3492 lines
5.1 MiB
3492 lines
5.1 MiB
/*
|
||
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 Usn=Object.create;var MY=Object.defineProperty;var Bsn=Object.getOwnPropertyDescriptor;var zsn=Object.getOwnPropertyNames;var Vsn=Object.getPrototypeOf,Hsn=Object.prototype.hasOwnProperty;var Iwt=t=>{throw TypeError(t)};var Jsn=(t,e,r)=>e in t?MY(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),Rn=(t,e)=>{for(var r in e)MY(t,r,{get:e[r],enumerable:!0})},Rwt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of zsn(e))!Hsn.call(t,o)&&o!==r&&MY(t,o,{get:()=>e[o],enumerable:!(n=Bsn(e,o))||n.enumerable});return t};var L=(t,e,r)=>(r=t!=null?Usn(Vsn(t)):{},Rwt(e||!t||!t.__esModule?MY(r,"default",{value:t,enumerable:!0}):r,t)),zfe=t=>Rwt(MY({},"__esModule",{value:!0}),t);var x=(t,e,r)=>Jsn(t,typeof e!="symbol"?e+"":e,r),Wsn=(t,e,r)=>e.has(t)||Iwt("Cannot "+r);var aqe=(t,e,r)=>e.has(t)?Iwt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var Awt=(t,e,r)=>(Wsn(t,e,"access private method"),r);function sqe(){if(!Vfe&&(Vfe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Vfe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Vfe(Ksn)}var Vfe,Ksn,Nwt=v(()=>{Ksn=new Uint8Array(16)});function jwt(t,e=0){return Wh[t[e+0]]+Wh[t[e+1]]+Wh[t[e+2]]+Wh[t[e+3]]+"-"+Wh[t[e+4]]+Wh[t[e+5]]+"-"+Wh[t[e+6]]+Wh[t[e+7]]+"-"+Wh[t[e+8]]+Wh[t[e+9]]+"-"+Wh[t[e+10]]+Wh[t[e+11]]+Wh[t[e+12]]+Wh[t[e+13]]+Wh[t[e+14]]+Wh[t[e+15]]}var Wh,Dwt=v(()=>{Wh=[];for(let t=0;t<256;++t)Wh.push((t+256).toString(16).slice(1))});var Gsn,uqe,$wt=v(()=>{Gsn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),uqe={randomUUID:Gsn}});function Xsn(t,e,r){if(uqe.randomUUID&&!e&&!t)return uqe.randomUUID();t=t||{};let n=t.random||(t.rng||sqe)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let o=0;o<16;++o)e[r+o]=n[o];return e}return jwt(n)}var Zm,Lwt=v(()=>{$wt();Nwt();Dwt();Zm=Xsn});var D$=v(()=>{Lwt()});var Zsn,Rt,Bo=v(()=>{Zsn=Object.defineProperty,Rt=(t,e)=>{for(var r in e)Zsn(t,r,{get:e[r],enumerable:!0})}});function IY(t,e=AB){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 Ysn(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 AB(t){try{return typeof t>"u"?null:Ysn(t)}catch{return null}}var RY=v(()=>{});function $$(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 AY=v(()=>{});var kwt=S((qbi,Fwt)=>{"use strict";Fwt.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 Jwt=S((Ubi,lqe)=>{"use strict";var Qsn=/[\p{Lu}]/u,eun=/[\p{Ll}]/u,qwt=/^[\p{Lu}](?![\p{Lu}])/gu,zwt=/([\p{Alpha}\p{N}_]|$)/u,Vwt=/[_.\- ]+/,tun=new RegExp("^"+Vwt.source),Uwt=new RegExp(Vwt.source+zwt.source,"gu"),Bwt=new RegExp("\\d+"+zwt.source,"gu"),run=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&Qsn.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&eun.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},nun=(t,e)=>(qwt.lastIndex=0,t.replace(qwt,r=>e(r))),oun=(t,e)=>(Uwt.lastIndex=0,Bwt.lastIndex=0,t.replace(Uwt,(r,n)=>e(n)).replace(Bwt,r=>e(r))),Hwt=(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=run(t,r,n)),t=t.replace(tun,""),e.preserveConsecutiveUppercase?t=nun(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),oun(t,n))};lqe.exports=Hwt;lqe.exports.default=Hwt});function Kwt(t,e){return e?.[t]||(0,Wwt.default)(t)}function Gwt(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var Wwt,iun,Xwt=v(()=>{Wwt=L(kwt(),1),iun=L(Jwt(),1)});function aun(t){return"lc"in t||Object.keys(t).length===1&&Zwt in t}function sun(t){return{[Zwt]:t}}function uun(t){return t!==null&&typeof t=="object"&&"lc_serializable"in t&&typeof t.toJSON=="function"}function lun(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 Hfe(t,e=new WeakSet){if(t!==null&&typeof t=="object"&&!Array.isArray(t)){if(e.has(t))return lun(t);if(uun(t))return t;e.add(t);let r=t;if(aun(r))return e.delete(t),sun(r);let n={};for(let[o,i]of Object.entries(r))n[o]=Hfe(i,e);return e.delete(t),n}return Array.isArray(t)?t.map(r=>Hfe(r,e)):t}var Zwt,Ywt=v(()=>{Zwt="__lc_escaped__"});function Qwt(t){return Array.isArray(t)?[...t]:{...t}}function dun(t,e){let r=Qwt(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]=Qwt(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function Jfe(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 cun,Kh,L$=v(()=>{Bo();Xwt();Ywt();cun={};Rt(cun,{Serializable:()=>Kh,get_lc_unique_name:()=>Jfe});Kh=class eSt{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,Jfe(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 eSt||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((u,l)=>(u[l]=l in this?this[l]:this.lc_kwargs[l],u),{});for(let u=Object.getPrototypeOf(this);u;u=Object.getPrototypeOf(u))Object.assign(e,Reflect.get(u,"lc_aliases",this)),Object.assign(r,Reflect.get(u,"lc_secrets",this)),Object.assign(n,Reflect.get(u,"lc_attributes",this));Object.keys(r).forEach(u=>{let l=this,c=n,[d,...f]=u.split(".").reverse();for(let p of f.reverse()){if(!(p in l)||l[p]===void 0)return;(!(p in c)||c[p]===void 0)&&(typeof l[p]=="object"&&l[p]!=null?c[p]={}:Array.isArray(l[p])&&(c[p]=[])),l=l[p],c=c[p]}d in l&&l[d]!==void 0&&(c[d]=c[d]||l[d])});let o={},i=new WeakSet;i.add(this);for(let[u,l]of Object.entries(n))o[u]=Hfe(l,i);let a=Object.keys(r).length?dun(o,r):o,s=Gwt(a,Kwt,e);return{lc:1,type:"constructor",id:this.lc_id,kwargs:s}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});function F$(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function tSt(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 H3,Wfe=v(()=>{H3=class extends Error{constructor(e,r){super(e);x(this,"output");this.output=r}}});var rSt,k$,nSt,q$,NY=v(()=>{rSt=Symbol.for("ls:tracing_async_local_storage"),k$=Symbol.for("lc:context_variables"),nSt=t=>{globalThis[rSt]=t},q$=()=>globalThis[rSt]});function Ym(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 J3(t){return Ym(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function W3(t){return Ym(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function oSt(t){return Ym(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function Kfe(t){return Ym(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function Gfe(t){if(Ym(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 jY(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 zg({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 Zx(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 DY=v(()=>{});function Mr(t,e){return yn(t)&&t.type===e}function yn(t){return typeof t=="object"&&t!==null}function Vg(t){return Array.isArray(t)}function St(t){return typeof t=="string"}function dv(t){return typeof t=="number"}function Xfe(t){return t instanceof Uint8Array}function cqe(t){try{return JSON.parse(t)}catch{return}}var zA,V0=v(()=>{zA=t=>t()});function fun(t){if(t.type==="char_location"&&St(t.document_title)&&dv(t.start_char_index)&&dv(t.end_char_index)&&St(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"&&St(t.document_title)&&dv(t.start_page_number)&&dv(t.end_page_number)&&St(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"&&St(t.document_title)&&dv(t.start_block_index)&&dv(t.end_block_index)&&St(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"&&St(t.url)&&St(t.title)&&St(t.encrypted_index)&&St(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"&&St(t.source)&&St(t.title)&&dv(t.start_block_index)&&dv(t.end_block_index)&&St(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 aSt(t){if(Mr(t,"document")&&yn(t.source)&&"type"in t.source){if(t.source.type==="base64"&&St(t.source.media_type)&&St(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&St(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&St(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&St(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(Mr(t,"image")&&yn(t.source)&&"type"in t.source){if(t.source.type==="base64"&&St(t.source.media_type)&&St(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&St(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&St(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function sSt(t){function*e(){for(let r of t){let n=aSt(r);n?yield n:yield r}}return Array.from(e())}function iSt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(Mr(n,"text")&&St(n.text)){let{text:o,citations:i,...a}=n;if(Vg(i)&&i.length){let s=i.reduce((u,l)=>{let c=fun(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(Mr(n,"thinking")&&St(n.thinking)){let{thinking:o,signature:i,...a}=n;yield{...a,type:"reasoning",reasoning:o,signature:i};continue}else if(Mr(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(Mr(n,"tool_use")&&St(n.name)&&St(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(Mr(n,"input_json_delta")){if(pun(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(Mr(n,"server_tool_use")&&St(n.name)&&St(n.id)){let{name:o,id:i}=n;if(o==="web_search"){let a=zA(()=>{if(typeof n.input=="string")return n.input;if(yn(n.input)&&St(n.input.query))return n.input.query;if(St(n.partial_json)){let s=cqe(n.partial_json);if(s?.query)return s.query}return""});yield{id:i,type:"server_tool_call",name:"web_search",args:{query:a}};continue}else if(n.name==="code_execution"){let a=zA(()=>{if(typeof n.input=="string")return n.input;if(yn(n.input)&&St(n.input.code))return n.input.code;if(St(n.partial_json)){let s=cqe(n.partial_json);if(s?.code)return s.code}return""});yield{id:i,type:"server_tool_call",name:"code_execution",args:{code:a}};continue}}else if(Mr(n,"web_search_tool_result")&&St(n.tool_use_id)&&Vg(n.content)){let{content:o,tool_use_id:i}=n,a=o.reduce((s,u)=>Mr(u,"web_search_result")?[...s,u.url]:s,[]);yield{type:"server_tool_call_result",name:"web_search",toolCallId:i,status:"success",output:{urls:a}};continue}else if(Mr(n,"code_execution_tool_result")&&St(n.tool_use_id)&&yn(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(Mr(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(Mr(n,"mcp_tool_result")&&St(n.tool_use_id)&&yn(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(Mr(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(Mr(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(Mr(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let o=aSt(n);if(o){yield o;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}function pun(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}var uSt,dqe=v(()=>{V0();uSt={translateContent:iSt,translateContentChunk:iSt}});function mun(t){return J3(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:W3(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:Kfe(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function lSt(t){return t.map(mun)}function cSt(t){return!!(Mr(t,"image_url")&&yn(t.image_url)||Mr(t,"input_audio")&&yn(t.input_audio)||Mr(t,"file")&&yn(t.file))}function dSt(t){if(Mr(t,"image_url")&&yn(t.image_url)&&St(t.image_url.url)){let e=zg({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(Mr(t,"input_audio")&&yn(t.input_audio)&&St(t.input_audio.data)&&St(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(Mr(t,"file")&&yn(t.file)&&St(t.file.data)){let e=zg({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(St(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}var fqe=v(()=>{DY();V0()});function hun(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...Zfe(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 gun(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...Zfe(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 Zfe(t){let e=[];for(let r of t)cSt(r)?e.push(dSt(r)):e.push(r);return e}function yun(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 fSt(t){function*e(){yn(t.additional_kwargs?.reasoning)&&Vg(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((o,i)=>yn(i)&&St(i.text)?`${o}${i.text}`:o,"")});let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r)if(Mr(n,"text")){let{text:o,annotations:i,...a}=n;Array.isArray(i)?yield{...a,type:"text",text:String(o),annotations:i.map(yun)}: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(yn(t.additional_kwargs)&&Vg(t.additional_kwargs.tool_outputs))for(let n of t.additional_kwargs.tool_outputs){if(Mr(n,"web_search_call")){yield{id:n.id,type:"server_tool_call",name:"web_search",args:{query:n.query}};continue}else if(Mr(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{query:n.query}};continue}else if(Mr(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(Mr(n,"code_interpreter_call")){if(St(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Vg(n.outputs)){let o=zA(()=>{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(Mr(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(Mr(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(Mr(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(Mr(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(Mr(n,"image_generation_call")){yield{type:"non_standard",value:n};continue}yn(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function bun(t){function*e(){yield*fSt(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 pSt,pqe=v(()=>{V0();fqe();pSt={translateContent:t=>typeof t.content=="string"?hun(t):fSt(t),translateContentChunk:t=>typeof t.content=="string"?gun(t):bun(t)}});function Yfe(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var mqe=v(()=>{});function mSt(t,e="pretty"){return e==="pretty"?_un(t):JSON.stringify(t)}function _un(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 hSt=v(()=>{});function Hg(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=>Ym(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?NB(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Ym(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function Qfe(t,e){return t==="error"||e==="error"?"error":"success"}function vun(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 ySt(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}function El(t,e){if(t===void 0&&e===void 0)return;if(t===void 0||e===void 0)return t??e;let r={...t};for(let[n,o]of Object.entries(e))if(r[n]==null)r[n]=o;else{if(o==null)continue;if(typeof r[n]!=typeof o||Array.isArray(r[n])!==Array.isArray(o))throw new Error(`field[${n}] already exists in the message chunk, but with a different type.`);if(typeof r[n]=="string"){if(n==="type")continue;["id","name","output_version","model_provider"].includes(n)?o&&(r[n]=o):r[n]+=o}else if(typeof r[n]=="number")r[n]=r[n]+o;else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=El(r[n],o);else if(Array.isArray(r[n]))r[n]=NB(r[n],o);else{if(r[n]===o)continue;console.warn(`field[${n}] already exists in this message chunk and value has unsupported type.`)}}return r}function NB(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)return t||e;{let r=[...t];for(let n of e)if(typeof n=="object"&&n!==null&&"index"in n&&typeof n.index=="number"){let o=r.findIndex(i=>{let a=typeof i=="object",s="index"in i&&i.index===n.index,u="id"in i&&"id"in n&&i?.id===n?.id,l=!("id"in i)||!i?.id||!("id"in n)||!n?.id;return a&&s&&(u||l)});o!==-1&&typeof r[o]=="object"&&r[o]!==null?r[o]=El(r[o],n):r.push(n)}else{if(typeof n=="object"&&n!==null&&"text"in n&&n.text==="")continue;r.push(n)}return r}}}function epe(t,e){if(!(t===void 0&&e===void 0)){if(t===void 0||e===void 0)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 NB(t,e);if(typeof t=="object"&&typeof e=="object")return El(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
|
||
Left ${t}
|
||
Right ${e}`)}}function tpe(t){return typeof t.role=="string"}function Gh(t){return typeof t?._getType=="function"}function K3(t){return Jy.isInstance(t)}var hqe,gSt,Uc,Jy,Jg=v(()=>{L$();DY();dqe();fqe();pqe();mqe();hSt();hqe=Symbol.for("langchain.message");Uc=class extends Kh{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,gSt,!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[lSt,Zfe,sSt].reduce((o,i)=>i(o),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&&hqe in e&&e[hqe]===!0&&Yfe(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[(gSt=hqe,Symbol.toStringTag)](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let r=vun(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}toFormattedString(e="pretty"){return mSt(this,e)}};Jy=class bSt extends Uc{static isInstance(e){if(!super.isInstance(e))return!1;let r=Object.getPrototypeOf(e);for(;r!==null;){if(r===bSt.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}}});function $Y(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function LY(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 FY(t){return typeof t=="object"&&t!==null&&"getType"in t&&typeof t.getType=="function"&&t.getType()==="tool"}function gqe(t){return t._getType()==="tool"}var wun,Wg,Iw,G3=v(()=>{Bo();Jg();wun={};Rt(wun,{ToolMessage:()=>Wg,ToolMessageChunk:()=>Iw,defaultToolCallParser:()=>LY,isDirectToolOutput:()=>$Y,isToolMessage:()=>FY,isToolMessageChunk:()=>gqe});Wg=class extends Uc{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}}},Iw=class extends Jy{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:Hg(this.content,e.content),additional_kwargs:El(this.additional_kwargs,e.additional_kwargs),response_metadata:El(this.response_metadata,e.response_metadata),artifact:epe(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:Qfe(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function vSt(t){return t._getType()==="generic"}function wSt(t){return t._getType()==="generic"}var nd,fv,kY=v(()=>{Jg();nd=class _St extends Uc{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 _St}static isInstance(r){return super.isInstance(r)&&r.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},fv=class extends Jy{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:Hg(this.content,e.content),additional_kwargs:El(this.additional_kwargs,e.additional_kwargs),response_metadata:El(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}}}});function SSt(t){return t._getType()==="function"}function CSt(t){return t._getType()==="function"}var jB,pv,rpe=v(()=>{Jg();jB=class extends Uc{constructor(e){super(e);x(this,"type","function");x(this,"name");this.name=e.name}static lc_name(){return"FunctionMessage"}},pv=class extends Jy{constructor(){super(...arguments);x(this,"type","function")}static lc_name(){return"FunctionMessageChunk"}concat(e){let r=this.constructor;return new r({content:Hg(this.content,e.content),additional_kwargs:El(this.additional_kwargs,e.additional_kwargs),response_metadata:El(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});function xSt(t){return t.getType()==="human"}function OSt(t){return t.getType()==="human"}var Hs,mv,U$=v(()=>{Jg();Hs=class extends Uc{constructor(e){super(e);x(this,"type","human")}static lc_name(){return"HumanMessage"}static isInstance(e){return super.isInstance(e)&&e.type==="human"}},mv=class extends Jy{constructor(e){super(e);x(this,"type","human")}static lc_name(){return"HumanMessageChunk"}concat(e){let r=this.constructor;return new r({content:Hg(this.content,e.content),additional_kwargs:El(this.additional_kwargs,e.additional_kwargs),response_metadata:El(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="human"}}});var DB,npe=v(()=>{Jg();DB=class extends Uc{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"}}});function TSt(t){return t._getType()==="system"}function ESt(t){return t._getType()==="system"}var Qm,Wy,qY=v(()=>{Jg();Qm=class ope extends Uc{constructor(r){super(r);x(this,"type","system")}static lc_name(){return"SystemMessage"}concat(r){if(typeof r=="string")return new ope({...this,content:Hg(this.content,r)});if(ope.isInstance(r))return new ope({...this,additional_kwargs:{...this.additional_kwargs,...r.additional_kwargs},response_metadata:{...this.response_metadata,...r.response_metadata},content:Hg(this.content,r.content)});throw new Error("Unexpected chunk type for system message")}static isInstance(r){return super.isInstance(r)&&r.type==="system"}},Wy=class extends Jy{constructor(e){super(e);x(this,"type","system")}static lc_name(){return"SystemMessageChunk"}concat(e){let r=this.constructor;return new r({content:Hg(this.content,e.content),additional_kwargs:El(this.additional_kwargs,e.additional_kwargs),response_metadata:El(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="system"}}});function yqe(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 Sun(t){if(yn(t.document)&&yn(t.document.source)){let e=yn(t.document)&&St(t.document.format)?t.document.format:"",r=yqe(e);if(yn(t.document.source)){if(yn(t.document.source.s3Location)&&St(t.document.source.s3Location.uri))return{type:"file",mimeType:r,fileId:t.document.source.s3Location.uri};if(Xfe(t.document.source.bytes))return{type:"file",mimeType:r,data:t.document.source.bytes};if(St(t.document.source.text))return{type:"file",mimeType:r,data:Buffer.from(t.document.source.text).toString("base64")};if(Vg(t.document.source.content)){let n=t.document.source.content.reduce((o,i)=>yn(i)&&St(i.text)?o+i.text:o,"");return{type:"file",mimeType:r,data:n}}}}return{type:"non_standard",value:t}}function Cun(t){if(Mr(t,"image")&&yn(t.image)){let e=yn(t.image)&&St(t.image.format)?t.image.format:"",r=yqe(e);if(yn(t.image.source)){if(yn(t.image.source.s3Location)&&St(t.image.source.s3Location.uri))return{type:"image",mimeType:r,fileId:t.image.source.s3Location.uri};if(Xfe(t.image.source.bytes))return{type:"image",mimeType:r,data:t.image.source.bytes}}}return{type:"non_standard",value:t}}function xun(t){if(Mr(t,"video")&&yn(t.video)){let e=yn(t.video)&&St(t.video.format)?t.video.format:"",r=yqe(e);if(yn(t.video.source)){if(yn(t.video.source.s3Location)&&St(t.video.source.s3Location.uri))return{type:"video",mimeType:r,fileId:t.video.source.s3Location.uri};if(Xfe(t.video.source.bytes))return{type:"video",mimeType:r,data:t.video.source.bytes}}}return{type:"non_standard",value:t}}function PSt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(Mr(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(Mr(n,"citations_content")&&yn(n.citationsContent)){let o=Vg(n.citationsContent.content)?n.citationsContent.content.reduce((a,s)=>yn(s)&&St(s.text)?a+s.text:a,""):"",i=Vg(n.citationsContent.citations)?n.citationsContent.citations.reduce((a,s)=>{if(yn(s)){let u=Vg(s.sourceContent)?s.sourceContent.reduce((c,d)=>yn(d)&&St(d.text)?c+d.text:c,""):"",l=zA(()=>{if(yn(s.location)){let c=s.location.documentChar||s.location.documentPage||s.location.documentChunk;if(yn(c))return{source:dv(c.documentIndex)?c.documentIndex.toString():void 0,startIndex:dv(c.start)?c.start:void 0,endIndex:dv(c.end)?c.end:void 0}}return{}});a.push({type:"citation",citedText:u,...l})}return a},[]):[];yield{type:"text",text:o,annotations:i};continue}else if(Mr(n,"document")&&yn(n.document)){yield Sun(n);continue}else if(Mr(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(Mr(n,"image")&&yn(n.image)){yield Cun(n);continue}else if(Mr(n,"reasoning_content")&&St(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(Mr(n,"text")&&St(n.text)){yield{type:"text",text:n.text};continue}else if(Mr(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(Mr(n,"tool_call"))continue;if(Mr(n,"video")&&yn(n.video)){yield xun(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var MSt,ISt=v(()=>{V0();MSt={translateContent:PSt,translateContentChunk:PSt}});function RSt(t){let e=[],r=t.additional_kwargs?.reasoning_content;if(St(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&&St(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 ASt,NSt=v(()=>{V0();ASt={translateContent:RSt,translateContentChunk:RSt}});function jSt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(Mr(n,"text")&&St(n.text)){yield{type:"text",text:n.text};continue}else if(Mr(n,"thinking")&&St(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(Mr(n,"inlineData")&&yn(n.inlineData)&&St(n.inlineData.mimeType)&&St(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(Mr(n,"functionCall")&&yn(n.functionCall)&&St(n.functionCall.name)&&yn(n.functionCall.args)){yield{type:"tool_call",id:t.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(Mr(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(Mr(n,"fileData")&&yn(n.fileData)&&St(n.fileData.mimeType)&&St(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(Mr(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(Mr(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var DSt,$St=v(()=>{V0();DSt={translateContent:jSt,translateContentChunk:jSt}});function LSt(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(Mr(n,"reasoning")&&St(n.reasoning)){let o=zA(()=>{let i=r.indexOf(n);if(Vg(t.additional_kwargs?.signatures)&&i>=0)return t.additional_kwargs.signatures.at(i)});St(o)?yield{type:"reasoning",reasoning:n.reasoning,signature:o}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(Mr(n,"thinking")&&St(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(Mr(n,"text")&&St(n.text)){yield{type:"text",text:n.text};continue}else if(Mr(n,"image_url")){if(St(n.image_url))if(n.image_url.startsWith("data:")){let o=/^data:([^;]+);base64,(.+)$/,i=n.image_url.match(o);i?yield{type:"image",data:i[2],mimeType:i[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(Mr(n,"media")&&St(n.mimeType)&&St(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var FSt,kSt=v(()=>{V0();FSt={translateContent:LSt,translateContentChunk:LSt}});function qSt(t){let e=[],r=t.additional_kwargs?.reasoning;if(St(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&&St(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 USt,BSt=v(()=>{V0();USt={translateContent:qSt,translateContentChunk:qSt}});function zSt(t){let e=[],r=t.additional_kwargs?.reasoning_content;if(St(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&&St(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 VSt,HSt=v(()=>{V0();VSt={translateContent:zSt,translateContentChunk:zSt}});function JSt(t){let e=[];if(yn(t.additional_kwargs?.reasoning)){let n=t.additional_kwargs.reasoning;if(Vg(n.summary)){let o=n.summary.reduce((i,a)=>yn(a)&&St(a.text)?`${i}${a.text}`:i,"");o.length>0&&e.push({type:"reasoning",reasoning:o})}}let r=t.additional_kwargs?.reasoning_content;if(St(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&&St(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 WSt,KSt=v(()=>{V0();WSt={translateContent:JSt,translateContentChunk:JSt}});function bqe(t){return globalThis.lc_block_translators_registry.get(t)}var GSt=v(()=>{dqe();pqe();ISt();NSt();$St();kSt();BSt();HSt();KSt();globalThis.lc_block_translators_registry??(globalThis.lc_block_translators_registry=new Map([["anthropic",uSt],["bedrock-converse",MSt],["deepseek",ASt],["google-genai",DSt],["google-vertexai",FSt],["groq",USt],["ollama",VSt],["openai",pSt],["xai",WSt]]))});function ipe(t,e){return El(t,e)??{}}function XSt(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 Oun(t,e){let r={...XSt(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 Tun(t,e){let r={...XSt(t,e)};return(t?.reasoning!==void 0||e?.reasoning!==void 0)&&(r.reasoning=(t?.reasoning??0)+(e?.reasoning??0)),r}function X3(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:Oun(t?.input_token_details,e?.input_token_details),output_token_details:Tun(t?.output_token_details,e?.output_token_details)}}var ape=v(()=>{Jg()});function Pl(t){return t._getType()==="ai"}function UY(t){return t._getType()==="ai"}var eo,Ir,Rw=v(()=>{Jg();GSt();ape();G3();H0();eo=class extends Uc{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]=LY(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"}}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=bqe(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"}};Ir=class extends Jy{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=spe(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"}}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=bqe(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:Hg(this.content,e.content),additional_kwargs:El(this.additional_kwargs,e.additional_kwargs),response_metadata:ipe(this.response_metadata,e.response_metadata),tool_call_chunks:[],id:this.id??e.id};if(this.tool_call_chunks!==void 0||e.tool_call_chunks!==void 0){let o=NB(this.tool_call_chunks,e.tool_call_chunks);o!==void 0&&o.length>0&&(r.tool_call_chunks=o)}(this.usage_metadata!==void 0||e.usage_metadata!==void 0)&&(r.usage_metadata=X3(this.usage_metadata,e.usage_metadata));let n=this.constructor;return new n(r)}static isInstance(e){return super.isInstance(e)&&e.type==="ai"}}});function Eun(t){return F$(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 Pun(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function _qe(t){let e,r;if(Pun(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 Hs(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new eo(r);let i=n.map(Eun);return new eo({...o,tool_calls:i})}else{if(e==="system")return new Qm(r);if(e==="developer")return new Qm({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new Wg({...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 DB({...r,id:r.id});throw $$(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 Aw(t){if(typeof t=="string")return new Hs(t);if(Gh(t))return t;if(Array.isArray(t)){let[e,r]=t;return _qe({type:e,content:r})}else if(tpe(t)){let{role:e,...r}=t;return _qe({...r,type:e})}else return _qe(t)}function ol(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 Mun(t){if(t.data!==void 0)return t;{let e=t;return{type:e.type,data:{content:e.text,role:e.role,name:void 0,tool_call_id:void 0}}}}function BY(t){let e=Mun(t);switch(e.type){case"human":return new Hs(e.data);case"ai":return new eo(e.data);case"system":return new Qm(e.data);case"function":if(e.data.name===void 0)throw new Error("Name must be defined for function messages");return new jB(e.data);case"tool":if(e.data.tool_call_id===void 0)throw new Error("Tool call ID must be defined for tool messages");return new Wg(e.data);case"generic":if(e.data.role===void 0)throw new Error("Role must be defined for chat messages");return new nd(e.data);default:throw new Error(`Got unexpected type: ${e.type}`)}}function ZSt(t){return t.map(BY)}function YSt(t){return t.map(e=>e.toDict())}function $B(t){let e=t._getType();if(e==="human")return new mv({...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 Ir({...r})}else{if(e==="system")return new Wy({...t});if(e==="function")return new pv({...t});if(nd.isInstance(t))return new fv({...t});throw new Error("Unknown message type.")}}function spe(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=AB(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 upe,H0=v(()=>{Jg();G3();AY();Wfe();RY();kY();rpe();U$();npe();qY();Rw();upe=t=>t()});function wqe(){return vqe===void 0&&(vqe={library:"langchain-js",runtime:cpe()}),vqe}function vn(t){try{return typeof process<"u"?process.env?.[t]:lpe()?Deno?.env.get(t):void 0}catch{return}}var Iun,QSt,e0t,t0t,lpe,r0t,cpe,vqe,ku=v(()=>{Bo();Iun={};Rt(Iun,{getEnv:()=>cpe,getEnvironmentVariable:()=>vn,getRuntimeEnvironment:()=>wqe,isBrowser:()=>QSt,isDeno:()=>lpe,isJsDom:()=>t0t,isNode:()=>r0t,isWebWorker:()=>e0t});QSt=()=>typeof window<"u"&&typeof window.document<"u",e0t=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",t0t=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),lpe=()=>typeof Deno<"u",r0t=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!lpe(),cpe=()=>{let t;return QSt()?t="browser":r0t()?t="node":e0t()?t="webworker":t0t()?t="jsdom":lpe()?t="deno":t="other",t}});var n0t,o0t=v(()=>{n0t=/^(?:[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 Run(t){return typeof t=="string"&&n0t.test(t)}var Z3,i0t=v(()=>{o0t();Z3=Run});function fpe(t,e=0){return(Xh[t[e+0]]+Xh[t[e+1]]+Xh[t[e+2]]+Xh[t[e+3]]+"-"+Xh[t[e+4]]+Xh[t[e+5]]+"-"+Xh[t[e+6]]+Xh[t[e+7]]+"-"+Xh[t[e+8]]+Xh[t[e+9]]+"-"+Xh[t[e+10]]+Xh[t[e+11]]+Xh[t[e+12]]+Xh[t[e+13]]+Xh[t[e+14]]+Xh[t[e+15]]).toLowerCase()}var Xh,dpe,Sqe=v(()=>{Xh=[];for(dpe=0;dpe<256;++dpe)Xh.push((dpe+256).toString(16).slice(1))});function zY(){if(!ppe&&(ppe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ppe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ppe(Aun)}var ppe,Aun,Cqe=v(()=>{Aun=new Uint8Array(16)});var Nun,xqe,a0t=v(()=>{Nun=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xqe={randomUUID:Nun}});function jun(t,e,r){if(xqe.randomUUID&&!e&&!t)return xqe.randomUUID();t=t||{};var n=t.random||(t.rng||zY)();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 fpe(n)}var VY,s0t=v(()=>{a0t();Cqe();Sqe();VY=jun});function Dun(t,e,r){t=t||{};var n=e&&r||0,o=e||new Uint8Array(16),i=t.random||(t.rng||zY)(),a=t.msecs!==void 0?t.msecs:Date.now(),s=t.seq!==void 0?t.seq:null,u=l0t,l=u0t;return a>J0&&t.msecs===void 0&&(J0=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>J0&&s===null?++l>524287&&(l=0,++u>4095&&(u=0,J0++)):J0=a,l0t=u,u0t=l,o[n++]=J0/1099511627776&255,o[n++]=J0/4294967296&255,o[n++]=J0/16777216&255,o[n++]=J0/65536&255,o[n++]=J0/256&255,o[n++]=J0&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||fpe(o)}var u0t,l0t,J0,Yx,c0t=v(()=>{Cqe();Sqe();u0t=null,l0t=null,J0=0;Yx=Dun});var HY=v(()=>{s0t();c0t();i0t()});function JY(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var Lun,Fun,LB,Oqe,WY=v(()=>{Bo();L$();ku();HY();Lun={};Rt(Lun,{BaseCallbackHandler:()=>LB,callbackHandlerPrefersStreaming:()=>JY,isBaseCallbackHandler:()=>Oqe});Fun=class{};LB=class extends Fun{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",vn("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,Jfe(this.constructor)]}copy(){return new this.constructor(this)}toJSON(){return Kh.prototype.toJSON.call(this)}toJSONNotImplemented(){return Kh.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends LB{constructor(){super();x(this,"name",Yx());Object.assign(this,e)}}return new r}},Oqe=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});var d0t,f0t=v(()=>{d0t=/^(?:[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 kun(t){return typeof t=="string"&&d0t.test(t)}var p0t,m0t=v(()=>{f0t();p0t=kun});function qun(t){if(!p0t(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 h0t,g0t=v(()=>{m0t();h0t=qun});function Y3(t,e=0){return(Zh[t[e+0]]+Zh[t[e+1]]+Zh[t[e+2]]+Zh[t[e+3]]+"-"+Zh[t[e+4]]+Zh[t[e+5]]+"-"+Zh[t[e+6]]+Zh[t[e+7]]+"-"+Zh[t[e+8]]+Zh[t[e+9]]+"-"+Zh[t[e+10]]+Zh[t[e+11]]+Zh[t[e+12]]+Zh[t[e+13]]+Zh[t[e+14]]+Zh[t[e+15]]).toLowerCase()}var Zh,mpe,hpe=v(()=>{Zh=[];for(mpe=0;mpe<256;++mpe)Zh.push((mpe+256).toString(16).slice(1))});function KY(){if(!gpe&&(gpe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!gpe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gpe(Uun)}var gpe,Uun,Tqe=v(()=>{Uun=new Uint8Array(16)});function zun(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}function Eqe(t,e,r){function n(o,i,a,s){var u;if(typeof o=="string"&&(o=zun(o)),typeof i=="string"&&(i=h0t(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 Y3(l)}try{n.name=t}catch{}return n.DNS=Vun,n.URL=Hun,n}var Vun,Hun,y0t=v(()=>{hpe();g0t();Vun="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Hun="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var Jun,Pqe,b0t=v(()=>{Jun=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Pqe={randomUUID:Jun}});function Wun(t,e,r){if(Pqe.randomUUID&&!e&&!t)return Pqe.randomUUID();t=t||{};var n=t.random||(t.rng||KY)();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 Y3(n)}var FB,_0t=v(()=>{b0t();Tqe();hpe();FB=Wun});function Kun(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 Mqe(t,e){return t<<e|t>>>32-e}function Gun(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]=Mqe(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 O=Math.floor(w/20),T=Mqe(h,5)+Kun(O,y,g,b)+_+e[O]+f[w]>>>0;_=b,b=g,g=Mqe(y,30)>>>0,y=h,h=T}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 v0t,w0t=v(()=>{v0t=Gun});var Xun,kB,S0t=v(()=>{y0t();w0t();Xun=Eqe("v5",80,v0t),kB=Xun});function Zun(t,e,r){t=t||{};var n=e&&r||0,o=e||new Uint8Array(16),i=t.random||(t.rng||KY)(),a=t.msecs!==void 0?t.msecs:Date.now(),s=t.seq!==void 0?t.seq:null,u=x0t,l=C0t;return a>W0&&t.msecs===void 0&&(W0=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>W0&&s===null?++l>524287&&(l=0,++u>4095&&(u=0,W0++)):W0=a,x0t=u,C0t=l,o[n++]=W0/1099511627776&255,o[n++]=W0/4294967296&255,o[n++]=W0/16777216&255,o[n++]=W0/65536&255,o[n++]=W0/256&255,o[n++]=W0&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||Y3(o)}var C0t,x0t,W0,Iqe,O0t=v(()=>{Tqe();hpe();C0t=null,x0t=null,W0=0;Iqe=Zun});var ype=v(()=>{_0t();S0t();O0t()});var T0t,E0t,Rqe,P0t,Aqe,Nqe,jqe,M0t,I0t,R0t,A0t,N0t,j0t,D0t,$0t,L0t,F0t,k0t,q0t,U0t,B0t,z0t,V0t,H0t,J0t,W0t,K0t,G0t,X0t,Z0t,Dqe,Y0t,Q0t,eCt=v(()=>{T0t="gen_ai.operation.name",E0t="gen_ai.system",Rqe="gen_ai.request.model",P0t="gen_ai.response.model",Aqe="gen_ai.usage.input_tokens",Nqe="gen_ai.usage.output_tokens",jqe="gen_ai.usage.total_tokens",M0t="gen_ai.request.max_tokens",I0t="gen_ai.request.temperature",R0t="gen_ai.request.top_p",A0t="gen_ai.request.frequency_penalty",N0t="gen_ai.request.presence_penalty",j0t="gen_ai.response.finish_reasons",D0t="gen_ai.prompt",$0t="gen_ai.completion",L0t="gen_ai.request.extra_query",F0t="gen_ai.request.extra_body",k0t="gen_ai.serialized.name",q0t="gen_ai.serialized.signature",U0t="gen_ai.serialized.doc",B0t="gen_ai.response.id",z0t="gen_ai.response.service_tier",V0t="gen_ai.response.system_fingerprint",H0t="gen_ai.usage.input_token_details",J0t="gen_ai.usage.output_token_details",W0t="langsmith.trace.session_id",K0t="langsmith.trace.session_name",G0t="langsmith.span.kind",X0t="langsmith.trace.name",Z0t="langsmith.metadata",Dqe="langsmith.span.tags",Y0t="langsmith.request.streaming",Q0t="langsmith.request.headers"});var eln,tCt,rCt,nCt,$qe=v(()=>{VA();eln=(...t)=>fetch(...t),tCt=Symbol.for("ls:fetch_implementation"),rCt=()=>{let t=globalThis[tCt];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},nCt=t=>async(...e)=>{if(t||od("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[tCt]??eln)(...e);return(t||od("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var GY,Lqe=v(()=>{VA();GY=()=>od("PROJECT")??hv("LANGCHAIN_SESSION")??"default"});function XY(t){oCt[t]||(console.warn(t),oCt[t]=!0)}var oCt,bpe=v(()=>{oCt={}});function Po(t,e){if(!tln.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}function _pe(t){let e=typeof t=="string"?Date.parse(t):t;return Iqe({msecs:e,seq:0})}var tln,vpe=v(()=>{ype();bpe();tln=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var iCt=v(()=>{vpe()});function aCt(t,e){throw new Error("dump() is not supported in browser environments.")}function sCt(t){throw new Error("load() is not supported in browser environments.")}var uCt=v(()=>{});function rln(t,e){return e===null?!1:Date.now()-t.createdAt>e*1e3}var ZY,Fqe=v(()=>{uCt();ZY=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,"fetchFunc",{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.maxSize=e.maxSize??100,this.ttlSeconds=e.ttlSeconds??3600,this.refreshIntervalSeconds=e.refreshIntervalSeconds??60,this.fetchFunc=e.fetchFunc,this.fetchFunc&&this.ttlSeconds!==null&&this.startRefreshLoop()}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){let r=this.cache.get(e);if(!r){this._metrics.misses+=1;return}return this.cache.delete(e),this.cache.set(e,r),this._metrics.hits+=1,r.value}set(e,r){if(!this.cache.has(e)&&this.cache.size>=this.maxSize){let o=this.cache.keys().next().value;o!==void 0&&this.cache.delete(o)}let n={value:r,createdAt:Date.now()};this.cache.delete(e),this.cache.set(e,n)}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;aCt(e,r)}load(e){let r=sCt(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.refreshTimer=setInterval(()=>{this.refreshStaleEntries().catch(e=>{console.warn("Unexpected error in cache refresh loop:",e)})},this.refreshIntervalSeconds*1e3),this.refreshTimer.unref&&this.refreshTimer.unref()}getStaleKeys(){let e=[];for(let[r,n]of this.cache.entries())rln(n,this.ttlSeconds)&&e.push(r);return e}async refreshStaleEntries(){if(!this.fetchFunc)return;let e=this.getStaleKeys();if(e.length!==0)for(let r of e)try{let n=await this.fetchFunc(r);this.set(r,n),this._metrics.refreshes+=1}catch(n){this._metrics.refreshErrors+=1,console.warn(`Failed to refresh cache entry ${r}:`,n)}}}});var wpe,Spe=v(()=>{kqe();qqe();$qe();Lqe();iCt();Fqe();wpe="0.4.6"});function Cpe(){if(Uqe===void 0){let t=zqe(),e=uln();Uqe={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:wpe,...e}}return Uqe}function Vqe(){let t=sln(),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 sln(){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 hv(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function od(t){return hv(`LANGSMITH_${t}`)||hv(`LANGCHAIN_${t}`)}function uln(){if(Bqe!==void 0)return Bqe;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=hv(r);n!==void 0&&(e[r]=n)}return Bqe=e,e}function xpe(){return hv("OTEL_ENABLED")==="true"||od("OTEL_ENABLED")==="true"}var Qx,nln,oln,iln,lCt,aln,zqe,Uqe,Bqe,VA=v(()=>{Spe();nln=()=>typeof window<"u"&&typeof window.document<"u",oln=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",iln=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),lCt=()=>typeof Deno<"u",aln=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!lCt(),zqe=()=>Qx||(typeof Bun<"u"?Qx="bun":nln()?Qx="browser":aln()?Qx="node":oln()?Qx="webworker":iln()?Qx="jsdom":lCt()?Qx="deno":Qx="other",Qx)});function Ope(){return Zqe.getTraceInstance()}function dCt(){return Zqe.getContextInstance()}function fCt(){return Zqe.getDefaultOTLPTracerComponents()}var Wqe,Kqe,Gqe,Hqe,Jqe,cCt,lln,cln,Xqe,Zqe,Yqe=v(()=>{VA();Wqe=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&xpe()&&(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()}},Kqe=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new Wqe})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},Gqe=class{active(){return{}}with(e,r){return r()}},Hqe=Symbol.for("ls:otel_trace"),Jqe=Symbol.for("ls:otel_context"),cCt=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),lln=new Kqe,cln=new Gqe,Xqe=class{getTraceInstance(){return globalThis[Hqe]??lln}getContextInstance(){return globalThis[Jqe]??cln}initializeGlobalInstances(e){globalThis[Hqe]===void 0&&(globalThis[Hqe]=e.trace),globalThis[Jqe]===void 0&&(globalThis[Jqe]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[cCt]=e}getDefaultOTLPTracerComponents(){return globalThis[cCt]??void 0}},Zqe=new Xqe});function fln(t){return dln[t]||t}var dln,Tpe,pCt=v(()=>{eCt();Yqe();dln={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};Tpe=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&&Ope().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(G0t,r.run_type);let s=fln(r.run_type||"chain");e.setAttribute(T0t,s)}"name"in r&&r.name&&e.setAttribute(X0t,r.name),"session_id"in r&&r.session_id&&e.setAttribute(W0t,r.session_id),"session_name"in r&&r.session_name&&e.setAttribute(K0t,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(Rqe,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(Aqe,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(Nqe,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(jqe,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[s,u]of Object.entries(i))u!=null&&e.setAttribute(`${Z0t}.${s}`,String(u));let a=r.tags;if(a&&Array.isArray(a)?e.setAttribute(Dqe,a.join(", ")):a&&e.setAttribute(Dqe,String(a)),"serialized"in r&&typeof r.serialized=="object"){let s=r.serialized;s.name&&e.setAttribute(k0t,String(s.name)),s.signature&&e.setAttribute(q0t,String(s.signature)),s.doc&&e.setAttribute(U0t,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(E0t,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(M0t,n.max_tokens),n.temperature!==void 0&&e.setAttribute(I0t,n.temperature),n.top_p!==void 0&&e.setAttribute(R0t,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(A0t,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(N0t,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(Rqe,n.model),n.stream!==void 0&&e.setAttribute(Y0t,n.stream),n.extra_headers&&e.setAttribute(Q0t,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(L0t,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(F0t,JSON.stringify(n.extra_body))),e.setAttribute(D0t,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(Aqe,o[0]),e.setAttribute(Nqe,o[1]),e.setAttribute(jqe,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(P0t,String(n.model)),n.id&&e.setAttribute(B0t,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(j0t,i.join(", "))}if(n.service_tier&&e.setAttribute(z0t,n.service_tier),n.system_fingerprint&&e.setAttribute(V0t,n.system_fingerprint),n.usage_metadata&&typeof n.usage_metadata=="object"){let i=n.usage_metadata;i.input_token_details&&e.setAttribute(H0t,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(J0t,JSON.stringify(i.output_token_details))}}e.setAttribute($0t,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 Qqe(t){if(!(t&&mln(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:hln.has(r)}var pln,mln,hln,mCt=v(()=>{pln=Object.prototype.toString,mln=t=>pln.call(t)==="[object Error]",hln=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 gln(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 Epe(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 yln(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 hCt(t,e){return Number.isFinite(e)?e-(performance.now()-t):e}async function bln({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 eUe)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),hCt(n,s)<=0)throw i;let l=await o.shouldConsumeRetry(u),c=hCt(n,s);if(c<=0||a<=0)throw i;if(i instanceof TypeError&&!Qqe(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=yln(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 tUe(t,e={}){if(e={...e},gln(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),Epe("factor",e.factor,{min:0,allowInfinity:!1}),Epe("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),Epe("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),Epe("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 bln({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var eUe,gCt=v(()=>{mCt();eUe=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 nUe=S((hSi,rUe)=>{"use strict";var _ln=Object.prototype.hasOwnProperty,Ky="~";function YY(){}Object.create&&(YY.prototype=Object.create(null),new YY().__proto__||(Ky=!1));function vln(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function yCt(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new vln(r,n||t,o),a=Ky?Ky+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 Ppe(t,e){--t._eventsCount===0?t._events=new YY:delete t._events[e]}function Kg(){this._events=new YY,this._eventsCount=0}Kg.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)_ln.call(r,n)&&e.push(Ky?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Kg.prototype.listeners=function(e){var r=Ky?Ky+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};Kg.prototype.listenerCount=function(e){var r=Ky?Ky+e:e,n=this._events[r];return n?n.fn?1:n.length:0};Kg.prototype.emit=function(e,r,n,o,i,a){var s=Ky?Ky+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};Kg.prototype.on=function(e,r,n){return yCt(this,e,r,n,!1)};Kg.prototype.once=function(e,r,n){return yCt(this,e,r,n,!0)};Kg.prototype.removeListener=function(e,r,n,o){var i=Ky?Ky+e:e;if(!this._events[i])return this;if(!r)return Ppe(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&Ppe(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:Ppe(this,i)}return this};Kg.prototype.removeAllListeners=function(e){var r;return e?(r=Ky?Ky+e:e,this._events[r]&&Ppe(this,r)):(this._events=new YY,this._eventsCount=0),this};Kg.prototype.off=Kg.prototype.removeListener;Kg.prototype.addListener=Kg.prototype.on;Kg.prefixed=Ky;Kg.EventEmitter=Kg;typeof rUe<"u"&&(rUe.exports=Kg)});var oUe=S((gSi,bCt)=>{"use strict";bCt.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 vCt=S((ySi,Ipe)=>{"use strict";var wln=oUe(),Mpe=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},_Ct=(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 Mpe(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);wln(t.then(n,o),()=>{clearTimeout(i)})});Ipe.exports=_Ct;Ipe.exports.default=_Ct;Ipe.exports.TimeoutError=Mpe});var wCt=S(iUe=>{"use strict";Object.defineProperty(iUe,"__esModule",{value:!0});function Sln(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}iUe.default=Sln});var SCt=S(sUe=>{"use strict";Object.defineProperty(sUe,"__esModule",{value:!0});var Cln=wCt(),aUe=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=Cln.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}};sUe.default=aUe});var xCt=S(lUe=>{"use strict";Object.defineProperty(lUe,"__esModule",{value:!0});var xln=nUe(),CCt=vCt(),Oln=SCt(),Rpe=()=>{},Tln=new CCt.TimeoutError,uUe=class extends xln{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Rpe,this._resolveIdle=Rpe,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:Oln.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=Rpe,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=Rpe,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():CCt.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(Tln)});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}};lUe.default=uUe});var Ape,Eln,QY,OCt=v(()=>{gCt();Ape=L(xCt(),1),Eln=[408,425,429,500,502,503,504],QY=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,"default"in Ape.default?this.queue=new Ape.default.default({concurrency:this.maxConcurrency}):this.queue=new Ape.default({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(()=>tUe(()=>r(...n).catch(s=>{throw s instanceof Error?s:new Error(s)}),{async onFailedAttempt({error:s}){if(s.message.startsWith("Cancel")||s.message.startsWith("TimeoutError")||s.name==="TimeoutError"||s.message.startsWith("AbortError")||s?.code==="ECONNABORTED")throw s;let u=s?.response;if(i&&await i(u))return;let l=u?.status??s?.status;if(l&&!Eln.includes(+l))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 cUe(t){return typeof t?._getType=="function"}function dUe(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 TCt=v(()=>{});var eQ=S((xSi,ECt)=>{"use strict";var Pln="2.0.0",Mln=Number.MAX_SAFE_INTEGER||9007199254740991,Iln=16,Rln=250,Aln=["major","premajor","minor","preminor","patch","prepatch","prerelease"];ECt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Iln,MAX_SAFE_BUILD_LENGTH:Rln,MAX_SAFE_INTEGER:Mln,RELEASE_TYPES:Aln,SEMVER_SPEC_VERSION:Pln,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var tQ=S((OSi,PCt)=>{"use strict";var Nln=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};PCt.exports=Nln});var Q3=S((eO,MCt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:fUe,MAX_SAFE_BUILD_LENGTH:jln,MAX_LENGTH:Dln}=eQ(),$ln=tQ();eO=MCt.exports={};var Lln=eO.re=[],Fln=eO.safeRe=[],br=eO.src=[],kln=eO.safeSrc=[],_r=eO.t={},qln=0,pUe="[a-zA-Z0-9-]",Uln=[["\\s",1],["\\d",Dln],[pUe,jln]],Bln=t=>{for(let[e,r]of Uln)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},jo=(t,e,r)=>{let n=Bln(e),o=qln++;$ln(t,o,e),_r[t]=o,br[o]=e,kln[o]=n,Lln[o]=new RegExp(e,r?"g":void 0),Fln[o]=new RegExp(n,r?"g":void 0)};jo("NUMERICIDENTIFIER","0|[1-9]\\d*");jo("NUMERICIDENTIFIERLOOSE","\\d+");jo("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${pUe}*`);jo("MAINVERSION",`(${br[_r.NUMERICIDENTIFIER]})\\.(${br[_r.NUMERICIDENTIFIER]})\\.(${br[_r.NUMERICIDENTIFIER]})`);jo("MAINVERSIONLOOSE",`(${br[_r.NUMERICIDENTIFIERLOOSE]})\\.(${br[_r.NUMERICIDENTIFIERLOOSE]})\\.(${br[_r.NUMERICIDENTIFIERLOOSE]})`);jo("PRERELEASEIDENTIFIER",`(?:${br[_r.NONNUMERICIDENTIFIER]}|${br[_r.NUMERICIDENTIFIER]})`);jo("PRERELEASEIDENTIFIERLOOSE",`(?:${br[_r.NONNUMERICIDENTIFIER]}|${br[_r.NUMERICIDENTIFIERLOOSE]})`);jo("PRERELEASE",`(?:-(${br[_r.PRERELEASEIDENTIFIER]}(?:\\.${br[_r.PRERELEASEIDENTIFIER]})*))`);jo("PRERELEASELOOSE",`(?:-?(${br[_r.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${br[_r.PRERELEASEIDENTIFIERLOOSE]})*))`);jo("BUILDIDENTIFIER",`${pUe}+`);jo("BUILD",`(?:\\+(${br[_r.BUILDIDENTIFIER]}(?:\\.${br[_r.BUILDIDENTIFIER]})*))`);jo("FULLPLAIN",`v?${br[_r.MAINVERSION]}${br[_r.PRERELEASE]}?${br[_r.BUILD]}?`);jo("FULL",`^${br[_r.FULLPLAIN]}$`);jo("LOOSEPLAIN",`[v=\\s]*${br[_r.MAINVERSIONLOOSE]}${br[_r.PRERELEASELOOSE]}?${br[_r.BUILD]}?`);jo("LOOSE",`^${br[_r.LOOSEPLAIN]}$`);jo("GTLT","((?:<|>)?=?)");jo("XRANGEIDENTIFIERLOOSE",`${br[_r.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);jo("XRANGEIDENTIFIER",`${br[_r.NUMERICIDENTIFIER]}|x|X|\\*`);jo("XRANGEPLAIN",`[v=\\s]*(${br[_r.XRANGEIDENTIFIER]})(?:\\.(${br[_r.XRANGEIDENTIFIER]})(?:\\.(${br[_r.XRANGEIDENTIFIER]})(?:${br[_r.PRERELEASE]})?${br[_r.BUILD]}?)?)?`);jo("XRANGEPLAINLOOSE",`[v=\\s]*(${br[_r.XRANGEIDENTIFIERLOOSE]})(?:\\.(${br[_r.XRANGEIDENTIFIERLOOSE]})(?:\\.(${br[_r.XRANGEIDENTIFIERLOOSE]})(?:${br[_r.PRERELEASELOOSE]})?${br[_r.BUILD]}?)?)?`);jo("XRANGE",`^${br[_r.GTLT]}\\s*${br[_r.XRANGEPLAIN]}$`);jo("XRANGELOOSE",`^${br[_r.GTLT]}\\s*${br[_r.XRANGEPLAINLOOSE]}$`);jo("COERCEPLAIN",`(^|[^\\d])(\\d{1,${fUe}})(?:\\.(\\d{1,${fUe}}))?(?:\\.(\\d{1,${fUe}}))?`);jo("COERCE",`${br[_r.COERCEPLAIN]}(?:$|[^\\d])`);jo("COERCEFULL",br[_r.COERCEPLAIN]+`(?:${br[_r.PRERELEASE]})?(?:${br[_r.BUILD]})?(?:$|[^\\d])`);jo("COERCERTL",br[_r.COERCE],!0);jo("COERCERTLFULL",br[_r.COERCEFULL],!0);jo("LONETILDE","(?:~>?)");jo("TILDETRIM",`(\\s*)${br[_r.LONETILDE]}\\s+`,!0);eO.tildeTrimReplace="$1~";jo("TILDE",`^${br[_r.LONETILDE]}${br[_r.XRANGEPLAIN]}$`);jo("TILDELOOSE",`^${br[_r.LONETILDE]}${br[_r.XRANGEPLAINLOOSE]}$`);jo("LONECARET","(?:\\^)");jo("CARETTRIM",`(\\s*)${br[_r.LONECARET]}\\s+`,!0);eO.caretTrimReplace="$1^";jo("CARET",`^${br[_r.LONECARET]}${br[_r.XRANGEPLAIN]}$`);jo("CARETLOOSE",`^${br[_r.LONECARET]}${br[_r.XRANGEPLAINLOOSE]}$`);jo("COMPARATORLOOSE",`^${br[_r.GTLT]}\\s*(${br[_r.LOOSEPLAIN]})$|^$`);jo("COMPARATOR",`^${br[_r.GTLT]}\\s*(${br[_r.FULLPLAIN]})$|^$`);jo("COMPARATORTRIM",`(\\s*)${br[_r.GTLT]}\\s*(${br[_r.LOOSEPLAIN]}|${br[_r.XRANGEPLAIN]})`,!0);eO.comparatorTrimReplace="$1$2$3";jo("HYPHENRANGE",`^\\s*(${br[_r.XRANGEPLAIN]})\\s+-\\s+(${br[_r.XRANGEPLAIN]})\\s*$`);jo("HYPHENRANGELOOSE",`^\\s*(${br[_r.XRANGEPLAINLOOSE]})\\s+-\\s+(${br[_r.XRANGEPLAINLOOSE]})\\s*$`);jo("STAR","(<|>)?=?\\s*\\*");jo("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");jo("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Npe=S((TSi,ICt)=>{"use strict";var zln=Object.freeze({loose:!0}),Vln=Object.freeze({}),Hln=t=>t?typeof t!="object"?zln:t:Vln;ICt.exports=Hln});var mUe=S((ESi,NCt)=>{"use strict";var RCt=/^[0-9]+$/,ACt=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=RCt.test(t),n=RCt.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Jln=(t,e)=>ACt(e,t);NCt.exports={compareIdentifiers:ACt,rcompareIdentifiers:Jln}});var Gg=S((PSi,DCt)=>{"use strict";var jpe=tQ(),{MAX_LENGTH:jCt,MAX_SAFE_INTEGER:Dpe}=eQ(),{safeRe:$pe,t:Lpe}=Q3(),Wln=Npe(),{compareIdentifiers:hUe}=mUe(),gUe=class t{constructor(e,r){if(r=Wln(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>jCt)throw new TypeError(`version is longer than ${jCt} characters`);jpe("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?$pe[Lpe.LOOSE]:$pe[Lpe.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>Dpe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Dpe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Dpe||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<Dpe)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(jpe("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(jpe("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 hUe(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(jpe("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 hUe(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?$pe[Lpe.PRERELEASELOOSE]:$pe[Lpe.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]),hUe(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}};DCt.exports=gUe});var UB=S((MSi,LCt)=>{"use strict";var $Ct=Gg(),Kln=(t,e,r=!1)=>{if(t instanceof $Ct)return t;try{return new $Ct(t,e)}catch(n){if(!r)return null;throw n}};LCt.exports=Kln});var kCt=S((ISi,FCt)=>{"use strict";var Gln=UB(),Xln=(t,e)=>{let r=Gln(t,e);return r?r.version:null};FCt.exports=Xln});var UCt=S((RSi,qCt)=>{"use strict";var Zln=UB(),Yln=(t,e)=>{let r=Zln(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};qCt.exports=Yln});var VCt=S((ASi,zCt)=>{"use strict";var BCt=Gg(),Qln=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new BCt(t instanceof BCt?t.version:t,r).inc(e,n,o).version}catch{return null}};zCt.exports=Qln});var WCt=S((NSi,JCt)=>{"use strict";var HCt=UB(),ecn=(t,e)=>{let r=HCt(t,null,!0),n=HCt(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"};JCt.exports=ecn});var GCt=S((jSi,KCt)=>{"use strict";var tcn=Gg(),rcn=(t,e)=>new tcn(t,e).major;KCt.exports=rcn});var ZCt=S((DSi,XCt)=>{"use strict";var ncn=Gg(),ocn=(t,e)=>new ncn(t,e).minor;XCt.exports=ocn});var QCt=S(($Si,YCt)=>{"use strict";var icn=Gg(),acn=(t,e)=>new icn(t,e).patch;YCt.exports=acn});var txt=S((LSi,ext)=>{"use strict";var scn=UB(),ucn=(t,e)=>{let r=scn(t,e);return r&&r.prerelease.length?r.prerelease:null};ext.exports=ucn});var Nw=S((FSi,nxt)=>{"use strict";var rxt=Gg(),lcn=(t,e,r)=>new rxt(t,r).compare(new rxt(e,r));nxt.exports=lcn});var ixt=S((kSi,oxt)=>{"use strict";var ccn=Nw(),dcn=(t,e,r)=>ccn(e,t,r);oxt.exports=dcn});var sxt=S((qSi,axt)=>{"use strict";var fcn=Nw(),pcn=(t,e)=>fcn(t,e,!0);axt.exports=pcn});var Fpe=S((USi,lxt)=>{"use strict";var uxt=Gg(),mcn=(t,e,r)=>{let n=new uxt(t,r),o=new uxt(e,r);return n.compare(o)||n.compareBuild(o)};lxt.exports=mcn});var dxt=S((BSi,cxt)=>{"use strict";var hcn=Fpe(),gcn=(t,e)=>t.sort((r,n)=>hcn(r,n,e));cxt.exports=gcn});var pxt=S((zSi,fxt)=>{"use strict";var ycn=Fpe(),bcn=(t,e)=>t.sort((r,n)=>ycn(n,r,e));fxt.exports=bcn});var rQ=S((VSi,mxt)=>{"use strict";var _cn=Nw(),vcn=(t,e,r)=>_cn(t,e,r)>0;mxt.exports=vcn});var kpe=S((HSi,hxt)=>{"use strict";var wcn=Nw(),Scn=(t,e,r)=>wcn(t,e,r)<0;hxt.exports=Scn});var yUe=S((JSi,gxt)=>{"use strict";var Ccn=Nw(),xcn=(t,e,r)=>Ccn(t,e,r)===0;gxt.exports=xcn});var bUe=S((WSi,yxt)=>{"use strict";var Ocn=Nw(),Tcn=(t,e,r)=>Ocn(t,e,r)!==0;yxt.exports=Tcn});var qpe=S((KSi,bxt)=>{"use strict";var Ecn=Nw(),Pcn=(t,e,r)=>Ecn(t,e,r)>=0;bxt.exports=Pcn});var Upe=S((GSi,_xt)=>{"use strict";var Mcn=Nw(),Icn=(t,e,r)=>Mcn(t,e,r)<=0;_xt.exports=Icn});var _Ue=S((XSi,vxt)=>{"use strict";var Rcn=yUe(),Acn=bUe(),Ncn=rQ(),jcn=qpe(),Dcn=kpe(),$cn=Upe(),Lcn=(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 Rcn(t,r,n);case"!=":return Acn(t,r,n);case">":return Ncn(t,r,n);case">=":return jcn(t,r,n);case"<":return Dcn(t,r,n);case"<=":return $cn(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};vxt.exports=Lcn});var Sxt=S((ZSi,wxt)=>{"use strict";var Fcn=Gg(),kcn=UB(),{safeRe:Bpe,t:zpe}=Q3(),qcn=(t,e)=>{if(t instanceof Fcn)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?Bpe[zpe.COERCEFULL]:Bpe[zpe.COERCE]);else{let u=e.includePrerelease?Bpe[zpe.COERCERTLFULL]:Bpe[zpe.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 kcn(`${n}.${o}.${i}${a}${s}`,e)};wxt.exports=qcn});var xxt=S((YSi,Cxt)=>{"use strict";var vUe=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}};Cxt.exports=vUe});var jw=S((QSi,Pxt)=>{"use strict";var Ucn=/\s+/g,wUe=class t{constructor(e,r){if(r=zcn(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof SUe)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(Ucn," "),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=>!Txt(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&&Xcn(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&&Kcn)|(this.options.loose&&Gcn))+":"+e,o=Oxt.get(n);if(o)return o;let i=this.options.loose,a=i?Gy[Xg.HYPHENRANGELOOSE]:Gy[Xg.HYPHENRANGE];e=e.replace(a,adn(this.options.includePrerelease)),il("hyphen replace",e),e=e.replace(Gy[Xg.COMPARATORTRIM],Hcn),il("comparator trim",e),e=e.replace(Gy[Xg.TILDETRIM],Jcn),il("tilde trim",e),e=e.replace(Gy[Xg.CARETTRIM],Wcn),il("caret trim",e);let s=e.split(" ").map(d=>Zcn(d,this.options)).join(" ").split(/\s+/).map(d=>idn(d,this.options));i&&(s=s.filter(d=>(il("loose invalid filter",d,this.options),!!d.match(Gy[Xg.COMPARATORLOOSE])))),il("range list",s);let u=new Map,l=s.map(d=>new SUe(d,this.options));for(let d of l){if(Txt(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return Oxt.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>Ext(n,r)&&e.set.some(o=>Ext(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 Vcn(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(sdn(this.set[r],e,this.options))return!0;return!1}};Pxt.exports=wUe;var Bcn=xxt(),Oxt=new Bcn,zcn=Npe(),SUe=nQ(),il=tQ(),Vcn=Gg(),{safeRe:Gy,t:Xg,comparatorTrimReplace:Hcn,tildeTrimReplace:Jcn,caretTrimReplace:Wcn}=Q3(),{FLAG_INCLUDE_PRERELEASE:Kcn,FLAG_LOOSE:Gcn}=eQ(),Txt=t=>t.value==="<0.0.0-0",Xcn=t=>t.value==="",Ext=(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},Zcn=(t,e)=>(t=t.replace(Gy[Xg.BUILD],""),il("comp",t,e),t=edn(t,e),il("caret",t),t=Ycn(t,e),il("tildes",t),t=rdn(t,e),il("xrange",t),t=odn(t,e),il("stars",t),t),Xy=t=>!t||t.toLowerCase()==="x"||t==="*",Ycn=(t,e)=>t.trim().split(/\s+/).map(r=>Qcn(r,e)).join(" "),Qcn=(t,e)=>{let r=e.loose?Gy[Xg.TILDELOOSE]:Gy[Xg.TILDE];return t.replace(r,(n,o,i,a,s)=>{il("tilde",t,n,o,i,a,s);let u;return Xy(o)?u="":Xy(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Xy(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(il("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,il("tilde return",u),u})},edn=(t,e)=>t.trim().split(/\s+/).map(r=>tdn(r,e)).join(" "),tdn=(t,e)=>{il("caret",t,e);let r=e.loose?Gy[Xg.CARETLOOSE]:Gy[Xg.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{il("caret",t,o,i,a,s,u);let l;return Xy(i)?l="":Xy(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Xy(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(il("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`):(il("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`),il("caret return",l),l})},rdn=(t,e)=>(il("replaceXRanges",t,e),t.split(/\s+/).map(r=>ndn(r,e)).join(" ")),ndn=(t,e)=>{t=t.trim();let r=e.loose?Gy[Xg.XRANGELOOSE]:Gy[Xg.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{il("xRange",t,n,o,i,a,s,u);let l=Xy(i),c=l||Xy(a),d=c||Xy(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`),il("xRange return",n),n})},odn=(t,e)=>(il("replaceStars",t,e),t.trim().replace(Gy[Xg.STAR],"")),idn=(t,e)=>(il("replaceGTE0",t,e),t.trim().replace(Gy[e.includePrerelease?Xg.GTE0PRE:Xg.GTE0],"")),adn=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(Xy(n)?r="":Xy(o)?r=`>=${n}.0.0${t?"-0":""}`:Xy(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Xy(l)?u="":Xy(c)?u=`<${+l+1}.0.0-0`:Xy(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()),sdn=(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(il(t[n].semver),t[n].semver!==SUe.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 nQ=S((e0i,jxt)=>{"use strict";var oQ=Symbol("SemVer ANY"),OUe=class t{static get ANY(){return oQ}constructor(e,r){if(r=Mxt(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),xUe("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===oQ?this.value="":this.value=this.operator+this.semver.version,xUe("comp",this)}parse(e){let r=this.options.loose?Ixt[Rxt.COMPARATORLOOSE]:Ixt[Rxt.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 Axt(n[2],this.options.loose):this.semver=oQ}toString(){return this.value}test(e){if(xUe("Comparator.test",e,this.options.loose),this.semver===oQ||e===oQ)return!0;if(typeof e=="string")try{e=new Axt(e,this.options)}catch{return!1}return CUe(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 Nxt(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Nxt(this.value,r).test(e.semver):(r=Mxt(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("=")||CUe(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||CUe(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};jxt.exports=OUe;var Mxt=Npe(),{safeRe:Ixt,t:Rxt}=Q3(),CUe=_Ue(),xUe=tQ(),Axt=Gg(),Nxt=jw()});var iQ=S((t0i,Dxt)=>{"use strict";var udn=jw(),ldn=(t,e,r)=>{try{e=new udn(e,r)}catch{return!1}return e.test(t)};Dxt.exports=ldn});var Lxt=S((r0i,$xt)=>{"use strict";var cdn=jw(),ddn=(t,e)=>new cdn(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));$xt.exports=ddn});var kxt=S((n0i,Fxt)=>{"use strict";var fdn=Gg(),pdn=jw(),mdn=(t,e,r)=>{let n=null,o=null,i=null;try{i=new pdn(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new fdn(n,r))}),n};Fxt.exports=mdn});var Uxt=S((o0i,qxt)=>{"use strict";var hdn=Gg(),gdn=jw(),ydn=(t,e,r)=>{let n=null,o=null,i=null;try{i=new gdn(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new hdn(n,r))}),n};qxt.exports=ydn});var Vxt=S((i0i,zxt)=>{"use strict";var TUe=Gg(),bdn=jw(),Bxt=rQ(),_dn=(t,e)=>{t=new bdn(t,e);let r=new TUe("0.0.0");if(t.test(r)||(r=new TUe("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 TUe(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||Bxt(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||Bxt(r,i))&&(r=i)}return r&&t.test(r)?r:null};zxt.exports=_dn});var Jxt=S((a0i,Hxt)=>{"use strict";var vdn=jw(),wdn=(t,e)=>{try{return new vdn(t,e).range||"*"}catch{return null}};Hxt.exports=wdn});var Vpe=S((s0i,Xxt)=>{"use strict";var Sdn=Gg(),Gxt=nQ(),{ANY:Cdn}=Gxt,xdn=jw(),Odn=iQ(),Wxt=rQ(),Kxt=kpe(),Tdn=Upe(),Edn=qpe(),Pdn=(t,e,r,n)=>{t=new Sdn(t,n),e=new xdn(e,n);let o,i,a,s,u;switch(r){case">":o=Wxt,i=Tdn,a=Kxt,s=">",u=">=";break;case"<":o=Kxt,i=Edn,a=Wxt,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Odn(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===Cdn&&(p=new Gxt(">=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};Xxt.exports=Pdn});var Yxt=S((u0i,Zxt)=>{"use strict";var Mdn=Vpe(),Idn=(t,e,r)=>Mdn(t,e,">",r);Zxt.exports=Idn});var eOt=S((l0i,Qxt)=>{"use strict";var Rdn=Vpe(),Adn=(t,e,r)=>Rdn(t,e,"<",r);Qxt.exports=Adn});var nOt=S((c0i,rOt)=>{"use strict";var tOt=jw(),Ndn=(t,e,r)=>(t=new tOt(t,r),e=new tOt(e,r),t.intersects(e,r));rOt.exports=Ndn});var iOt=S((d0i,oOt)=>{"use strict";var jdn=iQ(),Ddn=Nw();oOt.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>Ddn(c,d,r));for(let c of a)jdn(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 dOt=S((f0i,cOt)=>{"use strict";var aOt=jw(),PUe=nQ(),{ANY:EUe}=PUe,aQ=iQ(),MUe=Nw(),$dn=(t,e,r={})=>{if(t===e)return!0;t=new aOt(t,r),e=new aOt(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=Fdn(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},Ldn=[new PUe(">=0.0.0-0")],sOt=[new PUe(">=0.0.0")],Fdn=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===EUe){if(e.length===1&&e[0].semver===EUe)return!0;r.includePrerelease?t=Ldn:t=sOt}if(e.length===1&&e[0].semver===EUe){if(r.includePrerelease)return!0;e=sOt}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=uOt(o,p,r):p.operator==="<"||p.operator==="<="?i=lOt(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=MUe(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&&!aQ(p,String(o),r)||i&&!aQ(p,String(i),r))return null;for(let m of e)if(!aQ(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=uOt(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!aQ(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=lOt(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!aQ(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)},uOt=(t,e,r)=>{if(!t)return e;let n=MUe(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},lOt=(t,e,r)=>{if(!t)return e;let n=MUe(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};cOt.exports=$dn});var hOt=S((p0i,mOt)=>{"use strict";var IUe=Q3(),fOt=eQ(),kdn=Gg(),pOt=mUe(),qdn=UB(),Udn=kCt(),Bdn=UCt(),zdn=VCt(),Vdn=WCt(),Hdn=GCt(),Jdn=ZCt(),Wdn=QCt(),Kdn=txt(),Gdn=Nw(),Xdn=ixt(),Zdn=sxt(),Ydn=Fpe(),Qdn=dxt(),efn=pxt(),tfn=rQ(),rfn=kpe(),nfn=yUe(),ofn=bUe(),ifn=qpe(),afn=Upe(),sfn=_Ue(),ufn=Sxt(),lfn=nQ(),cfn=jw(),dfn=iQ(),ffn=Lxt(),pfn=kxt(),mfn=Uxt(),hfn=Vxt(),gfn=Jxt(),yfn=Vpe(),bfn=Yxt(),_fn=eOt(),vfn=nOt(),wfn=iOt(),Sfn=dOt();mOt.exports={parse:qdn,valid:Udn,clean:Bdn,inc:zdn,diff:Vdn,major:Hdn,minor:Jdn,patch:Wdn,prerelease:Kdn,compare:Gdn,rcompare:Xdn,compareLoose:Zdn,compareBuild:Ydn,sort:Qdn,rsort:efn,gt:tfn,lt:rfn,eq:nfn,neq:ofn,gte:ifn,lte:afn,cmp:sfn,coerce:ufn,Comparator:lfn,Range:cfn,satisfies:dfn,toComparators:ffn,maxSatisfying:pfn,minSatisfying:mfn,minVersion:hfn,validRange:gfn,outside:yfn,gtr:bfn,ltr:_fn,intersects:vfn,simplifyRange:wfn,subset:Sfn,SemVer:kdn,re:IUe.re,src:IUe.src,tokens:IUe.t,SEMVER_SPEC_VERSION:fOt.SEMVER_SPEC_VERSION,RELEASE_TYPES:fOt.RELEASE_TYPES,compareIdentifiers:pOt.compareIdentifiers,rcompareIdentifiers:pOt.rcompareIdentifiers}});function HA(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 Cfn,gOt=v(()=>{Cfn=L(hOt(),1)});function NUe(t){return t!=null&&typeof t=="object"&&"name"in t&&t?.name==="LangSmithNotFoundError"}async function Lr(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 AUe(o);if(t.status===409)throw new RUe(o);let i=new Error(o);throw i.status=t.status,i}function bOt(t){return typeof t=="object"&&t!==null&&t.code===yOt}var RUe,AUe,yOt,Hpe,jUe=v(()=>{RUe=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}},AUe=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}};yOt="ERR_CONFLICTING_ENDPOINTS",Hpe=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:yOt}),this.name="ConflictingEndpointsError"}}});function Tfn(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Jpe(t){return Ofn.encode(t)}function vOt(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 Efn(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return vOt(r)}}function Hb(t,e,r,n,o){try{let i=JSON.stringify(t,Efn(r),n);return Jpe(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?`
|
||
Context: ${e}`:""}`),Jpe("[Unserializable]");od("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?`
|
||
Context: ${e}`:""}`),typeof o>"u"&&(o=Tfn()),$Ue(t,"",0,[],void 0,0,o);let a;try{eW.length===0?a=JSON.stringify(t,r,n):a=JSON.stringify(t,Pfn(r),n)}catch{return Jpe("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Wpe.length!==0;){let s=Wpe.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return Jpe(a)}}function DUe(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),Wpe.push([n,r,e,o])):eW.push([e,r,t]):(n[r]=t,Wpe.push([n,r,e]))}function $Ue(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){DUe(xfn,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){DUe(_Ot,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){DUe(_Ot,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)$Ue(t[s],s,s,n,t,i,a);else{t=vOt(t);var u=Object.keys(t);for(s=0;s<u.length;s++){var l=u[s];$Ue(t[l],l,s,n,t,i,a)}}n.pop()}}function Pfn(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(eW.length>0)for(var n=0;n<eW.length;n++){var o=eW[n];if(o[1]===e&&o[0]===r){r=o[2],eW.splice(n,1);break}}return t.call(this,e,r)}}var _Ot,xfn,Wpe,eW,Ofn,wOt=v(()=>{VA();_Ot="[...]",xfn={result:"[Circular]"},Wpe=[],eW=[],Ofn=new TextEncoder});function SOt(t,e,r){if(r)return t;let n=Cpe(),o=e??Vqe(),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 Rfn(t){let e=[];for await(let r of t)e.push(r);return e}function Kpe(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function COt(t){return typeof t=="number"?Number(t.toFixed(4)):t}function OOt(t){return"dataset_id"in t||"dataset_name"in t}var Mfn,Ifn,Afn,Nfn,TOt,jfn,Dfn,xOt,LUe,qB,kqe=v(()=>{ype();pCt();Yqe();OCt();TCt();VA();Spe();vpe();bpe();gOt();jUe();Fqe();$qe();wOt();Mfn=t=>{let e=t?.toString()??od("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},Ifn=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};Afn=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};Nfn=24*1024*1024,TOt=1024*1024*1024,jfn=1e4,Dfn=100,xOt="https://api.smith.langchain.com",LUe=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??TOt}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=Hb(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())]}},qB=class t{get _fetch(){return this.fetchImplementation||nCt(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:hv("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,"_cache",{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,"debug",{enumerable:!0,configurable:!0,writable:!0,value:hv("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=Mfn(e.tracingSamplingRate),this.apiUrl=Kpe(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=Kpe(e.apiKey??r.apiKey),this.webUrl=Kpe(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=Kpe(e.workspaceId??od("WORKSPACE_ID")),this.timeout_ms=e.timeout_ms??9e4,this.caller=new QY({...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??TOt;this.batchIngestCaller=new QY({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:n,...e.callerOptions??{},onFailedResponseHook:Afn,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 LUe(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,xpe()&&(this.langSmithToOTELTranslator=new Tpe),this.cachedLSEnvVarsForMetadata=Vqe(),e.cache===!0?this._cache=new ZY:e.cache&&typeof e.cache=="object"?this._cache=e.cache:this._cache=void 0}static getDefaultClientConfig(){let e=od("API_KEY"),r=od("ENDPOINT")??xOt,n=od("HIDE_INPUTS")==="true",o=od("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:Ifn(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/${wpe}`};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 Lr(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 Lr(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 Lr(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??Nfn}async _getBatchSizeLimit(){let e=await this._ensureServerInfo();return this.batchSizeLimit??e?.batch_ingest_config?.size_limit??Dfn}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=i?.instance_flags?.gzip_body_enabled;try{await this.multipartIngestRuns(o,{...r,useGzip:s,sizeBytes:n})}catch(u){if(NUe(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=SOt(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(jfn),...this.fetchOptions});return await Lr(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=Ope(),r=dCt();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=SOt(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=Hb(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 Lr(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(Hb(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 Lr(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,...O}=p,T={inputs:m,outputs:h,events:y,extra:g,error:b,serialized:_},P=Hb(O,`Serializing for multipart ingestion of run with id: ${O.id}`);c.push({name:`${d}.${O.id}`,payload:new Blob([P],{type:`application/json; length=${P.length}`})});for(let[M,I]of Object.entries(T)){if(I===void 0)continue;let j=Hb(I,`Serializing ${M} for multipart ingestion of run with id: ${O.id}`);c.push({name:`${d}.${O.id}.${M}`,payload:new Blob([j],{type:`application/json; length=${j.length}`})})}if(O.id!==void 0){let M=o[O.id];if(M){delete o[O.id];for(let[I,j]of Object.entries(M)){let A,k;if(Array.isArray(j)?[A,k]=j:(A=j.mimeType,k=j.data),I.includes(".")){console.warn(`Skipping attachment '${I}' for run ${O.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}c.push({name:`attachment.${O.id}.${I}`,payload:new Blob([k],{type:`${A}; length=${k.byteLength}`})})}}}l.push(`trace=${O.trace_id},id=${O.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=rCt(),a=()=>this._createNodeFetchBody(e,o),s=()=>this._createMultipartStream(e,o),u=async l=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{let c=await l(),d={...this.headers,"Content-Type":`multipart/form-data; boundary=${o}`};n?.apiKey!==void 0&&(d["x-api-key"]=n.apiKey);let f=c;n?.useGzip&&typeof c=="object"&&"pipeThrough"in c&&(f=c.pipeThrough(new CompressionStream("gzip")),d["Content-Encoding"]="gzip");let p=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:d,body:f,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Lr(p,"Failed to send multipart request",!0),p});try{let l,c=!1;!i&&!this.multipartStreamingDisabled&&zqe()!=="bun"?(c=!0,l=await u(s)):l=await u(a),(!this.multipartStreamingDisabled||c)&&l.status===422&&(n?.apiUrl??this.apiUrl)!==xOt&&(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,l=await u(a))}catch(l){if(NUe(l))throw l;console.warn(`${l.message.trim()}
|
||
|
||
Context: ${r}`)}}async updateRun(e,r,n){Po(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=Hb(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 Lr(s,"update run",!0),s})}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){Po(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:od("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 Rfn(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 M=Array.isArray(n)?n:[n],I=await Promise.all(M.map(j=>this.readProject({projectName:j}).then(A=>A.id)));w.push(...I)}let O=["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"],T={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||O,is_root:l,order:_};T.select.includes("child_run_ids")&&XY("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let P=0;for await(let M of this._getCursorPaginatedList("/runs/query",T))if(g){if(P>=g)break;if(M.length+P>g){yield*M.slice(0,g-P);break}P+=M.length,yield*M}else yield*M}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(([T,P])=>P!==void 0)),g=JSON.stringify(y),_=await(await this.caller.call(async()=>{let T=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 Lr(T,`Failed to fetch ${p}`),T})).json(),{groups:w,total:O}=_;if(w.length===0)break;for(let T of w)yield T;if(f+=w.length,f>=O)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(P=>this.readProject({projectName:P}).then(M=>M.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(([P,M])=>M!==void 0)),w=JSON.stringify(_);return await(await this.caller.call(async()=>{let P=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 Lr(P,"get run stats"),P})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||FB()};Po(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 Lr(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){Po(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 Lr(r,"unshare run",!0),r})}async readRunSharedLink(e){Po(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 Lr(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 Po(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 Lr(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),Po(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 Lr(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};Po(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 Lr(s,"share dataset"),s})).json();return a.url=`${this.getHostUrl()}/public/${a.share_token}/d`,a}async unshareDataset(e){Po(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 Lr(r,"unshare dataset",!0),r})}async readSharedDataset(e){return Po(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 Lr(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 Lr(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 Lr(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 Lr(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)Po(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 Lr(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)Po(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,Po(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 Lr(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;return l.append("file",e,r),n.forEach(f=>{l.append("input_keys",f)}),o.forEach(f=>{l.append("output_keys",f)}),i&&l.append("description",i),a&&l.append("data_type",a),s&&l.append("name",s),await(await this.caller.call(async()=>{let f=await this._fetch(u,{method:"POST",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:l});return await Lr(f,"upload CSV"),f})).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 Lr(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)Po(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;Po(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 Lr(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;Po(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 Lr(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)Po(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 Lr(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),Po(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 Lr(u,"index dataset"),u})).json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),Po(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 Lr(l,"fetch similar examples"),l})).json()).examples}async createExample(e,r,n){if(OOt(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;OOt(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]??FB())}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 O=await this._uploadExamplesMultipart(_,b);return await Promise.all(O.example_ids.map(P=>this.readExample(P)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:a,useSourceRunIOs:s,useSourceRunAttachments:u,attachments:l,exampleIds:c,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((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=>cUe(a)?dUe(a):a),i=cUe(r)?dUe(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){Po(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,O=w;_&&(O.attachments=Object.entries(_).reduce((T,[P,M])=>(T[P.slice(11)]={presigned_url:M.presigned_url,mime_type:M.mime_type||void 0},T),{})),yield O,y++}if(u!==void 0&&y>=u)break}}async deleteExample(e){Po(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 Lr(n,`delete ${r}`,!0),n})}async deleteExamples(e,r){if(e.forEach(n=>Po(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 Lr(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 Lr(o,"delete examples",!0),o})}}async updateExample(e,r){let n;r?n=e:n=e.id,Po(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,Po(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 Lr(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,Po(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,Po(a);let s={split_name:n,examples:o.map(l=>(Po(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 Lr(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}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:u??"api",metadata:s??{}};l!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:l}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&Po(m.metadata.__run.run_id);let h={id:c??FB(),run_id:e,key:r,score:COt(n),value:o,correction:i,comment:a,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},y=JSON.stringify(h),g=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let b=await this._fetch(g,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:y});return await Lr(b,"create feedback",!0),b}),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=COt(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),Po(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 Lr(u,"update feedback",!0),u})}async readFeedback(e){Po(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){Po(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 Lr(n,`delete ${r}`,!0),n})}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e)for(let i of e)Po(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 Lr(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 Lr(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(e){Po(e);let r=new URLSearchParams({run_id:e});for await(let n of this._getPaginated("/feedback/tokens",r))yield*n}_selectEvalResults(e){let r;return"results"in e?r=e.results:Array.isArray(e)?r=e:r=[e],r}async _logEvaluationFeedback(e,r,n){let o=this._selectEvalResults(e),i=[];for(let a of o){let s=n||{};a.evaluatorInfo&&(s={...a.evaluatorInfo,...s});let u=null;a.targetRunId?u=a.targetRunId:r&&(u=r.id),i.push(await this.createFeedback(u,a.key,{score:a.score,value:a.value,comment:a.comment,correction:a.correction,sourceInfo:s,sourceRunId:a.sourceRunId,feedbackConfig:a.feedbackConfig,feedbackSourceType:"model"}))}return[o,i]}async logEvaluationFeedback(e,r,n){let[o]=await this._logEvaluationFeedback(e,r,n);return o}async*listAnnotationQueues(e={}){let{queueIds:r,name:n,nameContains:o,limit:i}=e,a=new URLSearchParams;r&&r.forEach((u,l)=>{Po(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}=e,a={name:r,description:n,id:o||FB(),rubric_instructions:i},s=JSON.stringify(Object.fromEntries(Object.entries(a).filter(([l,c])=>c!==void 0)));return(await this.caller.call(async()=>{let l=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:s});return await Lr(l,"create annotation queue"),l})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${Po(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Lr(n,"read annotation queue"),n})).json()}async updateAnnotationQueue(e,r){let{name:n,description:o,rubricInstructions:i}=r,a=JSON.stringify({name:n,description:o,rubric_instructions:i});await this.caller.call(async()=>{let s=await this._fetch(`${this.apiUrl}/annotation-queues/${Po(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Lr(s,"update annotation queue",!0),s})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${Po(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Lr(r,"delete annotation queue",!0),r})}async addRunsToAnnotationQueue(e,r){let n=JSON.stringify(r.map((o,i)=>Po(o,`runIds[${i}]`).toString()));await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/annotation-queues/${Po(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await Lr(o,"add runs to annotation queue",!0),o})}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${Po(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 Lr(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/${Po(e,"queueId")}/runs/${Po(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Lr(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/${Po(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Lr(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 Lr(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]=HA(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 Lr(u,`${r?"like":"unlike"} prompt`),u})).json()}async _getPromptUrl(e){let[r,n,o]=HA(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]=HA(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 Lr(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]=HA(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 Lr(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]=HA(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 Lr(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=Hb(u,`Serializing body for example with id: ${s}`),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=Hb(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=Hb(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=Hb(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 Lr(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??FB()).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=Hb(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=Hb(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=Hb(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 Lr(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]=HA(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 Lr(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]=HA(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 Lr(a,"delete prompt"),a})).json()}_getPromptCacheKey(e,r){return`${e}${r?":with_model":""}`}async _fetchPromptFromApi(e,r){let[n,o,i]=HA(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 Lr(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){if(!r?.skipCache&&this._cache){let n=this._getPromptCacheKey(e,r?.includeModel),o=this._cache.get(n);if(o)return o;let i=await this._fetchPromptFromApi(e,r);return this._cache.set(n,i),i}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 Po(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}`)}}get cache(){return this._cache}cleanup(){this._cache&&this._cache.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 fCt()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}}});var EOt,POt=v(()=>{VA();EOt=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>od(r)==="true")});var tO,j0i,Gpe,FUe=v(()=>{tO=Symbol.for("lc:context_variables"),j0i=Symbol.for("lc:child_run_end_promises"),Gpe=Symbol.for("langsmith:replica_trace_roots")});function kUe(t,e){if(tO in t)return t[tO][e]}function MOt(t,e,r){let n=tO in t?t[tO]:{};n[e]=r,t[tO]=n}var IOt=v(()=>{FUe()});function ROt(t){let r=Object.keys(t).sort().map(n=>`${n}:${t[n]??""}`).join("|");return kB(r,uQ)}function $fn(t){return t.replace(/[-:.]/g,"")}function NOt(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 qUe(t,e,r=1){let n=NOt(t,r);return{dottedOrder:$fn(n)+e,microsecondPrecisionDatestring:n}}function Ffn(t){let e={};for(let r of Object.keys(t))Lfn.has(r)&&(e[r]=t[r]);return e}function jOt(t){return t!=null&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function DOt(t){return typeof t=="object"&&t!=null&&typeof t.name=="string"&&t.name==="langchain_tracer"}function AOt(t){return Array.isArray(t)&&t.some(e=>DOt(e))}function kfn(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function qfn(t){let e=t?.callbacks;return t!=null&&typeof e=="object"&&(AOt(e?.handlers)||AOt(e))}function Ufn(){let t=hv("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){zfn(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(bOt(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 Bfn(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):Ufn()}function zfn(t){if(Object.keys(t).length>0&&od("ENDPOINT"))throw new Hpe}var sQ,uQ,Lfn,Xpe,K0,qqe=v(()=>{kqe();POt();jUe();FUe();IOt();VA();Lqe();VA();bpe();vpe();ype();sQ=36,uQ="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Lfn=new Set(["projectName","updates","reroot"]);Xpe=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:Ffn(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(",")}},K0=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}),jOt(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=NOt(this.start_time,this.execution_order)),this.id||(this.id=_pe(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=Bfn(this.replicas),!this.dotted_order){let{dottedOrder:s}=qUe(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:GY(),child_runs:[],api_url:hv("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:hv("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new qB),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});tO in this&&(i[tO]=this[tO]);let a=Symbol.for("lc:child_config"),s=e.extra?.[a]??this.extra[a];if(qfn(s)){let c={...s},d=kfn(c.callbacks)?c.callbacks.copy?.():void 0;d&&(Object.assign(d,{_parentRunId:i.id}),d.handlers?.find(DOt)?.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(-sQ)===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(-sQ):r.trace_id=r.id}}r.parent_run_id===e&&(r.parent_run_id=void 0)}_setReplicaTraceRoot(e,r){let n=kUe(this,Gpe)??{};n[e]=r,MOt(this,Gpe,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=ROt({projectName:r,apiUrl:s,apiKey:u,workspaceId:l});this._setReplicaTraceRoot(g,c.id)}let d;if(!i){let g=kUe(this,Gpe)??{},b=ROt({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 O=0;O<_.length;O++)if(_[O].slice(-sQ)===d){w=O;break}if(w!==null){let O=_.slice(w);c.dotted_order=O.join(".")}}}let f=c.id,p=kB(`${f}:${r}`,uQ),m;c.trace_id?m=kB(`${c.trace_id}:${r}`,uQ):m=p;let h;c.parent_run_id&&(h=kB(`${c.parent_run_id}:${r}`,uQ));let y;return c.dotted_order&&(y=c.dotted_order.split(".").map(_=>{let w=_.slice(-sQ),O=kB(`${w}:${r}`,uQ);return _.slice(0,-sQ)+O}).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=Cpe();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){XY("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=EOt();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=Xpe.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 Xpe(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(K0,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});var Zpe=v(()=>{qqe()});function BUe(t,e){if(t)return new K0({...t,start_time:t._serialized_start_time??t.start_time,parent_run:BUe(e),child_runs:t.child_runs.map(r=>BUe(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:wqe()},tracingEnabled:!1})}function UUe(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function BB(t){return typeof t._addRunToRunMap=="function"}var Vfn,Hfn,G0,zB=v(()=>{Bo();ku();WY();Zpe();Vfn={};Rt(Vfn,{BaseTracer:()=>G0,isBaseTracer:()=>BB});Hfn=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};G0=class extends LB{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?Hfn(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}=qUe(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=BUe(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=UUe(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=UUe(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=UUe(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 kOt=S((iCi,FOt)=>{"use strict";var $Ot=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,LOt=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function Jfn(){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=$Ot(),e.color.ansi16m=LOt(),e.bgColor.ansi256=$Ot(10),e.bgColor.ansi16m=LOt(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(FOt,"exports",{enumerable:!0,get:Jfn})});function Zy(t,e){return`${t.open}${e}${t.close}`}function Dw(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function qOt(t){return typeof t=="string"?t.trim():t==null?t:Dw(t,t.toString())}function B$(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 zUe,Wfn,Jb,Ype,UOt=v(()=>{Bo();zB();zUe=L(kOt(),1),Wfn={};Rt(Wfn,{ConsoleCallbackHandler:()=>Ype});({color:Jb}=zUe.default),Ype=class extends G0{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 n=[...this.getParents(e).reverse(),e].map((o,i,a)=>{let s=`${o.execution_order}:${o.run_type}:${o.name}`;return i===a.length-1?Zy(zUe.default.bold,s):s}).join(" > ");return Zy(Jb.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${Zy(Jb.green,"[chain/start]")} [${r}] Entering Chain run with input: ${Dw(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Zy(Jb.cyan,"[chain/end]")} [${r}] [${B$(e)}] Exiting Chain run with output: ${Dw(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${Zy(Jb.red,"[chain/error]")} [${r}] [${B$(e)}] Chain run errored with error: ${Dw(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(`${Zy(Jb.green,"[llm/start]")} [${r}] Entering LLM run with input: ${Dw(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Zy(Jb.cyan,"[llm/end]")} [${r}] [${B$(e)}] Exiting LLM run with output: ${Dw(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${Zy(Jb.red,"[llm/error]")} [${r}] [${B$(e)}] LLM run errored with error: ${Dw(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${Zy(Jb.green,"[tool/start]")} [${r}] Entering Tool run with input: "${qOt(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Zy(Jb.cyan,"[tool/end]")} [${r}] [${B$(e)}] Exiting Tool run with output: "${qOt(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${Zy(Jb.red,"[tool/error]")} [${r}] [${B$(e)}] Tool run errored with error: ${Dw(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${Zy(Jb.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${Dw(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Zy(Jb.cyan,"[retriever/end]")} [${r}] [${B$(e)}] Exiting Retriever run with output: ${Dw(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${Zy(Jb.red,"[retriever/error]")} [${r}] [${B$(e)}] Retriever run errored with error: ${Dw(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${Zy(Jb.blue,"[agent/action]")} [${n}] Agent selected action: ${Dw(r.actions[r.actions.length-1],"[action]")}`)}}});var Qpe=v(()=>{Spe()});var VUe,eme,HUe=v(()=>{ku();Qpe();eme=()=>{if(VUe===void 0){let t=vn("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};VUe=new qB(t)}return VUe}});function BOt(t=!1){let e=Gfn.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 tme(t){return typeof t=="function"&&"langsmith:traceable"in t}var WUe,JUe,Kfn,KUe,Gfn,gCi,zOt=v(()=>{WUe=class{getStore(){}run(e,r){return r()}},JUe=Symbol.for("ls:tracing_async_local_storage"),Kfn=new WUe,KUe=class{getInstance(){return globalThis[JUe]??Kfn}initializeGlobalInstance(e){globalThis[JUe]===void 0&&(globalThis[JUe]=e)}},Gfn=new KUe;gCi=Symbol.for("langsmith:traceable:root")});var GUe=v(()=>{zOt()});function Zfn(t){let e;for(let r of t)for(let n of r)eo.isInstance(n.message)&&n.message.usage_metadata!==void 0&&(e=X3(e,n.message.usage_metadata));return e}var Xfn,lQ,HOt=v(()=>{Bo();ape();Rw();zB();HUe();GUe();Zpe();Qpe();Xfn={};Rt(Xfn,{LangChainTracer:()=>lQ});lQ=class VOt extends G0{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??GY(),this.replicas=a,this.exampleId=n,this.client=i??eme();let s=VOt.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=Zfn(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 K0({...n,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return BOt(!0)}catch{return}}}});var WOt=S((ICi,nme)=>{"use strict";var Yfn=oUe(),rme=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},JOt=(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);Yfn(t.then(n,o),()=>{clearTimeout(i)})});nme.exports=JOt;nme.exports.default=JOt;nme.exports.TimeoutError=rme});var KOt=S(XUe=>{"use strict";Object.defineProperty(XUe,"__esModule",{value:!0});function Qfn(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}XUe.default=Qfn});var GOt=S(YUe=>{"use strict";Object.defineProperty(YUe,"__esModule",{value:!0});var epn=KOt(),ZUe=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=epn.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}};YUe.default=ZUe});var tBe=S(eBe=>{"use strict";Object.defineProperty(eBe,"__esModule",{value:!0});var tpn=nUe(),XOt=WOt(),rpn=GOt(),ome=()=>{},npn=new XOt.TimeoutError,QUe=class extends tpn{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=ome,this._resolveIdle=ome,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:rpn.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=ome,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=ome,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():XOt.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(npn)});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}};eBe.default=QUe});function opn(){let t="default"in ime.default?ime.default.default:ime.default;return new t({autoStart:!0,concurrency:1})}function ipn(){return typeof VB>"u"&&(VB=opn()),VB}async function wc(t,e){if(e===!0){let r=q$();r!==void 0?await r.run(void 0,async()=>t()):await t()}else VB=ipn(),VB.add(async()=>{let r=q$();r!==void 0?await r.run(void 0,async()=>t()):await t()})}async function ZOt(){let t=eme();await Promise.allSettled([typeof VB<"u"?VB.onIdle():Promise.resolve(),t.awaitPendingTraceBatches()])}var ime,VB,rBe=v(()=>{HUe();NY();ime=L(tBe(),1)});var apn,YOt=v(()=>{Bo();rBe();apn={};Rt(apn,{awaitAllCallbacks:()=>ZOt,consumeCallback:()=>wc})});var QOt,eTt=v(()=>{ku();QOt=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>vn(r)==="true")});function nBe(t){let e=q$();return e===void 0?void 0:e.getStore()?.[k$]?.[t]}var spn,tTt,rTt=v(()=>{NY();Zpe();spn=Symbol("lc:configure_hooks"),tTt=()=>nBe(spn)||[]});function JA(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function tW(t){return"name"in t?t:LB.fromMethods(t)}var upn,nTt,dQ,oTt,oBe,iTt,aTt,rc,z$=v(()=>{Bo();H0();ku();WY();zB();UOt();HOt();rBe();YOt();eTt();rTt();HY();upn={};Rt(upn,{BaseCallbackManager:()=>nTt,BaseRunManager:()=>dQ,CallbackManager:()=>rc,CallbackManagerForChainRun:()=>iTt,CallbackManagerForLLMRun:()=>oBe,CallbackManagerForRetrieverRun:()=>oTt,CallbackManagerForToolRun:()=>aTt,ensureHandler:()=>tW,parseCallbackConfigArg:()=>JA});nTt=class{setHandler(t){return this.setHandlers([t])}},dQ=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=>wc(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=>wc(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)))}},oTt=class extends dQ{getChild(t){let e=new rc(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=>wc(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=>wc(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)))}},oBe=class extends dQ{async handleLLMNewToken(t,e,r,n,o,i){await Promise.all(this.handlers.map(a=>wc(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=>wc(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=>wc(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)))}},iTt=class extends dQ{getChild(t){let e=new rc(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=>wc(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=>wc(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=>wc(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=>wc(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)))}},aTt=class extends dQ{getChild(t){let e=new rc(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=>wc(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 handleToolEnd(t){await Promise.all(this.handlers.map(e=>wc(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)))}},rc=class cQ extends nTt{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:Yx();return await Promise.all(this.handlers.map(p=>{if(!p.ignoreLLM)return BB(p)&&p._createRunForLLMStart(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l),wc(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 oBe(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:Yx();return await Promise.all(this.handlers.map(p=>{if(!p.ignoreLLM)return BB(p)&&p._createRunForChatModelStart(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l),wc(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=ol(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 oBe(f,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(r,n,o=Yx(),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 BB(d)&&d._createRunForChainStart(r,n,o,this._parentRunId,this.tags,this.metadata,i,u,c),wc(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 iTt(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(r,n,o=Yx(),i=void 0,a=void 0,s=void 0,u=void 0){return await Promise.all(this.handlers.map(l=>{if(!l.ignoreAgent)return BB(l)&&l._createRunForToolStart(r,n,o,this._parentRunId,this.tags,this.metadata,u),wc(async()=>{try{await l.handleToolStart?.(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}, handleToolStart: ${c}`),l.raiseError)throw c}},l.awaitHandlers)})),new aTt(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(r,n,o=Yx(),i=void 0,a=void 0,s=void 0,u=void 0){return await Promise.all(this.handlers.map(l=>{if(!l.ignoreRetriever)return BB(l)&&l._createRunForRetrieverStart(r,n,o,this._parentRunId,this.tags,this.metadata,u),wc(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 oTt(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=>wc(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 cQ(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 LB{constructor(){super();x(this,"name",Yx());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 cQ,l.setHandlers(r?.map(tW)??[],!0)):l=r,l=l.copy(Array.isArray(n)?n.map(tW):n?.handlers,!1));let c=vn("LANGCHAIN_VERBOSE")==="true"||u?.verbose,d=lQ.getTraceableRunTree()?.tracingEnabled||QOt(),f=d||(vn("LANGCHAIN_TRACING")??!1);if(c||f){if(l||(l=new cQ),c&&!l.handlers.some(p=>p.name===Ype.prototype.name)){let p=new Ype;l.addHandler(p,!0)}if(f&&!l.handlers.some(p=>p.name==="langchain_tracer")&&d){let p=new lQ;l.addHandler(p,!0)}if(d){let p=lQ.getTraceableRunTree();p&&l._parentRunId===void 0&&(l._parentRunId=p.id,l.handlers.find(h=>h.name==="langchain_tracer")?.updateFromRunTree(p))}}for(let{contextVar:p,inheritable:m=!0,handlerClass:h,envVar:y}of tTt()){let g=y&&vn(y)==="true"&&h,b,_=p!==void 0?nBe(p):void 0;_&&Oqe(_)?b=_:g&&(b=new h({})),b!==void 0&&(l||(l=new cQ),l.handlers.some(w=>w.name===b.name)||l.addHandler(b,m))}return(o||i)&&l&&(l.addTags(o??[]),l.addTags(i??[],!1)),(a||s)&&l&&(l.addMetadata(a??{}),l.addMetadata(s??{},!1)),l}}});var iBe,lpn,sTt,cpn,eh,HB=v(()=>{NY();z$();Qpe();iBe=class{getStore(){}run(t,e){return e()}enterWith(t){}},lpn=new iBe,sTt=Symbol.for("lc:child_config"),cpn=class{getInstance(){return q$()??lpn}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[sTt]}runWithConfig(t,e,r){let n=rc._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 K0({name:"<runnable_lambda>",tracingEnabled:!1})),u&&(u.extra={...u.extra,[sTt]:t}),i!==void 0&&i[k$]!==void 0&&(u===void 0&&(u={}),u[k$]=i[k$]),o.run(u,e)}initializeGlobalInstance(t){q$()===void 0&&nSt(t)}},eh=new cpn});var dpn,JB=v(()=>{Bo();NY();HB();dpn={};Rt(dpn,{AsyncLocalStorageProviderSingleton:()=>eh,MockAsyncLocalStorage:()=>iBe,_CONTEXT_VARIABLES_KEY:()=>k$})});async function Zg(t){return rc._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function WB(...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(tW(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(tW(s),!0);e.callbacks=a}else e.callbacks=new rc(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 Qo(t){let e=eh.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))fpn.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 Js(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=Qo(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 Yy(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 ame,fpn,rO=v(()=>{z$();HB();JB();ame=25;fpn=new Set(["string","number","boolean"])});async function $w(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(V$(e))},e.addEventListener("abort",r),e.aborted&&o(V$(e))})]).finally(()=>e.removeEventListener("abort",r))}function V$(t){return t?.reason instanceof Error?t.reason:typeof t?.reason=="string"?new Error(t.reason):new Error("Aborted")}var rW=v(()=>{});function sme(t,e=2){let r=Array.from({length:e},()=>[]);return r.map(async function*(o){for(;;)if(o.length===0){let i=await t.next();for(let a of r)a.push(i)}else{if(o[0].done)return;yield o.shift().value}})}function eb(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]=eb(r[n],o):r[n]=o;return r}else throw new Error(`Cannot concat ${typeof t} and ${typeof e}`)}async function sBe(t,e,r,n,...o){let i=new H$({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var ppn,Qy,H$,nO=v(()=>{Bo();HB();JB();rO();rW();ppn={};Rt(ppn,{AsyncGeneratorWithSetup:()=>H$,IterableReadableStream:()=>Qy,atee:()=>sme,concat:()=>eb,pipeGeneratorWithSetup:()=>sBe});Qy=class aBe 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 aBe({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 aBe({async pull(n){let{value:o,done:i}=await r.next();i&&n.close(),n.enqueue(o)},async cancel(n){await r.return(n)}})}};H$=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)=>{eh.runWithConfig(Yy(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?eh.runWithConfig(Yy(this.config),this.signal?async()=>$w(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 mpn.call(t,e)}function cme(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 tb(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function dme(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 WA(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function fme(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function ume(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(ume(t[r]))return!0}else if(typeof t=="object"){let r=cme(t),n=r.length;for(var e=0;e<n;e++)if(ume(t[r[e]]))return!0}}return!1}function uTt(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 mpn,pme,mme=v(()=>{mpn=Object.prototype.hasOwnProperty;pme=class extends Error{constructor(t,e,r,n,o){super(uTt(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=uTt(t,{name:e,index:r,operation:n,tree:o})}}});function uBe(t){return Object.getOwnPropertyNames(Object.prototype).includes(t)}function hme(t,e){if(e=="")return t;var r={op:"_get",path:e};return KB(t,r),r.value}function KB(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):gme(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=hme(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=fQ(t,e.value),a.test===!1)throw new Sc("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 Sc("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,t);return a}}else{n||(t=tb(t));let s=(e.path||"").split("/"),u=t,l=1,c=s.length,d,f,p;for(typeof r=="function"?p=r:p=gme;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=fme(f)),o&&(f=="__proto__"||f=="prototype"&&l>0&&s[l-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&d===void 0&&(u[f]===void 0?d=s.slice(0,l).join("/"):l==c-1&&(d=e.path),d!==void 0&&p(e,0,t,d)),l++,Array.isArray(u)){if(f==="-")f=u.length;else{if(r&&!dme(f))throw new Sc("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);dme(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new Sc("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,t);let m=gpn[e.op].call(e,u,f,t);if(m.test===!1)throw new Sc("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(l>=c){let m=nW[e.op].call(e,u,f,t);if(m.test===!1)throw new Sc("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new Sc("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function J$(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new Sc("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=tb(t));let i=new Array(e.length);for(let a=0,s=e.length;a<s;a++)i[a]=KB(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function ypn(t,e,r){let n=KB(t,e);if(n.test===!1)throw new Sc("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function gme(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new Sc("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(nW[t.op]){if(typeof t.path!="string")throw new Sc("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new Sc('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 Sc("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 Sc("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")&&ume(t.value))throw new Sc("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 Sc("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 Sc("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var a={op:"_get",path:t.from,value:void 0},s=lTt([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Sc("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new Sc("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function lTt(t,e,r){try{if(!Array.isArray(t))throw new Sc("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)J$(tb(e),tb(t),r||!0);else{r=r||gme;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof Sc)return o;throw o}}function fQ(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(!fQ(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],!fQ(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var lBe,Sc,hpn,nW,gpn,pQ=v(()=>{Bo();mme();lBe={};Rt(lBe,{JsonPatchError:()=>Sc,_areEquals:()=>fQ,applyOperation:()=>KB,applyPatch:()=>J$,applyReducer:()=>ypn,deepClone:()=>hpn,getValueByPointer:()=>hme,validate:()=>lTt,validator:()=>gme});Sc=pme,hpn=tb;nW={add:function(t,e,r){if(uBe(e))throw new TypeError("JSON-Patch: modifying `__proto__`, `constructor`, or `prototype` prop is banned for security reasons");return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){if(uBe(e))throw new TypeError("JSON-Patch: modifying `__proto__`, `constructor`, or `prototype` prop is banned for security reasons");var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){if(uBe(e))throw new TypeError("JSON-Patch: modifying `__proto__`, `constructor`, or `prototype` 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=hme(r,this.path);n&&(n=tb(n));let o=KB(r,{op:"remove",path:this.from}).removed;return KB(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=hme(r,this.from);return KB(r,{op:"add",path:this.path,value:tb(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:fQ(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},gpn={add:function(t,e,r){return dme(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:nW.move,copy:nW.copy,test:nW.test,_get:nW._get}});function cTt(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=cme(e),a=cme(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(lme(e,c)&&!(e[c]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var f=e[c];typeof d=="object"&&d!=null&&typeof f=="object"&&f!=null&&Array.isArray(d)===Array.isArray(f)?cTt(d,f,r,n+"/"+WA(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+WA(c),value:tb(d)}),r.push({op:"replace",path:n+"/"+WA(c),value:tb(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+WA(c),value:tb(d)}),r.push({op:"remove",path:n+"/"+WA(c)}),u=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),s=!0)}if(!(!u&&i.length==a.length))for(var l=0;l<i.length;l++){var c=i[l];!lme(t,c)&&e[c]!==void 0&&r.push({op:"add",path:n+"/"+WA(c),value:tb(e[c])})}}}function oW(t,e,r=!1){var n=[];return cTt(t,e,n,"",r),n}var mQ=v(()=>{mme();pQ()});var Qxi,cBe=v(()=>{mme();pQ();mQ();Qxi={...lBe,JsonPatchError:pme,deepClone:tb,escapePathComponent:WA,unescapePathComponent:fme}});async function dTt(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 fTt(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 _pn(t){return t!==void 0&&t.message!==void 0}var bpn,oO,yme,fBe,bme,pTt=v(()=>{Bo();Rw();pQ();cBe();zB();nO();bpn={};Rt(bpn,{LogStreamCallbackHandler:()=>bme,RunLog:()=>yme,RunLogPatch:()=>oO,isLogStreamHandler:()=>fBe});oO=class{constructor(t){x(this,"ops");this.ops=t.ops??[]}concat(t){let e=this.ops.concat(t.ops),r=J$({},e);return new yme({ops:e,state:r[r.length-1].newDocument})}},yme=class dBe extends oO{constructor(r){super(r);x(this,"state");this.state=r.state}concat(r){let n=this.ops.concat(r.ops),o=J$(this.state,r.ops);return new dBe({ops:n,state:o[o.length-1].newDocument})}static fromRunLogPatch(r){let n=J$({},r.ops);return new dBe({ops:r.ops,state:n[n.length-1].newDocument})}},fBe=t=>t.name==="log_stream_tracer";bme=class extends G0{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=Qy.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 oO({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 oO({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 dTt(e,this._schemaFormat)),await this.writer.write(new oO({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 dTt(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await fTt(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 oO({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new oO({ops:[{op:"replace",path:"/final_output",value:await fTt(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?_pn(n?.chunk)?a=n?.chunk:a=new Ir({id:`run-${e.id}`,content:r}):a=r;let s=new oO({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 vpn,KA,Lw,yi,id=v(()=>{Bo();vpn={};Rt(vpn,{ChatGenerationChunk:()=>yi,GenerationChunk:()=>Lw,RUN_KEY:()=>KA});KA="__run",Lw=class mTt{constructor(e){x(this,"text");x(this,"generationInfo");this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new mTt({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},yi=class hTt extends Lw{constructor(r){super(r);x(this,"message");this.message=r.message}concat(r){return new hTt({text:this.text+r.text,generationInfo:{...this.generationInfo,...r.generationInfo},message:this.message.concat(r.message)})}}});function _me({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 gTt,yTt,bTt=v(()=>{Rw();zB();nO();id();gTt=t=>t.name==="event_stream_tracer",yTt=class extends G0{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=Qy.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 Lw({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=_me(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 Ir({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 Lw({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=_me(e),n=e.run_type??"chain",o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:e.run_type},i={};e.inputs.input===""&&Object.keys(e.inputs).length===1?(i={},o.inputs={}):e.inputs.input!==void 0?(i.input=e.inputs.input,o.inputs=e.inputs.input):(i.input=e.inputs,o.inputs=e.inputs),this.runInfoMap.set(e.id,o),await this.send({event:`on_${n}_start`,data:i,name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onChainEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onChainEnd: Run ID ${e.id} not found in run map.`);let n=`on_${e.run_type}_end`,o=e.inputs??r.inputs??{},a={output:e.outputs?.output??e.outputs,input:o};o.input&&Object.keys(o).length===1&&(a.input=o.input,r.inputs=o.input),await this.sendEndEvent({event:n,data:a,run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata??{}},r)}async onToolStart(e){let r=_me(e),n={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:"tool",inputs:e.inputs??{}};this.runInfoMap.set(e.id,n),await this.send({event:"on_tool_start",data:{input:e.inputs??{}},name:r,run_id:e.id,tags:e.tags??[],metadata:e.extra?.metadata??{}},n)}async onToolEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(r.inputs===void 0)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);let n=e.outputs?.output===void 0?e.outputs:e.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:n,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async onRetrieverStart(e){let r=_me(e),o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:"retriever",inputs:{query:e.inputs.query}};this.runInfoMap.set(e.id,o),await this.send({event:"on_retriever_start",data:{input:{query:e.inputs.query}},name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onRetrieverEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onRetrieverEnd: Run ID ${e.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:e.outputs?.documents??e.outputs,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async handleCustomEvent(e,r,n){let o=this.runInfoMap.get(n);if(o===void 0)throw new Error(`handleCustomEvent: Run ID ${n} not found in run map.`);await this.send({event:"on_custom_event",run_id:n,name:e,tags:o.tags,metadata:o.metadata,data:r},o)}async finish(){let e=[...this.tappedPromises.values()];Promise.all(e).finally(()=>{this.writer.close()})}}});function _Tt(t){if(!(t&&Spn(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:Cpn.has(r)}var wpn,Spn,Cpn,vTt=v(()=>{wpn=Object.prototype.toString,Spn=t=>wpn.call(t)==="[object Error]",Cpn=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 xpn(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 vme(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 Tpn(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 wTt(t,e){return Number.isFinite(e)?e-(performance.now()-t):e}async function Epn({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 Opn)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),wTt(n,s)<=0)throw i;let l=await o.shouldConsumeRetry(u),c=wTt(n,s);if(c<=0||a<=0)throw i;if(i instanceof TypeError&&!_Tt(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=Tpn(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 hQ(t,e={}){if(e={...e},xpn(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),vme("factor",e.factor,{min:0,allowInfinity:!1}),vme("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),vme("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),vme("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 Epn({error:i,attemptNumber:r,retriesConsumed:n,startTime:o,options:e})&&n++}}throw new Error("Retry attempts exhausted without throwing an error.")}var Opn,pBe=v(()=>{vTt();Opn=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 wme,Ppn,Mpn,Ipn,Fw,GB=v(()=>{Bo();rW();pBe();wme=L(tBe(),1),Ppn={};Rt(Ppn,{AsyncCaller:()=>Fw});Mpn=[400,401,402,403,404,405,406,407,409],Ipn=t=>{if(t.message.startsWith("Cancel")||t.message.startsWith("AbortError")||t.name==="AbortError"||t?.code==="ECONNABORTED")throw t;let e=t?.response?.status??t?.status;if(e&&Mpn.includes(+e))throw t;if(t?.error?.code==="insufficient_quota"){let r=new Error(t?.message);throw r.name="InsufficientQuotaError",r}},Fw=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??Ipn;let e="default"in wme.default?wme.default.default:wme.default;this.queue=new e({concurrency:this.maxConcurrency})}async call(t,...e){return this.queue.add(()=>hQ(()=>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(V$(t.signal))},t.signal?.addEventListener("abort",n)})]).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 mBe,STt=v(()=>{zB();mBe=class extends G0{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 gQ(t){return t?t.lc_runnable:!1}var CTt,xTt,Sme=v(()=>{CTt=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}},xTt=t=>btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")});function Se(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 ad(t){return t&&Object.assign(yQ,t),yQ}var hBe,gBe,iO,yQ,iW=v(()=>{hBe=Object.freeze({status:"aborted"});gBe=Symbol("zod_brand"),iO=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},yQ={}});var Mt={};Rn(Mt,{BIGINT_FORMAT_RANGES:()=>TBe,Class:()=>bBe,NUMBER_FORMAT_RANGES:()=>OBe,aborted:()=>ZB,allowsEval:()=>SBe,assert:()=>Dpn,assertEqual:()=>Rpn,assertIs:()=>Npn,assertNever:()=>jpn,assertNotEqual:()=>Apn,assignProp:()=>wBe,cached:()=>vQ,captureStackTrace:()=>Cme,cleanEnum:()=>Kpn,cleanRegex:()=>wQ,clone:()=>nc,createTransparentProxy:()=>Upn,defineLazy:()=>ks,esc:()=>XB,escapeRegex:()=>GA,extend:()=>Vpn,finalizeIssue:()=>gv,floatSafeRemainder:()=>vBe,getElementAtPath:()=>$pn,getEnumValues:()=>_Q,getLengthableOrigin:()=>xQ,getParsedType:()=>qpn,getSizableOrigin:()=>CQ,isObject:()=>aW,isPlainObject:()=>sW,issue:()=>EBe,joinValues:()=>qe,jsonStringifyReplacer:()=>_Be,merge:()=>Hpn,normalizeParams:()=>bt,nullish:()=>W$,numKeys:()=>kpn,omit:()=>zpn,optionalKeys:()=>xBe,partial:()=>Jpn,pick:()=>Bpn,prefixIssues:()=>Wb,primitiveTypes:()=>CBe,promiseAllObject:()=>Lpn,propertyKeyTypes:()=>SQ,randomString:()=>Fpn,required:()=>Wpn,stringifyPrimitive:()=>$t,unwrapMessage:()=>bQ});function Rpn(t){return t}function Apn(t){return t}function Npn(t){}function jpn(t){throw new Error}function Dpn(t){}function _Q(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 qe(t,e="|"){return t.map(r=>$t(r)).join(e)}function _Be(t,e){return typeof e=="bigint"?e.toString():e}function vQ(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function W$(t){return t==null}function wQ(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function vBe(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 ks(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 wBe(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function $pn(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Lpn(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 Fpn(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function XB(t){return JSON.stringify(t)}function aW(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function sW(t){if(aW(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(aW(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function kpn(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function GA(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nc(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function bt(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 Upn(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 $t(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function xBe(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function Bpn(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 nc(t,{...t._zod.def,shape:r,checks:[]})}function zpn(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 nc(t,{...t._zod.def,shape:r,checks:[]})}function Vpn(t,e){if(!sW(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 wBe(this,"shape",n),n},checks:[]};return nc(t,r)}function Hpn(t,e){return nc(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return wBe(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function Jpn(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 nc(e,{...e._zod.def,shape:o,checks:[]})}function Wpn(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 nc(e,{...e._zod.def,shape:o,checks:[]})}function ZB(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Wb(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function bQ(t){return typeof t=="string"?t:t?.message}function gv(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=bQ(t.inst?._zod.def?.error?.(t))??bQ(e?.error?.(t))??bQ(r.customError?.(t))??bQ(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function CQ(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function xQ(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function EBe(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function Kpn(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var Cme,SBe,qpn,SQ,CBe,OBe,TBe,bBe,Ln=v(()=>{Cme=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};SBe=vQ(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});qpn=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}`)}},SQ=new Set(["string","number","symbol"]),CBe=new Set(["string","number","bigint","boolean","symbol","undefined"]);OBe={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]},TBe={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};bBe=class{constructor(...e){}}});function TQ(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 EQ(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 PBe(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 TTt(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 MBe(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 ${TTt(n.path)}`);return e.join(`
|
||
`)}var OTt,OQ,uW,IBe=v(()=>{iW();Ln();OTt=(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,_Be,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},OQ=Se("$ZodError",OTt),uW=Se("$ZodError",OTt,{Parent:Error})});var xme,aO,Ome,YB,Tme,RBe,Eme,ABe,Pme=v(()=>{iW();IBe();Ln();xme=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 iO;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>gv(u,i,ad())));throw Cme(s,o?.callee),s}return a.value},aO=xme(uW),Ome=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=>gv(u,i,ad())));throw Cme(s,o?.callee),s}return a.value},YB=Ome(uW),Tme=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 iO;return i.issues.length?{success:!1,error:new(t??OQ)(i.issues.map(a=>gv(a,o,ad())))}:{success:!0,data:i.value}},RBe=Tme(uW),Eme=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=>gv(a,o,ad())))}:{success:!0,data:i.value}},ABe=Eme(uW)});var ez={};Rn(ez,{_emoji:()=>ETt,base64:()=>WBe,base64url:()=>Mme,bigint:()=>eze,boolean:()=>nze,browserEmail:()=>nmn,cidrv4:()=>HBe,cidrv6:()=>JBe,cuid:()=>NBe,cuid2:()=>jBe,date:()=>XBe,datetime:()=>YBe,domain:()=>omn,duration:()=>kBe,e164:()=>GBe,email:()=>UBe,emoji:()=>BBe,extendedDuration:()=>Xpn,guid:()=>qBe,hostname:()=>KBe,html5Email:()=>emn,integer:()=>tze,ipv4:()=>zBe,ipv6:()=>VBe,ksuid:()=>LBe,lowercase:()=>aze,nanoid:()=>FBe,null:()=>oze,number:()=>rze,rfc5322Email:()=>tmn,string:()=>QBe,time:()=>ZBe,ulid:()=>DBe,undefined:()=>ize,unicodeEmail:()=>rmn,uppercase:()=>sze,uuid:()=>QB,uuid4:()=>Zpn,uuid6:()=>Ypn,uuid7:()=>Qpn,xid:()=>$Be});function BBe(){return new RegExp(ETt,"u")}function MTt(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 ZBe(t){return new RegExp(`^${MTt(t)}$`)}function YBe(t){let e=MTt({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(`^${PTt}T(?:${n})$`)}var NBe,jBe,DBe,$Be,LBe,FBe,kBe,Xpn,qBe,QB,Zpn,Ypn,Qpn,UBe,emn,tmn,rmn,nmn,ETt,zBe,VBe,HBe,JBe,WBe,Mme,KBe,omn,GBe,PTt,XBe,QBe,eze,tze,rze,nze,oze,ize,aze,sze,Ime=v(()=>{NBe=/^[cC][^\s-]{8,}$/,jBe=/^[0-9a-z]+$/,DBe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$Be=/^[0-9a-vA-V]{20}$/,LBe=/^[A-Za-z0-9]{27}$/,FBe=/^[a-zA-Z0-9_-]{21}$/,kBe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Xpn=/^[-+]?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)?)??$/,qBe=/^([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})$/,QB=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)$/,Zpn=QB(4),Ypn=QB(6),Qpn=QB(7),UBe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,emn=/^[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])?)*$/,tmn=/^(([^<>()\[\]\\.,;:\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,}))$/,rmn=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,nmn=/^[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])?)*$/,ETt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";zBe=/^(?:(?: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])$/,VBe=/^(([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})$/,HBe=/^((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])$/,JBe=/^(([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])$/,WBe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Mme=/^[A-Za-z0-9_-]*$/,KBe=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,omn=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,GBe=/^\+(?:[0-9]){6,14}[0-9]$/,PTt="(?:(?:\\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])))",XBe=new RegExp(`^${PTt}$`);QBe=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},eze=/^\d+n?$/,tze=/^\d+$/,rze=/^-?\d+(?:\.\d+)?/i,nze=/true|false/i,oze=/null/i,ize=/undefined/i,aze=/^[^A-Z]*$/,sze=/^[^a-z]*$/});function ITt(t,e,r){t.issues.length&&e.issues.push(...Wb(r,t.issues))}var oc,RTt,Rme,Ame,uze,lze,cze,dze,fze,pze,mze,hze,gze,lW,yze,bze,_ze,vze,wze,Sze,Cze,xze,Oze,Nme=v(()=>{iW();Ime();Ln();oc=Se("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),RTt={number:"number",bigint:"bigint",object:"date"},Rme=Se("$ZodCheckLessThan",(t,e)=>{oc.init(t,e);let r=RTt[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})}}),Ame=Se("$ZodCheckGreaterThan",(t,e)=>{oc.init(t,e);let r=RTt[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})}}),uze=Se("$ZodCheckMultipleOf",(t,e)=>{oc.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):vBe(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})}}),lze=Se("$ZodCheckNumberFormat",(t,e)=>{oc.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=OBe[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=tze)}),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})}}),cze=Se("$ZodCheckBigIntFormat",(t,e)=>{oc.init(t,e);let[r,n]=TBe[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})}}),dze=Se("$ZodCheckMaxSize",(t,e)=>{var r;oc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!W$(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:CQ(o),code:"too_big",maximum:e.maximum,input:o,inst:t,continue:!e.abort})}}),fze=Se("$ZodCheckMinSize",(t,e)=>{var r;oc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!W$(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:CQ(o),code:"too_small",minimum:e.minimum,input:o,inst:t,continue:!e.abort})}}),pze=Se("$ZodCheckSizeEquals",(t,e)=>{var r;oc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!W$(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:CQ(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})}}),mze=Se("$ZodCheckMaxLength",(t,e)=>{var r;oc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!W$(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=xQ(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),hze=Se("$ZodCheckMinLength",(t,e)=>{var r;oc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!W$(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=xQ(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),gze=Se("$ZodCheckLengthEquals",(t,e)=>{var r;oc.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!W$(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=xQ(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})}}),lW=Se("$ZodCheckStringFormat",(t,e)=>{var r,n;oc.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=()=>{})}),yze=Se("$ZodCheckRegex",(t,e)=>{lW.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})}}),bze=Se("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=aze),lW.init(t,e)}),_ze=Se("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=sze),lW.init(t,e)}),vze=Se("$ZodCheckIncludes",(t,e)=>{oc.init(t,e);let r=GA(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})}}),wze=Se("$ZodCheckStartsWith",(t,e)=>{oc.init(t,e);let r=new RegExp(`^${GA(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})}}),Sze=Se("$ZodCheckEndsWith",(t,e)=>{oc.init(t,e);let r=new RegExp(`.*${GA(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})}});Cze=Se("$ZodCheckProperty",(t,e)=>{oc.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=>ITt(o,r,e.property));ITt(n,r,e.property)}}),xze=Se("$ZodCheckMimeType",(t,e)=>{oc.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})}}),Oze=Se("$ZodCheckOverwrite",(t,e)=>{oc.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var PQ,Tze=v(()=>{PQ=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 Eze,Pze=v(()=>{Eze={major:4,minor:0,patch:0}});function Gze(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function VTt(t){if(!Mme.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Gze(r)}function HTt(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 NTt(t,e,r){t.issues.length&&e.issues.push(...Wb(r,t.issues)),e.value[r]=t.value}function jme(t,e,r){t.issues.length&&e.issues.push(...Wb(r,t.issues)),e.value[r]=t.value}function jTt(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(...Wb(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function DTt(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=>gv(i,n,ad())))}),e}function Mze(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(sW(t)&&sW(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=Mze(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=Mze(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 $Tt(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),ZB(t))return t;let n=Mze(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 Dme(t,e,r){t.issues.length&&e.issues.push(...Wb(r,t.issues)),e.value[r]=t.value}function LTt(t,e,r,n,o,i,a){t.issues.length&&(SQ.has(typeof n)?r.issues.push(...Wb(n,t.issues)):r.issues.push({origin:"map",code:"invalid_key",input:o,inst:i,issues:t.issues.map(s=>gv(s,a,ad()))})),e.issues.length&&(SQ.has(typeof n)?r.issues.push(...Wb(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>gv(s,a,ad()))})),r.value.set(t.value,e.value)}function FTt(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function kTt(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function qTt(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 UTt(t,e,r){return ZB(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}function BTt(t){return t.value=Object.freeze(t.value),t}function zTt(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(EBe(o))}}var no,tz,Ou,Ize,Rze,Aze,Nze,jze,Dze,$ze,Lze,Fze,kze,qze,Uze,Bze,zze,Vze,Hze,Jze,Wze,Kze,Xze,Zze,Yze,Qze,e4e,$me,t4e,MQ,Lme,r4e,n4e,o4e,i4e,a4e,K$,IQ,s4e,u4e,RQ,l4e,Fme,c4e,d4e,rz,f4e,p4e,m4e,h4e,g4e,y4e,AQ,cW,b4e,_4e,v4e,w4e,S4e,C4e,x4e,NQ,O4e,T4e,E4e,P4e,M4e,jQ=v(()=>{Nme();iW();Tze();Pme();Ime();Ln();Pze();Ln();no=Se("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Eze;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=ZB(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 iO;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(u||(u=ZB(i,d)))});else{if(i.issues.length===d)continue;u||(u=ZB(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 iO;return s.then(u=>o(u,n,a))}return o(s,n,a)}}t["~standard"]={validate:o=>{try{let i=RBe(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return ABe(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),tz=Se("$ZodString",(t,e)=>{no.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??QBe(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}}),Ou=Se("$ZodStringFormat",(t,e)=>{lW.init(t,e),tz.init(t,e)}),Ize=Se("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=qBe),Ou.init(t,e)}),Rze=Se("$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=QB(n))}else e.pattern??(e.pattern=QB());Ou.init(t,e)}),Aze=Se("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=UBe),Ou.init(t,e)}),Nze=Se("$ZodURL",(t,e)=>{Ou.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:KBe.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})}}}),jze=Se("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=BBe()),Ou.init(t,e)}),Dze=Se("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=FBe),Ou.init(t,e)}),$ze=Se("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=NBe),Ou.init(t,e)}),Lze=Se("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=jBe),Ou.init(t,e)}),Fze=Se("$ZodULID",(t,e)=>{e.pattern??(e.pattern=DBe),Ou.init(t,e)}),kze=Se("$ZodXID",(t,e)=>{e.pattern??(e.pattern=$Be),Ou.init(t,e)}),qze=Se("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=LBe),Ou.init(t,e)}),Uze=Se("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=YBe(e)),Ou.init(t,e)}),Bze=Se("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=XBe),Ou.init(t,e)}),zze=Se("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=ZBe(e)),Ou.init(t,e)}),Vze=Se("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=kBe),Ou.init(t,e)}),Hze=Se("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=zBe),Ou.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),Jze=Se("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=VBe),Ou.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})}}}),Wze=Se("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=HBe),Ou.init(t,e)}),Kze=Se("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=JBe),Ou.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})}}});Xze=Se("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=WBe),Ou.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{Gze(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});Zze=Se("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Mme),Ou.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{VTt(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Yze=Se("$ZodE164",(t,e)=>{e.pattern??(e.pattern=GBe),Ou.init(t,e)});Qze=Se("$ZodJWT",(t,e)=>{Ou.init(t,e),t._zod.check=r=>{HTt(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),e4e=Se("$ZodCustomStringFormat",(t,e)=>{Ou.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})}}),$me=Se("$ZodNumber",(t,e)=>{no.init(t,e),t._zod.pattern=t._zod.bag.pattern??rze,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}}),t4e=Se("$ZodNumber",(t,e)=>{lze.init(t,e),$me.init(t,e)}),MQ=Se("$ZodBoolean",(t,e)=>{no.init(t,e),t._zod.pattern=nze,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}}),Lme=Se("$ZodBigInt",(t,e)=>{no.init(t,e),t._zod.pattern=eze,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}}),r4e=Se("$ZodBigInt",(t,e)=>{cze.init(t,e),Lme.init(t,e)}),n4e=Se("$ZodSymbol",(t,e)=>{no.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}}),o4e=Se("$ZodUndefined",(t,e)=>{no.init(t,e),t._zod.pattern=ize,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}}),i4e=Se("$ZodNull",(t,e)=>{no.init(t,e),t._zod.pattern=oze,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}}),a4e=Se("$ZodAny",(t,e)=>{no.init(t,e),t._zod.parse=r=>r}),K$=Se("$ZodUnknown",(t,e)=>{no.init(t,e),t._zod.parse=r=>r}),IQ=Se("$ZodNever",(t,e)=>{no.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),s4e=Se("$ZodVoid",(t,e)=>{no.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}}),u4e=Se("$ZodDate",(t,e)=>{no.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}});RQ=Se("$ZodArray",(t,e)=>{no.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=>NTt(l,r,a))):NTt(u,r,a)}return i.length?Promise.all(i).then(()=>r):r}});l4e=Se("$ZodObject",(t,e)=>{no.init(t,e);let r=vQ(()=>{let d=Object.keys(e.shape);for(let p of d)if(!(e.shape[p]instanceof no))throw new Error(`Invalid element at key "${p}": expected a Zod schema`);let f=xBe(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(f)}});ks(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 PQ(["shape","payload","ctx"]),p=r.value,m=b=>{let _=XB(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=XB(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 ? [${XB(b)}, ...iss.path] : [${XB(b)}]
|
||
})));`),f.write(`newResult[${XB(b)}] = ${_}.value`)}f.write("payload.value = newResult;"),f.write("return payload;");let g=f.compile();return(b,_)=>g(d,b,_)},o,i=aW,a=!yQ.jitless,u=a&&SBe.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 O=_[w],T=O._zod.run({value:p[w],issues:[]},f),P=O._zod.optin==="optional"&&O._zod.optout==="optional";T instanceof Promise?m.push(T.then(M=>P?jTt(M,d,w,p):jme(M,d,w))):P?jTt(T,d,w,p):jme(T,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(O=>jme(O,d,_))):jme(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}});Fme=Se("$ZodUnion",(t,e)=>{no.init(t,e),ks(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ks(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ks(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),ks(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=>wQ(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=>DTt(a,r,t,n)):DTt(i,r,t,n)}}),c4e=Se("$ZodDiscriminatedUnion",(t,e)=>{Fme.init(t,e);let r=t._zod.parse;ks(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=vQ(()=>{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(!aW(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)}}),d4e=Se("$ZodIntersection",(t,e)=>{no.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])=>$Tt(r,u,l)):$Tt(r,i,a)}});rz=Se("$ZodTuple",(t,e)=>{no.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=>Dme(d,o,u))):Dme(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=>Dme(f,o,u))):Dme(d,o,u)}}return s.length?Promise.all(s).then(()=>o):o}});f4e=Se("$ZodRecord",(t,e)=>{no.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!sW(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(...Wb(u,c.issues)),r.value[u]=c.value})):(l.issues.length&&r.issues.push(...Wb(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=>gv(l,n,ad())),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(...Wb(a,l.issues)),r.value[s.value]=l.value})):(u.issues.length&&r.issues.push(...Wb(a,u.issues)),r.value[s.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),p4e=Se("$ZodMap",(t,e)=>{no.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])=>{LTt(c,d,r,a,o,t,n)})):LTt(u,l,r,a,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});m4e=Se("$ZodSet",(t,e)=>{no.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=>FTt(u,r))):FTt(s,r)}return i.length?Promise.all(i).then(()=>r):r}});h4e=Se("$ZodEnum",(t,e)=>{no.init(t,e);let r=_Q(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>SQ.has(typeof n)).map(n=>typeof n=="string"?GA(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}}),g4e=Se("$ZodLiteral",(t,e)=>{no.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?GA(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}}),y4e=Se("$ZodFile",(t,e)=>{no.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}}),AQ=Se("$ZodTransform",(t,e)=>{no.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 iO;return r.value=o,r}}),cW=Se("$ZodOptional",(t,e)=>{no.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ks(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ks(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${wQ(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)}),b4e=Se("$ZodNullable",(t,e)=>{no.init(t,e),ks(t._zod,"optin",()=>e.innerType._zod.optin),ks(t._zod,"optout",()=>e.innerType._zod.optout),ks(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${wQ(r.source)}|null)$`):void 0}),ks(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)}),_4e=Se("$ZodDefault",(t,e)=>{no.init(t,e),t._zod.optin="optional",ks(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=>kTt(i,e)):kTt(o,e)}});v4e=Se("$ZodPrefault",(t,e)=>{no.init(t,e),t._zod.optin="optional",ks(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))}),w4e=Se("$ZodNonOptional",(t,e)=>{no.init(t,e),ks(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=>qTt(i,t)):qTt(o,t)}});S4e=Se("$ZodSuccess",(t,e)=>{no.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)}}),C4e=Se("$ZodCatch",(t,e)=>{no.init(t,e),t._zod.optin="optional",ks(t._zod,"optout",()=>e.innerType._zod.optout),ks(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=>gv(a,n,ad()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>gv(i,n,ad()))},input:r.value}),r.issues=[]),r)}}),x4e=Se("$ZodNaN",(t,e)=>{no.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)}),NQ=Se("$ZodPipe",(t,e)=>{no.init(t,e),ks(t._zod,"values",()=>e.in._zod.values),ks(t._zod,"optin",()=>e.in._zod.optin),ks(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=>UTt(i,e,n)):UTt(o,e,n)}});O4e=Se("$ZodReadonly",(t,e)=>{no.init(t,e),ks(t._zod,"propValues",()=>e.innerType._zod.propValues),ks(t._zod,"values",()=>e.innerType._zod.values),ks(t._zod,"optin",()=>e.innerType._zod.optin),ks(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(BTt):BTt(o)}});T4e=Se("$ZodTemplateLiteral",(t,e)=>{no.init(t,e);let r=[];for(let n of e.parts)if(n instanceof no){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||CBe.has(typeof n))r.push(GA(`${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)}),E4e=Se("$ZodPromise",(t,e)=>{no.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),P4e=Se("$ZodLazy",(t,e)=>{no.init(t,e),ks(t._zod,"innerType",()=>e.getter()),ks(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),ks(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),ks(t._zod,"optin",()=>t._zod.innerType._zod.optin),ks(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),M4e=Se("$ZodCustom",(t,e)=>{oc.init(t,e),no.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=>zTt(i,r,n,t));zTt(o,r,n,t)}})});function WTt(){return{localeError:imn()}}var imn,KTt=v(()=>{Ln();imn=()=>{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 ${$t(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: ${qe(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":""}: ${qe(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 GTt(){return{localeError:amn()}}var amn,XTt=v(()=>{Ln();amn=()=>{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 ${$t(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${qe(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":""}: ${qe(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 ZTt(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 YTt(){return{localeError:smn()}}var smn,QTt=v(()=>{Ln();smn=()=>{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 ${$t(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 ${qe(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);if(a){let s=Number(o.maximum),u=ZTt(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=ZTt(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"}: ${qe(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 eEt(){return{localeError:umn()}}var umn,tEt=v(()=>{Ln();umn=()=>{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 ${$t(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${qe(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":""}: ${qe(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 rEt(){return{localeError:lmn()}}var lmn,nEt=v(()=>{Ln();lmn=()=>{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 ${$t(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${qe(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: ${qe(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 oEt(){return{localeError:cmn()}}var cmn,iEt=v(()=>{Ln();cmn=()=>{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 ${$t(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${qe(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"}: ${qe(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 kme(){return{localeError:fmn()}}var dmn,fmn,I4e=v(()=>{Ln();dmn=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},fmn=()=>{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 ${dmn(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${$t(n.values[0])}`:`Invalid option: expected one of ${qe(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":""}: ${qe(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 aEt(){return{localeError:mmn()}}var pmn,mmn,sEt=v(()=>{Ln();pmn=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},mmn=()=>{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 ${pmn(n.input)}`;case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${$t(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${qe(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":""}: ${qe(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 uEt(){return{localeError:hmn()}}var hmn,lEt=v(()=>{Ln();hmn=()=>{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 ${$t(o.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${qe(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":""}: ${qe(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 cEt(){return{localeError:gmn()}}var gmn,dEt=v(()=>{Ln();gmn=()=>{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 ${$t(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 ${qe(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: ${qe(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 fEt(){return{localeError:ymn()}}var ymn,pEt=v(()=>{Ln();ymn=()=>{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 ${$t(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${qe(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"}: ${qe(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 mEt(){return{localeError:bmn()}}var bmn,hEt=v(()=>{Ln();bmn=()=>{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 : ${$t(o.values[0])} attendu`:`Option invalide : une valeur parmi ${qe(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":""} : ${qe(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 gEt(){return{localeError:_mn()}}var _mn,yEt=v(()=>{Ln();_mn=()=>{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 ${$t(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${qe(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":""} : ${qe(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 bEt(){return{localeError:vmn()}}var vmn,_Et=v(()=>{Ln();vmn=()=>{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 ${$t(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 ${qe(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"}: ${qe(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 vEt(){return{localeError:wmn()}}var wmn,wEt=v(()=>{Ln();wmn=()=>{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 ${$t(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${qe(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":""}: ${qe(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 SEt(){return{localeError:Smn()}}var Smn,CEt=v(()=>{Ln();Smn=()=>{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 ${$t(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${qe(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":""}: ${qe(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 xEt(){return{localeError:Cmn()}}var Cmn,OEt=v(()=>{Ln();Cmn=()=>{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 ${$t(o.values[0])}`:`Opzione non valida: atteso uno tra ${qe(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"}: ${qe(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 TEt(){return{localeError:xmn()}}var xmn,EEt=v(()=>{Ln();xmn=()=>{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: ${$t(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${qe(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":""}: ${qe(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 PEt(){return{localeError:Omn()}}var Omn,MEt=v(()=>{Ln();Omn=()=>{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 ${$t(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 ${qe(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 ${qe(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 IEt(){return{localeError:Tmn()}}var Tmn,REt=v(()=>{Ln();Tmn=()=>{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 ${$t(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${qe(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: ${qe(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 AEt(){return{localeError:Emn()}}var Emn,NEt=v(()=>{Ln();Emn=()=>{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 ${$t(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 ${qe(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"}: ${qe(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 jEt(){return{localeError:Pmn()}}var Pmn,DEt=v(()=>{Ln();Pmn=()=>{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 ${$t(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${qe(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: ${qe(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 $Et(){return{localeError:Mmn()}}var Mmn,LEt=v(()=>{Ln();Mmn=()=>{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 ${$t(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${qe(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":""}: ${qe(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 FEt(){return{localeError:Imn()}}var Imn,kEt=v(()=>{Ln();Imn=()=>{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 ${$t(o.values[0])}`:`Ugyldig valg: forventet en av ${qe(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"}: ${qe(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 qEt(){return{localeError:Rmn()}}var Rmn,UEt=v(()=>{Ln();Rmn=()=>{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 ${$t(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${qe(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":""}: ${qe(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 BEt(){return{localeError:Amn()}}var Amn,zEt=v(()=>{Ln();Amn=()=>{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 ${$t(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${qe(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"}: ${qe(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 VEt(){return{localeError:Nmn()}}var Nmn,HEt=v(()=>{Ln();Nmn=()=>{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 ${$t(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${qe(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":""}: ${qe(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 JEt(){return{localeError:jmn()}}var jmn,WEt=v(()=>{Ln();jmn=()=>{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 ${$t(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${qe(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":""}: ${qe(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 KEt(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 GEt(){return{localeError:Dmn()}}var Dmn,XEt=v(()=>{Ln();Dmn=()=>{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 ${$t(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 ${qe(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);if(a){let s=Number(o.maximum),u=KEt(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=KEt(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":""}: ${qe(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 ZEt(){return{localeError:$mn()}}var $mn,YEt=v(()=>{Ln();$mn=()=>{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 ${$t(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${qe(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"}: ${qe(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 QEt(){return{localeError:Lmn()}}var Lmn,ePt=v(()=>{Ln();Lmn=()=>{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 ${$t(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${qe(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"}: ${qe(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 tPt(){return{localeError:Fmn()}}var Fmn,rPt=v(()=>{Ln();Fmn=()=>{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 ${$t(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 ${qe(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":""}: ${qe(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 nPt(){return{localeError:kmn()}}var kmn,oPt=v(()=>{Ln();kmn=()=>{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 ${$t(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 ${qe(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: ${qe(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 iPt(){return{localeError:Umn()}}var qmn,Umn,aPt=v(()=>{Ln();qmn=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},Umn=()=>{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 ${qmn(n.input)}`;case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${$t(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${qe(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":""}: ${qe(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 sPt(){return{localeError:Bmn()}}var Bmn,uPt=v(()=>{Ln();Bmn=()=>{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 ${$t(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 ${qe(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":""}: ${qe(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 lPt(){return{localeError:zmn()}}var zmn,cPt=v(()=>{Ln();zmn=()=>{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: ${$t(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${qe(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":""}: ${qe(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 dPt(){return{localeError:Vmn()}}var Vmn,fPt=v(()=>{Ln();Vmn=()=>{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 ${$t(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 ${qe(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: ${qe(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 pPt(){return{localeError:Hmn()}}var Hmn,mPt=v(()=>{Ln();Hmn=()=>{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 ${$t(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${qe(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): ${qe(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 hPt(){return{localeError:Jmn()}}var Jmn,gPt=v(()=>{Ln();Jmn=()=>{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 ${$t(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${qe(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${qe(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 DQ={};Rn(DQ,{ar:()=>WTt,az:()=>GTt,be:()=>YTt,ca:()=>eEt,cs:()=>rEt,de:()=>oEt,en:()=>kme,eo:()=>aEt,es:()=>uEt,fa:()=>cEt,fi:()=>fEt,fr:()=>mEt,frCA:()=>gEt,he:()=>bEt,hu:()=>vEt,id:()=>SEt,it:()=>xEt,ja:()=>TEt,kh:()=>PEt,ko:()=>IEt,mk:()=>AEt,ms:()=>jEt,nl:()=>$Et,no:()=>FEt,ota:()=>qEt,pl:()=>VEt,ps:()=>BEt,pt:()=>JEt,ru:()=>GEt,sl:()=>ZEt,sv:()=>QEt,ta:()=>tPt,th:()=>nPt,tr:()=>iPt,ua:()=>sPt,ur:()=>lPt,vi:()=>dPt,zhCN:()=>pPt,zhTW:()=>hPt});var R4e=v(()=>{KTt();XTt();QTt();tEt();nEt();iEt();I4e();sEt();lEt();dEt();pEt();hEt();yEt();_Et();wEt();CEt();OEt();EEt();MEt();REt();NEt();DEt();LEt();kEt();UEt();zEt();HEt();WEt();XEt();YEt();ePt();rPt();oPt();aPt();uPt();cPt();fPt();mPt();gPt()});function qme(){return new dW}var A4e,N4e,dW,Ml,j4e=v(()=>{A4e=Symbol("ZodOutput"),N4e=Symbol("ZodInput"),dW=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)}};Ml=qme()});function D4e(t,e){return new t({type:"string",...bt(e)})}function $4e(t,e){return new t({type:"string",coerce:!0,...bt(e)})}function Ume(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...bt(e)})}function $Q(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...bt(e)})}function Bme(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...bt(e)})}function zme(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...bt(e)})}function Vme(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...bt(e)})}function Hme(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...bt(e)})}function Jme(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...bt(e)})}function Wme(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...bt(e)})}function Kme(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...bt(e)})}function Gme(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...bt(e)})}function Xme(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...bt(e)})}function Zme(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...bt(e)})}function Yme(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...bt(e)})}function Qme(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...bt(e)})}function ehe(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...bt(e)})}function the(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...bt(e)})}function rhe(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...bt(e)})}function nhe(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...bt(e)})}function ohe(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...bt(e)})}function ihe(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...bt(e)})}function ahe(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...bt(e)})}function she(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...bt(e)})}function F4e(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...bt(e)})}function k4e(t,e){return new t({type:"string",format:"date",check:"string_format",...bt(e)})}function q4e(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...bt(e)})}function U4e(t,e){return new t({type:"string",format:"duration",check:"string_format",...bt(e)})}function B4e(t,e){return new t({type:"number",checks:[],...bt(e)})}function z4e(t,e){return new t({type:"number",coerce:!0,checks:[],...bt(e)})}function V4e(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...bt(e)})}function H4e(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...bt(e)})}function J4e(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...bt(e)})}function W4e(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...bt(e)})}function K4e(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...bt(e)})}function G4e(t,e){return new t({type:"boolean",...bt(e)})}function X4e(t,e){return new t({type:"boolean",coerce:!0,...bt(e)})}function Z4e(t,e){return new t({type:"bigint",...bt(e)})}function Y4e(t,e){return new t({type:"bigint",coerce:!0,...bt(e)})}function Q4e(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...bt(e)})}function e2e(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...bt(e)})}function t2e(t,e){return new t({type:"symbol",...bt(e)})}function r2e(t,e){return new t({type:"undefined",...bt(e)})}function n2e(t,e){return new t({type:"null",...bt(e)})}function o2e(t){return new t({type:"any"})}function G$(t){return new t({type:"unknown"})}function LQ(t,e){return new t({type:"never",...bt(e)})}function i2e(t,e){return new t({type:"void",...bt(e)})}function a2e(t,e){return new t({type:"date",...bt(e)})}function s2e(t,e){return new t({type:"date",coerce:!0,...bt(e)})}function u2e(t,e){return new t({type:"nan",...bt(e)})}function XA(t,e){return new Rme({check:"less_than",...bt(e),value:t,inclusive:!1})}function kw(t,e){return new Rme({check:"less_than",...bt(e),value:t,inclusive:!0})}function ZA(t,e){return new Ame({check:"greater_than",...bt(e),value:t,inclusive:!1})}function Kb(t,e){return new Ame({check:"greater_than",...bt(e),value:t,inclusive:!0})}function l2e(t){return ZA(0,t)}function c2e(t){return XA(0,t)}function d2e(t){return kw(0,t)}function f2e(t){return Kb(0,t)}function nz(t,e){return new uze({check:"multiple_of",...bt(e),value:t})}function fW(t,e){return new dze({check:"max_size",...bt(e),maximum:t})}function oz(t,e){return new fze({check:"min_size",...bt(e),minimum:t})}function FQ(t,e){return new pze({check:"size_equals",...bt(e),size:t})}function pW(t,e){return new mze({check:"max_length",...bt(e),maximum:t})}function X$(t,e){return new hze({check:"min_length",...bt(e),minimum:t})}function mW(t,e){return new gze({check:"length_equals",...bt(e),length:t})}function kQ(t,e){return new yze({check:"string_format",format:"regex",...bt(e),pattern:t})}function qQ(t){return new bze({check:"string_format",format:"lowercase",...bt(t)})}function UQ(t){return new _ze({check:"string_format",format:"uppercase",...bt(t)})}function BQ(t,e){return new vze({check:"string_format",format:"includes",...bt(e),includes:t})}function zQ(t,e){return new wze({check:"string_format",format:"starts_with",...bt(e),prefix:t})}function VQ(t,e){return new Sze({check:"string_format",format:"ends_with",...bt(e),suffix:t})}function p2e(t,e,r){return new Cze({check:"property",property:t,schema:e,...bt(r)})}function HQ(t,e){return new xze({check:"mime_type",mime:t,...bt(e)})}function YA(t){return new Oze({check:"overwrite",tx:t})}function JQ(t){return YA(e=>e.normalize(t))}function WQ(){return YA(t=>t.trim())}function KQ(){return YA(t=>t.toLowerCase())}function GQ(){return YA(t=>t.toUpperCase())}function XQ(t,e,r){return new t({type:"array",element:e,...bt(r)})}function Wmn(t,e,r){return new t({type:"union",options:e,...bt(r)})}function Kmn(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...bt(n)})}function Gmn(t,e,r){return new t({type:"intersection",left:e,right:r})}function m2e(t,e,r,n){let o=r instanceof no,i=o?n:r,a=o?r:null;return new t({type:"tuple",items:e,rest:a,...bt(i)})}function Xmn(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...bt(n)})}function Zmn(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...bt(n)})}function Ymn(t,e,r){return new t({type:"set",valueType:e,...bt(r)})}function Qmn(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new t({type:"enum",entries:n,...bt(r)})}function ehn(t,e,r){return new t({type:"enum",entries:e,...bt(r)})}function thn(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...bt(r)})}function h2e(t,e){return new t({type:"file",...bt(e)})}function rhn(t,e){return new t({type:"transform",transform:e})}function nhn(t,e){return new t({type:"optional",innerType:e})}function ohn(t,e){return new t({type:"nullable",innerType:e})}function ihn(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():r}})}function ahn(t,e,r){return new t({type:"nonoptional",innerType:e,...bt(r)})}function shn(t,e){return new t({type:"success",innerType:e})}function uhn(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function lhn(t,e,r){return new t({type:"pipe",in:e,out:r})}function chn(t,e){return new t({type:"readonly",innerType:e})}function dhn(t,e,r){return new t({type:"template_literal",parts:e,...bt(r)})}function fhn(t,e){return new t({type:"lazy",getter:e})}function phn(t,e){return new t({type:"promise",innerType:e})}function g2e(t,e,r){let n=bt(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function y2e(t,e,r){return new t({type:"custom",check:"custom",fn:e,...bt(r)})}function b2e(t,e){let r=bt(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??NQ,u=t.Boolean??MQ,l=t.String??tz,c=t.Transform??AQ,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 _2e(t,e,r,n={}){let o=bt(n),i={...bt(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 L4e,v2e=v(()=>{Nme();jQ();Ln();L4e={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function w2e(t){return new uhe({type:"function",input:Array.isArray(t?.input)?m2e(rz,t?.input):t?.input??XQ(RQ,G$(K$)),output:t?.output??G$(K$)})}var uhe,yPt=v(()=>{v2e();Pme();jQ();jQ();uhe=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?aO(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?aO(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 YB(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?YB(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 rz({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 Z$(t,e){if(t instanceof dW){let n=new ZQ(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 ZQ(e);return r.process(t),r.emit(t,e)}function fm(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 fm(o.element,r);case"object":{for(let i in o.shape)if(fm(o.shape[i],r))return!0;return!1}case"union":{for(let i of o.options)if(fm(i,r))return!0;return!1}case"intersection":return fm(o.left,r)||fm(o.right,r);case"tuple":{for(let i of o.items)if(fm(i,r))return!0;return!!(o.rest&&fm(o.rest,r))}case"record":return fm(o.keyType,r)||fm(o.valueType,r);case"map":return fm(o.keyType,r)||fm(o.valueType,r);case"set":return fm(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return fm(o.innerType,r);case"lazy":return fm(o.getter(),r);case"default":return fm(o.innerType,r);case"prefault":return fm(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return fm(o.in,r)||fm(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var ZQ,bPt=v(()=>{j4e();Ln();ZQ=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ml,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(O=>({...this.target==="draft-7"?{type:"string"}:{},pattern:O.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=_Q(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"&&fm(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 _Pt={};var vPt=v(()=>{});var QA={};Rn(QA,{$ZodAny:()=>a4e,$ZodArray:()=>RQ,$ZodAsyncError:()=>iO,$ZodBase64:()=>Xze,$ZodBase64URL:()=>Zze,$ZodBigInt:()=>Lme,$ZodBigIntFormat:()=>r4e,$ZodBoolean:()=>MQ,$ZodCIDRv4:()=>Wze,$ZodCIDRv6:()=>Kze,$ZodCUID:()=>$ze,$ZodCUID2:()=>Lze,$ZodCatch:()=>C4e,$ZodCheck:()=>oc,$ZodCheckBigIntFormat:()=>cze,$ZodCheckEndsWith:()=>Sze,$ZodCheckGreaterThan:()=>Ame,$ZodCheckIncludes:()=>vze,$ZodCheckLengthEquals:()=>gze,$ZodCheckLessThan:()=>Rme,$ZodCheckLowerCase:()=>bze,$ZodCheckMaxLength:()=>mze,$ZodCheckMaxSize:()=>dze,$ZodCheckMimeType:()=>xze,$ZodCheckMinLength:()=>hze,$ZodCheckMinSize:()=>fze,$ZodCheckMultipleOf:()=>uze,$ZodCheckNumberFormat:()=>lze,$ZodCheckOverwrite:()=>Oze,$ZodCheckProperty:()=>Cze,$ZodCheckRegex:()=>yze,$ZodCheckSizeEquals:()=>pze,$ZodCheckStartsWith:()=>wze,$ZodCheckStringFormat:()=>lW,$ZodCheckUpperCase:()=>_ze,$ZodCustom:()=>M4e,$ZodCustomStringFormat:()=>e4e,$ZodDate:()=>u4e,$ZodDefault:()=>_4e,$ZodDiscriminatedUnion:()=>c4e,$ZodE164:()=>Yze,$ZodEmail:()=>Aze,$ZodEmoji:()=>jze,$ZodEnum:()=>h4e,$ZodError:()=>OQ,$ZodFile:()=>y4e,$ZodFunction:()=>uhe,$ZodGUID:()=>Ize,$ZodIPv4:()=>Hze,$ZodIPv6:()=>Jze,$ZodISODate:()=>Bze,$ZodISODateTime:()=>Uze,$ZodISODuration:()=>Vze,$ZodISOTime:()=>zze,$ZodIntersection:()=>d4e,$ZodJWT:()=>Qze,$ZodKSUID:()=>qze,$ZodLazy:()=>P4e,$ZodLiteral:()=>g4e,$ZodMap:()=>p4e,$ZodNaN:()=>x4e,$ZodNanoID:()=>Dze,$ZodNever:()=>IQ,$ZodNonOptional:()=>w4e,$ZodNull:()=>i4e,$ZodNullable:()=>b4e,$ZodNumber:()=>$me,$ZodNumberFormat:()=>t4e,$ZodObject:()=>l4e,$ZodOptional:()=>cW,$ZodPipe:()=>NQ,$ZodPrefault:()=>v4e,$ZodPromise:()=>E4e,$ZodReadonly:()=>O4e,$ZodRealError:()=>uW,$ZodRecord:()=>f4e,$ZodRegistry:()=>dW,$ZodSet:()=>m4e,$ZodString:()=>tz,$ZodStringFormat:()=>Ou,$ZodSuccess:()=>S4e,$ZodSymbol:()=>n4e,$ZodTemplateLiteral:()=>T4e,$ZodTransform:()=>AQ,$ZodTuple:()=>rz,$ZodType:()=>no,$ZodULID:()=>Fze,$ZodURL:()=>Nze,$ZodUUID:()=>Rze,$ZodUndefined:()=>o4e,$ZodUnion:()=>Fme,$ZodUnknown:()=>K$,$ZodVoid:()=>s4e,$ZodXID:()=>kze,$brand:()=>gBe,$constructor:()=>Se,$input:()=>N4e,$output:()=>A4e,Doc:()=>PQ,JSONSchema:()=>_Pt,JSONSchemaGenerator:()=>ZQ,NEVER:()=>hBe,TimePrecision:()=>L4e,_any:()=>o2e,_array:()=>XQ,_base64:()=>ohe,_base64url:()=>ihe,_bigint:()=>Z4e,_boolean:()=>G4e,_catch:()=>uhn,_cidrv4:()=>rhe,_cidrv6:()=>nhe,_coercedBigint:()=>Y4e,_coercedBoolean:()=>X4e,_coercedDate:()=>s2e,_coercedNumber:()=>z4e,_coercedString:()=>$4e,_cuid:()=>Gme,_cuid2:()=>Xme,_custom:()=>g2e,_date:()=>a2e,_default:()=>ihn,_discriminatedUnion:()=>Kmn,_e164:()=>ahe,_email:()=>Ume,_emoji:()=>Wme,_endsWith:()=>VQ,_enum:()=>Qmn,_file:()=>h2e,_float32:()=>H4e,_float64:()=>J4e,_gt:()=>ZA,_gte:()=>Kb,_guid:()=>$Q,_includes:()=>BQ,_int:()=>V4e,_int32:()=>W4e,_int64:()=>Q4e,_intersection:()=>Gmn,_ipv4:()=>ehe,_ipv6:()=>the,_isoDate:()=>k4e,_isoDateTime:()=>F4e,_isoDuration:()=>U4e,_isoTime:()=>q4e,_jwt:()=>she,_ksuid:()=>Qme,_lazy:()=>fhn,_length:()=>mW,_literal:()=>thn,_lowercase:()=>qQ,_lt:()=>XA,_lte:()=>kw,_map:()=>Zmn,_max:()=>kw,_maxLength:()=>pW,_maxSize:()=>fW,_mime:()=>HQ,_min:()=>Kb,_minLength:()=>X$,_minSize:()=>oz,_multipleOf:()=>nz,_nan:()=>u2e,_nanoid:()=>Kme,_nativeEnum:()=>ehn,_negative:()=>c2e,_never:()=>LQ,_nonnegative:()=>f2e,_nonoptional:()=>ahn,_nonpositive:()=>d2e,_normalize:()=>JQ,_null:()=>n2e,_nullable:()=>ohn,_number:()=>B4e,_optional:()=>nhn,_overwrite:()=>YA,_parse:()=>xme,_parseAsync:()=>Ome,_pipe:()=>lhn,_positive:()=>l2e,_promise:()=>phn,_property:()=>p2e,_readonly:()=>chn,_record:()=>Xmn,_refine:()=>y2e,_regex:()=>kQ,_safeParse:()=>Tme,_safeParseAsync:()=>Eme,_set:()=>Ymn,_size:()=>FQ,_startsWith:()=>zQ,_string:()=>D4e,_stringFormat:()=>_2e,_stringbool:()=>b2e,_success:()=>shn,_symbol:()=>t2e,_templateLiteral:()=>dhn,_toLowerCase:()=>KQ,_toUpperCase:()=>GQ,_transform:()=>rhn,_trim:()=>WQ,_tuple:()=>m2e,_uint32:()=>K4e,_uint64:()=>e2e,_ulid:()=>Zme,_undefined:()=>r2e,_union:()=>Wmn,_unknown:()=>G$,_uppercase:()=>UQ,_url:()=>Jme,_uuid:()=>Bme,_uuidv4:()=>zme,_uuidv6:()=>Vme,_uuidv7:()=>Hme,_void:()=>i2e,_xid:()=>Yme,clone:()=>nc,config:()=>ad,flattenError:()=>TQ,formatError:()=>EQ,function:()=>w2e,globalConfig:()=>yQ,globalRegistry:()=>Ml,isValidBase64:()=>Gze,isValidBase64URL:()=>VTt,isValidJWT:()=>HTt,locales:()=>DQ,parse:()=>aO,parseAsync:()=>YB,prettifyError:()=>MBe,regexes:()=>ez,registry:()=>qme,safeParse:()=>RBe,safeParseAsync:()=>ABe,toDotPath:()=>TTt,toJSONSchema:()=>Z$,treeifyError:()=>PBe,util:()=>Mt,version:()=>Eze});var Yg=v(()=>{iW();Pme();IBe();jQ();Nme();Pze();Ln();Ime();R4e();j4e();Tze();yPt();v2e();bPt();vPt()});function Tu(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 ic(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 wPt(t){return Tu(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),ic(t)}function Ya(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(Tu(t)||ic(t))}function S2e(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodLiteral"}function C2e(t){return Tu(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==="literal":!1}function SPt(t){return!!(S2e(t)||C2e(t))}async function Y$(t,e){if(Tu(t))try{return{success:!0,data:await YB(t,e)}}catch(r){return{success:!1,error:r}}if(ic(t))return await t.safeParseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function Q$(t,e){if(Tu(t))return await YB(t,e);if(ic(t))return await t.parseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function CPt(t,e){if(Tu(t))try{return{success:!0,data:aO(t,e)}}catch(r){return{success:!1,error:r}}if(ic(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function xPt(t,e){if(Tu(t))return aO(t,e);if(ic(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function eL(t){if(Tu(t))return Ml.get(t)?.description;if(ic(t)||"description"in t&&typeof t.description=="string")return t.description}function OPt(t){if(!Ya(t))return!1;if(ic(t)){let e=t._def;if(e.typeName==="ZodObject"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.typeName==="ZodRecord")return!0}if(Tu(t)){let e=t._zod.def;if(e.type==="object"){let r=t;return!r.shape||Object.keys(r.shape).length===0}if(e.type==="record")return!0}return typeof t=="object"&&t!==null&&!("shape"in t)}function gW(t){return Ya(t)?ic(t)?t._def.typeName==="ZodString":Tu(t)?t._zod.def.type==="string":!1:!1}function dhe(t){return typeof t=="object"&&t!==null&&"_def"in t&&typeof t._def=="object"&&t._def!==null&&"typeName"in t._def&&t._def.typeName==="ZodObject"}function qw(t){return Tu(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 YQ(t){return Tu(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 x2e(t){return Tu(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 O2e(t){return Tu(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 TPt(t){return!!(dhe(t)||qw(t))}function lhe(t){if(ic(t))return t.shape;if(Tu(t))return t._zod.def.shape;throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function EPt(t,e){if(ic(t))return t.extend(e);if(Tu(t))return Mt.extend(t,e);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function PPt(t){if(ic(t))return t.partial();if(Tu(t))return Mt.partial(cW,t,void 0);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function hW(t,e=!1){if(ic(t))return t.strict();if(qw(t)){let r=t._zod.def.shape;if(e)for(let[i,a]of Object.entries(t._zod.def.shape)){if(qw(a)){let u=hW(a,e);r[i]=u}else if(YQ(a)){let u=a._zod.def.element;qw(u)&&(u=hW(u,e)),r[i]=nc(a,{...a._zod.def,element:u})}else r[i]=a;let s=Ml.get(a);s&&Ml.add(r[i],s)}let n=nc(t,{...t._zod.def,shape:r,catchall:LQ(IQ)}),o=Ml.get(t);return o&&Ml.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function che(t,e=!1){if(dhe(t))return t.passthrough();if(qw(t)){let r=t._zod.def.shape;if(e)for(let[i,a]of Object.entries(t._zod.def.shape)){if(qw(a)){let u=che(a,e);r[i]=u}else if(YQ(a)){let u=a._zod.def.element;qw(u)&&(u=che(u,e)),r[i]=nc(a,{...a._zod.def,element:u})}else r[i]=a;let s=Ml.get(a);s&&Ml.add(r[i],s)}let n=nc(t,{...t._zod.def,shape:r,catchall:G$(K$)}),o=Ml.get(t);return o&&Ml.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function MPt(t){if(ic(t))try{let e=t.parse(void 0);return()=>e}catch{return}if(Tu(t))try{let e=aO(t,void 0);return()=>e}catch{return}}function mhn(t){return ic(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function hhn(t){return Tu(t)&&t._zod.def.type==="pipe"}function iz(t,e,r){let n=r.get(t);if(n!==void 0)return n;if(ic(t))return mhn(t)?iz(t._def.schema,e,r):t;if(Tu(t)){let o=t;if(hhn(t)&&(o=iz(t._zod.def.in,e,r)),e){if(qw(o)){let a={};for(let[s,u]of Object.entries(o._zod.def.shape))a[s]=iz(u,e,r);o=nc(o,{...o._zod.def,shape:a})}else if(YQ(o)){let a=iz(o._zod.def.element,e,r);o=nc(o,{...o._zod.def,element:a})}else if(x2e(o)){let a=iz(o._zod.def.innerType,e,r);o=nc(o,{...o._zod.def,innerType:a})}else if(O2e(o)){let a=iz(o._zod.def.innerType,e,r);o=nc(o,{...o._zod.def,innerType:a})}}let i=Ml.get(t);return i&&Ml.add(o,i),r.set(t,o),o}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function fhe(t,e=!1){return iz(t,e,new WeakMap)}function IPt(t,e){if(ic(t)){let r=lhe(t),n={};for(let[o,i]of Object.entries(r))e(o,i)?n[o]=i.optional():n[o]=i;return t.extend(n)}if(Tu(t)){let r=lhe(t),n={...t._zod.def.shape};for(let[a,s]of Object.entries(r))e(a,s)&&(n[a]=new cW({type:"optional",innerType:s}));let o=nc(t,{...t._zod.def,shape:n}),i=Ml.get(t);return i&&Ml.add(o,i),o}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function phe(t){return t instanceof Error&&(t.constructor.name==="ZodError"||t.constructor.name==="$ZodError")}var eN=v(()=>{Yg()});function T2e(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function yhn(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n};
|
||
`;return e}function RPt(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()??"",w=ghn.some(T=>b.startsWith(T)&&b.endsWith(T))?`<p>${b}</p>`:b;Object.keys(g.metadata??{}).length&&(w+=`<hr/><small><em>${Object.entries(g.metadata??{}).map(([T,P])=>`${T} = ${P}`).join(`
|
||
`)}</em></small>`);let O=(h[y]??h[m]).replace("{0}",T2e(y)).replace("{1}",w);l+=` ${O}
|
||
`}}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:O,conditional:T}=b,P="";if(O!==void 0){let M=O,I=M.split(" ");I.length>u&&(M=Array.from({length:Math.ceil(I.length/u)},(j,A)=>I.slice(A*u,(A+1)*u).join(" ")).join(" <br> ")),P=T?` -. ${M} .-> `:` -- ${M} --> `}else P=T?" -.-> ":" --> ";l+=` ${T2e(_)}${P}${T2e(w)};
|
||
`}h&&!y&&(l+=` end
|
||
`)}p(c[""]??[],"");for(let m in c)!m.includes(":")&&m!==""&&p(c[m],m);return a&&(l+=yhn(i??{})),l}async function APt(t,e){let r=e?.backgroundColor??"white",n=e?.imageType??"png",o=xTt(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 ghn,NPt=v(()=>{Sme();ghn=["*","_","`"]});var DPt,jPt,$Pt,mhe=v(()=>{DPt=Symbol("Let zodToJsonSchema decide on which parser to use"),jPt={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"},$Pt=t=>typeof t=="string"?{...jPt,name:t}:{...jPt,...t}});var LPt,E2e=v(()=>{mhe();LPt=t=>{let e=$Pt(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 hhe,ghe=v(()=>{hhe=(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 Il(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?hhe(e,t.currentPath):e.join("/")}}var Uw=v(()=>{ghe()});function P2e(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Vi(t,e,r,n,o){t[e]=r,P2e(t,e,n,o)}var tL=v(()=>{});var Mi,M2e,ar,sO,QQ=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})(Mi||(Mi={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(M2e||(M2e={}));ar=Mi.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sO=t=>{switch(typeof t){case"undefined":return ar.undefined;case"string":return ar.string;case"number":return Number.isNaN(t)?ar.nan:ar.number;case"boolean":return ar.boolean;case"function":return ar.function;case"bigint":return ar.bigint;case"symbol":return ar.symbol;case"object":return Array.isArray(t)?ar.array:t===null?ar.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ar.promise:typeof Map<"u"&&t instanceof Map?ar.map:typeof Set<"u"&&t instanceof Set?ar.set:typeof Date<"u"&&t instanceof Date?ar.date:ar.object;default:return ar.unknown}}});var nt,bhn,Gb,yhe=v(()=>{QQ();nt=Mi.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"]),bhn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Gb=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,Mi.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()}};Gb.create=t=>new Gb(t)});var _hn,tN,I2e=v(()=>{yhe();QQ();_hn=(t,e)=>{let r;switch(t.code){case nt.invalid_type:t.received===ar.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case nt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Mi.jsonStringifyReplacer)}`;break;case nt.unrecognized_keys:r=`Unrecognized key(s) in object: ${Mi.joinValues(t.keys,", ")}`;break;case nt.invalid_union:r="Invalid input";break;case nt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Mi.joinValues(t.options)}`;break;case nt.invalid_enum_value:r=`Invalid enum value. Expected ${Mi.joinValues(t.options)}, received '${t.received}'`;break;case nt.invalid_arguments:r="Invalid function arguments";break;case nt.invalid_return_type:r="Invalid function return type";break;case nt.invalid_date:r="Invalid date";break;case nt.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}"`:Mi.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case nt.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 nt.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 nt.custom:r="Invalid input";break;case nt.invalid_intersection_types:r="Intersection results could not be merged";break;case nt.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case nt.not_finite:r="Number must be finite";break;default:r=e.defaultError,Mi.assertNever(t)}return{message:r}},tN=_hn});function vhn(t){FPt=t}function yW(){return FPt}var FPt,bhe=v(()=>{I2e();FPt=tN});function Jt(t,e){let r=yW(),n=eee({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===tN?void 0:tN].filter(o=>!!o)});t.common.issues.push(n)}var eee,whn,Yh,wn,az,Qg,_he,vhe,rL,bW,R2e=v(()=>{bhe();I2e();eee=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}},whn=[];Yh=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 wn;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 wn;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}}},wn=Object.freeze({status:"aborted"}),az=t=>({status:"dirty",value:t}),Qg=t=>({status:"valid",value:t}),_he=t=>t.status==="aborted",vhe=t=>t.status==="dirty",rL=t=>t.status==="valid",bW=t=>typeof Promise<"u"&&t instanceof Promise});var kPt=v(()=>{});var Nr,qPt=v(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Nr||(Nr={}))});function zo(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 VPt(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 Fhn(t){return new RegExp(`^${VPt(t)}$`)}function HPt(t){let e=`${zPt}T${VPt(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 khn(t,e){return!!((e==="v4"||!e)&&Rhn.test(t)||(e==="v6"||!e)&&Nhn.test(t))}function qhn(t,e){if(!Ehn.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 Uhn(t,e){return!!((e==="v4"||!e)&&Ahn.test(t)||(e==="v6"||!e)&&jhn.test(t))}function Bhn(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 _W(t){if(t instanceof Xb){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Bw.create(_W(n))}return new Xb({...t._def,shape:()=>e})}else return t instanceof oN?new oN({...t._def,type:_W(t.element)}):t instanceof Bw?Bw.create(_W(t.unwrap())):t instanceof lO?lO.create(_W(t.unwrap())):t instanceof uO?uO.create(t.items.map(e=>_W(e))):t}function N2e(t,e){let r=sO(t),n=sO(e);if(t===e)return{valid:!0,data:t};if(r===ar.object&&n===ar.object){let o=Mi.objectKeys(e),i=Mi.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=N2e(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===ar.array&&n===ar.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=N2e(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===ar.date&&n===ar.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function JPt(t,e){return new yz({values:t,typeName:Ie.ZodEnum,...zo(e)})}function BPt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function WPt(t,e={},r){return t?oL.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=BPt(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=BPt(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):oL.create()}var zw,UPt,si,Shn,Chn,xhn,Ohn,Thn,Ehn,Phn,Mhn,Ihn,A2e,Rhn,Ahn,Nhn,jhn,Dhn,$hn,zPt,Lhn,nL,sz,uz,lz,cz,vW,dz,fz,oL,nN,X0,wW,oN,Xb,pz,rN,whe,mz,uO,She,SW,CW,Che,hz,gz,yz,bz,iL,Vw,Bw,lO,_z,vz,xW,zhn,tee,ree,wz,Vhn,Ie,Hhn,KPt,GPt,Jhn,Whn,XPt,Khn,Ghn,Xhn,Zhn,Yhn,Qhn,egn,tgn,rgn,ngn,ogn,ign,agn,sgn,ugn,lgn,cgn,dgn,fgn,pgn,mgn,hgn,ggn,ygn,bgn,_gn,vgn,wgn,Sgn,Cgn,xgn,Ogn,Tgn,Egn,ZPt=v(()=>{yhe();bhe();qPt();R2e();QQ();zw=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}},UPt=(t,e)=>{if(rL(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 Gb(t.common.issues);return this._error=r,this._error}}};si=class{get description(){return this._def.description}_getType(e){return sO(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:sO(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Yh,ctx:{common:e.parent.common,data:e.data,parsedType:sO(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(bW(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:sO(e)},o=this._parseSync({data:e,path:n.path,parent:n});return UPt(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sO(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return rL(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=>rL(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:sO(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(bW(o)?o:Promise.resolve(o));return UPt(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:nt.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 Vw({schema:this,typeName:Ie.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 Bw.create(this,this._def)}nullable(){return lO.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return oN.create(this)}promise(){return iL.create(this,this._def)}or(e){return pz.create([this,e],this._def)}and(e){return mz.create(this,e,this._def)}transform(e){return new Vw({...zo(this._def),schema:this,typeName:Ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new _z({...zo(this._def),innerType:this,defaultValue:r,typeName:Ie.ZodDefault})}brand(){return new tee({typeName:Ie.ZodBranded,type:this,...zo(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new vz({...zo(this._def),innerType:this,catchValue:r,typeName:Ie.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ree.create(this,e)}readonly(){return wz.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Shn=/^c[^\s-]{8,}$/i,Chn=/^[0-9a-z]+$/,xhn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ohn=/^[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,Thn=/^[a-z0-9_-]{21}$/i,Ehn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Phn=/^[-+]?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)?)??$/,Mhn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ihn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Rhn=/^(?:(?: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])$/,Ahn=/^(?:(?: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])$/,Nhn=/^(([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]))$/,jhn=/^(([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])$/,Dhn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$hn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,zPt="((\\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])))",Lhn=new RegExp(`^${zPt}$`);nL=class t extends si{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ar.string){let i=this._getOrReturnCtx(e);return Jt(i,{code:nt.invalid_type,expected:ar.string,received:i.parsedType}),wn}let n=new Yh,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),Jt(o,{code:nt.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),Jt(o,{code:nt.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?Jt(o,{code:nt.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&Jt(o,{code:nt.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Mhn.test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"email",code:nt.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")A2e||(A2e=new RegExp(Ihn,"u")),A2e.test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"emoji",code:nt.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ohn.test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"uuid",code:nt.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Thn.test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"nanoid",code:nt.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Shn.test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"cuid",code:nt.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Chn.test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"cuid2",code:nt.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")xhn.test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"ulid",code:nt.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),Jt(o,{validation:"url",code:nt.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),Jt(o,{validation:"regex",code:nt.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),Jt(o,{code:nt.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),Jt(o,{code:nt.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),Jt(o,{code:nt.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?HPt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{code:nt.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Lhn.test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{code:nt.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Fhn(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{code:nt.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Phn.test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"duration",code:nt.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?khn(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"ip",code:nt.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?qhn(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"jwt",code:nt.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Uhn(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"cidr",code:nt.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Dhn.test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"base64",code:nt.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?$hn.test(e.data)||(o=this._getOrReturnCtx(e,o),Jt(o,{validation:"base64url",code:nt.invalid_string,message:i.message}),n.dirty()):Mi.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:nt.invalid_string,...Nr.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Nr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Nr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Nr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Nr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Nr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Nr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Nr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Nr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Nr.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Nr.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Nr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Nr.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Nr.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,...Nr.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,...Nr.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Nr.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Nr.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Nr.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Nr.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Nr.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Nr.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Nr.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Nr.errToObj(r)})}nonempty(e){return this.min(1,Nr.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}};nL.create=t=>new nL({checks:[],typeName:Ie.ZodString,coerce:t?.coerce??!1,...zo(t)});sz=class t extends si{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)!==ar.number){let i=this._getOrReturnCtx(e);return Jt(i,{code:nt.invalid_type,expected:ar.number,received:i.parsedType}),wn}let n,o=new Yh;for(let i of this._def.checks)i.kind==="int"?Mi.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Jt(n,{code:nt.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),Jt(n,{code:nt.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),Jt(n,{code:nt.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Bhn(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),Jt(n,{code:nt.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Jt(n,{code:nt.not_finite,message:i.message}),o.dirty()):Mi.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Nr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Nr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Nr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Nr.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Nr.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Nr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Nr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Nr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Nr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Nr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Nr.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Nr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Nr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Nr.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"&&Mi.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)}};sz.create=t=>new sz({checks:[],typeName:Ie.ZodNumber,coerce:t?.coerce||!1,...zo(t)});uz=class t extends si{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)!==ar.bigint)return this._getInvalidInput(e);let n,o=new Yh;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),Jt(n,{code:nt.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),Jt(n,{code:nt.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),Jt(n,{code:nt.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Mi.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Jt(r,{code:nt.invalid_type,expected:ar.bigint,received:r.parsedType}),wn}gte(e,r){return this.setLimit("min",e,!0,Nr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Nr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Nr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Nr.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Nr.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:Nr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Nr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Nr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Nr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Nr.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}};uz.create=t=>new uz({checks:[],typeName:Ie.ZodBigInt,coerce:t?.coerce??!1,...zo(t)});lz=class extends si{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ar.boolean){let n=this._getOrReturnCtx(e);return Jt(n,{code:nt.invalid_type,expected:ar.boolean,received:n.parsedType}),wn}return Qg(e.data)}};lz.create=t=>new lz({typeName:Ie.ZodBoolean,coerce:t?.coerce||!1,...zo(t)});cz=class t extends si{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ar.date){let i=this._getOrReturnCtx(e);return Jt(i,{code:nt.invalid_type,expected:ar.date,received:i.parsedType}),wn}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return Jt(i,{code:nt.invalid_date}),wn}let n=new Yh,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),Jt(o,{code:nt.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),Jt(o,{code:nt.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Mi.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:Nr.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Nr.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}};cz.create=t=>new cz({checks:[],coerce:t?.coerce||!1,typeName:Ie.ZodDate,...zo(t)});vW=class extends si{_parse(e){if(this._getType(e)!==ar.symbol){let n=this._getOrReturnCtx(e);return Jt(n,{code:nt.invalid_type,expected:ar.symbol,received:n.parsedType}),wn}return Qg(e.data)}};vW.create=t=>new vW({typeName:Ie.ZodSymbol,...zo(t)});dz=class extends si{_parse(e){if(this._getType(e)!==ar.undefined){let n=this._getOrReturnCtx(e);return Jt(n,{code:nt.invalid_type,expected:ar.undefined,received:n.parsedType}),wn}return Qg(e.data)}};dz.create=t=>new dz({typeName:Ie.ZodUndefined,...zo(t)});fz=class extends si{_parse(e){if(this._getType(e)!==ar.null){let n=this._getOrReturnCtx(e);return Jt(n,{code:nt.invalid_type,expected:ar.null,received:n.parsedType}),wn}return Qg(e.data)}};fz.create=t=>new fz({typeName:Ie.ZodNull,...zo(t)});oL=class extends si{constructor(){super(...arguments),this._any=!0}_parse(e){return Qg(e.data)}};oL.create=t=>new oL({typeName:Ie.ZodAny,...zo(t)});nN=class extends si{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Qg(e.data)}};nN.create=t=>new nN({typeName:Ie.ZodUnknown,...zo(t)});X0=class extends si{_parse(e){let r=this._getOrReturnCtx(e);return Jt(r,{code:nt.invalid_type,expected:ar.never,received:r.parsedType}),wn}};X0.create=t=>new X0({typeName:Ie.ZodNever,...zo(t)});wW=class extends si{_parse(e){if(this._getType(e)!==ar.undefined){let n=this._getOrReturnCtx(e);return Jt(n,{code:nt.invalid_type,expected:ar.void,received:n.parsedType}),wn}return Qg(e.data)}};wW.create=t=>new wW({typeName:Ie.ZodVoid,...zo(t)});oN=class t extends si{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==ar.array)return Jt(r,{code:nt.invalid_type,expected:ar.array,received:r.parsedType}),wn;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(Jt(r,{code:a?nt.too_big:nt.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&&(Jt(r,{code:nt.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&&(Jt(r,{code:nt.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 zw(r,a,r.path,s)))).then(a=>Yh.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new zw(r,a,r.path,s)));return Yh.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Nr.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Nr.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Nr.toString(r)}})}nonempty(e){return this.min(1,e)}};oN.create=(t,e)=>new oN({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ie.ZodArray,...zo(e)});Xb=class t extends si{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=Mi.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ar.object){let l=this._getOrReturnCtx(e);return Jt(l,{code:nt.invalid_type,expected:ar.object,received:l.parsedType}),wn}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof X0&&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 zw(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof X0){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&&(Jt(o,{code:nt.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 zw(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=>Yh.mergeObjectSync(n,l)):Yh.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Nr.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:Nr.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:Ie.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 Mi.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 Mi.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return _W(this)}partial(e){let r={};for(let n of Mi.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 Mi.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Bw;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return JPt(Mi.objectKeys(this.shape))}};Xb.create=(t,e)=>new Xb({shape:()=>t,unknownKeys:"strip",catchall:X0.create(),typeName:Ie.ZodObject,...zo(e)});Xb.strictCreate=(t,e)=>new Xb({shape:()=>t,unknownKeys:"strict",catchall:X0.create(),typeName:Ie.ZodObject,...zo(e)});Xb.lazycreate=(t,e)=>new Xb({shape:t,unknownKeys:"strip",catchall:X0.create(),typeName:Ie.ZodObject,...zo(e)});pz=class extends si{_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 Gb(s.ctx.common.issues));return Jt(r,{code:nt.invalid_union,unionErrors:a}),wn}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 Gb(u));return Jt(r,{code:nt.invalid_union,unionErrors:s}),wn}}get options(){return this._def.options}};pz.create=(t,e)=>new pz({options:t,typeName:Ie.ZodUnion,...zo(e)});rN=t=>t instanceof hz?rN(t.schema):t instanceof Vw?rN(t.innerType()):t instanceof gz?[t.value]:t instanceof yz?t.options:t instanceof bz?Mi.objectValues(t.enum):t instanceof _z?rN(t._def.innerType):t instanceof dz?[void 0]:t instanceof fz?[null]:t instanceof Bw?[void 0,...rN(t.unwrap())]:t instanceof lO?[null,...rN(t.unwrap())]:t instanceof tee||t instanceof wz?rN(t.unwrap()):t instanceof vz?rN(t._def.innerType):[],whe=class t extends si{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ar.object)return Jt(r,{code:nt.invalid_type,expected:ar.object,received:r.parsedType}),wn;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}):(Jt(r,{code:nt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),wn)}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=rN(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:Ie.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...zo(n)})}};mz=class extends si{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(_he(i)||_he(a))return wn;let s=N2e(i.value,a.value);return s.valid?((vhe(i)||vhe(a))&&r.dirty(),{status:r.value,value:s.data}):(Jt(n,{code:nt.invalid_intersection_types}),wn)};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}))}};mz.create=(t,e,r)=>new mz({left:t,right:e,typeName:Ie.ZodIntersection,...zo(r)});uO=class t extends si{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ar.array)return Jt(n,{code:nt.invalid_type,expected:ar.array,received:n.parsedType}),wn;if(n.data.length<this._def.items.length)return Jt(n,{code:nt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),wn;!this._def.rest&&n.data.length>this._def.items.length&&(Jt(n,{code:nt.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 zw(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Yh.mergeArray(r,a)):Yh.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};uO.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new uO({items:t,typeName:Ie.ZodTuple,rest:null,...zo(e)})};She=class t extends si{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!==ar.object)return Jt(n,{code:nt.invalid_type,expected:ar.object,received:n.parsedType}),wn;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new zw(n,s,n.path,s)),value:a._parse(new zw(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Yh.mergeObjectAsync(r,o):Yh.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof si?new t({keyType:e,valueType:r,typeName:Ie.ZodRecord,...zo(n)}):new t({keyType:nL.create(),valueType:e,typeName:Ie.ZodRecord,...zo(r)})}},SW=class extends si{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!==ar.map)return Jt(n,{code:nt.invalid_type,expected:ar.map,received:n.parsedType}),wn;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new zw(n,s,n.path,[l,"key"])),value:i._parse(new zw(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 wn;(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 wn;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};SW.create=(t,e,r)=>new SW({valueType:e,keyType:t,typeName:Ie.ZodMap,...zo(r)});CW=class t extends si{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==ar.set)return Jt(n,{code:nt.invalid_type,expected:ar.set,received:n.parsedType}),wn;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Jt(n,{code:nt.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&&(Jt(n,{code:nt.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 wn;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 zw(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:Nr.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Nr.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};CW.create=(t,e)=>new CW({valueType:t,minSize:null,maxSize:null,typeName:Ie.ZodSet,...zo(e)});Che=class t extends si{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ar.function)return Jt(r,{code:nt.invalid_type,expected:ar.function,received:r.parsedType}),wn;function n(s,u){return eee({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,yW(),tN].filter(l=>!!l),issueData:{code:nt.invalid_arguments,argumentsError:u}})}function o(s,u){return eee({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,yW(),tN].filter(l=>!!l),issueData:{code:nt.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof iL){let s=this;return Qg(async function(...u){let l=new Gb([]),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 Qg(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new Gb([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new Gb([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:uO.create(e).rest(nN.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||uO.create([]).rest(nN.create()),returns:r||nN.create(),typeName:Ie.ZodFunction,...zo(n)})}},hz=class extends si{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})}};hz.create=(t,e)=>new hz({getter:t,typeName:Ie.ZodLazy,...zo(e)});gz=class extends si{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Jt(r,{received:r.data,code:nt.invalid_literal,expected:this._def.value}),wn}return{status:"valid",value:e.data}}get value(){return this._def.value}};gz.create=(t,e)=>new gz({value:t,typeName:Ie.ZodLiteral,...zo(e)});yz=class t extends si{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Jt(r,{expected:Mi.joinValues(n),received:r.parsedType,code:nt.invalid_type}),wn}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 Jt(r,{received:r.data,code:nt.invalid_enum_value,options:n}),wn}return Qg(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})}};yz.create=JPt;bz=class extends si{_parse(e){let r=Mi.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ar.string&&n.parsedType!==ar.number){let o=Mi.objectValues(r);return Jt(n,{expected:Mi.joinValues(o),received:n.parsedType,code:nt.invalid_type}),wn}if(this._cache||(this._cache=new Set(Mi.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=Mi.objectValues(r);return Jt(n,{received:n.data,code:nt.invalid_enum_value,options:o}),wn}return Qg(e.data)}get enum(){return this._def.values}};bz.create=(t,e)=>new bz({values:t,typeName:Ie.ZodNativeEnum,...zo(e)});iL=class extends si{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ar.promise&&r.common.async===!1)return Jt(r,{code:nt.invalid_type,expected:ar.promise,received:r.parsedType}),wn;let n=r.parsedType===ar.promise?r.data:Promise.resolve(r.data);return Qg(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};iL.create=(t,e)=>new iL({type:t,typeName:Ie.ZodPromise,...zo(e)});Vw=class extends si{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ie.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=>{Jt(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 wn;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?wn:u.status==="dirty"?az(u.value):r.value==="dirty"?az(u.value):u});{if(r.value==="aborted")return wn;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?wn:s.status==="dirty"?az(s.value):r.value==="dirty"?az(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"?wn:(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"?wn:(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(!rL(a))return wn;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=>rL(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):wn);Mi.assertNever(o)}};Vw.create=(t,e,r)=>new Vw({schema:t,typeName:Ie.ZodEffects,effect:e,...zo(r)});Vw.createWithPreprocess=(t,e,r)=>new Vw({schema:e,effect:{type:"preprocess",transform:t},typeName:Ie.ZodEffects,...zo(r)});Bw=class extends si{_parse(e){return this._getType(e)===ar.undefined?Qg(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Bw.create=(t,e)=>new Bw({innerType:t,typeName:Ie.ZodOptional,...zo(e)});lO=class extends si{_parse(e){return this._getType(e)===ar.null?Qg(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lO.create=(t,e)=>new lO({innerType:t,typeName:Ie.ZodNullable,...zo(e)});_z=class extends si{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===ar.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};_z.create=(t,e)=>new _z({innerType:t,typeName:Ie.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...zo(e)});vz=class extends si{_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 bW(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Gb(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Gb(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};vz.create=(t,e)=>new vz({innerType:t,typeName:Ie.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...zo(e)});xW=class extends si{_parse(e){if(this._getType(e)!==ar.nan){let n=this._getOrReturnCtx(e);return Jt(n,{code:nt.invalid_type,expected:ar.nan,received:n.parsedType}),wn}return{status:"valid",value:e.data}}};xW.create=t=>new xW({typeName:Ie.ZodNaN,...zo(t)});zhn=Symbol("zod_brand"),tee=class extends si{_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}},ree=class t extends si{_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"?wn:i.status==="dirty"?(r.dirty(),az(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"?wn: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:Ie.ZodPipeline})}},wz=class extends si{_parse(e){let r=this._def.innerType._parse(e),n=o=>(rL(o)&&(o.value=Object.freeze(o.value)),o);return bW(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};wz.create=(t,e)=>new wz({innerType:t,typeName:Ie.ZodReadonly,...zo(e)});Vhn={object:Xb.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"})(Ie||(Ie={}));Hhn=(t,e={message:`Input not instance of ${t.name}`})=>WPt(r=>r instanceof t,e),KPt=nL.create,GPt=sz.create,Jhn=xW.create,Whn=uz.create,XPt=lz.create,Khn=cz.create,Ghn=vW.create,Xhn=dz.create,Zhn=fz.create,Yhn=oL.create,Qhn=nN.create,egn=X0.create,tgn=wW.create,rgn=oN.create,ngn=Xb.create,ogn=Xb.strictCreate,ign=pz.create,agn=whe.create,sgn=mz.create,ugn=uO.create,lgn=She.create,cgn=SW.create,dgn=CW.create,fgn=Che.create,pgn=hz.create,mgn=gz.create,hgn=yz.create,ggn=bz.create,ygn=iL.create,bgn=Vw.create,_gn=Bw.create,vgn=lO.create,wgn=Vw.createWithPreprocess,Sgn=ree.create,Cgn=()=>KPt().optional(),xgn=()=>GPt().optional(),Ogn=()=>XPt().optional(),Tgn={string:t=>nL.create({...t,coerce:!0}),number:t=>sz.create({...t,coerce:!0}),boolean:t=>lz.create({...t,coerce:!0}),bigint:t=>uz.create({...t,coerce:!0}),date:t=>cz.create({...t,coerce:!0})},Egn=wn});var Ct={};Rn(Ct,{BRAND:()=>zhn,DIRTY:()=>az,EMPTY_PATH:()=>whn,INVALID:()=>wn,NEVER:()=>Egn,OK:()=>Qg,ParseStatus:()=>Yh,Schema:()=>si,ZodAny:()=>oL,ZodArray:()=>oN,ZodBigInt:()=>uz,ZodBoolean:()=>lz,ZodBranded:()=>tee,ZodCatch:()=>vz,ZodDate:()=>cz,ZodDefault:()=>_z,ZodDiscriminatedUnion:()=>whe,ZodEffects:()=>Vw,ZodEnum:()=>yz,ZodError:()=>Gb,ZodFirstPartyTypeKind:()=>Ie,ZodFunction:()=>Che,ZodIntersection:()=>mz,ZodIssueCode:()=>nt,ZodLazy:()=>hz,ZodLiteral:()=>gz,ZodMap:()=>SW,ZodNaN:()=>xW,ZodNativeEnum:()=>bz,ZodNever:()=>X0,ZodNull:()=>fz,ZodNullable:()=>lO,ZodNumber:()=>sz,ZodObject:()=>Xb,ZodOptional:()=>Bw,ZodParsedType:()=>ar,ZodPipeline:()=>ree,ZodPromise:()=>iL,ZodReadonly:()=>wz,ZodRecord:()=>She,ZodSchema:()=>si,ZodSet:()=>CW,ZodString:()=>nL,ZodSymbol:()=>vW,ZodTransformer:()=>Vw,ZodTuple:()=>uO,ZodType:()=>si,ZodUndefined:()=>dz,ZodUnion:()=>pz,ZodUnknown:()=>nN,ZodVoid:()=>wW,addIssueToContext:()=>Jt,any:()=>Yhn,array:()=>rgn,bigint:()=>Whn,boolean:()=>XPt,coerce:()=>Tgn,custom:()=>WPt,date:()=>Khn,datetimeRegex:()=>HPt,defaultErrorMap:()=>tN,discriminatedUnion:()=>agn,effect:()=>bgn,enum:()=>hgn,function:()=>fgn,getErrorMap:()=>yW,getParsedType:()=>sO,instanceof:()=>Hhn,intersection:()=>sgn,isAborted:()=>_he,isAsync:()=>bW,isDirty:()=>vhe,isValid:()=>rL,late:()=>Vhn,lazy:()=>pgn,literal:()=>mgn,makeIssue:()=>eee,map:()=>cgn,nan:()=>Jhn,nativeEnum:()=>ggn,never:()=>egn,null:()=>Zhn,nullable:()=>vgn,number:()=>GPt,object:()=>ngn,objectUtil:()=>M2e,oboolean:()=>Ogn,onumber:()=>xgn,optional:()=>_gn,ostring:()=>Cgn,pipeline:()=>Sgn,preprocess:()=>wgn,promise:()=>ygn,quotelessJson:()=>bhn,record:()=>lgn,set:()=>dgn,setErrorMap:()=>vhn,strictObject:()=>ogn,string:()=>KPt,symbol:()=>Ghn,transformer:()=>bgn,tuple:()=>ugn,undefined:()=>Xhn,union:()=>ign,unknown:()=>Qhn,util:()=>Mi,void:()=>tgn});var nee=v(()=>{bhe();R2e();kPt();QQ();ZPt();yhe()});var cO=v(()=>{nee();nee()});function YPt(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==Ie.ZodAny&&(r.items=An(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Vi(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Vi(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Vi(r,"minItems",t.exactLength.value,t.exactLength.message,e),Vi(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var j2e=v(()=>{tL();sd();cO()});function QPt(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?Vi(r,"minimum",n.value,n.message,e):Vi(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Vi(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Vi(r,"maximum",n.value,n.message,e):Vi(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Vi(r,"maximum",n.value,n.message,e));break;case"multipleOf":Vi(r,"multipleOf",n.value,n.message,e);break}return r}var D2e=v(()=>{tL()});function eMt(){return{type:"boolean"}}var $2e=v(()=>{});function xhe(t,e){return An(t.type._def,e)}var Ohe=v(()=>{sd()});var tMt,L2e=v(()=>{sd();tMt=(t,e)=>An(t.innerType._def,e)});function F2e(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(o=>F2e(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 Pgn(t,e)}}var Pgn,k2e=v(()=>{tL();Pgn=(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":Vi(r,"minimum",n.value,n.message,e);break;case"max":Vi(r,"maximum",n.value,n.message,e);break}return r}});function rMt(t,e){return{...An(t.innerType._def,e),default:t.defaultValue()}}var q2e=v(()=>{sd()});function nMt(t,e){return e.effectStrategy==="input"?An(t.schema._def,e):Il(e)}var U2e=v(()=>{Uw();sd()});function oMt(t){return{type:"string",enum:Array.from(t.values)}}var B2e=v(()=>{});function iMt(t,e){let r=[An(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),An(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(Mgn(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 Mgn,z2e=v(()=>{sd();Mgn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function aMt(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 V2e=v(()=>{});function The(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":Vi(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":Vi(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":Y0(r,"email",n.message,e);break;case"format:idn-email":Y0(r,"idn-email",n.message,e);break;case"pattern:zod":rb(r,Z0.email,n.message,e);break}break;case"url":Y0(r,"uri",n.message,e);break;case"uuid":Y0(r,"uuid",n.message,e);break;case"regex":rb(r,n.regex,n.message,e);break;case"cuid":rb(r,Z0.cuid,n.message,e);break;case"cuid2":rb(r,Z0.cuid2,n.message,e);break;case"startsWith":rb(r,RegExp(`^${J2e(n.value,e)}`),n.message,e);break;case"endsWith":rb(r,RegExp(`${J2e(n.value,e)}$`),n.message,e);break;case"datetime":Y0(r,"date-time",n.message,e);break;case"date":Y0(r,"date",n.message,e);break;case"time":Y0(r,"time",n.message,e);break;case"duration":Y0(r,"duration",n.message,e);break;case"length":Vi(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),Vi(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":rb(r,RegExp(J2e(n.value,e)),n.message,e);break;case"ip":n.version!=="v6"&&Y0(r,"ipv4",n.message,e),n.version!=="v4"&&Y0(r,"ipv6",n.message,e);break;case"base64url":rb(r,Z0.base64url,n.message,e);break;case"jwt":rb(r,Z0.jwt,n.message,e);break;case"cidr":n.version!=="v6"&&rb(r,Z0.ipv4Cidr,n.message,e),n.version!=="v4"&&rb(r,Z0.ipv6Cidr,n.message,e);break;case"emoji":rb(r,Z0.emoji(),n.message,e);break;case"ulid":rb(r,Z0.ulid,n.message,e);break;case"base64":switch(e.base64Strategy){case"format:binary":Y0(r,"binary",n.message,e);break;case"contentEncoding:base64":Vi(r,"contentEncoding","base64",n.message,e);break;case"pattern:zod":rb(r,Z0.base64,n.message,e);break}break;case"nanoid":rb(r,Z0.nanoid,n.message,e);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function J2e(t,e){return e.patternStrategy==="escape"?Rgn(t):t}function Rgn(t){let e="";for(let r=0;r<t.length;r++)Ign.has(t[r])||(e+="\\"),e+=t[r];return e}function Y0(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}}})):Vi(t,"format",e,r,n)}function rb(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:sMt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Vi(t,"pattern",sMt(e,n),r,n)}function sMt(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 H2e,Z0,Ign,Ehe=v(()=>{tL();Z0={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:()=>(H2e===void 0&&(H2e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),H2e),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-_]*$/};Ign=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function Phe(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===Ie.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:An(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??Il(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:An(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===Ie.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=The(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===Ie.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===Ie.ZodBranded&&t.keyType._def.type._def.typeName===Ie.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=xhe(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var Mhe=v(()=>{Uw();Ohe();Ehe();sd();cO()});function uMt(t,e){if(e.mapStrategy==="record")return Phe(t,e);let r=An(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Il(e),n=An(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Il(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var W2e=v(()=>{Uw();Mhe();sd()});function lMt(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 K2e=v(()=>{});function cMt(t){return t.target==="openAi"?void 0:{not:Il({...t,currentPath:[...t.currentPath,"not"]})}}var G2e=v(()=>{Uw()});function dMt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var X2e=v(()=>{});function pMt(t,e){if(e.target==="openApi3")return fMt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in oee&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=oee[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;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 fMt(t,e)}var oee,fMt,Ihe=v(()=>{sd();oee={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};fMt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>An(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 mMt(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:oee[t.innerType._def.typeName],nullable:!0}:{type:[oee[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=An(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=An(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var Z2e=v(()=>{Ihe();sd()});function hMt(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",P2e(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Vi(r,"minimum",n.value,n.message,e):Vi(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Vi(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Vi(r,"maximum",n.value,n.message,e):Vi(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Vi(r,"maximum",n.value,n.message,e));break;case"multipleOf":Vi(r,"multipleOf",n.value,n.message,e);break}return r}var Y2e=v(()=>{tL()});function gMt(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=Ngn(u);l&&r&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),l=!1);let c=An(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=Agn(t,e);return a!==void 0&&(n.additionalProperties=a),n}function Agn(t,e){if(t.catchall._def.typeName!=="ZodNever")return An(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 Ngn(t){try{return t.isOptional()}catch{return!0}}var Q2e=v(()=>{sd()});var yMt,eVe=v(()=>{Uw();sd();yMt=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return An(t.innerType._def,e);let r=An(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Il(e)},r]}:Il(e)}});var bMt,tVe=v(()=>{sd();bMt=(t,e)=>{if(e.pipeStrategy==="input")return An(t.in._def,e);if(e.pipeStrategy==="output")return An(t.out._def,e);let r=An(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=An(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function _Mt(t,e){return An(t.type._def,e)}var rVe=v(()=>{sd()});function vMt(t,e){let n={type:"array",uniqueItems:!0,items:An(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Vi(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Vi(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var nVe=v(()=>{tL();sd()});function wMt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>An(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:An(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>An(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var oVe=v(()=>{sd()});function SMt(t){return{not:Il(t)}}var iVe=v(()=>{Uw()});function CMt(t){return Il(t)}var aVe=v(()=>{Uw()});var xMt,sVe=v(()=>{sd();xMt=(t,e)=>An(t.innerType._def,e)});var OMt,uVe=v(()=>{Uw();j2e();D2e();$2e();Ohe();L2e();k2e();q2e();U2e();B2e();z2e();V2e();Ehe();Mhe();W2e();K2e();G2e();X2e();Ihe();Z2e();Y2e();Q2e();eVe();tVe();rVe();nVe();oVe();iVe();aVe();sVe();cO();OMt=(t,e,r)=>{switch(e){case Ie.ZodString:return The(t,r);case Ie.ZodNumber:return hMt(t,r);case Ie.ZodObject:return gMt(t,r);case Ie.ZodBigInt:return QPt(t,r);case Ie.ZodBoolean:return eMt();case Ie.ZodDate:return F2e(t,r);case Ie.ZodUndefined:return SMt(r);case Ie.ZodNull:return dMt(r);case Ie.ZodArray:return YPt(t,r);case Ie.ZodUnion:case Ie.ZodDiscriminatedUnion:return pMt(t,r);case Ie.ZodIntersection:return iMt(t,r);case Ie.ZodTuple:return wMt(t,r);case Ie.ZodRecord:return Phe(t,r);case Ie.ZodLiteral:return aMt(t,r);case Ie.ZodEnum:return oMt(t);case Ie.ZodNativeEnum:return lMt(t);case Ie.ZodNullable:return mMt(t,r);case Ie.ZodOptional:return yMt(t,r);case Ie.ZodMap:return uMt(t,r);case Ie.ZodSet:return vMt(t,r);case Ie.ZodLazy:return()=>t.getter()._def;case Ie.ZodPromise:return _Mt(t,r);case Ie.ZodNaN:case Ie.ZodNever:return cMt(r);case Ie.ZodEffects:return nMt(t,r);case Ie.ZodAny:return Il(r);case Ie.ZodUnknown:return CMt(r);case Ie.ZodDefault:return rMt(t,r);case Ie.ZodBranded:return xhe(t,r);case Ie.ZodReadonly:return xMt(t,r);case Ie.ZodCatch:return tMt(t,r);case Ie.ZodPipeline:return bMt(t,r);case Ie.ZodFunction:case Ie.ZodVoid:case Ie.ZodSymbol:return;default:return(n=>{})(e)}}});function An(t,e,r=!1){let n=e.seen.get(t);if(e.override){let s=e.override?.(t,e,n,r);if(s!==DPt)return s}if(n&&!r){let s=jgn(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=OMt(t,t.typeName,e),a=typeof i=="function"?An(i(),e):i;if(a&&Dgn(t,e,a),e.postProcess){let s=e.postProcess(a,t,e);return o.jsonSchema=a,s}return o.jsonSchema=a,a}var jgn,Dgn,sd=v(()=>{mhe();ghe();Uw();uVe();jgn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:hhe(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`),Il(e)):e.$refStrategy==="seen"?Il(e):void 0}},Dgn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var TMt,lVe=v(()=>{E2e();Uw();sd();TMt=(t,e)=>{let r=LPt(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:An(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??Il(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=An(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??Il(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 EMt=v(()=>{mhe();E2e();tL();ghe();Uw();j2e();D2e();$2e();Ohe();L2e();k2e();q2e();U2e();B2e();z2e();V2e();Ehe();Mhe();W2e();K2e();G2e();X2e();Ihe();Z2e();Y2e();Q2e();eVe();tVe();rVe();nVe();oVe();iVe();aVe();sVe();uVe();sd();lVe()});function dO(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(!dO(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(!dO(t[a],e[a]))return!1;return!0}return t===e}var cVe=v(()=>{});function yv(t){return encodeURI($gn(t))}function $gn(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var Rhe=v(()=>{});function Q0(t,e=Object.create(null),r=qgn,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:Q0(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(kgn[i])continue;let a=`${n}/${yv(i)}`,s=t[i];if(Array.isArray(s)){if(Lgn[i]){let u=s.length;for(let l=0;l<u;l++)Q0(s[l],e,r,`${a}/${l}`)}}else if(Fgn[i])for(let u in s)Q0(s[u],e,r,`${a}/${yv(u)}`);else Q0(s,e,r,a)}return e}var Lgn,Fgn,kgn,qgn,Ahe=v(()=>{Rhe();Lgn={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Fgn={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},kgn={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},qgn=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 Zb(t){return t.test.bind(t)}function syn(t){return t%4===0&&(t%100!==0||t%400===0)}function PMt(t){let e=t.match(Ugn);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&syn(r)?29:Bgn[n])}function MMt(t,e){let r=e.match(zgn);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 lyn(t){let e=t.split(uyn);return e.length==2&&PMt(e[0])&&MMt(!0,e[1])}function fyn(t){return cyn.test(t)&&dyn.test(t)}function myn(t){if(pyn.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var Ugn,Bgn,zgn,Vgn,Hgn,Jgn,Wgn,Kgn,Ggn,Xgn,Zgn,Ygn,Qgn,eyn,tyn,ryn,nyn,oyn,iyn,ayn,dVe,uyn,cyn,dyn,pyn,fVe=v(()=>{Ugn=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Bgn=[0,31,28,31,30,31,30,31,31,30,31,30,31],zgn=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Vgn=/^(?=.{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,Hgn=/^(?:[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,Jgn=/^(?:(?:[^\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,Wgn=/^(?:(?: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,Kgn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Ggn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Xgn=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Zgn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Ygn=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Qgn=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,eyn=/^\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,tyn=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,ryn=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))},nyn=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,oyn=/^((([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,iyn=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));ayn={date:PMt,time:MMt.bind(void 0,!1),"date-time":lyn,duration:iyn,uri:fyn,"uri-reference":Zb(Hgn),"uri-template":Zb(Jgn),url:Zb(Wgn),email:ryn,hostname:Zb(Vgn),ipv4:Zb(nyn),ipv6:Zb(oyn),regex:myn,uuid:Zb(Kgn),"json-pointer":Zb(Ggn),"json-pointer-uri-fragment":Zb(Xgn),"relative-json-pointer":Zb(Zgn)},dVe={...ayn,date:Zb(Ygn),time:Zb(Qgn),"date-time":Zb(eyn),"uri-reference":Zb(tyn)};uyn=/t|\s/i;cyn=/\/|:/,dyn=/^(?:[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;pyn=/[^\\]\\Z/});var IMt,RMt=v(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(IMt||(IMt={}))});function AMt(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 pVe=v(()=>{});function qu(t,e,r="2019-09",n=Q0(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:O,if:T,then:P,else:M,format:I,properties:j,patternProperties:A,additionalProperties:k,unevaluatedProperties:V,minProperties:q,maxProperties:J,propertyNames:K,dependentRequired:ue,dependentSchemas:oe,dependencies:G,prefixItems:Y,items:se,additionalItems:ie,unevaluatedItems:$,contains:H,minContains:re,maxContains:D,minItems:R,maxItems:z,uniqueItems:U,minimum:ee,maximum:ce,exclusiveMinimum:ve,exclusiveMaximum:Oe,multipleOf:Je,minLength:tt,maxLength:Ke,pattern:dt,__absolute_ref__:Pt,__absolute_recursive_ref__:Nt}=e,Ne=[];if(p===!0&&i===null&&(i=e),f==="#"){let st=i===null?n[Nt]:i,Le=`${s}/$recursiveRef`,rt=qu(t,i===null?e:i,r,n,o,st,a,Le,u);rt.valid||Ne.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:Le,error:"A subschema had errors."},...rt.errors)}if(d!==void 0){let Le=n[Pt||d];if(Le===void 0){let We=`Unresolved $ref "${d}".`;throw Pt&&Pt!==d&&(We+=` Absolute URI "${Pt}".`),We+=`
|
||
Known schemas:
|
||
- ${Object.keys(n).join(`
|
||
- `)}`,new Error(We)}let rt=`${s}/$ref`,Fe=qu(t,Le,r,n,o,i,a,rt,u);if(Fe.valid||Ne.push({instanceLocation:a,keyword:"$ref",keywordLocation:rt,error:"A subschema had errors."},...Fe.errors),r==="4"||r==="7")return{valid:Ne.length===0,errors:Ne}}if(Array.isArray(m)){let st=m.length,Le=!1;for(let rt=0;rt<st;rt++)if(c===m[rt]||m[rt]==="integer"&&c==="number"&&t%1===0&&t===t){Le=!0;break}Le||Ne.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)&&Ne.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`}):m!==void 0&&c!==m&&Ne.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`});if(h!==void 0&&(c==="object"||c==="array"?dO(t,h)||Ne.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):t!==h&&Ne.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(st=>dO(t,st))||Ne.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(y)}.`}):y.some(st=>t===st)||Ne.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(y)}.`})),b!==void 0){let st=`${s}/not`;qu(t,b,r,n,o,i,a,st).valid&&Ne.push({instanceLocation:a,keyword:"not",keywordLocation:st,error:'Instance matched "not" schema.'})}let Tr=[];if(_!==void 0){let st=`${s}/anyOf`,Le=Ne.length,rt=!1;for(let Fe=0;Fe<_.length;Fe++){let We=_[Fe],ke=Object.create(u),Lt=qu(t,We,r,n,o,p===!0?i:null,a,`${st}/${Fe}`,ke);Ne.push(...Lt.errors),rt=rt||Lt.valid,Lt.valid&&Tr.push(ke)}rt?Ne.length=Le:Ne.splice(Le,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:st,error:"Instance does not match any subschemas."})}if(w!==void 0){let st=`${s}/allOf`,Le=Ne.length,rt=!0;for(let Fe=0;Fe<w.length;Fe++){let We=w[Fe],ke=Object.create(u),Lt=qu(t,We,r,n,o,p===!0?i:null,a,`${st}/${Fe}`,ke);Ne.push(...Lt.errors),rt=rt&&Lt.valid,Lt.valid&&Tr.push(ke)}rt?Ne.length=Le:Ne.splice(Le,0,{instanceLocation:a,keyword:"allOf",keywordLocation:st,error:"Instance does not match every subschema."})}if(O!==void 0){let st=`${s}/oneOf`,Le=Ne.length,rt=O.filter((Fe,We)=>{let ke=Object.create(u),Lt=qu(t,Fe,r,n,o,p===!0?i:null,a,`${st}/${We}`,ke);return Ne.push(...Lt.errors),Lt.valid&&Tr.push(ke),Lt.valid}).length;rt===1?Ne.length=Le:Ne.splice(Le,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:st,error:`Instance does not match exactly one subschema (${rt} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...Tr),T!==void 0){let st=`${s}/if`;if(qu(t,T,r,n,o,i,a,st,u).valid){if(P!==void 0){let rt=qu(t,P,r,n,o,i,a,`${s}/then`,u);rt.valid||Ne.push({instanceLocation:a,keyword:"if",keywordLocation:st,error:'Instance does not match "then" schema.'},...rt.errors)}}else if(M!==void 0){let rt=qu(t,M,r,n,o,i,a,`${s}/else`,u);rt.valid||Ne.push({instanceLocation:a,keyword:"if",keywordLocation:st,error:'Instance does not match "else" schema.'},...rt.errors)}}if(c==="object"){if(g!==void 0)for(let Fe of g)Fe in t||Ne.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${Fe}".`});let st=Object.keys(t);if(q!==void 0&&st.length<q&&Ne.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${q} properties.`}),J!==void 0&&st.length>J&&Ne.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${J} properties.`}),K!==void 0){let Fe=`${s}/propertyNames`;for(let We in t){let ke=`${a}/${yv(We)}`,Lt=qu(We,K,r,n,o,i,ke,Fe);Lt.valid||Ne.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:Fe,error:`Property name "${We}" does not match schema.`},...Lt.errors)}}if(ue!==void 0){let Fe=`${s}/dependantRequired`;for(let We in ue)if(We in t){let ke=ue[We];for(let Lt of ke)Lt in t||Ne.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:Fe,error:`Instance has "${We}" but does not have "${Lt}".`})}}if(oe!==void 0)for(let Fe in oe){let We=`${s}/dependentSchemas`;if(Fe in t){let ke=qu(t,oe[Fe],r,n,o,i,a,`${We}/${yv(Fe)}`,u);ke.valid||Ne.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:We,error:`Instance has "${Fe}" but does not match dependant schema.`},...ke.errors)}}if(G!==void 0){let Fe=`${s}/dependencies`;for(let We in G)if(We in t){let ke=G[We];if(Array.isArray(ke))for(let Lt of ke)Lt in t||Ne.push({instanceLocation:a,keyword:"dependencies",keywordLocation:Fe,error:`Instance has "${We}" but does not have "${Lt}".`});else{let Lt=qu(t,ke,r,n,o,i,a,`${Fe}/${yv(We)}`);Lt.valid||Ne.push({instanceLocation:a,keyword:"dependencies",keywordLocation:Fe,error:`Instance has "${We}" but does not match dependant schema.`},...Lt.errors)}}}let Le=Object.create(null),rt=!1;if(j!==void 0){let Fe=`${s}/properties`;for(let We in j){if(!(We in t))continue;let ke=`${a}/${yv(We)}`,Lt=qu(t[We],j[We],r,n,o,i,ke,`${Fe}/${yv(We)}`);if(Lt.valid)u[We]=Le[We]=!0;else if(rt=o,Ne.push({instanceLocation:a,keyword:"properties",keywordLocation:Fe,error:`Property "${We}" does not match schema.`},...Lt.errors),rt)break}}if(!rt&&A!==void 0){let Fe=`${s}/patternProperties`;for(let We in A){let ke=new RegExp(We,"u"),Lt=A[We];for(let Eo in t){if(!ke.test(Eo))continue;let xl=`${a}/${yv(Eo)}`,In=qu(t[Eo],Lt,r,n,o,i,xl,`${Fe}/${yv(We)}`);In.valid?u[Eo]=Le[Eo]=!0:(rt=o,Ne.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:Fe,error:`Property "${Eo}" matches pattern "${We}" but does not match associated schema.`},...In.errors))}}}if(!rt&&k!==void 0){let Fe=`${s}/additionalProperties`;for(let We in t){if(Le[We])continue;let ke=`${a}/${yv(We)}`,Lt=qu(t[We],k,r,n,o,i,ke,Fe);Lt.valid?u[We]=!0:(rt=o,Ne.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:Fe,error:`Property "${We}" does not match additional properties schema.`},...Lt.errors))}}else if(!rt&&V!==void 0){let Fe=`${s}/unevaluatedProperties`;for(let We in t)if(!u[We]){let ke=`${a}/${yv(We)}`,Lt=qu(t[We],V,r,n,o,i,ke,Fe);Lt.valid?u[We]=!0:Ne.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:Fe,error:`Property "${We}" does not match unevaluated properties schema.`},...Lt.errors)}}}else if(c==="array"){z!==void 0&&t.length>z&&Ne.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${z}).`}),R!==void 0&&t.length<R&&Ne.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${t.length} < ${R}).`});let st=t.length,Le=0,rt=!1;if(Y!==void 0){let Fe=`${s}/prefixItems`,We=Math.min(Y.length,st);for(;Le<We;Le++){let ke=qu(t[Le],Y[Le],r,n,o,i,`${a}/${Le}`,`${Fe}/${Le}`);if(u[Le]=!0,!ke.valid&&(rt=o,Ne.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:Fe,error:"Items did not match schema."},...ke.errors),rt))break}}if(se!==void 0){let Fe=`${s}/items`;if(Array.isArray(se)){let We=Math.min(se.length,st);for(;Le<We;Le++){let ke=qu(t[Le],se[Le],r,n,o,i,`${a}/${Le}`,`${Fe}/${Le}`);if(u[Le]=!0,!ke.valid&&(rt=o,Ne.push({instanceLocation:a,keyword:"items",keywordLocation:Fe,error:"Items did not match schema."},...ke.errors),rt))break}}else for(;Le<st;Le++){let We=qu(t[Le],se,r,n,o,i,`${a}/${Le}`,Fe);if(u[Le]=!0,!We.valid&&(rt=o,Ne.push({instanceLocation:a,keyword:"items",keywordLocation:Fe,error:"Items did not match schema."},...We.errors),rt))break}if(!rt&&ie!==void 0){let We=`${s}/additionalItems`;for(;Le<st;Le++){let ke=qu(t[Le],ie,r,n,o,i,`${a}/${Le}`,We);u[Le]=!0,ke.valid||(rt=o,Ne.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:We,error:"Items did not match additional items schema."},...ke.errors))}}}if(H!==void 0)if(st===0&&re===void 0)Ne.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(re!==void 0&&st<re)Ne.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${st}) than minContains (${re}).`});else{let Fe=`${s}/contains`,We=Ne.length,ke=0;for(let Lt=0;Lt<st;Lt++){let Eo=qu(t[Lt],H,r,n,o,i,`${a}/${Lt}`,Fe);Eo.valid?(u[Lt]=!0,ke++):Ne.push(...Eo.errors)}ke>=(re||0)&&(Ne.length=We),re===void 0&&D===void 0&&ke===0?Ne.splice(We,0,{instanceLocation:a,keyword:"contains",keywordLocation:Fe,error:"Array does not contain item matching schema."}):re!==void 0&&ke<re?Ne.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${re} items matching schema. Only ${ke} items were found.`}):D!==void 0&&ke>D&&Ne.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${D} items matching schema. ${ke} items were found.`})}if(!rt&&$!==void 0){let Fe=`${s}/unevaluatedItems`;for(Le;Le<st;Le++){if(u[Le])continue;let We=qu(t[Le],$,r,n,o,i,`${a}/${Le}`,Fe);u[Le]=!0,We.valid||Ne.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:Fe,error:"Items did not match unevaluated items schema."},...We.errors)}}if(U)for(let Fe=0;Fe<st;Fe++){let We=t[Fe],ke=typeof We=="object"&&We!==null;for(let Lt=0;Lt<st;Lt++){if(Fe===Lt)continue;let Eo=t[Lt];(We===Eo||ke&&(typeof Eo=="object"&&Eo!==null)&&dO(We,Eo))&&(Ne.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${Fe} and ${Lt}.`}),Fe=Number.MAX_SAFE_INTEGER,Lt=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(r==="4"?(ee!==void 0&&(ve===!0&&t<=ee||t<ee)&&Ne.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${ve?"or equal to ":""} ${ee}.`}),ce!==void 0&&(Oe===!0&&t>=ce||t>ce)&&Ne.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Oe?"or equal to ":""} ${ce}.`})):(ee!==void 0&&t<ee&&Ne.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${ee}.`}),ce!==void 0&&t>ce&&Ne.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${ce}.`}),ve!==void 0&&t<=ve&&Ne.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${ve}.`}),Oe!==void 0&&t>=Oe&&Ne.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Oe}.`})),Je!==void 0){let st=t%Je;Math.abs(0-st)>=11920929e-14&&Math.abs(Je-st)>=11920929e-14&&Ne.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${Je}.`})}}else if(c==="string"){let st=tt===void 0&&Ke===void 0?0:AMt(t);tt!==void 0&&st<tt&&Ne.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${st} < ${tt}).`}),Ke!==void 0&&st>Ke&&Ne.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${st} > ${Ke}).`}),dt!==void 0&&!new RegExp(dt,"u").test(t)&&Ne.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),I!==void 0&&dVe[I]&&!dVe[I](t)&&Ne.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${I}".`})}return{valid:Ne.length===0,errors:Ne}}var mVe=v(()=>{cVe();Ahe();fVe();Rhe();pVe()});var Nhe,NMt=v(()=>{Ahe();mVe();Nhe=class{constructor(e,r="2019-09",n=!0){x(this,"schema");x(this,"draft");x(this,"shortCircuit");x(this,"lookup");this.schema=e,this.draft=r,this.shortCircuit=n,this.lookup=Q0(e)}validate(e){return qu(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,r){r&&(e={...e,$id:r}),Q0(e,this.lookup)}}});var jhe=v(()=>{cVe();Ahe();fVe();Rhe();RMt();pVe();mVe();NMt()});function Ni(t,e){if(Tu(t)){let r=fhe(t,!0);if(qw(r)){let n=hW(r,!0);return Z$(n,e)}else return Z$(t,e)}return ic(t)?TMt(t):t}function OW(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=>OW(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=>OW(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=Q0(t);return r[e]?OW(r[e]):!1}return!1}var hyn,nb=v(()=>{Bo();eN();lVe();EMt();Yg();jhe();hyn={};Rt(hyn,{Validator:()=>Nhe,deepCompareStrict:()=>dO,toJsonSchema:()=>Ni,validatesOnlyStrings:()=>OW})});function yyn(t,e){if(t!==void 0&&!Z3(t))return t;if(gQ(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 byn(t){return gQ(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...Ni(t.data.schema),title:t.data.name}}}function jMt(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 DMt(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 gyn,Dhe,LMt=v(()=>{Bo();Sme();NPt();nb();HY();gyn={};Rt(gyn,{Graph:()=>Dhe});Dhe=class $Mt{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]=Z3(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...byn(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??VY(),i={id:o,data:e,name:yyn(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 jMt(this)}lastNode(){return DMt(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(Z3)&&(n="");let i=l=>n?`${n}:${l}`:l;Object.entries(e.nodes).forEach(([l,c])=>{this.nodes[i(l)]={...c,id:i(l)}});let a=e.edges.map(l=>({...l,source:i(l.source),target:i(l.target)}));this.edges=[...this.edges,...a];let s=e.firstNode(),u=e.lastNode();return[s?{id:i(s.id),data:s.data}:void 0,u?{id:i(u.id),data:u.data}:void 0]}trimFirstNode(){let e=this.firstNode();e&&jMt(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&DMt(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 Z3(o)&&r.get(i)===1?i:o};return new $Mt({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 RPt(a.nodes,a.edges,{firstNode:s?.id,lastNode:u?.id,withStyles:r,curveStyle:n,nodeColors:o,wrapLabelNWords:i})}async drawMermaidPng(e){let r=this.drawMermaid(e);return APt(r,{backgroundColor:e?.backgroundColor})}}});function FMt(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 Qy.fromReadableStream(r)}var kMt=v(()=>{nO()});function hVe(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function $he(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*gVe(t,e){for(;;){let{value:r,done:n}=eh.runWithConfig(Yy(t),e.next.bind(e),!0);if(n)break;yield r}}async function*Lhe(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await eh.runWithConfig(Yy(t),r.next.bind(e),!0);if(o)break;yield n}}var qMt,UMt=v(()=>{HB();JB();rO();qMt=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function ud(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function vyn(t){if(tme(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function bv(t){if(typeof t=="function")return new Yb({func:t});if(Vo.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=bv(n);return new aL({steps:e})}else throw new Error(`Expected a Runnable, function or object.
|
||
Instead got an unsupported type.`)}function wyn(t,e){let r=e.name??t.getName(),n=e.description??eL(e.schema);return gW(e.schema)?new Fhe({name:r,description:n,schema:Ct.object({input:Ct.string()}).transform(o=>o.input),bound:t}):new Fhe({name:r,description:n,schema:e.schema,bound:t})}var Vo,Hw,zMt,khe,Rl,aL,_yn,Yb,KMt,yVe,aee,bVe,Fhe,Qh=v(()=>{L$();Wfe();HB();JB();rO();rW();nO();pTt();bTt();pBe();GB();STt();Sme();eN();LMt();kMt();UMt();cO();HY();GUe();Vo=class extends Kh{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 khe({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new Hw({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new yVe({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(Qo);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)=>Qo(i===0?e:n))}return Array.from({length:r},()=>Qo(e))}async batch(e,r,n){let o=this._getOptionsList(r??{},e.length),i=o[0]?.maxConcurrency??n?.maxConcurrency,a=new Fw({maxConcurrency:i,onFailedAttempt:u=>{throw u}}),s=e.map((u,l)=>a.call(async()=>{try{return await this.invoke(u,o[l])}catch(c){if(n?.returnExceptions)return c;throw c}}));return Promise.all(s)}async*_streamIterator(e,r){yield this.invoke(e,r)}async stream(e,r){let n=Qo(r),o=new H$({generator:this._streamIterator(e,n),config:n});return await o.setup,Qy.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=Qo(e):r=Qo({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=Qo(n),a=await(await Zg(o))?.handleChainStart(this.toJSON(),ud(r,"input"),o.runId,o?.runType,void 0,void 0,o?.runName??this.getName());delete o.runId;let s;try{let u=e.call(this,r,o,a);s=await $w(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(ud(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(Zg)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),ud(r[c],"input"),i[c].runId,i[c].runType,void 0,void 0,i[c].runName??this.getName());return delete i[c].runId,d})),u;try{let l=e.call(this,r,i,s,o);u=await $w(l,i?.[0]?.signal)}catch(l){throw await Promise.all(s.map(c=>c?.handleChainError(l))),l}return await Promise.all(s.map(l=>l?.handleChainEnd(ud(u,"output")))),u}_concatOutputChunks(e,r){return eb(e,r)}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=Qo(n),l=await Zg(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 sBe(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(gTt),h=p.output;m!==void 0&&f!==void 0&&(h=m.tapOutputIterable(f.runId,h));let y=f?.handlers.find(fBe);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:ud(o,"input")}),p}await f?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:ud(o,"input")})}getGraph(e){let r=new Dhe,n=r.addNode({name:`${this.getName()}Input`,schema:Ct.any()}),o=r.addNode(this),i=r.addNode({name:`${this.getName()}Output`,schema:Ct.any()});return r.addEdge(n,o),r.addEdge(o,i),r}pipe(e){return new Rl({first:this,last:bv(e)})}pick(e){return this.pipe(new bVe(e))}assign(e){return this.pipe(new aee(new aL({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,Qo(r))}async*streamLog(e,r,n){let o=new bme({...n,autoClose:!1,_schemaFormat:"original"}),i=Qo(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 oO({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"?FMt(o):Qy.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new yTt({...n,autoClose:!1}),i=Qo(r),a=i.runId??VY();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=Qo(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new bme({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new CTt({...n}),f=this._streamLog(e,c,a);for await(let m of f){if(o?o=o.concat(m):o=yme.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={},O=o.state.logs[b];if(O.end_time===void 0?O.streamed_output.length>0?_="stream":_="start":_="end",_==="start")O.inputs!==void 0&&(w.input=O.inputs);else if(_==="end")O.inputs!==void 0&&(w.input=O.inputs),w.output=O.final_output;else if(_==="stream"){let T=O.streamed_output.length;if(T!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${T} instead. Encountered in: "${O.name}"`);w={chunk:O.streamed_output[0]},O.streamed_output=[]}yield{event:`on_${O.type}_${_}`,name:O.name,run_id:O.id,tags:O.tags,metadata:O.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 gQ(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new Hw({bound:this,config:{},configFactories:[o=>({callbacks:[new mBe({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return wyn(this,e)}},Hw=class BMt extends Vo{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=WB(this.config,...r);return WB(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 khe({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(Qo(a),this.kwargs))):await this._mergeConfig(Qo(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(Qo(n),this.kwargs))}async stream(r,n){return this.bound.stream(r,await this._mergeConfig(Qo(n),this.kwargs))}async*transform(r,n){yield*this.bound.transform(r,await this._mergeConfig(Qo(n),this.kwargs))}streamEvents(r,n,o){let i=this,a=async function*(){yield*i.bound.streamEvents(r,{...await i._mergeConfig(Qo(n),i.kwargs),version:n.version},o)};return Qy.fromAsyncGenerator(a())}static isRunnableBinding(r){return r.bound&&Vo.isRunnable(r.bound)}withListeners({onStart:r,onEnd:n,onError:o}){return new BMt({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[i=>({callbacks:[new mBe({config:i,onStart:r,onEnd:n,onError:o})]})]})}},zMt=class VMt extends Vo{constructor(r){super(r);x(this,"lc_serializable",!0);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"bound");this.bound=r.bound}static lc_name(){return"RunnableEach"}async invoke(r,n){return this._callWithConfig(this._invoke.bind(this),r,n)}async _invoke(r,n,o){return this.bound.batch(r,Js(n,{callbacks:o?.getChild()}))}withListeners({onStart:r,onEnd:n,onError:o}){return new VMt({bound:this.bound.withListeners({onStart:r,onEnd:n,onError:o})})}},khe=class extends Hw{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 Js(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return hQ(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 hQ(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)}},Rl=class iee extends Vo{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=Qo(n),a=await(await Zg(o))?.handleChainStart(this.toJSON(),ud(r,"input"),o.runId,void 0,void 0,void 0,o?.runName);delete o.runId;let s=r,u;try{let l=[this.first,...this.middle];for(let c=0;c<l.length;c+=1){let f=l[c].invoke(s,Js(o,{callbacks:a?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`)}));s=await $w(f,n?.signal)}if(n?.signal?.aborted)throw V$(n.signal);u=await this.last.invoke(s,Js(o,{callbacks:a?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(l){throw await a?.handleChainError(l),l}return await a?.handleChainEnd(ud(u,"output")),u}async batch(r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(Zg)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),ud(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){let d=this.steps[l].batch(u,s.map((f,p)=>{let m=f?.getChild(this.omitSequenceTags?void 0:`seq:step:${l+1}`);return Js(i[p],{callbacks:m})}),o);u=await $w(d,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(ud(u,"output")))),u}_concatOutputChunks(r,n){return this.last._concatOutputChunks(r,n)}async*_streamIterator(r,n){let o=await Zg(n),{runId:i,...a}=n??{},s=await o?.handleChainStart(this.toJSON(),ud(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(),Js(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,Js(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(ud(c,"output"))}getGraph(r){let n=new Dhe,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 iee.isRunnableSequence(r)?new iee({first:this.first,middle:this.middle.concat([this.last,r.first,...r.middle]),last:r.last,name:this.name??r.name}):new iee({first:this.first,middle:[...this.middle,this.last],last:bv(r),name:this.name})}static isRunnableSequence(r){return Array.isArray(r.middle)&&Vo.isRunnable(r)}static from([r,...n],o){let i={};return typeof o=="string"?i.name=o:o!==void 0&&(i=o),new iee({...i,first:bv(r),middle:n.slice(0,-1).map(bv),last:bv(n[n.length-1])})}},aL=class HMt extends Vo{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]=bv(o)}static lc_name(){return"RunnableMap"}getStepsKeys(){return Object.keys(this.steps)}static from(r){return new HMt({steps:r})}async invoke(r,n){let o=Qo(n),a=await(await Zg(o))?.handleChainStart(this.toJSON(),{input:r},o.runId,void 0,void 0,void 0,o?.runName);delete o.runId;let s={};try{let u=Object.entries(this.steps).map(async([l,c])=>{s[l]=await c.invoke(r,Js(o,{callbacks:a?.getChild(`map:key:${l}`)}))});await $w(Promise.all(u),n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(s),s}async*_transform(r,n,o){let i={...this.steps},a=sme(r,Object.keys(i).length),s=new Map(Object.entries(i).map(([u,l],c)=>{let d=l.transform(a[c],Js(o,{callbacks:n?.getChild(`map:key:${u}`)}));return[u,d.next().then(f=>({key:u,gen:d,result:f}))]}));for(;s.size;){let u=Promise.race(s.values()),{key:l,result:c,gen:d}=await $w(u,o?.signal);s.delete(l),c.done||(yield{[l]:c.value},s.set(l,d.next().then(f=>({key:l,gen:d,result:f}))))}}transform(r,n){return this._transformStreamWithConfig(r,this._transform.bind(this),n)}async stream(r,n){async function*o(){yield r}let i=Qo(n),a=new H$({generator:this.transform(o(),i),config:i});return await a.setup,Qy.fromAsyncGenerator(a)}},_yn=class JMt extends Vo{constructor(r){super(r);x(this,"lc_serializable",!1);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"func");if(!tme(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 Zg(o),a=this.func(Js(o,{callbacks:i}),r);return $w(a,o?.signal)}async*_streamIterator(r,n){let[o]=this._getOptionsList(n??{},1),i=await this.invoke(r,n);if($he(i)){for await(let a of i)o?.signal?.throwIfAborted(),yield a;return}if(qMt(i)){for(;;){o?.signal?.throwIfAborted();let a=i.next();if(a.done)break;yield a.value}return}yield i}static from(r){return new JMt({func:r})}};Yb=class WMt extends Vo{constructor(r){if(tme(r.func))return _yn.from(r.func);super(r);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"func");vyn(r.func),this.func=r.func}static lc_name(){return"RunnableLambda"}static from(r){return new WMt({func:r})}async _invoke(r,n,o){return new Promise((i,a)=>{let s=Js(n,{callbacks:o?.getChild(),recursionLimit:(n?.recursionLimit??ame)-1});eh.runWithConfig(Yy(s),async()=>{try{let u=await this.func(r,{...s});if(u&&Vo.isRunnable(u)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");u=await u.invoke(r,{...s,recursionLimit:(s.recursionLimit??ame)-1})}else if($he(u)){let l;for await(let c of Lhe(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(hVe(u)){let l;for(let c of gVe(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=Js(o,{callbacks:n?.getChild(),recursionLimit:(o?.recursionLimit??ame)-1}),s=await new Promise((u,l)=>{eh.runWithConfig(Yy(a),async()=>{try{let c=await this.func(i,{...a,config:a});u(c)}catch(c){l(c)}})});if(s&&Vo.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($he(s))for await(let u of Lhe(a,s))o?.signal?.throwIfAborted(),yield u;else if(hVe(s))for(let u of gVe(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=Qo(n),a=new H$({generator:this.transform(o(),i),config:i});return await a.setup,Qy.fromAsyncGenerator(a)}},KMt=class extends aL{},yVe=class extends Vo{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=Qo(r),o=await Zg(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),ud(e,"input"),i,void 0,void 0,void 0,a?.runName),u=Js(a,{callbacks:s?.getChild()});return await eh.runWithConfig(u,async()=>{let c;for(let d of this.runnables()){n?.signal?.throwIfAborted();try{let f=await d.invoke(e,u);return await s?.handleChainEnd(ud(f,"output")),f}catch(f){c===void 0&&(c=f)}}throw c===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(c),c)})}async*_streamIterator(e,r){let n=Qo(r),o=await Zg(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),ud(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=Js(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=Lhe(f,p);break}catch(p){u===void 0&&(u=p)}}if(l===void 0){let d=u??new Error("No error stored at end of fallback.");throw await s?.handleChainError(d),d}let c;try{for await(let d of l){yield d;try{c=c===void 0?c:this._concatOutputChunks(c,d)}catch{c=void 0}}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(ud(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=>Zg(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),ud(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)=>Js(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(ud(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.")}};aee=class extends Vo{constructor(e){e instanceof aL&&(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]=sme(e),s=this.mapper.transform(a,Js(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=Qo(r),i=new H$({generator:this.transform(n(),o),config:o});return await i.setup,Qy.fromAsyncGenerator(i)}},bVe=class extends Vo{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=Qo(r),i=new H$({generator:this.transform(n(),o),config:o});return await i.setup,Qy.fromAsyncGenerator(i)}},Fhe=class extends Hw{constructor(e){let r=Rl.from([Yb.from(async n=>{let o;if(F$(n))try{o=await Q$(this.schema,n.args)}catch{throw new H3("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 Eu,qhe=v(()=>{rO();nO();Qh();Eu=class extends Vo{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=Qo(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=Qo(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=eb(o,a)}catch{o=void 0,i=!1}this.func&&o!==void 0&&await this.func(o,n)}static assign(e){return new aee(new aL({steps:e}))}}});var GMt,XMt=v(()=>{rO();Qh();GMt=class extends Vo{constructor(e){super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"runnables");this.runnables=e.runnables}static lc_name(){return"RouterRunnable"}async invoke(e,r){let{key:n,input:o}=e,i=this.runnables[n];if(i===void 0)throw new Error(`No runnable associated with key "${n}".`);return i.invoke(o,Qo(r))}async batch(e,r,n){let o=e.map(f=>f.key),i=e.map(f=>f.input);if(o.find(f=>this.runnables[f]===void 0)!==void 0)throw new Error("One or more keys do not have a corresponding runnable.");let s=o.map(f=>this.runnables[f]),u=this._getOptionsList(r??{},e.length),l=u[0]?.maxConcurrency??n?.maxConcurrency,c=l&&l>0?l:e.length,d=[];for(let f=0;f<i.length;f+=c){let p=i.slice(f,f+c).map((h,y)=>s[y].invoke(h,u[y])),m=await Promise.all(p);d.push(m)}return d.flat()}async stream(e,r){let{key:n,input:o}=e,i=this.runnables[n];if(i===void 0)throw new Error(`No runnable associated with key "${n}".`);return i.stream(o,r)}}});var ZMt,YMt=v(()=>{rO();nO();Qh();ZMt=class extends Vo{constructor(e){super(e);x(this,"lc_namespace",["langchain_core","runnables"]);x(this,"lc_serializable",!0);x(this,"default");x(this,"branches");this.branches=e.branches,this.default=e.default}static lc_name(){return"RunnableBranch"}static from(e){if(e.length<1)throw new Error("RunnableBranch requires at least one branch");let n=e.slice(0,-1).map(([i,a])=>[bv(i),bv(a)]),o=bv(e[e.length-1]);return new this({branches:n,default:o})}async _invoke(e,r,n){let o;for(let i=0;i<this.branches.length;i+=1){let[a,s]=this.branches[i];if(await a.invoke(e,Js(r,{callbacks:n?.getChild(`condition:${i+1}`)}))){o=await s.invoke(e,Js(r,{callbacks:n?.getChild(`branch:${i+1}`)}));break}}return o||(o=await this.default.invoke(e,Js(r,{callbacks:n?.getChild("branch:default")}))),o}async invoke(e,r={}){return this._callWithConfig(this._invoke,e,r)}async*_streamIterator(e,r){let o=await(await Zg(r))?.handleChainStart(this.toJSON(),ud(e,"input"),r?.runId,void 0,void 0,void 0,r?.runName),i,a=!0,s;try{for(let u=0;u<this.branches.length;u+=1){let[l,c]=this.branches[u];if(await l.invoke(e,Js(r,{callbacks:o?.getChild(`condition:${u+1}`)}))){s=await c.stream(e,Js(r,{callbacks:o?.getChild(`branch:${u+1}`)}));for await(let f of s)if(yield f,a)if(i===void 0)i=f;else try{i=eb(i,f)}catch{i=void 0,a=!1}break}}if(s===void 0){s=await this.default.stream(e,Js(r,{callbacks:o?.getChild("branch:default")}));for await(let u of s)if(yield u,a)if(i===void 0)i=u;else try{i=eb(i,u)}catch{i=void 0,a=!1}}}catch(u){throw await o?.handleChainError(u),u}await o?.handleChainEnd(i??{})}}});function nIt(t,e){return Array.isArray(t)?QMt(t,e):Yb.from(r=>QMt(r,t))}function QMt(t,e={}){let{includeNames:r,excludeNames:n,includeTypes:o,excludeTypes:i,includeIds:a,excludeIds:s}=e,u=[];for(let l of t)if(!(n&&l.name&&n.includes(l.name))){{if(i&&Uhe(l,i))continue;if(s&&l.id&&s.includes(l.id))continue}o||a||r?(r&&l.name&&r.some(c=>c===l.name)||o&&Uhe(l,o)||a&&l.id&&a.some(c=>c===l.id))&&u.push(l):u.push(l)}return u}function oIt(t){return Array.isArray(t)?eIt(t):Yb.from(eIt)}function eIt(t){if(!t.length)return[];let e=[];for(let r of t){let n=r,o=e.pop();if(!o)e.push(n);else if(n.getType()==="tool"||n.getType()!==o.getType())e.push(o,n);else{let i=$B(o),a=$B(n),s=i.concat(a);typeof i.content=="string"&&typeof a.content=="string"&&(s.content=`${i.content}
|
||
${a.content}`),e.push(Cyn(s))}}return e}function iIt(t,e){if(Array.isArray(t)){let r=t;if(!e)throw new Error("Options parameter is required when providing messages.");return tIt(r,e)}else{let r=t;return Yb.from(n=>tIt(n,r)).withConfig({runName:"trim_messages"})}}async function tIt(t,e){let{maxTokens:r,tokenCounter:n,strategy:o="last",allowPartial:i=!1,endOn:a,startOn:s,includeSystem:u=!1,textSplitter:l}=e;if(s&&o==="first")throw new Error("`startOn` should only be specified if `strategy` is 'last'.");if(u&&o==="first")throw new Error("`includeSystem` should only be specified if `strategy` is 'last'.");let c;"getNumTokens"in n?c=async f=>(await Promise.all(f.map(m=>n.getNumTokens(m.content)))).reduce((m,h)=>m+h,0):c=async f=>n(f);let d=vVe;if(l&&("splitText"in l?d=l.splitText:d=async f=>l(f)),o==="first")return aIt(t,{maxTokens:r,tokenCounter:c,textSplitter:d,partialStrategy:i?"first":void 0,endOn:a});if(o==="last")return Syn(t,{maxTokens:r,tokenCounter:c,textSplitter:d,allowPartial:i,includeSystem:u,startOn:s,endOn:a});throw new Error(`Unrecognized strategy: '${o}'. Must be one of 'first' or 'last'.`)}async function aIt(t,e){let{maxTokens:r,tokenCounter:n,textSplitter:o,partialStrategy:i,endOn:a}=e,s=[...t],u=0;for(let l=0;l<s.length;l+=1){let c=l>0?s.slice(0,-l):s;if(await n(c)<=r){u=s.length-l;break}}if(u<s.length&&i){let l=!1;if(Array.isArray(s[u].content)){let c=s[u];if(typeof c.content=="string")throw new Error("Expected content to be an array.");let d=c.content.length,f=i==="last"?[...c.content].reverse():c.content;for(let p=1;p<=d;p+=1){let m=i==="first"?f.slice(0,p):f.slice(-p),h=Object.fromEntries(Object.entries(c).filter(([b])=>b!=="type"&&!b.startsWith("lc_"))),y=_Ve(c.getType(),{...h,content:m}),g=[...s.slice(0,u),y];if(await n(g)<=r)s=g,u+=1,l=!0;else break}l&&i==="last"&&(c.content=[...f].reverse())}if(!l){let c=s[u],d;if(Array.isArray(c.content)&&c.content.some(f=>typeof f=="string"||f.type==="text")?d=c.content.find(p=>p.type==="text"&&p.text)?.text:typeof c.content=="string"&&(d=c.content),d){let f=await o(d),p=f.length;i==="last"&&f.reverse();for(let m=0;m<p-1;m+=1)if(f.pop(),c.content=f.join(""),await n([...s.slice(0,u),c])<=r){i==="last"&&(c.content=[...f].reverse().join("")),s=[...s.slice(0,u),c],u+=1;break}}}}if(a){let l=Array.isArray(a)?a:[a];for(;u>0&&!Uhe(s[u-1],l);)u-=1}return s.slice(0,u)}async function Syn(t,e){let{allowPartial:r=!1,includeSystem:n=!1,endOn:o,startOn:i,...a}=e,s=t.map(c=>{let d=Object.fromEntries(Object.entries(c).filter(([f])=>f!=="type"&&!f.startsWith("lc_")));return _Ve(c.getType(),d,K3(c))});if(o){let c=Array.isArray(o)?o:[o];for(;s.length>0&&!Uhe(s[s.length-1],c);)s=s.slice(0,-1)}let u=n&&s[0]?.getType()==="system",l=u?s.slice(0,1).concat(s.slice(1).reverse()):s.reverse();return l=await aIt(l,{...a,partialStrategy:r?"last":void 0,endOn:i}),u?[l[0],...l.slice(1).reverse()]:l.reverse()}function _Ve(t,e,r){let n,o;switch(t){case"human":r?n=new mv(e):o=new Hs(e);break;case"ai":if(r){let i={...e};"tool_calls"in i&&(i={...i,tool_call_chunks:i.tool_calls?.map(a=>({...a,type:"tool_call_chunk",index:void 0,args:JSON.stringify(a.args)}))}),n=new Ir(i)}else o=new eo(e);break;case"system":r?n=new Wy(e):o=new Qm(e);break;case"developer":r?n=new Wy({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}}):o=new Qm({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in e)r?n=new Iw(e):o=new Wg(e);else throw new Error("Can not convert ToolMessage to ToolMessageChunk if 'tool_call_id' field is not defined.");break;case"function":if(r)n=new pv(e);else{if(!e.name)throw new Error("FunctionMessage must have a 'name' field");o=new jB(e)}break;case"generic":if("role"in e)r?n=new fv(e):o=new nd(e);else throw new Error("Can not convert ChatMessage to ChatMessageChunk if 'role' field is not defined.");break;default:throw new Error(`Unrecognized message type ${t}`)}if(r&&n)return n;if(o)return o;throw new Error(`Unrecognized message type ${t}`)}function Cyn(t){let e=t.getType(),r,n=Object.fromEntries(Object.entries(t).filter(([o])=>!["type","tool_call_chunks"].includes(o)&&!o.startsWith("lc_")));if(e in rIt&&(r=_Ve(e,n)),!r)throw new Error(`Unrecognized message chunk class ${e}. Supported classes are ${Object.keys(rIt)}`);return r}function vVe(t){let e=t.split(`
|
||
`);return Promise.resolve([...e.slice(0,-1).map(r=>`${r}
|
||
`),e[e.length-1]])}var Uhe,rIt,sIt=v(()=>{Jg();G3();kY();rpe();U$();npe();qY();H0();Rw();Qh();Uhe=(t,e)=>{let r=[...new Set(e?.map(o=>{if(typeof o=="string")return o;let i=new o({});if(!("getType"in i)||typeof i.getType!="function")throw new Error("Invalid type provided.");return i.getType()}))],n=t.getType();return r.some(o=>o===n)};rIt={human:{message:Hs,messageChunk:mv},ai:{message:eo,messageChunk:Ir},system:{message:Qm,messageChunk:Wy},developer:{message:Qm,messageChunk:Wy},tool:{message:Wg,messageChunk:Iw},function:{message:jB,messageChunk:pv},generic:{message:nd,messageChunk:fv},remove:{message:DB,messageChunk:DB}}});var uIt,lIt=v(()=>{uIt=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"]});var cIt,dIt=v(()=>{cIt=["image","video","audio","text-plain","file"]});var fIt,pIt=v(()=>{lIt();dIt();fIt=["text","reasoning",...uIt,...cIt]});var xyn,Qa=v(()=>{Bo();DY();mqe();Jg();ape();G3();kY();rpe();U$();npe();qY();H0();Rw();sIt();pIt();xyn={};Rt(xyn,{AIMessage:()=>eo,AIMessageChunk:()=>Ir,BaseMessage:()=>Uc,BaseMessageChunk:()=>Jy,ChatMessage:()=>nd,ChatMessageChunk:()=>fv,FunctionMessage:()=>jB,FunctionMessageChunk:()=>pv,HumanMessage:()=>Hs,HumanMessageChunk:()=>mv,KNOWN_BLOCK_TYPES:()=>fIt,RemoveMessage:()=>DB,SystemMessage:()=>Qm,SystemMessageChunk:()=>Wy,ToolMessage:()=>Wg,ToolMessageChunk:()=>Iw,_isMessageFieldWithRole:()=>tpe,_mergeDicts:()=>El,_mergeLists:()=>NB,_mergeObj:()=>epe,_mergeStatus:()=>Qfe,coerceMessageLikeToMessage:()=>Aw,collapseToolCallChunks:()=>spe,convertToChunk:()=>$B,convertToOpenAIImageBlock:()=>Gfe,convertToProviderContentBlock:()=>Zx,defaultTextSplitter:()=>vVe,defaultToolCallParser:()=>LY,filterMessages:()=>nIt,getBufferString:()=>ol,iife:()=>upe,isAIMessage:()=>Pl,isAIMessageChunk:()=>UY,isBase64ContentBlock:()=>W3,isBaseMessage:()=>Gh,isBaseMessageChunk:()=>K3,isChatMessage:()=>vSt,isChatMessageChunk:()=>wSt,isDataContentBlock:()=>Ym,isDirectToolOutput:()=>$Y,isFunctionMessage:()=>SSt,isFunctionMessageChunk:()=>CSt,isHumanMessage:()=>xSt,isHumanMessageChunk:()=>OSt,isIDContentBlock:()=>Kfe,isMessage:()=>Yfe,isOpenAIToolCallArray:()=>ySt,isPlainTextContentBlock:()=>oSt,isSystemMessage:()=>TSt,isSystemMessageChunk:()=>ESt,isToolMessage:()=>FY,isToolMessageChunk:()=>gqe,isURLContentBlock:()=>J3,mapChatMessagesToStoredMessages:()=>YSt,mapStoredMessageToChatMessage:()=>BY,mapStoredMessagesToChatMessages:()=>ZSt,mergeContent:()=>Hg,mergeMessageRuns:()=>oIt,mergeResponseMetadata:()=>ipe,mergeUsageMetadata:()=>X3,parseBase64DataUrl:()=>zg,parseMimeType:()=>jY,trimMessages:()=>iIt})});var mIt,hIt=v(()=>{Jg();U$();Rw();Qh();Qa();qhe();mIt=class extends Hw{constructor(e){let r=Yb.from((a,s)=>this._enterHistory(a,s??{})).withConfig({runName:"loadHistory"}),n=e.historyMessagesKey??e.inputMessagesKey;n&&(r=Eu.assign({[n]:r}).withConfig({runName:"insertHistory"}));let o=r.pipe(e.runnable.withListeners({onEnd:(a,s)=>this._exitHistory(a,s??{})})).withConfig({runName:"RunnableWithMessageHistory"}),i=e.config??{};super({...e,config:i,bound:o});x(this,"runnable");x(this,"inputMessagesKey");x(this,"outputMessagesKey");x(this,"historyMessagesKey");x(this,"getMessageHistory");this.runnable=e.runnable,this.getMessageHistory=e.getMessageHistory,this.inputMessagesKey=e.inputMessagesKey,this.outputMessagesKey=e.outputMessagesKey,this.historyMessagesKey=e.historyMessagesKey}_getInputMessages(e){let r;if(typeof e=="object"&&!Array.isArray(e)&&!Gh(e)){let n;this.inputMessagesKey?n=this.inputMessagesKey:Object.keys(e).length===1?n=Object.keys(e)[0]:n="input",Array.isArray(e[n])&&Array.isArray(e[n][0])?r=e[n][0]:r=e[n]}else r=e;if(typeof r=="string")return[new Hs(r)];if(Array.isArray(r))return r;if(Gh(r))return[r];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages.
|
||
Got ${JSON.stringify(r,null,2)}`)}_getOutputMessages(e){let r;if(!Array.isArray(e)&&!Gh(e)&&typeof e!="string"){let n;this.outputMessagesKey!==void 0?n=this.outputMessagesKey:Object.keys(e).length===1?n=Object.keys(e)[0]:n="output",e.generations!==void 0?r=e.generations[0][0].message:r=e[n]}else r=e;if(typeof r=="string")return[new eo(r)];if(Array.isArray(r))return r;if(Gh(r))return[r];throw new Error(`Expected a string, BaseMessage, or array of BaseMessages. Received: ${JSON.stringify(r,null,2)}`)}async _enterHistory(e,r){let o=await(r?.configurable?.messageHistory).getMessages();return this.historyMessagesKey===void 0?o.concat(this._getInputMessages(e)):o}async _exitHistory(e,r){let n=r.configurable?.messageHistory,o;Array.isArray(e.inputs)&&Array.isArray(e.inputs[0])?o=e.inputs[0]:o=e.inputs;let i=this._getInputMessages(o);if(this.historyMessagesKey===void 0){let u=await n.getMessages();i=i.slice(u.length)}let a=e.outputs;if(!a)throw new Error(`Output values from 'Run' undefined. Run: ${JSON.stringify(e,null,2)}`);let s=this._getOutputMessages(a);await n.addMessages([...i,...s])}async _mergeConfig(...e){let r=await super._mergeConfig(...e);if(!r.configurable||!r.configurable.sessionId){let o={[this.inputMessagesKey??"input"]:"foo"},i={configurable:{sessionId:"123"}};throw new Error(`sessionId is required. Pass it in as part of the config argument to .invoke() or .stream()
|
||
eg. chain.invoke(${JSON.stringify(o)}, ${JSON.stringify(i)})`)}let{sessionId:n}=r.configurable;return r.configurable.messageHistory=await this.getMessageHistory(n),r}}});var Oyn,_v=v(()=>{Bo();rO();rW();Qh();qhe();XMt();YMt();hIt();Oyn={};Rt(Oyn,{RouterRunnable:()=>GMt,Runnable:()=>Vo,RunnableAssign:()=>aee,RunnableBinding:()=>Hw,RunnableBranch:()=>ZMt,RunnableEach:()=>zMt,RunnableLambda:()=>Yb,RunnableMap:()=>aL,RunnableParallel:()=>KMt,RunnablePassthrough:()=>Eu,RunnablePick:()=>bVe,RunnableRetry:()=>khe,RunnableSequence:()=>Rl,RunnableToolLike:()=>Fhe,RunnableWithFallbacks:()=>yVe,RunnableWithMessageHistory:()=>mIt,_coerceToRunnable:()=>bv,ensureConfig:()=>Qo,getCallbackManagerForConfig:()=>Zg,mergeConfigs:()=>WB,patchConfig:()=>Js,pickRunnableConfigKeys:()=>Yy,raceWithSignal:()=>$w})});var Sz,iN,th,TW=v(()=>{AY();Qh();_v();Sz=class extends Vo{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"})}},iN=class extends Sz{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")}},th=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");$$(this,"OUTPUT_PARSING_FAILURE")}}});var aN,sL,uL=v(()=>{Jg();H0();id();TW();jhe();aN=class extends iN{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"})}},sL=class extends aN{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(K3(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new yi({message:o,text:o.content})}else if(Gh(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new yi({message:$B(o),text:o.content})}else i=new Lw({text:o});n===void 0?n=i:n=n.concat(i);let a=await this.parsePartialResult([n]);a!=null&&!dO(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var gIt,yIt=v(()=>{uL();gIt=class extends aN{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","bytes"]);x(this,"lc_serializable",!0);x(this,"textEncoder",new TextEncoder)}static lc_name(){return"BytesOutputParser"}parse(e){return Promise.resolve(this.textEncoder.encode(e))}getFormatInstructions(){return""}}});var EW,bIt,_It,vIt,wIt,SIt=v(()=>{TW();uL();EW=class extends aN{constructor(){super(...arguments);x(this,"re")}async*_transform(e){let r="";for await(let n of e)if(typeof n=="string"?r+=n:r+=n.content,this.re){let o=[...r.matchAll(this.re)];if(o.length>1){let i=0;for(let a of o.slice(0,-1))yield[a[1]],i+=(a.index??0)+a[0].length;r=r.slice(i)}}else{let o=await this.parse(r);if(o.length>1){for(let i of o.slice(0,-1))yield[i];r=o[o.length-1]}}for(let n of await this.parse(r))yield[n]}},bIt=class extends EW{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","list"]);x(this,"lc_serializable",!0)}static lc_name(){return"CommaSeparatedListOutputParser"}async parse(e){try{return e.trim().split(",").map(r=>r.trim())}catch{throw new th(`Could not parse output: ${e}`,e)}}getFormatInstructions(){return"Your response should be a list of comma separated values, eg: `foo, bar, baz`"}},_It=class extends EW{constructor({length:e,separator:r}){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","list"]);x(this,"length");x(this,"separator");this.length=e,this.separator=r||","}async parse(e){try{let r=e.trim().split(this.separator).map(n=>n.trim());if(this.length!==void 0&&r.length!==this.length)throw new th(`Incorrect number of items. Expected ${this.length}, got ${r.length}.`);return r}catch(r){throw Object.getPrototypeOf(r)===th.prototype?r:new th(`Could not parse output: ${e}`)}}getFormatInstructions(){return`Your response should be a list of ${this.length===void 0?"":`${this.length} `}items separated by "${this.separator}" (eg: \`foo${this.separator} bar${this.separator} baz\`)`}},vIt=class extends EW{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","list"]);x(this,"lc_serializable",!0);x(this,"re",/\d+\.\s([^\n]+)/g)}static lc_name(){return"NumberedListOutputParser"}getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example:
|
||
|
||
1. foo
|
||
|
||
2. bar
|
||
|
||
3. baz`}async parse(e){return[...e.matchAll(this.re)??[]].map(r=>r[1])}},wIt=class extends EW{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","output_parsers","list"]);x(this,"lc_serializable",!0);x(this,"re",/^\s*[-*]\s([^\n]+)$/gm)}static lc_name(){return"NumberedListOutputParser"}getFormatInstructions(){return`Your response should be a numbered list with each item on a new line. For example:
|
||
|
||
1. foo
|
||
|
||
2. bar
|
||
|
||
3. baz`}async parse(e){return[...e.matchAll(this.re)??[]].map(r=>r[1])}}});var Bhe,CIt=v(()=>{uL();Bhe=class extends aN{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;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 Jw,wVe,xIt,OIt=v(()=>{eN();nb();TW();cO();Jw=class extends iN{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=Ct.object(Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Ct.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(Ni(this.schema))}
|
||
\`\`\`
|
||
`}async parse(e){try{let r=e.trim(),o=(r.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||r.match(/```json\s*([\s\S]*?)```/)?.[1]||r).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(i,a)=>`"${a.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await Q$(this.schema,JSON.parse(o))}catch(r){throw new th(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}},wVe=class extends Jw{static lc_name(){return"JsonMarkdownStructuredOutputParser"}getFormatInstructions(t){let e=t?.interpolationDepth??1;if(e<1)throw new Error("f string interpolation depth must be at least 1");return`Return a markdown code snippet with a JSON object formatted to look like:
|
||
\`\`\`json
|
||
${this._schemaToInstruction(Ni(this.schema)).replaceAll("{","{".repeat(e)).replaceAll("}","}".repeat(e))}
|
||
\`\`\``}_schemaToInstruction(t,e=2){let r=t;if("type"in r){let n=!1,o;if(Array.isArray(r.type)){let s=r.type.findIndex(u=>u==="null");s!==-1&&(n=!0,r.type.splice(s,1)),o=r.type.join(" | ")}else o=r.type;if(r.type==="object"&&r.properties){let s=r.description?` // ${r.description}`:"";return`{
|
||
${Object.entries(r.properties).map(([l,c])=>{let d=r.required?.includes(l)?"":" (optional)";return`${" ".repeat(e)}"${l}": ${this._schemaToInstruction(c,e+2)}${d}`}).join(`
|
||
`)}
|
||
${" ".repeat(e-2)}}${s}`}if(r.type==="array"&&r.items){let s=r.description?` // ${r.description}`:"";return`array[
|
||
${" ".repeat(e)}${this._schemaToInstruction(r.items,e+2)}
|
||
${" ".repeat(e-2)}] ${s}`}let i=n?" (nullable)":"",a=r.description?` // ${r.description}`:"";return`${o}${a}${i}`}if("anyOf"in r)return r.anyOf.map(n=>this._schemaToInstruction(n,e)).join(`
|
||
${" ".repeat(e-2)}`);throw new Error("unsupported schema type")}static fromZodSchema(t){return new this(t)}static fromNamesAndDescriptions(t){let e=Ct.object(Object.fromEntries(Object.entries(t).map(([r,n])=>[r,Ct.string().describe(n)])));return new this(e)}},xIt=class extends iN{constructor({inputSchema:e}){super(...arguments);x(this,"structuredInputParser");this.structuredInputParser=new wVe(e)}async parse(e){let r;try{r=await this.structuredInputParser.parse(e)}catch(n){throw new th(`Failed to parse. Text: "${e}". Error: ${n}`,e)}return this.outputProcessor(r)}getFormatInstructions(){return this.structuredInputParser.getFormatInstructions()}}});var Tyn,SVe=v(()=>{Bo();pQ();mQ();cBe();Tyn={};Rt(Tyn,{applyPatch:()=>J$,compare:()=>oW})});var vv,CVe=v(()=>{RY();mQ();uL();SVe();vv=class extends sL{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?oW(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return IY(e[0].text)}async parse(e){return IY(e,JSON.parse)}getFormatInstructions(){return""}_baseMessageToString(e){return e.text}}});var Eyn,TIt,EIt=v(()=>{Eyn=function(){let t={};t.parser=function(D,R){return new r(D,R)},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,R){if(!(this instanceof r))return new r(D,R);var z=this;o(z),z.q=z.c="",z.bufferCheckPosition=t.MAX_BUFFER_LENGTH,z.opt=R||{},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=M.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),j(z,"onready")}Object.create||(Object.create=function(D){function R(){}R.prototype=D;var z=new R;return z}),Object.keys||(Object.keys=function(D){var R=[];for(var z in D)D.hasOwnProperty(z)&&R.push(z);return R});function n(D){for(var R=Math.max(t.MAX_BUFFER_LENGTH,10),z=0,U=0,ee=e.length;U<ee;U++){var ce=D[e[U]].length;if(ce>R)switch(e[U]){case"textNode":k(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[U])}z=Math.max(z,ce)}var ve=t.MAX_BUFFER_LENGTH-z;D.bufferCheckPosition=ve+D.position}function o(D){for(var R=0,z=e.length;R<z;R++)D[e[R]]=""}function i(D){k(D),D.cdata!==""&&(A(D,"oncdata",D.cdata),D.cdata=""),D.script!==""&&(A(D,"onscript",D.script),D.script="")}r.prototype={end:function(){J(this)},write:re,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,R){return new l(D,R)}function l(D,R){if(!(this instanceof l))return new l(D,R);a.apply(this),this._parser=new r(D,R),this.writable=!0,this.readable=!0;var z=this;this._parser.onend=function(){z.emit("end")},this._parser.onerror=function(U){z.emit("error",U),z._parser.error=null},this._decoder=null,s.forEach(function(U){Object.defineProperty(z,"on"+U,{get:function(){return z._parser["on"+U]},set:function(ee){if(!ee)return z.removeAllListeners(U),z._parser["on"+U]=ee,ee;z.on(U,ee)},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,R){var z=this;return!z._parser["on"+D]&&s.indexOf(D)!==-1&&(z._parser["on"+D]=function(){var U=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);U.splice(0,0,D),z.emit.apply(z,U)}),a.prototype.on.call(z,D,R)};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 O(D){return D===">"||_(D)}function T(D,R){return D.test(R)}function P(D,R){return!T(D,R)}var M=0;t.STATE={BEGIN:M++,BEGIN_WHITESPACE:M++,TEXT:M++,TEXT_ENTITY:M++,OPEN_WAKA:M++,SGML_DECL:M++,SGML_DECL_QUOTED:M++,DOCTYPE:M++,DOCTYPE_QUOTED:M++,DOCTYPE_DTD:M++,DOCTYPE_DTD_QUOTED:M++,COMMENT_STARTING:M++,COMMENT:M++,COMMENT_ENDING:M++,COMMENT_ENDED:M++,CDATA:M++,CDATA_ENDING:M++,CDATA_ENDING_2:M++,PROC_INST:M++,PROC_INST_BODY:M++,PROC_INST_ENDING:M++,OPEN_TAG:M++,OPEN_TAG_SLASH:M++,ATTRIB:M++,ATTRIB_NAME:M++,ATTRIB_NAME_SAW_WHITE:M++,ATTRIB_VALUE:M++,ATTRIB_VALUE_QUOTED:M++,ATTRIB_VALUE_CLOSED:M++,ATTRIB_VALUE_UNQUOTED:M++,ATTRIB_VALUE_ENTITY_Q:M++,ATTRIB_VALUE_ENTITY_U:M++,CLOSE_TAG:M++,CLOSE_TAG_SAW_WHITE:M++,SCRIPT:M++,SCRIPT_ENDING:M++},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 R=t.ENTITIES[D],z=typeof R=="number"?String.fromCharCode(R):R;t.ENTITIES[D]=z});for(var I in t.STATE)t.STATE[t.STATE[I]]=I;M=t.STATE;function j(D,R,z){D[R]&&D[R](z)}function A(D,R,z){D.textNode&&k(D),j(D,R,z)}function k(D){D.textNode=V(D.opt,D.textNode),D.textNode&&j(D,"ontext",D.textNode),D.textNode=""}function V(D,R){return D.trim&&(R=R.trim()),D.normalize&&(R=R.replace(/\s+/g," ")),R}function q(D,R){return k(D),D.trackPosition&&(R+=`
|
||
Line: `+D.line+`
|
||
Column: `+D.column+`
|
||
Char: `+D.c),R=new Error(R),D.error=R,j(D,"onerror",R),D}function J(D){return D.sawRoot&&!D.closedRoot&&K(D,"Unclosed root tag"),D.state!==M.BEGIN&&D.state!==M.BEGIN_WHITESPACE&&D.state!==M.TEXT&&q(D,"Unexpected end"),k(D),D.c="",D.closed=!0,j(D,"onend"),r.call(D,D.strict,D.opt),D}function K(D,R){if(typeof D!="object"||!(D instanceof r))throw new Error("bad call to strictFail");D.strict&&q(D,R)}function ue(D){D.strict||(D.tagName=D.tagName[D.looseCase]());var R=D.tags[D.tags.length-1]||D,z=D.tag={name:D.tagName,attributes:{}};D.opt.xmlns&&(z.ns=R.ns),D.attribList.length=0,A(D,"onopentagstart",z)}function oe(D,R){var z=D.indexOf(":"),U=z<0?["",D]:D.split(":"),ee=U[0],ce=U[1];return R&&D==="xmlns"&&(ee="xmlns",ce=""),{prefix:ee,local:ce}}function G(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 R=oe(D.attribName,!0),z=R.prefix,U=R.local;if(z==="xmlns")if(U==="xml"&&D.attribValue!==f)K(D,"xml: prefix must be bound to "+f+`
|
||
Actual: `+D.attribValue);else if(U==="xmlns"&&D.attribValue!==p)K(D,"xmlns: prefix must be bound to "+p+`
|
||
Actual: `+D.attribValue);else{var ee=D.tag,ce=D.tags[D.tags.length-1]||D;ee.ns===ce.ns&&(ee.ns=Object.create(ce.ns)),ee.ns[U]=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 Y(D,R){if(D.opt.xmlns){var z=D.tag,U=oe(D.tagName);z.prefix=U.prefix,z.local=U.local,z.uri=z.ns[U.prefix]||"",z.prefix&&!z.uri&&(K(D,"Unbound namespace prefix: "+JSON.stringify(D.tagName)),z.uri=U.prefix);var ee=D.tags[D.tags.length-1]||D;z.ns&&ee.ns!==z.ns&&Object.keys(z.ns).forEach(function(Tr){A(D,"onopennamespace",{prefix:Tr,uri:z.ns[Tr]})});for(var ce=0,ve=D.attribList.length;ce<ve;ce++){var Oe=D.attribList[ce],Je=Oe[0],tt=Oe[1],Ke=oe(Je,!0),dt=Ke.prefix,Pt=Ke.local,Nt=dt===""?"":z.ns[dt]||"",Ne={name:Je,value:tt,prefix:dt,local:Pt,uri:Nt};dt&&dt!=="xmlns"&&!Nt&&(K(D,"Unbound namespace prefix: "+JSON.stringify(dt)),Ne.uri=dt),D.tag.attributes[Je]=Ne,A(D,"onattribute",Ne)}D.attribList.length=0}D.tag.isSelfClosing=!!R,D.sawRoot=!0,D.tags.push(D.tag),A(D,"onopentag",D.tag),R||(!D.noscript&&D.tagName.toLowerCase()==="script"?D.state=M.SCRIPT:D.state=M.TEXT,D.tag=null,D.tagName=""),D.attribName=D.attribValue="",D.attribList.length=0}function se(D){if(!D.tagName){K(D,"Weird empty close tag."),D.textNode+="</>",D.state=M.TEXT;return}if(D.script){if(D.tagName!=="script"){D.script+="</"+D.tagName+">",D.tagName="",D.state=M.SCRIPT;return}A(D,"onscript",D.script),D.script=""}var R=D.tags.length,z=D.tagName;D.strict||(z=z[D.looseCase]());for(var U=z;R--;){var ee=D.tags[R];if(ee.name!==U)K(D,"Unexpected close tag");else break}if(R<0){K(D,"Unmatched closing tag: "+D.tagName),D.textNode+="</"+D.tagName+">",D.state=M.TEXT;return}D.tagName=z;for(var ce=D.tags.length;ce-- >R;){var ve=D.tag=D.tags.pop();D.tagName=D.tag.name,A(D,"onclosetag",D.tagName);var Oe={};for(var Je in ve.ns)Oe[Je]=ve.ns[Je];var tt=D.tags[D.tags.length-1]||D;D.opt.xmlns&&ve.ns!==tt.ns&&Object.keys(ve.ns).forEach(function(Ke){var dt=ve.ns[Ke];A(D,"onclosenamespace",{prefix:Ke,uri:dt})})}R===0&&(D.closedRoot=!0),D.tagName=D.attribValue=D.attribName="",D.attribList.length=0,D.state=M.TEXT}function ie(D){var R=D.entity,z=R.toLowerCase(),U,ee="";return D.ENTITIES[R]?D.ENTITIES[R]:D.ENTITIES[z]?D.ENTITIES[z]:(R=z,R.charAt(0)==="#"&&(R.charAt(1)==="x"?(R=R.slice(2),U=parseInt(R,16),ee=U.toString(16)):(R=R.slice(1),U=parseInt(R,10),ee=U.toString(10))),R=R.replace(/^0+/,""),isNaN(U)||ee.toLowerCase()!==R?(K(D,"Invalid character entity"),"&"+D.entity+";"):String.fromCodePoint(U))}function $(D,R){R==="<"?(D.state=M.OPEN_WAKA,D.startTagPosition=D.position):_(R)||(K(D,"Non-whitespace before first tag."),D.textNode=R,D.state=M.TEXT)}function H(D,R){var z="";return R<D.length&&(z=D.charAt(R)),z}function re(D){var R=this;if(this.error)throw this.error;if(R.closed)return q(R,"Cannot write after close. Assign an onready handler.");if(D===null)return J(R);typeof D=="object"&&(D=D.toString());for(var z=0,U="";U=H(D,z++),R.c=U,!!U;)switch(R.trackPosition&&(R.position++,U===`
|
||
`?(R.line++,R.column=0):R.column++),R.state){case M.BEGIN:if(R.state=M.BEGIN_WHITESPACE,U==="\uFEFF")continue;$(R,U);continue;case M.BEGIN_WHITESPACE:$(R,U);continue;case M.TEXT:if(R.sawRoot&&!R.closedRoot){for(var ee=z-1;U&&U!=="<"&&U!=="&";)U=H(D,z++),U&&R.trackPosition&&(R.position++,U===`
|
||
`?(R.line++,R.column=0):R.column++);R.textNode+=D.substring(ee,z-1)}U==="<"&&!(R.sawRoot&&R.closedRoot&&!R.strict)?(R.state=M.OPEN_WAKA,R.startTagPosition=R.position):(!_(U)&&(!R.sawRoot||R.closedRoot)&&K(R,"Text data outside of root node."),U==="&"?R.state=M.TEXT_ENTITY:R.textNode+=U);continue;case M.SCRIPT:U==="<"?R.state=M.SCRIPT_ENDING:R.script+=U;continue;case M.SCRIPT_ENDING:U==="/"?R.state=M.CLOSE_TAG:(R.script+="<"+U,R.state=M.SCRIPT);continue;case M.OPEN_WAKA:if(U==="!")R.state=M.SGML_DECL,R.sgmlDecl="";else if(!_(U))if(T(h,U))R.state=M.OPEN_TAG,R.tagName=U;else if(U==="/")R.state=M.CLOSE_TAG,R.tagName="";else if(U==="?")R.state=M.PROC_INST,R.procInstName=R.procInstBody="";else{if(K(R,"Unencoded <"),R.startTagPosition+1<R.position){var ce=R.position-R.startTagPosition;U=new Array(ce).join(" ")+U}R.textNode+="<"+U,R.state=M.TEXT}continue;case M.SGML_DECL:(R.sgmlDecl+U).toUpperCase()===c?(A(R,"onopencdata"),R.state=M.CDATA,R.sgmlDecl="",R.cdata=""):R.sgmlDecl+U==="--"?(R.state=M.COMMENT,R.comment="",R.sgmlDecl=""):(R.sgmlDecl+U).toUpperCase()===d?(R.state=M.DOCTYPE,(R.doctype||R.sawRoot)&&K(R,"Inappropriately located doctype declaration"),R.doctype="",R.sgmlDecl=""):U===">"?(A(R,"onsgmldeclaration",R.sgmlDecl),R.sgmlDecl="",R.state=M.TEXT):(w(U)&&(R.state=M.SGML_DECL_QUOTED),R.sgmlDecl+=U);continue;case M.SGML_DECL_QUOTED:U===R.q&&(R.state=M.SGML_DECL,R.q=""),R.sgmlDecl+=U;continue;case M.DOCTYPE:U===">"?(R.state=M.TEXT,A(R,"ondoctype",R.doctype),R.doctype=!0):(R.doctype+=U,U==="["?R.state=M.DOCTYPE_DTD:w(U)&&(R.state=M.DOCTYPE_QUOTED,R.q=U));continue;case M.DOCTYPE_QUOTED:R.doctype+=U,U===R.q&&(R.q="",R.state=M.DOCTYPE);continue;case M.DOCTYPE_DTD:R.doctype+=U,U==="]"?R.state=M.DOCTYPE:w(U)&&(R.state=M.DOCTYPE_DTD_QUOTED,R.q=U);continue;case M.DOCTYPE_DTD_QUOTED:R.doctype+=U,U===R.q&&(R.state=M.DOCTYPE_DTD,R.q="");continue;case M.COMMENT:U==="-"?R.state=M.COMMENT_ENDING:R.comment+=U;continue;case M.COMMENT_ENDING:U==="-"?(R.state=M.COMMENT_ENDED,R.comment=V(R.opt,R.comment),R.comment&&A(R,"oncomment",R.comment),R.comment=""):(R.comment+="-"+U,R.state=M.COMMENT);continue;case M.COMMENT_ENDED:U!==">"?(K(R,"Malformed comment"),R.comment+="--"+U,R.state=M.COMMENT):R.state=M.TEXT;continue;case M.CDATA:U==="]"?R.state=M.CDATA_ENDING:R.cdata+=U;continue;case M.CDATA_ENDING:U==="]"?R.state=M.CDATA_ENDING_2:(R.cdata+="]"+U,R.state=M.CDATA);continue;case M.CDATA_ENDING_2:U===">"?(R.cdata&&A(R,"oncdata",R.cdata),A(R,"onclosecdata"),R.cdata="",R.state=M.TEXT):U==="]"?R.cdata+="]":(R.cdata+="]]"+U,R.state=M.CDATA);continue;case M.PROC_INST:U==="?"?R.state=M.PROC_INST_ENDING:_(U)?R.state=M.PROC_INST_BODY:R.procInstName+=U;continue;case M.PROC_INST_BODY:if(!R.procInstBody&&_(U))continue;U==="?"?R.state=M.PROC_INST_ENDING:R.procInstBody+=U;continue;case M.PROC_INST_ENDING:U===">"?(A(R,"onprocessinginstruction",{name:R.procInstName,body:R.procInstBody}),R.procInstName=R.procInstBody="",R.state=M.TEXT):(R.procInstBody+="?"+U,R.state=M.PROC_INST_BODY);continue;case M.OPEN_TAG:T(y,U)?R.tagName+=U:(ue(R),U===">"?Y(R):U==="/"?R.state=M.OPEN_TAG_SLASH:(_(U)||K(R,"Invalid character in tag name"),R.state=M.ATTRIB));continue;case M.OPEN_TAG_SLASH:U===">"?(Y(R,!0),se(R)):(K(R,"Forward-slash in opening tag not followed by >"),R.state=M.ATTRIB);continue;case M.ATTRIB:if(_(U))continue;U===">"?Y(R):U==="/"?R.state=M.OPEN_TAG_SLASH:T(h,U)?(R.attribName=U,R.attribValue="",R.state=M.ATTRIB_NAME):K(R,"Invalid attribute name");continue;case M.ATTRIB_NAME:U==="="?R.state=M.ATTRIB_VALUE:U===">"?(K(R,"Attribute without value"),R.attribValue=R.attribName,G(R),Y(R)):_(U)?R.state=M.ATTRIB_NAME_SAW_WHITE:T(y,U)?R.attribName+=U:K(R,"Invalid attribute name");continue;case M.ATTRIB_NAME_SAW_WHITE:if(U==="=")R.state=M.ATTRIB_VALUE;else{if(_(U))continue;K(R,"Attribute without value"),R.tag.attributes[R.attribName]="",R.attribValue="",A(R,"onattribute",{name:R.attribName,value:""}),R.attribName="",U===">"?Y(R):T(h,U)?(R.attribName=U,R.state=M.ATTRIB_NAME):(K(R,"Invalid attribute name"),R.state=M.ATTRIB)}continue;case M.ATTRIB_VALUE:if(_(U))continue;w(U)?(R.q=U,R.state=M.ATTRIB_VALUE_QUOTED):(K(R,"Unquoted attribute value"),R.state=M.ATTRIB_VALUE_UNQUOTED,R.attribValue=U);continue;case M.ATTRIB_VALUE_QUOTED:if(U!==R.q){U==="&"?R.state=M.ATTRIB_VALUE_ENTITY_Q:R.attribValue+=U;continue}G(R),R.q="",R.state=M.ATTRIB_VALUE_CLOSED;continue;case M.ATTRIB_VALUE_CLOSED:_(U)?R.state=M.ATTRIB:U===">"?Y(R):U==="/"?R.state=M.OPEN_TAG_SLASH:T(h,U)?(K(R,"No whitespace between attributes"),R.attribName=U,R.attribValue="",R.state=M.ATTRIB_NAME):K(R,"Invalid attribute name");continue;case M.ATTRIB_VALUE_UNQUOTED:if(!O(U)){U==="&"?R.state=M.ATTRIB_VALUE_ENTITY_U:R.attribValue+=U;continue}G(R),U===">"?Y(R):R.state=M.ATTRIB;continue;case M.CLOSE_TAG:if(R.tagName)U===">"?se(R):T(y,U)?R.tagName+=U:R.script?(R.script+="</"+R.tagName,R.tagName="",R.state=M.SCRIPT):(_(U)||K(R,"Invalid tagname in closing tag"),R.state=M.CLOSE_TAG_SAW_WHITE);else{if(_(U))continue;P(h,U)?R.script?(R.script+="</"+U,R.state=M.SCRIPT):K(R,"Invalid tagname in closing tag."):R.tagName=U}continue;case M.CLOSE_TAG_SAW_WHITE:if(_(U))continue;U===">"?se(R):K(R,"Invalid characters in closing tag");continue;case M.TEXT_ENTITY:case M.ATTRIB_VALUE_ENTITY_Q:case M.ATTRIB_VALUE_ENTITY_U:var ve,Oe;switch(R.state){case M.TEXT_ENTITY:ve=M.TEXT,Oe="textNode";break;case M.ATTRIB_VALUE_ENTITY_Q:ve=M.ATTRIB_VALUE_QUOTED,Oe="attribValue";break;case M.ATTRIB_VALUE_ENTITY_U:ve=M.ATTRIB_VALUE_UNQUOTED,Oe="attribValue";break}if(U===";")if(R.opt.unparsedEntities){var Je=ie(R);R.entity="",R.state=ve,R.write(Je)}else R[Oe]+=ie(R),R.entity="",R.state=ve;else T(R.entity.length?b:g,U)?R.entity+=U:(K(R,"Invalid character in entity name"),R[Oe]+="&"+R.entity+U,R.entity="",R.state=ve);continue;default:throw new Error(R,"Unknown state: "+R.state)}return R.position>=R.bufferCheckPosition&&n(R),R}return String.fromCodePoint||function(){var D=String.fromCharCode,R=Math.floor,z=function(){var U=16384,ee=[],ce,ve,Oe=-1,Je=arguments.length;if(!Je)return"";for(var tt="";++Oe<Je;){var Ke=Number(arguments[Oe]);if(!isFinite(Ke)||Ke<0||Ke>1114111||R(Ke)!==Ke)throw RangeError("Invalid code point: "+Ke);Ke<=65535?ee.push(Ke):(Ke-=65536,ce=(Ke>>10)+55296,ve=Ke%1024+56320,ee.push(ce,ve)),(Oe+1===Je||ee.length>U)&&(tt+=D.apply(null,ee),ee.length=0)}return tt};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:z,configurable:!0,writable:!0}):String.fromCodePoint=z}(),t},TIt=Eyn()});function Vhe(t){let e=Pyn(t),r=TIt.parser(!0),n={},o=[];r.onopentag=s=>{let u={name:s.name,attributes:s.attributes,children:[],text:"",isSelfClosing:s.isSelfClosing};o.length>0?o[o.length-1].children.push(u):n=u,s.isSelfClosing||o.push(u)},r.onclosetag=()=>{if(o.length>0){let s=o.pop();o.length===0&&s&&(n=s)}},r.ontext=s=>{if(o.length>0){let u=o[o.length-1];u.text+=s}},r.onattribute=s=>{if(o.length>0){let u=o[o.length-1];u.attributes[s.name]=s.value}};let i=/```(xml)?(.*)```/s.exec(e),a=i?i[2]:e;return r.write(a).close(),n&&n.name==="?xml"&&(n=n.children[0]),MIt(n)}var zhe,PIt,Pyn,MIt,IIt=v(()=>{mQ();uL();SVe();EIt();zhe=`The output should be formatted as a XML file.
|
||
1. Output should conform to the tags below.
|
||
2. If tags are not given, make them on your own.
|
||
3. Remember to always open and close all the tags.
|
||
|
||
As an example, for the tags ["foo", "bar", "baz"]:
|
||
1. String "<foo>
|
||
<bar>
|
||
<baz></baz>
|
||
</bar>
|
||
</foo>" is a well-formatted instance of the schema.
|
||
2. String "<foo>
|
||
<bar>
|
||
</foo>" is a badly-formatted instance.
|
||
3. String "<foo>
|
||
<tag>
|
||
</tag>
|
||
</foo>" is a badly-formatted instance.
|
||
|
||
Here are the output tags:
|
||
\`\`\`
|
||
{tags}
|
||
\`\`\``,PIt=class extends sL{constructor(e){super(e);x(this,"tags");x(this,"lc_namespace",["langchain_core","output_parsers"]);x(this,"lc_serializable",!0);this.tags=e?.tags}static lc_name(){return"XMLOutputParser"}_diff(e,r){if(r)return e?oW(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return Vhe(e[0].text)}async parse(e){return Vhe(e)}getFormatInstructions(){return!!(this.tags&&this.tags.length>0)?zhe.replace("{tags}",this.tags?.join(", ")??""):zhe}},Pyn=t=>t.split(`
|
||
`).map(e=>e.replace(/^\s+/,"")).join(`
|
||
`).trim(),MIt=t=>{if(Object.keys(t).length===0)return{};let e={};return t.children.length>0?(e[t.name]=t.children.map(MIt),e):(e[t.name]=t.text??void 0,e)}});var Myn,fO=v(()=>{Bo();RY();TW();uL();yIt();SIt();CIt();OIt();CVe();IIt();Myn={};Rt(Myn,{AsymmetricStructuredOutputParser:()=>xIt,BaseCumulativeTransformOutputParser:()=>sL,BaseLLMOutputParser:()=>Sz,BaseOutputParser:()=>iN,BaseTransformOutputParser:()=>aN,BytesOutputParser:()=>gIt,CommaSeparatedListOutputParser:()=>bIt,CustomListOutputParser:()=>_It,JsonMarkdownStructuredOutputParser:()=>wVe,JsonOutputParser:()=>vv,ListOutputParser:()=>EW,MarkdownListOutputParser:()=>wIt,NumberedListOutputParser:()=>vIt,OutputParserException:()=>th,StringOutputParser:()=>Bhe,StructuredOutputParser:()=>Jw,XMLOutputParser:()=>PIt,XML_FORMAT_INSTRUCTIONS:()=>zhe,parseJsonMarkdown:()=>IY,parsePartialJson:()=>AB,parseXMLMarkdown:()=>Vhe})});var Ww,PW=v(()=>{Qh();Ww=class extends Vo{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[i,a]of Object.entries(r))typeof a=="string"?n[i]=a:n[i]=await a();return{...n,...e}}async invoke(e,r){let n={...this.metadata,...r?.metadata},o=[...this.tags??[],...r?.tags??[]];return this._callWithConfig(i=>this.formatPromptValue(i),e,{...r,tags:o,metadata:n,runType:"prompt"})}}});var Iyn,Hhe,see,uee,xVe,lee=v(()=>{Bo();L$();U$();H0();Iyn={};Rt(Iyn,{BasePromptValue:()=>Hhe,ChatPromptValue:()=>uee,ImagePromptValue:()=>xVe,StringPromptValue:()=>see});Hhe=class extends Kh{},see=class extends Hhe{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 Hs(this.value)]}},uee=class extends Hhe{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 ol(this.messages)}toChatMessages(){return this.messages}},xVe=class extends Hhe{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 Hs({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var sN,cee=v(()=>{lee();PW();sN=class extends Ww{async formatPromptValue(t){let e=await this.format(t);return new see(e)}}});function TVe(t){return typeof t=="function"}function Ayn(t){return IW(t)?"array":typeof t}function OVe(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function RIt(t,e){return t!=null&&typeof t=="object"&&e in t}function Nyn(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function Dyn(t,e){return jyn.call(t,e)}function Lyn(t){return!Dyn($yn,t)}function kyn(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return Fyn[r]})}function Vyn(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(M){if(typeof M=="string"&&(M=M.split(Uyn,2)),!IW(M)||M.length!==2)throw new Error("Invalid tags: "+M);d=new RegExp(OVe(M[0])+"\\s*"),f=new RegExp("\\s*"+OVe(M[1])),p=new RegExp("\\s*"+OVe("}"+M[1]))}m(e||Kw.tags);for(var h=new fee(t),y,g,b,_,w,O;!h.eos();){if(y=h.pos,b=h.scanUntil(d),b)for(var T=0,P=b.length;T<P;++T)_=b.charAt(T),Lyn(_)?(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(zyn)||"name",h.scan(qyn),g==="="?(b=h.scanUntil(AIt),h.scan(AIt),h.scanUntil(f)):g==="{"?(b=h.scanUntil(p),h.scan(Byn),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(O=n.pop(),!O)throw new Error('Unopened section "'+b+'" at '+y);if(O[1]!==b)throw new Error('Unclosed section "'+O[1]+'" at '+y)}else g==="name"||g==="{"||g==="&"?s=!0:g==="="&&m(b)}if(c(),O=n.pop(),O)throw new Error('Unclosed section "'+O[1]+'" at '+h.pos);return Jyn(Hyn(o))}function Hyn(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 Jyn(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 fee(t){this.string=t,this.tail=t,this.pos=0}function MW(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 Ryn,IW,jyn,$yn,Fyn,qyn,Uyn,AIt,Byn,zyn,Kw,dee,Jhe,NIt=v(()=>{Ryn=Object.prototype.toString,IW=Array.isArray||function(e){return Ryn.call(e)==="[object Array]"};jyn=RegExp.prototype.test;$yn=/\S/;Fyn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};qyn=/\s*/,Uyn=/\s+/,AIt=/\s*=/,Byn=/\s*\}/,zyn=/#|\^|\/|>|\{|&|=|!/;fee.prototype.eos=function(){return this.tail===""};fee.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};fee.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};MW.prototype.push=function(e){return new MW(e,this)};MW.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=RIt(i,a[s])||Nyn(i,a[s])),i=i[a[s++]];else i=o.view[e],u=RIt(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return TVe(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||Kw.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=Vyn(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 MW?r:new MW(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(IW(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(TVe(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||IW(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=TVe(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)||Kw.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===Kw.escape?String(i):o(i)};ob.prototype.rawValue=function(e){return e[1]};ob.prototype.getConfigTags=function(e){return IW(e)?e:e&&typeof e=="object"?e.tags:void 0};ob.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!IW(e))return e.escape};Kw={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){dee.templateCache=t},get templateCache(){return dee.templateCache}},dee=new ob;Kw.clearCache=function(){return dee.clearCache()};Kw.parse=function(e,r){return dee.parse(e,r)};Kw.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Ayn(e)+'" was given as the first argument for mustache#render(template, view, partials)');return dee.render(e,r,n,o)};Kw.escape=kyn;Kw.Scanner=fee;Kw.Context=MW;Kw.Writer=ob;Jhe=Kw});function jIt(){Jhe.escape=t=>t}var Cz,DIt,RW,EVe,PVe,pee,MVe,ey,xz,uN,Oz=v(()=>{AY();NIt();Cz=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},DIt=(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=DIt(n[4],o);r.push(...i)}}else r.push({type:"literal",text:n[1]});return r},RW=t=>{jIt();let e=Jhe.parse(t);return DIt(e)},EVe=(t,e)=>Cz(t).reduce((r,n)=>{if(n.type==="variable"){if(n.name in e){let o=typeof e[n.name]=="string"?e[n.name]:JSON.stringify(e[n.name]);return r+o}throw new Error(`(f-string) Missing value for input ${n.name}`)}return r+n.text},""),PVe=(t,e)=>(jIt(),Jhe.render(t,e)),pee={"f-string":EVe,mustache:PVe},MVe={"f-string":Cz,mustache:RW},ey=(t,e,r)=>{try{return pee[e](t,r)}catch(n){throw $$(n,"INVALID_PROMPT_INPUT")}},xz=(t,e)=>MVe[e](t),uN=(t,e,r)=>{if(!(e in pee)){let n=Object.keys(pee);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")ey(o.text,e,n);else if(o.type==="image_url"){if(typeof o.image_url=="string")ey(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;ey(i,e,n)}}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):ey(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var lu,Whe=v(()=>{cee();Oz();lu=class mee extends sN{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))),uN(this.template,this.templateFormat,n)}}static lc_name(){return"PromptTemplate"}_getPromptType(){return"prompt"}async format(r){let n=await this.mergePartialAndUserVariables(r);return ey(this.template,this.templateFormat,n)}static fromExamples(r,n,o,i=`
|
||
|
||
`,a=""){let s=[a,...r,n].join(i);return new mee({inputVariables:o,template:s})}static fromTemplate(r,n){let{templateFormat:o="f-string",...i}=n??{},a=new Set;return xz(r,o).forEach(s=>{s.type==="variable"&&a.add(s.name)}),new mee({inputVariables:[...a],templateFormat:o,template:r,...i})}async partial(r){let n=this.inputVariables.filter(a=>!(a in r)),o={...this.partialVariables??{},...r},i={...this,inputVariables:n,partialVariables:o};return new mee(i)}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 mee({inputVariables:r.input_variables,template:r.template,templateFormat:r.template_format})}}});var AW,IVe=v(()=>{lee();PW();Oz();AW=class $It extends Ww{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))),uN([{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(a=>!(a in r)),o={...this.partialVariables??{},...r},i={...this,inputVariables:n,partialVariables:o};return new $It(i)}async format(r){let n={};for(let[s,u]of Object.entries(this.template))typeof u=="string"?n[s]=ey(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){let n=await this.format(r);return new xVe(n)}}});function RVe(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")xz(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?xz(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...RVe(o,e));else typeof n=="object"&&n!==null&&r.push(...RVe(n,e));return Array.from(new Set(r))}function AVe(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=ey(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(ey(s,r,e)):typeof s=="object"&&a.push(AVe(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=AVe(i,e,r):n[o]=i;return n}var hee,NVe=v(()=>{Qh();Oz();hee=class extends Vo{constructor(e){let r=e.templateFormat??"f-string",n=RVe(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 AVe(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function Wyn(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function Kyn(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 Gyn(t){return typeof t.formatMessages=="function"}function Xyn(t,e){if(Gyn(t)||Gh(t))return t;if(Array.isArray(t)&&t[0]==="placeholder"){let o=t[1];if(e?.templateFormat==="mustache"&&typeof o=="string"&&o.slice(0,2)==="{{"&&o.slice(-2)==="}}"){let i=o.slice(2,-2);return new pO({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new pO({variableName:i,optional:!0})}throw new Error(`Invalid placeholder template for format ${e?.templateFormat??'"f-string"'}: "${t[1]}". Expected a variable name surrounded by ${e?.templateFormat==="mustache"?"double":"single"} curly braces.`)}let r=Aw(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 Qb.fromTemplate(n,e);if(r._getType()==="ai")return Ghe.fromTemplate(n,e);if(r._getType()==="system")return Gw.fromTemplate(n,e);if(nd.isInstance(r))return DVe.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function Zyn(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var gee,pO,jVe,yee,DVe,$Ve,Qb,Ghe,Gw,ld,bee=v(()=>{Jg();AY();kY();U$();qY();H0();Rw();Qh();Qa();lee();PW();cee();Oz();Whe();IVe();NVe();gee=class extends Vo{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"})}},pO=class extends gee{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(Aw):n=[Aw(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}},jVe=class extends gee{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)]}},yee=class extends Ww{constructor(t){super(t)}async format(t){return(await this.formatPromptValue(t)).toString()}async formatPromptValue(t){let e=await this.formatMessages(t);return new uee(e)}},DVe=class extends jVe{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 nd(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(lu.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};$Ve=class extends gee{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()){let n=r._messageClass();return new n({content:e})}else if(r.chatMessageClass){let n=r.chatMessageClass();return new n({content:e,role:this.getRoleFromMessageClass(n.lc_name())})}else throw new Error("No message class defined")}getRoleFromMessageClass(e){switch(e){case"HumanMessage":return"human";case"AIMessage":return"ai";case"SystemMessage":return"system";case"ChatMessage":return"chat";default:throw new Error("Invalid message class name")}}static fromTemplate(e,r){if(typeof e=="string")return new this(lu.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(lu.fromTemplate(o,r));else if(o!==null)if(Wyn(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(lu.fromTemplate(i,a))}else if(Kyn(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=RW(i):u=Cz(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 AW({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=RW(i.url):u=Cz(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new AW({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 hee({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof sN){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 sN){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 AW){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 hee){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)]}},Qb=class extends $Ve{static _messageClass(){return Hs}static lc_name(){return"HumanMessagePromptTemplate"}},Ghe=class extends $Ve{static _messageClass(){return eo}static lc_name(){return"AIMessagePromptTemplate"}},Gw=class extends $Ve{static _messageClass(){return Qm}static lc_name(){return"SystemMessagePromptTemplate"}};ld=class Khe extends yee{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 Uc))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){if(typeof r.content=="string")return r;let o=await Promise.all(r.content.map(async i=>{if(i.type!=="image_url")return i;let a="";typeof i.image_url=="string"?a=i.image_url:typeof i.image_url=="object"&&i.image_url!==null&&"url"in i.image_url&&typeof i.image_url.url=="string"&&(a=i.image_url.url);let u=await lu.fromTemplate(a,{templateFormat:this.templateFormat}).format(n);return typeof i.image_url=="object"&&i.image_url!==null&&"url"in i.image_url?i.image_url.url=u:i.image_url=u,i}));return r.content=o,r}async formatMessages(r){let n=await this.mergePartialAndUserVariables(r),o=[];for(let i of this.promptMessages)if(i instanceof Uc)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)&&!(Zyn(i)&&i.optional))throw $$(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(a=>!(a in r)),o={...this.partialVariables??{},...r},i={...this,inputVariables:n,partialVariables:o};return new Khe(i)}static fromTemplate(r,n){let o=lu.fromTemplate(r,n),i=new Qb({prompt:o});return this.fromMessages([i])}static fromMessages(r,n){let o=r.reduce((s,u)=>s.concat(u instanceof Khe?u.promptMessages:[Xyn(u,n)]),[]),i=r.reduce((s,u)=>u instanceof Khe?Object.assign(s,u.partialVariables):s,Object.create(null)),a=new Set;for(let s of o)if(!(s instanceof Uc))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 LIt,FIt,qIt=v(()=>{cee();Oz();Whe();bee();LIt=class LVe extends sN{constructor(r){super(r);x(this,"lc_serializable",!1);x(this,"examples");x(this,"exampleSelector");x(this,"examplePrompt");x(this,"suffix","");x(this,"exampleSeparator",`
|
||
|
||
`);x(this,"prefix","");x(this,"templateFormat","f-string");x(this,"validateTemplate",!0);if(Object.assign(this,r),this.examples!==void 0&&this.exampleSelector!==void 0)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(this.examples===void 0&&this.exampleSelector===void 0)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let n=this.inputVariables;this.partialVariables&&(n=n.concat(Object.keys(this.partialVariables))),uN(this.prefix+this.suffix,this.templateFormat,n)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(r){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(r);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(r){let n=this.inputVariables.filter(a=>!(a in r)),o={...this.partialVariables??{},...r},i={...this,inputVariables:n,partialVariables:o};return new LVe(i)}async format(r){let n=await this.mergePartialAndUserVariables(r),o=await this.getExamples(n),i=await Promise.all(o.map(s=>this.examplePrompt.format(s))),a=[this.prefix,...i,this.suffix].join(this.exampleSeparator);return ey(a,this.templateFormat,n)}serialize(){if(this.exampleSelector||!this.examples)throw new Error("Serializing an example selector is not currently supported");if(this.outputParser!==void 0)throw new Error("Serializing an output parser is not currently supported");return{_type:this._getPromptType(),input_variables:this.inputVariables,example_prompt:this.examplePrompt.serialize(),example_separator:this.exampleSeparator,suffix:this.suffix,prefix:this.prefix,template_format:this.templateFormat,examples:this.examples}}static async deserialize(r){let{example_prompt:n}=r;if(!n)throw new Error("Missing example prompt");let o=await lu.deserialize(n),i;if(Array.isArray(r.examples))i=r.examples;else throw new Error("Invalid examples format. Only list or string are supported.");return new LVe({inputVariables:r.input_variables,examplePrompt:o,examples:i,exampleSeparator:r.example_separator,prefix:r.prefix,suffix:r.suffix,templateFormat:r.template_format})}},FIt=class kIt extends yee{constructor(r){super(r);x(this,"lc_serializable",!0);x(this,"examples");x(this,"exampleSelector");x(this,"examplePrompt");x(this,"suffix","");x(this,"exampleSeparator",`
|
||
|
||
`);x(this,"prefix","");x(this,"templateFormat","f-string");x(this,"validateTemplate",!0);if(this.examples=r.examples,this.examplePrompt=r.examplePrompt,this.exampleSeparator=r.exampleSeparator??`
|
||
|
||
`,this.exampleSelector=r.exampleSelector,this.prefix=r.prefix??"",this.suffix=r.suffix??"",this.templateFormat=r.templateFormat??"f-string",this.validateTemplate=r.validateTemplate??!0,this.examples!==void 0&&this.exampleSelector!==void 0)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(this.examples===void 0&&this.exampleSelector===void 0)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let n=this.inputVariables;this.partialVariables&&(n=n.concat(Object.keys(this.partialVariables))),uN(this.prefix+this.suffix,this.templateFormat,n)}}_getPromptType(){return"few_shot_chat"}static lc_name(){return"FewShotChatMessagePromptTemplate"}async getExamples(r){if(this.examples!==void 0)return this.examples;if(this.exampleSelector!==void 0)return this.exampleSelector.selectExamples(r);throw new Error("One of 'examples' and 'example_selector' should be provided")}async formatMessages(r){let n=await this.mergePartialAndUserVariables(r),o=await this.getExamples(n);o=o.map(a=>{let s={};return this.examplePrompt.inputVariables.forEach(u=>{s[u]=a[u]}),s});let i=[];for(let a of o){let s=await this.examplePrompt.formatMessages(a);i.push(...s)}return i}async format(r){let n=await this.mergePartialAndUserVariables(r),o=await this.getExamples(n),a=(await Promise.all(o.map(u=>this.examplePrompt.formatMessages(u)))).flat().map(u=>u.content),s=[this.prefix,...a,this.suffix].join(this.exampleSeparator);return ey(s,this.templateFormat,n)}async partial(r){let n=this.inputVariables.filter(a=>!(a in r)),o={...this.partialVariables??{},...r},i={...this,inputVariables:n,partialVariables:o};return new kIt(i)}}});var UIt,BIt=v(()=>{PW();bee();UIt=class Xhe extends Ww{constructor(r){super({...r,inputVariables:[]});x(this,"pipelinePrompts");x(this,"finalPrompt");this.pipelinePrompts=r.pipelinePrompts,this.finalPrompt=r.finalPrompt,this.inputVariables=this.computeInputValues()}static lc_name(){return"PipelinePromptTemplate"}computeInputValues(){let r=this.pipelinePrompts.map(o=>o.name),n=this.pipelinePrompts.map(o=>o.prompt.inputVariables.filter(i=>!r.includes(i))).flat();return[...new Set(n)]}static extractRequiredInputValues(r,n){return n.reduce((o,i)=>(o[i]=r[i],o),{})}async formatPipelinePrompts(r){let n=await this.mergePartialAndUserVariables(r);for(let{name:o,prompt:i}of this.pipelinePrompts){let a=Xhe.extractRequiredInputValues(n,i.inputVariables);i instanceof ld?n[o]=await i.formatMessages(a):n[o]=await i.format(a)}return Xhe.extractRequiredInputValues(n,this.finalPrompt.inputVariables)}async formatPromptValue(r){return this.finalPrompt.formatPromptValue(await this.formatPipelinePrompts(r))}async format(r){return this.finalPrompt.format(await this.formatPipelinePrompts(r))}async partial(r){let n={...this};return n.inputVariables=this.inputVariables.filter(o=>!(o in r)),n.partialVariables={...this.partialVariables??{},...r},new Xhe(n)}serialize(){throw new Error("Not implemented.")}_getPromptType(){return"pipeline"}}});function zIt(t){return typeof t=="object"&&t!=null&&"withStructuredOutput"in t&&typeof t.withStructuredOutput=="function"}function Yyn(t){return typeof t=="object"&&t!=null&&"lc_id"in t&&Array.isArray(t.lc_id)&&t.lc_id.join("/")==="langchain_core/runnables/RunnableBinding"}var VIt,JIt=v(()=>{Qh();bee();VIt=class HIt extends ld{constructor(r){super(r);x(this,"schema");x(this,"method");x(this,"lc_namespace",["langchain_core","prompts","structured"]);this.schema=r.schema,this.method=r.method}get lc_aliases(){return{...super.lc_aliases,schema:"schema_"}}pipe(r){if(zIt(r))return super.pipe(r.withStructuredOutput(this.schema));if(Yyn(r)&&zIt(r.bound))return super.pipe(new Hw({bound:r.bound.withStructuredOutput(this.schema,...this.method?[{method:this.method}]:[]),kwargs:r.kwargs??{},config:r.config,configFactories:r.configFactories}));throw new Error('Structured prompts need to be piped to a language model that supports the "withStructuredOutput()" method.')}static fromMessagesAndSchema(r,n,o){return HIt.fromMessages(r,{schema:n,method:o})}}});var Qyn,wv=v(()=>{Bo();PW();cee();Oz();Whe();IVe();NVe();bee();qIt();BIt();JIt();Qyn={};Rt(Qyn,{AIMessagePromptTemplate:()=>Ghe,BaseChatPromptTemplate:()=>yee,BaseMessagePromptTemplate:()=>gee,BaseMessageStringPromptTemplate:()=>jVe,BasePromptTemplate:()=>Ww,BaseStringPromptTemplate:()=>sN,ChatMessagePromptTemplate:()=>DVe,ChatPromptTemplate:()=>ld,DEFAULT_FORMATTER_MAPPING:()=>pee,DEFAULT_PARSER_MAPPING:()=>MVe,DictPromptTemplate:()=>hee,FewShotChatMessagePromptTemplate:()=>FIt,FewShotPromptTemplate:()=>LIt,HumanMessagePromptTemplate:()=>Qb,ImagePromptTemplate:()=>AW,MessagesPlaceholder:()=>pO,PipelinePromptTemplate:()=>UIt,PromptTemplate:()=>lu,StructuredPrompt:()=>VIt,SystemMessagePromptTemplate:()=>Gw,checkValidTemplate:()=>uN,interpolateFString:()=>EVe,interpolateMustache:()=>PVe,parseFString:()=>Cz,parseMustache:()=>RW,parseTemplate:()=>xz,renderTemplate:()=>ey})});var ebn,NW,Zhe=v(()=>{ebn=Object.defineProperty,NW=(t,e)=>{for(var r in e)ebn(t,r,{get:e[r],enumerable:!0})}});var tbn,_ee,FVe=v(()=>{Zhe();tbn={};NW(tbn,{formatDocumentsAsString:()=>_ee});_ee=t=>t.map(e=>e.pageContent).join(`
|
||
|
||
`)});function Cc(t,e){let r=`atom${++rbn}`,n={toString(){return(Al.env?Al.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=nbn,n.write=obn),e&&(n.write=e),n}function nbn(t){return t(this)}function obn(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var Al,rbn,WIt,kVe,qVe,Qhe,BVe,ibn,abn,zVe,KIt,Yhe,ZIt,GIt,jW,UVe,sbn,ubn,XIt,lL,YIt,cL,vee,QIt,VVe=v(()=>{Al={},rbn=0;WIt=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,kVe=t=>"init"in t,qVe=t=>!!t.write,Qhe=new WeakMap,BVe=t=>{var e;return zVe(t)&&!((e=Qhe.get(t))!=null&&e[1])},ibn=(t,e)=>{let r=Qhe.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((Al.env?Al.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},abn=t=>{if(Qhe.has(t))return;let e=[new Set,!1];Qhe.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},zVe=t=>typeof t?.then=="function",KIt=t=>"v"in t||"e"in t,Yhe=t=>{if("e"in t)throw t.e;if((Al.env?Al.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},ZIt=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},GIt=(t,e,r,n,o)=>{var i;if((Al.env?Al.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),BVe(r.v)&&ZIt(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&sbn(t,n,e)},jW=()=>[new Map,new Map,new Set],UVe=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},sbn=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},ubn=(t,e)=>t[0].get(e),XIt=(t,e)=>{t[2].add(e)},lL=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},YIt=(...[t,e,r,n])=>{let o;(Al.env?Al.env.MODE:void 0)!=="production"&&(o=new Set);let i=(_,w,O)=>{let T="v"in w,P=w.v,M=BVe(w.v)?w.v:null;if(zVe(O)){abn(O);for(let I of w.d.keys())ZIt(_,O,t(I));w.v=O,delete w.e}else w.v=O,delete w.e;(!T||!Object.is(P,w.v))&&(++w.n,M&&ibn(M,O))},a=(_,w,O)=>{var T;let P=t(w);if(KIt(P)&&(P.m&&!O?.has(w)||Array.from(P.d).every(([V,q])=>a(_,V,O).n===q)))return P;P.d.clear();let M=!0,I=V=>{if(WIt(w,V)){let J=t(V);if(!KIt(J))if(kVe(V))i(V,J,V.init);else throw new Error("no atom init");return Yhe(J)}let q=a(_,V,O);try{return Yhe(q)}finally{if(M)GIt(_,w,P,V,q);else{let J=jW();GIt(J,w,P,V,q),p(J,w,P),lL(J)}}},j,A,k={get signal(){return j||(j=new AbortController),j.signal},get setSelf(){return(Al.env?Al.env.MODE:void 0)!=="production"&&!qVe(w)&&console.warn("setSelf function cannot be used with read-only atom"),!A&&qVe(w)&&(A=(...V)=>{if((Al.env?Al.env.MODE:void 0)!=="production"&&M&&console.warn("setSelf function cannot be called in sync"),!M)return f(w,...V)}),A}};try{let V=e(w,I,k);if(i(w,P,V),zVe(V)){(T=V.onCancel)==null||T.call(V,()=>j?.abort());let q=()=>{if(P.m){let J=jW();p(J,w,P),lL(J)}};V.then(q,q)}return P}catch(V){return delete P.v,P.e=V,++P.n,P}finally{M=!1}},s=_=>Yhe(a(void 0,_)),u=(_,w,O)=>{var T,P;let M=new Map;for(let I of((T=O.m)==null?void 0:T.t)||[])M.set(I,t(I));for(let I of O.p)M.set(I,t(I));return(P=ubn(_,w))==null||P.forEach(I=>{M.set(I,t(I))}),M};function l(_,w,O){let T=[],P=new Set,M=new Set,I=[[w,O]];for(;I.length>0;){let[j,A]=I[I.length-1];if(M.has(j)){I.pop();continue}if(P.has(j)){T.push([j,A,A.n]),M.add(j),I.pop();continue}P.add(j);for(let[k,V]of u(_,j,A))j!==k&&!P.has(k)&&I.push([k,V])}return[T,M]}let c=(_,w,O)=>{let[T,P]=l(_,w,O),M=new Set([w]);for(let I=T.length-1;I>=0;--I){let[j,A,k]=T[I],V=!1;for(let q of A.d.keys())if(q!==j&&M.has(q)){V=!0;break}V&&(a(_,j,P),p(_,j,A),k!==A.n&&(UVe(_,j,A),M.add(j))),P.delete(j)}},d=(_,w,...O)=>{let T=!0,P=I=>Yhe(a(_,I)),M=(I,...j)=>{let A=t(I);try{if(WIt(w,I)){if(!kVe(I))throw new Error("atom not writable");let k=A.n,V=j[0];i(I,A,V),p(_,I,A),k!==A.n&&(UVe(_,I,A),c(_,I,A));return}else return d(_,I,...j)}finally{T||lL(_)}};try{return r(w,P,M,...O)}finally{T=!1}},f=(_,...w)=>{let O=jW();try{return d(O,_,...w)}finally{lL(O)}},p=(_,w,O)=>{if(O.m&&!BVe(O.v)){for(let T of O.d.keys())O.m.d.has(T)||(m(_,T,t(T)).t.add(w),O.m.d.add(T));for(let T of O.m.d||[])if(!O.d.has(T)){O.m.d.delete(T);let P=h(_,T,t(T));P?.t.delete(w)}}},m=(_,w,O)=>{if(!O.m){a(_,w);for(let T of O.d.keys())m(_,T,t(T)).t.add(w);if(O.m={l:new Set,d:new Set(O.d.keys()),t:new Set},(Al.env?Al.env.MODE:void 0)!=="production"&&o.add(w),qVe(w)){let T=O.m,P,M=(I,j)=>{let A=!0;P=(...k)=>{try{return d(I,w,...k)}finally{A||lL(I)}};try{return j()}finally{A=!1}};XIt(_,()=>{let I=M(_,()=>n(w,(...j)=>P(...j)));I&&(T.u=j=>M(j,I))})}}return O.m},h=(_,w,O)=>{if(O.m&&!O.m.l.size&&!Array.from(O.m.t).some(T=>{var P;return(P=t(T).m)==null?void 0:P.d.has(w)})){let T=O.m.u;T&&XIt(_,()=>T(_)),delete O.m,(Al.env?Al.env.MODE:void 0)!=="production"&&o.delete(w);for(let P of O.d.keys()){let M=h(_,P,t(P));M?.t.delete(w)}return}return O.m},b={get:s,set:f,sub:(_,w)=>{let O=jW(),T=t(_),M=m(O,_,T).l;return M.add(w),lL(O),()=>{M.delete(w);let I=jW();h(I,_,T),lL(I)}},unstable_derive:_=>YIt(..._(t,e,r,n))};return(Al.env?Al.env.MODE:void 0)!=="production"&&Object.assign(b,{dev4_get_internal_weak_map:()=>({get:w=>{let O=t(w);if(O.n!==0)return O}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:w=>{let O=jW();for(let[T,P]of w)if(kVe(T)){let M=t(T),I=M.n;i(T,M,P),p(O,T,M),I!==M.n&&(UVe(O,T,M),c(O,T,M))}lL(O)}}),b},cL=()=>{let t=new WeakMap;return YIt(r=>{if((Al.env?Al.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)})},QIt=()=>(vee||(vee=cL(),(Al.env?Al.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=vee),globalThis.__JOTAI_DEFAULT_STORE__!==vee&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),vee)});var cRt=S(ji=>{"use strict";var wee=Symbol.for("react.element"),lbn=Symbol.for("react.portal"),cbn=Symbol.for("react.fragment"),dbn=Symbol.for("react.strict_mode"),fbn=Symbol.for("react.profiler"),pbn=Symbol.for("react.provider"),mbn=Symbol.for("react.context"),hbn=Symbol.for("react.forward_ref"),gbn=Symbol.for("react.suspense"),ybn=Symbol.for("react.memo"),bbn=Symbol.for("react.lazy"),eRt=Symbol.iterator;function _bn(t){return t===null||typeof t!="object"?null:(t=eRt&&t[eRt]||t["@@iterator"],typeof t=="function"?t:null)}var nRt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oRt=Object.assign,iRt={};function DW(t,e,r){this.props=t,this.context=e,this.refs=iRt,this.updater=r||nRt}DW.prototype.isReactComponent={};DW.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")};DW.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function aRt(){}aRt.prototype=DW.prototype;function JVe(t,e,r){this.props=t,this.context=e,this.refs=iRt,this.updater=r||nRt}var WVe=JVe.prototype=new aRt;WVe.constructor=JVe;oRt(WVe,DW.prototype);WVe.isPureReactComponent=!0;var tRt=Array.isArray,sRt=Object.prototype.hasOwnProperty,KVe={current:null},uRt={key:!0,ref:!0,__self:!0,__source:!0};function lRt(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)sRt.call(e,n)&&!uRt.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:wee,type:t,key:i,ref:a,props:o,_owner:KVe.current}}function vbn(t,e){return{$$typeof:wee,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function GVe(t){return typeof t=="object"&&t!==null&&t.$$typeof===wee}function wbn(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var rRt=/\/+/g;function HVe(t,e){return typeof t=="object"&&t!==null&&t.key!=null?wbn(""+t.key):e.toString(36)}function tge(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 wee:case lbn:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+HVe(a,0):n,tRt(o)?(r="",t!=null&&(r=t.replace(rRt,"$&/")+"/"),tge(o,e,r,"",function(l){return l})):o!=null&&(GVe(o)&&(o=vbn(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(rRt,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",tRt(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+HVe(i,s);a+=tge(i,e,r,u,o)}else if(u=_bn(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+HVe(i,s++),a+=tge(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 ege(t,e,r){if(t==null)return t;var n=[],o=0;return tge(t,n,"","",function(i){return e.call(r,i,o++)}),n}function Sbn(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 ib={current:null},rge={transition:null},Cbn={ReactCurrentDispatcher:ib,ReactCurrentBatchConfig:rge,ReactCurrentOwner:KVe};ji.Children={map:ege,forEach:function(t,e,r){ege(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return ege(t,function(){e++}),e},toArray:function(t){return ege(t,function(e){return e})||[]},only:function(t){if(!GVe(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};ji.Component=DW;ji.Fragment=cbn;ji.Profiler=fbn;ji.PureComponent=JVe;ji.StrictMode=dbn;ji.Suspense=gbn;ji.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Cbn;ji.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=oRt({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=KVe.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)sRt.call(e,u)&&!uRt.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:wee,type:t.type,key:o,ref:i,props:n,_owner:a}};ji.createContext=function(t){return t={$$typeof:mbn,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:pbn,_context:t},t.Consumer=t};ji.createElement=lRt;ji.createFactory=function(t){var e=lRt.bind(null,t);return e.type=t,e};ji.createRef=function(){return{current:null}};ji.forwardRef=function(t){return{$$typeof:hbn,render:t}};ji.isValidElement=GVe;ji.lazy=function(t){return{$$typeof:bbn,_payload:{_status:-1,_result:t},_init:Sbn}};ji.memo=function(t,e){return{$$typeof:ybn,type:t,compare:e===void 0?null:e}};ji.startTransition=function(t){var e=rge.transition;rge.transition={};try{t()}finally{rge.transition=e}};ji.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};ji.useCallback=function(t,e){return ib.current.useCallback(t,e)};ji.useContext=function(t){return ib.current.useContext(t)};ji.useDebugValue=function(){};ji.useDeferredValue=function(t){return ib.current.useDeferredValue(t)};ji.useEffect=function(t,e){return ib.current.useEffect(t,e)};ji.useId=function(){return ib.current.useId()};ji.useImperativeHandle=function(t,e,r){return ib.current.useImperativeHandle(t,e,r)};ji.useInsertionEffect=function(t,e){return ib.current.useInsertionEffect(t,e)};ji.useLayoutEffect=function(t,e){return ib.current.useLayoutEffect(t,e)};ji.useMemo=function(t,e){return ib.current.useMemo(t,e)};ji.useReducer=function(t,e,r){return ib.current.useReducer(t,e,r)};ji.useRef=function(t){return ib.current.useRef(t)};ji.useState=function(t){return ib.current.useState(t)};ji.useSyncExternalStore=function(t,e,r){return ib.current.useSyncExternalStore(t,e,r)};ji.useTransition=function(){return ib.current.useTransition()};ji.version="18.2.0"});var X=S((P$i,dRt)=>{"use strict";dRt.exports=cRt()});function e_(t,e){let r=pRt(e),[[n,o,i],a]=(0,ty.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,ty.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);ZVe(c)&&mRt(fRt(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,ty.useDebugValue)(s),ZVe(s)){let l=fRt(s);return Obn(l)}return s}function hRt(t,e){let r=pRt(e);return(0,ty.useCallback)((...o)=>{if((nge.env?nge.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function dL(t,e){return[e_(t,e),hRt(t,e)]}var ty,nge,xbn,pRt,ZVe,mRt,Obn,XVe,fRt,gRt=v(()=>{"use client";ty=L(X(),1);VVe();nge={},xbn=(0,ty.createContext)(void 0),pRt=t=>{let e=(0,ty.useContext)(xbn);return t?.store||e||QIt()},ZVe=t=>typeof t?.then=="function",mRt=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},Obn=ty.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(mRt(t),t)}),XVe=new WeakMap,fRt=t=>{let e=XVe.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((nge.env?nge.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");ZVe(l)?(XVe.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),XVe.set(t,e)),e}});var eC=v(()=>{VVe();gRt()});function LW(t){return typeof t=="string"&&Tbn.includes(t)}function Ebn(t){return typeof t=="string"?t.trim():""}function oge(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 Pbn(t,e){let r=new Intl.Collator(void 0),n=u=>Ebn(e.getName(u)),o=u=>{let l=e.getCreatedAtMs(u);return Number.isFinite(l)?l:0},i=u=>{let l=o(u);return oge(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 mO(t,e,r){return[...t].sort(Pbn(e,r))}var Tbn,$W,lN=v(()=>{Tbn=["recent","created","name","manual"];$W=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=oge(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=oge(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=oge(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 See={};Rn(See,{getModelKeyFromModel:()=>oo,getSettings:()=>ae,resetSettings:()=>YVe,sanitizeQaExclusions:()=>bRt,sanitizeSettings:()=>QVe,setSettings:()=>t_,settingsAtom:()=>fL,settingsStore:()=>ui,subscribeToSettingsChange:()=>al,updateSetting:()=>Ue,useSettingsValue:()=>zr});function t_(t){let e=Mbn({...ae(),...t});ui.set(fL,e)}function bRt(t){let r=(typeof t=="string"?t:eHe).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===tC){n.set(tC,tC);return}if(!n.has(a)){let s=i.length>0&&o.endsWith("/")?`${i}/`:o;n.set(a,s)}}),n.set(tC,tC),Array.from(n.values()).map(o=>encodeURIComponent(o)).join(",")}function Ue(t,e){let r=ae();t_({...r,[t]:e})}function ae(){return ui.get(fL)}function YVe(){let t={...Di,activeModels:hO.map(e=>({...e,enabled:!0})),activeEmbeddingModels:Tz.map(e=>({...e,enabled:!0}))};t_(t)}function al(t){let e=ae();return ui.sub(fL,()=>{let r=ae();t(e,r),e=r})}function zr(){return e_(fL,{store:ui})}function QVe(t){let e=t||Di;e.userId||(e.userId=Zm()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(h=>({...h,provider:h.provider==="azure_openai"?"azure openai":h.provider})):e.activeEmbeddingModels=Tz.map(h=>({...h,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?Di.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?Di.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?Di.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?Di.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);r.embeddingBatchSize=isNaN(s)?Di.embeddingBatchSize:s;let u=Number(e.lexicalSearchRamLimit);if(isNaN(u)?r.lexicalSearchRamLimit=Di.lexicalSearchRamLimit:r.lexicalSearchRamLimit=Math.min(1e3,Math.max(20,u)),typeof r.autoAddActiveContentToContext!="boolean"){let h=e.includeActiveNoteAsContext;typeof h=="boolean"?r.autoAddActiveContentToContext=h:r.autoAddActiveContentToContext=Di.autoAddActiveContentToContext}typeof r.generateAIChatTitleOnSave!="boolean"&&(r.generateAIChatTitleOnSave=Di.generateAIChatTitleOnSave),typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=Di.passMarkdownImages),typeof r.enableInlineCitations!="boolean"&&(r.enableInlineCitations=Di.enableInlineCitations),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=Di.enableCustomPromptTemplating);let l=Number(e.autonomousAgentMaxIterations);isNaN(l)||l<4||l>8?r.autonomousAgentMaxIterations=Di.autonomousAgentMaxIterations:r.autonomousAgentMaxIterations=l,Array.isArray(r.autonomousAgentEnabledToolIds)||(r.autonomousAgentEnabledToolIds=Di.autonomousAgentEnabledToolIds),(!r.memoryFolderName||typeof r.memoryFolderName!="string")&&(r.memoryFolderName=Di.memoryFolderName),typeof r.enableRecentConversations!="boolean"&&(r.enableRecentConversations=Di.enableRecentConversations),typeof r.enableSavedMemory!="boolean"&&(r.enableSavedMemory=Di.enableSavedMemory);let c=Number(e.maxRecentConversations);isNaN(c)||c<10||c>50?r.maxRecentConversations=Di.maxRecentConversations:r.maxRecentConversations=c,typeof r.autosaveChat!="boolean"&&(r.autosaveChat=Di.autosaveChat);let d=Number(e.autoCompactThreshold);if(isNaN(d)?r.autoCompactThreshold=Di.autoCompactThreshold:r.autoCompactThreshold=Math.min(1e6,Math.max(64e3,d)),typeof r.quickCommandIncludeNoteContext!="boolean"&&(r.quickCommandIncludeNoteContext=Di.quickCommandIncludeNoteContext),e.quickCommandModelKey!==void 0&&typeof e.quickCommandModelKey!="string"&&(r.quickCommandModelKey=Di.quickCommandModelKey),typeof r.autoAddSelectionToContext!="boolean"){let h=e.autoIncludeTextSelection;typeof h=="boolean"?r.autoAddSelectionToContext=h:r.autoAddSelectionToContext=Di.autoAddSelectionToContext}typeof r.autoAcceptEdits!="boolean"&&(r.autoAcceptEdits=Di.autoAcceptEdits),Object.values(Cee).includes(r.defaultSendShortcut)||(r.defaultSendShortcut=Di.defaultSendShortcut);let f=(e.defaultSaveFolder||"").trim();r.defaultSaveFolder=f.length>0?f:Di.defaultSaveFolder;let p=(e.customPromptsFolder||"").trim();r.customPromptsFolder=p.length>0?p:Di.customPromptsFolder,(!LW(r.chatHistorySortStrategy)||r.chatHistorySortStrategy==="manual")&&(r.chatHistorySortStrategy=Di.chatHistorySortStrategy),(!LW(r.projectListSortStrategy)||r.projectListSortStrategy==="manual")&&(r.projectListSortStrategy=Di.projectListSortStrategy);let m=(e.userSystemPromptsFolder||"").trim();return r.userSystemPromptsFolder=m.length>0?m:Di.userSystemPromptsFolder,r.qaExclusions=bRt(e.qaExclusions),r}function Mbn(t){return t.activeModels=yRt(t.activeModels,hO),t.activeEmbeddingModels=yRt(t.activeEmbeddingModels,Tz),t}function oo(t){return`${t.name}|${t.provider}`}function yRt(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(oo(n),{...n})}),t.forEach(n=>{let o=oo(n),i=r.get(o);if(i){let a=e.find(s=>s.name===n.name&&s.provider===n.provider);a?r.set(o,{...a,...n,isBuiltIn:!0,believerExclusive:a.believerExclusive}):r.set(o,{...n,isBuiltIn:i.isBuiltIn})}else r.set(o,n)}),Array.from(r.values())}var ui,fL,ot=v(()=>{eC();D$();lN();Or();ui=cL(),fL=Cc(Di)});function Sn(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 tHe=v(()=>{});var rHe,pm,Ez=v(()=>{tHe();Zt();ot();rHe=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=Sn(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,"<").replace(/>/g,">")}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=ae();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 xc(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{}}},pm=rHe.getInstance()});function B(...t){ae().debug&&console.log(...t),pm.append("INFO",...t)}function ne(...t){ae().debug&&console.error(...t),pm.append("ERROR",...t)}function Be(...t){ae().debug&&console.warn(...t),pm.append("WARN",...t)}function ige(t){pm.appendMarkdownBlock(t)}function _Rt(t,e){if(ae().debug)try{if(typeof console.table=="function"){Array.isArray(e)&&e.length>0?console.table(t,e):console.table(t);return}}catch{}B("Table:",JSON.stringify(t))}var _t=v(()=>{ot();Ez()});var vRt=S((nHe,FW)=>{(function(t,e){typeof nHe=="object"&&typeof FW<"u"?FW.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(nHe,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,E){return Object.prototype.hasOwnProperty.call(C,E)}function a(C){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(C).length===0;var E;for(E in C)if(i(C,E))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,E){var N=[],F,W=C.length;for(F=0;F<W;++F)N.push(E(C[F],F));return N}function d(C,E){for(var N in E)i(E,N)&&(C[N]=E[N]);return i(E,"toString")&&(C.toString=E.toString),i(E,"valueOf")&&(C.valueOf=E.valueOf),C}function f(C,E,N,F){return uwt(C,E,N,F,!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 E=Object(this),N=E.length>>>0,F;for(F=0;F<N;F++)if(F in E&&C.call(this,E[F],F,E))return!0;return!1};function y(C){if(C._isValid==null){var E=m(C),N=h.call(E.parsedDateParts,function(W){return W!=null}),F=!isNaN(C._d.getTime())&&E.overflow<0&&!E.empty&&!E.invalidEra&&!E.invalidMonth&&!E.invalidWeekday&&!E.weekdayMismatch&&!E.nullInput&&!E.invalidFormat&&!E.userInvalidated&&(!E.meridiem||E.meridiem&&N);if(C._strict&&(F=F&&E.charsLeftOver===0&&E.unusedTokens.length===0&&E.bigHour===void 0),Object.isFrozen==null||!Object.isFrozen(C))C._isValid=F;else return F}return C._isValid}function g(C){var E=f(NaN);return C!=null?d(m(E),C):m(E).userInvalidated=!0,E}var b=e.momentProperties=[],_=!1;function w(C,E){var N,F,W,de=b.length;if(s(E._isAMomentObject)||(C._isAMomentObject=E._isAMomentObject),s(E._i)||(C._i=E._i),s(E._f)||(C._f=E._f),s(E._l)||(C._l=E._l),s(E._strict)||(C._strict=E._strict),s(E._tzm)||(C._tzm=E._tzm),s(E._isUTC)||(C._isUTC=E._isUTC),s(E._offset)||(C._offset=E._offset),s(E._pf)||(C._pf=m(E)),s(E._locale)||(C._locale=E._locale),de>0)for(N=0;N<de;N++)F=b[N],W=E[F],s(W)||(C[F]=W);return C}function O(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 T(C){return C instanceof O||C!=null&&C._isAMomentObject!=null}function P(C){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+C)}function M(C,E){var N=!0;return d(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,C),N){var F=[],W,de,Ae,rn=arguments.length;for(de=0;de<rn;de++){if(W="",typeof arguments[de]=="object"){W+=`
|
||
[`+de+"] ";for(Ae in arguments[0])i(arguments[0],Ae)&&(W+=Ae+": "+arguments[0][Ae]+", ");W=W.slice(0,-2)}else W=arguments[de];F.push(W)}P(C+`
|
||
Arguments: `+Array.prototype.slice.call(F).join("")+`
|
||
`+new Error().stack),N=!1}return E.apply(this,arguments)},E)}var I={};function j(C,E){e.deprecationHandler!=null&&e.deprecationHandler(C,E),I[C]||(P(E),I[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 k(C){var E,N;for(N in C)i(C,N)&&(E=C[N],A(E)?this[N]=E:this["_"+N]=E);this._config=C,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function V(C,E){var N=d({},C),F;for(F in E)i(E,F)&&(o(C[F])&&o(E[F])?(N[F]={},d(N[F],C[F]),d(N[F],E[F])):E[F]!=null?N[F]=E[F]:delete N[F]);for(F in C)i(C,F)&&!i(E,F)&&o(C[F])&&(N[F]=d({},N[F]));return N}function q(C){C!=null&&this.set(C)}var J;Object.keys?J=Object.keys:J=function(C){var E,N=[];for(E in C)i(C,E)&&N.push(E);return N};var K={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function ue(C,E,N){var F=this._calendar[C]||this._calendar.sameElse;return A(F)?F.call(E,N):F}function oe(C,E,N){var F=""+Math.abs(C),W=E-F.length,de=C>=0;return(de?N?"+":"":"-")+Math.pow(10,Math.max(0,W)).toString().substr(1)+F}var G=/(\[[^\[]*\])|(\\)?([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,Y=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,se={},ie={};function $(C,E,N,F){var W=F;typeof F=="string"&&(W=function(){return this[F]()}),C&&(ie[C]=W),E&&(ie[E[0]]=function(){return oe(W.apply(this,arguments),E[1],E[2])}),N&&(ie[N]=function(){return this.localeData().ordinal(W.apply(this,arguments),C)})}function H(C){return C.match(/\[[\s\S]/)?C.replace(/^\[|\]$/g,""):C.replace(/\\/g,"")}function re(C){var E=C.match(G),N,F;for(N=0,F=E.length;N<F;N++)ie[E[N]]?E[N]=ie[E[N]]:E[N]=H(E[N]);return function(W){var de="",Ae;for(Ae=0;Ae<F;Ae++)de+=A(E[Ae])?E[Ae].call(W,C):E[Ae];return de}}function D(C,E){return C.isValid()?(E=R(E,C.localeData()),se[E]=se[E]||re(E),se[E](C)):C.localeData().invalidDate()}function R(C,E){var N=5;function F(W){return E.longDateFormat(W)||W}for(Y.lastIndex=0;N>=0&&Y.test(C);)C=C.replace(Y,F),Y.lastIndex=0,N-=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 U(C){var E=this._longDateFormat[C],N=this._longDateFormat[C.toUpperCase()];return E||!N?E:(this._longDateFormat[C]=N.match(G).map(function(F){return F==="MMMM"||F==="MM"||F==="DD"||F==="dddd"?F.slice(1):F}).join(""),this._longDateFormat[C])}var ee="Invalid date";function ce(){return this._invalidDate}var ve="%d",Oe=/\d{1,2}/;function Je(C){return this._ordinal.replace("%d",C)}var tt={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 Ke(C,E,N,F){var W=this._relativeTime[N];return A(W)?W(C,E,N,F):W.replace(/%d/i,C)}function dt(C,E){var N=this._relativeTime[C>0?"future":"past"];return A(N)?N(E):N.replace(/%s/i,E)}var Pt={};function Nt(C,E){var N=C.toLowerCase();Pt[N]=Pt[N+"s"]=Pt[E]=C}function Ne(C){return typeof C=="string"?Pt[C]||Pt[C.toLowerCase()]:void 0}function Tr(C){var E={},N,F;for(F in C)i(C,F)&&(N=Ne(F),N&&(E[N]=C[F]));return E}var st={};function Le(C,E){st[C]=E}function rt(C){var E=[],N;for(N in C)i(C,N)&&E.push({unit:N,priority:st[N]});return E.sort(function(F,W){return F.priority-W.priority}),E}function Fe(C){return C%4===0&&C%100!==0||C%400===0}function We(C){return C<0?Math.ceil(C)||0:Math.floor(C)}function ke(C){var E=+C,N=0;return E!==0&&isFinite(E)&&(N=We(E)),N}function Lt(C,E){return function(N){return N!=null?(xl(this,C,N),e.updateOffset(this,E),this):Eo(this,C)}}function Eo(C,E){return C.isValid()?C._d["get"+(C._isUTC?"UTC":"")+E]():NaN}function xl(C,E,N){C.isValid()&&!isNaN(N)&&(E==="FullYear"&&Fe(C.year())&&C.month()===1&&C.date()===29?(N=ke(N),C._d["set"+(C._isUTC?"UTC":"")+E](N,C.month(),Rfe(N,C.month()))):C._d["set"+(C._isUTC?"UTC":"")+E](N))}function In(C){return C=Ne(C),A(this[C])?this[C]():this}function hi(C,E){if(typeof C=="object"){C=Tr(C);var N=rt(C),F,W=N.length;for(F=0;F<W;F++)this[N[F].unit](C[N[F].unit])}else if(C=Ne(C),A(this[C]))return this[C](E);return this}var Gm=/\d/,Fs=/\d\d/,Vb=/\d{3}/,Jh=/\d{4}/,Mw=/[+-]?\d{6}/,zi=/\d\d?/,pt=/\d\d\d\d?/,Br=/\d\d\d\d\d\d?/,Ti=/\d{1,3}/,Ei=/\d{1,4}/,tu=/[+-]?\d{1,6}/,Pi=/\d+/,tl=/[+-]?\d+/,rl=/Z|[+-]\d\d:?\d\d/gi,Ol=/Z|[+-]\d\d(?::?\d\d)?/gi,Xm=/[+-]?\d+(\.\d{1,3})?/,Ft=/[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,Ge;Ge={};function Ee(C,E,N){Ge[C]=A(E)?E:function(F,W){return F&&N?N:E}}function yr(C,E){return i(Ge,C)?Ge[C](E._strict,E._locale):new RegExp(ii(C))}function ii(C){return is(C.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(E,N,F,W,de){return N||F||W||de}))}function is(C){return C.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var cv={};function gi(C,E){var N,F=E,W;for(typeof C=="string"&&(C=[C]),u(E)&&(F=function(de,Ae){Ae[E]=ke(de)}),W=C.length,N=0;N<W;N++)cv[C[N]]=F}function U0(C,E){gi(C,function(N,F,W,de){W._w=W._w||{},E(N,W._w,W,de)})}function SY(C,E,N){E!=null&&i(cv,C)&&cv[C](E,N._a,N,C)}var Bg=0,DA=1,Xx=2,dm=3,B0=4,$A=5,MB=6,fon=7,pon=8;function mon(C,E){return(C%E+E)%E}var qc;Array.prototype.indexOf?qc=Array.prototype.indexOf:qc=function(C){var E;for(E=0;E<this.length;++E)if(this[E]===C)return E;return-1};function Rfe(C,E){if(isNaN(C)||isNaN(E))return NaN;var N=mon(E,12);return C+=(E-N)/12,N===1?Fe(C)?29:28:31-N%7%2}$("M",["MM",2],"Mo",function(){return this.month()+1}),$("MMM",0,0,function(C){return this.localeData().monthsShort(this,C)}),$("MMMM",0,0,function(C){return this.localeData().months(this,C)}),Nt("month","M"),Le("month",8),Ee("M",zi),Ee("MM",zi,Fs),Ee("MMM",function(C,E){return E.monthsShortRegex(C)}),Ee("MMMM",function(C,E){return E.monthsRegex(C)}),gi(["M","MM"],function(C,E){E[DA]=ke(C)-1}),gi(["MMM","MMMM"],function(C,E,N,F){var W=N._locale.monthsParse(C,F,N._strict);W!=null?E[DA]=W:m(N).invalidMonth=C});var hon="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Wvt="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Kvt=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,gon=Ft,yon=Ft;function bon(C,E){return C?n(this._months)?this._months[C.month()]:this._months[(this._months.isFormat||Kvt).test(E)?"format":"standalone"][C.month()]:n(this._months)?this._months:this._months.standalone}function _on(C,E){return C?n(this._monthsShort)?this._monthsShort[C.month()]:this._monthsShort[Kvt.test(E)?"format":"standalone"][C.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function von(C,E,N){var F,W,de,Ae=C.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],F=0;F<12;++F)de=f([2e3,F]),this._shortMonthsParse[F]=this.monthsShort(de,"").toLocaleLowerCase(),this._longMonthsParse[F]=this.months(de,"").toLocaleLowerCase();return N?E==="MMM"?(W=qc.call(this._shortMonthsParse,Ae),W!==-1?W:null):(W=qc.call(this._longMonthsParse,Ae),W!==-1?W:null):E==="MMM"?(W=qc.call(this._shortMonthsParse,Ae),W!==-1?W:(W=qc.call(this._longMonthsParse,Ae),W!==-1?W:null)):(W=qc.call(this._longMonthsParse,Ae),W!==-1?W:(W=qc.call(this._shortMonthsParse,Ae),W!==-1?W:null))}function won(C,E,N){var F,W,de;if(this._monthsParseExact)return von.call(this,C,E,N);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),F=0;F<12;F++){if(W=f([2e3,F]),N&&!this._longMonthsParse[F]&&(this._longMonthsParse[F]=new RegExp("^"+this.months(W,"").replace(".","")+"$","i"),this._shortMonthsParse[F]=new RegExp("^"+this.monthsShort(W,"").replace(".","")+"$","i")),!N&&!this._monthsParse[F]&&(de="^"+this.months(W,"")+"|^"+this.monthsShort(W,""),this._monthsParse[F]=new RegExp(de.replace(".",""),"i")),N&&E==="MMMM"&&this._longMonthsParse[F].test(C))return F;if(N&&E==="MMM"&&this._shortMonthsParse[F].test(C))return F;if(!N&&this._monthsParse[F].test(C))return F}}function Gvt(C,E){var N;if(!C.isValid())return C;if(typeof E=="string"){if(/^\d+$/.test(E))E=ke(E);else if(E=C.localeData().monthsParse(E),!u(E))return C}return N=Math.min(C.date(),Rfe(C.year(),E)),C._d["set"+(C._isUTC?"UTC":"")+"Month"](E,N),C}function Xvt(C){return C!=null?(Gvt(this,C),e.updateOffset(this,!0),this):Eo(this,"Month")}function Son(){return Rfe(this.year(),this.month())}function Con(C){return this._monthsParseExact?(i(this,"_monthsRegex")||Zvt.call(this),C?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=gon),this._monthsShortStrictRegex&&C?this._monthsShortStrictRegex:this._monthsShortRegex)}function xon(C){return this._monthsParseExact?(i(this,"_monthsRegex")||Zvt.call(this),C?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=yon),this._monthsStrictRegex&&C?this._monthsStrictRegex:this._monthsRegex)}function Zvt(){function C(Ae,rn){return rn.length-Ae.length}var E=[],N=[],F=[],W,de;for(W=0;W<12;W++)de=f([2e3,W]),E.push(this.monthsShort(de,"")),N.push(this.months(de,"")),F.push(this.months(de,"")),F.push(this.monthsShort(de,""));for(E.sort(C),N.sort(C),F.sort(C),W=0;W<12;W++)E[W]=is(E[W]),N[W]=is(N[W]);for(W=0;W<24;W++)F[W]=is(F[W]);this._monthsRegex=new RegExp("^("+F.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+N.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+E.join("|")+")","i")}$("Y",0,0,function(){var C=this.year();return C<=9999?oe(C,4):"+"+C}),$(0,["YY",2],0,function(){return this.year()%100}),$(0,["YYYY",4],0,"year"),$(0,["YYYYY",5],0,"year"),$(0,["YYYYYY",6,!0],0,"year"),Nt("year","y"),Le("year",1),Ee("Y",tl),Ee("YY",zi,Fs),Ee("YYYY",Ei,Jh),Ee("YYYYY",tu,Mw),Ee("YYYYYY",tu,Mw),gi(["YYYYY","YYYYYY"],Bg),gi("YYYY",function(C,E){E[Bg]=C.length===2?e.parseTwoDigitYear(C):ke(C)}),gi("YY",function(C,E){E[Bg]=e.parseTwoDigitYear(C)}),gi("Y",function(C,E){E[Bg]=parseInt(C,10)});function CY(C){return Fe(C)?366:365}e.parseTwoDigitYear=function(C){return ke(C)+(ke(C)>68?1900:2e3)};var Yvt=Lt("FullYear",!0);function Oon(){return Fe(this.year())}function Ton(C,E,N,F,W,de,Ae){var rn;return C<100&&C>=0?(rn=new Date(C+400,E,N,F,W,de,Ae),isFinite(rn.getFullYear())&&rn.setFullYear(C)):rn=new Date(C,E,N,F,W,de,Ae),rn}function xY(C){var E,N;return C<100&&C>=0?(N=Array.prototype.slice.call(arguments),N[0]=C+400,E=new Date(Date.UTC.apply(null,N)),isFinite(E.getUTCFullYear())&&E.setUTCFullYear(C)):E=new Date(Date.UTC.apply(null,arguments)),E}function Afe(C,E,N){var F=7+E-N,W=(7+xY(C,0,F).getUTCDay()-E)%7;return-W+F-1}function Qvt(C,E,N,F,W){var de=(7+N-F)%7,Ae=Afe(C,F,W),rn=1+7*(E-1)+de+Ae,ai,uu;return rn<=0?(ai=C-1,uu=CY(ai)+rn):rn>CY(C)?(ai=C+1,uu=rn-CY(C)):(ai=C,uu=rn),{year:ai,dayOfYear:uu}}function OY(C,E,N){var F=Afe(C.year(),E,N),W=Math.floor((C.dayOfYear()-F-1)/7)+1,de,Ae;return W<1?(Ae=C.year()-1,de=W+LA(Ae,E,N)):W>LA(C.year(),E,N)?(de=W-LA(C.year(),E,N),Ae=C.year()+1):(Ae=C.year(),de=W),{week:de,year:Ae}}function LA(C,E,N){var F=Afe(C,E,N),W=Afe(C+1,E,N);return(CY(C)-F+W)/7}$("w",["ww",2],"wo","week"),$("W",["WW",2],"Wo","isoWeek"),Nt("week","w"),Nt("isoWeek","W"),Le("week",5),Le("isoWeek",5),Ee("w",zi),Ee("ww",zi,Fs),Ee("W",zi),Ee("WW",zi,Fs),U0(["w","ww","W","WW"],function(C,E,N,F){E[F.substr(0,1)]=ke(C)});function Eon(C){return OY(C,this._week.dow,this._week.doy).week}var Pon={dow:0,doy:6};function Mon(){return this._week.dow}function Ion(){return this._week.doy}function Ron(C){var E=this.localeData().week(this);return C==null?E:this.add((C-E)*7,"d")}function Aon(C){var E=OY(this,1,4).week;return C==null?E:this.add((C-E)*7,"d")}$("d",0,"do","day"),$("dd",0,0,function(C){return this.localeData().weekdaysMin(this,C)}),$("ddd",0,0,function(C){return this.localeData().weekdaysShort(this,C)}),$("dddd",0,0,function(C){return this.localeData().weekdays(this,C)}),$("e",0,0,"weekday"),$("E",0,0,"isoWeekday"),Nt("day","d"),Nt("weekday","e"),Nt("isoWeekday","E"),Le("day",11),Le("weekday",11),Le("isoWeekday",11),Ee("d",zi),Ee("e",zi),Ee("E",zi),Ee("dd",function(C,E){return E.weekdaysMinRegex(C)}),Ee("ddd",function(C,E){return E.weekdaysShortRegex(C)}),Ee("dddd",function(C,E){return E.weekdaysRegex(C)}),U0(["dd","ddd","dddd"],function(C,E,N,F){var W=N._locale.weekdaysParse(C,F,N._strict);W!=null?E.d=W:m(N).invalidWeekday=C}),U0(["d","e","E"],function(C,E,N,F){E[F]=ke(C)});function Non(C,E){return typeof C!="string"?C:isNaN(C)?(C=E.weekdaysParse(C),typeof C=="number"?C:null):parseInt(C,10)}function jon(C,E){return typeof C=="string"?E.weekdaysParse(C)%7||7:isNaN(C)?null:C}function zke(C,E){return C.slice(E,7).concat(C.slice(0,E))}var Don="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ewt="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),$on="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Lon=Ft,Fon=Ft,kon=Ft;function qon(C,E){var N=n(this._weekdays)?this._weekdays:this._weekdays[C&&C!==!0&&this._weekdays.isFormat.test(E)?"format":"standalone"];return C===!0?zke(N,this._week.dow):C?N[C.day()]:N}function Uon(C){return C===!0?zke(this._weekdaysShort,this._week.dow):C?this._weekdaysShort[C.day()]:this._weekdaysShort}function Bon(C){return C===!0?zke(this._weekdaysMin,this._week.dow):C?this._weekdaysMin[C.day()]:this._weekdaysMin}function zon(C,E,N){var F,W,de,Ae=C.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],F=0;F<7;++F)de=f([2e3,1]).day(F),this._minWeekdaysParse[F]=this.weekdaysMin(de,"").toLocaleLowerCase(),this._shortWeekdaysParse[F]=this.weekdaysShort(de,"").toLocaleLowerCase(),this._weekdaysParse[F]=this.weekdays(de,"").toLocaleLowerCase();return N?E==="dddd"?(W=qc.call(this._weekdaysParse,Ae),W!==-1?W:null):E==="ddd"?(W=qc.call(this._shortWeekdaysParse,Ae),W!==-1?W:null):(W=qc.call(this._minWeekdaysParse,Ae),W!==-1?W:null):E==="dddd"?(W=qc.call(this._weekdaysParse,Ae),W!==-1||(W=qc.call(this._shortWeekdaysParse,Ae),W!==-1)?W:(W=qc.call(this._minWeekdaysParse,Ae),W!==-1?W:null)):E==="ddd"?(W=qc.call(this._shortWeekdaysParse,Ae),W!==-1||(W=qc.call(this._weekdaysParse,Ae),W!==-1)?W:(W=qc.call(this._minWeekdaysParse,Ae),W!==-1?W:null)):(W=qc.call(this._minWeekdaysParse,Ae),W!==-1||(W=qc.call(this._weekdaysParse,Ae),W!==-1)?W:(W=qc.call(this._shortWeekdaysParse,Ae),W!==-1?W:null))}function Von(C,E,N){var F,W,de;if(this._weekdaysParseExact)return zon.call(this,C,E,N);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),F=0;F<7;F++){if(W=f([2e3,1]).day(F),N&&!this._fullWeekdaysParse[F]&&(this._fullWeekdaysParse[F]=new RegExp("^"+this.weekdays(W,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[F]=new RegExp("^"+this.weekdaysShort(W,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[F]=new RegExp("^"+this.weekdaysMin(W,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[F]||(de="^"+this.weekdays(W,"")+"|^"+this.weekdaysShort(W,"")+"|^"+this.weekdaysMin(W,""),this._weekdaysParse[F]=new RegExp(de.replace(".",""),"i")),N&&E==="dddd"&&this._fullWeekdaysParse[F].test(C))return F;if(N&&E==="ddd"&&this._shortWeekdaysParse[F].test(C))return F;if(N&&E==="dd"&&this._minWeekdaysParse[F].test(C))return F;if(!N&&this._weekdaysParse[F].test(C))return F}}function Hon(C){if(!this.isValid())return C!=null?this:NaN;var E=this._isUTC?this._d.getUTCDay():this._d.getDay();return C!=null?(C=Non(C,this.localeData()),this.add(C-E,"d")):E}function Jon(C){if(!this.isValid())return C!=null?this:NaN;var E=(this.day()+7-this.localeData()._week.dow)%7;return C==null?E:this.add(C-E,"d")}function Won(C){if(!this.isValid())return C!=null?this:NaN;if(C!=null){var E=jon(C,this.localeData());return this.day(this.day()%7?E:E-7)}else return this.day()||7}function Kon(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Vke.call(this),C?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=Lon),this._weekdaysStrictRegex&&C?this._weekdaysStrictRegex:this._weekdaysRegex)}function Gon(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Vke.call(this),C?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Fon),this._weekdaysShortStrictRegex&&C?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Xon(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Vke.call(this),C?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=kon),this._weekdaysMinStrictRegex&&C?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Vke(){function C(Hy,BA){return BA.length-Hy.length}var E=[],N=[],F=[],W=[],de,Ae,rn,ai,uu;for(de=0;de<7;de++)Ae=f([2e3,1]).day(de),rn=is(this.weekdaysMin(Ae,"")),ai=is(this.weekdaysShort(Ae,"")),uu=is(this.weekdays(Ae,"")),E.push(rn),N.push(ai),F.push(uu),W.push(rn),W.push(ai),W.push(uu);E.sort(C),N.sort(C),F.sort(C),W.sort(C),this._weekdaysRegex=new RegExp("^("+W.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+F.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+N.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+E.join("|")+")","i")}function Hke(){return this.hours()%12||12}function Zon(){return this.hours()||24}$("H",["HH",2],0,"hour"),$("h",["hh",2],0,Hke),$("k",["kk",2],0,Zon),$("hmm",0,0,function(){return""+Hke.apply(this)+oe(this.minutes(),2)}),$("hmmss",0,0,function(){return""+Hke.apply(this)+oe(this.minutes(),2)+oe(this.seconds(),2)}),$("Hmm",0,0,function(){return""+this.hours()+oe(this.minutes(),2)}),$("Hmmss",0,0,function(){return""+this.hours()+oe(this.minutes(),2)+oe(this.seconds(),2)});function twt(C,E){$(C,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),E)})}twt("a",!0),twt("A",!1),Nt("hour","h"),Le("hour",13);function rwt(C,E){return E._meridiemParse}Ee("a",rwt),Ee("A",rwt),Ee("H",zi),Ee("h",zi),Ee("k",zi),Ee("HH",zi,Fs),Ee("hh",zi,Fs),Ee("kk",zi,Fs),Ee("hmm",pt),Ee("hmmss",Br),Ee("Hmm",pt),Ee("Hmmss",Br),gi(["H","HH"],dm),gi(["k","kk"],function(C,E,N){var F=ke(C);E[dm]=F===24?0:F}),gi(["a","A"],function(C,E,N){N._isPm=N._locale.isPM(C),N._meridiem=C}),gi(["h","hh"],function(C,E,N){E[dm]=ke(C),m(N).bigHour=!0}),gi("hmm",function(C,E,N){var F=C.length-2;E[dm]=ke(C.substr(0,F)),E[B0]=ke(C.substr(F)),m(N).bigHour=!0}),gi("hmmss",function(C,E,N){var F=C.length-4,W=C.length-2;E[dm]=ke(C.substr(0,F)),E[B0]=ke(C.substr(F,2)),E[$A]=ke(C.substr(W)),m(N).bigHour=!0}),gi("Hmm",function(C,E,N){var F=C.length-2;E[dm]=ke(C.substr(0,F)),E[B0]=ke(C.substr(F))}),gi("Hmmss",function(C,E,N){var F=C.length-4,W=C.length-2;E[dm]=ke(C.substr(0,F)),E[B0]=ke(C.substr(F,2)),E[$A]=ke(C.substr(W))});function Yon(C){return(C+"").toLowerCase().charAt(0)==="p"}var Qon=/[ap]\.?m?\.?/i,ein=Lt("Hours",!0);function tin(C,E,N){return C>11?N?"pm":"PM":N?"am":"AM"}var nwt={calendar:K,longDateFormat:z,invalidDate:ee,ordinal:ve,dayOfMonthOrdinalParse:Oe,relativeTime:tt,months:hon,monthsShort:Wvt,week:Pon,weekdays:Don,weekdaysMin:$on,weekdaysShort:ewt,meridiemParse:Qon},Tl={},TY={},EY;function rin(C,E){var N,F=Math.min(C.length,E.length);for(N=0;N<F;N+=1)if(C[N]!==E[N])return N;return F}function owt(C){return C&&C.toLowerCase().replace("_","-")}function nin(C){for(var E=0,N,F,W,de;E<C.length;){for(de=owt(C[E]).split("-"),N=de.length,F=owt(C[E+1]),F=F?F.split("-"):null;N>0;){if(W=Nfe(de.slice(0,N).join("-")),W)return W;if(F&&F.length>=N&&rin(de,F)>=N-1)break;N--}E++}return EY}function oin(C){return C.match("^[^/\\\\]*$")!=null}function Nfe(C){var E=null,N;if(Tl[C]===void 0&&typeof FW<"u"&&FW&&FW.exports&&oin(C))try{E=EY._abbr,N=require,N("./locale/"+C),A$(E)}catch{Tl[C]=null}return Tl[C]}function A$(C,E){var N;return C&&(s(E)?N=FA(C):N=Jke(C,E),N?EY=N:typeof console<"u"&&console.warn&&console.warn("Locale "+C+" not found. Did you forget to load it?")),EY._abbr}function Jke(C,E){if(E!==null){var N,F=nwt;if(E.abbr=C,Tl[C]!=null)j("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),F=Tl[C]._config;else if(E.parentLocale!=null)if(Tl[E.parentLocale]!=null)F=Tl[E.parentLocale]._config;else if(N=Nfe(E.parentLocale),N!=null)F=N._config;else return TY[E.parentLocale]||(TY[E.parentLocale]=[]),TY[E.parentLocale].push({name:C,config:E}),null;return Tl[C]=new q(V(F,E)),TY[C]&&TY[C].forEach(function(W){Jke(W.name,W.config)}),A$(C),Tl[C]}else return delete Tl[C],null}function iin(C,E){if(E!=null){var N,F,W=nwt;Tl[C]!=null&&Tl[C].parentLocale!=null?Tl[C].set(V(Tl[C]._config,E)):(F=Nfe(C),F!=null&&(W=F._config),E=V(W,E),F==null&&(E.abbr=C),N=new q(E),N.parentLocale=Tl[C],Tl[C]=N),A$(C)}else Tl[C]!=null&&(Tl[C].parentLocale!=null?(Tl[C]=Tl[C].parentLocale,C===A$()&&A$(C)):Tl[C]!=null&&delete Tl[C]);return Tl[C]}function FA(C){var E;if(C&&C._locale&&C._locale._abbr&&(C=C._locale._abbr),!C)return EY;if(!n(C)){if(E=Nfe(C),E)return E;C=[C]}return nin(C)}function ain(){return J(Tl)}function Wke(C){var E,N=C._a;return N&&m(C).overflow===-2&&(E=N[DA]<0||N[DA]>11?DA:N[Xx]<1||N[Xx]>Rfe(N[Bg],N[DA])?Xx:N[dm]<0||N[dm]>24||N[dm]===24&&(N[B0]!==0||N[$A]!==0||N[MB]!==0)?dm:N[B0]<0||N[B0]>59?B0:N[$A]<0||N[$A]>59?$A:N[MB]<0||N[MB]>999?MB:-1,m(C)._overflowDayOfYear&&(E<Bg||E>Xx)&&(E=Xx),m(C)._overflowWeeks&&E===-1&&(E=fon),m(C)._overflowWeekday&&E===-1&&(E=pon),m(C).overflow=E),C}var sin=/^\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)?)?$/,uin=/^\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)?)?$/,lin=/Z|[+-]\d\d(?::?\d\d)?/,jfe=[["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]],Kke=[["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/]],cin=/^\/?Date\((-?\d+)/i,din=/^(?:(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}))$/,fin={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 iwt(C){var E,N,F=C._i,W=sin.exec(F)||uin.exec(F),de,Ae,rn,ai,uu=jfe.length,Hy=Kke.length;if(W){for(m(C).iso=!0,E=0,N=uu;E<N;E++)if(jfe[E][1].exec(W[1])){Ae=jfe[E][0],de=jfe[E][2]!==!1;break}if(Ae==null){C._isValid=!1;return}if(W[3]){for(E=0,N=Hy;E<N;E++)if(Kke[E][1].exec(W[3])){rn=(W[2]||" ")+Kke[E][0];break}if(rn==null){C._isValid=!1;return}}if(!de&&rn!=null){C._isValid=!1;return}if(W[4])if(lin.exec(W[4]))ai="Z";else{C._isValid=!1;return}C._f=Ae+(rn||"")+(ai||""),Xke(C)}else C._isValid=!1}function pin(C,E,N,F,W,de){var Ae=[min(C),Wvt.indexOf(E),parseInt(N,10),parseInt(F,10),parseInt(W,10)];return de&&Ae.push(parseInt(de,10)),Ae}function min(C){var E=parseInt(C,10);return E<=49?2e3+E:E<=999?1900+E:E}function hin(C){return C.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function gin(C,E,N){if(C){var F=ewt.indexOf(C),W=new Date(E[0],E[1],E[2]).getDay();if(F!==W)return m(N).weekdayMismatch=!0,N._isValid=!1,!1}return!0}function yin(C,E,N){if(C)return fin[C];if(E)return 0;var F=parseInt(N,10),W=F%100,de=(F-W)/100;return de*60+W}function awt(C){var E=din.exec(hin(C._i)),N;if(E){if(N=pin(E[4],E[3],E[2],E[5],E[6],E[7]),!gin(E[1],N,C))return;C._a=N,C._tzm=yin(E[8],E[9],E[10]),C._d=xY.apply(null,C._a),C._d.setUTCMinutes(C._d.getUTCMinutes()-C._tzm),m(C).rfc2822=!0}else C._isValid=!1}function bin(C){var E=cin.exec(C._i);if(E!==null){C._d=new Date(+E[1]);return}if(iwt(C),C._isValid===!1)delete C._isValid;else return;if(awt(C),C._isValid===!1)delete C._isValid;else return;C._strict?C._isValid=!1:e.createFromInputFallback(C)}e.createFromInputFallback=M("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(C){C._d=new Date(C._i+(C._useUTC?" UTC":""))});function q3(C,E,N){return C??E??N}function _in(C){var E=new Date(e.now());return C._useUTC?[E.getUTCFullYear(),E.getUTCMonth(),E.getUTCDate()]:[E.getFullYear(),E.getMonth(),E.getDate()]}function Gke(C){var E,N,F=[],W,de,Ae;if(!C._d){for(W=_in(C),C._w&&C._a[Xx]==null&&C._a[DA]==null&&vin(C),C._dayOfYear!=null&&(Ae=q3(C._a[Bg],W[Bg]),(C._dayOfYear>CY(Ae)||C._dayOfYear===0)&&(m(C)._overflowDayOfYear=!0),N=xY(Ae,0,C._dayOfYear),C._a[DA]=N.getUTCMonth(),C._a[Xx]=N.getUTCDate()),E=0;E<3&&C._a[E]==null;++E)C._a[E]=F[E]=W[E];for(;E<7;E++)C._a[E]=F[E]=C._a[E]==null?E===2?1:0:C._a[E];C._a[dm]===24&&C._a[B0]===0&&C._a[$A]===0&&C._a[MB]===0&&(C._nextDay=!0,C._a[dm]=0),C._d=(C._useUTC?xY:Ton).apply(null,F),de=C._useUTC?C._d.getUTCDay():C._d.getDay(),C._tzm!=null&&C._d.setUTCMinutes(C._d.getUTCMinutes()-C._tzm),C._nextDay&&(C._a[dm]=24),C._w&&typeof C._w.d<"u"&&C._w.d!==de&&(m(C).weekdayMismatch=!0)}}function vin(C){var E,N,F,W,de,Ae,rn,ai,uu;E=C._w,E.GG!=null||E.W!=null||E.E!=null?(de=1,Ae=4,N=q3(E.GG,C._a[Bg],OY(nl(),1,4).year),F=q3(E.W,1),W=q3(E.E,1),(W<1||W>7)&&(ai=!0)):(de=C._locale._week.dow,Ae=C._locale._week.doy,uu=OY(nl(),de,Ae),N=q3(E.gg,C._a[Bg],uu.year),F=q3(E.w,uu.week),E.d!=null?(W=E.d,(W<0||W>6)&&(ai=!0)):E.e!=null?(W=E.e+de,(E.e<0||E.e>6)&&(ai=!0)):W=de),F<1||F>LA(N,de,Ae)?m(C)._overflowWeeks=!0:ai!=null?m(C)._overflowWeekday=!0:(rn=Qvt(N,F,W,de,Ae),C._a[Bg]=rn.year,C._dayOfYear=rn.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function Xke(C){if(C._f===e.ISO_8601){iwt(C);return}if(C._f===e.RFC_2822){awt(C);return}C._a=[],m(C).empty=!0;var E=""+C._i,N,F,W,de,Ae,rn=E.length,ai=0,uu,Hy;for(W=R(C._f,C._locale).match(G)||[],Hy=W.length,N=0;N<Hy;N++)de=W[N],F=(E.match(yr(de,C))||[])[0],F&&(Ae=E.substr(0,E.indexOf(F)),Ae.length>0&&m(C).unusedInput.push(Ae),E=E.slice(E.indexOf(F)+F.length),ai+=F.length),ie[de]?(F?m(C).empty=!1:m(C).unusedTokens.push(de),SY(de,F,C)):C._strict&&!F&&m(C).unusedTokens.push(de);m(C).charsLeftOver=rn-ai,E.length>0&&m(C).unusedInput.push(E),C._a[dm]<=12&&m(C).bigHour===!0&&C._a[dm]>0&&(m(C).bigHour=void 0),m(C).parsedDateParts=C._a.slice(0),m(C).meridiem=C._meridiem,C._a[dm]=win(C._locale,C._a[dm],C._meridiem),uu=m(C).era,uu!==null&&(C._a[Bg]=C._locale.erasConvertYear(uu,C._a[Bg])),Gke(C),Wke(C)}function win(C,E,N){var F;return N==null?E:C.meridiemHour!=null?C.meridiemHour(E,N):(C.isPM!=null&&(F=C.isPM(N),F&&E<12&&(E+=12),!F&&E===12&&(E=0)),E)}function Sin(C){var E,N,F,W,de,Ae,rn=!1,ai=C._f.length;if(ai===0){m(C).invalidFormat=!0,C._d=new Date(NaN);return}for(W=0;W<ai;W++)de=0,Ae=!1,E=w({},C),C._useUTC!=null&&(E._useUTC=C._useUTC),E._f=C._f[W],Xke(E),y(E)&&(Ae=!0),de+=m(E).charsLeftOver,de+=m(E).unusedTokens.length*10,m(E).score=de,rn?de<F&&(F=de,N=E):(F==null||de<F||Ae)&&(F=de,N=E,Ae&&(rn=!0));d(C,N||E)}function Cin(C){if(!C._d){var E=Tr(C._i),N=E.day===void 0?E.date:E.day;C._a=c([E.year,E.month,N,E.hour,E.minute,E.second,E.millisecond],function(F){return F&&parseInt(F,10)}),Gke(C)}}function xin(C){var E=new O(Wke(swt(C)));return E._nextDay&&(E.add(1,"d"),E._nextDay=void 0),E}function swt(C){var E=C._i,N=C._f;return C._locale=C._locale||FA(C._l),E===null||N===void 0&&E===""?g({nullInput:!0}):(typeof E=="string"&&(C._i=E=C._locale.preparse(E)),T(E)?new O(Wke(E)):(l(E)?C._d=E:n(N)?Sin(C):N?Xke(C):Oin(C),y(C)||(C._d=null),C))}function Oin(C){var E=C._i;s(E)?C._d=new Date(e.now()):l(E)?C._d=new Date(E.valueOf()):typeof E=="string"?bin(C):n(E)?(C._a=c(E.slice(0),function(N){return parseInt(N,10)}),Gke(C)):o(E)?Cin(C):u(E)?C._d=new Date(E):e.createFromInputFallback(C)}function uwt(C,E,N,F,W){var de={};return(E===!0||E===!1)&&(F=E,E=void 0),(N===!0||N===!1)&&(F=N,N=void 0),(o(C)&&a(C)||n(C)&&C.length===0)&&(C=void 0),de._isAMomentObject=!0,de._useUTC=de._isUTC=W,de._l=N,de._i=C,de._f=E,de._strict=F,xin(de)}function nl(C,E,N,F){return uwt(C,E,N,F,!1)}var Tin=M("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var C=nl.apply(null,arguments);return this.isValid()&&C.isValid()?C<this?this:C:g()}),Ein=M("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var C=nl.apply(null,arguments);return this.isValid()&&C.isValid()?C>this?this:C:g()});function lwt(C,E){var N,F;if(E.length===1&&n(E[0])&&(E=E[0]),!E.length)return nl();for(N=E[0],F=1;F<E.length;++F)(!E[F].isValid()||E[F][C](N))&&(N=E[F]);return N}function Pin(){var C=[].slice.call(arguments,0);return lwt("isBefore",C)}function Min(){var C=[].slice.call(arguments,0);return lwt("isAfter",C)}var Iin=function(){return Date.now?Date.now():+new Date},PY=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Rin(C){var E,N=!1,F,W=PY.length;for(E in C)if(i(C,E)&&!(qc.call(PY,E)!==-1&&(C[E]==null||!isNaN(C[E]))))return!1;for(F=0;F<W;++F)if(C[PY[F]]){if(N)return!1;parseFloat(C[PY[F]])!==ke(C[PY[F]])&&(N=!0)}return!0}function Ain(){return this._isValid}function Nin(){return z0(NaN)}function Dfe(C){var E=Tr(C),N=E.year||0,F=E.quarter||0,W=E.month||0,de=E.week||E.isoWeek||0,Ae=E.day||0,rn=E.hour||0,ai=E.minute||0,uu=E.second||0,Hy=E.millisecond||0;this._isValid=Rin(E),this._milliseconds=+Hy+uu*1e3+ai*6e4+rn*1e3*60*60,this._days=+Ae+de*7,this._months=+W+F*3+N*12,this._data={},this._locale=FA(),this._bubble()}function $fe(C){return C instanceof Dfe}function Zke(C){return C<0?Math.round(-1*C)*-1:Math.round(C)}function jin(C,E,N){var F=Math.min(C.length,E.length),W=Math.abs(C.length-E.length),de=0,Ae;for(Ae=0;Ae<F;Ae++)(N&&C[Ae]!==E[Ae]||!N&&ke(C[Ae])!==ke(E[Ae]))&&de++;return de+W}function cwt(C,E){$(C,0,0,function(){var N=this.utcOffset(),F="+";return N<0&&(N=-N,F="-"),F+oe(~~(N/60),2)+E+oe(~~N%60,2)})}cwt("Z",":"),cwt("ZZ",""),Ee("Z",Ol),Ee("ZZ",Ol),gi(["Z","ZZ"],function(C,E,N){N._useUTC=!0,N._tzm=Yke(Ol,C)});var Din=/([\+\-]|\d\d)/gi;function Yke(C,E){var N=(E||"").match(C),F,W,de;return N===null?null:(F=N[N.length-1]||[],W=(F+"").match(Din)||["-",0,0],de=+(W[1]*60)+ke(W[2]),de===0?0:W[0]==="+"?de:-de)}function Qke(C,E){var N,F;return E._isUTC?(N=E.clone(),F=(T(C)||l(C)?C.valueOf():nl(C).valueOf())-N.valueOf(),N._d.setTime(N._d.valueOf()+F),e.updateOffset(N,!1),N):nl(C).local()}function eqe(C){return-Math.round(C._d.getTimezoneOffset())}e.updateOffset=function(){};function $in(C,E,N){var F=this._offset||0,W;if(!this.isValid())return C!=null?this:NaN;if(C!=null){if(typeof C=="string"){if(C=Yke(Ol,C),C===null)return this}else Math.abs(C)<16&&!N&&(C=C*60);return!this._isUTC&&E&&(W=eqe(this)),this._offset=C,this._isUTC=!0,W!=null&&this.add(W,"m"),F!==C&&(!E||this._changeInProgress?mwt(this,z0(C-F,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?F:eqe(this)}function Lin(C,E){return C!=null?(typeof C!="string"&&(C=-C),this.utcOffset(C,E),this):-this.utcOffset()}function Fin(C){return this.utcOffset(0,C)}function kin(C){return this._isUTC&&(this.utcOffset(0,C),this._isUTC=!1,C&&this.subtract(eqe(this),"m")),this}function qin(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var C=Yke(rl,this._i);C!=null?this.utcOffset(C):this.utcOffset(0,!0)}return this}function Uin(C){return this.isValid()?(C=C?nl(C).utcOffset():0,(this.utcOffset()-C)%60===0):!1}function Bin(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function zin(){if(!s(this._isDSTShifted))return this._isDSTShifted;var C={},E;return w(C,this),C=swt(C),C._a?(E=C._isUTC?f(C._a):nl(C._a),this._isDSTShifted=this.isValid()&&jin(C._a,E.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Vin(){return this.isValid()?!this._isUTC:!1}function Hin(){return this.isValid()?this._isUTC:!1}function dwt(){return this.isValid()?this._isUTC&&this._offset===0:!1}var Jin=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Win=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function z0(C,E){var N=C,F=null,W,de,Ae;return $fe(C)?N={ms:C._milliseconds,d:C._days,M:C._months}:u(C)||!isNaN(+C)?(N={},E?N[E]=+C:N.milliseconds=+C):(F=Jin.exec(C))?(W=F[1]==="-"?-1:1,N={y:0,d:ke(F[Xx])*W,h:ke(F[dm])*W,m:ke(F[B0])*W,s:ke(F[$A])*W,ms:ke(Zke(F[MB]*1e3))*W}):(F=Win.exec(C))?(W=F[1]==="-"?-1:1,N={y:IB(F[2],W),M:IB(F[3],W),w:IB(F[4],W),d:IB(F[5],W),h:IB(F[6],W),m:IB(F[7],W),s:IB(F[8],W)}):N==null?N={}:typeof N=="object"&&("from"in N||"to"in N)&&(Ae=Kin(nl(N.from),nl(N.to)),N={},N.ms=Ae.milliseconds,N.M=Ae.months),de=new Dfe(N),$fe(C)&&i(C,"_locale")&&(de._locale=C._locale),$fe(C)&&i(C,"_isValid")&&(de._isValid=C._isValid),de}z0.fn=Dfe.prototype,z0.invalid=Nin;function IB(C,E){var N=C&&parseFloat(C.replace(",","."));return(isNaN(N)?0:N)*E}function fwt(C,E){var N={};return N.months=E.month()-C.month()+(E.year()-C.year())*12,C.clone().add(N.months,"M").isAfter(E)&&--N.months,N.milliseconds=+E-+C.clone().add(N.months,"M"),N}function Kin(C,E){var N;return C.isValid()&&E.isValid()?(E=Qke(E,C),C.isBefore(E)?N=fwt(C,E):(N=fwt(E,C),N.milliseconds=-N.milliseconds,N.months=-N.months),N):{milliseconds:0,months:0}}function pwt(C,E){return function(N,F){var W,de;return F!==null&&!isNaN(+F)&&(j(E,"moment()."+E+"(period, number) is deprecated. Please use moment()."+E+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),de=N,N=F,F=de),W=z0(N,F),mwt(this,W,C),this}}function mwt(C,E,N,F){var W=E._milliseconds,de=Zke(E._days),Ae=Zke(E._months);C.isValid()&&(F=F??!0,Ae&&Gvt(C,Eo(C,"Month")+Ae*N),de&&xl(C,"Date",Eo(C,"Date")+de*N),W&&C._d.setTime(C._d.valueOf()+W*N),F&&e.updateOffset(C,de||Ae))}var Gin=pwt(1,"add"),Xin=pwt(-1,"subtract");function hwt(C){return typeof C=="string"||C instanceof String}function Zin(C){return T(C)||l(C)||hwt(C)||u(C)||Qin(C)||Yin(C)||C===null||C===void 0}function Yin(C){var E=o(C)&&!a(C),N=!1,F=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],W,de,Ae=F.length;for(W=0;W<Ae;W+=1)de=F[W],N=N||i(C,de);return E&&N}function Qin(C){var E=n(C),N=!1;return E&&(N=C.filter(function(F){return!u(F)&&hwt(C)}).length===0),E&&N}function ean(C){var E=o(C)&&!a(C),N=!1,F=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],W,de;for(W=0;W<F.length;W+=1)de=F[W],N=N||i(C,de);return E&&N}function tan(C,E){var N=C.diff(E,"days",!0);return N<-6?"sameElse":N<-1?"lastWeek":N<0?"lastDay":N<1?"sameDay":N<2?"nextDay":N<7?"nextWeek":"sameElse"}function ran(C,E){arguments.length===1&&(arguments[0]?Zin(arguments[0])?(C=arguments[0],E=void 0):ean(arguments[0])&&(E=arguments[0],C=void 0):(C=void 0,E=void 0));var N=C||nl(),F=Qke(N,this).startOf("day"),W=e.calendarFormat(this,F)||"sameElse",de=E&&(A(E[W])?E[W].call(this,N):E[W]);return this.format(de||this.localeData().calendar(W,this,nl(N)))}function nan(){return new O(this)}function oan(C,E){var N=T(C)?C:nl(C);return this.isValid()&&N.isValid()?(E=Ne(E)||"millisecond",E==="millisecond"?this.valueOf()>N.valueOf():N.valueOf()<this.clone().startOf(E).valueOf()):!1}function ian(C,E){var N=T(C)?C:nl(C);return this.isValid()&&N.isValid()?(E=Ne(E)||"millisecond",E==="millisecond"?this.valueOf()<N.valueOf():this.clone().endOf(E).valueOf()<N.valueOf()):!1}function aan(C,E,N,F){var W=T(C)?C:nl(C),de=T(E)?E:nl(E);return this.isValid()&&W.isValid()&&de.isValid()?(F=F||"()",(F[0]==="("?this.isAfter(W,N):!this.isBefore(W,N))&&(F[1]===")"?this.isBefore(de,N):!this.isAfter(de,N))):!1}function san(C,E){var N=T(C)?C:nl(C),F;return this.isValid()&&N.isValid()?(E=Ne(E)||"millisecond",E==="millisecond"?this.valueOf()===N.valueOf():(F=N.valueOf(),this.clone().startOf(E).valueOf()<=F&&F<=this.clone().endOf(E).valueOf())):!1}function uan(C,E){return this.isSame(C,E)||this.isAfter(C,E)}function lan(C,E){return this.isSame(C,E)||this.isBefore(C,E)}function can(C,E,N){var F,W,de;if(!this.isValid())return NaN;if(F=Qke(C,this),!F.isValid())return NaN;switch(W=(F.utcOffset()-this.utcOffset())*6e4,E=Ne(E),E){case"year":de=Lfe(this,F)/12;break;case"month":de=Lfe(this,F);break;case"quarter":de=Lfe(this,F)/3;break;case"second":de=(this-F)/1e3;break;case"minute":de=(this-F)/6e4;break;case"hour":de=(this-F)/36e5;break;case"day":de=(this-F-W)/864e5;break;case"week":de=(this-F-W)/6048e5;break;default:de=this-F}return N?de:We(de)}function Lfe(C,E){if(C.date()<E.date())return-Lfe(E,C);var N=(E.year()-C.year())*12+(E.month()-C.month()),F=C.clone().add(N,"months"),W,de;return E-F<0?(W=C.clone().add(N-1,"months"),de=(E-F)/(F-W)):(W=C.clone().add(N+1,"months"),de=(E-F)/(W-F)),-(N+de)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function dan(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function fan(C){if(!this.isValid())return null;var E=C!==!0,N=E?this.clone().utc():this;return N.year()<0||N.year()>9999?D(N,E?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):A(Date.prototype.toISOString)?E?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",D(N,"Z")):D(N,E?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function pan(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var C="moment",E="",N,F,W,de;return this.isLocal()||(C=this.utcOffset()===0?"moment.utc":"moment.parseZone",E="Z"),N="["+C+'("]',F=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",W="-MM-DD[T]HH:mm:ss.SSS",de=E+'[")]',this.format(N+F+W+de)}function man(C){C||(C=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var E=D(this,C);return this.localeData().postformat(E)}function han(C,E){return this.isValid()&&(T(C)&&C.isValid()||nl(C).isValid())?z0({to:this,from:C}).locale(this.locale()).humanize(!E):this.localeData().invalidDate()}function gan(C){return this.from(nl(),C)}function yan(C,E){return this.isValid()&&(T(C)&&C.isValid()||nl(C).isValid())?z0({from:this,to:C}).locale(this.locale()).humanize(!E):this.localeData().invalidDate()}function ban(C){return this.to(nl(),C)}function gwt(C){var E;return C===void 0?this._locale._abbr:(E=FA(C),E!=null&&(this._locale=E),this)}var ywt=M("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 bwt(){return this._locale}var Ffe=1e3,U3=60*Ffe,kfe=60*U3,_wt=(365*400+97)*24*kfe;function B3(C,E){return(C%E+E)%E}function vwt(C,E,N){return C<100&&C>=0?new Date(C+400,E,N)-_wt:new Date(C,E,N).valueOf()}function wwt(C,E,N){return C<100&&C>=0?Date.UTC(C+400,E,N)-_wt:Date.UTC(C,E,N)}function _an(C){var E,N;if(C=Ne(C),C===void 0||C==="millisecond"||!this.isValid())return this;switch(N=this._isUTC?wwt:vwt,C){case"year":E=N(this.year(),0,1);break;case"quarter":E=N(this.year(),this.month()-this.month()%3,1);break;case"month":E=N(this.year(),this.month(),1);break;case"week":E=N(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":E=N(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":E=N(this.year(),this.month(),this.date());break;case"hour":E=this._d.valueOf(),E-=B3(E+(this._isUTC?0:this.utcOffset()*U3),kfe);break;case"minute":E=this._d.valueOf(),E-=B3(E,U3);break;case"second":E=this._d.valueOf(),E-=B3(E,Ffe);break}return this._d.setTime(E),e.updateOffset(this,!0),this}function van(C){var E,N;if(C=Ne(C),C===void 0||C==="millisecond"||!this.isValid())return this;switch(N=this._isUTC?wwt:vwt,C){case"year":E=N(this.year()+1,0,1)-1;break;case"quarter":E=N(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":E=N(this.year(),this.month()+1,1)-1;break;case"week":E=N(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":E=N(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":E=N(this.year(),this.month(),this.date()+1)-1;break;case"hour":E=this._d.valueOf(),E+=kfe-B3(E+(this._isUTC?0:this.utcOffset()*U3),kfe)-1;break;case"minute":E=this._d.valueOf(),E+=U3-B3(E,U3)-1;break;case"second":E=this._d.valueOf(),E+=Ffe-B3(E,Ffe)-1;break}return this._d.setTime(E),e.updateOffset(this,!0),this}function wan(){return this._d.valueOf()-(this._offset||0)*6e4}function San(){return Math.floor(this.valueOf()/1e3)}function Can(){return new Date(this.valueOf())}function xan(){var C=this;return[C.year(),C.month(),C.date(),C.hour(),C.minute(),C.second(),C.millisecond()]}function Oan(){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 Tan(){return this.isValid()?this.toISOString():null}function Ean(){return y(this)}function Pan(){return d({},m(this))}function Man(){return m(this).overflow}function Ian(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}$("N",0,0,"eraAbbr"),$("NN",0,0,"eraAbbr"),$("NNN",0,0,"eraAbbr"),$("NNNN",0,0,"eraName"),$("NNNNN",0,0,"eraNarrow"),$("y",["y",1],"yo","eraYear"),$("y",["yy",2],0,"eraYear"),$("y",["yyy",3],0,"eraYear"),$("y",["yyyy",4],0,"eraYear"),Ee("N",tqe),Ee("NN",tqe),Ee("NNN",tqe),Ee("NNNN",Uan),Ee("NNNNN",Ban),gi(["N","NN","NNN","NNNN","NNNNN"],function(C,E,N,F){var W=N._locale.erasParse(C,F,N._strict);W?m(N).era=W:m(N).invalidEra=C}),Ee("y",Pi),Ee("yy",Pi),Ee("yyy",Pi),Ee("yyyy",Pi),Ee("yo",zan),gi(["y","yy","yyy","yyyy"],Bg),gi(["yo"],function(C,E,N,F){var W;N._locale._eraYearOrdinalRegex&&(W=C.match(N._locale._eraYearOrdinalRegex)),N._locale.eraYearOrdinalParse?E[Bg]=N._locale.eraYearOrdinalParse(C,W):E[Bg]=parseInt(C,10)});function Ran(C,E){var N,F,W,de=this._eras||FA("en")._eras;for(N=0,F=de.length;N<F;++N){switch(typeof de[N].since){case"string":W=e(de[N].since).startOf("day"),de[N].since=W.valueOf();break}switch(typeof de[N].until){case"undefined":de[N].until=1/0;break;case"string":W=e(de[N].until).startOf("day").valueOf(),de[N].until=W.valueOf();break}}return de}function Aan(C,E,N){var F,W,de=this.eras(),Ae,rn,ai;for(C=C.toUpperCase(),F=0,W=de.length;F<W;++F)if(Ae=de[F].name.toUpperCase(),rn=de[F].abbr.toUpperCase(),ai=de[F].narrow.toUpperCase(),N)switch(E){case"N":case"NN":case"NNN":if(rn===C)return de[F];break;case"NNNN":if(Ae===C)return de[F];break;case"NNNNN":if(ai===C)return de[F];break}else if([Ae,rn,ai].indexOf(C)>=0)return de[F]}function Nan(C,E){var N=C.since<=C.until?1:-1;return E===void 0?e(C.since).year():e(C.since).year()+(E-C.offset)*N}function jan(){var C,E,N,F=this.localeData().eras();for(C=0,E=F.length;C<E;++C)if(N=this.clone().startOf("day").valueOf(),F[C].since<=N&&N<=F[C].until||F[C].until<=N&&N<=F[C].since)return F[C].name;return""}function Dan(){var C,E,N,F=this.localeData().eras();for(C=0,E=F.length;C<E;++C)if(N=this.clone().startOf("day").valueOf(),F[C].since<=N&&N<=F[C].until||F[C].until<=N&&N<=F[C].since)return F[C].narrow;return""}function $an(){var C,E,N,F=this.localeData().eras();for(C=0,E=F.length;C<E;++C)if(N=this.clone().startOf("day").valueOf(),F[C].since<=N&&N<=F[C].until||F[C].until<=N&&N<=F[C].since)return F[C].abbr;return""}function Lan(){var C,E,N,F,W=this.localeData().eras();for(C=0,E=W.length;C<E;++C)if(N=W[C].since<=W[C].until?1:-1,F=this.clone().startOf("day").valueOf(),W[C].since<=F&&F<=W[C].until||W[C].until<=F&&F<=W[C].since)return(this.year()-e(W[C].since).year())*N+W[C].offset;return this.year()}function Fan(C){return i(this,"_erasNameRegex")||rqe.call(this),C?this._erasNameRegex:this._erasRegex}function kan(C){return i(this,"_erasAbbrRegex")||rqe.call(this),C?this._erasAbbrRegex:this._erasRegex}function qan(C){return i(this,"_erasNarrowRegex")||rqe.call(this),C?this._erasNarrowRegex:this._erasRegex}function tqe(C,E){return E.erasAbbrRegex(C)}function Uan(C,E){return E.erasNameRegex(C)}function Ban(C,E){return E.erasNarrowRegex(C)}function zan(C,E){return E._eraYearOrdinalRegex||Pi}function rqe(){var C=[],E=[],N=[],F=[],W,de,Ae=this.eras();for(W=0,de=Ae.length;W<de;++W)E.push(is(Ae[W].name)),C.push(is(Ae[W].abbr)),N.push(is(Ae[W].narrow)),F.push(is(Ae[W].name)),F.push(is(Ae[W].abbr)),F.push(is(Ae[W].narrow));this._erasRegex=new RegExp("^("+F.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+E.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+C.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+N.join("|")+")","i")}$(0,["gg",2],0,function(){return this.weekYear()%100}),$(0,["GG",2],0,function(){return this.isoWeekYear()%100});function qfe(C,E){$(0,[C,C.length],0,E)}qfe("gggg","weekYear"),qfe("ggggg","weekYear"),qfe("GGGG","isoWeekYear"),qfe("GGGGG","isoWeekYear"),Nt("weekYear","gg"),Nt("isoWeekYear","GG"),Le("weekYear",1),Le("isoWeekYear",1),Ee("G",tl),Ee("g",tl),Ee("GG",zi,Fs),Ee("gg",zi,Fs),Ee("GGGG",Ei,Jh),Ee("gggg",Ei,Jh),Ee("GGGGG",tu,Mw),Ee("ggggg",tu,Mw),U0(["gggg","ggggg","GGGG","GGGGG"],function(C,E,N,F){E[F.substr(0,2)]=ke(C)}),U0(["gg","GG"],function(C,E,N,F){E[F]=e.parseTwoDigitYear(C)});function Van(C){return Swt.call(this,C,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Han(C){return Swt.call(this,C,this.isoWeek(),this.isoWeekday(),1,4)}function Jan(){return LA(this.year(),1,4)}function Wan(){return LA(this.isoWeekYear(),1,4)}function Kan(){var C=this.localeData()._week;return LA(this.year(),C.dow,C.doy)}function Gan(){var C=this.localeData()._week;return LA(this.weekYear(),C.dow,C.doy)}function Swt(C,E,N,F,W){var de;return C==null?OY(this,F,W).year:(de=LA(C,F,W),E>de&&(E=de),Xan.call(this,C,E,N,F,W))}function Xan(C,E,N,F,W){var de=Qvt(C,E,N,F,W),Ae=xY(de.year,0,de.dayOfYear);return this.year(Ae.getUTCFullYear()),this.month(Ae.getUTCMonth()),this.date(Ae.getUTCDate()),this}$("Q",0,"Qo","quarter"),Nt("quarter","Q"),Le("quarter",7),Ee("Q",Gm),gi("Q",function(C,E){E[DA]=(ke(C)-1)*3});function Zan(C){return C==null?Math.ceil((this.month()+1)/3):this.month((C-1)*3+this.month()%3)}$("D",["DD",2],"Do","date"),Nt("date","D"),Le("date",9),Ee("D",zi),Ee("DD",zi,Fs),Ee("Do",function(C,E){return C?E._dayOfMonthOrdinalParse||E._ordinalParse:E._dayOfMonthOrdinalParseLenient}),gi(["D","DD"],Xx),gi("Do",function(C,E){E[Xx]=ke(C.match(zi)[0])});var Cwt=Lt("Date",!0);$("DDD",["DDDD",3],"DDDo","dayOfYear"),Nt("dayOfYear","DDD"),Le("dayOfYear",4),Ee("DDD",Ti),Ee("DDDD",Vb),gi(["DDD","DDDD"],function(C,E,N){N._dayOfYear=ke(C)});function Yan(C){var E=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return C==null?E:this.add(C-E,"d")}$("m",["mm",2],0,"minute"),Nt("minute","m"),Le("minute",14),Ee("m",zi),Ee("mm",zi,Fs),gi(["m","mm"],B0);var Qan=Lt("Minutes",!1);$("s",["ss",2],0,"second"),Nt("second","s"),Le("second",15),Ee("s",zi),Ee("ss",zi,Fs),gi(["s","ss"],$A);var esn=Lt("Seconds",!1);$("S",0,0,function(){return~~(this.millisecond()/100)}),$(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),$(0,["SSS",3],0,"millisecond"),$(0,["SSSS",4],0,function(){return this.millisecond()*10}),$(0,["SSSSS",5],0,function(){return this.millisecond()*100}),$(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),$(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),$(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),$(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),Nt("millisecond","ms"),Le("millisecond",16),Ee("S",Ti,Gm),Ee("SS",Ti,Fs),Ee("SSS",Ti,Vb);var N$,xwt;for(N$="SSSS";N$.length<=9;N$+="S")Ee(N$,Pi);function tsn(C,E){E[MB]=ke(("0."+C)*1e3)}for(N$="S";N$.length<=9;N$+="S")gi(N$,tsn);xwt=Lt("Milliseconds",!1),$("z",0,0,"zoneAbbr"),$("zz",0,0,"zoneName");function rsn(){return this._isUTC?"UTC":""}function nsn(){return this._isUTC?"Coordinated Universal Time":""}var lt=O.prototype;lt.add=Gin,lt.calendar=ran,lt.clone=nan,lt.diff=can,lt.endOf=van,lt.format=man,lt.from=han,lt.fromNow=gan,lt.to=yan,lt.toNow=ban,lt.get=In,lt.invalidAt=Man,lt.isAfter=oan,lt.isBefore=ian,lt.isBetween=aan,lt.isSame=san,lt.isSameOrAfter=uan,lt.isSameOrBefore=lan,lt.isValid=Ean,lt.lang=ywt,lt.locale=gwt,lt.localeData=bwt,lt.max=Ein,lt.min=Tin,lt.parsingFlags=Pan,lt.set=hi,lt.startOf=_an,lt.subtract=Xin,lt.toArray=xan,lt.toObject=Oan,lt.toDate=Can,lt.toISOString=fan,lt.inspect=pan,typeof Symbol<"u"&&Symbol.for!=null&&(lt[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),lt.toJSON=Tan,lt.toString=dan,lt.unix=San,lt.valueOf=wan,lt.creationData=Ian,lt.eraName=jan,lt.eraNarrow=Dan,lt.eraAbbr=$an,lt.eraYear=Lan,lt.year=Yvt,lt.isLeapYear=Oon,lt.weekYear=Van,lt.isoWeekYear=Han,lt.quarter=lt.quarters=Zan,lt.month=Xvt,lt.daysInMonth=Son,lt.week=lt.weeks=Ron,lt.isoWeek=lt.isoWeeks=Aon,lt.weeksInYear=Kan,lt.weeksInWeekYear=Gan,lt.isoWeeksInYear=Jan,lt.isoWeeksInISOWeekYear=Wan,lt.date=Cwt,lt.day=lt.days=Hon,lt.weekday=Jon,lt.isoWeekday=Won,lt.dayOfYear=Yan,lt.hour=lt.hours=ein,lt.minute=lt.minutes=Qan,lt.second=lt.seconds=esn,lt.millisecond=lt.milliseconds=xwt,lt.utcOffset=$in,lt.utc=Fin,lt.local=kin,lt.parseZone=qin,lt.hasAlignedHourOffset=Uin,lt.isDST=Bin,lt.isLocal=Vin,lt.isUtcOffset=Hin,lt.isUtc=dwt,lt.isUTC=dwt,lt.zoneAbbr=rsn,lt.zoneName=nsn,lt.dates=M("dates accessor is deprecated. Use date instead.",Cwt),lt.months=M("months accessor is deprecated. Use month instead",Xvt),lt.years=M("years accessor is deprecated. Use year instead",Yvt),lt.zone=M("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Lin),lt.isDSTShifted=M("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",zin);function osn(C){return nl(C*1e3)}function isn(){return nl.apply(null,arguments).parseZone()}function Owt(C){return C}var as=q.prototype;as.calendar=ue,as.longDateFormat=U,as.invalidDate=ce,as.ordinal=Je,as.preparse=Owt,as.postformat=Owt,as.relativeTime=Ke,as.pastFuture=dt,as.set=k,as.eras=Ran,as.erasParse=Aan,as.erasConvertYear=Nan,as.erasAbbrRegex=kan,as.erasNameRegex=Fan,as.erasNarrowRegex=qan,as.months=bon,as.monthsShort=_on,as.monthsParse=won,as.monthsRegex=xon,as.monthsShortRegex=Con,as.week=Eon,as.firstDayOfYear=Ion,as.firstDayOfWeek=Mon,as.weekdays=qon,as.weekdaysMin=Bon,as.weekdaysShort=Uon,as.weekdaysParse=Von,as.weekdaysRegex=Kon,as.weekdaysShortRegex=Gon,as.weekdaysMinRegex=Xon,as.isPM=Yon,as.meridiem=tin;function Ufe(C,E,N,F){var W=FA(),de=f().set(F,E);return W[N](de,C)}function Twt(C,E,N){if(u(C)&&(E=C,C=void 0),C=C||"",E!=null)return Ufe(C,E,N,"month");var F,W=[];for(F=0;F<12;F++)W[F]=Ufe(C,F,N,"month");return W}function nqe(C,E,N,F){typeof C=="boolean"?(u(E)&&(N=E,E=void 0),E=E||""):(E=C,N=E,C=!1,u(E)&&(N=E,E=void 0),E=E||"");var W=FA(),de=C?W._week.dow:0,Ae,rn=[];if(N!=null)return Ufe(E,(N+de)%7,F,"day");for(Ae=0;Ae<7;Ae++)rn[Ae]=Ufe(E,(Ae+de)%7,F,"day");return rn}function asn(C,E){return Twt(C,E,"months")}function ssn(C,E){return Twt(C,E,"monthsShort")}function usn(C,E,N){return nqe(C,E,N,"weekdays")}function lsn(C,E,N){return nqe(C,E,N,"weekdaysShort")}function csn(C,E,N){return nqe(C,E,N,"weekdaysMin")}A$("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 E=C%10,N=ke(C%100/10)===1?"th":E===1?"st":E===2?"nd":E===3?"rd":"th";return C+N}}),e.lang=M("moment.lang is deprecated. Use moment.locale instead.",A$),e.langData=M("moment.langData is deprecated. Use moment.localeData instead.",FA);var kA=Math.abs;function dsn(){var C=this._data;return this._milliseconds=kA(this._milliseconds),this._days=kA(this._days),this._months=kA(this._months),C.milliseconds=kA(C.milliseconds),C.seconds=kA(C.seconds),C.minutes=kA(C.minutes),C.hours=kA(C.hours),C.months=kA(C.months),C.years=kA(C.years),this}function Ewt(C,E,N,F){var W=z0(E,N);return C._milliseconds+=F*W._milliseconds,C._days+=F*W._days,C._months+=F*W._months,C._bubble()}function fsn(C,E){return Ewt(this,C,E,1)}function psn(C,E){return Ewt(this,C,E,-1)}function Pwt(C){return C<0?Math.floor(C):Math.ceil(C)}function msn(){var C=this._milliseconds,E=this._days,N=this._months,F=this._data,W,de,Ae,rn,ai;return C>=0&&E>=0&&N>=0||C<=0&&E<=0&&N<=0||(C+=Pwt(oqe(N)+E)*864e5,E=0,N=0),F.milliseconds=C%1e3,W=We(C/1e3),F.seconds=W%60,de=We(W/60),F.minutes=de%60,Ae=We(de/60),F.hours=Ae%24,E+=We(Ae/24),ai=We(Mwt(E)),N+=ai,E-=Pwt(oqe(ai)),rn=We(N/12),N%=12,F.days=E,F.months=N,F.years=rn,this}function Mwt(C){return C*4800/146097}function oqe(C){return C*146097/4800}function hsn(C){if(!this.isValid())return NaN;var E,N,F=this._milliseconds;if(C=Ne(C),C==="month"||C==="quarter"||C==="year")switch(E=this._days+F/864e5,N=this._months+Mwt(E),C){case"month":return N;case"quarter":return N/3;case"year":return N/12}else switch(E=this._days+Math.round(oqe(this._months)),C){case"week":return E/7+F/6048e5;case"day":return E+F/864e5;case"hour":return E*24+F/36e5;case"minute":return E*1440+F/6e4;case"second":return E*86400+F/1e3;case"millisecond":return Math.floor(E*864e5)+F;default:throw new Error("Unknown unit "+C)}}function gsn(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+ke(this._months/12)*31536e6:NaN}function qA(C){return function(){return this.as(C)}}var ysn=qA("ms"),bsn=qA("s"),_sn=qA("m"),vsn=qA("h"),wsn=qA("d"),Ssn=qA("w"),Csn=qA("M"),xsn=qA("Q"),Osn=qA("y");function Tsn(){return z0(this)}function Esn(C){return C=Ne(C),this.isValid()?this[C+"s"]():NaN}function RB(C){return function(){return this.isValid()?this._data[C]:NaN}}var Psn=RB("milliseconds"),Msn=RB("seconds"),Isn=RB("minutes"),Rsn=RB("hours"),Asn=RB("days"),Nsn=RB("months"),jsn=RB("years");function Dsn(){return We(this.days()/7)}var UA=Math.round,z3={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function $sn(C,E,N,F,W){return W.relativeTime(E||1,!!N,C,F)}function Lsn(C,E,N,F){var W=z0(C).abs(),de=UA(W.as("s")),Ae=UA(W.as("m")),rn=UA(W.as("h")),ai=UA(W.as("d")),uu=UA(W.as("M")),Hy=UA(W.as("w")),BA=UA(W.as("y")),j$=de<=N.ss&&["s",de]||de<N.s&&["ss",de]||Ae<=1&&["m"]||Ae<N.m&&["mm",Ae]||rn<=1&&["h"]||rn<N.h&&["hh",rn]||ai<=1&&["d"]||ai<N.d&&["dd",ai];return N.w!=null&&(j$=j$||Hy<=1&&["w"]||Hy<N.w&&["ww",Hy]),j$=j$||uu<=1&&["M"]||uu<N.M&&["MM",uu]||BA<=1&&["y"]||["yy",BA],j$[2]=E,j$[3]=+C>0,j$[4]=F,$sn.apply(null,j$)}function Fsn(C){return C===void 0?UA:typeof C=="function"?(UA=C,!0):!1}function ksn(C,E){return z3[C]===void 0?!1:E===void 0?z3[C]:(z3[C]=E,C==="s"&&(z3.ss=E-1),!0)}function qsn(C,E){if(!this.isValid())return this.localeData().invalidDate();var N=!1,F=z3,W,de;return typeof C=="object"&&(E=C,C=!1),typeof C=="boolean"&&(N=C),typeof E=="object"&&(F=Object.assign({},z3,E),E.s!=null&&E.ss==null&&(F.ss=E.s-1)),W=this.localeData(),de=Lsn(this,!N,F,W),N&&(de=W.pastFuture(+this,de)),W.postformat(de)}var iqe=Math.abs;function V3(C){return(C>0)-(C<0)||+C}function Bfe(){if(!this.isValid())return this.localeData().invalidDate();var C=iqe(this._milliseconds)/1e3,E=iqe(this._days),N=iqe(this._months),F,W,de,Ae,rn=this.asSeconds(),ai,uu,Hy,BA;return rn?(F=We(C/60),W=We(F/60),C%=60,F%=60,de=We(N/12),N%=12,Ae=C?C.toFixed(3).replace(/\.?0+$/,""):"",ai=rn<0?"-":"",uu=V3(this._months)!==V3(rn)?"-":"",Hy=V3(this._days)!==V3(rn)?"-":"",BA=V3(this._milliseconds)!==V3(rn)?"-":"",ai+"P"+(de?uu+de+"Y":"")+(N?uu+N+"M":"")+(E?Hy+E+"D":"")+(W||F||C?"T":"")+(W?BA+W+"H":"")+(F?BA+F+"M":"")+(C?BA+Ae+"S":"")):"P0D"}var Zi=Dfe.prototype;Zi.isValid=Ain,Zi.abs=dsn,Zi.add=fsn,Zi.subtract=psn,Zi.as=hsn,Zi.asMilliseconds=ysn,Zi.asSeconds=bsn,Zi.asMinutes=_sn,Zi.asHours=vsn,Zi.asDays=wsn,Zi.asWeeks=Ssn,Zi.asMonths=Csn,Zi.asQuarters=xsn,Zi.asYears=Osn,Zi.valueOf=gsn,Zi._bubble=msn,Zi.clone=Tsn,Zi.get=Esn,Zi.milliseconds=Psn,Zi.seconds=Msn,Zi.minutes=Isn,Zi.hours=Rsn,Zi.days=Asn,Zi.weeks=Dsn,Zi.months=Nsn,Zi.years=jsn,Zi.humanize=qsn,Zi.toISOString=Bfe,Zi.toString=Bfe,Zi.toJSON=Bfe,Zi.locale=gwt,Zi.localeData=bwt,Zi.toIsoString=M("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Bfe),Zi.lang=ywt,$("X",0,0,"unix"),$("x",0,0,"valueOf"),Ee("x",tl),Ee("X",Xm),gi("X",function(C,E,N){N._d=new Date(parseFloat(C)*1e3)}),gi("x",function(C,E,N){N._d=new Date(ke(C))});return e.version="2.29.4",r(nl),e.fn=lt,e.min=Pin,e.max=Min,e.now=Iin,e.utc=f,e.unix=osn,e.months=asn,e.isDate=l,e.locale=A$,e.invalid=g,e.duration=z0,e.isMoment=T,e.weekdays=usn,e.parseZone=isn,e.localeData=FA,e.isDuration=$fe,e.monthsShort=ssn,e.weekdaysMin=csn,e.defineLocale=Jke,e.updateLocale=iin,e.locales=ain,e.weekdaysShort=lsn,e.normalizeUnits=Ne,e.relativeTimeRounding=Fsn,e.relativeTimeThreshold=ksn,e.calendarFormat=tan,e.prototype=lt,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 wRt(t){return t in xee}function ab(t,e){let r=ae();return e?.apiKey||r[xee[t]]||""}function Ibn(){return[{name:"copilot-plus-flash",provider:"copilot-plus"},{name:"google/gemini-2.5-flash",provider:"openrouterai"}]}function age(t){return Ibn().some(e=>e.name===t.name&&e.provider===t.provider)}var pL=v(()=>{Or();ot()});var SRt={};Rn(SRt,{CustomError:()=>Ao,MissingApiKeyError:()=>Tee,MissingModelKeyError:()=>kW,MissingPlusLicenseError:()=>Pz,TimeoutError:()=>Oee});var Ao,Oee,Tee,Pz,kW,Xw=v(()=>{Ao=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}},Oee=class t extends Error{constructor(e,r){super(`${e} timed out after ${r}ms`),this.name="TimeoutError",Object.setPrototypeOf(this,t.prototype)}},Tee=class t extends Error{constructor(e="API key is not configured."){super(e),this.name="MissingApiKeyError",Object.setPrototypeOf(this,t.prototype)}},Pz=class t extends Error{constructor(e="Copilot Plus license key is not configured."){super(e),this.name="MissingPlusLicenseError",Object.setPrototypeOf(this,t.prototype)}},kW=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)}}});function cN(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return t}}function xRt(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function Abn(t){let e=xRt(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function ORt(t){let e=xRt(t);return Abn(t)?oHe.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:oHe.UNKNOWN_ERROR)}function qW(t){return t.replace(/^#/,"").trim()}function UW(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 yO(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(qW(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(qW(i))}):typeof n=="string"&&o.add(qW(n))),Array.from(o)}function sge(t,e,r){if(e.length===0)return[];e=e.map(i=>qW(i));let n=r&&r.length>0?r:Eee(t,"/"),o=[];for(let i of n){let a=yO(i);e.some(s=>a.includes(s))&&o.push(i)}return o}async function xc(t){let e=(0,ry.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 ry.TFile)throw new Error(`Path conflict: "${n}" exists as a file, expected folder.`);continue}await app.vault.adapter.mkdir(n)}}async function BW(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function uge(t){return t.basename}function bO(t){return t?Dbn.includes(t.extension):!1}function sb(t){return t==="copilot_plus"||t==="project"}function zW(t,e){return t?t.extension==="md"||t.extension==="canvas"?!0:sb(e):!1}function ERt(t,e){return!t||!e?!1:t.includes(iHe)&&e.includes(iHe)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function lge(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 PRt(t,e){let r=new Map;return t.forEach(n=>{let o=e.getAbstractFileByPath(n);if(o instanceof ry.TFile)r.set(o.path,o);else{let a=e.getMarkdownFiles().filter(s=>s.basename===n);a.length>0&&($bn(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 mL(t,e){let r=/\[\[(.*?)\]\]/g,n=t.match(r);if(!n)return[];let o=n.map(i=>i.slice(2,-2));return PRt(o,e)}function MRt(t,e){let r=/\{\[\[(.*?)\]\]\}/g,n=t.match(r);if(!n)return[];let o=n.map(i=>i.slice(3,-3));return PRt(o,e)}function $bn(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function IRt(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function RRt(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function aHe(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=sHe(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 sHe(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 ARt(t){return`https://www.youtube.com/watch?v=${t}`}function NRt(t){return aHe(t).isValid}function jRt(t){let e=t.matchAll(new RegExp(Lbn,"g"));return Array.from(e,r=>r[0])}async function Nl(t,e={}){let r=new Headers(e.headers),n=Object.fromEntries(r.entries());delete n["content-length"],B("safeFetch request");let o=e.method?.toUpperCase()||"POST",a=await(0,ry.requestUrl)({url:t,contentType:"application/json",headers:n,method:o,...["POST","PUT","PATCH"].includes(o)&&{body:e.body?.toString()},throw:!1});if(a.status>=400){let s;try{s=typeof a.json=="string"?JSON.parse(a.json):a.json}catch{try{s=typeof a.text=="string"?JSON.parse(a.text):a.text}catch{s=null}}let u=new Error(oHe.REQUEST_FAILED(a.status));if(u.json=s,s?.detail?.reason==="Invalid license key"||s?.reason==="Invalid license key")u.message="Invalid license key";else if(s?.detail?.message||s?.message){let l=s?.detail?.message||s?.message,c=s?.detail?.reason||s?.reason;u.message=c?`${l}: ${c}`:l}else s?.detail?u.message=JSON.stringify(s.detail):s&&(u.message+=". "+JSON.stringify(s));throw u}return{ok:a.status>=200&&a.status<300,status:a.status,statusText:a.status.toString(),headers:new Headers(a.headers),url:t,type:"basic",redirected:!1,bytes:()=>Promise.resolve(new Uint8Array(0)),body:Fbn(a.text),bodyUsed:!0,json:()=>a.json,text:async()=>a.text,arrayBuffer:async()=>{if(a.arrayBuffer)return a.arrayBuffer;let s=a.text.replace(/^data:.*;base64,/,""),u=atob(s),l=new Uint8Array(u.length);for(let c=0;c<u.length;c++)l[c]=u.charCodeAt(c);return l.buffer},blob:()=>{throw new Error("not implemented")},formData:()=>{throw new Error("not implemented")},clone:()=>{throw new Error("not implemented")}}}function Fbn(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function Pee(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function _O(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 dN(t){let e=rC[t];return{...e,label:e.label||t}}function tg(t,e){let r=rC[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}function cge(t){let e=t;return e=Az(e),e=e.replace(/```xml\s*[\s\S]*?<writeToFile>[\s\S]*?<\/writeToFile>[\s\S]*?```/g,""),e=e.replace(/<writeToFile>[\s\S]*?<\/writeToFile>/g,""),e=e.replace(/<!--TOOL_CALL_START:[^:]+:[^:]+:[^:]+:[^:]+:[^:]*:[^:]+-->[\s\S]*?<!--TOOL_CALL_END:[^:]+:[\s\S]*?-->/g,""),e=e.replace(/\n{3,}/g,`
|
||
|
||
`),e=e.trim(),e}async function Mz(t,e=!1){let r=app.workspace.getMostRecentLeaf();if(!r){new ry.Notice("No active leaf found.");return}if(r.view instanceof ry.MarkdownView||(r=app.workspace.getLeaf(!1),await r.setViewState({type:"markdown",state:r.view.getState()})),!(r.view instanceof ry.MarkdownView)){new ry.Notice("Failed to open a markdown view.");return}let n=r.view.editor,o=n.getCursor("from"),i=n.getCursor("to"),a=cge(t);e?n.replaceRange(a,o,i):n.replaceRange(a,i),new ry.Notice("Message inserted into the active note.")}function dge(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function fge(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 DRt(){try{return{version:(await(0,ry.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 Mee(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 kbn(t){return typeof t=="string"?t.startsWith("gpt-5"):(t.modelName||t.model||"").startsWith("gpt-5")}function VW(t){let e=typeof t=="string"?t:t.modelName||t.model||"",r=Mee(e),n=kbn(e),o=e.startsWith("claude-3-7-sonnet")||e.startsWith("claude-sonnet-4");return{isOSeries:r,isGPT5:n,isThinkingEnabled:o}}function Iz(t,e="system"){return Mee(t)?"human":e}function uHe(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","github-copilot","copilot-plus","copilot-plus-jina"];return Object.keys(rC).filter(e=>!t.includes(e))}function HW(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=!!uHe().find(o=>o===t.provider),n=!ab(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 Rz(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function Az(t){let r=Rz(t).replace(/<think>[\s\S]*?<\/think>/g,"");return r=r.replace(/<think>[\s\S]*$/g,""),r.trim()}function JW(t){return Rz(t).replace(/<errorChunk>[\s\S]*?<\/errorChunk>/g,"").trim()}function $Rt(){return crypto.randomUUID()}async function rh(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 pge(t,e,r="Operation"){let{TimeoutError:n}=await Promise.resolve().then(()=>(Xw(),SRt)),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 lHe(){let t=app.workspace.getActiveViewOfType(ry.MarkdownView);return t?t.getState().source===!0:!0}function Iee(t){return new TextEncoder().encode(t).length}function cHe(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}async function LRt(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 CRt,ry,oHe,Eee,Nbn,jbn,TRt,eg,Dbn,Lbn,Zt=v(()=>{Bc();Or();_t();CRt=L(vRt()),ry=require("obsidian");pL();tHe();oHe={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}`};Eee=(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})};Nbn=t=>t.last?.modelName||t.last?.model,jbn=t=>t.last?.retriever!==void 0,TRt=t=>Nbn(t)||jbn(t),eg=(t,e="local")=>{let r=(0,CRt.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};Dbn=["md","pdf","canvas"];Lbn=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/});var WW,dHe,Ree,Bc=v(()=>{fO();wv();_v();FVe();Zt();WW=class WW{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.withConfig({signal:i?.signal}),s=Rl.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return WW.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=WW.instances.get("llm_chain");return r||(r=WW.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=lu.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=lu.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=Rl.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 Bhe,y=>{let g=Az(y),b=JW(g);return n&&console.log("Standalone Question: ",b),b}]),p=async y=>(r(y),_ee(y)),m=Rl.from([{context:i.pipe(p),question:new Eu,system_message:()=>a},c,o]);return f.pipe(m)}};WW.instances=new Map;dHe=WW,Ree=dHe});var Aee=v(()=>{});var fHe,fN,ac,Ws,nC,tC,qbn,Ubn,Bbn,zbn,eHe,kRt,qRt,Nee,n_,pHe,jee,Nz,Dee,mHe,$ee,hHe,gHe,mge,yHe,Lee,jz,bHe,_He,KW,Sv,pN,ub,r_,hL,hO,gO,Tz,iHe,rC,xee,URt,Cee,Nn,hge,GW,Di,Zw,Or=v(()=>{D$();Bc();Aee();fHe="https://api.brevilabs.com/v1",fN="https://models.brevilabs.com/v1",ac="copilot-chat-view",Ws="user",nC="ai",tC="copilot",qbn=`${tC}/copilot-conversations`,Ubn=`${tC}/copilot-custom-prompts`,Bbn=`${tC}/memory`,zbn=`${tC}/system-prompts`,eHe=tC,kRt=`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  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.`,qRt=`Return the new note content or canvas JSON in <writeToFile> 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:
|
||
<writeToFile>
|
||
<path>path/to/file.md</path>
|
||
<content>The FULL CONTENT of the note A with added section goes here</content>
|
||
</writeToFile>
|
||
|
||
Input: Create a new canvas with "Hello, world!"
|
||
Output:
|
||
<writeToFile>
|
||
<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>
|
||
</writeToFile>
|
||
|
||
Input: Create a canvas with a file node and a group
|
||
Output:
|
||
<writeToFile>
|
||
<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>
|
||
</writeToFile>
|
||
|
||
# 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.
|
||
`,Nee="note_context",n_="selected_text",pHe="web_selected_text",jee="variable",Nz="variable_note",Dee="embedded_pdf",mHe="embedded_note",$ee="dataview_block",hHe="retrieved_document",gHe="web_tab_context",mge="active_web_tab",yHe="youtube_video_context",Lee="{activeWebTab}",jz=6e3,bHe=.4,_He=448e3,KW=3e4,Sv={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree",COMPACTING:"Compacting"},pN={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},ub={MAX_TOKENS:6e3,TEMPERATURE:.1,REASONING_EFFORT:"low",VERBOSITY:"medium"},r_=(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))(r_||{}),hL={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},hO=[{name:"copilot-plus-flash",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,core:!0,plusExclusive:!0,projectEnabled:!1,capabilities:["vision"]},{name:"google/gemini-2.5-flash-lite",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"google/gemini-2.5-flash",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"google/gemini-2.5-pro",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"openai/gpt-4.1",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"openai/gpt-4.1-mini",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"grok-4-fast",provider:"xai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"x-ai/grok-4-fast",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-5",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:"gpt-4.1",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gpt-4.1-mini",provider:"openai",enabled:!0,isBuiltIn:!0,core:!0,projectEnabled:!0,capabilities:["vision"]},{name:"claude-sonnet-4-20250514",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"gemini-2.5-flash",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gemini-2.5-flash-lite",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"gemini-2.5-pro",provider:"google",enabled:!0,isBuiltIn:!0,projectEnabled:!0,capabilities:["vision"]},{name:"azure-openai",provider:"azure openai",enabled:!0,isBuiltIn:!0},{name:"deepseek-chat",provider:"deepseek",enabled:!0,isBuiltIn:!0},{name:"deepseek-reasoner",provider:"deepseek",enabled:!0,isBuiltIn:!0,capabilities:["reasoning"]},{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"]}],gO=(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))(gO||{}),Tz=[{name:"copilot-plus-small",provider:"copilot-plus",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0},{name:"copilot-plus-large",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,believerExclusive:!0,dimensions:1024},{name:"copilot-plus-multilingual",provider:"copilot-plus-jina",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0,plusExclusive:!0,dimensions:512},{name:"text-embedding-3-small",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0,core:!0},{name:"text-embedding-3-large",provider:"openai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"embed-multilingual-light-v3.0",provider:"cohereai",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"text-embedding-004",provider:"google",enabled:!0,isBuiltIn:!0,isEmbeddingModel:!0},{name:"gemini-embedding-001",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"}],iHe="nomic-embed-text",rC={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-4.1-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-20250514"},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-4.1"},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-fast"},"azure openai":{label:"Azure OpenAI",host:"",curlBaseURL:"",keyManagementURL:"",listModelURL:"",testModel:"azure-openai"},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:fN,curlBaseURL:fN,keyManagementURL:"",listModelURL:""},"copilot-plus-jina":{label:"Copilot Plus",host:fN,curlBaseURL:fN,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:""}},xee={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"},URt=["NEVER","ON STARTUP","ON MODE SWITCH"],Cee=(r=>(r.ENTER="enter",r.SHIFT_ENTER="shift+enter",r))(Cee||{}),Nn={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"},hge={[Nn.TRIGGER_QUICK_COMMAND]:"Trigger quick command",[Nn.CLEAR_LOCAL_COPILOT_INDEX]:"Clear local Copilot index",[Nn.CLEAR_COPILOT_CACHE]:"Clear Copilot cache",[Nn.COUNT_TOTAL_VAULT_TOKENS]:"Count total tokens in your vault",[Nn.COUNT_WORD_AND_TOKENS_SELECTION]:"Count words and tokens in selection",[Nn.DEBUG_WORD_COMPLETION]:"Word completion: Debug",[Nn.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX]:"Force reindex vault",[Nn.GARBAGE_COLLECT_COPILOT_INDEX]:"Garbage collect Copilot index (remove files that no longer exist in vault)",[Nn.INDEX_VAULT_TO_COPILOT_INDEX]:"Index (refresh) vault",[Nn.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS]:"Inspect Copilot index by note paths (debug)",[Nn.LIST_INDEXED_FILES]:"List all indexed files (debug)",[Nn.LOAD_COPILOT_CHAT_CONVERSATION]:"Load Copilot chat conversation",[Nn.NEW_CHAT]:"New Copilot Chat",[Nn.OPEN_COPILOT_CHAT_WINDOW]:"Open Copilot Chat Window",[Nn.REMOVE_FILES_FROM_COPILOT_INDEX]:"Remove files from Copilot index (debug)",[Nn.SEARCH_ORAMA_DB]:"Search semantic index (debug)",[Nn.TOGGLE_COPILOT_CHAT_WINDOW]:"Toggle Copilot Chat Window",[Nn.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add selection to chat context",[Nn.ADD_WEB_SELECTION_TO_CHAT_CONTEXT]:"Add web selection to chat context",[Nn.ADD_CUSTOM_COMMAND]:"Add new custom command",[Nn.APPLY_CUSTOM_COMMAND]:"Apply custom command",[Nn.OPEN_LOG_FILE]:"Create log file",[Nn.CLEAR_LOG_FILE]:"Clear log file",[Nn.DOWNLOAD_YOUTUBE_SCRIPT]:"Download YouTube Script (plus)"},GW={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.`},Di={userId:Zm(),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:"text-embedding-3-small|openai",temperature:ub.TEMPERATURE,maxTokens:ub.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:qbn,defaultConversationTag:"copilot-conversation",autosaveChat:!0,generateAIChatTitleOnSave:!0,autoAddActiveContentToContext:!0,defaultOpenArea:"view",defaultSendShortcut:"enter",customPromptsFolder:Ubn,indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:eHe,qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:15,enableInlineCitations:!0,groqApiKey:"",activeModels:hO,activeEmbeddingModels:Tz,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,enableLexicalBoosts:!0,suggestedDefaultCommands:!1,autonomousAgentMaxIterations:4,autonomousAgentEnabledToolIds:["localSearch","readNote","webSearch","pomodoro","youtubeTranscription","writeToFile","replaceInFile","updateMemory"],reasoningEffort:ub.REASONING_EFFORT,verbosity:ub.VERBOSITY,memoryFolderName:Bbn,enableRecentConversations:!0,maxRecentConversations:30,enableSavedMemory:!0,quickCommandModelKey:void 0,quickCommandIncludeNoteContext:!0,autoIncludeTextSelection:!1,autoAddSelectionToContext:!1,autoAcceptEdits:!1,diffViewMode:"split",userSystemPromptsFolder:zbn,defaultSystemPromptTitle:"",autoCompactThreshold:128e3},Zw={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var wHe=S(gge=>{"use strict";gge.byteLength=Hbn;gge.toByteArray=Wbn;gge.fromByteArray=Xbn;var vO=[],Yw=[],Vbn=typeof Uint8Array<"u"?Uint8Array:Array,vHe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Dz=0,BRt=vHe.length;Dz<BRt;++Dz)vO[Dz]=vHe[Dz],Yw[vHe.charCodeAt(Dz)]=Dz;var Dz,BRt;Yw[45]=62;Yw[95]=63;function zRt(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 Hbn(t){var e=zRt(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Jbn(t,e,r){return(e+r)*3/4-r}function Wbn(t){var e,r=zRt(t),n=r[0],o=r[1],i=new Vbn(Jbn(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=Yw[t.charCodeAt(u)]<<18|Yw[t.charCodeAt(u+1)]<<12|Yw[t.charCodeAt(u+2)]<<6|Yw[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=Yw[t.charCodeAt(u)]<<2|Yw[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=Yw[t.charCodeAt(u)]<<10|Yw[t.charCodeAt(u+1)]<<4|Yw[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function Kbn(t){return vO[t>>18&63]+vO[t>>12&63]+vO[t>>6&63]+vO[t&63]}function Gbn(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(Kbn(n));return o.join("")}function Xbn(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(Gbn(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(vO[e>>2]+vO[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(vO[e>>10]+vO[e>>4&63]+vO[e<<2&63]+"=")),o.join("")}});var VRt=S(SHe=>{SHe.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)};SHe.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 Qw=S(QW=>{"use strict";var CHe=wHe(),ZW=VRt(),HRt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;QW.Buffer=$e;QW.SlowBuffer=r_n;QW.INSPECT_MAX_BYTES=50;var yge=2147483647;QW.kMaxLength=yge;$e.TYPED_ARRAY_SUPPORT=Zbn();!$e.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 Zbn(){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($e.prototype,"parent",{enumerable:!0,get:function(){if($e.isBuffer(this))return this.buffer}});Object.defineProperty($e.prototype,"offset",{enumerable:!0,get:function(){if($e.isBuffer(this))return this.byteOffset}});function mN(t){if(t>yge)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,$e.prototype),e}function $e(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 EHe(t)}return GRt(t,e,r)}$e.poolSize=8192;function GRt(t,e,r){if(typeof t=="string")return Qbn(t,e);if(ArrayBuffer.isView(t))return e_n(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(wO(t,ArrayBuffer)||t&&wO(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(wO(t,SharedArrayBuffer)||t&&wO(t.buffer,SharedArrayBuffer)))return OHe(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 $e.from(n,e,r);let o=t_n(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $e.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)}$e.from=function(t,e,r){return GRt(t,e,r)};Object.setPrototypeOf($e.prototype,Uint8Array.prototype);Object.setPrototypeOf($e,Uint8Array);function XRt(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 Ybn(t,e,r){return XRt(t),t<=0?mN(t):e!==void 0?typeof r=="string"?mN(t).fill(e,r):mN(t).fill(e):mN(t)}$e.alloc=function(t,e,r){return Ybn(t,e,r)};function EHe(t){return XRt(t),mN(t<0?0:PHe(t)|0)}$e.allocUnsafe=function(t){return EHe(t)};$e.allocUnsafeSlow=function(t){return EHe(t)};function Qbn(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$e.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=ZRt(t,e)|0,n=mN(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function xHe(t){let e=t.length<0?0:PHe(t.length)|0,r=mN(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function e_n(t){if(wO(t,Uint8Array)){let e=new Uint8Array(t);return OHe(e.buffer,e.byteOffset,e.byteLength)}return xHe(t)}function OHe(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,$e.prototype),n}function t_n(t){if($e.isBuffer(t)){let e=PHe(t.length)|0,r=mN(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||IHe(t.length)?mN(0):xHe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return xHe(t.data)}function PHe(t){if(t>=yge)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+yge.toString(16)+" bytes");return t|0}function r_n(t){return+t!=t&&(t=0),$e.alloc(+t)}$e.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$e.prototype};$e.compare=function(e,r){if(wO(e,Uint8Array)&&(e=$e.from(e,e.offset,e.byteLength)),wO(r,Uint8Array)&&(r=$e.from(r,r.offset,r.byteLength)),!$e.isBuffer(e)||!$e.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};$e.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}};$e.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return $e.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=$e.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(wO(a,Uint8Array))i+a.length>o.length?($e.isBuffer(a)||(a=$e.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if($e.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function ZRt(t,e){if($e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||wO(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 THe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return aAt(t).length;default:if(o)return n?-1:THe(t).length;e=(""+e).toLowerCase(),o=!0}}$e.byteLength=ZRt;function n_n(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 p_n(this,e,r);case"utf8":case"utf-8":return QRt(this,e,r);case"ascii":return d_n(this,e,r);case"latin1":case"binary":return f_n(this,e,r);case"base64":return l_n(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m_n(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$e.prototype._isBuffer=!0;function $z(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}$e.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)$z(this,r,r+1);return this};$e.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)$z(this,r,r+3),$z(this,r+1,r+2);return this};$e.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)$z(this,r,r+7),$z(this,r+1,r+6),$z(this,r+2,r+5),$z(this,r+3,r+4);return this};$e.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?QRt(this,0,e):n_n.apply(this,arguments)};$e.prototype.toLocaleString=$e.prototype.toString;$e.prototype.equals=function(e){if(!$e.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:$e.compare(this,e)===0};$e.prototype.inspect=function(){let e="",r=QW.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};HRt&&($e.prototype[HRt]=$e.prototype.inspect);$e.prototype.compare=function(e,r,n,o,i){if(wO(e,Uint8Array)&&(e=$e.from(e,e.offset,e.byteLength)),!$e.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 YRt(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,IHe(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=$e.from(e,n)),$e.isBuffer(e))return e.length===0?-1:JRt(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):JRt(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function JRt(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}$e.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};$e.prototype.indexOf=function(e,r,n){return YRt(this,e,r,n,!0)};$e.prototype.lastIndexOf=function(e,r,n){return YRt(this,e,r,n,!1)};function o_n(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(IHe(s))return a;t[r+a]=s}return a}function i_n(t,e,r,n){return bge(THe(e,t.length-r),t,r,n)}function a_n(t,e,r,n){return bge(b_n(e),t,r,n)}function s_n(t,e,r,n){return bge(aAt(e),t,r,n)}function u_n(t,e,r,n){return bge(__n(e,t.length-r),t,r,n)}$e.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 o_n(this,e,r,n);case"utf8":case"utf-8":return i_n(this,e,r,n);case"ascii":case"latin1":case"binary":return a_n(this,e,r,n);case"base64":return s_n(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u_n(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};$e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function l_n(t,e,r){return e===0&&r===t.length?CHe.fromByteArray(t):CHe.fromByteArray(t.slice(e,r))}function QRt(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 c_n(n)}var WRt=4096;function c_n(t){let e=t.length;if(e<=WRt)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=WRt));return r}function d_n(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 f_n(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 p_n(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+=v_n[t[i]];return o}function m_n(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}$e.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,$e.prototype),o};function nh(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")}$e.prototype.readUintLE=$e.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||nh(e,r,this.length);let o=this[e],i=1,a=0;for(;++a<r&&(i*=256);)o+=this[e+a]*i;return o};$e.prototype.readUintBE=$e.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||nh(e,r,this.length);let o=this[e+--r],i=1;for(;r>0&&(i*=256);)o+=this[e+--r]*i;return o};$e.prototype.readUint8=$e.prototype.readUInt8=function(e,r){return e=e>>>0,r||nh(e,1,this.length),this[e]};$e.prototype.readUint16LE=$e.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||nh(e,2,this.length),this[e]|this[e+1]<<8};$e.prototype.readUint16BE=$e.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||nh(e,2,this.length),this[e]<<8|this[e+1]};$e.prototype.readUint32LE=$e.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||nh(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$e.prototype.readUint32BE=$e.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||nh(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$e.prototype.readBigUInt64LE=gL(function(e){e=e>>>0,YW(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Fee(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))});$e.prototype.readBigUInt64BE=gL(function(e){e=e>>>0,YW(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Fee(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)});$e.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||nh(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};$e.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||nh(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};$e.prototype.readInt8=function(e,r){return e=e>>>0,r||nh(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$e.prototype.readInt16LE=function(e,r){e=e>>>0,r||nh(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};$e.prototype.readInt16BE=function(e,r){e=e>>>0,r||nh(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};$e.prototype.readInt32LE=function(e,r){return e=e>>>0,r||nh(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$e.prototype.readInt32BE=function(e,r){return e=e>>>0,r||nh(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$e.prototype.readBigInt64LE=gL(function(e){e=e>>>0,YW(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Fee(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)});$e.prototype.readBigInt64BE=gL(function(e){e=e>>>0,YW(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Fee(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)});$e.prototype.readFloatLE=function(e,r){return e=e>>>0,r||nh(e,4,this.length),ZW.read(this,e,!0,23,4)};$e.prototype.readFloatBE=function(e,r){return e=e>>>0,r||nh(e,4,this.length),ZW.read(this,e,!1,23,4)};$e.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||nh(e,8,this.length),ZW.read(this,e,!0,52,8)};$e.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||nh(e,8,this.length),ZW.read(this,e,!1,52,8)};function o_(t,e,r,n,o,i){if(!$e.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")}$e.prototype.writeUintLE=$e.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;o_(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};$e.prototype.writeUintBE=$e.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;o_(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};$e.prototype.writeUint8=$e.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||o_(this,e,r,1,255,0),this[r]=e&255,r+1};$e.prototype.writeUint16LE=$e.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||o_(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};$e.prototype.writeUint16BE=$e.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||o_(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};$e.prototype.writeUint32LE=$e.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||o_(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};$e.prototype.writeUint32BE=$e.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||o_(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 eAt(t,e,r,n,o){iAt(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 tAt(t,e,r,n,o){iAt(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}$e.prototype.writeBigUInt64LE=gL(function(e,r=0){return eAt(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$e.prototype.writeBigUInt64BE=gL(function(e,r=0){return tAt(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$e.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);o_(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};$e.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);o_(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};$e.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||o_(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};$e.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||o_(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};$e.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||o_(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};$e.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||o_(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};$e.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||o_(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};$e.prototype.writeBigInt64LE=gL(function(e,r=0){return eAt(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});$e.prototype.writeBigInt64BE=gL(function(e,r=0){return tAt(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function rAt(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 nAt(t,e,r,n,o){return e=+e,r=r>>>0,o||rAt(t,e,r,4,34028234663852886e22,-34028234663852886e22),ZW.write(t,e,r,n,23,4),r+4}$e.prototype.writeFloatLE=function(e,r,n){return nAt(this,e,r,!0,n)};$e.prototype.writeFloatBE=function(e,r,n){return nAt(this,e,r,!1,n)};function oAt(t,e,r,n,o){return e=+e,r=r>>>0,o||rAt(t,e,r,8,17976931348623157e292,-17976931348623157e292),ZW.write(t,e,r,n,52,8),r+8}$e.prototype.writeDoubleLE=function(e,r,n){return oAt(this,e,r,!0,n)};$e.prototype.writeDoubleBE=function(e,r,n){return oAt(this,e,r,!1,n)};$e.prototype.copy=function(e,r,n,o){if(!$e.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};$e.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"&&!$e.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=$e.isBuffer(e)?e:$e.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 XW={};function MHe(t,e,r){XW[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}`}}}MHe("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);MHe("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);MHe("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=KRt(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=KRt(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function KRt(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 h_n(t,e,r){YW(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Fee(e,t.length-(r+1))}function iAt(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 XW.ERR_OUT_OF_RANGE("value",s,t)}h_n(n,o,i)}function YW(t,e){if(typeof t!="number")throw new XW.ERR_INVALID_ARG_TYPE(e,"number",t)}function Fee(t,e,r){throw Math.floor(t)!==t?(YW(t,r),new XW.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new XW.ERR_BUFFER_OUT_OF_BOUNDS:new XW.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var g_n=/[^+/0-9A-Za-z-_]/g;function y_n(t){if(t=t.split("=")[0],t=t.trim().replace(g_n,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function THe(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 b_n(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function __n(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 aAt(t){return CHe.toByteArray(y_n(t))}function bge(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 wO(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function IHe(t){return t!==t}var v_n=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 gL(t){return typeof BigInt>"u"?w_n:t}function w_n(){throw new Error("BigInt not supported")}});function kee(){return uAt.Platform.isDesktop&&_ge||(_ge=require("electron")?.remote?.safeStorage),_ge}async function DHe(){return await crypto.subtle.importKey("raw",S_n,vge.name,!1,["encrypt","decrypt"])}async function lAt(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 RHe(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await RHe(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await RHe(n.apiKey||"")})))),e}async function RHe(t){if(!t||t.startsWith($He))return t;cAt(t)&&(t=t.replace(wge,""));try{if(kee()?.isEncryptionAvailable()){let o=kee().encryptString(t);return NHe+o.toString("base64")}let e=await DHe(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(vge,e,r);return jHe+x_n(n)}catch(e){return console.error("Encryption failed:",e),t}}async function Do(t){if(!t||C_n(t))return t;if(cAt(t))return t.replace(wge,"");if(t.startsWith(NHe)){let r=t.replace(NHe,""),n=AHe.Buffer.from(r,"base64");return kee().decryptString(n)}if(t.startsWith(jHe)){let r=t.replace(jHe,""),n=await DHe(),o=sAt(r),i=await crypto.subtle.decrypt(vge,n,o);return new TextDecoder().decode(i)}let e=t.replace($He,"");try{if(kee()?.isEncryptionAvailable())try{let i=AHe.Buffer.from(e,"base64");return kee().decryptString(i)}catch{}let r=await DHe(),n=sAt(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 C_n(t){return!t.startsWith($He)&&!t.startsWith(wge)}function cAt(t){return t.startsWith(wge)}function x_n(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 sAt(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 AHe,uAt,_ge,NHe,jHe,$He,wge,S_n,vge,hN=v(()=>{AHe=L(Qw()),uAt=require("obsidian"),_ge=null;NHe="enc_desk_",jHe="enc_web_",$He="enc_",wge="dec_",S_n=new TextEncoder().encode("obsidian-copilot-v1"),vge={name:"AES-GCM",iv:new Uint8Array(12)}});function mAt(t){ui.set(Cge,t)}function i_(){return ui.get(Cge)}function hAt(t){return ui.sub(Cge,t)}function yL(){return dL(Cge,{store:ui})}function gN(){return ui.get(xge)}function Lz(t){ui.set(xge,t)}function gAt(t){return ui.sub(xge,t)}function Cv(){return dL(xge,{store:ui})}function Fz(t){ui.set(Sge,t)}function Uu(){return ui.get(Sge)}function e6(t){return ui.sub(Sge,()=>{t(ui.get(Sge))})}function SO(t){ui.set(pAt,t)}function Oge(){return dL(pAt,{store:ui})}function t6(){return gN()==="project"}function yN(t){ui.set(LHe,t)}function bL(){return ui.get(LHe)}function yAt(t){let e=bL();yN(e.filter(r=>r.id!==t))}function bAt(){yN([])}function _At(){return dL(LHe,{store:ui})}function vAt(t){ui.set(qee,t)}function CO(t,e){ui.set(qee,r=>({...r,[t]:e(r[t])}))}function r6(){return dL(qee,{store:ui})}var dAt,Cge,fAt,xge,Sge,pAt,qee,LHe,qs=v(()=>{Bc();ot();eC();dAt=Cc(null),Cge=Cc(t=>{let e=t(dAt);return e!==null?e:t(fL).defaultModelKey},(t,e,r)=>{e(dAt,r)}),fAt=Cc(null),xge=Cc(t=>{let e=t(fAt);return e!==null?e:t(fL).defaultChainType},(t,e,r)=>{e(fAt,r)}),Sge=Cc(null),pAt=Cc(!1),qee=Cc({success:[],failed:[],processingFiles:[],total:[]}),LHe=Cc([])});var IAt=S(Bu=>{"use strict";function UHe(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<Tge(o,e))t[n]=e,t[r]=o,r=n;else break e}}function oC(t){return t.length===0?null:t[0]}function Pge(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>Tge(s,r))u<o&&0>Tge(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>Tge(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function Tge(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(wAt=performance,Bu.unstable_now=function(){return wAt.now()}):(FHe=Date,SAt=FHe.now(),Bu.unstable_now=function(){return FHe.now()-SAt});var wAt,FHe,SAt,xO=[],_L=[],O_n=1,eS=null,ny=3,Mge=!1,kz=!1,Bee=!1,OAt=typeof setTimeout=="function"?setTimeout:null,TAt=typeof clearTimeout=="function"?clearTimeout:null,CAt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function BHe(t){for(var e=oC(_L);e!==null;){if(e.callback===null)Pge(_L);else if(e.startTime<=t)Pge(_L),e.sortIndex=e.expirationTime,UHe(xO,e);else break;e=oC(_L)}}function zHe(t){if(Bee=!1,BHe(t),!kz)if(oC(xO)!==null)kz=!0,HHe(VHe);else{var e=oC(_L);e!==null&&JHe(zHe,e.startTime-t)}}function VHe(t,e){kz=!1,Bee&&(Bee=!1,TAt(zee),zee=-1),Mge=!0;var r=ny;try{for(BHe(e),eS=oC(xO);eS!==null&&(!(eS.expirationTime>e)||t&&!MAt());){var n=eS.callback;if(typeof n=="function"){eS.callback=null,ny=eS.priorityLevel;var o=n(eS.expirationTime<=e);e=Bu.unstable_now(),typeof o=="function"?eS.callback=o:eS===oC(xO)&&Pge(xO),BHe(e)}else Pge(xO);eS=oC(xO)}if(eS!==null)var i=!0;else{var a=oC(_L);a!==null&&JHe(zHe,a.startTime-e),i=!1}return i}finally{eS=null,ny=r,Mge=!1}}var Ige=!1,Ege=null,zee=-1,EAt=5,PAt=-1;function MAt(){return!(Bu.unstable_now()-PAt<EAt)}function kHe(){if(Ege!==null){var t=Bu.unstable_now();PAt=t;var e=!0;try{e=Ege(!0,t)}finally{e?Uee():(Ige=!1,Ege=null)}}else Ige=!1}var Uee;typeof CAt=="function"?Uee=function(){CAt(kHe)}:typeof MessageChannel<"u"?(qHe=new MessageChannel,xAt=qHe.port2,qHe.port1.onmessage=kHe,Uee=function(){xAt.postMessage(null)}):Uee=function(){OAt(kHe,0)};var qHe,xAt;function HHe(t){Ege=t,Ige||(Ige=!0,Uee())}function JHe(t,e){zee=OAt(function(){t(Bu.unstable_now())},e)}Bu.unstable_IdlePriority=5;Bu.unstable_ImmediatePriority=1;Bu.unstable_LowPriority=4;Bu.unstable_NormalPriority=3;Bu.unstable_Profiling=null;Bu.unstable_UserBlockingPriority=2;Bu.unstable_cancelCallback=function(t){t.callback=null};Bu.unstable_continueExecution=function(){kz||Mge||(kz=!0,HHe(VHe))};Bu.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"):EAt=0<t?Math.floor(1e3/t):5};Bu.unstable_getCurrentPriorityLevel=function(){return ny};Bu.unstable_getFirstCallbackNode=function(){return oC(xO)};Bu.unstable_next=function(t){switch(ny){case 1:case 2:case 3:var e=3;break;default:e=ny}var r=ny;ny=e;try{return t()}finally{ny=r}};Bu.unstable_pauseExecution=function(){};Bu.unstable_requestPaint=function(){};Bu.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=ny;ny=t;try{return e()}finally{ny=r}};Bu.unstable_scheduleCallback=function(t,e,r){var n=Bu.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:O_n++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,UHe(_L,t),oC(xO)===null&&t===oC(_L)&&(Bee?(TAt(zee),zee=-1):Bee=!0,JHe(zHe,r-n))):(t.sortIndex=o,UHe(xO,t),kz||Mge||(kz=!0,HHe(VHe))),t};Bu.unstable_shouldYield=MAt;Bu.unstable_wrapCallback=function(t){var e=ny;return function(){var r=ny;ny=e;try{return t.apply(this,arguments)}finally{ny=r}}}});var AAt=S((RLi,RAt)=>{"use strict";RAt.exports=IAt()});var Fjt=S(Mv=>{"use strict";var kNt=X(),Ev=AAt();function ut(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 qNt=new Set,dte={};function Yz(t,e){C6(t,e),C6(t+"Capture",e)}function C6(t,e){for(dte[t]=e,t=0;t<e.length;t++)qNt.add(e[t])}var CN=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hJe=Object.prototype.hasOwnProperty,T_n=/^[: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]*$/,NAt={},jAt={};function E_n(t){return hJe.call(jAt,t)?!0:hJe.call(NAt,t)?!1:T_n.test(t)?jAt[t]=!0:(NAt[t]=!0,!1)}function P_n(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 M_n(t,e,r,n){if(e===null||typeof e>"u"||P_n(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 db(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 og={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){og[t]=new db(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];og[e]=new db(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){og[t]=new db(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){og[t]=new db(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){og[t]=new db(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){og[t]=new db(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){og[t]=new db(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){og[t]=new db(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){og[t]=new db(t,5,!1,t.toLowerCase(),null,!1,!1)});var s3e=/[\-:]([a-z])/g;function u3e(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(s3e,u3e);og[e]=new db(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(s3e,u3e);og[e]=new db(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(s3e,u3e);og[e]=new db(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){og[t]=new db(t,1,!1,t.toLowerCase(),null,!1,!1)});og.xlinkHref=new db("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){og[t]=new db(t,1,!1,t.toLowerCase(),null,!0,!0)});function l3e(t,e,r,n){var o=og.hasOwnProperty(e)?og[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(M_n(e,r,o,n)&&(r=null),n||o===null?E_n(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 EN=kNt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Rge=Symbol.for("react.element"),i6=Symbol.for("react.portal"),a6=Symbol.for("react.fragment"),c3e=Symbol.for("react.strict_mode"),gJe=Symbol.for("react.profiler"),UNt=Symbol.for("react.provider"),BNt=Symbol.for("react.context"),d3e=Symbol.for("react.forward_ref"),yJe=Symbol.for("react.suspense"),bJe=Symbol.for("react.suspense_list"),f3e=Symbol.for("react.memo"),wL=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var zNt=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var DAt=Symbol.iterator;function Vee(t){return t===null||typeof t!="object"?null:(t=DAt&&t[DAt]||t["@@iterator"],typeof t=="function"?t:null)}var lc=Object.assign,WHe;function Yee(t){if(WHe===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);WHe=e&&e[1]||""}return`
|
||
`+WHe+t}var KHe=!1;function GHe(t,e){if(!t||KHe)return"";KHe=!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{KHe=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?Yee(t):""}function I_n(t){switch(t.tag){case 5:return Yee(t.type);case 16:return Yee("Lazy");case 13:return Yee("Suspense");case 19:return Yee("SuspenseList");case 0:case 2:case 15:return t=GHe(t.type,!1),t;case 11:return t=GHe(t.type.render,!1),t;case 1:return t=GHe(t.type,!0),t;default:return""}}function _Je(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 a6:return"Fragment";case i6:return"Portal";case gJe:return"Profiler";case c3e:return"StrictMode";case yJe:return"Suspense";case bJe:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case BNt:return(t.displayName||"Context")+".Consumer";case UNt:return(t._context.displayName||"Context")+".Provider";case d3e:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case f3e:return e=t.displayName||null,e!==null?e:_Je(t.type)||"Memo";case wL:e=t._payload,t=t._init;try{return _Je(t(e))}catch{}}return null}function R_n(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 _Je(e);case 8:return e===c3e?"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 DL(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function VNt(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function A_n(t){var e=VNt(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 Age(t){t._valueTracker||(t._valueTracker=A_n(t))}function HNt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=VNt(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function aye(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 vJe(t,e){var r=e.checked;return lc({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function $At(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=DL(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 JNt(t,e){e=e.checked,e!=null&&l3e(t,"checked",e,!1)}function wJe(t,e){JNt(t,e);var r=DL(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")?SJe(t,e.type,r):e.hasOwnProperty("defaultValue")&&SJe(t,e.type,DL(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function LAt(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 SJe(t,e,r){(e!=="number"||aye(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var Qee=Array.isArray;function y6(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=""+DL(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 CJe(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(ut(91));return lc({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function FAt(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(ut(92));if(Qee(r)){if(1<r.length)throw Error(ut(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:DL(r)}}function WNt(t,e){var r=DL(e.value),n=DL(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 kAt(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function KNt(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 xJe(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?KNt(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Nge,GNt=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(Nge=Nge||document.createElement("div"),Nge.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Nge.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function fte(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var rte={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},N_n=["Webkit","ms","Moz","O"];Object.keys(rte).forEach(function(t){N_n.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),rte[e]=rte[t]})});function XNt(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||rte.hasOwnProperty(t)&&rte[t]?(""+e).trim():e+"px"}function ZNt(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=XNt(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var j_n=lc({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 OJe(t,e){if(e){if(j_n[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ut(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ut(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ut(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ut(62))}}function TJe(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 EJe=null;function p3e(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var PJe=null,b6=null,_6=null;function qAt(t){if(t=Ite(t)){if(typeof PJe!="function")throw Error(ut(280));var e=t.stateNode;e&&(e=jye(e),PJe(t.stateNode,t.type,e))}}function YNt(t){b6?_6?_6.push(t):_6=[t]:b6=t}function QNt(){if(b6){var t=b6,e=_6;if(_6=b6=null,qAt(t),e)for(t=0;t<e.length;t++)qAt(e[t])}}function e1t(t,e){return t(e)}function t1t(){}var XHe=!1;function r1t(t,e,r){if(XHe)return t(e,r);XHe=!0;try{return e1t(t,e,r)}finally{XHe=!1,(b6!==null||_6!==null)&&(t1t(),QNt())}}function pte(t,e){var r=t.stateNode;if(r===null)return null;var n=jye(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(ut(231,e,typeof r));return r}var MJe=!1;if(CN)try{n6={},Object.defineProperty(n6,"passive",{get:function(){MJe=!0}}),window.addEventListener("test",n6,n6),window.removeEventListener("test",n6,n6)}catch{MJe=!1}var n6;function D_n(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 nte=!1,sye=null,uye=!1,IJe=null,$_n={onError:function(t){nte=!0,sye=t}};function L_n(t,e,r,n,o,i,a,s,u){nte=!1,sye=null,D_n.apply($_n,arguments)}function F_n(t,e,r,n,o,i,a,s,u){if(L_n.apply(this,arguments),nte){if(nte){var l=sye;nte=!1,sye=null}else throw Error(ut(198));uye||(uye=!0,IJe=l)}}function Qz(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 n1t(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 UAt(t){if(Qz(t)!==t)throw Error(ut(188))}function k_n(t){var e=t.alternate;if(!e){if(e=Qz(t),e===null)throw Error(ut(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 UAt(o),t;if(i===n)return UAt(o),e;i=i.sibling}throw Error(ut(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(ut(189))}}if(r.alternate!==n)throw Error(ut(190))}if(r.tag!==3)throw Error(ut(188));return r.stateNode.current===r?t:e}function o1t(t){return t=k_n(t),t!==null?i1t(t):null}function i1t(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=i1t(t);if(e!==null)return e;t=t.sibling}return null}var a1t=Ev.unstable_scheduleCallback,BAt=Ev.unstable_cancelCallback,q_n=Ev.unstable_shouldYield,U_n=Ev.unstable_requestPaint,zc=Ev.unstable_now,B_n=Ev.unstable_getCurrentPriorityLevel,m3e=Ev.unstable_ImmediatePriority,s1t=Ev.unstable_UserBlockingPriority,lye=Ev.unstable_NormalPriority,z_n=Ev.unstable_LowPriority,u1t=Ev.unstable_IdlePriority,Iye=null,PO=null;function V_n(t){if(PO&&typeof PO.onCommitFiberRoot=="function")try{PO.onCommitFiberRoot(Iye,t,void 0,(t.current.flags&128)===128)}catch{}}var lC=Math.clz32?Math.clz32:W_n,H_n=Math.log,J_n=Math.LN2;function W_n(t){return t>>>=0,t===0?32:31-(H_n(t)/J_n|0)|0}var jge=64,Dge=4194304;function ete(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 cye(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=ete(s):(i&=a,i!==0&&(n=ete(i)))}else a=r&~o,a!==0?n=ete(a):i!==0&&(n=ete(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-lC(e),o=1<<r,n|=t[r],e&=~o;return n}function K_n(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 G_n(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-lC(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=K_n(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function RJe(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function l1t(){var t=jge;return jge<<=1,(jge&4194240)===0&&(jge=64),t}function ZHe(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function Pte(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-lC(e),t[e]=r}function X_n(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-lC(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function h3e(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-lC(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var ru=0;function c1t(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var d1t,g3e,f1t,p1t,m1t,AJe=!1,$ge=[],EL=null,PL=null,ML=null,mte=new Map,hte=new Map,CL=[],Z_n="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 zAt(t,e){switch(t){case"focusin":case"focusout":EL=null;break;case"dragenter":case"dragleave":PL=null;break;case"mouseover":case"mouseout":ML=null;break;case"pointerover":case"pointerout":mte.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":hte.delete(e.pointerId)}}function Hee(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=Ite(e),e!==null&&g3e(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function Y_n(t,e,r,n,o){switch(e){case"focusin":return EL=Hee(EL,t,e,r,n,o),!0;case"dragenter":return PL=Hee(PL,t,e,r,n,o),!0;case"mouseover":return ML=Hee(ML,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return mte.set(i,Hee(mte.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,hte.set(i,Hee(hte.get(i)||null,t,e,r,n,o)),!0}return!1}function h1t(t){var e=Bz(t.target);if(e!==null){var r=Qz(e);if(r!==null){if(e=r.tag,e===13){if(e=n1t(r),e!==null){t.blockedOn=e,m1t(t.priority,function(){f1t(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 Xge(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=NJe(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);EJe=n,r.target.dispatchEvent(n),EJe=null}else return e=Ite(r),e!==null&&g3e(e),t.blockedOn=r,!1;e.shift()}return!0}function VAt(t,e,r){Xge(t)&&r.delete(e)}function Q_n(){AJe=!1,EL!==null&&Xge(EL)&&(EL=null),PL!==null&&Xge(PL)&&(PL=null),ML!==null&&Xge(ML)&&(ML=null),mte.forEach(VAt),hte.forEach(VAt)}function Jee(t,e){t.blockedOn===e&&(t.blockedOn=null,AJe||(AJe=!0,Ev.unstable_scheduleCallback(Ev.unstable_NormalPriority,Q_n)))}function gte(t){function e(o){return Jee(o,t)}if(0<$ge.length){Jee($ge[0],t);for(var r=1;r<$ge.length;r++){var n=$ge[r];n.blockedOn===t&&(n.blockedOn=null)}}for(EL!==null&&Jee(EL,t),PL!==null&&Jee(PL,t),ML!==null&&Jee(ML,t),mte.forEach(e),hte.forEach(e),r=0;r<CL.length;r++)n=CL[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<CL.length&&(r=CL[0],r.blockedOn===null);)h1t(r),r.blockedOn===null&&CL.shift()}var v6=EN.ReactCurrentBatchConfig,dye=!0;function evn(t,e,r,n){var o=ru,i=v6.transition;v6.transition=null;try{ru=1,y3e(t,e,r,n)}finally{ru=o,v6.transition=i}}function tvn(t,e,r,n){var o=ru,i=v6.transition;v6.transition=null;try{ru=4,y3e(t,e,r,n)}finally{ru=o,v6.transition=i}}function y3e(t,e,r,n){if(dye){var o=NJe(t,e,r,n);if(o===null)oJe(t,e,n,fye,r),zAt(t,n);else if(Y_n(o,t,e,r,n))n.stopPropagation();else if(zAt(t,n),e&4&&-1<Z_n.indexOf(t)){for(;o!==null;){var i=Ite(o);if(i!==null&&d1t(i),i=NJe(t,e,r,n),i===null&&oJe(t,e,n,fye,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else oJe(t,e,n,null,r)}}var fye=null;function NJe(t,e,r,n){if(fye=null,t=p3e(n),t=Bz(t),t!==null)if(e=Qz(t),e===null)t=null;else if(r=e.tag,r===13){if(t=n1t(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 fye=t,null}function g1t(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(B_n()){case m3e:return 1;case s1t:return 4;case lye:case z_n:return 16;case u1t:return 536870912;default:return 16}default:return 16}}var OL=null,b3e=null,Zge=null;function y1t(){if(Zge)return Zge;var t,e=b3e,r=e.length,n,o="value"in OL?OL.value:OL.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 Zge=o.slice(t,1<n?1-n:void 0)}function Yge(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 Lge(){return!0}function HAt(){return!1}function Pv(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)?Lge:HAt,this.isPropagationStopped=HAt,this}return lc(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=Lge)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Lge)},persist:function(){},isPersistent:Lge}),e}var I6={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_3e=Pv(I6),Mte=lc({},I6,{view:0,detail:0}),rvn=Pv(Mte),YHe,QHe,Wee,Rye=lc({},Mte,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:v3e,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!==Wee&&(Wee&&t.type==="mousemove"?(YHe=t.screenX-Wee.screenX,QHe=t.screenY-Wee.screenY):QHe=YHe=0,Wee=t),YHe)},movementY:function(t){return"movementY"in t?t.movementY:QHe}}),JAt=Pv(Rye),nvn=lc({},Rye,{dataTransfer:0}),ovn=Pv(nvn),ivn=lc({},Mte,{relatedTarget:0}),eJe=Pv(ivn),avn=lc({},I6,{animationName:0,elapsedTime:0,pseudoElement:0}),svn=Pv(avn),uvn=lc({},I6,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),lvn=Pv(uvn),cvn=lc({},I6,{data:0}),WAt=Pv(cvn),dvn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fvn={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"},pvn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mvn(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=pvn[t])?!!e[t]:!1}function v3e(){return mvn}var hvn=lc({},Mte,{key:function(t){if(t.key){var e=dvn[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Yge(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?fvn[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:v3e,charCode:function(t){return t.type==="keypress"?Yge(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Yge(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),gvn=Pv(hvn),yvn=lc({},Rye,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),KAt=Pv(yvn),bvn=lc({},Mte,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:v3e}),_vn=Pv(bvn),vvn=lc({},I6,{propertyName:0,elapsedTime:0,pseudoElement:0}),wvn=Pv(vvn),Svn=lc({},Rye,{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}),Cvn=Pv(Svn),xvn=[9,13,27,32],w3e=CN&&"CompositionEvent"in window,ote=null;CN&&"documentMode"in document&&(ote=document.documentMode);var Ovn=CN&&"TextEvent"in window&&!ote,b1t=CN&&(!w3e||ote&&8<ote&&11>=ote),GAt=" ",XAt=!1;function _1t(t,e){switch(t){case"keyup":return xvn.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function v1t(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var s6=!1;function Tvn(t,e){switch(t){case"compositionend":return v1t(e);case"keypress":return e.which!==32?null:(XAt=!0,GAt);case"textInput":return t=e.data,t===GAt&&XAt?null:t;default:return null}}function Evn(t,e){if(s6)return t==="compositionend"||!w3e&&_1t(t,e)?(t=y1t(),Zge=b3e=OL=null,s6=!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 b1t&&e.locale!=="ko"?null:e.data;default:return null}}var Pvn={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 ZAt(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Pvn[t.type]:e==="textarea"}function w1t(t,e,r,n){YNt(n),e=pye(e,"onChange"),0<e.length&&(r=new _3e("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var ite=null,yte=null;function Mvn(t){A1t(t,0)}function Aye(t){var e=c6(t);if(HNt(e))return t}function Ivn(t,e){if(t==="change")return e}var S1t=!1;CN&&(CN?(kge="oninput"in document,kge||(tJe=document.createElement("div"),tJe.setAttribute("oninput","return;"),kge=typeof tJe.oninput=="function"),Fge=kge):Fge=!1,S1t=Fge&&(!document.documentMode||9<document.documentMode));var Fge,kge,tJe;function YAt(){ite&&(ite.detachEvent("onpropertychange",C1t),yte=ite=null)}function C1t(t){if(t.propertyName==="value"&&Aye(yte)){var e=[];w1t(e,yte,t,p3e(t)),r1t(Mvn,e)}}function Rvn(t,e,r){t==="focusin"?(YAt(),ite=e,yte=r,ite.attachEvent("onpropertychange",C1t)):t==="focusout"&&YAt()}function Avn(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Aye(yte)}function Nvn(t,e){if(t==="click")return Aye(e)}function jvn(t,e){if(t==="input"||t==="change")return Aye(e)}function Dvn(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var dC=typeof Object.is=="function"?Object.is:Dvn;function bte(t,e){if(dC(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(!hJe.call(e,o)||!dC(t[o],e[o]))return!1}return!0}function QAt(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function eNt(t,e){var r=QAt(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=QAt(r)}}function x1t(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?x1t(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function O1t(){for(var t=window,e=aye();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=aye(t.document)}return e}function S3e(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 $vn(t){var e=O1t(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&x1t(r.ownerDocument.documentElement,r)){if(n!==null&&S3e(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=eNt(r,i);var a=eNt(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 Lvn=CN&&"documentMode"in document&&11>=document.documentMode,u6=null,jJe=null,ate=null,DJe=!1;function tNt(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;DJe||u6==null||u6!==aye(n)||(n=u6,"selectionStart"in n&&S3e(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}),ate&&bte(ate,n)||(ate=n,n=pye(jJe,"onSelect"),0<n.length&&(e=new _3e("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=u6)))}function qge(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var l6={animationend:qge("Animation","AnimationEnd"),animationiteration:qge("Animation","AnimationIteration"),animationstart:qge("Animation","AnimationStart"),transitionend:qge("Transition","TransitionEnd")},rJe={},T1t={};CN&&(T1t=document.createElement("div").style,"AnimationEvent"in window||(delete l6.animationend.animation,delete l6.animationiteration.animation,delete l6.animationstart.animation),"TransitionEvent"in window||delete l6.transitionend.transition);function Nye(t){if(rJe[t])return rJe[t];if(!l6[t])return t;var e=l6[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in T1t)return rJe[t]=e[r];return t}var E1t=Nye("animationend"),P1t=Nye("animationiteration"),M1t=Nye("animationstart"),I1t=Nye("transitionend"),R1t=new Map,rNt="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 LL(t,e){R1t.set(t,e),Yz(e,[t])}for(Uge=0;Uge<rNt.length;Uge++)Bge=rNt[Uge],nNt=Bge.toLowerCase(),oNt=Bge[0].toUpperCase()+Bge.slice(1),LL(nNt,"on"+oNt);var Bge,nNt,oNt,Uge;LL(E1t,"onAnimationEnd");LL(P1t,"onAnimationIteration");LL(M1t,"onAnimationStart");LL("dblclick","onDoubleClick");LL("focusin","onFocus");LL("focusout","onBlur");LL(I1t,"onTransitionEnd");C6("onMouseEnter",["mouseout","mouseover"]);C6("onMouseLeave",["mouseout","mouseover"]);C6("onPointerEnter",["pointerout","pointerover"]);C6("onPointerLeave",["pointerout","pointerover"]);Yz("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Yz("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Yz("onBeforeInput",["compositionend","keypress","textInput","paste"]);Yz("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Yz("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Yz("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tte="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(" "),Fvn=new Set("cancel close invalid load scroll toggle".split(" ").concat(tte));function iNt(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,F_n(n,e,void 0,t),t.currentTarget=null}function A1t(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;iNt(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;iNt(o,s,l),i=u}}}if(uye)throw t=IJe,uye=!1,IJe=null,t}function sl(t,e){var r=e[qJe];r===void 0&&(r=e[qJe]=new Set);var n=t+"__bubble";r.has(n)||(N1t(e,t,2,!1),r.add(n))}function nJe(t,e,r){var n=0;e&&(n|=4),N1t(r,t,n,e)}var zge="_reactListening"+Math.random().toString(36).slice(2);function _te(t){if(!t[zge]){t[zge]=!0,qNt.forEach(function(r){r!=="selectionchange"&&(Fvn.has(r)||nJe(r,!1,t),nJe(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[zge]||(e[zge]=!0,nJe("selectionchange",!1,e))}}function N1t(t,e,r,n){switch(g1t(e)){case 1:var o=evn;break;case 4:o=tvn;break;default:o=y3e}r=o.bind(null,e,r,t),o=void 0,!MJe||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 oJe(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=Bz(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}r1t(function(){var l=i,c=p3e(r),d=[];e:{var f=R1t.get(t);if(f!==void 0){var p=_3e,m=t;switch(t){case"keypress":if(Yge(r)===0)break e;case"keydown":case"keyup":p=gvn;break;case"focusin":m="focus",p=eJe;break;case"focusout":m="blur",p=eJe;break;case"beforeblur":case"afterblur":p=eJe;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=JAt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=ovn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=_vn;break;case E1t:case P1t:case M1t:p=svn;break;case I1t:p=wvn;break;case"scroll":p=rvn;break;case"wheel":p=Cvn;break;case"copy":case"cut":case"paste":p=lvn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=KAt}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=pte(b,g),w!=null&&h.push(vte(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!==EJe&&(m=r.relatedTarget||r.fromElement)&&(Bz(m)||m[xN]))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?Bz(m):null,m!==null&&(y=Qz(m),m!==y||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=l),p!==m)){if(h=JAt,w="onMouseLeave",g="onMouseEnter",b="mouse",(t==="pointerout"||t==="pointerover")&&(h=KAt,w="onPointerLeave",g="onPointerEnter",b="pointer"),y=p==null?f:c6(p),_=m==null?f:c6(m),f=new h(w,b+"leave",p,r,c),f.target=y,f.relatedTarget=_,w=null,Bz(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;_;_=o6(_))b++;for(_=0,w=g;w;w=o6(w))_++;for(;0<b-_;)h=o6(h),b--;for(;0<_-b;)g=o6(g),_--;for(;b--;){if(h===g||g!==null&&h===g.alternate)break t;h=o6(h),g=o6(g)}h=null}else h=null;p!==null&&aNt(d,f,p,h,!1),m!==null&&y!==null&&aNt(d,y,m,h,!0)}}e:{if(f=l?c6(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var O=Ivn;else if(ZAt(f))if(S1t)O=jvn;else{O=Avn;var T=Rvn}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(O=Nvn);if(O&&(O=O(t,l))){w1t(d,O,r,c);break e}T&&T(t,f,l),t==="focusout"&&(T=f._wrapperState)&&T.controlled&&f.type==="number"&&SJe(f,"number",f.value)}switch(T=l?c6(l):window,t){case"focusin":(ZAt(T)||T.contentEditable==="true")&&(u6=T,jJe=l,ate=null);break;case"focusout":ate=jJe=u6=null;break;case"mousedown":DJe=!0;break;case"contextmenu":case"mouseup":case"dragend":DJe=!1,tNt(d,r,c);break;case"selectionchange":if(Lvn)break;case"keydown":case"keyup":tNt(d,r,c)}var P;if(w3e)e:{switch(t){case"compositionstart":var M="onCompositionStart";break e;case"compositionend":M="onCompositionEnd";break e;case"compositionupdate":M="onCompositionUpdate";break e}M=void 0}else s6?_1t(t,r)&&(M="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(M="onCompositionStart");M&&(b1t&&r.locale!=="ko"&&(s6||M!=="onCompositionStart"?M==="onCompositionEnd"&&s6&&(P=y1t()):(OL=c,b3e="value"in OL?OL.value:OL.textContent,s6=!0)),T=pye(l,M),0<T.length&&(M=new WAt(M,t,null,r,c),d.push({event:M,listeners:T}),P?M.data=P:(P=v1t(r),P!==null&&(M.data=P)))),(P=Ovn?Tvn(t,r):Evn(t,r))&&(l=pye(l,"onBeforeInput"),0<l.length&&(c=new WAt("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=P))}A1t(d,e)})}function vte(t,e,r){return{instance:t,listener:e,currentTarget:r}}function pye(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=pte(t,r),i!=null&&n.unshift(vte(t,i,o)),i=pte(t,e),i!=null&&n.push(vte(t,i,o))),t=t.return}return n}function o6(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function aNt(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=pte(r,i),u!=null&&a.unshift(vte(r,u,s))):o||(u=pte(r,i),u!=null&&a.push(vte(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var kvn=/\r\n?/g,qvn=/\u0000|\uFFFD/g;function sNt(t){return(typeof t=="string"?t:""+t).replace(kvn,`
|
||
`).replace(qvn,"")}function Vge(t,e,r){if(e=sNt(e),sNt(t)!==e&&r)throw Error(ut(425))}function mye(){}var $Je=null,LJe=null;function FJe(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 kJe=typeof setTimeout=="function"?setTimeout:void 0,Uvn=typeof clearTimeout=="function"?clearTimeout:void 0,uNt=typeof Promise=="function"?Promise:void 0,Bvn=typeof queueMicrotask=="function"?queueMicrotask:typeof uNt<"u"?function(t){return uNt.resolve(null).then(t).catch(zvn)}:kJe;function zvn(t){setTimeout(function(){throw t})}function iJe(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),gte(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);gte(e)}function IL(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 lNt(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 R6=Math.random().toString(36).slice(2),EO="__reactFiber$"+R6,wte="__reactProps$"+R6,xN="__reactContainer$"+R6,qJe="__reactEvents$"+R6,Vvn="__reactListeners$"+R6,Hvn="__reactHandles$"+R6;function Bz(t){var e=t[EO];if(e)return e;for(var r=t.parentNode;r;){if(e=r[xN]||r[EO]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=lNt(t);t!==null;){if(r=t[EO])return r;t=lNt(t)}return e}t=r,r=t.parentNode}return null}function Ite(t){return t=t[EO]||t[xN],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function c6(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(ut(33))}function jye(t){return t[wte]||null}var UJe=[],d6=-1;function FL(t){return{current:t}}function ul(t){0>d6||(t.current=UJe[d6],UJe[d6]=null,d6--)}function zu(t,e){d6++,UJe[d6]=t.current,t.current=e}var $L={},sy=FL($L),u_=FL(!1),Wz=$L;function x6(t,e){var r=t.type.contextTypes;if(!r)return $L;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 l_(t){return t=t.childContextTypes,t!=null}function hye(){ul(u_),ul(sy)}function cNt(t,e,r){if(sy.current!==$L)throw Error(ut(168));zu(sy,e),zu(u_,r)}function j1t(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(ut(108,R_n(t)||"Unknown",o));return lc({},r,n)}function gye(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||$L,Wz=sy.current,zu(sy,t),zu(u_,u_.current),!0}function dNt(t,e,r){var n=t.stateNode;if(!n)throw Error(ut(169));r?(t=j1t(t,e,Wz),n.__reactInternalMemoizedMergedChildContext=t,ul(u_),ul(sy),zu(sy,t)):ul(u_),zu(u_,r)}var _N=null,Dye=!1,aJe=!1;function D1t(t){_N===null?_N=[t]:_N.push(t)}function Jvn(t){Dye=!0,D1t(t)}function kL(){if(!aJe&&_N!==null){aJe=!0;var t=0,e=ru;try{var r=_N;for(ru=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}_N=null,Dye=!1}catch(o){throw _N!==null&&(_N=_N.slice(t+1)),a1t(m3e,kL),o}finally{ru=e,aJe=!1}}return null}var f6=[],p6=0,yye=null,bye=0,tS=[],rS=0,Kz=null,vN=1,wN="";function qz(t,e){f6[p6++]=bye,f6[p6++]=yye,yye=t,bye=e}function $1t(t,e,r){tS[rS++]=vN,tS[rS++]=wN,tS[rS++]=Kz,Kz=t;var n=vN;t=wN;var o=32-lC(n)-1;n&=~(1<<o),r+=1;var i=32-lC(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,vN=1<<32-lC(e)+o|r<<o|n,wN=i+t}else vN=1<<i|r<<o|n,wN=t}function C3e(t){t.return!==null&&(qz(t,1),$1t(t,1,0))}function x3e(t){for(;t===yye;)yye=f6[--p6],f6[p6]=null,bye=f6[--p6],f6[p6]=null;for(;t===Kz;)Kz=tS[--rS],tS[rS]=null,wN=tS[--rS],tS[rS]=null,vN=tS[--rS],tS[rS]=null}var Tv=null,Ov=null,jl=!1,uC=null;function L1t(t,e){var r=nS(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 fNt(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,Tv=t,Ov=IL(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Tv=t,Ov=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=Kz!==null?{id:vN,overflow:wN}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=nS(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Tv=t,Ov=null,!0):!1;default:return!1}}function BJe(t){return(t.mode&1)!==0&&(t.flags&128)===0}function zJe(t){if(jl){var e=Ov;if(e){var r=e;if(!fNt(t,e)){if(BJe(t))throw Error(ut(418));e=IL(r.nextSibling);var n=Tv;e&&fNt(t,e)?L1t(n,r):(t.flags=t.flags&-4097|2,jl=!1,Tv=t)}}else{if(BJe(t))throw Error(ut(418));t.flags=t.flags&-4097|2,jl=!1,Tv=t}}}function pNt(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Tv=t}function Hge(t){if(t!==Tv)return!1;if(!jl)return pNt(t),jl=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!FJe(t.type,t.memoizedProps)),e&&(e=Ov)){if(BJe(t))throw F1t(),Error(ut(418));for(;e;)L1t(t,e),e=IL(e.nextSibling)}if(pNt(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(ut(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Ov=IL(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Ov=null}}else Ov=Tv?IL(t.stateNode.nextSibling):null;return!0}function F1t(){for(var t=Ov;t;)t=IL(t.nextSibling)}function O6(){Ov=Tv=null,jl=!1}function O3e(t){uC===null?uC=[t]:uC.push(t)}var Wvn=EN.ReactCurrentBatchConfig;function aC(t,e){if(t&&t.defaultProps){e=lc({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var _ye=FL(null),vye=null,m6=null,T3e=null;function E3e(){T3e=m6=vye=null}function P3e(t){var e=_ye.current;ul(_ye),t._currentValue=e}function VJe(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 w6(t,e){vye=t,T3e=m6=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&e)!==0&&(s_=!0),t.firstContext=null)}function iS(t){var e=t._currentValue;if(T3e!==t)if(t={context:t,memoizedValue:e,next:null},m6===null){if(vye===null)throw Error(ut(308));m6=t,vye.dependencies={lanes:0,firstContext:t}}else m6=m6.next=t;return e}var zz=null;function M3e(t){zz===null?zz=[t]:zz.push(t)}function k1t(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,M3e(e)):(r.next=o.next,o.next=r),e.interleaved=r,ON(t,n)}function ON(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 SL=!1;function I3e(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function q1t(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 SN(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function RL(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,(es&2)!==0){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,ON(t,r)}return o=n.interleaved,o===null?(e.next=e,M3e(n)):(e.next=o.next,o.next=e),n.interleaved=e,ON(t,r)}function Qge(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,h3e(t,r)}}function mNt(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 wye(t,e,r,n){var o=t.updateQueue;SL=!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=lc({},d,f);break e;case 2:SL=!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);Xz|=a,t.lanes=a,t.memoizedState=d}}function hNt(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(ut(191,o));o.call(n)}}}var U1t=new kNt.Component().refs;function HJe(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:lc({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var $ye={isMounted:function(t){return(t=t._reactInternals)?Qz(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=cb(),o=NL(t),i=SN(n,o);i.payload=e,r!=null&&(i.callback=r),e=RL(t,i,o),e!==null&&(cC(e,t,o,n),Qge(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=cb(),o=NL(t),i=SN(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=RL(t,i,o),e!==null&&(cC(e,t,o,n),Qge(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=cb(),n=NL(t),o=SN(r,n);o.tag=2,e!=null&&(o.callback=e),e=RL(t,o,n),e!==null&&(cC(e,t,n,r),Qge(e,t,n))}};function gNt(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?!bte(r,n)||!bte(o,i):!0}function B1t(t,e,r){var n=!1,o=$L,i=e.contextType;return typeof i=="object"&&i!==null?i=iS(i):(o=l_(e)?Wz:sy.current,n=e.contextTypes,i=(n=n!=null)?x6(t,o):$L),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=$ye,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function yNt(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&&$ye.enqueueReplaceState(e,e.state,null)}function JJe(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=U1t,I3e(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=iS(i):(i=l_(e)?Wz:sy.current,o.context=x6(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(HJe(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&&$ye.enqueueReplaceState(o,o.state,null),wye(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function Kee(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(ut(309));var n=r.stateNode}if(!n)throw Error(ut(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===U1t&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(ut(284));if(!r._owner)throw Error(ut(290,t))}return t}function Jge(t,e){throw t=Object.prototype.toString.call(e),Error(ut(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function bNt(t){var e=t._init;return e(t._payload)}function z1t(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=jL(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=pJe(_,g.mode,w),b.return=g,b):(b=o(b,_),b.return=g,b)}function u(g,b,_,w){var O=_.type;return O===a6?c(g,b,_.props.children,w,_.key):b!==null&&(b.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===wL&&bNt(O)===b.type)?(w=o(b,_.props),w.ref=Kee(g,b,_),w.return=g,w):(w=iye(_.type,_.key,_.props,null,g.mode,w),w.ref=Kee(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=mJe(_,g.mode,w),b.return=g,b):(b=o(b,_.children||[]),b.return=g,b)}function c(g,b,_,w,O){return b===null||b.tag!==7?(b=Jz(_,g.mode,w,O),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=pJe(""+b,g.mode,_),b.return=g,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Rge:return _=iye(b.type,b.key,b.props,null,g.mode,_),_.ref=Kee(g,null,b),_.return=g,_;case i6:return b=mJe(b,g.mode,_),b.return=g,b;case wL:var w=b._init;return d(g,w(b._payload),_)}if(Qee(b)||Vee(b))return b=Jz(b,g.mode,_,null),b.return=g,b;Jge(g,b)}return null}function f(g,b,_,w){var O=b!==null?b.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return O!==null?null:s(g,b,""+_,w);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Rge:return _.key===O?u(g,b,_,w):null;case i6:return _.key===O?l(g,b,_,w):null;case wL:return O=_._init,f(g,b,O(_._payload),w)}if(Qee(_)||Vee(_))return O!==null?null:c(g,b,_,w,null);Jge(g,_)}return null}function p(g,b,_,w,O){if(typeof w=="string"&&w!==""||typeof w=="number")return g=g.get(_)||null,s(b,g,""+w,O);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Rge:return g=g.get(w.key===null?_:w.key)||null,u(b,g,w,O);case i6:return g=g.get(w.key===null?_:w.key)||null,l(b,g,w,O);case wL:var T=w._init;return p(g,b,_,T(w._payload),O)}if(Qee(w)||Vee(w))return g=g.get(_)||null,c(b,g,w,O,null);Jge(b,w)}return null}function m(g,b,_,w){for(var O=null,T=null,P=b,M=b=0,I=null;P!==null&&M<_.length;M++){P.index>M?(I=P,P=null):I=P.sibling;var j=f(g,P,_[M],w);if(j===null){P===null&&(P=I);break}t&&P&&j.alternate===null&&e(g,P),b=i(j,b,M),T===null?O=j:T.sibling=j,T=j,P=I}if(M===_.length)return r(g,P),jl&&qz(g,M),O;if(P===null){for(;M<_.length;M++)P=d(g,_[M],w),P!==null&&(b=i(P,b,M),T===null?O=P:T.sibling=P,T=P);return jl&&qz(g,M),O}for(P=n(g,P);M<_.length;M++)I=p(P,g,M,_[M],w),I!==null&&(t&&I.alternate!==null&&P.delete(I.key===null?M:I.key),b=i(I,b,M),T===null?O=I:T.sibling=I,T=I);return t&&P.forEach(function(A){return e(g,A)}),jl&&qz(g,M),O}function h(g,b,_,w){var O=Vee(_);if(typeof O!="function")throw Error(ut(150));if(_=O.call(_),_==null)throw Error(ut(151));for(var T=O=null,P=b,M=b=0,I=null,j=_.next();P!==null&&!j.done;M++,j=_.next()){P.index>M?(I=P,P=null):I=P.sibling;var A=f(g,P,j.value,w);if(A===null){P===null&&(P=I);break}t&&P&&A.alternate===null&&e(g,P),b=i(A,b,M),T===null?O=A:T.sibling=A,T=A,P=I}if(j.done)return r(g,P),jl&&qz(g,M),O;if(P===null){for(;!j.done;M++,j=_.next())j=d(g,j.value,w),j!==null&&(b=i(j,b,M),T===null?O=j:T.sibling=j,T=j);return jl&&qz(g,M),O}for(P=n(g,P);!j.done;M++,j=_.next())j=p(P,g,M,j.value,w),j!==null&&(t&&j.alternate!==null&&P.delete(j.key===null?M:j.key),b=i(j,b,M),T===null?O=j:T.sibling=j,T=j);return t&&P.forEach(function(k){return e(g,k)}),jl&&qz(g,M),O}function y(g,b,_,w){if(typeof _=="object"&&_!==null&&_.type===a6&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Rge:e:{for(var O=_.key,T=b;T!==null;){if(T.key===O){if(O=_.type,O===a6){if(T.tag===7){r(g,T.sibling),b=o(T,_.props.children),b.return=g,g=b;break e}}else if(T.elementType===O||typeof O=="object"&&O!==null&&O.$$typeof===wL&&bNt(O)===T.type){r(g,T.sibling),b=o(T,_.props),b.ref=Kee(g,T,_),b.return=g,g=b;break e}r(g,T);break}else e(g,T);T=T.sibling}_.type===a6?(b=Jz(_.props.children,g.mode,w,_.key),b.return=g,g=b):(w=iye(_.type,_.key,_.props,null,g.mode,w),w.ref=Kee(g,b,_),w.return=g,g=w)}return a(g);case i6:e:{for(T=_.key;b!==null;){if(b.key===T)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=mJe(_,g.mode,w),b.return=g,g=b}return a(g);case wL:return T=_._init,y(g,b,T(_._payload),w)}if(Qee(_))return m(g,b,_,w);if(Vee(_))return h(g,b,_,w);Jge(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=pJe(_,g.mode,w),b.return=g,g=b),a(g)):r(g,b)}return y}var T6=z1t(!0),V1t=z1t(!1),Rte={},MO=FL(Rte),Ste=FL(Rte),Cte=FL(Rte);function Vz(t){if(t===Rte)throw Error(ut(174));return t}function R3e(t,e){switch(zu(Cte,e),zu(Ste,t),zu(MO,Rte),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:xJe(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=xJe(e,t)}ul(MO),zu(MO,e)}function E6(){ul(MO),ul(Ste),ul(Cte)}function H1t(t){Vz(Cte.current);var e=Vz(MO.current),r=xJe(e,t.type);e!==r&&(zu(Ste,t),zu(MO,r))}function A3e(t){Ste.current===t&&(ul(MO),ul(Ste))}var sc=FL(0);function Sye(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 sJe=[];function N3e(){for(var t=0;t<sJe.length;t++)sJe[t]._workInProgressVersionPrimary=null;sJe.length=0}var eye=EN.ReactCurrentDispatcher,uJe=EN.ReactCurrentBatchConfig,Gz=0,uc=null,hm=null,oh=null,Cye=!1,ste=!1,xte=0,Kvn=0;function oy(){throw Error(ut(321))}function j3e(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!dC(t[r],e[r]))return!1;return!0}function D3e(t,e,r,n,o,i){if(Gz=i,uc=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,eye.current=t===null||t.memoizedState===null?Yvn:Qvn,t=r(n,o),ste){i=0;do{if(ste=!1,xte=0,25<=i)throw Error(ut(301));i+=1,oh=hm=null,e.updateQueue=null,eye.current=ewn,t=r(n,o)}while(ste)}if(eye.current=xye,e=hm!==null&&hm.next!==null,Gz=0,oh=hm=uc=null,Cye=!1,e)throw Error(ut(300));return t}function $3e(){var t=xte!==0;return xte=0,t}function TO(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return oh===null?uc.memoizedState=oh=t:oh=oh.next=t,oh}function aS(){if(hm===null){var t=uc.alternate;t=t!==null?t.memoizedState:null}else t=hm.next;var e=oh===null?uc.memoizedState:oh.next;if(e!==null)oh=e,hm=t;else{if(t===null)throw Error(ut(310));hm=t,t={memoizedState:hm.memoizedState,baseState:hm.baseState,baseQueue:hm.baseQueue,queue:hm.queue,next:null},oh===null?uc.memoizedState=oh=t:oh=oh.next=t}return oh}function Ote(t,e){return typeof e=="function"?e(t):e}function lJe(t){var e=aS(),r=e.queue;if(r===null)throw Error(ut(311));r.lastRenderedReducer=t;var n=hm,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((Gz&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,uc.lanes|=c,Xz|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,dC(n,e.memoizedState)||(s_=!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,uc.lanes|=i,Xz|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function cJe(t){var e=aS(),r=e.queue;if(r===null)throw Error(ut(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);dC(i,e.memoizedState)||(s_=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function J1t(){}function W1t(t,e){var r=uc,n=aS(),o=e(),i=!dC(n.memoizedState,o);if(i&&(n.memoizedState=o,s_=!0),n=n.queue,L3e(X1t.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||oh!==null&&oh.memoizedState.tag&1){if(r.flags|=2048,Tte(9,G1t.bind(null,r,n,o,e),void 0,null),ih===null)throw Error(ut(349));(Gz&30)!==0||K1t(r,e,o)}return o}function K1t(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=uc.updateQueue,e===null?(e={lastEffect:null,stores:null},uc.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function G1t(t,e,r,n){e.value=r,e.getSnapshot=n,Z1t(e)&&Y1t(t)}function X1t(t,e,r){return r(function(){Z1t(e)&&Y1t(t)})}function Z1t(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!dC(t,r)}catch{return!0}}function Y1t(t){var e=ON(t,1);e!==null&&cC(e,t,1,-1)}function _Nt(t){var e=TO();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ote,lastRenderedState:t},e.queue=t,t=t.dispatch=Zvn.bind(null,uc,t),[e.memoizedState,t]}function Tte(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=uc.updateQueue,e===null?(e={lastEffect:null,stores:null},uc.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 Q1t(){return aS().memoizedState}function tye(t,e,r,n){var o=TO();uc.flags|=t,o.memoizedState=Tte(1|e,r,void 0,n===void 0?null:n)}function Lye(t,e,r,n){var o=aS();n=n===void 0?null:n;var i=void 0;if(hm!==null){var a=hm.memoizedState;if(i=a.destroy,n!==null&&j3e(n,a.deps)){o.memoizedState=Tte(e,r,i,n);return}}uc.flags|=t,o.memoizedState=Tte(1|e,r,i,n)}function vNt(t,e){return tye(8390656,8,t,e)}function L3e(t,e){return Lye(2048,8,t,e)}function ejt(t,e){return Lye(4,2,t,e)}function tjt(t,e){return Lye(4,4,t,e)}function rjt(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 njt(t,e,r){return r=r!=null?r.concat([t]):null,Lye(4,4,rjt.bind(null,e,t),r)}function F3e(){}function ojt(t,e){var r=aS();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&j3e(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function ijt(t,e){var r=aS();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&j3e(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function ajt(t,e,r){return(Gz&21)===0?(t.baseState&&(t.baseState=!1,s_=!0),t.memoizedState=r):(dC(r,e)||(r=l1t(),uc.lanes|=r,Xz|=r,t.baseState=!0),e)}function Gvn(t,e){var r=ru;ru=r!==0&&4>r?r:4,t(!0);var n=uJe.transition;uJe.transition={};try{t(!1),e()}finally{ru=r,uJe.transition=n}}function sjt(){return aS().memoizedState}function Xvn(t,e,r){var n=NL(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},ujt(t))ljt(e,r);else if(r=k1t(t,e,r,n),r!==null){var o=cb();cC(r,t,n,o),cjt(r,e,n)}}function Zvn(t,e,r){var n=NL(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(ujt(t))ljt(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,dC(s,a)){var u=e.interleaved;u===null?(o.next=o,M3e(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=k1t(t,e,o,n),r!==null&&(o=cb(),cC(r,t,n,o),cjt(r,e,n))}}function ujt(t){var e=t.alternate;return t===uc||e!==null&&e===uc}function ljt(t,e){ste=Cye=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function cjt(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,h3e(t,r)}}var xye={readContext:iS,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},Yvn={readContext:iS,useCallback:function(t,e){return TO().memoizedState=[t,e===void 0?null:e],t},useContext:iS,useEffect:vNt,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,tye(4194308,4,rjt.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=TO();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=TO();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=Xvn.bind(null,uc,t),[n.memoizedState,t]},useRef:function(t){var e=TO();return t={current:t},e.memoizedState=t},useState:_Nt,useDebugValue:F3e,useDeferredValue:function(t){return TO().memoizedState=t},useTransition:function(){var t=_Nt(!1),e=t[0];return t=Gvn.bind(null,t[1]),TO().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=uc,o=TO();if(jl){if(r===void 0)throw Error(ut(407));r=r()}else{if(r=e(),ih===null)throw Error(ut(349));(Gz&30)!==0||K1t(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,vNt(X1t.bind(null,n,i,t),[t]),n.flags|=2048,Tte(9,G1t.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=TO(),e=ih.identifierPrefix;if(jl){var r=wN,n=vN;r=(n&~(1<<32-lC(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=xte++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=Kvn++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Qvn={readContext:iS,useCallback:ojt,useContext:iS,useEffect:L3e,useImperativeHandle:njt,useInsertionEffect:ejt,useLayoutEffect:tjt,useMemo:ijt,useReducer:lJe,useRef:Q1t,useState:function(){return lJe(Ote)},useDebugValue:F3e,useDeferredValue:function(t){var e=aS();return ajt(e,hm.memoizedState,t)},useTransition:function(){var t=lJe(Ote)[0],e=aS().memoizedState;return[t,e]},useMutableSource:J1t,useSyncExternalStore:W1t,useId:sjt,unstable_isNewReconciler:!1},ewn={readContext:iS,useCallback:ojt,useContext:iS,useEffect:L3e,useImperativeHandle:njt,useInsertionEffect:ejt,useLayoutEffect:tjt,useMemo:ijt,useReducer:cJe,useRef:Q1t,useState:function(){return cJe(Ote)},useDebugValue:F3e,useDeferredValue:function(t){var e=aS();return hm===null?e.memoizedState=t:ajt(e,hm.memoizedState,t)},useTransition:function(){var t=cJe(Ote)[0],e=aS().memoizedState;return[t,e]},useMutableSource:J1t,useSyncExternalStore:W1t,useId:sjt,unstable_isNewReconciler:!1};function P6(t,e){try{var r="",n=e;do r+=I_n(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 dJe(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function WJe(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var twn=typeof WeakMap=="function"?WeakMap:Map;function djt(t,e,r){r=SN(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){Tye||(Tye=!0,n3e=n),WJe(t,e)},r}function fjt(t,e,r){r=SN(-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(){WJe(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){WJe(t,e),typeof n!="function"&&(AL===null?AL=new Set([this]):AL.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function wNt(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new twn;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=hwn.bind(null,t,e,r),e.then(t,t))}function SNt(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 CNt(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=SN(-1,1),e.tag=2,RL(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var rwn=EN.ReactCurrentOwner,s_=!1;function lb(t,e,r,n){e.child=t===null?V1t(e,null,r,n):T6(e,t.child,r,n)}function xNt(t,e,r,n,o){r=r.render;var i=e.ref;return w6(e,o),n=D3e(t,e,r,n,i,o),r=$3e(),t!==null&&!s_?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,TN(t,e,o)):(jl&&r&&C3e(e),e.flags|=1,lb(t,e,n,o),e.child)}function ONt(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!J3e(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,pjt(t,e,i,n,o)):(t=iye(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:bte,r(a,n)&&t.ref===e.ref)return TN(t,e,o)}return e.flags|=1,t=jL(i,n),t.ref=e.ref,t.return=e,e.child=t}function pjt(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(bte(i,n)&&t.ref===e.ref)if(s_=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(s_=!0);else return e.lanes=t.lanes,TN(t,e,o)}return KJe(t,e,r,n,o)}function mjt(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(g6,xv),xv|=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(g6,xv),xv|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,zu(g6,xv),xv|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,zu(g6,xv),xv|=n;return lb(t,e,o,r),e.child}function hjt(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function KJe(t,e,r,n,o){var i=l_(r)?Wz:sy.current;return i=x6(e,i),w6(e,o),r=D3e(t,e,r,n,i,o),n=$3e(),t!==null&&!s_?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,TN(t,e,o)):(jl&&n&&C3e(e),e.flags|=1,lb(t,e,r,o),e.child)}function TNt(t,e,r,n,o){if(l_(r)){var i=!0;gye(e)}else i=!1;if(w6(e,o),e.stateNode===null)rye(t,e),B1t(e,r,n),JJe(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=iS(l):(l=l_(r)?Wz:sy.current,l=x6(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)&&yNt(e,a,n,l),SL=!1;var f=e.memoizedState;a.state=f,wye(e,n,a,o),u=e.memoizedState,s!==n||f!==u||u_.current||SL?(typeof c=="function"&&(HJe(e,r,c,n),u=e.memoizedState),(s=SL||gNt(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,q1t(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:aC(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=iS(u):(u=l_(r)?Wz:sy.current,u=x6(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)&&yNt(e,a,n,u),SL=!1,f=e.memoizedState,a.state=f,wye(e,n,a,o);var m=e.memoizedState;s!==d||f!==m||u_.current||SL?(typeof p=="function"&&(HJe(e,r,p,n),m=e.memoizedState),(l=SL||gNt(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 GJe(t,e,r,n,i,o)}function GJe(t,e,r,n,o,i){hjt(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&dNt(e,r,!1),TN(t,e,i);n=e.stateNode,rwn.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=T6(e,t.child,null,i),e.child=T6(e,null,s,i)):lb(t,e,s,i),e.memoizedState=n.state,o&&dNt(e,r,!0),e.child}function gjt(t){var e=t.stateNode;e.pendingContext?cNt(t,e.pendingContext,e.pendingContext!==e.context):e.context&&cNt(t,e.context,!1),R3e(t,e.containerInfo)}function ENt(t,e,r,n,o){return O6(),O3e(o),e.flags|=256,lb(t,e,r,n),e.child}var XJe={dehydrated:null,treeContext:null,retryLane:0};function ZJe(t){return{baseLanes:t,cachePool:null,transitions:null}}function yjt(t,e,r){var n=e.pendingProps,o=sc.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(sc,o&1),t===null)return zJe(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=qye(a,n,0,null),t=Jz(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=ZJe(r),e.memoizedState=XJe,t):k3e(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return nwn(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=jL(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=jL(s,i):(i=Jz(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?ZJe(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=XJe,n}return i=t.child,t=i.sibling,n=jL(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 k3e(t,e){return e=qye({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Wge(t,e,r,n){return n!==null&&O3e(n),T6(e,t.child,null,r),t=k3e(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function nwn(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=dJe(Error(ut(422))),Wge(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=qye({mode:"visible",children:n.children},o,0,null),i=Jz(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&T6(e,t.child,null,a),e.child.memoizedState=ZJe(a),e.memoizedState=XJe,i);if((e.mode&1)===0)return Wge(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(ut(419)),n=dJe(i,n,void 0),Wge(t,e,a,n)}if(s=(a&t.childLanes)!==0,s_||s){if(n=ih,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,ON(t,o),cC(n,t,o,-1))}return H3e(),n=dJe(Error(ut(421))),Wge(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=gwn.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,Ov=IL(o.nextSibling),Tv=e,jl=!0,uC=null,t!==null&&(tS[rS++]=vN,tS[rS++]=wN,tS[rS++]=Kz,vN=t.id,wN=t.overflow,Kz=e),e=k3e(e,n.children),e.flags|=4096,e)}function PNt(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),VJe(t.return,e,r)}function fJe(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 bjt(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if(lb(t,e,n.children,r),n=sc.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&&PNt(t,r,e);else if(t.tag===19)PNt(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(sc,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&&Sye(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),fJe(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&&Sye(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}fJe(e,!0,r,null,i);break;case"together":fJe(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function rye(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function TN(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),Xz|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(ut(153));if(e.child!==null){for(t=e.child,r=jL(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=jL(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function own(t,e,r){switch(e.tag){case 3:gjt(e),O6();break;case 5:H1t(e);break;case 1:l_(e.type)&&gye(e);break;case 4:R3e(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;zu(_ye,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(zu(sc,sc.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?yjt(t,e,r):(zu(sc,sc.current&1),t=TN(t,e,r),t!==null?t.sibling:null);zu(sc,sc.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return bjt(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),zu(sc,sc.current),n)break;return null;case 22:case 23:return e.lanes=0,mjt(t,e,r)}return TN(t,e,r)}var _jt,YJe,vjt,wjt;_jt=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}};YJe=function(){};vjt=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,Vz(MO.current);var i=null;switch(r){case"input":o=vJe(t,o),n=vJe(t,n),i=[];break;case"select":o=lc({},o,{value:void 0}),n=lc({},n,{value:void 0}),i=[];break;case"textarea":o=CJe(t,o),n=CJe(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=mye)}OJe(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"&&(dte.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"&&(dte.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&sl("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)}};wjt=function(t,e,r,n){r!==n&&(e.flags|=4)};function Gee(t,e){if(!jl)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 iy(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 iwn(t,e,r){var n=e.pendingProps;switch(x3e(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return iy(e),null;case 1:return l_(e.type)&&hye(),iy(e),null;case 3:return n=e.stateNode,E6(),ul(u_),ul(sy),N3e(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Hge(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,uC!==null&&(a3e(uC),uC=null))),YJe(t,e),iy(e),null;case 5:A3e(e);var o=Vz(Cte.current);if(r=e.type,t!==null&&e.stateNode!=null)vjt(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(ut(166));return iy(e),null}if(t=Vz(MO.current),Hge(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[EO]=e,n[wte]=i,t=(e.mode&1)!==0,r){case"dialog":sl("cancel",n),sl("close",n);break;case"iframe":case"object":case"embed":sl("load",n);break;case"video":case"audio":for(o=0;o<tte.length;o++)sl(tte[o],n);break;case"source":sl("error",n);break;case"img":case"image":case"link":sl("error",n),sl("load",n);break;case"details":sl("toggle",n);break;case"input":$At(n,i),sl("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},sl("invalid",n);break;case"textarea":FAt(n,i),sl("invalid",n)}OJe(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&&Vge(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&Vge(n.textContent,s,t),o=["children",""+s]):dte.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&sl("scroll",n)}switch(r){case"input":Age(n),LAt(n,i,!0);break;case"textarea":Age(n),kAt(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=mye)}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=KNt(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[EO]=e,t[wte]=n,_jt(t,e,!1,!1),e.stateNode=t;e:{switch(a=TJe(r,n),r){case"dialog":sl("cancel",t),sl("close",t),o=n;break;case"iframe":case"object":case"embed":sl("load",t),o=n;break;case"video":case"audio":for(o=0;o<tte.length;o++)sl(tte[o],t);o=n;break;case"source":sl("error",t),o=n;break;case"img":case"image":case"link":sl("error",t),sl("load",t),o=n;break;case"details":sl("toggle",t),o=n;break;case"input":$At(t,n),o=vJe(t,n),sl("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=lc({},n,{value:void 0}),sl("invalid",t);break;case"textarea":FAt(t,n),o=CJe(t,n),sl("invalid",t);break;default:o=n}OJe(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?ZNt(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&GNt(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&fte(t,u):typeof u=="number"&&fte(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(dte.hasOwnProperty(i)?u!=null&&i==="onScroll"&&sl("scroll",t):u!=null&&l3e(t,i,u,a))}switch(r){case"input":Age(t),LAt(t,n,!1);break;case"textarea":Age(t),kAt(t);break;case"option":n.value!=null&&t.setAttribute("value",""+DL(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?y6(t,!!n.multiple,i,!1):n.defaultValue!=null&&y6(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=mye)}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 iy(e),null;case 6:if(t&&e.stateNode!=null)wjt(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(ut(166));if(r=Vz(Cte.current),Vz(MO.current),Hge(e)){if(n=e.stateNode,r=e.memoizedProps,n[EO]=e,(i=n.nodeValue!==r)&&(t=Tv,t!==null))switch(t.tag){case 3:Vge(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Vge(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[EO]=e,e.stateNode=n}return iy(e),null;case 13:if(ul(sc),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(jl&&Ov!==null&&(e.mode&1)!==0&&(e.flags&128)===0)F1t(),O6(),e.flags|=98560,i=!1;else if(i=Hge(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(ut(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ut(317));i[EO]=e}else O6(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;iy(e),i=!1}else uC!==null&&(a3e(uC),uC=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||(sc.current&1)!==0?gm===0&&(gm=3):H3e())),e.updateQueue!==null&&(e.flags|=4),iy(e),null);case 4:return E6(),YJe(t,e),t===null&&_te(e.stateNode.containerInfo),iy(e),null;case 10:return P3e(e.type._context),iy(e),null;case 17:return l_(e.type)&&hye(),iy(e),null;case 19:if(ul(sc),i=e.memoizedState,i===null)return iy(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)Gee(i,!1);else{if(gm!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(a=Sye(t),a!==null){for(e.flags|=128,Gee(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(sc,sc.current&1|2),e.child}t=t.sibling}i.tail!==null&&zc()>M6&&(e.flags|=128,n=!0,Gee(i,!1),e.lanes=4194304)}else{if(!n)if(t=Sye(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),Gee(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!jl)return iy(e),null}else 2*zc()-i.renderingStartTime>M6&&r!==1073741824&&(e.flags|=128,n=!0,Gee(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=zc(),e.sibling=null,r=sc.current,zu(sc,n?r&1|2:r&1),e):(iy(e),null);case 22:case 23:return V3e(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(xv&1073741824)!==0&&(iy(e),e.subtreeFlags&6&&(e.flags|=8192)):iy(e),null;case 24:return null;case 25:return null}throw Error(ut(156,e.tag))}function awn(t,e){switch(x3e(e),e.tag){case 1:return l_(e.type)&&hye(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return E6(),ul(u_),ul(sy),N3e(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return A3e(e),null;case 13:if(ul(sc),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ut(340));O6()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ul(sc),null;case 4:return E6(),null;case 10:return P3e(e.type._context),null;case 22:case 23:return V3e(),null;case 24:return null;default:return null}}var Kge=!1,ay=!1,swn=typeof WeakSet=="function"?WeakSet:Set,xr=null;function h6(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Oc(t,e,n)}else r.current=null}function QJe(t,e,r){try{r()}catch(n){Oc(t,e,n)}}var MNt=!1;function uwn(t,e){if($Je=dye,t=O1t(),S3e(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(LJe={focusedElem:t,selectionRange:r},dye=!1,xr=e;xr!==null;)if(e=xr,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,xr=t;else for(;xr!==null;){e=xr;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:aC(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(ut(163))}}catch(w){Oc(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,xr=t;break}xr=e.return}return m=MNt,MNt=!1,m}function ute(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&&QJe(e,r,i)}o=o.next}while(o!==n)}}function Fye(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 e3e(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 Sjt(t){var e=t.alternate;e!==null&&(t.alternate=null,Sjt(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[EO],delete e[wte],delete e[qJe],delete e[Vvn],delete e[Hvn])),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 Cjt(t){return t.tag===5||t.tag===3||t.tag===4}function INt(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Cjt(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 t3e(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=mye));else if(n!==4&&(t=t.child,t!==null))for(t3e(t,e,r),t=t.sibling;t!==null;)t3e(t,e,r),t=t.sibling}function r3e(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(r3e(t,e,r),t=t.sibling;t!==null;)r3e(t,e,r),t=t.sibling}var rg=null,sC=!1;function vL(t,e,r){for(r=r.child;r!==null;)xjt(t,e,r),r=r.sibling}function xjt(t,e,r){if(PO&&typeof PO.onCommitFiberUnmount=="function")try{PO.onCommitFiberUnmount(Iye,r)}catch{}switch(r.tag){case 5:ay||h6(r,e);case 6:var n=rg,o=sC;rg=null,vL(t,e,r),rg=n,sC=o,rg!==null&&(sC?(t=rg,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):rg.removeChild(r.stateNode));break;case 18:rg!==null&&(sC?(t=rg,r=r.stateNode,t.nodeType===8?iJe(t.parentNode,r):t.nodeType===1&&iJe(t,r),gte(t)):iJe(rg,r.stateNode));break;case 4:n=rg,o=sC,rg=r.stateNode.containerInfo,sC=!0,vL(t,e,r),rg=n,sC=o;break;case 0:case 11:case 14:case 15:if(!ay&&(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)&&QJe(r,e,a),o=o.next}while(o!==n)}vL(t,e,r);break;case 1:if(!ay&&(h6(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Oc(r,e,s)}vL(t,e,r);break;case 21:vL(t,e,r);break;case 22:r.mode&1?(ay=(n=ay)||r.memoizedState!==null,vL(t,e,r),ay=n):vL(t,e,r);break;default:vL(t,e,r)}}function RNt(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new swn),e.forEach(function(n){var o=ywn.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function iC(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:rg=s.stateNode,sC=!1;break e;case 3:rg=s.stateNode.containerInfo,sC=!0;break e;case 4:rg=s.stateNode.containerInfo,sC=!0;break e}s=s.return}if(rg===null)throw Error(ut(160));xjt(i,a,o),rg=null,sC=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){Oc(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Ojt(e,t),e=e.sibling}function Ojt(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(iC(e,t),OO(t),n&4){try{ute(3,t,t.return),Fye(3,t)}catch(h){Oc(t,t.return,h)}try{ute(5,t,t.return)}catch(h){Oc(t,t.return,h)}}break;case 1:iC(e,t),OO(t),n&512&&r!==null&&h6(r,r.return);break;case 5:if(iC(e,t),OO(t),n&512&&r!==null&&h6(r,r.return),t.flags&32){var o=t.stateNode;try{fte(o,"")}catch(h){Oc(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&&JNt(o,i),TJe(s,a);var l=TJe(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?ZNt(o,d):c==="dangerouslySetInnerHTML"?GNt(o,d):c==="children"?fte(o,d):l3e(o,c,d,l)}switch(s){case"input":wJe(o,i);break;case"textarea":WNt(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?y6(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?y6(o,!!i.multiple,i.defaultValue,!0):y6(o,!!i.multiple,i.multiple?[]:"",!1))}o[wte]=i}catch(h){Oc(t,t.return,h)}}break;case 6:if(iC(e,t),OO(t),n&4){if(t.stateNode===null)throw Error(ut(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(h){Oc(t,t.return,h)}}break;case 3:if(iC(e,t),OO(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{gte(e.containerInfo)}catch(h){Oc(t,t.return,h)}break;case 4:iC(e,t),OO(t);break;case 13:iC(e,t),OO(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(B3e=zc())),n&4&&RNt(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(ay=(l=ay)||c,iC(e,t),ay=l):iC(e,t),OO(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&(t.mode&1)!==0)for(xr=t,c=t.child;c!==null;){for(d=xr=c;xr!==null;){switch(f=xr,p=f.child,f.tag){case 0:case 11:case 14:case 15:ute(4,f,f.return);break;case 1:h6(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){Oc(n,r,h)}}break;case 5:h6(f,f.return);break;case 22:if(f.memoizedState!==null){NNt(d);continue}}p!==null?(p.return=f,xr=p):NNt(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=XNt("display",a))}catch(h){Oc(t,t.return,h)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(h){Oc(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:iC(e,t),OO(t),n&4&&RNt(t);break;case 21:break;default:iC(e,t),OO(t)}}function OO(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(Cjt(r)){var n=r;break e}r=r.return}throw Error(ut(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(fte(o,""),n.flags&=-33);var i=INt(t);r3e(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=INt(t);t3e(t,s,a);break;default:throw Error(ut(161))}}catch(u){Oc(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function lwn(t,e,r){xr=t,Tjt(t,e,r)}function Tjt(t,e,r){for(var n=(t.mode&1)!==0;xr!==null;){var o=xr,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||Kge;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||ay;s=Kge;var l=ay;if(Kge=a,(ay=u)&&!l)for(xr=o;xr!==null;)a=xr,u=a.child,a.tag===22&&a.memoizedState!==null?jNt(o):u!==null?(u.return=a,xr=u):jNt(o);for(;i!==null;)xr=i,Tjt(i,e,r),i=i.sibling;xr=o,Kge=s,ay=l}ANt(t,e,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,xr=i):ANt(t,e,r)}}function ANt(t){for(;xr!==null;){var e=xr;if((e.flags&8772)!==0){var r=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:ay||Fye(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!ay)if(r===null)n.componentDidMount();else{var o=e.elementType===e.type?r.memoizedProps:aC(e.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&hNt(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}hNt(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&>e(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ut(163))}ay||e.flags&512&&e3e(e)}catch(f){Oc(e,e.return,f)}}if(e===t){xr=null;break}if(r=e.sibling,r!==null){r.return=e.return,xr=r;break}xr=e.return}}function NNt(t){for(;xr!==null;){var e=xr;if(e===t){xr=null;break}var r=e.sibling;if(r!==null){r.return=e.return,xr=r;break}xr=e.return}}function jNt(t){for(;xr!==null;){var e=xr;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{Fye(4,e)}catch(u){Oc(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){Oc(e,o,u)}}var i=e.return;try{e3e(e)}catch(u){Oc(e,i,u)}break;case 5:var a=e.return;try{e3e(e)}catch(u){Oc(e,a,u)}}}catch(u){Oc(e,e.return,u)}if(e===t){xr=null;break}var s=e.sibling;if(s!==null){s.return=e.return,xr=s;break}xr=e.return}}var cwn=Math.ceil,Oye=EN.ReactCurrentDispatcher,q3e=EN.ReactCurrentOwner,oS=EN.ReactCurrentBatchConfig,es=0,ih=null,cd=null,ng=0,xv=0,g6=FL(0),gm=0,Ete=null,Xz=0,kye=0,U3e=0,lte=null,a_=null,B3e=0,M6=1/0,bN=null,Tye=!1,n3e=null,AL=null,Gge=!1,TL=null,Eye=0,cte=0,o3e=null,nye=-1,oye=0;function cb(){return(es&6)!==0?zc():nye!==-1?nye:nye=zc()}function NL(t){return(t.mode&1)===0?1:(es&2)!==0&&ng!==0?ng&-ng:Wvn.transition!==null?(oye===0&&(oye=l1t()),oye):(t=ru,t!==0||(t=window.event,t=t===void 0?16:g1t(t.type)),t)}function cC(t,e,r,n){if(50<cte)throw cte=0,o3e=null,Error(ut(185));Pte(t,r,n),((es&2)===0||t!==ih)&&(t===ih&&((es&2)===0&&(kye|=r),gm===4&&xL(t,ng)),c_(t,n),r===1&&es===0&&(e.mode&1)===0&&(M6=zc()+500,Dye&&kL()))}function c_(t,e){var r=t.callbackNode;G_n(t,e);var n=cye(t,t===ih?ng:0);if(n===0)r!==null&&BAt(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&BAt(r),e===1)t.tag===0?Jvn(DNt.bind(null,t)):D1t(DNt.bind(null,t)),Bvn(function(){(es&6)===0&&kL()}),r=null;else{switch(c1t(n)){case 1:r=m3e;break;case 4:r=s1t;break;case 16:r=lye;break;case 536870912:r=u1t;break;default:r=lye}r=jjt(r,Ejt.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function Ejt(t,e){if(nye=-1,oye=0,(es&6)!==0)throw Error(ut(327));var r=t.callbackNode;if(S6()&&t.callbackNode!==r)return null;var n=cye(t,t===ih?ng:0);if(n===0)return null;if((n&30)!==0||(n&t.expiredLanes)!==0||e)e=Pye(t,n);else{e=n;var o=es;es|=2;var i=Mjt();(ih!==t||ng!==e)&&(bN=null,M6=zc()+500,Hz(t,e));do try{pwn();break}catch(s){Pjt(t,s)}while(!0);E3e(),Oye.current=i,es=o,cd!==null?e=0:(ih=null,ng=0,e=gm)}if(e!==0){if(e===2&&(o=RJe(t),o!==0&&(n=o,e=i3e(t,o))),e===1)throw r=Ete,Hz(t,0),xL(t,n),c_(t,zc()),r;if(e===6)xL(t,n);else{if(o=t.current.alternate,(n&30)===0&&!dwn(o)&&(e=Pye(t,n),e===2&&(i=RJe(t),i!==0&&(n=i,e=i3e(t,i))),e===1))throw r=Ete,Hz(t,0),xL(t,n),c_(t,zc()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(ut(345));case 2:Uz(t,a_,bN);break;case 3:if(xL(t,n),(n&130023424)===n&&(e=B3e+500-zc(),10<e)){if(cye(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){cb(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=kJe(Uz.bind(null,t,a_,bN),e);break}Uz(t,a_,bN);break;case 4:if(xL(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-lC(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=zc()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*cwn(n/1960))-n,10<n){t.timeoutHandle=kJe(Uz.bind(null,t,a_,bN),n);break}Uz(t,a_,bN);break;case 5:Uz(t,a_,bN);break;default:throw Error(ut(329))}}}return c_(t,zc()),t.callbackNode===r?Ejt.bind(null,t):null}function i3e(t,e){var r=lte;return t.current.memoizedState.isDehydrated&&(Hz(t,e).flags|=256),t=Pye(t,e),t!==2&&(e=a_,a_=r,e!==null&&a3e(e)),t}function a3e(t){a_===null?a_=t:a_.push.apply(a_,t)}function dwn(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(!dC(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 xL(t,e){for(e&=~U3e,e&=~kye,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-lC(e),n=1<<r;t[r]=-1,e&=~n}}function DNt(t){if((es&6)!==0)throw Error(ut(327));S6();var e=cye(t,0);if((e&1)===0)return c_(t,zc()),null;var r=Pye(t,e);if(t.tag!==0&&r===2){var n=RJe(t);n!==0&&(e=n,r=i3e(t,n))}if(r===1)throw r=Ete,Hz(t,0),xL(t,e),c_(t,zc()),r;if(r===6)throw Error(ut(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Uz(t,a_,bN),c_(t,zc()),null}function z3e(t,e){var r=es;es|=1;try{return t(e)}finally{es=r,es===0&&(M6=zc()+500,Dye&&kL())}}function Zz(t){TL!==null&&TL.tag===0&&(es&6)===0&&S6();var e=es;es|=1;var r=oS.transition,n=ru;try{if(oS.transition=null,ru=1,t)return t()}finally{ru=n,oS.transition=r,es=e,(es&6)===0&&kL()}}function V3e(){xv=g6.current,ul(g6)}function Hz(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,Uvn(r)),cd!==null)for(r=cd.return;r!==null;){var n=r;switch(x3e(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&hye();break;case 3:E6(),ul(u_),ul(sy),N3e();break;case 5:A3e(n);break;case 4:E6();break;case 13:ul(sc);break;case 19:ul(sc);break;case 10:P3e(n.type._context);break;case 22:case 23:V3e()}r=r.return}if(ih=t,cd=t=jL(t.current,null),ng=xv=e,gm=0,Ete=null,U3e=kye=Xz=0,a_=lte=null,zz!==null){for(e=0;e<zz.length;e++)if(r=zz[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}zz=null}return t}function Pjt(t,e){do{var r=cd;try{if(E3e(),eye.current=xye,Cye){for(var n=uc.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}Cye=!1}if(Gz=0,oh=hm=uc=null,ste=!1,xte=0,q3e.current=null,r===null||r.return===null){gm=1,Ete=e,cd=null;break}e:{var i=t,a=r.return,s=r,u=e;if(e=ng,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=SNt(a);if(p!==null){p.flags&=-257,CNt(p,a,s,i,e),p.mode&1&&wNt(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){wNt(i,l,e),H3e();break e}u=Error(ut(426))}}else if(jl&&s.mode&1){var y=SNt(a);if(y!==null){(y.flags&65536)===0&&(y.flags|=256),CNt(y,a,s,i,e),O3e(P6(u,s));break e}}i=u=P6(u,s),gm!==4&&(gm=2),lte===null?lte=[i]:lte.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=djt(i,u,e);mNt(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"&&(AL===null||!AL.has(_)))){i.flags|=65536,e&=-e,i.lanes|=e;var w=fjt(i,s,e);mNt(i,w);break e}}i=i.return}while(i!==null)}Rjt(r)}catch(O){e=O,cd===r&&r!==null&&(cd=r=r.return);continue}break}while(!0)}function Mjt(){var t=Oye.current;return Oye.current=xye,t===null?xye:t}function H3e(){(gm===0||gm===3||gm===2)&&(gm=4),ih===null||(Xz&268435455)===0&&(kye&268435455)===0||xL(ih,ng)}function Pye(t,e){var r=es;es|=2;var n=Mjt();(ih!==t||ng!==e)&&(bN=null,Hz(t,e));do try{fwn();break}catch(o){Pjt(t,o)}while(!0);if(E3e(),es=r,Oye.current=n,cd!==null)throw Error(ut(261));return ih=null,ng=0,gm}function fwn(){for(;cd!==null;)Ijt(cd)}function pwn(){for(;cd!==null&&!q_n();)Ijt(cd)}function Ijt(t){var e=Njt(t.alternate,t,xv);t.memoizedProps=t.pendingProps,e===null?Rjt(t):cd=e,q3e.current=null}function Rjt(t){var e=t;do{var r=e.alternate;if(t=e.return,(e.flags&32768)===0){if(r=iwn(r,e,xv),r!==null){cd=r;return}}else{if(r=awn(r,e),r!==null){r.flags&=32767,cd=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{gm=6,cd=null;return}}if(e=e.sibling,e!==null){cd=e;return}cd=e=t}while(e!==null);gm===0&&(gm=5)}function Uz(t,e,r){var n=ru,o=oS.transition;try{oS.transition=null,ru=1,mwn(t,e,r,n)}finally{oS.transition=o,ru=n}return null}function mwn(t,e,r,n){do S6();while(TL!==null);if((es&6)!==0)throw Error(ut(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(ut(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(X_n(t,i),t===ih&&(cd=ih=null,ng=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||Gge||(Gge=!0,jjt(lye,function(){return S6(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=oS.transition,oS.transition=null;var a=ru;ru=1;var s=es;es|=4,q3e.current=null,uwn(t,r),Ojt(r,t),$vn(LJe),dye=!!$Je,LJe=$Je=null,t.current=r,lwn(r,t,o),U_n(),es=s,ru=a,oS.transition=i}else t.current=r;if(Gge&&(Gge=!1,TL=t,Eye=o),i=t.pendingLanes,i===0&&(AL=null),V_n(r.stateNode,n),c_(t,zc()),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(Tye)throw Tye=!1,t=n3e,n3e=null,t;return(Eye&1)!==0&&t.tag!==0&&S6(),i=t.pendingLanes,(i&1)!==0?t===o3e?cte++:(cte=0,o3e=t):cte=0,kL(),null}function S6(){if(TL!==null){var t=c1t(Eye),e=oS.transition,r=ru;try{if(oS.transition=null,ru=16>t?16:t,TL===null)var n=!1;else{if(t=TL,TL=null,Eye=0,(es&6)!==0)throw Error(ut(331));var o=es;for(es|=4,xr=t.current;xr!==null;){var i=xr,a=i.child;if((xr.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(xr=l;xr!==null;){var c=xr;switch(c.tag){case 0:case 11:case 15:ute(8,c,i)}var d=c.child;if(d!==null)d.return=c,xr=d;else for(;xr!==null;){c=xr;var f=c.sibling,p=c.return;if(Sjt(c),c===l){xr=null;break}if(f!==null){f.return=p,xr=f;break}xr=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)}}xr=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,xr=a;else e:for(;xr!==null;){if(i=xr,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:ute(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,xr=g;break e}xr=i.return}}var b=t.current;for(xr=b;xr!==null;){a=xr;var _=a.child;if((a.subtreeFlags&2064)!==0&&_!==null)_.return=a,xr=_;else e:for(a=b;xr!==null;){if(s=xr,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:Fye(9,s)}}catch(O){Oc(s,s.return,O)}if(s===a){xr=null;break e}var w=s.sibling;if(w!==null){w.return=s.return,xr=w;break e}xr=s.return}}if(es=o,kL(),PO&&typeof PO.onPostCommitFiberRoot=="function")try{PO.onPostCommitFiberRoot(Iye,t)}catch{}n=!0}return n}finally{ru=r,oS.transition=e}}return!1}function $Nt(t,e,r){e=P6(r,e),e=djt(t,e,1),t=RL(t,e,1),e=cb(),t!==null&&(Pte(t,1,e),c_(t,e))}function Oc(t,e,r){if(t.tag===3)$Nt(t,t,r);else for(;e!==null;){if(e.tag===3){$Nt(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(AL===null||!AL.has(n))){t=P6(r,t),t=fjt(e,t,1),e=RL(e,t,1),t=cb(),e!==null&&(Pte(e,1,t),c_(e,t));break}}e=e.return}}function hwn(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=cb(),t.pingedLanes|=t.suspendedLanes&r,ih===t&&(ng&r)===r&&(gm===4||gm===3&&(ng&130023424)===ng&&500>zc()-B3e?Hz(t,0):U3e|=r),c_(t,e)}function Ajt(t,e){e===0&&((t.mode&1)===0?e=1:(e=Dge,Dge<<=1,(Dge&130023424)===0&&(Dge=4194304)));var r=cb();t=ON(t,e),t!==null&&(Pte(t,e,r),c_(t,r))}function gwn(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),Ajt(t,r)}function ywn(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(ut(314))}n!==null&&n.delete(e),Ajt(t,r)}var Njt;Njt=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||u_.current)s_=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return s_=!1,own(t,e,r);s_=(t.flags&131072)!==0}else s_=!1,jl&&(e.flags&1048576)!==0&&$1t(e,bye,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;rye(t,e),t=e.pendingProps;var o=x6(e,sy.current);w6(e,r),o=D3e(null,e,n,t,o,r);var i=$3e();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,l_(n)?(i=!0,gye(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,I3e(e),o.updater=$ye,e.stateNode=o,o._reactInternals=e,JJe(e,n,t,r),e=GJe(null,e,n,!0,i,r)):(e.tag=0,jl&&i&&C3e(e),lb(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(rye(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=_wn(n),t=aC(n,t),o){case 0:e=KJe(null,e,n,t,r);break e;case 1:e=TNt(null,e,n,t,r);break e;case 11:e=xNt(null,e,n,t,r);break e;case 14:e=ONt(null,e,n,aC(n.type,t),r);break e}throw Error(ut(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:aC(n,o),KJe(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:aC(n,o),TNt(t,e,n,o,r);case 3:e:{if(gjt(e),t===null)throw Error(ut(387));n=e.pendingProps,i=e.memoizedState,o=i.element,q1t(t,e),wye(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=P6(Error(ut(423)),e),e=ENt(t,e,n,r,o);break e}else if(n!==o){o=P6(Error(ut(424)),e),e=ENt(t,e,n,r,o);break e}else for(Ov=IL(e.stateNode.containerInfo.firstChild),Tv=e,jl=!0,uC=null,r=V1t(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(O6(),n===o){e=TN(t,e,r);break e}lb(t,e,n,r)}e=e.child}return e;case 5:return H1t(e),t===null&&zJe(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,FJe(n,o)?a=null:i!==null&&FJe(n,i)&&(e.flags|=32),hjt(t,e),lb(t,e,a,r),e.child;case 6:return t===null&&zJe(e),null;case 13:return yjt(t,e,r);case 4:return R3e(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=T6(e,null,n,r):lb(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:aC(n,o),xNt(t,e,n,o,r);case 7:return lb(t,e,e.pendingProps,r),e.child;case 8:return lb(t,e,e.pendingProps.children,r),e.child;case 12:return lb(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(_ye,n._currentValue),n._currentValue=a,i!==null)if(dC(i.value,a)){if(i.children===o.children&&!u_.current){e=TN(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=SN(-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),VJe(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(ut(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),VJe(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}lb(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,w6(e,r),o=iS(o),n=n(o),e.flags|=1,lb(t,e,n,r),e.child;case 14:return n=e.type,o=aC(n,e.pendingProps),o=aC(n.type,o),ONt(t,e,n,o,r);case 15:return pjt(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:aC(n,o),rye(t,e),e.tag=1,l_(n)?(t=!0,gye(e)):t=!1,w6(e,r),B1t(e,n,o),JJe(e,n,o,r),GJe(null,e,n,!0,t,r);case 19:return bjt(t,e,r);case 22:return mjt(t,e,r)}throw Error(ut(156,e.tag))};function jjt(t,e){return a1t(t,e)}function bwn(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 nS(t,e,r,n){return new bwn(t,e,r,n)}function J3e(t){return t=t.prototype,!(!t||!t.isReactComponent)}function _wn(t){if(typeof t=="function")return J3e(t)?1:0;if(t!=null){if(t=t.$$typeof,t===d3e)return 11;if(t===f3e)return 14}return 2}function jL(t,e){var r=t.alternate;return r===null?(r=nS(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 iye(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")J3e(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case a6:return Jz(r.children,o,i,e);case c3e:a=8,o|=8;break;case gJe:return t=nS(12,r,e,o|2),t.elementType=gJe,t.lanes=i,t;case yJe:return t=nS(13,r,e,o),t.elementType=yJe,t.lanes=i,t;case bJe:return t=nS(19,r,e,o),t.elementType=bJe,t.lanes=i,t;case zNt:return qye(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case UNt:a=10;break e;case BNt:a=9;break e;case d3e:a=11;break e;case f3e:a=14;break e;case wL:a=16,n=null;break e}throw Error(ut(130,t==null?t:typeof t,""))}return e=nS(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function Jz(t,e,r,n){return t=nS(7,t,n,e),t.lanes=r,t}function qye(t,e,r,n){return t=nS(22,t,n,e),t.elementType=zNt,t.lanes=r,t.stateNode={isHidden:!1},t}function pJe(t,e,r){return t=nS(6,t,null,e),t.lanes=r,t}function mJe(t,e,r){return e=nS(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function vwn(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=ZHe(0),this.expirationTimes=ZHe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ZHe(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function W3e(t,e,r,n,o,i,a,s,u){return t=new vwn(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=nS(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},I3e(i),t}function wwn(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i6,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function Djt(t){if(!t)return $L;t=t._reactInternals;e:{if(Qz(t)!==t||t.tag!==1)throw Error(ut(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(l_(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(ut(171))}if(t.tag===1){var r=t.type;if(l_(r))return j1t(t,r,e)}return e}function $jt(t,e,r,n,o,i,a,s,u){return t=W3e(r,n,!0,t,o,i,a,s,u),t.context=Djt(null),r=t.current,n=cb(),o=NL(r),i=SN(n,o),i.callback=e??null,RL(r,i,o),t.current.lanes=o,Pte(t,o,n),c_(t,n),t}function Uye(t,e,r,n){var o=e.current,i=cb(),a=NL(o);return r=Djt(r),e.context===null?e.context=r:e.pendingContext=r,e=SN(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=RL(o,e,a),t!==null&&(cC(t,o,a,i),Qge(t,o,a)),a}function Mye(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 LNt(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function K3e(t,e){LNt(t,e),(t=t.alternate)&&LNt(t,e)}function Swn(){return null}var Ljt=typeof reportError=="function"?reportError:function(t){console.error(t)};function G3e(t){this._internalRoot=t}Bye.prototype.render=G3e.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(ut(409));Uye(t,e,null,null)};Bye.prototype.unmount=G3e.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Zz(function(){Uye(null,t,null,null)}),e[xN]=null}};function Bye(t){this._internalRoot=t}Bye.prototype.unstable_scheduleHydration=function(t){if(t){var e=p1t();t={blockedOn:null,target:t,priority:e};for(var r=0;r<CL.length&&e!==0&&e<CL[r].priority;r++);CL.splice(r,0,t),r===0&&h1t(t)}};function X3e(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function zye(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function FNt(){}function Cwn(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=Mye(a);i.call(l)}}var a=$jt(e,n,t,0,null,!1,!1,"",FNt);return t._reactRootContainer=a,t[xN]=a.current,_te(t.nodeType===8?t.parentNode:t),Zz(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=Mye(u);s.call(l)}}var u=W3e(t,0,!1,null,null,!1,!1,"",FNt);return t._reactRootContainer=u,t[xN]=u.current,_te(t.nodeType===8?t.parentNode:t),Zz(function(){Uye(e,u,r,n)}),u}function Vye(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=Mye(a);s.call(u)}}Uye(e,a,t,o)}else a=Cwn(r,e,t,o,n);return Mye(a)}d1t=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=ete(e.pendingLanes);r!==0&&(h3e(e,r|1),c_(e,zc()),(es&6)===0&&(M6=zc()+500,kL()))}break;case 13:Zz(function(){var n=ON(t,1);if(n!==null){var o=cb();cC(n,t,1,o)}}),K3e(t,1)}};g3e=function(t){if(t.tag===13){var e=ON(t,134217728);if(e!==null){var r=cb();cC(e,t,134217728,r)}K3e(t,134217728)}};f1t=function(t){if(t.tag===13){var e=NL(t),r=ON(t,e);if(r!==null){var n=cb();cC(r,t,e,n)}K3e(t,e)}};p1t=function(){return ru};m1t=function(t,e){var r=ru;try{return ru=t,e()}finally{ru=r}};PJe=function(t,e,r){switch(e){case"input":if(wJe(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=jye(n);if(!o)throw Error(ut(90));HNt(n),wJe(n,o)}}}break;case"textarea":WNt(t,r);break;case"select":e=r.value,e!=null&&y6(t,!!r.multiple,e,!1)}};e1t=z3e;t1t=Zz;var xwn={usingClientEntryPoint:!1,Events:[Ite,c6,jye,YNt,QNt,z3e]},Xee={findFiberByHostInstance:Bz,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},Own={bundleType:Xee.bundleType,version:Xee.version,rendererPackageName:Xee.rendererPackageName,rendererConfig:Xee.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:EN.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=o1t(t),t===null?null:t.stateNode},findFiberByHostInstance:Xee.findFiberByHostInstance||Swn,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Zee=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Zee.isDisabled&&Zee.supportsFiber))try{Iye=Zee.inject(Own),PO=Zee}catch{}var Zee;Mv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xwn;Mv.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!X3e(e))throw Error(ut(200));return wwn(t,e,null,r)};Mv.createRoot=function(t,e){if(!X3e(t))throw Error(ut(299));var r=!1,n="",o=Ljt;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=W3e(t,1,!1,null,null,r,!1,n,o),t[xN]=e.current,_te(t.nodeType===8?t.parentNode:t),new G3e(e)};Mv.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(ut(188)):(t=Object.keys(t).join(","),Error(ut(268,t)));return t=o1t(e),t=t===null?null:t.stateNode,t};Mv.flushSync=function(t){return Zz(t)};Mv.hydrate=function(t,e,r){if(!zye(e))throw Error(ut(200));return Vye(null,t,e,!0,r)};Mv.hydrateRoot=function(t,e,r){if(!X3e(t))throw Error(ut(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=Ljt;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=$jt(e,null,t,1,r??null,o,!1,i,a),t[xN]=e.current,_te(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 Bye(e)};Mv.render=function(t,e,r){if(!zye(e))throw Error(ut(200));return Vye(null,t,e,!1,r)};Mv.unmountComponentAtNode=function(t){if(!zye(t))throw Error(ut(40));return t._reactRootContainer?(Zz(function(){Vye(null,null,t,!1,function(){t._reactRootContainer=null,t[xN]=null})}),!0):!1};Mv.unstable_batchedUpdates=z3e;Mv.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!zye(r))throw Error(ut(200));if(t==null||t._reactInternals===void 0)throw Error(ut(38));return Vye(t,e,r,!1,n)};Mv.version="18.2.0-next-9e3b772b8-20220608"});var cu=S((NLi,qjt)=>{"use strict";function kjt(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(kjt)}catch(t){console.error(t)}}kjt(),qjt.exports=Fjt()});var dd=S(Z3e=>{"use strict";var Ujt=cu();Z3e.createRoot=Ujt.createRoot,Z3e.hydrateRoot=Ujt.hydrateRoot;var jLi});function Bjt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function zjt(...t){return e=>{let r=!1,n=t.map(o=>{let i=Bjt(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():Bjt(t[o],null)}}}}var Twn,Vjt=v(()=>{Twn=L(X(),1)});var Jjt=S(Hye=>{"use strict";var Ewn=X(),Pwn=Symbol.for("react.element"),Mwn=Symbol.for("react.fragment"),Iwn=Object.prototype.hasOwnProperty,Rwn=Ewn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Awn={key:!0,ref:!0,__self:!0,__source:!0};function Hjt(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)Iwn.call(e,n)&&!Awn.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:Pwn,type:t,key:i,ref:a,props:o,_owner:Rwn.current}}Hye.Fragment=Mwn;Hye.jsx=Hjt;Hye.jsxs=Hjt});var vr=S((FLi,Wjt)=>{"use strict";Wjt.exports=Jjt()});function Fn(t){let e=Nwn(t),r=ym.forwardRef((n,o)=>{let{children:i,...a}=n,s=ym.Children.toArray(i),u=s.find(jwn);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,A6.jsx)(e,{...a,ref:o,children:ym.isValidElement(l)?ym.cloneElement(l,void 0,c):null})}return(0,A6.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function Nwn(t){let e=ym.forwardRef((r,n)=>{let{children:o,...i}=r;if(ym.isValidElement(o)){let a=$wn(o),s=Dwn(i,o.props);return o.type!==ym.Fragment&&(s.ref=n?zjt(n,a):a),ym.cloneElement(o,s)}return ym.Children.count(o)>1?ym.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function Xjt(t){let e=({children:r})=>(0,A6.jsx)(A6.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=Gjt,e}function jwn(t){return ym.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Gjt}function Dwn(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 $wn(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 ym,A6,Kjt,Gjt,Vu=v(()=>{ym=L(X(),1);Vjt();A6=L(vr(),1);Kjt=Fn("Slot");Gjt=Symbol("radix.slottable")});function Zjt(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=Zjt(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Jye(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=Zjt(t))&&(n&&(n+=" "),n+=e);return n}var Y3e=v(()=>{});var Yjt,Qjt,N6,Wye=v(()=>{Y3e();Yjt=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Qjt=Jye,N6=(t,e)=>r=>{var n;if(e?.variants==null)return Qjt(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=Yjt(c)||Yjt(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 Qjt(t,a,u,r?.class,r?.className)}});function Kwn(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=aDt(e))&&(n&&(n+=" "),n+=r);return n}function rDt(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=Hwn(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=Wwn(u,r);return o(u,c),c}return function(){return i(Kwn.apply(null,arguments))}}var tWe,Lwn,oDt,eDt,Fwn,kwn,eWe,tDt,qwn,Uwn,Bwn,iDt,zwn,Vwn,Hwn,Jwn,Wwn,aDt,ll,sDt,Gwn,Xwn,Zwn,Ywn,Qwn,eSn,tSn,PN,qL,j6,Q3e,Ate,rSn,ei,UL,nSn,oSn,iSn,aSn,sSn,uSn,Nte,D6,lSn,uDt,cSn,dSn,nDt,fSn,jte,pSn,mSn,lDt,cDt=v(()=>{tWe="-",Lwn=t=>{let e=kwn(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(tWe);return s[0]===""&&s.length!==1&&s.shift(),oDt(s,e)||Fwn(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},oDt=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?oDt(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(tWe);return e.validators.find(({validator:a})=>a(i))?.classGroupId},eDt=/^\[(.+)\]$/,Fwn=t=>{if(eDt.test(t)){let e=eDt.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},kwn=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return Uwn(Object.entries(t.classGroups),r).forEach(([i,a])=>{eWe(a,n,i,e)}),n},eWe=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:tDt(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(qwn(o)){eWe(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{eWe(a,tDt(e,i),r,n)})})},tDt=(t,e)=>{let r=t;return e.split(tWe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},qwn=t=>t.isThemeGetter,Uwn=(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,Bwn=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)}}},iDt="!",zwn=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(iDt),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},Vwn=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},Hwn=t=>({cache:Bwn(t.cacheSize),parseClassName:zwn(t),...Lwn(t)}),Jwn=/\s+/,Wwn=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(Jwn),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=Vwn(c).join(":"),g=d?y+iDt:y,b=g+h;if(i.includes(b))continue;i.push(b);let _=o(h,m);for(let w=0;w<_.length;++w){let O=_[w];i.push(g+O)}s=l+(s.length>0?" "+s:s)}return s};aDt=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=aDt(t[n]))&&(r&&(r+=" "),r+=e);return r};ll=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},sDt=/^\[(?:([a-z-]+):)?(.+)\]$/i,Gwn=/^\d+\/\d+$/,Xwn=new Set(["px","full","screen"]),Zwn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ywn=/\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$/,Qwn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,eSn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tSn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,PN=t=>j6(t)||Xwn.has(t)||Gwn.test(t),qL=t=>D6(t,"length",lSn),j6=t=>!!t&&!Number.isNaN(Number(t)),Q3e=t=>D6(t,"number",j6),Ate=t=>!!t&&Number.isInteger(Number(t)),rSn=t=>t.endsWith("%")&&j6(t.slice(0,-1)),ei=t=>sDt.test(t),UL=t=>Zwn.test(t),nSn=new Set(["length","size","percentage"]),oSn=t=>D6(t,nSn,uDt),iSn=t=>D6(t,"position",uDt),aSn=new Set(["image","url"]),sSn=t=>D6(t,aSn,dSn),uSn=t=>D6(t,"",cSn),Nte=()=>!0,D6=(t,e,r)=>{let n=sDt.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},lSn=t=>Ywn.test(t)&&!Qwn.test(t),uDt=()=>!1,cSn=t=>eSn.test(t),dSn=t=>tSn.test(t),nDt=()=>{let t=ll("colors"),e=ll("spacing"),r=ll("blur"),n=ll("brightness"),o=ll("borderColor"),i=ll("borderRadius"),a=ll("borderSpacing"),s=ll("borderWidth"),u=ll("contrast"),l=ll("grayscale"),c=ll("hueRotate"),d=ll("invert"),f=ll("gap"),p=ll("gradientColorStops"),m=ll("gradientColorStopPositions"),h=ll("inset"),y=ll("margin"),g=ll("opacity"),b=ll("padding"),_=ll("saturate"),w=ll("scale"),O=ll("sepia"),T=ll("skew"),P=ll("space"),M=ll("translate"),I=()=>["auto","contain","none"],j=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",ei,e],k=()=>[ei,e],V=()=>["",PN,qL],q=()=>["auto",j6,ei],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",ei],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],se=()=>[j6,ei];return{cacheSize:500,separator:":",theme:{colors:[Nte],spacing:[PN,qL],blur:["none","",UL,ei],brightness:se(),borderColor:[t],borderRadius:["none","","full",UL,ei],borderSpacing:k(),borderWidth:V(),contrast:se(),grayscale:G(),hueRotate:se(),invert:G(),gap:k(),gradientColorStops:[t],gradientColorStopPositions:[rSn,qL],inset:A(),margin:A(),opacity:se(),padding:k(),saturate:se(),scale:se(),sepia:G(),skew:se(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",ei]}],container:["container"],columns:[{columns:[UL]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"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:[...J(),ei]}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ate,ei]}],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",ei]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",Ate,ei]}],"grid-cols":[{"grid-cols":[Nte]}],"col-start-end":[{col:["auto",{span:["full",Ate,ei]},ei]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[Nte]}],"row-start-end":[{row:["auto",{span:[Ate,ei]},ei]}],"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",ei]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ei]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...oe()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...oe(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...oe(),"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":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ei,e]}],"min-w":[{"min-w":[ei,e,"min","max","fit"]}],"max-w":[{"max-w":[ei,e,"none","full","min","max","fit","prose",{screen:[UL]},UL]}],h:[{h:[ei,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ei,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ei,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ei,e,"auto","min","max","fit"]}],"font-size":[{text:["base",UL,qL]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Q3e]}],"font-family":[{font:[Nte]}],"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",ei]}],"line-clamp":[{"line-clamp":["none",j6,Q3e]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",PN,ei]}],"list-image":[{"list-image":["none",ei]}],"list-style-type":[{list:["none","disc","decimal",ei]}],"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:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",PN,qL]}],"underline-offset":[{"underline-offset":["auto",PN,ei]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ei]}],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",ei]}],"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:[...J(),iSn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",oSn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},sSn]}],"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:[...K(),"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:K()}],"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:["",...K()]}],"outline-offset":[{"outline-offset":[PN,ei]}],"outline-w":[{outline:[PN,qL]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[PN,qL]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",UL,uSn]}],"shadow-color":[{shadow:[Nte]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...ue(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ue()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",UL,ei]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[_]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ei]}],duration:[{duration:se()}],ease:[{ease:["linear","in","out","in-out",ei]}],delay:[{delay:se()}],animate:[{animate:["none","spin","ping","pulse","bounce",ei]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[Ate,ei]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ei]}],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",ei]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ei]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[PN,qL,Q3e]}],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"]}}},fSn=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{jte(t,"cacheSize",e),jte(t,"prefix",r),jte(t,"separator",n),jte(t,"experimentalParseClassName",o);for(let s in a)pSn(t[s],a[s]);for(let s in i)mSn(t[s],i[s]);return t},jte=(t,e,r)=>{r!==void 0&&(t[e]=r)},pSn=(t,e)=>{if(e)for(let r in e)jte(t,r,e[r])},mSn=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},lDt=(t,...e)=>typeof t=="function"?rDt(nDt,t,...e):rDt(()=>fSn(nDt(),t),...e)});function Te(...t){return hSn(Jye(t))}var hSn,kn=v(()=>{Y3e();cDt();hSn=lDt({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 Kye,gSn,ge,to=v(()=>{Kye=L(X());Vu();Wye();kn();gSn=N6("tw-inline-flex tw-items-center tw-justify-center tw-gap-1 tw-whitespace-nowrap tw-rounded-md tw-text-sm tw-font-medium tw-transition-colors focus-visible:tw-outline-none focus-visible:tw-ring-1 focus-visible:tw-ring-ring disabled:tw-pointer-events-none disabled:tw-opacity-50 [&_svg]:tw-shrink-0",{variants:{variant:{default:"mod-cta tw-bg-interactive-accent tw-text-on-accent tw-shadow hover:tw-bg-interactive-accent-hover",destructive:"clickable-icon tw-bg-modifier-error tw-text-on-accent hover:tw-bg-modifier-error hover:tw-text-on-accent",secondary:"tw-bg-secondary tw-text-normal tw-shadow-sm hover:tw-bg-interactive-hover",ghost:"clickable-icon tw-bg-transparent hover:tw-bg-interactive-accent hover:tw-text-on-accent",link:"tw-text-accent tw-underline-offset-4 hover:tw-underline",success:"clickable-icon tw-bg-modifier-success tw-text-on-accent hover:tw-bg-modifier-success hover:tw-text-on-accent",ghost2:"clickable-icon tw-bg-transparent tw-text-faint tw-outline-none hover:tw-bg-transparent hover:tw-bg-opacity-100 hover:tw-text-normal focus-visible:tw-text-normal focus-visible:tw-outline-none focus-visible:tw-ring-0"},size:{default:"tw-h-9 tw-px-4 tw-py-2",sm:"tw-h-6 tw-rounded-md tw-px-3 tw-text-xs",lg:"tw-h-10 tw-rounded-md tw-px-8",icon:"tw-size-7",fit:"tw-gap-1 tw-px-1 tw-text-xs"}},defaultVariants:{variant:"default",size:"default"}}),ge=Kye.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>Kye.createElement(n?Kjt:"button",{className:Te(gSn({variant:e,size:r,className:t})),ref:i,...o}));ge.displayName="Button"});var dDt,Gye,rWe=v(()=>{dDt=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Gye=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim()});var fDt,pDt=v(()=>{fDt={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 Dte,mDt,hDt=v(()=>{Dte=L(X());pDt();rWe();mDt=(0,Dte.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,Dte.createElement)("svg",{ref:u,...fDt,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:Gye("lucide",o),...s},[...a.map(([l,c])=>(0,Dte.createElement)(l,c)),...Array.isArray(i)?i:[i]]))});var Xye,Pe,Wt=v(()=>{Xye=L(X());rWe();hDt();Pe=(t,e)=>{let r=(0,Xye.forwardRef)(({className:n,...o},i)=>(0,Xye.createElement)(mDt,{ref:i,iconNode:e,className:Gye(`lucide-${dDt(t)}`,n),...o}));return r.displayName=`${t}`,r}});var $6,gDt=v(()=>{Wt();$6=Pe("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]])});var $te,yDt=v(()=>{Wt();$te=Pe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var MN,bDt=v(()=>{Wt();MN=Pe("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]])});var Lte,_Dt=v(()=>{Wt();Lte=Pe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])});var L6,vDt=v(()=>{Wt();L6=Pe("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 Hu,wDt=v(()=>{Wt();Hu=Pe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var ts,SDt=v(()=>{Wt();ts=Pe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var bm,CDt=v(()=>{Wt();bm=Pe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var fb,xDt=v(()=>{Wt();fb=Pe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var sS,ODt=v(()=>{Wt();sS=Pe("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 uS,TDt=v(()=>{Wt();uS=Pe("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 BL,EDt=v(()=>{Wt();BL=Pe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])});var IN,PDt=v(()=>{Wt();IN=Pe("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 zL,MDt=v(()=>{Wt();zL=Pe("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 Iv,IDt=v(()=>{Wt();Iv=Pe("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var VL,RDt=v(()=>{Wt();VL=Pe("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]])});var IO,ADt=v(()=>{Wt();IO=Pe("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 Fte,NDt=v(()=>{Wt();Fte=Pe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var kte,jDt=v(()=>{Wt();kte=Pe("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 qte,DDt=v(()=>{Wt();qte=Pe("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 HL,$Dt=v(()=>{Wt();HL=Pe("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 ig,LDt=v(()=>{Wt();ig=Pe("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 fC,FDt=v(()=>{Wt();fC=Pe("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]])});var Ute,kDt=v(()=>{Wt();Ute=Pe("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 RN,qDt=v(()=>{Wt();RN=Pe("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 Bte,UDt=v(()=>{Wt();Bte=Pe("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 RO,BDt=v(()=>{Wt();RO=Pe("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 JL,zDt=v(()=>{Wt();JL=Pe("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 AN,VDt=v(()=>{Wt();AN=Pe("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 zte,HDt=v(()=>{Wt();zte=Pe("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 NN,JDt=v(()=>{Wt();NN=Pe("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 Vte,WDt=v(()=>{Wt();Vte=Pe("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 jN,KDt=v(()=>{Wt();jN=Pe("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 Hte,GDt=v(()=>{Wt();Hte=Pe("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 Jte,XDt=v(()=>{Wt();Jte=Pe("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 Wte,ZDt=v(()=>{Wt();Wte=Pe("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,YDt=v(()=>{Wt();Ju=Pe("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 Kte,QDt=v(()=>{Wt();Kte=Pe("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 Gte,e$t=v(()=>{Wt();Gte=Pe("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]])});var ah,t$t=v(()=>{Wt();ah=Pe("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 cl,r$t=v(()=>{Wt();cl=Pe("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 pC,n$t=v(()=>{Wt();pC=Pe("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 Xte,o$t=v(()=>{Wt();Xte=Pe("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 Zte,i$t=v(()=>{Wt();Zte=Pe("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 Yte,a$t=v(()=>{Wt();Yte=Pe("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 Qte,s$t=v(()=>{Wt();Qte=Pe("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 ere,u$t=v(()=>{Wt();ere=Pe("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 e4,l$t=v(()=>{Wt();e4=Pe("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 mC,c$t=v(()=>{Wt();mC=Pe("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 du,d$t=v(()=>{Wt();du=Pe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var tre,f$t=v(()=>{Wt();tre=Pe("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 F6,p$t=v(()=>{Wt();F6=Pe("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]])});var k6,m$t=v(()=>{Wt();k6=Pe("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 lS,h$t=v(()=>{Wt();lS=Pe("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 pb,g$t=v(()=>{Wt();pb=Pe("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 q6,y$t=v(()=>{Wt();q6=Pe("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 U6,b$t=v(()=>{Wt();U6=Pe("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 Rv,_$t=v(()=>{Wt();Rv=Pe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var rre,v$t=v(()=>{Wt();rre=Pe("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 WL,w$t=v(()=>{Wt();WL=Pe("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 t4,S$t=v(()=>{Wt();t4=Pe("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 nre,C$t=v(()=>{Wt();nre=Pe("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 r4,x$t=v(()=>{Wt();r4=Pe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var ore,O$t=v(()=>{Wt();ore=Pe("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 uy,T$t=v(()=>{Wt();uy=Pe("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 DN,E$t=v(()=>{Wt();DN=Pe("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 d_,P$t=v(()=>{Wt();d_=Pe("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 KL,M$t=v(()=>{Wt();KL=Pe("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 ire,I$t=v(()=>{Wt();ire=Pe("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 ly,R$t=v(()=>{Wt();ly=Pe("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 _m,A$t=v(()=>{Wt();_m=Pe("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 Av,N$t=v(()=>{Wt();Av=Pe("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 $o,j$t=v(()=>{Wt();$o=Pe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var are,D$t=v(()=>{Wt();are=Pe("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 sre,$$t=v(()=>{Wt();sre=Pe("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 Jr=v(()=>{ODt();TDt();EDt();MDt();IDt();RDt();ADt();BDt();zDt();d$t();h$t();g$t();T$t();E$t();P$t();A$t();gDt();yDt();bDt();_Dt();vDt();wDt();SDt();CDt();xDt();PDt();NDt();jDt();DDt();$Dt();LDt();FDt();kDt();qDt();UDt();VDt();HDt();JDt();WDt();KDt();GDt();XDt();ZDt();YDt();QDt();e$t();t$t();r$t();n$t();o$t();i$t();a$t();s$t();u$t();l$t();c$t();f$t();p$t();m$t();y$t();b$t();_$t();v$t();w$t();S$t();C$t();x$t();O$t();M$t();I$t();R$t();N$t();j$t();D$t();$$t();});function ySn({onCancel:t}){let e=ae(),r=nWe(e.defaultModelKey)&&nWe(e.embeddingModelKey);return AO.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},AO.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},AO.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&AO.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.")),AO.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},AO.default.createElement(ge,{variant:"ghost",onClick:t},"Close"),AO.default.createElement(ge,{variant:"default",onClick:()=>{n4(pN.EXPIRED_MODAL)}},"Renew Now ",AO.default.createElement(AN,{className:"tw-size-4"}))))}var AO,L$t,F$t,Zye,k$t=v(()=>{AO=L(X()),L$t=require("obsidian"),F$t=L(dd());to();Nv();Or();Jr();ot();Zye=class extends L$t.Modal{constructor(e){super(e),this.setTitle("Thanks for being a Copilot Plus user \u{1F44B}")}onOpen(){let{contentEl:e}=this;this.root=(0,F$t.createRoot)(e);let r=()=>{this.close()};this.root.render(AO.default.createElement(ySn,{onCancel:r}))}onClose(){this.root.unmount()}}});var U$t=S(q$t=>{"use strict";Object.defineProperty(q$t,"__esModule",{value:!0})});var B$t=S(Yye=>{"use strict";Object.defineProperty(Yye,"__esModule",{value:!0});Yye.V2ChatStreamRequestSafetyMode=void 0;Yye.V2ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",Off:"OFF"}});var z$t=S(Qye=>{"use strict";Object.defineProperty(Qye,"__esModule",{value:!0});Qye.V2ChatStreamRequestToolChoice=void 0;Qye.V2ChatStreamRequestToolChoice={Required:"REQUIRED",None:"NONE"}});var H$t=S(V$t=>{"use strict";Object.defineProperty(V$t,"__esModule",{value:!0})});var W$t=S(J$t=>{"use strict";Object.defineProperty(J$t,"__esModule",{value:!0})});var K$t=S(ebe=>{"use strict";Object.defineProperty(ebe,"__esModule",{value:!0});ebe.V2ChatRequestSafetyMode=void 0;ebe.V2ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",Off:"OFF"}});var G$t=S(tbe=>{"use strict";Object.defineProperty(tbe,"__esModule",{value:!0});tbe.V2ChatRequestToolChoice=void 0;tbe.V2ChatRequestToolChoice={Required:"REQUIRED",None:"NONE"}});var Z$t=S(X$t=>{"use strict";Object.defineProperty(X$t,"__esModule",{value:!0})});var Y$t=S(rbe=>{"use strict";Object.defineProperty(rbe,"__esModule",{value:!0});rbe.V2EmbedRequestTruncate=void 0;rbe.V2EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var eLt=S(Q$t=>{"use strict";Object.defineProperty(Q$t,"__esModule",{value:!0})});var rLt=S(tLt=>{"use strict";Object.defineProperty(tLt,"__esModule",{value:!0})});var oWe=S(ag=>{"use strict";var bSn=ag&&ag.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hC=ag&&ag.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bSn(e,t,r)};Object.defineProperty(ag,"__esModule",{value:!0});hC(U$t(),ag);hC(B$t(),ag);hC(z$t(),ag);hC(H$t(),ag);hC(W$t(),ag);hC(K$t(),ag);hC(G$t(),ag);hC(Z$t(),ag);hC(Y$t(),ag);hC(eLt(),ag);hC(rLt(),ag)});var iWe=S(nLt=>{"use strict";Object.defineProperty(nLt,"__esModule",{value:!0})});var oLt=S(o4=>{"use strict";var _Sn=o4&&o4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vSn=o4&&o4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_Sn(e,t,r)};Object.defineProperty(o4,"__esModule",{value:!0});vSn(iWe(),o4)});var aLt=S(GL=>{"use strict";var wSn=GL&&GL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iLt=GL&&GL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&wSn(e,t,r)};Object.defineProperty(GL,"__esModule",{value:!0});iLt(oWe(),GL);iLt(oLt(),GL)});var sLt=S(nbe=>{"use strict";Object.defineProperty(nbe,"__esModule",{value:!0});nbe.CreateEmbedJobRequestTruncate=void 0;nbe.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var aWe=S(i4=>{"use strict";var SSn=i4&&i4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CSn=i4&&i4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&SSn(e,t,r)};Object.defineProperty(i4,"__esModule",{value:!0});CSn(sLt(),i4)});var sWe=S(uLt=>{"use strict";Object.defineProperty(uLt,"__esModule",{value:!0})});var lLt=S(a4=>{"use strict";var xSn=a4&&a4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),OSn=a4&&a4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xSn(e,t,r)};Object.defineProperty(a4,"__esModule",{value:!0});OSn(sWe(),a4)});var dLt=S(XL=>{"use strict";var TSn=XL&&XL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cLt=XL&&XL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&TSn(e,t,r)};Object.defineProperty(XL,"__esModule",{value:!0});cLt(aWe(),XL);cLt(lLt(),XL)});var pLt=S(fLt=>{"use strict";Object.defineProperty(fLt,"__esModule",{value:!0})});var hLt=S(mLt=>{"use strict";Object.defineProperty(mLt,"__esModule",{value:!0})});var yLt=S(gLt=>{"use strict";Object.defineProperty(gLt,"__esModule",{value:!0})});var _Lt=S(bLt=>{"use strict";Object.defineProperty(bLt,"__esModule",{value:!0})});var uWe=S(NO=>{"use strict";var ESn=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]}),obe=NO&&NO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ESn(e,t,r)};Object.defineProperty(NO,"__esModule",{value:!0});obe(pLt(),NO);obe(hLt(),NO);obe(yLt(),NO);obe(_Lt(),NO)});var lWe=S(vLt=>{"use strict";Object.defineProperty(vLt,"__esModule",{value:!0})});var wLt=S(s4=>{"use strict";var PSn=s4&&s4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MSn=s4&&s4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&PSn(e,t,r)};Object.defineProperty(s4,"__esModule",{value:!0});MSn(lWe(),s4)});var CLt=S(ZL=>{"use strict";var ISn=ZL&&ZL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SLt=ZL&&ZL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ISn(e,t,r)};Object.defineProperty(ZL,"__esModule",{value:!0});SLt(uWe(),ZL);SLt(wLt(),ZL)});var xLt=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 OLt=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 ELt=S(TLt=>{"use strict";Object.defineProperty(TLt,"__esModule",{value:!0})});var PLt=S(sbe=>{"use strict";Object.defineProperty(sbe,"__esModule",{value:!0});sbe.LoraTargetModules=void 0;sbe.LoraTargetModules={LoraTargetModulesUnspecified:"LORA_TARGET_MODULES_UNSPECIFIED",LoraTargetModulesQv:"LORA_TARGET_MODULES_QV",LoraTargetModulesQkvo:"LORA_TARGET_MODULES_QKVO",LoraTargetModulesQkvoFfn:"LORA_TARGET_MODULES_QKVO_FFN"}});var ILt=S(MLt=>{"use strict";Object.defineProperty(MLt,"__esModule",{value:!0})});var ALt=S(RLt=>{"use strict";Object.defineProperty(RLt,"__esModule",{value:!0})});var jLt=S(NLt=>{"use strict";Object.defineProperty(NLt,"__esModule",{value:!0})});var DLt=S(ube=>{"use strict";Object.defineProperty(ube,"__esModule",{value:!0});ube.Status=void 0;ube.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 LLt=S($Lt=>{"use strict";Object.defineProperty($Lt,"__esModule",{value:!0})});var kLt=S(FLt=>{"use strict";Object.defineProperty(FLt,"__esModule",{value:!0})});var ULt=S(qLt=>{"use strict";Object.defineProperty(qLt,"__esModule",{value:!0})});var zLt=S(BLt=>{"use strict";Object.defineProperty(BLt,"__esModule",{value:!0})});var HLt=S(VLt=>{"use strict";Object.defineProperty(VLt,"__esModule",{value:!0})});var WLt=S(JLt=>{"use strict";Object.defineProperty(JLt,"__esModule",{value:!0})});var GLt=S(KLt=>{"use strict";Object.defineProperty(KLt,"__esModule",{value:!0})});var ZLt=S(XLt=>{"use strict";Object.defineProperty(XLt,"__esModule",{value:!0})});var QLt=S(YLt=>{"use strict";Object.defineProperty(YLt,"__esModule",{value:!0})});var tFt=S(eFt=>{"use strict";Object.defineProperty(eFt,"__esModule",{value:!0})});var cWe=S(Dl=>{"use strict";var RSn=Dl&&Dl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sh=Dl&&Dl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&RSn(e,t,r)};Object.defineProperty(Dl,"__esModule",{value:!0});sh(xLt(),Dl);sh(OLt(),Dl);sh(ELt(),Dl);sh(PLt(),Dl);sh(ILt(),Dl);sh(ALt(),Dl);sh(jLt(),Dl);sh(DLt(),Dl);sh(LLt(),Dl);sh(kLt(),Dl);sh(ULt(),Dl);sh(zLt(),Dl);sh(HLt(),Dl);sh(WLt(),Dl);sh(GLt(),Dl);sh(ZLt(),Dl);sh(QLt(),Dl);sh(tFt(),Dl)});var rFt=S(u4=>{"use strict";var ASn=u4&&u4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NSn=u4&&u4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ASn(e,t,r)};Object.defineProperty(u4,"__esModule",{value:!0});NSn(cWe(),u4)});var oFt=S(jv=>{"use strict";var nFt=jv&&jv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jSn=jv&&jv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DSn=jv&&jv.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nFt(r,e,n[o]);return jSn(r,e),r}}(),$Sn=jv&&jv.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nFt(e,t,r)};Object.defineProperty(jv,"__esModule",{value:!0});jv.finetuning=void 0;jv.finetuning=DSn(rFt());$Sn(cWe(),jv)});var dWe=S(iFt=>{"use strict";Object.defineProperty(iFt,"__esModule",{value:!0})});var aFt=S(l4=>{"use strict";var LSn=l4&&l4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FSn=l4&&l4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&LSn(e,t,r)};Object.defineProperty(l4,"__esModule",{value:!0});FSn(dWe(),l4)});var uFt=S(YL=>{"use strict";var kSn=YL&&YL.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sFt=YL&&YL.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kSn(e,t,r)};Object.defineProperty(YL,"__esModule",{value:!0});sFt(oFt(),YL);sFt(aFt(),YL)});var fWe=S(lFt=>{"use strict";Object.defineProperty(lFt,"__esModule",{value:!0})});var cFt=S(c4=>{"use strict";var qSn=c4&&c4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),USn=c4&&c4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qSn(e,t,r)};Object.defineProperty(c4,"__esModule",{value:!0});USn(fWe(),c4)});var dFt=S(d4=>{"use strict";var BSn=d4&&d4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zSn=d4&&d4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BSn(e,t,r)};Object.defineProperty(d4,"__esModule",{value:!0});zSn(cFt(),d4)});var pWe=S(fFt=>{"use strict";Object.defineProperty(fFt,"__esModule",{value:!0})});var pFt=S(f4=>{"use strict";var VSn=f4&&f4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HSn=f4&&f4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&VSn(e,t,r)};Object.defineProperty(f4,"__esModule",{value:!0});HSn(pWe(),f4)});var mFt=S(p4=>{"use strict";var JSn=p4&&p4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WSn=p4&&p4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&JSn(e,t,r)};Object.defineProperty(p4,"__esModule",{value:!0});WSn(pFt(),p4)});var gFt=S(Us=>{"use strict";var hFt=Us&&Us.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),KSn=Us&&Us.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B6=Us&&Us.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hFt(r,e,n[o]);return KSn(r,e),r}}(),$N=Us&&Us.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hFt(e,t,r)};Object.defineProperty(Us,"__esModule",{value:!0});Us.models=Us.connectors=Us.finetuning=Us.datasets=Us.embedJobs=Us.v2=void 0;Us.v2=B6(aLt());$N(oWe(),Us);Us.embedJobs=B6(dLt());$N(aWe(),Us);Us.datasets=B6(CLt());$N(uWe(),Us);Us.finetuning=B6(uFt());Us.connectors=B6(dFt());Us.models=B6(mFt());$N(iWe(),Us);$N(sWe(),Us);$N(lWe(),Us);$N(fWe(),Us);$N(pWe(),Us);$N(dWe(),Us)});var yFt=S(lbe=>{"use strict";Object.defineProperty(lbe,"__esModule",{value:!0});lbe.ChatStreamRequestPromptTruncation=void 0;lbe.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var bFt=S(cbe=>{"use strict";Object.defineProperty(cbe,"__esModule",{value:!0});cbe.ChatStreamRequestCitationQuality=void 0;cbe.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var _Ft=S(dbe=>{"use strict";Object.defineProperty(dbe,"__esModule",{value:!0});dbe.ChatStreamRequestSafetyMode=void 0;dbe.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var wFt=S(vFt=>{"use strict";Object.defineProperty(vFt,"__esModule",{value:!0})});var SFt=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 CFt=S(pbe=>{"use strict";Object.defineProperty(pbe,"__esModule",{value:!0});pbe.ChatRequestCitationQuality=void 0;pbe.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var xFt=S(mbe=>{"use strict";Object.defineProperty(mbe,"__esModule",{value:!0});mbe.ChatRequestSafetyMode=void 0;mbe.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var TFt=S(OFt=>{"use strict";Object.defineProperty(OFt,"__esModule",{value:!0})});var EFt=S(hbe=>{"use strict";Object.defineProperty(hbe,"__esModule",{value:!0});hbe.GenerateStreamRequestTruncate=void 0;hbe.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var PFt=S(gbe=>{"use strict";Object.defineProperty(gbe,"__esModule",{value:!0});gbe.GenerateStreamRequestReturnLikelihoods=void 0;gbe.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var IFt=S(MFt=>{"use strict";Object.defineProperty(MFt,"__esModule",{value:!0})});var RFt=S(ybe=>{"use strict";Object.defineProperty(ybe,"__esModule",{value:!0});ybe.GenerateRequestTruncate=void 0;ybe.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var AFt=S(bbe=>{"use strict";Object.defineProperty(bbe,"__esModule",{value:!0});bbe.GenerateRequestReturnLikelihoods=void 0;bbe.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var jFt=S(NFt=>{"use strict";Object.defineProperty(NFt,"__esModule",{value:!0})});var DFt=S(_be=>{"use strict";Object.defineProperty(_be,"__esModule",{value:!0});_be.EmbedRequestTruncate=void 0;_be.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var LFt=S($Ft=>{"use strict";Object.defineProperty($Ft,"__esModule",{value:!0})});var kFt=S(FFt=>{"use strict";Object.defineProperty(FFt,"__esModule",{value:!0})});var UFt=S(qFt=>{"use strict";Object.defineProperty(qFt,"__esModule",{value:!0})});var zFt=S(BFt=>{"use strict";Object.defineProperty(BFt,"__esModule",{value:!0})});var HFt=S(VFt=>{"use strict";Object.defineProperty(VFt,"__esModule",{value:!0})});var JFt=S(vbe=>{"use strict";Object.defineProperty(vbe,"__esModule",{value:!0});vbe.ClassifyRequestTruncate=void 0;vbe.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var KFt=S(WFt=>{"use strict";Object.defineProperty(WFt,"__esModule",{value:!0})});var GFt=S(wbe=>{"use strict";Object.defineProperty(wbe,"__esModule",{value:!0});wbe.ClassifyResponseClassificationsItemClassificationType=void 0;wbe.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var ZFt=S(XFt=>{"use strict";Object.defineProperty(XFt,"__esModule",{value:!0})});var QFt=S(YFt=>{"use strict";Object.defineProperty(YFt,"__esModule",{value:!0})});var ekt=S(Sbe=>{"use strict";Object.defineProperty(Sbe,"__esModule",{value:!0});Sbe.SummarizeRequestLength=void 0;Sbe.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var tkt=S(Cbe=>{"use strict";Object.defineProperty(Cbe,"__esModule",{value:!0});Cbe.SummarizeRequestFormat=void 0;Cbe.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var rkt=S(xbe=>{"use strict";Object.defineProperty(xbe,"__esModule",{value:!0});xbe.SummarizeRequestExtractiveness=void 0;xbe.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var okt=S(nkt=>{"use strict";Object.defineProperty(nkt,"__esModule",{value:!0})});var akt=S(ikt=>{"use strict";Object.defineProperty(ikt,"__esModule",{value:!0})});var ukt=S(skt=>{"use strict";Object.defineProperty(skt,"__esModule",{value:!0})});var ckt=S(lkt=>{"use strict";Object.defineProperty(lkt,"__esModule",{value:!0})});var fkt=S(dkt=>{"use strict";Object.defineProperty(dkt,"__esModule",{value:!0})});var mkt=S(pkt=>{"use strict";Object.defineProperty(pkt,"__esModule",{value:!0})});var gkt=S(hkt=>{"use strict";Object.defineProperty(hkt,"__esModule",{value:!0})});var bkt=S(ykt=>{"use strict";Object.defineProperty(ykt,"__esModule",{value:!0})});var vkt=S(_kt=>{"use strict";Object.defineProperty(_kt,"__esModule",{value:!0})});var Skt=S(wkt=>{"use strict";Object.defineProperty(wkt,"__esModule",{value:!0})});var xkt=S(Ckt=>{"use strict";Object.defineProperty(Ckt,"__esModule",{value:!0})});var Tkt=S(Okt=>{"use strict";Object.defineProperty(Okt,"__esModule",{value:!0})});var Pkt=S(Ekt=>{"use strict";Object.defineProperty(Ekt,"__esModule",{value:!0})});var Ikt=S(Mkt=>{"use strict";Object.defineProperty(Mkt,"__esModule",{value:!0})});var Akt=S(Rkt=>{"use strict";Object.defineProperty(Rkt,"__esModule",{value:!0})});var jkt=S(Nkt=>{"use strict";Object.defineProperty(Nkt,"__esModule",{value:!0})});var Dkt=S(Obe=>{"use strict";Object.defineProperty(Obe,"__esModule",{value:!0});Obe.ChatCitationType=void 0;Obe.ChatCitationType={TextContent:"TEXT_CONTENT",Plan:"PLAN"}});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 Ukt=S(qkt=>{"use strict";Object.defineProperty(qkt,"__esModule",{value:!0})});var zkt=S(Bkt=>{"use strict";Object.defineProperty(Bkt,"__esModule",{value:!0})});var Vkt=S(Tbe=>{"use strict";Object.defineProperty(Tbe,"__esModule",{value:!0});Tbe.FinishReason=void 0;Tbe.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var Jkt=S(Hkt=>{"use strict";Object.defineProperty(Hkt,"__esModule",{value:!0})});var Kkt=S(Wkt=>{"use strict";Object.defineProperty(Wkt,"__esModule",{value:!0})});var Xkt=S(Gkt=>{"use strict";Object.defineProperty(Gkt,"__esModule",{value:!0})});var Ykt=S(Zkt=>{"use strict";Object.defineProperty(Zkt,"__esModule",{value:!0})});var eqt=S(Qkt=>{"use strict";Object.defineProperty(Qkt,"__esModule",{value:!0})});var rqt=S(tqt=>{"use strict";Object.defineProperty(tqt,"__esModule",{value:!0})});var oqt=S(nqt=>{"use strict";Object.defineProperty(nqt,"__esModule",{value:!0})});var aqt=S(iqt=>{"use strict";Object.defineProperty(iqt,"__esModule",{value:!0})});var uqt=S(sqt=>{"use strict";Object.defineProperty(sqt,"__esModule",{value:!0})});var cqt=S(lqt=>{"use strict";Object.defineProperty(lqt,"__esModule",{value:!0})});var fqt=S(dqt=>{"use strict";Object.defineProperty(dqt,"__esModule",{value:!0})});var pqt=S(Ebe=>{"use strict";Object.defineProperty(Ebe,"__esModule",{value:!0});Ebe.ChatStreamEndEventFinishReason=void 0;Ebe.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var hqt=S(mqt=>{"use strict";Object.defineProperty(mqt,"__esModule",{value:!0})});var yqt=S(gqt=>{"use strict";Object.defineProperty(gqt,"__esModule",{value:!0})});var _qt=S(bqt=>{"use strict";Object.defineProperty(bqt,"__esModule",{value:!0})});var wqt=S(vqt=>{"use strict";Object.defineProperty(vqt,"__esModule",{value:!0})});var Cqt=S(Sqt=>{"use strict";Object.defineProperty(Sqt,"__esModule",{value:!0})});var xqt=S(Pbe=>{"use strict";Object.defineProperty(Pbe,"__esModule",{value:!0});Pbe.ImageUrlDetail=void 0;Pbe.ImageUrlDetail={Auto:"auto",Low:"low",High:"high"}});var Tqt=S(Oqt=>{"use strict";Object.defineProperty(Oqt,"__esModule",{value:!0})});var Pqt=S(Eqt=>{"use strict";Object.defineProperty(Eqt,"__esModule",{value:!0})});var Iqt=S(Mqt=>{"use strict";Object.defineProperty(Mqt,"__esModule",{value:!0})});var Aqt=S(Rqt=>{"use strict";Object.defineProperty(Rqt,"__esModule",{value:!0})});var jqt=S(Nqt=>{"use strict";Object.defineProperty(Nqt,"__esModule",{value:!0})});var $qt=S(Dqt=>{"use strict";Object.defineProperty(Dqt,"__esModule",{value:!0})});var Fqt=S(Lqt=>{"use strict";Object.defineProperty(Lqt,"__esModule",{value:!0})});var qqt=S(kqt=>{"use strict";Object.defineProperty(kqt,"__esModule",{value:!0})});var Bqt=S(Uqt=>{"use strict";Object.defineProperty(Uqt,"__esModule",{value:!0})});var Vqt=S(zqt=>{"use strict";Object.defineProperty(zqt,"__esModule",{value:!0})});var Jqt=S(Hqt=>{"use strict";Object.defineProperty(Hqt,"__esModule",{value:!0})});var Wqt=S(Mbe=>{"use strict";Object.defineProperty(Mbe,"__esModule",{value:!0});Mbe.CitationType=void 0;Mbe.CitationType={TextContent:"TEXT_CONTENT",ThinkingContent:"THINKING_CONTENT",Plan:"PLAN"}});var Gqt=S(Kqt=>{"use strict";Object.defineProperty(Kqt,"__esModule",{value:!0})});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 tUt=S(eUt=>{"use strict";Object.defineProperty(eUt,"__esModule",{value:!0})});var nUt=S(rUt=>{"use strict";Object.defineProperty(rUt,"__esModule",{value:!0})});var iUt=S(oUt=>{"use strict";Object.defineProperty(oUt,"__esModule",{value:!0})});var sUt=S(aUt=>{"use strict";Object.defineProperty(aUt,"__esModule",{value:!0})});var lUt=S(uUt=>{"use strict";Object.defineProperty(uUt,"__esModule",{value:!0})});var dUt=S(cUt=>{"use strict";Object.defineProperty(cUt,"__esModule",{value:!0})});var pUt=S(fUt=>{"use strict";Object.defineProperty(fUt,"__esModule",{value:!0})});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 OUt=S(xUt=>{"use strict";Object.defineProperty(xUt,"__esModule",{value:!0})});var TUt=S(Ibe=>{"use strict";Object.defineProperty(Ibe,"__esModule",{value:!0});Ibe.CitationOptionsMode=void 0;Ibe.CitationOptionsMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var PUt=S(EUt=>{"use strict";Object.defineProperty(EUt,"__esModule",{value:!0})});var IUt=S(MUt=>{"use strict";Object.defineProperty(MUt,"__esModule",{value:!0})});var AUt=S(RUt=>{"use strict";Object.defineProperty(RUt,"__esModule",{value:!0})});var jUt=S(NUt=>{"use strict";Object.defineProperty(NUt,"__esModule",{value:!0})});var DUt=S(Rbe=>{"use strict";Object.defineProperty(Rbe,"__esModule",{value:!0});Rbe.ThinkingType=void 0;Rbe.ThinkingType={Enabled:"enabled",Disabled:"disabled"}});var LUt=S($Ut=>{"use strict";Object.defineProperty($Ut,"__esModule",{value:!0})});var FUt=S(Abe=>{"use strict";Object.defineProperty(Abe,"__esModule",{value:!0});Abe.ChatFinishReason=void 0;Abe.ChatFinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",MaxTokens:"MAX_TOKENS",ToolCall:"TOOL_CALL",Error:"ERROR"}});var qUt=S(kUt=>{"use strict";Object.defineProperty(kUt,"__esModule",{value:!0})});var BUt=S(UUt=>{"use strict";Object.defineProperty(UUt,"__esModule",{value:!0})});var VUt=S(zUt=>{"use strict";Object.defineProperty(zUt,"__esModule",{value:!0})});var JUt=S(HUt=>{"use strict";Object.defineProperty(HUt,"__esModule",{value:!0})});var KUt=S(WUt=>{"use strict";Object.defineProperty(WUt,"__esModule",{value:!0})});var XUt=S(GUt=>{"use strict";Object.defineProperty(GUt,"__esModule",{value:!0})});var YUt=S(ZUt=>{"use strict";Object.defineProperty(ZUt,"__esModule",{value:!0})});var eBt=S(QUt=>{"use strict";Object.defineProperty(QUt,"__esModule",{value:!0})});var rBt=S(tBt=>{"use strict";Object.defineProperty(tBt,"__esModule",{value:!0})});var oBt=S(nBt=>{"use strict";Object.defineProperty(nBt,"__esModule",{value:!0})});var iBt=S(Nbe=>{"use strict";Object.defineProperty(Nbe,"__esModule",{value:!0});Nbe.ChatContentStartEventDeltaMessageContentType=void 0;Nbe.ChatContentStartEventDeltaMessageContentType={Text:"text",Thinking:"thinking"}});var sBt=S(aBt=>{"use strict";Object.defineProperty(aBt,"__esModule",{value:!0})});var lBt=S(uBt=>{"use strict";Object.defineProperty(uBt,"__esModule",{value:!0})});var dBt=S(cBt=>{"use strict";Object.defineProperty(cBt,"__esModule",{value:!0})});var pBt=S(fBt=>{"use strict";Object.defineProperty(fBt,"__esModule",{value:!0})});var hBt=S(mBt=>{"use strict";Object.defineProperty(mBt,"__esModule",{value:!0})});var yBt=S(gBt=>{"use strict";Object.defineProperty(gBt,"__esModule",{value:!0})});var _Bt=S(bBt=>{"use strict";Object.defineProperty(bBt,"__esModule",{value:!0})});var wBt=S(vBt=>{"use strict";Object.defineProperty(vBt,"__esModule",{value:!0})});var CBt=S(SBt=>{"use strict";Object.defineProperty(SBt,"__esModule",{value:!0})});var OBt=S(xBt=>{"use strict";Object.defineProperty(xBt,"__esModule",{value:!0})});var EBt=S(TBt=>{"use strict";Object.defineProperty(TBt,"__esModule",{value:!0})});var MBt=S(PBt=>{"use strict";Object.defineProperty(PBt,"__esModule",{value:!0})});var RBt=S(IBt=>{"use strict";Object.defineProperty(IBt,"__esModule",{value:!0})});var NBt=S(ABt=>{"use strict";Object.defineProperty(ABt,"__esModule",{value:!0})});var DBt=S(jBt=>{"use strict";Object.defineProperty(jBt,"__esModule",{value:!0})});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 UBt=S(qBt=>{"use strict";Object.defineProperty(qBt,"__esModule",{value:!0})});var zBt=S(BBt=>{"use strict";Object.defineProperty(BBt,"__esModule",{value:!0})});var HBt=S(VBt=>{"use strict";Object.defineProperty(VBt,"__esModule",{value:!0})});var WBt=S(JBt=>{"use strict";Object.defineProperty(JBt,"__esModule",{value:!0})});var GBt=S(KBt=>{"use strict";Object.defineProperty(KBt,"__esModule",{value:!0})});var ZBt=S(XBt=>{"use strict";Object.defineProperty(XBt,"__esModule",{value:!0})});var QBt=S(YBt=>{"use strict";Object.defineProperty(YBt,"__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 Szt=S(jbe=>{"use strict";Object.defineProperty(jbe,"__esModule",{value:!0});jbe.EmbedInputType=void 0;jbe.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering",Image:"image"}});var Czt=S(Dbe=>{"use strict";Object.defineProperty(Dbe,"__esModule",{value:!0});Dbe.EmbeddingType=void 0;Dbe.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary",Base64:"base64"}});var Ozt=S(xzt=>{"use strict";Object.defineProperty(xzt,"__esModule",{value:!0})});var Ezt=S(Tzt=>{"use strict";Object.defineProperty(Tzt,"__esModule",{value:!0})});var Mzt=S(Pzt=>{"use strict";Object.defineProperty(Pzt,"__esModule",{value:!0})});var Rzt=S(Izt=>{"use strict";Object.defineProperty(Izt,"__esModule",{value:!0})});var Nzt=S(Azt=>{"use strict";Object.defineProperty(Azt,"__esModule",{value:!0})});var Dzt=S(jzt=>{"use strict";Object.defineProperty(jzt,"__esModule",{value:!0})});var Lzt=S($zt=>{"use strict";Object.defineProperty($zt,"__esModule",{value:!0})});var kzt=S(Fzt=>{"use strict";Object.defineProperty(Fzt,"__esModule",{value:!0})});var Uzt=S(qzt=>{"use strict";Object.defineProperty(qzt,"__esModule",{value:!0})});var Bzt=S($be=>{"use strict";Object.defineProperty($be,"__esModule",{value:!0});$be.EmbedJobStatus=void 0;$be.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var zzt=S(Lbe=>{"use strict";Object.defineProperty(Lbe,"__esModule",{value:!0});Lbe.EmbedJobTruncate=void 0;Lbe.EmbedJobTruncate={Start:"START",End:"END"}});var Hzt=S(Vzt=>{"use strict";Object.defineProperty(Vzt,"__esModule",{value:!0})});var Wzt=S(Jzt=>{"use strict";Object.defineProperty(Jzt,"__esModule",{value:!0})});var Gzt=S(Kzt=>{"use strict";Object.defineProperty(Kzt,"__esModule",{value:!0})});var Zzt=S(Xzt=>{"use strict";Object.defineProperty(Xzt,"__esModule",{value:!0})});var Qzt=S(Yzt=>{"use strict";Object.defineProperty(Yzt,"__esModule",{value:!0})});var e4t=S(Fbe=>{"use strict";Object.defineProperty(Fbe,"__esModule",{value:!0});Fbe.DatasetValidationStatus=void 0;Fbe.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var t4t=S(kbe=>{"use strict";Object.defineProperty(kbe,"__esModule",{value:!0});kbe.DatasetType=void 0;kbe.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 n4t=S(r4t=>{"use strict";Object.defineProperty(r4t,"__esModule",{value:!0})});var i4t=S(o4t=>{"use strict";Object.defineProperty(o4t,"__esModule",{value:!0})});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 S4t=S(qbe=>{"use strict";Object.defineProperty(qbe,"__esModule",{value:!0});qbe.ConnectorAuthStatus=void 0;qbe.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var x4t=S(C4t=>{"use strict";Object.defineProperty(C4t,"__esModule",{value:!0})});var T4t=S(O4t=>{"use strict";Object.defineProperty(O4t,"__esModule",{value:!0})});var P4t=S(E4t=>{"use strict";Object.defineProperty(E4t,"__esModule",{value:!0})});var M4t=S(Ube=>{"use strict";Object.defineProperty(Ube,"__esModule",{value:!0});Ube.AuthTokenType=void 0;Ube.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var R4t=S(I4t=>{"use strict";Object.defineProperty(I4t,"__esModule",{value:!0})});var N4t=S(A4t=>{"use strict";Object.defineProperty(A4t,"__esModule",{value:!0})});var D4t=S(j4t=>{"use strict";Object.defineProperty(j4t,"__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 U4t=S(q4t=>{"use strict";Object.defineProperty(q4t,"__esModule",{value:!0})});var B4t=S(Bbe=>{"use strict";Object.defineProperty(Bbe,"__esModule",{value:!0});Bbe.CompatibleEndpoint=void 0;Bbe.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var V4t=S(z4t=>{"use strict";Object.defineProperty(z4t,"__esModule",{value:!0})});var J4t=S(H4t=>{"use strict";Object.defineProperty(H4t,"__esModule",{value:!0})});var W4t=S(fe=>{"use strict";var GSn=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]}),ye=fe&&fe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&GSn(e,t,r)};Object.defineProperty(fe,"__esModule",{value:!0});ye(yFt(),fe);ye(bFt(),fe);ye(_Ft(),fe);ye(wFt(),fe);ye(SFt(),fe);ye(CFt(),fe);ye(xFt(),fe);ye(TFt(),fe);ye(EFt(),fe);ye(PFt(),fe);ye(IFt(),fe);ye(RFt(),fe);ye(AFt(),fe);ye(jFt(),fe);ye(DFt(),fe);ye(LFt(),fe);ye(kFt(),fe);ye(UFt(),fe);ye(zFt(),fe);ye(HFt(),fe);ye(JFt(),fe);ye(KFt(),fe);ye(GFt(),fe);ye(ZFt(),fe);ye(QFt(),fe);ye(ekt(),fe);ye(tkt(),fe);ye(rkt(),fe);ye(okt(),fe);ye(akt(),fe);ye(ukt(),fe);ye(ckt(),fe);ye(fkt(),fe);ye(mkt(),fe);ye(gkt(),fe);ye(bkt(),fe);ye(vkt(),fe);ye(Skt(),fe);ye(xkt(),fe);ye(Tkt(),fe);ye(Pkt(),fe);ye(Ikt(),fe);ye(Akt(),fe);ye(jkt(),fe);ye(Dkt(),fe);ye(Lkt(),fe);ye(kkt(),fe);ye(Ukt(),fe);ye(zkt(),fe);ye(Vkt(),fe);ye(Jkt(),fe);ye(Kkt(),fe);ye(Xkt(),fe);ye(Ykt(),fe);ye(eqt(),fe);ye(rqt(),fe);ye(oqt(),fe);ye(aqt(),fe);ye(uqt(),fe);ye(cqt(),fe);ye(fqt(),fe);ye(pqt(),fe);ye(hqt(),fe);ye(yqt(),fe);ye(_qt(),fe);ye(wqt(),fe);ye(Cqt(),fe);ye(xqt(),fe);ye(Tqt(),fe);ye(Pqt(),fe);ye(Iqt(),fe);ye(Aqt(),fe);ye(jqt(),fe);ye($qt(),fe);ye(Fqt(),fe);ye(qqt(),fe);ye(Bqt(),fe);ye(Vqt(),fe);ye(Jqt(),fe);ye(Wqt(),fe);ye(Gqt(),fe);ye(Zqt(),fe);ye(Qqt(),fe);ye(tUt(),fe);ye(nUt(),fe);ye(iUt(),fe);ye(sUt(),fe);ye(lUt(),fe);ye(dUt(),fe);ye(pUt(),fe);ye(hUt(),fe);ye(yUt(),fe);ye(_Ut(),fe);ye(wUt(),fe);ye(CUt(),fe);ye(OUt(),fe);ye(TUt(),fe);ye(PUt(),fe);ye(IUt(),fe);ye(AUt(),fe);ye(jUt(),fe);ye(DUt(),fe);ye(LUt(),fe);ye(FUt(),fe);ye(qUt(),fe);ye(BUt(),fe);ye(VUt(),fe);ye(JUt(),fe);ye(KUt(),fe);ye(XUt(),fe);ye(YUt(),fe);ye(eBt(),fe);ye(rBt(),fe);ye(oBt(),fe);ye(iBt(),fe);ye(sBt(),fe);ye(lBt(),fe);ye(dBt(),fe);ye(pBt(),fe);ye(hBt(),fe);ye(yBt(),fe);ye(_Bt(),fe);ye(wBt(),fe);ye(CBt(),fe);ye(OBt(),fe);ye(EBt(),fe);ye(MBt(),fe);ye(RBt(),fe);ye(NBt(),fe);ye(DBt(),fe);ye(LBt(),fe);ye(kBt(),fe);ye(UBt(),fe);ye(zBt(),fe);ye(HBt(),fe);ye(WBt(),fe);ye(GBt(),fe);ye(ZBt(),fe);ye(QBt(),fe);ye(tzt(),fe);ye(nzt(),fe);ye(izt(),fe);ye(szt(),fe);ye(lzt(),fe);ye(dzt(),fe);ye(pzt(),fe);ye(hzt(),fe);ye(yzt(),fe);ye(_zt(),fe);ye(wzt(),fe);ye(Szt(),fe);ye(Czt(),fe);ye(Ozt(),fe);ye(Ezt(),fe);ye(Mzt(),fe);ye(Rzt(),fe);ye(Nzt(),fe);ye(Dzt(),fe);ye(Lzt(),fe);ye(kzt(),fe);ye(Uzt(),fe);ye(Bzt(),fe);ye(zzt(),fe);ye(Hzt(),fe);ye(Wzt(),fe);ye(Gzt(),fe);ye(Zzt(),fe);ye(Qzt(),fe);ye(e4t(),fe);ye(t4t(),fe);ye(n4t(),fe);ye(i4t(),fe);ye(s4t(),fe);ye(l4t(),fe);ye(d4t(),fe);ye(p4t(),fe);ye(h4t(),fe);ye(y4t(),fe);ye(_4t(),fe);ye(w4t(),fe);ye(S4t(),fe);ye(x4t(),fe);ye(T4t(),fe);ye(P4t(),fe);ye(M4t(),fe);ye(R4t(),fe);ye(N4t(),fe);ye(D4t(),fe);ye(L4t(),fe);ye(k4t(),fe);ye(U4t(),fe);ye(B4t(),fe);ye(V4t(),fe);ye(J4t(),fe)});var zbe=S(ure=>{"use strict";Object.defineProperty(ure,"__esModule",{value:!0});ure.toJson=void 0;ure.fromJson=ZSn;var XSn=(t,e,r)=>JSON.stringify(t,e,r);ure.toJson=XSn;function ZSn(t,e){return JSON.parse(t,e)}});var K4t=S(Vbe=>{"use strict";Object.defineProperty(Vbe,"__esModule",{value:!0});Vbe.CohereError=void 0;var YSn=zbe(),mWe=class t extends Error{constructor({message:e,statusCode:r,body:n,rawResponse:o}){super(QSn({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),this.statusCode=r,this.body=n,this.rawResponse=o}};Vbe.CohereError=mWe;function QSn({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,YSn.toJson)(r,void 0,2)}`),n.join(`
|
||
`)}});var G4t=S(Hbe=>{"use strict";Object.defineProperty(Hbe,"__esModule",{value:!0});Hbe.CohereTimeoutError=void 0;var hWe=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};Hbe.CohereTimeoutError=hWe});var Tc=S(z6=>{"use strict";Object.defineProperty(z6,"__esModule",{value:!0});z6.CohereTimeoutError=z6.CohereError=void 0;var e0n=K4t();Object.defineProperty(z6,"CohereError",{enumerable:!0,get:function(){return e0n.CohereError}});var t0n=G4t();Object.defineProperty(z6,"CohereTimeoutError",{enumerable:!0,get:function(){return t0n.CohereTimeoutError}})});var X4t=S(jO=>{"use strict";var r0n=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]}),n0n=jO&&jO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o0n=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"&&r0n(r,e,n[o]);return n0n(r,e),r}}();Object.defineProperty(jO,"__esModule",{value:!0});jO.BadRequestError=void 0;var i0n=o0n(Tc()),gWe=class t extends i0n.CohereError{constructor(e,r){super({message:"BadRequestError",statusCode:400,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};jO.BadRequestError=gWe});var Z4t=S(DO=>{"use strict";var a0n=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]}),s0n=DO&&DO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u0n=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"&&a0n(r,e,n[o]);return s0n(r,e),r}}();Object.defineProperty(DO,"__esModule",{value:!0});DO.UnauthorizedError=void 0;var l0n=u0n(Tc()),yWe=class t extends l0n.CohereError{constructor(e,r){super({message:"UnauthorizedError",statusCode:401,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};DO.UnauthorizedError=yWe});var Y4t=S($O=>{"use strict";var c0n=$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]}),d0n=$O&&$O.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f0n=$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"&&c0n(r,e,n[o]);return d0n(r,e),r}}();Object.defineProperty($O,"__esModule",{value:!0});$O.ForbiddenError=void 0;var p0n=f0n(Tc()),bWe=class t extends p0n.CohereError{constructor(e,r){super({message:"ForbiddenError",statusCode:403,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};$O.ForbiddenError=bWe});var Q4t=S(LO=>{"use strict";var m0n=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]}),h0n=LO&&LO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g0n=LO&&LO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&m0n(r,e,n[o]);return h0n(r,e),r}}();Object.defineProperty(LO,"__esModule",{value:!0});LO.NotFoundError=void 0;var y0n=g0n(Tc()),_We=class t extends y0n.CohereError{constructor(e,r){super({message:"NotFoundError",statusCode:404,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};LO.NotFoundError=_We});var e2t=S(FO=>{"use strict";var b0n=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]}),_0n=FO&&FO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v0n=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"&&b0n(r,e,n[o]);return _0n(r,e),r}}();Object.defineProperty(FO,"__esModule",{value:!0});FO.UnprocessableEntityError=void 0;var w0n=v0n(Tc()),vWe=class t extends w0n.CohereError{constructor(e,r){super({message:"UnprocessableEntityError",statusCode:422,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};FO.UnprocessableEntityError=vWe});var t2t=S(kO=>{"use strict";var S0n=kO&&kO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),C0n=kO&&kO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x0n=kO&&kO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&S0n(r,e,n[o]);return C0n(r,e),r}}();Object.defineProperty(kO,"__esModule",{value:!0});kO.TooManyRequestsError=void 0;var O0n=x0n(Tc()),wWe=class t extends O0n.CohereError{constructor(e,r){super({message:"TooManyRequestsError",statusCode:429,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};kO.TooManyRequestsError=wWe});var r2t=S(qO=>{"use strict";var T0n=qO&&qO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E0n=qO&&qO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P0n=qO&&qO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T0n(r,e,n[o]);return E0n(r,e),r}}();Object.defineProperty(qO,"__esModule",{value:!0});qO.InvalidTokenError=void 0;var M0n=P0n(Tc()),SWe=class t extends M0n.CohereError{constructor(e,r){super({message:"InvalidTokenError",statusCode:498,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};qO.InvalidTokenError=SWe});var n2t=S(UO=>{"use strict";var I0n=UO&&UO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R0n=UO&&UO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A0n=UO&&UO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&I0n(r,e,n[o]);return R0n(r,e),r}}();Object.defineProperty(UO,"__esModule",{value:!0});UO.ClientClosedRequestError=void 0;var N0n=A0n(Tc()),CWe=class t extends N0n.CohereError{constructor(e,r){super({message:"ClientClosedRequestError",statusCode:499,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};UO.ClientClosedRequestError=CWe});var o2t=S(BO=>{"use strict";var j0n=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]}),D0n=BO&&BO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$0n=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"&&j0n(r,e,n[o]);return D0n(r,e),r}}();Object.defineProperty(BO,"__esModule",{value:!0});BO.InternalServerError=void 0;var L0n=$0n(Tc()),xWe=class t extends L0n.CohereError{constructor(e,r){super({message:"InternalServerError",statusCode:500,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};BO.InternalServerError=xWe});var i2t=S(zO=>{"use strict";var F0n=zO&&zO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),k0n=zO&&zO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q0n=zO&&zO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&F0n(r,e,n[o]);return k0n(r,e),r}}();Object.defineProperty(zO,"__esModule",{value:!0});zO.NotImplementedError=void 0;var U0n=q0n(Tc()),OWe=class t extends U0n.CohereError{constructor(e,r){super({message:"NotImplementedError",statusCode:501,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};zO.NotImplementedError=OWe});var a2t=S(VO=>{"use strict";var B0n=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]}),z0n=VO&&VO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V0n=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"&&B0n(r,e,n[o]);return z0n(r,e),r}}();Object.defineProperty(VO,"__esModule",{value:!0});VO.ServiceUnavailableError=void 0;var H0n=V0n(Tc()),TWe=class t extends H0n.CohereError{constructor(e,r){super({message:"ServiceUnavailableError",statusCode:503,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};VO.ServiceUnavailableError=TWe});var s2t=S(HO=>{"use strict";var J0n=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]}),W0n=HO&&HO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K0n=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"&&J0n(r,e,n[o]);return W0n(r,e),r}}();Object.defineProperty(HO,"__esModule",{value:!0});HO.GatewayTimeoutError=void 0;var G0n=K0n(Tc()),EWe=class t extends G0n.CohereError{constructor(e,r){super({message:"GatewayTimeoutError",statusCode:504,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};HO.GatewayTimeoutError=EWe});var u2t=S(uh=>{"use strict";var X0n=uh&&uh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cS=uh&&uh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&X0n(e,t,r)};Object.defineProperty(uh,"__esModule",{value:!0});cS(X4t(),uh);cS(Z4t(),uh);cS(Y4t(),uh);cS(Q4t(),uh);cS(e2t(),uh);cS(t2t(),uh);cS(r2t(),uh);cS(n2t(),uh);cS(o2t(),uh);cS(i2t(),uh);cS(a2t(),uh);cS(s2t(),uh)});var c2t=S(l2t=>{"use strict";Object.defineProperty(l2t,"__esModule",{value:!0})});var d2t=S(m4=>{"use strict";var Z0n=m4&&m4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y0n=m4&&m4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Z0n(e,t,r)};Object.defineProperty(m4,"__esModule",{value:!0});Y0n(c2t(),m4)});var LN=S(JO=>{"use strict";var Q0n=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]}),Jbe=JO&&JO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Q0n(e,t,r)};Object.defineProperty(JO,"__esModule",{value:!0});Jbe(gFt(),JO);Jbe(W4t(),JO);Jbe(u2t(),JO);Jbe(d2t(),JO)});var IWe={};Rn(IWe,{__addDisposableResource:()=>A2t,__assign:()=>Wbe,__asyncDelegator:()=>x2t,__asyncGenerator:()=>C2t,__asyncValues:()=>O2t,__await:()=>V6,__awaiter:()=>y2t,__classPrivateFieldGet:()=>M2t,__classPrivateFieldIn:()=>R2t,__classPrivateFieldSet:()=>I2t,__createBinding:()=>Gbe,__decorate:()=>m2t,__disposeResources:()=>N2t,__esDecorate:()=>eCn,__exportStar:()=>_2t,__extends:()=>f2t,__generator:()=>b2t,__importDefault:()=>P2t,__importStar:()=>E2t,__makeTemplateObject:()=>T2t,__metadata:()=>g2t,__param:()=>h2t,__propKey:()=>rCn,__read:()=>MWe,__rest:()=>p2t,__runInitializers:()=>tCn,__setFunctionName:()=>nCn,__spread:()=>v2t,__spreadArray:()=>S2t,__spreadArrays:()=>w2t,__values:()=>Kbe,default:()=>aCn});function f2t(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");PWe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function p2t(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 m2t(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 h2t(t,e){return function(r,n){e(r,n,t)}}function eCn(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 tCn(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 rCn(t){return typeof t=="symbol"?t:"".concat(t)}function nCn(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 g2t(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function y2t(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 b2t(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 _2t(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Gbe(e,t,r)}function Kbe(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 MWe(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 v2t(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(MWe(arguments[e]));return t}function w2t(){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 S2t(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 V6(t){return this instanceof V6?(this.v=t,this):new V6(t)}function C2t(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 V6?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 x2t(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:V6(t[o](a)),done:!1}:i?i(a):a}:i}}function O2t(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 Kbe=="function"?Kbe(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 T2t(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function E2t(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gbe(e,t,r);return oCn(e,t),e}function P2t(t){return t&&t.__esModule?t:{default:t}}function M2t(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 I2t(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 R2t(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 A2t(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 N2t(t){function e(i){t.error=t.hasError?new iCn(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 PWe,Wbe,Gbe,oCn,iCn,aCn,RWe=v(()=>{PWe=function(t,e){return PWe=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])},PWe(t,e)};Wbe=function(){return Wbe=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},Wbe.apply(this,arguments)};Gbe=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]};oCn=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};iCn=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};aCn={__extends:f2t,__assign:Wbe,__rest:p2t,__decorate:m2t,__param:h2t,__metadata:g2t,__awaiter:y2t,__generator:b2t,__createBinding:Gbe,__exportStar:_2t,__values:Kbe,__read:MWe,__spread:v2t,__spreadArrays:w2t,__spreadArray:S2t,__await:V6,__asyncGenerator:C2t,__asyncDelegator:x2t,__asyncValues:O2t,__makeTemplateObject:T2t,__importStar:E2t,__importDefault:P2t,__classPrivateFieldGet:M2t,__classPrivateFieldSet:I2t,__classPrivateFieldIn:R2t,__addDisposableResource:A2t,__disposeResources:N2t}});var AWe=S(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});dS.MAX_HASHABLE_LENGTH=dS.INIT=dS.KEY=dS.DIGEST_LENGTH=dS.BLOCK_SIZE=void 0;dS.BLOCK_SIZE=64;dS.DIGEST_LENGTH=32;dS.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]);dS.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];dS.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var j2t=S(Xbe=>{"use strict";Object.defineProperty(Xbe,"__esModule",{value:!0});Xbe.RawSha256=void 0;var fS=AWe(),sCn=function(){function t(){this.state=Int32Array.from(fS.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>fS.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===fS.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%fS.BLOCK_SIZE>=fS.BLOCK_SIZE-8){for(var o=this.bufferLength;o<fS.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<fS.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(fS.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(fS.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(fS.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<fS.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+(fS.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}();Xbe.RawSha256=sCn});var L2t=S((MHi,$2t)=>{var Zbe=Object.defineProperty,uCn=Object.getOwnPropertyDescriptor,lCn=Object.getOwnPropertyNames,cCn=Object.prototype.hasOwnProperty,dCn=(t,e)=>Zbe(t,"name",{value:e,configurable:!0}),fCn=(t,e)=>{for(var r in e)Zbe(t,r,{get:e[r],enumerable:!0})},pCn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of lCn(e))!cCn.call(t,o)&&o!==r&&Zbe(t,o,{get:()=>e[o],enumerable:!(n=uCn(e,o))||n.enumerable});return t},mCn=t=>pCn(Zbe({},"__esModule",{value:!0}),t),D2t={};fCn(D2t,{isArrayBuffer:()=>hCn});$2t.exports=mCn(D2t);var hCn=dCn(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var U2t=S((IHi,q2t)=>{var Ybe=Object.defineProperty,gCn=Object.getOwnPropertyDescriptor,yCn=Object.getOwnPropertyNames,bCn=Object.prototype.hasOwnProperty,F2t=(t,e)=>Ybe(t,"name",{value:e,configurable:!0}),_Cn=(t,e)=>{for(var r in e)Ybe(t,r,{get:e[r],enumerable:!0})},vCn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of yCn(e))!bCn.call(t,o)&&o!==r&&Ybe(t,o,{get:()=>e[o],enumerable:!(n=gCn(e,o))||n.enumerable});return t},wCn=t=>vCn(Ybe({},"__esModule",{value:!0}),t),k2t={};_Cn(k2t,{fromArrayBuffer:()=>CCn,fromString:()=>xCn});q2t.exports=wCn(k2t);var SCn=L2t(),NWe=Qw(),CCn=F2t((t,e=0,r=t.byteLength-e)=>{if(!(0,SCn.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return NWe.Buffer.from(t,e,r)},"fromArrayBuffer"),xCn=F2t((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?NWe.Buffer.from(t,e):NWe.Buffer.from(t)},"fromString")});var J2t=S((RHi,H2t)=>{var Qbe=Object.defineProperty,OCn=Object.getOwnPropertyDescriptor,TCn=Object.getOwnPropertyNames,ECn=Object.prototype.hasOwnProperty,jWe=(t,e)=>Qbe(t,"name",{value:e,configurable:!0}),PCn=(t,e)=>{for(var r in e)Qbe(t,r,{get:e[r],enumerable:!0})},MCn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of TCn(e))!ECn.call(t,o)&&o!==r&&Qbe(t,o,{get:()=>e[o],enumerable:!(n=OCn(e,o))||n.enumerable});return t},ICn=t=>MCn(Qbe({},"__esModule",{value:!0}),t),B2t={};PCn(B2t,{fromUtf8:()=>V2t,toUint8Array:()=>RCn,toUtf8:()=>ACn});H2t.exports=ICn(B2t);var z2t=U2t(),V2t=jWe(t=>{let e=(0,z2t.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),RCn=jWe(t=>typeof t=="string"?V2t(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),ACn=jWe(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,z2t.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var W2t=S(e_e=>{"use strict";Object.defineProperty(e_e,"__esModule",{value:!0});e_e.convertToBuffer=void 0;var NCn=J2t(),jCn=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:NCn.fromUtf8;function DCn(t){return t instanceof Uint8Array?t:typeof t=="string"?jCn(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}e_e.convertToBuffer=DCn});var K2t=S(t_e=>{"use strict";Object.defineProperty(t_e,"__esModule",{value:!0});t_e.isEmptyData=void 0;function $Cn(t){return typeof t=="string"?t.length===0:t.byteLength===0}t_e.isEmptyData=$Cn});var G2t=S(r_e=>{"use strict";Object.defineProperty(r_e,"__esModule",{value:!0});r_e.numToUint8=void 0;function LCn(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}r_e.numToUint8=LCn});var X2t=S(n_e=>{"use strict";Object.defineProperty(n_e,"__esModule",{value:!0});n_e.uint32ArrayFrom=void 0;function FCn(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)}n_e.uint32ArrayFrom=FCn});var o_e=S(WO=>{"use strict";Object.defineProperty(WO,"__esModule",{value:!0});WO.uint32ArrayFrom=WO.numToUint8=WO.isEmptyData=WO.convertToBuffer=void 0;var kCn=W2t();Object.defineProperty(WO,"convertToBuffer",{enumerable:!0,get:function(){return kCn.convertToBuffer}});var qCn=K2t();Object.defineProperty(WO,"isEmptyData",{enumerable:!0,get:function(){return qCn.isEmptyData}});var UCn=G2t();Object.defineProperty(WO,"numToUint8",{enumerable:!0,get:function(){return UCn.numToUint8}});var BCn=X2t();Object.defineProperty(WO,"uint32ArrayFrom",{enumerable:!0,get:function(){return BCn.uint32ArrayFrom}})});var Y2t=S(s_e=>{"use strict";Object.defineProperty(s_e,"__esModule",{value:!0});s_e.Sha256=void 0;var Z2t=(RWe(),zfe(IWe)),a_e=AWe(),i_e=j2t(),DWe=o_e(),zCn=function(){function t(e){this.secret=e,this.hash=new i_e.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,DWe.isEmptyData)(e)||this.error))try{this.hash.update((0,DWe.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 Z2t.__awaiter(this,void 0,void 0,function(){return Z2t.__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=VCn(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}();s_e.Sha256=zCn;function VCn(t){var e=(0,DWe.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 LWe=S($We=>{"use strict";Object.defineProperty($We,"__esModule",{value:!0});var HCn=(RWe(),zfe(IWe));HCn.__exportStar(Y2t(),$We)});var Q2t=v(()=>{});var eVt=v(()=>{});var tVt=v(()=>{});var u_e,FWe=v(()=>{u_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 vm,rVt=v(()=>{FWe();vm=class t extends u_e{constructor(r,n=!0){super(r,n);x(this,"name","CredentialsProviderError");Object.setPrototypeOf(this,t.prototype)}}});var nVt=v(()=>{});var oVt=v(()=>{});var iVt=v(()=>{});var aVt,sVt=v(()=>{aVt=(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 QL=v(()=>{rVt();FWe();nVt();oVt();iVt();sVt()});function l_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 kWe=v(()=>{});var uVt=v(()=>{});var lVt=v(()=>{uVt()});var H6=S(Pu=>{"use strict";Pu.HttpAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(Pu.HttpAuthLocation||(Pu.HttpAuthLocation={}));Pu.HttpApiKeyAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(Pu.HttpApiKeyAuthLocation||(Pu.HttpApiKeyAuthLocation={}));Pu.EndpointURLScheme=void 0;(function(t){t.HTTP="http",t.HTTPS="https"})(Pu.EndpointURLScheme||(Pu.EndpointURLScheme={}));Pu.AlgorithmId=void 0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(Pu.AlgorithmId||(Pu.AlgorithmId={}));var JCn=t=>{let e=[];return t.sha256!==void 0&&e.push({algorithmId:()=>Pu.AlgorithmId.SHA256,checksumConstructor:()=>t.sha256}),t.md5!=null&&e.push({algorithmId:()=>Pu.AlgorithmId.MD5,checksumConstructor:()=>t.md5}),{addChecksumAlgorithm(r){e.push(r)},checksumAlgorithms(){return e}}},WCn=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e},KCn=t=>JCn(t),GCn=t=>WCn(t);Pu.FieldPosition=void 0;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(Pu.FieldPosition||(Pu.FieldPosition={}));var XCn="__smithy_context";Pu.IniSectionType=void 0;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(Pu.IniSectionType||(Pu.IniSectionType={}));Pu.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"})(Pu.RequestHandlerProtocol||(Pu.RequestHandlerProtocol={}));Pu.SMITHY_CONTEXT_KEY=XCn;Pu.getDefaultClientConfiguration=KCn;Pu.resolveDefaultRuntimeConfig=GCn});var cVt=v(()=>{});var dVt=v(()=>{});var fVt=v(()=>{});function ZCn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var c_e,pVt=v(()=>{c_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=ZCn(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 mVt=v(()=>{});var hVt=v(()=>{});var gVt=v(()=>{});var yVt=v(()=>{lVt();cVt();dVt();fVt();pVt();mVt();hVt();gVt()});var YCn,QCn,d_e,qWe=v(()=>{yVt();YCn=t=>e=>async r=>{if(!c_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)},QCn={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},d_e=t=>({applyToStack:e=>{e.add(YCn(t),QCn)}})});var exn,txn,f_e,bVt=v(()=>{exn=()=>(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}},txn={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},f_e=t=>({applyToStack:e=>{e.add(exn(),txn)}})});var UWe=v(()=>{bVt()});var _Vt,vVt=v(()=>{_Vt={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"}});var wVt,BWe=v(()=>{wVt=()=>t=>async e=>t(e)});var p_e,SVt=v(()=>{vVt();BWe();p_e=t=>({applyToStack:e=>{e.add(wVt(),_Vt)}})});var zWe=v(()=>{SVt();BWe()});var CVt=v(()=>{});var pS=S(VWe=>{"use strict";var xVt=H6(),rxn=t=>t[xVt.SMITHY_CONTEXT_KEY]||(t[xVt.SMITHY_CONTEXT_KEY]={}),nxn=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};VWe.getSmithyContext=rxn;VWe.normalizeProvider=nxn});var OVt,TVt=v(()=>{OVt=(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 oxn(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var EVt,PVt,HWe=v(()=>{EVt=L(pS());TVt();PVt=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=t.authSchemePreference?await t.authSchemePreference():[],s=OVt(i,a),u=oxn(t.httpAuthSchemes),l=(0,EVt.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 ixn,m_e,MVt=v(()=>{HWe();ixn={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},m_e=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(PVt(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),ixn)}})});var IVt=v(()=>{});var RVt=v(()=>{});var h_e,AVt=v(()=>{h_e={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var JWe=v(()=>{IVt();AVt();RVt()});var QJi,NVt=v(()=>{JWe();QJi={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:h_e.name}});var jVt=v(()=>{HWe();MVt();NVt()});var DVt=v(()=>{});var $Vt=v(()=>{DVt()});var LVt=v(()=>{});var FVt=v(()=>{});var kVt=v(()=>{});function axn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var eF,qVt=v(()=>{eF=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=axn(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 J6,UVt=v(()=>{J6=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 BVt=v(()=>{});var zVt=v(()=>{});var lre=v(()=>{$Vt();LVt();FVt();kVt();qVt();UVt();BVt();zVt()});var VVt,sxn,uxn,HVt,WWe=v(()=>{lre();VVt=L(pS()),sxn=t=>e=>{throw e},uxn=(t,e)=>{},HVt=t=>(e,r)=>async n=>{if(!eF.isInstance(n.request))return e(n);let i=(0,VVt.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||sxn)(a));return(u.successHandler||uxn)(l.response,a),l}});var lxn,g_e,JVt=v(()=>{WWe();lxn={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},g_e=t=>({applyToStack:e=>{e.addRelativeTo(HVt(t),lxn)}})});var WVt=v(()=>{WWe();JVt()});var FN,KVt=v(()=>{FN=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});function KWe(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 cxn(e,a.client,s,a.withCommand,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield f;let p=c;c=dxn(f,n),d=!!(c&&(!a.stopOnSameToken||c!==p))}return void 0}}var cxn,dxn,GVt=v(()=>{cxn=async(t,e,r,n=i=>i,...o)=>{let i=new t(r);return i=n(i)??i,await e.send(i,...o)};dxn=(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 XVt,GWe,ZVt,tF,h4,YVt,XWe=v(()=>{XVt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",GWe=Object.entries(XVt).reduce((t,[e,r])=>(t[r]=Number(e),t),{}),ZVt=XVt.split(""),tF=6,h4=8,YVt=63});var Dv,QVt=v(()=>{XWe();Dv=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 GWe))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=GWe[t[l]]<<(c-l)*tF,a+=tF}else i>>=tF;let s=o/4*3;i>>=a%h4;let u=Math.floor(a/h4);for(let l=0;l<u;l++){let c=(u-l-1)*h4;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var eHt,tHt=v(()=>{eHt=t=>new TextEncoder().encode(t)});var rHt=v(()=>{});var nHt=v(()=>{});var oHt=v(()=>{tHt();rHt();nHt()});function $v(t){let e;typeof t=="string"?e=eHt(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)*h4,s+=h4;let u=Math.ceil(s/tF);a<<=u*tF-s;for(let l=1;l<=u;l++){let c=(u-l)*tF;o+=ZVt[(a&YVt<<c)>>c]}o+="==".slice(0,4-u)}return o}var iHt=v(()=>{oHt();XWe()});var KO=v(()=>{QVt();iHt()});var aHt,sHt=v(()=>{aHt=t=>new TextEncoder().encode(t)});var uHt=v(()=>{});var y_e,lHt=v(()=>{y_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 ZWe=v(()=>{sHt();uHt();lHt()});var W6,cHt=v(()=>{KO();ZWe();W6=class t extends Uint8Array{static fromString(e,r="utf-8"){if(typeof e=="string")return r==="base64"?t.mutate(Dv(e)):t.mutate(aHt(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"?$v(this):y_e(this)}}});var dHt=v(()=>{});var YWe,fHt=v(()=>{YWe=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var pHt=v(()=>{});var mHt=v(()=>{});var hHt=v(()=>{});var gHt=v(()=>{});var yHt=v(()=>{});var bHt=v(()=>{yHt()});var _Ht=v(()=>{});var vHt=v(()=>{});var wHt=v(()=>{});var SHt=v(()=>{});var cre,CHt=v(()=>{cre=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 xHt=v(()=>{});var OHt=v(()=>{});var THt=v(()=>{bHt();_Ht();vHt();wHt();SHt();CHt();xHt();OHt()});var dre=S(QWe=>{"use strict";var EHt=t=>encodeURIComponent(t).replace(/[!'()*]/g,fxn),fxn=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`,pxn=t=>t.split("/").map(EHt).join("/");QWe.escapeUri=EHt;QWe.escapeUriPath=pxn});function PHt(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=(0,b_e.escapeUri)(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${(0,b_e.escapeUri)(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${(0,b_e.escapeUri)(n)}`),e.push(o)}}return e.join("&")}var b_e,MHt=v(()=>{b_e=L(dre())});function e6e(t,e){return new Request(t,e)}var IHt=v(()=>{});function RHt(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 AHt=v(()=>{});var t6e,rF,NHt=v(()=>{THt();MHt();IHt();AHt();t6e={supported:void 0},rF=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)),t6e.supported===void 0&&(t6e.supported=typeof Request<"u"&&"keepalive"in e6e("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=PHt(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),t6e.supported&&(m.keepalive=i),typeof this.config.requestInit=="function"&&Object.assign(m,this.config.requestInit(e));let h=()=>{},y=e6e(f,m),g=[fetch(y).then(b=>{let _=b.headers,w={};for(let T of _.entries())w[T[0]]=T[1];return b.body!=null?{response:new cre({headers:w,reason:b.statusText,statusCode:b.status,body:b.body})}:b.blob().then(T=>({response:new cre({headers:w,reason:b.statusText,statusCode:b.status,body:T})}))}),RHt(o)];return r&&g.push(new Promise((b,_)=>{let w=()=>{let O=new Error("Request aborted");O.name="AbortError",_(O)};if(typeof r.addEventListener=="function"){let O=r;O.addEventListener("abort",w,{once:!0}),h=()=>O.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 mxn(t){let e=await gxn(t),r=Dv(e);return new Uint8Array(r)}async function hxn(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 gxn(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 K6,jHt=v(()=>{KO();K6=async t=>typeof Blob=="function"&&t instanceof Blob||t.constructor?.name==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await t.arrayBuffer()):mxn(t):hxn(t)});var fre=v(()=>{NHt();jHt()});function $Ht(t){let e="";for(let r=0;r<t.byteLength;r++)e+=DHt[t[r]];return e}var DHt,yxn,LHt=v(()=>{DHt={},yxn={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),DHt[t]=e,yxn[e]=t}});var FHt,qHt,kHt,UHt=v(()=>{fre();KO();LHt();ZWe();fHt();FHt="The stream has already been transformed.",qHt=t=>{if(!kHt(t)&&!YWe(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(FHt);return e=!0,await K6(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 $v(i);if(o==="hex")return $Ht(i);if(o===void 0||o==="utf8"||o==="utf-8")return y_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(FHt);if(e=!0,kHt(t))return n(t);if(YWe(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},kHt=t=>typeof Blob=="function"&&t instanceof Blob});var BHt=v(()=>{});var r6e=v(()=>{cHt();dHt();pHt();mHt();hHt();gHt();UHt();BHt()});var kN,n6e=v(()=>{r6e();kN=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return W6.mutate(t);if(!t)return W6.mutate(new Uint8Array);let r=e.streamCollector(t);return W6.mutate(await r)}});function o6e(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var zHt=v(()=>{});var nF,i6e=v(()=>{nF=t=>typeof t=="function"?t():t});var __e,v_e=v(()=>{__e=(t,e,r,n,o)=>({name:e,namespace:t,traits:r,input:n,output:o})});var VHt,HHt,a6e,JHt=v(()=>{lre();VHt=L(pS());v_e();HHt=t=>(e,r)=>async n=>{let{response:o}=await e(n),{operationSchema:i}=(0,VHt.getSmithyContext)(r),[,a,s,u,l,c]=i??[];try{let d=await t.protocol.deserializeResponse(__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(J6.isInstance(o)){let{headers:p={}}=o,m=Object.entries(p);d.$metadata={httpStatusCode:o.statusCode,requestId:a6e(/^x-[\w-]+-request-?id$/,m),extendedRequestId:a6e(/^x-[\w-]+-id-2$/,m),cfId:a6e(/^x-[\w-]+-cf-id$/,m)}}}catch{}}throw d}},a6e=(t,e)=>(e.find(([r])=>r.match(t))||[void 0,void 0])[1]});var WHt,KHt,GHt=v(()=>{WHt=L(pS());v_e();KHt=t=>(e,r)=>async n=>{let{operationSchema:o}=(0,WHt.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(__e(i,a,s,u,l),n.input,{...t,...r,endpoint:c});return e({...n,request:d})}});function w_e(t){return{applyToStack:e=>{e.add(KHt(t),_xn),e.add(HHt(t),bxn),t.protocol.setSerdeContext(t)}}}var bxn,_xn,XHt=v(()=>{JHt();GHt();bxn={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},_xn={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var mS,g4=v(()=>{mS=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 S_e,ZHt,YHt=v(()=>{g4();S_e=class S_e extends mS{constructor(){super(...arguments);x(this,"name");x(this,"traits");x(this,"valueSchema");x(this,"symbol",S_e.symbol)}};x(S_e,"symbol",Symbol.for("@smithy/lis"));ZHt=S_e});var C_e,QHt,eJt=v(()=>{g4();C_e=class C_e extends mS{constructor(){super(...arguments);x(this,"name");x(this,"traits");x(this,"keySchema");x(this,"valueSchema");x(this,"symbol",C_e.symbol)}};x(C_e,"symbol",Symbol.for("@smithy/map"));QHt=C_e});var x_e,tJt,rJt=v(()=>{g4();x_e=class x_e extends mS{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"));tJt=x_e});var T_e,O_e,s6e=v(()=>{g4();T_e=class T_e extends mS{constructor(){super(...arguments);x(this,"name");x(this,"traits");x(this,"memberNames");x(this,"memberList");x(this,"symbol",T_e.symbol)}};x(T_e,"symbol",Symbol.for("@smithy/str"));O_e=T_e});var E_e,nJt,oJt=v(()=>{s6e();E_e=class E_e extends O_e{constructor(){super(...arguments);x(this,"ctor");x(this,"symbol",E_e.symbol)}};x(E_e,"symbol",Symbol.for("@smithy/err"));nJt=E_e});function y4(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 u6e=v(()=>{});function pre(t,e){if(t instanceof Yi)return Object.assign(t,{memberName:e,_isMemberSchema:!0});let r=Yi;return new r(t,e)}var oF,Yi,l6e,vxn,iJt=v(()=>{i6e();u6e();oF=class oF{constructor(e,r){x(this,"ref");x(this,"memberName");x(this,"symbol",oF.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;l6e(o);)n.push(o[1]),o=o[0],i=nF(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,y4(s))}}else this.memberTraits=0;if(i instanceof oF){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=nF(i),vxn(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=nF(e);if(r instanceof oF)return r;if(l6e(r)){let[n,o]=r;if(n instanceof oF)return Object.assign(n.getMergedTraits(),y4(o)),n;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}return new oF(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 y4(this.memberTraits)}getOwnTraits(){return y4(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 pre([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 pre([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 pre(l6e(o)?o:[o,0],e)}if(this.isDocumentSchema())return pre([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],pre([e[5][r],0],e[4][r])]}};x(oF,"symbol",Symbol.for("@smithy/nor"));Yi=oF;l6e=t=>Array.isArray(t)&&t.length===2,vxn=t=>Array.isArray(t)&&t.length>=5});var P_e,aJt,sJt=v(()=>{g4();P_e=class P_e extends mS{constructor(){super(...arguments);x(this,"name");x(this,"schemaRef");x(this,"traits");x(this,"symbol",P_e.symbol)}};x(P_e,"symbol",Symbol.for("@smithy/sim"));aJt=P_e});var uJt=v(()=>{});var GO,Bs,lJt=v(()=>{GO=class GO{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 GO.registries.has(e)||GO.registries.set(e,new GO(e)),GO.registries.get(e)}register(e,r){let n=this.normalizeShapeId(e);GO.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=GO.for(n[1]);o.schemas.set(n[1]+"#"+n[2],n),o.exceptions.set(n,r)}getErrorCtor(e){let r=e;return GO.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(GO,"registries",new Map);Bs=GO});var sg=v(()=>{i6e();XHt();YHt();eJt();rJt();v_e();oJt();iJt();g4();sJt();s6e();uJt();u6e();lJt()});var cJt=v(()=>{});var c6e,wxn,dJt,Sxn,fJt,pJt,mJt,Cxn,hJt,gJt,xxn,M_e,G6,yJt,Oxn,Txn,d6e=v(()=>{c6e=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&Txn.warn(Oxn(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},wxn=Math.ceil(34028234663852886e22),dJt=t=>{let e=c6e(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>wxn)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},Sxn=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},fJt=t=>mJt(t,16),pJt=t=>mJt(t,8),mJt=(t,e)=>{let r=Sxn(t);if(r!==void 0&&Cxn(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},Cxn=(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]}},hJt=t=>c6e(typeof t=="string"?M_e(t):t),gJt=t=>dJt(typeof t=="string"?M_e(t):t),xxn=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,M_e=t=>{let e=t.match(xxn);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},G6=t=>fJt(typeof t=="string"?M_e(t):t),yJt=t=>pJt(typeof t=="string"?M_e(t):t),Oxn=t=>String(new TypeError(t).stack||t).split(`
|
||
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
|
||
`),Txn={warn:console.warn}});function I_e(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`${Exn[n]}, ${u} ${p6e[r]} ${e} ${l}:${c}:${d} GMT`}var Exn,p6e,Pxn,bJt,Mxn,_Jt,Ixn,Rxn,Axn,vJt,wJt,mre,Nxn,jxn,Dxn,f6e,$xn,Lxn,Fxn,XO,kxn,qxn,X6,SJt=v(()=>{d6e();Exn=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],p6e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Pxn=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),bJt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Pxn.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=G6(X6(n)),d=XO(o,"month",1,12),f=XO(i,"day",1,31);return mre(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},Mxn=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),_Jt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=Mxn.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=G6(X6(n)),f=XO(o,"month",1,12),p=XO(i,"day",1,31),m=mre(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&m.setTime(m.getTime()-qxn(c)),m},Ixn=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$/),Rxn=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$/),Axn=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})$/),vJt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=Ixn.exec(t);if(e){let[r,n,o,i,a,s,u,l]=e;return mre(G6(X6(i)),f6e(o),XO(n,"day",1,31),{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})}if(e=Rxn.exec(t),e){let[r,n,o,i,a,s,u,l]=e;return Dxn(mre(Nxn(i),f6e(o),XO(n,"day",1,31),{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l}))}if(e=Axn.exec(t),e){let[r,n,o,i,a,s,u,l]=e;return mre(G6(X6(l)),f6e(n),XO(o.trimLeft(),"day",1,31),{hours:i,minutes:a,seconds:s,fractionalMilliseconds:u})}throw new TypeError("Invalid RFC-7231 date-time value")},wJt=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=hJt(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))},mre=(t,e,r,n)=>{let o=e-1;return Lxn(t,o,r),new Date(Date.UTC(t,o,r,XO(n.hours,"hour",0,23),XO(n.minutes,"minute",0,59),XO(n.seconds,"seconds",0,60),kxn(n.fractionalMilliseconds)))},Nxn=t=>{let e=new Date().getUTCFullYear(),r=Math.floor(e/100)*100+G6(X6(t));return r<e?r+100:r},jxn=50*365*24*60*60*1e3,Dxn=t=>t.getTime()-new Date().getTime()>jxn?new Date(Date.UTC(t.getUTCFullYear()-100,t.getUTCMonth(),t.getUTCDate(),t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds())):t,f6e=t=>{let e=p6e.indexOf(t);if(e<0)throw new TypeError(`Invalid month: ${t}`);return e+1},$xn=[31,28,31,30,31,30,31,31,30,31,30,31],Lxn=(t,e,r)=>{let n=$xn[e];if(e===1&&Fxn(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${p6e[e]} in ${t}: ${r}`)},Fxn=t=>t%4===0&&(t%100!==0||t%400===0),XO=(t,e,r,n)=>{let o=yJt(X6(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},kxn=t=>t==null?0:gJt("0."+t)*1e3,qxn=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},X6=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var m6e,CJt=v(()=>{m6e=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)});var cy,b4,xJt=v(()=>{CJt();cy=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0")),b4=()=>{if(m6e)return m6e();let t=new Uint8Array(16);return crypto.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128,cy[t[0]]+cy[t[1]]+cy[t[2]]+cy[t[3]]+"-"+cy[t[4]]+cy[t[5]]+"-"+cy[t[6]]+cy[t[7]]+"-"+cy[t[8]]+cy[t[9]]+"-"+cy[t[10]]+cy[t[11]]+cy[t[12]]+cy[t[13]]+cy[t[14]]+cy[t[15]]}});var h6e=v(()=>{xJt()});var OJt=v(()=>{h6e()});var hS,TJt=v(()=>{hS=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};hS.from=t=>t&&typeof t=="object"&&(t instanceof hS||"deserializeJSON"in t)?t:typeof t=="string"||Object.getPrototypeOf(t)===String.prototype?hS(String(t)):hS(JSON.stringify(t));hS.fromObject=hS.from});var EJt=v(()=>{});function qN(t,e,r){let n=Number(t);if(n<e||n>r)throw new Error(`Value ${n} out of range [${e}, ${r}]`)}var g6e,y6e,b6e,PJt,MJt,Uxn,Bxn,zxn,Vxn,Hxn,IJt,RJt,AJt,NJt=v(()=>{g6e="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",y6e="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",b6e="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",PJt="(\\d?\\d)",MJt="(\\d{4})",Uxn=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),Bxn=new RegExp(`^${g6e}, ${PJt} ${y6e} ${MJt} ${b6e} GMT$`),zxn=new RegExp(`^${g6e}, ${PJt}-${y6e}-(\\d\\d) ${b6e} GMT$`),Vxn=new RegExp(`^${g6e} ${y6e} ( [1-9]|\\d\\d) ${b6e} ${MJt}$`),Hxn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],IJt=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))},RJt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC3339 timestamps must be strings");let e=Uxn.exec(t);if(!e)throw new TypeError(`Invalid RFC3339 timestamp format ${t}`);let[,r,n,o,i,a,s,,u,l]=e;qN(n,1,12),qN(o,1,31),qN(i,0,23),qN(a,0,59),qN(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},AJt=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=Bxn.exec(t))?[,e,r,n,o,i,a,s]=u:(u=zxn.exec(t))?([,e,r,n,o,i,a,s]=u,n=(Number(n)+1900).toString()):(u=Vxn.exec(t))&&([,r,e,o,i,a,s,n]=u),n&&a){let l=Date.UTC(Number(n),Hxn.indexOf(r),Number(e),Number(o),Number(i),Number(a),s?Math.round(parseFloat(`0.${s}`)*1e3):0);qN(e,1,31),qN(o,0,23),qN(i,0,59),qN(a,0,60);let c=new Date(l);return c.setUTCFullYear(Number(n)),c}throw new TypeError(`Invalid RFC7231 date-time value ${t}.`)}});var jJt=v(()=>{});var DJt,$Jt=v(()=>{DJt=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 LJt,lh,FJt=v(()=>{LJt=/^-?\d*(\.\d+)?$/,lh=class t{constructor(e,r){x(this,"string");x(this,"type");if(this.string=e,this.type=r,!LJt.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"&&LJt.test(r.string)}}});var iF=v(()=>{cJt();SJt();OJt();TJt();d6e();EJt();NJt();jJt();$Jt();FJt()});var Z6,R_e=v(()=>{Z6=class{constructor(){x(this,"serdeContext")}setSerdeContext(e){this.serdeContext=e}}});var kJt,qJt=v(()=>{kJt=t=>new TextEncoder().encode(t)});var UJt=v(()=>{});var A_e,BJt=v(()=>{A_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 _6e=v(()=>{qJt();UJt();BJt()});var v6e,zJt=v(()=>{_6e();v6e=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:O}=_.getMergedTraits();if(g=g||!!(w||O),O)_.isBlobSchema()?y[b]=m:_.isStringSchema()?y[b]=(this.serdeContext?.utf8Encoder??A_e)(m):_.isStructSchema()&&(y[b]=await this.deserializer.read(_,m));else if(w){let T=f[p].headers[b]?.value;T!=null&&(_.isNumericSchema()?T&&typeof T=="object"&&"bytes"in T?y[b]=BigInt(T.toString()):y[b]=Number(T):y[b]=T)}}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??kJt)(c):c,eventType:i,explicitPayloadContentType:s,additionalHeaders:l}}}});var VJt={};Rn(VJt,{EventStreamSerde:()=>v6e});var HJt=v(()=>{zJt()});var N_e,w6e=v(()=>{sg();lre();R_e();N_e=class extends Z6{constructor(r){super();x(this,"options");this.options=r}getRequestType(){return eF}getResponseType(){return J6}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=Yi.of(n.input),a=y4(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(()=>(HJt(),VJt));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 JJt=v(()=>{});var Y6,WJt=v(()=>{sg();lre();n6e();w6e();Y6=class extends N_e{async serializeRequest(e,r,n){let o=this.serializer,i={},a={},s=await n.endpoint(),u=Yi.of(e?.input),l=u.getSchema(),c,d=new eF({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=Yi.of(e.output),a={};if(n.statusCode>=300){let u=await kN(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 kN(n.body,r);u.byteLength>0&&Object.assign(a,await o.read(i,u))}return a.$metadata=this.deserializeMetadata(n),a}}});var KJt=v(()=>{});var GJt=v(()=>{});function aF(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 S6e=v(()=>{});var j_e,XJt=v(()=>{sg();iF();KO();_6e();R_e();S6e();j_e=class extends Z6{constructor(r){super();x(this,"settings");this.settings=r}read(r,n){let o=Yi.of(r);if(o.isListSchema())return DJt(n).map(i=>this.read(o.getValueSchema(),i));if(o.isBlobSchema())return(this.serdeContext?.base64Decoder??Dv)(n);if(o.isTimestampSchema())switch(aF(o,this.settings)){case 5:return RJt(n);case 6:return AJt(n);case 7:return IJt(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=hS.from(a)),a}return o.isNumericSchema()?Number(n):o.isBigIntegerSchema()?BigInt(n):o.isBigDecimalSchema()?new lh(n,"bigDecimal"):o.isBooleanSchema()?String(n).toLowerCase()==="true":n}base64ToUtf8(r){return(this.serdeContext?.utf8Encoder??A_e)((this.serdeContext?.base64Decoder??Dv)(r))}}});var ZJt=v(()=>{});var YJt=v(()=>{});var QJt=v(()=>{});var sF=v(()=>{n6e();zHt();JJt();w6e();WJt();GJt();KJt();XJt();ZJt();QJt();YJt();S6e();R_e()});var e3t=v(()=>{});function t3t(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 r3t=v(()=>{});var Q6,n3t=v(()=>{Q6=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 o3t=v(()=>{});var i3t=v(()=>{});var e5,a3t=v(()=>{e5=class{async sign(e,r,n){return e}}});var s3t=v(()=>{o3t();i3t();a3t()});var Jxn,u3t,C6e,l3t,c3t=v(()=>{Jxn=t=>function(r){return C6e(r)&&r.expiration.getTime()-Date.now()<t},u3t=Jxn(3e5),C6e=t=>t.expiration!==void 0,l3t=(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 d3t=v(()=>{n3t();s3t();c3t()});var ZO=v(()=>{CVt();jVt();WVt();KVt();GVt();e3t();r3t();d3t()});function Kxn(t){return t===void 0?!0:typeof t=="string"&&t.length<=50}function D_e(t){let e=FN(t.userAgentAppId??Wxn),{customUserAgent:r}=t;return Object.assign(t,{customUserAgent:typeof r=="string"?[[r]]:r,userAgentAppId:async()=>{let n=await e();if(!Kxn(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 Wxn,f3t=v(()=>{ZO();Wxn=void 0});var t5,p3t=v(()=>{t5=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 Gxn,hre,x6e=v(()=>{Gxn=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}$"),hre=t=>Gxn.test(t)||t.startsWith("[")&&t.endsWith("]")});var Xxn,_4,O6e=v(()=>{Xxn=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),_4=(t,e=!1)=>{if(!e)return Xxn.test(t);let r=t.split(".");for(let n of r)if(!_4(n))return!1;return!0}});var UN,$_e=v(()=>{UN={}});var BN,m3t=v(()=>{BN="endpoints"});function gS(t){return typeof t!="object"||t==null?t:"ref"in t?`$${gS(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(gS).join(", ")})`:JSON.stringify(t,null,2)}var h3t=v(()=>{});var gre=v(()=>{m3t();h3t()});var dl,g3t=v(()=>{dl=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var y3t=v(()=>{});var b3t=v(()=>{});var _3t=v(()=>{});var v3t=v(()=>{});var w3t=v(()=>{});var S3t=v(()=>{});var yS=v(()=>{g3t();y3t();b3t();_3t();v3t();w3t();S3t()});var C3t,x3t=v(()=>{C3t=(t,e)=>t===e});var O3t,T3t=v(()=>{yS();O3t=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 dl(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new dl(`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 L_e,E3t=v(()=>{yS();T3t();L_e=(t,e)=>O3t(e).reduce((r,n)=>{if(typeof r!="object")throw new dl(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var P3t,M3t=v(()=>{P3t=t=>t!=null});var I3t,R3t=v(()=>{I3t=t=>!t});var F_e,T6e,A3t,N3t=v(()=>{F_e=L(H6());x6e();T6e={[F_e.EndpointURLScheme.HTTP]:80,[F_e.EndpointURLScheme.HTTPS]:443},A3t=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(F_e.EndpointURLScheme).includes(u))return null;let l=hre(o),c=r.includes(`${n}:${T6e[u]}`)||typeof t=="string"&&t.includes(`${n}:${T6e[u]}`),d=`${n}${c?`:${T6e[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var j3t,D3t=v(()=>{j3t=(t,e)=>t===e});var $3t,L3t=v(()=>{$3t=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var F3t,k3t=v(()=>{F3t=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var E6e=v(()=>{x3t();E3t();M3t();O6e();R3t();N3t();D3t();L3t();k3t()});var q3t,U3t=v(()=>{E6e();q3t={booleanEquals:C3t,getAttr:L_e,isSet:P3t,isValidHostLabel:_4,not:I3t,parseURL:A3t,stringEquals:j3t,substring:$3t,uriEncode:F3t}});var k_e,P6e=v(()=>{E6e();k_e=(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(L_e(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var B3t,z3t=v(()=>{B3t=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var v4,q_e,V3t,yre=v(()=>{yS();$_e();U3t();P6e();z3t();v4=(t,e,r)=>{if(typeof t=="string")return k_e(t,r);if(t.fn)return V3t.callFunction(t,r);if(t.ref)return B3t(t,r);throw new dl(`'${e}': ${String(t)} is not a string, function or reference.`)},q_e=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:V3t.evaluateExpression(i,"arg",r)),o=t.split(".");return o[0]in UN&&o[1]!=null?UN[o[0]][o[1]](...n):q3t[t](...n)},V3t={evaluateExpression:v4,callFunction:q_e}});var H3t=v(()=>{yre()});var J3t,W3t=v(()=>{gre();yS();H3t();J3t=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new dl(`'${t}' is already defined in Reference Record.`);let n=q_e(e,r);return r.logger?.debug?.(`${BN} evaluateCondition: ${gS(e)} = ${gS(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var r5,U_e=v(()=>{gre();W3t();r5=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=J3t(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${BN} assign: ${i.name} := ${gS(i.value)}`))}return{result:!0,referenceRecord:r}}});var K3t,G3t=v(()=>{yS();yre();K3t=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=v4(i,"Header value entry",e);if(typeof a!="string")throw new dl(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var M6e,X3t,Z3t,Y3t=v(()=>{yS();P6e();M6e=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:Z3t.getEndpointProperty(o,e)}),{}),X3t=(t,e)=>{if(Array.isArray(t))return t.map(r=>X3t(r,e));switch(typeof t){case"string":return k_e(t,e);case"object":if(t===null)throw new dl(`Unexpected endpoint property: ${t}`);return Z3t.getEndpointProperties(t,e);case"boolean":return t;default:throw new dl(`Unexpected endpoint property type: ${typeof t}`)}},Z3t={getEndpointProperty:X3t,getEndpointProperties:M6e}});var Q3t,eWt=v(()=>{yS();yre();Q3t=(t,e)=>{let r=v4(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 dl(`Endpoint URL must be a string, got ${typeof r}`)}});var tWt,rWt=v(()=>{gre();U_e();G3t();Y3t();eWt();tWt=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=r5(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${BN} Resolving endpoint from template: ${gS(n)}`),{...l!=null&&{headers:K3t(l,a)},...u!=null&&{properties:M6e(u,a)},url:Q3t(s,a)}}});var nWt,oWt=v(()=>{yS();U_e();yre();nWt=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=r5(r,e);if(o)throw new dl(v4(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var I6e,Zxn,iWt,aWt=v(()=>{yS();U_e();rWt();oWt();I6e=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=tWt(r,e);if(n)return n}else if(r.type==="error")nWt(r,e);else if(r.type==="tree"){let n=iWt.evaluateTreeRule(r,e);if(n)return n}else throw new dl(`Unknown endpoint rule: ${r}`);throw new dl("Rules evaluation failed")},Zxn=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=r5(r,e);if(o)return iWt.evaluateRules(n,{...e,referenceRecord:{...e.referenceRecord,...i}})},iWt={evaluateRules:I6e,evaluateTreeRule:Zxn}});var sWt=v(()=>{$_e();aWt()});var B_e,uWt=v(()=>{gre();yS();sWt();B_e=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${BN} Initial EndpointParams: ${gS(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 dl(`Missing required parameter: '${l}'`);let u=I6e(i,{endpointParams:r,logger:n,referenceRecord:{}});return e.logger?.debug?.(`${BN} Resolved endpoint: ${gS(u)}`),u}});var w4=v(()=>{p3t();x6e();O6e();$_e();uWt();yS()});var R6e=v(()=>{w4()});var A6e,lWt=v(()=>{w4();R6e();A6e=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!A6e(r))return!1;return!0}return!(!_4(t)||t.length<3||t.length>63||t!==t.toLowerCase()||hre(t))}});var cWt,Yxn,dWt,fWt=v(()=>{cWt=":",Yxn="/",dWt=t=>{let e=t.split(cWt);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(cWt)==="")return null;let u=s.map(l=>l.split(Yxn)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var mWt,pWt=v(()=>{mWt={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 eOn,tOn,hWt,gWt,N6e=v(()=>{pWt();eOn=mWt,tOn="",hWt=t=>{let{partitions:e}=eOn;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}},gWt=()=>tOn});var bre,yWt=v(()=>{w4();lWt();fWt();N6e();bre={isVirtualHostableS3Bucket:A6e,parseArn:dWt,partition:hWt};UN.aws=bre});function bWt(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 _Wt=v(()=>{});var uF,z_e=v(()=>{_Wt();uF=t=>{if(typeof t=="string")return uF(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=bWt(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var vWt=v(()=>{});var wWt=v(()=>{});var SWt=v(()=>{});var CWt=v(()=>{});var xWt=v(()=>{});var OWt=v(()=>{});var TWt=v(()=>{});var EWt=v(()=>{});var PWt=v(()=>{SWt();CWt();xWt();OWt();TWt();EWt()});var V_e=v(()=>{yWt();N6e();R6e();vWt();wWt();PWt()});var MWt=v(()=>{});var IWt=v(()=>{MWt()});var RWt=v(()=>{});var AWt=v(()=>{});var NWt=v(()=>{});function rOn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var H_e,jWt=v(()=>{H_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=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 DWt=v(()=>{});var $Wt=v(()=>{});var LWt=v(()=>{});var FWt=v(()=>{IWt();RWt();AWt();NWt();jWt();DWt();$Wt();LWt()});var kWt=v(()=>{});function n5(t,e,r){return t.$source||(t.$source={}),t.$source[e]=r,t}var qWt=v(()=>{});function gC(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 UWt=v(()=>{});var BWt=v(()=>{});var J_e=v(()=>{kWt();qWt();UWt();BWt()});var zWt=v(()=>{});var VWt=v(()=>{zWt()});var HWt=v(()=>{});var JWt=v(()=>{});var WWt=v(()=>{});function nOn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var lF,KWt=v(()=>{lF=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=nOn(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 W_e,GWt=v(()=>{W_e=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 XWt=v(()=>{});var ZWt=v(()=>{});var _re=v(()=>{VWt();HWt();JWt();WWt();KWt();GWt();XWt();ZWt()});var j6e,YWt=v(()=>{_re();j6e=t=>W_e.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var K_e,D6e=v(()=>{K_e=t=>new Date(Date.now()+t)});var QWt,e6t=v(()=>{D6e();QWt=(t,e)=>Math.abs(K_e(e).getTime()-t)>=3e5});var $6e,t6t=v(()=>{e6t();$6e=(t,e)=>{let r=Date.parse(t);return QWt(r,e)?r-Date.now():e}});var r6t=v(()=>{YWt();D6e();t6t()});var vre,n6t,S4,o6t=v(()=>{_re();r6t();vre=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},n6t=async t=>{let e=vre("context",t.context),r=vre("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await vre("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},S4=class{async sign(e,r,n){if(!lF.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await n6t(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:K_e(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??j6e(r.$response);if(n){let o=vre("config",e.config),i=o.systemClockOffset;o.systemClockOffset=$6e(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=j6e(e);if(n){let o=vre("config",r.config);o.systemClockOffset=$6e(n,o.systemClockOffset)}}}});var i6t=v(()=>{});var a6t=v(()=>{});var s6t=v(()=>{});function l6t(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 L6e)e[r/2]=L6e[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function bS(t){let e="";for(let r=0;r<t.byteLength;r++)e+=u6t[t[r]];return e}var u6t,L6e,o5=v(()=>{u6t={},L6e={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),u6t[t]=e,L6e[e]=t}});var wre,F6e=v(()=>{wre=t=>new TextEncoder().encode(t)});var zN,c6t=v(()=>{F6e();zN=t=>typeof t=="string"?wre(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var G_e,d6t=v(()=>{G_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 cF=v(()=>{F6e();c6t();d6t()});var f6t,p6t,k6e,m6t,h6t,q6e,U6e,B6e,z6e,oOn,g6t,y6t,Sre,b6t,_6t,v6t,w6t,X_e,S6t,C6t,x6t,V6e,O6t,dF=v(()=>{f6t="X-Amz-Algorithm",p6t="X-Amz-Credential",k6e="X-Amz-Date",m6t="X-Amz-SignedHeaders",h6t="X-Amz-Expires",q6e="X-Amz-Signature",U6e="X-Amz-Security-Token",B6e="authorization",z6e=k6e.toLowerCase(),oOn="date",g6t=[B6e,z6e,oOn],y6t=q6e.toLowerCase(),Sre="x-amz-content-sha256",b6t=U6e.toLowerCase(),_6t={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},v6t=/^proxy-/,w6t=/^sec-/,X_e="AWS4-HMAC-SHA256",S6t="AWS4-HMAC-SHA256-PAYLOAD",C6t="UNSIGNED-PAYLOAD",x6t=50,V6e="aws4_request",O6t=60*60*24*7});var Z_e,H6e,Y_e,E6t,T6t,J6e=v(()=>{o5();cF();dF();Z_e={},H6e=[],Y_e=(t,e,r)=>`${t}/${e}/${r}/${V6e}`,E6t=async(t,e,r,n,o)=>{let i=await T6t(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${bS(i)}:${e.sessionToken}`;if(a in Z_e)return Z_e[a];for(H6e.push(a);H6e.length>x6t;)delete Z_e[H6e.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,V6e])s=await T6t(t,s,u);return Z_e[a]=s},T6t=(t,e,r)=>{let n=new t(e);return n.update(zN(r)),n.digest()}});var W6e,P6t=v(()=>{dF();W6e=({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 _6t||e?.has(i)||v6t.test(i)||w6t.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var M6t,I6t=v(()=>{M6t=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var Q_e,R6t=v(()=>{I6t();o5();cF();dF();Q_e=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===Sre)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||M6t(e)){let n=new r;return n.update(zN(e)),bS(await n.digest())}return C6t}});function N6t(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var eve,A6t,iOn,K6e,j6t=v(()=>{o5();cF();eve=class{format(e){let r=[];for(let i of Object.keys(e)){let a=wre(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=wre(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(K6e.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!iOn.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(l6t(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"})(A6t||(A6t={}));iOn=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,K6e=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&&N6t(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&N6t(e),parseInt(bS(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var D6t,$6t=v(()=>{D6t=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var L6t,F6t=v(()=>{_re();L6t=(t,e={})=>{let{headers:r,query:n={}}=lF.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 G6e,k6t=v(()=>{_re();dF();G6e=t=>{t=lF.clone(t);for(let e of Object.keys(t.headers))g6t.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var tve,q6t,U6t=v(()=>{tve=L(dre());dF();q6t=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t)){if(n.toLowerCase()===y6t)continue;let o=(0,tve.escapeUri)(n);e.push(o);let i=t[n];typeof i=="string"?r[o]=`${o}=${(0,tve.escapeUri)(i)}`:Array.isArray(i)&&(r[o]=i.slice(0).reduce((a,s)=>a.concat([`${o}=${(0,tve.escapeUri)(s)}`]),[]).sort().join("&"))}return e.sort().map(n=>r[n]).filter(n=>n).join("&")}});var B6t,aOn,z6t=v(()=>{B6t=t=>aOn(t).toISOString().replace(/\.\d{3}Z$/,"Z"),aOn=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var X6e,V6t,rve,H6t=v(()=>{o5();X6e=L(pS()),V6t=L(dre());cF();U6t();z6t();rve=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,X6e.normalizeProvider)(n),this.credentialProvider=(0,X6e.normalizeProvider)(r)}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
|
||
${this.getCanonicalPath(e)}
|
||
${q6t(e)}
|
||
${o.map(i=>`${i}:${r[i]}`).join(`
|
||
`)}
|
||
|
||
${o.join(";")}
|
||
${n}`}async createStringToSign(e,r,n,o){let i=new this.sha256;i.update(zN(n));let a=await i.digest();return`${o}
|
||
${e}
|
||
${r}
|
||
${bS(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,V6t.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=B6t(e).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}});var Cre,J6t=v(()=>{o5();cF();dF();J6e();P6t();R6t();j6t();$6t();F6t();k6t();H6t();Cre=class extends rve{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 eve)}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>O6t)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let y=Y_e(h,p,d??this.service),g=L6t(G6e(r),{unhoistableHeaders:s,hoistableHeaders:l});f.sessionToken&&(g.query[U6e]=f.sessionToken),g.query[f6t]=X_e,g.query[p6t]=`${f.accessKeyId}/${y}`,g.query[k6e]=m,g.query[h6t]=i.toString(10);let b=W6e(g,a,u);return g.query[m6t]=this.getCanonicalHeaderList(b),g.query[q6e]=await this.getSignature(m,y,this.getSigningKey(f,p,h,d),this.createCanonicalRequest(g,b,await Q_e(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=Y_e(l,u,s??this.service),f=await Q_e({headers:{},body:n},this.sha256),p=new this.sha256;p.update(r);let m=bS(await p.digest()),h=[S6t,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(zN(r)),bS(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=G6e(r),{longDate:d,shortDate:f}=this.formatDate(n),p=Y_e(f,l,s??this.service);c.headers[z6e]=d,u.sessionToken&&(c.headers[b6t]=u.sessionToken);let m=await Q_e(c,this.sha256);!D6t(Sre,c.headers)&&this.applyChecksum&&(c.headers[Sre]=m);let h=W6e(c,i,o),y=await this.getSignature(d,p,this.getSigningKey(u,l,f,s),this.createCanonicalRequest(c,h,m));return c.headers[B6e]=`${X_e} 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,X_e),s=new this.sha256(await o);return s.update(zN(a)),bS(await s.digest())}getSigningKey(r,n,o,i){return E6t(this.sha256,r,o,n,i||this.service)}}});var W6t=v(()=>{});var K6t=v(()=>{J6t();dF();J6e();W6t()});function sOn(t,{credentials:e,credentialDefaultProvider:r}){let n;return e?e?.memoized?n=e:n=l3t(e,u3t,C6e):r?n=FN(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 uOn(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 nve,G6t=v(()=>{J_e();ZO();K6t();nve=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=sOn(t,{credentials:e,credentialDefaultProvider:t.credentialDefaultProvider}),d=uOn(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)?n5(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=FN(t.signer):t.regionInfoProvider?s=()=>FN(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||Cre;return new m(p)}):s=async l=>{l=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await FN(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||Cre;return new p(f)},Object.assign(t,{systemClockOffset:i,signingEscapePath:o,signer:s})}});var X6t=v(()=>{o6t();a6t();s6t();G6t()});var Z6t=v(()=>{X6t();i6t()});var Y6t,ove,Q6t=v(()=>{Y6t=typeof TextEncoder=="function"?new TextEncoder:null,ove=t=>{if(typeof t=="string"){if(Y6t)return Y6t.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 Z6e=v(()=>{Q6t()});var C4,fF,i5,e5t,t5t,r5t=v(()=>{C4=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},fF=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,i5=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>e5t[p.step]-e5t[f.step]||t5t[p.priority||"normal"]-t5t[f.priority||"normal"]),i=d=>{let f=!1,p=m=>{let h=C4(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 C4(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 C4(g.name,g.aliases))m[b]=g;f.push(g)}),e.forEach(y=>{let g={...y,before:[],after:[]};for(let b of C4(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 ${fF(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=C4(p,h);if(g.length>0){if(g.some(b=>n.has(b))){if(!m)throw new Error(`Duplicate middleware name '${fF(p,h)}'`);for(let b of g){let _=t.findIndex(O=>O.name===b||O.aliases?.some(T=>T===b));if(_===-1)continue;let w=t[_];if(w.step!==y.step||y.priority!==w.priority)throw new Error(`"${fF(w.name,w.aliases)}" middleware with ${w.priority} priority in ${w.step} step cannot be overridden by "${fF(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=C4(p,h);if(g.length>0){if(g.some(b=>n.has(b))){if(!m)throw new Error(`Duplicate middleware name '${fF(p,h)}'`);for(let b of g){let _=e.findIndex(O=>O.name===b||O.aliases?.some(T=>T===b));if(_===-1)continue;let w=e[_];if(w.toMiddleware!==y.toMiddleware||w.relation!==y.relation)throw new Error(`"${fF(w.name,w.aliases)}" middleware ${w.relation} "${w.toMiddleware}" middleware cannot be overridden by "${fF(p,h)}" middleware ${y.relation} "${y.toMiddleware}" middleware.`);e.splice(_,1)}}for(let b of g)n.add(b)}e.push(y)},clone:()=>s(i5()),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=C4(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(i5());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 fF(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},e5t={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},t5t={high:3,normal:2,low:1}});var Y6e=v(()=>{r5t()});var x4,n5t=v(()=>{Y6e();x4=class{constructor(e){x(this,"config");x(this,"middlewareStack",i5());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 o5t=v(()=>{sF()});function ive(t,e){if(e==null)return e;let r=Yi.of(t);if(r.getMergedTraits().sensitive)return Q6e;if(r.isListSchema()){if(!!r.getValueSchema().getMergedTraits().sensitive)return Q6e}else if(r.isMapSchema()){if(!!r.getKeySchema().getMergedTraits().sensitive||!!r.getValueSchema().getMergedTraits().sensitive)return Q6e}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 Q6e,i5t=v(()=>{sg();Q6e="***SensitiveInformation***"});var a5t,an,e5e,s5t=v(()=>{Y6e();a5t=L(H6());i5t();an=class{constructor(){x(this,"middlewareStack",i5());x(this,"schema")}static classBuilder(){return new e5e}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,[a5t.SMITHY_CONTEXT_KEY]:{commandInstance:this,...l},...c},{requestHandler:h}=r;return f.resolve(y=>h.handle(y.request,n||{}),m)}},e5e=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 an{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 u5t=v(()=>{});var ave,l5t=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 a5,t5e,c5t=v(()=>{a5=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}},t5e=(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 d5t=v(()=>{});var sve,f5t=v(()=>{sve=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 p5t=v(()=>{});var m5t=v(()=>{});var r5e,h5t,g5t,y5t=v(()=>{r5e=L(H6()),h5t=t=>{let e=[];for(let r in r5e.AlgorithmId){let n=r5e.AlgorithmId[r];t[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>t[n]})}return{addChecksumAlgorithm(r){e.push(r)},checksumAlgorithms(){return e}}},g5t=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var b5t,_5t,v5t=v(()=>{b5t=t=>({setRetryStrategy(e){t.retryStrategy=e},retryStrategy(){return t.retryStrategy}}),_5t=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var uve,lve,w5t=v(()=>{y5t();v5t();uve=t=>Object.assign(h5t(t),b5t(t)),lve=t=>Object.assign(g5t(t),_5t(t))});var S5t=v(()=>{w5t()});var C5t=v(()=>{});var n5e,x5t=v(()=>{n5e=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]=n5e(t[r]));return t}});var O5t=v(()=>{});var pF,T5t=v(()=>{pF=class{trace(){}debug(){}info(){}warn(){}error(){}}});var E5t=v(()=>{});var P5t=v(()=>{});var M5t=v(()=>{});var I5t=v(()=>{});var No=v(()=>{n5t();o5t();s5t();u5t();l5t();d5t();f5t();p5t();c5t();m5t();S5t();C5t();x5t();O5t();T5t();E5t();P5t();M5t();I5t();iF()});var s5,o5e=v(()=>{sg();No();s5=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=Bs.for(s);try{return{errorSchema:a?.(c,u)??c.getSchema(e),errorMetadata:l}}catch{o.message=o.message??o.Message??"UnknownError";let f=Bs.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=t5e(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 t5e(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=>Yi.of(o).getMergedTraits().awsQueryError?.[0]===r)}}}});var R5t=v(()=>{});var A5t=v(()=>{});var _S,u5=v(()=>{_S=class{constructor(){x(this,"serdeContext")}setSerdeContext(e){this.serdeContext=e}}});function*cve(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 Yi([i,0],o);!(o in e)&&!a.isIdempotencyToken()||(yield[o,a])}}function*N5t(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 Yi([s,0],a),l=a;r&&(l=u.getMergedTraits()[r]??a),l in e&&(yield[a,u],o-=1)}}var dve=v(()=>{sg()});var l5,i5e=v(()=>{l5=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 j5t(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 lh(n,"bigDecimal"):BigInt(n)}return e}var D5t=v(()=>{iF()});var $5t,L5t=v(()=>{No();cF();$5t=(t,e)=>kN(t,e).then(r=>(e?.utf8Encoder??G_e)(r))});var F5t,k5t,fve=v(()=>{L5t();F5t=(t,e)=>$5t(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{}}),k5t=(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 pve,a5e=v(()=>{sF();sg();iF();KO();u5();dve();i5e();D5t();fve();pve=class extends _S{constructor(r){super();x(this,"settings");this.settings=r}async read(r,n){return this._read(r,typeof n=="string"?JSON.parse(n,j5t):await F5t(n,this.serdeContext))}readObject(r,n){return this._read(r,n)}_read(r,n){let o=n!==null&&typeof n=="object",i=Yi.of(r);if(o){if(i.isStructSchema()){let s=i.isUnionSchema(),u={},l;s&&(l=new l5(n,u));for(let[c,d]of N5t(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 Dv(n);let a=i.getMergedTraits().mediaType;if(i.isStringSchema()&&typeof n=="string"&&a)return a==="application/json"||a.endsWith("+json")?hS.from(n):n;if(i.isTimestampSchema()&&n!=null)switch(aF(i,this.settings)){case 5:return _Jt(n);case 6:return vJt(n);case 7:return wJt(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 lh)return n;let s=n;return s.type==="bigDecimal"&&"string"in s?new lh(s.string,s.type):new lh(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 lh?s[u]=l:s[u]=this._read(i,l);return s}else return structuredClone(n);return n}}});var q5t,mve,U5t=v(()=>{iF();q5t="\u039D",mve=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 lh){let n=`${q5t+"nv"+this.counter++}_`+r.string;return this.values.set(`"${n}"`,r.string),n}if(typeof r=="bigint"){let n=r.toString(),o=`${q5t+"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 hve,s5e=v(()=>{sF();sg();iF();KO();u5();dve();U5t();hve=class extends _S{constructor(r){super();x(this,"settings");x(this,"buffer");x(this,"useReplacer",!1);x(this,"rootSchema");this.settings=r}write(r,n){this.rootSchema=Yi.of(r),this.buffer=this._write(this.rootSchema,n)}writeDiscriminatedDocument(r,n){this.write(r,n),typeof this.buffer=="object"&&(this.buffer.__type=Yi.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 mve;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=Yi.of(r);if(i){if(a.isStructSchema()){let s={};for(let[u,l]of cve(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??$v)(n);if(n instanceof Date&&(a.isTimestampSchema()||a.isDocumentSchema()))switch(aF(a,this.settings)){case 5:return n.toISOString().replace(".000Z","Z");case 6:return I_e(n);case 7:return n.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",n),n.getTime()/1e3}n instanceof lh&&(this.useReplacer=!0)}if(!(n===null&&o?.isStructSchema())){if(a.isStringSchema()){if(typeof n>"u"&&a.isIdempotencyToken())return b4();let s=a.getMergedTraits().mediaType;return n!=null&&s&&(s==="application/json"||s.endsWith("+json"))?hS.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??$v)(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 lh?(this.useReplacer=!0,s[u]=l):s[u]=this._write(a,l);return s}else return structuredClone(n);return n}}}});var gve,u5e=v(()=>{u5();a5e();s5e();gve=class extends _S{constructor(r){super();x(this,"settings");this.settings=r}createSerializer(){let r=new hve(this.settings);return r.setSerdeContext(this.serdeContext),r}createDeserializer(){let r=new pve(this.settings);return r.setSerdeContext(this.serdeContext),r}}});var yve,l5e=v(()=>{sF();sg();o5e();u5e();fve();yve=class extends Y6{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 gve({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!o,this.mixin=new s5(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"),(nF(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=k5t(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=Yi.of(u),d=i.message??i.Message??"Unknown",f=Bs.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 B5t=v(()=>{});var bve,z5t=v(()=>{l5e();bve=class extends yve{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 V5t=v(()=>{});var H5t=v(()=>{});var J5t=v(()=>{});var W5t=v(()=>{});function d5e(t){c5e||(c5e=new DOMParser);let e=c5e.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 c5e,K5t=v(()=>{});var G5t=v(()=>{W5t();J5t();K5t()});var _ve,f5e=v(()=>{G5t();sF();sg();No();cF();u5();i5e();_ve=class extends _S{constructor(r){super();x(this,"settings");x(this,"stringDeserializer");this.settings=r,this.stringDeserializer=new j_e(r)}setSerdeContext(r){this.serdeContext=r,this.stringDeserializer.setSerdeContext(r)}read(r,n,o){let i=Yi.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??G_e)(n),l=this.parseXml(u);return this.readSchema(r,o?l[o]:l)}readSchema(r,n){let o=Yi.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 l5(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=d5e(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]),n5e(a)}return{}}}});var vve,X5t=v(()=>{sF();sg();iF();No();KO();u5();dve();vve=class extends _S{constructor(r){super();x(this,"settings");x(this,"buffer");this.settings=r}write(r,n,o=""){this.buffer===void 0&&(this.buffer="");let i=Yi.of(r);if(o&&!o.endsWith(".")&&(o+="."),i.isBlobSchema())(typeof n=="string"||n instanceof Uint8Array)&&(this.writeKey(o),this.writeValue((this.serdeContext?.base64Encoder??$v)(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(b4()));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 lh?n.string:String(n)));else if(i.isTimestampSchema()){if(n instanceof Date)switch(this.writeKey(o),aF(i,this.settings)){case 5:this.writeValue(n.toISOString().replace(".000Z","Z"));break;case 6:this.writeValue(I_e(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 cve(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+=`&${o6e(r)}=`}writeValue(r){this.buffer+=o6e(r)}}});var wve,Z5t=v(()=>{sF();sg();o5e();f5e();X5t();wve=class extends Y6{constructor(r){super({defaultNamespace:r.defaultNamespace});x(this,"options");x(this,"serializer");x(this,"deserializer");x(this,"mixin",new s5);this.options=r;let n={timestampFormat:{useTrait:!0,default:5},httpBindings:!1,xmlNamespace:r.xmlNamespace,serviceNamespace:r.defaultNamespace,serializeEmptyLists:!0};this.serializer=new vve(n),this.deserializer=new _ve(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"}),(nF(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=Yi.of(r.output),s={};if(o.statusCode>=300){let f=await kN(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 kN(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=Yi.of(c),p=Bs.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 Y5t=v(()=>{});var Q5t=v(()=>{});var eKt=v(()=>{});var tKt=v(()=>{});var rKt=v(()=>{});var Sve=v(()=>{R5t();A5t();B5t();z5t();l5e();V5t();u5e();a5e();s5e();H5t();fve();Y5t();Z5t();rKt();tKt();f5e();eKt();Q5t()});var c5=v(()=>{J_e();Z6t();Sve()});async function nKt(t,e,r){if(r.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&gC(t,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){let i=await e.retryStrategy();typeof i.acquireInitialRetryToken=="function"?i.constructor?.name?.includes("Adaptive")?gC(t,"RETRY_MODE_ADAPTIVE","F"):gC(t,"RETRY_MODE_STANDARD","E"):gC(t,"RETRY_MODE_LEGACY","D")}if(typeof e.accountIdEndpointMode=="function"){let i=t.endpointV2;switch(String(i?.url?.hostname).match(lOn)&&gC(t,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":gC(t,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":gC(t,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":gC(t,"ACCOUNT_ID_MODE_REQUIRED","R");break}}let o=t.__smithy_context?.selectedHttpAuthScheme?.identity;if(o?.$source){let i=o;i.accountId&&gC(t,"RESOLVED_ACCOUNT_ID","T");for(let[a,s]of Object.entries(i.$source??{}))gC(t,a,s)}}var lOn,oKt=v(()=>{c5();lOn=/\d{12}\.ddb/});var p5e,Cve,m5e,xve,iKt,aKt,h5e,sKt=v(()=>{p5e="user-agent",Cve="x-amz-user-agent",m5e=" ",xve="/",iKt=/[^!$%&'*+\-.^_`|~\w]/g,aKt=/[^!$%&'*+\-.^_`|~\w#]/g,h5e="-"});function uKt(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 lKt=v(()=>{});var cOn,Ove,dOn,Tve,cKt=v(()=>{V_e();FWt();oKt();sKt();lKt();cOn=t=>(e,r)=>async n=>{let{request:o}=n;if(!H_e.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(Ove)||[],s=(await t.defaultUserAgentProvider()).map(Ove);await nKt(r,t,n);let u=r;s.push(`m/${uKt(Object.assign({},r.__smithy_context?.features,u.__aws_sdk_context?.features))}`);let l=t?.customUserAgent?.map(Ove)||[],c=await t.userAgentAppId();c&&s.push(Ove(["app",`${c}`]));let d=gWt(),f=(d?[d]:[]).concat([...s,...a,...l]).join(m5e),p=[...s.filter(m=>m.startsWith("aws-sdk-")),...l].join(m5e);return t.runtime!=="browser"?(p&&(i[Cve]=i[Cve]?`${i[p5e]} ${p}`:p),i[p5e]=f):i[Cve]=f,e({...n,request:o})},Ove=t=>{let e=t[0].split(xve).map(a=>a.replace(iKt,h5e)).join(xve),r=t[1]?.replace(aKt,h5e),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}`}},"")},dOn={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Tve=t=>({applyToStack:e=>{e.add(cOn(t),dOn)}})});var g5e=v(()=>{f3t();cKt()});var Eve,dKt=v(()=>{Eve=!1});var Pve,fKt=v(()=>{Pve=!1});var pKt=v(()=>{});var mKt=v(()=>{});var hKt=v(()=>{dKt();fKt();pKt();mKt()});var gKt=v(()=>{});var yKt,bKt,_Kt=v(()=>{w4();yKt=new Set,bKt=(t,e=_4)=>{if(!yKt.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 yKt.add(t)}});var Mve,y5e=v(()=>{Mve=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var vKt,wKt=v(()=>{y5e();vKt=t=>Mve(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var Ive,SKt=v(()=>{_Kt();wKt();y5e();Ive=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=vKt(n);return bKt(o),o},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return Mve(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}})}});var CKt=v(()=>{gKt();SKt()});var xKt=v(()=>{});var OKt=v(()=>{});var TKt=v(()=>{});var EKt=v(()=>{xKt();OKt();TKt()});var xre=v(()=>{hKt();CKt();EKt()});var PKt=v(()=>{});var MKt=v(()=>{PKt()});var IKt=v(()=>{});var RKt=v(()=>{});var AKt=v(()=>{});function fOn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Rve,NKt=v(()=>{Rve=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=fOn(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 jKt=v(()=>{});var DKt=v(()=>{});var $Kt=v(()=>{});var LKt=v(()=>{MKt();IKt();RKt();AKt();NKt();jKt();DKt();$Kt()});function pOn(t){return e=>async r=>{let n=r.request;if(Rve.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(FKt)===-1)try{let a=t(o);n.headers={...n.headers,[FKt]:String(a)}}catch{}}return e({...r,request:n})}}var FKt,mOn,Ave,b5e=v(()=>{LKt();FKt="content-length";mOn={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Ave=t=>({applyToStack:e=>{e.add(pOn(t.bodyLengthChecker),mOn)}})});var kKt,hOn,gOn,yOn,bOn,_On,qKt=v(()=>{kKt=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),_On(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!bOn(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},hOn=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,gOn=/(\d+\.){3}\d+/,yOn=/\.\./,bOn=t=>hOn.test(t)&&!gOn.test(t)&&!yOn.test(t),_On=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 UKt=v(()=>{qKt()});var BKt,zKt=v(()=>{BKt=(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 Nve,_5e=v(()=>{Nve=async t=>{}});var jve,Dve=v(()=>{z_e();jve=t=>typeof t=="object"?"url"in t?uF(t.url):t:uF(t)});var VKt,vOn,v5e=v(()=>{UKt();zKt();_5e();Dve();VKt=async(t,e,r,n)=>{if(!r.isCustomEndpoint){let a;r.serviceConfiguredEndpoint?a=await r.serviceConfiguredEndpoint():a=await Nve(r.serviceId),a&&(r.endpoint=()=>Promise.resolve(jve(a)),r.isCustomEndpoint=!0)}let o=await vOn(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},vOn=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 BKt(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 kKt(n),n}});var HKt=v(()=>{v5e();Dve()});var JKt,WKt,w5e=v(()=>{ZO();JKt=L(pS());v5e();WKt=({config:t,instructions:e})=>(r,n)=>async o=>{t.isCustomEndpoint&&t3t(n,"ENDPOINT_OVERRIDE","N");let i=await VKt(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,JKt.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 wOn,On,KKt=v(()=>{JWe();w5e();wOn={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:h_e.name},On=(t,e)=>({applyToStack:r=>{r.addRelativeTo(WKt({config:t,instructions:e}),wOn)}})});var $ve,Lve,GKt=v(()=>{$ve=L(pS());_5e();Dve();Lve=t=>{let e=t.tls??!0,{endpoint:r,useDualstackEndpoint:n,useFipsEndpoint:o}=t,i=r!=null?async()=>jve(await(0,$ve.normalizeProvider)(r)()):void 0,s=Object.assign(t,{endpoint:i,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:(0,$ve.normalizeProvider)(n??!1),useFipsEndpoint:(0,$ve.normalizeProvider)(o??!1)}),u;return s.serviceConfiguredEndpoint=async()=>(t.serviceId&&!u&&(u=Nve(t.serviceId)),u),s}});var XKt=v(()=>{});var ZKt=v(()=>{});var fu=v(()=>{HKt();w5e();KKt();GKt();XKt();ZKt()});var VN,HN,Ore,Fve=v(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(VN||(VN={}));HN=3,Ore=VN.STANDARD});var YKt,QKt,e8t,t8t,r8t,n8t=v(()=>{YKt=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],QKt=["TimeoutError","RequestTimeout","RequestTimeoutException"],e8t=[500,502,503,504],t8t=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],r8t=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"]});var SOn,COn,xOn,kve,qve,o8t,S5e=v(()=>{n8t();SOn=t=>t?.$retryable!==void 0,COn=t=>t.$metadata?.clockSkewCorrected,xOn=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},kve=t=>t.$metadata?.httpStatusCode===429||YKt.includes(t.name)||t.$retryable?.throttling==!0,qve=(t,e=0)=>SOn(t)||COn(t)||QKt.includes(t.name)||t8t.includes(t?.code||"")||r8t.includes(t?.code||"")||e8t.includes(t.$metadata?.httpStatusCode||0)||xOn(t)||t.cause!==void 0&&e<=10&&qve(t.cause,e+1),o8t=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!qve(t)}return!1}});var Bve,Uve,C5e=v(()=>{S5e();Bve=class Bve{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=>Bve.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(),kve(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(Bve,"setTimeoutFn",setTimeout);Uve=Bve});var i8t,a8t,s8t=v(()=>{i8t="amz-sdk-invocation-id",a8t="amz-sdk-request"});var l8t,c8t=v(()=>{l8t=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var x5e,d8t=v(()=>{x5e=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var d5,O5e=v(()=>{Fve();c8t();d8t();d5=class{constructor(e){x(this,"maxAttempts");x(this,"mode",VN.STANDARD);x(this,"capacity",500);x(this,"retryBackoffStrategy",l8t());x(this,"maxAttemptsProvider");this.maxAttempts=e,this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return x5e({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,x5e({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 ${HN}`),HN}}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 zve,f8t=v(()=>{Fve();C5e();O5e();zve=class{constructor(e,r){x(this,"maxAttemptsProvider");x(this,"rateLimiter");x(this,"standardRetryStrategy");x(this,"mode",VN.ADAPTIVE);this.maxAttemptsProvider=e;let{rateLimiter:n}=r??{};this.rateLimiter=n??new Uve,this.standardRetryStrategy=new d5(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 p8t=v(()=>{});var m8t=v(()=>{});var Tre=v(()=>{f8t();p8t();C5e();O5e();Fve();s8t();m8t()});var h8t=v(()=>{});var g8t=v(()=>{h8t()});var y8t=v(()=>{});var b8t=v(()=>{});var _8t=v(()=>{});function EOn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Vve,v8t=v(()=>{Vve=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=EOn(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 Hve,w8t=v(()=>{Hve=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 S8t=v(()=>{});var C8t=v(()=>{});var x8t=v(()=>{g8t();y8t();b8t();_8t();v8t();w8t();S8t();C8t()});var O8t=v(()=>{});var T8t=v(()=>{});var E8t,P8t=v(()=>{E8t=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 M8t=v(()=>{});var I8t=v(()=>{});var T5e,Jve,R8t=v(()=>{T5e=L(pS());Tre();Jve=t=>{let{retryStrategy:e,retryMode:r,maxAttempts:n}=t,o=(0,T5e.normalizeProvider)(n??HN);return Object.assign(t,{maxAttempts:o,retryStrategy:async()=>e||(await(0,T5e.normalizeProvider)(r)()===VN.ADAPTIVE?new zve(o):new d5(o))})}});var A8t=v(()=>{});var N8t,j8t=v(()=>{N8t=t=>t?.body instanceof ReadableStream});var POn,MOn,IOn,ROn,AOn,Wve,NOn,D8t=v(()=>{x8t();S5e();No();Tre();h6e();j8t();P8t();POn=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(MOn(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=Vve.isInstance(c);for(d&&(c.headers[i8t]=b4());;)try{d&&(c.headers[a8t]=`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=IOn(f);if(s=E8t(f),d&&N8t(c))throw(r.logger instanceof pF?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)},MOn=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",IOn=t=>{let e={error:t,errorType:ROn(t)},r=NOn(t.$response);return r&&(e.retryAfterHint=r),e},ROn=t=>kve(t)?"THROTTLING":qve(t)?"TRANSIENT":o8t(t)?"SERVER_ERROR":"CLIENT_ERROR",AOn={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Wve=t=>({applyToStack:e=>{e.add(POn(t),AOn)}}),NOn=t=>{if(!Hve.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 E5e=v(()=>{I8t();M8t();R8t();O8t();A8t();T8t();D8t()});function jOn(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function Kve(t){return{schemeId:"smithy.api#noAuth"}}var Ere,$8t,L8t,F8t,P5e=v(()=>{c5();Ere=L(pS()),$8t=async(t,e,r)=>({operation:(0,Ere.getSmithyContext)(e).operation,region:await(0,Ere.normalizeProvider)(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});L8t=t=>{let e=[];switch(t.operation){case"GetCredentialsForIdentity":{e.push(Kve(t));break}case"GetId":{e.push(Kve(t));break}case"GetOpenIdToken":{e.push(Kve(t));break}case"UnlinkIdentity":{e.push(Kve(t));break}default:e.push(jOn(t))}return e},F8t=t=>{let e=nve(t);return Object.assign(e,{authSchemePreference:(0,Ere.normalizeProvider)(t.authSchemePreference??[])})}});var k8t,io,fl=v(()=>{k8t=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),io={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var U8t,q8t=v(()=>{U8t={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 M5e,I5e,B8t,z8t=v(()=>{M5e={name:"SHA-256"},I5e={name:"HMAC",hash:M5e},B8t=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 f5(){return typeof window<"u"?window:typeof self<"u"?self:$On}var $On,R5e=v(()=>{$On={}});var p5,A5e,N5e=v(()=>{p5=L(o_e());z8t();R5e();A5e=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,p5.isEmptyData)(e)){var r=(0,p5.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 f5().crypto.subtle.sign(I5e,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,p5.isEmptyData)(this.toHash)?Promise.resolve(B8t):Promise.resolve().then(function(){return f5().crypto.subtle.digest(M5e,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){f5().crypto.subtle.importKey("raw",(0,p5.convertToBuffer)(e.secret),I5e,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function V8t(t){if(FOn(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return kOn(e)}return!1}function FOn(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function kOn(t){return t&&LOn.every(function(e){return typeof t[e]=="function"})}var LOn,H8t=v(()=>{LOn=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var J8t=v(()=>{H8t()});var W8t,K8t,Gve,G8t=v(()=>{N5e();W8t=L(LWe());J8t();R5e();K8t=L(o_e()),Gve=function(){function t(e){V8t(f5())?this.hash=new A5e(e):this.hash=new W8t.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,K8t.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var j5e=v(()=>{G8t();N5e()});var Xve,X8t,D5e=v(()=>{Xve=({serviceId:t,clientVersion:e})=>async r=>{let n=typeof window<"u"?window.navigator:void 0,o=n?.userAgent??"",i=n?.userAgentData?.platform??X8t.os(o)??"other",a=void 0,s=n?.userAgentData?.brands??[],u=s[s.length-1],l=u?.brand??X8t.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},X8t={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 Z8t=v(()=>{});var Zve,Y8t=v(()=>{Zve=t=>()=>Promise.reject(t)});var $5e=v(()=>{Z8t();Y8t()});var Q8t,eGt=v(()=>{Q8t=["in-region","cross-region","mobile","standard","legacy"]});var Yve,qOn,tGt=v(()=>{QL();eGt();Yve=({defaultsMode:t}={})=>aVt(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(qOn()?"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 ${Q8t.join(", ")}, got ${e}`)}}),qOn=()=>{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 L5e=v(()=>{tGt()});var rGt,nGt=v(()=>{rGt=t=>new TextEncoder().encode(t)});var oGt=v(()=>{});var iGt,aGt=v(()=>{iGt=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 sGt=v(()=>{nGt();oGt();aGt()});var yGt,dy,fy,h5,uGt,Ire,m5,YO,JN,F5e,k5e,Pre,lGt,cGt,dGt,bGt,_Gt,fd,Mre,fGt,vGt,pGt,mGt,hGt,gGt,UOn,wGt,SGt=v(()=>{yGt="required",dy="fn",fy="argv",h5="ref",uGt="isSet",Ire="booleanEquals",m5="error",YO="endpoint",JN="tree",F5e="PartitionResult",k5e="getAttr",Pre="stringEquals",lGt={[yGt]:!1,type:"string"},cGt={[yGt]:!0,default:!1,type:"boolean"},dGt={[h5]:"Endpoint"},bGt={[dy]:Ire,[fy]:[{[h5]:"UseFIPS"},!0]},_Gt={[dy]:Ire,[fy]:[{[h5]:"UseDualStack"},!0]},fd={},Mre={[h5]:"Region"},fGt={[dy]:k5e,[fy]:[{[h5]:F5e},"supportsFIPS"]},vGt={[h5]:F5e},pGt={[dy]:Ire,[fy]:[!0,{[dy]:k5e,[fy]:[vGt,"supportsDualStack"]}]},mGt=[bGt],hGt=[_Gt],gGt=[Mre],UOn={version:"1.0",parameters:{Region:lGt,UseDualStack:cGt,UseFIPS:cGt,Endpoint:lGt},rules:[{conditions:[{[dy]:uGt,[fy]:[dGt]}],rules:[{conditions:mGt,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:m5},{conditions:hGt,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:m5},{endpoint:{url:dGt,properties:fd,headers:fd},type:YO}],type:JN},{conditions:[{[dy]:uGt,[fy]:gGt}],rules:[{conditions:[{[dy]:"aws.partition",[fy]:gGt,assign:F5e}],rules:[{conditions:[bGt,_Gt],rules:[{conditions:[{[dy]:Ire,[fy]:[!0,fGt]},pGt],rules:[{conditions:[{[dy]:Pre,[fy]:[Mre,"us-east-1"]}],endpoint:{url:"https://cognito-identity-fips.us-east-1.amazonaws.com",properties:fd,headers:fd},type:YO},{conditions:[{[dy]:Pre,[fy]:[Mre,"us-east-2"]}],endpoint:{url:"https://cognito-identity-fips.us-east-2.amazonaws.com",properties:fd,headers:fd},type:YO},{conditions:[{[dy]:Pre,[fy]:[Mre,"us-west-1"]}],endpoint:{url:"https://cognito-identity-fips.us-west-1.amazonaws.com",properties:fd,headers:fd},type:YO},{conditions:[{[dy]:Pre,[fy]:[Mre,"us-west-2"]}],endpoint:{url:"https://cognito-identity-fips.us-west-2.amazonaws.com",properties:fd,headers:fd},type:YO},{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:fd,headers:fd},type:YO}],type:JN},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:m5}],type:JN},{conditions:mGt,rules:[{conditions:[{[dy]:Ire,[fy]:[fGt,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:fd,headers:fd},type:YO}],type:JN},{error:"FIPS is enabled but this partition does not support FIPS",type:m5}],type:JN},{conditions:hGt,rules:[{conditions:[pGt],rules:[{conditions:[{[dy]:Pre,[fy]:["aws",{[dy]:k5e,[fy]:[vGt,"name"]}]}],endpoint:{url:"https://cognito-identity.{Region}.amazonaws.com",properties:fd,headers:fd},type:YO},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:fd,headers:fd},type:YO}],type:JN},{error:"DualStack is enabled but this partition does not support DualStack",type:m5}],type:JN},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:fd,headers:fd},type:YO}],type:JN}],type:JN},{error:"Invalid Configuration: Missing Region",type:m5}]},wGt=UOn});var BOn,CGt,xGt=v(()=>{V_e();w4();SGt();BOn=new t5({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),CGt=(t,e={})=>BOn.get(t,()=>B_e(wGt,{endpointParams:t,logger:e.logger}));UN.aws=bre});var OGt,TGt=v(()=>{c5();Sve();ZO();No();z_e();KO();sGt();P5e();xGt();OGt=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??Dv,base64Encoder:t?.base64Encoder??$v,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??CGt,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??L8t,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new S4},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new e5}],logger:t?.logger??new pF,protocol:t?.protocol??bve,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??uF,utf8Decoder:t?.utf8Decoder??rGt,utf8Encoder:t?.utf8Encoder??iGt})});var EGt,PGt=v(()=>{q8t();j5e();D5e();xre();fre();$5e();No();Z6e();L5e();Tre();TGt();EGt=t=>{let e=Yve(t),r=()=>e().then(sve),n=OGt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??ove,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??Xve({serviceId:n.serviceId,clientVersion:U8t.version}),maxAttempts:t?.maxAttempts??HN,region:t?.region??Zve("Region is missing"),requestHandler:rF.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||Ore),sha256:t?.sha256??Gve,streamCollector:t?.streamCollector??K6,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Eve)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(Pve))}}});var Qve,ewe,MGt=v(()=>{Qve=t=>({setRegion(e){t.region=e},region(){return t.region}}),ewe=t=>({region:t.region()})});var IGt=v(()=>{});function RGt(){return async()=>"us-east-1"}var AGt=v(()=>{});var twe=v(()=>{MGt();IGt();AGt()});var NGt,jGt,DGt=v(()=>{NGt=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),jGt=t=>({httpHandler:t.httpHandler()})});var $Gt=v(()=>{DGt()});var LGt=v(()=>{});var FGt=v(()=>{});var kGt=v(()=>{});var qGt=v(()=>{});var UGt=v(()=>{});var BGt=v(()=>{});var zGt=v(()=>{});var VGt=v(()=>{$Gt();LGt();FGt();kGt();qGt();UGt();BGt();zGt()});var HGt,JGt,WGt=v(()=>{HGt=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}}},JGt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var KGt,GGt=v(()=>{twe();VGt();No();WGt();KGt=(t,e)=>{let r=Object.assign(Qve(t),uve(t),NGt(t),HGt(t));return e.forEach(n=>n.configure(r)),Object.assign(t,ewe(r),lve(r),jGt(r),JGt(r))}});var mF,rwe=v(()=>{qWe();UWe();zWe();g5e();xre();ZO();sg();b5e();fu();E5e();No();P5e();fl();PGt();GGt();mF=class extends x4{constructor(...[r]){let n=EGt(r||{});super(n);x(this,"config");this.initConfig=n;let o=k8t(n),i=D_e(o),a=Jve(i),s=Ive(a),u=s,l=Lve(u),c=F8t(l),d=KGt(c,r?.extensions||[]);this.config=d,this.middlewareStack.use(w_e(this.config)),this.middlewareStack.use(Tve(this.config)),this.middlewareStack.use(Wve(this.config)),this.middlewareStack.use(Ave(this.config)),this.middlewareStack.use(d_e(this.config)),this.middlewareStack.use(f_e(this.config)),this.middlewareStack.use(p_e(this.config)),this.middlewareStack.use(m_e(this.config,{httpAuthSchemeParametersProvider:$8t,identityProviderConfigProvider:async f=>new Q6({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(g_e(this.config))}destroy(){super.destroy()}}});var py,q5e=v(()=>{No();py=class t extends a5{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var nwe,owe,iwe,awe,swe,uwe,lwe,cwe,dwe,fwe,pwe,U5e=v(()=>{q5e();nwe=class t extends py{constructor(r){super({name:"InternalErrorException",$fault:"server",...r});x(this,"name","InternalErrorException");x(this,"$fault","server");Object.setPrototypeOf(this,t.prototype)}},owe=class t extends py{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 py{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 py{constructor(r){super({name:"NotAuthorizedException",$fault:"client",...r});x(this,"name","NotAuthorizedException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},swe=class t extends py{constructor(r){super({name:"ResourceConflictException",$fault:"client",...r});x(this,"name","ResourceConflictException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},uwe=class t extends py{constructor(r){super({name:"TooManyRequestsException",$fault:"client",...r});x(this,"name","TooManyRequestsException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},lwe=class t extends py{constructor(r){super({name:"ResourceNotFoundException",$fault:"client",...r});x(this,"name","ResourceNotFoundException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},cwe=class t extends py{constructor(r){super({name:"ExternalServiceException",$fault:"client",...r});x(this,"name","ExternalServiceException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},dwe=class t extends py{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 py{constructor(r){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...r});x(this,"name","DeveloperUserAlreadyRegisteredException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},pwe=class t extends py{constructor(r){super({name:"ConcurrentModificationException",$fault:"client",...r});x(this,"name","ConcurrentModificationException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}}});var XGt,VOn,HOn,JOn,ZGt,YGt,WOn,KOn,GOn,XOn,ZOn,QGt,YOn,QOn,eTn,tTn,rTn,nTn,oTn,iTn,aTn,sTn,uTn,lTn,cTn,hwe,dTn,e9t,fTn,pTn,mTn,hTn,gTn,yTn,bTn,_Tn,vTn,wTn,STn,CTn,xTn,OTn,TTn,ETn,PTn,MTn,ITn,RTn,ATn,NTn,jTn,DTn,$Tn,LTn,FTn,mb,kTn,qTn,UTn,BTn,zTn,ch,VTn,B5e,gwe,HTn,JTn,t9t,WTn,g5,KTn,GTn,XTn,ZTn,YTn,QTn,eEn,tEn,rEn,nEn,oEn,iEn,aEn,sEn,uEn,lEn,cEn,dEn,fEn,z5e,pEn,mEn,hEn,gEn,y5,r9t,yEn,bEn,ywe,n9t,V5e,_En,vEn,wEn,SEn,o9t,CEn,xEn,OEn,TEn,EEn,PEn,MEn,IEn,i9t,a9t,REn,AEn,NEn,jEn,DEn,$En,s9t,LEn,FEn,kEn,qEn,UEn,BEn,u9t,zEn,H5e,VEn,HEn,JEn,WEn,KEn,GEn,XEn,ZEn,YEn,QEn,ePn,tPn,QO,yC,eT,bC,rPn,l9t,Ye,nPn,c9t,oPn,iPn,aPn,sPn,uPn,lPn,cPn,dPn,fPn,pPn,mPn,hPn,gPn,yPn,bPn,_Pn,vPn,wPn,SPn,CPn,xPn,OPn,TPn,EPn,d9t,mwe,PPn,MPn,IPn,RPn,APn,NPn,jPn,DPn,$Pn,LPn,FPn,kPn,qPn,UPn,BPn,zPn,VPn,HPn,JPn,WPn,KPn,GPn,XPn,ZPn,YPn,QPn,eMn,tMn,rMn,nMn,oMn,iMn,bwe,aMn,f9t,sMn,uMn,lMn,cMn,Rre,p9t,m9t,h9t,g9t,y9t,b9t,_9t,v9t,w9t,S9t,C9t,x9t,O9t,T9t,E9t,P9t,M9t,I9t,R9t,A9t,N9t,j9t,D9t,$9t,pl=v(()=>{sg();q5e();U5e();XGt="AllowClassicFlow",VOn="AccountId",HOn="AccessKeyId",JOn="AmbiguousRoleResolution",ZGt="AllowUnauthenticatedIdentities",YGt="Credentials",WOn="CreationDate",KOn="ClientId",GOn="CognitoIdentityProvider",XOn="CreateIdentityPoolInput",ZOn="CognitoIdentityProviderList",QGt="CognitoIdentityProviders",YOn="CreateIdentityPool",QOn="ConcurrentModificationException",eTn="CustomRoleArn",tTn="Claim",rTn="DeleteIdentities",nTn="DeleteIdentitiesInput",oTn="DescribeIdentityInput",iTn="DeleteIdentityPool",aTn="DeleteIdentityPoolInput",sTn="DescribeIdentityPoolInput",uTn="DescribeIdentityPool",lTn="DeleteIdentitiesResponse",cTn="DescribeIdentity",hwe="DeveloperProviderName",dTn="DeveloperUserAlreadyRegisteredException",e9t="DeveloperUserIdentifier",fTn="DeveloperUserIdentifierList",pTn="DestinationUserIdentifier",mTn="Expiration",hTn="ErrorCode",gTn="ExternalServiceException",yTn="GetCredentialsForIdentity",bTn="GetCredentialsForIdentityInput",_Tn="GetCredentialsForIdentityResponse",vTn="GetId",wTn="GetIdInput",STn="GetIdentityPoolRoles",CTn="GetIdentityPoolRolesInput",xTn="GetIdentityPoolRolesResponse",OTn="GetIdResponse",TTn="GetOpenIdToken",ETn="GetOpenIdTokenForDeveloperIdentity",PTn="GetOpenIdTokenForDeveloperIdentityInput",MTn="GetOpenIdTokenForDeveloperIdentityResponse",ITn="GetOpenIdTokenInput",RTn="GetOpenIdTokenResponse",ATn="GetPrincipalTagAttributeMap",NTn="GetPrincipalTagAttributeMapInput",jTn="GetPrincipalTagAttributeMapResponse",DTn="HideDisabled",$Tn="Identities",LTn="IdentityDescription",FTn="InternalErrorException",mb="IdentityId",kTn="InvalidIdentityPoolConfigurationException",qTn="IdentityIdsToDelete",UTn="IdentitiesList",BTn="IdentityPool",zTn="InvalidParameterException",ch="IdentityPoolId",VTn="IdentityPoolsList",B5e="IdentityPoolName",gwe="IdentityProviderName",HTn="IdentityPoolShortDescription",JTn="IdentityProviderToken",t9t="IdentityPoolTags",WTn="IdentityPools",g5="Logins",KTn="LookupDeveloperIdentity",GTn="LookupDeveloperIdentityInput",XTn="LookupDeveloperIdentityResponse",ZTn="LimitExceededException",YTn="ListIdentities",QTn="ListIdentitiesInput",eEn="ListIdentityPools",tEn="ListIdentityPoolsInput",rEn="ListIdentityPoolsResponse",nEn="ListIdentitiesResponse",oEn="LoginsMap",iEn="LastModifiedDate",aEn="ListTagsForResource",sEn="ListTagsForResourceInput",uEn="ListTagsForResourceResponse",lEn="LoginsToRemove",cEn="MergeDeveloperIdentities",dEn="MergeDeveloperIdentitiesInput",fEn="MergeDeveloperIdentitiesResponse",z5e="MaxResults",pEn="MappingRulesList",mEn="MappingRule",hEn="MatchType",gEn="NotAuthorizedException",y5="NextToken",r9t="OpenIdConnectProviderARNs",yEn="OIDCToken",bEn="ProviderName",ywe="PrincipalTags",n9t="Roles",V5e="ResourceArn",_En="RoleARN",vEn="RulesConfiguration",wEn="ResourceConflictException",SEn="RulesConfigurationType",o9t="RoleMappings",CEn="RoleMappingMap",xEn="RoleMapping",OEn="ResourceNotFoundException",TEn="Rules",EEn="SetIdentityPoolRoles",PEn="SetIdentityPoolRolesInput",MEn="SecretKey",IEn="SecretKeyString",i9t="SupportedLoginProviders",a9t="SamlProviderARNs",REn="SetPrincipalTagAttributeMap",AEn="SetPrincipalTagAttributeMapInput",NEn="SetPrincipalTagAttributeMapResponse",jEn="ServerSideTokenCheck",DEn="SessionToken",$En="SourceUserIdentifier",s9t="Token",LEn="TokenDuration",FEn="TagKeys",kEn="TooManyRequestsException",qEn="TagResource",UEn="TagResourceInput",BEn="TagResourceResponse",u9t="Tags",zEn="Type",H5e="UseDefaults",VEn="UnlinkDeveloperIdentity",HEn="UnlinkDeveloperIdentityInput",JEn="UnlinkIdentity",WEn="UnprocessedIdentityIds",KEn="UnprocessedIdentityIdList",GEn="UnlinkIdentityInput",XEn="UnprocessedIdentityId",ZEn="UpdateIdentityPool",YEn="UntagResource",QEn="UntagResourceInput",ePn="UntagResourceResponse",tPn="Value",QO="client",yC="error",eT="httpError",bC="message",rPn="server",l9t="smithy.ts.sdk.synthetic.com.amazonaws.cognitoidentity",Ye="com.amazonaws.cognitoidentity",nPn=[0,Ye,JTn,8,0],c9t=[0,Ye,yEn,8,0],oPn=[0,Ye,IEn,8,0],iPn=[3,Ye,GOn,0,[bEn,KOn,jEn],[0,0,2]],aPn=[-3,Ye,QOn,{[yC]:QO,[eT]:400},[bC],[0]];Bs.for(Ye).registerError(aPn,pwe);sPn=[3,Ye,XOn,0,[B5e,ZGt,XGt,i9t,hwe,r9t,QGt,a9t,t9t],[0,2,2,128,0,64,()=>f9t,64,128]],uPn=[3,Ye,YGt,0,[HOn,MEn,DEn,mTn],[0,[()=>oPn,0],0,4]],lPn=[3,Ye,nTn,0,[qTn],[64]],cPn=[3,Ye,lTn,0,[WEn],[()=>cMn]],dPn=[3,Ye,aTn,0,[ch],[0]],fPn=[3,Ye,oTn,0,[mb],[0]],pPn=[3,Ye,sTn,0,[ch],[0]],mPn=[-3,Ye,dTn,{[yC]:QO,[eT]:400},[bC],[0]];Bs.for(Ye).registerError(mPn,fwe);hPn=[-3,Ye,gTn,{[yC]:QO,[eT]:400},[bC],[0]];Bs.for(Ye).registerError(hPn,cwe);gPn=[3,Ye,bTn,0,[mb,g5,eTn],[0,[()=>Rre,0],0]],yPn=[3,Ye,_Tn,0,[mb,YGt],[0,[()=>uPn,0]]],bPn=[3,Ye,CTn,0,[ch],[0]],_Pn=[3,Ye,xTn,0,[ch,n9t,o9t],[0,128,()=>p9t]],vPn=[3,Ye,wTn,0,[VOn,ch,g5],[0,0,[()=>Rre,0]]],wPn=[3,Ye,OTn,0,[mb],[0]],SPn=[3,Ye,PTn,0,[ch,mb,g5,ywe,LEn],[0,0,[()=>Rre,0],128,1]],CPn=[3,Ye,MTn,0,[mb,s9t],[0,[()=>c9t,0]]],xPn=[3,Ye,ITn,0,[mb,g5],[0,[()=>Rre,0]]],OPn=[3,Ye,RTn,0,[mb,s9t],[0,[()=>c9t,0]]],TPn=[3,Ye,NTn,0,[ch,gwe],[0,0]],EPn=[3,Ye,jTn,0,[ch,gwe,H5e,ywe],[0,0,2,128]],d9t=[3,Ye,LTn,0,[mb,g5,WOn,iEn],[0,64,4,4]],mwe=[3,Ye,BTn,0,[ch,B5e,ZGt,XGt,i9t,hwe,r9t,QGt,a9t,t9t],[0,0,2,2,128,0,64,()=>f9t,64,128]],PPn=[3,Ye,HTn,0,[ch,B5e],[0,0]],MPn=[-3,Ye,FTn,{[yC]:rPn},[bC],[0]];Bs.for(Ye).registerError(MPn,nwe);IPn=[-3,Ye,kTn,{[yC]:QO,[eT]:400},[bC],[0]];Bs.for(Ye).registerError(IPn,dwe);RPn=[-3,Ye,zTn,{[yC]:QO,[eT]:400},[bC],[0]];Bs.for(Ye).registerError(RPn,owe);APn=[-3,Ye,ZTn,{[yC]:QO,[eT]:400},[bC],[0]];Bs.for(Ye).registerError(APn,iwe);NPn=[3,Ye,QTn,0,[ch,z5e,y5,DTn],[0,1,0,2]],jPn=[3,Ye,nEn,0,[ch,$Tn,y5],[0,()=>sMn,0]],DPn=[3,Ye,tEn,0,[z5e,y5],[1,0]],$Pn=[3,Ye,rEn,0,[WTn,y5],[()=>uMn,0]],LPn=[3,Ye,sEn,0,[V5e],[0]],FPn=[3,Ye,uEn,0,[u9t],[128]],kPn=[3,Ye,GTn,0,[ch,mb,e9t,z5e,y5],[0,0,0,1,0]],qPn=[3,Ye,XTn,0,[mb,fTn,y5],[0,64,0]],UPn=[3,Ye,mEn,0,[tTn,hEn,tPn,_En],[0,0,0,0]],BPn=[3,Ye,dEn,0,[$En,pTn,hwe,ch],[0,0,0,0]],zPn=[3,Ye,fEn,0,[mb],[0]],VPn=[-3,Ye,gEn,{[yC]:QO,[eT]:403},[bC],[0]];Bs.for(Ye).registerError(VPn,awe);HPn=[-3,Ye,wEn,{[yC]:QO,[eT]:409},[bC],[0]];Bs.for(Ye).registerError(HPn,swe);JPn=[-3,Ye,OEn,{[yC]:QO,[eT]:404},[bC],[0]];Bs.for(Ye).registerError(JPn,lwe);WPn=[3,Ye,xEn,0,[zEn,JOn,vEn],[0,0,()=>KPn]],KPn=[3,Ye,SEn,0,[TEn],[()=>lMn]],GPn=[3,Ye,PEn,0,[ch,n9t,o9t],[0,128,()=>p9t]],XPn=[3,Ye,AEn,0,[ch,gwe,H5e,ywe],[0,0,2,128]],ZPn=[3,Ye,NEn,0,[ch,gwe,H5e,ywe],[0,0,2,128]],YPn=[3,Ye,UEn,0,[V5e,u9t],[0,128]],QPn=[3,Ye,BEn,0,[],[]],eMn=[-3,Ye,kEn,{[yC]:QO,[eT]:429},[bC],[0]];Bs.for(Ye).registerError(eMn,uwe);tMn=[3,Ye,HEn,0,[mb,ch,hwe,e9t],[0,0,0,0]],rMn=[3,Ye,GEn,0,[mb,g5,lEn],[0,[()=>Rre,0],64]],nMn=[3,Ye,XEn,0,[mb,hTn],[0,0]],oMn=[3,Ye,QEn,0,[V5e,FEn],[0,64]],iMn=[3,Ye,ePn,0,[],[]],bwe="unit",aMn=[-3,l9t,"CognitoIdentityServiceException",0,[],[]];Bs.for(l9t).registerError(aMn,py);f9t=[1,Ye,ZOn,0,()=>iPn],sMn=[1,Ye,UTn,0,()=>d9t],uMn=[1,Ye,VTn,0,()=>PPn],lMn=[1,Ye,pEn,0,()=>UPn],cMn=[1,Ye,KEn,0,()=>nMn],Rre=[2,Ye,oEn,0,[0,0],[()=>nPn,0]],p9t=[2,Ye,CEn,0,0,()=>WPn],m9t=[9,Ye,YOn,0,()=>sPn,()=>mwe],h9t=[9,Ye,rTn,0,()=>lPn,()=>cPn],g9t=[9,Ye,iTn,0,()=>dPn,()=>bwe],y9t=[9,Ye,cTn,0,()=>fPn,()=>d9t],b9t=[9,Ye,uTn,0,()=>pPn,()=>mwe],_9t=[9,Ye,yTn,0,()=>gPn,()=>yPn],v9t=[9,Ye,vTn,0,()=>vPn,()=>wPn],w9t=[9,Ye,STn,0,()=>bPn,()=>_Pn],S9t=[9,Ye,TTn,0,()=>xPn,()=>OPn],C9t=[9,Ye,ETn,0,()=>SPn,()=>CPn],x9t=[9,Ye,ATn,0,()=>TPn,()=>EPn],O9t=[9,Ye,YTn,0,()=>NPn,()=>jPn],T9t=[9,Ye,eEn,0,()=>DPn,()=>$Pn],E9t=[9,Ye,aEn,0,()=>LPn,()=>FPn],P9t=[9,Ye,KTn,0,()=>kPn,()=>qPn],M9t=[9,Ye,cEn,0,()=>BPn,()=>zPn],I9t=[9,Ye,EEn,0,()=>GPn,()=>bwe],R9t=[9,Ye,REn,0,()=>XPn,()=>ZPn],A9t=[9,Ye,qEn,0,()=>YPn,()=>QPn],N9t=[9,Ye,VEn,0,()=>tMn,()=>bwe],j9t=[9,Ye,JEn,0,()=>rMn,()=>bwe],D9t=[9,Ye,YEn,0,()=>oMn,()=>iMn],$9t=[9,Ye,ZEn,0,()=>mwe,()=>mwe]});var _we,J5e=v(()=>{fu();No();fl();pl();_we=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").sc(m9t).build(){}});var vwe,W5e=v(()=>{fu();No();fl();pl();vwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").sc(h9t).build(){}});var wwe,K5e=v(()=>{fu();No();fl();pl();wwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").sc(g9t).build(){}});var Swe,G5e=v(()=>{fu();No();fl();pl();Swe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").sc(y9t).build(){}});var Cwe,X5e=v(()=>{fu();No();fl();pl();Cwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").sc(b9t).build(){}});var b5,Z5e=v(()=>{fu();No();fl();pl();b5=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").sc(_9t).build(){}});var _5,Y5e=v(()=>{fu();No();fl();pl();_5=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").sc(v9t).build(){}});var xwe,Q5e=v(()=>{fu();No();fl();pl();xwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").sc(w9t).build(){}});var Owe,eKe=v(()=>{fu();No();fl();pl();Owe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").sc(S9t).build(){}});var Twe,tKe=v(()=>{fu();No();fl();pl();Twe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").sc(C9t).build(){}});var Ewe,rKe=v(()=>{fu();No();fl();pl();Ewe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").sc(x9t).build(){}});var Pwe,nKe=v(()=>{fu();No();fl();pl();Pwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").sc(O9t).build(){}});var v5,Mwe=v(()=>{fu();No();fl();pl();v5=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").sc(T9t).build(){}});var Iwe,oKe=v(()=>{fu();No();fl();pl();Iwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").sc(E9t).build(){}});var Rwe,iKe=v(()=>{fu();No();fl();pl();Rwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").sc(P9t).build(){}});var Awe,aKe=v(()=>{fu();No();fl();pl();Awe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").sc(M9t).build(){}});var Nwe,sKe=v(()=>{fu();No();fl();pl();Nwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").sc(I9t).build(){}});var jwe,uKe=v(()=>{fu();No();fl();pl();jwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").sc(R9t).build(){}});var Dwe,lKe=v(()=>{fu();No();fl();pl();Dwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").sc(A9t).build(){}});var $we,cKe=v(()=>{fu();No();fl();pl();$we=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").sc(N9t).build(){}});var Lwe,dKe=v(()=>{fu();No();fl();pl();Lwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").sc(j9t).build(){}});var Fwe,fKe=v(()=>{fu();No();fl();pl();Fwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").sc(D9t).build(){}});var kwe,pKe=v(()=>{fu();No();fl();pl();kwe=class extends an.classBuilder().ep(io).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").sc($9t).build(){}});var dMn,mKe,L9t=v(()=>{No();rwe();J5e();W5e();K5e();G5e();X5e();Z5e();Y5e();Q5e();eKe();tKe();rKe();nKe();Mwe();oKe();iKe();aKe();sKe();uKe();lKe();cKe();dKe();fKe();pKe();dMn={CreateIdentityPoolCommand:_we,DeleteIdentitiesCommand:vwe,DeleteIdentityPoolCommand:wwe,DescribeIdentityCommand:Swe,DescribeIdentityPoolCommand:Cwe,GetCredentialsForIdentityCommand:b5,GetIdCommand:_5,GetIdentityPoolRolesCommand:xwe,GetOpenIdTokenCommand:Owe,GetOpenIdTokenForDeveloperIdentityCommand:Twe,GetPrincipalTagAttributeMapCommand:Ewe,ListIdentitiesCommand:Pwe,ListIdentityPoolsCommand:v5,ListTagsForResourceCommand:Iwe,LookupDeveloperIdentityCommand:Rwe,MergeDeveloperIdentitiesCommand:Awe,SetIdentityPoolRolesCommand:Nwe,SetPrincipalTagAttributeMapCommand:jwe,TagResourceCommand:Dwe,UnlinkDeveloperIdentityCommand:$we,UnlinkIdentityCommand:Lwe,UntagResourceCommand:Fwe,UpdateIdentityPoolCommand:kwe},mKe=class extends mF{};ave(dMn,mKe)});var F9t=v(()=>{J5e();W5e();K5e();G5e();X5e();Z5e();Y5e();Q5e();eKe();tKe();rKe();nKe();Mwe();oKe();iKe();aKe();sKe();uKe();lKe();cKe();dKe();fKe();pKe()});var k9t=v(()=>{});var kla,q9t=v(()=>{ZO();rwe();Mwe();kla=KWe(mF,v5,"NextToken","NextToken","MaxResults")});var U9t=v(()=>{k9t();q9t()});var B9t=v(()=>{});var z9t=v(()=>{});var V9t=v(()=>{rwe();L9t();F9t();pl();U9t();B9t();U5e();z9t()});var hKe={};Rn(hKe,{CognitoIdentityClient:()=>mF,GetCredentialsForIdentityCommand:()=>b5,GetIdCommand:()=>_5});var gKe=v(()=>{V9t()});function qwe(t){return async e=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:r,CognitoIdentityClient:n}=await Promise.resolve().then(()=>(gKe(),hKe)),o=l=>t.clientConfig?.[l]??t.parentClientConfig?.[l]??e?.callerClientConfig?.[l],{Credentials:{AccessKeyId:i=fMn(t.logger),Expiration:a,SecretKey:s=mMn(t.logger),SessionToken:u}=pMn(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 l_e(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:i,secretAccessKey:s,sessionToken:u,expiration:a}}}function fMn(t){throw new vm("Response from Amazon Cognito contained no access key ID",{logger:t})}function pMn(t){throw new vm("Response from Amazon Cognito contained no credentials",{logger:t})}function mMn(t){throw new vm("Response from Amazon Cognito contained no secret key",{logger:t})}var yKe=v(()=>{QL();kWe()});var bKe,Uwe,H9t=v(()=>{bKe="IdentityIds",Uwe=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(bKe,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(bKe,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(bKe)))}).catch(i=>{throw n.close(),i})})}}});var Bwe,J9t=v(()=>{Bwe=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 W9t(){return typeof self=="object"&&self.indexedDB?new Uwe:typeof window=="object"&&window.localStorage?window.localStorage:hMn}var hMn,K9t=v(()=>{H9t();J9t();hMn=new Bwe});function G9t({accountId:t,cache:e=W9t(),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(()=>(gKe(),hKe)),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=gMn(u)}=await y.send(new p({AccountId:t,IdentityPoolId:i,Logins:a?await l_e(a):void 0}));g=b,c&&Promise.resolve(e.setItem(c,g)).catch(()=>{})}return d=qwe({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 gMn(t){throw new vm("Response from Amazon Cognito contained no identity ID",{logger:t})}var X9t=v(()=>{QL();yKe();K9t();kWe()});var _Ke=v(()=>{Q2t();eVt();tVt();yKe();X9t()});var yMn,Z9t=v(()=>{_Ke();yMn=t=>qwe({...t})});var bMn,Y9t=v(()=>{_Ke();bMn=t=>G9t({...t})});var _Mn,vMn,wMn,Q9t,e7t=v(()=>{QL();_Mn="169.254.170.2",vMn="169.254.170.23",wMn="[fd00:ec2::23]",Q9t=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===_Mn||t.hostname===vMn||t.hostname===wMn)){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 vm(`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 t7t=v(()=>{});var r7t=v(()=>{t7t()});var n7t=v(()=>{});var o7t=v(()=>{});var i7t=v(()=>{});function SMn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var zwe,a7t=v(()=>{zwe=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=SMn(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 s7t=v(()=>{});var u7t=v(()=>{});var l7t=v(()=>{});var c7t=v(()=>{r7t();n7t();o7t();i7t();a7t();s7t();u7t();l7t()});function d7t(t){return new zwe({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 f7t(t,e){let n=await qHt(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 vm("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:bJt(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new vm(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new vm(`Server responded with status: ${t.statusCode}`,{logger:e})}var p7t=v(()=>{QL();c7t();No();r6e()});var m7t,h7t=v(()=>{m7t=(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 vKe,g7t=v(()=>{fre();QL();e7t();p7t();h7t();vKe=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new vm("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);Q9t(n,t.logger);let o=new rF;return m7t(async()=>{let i=d7t(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return f7t(a.response)},t.maxRetries??3,t.timeout??1e3)}});var y7t=v(()=>{g7t()});function CMn(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function xMn(t){return{schemeId:"smithy.api#noAuth"}}var Are,b7t,_7t,OMn,v7t,wKe=v(()=>{c5();Are=L(pS());Nre();b7t=async(t,e,r)=>({operation:(0,Are.getSmithyContext)(e).operation,region:await(0,Are.normalizeProvider)(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});_7t=t=>{let e=[];switch(t.operation){case"AssumeRoleWithWebIdentity":{e.push(xMn(t));break}default:e.push(CMn(t))}return e},OMn=t=>Object.assign(t,{stsClientCtor:vS}),v7t=t=>{let e=OMn(t),r=nve(e);return Object.assign(r,{authSchemePreference:(0,Are.normalizeProvider)(t.authSchemePreference??[])})}});var w7t,Vwe,Hwe=v(()=>{w7t=t=>Object.assign(t,{useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),Vwe={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 C7t,S7t=v(()=>{C7t={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 x7t,O7t=v(()=>{x7t=t=>new TextEncoder().encode(t)});var T7t=v(()=>{});var E7t,P7t=v(()=>{E7t=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 M7t=v(()=>{O7t();T7t();P7t()});var q7t,ti,ss,us,gF,hF,ug,U7t,B7t,z7t,$l,I7t,tT,w5,CKe,R7t,SKe,V7t,A7t,lg,N7t,H7t,J7t,my,Lv,j7t,W7t,K7t,D7t,G7t,$7t,L7t,F7t,k7t,EMn,X7t,Z7t=v(()=>{q7t="required",ti="type",ss="fn",us="argv",gF="ref",hF="booleanEquals",ug="stringEquals",U7t="sigv4",B7t="sts",z7t="us-east-1",$l="endpoint",I7t="https://sts.{Region}.{PartitionResult#dnsSuffix}",tT="tree",w5="error",CKe="getAttr",R7t={[q7t]:!1,[ti]:"string"},SKe={[q7t]:!0,default:!1,[ti]:"boolean"},V7t={[gF]:"Endpoint"},A7t={[ss]:"isSet",[us]:[{[gF]:"Region"}]},lg={[gF]:"Region"},N7t={[ss]:"aws.partition",[us]:[lg],assign:"PartitionResult"},H7t={[gF]:"UseFIPS"},J7t={[gF]:"UseDualStack"},my={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:U7t,signingName:B7t,signingRegion:z7t}]},headers:{}},Lv={},j7t={conditions:[{[ss]:ug,[us]:[lg,"aws-global"]}],[$l]:my,[ti]:$l},W7t={[ss]:hF,[us]:[H7t,!0]},K7t={[ss]:hF,[us]:[J7t,!0]},D7t={[ss]:CKe,[us]:[{[gF]:"PartitionResult"},"supportsFIPS"]},G7t={[gF]:"PartitionResult"},$7t={[ss]:hF,[us]:[!0,{[ss]:CKe,[us]:[G7t,"supportsDualStack"]}]},L7t=[{[ss]:"isSet",[us]:[V7t]}],F7t=[W7t],k7t=[K7t],EMn={version:"1.0",parameters:{Region:R7t,UseDualStack:SKe,UseFIPS:SKe,Endpoint:R7t,UseGlobalEndpoint:SKe},rules:[{conditions:[{[ss]:hF,[us]:[{[gF]:"UseGlobalEndpoint"},!0]},{[ss]:"not",[us]:L7t},A7t,N7t,{[ss]:hF,[us]:[H7t,!1]},{[ss]:hF,[us]:[J7t,!1]}],rules:[{conditions:[{[ss]:ug,[us]:[lg,"ap-northeast-1"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"ap-south-1"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"ap-southeast-1"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"ap-southeast-2"]}],endpoint:my,[ti]:$l},j7t,{conditions:[{[ss]:ug,[us]:[lg,"ca-central-1"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"eu-central-1"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"eu-north-1"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"eu-west-1"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"eu-west-2"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"eu-west-3"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"sa-east-1"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,z7t]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"us-east-2"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"us-west-1"]}],endpoint:my,[ti]:$l},{conditions:[{[ss]:ug,[us]:[lg,"us-west-2"]}],endpoint:my,[ti]:$l},{endpoint:{url:I7t,properties:{authSchemes:[{name:U7t,signingName:B7t,signingRegion:"{Region}"}]},headers:Lv},[ti]:$l}],[ti]:tT},{conditions:L7t,rules:[{conditions:F7t,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[ti]:w5},{conditions:k7t,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[ti]:w5},{endpoint:{url:V7t,properties:Lv,headers:Lv},[ti]:$l}],[ti]:tT},{conditions:[A7t],rules:[{conditions:[N7t],rules:[{conditions:[W7t,K7t],rules:[{conditions:[{[ss]:hF,[us]:[!0,D7t]},$7t],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Lv,headers:Lv},[ti]:$l}],[ti]:tT},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[ti]:w5}],[ti]:tT},{conditions:F7t,rules:[{conditions:[{[ss]:hF,[us]:[D7t,!0]}],rules:[{conditions:[{[ss]:ug,[us]:[{[ss]:CKe,[us]:[G7t,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:Lv,headers:Lv},[ti]:$l},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Lv,headers:Lv},[ti]:$l}],[ti]:tT},{error:"FIPS is enabled but this partition does not support FIPS",[ti]:w5}],[ti]:tT},{conditions:k7t,rules:[{conditions:[$7t],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Lv,headers:Lv},[ti]:$l}],[ti]:tT},{error:"DualStack is enabled but this partition does not support DualStack",[ti]:w5}],[ti]:tT},j7t,{endpoint:{url:I7t,properties:Lv,headers:Lv},[ti]:$l}],[ti]:tT}],[ti]:tT},{error:"Invalid Configuration: Missing Region",[ti]:w5}]},X7t=EMn});var PMn,Y7t,Q7t=v(()=>{V_e();w4();Z7t();PMn=new t5({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS","UseGlobalEndpoint"]}),Y7t=(t,e={})=>PMn.get(t,()=>B_e(X7t,{endpointParams:t,logger:e.logger}));UN.aws=bre});var eXt,tXt=v(()=>{c5();Sve();ZO();No();z_e();KO();M7t();wKe();Q7t();eXt=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??Dv,base64Encoder:t?.base64Encoder??$v,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??Y7t,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??_7t,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new S4},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new e5}],logger:t?.logger??new pF,protocol:t?.protocol??wve,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??uF,utf8Decoder:t?.utf8Decoder??x7t,utf8Encoder:t?.utf8Encoder??E7t})});var rXt,nXt=v(()=>{S7t();j5e();D5e();xre();fre();$5e();No();Z6e();L5e();Tre();tXt();rXt=t=>{let e=Yve(t),r=()=>e().then(sve),n=eXt(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??ove,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??Xve({serviceId:n.serviceId,clientVersion:C7t.version}),maxAttempts:t?.maxAttempts??HN,region:t?.region??Zve("Region is missing"),requestHandler:rF.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||Ore),sha256:t?.sha256??Gve,streamCollector:t?.streamCollector??K6,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(Eve)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(Pve))}}});var oXt,iXt,aXt=v(()=>{oXt=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),iXt=t=>({httpHandler:t.httpHandler()})});var sXt=v(()=>{aXt()});var uXt=v(()=>{});var lXt=v(()=>{});var cXt=v(()=>{});var dXt=v(()=>{});var fXt=v(()=>{});var pXt=v(()=>{});var mXt=v(()=>{});var hXt=v(()=>{sXt();uXt();lXt();cXt();dXt();fXt();pXt();mXt()});var gXt,yXt,bXt=v(()=>{gXt=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}}},yXt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var _Xt,vXt=v(()=>{twe();hXt();No();bXt();_Xt=(t,e)=>{let r=Object.assign(Qve(t),uve(t),oXt(t),gXt(t));return e.forEach(n=>n.configure(r)),Object.assign(t,ewe(r),lve(r),iXt(r),yXt(r))}});var vS,Nre=v(()=>{qWe();UWe();zWe();g5e();xre();ZO();sg();b5e();fu();E5e();No();wKe();Hwe();nXt();vXt();vS=class extends x4{constructor(...[r]){let n=rXt(r||{});super(n);x(this,"config");this.initConfig=n;let o=w7t(n),i=D_e(o),a=Jve(i),s=Ive(a),u=s,l=Lve(u),c=v7t(l),d=_Xt(c,r?.extensions||[]);this.config=d,this.middlewareStack.use(w_e(this.config)),this.middlewareStack.use(Tve(this.config)),this.middlewareStack.use(Wve(this.config)),this.middlewareStack.use(Ave(this.config)),this.middlewareStack.use(d_e(this.config)),this.middlewareStack.use(f_e(this.config)),this.middlewareStack.use(p_e(this.config)),this.middlewareStack.use(m_e(this.config,{httpAuthSchemeParametersProvider:b7t,identityProviderConfigProvider:async f=>new Q6({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(g_e(this.config))}destroy(){super.destroy()}}});var f_,Jwe=v(()=>{No();f_=class t extends a5{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var jre,Dre,$re,Lre,Fre,kre,qre,xKe=v(()=>{Jwe();jre=class t extends f_{constructor(r){super({name:"ExpiredTokenException",$fault:"client",...r});x(this,"name","ExpiredTokenException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Dre=class t extends f_{constructor(r){super({name:"MalformedPolicyDocumentException",$fault:"client",...r});x(this,"name","MalformedPolicyDocumentException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},$re=class t extends f_{constructor(r){super({name:"PackedPolicyTooLargeException",$fault:"client",...r});x(this,"name","PackedPolicyTooLargeException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Lre=class t extends f_{constructor(r){super({name:"RegionDisabledException",$fault:"client",...r});x(this,"name","RegionDisabledException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},Fre=class t extends f_{constructor(r){super({name:"IDPRejectedClaimException",$fault:"client",...r});x(this,"name","IDPRejectedClaimException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},kre=class t extends f_{constructor(r){super({name:"InvalidIdentityTokenException",$fault:"client",...r});x(this,"name","InvalidIdentityTokenException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}},qre=class t extends f_{constructor(r){super({name:"IDPCommunicationErrorException",$fault:"client",...r});x(this,"name","IDPCommunicationErrorException");x(this,"$fault","client");Object.setPrototypeOf(this,t.prototype)}}});var MMn,IMn,RMn,AMn,NMn,jMn,OKe,DMn,$Mn,LMn,FMn,TKe,kMn,wXt,qMn,UMn,BMn,zMn,VMn,HMn,JMn,WMn,SXt,CXt,KMn,GMn,XMn,ZMn,YMn,QMn,xXt,eIn,tIn,OXt,rIn,TXt,nIn,oIn,EKe,iIn,aIn,sIn,uIn,lIn,cIn,dIn,fIn,pIn,mIn,O4,T4,hIn,E4,P4,M4,gIn,EXt,yIn,Ks,bIn,_In,PKe,PXt,MXt,IXt,RXt,MKe,AXt,NXt,jXt,DXt,$Xt,LXt,FXt,kXt,qXt,UXt,BXt,zXt,vIn,wIn,IKe,RKe,Wwe=v(()=>{sg();xKe();Jwe();MMn="Arn",IMn="AccessKeyId",RMn="AssumeRole",AMn="AssumedRoleId",NMn="AssumeRoleRequest",jMn="AssumeRoleResponse",OKe="AssumedRoleUser",DMn="AssumeRoleWithWebIdentity",$Mn="AssumeRoleWithWebIdentityRequest",LMn="AssumeRoleWithWebIdentityResponse",FMn="Audience",TKe="Credentials",kMn="ContextAssertion",wXt="DurationSeconds",qMn="Expiration",UMn="ExternalId",BMn="ExpiredTokenException",zMn="IDPCommunicationErrorException",VMn="IDPRejectedClaimException",HMn="InvalidIdentityTokenException",JMn="Key",WMn="MalformedPolicyDocumentException",SXt="Policy",CXt="PolicyArns",KMn="ProviderArn",GMn="ProvidedContexts",XMn="ProvidedContextsListType",ZMn="ProvidedContext",YMn="PolicyDescriptorType",QMn="ProviderId",xXt="PackedPolicySize",eIn="PackedPolicyTooLargeException",tIn="Provider",OXt="RoleArn",rIn="RegionDisabledException",TXt="RoleSessionName",nIn="SecretAccessKey",oIn="SubjectFromWebIdentityToken",EKe="SourceIdentity",iIn="SerialNumber",aIn="SessionToken",sIn="Tags",uIn="TokenCode",lIn="TransitiveTagKeys",cIn="Tag",dIn="Value",fIn="WebIdentityToken",pIn="arn",mIn="accessKeySecretType",O4="awsQueryError",T4="client",hIn="clientTokenType",E4="error",P4="httpError",M4="message",gIn="policyDescriptorListType",EXt="smithy.ts.sdk.synthetic.com.amazonaws.sts",yIn="tagListType",Ks="com.amazonaws.sts",bIn=[0,Ks,mIn,8,0],_In=[0,Ks,hIn,8,0],PKe=[3,Ks,OKe,0,[AMn,MMn],[0,0]],PXt=[3,Ks,NMn,0,[OXt,TXt,CXt,SXt,wXt,sIn,lIn,UMn,iIn,uIn,EKe,GMn],[0,0,()=>zXt,0,1,()=>wIn,64,0,0,0,0,()=>vIn]],MXt=[3,Ks,jMn,0,[TKe,OKe,xXt,EKe],[[()=>MKe,0],()=>PKe,1,0]],IXt=[3,Ks,$Mn,0,[OXt,TXt,fIn,QMn,CXt,SXt,wXt],[0,0,[()=>_In,0],0,()=>zXt,0,1]],RXt=[3,Ks,LMn,0,[TKe,oIn,OKe,xXt,tIn,FMn,EKe],[[()=>MKe,0],0,()=>PKe,1,0,0,0]],MKe=[3,Ks,TKe,0,[IMn,nIn,aIn,qMn],[0,[()=>bIn,0],0,4]],AXt=[-3,Ks,BMn,{[O4]:["ExpiredTokenException",400],[E4]:T4,[P4]:400},[M4],[0]];Bs.for(Ks).registerError(AXt,jre);NXt=[-3,Ks,zMn,{[O4]:["IDPCommunicationError",400],[E4]:T4,[P4]:400},[M4],[0]];Bs.for(Ks).registerError(NXt,qre);jXt=[-3,Ks,VMn,{[O4]:["IDPRejectedClaim",403],[E4]:T4,[P4]:403},[M4],[0]];Bs.for(Ks).registerError(jXt,Fre);DXt=[-3,Ks,HMn,{[O4]:["InvalidIdentityToken",400],[E4]:T4,[P4]:400},[M4],[0]];Bs.for(Ks).registerError(DXt,kre);$Xt=[-3,Ks,WMn,{[O4]:["MalformedPolicyDocument",400],[E4]:T4,[P4]:400},[M4],[0]];Bs.for(Ks).registerError($Xt,Dre);LXt=[-3,Ks,eIn,{[O4]:["PackedPolicyTooLarge",400],[E4]:T4,[P4]:400},[M4],[0]];Bs.for(Ks).registerError(LXt,$re);FXt=[3,Ks,YMn,0,[pIn],[0]],kXt=[3,Ks,ZMn,0,[KMn,kMn],[0,0]],qXt=[-3,Ks,rIn,{[O4]:["RegionDisabledException",403],[E4]:T4,[P4]:403},[M4],[0]];Bs.for(Ks).registerError(qXt,Lre);UXt=[3,Ks,cIn,0,[JMn,dIn],[0,0]],BXt=[-3,EXt,"STSServiceException",0,[],[]];Bs.for(EXt).registerError(BXt,f_);zXt=[1,Ks,gIn,0,()=>FXt],vIn=[1,Ks,XMn,0,()=>kXt],wIn=[1,Ks,yIn,0,()=>UXt],IKe=[9,Ks,RMn,0,()=>PXt,()=>MXt],RKe=[9,Ks,DMn,0,()=>IXt,()=>RXt]});var WN,Kwe=v(()=>{fu();No();Hwe();Wwe();WN=class extends an.classBuilder().ep(Vwe).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").sc(IKe).build(){}});var I4,Gwe=v(()=>{fu();No();Hwe();Wwe();I4=class extends an.classBuilder().ep(Vwe).m(function(e,r,n,o){return[On(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").sc(RKe).build(){}});var SIn,Xwe,VXt=v(()=>{No();Kwe();Gwe();Nre();SIn={AssumeRoleCommand:WN,AssumeRoleWithWebIdentityCommand:I4},Xwe=class extends vS{};ave(SIn,Xwe)});var HXt=v(()=>{Kwe();Gwe()});var JXt=v(()=>{});var WXt,KXt,GXt,XXt,ZXt,YXt=v(()=>{J_e();twe();Kwe();Gwe();WXt=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},KXt=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 RGt(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},GXt=(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 KXt(f,t?.parentClientConfig?.region,m,{logger:c,profile:d}),g=!ZXt(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 WN(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=WXt(s),l={accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}};return n5(l,"CREDENTIALS_STS_ASSUME_ROLE","i"),l}},XXt=(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 KXt(c,t?.parentClientConfig?.region,f,{logger:u,profile:l}),h=!ZXt(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 I4(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=WXt(i),s={accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}};return a&&n5(s,"RESOLVED_ACCOUNT_ID","T"),n5(s,"CREDENTIALS_STS_ASSUME_ROLE_WEB_ID","k"),s}},ZXt=t=>t?.metadata?.handlerProtocol==="h2"});var QXt,eZt,tZt,CIn,rZt=v(()=>{YXt();Nre();QXt=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,eZt=(t={},e)=>GXt(t,QXt(vS,e)),tZt=(t={},e)=>XXt(t,QXt(vS,e)),CIn=t=>e=>t({roleAssumer:eZt(e),roleAssumerWithWebIdentity:tZt(e),...e})});var nZt={};Rn(nZt,{$Command:()=>an,AssumeRole$:()=>IKe,AssumeRoleCommand:()=>WN,AssumeRoleRequest$:()=>PXt,AssumeRoleResponse$:()=>MXt,AssumeRoleWithWebIdentity$:()=>RKe,AssumeRoleWithWebIdentityCommand:()=>I4,AssumeRoleWithWebIdentityRequest$:()=>IXt,AssumeRoleWithWebIdentityResponse$:()=>RXt,AssumedRoleUser$:()=>PKe,Credentials$:()=>MKe,ExpiredTokenException:()=>jre,ExpiredTokenException$:()=>AXt,IDPCommunicationErrorException:()=>qre,IDPCommunicationErrorException$:()=>NXt,IDPRejectedClaimException:()=>Fre,IDPRejectedClaimException$:()=>jXt,InvalidIdentityTokenException:()=>kre,InvalidIdentityTokenException$:()=>DXt,MalformedPolicyDocumentException:()=>Dre,MalformedPolicyDocumentException$:()=>$Xt,PackedPolicyTooLargeException:()=>$re,PackedPolicyTooLargeException$:()=>LXt,PolicyDescriptorType$:()=>FXt,ProvidedContext$:()=>kXt,RegionDisabledException:()=>Lre,RegionDisabledException$:()=>qXt,STS:()=>Xwe,STSClient:()=>vS,STSServiceException:()=>f_,STSServiceException$:()=>BXt,Tag$:()=>UXt,__Client:()=>x4,decorateDefaultCredentialProvider:()=>CIn,getDefaultRoleAssumer:()=>eZt,getDefaultRoleAssumerWithWebIdentity:()=>tZt});var AKe=v(()=>{Nre();VXt();HXt();Wwe();xKe();JXt();rZt();Jwe()});var oZt={};Rn(oZt,{AssumeRoleCommand:()=>WN,STSClient:()=>vS});var iZt=v(()=>{AKe()});var xIn,sZt,aZt,Zwe,uZt=v(()=>{ZO();QL();xIn="us-east-1",sZt=(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 vm("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(()=>(iZt(),oZt));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}),xIn],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=[aZt(t.clientConfig?.requestHandler),aZt(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 FN(Zwe(h))()}, ${m}, ${b}.`),n=new c({userAgentAppId:i?.userAgentAppId,...t.clientConfig,credentials:Zwe(p),logger:s,profile:a,region:Zwe(h),requestHandler:Zwe(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 vm(`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}}},aZt=t=>t?.metadata?.handlerProtocol==="h2"?void 0:t,Zwe=t=>{for(let e of t)if(e!==void 0)return e}});var lZt=v(()=>{uZt()});var cZt=v(()=>{});var dZt,fZt=v(()=>{dZt=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(()=>(AKe(),nZt));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 pZt=v(()=>{cZt();fZt()});var OIn,mZt=v(()=>{pZt();OIn=t=>dZt({...t})});var hZt={};Rn(hZt,{fromCognitoIdentity:()=>yMn,fromCognitoIdentityPool:()=>bMn,fromHttp:()=>vKe,fromTemporaryCredentials:()=>sZt,fromWebToken:()=>OIn});var gZt=v(()=>{Z9t();Y9t();y7t();lZt();mZt()});var LKe=S(yF=>{"use strict";var TIn=H6(),EIn=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),PIn=t=>({httpHandler:t.httpHandler()}),NKe=class{constructor({name:e,kind:r=TIn.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}},jKe=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)}},DKe=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=MIn(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 MIn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var $Ke=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 IIn(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}yF.Field=NKe;yF.Fields=jKe;yF.HttpRequest=DKe;yF.HttpResponse=$Ke;yF.getHttpHandlerExtensionConfiguration=EIn;yF.isValidHostname=IIn;yF.resolveHttpHandlerRuntimeConfig=PIn});var bZt=S(kKe=>{"use strict";var yZt={},FKe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),yZt[t]=e,FKe[e]=t}function RIn(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 FKe)e[r/2]=FKe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function AIn(t){let e="";for(let r=0;r<t.byteLength;r++)e+=yZt[t[r]];return e}kKe.fromHex=RIn;kKe.toHex=AIn});var vZt=S(_Zt=>{"use strict";var NIn=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";_Zt.isArrayBuffer=NIn});var wZt=S(UKe=>{"use strict";var jIn=vZt(),qKe=Qw(),DIn=(t,e=0,r=t.byteLength-e)=>{if(!jIn.isArrayBuffer(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return qKe.Buffer.from(t,e,r)},$In=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?qKe.Buffer.from(t,e):qKe.Buffer.from(t)};UKe.fromArrayBuffer=DIn;UKe.fromString=$In});var xZt=S(Ywe=>{"use strict";var SZt=wZt(),CZt=t=>{let e=SZt.fromString(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},LIn=t=>typeof t=="string"?CZt(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),FIn=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 SZt.fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength).toString("utf8")};Ywe.fromUtf8=CZt;Ywe.toUint8Array=LIn;Ywe.toUtf8=FIn});var TZt=S(OZt=>{"use strict";var kIn=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";OZt.isArrayBuffer=kIn});var XZt=S(li=>{"use strict";var bF=bZt(),R4=xZt(),qIn=TZt(),IZt=LKe(),EZt=pS(),Qwe=dre(),RZt="X-Amz-Algorithm",AZt="X-Amz-Credential",WKe="X-Amz-Date",NZt="X-Amz-SignedHeaders",jZt="X-Amz-Expires",KKe="X-Amz-Signature",GKe="X-Amz-Security-Token",UIn="X-Amz-Region-Set",XKe="authorization",ZKe=WKe.toLowerCase(),DZt="date",$Zt=[XKe,ZKe,DZt],LZt=KKe.toLowerCase(),oSe="x-amz-content-sha256",FZt=GKe.toLowerCase(),BIn="host",kZt={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},qZt=/^proxy-/,UZt=/^sec-/,zIn=[/^proxy-/i,/^sec-/i],eSe="AWS4-HMAC-SHA256",VIn="AWS4-ECDSA-P256-SHA256",BZt="AWS4-HMAC-SHA256-PAYLOAD",zZt="UNSIGNED-PAYLOAD",VZt=50,YKe="aws4_request",HZt=60*60*24*7,S5={},tSe=[],rSe=(t,e,r)=>`${t}/${e}/${r}/${YKe}`,JZt=async(t,e,r,n,o)=>{let i=await PZt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${bF.toHex(i)}:${e.sessionToken}`;if(a in S5)return S5[a];for(tSe.push(a);tSe.length>VZt;)delete S5[tSe.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,YKe])s=await PZt(t,s,u);return S5[a]=s},HIn=()=>{tSe.length=0,Object.keys(S5).forEach(t=>{delete S5[t]})},PZt=(t,e,r)=>{let n=new t(e);return n.update(R4.toUint8Array(r)),n.digest()},BKe=({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 kZt||e?.has(i)||qZt.test(i)||UZt.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n},nSe=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===oSe)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||qIn.isArrayBuffer(e)){let n=new r;return n.update(R4.toUint8Array(e)),bF.toHex(await n.digest())}return zZt},zKe=class{format(e){let r=[];for(let i of Object.keys(e)){let a=R4.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=R4.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(VKe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!JIn.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(bF.fromHex(e.value.replace(/\-/g,"")),1),d}}},JIn=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,VKe=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&&MZt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&MZt(e),parseInt(bF.toHex(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function MZt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var WZt=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1},KZt=(t,e={})=>{let{headers:r,query:n={}}=IZt.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}},HKe=t=>{t=IZt.HttpRequest.clone(t);for(let e of Object.keys(t.headers))$Zt.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t},GZt=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t)){if(n.toLowerCase()===LZt)continue;let o=Qwe.escapeUri(n);e.push(o);let i=t[n];typeof i=="string"?r[o]=`${o}=${Qwe.escapeUri(i)}`:Array.isArray(i)&&(r[o]=i.slice(0).reduce((a,s)=>a.concat([`${o}=${Qwe.escapeUri(s)}`]),[]).sort().join("&"))}return e.sort().map(n=>r[n]).filter(n=>n).join("&")},WIn=t=>KIn(t).toISOString().replace(/\.\d{3}Z$/,"Z"),KIn=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=EZt.normalizeProvider(n),this.credentialProvider=EZt.normalizeProvider(r)}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
|
||
${this.getCanonicalPath(e)}
|
||
${GZt(e)}
|
||
${o.map(i=>`${i}:${r[i]}`).join(`
|
||
`)}
|
||
|
||
${o.join(";")}
|
||
${n}`}async createStringToSign(e,r,n,o){let i=new this.sha256;i.update(R4.toUint8Array(n));let a=await i.digest();return`${o}
|
||
${e}
|
||
${r}
|
||
${bF.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 Qwe.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=WIn(e).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}},JKe=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 zKe)}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>HZt)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let y=rSe(h,p,d??this.service),g=KZt(HKe(r),{unhoistableHeaders:s,hoistableHeaders:l});f.sessionToken&&(g.query[GKe]=f.sessionToken),g.query[RZt]=eSe,g.query[AZt]=`${f.accessKeyId}/${y}`,g.query[WKe]=m,g.query[jZt]=i.toString(10);let b=BKe(g,a,u);return g.query[NZt]=this.getCanonicalHeaderList(b),g.query[KKe]=await this.getSignature(m,y,this.getSigningKey(f,p,h,d),this.createCanonicalRequest(g,b,await nSe(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=rSe(l,u,s??this.service),f=await nSe({headers:{},body:n},this.sha256),p=new this.sha256;p.update(r);let m=bF.toHex(await p.digest()),h=[BZt,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(R4.toUint8Array(r)),bF.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=HKe(r),{longDate:d,shortDate:f}=this.formatDate(n),p=rSe(f,l,s??this.service);c.headers[ZKe]=d,u.sessionToken&&(c.headers[FZt]=u.sessionToken);let m=await nSe(c,this.sha256);!WZt(oSe,c.headers)&&this.applyChecksum&&(c.headers[oSe]=m);let h=BKe(c,i,o),y=await this.getSignature(d,p,this.getSigningKey(u,l,f,s),this.createCanonicalRequest(c,h,m));return c.headers[XKe]=`${eSe} 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,eSe),s=new this.sha256(await o);return s.update(R4.toUint8Array(a)),bF.toHex(await s.digest())}getSigningKey(r,n,o,i){return JZt(this.sha256,r,o,n,i||this.service)}},GIn={SignatureV4a:null};li.ALGORITHM_IDENTIFIER=eSe;li.ALGORITHM_IDENTIFIER_V4A=VIn;li.ALGORITHM_QUERY_PARAM=RZt;li.ALWAYS_UNSIGNABLE_HEADERS=kZt;li.AMZ_DATE_HEADER=ZKe;li.AMZ_DATE_QUERY_PARAM=WKe;li.AUTH_HEADER=XKe;li.CREDENTIAL_QUERY_PARAM=AZt;li.DATE_HEADER=DZt;li.EVENT_ALGORITHM_IDENTIFIER=BZt;li.EXPIRES_QUERY_PARAM=jZt;li.GENERATED_HEADERS=$Zt;li.HOST_HEADER=BIn;li.KEY_TYPE_IDENTIFIER=YKe;li.MAX_CACHE_SIZE=VZt;li.MAX_PRESIGNED_TTL=HZt;li.PROXY_HEADER_PATTERN=qZt;li.REGION_SET_PARAM=UIn;li.SEC_HEADER_PATTERN=UZt;li.SHA256_HEADER=oSe;li.SIGNATURE_HEADER=LZt;li.SIGNATURE_QUERY_PARAM=KKe;li.SIGNED_HEADERS_QUERY_PARAM=NZt;li.SignatureV4=JKe;li.SignatureV4Base=iSe;li.TOKEN_HEADER=FZt;li.TOKEN_QUERY_PARAM=GKe;li.UNSIGNABLE_PATTERNS=zIn;li.UNSIGNED_PAYLOAD=zZt;li.clearCredentialCache=HIn;li.createScope=rSe;li.getCanonicalHeaders=BKe;li.getCanonicalQuery=GZt;li.getPayloadHash=nSe;li.getSigningKey=JZt;li.hasHeader=WZt;li.moveHeadersToQuery=KZt;li.prepareRequest=HKe;li.signatureV4aContainer=GIn});var cc=S((ema,ZZt)=>{"use strict";ZZt.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 C5=S((tma,aSe)=>{"use strict";var{AbortController:YZt,AbortSignal:XIn}=typeof self<"u"?self:typeof window<"u"?window:void 0;aSe.exports=YZt;aSe.exports.AbortSignal=XIn;aSe.exports.default=YZt});var Ure=S((rma,QKe)=>{"use strict";var x5=typeof Reflect=="object"?Reflect:null,QZt=x5&&typeof x5.apply=="function"?x5.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},sSe;x5&&typeof x5.ownKeys=="function"?sSe=x5.ownKeys:Object.getOwnPropertySymbols?sSe=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:sSe=function(e){return Object.getOwnPropertyNames(e)};function ZIn(t){console&&console.warn&&console.warn(t)}var tYt=Number.isNaN||function(e){return e!==e};function pu(){pu.init.call(this)}QKe.exports=pu;QKe.exports.once=tRn;pu.EventEmitter=pu;pu.prototype._events=void 0;pu.prototype._eventsCount=0;pu.prototype._maxListeners=void 0;var eYt=10;function uSe(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(pu,"defaultMaxListeners",{enumerable:!0,get:function(){return eYt},set:function(t){if(typeof t!="number"||t<0||tYt(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");eYt=t}});pu.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};pu.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||tYt(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 rYt(t){return t._maxListeners===void 0?pu.defaultMaxListeners:t._maxListeners}pu.prototype.getMaxListeners=function(){return rYt(this)};pu.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")QZt(u,this,r);else for(var l=u.length,c=sYt(u,l),n=0;n<l;++n)QZt(c[n],this,r);return!0};function nYt(t,e,r,n){var o,i,a;if(uSe(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=rYt(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,ZIn(s)}return t}pu.prototype.addListener=function(e,r){return nYt(this,e,r,!1)};pu.prototype.on=pu.prototype.addListener;pu.prototype.prependListener=function(e,r){return nYt(this,e,r,!0)};function YIn(){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 oYt(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=YIn.bind(n);return o.listener=r,n.wrapFn=o,o}pu.prototype.once=function(e,r){return uSe(r),this.on(e,oYt(this,e,r)),this};pu.prototype.prependOnceListener=function(e,r){return uSe(r),this.prependListener(e,oYt(this,e,r)),this};pu.prototype.removeListener=function(e,r){var n,o,i,a,s;if(uSe(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():QIn(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};pu.prototype.off=pu.prototype.removeListener;pu.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 iYt(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?eRn(o):sYt(o,o.length)}pu.prototype.listeners=function(e){return iYt(this,e,!0)};pu.prototype.rawListeners=function(e){return iYt(this,e,!1)};pu.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):aYt.call(t,e)};pu.prototype.listenerCount=aYt;function aYt(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}pu.prototype.eventNames=function(){return this._eventsCount>0?sSe(this._events):[]};function sYt(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function QIn(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function eRn(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function tRn(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))}uYt(t,e,i,{once:!0}),e!=="error"&&rRn(t,o,{once:!0})})}function rRn(t,e,r){typeof t.on=="function"&&uYt(t,"error",e,r)}function uYt(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 hy=S((nma,t8e)=>{"use strict";var nRn=Qw(),{kResistStopPropagation:oRn,SymbolDispose:iRn}=cc(),aRn=globalThis.AbortSignal||C5().AbortSignal,sRn=globalThis.AbortController||C5().AbortController,uRn=Object.getPrototypeOf(async function(){}).constructor,lYt=globalThis.Blob||nRn.Blob,lRn=typeof lYt<"u"?function(e){return e instanceof lYt}:function(e){return!1},cYt=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},cRn=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},e8e=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}};t8e.exports={AggregateError:e8e,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 uRn},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:lRn,deprecate(t,e){return t},addAbortListener:Ure().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);cYt(e,"signal"),cRn(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[oRn]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[iRn](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:aRn.any||function(e){if(e.length===1)return e[0];let r=new sRn,n=()=>r.abort();return e.forEach(o=>{cYt(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};t8e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var hb=S((oma,pYt)=>{"use strict";var{format:dRn,inspect:lSe,AggregateError:fRn}=hy(),pRn=globalThis.AggregateError||fRn,mRn=Symbol("kIsNodeError"),hRn=["string","function","number","object","Function","Object","boolean","bigint","symbol"],gRn=/^([A-Z][a-z0-9]*)+$/,yRn="__node_internal_",cSe={};function A4(t,e){if(!t)throw new cSe.ERR_INTERNAL_ASSERTION(e)}function dYt(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 bRn(t,e,r){if(typeof e=="function")return A4(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 A4(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:dRn(e,...r)}function cg(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(bRn(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[mRn]=!0,cSe[t]=n}function fYt(t){let e=yRn+t.name;return Object.defineProperty(t,"name",{value:e}),t}function _Rn(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new pRn([e,t],e.message);return r.code=e.code,r}return t||e}var r8e=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new cSe.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};cg("ERR_ASSERTION","%s",Error);cg("ERR_INVALID_ARG_TYPE",(t,e,r)=>{A4(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)A4(typeof u=="string","All expected entries have to be of type string"),hRn.includes(u)?o.push(u.toLowerCase()):gRn.test(u)?i.push(u):(A4(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=lSe(r,{depth:-1});n+=`. Received ${u}`}}else{let u=lSe(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);cg("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=lSe(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);cg("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);cg("ERR_MISSING_ARGS",(...t)=>{A4(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);cg("ERR_OUT_OF_RANGE",(t,e,r)=>{A4(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=dYt(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=dYt(n)),n+="n"):n=lSe(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);cg("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);cg("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);cg("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);cg("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);cg("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);cg("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);cg("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);cg("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);cg("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);cg("ERR_STREAM_WRITE_AFTER_END","write after end",Error);cg("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);pYt.exports={AbortError:r8e,aggregateTwoErrors:fYt(_Rn),hideStackFrames:fYt,codes:cSe}});var T5=S((ima,CYt)=>{"use strict";var{ArrayIsArray:o8e,ArrayPrototypeIncludes:yYt,ArrayPrototypeJoin:bYt,ArrayPrototypeMap:vRn,NumberIsInteger:i8e,NumberIsNaN:wRn,NumberMAX_SAFE_INTEGER:SRn,NumberMIN_SAFE_INTEGER:CRn,NumberParseInt:xRn,ObjectPrototypeHasOwnProperty:ORn,RegExpPrototypeExec:_Yt,String:TRn,StringPrototypeToUpperCase:ERn,StringPrototypeTrim:PRn}=cc(),{hideStackFrames:wS,codes:{ERR_SOCKET_BAD_PORT:MRn,ERR_INVALID_ARG_TYPE:gy,ERR_INVALID_ARG_VALUE:O5,ERR_OUT_OF_RANGE:N4,ERR_UNKNOWN_SIGNAL:mYt}}=hb(),{normalizeEncoding:IRn}=hy(),{isAsyncFunction:RRn,isArrayBufferView:ARn}=hy().types,hYt={};function NRn(t){return t===(t|0)}function jRn(t){return t===t>>>0}var DRn=/^[0-7]+$/,$Rn="must be a 32-bit unsigned integer or an octal string";function LRn(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(_Yt(DRn,t)===null)throw new O5(e,t,$Rn);t=xRn(t,8)}return vYt(t,e),t}var FRn=wS((t,e,r=CRn,n=SRn)=>{if(typeof t!="number")throw new gy(e,"number",t);if(!i8e(t))throw new N4(e,"an integer",t);if(t<r||t>n)throw new N4(e,`>= ${r} && <= ${n}`,t)}),kRn=wS((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new gy(e,"number",t);if(!i8e(t))throw new N4(e,"an integer",t);if(t<r||t>n)throw new N4(e,`>= ${r} && <= ${n}`,t)}),vYt=wS((t,e,r=!1)=>{if(typeof t!="number")throw new gy(e,"number",t);if(!i8e(t))throw new N4(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new N4(e,`>= ${n} && <= ${o}`,t)});function a8e(t,e){if(typeof t!="string")throw new gy(e,"string",t)}function qRn(t,e,r=void 0,n){if(typeof t!="number")throw new gy(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&wRn(t))throw new N4(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var URn=wS((t,e,r)=>{if(!yYt(r,t)){let o="must be one of: "+bYt(vRn(r,i=>typeof i=="string"?`'${i}'`:TRn(i)),", ");throw new O5(e,t,o)}});function wYt(t,e){if(typeof t!="boolean")throw new gy(e,"boolean",t)}function n8e(t,e,r){return t==null||!ORn(t,e)?r:t[e]}var BRn=wS((t,e,r=null)=>{let n=n8e(r,"allowArray",!1),o=n8e(r,"allowFunction",!1);if(!n8e(r,"nullable",!1)&&t===null||!n&&o8e(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new gy(e,"Object",t)}),zRn=wS((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new gy(e,"a dictionary",t)}),dSe=wS((t,e,r=0)=>{if(!o8e(t))throw new gy(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new O5(e,t,n)}});function VRn(t,e){dSe(t,e);for(let r=0;r<t.length;r++)a8e(t[r],`${e}[${r}]`)}function HRn(t,e){dSe(t,e);for(let r=0;r<t.length;r++)wYt(t[r],`${e}[${r}]`)}function JRn(t,e){dSe(t,e);for(let r=0;r<t.length;r++){let n=t[r],o=`${e}[${r}]`;if(n==null)throw new gy(o,"AbortSignal",n);SYt(n,o)}}function WRn(t,e="signal"){if(a8e(t,e),hYt[t]===void 0)throw hYt[ERn(t)]!==void 0?new mYt(t+" (signals must use all capital letters)"):new mYt(t)}var KRn=wS((t,e="buffer")=>{if(!ARn(t))throw new gy(e,["Buffer","TypedArray","DataView"],t)});function GRn(t,e){let r=IRn(e),n=t.length;if(r==="hex"&&n%2!==0)throw new O5("encoding",e,`is invalid for data of length ${n}`)}function XRn(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&PRn(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new MRn(e,t,r);return t|0}var SYt=wS((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new gy(e,"AbortSignal",t)}),ZRn=wS((t,e)=>{if(typeof t!="function")throw new gy(e,"Function",t)}),YRn=wS((t,e)=>{if(typeof t!="function"||RRn(t))throw new gy(e,"Function",t)}),QRn=wS((t,e)=>{if(t!==void 0)throw new gy(e,"undefined",t)});function eAn(t,e,r){if(!yYt(r,t))throw new gy(e,`('${bYt(r,"|")}')`,t)}var tAn=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function gYt(t,e){if(typeof t>"u"||!_Yt(tAn,t))throw new O5(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function rAn(t){if(typeof t=="string")return gYt(t,"hints"),t;if(o8e(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];gYt(o,"hints"),r+=o,n!==e-1&&(r+=", ")}return r}throw new O5("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}CYt.exports={isInt32:NRn,isUint32:jRn,parseFileMode:LRn,validateArray:dSe,validateStringArray:VRn,validateBooleanArray:HRn,validateAbortSignalArray:JRn,validateBoolean:wYt,validateBuffer:KRn,validateDictionary:zRn,validateEncoding:GRn,validateFunction:ZRn,validateInt32:kRn,validateInteger:FRn,validateNumber:qRn,validateObject:BRn,validateOneOf:URn,validatePlainFunction:YRn,validatePort:XRn,validateSignalName:WRn,validateString:a8e,validateUint32:vYt,validateUndefined:QRn,validateUnion:eAn,validateAbortSignal:SYt,validateLinkHeaderValue:rAn}});var _F=S((ama,EYt)=>{var Vc=EYt.exports={},rT,nT;function s8e(){throw new Error("setTimeout has not been defined")}function u8e(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?rT=setTimeout:rT=s8e}catch{rT=s8e}try{typeof clearTimeout=="function"?nT=clearTimeout:nT=u8e}catch{nT=u8e}})();function xYt(t){if(rT===setTimeout)return setTimeout(t,0);if((rT===s8e||!rT)&&setTimeout)return rT=setTimeout,setTimeout(t,0);try{return rT(t,0)}catch{try{return rT.call(null,t,0)}catch{return rT.call(this,t,0)}}}function nAn(t){if(nT===clearTimeout)return clearTimeout(t);if((nT===u8e||!nT)&&clearTimeout)return nT=clearTimeout,clearTimeout(t);try{return nT(t)}catch{try{return nT.call(null,t)}catch{return nT.call(this,t)}}}var KN=[],E5=!1,j4,fSe=-1;function oAn(){!E5||!j4||(E5=!1,j4.length?KN=j4.concat(KN):fSe=-1,KN.length&&OYt())}function OYt(){if(!E5){var t=xYt(oAn);E5=!0;for(var e=KN.length;e;){for(j4=KN,KN=[];++fSe<e;)j4&&j4[fSe].run();fSe=-1,e=KN.length}j4=null,E5=!1,nAn(t)}}Vc.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];KN.push(new TYt(t,e)),KN.length===1&&!E5&&xYt(OYt)};function TYt(t,e){this.fun=t,this.array=e}TYt.prototype.run=function(){this.fun.apply(null,this.array)};Vc.title="browser";Vc.browser=!0;Vc.env={};Vc.argv=[];Vc.version="";Vc.versions={};function GN(){}Vc.on=GN;Vc.addListener=GN;Vc.once=GN;Vc.off=GN;Vc.removeListener=GN;Vc.removeAllListeners=GN;Vc.emit=GN;Vc.prependListener=GN;Vc.prependOnceListener=GN;Vc.listeners=function(t){return[]};Vc.binding=function(t){throw new Error("process.binding is not supported")};Vc.cwd=function(){return"/"};Vc.chdir=function(t){throw new Error("process.chdir is not supported")};Vc.umask=function(){return 0}});var iT=S((sma,BYt)=>{"use strict";var{SymbolAsyncIterator:PYt,SymbolIterator:MYt,SymbolFor:D4}=cc(),IYt=D4("nodejs.stream.destroyed"),RYt=D4("nodejs.stream.errored"),l8e=D4("nodejs.stream.readable"),c8e=D4("nodejs.stream.writable"),AYt=D4("nodejs.stream.disturbed"),iAn=D4("nodejs.webstream.isClosedPromise"),aAn=D4("nodejs.webstream.controllerErrorFunction");function pSe(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 mSe(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 sAn(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function oT(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function NYt(t){return!!(t&&!oT(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function jYt(t){return!!(t&&!oT(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function DYt(t){return!!(t&&!oT(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function uAn(t){return NYt(t)||jYt(t)||DYt(t)}function lAn(t,e){return t==null?!1:e===!0?typeof t[PYt]=="function":e===!1?typeof t[MYt]=="function":typeof t[PYt]=="function"||typeof t[MYt]=="function"}function hSe(t){if(!oT(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[IYt]||n!=null&&n.destroyed)}function $Yt(t){if(!mSe(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 cAn(t,e){if(!mSe(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 dAn(t){if(!pSe(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 LYt(t,e){if(!pSe(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 FYt(t){return t&&t[l8e]!=null?t[l8e]:typeof t?.readable!="boolean"?null:hSe(t)?!1:pSe(t)&&t.readable&&!LYt(t)}function kYt(t){return t&&t[c8e]!=null?t[c8e]:typeof t?.writable!="boolean"?null:hSe(t)?!1:mSe(t)&&t.writable&&!$Yt(t)}function fAn(t,e){return oT(t)?hSe(t)?!0:!(e?.readable!==!1&&FYt(t)||e?.writable!==!1&&kYt(t)):null}function pAn(t){var e,r;return oT(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 mAn(t){var e,r;return oT(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 hAn(t){if(!oT(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"&&qYt(t)?t._closed:null}function qYt(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function UYt(t){return typeof t._sent100=="boolean"&&qYt(t)}function gAn(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 yAn(t){if(!oT(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&UYt(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function bAn(t){var e;return!!(t&&((e=t[AYt])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function _An(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[RYt])!==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))}BYt.exports={isDestroyed:hSe,kIsDestroyed:IYt,isDisturbed:bAn,kIsDisturbed:AYt,isErrored:_An,kIsErrored:RYt,isReadable:FYt,kIsReadable:l8e,kIsClosedPromise:iAn,kControllerErrorFunction:aAn,kIsWritable:c8e,isClosed:hAn,isDuplexNodeStream:sAn,isFinished:fAn,isIterable:lAn,isReadableNodeStream:pSe,isReadableStream:NYt,isReadableEnded:dAn,isReadableFinished:LYt,isReadableErrored:mAn,isNodeStream:oT,isWebStream:uAn,isWritable:kYt,isWritableNodeStream:mSe,isWritableStream:jYt,isWritableEnded:$Yt,isWritableFinished:cAn,isWritableErrored:pAn,isServerRequest:gAn,isServerResponse:UYt,willEmitClose:yAn,isTransformStream:DYt}});var XN=S((uma,h8e)=>{var vF=_F(),{AbortError:ZYt,codes:vAn}=hb(),{ERR_INVALID_ARG_TYPE:wAn,ERR_STREAM_PREMATURE_CLOSE:zYt}=vAn,{kEmptyObject:f8e,once:p8e}=hy(),{validateAbortSignal:SAn,validateFunction:CAn,validateObject:xAn,validateBoolean:OAn}=T5(),{Promise:TAn,PromisePrototypeThen:EAn,SymbolDispose:YYt}=cc(),{isClosed:PAn,isReadable:VYt,isReadableNodeStream:d8e,isReadableStream:MAn,isReadableFinished:HYt,isReadableErrored:JYt,isWritable:WYt,isWritableNodeStream:KYt,isWritableStream:IAn,isWritableFinished:GYt,isWritableErrored:XYt,isNodeStream:RAn,willEmitClose:AAn,kIsClosedPromise:NAn}=iT(),P5;function jAn(t){return t.setHeader&&typeof t.abort=="function"}var m8e=()=>{};function QYt(t,e,r){var n,o;if(arguments.length===2?(r=e,e=f8e):e==null?e=f8e:xAn(e,"options"),CAn(r,"callback"),SAn(e.signal,"options.signal"),r=p8e(r),MAn(t)||IAn(t))return DAn(t,e,r);if(!RAn(t))throw new wAn("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:d8e(t),a=(o=e.writable)!==null&&o!==void 0?o:KYt(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=AAn(t)&&d8e(t)===i&&KYt(t)===a,d=GYt(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=HYt(t,!1),m=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},h=O=>{r.call(t,O)},y=PAn(t),g=()=>{y=!0;let O=XYt(t)||JYt(t);if(O&&typeof O!="boolean")return r.call(t,O);if(i&&!p&&d8e(t,!0)&&!HYt(t,!1))return r.call(t,new zYt);if(a&&!d&&!GYt(t,!1))return r.call(t,new zYt);r.call(t)},b=()=>{y=!0;let O=XYt(t)||JYt(t);if(O&&typeof O!="boolean")return r.call(t,O);r.call(t)},_=()=>{t.req.on("finish",f)};jAn(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?vF.nextTick(g):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||vF.nextTick(b):(!i&&(!c||VYt(t))&&(d||WYt(t)===!1)||!a&&(!c||WYt(t))&&(p||VYt(t)===!1)||u&&t.req&&t.aborted)&&vF.nextTick(b);let w=()=>{r=m8e,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 O=()=>{let T=r;w(),T.call(t,new ZYt(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)vF.nextTick(O);else{P5=P5||hy().addAbortListener;let T=P5(e.signal,O),P=r;r=p8e((...M)=>{T[YYt](),P.apply(t,M)})}}return w}function DAn(t,e,r){let n=!1,o=m8e;if(e.signal)if(o=()=>{n=!0,r.call(t,new ZYt(void 0,{cause:e.signal.reason}))},e.signal.aborted)vF.nextTick(o);else{P5=P5||hy().addAbortListener;let a=P5(e.signal,o),s=r;r=p8e((...u)=>{a[YYt](),s.apply(t,u)})}let i=(...a)=>{n||vF.nextTick(()=>r.apply(t,a))};return EAn(t[NAn].promise,i,i),m8e}function $An(t,e){var r;let n=!1;return e===null&&(e=f8e),(r=e)!==null&&r!==void 0&&r.cleanup&&(OAn(e.cleanup,"cleanup"),n=e.cleanup),new TAn((o,i)=>{let a=QYt(t,e,s=>{n&&a(),s?i(s):o()})})}h8e.exports=QYt;h8e.exports.finished=$An});var $4=S((lma,sQt)=>{"use strict";var aT=_F(),{aggregateTwoErrors:LAn,codes:{ERR_MULTIPLE_CALLBACK:FAn},AbortError:kAn}=hb(),{Symbol:rQt}=cc(),{kIsDestroyed:qAn,isDestroyed:UAn,isFinished:BAn,isServerRequest:zAn}=iT(),nQt=rQt("kDestroy"),g8e=rQt("kConstruct");function oQt(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function VAn(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):(oQt(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?eQt(this,t,e):this.once(nQt,function(i){eQt(this,LAn(i,t),e)}),this)}function eQt(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;oQt(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?aT.nextTick(HAn,t,i):aT.nextTick(iQt,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function HAn(t,e){y8e(t,e),iQt(t)}function iQt(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 y8e(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 JAn(){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 b8e(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?aT.nextTick(y8e,t,e):y8e(t,e))}function WAn(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(g8e,e),!(t.listenerCount(g8e)>1)&&aT.nextTick(KAn,t)}function KAn(t){let e=!1;function r(n){if(e){b8e(t,n??new FAn);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(nQt,n):n?b8e(t,n,!0):aT.nextTick(GAn,t)}try{t._construct(n=>{aT.nextTick(r,n)})}catch(n){aT.nextTick(r,n)}}function GAn(t){t.emit(g8e)}function tQt(t){return t?.setHeader&&typeof t.abort=="function"}function aQt(t){t.emit("close")}function XAn(t,e){t.emit("error",e),aT.nextTick(aQt,t)}function ZAn(t,e){!t||UAn(t)||(!e&&!BAn(t)&&(e=new kAn),zAn(t)?(t.socket=null,t.destroy(e)):tQt(t)?t.abort():tQt(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?aT.nextTick(XAn,t,e):aT.nextTick(aQt,t),t.destroyed||(t[qAn]=!0))}sQt.exports={construct:WAn,destroyer:ZAn,destroy:VAn,undestroy:JAn,errorOrDestroy:b8e}});var bSe=S((cma,lQt)=>{"use strict";var{ArrayIsArray:YAn,ObjectSetPrototypeOf:uQt}=cc(),{EventEmitter:gSe}=Ure();function ySe(t){gSe.call(this,t)}uQt(ySe.prototype,gSe.prototype);uQt(ySe,gSe);ySe.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(),gSe.listenerCount(this,"error")===0&&this.emit("error",c)}_8e(r,"error",u),_8e(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 _8e(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):YAn(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}lQt.exports={Stream:ySe,prependListener:_8e}});var Bre=S((dma,_Se)=>{"use strict";var{SymbolDispose:QAn}=cc(),{AbortError:cQt,codes:eNn}=hb(),{isNodeStream:dQt,isWebStream:tNn,kControllerErrorFunction:rNn}=iT(),nNn=XN(),{ERR_INVALID_ARG_TYPE:fQt}=eNn,v8e,oNn=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new fQt(e,"AbortSignal",t)};_Se.exports.addAbortSignal=function(e,r){if(oNn(e,"signal"),!dQt(r)&&!tNn(r))throw new fQt("stream",["ReadableStream","WritableStream","Stream"],r);return _Se.exports.addAbortSignalNoValidate(e,r)};_Se.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=dQt(e)?()=>{e.destroy(new cQt(void 0,{cause:t.reason}))}:()=>{e[rNn](new cQt(void 0,{cause:t.reason}))};if(t.aborted)r();else{v8e=v8e||hy().addAbortListener;let n=v8e(t,r);nNn(e,n[QAn])}return e}});var hQt=S((pma,mQt)=>{"use strict";var{StringPrototypeSlice:pQt,SymbolIterator:iNn,TypedArrayPrototypeSet:vSe,Uint8Array:aNn}=cc(),{Buffer:w8e}=Qw(),{inspect:sNn}=hy();mQt.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 w8e.alloc(0);let r=w8e.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)vSe(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}*[iNn](){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+=pQt(i,0,e),this.head=n,n.data=pQt(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=w8e.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)vSe(r,a,n-e),e-=a.length;else{e===a.length?(vSe(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(vSe(r,new aNn(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 sNn(this,{...r,depth:0,customInspect:!1})}}});var zre=S((mma,_Qt)=>{"use strict";var{MathFloor:uNn,NumberIsInteger:lNn}=cc(),{validateInteger:cNn}=T5(),{ERR_INVALID_ARG_VALUE:dNn}=hb().codes,gQt=16*1024,yQt=16;function fNn(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function bQt(t){return t?yQt:gQt}function pNn(t,e){cNn(e,"value",0),t?yQt=e:gQt=e}function mNn(t,e,r,n){let o=fNn(e,n,r);if(o!=null){if(!lNn(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new dNn(i,o)}return uNn(o)}return bQt(t.objectMode)}_Qt.exports={getHighWaterMark:mNn,getDefaultHighWaterMark:bQt,setDefaultHighWaterMark:pNn}});var SQt=S((S8e,wQt)=>{var wSe=Qw(),sT=wSe.Buffer;function vQt(t,e){for(var r in t)e[r]=t[r]}sT.from&&sT.alloc&&sT.allocUnsafe&&sT.allocUnsafeSlow?wQt.exports=wSe:(vQt(wSe,S8e),S8e.Buffer=L4);function L4(t,e,r){return sT(t,e,r)}L4.prototype=Object.create(sT.prototype);vQt(sT,L4);L4.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return sT(t,e,r)};L4.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=sT(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};L4.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return sT(t)};L4.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return wSe.SlowBuffer(t)}});var OQt=S(xQt=>{"use strict";var x8e=SQt().Buffer,CQt=x8e.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 hNn(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 gNn(t){var e=hNn(t);if(typeof e!="string"&&(x8e.isEncoding===CQt||!CQt(t)))throw new Error("Unknown encoding: "+t);return e||t}xQt.StringDecoder=Vre;function Vre(t){this.encoding=gNn(t);var e;switch(this.encoding){case"utf16le":this.text=SNn,this.end=CNn,e=4;break;case"utf8":this.fillLast=_Nn,e=4;break;case"base64":this.text=xNn,this.end=ONn,e=3;break;default:this.write=TNn,this.end=ENn;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=x8e.allocUnsafe(e)}Vre.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||""};Vre.prototype.end=wNn;Vre.prototype.text=vNn;Vre.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 C8e(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function yNn(t,e,r){var n=e.length-1;if(n<r)return 0;var o=C8e(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=C8e(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=C8e(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function bNn(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 _Nn(t){var e=this.lastTotal-this.lastNeed,r=bNn(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 vNn(t,e){var r=yNn(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 wNn(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function SNn(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 CNn(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 xNn(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 ONn(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function TNn(t){return t.toString(this.encoding)}function ENn(t){return t&&t.length?this.write(t):""}});var O8e=S((gma,MQt)=>{"use strict";var TQt=_F(),{PromisePrototypeThen:PNn,SymbolAsyncIterator:EQt,SymbolIterator:PQt}=cc(),{Buffer:MNn}=Qw(),{ERR_INVALID_ARG_TYPE:INn,ERR_STREAM_NULL_VALUES:RNn}=hb().codes;function ANn(t,e,r){let n;if(typeof e=="string"||e instanceof MNn)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[EQt])o=!0,n=e[EQt]();else if(e&&e[PQt])o=!1,n=e[PQt]();else throw new INn("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){PNn(s(l),()=>TQt.nextTick(c,l),d=>TQt.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 RNn;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}MQt.exports=ANn});var Jre=S((yma,WQt)=>{var _C=_F(),{ArrayPrototypeIndexOf:NNn,NumberIsInteger:jNn,NumberIsNaN:DNn,NumberParseInt:$Nn,ObjectDefineProperties:N8e,ObjectKeys:LNn,ObjectSetPrototypeOf:AQt,Promise:NQt,SafeSet:FNn,SymbolAsyncDispose:kNn,SymbolAsyncIterator:qNn,Symbol:UNn}=cc();WQt.exports=ci;ci.ReadableState=OSe;var{EventEmitter:BNn}=Ure(),{Stream:wF,prependListener:zNn}=bSe(),{Buffer:T8e}=Qw(),{addAbortSignal:VNn}=Bre(),jQt=XN(),$i=hy().debuglog("stream",t=>{$i=t}),HNn=hQt(),R5=$4(),{getHighWaterMark:JNn,getDefaultHighWaterMark:WNn}=zre(),{aggregateTwoErrors:IQt,codes:{ERR_INVALID_ARG_TYPE:KNn,ERR_METHOD_NOT_IMPLEMENTED:GNn,ERR_OUT_OF_RANGE:XNn,ERR_STREAM_PUSH_AFTER_EOF:ZNn,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:YNn},AbortError:QNn}=hb(),{validateObject:e1n}=T5(),F4=UNn("kPaused"),{StringDecoder:DQt}=OQt(),t1n=O8e();AQt(ci.prototype,wF.prototype);AQt(ci,wF);var E8e=()=>{},{errorOrDestroy:M5}=R5,I5=1,r1n=2,$Qt=4,Hre=8,LQt=16,SSe=32,CSe=64,FQt=128,n1n=256,o1n=512,i1n=1024,R8e=2048,A8e=4096,a1n=8192,s1n=16384,u1n=32768,kQt=65536,l1n=1<<17,c1n=1<<18;function wm(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}N8e(OSe.prototype,{objectMode:wm(I5),ended:wm(r1n),endEmitted:wm($Qt),reading:wm(Hre),constructed:wm(LQt),sync:wm(SSe),needReadable:wm(CSe),emittedReadable:wm(FQt),readableListening:wm(n1n),resumeScheduled:wm(o1n),errorEmitted:wm(i1n),emitClose:wm(R8e),autoDestroy:wm(A8e),destroyed:wm(a1n),closed:wm(s1n),closeEmitted:wm(u1n),multiAwaitDrain:wm(kQt),readingMore:wm(l1n),dataEmitted:wm(c1n)});function OSe(t,e,r){typeof r!="boolean"&&(r=e instanceof uT()),this.state=R8e|A8e|LQt|SSe,t&&t.objectMode&&(this.state|=I5),r&&t&&t.readableObjectMode&&(this.state|=I5),this.highWaterMark=t?JNn(this,t,"readableHighWaterMark",r):WNn(!1),this.buffer=new HNn,this.length=0,this.pipes=[],this.flowing=null,this[F4]=null,t&&t.emitClose===!1&&(this.state&=~R8e),t&&t.autoDestroy===!1&&(this.state&=~A8e),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new DQt(t.encoding),this.encoding=t.encoding)}function ci(t){if(!(this instanceof ci))return new ci(t);let e=this instanceof uT();this._readableState=new OSe(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&&VNn(t.signal,this)),wF.call(this,t),R5.construct(this,()=>{this._readableState.needReadable&&xSe(this,this._readableState)})}ci.prototype.destroy=R5.destroy;ci.prototype._undestroy=R5.undestroy;ci.prototype._destroy=function(t,e){e(t)};ci.prototype[BNn.captureRejectionSymbol]=function(t){this.destroy(t)};ci.prototype[kNn]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new QNn,this.destroy(t)),new NQt((e,r)=>jQt(this,n=>n&&n!==t?r(n):e(null)))};ci.prototype.push=function(t,e){return qQt(this,t,e,!1)};ci.prototype.unshift=function(t,e){return qQt(this,t,e,!0)};function qQt(t,e,r,n){$i("readableAddChunk",e);let o=t._readableState,i;if((o.state&I5)===0&&(typeof e=="string"?(r=r||o.defaultEncoding,o.encoding!==r&&(n&&o.encoding?e=T8e.from(e,r).toString(o.encoding):(e=T8e.from(e,r),r=""))):e instanceof T8e?r="":wF._isUint8Array(e)?(e=wF._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new KNn("chunk",["string","Buffer","Uint8Array"],e))),i)M5(t,i);else if(e===null)o.state&=~Hre,p1n(t,o);else if((o.state&I5)!==0||e&&e.length>0)if(n)if((o.state&$Qt)!==0)M5(t,new YNn);else{if(o.destroyed||o.errored)return!1;P8e(t,o,e,!0)}else if(o.ended)M5(t,new ZNn);else{if(o.destroyed||o.errored)return!1;o.state&=~Hre,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?P8e(t,o,e,!1):xSe(t,o)):P8e(t,o,e,!1)}else n||(o.state&=~Hre,xSe(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function P8e(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&kQt)!==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&CSe)!==0&&TSe(t)),xSe(t,e)}ci.prototype.isPaused=function(){let t=this._readableState;return t[F4]===!0||t.flowing===!1};ci.prototype.setEncoding=function(t){let e=new DQt(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 d1n=1073741824;function f1n(t){if(t>d1n)throw new XNn("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function RQt(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&I5)!==0?1:DNn(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}ci.prototype.read=function(t){$i("read",t),t===void 0?t=NaN:jNn(t)||(t=$Nn(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=f1n(t)),t!==0&&(e.state&=~FQt),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return $i("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?M8e(this):TSe(this),null;if(t=RQt(t,e),t===0&&e.ended)return e.length===0&&M8e(this),null;let n=(e.state&CSe)!==0;if($i("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,$i("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,$i("reading, ended or constructing",n);else if(n){$i("do read"),e.state|=Hre|SSe,e.length===0&&(e.state|=CSe);try{this._read(e.highWaterMark)}catch(i){M5(this,i)}e.state&=~SSe,e.reading||(t=RQt(r,e))}let o;return t>0?o=HQt(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&&M8e(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function p1n(t,e){if($i("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?TSe(t):(e.needReadable=!1,e.emittedReadable=!0,UQt(t))}}function TSe(t){let e=t._readableState;$i("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||($i("emitReadable",e.flowing),e.emittedReadable=!0,_C.nextTick(UQt,t))}function UQt(t){let e=t._readableState;$i("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,zQt(t)}function xSe(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,_C.nextTick(m1n,t,e))}function m1n(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if($i("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}ci.prototype._read=function(t){throw new GNn("_read()")};ci.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new FNn(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),$i("pipe count=%d opts=%j",n.pipes.length,e);let i=(!e||e.end!==!1)&&t!==_C.stdout&&t!==_C.stderr?s:y;n.endEmitted?_C.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(g,b){$i("onunpipe"),g===r&&b&&b.hasUnpiped===!1&&(b.hasUnpiped=!0,c())}function s(){$i("onend"),t.end()}let u,l=!1;function c(){$i("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?($i("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&($i("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=h1n(r,t),t.on("drain",u))}r.on("data",f);function f(g){$i("ondata");let b=t.write(g);$i("dest.write",b),b===!1&&d()}function p(g){if($i("onerror",g),y(),t.removeListener("error",p),t.listenerCount("error")===0){let b=t._writableState||t._readableState;b&&!b.errorEmitted?M5(t,g):t.emit("error",g)}}zNn(t,"error",p);function m(){t.removeListener("finish",h),y()}t.once("close",m);function h(){$i("onfinish"),t.removeListener("close",m),y()}t.once("finish",h);function y(){$i("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||($i("pipe resume"),r.resume()),t};function h1n(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?($i("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&($i("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}ci.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=NNn(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};ci.prototype.on=function(t,e){let r=wF.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,$i("on readable",n.length,n.reading),n.length?TSe(this):n.reading||_C.nextTick(g1n,this)),r};ci.prototype.addListener=ci.prototype.on;ci.prototype.removeListener=function(t,e){let r=wF.prototype.removeListener.call(this,t,e);return t==="readable"&&_C.nextTick(BQt,this),r};ci.prototype.off=ci.prototype.removeListener;ci.prototype.removeAllListeners=function(t){let e=wF.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&_C.nextTick(BQt,this),e};function BQt(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[F4]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function g1n(t){$i("readable nexttick read 0"),t.read(0)}ci.prototype.resume=function(){let t=this._readableState;return t.flowing||($i("resume"),t.flowing=!t.readableListening,y1n(this,t)),t[F4]=!1,this};function y1n(t,e){e.resumeScheduled||(e.resumeScheduled=!0,_C.nextTick(b1n,t,e))}function b1n(t,e){$i("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),zQt(t),e.flowing&&!e.reading&&t.read(0)}ci.prototype.pause=function(){return $i("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&($i("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[F4]=!0,this};function zQt(t){let e=t._readableState;for($i("flow",e.flowing);e.flowing&&t.read()!==null;);}ci.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=>{M5(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=LNn(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};ci.prototype[qNn]=function(){return VQt(this)};ci.prototype.iterator=function(t){return t!==void 0&&e1n(t,"options"),VQt(this,t)};function VQt(t,e){typeof t.read!="function"&&(t=ci.wrap(t,{objectMode:!0}));let r=_1n(t,e);return r.stream=t,r}async function*_1n(t,e){let r=E8e;function n(a){this===t?(r(),r=E8e):r=a}t.on("readable",n);let o,i=jQt(t,{writable:!1},a=>{o=a?IQt(o,a):null,r(),r=E8e});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 NQt(n)}}}catch(a){throw o=IQt(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?R5.destroyer(t,null):(t.off("readable",n),i())}}N8e(ci.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}}});N8e(OSe.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[F4]!==!1},set(t){this[F4]=!!t}}});ci._fromList=HQt;function HQt(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 M8e(t){let e=t._readableState;$i("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,_C.nextTick(v1n,e,t))}function v1n(t,e){if($i("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)_C.nextTick(w1n,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function w1n(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}ci.from=function(t,e){return t1n(ci,t,e)};var I8e;function JQt(){return I8e===void 0&&(I8e={}),I8e}ci.fromWeb=function(t,e){return JQt().newStreamReadableFromReadableStream(t,e)};ci.toWeb=function(t,e){return JQt().newReadableStreamFromStreamReadable(t,e)};ci.wrap=function(t,e){var r,n;return new ci({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){R5.destroyer(t,o),i(o)}}).wrap(t)}});var RSe=S((bma,ier)=>{var k4=_F(),{ArrayPrototypeSlice:XQt,Error:S1n,FunctionPrototypeSymbolHasInstance:ZQt,ObjectDefineProperty:YQt,ObjectDefineProperties:C1n,ObjectSetPrototypeOf:QQt,StringPrototypeToLowerCase:x1n,Symbol:O1n,SymbolHasInstance:T1n}=cc();ier.exports=dc;dc.WritableState=Gre;var{EventEmitter:E1n}=Ure(),Wre=bSe().Stream,{Buffer:ESe}=Qw(),ISe=$4(),{addAbortSignal:P1n}=Bre(),{getHighWaterMark:M1n,getDefaultHighWaterMark:I1n}=zre(),{ERR_INVALID_ARG_TYPE:R1n,ERR_METHOD_NOT_IMPLEMENTED:A1n,ERR_MULTIPLE_CALLBACK:eer,ERR_STREAM_CANNOT_PIPE:N1n,ERR_STREAM_DESTROYED:Kre,ERR_STREAM_ALREADY_FINISHED:j1n,ERR_STREAM_NULL_VALUES:D1n,ERR_STREAM_WRITE_AFTER_END:$1n,ERR_UNKNOWN_ENCODING:ter}=hb().codes,{errorOrDestroy:A5}=ISe;QQt(dc.prototype,Wre.prototype);QQt(dc,Wre);function $8e(){}var N5=O1n("kOnFinished");function Gre(t,e,r){typeof r!="boolean"&&(r=e instanceof uT()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?M1n(this,t,"writableHighWaterMark",r):I1n(!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=F1n.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,MSe(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[N5]=[]}function MSe(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Gre.prototype.getBuffer=function(){return XQt(this.buffered,this.bufferedIndex)};YQt(Gre.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function dc(t){let e=this instanceof uT();if(!e&&!ZQt(dc,this))return new dc(t);this._writableState=new Gre(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&&P1n(t.signal,this)),Wre.call(this,t),ISe.construct(this,()=>{let r=this._writableState;r.writing||F8e(this,r),k8e(this,r)})}YQt(dc,T1n,{__proto__:null,value:function(t){return ZQt(this,t)?!0:this!==dc?!1:t&&t._writableState instanceof Gre}});dc.prototype.pipe=function(){A5(this,new N1n)};function rer(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"&&!ESe.isEncoding(r))throw new ter(r);typeof n!="function"&&(n=$8e)}if(e===null)throw new D1n;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=ESe.from(e,r),r="buffer");else if(e instanceof ESe)r="buffer";else if(Wre._isUint8Array(e))e=Wre._uint8ArrayToBuffer(e),r="buffer";else throw new R1n("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new $1n:o.destroyed&&(i=new Kre("write")),i?(k4.nextTick(n,i),A5(t,i,!0),i):(o.pendingcb++,L1n(t,o,e,r,n))}dc.prototype.write=function(t,e,r){return rer(this,t,e,r)===!0};dc.prototype.cork=function(){this._writableState.corked++};dc.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||F8e(this,t))};dc.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=x1n(e)),!ESe.isEncoding(e))throw new ter(e);return this._writableState.defaultEncoding=e,this};function L1n(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!==$8e&&(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 KQt(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Kre("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function GQt(t,e,r,n){--e.pendingcb,n(r),L8e(e),A5(t,r)}function F1n(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){A5(t,new eer);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?k4.nextTick(GQt,t,r,e,o):GQt(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&F8e(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},k4.nextTick(k1n,r.afterWriteTickInfo)):ner(t,r,1,o))}function k1n({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,ner(t,e,r,n)}function ner(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&&L8e(e),k8e(t,e)}function L8e(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 Kre("write"))}let r=t[N5].splice(0);for(let o=0;o<r.length;o++){var n;r[o]((n=t.errored)!==null&&n!==void 0?n:new Kre("end"))}MSe(t)}function F8e(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?$8e:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:XQt(r,a);u.allBuffers=e.allBuffers,KQt(t,e,!0,e.length,u,"",s),MSe(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;KQt(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?MSe(e):a>256?(r.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}dc.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new A1n("_write()")};dc.prototype._writev=null;dc.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=rer(this,t,e);i instanceof S1n&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,k8e(this,n,!0),n.ended=!0):n.finished?o=new j1n("end"):n.destroyed&&(o=new Kre("end"))),typeof r=="function"&&(o||n.finished?k4.nextTick(r,o):n[N5].push(r)),this};function PSe(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 q1n(t,e){let r=!1;function n(o){if(r){A5(t,o??eer());return}if(r=!0,e.pendingcb--,o){let i=e[N5].splice(0);for(let a=0;a<i.length;a++)i[a](o);A5(t,o,e.sync)}else PSe(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,k4.nextTick(D8e,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function U1n(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,q1n(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function k8e(t,e,r){PSe(e)&&(U1n(t,e),e.pendingcb===0&&(r?(e.pendingcb++,k4.nextTick((n,o)=>{PSe(o)?D8e(n,o):o.pendingcb--},t,e)):PSe(e)&&(e.pendingcb++,D8e(t,e))))}function D8e(t,e){e.pendingcb--,e.finished=!0;let r=e[N5].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()}}C1n(dc.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 B1n=ISe.destroy;dc.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[N5].length)&&k4.nextTick(L8e,r),B1n.call(this,t,e),this};dc.prototype._undestroy=ISe.undestroy;dc.prototype._destroy=function(t,e){e(t)};dc.prototype[E1n.captureRejectionSymbol]=function(t){this.destroy(t)};var j8e;function oer(){return j8e===void 0&&(j8e={}),j8e}dc.fromWeb=function(t,e){return oer().newStreamWritableFromWritableStream(t,e)};dc.toWeb=function(t){return oer().newWritableStreamFromStreamWritable(t)}});var ver=S((_ma,_er)=>{var q8e=_F(),z1n=Qw(),{isReadable:V1n,isWritable:H1n,isIterable:aer,isNodeStream:J1n,isReadableNodeStream:ser,isWritableNodeStream:uer,isDuplexNodeStream:W1n,isReadableStream:ler,isWritableStream:cer}=iT(),der=XN(),{AbortError:yer,codes:{ERR_INVALID_ARG_TYPE:K1n,ERR_INVALID_RETURN_VALUE:fer}}=hb(),{destroyer:D5}=$4(),G1n=uT(),ber=Jre(),X1n=RSe(),{createDeferredPromise:per}=hy(),mer=O8e(),her=globalThis.Blob||z1n.Blob,Z1n=typeof her<"u"?function(e){return e instanceof her}:function(e){return!1},Y1n=globalThis.AbortController||C5().AbortController,{FunctionPrototypeCall:ger}=cc(),SF=class extends G1n{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)}};_er.exports=function t(e,r){if(W1n(e))return e;if(ser(e))return j5({readable:e});if(uer(e))return j5({writable:e});if(J1n(e))return j5({writable:!1,readable:!1});if(ler(e))return j5({readable:ber.fromWeb(e)});if(cer(e))return j5({writable:X1n.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=Q1n(e);if(aer(o))return mer(SF,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=ger(u,o,d=>{if(d!=null)throw new fer("nully","body",d)},d=>{D5(l,d)});return l=new SF({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,q8e.nextTick(d,null)}catch(f){q8e.nextTick(d,f)}})},destroy:s})}throw new fer("Iterable, AsyncIterable or AsyncFunction",r,o)}if(Z1n(e))return t(e.arrayBuffer());if(aer(e))return mer(SF,e,{objectMode:!0,writable:!1});if(ler(e?.readable)&&cer(e?.writable))return SF.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?ser(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?uer(e?.writable)?e?.writable:t(e.writable):void 0;return j5({readable:o,writable:i})}let n=e?.then;if(typeof n=="function"){let o;return ger(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{D5(o,i)}),o=new SF({objectMode:!0,writable:!1,read(){}})}throw new K1n(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function Q1n(t){let{promise:e,resolve:r}=per(),n=new Y1n,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(q8e.nextTick(l),u)return;if(o.aborted)throw new yer(void 0,{cause:o.reason});({promise:e,resolve:r}=per()),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 j5(t){let e=t.readable&&typeof t.readable.read!="function"?ber.wrap(t.readable):t.readable,r=t.writable,n=!!V1n(e),o=!!H1n(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new SF({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(der(r,d=>{o=!1,d&&D5(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&&(der(e,d=>{n=!1,d&&D5(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 yer),s=null,i=null,a=null,u===null?f(d):(u=f,D5(r,d),D5(e,d))},l}});var uT=S((vma,Cer)=>{"use strict";var{ObjectDefineProperties:ejn,ObjectGetOwnPropertyDescriptor:ZN,ObjectKeys:tjn,ObjectSetPrototypeOf:wer}=cc();Cer.exports=vC;var z8e=Jre(),SS=RSe();wer(vC.prototype,z8e.prototype);wer(vC,z8e);{let t=tjn(SS.prototype);for(let e=0;e<t.length;e++){let r=t[e];vC.prototype[r]||(vC.prototype[r]=SS.prototype[r])}}function vC(t){if(!(this instanceof vC))return new vC(t);z8e.call(this,t),SS.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}ejn(vC.prototype,{writable:{__proto__:null,...ZN(SS.prototype,"writable")},writableHighWaterMark:{__proto__:null,...ZN(SS.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...ZN(SS.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...ZN(SS.prototype,"writableBuffer")},writableLength:{__proto__:null,...ZN(SS.prototype,"writableLength")},writableFinished:{__proto__:null,...ZN(SS.prototype,"writableFinished")},writableCorked:{__proto__:null,...ZN(SS.prototype,"writableCorked")},writableEnded:{__proto__:null,...ZN(SS.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...ZN(SS.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 U8e;function Ser(){return U8e===void 0&&(U8e={}),U8e}vC.fromWeb=function(t,e){return Ser().newStreamDuplexFromReadableWritablePair(t,e)};vC.toWeb=function(t){return Ser().newReadableWritablePairFromDuplex(t)};var B8e;vC.from=function(t){return B8e||(B8e=ver()),B8e(t,"body")}});var J8e=S((wma,Oer)=>{"use strict";var{ObjectSetPrototypeOf:xer,Symbol:rjn}=cc();Oer.exports=YN;var{ERR_METHOD_NOT_IMPLEMENTED:njn}=hb().codes,H8e=uT(),{getHighWaterMark:ojn}=zre();xer(YN.prototype,H8e.prototype);xer(YN,H8e);var Xre=rjn("kCallback");function YN(t){if(!(this instanceof YN))return new YN(t);let e=t?ojn(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),H8e.call(this,t),this._readableState.sync=!1,this[Xre]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",ijn)}function V8e(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 ijn(){this._final!==V8e&&V8e.call(this)}YN.prototype._final=V8e;YN.prototype._transform=function(t,e,r){throw new njn("_transform()")};YN.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[Xre]=r})};YN.prototype._read=function(){if(this[Xre]){let t=this[Xre];this[Xre]=null,t()}}});var K8e=S((Sma,Eer)=>{"use strict";var{ObjectSetPrototypeOf:Ter}=cc();Eer.exports=$5;var W8e=J8e();Ter($5.prototype,W8e.prototype);Ter($5,W8e);function $5(t){if(!(this instanceof $5))return new $5(t);W8e.call(this,t)}$5.prototype._transform=function(t,e,r){r(null,t)}});var DSe=S((Cma,Aer)=>{var Zre=_F(),{ArrayIsArray:ajn,Promise:sjn,SymbolAsyncIterator:ujn,SymbolDispose:ljn}=cc(),jSe=XN(),{once:cjn}=hy(),djn=$4(),Per=uT(),{aggregateTwoErrors:fjn,codes:{ERR_INVALID_ARG_TYPE:nGe,ERR_INVALID_RETURN_VALUE:G8e,ERR_MISSING_ARGS:pjn,ERR_STREAM_DESTROYED:mjn,ERR_STREAM_PREMATURE_CLOSE:hjn},AbortError:gjn}=hb(),{validateFunction:yjn,validateAbortSignal:bjn}=T5(),{isIterable:q4,isReadable:X8e,isReadableNodeStream:NSe,isNodeStream:Mer,isTransformStream:L5,isWebStream:_jn,isReadableStream:Z8e,isReadableFinished:vjn}=iT(),wjn=globalThis.AbortController||C5().AbortController,Y8e,Q8e,eGe;function Ier(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=jSe(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,djn.destroyer(t,i||new mjn("pipe")))},cleanup:o}}function Sjn(t){return yjn(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function tGe(t){if(q4(t))return t;if(NSe(t))return Cjn(t);throw new nGe("val",["Readable","Iterable","AsyncIterable"],t)}async function*Cjn(t){Q8e||(Q8e=Jre()),yield*Q8e.prototype[ujn].call(t)}async function ASe(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new sjn((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=jSe(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?fjn(o,l):l)}finally{u(),e.off("drain",a)}}async function rGe(t,e,r,{end:n}){L5(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 xjn(...t){return Rer(t,cjn(Sjn(t)))}function Rer(t,e,r){if(t.length===1&&ajn(t[0])&&(t=t[0]),t.length<2)throw new pjn("streams");let n=new wjn,o=n.signal,i=r?.signal,a=[];bjn(i,"options.signal");function s(){m(new gjn)}eGe=eGe||hy().addAbortListener;let u;i&&(u=eGe(i,s));let l,c,d=[],f=0;function p(_){m(_,--f===0)}function m(_,w){var O;if(_&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=_),!(!l&&!w)){for(;d.length;)d.shift()(l);(O=u)===null||O===void 0||O[ljn](),n.abort(),w&&(l||a.forEach(T=>T()),Zre.nextTick(e,l,c))}}let h;for(let _=0;_<t.length;_++){let w=t[_],O=_<t.length-1,T=_>0,P=O||r?.end!==!1,M=_===t.length-1;if(Mer(w)){let I=function(j){j&&j.name!=="AbortError"&&j.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(j)};var b=I;if(P){let{destroy:j,cleanup:A}=Ier(w,O,T);d.push(j),X8e(w)&&M&&a.push(A)}w.on("error",I),X8e(w)&&M&&a.push(()=>{w.removeListener("error",I)})}if(_===0)if(typeof w=="function"){if(h=w({signal:o}),!q4(h))throw new G8e("Iterable, AsyncIterable or Stream","source",h)}else q4(w)||NSe(w)||L5(w)?h=w:h=Per.from(w);else if(typeof w=="function"){if(L5(h)){var y;h=tGe((y=h)===null||y===void 0?void 0:y.readable)}else h=tGe(h);if(h=w(h,{signal:o}),O){if(!q4(h,!0))throw new G8e("AsyncIterable",`transform[${_-1}]`,h)}else{var g;Y8e||(Y8e=K8e());let I=new Y8e({objectMode:!0}),j=(g=h)===null||g===void 0?void 0:g.then;if(typeof j=="function")f++,j.call(h,V=>{c=V,V!=null&&I.write(V),P&&I.end(),Zre.nextTick(p)},V=>{I.destroy(V),Zre.nextTick(p,V)});else if(q4(h,!0))f++,ASe(h,I,p,{end:P});else if(Z8e(h)||L5(h)){let V=h.readable||h;f++,ASe(V,I,p,{end:P})}else throw new G8e("AsyncIterable or Promise","destination",h);h=I;let{destroy:A,cleanup:k}=Ier(h,!1,!0);d.push(A),M&&a.push(k)}}else if(Mer(w)){if(NSe(h)){f+=2;let I=Ojn(h,w,p,{end:P});X8e(w)&&M&&a.push(I)}else if(L5(h)||Z8e(h)){let I=h.readable||h;f++,ASe(I,w,p,{end:P})}else if(q4(h))f++,ASe(h,w,p,{end:P});else throw new nGe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=w}else if(_jn(w)){if(NSe(h))f++,rGe(tGe(h),w,p,{end:P});else if(Z8e(h)||q4(h))f++,rGe(h,w,p,{end:P});else if(L5(h))f++,rGe(h.readable,w,p,{end:P});else throw new nGe("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=w}else h=Per.from(w)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&Zre.nextTick(s),h}function Ojn(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new hjn)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;vjn(t)?Zre.nextTick(a):t.once("end",a)}else r();return jSe(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)}),jSe(e,{readable:!1,writable:!0},r)}Aer.exports={pipelineImpl:Rer,pipeline:xjn}});var iGe=S((xma,Fer)=>{"use strict";var{pipeline:Tjn}=DSe(),$Se=uT(),{destroyer:Ejn}=$4(),{isNodeStream:LSe,isReadable:Ner,isWritable:jer,isWebStream:oGe,isTransformStream:U4,isWritableStream:Der,isReadableStream:$er}=iT(),{AbortError:Pjn,codes:{ERR_INVALID_ARG_VALUE:Ler,ERR_MISSING_ARGS:Mjn}}=hb(),Ijn=XN();Fer.exports=function(...e){if(e.length===0)throw new Mjn("streams");if(e.length===1)return $Se.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=$Se.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=$Se.from(e[p])}for(let p=0;p<e.length;++p)if(!(!LSe(e[p])&&!oGe(e[p]))){if(p<e.length-1&&!(Ner(e[p])||$er(e[p])||U4(e[p])))throw new Ler(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(jer(e[p])||Der(e[p])||U4(e[p])))throw new Ler(`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=Tjn(e,u),d=!!(jer(l)||Der(l)||U4(l)),f=!!(Ner(c)||$er(c)||U4(c));if(s=new $Se({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(LSe(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(oGe(l)){let h=(U4(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=U4(c)?c.readable:c;Ijn(p,()=>{if(o){let m=o;o=null,m()}})}if(f){if(LSe(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(oGe(c)){let m=(U4(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 Pjn),i=null,n=null,o=null,a===null?m(p):(a=m,LSe(c)&&Ejn(c,p))},s}});var Ker=S((Oma,uGe)=>{"use strict";var Rjn=globalThis.AbortController||C5().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Ajn,ERR_INVALID_ARG_TYPE:Yre,ERR_MISSING_ARGS:Njn,ERR_OUT_OF_RANGE:jjn},AbortError:lT}=hb(),{validateAbortSignal:B4,validateInteger:ker,validateObject:z4}=T5(),Djn=cc().Symbol("kWeak"),$jn=cc().Symbol("kResistStopPropagation"),{finished:Ljn}=XN(),Fjn=iGe(),{addAbortSignalNoValidate:kjn}=Bre(),{isWritable:qjn,isNodeStream:Ujn}=iT(),{deprecate:Bjn}=hy(),{ArrayPrototypePush:zjn,Boolean:Vjn,MathFloor:qer,Number:Hjn,NumberIsNaN:Jjn,Promise:Uer,PromiseReject:Ber,PromiseResolve:Wjn,PromisePrototypeThen:zer,Symbol:Her}=cc(),FSe=Her("kEmpty"),Ver=Her("kEof");function Kjn(t,e){if(e!=null&&z4(e,"options"),e?.signal!=null&&B4(e.signal,"options.signal"),Ujn(t)&&!qjn(t))throw new Ajn("stream",t,"must be writable");let r=Fjn(this,t);return e!=null&&e.signal&&kjn(e.signal,r),r}function kSe(t,e){if(typeof t!="function")throw new Yre("fn",["Function","AsyncFunction"],t);e!=null&&z4(e,"options"),e?.signal!=null&&B4(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=qer(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=qer(e.highWaterMark)),ker(r,"options.concurrency",1),ker(n,"options.highWaterMark",0),n+=r,async function*(){let i=hy().AbortSignalAny([e?.signal].filter(Vjn)),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 lT;try{if(g=t(g,u),g===FSe)continue;g=Wjn(g)}catch(b){g=Ber(b)}f+=1,zer(g,m,p),s.push(g),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new Uer(b=>{c=b})}s.push(Ver)}catch(g){let b=Ber(g);zer(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===Ver)return;if(i.aborted)throw new lT;g!==FSe&&(yield g),s.shift(),h()}await new Uer(g=>{l=g})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function Gjn(t=void 0){return t!=null&&z4(t,"options"),t?.signal!=null&&B4(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 lT({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function Jer(t,e=void 0){for await(let r of sGe.call(this,t,e))return!0;return!1}async function Xjn(t,e=void 0){if(typeof t!="function")throw new Yre("fn",["Function","AsyncFunction"],t);return!await Jer.call(this,async(...r)=>!await t(...r),e)}async function Zjn(t,e){for await(let r of sGe.call(this,t,e))return r}async function Yjn(t,e){if(typeof t!="function")throw new Yre("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),FSe}for await(let n of kSe.call(this,r,e));}function sGe(t,e){if(typeof t!="function")throw new Yre("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:FSe}return kSe.call(this,r,e)}var aGe=class extends Njn{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function Qjn(t,e,r){var n;if(typeof t!="function")throw new Yre("reducer",["Function","AsyncFunction"],t);r!=null&&z4(r,"options"),r?.signal!=null&&B4(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new lT(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await Ljn(this.destroy(l)),l}let i=new Rjn,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[Djn]:this,[$jn]:!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 lT;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new aGe}finally{i.abort()}return e}async function eDn(t){t!=null&&z4(t,"options"),t?.signal!=null&&B4(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 lT(void 0,{cause:t.signal.reason});zjn(e,n)}return e}function tDn(t,e){let r=kSe.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function Wer(t){if(t=Hjn(t),Jjn(t))return 0;if(t<0)throw new jjn("number",">= 0",t);return t}function rDn(t,e=void 0){return e!=null&&z4(e,"options"),e?.signal!=null&&B4(e.signal,"options.signal"),t=Wer(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new lT;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new lT;t--<=0&&(yield i)}}.call(this)}function nDn(t,e=void 0){return e!=null&&z4(e,"options"),e?.signal!=null&&B4(e.signal,"options.signal"),t=Wer(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new lT;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new lT;if(t-- >0&&(yield i),t<=0)return}}.call(this)}uGe.exports.streamReturningOperators={asIndexedPairs:Bjn(Gjn,"readable.asIndexedPairs will be removed in a future version."),drop:rDn,filter:sGe,flatMap:tDn,map:kSe,take:nDn,compose:Kjn};uGe.exports.promiseReturningOperators={every:Xjn,forEach:Yjn,reduce:Qjn,toArray:eDn,some:Jer,find:Zjn}});var lGe=S((Tma,Ger)=>{"use strict";var{ArrayPrototypePop:oDn,Promise:iDn}=cc(),{isIterable:aDn,isNodeStream:sDn,isWebStream:uDn}=iT(),{pipelineImpl:lDn}=DSe(),{finished:cDn}=XN();cGe();function dDn(...t){return new iDn((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!sDn(i)&&!aDn(i)&&!uDn(i)){let a=oDn(t);n=a.signal,o=a.end}lDn(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}Ger.exports={finished:cDn,pipeline:dDn}});var cGe=S((Ema,otr)=>{var{Buffer:fDn}=Qw(),{ObjectDefineProperty:QN,ObjectKeys:Yer,ReflectApply:Qer}=cc(),{promisify:{custom:etr}}=hy(),{streamReturningOperators:Xer,promiseReturningOperators:Zer}=Ker(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:ttr}}=hb(),pDn=iGe(),{setDefaultHighWaterMark:mDn,getDefaultHighWaterMark:hDn}=zre(),{pipeline:rtr}=DSe(),{destroyer:gDn}=$4(),ntr=XN(),dGe=lGe(),Qre=iT(),ml=otr.exports=bSe().Stream;ml.isDestroyed=Qre.isDestroyed;ml.isDisturbed=Qre.isDisturbed;ml.isErrored=Qre.isErrored;ml.isReadable=Qre.isReadable;ml.isWritable=Qre.isWritable;ml.Readable=Jre();for(let t of Yer(Xer)){let r=function(...n){if(new.target)throw ttr();return ml.Readable.from(Qer(e,this,n))};fGe=r;let e=Xer[t];QN(r,"name",{__proto__:null,value:e.name}),QN(r,"length",{__proto__:null,value:e.length}),QN(ml.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var fGe;for(let t of Yer(Zer)){let r=function(...o){if(new.target)throw ttr();return Qer(e,this,o)};fGe=r;let e=Zer[t];QN(r,"name",{__proto__:null,value:e.name}),QN(r,"length",{__proto__:null,value:e.length}),QN(ml.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var fGe;ml.Writable=RSe();ml.Duplex=uT();ml.Transform=J8e();ml.PassThrough=K8e();ml.pipeline=rtr;var{addAbortSignal:yDn}=Bre();ml.addAbortSignal=yDn;ml.finished=ntr;ml.destroy=gDn;ml.compose=pDn;ml.setDefaultHighWaterMark=mDn;ml.getDefaultHighWaterMark=hDn;QN(ml,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return dGe}});QN(rtr,etr,{__proto__:null,enumerable:!0,get(){return dGe.pipeline}});QN(ntr,etr,{__proto__:null,enumerable:!0,get(){return dGe.finished}});ml.Stream=ml;ml._isUint8Array=function(e){return e instanceof Uint8Array};ml._uint8ArrayToBuffer=function(e){return fDn.from(e.buffer,e.byteOffset,e.byteLength)}});var ene=S((Pma,Hc)=>{"use strict";var Sm=cGe(),bDn=lGe(),_Dn=Sm.Readable.destroy;Hc.exports=Sm.Readable;Hc.exports._uint8ArrayToBuffer=Sm._uint8ArrayToBuffer;Hc.exports._isUint8Array=Sm._isUint8Array;Hc.exports.isDisturbed=Sm.isDisturbed;Hc.exports.isErrored=Sm.isErrored;Hc.exports.isReadable=Sm.isReadable;Hc.exports.Readable=Sm.Readable;Hc.exports.Writable=Sm.Writable;Hc.exports.Duplex=Sm.Duplex;Hc.exports.Transform=Sm.Transform;Hc.exports.PassThrough=Sm.PassThrough;Hc.exports.addAbortSignal=Sm.addAbortSignal;Hc.exports.finished=Sm.finished;Hc.exports.destroy=Sm.destroy;Hc.exports.destroy=_Dn;Hc.exports.pipeline=Sm.pipeline;Hc.exports.compose=Sm.compose;Object.defineProperty(Sm,"promises",{configurable:!0,enumerable:!0,get(){return bDn}});Hc.exports.Stream=Sm.Stream;Hc.exports.default=Hc.exports});var str=S(tne=>{"use strict";Object.defineProperty(tne,"__esModule",{value:!0});tne.Headers=void 0;var itr;typeof globalThis.Headers<"u"?tne.Headers=itr=globalThis.Headers:tne.Headers=itr=class atr{constructor(e){if(this.headers=new Map,e)if(e instanceof atr)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 pGe=S(V4=>{"use strict";Object.defineProperty(V4,"__esModule",{value:!0});V4.unknownRawResponse=V4.abortRawResponse=void 0;V4.toRawResponse=vDn;var utr=str();V4.abortRawResponse={headers:new utr.Headers,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""};V4.unknownRawResponse={headers:new utr.Headers,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function vDn(t){return{headers:t.headers,redirected:t.redirected,status:t.status,statusText:t.statusText,type:t.type,url:t.url}}});var H4=S((Rma,ltr)=>{"use strict";ltr.exports=TypeError});var ctr=S(()=>{});var ine=S((jma,Itr)=>{var CGe=typeof Map=="function"&&Map.prototype,mGe=Object.getOwnPropertyDescriptor&&CGe?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,USe=CGe&&mGe&&typeof mGe.get=="function"?mGe.get:null,dtr=CGe&&Map.prototype.forEach,xGe=typeof Set=="function"&&Set.prototype,hGe=Object.getOwnPropertyDescriptor&&xGe?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,BSe=xGe&&hGe&&typeof hGe.get=="function"?hGe.get:null,ftr=xGe&&Set.prototype.forEach,wDn=typeof WeakMap=="function"&&WeakMap.prototype,nne=wDn?WeakMap.prototype.has:null,SDn=typeof WeakSet=="function"&&WeakSet.prototype,one=SDn?WeakSet.prototype.has:null,CDn=typeof WeakRef=="function"&&WeakRef.prototype,ptr=CDn?WeakRef.prototype.deref:null,xDn=Boolean.prototype.valueOf,ODn=Object.prototype.toString,TDn=Function.prototype.toString,EDn=String.prototype.match,OGe=String.prototype.slice,CF=String.prototype.replace,PDn=String.prototype.toUpperCase,mtr=String.prototype.toLowerCase,Ctr=RegExp.prototype.test,htr=Array.prototype.concat,cT=Array.prototype.join,MDn=Array.prototype.slice,gtr=Math.floor,bGe=typeof BigInt=="function"?BigInt.prototype.valueOf:null,gGe=Object.getOwnPropertySymbols,_Ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,F5=typeof Symbol=="function"&&typeof Symbol.iterator=="object",yy=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===F5||!0)?Symbol.toStringTag:null,xtr=Object.prototype.propertyIsEnumerable,ytr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function btr(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Ctr.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-gtr(-t):gtr(t);if(n!==t){var o=String(n),i=OGe.call(e,o.length+1);return CF.call(o,r,"$&_")+"."+CF.call(CF.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return CF.call(e,r,"$&_")}var vGe=ctr(),_tr=vGe.custom,vtr=Etr(_tr)?_tr:null,Otr={__proto__:null,double:'"',single:"'"},IDn={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Itr.exports=function t(e,r,n,o){var i=r||{};if(e1(i,"quoteStyle")&&!e1(Otr,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(e1(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=e1(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(e1(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(e1(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 Mtr(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?btr(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?btr(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 wGe(e)?"[Array]":"[Object]";var d=KDn(i,n);if(typeof o>"u")o=[];else if(Ptr(o,e)>=0)return"[Circular]";function f(V,q,J){if(q&&(o=MDn.call(o),o.push(q)),J){var K={depth:i.depth};return e1(i,"quoteStyle")&&(K.quoteStyle=i.quoteStyle),t(V,K,n+1,o)}return t(V,i,n+1,o)}if(typeof e=="function"&&!wtr(e)){var p=kDn(e),m=qSe(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+cT.call(m,", ")+" }":"")}if(Etr(e)){var h=F5?CF.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):_Ge.call(e);return typeof e=="object"&&!F5?rne(h):h}if(HDn(e)){for(var y="<"+mtr.call(String(e.nodeName)),g=e.attributes||[],b=0;b<g.length;b++)y+=" "+g[b].name+"="+Ttr(RDn(g[b].value),"double",i);return y+=">",e.childNodes&&e.childNodes.length&&(y+="..."),y+="</"+mtr.call(String(e.nodeName))+">",y}if(wGe(e)){if(e.length===0)return"[]";var _=qSe(e,f);return d&&!WDn(_)?"["+SGe(_,d)+"]":"[ "+cT.call(_,", ")+" ]"}if(NDn(e)){var w=qSe(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!xtr.call(e,"cause")?"{ ["+String(e)+"] "+cT.call(htr.call("[cause]: "+f(e.cause),w),", ")+" }":w.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+cT.call(w,", ")+" }"}if(typeof e=="object"&&a){if(vtr&&typeof e[vtr]=="function"&&vGe)return vGe(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(qDn(e)){var O=[];return dtr&&dtr.call(e,function(V,q){O.push(f(q,e,!0)+" => "+f(V,e))}),Str("Map",USe.call(e),O,d)}if(zDn(e)){var T=[];return ftr&&ftr.call(e,function(V){T.push(f(V,e))}),Str("Set",BSe.call(e),T,d)}if(UDn(e))return yGe("WeakMap");if(VDn(e))return yGe("WeakSet");if(BDn(e))return yGe("WeakRef");if(DDn(e))return rne(f(Number(e)));if(LDn(e))return rne(f(bGe.call(e)));if($Dn(e))return rne(xDn.call(e));if(jDn(e))return rne(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(!ADn(e)&&!wtr(e)){var P=qSe(e,f),M=ytr?ytr(e)===Object.prototype:e instanceof Object||e.constructor===Object,I=e instanceof Object?"":"null prototype",j=!M&&yy&&Object(e)===e&&yy in e?OGe.call(xF(e),8,-1):I?"Object":"",A=M||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",k=A+(j||I?"["+cT.call(htr.call([],j||[],I||[]),": ")+"] ":"");return P.length===0?k+"{}":d?k+"{"+SGe(P,d)+"}":k+"{ "+cT.call(P,", ")+" }"}return String(e)};function Ttr(t,e,r){var n=r.quoteStyle||e,o=Otr[n];return o+t+o}function RDn(t){return CF.call(String(t),/"/g,""")}function wGe(t){return xF(t)==="[object Array]"&&(!yy||!(typeof t=="object"&&yy in t))}function ADn(t){return xF(t)==="[object Date]"&&(!yy||!(typeof t=="object"&&yy in t))}function wtr(t){return xF(t)==="[object RegExp]"&&(!yy||!(typeof t=="object"&&yy in t))}function NDn(t){return xF(t)==="[object Error]"&&(!yy||!(typeof t=="object"&&yy in t))}function jDn(t){return xF(t)==="[object String]"&&(!yy||!(typeof t=="object"&&yy in t))}function DDn(t){return xF(t)==="[object Number]"&&(!yy||!(typeof t=="object"&&yy in t))}function $Dn(t){return xF(t)==="[object Boolean]"&&(!yy||!(typeof t=="object"&&yy in t))}function Etr(t){if(F5)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!_Ge)return!1;try{return _Ge.call(t),!0}catch{}return!1}function LDn(t){if(!t||typeof t!="object"||!bGe)return!1;try{return bGe.call(t),!0}catch{}return!1}var FDn=Object.prototype.hasOwnProperty||function(t){return t in this};function e1(t,e){return FDn.call(t,e)}function xF(t){return ODn.call(t)}function kDn(t){if(t.name)return t.name;var e=EDn.call(TDn.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Ptr(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 qDn(t){if(!USe||!t||typeof t!="object")return!1;try{USe.call(t);try{BSe.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function UDn(t){if(!nne||!t||typeof t!="object")return!1;try{nne.call(t,nne);try{one.call(t,one)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function BDn(t){if(!ptr||!t||typeof t!="object")return!1;try{return ptr.call(t),!0}catch{}return!1}function zDn(t){if(!BSe||!t||typeof t!="object")return!1;try{BSe.call(t);try{USe.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function VDn(t){if(!one||!t||typeof t!="object")return!1;try{one.call(t,one);try{nne.call(t,nne)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function HDn(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function Mtr(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Mtr(OGe.call(t,0,e.maxStringLength),e)+n}var o=IDn[e.quoteStyle||"single"];o.lastIndex=0;var i=CF.call(CF.call(t,o,"\\$1"),/[\x00-\x1f]/g,JDn);return Ttr(i,"single",e)}function JDn(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":"")+PDn.call(e.toString(16))}function rne(t){return"Object("+t+")"}function yGe(t){return t+" { ? }"}function Str(t,e,r,n){var o=n?SGe(r,n):cT.call(r,", ");return t+" ("+e+") {"+o+"}"}function WDn(t){for(var e=0;e<t.length;e++)if(Ptr(t[e],`
|
||
`)>=0)return!1;return!0}function KDn(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=cT.call(Array(t.indent+1)," ");else return null;return{base:r,prev:cT.call(Array(e+1),r)}}function SGe(t,e){if(t.length===0)return"";var r=`
|
||
`+e.prev+e.base;return r+cT.call(t,","+r)+`
|
||
`+e.prev}function qSe(t,e){var r=wGe(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=e1(t,o)?e(t[o],t):""}var i=typeof gGe=="function"?gGe(t):[],a;if(F5){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)e1(t,u)&&(r&&String(Number(u))===u&&u<t.length||F5&&a["$"+u]instanceof Symbol||(Ctr.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof gGe=="function")for(var l=0;l<i.length;l++)xtr.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var Atr=S((Dma,Rtr)=>{"use strict";var GDn=ine(),XDn=H4(),zSe=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},ZDn=function(t,e){if(t){var r=zSe(t,e);return r&&r.value}},YDn=function(t,e,r){var n=zSe(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},QDn=function(t,e){return t?!!zSe(t,e):!1},e$n=function(t,e){if(t)return zSe(t,e,!0)};Rtr.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new XDn("Side channel does not contain "+GDn(n))},delete:function(n){var o=e&&e.next,i=e$n(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return ZDn(e,n)},has:function(n){return QDn(e,n)},set:function(n,o){e||(e={next:void 0}),YDn(e,n,o)}};return r}});var TGe=S(($ma,Ntr)=>{"use strict";Ntr.exports=Object});var Dtr=S((Lma,jtr)=>{"use strict";jtr.exports=Error});var Ltr=S((Fma,$tr)=>{"use strict";$tr.exports=EvalError});var ktr=S((kma,Ftr)=>{"use strict";Ftr.exports=RangeError});var Utr=S((qma,qtr)=>{"use strict";qtr.exports=ReferenceError});var ztr=S((Uma,Btr)=>{"use strict";Btr.exports=SyntaxError});var Htr=S((Bma,Vtr)=>{"use strict";Vtr.exports=URIError});var Wtr=S((zma,Jtr)=>{"use strict";Jtr.exports=Math.abs});var Gtr=S((Vma,Ktr)=>{"use strict";Ktr.exports=Math.floor});var Ztr=S((Hma,Xtr)=>{"use strict";Xtr.exports=Math.max});var Qtr=S((Jma,Ytr)=>{"use strict";Ytr.exports=Math.min});var trr=S((Wma,err)=>{"use strict";err.exports=Math.pow});var nrr=S((Kma,rrr)=>{"use strict";rrr.exports=Math.round});var irr=S((Gma,orr)=>{"use strict";orr.exports=Number.isNaN||function(e){return e!==e}});var srr=S((Xma,arr)=>{"use strict";var t$n=irr();arr.exports=function(e){return t$n(e)||e===0?e:e<0?-1:1}});var lrr=S((Zma,urr)=>{"use strict";urr.exports=Object.getOwnPropertyDescriptor});var EGe=S((Yma,crr)=>{"use strict";var VSe=lrr();if(VSe)try{VSe([],"length")}catch{VSe=null}crr.exports=VSe});var frr=S((Qma,drr)=>{"use strict";var HSe=Object.defineProperty||!1;if(HSe)try{HSe({},"a",{value:1})}catch{HSe=!1}drr.exports=HSe});var mrr=S((eha,prr)=>{"use strict";prr.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 yrr=S((tha,grr)=>{"use strict";var hrr=typeof Symbol<"u"&&Symbol,r$n=mrr();grr.exports=function(){return typeof hrr!="function"||typeof Symbol!="function"||typeof hrr("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:r$n()}});var PGe=S((rha,brr)=>{"use strict";brr.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var MGe=S((nha,_rr)=>{"use strict";var n$n=TGe();_rr.exports=n$n.getPrototypeOf||null});var Srr=S((oha,wrr)=>{"use strict";var o$n="Function.prototype.bind called on incompatible ",i$n=Object.prototype.toString,a$n=Math.max,s$n="[object Function]",vrr=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},u$n=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},l$n=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};wrr.exports=function(e){var r=this;if(typeof r!="function"||i$n.apply(r)!==s$n)throw new TypeError(o$n+r);for(var n=u$n(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,vrr(n,arguments));return Object(c)===c?c:this}return r.apply(e,vrr(n,arguments))},a=a$n(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+l$n(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 ane=S((iha,Crr)=>{"use strict";var c$n=Srr();Crr.exports=Function.prototype.bind||c$n});var JSe=S((aha,xrr)=>{"use strict";xrr.exports=Function.prototype.call});var IGe=S((sha,Orr)=>{"use strict";Orr.exports=Function.prototype.apply});var Err=S((uha,Trr)=>{"use strict";Trr.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Mrr=S((lha,Prr)=>{"use strict";var d$n=ane(),f$n=IGe(),p$n=JSe(),m$n=Err();Prr.exports=m$n||d$n.call(p$n,f$n)});var RGe=S((cha,Irr)=>{"use strict";var h$n=ane(),g$n=H4(),y$n=JSe(),b$n=Mrr();Irr.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new g$n("a function is required");return b$n(h$n,y$n,e)}});var $rr=S((dha,Drr)=>{"use strict";var _$n=RGe(),Rrr=EGe(),Nrr;try{Nrr=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var AGe=!!Nrr&&Rrr&&Rrr(Object.prototype,"__proto__"),jrr=Object,Arr=jrr.getPrototypeOf;Drr.exports=AGe&&typeof AGe.get=="function"?_$n([AGe.get]):typeof Arr=="function"?function(e){return Arr(e==null?e:jrr(e))}:!1});var Urr=S((fha,qrr)=>{"use strict";var Lrr=PGe(),Frr=MGe(),krr=$rr();qrr.exports=Lrr?function(e){return Lrr(e)}:Frr?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return Frr(e)}:krr?function(e){return krr(e)}:null});var zrr=S((pha,Brr)=>{"use strict";var v$n=Function.prototype.call,w$n=Object.prototype.hasOwnProperty,S$n=ane();Brr.exports=S$n.call(v$n,w$n)});var GSe=S((mha,Grr)=>{"use strict";var Li,C$n=TGe(),x$n=Dtr(),O$n=Ltr(),T$n=ktr(),E$n=Utr(),B5=ztr(),U5=H4(),P$n=Htr(),M$n=Wtr(),I$n=Gtr(),R$n=Ztr(),A$n=Qtr(),N$n=trr(),j$n=nrr(),D$n=srr(),Wrr=Function,NGe=function(t){try{return Wrr('"use strict"; return ('+t+").constructor;")()}catch{}},sne=EGe(),$$n=frr(),jGe=function(){throw new U5},L$n=sne?function(){try{return arguments.callee,jGe}catch{try{return sne(arguments,"callee").get}catch{return jGe}}}():jGe,k5=yrr()(),dh=Urr(),F$n=MGe(),k$n=PGe(),Krr=IGe(),une=JSe(),q5={},q$n=typeof Uint8Array>"u"||!dh?Li:dh(Uint8Array),J4={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Li:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Li:ArrayBuffer,"%ArrayIteratorPrototype%":k5&&dh?dh([][Symbol.iterator]()):Li,"%AsyncFromSyncIteratorPrototype%":Li,"%AsyncFunction%":q5,"%AsyncGenerator%":q5,"%AsyncGeneratorFunction%":q5,"%AsyncIteratorPrototype%":q5,"%Atomics%":typeof Atomics>"u"?Li:Atomics,"%BigInt%":typeof BigInt>"u"?Li:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Li:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Li:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Li:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":x$n,"%eval%":eval,"%EvalError%":O$n,"%Float32Array%":typeof Float32Array>"u"?Li:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Li:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Li:FinalizationRegistry,"%Function%":Wrr,"%GeneratorFunction%":q5,"%Int8Array%":typeof Int8Array>"u"?Li:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Li:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Li:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":k5&&dh?dh(dh([][Symbol.iterator]())):Li,"%JSON%":typeof JSON=="object"?JSON:Li,"%Map%":typeof Map>"u"?Li:Map,"%MapIteratorPrototype%":typeof Map>"u"||!k5||!dh?Li:dh(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":C$n,"%Object.getOwnPropertyDescriptor%":sne,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Li:Promise,"%Proxy%":typeof Proxy>"u"?Li:Proxy,"%RangeError%":T$n,"%ReferenceError%":E$n,"%Reflect%":typeof Reflect>"u"?Li:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Li:Set,"%SetIteratorPrototype%":typeof Set>"u"||!k5||!dh?Li:dh(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Li:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":k5&&dh?dh(""[Symbol.iterator]()):Li,"%Symbol%":k5?Symbol:Li,"%SyntaxError%":B5,"%ThrowTypeError%":L$n,"%TypedArray%":q$n,"%TypeError%":U5,"%Uint8Array%":typeof Uint8Array>"u"?Li:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Li:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Li:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Li:Uint32Array,"%URIError%":P$n,"%WeakMap%":typeof WeakMap>"u"?Li:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Li:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Li:WeakSet,"%Function.prototype.call%":une,"%Function.prototype.apply%":Krr,"%Object.defineProperty%":$$n,"%Object.getPrototypeOf%":F$n,"%Math.abs%":M$n,"%Math.floor%":I$n,"%Math.max%":R$n,"%Math.min%":A$n,"%Math.pow%":N$n,"%Math.round%":j$n,"%Math.sign%":D$n,"%Reflect.getPrototypeOf%":k$n};if(dh)try{null.error}catch(t){Vrr=dh(dh(t)),J4["%Error.prototype%"]=Vrr}var Vrr,U$n=function t(e){var r;if(e==="%AsyncFunction%")r=NGe("async function () {}");else if(e==="%GeneratorFunction%")r=NGe("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=NGe("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&dh&&(r=dh(o.prototype))}return J4[e]=r,r},Hrr={__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"]},lne=ane(),WSe=zrr(),B$n=lne.call(une,Array.prototype.concat),z$n=lne.call(Krr,Array.prototype.splice),Jrr=lne.call(une,String.prototype.replace),KSe=lne.call(une,String.prototype.slice),V$n=lne.call(une,RegExp.prototype.exec),H$n=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,J$n=/\\(\\)?/g,W$n=function(e){var r=KSe(e,0,1),n=KSe(e,-1);if(r==="%"&&n!=="%")throw new B5("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new B5("invalid intrinsic syntax, expected opening `%`");var o=[];return Jrr(e,H$n,function(i,a,s,u){o[o.length]=s?Jrr(u,J$n,"$1"):a||i}),o},K$n=function(e,r){var n=e,o;if(WSe(Hrr,n)&&(o=Hrr[n],n="%"+o[0]+"%"),WSe(J4,n)){var i=J4[n];if(i===q5&&(i=U$n(n)),typeof i>"u"&&!r)throw new U5("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new B5("intrinsic "+e+" does not exist!")};Grr.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new U5("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new U5('"allowMissing" argument must be a boolean');if(V$n(/^%?[^%]*%?$/,e)===null)throw new B5("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=W$n(e),o=n.length>0?n[0]:"",i=K$n("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],z$n(n,B$n([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=KSe(f,0,1),m=KSe(f,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new B5("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",WSe(J4,a))s=J4[a];else if(s!=null){if(!(f in s)){if(!r)throw new U5("base intrinsic for "+e+" exists, but the property is not available.");return}if(sne&&c+1>=n.length){var h=sne(s,f);d=!!h,d&&"get"in h&&!("originalValue"in h.get)?s=h.get:s=s[f]}else d=WSe(s,f),s=s[f];d&&!u&&(J4[a]=s)}}return s}});var DGe=S((hha,Yrr)=>{"use strict";var Xrr=GSe(),Zrr=RGe(),G$n=Zrr([Xrr("%String.prototype.indexOf%")]);Yrr.exports=function(e,r){var n=Xrr(e,!!r);return typeof n=="function"&&G$n(e,".prototype.")>-1?Zrr([n]):n}});var $Ge=S((gha,enr)=>{"use strict";var X$n=GSe(),cne=DGe(),Z$n=ine(),Y$n=H4(),Qrr=X$n("%Map%",!0),Q$n=cne("Map.prototype.get",!0),eLn=cne("Map.prototype.set",!0),tLn=cne("Map.prototype.has",!0),rLn=cne("Map.prototype.delete",!0),nLn=cne("Map.prototype.size",!0);enr.exports=!!Qrr&&function(){var e,r={assert:function(n){if(!r.has(n))throw new Y$n("Side channel does not contain "+Z$n(n))},delete:function(n){if(e){var o=rLn(e,n);return nLn(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return Q$n(e,n)},has:function(n){return e?tLn(e,n):!1},set:function(n,o){e||(e=new Qrr),eLn(e,n,o)}};return r}});var rnr=S((yha,tnr)=>{"use strict";var oLn=GSe(),ZSe=DGe(),iLn=ine(),XSe=$Ge(),aLn=H4(),z5=oLn("%WeakMap%",!0),sLn=ZSe("WeakMap.prototype.get",!0),uLn=ZSe("WeakMap.prototype.set",!0),lLn=ZSe("WeakMap.prototype.has",!0),cLn=ZSe("WeakMap.prototype.delete",!0);tnr.exports=z5?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new aLn("Side channel does not contain "+iLn(o))},delete:function(o){if(z5&&o&&(typeof o=="object"||typeof o=="function")){if(e)return cLn(e,o)}else if(XSe&&r)return r.delete(o);return!1},get:function(o){return z5&&o&&(typeof o=="object"||typeof o=="function")&&e?sLn(e,o):r&&r.get(o)},has:function(o){return z5&&o&&(typeof o=="object"||typeof o=="function")&&e?lLn(e,o):!!r&&r.has(o)},set:function(o,i){z5&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new z5),uLn(e,o,i)):XSe&&(r||(r=XSe()),r.set(o,i))}};return n}:XSe});var LGe=S((bha,nnr)=>{"use strict";var dLn=H4(),fLn=ine(),pLn=Atr(),mLn=$Ge(),hLn=rnr(),gLn=hLn||mLn||pLn;nnr.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new dLn("Side channel does not contain "+fLn(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=gLn()),e.set(n,o)}};return r}});var YSe=S((_ha,onr)=>{"use strict";var yLn=String.prototype.replace,bLn=/%20/g,FGe={RFC1738:"RFC1738",RFC3986:"RFC3986"};onr.exports={default:FGe.RFC3986,formatters:{RFC1738:function(t){return yLn.call(t,bLn,"+")},RFC3986:function(t){return String(t)}},RFC1738:FGe.RFC1738,RFC3986:FGe.RFC3986}});var zGe=S((vha,snr)=>{"use strict";var _Ln=YSe(),vLn=LGe(),kGe=Object.prototype.hasOwnProperty,W4=Array.isArray,e0e=vLn(),inr=function(e,r){return e0e.set(e,r),e},QSe=function(e){return e0e.has(e)},UGe=function(e){return e0e.get(e)},anr=function(e,r){e0e.set(e,r)},dT=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),wLn=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(W4(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},BGe=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},SLn=function t(e,r,n){if(!r)return e;if(typeof r!="object"&&typeof r!="function"){if(W4(e))e.push(r);else if(e&&typeof e=="object")if(QSe(e)){var o=UGe(e)+1;e[o]=r,anr(e,o)}else(n&&(n.plainObjects||n.allowPrototypes)||!kGe.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object"){if(QSe(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 inr(a,UGe(r)+1)}return[e].concat(r)}var l=e;return W4(e)&&!W4(r)&&(l=BGe(e,n)),W4(e)&&W4(r)?(r.forEach(function(c,d){if(kGe.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 kGe.call(c,d)?c[d]=t(c[d],f,n):c[d]=f,c},l)},CLn=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},xLn=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}},qGe=1024,OLn=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+=qGe){for(var l=a.length>=qGe?a.slice(u,u+qGe):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===_Ln.RFC1738&&(f===40||f===41)){c[c.length]=l.charAt(d);continue}if(f<128){c[c.length]=dT[f];continue}if(f<2048){c[c.length]=dT[192|f>>6]+dT[128|f&63];continue}if(f<55296||f>=57344){c[c.length]=dT[224|f>>12]+dT[128|f>>6&63]+dT[128|f&63];continue}d+=1,f=65536+((f&1023)<<10|l.charCodeAt(d)&1023),c[c.length]=dT[240|f>>18]+dT[128|f>>12&63]+dT[128|f>>6&63]+dT[128|f&63]}s+=c.join("")}return s},TLn=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 wLn(r),e},ELn=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},PLn=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},MLn=function(e,r,n,o){if(QSe(e)){var i=UGe(e)+1;return e[i]=r,anr(e,i),e}var a=[].concat(e,r);return a.length>n?inr(BGe(a,{plainObjects:o}),a.length-1):a},ILn=function(e,r){if(W4(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};snr.exports={arrayToObject:BGe,assign:CLn,combine:MLn,compact:TLn,decode:xLn,encode:OLn,isBuffer:PLn,isOverflow:QSe,isRegExp:ELn,maybeMap:ILn,merge:SLn}});var pnr=S((wha,fnr)=>{"use strict";var lnr=LGe(),t0e=zGe(),dne=YSe(),RLn=Object.prototype.hasOwnProperty,cnr={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},fT=Array.isArray,ALn=Array.prototype.push,dnr=function(t,e){ALn.apply(t,fT(e)?e:[e])},NLn=Date.prototype.toISOString,unr=dne.default,Cm={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:t0e.encode,encodeValuesOnly:!1,filter:void 0,format:unr,formatter:dne.formatters[unr],indices:!1,serializeDate:function(e){return NLn.call(e)},skipNulls:!1,strictNullHandling:!1},jLn=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},VGe={},DLn=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,O=0,T=!1;(w=w.get(VGe))!==void 0&&!T;){var P=w.get(e);if(O+=1,typeof P<"u"){if(P===O)throw new RangeError("Cyclic object value");T=!0}typeof w.get(VGe)>"u"&&(O=0)}if(typeof c=="function"?_=c(r,_):_ instanceof Date?_=p(_):n==="comma"&&fT(_)&&(_=t0e.maybeMap(_,function(Y){return Y instanceof Date?p(Y):Y})),_===null){if(a)return l&&!y?l(r,Cm.encoder,g,"key",m):r;_=""}if(jLn(_)||t0e.isBuffer(_)){if(l){var M=y?r:l(r,Cm.encoder,g,"key",m);return[h(M)+"="+h(l(_,Cm.encoder,g,"value",m))]}return[h(r)+"="+h(String(_))]}var I=[];if(typeof _>"u")return I;var j;if(n==="comma"&&fT(_))y&&l&&(_=t0e.maybeMap(_,l)),j=[{value:_.length>0?_.join(",")||null:void 0}];else if(fT(c))j=c;else{var A=Object.keys(_);j=d?A.sort(d):A}var k=u?String(r).replace(/\./g,"%2E"):String(r),V=o&&fT(_)&&_.length===1?k+"[]":k;if(i&&fT(_)&&_.length===0)return V+"[]";for(var q=0;q<j.length;++q){var J=j[q],K=typeof J=="object"&&J&&typeof J.value<"u"?J.value:_[J];if(!(s&&K===null)){var ue=f&&u?String(J).replace(/\./g,"%2E"):String(J),oe=fT(_)?typeof n=="function"?n(V,ue):V:V+(f?"."+ue:"["+ue+"]");b.set(e,O);var G=lnr();G.set(VGe,b),dnr(I,t(K,oe,n,o,i,a,s,u,n==="comma"&&y&&fT(_)?null:l,c,d,f,p,m,h,y,g,G))}}return I},$Ln=function(e){if(!e)return Cm;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||Cm.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=dne.default;if(typeof e.format<"u"){if(!RLn.call(dne.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=dne.formatters[n],i=Cm.filter;(typeof e.filter=="function"||fT(e.filter))&&(i=e.filter);var a;if(e.arrayFormat in cnr?a=e.arrayFormat:"indices"in e?a=e.indices?"indices":"repeat":a=Cm.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:Cm.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Cm.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Cm.allowEmptyArrays,arrayFormat:a,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Cm.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?Cm.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Cm.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:Cm.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:Cm.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Cm.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Cm.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Cm.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Cm.strictNullHandling}};fnr.exports=function(t,e){var r=t,n=$Ln(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):fT(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s=cnr[n.arrayFormat],u=s==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);for(var l=lnr(),c=0;c<o.length;++c){var d=o[c],f=r[d];n.skipNulls&&f===null||dnr(a,DLn(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 ynr=S((Sha,gnr)=>{"use strict";var OF=zGe(),r0e=Object.prototype.hasOwnProperty,mnr=Array.isArray,Ec={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:OF.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},LLn=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},hnr=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},FLn="utf8=%26%2310003%3B",kLn="utf8=%E2%9C%93",qLn=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]===kLn?l="utf-8":a[u]===FLn&&(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,Ec.decoder,l,"key"),m=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),Ec.decoder,l,"key"),p!==null&&(m=OF.maybeMap(hnr(c.slice(f+1),r,mnr(n[p])?n[p].length:0),function(y){return r.decoder(y,Ec.decoder,l,"value")}))),m&&r.interpretNumericEntities&&l==="iso-8859-1"&&(m=LLn(String(m))),c.indexOf("[]=")>-1&&(m=mnr(m)?[m]:m),p!==null){var h=r0e.call(n,p);h&&r.duplicates==="combine"?n[p]=OF.combine(n[p],m,r.arrayLimit,r.plainObjects):(!h||r.duplicates==="last")&&(n[p]=m)}}return n},ULn=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:hnr(e,r,o),s=t.length-1;s>=0;--s){var u,l=t[s];if(l==="[]"&&r.parseArrays)OF.isOverflow(a)?u=a:u=r.allowEmptyArrays&&(a===""||r.strictNullHandling&&a===null)?[]:OF.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},BLn=function(e,r){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(r.depth<=0)return!r.plainObjects&&r0e.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&&r0e.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&&r0e.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},zLn=function(e,r,n,o){if(e){var i=BLn(e,n);if(i)return ULn(i,r,n,o)}},VLn=function(e){if(!e)return Ec;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"?Ec.charset:e.charset,n=typeof e.duplicates>"u"?Ec.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:Ec.allowDots:!!e.allowDots;return{allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Ec.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Ec.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Ec.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Ec.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ec.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Ec.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:Ec.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:Ec.decoder,delimiter:typeof e.delimiter=="string"||OF.isRegExp(e.delimiter)?e.delimiter:Ec.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Ec.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Ec.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Ec.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Ec.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:Ec.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ec.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};gnr.exports=function(t,e){var r=VLn(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?{__proto__:null}:{};for(var n=typeof t=="string"?qLn(t,r):t,o=r.plainObjects?{__proto__:null}:{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=zLn(s,n[s],r,typeof t=="string");o=OF.merge(o,u,r)}return r.allowSparse===!0?o:OF.compact(o)}});var HGe=S((Cha,bnr)=>{"use strict";var HLn=pnr(),JLn=ynr(),WLn=YSe();bnr.exports={formats:WLn,parse:JLn,stringify:HLn}});var _nr=S(fne=>{"use strict";var KLn=fne&&fne.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fne,"__esModule",{value:!0});fne.createRequestUrl=XLn;var GLn=KLn(HGe());function XLn(t,e){return Object.keys(e??{}).length>0?`${t}?${GLn.default.stringify(e,{arrayFormat:"repeat"})}`:t}});var vnr=S(n0e=>{"use strict";Object.defineProperty(n0e,"__esModule",{value:!0});n0e.RUNTIME=void 0;n0e.RUNTIME=ZLn();function ZLn(){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 V5=S(o0e=>{"use strict";Object.defineProperty(o0e,"__esModule",{value:!0});o0e.RUNTIME=void 0;var YLn=vnr();Object.defineProperty(o0e,"RUNTIME",{enumerable:!0,get:function(){return YLn.RUNTIME}})});var JGe=S((H5,wnr)=>{"use strict";var QLn=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},K4=QLn();wnr.exports=H5=K4.fetch;K4.fetch&&(H5.default=K4.fetch.bind(K4));H5.Headers=K4.Headers;H5.Request=K4.Request;H5.Response=K4.Response});var Cnr=S(wC=>{"use strict";var eFn=wC&&wC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tFn=wC&&wC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Snr=wC&&wC.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&eFn(r,e,n[o]);return tFn(r,e),r}}(),rFn=wC&&wC.__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(wC,"__esModule",{value:!0});wC.getFetchFn=nFn;var i0e=V5();function nFn(){return rFn(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(()=>Snr(JGe()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>Snr(JGe()))).default})}});var xnr=S(pne=>{"use strict";var oFn=pne&&pne.__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(pne,"__esModule",{value:!0});pne.getRequestBody=aFn;var iFn=zbe();function aFn(t){return oFn(this,arguments,void 0,function*({body:e,type:r}){return r.includes("json")?(0,iFn.toJson)(e):e})}});var Onr=S(J5=>{"use strict";var SC=J5&&J5.__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(J5,"__esModule",{value:!0});J5.Node18UniversalStreamWrapper=void 0;var WGe=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=>SC(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",()=>SC(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>SC(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=>SC(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",()=>SC(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>SC(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 SC(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 SC(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 SC(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 SC(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:()=>SC(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}}}};J5.Node18UniversalStreamWrapper=WGe});var Tnr=S(W5=>{"use strict";var mne=W5&&W5.__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(W5,"__esModule",{value:!0});W5.UndiciStreamWrapper=void 0;var KGe=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 mne(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 mne(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 mne(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 mne(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:()=>mne(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}}}};W5.UndiciStreamWrapper=KGe});var Enr=S(TF=>{"use strict";var a0e=TF&&TF.__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())})},sFn=TF&&TF.__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(TF,"__esModule",{value:!0});TF.NodePre18StreamWrapper=void 0;var GGe=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=sFn(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}}}};TF.NodePre18StreamWrapper=GGe});var Pnr=S(CC=>{"use strict";var uFn=CC&&CC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lFn=CC&&CC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XGe=CC&&CC.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&uFn(r,e,n[o]);return lFn(r,e),r}}(),cFn=CC&&CC.__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(CC,"__esModule",{value:!0});CC.chooseStreamWrapper=dFn;var s0e=V5();function dFn(t){return cFn(this,void 0,void 0,function*(){return s0e.RUNTIME.type==="node"&&s0e.RUNTIME.parsedVersion!=null&&s0e.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>XGe(Onr()))).Node18UniversalStreamWrapper(t):s0e.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>XGe(Tnr()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>XGe(Enr()))).NodePre18StreamWrapper(t)})}});var Mnr=S(hne=>{"use strict";var fFn=hne&&hne.__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(hne,"__esModule",{value:!0});hne.getResponseBody=mFn;var pFn=Pnr();function mFn(t,e){return fFn(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,pFn.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 Inr=S(u0e=>{"use strict";Object.defineProperty(u0e,"__esModule",{value:!0});u0e.getTimeoutSignal=gFn;u0e.anySignal=yFn;var hFn="timeout";function gFn(t){let e=new AbortController,r=setTimeout(()=>e.abort(hFn),t);return{signal:e.signal,abortId:r}}function yFn(...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 Anr=S(K5=>{"use strict";var bFn=K5&&K5.__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(K5,"__esModule",{value:!0});K5.makeRequest=void 0;var Rnr=Inr(),_Fn=(t,e,r,n,o,i,a,s,u)=>bFn(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:m}=(0,Rnr.getTimeoutSignal)(i);c=m,l.push(p)}a!=null&&l.push(a);let d=(0,Rnr.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});K5.makeRequest=_Fn});var Nnr=S(gne=>{"use strict";var vFn=gne&&gne.__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(gne,"__esModule",{value:!0});gne.requestWithRetries=TFn;var wFn=1e3,SFn=6e4,CFn=2,xFn=.2;function OFn(t){let e=1+(Math.random()*2-1)*xFn;return t*e}function TFn(t){return vFn(this,arguments,void 0,function*(e,r=CFn){let n=yield e();for(let o=0;o<r&&([408,429].includes(n.status)||n.status>=500);++o){let i=Math.min(wFn*Math.pow(2,o),SFn),a=OFn(i);yield new Promise(s=>setTimeout(s,a)),n=yield e()}return n})}});var $nr=S(G4=>{"use strict";var jnr=G4&&G4.__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(G4,"__esModule",{value:!0});G4.fetcher=void 0;G4.fetcherImpl=Dnr;var EFn=zbe(),G5=pGe(),PFn=_nr(),MFn=Cnr(),IFn=xnr(),RFn=Mnr(),AFn=Anr(),NFn=Nnr();function Dnr(t){return jnr(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,PFn.createRequestUrl)(t.url,t.queryParameters),n=yield(0,IFn.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,MFn.getFetchFn)();try{let i=yield(0,NFn.requestWithRetries)(()=>jnr(this,void 0,void 0,function*(){return(0,AFn.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,RFn.getResponseBody)(i,t.responseType);return i.status>=200&&i.status<400?{ok:!0,body:a,headers:i.headers,rawResponse:(0,G5.toRawResponse)(i)}:{ok:!1,error:{reason:"status-code",statusCode:i.status,body:a},rawResponse:(0,G5.toRawResponse)(i)}}catch(i){return t.abortSignal!=null&&t.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:G5.abortRawResponse}:i instanceof Error&&i.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:G5.abortRawResponse}:i instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:i.message},rawResponse:G5.unknownRawResponse}:{ok:!1,error:{reason:"unknown",errorMessage:(0,EFn.toJson)(i)},rawResponse:G5.unknownRawResponse}}})}G4.fetcher=Dnr});var Lnr=S(ZGe=>{"use strict";Object.defineProperty(ZGe,"__esModule",{value:!0});ZGe.getHeader=jFn;function jFn(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}});var Fnr=S(X5=>{"use strict";var DFn=X5&&X5.__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(X5,"__esModule",{value:!0});X5.Supplier=void 0;X5.Supplier={get:t=>DFn(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var knr=S(Z5=>{"use strict";var $Fn=Z5&&Z5.__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(Z5,"__esModule",{value:!0});Z5.HttpResponsePromise=void 0;var YGe=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 $Fn(this,void 0,void 0,function*(){return yield this.innerPromise})}};Z5.HttpResponsePromise=YGe});var qnr=S(by=>{"use strict";Object.defineProperty(by,"__esModule",{value:!0});by.HttpResponsePromise=by.unknownRawResponse=by.toRawResponse=by.abortRawResponse=by.Supplier=by.getHeader=by.fetcher=void 0;var LFn=$nr();Object.defineProperty(by,"fetcher",{enumerable:!0,get:function(){return LFn.fetcher}});var FFn=Lnr();Object.defineProperty(by,"getHeader",{enumerable:!0,get:function(){return FFn.getHeader}});var kFn=Fnr();Object.defineProperty(by,"Supplier",{enumerable:!0,get:function(){return kFn.Supplier}});var QGe=pGe();Object.defineProperty(by,"abortRawResponse",{enumerable:!0,get:function(){return QGe.abortRawResponse}});Object.defineProperty(by,"toRawResponse",{enumerable:!0,get:function(){return QGe.toRawResponse}});Object.defineProperty(by,"unknownRawResponse",{enumerable:!0,get:function(){return QGe.unknownRawResponse}});var qFn=knr();Object.defineProperty(by,"HttpResponsePromise",{enumerable:!0,get:function(){return qFn.HttpResponsePromise}})});var Unr=S((e9e,t9e)=>{(function(t,e){typeof e9e=="object"&&typeof t9e<"u"?t9e.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:e9e,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($){var H={};return $.forEach(function(re,D){return H[re]=D}),H}(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($){return new Uint8Array(Array.prototype.slice.call($,0))},d=function($){return $.replace(/=/g,"").replace(/[+\/]/g,function(H){return H=="+"?"-":"_"})},f=function($){return $.replace(/[^A-Za-z0-9\+\/]/g,"")},p=function($){for(var H,re,D,R,z="",U=$.length%3,ee=0;ee<$.length;){if((re=$.charCodeAt(ee++))>255||(D=$.charCodeAt(ee++))>255||(R=$.charCodeAt(ee++))>255)throw new TypeError("invalid character found");H=re<<16|D<<8|R,z+=a[H>>18&63]+a[H>>12&63]+a[H>>6&63]+a[H&63]}return U?z.slice(0,U-3)+"===".substring(U):z},m=typeof btoa=="function"?function($){return btoa($)}:r?function($){return Buffer.from($,"binary").toString("base64")}:p,h=r?function($){return Buffer.from($).toString("base64")}:function($){for(var H=4096,re=[],D=0,R=$.length;D<R;D+=H)re.push(l.apply(null,$.subarray(D,D+H)));return m(re.join(""))},y=function($,H){return H===void 0&&(H=!1),H?d(h($)):h($)},g=function($){if($.length<2){var H=$.charCodeAt(0);return H<128?$:H<2048?l(192|H>>>6)+l(128|H&63):l(224|H>>>12&15)+l(128|H>>>6&63)+l(128|H&63)}else{var H=65536+($.charCodeAt(0)-55296)*1024+($.charCodeAt(1)-56320);return l(240|H>>>18&7)+l(128|H>>>12&63)+l(128|H>>>6&63)+l(128|H&63)}},b=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,_=function($){return $.replace(b,g)},w=r?function($){return Buffer.from($,"utf8").toString("base64")}:o?function($){return h(o.encode($))}:function($){return m(_($))},O=function($,H){return H===void 0&&(H=!1),H?d(w($)):w($)},T=function($){return O($,!0)},P=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,M=function($){switch($.length){case 4:var H=(7&$.charCodeAt(0))<<18|(63&$.charCodeAt(1))<<12|(63&$.charCodeAt(2))<<6|63&$.charCodeAt(3),re=H-65536;return l((re>>>10)+55296)+l((re&1023)+56320);case 3:return l((15&$.charCodeAt(0))<<12|(63&$.charCodeAt(1))<<6|63&$.charCodeAt(2));default:return l((31&$.charCodeAt(0))<<6|63&$.charCodeAt(1))}},I=function($){return $.replace(P,M)},j=function($){if($=$.replace(/\s+/g,""),!u.test($))throw new TypeError("malformed base64.");$+="==".slice(2-($.length&3));for(var H,re="",D,R,z=0;z<$.length;)H=s[$.charAt(z++)]<<18|s[$.charAt(z++)]<<12|(D=s[$.charAt(z++)])<<6|(R=s[$.charAt(z++)]),re+=D===64?l(H>>16&255):R===64?l(H>>16&255,H>>8&255):l(H>>16&255,H>>8&255,H&255);return re},A=typeof atob=="function"?function($){return atob(f($))}:r?function($){return Buffer.from($,"base64").toString("binary")}:j,k=r?function($){return c(Buffer.from($,"base64"))}:function($){return c(A($).split("").map(function(H){return H.charCodeAt(0)}))},V=function($){return k(J($))},q=r?function($){return Buffer.from($,"base64").toString("utf8")}:n?function($){return n.decode(k($))}:function($){return I(A($))},J=function($){return f($.replace(/[-_]/g,function(H){return H=="-"?"+":"/"}))},K=function($){return q(J($))},ue=function($){if(typeof $!="string")return!1;var H=$.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(H)||!/[^\s0-9a-zA-Z\-_]/.test(H)},oe=function($){return{value:$,enumerable:!1,writable:!0,configurable:!0}},G=function(){var $=function(H,re){return Object.defineProperty(String.prototype,H,oe(re))};$("fromBase64",function(){return K(this)}),$("toBase64",function(H){return O(this,H)}),$("toBase64URI",function(){return O(this,!0)}),$("toBase64URL",function(){return O(this,!0)}),$("toUint8Array",function(){return V(this)})},Y=function(){var $=function(H,re){return Object.defineProperty(Uint8Array.prototype,H,oe(re))};$("toBase64",function(H){return y(this,H)}),$("toBase64URI",function(){return y(this,!0)}),$("toBase64URL",function(){return y(this,!0)})},se=function(){G(),Y()},ie={version:t,VERSION:e,atob:A,atobPolyfill:j,btoa:m,btoaPolyfill:p,fromBase64:K,toBase64:O,encode:O,encodeURI:T,encodeURL:T,utob:_,btou:I,decode:K,isValid:ue,fromUint8Array:y,toUint8Array:V,extendString:G,extendUint8Array:Y,extendBuiltins:se};return ie.Base64={},Object.keys(ie).forEach(function($){return ie.Base64[$]=ie[$]}),ie})});var znr=S(l0e=>{"use strict";Object.defineProperty(l0e,"__esModule",{value:!0});l0e.BasicAuth=void 0;var Bnr=Unr(),UFn=/^Basic /i;l0e.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${Bnr.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(UFn,""),r=Bnr.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 Vnr=S(c0e=>{"use strict";Object.defineProperty(c0e,"__esModule",{value:!0});c0e.BearerToken=void 0;var BFn=/^Bearer /i;c0e.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(BFn,"").trim()}});var Hnr=S(Y5=>{"use strict";Object.defineProperty(Y5,"__esModule",{value:!0});Y5.BearerToken=Y5.BasicAuth=void 0;var zFn=znr();Object.defineProperty(Y5,"BasicAuth",{enumerable:!0,get:function(){return zFn.BasicAuth}});var VFn=Vnr();Object.defineProperty(Y5,"BearerToken",{enumerable:!0,get:function(){return VFn.BearerToken}})});var n9e=S(Fv=>{"use strict";var Jnr=Fv&&Fv.__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())})},Wnr=Fv&&Fv.__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)}},xC=Fv&&Fv.__await||function(t){return this instanceof xC?(this.v=t,this):new xC(t)},Knr=Fv&&Fv.__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 xC?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(Fv,"__esModule",{value:!0});Fv.Stream=void 0;Fv.readableStreamAsyncIterable=Gnr;var HFn=V5(),JFn="data:",r9e=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=JFn,this.messageTerminator=`
|
||
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return Knr(this,arguments,function*(){var r,n,o,i;this.controller.signal;let a=Gnr(this.stream),s="",u=!1;try{for(var l=!0,c=Wnr(a),d;d=yield xC(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 xC(void 0);let h=yield xC(this.parse(JSON.parse(m)));yield yield xC(h),u=!1}}}catch(f){n={error:f}}finally{try{!l&&!r&&(o=c.return)&&(yield xC(o.call(c)))}finally{if(n)throw n.error}}})}[Symbol.asyncIterator](){return Knr(this,arguments,function*(){var r,n,o,i;try{for(var a=!0,s=Wnr(this.iterMessages()),u;u=yield xC(s.next()),r=u.done,!r;a=!0)i=u.value,a=!1,yield yield xC(i)}catch(l){n={error:l}}finally{try{!a&&!r&&(o=s.return)&&(yield xC(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 HFn.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};Fv.Stream=r9e;function Gnr(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return Jnr(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 Jnr(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 Xnr=S(d0e=>{"use strict";Object.defineProperty(d0e,"__esModule",{value:!0});d0e.Stream=void 0;var WFn=n9e();Object.defineProperty(d0e,"Stream",{enumerable:!0,get:function(){return WFn.Stream}})});var Znr=S(yne=>{"use strict";var KFn=yne&&yne.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yne,"__esModule",{value:!0});yne.encodeAsFormParameter=XFn;var GFn=KFn(HGe());function XFn(t){let r=GFn.default.stringify(t,{encode:!1}).split("&").map(n=>{let[o,i]=n.split("=");return[o,i]});return Object.fromEntries(r)}});var eor=S((Kha,Qnr)=>{"use strict";var o9e=Object.defineProperty,ZFn=Object.getOwnPropertyDescriptor,YFn=Object.getOwnPropertyNames,QFn=Object.prototype.hasOwnProperty,ekn=(t,e)=>{for(var r in e)o9e(t,r,{get:e[r],enumerable:!0})},tkn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of YFn(e))!QFn.call(t,o)&&o!==r&&o9e(t,o,{get:()=>e[o],enumerable:!(n=ZFn(e,o))||n.enumerable});return t},rkn=t=>tkn(o9e({},"__esModule",{value:!0}),t),Ynr={};ekn(Ynr,{Blob:()=>ikn,File:()=>akn,FormData:()=>okn});Qnr.exports=rkn(Ynr);var nkn=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:okn,Blob:ikn,File:akn}=nkn});var mor=S((Gha,por)=>{"use strict";var s9e=Object.defineProperty,skn=Object.getOwnPropertyDescriptor,ukn=Object.getOwnPropertyNames,lkn=Object.prototype.hasOwnProperty,ckn=(t,e)=>{for(var r in e)s9e(t,r,{get:e[r],enumerable:!0})},dkn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ukn(e))!lkn.call(t,o)&&o!==r&&s9e(t,o,{get:()=>e[o],enumerable:!(n=skn(e,o))||n.enumerable});return t},fkn=t=>dkn(s9e({},"__esModule",{value:!0}),t),u9e=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Pc=(t,e,r)=>(u9e(t,e,"read from private field"),r?r.call(t):e.get(t)),pT=(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)},bne=(t,e,r,n)=>(u9e(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),i9e=(t,e,r)=>(u9e(t,e,"access private method"),r),sor={};ckn(sor,{FormDataEncoder:()=>vkn,isFile:()=>Z4,isFormData:()=>cor});por.exports=fkn(sor);var t1=t=>typeof t=="function",pkn=t=>t1(t[Symbol.asyncIterator]),tor=65536;function*uor(t){if(t.byteLength<=tor){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,tor),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*mkn(t){let e=t.getReader();for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}async function*ror(t){for await(let e of t)yield*uor(e)}var hkn=t=>{if(pkn(t))return ror(t);if(t1(t.getReader))return ror(mkn(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},nor="abcdefghijklmnopqrstuvwxyz0123456789";function gkn(){let t=16,e="";for(;t--;)e+=nor[Math.random()*nor.length<<0];return e}var lor=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
|
||
`||e===`
|
||
`&&n[r-1]!=="\r"?`\r
|
||
`:e),ykn=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function oor(t){if(ykn(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function ior(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var bkn=t=>new Proxy(t,{get:(e,r)=>ior(e,r),has:(e,r)=>ior(e,r)!==void 0}),cor=t=>!!(t&&t1(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&t1(t.append)&&t1(t.getAll)&&t1(t.entries)&&t1(t[Symbol.iterator])),aor=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),Z4=t=>!!(t&&typeof t=="object"&&t1(t.constructor)&&t[Symbol.toStringTag]==="File"&&t1(t.stream)&&t.name!=null),_kn={enableAdditionalHeaders:!1},f0e={writable:!1,configurable:!1},EF,_ne,p0e,vne,X4,wne,Sne,m0e,h0e,l9e,a9e,dor,vkn=class{constructor(t,e,r){if(pT(this,h0e),pT(this,a9e),pT(this,EF,`\r
|
||
`),pT(this,_ne,void 0),pT(this,p0e,void 0),pT(this,vne,"-".repeat(2)),pT(this,X4,new TextEncoder),pT(this,wne,void 0),pT(this,Sne,void 0),pT(this,m0e,void 0),!cor(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(oor(e)?r=e:n=e,n||(n=gkn()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!oor(r))throw new TypeError("Expected options argument to be an object.");bne(this,Sne,Array.from(t.entries())),bne(this,m0e,{..._kn,...r}),bne(this,_ne,Pc(this,X4).encode(Pc(this,EF))),bne(this,p0e,Pc(this,_ne).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,bne(this,wne,Pc(this,X4).encode(`${Pc(this,vne)}${this.boundary}${Pc(this,vne)}${Pc(this,EF).repeat(2)}`));let o={"Content-Type":this.contentType},i=i9e(this,a9e,dor).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=bkn(Object.freeze(o)),Object.defineProperties(this,{boundary:f0e,contentType:f0e,contentLength:f0e,headers:f0e})}*values(){for(let[t,e]of Pc(this,Sne)){let r=Z4(e)?e:Pc(this,X4).encode(lor(e));yield i9e(this,h0e,l9e).call(this,t,r),yield r,yield Pc(this,_ne)}yield Pc(this,wne)}async*encode(){for(let t of this.values())Z4(t)?yield*hkn(t.stream()):yield*uor(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};EF=new WeakMap;_ne=new WeakMap;p0e=new WeakMap;vne=new WeakMap;X4=new WeakMap;wne=new WeakMap;Sne=new WeakMap;m0e=new WeakMap;h0e=new WeakSet;l9e=function(t,e){let r="";if(r+=`${Pc(this,vne)}${this.boundary}${Pc(this,EF)}`,r+=`Content-Disposition: form-data; name="${aor(t)}"`,Z4(e)&&(r+=`; filename="${aor(e.name)}"${Pc(this,EF)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),Pc(this,m0e).enableAdditionalHeaders===!0){let n=Z4(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${Pc(this,EF)}Content-Length: ${n}`)}return Pc(this,X4).encode(`${r}${Pc(this,EF).repeat(2)}`)};a9e=new WeakSet;dor=function(){let t=0;for(let[e,r]of Pc(this,Sne)){let n=Z4(r)?r:Pc(this,X4).encode(lor(r)),o=Z4(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=i9e(this,h0e,l9e).call(this,e,n).byteLength,t+=o,t+=Pc(this,p0e)}return String(t+Pc(this,wne).byteLength)}});var gor=S((Zha,hor)=>{"use strict";hor.exports=typeof self=="object"?self.FormData:window.FormData});var yor=S(dg=>{"use strict";var wkn=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]}),Skn=dg&&dg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q5=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"&&wkn(r,e,n[o]);return Skn(r,e),r}}(),PF=dg&&dg.__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(dg,"__esModule",{value:!0});dg.WebFormData=dg.Node16FormData=dg.Node18FormData=void 0;dg.newFormData=Ckn;var g0e=V5();function c9e(t){return typeof t=="object"&&t!=null&&"name"in t}function Ckn(){return PF(this,void 0,void 0,function*(){let t;return g0e.RUNTIME.type==="node"&&g0e.RUNTIME.parsedVersion!=null&&g0e.RUNTIME.parsedVersion>=18?t=new y0e:g0e.RUNTIME.type==="node"?t=new b0e:t=new _0e,yield t.setup(),t})}var y0e=class{setup(){return PF(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>Q5(eor()))).FormData})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){return PF(this,void 0,void 0,function*(){var o,i;n==null&&c9e(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>Q5(ene()))).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 PF(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>Q5(mor()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>Q5(ene()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};dg.Node18FormData=y0e;var b0e=class{setup(){return PF(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>Q5(gor()))).default})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){return PF(this,void 0,void 0,function*(){var o,i;n==null&&c9e(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>Q5(ene()))).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():{}}}};dg.Node16FormData=b0e;var _0e=class{setup(){return PF(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 PF(this,void 0,void 0,function*(){var o;n==null&&c9e(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};dg.WebFormData=_0e});var bor=S(r1=>{"use strict";var xkn=r1&&r1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Okn=r1&&r1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&xkn(e,t,r)};Object.defineProperty(r1,"__esModule",{value:!0});r1.encodeAsFormParameter=void 0;var Tkn=Znr();Object.defineProperty(r1,"encodeAsFormParameter",{enumerable:!0,get:function(){return Tkn.encodeAsFormParameter}});Okn(yor(),r1)});var fh=S(v0e=>{"use strict";Object.defineProperty(v0e,"__esModule",{value:!0});v0e.SchemaType=void 0;v0e.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 gb=S(d9e=>{"use strict";Object.defineProperty(d9e,"__esModule",{value:!0});d9e.getErrorMessageForIncorrectType=Ekn;function Ekn(t,e){return`Expected ${e}. Received ${Pkn(t)}.`}function Pkn(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 mT=S(f9e=>{"use strict";Object.defineProperty(f9e,"__esModule",{value:!0});f9e.maybeSkipValidation=Mkn;function Mkn(t){return Object.assign(Object.assign({},t),{json:_or(t.json),parse:_or(t.parse)})}function _or(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 m9e=S(p9e=>{"use strict";Object.defineProperty(p9e,"__esModule",{value:!0});p9e.stringifyValidationError=Ikn;function Ikn(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}});var g9e=S(w0e=>{"use strict";Object.defineProperty(w0e,"__esModule",{value:!0});w0e.JsonError=void 0;var Rkn=m9e(),h9e=class t extends Error{constructor(e){super(e.map(Rkn.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};w0e.JsonError=h9e});var b9e=S(S0e=>{"use strict";Object.defineProperty(S0e,"__esModule",{value:!0});S0e.ParseError=void 0;var Akn=m9e(),y9e=class t extends Error{constructor(e){super(e.map(Akn.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};S0e.ParseError=y9e});var xor=S(Y4=>{"use strict";Object.defineProperty(Y4,"__esModule",{value:!0});Y4.getSchemaUtils=Cne;Y4.nullable=vor;Y4.optional=wor;Y4.optionalNullable=Sor;Y4.transform=Cor;var _9e=fh(),Nkn=g9e(),jkn=b9e();function Cne(t){return{nullable:()=>vor(t),optional:()=>wor(t),optionalNullable:()=>Sor(t),transform:e=>Cor(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new jkn.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new Nkn.JsonError(n.errors)}}}function vor(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:()=>_9e.SchemaType.NULLABLE};return Object.assign(Object.assign({},e),Cne(e))}function wor(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:()=>_9e.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),Cne(e))}function Sor(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:()=>_9e.SchemaType.OPTIONAL_NULLABLE};return Object.assign(Object.assign({},e),Cne(e))}function Cor(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),Cne(r))}});var p_=S(CS=>{"use strict";Object.defineProperty(CS,"__esModule",{value:!0});CS.ParseError=CS.JsonError=CS.transform=CS.optional=CS.getSchemaUtils=void 0;var v9e=xor();Object.defineProperty(CS,"getSchemaUtils",{enumerable:!0,get:function(){return v9e.getSchemaUtils}});Object.defineProperty(CS,"optional",{enumerable:!0,get:function(){return v9e.optional}});Object.defineProperty(CS,"transform",{enumerable:!0,get:function(){return v9e.transform}});var Dkn=g9e();Object.defineProperty(CS,"JsonError",{enumerable:!0,get:function(){return Dkn.JsonError}});var $kn=b9e();Object.defineProperty(CS,"ParseError",{enumerable:!0,get:function(){return $kn.ParseError}})});var Tor=S(w9e=>{"use strict";Object.defineProperty(w9e,"__esModule",{value:!0});w9e.bigint=qkn;var Lkn=fh(),Oor=gb(),Fkn=mT(),kkn=p_();function qkn(){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,Oor.getErrorMessageForIncorrectType)(e,"bigint | number")}]},json:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="bigint"?{ok:!1,errors:[{path:r,message:(0,Oor.getErrorMessageForIncorrectType)(e,"bigint")}]}:{ok:!0,value:e},getType:()=>Lkn.SchemaType.BIGINT};return Object.assign(Object.assign({},(0,Fkn.maybeSkipValidation)(t)),(0,kkn.getSchemaUtils)(t))}});var Eor=S(C0e=>{"use strict";Object.defineProperty(C0e,"__esModule",{value:!0});C0e.bigint=void 0;var Ukn=Tor();Object.defineProperty(C0e,"bigint",{enumerable:!0,get:function(){return Ukn.bigint}})});var Por=S(C9e=>{"use strict";Object.defineProperty(C9e,"__esModule",{value:!0});C9e.date=Jkn;var Bkn=fh(),S9e=gb(),zkn=mT(),Vkn=p_(),Hkn=/^([+-]?\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 Jkn(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,S9e.getErrorMessageForIncorrectType)(e,"string")}]}:Hkn.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,S9e.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,S9e.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>Bkn.SchemaType.DATE};return Object.assign(Object.assign({},(0,zkn.maybeSkipValidation)(t)),(0,Vkn.getSchemaUtils)(t))}});var Mor=S(x0e=>{"use strict";Object.defineProperty(x0e,"__esModule",{value:!0});x0e.date=void 0;var Wkn=Por();Object.defineProperty(x0e,"date",{enumerable:!0,get:function(){return Wkn.date}})});var n1=S(x9e=>{"use strict";Object.defineProperty(x9e,"__esModule",{value:!0});x9e.createIdentitySchemaCreator=Xkn;var Kkn=p_(),Gkn=mT();function Xkn(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,Gkn.maybeSkipValidation)(r)),(0,Kkn.getSchemaUtils)(r))}}});var Ror=S(O9e=>{"use strict";Object.defineProperty(O9e,"__esModule",{value:!0});O9e.enum_=Qkn;var Zkn=fh(),Ykn=n1(),Ior=gb();function Qkn(t){let e=new Set(t);return(0,Ykn.createIdentitySchemaCreator)(Zkn.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,Ior.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,Ior.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}});var T9e=S(O0e=>{"use strict";Object.defineProperty(O0e,"__esModule",{value:!0});O0e.enum_=void 0;var eqn=Ror();Object.defineProperty(O0e,"enum_",{enumerable:!0,get:function(){return eqn.enum_}})});var E9e=S(xne=>{"use strict";Object.defineProperty(xne,"__esModule",{value:!0});xne.lazy=rqn;xne.constructLazyBaseSchema=Aor;xne.getMemoizedSchema=T0e;var tqn=p_();function rqn(t){let e=Aor(t);return Object.assign(Object.assign({},e),(0,tqn.getSchemaUtils)(e))}function Aor(t){return{parse:(e,r)=>T0e(t).parse(e,r),json:(e,r)=>T0e(t).json(e,r),getType:()=>T0e(t).getType()}}function T0e(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}});var M9e=S(P9e=>{"use strict";Object.defineProperty(P9e,"__esModule",{value:!0});P9e.entries=nqn;function nqn(t){return Object.entries(t)}});var R9e=S(I9e=>{"use strict";Object.defineProperty(I9e,"__esModule",{value:!0});I9e.filterObject=oqn;function oqn(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}});var One=S(A9e=>{"use strict";Object.defineProperty(A9e,"__esModule",{value:!0});A9e.isPlainObject=iqn;function iqn(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 j9e=S(N9e=>{"use strict";Object.defineProperty(N9e,"__esModule",{value:!0});N9e.keys=aqn;function aqn(t){return Object.keys(t)}});var Nor=S(D9e=>{"use strict";Object.defineProperty(D9e,"__esModule",{value:!0});D9e.partition=sqn;function sqn(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}});var $or=S(E0e=>{"use strict";Object.defineProperty(E0e,"__esModule",{value:!0});E0e.getObjectLikeUtils=jor;E0e.withParsedProperties=Dor;var uqn=R9e(),lqn=gb(),cqn=One(),dqn=p_();function jor(t){return{withParsedProperties:e=>Dor(t,e)}}function Dor(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,cqn.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,lqn.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,uqn.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,dqn.getSchemaUtils)(r)),jor(r))}});var Tne=S(eK=>{"use strict";Object.defineProperty(eK,"__esModule",{value:!0});eK.withParsedProperties=eK.getObjectLikeUtils=void 0;var Lor=$or();Object.defineProperty(eK,"getObjectLikeUtils",{enumerable:!0,get:function(){return Lor.getObjectLikeUtils}});Object.defineProperty(eK,"withParsedProperties",{enumerable:!0,get:function(){return Lor.withParsedProperties}})});var $9e=S(P0e=>{"use strict";Object.defineProperty(P0e,"__esModule",{value:!0});P0e.property=fqn;P0e.isProperty=pqn;function fqn(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}function pqn(t){return t.isProperty}});var k9e=S(I0e=>{"use strict";Object.defineProperty(I0e,"__esModule",{value:!0});I0e.object=bqn;I0e.getObjectUtils=M0e;var Q4=fh(),For=M9e(),kor=R9e(),mqn=gb(),hqn=One(),zor=j9e(),gqn=mT(),yqn=Nor(),L9e=Tne(),F9e=p_(),Ene=$9e();function bqn(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,Ene.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,zor.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,For.entries)(t)){let u=(0,Ene.isProperty)(s)?s.rawKey:a,l=(0,Ene.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,Bor(l)&&i.push(u)}return qor({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,For.entries)(t)){let s=(0,Ene.isProperty)(a)?a.valueSchema:a;Bor(s)&&o.push(i)}return qor({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,Ene.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:()=>Q4.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,gqn.maybeSkipValidation)(e)),(0,F9e.getSchemaUtils)(e)),(0,L9e.getObjectLikeUtils)(e)),M0e(e))}function qor({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,hqn.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,mqn.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 M0e(t){return{extend:e=>{let r={_getParsedProperties:()=>[...t._getParsedProperties(),...e._getParsedProperties()],_getRawProperties:()=>[...t._getRawProperties(),...e._getRawProperties()],parse:(n,o)=>Uor({extensionKeys:e._getRawProperties(),value:n,transformBase:i=>t.parse(i,o),transformExtension:i=>e.parse(i,o)}),json:(n,o)=>Uor({extensionKeys:e._getParsedProperties(),value:n,transformBase:i=>t.json(i,o),transformExtension:i=>e.json(i,o)}),getType:()=>Q4.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,F9e.getSchemaUtils)(r)),(0,L9e.getObjectLikeUtils)(r)),M0e(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:()=>Q4.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,F9e.getSchemaUtils)(e)),(0,L9e.getObjectLikeUtils)(e)),M0e(e))}}}function Uor({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,yqn.partition)((0,zor.keys)(e),l=>o.has(l)),s=r((0,kor.filterObject)(e,a)),u=n((0,kor.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 Bor(t){return!_qn(t)}function _qn(t){switch(t.getType()){case Q4.SchemaType.ANY:case Q4.SchemaType.UNKNOWN:case Q4.SchemaType.OPTIONAL:case Q4.SchemaType.OPTIONAL_NULLABLE:return!0;default:return!1}}});var Vor=S(q9e=>{"use strict";Object.defineProperty(q9e,"__esModule",{value:!0});q9e.objectWithoutOptionalProperties=wqn;var vqn=k9e();function wqn(t){return(0,vqn.object)(t)}});var U9e=S(xS=>{"use strict";Object.defineProperty(xS,"__esModule",{value:!0});xS.property=xS.isProperty=xS.objectWithoutOptionalProperties=xS.object=xS.getObjectUtils=void 0;var Hor=k9e();Object.defineProperty(xS,"getObjectUtils",{enumerable:!0,get:function(){return Hor.getObjectUtils}});Object.defineProperty(xS,"object",{enumerable:!0,get:function(){return Hor.object}});var Sqn=Vor();Object.defineProperty(xS,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return Sqn.objectWithoutOptionalProperties}});var Jor=$9e();Object.defineProperty(xS,"isProperty",{enumerable:!0,get:function(){return Jor.isProperty}});Object.defineProperty(xS,"property",{enumerable:!0,get:function(){return Jor.property}})});var Wor=S(z9e=>{"use strict";Object.defineProperty(z9e,"__esModule",{value:!0});z9e.lazyObject=Tqn;var Cqn=U9e(),xqn=Tne(),Oqn=p_(),B9e=E9e();function Tqn(t){let e=Object.assign(Object.assign({},(0,B9e.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,B9e.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,B9e.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,Oqn.getSchemaUtils)(e)),(0,xqn.getObjectLikeUtils)(e)),(0,Cqn.getObjectUtils)(e))}});var Kor=S(tK=>{"use strict";Object.defineProperty(tK,"__esModule",{value:!0});tK.lazyObject=tK.lazy=void 0;var Eqn=E9e();Object.defineProperty(tK,"lazy",{enumerable:!0,get:function(){return Eqn.lazy}});var Pqn=Wor();Object.defineProperty(tK,"lazyObject",{enumerable:!0,get:function(){return Pqn.lazyObject}})});var Xor=S(V9e=>{"use strict";Object.defineProperty(V9e,"__esModule",{value:!0});V9e.list=Nqn;var Mqn=fh(),Iqn=gb(),Rqn=mT(),Aqn=p_();function Nqn(t){let e={parse:(r,n)=>Gor(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)=>Gor(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:()=>Mqn.SchemaType.LIST};return Object.assign(Object.assign({},(0,Rqn.maybeSkipValidation)(e)),(0,Aqn.getSchemaUtils)(e))}function Gor(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,Iqn.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var H9e=S(R0e=>{"use strict";Object.defineProperty(R0e,"__esModule",{value:!0});R0e.list=void 0;var jqn=Xor();Object.defineProperty(R0e,"list",{enumerable:!0,get:function(){return jqn.list}})});var Zor=S(J9e=>{"use strict";Object.defineProperty(J9e,"__esModule",{value:!0});J9e.stringLiteral=Fqn;var Dqn=fh(),$qn=n1(),Lqn=gb();function Fqn(t){return(0,$qn.createIdentitySchemaCreator)(Dqn.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,Lqn.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}});var Yor=S(W9e=>{"use strict";Object.defineProperty(W9e,"__esModule",{value:!0});W9e.booleanLiteral=Bqn;var kqn=fh(),qqn=n1(),Uqn=gb();function Bqn(t){return(0,qqn.createIdentitySchemaCreator)(kqn.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,Uqn.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}});var Qor=S(rK=>{"use strict";Object.defineProperty(rK,"__esModule",{value:!0});rK.booleanLiteral=rK.stringLiteral=void 0;var zqn=Zor();Object.defineProperty(rK,"stringLiteral",{enumerable:!0,get:function(){return zqn.stringLiteral}});var Vqn=Yor();Object.defineProperty(rK,"booleanLiteral",{enumerable:!0,get:function(){return Vqn.booleanLiteral}})});var eir=S(A0e=>{"use strict";Object.defineProperty(A0e,"__esModule",{value:!0});A0e.any=void 0;var Hqn=fh(),Jqn=n1();A0e.any=(0,Jqn.createIdentitySchemaCreator)(Hqn.SchemaType.ANY,t=>({ok:!0,value:t}))});var tir=S(N0e=>{"use strict";Object.defineProperty(N0e,"__esModule",{value:!0});N0e.boolean=void 0;var Wqn=fh(),Kqn=n1(),Gqn=gb();N0e.boolean=(0,Kqn.createIdentitySchemaCreator)(Wqn.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,Gqn.getErrorMessageForIncorrectType)(t,"boolean")}]})});var rir=S(j0e=>{"use strict";Object.defineProperty(j0e,"__esModule",{value:!0});j0e.number=void 0;var Xqn=fh(),Zqn=n1(),Yqn=gb();j0e.number=(0,Zqn.createIdentitySchemaCreator)(Xqn.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,Yqn.getErrorMessageForIncorrectType)(t,"number")}]})});var nir=S(D0e=>{"use strict";Object.defineProperty(D0e,"__esModule",{value:!0});D0e.string=void 0;var Qqn=fh(),eUn=n1(),tUn=gb();D0e.string=(0,eUn.createIdentitySchemaCreator)(Qqn.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,tUn.getErrorMessageForIncorrectType)(t,"string")}]})});var oir=S($0e=>{"use strict";Object.defineProperty($0e,"__esModule",{value:!0});$0e.unknown=void 0;var rUn=fh(),nUn=n1();$0e.unknown=(0,nUn.createIdentitySchemaCreator)(rUn.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var iir=S(OS=>{"use strict";Object.defineProperty(OS,"__esModule",{value:!0});OS.unknown=OS.string=OS.number=OS.boolean=OS.any=void 0;var oUn=eir();Object.defineProperty(OS,"any",{enumerable:!0,get:function(){return oUn.any}});var iUn=tir();Object.defineProperty(OS,"boolean",{enumerable:!0,get:function(){return iUn.boolean}});var aUn=rir();Object.defineProperty(OS,"number",{enumerable:!0,get:function(){return aUn.number}});var sUn=nir();Object.defineProperty(OS,"string",{enumerable:!0,get:function(){return sUn.string}});var uUn=oir();Object.defineProperty(OS,"unknown",{enumerable:!0,get:function(){return uUn.unknown}})});var sir=S(G9e=>{"use strict";Object.defineProperty(G9e,"__esModule",{value:!0});G9e.record=mUn;var K9e=fh(),lUn=M9e(),cUn=gb(),dUn=One(),fUn=mT(),pUn=p_();function mUn(t,e){let r={parse:(n,o)=>air({value:n,isKeyNumeric:t.getType()===K9e.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)=>air({value:n,isKeyNumeric:t.getType()===K9e.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:()=>K9e.SchemaType.RECORD};return Object.assign(Object.assign({},(0,fUn.maybeSkipValidation)(r)),(0,pUn.getSchemaUtils)(r))}function air({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,dUn.isPlainObject)(t)?(0,lUn.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,cUn.getErrorMessageForIncorrectType)(t,"object")}]}}});var uir=S(L0e=>{"use strict";Object.defineProperty(L0e,"__esModule",{value:!0});L0e.record=void 0;var hUn=sir();Object.defineProperty(L0e,"record",{enumerable:!0,get:function(){return hUn.record}})});var lir=S(X9e=>{"use strict";Object.defineProperty(X9e,"__esModule",{value:!0});X9e.set=wUn;var gUn=fh(),yUn=gb(),bUn=mT(),_Un=H9e(),vUn=p_();function wUn(t){let e=(0,_Un.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,yUn.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>gUn.SchemaType.SET};return Object.assign(Object.assign({},(0,bUn.maybeSkipValidation)(r)),(0,vUn.getSchemaUtils)(r))}});var cir=S(F0e=>{"use strict";Object.defineProperty(F0e,"__esModule",{value:!0});F0e.set=void 0;var SUn=lir();Object.defineProperty(F0e,"set",{enumerable:!0,get:function(){return SUn.set}})});var fir=S(Z9e=>{"use strict";Object.defineProperty(Z9e,"__esModule",{value:!0});Z9e.undiscriminatedUnion=TUn;var CUn=fh(),xUn=mT(),OUn=p_();function TUn(t){let e={parse:(r,n)=>dir((o,i)=>o.parse(r,i),t,n),json:(r,n)=>dir((o,i)=>o.json(r,i),t,n),getType:()=>CUn.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,xUn.maybeSkipValidation)(e)),(0,OUn.getSchemaUtils)(e))}function dir(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 pir=S(k0e=>{"use strict";Object.defineProperty(k0e,"__esModule",{value:!0});k0e.undiscriminatedUnion=void 0;var EUn=fir();Object.defineProperty(k0e,"undiscriminatedUnion",{enumerable:!0,get:function(){return EUn.undiscriminatedUnion}})});var mir=S(Y9e=>{"use strict";Object.defineProperty(Y9e,"__esModule",{value:!0});Y9e.discriminant=PUn;function PUn(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}});var gir=S(Pne=>{"use strict";var MUn=Pne&&Pne.__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(Pne,"__esModule",{value:!0});Pne.union=FUn;var IUn=fh(),RUn=gb(),AUn=One(),NUn=j9e(),jUn=mT(),DUn=T9e(),$Un=Tne(),LUn=p_();function FUn(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,DUn.enum_)((0,NUn.keys)(e)),i={parse:(a,s)=>hir({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)=>hir({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:()=>IUn.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,jUn.maybeSkipValidation)(i)),(0,LUn.getSchemaUtils)(i)),(0,$Un.getObjectLikeUtils)(i))}function hir({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,AUn.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,RUn.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=MUn(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 yir=S(nK=>{"use strict";Object.defineProperty(nK,"__esModule",{value:!0});nK.union=nK.discriminant=void 0;var kUn=mir();Object.defineProperty(nK,"discriminant",{enumerable:!0,get:function(){return kUn.discriminant}});var qUn=gir();Object.defineProperty(nK,"union",{enumerable:!0,get:function(){return qUn.union}})});var bir=S(pd=>{"use strict";var UUn=pd&&pd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),m_=pd&&pd.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UUn(e,t,r)};Object.defineProperty(pd,"__esModule",{value:!0});m_(Eor(),pd);m_(Mor(),pd);m_(T9e(),pd);m_(Kor(),pd);m_(H9e(),pd);m_(Qor(),pd);m_(U9e(),pd);m_(Tne(),pd);m_(iir(),pd);m_(uir(),pd);m_(p_(),pd);m_(cir(),pd);m_(pir(),pd);m_(yir(),pd)});var _ir=S(e2=>{"use strict";var BUn=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]}),zUn=e2&&e2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&BUn(e,t,r)};Object.defineProperty(e2,"__esModule",{value:!0});zUn(bir(),e2)});var te=S(fg=>{"use strict";var vir=fg&&fg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VUn=fg&&fg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mne=fg&&fg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vir(e,t,r)},HUn=fg&&fg.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vir(r,e,n[o]);return VUn(r,e),r}}();Object.defineProperty(fg,"__esModule",{value:!0});fg.serialization=void 0;Mne(qnr(),fg);Mne(V5(),fg);Mne(Hnr(),fg);Mne(Xnr(),fg);Mne(bor(),fg);fg.serialization=HUn(_ir())});var Sir=S(pg=>{"use strict";var Ine=pg&&pg.__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())})},Rne=pg&&pg.__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)}},Ll=pg&&pg.__await||function(t){return this instanceof Ll?(this.v=t,this):new Ll(t)},Ane=pg&&pg.__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 Ll?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(pg,"__esModule",{value:!0});pg.LineDecoder=pg.StreamUtils=void 0;pg._iterSSEMessages=wir;pg._decodeChunks=KUn;pg.readableStreamAsyncIterable=t7e;var oK=Tc(),Q9e=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return Ane(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=Rne(wir(e,r)),p;p=yield Ll(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 oK.CohereError({message:`Error: ${h.error}`});yield yield Ll(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 oK.CohereError({message:`Error: ${h.message}, ${h.error}`});yield yield Ll({event:m.event,data:h})}}}}catch(m){s={error:m}}finally{try{!d&&!a&&(u=f.return)&&(yield Ll(u.call(f)))}finally{if(s)throw s.error}}c=!0}catch(m){if(m instanceof Error&&m.name==="AbortError")return yield Ll(void 0);throw m}finally{c||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return Ane(this,arguments,function*(){var s,u,l,c;let d=new MF,f=t7e(e);try{for(var p=!0,m=Rne(f),h;h=yield Ll(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 Ll(g)}}catch(y){u={error:y}}finally{try{!p&&!s&&(l=m.return)&&(yield Ll(l.call(m)))}finally{if(u)throw u.error}}for(let y of d.flush())yield yield Ll(y)})}function i(){return Ane(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=Rne(o()),m;m=yield Ll(p.next()),s=m.done,!s;f=!0){c=m.value,f=!1;let h=c;d||h&&(yield yield Ll(JSON.parse(h)))}}catch(h){u={error:h}}finally{try{!f&&!s&&(l=p.return)&&(yield Ll(l.call(p)))}finally{if(u)throw u.error}}d=!0}catch(h){if(h instanceof Error&&h.name==="AbortError")return yield Ll(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 Ine(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return Ine(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 Ine(this,void 0,void 0,function*(){var o;yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};pg.StreamUtils=Q9e;function wir(t,e){return Ane(this,arguments,function*(){var n,o,i,a;if(!t.body)throw e?.abort(),new oK.CohereError({message:"Attempted to iterate over a response with no body"});let s=new e7e,u=new MF,l=t7e(t.body);try{for(var c=!0,d=Rne(JUn(l)),f;f=yield Ll(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 Ll(h))}}}catch(p){o={error:p}}finally{try{!c&&!n&&(i=d.return)&&(yield Ll(i.call(d)))}finally{if(o)throw o.error}}for(let p of u.flush()){let m=s.decode(p);m&&(yield yield Ll(m))}})}function JUn(t){return Ane(this,arguments,function*(){var r,n,o,i;let a=new Uint8Array;try{for(var s=!0,u=Rne(t),l;l=yield Ll(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=WUn(a))!==-1;)yield yield Ll(a.slice(0,p)),a=a.slice(p)}}catch(c){n={error:c}}finally{try{!s&&!r&&(o=u.return)&&(yield Ll(o.call(u)))}finally{if(n)throw n.error}}a.length>0&&(yield yield Ll(a))})}function WUn(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 e7e=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]=GUn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},MF=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 oK.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 oK.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new oK.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}};pg.LineDecoder=MF;MF.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);MF.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function KUn(t){let e=new MF,r=[];for(let n of t)r.push(...e.decode(n));return r}function GUn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function t7e(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return Ine(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 Ine(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 jne=S(hT=>{"use strict";var XUn=hT&&hT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ZUn=hT&&hT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YUn=hT&&hT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&XUn(r,e,n[o]);return ZUn(r,e),r}}();Object.defineProperty(hT,"__esModule",{value:!0});hT.Document=void 0;var Nne=YUn(te());hT.Document=Nne.serialization.object({data:Nne.serialization.record(Nne.serialization.string(),Nne.serialization.unknown()),id:Nne.serialization.string().optional()})});var r7e=S(gT=>{"use strict";var QUn=gT&&gT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eBn=gT&&gT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tBn=gT&&gT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QUn(r,e,n[o]);return eBn(r,e),r}}();Object.defineProperty(gT,"__esModule",{value:!0});gT.V2ChatStreamRequestDocumentsItem=void 0;var Cir=tBn(te()),rBn=jne();gT.V2ChatStreamRequestDocumentsItem=Cir.serialization.undiscriminatedUnion([Cir.serialization.string(),rBn.Document])});var n7e=S(yT=>{"use strict";var nBn=yT&&yT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oBn=yT&&yT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iBn=yT&&yT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&nBn(r,e,n[o]);return oBn(r,e),r}}();Object.defineProperty(yT,"__esModule",{value:!0});yT.V2ChatStreamRequestSafetyMode=void 0;var aBn=iBn(te());yT.V2ChatStreamRequestSafetyMode=aBn.serialization.enum_(["CONTEXTUAL","STRICT","OFF"])});var o7e=S(bT=>{"use strict";var sBn=bT&&bT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uBn=bT&&bT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lBn=bT&&bT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&sBn(r,e,n[o]);return uBn(r,e),r}}();Object.defineProperty(bT,"__esModule",{value:!0});bT.V2ChatStreamRequestToolChoice=void 0;var cBn=lBn(te());bT.V2ChatStreamRequestToolChoice=cBn.serialization.enum_(["REQUIRED","NONE"])});var i7e=S(_T=>{"use strict";var dBn=_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]}),fBn=_T&&_T.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pBn=_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"&&dBn(r,e,n[o]);return fBn(r,e),r}}();Object.defineProperty(_T,"__esModule",{value:!0});_T.ChatMessageStartEventDeltaMessage=void 0;var xir=pBn(te());_T.ChatMessageStartEventDeltaMessage=xir.serialization.object({role:xir.serialization.stringLiteral("assistant").optional()})});var a7e=S(vT=>{"use strict";var mBn=vT&&vT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hBn=vT&&vT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gBn=vT&&vT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&mBn(r,e,n[o]);return hBn(r,e),r}}();Object.defineProperty(vT,"__esModule",{value:!0});vT.ChatMessageStartEventDelta=void 0;var yBn=gBn(te()),bBn=i7e();vT.ChatMessageStartEventDelta=yBn.serialization.object({message:bBn.ChatMessageStartEventDeltaMessage.optional()})});var kv=S(wT=>{"use strict";var _Bn=wT&&wT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vBn=wT&&wT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wBn=wT&&wT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_Bn(r,e,n[o]);return vBn(r,e),r}}();Object.defineProperty(wT,"__esModule",{value:!0});wT.ChatStreamEventType=void 0;var SBn=wBn(te());wT.ChatStreamEventType=SBn.serialization.object({})});var s7e=S(ST=>{"use strict";var CBn=ST&&ST.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xBn=ST&&ST.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OBn=ST&&ST.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&CBn(r,e,n[o]);return xBn(r,e),r}}();Object.defineProperty(ST,"__esModule",{value:!0});ST.ChatMessageStartEvent=void 0;var Oir=OBn(te()),TBn=a7e(),EBn=kv();ST.ChatMessageStartEvent=Oir.serialization.object({id:Oir.serialization.string().optional(),delta:TBn.ChatMessageStartEventDelta.optional()}).extend(EBn.ChatStreamEventType)});var u7e=S(CT=>{"use strict";var PBn=CT&&CT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),MBn=CT&&CT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IBn=CT&&CT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&PBn(r,e,n[o]);return MBn(r,e),r}}();Object.defineProperty(CT,"__esModule",{value:!0});CT.ChatContentStartEventDeltaMessageContentType=void 0;var RBn=IBn(te());CT.ChatContentStartEventDeltaMessageContentType=RBn.serialization.enum_(["text","thinking"])});var c7e=S(xT=>{"use strict";var ABn=xT&&xT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NBn=xT&&xT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jBn=xT&&xT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ABn(r,e,n[o]);return NBn(r,e),r}}();Object.defineProperty(xT,"__esModule",{value:!0});xT.ChatContentStartEventDeltaMessageContent=void 0;var l7e=jBn(te()),DBn=u7e();xT.ChatContentStartEventDeltaMessageContent=l7e.serialization.object({thinking:l7e.serialization.string().optional(),text:l7e.serialization.string().optional(),type:DBn.ChatContentStartEventDeltaMessageContentType.optional()})});var d7e=S(OT=>{"use strict";var $Bn=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]}),LBn=OT&&OT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FBn=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"&&$Bn(r,e,n[o]);return LBn(r,e),r}}();Object.defineProperty(OT,"__esModule",{value:!0});OT.ChatContentStartEventDeltaMessage=void 0;var kBn=FBn(te()),qBn=c7e();OT.ChatContentStartEventDeltaMessage=kBn.serialization.object({content:qBn.ChatContentStartEventDeltaMessageContent.optional()})});var f7e=S(TT=>{"use strict";var UBn=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]}),BBn=TT&&TT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zBn=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"&&UBn(r,e,n[o]);return BBn(r,e),r}}();Object.defineProperty(TT,"__esModule",{value:!0});TT.ChatContentStartEventDelta=void 0;var VBn=zBn(te()),HBn=d7e();TT.ChatContentStartEventDelta=VBn.serialization.object({message:HBn.ChatContentStartEventDeltaMessage.optional()})});var p7e=S(ET=>{"use strict";var JBn=ET&&ET.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WBn=ET&&ET.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KBn=ET&&ET.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&JBn(r,e,n[o]);return WBn(r,e),r}}();Object.defineProperty(ET,"__esModule",{value:!0});ET.ChatContentStartEvent=void 0;var Tir=KBn(te()),GBn=f7e(),XBn=kv();ET.ChatContentStartEvent=Tir.serialization.object({index:Tir.serialization.number().optional(),delta:GBn.ChatContentStartEventDelta.optional()}).extend(XBn.ChatStreamEventType)});var h7e=S(PT=>{"use strict";var ZBn=PT&&PT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),YBn=PT&&PT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QBn=PT&&PT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZBn(r,e,n[o]);return YBn(r,e),r}}();Object.defineProperty(PT,"__esModule",{value:!0});PT.ChatContentDeltaEventDeltaMessageContent=void 0;var m7e=QBn(te());PT.ChatContentDeltaEventDeltaMessageContent=m7e.serialization.object({thinking:m7e.serialization.string().optional(),text:m7e.serialization.string().optional()})});var g7e=S(MT=>{"use strict";var ezn=MT&&MT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tzn=MT&&MT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rzn=MT&&MT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 tzn(r,e),r}}();Object.defineProperty(MT,"__esModule",{value:!0});MT.ChatContentDeltaEventDeltaMessage=void 0;var nzn=rzn(te()),ozn=h7e();MT.ChatContentDeltaEventDeltaMessage=nzn.serialization.object({content:ozn.ChatContentDeltaEventDeltaMessageContent.optional()})});var y7e=S(IT=>{"use strict";var izn=IT&&IT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),azn=IT&&IT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),szn=IT&&IT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(IT,"__esModule",{value:!0});IT.ChatContentDeltaEventDelta=void 0;var uzn=szn(te()),lzn=g7e();IT.ChatContentDeltaEventDelta=uzn.serialization.object({message:lzn.ChatContentDeltaEventDeltaMessage.optional()})});var q0e=S(RT=>{"use strict";var czn=RT&&RT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dzn=RT&&RT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fzn=RT&&RT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 dzn(r,e),r}}();Object.defineProperty(RT,"__esModule",{value:!0});RT.LogprobItem=void 0;var t2=fzn(te());RT.LogprobItem=t2.serialization.object({text:t2.serialization.string().optional(),tokenIds:t2.serialization.property("token_ids",t2.serialization.list(t2.serialization.number())),logprobs:t2.serialization.list(t2.serialization.number()).optional()})});var b7e=S(AT=>{"use strict";var pzn=AT&&AT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mzn=AT&&AT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hzn=AT&&AT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&pzn(r,e,n[o]);return mzn(r,e),r}}();Object.defineProperty(AT,"__esModule",{value:!0});AT.ChatContentDeltaEvent=void 0;var Eir=hzn(te()),gzn=y7e(),yzn=q0e(),bzn=kv();AT.ChatContentDeltaEvent=Eir.serialization.object({index:Eir.serialization.number().optional(),delta:gzn.ChatContentDeltaEventDelta.optional(),logprobs:yzn.LogprobItem.optional()}).extend(bzn.ChatStreamEventType)});var _7e=S(NT=>{"use strict";var _zn=NT&&NT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=NT&&NT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wzn=NT&&NT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(NT,"__esModule",{value:!0});NT.ChatContentEndEvent=void 0;var Pir=wzn(te()),Szn=kv();NT.ChatContentEndEvent=Pir.serialization.object({index:Pir.serialization.number().optional()}).extend(Szn.ChatStreamEventType)});var w7e=S(jT=>{"use strict";var Czn=jT&&jT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xzn=jT&&jT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ozn=jT&&jT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(jT,"__esModule",{value:!0});jT.ChatToolPlanDeltaEventDeltaMessage=void 0;var v7e=Ozn(te());jT.ChatToolPlanDeltaEventDeltaMessage=v7e.serialization.object({toolPlan:v7e.serialization.property("tool_plan",v7e.serialization.string().optional())})});var S7e=S(DT=>{"use strict";var Tzn=DT&&DT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=DT&&DT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pzn=DT&&DT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Tzn(r,e,n[o]);return Ezn(r,e),r}}();Object.defineProperty(DT,"__esModule",{value:!0});DT.ChatToolPlanDeltaEventDelta=void 0;var Mzn=Pzn(te()),Izn=w7e();DT.ChatToolPlanDeltaEventDelta=Mzn.serialization.object({message:Izn.ChatToolPlanDeltaEventDeltaMessage.optional()})});var C7e=S($T=>{"use strict";var Rzn=$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]}),Azn=$T&&$T.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nzn=$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"&&Rzn(r,e,n[o]);return Azn(r,e),r}}();Object.defineProperty($T,"__esModule",{value:!0});$T.ChatToolPlanDeltaEvent=void 0;var jzn=Nzn(te()),Dzn=S7e(),$zn=kv();$T.ChatToolPlanDeltaEvent=jzn.serialization.object({delta:Dzn.ChatToolPlanDeltaEventDelta.optional()}).extend($zn.ChatStreamEventType)});var O7e=S(LT=>{"use strict";var Lzn=LT&<.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Fzn=LT&<.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kzn=LT&<.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Lzn(r,e,n[o]);return Fzn(r,e),r}}();Object.defineProperty(LT,"__esModule",{value:!0});LT.ToolCallV2Function=void 0;var x7e=kzn(te());LT.ToolCallV2Function=x7e.serialization.object({name:x7e.serialization.string().optional(),arguments:x7e.serialization.string().optional()})});var Dne=S(FT=>{"use strict";var qzn=FT&&FT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=FT&&FT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bzn=FT&&FT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qzn(r,e,n[o]);return Uzn(r,e),r}}();Object.defineProperty(FT,"__esModule",{value:!0});FT.ToolCallV2=void 0;var T7e=Bzn(te()),zzn=O7e();FT.ToolCallV2=T7e.serialization.object({id:T7e.serialization.string().optional(),type:T7e.serialization.stringLiteral("function").optional(),function:zzn.ToolCallV2Function.optional()})});var E7e=S(kT=>{"use strict";var Vzn=kT&&kT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hzn=kT&&kT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jzn=kT&&kT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Vzn(r,e,n[o]);return Hzn(r,e),r}}();Object.defineProperty(kT,"__esModule",{value:!0});kT.ChatToolCallStartEventDeltaMessage=void 0;var Mir=Jzn(te()),Wzn=Dne();kT.ChatToolCallStartEventDeltaMessage=Mir.serialization.object({toolCalls:Mir.serialization.property("tool_calls",Wzn.ToolCallV2.optional())})});var P7e=S(qT=>{"use strict";var Kzn=qT&&qT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gzn=qT&&qT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xzn=qT&&qT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Kzn(r,e,n[o]);return Gzn(r,e),r}}();Object.defineProperty(qT,"__esModule",{value:!0});qT.ChatToolCallStartEventDelta=void 0;var Zzn=Xzn(te()),Yzn=E7e();qT.ChatToolCallStartEventDelta=Zzn.serialization.object({message:Yzn.ChatToolCallStartEventDeltaMessage.optional()})});var M7e=S(UT=>{"use strict";var Qzn=UT&&UT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e4n=UT&&UT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t4n=UT&&UT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Qzn(r,e,n[o]);return e4n(r,e),r}}();Object.defineProperty(UT,"__esModule",{value:!0});UT.ChatToolCallStartEvent=void 0;var Iir=t4n(te()),r4n=P7e(),n4n=kv();UT.ChatToolCallStartEvent=Iir.serialization.object({index:Iir.serialization.number().optional(),delta:r4n.ChatToolCallStartEventDelta.optional()}).extend(n4n.ChatStreamEventType)});var I7e=S(BT=>{"use strict";var o4n=BT&&BT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i4n=BT&&BT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a4n=BT&&BT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&o4n(r,e,n[o]);return i4n(r,e),r}}();Object.defineProperty(BT,"__esModule",{value:!0});BT.ChatToolCallDeltaEventDeltaMessageToolCallsFunction=void 0;var Rir=a4n(te());BT.ChatToolCallDeltaEventDeltaMessageToolCallsFunction=Rir.serialization.object({arguments:Rir.serialization.string().optional()})});var R7e=S(zT=>{"use strict";var s4n=zT&&zT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u4n=zT&&zT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l4n=zT&&zT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&s4n(r,e,n[o]);return u4n(r,e),r}}();Object.defineProperty(zT,"__esModule",{value:!0});zT.ChatToolCallDeltaEventDeltaMessageToolCalls=void 0;var c4n=l4n(te()),d4n=I7e();zT.ChatToolCallDeltaEventDeltaMessageToolCalls=c4n.serialization.object({function:d4n.ChatToolCallDeltaEventDeltaMessageToolCallsFunction.optional()})});var A7e=S(VT=>{"use strict";var f4n=VT&&VT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p4n=VT&&VT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m4n=VT&&VT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 p4n(r,e),r}}();Object.defineProperty(VT,"__esModule",{value:!0});VT.ChatToolCallDeltaEventDeltaMessage=void 0;var Air=m4n(te()),h4n=R7e();VT.ChatToolCallDeltaEventDeltaMessage=Air.serialization.object({toolCalls:Air.serialization.property("tool_calls",h4n.ChatToolCallDeltaEventDeltaMessageToolCalls.optional())})});var N7e=S(HT=>{"use strict";var g4n=HT&&HT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y4n=HT&&HT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b4n=HT&&HT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&g4n(r,e,n[o]);return y4n(r,e),r}}();Object.defineProperty(HT,"__esModule",{value:!0});HT.ChatToolCallDeltaEventDelta=void 0;var _4n=b4n(te()),v4n=A7e();HT.ChatToolCallDeltaEventDelta=_4n.serialization.object({message:v4n.ChatToolCallDeltaEventDeltaMessage.optional()})});var j7e=S(JT=>{"use strict";var w4n=JT&&JT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),S4n=JT&&JT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C4n=JT&&JT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&w4n(r,e,n[o]);return S4n(r,e),r}}();Object.defineProperty(JT,"__esModule",{value:!0});JT.ChatToolCallDeltaEvent=void 0;var Nir=C4n(te()),x4n=N7e(),O4n=kv();JT.ChatToolCallDeltaEvent=Nir.serialization.object({index:Nir.serialization.number().optional(),delta:x4n.ChatToolCallDeltaEventDelta.optional()}).extend(O4n.ChatStreamEventType)});var D7e=S(WT=>{"use strict";var T4n=WT&&WT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E4n=WT&&WT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P4n=WT&&WT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T4n(r,e,n[o]);return E4n(r,e),r}}();Object.defineProperty(WT,"__esModule",{value:!0});WT.ChatToolCallEndEvent=void 0;var jir=P4n(te()),M4n=kv();WT.ChatToolCallEndEvent=jir.serialization.object({index:jir.serialization.number().optional()}).extend(M4n.ChatStreamEventType)});var $7e=S(KT=>{"use strict";var I4n=KT&&KT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R4n=KT&&KT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A4n=KT&&KT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 R4n(r,e),r}}();Object.defineProperty(KT,"__esModule",{value:!0});KT.ChatToolSource=void 0;var iK=A4n(te());KT.ChatToolSource=iK.serialization.object({id:iK.serialization.string().optional(),toolOutput:iK.serialization.property("tool_output",iK.serialization.record(iK.serialization.string(),iK.serialization.unknown()).optional())})});var L7e=S(GT=>{"use strict";var N4n=GT&>.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),j4n=GT&>.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D4n=GT&>.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&N4n(r,e,n[o]);return j4n(r,e),r}}();Object.defineProperty(GT,"__esModule",{value:!0});GT.ChatDocumentSource=void 0;var $ne=D4n(te());GT.ChatDocumentSource=$ne.serialization.object({id:$ne.serialization.string().optional(),document:$ne.serialization.record($ne.serialization.string(),$ne.serialization.unknown()).optional()})});var F7e=S(XT=>{"use strict";var $4n=XT&&XT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L4n=XT&&XT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F4n=XT&&XT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$4n(r,e,n[o]);return L4n(r,e),r}}();Object.defineProperty(XT,"__esModule",{value:!0});XT.Source=void 0;var k4n=F4n(te()),q4n=$7e(),U4n=L7e();XT.Source=k4n.serialization.union("type",{tool:q4n.ChatToolSource,document:U4n.ChatDocumentSource}).transform({transform:t=>t,untransform:t=>t})});var k7e=S(ZT=>{"use strict";var B4n=ZT&&ZT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4n=ZT&&ZT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V4n=ZT&&ZT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&B4n(r,e,n[o]);return z4n(r,e),r}}();Object.defineProperty(ZT,"__esModule",{value:!0});ZT.CitationType=void 0;var H4n=V4n(te());ZT.CitationType=H4n.serialization.enum_(["TEXT_CONTENT","THINKING_CONTENT","PLAN"])});var Lne=S(YT=>{"use strict";var J4n=YT&&YT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W4n=YT&&YT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K4n=YT&&YT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 W4n(r,e),r}}();Object.defineProperty(YT,"__esModule",{value:!0});YT.Citation=void 0;var r2=K4n(te()),G4n=F7e(),X4n=k7e();YT.Citation=r2.serialization.object({start:r2.serialization.number().optional(),end:r2.serialization.number().optional(),text:r2.serialization.string().optional(),sources:r2.serialization.list(G4n.Source).optional(),contentIndex:r2.serialization.property("content_index",r2.serialization.number().optional()),type:X4n.CitationType.optional()})});var q7e=S(QT=>{"use strict";var Z4n=QT&&QT.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y4n=QT&&QT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q4n=QT&&QT.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 Y4n(r,e),r}}();Object.defineProperty(QT,"__esModule",{value:!0});QT.CitationStartEventDeltaMessage=void 0;var e2n=Q4n(te()),t2n=Lne();QT.CitationStartEventDeltaMessage=e2n.serialization.object({citations:t2n.Citation.optional()})});var U7e=S(eE=>{"use strict";var r2n=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]}),n2n=eE&&eE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o2n=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"&&r2n(r,e,n[o]);return n2n(r,e),r}}();Object.defineProperty(eE,"__esModule",{value:!0});eE.CitationStartEventDelta=void 0;var i2n=o2n(te()),a2n=q7e();eE.CitationStartEventDelta=i2n.serialization.object({message:a2n.CitationStartEventDeltaMessage.optional()})});var B7e=S(tE=>{"use strict";var s2n=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]}),u2n=tE&&tE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l2n=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"&&s2n(r,e,n[o]);return u2n(r,e),r}}();Object.defineProperty(tE,"__esModule",{value:!0});tE.CitationStartEvent=void 0;var Dir=l2n(te()),c2n=U7e(),d2n=kv();tE.CitationStartEvent=Dir.serialization.object({index:Dir.serialization.number().optional(),delta:c2n.CitationStartEventDelta.optional()}).extend(d2n.ChatStreamEventType)});var z7e=S(rE=>{"use strict";var f2n=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]}),p2n=rE&&rE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m2n=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"&&f2n(r,e,n[o]);return p2n(r,e),r}}();Object.defineProperty(rE,"__esModule",{value:!0});rE.CitationEndEvent=void 0;var $ir=m2n(te()),h2n=kv();rE.CitationEndEvent=$ir.serialization.object({index:$ir.serialization.number().optional()}).extend(h2n.ChatStreamEventType)});var U0e=S(nE=>{"use strict";var g2n=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]}),y2n=nE&&nE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b2n=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"&&g2n(r,e,n[o]);return y2n(r,e),r}}();Object.defineProperty(nE,"__esModule",{value:!0});nE.ChatFinishReason=void 0;var _2n=b2n(te());nE.ChatFinishReason=_2n.serialization.enum_(["COMPLETE","STOP_SEQUENCE","MAX_TOKENS","TOOL_CALL","ERROR"])});var V7e=S(oE=>{"use strict";var v2n=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]}),w2n=oE&&oE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S2n=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"&&v2n(r,e,n[o]);return w2n(r,e),r}}();Object.defineProperty(oE,"__esModule",{value:!0});oE.UsageBilledUnits=void 0;var IF=S2n(te());oE.UsageBilledUnits=IF.serialization.object({inputTokens:IF.serialization.property("input_tokens",IF.serialization.number().optional()),outputTokens:IF.serialization.property("output_tokens",IF.serialization.number().optional()),searchUnits:IF.serialization.property("search_units",IF.serialization.number().optional()),classifications:IF.serialization.number().optional()})});var H7e=S(iE=>{"use strict";var C2n=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]}),x2n=iE&&iE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O2n=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"&&C2n(r,e,n[o]);return x2n(r,e),r}}();Object.defineProperty(iE,"__esModule",{value:!0});iE.UsageTokens=void 0;var Fne=O2n(te());iE.UsageTokens=Fne.serialization.object({inputTokens:Fne.serialization.property("input_tokens",Fne.serialization.number().optional()),outputTokens:Fne.serialization.property("output_tokens",Fne.serialization.number().optional())})});var B0e=S(aE=>{"use strict";var T2n=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]}),E2n=aE&&aE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P2n=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"&&T2n(r,e,n[o]);return E2n(r,e),r}}();Object.defineProperty(aE,"__esModule",{value:!0});aE.Usage=void 0;var Lir=P2n(te()),M2n=V7e(),I2n=H7e();aE.Usage=Lir.serialization.object({billedUnits:Lir.serialization.property("billed_units",M2n.UsageBilledUnits.optional()),tokens:I2n.UsageTokens.optional()})});var W7e=S(sE=>{"use strict";var R2n=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]}),A2n=sE&&sE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N2n=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"&&R2n(r,e,n[o]);return A2n(r,e),r}}();Object.defineProperty(sE,"__esModule",{value:!0});sE.ChatMessageEndEventDelta=void 0;var J7e=N2n(te()),j2n=U0e(),D2n=B0e();sE.ChatMessageEndEventDelta=J7e.serialization.object({error:J7e.serialization.string().optional(),finishReason:J7e.serialization.property("finish_reason",j2n.ChatFinishReason.optional()),usage:D2n.Usage.optional()})});var K7e=S(uE=>{"use strict";var $2n=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]}),L2n=uE&&uE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F2n=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"&&$2n(r,e,n[o]);return L2n(r,e),r}}();Object.defineProperty(uE,"__esModule",{value:!0});uE.ChatMessageEndEvent=void 0;var Fir=F2n(te()),k2n=W7e(),q2n=kv();uE.ChatMessageEndEvent=Fir.serialization.object({id:Fir.serialization.string().optional(),delta:k2n.ChatMessageEndEventDelta.optional()}).extend(q2n.ChatStreamEventType)});var OC=S(lE=>{"use strict";var U2n=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]}),B2n=lE&&lE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z2n=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"&&U2n(r,e,n[o]);return B2n(r,e),r}}();Object.defineProperty(lE,"__esModule",{value:!0});lE.ChatStreamEvent=void 0;var V2n=z2n(te());lE.ChatStreamEvent=V2n.serialization.object({})});var z0e=S(cE=>{"use strict";var H2n=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]}),J2n=cE&&cE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W2n=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"&&H2n(r,e,n[o]);return J2n(r,e),r}}();Object.defineProperty(cE,"__esModule",{value:!0});cE.ChatDebugEvent=void 0;var kir=W2n(te()),K2n=OC();cE.ChatDebugEvent=kir.serialization.object({prompt:kir.serialization.string().optional()}).extend(K2n.ChatStreamEvent)});var qir=S(dE=>{"use strict";var G2n=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]}),X2n=dE&&dE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z2n=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"&&G2n(r,e,n[o]);return X2n(r,e),r}}();Object.defineProperty(dE,"__esModule",{value:!0});dE.V2ChatStreamResponse=void 0;var Y2n=Z2n(te()),Q2n=s7e(),eVn=p7e(),tVn=b7e(),rVn=_7e(),nVn=C7e(),oVn=M7e(),iVn=j7e(),aVn=D7e(),sVn=B7e(),uVn=z7e(),lVn=K7e(),cVn=z0e();dE.V2ChatStreamResponse=Y2n.serialization.union("type",{"message-start":Q2n.ChatMessageStartEvent,"content-start":eVn.ChatContentStartEvent,"content-delta":tVn.ChatContentDeltaEvent,"content-end":rVn.ChatContentEndEvent,"tool-plan-delta":nVn.ChatToolPlanDeltaEvent,"tool-call-start":oVn.ChatToolCallStartEvent,"tool-call-delta":iVn.ChatToolCallDeltaEvent,"tool-call-end":aVn.ChatToolCallEndEvent,"citation-start":sVn.CitationStartEvent,"citation-end":uVn.CitationEndEvent,"message-end":lVn.ChatMessageEndEvent,debug:cVn.ChatDebugEvent}).transform({transform:t=>t,untransform:t=>t})});var G7e=S(fE=>{"use strict";var dVn=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]}),fVn=fE&&fE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pVn=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"&&dVn(r,e,n[o]);return fVn(r,e),r}}();Object.defineProperty(fE,"__esModule",{value:!0});fE.V2ChatRequestDocumentsItem=void 0;var Uir=pVn(te()),mVn=jne();fE.V2ChatRequestDocumentsItem=Uir.serialization.undiscriminatedUnion([Uir.serialization.string(),mVn.Document])});var X7e=S(pE=>{"use strict";var hVn=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]}),gVn=pE&&pE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yVn=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"&&hVn(r,e,n[o]);return gVn(r,e),r}}();Object.defineProperty(pE,"__esModule",{value:!0});pE.V2ChatRequestSafetyMode=void 0;var bVn=yVn(te());pE.V2ChatRequestSafetyMode=bVn.serialization.enum_(["CONTEXTUAL","STRICT","OFF"])});var Z7e=S(mE=>{"use strict";var _Vn=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]}),vVn=mE&&mE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wVn=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"&&_Vn(r,e,n[o]);return vVn(r,e),r}}();Object.defineProperty(mE,"__esModule",{value:!0});mE.V2ChatRequestToolChoice=void 0;var SVn=wVn(te());mE.V2ChatRequestToolChoice=SVn.serialization.enum_(["REQUIRED","NONE"])});var n2=S(hE=>{"use strict";var CVn=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]}),xVn=hE&&hE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OVn=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"&&CVn(r,e,n[o]);return xVn(r,e),r}}();Object.defineProperty(hE,"__esModule",{value:!0});hE.ChatTextContent=void 0;var Bir=OVn(te());hE.ChatTextContent=Bir.serialization.object({text:Bir.serialization.string()})});var V0e=S(gE=>{"use strict";var TVn=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]}),EVn=gE&&gE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PVn=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"&&TVn(r,e,n[o]);return EVn(r,e),r}}();Object.defineProperty(gE,"__esModule",{value:!0});gE.ChatThinkingContent=void 0;var zir=PVn(te());gE.ChatThinkingContent=zir.serialization.object({thinking:zir.serialization.string()})});var Y7e=S(yE=>{"use strict";var MVn=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]}),IVn=yE&&yE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RVn=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"&&MVn(r,e,n[o]);return IVn(r,e),r}}();Object.defineProperty(yE,"__esModule",{value:!0});yE.AssistantMessageResponseContentItem=void 0;var AVn=RVn(te()),NVn=n2(),jVn=V0e();yE.AssistantMessageResponseContentItem=AVn.serialization.union("type",{text:NVn.ChatTextContent,thinking:jVn.ChatThinkingContent}).transform({transform:t=>t,untransform:t=>t})});var Q7e=S(bE=>{"use strict";var DVn=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]}),$Vn=bE&&bE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LVn=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"&&DVn(r,e,n[o]);return $Vn(r,e),r}}();Object.defineProperty(bE,"__esModule",{value:!0});bE.AssistantMessageResponse=void 0;var RF=LVn(te()),FVn=Dne(),kVn=Y7e(),qVn=Lne();bE.AssistantMessageResponse=RF.serialization.object({role:RF.serialization.stringLiteral("assistant"),toolCalls:RF.serialization.property("tool_calls",RF.serialization.list(FVn.ToolCallV2).optional()),toolPlan:RF.serialization.property("tool_plan",RF.serialization.string().optional()),content:RF.serialization.list(kVn.AssistantMessageResponseContentItem).optional(),citations:RF.serialization.list(qVn.Citation).optional()})});var Vir=S(_E=>{"use strict";var UVn=_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}),zVn=_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"&&UVn(r,e,n[o]);return BVn(r,e),r}}();Object.defineProperty(_E,"__esModule",{value:!0});_E.V2ChatResponse=void 0;var H0e=zVn(te()),VVn=U0e(),HVn=Q7e(),JVn=B0e(),WVn=q0e();_E.V2ChatResponse=H0e.serialization.object({id:H0e.serialization.string(),finishReason:H0e.serialization.property("finish_reason",VVn.ChatFinishReason),message:HVn.AssistantMessageResponse,usage:JVn.Usage.optional(),logprobs:H0e.serialization.list(WVn.LogprobItem).optional()})});var eXe=S(vE=>{"use strict";var KVn=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]}),GVn=vE&&vE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XVn=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"&&KVn(r,e,n[o]);return GVn(r,e),r}}();Object.defineProperty(vE,"__esModule",{value:!0});vE.V2EmbedRequestTruncate=void 0;var ZVn=XVn(te());vE.V2EmbedRequestTruncate=ZVn.serialization.enum_(["NONE","START","END"])});var tXe=S(wE=>{"use strict";var YVn=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]}),QVn=wE&&wE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eHn=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"&&YVn(r,e,n[o]);return QVn(r,e),r}}();Object.defineProperty(wE,"__esModule",{value:!0});wE.V2RerankResponseResultsItem=void 0;var J0e=eHn(te());wE.V2RerankResponseResultsItem=J0e.serialization.object({index:J0e.serialization.number(),relevanceScore:J0e.serialization.property("relevance_score",J0e.serialization.number())})});var rXe=S(SE=>{"use strict";var tHn=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]}),rHn=SE&&SE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nHn=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"&&tHn(r,e,n[o]);return rHn(r,e),r}}();Object.defineProperty(SE,"__esModule",{value:!0});SE.ApiMetaApiVersion=void 0;var aK=nHn(te());SE.ApiMetaApiVersion=aK.serialization.object({version:aK.serialization.string(),isDeprecated:aK.serialization.property("is_deprecated",aK.serialization.boolean().optional()),isExperimental:aK.serialization.property("is_experimental",aK.serialization.boolean().optional())})});var nXe=S(CE=>{"use strict";var oHn=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]}),iHn=CE&&CE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aHn=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"&&oHn(r,e,n[o]);return iHn(r,e),r}}();Object.defineProperty(CE,"__esModule",{value:!0});CE.ApiMetaBilledUnits=void 0;var o1=aHn(te());CE.ApiMetaBilledUnits=o1.serialization.object({images:o1.serialization.number().optional(),inputTokens:o1.serialization.property("input_tokens",o1.serialization.number().optional()),outputTokens:o1.serialization.property("output_tokens",o1.serialization.number().optional()),searchUnits:o1.serialization.property("search_units",o1.serialization.number().optional()),classifications:o1.serialization.number().optional()})});var oXe=S(xE=>{"use strict";var sHn=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]}),uHn=xE&&xE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lHn=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"&&sHn(r,e,n[o]);return uHn(r,e),r}}();Object.defineProperty(xE,"__esModule",{value:!0});xE.ApiMetaTokens=void 0;var kne=lHn(te());xE.ApiMetaTokens=kne.serialization.object({inputTokens:kne.serialization.property("input_tokens",kne.serialization.number().optional()),outputTokens:kne.serialization.property("output_tokens",kne.serialization.number().optional())})});var h_=S(OE=>{"use strict";var cHn=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]}),dHn=OE&&OE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fHn=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"&&cHn(r,e,n[o]);return dHn(r,e),r}}();Object.defineProperty(OE,"__esModule",{value:!0});OE.ApiMeta=void 0;var qne=fHn(te()),pHn=rXe(),mHn=nXe(),hHn=oXe();OE.ApiMeta=qne.serialization.object({apiVersion:qne.serialization.property("api_version",pHn.ApiMetaApiVersion.optional()),billedUnits:qne.serialization.property("billed_units",mHn.ApiMetaBilledUnits.optional()),tokens:hHn.ApiMetaTokens.optional(),warnings:qne.serialization.list(qne.serialization.string()).optional()})});var Hir=S(TE=>{"use strict";var gHn=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]}),yHn=TE&&TE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bHn=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"&&gHn(r,e,n[o]);return yHn(r,e),r}}();Object.defineProperty(TE,"__esModule",{value:!0});TE.V2RerankResponse=void 0;var iXe=bHn(te()),_Hn=tXe(),vHn=h_();TE.V2RerankResponse=iXe.serialization.object({id:iXe.serialization.string().optional(),results:iXe.serialization.list(_Hn.V2RerankResponseResultsItem),meta:vHn.ApiMeta.optional()})});var aXe=S(mg=>{"use strict";var wHn=mg&&mg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),TC=mg&&mg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&wHn(e,t,r)};Object.defineProperty(mg,"__esModule",{value:!0});TC(r7e(),mg);TC(n7e(),mg);TC(o7e(),mg);TC(qir(),mg);TC(G7e(),mg);TC(X7e(),mg);TC(Z7e(),mg);TC(Vir(),mg);TC(eXe(),mg);TC(tXe(),mg);TC(Hir(),mg)});var sXe=S(EE=>{"use strict";var SHn=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]}),CHn=EE&&EE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xHn=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"&&SHn(r,e,n[o]);return CHn(r,e),r}}();Object.defineProperty(EE,"__esModule",{value:!0});EE.ImageUrlDetail=void 0;var OHn=xHn(te());EE.ImageUrlDetail=OHn.serialization.enum_(["auto","low","high"])});var uXe=S(PE=>{"use strict";var THn=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]}),EHn=PE&&PE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PHn=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"&&THn(r,e,n[o]);return EHn(r,e),r}}();Object.defineProperty(PE,"__esModule",{value:!0});PE.ImageUrl=void 0;var Jir=PHn(te()),MHn=sXe();PE.ImageUrl=Jir.serialization.object({url:Jir.serialization.string(),detail:MHn.ImageUrlDetail.optional()})});var lXe=S(ME=>{"use strict";var IHn=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]}),RHn=ME&&ME.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AHn=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"&&IHn(r,e,n[o]);return RHn(r,e),r}}();Object.defineProperty(ME,"__esModule",{value:!0});ME.ImageContent=void 0;var Wir=AHn(te()),NHn=uXe();ME.ImageContent=Wir.serialization.object({imageUrl:Wir.serialization.property("image_url",NHn.ImageUrl)})});var cXe=S(IE=>{"use strict";var jHn=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]}),DHn=IE&&IE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Hn=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"&&jHn(r,e,n[o]);return DHn(r,e),r}}();Object.defineProperty(IE,"__esModule",{value:!0});IE.Content=void 0;var LHn=$Hn(te()),FHn=n2(),kHn=lXe();IE.Content=LHn.serialization.union("type",{text:FHn.ChatTextContent,image_url:kHn.ImageContent}).transform({transform:t=>t,untransform:t=>t})});var fXe=S(RE=>{"use strict";var qHn=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]}),UHn=RE&&RE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BHn=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"&&qHn(r,e,n[o]);return UHn(r,e),r}}();Object.defineProperty(RE,"__esModule",{value:!0});RE.UserMessageV2Content=void 0;var dXe=BHn(te()),zHn=cXe();RE.UserMessageV2Content=dXe.serialization.undiscriminatedUnion([dXe.serialization.string(),dXe.serialization.list(zHn.Content)])});var pXe=S(AE=>{"use strict";var VHn=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]}),HHn=AE&&AE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JHn=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"&&VHn(r,e,n[o]);return HHn(r,e),r}}();Object.defineProperty(AE,"__esModule",{value:!0});AE.UserMessageV2=void 0;var WHn=JHn(te()),KHn=fXe();AE.UserMessageV2=WHn.serialization.object({content:KHn.UserMessageV2Content})});var mXe=S(NE=>{"use strict";var GHn=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]}),XHn=NE&&NE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZHn=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"&&GHn(r,e,n[o]);return XHn(r,e),r}}();Object.defineProperty(NE,"__esModule",{value:!0});NE.AssistantMessageV2ContentItem=void 0;var YHn=ZHn(te()),QHn=n2(),eJn=V0e();NE.AssistantMessageV2ContentItem=YHn.serialization.union("type",{text:QHn.ChatTextContent,thinking:eJn.ChatThinkingContent}).transform({transform:t=>t,untransform:t=>t})});var gXe=S(jE=>{"use strict";var tJn=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]}),rJn=jE&&jE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nJn=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"&&tJn(r,e,n[o]);return rJn(r,e),r}}();Object.defineProperty(jE,"__esModule",{value:!0});jE.AssistantMessageV2Content=void 0;var hXe=nJn(te()),oJn=mXe();jE.AssistantMessageV2Content=hXe.serialization.undiscriminatedUnion([hXe.serialization.string(),hXe.serialization.list(oJn.AssistantMessageV2ContentItem)])});var yXe=S(DE=>{"use strict";var iJn=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]}),aJn=DE&&DE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sJn=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"&&iJn(r,e,n[o]);return aJn(r,e),r}}();Object.defineProperty(DE,"__esModule",{value:!0});DE.AssistantMessage=void 0;var sK=sJn(te()),uJn=Dne(),lJn=gXe(),cJn=Lne();DE.AssistantMessage=sK.serialization.object({toolCalls:sK.serialization.property("tool_calls",sK.serialization.list(uJn.ToolCallV2).optional()),toolPlan:sK.serialization.property("tool_plan",sK.serialization.string().optional()),content:lJn.AssistantMessageV2Content.optional(),citations:sK.serialization.list(cJn.Citation).optional()})});var bXe=S($E=>{"use strict";var dJn=$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]}),fJn=$E&&$E.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pJn=$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"&&dJn(r,e,n[o]);return fJn(r,e),r}}();Object.defineProperty($E,"__esModule",{value:!0});$E.SystemMessageV2ContentItem=void 0;var mJn=pJn(te()),hJn=n2();$E.SystemMessageV2ContentItem=mJn.serialization.union("type",{text:hJn.ChatTextContent}).transform({transform:t=>t,untransform:t=>t})});var vXe=S(LE=>{"use strict";var gJn=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]}),yJn=LE&&LE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bJn=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"&&gJn(r,e,n[o]);return yJn(r,e),r}}();Object.defineProperty(LE,"__esModule",{value:!0});LE.SystemMessageV2Content=void 0;var _Xe=bJn(te()),_Jn=bXe();LE.SystemMessageV2Content=_Xe.serialization.undiscriminatedUnion([_Xe.serialization.string(),_Xe.serialization.list(_Jn.SystemMessageV2ContentItem)])});var wXe=S(FE=>{"use strict";var vJn=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]}),wJn=FE&&FE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SJn=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"&&vJn(r,e,n[o]);return wJn(r,e),r}}();Object.defineProperty(FE,"__esModule",{value:!0});FE.SystemMessageV2=void 0;var CJn=SJn(te()),xJn=vXe();FE.SystemMessageV2=CJn.serialization.object({content:xJn.SystemMessageV2Content})});var SXe=S(kE=>{"use strict";var OJn=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]}),TJn=kE&&kE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EJn=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"&&OJn(r,e,n[o]);return TJn(r,e),r}}();Object.defineProperty(kE,"__esModule",{value:!0});kE.DocumentContent=void 0;var PJn=EJn(te()),MJn=jne();kE.DocumentContent=PJn.serialization.object({document:MJn.Document})});var CXe=S(qE=>{"use strict";var IJn=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]}),RJn=qE&&qE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AJn=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"&&IJn(r,e,n[o]);return RJn(r,e),r}}();Object.defineProperty(qE,"__esModule",{value:!0});qE.ToolContent=void 0;var NJn=AJn(te()),jJn=n2(),DJn=SXe();qE.ToolContent=NJn.serialization.union("type",{text:jJn.ChatTextContent,document:DJn.DocumentContent}).transform({transform:t=>t,untransform:t=>t})});var OXe=S(UE=>{"use strict";var $Jn=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]}),LJn=UE&&UE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FJn=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"&&$Jn(r,e,n[o]);return LJn(r,e),r}}();Object.defineProperty(UE,"__esModule",{value:!0});UE.ToolMessageV2Content=void 0;var xXe=FJn(te()),kJn=CXe();UE.ToolMessageV2Content=xXe.serialization.undiscriminatedUnion([xXe.serialization.string(),xXe.serialization.list(kJn.ToolContent)])});var EXe=S(BE=>{"use strict";var qJn=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]}),UJn=BE&&BE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BJn=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"&&qJn(r,e,n[o]);return UJn(r,e),r}}();Object.defineProperty(BE,"__esModule",{value:!0});BE.ToolMessageV2=void 0;var TXe=BJn(te()),zJn=OXe();BE.ToolMessageV2=TXe.serialization.object({toolCallId:TXe.serialization.property("tool_call_id",TXe.serialization.string()),content:zJn.ToolMessageV2Content})});var PXe=S(zE=>{"use strict";var VJn=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]}),HJn=zE&&zE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JJn=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"&&VJn(r,e,n[o]);return HJn(r,e),r}}();Object.defineProperty(zE,"__esModule",{value:!0});zE.ChatMessageV2=void 0;var WJn=JJn(te()),KJn=pXe(),GJn=yXe(),XJn=wXe(),ZJn=EXe();zE.ChatMessageV2=WJn.serialization.union("role",{user:KJn.UserMessageV2,assistant:GJn.AssistantMessage,system:XJn.SystemMessageV2,tool:ZJn.ToolMessageV2}).transform({transform:t=>t,untransform:t=>t})});var W0e=S(VE=>{"use strict";var YJn=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]}),QJn=VE&&VE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e3n=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"&&YJn(r,e,n[o]);return QJn(r,e),r}}();Object.defineProperty(VE,"__esModule",{value:!0});VE.ChatMessages=void 0;var t3n=e3n(te()),r3n=PXe();VE.ChatMessages=t3n.serialization.list(r3n.ChatMessageV2)});var MXe=S(HE=>{"use strict";var n3n=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]}),o3n=HE&&HE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i3n=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"&&n3n(r,e,n[o]);return o3n(r,e),r}}();Object.defineProperty(HE,"__esModule",{value:!0});HE.ToolV2Function=void 0;var uK=i3n(te());HE.ToolV2Function=uK.serialization.object({name:uK.serialization.string(),description:uK.serialization.string().optional(),parameters:uK.serialization.record(uK.serialization.string(),uK.serialization.unknown())})});var K0e=S(JE=>{"use strict";var a3n=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]}),s3n=JE&&JE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u3n=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"&&a3n(r,e,n[o]);return s3n(r,e),r}}();Object.defineProperty(JE,"__esModule",{value:!0});JE.ToolV2=void 0;var Kir=u3n(te()),l3n=MXe();JE.ToolV2=Kir.serialization.object({type:Kir.serialization.stringLiteral("function").optional(),function:l3n.ToolV2Function.optional()})});var IXe=S(WE=>{"use strict";var c3n=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]}),d3n=WE&&WE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f3n=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"&&c3n(r,e,n[o]);return d3n(r,e),r}}();Object.defineProperty(WE,"__esModule",{value:!0});WE.CitationOptionsMode=void 0;var p3n=f3n(te());WE.CitationOptionsMode=p3n.serialization.enum_(["FAST","ACCURATE","OFF"])});var G0e=S(KE=>{"use strict";var m3n=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]}),h3n=KE&&KE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g3n=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"&&m3n(r,e,n[o]);return h3n(r,e),r}}();Object.defineProperty(KE,"__esModule",{value:!0});KE.CitationOptions=void 0;var y3n=g3n(te()),b3n=IXe();KE.CitationOptions=y3n.serialization.object({mode:b3n.CitationOptionsMode.optional()})});var RXe=S(GE=>{"use strict";var _3n=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]}),v3n=GE&&GE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w3n=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"&&_3n(r,e,n[o]);return v3n(r,e),r}}();Object.defineProperty(GE,"__esModule",{value:!0});GE.ChatTextResponseFormatV2=void 0;var S3n=w3n(te());GE.ChatTextResponseFormatV2=S3n.serialization.object({})});var AXe=S(XE=>{"use strict";var C3n=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]}),x3n=XE&&XE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O3n=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"&&C3n(r,e,n[o]);return x3n(r,e),r}}();Object.defineProperty(XE,"__esModule",{value:!0});XE.JsonResponseFormatV2=void 0;var Une=O3n(te());XE.JsonResponseFormatV2=Une.serialization.object({jsonSchema:Une.serialization.property("json_schema",Une.serialization.record(Une.serialization.string(),Une.serialization.unknown()).optional())})});var X0e=S(ZE=>{"use strict";var T3n=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]}),E3n=ZE&&ZE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P3n=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"&&T3n(r,e,n[o]);return E3n(r,e),r}}();Object.defineProperty(ZE,"__esModule",{value:!0});ZE.ResponseFormatV2=void 0;var M3n=P3n(te()),I3n=RXe(),R3n=AXe();ZE.ResponseFormatV2=M3n.serialization.union("type",{text:I3n.ChatTextResponseFormatV2,json_object:R3n.JsonResponseFormatV2}).transform({transform:t=>t,untransform:t=>t})});var NXe=S(YE=>{"use strict";var A3n=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]}),N3n=YE&&YE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j3n=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"&&A3n(r,e,n[o]);return N3n(r,e),r}}();Object.defineProperty(YE,"__esModule",{value:!0});YE.ThinkingType=void 0;var D3n=j3n(te());YE.ThinkingType=D3n.serialization.enum_(["enabled","disabled"])});var Z0e=S(QE=>{"use strict";var $3n=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]}),L3n=QE&&QE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F3n=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"&&$3n(r,e,n[o]);return L3n(r,e),r}}();Object.defineProperty(QE,"__esModule",{value:!0});QE.Thinking=void 0;var jXe=F3n(te()),k3n=NXe();QE.Thinking=jXe.serialization.object({type:k3n.ThinkingType,tokenBudget:jXe.serialization.property("token_budget",jXe.serialization.number().optional())})});var Gir=S(eP=>{"use strict";var q3n=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]}),U3n=eP&&eP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B3n=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"&&q3n(r,e,n[o]);return U3n(r,e),r}}();Object.defineProperty(eP,"__esModule",{value:!0});eP.V2ChatStreamRequest=void 0;var Fl=B3n(te()),z3n=W0e(),V3n=K0e(),H3n=r7e(),J3n=G0e(),W3n=X0e(),K3n=n7e(),G3n=o7e(),X3n=Z0e();eP.V2ChatStreamRequest=Fl.serialization.object({model:Fl.serialization.string(),messages:z3n.ChatMessages,tools:Fl.serialization.list(V3n.ToolV2).optional(),strictTools:Fl.serialization.property("strict_tools",Fl.serialization.boolean().optional()),documents:Fl.serialization.list(H3n.V2ChatStreamRequestDocumentsItem).optional(),citationOptions:Fl.serialization.property("citation_options",J3n.CitationOptions.optional()),responseFormat:Fl.serialization.property("response_format",W3n.ResponseFormatV2.optional()),safetyMode:Fl.serialization.property("safety_mode",K3n.V2ChatStreamRequestSafetyMode.optional()),maxTokens:Fl.serialization.property("max_tokens",Fl.serialization.number().optional()),stopSequences:Fl.serialization.property("stop_sequences",Fl.serialization.list(Fl.serialization.string()).optional()),temperature:Fl.serialization.number().optional(),seed:Fl.serialization.number().optional(),frequencyPenalty:Fl.serialization.property("frequency_penalty",Fl.serialization.number().optional()),presencePenalty:Fl.serialization.property("presence_penalty",Fl.serialization.number().optional()),k:Fl.serialization.number().optional(),p:Fl.serialization.number().optional(),logprobs:Fl.serialization.boolean().optional(),toolChoice:Fl.serialization.property("tool_choice",G3n.V2ChatStreamRequestToolChoice.optional()),thinking:X3n.Thinking.optional()})});var Xir=S(tP=>{"use strict";var Z3n=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]}),Y3n=tP&&tP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q3n=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"&&Z3n(r,e,n[o]);return Y3n(r,e),r}}();Object.defineProperty(tP,"__esModule",{value:!0});tP.V2ChatRequest=void 0;var kl=Q3n(te()),eWn=W0e(),tWn=K0e(),rWn=G7e(),nWn=G0e(),oWn=X0e(),iWn=X7e(),aWn=Z7e(),sWn=Z0e();tP.V2ChatRequest=kl.serialization.object({model:kl.serialization.string(),messages:eWn.ChatMessages,tools:kl.serialization.list(tWn.ToolV2).optional(),strictTools:kl.serialization.property("strict_tools",kl.serialization.boolean().optional()),documents:kl.serialization.list(rWn.V2ChatRequestDocumentsItem).optional(),citationOptions:kl.serialization.property("citation_options",nWn.CitationOptions.optional()),responseFormat:kl.serialization.property("response_format",oWn.ResponseFormatV2.optional()),safetyMode:kl.serialization.property("safety_mode",iWn.V2ChatRequestSafetyMode.optional()),maxTokens:kl.serialization.property("max_tokens",kl.serialization.number().optional()),stopSequences:kl.serialization.property("stop_sequences",kl.serialization.list(kl.serialization.string()).optional()),temperature:kl.serialization.number().optional(),seed:kl.serialization.number().optional(),frequencyPenalty:kl.serialization.property("frequency_penalty",kl.serialization.number().optional()),presencePenalty:kl.serialization.property("presence_penalty",kl.serialization.number().optional()),k:kl.serialization.number().optional(),p:kl.serialization.number().optional(),logprobs:kl.serialization.boolean().optional(),toolChoice:kl.serialization.property("tool_choice",aWn.V2ChatRequestToolChoice.optional()),thinking:sWn.Thinking.optional()})});var Bne=S(rP=>{"use strict";var uWn=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]}),lWn=rP&&rP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cWn=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"&&uWn(r,e,n[o]);return lWn(r,e),r}}();Object.defineProperty(rP,"__esModule",{value:!0});rP.EmbedInputType=void 0;var dWn=cWn(te());rP.EmbedInputType=dWn.serialization.enum_(["search_document","search_query","classification","clustering","image"])});var DXe=S(nP=>{"use strict";var fWn=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]}),pWn=nP&&nP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mWn=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"&&fWn(r,e,n[o]);return pWn(r,e),r}}();Object.defineProperty(nP,"__esModule",{value:!0});nP.EmbedImageUrl=void 0;var Zir=mWn(te());nP.EmbedImageUrl=Zir.serialization.object({url:Zir.serialization.string()})});var $Xe=S(oP=>{"use strict";var hWn=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]}),gWn=oP&&oP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yWn=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"&&hWn(r,e,n[o]);return gWn(r,e),r}}();Object.defineProperty(oP,"__esModule",{value:!0});oP.EmbedImage=void 0;var Yir=yWn(te()),bWn=DXe();oP.EmbedImage=Yir.serialization.object({imageUrl:Yir.serialization.property("image_url",bWn.EmbedImageUrl.optional())})});var LXe=S(iP=>{"use strict";var _Wn=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}),wWn=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"&&_Wn(r,e,n[o]);return vWn(r,e),r}}();Object.defineProperty(iP,"__esModule",{value:!0});iP.EmbedText=void 0;var Qir=wWn(te());iP.EmbedText=Qir.serialization.object({text:Qir.serialization.string().optional()})});var FXe=S(aP=>{"use strict";var SWn=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]}),CWn=aP&&aP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xWn=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"&&SWn(r,e,n[o]);return CWn(r,e),r}}();Object.defineProperty(aP,"__esModule",{value:!0});aP.EmbedContent=void 0;var OWn=xWn(te()),TWn=$Xe(),EWn=LXe();aP.EmbedContent=OWn.serialization.union("type",{image_url:TWn.EmbedImage,text:EWn.EmbedText}).transform({transform:t=>t,untransform:t=>t})});var kXe=S(sP=>{"use strict";var PWn=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]}),MWn=sP&&sP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IWn=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"&&PWn(r,e,n[o]);return MWn(r,e),r}}();Object.defineProperty(sP,"__esModule",{value:!0});sP.EmbedInput=void 0;var ear=IWn(te()),RWn=FXe();sP.EmbedInput=ear.serialization.object({content:ear.serialization.list(RWn.EmbedContent)})});var zne=S(uP=>{"use strict";var AWn=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]}),NWn=uP&&uP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jWn=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"&&AWn(r,e,n[o]);return NWn(r,e),r}}();Object.defineProperty(uP,"__esModule",{value:!0});uP.EmbeddingType=void 0;var DWn=jWn(te());uP.EmbeddingType=DWn.serialization.enum_(["float","int8","uint8","binary","ubinary","base64"])});var tar=S(lP=>{"use strict";var $Wn=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]}),LWn=lP&&lP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FWn=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"&&$Wn(r,e,n[o]);return LWn(r,e),r}}();Object.defineProperty(lP,"__esModule",{value:!0});lP.V2EmbedRequest=void 0;var g_=FWn(te()),kWn=Bne(),qWn=kXe(),UWn=zne(),BWn=eXe();lP.V2EmbedRequest=g_.serialization.object({texts:g_.serialization.list(g_.serialization.string()).optional(),images:g_.serialization.list(g_.serialization.string()).optional(),model:g_.serialization.string(),inputType:g_.serialization.property("input_type",kWn.EmbedInputType),inputs:g_.serialization.list(qWn.EmbedInput).optional(),maxTokens:g_.serialization.property("max_tokens",g_.serialization.number().optional()),outputDimension:g_.serialization.property("output_dimension",g_.serialization.number().optional()),embeddingTypes:g_.serialization.property("embedding_types",g_.serialization.list(UWn.EmbeddingType).optional()),truncate:BWn.V2EmbedRequestTruncate.optional()})});var rar=S(cP=>{"use strict";var zWn=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]}),VWn=cP&&cP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HWn=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"&&zWn(r,e,n[o]);return VWn(r,e),r}}();Object.defineProperty(cP,"__esModule",{value:!0});cP.V2RerankRequest=void 0;var i1=HWn(te());cP.V2RerankRequest=i1.serialization.object({model:i1.serialization.string(),query:i1.serialization.string(),documents:i1.serialization.list(i1.serialization.string()),topN:i1.serialization.property("top_n",i1.serialization.number().optional()),maxTokensPerDoc:i1.serialization.property("max_tokens_per_doc",i1.serialization.number().optional())})});var qXe=S(dP=>{"use strict";Object.defineProperty(dP,"__esModule",{value:!0});dP.V2RerankRequest=dP.V2EmbedRequest=dP.V2ChatRequest=dP.V2ChatStreamRequest=void 0;var JWn=Gir();Object.defineProperty(dP,"V2ChatStreamRequest",{enumerable:!0,get:function(){return JWn.V2ChatStreamRequest}});var WWn=Xir();Object.defineProperty(dP,"V2ChatRequest",{enumerable:!0,get:function(){return WWn.V2ChatRequest}});var KWn=tar();Object.defineProperty(dP,"V2EmbedRequest",{enumerable:!0,get:function(){return KWn.V2EmbedRequest}});var GWn=rar();Object.defineProperty(dP,"V2RerankRequest",{enumerable:!0,get:function(){return GWn.V2RerankRequest}})});var nar=S(o2=>{"use strict";var XWn=o2&&o2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=o2&&o2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&XWn(e,t,r)};Object.defineProperty(o2,"__esModule",{value:!0});ZWn(qXe(),o2)});var iar=S(AF=>{"use strict";var YWn=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]}),oar=AF&&AF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&YWn(e,t,r)};Object.defineProperty(AF,"__esModule",{value:!0});oar(aXe(),AF);oar(nar(),AF)});var UXe=S(fP=>{"use strict";var QWn=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]}),e6n=fP&&fP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t6n=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"&&QWn(r,e,n[o]);return e6n(r,e),r}}();Object.defineProperty(fP,"__esModule",{value:!0});fP.CreateEmbedJobRequestTruncate=void 0;var r6n=t6n(te());fP.CreateEmbedJobRequestTruncate=r6n.serialization.enum_(["START","END"])});var BXe=S(i2=>{"use strict";var n6n=i2&&i2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=i2&&i2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&n6n(e,t,r)};Object.defineProperty(i2,"__esModule",{value:!0});o6n(UXe(),i2)});var aar=S(pP=>{"use strict";var i6n=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]}),a6n=pP&&pP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s6n=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"&&i6n(r,e,n[o]);return a6n(r,e),r}}();Object.defineProperty(pP,"__esModule",{value:!0});pP.CreateEmbedJobRequest=void 0;var NF=s6n(te()),u6n=Bne(),l6n=zne(),c6n=UXe();pP.CreateEmbedJobRequest=NF.serialization.object({model:NF.serialization.string(),datasetId:NF.serialization.property("dataset_id",NF.serialization.string()),inputType:NF.serialization.property("input_type",u6n.EmbedInputType),name:NF.serialization.string().optional(),embeddingTypes:NF.serialization.property("embedding_types",NF.serialization.list(l6n.EmbeddingType).optional()),truncate:c6n.CreateEmbedJobRequestTruncate.optional()})});var zXe=S(Y0e=>{"use strict";Object.defineProperty(Y0e,"__esModule",{value:!0});Y0e.CreateEmbedJobRequest=void 0;var d6n=aar();Object.defineProperty(Y0e,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return d6n.CreateEmbedJobRequest}})});var sar=S(a2=>{"use strict";var f6n=a2&&a2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),p6n=a2&&a2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&f6n(e,t,r)};Object.defineProperty(a2,"__esModule",{value:!0});p6n(zXe(),a2)});var lar=S(jF=>{"use strict";var m6n=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]}),uar=jF&&jF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&m6n(e,t,r)};Object.defineProperty(jF,"__esModule",{value:!0});uar(BXe(),jF);uar(sar(),jF)});var VXe=S(mP=>{"use strict";var h6n=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]}),g6n=mP&&mP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y6n=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"&&h6n(r,e,n[o]);return g6n(r,e),r}}();Object.defineProperty(mP,"__esModule",{value:!0});mP.DatasetType=void 0;var b6n=y6n(te());mP.DatasetType=b6n.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 HXe=S(hP=>{"use strict";var _6n=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]}),v6n=hP&&hP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w6n=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"&&_6n(r,e,n[o]);return v6n(r,e),r}}();Object.defineProperty(hP,"__esModule",{value:!0});hP.DatasetValidationStatus=void 0;var S6n=w6n(te());hP.DatasetValidationStatus=S6n.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var JXe=S(gP=>{"use strict";var C6n=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]}),x6n=gP&&gP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O6n=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"&&C6n(r,e,n[o]);return x6n(r,e),r}}();Object.defineProperty(gP,"__esModule",{value:!0});gP.DatasetPart=void 0;var qv=O6n(te());gP.DatasetPart=qv.serialization.object({id:qv.serialization.string(),name:qv.serialization.string(),url:qv.serialization.string().optional(),index:qv.serialization.number().optional(),sizeBytes:qv.serialization.property("size_bytes",qv.serialization.number().optional()),numRows:qv.serialization.property("num_rows",qv.serialization.number().optional()),originalUrl:qv.serialization.property("original_url",qv.serialization.string().optional()),samples:qv.serialization.list(qv.serialization.string()).optional()})});var Q0e=S(yP=>{"use strict";var T6n=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]}),E6n=yP&&yP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P6n=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"&&T6n(r,e,n[o]);return E6n(r,e),r}}();Object.defineProperty(yP,"__esModule",{value:!0});yP.Dataset=void 0;var fc=P6n(te()),M6n=VXe(),I6n=HXe(),R6n=JXe();yP.Dataset=fc.serialization.object({id:fc.serialization.string(),name:fc.serialization.string(),createdAt:fc.serialization.property("created_at",fc.serialization.date()),updatedAt:fc.serialization.property("updated_at",fc.serialization.date()),datasetType:fc.serialization.property("dataset_type",M6n.DatasetType),validationStatus:fc.serialization.property("validation_status",I6n.DatasetValidationStatus),validationError:fc.serialization.property("validation_error",fc.serialization.string().optional()),schema:fc.serialization.string().optional(),requiredFields:fc.serialization.property("required_fields",fc.serialization.list(fc.serialization.string()).optional()),preserveFields:fc.serialization.property("preserve_fields",fc.serialization.list(fc.serialization.string()).optional()),datasetParts:fc.serialization.property("dataset_parts",fc.serialization.list(R6n.DatasetPart).optional()),validationWarnings:fc.serialization.property("validation_warnings",fc.serialization.list(fc.serialization.string()).optional())})});var dar=S(bP=>{"use strict";var A6n=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]}),N6n=bP&&bP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j6n=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"&&A6n(r,e,n[o]);return N6n(r,e),r}}();Object.defineProperty(bP,"__esModule",{value:!0});bP.DatasetsListResponse=void 0;var car=j6n(te()),D6n=Q0e();bP.DatasetsListResponse=car.serialization.object({datasets:car.serialization.list(D6n.Dataset).optional()})});var par=S(_P=>{"use strict";var $6n=_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]}),L6n=_P&&_P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F6n=_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"&&$6n(r,e,n[o]);return L6n(r,e),r}}();Object.defineProperty(_P,"__esModule",{value:!0});_P.DatasetsCreateResponse=void 0;var far=F6n(te());_P.DatasetsCreateResponse=far.serialization.object({id:far.serialization.string().optional()})});var mar=S(vP=>{"use strict";var k6n=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]}),q6n=vP&&vP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U6n=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"&&k6n(r,e,n[o]);return q6n(r,e),r}}();Object.defineProperty(vP,"__esModule",{value:!0});vP.DatasetsGetUsageResponse=void 0;var WXe=U6n(te());vP.DatasetsGetUsageResponse=WXe.serialization.object({organizationUsage:WXe.serialization.property("organization_usage",WXe.serialization.number().optional())})});var har=S(wP=>{"use strict";var B6n=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]}),z6n=wP&&wP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V6n=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"&&B6n(r,e,n[o]);return z6n(r,e),r}}();Object.defineProperty(wP,"__esModule",{value:!0});wP.DatasetsGetResponse=void 0;var H6n=V6n(te()),J6n=Q0e();wP.DatasetsGetResponse=H6n.serialization.object({dataset:J6n.Dataset})});var KXe=S(SP=>{"use strict";var W6n=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]}),eCe=SP&&SP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&W6n(e,t,r)};Object.defineProperty(SP,"__esModule",{value:!0});eCe(dar(),SP);eCe(par(),SP);eCe(mar(),SP);eCe(har(),SP)});var gar=S(CP=>{"use strict";var K6n=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]}),G6n=CP&&CP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X6n=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"&&K6n(r,e,n[o]);return G6n(r,e),r}}();Object.defineProperty(CP,"__esModule",{value:!0});CP.Response=void 0;var GXe=X6n(te());CP.Response=GXe.serialization.record(GXe.serialization.string(),GXe.serialization.unknown())});var yar=S(xP=>{"use strict";var Z6n=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]}),Y6n=xP&&xP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q6n=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"&&Z6n(r,e,n[o]);return Y6n(r,e),r}}();Object.defineProperty(xP,"__esModule",{value:!0});xP.delete=void 0;xP.delete=Q6n(gar())});var _ar=S(DF=>{"use strict";var e5n=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]}),bar=DF&&DF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&e5n(e,t,r)};Object.defineProperty(DF,"__esModule",{value:!0});bar(KXe(),DF);bar(yar(),DF)});var XXe=S(OP=>{"use strict";var t5n=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]}),r5n=OP&&OP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n5n=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"&&t5n(r,e,n[o]);return r5n(r,e),r}}();Object.defineProperty(OP,"__esModule",{value:!0});OP.BaseType=void 0;var o5n=n5n(te());OP.BaseType=o5n.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var ZXe=S(TP=>{"use strict";var i5n=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]}),a5n=TP&&TP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s5n=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"&&i5n(r,e,n[o]);return a5n(r,e),r}}();Object.defineProperty(TP,"__esModule",{value:!0});TP.Strategy=void 0;var u5n=s5n(te());TP.Strategy=u5n.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var YXe=S(EP=>{"use strict";var l5n=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]}),c5n=EP&&EP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d5n=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"&&l5n(r,e,n[o]);return c5n(r,e),r}}();Object.defineProperty(EP,"__esModule",{value:!0});EP.BaseModel=void 0;var tCe=d5n(te()),f5n=XXe(),p5n=ZXe();EP.BaseModel=tCe.serialization.object({name:tCe.serialization.string().optional(),version:tCe.serialization.string().optional(),baseType:tCe.serialization.property("base_type",f5n.BaseType),strategy:p5n.Strategy.optional()})});var QXe=S(PP=>{"use strict";var m5n=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]}),h5n=PP&&PP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g5n=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"&&m5n(r,e,n[o]);return h5n(r,e),r}}();Object.defineProperty(PP,"__esModule",{value:!0});PP.LoraTargetModules=void 0;var y5n=g5n(te());PP.LoraTargetModules=y5n.serialization.enum_(["LORA_TARGET_MODULES_UNSPECIFIED","LORA_TARGET_MODULES_QV","LORA_TARGET_MODULES_QKVO","LORA_TARGET_MODULES_QKVO_FFN"])});var eZe=S(MP=>{"use strict";var b5n=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]}),_5n=MP&&MP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v5n=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"&&b5n(r,e,n[o]);return _5n(r,e),r}}();Object.defineProperty(MP,"__esModule",{value:!0});MP.Hyperparameters=void 0;var _y=v5n(te()),w5n=QXe();MP.Hyperparameters=_y.serialization.object({earlyStoppingPatience:_y.serialization.property("early_stopping_patience",_y.serialization.number().optional()),earlyStoppingThreshold:_y.serialization.property("early_stopping_threshold",_y.serialization.number().optional()),trainBatchSize:_y.serialization.property("train_batch_size",_y.serialization.number().optional()),trainEpochs:_y.serialization.property("train_epochs",_y.serialization.number().optional()),learningRate:_y.serialization.property("learning_rate",_y.serialization.number().optional()),loraAlpha:_y.serialization.property("lora_alpha",_y.serialization.number().optional()),loraRank:_y.serialization.property("lora_rank",_y.serialization.number().optional()),loraTargetModules:_y.serialization.property("lora_target_modules",w5n.LoraTargetModules.optional())})});var tZe=S(IP=>{"use strict";var S5n=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]}),C5n=IP&&IP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x5n=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"&&S5n(r,e,n[o]);return C5n(r,e),r}}();Object.defineProperty(IP,"__esModule",{value:!0});IP.WandbConfig=void 0;var Vne=x5n(te());IP.WandbConfig=Vne.serialization.object({project:Vne.serialization.string(),apiKey:Vne.serialization.property("api_key",Vne.serialization.string()),entity:Vne.serialization.string().optional()})});var rCe=S(RP=>{"use strict";var O5n=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]}),T5n=RP&&RP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E5n=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"&&O5n(r,e,n[o]);return T5n(r,e),r}}();Object.defineProperty(RP,"__esModule",{value:!0});RP.Settings=void 0;var lK=E5n(te()),P5n=YXe(),M5n=eZe(),I5n=tZe();RP.Settings=lK.serialization.object({baseModel:lK.serialization.property("base_model",P5n.BaseModel),datasetId:lK.serialization.property("dataset_id",lK.serialization.string()),hyperparameters:M5n.Hyperparameters.optional(),multiLabel:lK.serialization.property("multi_label",lK.serialization.boolean().optional()),wandb:I5n.WandbConfig.optional()})});var Hne=S(AP=>{"use strict";var R5n=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]}),A5n=AP&&AP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N5n=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"&&R5n(r,e,n[o]);return A5n(r,e),r}}();Object.defineProperty(AP,"__esModule",{value:!0});AP.Status=void 0;var j5n=N5n(te());AP.Status=j5n.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var cK=S(NP=>{"use strict";var D5n=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]}),$5n=NP&&NP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L5n=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"&&D5n(r,e,n[o]);return $5n(r,e),r}}();Object.defineProperty(NP,"__esModule",{value:!0});NP.FinetunedModel=void 0;var yb=L5n(te()),F5n=rCe(),k5n=Hne();NP.FinetunedModel=yb.serialization.object({id:yb.serialization.string().optional(),name:yb.serialization.string(),creatorId:yb.serialization.property("creator_id",yb.serialization.string().optional()),organizationId:yb.serialization.property("organization_id",yb.serialization.string().optional()),settings:F5n.Settings,status:k5n.Status.optional(),createdAt:yb.serialization.property("created_at",yb.serialization.date().optional()),updatedAt:yb.serialization.property("updated_at",yb.serialization.date().optional()),completedAt:yb.serialization.property("completed_at",yb.serialization.date().optional()),lastUsed:yb.serialization.property("last_used",yb.serialization.date().optional())})});var war=S(jP=>{"use strict";var q5n=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]}),U5n=jP&&jP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B5n=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"&&q5n(r,e,n[o]);return U5n(r,e),r}}();Object.defineProperty(jP,"__esModule",{value:!0});jP.ListFinetunedModelsResponse=void 0;var s2=B5n(te()),z5n=cK();jP.ListFinetunedModelsResponse=s2.serialization.object({finetunedModels:s2.serialization.property("finetuned_models",s2.serialization.list(z5n.FinetunedModel).optional()),nextPageToken:s2.serialization.property("next_page_token",s2.serialization.string().optional()),totalSize:s2.serialization.property("total_size",s2.serialization.number().optional())})});var Car=S(DP=>{"use strict";var V5n=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]}),H5n=DP&&DP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J5n=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"&&V5n(r,e,n[o]);return H5n(r,e),r}}();Object.defineProperty(DP,"__esModule",{value:!0});DP.CreateFinetunedModelResponse=void 0;var Sar=J5n(te()),W5n=cK();DP.CreateFinetunedModelResponse=Sar.serialization.object({finetunedModel:Sar.serialization.property("finetuned_model",W5n.FinetunedModel.optional())})});var Oar=S($P=>{"use strict";var K5n=$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]}),G5n=$P&&$P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X5n=$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"&&K5n(r,e,n[o]);return G5n(r,e),r}}();Object.defineProperty($P,"__esModule",{value:!0});$P.GetFinetunedModelResponse=void 0;var xar=X5n(te()),Z5n=cK();$P.GetFinetunedModelResponse=xar.serialization.object({finetunedModel:xar.serialization.property("finetuned_model",Z5n.FinetunedModel.optional())})});var Tar=S(LP=>{"use strict";var Y5n=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]}),Q5n=LP&&LP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eKn=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"&&Y5n(r,e,n[o]);return Q5n(r,e),r}}();Object.defineProperty(LP,"__esModule",{value:!0});LP.DeleteFinetunedModelResponse=void 0;var rZe=eKn(te());LP.DeleteFinetunedModelResponse=rZe.serialization.record(rZe.serialization.string(),rZe.serialization.unknown())});var Par=S(FP=>{"use strict";var tKn=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]}),rKn=FP&&FP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nKn=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"&&tKn(r,e,n[o]);return rKn(r,e),r}}();Object.defineProperty(FP,"__esModule",{value:!0});FP.UpdateFinetunedModelResponse=void 0;var Ear=nKn(te()),oKn=cK();FP.UpdateFinetunedModelResponse=Ear.serialization.object({finetunedModel:Ear.serialization.property("finetuned_model",oKn.FinetunedModel.optional())})});var nZe=S(kP=>{"use strict";var iKn=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]}),aKn=kP&&kP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sKn=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"&&iKn(r,e,n[o]);return aKn(r,e),r}}();Object.defineProperty(kP,"__esModule",{value:!0});kP.Event=void 0;var Jne=sKn(te()),uKn=Hne();kP.Event=Jne.serialization.object({userId:Jne.serialization.property("user_id",Jne.serialization.string().optional()),status:uKn.Status.optional(),createdAt:Jne.serialization.property("created_at",Jne.serialization.date().optional())})});var Mar=S(qP=>{"use strict";var lKn=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]}),cKn=qP&&qP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dKn=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"&&lKn(r,e,n[o]);return cKn(r,e),r}}();Object.defineProperty(qP,"__esModule",{value:!0});qP.ListEventsResponse=void 0;var dK=dKn(te()),fKn=nZe();qP.ListEventsResponse=dK.serialization.object({events:dK.serialization.list(fKn.Event).optional(),nextPageToken:dK.serialization.property("next_page_token",dK.serialization.string().optional()),totalSize:dK.serialization.property("total_size",dK.serialization.number().optional())})});var oZe=S(UP=>{"use strict";var pKn=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]}),mKn=UP&&UP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hKn=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"&&pKn(r,e,n[o]);return mKn(r,e),r}}();Object.defineProperty(UP,"__esModule",{value:!0});UP.TrainingStepMetrics=void 0;var $F=hKn(te());UP.TrainingStepMetrics=$F.serialization.object({createdAt:$F.serialization.property("created_at",$F.serialization.date().optional()),stepNumber:$F.serialization.property("step_number",$F.serialization.number().optional()),metrics:$F.serialization.record($F.serialization.string(),$F.serialization.number()).optional()})});var Iar=S(BP=>{"use strict";var gKn=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]}),yKn=BP&&BP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bKn=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"&&gKn(r,e,n[o]);return yKn(r,e),r}}();Object.defineProperty(BP,"__esModule",{value:!0});BP.ListTrainingStepMetricsResponse=void 0;var Wne=bKn(te()),_Kn=oZe();BP.ListTrainingStepMetricsResponse=Wne.serialization.object({stepMetrics:Wne.serialization.property("step_metrics",Wne.serialization.list(_Kn.TrainingStepMetrics).optional()),nextPageToken:Wne.serialization.property("next_page_token",Wne.serialization.string().optional())})});var iZe=S(ql=>{"use strict";var vKn=ql&&ql.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ph=ql&&ql.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vKn(e,t,r)};Object.defineProperty(ql,"__esModule",{value:!0});ph(XXe(),ql);ph(ZXe(),ql);ph(YXe(),ql);ph(QXe(),ql);ph(eZe(),ql);ph(tZe(),ql);ph(rCe(),ql);ph(Hne(),ql);ph(cK(),ql);ph(war(),ql);ph(Car(),ql);ph(Oar(),ql);ph(Tar(),ql);ph(Par(),ql);ph(nZe(),ql);ph(Mar(),ql);ph(oZe(),ql);ph(Iar(),ql)});var Rar=S(u2=>{"use strict";var wKn=u2&&u2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=u2&&u2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&wKn(e,t,r)};Object.defineProperty(u2,"__esModule",{value:!0});SKn(iZe(),u2)});var Nar=S(Uv=>{"use strict";var Aar=Uv&&Uv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CKn=Uv&&Uv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xKn=Uv&&Uv.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Aar(r,e,n[o]);return CKn(r,e),r}}(),OKn=Uv&&Uv.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Aar(e,t,r)};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.finetuning=void 0;Uv.finetuning=xKn(Rar());OKn(iZe(),Uv)});var Dar=S(zP=>{"use strict";var TKn=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]}),EKn=zP&&zP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PKn=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"&&TKn(r,e,n[o]);return EKn(r,e),r}}();Object.defineProperty(zP,"__esModule",{value:!0});zP.FinetuningUpdateFinetunedModelRequest=void 0;var jar=PKn(te()),MKn=rCe(),IKn=Hne();zP.FinetuningUpdateFinetunedModelRequest=jar.serialization.object({name:jar.serialization.string(),settings:MKn.Settings,status:IKn.Status.optional()})});var aZe=S(nCe=>{"use strict";Object.defineProperty(nCe,"__esModule",{value:!0});nCe.FinetuningUpdateFinetunedModelRequest=void 0;var RKn=Dar();Object.defineProperty(nCe,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return RKn.FinetuningUpdateFinetunedModelRequest}})});var $ar=S(l2=>{"use strict";var AKn=l2&&l2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=l2&&l2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&AKn(e,t,r)};Object.defineProperty(l2,"__esModule",{value:!0});NKn(aZe(),l2)});var Far=S(LF=>{"use strict";var jKn=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]}),Lar=LF&&LF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jKn(e,t,r)};Object.defineProperty(LF,"__esModule",{value:!0});Lar(Nar(),LF);Lar($ar(),LF)});var oCe=S(HP=>{"use strict";var DKn=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]}),$Kn=HP&&HP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LKn=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"&&DKn(r,e,n[o]);return $Kn(r,e),r}}();Object.defineProperty(HP,"__esModule",{value:!0});HP.CreateConnectorOAuth=void 0;var VP=LKn(te());HP.CreateConnectorOAuth=VP.serialization.object({clientId:VP.serialization.property("client_id",VP.serialization.string().optional()),clientSecret:VP.serialization.property("client_secret",VP.serialization.string().optional()),authorizeUrl:VP.serialization.property("authorize_url",VP.serialization.string().optional()),tokenUrl:VP.serialization.property("token_url",VP.serialization.string().optional()),scope:VP.serialization.string().optional()})});var sZe=S(JP=>{"use strict";var FKn=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]}),kKn=JP&&JP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qKn=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"&&FKn(r,e,n[o]);return kKn(r,e),r}}();Object.defineProperty(JP,"__esModule",{value:!0});JP.AuthTokenType=void 0;var UKn=qKn(te());JP.AuthTokenType=UKn.serialization.enum_(["bearer","basic","noscheme"])});var iCe=S(WP=>{"use strict";var BKn=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]}),zKn=WP&&WP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VKn=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"&&BKn(r,e,n[o]);return zKn(r,e),r}}();Object.defineProperty(WP,"__esModule",{value:!0});WP.CreateConnectorServiceAuth=void 0;var kar=VKn(te()),HKn=sZe();WP.CreateConnectorServiceAuth=kar.serialization.object({type:HKn.AuthTokenType,token:kar.serialization.string()})});var qar=S(GP=>{"use strict";var JKn=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]}),WKn=GP&&GP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KKn=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"&&JKn(r,e,n[o]);return WKn(r,e),r}}();Object.defineProperty(GP,"__esModule",{value:!0});GP.CreateConnectorRequest=void 0;var KP=KKn(te()),GKn=oCe(),XKn=iCe();GP.CreateConnectorRequest=KP.serialization.object({name:KP.serialization.string(),description:KP.serialization.string().optional(),url:KP.serialization.string(),excludes:KP.serialization.list(KP.serialization.string()).optional(),oauth:GKn.CreateConnectorOAuth.optional(),active:KP.serialization.boolean().optional(),continueOnFailure:KP.serialization.property("continue_on_failure",KP.serialization.boolean().optional()),serviceAuth:KP.serialization.property("service_auth",XKn.CreateConnectorServiceAuth.optional())})});var Uar=S(XP=>{"use strict";var ZKn=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]}),YKn=XP&&XP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QKn=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"&&ZKn(r,e,n[o]);return YKn(r,e),r}}();Object.defineProperty(XP,"__esModule",{value:!0});XP.UpdateConnectorRequest=void 0;var a1=QKn(te()),e8n=oCe(),t8n=iCe();XP.UpdateConnectorRequest=a1.serialization.object({name:a1.serialization.string().optional(),url:a1.serialization.string().optional(),excludes:a1.serialization.list(a1.serialization.string()).optional(),oauth:e8n.CreateConnectorOAuth.optional(),active:a1.serialization.boolean().optional(),continueOnFailure:a1.serialization.property("continue_on_failure",a1.serialization.boolean().optional()),serviceAuth:a1.serialization.property("service_auth",t8n.CreateConnectorServiceAuth.optional())})});var uZe=S(fK=>{"use strict";Object.defineProperty(fK,"__esModule",{value:!0});fK.UpdateConnectorRequest=fK.CreateConnectorRequest=void 0;var r8n=qar();Object.defineProperty(fK,"CreateConnectorRequest",{enumerable:!0,get:function(){return r8n.CreateConnectorRequest}});var n8n=Uar();Object.defineProperty(fK,"UpdateConnectorRequest",{enumerable:!0,get:function(){return n8n.UpdateConnectorRequest}})});var Bar=S(c2=>{"use strict";var o8n=c2&&c2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),i8n=c2&&c2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&o8n(e,t,r)};Object.defineProperty(c2,"__esModule",{value:!0});i8n(uZe(),c2)});var zar=S(d2=>{"use strict";var a8n=d2&&d2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=d2&&d2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&a8n(e,t,r)};Object.defineProperty(d2,"__esModule",{value:!0});s8n(Bar(),d2)});var Har=S(Mu=>{"use strict";var Var=Mu&&Mu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u8n=Mu&&Mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kne=Mu&&Mu.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Var(r,e,n[o]);return u8n(r,e),r}}(),f2=Mu&&Mu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Var(e,t,r)};Object.defineProperty(Mu,"__esModule",{value:!0});Mu.connectors=Mu.finetuning=Mu.datasets=Mu.embedJobs=Mu.v2=void 0;Mu.v2=Kne(iar());f2(aXe(),Mu);Mu.embedJobs=Kne(lar());f2(BXe(),Mu);Mu.datasets=Kne(_ar());f2(KXe(),Mu);Mu.finetuning=Kne(Far());f2(qXe(),Mu);f2(zXe(),Mu);Mu.connectors=Kne(zar());f2(uZe(),Mu);f2(aZe(),Mu)});var lZe=S(ZP=>{"use strict";var l8n=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]}),c8n=ZP&&ZP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d8n=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"&&l8n(r,e,n[o]);return c8n(r,e),r}}();Object.defineProperty(ZP,"__esModule",{value:!0});ZP.ChatStreamRequestPromptTruncation=void 0;var f8n=d8n(te());ZP.ChatStreamRequestPromptTruncation=f8n.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var cZe=S(YP=>{"use strict";var p8n=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]}),m8n=YP&&YP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h8n=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"&&p8n(r,e,n[o]);return m8n(r,e),r}}();Object.defineProperty(YP,"__esModule",{value:!0});YP.ChatStreamRequestCitationQuality=void 0;var g8n=h8n(te());YP.ChatStreamRequestCitationQuality=g8n.serialization.enum_(["fast","accurate","off"])});var dZe=S(QP=>{"use strict";var y8n=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]}),b8n=QP&&QP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_8n=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"&&y8n(r,e,n[o]);return b8n(r,e),r}}();Object.defineProperty(QP,"__esModule",{value:!0});QP.ChatStreamRequestSafetyMode=void 0;var v8n=_8n(te());QP.ChatStreamRequestSafetyMode=v8n.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var pZe=S(eM=>{"use strict";var w8n=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]}),S8n=eM&&eM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C8n=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"&&w8n(r,e,n[o]);return S8n(r,e),r}}();Object.defineProperty(eM,"__esModule",{value:!0});eM.ChatStreamStartEvent=void 0;var fZe=C8n(te()),x8n=OC();eM.ChatStreamStartEvent=fZe.serialization.object({generationId:fZe.serialization.property("generation_id",fZe.serialization.string())}).extend(x8n.ChatStreamEvent)});var Gne=S(tM=>{"use strict";var O8n=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]}),T8n=tM&&tM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E8n=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"&&O8n(r,e,n[o]);return T8n(r,e),r}}();Object.defineProperty(tM,"__esModule",{value:!0});tM.ChatSearchQuery=void 0;var aCe=E8n(te());tM.ChatSearchQuery=aCe.serialization.object({text:aCe.serialization.string(),generationId:aCe.serialization.property("generation_id",aCe.serialization.string())})});var hZe=S(rM=>{"use strict";var P8n=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]}),M8n=rM&&rM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I8n=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"&&P8n(r,e,n[o]);return M8n(r,e),r}}();Object.defineProperty(rM,"__esModule",{value:!0});rM.ChatSearchQueriesGenerationEvent=void 0;var mZe=I8n(te()),R8n=Gne(),A8n=OC();rM.ChatSearchQueriesGenerationEvent=mZe.serialization.object({searchQueries:mZe.serialization.property("search_queries",mZe.serialization.list(R8n.ChatSearchQuery))}).extend(A8n.ChatStreamEvent)});var gZe=S(nM=>{"use strict";var N8n=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]}),j8n=nM&&nM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D8n=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"&&N8n(r,e,n[o]);return j8n(r,e),r}}();Object.defineProperty(nM,"__esModule",{value:!0});nM.ChatSearchResultConnector=void 0;var Jar=D8n(te());nM.ChatSearchResultConnector=Jar.serialization.object({id:Jar.serialization.string()})});var sCe=S(oM=>{"use strict";var $8n=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]}),L8n=oM&&oM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F8n=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"&&$8n(r,e,n[o]);return L8n(r,e),r}}();Object.defineProperty(oM,"__esModule",{value:!0});oM.ChatSearchResult=void 0;var s1=F8n(te()),k8n=Gne(),q8n=gZe();oM.ChatSearchResult=s1.serialization.object({searchQuery:s1.serialization.property("search_query",k8n.ChatSearchQuery.optional()),connector:q8n.ChatSearchResultConnector,documentIds:s1.serialization.property("document_ids",s1.serialization.list(s1.serialization.string())),errorMessage:s1.serialization.property("error_message",s1.serialization.string().optional()),continueOnFailure:s1.serialization.property("continue_on_failure",s1.serialization.boolean().optional())})});var pK=S(iM=>{"use strict";var U8n=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]}),B8n=iM&&iM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z8n=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"&&U8n(r,e,n[o]);return B8n(r,e),r}}();Object.defineProperty(iM,"__esModule",{value:!0});iM.ChatDocument=void 0;var yZe=z8n(te());iM.ChatDocument=yZe.serialization.record(yZe.serialization.string(),yZe.serialization.string())});var bZe=S(aM=>{"use strict";var V8n=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]}),H8n=aM&&aM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J8n=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"&&V8n(r,e,n[o]);return H8n(r,e),r}}();Object.defineProperty(aM,"__esModule",{value:!0});aM.ChatSearchResultsEvent=void 0;var uCe=J8n(te()),W8n=sCe(),K8n=pK(),G8n=OC();aM.ChatSearchResultsEvent=uCe.serialization.object({searchResults:uCe.serialization.property("search_results",uCe.serialization.list(W8n.ChatSearchResult).optional()),documents:uCe.serialization.list(K8n.ChatDocument).optional()}).extend(G8n.ChatStreamEvent)});var _Ze=S(sM=>{"use strict";var X8n=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]}),Z8n=sM&&sM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y8n=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"&&X8n(r,e,n[o]);return Z8n(r,e),r}}();Object.defineProperty(sM,"__esModule",{value:!0});sM.ChatTextGenerationEvent=void 0;var War=Y8n(te()),Q8n=OC();sM.ChatTextGenerationEvent=War.serialization.object({text:War.serialization.string()}).extend(Q8n.ChatStreamEvent)});var vZe=S(uM=>{"use strict";var eGn=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]}),tGn=uM&&uM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rGn=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"&&eGn(r,e,n[o]);return tGn(r,e),r}}();Object.defineProperty(uM,"__esModule",{value:!0});uM.ChatCitationType=void 0;var nGn=rGn(te());uM.ChatCitationType=nGn.serialization.enum_(["TEXT_CONTENT","PLAN"])});var lCe=S(lM=>{"use strict";var oGn=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]}),iGn=lM&&lM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aGn=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"&&oGn(r,e,n[o]);return iGn(r,e),r}}();Object.defineProperty(lM,"__esModule",{value:!0});lM.ChatCitation=void 0;var p2=aGn(te()),sGn=vZe();lM.ChatCitation=p2.serialization.object({start:p2.serialization.number(),end:p2.serialization.number(),text:p2.serialization.string(),documentIds:p2.serialization.property("document_ids",p2.serialization.list(p2.serialization.string())),type:sGn.ChatCitationType.optional()})});var wZe=S(cM=>{"use strict";var uGn=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]}),lGn=cM&&cM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cGn=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"&&uGn(r,e,n[o]);return lGn(r,e),r}}();Object.defineProperty(cM,"__esModule",{value:!0});cM.ChatCitationGenerationEvent=void 0;var Kar=cGn(te()),dGn=lCe(),fGn=OC();cM.ChatCitationGenerationEvent=Kar.serialization.object({citations:Kar.serialization.list(dGn.ChatCitation)}).extend(fGn.ChatStreamEvent)});var mK=S(dM=>{"use strict";var pGn=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]}),mGn=dM&&dM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hGn=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"&&pGn(r,e,n[o]);return mGn(r,e),r}}();Object.defineProperty(dM,"__esModule",{value:!0});dM.ToolCall=void 0;var Xne=hGn(te());dM.ToolCall=Xne.serialization.object({name:Xne.serialization.string(),parameters:Xne.serialization.record(Xne.serialization.string(),Xne.serialization.unknown())})});var SZe=S(fM=>{"use strict";var gGn=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]}),yGn=fM&&fM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bGn=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"&&gGn(r,e,n[o]);return yGn(r,e),r}}();Object.defineProperty(fM,"__esModule",{value:!0});fM.ChatToolCallsGenerationEvent=void 0;var cCe=bGn(te()),_Gn=mK(),vGn=OC();fM.ChatToolCallsGenerationEvent=cCe.serialization.object({text:cCe.serialization.string().optional(),toolCalls:cCe.serialization.property("tool_calls",cCe.serialization.list(_Gn.ToolCall))}).extend(vGn.ChatStreamEvent)});var CZe=S(pM=>{"use strict";var wGn=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]}),SGn=pM&&pM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CGn=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"&&wGn(r,e,n[o]);return SGn(r,e),r}}();Object.defineProperty(pM,"__esModule",{value:!0});pM.ChatStreamEndEventFinishReason=void 0;var xGn=CGn(te());pM.ChatStreamEndEventFinishReason=xGn.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var hK=S(mM=>{"use strict";var OGn=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]}),TGn=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"&&OGn(r,e,n[o]);return TGn(r,e),r}}();Object.defineProperty(mM,"__esModule",{value:!0});mM.FinishReason=void 0;var PGn=EGn(te());mM.FinishReason=PGn.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var xZe=S(hM=>{"use strict";var MGn=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]}),IGn=hM&&hM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RGn=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"&&MGn(r,e,n[o]);return IGn(r,e),r}}();Object.defineProperty(hM,"__esModule",{value:!0});hM.ChatMessage=void 0;var dCe=RGn(te()),AGn=mK();hM.ChatMessage=dCe.serialization.object({message:dCe.serialization.string(),toolCalls:dCe.serialization.property("tool_calls",dCe.serialization.list(AGn.ToolCall).optional())})});var Yne=S(gM=>{"use strict";var NGn=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]}),jGn=gM&&gM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DGn=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"&&NGn(r,e,n[o]);return jGn(r,e),r}}();Object.defineProperty(gM,"__esModule",{value:!0});gM.ToolResult=void 0;var Zne=DGn(te()),$Gn=mK();gM.ToolResult=Zne.serialization.object({call:$Gn.ToolCall,outputs:Zne.serialization.list(Zne.serialization.record(Zne.serialization.string(),Zne.serialization.unknown()))})});var TZe=S(yM=>{"use strict";var LGn=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]}),FGn=yM&&yM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kGn=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"&&LGn(r,e,n[o]);return FGn(r,e),r}}();Object.defineProperty(yM,"__esModule",{value:!0});yM.ChatToolMessage=void 0;var OZe=kGn(te()),qGn=Yne();yM.ChatToolMessage=OZe.serialization.object({toolResults:OZe.serialization.property("tool_results",OZe.serialization.list(qGn.ToolResult).optional())})});var Qne=S(bM=>{"use strict";var UGn=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]}),BGn=bM&&bM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zGn=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"&&UGn(r,e,n[o]);return BGn(r,e),r}}();Object.defineProperty(bM,"__esModule",{value:!0});bM.Message=void 0;var VGn=zGn(te()),EZe=xZe(),HGn=TZe();bM.Message=VGn.serialization.union("role",{CHATBOT:EZe.ChatMessage,SYSTEM:EZe.ChatMessage,USER:EZe.ChatMessage,TOOL:HGn.ChatToolMessage}).transform({transform:t=>t,untransform:t=>t})});var PZe=S(_M=>{"use strict";var JGn=_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]}),WGn=_M&&_M.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KGn=_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"&&JGn(r,e,n[o]);return WGn(r,e),r}}();Object.defineProperty(_M,"__esModule",{value:!0});_M.NonStreamedChatResponse=void 0;var xm=KGn(te()),GGn=lCe(),XGn=pK(),ZGn=Gne(),YGn=sCe(),QGn=hK(),e9n=mK(),t9n=Qne(),r9n=h_();_M.NonStreamedChatResponse=xm.serialization.object({text:xm.serialization.string(),generationId:xm.serialization.property("generation_id",xm.serialization.string().optional()),responseId:xm.serialization.property("response_id",xm.serialization.string().optional()),citations:xm.serialization.list(GGn.ChatCitation).optional(),documents:xm.serialization.list(XGn.ChatDocument).optional(),isSearchRequired:xm.serialization.property("is_search_required",xm.serialization.boolean().optional()),searchQueries:xm.serialization.property("search_queries",xm.serialization.list(ZGn.ChatSearchQuery).optional()),searchResults:xm.serialization.property("search_results",xm.serialization.list(YGn.ChatSearchResult).optional()),finishReason:xm.serialization.property("finish_reason",QGn.FinishReason.optional()),toolCalls:xm.serialization.property("tool_calls",xm.serialization.list(e9n.ToolCall).optional()),chatHistory:xm.serialization.property("chat_history",xm.serialization.list(t9n.Message).optional()),meta:r9n.ApiMeta.optional()})});var MZe=S(vM=>{"use strict";var n9n=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]}),o9n=vM&&vM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i9n=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"&&n9n(r,e,n[o]);return o9n(r,e),r}}();Object.defineProperty(vM,"__esModule",{value:!0});vM.ChatStreamEndEvent=void 0;var Gar=i9n(te()),a9n=CZe(),s9n=PZe(),u9n=OC();vM.ChatStreamEndEvent=Gar.serialization.object({finishReason:Gar.serialization.property("finish_reason",a9n.ChatStreamEndEventFinishReason),response:s9n.NonStreamedChatResponse}).extend(u9n.ChatStreamEvent)});var IZe=S(wM=>{"use strict";var l9n=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]}),c9n=wM&&wM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d9n=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"&&l9n(r,e,n[o]);return c9n(r,e),r}}();Object.defineProperty(wM,"__esModule",{value:!0});wM.ToolCallDelta=void 0;var eoe=d9n(te());wM.ToolCallDelta=eoe.serialization.object({name:eoe.serialization.string().optional(),index:eoe.serialization.number().optional(),parameters:eoe.serialization.string().optional(),text:eoe.serialization.string().optional()})});var AZe=S(SM=>{"use strict";var f9n=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]}),p9n=SM&&SM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m9n=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"&&f9n(r,e,n[o]);return p9n(r,e),r}}();Object.defineProperty(SM,"__esModule",{value:!0});SM.ChatToolCallsChunkEvent=void 0;var RZe=m9n(te()),h9n=IZe(),g9n=OC();SM.ChatToolCallsChunkEvent=RZe.serialization.object({toolCallDelta:RZe.serialization.property("tool_call_delta",h9n.ToolCallDelta),text:RZe.serialization.string().optional()}).extend(g9n.ChatStreamEvent)});var Zar=S(CM=>{"use strict";var y9n=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]}),b9n=CM&&CM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_9n=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"&&y9n(r,e,n[o]);return b9n(r,e),r}}();Object.defineProperty(CM,"__esModule",{value:!0});CM.StreamedChatResponse=void 0;var Xar=_9n(te()),v9n=pZe(),w9n=hZe(),S9n=bZe(),C9n=_Ze(),x9n=wZe(),O9n=SZe(),T9n=MZe(),E9n=AZe(),P9n=z0e();CM.StreamedChatResponse=Xar.serialization.union(Xar.serialization.discriminant("eventType","event_type"),{"stream-start":v9n.ChatStreamStartEvent,"search-queries-generation":w9n.ChatSearchQueriesGenerationEvent,"search-results":S9n.ChatSearchResultsEvent,"text-generation":C9n.ChatTextGenerationEvent,"citation-generation":x9n.ChatCitationGenerationEvent,"tool-calls-generation":O9n.ChatToolCallsGenerationEvent,"stream-end":T9n.ChatStreamEndEvent,"tool-calls-chunk":E9n.ChatToolCallsChunkEvent,debug:P9n.ChatDebugEvent}).transform({transform:t=>t,untransform:t=>t})});var NZe=S(xM=>{"use strict";var M9n=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]}),I9n=xM&&xM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R9n=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"&&M9n(r,e,n[o]);return I9n(r,e),r}}();Object.defineProperty(xM,"__esModule",{value:!0});xM.ChatRequestPromptTruncation=void 0;var A9n=R9n(te());xM.ChatRequestPromptTruncation=A9n.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var jZe=S(OM=>{"use strict";var N9n=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]}),j9n=OM&&OM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D9n=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"&&N9n(r,e,n[o]);return j9n(r,e),r}}();Object.defineProperty(OM,"__esModule",{value:!0});OM.ChatRequestCitationQuality=void 0;var $9n=D9n(te());OM.ChatRequestCitationQuality=$9n.serialization.enum_(["fast","accurate","off"])});var DZe=S(TM=>{"use strict";var L9n=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]}),F9n=TM&&TM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k9n=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"&&L9n(r,e,n[o]);return F9n(r,e),r}}();Object.defineProperty(TM,"__esModule",{value:!0});TM.ChatRequestSafetyMode=void 0;var q9n=k9n(te());TM.ChatRequestSafetyMode=q9n.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var $Ze=S(EM=>{"use strict";var U9n=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]}),B9n=EM&&EM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z9n=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"&&U9n(r,e,n[o]);return B9n(r,e),r}}();Object.defineProperty(EM,"__esModule",{value:!0});EM.GenerateStreamRequestTruncate=void 0;var V9n=z9n(te());EM.GenerateStreamRequestTruncate=V9n.serialization.enum_(["NONE","START","END"])});var LZe=S(PM=>{"use strict";var H9n=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]}),J9n=PM&&PM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W9n=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"&&H9n(r,e,n[o]);return J9n(r,e),r}}();Object.defineProperty(PM,"__esModule",{value:!0});PM.GenerateStreamRequestReturnLikelihoods=void 0;var K9n=W9n(te());PM.GenerateStreamRequestReturnLikelihoods=K9n.serialization.enum_(["GENERATION","ALL","NONE"])});var toe=S(MM=>{"use strict";var G9n=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]}),X9n=MM&&MM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z9n=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"&&G9n(r,e,n[o]);return X9n(r,e),r}}();Object.defineProperty(MM,"__esModule",{value:!0});MM.GenerateStreamEvent=void 0;var Y9n=Z9n(te());MM.GenerateStreamEvent=Y9n.serialization.object({})});var FZe=S(IM=>{"use strict";var Q9n=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]}),e7n=IM&&IM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t7n=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"&&Q9n(r,e,n[o]);return e7n(r,e),r}}();Object.defineProperty(IM,"__esModule",{value:!0});IM.GenerateStreamText=void 0;var roe=t7n(te()),r7n=toe();IM.GenerateStreamText=roe.serialization.object({text:roe.serialization.string(),index:roe.serialization.number().optional(),isFinished:roe.serialization.property("is_finished",roe.serialization.boolean())}).extend(r7n.GenerateStreamEvent)});var kZe=S(RM=>{"use strict";var n7n=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]}),o7n=RM&&RM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i7n=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"&&n7n(r,e,n[o]);return o7n(r,e),r}}();Object.defineProperty(RM,"__esModule",{value:!0});RM.SingleGenerationInStream=void 0;var noe=i7n(te()),a7n=hK();RM.SingleGenerationInStream=noe.serialization.object({id:noe.serialization.string(),text:noe.serialization.string(),index:noe.serialization.number().optional(),finishReason:noe.serialization.property("finish_reason",a7n.FinishReason)})});var qZe=S(AM=>{"use strict";var s7n=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]}),u7n=AM&&AM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l7n=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"&&s7n(r,e,n[o]);return u7n(r,e),r}}();Object.defineProperty(AM,"__esModule",{value:!0});AM.GenerateStreamEndResponse=void 0;var fCe=l7n(te()),c7n=kZe();AM.GenerateStreamEndResponse=fCe.serialization.object({id:fCe.serialization.string(),prompt:fCe.serialization.string().optional(),generations:fCe.serialization.list(c7n.SingleGenerationInStream).optional()})});var UZe=S(NM=>{"use strict";var d7n=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]}),f7n=NM&&NM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p7n=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"&&d7n(r,e,n[o]);return f7n(r,e),r}}();Object.defineProperty(NM,"__esModule",{value:!0});NM.GenerateStreamEnd=void 0;var pCe=p7n(te()),m7n=hK(),h7n=qZe(),g7n=toe();NM.GenerateStreamEnd=pCe.serialization.object({isFinished:pCe.serialization.property("is_finished",pCe.serialization.boolean()),finishReason:pCe.serialization.property("finish_reason",m7n.FinishReason.optional()),response:h7n.GenerateStreamEndResponse}).extend(g7n.GenerateStreamEvent)});var BZe=S(jM=>{"use strict";var y7n=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]}),b7n=jM&&jM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_7n=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"&&y7n(r,e,n[o]);return b7n(r,e),r}}();Object.defineProperty(jM,"__esModule",{value:!0});jM.GenerateStreamError=void 0;var gK=_7n(te()),v7n=hK(),w7n=toe();jM.GenerateStreamError=gK.serialization.object({index:gK.serialization.number().optional(),isFinished:gK.serialization.property("is_finished",gK.serialization.boolean()),finishReason:gK.serialization.property("finish_reason",v7n.FinishReason),err:gK.serialization.string()}).extend(w7n.GenerateStreamEvent)});var Qar=S(DM=>{"use strict";var S7n=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]}),C7n=DM&&DM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x7n=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"&&S7n(r,e,n[o]);return C7n(r,e),r}}();Object.defineProperty(DM,"__esModule",{value:!0});DM.GenerateStreamedResponse=void 0;var Yar=x7n(te()),O7n=FZe(),T7n=UZe(),E7n=BZe();DM.GenerateStreamedResponse=Yar.serialization.union(Yar.serialization.discriminant("eventType","event_type"),{"text-generation":O7n.GenerateStreamText,"stream-end":T7n.GenerateStreamEnd,"stream-error":E7n.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var zZe=S($M=>{"use strict";var P7n=$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]}),M7n=$M&&$M.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I7n=$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"&&P7n(r,e,n[o]);return M7n(r,e),r}}();Object.defineProperty($M,"__esModule",{value:!0});$M.GenerateRequestTruncate=void 0;var R7n=I7n(te());$M.GenerateRequestTruncate=R7n.serialization.enum_(["NONE","START","END"])});var VZe=S(LM=>{"use strict";var A7n=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]}),N7n=LM&&LM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j7n=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"&&A7n(r,e,n[o]);return N7n(r,e),r}}();Object.defineProperty(LM,"__esModule",{value:!0});LM.GenerateRequestReturnLikelihoods=void 0;var D7n=j7n(te());LM.GenerateRequestReturnLikelihoods=D7n.serialization.enum_(["GENERATION","ALL","NONE"])});var JZe=S(FM=>{"use strict";var $7n=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]}),L7n=FM&&FM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F7n=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"&&$7n(r,e,n[o]);return L7n(r,e),r}}();Object.defineProperty(FM,"__esModule",{value:!0});FM.SingleGenerationTokenLikelihoodsItem=void 0;var HZe=F7n(te());FM.SingleGenerationTokenLikelihoodsItem=HZe.serialization.object({token:HZe.serialization.string(),likelihood:HZe.serialization.number()})});var WZe=S(kM=>{"use strict";var k7n=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]}),q7n=kM&&kM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U7n=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"&&k7n(r,e,n[o]);return q7n(r,e),r}}();Object.defineProperty(kM,"__esModule",{value:!0});kM.SingleGeneration=void 0;var m2=U7n(te()),B7n=JZe();kM.SingleGeneration=m2.serialization.object({id:m2.serialization.string(),text:m2.serialization.string(),index:m2.serialization.number().optional(),likelihood:m2.serialization.number().optional(),tokenLikelihoods:m2.serialization.property("token_likelihoods",m2.serialization.list(B7n.SingleGenerationTokenLikelihoodsItem).optional())})});var esr=S(qM=>{"use strict";var z7n=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]}),V7n=qM&&qM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H7n=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"&&z7n(r,e,n[o]);return V7n(r,e),r}}();Object.defineProperty(qM,"__esModule",{value:!0});qM.Generation=void 0;var mCe=H7n(te()),J7n=WZe(),W7n=h_();qM.Generation=mCe.serialization.object({id:mCe.serialization.string(),prompt:mCe.serialization.string().optional(),generations:mCe.serialization.list(J7n.SingleGeneration),meta:W7n.ApiMeta.optional()})});var KZe=S(UM=>{"use strict";var K7n=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]}),G7n=UM&&UM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X7n=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"&&K7n(r,e,n[o]);return G7n(r,e),r}}();Object.defineProperty(UM,"__esModule",{value:!0});UM.EmbedRequestTruncate=void 0;var Z7n=X7n(te());UM.EmbedRequestTruncate=Z7n.serialization.enum_(["NONE","START","END"])});var hCe=S(BM=>{"use strict";var Y7n=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]}),Q7n=BM&&BM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eXn=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"&&Y7n(r,e,n[o]);return Q7n(r,e),r}}();Object.defineProperty(BM,"__esModule",{value:!0});BM.Image=void 0;var yK=eXn(te());BM.Image=yK.serialization.object({width:yK.serialization.number(),height:yK.serialization.number(),format:yK.serialization.string(),bitDepth:yK.serialization.property("bit_depth",yK.serialization.number())})});var GZe=S(zM=>{"use strict";var tXn=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]}),rXn=zM&&zM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nXn=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"&&tXn(r,e,n[o]);return rXn(r,e),r}}();Object.defineProperty(zM,"__esModule",{value:!0});zM.EmbedFloatsResponse=void 0;var FF=nXn(te()),oXn=hCe(),iXn=h_();zM.EmbedFloatsResponse=FF.serialization.object({id:FF.serialization.string(),embeddings:FF.serialization.list(FF.serialization.list(FF.serialization.number())),texts:FF.serialization.list(FF.serialization.string()),images:FF.serialization.list(oXn.Image).optional(),meta:iXn.ApiMeta.optional()})});var XZe=S(VM=>{"use strict";var aXn=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]}),sXn=VM&&VM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uXn=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"&&aXn(r,e,n[o]);return sXn(r,e),r}}();Object.defineProperty(VM,"__esModule",{value:!0});VM.EmbedByTypeResponseEmbeddings=void 0;var mh=uXn(te());VM.EmbedByTypeResponseEmbeddings=mh.serialization.object({float:mh.serialization.list(mh.serialization.list(mh.serialization.number())).optional(),int8:mh.serialization.list(mh.serialization.list(mh.serialization.number())).optional(),uint8:mh.serialization.list(mh.serialization.list(mh.serialization.number())).optional(),binary:mh.serialization.list(mh.serialization.list(mh.serialization.number())).optional(),ubinary:mh.serialization.list(mh.serialization.list(mh.serialization.number())).optional(),base64:mh.serialization.list(mh.serialization.string()).optional()})});var ZZe=S(HM=>{"use strict";var lXn=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]}),cXn=HM&&HM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dXn=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"&&lXn(r,e,n[o]);return cXn(r,e),r}}();Object.defineProperty(HM,"__esModule",{value:!0});HM.EmbedByTypeResponse=void 0;var ooe=dXn(te()),fXn=XZe(),pXn=hCe(),mXn=h_();HM.EmbedByTypeResponse=ooe.serialization.object({id:ooe.serialization.string(),embeddings:fXn.EmbedByTypeResponseEmbeddings,texts:ooe.serialization.list(ooe.serialization.string()).optional(),images:ooe.serialization.list(pXn.Image).optional(),meta:mXn.ApiMeta.optional()})});var rsr=S(JM=>{"use strict";var hXn=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]}),gXn=JM&&JM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yXn=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"&&hXn(r,e,n[o]);return gXn(r,e),r}}();Object.defineProperty(JM,"__esModule",{value:!0});JM.EmbedResponse=void 0;var tsr=yXn(te()),bXn=GZe(),_Xn=ZZe();JM.EmbedResponse=tsr.serialization.union(tsr.serialization.discriminant("responseType","response_type"),{embeddings_floats:bXn.EmbedFloatsResponse,embeddings_by_type:_Xn.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var QZe=S(WM=>{"use strict";var vXn=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]}),wXn=WM&&WM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SXn=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"&&vXn(r,e,n[o]);return wXn(r,e),r}}();Object.defineProperty(WM,"__esModule",{value:!0});WM.RerankDocument=void 0;var YZe=SXn(te());WM.RerankDocument=YZe.serialization.record(YZe.serialization.string(),YZe.serialization.string())});var eYe=S(KM=>{"use strict";var CXn=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]}),xXn=KM&&KM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OXn=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"&&CXn(r,e,n[o]);return xXn(r,e),r}}();Object.defineProperty(KM,"__esModule",{value:!0});KM.RerankRequestDocumentsItem=void 0;var nsr=OXn(te()),TXn=QZe();KM.RerankRequestDocumentsItem=nsr.serialization.undiscriminatedUnion([nsr.serialization.string(),TXn.RerankDocument])});var tYe=S(GM=>{"use strict";var EXn=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]}),PXn=GM&&GM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MXn=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"&&EXn(r,e,n[o]);return PXn(r,e),r}}();Object.defineProperty(GM,"__esModule",{value:!0});GM.RerankResponseResultsItemDocument=void 0;var osr=MXn(te());GM.RerankResponseResultsItemDocument=osr.serialization.object({text:osr.serialization.string()})});var rYe=S(XM=>{"use strict";var IXn=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]}),RXn=XM&&XM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AXn=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"&&IXn(r,e,n[o]);return RXn(r,e),r}}();Object.defineProperty(XM,"__esModule",{value:!0});XM.RerankResponseResultsItem=void 0;var gCe=AXn(te()),NXn=tYe();XM.RerankResponseResultsItem=gCe.serialization.object({document:NXn.RerankResponseResultsItemDocument.optional(),index:gCe.serialization.number(),relevanceScore:gCe.serialization.property("relevance_score",gCe.serialization.number())})});var isr=S(ZM=>{"use strict";var jXn=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]}),DXn=ZM&&ZM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Xn=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"&&jXn(r,e,n[o]);return DXn(r,e),r}}();Object.defineProperty(ZM,"__esModule",{value:!0});ZM.RerankResponse=void 0;var nYe=$Xn(te()),LXn=rYe(),FXn=h_();ZM.RerankResponse=nYe.serialization.object({id:nYe.serialization.string().optional(),results:nYe.serialization.list(LXn.RerankResponseResultsItem),meta:FXn.ApiMeta.optional()})});var oYe=S(YM=>{"use strict";var kXn=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]}),qXn=YM&&YM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UXn=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"&&kXn(r,e,n[o]);return qXn(r,e),r}}();Object.defineProperty(YM,"__esModule",{value:!0});YM.ClassifyRequestTruncate=void 0;var BXn=UXn(te());YM.ClassifyRequestTruncate=BXn.serialization.enum_(["NONE","START","END"])});var iYe=S(QM=>{"use strict";var zXn=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]}),VXn=QM&&QM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HXn=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"&&zXn(r,e,n[o]);return VXn(r,e),r}}();Object.defineProperty(QM,"__esModule",{value:!0});QM.ClassifyResponseClassificationsItemLabelsValue=void 0;var asr=HXn(te());QM.ClassifyResponseClassificationsItemLabelsValue=asr.serialization.object({confidence:asr.serialization.number().optional()})});var aYe=S(eI=>{"use strict";var JXn=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]}),WXn=eI&&eI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KXn=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"&&JXn(r,e,n[o]);return WXn(r,e),r}}();Object.defineProperty(eI,"__esModule",{value:!0});eI.ClassifyResponseClassificationsItemClassificationType=void 0;var GXn=KXn(te());eI.ClassifyResponseClassificationsItemClassificationType=GXn.serialization.enum_(["single-label","multi-label"])});var sYe=S(tI=>{"use strict";var XXn=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]}),ZXn=tI&&tI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YXn=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"&&XXn(r,e,n[o]);return ZXn(r,e),r}}();Object.defineProperty(tI,"__esModule",{value:!0});tI.ClassifyResponseClassificationsItem=void 0;var TS=YXn(te()),QXn=iYe(),eZn=aYe();tI.ClassifyResponseClassificationsItem=TS.serialization.object({id:TS.serialization.string(),input:TS.serialization.string().optional(),prediction:TS.serialization.string().optional(),predictions:TS.serialization.list(TS.serialization.string()),confidence:TS.serialization.number().optional(),confidences:TS.serialization.list(TS.serialization.number()),labels:TS.serialization.record(TS.serialization.string(),QXn.ClassifyResponseClassificationsItemLabelsValue),classificationType:TS.serialization.property("classification_type",eZn.ClassifyResponseClassificationsItemClassificationType)})});var ssr=S(rI=>{"use strict";var tZn=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]}),rZn=rI&&rI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nZn=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"&&tZn(r,e,n[o]);return rZn(r,e),r}}();Object.defineProperty(rI,"__esModule",{value:!0});rI.ClassifyResponse=void 0;var uYe=nZn(te()),oZn=sYe(),iZn=h_();rI.ClassifyResponse=uYe.serialization.object({id:uYe.serialization.string(),classifications:uYe.serialization.list(oZn.ClassifyResponseClassificationsItem),meta:iZn.ApiMeta.optional()})});var lYe=S(nI=>{"use strict";var aZn=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]}),sZn=nI&&nI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uZn=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"&&aZn(r,e,n[o]);return sZn(r,e),r}}();Object.defineProperty(nI,"__esModule",{value:!0});nI.SummarizeRequestLength=void 0;var lZn=uZn(te());nI.SummarizeRequestLength=lZn.serialization.enum_(["short","medium","long"])});var cYe=S(oI=>{"use strict";var cZn=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]}),dZn=oI&&oI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fZn=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"&&cZn(r,e,n[o]);return dZn(r,e),r}}();Object.defineProperty(oI,"__esModule",{value:!0});oI.SummarizeRequestFormat=void 0;var pZn=fZn(te());oI.SummarizeRequestFormat=pZn.serialization.enum_(["paragraph","bullets"])});var dYe=S(iI=>{"use strict";var mZn=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]}),hZn=iI&&iI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gZn=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"&&mZn(r,e,n[o]);return hZn(r,e),r}}();Object.defineProperty(iI,"__esModule",{value:!0});iI.SummarizeRequestExtractiveness=void 0;var yZn=gZn(te());iI.SummarizeRequestExtractiveness=yZn.serialization.enum_(["low","medium","high"])});var usr=S(aI=>{"use strict";var bZn=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]}),_Zn=aI&&aI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vZn=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"&&bZn(r,e,n[o]);return _Zn(r,e),r}}();Object.defineProperty(aI,"__esModule",{value:!0});aI.SummarizeResponse=void 0;var fYe=vZn(te()),wZn=h_();aI.SummarizeResponse=fYe.serialization.object({id:fYe.serialization.string().optional(),summary:fYe.serialization.string().optional(),meta:wZn.ApiMeta.optional()})});var lsr=S(sI=>{"use strict";var SZn=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]}),CZn=sI&&sI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xZn=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"&&SZn(r,e,n[o]);return CZn(r,e),r}}();Object.defineProperty(sI,"__esModule",{value:!0});sI.TokenizeResponse=void 0;var bK=xZn(te()),OZn=h_();sI.TokenizeResponse=bK.serialization.object({tokens:bK.serialization.list(bK.serialization.number()),tokenStrings:bK.serialization.property("token_strings",bK.serialization.list(bK.serialization.string())),meta:OZn.ApiMeta.optional()})});var dsr=S(uI=>{"use strict";var TZn=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]}),EZn=uI&&uI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PZn=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"&&TZn(r,e,n[o]);return EZn(r,e),r}}();Object.defineProperty(uI,"__esModule",{value:!0});uI.DetokenizeResponse=void 0;var csr=PZn(te()),MZn=h_();uI.DetokenizeResponse=csr.serialization.object({text:csr.serialization.string(),meta:MZn.ApiMeta.optional()})});var fsr=S(lI=>{"use strict";var IZn=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]}),RZn=lI&&lI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AZn=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"&&IZn(r,e,n[o]);return RZn(r,e),r}}();Object.defineProperty(lI,"__esModule",{value:!0});lI.CheckApiKeyResponse=void 0;var _K=AZn(te());lI.CheckApiKeyResponse=_K.serialization.object({valid:_K.serialization.boolean(),organizationId:_K.serialization.property("organization_id",_K.serialization.string().optional()),ownerId:_K.serialization.property("owner_id",_K.serialization.string().optional())})});var yCe=S(cI=>{"use strict";var NZn=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]}),jZn=cI&&cI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DZn=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"&&NZn(r,e,n[o]);return jZn(r,e),r}}();Object.defineProperty(cI,"__esModule",{value:!0});cI.ChatConnector=void 0;var u1=DZn(te());cI.ChatConnector=u1.serialization.object({id:u1.serialization.string(),userAccessToken:u1.serialization.property("user_access_token",u1.serialization.string().optional()),continueOnFailure:u1.serialization.property("continue_on_failure",u1.serialization.boolean().optional()),options:u1.serialization.record(u1.serialization.string(),u1.serialization.unknown()).optional()})});var pYe=S(dI=>{"use strict";var $Zn=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]}),LZn=dI&&dI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FZn=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"&&$Zn(r,e,n[o]);return LZn(r,e),r}}();Object.defineProperty(dI,"__esModule",{value:!0});dI.ToolParameterDefinitionsValue=void 0;var bCe=FZn(te());dI.ToolParameterDefinitionsValue=bCe.serialization.object({description:bCe.serialization.string().optional(),type:bCe.serialization.string(),required:bCe.serialization.boolean().optional()})});var _Ce=S(fI=>{"use strict";var kZn=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]}),qZn=fI&&fI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UZn=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"&&kZn(r,e,n[o]);return qZn(r,e),r}}();Object.defineProperty(fI,"__esModule",{value:!0});fI.Tool=void 0;var vK=UZn(te()),BZn=pYe();fI.Tool=vK.serialization.object({name:vK.serialization.string(),description:vK.serialization.string(),parameterDefinitions:vK.serialization.property("parameter_definitions",vK.serialization.record(vK.serialization.string(),BZn.ToolParameterDefinitionsValue).optional())})});var mYe=S(pI=>{"use strict";var zZn=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]}),VZn=pI&&pI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HZn=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"&&zZn(r,e,n[o]);return VZn(r,e),r}}();Object.defineProperty(pI,"__esModule",{value:!0});pI.ChatTextResponseFormat=void 0;var JZn=HZn(te());pI.ChatTextResponseFormat=JZn.serialization.object({})});var hYe=S(mI=>{"use strict";var WZn=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]}),KZn=mI&&mI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GZn=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"&&WZn(r,e,n[o]);return KZn(r,e),r}}();Object.defineProperty(mI,"__esModule",{value:!0});mI.JsonResponseFormat=void 0;var vCe=GZn(te());mI.JsonResponseFormat=vCe.serialization.object({schema:vCe.serialization.record(vCe.serialization.string(),vCe.serialization.unknown()).optional()})});var wCe=S(hI=>{"use strict";var XZn=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]}),ZZn=hI&&hI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YZn=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"&&XZn(r,e,n[o]);return ZZn(r,e),r}}();Object.defineProperty(hI,"__esModule",{value:!0});hI.ResponseFormat=void 0;var QZn=YZn(te()),eYn=mYe(),tYn=hYe();hI.ResponseFormat=QZn.serialization.union("type",{text:eYn.ChatTextResponseFormat,json_object:tYn.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var gYe=S(gI=>{"use strict";var rYn=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]}),nYn=gI&&gI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oYn=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"&&rYn(r,e,n[o]);return nYn(r,e),r}}();Object.defineProperty(gI,"__esModule",{value:!0});gI.EmbedJobStatus=void 0;var iYn=oYn(te());gI.EmbedJobStatus=iYn.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var yYe=S(yI=>{"use strict";var aYn=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]}),sYn=yI&&yI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uYn=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"&&aYn(r,e,n[o]);return sYn(r,e),r}}();Object.defineProperty(yI,"__esModule",{value:!0});yI.EmbedJobTruncate=void 0;var lYn=uYn(te());yI.EmbedJobTruncate=lYn.serialization.enum_(["START","END"])});var bYe=S(bI=>{"use strict";var cYn=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]}),dYn=bI&&bI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fYn=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"&&cYn(r,e,n[o]);return dYn(r,e),r}}();Object.defineProperty(bI,"__esModule",{value:!0});bI.EmbedJob=void 0;var EC=fYn(te()),pYn=gYe(),mYn=yYe(),hYn=h_();bI.EmbedJob=EC.serialization.object({jobId:EC.serialization.property("job_id",EC.serialization.string()),name:EC.serialization.string().optional(),status:pYn.EmbedJobStatus,createdAt:EC.serialization.property("created_at",EC.serialization.date()),inputDatasetId:EC.serialization.property("input_dataset_id",EC.serialization.string()),outputDatasetId:EC.serialization.property("output_dataset_id",EC.serialization.string().optional()),model:EC.serialization.string(),truncate:mYn.EmbedJobTruncate,meta:hYn.ApiMeta.optional()})});var psr=S(_I=>{"use strict";var gYn=_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]}),yYn=_I&&_I.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bYn=_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"&&gYn(r,e,n[o]);return yYn(r,e),r}}();Object.defineProperty(_I,"__esModule",{value:!0});_I.ListEmbedJobResponse=void 0;var _Ye=bYn(te()),_Yn=bYe();_I.ListEmbedJobResponse=_Ye.serialization.object({embedJobs:_Ye.serialization.property("embed_jobs",_Ye.serialization.list(_Yn.EmbedJob).optional())})});var msr=S(vI=>{"use strict";var vYn=vI&&vI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wYn=vI&&vI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SYn=vI&&vI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 wYn(r,e),r}}();Object.defineProperty(vI,"__esModule",{value:!0});vI.CreateEmbedJobResponse=void 0;var vYe=SYn(te()),CYn=h_();vI.CreateEmbedJobResponse=vYe.serialization.object({jobId:vYe.serialization.property("job_id",vYe.serialization.string()),meta:CYn.ApiMeta.optional()})});var SYe=S(wI=>{"use strict";var xYn=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]}),OYn=wI&&wI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TYn=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"&&xYn(r,e,n[o]);return OYn(r,e),r}}();Object.defineProperty(wI,"__esModule",{value:!0});wI.ClassifyExample=void 0;var wYe=TYn(te());wI.ClassifyExample=wYe.serialization.object({text:wYe.serialization.string().optional(),label:wYe.serialization.string().optional()})});var hsr=S(SI=>{"use strict";var EYn=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]}),PYn=SI&&SI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MYn=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"&&EYn(r,e,n[o]);return PYn(r,e),r}}();Object.defineProperty(SI,"__esModule",{value:!0});SI.ParseInfo=void 0;var CYe=MYn(te());SI.ParseInfo=CYe.serialization.object({separator:CYe.serialization.string().optional(),delimiter:CYe.serialization.string().optional()})});var gsr=S(CI=>{"use strict";var IYn=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]}),RYn=CI&&CI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AYn=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"&&IYn(r,e,n[o]);return RYn(r,e),r}}();Object.defineProperty(CI,"__esModule",{value:!0});CI.RerankerDataMetrics=void 0;var Bv=AYn(te());CI.RerankerDataMetrics=Bv.serialization.object({numTrainQueries:Bv.serialization.property("num_train_queries",Bv.serialization.number().optional()),numTrainRelevantPassages:Bv.serialization.property("num_train_relevant_passages",Bv.serialization.number().optional()),numTrainHardNegatives:Bv.serialization.property("num_train_hard_negatives",Bv.serialization.number().optional()),numEvalQueries:Bv.serialization.property("num_eval_queries",Bv.serialization.number().optional()),numEvalRelevantPassages:Bv.serialization.property("num_eval_relevant_passages",Bv.serialization.number().optional()),numEvalHardNegatives:Bv.serialization.property("num_eval_hard_negatives",Bv.serialization.number().optional())})});var ysr=S(xI=>{"use strict";var NYn=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]}),jYn=xI&&xI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DYn=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"&&NYn(r,e,n[o]);return jYn(r,e),r}}();Object.defineProperty(xI,"__esModule",{value:!0});xI.ChatDataMetrics=void 0;var wK=DYn(te());xI.ChatDataMetrics=wK.serialization.object({numTrainTurns:wK.serialization.property("num_train_turns",wK.serialization.number().optional()),numEvalTurns:wK.serialization.property("num_eval_turns",wK.serialization.number().optional()),preamble:wK.serialization.string().optional()})});var xYe=S(OI=>{"use strict";var $Yn=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]}),LYn=OI&&OI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FYn=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"&&$Yn(r,e,n[o]);return LYn(r,e),r}}();Object.defineProperty(OI,"__esModule",{value:!0});OI.LabelMetric=void 0;var SK=FYn(te());OI.LabelMetric=SK.serialization.object({totalExamples:SK.serialization.property("total_examples",SK.serialization.number().optional()),label:SK.serialization.string().optional(),samples:SK.serialization.list(SK.serialization.string()).optional()})});var bsr=S(TI=>{"use strict";var kYn=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]}),qYn=TI&&TI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UYn=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"&&kYn(r,e,n[o]);return qYn(r,e),r}}();Object.defineProperty(TI,"__esModule",{value:!0});TI.ClassifyDataMetrics=void 0;var OYe=UYn(te()),BYn=xYe();TI.ClassifyDataMetrics=OYe.serialization.object({labelMetrics:OYe.serialization.property("label_metrics",OYe.serialization.list(BYn.LabelMetric).optional())})});var TYe=S(EI=>{"use strict";var zYn=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]}),VYn=EI&&EI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HYn=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"&&zYn(r,e,n[o]);return VYn(r,e),r}}();Object.defineProperty(EI,"__esModule",{value:!0});EI.FinetuneDatasetMetrics=void 0;var zv=HYn(te());EI.FinetuneDatasetMetrics=zv.serialization.object({trainableTokenCount:zv.serialization.property("trainable_token_count",zv.serialization.number().optional()),totalExamples:zv.serialization.property("total_examples",zv.serialization.number().optional()),trainExamples:zv.serialization.property("train_examples",zv.serialization.number().optional()),trainSizeBytes:zv.serialization.property("train_size_bytes",zv.serialization.number().optional()),evalExamples:zv.serialization.property("eval_examples",zv.serialization.number().optional()),evalSizeBytes:zv.serialization.property("eval_size_bytes",zv.serialization.number().optional())})});var vsr=S(PI=>{"use strict";var JYn=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]}),WYn=PI&&PI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KYn=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"&&JYn(r,e,n[o]);return WYn(r,e),r}}();Object.defineProperty(PI,"__esModule",{value:!0});PI.Metrics=void 0;var _sr=KYn(te()),GYn=TYe();PI.Metrics=_sr.serialization.object({finetuneDatasetMetrics:_sr.serialization.property("finetune_dataset_metrics",GYn.FinetuneDatasetMetrics.optional())})});var EYe=S(II=>{"use strict";var XYn=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]}),ZYn=II&&II.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YYn=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"&&XYn(r,e,n[o]);return ZYn(r,e),r}}();Object.defineProperty(II,"__esModule",{value:!0});II.ConnectorOAuth=void 0;var MI=YYn(te());II.ConnectorOAuth=MI.serialization.object({clientId:MI.serialization.property("client_id",MI.serialization.string().optional()),clientSecret:MI.serialization.property("client_secret",MI.serialization.string().optional()),authorizeUrl:MI.serialization.property("authorize_url",MI.serialization.string()),tokenUrl:MI.serialization.property("token_url",MI.serialization.string()),scope:MI.serialization.string().optional()})});var PYe=S(RI=>{"use strict";var QYn=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]}),eQn=RI&&RI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tQn=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"&&QYn(r,e,n[o]);return eQn(r,e),r}}();Object.defineProperty(RI,"__esModule",{value:!0});RI.ConnectorAuthStatus=void 0;var rQn=tQn(te());RI.ConnectorAuthStatus=rQn.serialization.enum_(["valid","expired"])});var CK=S(AI=>{"use strict";var nQn=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]}),oQn=AI&&AI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iQn=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"&&nQn(r,e,n[o]);return oQn(r,e),r}}();Object.defineProperty(AI,"__esModule",{value:!0});AI.Connector=void 0;var Om=iQn(te()),aQn=EYe(),sQn=PYe();AI.Connector=Om.serialization.object({id:Om.serialization.string(),organizationId:Om.serialization.property("organization_id",Om.serialization.string().optional()),name:Om.serialization.string(),description:Om.serialization.string().optional(),url:Om.serialization.string().optional(),createdAt:Om.serialization.property("created_at",Om.serialization.date()),updatedAt:Om.serialization.property("updated_at",Om.serialization.date()),excludes:Om.serialization.list(Om.serialization.string()).optional(),authType:Om.serialization.property("auth_type",Om.serialization.string().optional()),oauth:aQn.ConnectorOAuth.optional(),authStatus:Om.serialization.property("auth_status",sQn.ConnectorAuthStatus.optional()),active:Om.serialization.boolean().optional(),continueOnFailure:Om.serialization.property("continue_on_failure",Om.serialization.boolean().optional())})});var wsr=S(NI=>{"use strict";var uQn=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]}),lQn=NI&&NI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cQn=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"&&uQn(r,e,n[o]);return lQn(r,e),r}}();Object.defineProperty(NI,"__esModule",{value:!0});NI.ListConnectorsResponse=void 0;var SCe=cQn(te()),dQn=CK();NI.ListConnectorsResponse=SCe.serialization.object({connectors:SCe.serialization.list(dQn.Connector),totalCount:SCe.serialization.property("total_count",SCe.serialization.number().optional())})});var Ssr=S(jI=>{"use strict";var fQn=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]}),pQn=jI&&jI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mQn=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"&&fQn(r,e,n[o]);return pQn(r,e),r}}();Object.defineProperty(jI,"__esModule",{value:!0});jI.CreateConnectorResponse=void 0;var hQn=mQn(te()),gQn=CK();jI.CreateConnectorResponse=hQn.serialization.object({connector:gQn.Connector})});var Csr=S(DI=>{"use strict";var yQn=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]}),bQn=DI&&DI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Qn=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"&&yQn(r,e,n[o]);return bQn(r,e),r}}();Object.defineProperty(DI,"__esModule",{value:!0});DI.GetConnectorResponse=void 0;var vQn=_Qn(te()),wQn=CK();DI.GetConnectorResponse=vQn.serialization.object({connector:wQn.Connector})});var xsr=S($I=>{"use strict";var SQn=$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]}),CQn=$I&&$I.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xQn=$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"&&SQn(r,e,n[o]);return CQn(r,e),r}}();Object.defineProperty($I,"__esModule",{value:!0});$I.DeleteConnectorResponse=void 0;var MYe=xQn(te());$I.DeleteConnectorResponse=MYe.serialization.record(MYe.serialization.string(),MYe.serialization.unknown())});var Osr=S(LI=>{"use strict";var OQn=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]}),TQn=LI&&LI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EQn=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"&&OQn(r,e,n[o]);return TQn(r,e),r}}();Object.defineProperty(LI,"__esModule",{value:!0});LI.UpdateConnectorResponse=void 0;var PQn=EQn(te()),MQn=CK();LI.UpdateConnectorResponse=PQn.serialization.object({connector:MQn.Connector})});var Tsr=S(FI=>{"use strict";var IQn=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]}),RQn=FI&&FI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AQn=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"&&IQn(r,e,n[o]);return RQn(r,e),r}}();Object.defineProperty(FI,"__esModule",{value:!0});FI.OAuthAuthorizeResponse=void 0;var IYe=AQn(te());FI.OAuthAuthorizeResponse=IYe.serialization.object({redirectUrl:IYe.serialization.property("redirect_url",IYe.serialization.string().optional())})});var RYe=S(kI=>{"use strict";var NQn=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]}),jQn=kI&&kI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DQn=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"&&NQn(r,e,n[o]);return jQn(r,e),r}}();Object.defineProperty(kI,"__esModule",{value:!0});kI.CompatibleEndpoint=void 0;var $Qn=DQn(te());kI.CompatibleEndpoint=$Qn.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var AYe=S(qI=>{"use strict";var LQn=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]}),FQn=qI&&qI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kQn=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"&&LQn(r,e,n[o]);return FQn(r,e),r}}();Object.defineProperty(qI,"__esModule",{value:!0});qI.GetModelResponse=void 0;var vy=kQn(te()),Esr=RYe();qI.GetModelResponse=vy.serialization.object({name:vy.serialization.string().optional(),isDeprecated:vy.serialization.property("is_deprecated",vy.serialization.boolean().optional()),endpoints:vy.serialization.list(Esr.CompatibleEndpoint).optional(),finetuned:vy.serialization.boolean().optional(),contextLength:vy.serialization.property("context_length",vy.serialization.number().optional()),tokenizerUrl:vy.serialization.property("tokenizer_url",vy.serialization.string().optional()),supportsVision:vy.serialization.property("supports_vision",vy.serialization.boolean().optional()),defaultEndpoints:vy.serialization.property("default_endpoints",vy.serialization.list(Esr.CompatibleEndpoint).optional()),features:vy.serialization.list(vy.serialization.string()).optional()})});var Psr=S(UI=>{"use strict";var qQn=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]}),UQn=UI&&UI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BQn=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"&&qQn(r,e,n[o]);return UQn(r,e),r}}();Object.defineProperty(UI,"__esModule",{value:!0});UI.ListModelsResponse=void 0;var CCe=BQn(te()),zQn=AYe();UI.ListModelsResponse=CCe.serialization.object({models:CCe.serialization.list(zQn.GetModelResponse),nextPageToken:CCe.serialization.property("next_page_token",CCe.serialization.string().optional())})});var Msr=S(pe=>{"use strict";var VQn=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]}),be=pe&&pe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&VQn(e,t,r)};Object.defineProperty(pe,"__esModule",{value:!0});be(lZe(),pe);be(cZe(),pe);be(dZe(),pe);be(Zar(),pe);be(NZe(),pe);be(jZe(),pe);be(DZe(),pe);be(PZe(),pe);be($Ze(),pe);be(LZe(),pe);be(Qar(),pe);be(zZe(),pe);be(VZe(),pe);be(esr(),pe);be(KZe(),pe);be(rsr(),pe);be(eYe(),pe);be(tYe(),pe);be(rYe(),pe);be(isr(),pe);be(oYe(),pe);be(iYe(),pe);be(aYe(),pe);be(sYe(),pe);be(ssr(),pe);be(lYe(),pe);be(cYe(),pe);be(dYe(),pe);be(usr(),pe);be(lsr(),pe);be(dsr(),pe);be(fsr(),pe);be(mK(),pe);be(xZe(),pe);be(Yne(),pe);be(TZe(),pe);be(Qne(),pe);be(yCe(),pe);be(pK(),pe);be(pYe(),pe);be(_Ce(),pe);be(mYe(),pe);be(hYe(),pe);be(wCe(),pe);be(vZe(),pe);be(lCe(),pe);be(Gne(),pe);be(gZe(),pe);be(sCe(),pe);be(hK(),pe);be(rXe(),pe);be(nXe(),pe);be(oXe(),pe);be(h_(),pe);be(OC(),pe);be(pZe(),pe);be(hZe(),pe);be(bZe(),pe);be(_Ze(),pe);be(wZe(),pe);be(SZe(),pe);be(CZe(),pe);be(MZe(),pe);be(IZe(),pe);be(AZe(),pe);be(z0e(),pe);be(n2(),pe);be(sXe(),pe);be(uXe(),pe);be(lXe(),pe);be(cXe(),pe);be(fXe(),pe);be(pXe(),pe);be(O7e(),pe);be(Dne(),pe);be(V0e(),pe);be($7e(),pe);be(L7e(),pe);be(F7e(),pe);be(k7e(),pe);be(Lne(),pe);be(mXe(),pe);be(gXe(),pe);be(yXe(),pe);be(bXe(),pe);be(vXe(),pe);be(wXe(),pe);be(jne(),pe);be(SXe(),pe);be(CXe(),pe);be(OXe(),pe);be(EXe(),pe);be(PXe(),pe);be(W0e(),pe);be(MXe(),pe);be(K0e(),pe);be(IXe(),pe);be(G0e(),pe);be(RXe(),pe);be(AXe(),pe);be(X0e(),pe);be(NXe(),pe);be(Z0e(),pe);be(U0e(),pe);be(Y7e(),pe);be(Q7e(),pe);be(V7e(),pe);be(H7e(),pe);be(B0e(),pe);be(q0e(),pe);be(kv(),pe);be(i7e(),pe);be(a7e(),pe);be(s7e(),pe);be(u7e(),pe);be(c7e(),pe);be(d7e(),pe);be(f7e(),pe);be(p7e(),pe);be(h7e(),pe);be(g7e(),pe);be(y7e(),pe);be(b7e(),pe);be(_7e(),pe);be(w7e(),pe);be(S7e(),pe);be(C7e(),pe);be(E7e(),pe);be(P7e(),pe);be(M7e(),pe);be(I7e(),pe);be(R7e(),pe);be(A7e(),pe);be(N7e(),pe);be(j7e(),pe);be(D7e(),pe);be(q7e(),pe);be(U7e(),pe);be(B7e(),pe);be(z7e(),pe);be(W7e(),pe);be(K7e(),pe);be(JZe(),pe);be(WZe(),pe);be(toe(),pe);be(FZe(),pe);be(kZe(),pe);be(qZe(),pe);be(UZe(),pe);be(BZe(),pe);be(Bne(),pe);be(zne(),pe);be(hCe(),pe);be(GZe(),pe);be(XZe(),pe);be(ZZe(),pe);be(DXe(),pe);be($Xe(),pe);be(LXe(),pe);be(FXe(),pe);be(kXe(),pe);be(gYe(),pe);be(yYe(),pe);be(bYe(),pe);be(psr(),pe);be(msr(),pe);be(QZe(),pe);be(SYe(),pe);be(HXe(),pe);be(VXe(),pe);be(JXe(),pe);be(hsr(),pe);be(gsr(),pe);be(ysr(),pe);be(xYe(),pe);be(bsr(),pe);be(TYe(),pe);be(vsr(),pe);be(Q0e(),pe);be(EYe(),pe);be(PYe(),pe);be(CK(),pe);be(wsr(),pe);be(oCe(),pe);be(sZe(),pe);be(iCe(),pe);be(Ssr(),pe);be(Csr(),pe);be(xsr(),pe);be(Osr(),pe);be(Tsr(),pe);be(RYe(),pe);be(AYe(),pe);be(Psr(),pe)});var Isr=S(BI=>{"use strict";var HQn=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]}),JQn=BI&&BI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WQn=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"&&HQn(r,e,n[o]);return JQn(r,e),r}}();Object.defineProperty(BI,"__esModule",{value:!0});BI.ChatStreamRequest=void 0;var vi=WQn(te()),KQn=Qne(),GQn=lZe(),XQn=yCe(),ZQn=pK(),YQn=cZe(),QQn=_Ce(),eeo=Yne(),teo=wCe(),reo=dZe();BI.ChatStreamRequest=vi.serialization.object({message:vi.serialization.string(),model:vi.serialization.string().optional(),preamble:vi.serialization.string().optional(),chatHistory:vi.serialization.property("chat_history",vi.serialization.list(KQn.Message).optional()),conversationId:vi.serialization.property("conversation_id",vi.serialization.string().optional()),promptTruncation:vi.serialization.property("prompt_truncation",GQn.ChatStreamRequestPromptTruncation.optional()),connectors:vi.serialization.list(XQn.ChatConnector).optional(),searchQueriesOnly:vi.serialization.property("search_queries_only",vi.serialization.boolean().optional()),documents:vi.serialization.list(ZQn.ChatDocument).optional(),citationQuality:vi.serialization.property("citation_quality",YQn.ChatStreamRequestCitationQuality.optional()),temperature:vi.serialization.number().optional(),maxTokens:vi.serialization.property("max_tokens",vi.serialization.number().optional()),maxInputTokens:vi.serialization.property("max_input_tokens",vi.serialization.number().optional()),k:vi.serialization.number().optional(),p:vi.serialization.number().optional(),seed:vi.serialization.number().optional(),stopSequences:vi.serialization.property("stop_sequences",vi.serialization.list(vi.serialization.string()).optional()),frequencyPenalty:vi.serialization.property("frequency_penalty",vi.serialization.number().optional()),presencePenalty:vi.serialization.property("presence_penalty",vi.serialization.number().optional()),rawPrompting:vi.serialization.property("raw_prompting",vi.serialization.boolean().optional()),tools:vi.serialization.list(QQn.Tool).optional(),toolResults:vi.serialization.property("tool_results",vi.serialization.list(eeo.ToolResult).optional()),forceSingleStep:vi.serialization.property("force_single_step",vi.serialization.boolean().optional()),responseFormat:vi.serialization.property("response_format",teo.ResponseFormat.optional()),safetyMode:vi.serialization.property("safety_mode",reo.ChatStreamRequestSafetyMode.optional())})});var Rsr=S(zI=>{"use strict";var neo=zI&&zI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=zI&&zI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ieo=zI&&zI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(zI,"__esModule",{value:!0});zI.ChatRequest=void 0;var wi=ieo(te()),aeo=Qne(),seo=NZe(),ueo=yCe(),leo=pK(),ceo=jZe(),deo=_Ce(),feo=Yne(),peo=wCe(),meo=DZe();zI.ChatRequest=wi.serialization.object({message:wi.serialization.string(),model:wi.serialization.string().optional(),preamble:wi.serialization.string().optional(),chatHistory:wi.serialization.property("chat_history",wi.serialization.list(aeo.Message).optional()),conversationId:wi.serialization.property("conversation_id",wi.serialization.string().optional()),promptTruncation:wi.serialization.property("prompt_truncation",seo.ChatRequestPromptTruncation.optional()),connectors:wi.serialization.list(ueo.ChatConnector).optional(),searchQueriesOnly:wi.serialization.property("search_queries_only",wi.serialization.boolean().optional()),documents:wi.serialization.list(leo.ChatDocument).optional(),citationQuality:wi.serialization.property("citation_quality",ceo.ChatRequestCitationQuality.optional()),temperature:wi.serialization.number().optional(),maxTokens:wi.serialization.property("max_tokens",wi.serialization.number().optional()),maxInputTokens:wi.serialization.property("max_input_tokens",wi.serialization.number().optional()),k:wi.serialization.number().optional(),p:wi.serialization.number().optional(),seed:wi.serialization.number().optional(),stopSequences:wi.serialization.property("stop_sequences",wi.serialization.list(wi.serialization.string()).optional()),frequencyPenalty:wi.serialization.property("frequency_penalty",wi.serialization.number().optional()),presencePenalty:wi.serialization.property("presence_penalty",wi.serialization.number().optional()),rawPrompting:wi.serialization.property("raw_prompting",wi.serialization.boolean().optional()),tools:wi.serialization.list(deo.Tool).optional(),toolResults:wi.serialization.property("tool_results",wi.serialization.list(feo.ToolResult).optional()),forceSingleStep:wi.serialization.property("force_single_step",wi.serialization.boolean().optional()),responseFormat:wi.serialization.property("response_format",peo.ResponseFormat.optional()),safetyMode:wi.serialization.property("safety_mode",meo.ChatRequestSafetyMode.optional())})});var Asr=S(VI=>{"use strict";var heo=VI&&VI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=VI&&VI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yeo=VI&&VI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(VI,"__esModule",{value:!0});VI.GenerateStreamRequest=void 0;var hl=yeo(te()),beo=$Ze(),_eo=LZe();VI.GenerateStreamRequest=hl.serialization.object({prompt:hl.serialization.string(),model:hl.serialization.string().optional(),numGenerations:hl.serialization.property("num_generations",hl.serialization.number().optional()),maxTokens:hl.serialization.property("max_tokens",hl.serialization.number().optional()),truncate:beo.GenerateStreamRequestTruncate.optional(),temperature:hl.serialization.number().optional(),seed:hl.serialization.number().optional(),preset:hl.serialization.string().optional(),endSequences:hl.serialization.property("end_sequences",hl.serialization.list(hl.serialization.string()).optional()),stopSequences:hl.serialization.property("stop_sequences",hl.serialization.list(hl.serialization.string()).optional()),k:hl.serialization.number().optional(),p:hl.serialization.number().optional(),frequencyPenalty:hl.serialization.property("frequency_penalty",hl.serialization.number().optional()),presencePenalty:hl.serialization.property("presence_penalty",hl.serialization.number().optional()),returnLikelihoods:hl.serialization.property("return_likelihoods",_eo.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:hl.serialization.property("raw_prompting",hl.serialization.boolean().optional())})});var Nsr=S(HI=>{"use strict";var veo=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]}),weo=HI&&HI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Seo=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"&&veo(r,e,n[o]);return weo(r,e),r}}();Object.defineProperty(HI,"__esModule",{value:!0});HI.GenerateRequest=void 0;var gl=Seo(te()),Ceo=zZe(),xeo=VZe();HI.GenerateRequest=gl.serialization.object({prompt:gl.serialization.string(),model:gl.serialization.string().optional(),numGenerations:gl.serialization.property("num_generations",gl.serialization.number().optional()),maxTokens:gl.serialization.property("max_tokens",gl.serialization.number().optional()),truncate:Ceo.GenerateRequestTruncate.optional(),temperature:gl.serialization.number().optional(),seed:gl.serialization.number().optional(),preset:gl.serialization.string().optional(),endSequences:gl.serialization.property("end_sequences",gl.serialization.list(gl.serialization.string()).optional()),stopSequences:gl.serialization.property("stop_sequences",gl.serialization.list(gl.serialization.string()).optional()),k:gl.serialization.number().optional(),p:gl.serialization.number().optional(),frequencyPenalty:gl.serialization.property("frequency_penalty",gl.serialization.number().optional()),presencePenalty:gl.serialization.property("presence_penalty",gl.serialization.number().optional()),returnLikelihoods:gl.serialization.property("return_likelihoods",xeo.GenerateRequestReturnLikelihoods.optional()),rawPrompting:gl.serialization.property("raw_prompting",gl.serialization.boolean().optional())})});var jsr=S(JI=>{"use strict";var Oeo=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]}),Teo=JI&&JI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Eeo=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"&&Oeo(r,e,n[o]);return Teo(r,e),r}}();Object.defineProperty(JI,"__esModule",{value:!0});JI.EmbedRequest=void 0;var l1=Eeo(te()),Peo=Bne(),Meo=zne(),Ieo=KZe();JI.EmbedRequest=l1.serialization.object({texts:l1.serialization.list(l1.serialization.string()).optional(),images:l1.serialization.list(l1.serialization.string()).optional(),model:l1.serialization.string().optional(),inputType:l1.serialization.property("input_type",Peo.EmbedInputType.optional()),embeddingTypes:l1.serialization.property("embedding_types",l1.serialization.list(Meo.EmbeddingType).optional()),truncate:Ieo.EmbedRequestTruncate.optional()})});var Dsr=S(WI=>{"use strict";var Reo=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]}),Aeo=WI&&WI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Neo=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"&&Reo(r,e,n[o]);return Aeo(r,e),r}}();Object.defineProperty(WI,"__esModule",{value:!0});WI.RerankRequest=void 0;var Vv=Neo(te()),jeo=eYe();WI.RerankRequest=Vv.serialization.object({model:Vv.serialization.string().optional(),query:Vv.serialization.string(),documents:Vv.serialization.list(jeo.RerankRequestDocumentsItem),topN:Vv.serialization.property("top_n",Vv.serialization.number().optional()),rankFields:Vv.serialization.property("rank_fields",Vv.serialization.list(Vv.serialization.string()).optional()),returnDocuments:Vv.serialization.property("return_documents",Vv.serialization.boolean().optional()),maxChunksPerDoc:Vv.serialization.property("max_chunks_per_doc",Vv.serialization.number().optional())})});var $sr=S(KI=>{"use strict";var Deo=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]}),$eo=KI&&KI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Leo=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"&&Deo(r,e,n[o]);return $eo(r,e),r}}();Object.defineProperty(KI,"__esModule",{value:!0});KI.ClassifyRequest=void 0;var xK=Leo(te()),Feo=SYe(),keo=oYe();KI.ClassifyRequest=xK.serialization.object({inputs:xK.serialization.list(xK.serialization.string()),examples:xK.serialization.list(Feo.ClassifyExample).optional(),model:xK.serialization.string().optional(),preset:xK.serialization.string().optional(),truncate:keo.ClassifyRequestTruncate.optional()})});var Lsr=S(GI=>{"use strict";var qeo=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]}),Ueo=GI&&GI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Beo=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"&&qeo(r,e,n[o]);return Ueo(r,e),r}}();Object.defineProperty(GI,"__esModule",{value:!0});GI.SummarizeRequest=void 0;var OK=Beo(te()),zeo=lYe(),Veo=cYe(),Heo=dYe();GI.SummarizeRequest=OK.serialization.object({text:OK.serialization.string(),length:zeo.SummarizeRequestLength.optional(),format:Veo.SummarizeRequestFormat.optional(),model:OK.serialization.string().optional(),extractiveness:Heo.SummarizeRequestExtractiveness.optional(),temperature:OK.serialization.number().optional(),additionalCommand:OK.serialization.property("additional_command",OK.serialization.string().optional())})});var Fsr=S(XI=>{"use strict";var Jeo=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]}),Weo=XI&&XI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Keo=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"&&Jeo(r,e,n[o]);return Weo(r,e),r}}();Object.defineProperty(XI,"__esModule",{value:!0});XI.TokenizeRequest=void 0;var NYe=Keo(te());XI.TokenizeRequest=NYe.serialization.object({text:NYe.serialization.string(),model:NYe.serialization.string()})});var ksr=S(ZI=>{"use strict";var Geo=ZI&&ZI.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Xeo=ZI&&ZI.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zeo=ZI&&ZI.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Geo(r,e,n[o]);return Xeo(r,e),r}}();Object.defineProperty(ZI,"__esModule",{value:!0});ZI.DetokenizeRequest=void 0;var xCe=Zeo(te());ZI.DetokenizeRequest=xCe.serialization.object({tokens:xCe.serialization.list(xCe.serialization.number()),model:xCe.serialization.string()})});var qsr=S(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.DetokenizeRequest=Mc.TokenizeRequest=Mc.SummarizeRequest=Mc.ClassifyRequest=Mc.RerankRequest=Mc.EmbedRequest=Mc.GenerateRequest=Mc.GenerateStreamRequest=Mc.ChatRequest=Mc.ChatStreamRequest=void 0;var Yeo=Isr();Object.defineProperty(Mc,"ChatStreamRequest",{enumerable:!0,get:function(){return Yeo.ChatStreamRequest}});var Qeo=Rsr();Object.defineProperty(Mc,"ChatRequest",{enumerable:!0,get:function(){return Qeo.ChatRequest}});var eto=Asr();Object.defineProperty(Mc,"GenerateStreamRequest",{enumerable:!0,get:function(){return eto.GenerateStreamRequest}});var tto=Nsr();Object.defineProperty(Mc,"GenerateRequest",{enumerable:!0,get:function(){return tto.GenerateRequest}});var rto=jsr();Object.defineProperty(Mc,"EmbedRequest",{enumerable:!0,get:function(){return rto.EmbedRequest}});var nto=Dsr();Object.defineProperty(Mc,"RerankRequest",{enumerable:!0,get:function(){return nto.RerankRequest}});var oto=$sr();Object.defineProperty(Mc,"ClassifyRequest",{enumerable:!0,get:function(){return oto.ClassifyRequest}});var ito=Lsr();Object.defineProperty(Mc,"SummarizeRequest",{enumerable:!0,get:function(){return ito.SummarizeRequest}});var ato=Fsr();Object.defineProperty(Mc,"TokenizeRequest",{enumerable:!0,get:function(){return ato.TokenizeRequest}});var sto=ksr();Object.defineProperty(Mc,"DetokenizeRequest",{enumerable:!0,get:function(){return sto.DetokenizeRequest}})});var Usr=S(h2=>{"use strict";var uto=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]}),lto=h2&&h2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&uto(e,t,r)};Object.defineProperty(h2,"__esModule",{value:!0});lto(qsr(),h2)});var d1=S(c1=>{"use strict";var cto=c1&&c1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),jYe=c1&&c1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cto(e,t,r)};Object.defineProperty(c1,"__esModule",{value:!0});jYe(Har(),c1);jYe(Msr(),c1);jYe(Usr(),c1)});var DYe=S(nu=>{"use strict";var dto=nu&&nu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fto=nu&&nu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pto=nu&&nu.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dto(r,e,n[o]);return fto(r,e),r}}(),OCe=nu&&nu.__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())})},mto=nu&&nu.__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(nu,"__esModule",{value:!0});nu.fetchOverride=nu.parseAWSEvent=nu.getAuthHeaders=nu.getUrl=nu.mapResponseFromBedrock=void 0;var hto=LWe(),gto=(gZt(),zfe(hZt)),yto=LKe(),bto=XZt(),_to=ene(),vto=te(),wto=n9e(),Sto=Sir(),ES=pto(d1()),Cto=(t,e)=>OCe(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),xto={1:{chat:ES.StreamedChatResponse,generate:ES.GenerateStreamedResponse},2:{chat:ES.V2ChatStreamResponse,generate:ES.GenerateStreamedResponse}},Oto={1:{chat:ES.NonStreamedChatResponse,embed:ES.EmbedResponse,generate:ES.Generation,rerank:ES.RerankResponse},2:{chat:ES.V2ChatResponse,embed:ES.EmbedByTypeResponse,generate:ES.Generation,rerank:ES.V2RerankResponse}},Tto=(t,e,r,n)=>OCe(void 0,void 0,void 0,function*(){let o=t?xto[r][e]:Oto[r][e],i={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},a=yield o.parseOrThrow(n,i);return o.jsonOrThrow(a,i)});nu.mapResponseFromBedrock=Tto;var Eto=(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]};nu.getUrl=Eto;var Pto=(t,e,r,n,o,i)=>OCe(void 0,void 0,void 0,function*(){let a=(0,gto.fromNodeProviderChain)(),s=yield Cto(()=>{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 bto.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:hto.Sha256});delete r.connection,r.host=t.hostname;let l=new yto.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});nu.getAuthHeaders=Pto;var Mto=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}}};nu.parseAWSEvent=Mto;var Ito=t=>({v1:1,v2:2})[t]||1,Rto=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>OCe(void 0,void 0,void 0,function*(){var a,s,u,l;let c=i.url.split("/"),d=c.pop(),f=Ito(c.pop()),p=i.body;console.assert(p.model,"model is required");let m=!!p.stream,h=(0,nu.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,nu.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,vto.fetcher)(i);if(!g.ok)return g;try{if(m){let O=(0,wto.readableStreamAsyncIterable)(g.body),T=new Sto.LineDecoder,P=new _to.PassThrough;try{for(var b=!0,_=mto(O),w;w=yield _.next(),a=w.done,!a;b=!0){l=w.value,b=!1;let M=l;for(let I of T.decode(M)){let j=(0,nu.parseAWSEvent)(I);if(j){let A=yield(0,nu.mapResponseFromBedrock)(m,d,f,j);P.push(JSON.stringify(A)+`
|
||
`)}}}}catch(M){s={error:M}}finally{try{!b&&!a&&(u=_.return)&&(yield u.call(_))}finally{if(s)throw s.error}}for(let M of T.flush()){let I=(0,nu.parseAWSEvent)(M);if(I){let j=yield(0,nu.mapResponseFromBedrock)(m,d,f,I);P.push(JSON.stringify(j)+`
|
||
`)}}return P.end(),{ok:!0,body:P,rawResponse:g.rawResponse}}else{let O=yield g.body;return{ok:!0,body:yield(0,nu.mapResponseFromBedrock)(m,d,f,O),rawResponse:g.rawResponse}}}catch(O){throw O}});nu.fetchOverride=Rto});var f1=S(TCe=>{"use strict";Object.defineProperty(TCe,"__esModule",{value:!0});TCe.CohereEnvironment=void 0;TCe.CohereEnvironment={Production:"https://api.cohere.com"}});var kF=S((Bsr,ECe)=>{(function(t,e,r){typeof ECe<"u"&&ECe.exports?ECe.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",Bsr,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 LYe=S(y_=>{"use strict";var Ato=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]}),Nto=y_&&y_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ioe=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"&&Ato(r,e,n[o]);return Nto(r,e),r}}(),TK=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())})},jto=y_&&y_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(y_,"__esModule",{value:!0});y_.V2=void 0;var PCe=ioe(f1()),Qi=ioe(te()),qn=ioe(LN()),qF=ioe(d1()),MCe=jto(kF()),hg=ioe(Tc()),$Ye=class{constructor(e={}){this._options=e}chatStream(e,r){return Qi.HttpResponsePromise.fromPromise(this.__chatStream(e,r))}__chatStream(e,r){return TK(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Qi.fetcher)({url:(0,MCe.default)((i=(o=yield Qi.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Qi.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PCe.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Qi.Supplier.get(this._options.clientName))!=null?yield Qi.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":Qi.RUNTIME.type,"X-Fern-Runtime-Version":Qi.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},qF.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 Qi.Stream({stream:a.body,parse:s=>TK(this,void 0,void 0,function*(){return qF.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 qn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new qn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new qn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new qn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new qn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new qn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new qn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new qn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new qn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new qn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new qn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new qn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new hg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new hg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new hg.CohereTimeoutError("Timeout exceeded when calling POST /v2/chat.");case"unknown":throw new hg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}chat(e,r){return Qi.HttpResponsePromise.fromPromise(this.__chat(e,r))}__chat(e,r){return TK(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Qi.fetcher)({url:(0,MCe.default)((i=(o=yield Qi.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Qi.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PCe.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Qi.Supplier.get(this._options.clientName))!=null?yield Qi.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":Qi.RUNTIME.type,"X-Fern-Runtime-Version":Qi.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},qF.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:qF.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 qn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new qn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new qn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new qn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new qn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new qn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new qn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new qn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new qn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new qn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new qn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new qn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new hg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new hg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new hg.CohereTimeoutError("Timeout exceeded when calling POST /v2/chat.");case"unknown":throw new hg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}embed(e,r){return Qi.HttpResponsePromise.fromPromise(this.__embed(e,r))}__embed(e,r){return TK(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Qi.fetcher)({url:(0,MCe.default)((i=(o=yield Qi.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Qi.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PCe.CohereEnvironment.Production,"v2/embed"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Qi.Supplier.get(this._options.clientName))!=null?yield Qi.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":Qi.RUNTIME.type,"X-Fern-Runtime-Version":Qi.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:qF.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:qF.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 qn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new qn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new qn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new qn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new qn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new qn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new qn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new qn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new qn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new qn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new qn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new qn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new hg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new hg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new hg.CohereTimeoutError("Timeout exceeded when calling POST /v2/embed.");case"unknown":throw new hg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}rerank(e,r){return Qi.HttpResponsePromise.fromPromise(this.__rerank(e,r))}__rerank(e,r){return TK(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Qi.fetcher)({url:(0,MCe.default)((i=(o=yield Qi.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Qi.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PCe.CohereEnvironment.Production,"v2/rerank"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Qi.Supplier.get(this._options.clientName))!=null?yield Qi.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":Qi.RUNTIME.type,"X-Fern-Runtime-Version":Qi.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:qF.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:qF.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 qn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new qn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new qn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new qn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new qn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new qn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new qn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new qn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new qn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new qn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new qn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new qn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new hg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new hg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new hg.CohereTimeoutError("Timeout exceeded when calling POST /v2/rerank.");case"unknown":throw new hg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return TK(this,void 0,void 0,function*(){var e;let r=(e=yield Qi.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new hg.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_.V2=$Ye});var zsr=S(b_=>{"use strict";var Dto=b_&&b_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$to=b_&&b_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),soe=b_&&b_.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Dto(r,e,n[o]);return $to(r,e),r}}(),aoe=b_&&b_.__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())})},Lto=b_&&b_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(b_,"__esModule",{value:!0});b_.EmbedJobs=void 0;var ICe=soe(f1()),rs=soe(te()),Un=soe(LN()),RCe=Lto(kF()),ACe=soe(d1()),gg=soe(Tc()),FYe=class{constructor(e={}){this._options=e}list(e){return rs.HttpResponsePromise.fromPromise(this.__list(e))}__list(e){return aoe(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:rs.fetcher)({url:(0,RCe.default)((o=(n=yield rs.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield rs.Supplier.get(this._options.environment))!==null&&o!==void 0?o:ICe.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield rs.Supplier.get(this._options.clientName))!=null?yield rs.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":rs.RUNTIME.type,"X-Fern-Runtime-Version":rs.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:ACe.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 Un.BadRequestError(i.error.body,i.rawResponse);case 401:throw new Un.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new Un.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new Un.NotFoundError(i.error.body,i.rawResponse);case 422:throw new Un.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new Un.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new Un.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new Un.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new Un.InternalServerError(i.error.body,i.rawResponse);case 501:throw new Un.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new Un.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new Un.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new gg.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new gg.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new gg.CohereTimeoutError("Timeout exceeded when calling GET /v1/embed-jobs.");case"unknown":throw new gg.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}create(e,r){return rs.HttpResponsePromise.fromPromise(this.__create(e,r))}__create(e,r){return aoe(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:rs.fetcher)({url:(0,RCe.default)((i=(o=yield rs.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield rs.Supplier.get(this._options.environment))!==null&&i!==void 0?i:ICe.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield rs.Supplier.get(this._options.clientName))!=null?yield rs.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":rs.RUNTIME.type,"X-Fern-Runtime-Version":rs.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:ACe.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:ACe.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 Un.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Un.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Un.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Un.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Un.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Un.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Un.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Un.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Un.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Un.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Un.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Un.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new gg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new gg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new gg.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed-jobs.");case"unknown":throw new gg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}get(e,r){return rs.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return aoe(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:rs.fetcher)({url:(0,RCe.default)((i=(o=yield rs.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield rs.Supplier.get(this._options.environment))!==null&&i!==void 0?i:ICe.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield rs.Supplier.get(this._options.clientName))!=null?yield rs.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":rs.RUNTIME.type,"X-Fern-Runtime-Version":rs.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:ACe.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 Un.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Un.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Un.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Un.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Un.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Un.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Un.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Un.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Un.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Un.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Un.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Un.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new gg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new gg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new gg.CohereTimeoutError("Timeout exceeded when calling GET /v1/embed-jobs/{id}.");case"unknown":throw new gg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}cancel(e,r){return rs.HttpResponsePromise.fromPromise(this.__cancel(e,r))}__cancel(e,r){return aoe(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:rs.fetcher)({url:(0,RCe.default)((i=(o=yield rs.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield rs.Supplier.get(this._options.environment))!==null&&i!==void 0?i:ICe.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield rs.Supplier.get(this._options.clientName))!=null?yield rs.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":rs.RUNTIME.type,"X-Fern-Runtime-Version":rs.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 Un.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Un.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Un.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Un.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Un.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Un.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Un.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Un.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Un.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Un.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Un.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Un.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new gg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new gg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new gg.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed-jobs/{id}/cancel.");case"unknown":throw new gg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return aoe(this,void 0,void 0,function*(){var e;let r=(e=yield rs.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new gg.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}`})}};b_.EmbedJobs=FYe});var Vsr=S(__=>{"use strict";var Fto=__&&__.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=__&&__.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),coe=__&&__.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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}}(),EK=__&&__.__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())})},qto=__&&__.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(__,"__esModule",{value:!0});__.Datasets=void 0;var uoe=coe(f1()),Ho=coe(te()),Dr=coe(LN()),g2=coe(d1()),loe=qto(kF()),Jc=coe(Tc()),kYe=class{constructor(e={}){this._options=e}list(e={},r){return Ho.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return EK(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=g2.DatasetValidationStatus.jsonOrThrow(d,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}));let p=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ho.fetcher)({url:(0,loe.default)((i=(o=yield Ho.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Ho.Supplier.get(this._options.environment))!==null&&i!==void 0?i:uoe.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ho.Supplier.get(this._options.clientName))!=null?yield Ho.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":Ho.RUNTIME.type,"X-Fern-Runtime-Version":Ho.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:g2.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 Dr.BadRequestError(p.error.body,p.rawResponse);case 401:throw new Dr.UnauthorizedError(p.error.body,p.rawResponse);case 403:throw new Dr.ForbiddenError(p.error.body,p.rawResponse);case 404:throw new Dr.NotFoundError(p.error.body,p.rawResponse);case 422:throw new Dr.UnprocessableEntityError(p.error.body,p.rawResponse);case 429:throw new Dr.TooManyRequestsError(p.error.body,p.rawResponse);case 498:throw new Dr.InvalidTokenError(p.error.body,p.rawResponse);case 499:throw new Dr.ClientClosedRequestError(p.error.body,p.rawResponse);case 500:throw new Dr.InternalServerError(p.error.body,p.rawResponse);case 501:throw new Dr.NotImplementedError(p.error.body,p.rawResponse);case 503:throw new Dr.ServiceUnavailableError(p.error.body,p.rawResponse);case 504:throw new Dr.GatewayTimeoutError(p.error.body,p.rawResponse);default:throw new Jc.CohereError({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new Jc.CohereError({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new Jc.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets.");case"unknown":throw new Jc.CohereError({message:p.error.errorMessage,rawResponse:p.rawResponse})}})}create(e,r,n,o){return Ho.HttpResponsePromise.fromPromise(this.__create(e,r,n,o))}__create(e,r,n,o){return EK(this,void 0,void 0,function*(){var i,a,s;let u={};u.name=n.name,u.type=g2.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 Ho.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:Ho.fetcher)({url:(0,loe.default)((s=(a=yield Ho.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Ho.Supplier.get(this._options.environment))!==null&&s!==void 0?s:uoe.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign(Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ho.Supplier.get(this._options.clientName))!=null?yield Ho.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":Ho.RUNTIME.type,"X-Fern-Runtime-Version":Ho.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:g2.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 Dr.BadRequestError(d.error.body,d.rawResponse);case 401:throw new Dr.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new Dr.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new Dr.NotFoundError(d.error.body,d.rawResponse);case 422:throw new Dr.UnprocessableEntityError(d.error.body,d.rawResponse);case 429:throw new Dr.TooManyRequestsError(d.error.body,d.rawResponse);case 498:throw new Dr.InvalidTokenError(d.error.body,d.rawResponse);case 499:throw new Dr.ClientClosedRequestError(d.error.body,d.rawResponse);case 500:throw new Dr.InternalServerError(d.error.body,d.rawResponse);case 501:throw new Dr.NotImplementedError(d.error.body,d.rawResponse);case 503:throw new Dr.ServiceUnavailableError(d.error.body,d.rawResponse);case 504:throw new Dr.GatewayTimeoutError(d.error.body,d.rawResponse);default:throw new Jc.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jc.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new Jc.CohereTimeoutError("Timeout exceeded when calling POST /v1/datasets.");case"unknown":throw new Jc.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}getUsage(e){return Ho.HttpResponsePromise.fromPromise(this.__getUsage(e))}__getUsage(e){return EK(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Ho.fetcher)({url:(0,loe.default)((o=(n=yield Ho.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield Ho.Supplier.get(this._options.environment))!==null&&o!==void 0?o:uoe.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ho.Supplier.get(this._options.clientName))!=null?yield Ho.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":Ho.RUNTIME.type,"X-Fern-Runtime-Version":Ho.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:g2.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 Dr.BadRequestError(i.error.body,i.rawResponse);case 401:throw new Dr.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new Dr.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new Dr.NotFoundError(i.error.body,i.rawResponse);case 422:throw new Dr.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new Dr.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new Dr.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new Dr.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new Dr.InternalServerError(i.error.body,i.rawResponse);case 501:throw new Dr.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new Dr.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new Dr.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new Jc.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new Jc.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new Jc.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets/usage.");case"unknown":throw new Jc.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}get(e,r){return Ho.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return EK(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ho.fetcher)({url:(0,loe.default)((i=(o=yield Ho.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Ho.Supplier.get(this._options.environment))!==null&&i!==void 0?i:uoe.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ho.Supplier.get(this._options.clientName))!=null?yield Ho.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":Ho.RUNTIME.type,"X-Fern-Runtime-Version":Ho.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:g2.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 Dr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Dr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Dr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Dr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Dr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Dr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Dr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Dr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Dr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Dr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Dr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Dr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Jc.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Jc.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Jc.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets/{id}.");case"unknown":throw new Jc.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}delete(e,r){return Ho.HttpResponsePromise.fromPromise(this.__delete(e,r))}__delete(e,r){return EK(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Ho.fetcher)({url:(0,loe.default)((i=(o=yield Ho.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Ho.Supplier.get(this._options.environment))!==null&&i!==void 0?i:uoe.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Ho.Supplier.get(this._options.clientName))!=null?yield Ho.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":Ho.RUNTIME.type,"X-Fern-Runtime-Version":Ho.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:g2.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 Dr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Dr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Dr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Dr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Dr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Dr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Dr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Dr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Dr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Dr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Dr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Dr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Jc.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Jc.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Jc.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/datasets/{id}.");case"unknown":throw new Jc.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return EK(this,void 0,void 0,function*(){var e;let r=(e=yield Ho.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Jc.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}`})}};__.Datasets=kYe});var Hsr=S(v_=>{"use strict";var Uto=v_&&v_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Bto=v_&&v_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),doe=v_&&v_.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Uto(r,e,n[o]);return Bto(r,e),r}}(),y2=v_&&v_.__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())})},zto=v_&&v_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(v_,"__esModule",{value:!0});v_.Connectors=void 0;var PK=doe(f1()),jn=doe(te()),ir=doe(LN()),MK=zto(kF()),UF=doe(d1()),yl=doe(Tc()),qYe=class{constructor(e={}){this._options=e}list(e={},r){return jn.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return y2(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:jn.fetcher)({url:(0,MK.default)((i=(o=yield jn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield jn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PK.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield jn.Supplier.get(this._options.clientName))!=null?yield jn.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":jn.RUNTIME.type,"X-Fern-Runtime-Version":jn.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:UF.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 ir.BadRequestError(l.error.body,l.rawResponse);case 401:throw new ir.UnauthorizedError(l.error.body,l.rawResponse);case 403:throw new ir.ForbiddenError(l.error.body,l.rawResponse);case 404:throw new ir.NotFoundError(l.error.body,l.rawResponse);case 422:throw new ir.UnprocessableEntityError(l.error.body,l.rawResponse);case 429:throw new ir.TooManyRequestsError(l.error.body,l.rawResponse);case 498:throw new ir.InvalidTokenError(l.error.body,l.rawResponse);case 499:throw new ir.ClientClosedRequestError(l.error.body,l.rawResponse);case 500:throw new ir.InternalServerError(l.error.body,l.rawResponse);case 501:throw new ir.NotImplementedError(l.error.body,l.rawResponse);case 503:throw new ir.ServiceUnavailableError(l.error.body,l.rawResponse);case 504:throw new ir.GatewayTimeoutError(l.error.body,l.rawResponse);default:throw new yl.CohereError({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new yl.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new yl.CohereTimeoutError("Timeout exceeded when calling GET /v1/connectors.");case"unknown":throw new yl.CohereError({message:l.error.errorMessage,rawResponse:l.rawResponse})}})}create(e,r){return jn.HttpResponsePromise.fromPromise(this.__create(e,r))}__create(e,r){return y2(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:jn.fetcher)({url:(0,MK.default)((i=(o=yield jn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield jn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PK.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield jn.Supplier.get(this._options.clientName))!=null?yield jn.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":jn.RUNTIME.type,"X-Fern-Runtime-Version":jn.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:UF.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:UF.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 ir.BadRequestError(a.error.body,a.rawResponse);case 401:throw new ir.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new ir.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new ir.NotFoundError(a.error.body,a.rawResponse);case 422:throw new ir.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new ir.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new ir.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new ir.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new ir.InternalServerError(a.error.body,a.rawResponse);case 501:throw new ir.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new ir.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new ir.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new yl.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new yl.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new yl.CohereTimeoutError("Timeout exceeded when calling POST /v1/connectors.");case"unknown":throw new yl.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}get(e,r){return jn.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return y2(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:jn.fetcher)({url:(0,MK.default)((i=(o=yield jn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield jn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PK.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield jn.Supplier.get(this._options.clientName))!=null?yield jn.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":jn.RUNTIME.type,"X-Fern-Runtime-Version":jn.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:UF.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 ir.BadRequestError(a.error.body,a.rawResponse);case 401:throw new ir.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new ir.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new ir.NotFoundError(a.error.body,a.rawResponse);case 422:throw new ir.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new ir.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new ir.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new ir.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new ir.InternalServerError(a.error.body,a.rawResponse);case 501:throw new ir.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new ir.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new ir.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new yl.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new yl.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new yl.CohereTimeoutError("Timeout exceeded when calling GET /v1/connectors/{id}.");case"unknown":throw new yl.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}delete(e,r){return jn.HttpResponsePromise.fromPromise(this.__delete(e,r))}__delete(e,r){return y2(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:jn.fetcher)({url:(0,MK.default)((i=(o=yield jn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield jn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PK.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield jn.Supplier.get(this._options.clientName))!=null?yield jn.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":jn.RUNTIME.type,"X-Fern-Runtime-Version":jn.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:UF.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 ir.BadRequestError(a.error.body,a.rawResponse);case 401:throw new ir.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new ir.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new ir.NotFoundError(a.error.body,a.rawResponse);case 422:throw new ir.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new ir.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new ir.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new ir.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new ir.InternalServerError(a.error.body,a.rawResponse);case 501:throw new ir.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new ir.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new ir.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new yl.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new yl.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new yl.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/connectors/{id}.");case"unknown":throw new yl.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}update(e,r={},n){return jn.HttpResponsePromise.fromPromise(this.__update(e,r,n))}__update(e){return y2(this,arguments,void 0,function*(r,n={},o){var i,a,s;let u=yield((i=this._options.fetcher)!==null&&i!==void 0?i:jn.fetcher)({url:(0,MK.default)((s=(a=yield jn.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield jn.Supplier.get(this._options.environment))!==null&&s!==void 0?s:PK.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(r)}`),method:"PATCH",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield jn.Supplier.get(this._options.clientName))!=null?yield jn.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":jn.RUNTIME.type,"X-Fern-Runtime-Version":jn.RUNTIME.version},o?.headers),contentType:"application/json",requestType:"json",body:UF.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:UF.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 ir.BadRequestError(u.error.body,u.rawResponse);case 401:throw new ir.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new ir.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new ir.NotFoundError(u.error.body,u.rawResponse);case 422:throw new ir.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new ir.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new ir.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new ir.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new ir.InternalServerError(u.error.body,u.rawResponse);case 501:throw new ir.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new ir.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new ir.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new yl.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new yl.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new yl.CohereTimeoutError("Timeout exceeded when calling PATCH /v1/connectors/{id}.");case"unknown":throw new yl.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}oAuthAuthorize(e,r={},n){return jn.HttpResponsePromise.fromPromise(this.__oAuthAuthorize(e,r,n))}__oAuthAuthorize(e){return y2(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:jn.fetcher)({url:(0,MK.default)((s=(a=yield jn.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield jn.Supplier.get(this._options.environment))!==null&&s!==void 0?s:PK.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(r)}/oauth/authorize`),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield jn.Supplier.get(this._options.clientName))!=null?yield jn.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":jn.RUNTIME.type,"X-Fern-Runtime-Version":jn.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:UF.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 ir.BadRequestError(c.error.body,c.rawResponse);case 401:throw new ir.UnauthorizedError(c.error.body,c.rawResponse);case 403:throw new ir.ForbiddenError(c.error.body,c.rawResponse);case 404:throw new ir.NotFoundError(c.error.body,c.rawResponse);case 422:throw new ir.UnprocessableEntityError(c.error.body,c.rawResponse);case 429:throw new ir.TooManyRequestsError(c.error.body,c.rawResponse);case 498:throw new ir.InvalidTokenError(c.error.body,c.rawResponse);case 499:throw new ir.ClientClosedRequestError(c.error.body,c.rawResponse);case 500:throw new ir.InternalServerError(c.error.body,c.rawResponse);case 501:throw new ir.NotImplementedError(c.error.body,c.rawResponse);case 503:throw new ir.ServiceUnavailableError(c.error.body,c.rawResponse);case 504:throw new ir.GatewayTimeoutError(c.error.body,c.rawResponse);default:throw new yl.CohereError({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new yl.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new yl.CohereTimeoutError("Timeout exceeded when calling POST /v1/connectors/{id}/oauth/authorize.");case"unknown":throw new yl.CohereError({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}_getAuthorizationHeader(){return y2(this,void 0,void 0,function*(){var e;let r=(e=yield jn.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new yl.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}`})}};v_.Connectors=qYe});var Ksr=S(w_=>{"use strict";var Vto=w_&&w_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hto=w_&&w_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),foe=w_&&w_.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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}}(),UYe=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())})},Jto=w_&&w_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(w_,"__esModule",{value:!0});w_.Models=void 0;var Jsr=foe(f1()),yg=foe(te()),Ul=foe(LN()),Wsr=Jto(kF()),BYe=foe(d1()),p1=foe(Tc()),zYe=class{constructor(e={}){this._options=e}get(e,r){return yg.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return UYe(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:yg.fetcher)({url:(0,Wsr.default)((i=(o=yield yg.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield yg.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Jsr.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield yg.Supplier.get(this._options.clientName))!=null?yield yg.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":yg.RUNTIME.type,"X-Fern-Runtime-Version":yg.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:BYe.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 Ul.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ul.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ul.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ul.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ul.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ul.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ul.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ul.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ul.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ul.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ul.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ul.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new p1.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new p1.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new p1.CohereTimeoutError("Timeout exceeded when calling GET /v1/models/{model}.");case"unknown":throw new p1.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}list(e={},r){return yg.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return UYe(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=BYe.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:yg.fetcher)({url:(0,Wsr.default)((i=(o=yield yg.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield yg.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Jsr.CohereEnvironment.Production,"v1/models"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield yg.Supplier.get(this._options.clientName))!=null?yield yg.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":yg.RUNTIME.type,"X-Fern-Runtime-Version":yg.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:BYe.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 Ul.BadRequestError(d.error.body,d.rawResponse);case 401:throw new Ul.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new Ul.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new Ul.NotFoundError(d.error.body,d.rawResponse);case 422:throw new Ul.UnprocessableEntityError(d.error.body,d.rawResponse);case 429:throw new Ul.TooManyRequestsError(d.error.body,d.rawResponse);case 498:throw new Ul.InvalidTokenError(d.error.body,d.rawResponse);case 499:throw new Ul.ClientClosedRequestError(d.error.body,d.rawResponse);case 500:throw new Ul.InternalServerError(d.error.body,d.rawResponse);case 501:throw new Ul.NotImplementedError(d.error.body,d.rawResponse);case 503:throw new Ul.ServiceUnavailableError(d.error.body,d.rawResponse);case 504:throw new Ul.GatewayTimeoutError(d.error.body,d.rawResponse);default:throw new p1.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new p1.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new p1.CohereTimeoutError("Timeout exceeded when calling GET /v1/models.");case"unknown":throw new p1.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return UYe(this,void 0,void 0,function*(){var e;let r=(e=yield yg.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new p1.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}`})}};w_.Models=zYe});var Gsr=S(S_=>{"use strict";var Wto=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]}),Kto=S_&&S_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),poe=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"&&Wto(r,e,n[o]);return Kto(r,e),r}}(),BF=S_&&S_.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},Gto=S_&&S_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(S_,"__esModule",{value:!0});S_.Finetuning=void 0;var b2=poe(f1()),Vr=poe(te()),Jo=poe(LN()),_2=Gto(kF()),m1=poe(d1()),ou=poe(Tc()),VYe=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){return Vr.HttpResponsePromise.fromPromise(this.__listFinetunedModels(e,r))}__listFinetunedModels(){return BF(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:Vr.fetcher)({url:(0,_2.default)((i=(o=yield Vr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Vr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:b2.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vr.Supplier.get(this._options.clientName))!=null?yield Vr.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":Vr.RUNTIME.type,"X-Fern-Runtime-Version":Vr.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:m1.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 Jo.BadRequestError(c.error.body,c.rawResponse);case 401:throw new Jo.UnauthorizedError(c.error.body,c.rawResponse);case 403:throw new Jo.ForbiddenError(c.error.body,c.rawResponse);case 404:throw new Jo.NotFoundError(c.error.body,c.rawResponse);case 500:throw new Jo.InternalServerError(c.error.body,c.rawResponse);case 503:throw new Jo.ServiceUnavailableError(c.error.body,c.rawResponse);default:throw new ou.CohereError({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new ou.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new ou.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models.");case"unknown":throw new ou.CohereError({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}createFinetunedModel(e,r){return Vr.HttpResponsePromise.fromPromise(this.__createFinetunedModel(e,r))}__createFinetunedModel(e,r){return BF(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Vr.fetcher)({url:(0,_2.default)((i=(o=yield Vr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Vr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:b2.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vr.Supplier.get(this._options.clientName))!=null?yield Vr.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":Vr.RUNTIME.type,"X-Fern-Runtime-Version":Vr.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:m1.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:m1.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 Jo.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Jo.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Jo.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Jo.NotFoundError(a.error.body,a.rawResponse);case 500:throw new Jo.InternalServerError(a.error.body,a.rawResponse);case 503:throw new Jo.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new ou.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new ou.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new ou.CohereTimeoutError("Timeout exceeded when calling POST /v1/finetuning/finetuned-models.");case"unknown":throw new ou.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}getFinetunedModel(e,r){return Vr.HttpResponsePromise.fromPromise(this.__getFinetunedModel(e,r))}__getFinetunedModel(e,r){return BF(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Vr.fetcher)({url:(0,_2.default)((i=(o=yield Vr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Vr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:b2.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vr.Supplier.get(this._options.clientName))!=null?yield Vr.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":Vr.RUNTIME.type,"X-Fern-Runtime-Version":Vr.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:m1.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 Jo.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Jo.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Jo.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Jo.NotFoundError(a.error.body,a.rawResponse);case 500:throw new Jo.InternalServerError(a.error.body,a.rawResponse);case 503:throw new Jo.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new ou.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new ou.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new ou.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new ou.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}deleteFinetunedModel(e,r){return Vr.HttpResponsePromise.fromPromise(this.__deleteFinetunedModel(e,r))}__deleteFinetunedModel(e,r){return BF(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Vr.fetcher)({url:(0,_2.default)((i=(o=yield Vr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Vr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:b2.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vr.Supplier.get(this._options.clientName))!=null?yield Vr.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":Vr.RUNTIME.type,"X-Fern-Runtime-Version":Vr.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:m1.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 Jo.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Jo.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Jo.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Jo.NotFoundError(a.error.body,a.rawResponse);case 500:throw new Jo.InternalServerError(a.error.body,a.rawResponse);case 503:throw new Jo.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new ou.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new ou.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new ou.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new ou.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}updateFinetunedModel(e,r,n){return Vr.HttpResponsePromise.fromPromise(this.__updateFinetunedModel(e,r,n))}__updateFinetunedModel(e,r,n){return BF(this,void 0,void 0,function*(){var o,i,a;let s=yield((o=this._options.fetcher)!==null&&o!==void 0?o:Vr.fetcher)({url:(0,_2.default)((a=(i=yield Vr.Supplier.get(this._options.baseUrl))!==null&&i!==void 0?i:yield Vr.Supplier.get(this._options.environment))!==null&&a!==void 0?a:b2.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vr.Supplier.get(this._options.clientName))!=null?yield Vr.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":Vr.RUNTIME.type,"X-Fern-Runtime-Version":Vr.RUNTIME.version},n?.headers),contentType:"application/json",requestType:"json",body:m1.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:m1.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 Jo.BadRequestError(s.error.body,s.rawResponse);case 401:throw new Jo.UnauthorizedError(s.error.body,s.rawResponse);case 403:throw new Jo.ForbiddenError(s.error.body,s.rawResponse);case 404:throw new Jo.NotFoundError(s.error.body,s.rawResponse);case 500:throw new Jo.InternalServerError(s.error.body,s.rawResponse);case 503:throw new Jo.ServiceUnavailableError(s.error.body,s.rawResponse);default:throw new ou.CohereError({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new ou.CohereError({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new ou.CohereTimeoutError("Timeout exceeded when calling PATCH /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new ou.CohereError({message:s.error.errorMessage,rawResponse:s.rawResponse})}})}listEvents(e,r={},n){return Vr.HttpResponsePromise.fromPromise(this.__listEvents(e,r,n))}__listEvents(e){return BF(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:Vr.fetcher)({url:(0,_2.default)((s=(a=yield Vr.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Vr.Supplier.get(this._options.environment))!==null&&s!==void 0?s:b2.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(r)}/events`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vr.Supplier.get(this._options.clientName))!=null?yield Vr.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":Vr.RUNTIME.type,"X-Fern-Runtime-Version":Vr.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:m1.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 Jo.BadRequestError(f.error.body,f.rawResponse);case 401:throw new Jo.UnauthorizedError(f.error.body,f.rawResponse);case 403:throw new Jo.ForbiddenError(f.error.body,f.rawResponse);case 404:throw new Jo.NotFoundError(f.error.body,f.rawResponse);case 500:throw new Jo.InternalServerError(f.error.body,f.rawResponse);case 503:throw new Jo.ServiceUnavailableError(f.error.body,f.rawResponse);default:throw new ou.CohereError({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new ou.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new ou.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/events.");case"unknown":throw new ou.CohereError({message:f.error.errorMessage,rawResponse:f.rawResponse})}})}listTrainingStepMetrics(e,r={},n){return Vr.HttpResponsePromise.fromPromise(this.__listTrainingStepMetrics(e,r,n))}__listTrainingStepMetrics(e){return BF(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:Vr.fetcher)({url:(0,_2.default)((s=(a=yield Vr.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Vr.Supplier.get(this._options.environment))!==null&&s!==void 0?s:b2.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(r)}/training-step-metrics`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Vr.Supplier.get(this._options.clientName))!=null?yield Vr.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":Vr.RUNTIME.type,"X-Fern-Runtime-Version":Vr.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:m1.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 Jo.BadRequestError(d.error.body,d.rawResponse);case 401:throw new Jo.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new Jo.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new Jo.NotFoundError(d.error.body,d.rawResponse);case 500:throw new Jo.InternalServerError(d.error.body,d.rawResponse);case 503:throw new Jo.ServiceUnavailableError(d.error.body,d.rawResponse);default:throw new ou.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new ou.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ou.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/training-step-metrics.");case"unknown":throw new ou.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return BF(this,void 0,void 0,function*(){var e;let r=(e=yield Vr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new ou.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}`})}};S_.Finetuning=VYe});var NCe=S(wy=>{"use strict";var Xto=wy&&wy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zto=wy&&wy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),moe=wy&&wy.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Xto(r,e,n[o]);return Zto(r,e),r}}(),C_=wy&&wy.__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())})},Xsr=wy&&wy.__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},Yto=wy&&wy.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wy,"__esModule",{value:!0});wy.CohereClient=void 0;var PC=moe(f1()),ct=moe(te()),Re=moe(LN()),Wc=moe(d1()),MC=Yto(kF()),Mo=moe(Tc()),Qto=LYe(),ero=zsr(),tro=Vsr(),rro=Hsr(),nro=Ksr(),oro=Gsr(),HYe=class{constructor(e={}){this._options=e}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new Qto.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new ero.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new tro.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new rro.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new nro.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new oro.Finetuning(this._options)}chatStream(e,r){return ct.HttpResponsePromise.fromPromise(this.__chatStream(e,r))}__chatStream(e,r){return C_(this,void 0,void 0,function*(){var n,o,i;let{accepts:a}=e,s=Xsr(e,["accepts"]),u=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ct.fetcher)({url:(0,MC.default)((i=(o=yield ct.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ct.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PC.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ct.Supplier.get(this._options.clientName))!=null?yield ct.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":ct.RUNTIME.type,"X-Fern-Runtime-Version":ct.RUNTIME.version,Accepts:a??void 0},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Wc.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 ct.Stream({stream:u.body,parse:l=>C_(this,void 0,void 0,function*(){return Wc.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 Re.BadRequestError(u.error.body,u.rawResponse);case 401:throw new Re.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new Re.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new Re.NotFoundError(u.error.body,u.rawResponse);case 422:throw new Re.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new Re.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new Re.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new Re.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new Re.InternalServerError(u.error.body,u.rawResponse);case 501:throw new Re.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new Re.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new Re.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new Mo.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Mo.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new Mo.CohereTimeoutError("Timeout exceeded when calling POST /v1/chat.");case"unknown":throw new Mo.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}chat(e,r){return ct.HttpResponsePromise.fromPromise(this.__chat(e,r))}__chat(e,r){return C_(this,void 0,void 0,function*(){var n,o,i;let{accepts:a}=e,s=Xsr(e,["accepts"]),u=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ct.fetcher)({url:(0,MC.default)((i=(o=yield ct.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ct.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PC.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ct.Supplier.get(this._options.clientName))!=null?yield ct.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":ct.RUNTIME.type,"X-Fern-Runtime-Version":ct.RUNTIME.version,Accepts:a??void 0},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Wc.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:Wc.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 Re.BadRequestError(u.error.body,u.rawResponse);case 401:throw new Re.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new Re.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new Re.NotFoundError(u.error.body,u.rawResponse);case 422:throw new Re.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new Re.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new Re.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new Re.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new Re.InternalServerError(u.error.body,u.rawResponse);case 501:throw new Re.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new Re.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new Re.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new Mo.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Mo.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new Mo.CohereTimeoutError("Timeout exceeded when calling POST /v1/chat.");case"unknown":throw new Mo.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}generateStream(e,r){return ct.HttpResponsePromise.fromPromise(this.__generateStream(e,r))}__generateStream(e,r){return C_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ct.fetcher)({url:(0,MC.default)((i=(o=yield ct.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ct.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PC.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ct.Supplier.get(this._options.clientName))!=null?yield ct.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":ct.RUNTIME.type,"X-Fern-Runtime-Version":ct.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Wc.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 ct.Stream({stream:a.body,parse:s=>C_(this,void 0,void 0,function*(){return Wc.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 Re.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Re.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Re.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Re.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Re.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Re.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Re.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Re.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Re.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Re.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Re.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Re.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Mo.CohereTimeoutError("Timeout exceeded when calling POST /v1/generate.");case"unknown":throw new Mo.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}generate(e,r){return ct.HttpResponsePromise.fromPromise(this.__generate(e,r))}__generate(e,r){return C_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ct.fetcher)({url:(0,MC.default)((i=(o=yield ct.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ct.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PC.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ct.Supplier.get(this._options.clientName))!=null?yield ct.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":ct.RUNTIME.type,"X-Fern-Runtime-Version":ct.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},Wc.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:Wc.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 Re.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Re.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Re.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Re.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Re.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Re.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Re.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Re.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Re.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Re.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Re.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Re.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Mo.CohereTimeoutError("Timeout exceeded when calling POST /v1/generate.");case"unknown":throw new Mo.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}embed(e={},r){return ct.HttpResponsePromise.fromPromise(this.__embed(e,r))}__embed(){return C_(this,arguments,void 0,function*(e={},r){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ct.fetcher)({url:(0,MC.default)((i=(o=yield ct.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ct.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PC.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ct.Supplier.get(this._options.clientName))!=null?yield ct.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":ct.RUNTIME.type,"X-Fern-Runtime-Version":ct.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Wc.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:Wc.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 Re.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Re.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Re.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Re.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Re.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Re.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Re.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Re.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Re.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Re.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Re.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Re.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Mo.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed.");case"unknown":throw new Mo.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}rerank(e,r){return ct.HttpResponsePromise.fromPromise(this.__rerank(e,r))}__rerank(e,r){return C_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ct.fetcher)({url:(0,MC.default)((i=(o=yield ct.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ct.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PC.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ct.Supplier.get(this._options.clientName))!=null?yield ct.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":ct.RUNTIME.type,"X-Fern-Runtime-Version":ct.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Wc.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:Wc.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 Re.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Re.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Re.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Re.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Re.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Re.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Re.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Re.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Re.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Re.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Re.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Re.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Mo.CohereTimeoutError("Timeout exceeded when calling POST /v1/rerank.");case"unknown":throw new Mo.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}classify(e,r){return ct.HttpResponsePromise.fromPromise(this.__classify(e,r))}__classify(e,r){return C_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ct.fetcher)({url:(0,MC.default)((i=(o=yield ct.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ct.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PC.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ct.Supplier.get(this._options.clientName))!=null?yield ct.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":ct.RUNTIME.type,"X-Fern-Runtime-Version":ct.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Wc.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:Wc.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 Re.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Re.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Re.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Re.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Re.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Re.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Re.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Re.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Re.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Re.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Re.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Re.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Mo.CohereTimeoutError("Timeout exceeded when calling POST /v1/classify.");case"unknown":throw new Mo.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}summarize(e,r){return ct.HttpResponsePromise.fromPromise(this.__summarize(e,r))}__summarize(e,r){return C_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ct.fetcher)({url:(0,MC.default)((i=(o=yield ct.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ct.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PC.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ct.Supplier.get(this._options.clientName))!=null?yield ct.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":ct.RUNTIME.type,"X-Fern-Runtime-Version":ct.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Wc.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:Wc.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 Re.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Re.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Re.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Re.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Re.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Re.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Re.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Re.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Re.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Re.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Re.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Re.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Mo.CohereTimeoutError("Timeout exceeded when calling POST /v1/summarize.");case"unknown":throw new Mo.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}tokenize(e,r){return ct.HttpResponsePromise.fromPromise(this.__tokenize(e,r))}__tokenize(e,r){return C_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ct.fetcher)({url:(0,MC.default)((i=(o=yield ct.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ct.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PC.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ct.Supplier.get(this._options.clientName))!=null?yield ct.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":ct.RUNTIME.type,"X-Fern-Runtime-Version":ct.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Wc.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:Wc.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 Re.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Re.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Re.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Re.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Re.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Re.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Re.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Re.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Re.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Re.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Re.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Re.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Mo.CohereTimeoutError("Timeout exceeded when calling POST /v1/tokenize.");case"unknown":throw new Mo.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}detokenize(e,r){return ct.HttpResponsePromise.fromPromise(this.__detokenize(e,r))}__detokenize(e,r){return C_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ct.fetcher)({url:(0,MC.default)((i=(o=yield ct.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ct.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PC.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ct.Supplier.get(this._options.clientName))!=null?yield ct.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":ct.RUNTIME.type,"X-Fern-Runtime-Version":ct.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Wc.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:Wc.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 Re.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Re.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Re.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Re.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Re.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Re.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Re.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Re.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Re.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Re.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Re.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Re.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Mo.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Mo.CohereTimeoutError("Timeout exceeded when calling POST /v1/detokenize.");case"unknown":throw new Mo.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}checkApiKey(e){return ct.HttpResponsePromise.fromPromise(this.__checkApiKey(e))}__checkApiKey(e){return C_(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:ct.fetcher)({url:(0,MC.default)((o=(n=yield ct.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield ct.Supplier.get(this._options.environment))!==null&&o!==void 0?o:PC.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ct.Supplier.get(this._options.clientName))!=null?yield ct.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":ct.RUNTIME.type,"X-Fern-Runtime-Version":ct.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:Wc.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 Re.BadRequestError(i.error.body,i.rawResponse);case 401:throw new Re.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new Re.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new Re.NotFoundError(i.error.body,i.rawResponse);case 422:throw new Re.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new Re.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new Re.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new Re.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new Re.InternalServerError(i.error.body,i.rawResponse);case 501:throw new Re.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new Re.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new Re.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new Mo.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new Mo.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new Mo.CohereTimeoutError("Timeout exceeded when calling POST /v1/check-api-key.");case"unknown":throw new Mo.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}_getAuthorizationHeader(){return C_(this,void 0,void 0,function*(){var e;let r=(e=yield ct.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Mo.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}`})}};wy.CohereClient=HYe});var WYe=S(jCe=>{"use strict";Object.defineProperty(jCe,"__esModule",{value:!0});jCe.CohereClientV2=void 0;var iro=LYe(),aro=NCe(),JYe=class{constructor(e){this._options=e,this.client=new aro.CohereClient(this._options),this.clientV2=new iro.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}};jCe.CohereClientV2=JYe});var XYe=S(IK=>{"use strict";Object.defineProperty(IK,"__esModule",{value:!0});IK.AwsClientV2=IK.AwsClient=void 0;var sro=NCe(),uro=WYe(),KYe=class extends sro.CohereClient{constructor(e){e.token="n/a",super(e)}};IK.AwsClient=KYe;var GYe=class extends uro.CohereClientV2{constructor(e){e.token="n/a",super(e)}};IK.AwsClientV2=GYe});var Qsr=S(RK=>{"use strict";Object.defineProperty(RK,"__esModule",{value:!0});RK.BedrockClientV2=RK.BedrockClient=void 0;var Zsr=DYe(),Ysr=XYe(),ZYe=class extends Ysr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,Zsr.fetchOverride)("bedrock",e)}))}};RK.BedrockClient=ZYe;var YYe=class extends Ysr.AwsClientV2{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,Zsr.fetchOverride)("bedrock",e)}))}};RK.BedrockClientV2=YYe});var eur=S(DCe=>{"use strict";Object.defineProperty(DCe,"__esModule",{value:!0});DCe.CustomClient=void 0;var lro=NCe(),QYe=class extends lro.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}};DCe.CustomClient=QYe});var nur=S(AK=>{"use strict";Object.defineProperty(AK,"__esModule",{value:!0});AK.SagemakerClientV2=AK.SagemakerClient=void 0;var tur=XYe(),rur=DYe(),eQe=class extends tur.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,rur.fetchOverride)("sagemaker",e)}))}};AK.SagemakerClient=eQe;var tQe=class extends tur.AwsClientV2{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,rur.fetchOverride)("sagemaker",e)}))}};AK.SagemakerClientV2=tQe});var sur=S(mu=>{"use strict";var cro=mu&&mu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dro=mu&&mu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fro=mu&&mu.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(mu,"__esModule",{value:!0});mu.SagemakerClientV2=mu.SagemakerClient=mu.CohereTimeoutError=mu.CohereError=mu.CohereEnvironment=mu.CohereClient=mu.CohereClientV2=mu.BedrockClientV2=mu.BedrockClient=mu.Cohere=void 0;mu.Cohere=fro(LN());var our=Qsr();Object.defineProperty(mu,"BedrockClient",{enumerable:!0,get:function(){return our.BedrockClient}});Object.defineProperty(mu,"BedrockClientV2",{enumerable:!0,get:function(){return our.BedrockClientV2}});var pro=WYe();Object.defineProperty(mu,"CohereClientV2",{enumerable:!0,get:function(){return pro.CohereClientV2}});var mro=eur();Object.defineProperty(mu,"CohereClient",{enumerable:!0,get:function(){return mro.CustomClient}});var hro=f1();Object.defineProperty(mu,"CohereEnvironment",{enumerable:!0,get:function(){return hro.CohereEnvironment}});var iur=Tc();Object.defineProperty(mu,"CohereError",{enumerable:!0,get:function(){return iur.CohereError}});Object.defineProperty(mu,"CohereTimeoutError",{enumerable:!0,get:function(){return iur.CohereTimeoutError}});var aur=nur();Object.defineProperty(mu,"SagemakerClient",{enumerable:!0,get:function(){return aur.SagemakerClient}});Object.defineProperty(mu,"SagemakerClientV2",{enumerable:!0,get:function(){return aur.SagemakerClientV2}})});function NK(t){if(t?.client)return t.client;let e=t?.apiKey??vn("COHERE_API_KEY");if(!e)throw new Error("COHERE_API_KEY must be set");return new uur.CohereClient({token:e})}var uur,hoe=v(()=>{uur=L(sur(),1);ku()});function RC(t,e){e?(hh[0]=hh[16]=hh[1]=hh[2]=hh[3]=hh[4]=hh[5]=hh[6]=hh[7]=hh[8]=hh[9]=hh[10]=hh[11]=hh[12]=hh[13]=hh[14]=hh[15]=0,this.blocks=hh):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 Er,gro,IC,$Ce,hh,LCe,rQe=v(()=>{Er="0123456789abcdef".split(""),gro=[-2147483648,8388608,32768,128],IC=[24,16,8,0],$Ce=[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],hh=[];RC.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]<<IC[i++&3];else for(i=this.start;o<a&&i<64;++o)n=t.charCodeAt(o),n<128?s[i>>>2]|=n<<IC[i++&3]:n<2048?(s[i>>>2]|=(192|n>>>6)<<IC[i++&3],s[i>>>2]|=(128|n&63)<<IC[i++&3]):n<55296||n>=57344?(s[i>>>2]|=(224|n>>>12)<<IC[i++&3],s[i>>>2]|=(128|n>>>6&63)<<IC[i++&3],s[i>>>2]|=(128|n&63)<<IC[i++&3]):(n=65536+((n&1023)<<10|t.charCodeAt(++o)&1023),s[i>>>2]|=(240|n>>>18)<<IC[i++&3],s[i>>>2]|=(128|n>>>12&63)<<IC[i++&3],s[i>>>2]|=(128|n>>>6&63)<<IC[i++&3],s[i>>>2]|=(128|n&63)<<IC[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}};RC.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=gro[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()}};RC.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+$Ce[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+$Ce[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+$Ce[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+$Ce[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};RC.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=Er[t>>>28&15]+Er[t>>>24&15]+Er[t>>>20&15]+Er[t>>>16&15]+Er[t>>>12&15]+Er[t>>>8&15]+Er[t>>>4&15]+Er[t&15]+Er[e>>>28&15]+Er[e>>>24&15]+Er[e>>>20&15]+Er[e>>>16&15]+Er[e>>>12&15]+Er[e>>>8&15]+Er[e>>>4&15]+Er[e&15]+Er[r>>>28&15]+Er[r>>>24&15]+Er[r>>>20&15]+Er[r>>>16&15]+Er[r>>>12&15]+Er[r>>>8&15]+Er[r>>>4&15]+Er[r&15]+Er[n>>>28&15]+Er[n>>>24&15]+Er[n>>>20&15]+Er[n>>>16&15]+Er[n>>>12&15]+Er[n>>>8&15]+Er[n>>>4&15]+Er[n&15]+Er[o>>>28&15]+Er[o>>>24&15]+Er[o>>>20&15]+Er[o>>>16&15]+Er[o>>>12&15]+Er[o>>>8&15]+Er[o>>>4&15]+Er[o&15]+Er[i>>>28&15]+Er[i>>>24&15]+Er[i>>>20&15]+Er[i>>>16&15]+Er[i>>>12&15]+Er[i>>>8&15]+Er[i>>>4&15]+Er[i&15]+Er[a>>>28&15]+Er[a>>>24&15]+Er[a>>>20&15]+Er[a>>>16&15]+Er[a>>>12&15]+Er[a>>>8&15]+Er[a>>>4&15]+Er[a&15];return this.is224||(u+=Er[s>>>28&15]+Er[s>>>24&15]+Er[s>>>20&15]+Er[s>>>16&15]+Er[s>>>12&15]+Er[s>>>8&15]+Er[s>>>4&15]+Er[s&15]),u};RC.prototype.toString=RC.prototype.hex;RC.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};RC.prototype.array=RC.prototype.digest;RC.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};LCe=(...t)=>new RC(!1,!0).update(t.join("")).hex()});var yro,lur=v(()=>{Bo();rQe();yro={};Rt(yro,{sha256:()=>LCe})});function _ro(t){return t.message!==void 0?{text:t.text,message:BY(t.message)}:{text:t.text}}function vro(t){let e={text:t.text};return t.message!==void 0&&(e.message=t.message.toDict()),e}var bro,cur,dur,wro,nQe,pur=v(()=>{Bo();H0();rQe();lur();bro={};Rt(bro,{BaseCache:()=>dur,InMemoryCache:()=>nQe,defaultHashKeyEncoder:()=>cur,deserializeStoredGeneration:()=>_ro,serializeGeneration:()=>vro});cur=(...t)=>LCe(t.join("_"));dur=class{constructor(){x(this,"keyEncoder",cur)}makeDefaultKeyEncoder(t){this.keyEncoder=t}},wro=new Map,nQe=class fur extends dur{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 fur(wro)}}});function Oro(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 Tro(t,e){return t.length===1?[e.get(t.join(","))]:Oro(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function Ero(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function iQe(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 mur,Sro,Cro,xro,oQe,FCe,hur=v(()=>{mur=L(wHe(),1),Sro=Object.defineProperty,Cro=(t,e,r)=>e in t?Sro(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xro=(t,e,r)=>(Cro(t,typeof e!="symbol"?e+"":e,r),r);oQe=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=mur.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=oQe.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=oQe.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(...Tro(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)}},FCe=oQe;xro(FCe,"specialTokenRegex",t=>new RegExp(t.map(e=>Ero(e)).join("|"),"g"))});var gur=v(()=>{hur()});async function aQe(t){return t in kCe||(kCe[t]=Mro.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new FCe(e)).catch(e=>{throw delete kCe[t],e})),await kCe[t]}async function qCe(t){return aQe(iQe(t))}var Pro,kCe,Mro,sQe=v(()=>{Bo();GB();gur();Pro={};Rt(Pro,{encodingForModel:()=>qCe,getEncoding:()=>aQe});kCe={},Mro=new Fw({})});function Hv(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 Iro,UCe,Rro,yur,bur,Aro,jK,v2,Jv=v(()=>{Bo();H0();GB();Qh();lee();pur();sQe();Iro={};Rt(Iro,{BaseLangChain:()=>jK,BaseLanguageModel:()=>v2,calculateMaxTokens:()=>bur,getEmbeddingContextSize:()=>Rro,getModelContextSize:()=>yur,getModelNameForTiktoken:()=>UCe,isOpenAITool:()=>Hv});UCe=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,Rro=t=>{switch(t){case"text-embedding-ada-002":return 8191;default:return 2046}},yur=t=>{switch(UCe(t)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};bur=async({prompt:t,modelName:e})=>{let r;try{r=(await qCe(UCe(e))).encode(t).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(t.length/4)}return yur(e)-r},Aro=()=>!1,jK=class extends Vo{constructor(e){super(e);x(this,"verbose");x(this,"callbacks");x(this,"tags");x(this,"metadata");this.verbose=e.verbose??Aro(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}get lc_attributes(){return{callbacks:void 0,verbose:void 0}}},v2=class extends jK{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=nQe.global():this.cache=void 0,this.caller=new Fw(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 qCe("modelName"in this?UCe(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 see(e):Array.isArray(e)?new uee(e.map(Aw)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...r}){let n={...this._identifyingParams(),...r,_type:this._llmType(),_model:this._modelType()};return Object.entries(n).filter(([a,s])=>s!==void 0).map(([a,s])=>`${a}:${JSON.stringify(s)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}get profile(){return{}}}});function goe(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function yoe(t){return t!==void 0&&Vo.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function boe(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(Ya(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 bg(t){return boe(t)||yoe(t)||goe(t)}var uQe=v(()=>{eN();Qh()});function _ur(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:Ni(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function h1(t,e){let r=typeof e=="number"?void 0:e,n;return bg(t)?n={type:"function",function:_ur(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var Nro,g1=v(()=>{Bo();nb();uQe();Nro={};Rt(Nro,{convertToOpenAIFunction:()=>_ur,convertToOpenAITool:()=>h1,isLangChainTool:()=>bg,isRunnableToolLike:()=>yoe,isStructuredTool:()=>goe,isStructuredToolParams:()=>boe})});function BCe(t){let e=t.constructor;return new e({...t,content:t.contentBlocks,response_metadata:{...t.response_metadata,output_version:"v1"}})}var vur,wur=v(()=>{vur=t=>t()});function lQe(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];(J3(i)||W3(i))&&n===r&&(n=new r.constructor({...n,content:[...r.content.slice(0,o),Gfe(i),...r.content.slice(o+1)]}))}e.push(n)}return e}var jro,md,Dro,YI=v(()=>{Bo();DY();Jg();H0();Rw();ku();WY();z$();nO();id();eN();nb();Qh();Qa();Jv();qhe();wur();jro={};Rt(jro,{BaseChatModel:()=>md,SimpleChatModel:()=>Dro});md=class w2 extends v2{constructor(r){super(r);x(this,"lc_namespace",["langchain","chat_models",this._llmType()]);x(this,"disableStreaming",!1);x(this,"outputVersion");this.outputVersion=vur(()=>{let n=r.outputVersion??vn("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=w2._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===w2.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(r,n);else{let i=w2._convertInputToPromptValue(r).toChatMessages(),[a,s]=this._separateRunnableConfigFromCallOptionsCompat(n),u={...a.metadata,...this.getLsParams(s)},l=await rc.configure(a.callbacks,this.callbacks,a.tags,this.tags,u,this.metadata,{verbose:this.verbose}),c={options:s,invocation_params:this?.invocationParams(s),batch_size:1},d=s.outputVersion??this.outputVersion,f=await l?.handleChatModelStart(this.toJSON(),[lQe(i)],a.runId,void 0,c,void 0,void 0,a.runName),p,m;try{for await(let h of this._streamResponseChunks(i,s,f?.[0])){if(h.message.id==null){let y=f?.at(0)?.runId;y!=null&&h.message._updateId(`run-${y}`)}h.message.response_metadata={...h.generationInfo,...h.message.response_metadata},d==="v1"?yield BCe(h.message):yield h.message,p?p=p.concat(h):p=h,UY(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}})}}catch(h){throw await Promise.all((f??[]).map(y=>y?.handleLLMError(h))),h}await Promise.all((f??[]).map(h=>h?.handleLLMEnd({generations:[[p]],llmOutput:m})))}}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(p=>p.map(Aw)),s;if(i!==void 0&&i.length===a.length)s=i;else{let p={...o.metadata,...this.getLsParams(n)},m=await rc.configure(o.callbacks,this.callbacks,o.tags,this.tags,p,this.metadata,{verbose:this.verbose}),h={options:n,invocation_params:this?.invocationParams(n),batch_size:1};s=await m?.handleChatModelStart(this.toJSON(),a.map(lQe),o.runId,void 0,h,void 0,void 0,o.runName)}let u=n.outputVersion??this.outputVersion,l=[],c=[];if(!!s?.[0].handlers.find(JY)&&!this.disableStreaming&&a.length===1&&this._streamResponseChunks!==w2.prototype._streamResponseChunks)try{let p=await this._streamResponseChunks(a[0],n,s?.[0]),m,h;for await(let y of p){if(y.message.id==null){let g=s?.at(0)?.runId;g!=null&&y.message._updateId(`run-${g}`)}m===void 0?m=y:m=eb(m,y),UY(y.message)&&y.message.usage_metadata!==void 0&&(h={tokenUsage:{promptTokens:y.message.usage_metadata.input_tokens,completionTokens:y.message.usage_metadata.output_tokens,totalTokens:y.message.usage_metadata.total_tokens}})}if(m===void 0)throw new Error("Received empty response from chat model call.");l.push([m]),await s?.[0].handleLLMEnd({generations:l,llmOutput:h})}catch(p){throw await s?.[0].handleLLMError(p),p}else{let p=await Promise.allSettled(a.map(async(m,h)=>{let y=await this._generate(m,{...n,promptIndex:h},s?.[h]);if(u==="v1")for(let g of y.generations)g.message=BCe(g.message);return y}));await Promise.all(p.map(async(m,h)=>{if(m.status==="fulfilled"){let y=m.value;for(let g of y.generations){if(g.message.id==null){let b=s?.at(0)?.runId;b!=null&&g.message._updateId(`run-${b}`)}g.message.response_metadata={...g.generationInfo,...g.message.response_metadata}}return y.generations.length===1&&(y.generations[0].message.response_metadata={...y.llmOutput,...y.generations[0].message.response_metadata}),l[h]=y.generations,c[h]=y.llmOutput,s?.[h]?.handleLLMEnd({generations:[y.generations],llmOutput:y.llmOutput})}else return await s?.[h]?.handleLLMError(m.reason),Promise.reject(m.reason)}))}let f={generations:l,llmOutput:c.length?this._combineLLMOutput?.(...c):void 0};return Object.defineProperty(f,KA,{value:s?{runIds:s?.map(p=>p.runId)}:void 0,configurable:!0}),f}async _generateCached({messages:r,cache:n,llmStringKey:o,parsedOptions:i,handledOptions:a}){let s=r.map(b=>b.map(Aw)),u={...a.metadata,...this.getLsParams(i)},l=await rc.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(lQe),a.runId,void 0,c,void 0,void 0,a.runName),f=[],m=(await Promise.allSettled(s.map(async(b,_)=>{let w=w2._convertInputToPromptValue(b).toString(),O=await n.lookup(w,o);return O==null&&f.push(_),O}))).map((b,_)=>({result:b,runManager:d?.[_]})).filter(({result:b})=>b.status==="fulfilled"&&b.value!=null||b.status==="rejected"),h=i.outputVersion??this.outputVersion,y=[];await Promise.all(m.map(async({result:b,runManager:_},w)=>{if(b.status==="fulfilled"){let O=b.value;return y[w]=O.map(T=>("message"in T&&Gh(T.message)&&Pl(T.message)&&(T.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},h==="v1"&&(T.message=BCe(T.message))),T.generationInfo={...T.generationInfo,tokenUsage:{}},T)),O.length&&await _?.handleLLMNewToken(O[0].text),_?.handleLLMEnd({generations:[O]},void 0,void 0,void 0,{cached:!0})}else return await _?.handleLLMError(b.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(b.reason)}));let g={generations:y,missingPromptIndices:f,startedRunManagers:d};return Object.defineProperty(g,KA,{value:d?{runIds:d?.map(b=>b.runId)}:void 0,configurable:!0}),g}async generate(r,n,o){let i;Array.isArray(n)?i={stop:n}:i=n;let a=r.map(h=>h.map(Aw)),[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 _=w2._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=eL(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;Ya(o)?c=[{type:"function",function:{name:l,description:a,parameters:Ni(o)}}]:("name"in o&&(l=o.name),c=[{type:"function",function:{name:l,description:a,parameters:o}}]);let d=this.bindTools(c),f=Yb.from(y=>{if(!Ir.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=Eu.assign({parsed:(y,g)=>f.invoke(y.raw,g)}),m=Eu.assign({parsed:()=>null}),h=p.withFallbacks({fallbacks:[m]});return Rl.from([{raw:d},h]).withConfig({runName:"StructuredOutputRunnable"})}},Dro=class extends md{async _generate(t,e,r){let n=await this._call(t,e,r),o=new eo(n);if(typeof o.content!="string")throw new Error("Cannot generate with a simple chat model when output is not a string.");return{generations:[{text:o.content,message:o}]}}}});function Sur(t,e=0){return(_g[t[e+0]]+_g[t[e+1]]+_g[t[e+2]]+_g[t[e+3]]+"-"+_g[t[e+4]]+_g[t[e+5]]+"-"+_g[t[e+6]]+_g[t[e+7]]+"-"+_g[t[e+8]]+_g[t[e+9]]+"-"+_g[t[e+10]]+_g[t[e+11]]+_g[t[e+12]]+_g[t[e+13]]+_g[t[e+14]]+_g[t[e+15]]).toLowerCase()}var _g,zCe,Cur=v(()=>{_g=[];for(zCe=0;zCe<256;++zCe)_g.push((zCe+256).toString(16).slice(1))});function cQe(){if(!VCe&&(VCe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!VCe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return VCe($ro)}var VCe,$ro,xur=v(()=>{$ro=new Uint8Array(16)});var Lro,dQe,Our=v(()=>{Lro=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),dQe={randomUUID:Lro}});function Fro(t,e,r){if(dQe.randomUUID&&!e&&!t)return dQe.randomUUID();t=t||{};var n=t.random||(t.rng||cQe)();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 Sur(n)}var fQe,Tur=v(()=>{Our();xur();Cur();fQe=Fro});var Eur=v(()=>{Tur()});var qro,Wv=v(()=>{Bo();eN();qro={};Rt(qro,{extendInteropZodObject:()=>EPt,getInteropZodDefaultGetter:()=>MPt,getInteropZodObjectShape:()=>lhe,getSchemaDescription:()=>eL,interopParse:()=>xPt,interopParseAsync:()=>Q$,interopSafeParse:()=>CPt,interopSafeParseAsync:()=>Y$,interopZodObjectMakeFieldsOptional:()=>IPt,interopZodObjectPartial:()=>PPt,interopZodObjectPassthrough:()=>che,interopZodObjectStrict:()=>hW,interopZodTransformInputSchema:()=>fhe,isInteropZodError:()=>phe,isInteropZodLiteral:()=>SPt,isInteropZodObject:()=>TPt,isInteropZodSchema:()=>Ya,isShapelessZodSchema:()=>OPt,isSimpleStringZodSchema:()=>gW,isZodArrayV4:()=>YQ,isZodLiteralV3:()=>S2e,isZodLiteralV4:()=>C2e,isZodNullableV4:()=>O2e,isZodObjectV3:()=>dhe,isZodObjectV4:()=>qw,isZodOptionalV4:()=>x2e,isZodSchema:()=>wPt,isZodSchemaV3:()=>ic,isZodSchemaV4:()=>Tu})});function Pur(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 HCe(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=>Pl(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 Uro(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function Mur(t){return t._getType()==="tool"}function Iur(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 Bro(t){if(t){if(t.every(Uro))return t;if(t.every(Hv))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:Iur(e.function.parameters)}));if(t.every(bg))return t.map(e=>{let r=Ya(e.schema)?Ni(e.schema):e.schema;return{name:e.name,description:e.description??"",parameterDefinitions:Iur(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var pQe,Rur=v(()=>{hoe();Qa();Jv();g1();YI();id();Eur();Wv();nb();pQe=class extends md{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=NK(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:Bro(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(!(Pl(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=HCe(c,s);i.push(d),s=[]}}else i.push(HCe(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=HCe(c,s);i.push(d),s=[]}}else i.push(HCe(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(Mur(o)){let i=o,a=n.filter(s=>Pl(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:Pur(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!Mur(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>Pl(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:Pur(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:fQe().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 eo({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 yi({text:a.text,message:new Ir({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new yi({text:"",message:new Ir({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 yi({text:"",message:new Ir({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 zro,mQe,JCe,voe=v(()=>{Bo();WY();z$();nO();id();Jv();zro={};Rt(zro,{BaseLLM:()=>mQe,LLM:()=>JCe});mQe=class _oe extends v2{constructor(){super(...arguments);x(this,"lc_namespace",["langchain","llms",this._llmType()])}async invoke(r,n){let o=_oe._convertInputToPromptValue(r);return(await this.generatePrompt([o],n,n?.callbacks)).generations[0][0].text}async*_streamResponseChunks(r,n,o){throw new Error("Not implemented.")}_separateRunnableConfigFromCallOptionsCompat(r){let[n,o]=super._separateRunnableConfigFromCallOptions(r);return o.signal=n.signal,[n,o]}async*_streamIterator(r,n){if(this._streamResponseChunks===_oe.prototype._streamResponseChunks)yield this.invoke(r,n);else{let o=_oe._convertInputToPromptValue(r),[i,a]=this._separateRunnableConfigFromCallOptionsCompat(n),s=await rc.configure(i.callbacks,this.callbacks,i.tags,this.tags,i.metadata,this.metadata,{verbose:this.verbose}),u={options:a,invocation_params:this?.invocationParams(a),batch_size:1},l=await s?.handleLLMStart(this.toJSON(),[o.toString()],i.runId,void 0,u,void 0,void 0,i.runName),c=new Lw({text:""});try{for await(let d of this._streamResponseChunks(o.toString(),a,l?.[0]))c?c=c.concat(d):c=d,typeof d.text=="string"&&(yield d.text)}catch(d){throw await Promise.all((l??[]).map(f=>f?.handleLLMError(d))),d}await Promise.all((l??[]).map(d=>d?.handleLLMEnd({generations:[[c]]})))}}async generatePrompt(r,n,o){let i=r.map(a=>a.toString());return this.generate(i,n,o)}invocationParams(r){return{}}_flattenLLMResult(r){let n=[];for(let o=0;o<r.generations.length;o+=1){let i=r.generations[o];if(o===0)n.push({generations:[i],llmOutput:r.llmOutput});else{let a=r.llmOutput?{...r.llmOutput,tokenUsage:{}}:void 0;n.push({generations:[i],llmOutput:a})}}return n}async _generateUncached(r,n,o,i){let a;if(i!==void 0&&i.length===r.length)a=i;else{let c=await rc.configure(o.callbacks,this.callbacks,o.tags,this.tags,o.metadata,this.metadata,{verbose:this.verbose}),d={options:n,invocation_params:this?.invocationParams(n),batch_size:r.length};a=await c?.handleLLMStart(this.toJSON(),r,o.runId,void 0,d,void 0,void 0,o?.runName)}let s=!!a?.[0].handlers.find(JY),u;if(s&&r.length===1&&this._streamResponseChunks!==_oe.prototype._streamResponseChunks)try{let c=await this._streamResponseChunks(r[0],n,a?.[0]),d;for await(let f of c)d===void 0?d=f:d=eb(d,f);if(d===void 0)throw new Error("Received empty response from chat model call.");u={generations:[[d]],llmOutput:{}},await a?.[0].handleLLMEnd(u)}catch(c){throw await a?.[0].handleLLMError(c),c}else{try{u=await this._generate(r,n,a?.[0])}catch(d){throw await Promise.all((a??[]).map(f=>f?.handleLLMError(d))),d}let c=this._flattenLLMResult(u);await Promise.all((a??[]).map((d,f)=>d?.handleLLMEnd(c[f])))}let l=a?.map(c=>c.runId)||void 0;return Object.defineProperty(u,KA,{value:l?{runIds:l}:void 0,configurable:!0}),u}async _generateCached({prompts:r,cache:n,llmStringKey:o,parsedOptions:i,handledOptions:a,runId:s}){let u=await rc.configure(a.callbacks,this.callbacks,a.tags,this.tags,a.metadata,this.metadata,{verbose:this.verbose}),l={options:i,invocation_params:this?.invocationParams(i),batch_size:r.length},c=await u?.handleLLMStart(this.toJSON(),r,s,void 0,l,void 0,void 0,a?.runName),d=[],p=(await Promise.allSettled(r.map(async(y,g)=>{let b=await n.lookup(y,o);return b==null&&d.push(g),b}))).map((y,g)=>({result:y,runManager:c?.[g]})).filter(({result:y})=>y.status==="fulfilled"&&y.value!=null||y.status==="rejected"),m=[];await Promise.all(p.map(async({result:y,runManager:g},b)=>{if(y.status==="fulfilled"){let _=y.value;return m[b]=_.map(w=>(w.generationInfo={...w.generationInfo,tokenUsage:{}},w)),_.length&&await g?.handleLLMNewToken(_[0].text),g?.handleLLMEnd({generations:[_]},void 0,void 0,void 0,{cached:!0})}else return await g?.handleLLMError(y.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(y.reason)}));let h={generations:m,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(h,KA,{value:c?{runIds:c?.map(y=>y.runId)}:void 0,configurable:!0}),h}async generate(r,n,o){if(!Array.isArray(r))throw new Error("Argument 'prompts' is expected to be a string[]");let i;Array.isArray(n)?i={stop:n}:i=n;let[a,s]=this._separateRunnableConfigFromCallOptionsCompat(i);if(a.callbacks=a.callbacks??o,!this.cache)return this._generateUncached(r,s,a);let{cache:u}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:c,missingPromptIndices:d,startedRunManagers:f}=await this._generateCached({prompts:r,cache:u,llmStringKey:l,parsedOptions:s,handledOptions:a,runId:a.runId}),p={};if(d.length>0){let m=await this._generateUncached(d.map(h=>r[h]),s,a,f!==void 0?d.map(h=>f?.[h]):void 0);await Promise.all(m.generations.map(async(h,y)=>{let g=d[y];return c[g]=h,u.update(r[g],l,h)})),p=m.llmOutput??{}}return{generations:c,llmOutput:p}}_identifyingParams(){return{}}_modelType(){return"base_llm"}},JCe=class extends mQe{async _generate(t,e,r){return{generations:await Promise.all(t.map((o,i)=>this._call(o,{...e,promptIndex:i},r).then(a=>[{text:a}])))}}}});var Aur=v(()=>{hoe();voe()});var Vro,PS,S2=v(()=>{Bo();GB();Vro={};Rt(Vro,{Embeddings:()=>PS});PS=class{constructor(t){x(this,"caller");this.caller=new Fw(t??{})}}});var Hro,MS,zF=v(()=>{Bo();Hro={};Rt(Hro,{chunkArray:()=>MS});MS=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[])});var hQe,Nur=v(()=>{hoe();S2();zF();hQe=class extends PS{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=NK(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=MS(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 Jro,jur,Dur=v(()=>{Bo();Jro={};Rt(Jro,{BaseDocumentCompressor:()=>jur});jur=class{static isBaseDocumentCompressor(t){return t?.compressDocuments!==void 0}}});var $ur=v(()=>{hoe();Dur()});var gQe=v(()=>{Rur();Aur();Nur();$ur()});function y1(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(y1):typeof e[r]=="object"&&e[r]!==null&&(e[r]=y1(e[r])));return e}return t}function woe(t){let e=y1(Ya(t)?Ni(t):t),{$schema:r,...n}=e;return n}function Lur(t){let e=y1(t),{$schema:r,...n}=e;return n}var WCe=v(()=>{Wv();nb()});function Fur(t,e=0){return(vg[t[e+0]]+vg[t[e+1]]+vg[t[e+2]]+vg[t[e+3]]+"-"+vg[t[e+4]]+vg[t[e+5]]+"-"+vg[t[e+6]]+vg[t[e+7]]+"-"+vg[t[e+8]]+vg[t[e+9]]+"-"+vg[t[e+10]]+vg[t[e+11]]+vg[t[e+12]]+vg[t[e+13]]+vg[t[e+14]]+vg[t[e+15]]).toLowerCase()}var vg,kur=v(()=>{vg=[];for(let t=0;t<256;++t)vg.push((t+256).toString(16).slice(1))});function bQe(){if(!yQe){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");yQe=crypto.getRandomValues.bind(crypto)}return yQe(Wro)}var yQe,Wro,qur=v(()=>{Wro=new Uint8Array(16)});var Kro,_Qe,Uur=v(()=>{Kro=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),_Qe={randomUUID:Kro}});function Gro(t,e,r){if(_Qe.randomUUID&&!e&&!t)return _Qe.randomUUID();t=t||{};let n=t.random??t.rng?.()??bQe();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 Fur(n)}var KCe,Bur=v(()=>{Uur();qur();kur();KCe=Gro});var zur=v(()=>{Bur()});function Xro(t){let e=t._getType();return nd.isInstance(t)?t.role:e==="tool"?e:t.name??e}function Zro(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 Yro(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 Qro(t,e){return e.map(r=>Pl(r)?r.tool_calls??[]:[]).flat().find(r=>r.id===t.tool_call_id)?.name}function eno(t){return{providerName:"Google Gemini",fromStandardTextBlock(r){return{text:r.text}},fromStandardImageBlock(r){if(!t)throw new Error("This model does not support images");if(r.source_type==="url"){let n=zg({dataUrl:r.url});return n?{inlineData:{mimeType:n.mime_type,data:n.data}}:{fileData:{mimeType:r.mime_type??"",fileUri:r.url}}}if(r.source_type==="base64")return{inlineData:{mimeType:r.mime_type??"",data:r.data}};throw new Error(`Unsupported source type: ${r.source_type}`)},fromStandardAudioBlock(r){if(!t)throw new Error("This model does not support audio");if(r.source_type==="url"){let n=zg({dataUrl:r.url});return n?{inlineData:{mimeType:n.mime_type,data:n.data}}:{fileData:{mimeType:r.mime_type??"",fileUri:r.url}}}if(r.source_type==="base64")return{inlineData:{mimeType:r.mime_type??"",data:r.data}};throw new Error(`Unsupported source type: ${r.source_type}`)},fromStandardFileBlock(r){if(!t)throw new Error("This model does not support files");if(r.source_type==="text")return{text:r.text};if(r.source_type==="url"){let n=zg({dataUrl:r.url});return n?{inlineData:{mimeType:n.mime_type,data:n.data}}:{fileData:{mimeType:r.mime_type??"",fileUri:r.url}}}if(r.source_type==="base64")return{inlineData:{mimeType:r.mime_type??"",data:r.data}};throw new Error(`Unsupported source type: ${r.source_type}`)}}}function Vur(t,e){if(Ym(t))return Zx(t,eno(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 Yro(t);if(t.type==="tool_use")return{functionCall:{name:t.name,args:t.input}};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 tno(t,e,r){if(FY(t)){let i=t.name??Qro(t,r);if(i===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 a=Array.isArray(t.content)?t.content.map(s=>Vur(s,e)).filter(s=>s!==void 0):t.content;return t.status==="error"?[{functionResponse:{name:i,response:{error:{details:a}}}}]:[{functionResponse:{name:i,response:{result:a}}}]}let n=[],o=[];return typeof t.content=="string"&&t.content&&o.push({text:t.content}),Array.isArray(t.content)&&o.push(...t.content.map(i=>Vur(i,e)).filter(i=>i!==void 0)),Pl(t)&&t.tool_calls?.length&&(n=t.tool_calls.map(i=>({functionCall:{name:i.name,args:i.args}}))),[...o,...n]}function vQe(t,e,r=!1){return t.reduce((n,o,i)=>{if(!Gh(o))throw new Error("Unsupported message input");let a=Xro(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=Zro(a),u=n.content[n.content.length];if(!n.mergeWithPreviousContent&&u&&u.role===s)throw new Error("Google Generative AI requires alternate messages between authors");let l=tno(o,e,t.slice(0,i));if(n.mergeWithPreviousContent){let f=n.content[n.content.length-1];if(!f)throw new Error("There was a problem parsing your system message. Please try a prompt without one.");return f.parts.push(...l),{mergeWithPreviousContent:!1,content:n.content}}let c=s;(c==="function"||c==="system"&&!r)&&(c="user");let d={role:c,parts:l};return{mergeWithPreviousContent:a==="system"&&!r,content:[...n.content,d]}},{content:[],mergeWithPreviousContent:!1}).content}function Hur(t,e){if(!t.candidates||t.candidates.length===0||!t.candidates[0])return{generations:[],llmOutput:{filters:t.promptFeedback}};let r=t.functionCalls(),[n]=t.candidates,{content:o,...i}=n,a;Array.isArray(o?.parts)&&o.parts.length===1&&o.parts[0].text?a=o.parts[0].text:Array.isArray(o?.parts)&&o.parts.length>0?a=o.parts.map(l=>"text"in l?{type:"text",text:l.text}:"inlineData"in l?{type:"inlineData",inlineData:l.inlineData}:"functionCall"in l?{type:"functionCall",functionCall:l.functionCall}:"functionResponse"in l?{type:"functionResponse",functionResponse:l.functionResponse}:"fileData"in l?{type:"fileData",fileData:l.fileData}:"executableCode"in l?{type:"executableCode",executableCode:l.executableCode}:"codeExecutionResult"in l?{type:"codeExecutionResult",codeExecutionResult:l.codeExecutionResult}:l):a=[];let s="";return typeof a=="string"?s=a:Array.isArray(a)&&a.length>0&&(s=a.find(c=>"text"in c)?.text??s),{generations:[{text:s,message:new eo({content:a??"",tool_calls:r?.map(l=>({...l,type:"tool_call",id:"id"in l&&typeof l.id=="string"?l.id:KCe()})),additional_kwargs:{...i},usage_metadata:e?.usageMetadata}),generationInfo:i}],llmOutput:{tokenUsage:{promptTokens:e?.usageMetadata?.input_tokens,completionTokens:e?.usageMetadata?.output_tokens,totalTokens:e?.usageMetadata?.total_tokens}}}}function Jur(t,e){if(!t.candidates||t.candidates.length===0)return null;let r=t.functionCalls(),[n]=t.candidates,{content:o,...i}=n,a;Array.isArray(o?.parts)&&o.parts.every(l=>"text"in l)?a=o.parts.map(l=>l.text).join(""):Array.isArray(o?.parts)?a=o.parts.map(l=>"text"in l?{type:"text",text:l.text}:"inlineData"in l?{type:"inlineData",inlineData:l.inlineData}:"functionCall"in l?{type:"functionCall",functionCall:l.functionCall}:"functionResponse"in l?{type:"functionResponse",functionResponse:l.functionResponse}:"fileData"in l?{type:"fileData",fileData:l.fileData}:"executableCode"in l?{type:"executableCode",executableCode:l.executableCode}:"codeExecutionResult"in l?{type:"codeExecutionResult",codeExecutionResult:l.codeExecutionResult}:l):a=[];let s="";a&&typeof a=="string"?s=a:Array.isArray(a)&&(s=a.find(c=>"text"in c)?.text??"");let u=[];return r&&u.push(...r.map(l=>({...l,args:JSON.stringify(l.args),index:e.index,type:"tool_call_chunk",id:"id"in l&&typeof l.id=="string"?l.id:KCe()}))),new yi({text:s,message:new Ir({content:a||"",name:o?o.role:void 0,tool_call_chunks:u,additional_kwargs:{},response_metadata:{model_provider:"google-genai"},usage_metadata:e.usageMetadata}),generationInfo:i})}function Wur(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(bg(e)){let r=woe(e.schema);return r.type==="object"&&"properties"in r&&Object.keys(r.properties).length===0?{name:e.name,description:e.description}:{name:e.name,description:e.description,parameters:r}}return Hv(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:Lur(e.function.parameters)}:e})}]}var wQe=v(()=>{WCe();Qa();id();g1();Jv();zur()});var SQe,Kur=v(()=>{Wv();fO();SQe=class extends Sz{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 Y$(this.zodSchema,e);if(r.success)return r.data;throw new th(`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(i=>{let{message:a}=i;return!("tool_calls"in a)||!Array.isArray(a.tool_calls)?[]:a.tool_calls});if(r[0]===void 0)throw new Error("No parseable tool calls provided to GoogleGenerativeAIToolsOutputParser.");let[n]=r;return await this._validateResult(n.args)}}});function ano(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${ino}/${ono}`),e.join(" ")}async function sno(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",ano(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 QI(`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 QI(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new QI(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function uno(t,e,r,n,o,i){let a=new CQe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},fno(i)),{method:"POST",headers:await sno(a),body:o})}}async function Ooe(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await uno(t,e,r,n,o,i);return lno(s,u,a)}async function lno(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){cno(o,t)}return n.ok||await dno(n,t),n}function cno(t,e){let r=t;throw r.name==="AbortError"?(r=new ZCe(`Request aborted when fetching ${e.toString()}: ${t.message}`),r.stack=t.stack):t instanceof XCe||t instanceof QI||(r=new gh(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function dno(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 XCe(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function fno(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 OQe(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.`),GCe(t.candidates[0]))throw new VF(`${HF(t)}`,t);return pno(t)}else if(t.promptFeedback)throw new VF(`Text not available. ${HF(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.`),GCe(t.candidates[0]))throw new VF(`${HF(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),ilr(t)[0]}else if(t.promptFeedback)throw new VF(`Function call not available. ${HF(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.`),GCe(t.candidates[0]))throw new VF(`${HF(t)}`,t);return ilr(t)}else if(t.promptFeedback)throw new VF(`Function call not available. ${HF(t)}`,t)},t}function pno(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 ilr(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 GCe(t){return!!t.finishReason&&mno.includes(t.finishReason)}function HF(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];GCe(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function Coe(t){return this instanceof Coe?(this.v=t,this):new Coe(t)}function hno(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 Coe?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 gno(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=_no(e),[n,o]=r.tee();return{stream:bno(n),response:yno(o)}}async function yno(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return OQe(vno(e));e.push(o)}}function bno(t){return hno(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield Coe(r.read());if(o)break;yield yield Coe(OQe(n))}})}function _no(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 gh("Failed to parse stream"));return}n.close();return}o+=a;let u=o.match(alr),l;for(;u;){try{l=JSON.parse(u[1])}catch{n.error(new gh(`Error parsing JSON response: "${u[1]}"`));return}n.enqueue(l),o=o.substring(u[0].length),u=o.match(alr)}return i()}).catch(a=>{let s=a;throw s.stack=a.stack,s.name==="AbortError"?s=new ZCe("Request aborted when reading from the stream"):s=new gh("Error reading from the stream"),s})}}})}function vno(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 dlr(t,e,r,n){let o=await Ooe(e,x2.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return gno(o)}async function flr(t,e,r,n){let i=await(await Ooe(e,x2.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:OQe(i)}}function plr(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 xoe(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 wno(e)}function wno(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 gh("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 gh("No content is provided for sending chat message.");return n?e:r}function Sno(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 QI("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=xoe(t);n.contents=[i]}return{generateContentRequest:n}}function slr(t){let e;return t.contents?e=t:e={contents:[xoe(t)]},t.systemInstruction&&(e.systemInstruction=plr(t.systemInstruction)),e}function Cno(t){return typeof t=="string"||Array.isArray(t)?{content:xoe(t)}:t}function Ono(t){let e=!1;for(let r of t){let{role:n,parts:o}=r;if(!e&&n!=="user")throw new gh(`First content should be with role 'user', got ${n}`);if(!Yur.includes(n))throw new gh(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(Yur)}`);if(!Array.isArray(o))throw new gh("Content should have 'parts' property with an array of Parts");if(o.length===0)throw new gh("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 ulr)u in s&&(i[u]+=1);let a=xno[n];for(let s of ulr)if(!a.includes(s)&&i[s]>0)throw new gh(`Content with role '${n}' can't contain '${s}' part`);e=!0}}function llr(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 Tno(t,e,r,n){return(await Ooe(e,x2.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function Eno(t,e,r,n){return(await Ooe(e,x2.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function Pno(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await Ooe(e,x2.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var Gur,Xur,Zur,Yur,Qur,elr,tlr,rlr,Soe,nlr,C2,olr,gh,VF,XCe,QI,ZCe,rno,nno,ono,ino,x2,CQe,mno,alr,ulr,xno,clr,xQe,YCe,O2,QCe=v(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(Gur||(Gur={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(Xur||(Xur={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(Zur||(Zur={}));Yur=["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"})(Qur||(Qur={}));(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"})(elr||(elr={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(tlr||(tlr={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(rlr||(rlr={}));(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"})(Soe||(Soe={}));(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"})(nlr||(nlr={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(C2||(C2={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(olr||(olr={}));gh=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},VF=class extends gh{constructor(e,r){super(e),this.response=r}},XCe=class extends gh{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},QI=class extends gh{},ZCe=class extends gh{};rno="https://generativelanguage.googleapis.com",nno="v1beta",ono="0.24.1",ino="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"})(x2||(x2={}));CQe=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)||nno,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||rno}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};mno=[Soe.RECITATION,Soe.SAFETY,Soe.LANGUAGE];alr=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;ulr=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],xno={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};clr="SILENT_ERROR",xQe=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&&(Ono(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=xoe(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(()=>flr(this._apiKey,this.model,c,d)).then(p=>{var m;if(llr(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=HF(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=xoe(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=dlr(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(clr)}).then(p=>p.response).then(p=>{if(llr(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=HF(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==clr&&console.error(p)}),f}};YCe=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=plr(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=slr(e),i=Object.assign(Object.assign({},this._requestOptions),r);return flr(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=slr(e),i=Object.assign(Object.assign({},this._requestOptions),r);return dlr(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 xQe(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=Sno(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 Tno(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=Cno(e),o=Object.assign(Object.assign({},this._requestOptions),r);return Eno(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return Pno(this.apiKey,this.model,e,n)}};O2=class{constructor(e){this.apiKey=e}getGenerativeModel(e,r){if(!e.model)throw new gh("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new YCe(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new QI("Cached content must contain a `name` field.");if(!e.model)throw new QI("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 QI(`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 YCe(this.apiKey,i,n)}}});function TQe(t,e){let r=Mno(t),n=Rno(r,e);return{tools:r,toolConfig:n}}function Mno(t){let e=[],r=[];return t.forEach(o=>{if(bg(o)){let[i]=Wur([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if(Hv(o)){let{functionDeclarations:i}=Ino(o);if(i)e.push(...i);else throw new Error("Failed to convert OpenAI structured tool to GenerativeAI tool")}else r.push(o)}),r.find(o=>"functionDeclarations"in o)?r.map(o=>{if(e?.length>0&&"functionDeclarations"in o){let i={functionDeclarations:[...o.functionDeclarations||[],...e]};return e=[],i}return o}):[...r,...e.length>0?[{functionDeclarations:e}]:[]]}function Ino(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:y1(t.function.parameters)}]}}function Rno(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:C2.ANY,auto:C2.AUTO,none:C2.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:C2.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var mlr=v(()=>{WCe();wQe();QCe();g1();Jv()});var EQe,hlr=v(()=>{WCe();wQe();Kur();mlr();QCe();ku();YI();_v();Wv();fO();EQe=class extends md{constructor(e){super(e);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,"client");if(this.model=e.model.replace(/^models\//,""),this.maxOutputTokens=e.maxOutputTokens??this.maxOutputTokens,this.maxOutputTokens&&this.maxOutputTokens<0)throw new Error("`maxOutputTokens` must be a positive integer");if(this.temperature=e.temperature??this.temperature,this.temperature&&(this.temperature<0||this.temperature>2))throw new Error("`temperature` must be in the range of [0.0,2.0]");if(this.topP=e.topP??this.topP,this.topP&&this.topP<0)throw new Error("`topP` must be a positive integer");if(this.topP&&this.topP>1)throw new Error("`topP` must be below 1.");if(this.topK=e.topK??this.topK,this.topK&&this.topK<0)throw new Error("`topK` must be a positive integer");if(this.stopSequences=e.stopSequences??this.stopSequences,this.apiKey=e.apiKey??vn("GOOGLE_API_KEY"),!this.apiKey)throw new Error("Please set an API key for Google GenerativeAI in the environment variable GOOGLE_API_KEY or in the `apiKey` field of the ChatGoogleGenerativeAI constructor");if(this.safetySettings=e.safetySettings??this.safetySettings,this.safetySettings&&this.safetySettings.length>0&&new Set(this.safetySettings.map(n=>n.category)).size!==this.safetySettings.length)throw new Error("The categories in `safetySettings` array must be unique");this.streaming=e.streaming??this.streaming,this.json=e.json,this.client=new O2(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"}:{}}},{apiVersion:e.apiVersion,baseUrl:e.baseUrl}),this.streamUsage=e.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")}useCachedContent(e,r,n){this.apiKey&&(this.client=new O2(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:TQe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?TQe(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){let o=vQe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[c]=o;this.client.systemInstruction=c,i=o.slice(1)}let a=this.invocationParams(r);if(this.streaming){let c={},d=this._streamResponseChunks(e,r,n),f={};for await(let m of d){let h=m.generationInfo?.completion??0;f[h]===void 0?f[h]=m:f[h]=f[h].concat(m)}return{generations:Object.entries(f).sort(([m],[h])=>parseInt(m,10)-parseInt(h,10)).map(([m,h])=>h),llmOutput:{estimatedTokenUsage:c}}}let s=await this.completionWithRetry({...a,contents:i}),u;if("usageMetadata"in s.response){let c=s.response.usageMetadata;u={input_tokens:c.promptTokenCount??0,output_tokens:c.candidatesTokenCount??0,total_tokens:c.totalTokenCount??0}}let l=Hur(s.response,{usageMetadata:u});return l.generations?.length>0&&await n?.handleLLMNewToken(l.generations[0]?.text??""),l}async*_streamResponseChunks(e,r,n){let o=vQe(e,this._isMultimodalModel,this.useSystemInstruction),i=o;if(o[0].role==="system"){let[m]=o;this.client.systemInstruction=m,i=o.slice(1)}let s={...this.invocationParams(r),contents:i},u=await this.caller.callWithOptions({signal:r?.signal},async()=>{let{stream:m}=await this.client.generateContentStream(s);return m}),l,c=0,d=0,f=0,p=0;for await(let m of u){if("usageMetadata"in m&&m.usageMetadata!==void 0&&this.streamUsage!==!1&&r.streamUsage!==!1){l={input_tokens:m.usageMetadata.promptTokenCount??0,output_tokens:m.usageMetadata.candidatesTokenCount??0,total_tokens:m.usageMetadata.totalTokenCount??0};let y=m.usageMetadata.promptTokenCount??0;l.input_tokens=Math.max(0,y-c),c=y;let g=m.usageMetadata.candidatesTokenCount??0;l.output_tokens=Math.max(0,g-d),d=g;let b=m.usageMetadata.totalTokenCount??0;l.total_tokens=Math.max(0,b-f),f=b}let h=Jur(m,{usageMetadata:l,index:p});p+=1,h&&(yield h,await n?.handleLLMNewToken(h.text??""))}}async completionWithRetry(e,r){return this.caller.callWithOptions({signal:r?.signal},async()=>{try{return await this.client.generateContent(e)}catch(n){throw n.message?.includes("400 Bad Request")&&(n.status=400),n}})}withStructuredOutput(e,r){let n=e,o=r?.name,i=r?.method,a=r?.includeRaw;if(i==="jsonMode")throw new Error('ChatGoogleGenerativeAI only supports "jsonSchema" or "functionCalling" as a method.');let s,u;if(i==="functionCalling"){let f=o??"extract",p;if(Ya(n)){let m=woe(n);p=[{functionDeclarations:[{name:f,description:m.description??"A function available to call.",parameters:m}]}],u=new SQe({returnSingle:!0,keyName:f,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(m=n,m.parameters=y1(n.parameters),f=n.name):m={name:f,description:n.description??"",parameters:y1(n)},p=[{functionDeclarations:[m]}],u=new SQe({returnSingle:!0,keyName:f})}s=this.bindTools(p).withConfig({allowedFunctionNames:[f]})}else{let f=woe(n);s=this.withConfig({responseSchema:f}),u=new vv}if(!a)return s.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let l=Eu.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Eu.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Rl.from([{raw:s},d]).withConfig({runName:"StructuredOutputRunnable"})}}});var PQe,glr=v(()=>{QCe();ku();S2();zF();PQe=class extends PS{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??vn("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 O2(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=MS(e,this.maxBatchSize),n=r.map(a=>({requests:a.map(s=>this._convertToContent(s))}));return(await Promise.allSettled(n.map(a=>this.client.batchEmbedContents(a)))).flatMap((a,s)=>a.status==="fulfilled"?a.value.embeddings.map(u=>u.values||[]):Array(r[s].length).fill([]))}embedQuery(e){return this.caller.call(this._embedQueryContent.bind(this),e)}embedDocuments(e){return this.caller.call(this._embedDocumentsContent.bind(this),e)}}});var MQe=v(()=>{hlr();glr()});function ylr(t,e=0){return(wg[t[e+0]]+wg[t[e+1]]+wg[t[e+2]]+wg[t[e+3]]+"-"+wg[t[e+4]]+wg[t[e+5]]+"-"+wg[t[e+6]]+wg[t[e+7]]+"-"+wg[t[e+8]]+wg[t[e+9]]+"-"+wg[t[e+10]]+wg[t[e+11]]+wg[t[e+12]]+wg[t[e+13]]+wg[t[e+14]]+wg[t[e+15]]).toLowerCase()}var wg,exe,blr=v(()=>{wg=[];for(exe=0;exe<256;++exe)wg.push((exe+256).toString(16).slice(1))});function IQe(){if(!txe&&(txe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!txe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return txe(Ano)}var txe,Ano,_lr=v(()=>{Ano=new Uint8Array(16)});var Nno,RQe,vlr=v(()=>{Nno=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),RQe={randomUUID:Nno}});function jno(t,e,r){if(RQe.randomUUID&&!e&&!t)return RQe.randomUUID();t=t||{};var n=t.random||(t.rng||IQe)();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 ylr(n)}var AQe,wlr=v(()=>{vlr();_lr();blr();AQe=jno});var Slr=v(()=>{wlr()});function xlr(t,e){return new Ir({content:t.thinking??t.content??"",tool_call_chunks:t.tool_calls?.map(r=>({name:r.function.name,args:JSON.stringify(r.function.arguments),type:"tool_call_chunk",index:0,id:AQe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function Clr(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function Dno(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 $no(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:[Clr(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[Clr(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function Lno(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 Fno(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function Olr(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return $no(e);if(e._getType()==="ai")return Dno(e);if(e._getType()==="system")return Lno(e);if(e._getType()==="tool")return Fno(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var Tlr=v(()=>{Qa();Slr()});function kno(t){return t&&DataView.prototype.isPrototypeOf(t)}function DK(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 jQe(t){return typeof t!="string"&&(t=String(t)),t}function DQe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return bb.iterable&&(e[Symbol.iterator]=function(){return e}),e}function Tm(t){this.map={},t instanceof Tm?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 NQe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function Ilr(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function qno(t){var e=new FileReader,r=Ilr(e);return e.readAsArrayBuffer(t),r}function Uno(t){var e=new FileReader,r=Ilr(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function Bno(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 Plr(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function Rlr(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:bb.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:bb.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:bb.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():bb.arrayBuffer&&bb.blob&&kno(t)?(this._bodyArrayBuffer=Plr(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):bb.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||Mlr(t))?this._bodyArrayBuffer=Plr(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):bb.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},bb.blob&&(this.blob=function(){var t=NQe(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=NQe(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(bb.blob)return this.blob().then(qno);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=NQe(this);if(t)return t;if(this._bodyBlob)return Uno(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Bno(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},bb.formData&&(this.formData=function(){return this.text().then(Hno)}),this.json=function(){return this.text().then(JSON.parse)},this}function Vno(t){var e=t.toUpperCase();return zno.indexOf(e)>-1?e:t}function E2(t,e){if(!(this instanceof E2))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 E2){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new Tm(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 Tm(e.headers)),this.method=Vno(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in Sg){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 Hno(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 Jno(t){var e=new Tm,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 eR(t,e){if(!(this instanceof eR))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 Tm(e.headers),this.url=e.url||"",this._initBody(t)}function Alr(t,e){return new Promise(function(r,n){var o=new E2(t,e);if(o.signal&&o.signal.aborted)return n(new T2("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:Jno(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 eR(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 T2("Aborted","AbortError"))},0)};function s(l){try{return l===""&&Sg.location.href?Sg.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&&(bb.blob?i.responseType="blob":bb.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof Tm||Sg.Headers&&e.headers instanceof Sg.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(DK(l)),i.setRequestHeader(l,jQe(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 Sg,bb,Elr,Mlr,zno,Wno,T2,Nlr=v(()=>{Sg=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},bb={searchParams:"URLSearchParams"in Sg,iterable:"Symbol"in Sg&&"iterator"in Symbol,blob:"FileReader"in Sg&&"Blob"in Sg&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in Sg,arrayBuffer:"ArrayBuffer"in Sg};bb.arrayBuffer&&(Elr=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Mlr=ArrayBuffer.isView||function(t){return t&&Elr.indexOf(Object.prototype.toString.call(t))>-1});Tm.prototype.append=function(t,e){t=DK(t),e=jQe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};Tm.prototype.delete=function(t){delete this.map[DK(t)]};Tm.prototype.get=function(t){return t=DK(t),this.has(t)?this.map[t]:null};Tm.prototype.has=function(t){return this.map.hasOwnProperty(DK(t))};Tm.prototype.set=function(t,e){this.map[DK(t)]=jQe(e)};Tm.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};Tm.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),DQe(t)};Tm.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),DQe(t)};Tm.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),DQe(t)};bb.iterable&&(Tm.prototype[Symbol.iterator]=Tm.prototype.entries);zno=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];E2.prototype.clone=function(){return new E2(this,{body:this._bodyInit})};Rlr.call(E2.prototype);Rlr.call(eR.prototype);eR.prototype.clone=function(){return new eR(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Tm(this.headers),url:this.url})};eR.error=function(){var t=new eR(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};Wno=[301,302,303,307,308];eR.redirect=function(t,e){if(Wno.indexOf(e)===-1)throw new RangeError("Invalid status code");return new eR(null,{status:e,headers:{location:t}})};T2=Sg.DOMException;try{new T2}catch{T2=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},T2.prototype=Object.create(Error.prototype),T2.prototype.constructor=T2}Alr.polyfill=!0;Sg.fetch||(Sg.fetch=Alr,Sg.Headers=Tm,Sg.Request=E2,Sg.Response=eR)});function Zno(){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 Yno(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 Dlr,$lr,Kno,Gno,Xno,$Qe,FQe,kQe,qQe,UQe,jlr,$K,Qno,eoo,too,roo,noo,LQe,LK,Jxa,rxe=v(()=>{Nlr();Dlr="11434",$lr=`http://127.0.0.1:${Dlr}`,Kno="0.5.18",Gno=Object.defineProperty,Xno=(t,e,r)=>e in t?Gno(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$Qe=(t,e,r)=>(Xno(t,typeof e!="symbol"?e+"":e,r),r),FQe=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)}},kQe=class{constructor(e,r,n){$Qe(this,"abortController"),$Qe(this,"itr"),$Qe(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.")}},qQe=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 FQe(e,t.status)};UQe=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${Kno} (${Zno()})`};r.headers=Yno(r.headers);let o=Object.fromEntries(Object.entries(r.headers).filter(([i])=>!Object.keys(n).some(a=>a.toLowerCase()===i.toLowerCase())));return r.headers={...n,...o},t(e,r)},jlr=async(t,e,r)=>{let n=await UQe(t,e,{headers:r?.headers});return await qQe(n),n},$K=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await UQe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await qQe(a),a},Qno=async(t,e,r,n)=>{let o=await UQe(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await qQe(o),o},eoo=async function*(t){let e=new TextDecoder("utf-8"),r="",n=t.getReader();for(;;){let{done:o,value:i}=await n.read();if(o)break;r+=e.decode(i);let a=r.split(`
|
||
`);r=a.pop()??"";for(let s of a)try{yield JSON.parse(s)}catch{console.warn("invalid json: ",s)}}for(let o of r.split(`
|
||
`).filter(i=>i!==""))try{yield JSON.parse(o)}catch{console.warn("invalid json: ",o)}},too=t=>{if(!t)return $lr;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=Dlr);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},roo=Object.defineProperty,noo=(t,e,r)=>e in t?roo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,LQe=(t,e,r)=>(noo(t,typeof e!="symbol"?e+"":e,r),r),LK=class{constructor(e){LQe(this,"config"),LQe(this,"fetch"),LQe(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=too(e?.host??$lr)),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 $K(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=eoo(a.body),u=new kQe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await $K(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 Qno(this.fetch,`${this.config.host}/api/delete`,{name:e.model},{headers:this.config.headers}),{status:"success"}}async copy(e){return await $K(this.fetch,`${this.config.host}/api/copy`,{...e},{headers:this.config.headers}),{status:"success"}}async list(){return await(await jlr(this.fetch,`${this.config.host}/api/tags`,{headers:this.config.headers})).json()}async show(e){return await(await $K(this.fetch,`${this.config.host}/api/show`,{...e},{headers:this.config.headers})).json()}async embed(e){return await(await $K(this.fetch,`${this.config.host}/api/embed`,{...e},{headers:this.config.headers})).json()}async embeddings(e){return await(await $K(this.fetch,`${this.config.host}/api/embeddings`,{...e},{headers:this.config.headers})).json()}async ps(){return await(await jlr(this.fetch,`${this.config.host}/api/ps`,{headers:this.config.headers})).json()}},Jxa=new LK});var BQe,Llr=v(()=>{Tlr();Qa();YI();rxe();id();_v();g1();nO();fO();Wv();nb();BQe=class extends md{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.client=new LK({fetch:e?.fetch,host:e?.baseUrl,headers:e?.headers}),this.baseUrl=e?.baseUrl??this.baseUrl,this.model=e?.model??this.model,this.numa=e?.numa,this.numCtx=e?.numCtx,this.numBatch=e?.numBatch,this.numGpu=e?.numGpu,this.mainGpu=e?.mainGpu,this.lowVram=e?.lowVram,this.f16Kv=e?.f16Kv,this.logitsAll=e?.logitsAll,this.vocabOnly=e?.vocabOnly,this.useMmap=e?.useMmap,this.useMlock=e?.useMlock,this.embeddingOnly=e?.embeddingOnly,this.numThread=e?.numThread,this.numKeep=e?.numKeep,this.seed=e?.seed,this.numPredict=e?.numPredict,this.topK=e?.topK,this.topP=e?.topP,this.tfsZ=e?.tfsZ,this.typicalP=e?.typicalP,this.repeatLastN=e?.repeatLastN,this.temperature=e?.temperature,this.repeatPenalty=e?.repeatPenalty,this.presencePenalty=e?.presencePenalty,this.frequencyPenalty=e?.frequencyPenalty,this.mirostat=e?.mirostat,this.mirostatTau=e?.mirostatTau,this.mirostatEta=e?.mirostatEta,this.penalizeNewline=e?.penalizeNewline,this.streaming=e?.streaming,this.format=e?.format,this.keepAlive=e?.keepAlive,this.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=>h1(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=>h1(r)):void 0}}async checkModelExistsOnMachine(e){let{models:r}=await this.client.list();return!!r.find(n=>n.name===e||n.name===`${e}:latest`)}async _generate(e,r,n){this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o;for await(let a of this._streamResponseChunks(e,r,n))o?o=eb(o,a.message):o=a.message;let i=new eo({id:o?.id,content:o?.content??"",tool_calls:o?.tool_calls,response_metadata:o?.response_metadata,usage_metadata:o?.usage_metadata});return{generations:[{text:typeof i.content=="string"?i.content:"",message:i}]}}async*_streamResponseChunks(e,r,n){this.checkOrPullModel&&(await this.checkModelExistsOnMachine(this.model)||await this.pull(this.model,{logProgress:!0}));let o=this.invocationParams(r),i=Olr(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){r.signal?.aborted&&this.client.abort();let{message:c,...d}=l;a.input_tokens+=d.prompt_eval_count??0,a.output_tokens+=d.eval_count??0,a.total_tokens=a.input_tokens+a.output_tokens,u=d;let f=this.think?c.thinking??c.content??"":c.content??"";yield new yi({text:f,message:xlr(c)}),await n?.handleLLMNewToken(f)}yield new yi({text:"",message:new Ir({content:"",response_metadata:u,usage_metadata:a})})}withStructuredOutput(e,r){if(r?.method===void 0||r?.method==="jsonSchema"){let n=Ya(e),o=n?Ni(e):e,i=this.bindTools([{type:"function",function:{name:"extract",description:o.description,parameters:o}}]).withConfig({format:"json",ls_structured_output_format:{kwargs:{method:"jsonSchema"},schema:Ni(e)}}),a=n?Jw.fromZodSchema(e):new vv;if(!r?.includeRaw)return i.pipe(a);let s=Eu.assign({parsed:(c,d)=>a.invoke(c.raw,d)}),u=Eu.assign({parsed:()=>null}),l=s.withFallbacks({fallbacks:[u]});return Rl.from([{raw:i},l])}else return super.withStructuredOutput(e,r)}}});var zQe,Flr=v(()=>{rxe();S2();zQe=class extends PS{constructor(e){super({maxConcurrency:1,...e});x(this,"model","mxbai-embed-large");x(this,"baseUrl","http://localhost:11434");x(this,"keepAlive");x(this,"requestOptions");x(this,"client");x(this,"truncate",!1);this.client=new LK({fetch:e?.fetch,host:e?.baseUrl,headers:e?.headers?new Headers(e.headers):void 0}),this.baseUrl=e?.baseUrl??this.baseUrl,this.model=e?.model??this.model,this.keepAlive=e?.keepAlive,this.truncate=e?.truncate??this.truncate,this.requestOptions=e?.requestOptions?this._convertOptions(e?.requestOptions):void 0}_convertOptions(e){let r={},n={embeddingOnly:"embedding_only",frequencyPenalty:"frequency_penalty",keepAlive:"keep_alive",logitsAll:"logits_all",lowVram:"low_vram",mainGpu:"main_gpu",mirostat:"mirostat",mirostatEta:"mirostat_eta",mirostatTau:"mirostat_tau",numBatch:"num_batch",numCtx:"num_ctx",numGpu:"num_gpu",numKeep:"num_keep",numPredict:"num_predict",numThread:"num_thread",penalizeNewline:"penalize_newline",presencePenalty:"presence_penalty",repeatLastN:"repeat_last_n",repeatPenalty:"repeat_penalty",temperature:"temperature",stop:"stop",tfsZ:"tfs_z",topK:"top_k",topP:"top_p",typicalP:"typical_p",useMlock:"use_mlock",useMmap:"use_mmap",vocabOnly:"vocab_only",f16Kv:"f16_kv",numa:"numa",seed:"seed"};for(let[o,i]of Object.entries(e)){let a=n[o];a?r[a]=i:r[o]=i}return r}async embedDocuments(e){return this.embeddingWithRetry(e)}async embedQuery(e){return(await this.embeddingWithRetry([e]))[0]}async embeddingWithRetry(e){return(await this.caller.call(()=>this.client.embed({model:this.model,input:e,keep_alive:this.keepAlive,options:this.requestOptions,truncate:this.truncate}))).embeddings}}});var klr=v(()=>{rxe();id();voe()});var VQe=v(()=>{Llr();Flr();klr()});function Toe(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 qlr=v(()=>{});function Hr(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 xe(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 IS=v(()=>{});var HQe,JQe=v(()=>{HQe=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return HQe=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 Eoe(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var Poe,nxe=v(()=>{Poe=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 Vt,Em,Ic,JF,tR,FK,kK,qK,UK,BK,zK,VK,HK,JK,WK,rR,nR=v(()=>{nxe();Vt=class extends Error{},Em=class t extends Vt{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 JF({message:n,cause:Poe(r)});let i=r?.error;return e===400?new FK(e,i,n,o):e===401?new kK(e,i,n,o):e===403?new qK(e,i,n,o):e===404?new UK(e,i,n,o):e===409?new BK(e,i,n,o):e===422?new zK(e,i,n,o):e===429?new VK(e,i,n,o):e>=500?new HK(e,i,n,o):new t(e,i,n,o)}},Ic=class extends Em{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},JF=class extends Em{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},tR=class extends JF{constructor({message:e}={}){super({message:e??"Request timed out."})}},FK=class extends Em{},kK=class extends Em{},qK=class extends Em{},UK=class extends Em{},BK=class extends Em{},zK=class extends Em{},VK=class extends Em{},HK=class extends Em{},JK=class extends Vt{constructor(){super("Could not parse response content as the length limit was reached")}},WK=class extends Vt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},rR=class extends Error{constructor(e){super(e)}}});function KQe(t){return typeof t!="object"?{}:t??{}}function Blr(t){if(!t)return!0;for(let e in t)return!1;return!0}function zlr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function KK(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var ioo,Ulr,Sy,WQe,Vlr,Hlr,b1=v(()=>{nR();ioo=/^[a-z][a-z0-9+.-]*:/i,Ulr=t=>ioo.test(t),Sy=t=>(Sy=Array.isArray,Sy(t)),WQe=Sy;Vlr=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Vt(`${t} must be an integer`);if(e<0)throw new Vt(`${t} must be a positive integer`);return e},Hlr=t=>{try{return JSON.parse(t)}catch{return}}});var oR,GK=v(()=>{oR=t=>new Promise(e=>setTimeout(e,t))});var WF,GQe=v(()=>{WF="6.16.0"});function aoo(){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 uoo(){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 Glr,soo,Jlr,Wlr,Klr,Xlr,XQe=v(()=>{GQe();Glr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";soo=()=>{let t=aoo();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":WF,"X-Stainless-OS":Wlr(Deno.build.os),"X-Stainless-Arch":Jlr(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":WF,"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":WF,"X-Stainless-OS":Wlr(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Jlr(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=uoo();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":WF,"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":WF,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};Jlr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Wlr=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"),Xlr=()=>Klr??(Klr=soo())});function Zlr(){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 ZQe(...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 oxe(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return ZQe({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function YQe(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 Ylr(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 Moe=v(()=>{});var Qlr,ecr=v(()=>{Qlr=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});var ixe,QQe,axe,eet,sxe=v(()=>{ixe="RFC3986",QQe=t=>String(t),axe={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:QQe},eet="RFC1738"});function rcr(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function ret(t,e){if(Sy(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var uxe,iR,tet,tcr,ncr=v(()=>{sxe();b1();uxe=(t,e)=>(uxe=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),uxe(t,e)),iR=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),tet=1024,tcr=(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+=tet){let u=i.length>=tet?i.slice(s,s+tet):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===eet&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=iR[d];continue}if(d<2048){l[l.length]=iR[192|d>>6]+iR[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=iR[224|d>>12]+iR[128|d>>6&63]+iR[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=iR[240|d>>18]+iR[128|d>>12&63]+iR[128|d>>6&63]+iR[128|d&63]}a+=l.join("")}return a}});function doo(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function scr(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,y,g){let b=t,_=g,w=0,O=!1;for(;(_=_.get(net))!==void 0&&!O;){let j=_.get(t);if(w+=1,typeof j<"u"){if(j===w)throw new RangeError("Cyclic object value");O=!0}typeof _.get(net)>"u"&&(w=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&Sy(b)&&(b=ret(b,function(j){return j instanceof Date?f?.(j):j})),b===null){if(i)return u&&!h?u(e,Pm.encoder,y,"key",p):e;b=""}if(doo(b)||rcr(b)){if(u){let j=h?e:u(e,Pm.encoder,y,"key",p);return[m?.(j)+"="+m?.(u(b,Pm.encoder,y,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let T=[];if(typeof b>"u")return T;let P;if(r==="comma"&&Sy(b))h&&u&&(b=ret(b,u)),P=[{value:b.length>0?b.join(",")||null:void 0}];else if(Sy(l))P=l;else{let j=Object.keys(b);P=c?j.sort(c):j}let M=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&Sy(b)&&b.length===1?M+"[]":M;if(o&&Sy(b)&&b.length===0)return I+"[]";for(let j=0;j<P.length;++j){let A=P[j],k=typeof A=="object"&&typeof A.value<"u"?A.value:b[A];if(a&&k===null)continue;let V=d&&s?A.replace(/\./g,"%2E"):A,q=Sy(b)?typeof r=="function"?r(I,V):I:I+(d?"."+V:"["+V+"]");g.set(t,w);let J=new WeakMap;J.set(net,g),acr(T,scr(k,q,r,n,o,i,a,s,r==="comma"&&h&&Sy(b)?null:u,l,c,d,f,p,m,h,y,J))}return T}function foo(t=Pm){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||Pm.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=ixe;if(typeof t.format<"u"){if(!uxe(axe,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=axe[r],o=Pm.filter;(typeof t.filter=="function"||Sy(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in icr?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=Pm.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:Pm.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Pm.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Pm.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Pm.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Pm.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Pm.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Pm.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Pm.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Pm.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Pm.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Pm.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Pm.strictNullHandling}}function oet(t,e={}){let r=t,n=foo(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Sy(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=icr[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||acr(a,scr(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 icr,acr,ocr,Pm,net,ucr=v(()=>{ncr();sxe();b1();icr={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},acr=function(t,e){Array.prototype.push.apply(t,Sy(e)?e:[e])},Pm={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:tcr,encodeValuesOnly:!1,format:ixe,formatter:QQe,indices:!1,serializeDate(t){return(ocr??(ocr=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};net={}});var lcr=v(()=>{sxe();ucr()});function fcr(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 XK(t){let e;return(ccr??(e=new globalThis.TextEncoder,ccr=e.encode.bind(e)))(t)}function iet(t){let e;return(dcr??(e=new globalThis.TextDecoder,dcr=e.decode.bind(e)))(t)}var ccr,dcr,lxe=v(()=>{});function moo(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 pcr(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 Kv,Gv,P2,mcr=v(()=>{IS();lxe();P2=class{constructor(){Kv.set(this,void 0),Gv.set(this,void 0),Hr(this,Kv,new Uint8Array,"f"),Hr(this,Gv,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?XK(e):e;Hr(this,Kv,fcr([xe(this,Kv,"f"),r]),"f");let n=[],o;for(;(o=moo(xe(this,Kv,"f"),xe(this,Gv,"f")))!=null;){if(o.carriage&&xe(this,Gv,"f")==null){Hr(this,Gv,o.index,"f");continue}if(xe(this,Gv,"f")!=null&&(o.index!==xe(this,Gv,"f")+1||o.carriage)){n.push(iet(xe(this,Kv,"f").subarray(0,xe(this,Gv,"f")-1))),Hr(this,Kv,xe(this,Kv,"f").subarray(xe(this,Gv,"f")),"f"),Hr(this,Gv,null,"f");continue}let i=xe(this,Gv,"f")!==null?o.preceding-1:o.preceding,a=iet(xe(this,Kv,"f").subarray(0,i));n.push(a),Hr(this,Kv,xe(this,Kv,"f").subarray(o.index),"f"),Hr(this,Gv,null,"f")}return n}flush(){return xe(this,Kv,"f").length?this.decode(`
|
||
`):[]}};Kv=new WeakMap,Gv=new WeakMap;P2.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);P2.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function Ioe(){}function cxe(t,e,r){return!e||dxe[t]>dxe[r]?Ioe:e[t].bind(e)}function Kc(t){let e=t.logger,r=t.logLevel??"off";if(!e)return hoo;let n=hcr.get(e);if(n&&n[0]===r)return n[1];let o={error:cxe("error",e,r),warn:cxe("warn",e,r),info:cxe("info",e,r),debug:cxe("debug",e,r)};return hcr.set(e,[r,o]),o}var dxe,aet,hoo,hcr,_1,Roe=v(()=>{b1();dxe={off:0,error:200,warn:300,info:400,debug:500},aet=(t,e,r)=>{if(t){if(zlr(dxe,t))return t;Kc(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(dxe))}`)}};hoo={error:Ioe,warn:Ioe,info:Ioe,debug:Ioe},hcr=new WeakMap;_1=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*goo(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new Vt("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 Vt("Attempted to iterate over a response with no body");let r=new set,n=new P2,o=YQe(t.body);for await(let i of yoo(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*yoo(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"?XK(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=pcr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function boo(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var Aoe,aR,set,uet=v(()=>{IS();nR();Moe();mcr();Moe();nxe();lxe();Roe();nR();aR=class t{constructor(e,r,n){this.iterator=e,Aoe.set(this,void 0),this.controller=r,Hr(this,Aoe,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?Kc(n):console;async function*a(){if(o)throw new Vt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of goo(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 Em(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 Em(void 0,l.error,l.message,void 0);yield{event:u.event,data:l}}}s=!0}catch(u){if(Eoe(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 P2,u=YQe(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 Vt("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(Eoe(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[(Aoe=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,xe(this,Aoe,"f")),new t(()=>o(r),this.controller,xe(this,Aoe,"f"))]}toReadableStream(){let e=this,r;return ZQe({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=XK(JSON.stringify(o)+`
|
||
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};set=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]=boo(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function fxe(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return Kc(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):aR.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 cet(d,r)}return await r.text()})();return Kc(t).debug(`[${n}] response parsed`,_1({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function cet(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 det=v(()=>{uet();Roe()});var Noe,M2,pxe=v(()=>{IS();det();M2=class t extends Promise{constructor(e,r,n=fxe){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,Noe.set(this,void 0),Hr(this,Noe,e,"f")}_thenUnwrap(e){return new t(xe(this,Noe,"f"),this.responsePromise,async(r,n)=>cet(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(xe(this,Noe,"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)}};Noe=new WeakMap});var mxe,joe,Doe,sR,ri,v1,Iu=v(()=>{IS();nR();det();pxe();b1();joe=class{constructor(e,r,n,o){mxe.set(this,void 0),Hr(this,mxe,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 Vt("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await xe(this,mxe,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(mxe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Doe=class extends M2{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await fxe(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},sR=class extends joe{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}},ri=class extends joe{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:{...KQe(this.options.query),after:r}}:null}},v1=class extends joe{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:{...KQe(this.options.query),after:e}}:null}}});function ZK(t,e,r){return met(),new File(t,e??"unknown_file",r)}function $oe(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 voo(t){let e=typeof t=="function"?t:t.fetch,r=gcr.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 gcr.set(e,n),n}var met,hxe,het,Xv,gcr,ycr,bcr,woo,fet,pet,uR=v(()=>{Moe();met=()=>{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`.":""))}};hxe=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",het=async(t,e)=>fet(t.body)?{...t,body:await ycr(t.body,e)}:t,Xv=async(t,e)=>({...t,body:await ycr(t.body,e)}),gcr=new WeakMap;ycr=async(t,e)=>{if(!await voo(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])=>pet(r,n,o))),r},bcr=t=>t instanceof Blob&&"name"in t,woo=t=>typeof t=="object"&&t!==null&&(t instanceof Response||hxe(t)||bcr(t)),fet=t=>{if(woo(t))return!0;if(Array.isArray(t))return t.some(fet);if(t&&typeof t=="object"){for(let e in t)if(fet(t[e]))return!0}return!1},pet=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,ZK([await r.blob()],$oe(r)));else if(hxe(r))t.append(e,ZK([await new Response(oxe(r)).blob()],$oe(r)));else if(bcr(r))t.append(e,r,$oe(r));else if(Array.isArray(r))await Promise.all(r.map(n=>pet(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>pet(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 Loe(t,e,r){if(met(),t=await t,Soo(t))return t instanceof File?t:ZK([await t.arrayBuffer()],t.name);if(Coo(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),ZK(await get(o),e,r)}let n=await get(t);if(e||(e=$oe(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return ZK(n,e,r)}async function get(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(_cr(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(hxe(t))for await(let r of t)e.push(...await get(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${xoo(t)}`)}return e}function xoo(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var _cr,Soo,Coo,vcr=v(()=>{uR();uR();_cr=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",Soo=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&_cr(t),Coo=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var yet=v(()=>{vcr()});var ze,kr=v(()=>{ze=class{constructor(e){this._client=e}}});function Scr(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var wcr,Too,je,ns=v(()=>{nR();wcr=Object.freeze(Object.create(null)),Too=(t=Scr)=>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??wcr)??wcr)?.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 Vt(`Path parameters result in path with invalid segments:
|
||
${i.map(f=>f.error).join(`
|
||
`)}
|
||
${a}
|
||
${d}`)}return a},je=Too(Scr)});var I2,gxe=v(()=>{kr();Iu();ns();I2=class extends ze{list(e,r={},n){return this._client.getAPIList(je`/chat/completions/${e}/messages`,ri,{query:r,...n})}}});var AC=v(()=>{nR()});function Foe(t){return t!==void 0&&"function"in t&&t.function!==void 0}function Ccr(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function koe(t){return t?.$brand==="auto-parseable-response-format"}function R2(t){return t?.$brand==="auto-parseable-tool"}function xcr(t,e){return!e||!bet(e)?{...t,choices:t.choices.map(r=>(Tcr(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:qoe(t,e)}function qoe(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new JK;if(n.finish_reason==="content_filter")throw new WK;return Tcr(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>Ioo(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?Moo(e,n.message.content):null}}});return{...t,choices:r}}function Moo(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 Ioo(t,e){let r=t.tools?.find(n=>Foe(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:R2(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function Ocr(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>Foe(n)&&n.function?.name===e.function.name);return Foe(r)&&(R2(r)||r?.function.strict||!1)}function bet(t){return koe(t.response_format)?!0:t.tools?.some(e=>R2(e)||e.type==="function"&&e.function.strict===!0)??!1}function Tcr(t){for(let e of t||[])if(e.type!=="function")throw new Vt(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function Ecr(t){for(let e of t??[]){if(e.type!=="function")throw new Vt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new Vt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var YK=v(()=>{AC()});var QK,_et,vet=v(()=>{QK=t=>t?.role==="assistant",_et=t=>t?.role==="tool"});var wet,yxe,bxe,Uoe,Boe,_xe,zoe,w1,Voe,vxe,wxe,e8,Pcr,KF,Sxe=v(()=>{IS();AC();KF=class{constructor(){wet.add(this),this.controller=new AbortController,yxe.set(this,void 0),bxe.set(this,()=>{}),Uoe.set(this,()=>{}),Boe.set(this,void 0),_xe.set(this,()=>{}),zoe.set(this,()=>{}),w1.set(this,{}),Voe.set(this,!1),vxe.set(this,!1),wxe.set(this,!1),e8.set(this,!1),Hr(this,yxe,new Promise((e,r)=>{Hr(this,bxe,e,"f"),Hr(this,Uoe,r,"f")}),"f"),Hr(this,Boe,new Promise((e,r)=>{Hr(this,_xe,e,"f"),Hr(this,zoe,r,"f")}),"f"),xe(this,yxe,"f").catch(()=>{}),xe(this,Boe,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},xe(this,wet,"m",Pcr).bind(this))},0)}_connected(){this.ended||(xe(this,bxe,"f").call(this),this._emit("connect"))}get ended(){return xe(this,Voe,"f")}get errored(){return xe(this,vxe,"f")}get aborted(){return xe(this,wxe,"f")}abort(){this.controller.abort()}on(e,r){return(xe(this,w1,"f")[e]||(xe(this,w1,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=xe(this,w1,"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(xe(this,w1,"f")[e]||(xe(this,w1,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{Hr(this,e8,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){Hr(this,e8,!0,"f"),await xe(this,Boe,"f")}_emit(e,...r){if(xe(this,Voe,"f"))return;e==="end"&&(Hr(this,Voe,!0,"f"),xe(this,_xe,"f").call(this));let n=xe(this,w1,"f")[e];if(n&&(xe(this,w1,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!xe(this,e8,"f")&&!n?.length&&Promise.reject(o),xe(this,Uoe,"f").call(this,o),xe(this,zoe,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!xe(this,e8,"f")&&!n?.length&&Promise.reject(o),xe(this,Uoe,"f").call(this,o),xe(this,zoe,"f").call(this,o),this._emit("end")}}_emitFinal(){}};yxe=new WeakMap,bxe=new WeakMap,Uoe=new WeakMap,Boe=new WeakMap,_xe=new WeakMap,zoe=new WeakMap,w1=new WeakMap,Voe=new WeakMap,vxe=new WeakMap,wxe=new WeakMap,e8=new WeakMap,wet=new WeakSet,Pcr=function(e){if(Hr(this,vxe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Ic),e instanceof Ic)return Hr(this,wxe,!0,"f"),this._emit("abort",e);if(e instanceof Vt)return this._emit("error",e);if(e instanceof Error){let r=new Vt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Vt(String(e)))}});function Mcr(t){return typeof t.parse=="function"}var Cet=v(()=>{});var _b,xet,Cxe,Oet,Tet,Eet,Icr,Rcr,Roo,t8,Pet=v(()=>{IS();AC();YK();vet();Sxe();Cet();Roo=10,t8=class extends KF{constructor(){super(...arguments),_b.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),_et(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(QK(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 Vt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),xe(this,_b,"m",xet).call(this)}async finalMessage(){return await this.done(),xe(this,_b,"m",Cxe).call(this)}async finalFunctionToolCall(){return await this.done(),xe(this,_b,"m",Oet).call(this)}async finalFunctionToolCallResult(){return await this.done(),xe(this,_b,"m",Tet).call(this)}async totalUsage(){return await this.done(),xe(this,_b,"m",Eet).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=xe(this,_b,"m",Cxe).call(this);r&&this._emit("finalMessage",r);let n=xe(this,_b,"m",xet).call(this);n&&this._emit("finalContent",n);let o=xe(this,_b,"m",Oet).call(this);o&&this._emit("finalFunctionToolCall",o);let i=xe(this,_b,"m",Tet).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",xe(this,_b,"m",Eet).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),xe(this,_b,"m",Icr).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(qoe(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=Roo}=n||{},c=r.tools.map(p=>{if(R2(p)){if(!p.$callback)throw new Vt("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of c)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?c.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;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 Vt("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 M=`Invalid tool_call: ${JSON.stringify(b)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:M});continue}}else{let M=`Invalid tool_call: ${JSON.stringify(b)}. Available options are: ${Object.keys(d).map(I=>JSON.stringify(I)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:M});continue}let O;try{O=Mcr(w)?await w.parse(_):_}catch(M){let I=M instanceof Error?M.message:String(M);this._addMessage({role:o,tool_call_id:g,content:I});continue}let T=await w.function(O,this),P=xe(this,_b,"m",Rcr).call(this,T);if(this._addMessage({role:o,tool_call_id:g,content:P}),u)return}}}};_b=new WeakSet,xet=function(){return xe(this,_b,"m",Cxe).call(this).content??null},Cxe=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(QK(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new Vt("stream ended without producing a ChatCompletionMessage with role=assistant")},Oet=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(QK(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},Tet=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(_et(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}},Eet=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},Icr=function(e){if(e.n!=null&&e.n>1)throw new Vt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},Rcr=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var Hoe,Met=v(()=>{Pet();vet();Hoe=class t extends t8{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),QK(e)&&e.content&&this._emit("content",e.content)}}});function Aoo(t,e=yh.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return Noo(t.trim(),e)}var yh,Iet,Ret,Noo,Aet,Acr=v(()=>{yh={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},Iet=class extends Error{},Ret=class extends Error{};Noo=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Iet(`${f} at position ${n}`)},i=f=>{throw new Ret(`${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"||yh.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||yh.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||yh.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||yh.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||yh.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||yh.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(yh.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&&yh.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(yh.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(yh.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(yh.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&yh.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(yh.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&&!(yh.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&yh.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()},Aet=t=>Aoo(t,yh.ALL^yh.NUM)});var Net=v(()=>{uet()});function joo(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:a,...s}=t,u={...s,id:r,choices:n.map(({message:l,finish_reason:c,index:d,logprobs:f,...p})=>{if(!c)throw new Vt(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:y,...g}=l,b=l.role;if(!b)throw new Vt(`missing role for choice ${d}`);if(h){let{arguments:_,name:w}=h;if(_==null)throw new Vt(`missing function_call.arguments for choice ${d}`);if(!w)throw new Vt(`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:O,type:T,id:P,...M}=_,{arguments:I,name:j,...A}=O||{};if(P==null)throw new Vt(`missing choices[${d}].tool_calls[${w}].id
|
||
${Txe(t)}`);if(T==null)throw new Vt(`missing choices[${d}].tool_calls[${w}].type
|
||
${Txe(t)}`);if(j==null)throw new Vt(`missing choices[${d}].tool_calls[${w}].function.name
|
||
${Txe(t)}`);if(I==null)throw new Vt(`missing choices[${d}].tool_calls[${w}].function.arguments
|
||
${Txe(t)}`);return{...M,id:P,type:T,function:{...A,name:j,arguments:I}}})}}:{...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 xcr(u,e)}function Txe(t){return JSON.stringify(t)}var Mm,S1,r8,GF,jet,xxe,Det,$et,Let,Oxe,Fet,Ncr,A2,Exe=v(()=>{IS();Acr();AC();YK();Net();Pet();A2=class t extends t8{constructor(e){super(),Mm.add(this),S1.set(this,void 0),r8.set(this,void 0),GF.set(this,void 0),Hr(this,S1,e,"f"),Hr(this,r8,[],"f")}get currentChatCompletionSnapshot(){return xe(this,GF,"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())),xe(this,Mm,"m",jet).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)xe(this,Mm,"m",Det).call(this,a);if(i.controller.signal?.aborted)throw new Ic;return this._addChatCompletion(xe(this,Mm,"m",Oxe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),xe(this,Mm,"m",jet).call(this),this._connected();let o=aR.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(xe(this,Mm,"m",Oxe).call(this)),xe(this,Mm,"m",Det).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Ic;return this._addChatCompletion(xe(this,Mm,"m",Oxe).call(this))}[(S1=new WeakMap,r8=new WeakMap,GF=new WeakMap,Mm=new WeakSet,jet=function(){this.ended||Hr(this,GF,void 0,"f")},xxe=function(r){let n=xe(this,r8,"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},xe(this,r8,"f")[r.index]=n,n)},Det=function(r){if(this.ended)return;let n=xe(this,Mm,"m",Ncr).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=xe(this,Mm,"m",xxe).call(this,i);i.finish_reason&&(xe(this,Mm,"m",Let).call(this,i),a.current_tool_call_index!=null&&xe(this,Mm,"m",$et).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(xe(this,Mm,"m",Let).call(this,i),a.current_tool_call_index!=null&&xe(this,Mm,"m",$et).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))}}},$et=function(r,n){if(xe(this,Mm,"m",xxe).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=xe(this,S1,"f")?.tools?.find(s=>Foe(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:R2(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Let=function(r){let n=xe(this,Mm,"m",xxe).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=xe(this,Mm,"m",Fet).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}))},Oxe=function(){if(this.ended)throw new Vt("stream has ended, this shouldn't happen");let r=xe(this,GF,"f");if(!r)throw new Vt("request ended without sending any chunks");return Hr(this,GF,void 0,"f"),Hr(this,r8,[],"f"),joo(r,xe(this,S1,"f"))},Fet=function(){let r=xe(this,S1,"f")?.response_format;return koe(r)?r:null},Ncr=function(r){var n,o,i,a;let s=xe(this,GF,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=Hr(this,GF,{...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:T,refusal:P,...M}=p;Object.assign(h.logprobs,M),T&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...T)),P&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...P))}if(d&&(h.finish_reason=d,xe(this,S1,"f")&&bet(xe(this,S1,"f")))){if(d==="length")throw new JK;if(d==="content_filter")throw new WK}if(Object.assign(h,m),!c)continue;let{content:y,refusal:g,function_call:b,role:_,tool_calls:w,...O}=c;if(Object.assign(h.message,O),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&&xe(this,Mm,"m",Fet).call(this)&&(h.message.parsed=Aet(h.message.content))),w){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:T,id:P,type:M,function:I,...j}of w){let A=(a=h.message.tool_calls)[T]??(a[T]={});Object.assign(A,j),P&&(A.id=P),M&&(A.type=M),I&&(A.function??(A.function={name:I.name??"",arguments:""})),I?.name&&(A.function.name=I.name),I?.arguments&&(A.function.arguments+=I.arguments,Ocr(xe(this,S1,"f"),A)&&(A.function.parsed_arguments=Aet(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 aR(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var Joe,ket=v(()=>{Exe();Joe=class t extends A2{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 C1,Woe=v(()=>{kr();gxe();gxe();Iu();ns();Met();ket();Exe();YK();ket();Cet();Exe();Met();C1=class extends ze{constructor(){super(...arguments),this.messages=new I2(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(je`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post(je`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",ri,{query:e,...r})}delete(e,r){return this._client.delete(je`/chat/completions/${e}`,r)}parse(e,r){return Ecr(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>qoe(n,e))}runTools(e,r){return e.stream?Joe.runTools(this._client,e,r):Hoe.runTools(this._client,e,r)}stream(e,r){return A2.createChatCompletion(this._client,e,r)}};C1.Messages=I2});var XF,qet=v(()=>{kr();Woe();Woe();XF=class extends ze{constructor(){super(...arguments),this.completions=new C1(this._client)}};XF.Completions=C1});var jcr=v(()=>{Woe();Woe();gxe()});var Dcr=v(()=>{qet();jcr()});var $cr=v(()=>{});function*$oo(t){if(!t)return;if(Lcr 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():WQe(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=WQe(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 Lcr,mt,Bl=v(()=>{b1();Lcr=Symbol("brand.privateNullableHeaders");mt=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,a]of $oo(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{[Lcr]:!0,values:e,nulls:r}}});var n8,Uet=v(()=>{kr();Bl();n8=class extends ze{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:mt([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}}});var o8,Bet=v(()=>{kr();uR();o8=class extends ze{create(e,r){return this._client.post("/audio/transcriptions",Xv({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}}});var i8,zet=v(()=>{kr();uR();i8=class extends ze{create(e,r){return this._client.post("/audio/translations",Xv({body:e,...r,__metadata:{model:e.model}},this._client))}}});var lR,Vet=v(()=>{kr();Uet();Uet();Bet();Bet();zet();zet();lR=class extends ze{constructor(){super(...arguments),this.transcriptions=new o8(this._client),this.translations=new i8(this._client),this.speech=new n8(this._client)}};lR.Transcriptions=o8;lR.Translations=i8;lR.Speech=n8});var N2,Het=v(()=>{kr();Iu();ns();N2=class extends ze{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get(je`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",ri,{query:e,...r})}cancel(e,r){return this._client.post(je`/batches/${e}/cancel`,r)}}});var a8,Jet=v(()=>{kr();Iu();Bl();ns();a8=class extends ze{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(je`/assistants/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(je`/assistants/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",ri,{query:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(je`/assistants/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var s8,Wet=v(()=>{kr();Bl();s8=class extends ze{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var u8,Ket=v(()=>{kr();Bl();u8=class extends ze{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var ZF,Get=v(()=>{kr();Wet();Wet();Ket();Ket();ZF=class extends ze{constructor(){super(...arguments),this.sessions=new s8(this._client),this.transcriptionSessions=new u8(this._client)}};ZF.Sessions=s8;ZF.TranscriptionSessions=u8});var l8,Xet=v(()=>{kr();Bl();ns();l8=class extends ze{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:mt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}cancel(e,r){return this._client.post(je`/chatkit/sessions/${e}/cancel`,{...r,headers:mt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}}});var c8,Zet=v(()=>{kr();Iu();Bl();ns();c8=class extends ze{retrieve(e,r){return this._client.get(je`/chatkit/threads/${e}`,{...r,headers:mt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}list(e={},r){return this._client.getAPIList("/chatkit/threads",v1,{query:e,...r,headers:mt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}delete(e,r){return this._client.delete(je`/chatkit/threads/${e}`,{...r,headers:mt([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}listItems(e,r={},n){return this._client.getAPIList(je`/chatkit/threads/${e}/items`,v1,{query:r,...n,headers:mt([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers])})}}});var YF,Yet=v(()=>{kr();Xet();Xet();Zet();Zet();YF=class extends ze{constructor(){super(...arguments),this.sessions=new l8(this._client),this.threads=new c8(this._client)}};YF.Sessions=l8;YF.Threads=c8});var d8,Qet=v(()=>{kr();Iu();Bl();ns();d8=class extends ze{create(e,r,n){return this._client.post(je`/threads/${e}/messages`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(je`/threads/${o}/messages/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(je`/threads/${o}/messages/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(je`/threads/${e}/messages`,ri,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(je`/threads/${o}/messages/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var f8,ett=v(()=>{kr();Iu();Bl();ns();f8=class extends ze{retrieve(e,r,n){let{thread_id:o,run_id:i,...a}=r;return this._client.get(je`/threads/${o}/runs/${i}/steps/${e}`,{query:a,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList(je`/threads/${o}/runs/${e}/steps`,ri,{query:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var Fcr,kcr=v(()=>{nR();lxe();Fcr=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 NC,ttt=v(()=>{NC=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 Koe=v(()=>{b1();kcr();ttt();Roe();JQe();GK()});var Cg,D2,rtt,cR,Pxe,jC,$2,p8,j2,Rxe,Zv,Mxe,Ixe,Zoe,Goe,Xoe,qcr,Ucr,Bcr,zcr,Vcr,Hcr,Jcr,x1,ntt=v(()=>{IS();Net();AC();Sxe();Koe();x1=class extends KF{constructor(){super(...arguments),Cg.add(this),rtt.set(this,[]),cR.set(this,{}),Pxe.set(this,{}),jC.set(this,void 0),$2.set(this,void 0),p8.set(this,void 0),j2.set(this,void 0),Rxe.set(this,void 0),Zv.set(this,void 0),Mxe.set(this,void 0),Ixe.set(this,void 0),Zoe.set(this,void 0)}[(rtt=new WeakMap,cR=new WeakMap,Pxe=new WeakMap,jC=new WeakMap,$2=new WeakMap,p8=new WeakMap,j2=new WeakMap,Rxe=new WeakMap,Zv=new WeakMap,Mxe=new WeakMap,Ixe=new WeakMap,Zoe=new WeakMap,Cg=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 D2;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=aR.fromReadableStream(e,this.controller);for await(let i of o)xe(this,Cg,"m",Goe).call(this,i);if(o.controller.signal?.aborted)throw new Ic;return this._addRun(xe(this,Cg,"m",Xoe).call(this))}toReadableStream(){return new aR(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new D2;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)xe(this,Cg,"m",Goe).call(this,u);if(s.controller.signal?.aborted)throw new Ic;return this._addRun(xe(this,Cg,"m",Xoe).call(this))}static createThreadAssistantStream(e,r,n){let o=new D2;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 D2;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return xe(this,Mxe,"f")}currentRun(){return xe(this,Ixe,"f")}currentMessageSnapshot(){return xe(this,jC,"f")}currentRunStepSnapshot(){return xe(this,Zoe,"f")}async finalRunSteps(){return await this.done(),Object.values(xe(this,cR,"f"))}async finalMessages(){return await this.done(),Object.values(xe(this,Pxe,"f"))}async finalRun(){if(await this.done(),!xe(this,$2,"f"))throw Error("Final run was not received.");return xe(this,$2,"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)xe(this,Cg,"m",Goe).call(this,s);if(a.controller.signal?.aborted)throw new Ic;return this._addRun(xe(this,Cg,"m",Xoe).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)xe(this,Cg,"m",Goe).call(this,u);if(s.controller.signal?.aborted)throw new Ic;return this._addRun(xe(this,Cg,"m",Xoe).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(KK(i)&&KK(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(!KK(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)}};D2=x1,Goe=function(e){if(!this.ended)switch(Hr(this,Mxe,e,"f"),xe(this,Cg,"m",Bcr).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":xe(this,Cg,"m",Jcr).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":xe(this,Cg,"m",Ucr).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":xe(this,Cg,"m",qcr).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},Xoe=function(){if(this.ended)throw new Vt("stream has ended, this shouldn't happen");if(!xe(this,$2,"f"))throw Error("Final run has not been received");return xe(this,$2,"f")},qcr=function(e){let[r,n]=xe(this,Cg,"m",Vcr).call(this,e,xe(this,jC,"f"));Hr(this,jC,r,"f"),xe(this,Pxe,"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!=xe(this,p8,"f")){if(xe(this,j2,"f"))switch(xe(this,j2,"f").type){case"text":this._emit("textDone",xe(this,j2,"f").text,xe(this,jC,"f"));break;case"image_file":this._emit("imageFileDone",xe(this,j2,"f").image_file,xe(this,jC,"f"));break}Hr(this,p8,o.index,"f")}Hr(this,j2,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(xe(this,p8,"f")!==void 0){let o=e.data.content[xe(this,p8,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,xe(this,jC,"f"));break;case"text":this._emit("textDone",o.text,xe(this,jC,"f"));break}}xe(this,jC,"f")&&this._emit("messageDone",e.data),Hr(this,jC,void 0,"f")}},Ucr=function(e){let r=xe(this,Cg,"m",zcr).call(this,e);switch(Hr(this,Zoe,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==xe(this,Rxe,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(xe(this,Zv,"f")&&this._emit("toolCallDone",xe(this,Zv,"f")),Hr(this,Rxe,i.index,"f"),Hr(this,Zv,r.step_details.tool_calls[i.index],"f"),xe(this,Zv,"f")&&this._emit("toolCallCreated",xe(this,Zv,"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":Hr(this,Zoe,void 0,"f"),e.data.step_details.type=="tool_calls"&&xe(this,Zv,"f")&&(this._emit("toolCallDone",xe(this,Zv,"f")),Hr(this,Zv,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},Bcr=function(e){xe(this,rtt,"f").push(e),this._emit("event",e)},zcr=function(e){switch(e.event){case"thread.run.step.created":return xe(this,cR,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=xe(this,cR,"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=D2.accumulateDelta(r,n.delta);xe(this,cR,"f")[e.data.id]=o}return xe(this,cR,"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":xe(this,cR,"f")[e.data.id]=e.data;break}if(xe(this,cR,"f")[e.data.id])return xe(this,cR,"f")[e.data.id];throw new Error("No snapshot available")},Vcr=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]=xe(this,Cg,"m",Hcr).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")},Hcr=function(e,r){return D2.accumulateDelta(r,e)},Jcr=function(e){switch(Hr(this,Ixe,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":Hr(this,$2,e.data,"f"),xe(this,Zv,"f")&&(this._emit("toolCallDone",xe(this,Zv,"f")),Hr(this,Zv,void 0,"f"));break;case"thread.run.cancelling":break}}});var L2,ott=v(()=>{kr();ett();ett();Iu();Bl();ntt();GK();ns();L2=class extends ze{constructor(){super(...arguments),this.steps=new f8(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post(je`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(je`/threads/${o}/runs/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post(je`/threads/${o}/runs/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(je`/threads/${e}/runs`,ri,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(je`/threads/${o}/runs/${e}/cancel`,{...n,headers:mt([{"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 x1.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=mt([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 oR(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return x1.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post(je`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:mt([{"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 x1.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};L2.Steps=f8});var QF,itt=v(()=>{kr();Qet();Qet();ott();ott();Bl();ntt();ns();QF=class extends ze{constructor(){super(...arguments),this.runs=new L2(this._client),this.messages=new d8(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(je`/threads/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(je`/threads/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete(je`/threads/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:mt([{"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 x1.createThreadAssistantStream(e,this._client.beta.threads,r)}};QF.Runs=L2;QF.Messages=d8});var DC,att=v(()=>{kr();Jet();Jet();Get();Get();Yet();Yet();itt();itt();DC=class extends ze{constructor(){super(...arguments),this.realtime=new ZF(this._client),this.chatkit=new YF(this._client),this.assistants=new a8(this._client),this.threads=new QF(this._client)}};DC.Realtime=ZF;DC.ChatKit=YF;DC.Assistants=a8;DC.Threads=QF});var F2,stt=v(()=>{kr();F2=class extends ze{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var m8,utt=v(()=>{kr();Bl();ns();m8=class extends ze{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(je`/containers/${o}/files/${e}/content`,{...n,headers:mt([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}}});var k2,ltt=v(()=>{kr();utt();utt();Iu();Bl();uR();ns();k2=class extends ze{constructor(){super(...arguments),this.content=new m8(this._client)}create(e,r,n){return this._client.post(je`/containers/${e}/files`,Xv({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(je`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList(je`/containers/${e}/files`,ri,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(je`/containers/${o}/files/${e}`,{...n,headers:mt([{Accept:"*/*"},n?.headers])})}};k2.Content=m8});var ek,ctt=v(()=>{kr();ltt();ltt();Iu();Bl();ns();ek=class extends ze{constructor(){super(...arguments),this.files=new k2(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get(je`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",ri,{query:e,...r})}delete(e,r){return this._client.delete(je`/containers/${e}`,{...r,headers:mt([{Accept:"*/*"},r?.headers])})}};ek.Files=k2});var h8,dtt=v(()=>{kr();Iu();ns();h8=class extends ze{create(e,r,n){let{include:o,...i}=r;return this._client.post(je`/conversations/${e}/items`,{query:{include:o},body:i,...n})}retrieve(e,r,n){let{conversation_id:o,...i}=r;return this._client.get(je`/conversations/${o}/items/${e}`,{query:i,...n})}list(e,r={},n){return this._client.getAPIList(je`/conversations/${e}/items`,v1,{query:r,...n})}delete(e,r,n){let{conversation_id:o}=r;return this._client.delete(je`/conversations/${o}/items/${e}`,n)}}});var tk,ftt=v(()=>{kr();dtt();dtt();ns();tk=class extends ze{constructor(){super(...arguments),this.items=new h8(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r})}retrieve(e,r){return this._client.get(je`/conversations/${e}`,r)}update(e,r,n){return this._client.post(je`/conversations/${e}`,{body:r,...n})}delete(e,r){return this._client.delete(je`/conversations/${e}`,r)}};tk.Items=h8});var q2,ptt=v(()=>{kr();Koe();q2=class extends ze{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&Kc(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:(Kc(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=Fcr(u)}),a)))}}});var g8,mtt=v(()=>{kr();Iu();ns();g8=class extends ze{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get(je`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList(je`/evals/${o}/runs/${e}/output_items`,ri,{query:i,...n})}}});var U2,htt=v(()=>{kr();mtt();mtt();Iu();ns();U2=class extends ze{constructor(){super(...arguments),this.outputItems=new g8(this._client)}create(e,r,n){return this._client.post(je`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(je`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList(je`/evals/${e}/runs`,ri,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(je`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(je`/evals/${o}/runs/${e}`,n)}};U2.OutputItems=g8});var rk,gtt=v(()=>{kr();htt();htt();Iu();ns();rk=class extends ze{constructor(){super(...arguments),this.runs=new U2(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get(je`/evals/${e}`,r)}update(e,r,n){return this._client.post(je`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",ri,{query:e,...r})}delete(e,r){return this._client.delete(je`/evals/${e}`,r)}};rk.Runs=U2});var B2,ytt=v(()=>{kr();Iu();Bl();GK();AC();uR();ns();B2=class extends ze{create(e,r){return this._client.post("/files",Xv({body:e,...r},this._client))}retrieve(e,r){return this._client.get(je`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",ri,{query:e,...r})}delete(e,r){return this._client.delete(je`/files/${e}`,r)}content(e,r){return this._client.get(je`/files/${e}/content`,{...r,headers:mt([{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 oR(r),a=await this.retrieve(e),Date.now()-i>n)throw new tR({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}}});var y8,btt=v(()=>{kr();y8=class extends ze{}});var b8,_tt=v(()=>{kr();b8=class extends ze{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 z2,vtt=v(()=>{kr();_tt();_tt();z2=class extends ze{constructor(){super(...arguments),this.graders=new b8(this._client)}};z2.Graders=b8});var _8,wtt=v(()=>{kr();Iu();ns();_8=class extends ze{create(e,r,n){return this._client.getAPIList(je`/fine_tuning/checkpoints/${e}/permissions`,sR,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get(je`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(je`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}}});var V2,Stt=v(()=>{kr();wtt();wtt();V2=class extends ze{constructor(){super(...arguments),this.permissions=new _8(this._client)}};V2.Permissions=_8});var v8,Ctt=v(()=>{kr();Iu();ns();v8=class extends ze{list(e,r={},n){return this._client.getAPIList(je`/fine_tuning/jobs/${e}/checkpoints`,ri,{query:r,...n})}}});var H2,xtt=v(()=>{kr();Ctt();Ctt();Iu();ns();H2=class extends ze{constructor(){super(...arguments),this.checkpoints=new v8(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get(je`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",ri,{query:e,...r})}cancel(e,r){return this._client.post(je`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList(je`/fine_tuning/jobs/${e}/events`,ri,{query:r,...n})}pause(e,r){return this._client.post(je`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post(je`/fine_tuning/jobs/${e}/resume`,r)}};H2.Checkpoints=v8});var $C,Ott=v(()=>{kr();btt();btt();vtt();vtt();Stt();Stt();xtt();xtt();$C=class extends ze{constructor(){super(...arguments),this.methods=new y8(this._client),this.jobs=new H2(this._client),this.checkpoints=new V2(this._client),this.alpha=new z2(this._client)}};$C.Methods=y8;$C.Jobs=H2;$C.Checkpoints=V2;$C.Alpha=z2});var w8,Ttt=v(()=>{kr();w8=class extends ze{}});var nk,Ett=v(()=>{kr();Ttt();Ttt();nk=class extends ze{constructor(){super(...arguments),this.graderModels=new w8(this._client)}};nk.GraderModels=w8});var J2,Ptt=v(()=>{kr();uR();J2=class extends ze{createVariation(e,r){return this._client.post("/images/variations",Xv({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",Xv({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 W2,Mtt=v(()=>{kr();Iu();ns();W2=class extends ze{retrieve(e,r){return this._client.get(je`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",sR,e)}delete(e,r){return this._client.delete(je`/models/${e}`,r)}}});var K2,Itt=v(()=>{kr();K2=class extends ze{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});var S8,Rtt=v(()=>{kr();Bl();ns();S8=class extends ze{accept(e,r,n){return this._client.post(je`/realtime/calls/${e}/accept`,{body:r,...n,headers:mt([{Accept:"*/*"},n?.headers])})}hangup(e,r){return this._client.post(je`/realtime/calls/${e}/hangup`,{...r,headers:mt([{Accept:"*/*"},r?.headers])})}refer(e,r,n){return this._client.post(je`/realtime/calls/${e}/refer`,{body:r,...n,headers:mt([{Accept:"*/*"},n?.headers])})}reject(e,r={},n){return this._client.post(je`/realtime/calls/${e}/reject`,{body:r,...n,headers:mt([{Accept:"*/*"},n?.headers])})}}});var C8,Att=v(()=>{kr();C8=class extends ze{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r})}}});var O1,Ntt=v(()=>{kr();Rtt();Rtt();Att();Att();O1=class extends ze{constructor(){super(...arguments),this.clientSecrets=new C8(this._client),this.calls=new S8(this._client)}};O1.ClientSecrets=C8;O1.Calls=S8});function Wcr(t,e){return!e||!pio(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)}:jtt(t,e)}function jtt(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:gio(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:fio(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||Axe(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 fio(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function pio(t){return!!koe(t.text?.format)}function mio(t){return t?.$brand==="auto-parseable-tool"}function hio(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function gio(t,e){let r=hio(t.tools??[],e.name);return{...e,...e,parsed_arguments:mio(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function Axe(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 Nxe=v(()=>{AC();YK()});function yio(t,e){return Wcr(t,e)}var x8,jxe,ok,Dxe,Kcr,Gcr,Xcr,Zcr,$xe,Ycr=v(()=>{IS();AC();Sxe();Nxe();$xe=class t extends KF{constructor(e){super(),x8.add(this),jxe.set(this,void 0),ok.set(this,void 0),Dxe.set(this,void 0),Hr(this,jxe,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())),xe(this,x8,"m",Kcr).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)xe(this,x8,"m",Gcr).call(this,s,a);if(i.controller.signal?.aborted)throw new Ic;return xe(this,x8,"m",Xcr).call(this)}[(jxe=new WeakMap,ok=new WeakMap,Dxe=new WeakMap,x8=new WeakSet,Kcr=function(){this.ended||Hr(this,ok,void 0,"f")},Gcr=function(r,n){if(this.ended)return;let o=(a,s)=>{(n==null||s.sequence_number>n)&&this._emit(a,s)},i=xe(this,x8,"m",Zcr).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 Vt(`missing output at index ${r.output_index}`);if(a.type==="message"){let s=a.content[r.content_index];if(!s)throw new Vt(`missing content at index ${r.content_index}`);if(s.type!=="output_text")throw new Vt(`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 Vt(`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}},Xcr=function(){if(this.ended)throw new Vt("stream has ended, this shouldn't happen");let r=xe(this,ok,"f");if(!r)throw new Vt("request ended without sending any events");Hr(this,ok,void 0,"f");let n=yio(r,xe(this,jxe,"f"));return Hr(this,Dxe,n,"f"),n},Zcr=function(r){let n=xe(this,ok,"f");if(!n){if(r.type!=="response.created")throw new Vt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=Hr(this,ok,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new Vt(`missing output at index ${r.output_index}`);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 Vt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new Vt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new Vt(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new Vt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.reasoning_text.delta":{let o=n.output[r.output_index];if(!o)throw new Vt(`missing output at index ${r.output_index}`);if(o.type==="reasoning"){let i=o.content?.[r.content_index];if(!i)throw new Vt(`missing content at index ${r.content_index}`);if(i.type!=="reasoning_text")throw new Vt(`expected content to be 'reasoning_text', got ${i.type}`);i.text+=r.delta}break}case"response.completed":{Hr(this,ok,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=xe(this,Dxe,"f");if(!e)throw new Vt("stream ended without producing a ChatCompletion");return e}}});var O8,Dtt=v(()=>{kr();Iu();ns();O8=class extends ze{list(e,r={},n){return this._client.getAPIList(je`/responses/${e}/input_items`,ri,{query:r,...n})}}});var T8,$tt=v(()=>{kr();T8=class extends ze{count(e={},r){return this._client.post("/responses/input_tokens",{body:e,...r})}}});var T1,Ltt=v(()=>{Nxe();Ycr();kr();Dtt();Dtt();$tt();$tt();Bl();ns();T1=class extends ze{constructor(){super(...arguments),this.inputItems=new O8(this._client),this.inputTokens=new T8(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"&&Axe(n),n))}retrieve(e,r={},n){return this._client.get(je`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&Axe(o),o))}delete(e,r){return this._client.delete(je`/responses/${e}`,{...r,headers:mt([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>jtt(n,e))}stream(e,r){return $xe.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(je`/responses/${e}/cancel`,r)}compact(e,r){return this._client.post("/responses/compact",{body:e,...r})}};T1.InputItems=O8;T1.InputTokens=T8});var E8,Ftt=v(()=>{kr();uR();ns();E8=class extends ze{create(e,r,n){return this._client.post(je`/uploads/${e}/parts`,Xv({body:r,...n},this._client))}}});var ik,ktt=v(()=>{kr();Ftt();Ftt();ns();ik=class extends ze{constructor(){super(...arguments),this.parts=new E8(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r})}cancel(e,r){return this._client.post(je`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post(je`/uploads/${e}/complete`,{body:r,...n})}};ik.Parts=E8});var Qcr,edr=v(()=>{Qcr=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 P8,qtt=v(()=>{kr();Iu();Bl();GK();edr();ns();P8=class extends ze{create(e,r,n){return this._client.post(je`/vector_stores/${e}/file_batches`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(je`/vector_stores/${o}/file_batches/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(je`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:mt([{"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(je`/vector_stores/${o}/file_batches/${e}/files`,ri,{query:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=mt([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 oR(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 Qcr(d),await this.createAndPoll(e,{file_ids:l})}}});var M8,Utt=v(()=>{kr();Iu();Bl();Koe();ns();M8=class extends ze{create(e,r,n){return this._client.post(je`/vector_stores/${e}/files`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(je`/vector_stores/${o}/files/${e}`,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post(je`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList(je`/vector_stores/${e}/files`,ri,{query:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(je`/vector_stores/${o}/files/${e}`,{...n,headers:mt([{"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=mt([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 oR(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(je`/vector_stores/${o}/files/${e}/content`,sR,{...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var E1,Btt=v(()=>{kr();qtt();qtt();Utt();Utt();Iu();Bl();ns();E1=class extends ze{constructor(){super(...arguments),this.files=new M8(this._client),this.fileBatches=new P8(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get(je`/vector_stores/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post(je`/vector_stores/${e}`,{body:r,...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",ri,{query:e,...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete(je`/vector_stores/${e}`,{...r,headers:mt([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList(je`/vector_stores/${e}/search`,sR,{body:r,method:"post",...n,headers:mt([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};E1.Files=M8;E1.FileBatches=P8});var G2,ztt=v(()=>{kr();Iu();Bl();uR();ns();G2=class extends ze{create(e,r){return this._client.post("/videos",het({body:e,...r},this._client))}retrieve(e,r){return this._client.get(je`/videos/${e}`,r)}list(e={},r){return this._client.getAPIList("/videos",v1,{query:e,...r})}delete(e,r){return this._client.delete(je`/videos/${e}`,r)}downloadContent(e,r={},n){return this._client.get(je`/videos/${e}/content`,{query:r,...n,headers:mt([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}remix(e,r,n){return this._client.post(je`/videos/${e}/remix`,het({body:r,...n},this._client))}}});var I8,tdr,Lxe,X2,Vtt=v(()=>{IS();AC();kr();Bl();X2=class extends ze{constructor(){super(...arguments),I8.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");xe(this,I8,"m",tdr).call(this,n);let i=mt([r]).values,a=xe(this,I8,"m",Lxe).call(this,i,"webhook-signature"),s=xe(this,I8,"m",Lxe).call(this,i,"webhook-timestamp"),u=xe(this,I8,"m",Lxe).call(this,i,"webhook-id"),l=parseInt(s,10);if(isNaN(l))throw new rR("Invalid webhook timestamp format");let c=Math.floor(Date.now()/1e3);if(c-l>o)throw new rR("Webhook timestamp is too old");if(l>c+o)throw new rR("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 rR("The given webhook signature does not match the expected signature")}};I8=new WeakSet,tdr=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")},Lxe=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 rdr=v(()=>{Dcr();$cr();Vet();Het();att();stt();ctt();ftt();ptt();gtt();ytt();Ott();Ett();Ptt();Mtt();Itt();Ntt();Ltt();ktt();Btt();ztt();Vtt()});var Htt,Jtt,Fxe,ndr,bn,kxe=v(()=>{IS();JQe();b1();GK();nxe();XQe();Moe();ecr();lcr();GQe();nR();Iu();yet();rdr();pxe();Het();stt();ptt();ytt();Ptt();Mtt();Itt();ztt();Vtt();Vet();att();qet();ctt();ftt();gtt();Ott();Ett();Ntt();Ltt();ktt();Btt();XQe();Bl();ttt();Roe();b1();bn=class{constructor({baseURL:e=NC("OPENAI_BASE_URL"),apiKey:r=NC("OPENAI_API_KEY"),organization:n=NC("OPENAI_ORG_ID")??null,project:o=NC("OPENAI_PROJECT_ID")??null,webhookSecret:i=NC("OPENAI_WEBHOOK_SECRET")??null,...a}={}){if(Htt.add(this),Fxe.set(this,void 0),this.completions=new F2(this),this.chat=new XF(this),this.embeddings=new q2(this),this.files=new B2(this),this.images=new J2(this),this.audio=new lR(this),this.moderations=new K2(this),this.models=new W2(this),this.fineTuning=new $C(this),this.graders=new nk(this),this.vectorStores=new E1(this),this.webhooks=new X2(this),this.beta=new DC(this),this.batches=new N2(this),this.uploads=new ik(this),this.responses=new T1(this),this.realtime=new O1(this),this.conversations=new tk(this),this.evals=new rk(this),this.containers=new ek(this),this.videos=new G2(this),r===void 0)throw new Vt("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&&Glr())throw new Vt(`It looks like you're running in a browser-like environment.
|
||
|
||
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
||
If you understand the risks and have appropriate mitigations in place,
|
||
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??Jtt.DEFAULT_TIMEOUT,this.logger=s.logger??console;let u="warn";this.logLevel=u,this.logLevel=aet(s.logLevel,"ClientOptions.logLevel",this)??aet(NC("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??u,this.fetchOptions=s.fetchOptions,this.maxRetries=s.maxRetries??2,this.fetch=s.fetch??Zlr(),Hr(this,Fxe,Qlr,"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 mt([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return oet(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${WF}`}defaultIdempotencyKey(){return`stainless-node-retry-${HQe()}`}makeStatusError(e,r,n,o){return Em.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 Vt?n:new Vt(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new Vt(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let o=!xe(this,Htt,"m",ndr).call(this)&&n||this.baseURL,i=Ulr(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return Blr(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 M2(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(Kc(this).debug(`[${l}] sending request`,_1({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new Ic;let f=new AbortController,p=await this.fetchWithTimeout(s,a,u,f).catch(Poe),m=Date.now();if(p instanceof globalThis.Error){let g=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new Ic;let b=Eoe(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return Kc(this).info(`[${l}] connection ${b?"timed out":"failed"} - ${g}`),Kc(this).debug(`[${l}] connection ${b?"timed out":"failed"} (${g})`,_1({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??l);throw Kc(this).info(`[${l}] connection ${b?"timed out":"failed"} - error; no more retries left`),Kc(this).debug(`[${l}] connection ${b?"timed out":"failed"} (error; no more retries left)`,_1({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),b?new tR:new JF({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 P=`retrying, ${r} attempts remaining`;return await Ylr(p.body),Kc(this).info(`${y} - ${P}`),Kc(this).debug(`[${l}] response error (${P})`,_1({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";Kc(this).info(`${y} - ${b}`);let _=await p.text().catch(P=>Poe(P).message),w=Hlr(_),O=w?void 0:_;throw Kc(this).debug(`[${l}] response error (${b})`,_1({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:O,durationMs:Date.now()-d})),this.makeStatusError(p.status,w,O,p.headers)}return Kc(this).info(y),Kc(this).debug(`[${l}] response start`,_1({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 Doe(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 oR(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&&Vlr("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=mt([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))}:{},...Xlr(),"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=mt([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:oxe(e)}:xe(this,Fxe,"f").call(this,{body:e,headers:n})}};Jtt=bn,Fxe=new WeakMap,Htt=new WeakSet,ndr=function(){return this.baseURL!=="https://api.openai.com/v1"};bn.OpenAI=Jtt;bn.DEFAULT_TIMEOUT=6e5;bn.OpenAIError=Vt;bn.APIError=Em;bn.APIConnectionError=JF;bn.APIConnectionTimeoutError=tR;bn.APIUserAbortError=Ic;bn.NotFoundError=UK;bn.ConflictError=BK;bn.RateLimitError=VK;bn.BadRequestError=FK;bn.AuthenticationError=kK;bn.InternalServerError=HK;bn.PermissionDeniedError=qK;bn.UnprocessableEntityError=zK;bn.InvalidWebhookSignatureError=rR;bn.toFile=Loe;bn.Completions=F2;bn.Chat=XF;bn.Embeddings=q2;bn.Files=B2;bn.Images=J2;bn.Audio=lR;bn.Moderations=K2;bn.Models=W2;bn.FineTuning=$C;bn.Graders=nk;bn.VectorStores=E1;bn.Webhooks=X2;bn.Beta=DC;bn.Batches=N2;bn.Uploads=ik;bn.Responses=T1;bn.Realtime=O1;bn.Conversations=tk;bn.Evals=rk;bn.Containers=ek;bn.Videos=G2});var Z2,xio,odr=v(()=>{Bl();AC();Koe();kxe();Z2=class extends bn{constructor({baseURL:e=NC("OPENAI_BASE_URL"),apiKey:r=NC("AZURE_OPENAI_API_KEY"),apiVersion:n=NC("OPENAI_API_VERSION"),endpoint:o,deployment:i,azureADTokenProvider:a,dangerouslyAllowBrowser:s,...u}={}){if(!n)throw new Vt("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof a=="function"&&(s=!0),!a&&!r)throw new Vt("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new Vt("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(u.defaultQuery={...u.defaultQuery,"api-version":n},e){if(o)throw new Vt("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new Vt("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");e=`${o}/openai`}super({apiKey:a??r,baseURL:e,...u,...s!==void 0?{dangerouslyAllowBrowser:s}:{}}),this.apiVersion="",this.apiVersion=n,this.deploymentName=i}async buildRequest(e,r={}){if(xio.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!KK(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"?mt([{"api-key":this.apiKey}]):super.authHeaders(e)}},xio=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"])});var dR=v(()=>{kxe();yet();pxe();kxe();Iu();nR();odr()});function RS(t){if(!t||typeof t!="object")return t;let e;return t.constructor.name===tR.name&&"message"in t&&typeof t.message=="string"?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===Ic.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=Toe(t,"INVALID_TOOL_RESULTS"):"status"in t&&t.status===401?e=Toe(t,"MODEL_AUTHENTICATION"):"status"in t&&t.status===429?e=Toe(t,"MODEL_RATE_LIMIT"):"status"in t&&t.status===404?e=Toe(t,"MODEL_NOT_FOUND"):e=t,e}var ak=v(()=>{qlr();dR()});function M1(t){return t?!!(/^o\d/.test(t??"")||t.startsWith("gpt-5")&&!t.startsWith("gpt-5-chat")):!1}function Oio(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 R8(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 I1(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(!nd.isInstance(t))throw new Error("Invalid generic chat message");return Oio(t);default:throw new Error(`Unknown message type: ${e}`)}}function idr(t){return t.includes("gpt-5.2-pro")}var P1,sk=v(()=>{Qa();P1=t=>t()});function fR(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 Wtt(t){return typeof Headers<"u"&&t!==null&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Headers]"}function adr(t){let e=P1(()=>{if(Wtt(t))return t;if(Array.isArray(t))return new Headers(t);if(typeof t=="object"&&t!==null&&"values"in t&&Wtt(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 sdr(){let t=cpe();return(t==="node"||t==="deno")&&(t=`(${t}/${process.version}; ${process.platform}; ${process.arch})`),t}function pR(t,e=!1,r="1.0.0"){let n=adr(t),o=sdr(),i=`langchainjs${e?"-azure":""}-openai`;return{...n,"User-Agent":n["User-Agent"]?`${i}/${r} (${o})${n["User-Agent"]}`:`${i}/${r} (${o})`}}var uk=v(()=>{sk();ku()});function udr(t,e){let r;return bg(t)?r=h1(t):r=t,e?.strict!==void 0&&(r.function.strict=e.strict),r}function Tio(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function ldr(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(cdr(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
|
||
`)}function cdr(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}: ${qxe(o,e)},`):r.push(`${n}?: ${qxe(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
|
||
`)}function qxe(t,e){if(Tio(t))return t.anyOf.map(r=>qxe(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["{",cdr(t,e+2),"}"].join(`
|
||
`);case"array":return t.items?`${qxe(t.items,e)}[]`:"any[]";default:return""}}function Uxe(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 A8(t){return"type"in t&&t.type!=="function"}function ddr(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 fdr(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function Y2(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 Bxe(t){return"type"in t&&t.type==="custom"&&"custom"in t&&typeof t.custom=="object"&&t.custom!==null}function pdr(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 mdr(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 hdr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="tool_call"&&"isComputerTool"in t&&t.isComputerTool===!0}function gdr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="tool_call"&&"isCustomTool"in t&&t.isCustomTool===!0}function ydr(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 bdr(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 N8=v(()=>{g1();Wv();nb()});var Ktt=v(()=>{Yg()});var Wxe={};Rn(Wxe,{ZodISODate:()=>Vxe,ZodISODateTime:()=>zxe,ZodISODuration:()=>Jxe,ZodISOTime:()=>Hxe,date:()=>Xtt,datetime:()=>Gtt,duration:()=>Ytt,time:()=>Ztt});function Gtt(t){return F4e(zxe,t)}function Xtt(t){return k4e(Vxe,t)}function Ztt(t){return q4e(Hxe,t)}function Ytt(t){return U4e(Jxe,t)}var zxe,Vxe,Hxe,Jxe,Kxe=v(()=>{Yg();Gxe();zxe=Se("ZodISODateTime",(t,e)=>{Uze.init(t,e),Wu.init(t,e)});Vxe=Se("ZodISODate",(t,e)=>{Bze.init(t,e),Wu.init(t,e)});Hxe=Se("ZodISOTime",(t,e)=>{zze.init(t,e),Wu.init(t,e)});Jxe=Se("ZodISODuration",(t,e)=>{Vze.init(t,e),Wu.init(t,e)})});var vdr,Pio,j8,Qtt=v(()=>{Yg();Yg();vdr=(t,e)=>{OQ.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>EQ(t,r)},flatten:{value:r=>TQ(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},Pio=Se("ZodError",vdr),j8=Se("ZodError",vdr,{Parent:Error})});var ert,trt,rrt,nrt,ort=v(()=>{Yg();Qtt();ert=xme(j8),trt=Ome(j8),rrt=Tme(j8),nrt=Eme(j8)});function irt(t){return D4e(Qoe,t)}function Iio(t){return Ume(urt,t)}function Rio(t){return $Q(Xxe,t)}function Aio(t){return Bme(R1,t)}function Nio(t){return zme(R1,t)}function jio(t){return Vme(R1,t)}function Dio(t){return Hme(R1,t)}function $io(t){return Jme(lrt,t)}function Lio(t){return Wme(crt,t)}function Fio(t){return Kme(drt,t)}function kio(t){return Gme(frt,t)}function qio(t){return Xme(prt,t)}function Uio(t){return Zme(mrt,t)}function Bio(t){return Yme(hrt,t)}function zio(t){return Qme(grt,t)}function Vio(t){return ehe(yrt,t)}function Hio(t){return the(brt,t)}function Jio(t){return rhe(_rt,t)}function Wio(t){return nhe(vrt,t)}function Kio(t){return ohe(wrt,t)}function Gio(t){return ihe(Srt,t)}function Xio(t){return ahe(Crt,t)}function Zio(t){return she(xrt,t)}function Yio(t,e,r={}){return _2e(wdr,t,e,r)}function Sdr(t){return B4e(eie,t)}function art(t){return V4e(D8,t)}function Qio(t){return H4e(D8,t)}function eao(t){return J4e(D8,t)}function tao(t){return W4e(D8,t)}function rao(t){return K4e(D8,t)}function Cdr(t){return G4e(tie,t)}function nao(t){return Z4e(rie,t)}function oao(t){return Q4e(Ort,t)}function iao(t){return e2e(Ort,t)}function aao(t){return t2e(xdr,t)}function sao(t){return r2e(Odr,t)}function Edr(t){return n2e(Tdr,t)}function uao(){return o2e(Pdr)}function Zxe(){return G$(Mdr)}function tOe(t){return LQ(Idr,t)}function lao(t){return i2e(Rdr,t)}function cao(t){return a2e(rOe,t)}function Trt(t,e){return XQ(Adr,t,e)}function dao(t){let e=t._zod.def.shape;return Bdr(Object.keys(e))}function fao(t,e){let r={type:"object",get shape(){return Mt.assignProp(this,"shape",{...t}),this.shape},...Mt.normalizeParams(e)};return new nOe(r)}function pao(t,e){return new nOe({type:"object",get shape(){return Mt.assignProp(this,"shape",{...t}),this.shape},catchall:tOe(),...Mt.normalizeParams(e)})}function mao(t,e){return new nOe({type:"object",get shape(){return Mt.assignProp(this,"shape",{...t}),this.shape},catchall:Zxe(),...Mt.normalizeParams(e)})}function oOe(t,e){return new Ert({type:"union",options:t,...Mt.normalizeParams(e)})}function hao(t,e,r){return new Ndr({type:"union",options:e,discriminator:t,...Mt.normalizeParams(r)})}function Ddr(t,e){return new jdr({type:"intersection",left:t,right:e})}function gao(t,e,r){let n=e instanceof no,o=n?r:e,i=n?e:null;return new $dr({type:"tuple",items:t,rest:i,...Mt.normalizeParams(o)})}function Ldr(t,e,r){return new Prt({type:"record",keyType:t,valueType:e,...Mt.normalizeParams(r)})}function yao(t,e,r){return new Prt({type:"record",keyType:oOe([t,tOe()]),valueType:e,...Mt.normalizeParams(r)})}function bao(t,e,r){return new Fdr({type:"map",keyType:t,valueType:e,...Mt.normalizeParams(r)})}function _ao(t,e){return new kdr({type:"set",valueType:t,...Mt.normalizeParams(e)})}function qdr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Yoe({type:"enum",entries:r,...Mt.normalizeParams(e)})}function vao(t,e){return new Yoe({type:"enum",entries:t,...Mt.normalizeParams(e)})}function Bdr(t,e){return new Udr({type:"literal",values:Array.isArray(t)?t:[t],...Mt.normalizeParams(e)})}function wao(t){return h2e(zdr,t)}function Irt(t){return new Mrt({type:"transform",transform:t})}function Yxe(t){return new Rrt({type:"optional",innerType:t})}function Qxe(t){return new Vdr({type:"nullable",innerType:t})}function Sao(t){return Yxe(Qxe(t))}function Jdr(t,e){return new Hdr({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function Kdr(t,e){return new Wdr({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function Gdr(t,e){return new Art({type:"nonoptional",innerType:t,...Mt.normalizeParams(e)})}function Cao(t){return new Xdr({type:"success",innerType:t})}function Ydr(t,e){return new Zdr({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function xao(t){return u2e(Qdr,t)}function eOe(t,e){return new Nrt({type:"pipe",in:t,out:e})}function tfr(t){return new efr({type:"readonly",innerType:t})}function Oao(t,e){return new rfr({type:"template_literal",parts:t,...Mt.normalizeParams(e)})}function ofr(t){return new nfr({type:"lazy",getter:t})}function Tao(t){return new ifr({type:"promise",innerType:t})}function afr(t){let e=new oc({check:"custom"});return e._zod.check=t,e}function Eao(t,e){return g2e(iOe,t??(()=>!0),e)}function sfr(t,e={}){return y2e(iOe,t,e)}function ufr(t){let e=afr(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Mt.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(Mt.issue(o))}},t(r.value,r)));return e}function Pao(t,e={error:`Input not instance of ${t.name}`}){let r=new iOe({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...Mt.normalizeParams(e)});return r._zod.bag.Class=t,r}function Iao(t){let e=ofr(()=>oOe([irt(t),Sdr(),Cdr(),Edr(),Trt(e),Ldr(irt(),e)]));return e}function Rao(t,e){return eOe(Irt(t),e)}var bi,srt,Qoe,Wu,urt,Xxe,R1,lrt,crt,drt,frt,prt,mrt,hrt,grt,yrt,brt,_rt,vrt,wrt,Srt,Crt,xrt,wdr,eie,D8,tie,rie,Ort,xdr,Odr,Tdr,Pdr,Mdr,Idr,Rdr,rOe,Adr,nOe,Ert,Ndr,jdr,$dr,Prt,Fdr,kdr,Yoe,Udr,zdr,Mrt,Rrt,Vdr,Hdr,Wdr,Art,Xdr,Zdr,Qdr,Nrt,efr,rfr,nfr,ifr,iOe,Mao,Gxe=v(()=>{Yg();Yg();Ktt();Kxe();ort();bi=Se("ZodType",(t,e)=>(no.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)=>nc(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>ert(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>rrt(t,r,n),t.parseAsync=async(r,n)=>trt(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>nrt(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(sfr(r,n)),t.superRefine=r=>t.check(ufr(r)),t.overwrite=r=>t.check(YA(r)),t.optional=()=>Yxe(t),t.nullable=()=>Qxe(t),t.nullish=()=>Yxe(Qxe(t)),t.nonoptional=r=>Gdr(t,r),t.array=()=>Trt(t),t.or=r=>oOe([t,r]),t.and=r=>Ddr(t,r),t.transform=r=>eOe(t,Irt(r)),t.default=r=>Jdr(t,r),t.prefault=r=>Kdr(t,r),t.catch=r=>Ydr(t,r),t.pipe=r=>eOe(t,r),t.readonly=()=>tfr(t),t.describe=r=>{let n=t.clone();return Ml.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ml.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ml.get(t);let n=t.clone();return Ml.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),srt=Se("_ZodString",(t,e)=>{tz.init(t,e),bi.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(kQ(...n)),t.includes=(...n)=>t.check(BQ(...n)),t.startsWith=(...n)=>t.check(zQ(...n)),t.endsWith=(...n)=>t.check(VQ(...n)),t.min=(...n)=>t.check(X$(...n)),t.max=(...n)=>t.check(pW(...n)),t.length=(...n)=>t.check(mW(...n)),t.nonempty=(...n)=>t.check(X$(1,...n)),t.lowercase=n=>t.check(qQ(n)),t.uppercase=n=>t.check(UQ(n)),t.trim=()=>t.check(WQ()),t.normalize=(...n)=>t.check(JQ(...n)),t.toLowerCase=()=>t.check(KQ()),t.toUpperCase=()=>t.check(GQ())}),Qoe=Se("ZodString",(t,e)=>{tz.init(t,e),srt.init(t,e),t.email=r=>t.check(Ume(urt,r)),t.url=r=>t.check(Jme(lrt,r)),t.jwt=r=>t.check(she(xrt,r)),t.emoji=r=>t.check(Wme(crt,r)),t.guid=r=>t.check($Q(Xxe,r)),t.uuid=r=>t.check(Bme(R1,r)),t.uuidv4=r=>t.check(zme(R1,r)),t.uuidv6=r=>t.check(Vme(R1,r)),t.uuidv7=r=>t.check(Hme(R1,r)),t.nanoid=r=>t.check(Kme(drt,r)),t.guid=r=>t.check($Q(Xxe,r)),t.cuid=r=>t.check(Gme(frt,r)),t.cuid2=r=>t.check(Xme(prt,r)),t.ulid=r=>t.check(Zme(mrt,r)),t.base64=r=>t.check(ohe(wrt,r)),t.base64url=r=>t.check(ihe(Srt,r)),t.xid=r=>t.check(Yme(hrt,r)),t.ksuid=r=>t.check(Qme(grt,r)),t.ipv4=r=>t.check(ehe(yrt,r)),t.ipv6=r=>t.check(the(brt,r)),t.cidrv4=r=>t.check(rhe(_rt,r)),t.cidrv6=r=>t.check(nhe(vrt,r)),t.e164=r=>t.check(ahe(Crt,r)),t.datetime=r=>t.check(Gtt(r)),t.date=r=>t.check(Xtt(r)),t.time=r=>t.check(Ztt(r)),t.duration=r=>t.check(Ytt(r))});Wu=Se("ZodStringFormat",(t,e)=>{Ou.init(t,e),srt.init(t,e)}),urt=Se("ZodEmail",(t,e)=>{Aze.init(t,e),Wu.init(t,e)});Xxe=Se("ZodGUID",(t,e)=>{Ize.init(t,e),Wu.init(t,e)});R1=Se("ZodUUID",(t,e)=>{Rze.init(t,e),Wu.init(t,e)});lrt=Se("ZodURL",(t,e)=>{Nze.init(t,e),Wu.init(t,e)});crt=Se("ZodEmoji",(t,e)=>{jze.init(t,e),Wu.init(t,e)});drt=Se("ZodNanoID",(t,e)=>{Dze.init(t,e),Wu.init(t,e)});frt=Se("ZodCUID",(t,e)=>{$ze.init(t,e),Wu.init(t,e)});prt=Se("ZodCUID2",(t,e)=>{Lze.init(t,e),Wu.init(t,e)});mrt=Se("ZodULID",(t,e)=>{Fze.init(t,e),Wu.init(t,e)});hrt=Se("ZodXID",(t,e)=>{kze.init(t,e),Wu.init(t,e)});grt=Se("ZodKSUID",(t,e)=>{qze.init(t,e),Wu.init(t,e)});yrt=Se("ZodIPv4",(t,e)=>{Hze.init(t,e),Wu.init(t,e)});brt=Se("ZodIPv6",(t,e)=>{Jze.init(t,e),Wu.init(t,e)});_rt=Se("ZodCIDRv4",(t,e)=>{Wze.init(t,e),Wu.init(t,e)});vrt=Se("ZodCIDRv6",(t,e)=>{Kze.init(t,e),Wu.init(t,e)});wrt=Se("ZodBase64",(t,e)=>{Xze.init(t,e),Wu.init(t,e)});Srt=Se("ZodBase64URL",(t,e)=>{Zze.init(t,e),Wu.init(t,e)});Crt=Se("ZodE164",(t,e)=>{Yze.init(t,e),Wu.init(t,e)});xrt=Se("ZodJWT",(t,e)=>{Qze.init(t,e),Wu.init(t,e)});wdr=Se("ZodCustomStringFormat",(t,e)=>{e4e.init(t,e),Wu.init(t,e)});eie=Se("ZodNumber",(t,e)=>{$me.init(t,e),bi.init(t,e),t.gt=(n,o)=>t.check(ZA(n,o)),t.gte=(n,o)=>t.check(Kb(n,o)),t.min=(n,o)=>t.check(Kb(n,o)),t.lt=(n,o)=>t.check(XA(n,o)),t.lte=(n,o)=>t.check(kw(n,o)),t.max=(n,o)=>t.check(kw(n,o)),t.int=n=>t.check(art(n)),t.safe=n=>t.check(art(n)),t.positive=n=>t.check(ZA(0,n)),t.nonnegative=n=>t.check(Kb(0,n)),t.negative=n=>t.check(XA(0,n)),t.nonpositive=n=>t.check(kw(0,n)),t.multipleOf=(n,o)=>t.check(nz(n,o)),t.step=(n,o)=>t.check(nz(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});D8=Se("ZodNumberFormat",(t,e)=>{t4e.init(t,e),eie.init(t,e)});tie=Se("ZodBoolean",(t,e)=>{MQ.init(t,e),bi.init(t,e)});rie=Se("ZodBigInt",(t,e)=>{Lme.init(t,e),bi.init(t,e),t.gte=(n,o)=>t.check(Kb(n,o)),t.min=(n,o)=>t.check(Kb(n,o)),t.gt=(n,o)=>t.check(ZA(n,o)),t.gte=(n,o)=>t.check(Kb(n,o)),t.min=(n,o)=>t.check(Kb(n,o)),t.lt=(n,o)=>t.check(XA(n,o)),t.lte=(n,o)=>t.check(kw(n,o)),t.max=(n,o)=>t.check(kw(n,o)),t.positive=n=>t.check(ZA(BigInt(0),n)),t.negative=n=>t.check(XA(BigInt(0),n)),t.nonpositive=n=>t.check(kw(BigInt(0),n)),t.nonnegative=n=>t.check(Kb(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(nz(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});Ort=Se("ZodBigIntFormat",(t,e)=>{r4e.init(t,e),rie.init(t,e)});xdr=Se("ZodSymbol",(t,e)=>{n4e.init(t,e),bi.init(t,e)});Odr=Se("ZodUndefined",(t,e)=>{o4e.init(t,e),bi.init(t,e)});Tdr=Se("ZodNull",(t,e)=>{i4e.init(t,e),bi.init(t,e)});Pdr=Se("ZodAny",(t,e)=>{a4e.init(t,e),bi.init(t,e)});Mdr=Se("ZodUnknown",(t,e)=>{K$.init(t,e),bi.init(t,e)});Idr=Se("ZodNever",(t,e)=>{IQ.init(t,e),bi.init(t,e)});Rdr=Se("ZodVoid",(t,e)=>{s4e.init(t,e),bi.init(t,e)});rOe=Se("ZodDate",(t,e)=>{u4e.init(t,e),bi.init(t,e),t.min=(n,o)=>t.check(Kb(n,o)),t.max=(n,o)=>t.check(kw(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});Adr=Se("ZodArray",(t,e)=>{RQ.init(t,e),bi.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(X$(r,n)),t.nonempty=r=>t.check(X$(1,r)),t.max=(r,n)=>t.check(pW(r,n)),t.length=(r,n)=>t.check(mW(r,n)),t.unwrap=()=>t.element});nOe=Se("ZodObject",(t,e)=>{l4e.init(t,e),bi.init(t,e),Mt.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>qdr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Zxe()}),t.loose=()=>t.clone({...t._zod.def,catchall:Zxe()}),t.strict=()=>t.clone({...t._zod.def,catchall:tOe()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>Mt.extend(t,r),t.merge=r=>Mt.merge(t,r),t.pick=r=>Mt.pick(t,r),t.omit=r=>Mt.omit(t,r),t.partial=(...r)=>Mt.partial(Rrt,t,r[0]),t.required=(...r)=>Mt.required(Art,t,r[0])});Ert=Se("ZodUnion",(t,e)=>{Fme.init(t,e),bi.init(t,e),t.options=e.options});Ndr=Se("ZodDiscriminatedUnion",(t,e)=>{Ert.init(t,e),c4e.init(t,e)});jdr=Se("ZodIntersection",(t,e)=>{d4e.init(t,e),bi.init(t,e)});$dr=Se("ZodTuple",(t,e)=>{rz.init(t,e),bi.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});Prt=Se("ZodRecord",(t,e)=>{f4e.init(t,e),bi.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});Fdr=Se("ZodMap",(t,e)=>{p4e.init(t,e),bi.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});kdr=Se("ZodSet",(t,e)=>{m4e.init(t,e),bi.init(t,e),t.min=(...r)=>t.check(oz(...r)),t.nonempty=r=>t.check(oz(1,r)),t.max=(...r)=>t.check(fW(...r)),t.size=(...r)=>t.check(FQ(...r))});Yoe=Se("ZodEnum",(t,e)=>{h4e.init(t,e),bi.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 Yoe({...e,checks:[],...Mt.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 Yoe({...e,checks:[],...Mt.normalizeParams(o),entries:i})}});Udr=Se("ZodLiteral",(t,e)=>{g4e.init(t,e),bi.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]}})});zdr=Se("ZodFile",(t,e)=>{y4e.init(t,e),bi.init(t,e),t.min=(r,n)=>t.check(oz(r,n)),t.max=(r,n)=>t.check(fW(r,n)),t.mime=(r,n)=>t.check(HQ(Array.isArray(r)?r:[r],n))});Mrt=Se("ZodTransform",(t,e)=>{AQ.init(t,e),bi.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=i=>{if(typeof i=="string")r.issues.push(Mt.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(Mt.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});Rrt=Se("ZodOptional",(t,e)=>{cW.init(t,e),bi.init(t,e),t.unwrap=()=>t._zod.def.innerType});Vdr=Se("ZodNullable",(t,e)=>{b4e.init(t,e),bi.init(t,e),t.unwrap=()=>t._zod.def.innerType});Hdr=Se("ZodDefault",(t,e)=>{_4e.init(t,e),bi.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});Wdr=Se("ZodPrefault",(t,e)=>{v4e.init(t,e),bi.init(t,e),t.unwrap=()=>t._zod.def.innerType});Art=Se("ZodNonOptional",(t,e)=>{w4e.init(t,e),bi.init(t,e),t.unwrap=()=>t._zod.def.innerType});Xdr=Se("ZodSuccess",(t,e)=>{S4e.init(t,e),bi.init(t,e),t.unwrap=()=>t._zod.def.innerType});Zdr=Se("ZodCatch",(t,e)=>{C4e.init(t,e),bi.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});Qdr=Se("ZodNaN",(t,e)=>{x4e.init(t,e),bi.init(t,e)});Nrt=Se("ZodPipe",(t,e)=>{NQ.init(t,e),bi.init(t,e),t.in=e.in,t.out=e.out});efr=Se("ZodReadonly",(t,e)=>{O4e.init(t,e),bi.init(t,e)});rfr=Se("ZodTemplateLiteral",(t,e)=>{T4e.init(t,e),bi.init(t,e)});nfr=Se("ZodLazy",(t,e)=>{P4e.init(t,e),bi.init(t,e),t.unwrap=()=>t._zod.def.getter()});ifr=Se("ZodPromise",(t,e)=>{E4e.init(t,e),bi.init(t,e),t.unwrap=()=>t._zod.def.innerType});iOe=Se("ZodCustom",(t,e)=>{M4e.init(t,e),bi.init(t,e)});Mao=(...t)=>b2e({Pipe:Nrt,Boolean:tie,String:Qoe,Transform:Mrt},...t)});function Nao(t){ad({customError:t})}function jao(){return ad().customError}var Aao,lfr=v(()=>{Yg();Aao={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 jrt={};Rn(jrt,{bigint:()=>Fao,boolean:()=>Lao,date:()=>kao,number:()=>$ao,string:()=>Dao});function Dao(t){return $4e(Qoe,t)}function $ao(t){return z4e(eie,t)}function Lao(t){return X4e(tie,t)}function Fao(t){return Y4e(rie,t)}function kao(t){return s2e(rOe,t)}var cfr=v(()=>{Yg();Gxe()});var Kt={};Rn(Kt,{$brand:()=>gBe,$input:()=>N4e,$output:()=>A4e,NEVER:()=>hBe,TimePrecision:()=>L4e,ZodAny:()=>Pdr,ZodArray:()=>Adr,ZodBase64:()=>wrt,ZodBase64URL:()=>Srt,ZodBigInt:()=>rie,ZodBigIntFormat:()=>Ort,ZodBoolean:()=>tie,ZodCIDRv4:()=>_rt,ZodCIDRv6:()=>vrt,ZodCUID:()=>frt,ZodCUID2:()=>prt,ZodCatch:()=>Zdr,ZodCustom:()=>iOe,ZodCustomStringFormat:()=>wdr,ZodDate:()=>rOe,ZodDefault:()=>Hdr,ZodDiscriminatedUnion:()=>Ndr,ZodE164:()=>Crt,ZodEmail:()=>urt,ZodEmoji:()=>crt,ZodEnum:()=>Yoe,ZodError:()=>Pio,ZodFile:()=>zdr,ZodGUID:()=>Xxe,ZodIPv4:()=>yrt,ZodIPv6:()=>brt,ZodISODate:()=>Vxe,ZodISODateTime:()=>zxe,ZodISODuration:()=>Jxe,ZodISOTime:()=>Hxe,ZodIntersection:()=>jdr,ZodIssueCode:()=>Aao,ZodJWT:()=>xrt,ZodKSUID:()=>grt,ZodLazy:()=>nfr,ZodLiteral:()=>Udr,ZodMap:()=>Fdr,ZodNaN:()=>Qdr,ZodNanoID:()=>drt,ZodNever:()=>Idr,ZodNonOptional:()=>Art,ZodNull:()=>Tdr,ZodNullable:()=>Vdr,ZodNumber:()=>eie,ZodNumberFormat:()=>D8,ZodObject:()=>nOe,ZodOptional:()=>Rrt,ZodPipe:()=>Nrt,ZodPrefault:()=>Wdr,ZodPromise:()=>ifr,ZodReadonly:()=>efr,ZodRealError:()=>j8,ZodRecord:()=>Prt,ZodSet:()=>kdr,ZodString:()=>Qoe,ZodStringFormat:()=>Wu,ZodSuccess:()=>Xdr,ZodSymbol:()=>xdr,ZodTemplateLiteral:()=>rfr,ZodTransform:()=>Mrt,ZodTuple:()=>$dr,ZodType:()=>bi,ZodULID:()=>mrt,ZodURL:()=>lrt,ZodUUID:()=>R1,ZodUndefined:()=>Odr,ZodUnion:()=>Ert,ZodUnknown:()=>Mdr,ZodVoid:()=>Rdr,ZodXID:()=>hrt,_ZodString:()=>srt,_default:()=>Jdr,any:()=>uao,array:()=>Trt,base64:()=>Kio,base64url:()=>Gio,bigint:()=>nao,boolean:()=>Cdr,catch:()=>Ydr,check:()=>afr,cidrv4:()=>Jio,cidrv6:()=>Wio,clone:()=>nc,coerce:()=>jrt,config:()=>ad,core:()=>QA,cuid:()=>kio,cuid2:()=>qio,custom:()=>Eao,date:()=>cao,discriminatedUnion:()=>hao,e164:()=>Xio,email:()=>Iio,emoji:()=>Lio,endsWith:()=>VQ,enum:()=>qdr,file:()=>wao,flattenError:()=>TQ,float32:()=>Qio,float64:()=>eao,formatError:()=>EQ,function:()=>w2e,getErrorMap:()=>jao,globalRegistry:()=>Ml,gt:()=>ZA,gte:()=>Kb,guid:()=>Rio,includes:()=>BQ,instanceof:()=>Pao,int:()=>art,int32:()=>tao,int64:()=>oao,intersection:()=>Ddr,ipv4:()=>Vio,ipv6:()=>Hio,iso:()=>Wxe,json:()=>Iao,jwt:()=>Zio,keyof:()=>dao,ksuid:()=>zio,lazy:()=>ofr,length:()=>mW,literal:()=>Bdr,locales:()=>DQ,looseObject:()=>mao,lowercase:()=>qQ,lt:()=>XA,lte:()=>kw,map:()=>bao,maxLength:()=>pW,maxSize:()=>fW,mime:()=>HQ,minLength:()=>X$,minSize:()=>oz,multipleOf:()=>nz,nan:()=>xao,nanoid:()=>Fio,nativeEnum:()=>vao,negative:()=>c2e,never:()=>tOe,nonnegative:()=>f2e,nonoptional:()=>Gdr,nonpositive:()=>d2e,normalize:()=>JQ,null:()=>Edr,nullable:()=>Qxe,nullish:()=>Sao,number:()=>Sdr,object:()=>fao,optional:()=>Yxe,overwrite:()=>YA,parse:()=>ert,parseAsync:()=>trt,partialRecord:()=>yao,pipe:()=>eOe,positive:()=>l2e,prefault:()=>Kdr,preprocess:()=>Rao,prettifyError:()=>MBe,promise:()=>Tao,property:()=>p2e,readonly:()=>tfr,record:()=>Ldr,refine:()=>sfr,regex:()=>kQ,regexes:()=>ez,registry:()=>qme,safeParse:()=>rrt,safeParseAsync:()=>nrt,set:()=>_ao,setErrorMap:()=>Nao,size:()=>FQ,startsWith:()=>zQ,strictObject:()=>pao,string:()=>irt,stringFormat:()=>Yio,stringbool:()=>Mao,success:()=>Cao,superRefine:()=>ufr,symbol:()=>aao,templateLiteral:()=>Oao,toJSONSchema:()=>Z$,toLowerCase:()=>KQ,toUpperCase:()=>GQ,transform:()=>Irt,treeifyError:()=>PBe,trim:()=>WQ,tuple:()=>gao,uint32:()=>rao,uint64:()=>iao,ulid:()=>Uio,undefined:()=>sao,union:()=>oOe,unknown:()=>Zxe,uppercase:()=>UQ,url:()=>$io,uuid:()=>Aio,uuidv4:()=>Nio,uuidv6:()=>jio,uuidv7:()=>Dio,void:()=>lao,xid:()=>Bio});var Drt=v(()=>{Yg();Gxe();Ktt();Qtt();ort();lfr();Yg();I4e();Yg();R4e();Kxe();Kxe();cfr();ad(kme())});var dfr=v(()=>{Drt();Drt()});var Q2=v(()=>{dfr()});var pfr,ffr,mfr,aOe=v(()=>{pfr=Symbol("Let zodToJsonSchema decide on which parser to use"),ffr={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"},mfr=t=>typeof t=="string"?{...ffr,basePath:["#"],definitions:{},name:t}:{...ffr,basePath:["#"],definitions:{},...t}});function hfr(t){if(!t)return!0;for(let e in t)return!1;return!0}var nie,$rt=v(()=>{nie=t=>"_def"in t?t._def:t});var gfr,Lrt=v(()=>{aOe();$rt();gfr=t=>{let e=mfr(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])=>[nie(o),{def:nie(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function Frt(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Hi(t,e,r,n,o){t[e]=r,Frt(t,e,n,o)}var lk=v(()=>{});function yfr(){return{}}var krt=v(()=>{});function bfr(t,e){let r={type:"array"};return t.type?._def?.typeName!==Ie.ZodAny&&(r.items=Tn(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Hi(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Hi(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Hi(r,"minItems",t.exactLength.value,t.exactLength.message,e),Hi(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var qrt=v(()=>{cO();lk();hd()});function _fr(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?Hi(r,"minimum",n.value,n.message,e):Hi(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Hi(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Hi(r,"maximum",n.value,n.message,e):Hi(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Hi(r,"maximum",n.value,n.message,e));break;case"multipleOf":Hi(r,"multipleOf",n.value,n.message,e);break}return r}var Urt=v(()=>{lk()});function vfr(){return{type:"boolean"}}var Brt=v(()=>{});function wfr(t,e){return Tn(t.type._def,e)}var zrt=v(()=>{hd()});var Sfr,Vrt=v(()=>{hd();Sfr=(t,e)=>Tn(t.innerType._def,e)});function Hrt(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>Hrt(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 Uao(t,e)}}var Uao,Jrt=v(()=>{lk();Uao=(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":Hi(r,"minimum",n.value,n.message,e);break;case"max":Hi(r,"maximum",n.value,n.message,e);break}return r}});function Cfr(t,e){return{...Tn(t.innerType._def,e),default:t.defaultValue()}}var Wrt=v(()=>{hd()});function xfr(t,e,r){return e.effectStrategy==="input"?Tn(t.schema._def,e,r):{}}var Krt=v(()=>{hd()});function Ofr(t){return{type:"string",enum:[...t.values]}}var Grt=v(()=>{});function Tfr(t,e){let r=[Tn(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Tn(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(Bao(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 Bao,Xrt=v(()=>{hd();Bao=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function Efr(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 Zrt=v(()=>{});function sOe(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?zao(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":Hi(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":Hi(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":LC(r,"email",o.message,e);break;case"format:idn-email":LC(r,"idn-email",o.message,e);break;case"pattern:zod":FC(r,eV.email,o.message,e);break}break;case"url":LC(r,"uri",o.message,e);break;case"uuid":LC(r,"uuid",o.message,e);break;case"regex":FC(r,o.regex,o.message,e);break;case"cuid":FC(r,eV.cuid,o.message,e);break;case"cuid2":FC(r,eV.cuid2,o.message,e);break;case"startsWith":FC(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":FC(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":LC(r,"date-time",o.message,e);break;case"date":LC(r,"date",o.message,e);break;case"time":LC(r,"time",o.message,e);break;case"duration":LC(r,"duration",o.message,e);break;case"length":Hi(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),Hi(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{FC(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&LC(r,"ipv4",o.message,e),o.version!=="v4"&&LC(r,"ipv6",o.message,e);break}case"emoji":FC(r,eV.emoji,o.message,e);break;case"ulid":{FC(r,eV.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{LC(r,"binary",o.message,e);break}case"contentEncoding:base64":{Hi(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{FC(r,eV.base64,o.message,e);break}}break}case"nanoid":FC(r,eV.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var Yrt,eV,zao,LC,FC,Pfr,uOe=v(()=>{lk();eV={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:()=>(Yrt===void 0&&(Yrt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Yrt),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}$/};zao=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),LC=(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}}})):Hi(t,"format",e,r,n)},FC=(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:Pfr(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Hi(t,"pattern",Pfr(e,n),r,n)},Pfr=(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 lOe(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===Ie.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:Tn(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:Tn(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===Ie.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(sOe(t.keyType._def,e)).reduce((o,[i,a])=>i==="type"?o:{...o,[i]:a},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===Ie.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}var cOe=v(()=>{cO();hd();uOe()});function Mfr(t,e){if(e.mapStrategy==="record")return lOe(t,e);let r=Tn(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=Tn(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 Qrt=v(()=>{hd();cOe()});function Ifr(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 ent=v(()=>{});function Rfr(){return{not:{}}}var tnt=v(()=>{});function Afr(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var rnt=v(()=>{});function jfr(t,e){if(e.target==="openApi3")return Nfr(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in oie&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=oie[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 Nfr(t,e)}var oie,Nfr,dOe=v(()=>{hd();oie={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};Nfr=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>Tn(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 Dfr(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:oie[t.innerType._def.typeName],nullable:!0}:{type:[oie[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=Tn(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=Tn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var nnt=v(()=>{hd();dOe()});function $fr(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",Frt(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Hi(r,"minimum",n.value,n.message,e):Hi(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Hi(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Hi(r,"maximum",n.value,n.message,e):Hi(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Hi(r,"maximum",n.value,n.message,e));break;case"multipleOf":Hi(r,"multipleOf",n.value,n.message,e);break}return r}var ont=v(()=>{lk()});function Vao(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":Tn(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":Tn(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function Lfr(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=Tn(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:Vao(t,e)};return r.required.length||delete r.required,r}var int=v(()=>{hd()});var Ffr,ant=v(()=>{hd();Ffr=(t,e)=>{if(e.propertyPath&&e.currentPath.slice(0,e.propertyPath.length).toString()===e.propertyPath.toString())return Tn(t.innerType._def,{...e,currentPath:e.currentPath});let r=Tn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var kfr,snt=v(()=>{hd();kfr=(t,e)=>{if(e.pipeStrategy==="input")return Tn(t.in._def,e);if(e.pipeStrategy==="output")return Tn(t.out._def,e);let r=Tn(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=Tn(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function qfr(t,e){return Tn(t.type._def,e)}var unt=v(()=>{hd()});function Ufr(t,e){let n={type:"array",uniqueItems:!0,items:Tn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Hi(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Hi(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var lnt=v(()=>{lk();hd()});function Bfr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>Tn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:Tn(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>Tn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var cnt=v(()=>{hd()});function zfr(){return{not:{}}}var dnt=v(()=>{});function Vfr(){return{}}var fnt=v(()=>{});var Hfr,pnt=v(()=>{hd();Hfr=(t,e)=>Tn(t.innerType._def,e)});function Tn(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==pfr)return a}if(n&&!r){let a=Hao(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=Wao(t,t.typeName,e,r);return i&&Kao(t,e,i),o.jsonSchema=i,i}var Hao,Jao,Wao,Kao,hd=v(()=>{cO();krt();qrt();Urt();Brt();zrt();Vrt();Jrt();Wrt();Krt();Grt();Xrt();Zrt();Qrt();ent();tnt();rnt();nnt();ont();int();ant();snt();unt();cOe();lnt();uOe();cnt();dnt();dOe();fnt();pnt();aOe();Hao=(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:Jao(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}},Jao=(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("/")},Wao=(t,e,r,n)=>{switch(e){case Ie.ZodString:return sOe(t,r);case Ie.ZodNumber:return $fr(t,r);case Ie.ZodObject:return Lfr(t,r);case Ie.ZodBigInt:return _fr(t,r);case Ie.ZodBoolean:return vfr();case Ie.ZodDate:return Hrt(t,r);case Ie.ZodUndefined:return zfr();case Ie.ZodNull:return Afr(r);case Ie.ZodArray:return bfr(t,r);case Ie.ZodUnion:case Ie.ZodDiscriminatedUnion:return jfr(t,r);case Ie.ZodIntersection:return Tfr(t,r);case Ie.ZodTuple:return Bfr(t,r);case Ie.ZodRecord:return lOe(t,r);case Ie.ZodLiteral:return Efr(t,r);case Ie.ZodEnum:return Ofr(t);case Ie.ZodNativeEnum:return Ifr(t);case Ie.ZodNullable:return Dfr(t,r);case Ie.ZodOptional:return Ffr(t,r);case Ie.ZodMap:return Mfr(t,r);case Ie.ZodSet:return Ufr(t,r);case Ie.ZodLazy:return Tn(t.getter()._def,r);case Ie.ZodPromise:return qfr(t,r);case Ie.ZodNaN:case Ie.ZodNever:return Rfr();case Ie.ZodEffects:return xfr(t,r,n);case Ie.ZodAny:return yfr();case Ie.ZodUnknown:return Vfr();case Ie.ZodDefault:return Cfr(t,r);case Ie.ZodBranded:return wfr(t,r);case Ie.ZodReadonly:return Hfr(t,r);case Ie.ZodCatch:return Sfr(t,r);case Ie.ZodPipeline:return kfr(t,r);case Ie.ZodFunction:case Ie.ZodVoid:case Ie.ZodSymbol:return;default:return(o=>{})(e)}},Kao=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var mnt,hnt=v(()=>{hd();Lrt();$rt();mnt=(t,e)=>{let r=gfr(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Tn(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(hfr(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]=Tn(nie(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 Jfr=v(()=>{aOe();Lrt();lk();hd();krt();qrt();Urt();Brt();zrt();Vrt();Jrt();Wrt();Krt();Grt();Xrt();Zrt();Qrt();ent();tnt();rnt();nnt();ont();int();ant();snt();unt();pnt();cOe();lnt();uOe();cnt();dnt();dOe();fnt();hnt();hnt()});function Wfr(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 A1(e,[],e)}function gnt(t){if(typeof t=="boolean")return!1;if(t.type==="null")return!0;for(let e of t.oneOf??[])if(gnt(e))return!0;for(let e of t.anyOf??[])if(gnt(e))return!0;return!1}function A1(t,e,r){if(typeof t=="boolean")throw new TypeError(`Expected object schema but got boolean; path=${e.join("/")}`);if(!tV(t))throw new TypeError(`Expected ${JSON.stringify(t)} to be an object; path=${e.join("/")}`);let n=t.$defs;if(tV(n))for(let[f,p]of Object.entries(n))A1(p,[...e,"$defs",f],r);let o=t.definitions;if(tV(o))for(let[f,p]of Object.entries(o))A1(p,[...e,"definitions",f],r);t.type==="object"&&!("additionalProperties"in t)&&(t.additionalProperties=!1);let a=t.required??[],s=t.properties;if(tV(s)){for(let[f,p]of Object.entries(s))if(!gnt(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,A1(p,[...e,"properties",f],r)]))}let u=t.items;tV(u)&&(t.items=A1(u,[...e,"items"],r));let l=t.anyOf;Array.isArray(l)&&(t.anyOf=l.map((f,p)=>A1(f,[...e,"anyOf",String(p)],r)));let c=t.allOf;if(Array.isArray(c))if(c.length===1){let f=A1(c[0],[...e,"allOf","0"],r);Object.assign(t,f),delete t.allOf}else t.allOf=c.map((f,p)=>A1(f,[...e,"allOf",String(p)],r));t.default===null&&delete t.default;let d=t.$ref;if(d&&Xao(t,1)){if(typeof d!="string")throw new TypeError(`Received non-string $ref - ${d}; path=${e.join("/")}`);let f=Gao(r,d);if(typeof f=="boolean")throw new Error(`Expected \`$ref: ${d}\` to resolve to an object schema but got boolean`);if(!tV(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,A1(t,e,r)}return t}function Gao(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(!tV(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 tV(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Xao(t,e){let r=0;for(let n in t)if(r++,r>e)return!0;return!1}var Kfr=v(()=>{});function Zao(t,e){return mnt(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function Yao(t){return Wfr(Z$(t,{target:"draft-7"}))}function Qao(t){return"_zod"in t}function Gfr(t,e,r){return Ccr({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:Qao(t)?Yao(t):Zao(t,{name:e})}},n=>t.parse(JSON.parse(n)))}var Xfr=v(()=>{Q2();YK();Jfr();Nxe();Kfr()});function Yfr(t,e){if(typeof e<"u"&&!Zfr.includes(e))throw new Error(`Invalid method: ${e}. Supported methods are: ${Zfr.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 eso(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function Qfr(t,e,r){if(ic(t))return Gfr(t,e,r);if(Tu(t))return eso({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:Ni(t,{cycles:"ref",reused:"ref",override(n){n.jsonSchema.title=e}})}},n=>aO(t,JSON.parse(n)));throw new Error("Unsupported schema response format")}function epr(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 Zfr,ynt=v(()=>{Wv();nb();Yg();Xfr();Zfr=["jsonSchema","functionCalling","jsonMode"]});var tso,tpr,rpr=v(()=>{tso={"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}},tpr=tso});function kC(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=AB(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new th([`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 ck(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 AS(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var bnt,qC,npr=v(()=>{RY();Rw();eN();TW();uL();CVe();bnt=class extends sL{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(Pl(n)&&n.tool_calls?.length?o=n.tool_calls.map(a=>{let{id:s,...u}=a;return this.returnId?{id:s,...u}:u}):n.additional_kwargs.tool_calls!==void 0&&(o=JSON.parse(JSON.stringify(n.additional_kwargs.tool_calls)).map(s=>kC(s,{returnId:this.returnId,partial:r}))),!o)return[];let i=[];for(let a of o)if(a!==void 0){let s={type:a.name,args:a.args,id:a.id};i.push(s)}return i}},qC=class extends bnt{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 Y$(this.zodSchema,e);if(r.success)return r.data;throw new th(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(r.error?.issues)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){let n=(await super.parsePartialResult(e)).filter(i=>i.type===this.keyName),o=n;if(n.length)return this.returnId||(o=n.map(i=>i.args)),this.returnSingle?o[0]:o}async parseResult(e){let n=(await super.parsePartialResult(e,!1)).filter(a=>a.type===this.keyName),o=n;return n.length?(this.returnId||(o=n.map(a=>a.args)),this.returnSingle?this._validateResult(o[0]):await Promise.all(o.map(a=>this._validateResult(a)))):void 0}}});var rso,$8=v(()=>{Bo();npr();rso={};Rt(rso,{JsonOutputKeyToolsParser:()=>qC,JsonOutputToolsParser:()=>bnt,convertLangChainToolCallToOpenAI:()=>ck,makeInvalidToolCall:()=>AS,parseToolCall:()=>kC})});var rV,iie=v(()=>{ak();N8();sk();uk();ynt();rpr();dR();Wv();nb();ku();YI();Jv();_v();fO();$8();rV=class extends md{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??vn("OPENAI_API_KEY"),this.organization=e?.configuration?.organization??vn("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(!M1(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&&Ya(e.json_schema.schema)?Qfr(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=fR(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,i.defaultHeaders=pR(i.defaultHeaders),this.client=new bn(i)}return{...this.clientConfig,...e}}_convertChatOpenAIToolToCompletionsTool(e,r){return Y2(e)?bdr(e.metadata.customTool):Hv(e)?r?.strict!==void 0?{...e,function:{...e.function,strict:r.strict}}:e:udr(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=>A8(o)||Y2(o)?o:ddr(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(I1(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=ldr(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 RS(a)}})}get profile(){return tpr[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=Yfr(this.model,r?.method);if(u==="jsonMode"){Ya(i)?o=Jw.fromZodSchema(i):o=new vv;let f=Ni(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:eL(i),schema:i,strict:r?.strict},p=Ni(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}}}),Ya(i)){let m=Jw.fromZodSchema(i);o=Yb.from(h=>"parsed"in h.additional_kwargs?h.additional_kwargs.parsed:m)}else o=new vv}else{let f=a??"extract";if(Ya(i)){let p=Ni(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 qC({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=Ni(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 qC({returnSingle:!0,keyName:f})}}if(!s)return n.pipe(o);let l=Eu.assign({parsed:(f,p)=>o.invoke(f.raw,p)}),c=Eu.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Rl.from([{raw:n},d])}}});var fOe,_nt,vnt,opr,ipr,aie,L8=v(()=>{sk();ynt();Qa();$8();fOe={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=zg({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=jY(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=jY(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=zg({dataUrl:t.url}),r=R8(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=R8(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`)}},_nt=({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(kC(l,{returnId:!0}))}catch(c){i.push(AS(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=epr(t.content||"",e.choices?.[0]?.message);return new eo({content:u,tool_calls:o,invalid_tool_calls:i,additional_kwargs:a,response_metadata:s,id:e.id})}default:return new nd(t.content||"",t.role??"unknown")}},vnt=({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 mv({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 Ir({content:i,tool_call_chunks:u,additional_kwargs:a,id:e.id,response_metadata:s})}else return o==="system"?new Wy({content:i,response_metadata:s}):o==="developer"?new Wy({content:i,response_metadata:s,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new pv({content:i,additional_kwargs:a,name:t.name,response_metadata:s}):o==="tool"?new Iw({content:i,additional_kwargs:a,tool_call_id:t.tool_call_id,response_metadata:s}):new fv({content:i,role:o,response_metadata:s})},opr=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=upe(()=>{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=R8(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}}}},ipr=({message:t,model:e})=>{let r=I1(t);if(r==="system"&&M1(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"&&Wg.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=opr(i);a&&(yield a)}}return{role:"user",content:Array.from(n(t.contentBlocks))}},aie=({messages:t,model:e})=>t.flatMap(r=>{if("output_version"in r.response_metadata&&r.response_metadata?.output_version==="v1")return ipr({message:r});let n=I1(r);n==="system"&&M1(e)&&(n="developer");let o=typeof r.content=="string"?r.content:r.content.map(a=>Ym(a)?Zx(a,fOe):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),eo.isInstance(r)&&r.tool_calls?.length?i.tool_calls=r.tool_calls.map(ck):(r.additional_kwargs.tool_calls!=null&&(i.tool_calls=r.additional_kwargs.tool_calls),Wg.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 dk,pOe=v(()=>{ak();N8();sk();iie();L8();Qa();id();dk=class extends rV{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:Uxe(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),M1(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=aie({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}:{}},Pl(h.message)&&(h.message.usage_metadata=n),h.message=new eo(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=aie({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 yi({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 yi({message:new Ir({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 RS(o)}})}_convertCompletionsDeltaToBaseMessageChunk(t,e,r){return vnt({delta:t,rawResponse:e,includeRawResponse:this.__includeRawResponse,defaultRole:r})}_convertCompletionsMessageToBaseMessage(t,e){return _nt({message:t,rawResponse:e,includeRawResponse:this.__includeRawResponse})}}});var mOe=v(()=>{uk();dR();ku()});var wnt=v(()=>{pOe();mOe()});var F8,Snt,hOe,dpr,Cnt,fpr,gOe,yOe=v(()=>{N8();sk();L8();Qa();id();$8();F8="__openai_function_call_ids__",Snt=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}},hOe=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(kC(u,{returnId:!0}))}catch(l){let c;typeof l=="object"&&l!=null&&"message"in l&&typeof l.message=="string"&&(c=l.message),o.push(AS(u,c))}a[F8]??(a[F8]={}),s.id&&(a[F8][s.call_id]=s.id)}else if(s.type==="reasoning")a.reasoning=s;else if(s.type==="custom_tool_call"){let u=pdr(s);u?n.push(u):o.push(AS(s,"Malformed custom tool call"))}else if(s.type==="computer_call"){let u=mdr(s);u?n.push(u):o.push(AS(s,"Malformed computer call"))}else a.tool_outputs??(a.tool_outputs=[]),a.tool_outputs.push(s);return new eo({id:e,content:r,tool_calls:n,invalid_tool_calls:o,usage_metadata:Snt(t.usage),additional_kwargs:a,response_metadata:i})},dpr=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}},Cnt=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[F8]={[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=hOe(t.response);n=Snt(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 yi({text:e.map(u=>u.text).join(""),message:new Ir({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})},fpr=t=>{let e=eo.isInstance(t)&&t.response_metadata?.model_provider==="openai";function*r(){let n=P1(()=>{try{let g=I1(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=P1(()=>{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=R8(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=P1(()=>{if(Array.isArray(g.summary)){let T=g.summary?.map(P=>P?.text).filter(P=>typeof P=="string")??[];if(T.length>0)return T}return g.reasoning?[g.reasoning]:[]}),_=b.length>0?b.map(O=>({type:"summary_text",text:O})):[{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())},gOe=({messages:t,zdrEnabled:e,model:r})=>t.flatMap(n=>{let o=n.response_metadata;if(o?.output_version==="v1")return fpr(n);let i=n.additional_kwargs,a=I1(n);if(a==="system"&&M1(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=dpr(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:P1(()=>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?.[F8];eo.isInstance(n)&&n.tool_calls?.length?s.push(...n.tool_calls.map(f=>gdr(f)?{type:"custom_tool_call",id:f.call_id,call_id:f.id??"",input:f.args.input,name:f.name}:hdr(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}),Ym(l))return Zx(l,fOe);if(l.type==="text")return{type:"input_text",text:l.text};if(l.type==="image_url"){let c=P1(()=>{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=P1(()=>{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 bOe,_Oe=v(()=>{ak();N8();iie();yOe();Jv();bOe=class extends rV{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:fdr(t?.tool_choice)?t?.tool_choice:(()=>{let o=Uxe(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:gOe({messages:t,zdrEnabled:this.zdrEnabled??!1,model:this.model}),...n,stream:!1},{signal:e?.signal,...e?.options});return{generations:[{text:o.output_text,message:hOe(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:gOe({messages:t,zdrEnabled:this.zdrEnabled??!1,model:this.model}),stream:!0},e);for await(let o of n){let i=Cnt(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 RS(n)}})}_reduceChatOpenAITools(t,e){let r=[];for(let n of t)if(A8(n))n.type==="image_generation"&&e?.stream&&(n.partial_images=1),r.push(n);else if(Y2(n)){let o=n.metadata.customTool;r.push({type:"custom",name:o.name,description:o.description,format:o.format})}else Hv(n)?r.push({type:"function",name:n.function.name,parameters:n.function.parameters,description:n.function.description,strict:e?.strict??null}):Bxe(n)&&r.push(ydr(n));return r}}});var xnt=v(()=>{mOe();_Oe()});var UC,Ont=v(()=>{N8();sk();iie();pOe();_Oe();UC=class ppr extends rV{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 bOe(r),this.completions=r?.completions??new dk(r)}get lc_serializable_keys(){return[...super.lc_serializable_keys,"useResponsesApi"]}get callKeys(){return[...super.callKeys,"useResponsesApi"]}_useResponsesApi(r){let n=r?.tools?.some(A8),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(Bxe)||r?.tools?.some(Y2);return this.useResponsesApi||n||o||i||idr(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 ppr(this.fields);return n.defaultOptions={...this.defaultOptions,...r},n}}});var mpr=v(()=>{mOe();wnt();xnt();Ont()});var Tnt=v(()=>{ak();uk();dR();id();ku();Jv();voe();zF()});var hpr=v(()=>{uk();Tnt();dR();ku()});var fk,Ent=v(()=>{ak();uk();dR();ku();zF();S2();fk=class extends PS{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??vn("OPENAI_API_KEY");this.organization=r?.configuration?.organization??vn("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=MS(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=fR(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,i.defaultHeaders=pR(i.defaultHeaders),this.client=new bn(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw RS(n)}})}}});var Pnt,gpr=v(()=>{ak();uk();Ent();dR();ku();Pnt=class extends fk{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)??vn("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??vn("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??vn("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??vn("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(vn("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||vn("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=fR(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=pR(s.defaultHeaders,!0,"2.0.0"),this.client=new Z2({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 RS(n)}})}}});function sie(t,e){let r=gW(e.schema),n=OW(e.schema);if(!e.schema||r||n)return new Rnt({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(a,s,u)=>new Promise((l,c)=>{let d=Js(u,{callbacks:s?.getChild()});eh.runWithConfig(Yy(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 ypr({...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(V$(u.signal))},u.signal.addEventListener("abort",d));let p=Js(u,{callbacks:s?.getChild()});eh.runWithConfig(Yy(p),async()=>{try{let m=await t(a,p);if(u?.signal?.aborted){f();return}f(),l(m)}catch(m){f(),c(m)}})})})}function lso(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!$Y(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new Wg({status:"success",content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new Wg({status:"success",content:cso(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function cso(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}var sso,Mnt,Int,Rnt,ypr,uso,nV=v(()=>{Bo();G3();Wfe();z$();HB();JB();rO();rW();eN();nb();Jv();uQe();cO();jhe();Q2();sso={};Rt(sso,{BaseToolkit:()=>uso,DynamicStructuredTool:()=>ypr,DynamicTool:()=>Rnt,StructuredTool:()=>Mnt,Tool:()=>Int,ToolInputParsingException:()=>H3,isLangChainTool:()=>bg,isRunnableToolLike:()=>yoe,isStructuredTool:()=>goe,isStructuredToolParams:()=>boe,tool:()=>sie});Mnt=class extends jK{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=Qo(WB(this.defaultConfig,r));return F$(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=F$(e)?e.args:e,i;if(Ya(this.schema))try{i=await Q$(this.schema,o)}catch(m){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
|
||
Details: ${m.message}`),phe(m)&&(h=`${h}
|
||
|
||
${Kt.prettifyError(m)}`),new H3(h,JSON.stringify(e))}else{let m=qu(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 H3(h,JSON.stringify(e))}i=o}let a=JA(r),u=await rc.configure(a.callbacks,this.callbacks,a.tags||n,this.tags,a.metadata,this.metadata,{verbose:this.verbose})?.handleToolStart(this.toJSON(),typeof e=="string"?e:JSON.stringify(e),a.runId,void 0,void 0,void 0,a.runName);delete a.runId;let l;try{l=await this._call(i,u,a)}catch(m){throw await u?.handleToolError(m),m}let c,d;if(this.responseFormat==="content_and_artifact")if(Array.isArray(l)&&l.length===2)[c,d]=l;else throw new Error(`Tool response format is "content_and_artifact" but the output was not a two-tuple.
|
||
Result: ${JSON.stringify(l)}`);else c=l;let f;F$(e)&&(f=e.id),!f&&tSt(a)&&(f=a.toolCall.id);let p=lso({content:c,artifact:d,toolCallId:f,name:this.name,metadata:this.metadata});return await u?.handleToolEnd(p),p}},Int=class extends Mnt{constructor(e){super(e);x(this,"schema",Ct.object({input:Ct.string().optional()}).transform(e=>e.input))}call(e,r){let n=typeof e=="string"||e==null?{input:e}:e;return super.call(n,r)}},Rnt=class extends Int{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=JA(r);return n.runName===void 0&&(n.runName=this.name),super.call(e,n)}async _call(e,r,n){return this.func(e,r,n)}},ypr=class extends Mnt{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=JA(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)}},uso=class{getTools(){return this.tools}}});var Ant=v(()=>{dR();ku();nV()});var bpr=v(()=>{});var _pr=v(()=>{});var vpr=v(()=>{});var wpr=v(()=>{});var Spr=v(()=>{});var dso,fso,pso,mso,hso,gso,yso,bso,_so,vso,gFa,Cpr=v(()=>{Qa();nV();Q2();dso=Kt.object({type:Kt.literal("screenshot")}),fso=Kt.object({type:Kt.literal("click"),x:Kt.number(),y:Kt.number(),button:Kt.enum(["left","right","wheel","back","forward"]).default("left")}),pso=Kt.object({type:Kt.literal("double_click"),x:Kt.number(),y:Kt.number(),button:Kt.enum(["left","right","wheel","back","forward"]).default("left")}),mso=Kt.object({type:Kt.literal("drag"),path:Kt.array(Kt.object({x:Kt.number(),y:Kt.number()}))}),hso=Kt.object({type:Kt.literal("keypress"),keys:Kt.array(Kt.string())}),gso=Kt.object({type:Kt.literal("move"),x:Kt.number(),y:Kt.number()}),yso=Kt.object({type:Kt.literal("scroll"),x:Kt.number(),y:Kt.number(),scroll_x:Kt.number(),scroll_y:Kt.number()}),bso=Kt.object({type:Kt.literal("type"),text:Kt.string()}),_so=Kt.object({type:Kt.literal("wait"),duration:Kt.number().optional()}),vso=Kt.discriminatedUnion("type",[dso,fso,pso,mso,hso,gso,yso,bso,_so]),gFa=Kt.object({action:vso})});var wso,vFa,xpr=v(()=>{nV();Q2();wso=Kt.object({type:Kt.literal("exec"),command:Kt.array(Kt.string()),env:Kt.record(Kt.string(),Kt.string()).optional(),working_directory:Kt.string().optional(),timeout_ms:Kt.number().optional(),user:Kt.string().optional()}),vFa=Kt.discriminatedUnion("type",[wso])});var xFa,Opr=v(()=>{nV();Q2();xFa=Kt.object({commands:Kt.array(Kt.string()).describe("Array of shell commands to execute"),timeout_ms:Kt.number().optional().describe("Optional timeout in milliseconds for the commands"),max_output_length:Kt.number().optional().describe("Optional maximum number of characters to return from each command")})});var Sso,Cso,xso,PFa,Tpr=v(()=>{nV();Q2();Sso=Kt.object({type:Kt.literal("create_file"),path:Kt.string(),diff:Kt.string()}),Cso=Kt.object({type:Kt.literal("update_file"),path:Kt.string(),diff:Kt.string()}),xso=Kt.object({type:Kt.literal("delete_file"),path:Kt.string()}),PFa=Kt.discriminatedUnion("type",[Sso,Cso,xso])});var Epr=v(()=>{Ant();bpr();_pr();vpr();wpr();Spr();Cpr();xpr();Opr();Tpr()});var Ppr=v(()=>{_v();nV();JB()});var Mpr=v(()=>{L8()});var Ipr=v(()=>{L8();yOe()});var oV=v(()=>{ak();sk();uk();iie();L8();pOe();wnt();yOe();_Oe();xnt();Ont();mpr();Tnt();hpr();Ent();gpr();Ant();Epr();Ppr();Mpr();Ipr();dR()});var Apr=S((Jka,Rpr)=>{Rpr.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 Oso,Tso,Npr,jpr=v(()=>{Oso=L(Apr(),1),Tso=Object.defineProperty,Npr=(t,e)=>{for(var r in e)Tso(t,r,{get:e[r],enumerable:!0})}});var Eso,Nnt,Dpr=v(()=>{jpr();ku();S2();zF();Eso={};Npr(Eso,{JinaEmbeddings:()=>Nnt});Nnt=class extends PS{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||vn("JINA_API_KEY")||vn("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=MS(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 vOe,$pr=v(()=>{Dpr();vOe=class extends Nnt{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}}});var iV,Lpr=v(()=>{oV();iV=class extends fk{constructor(e){super(e),this.customConfig=e}async embedQuery(e){return(await this.callEmbeddingAPI([e]))[0]}async embedDocuments(e){return await this.callEmbeddingAPI(e)}async callEmbeddingAPI(e){let r={model:this.customConfig.modelName,input:e,encoding_format:"float"},o=`${this.customConfig.configuration?.baseURL||"https://api.openai.com/v1"}/embeddings`,i=this.customConfig.apiKey,s=await(this.customConfig.configuration?.fetch||fetch)(o,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok){let l=await s.text();throw new Error(`Embedding API request failed: ${s.status} ${s.statusText} - ${l}`)}let u=await s.json();if(!u.data||!Array.isArray(u.data))throw new Error("Invalid API response format: missing or invalid data array");return u.data.map(l=>{if(!l.embedding||!Array.isArray(l.embedding))throw new Error("Invalid API response format: missing or invalid embedding array");return l.embedding})}}});var wOe,Pso,gd,aV=v(()=>{Or();hN();Xw();ot();Zt();gQe();MQe();VQe();oV();wOe=require("obsidian");mR();$pr();Lpr();Pso={"copilot-plus":iV,"copilot-plus-jina":vOe,openai:fk,cohereai:hQe,google:PQe,"azure openai":Pnt,ollama:zQe,"lm-studio":iV,"3rd party (openai-format)":fk,siliconflow:iV,openrouterai:iV},gd=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>ae().plusLicenseKey,"copilot-plus-jina":()=>ae().plusLicenseKey,openai:()=>ae().openAIApiKey,cohereai:()=>ae().cohereApiKey,google:()=>ae().googleApiKey,"azure openai":()=>ae().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key",siliconflow:()=>ae().siliconflowApiKey,openrouterai:()=>ae().openRouterAiApiKey};this.initialize(),al(()=>this.initialize())}initialize(){let e=ae().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=Pso[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(gO).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=oo(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=oo(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=ae();if(!t.modelMap.hasOwnProperty(e))throw new Ao(`No embedding model found for: ${e}`);let r=this.getCustomModel(e);if(r.plusExclusive&&!ae().isPlusUser)throw new wOe.Notice("Plus-only model, please consider upgrading to Plus to access it."),new Ao("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await pc.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new wOe.Notice("Believer-only model, please consider upgrading to Believer to access it."),new Ao("Believer-only model selected but user is not on Believer plan")}let n=t.modelMap[e];if(!n.hasApiKey)throw new Ao(`API key is not provided for the embedding model: ${e}`);let o=await this.getEmbeddingConfig(r);try{return t.embeddingModel=new n.EmbeddingConstructor(o),t.embeddingModel}catch(i){throw new Ao(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=ae(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await Do(r.plusLicenseKey),timeout:1e4,batchSize:ae().embeddingBatchSize,configuration:{baseURL:fN,fetch:e.enableCors?Nl:void 0}},"copilot-plus-jina":{model:n,apiKey:await Do(r.plusLicenseKey),timeout:1e4,batchSize:ae().embeddingBatchSize,dimensions:e.dimensions,baseUrl:fN+"/embeddings",configuration:{fetch:e.enableCors?Nl:void 0}},openai:{modelName:n,apiKey:await Do(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:ae().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Nl:void 0}},cohereai:{model:n,apiKey:await Do(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await Do(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await Do(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 Do(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await Do(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Nl:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await Do(e.apiKey||""),batchSize:ae().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Nl:void 0,dangerouslyAllowBrowser:!0}},siliconflow:{modelName:n,apiKey:await Do(e.apiKey||r.siliconflowApiKey),batchSize:ae().embeddingBatchSize,configuration:{baseURL:e.baseUrl||rC.siliconflow.host,fetch:e.enableCors?Nl:void 0}},openrouterai:{modelName:n,apiKey:await Do(e.apiKey||r.openRouterAiApiKey),batchSize:ae().embeddingBatchSize,configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?Nl: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 wOe.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: `+Sn(n)+`
|
||
with CORS Error: `+Sn(o);throw new Error(i)}}}}});function qpr(t){return t!==void 0&&uie.includes(t)?Fpr[t]:void 0}var Fpr,kpr,uie,SOe=v(()=>{Fpr={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"},kpr={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},uie=Object.keys(Fpr)});function Ru(t,e){if(e.length<jnt)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=jnt)Array.prototype.push.apply(t,e.slice(n,n+jnt))}}function Hpr(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 Rso(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Aso(){return typeof process<"u"&&process.release&&process.release.name==="node"}function Vpr(){return BigInt(Math.floor(performance.now()*1e6))}function sV(t){return typeof t=="number"&&(t=BigInt(t)),t<Upr?`${t}ns`:t<Bpr?`${t/Upr}\u03BCs`:t<zpr?`${t/Bpr}ms`:`${t/zpr}s`}function BC(){return Rso()?Vpr():Aso()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?Vpr():BigInt(0)}function lie(){return`${Mso}-${Iso++}`}function k8(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 Jpr(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function q8(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 COe(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 U8(t,e){return COe(t,[e])[e]}function Dnt(t,e){let r=Nso[e];if(r===void 0)throw new Error(Fr("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function xOe(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 yd(t){return t?.constructor?.name==="AsyncFunction"}var Mso,Iso,Upr,Bpr,zpr,jnt,Nso,Gc=v(()=>{bh();Mso=Date.now().toString().slice(5),Iso=0,Upr=BigInt(1e3),Bpr=BigInt(1e6),zpr=BigInt(1e9),jnt=65535;Nso={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function Fr(t,...e){let r=new Error(Hpr(Dso[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}var jso,Dso,bh=v(()=>{SOe();Gc();jso=uie.join(`
|
||
- `),Dso={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:
|
||
- ${jso}`,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 Wpr(t){return{raw:Number(t),formatted:sV(t)}}function Kpr(t){if(t.id){if(typeof t.id!="string")throw Fr("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return lie()}function $nt(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(N1(n)){let i=Fnt(n);if(!Array.isArray(o)||o.length!==i)throw Fr("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(B8(n)){if(!Array.isArray(o))return r;let i=Lnt(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=$nt(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}function Gpr(t){return t==="geopoint"}function N1(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function B8(t){return typeof t=="string"&&$so[t]}function Lnt(t){return Lso[t]}function Fnt(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw Fr("INVALID_VECTOR_VALUE",t);case e<=0:throw Fr("INVALID_VECTOR_SIZE",t);default:return e}}var $so,Lso,cie=v(()=>{bh();Gc();Gc();$so={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},Lso={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function Xpr(){return{idToInternalId:new Map,internalIdToId:[],save:Fso,load:kso}}function Fso(t){return{internalIdToId:t.internalIdToId}}function kso(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 iu(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?iu(t,e.toString()):e}function NS(t,e){if(t.internalIdToId.length<e)throw new Error(`Invalid internalId ${e}`);return t.internalIdToId[e-1]}var jS=v(()=>{});function Uso(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function Bso(t,e){let r=iu(t.sharedInternalDocumentStore,e);return t.docs[r]}function zso(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=iu(t.sharedInternalDocumentStore,e[o]);n[o]=t.docs[i]}return n}function Vso(t){return t.docs}function Hso(t,e,r){let n=iu(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function Jso(t,e){let r=iu(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function Wso(t){return t.count}function Kso(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function Gso(t){return{docs:t.docs,count:t.count}}function Zpr(){return{create:Uso,get:Bso,getMultiple:zso,getAll:Vso,store:Hso,remove:Jso,count:Wso,load:Kso,save:Gso}}var knt=v(()=>{jS()});function Qpr(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),Fr("PLUGIN_CRASHED")}return r}var Ypr,emr=v(()=>{bh();Ypr=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function zC(t,e,r,n){if(t.some(yd))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function uV(t,e,r){if(t.some(yd))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function z8(t,e,r,n,o){if(t.some(yd))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function V8(t,e,r,n){if(t.some(yd))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function rmr(t,e){if(t.some(yd))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}var tmr,qnt,pk=v(()=>{Gc();tmr=["tokenizer","index","documentsStore","sorter"],qnt=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function Unt(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(DS(t.l),DS(t.r))+1,e.h=Math.max(DS(e.l),DS(e.r))+1,e}function Bnt(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(DS(t.l),DS(t.r))+1,e.h=Math.max(DS(e.l),DS(e.r))+1,e}function omr(t,e,r){let n=[];function o(i){i!==null&&(e<i.k&&o(i.l),i.k>=e&&i.k<=r&&Ru(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function znt(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&&Ru(n,i.v),!r&&i.k>e&&Ru(n,i.v),o.push(i.r),o.push(i.l))}return n}function Vnt(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&&Ru(n,i.v),!r&&i.k<e&&Ru(n,i.v),o.push(i.r),o.push(i.l))}return n}function imr(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 amr(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function smr(t,e,r,n=500){function o(i,a,s){if(i===null)return nmr++,{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 nmr%n===0?Zso(i,a):i}t.root=o(t.root,e,r)}function Zso(t,e){t.h=1+Math.max(DS(t.l),DS(t.r));let r=DS(t.l)-DS(t.r);return r>1&&e<t.l.k?Bnt(t):r<-1&&e>t.r.k?Unt(t):r>1&&e>t.l.k?(t.l=Unt(t.l),Bnt(t)):r<-1&&e<t.r.k?(t.r=Bnt(t.r),Unt(t)):t}function DS(t){return t!==null?t.h:-1}function umr(t,e){let r=imr(t.root,e);return r===null?null:r.v}function Yso(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 lmr(t,e,r){let n=imr(t.root,r);if(n){if(n.v.length===1){Yso(t,r);return}n.v.splice(n.v.indexOf(e),1)}}var nmr,cmr=v(()=>{Gc();nmr=0});function dmr(){return{numberToDocumentId:new Map}}function fmr(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function pmr(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 mmr(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&&Ru(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&&Ru(i,u)}return i}}throw new Error("Invalid operation")}function hmr(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 q8(i)}}throw new Error("Invalid operation")}var gmr=v(()=>{Gc()});function Qso(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 Hnt(t,e,r){let n=Qso(t,e,r);return{distance:n,isBounded:n>=0}}var Jnt=v(()=>{});function H8(t,e){t.w=e.w+t.s}function OOe(t,e){t.d.push(e)}function euo(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function Knt(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(k8(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&Hnt(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),k8(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))Knt(t.c[i],e,r,n,o);return e}function ymr(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 lV(t=!1,e="",r=""){return new Wnt(r,e,t)}function bmr(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=ymr(u,a),d=c.length;if(u===a){OOe(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=lV(!0,a,i);p.c[f]=s;let m=p.c[f];m.s=u.substring(d),m.k=f,t.c[i]=p,H8(p,t),H8(m,p),OOe(p,r);return}if(d<l&&d<a.length){let p=lV(!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=lV(!0,e.substring(o+d),h);OOe(y,r),p.c[h]=y,H8(p,t),H8(y,p),H8(m,p);return}o+=l-1,t=s}else{let u=lV(!0,a,i);OOe(u,r),t.c[i]=u,H8(u,t);return}}}function die(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){Knt(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(Hnt(e,a,o).isBounded&&(i[a]=[]),k8(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&&die(t.c[e[r]],e,r+1,n,o,i),die(t,e,r+1,n-1,o,i);for(let a in t.c)die(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&die(t.c[a],e,r+1,n-1,o,i)}}}function Gnt(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,die(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=ymr(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 Knt(t,i,e,r,n),i}}function _mr(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||euo(t,r)}else return!1}return!0}var Wnt,vmr=v(()=>{Jnt();Gc();Wnt=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 wmr(){return{root:null}}function Smr(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 Cmr(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 xmr(t,e,r,n=!0,o="asc",i=!1){let a=i?Emr:Tmr,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 Omr(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=ruo(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=tuo(e);if(n){let u=o?Emr:Tmr;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 tuo(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 ruo(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 Tmr(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 Emr(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,O,T;do{let k=Math.sin(h),V=Math.cos(h);w=Math.sqrt(m*k*(m*k)+(f*p-d*m*V)*(f*p-d*m*V)),O=d*p+f*m*V,T=Math.atan2(w,O),b=f*m*k/w,_=1-b*b;let q=O-2*d*p/_,J=n/16*_*(4+n*(4-3*_));y=h,h=u+(1-J)*n*b*(T+J*w*(q+J*O*(-1+2*q*q)))}while(Math.abs(h-y)>1e-12&&--g>0);let P=_*(6378137*6378137-o*o)/(o*o),M=1+P/16384*(4096+P*(-768+P*(320-175*P))),I=P/1024*(256+P*(-128+P*(74-47*P))),j=I*w*(O-2*d*p/_+I/4*(O*(-1+2*w*w)-I/6*T*(-3+4*w*w)*(-3+4*T*T)));return o*M*(T-j)}var Pmr=v(()=>{});function TOe(t,e,r=0,n){if(e===0)throw Fr("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],O=w*e,T=o.get(_)?.[0];T!==void 0?o.set(_,[T*1.5+O,(o?.get(_)?.[1]||0)+1]):o.set(_,[O,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 Xnt(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 fie=v(()=>{bh()});function Znt(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function EOe(t,e,r,n=.8){let o=Znt(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 POe=v(()=>{});function nuo(t,e,r,n,o){let i=iu(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 ouo(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=iu(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 iuo(t,e,r,n){let o=iu(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 auo(t,e,r){t.tokenOccurrences[e][r]--}function suo(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=iu(e.sharedInternalDocumentStore,i[p]),h=l?.[m]?.[n]??0,y=Xnt(h,c,t.docsCount,s[m],a,t.params.relevance);d.push([m,y])}return d}function Imr(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)){Imr(t,e,a,n,s);continue}if(N1(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:Fnt(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:amr(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:lV(),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:dmr(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:wmr(),isArray:u};break;default:throw Fr("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function uuo(t,e,r,n,o,i,a,s){return u=>{let l=iu(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;smr(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),bmr(d,p,l);break}case"Flat":{fmr(d,u,l);break}case"BKD":{Smr(d,u,[l]);break}}}}function luo(t,e,r,n,o,i,a,s,u,l){if(N1(i))return cuo(e,r,o,n);let c=uuo(t,e,r,n,a,s,u,l);if(!B8(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function cuo(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=Znt(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function Mmr(t,e,r,n,o,i,a,s,u){let l=iu(e.sharedInternalDocumentStore,n);if(N1(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return lmr(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),_mr(d,p,l);return!0}case"Flat":return pmr(d,l,o),!0;case"BKD":return Cmr(d,o,l),!1}}function duo(t,e,r,n,o,i,a,s,u){if(!B8(i))return Mmr(t,e,r,n,o,i,a,s,u);let l=Lnt(i),c=o,d=c.length;for(let f=0;f<d;f++)Mmr(t,e,r,n,c[f],l,a,s,u);return!0}function fuo(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw Fr("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=Gnt(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(k8(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function puo(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 Fr("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];Ru(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=Dnt(f,m),b=xmr(s.root,p,g,h,void 0,y);Ru(o[i],b.flatMap(({docIDs:_})=>_))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=a[d],h=Omr(s.root,f,p,void 0,m);Ru(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=Gnt(s,{term:p,exact:!0});Ru(o[i],Object.values(m).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw Fr("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?hmr:mmr;Ru(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=znt(s,f,!1);break}case"gte":{p=znt(s,f,!0);break}case"lt":{p=Vnt(s,f,!1);break}case"lte":{p=Vnt(s,f,!0);break}case"eq":{p=umr(s,f)??[];break}case"between":{let[m,h]=f;p=omr(s,m,h);break}}Ru(o[i],p)}}return q8(Object.values(o))}function muo(t){return t.searchableProperties}function huo(t){return t.searchablePropertiesWithTypes}function Rmr(t){let e=lV(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]=Rmr(t.c[r]);return e}function guo(t){return{numberToDocumentId:new Map(t)}}function yuo(t){return Array.from(t.numberToDocumentId.entries())}function buo(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:Rmr(p),isArray:h};break;case"Flat":c[f]={type:"Flat",node:guo(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 _uo(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:yuo(p),isArray:m}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function Amr(){return{create:Imr,insert:luo,remove:duo,insertDocumentScoreParameters:nuo,insertTokenScoreParameters:ouo,removeDocumentScoreParameters:iuo,removeTokenScoreParameters:auo,calculateResultScores:suo,search:fuo,searchByWhereClause:puo,getSearchableProperties:muo,getSearchablePropertiesWithTypes:huo,load:buo,save:_uo}}var Ynt=v(()=>{bh();cmr();gmr();vmr();Pmr();Gc();fie();POe();cie();jS()});function Nmr(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=Nmr(t,e,s,n,u);Ru(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!N1(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 Fr("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function wuo(t,e,r,n){return n?.enabled!==!1?Nmr(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function Suo(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=iu(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&Qnt(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function jmr(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)Tuo(t,r);t.isSorted=!0}function Cuo(t,e,r){return e[1].localeCompare(r[1],qpr(t))}function xuo(t,e){return t[1]-e[1]}function Ouo(t,e){return e[1]?-1:1}function Tuo(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=Cuo.bind(null,t.language);break;case"number":n=xuo.bind(null);break;case"boolean":n=Ouo.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 Euo(t){let e=Object.keys(t.sorts);for(let r of e)Qnt(t,r)}function Qnt(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 Puo(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=iu(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function Muo(t,e,r){if(!t.enabled)throw Fr("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw Fr("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return Qnt(t,n),jmr(t),e.sort((a,s)=>{let u=i.docs.get(iu(t.sharedInternalDocumentStore,a[0])),l=i.docs.get(iu(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 Iuo(t){return t.enabled?t.sortableProperties:[]}function Ruo(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function Auo(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 Nuo(t){if(!t.enabled)return{enabled:!1};Euo(t),jmr(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 Dmr(){return{create:wuo,insert:Suo,remove:Puo,save:Nuo,load:Auo,sortBy:Muo,getSortableProperties:Iuo,getSortablePropertiesWithTypes:Ruo}}var eot=v(()=>{bh();cie();jS();Gc();SOe()});function $uo(t){return t<192||t>383?t:Duo[t-192]||t}function $mr(t){let e=[];for(let r=0;r<t.length;r++)e[r]=$uo(t.charCodeAt(r));return String.fromCharCode(...e)}var Duo,Lmr=v(()=>{Duo=[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 kmr(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(tot),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(Fmr),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+hR+IOe+"[^aeiouwxy]$"),o.test(t)?t=t+"e":i.test(t)?(n=/.$/,t=t.replace(n,"")):a.test(t)&&(t=t+"e")));if(n=/^(.+?)y$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(Fmr),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(tot),e&&n.test(e)&&(t=e+Luo[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(tot),e&&n.test(e)&&(t=e+Fuo[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(MOe),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(MOe),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(MOe),o=new RegExp(quo),i=new RegExp("^"+hR+IOe+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(MOe),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}var Luo,Fuo,kuo,IOe,hR,pie,tot,quo,MOe,Fmr,qmr=v(()=>{Luo={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"},Fuo={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},kuo="[^aeiou]",IOe="[aeiouy]",hR=kuo+"[^aeiouy]*",pie=IOe+"[aeiou]*",tot="^("+hR+")?"+pie+hR,quo="^("+hR+")?"+pie+hR+"("+pie+")?$",MOe="^("+hR+")?"+pie+hR+pie+hR,Fmr="^("+hR+")?"+IOe});function rot(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=$mr(e),this.normalizationCache.set(r,e),e)}function Uuo(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function Umr(t,e,r){if(e&&e!==this.language)throw Fr("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=kpr[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=Uuo(n);return this.allowDuplicates?o:Array.from(new Set(o))}function not(t={}){if(!t.language)t.language="english";else if(!uie.includes(t.language))throw Fr("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw Fr("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=kmr;else throw Fr("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 Fr("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw Fr("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw Fr("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:Umr,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:rot,normalizationCache:new Map};return n.tokenize=Umr.bind(n),n.normalizeToken=rot,n}var ROe=v(()=>{bh();Lmr();SOe();qmr()});function zuo(t){let e={formatElapsedTime:Wpr,getDocumentIndexId:Kpr,getDocumentProperties:COe,validateSchema:$nt};for(let r of qnt){let n=r;if(t[n]){if(typeof t[n]!="function")throw Fr("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!tmr.includes(r)&&!qnt.includes(r))throw Fr("UNSUPPORTED_COMPONENT",r)}function J8({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=lie());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=not(a):a=not({language:r??"english"}),n.tokenizer&&r)throw Fr("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=Xpr();s||(s=Amr()),l||(l=Dmr()),u||(u=Zpr()),zuo(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:Vuo()};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 Ypr)h[g]=(h[g]??[]).concat(Qpr(h,g));let y=h.afterCreate;return y&&rmr(y,h),h}function Vuo(){return"{{VERSION}}"}var Bmr=v(()=>{cie();knt();emr();pk();Ynt();jS();eot();ROe();bh();Gc()});var zmr=v(()=>{});var oot=v(()=>{cie();knt();Ynt();ROe();eot();jS()});var AOe,iot,aot,sot=v(()=>{AOe="fulltext",iot="hybrid",aot="vector"});var mk,hk,uot=v(()=>{sot();mk=Symbol("orama.insertions"),hk=Symbol("orama.removals")});function lot(t){typeof t[mk]!="number"&&(queueMicrotask(()=>{t[mk]=void 0}),t[mk]=0),t[mk]>1e3?(Vmr("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[mk]=-1):t[mk]>=0&&t[mk]++}function cot(t){typeof t[hk]!="number"&&(queueMicrotask(()=>{t[hk]=void 0}),t[hk]=0),t[hk]>1e3?(Vmr("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[hk]=-1):t[hk]>=0&&t[hk]++}var Vmr,dot=v(()=>{uot();Vmr=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)}});function mie(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw Fr("SCHEMA_VALIDATION_FAILURE",i);return yd(t.index.beforeInsert)||yd(t.index.insert)||yd(t.index.afterInsert)?Kuo(t,e,r,n,o):Guo(t,e,r,n,o)}async function Kuo(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Fr("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Fr("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await zC(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];Hmr(m,h,f,p)}return await Xuo(t,s,l,d,u,r,e,o),n||await zC(t.afterInsert,t,s,e),lot(t),s}function Guo(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw Fr("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw Fr("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||zC(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];Hmr(m,h,f,p)}return Zuo(t,s,l,d,u,r,e,o),n||zC(t.afterInsert,t,s,e),lot(t),s}function Hmr(t,e,r,n){if(!(Gpr(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(N1(e)&&Array.isArray(n))&&!(B8(e)&&Array.isArray(n))&&!(Juo.has(e)&&Wuo.has(t))&&t!==e)throw Fr("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function Xuo(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 Zuo(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 Juo,Wuo,fot=v(()=>{oot();Gc();pk();dot();bh();Juo=new Set(["enum","enum[]"]),Wuo=new Set(["string","number"])});function cV(t,e,r,n){return yd(t.index.beforeRemove)||yd(t.index.remove)||yd(t.index.afterRemove)?Yuo(t,e,r,n):Quo(t,e,r,n)}async function Yuo(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=NS(t.internalDocumentIDStore,iu(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await zC(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 zC(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),cot(t),o}function Quo(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=NS(t.internalDocumentIDStore,iu(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||zC(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||zC(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),cot(t),o}function hie(t,e,r,n,o){return yd(t.index.beforeRemove)||yd(t.index.remove)||yd(t.index.afterRemove)||yd(t.beforeRemoveMultiple)||yd(t.afterRemoveMultiple)?elo(t,e,r,n,o):tlo(t,e,r,n,o)}async function elo(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>NS(t.internalDocumentIDStore,iu(t.internalDocumentIDStore,s)));return o||await uV(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 cV(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await uV(t.afterRemoveMultiple,t,a),i}function tlo(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>NS(t.internalDocumentIDStore,iu(t.internalDocumentIDStore,l)));o||uV(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)cV(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||uV(t.afterRemoveMultiple,t,a),i}var pot=v(()=>{pk();jS();dot();Gc()});function rlo(t,e){return t[1]-e[1]}function nlo(t,e){return e[1]-t[1]}function olo(t="desc"){return t.toLowerCase()==="asc"?rlo:nlo}function W8(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(".")?U8(c,d):c[d],p=s[d],m=n[d].values;switch(p){case"number":{let h=r[d].ranges;Jmr(h,m)(f);break}case"number[]":{let h=new Set,y=r[d].ranges,g=Jmr(y,m,h);for(let b of f)g(b);break}case"boolean":case"enum":case"string":{Wmr(m,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let g=Wmr(m,p==="boolean[]"?"boolean":"string",new Set);for(let b of f)g(b);break}default:throw Fr("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=olo(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function Jmr(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 Wmr(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 NOe=v(()=>{bh();Gc()});function K8(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 jOe=v(()=>{});function G8(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 Fr("UNKNOWN_GROUP_BY_PROPERTY",b);if(!Kmr.includes(i[b]))throw Fr("INVALID_GROUP_BY_PROPERTY",b,Kmr.join(", "),i[b])}let a=e.map(([g])=>NS(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 O=0;O<u;O++){let T=s[O],P=U8(T,b);if(typeof P>"u")continue;let M=typeof P!="boolean"?P:""+P,I=_.perValue[M]??{indexes:[],count:0};I.count>=l||(I.indexes.push(O),I.count++,_.perValue[M]=I,w.add(P))}c.push(Array.from(w)),d[b]=_}let f=Gmr(c),p=f.length,m=[];for(let g=0;g<p;g++){let b=f[g],_=b.length,w={values:[],indexes:[]},O=[];for(let T=0;T<_;T++){let P=b[T],M=n[T];O.push(d[M].perValue[typeof P!="boolean"?P:""+P].indexes),w.values.push(P)}w.indexes=q8(O).sort((T,P)=>T-P),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||ilo,w=b.indexes.map(M=>({id:a[M],score:e[M][1],document:s[M]})),O=_.reducer.bind(null,b.values),T=_.getInitialValue(b.indexes.length),P=w.reduce(O,T);y[g]={values:b.values,result:P}}return y}function Gmr(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=Gmr(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];Ru(s,a),o.push(s)}return o}var ilo,Kmr,DOe=v(()=>{bh();Gc();jS();ilo={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},Kmr=["string","number","boolean"]});function Xmr(t,e,r){let n=BC(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign($Oe,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 k=t.index.getSearchablePropertiesWithTypes(g);w=t.index.getSearchableProperties(g),w=w.filter(V=>k[V].startsWith("string")),t.caches.propertiesToSearch=w}if(f&&f!=="*"){for(let k of f)if(!w.includes(k))throw Fr("UNKNOWN_INDEX",k,w.join(", "));w=w.filter(k=>f.includes(k))}let O=dV(t.tokenizer,t.index,t.documentsStore,r,e,w,_,t.documentsStore.count(b),n),T=Object.keys(e.where??{}).length>0,P=[];T&&(P=t.index.searchByWhereClause(O,g,e.where));let M=_.length;if(M||f?.length){let k=w.length;for(let V=0;V<k;V++){let q=w[V],J=O.indexMap[q];if(M!==0)for(let G=0;G<M;G++){let Y=_[G],se=t.index.search(O,g,q,Y);Ru(J[Y],se)}else{J[""]=[];let G=t.index.search(O,g,q,"");Ru(J[""],G)}let K=Object.values(J);O.docsIntersection[q]=TOe(K,e?.boost?.[q]??1,p,M);let ue=O.docsIntersection[q],oe=ue.length;for(let G=0;G<oe;G++){let[Y,se]=ue[G],ie=O.uniqueDocsIDs[Y];ie?O.uniqueDocsIDs[Y]=ie+se+.5:O.uniqueDocsIDs[Y]=se}}}else _.length===0&&d?O.uniqueDocsIDs={}:O.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(k=>[k,0]));let I=Object.entries(O.uniqueDocsIDs).map(([k,V])=>[+k,V]);if(T&&(I=K8(P,I)),e.sortBy)if(typeof e.sortBy=="function"){let k=I.map(([J])=>J),q=t.documentsStore.getMultiple(t.data.docs,k).map((J,K)=>[I[K][0],I[K][1],J]);q.sort(e.sortBy),I=q.map(([J,K])=>[J,K])}else I=t.sorter.sortBy(t.data.sorting,I,e.sortBy).map(([k,V])=>[iu(t.internalDocumentIDStore,k),V]);else I=I.sort(Jpr);let j;y||(j=m?Ymr(t,I,c,l,m):LOe(t,I,c,l));let A={elapsed:{formatted:"",raw:0},hits:[],count:I.length};if(typeof j<"u"&&(A.hits=j.filter(Boolean),h||xOe(A,s)),u){let k=W8(t,I,e.facets);A.facets=k}return e.groupBy&&(A.groups=G8(t,I,e.groupBy)),A.elapsed=t.formatElapsedTime(BC()-O.timeStart),A}async function a(){t.beforeSearch&&await V8(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await z8(t.afterSearch,t,e,r,s),s}return o?a():i()}var Zmr=v(()=>{fie();NOe();jOe();DOe();pk();jS();bh();Gc();fV()});function mot(t,e,r="english"){let n=BC(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw Fr("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?Fr("INVALID_INPUT_VECTOR","undefined",f,"undefined"):Fr("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let b=EOe(s.value,p,f,e.similarity).map(([k,V])=>[iu(t.internalDocumentIDStore,k),V]),_=t.caches.propertiesToSearch;if(!_){let k=t.index.getSearchablePropertiesWithTypes(y);_=t.index.getSearchableProperties(y),_=_.filter(V=>k[V].startsWith("string")),t.caches.propertiesToSearch=_}let w=[],O=dV(t.tokenizer,t.index,t.documentsStore,r,e,_,w,t.documentsStore.count(g),n),T=[];h&&(T=t.index.searchByWhereClause(O,y,e.where),b=K8(T,b));let P=[];m&&(P=W8(t,b,e.facets));let M=Array.from({length:u});for(let k=0;k<u;k++){let V=b[k+l];if(!V)break;let q=t.data.docs.docs[V[0]];if(q){c||(q[s.property]=null);let J={id:NS(t.internalDocumentIDStore,V[0]),score:V[1],document:q};M[k]=J}}let I=[];e.groupBy&&(I=G8(t,b,e.groupBy));let A=BC()-n;return{count:b.length,hits:M.filter(Boolean),elapsed:{raw:Number(A),formatted:sV(A)},...P?{facets:P}:{},...I?{groups:I}:{}}}async function a(){t.beforeSearch&&await V8(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await z8(t.afterSearch,t,e,r,s),s}return o?a():i()}var hot=v(()=>{fV();Gc();NOe();bh();POe();jOe();DOe();jS();pk()});function ehr(t,e,r){let n=BC(),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=alo(t,e,r),f=slo(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,y=llo(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(k=>A[k].startsWith("string")),t.caches.propertiesToSearch=b}if(e.properties&&e.properties!=="*"){for(let A of e.properties)if(!b.includes(A))throw Fr("UNKNOWN_INDEX",A,b.join(", "));b=b.filter(A=>e.properties.includes(A))}let _=dV(t.tokenizer,t.index,t.documentsStore,r,e,b,g,t.documentsStore.count(m),n),w=Object.keys(e.where??{}).length>0,O=[];w&&(O=t.index.searchByWhereClause(_,p,e.where),y=K8(O,y));let T;c&&(T=W8(t,y,e.facets));let P;e.groupBy&&(P=G8(t,y,e.groupBy));let M=LOe(t,y,s,u).filter(Boolean),I=BC(),j={count:y.length,elapsed:{raw:Number(I-n),formatted:sV(I-n)},hits:M,...T?{facets:T}:{},...P?{groups:P}:{}};if(!l){let A=Object.keys(t.data.index.vectorIndexes);xOe(j,A)}return j}async function a(){t.beforeSearch&&await V8(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await z8(t.afterSearch,t,e,r,s),s}return o?a():i()}function alo(t,e,r){let n=BC();e.relevance=Object.assign($Oe,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 Fr("UNKNOWN_INDEX",y,c.join(", "));c=c.filter(y=>h.has(y))}let d=dV(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 O=0;O<f;O++){let T=l[O],P=t.index.search(d,s,y,T);Ru(d.indexMap[y][T],P)}else{let O=[];d.indexMap[y][""]=O;let T=t.index.search(d,s,y,"");Ru(O,T)}let g=d.indexMap[y],b=Object.values(g);d.docsIntersection[y]=TOe(b,e?.boost?.[y]??1,a,f);let _=d.docsIntersection[y],w=_.length;for(let O=0;O<w;O++){let[T,P]=_[O],M=d.uniqueDocsIDs[T];d.uniqueDocsIDs[T]=M?M+P+.5:P}}}else l.length===0&&o?d.uniqueDocsIDs={}:d.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(m=>[m,0]));let p=Object.entries(d.uniqueDocsIDs).map(([m,h])=>[+m,h]).sort((m,h)=>h[1]-m[1]);return thr(p)}function slo(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 Fr("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw Fr("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=EOe(r.value,i,o,e.similarity).map(([s,u])=>[iu(t.internalDocumentIDStore,s),u]);return thr(a)}function got([,t]){return t}function thr(t){let e=Math.max.apply(Math,t.map(got));return t.map(([r,n])=>[r,n/e])}function Qmr(t,e){return t/e}function ulo(t,e){return(r,n)=>r*t+n*e}function llo(t,e,r,n){let o=Math.max.apply(Math,t.map(got)),i=Math.max.apply(Math,e.map(got)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:clo(r),l=new Map,c=t.length,d=ulo(s,u);for(let p=0;p<c;p++){let[m,h]=t[p],y=Qmr(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=Qmr(h,i),g=l.get(m)??0;l.set(m,g+d(0,y))}return[...l].sort((p,m)=>m[1]-p[1])}function clo(t){return{text:.5,vector:.5}}var rhr=v(()=>{Gc();jOe();fie();bh();fV();NOe();DOe();POe();jS();fV();pk()});function dV(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 x_(t,e,r){let n=e.mode??AOe;if(n===AOe)return Xmr(t,e,r);if(n===aot)return mot(t,e);if(n===iot)return ehr(t,e);throw Fr("INVALID_SEARCH_MODE",n)}function Ymr(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=U8(h,o);if(!(typeof y>"u"||a.has(y))&&(a.set(y,!0),c++,!(c<=r)&&(s.push({id:NS(t.internalDocumentIDStore,p),score:m,document:h}),u.add(p),c>=r+n)))break}return s}function LOe(t,e,r,n){let o=t.data.docs,i=Array.from({length:n}),a=new Set;for(let s=r;s<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:NS(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}var $Oe,fV=v(()=>{jS();bh();Gc();sot();Zmr();hot();rhr();$Oe={k:1.2,b:.75,d:.5}});function FOe(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 yot(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 nhr=v(()=>{});var ohr=v(()=>{pk();bh();fot();pot();Gc()});var ihr=v(()=>{bh();fV()});var ahr=v(()=>{Jnt();Gc();fie();ROe()});var kOe=v(()=>{Bmr();zmr();fot();pot();fV();hot();nhr();ohr();ihr();uot();oot();ahr()});function mlo(t,e){let r=shr(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function shr(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var bza,_za,flo,plo,bot,hlo,pV,_ot=v(()=>{bza=new Error("timeout while waiting for mutex to become available"),_za=new Error("mutex already locked"),flo=new Error("request for lock canceled"),plo=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())})},bot=class{constructor(e,r=flo){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=shr(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return plo(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]=[]),mlo(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}};hlo=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())})},pV=class{constructor(e){this._semaphore=new bot(1,e)}acquire(){return hlo(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 uhr=S(()=>{});var Fi=S((qOe,lhr)=>{(function(t,e){typeof qOe=="object"?lhr.exports=qOe=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(qOe,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=uhr()}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,O=g.sigBytes;if(this.clamp(),w%4)for(var T=0;T<O;T++){var P=_[T>>>2]>>>24-T%4*8&255;b[w+T>>>2]|=P<<24-(w+T)%4*8}else for(var M=0;M<O;M+=4)b[w+M>>>2]=_[M>>>2];return this.sigBytes+=O,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=[],O=0;O<_;O++){var T=b[O>>>2]>>>24-O%4*8&255;w.push((T>>>4).toString(16)),w.push((T&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=[],O=0;O<_;O++){var T=b[O>>>2]>>>24-O%4*8&255;w.push(String.fromCharCode(T))}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,O=_.sigBytes,T=this.blockSize,P=T*4,M=O/P;g?M=e.ceil(M):M=e.max((M|0)-this._minBufferSize,0);var I=M*T,j=e.min(I*4,O);if(I){for(var A=0;A<I;A+=T)this._doProcessBlock(w,A);b=w.splice(0,I),_.sigBytes-=j}return new l.init(b,j)},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 gie=S((UOe,chr)=>{(function(t,e){typeof UOe=="object"?chr.exports=UOe=e(Fi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(UOe,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 fhr=S((BOe,dhr)=>{(function(t,e){typeof BOe=="object"?dhr.exports=BOe=e(Fi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(BOe,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 mhr=S((zOe,phr)=>{(function(t,e){typeof zOe=="object"?phr.exports=zOe=e(Fi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(zOe,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 gk=S((VOe,hhr)=>{(function(t,e){typeof VOe=="object"?hhr.exports=VOe=e(Fi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(VOe,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.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 yhr=S((HOe,ghr)=>{(function(t,e){typeof HOe=="object"?ghr.exports=HOe=e(Fi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(HOe,function(t){return function(){var e=t,r=e.lib,n=r.WordArray,o=e.enc,i=o.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 yk=S((JOe,bhr)=>{(function(t,e){typeof JOe=="object"?bhr.exports=JOe=e(Fi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(JOe,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],O=p[m+2],T=p[m+3],P=p[m+4],M=p[m+5],I=p[m+6],j=p[m+7],A=p[m+8],k=p[m+9],V=p[m+10],q=p[m+11],J=p[m+12],K=p[m+13],ue=p[m+14],oe=p[m+15],G=b[0],Y=b[1],se=b[2],ie=b[3];G=l(G,Y,se,ie,_,7,s[0]),ie=l(ie,G,Y,se,w,12,s[1]),se=l(se,ie,G,Y,O,17,s[2]),Y=l(Y,se,ie,G,T,22,s[3]),G=l(G,Y,se,ie,P,7,s[4]),ie=l(ie,G,Y,se,M,12,s[5]),se=l(se,ie,G,Y,I,17,s[6]),Y=l(Y,se,ie,G,j,22,s[7]),G=l(G,Y,se,ie,A,7,s[8]),ie=l(ie,G,Y,se,k,12,s[9]),se=l(se,ie,G,Y,V,17,s[10]),Y=l(Y,se,ie,G,q,22,s[11]),G=l(G,Y,se,ie,J,7,s[12]),ie=l(ie,G,Y,se,K,12,s[13]),se=l(se,ie,G,Y,ue,17,s[14]),Y=l(Y,se,ie,G,oe,22,s[15]),G=c(G,Y,se,ie,w,5,s[16]),ie=c(ie,G,Y,se,I,9,s[17]),se=c(se,ie,G,Y,q,14,s[18]),Y=c(Y,se,ie,G,_,20,s[19]),G=c(G,Y,se,ie,M,5,s[20]),ie=c(ie,G,Y,se,V,9,s[21]),se=c(se,ie,G,Y,oe,14,s[22]),Y=c(Y,se,ie,G,P,20,s[23]),G=c(G,Y,se,ie,k,5,s[24]),ie=c(ie,G,Y,se,ue,9,s[25]),se=c(se,ie,G,Y,T,14,s[26]),Y=c(Y,se,ie,G,A,20,s[27]),G=c(G,Y,se,ie,K,5,s[28]),ie=c(ie,G,Y,se,O,9,s[29]),se=c(se,ie,G,Y,j,14,s[30]),Y=c(Y,se,ie,G,J,20,s[31]),G=d(G,Y,se,ie,M,4,s[32]),ie=d(ie,G,Y,se,A,11,s[33]),se=d(se,ie,G,Y,q,16,s[34]),Y=d(Y,se,ie,G,ue,23,s[35]),G=d(G,Y,se,ie,w,4,s[36]),ie=d(ie,G,Y,se,P,11,s[37]),se=d(se,ie,G,Y,j,16,s[38]),Y=d(Y,se,ie,G,V,23,s[39]),G=d(G,Y,se,ie,K,4,s[40]),ie=d(ie,G,Y,se,_,11,s[41]),se=d(se,ie,G,Y,T,16,s[42]),Y=d(Y,se,ie,G,I,23,s[43]),G=d(G,Y,se,ie,k,4,s[44]),ie=d(ie,G,Y,se,J,11,s[45]),se=d(se,ie,G,Y,oe,16,s[46]),Y=d(Y,se,ie,G,O,23,s[47]),G=f(G,Y,se,ie,_,6,s[48]),ie=f(ie,G,Y,se,j,10,s[49]),se=f(se,ie,G,Y,ue,15,s[50]),Y=f(Y,se,ie,G,M,21,s[51]),G=f(G,Y,se,ie,J,6,s[52]),ie=f(ie,G,Y,se,T,10,s[53]),se=f(se,ie,G,Y,V,15,s[54]),Y=f(Y,se,ie,G,w,21,s[55]),G=f(G,Y,se,ie,A,6,s[56]),ie=f(ie,G,Y,se,oe,10,s[57]),se=f(se,ie,G,Y,I,15,s[58]),Y=f(Y,se,ie,G,K,21,s[59]),G=f(G,Y,se,ie,P,6,s[60]),ie=f(ie,G,Y,se,q,10,s[61]),se=f(se,ie,G,Y,O,15,s[62]),Y=f(Y,se,ie,G,k,21,s[63]),b[0]=b[0]+G|0,b[1]=b[1]+Y|0,b[2]=b[2]+se|0,b[3]=b[3]+ie|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,O=0;O<4;O++){var T=w[O];w[O]=(T<<8|T>>>24)&16711935|(T<<24|T>>>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 vot=S((WOe,_hr)=>{(function(t,e){typeof WOe=="object"?_hr.exports=WOe=e(Fi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(WOe,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 GOe=S((KOe,vhr)=>{(function(t,e){typeof KOe=="object"?vhr.exports=KOe=e(Fi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(KOe,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],O=p[7],T=0;T<64;T++){if(T<16)l[T]=d[f+T]|0;else{var P=l[T-15],M=(P<<25|P>>>7)^(P<<14|P>>>18)^P>>>3,I=l[T-2],j=(I<<15|I>>>17)^(I<<13|I>>>19)^I>>>10;l[T]=M+l[T-7]+j+l[T-16]}var A=b&_^~b&w,k=m&h^m&y^h&y,V=(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),J=O+q+A+u[T]+l[T],K=V+k;O=w,w=_,_=b,b=g+J|0,g=y,y=h,h=m,m=J+K|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]+O|0},_doFinalize:function(){var d=this._data,f=d.words,p=this._nDataBytes*8,m=d.sigBytes*8;return f[m>>>5]|=128<<24-m%32,f[(m+64>>>9<<4)+14]=e.floor(p/4294967296),f[(m+64>>>9<<4)+15]=p,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=i.clone.call(this);return d._hash=this._hash.clone(),d}});r.SHA256=i._createHelper(c),r.HmacSHA256=i._createHmacHelper(c)}(Math),t.SHA256})});var Shr=S((XOe,whr)=>{(function(t,e,r){typeof XOe=="object"?whr.exports=XOe=e(Fi(),GOe()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(XOe,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 wot=S((ZOe,Chr)=>{(function(t,e,r){typeof ZOe=="object"?Chr.exports=ZOe=e(Fi(),gie()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(ZOe,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],O=m[6],T=m[7],P=h.high,M=h.low,I=y.high,j=y.low,A=g.high,k=g.low,V=b.high,q=b.low,J=_.high,K=_.low,ue=w.high,oe=w.low,G=O.high,Y=O.low,se=T.high,ie=T.low,$=P,H=M,re=I,D=j,R=A,z=k,U=V,ee=q,ce=J,ve=K,Oe=ue,Je=oe,tt=G,Ke=Y,dt=se,Pt=ie,Nt=0;Nt<80;Nt++){var Ne,Tr,st=c[Nt];if(Nt<16)Tr=st.high=f[p+Nt*2]|0,Ne=st.low=f[p+Nt*2+1]|0;else{var Le=c[Nt-15],rt=Le.high,Fe=Le.low,We=(rt>>>1|Fe<<31)^(rt>>>8|Fe<<24)^rt>>>7,ke=(Fe>>>1|rt<<31)^(Fe>>>8|rt<<24)^(Fe>>>7|rt<<25),Lt=c[Nt-2],Eo=Lt.high,xl=Lt.low,In=(Eo>>>19|xl<<13)^(Eo<<3|xl>>>29)^Eo>>>6,hi=(xl>>>19|Eo<<13)^(xl<<3|Eo>>>29)^(xl>>>6|Eo<<26),Gm=c[Nt-7],Fs=Gm.high,Vb=Gm.low,Jh=c[Nt-16],Mw=Jh.high,zi=Jh.low;Ne=ke+Vb,Tr=We+Fs+(Ne>>>0<ke>>>0?1:0),Ne=Ne+hi,Tr=Tr+In+(Ne>>>0<hi>>>0?1:0),Ne=Ne+zi,Tr=Tr+Mw+(Ne>>>0<zi>>>0?1:0),st.high=Tr,st.low=Ne}var pt=ce&Oe^~ce&tt,Br=ve&Je^~ve&Ke,Ti=$&re^$&R^re&R,Ei=H&D^H&z^D&z,tu=($>>>28|H<<4)^($<<30|H>>>2)^($<<25|H>>>7),Pi=(H>>>28|$<<4)^(H<<30|$>>>2)^(H<<25|$>>>7),tl=(ce>>>14|ve<<18)^(ce>>>18|ve<<14)^(ce<<23|ve>>>9),rl=(ve>>>14|ce<<18)^(ve>>>18|ce<<14)^(ve<<23|ce>>>9),Ol=l[Nt],Xm=Ol.high,Ft=Ol.low,Ge=Pt+rl,Ee=dt+tl+(Ge>>>0<Pt>>>0?1:0),Ge=Ge+Br,Ee=Ee+pt+(Ge>>>0<Br>>>0?1:0),Ge=Ge+Ft,Ee=Ee+Xm+(Ge>>>0<Ft>>>0?1:0),Ge=Ge+Ne,Ee=Ee+Tr+(Ge>>>0<Ne>>>0?1:0),yr=Pi+Ei,ii=tu+Ti+(yr>>>0<Pi>>>0?1:0);dt=tt,Pt=Ke,tt=Oe,Ke=Je,Oe=ce,Je=ve,ve=ee+Ge|0,ce=U+Ee+(ve>>>0<ee>>>0?1:0)|0,U=R,ee=z,R=re,z=D,re=$,D=H,H=Ge+yr|0,$=Ee+ii+(H>>>0<Ge>>>0?1:0)|0}M=h.low=M+H,h.high=P+$+(M>>>0<H>>>0?1:0),j=y.low=j+D,y.high=I+re+(j>>>0<D>>>0?1:0),k=g.low=k+z,g.high=A+R+(k>>>0<z>>>0?1:0),q=b.low=q+ee,b.high=V+U+(q>>>0<ee>>>0?1:0),K=_.low=K+ve,_.high=J+ce+(K>>>0<ve>>>0?1:0),oe=w.low=oe+Je,w.high=ue+Oe+(oe>>>0<Je>>>0?1:0),Y=O.low=Y+Ke,O.high=G+tt+(Y>>>0<Ke>>>0?1:0),ie=T.low=ie+Pt,T.high=se+dt+(ie>>>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 Ohr=S((YOe,xhr)=>{(function(t,e,r){typeof YOe=="object"?xhr.exports=YOe=e(Fi(),gie(),wot()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(YOe,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 Ehr=S((QOe,Thr)=>{(function(t,e,r){typeof QOe=="object"?Thr.exports=QOe=e(Fi(),gie()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(QOe,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 O=0,T=0,P=0;P<7;P++){if(_&1){var M=(1<<P)-1;M<32?T^=1<<M:O^=1<<M-32}_&128?_=_<<1^113:_<<=1}d[w]=s.create(O,T)}})();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 O=y[b];O.high^=w,O.low^=_}for(var T=0;T<24;T++){for(var P=0;P<5;P++){for(var M=0,I=0,j=0;j<5;j++){var O=y[P+5*j];M^=O.high,I^=O.low}var A=f[P];A.high=M,A.low=I}for(var P=0;P<5;P++)for(var k=f[(P+4)%5],V=f[(P+1)%5],q=V.high,J=V.low,M=k.high^(q<<1|J>>>31),I=k.low^(J<<1|q>>>31),j=0;j<5;j++){var O=y[P+5*j];O.high^=M,O.low^=I}for(var K=1;K<25;K++){var M,I,O=y[K],ue=O.high,oe=O.low,G=l[K];G<32?(M=ue<<G|oe>>>32-G,I=oe<<G|ue>>>32-G):(M=oe<<G-32|ue>>>64-G,I=ue<<G-32|oe>>>64-G);var Y=f[c[K]];Y.high=M,Y.low=I}var se=f[0],ie=y[0];se.high=ie.high,se.low=ie.low;for(var P=0;P<5;P++)for(var j=0;j<5;j++){var K=P+5*j,O=y[K],$=f[K],H=f[(P+1)%5+5*j],re=f[(P+2)%5+5*j];O.high=$.high^~H.high&re.high,O.low=$.low^~H.low&re.low}var O=y[0],D=d[T];O.high^=D.high,O.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,O=w/8,T=[],P=0;P<O;P++){var M=_[P],I=M.high,j=M.low;I=(I<<8|I>>>24)&16711935|(I<<24|I>>>8)&4278255360,j=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360,T.push(j),T.push(I)}return new o.init(T,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 Mhr=S((eTe,Phr)=>{(function(t,e){typeof eTe=="object"?Phr.exports=eTe=e(Fi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(eTe,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,O){for(var T=0;T<16;T++){var P=O+T,M=w[P];w[P]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}var I=this._hash.words,j=d.words,A=f.words,k=s.words,V=u.words,q=l.words,J=c.words,K,ue,oe,G,Y,se,ie,$,H,re;se=K=I[0],ie=ue=I[1],$=oe=I[2],H=G=I[3],re=Y=I[4];for(var D,T=0;T<80;T+=1)D=K+w[O+k[T]]|0,T<16?D+=m(ue,oe,G)+j[0]:T<32?D+=h(ue,oe,G)+j[1]:T<48?D+=y(ue,oe,G)+j[2]:T<64?D+=g(ue,oe,G)+j[3]:D+=b(ue,oe,G)+j[4],D=D|0,D=_(D,q[T]),D=D+Y|0,K=Y,Y=G,G=_(oe,10),oe=ue,ue=D,D=se+w[O+V[T]]|0,T<16?D+=b(ie,$,H)+A[0]:T<32?D+=g(ie,$,H)+A[1]:T<48?D+=y(ie,$,H)+A[2]:T<64?D+=h(ie,$,H)+A[3]:D+=m(ie,$,H)+A[4],D=D|0,D=_(D,J[T]),D=D+re|0,se=re,re=H,H=_($,10),$=ie,ie=D;D=I[1]+oe+H|0,I[1]=I[2]+G+re|0,I[2]=I[3]+Y+se|0,I[3]=I[4]+K+ie|0,I[4]=I[0]+ue+$|0,I[0]=D},_doFinalize:function(){var w=this._data,O=w.words,T=this._nDataBytes*8,P=w.sigBytes*8;O[P>>>5]|=128<<24-P%32,O[(P+64>>>9<<4)+14]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360,w.sigBytes=(O.length+1)*4,this._process();for(var M=this._hash,I=M.words,j=0;j<5;j++){var A=I[j];I[j]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}return M},clone:function(){var w=i.clone.call(this);return w._hash=this._hash.clone(),w}});function m(w,O,T){return w^O^T}function h(w,O,T){return w&O|~w&T}function y(w,O,T){return(w|~O)^T}function g(w,O,T){return w&T|O&~T}function b(w,O,T){return w^(O|~T)}function _(w,O){return w<<O|w>>>32-O}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var rTe=S((tTe,Ihr)=>{(function(t,e){typeof tTe=="object"?Ihr.exports=tTe=e(Fi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(tTe,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 Ahr=S((nTe,Rhr)=>{(function(t,e,r){typeof nTe=="object"?Rhr.exports=nTe=e(Fi(),GOe(),rTe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(nTe,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,O=w.length,T=_,P=1;P<b;P++){T=f.finalize(T),f.reset();for(var M=T.words,I=0;I<O;I++)w[I]^=M[I]}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 j1=S((oTe,Nhr)=>{(function(t,e,r){typeof oTe=="object"?Nhr.exports=oTe=e(Fi(),vot(),rTe()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(oTe,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 Im=S((iTe,jhr)=>{(function(t,e,r){typeof iTe=="object"?jhr.exports=iTe=e(Fi(),j1()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(iTe,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,k){return this.create(this._ENC_XFORM_MODE,A,k)},createDecryptor:function(A,k){return this.create(this._DEC_XFORM_MODE,A,k)},init:function(A,k,V){this.cfg=this.cfg.extend(V),this._xformMode=A,this._key=k,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 k=this._doFinalize();return k},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function A(k){return typeof k=="string"?j:P}return function(k){return{encrypt:function(V,q,J){return A(q).encrypt(k,V,q,J)},decrypt:function(V,q,J){return A(q).decrypt(k,V,q,J)}}}}()}),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,k){return this.Encryptor.create(A,k)},createDecryptor:function(A,k){return this.Decryptor.create(A,k)},init:function(A,k){this._cipher=A,this._iv=k}}),y=m.CBC=function(){var A=h.extend();A.Encryptor=A.extend({processBlock:function(V,q){var J=this._cipher,K=J.blockSize;k.call(this,V,q,K),J.encryptBlock(V,q),this._prevBlock=V.slice(q,q+K)}}),A.Decryptor=A.extend({processBlock:function(V,q){var J=this._cipher,K=J.blockSize,ue=V.slice(q,q+K);J.decryptBlock(V,q),k.call(this,V,q,K),this._prevBlock=ue}});function k(V,q,J){var K,ue=this._iv;ue?(K=ue,this._iv=e):K=this._prevBlock;for(var oe=0;oe<J;oe++)V[q+oe]^=K[oe]}return A}(),g=r.pad={},b=g.Pkcs7={pad:function(A,k){for(var V=k*4,q=V-A.sigBytes%V,J=q<<24|q<<16|q<<8|q,K=[],ue=0;ue<q;ue+=4)K.push(J);var oe=i.create(K,q);A.concat(oe)},unpad:function(A){var k=A.words[A.sigBytes-1>>>2]&255;A.sigBytes-=k}},_=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:y,padding:b}),reset:function(){var A;f.reset.call(this);var k=this.cfg,V=k.iv,q=k.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,V&&V.words):(this._mode=A.call(q,this,V&&V.words),this._mode.__creator=A)},_doProcessBlock:function(A,k){this._mode.processBlock(A,k)},_doFinalize:function(){var A,k=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(k.pad(this._data,this.blockSize),A=this._process(!0)):(A=this._process(!0),k.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)}}),O=r.format={},T=O.OpenSSL={stringify:function(A){var k,V=A.ciphertext,q=A.salt;return q?k=i.create([1398893684,1701076831]).concat(q).concat(V):k=V,k.toString(l)},parse:function(A){var k,V=l.parse(A),q=V.words;return q[0]==1398893684&&q[1]==1701076831&&(k=i.create(q.slice(2,4)),q.splice(0,4),V.sigBytes-=16),w.create({ciphertext:V,salt:k})}},P=n.SerializableCipher=o.extend({cfg:o.extend({format:T}),encrypt:function(A,k,V,q){q=this.cfg.extend(q);var J=A.createEncryptor(V,q),K=J.finalize(k),ue=J.cfg;return w.create({ciphertext:K,key:V,iv:ue.iv,algorithm:A,mode:ue.mode,padding:ue.padding,blockSize:A.blockSize,formatter:q.format})},decrypt:function(A,k,V,q){q=this.cfg.extend(q),k=this._parse(k,q.format);var J=A.createDecryptor(V,q).finalize(k.ciphertext);return J},_parse:function(A,k){return typeof A=="string"?k.parse(A,this):A}}),M=r.kdf={},I=M.OpenSSL={execute:function(A,k,V,q,J){if(q||(q=i.random(64/8)),J)var K=d.create({keySize:k+V,hasher:J}).compute(A,q);else var K=d.create({keySize:k+V}).compute(A,q);var ue=i.create(K.words.slice(k),V*4);return K.sigBytes=k*4,w.create({key:K,iv:ue,salt:q})}},j=n.PasswordBasedCipher=P.extend({cfg:P.cfg.extend({kdf:I}),encrypt:function(A,k,V,q){q=this.cfg.extend(q);var J=q.kdf.execute(V,A.keySize,A.ivSize,q.salt,q.hasher);q.iv=J.iv;var K=P.encrypt.call(this,A,k,J.key,q);return K.mixIn(J),K},decrypt:function(A,k,V,q){q=this.cfg.extend(q),k=this._parse(k,q.format);var J=q.kdf.execute(V,A.keySize,A.ivSize,k.salt,q.hasher);q.iv=J.iv;var K=P.decrypt.call(this,A,k,J.key,q);return K}})}()})});var $hr=S((aTe,Dhr)=>{(function(t,e,r){typeof aTe=="object"?Dhr.exports=aTe=e(Fi(),Im()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(aTe,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 Fhr=S((sTe,Lhr)=>{(function(t,e,r){typeof sTe=="object"?Lhr.exports=sTe=e(Fi(),Im()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(sTe,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 qhr=S((uTe,khr)=>{(function(t,e,r){typeof uTe=="object"?khr.exports=uTe=e(Fi(),Im()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(uTe,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 Bhr=S((lTe,Uhr)=>{(function(t,e,r){typeof lTe=="object"?Uhr.exports=lTe=e(Fi(),Im()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(lTe,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 Vhr=S((cTe,zhr)=>{(function(t,e,r){typeof cTe=="object"?zhr.exports=cTe=e(Fi(),Im()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(cTe,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 Jhr=S((dTe,Hhr)=>{(function(t,e,r){typeof dTe=="object"?Hhr.exports=dTe=e(Fi(),Im()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(dTe,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 Khr=S((fTe,Whr)=>{(function(t,e,r){typeof fTe=="object"?Whr.exports=fTe=e(Fi(),Im()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(fTe,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 Xhr=S((pTe,Ghr)=>{(function(t,e,r){typeof pTe=="object"?Ghr.exports=pTe=e(Fi(),Im()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(pTe,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 Yhr=S((mTe,Zhr)=>{(function(t,e,r){typeof mTe=="object"?Zhr.exports=mTe=e(Fi(),Im()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(mTe,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 egr=S((hTe,Qhr)=>{(function(t,e,r){typeof hTe=="object"?Qhr.exports=hTe=e(Fi(),Im()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(hTe,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var rgr=S((gTe,tgr)=>{(function(t,e,r){typeof gTe=="object"?tgr.exports=gTe=e(Fi(),Im()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(gTe,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 ogr=S((yTe,ngr)=>{(function(t,e,r){typeof yTe=="object"?ngr.exports=yTe=e(Fi(),gk(),yk(),j1(),Im()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(yTe,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 O=w^w<<1^w<<2^w<<3^w<<4;O=O>>>8^O&255^99,i[_]=O,a[O]=_;var T=g[_],P=g[T],M=g[P],I=g[O]*257^O*16843008;s[_]=I<<24|I>>>8,u[_]=I<<16|I>>>16,l[_]=I<<8|I>>>24,c[_]=I;var I=M*16843009^P*65537^T*257^_*16843008;d[O]=I<<24|I>>>8,f[O]=I<<16|I>>>16,p[O]=I<<8|I>>>24,m[O]=I,_?(_=T^g[g[g[M^T]]],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,O=this._nRounds=w+6,T=(O+1)*4,P=this._keySchedule=[],M=0;M<T;M++)M<w?P[M]=_[M]:(g=P[M-1],M%w?w>6&&M%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[M/w|0]<<24),P[M]=P[M-w]^g);for(var I=this._invKeySchedule=[],j=0;j<T;j++){var M=T-j;if(j%4)var g=P[M];else var g=P[M-4];j<4||M<=4?I[j]=g:I[j]=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,O,T,P,M){for(var I=this._nRounds,j=g[b]^_[0],A=g[b+1]^_[1],k=g[b+2]^_[2],V=g[b+3]^_[3],q=4,J=1;J<I;J++){var K=w[j>>>24]^O[A>>>16&255]^T[k>>>8&255]^P[V&255]^_[q++],ue=w[A>>>24]^O[k>>>16&255]^T[V>>>8&255]^P[j&255]^_[q++],oe=w[k>>>24]^O[V>>>16&255]^T[j>>>8&255]^P[A&255]^_[q++],G=w[V>>>24]^O[j>>>16&255]^T[A>>>8&255]^P[k&255]^_[q++];j=K,A=ue,k=oe,V=G}var K=(M[j>>>24]<<24|M[A>>>16&255]<<16|M[k>>>8&255]<<8|M[V&255])^_[q++],ue=(M[A>>>24]<<24|M[k>>>16&255]<<16|M[V>>>8&255]<<8|M[j&255])^_[q++],oe=(M[k>>>24]<<24|M[V>>>16&255]<<16|M[j>>>8&255]<<8|M[A&255])^_[q++],G=(M[V>>>24]<<24|M[j>>>16&255]<<16|M[A>>>8&255]<<8|M[k&255])^_[q++];g[b]=K,g[b+1]=ue,g[b+2]=oe,g[b+3]=G},keySize:256/32});e.AES=n._createHelper(y)}(),t.AES})});var agr=S((bTe,igr)=>{(function(t,e,r){typeof bTe=="object"?igr.exports=bTe=e(Fi(),gk(),yk(),j1(),Im()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(bTe,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=[],O=0;O<16;O++){for(var T=w[O]=[],P=u[O],b=0;b<24;b++)T[b/6|0]|=g[(s[b]-1+P)%28]<<31-b%6,T[4+(b/6|0)]|=g[28+(s[b+24]-1+P)%28]<<31-b%6;T[0]=T[0]<<1|T[0]>>>31;for(var b=1;b<7;b++)T[b]=T[b]>>>(b-1)*4+3;T[7]=T[7]<<5|T[7]>>>27}for(var M=this._invSubKeys=[],b=0;b<16;b++)M[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,O=this._rBlock,T=0,P=0;P<8;P++)T|=l[P][((O^_[P])&c[P])>>>0];this._lBlock=O,this._rBlock=w^T}var M=this._lBlock;this._lBlock=this._rBlock,this._rBlock=M,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),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 ugr=S((_Te,sgr)=>{(function(t,e,r){typeof _Te=="object"?sgr.exports=_Te=e(Fi(),gk(),yk(),j1(),Im()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(_Te,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 cgr=S((vTe,lgr)=>{(function(t,e,r){typeof vTe=="object"?lgr.exports=vTe=e(Fi(),gk(),yk(),j1(),Im()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(vTe,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,O=_<<16|b&65535;m[0]^=b,m[1]^=w,m[2]^=_,m[3]^=O,m[4]^=b,m[5]^=w,m[6]^=_,m[7]^=O;for(var f=0;f<4;f++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<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 fgr=S((wTe,dgr)=>{(function(t,e,r){typeof wTe=="object"?dgr.exports=wTe=e(Fi(),gk(),yk(),j1(),Im()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(wTe,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,O=_<<16|b&65535;p[0]^=b,p[1]^=w,p[2]^=_,p[3]^=O,p[4]^=b,p[5]^=w,p[6]^=_,p[7]^=O;for(var m=0;m<4;m++)l.call(this)}},_doProcessBlock:function(c,d){var f=this._X;l.call(this),i[0]=f[0]^f[5]>>>16^f[3]<<16,i[1]=f[2]^f[7]>>>16^f[5]<<16,i[2]=f[4]^f[1]>>>16^f[7]<<16,i[3]=f[6]^f[3]>>>16^f[1]<<16;for(var p=0;p<4;p++)i[p]=(i[p]<<8|i[p]>>>24)&16711935|(i[p]<<24|i[p]>>>8)&4278255360,c[d+p]^=i[p]},blockSize:128/32,ivSize:64/32});function l(){for(var c=this._X,d=this._C,f=0;f<8;f++)a[f]=d[f];d[0]=d[0]+1295307597+this._b|0,d[1]=d[1]+3545052371+(d[0]>>>0<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 mgr=S((STe,pgr)=>{(function(t,e,r){typeof STe=="object"?pgr.exports=STe=e(Fi(),gk(),yk(),j1(),Im()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(STe,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 O=0;O<4;O++){m.sbox[O]=[];for(let T=0;T<256;T++)m.sbox[O][T]=s[O][T]}let g=0;for(let O=0;O<i+2;O++)m.pbox[O]=a[O]^h[g],g++,g>=y&&(g=0);let b=0,_=0,w=0;for(let O=0;O<i+2;O+=2)w=c(m,b,_),b=w.left,_=w.right,m.pbox[O]=b,m.pbox[O+1]=_;for(let O=0;O<4;O++)for(let T=0;T<256;T+=2)w=c(m,b,_),b=w.left,_=w.right,m.sbox[O][T]=b,m.sbox[O][T+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 mV=S((CTe,hgr)=>{(function(t,e,r){typeof CTe=="object"?hgr.exports=CTe=e(Fi(),gie(),fhr(),mhr(),gk(),yhr(),yk(),vot(),GOe(),Shr(),wot(),Ohr(),Ehr(),Mhr(),rTe(),Ahr(),j1(),Im(),$hr(),Fhr(),qhr(),Bhr(),Vhr(),Jhr(),Khr(),Xhr(),Yhr(),egr(),rgr(),ogr(),agr(),ugr(),cgr(),fgr(),mgr()):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)})(CTe,function(t){return t})});var Sot,glo,xTe,ggr=v(()=>{Xw();ot();kOe();Sot="copilot-index-chunk-",glo=".json",xTe=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${Sot}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${Sot}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${glo}`}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,[]);ae().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,ae().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),ae().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 yot(e),n=ae().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(ae().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)),ae().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)),ae().debug&&console.log(`Saved partition ${l+1}/${n}`)}ae().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new Ao(`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 Ao("Invalid legacy database format");let l=await J8({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await FOe(l,u),l}let r=await this.loadMetadata(),n=await J8({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 Ao("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++):ae().debug&&console.warn(`Document ${u} not found in any chunk`)}return o.docs.docs=a,o.docs.count=Object.keys(a).length,o.index.vectorIndexes.embedding.vectors=Object.assign({},...i.map(u=>u.index?.vectorIndexes?.embedding?.vectors||{})),await FOe(n,o),n}catch(e){throw console.error("Error loading database:",e),new Ao(`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}/${Sot}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new Ao(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(ae().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 Ao("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new Ao("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 vgr={};Rn(vgr,{categorizePatterns:()=>X8,createPatternSettingsValue:()=>Z8,extractAppIgnoreSettings:()=>yie,getAllQAMarkdownContent:()=>Oot,getDecodedPatterns:()=>O_,getExtensionPattern:()=>Tot,getFilePattern:()=>Y8,getInternalExcludePaths:()=>bgr,getMatchingPatterns:()=>Xc,getTagPattern:()=>bie,getVectorLength:()=>xot,isInternalExcludedFile:()=>Q8,isInternalExcludedPath:()=>_gr,previewPatternValue:()=>_lo,shouldIndexFile:()=>bl});async function xot(t){if(!t)throw new Ao("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new Ao("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${gd.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new Ao("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function Oot(t){let e="",{inclusions:r,exclusions:n}=Xc(),o=t.vault.getMarkdownFiles().filter(i=>bl(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function O_(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function ylo(){return ae().qaExclusions?O_(ae().qaExclusions):[]}function blo(){return ae().qaInclusions?O_(ae().qaInclusions):[]}function Xc(t){let e=t?.inclusions?O_(t.inclusions):t?.isProject?[]:blo(),r=t?.exclusions?O_(t.exclusions):t?.isProject?[]:ylo();return{inclusions:e.length>0?X8(e):null,exclusions:r.length>0?X8(r):null}}function bl(t,e,r,n){return!(Q8(t)||r&&ygr(t.path,r)||e&&!ygr(t.path,e)||n&&!e)}function X8(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 _lo(t){return O_(t).join(", ")}function Z8({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function vlo(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof Cot.TFile){let n=yO(r);if(e.some(o=>n.some(i=>i.toLowerCase()===qW(o).toLowerCase())))return!0}return!1}function wlo(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 Slo(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 Clo(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof Cot.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function ygr(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return vlo(t,r??[])||wlo(t,n??[])||Slo(t,o??[])||Clo(t,i??[])}function yie(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 bie(t){return`#${t}`}function Y8(t){return`[[${t.basename}]]`}function Tot(t){return`*.${t}`}function bgr(){return[pm.getLogPath()]}function _gr(t){return new Set(bgr()).has(t)}function Q8(t){return _gr(t.path)}var Cot,vb=v(()=>{Xw();aV();ot();Ez();Zt();Cot=require("obsidian")});var Cgr={};Rn(Cgr,{DBOperations:()=>yR});var Sgr,gR,wgr,yR,_ie=v(()=>{aV();Xw();_t();ot();Zt();kOe();_ot();Sgr=L(mV()),gR=require("obsidian");ggr();vb();wgr=25,yR=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new pV;al(async()=>{let r=ae();gR.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):gR.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await gd.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(B("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await gd.getInstance().getEmbeddingsAPI()),B("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new Ao("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new xTe(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),gR.Platform.isMobile&&ae().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new Ao("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),B("Loaded existing chunked semantic index database from disk."),this.oramaDb}catch(n){ne("Failed to load existing semantic index database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){ne("Error initializing semantic index database:",r),new gR.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(gR.Platform.isMobile&&ae().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await gd.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new Ao("Semantic index database not found.")}catch(e){throw ne("Failed to initialize database during save:",e),new Ao("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,ae().debug&&B("Semantic index database saved successfully at:",this.dbPath)}catch(e){throw ne("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 gR.Notice("Local Copilot index cleared successfully."),B("Local Copilot index cleared successfully, new instance created.")}catch(r){throw ne("Error clearing the local Copilot index:",r),new gR.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new Ao("Semantic index database not found.");try{let r=await x_(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await hie(this.oramaDb,r.hits.map(n=>n.id),500),ae().debug&&B(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){ne("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(ae().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),B("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,Sgr.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new Ao("Embedding instance not found.");let r=await xot(e);if(!r||r===0)throw new Ao("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await J8({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return B(`Created new semantic index database for ${this.dbPath}. Embedding model: ${gd.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 x_(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 x_(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return ne("Error getting latest file mtime from VectorDB:",r),0}}createDynamicSchema(e){return{id:"string",title:"string",path:"string",content:"string",embedding:`vector[${e}]`,embeddingModel:"string",created_at:"number",ctime:"number",mtime:"number",tags:"string[]",extension:"string"}}async upsert(e){if(!this.oramaDb)throw new Error("DB not initialized");let r=this.oramaDb;return await this.upsertMutex.runExclusive(async()=>{try{let n=this.chunkedStorage?.assignDocumentToPartition(e.id,ae().numPartitions),o=await x_(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await cV(r,o.hits[0].id);try{return await mie(r,e),B(`${o.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${n}`),this.markUnsavedChanges(),e}catch(i){if(ne(`Failed to ${o.hits.length>0?"update":"insert"} document ${e.id}:`,i),o.hits.length>0)try{await mie(r,o.hits[0].document)}catch(a){ne("Failed to restore previous document version:",a)}return}}catch(n){ne(`Error upserting document ${e.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await x_(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return ne("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){B("Semantic index database not loaded in memory. Checking for existing index...");try{await this.initializeDB(e)}catch(o){throw ne("Failed to initialize database:",o),new Ao("Failed to initialize semantic index database. Please check your embedding model settings.")}if(!this.oramaDb)return B("No existing index found. Will create new index."),!1}let r=await x_(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=gd.getModelName(e);if(!ERt(n,o))return new gR.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),B(`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 B("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await x_(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){B("Semantic index database not found during garbage collection. Attempting to initialize...");try{let e=await gd.getInstance().getEmbeddingsAPI();if(!e)throw new Ao("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new Ao("Failed to initialize database after attempt.")}catch(e){throw ne("Failed to initialize database during garbage collection:",e),new Ao("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}=Xc(),i=new Set(e.filter(u=>bl(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:(B("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(s.map(u=>u.path))).join(", ")),s.length===1?await cV(this.oramaDb,s[0].id):await hie(this.oramaDb,s.map(u=>u.id),500),await this.saveDB(),s.length)}catch(e){throw ne("Error garbage collecting the Copilot index:",e),new Ao("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new Ao("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 ne("Error getting indexed files:",e),new Ao("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await x_(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw ne("Error checking if database is empty:",e),new Ao("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 Ao("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 Ao("Orama database not found.");try{let e=await this.getIndexedFiles();for(let n=0;n<e.length;n+=1){let o=e[n];await this.hasEmbeddings(o)||this.markFileMissingEmbeddings(o),(n+1)%wgr===0&&await this.yieldToEventLoop()}e.length%wgr!==0&&await this.yieldToEventLoop();let r=this.getFilesMissingEmbeddings();r.length>0?B("Files missing embeddings after integrity check:",r.join(", ")):B("Index integrity check completed. All documents have embeddings.")}catch(e){throw ne("Error checking index integrity:",e),new Ao("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 eG,xlo,OTe,xgr=v(()=>{qs();Bc();_t();ot();eG=require("obsidian");vb();xlo=5e3,OTe=class{constructor(e,r,n){this.app=e;this.indexOps=r;this.dbOps=n;this.debounceTimer=null;this.lastActiveFile=null;this.lastActiveFileMtime=null;this.listenersActive=!1;this.handleActiveLeafChange=async e=>{if(!this.shouldHandleEvents()||eG.Platform.isMobile&&ae().disableIndexOnMobile||gN()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof eG.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}=Xc(),u=bl(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(()=>{ae().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},xlo))};this.handleFileDelete=async e=>{this.shouldHandleEvents()&&e instanceof eG.TFile&&await this.dbOps.removeDocs(e.path)};this.syncEventListeners(),al(()=>{this.syncEventListeners()})}shouldHandleEvents(){return ae().enableSemanticSearchV3}syncEventListeners(){let e=this.shouldHandleEvents();e&&!this.listenersActive?(B("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()}}});var vie,Ogr=v(()=>{vie=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 Rm,Eot=v(()=>{Rm=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 wie,Tgr,Egr=v(()=>{Qh();wie=class extends Vo{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","documents","transformers"])}invoke(e,r){return this.transformDocuments(e)}},Tgr=class extends wie{async transformDocuments(t){let e=[];for(let r of t){let n=await this._transformDocument(r);e.push(n)}return e}}});var Olo,tG=v(()=>{Bo();Eot();Egr();Olo={};Rt(Olo,{BaseDocumentTransformer:()=>wie,Document:()=>Rm,MappingDocumentTransformer:()=>Tgr})});var Pgr,Sie,Mgr=v(()=>{tG();sQe();Pgr=class extends wie{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 O=this.numberOfNewLines(c,w,y);d+=O}else if(w>y){let O=this.numberOfNewLines(c,y,w);d-=O}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 Rm({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}},Sie=class Pot extends Pgr{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 Pot({...n,separators:Pot.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 Mot=v(()=>{Mgr()});var Igr,bR,TTe,Rgr=v(()=>{Or();aV();_t();Ogr();ot();Zt();Igr=L(mV());Mot();bR=require("obsidian");vb();TTe=class{constructor(e,r,n){this.app=e;this.dbOps=r;this.embeddingsManager=n;this.state={isIndexingPaused:!1,isIndexingCancelled:!1,indexedCount:0,totalFilesToIndex:0,processedFiles:new Set,currentIndexingNotice:null,indexNoticeMessage:null};let o=ae();this.rateLimiter=new vie(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,al(async()=>{let i=ae();this.rateLimiter=new vie(i.embeddingRequestsPerMin),this.embeddingBatchSize=i.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize})}async indexVaultToVectorStore(e){let r=[];try{let n=await this.embeddingsManager.getEmbeddingsAPI();if(!n)return console.error("Embedding instance not found."),0;await this.dbOps.checkAndHandleEmbeddingModelChange(n)&&(e=!0),e?(await this.dbOps.clearIndex(n),this.dbOps.clearFilesMissingEmbeddings()):await this.dbOps.garbageCollect();let i=await this.getFilesToIndex(e);if(i.length===0)return new bR.Notice("Copilot vault index is up-to-date."),0;this.initializeIndexingState(i.length),this.createIndexingNotice(),this.dbOps.clearFilesMissingEmbeddings();let a=await this.prepareAllChunks(i);if(a.length===0)return new bR.Notice("No valid content to index."),0;for(let s=0;s<a.length&&!this.state.isIndexingCancelled;s+=this.embeddingBatchSize){await this.handlePause();let u=a.slice(s,s+this.embeddingBatchSize);try{await this.rateLimiter.wait();let l=await n.embedDocuments(u.map(f=>f.content));if(!l||l.length!==u.length)throw new Error(`Embedding model returned ${l?.length??0} embeddings for ${u.length} documents`);for(let f=0;f<u.length;f++){let p=u[f],m=l[f];if(!m||!Array.isArray(m)||m.length===0){ne(`Invalid embedding for document ${p.fileInfo.path}: ${m}`),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}try{await this.dbOps.upsert({...p.fileInfo,id:this.getDocHash(p.content),content:p.content,embedding:m,created_at:Date.now(),nchars:p.content.length}),this.state.processedFiles.add(p.fileInfo.path)}catch(h){this.handleError(h,{filePath:p.fileInfo.path,errors:r}),this.dbOps.markFileMissingEmbeddings(p.fileInfo.path);continue}}this.state.indexedCount=this.state.processedFiles.size,this.updateIndexingNoticeMessage();let c=Math.floor((this.state.indexedCount-u.length)/this.checkpointInterval);Math.floor(this.state.indexedCount/this.checkpointInterval)>c&&(await this.dbOps.saveDB(),console.log("Copilot index checkpoint save completed."))}catch(l){if(this.handleError(l,{filePath:u?.[0]?.fileInfo?.path,errors:r,batch:u}),this.isRateLimitError(l))break}}return this.finalizeIndexing(r),setTimeout(()=>{this.dbOps.saveDB().then(()=>{B("Copilot index final save completed."),this.dbOps.checkIndexIntegrity().catch(s=>{ne("Background integrity check failed:",s)})}).catch(s=>{ne("Background save failed:",s)})},100),this.state.indexedCount}catch(n){return this.handleError(n),0}}async prepareAllChunks(e){let r=await this.embeddingsManager.getEmbeddingsAPI();if(!r)return console.error("Embedding instance not found."),[];let n=gd.getModelName(r),o=Sie.fromLanguage("markdown",{chunkSize:jz}),i=[];for(let a of e){let s=await this.app.vault.cachedRead(a);if(!s?.trim())continue;let u=this.app.metadataCache.getFileCache(a),l={title:a.basename,path:a.path,embeddingModel:n,ctime:a.stat.ctime,mtime:a.stat.mtime,tags:u?.tags?.map(d=>d.tag)??[],extension:a.extension,metadata:{...u?.frontmatter??{},created:eg(new Date(a.stat.ctime)).display,modified:eg(new Date(a.stat.mtime)).display}};(await o.createDocuments([s],[],{chunkHeader:`
|
||
|
||
NOTE TITLE: [[${l.title}]]
|
||
|
||
METADATA:${JSON.stringify(l.metadata)}
|
||
|
||
NOTE BLOCK CONTENT:
|
||
|
||
`,appendChunkOverlapHeader:!0})).forEach(d=>{d.pageContent.trim()&&i.push({content:d.pageContent,fileInfo:l})})}return i}getDocHash(e){return(0,Igr.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=Xc(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>bl(c,r,n));let i=new Set(await this.dbOps.getIndexedFiles()),a=await this.dbOps.getLatestFileMtime(),s=new Set(this.dbOps.getFilesMissingEmbeddings()),u=new Set,l=new Set;for(let c of o){if(!bl(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 B([`Files to index: ${u.size}`,`Previously indexed: ${i.size}`,`Empty files skipped: ${l.size}`,`Files missing embeddings: ${s.size}`].join(`
|
||
`)),Array.from(u)}initializeIndexingState(e){this.state={isIndexingPaused:!1,isIndexingCancelled:!1,indexedCount:0,totalFilesToIndex:e,processedFiles:new Set,currentIndexingNotice:null,indexNoticeMessage:null}}createIndexingNotice(){let e=document.createDocumentFragment(),r=e.createEl("div",{cls:"copilot-notice-container"});this.state.indexNoticeMessage=r.createEl("div",{cls:"copilot-notice-message"}),this.updateIndexingNoticeMessage();let n=r.createEl("div",{cls:"copilot-notice-buttons"}),o=n.createEl("button");o.textContent="Pause",o.addEventListener("click",a=>{a.stopPropagation(),a.preventDefault(),this.state.isIndexingPaused?(this.resumeIndexing(),o.textContent="Pause"):(this.pauseIndexing(),o.textContent="Resume")});let i=n.createEl("button");return i.textContent="Stop",i.style.marginLeft="8px",i.addEventListener("click",a=>{a.stopPropagation(),a.preventDefault(),this.cancelIndexing()}),e.appendChild(this.state.indexNoticeMessage),e.appendChild(n),this.state.currentIndexingNotice=new bR.Notice(e,0),this.state.currentIndexingNotice}async handlePause(){if(this.state.isIndexingPaused){for(;this.state.isIndexingPaused&&!this.state.isIndexingCancelled;)await new Promise(e=>setTimeout(e,100));if(!this.state.isIndexingCancelled){let e=await this.getFilesToIndex();if(e.length===0){console.log("No files to index after filter change, stopping indexing"),this.cancelIndexing(),new bR.Notice("No files to index with current filters");return}this.state.totalFilesToIndex=e.length,console.log("Total files to index:",this.state.totalFilesToIndex),console.log("Files to index:",e),this.updateIndexingNoticeMessage()}}}pauseIndexing(){this.state.isIndexingPaused=!0}resumeIndexing(){this.state.isIndexingPaused=!1}updateIndexingNoticeMessage(){if(this.state.indexNoticeMessage){let e=this.state.isIndexingPaused?" (Paused)":"",r=["Copilot is indexing your vault...",`${this.state.indexedCount}/${this.state.totalFilesToIndex} files processed${e}`],n=ae(),o=O_(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...yie(this.app),...O_(n.qaExclusions)];a.length>0&&r.push(`Exclusions: ${a.join(", ")}`),this.state.indexNoticeMessage.textContent=r.join(`
|
||
`)}}isStringLengthError(e){if(!e)return!1;if(e instanceof RangeError&&e.message.toLowerCase().includes("string length"))return!0;let n=(e.message||e.toString()).toLowerCase();return n.includes("string length")||n.includes("rangeerror")}handleError(e,r){let n=r?.filePath;if(n?(r.batch?console.error("Batch processing error:",{error:e,batchSize:r.batch.length||0,firstChunk:r.batch[0]?{path:r.batch[0].fileInfo?.path,contentLength:r.batch[0].content?.length,hasFileInfo:!!r.batch[0].fileInfo}:"No chunks in batch",errorType:e?.constructor?.name,errorMessage:e?.message}):console.error(`Error indexing file ${n}:`,e),r.errors?.push(n)):console.error("Fatal error during indexing:",e),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide(),this.isStringLengthError(e)){new bR.Notice("Vault is too large for 1 partition, please increase the number of partitions in your Copilot QA settings!",1e4);return}if(this.isRateLimitError(e))return;let o=n?`Error indexing file ${n}. Check console for details.`:"Fatal error during indexing. Check console for details.";new bR.Notice(o)}isRateLimitError(e){return e?.message?.includes?.("rate limit")||!1}finalizeIndexing(e){if(this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide(),this.state.isIndexingCancelled){new bR.Notice("Indexing cancelled");return}e.length>0?new bR.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new bR.Notice("Indexing completed successfully!")}async reindexFile(e){try{let r=await this.embeddingsManager.getEmbeddingsAPI();if(!r)return;if(await this.dbOps.removeDocs(e.path),await this.dbOps.checkAndHandleEmbeddingModelChange(r)){await this.indexVaultToVectorStore(!0);return}let o=await this.prepareAllChunks([e]);if(o.length===0)return;let i=await r.embedDocuments(o.map(a=>a.content));for(let a=0;a<o.length;a++){let s=o[a];await this.dbOps.upsert({...s.fileInfo,id:this.getDocHash(s.content),content:s.content,embedding:i[a],created_at:Date.now(),nchars:s.content.length})}this.dbOps.markUnsavedChanges(),ae().debug&&console.log(`Reindexed file: ${e.path}`)}catch(r){this.handleError(r,{filePath:e.path})}}async cancelIndexing(){console.log("Indexing cancelled by user"),this.state.isIndexingCancelled=!0,await new Promise(e=>setTimeout(e,100)),this.state.currentIndexingNotice&&this.state.currentIndexingNotice.hide()}}});var xg={};Rn(xg,{default:()=>D1});var Cie,D1,Am=v(()=>{Xw();aV();ot();Cie=require("obsidian");_ie();xgr();Rgr();D1=class t{constructor(){this.embeddingsManager=gd.getInstance(),this.dbOps=new yR(app),this.indexOps=new TTe(app,this.dbOps,this.embeddingsManager),this.eventHandler=new OTe(app,this.indexOps,this.dbOps),this.initializationPromise=this.initialize(),this.setupSettingsSubscription()}static getInstance(){return t.instance||(t.instance=new t),t.instance}setupSettingsSubscription(){this.lastKnownSettings={...ae()};let e=async()=>{let r=ae(),n=this.lastKnownSettings;if(this.lastKnownSettings={...r},r.enableIndexSync!==n?.enableIndexSync){let o=await this.dbOps.getDbPath();this.dbOps.getCurrentDbPath()!==o&&await this.dbOps.initializeDB(await this.embeddingsManager.getEmbeddingsAPI())}};al(()=>{this.initializationPromise=e()})}async initialize(){if(ae().enableSemanticSearchV3)try{let r=3;for(;r>0;)try{let n=await this.embeddingsManager.getEmbeddingsAPI();await this.dbOps.initializeDB(n);break}catch(n){if(n instanceof Ao&&n.message.includes("Vault adapter not available")&&(r--,r>0)){await new Promise(o=>setTimeout(o,100));continue}new Cie.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){return await this.waitForInitialization(),Cie.Platform.isMobile&&ae().disableIndexOnMobile?(new Cie.Notice("Indexing is disabled on mobile devices"),0):this.indexOps.indexVaultToVectorStore(e)}async clearIndex(){await this.waitForInitialization(),await this.dbOps.clearIndex(await this.embeddingsManager.getEmbeddingsAPI())}async garbageCollectVectorStore(){return await this.waitForInitialization(),this.dbOps.garbageCollect()}async getIndexedFiles(){return await this.waitForInitialization(),this.dbOps.getIndexedFiles()}async isIndexEmpty(){return await this.waitForInitialization(),await this.dbOps.isIndexEmpty()}async hasIndex(e){return await this.waitForInitialization(),this.dbOps.hasIndex(e)}onunload(){this.eventHandler.cleanup(),this.dbOps.onunload()}async getDbOps(){return await this.waitForInitialization(),this.dbOps}async getDb(){await this.waitForInitialization();let e=this.dbOps.getDb();if(!e)throw new Error("Database is not loaded. Please restart the plugin.");return e}async reindexFile(e){await this.waitForInitialization(),await this.indexOps.reindexFile(e)}}});function nWe(t){return t.split("|")[1]==="copilot-plus"}function rG(){return zr().isPlusUser}async function $S(t){return ae().plusLicenseKey?(await pc.getInstance().validateLicenseKey(t)).isValid:(jot(),!1)}function Ngr(){let t=Tlo,e=Aot,r=ae().embeddingModelKey;B("applyPlusSettings: Changing embedding model",{from:r,to:e,changed:r!==e}),mAt(t),Lz("copilot_plus"),t_({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e?(B("applyPlusSettings: Embedding model changed, triggering indexing"),Promise.resolve().then(()=>(Am(),xg)).then(async n=>{await n.default.getInstance().indexVaultToVectorStore()}).catch(n=>{ne("Failed to trigger indexing after Plus settings applied:",n),new Agr.Notice("Failed to update Copilot index. Please try force reindexing from the command palette.")})):B("applyPlusSettings: No embedding model change, skipping indexing")}function Not(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function n4(t){window.open(Not(t),"_blank")}function jgr(){Ue("isPlusUser",!0)}function jot(){let t=ae().isPlusUser;Ue("isPlusUser",!1),t&&new Zye(app).open()}var Agr,Iot,Tlo,Rot,Aot,Q4a,e2a,Nv=v(()=>{qs();Bc();k$t();Or();mR();_t();ot();Agr=require("obsidian"),Iot="copilot-plus-flash",Tlo=Iot+"|"+"copilot-plus",Rot="copilot-plus-small",Aot=Rot+"|"+"copilot-plus",Q4a=Di.defaultModelKey,e2a=Di.embeddingModelKey});function bk(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 ETe=v(()=>{});var pc,mR=v(()=>{Or();hN();Xw();_t();Nv();ot();ETe();pc=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!ae().plusLicenseKey)throw new Pz("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=ae().userId;let a=new URL(`${fHe}${e}`);n==="GET"&&Object.entries(r).forEach(([l,c])=>{a.searchParams.append(l,c)});let s=await fetch(a.toString(),{method:n,headers:{"Content-Type":"application/json",...!o&&{Authorization:`Bearer ${await Do(ae().plusLicenseKey)}`},"X-Client-Version":this.pluginVersion},...n==="POST"&&{body:JSON.stringify(r)}}),u=await s.json();if(!s.ok)try{let l=u.detail,c=new Error(l.reason);return c.name=l.error,{data:null,error:c}}catch{return{data:null,error:new Error("Unknown error")}}return B(`[API ${e} request]:`,u),{data:u}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",ae().userId);let o=new URL(`${fHe}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await Do(ae().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 B(`[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 Do(ae().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"?(jot(),{isValid:!1}):{isValid:void 0}:(jgr(),{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=bk(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}}});var Dgr,nG,Dot=v(()=>{_t();Dgr=L(mV()),nG=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)||(B("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,Dgr.MD5)(n).toString()}getCachePath(e){return`${this.cacheDir}/${e}.md`}async get(e){try{let r=this.memoryCache.get(e);if(r)return B("Memory cache hit for file:",e),r.content;let n=this.getCachePath(e);if(await app.vault.adapter.exists(n)){B("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 B("Cache miss for file:",e),null}catch(r){return ne("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),B("Cached file content:",e)}catch(n){ne("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),B("Removed file from cache:",e))}catch(r){ne("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);B("Clearing file cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ne("Error clearing file cache:",e)}}}});var oG=S((p2a,Fgr)=>{var Elo="Expected a function",$gr=NaN,Plo="[object Symbol]",Mlo=/^\s+|\s+$/g,Ilo=/^[-+]0x[0-9a-f]+$/i,Rlo=/^0b[01]+$/i,Alo=/^0o[0-7]+$/i,Nlo=parseInt,jlo=typeof window=="object"&&window&&window.Object===Object&&window,Dlo=typeof self=="object"&&self&&self.Object===Object&&self,$lo=jlo||Dlo||Function("return this")(),Llo=Object.prototype,Flo=Llo.toString,klo=Math.max,qlo=Math.min,$ot=function(){return $lo.Date.now()};function Ulo(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(Elo);e=Lgr(e)||0,Lot(r)&&(c=!!r.leading,d="maxWait"in r,i=d?klo(Lgr(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(T){var P=n,M=o;return n=o=void 0,l=T,a=t.apply(M,P),a}function m(T){return l=T,s=setTimeout(g,e),c?p(T):a}function h(T){var P=T-u,M=T-l,I=e-P;return d?qlo(I,i-M):I}function y(T){var P=T-u,M=T-l;return u===void 0||P>=e||P<0||d&&M>=i}function g(){var T=$ot();if(y(T))return b(T);s=setTimeout(g,h(T))}function b(T){return s=void 0,f&&n?p(T):(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($ot())}function O(){var T=$ot(),P=y(T);if(n=arguments,o=this,u=T,P){if(s===void 0)return m(u);if(d)return s=setTimeout(g,e),p(u)}return s===void 0&&(s=setTimeout(g,e)),a}return O.cancel=_,O.flush=w,O}function Lot(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Blo(t){return!!t&&typeof t=="object"}function zlo(t){return typeof t=="symbol"||Blo(t)&&Flo.call(t)==Plo}function Lgr(t){if(typeof t=="number")return t;if(zlo(t))return $gr;if(Lot(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Lot(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(Mlo,"");var r=Rlo.test(t);return r||Alo.test(t)?Nlo(t.slice(2),r?2:8):Ilo.test(t)?$gr:+t}Fgr.exports=Ulo});var kgr,PTe,qgr,_k,Yv,iG=v(()=>{Dot();_t();vb();ot();kgr=L(mV()),PTe=require("obsidian"),qgr=L(oG());_ot();_k=class _k{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.projectMutexMap=new Map;this.mutexCreationMutex=new pV;this.handleFileEvent=e=>{e instanceof PTe.TFile&&this.debouncedHandleFileChange(e)};this.handleFileChange=async e=>{try{if(e.extension!=="md")return;let n=ae().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=Xc({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});bl(e,i,a,!0)&&(await this.invalidateMarkdownContext(o),B(`Invalidated markdown context for project ${o.name} due to file change: ${e.path}`))}}catch(r){ne("Error handling file change for project context cache:",r)}};this.debouncedHandleFileChange=(0,qgr.default)(e=>{this.handleFileChange(e)},_k.DEBOUNCE_DELAY,{leading:!0,trailing:!0});this.vault=app.vault,this.fileCache=nG.getInstance(),this.initializeEventListeners()}static getInstance(){return _k.instance||(_k.instance=new _k),_k.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)||(B("Creating project context cache directory:",this.cacheDir),await this.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){return(0,kgr.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 pV;return this.projectMutexMap.set(r,i),B(`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 B("Memory cache hit for project:",e.name),n;let o=this.getCachePath(r);if(await this.vault.adapter.exists(o)){B("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 B("Cache miss for project:",e.name),null}catch(r){return ne("Error reading from project context cache:",r),null}}async getOrInitializeCache(e){let r=await this.get(e);if(r)return B(`[getOrInitializeCache] Project ${e.name}: Existing cache found. MarkdownNeedsReload: ${r.markdownNeedsReload}`),r;B(`[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?(B("Memory cache hit for project:",e.name),n):(B("Memory cache miss for project:",e.name),null)}catch(r){return ne("Error reading from project context memory cache:",r),null}}async set(e,r){let n=await this.getOrCreateProjectMutex(e);return n.isLocked()&&B(`Waiting for project cache lock for project: ${e.name}`),await n.runExclusive(async()=>(B(`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);B("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 ne("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);B("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);B(`Cleared ${e.size} file content cache entries associated with projects`)}catch(e){ne("Error clearing project context cache:",e)}}async clearForProject(e){try{B(`[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){B(`[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++):Be(`[clearForProject] Project ${e.name}: Skipped removing FileCache entry for file ${s} due to missing cacheKey.`)}B(`[clearForProject] Project ${e.name}: Attempted to clear ${o} entries from FileCache.`)}}else B(`[clearForProject] Project ${e.name}: No fileContexts found in existing project cache to clear from FileCache.`);this.memoryCache.delete(r),B(`[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),B(`[clearForProject] Project ${e.name}: Successfully removed main project cache file: ${i}`)):B(`[clearForProject] Project ${e.name}: Main project cache file not found (already deleted or never existed): ${i}`),this.projectMutexMap.delete(e.id),B(`[clearForProject] Cleaned up mutex for project: ${e.name}`),B(`[clearForProject] Completed for project: ${e.name}`)}catch(r){ne(`[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={},B(`Flagged Web/YouTube contexts for full reload for project ${e.name}`));let o=this.cleanupFileReferencesInCache(e,n);return B(`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,B(`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),B(`Reused cached content from other project for: ${r} in project ${e.name}`),o.content):null}catch(n){return ne(`Error in getOrReuseFileContext for ${r} in project ${e.name}:`,n),null}}async getFileContext(e,r){try{if(!r||typeof r!="string")return ne("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 Be(`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"?(Be(`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 ne(`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 PTe.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},B(`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),B(`Removed file context for ${r} in project ${e.name}`)}return n})}async searchOtherProjectsForFile(e){try{let n=ae().projectList||[];if(n.length===0)return null;B(`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 B(`Found content for file ${e} in project ${o.name}`),{content:s,cacheKey:a}}}return B(`No content found in any project for file: ${e}`),null}catch(r){return ne(`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},B(`Associated cache with project ${e.name} for file: ${r}`),o))}cleanupFileReferencesInCache(e,r){if(!r.fileContexts)return r;let{inclusions:n,exclusions:o}=Xc({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 PTe.TFile)||!bl(u,n,o,!0)?i++:a[s]=r.fileContexts[s]}return i>0&&(r.fileContexts=a,B(`Removed ${i} file references from project ${e.name} that no longer match inclusion patterns`)),r}async cleanupProjectFileReferences(e){B(`[cleanupProjectFileReferences] Starting for project: ${e.name}`);try{await this.updateCacheSafely(e,r=>this.cleanupFileReferencesInCache(e,r),!0)}catch(r){ne(`Error cleaning up project file references for ${e.name}:`,r)}}async updateProjectFilesFromPatterns(e,r){try{B(`[updateProjectFilesFromPatterns] Starting for project: ${e.name}`),r.fileContexts||(r.fileContexts={});let{inclusions:n,exclusions:o}=Xc({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(bl(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&&B(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${a} new file references to context (in memory).`),B(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(n){ne(`[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&&B(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${i} new file references to context (in memory).`),B(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total markdown fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(o){ne(`[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];B(`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,B(`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];B(`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,B(`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 ne(`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 ne(`Error updating cache for project ${e.name}:`,i),i}})}async setCacheSafely(e,r){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>(B(`External safe set for project: ${e.name}`),await this.setWithoutMutex(e,r)))}};_k.DEBOUNCE_DELAY=5e3;Yv=_k});var hV,_R,gV,Fot=v(()=>{_t();Zt();ETe();hV=require("obsidian"),_R=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 ne(`Unsupported image format from URL path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;try{let c=(await Nl(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?(ne(`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 hV.TFile?i.stat.size>this.MAX_IMAGE_SIZE?(ne(`Vault file too large: ${i.stat.size} bytes for path: ${e}`),!1):!0:(ne(`File with image extension not found in vault: ${e}.`),!1)}else return n&&ne(`Unsupported image format for potential vault path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;return ne(`Could not determine image status for URL/path: ${e}`),!1}catch(n){return ne(`Unexpected error in isImageUrl for "${e}":`,n),!1}}static async handleVaultImage(e,r){try{if(e.stat.size>this.MAX_IMAGE_SIZE)return ne(`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 ne(`Invalid MIME type: ${o}, skipping: ${e.path}`),null;let i=bk(n);return`data:${o};base64,${i}`}catch(n){return ne("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await Nl(e,{method:"GET",headers:{}});if(!r.ok)return ne(`Failed to fetch image: ${r.statusText}, URL: ${e}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return ne(`Invalid content type: ${n}, URL: ${e}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return ne(`Image too large: ${o.byteLength} bytes, URL: ${e}`),null;let i=bk(o);return`data:${n};base64,${i}`}catch(r){return ne("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 hV.TFile))return ne(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return ne(`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 ne(`Invalid MIME type: ${a}, path: ${n}`),null;let s=bk(i);return`data:${a};base64,${s}`}catch(n){return ne("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 hV.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 hV.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}}:(ne(`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 ne(i),new Error(i)}return o}};_R.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],_R.MAX_IMAGE_SIZE=3*1024*1024,_R.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};gV=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 ne("Error processing URL batch:",o),{successfulImages:[],failureDescriptions:e.map(i=>`Image read failed for: ${i}`)}}}static async processSingleUrl(e,r,n){try{if(!await _R.isImageUrl(e,n))return null;let o=await _R.convertToBase64(e,n);return o||(r.push(e),null)}catch(o){return ne(`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){ne("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 _R.convertToBase64(e.image_url.url,n);return o||(r.push(e.image_url.url),null)}catch(o){return ne(`Failed to process chat image: ${e.image_url.url}`,o),r.push(e.image_url.url),null}}static showFailedImagesNotice(e){e.length>0&&new hV.Notice(`Failed to process images:
|
||
${e.join(`
|
||
`)}`)}}});var aG,kot=v(()=>{Fot();mR();Zt();_t();aG=class t{constructor(){this.mentions=new Map,this.brevilabsClient=pc.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=Sn(r);return ne(`Error processing URL ${e}: ${n}`),{response:e,elapsed_time_ms:0,error:n}}}async processYoutubeUrl(e){try{return{transcript:(await this.brevilabsClient.youtube4llm(e)).response.transcript}}catch(r){let n=Sn(r);return ne(`Error processing YouTube URL ${e}: ${n}`),{transcript:"",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 _R.isImageUrl(s,app.vault))return n.push(s),{type:"image",url:s};if(NRt(s)){if(!this.mentions.has(s)){let u=await this.processYoutubeUrl(s);this.mentions.set(s,{type:"youtube",original:s,processed:u.transcript,error:u.error})}return{type:"youtube",data:this.mentions.get(s)}}if(!this.mentions.has(s)){let u=await this.processUrl(s);this.mentions.set(s,{type:"url",original:s,processed:u.response,error:u.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_transcript>
|
||
<url>${u.original}</url>
|
||
<transcript>
|
||
${u.processed}
|
||
</transcript>
|
||
</youtube_transcript>`: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()}}});var Ugr,MTe,Bgr=v(()=>{_t();Ugr=L(mV()),MTe=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)||(B("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,Ugr.MD5)(r).toString();return B("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)){B("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return B("Cache miss for PDF:",e.path),null}catch(r){return ne("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);B("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){ne("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);B("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ne("Error clearing PDF cache:",e)}}}});function $1(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 zgr(t){let r=(t?.message||t?.toString()||"").match(/Try again in ([\d\w\s]+)/);return r?r[1]:"some time"}var xie=v(()=>{});var Vgr,RTe,Hgr,ITe,Jgr=v(()=>{Vgr=require("obsidian"),ITe=class{constructor(e){this.vault=e;aqe(this,RTe)}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 Vgr.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];Awt(this,RTe,Hgr).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}};RTe=new WeakSet,Hgr=function(e,r){let n=e.filter(o=>o.type==="group");for(let o of n)for(let i of e){if(i.id===o.id)continue;let a=i.x+i.width/2,s=i.y+i.height/2;a>=o.x&&s>=o.y&&a<=o.x+o.width&&s<=o.y+o.height&&r.push({id:crypto.randomUUID(),fromNode:o.id,toNode:i.id,label:"contains"})}}});var Wgr,qot,ATe,Uot,sG,Oie,vk,NTe=v(()=>{Bgr();iG();_t();xie();Wgr=require("obsidian");Jgr();qot=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},ATe=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=MTe.getInstance()}async parseFile(e,r){try{B("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return B("Using cached PDF content for:",e.path),n.response;let o=await r.readBinary(e);B("Calling pdf4llm API for:",e.path);let i=await this.brevilabsClient.pdf4llm(o);return await this.pdfCache.set(e,i),i.response}catch(n){return ne(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){B("Clearing PDF cache"),await this.pdfCache.clear()}},Uot=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{B("Parsing Canvas file:",e.path);let n=new ITe(r),o=await n.load(e);return n.buildPrompt(o)}catch(n){return ne(`Error parsing Canvas file ${e.path}:`,n),`[Error: Could not parse Canvas file ${e.basename}]`}}},sG=class sG{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=Yv.getInstance(),this.currentProject=r}static resetRateLimitNoticeTimer(){sG.lastRateLimitNoticeTime=0}async parseFile(e,r){try{if(B(`[Docs4LLMParser] Project ${this.currentProject?.name}: Parsing ${e.extension} file: ${e.path}`),!this.currentProject)throw ne("[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 B(`[Docs4LLMParser] Project ${this.currentProject.name}: Using cached content for: ${e.path}`),n;B(`[Docs4LLMParser] Project ${this.currentProject.name}: Cache miss for: ${e.path}. Proceeding to API call.`);let o=await r.readBinary(e);B(`[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),B(`[Docs4LLMParser] Project ${this.currentProject.name}: Successfully processed and cached: ${e.path}`),a}catch(n){throw ne(`[Docs4LLMParser] Project ${this.currentProject?.name}: Error processing file ${e.path}:`,n),$1(n)&&this.showRateLimitNotice(n),n}}showRateLimitNotice(e){let r=Date.now();if(r-sG.lastRateLimitNoticeTime<6e4)return;sG.lastRateLimitNoticeTime=r;let n=zgr(e);new Wgr.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(){B("Cache clearing is now handled at the project level")}};sG.lastRateLimitNoticeTime=0;Oie=sG,vk=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.isProjectMode=n,this.currentProject=o,this.registerParser(new qot),this.registerParser(new Oie(e,o)),n||this.registerParser(new ATe(e)),this.registerParser(new Uot)}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 ATe&&await e.clearCache()}}});var Wot={};Rn(Wot,{createToolCallMarker:()=>DTe,decodeResultFromMarker:()=>Vot,decodeToolCallMarkerResults:()=>Jlo,ensureEncodedToolCallMarkerResults:()=>jTe,parseToolCallMarkers:()=>Hot,updateToolCallMarker:()=>Jot});function zot(t){try{return`ENC:${encodeURIComponent(t)}`}catch{return t}}function Vot(t){if(typeof t!="string"||!t.startsWith("ENC:"))return t;try{return decodeURIComponent(t.slice(4))}catch{return t}}function Hlo(t){return`Tool '${t}' ${Vlo}`}function Jlo(t){return!t||typeof t!="string"?t:t.replace(/<!--TOOL_CALL_END:([^:]+):(ENC:[\s\S]*?)-->/g,(e,r,n)=>{let o=Vot(n)||n;return`<!--TOOL_CALL_END:${r}:${o}-->`})}function jTe(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=zot(n);return`<!--TOOL_CALL_END:${r}:${o}-->`})}function Bot(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 Hot(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);Bot(_,o,e).forEach(O=>{O.type==="text"&&O.content.trim()?r.push({type:"text",content:O.content}):O.type==="error"&&O.error&&r.push({type:"error",content:O.content,error:O.error})})}let[a,s,u,l,c,d,f,p,m]=i,y=Vot(typeof m=="string"?m:""),b=(typeof y=="string"?y.length:0)>5e3?Hlo(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);Bot(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&&Bot(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 DTe(t,e,r,n,o="",i=!0,a="",s=""){let u=s&&zot(s);return`<!--TOOL_CALL_START:${t}:${e}:${r}:${n}:${o}:${i}-->${a}<!--TOOL_CALL_END:${t}:${u}-->`}function Jot(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=zot(r);return t.replace(o,`$1false$2${i}-->`)}var Vlo,Tie=v(()=>{Vlo=`Result omitted to keep the UI responsive (payload exceeded ${5e3.toLocaleString()} characters).`});var L1,Pie=v(()=>{Or();_t();Zt();L1=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 f=s||e||"[Response truncated - no content generated]";await this.chainManager.memoryManager.getMemory().saveContext({input:r.message},{output:f});let m={message:e||(u?.wasTruncated?"_[The response was truncated before any content could be generated. Try increasing the max tokens limit.]_":""),sender:nC,isVisible:!0,timestamp:eg(new Date),sources:a,responseMetadata:u};o(m),i("")}else n.signal.reason==="new-chat"&&i("");let c=this.chainManager.memoryManager.getMemory().chatHistory.messages;B(`Chat memory updated:
|
||
`,{turns:Array.isArray(c)?c.length:0});let d=2e3;try{let{parseToolCallMarkers:f}=await Promise.resolve().then(()=>(Tie(),Wot)),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;B(`Final AI response (truncated):
|
||
`,h)}catch{let f=typeof e=="string"?e:String(e??""),p=f.length>d?f.slice(0,d)+"... (truncated)":f;B(`Final AI response (truncated):
|
||
`,p)}return e}async handleError(e,r){let n=Sn(e);ne("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}`,ne(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))}}});var vR,Mie=v(()=>{_t();vR=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&&B("[LayerToMessagesConverter] Added L2 (cumulative context) to system")),a.push({role:"system",content:f.join(`
|
||
`)}),i&&B("[LayerToMessagesConverter] Added L1 (System) + L2 (Cumulative) as stable prefix")}if(c&&c.text&&i&&B("[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&&B(`[LayerToMessagesConverter] Added L3: ${m.length} references, ${h.length} new items`)}}else l&&l.text&&(f.push(l.text),i&&B("[LayerToMessagesConverter] Added L3 (all new context)"));f.length>0&&d&&d.text&&f.push(`---
|
||
|
||
[User query]:`),d&&d.text&&(f.push(d.text),i&&B("[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&&(B(`[LayerToMessagesConverter] Converted envelope to ${a.length} messages`),a.forEach((f,p)=>{let m=f.content.substring(0,100);B(` 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}}});function Kot(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=Wlo(r);n&&e.push({role:n,content:r.content})}}return e}function Wlo(t){return t.role==="human"||t.role==="user"||t.sender==="user"?"user":t.role==="ai"||t.role==="assistant"||t.sender==="AI"?"assistant":null}function Klo(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 Kgr(t){return t.map(e=>({role:e.role,content:Klo(e.content)}))}async function wk(t,e){let n=(await t.loadMemoryVariables({})).history||[];if(!n.length)return[];let o=Kot(n);for(let i of o)e.push({role:i.role,content:i.content});return o}var uG=v(()=>{});var bd,yV=v(()=>{bd=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}clear(){this.tools.clear()}}});function Glo(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 Xlo(t,e){let r=[];e&&(r.push(`msg:${e.messageId??"N/A"} | conv:${e.conversationId??"N/A"} | v${e.version}`),r.push(""));let n=bd.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 O=m.text.length>300?m.text.substring(0,300)+"...[truncated]":m.text;r.push(O),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 Sk(t){let{messages:e,modelName:r,contextEnvelope:n}=t;try{lG={timestamp:new Date().toISOString(),modelName:r,serializedMessages:Glo(e),messagesArray:e,contextEnvelope:n}}catch{lG={timestamp:new Date().toISOString(),modelName:r,serializedMessages:String(e),messagesArray:e,contextEnvelope:n}}}function cG(){lG=null}async function $Te(){if(!lG)return;let{timestamp:t,modelName:e,serializedMessages:r,messagesArray:n,contextEnvelope:o}=lG,i=[`### Prompt \u2014 ${t}${e?` \u2014 ${e}`:""}`,"","**Actual Messages Sent to LLM:**","","```json",r,"```",""],a=Xlo(n,o);i.push("**Layered Context Metadata:**"),i.push(""),i.push("```"),i.push(a),i.push("```"),i.push(""),ige(i),lG=null}var lG,F1=v(()=>{_t();yV();lG=null});function Ggr(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 Xgr(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}var Zgr=v(()=>{});function Zlo(){return 1e4}function Ylo(t,e){let r=e??Zlo();if(!t||t.length<=r)return t;let n=t.substring(0,r),o=t.length-r;return`${n}
|
||
|
||
... (truncated ${o.toLocaleString()} characters)`}function Qlo(t,e,r){let n=Ylo(e,r);return`Tool '${t}' result: ${n}`}function Got(t,e=!1){return t.map(r=>e?Qlo(r.toolName,r.result):`Tool '${r.toolName}' result: ${r.result}`).join(`
|
||
|
||
`)}function eco(t){return`<errorChunk>${t}</errorChunk>`}function dG(t,e){let r=eco(t);return e?`${e}
|
||
${r}`:`
|
||
${r}`}var LTe=v(()=>{});var T_,bV=v(()=>{Zgr();LTe();T_=class{constructor(e,r,n=!1){this.updateCurrentAiMessage=e;this.modelAdapter=r;this.excludeThinking=n;this.hasOpenThinkBlock=!1;this.fullResponse="";this.errorResponse="";this.shouldTruncate=!1;this.wasTruncated=!1;this.tokenUsage=null}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+=r),n}handleDeepseekChunk(e){return typeof e.content=="string"&&(this.fullResponse+=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)}processChunk(e){if(this.shouldTruncate)return;Ggr(e).wasTruncated&&(this.wasTruncated=!0);let n=Xgr(e);n&&(this.tokenUsage=n);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.modelAdapter?.shouldTruncateStreaming?.(this.fullResponse)&&(this.shouldTruncate=!0,this.fullResponse=this.truncateToLastCompleteToolCall(this.fullResponse)),this.updateCurrentAiMessage(this.fullResponse)}truncateToLastCompleteToolCall(e){let r=e.lastIndexOf("</use_tool>");if(r===-1)return e;let n=e.substring(0,r+11);return this.modelAdapter?.sanitizeResponse?this.modelAdapter.sanitizeResponse(n,1):n}processErrorChunk(e){this.errorResponse=dG(e)}close(){return this.hasOpenThinkBlock&&(this.fullResponse+="</think>"),this.errorResponse&&(this.fullResponse+=this.errorResponse),this.updateCurrentAiMessage(this.fullResponse),{content:this.fullResponse,wasTruncated:this.wasTruncated,tokenUsage:this.tokenUsage}}}});var Iie,Ygr=v(()=>{Or();Mie();_t();ot();Zt();Pie();uG();F1();bV();qs();Iie=class extends L1{async constructMessages(e){if(!e.contextEnvelope)throw new Error("[LLMChainRunner] Context envelope is required but not available. Cannot proceed with LLM chain.");B("[LLMChainRunner] Using envelope-based context");let r=vR.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 wk(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=ae(),s=i_(),u=!1;try{u=!_O(s,a.activeModels).capabilities?.includes("reasoning")}catch(f){B("Could not determine model capabilities, defaulting to include thinking blocks",f)}let l=new T_(n,void 0,u);try{let f=await this.constructMessages(e),m=this.chainManager.chatModelManager.getChatModel()?.modelName;Sk({messages:f,modelName:m,contextEnvelope:e.contextEnvelope}),B(`Final Request to AI:
|
||
`,f);let h=await rh(()=>this.chainManager.chatModelManager.getChatModel().stream(f,{signal:r.signal}));for await(let y of h){if(r.signal.aborted){B("Stream iteration aborted",{reason:r.signal.reason});break}l.processChunk(y)}}catch(f){f.name==="AbortError"||r.signal.aborted?B("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)}}});async function FTe(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 rh(async()=>{let i=await(await Nm.instance.getCurrentChainManager().chatModelManager.getChatModelWithTemperature(0)).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]),a=Az(i.content);return JW(a)})}var Xot=v(()=>{k1();Zt()});var tco,vV,kTe=v(()=>{Bo();z$();rO();Qh();tco={};Rt(tco,{BaseRetriever:()=>vV});vV=class extends Vo{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=Qo(JA(r)),i=await(await rc.configure(n.callbacks,this.callbacks,n.tags,this.tags,n.metadata,this.metadata,{verbose:this.verbose}))?.handleRetrieverStart(this.toJSON(),e,n.runId,void 0,void 0,void 0,n.runName);try{let a=await this._getRelevantDocuments(e,i);return await i?.handleRetrieverEnd(a),a}catch(a){throw await i?.handleRetrieverError(a),a}}}});var Yot,Zot,Ck,qTe=v(()=>{_t();Or();Yot=require("obsidian");Mot();Zot={maxChars:jz,overlap:0,maxBytesTotal:10*1024*1024},Ck=class{constructor(e){this.app=e;this.cache=new Map;this.memoryUsage=0;this.splitter=Sie.fromLanguage("markdown",{chunkSize:jz,chunkOverlap:0,separators:[`
|
||
|
||
`,`
|
||
`,". "," ",""],keepSeparator:!1})}async getChunks(e,r={}){try{if(!Array.isArray(e))return Be("ChunkManager: Invalid notePaths provided"),[];if(e.length===0)return[];e.length>1e3&&(Be("ChunkManager: Too many note paths, limiting to 1000"),e=e.slice(0,1e3));let n=e.filter(a=>!(!a||typeof a!="string"||a.includes("..")||a.startsWith("/")));if(n.length===0)return Be("ChunkManager: No valid note paths provided"),[];let o={...Zot,...r},i=[];for(let a of n){let s=this.cache.get(a);if(!s&&(s=await this.generateChunksForNote(a,o),s.length>0)){let u=this.calculateChunkBytes(s);this.memoryUsage+u<=o.maxBytesTotal?(this.cache.set(a,s),this.memoryUsage+=u):Be(`ChunkManager: Skipping cache for ${a}, would exceed memory budget`)}i.push(...s)}return B(`ChunkManager: Retrieved ${i.length} chunks from ${n.length} notes (${this.formatMemoryUsage()})`),i}catch(n){return Be("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||Be(`ChunkManager: Chunk ${e} not found after regeneration`),o||null}async getValidatedChunks(e){let r=this.cache.get(e);if(!r&&(B(`ChunkManager: Cache miss for ${e}, regenerating...`),r=await this.regenerateChunks(e),!r||r.length===0))return Be(`ChunkManager: Failed to regenerate chunks for ${e}`),[];let n=this.app.vault.getAbstractFileByPath(e);return n&&n instanceof Yot.TFile&&r.length>0&&n.stat.mtime>r[0].mtime&&(B(`ChunkManager: File ${e} modified, regenerating chunks`),r=await this.regenerateChunks(e),!r||r.length===0)?(Be(`ChunkManager: Failed to regenerate chunks after modification for ${e}`),[]):r}getChunkTextSync(e){let[r]=e.split("#"),n=this.cache.get(r);return n?n.find(i=>i.id===e)?.content||"":(Be(`ChunkManager: Chunk not in cache: ${e} (use async getChunkText for auto-regeneration)`),"")}async regenerateChunks(e){try{let r=await this.generateChunksForNote(e,Zot);if(r.length>0){let n=this.calculateChunkBytes(r);if(this.memoryUsage+n<=Zot.maxBytesTotal){let o=this.cache.get(e);o&&(this.memoryUsage-=this.calculateChunkBytes(o)),this.cache.set(e,r),this.memoryUsage+=n}else Be(`ChunkManager: Cannot cache regenerated chunks for ${e}, would exceed memory budget`)}return r}catch(r){return Be(`ChunkManager: Failed to regenerate chunks for ${e}`,r),[]}}clearCache(){this.cache.clear(),this.memoryUsage=0,B("ChunkManager: Cache cleared")}async generateChunksForNote(e,r){try{let n=this.app.vault.getAbstractFileByPath(e);if(!n||!(n instanceof Yot.TFile))return[];let o=await this.safeReadFile(n);if(!o?.trim())return[];let a=(this.app.metadataCache.getFileCache(n)?.headings||[]).slice().sort((l,c)=>l.position.start.offset-c.position.start.offset),s=[],u=0;if(a.length===0){let l=await this.processContentSection(o,"",n,u,r);return s.push(...l),s}for(let l=0;l<a.length;l++){let c=a[l],d=a[l+1],f=c.position.start.offset,p=d?.position.start.offset||o.length,m=o.substring(f,p),h=await this.processContentSection(m,c.heading,n,u,r);s.push(...h),u+=h.length}return s}catch(n){return Be(`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{(await this.splitter.createDocuments([e],[],{chunkHeader:u,appendChunkOverlapHeader:i.overlap>0})).forEach((d,f)=>{let p=o+f,m=this.generateChunkId(n.path,p),h=this.calculateContentHash(d.pageContent);s.push({id:m,notePath:n.path,chunkIndex:p,content:d.pageContent,contentHash:h,title:a,heading:r,mtime:n.stat.mtime})})}catch(c){Be(`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}calculateChunkBytes(e){return e.reduce((r,n)=>r+Buffer.byteLength(n.content,"utf8"),0)}async safeReadFile(e){try{return(await this.app.vault.cachedRead(e))?.trim()||""}catch(r){return Be(`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`}}});var rco,nyr,oyr,Og,Rie,fG,nco,iyr,Aie,zTe,nit,Qot,oco,ayr,syr,ait,sit,uyr,ico,Nie,eit,aco,sco,uco,lco,tit,Qgr,cco,oit,iit,rit,dco,eyr,tyr,ryr,UTe,BTe,lyr,fco,cyr=v(()=>{rco="ENTRIES",nyr="KEYS",oyr="VALUES",Og="",Rie=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}=fG(this._path);if(fG(r)===Og)return{done:!1,value:this.result()};let n=e.get(fG(r));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;let e=fG(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>fG(e)).filter(e=>e!==Og).join("")}value(){return fG(this._path).node.get(Og)}result(){switch(this._type){case oyr:return this.value();case nyr:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}},fG=t=>t[t.length-1],nco=(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 iyr(t,e,r,n,a,1,o,""),n},iyr=(t,e,r,n,o,i,a,s)=>{let u=i*a;e:for(let l of t.keys())if(l===Og){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]+ +_,O=o[m+b+1]+1,T=o[p+b]+1,P=o[p+b+1]=Math.min(w,O,T);P<h&&(h=P)}if(h>r)continue e}iyr(t.get(l),e,r,n,o,c,a,s+l)}},Aie=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]=zTe(this._tree,e.slice(this._prefix.length));if(r===void 0){let[o,i]=ait(n);for(let a of o.keys())if(a!==Og&&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,oco(this._tree,e)}entries(){return new Rie(this,rco)}forEach(e){for(let[r,n]of this)e(r,n,this)}fuzzyGet(e,r){return nco(this._tree,e,r)}get(e){let r=nit(this._tree,e);return r!==void 0?r.get(Og):void 0}has(e){let r=nit(this._tree,e);return r!==void 0&&r.has(Og)}keys(){return new Rie(this,nyr)}set(e,r){if(typeof e!="string")throw new Error("key must be a string");return this._size=void 0,Qot(this._tree,e).set(Og,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=Qot(this._tree,e);return n.set(Og,r(n.get(Og))),this}fetch(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;let n=Qot(this._tree,e),o=n.get(Og);return o===void 0&&n.set(Og,o=r()),o}values(){return new Rie(this,oyr)}[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))}},zTe=(t,e,r=[])=>{if(e.length===0||t==null)return[t,r];for(let n of t.keys())if(n!==Og&&e.startsWith(n))return r.push([t,n]),zTe(t.get(n),e.slice(n.length),r);return r.push([t,e]),zTe(void 0,"",r)},nit=(t,e)=>{if(e.length===0||t==null)return t;for(let r of t.keys())if(r!==Og&&e.startsWith(r))return nit(t.get(r),e.slice(r.length))},Qot=(t,e)=>{let r=e.length;e:for(let n=0;t&&n<r;){for(let i of t.keys())if(i!==Og&&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},oco=(t,e)=>{let[r,n]=zTe(t,e);if(r!==void 0){if(r.delete(Og),r.size===0)ayr(n);else if(r.size===1){let[o,i]=r.entries().next().value;syr(n,o,i)}}},ayr=t=>{if(t.length===0)return;let[e,r]=ait(t);if(e.delete(r),e.size===0)ayr(t.slice(0,-1));else if(e.size===1){let[n,o]=e.entries().next().value;n!==Og&&syr(t.slice(0,-1),n,o)}},syr=(t,e,r)=>{if(t.length===0)return;let[n,o]=ait(t);n.set(o+e,r),n.delete(o)},ait=t=>t[t.length-1],sit="or",uyr="and",ico="and_not",Nie=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?rit:e.autoVacuum;this._options={...tit,...e,autoVacuum:r,searchOptions:{...Qgr,...e.searchOptions||{}},autoSuggestOptions:{...cco,...e.autoSuggestOptions||{}}},this._index=new Aie,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=iit,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 Aie,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=iit,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||oit.batchSize,i=e.batchWait||oit.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||rit.minDirtCount,n=n||rit.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(tyr),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(tyr),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(tit.hasOwnProperty(e))return eit(tit,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=UTe(o),u._fieldLength=UTe(i),u._storedFields=UTe(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),UTe(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 BTe(o),u._fieldLength=await BTe(i),u._storedFields=await BTe(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 BTe(m))}++l%1e3===0&&await lyr(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 Aie,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(lco(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]:eit(n.boost,y)||1}),{}),{boostDocument:i,weights:a,maxFuzzy:s,bm25:u}=n,{fuzzy:l,prefix:c}={...Qgr.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=sit){if(e.length===0)return new Map;let n=r.toLowerCase(),o=aco[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=uco(b,m,this._documentCount,_,h,u),O=n*o*d*g*w,T=l.get(y);if(T){T.score+=O,dco(T.terms,e);let P=eit(T.match,r);P?P.push(c):T.match[r]=[c]}else l.set(y,{score:O,terms:[e],match:{[r]:[c]}})}}return l}addTerm(e,r,n){let o=this._index.fetch(n,ryr),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,ryr),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)}}};Nie.wildcard=Symbol("*");eit=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0,aco={[sit]:(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),eyr(n.terms,i)}}return t},[uyr]:(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);eyr(o.terms,a),r.set(n,{score:o.score+i,terms:o.terms,match:Object.assign(o.match,s)})}return r},[ico]:(t,e)=>{for(let r of e.keys())t.delete(r);return t}},sco={k:1.2,b:.7,d:.5},uco=(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)))},lco=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}},tit={idField:"id",extractField:(t,e)=>t[e],stringifyField:(t,e)=>t.toString(),tokenize:t=>t.split(fco),processTerm:t=>t.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(t,e)=>{typeof console?.[t]=="function"&&console[t](e)},autoVacuum:!0},Qgr={combineWith:sit,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:sco},cco={combineWith:uyr,prefix:(t,e,r)=>e===r.length-1},oit={batchSize:1e3,batchWait:10},iit={minDirtFactor:.1,minDirtCount:20},rit={...oit,...iit},dco=(t,e)=>{t.includes(e)||t.push(e)},eyr=(t,e)=>{for(let r of e)t.includes(r)||t.push(r)},tyr=({score:t},{score:e})=>e-t,ryr=()=>new Map,UTe=t=>{let e=new Map;for(let r of Object.keys(t))e.set(parseInt(r,10),t[r]);return e},BTe=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 lyr(0);return e},lyr=t=>new Promise(e=>setTimeout(e,t)),fco=/[\n\r\p{Z}\p{P}]+/u});var pG,VTe,dyr=v(()=>{_t();ot();pG=class pG{constructor(){this.bytesUsed=0;let e=ae(),r=Math.min(1e3,Math.max(20,e.lexicalSearchRamLimit||100));this.maxBytes=r*pG.MB_TO_BYTES,this.candidateLimit=Math.min(pG.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,B(`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}};pG.DEFAULT_CANDIDATE_LIMIT=500,pG.MB_TO_BYTES=1024*1024;VTe=pG});var JTe,Au,HTe,fyr=v(()=>{_t();Or();cyr();JTe=require("obsidian");qTe();dyr();Au=class Au{constructor(e,r){this.app=e;this.index=null;this.indexedChunks=new Set;this.memoryManager=new VTe,this.chunkManager=r||new Ck(e)}createIndex(){return new Nie({fields:["title","heading","path","tags","body"],storeFields:["id","notePath","title","heading","chunkIndex"],tokenize:this.tokenizeMixed.bind(this),searchOptions:{boost:{title:Au.FIELD_WEIGHTS.title,heading:Au.FIELD_WEIGHTS.heading,path:Au.FIELD_WEIGHTS.path,tags:Au.FIELD_WEIGHTS.tags,body:Au.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){B(`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;B(`FullTextEngine: MiniSearch index created in ${n}ms`);let o={maxChars:jz,overlap:0,maxBytesTotal:this.memoryManager.getMaxBytes()*Au.CHUNK_MEMORY_PERCENTAGE},i=await this.chunkManager.getChunks(e,o);if(i.length===0)return B("FullTextEngine: No chunks generated"),0;B(`FullTextEngine: Generated ${i.length} chunks from ${e.length} notes`);let a=0,s=Au.BATCH_SIZE,u=new Map;for(let l=0;l<i.length;l++){let c=i[l],d=Buffer.byteLength(c.content,"utf8");if(!this.memoryManager.canAddContent(d)){B(`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 JTe.TFile){let y=this.app.metadataCache.getFileCache(h),g=y?.frontmatter??{},b=y?(0,JTe.getAllTags)(y)??[]:[],_=this.extractFrontmatterTags(g),w=this.normalizeTagList([...b,..._]),O=this.app.metadataCache.resolvedLinks[h.path]??{},T=this.app.metadataCache.getBacklinksForFile(h)?.data??{},P=Object.keys(O),M=Object.keys(T),I=[...P,...M],j=this.extractPropertyValues(g);p={tags:w,links:I,props:j},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 B(`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,Au.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,Au.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,i=[]){if(!this.index)return[];let a=n.length>0?n.join(" "):o||e[0]||"";if(!a.trim())return[];let s=e.slice(1),l=[...i,...s].join(" ").trim(),c={boost:{title:Au.FIELD_WEIGHTS.title,heading:Au.FIELD_WEIGHTS.heading,path:Au.FIELD_WEIGHTS.path,tags:Au.FIELD_WEIGHTS.tags,body:Au.FIELD_WEIGHTS.body},prefix:!0,fuzzy:!1,combineWith:"OR"};try{let d=this.index.search(a,c);if(B(`FullText: Primary search found ${d.length} results for "${a.substring(0,50)}..."`),!l)return d.slice(0,r).map(m=>({id:m.id,score:m.score,engine:"fulltext",explanation:{lexicalMatches:this.extractLexicalMatches(m),baseScore:m.score,finalScore:m.score}}));let f=this.index.search(l,c);return B(`FullText: Secondary search found ${f.length} results for expanded terms`),this.combineWeightedScores(d,f).slice(0,r)}catch(d){return Be(`FullText: Search failed for "${a}": ${d}`),[]}}combineWeightedScores(e,r){let n=new Map;for(let a of r)n.set(a.id,{score:a.score,result:a});let o=new Set,i=[];for(let a of e){let s=a.id;o.add(s);let u=n.get(s),l=a.score*Au.SALIENT_WEIGHT,c=u?u.score*Au.EXPANDED_WEIGHT:0,d=l+c;i.push({id:s,score:d,engine:"fulltext",explanation:{lexicalMatches:this.extractLexicalMatches(a),baseScore:a.score,finalScore:d,expandedBoost:c>0?c:void 0}})}for(let[a,{score:s,result:u}]of n)if(!o.has(a)){let l=s*Au.EXPANDED_WEIGHT;i.push({id:a,score:l,engine:"fulltext",explanation:{lexicalMatches:this.extractLexicalMatches(u),baseScore:0,finalScore:l,expandedBoost:l}})}return i.sort((a,s)=>s.score-a.score),i}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 Au.FIELD_WEIGHTS[e]||1}clear(){try{this.index=null,this.indexedChunks.clear(),this.memoryManager.reset(),B("FullTextEngine: Cleanup completed successfully")}catch(e){Be(`FullTextEngine: Cleanup error: ${e}`)}}getStats(){return{documentsIndexed:this.indexedChunks.size,memoryUsed:this.memoryManager.getBytesUsed(),memoryPercent:this.memoryManager.getUsagePercent()}}};Au.BATCH_SIZE=10,Au.CHUNK_MEMORY_PERCENTAGE=.35,Au.MAX_ARRAY_ITEMS=10,Au.MAX_EXTRACTION_DEPTH=2,Au.SALIENT_WEIGHT=.9,Au.EXPANDED_WEIGHT=.1,Au.FIELD_WEIGHTS={title:3,heading:2.5,headings:1.5,path:1.5,tags:4,props:1.5,links:1.5,body:1};HTe=Au});function mG(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 uit=v(()=>{});var WTe,pyr=v(()=>{WTe=class{static levenshteinDistance(e,r){let n=e.length,o=r.length;if(n===0)return o;if(o===0)return n;let i=Array(n+1).fill(null).map(()=>Array(o+1).fill(0));for(let a=0;a<=n;a++)i[a][0]=a;for(let a=0;a<=o;a++)i[0][a]=a;for(let a=1;a<=n;a++)for(let s=1;s<=o;s++)e[a-1]===r[s-1]?i[a][s]=i[a-1][s-1]:i[a][s]=1+Math.min(i[a-1][s],i[a][s-1],i[a-1][s-1]);return i[n][o]}static similarity(e,r){let n=e.toLowerCase(),o=r.toLowerCase(),i=Math.max(n.length,o.length);return i===0?1:1-this.levenshteinDistance(n,o)/i}static generateVariants(e){let r=new Set,n=e.toLowerCase();if(r.add(e),r.add(n),r.add(e.toUpperCase()),n.length>0&&r.add(n[0].toUpperCase()+n.slice(1)),n.includes(" ")||n.includes("-")||n.includes("_")){let i=n.split(/[\s\-_]+/);if(i.length>1){let a=i[0]+i.slice(1).map(u=>u[0]?.toUpperCase()+u.slice(1)).join("");r.add(a);let s=i.map(u=>u[0]?.toUpperCase()+u.slice(1)).join("");r.add(s)}}n.endsWith("s")?r.add(n.slice(0,-1)):n.endsWith("es")?r.add(n.slice(0,-2)):(r.add(n+"s"),n.endsWith("y")&&r.add(n.slice(0,-1)+"ies"));let o={a:["s","q","w","z"],b:["v","g","h","n"],c:["x","d","f","v"],d:["s","e","r","f","c","x"],e:["w","r","d","s"],f:["d","r","t","g","v","c"],g:["f","t","y","h","b","v"],h:["g","y","u","j","n","b"],i:["u","o","k","j"],j:["h","u","i","k","m","n"],k:["j","i","o","l","m"],l:["k","o","p"],m:["n","j","k"],n:["b","h","j","m"],o:["i","p","l","k"],p:["o","l"],q:["w","a"],r:["e","t","f","d"],s:["a","w","e","d","x","z"],t:["r","y","g","f"],u:["y","i","j","h"],v:["c","f","g","b"],w:["q","e","s","a"],x:["z","s","d","c"],y:["t","u","h","g"],z:["a","s","x"]};for(let i=0;i<n.length&&r.size<10;i++){let a=n[i],s=o[a]||[];for(let u of s){if(r.size>=10)break;let l=n.slice(0,i)+u+n.slice(i+1);r.add(l)}}return Array.from(r)}static isFuzzyMatch(e,r,n=.8){if(this.similarity(e,r)>=n)return!0;let i=l=>{let c=l.toLowerCase();return c.endsWith("ies")&&c.length>3?c.slice(0,-3)+"y":c.endsWith("es")&&c.length>2?c.slice(0,-2):c.endsWith("s")&&!c.endsWith("ss")&&c.length>1?c.slice(0,-1):c},a=i(e),s=i(r);return a===s?!0:this.similarity(a,s)>=n}}});var GTe,KTe,myr=v(()=>{Or();Xw();_t();uit();Zt();pyr();GTe=class GTe{constructor(e={}){this.options=e;this.cache=new Map;this.config={maxVariants:e.maxVariants??2,timeout:e.timeout??KW,cacheSize:e.cacheSize??100,minTermLength:2}}async expand(e){if(!e?.trim())return{queries:[],salientTerms:[],originalQuery:"",expandedQueries:[],expandedTerms:[]};let r=this.cache.get(e);if(r)return this.cache.delete(e),this.cache.set(e,r),B(`QueryExpander: Using cached expansion for "${e}"`),r;try{let n=await this.expandWithTimeout(e);return this.cacheResult(e,n),n}catch(n){return Be(`QueryExpander: Failed to expand query "${e}":`,n),this.fallbackExpansion(e)}}async expandWithTimeout(e){try{return await pge(r=>this.expandWithLLM(e,r),this.config.timeout,"Query expansion")}catch(r){if(r instanceof Oee)return B(`QueryExpander: Timeout reached for "${e}"`),this.fallbackExpansion(e);throw r}}async expandWithLLM(e,r){try{if(!this.options.getChatModel)return B("QueryExpander: No chat model getter provided"),this.fallbackExpansion(e);let n=await this.options.getChatModel();if(!n)return B("QueryExpander: No chat model available"),this.fallbackExpansion(e);let o=GTe.PROMPT_TEMPLATE.replace("{count}",this.config.maxVariants.toString()).replace("{query}",e),i=await rh(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 B(`QueryExpander: Expanded "${e}" to ${s.queries.length} queries and ${s.salientTerms.length} terms`),s}catch(n){return ne("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=mG(e);return this.combineBaseAndTagTerms(r,n,e)}parseXMLResponse(e,r){let n=[r],o=new Set,i=new Set,a=/<query>(.*?)<\/query>/g,s;for(;(s=a.exec(e))!==null;){let p=s[1]?.trim();p&&p!==r&&n.length<=this.config.maxVariants&&n.push(p)}let u=e.match(/<salient>([\s\S]*?)<\/salient>/);if(u){let p=/<term>(.*?)<\/term>/g,m;for(;(m=p.exec(u[1]))!==null;){let h=m[1]?.trim().toLowerCase();h&&this.isValidTerm(h)&&o.add(h)}}let l=e.match(/<expanded>([\s\S]*?)<\/expanded>/);if(l){let p=/<term>(.*?)<\/term>/g,m;for(;(m=p.exec(l[1]))!==null;){let h=m[1]?.trim().toLowerCase();h&&this.isValidTerm(h)&&i.add(h)}}if(o.size===0&&i.size===0){let p=/<term>(.*?)<\/term>/g,m;for(;(m=p.exec(e))!==null;){let h=m[1]?.trim().toLowerCase();h&&this.isValidTerm(h)&&i.add(h)}}if(n.length===1&&o.size===0&&i.size===0)return this.parseLegacyFormat(e,r);let c=mG(r),d=o.size>0?Array.from(new Set([...o,...c])):this.extractSalientTermsFromOriginal(r),f=n.slice(1);return{queries:n.slice(0,this.config.maxVariants+1),salientTerms:d,originalQuery:r,expandedQueries:f.slice(0,this.config.maxVariants),expandedTerms:Array.from(i)}}parseLegacyFormat(e,r){let n=e.split(`
|
||
`).map(l=>l.trim()),o=[r],i=new Set,a=null;for(let l of n)if(!(!l||l==="")){if(l.toUpperCase().includes("QUERIES")){a="queries";continue}if(l.toUpperCase().includes("TERMS")||l.toUpperCase().includes("KEYWORDS")){a="terms";continue}if(a==="queries"&&o.length<=this.config.maxVariants){let c=l.replace(/^[-•*\d.)\s]+/,"").trim();c&&c!==r&&o.push(c)}else if(a==="terms"){let c=l.replace(/^[-•*\d.)\s]+/,"").trim().toLowerCase();c&&this.isValidTerm(c)&&i.add(c)}}if(o.length===1&&i.size===0)for(let l of n.slice(0,this.config.maxVariants))l&&!l.toUpperCase().includes("QUERY")&&o.push(l);let s=this.extractSalientTermsFromOriginal(r),u=o.slice(1);return{queries:o.slice(0,this.config.maxVariants+1),salientTerms:s,originalQuery:r,expandedQueries:u.slice(0,this.config.maxVariants),expandedTerms:Array.from(i)}}fallbackExpansion(e){let r=this.extractTermsFromQueries([e]),n=mG(e),o=this.combineBaseAndTagTerms(r,n,e),i=new Set([e]);for(let s of o)if(!s.startsWith("#")&&s.length>=3){let u=WTe.generateVariants(s);for(let l of u.slice(0,3))if(l!==s){let c=e.toLowerCase().replace(new RegExp(`\\b${s}\\b`,"gi"),l);c!==e.toLowerCase()&&i.add(c)}}return{queries:[e],salientTerms:o,originalQuery:e,expandedQueries:[],expandedTerms:[]}}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(),B("QueryExpander: Cache cleared")}getCacheSize(){return this.cache.size}async expandQueries(e){return(await this.expand(e)).queries}};GTe.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
|
||
|
||
EXPANDED (for recall - can add new related terms):
|
||
- Alternative phrasings of the query
|
||
- Related/synonym terms to find more documents
|
||
|
||
Example: "find my piano notes"
|
||
- Salient (from original): piano, notes
|
||
- Expanded queries: "piano lesson notes", "piano practice sheets"
|
||
- Expanded terms: music, sheet, practice, lesson
|
||
|
||
Example: "\u67E5\u627E\u6211\u7684\u5B66\u4E60\u7B14\u8BB0"
|
||
- Salient (from original): \u5B66\u4E60, \u7B14\u8BB0
|
||
- Expanded queries: "\u4E2A\u4EBA\u7B14\u8BB0\u6587\u6863"
|
||
- Expanded terms: \u6587\u6863, \u8BB0\u5F55, \u8D44\u6599
|
||
|
||
Format:
|
||
<salient>
|
||
<term>word_from_original_query</term>
|
||
</salient>
|
||
<queries>
|
||
<query>alternative query</query>
|
||
</queries>
|
||
<expanded>
|
||
<term>related_term_for_recall</term>
|
||
</expanded>`;KTe=GTe});var jie,XTe,hyr=v(()=>{_t();vb();jie=class jie{constructor(e){this.app=e}async batchCachedReadGrep(e,r){let{inclusions:n,exclusions:o}=Xc(),a=this.app.vault.getMarkdownFiles().filter(d=>bl(d,n,o)),s=new Set,u=jie.CONFIG.BATCH_SIZE,l=e.map(d=>d.toLowerCase());for(let d=0;d<a.length&&s.size<r;d+=u){let f=a.slice(d,d+u);await Promise.all(f.map(async p=>{if(!(s.size>=r))try{let m=p.path.toLowerCase(),h=!1;for(let y of l)if(m.includes(y)){s.add(p.path),h=!0;break}if(!h){let g=(await this.app.vault.cachedRead(p)).toLowerCase();for(let b of l)if(g.includes(b)){s.add(p.path);break}}}catch(m){B(`GrepScanner: Skipping file ${p.path}: ${m}`)}})),d%jie.CONFIG.YIELD_INTERVAL===0&&await new Promise(p=>setTimeout(p,0))}let c=Array.from(s).slice(0,r);return c.length>0&&B(` Grep: ${c.length} files match [${e.slice(0,3).join(", ")}${e.length>3?"...":""}]`),c}async grep(e,r=200){return this.batchCachedReadGrep([e],r)}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}}};jie.CONFIG={BATCH_SIZE:30,YIELD_INTERVAL:100};XTe=jie});var pco,ZTe,gyr=v(()=>{_t();pco={enabled:!0,minDocsForBoost:2,maxBoostFactor:1.15,minRelevanceRatio:.4},ZTe=class{constructor(e){this.config=pco;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=this.extractFolder(n.id),i=r.get(o);if(i){let a=n.score*i.boostFactor;return{...n,score:a,explanation:n.explanation?{...n.explanation,folderBoost:{folder:i.folderPath,documentCount:i.documentCount,totalDocsInFolder:i.totalDocsInFolder,relevanceRatio:i.relevanceRatio,boostFactor:i.boostFactor},finalScore:a}:void 0}}return n})}calculateFolderStats(e){let r=new Map;for(let i of e){let a=this.extractFolder(i.id);r.set(a,(r.get(a)||0)+1)}let n=this.getTotalDocsPerFolder(),o=new Map;for(let[i,a]of r.entries()){let s=n.get(i)||a,u=a/s;if(a>=this.config.minDocsForBoost&&u>=this.config.minRelevanceRatio){let c=1+(1+Math.log2(a+1)-1)*Math.sqrt(u),d=Math.min(c,this.config.maxBoostFactor);o.set(i,{folderPath:i,documentCount:a,totalDocsInFolder:s,relevanceRatio:u,boostFactor:d})}}return o}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&&(B(`Folder boost: Boosting ${r.length} folders with significant relevance`),r.slice(0,5).forEach(n=>{let o=(n.relevanceRatio*100).toFixed(1);B(` ${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 mco,YTe,yyr=v(()=>{_t();mco={enabled:!0,maxCandidates:10,backlinkWeight:1,coCitationWeight:.5,sharedTagWeight:.3,boostStrength:.1,maxBoostMultiplier:1.2},YTe=class{constructor(e,r={}){this.metadataCache=e.metadataCache,this.config={...mco,...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=>s.id)),o=new Map;for(let s of r){let u=this.calculateConnections(s.id,n);o.set(s.id,u)}let i=e.map(s=>{let u=o.get(s.id);return!u||u.boostMultiplier===1?s:{...s,score:s.score*u.boostMultiplier,explanation:s.explanation?{...s.explanation,graphConnections:{backlinks:u.backlinks.length,coCitations:u.coCitations.length,sharedTags:u.sharedTags.length,score:u.connectionScore,boostMultiplier:u.boostMultiplier}}:void 0}}),a=i.filter(s=>{let u=o.get(s.id);return u&&u.boostMultiplier>1});return a.length>0&&B(`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=e,n=r.length;return r=r.slice(0,this.config.maxCandidates),n>this.config.maxCandidates&&B(`GraphBoost: Limited to top ${this.config.maxCandidates} candidates (from ${n})`),r}setConfig(e){this.config={...this.config,...e}}}});var QTe,byr=v(()=>{QTe=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}}}});var lit,jm,eEe,tEe=v(()=>{Or();_t();qTe();fyr();myr();hyr();gyr();yyr();byr();lit=2,jm=100,eEe=class{constructor(e,r){this.app=e;this.getChatModel=r;this.grepScanner=new XTe(e),this.chunkManager=new Ck(e),this.fullTextEngine=new HTe(e,this.chunkManager),this.queryExpander=new KTe({getChatModel:this.getChatModel,maxVariants:3,timeout:KW}),this.folderBoostCalculator=new ZTe(e),this.graphBoostCalculator=new YTe(e,{enabled:!0,maxCandidates:10,boostStrength:.1,maxBoostMultiplier:1.15}),this.scoreNormalizer=new QTe({method:"minmax",clipMin:.02,clipMax:.98})}async retrieve(e,r={}){if(!e||typeof e!="string")return Be("SearchCore: Invalid query provided"),[];let n=e.trim();if(n.length===0)return Be("SearchCore: Empty query provided"),[];n.length>1e3?(Be("SearchCore: Query too long, truncating"),e=n.substring(0,1e3)):e=n;let o=!!r.returnAll,i=o?jm:Math.min(Math.max(1,r.maxResults||30),100),a=o?jm:Math.min(Math.max(10,r.candidateLimit||500),1e3),s=!!(r.enableLexicalBoosts??!0);try{B(`SearchCore: Searching for "${e}"`);let u=await this.queryExpander.expand(e),l=u.queries,c=r.salientTerms?[...new Set([...u.salientTerms,...r.salientTerms])]:u.salientTerms,d=this.buildTagRecallQueries(c),f=[],p=new Set,m=w=>{if(!w)return;let O=w.toLowerCase();O.length===0||p.has(O)||(p.add(O),f.push(O))};l.forEach(m),u.expandedTerms.forEach(m),c.forEach(m),d.forEach(m),(l.length>1||c.length>0||u.expandedTerms.length>0)&&B(`Query expansion: variants=${JSON.stringify(l)}, salient=${JSON.stringify(c)}, recall=${JSON.stringify(u.expandedTerms)}`);let h=o?jm:200,y=await this.grepScanner.batchCachedReadGrep(f,h),g=y.slice(0,a);B(`SearchCore: ${g.length} candidates (from ${y.length} grep hits)`);let _=await this.executeLexicalSearch(g,f,c,i,u.originalQuery,o,u.expandedTerms);if(s&&(_=this.folderBoostCalculator.applyBoosts(_),_=this.graphBoostCalculator.applyBoost(_)),_=this.scoreNormalizer.normalize(_),this.fullTextEngine.clear(),_.length>i&&(_=_.slice(0,i)),_.length>0){let w=this.app.vault.getAbstractFileByPath(_[0].id);B(`SearchCore: ${_.length} results found (top: ${w?.name||_[0].id})`)}else B("SearchCore: No results found");return _}catch(u){ne("SearchCore: Retrieval failed",u);try{return await this.fallbackSearch(e,i)}catch(l){return ne("SearchCore: Fallback search also failed",l),[]}}}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 ne("SearchCore: Fallback search failed",n),[]}}getStats(){return{fullTextStats:this.fullTextEngine.getStats()}}getChunkManager(){return this.chunkManager}clear(){this.fullTextEngine.clear(),this.queryExpander.clearCache(),B("SearchCore: Cleared all caches")}buildTagRecallQueries(e){let r=new Set;for(let n of e){if(!n||!n.startsWith("#"))continue;let o=n.toLowerCase();if(o.length<=1)continue;let i=o.slice(1);if(i.length===0)continue;r.add(i);let a=i.split("/").filter(s=>s.length>0);if(a.length>0){let s="";for(let u of a)s=s?`${s}/${u}`:u,r.add(s),r.add(u)}}return Array.from(r)}async executeLexicalSearch(e,r,n,o,i,a=!1,s=[]){try{let u=Date.now(),l=await this.fullTextEngine.buildFromCandidates(e),c=Date.now()-u,d=Date.now(),f=a?jm:Number.isFinite(o)?Math.min(o,1e3):e.length||30,p=a?jm*lit:Math.max(f*lit,lit),m=this.fullTextEngine.search(r,p,n,i,s),h=Date.now()-d;return B(`Full-text: ${l} docs indexed (${c}ms), ${m.length} results (${h}ms)`),m}catch(u){return ne("Full-text search failed",u),[]}}}});var _yr,vyr,wyr,wV,SV,Syr,Cyr,Die,xyr,Oyr,Tyr,Eyr,wHa,Pyr=v(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(_yr||(_yr={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(vyr||(vyr={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(wyr||(wyr={}));(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"})(wV||(wV={}));(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"})(SV||(SV={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(Syr||(Syr={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(Cyr||(Cyr={}));(function(t){t.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",t.STOP="STOP",t.MAX_TOKENS="MAX_TOKENS",t.SAFETY="SAFETY",t.RECITATION="RECITATION",t.LANGUAGE="LANGUAGE",t.OTHER="OTHER"})(Die||(Die={}));(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"})(xyr||(xyr={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(Oyr||(Oyr={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(Tyr||(Tyr={}));(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(Eyr||(Eyr={}));wHa=[Die.RECITATION,Die.SAFETY,Die.LANGUAGE];});function dit(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 cit,fit=v(()=>{Wv();fO();cit=class extends Sz{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 th(`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 Y$(this.zodSchema,r);if(n.success)return n.data;throw new th(`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)?dit(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 Myr(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 Iyr=v(()=>{});function Ryr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="thinking"}function Ayr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="redacted_thinking"}function Nyr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="search_result"}function jyr(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 Dyr,$yr=v(()=>{Qa();Dyr={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=zg({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 Lyr,Fyr=v(()=>{Lyr=t=>t()});function hco(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="citation"}function gco(t){function*e(){for(let r of t)hco(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 $ie(t){return typeof t=="string"?t:yco(t)}function yco(t){let e=[];for(let r=0,{length:n}=t;r<n;r++)e.push(String.fromCharCode(t[r]));return btoa(e.join(""))}function pit(t){return(t??"").split(";")[0].toLowerCase()}function Lie(t,e){if(t!=null&&typeof t=="object"&&e in t)return t[e]}function hG(t,e){let r=Lie(e,"cache_control");r!==void 0&&(t.cache_control=r);let n=Lie(e,"citations");n!==void 0&&(t.citations=n);let o=Lie(e,"context");o!==void 0&&(t.context=o);let i=Lie(e,"title");return i!==void 0&&(t.title=i),t}function mit(t,e){let r=Lie(e,"cache_control");return r!==void 0&&(t.cache_control=r),t}function kyr(t){return new Set(["image/jpeg","image/png","image/gif","image/webp"]).has(t)}function qyr(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:gco(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=Lyr(()=>{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(hG({type:"document",source:{type:"file",file_id:o.fileId}},i));continue}if(o.url){let a=pit(o.mimeType);if(a==="application/pdf"||a===""){e.push(hG({type:"document",source:{type:"url",url:o.url}},i));continue}}if(o.data){let a=pit(o.mimeType);if(a===""||a==="application/pdf")e.push(hG({type:"document",source:{type:"base64",data:$ie(o.data),media_type:"application/pdf"}},i));else if(a==="text/plain")e.push(hG({type:"document",source:{type:"text",data:$ie(o.data),media_type:"text/plain"}},i));else if(kyr(a))e.push(hG({type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:$ie(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(mit({type:"image",source:{type:"file",file_id:o.fileId}},i));continue}if(o.url){e.push(mit({type:"image",source:{type:"url",url:o.url}},i));continue}if(o.data){let a=pit(o.mimeType)||"image/png";kyr(a)&&e.push(mit({type:"image",source:{type:"base64",data:$ie(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(hG({type:"document",source:{type:"text",data:$ie(o.data),media_type:"text/plain"}},o.metadata)):o.type==="non_standard"&&n&&e.push(o.value))}return e}var Uyr=v(()=>{Fyr()});function Byr(t){let e=zg({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 bco(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 Hs({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new Hs({content:[{type:"tool_result",...r.content!=null?{content:hit(r)}:{},tool_use_id:r.tool_call_id}]}));else e.push(r);return e}function zyr(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*_co(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){Ym(n)&&(yield Zx(n,Dyr));let o="cache_control"in n?n.cache_control:void 0;if(n.type==="image_url"){let i;typeof n.image_url=="string"?i=Byr(n.image_url):typeof n.image_url=="object"&&n.image_url!==null&&"url"in n.image_url&&typeof n.image_url.url=="string"&&(i=Byr(n.image_url.url)),i&&(yield{type:"image",source:i,...o?{cache_control:o}:{}})}else{if(jyr(n))return n;if(n.type==="document")yield{...n,...o?{cache_control:o}:{}};else if(Ryr(n))yield{type:"thinking",thinking:n.thinking,signature:n.signature,...o?{cache_control:o}:{}};else if(Ayr(n))yield{type:"redacted_thinking",data:n.data,...o?{cache_control:o}:{}};else if(Nyr(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 hit(t){let{content:e}=t;return typeof e=="string"?e:Array.from(_co(e))}function rEe(t){let e=bco(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(Pl(i)&&i.response_metadata?.output_version==="v1")return{role:a,content:qyr(i)};if(Pl(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(zyr)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(zyr)]};{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:hit(i)}}}else return{role:a,content:hit(i)}});return{messages:vco(o),system:r}}function vco(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 git=v(()=>{$yr();Uyr();Qa()});function Vyr(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 Ir({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 Ir({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 Ir({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 Ir({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 Ir({content:[{index:t.index,...n,type:"thinking"}],response_metadata:r})}:{chunk:new Ir({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 Ir({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 Ir({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 Ir({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 Ir({content:e.coerceContentToString?n:[{index:t.index,...t.content_block}],response_metadata:r})}}}}return null}function Hyr(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 eo({content:t[0].text,additional_kwargs:e,usage_metadata:o,response_metadata:r,id:e.id})}];{let i=dit(t);return[{text:"",message:new eo({content:t,additional_kwargs:e,tool_calls:i,usage_metadata:o,response_metadata:r,id:e.id})}]}}var Jyr=v(()=>{fit();Qa()});function nEe(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
|
||
`,t}function yit(t){let e;return t.status===400&&t.message.includes("tool")?e=nEe(t,"INVALID_TOOL_RESULTS"):t.status===401?e=nEe(t,"MODEL_AUTHENTICATION"):t.status===404?e=nEe(t,"MODEL_NOT_FOUND"):t.status===429?e=nEe(t,"MODEL_RATE_LIMIT"):e=t,e}var Wyr=v(()=>{});function fr(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 Me(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 q1=v(()=>{});var bit,Kyr=v(()=>{bit=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return bit=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 U1(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var Fie,gG=v(()=>{Fie=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 nn,_h,Tg,xk,yG,bG,_G,vG,wG,SG,CG,xG,OG,VC=v(()=>{gG();nn=class extends Error{},_h=class t extends nn{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 xk({message:n,cause:Fie(r)});let i=r;return e===400?new bG(e,i,n,o):e===401?new _G(e,i,n,o):e===403?new vG(e,i,n,o):e===404?new wG(e,i,n,o):e===409?new SG(e,i,n,o):e===422?new CG(e,i,n,o):e===429?new xG(e,i,n,o):e>=500?new OG(e,i,n,o):new t(e,i,n,o)}},Tg=class extends _h{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},xk=class extends _h{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},yG=class extends xk{constructor({message:e}={}){super({message:e??"Request timed out."})}},bG=class extends _h{},_G=class extends _h{},vG=class extends _h{},wG=class extends _h{},SG=class extends _h{},CG=class extends _h{},xG=class extends _h{},OG=class extends _h{}});function wit(t){return typeof t!="object"?{}:t??{}}function Xyr(t){if(!t)return!0;for(let e in t)return!1;return!0}function Zyr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Sco,Gyr,_it,vit,Yyr,oEe,CV=v(()=>{VC();Sco=/^[a-z][a-z0-9+.-]*:/i,Gyr=t=>Sco.test(t),_it=t=>(_it=Array.isArray,_it(t)),vit=_it;Yyr=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new nn(`${t} must be an integer`);if(e<0)throw new nn(`${t} must be a positive integer`);return e},oEe=t=>{try{return JSON.parse(t)}catch{return}}});var Qyr,ebr=v(()=>{Qyr=t=>new Promise(e=>setTimeout(e,t))});var Ok,Sit=v(()=>{Ok="0.65.0"});function Cco(){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 Oco(){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 obr,xco,tbr,rbr,nbr,ibr,Cit=v(()=>{Sit();obr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";xco=()=>{let t=Cco();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ok,"X-Stainless-OS":rbr(Deno.build.os),"X-Stainless-Arch":tbr(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":Ok,"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":Ok,"X-Stainless-OS":rbr(globalThis.process.platform??"unknown"),"X-Stainless-Arch":tbr(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Oco();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Ok,"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":Ok,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};tbr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",rbr=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"),ibr=()=>nbr??(nbr=xco())});function abr(){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 xit(...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 iEe(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return xit({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function kie(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 sbr(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 TG=v(()=>{});var ubr,lbr=v(()=>{ubr=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});function fbr(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 qie(t){let e;return(cbr??(e=new globalThis.TextEncoder,cbr=e.encode.bind(e)))(t)}function Oit(t){let e;return(dbr??(e=new globalThis.TextDecoder,dbr=e.decode.bind(e)))(t)}var cbr,dbr,Tit=v(()=>{});function Pco(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 pbr(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 Qv,ew,B1,Eit=v(()=>{q1();Tit();B1=class{constructor(){Qv.set(this,void 0),ew.set(this,void 0),fr(this,Qv,new Uint8Array,"f"),fr(this,ew,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?qie(e):e;fr(this,Qv,fbr([Me(this,Qv,"f"),r]),"f");let n=[],o;for(;(o=Pco(Me(this,Qv,"f"),Me(this,ew,"f")))!=null;){if(o.carriage&&Me(this,ew,"f")==null){fr(this,ew,o.index,"f");continue}if(Me(this,ew,"f")!=null&&(o.index!==Me(this,ew,"f")+1||o.carriage)){n.push(Oit(Me(this,Qv,"f").subarray(0,Me(this,ew,"f")-1))),fr(this,Qv,Me(this,Qv,"f").subarray(Me(this,ew,"f")),"f"),fr(this,ew,null,"f");continue}let i=Me(this,ew,"f")!==null?o.preceding-1:o.preceding,a=Oit(Me(this,Qv,"f").subarray(0,i));n.push(a),fr(this,Qv,Me(this,Qv,"f").subarray(o.index),"f"),fr(this,ew,null,"f")}return n}flush(){return Me(this,Qv,"f").length?this.decode(`
|
||
`):[]}};Qv=new WeakMap,ew=new WeakMap;B1.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);B1.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function Uie(){}function aEe(t,e,r){return!e||sEe[t]>sEe[r]?Uie:e[t].bind(e)}function vh(t){let e=t.logger,r=t.logLevel??"off";if(!e)return Mco;let n=mbr.get(e);if(n&&n[0]===r)return n[1];let o={error:aEe("error",e,r),warn:aEe("warn",e,r),info:aEe("info",e,r),debug:aEe("debug",e,r)};return mbr.set(e,[r,o]),o}var sEe,Pit,Mco,mbr,z1,uEe=v(()=>{CV();sEe={off:0,error:200,warn:300,info:400,debug:500},Pit=(t,e,r)=>{if(t){if(Zyr(sEe,t))return t;vh(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(sEe))}`)}};Mco={error:Uie,warn:Uie,info:Uie,debug:Uie},mbr=new WeakMap;z1=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*Ico(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new nn("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 nn("Attempted to iterate over a response with no body");let r=new Mit,n=new B1,o=kie(t.body);for await(let i of Rco(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*Rco(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"?qie(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=pbr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function Aco(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var Bie,wR,Mit,Iit=v(()=>{q1();VC();TG();Eit();TG();gG();CV();Tit();uEe();VC();wR=class t{constructor(e,r,n){this.iterator=e,Bie.set(this,void 0),this.controller=r,fr(this,Bie,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?vh(n):console;async function*a(){if(o)throw new nn("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of Ico(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 _h(void 0,oEe(u.data)??u.data,void 0,e.headers)}s=!0}catch(u){if(U1(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 B1,u=kie(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 nn("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(U1(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[(Bie=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,Me(this,Bie,"f")),new t(()=>o(r),this.controller,Me(this,Bie,"f"))]}toReadableStream(){let e=this,r;return xit({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=qie(JSON.stringify(o)+`
|
||
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};Mit=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]=Aco(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function lEe(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return vh(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller):wR.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 Rit(d,r)}return await r.text()})();return vh(t).debug(`[${n}] response parsed`,z1({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function Rit(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 Ait=v(()=>{Iit();uEe()});var zie,xV,cEe=v(()=>{q1();Ait();xV=class t extends Promise{constructor(e,r,n=lEe){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,zie.set(this,void 0),fr(this,zie,e,"f")}_thenUnwrap(e){return new t(Me(this,zie,"f"),this.responsePromise,async(r,n)=>Rit(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(Me(this,zie,"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)}};zie=new WeakMap});var dEe,Nit,Vie,LS,Tk=v(()=>{q1();VC();Ait();cEe();CV();Nit=class{constructor(e,r,n,o){dEe.set(this,void 0),fr(this,dEe,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 nn("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await Me(this,dEe,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(dEe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Vie=class extends xV{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await lEe(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},LS=class extends Nit{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:{...wit(this.options.query),before_id:r}}:null}let e=this.last_id;return e?{...this.options,query:{...wit(this.options.query),after_id:e}}:null}}});function OV(t,e,r){return Dit(),new File(t,e??"unknown_file",r)}function Hie(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 jco(t){let e=typeof t=="function"?t:t.fetch,r=hbr.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 hbr.set(e,n),n}var Dit,$it,gbr,hbr,Dco,$co,jit,fEe=v(()=>{TG();Dit=()=>{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`.":""))}};$it=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",gbr=async(t,e)=>({...t,body:await Dco(t.body,e)}),hbr=new WeakMap;Dco=async(t,e)=>{if(!await jco(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])=>jit(r,n,o))),r},$co=t=>t instanceof Blob&&"name"in t,jit=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,OV([await r.blob()],Hie(r),n))}else if($it(r))t.append(e,OV([await new Response(iEe(r)).blob()],Hie(r)));else if($co(r))t.append(e,OV([r],Hie(r),{type:r.type}));else if(Array.isArray(r))await Promise.all(r.map(n=>jit(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>jit(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 pEe(t,e,r){if(Dit(),t=await t,e||(e=Hie(t)),Lco(t))return t instanceof File&&e==null&&r==null?t:OV([await t.arrayBuffer()],e??t.name,{type:t.type,lastModified:t.lastModified,...r});if(Fco(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),OV(await Lit(o),e,r)}let n=await Lit(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 OV(n,e,r)}async function Lit(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(ybr(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if($it(t))for await(let r of t)e.push(...await Lit(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${kco(t)}`)}return e}function kco(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var ybr,Lco,Fco,bbr=v(()=>{fEe();fEe();ybr=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",Lco=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&ybr(t),Fco=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var Fit=v(()=>{bbr()});var _br=v(()=>{});var _d,SR=v(()=>{_d=class{constructor(e){this._client=e}}});function*Uco(t){if(!t)return;if(vbr 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():vit(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=vit(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 vbr,ea,CR=v(()=>{CV();vbr=Symbol.for("brand.privateNullableHeaders");ea=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,a]of Uco(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{[vbr]:!0,values:e,nulls:r}}});function Sbr(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var wbr,Bco,Cy,EG=v(()=>{VC();wbr=Object.freeze(Object.create(null)),Bco=(t=Sbr)=>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??wbr)??wbr)?.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 nn(`Path parameters result in path with invalid segments:
|
||
${i.map(f=>f.error).join(`
|
||
`)}
|
||
${a}
|
||
${d}`)}return a},Cy=Bco(Sbr)});var PG,kit=v(()=>{SR();Tk();CR();fEe();EG();PG=class extends _d{list(e={},r){let{betas:n,...o}=e??{};return this._client.getAPIList("/v1/files",LS,{query:o,...r,headers:ea([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])})}delete(e,r={},n){let{betas:o}=r??{};return this._client.delete(Cy`/v1/files/${e}`,{...n,headers:ea([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},n?.headers])})}download(e,r={},n){let{betas:o}=r??{};return this._client.get(Cy`/v1/files/${e}/content`,{...n,headers:ea([{"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(Cy`/v1/files/${e}`,{...n,headers:ea([{"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",gbr({body:o,...r,headers:ea([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])},this._client))}}});var MG,qit=v(()=>{SR();Tk();CR();EG();MG=class extends _d{retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(Cy`/v1/models/${e}?beta=true`,{...n,headers:ea([{...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",LS,{query:o,...r,headers:ea([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}}});var IG,Uit=v(()=>{VC();TG();Eit();IG=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new B1;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 nn("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 nn("Attempted to iterate over a response with no body");return new t(kie(e.body),r)}}});var Jie=v(()=>{VC()});var RG,Bit=v(()=>{SR();Tk();CR();Uit();Jie();EG();RG=class extends _d{create(e,r){let{betas:n,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...r,headers:ea([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(Cy`/v1/messages/batches/${e}?beta=true`,{...n,headers:ea([{"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",LS,{query:o,...r,headers:ea([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}delete(e,r={},n){let{betas:o}=r??{};return this._client.delete(Cy`/v1/messages/batches/${e}?beta=true`,{...n,headers:ea([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},n?.headers])})}cancel(e,r={},n){let{betas:o}=r??{};return this._client.post(Cy`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:ea([{"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 nn(`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:ea([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((a,s)=>IG.fromResponse(s.response,s.controller))}}});var zit=v(()=>{Iit()});var Jco,AG,Wco,Kco,mEe,Vit=v(()=>{Jco=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},AG=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),AG(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),AG(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),AG(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),AG(t);break;case"delimiter":return t=t.slice(0,t.length-1),AG(t);break}return t},Wco=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},Kco=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},mEe=t=>JSON.parse(Kco(Wco(AG(Jco(t)))))});function Tbr(t){return t.type==="tool_use"||t.type==="server_tool_use"||t.type==="mcp_tool_use"}var FS,Ek,Wie,hEe,Kie,Gie,gEe,Xie,V1,Zie,yEe,bEe,NG,_Ee,vEe,Hit,Cbr,wEe,Jit,Wit,Kit,xbr,Obr,SEe,Ebr=v(()=>{q1();gG();Jie();zit();Vit();Obr="__json_buf";SEe=class t{constructor(){FS.add(this),this.messages=[],this.receivedMessages=[],Ek.set(this,void 0),this.controller=new AbortController,Wie.set(this,void 0),hEe.set(this,()=>{}),Kie.set(this,()=>{}),Gie.set(this,void 0),gEe.set(this,()=>{}),Xie.set(this,()=>{}),V1.set(this,{}),Zie.set(this,!1),yEe.set(this,!1),bEe.set(this,!1),NG.set(this,!1),_Ee.set(this,void 0),vEe.set(this,void 0),wEe.set(this,e=>{if(fr(this,yEe,!0,"f"),U1(e)&&(e=new Tg),e instanceof Tg)return fr(this,bEe,!0,"f"),this._emit("abort",e);if(e instanceof nn)return this._emit("error",e);if(e instanceof Error){let r=new nn(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new nn(String(e)))}),fr(this,Wie,new Promise((e,r)=>{fr(this,hEe,e,"f"),fr(this,Kie,r,"f")}),"f"),fr(this,Gie,new Promise((e,r)=>{fr(this,gEe,e,"f"),fr(this,Xie,r,"f")}),"f"),Me(this,Wie,"f").catch(()=>{}),Me(this,Gie,"f").catch(()=>{})}get response(){return Me(this,_Ee,"f")}get request_id(){return Me(this,vEe,"f")}async withResponse(){let e=await Me(this,Wie,"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")},Me(this,wEe,"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{Me(this,FS,"m",Jit).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)Me(this,FS,"m",Wit).call(this,u);if(s.controller.signal?.aborted)throw new Tg;Me(this,FS,"m",Kit).call(this)}finally{o&&i&&o.removeEventListener("abort",i)}}_connected(e){this.ended||(fr(this,_Ee,e,"f"),fr(this,vEe,e?.headers.get("request-id"),"f"),Me(this,hEe,"f").call(this,e),this._emit("connect"))}get ended(){return Me(this,Zie,"f")}get errored(){return Me(this,yEe,"f")}get aborted(){return Me(this,bEe,"f")}abort(){this.controller.abort()}on(e,r){return(Me(this,V1,"f")[e]||(Me(this,V1,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Me(this,V1,"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(Me(this,V1,"f")[e]||(Me(this,V1,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{fr(this,NG,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){fr(this,NG,!0,"f"),await Me(this,Gie,"f")}get currentMessage(){return Me(this,Ek,"f")}async finalMessage(){return await this.done(),Me(this,FS,"m",Hit).call(this)}async finalText(){return await this.done(),Me(this,FS,"m",Cbr).call(this)}_emit(e,...r){if(Me(this,Zie,"f"))return;e==="end"&&(fr(this,Zie,!0,"f"),Me(this,gEe,"f").call(this));let n=Me(this,V1,"f")[e];if(n&&(Me(this,V1,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Me(this,NG,"f")&&!n?.length&&Promise.reject(o),Me(this,Kie,"f").call(this,o),Me(this,Xie,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Me(this,NG,"f")&&!n?.length&&Promise.reject(o),Me(this,Kie,"f").call(this,o),Me(this,Xie,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",Me(this,FS,"m",Hit).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{Me(this,FS,"m",Jit).call(this),this._connected(null);let i=wR.fromReadableStream(e,this.controller);for await(let a of i)Me(this,FS,"m",Wit).call(this,a);if(i.controller.signal?.aborted)throw new Tg;Me(this,FS,"m",Kit).call(this)}finally{n&&o&&n.removeEventListener("abort",o)}}[(Ek=new WeakMap,Wie=new WeakMap,hEe=new WeakMap,Kie=new WeakMap,Gie=new WeakMap,gEe=new WeakMap,Xie=new WeakMap,V1=new WeakMap,Zie=new WeakMap,yEe=new WeakMap,bEe=new WeakMap,NG=new WeakMap,_Ee=new WeakMap,vEe=new WeakMap,wEe=new WeakMap,FS=new WeakSet,Hit=function(){if(this.receivedMessages.length===0)throw new nn("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Cbr=function(){if(this.receivedMessages.length===0)throw new nn("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 nn("stream ended without producing a content block with type=text");return r.join(" ")},Jit=function(){this.ended||fr(this,Ek,void 0,"f")},Wit=function(r){if(this.ended)return;let n=Me(this,FS,"m",xbr).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":{Tbr(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":{fr(this,Ek,n,"f");break}case"content_block_start":case"message_delta":break}},Kit=function(){if(this.ended)throw new nn("stream has ended, this shouldn't happen");let r=Me(this,Ek,"f");if(!r)throw new nn("request ended without sending any chunks");return fr(this,Ek,void 0,"f"),r},xbr=function(r){let n=Me(this,Ek,"f");if(r.type==="message_start"){if(n)throw new nn(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new nn(`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&&Tbr(o)){let i=o[Obr]||"";i+=r.delta.partial_json;let a={...o};if(Object.defineProperty(a,Obr,{value:i,enumerable:!1,writable:!0}),i)try{a.input=mEe(i)}catch(s){let u=new nn(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${i}`);Me(this,wEe,"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 wR(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var CEe,Git=v(()=>{CEe={"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 Pbr(){let t,e;return{promise:new Promise((n,o)=>{t=n,e=o}),resolve:t,reject:e}}async function Gco(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 xEe,jG,TV,E_,Yie,xR,H1,Pk,Qie,Xit,DG,Zit=v(()=>{q1();VC();CR();DG=class{constructor(e,r,n){xEe.add(this),this.client=e,jG.set(this,!1),TV.set(this,!1),E_.set(this,void 0),Yie.set(this,void 0),xR.set(this,void 0),H1.set(this,void 0),Pk.set(this,void 0),Qie.set(this,0),fr(this,E_,{params:{...r,messages:structuredClone(r.messages)}},"f"),fr(this,Yie,{...n,headers:ea([{"x-stainless-helper":"BetaToolRunner"},n?.headers])},"f"),fr(this,Pk,Pbr(),"f")}async*[(jG=new WeakMap,TV=new WeakMap,E_=new WeakMap,Yie=new WeakMap,xR=new WeakMap,H1=new WeakMap,Pk=new WeakMap,Qie=new WeakMap,xEe=new WeakSet,Symbol.asyncIterator)](){var e;if(Me(this,jG,"f"))throw new nn("Cannot iterate over a consumed stream");fr(this,jG,!0,"f"),fr(this,TV,!0,"f"),fr(this,H1,void 0,"f");try{for(;;){let r;try{if(Me(this,E_,"f").params.max_iterations&&Me(this,Qie,"f")>=Me(this,E_,"f").params.max_iterations)break;fr(this,TV,!1,"f"),fr(this,xR,void 0,"f"),fr(this,H1,void 0,"f"),fr(this,Qie,(e=Me(this,Qie,"f"),e++,e),"f");let{max_iterations:n,...o}=Me(this,E_,"f").params;if(o.stream?(r=this.client.beta.messages.stream({...o},Me(this,Yie,"f")),fr(this,xR,r.finalMessage(),"f"),yield r):(fr(this,xR,this.client.beta.messages.create({...o,stream:!1},Me(this,Yie,"f")),"f"),yield Me(this,xR,"f")),!Me(this,TV,"f")){let{role:a,content:s}=await Me(this,xR,"f");Me(this,E_,"f").params.messages.push({role:a,content:s})}let i=await Me(this,xEe,"m",Xit).call(this,Me(this,E_,"f").params.messages.at(-1));if(i&&Me(this,E_,"f").params.messages.push(i),!i&&!Me(this,TV,"f"))break}finally{r&&r.abort()}}if(!Me(this,xR,"f"))throw new nn("ToolRunner concluded without a message from the server");Me(this,Pk,"f").resolve(await Me(this,xR,"f"))}catch(r){throw fr(this,jG,!1,"f"),Me(this,Pk,"f").promise.catch(()=>{}),Me(this,Pk,"f").reject(r),fr(this,Pk,Pbr(),"f"),r}}setMessagesParams(e){typeof e=="function"?Me(this,E_,"f").params=e(Me(this,E_,"f").params):Me(this,E_,"f").params=e,fr(this,TV,!0,"f"),fr(this,H1,void 0,"f")}async generateToolResponse(){let e=await Me(this,xR,"f")??this.params.messages.at(-1);return e?Me(this,xEe,"m",Xit).call(this,e):null}done(){return Me(this,Pk,"f").promise}async runUntilDone(){if(!Me(this,jG,"f"))for await(let e of this);return this.done()}get params(){return Me(this,E_,"f").params}pushMessages(...e){this.setMessagesParams(r=>({...r,messages:[...r.messages,...e]}))}then(e,r){return this.runUntilDone().then(e,r)}};Xit=async function(e){return Me(this,H1,"f")!==void 0?Me(this,H1,"f"):(fr(this,H1,Gco(Me(this,E_,"f").params,e),"f"),Me(this,H1,"f"))}});var Mbr,Mk,Yit=v(()=>{SR();Bit();Bit();CR();Ebr();Git();Zit();Zit();Mbr={"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"},Mk=class extends _d{constructor(){super(...arguments),this.batches=new RG(this._client)}create(e,r){let{betas:n,...o}=e;o.model in Mbr&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${Mbr[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=CEe[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:ea([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}stream(e,r){return SEe.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:ea([{"anthropic-beta":[...n??[],"token-counting-2024-11-01"].toString()},r?.headers])})}toolRunner(e,r){return new DG(this._client,e,r)}};Mk.Batches=RG;Mk.BetaToolRunner=DG});var OR,Qit=v(()=>{SR();kit();kit();qit();qit();Yit();Yit();OR=class extends _d{constructor(){super(...arguments),this.models=new MG(this._client),this.messages=new Mk(this._client),this.files=new PG(this._client)}};OR.Models=MG;OR.Messages=Mk;OR.Files=PG});var EV,eat=v(()=>{SR();CR();EV=class extends _d{create(e,r){let{betas:n,...o}=e;return this._client.post("/v1/complete",{body:o,timeout:this._client._options.timeout??6e5,...r,headers:ea([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}}});function Nbr(t){return t.type==="tool_use"||t.type==="server_tool_use"}var kS,Ik,eae,OEe,tae,rae,TEe,nae,J1,oae,EEe,PEe,$G,MEe,IEe,tat,Ibr,rat,nat,oat,iat,Rbr,Abr,REe,jbr=v(()=>{q1();gG();Jie();zit();Vit();Abr="__json_buf";REe=class t{constructor(){kS.add(this),this.messages=[],this.receivedMessages=[],Ik.set(this,void 0),this.controller=new AbortController,eae.set(this,void 0),OEe.set(this,()=>{}),tae.set(this,()=>{}),rae.set(this,void 0),TEe.set(this,()=>{}),nae.set(this,()=>{}),J1.set(this,{}),oae.set(this,!1),EEe.set(this,!1),PEe.set(this,!1),$G.set(this,!1),MEe.set(this,void 0),IEe.set(this,void 0),rat.set(this,e=>{if(fr(this,EEe,!0,"f"),U1(e)&&(e=new Tg),e instanceof Tg)return fr(this,PEe,!0,"f"),this._emit("abort",e);if(e instanceof nn)return this._emit("error",e);if(e instanceof Error){let r=new nn(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new nn(String(e)))}),fr(this,eae,new Promise((e,r)=>{fr(this,OEe,e,"f"),fr(this,tae,r,"f")}),"f"),fr(this,rae,new Promise((e,r)=>{fr(this,TEe,e,"f"),fr(this,nae,r,"f")}),"f"),Me(this,eae,"f").catch(()=>{}),Me(this,rae,"f").catch(()=>{})}get response(){return Me(this,MEe,"f")}get request_id(){return Me(this,IEe,"f")}async withResponse(){let e=await Me(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")},Me(this,rat,"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{Me(this,kS,"m",nat).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)Me(this,kS,"m",oat).call(this,u);if(s.controller.signal?.aborted)throw new Tg;Me(this,kS,"m",iat).call(this)}finally{o&&i&&o.removeEventListener("abort",i)}}_connected(e){this.ended||(fr(this,MEe,e,"f"),fr(this,IEe,e?.headers.get("request-id"),"f"),Me(this,OEe,"f").call(this,e),this._emit("connect"))}get ended(){return Me(this,oae,"f")}get errored(){return Me(this,EEe,"f")}get aborted(){return Me(this,PEe,"f")}abort(){this.controller.abort()}on(e,r){return(Me(this,J1,"f")[e]||(Me(this,J1,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Me(this,J1,"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(Me(this,J1,"f")[e]||(Me(this,J1,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{fr(this,$G,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){fr(this,$G,!0,"f"),await Me(this,rae,"f")}get currentMessage(){return Me(this,Ik,"f")}async finalMessage(){return await this.done(),Me(this,kS,"m",tat).call(this)}async finalText(){return await this.done(),Me(this,kS,"m",Ibr).call(this)}_emit(e,...r){if(Me(this,oae,"f"))return;e==="end"&&(fr(this,oae,!0,"f"),Me(this,TEe,"f").call(this));let n=Me(this,J1,"f")[e];if(n&&(Me(this,J1,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Me(this,$G,"f")&&!n?.length&&Promise.reject(o),Me(this,tae,"f").call(this,o),Me(this,nae,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Me(this,$G,"f")&&!n?.length&&Promise.reject(o),Me(this,tae,"f").call(this,o),Me(this,nae,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",Me(this,kS,"m",tat).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{Me(this,kS,"m",nat).call(this),this._connected(null);let i=wR.fromReadableStream(e,this.controller);for await(let a of i)Me(this,kS,"m",oat).call(this,a);if(i.controller.signal?.aborted)throw new Tg;Me(this,kS,"m",iat).call(this)}finally{n&&o&&n.removeEventListener("abort",o)}}[(Ik=new WeakMap,eae=new WeakMap,OEe=new WeakMap,tae=new WeakMap,rae=new WeakMap,TEe=new WeakMap,nae=new WeakMap,J1=new WeakMap,oae=new WeakMap,EEe=new WeakMap,PEe=new WeakMap,$G=new WeakMap,MEe=new WeakMap,IEe=new WeakMap,rat=new WeakMap,kS=new WeakSet,tat=function(){if(this.receivedMessages.length===0)throw new nn("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Ibr=function(){if(this.receivedMessages.length===0)throw new nn("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 nn("stream ended without producing a content block with type=text");return r.join(" ")},nat=function(){this.ended||fr(this,Ik,void 0,"f")},oat=function(r){if(this.ended)return;let n=Me(this,kS,"m",Rbr).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":{Nbr(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":{fr(this,Ik,n,"f");break}case"content_block_start":case"message_delta":break}},iat=function(){if(this.ended)throw new nn("stream has ended, this shouldn't happen");let r=Me(this,Ik,"f");if(!r)throw new nn("request ended without sending any chunks");return fr(this,Ik,void 0,"f"),r},Rbr=function(r){let n=Me(this,Ik,"f");if(r.type==="message_start"){if(n)throw new nn(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new nn(`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&&Nbr(o)){let i=o[Abr]||"";i+=r.delta.partial_json;let a={...o};Object.defineProperty(a,Abr,{value:i,enumerable:!1,writable:!0}),i&&(a.input=mEe(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 wR(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var LG,aat=v(()=>{SR();Tk();CR();Uit();Jie();EG();LG=class extends _d{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(Cy`/v1/messages/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/v1/messages/batches",LS,{query:e,...r})}delete(e,r){return this._client.delete(Cy`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(Cy`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new nn(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:ea([{Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((o,i)=>IG.fromResponse(i.response,i.controller))}}});var Rk,Dbr,sat=v(()=>{SR();jbr();aat();aat();Git();Rk=class extends _d{constructor(){super(...arguments),this.batches=new LG(this._client)}create(e,r){e.model in Dbr&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${Dbr[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=CEe[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 REe.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},Dbr={"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"};Rk.Batches=LG});var PV,uat=v(()=>{SR();Tk();CR();EG();PV=class extends _d{retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(Cy`/v1/models/${e}`,{...n,headers:ea([{...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",LS,{query:o,...r,headers:ea([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}}});var $br=v(()=>{_br();Qit();eat();sat();uat()});var iae,Lbr=v(()=>{iae=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 lat,cat,AEe,Fbr,kbr,qbr,mc,TR,dat=v(()=>{q1();Kyr();CV();ebr();gG();Cit();TG();lbr();Sit();VC();Tk();Fit();$br();cEe();eat();uat();Qit();sat();Cit();CR();Lbr();uEe();CV();kbr="\\n\\nHuman:",qbr="\\n\\nAssistant:",mc=class{constructor({baseURL:e=iae("ANTHROPIC_BASE_URL"),apiKey:r=iae("ANTHROPIC_API_KEY")??null,authToken:n=iae("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){lat.add(this),AEe.set(this,void 0);let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&obr())throw new nn(`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??cat.DEFAULT_TIMEOUT,this.logger=i.logger??console;let a="warn";this.logLevel=a,this.logLevel=Pit(i.logLevel,"ClientOptions.logLevel",this)??Pit(iae("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??a,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??abr(),fr(this,AEe,ubr,"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 ea([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return ea([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return ea([{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 nn(`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 ${Ok}`}defaultIdempotencyKey(){return`stainless-node-retry-${bit()}`}makeStatusError(e,r,n,o){return _h.generate(e,r,n,o)}buildURL(e,r,n){let o=!Me(this,lat,"m",Fbr).call(this)&&n||this.baseURL,i=Gyr(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return Xyr(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 nn("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 xV(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(vh(this).debug(`[${l}] sending request`,z1({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new Tg;let f=new AbortController,p=await this.fetchWithTimeout(s,a,u,f).catch(Fie),m=Date.now();if(p instanceof globalThis.Error){let g=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new Tg;let b=U1(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return vh(this).info(`[${l}] connection ${b?"timed out":"failed"} - ${g}`),vh(this).debug(`[${l}] connection ${b?"timed out":"failed"} (${g})`,z1({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??l);throw vh(this).info(`[${l}] connection ${b?"timed out":"failed"} - error; no more retries left`),vh(this).debug(`[${l}] connection ${b?"timed out":"failed"} (error; no more retries left)`,z1({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),b?new yG:new xk({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 P=`retrying, ${r} attempts remaining`;return await sbr(p.body),vh(this).info(`${y} - ${P}`),vh(this).debug(`[${l}] response error (${P})`,z1({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";vh(this).info(`${y} - ${b}`);let _=await p.text().catch(P=>Fie(P).message),w=oEe(_),O=w?void 0:_;throw vh(this).debug(`[${l}] response error (${b})`,z1({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:O,durationMs:Date.now()-d})),this.makeStatusError(p.status,w,O,p.headers)}return vh(this).info(y),vh(this).debug(`[${l}] response start`,z1({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 Vie(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 Qyr(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 nn("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&&Yyr("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=ea([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))}:{},...ibr(),...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=ea([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:iEe(e)}:Me(this,AEe,"f").call(this,{body:e,headers:n})}};cat=mc,AEe=new WeakMap,lat=new WeakSet,Fbr=function(){return this.baseURL!=="https://api.anthropic.com"};mc.Anthropic=cat;mc.HUMAN_PROMPT=kbr;mc.AI_PROMPT=qbr;mc.DEFAULT_TIMEOUT=6e5;mc.AnthropicError=nn;mc.APIError=_h;mc.APIConnectionError=xk;mc.APIConnectionTimeoutError=yG;mc.APIUserAbortError=Tg;mc.NotFoundError=wG;mc.ConflictError=SG;mc.RateLimitError=xG;mc.BadRequestError=bG;mc.AuthenticationError=_G;mc.InternalServerError=OG;mc.PermissionDeniedError=vG;mc.UnprocessableEntityError=CG;mc.toFile=pEe;TR=class extends mc{constructor(){super(...arguments),this.completions=new EV(this),this.messages=new Rk(this),this.models=new PV(this),this.beta=new OR(this)}};TR.Completions=EV;TR.Messages=Rk;TR.Models=PV;TR.Beta=OR});var Ubr=v(()=>{dat();Fit();cEe();dat();Tk();VC()});function edo(t){return t?Object.entries(Qco).find(([r])=>t.startsWith(r))?.[1]??Bbr:Bbr}function tdo(t){return!!(t.tools&&t.tools.length>0)}function rdo(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 ndo(t){return!!(t.thinking&&t.thinking.type==="enabled")}function odo(t){return"input_schema"in t}function ido(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 ado(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 Qco,Bbr,zbr,fat,Vbr=v(()=>{fit();Iyr();git();Jyr();Wyr();Ubr();Qa();id();ku();YI();Jv();nb();_v();Wv();g1();Qco={"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},Bbr=2048;zbr=class extends md{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??vn("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??edo(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 TR(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(ido(r)||odo(r))return r;if(Hv(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(bg(r))return{name:r.name,description:r.description,input_schema:Ya(r.schema)?Ni(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=Myr(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=rEe(e),a={...o,...i,stream:!0},s=!tdo(a)&&!rdo(a)&&!ndo(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=Vyr(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=ado(f),m=new yi({message:new Ir({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,...rEe(e)},n),{content:i,...a}=o,s=Hyr(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 yit(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 yit(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(Ya(n)){let m=Ni(n);l=[{name:s,description:m.description??"A function available to call.",input_schema:m}],u=new cit({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 cit({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:Ni(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:Ni(n)}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=Eu.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=Eu.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return Rl.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},fat=class extends zbr{}});var Hbr=v(()=>{git()});var Jbr=v(()=>{Vbr();Hbr()});var pat,Wbr=v(()=>{ku();oV();pat=class extends dk{constructor(e){let r=e?.apiKey||vn("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 Kbr=v(()=>{Wbr()});var MV,Gbr=v(()=>{MV="0.19.0"});function Zbr(t,e={auto:!1}){if(Xbr)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(IV)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${IV}'\``);Xbr=e.auto,IV=t.kind,mat=t.fetch,sdo=t.Request,udo=t.Response,ldo=t.Headers,hat=t.FormData,cdo=t.Blob,NEe=t.File,gat=t.ReadableStream,yat=t.getMultipartRequestOptions,bat=t.getDefaultAgent,jEe=t.fileFromPath,_at=t.isFsReadStream}var Xbr,IV,mat,sdo,udo,ldo,hat,cdo,NEe,gat,yat,bat,jEe,_at,vat=v(()=>{Xbr=!1});var DEe,Ybr=v(()=>{DEe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function Qbr({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 DEe(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 e_r=v(()=>{Ybr()});var t_r=v(()=>{e_r()});var wat,aae=v(()=>{vat();t_r();vat();wat=()=>{IV||Zbr(Qbr(),{auto:!0})};wat()});var Eg,wh,RV,Ak,FG,sae,uae,lae,cae,dae,fae,pae,mae,hae=v(()=>{kG();Eg=class extends Error{},wh=class t extends Eg{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 Ak({message:n,cause:$Ee(r)});let i=r;return e===400?new sae(e,i,n,o):e===401?new uae(e,i,n,o):e===403?new lae(e,i,n,o):e===404?new cae(e,i,n,o):e===409?new dae(e,i,n,o):e===422?new fae(e,i,n,o):e===429?new pae(e,i,n,o):e>=500?new mae(e,i,n,o):new t(e,i,n,o)}},RV=class extends wh{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Ak=class extends wh{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},FG=class extends Ak{constructor({message:e}={}){super({message:e??"Request timed out."})}},sae=class extends wh{},uae=class extends wh{},lae=class extends wh{},cae=class extends wh{},dae=class extends wh{},fae=class extends wh{},pae=class extends wh{},mae=class extends wh{}});function mdo(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function r_r(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 LEe,Sat,qG,n_r=v(()=>{aae();hae();hae();LEe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new Sat;async function*i(){if(!e.body)throw r.abort(),new Eg("Attempted to iterate over a response with no body");let s=new qG,u=r_r(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 wh(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 qG,s=r_r(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 gat({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?.()}})}},Sat=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]=mdo(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},qG=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 Eg(`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 Eg(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Eg("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}};qG.NEWLINE_CHARS=new Set([`
|
||
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);qG.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g});async function Oat(t,e,r){if(t=await t,i_r(t))return t;if(o_r(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=gae(o)?[await o.arrayBuffer()]:[o];return new NEe(i,e,r)}let n=await gdo(t);if(e||(e=bdo(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new NEe(n,e,r)}async function gdo(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(gae(t))e.push(await t.arrayBuffer());else if(_do(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${ydo(t)}`);return e}function ydo(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function bdo(t){return Cat(t.name)||Cat(t.filename)||Cat(t.path)?.split(/[\\/]/).pop()}var o_r,i_r,gae,hdo,Cat,_do,Tat,AV,a_r,xat,FEe=v(()=>{aae();aae();o_r=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",i_r=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&gae(t),gae=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",hdo=t=>i_r(t)||o_r(t)||_at(t);Cat=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},_do=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Tat=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",AV=async t=>{let e=await a_r(t.body);return yat(e,t)},a_r=async t=>{let e=new hat;return await Promise.all(Object.entries(t||{}).map(([r,n])=>xat(e,r,n))),e},xat=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(hdo(r)){let n=await Oat(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>xat(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>xat(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 f_r(t){let{response:e}=t;if(t.options.stream)return UG("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):LEe.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 UG("response",e.status,e.url,e.headers,a),a}let i=await e.text();return UG("response",e.status,e.url,e.headers,i),i}function Odo(){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 Rdo(t){if(!t)return!0;for(let e in t)return!1;return!0}function Ado(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function d_r(t,e){for(let r in e){if(!Ado(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 UG(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var wdo,Sdo,kEe,UEe,BEe,s_r,Pat,Cdo,xdo,u_r,l_r,c_r,Tdo,Edo,Pdo,Mdo,Ido,Eat,$Ee,Mat,Ndo,p_r,jdo,qEe,kG=v(()=>{Gbr();n_r();hae();aae();FEe();FEe();wdo=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},Sdo=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)};wat();UEe=class t extends Promise{constructor(e,r=f_r){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)}},BEe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e4,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Eat("maxRetries",r),this.timeout=Eat("timeout",n),this.httpAgent=o,this.fetch=i??mat}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...Tdo(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${Ndo()}`}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&&gae(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:Tat(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&&Eat("timeout",e.timeout),e.timeout=e.timeout??this.timeout;let c=e.httpAgent??this.httpAgent??bat(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 d_r(i,a),d_r(i,r),Tat(e.body)&&IV!=="node"&&delete i["content-type"],qEe(a,"x-stainless-retry-count")===void 0&&qEe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),qEe(a,"x-stainless-timeout")===void 0&&qEe(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 wh.generate(e,r,n,o)}request(e,r=null){return new UEe(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}),UG("request",a,n,i.headers),n.signal?.aborted)throw new RV;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch($Ee);if(l instanceof Error){if(n.signal?.aborted)throw new RV;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new FG:new Ak({cause:l})}let c=Cdo(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let y=`retrying, ${r} attempts remaining`;return UG(`response (error; ${y})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(y=>$Ee(y).message),f=Edo(d),p=f?void 0:d;throw UG(`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 Pat(this,n,e)}buildURL(e,r){let n=Mdo(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return Rdo(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 Eg(`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 Ido(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 ${MV}`}},s_r=class{constructor(e,r,n,o){kEe.set(this,void 0),wdo(this,kEe,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 Eg("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 Sdo(this,kEe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(kEe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Pat=class extends UEe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await f_r(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},Cdo=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),xdo=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":MV,"X-Stainless-OS":l_r(Deno.build.os),"X-Stainless-Arch":u_r(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":MV,"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":MV,"X-Stainless-OS":l_r(process.platform),"X-Stainless-Arch":u_r(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=Odo();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":MV,"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":MV,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};u_r=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",l_r=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"),Tdo=()=>c_r??(c_r=xdo()),Edo=t=>{try{return JSON.parse(t)}catch{return}},Pdo=/^[a-z][a-z0-9+.-]*:/i,Mdo=t=>Pdo.test(t),Ido=t=>new Promise(e=>setTimeout(e,t)),Eat=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Eg(`${t} must be an integer`);if(e<0)throw new Eg(`${t} must be a positive integer`);return e},$Ee=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)},Mat=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};Ndo=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),p_r=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",jdo=t=>typeof t?.get=="function",qEe=(t,e)=>{let r=e.toLowerCase();if(jdo(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 m_r=v(()=>{});var zl,qS=v(()=>{zl=class{constructor(e){this._client=e}}});var BG,Iat=v(()=>{qS();BG=class extends zl{create(e,r){return this._client.post("/openai/v1/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var zG,Rat=v(()=>{qS();kG();zG=class extends zl{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",AV({body:e,...r}))}}});var VG,Aat=v(()=>{qS();kG();VG=class extends zl{create(e,r){return this._client.post("/openai/v1/audio/translations",AV({body:e,...r}))}}});var ER,Nat=v(()=>{qS();Iat();Iat();Rat();Rat();Aat();Aat();ER=class extends zl{constructor(){super(...arguments),this.speech=new BG(this._client),this.transcriptions=new zG(this._client),this.translations=new VG(this._client)}};ER.Speech=BG;ER.Transcriptions=zG;ER.Translations=VG});var NV,jat=v(()=>{qS();NV=class extends zl{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 HG,Dat=v(()=>{qS();HG=class extends zl{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}}});var Nk,$at=v(()=>{qS();Dat();Dat();Nk=class extends zl{constructor(){super(...arguments),this.completions=new HG(this._client)}};Nk.Completions=HG});var jV,Lat=v(()=>{qS();jV=class extends zl{}});var DV,Fat=v(()=>{qS();DV=class extends zl{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}}});var $V,kat=v(()=>{qS();kG();$V=class extends zl{create(e,r){return this._client.post("/openai/v1/files",AV({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 LV,qat=v(()=>{qS();LV=class extends zl{retrieve(e,r){return this._client.get(`/openai/v1/models/${e}`,r)}list(e){return this._client.get("/openai/v1/models",e)}delete(e,r){return this._client.delete(`/openai/v1/models/${e}`,r)}}});var h_r=v(()=>{m_r();Nat();jat();$at();Lat();Fat();kat();qat()});var g_r,hu,y_r,b_r=v(()=>{kG();hae();FEe();h_r();jat();Lat();Fat();kat();qat();Nat();$at();hu=class extends BEe{constructor({baseURL:e=Mat("GROQ_BASE_URL"),apiKey:r=Mat("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new Eg("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&&p_r())throw new Eg(`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 jV(this),this.chat=new Nk(this),this.embeddings=new DV(this),this.audio=new ER(this),this.models=new LV(this),this.batches=new NV(this),this.files=new $V(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}`}}};g_r=hu;hu.Groq=g_r;hu.DEFAULT_TIMEOUT=6e4;hu.GroqError=Eg;hu.APIError=wh;hu.APIConnectionError=Ak;hu.APIConnectionTimeoutError=FG;hu.APIUserAbortError=RV;hu.NotFoundError=cae;hu.ConflictError=dae;hu.RateLimitError=pae;hu.BadRequestError=sae;hu.AuthenticationError=uae;hu.InternalServerError=mae;hu.PermissionDeniedError=lae;hu.UnprocessableEntityError=fae;hu.toFile=Oat;hu.fileFromPath=jEe;hu.Completions=jV;hu.Chat=Nk;hu.Embeddings=DV;hu.Audio=ER;hu.Models=LV;hu.Batches=NV;hu.Files=$V;y_r=hu});function zdo(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 v_r(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(!nd.isInstance(t))throw new Error("Invalid generic chat message");return zdo(t);default:throw new Error(`Unknown message type: ${t.type}`)}}function __r(t){return t.map(e=>{let r={role:v_r(e),content:e.content,name:e.name,function_call:e.additional_kwargs.function_call,tool_calls:e.additional_kwargs.tool_calls,tool_call_id:e.tool_call_id};return Pl(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(ck):(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 Vdo(t,e,r){let n=t.tool_calls;switch(t.role){case"assistant":{let o=[],i=[];for(let a of n??[])try{o.push(kC(a,{returnId:!0}))}catch(s){i.push(AS(a,s.message))}return new eo({content:t.content||"",additional_kwargs:{tool_calls:n},tool_calls:o,invalid_tool_calls:i,usage_metadata:e,response_metadata:r})}default:return new nd(t.content||"",t.role??"unknown")}}function Hdo(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 mv({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 Ir({content:i,tool_call_chunks:f,additional_kwargs:a,id:u,response_metadata:d})}else return o==="system"?new Wy({content:i,response_metadata:d}):o==="developer"?new Wy({content:i,response_metadata:d,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new pv({content:i,additional_kwargs:a,name:t.name,response_metadata:d}):o==="tool"?new Iw({content:i,additional_kwargs:a,tool_call_id:t.tool_call_id,response_metadata:d}):new fv({content:i,role:o,response_metadata:d})}function Jdo(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 qdo,Udo,Bdo,Uat,w_r=v(()=>{nb();YI();Qa();id();ku();Wv();b_r();_v();fO();$8();g1();qdo=["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"],Udo=["headers","promptIndex","stream_options","tools"],Bdo=[...qdo,...Udo];Uat=class extends md{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||vn("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 y_r({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,...Bdo]}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:Jdo(e?.tool_choice),tools:e?.tools?.length?e.tools.map(a=>h1(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=>h1(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r,{streaming:!0}),i=__r(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=Hdo(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 yi({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 yi({message:new Ir({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=__r(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:Vdo(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;Ya(n)?(u=Jw.fromZodSchema(n),p=Ni(n)):u=new vv,l=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"jsonMode"},schema:p}})}else if(Ya(n)){let p=Ni(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 qC({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 qC({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=Eu.assign({parsed:(p,m)=>u.invoke(p.raw,m)}),d=Eu.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return Rl.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}}});var S_r=v(()=>{w_r()});function Kdo(t){return Wdo.test(t)}function Gdo(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 Xdo(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 yae(t){if(Kdo(t))return t;{let e=Xdo(t),r=Gdo(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function Bat(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 Wdo,C_r=v(()=>{Wdo=/^[a-zA-Z0-9]{9}$/});function x_r(t,e=0){return(Pg[t[e+0]]+Pg[t[e+1]]+Pg[t[e+2]]+Pg[t[e+3]]+"-"+Pg[t[e+4]]+Pg[t[e+5]]+"-"+Pg[t[e+6]]+Pg[t[e+7]]+"-"+Pg[t[e+8]]+Pg[t[e+9]]+"-"+Pg[t[e+10]]+Pg[t[e+11]]+Pg[t[e+12]]+Pg[t[e+13]]+Pg[t[e+14]]+Pg[t[e+15]]).toLowerCase()}var Pg,VEe,O_r=v(()=>{Pg=[];for(VEe=0;VEe<256;++VEe)Pg.push((VEe+256).toString(16).slice(1))});function zat(){if(!HEe&&(HEe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!HEe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return HEe(Zdo)}var HEe,Zdo,T_r=v(()=>{Zdo=new Uint8Array(16)});var Ydo,Vat,E_r=v(()=>{Ydo=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vat={randomUUID:Ydo}});function Qdo(t,e,r){if(Vat.randomUUID&&!e&&!t)return Vat.randomUUID();t=t||{};var n=t.random||(t.rng||zat)();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 x_r(n)}var JEe,P_r=v(()=>{E_r();T_r();O_r();JEe=Qdo});var M_r=v(()=>{P_r()});var cr=S(Hat=>{"use strict";Object.defineProperty(Hat,"__esModule",{value:!0});Hat.pathToFunc=tfo;var efo=Object.prototype.hasOwnProperty;function tfo(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!efo.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 WEe=S(US=>{"use strict";Object.defineProperty(US,"__esModule",{value:!0});US.SDK_METADATA=US.ServerList=US.ServerEu=void 0;US.serverURLFromOptions=nfo;var rfo=cr();US.ServerEu="eu";US.ServerList={[US.ServerEu]:"https://api.mistral.ai"};function nfo(t){let e=t.serverURL,r={};if(!e){let o=t.server??US.ServerEu;e=US.ServerList[o]||""}let n=(0,rfo.pathToFunc)(e)(r);return new URL(n)}US.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 JG=S(KEe=>{"use strict";Object.defineProperty(KEe,"__esModule",{value:!0});KEe.readableStreamToArrayBuffer=ofo;KEe.getContentTypeFromFileName=ifo;async function ofo(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 ifo(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 WG=S(PR=>{"use strict";Object.defineProperty(PR,"__esModule",{value:!0});PR.HTTPClient=void 0;PR.matchContentType=R_r;PR.matchStatusCode=A_r;PR.matchResponse=ufo;PR.isConnectionError=lfo;PR.isTimeoutError=cfo;PR.isAbortError=dfo;var afo=(t,e)=>e==null?fetch(t):fetch(t,e),Jat=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||afo}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}};PR.HTTPClient=Jat;var I_r=/\s*;\s*/g;function R_r(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(I_r),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(I_r),[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 sfo=new RegExp("^[0-9]xx$","i");function A_r(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(!sfo.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 ufo(t,e,r){return A_r(t,e)&&R_r(t,r)}function lfo(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 cfo(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 dfo(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 N_r=S(GEe=>{"use strict";Object.defineProperty(GEe,"__esModule",{value:!0});GEe.CustomUserAgentHook=void 0;var ffo=WEe(),Wat=class{beforeRequest(e,r){let o=`mistral-client-typescript/${ffo.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};GEe.CustomUserAgentHook=Wat});var D_r=S(XEe=>{"use strict";Object.defineProperty(XEe,"__esModule",{value:!0});XEe.DeprecationWarningHook=void 0;var j_r="x-model-deprecation-timestamp",Kat=class{afterSuccess(e,r){return r.headers.has(j_r)&&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(j_r)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};XEe.DeprecationWarningHook=Kat});var $_r=S(Gat=>{"use strict";Object.defineProperty(Gat,"__esModule",{value:!0});Gat.initHooks=hfo;var pfo=N_r(),mfo=D_r();function hfo(t){let e=new pfo.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new mfo.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var L_r=S(ZEe=>{"use strict";Object.defineProperty(ZEe,"__esModule",{value:!0});ZEe.SDKHooks=void 0;var gfo=$_r(),Xat=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,gfo.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}}};ZEe.SDKHooks=Xat});var rst=S(P_=>{"use strict";Object.defineProperty(P_,"__esModule",{value:!0});P_.ConnectionError=P_.RequestTimeoutError=P_.RequestAbortedError=P_.InvalidRequestError=P_.UnexpectedClientError=P_.HTTPClientError=void 0;var jk=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)}};P_.HTTPClientError=jk;var Zat=class extends jk{constructor(){super(...arguments),this.name="UnexpectedClientError"}};P_.UnexpectedClientError=Zat;var Yat=class extends jk{constructor(){super(...arguments),this.name="InvalidRequestError"}};P_.InvalidRequestError=Yat;var Qat=class extends jk{constructor(){super(...arguments),this.name="RequestAbortedError"}};P_.RequestAbortedError=Qat;var est=class extends jk{constructor(){super(...arguments),this.name="RequestTimeoutError"}};P_.RequestTimeoutError=est;var tst=class extends jk{constructor(){super(...arguments),this.name="ConnectionError"}};P_.ConnectionError=tst});var vd=S(KG=>{"use strict";Object.defineProperty(KG,"__esModule",{value:!0});KG.OK=yfo;KG.ERR=bfo;KG.unwrap=_fo;KG.unwrapAsync=vfo;function yfo(t){return{ok:!0,value:t}}function bfo(t){return{ok:!1,error:t}}function _fo(t){if(!t.ok)throw t.error;return t.value}async function vfo(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var bae=S(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.getParsedType=Ku.ZodParsedType=Ku.objectUtil=Ku.util=void 0;var nst;(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})(nst||(Ku.util=nst={}));var F_r;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(F_r||(Ku.objectUtil=F_r={}));Ku.ZodParsedType=nst.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var wfo=t=>{switch(typeof t){case"undefined":return Ku.ZodParsedType.undefined;case"string":return Ku.ZodParsedType.string;case"number":return Number.isNaN(t)?Ku.ZodParsedType.nan:Ku.ZodParsedType.number;case"boolean":return Ku.ZodParsedType.boolean;case"function":return Ku.ZodParsedType.function;case"bigint":return Ku.ZodParsedType.bigint;case"symbol":return Ku.ZodParsedType.symbol;case"object":return Array.isArray(t)?Ku.ZodParsedType.array:t===null?Ku.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ku.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?Ku.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?Ku.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?Ku.ZodParsedType.date:Ku.ZodParsedType.object;default:return Ku.ZodParsedType.unknown}};Ku.getParsedType=wfo});var YEe=S(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});Dk.ZodError=Dk.quotelessJson=Dk.ZodIssueCode=void 0;var k_r=bae();Dk.ZodIssueCode=k_r.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 Sfo=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Dk.quotelessJson=Sfo;var _ae=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,k_r.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()}};Dk.ZodError=_ae;_ae.create=t=>new _ae(t)});var ist=S(ost=>{"use strict";Object.defineProperty(ost,"__esModule",{value:!0});var xy=YEe(),FV=bae(),Cfo=(t,e)=>{let r;switch(t.code){case xy.ZodIssueCode.invalid_type:t.received===FV.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case xy.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,FV.util.jsonStringifyReplacer)}`;break;case xy.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${FV.util.joinValues(t.keys,", ")}`;break;case xy.ZodIssueCode.invalid_union:r="Invalid input";break;case xy.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${FV.util.joinValues(t.options)}`;break;case xy.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${FV.util.joinValues(t.options)}, received '${t.received}'`;break;case xy.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case xy.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case xy.ZodIssueCode.invalid_date:r="Invalid date";break;case xy.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}"`:FV.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case xy.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 xy.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 xy.ZodIssueCode.custom:r="Invalid input";break;case xy.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case xy.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case xy.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,FV.util.assertNever(t)}return{message:r}};ost.default=Cfo});var QEe=S($k=>{"use strict";var xfo=$k&&$k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty($k,"__esModule",{value:!0});$k.defaultErrorMap=void 0;$k.setErrorMap=Ofo;$k.getErrorMap=Tfo;var q_r=xfo(ist());$k.defaultErrorMap=q_r.default;var U_r=q_r.default;function Ofo(t){U_r=t}function Tfo(){return U_r}});var sst=S(au=>{"use strict";var Efo=au&&au.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(au,"__esModule",{value:!0});au.isAsync=au.isValid=au.isDirty=au.isAborted=au.OK=au.DIRTY=au.INVALID=au.ParseStatus=au.EMPTY_PATH=au.makeIssue=void 0;au.addIssueToContext=Ifo;var Pfo=QEe(),B_r=Efo(ist()),Mfo=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}};au.makeIssue=Mfo;au.EMPTY_PATH=[];function Ifo(t,e){let r=(0,Pfo.getErrorMap)(),n=(0,au.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===B_r.default?void 0:B_r.default].filter(o=>!!o)});t.common.issues.push(n)}var ast=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 au.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 au.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}}};au.ParseStatus=ast;au.INVALID=Object.freeze({status:"aborted"});var Rfo=t=>({status:"dirty",value:t});au.DIRTY=Rfo;var Afo=t=>({status:"valid",value:t});au.OK=Afo;var Nfo=t=>t.status==="aborted";au.isAborted=Nfo;var jfo=t=>t.status==="dirty";au.isDirty=jfo;var Dfo=t=>t.status==="valid";au.isValid=Dfo;var $fo=t=>typeof Promise<"u"&&t instanceof Promise;au.isAsync=$fo});var V_r=S(z_r=>{"use strict";Object.defineProperty(z_r,"__esModule",{value:!0})});var J_r=S(ePe=>{"use strict";Object.defineProperty(ePe,"__esModule",{value:!0});ePe.errorUtil=void 0;var H_r;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(H_r||(ePe.errorUtil=H_r={}))});var ovr=S(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.discriminatedUnion=we.date=we.boolean=we.bigint=we.array=we.any=we.coerce=we.ZodFirstPartyTypeKind=we.late=we.ZodSchema=we.Schema=we.ZodReadonly=we.ZodPipeline=we.ZodBranded=we.BRAND=we.ZodNaN=we.ZodCatch=we.ZodDefault=we.ZodNullable=we.ZodOptional=we.ZodTransformer=we.ZodEffects=we.ZodPromise=we.ZodNativeEnum=we.ZodEnum=we.ZodLiteral=we.ZodLazy=we.ZodFunction=we.ZodSet=we.ZodMap=we.ZodRecord=we.ZodTuple=we.ZodIntersection=we.ZodDiscriminatedUnion=we.ZodUnion=we.ZodObject=we.ZodArray=we.ZodVoid=we.ZodNever=we.ZodUnknown=we.ZodAny=we.ZodNull=we.ZodUndefined=we.ZodSymbol=we.ZodDate=we.ZodBoolean=we.ZodBigInt=we.ZodNumber=we.ZodString=we.ZodType=void 0;we.NEVER=we.void=we.unknown=we.union=we.undefined=we.tuple=we.transformer=we.symbol=we.string=we.strictObject=we.set=we.record=we.promise=we.preprocess=we.pipeline=we.ostring=we.optional=we.onumber=we.oboolean=we.object=we.number=we.nullable=we.null=we.never=we.nativeEnum=we.nan=we.map=we.literal=we.lazy=we.intersection=we.instanceof=we.function=we.enum=we.effect=void 0;we.datetimeRegex=Z_r;we.custom=Q_r;var xt=YEe(),tPe=QEe(),qr=J_r(),Ce=sst(),jt=bae(),zS=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}},W_r=(t,e)=>{if((0,Ce.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 Wo(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 Ko=class{get description(){return this._def.description}_getType(e){return(0,jt.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,jt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ce.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,jt.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,Ce.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,jt.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return W_r(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,jt.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return(0,Ce.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,Ce.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,jt.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,Ce.isAsync)(o)?o:Promise.resolve(o));return W_r(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 tw({schema:this,typeName:Bn.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 BS.create(this,this._def)}nullable(){return IR.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return G1.create(this)}promise(){return kk.create(this,this._def)}or(e){return HV.create([this,e],this._def)}and(e){return JV.create(this,e,this._def)}transform(e){return new tw({...Wo(this._def),schema:this,typeName:Bn.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ZV({...Wo(this._def),innerType:this,defaultValue:r,typeName:Bn.ZodDefault})}brand(){return new vae({typeName:Bn.ZodBranded,type:this,...Wo(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new YV({...Wo(this._def),innerType:this,catchValue:r,typeName:Bn.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return wae.create(this,e)}readonly(){return QV.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};we.ZodType=Ko;we.Schema=Ko;we.ZodSchema=Ko;var Lfo=/^c[^\s-]{8,}$/i,Ffo=/^[0-9a-z]+$/,kfo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qfo=/^[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,Ufo=/^[a-z0-9_-]{21}$/i,Bfo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zfo=/^[-+]?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)?)??$/,Vfo=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hfo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ust,Jfo=/^(?:(?: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])$/,Wfo=/^(?:(?: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])$/,Kfo=/^(([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]))$/,Gfo=/^(([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])$/,Xfo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Zfo=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,G_r="((\\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])))",Yfo=new RegExp(`^${G_r}$`);function X_r(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 Qfo(t){return new RegExp(`^${X_r(t)}$`)}function Z_r(t){let e=`${G_r}T${X_r(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 epo(t,e){return!!((e==="v4"||!e)&&Jfo.test(t)||(e==="v6"||!e)&&Kfo.test(t))}function tpo(t,e){if(!Bfo.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 rpo(t,e){return!!((e==="v4"||!e)&&Wfo.test(t)||(e==="v6"||!e)&&Gfo.test(t))}var Lk=class t extends Ko{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==jt.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(i,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.string,received:i.parsedType}),Ce.INVALID}let n=new Ce.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,Ce.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,Ce.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,Ce.addIssueToContext)(o,{code:xt.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,Ce.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")Vfo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"email",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")ust||(ust=new RegExp(Hfo,"u")),ust.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"emoji",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")qfo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"uuid",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Ufo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"nanoid",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Lfo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"cuid",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Ffo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"cuid2",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")kfo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.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,Ce.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,Ce.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,Ce.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,Ce.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,Ce.addIssueToContext)(o,{code:xt.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Z_r(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{code:xt.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Yfo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{code:xt.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Qfo(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{code:xt.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?zfo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"duration",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?epo(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"ip",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?tpo(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"jwt",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?rpo(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"cidr",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Xfo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"base64",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Zfo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Ce.addIssueToContext)(o,{validation:"base64url",code:xt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):jt.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,...qr.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...qr.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...qr.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...qr.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...qr.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...qr.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...qr.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...qr.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...qr.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...qr.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...qr.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...qr.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...qr.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...qr.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,...qr.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,...qr.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...qr.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...qr.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...qr.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...qr.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...qr.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...qr.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...qr.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...qr.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,qr.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}};we.ZodString=Lk;Lk.create=t=>new Lk({checks:[],typeName:Bn.ZodString,coerce:t?.coerce??!1,...Wo(t)});function npo(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 kV=class t extends Ko{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)!==jt.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(i,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.number,received:i.parsedType}),Ce.INVALID}let n,o=new Ce.ParseStatus;for(let i of this._def.checks)i.kind==="int"?jt.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,Ce.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,Ce.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,Ce.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"?npo(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,Ce.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,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.not_finite,message:i.message}),o.dirty()):jt.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,qr.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,qr.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,qr.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,qr.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:qr.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:qr.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:qr.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:qr.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:qr.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:qr.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:qr.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:qr.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:qr.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:qr.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"&&jt.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)}};we.ZodNumber=kV;kV.create=t=>new kV({checks:[],typeName:Bn.ZodNumber,coerce:t?.coerce||!1,...Wo(t)});var qV=class t extends Ko{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)!==jt.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new Ce.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,Ce.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,Ce.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,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):jt.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.bigint,received:r.parsedType}),Ce.INVALID}gte(e,r){return this.setLimit("min",e,!0,qr.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,qr.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,qr.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,qr.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:qr.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:qr.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:qr.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:qr.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:qr.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:qr.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}};we.ZodBigInt=qV;qV.create=t=>new qV({checks:[],typeName:Bn.ZodBigInt,coerce:t?.coerce??!1,...Wo(t)});var UV=class extends Ko{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==jt.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.boolean,received:n.parsedType}),Ce.INVALID}return(0,Ce.OK)(e.data)}};we.ZodBoolean=UV;UV.create=t=>new UV({typeName:Bn.ZodBoolean,coerce:t?.coerce||!1,...Wo(t)});var BV=class t extends Ko{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==jt.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(i,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.date,received:i.parsedType}),Ce.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(i,{code:xt.ZodIssueCode.invalid_date}),Ce.INVALID}let n=new Ce.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,Ce.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,Ce.addIssueToContext)(o,{code:xt.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):jt.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:qr.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:qr.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}};we.ZodDate=BV;BV.create=t=>new BV({checks:[],coerce:t?.coerce||!1,typeName:Bn.ZodDate,...Wo(t)});var XG=class extends Ko{_parse(e){if(this._getType(e)!==jt.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.symbol,received:n.parsedType}),Ce.INVALID}return(0,Ce.OK)(e.data)}};we.ZodSymbol=XG;XG.create=t=>new XG({typeName:Bn.ZodSymbol,...Wo(t)});var zV=class extends Ko{_parse(e){if(this._getType(e)!==jt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.undefined,received:n.parsedType}),Ce.INVALID}return(0,Ce.OK)(e.data)}};we.ZodUndefined=zV;zV.create=t=>new zV({typeName:Bn.ZodUndefined,...Wo(t)});var VV=class extends Ko{_parse(e){if(this._getType(e)!==jt.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.null,received:n.parsedType}),Ce.INVALID}return(0,Ce.OK)(e.data)}};we.ZodNull=VV;VV.create=t=>new VV({typeName:Bn.ZodNull,...Wo(t)});var Fk=class extends Ko{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,Ce.OK)(e.data)}};we.ZodAny=Fk;Fk.create=t=>new Fk({typeName:Bn.ZodAny,...Wo(t)});var K1=class extends Ko{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,Ce.OK)(e.data)}};we.ZodUnknown=K1;K1.create=t=>new K1({typeName:Bn.ZodUnknown,...Wo(t)});var HC=class extends Ko{_parse(e){let r=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.never,received:r.parsedType}),Ce.INVALID}};we.ZodNever=HC;HC.create=t=>new HC({typeName:Bn.ZodNever,...Wo(t)});var ZG=class extends Ko{_parse(e){if(this._getType(e)!==jt.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.void,received:n.parsedType}),Ce.INVALID}return(0,Ce.OK)(e.data)}};we.ZodVoid=ZG;ZG.create=t=>new ZG({typeName:Bn.ZodVoid,...Wo(t)});var G1=class t extends Ko{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==jt.ZodParsedType.array)return(0,Ce.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.array,received:r.parsedType}),Ce.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,Ce.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,Ce.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,Ce.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 zS(r,a,r.path,s)))).then(a=>Ce.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new zS(r,a,r.path,s)));return Ce.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:qr.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:qr.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:qr.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};we.ZodArray=G1;G1.create=(t,e)=>new G1({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Bn.ZodArray,...Wo(e)});function GG(t){if(t instanceof M_){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=BS.create(GG(n))}return new M_({...t._def,shape:()=>e})}else return t instanceof G1?new G1({...t._def,type:GG(t.element)}):t instanceof BS?BS.create(GG(t.unwrap())):t instanceof IR?IR.create(GG(t.unwrap())):t instanceof MR?MR.create(t.items.map(e=>GG(e))):t}var M_=class t extends Ko{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=jt.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==jt.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(l,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.object,received:l.parsedType}),Ce.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof HC&&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 zS(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof HC){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,Ce.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 zS(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=>Ce.ParseStatus.mergeObjectSync(n,l)):Ce.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return qr.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:qr.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:Bn.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 jt.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 jt.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return GG(this)}partial(e){let r={};for(let n of jt.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 jt.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof BS;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Y_r(jt.util.objectKeys(this.shape))}};we.ZodObject=M_;M_.create=(t,e)=>new M_({shape:()=>t,unknownKeys:"strip",catchall:HC.create(),typeName:Bn.ZodObject,...Wo(e)});M_.strictCreate=(t,e)=>new M_({shape:()=>t,unknownKeys:"strict",catchall:HC.create(),typeName:Bn.ZodObject,...Wo(e)});M_.lazycreate=(t,e)=>new M_({shape:t,unknownKeys:"strip",catchall:HC.create(),typeName:Bn.ZodObject,...Wo(e)});var HV=class extends Ko{_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,Ce.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_union,unionErrors:a}),Ce.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,Ce.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_union,unionErrors:s}),Ce.INVALID}}get options(){return this._def.options}};we.ZodUnion=HV;HV.create=(t,e)=>new HV({options:t,typeName:Bn.ZodUnion,...Wo(e)});var W1=t=>t instanceof WV?W1(t.schema):t instanceof tw?W1(t.innerType()):t instanceof KV?[t.value]:t instanceof GV?t.options:t instanceof XV?jt.util.objectValues(t.enum):t instanceof ZV?W1(t._def.innerType):t instanceof zV?[void 0]:t instanceof VV?[null]:t instanceof BS?[void 0,...W1(t.unwrap())]:t instanceof IR?[null,...W1(t.unwrap())]:t instanceof vae||t instanceof QV?W1(t.unwrap()):t instanceof YV?W1(t._def.innerType):[],rPe=class t extends Ko{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==jt.ZodParsedType.object)return(0,Ce.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.object,received:r.parsedType}),Ce.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,Ce.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ce.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=W1(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:Bn.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...Wo(n)})}};we.ZodDiscriminatedUnion=rPe;function lst(t,e){let r=(0,jt.getParsedType)(t),n=(0,jt.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===jt.ZodParsedType.object&&n===jt.ZodParsedType.object){let o=jt.util.objectKeys(e),i=jt.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=lst(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===jt.ZodParsedType.array&&n===jt.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=lst(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===jt.ZodParsedType.date&&n===jt.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var JV=class extends Ko{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if((0,Ce.isAborted)(i)||(0,Ce.isAborted)(a))return Ce.INVALID;let s=lst(i.value,a.value);return s.valid?(((0,Ce.isDirty)(i)||(0,Ce.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_intersection_types}),Ce.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}))}};we.ZodIntersection=JV;JV.create=(t,e,r)=>new JV({left:t,right:e,typeName:Bn.ZodIntersection,...Wo(r)});var MR=class t extends Ko{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==jt.ZodParsedType.array)return(0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.array,received:n.parsedType}),Ce.INVALID;if(n.data.length<this._def.items.length)return(0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ce.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,Ce.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 zS(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Ce.ParseStatus.mergeArray(r,a)):Ce.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};we.ZodTuple=MR;MR.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new MR({items:t,typeName:Bn.ZodTuple,rest:null,...Wo(e)})};var nPe=class t extends Ko{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!==jt.ZodParsedType.object)return(0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.object,received:n.parsedType}),Ce.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new zS(n,s,n.path,s)),value:a._parse(new zS(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ce.ParseStatus.mergeObjectAsync(r,o):Ce.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Ko?new t({keyType:e,valueType:r,typeName:Bn.ZodRecord,...Wo(n)}):new t({keyType:Lk.create(),valueType:e,typeName:Bn.ZodRecord,...Wo(r)})}};we.ZodRecord=nPe;var YG=class extends Ko{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!==jt.ZodParsedType.map)return(0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.map,received:n.parsedType}),Ce.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new zS(n,s,n.path,[l,"key"])),value:i._parse(new zS(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 Ce.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 Ce.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};we.ZodMap=YG;YG.create=(t,e,r)=>new YG({valueType:e,keyType:t,typeName:Bn.ZodMap,...Wo(r)});var QG=class t extends Ko{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==jt.ZodParsedType.set)return(0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.set,received:n.parsedType}),Ce.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,Ce.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,Ce.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 Ce.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 zS(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:qr.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:qr.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};we.ZodSet=QG;QG.create=(t,e)=>new QG({valueType:t,minSize:null,maxSize:null,typeName:Bn.ZodSet,...Wo(e)});var oPe=class t extends Ko{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==jt.ZodParsedType.function)return(0,Ce.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.function,received:r.parsedType}),Ce.INVALID;function n(s,u){return(0,Ce.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,tPe.getErrorMap)(),tPe.defaultErrorMap].filter(l=>!!l),issueData:{code:xt.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,Ce.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,tPe.getErrorMap)(),tPe.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 kk){let s=this;return(0,Ce.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,Ce.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:MR.create(e).rest(K1.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||MR.create([]).rest(K1.create()),returns:r||K1.create(),typeName:Bn.ZodFunction,...Wo(n)})}};we.ZodFunction=oPe;var WV=class extends Ko{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})}};we.ZodLazy=WV;WV.create=(t,e)=>new WV({getter:t,typeName:Bn.ZodLazy,...Wo(e)});var KV=class extends Ko{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(r,{received:r.data,code:xt.ZodIssueCode.invalid_literal,expected:this._def.value}),Ce.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};we.ZodLiteral=KV;KV.create=(t,e)=>new KV({value:t,typeName:Bn.ZodLiteral,...Wo(e)});function Y_r(t,e){return new GV({values:t,typeName:Bn.ZodEnum,...Wo(e)})}var GV=class t extends Ko{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,Ce.addIssueToContext)(r,{expected:jt.util.joinValues(n),received:r.parsedType,code:xt.ZodIssueCode.invalid_type}),Ce.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,Ce.addIssueToContext)(r,{received:r.data,code:xt.ZodIssueCode.invalid_enum_value,options:n}),Ce.INVALID}return(0,Ce.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})}};we.ZodEnum=GV;GV.create=Y_r;var XV=class extends Ko{_parse(e){let r=jt.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==jt.ZodParsedType.string&&n.parsedType!==jt.ZodParsedType.number){let o=jt.util.objectValues(r);return(0,Ce.addIssueToContext)(n,{expected:jt.util.joinValues(o),received:n.parsedType,code:xt.ZodIssueCode.invalid_type}),Ce.INVALID}if(this._cache||(this._cache=new Set(jt.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=jt.util.objectValues(r);return(0,Ce.addIssueToContext)(n,{received:n.data,code:xt.ZodIssueCode.invalid_enum_value,options:o}),Ce.INVALID}return(0,Ce.OK)(e.data)}get enum(){return this._def.values}};we.ZodNativeEnum=XV;XV.create=(t,e)=>new XV({values:t,typeName:Bn.ZodNativeEnum,...Wo(e)});var kk=class extends Ko{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==jt.ZodParsedType.promise&&r.common.async===!1)return(0,Ce.addIssueToContext)(r,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.promise,received:r.parsedType}),Ce.INVALID;let n=r.parsedType===jt.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,Ce.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};we.ZodPromise=kk;kk.create=(t,e)=>new kk({type:t,typeName:Bn.ZodPromise,...Wo(e)});var tw=class extends Ko{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Bn.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,Ce.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 Ce.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?Ce.INVALID:u.status==="dirty"||r.value==="dirty"?(0,Ce.DIRTY)(u.value):u});{if(r.value==="aborted")return Ce.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Ce.INVALID:s.status==="dirty"||r.value==="dirty"?(0,Ce.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"?Ce.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"?Ce.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,Ce.isValid)(a))return Ce.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,Ce.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):Ce.INVALID);jt.util.assertNever(o)}};we.ZodEffects=tw;we.ZodTransformer=tw;tw.create=(t,e,r)=>new tw({schema:t,typeName:Bn.ZodEffects,effect:e,...Wo(r)});tw.createWithPreprocess=(t,e,r)=>new tw({schema:e,effect:{type:"preprocess",transform:t},typeName:Bn.ZodEffects,...Wo(r)});var BS=class extends Ko{_parse(e){return this._getType(e)===jt.ZodParsedType.undefined?(0,Ce.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.ZodOptional=BS;BS.create=(t,e)=>new BS({innerType:t,typeName:Bn.ZodOptional,...Wo(e)});var IR=class extends Ko{_parse(e){return this._getType(e)===jt.ZodParsedType.null?(0,Ce.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};we.ZodNullable=IR;IR.create=(t,e)=>new IR({innerType:t,typeName:Bn.ZodNullable,...Wo(e)});var ZV=class extends Ko{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===jt.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};we.ZodDefault=ZV;ZV.create=(t,e)=>new ZV({innerType:t,typeName:Bn.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Wo(e)});var YV=class extends Ko{_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,Ce.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}};we.ZodCatch=YV;YV.create=(t,e)=>new YV({innerType:t,typeName:Bn.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Wo(e)});var e9=class extends Ko{_parse(e){if(this._getType(e)!==jt.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,Ce.addIssueToContext)(n,{code:xt.ZodIssueCode.invalid_type,expected:jt.ZodParsedType.nan,received:n.parsedType}),Ce.INVALID}return{status:"valid",value:e.data}}};we.ZodNaN=e9;e9.create=t=>new e9({typeName:Bn.ZodNaN,...Wo(t)});we.BRAND=Symbol("zod_brand");var vae=class extends Ko{_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}};we.ZodBranded=vae;var wae=class t extends Ko{_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"?Ce.INVALID:i.status==="dirty"?(r.dirty(),(0,Ce.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"?Ce.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:Bn.ZodPipeline})}};we.ZodPipeline=wae;var QV=class extends Ko{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,Ce.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,Ce.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};we.ZodReadonly=QV;QV.create=(t,e)=>new QV({innerType:t,typeName:Bn.ZodReadonly,...Wo(e)});function K_r(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Q_r(t,e={},r){return t?Fk.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=K_r(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=K_r(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Fk.create()}we.late={object:M_.lazycreate};var Bn;(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"})(Bn||(we.ZodFirstPartyTypeKind=Bn={}));var opo=(t,e={message:`Input not instance of ${t.name}`})=>Q_r(r=>r instanceof t,e);we.instanceof=opo;var evr=Lk.create;we.string=evr;var tvr=kV.create;we.number=tvr;var ipo=e9.create;we.nan=ipo;var apo=qV.create;we.bigint=apo;var rvr=UV.create;we.boolean=rvr;var spo=BV.create;we.date=spo;var upo=XG.create;we.symbol=upo;var lpo=zV.create;we.undefined=lpo;var cpo=VV.create;we.null=cpo;var dpo=Fk.create;we.any=dpo;var fpo=K1.create;we.unknown=fpo;var ppo=HC.create;we.never=ppo;var mpo=ZG.create;we.void=mpo;var hpo=G1.create;we.array=hpo;var gpo=M_.create;we.object=gpo;var ypo=M_.strictCreate;we.strictObject=ypo;var bpo=HV.create;we.union=bpo;var _po=rPe.create;we.discriminatedUnion=_po;var vpo=JV.create;we.intersection=vpo;var wpo=MR.create;we.tuple=wpo;var Spo=nPe.create;we.record=Spo;var Cpo=YG.create;we.map=Cpo;var xpo=QG.create;we.set=xpo;var Opo=oPe.create;we.function=Opo;var Tpo=WV.create;we.lazy=Tpo;var Epo=KV.create;we.literal=Epo;var Ppo=GV.create;we.enum=Ppo;var Mpo=XV.create;we.nativeEnum=Mpo;var Ipo=kk.create;we.promise=Ipo;var nvr=tw.create;we.effect=nvr;we.transformer=nvr;var Rpo=BS.create;we.optional=Rpo;var Apo=IR.create;we.nullable=Apo;var Npo=tw.createWithPreprocess;we.preprocess=Npo;var jpo=wae.create;we.pipeline=jpo;var Dpo=()=>evr().optional();we.ostring=Dpo;var $po=()=>tvr().optional();we.onumber=$po;var Lpo=()=>rvr().optional();we.oboolean=Lpo;we.coerce={string:t=>Lk.create({...t,coerce:!0}),number:t=>kV.create({...t,coerce:!0}),boolean:t=>UV.create({...t,coerce:!0}),bigint:t=>qV.create({...t,coerce:!0}),date:t=>BV.create({...t,coerce:!0})};we.NEVER=Ce.INVALID});var cst=S(VS=>{"use strict";var Fpo=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]}),t9=VS&&VS.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Fpo(e,t,r)};Object.defineProperty(VS,"__esModule",{value:!0});t9(QEe(),VS);t9(sst(),VS);t9(V_r(),VS);t9(bae(),VS);t9(ovr(),VS);t9(YEe(),VS)});var Q=S(I_=>{"use strict";var ivr=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]}),kpo=I_&&I_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qpo=I_&&I_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&ivr(e,t,r);return kpo(e,t),e},Upo=I_&&I_.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ivr(e,t,r)};Object.defineProperty(I_,"__esModule",{value:!0});I_.z=void 0;var avr=qpo(cst());I_.z=avr;Upo(cst(),I_);I_.default=avr});var pst=S(Sh=>{"use strict";var Bpo=Sh&&Sh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Sh&&Sh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vpo=Sh&&Sh.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 zpo(r,e),r}}();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.zodInbound=Sh.zodOutbound=void 0;Sh.bytesToBase64=svr;Sh.bytesFromBase64=dst;Sh.stringToBytes=fst;Sh.stringFromBytes=uvr;Sh.stringToBase64=Hpo;Sh.stringFromBase64=Jpo;var iPe=Vpo(Q());function svr(t){return btoa(String.fromCodePoint(...t))}function dst(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function fst(t){return new TextEncoder().encode(t)}function uvr(t){return new TextDecoder().decode(t)}function Hpo(t){return svr(fst(t))}function Jpo(t){return uvr(dst(t))}Sh.zodOutbound=iPe.instanceof(Uint8Array).or(iPe.string().transform(fst));Sh.zodInbound=iPe.instanceof(Uint8Array).or(iPe.string().transform(dst))});var hst=S(mst=>{"use strict";Object.defineProperty(mst,"__esModule",{value:!0});mst.isPlainObject=Wpo;function Wpo(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 wr=S(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});ta.encodeDeepObjectQuery=ta.encodePipeDelimitedQuery=ta.encodeSpaceDelimitedQuery=ta.encodeFormQuery=ta.encodeJSONQuery=ta.encodeSimple=ta.encodePipeDelimited=ta.encodeSpaceDelimited=ta.encodeForm=ta.EncodingError=void 0;ta.encodeMatrix=Kpo;ta.encodeLabel=Gpo;ta.encodeBodyForm=Xpo;ta.encodeDeepObject=cvr;ta.encodeDeepObjectObject=yst;ta.encodeJSON=dvr;ta.queryJoin=fvr;ta.queryEncoder=n9;ta.appendForm=Ypo;var lvr=pst(),JC=hst(),Sae=class extends Error{constructor(e){super(e),this.name="EncodingError"}};ta.EncodingError=Sae;function Kpo(t,e,r){let n="",o=r?.explode?Cae(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(r9(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=xae(u,f=>`${a(f)}`)?.join(","):(0,JC.isPlainObject)(u)?c=sPe(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 Gpo(t,e,r){let n="",o=r?.explode?Cae(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(r9(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=xae(u,c=>`${a(c)}`)?.join("."):(0,JC.isPlainObject)(u)?l=sPe(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,JC.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function gst(t){return(e,r,n)=>{let o="",i=n?.explode?Cae(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(r9(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=xae(c,p=>`${s(p)}`)?.join(u):(0,JC.isPlainObject)(c)?f=sPe(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)}}ta.encodeForm=gst(",");ta.encodeSpaceDelimited=gst(" ");ta.encodePipeDelimited=gst("|");function Xpo(t,e,r){let n="",o=r?.explode?Cae(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(r9(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,JC.isPlainObject)(u)?c=JSON.stringify(u,aPe):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function cvr(t,e,r){if(e!=null){if(!(0,JC.isPlainObject)(e))throw new Sae(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return yst(t,e,r)}}function yst(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,JC.isPlainObject)(e))throw new Sae(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,JC.isPlainObject)(a)){let c=yst(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=xae(u,c=>`${o(s)}=${o(r9(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function dvr(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,aPe));return r?.explode?o:`${n(t)}=${o}`}var Zpo=(t,e,r)=>{let n="",o=r?.explode?Cae(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(r9(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=xae(u,c=>`${a(c)}`)?.join(","):(0,JC.isPlainObject)(u)?l=sPe(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,JC.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};ta.encodeSimple=Zpo;function Cae(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,JC.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function r9(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,lvr.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,aPe):`${t}`}function aPe(t,e){return e instanceof Uint8Array?(0,lvr.bytesToBase64)(e):e}function xae(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 sPe(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 fvr(...t){return t.filter(Boolean).join("&")}function n9(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 fvr(...i)}}ta.encodeJSONQuery=n9(dvr);ta.encodeFormQuery=n9(ta.encodeForm);ta.encodeSpaceDelimitedQuery=n9(ta.encodeSpaceDelimited);ta.encodePipeDelimitedQuery=n9(ta.encodePipeDelimited);ta.encodeDeepObjectQuery=n9(cvr);function Ypo(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 pvr=S(bst=>{"use strict";Object.defineProperty(bst,"__esModule",{value:!0});bst.dlv=Qpo;function Qpo(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 vst=S(rw=>{"use strict";var emo=rw&&rw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tmo=rw&&rw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rmo=rw&&rw.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&emo(r,e,n[o]);return tmo(r,e),r}}();Object.defineProperty(rw,"__esModule",{value:!0});rw.envSchema=void 0;rw.env=nmo;rw.resetEnv=omo;var mvr=pvr(),_st=rmo(Q());rw.envSchema=_st.object({MISTRAL_API_KEY:_st.string().optional(),MISTRAL_DEBUG:_st.coerce.boolean().optional()});var Oae;function nmo(){return Oae||(Oae=rw.envSchema.parse((0,mvr.dlv)(globalThis,"process.env")??(0,mvr.dlv)(globalThis,"Deno.env")??{}),Oae)}function omo(){Oae=void 0}});var gvr=S(tH=>{"use strict";Object.defineProperty(tH,"__esModule",{value:!0});tH.TemporaryError=tH.PermanentError=void 0;tH.retry=amo;var hvr=WG(),imo={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},Tae=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)}};tH.PermanentError=Tae;var eH=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};tH.TemporaryError=eH;async function amo(t,e){switch(e.config.strategy){case"backoff":return cmo(smo(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??imo);default:return await t()}}function smo(t,e){return async()=>{try{let r=await t();if(lmo(r,e.statusCodes))throw new eH("Response failed with retryable status code",r);return r}catch(r){throw r instanceof eH||e.retryConnectionErrors&&((0,hvr.isTimeoutError)(r)||(0,hvr.isConnectionError)(r))?r:new Tae("Permanent error",{cause:r})}}}var umo=new RegExp("^[0-9]xx$","i");function lmo(t,e){let r=`${t.status}`;return e.some(n=>{if(!umo.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 cmo(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 Tae)throw u.cause;if(Date.now()-a>r){if(u instanceof eH)return u.response;throw u}let c=0;u instanceof eH&&(c=dmo(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await fmo(d),s++}}function dmo(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 fmo(t){return new Promise(e=>setTimeout(e,t))}});var Rc=S(Uk=>{"use strict";var Eae=Uk&&Uk.__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},HS=Uk&&Uk.__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)},lPe,RR,X1;Object.defineProperty(Uk,"__esModule",{value:!0});Uk.ClientSDK=void 0;var yvr=L_r(),o9=rst(),qk=vd(),pmo=pst(),bvr=WEe(),mmo=wr(),hmo=vst(),AR=WG(),gmo=gvr(),uPe=typeof globalThis>"u"?null:globalThis,ymo=typeof uPe=="object"&&uPe!=null&&"importScripts"in uPe&&typeof uPe.importScripts=="function",bmo=ymo||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",wst=class{constructor(e={}){lPe.set(this,void 0),RR.set(this,void 0),X1.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof yvr.SDKHooks?Eae(this,RR,r.hooks,"f"):Eae(this,RR,new yvr.SDKHooks,"f");let n=(0,bvr.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=HS(this,RR,"f").sdkInit({baseURL:n,client:e.httpClient||new AR.HTTPClient});this._baseURL=o,Eae(this,lPe,i,"f"),this._options={...e,hooks:HS(this,RR,"f")},Eae(this,X1,this._options.debugLogger,"f"),!HS(this,X1,"f")&&(0,hmo.env)().MISTRAL_DEBUG&&Eae(this,X1,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,qk.ERR)(new o9.InvalidRequestError("No base URL provided for operation"));let c=new URL(l),d=new URL(i,c);i&&(c.pathname+=c.pathname.endsWith("/")?"":"/",c.pathname+=d.pathname.replace(/^\/+/,""));let f=a||"",p=[];for(let[T,P]of Object.entries(u?.queryParams||{})){let M=(0,mmo.encodeForm)(T,P,{charEncoding:"percent"});typeof M<"u"&&p.push(M)}if(p.length&&(f+=`&${p.join("&")}`),f){let T=f.startsWith("&")?f.slice(1):f;c.search=`?${T}`}let m=new Headers(s),h=u?.basic.username,y=u?.basic.password;if(h!=null||y!=null){let T=(0,pmo.stringToBase64)([h||"",y||""].join(":"));m.set("Authorization",`Basic ${T}`)}let g=new Headers(u?.headers||{});for(let[T,P]of g)m.set(T,P);let b=m.get("cookie")||"";for(let[T,P]of Object.entries(u?.cookies||{}))b+=`; ${T}=${P}`;b=b.startsWith("; ")?b.slice(2):b,m.set("cookie",b);let _=new Headers(n?.headers??n?.fetchOptions?.headers);for(let[T,P]of _)m.set(T,P);bmo||m.set(r.uaHeader??"user-agent",r.userAgent??bvr.SDK_METADATA.userAgent);let w={...n?.fetchOptions,...n};if(!w?.signal&&r.timeoutMs&&r.timeoutMs>0){let T=AbortSignal.timeout(r.timeoutMs);w.signal=T}r.body instanceof ReadableStream&&Object.assign(w,{duplex:"half"});let O;try{O=HS(this,RR,"f").beforeCreateRequest(e,{url:c,options:{...w,body:r.body??null,headers:m,method:o}})}catch(T){return(0,qk.ERR)(new o9.UnexpectedClientError("Create request hook failed to execute",{cause:T}))}return(0,qk.OK)(new Request(O.url,O.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,gmo.retry)(async()=>{let i=await HS(this,RR,"f").beforeRequest(n,e.clone());await _mo(HS(this,X1,"f"),i).catch(s=>HS(this,X1,"f")?.log("Failed to log request:",s));let a=await HS(this,lPe,"f").request(i);try{if((0,AR.matchStatusCode)(a,o)){let s=await HS(this,RR,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await HS(this,RR,"f").afterSuccess(n,a)}finally{await vmo(HS(this,X1,"f"),a,i).catch(s=>HS(this,X1,"f")?.log("Failed to log response:",s))}return a},{config:r.retryConfig,statusCodes:r.retryCodes}).then(i=>(0,qk.OK)(i),i=>{switch(!0){case(0,AR.isAbortError)(i):return(0,qk.ERR)(new o9.RequestAbortedError("Request aborted by client",{cause:i}));case(0,AR.isTimeoutError)(i):return(0,qk.ERR)(new o9.RequestTimeoutError("Request timed out",{cause:i}));case(0,AR.isConnectionError)(i):return(0,qk.ERR)(new o9.ConnectionError("Unable to make request",{cause:i}));default:return(0,qk.ERR)(new o9.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};Uk.ClientSDK=wst;lPe=new WeakMap,RR=new WeakMap,X1=new WeakMap;var vvr=/(application|text)\/.*?\+*json.*/,_vr=/(application|text)\/(.*?\+*\bjsonl\b.*|.*?\+*\bx-ndjson\b.*)/;async function _mo(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 vvr.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 vmo(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,AR.matchContentType)(e,"application/json")||vvr.test(o)&&!_vr.test(o)):t.log(await e.clone().json());break;case((0,AR.matchContentType)(e,"application/jsonl")||_vr.test(o)):t.log(await e.clone().text());break;case(0,AR.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,AR.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,AR.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 dPe=S(cPe=>{"use strict";Object.defineProperty(cPe,"__esModule",{value:!0});cPe.MistralError=void 0;var Sst=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"}};cPe.MistralError=Sst});var fPe=S(WC=>{"use strict";var wmo=WC&&WC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Smo=WC&&WC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cmo=WC&&WC.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wmo(r,e,n[o]);return Smo(r,e),r}}();Object.defineProperty(WC,"__esModule",{value:!0});WC.SDKValidationError=void 0;WC.formatZodError=xst;var xmo=Cmo(Q()),Cst=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 xmo.ZodError?`${this.rawMessage}
|
||
${xst(this.cause)}`:this.toString()}};WC.SDKValidationError=Cst;function xst(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(`${xst(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var Tst=S(NR=>{"use strict";var Omo=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]}),Tmo=NR&&NR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Emo=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"&&Omo(r,e,n[o]);return Tmo(r,e),r}}();Object.defineProperty(NR,"__esModule",{value:!0});NR.ResponseValidationError=void 0;var Pmo=Emo(Q()),Mmo=dPe(),Imo=fPe(),Ost=class extends Mmo.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 Pmo.ZodError?`${this.rawMessage}
|
||
${(0,Imo.formatZodError)(this.cause)}`:this.toString()}};NR.ResponseValidationError=Ost});var Pst=S(pPe=>{"use strict";Object.defineProperty(pPe,"__esModule",{value:!0});pPe.SDKError=void 0;var Rmo=dPe(),Est=class extends Rmo.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"}};pPe.SDKError=Est});var pr=S(Dm=>{"use strict";Object.defineProperty(Dm,"__esModule",{value:!0});Dm.jsonErr=jmo;Dm.json=Dmo;Dm.jsonl=$mo;Dm.jsonlErr=Lmo;Dm.textErr=Fmo;Dm.text=kmo;Dm.bytesErr=qmo;Dm.bytes=Umo;Dm.streamErr=Bmo;Dm.stream=zmo;Dm.sseErr=Vmo;Dm.sse=Hmo;Dm.nilErr=Jmo;Dm.nil=Wmo;Dm.fail=Kmo;Dm.match=Gmo;Dm.unpackHeaders=mPe;var Amo=Tst(),wvr=Pst(),Svr=vd(),Cvr=WG(),xvr=hst(),Nmo={jsonl:"application/jsonl",json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function jmo(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function Dmo(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function $mo(t,e,r){return{...r,enc:"jsonl",codes:t,schema:e}}function Lmo(t,e,r){return{...r,err:!0,enc:"jsonl",codes:t,schema:e}}function Fmo(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function kmo(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function qmo(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function Umo(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function Bmo(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function zmo(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function Vmo(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function Hmo(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function Jmo(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function Wmo(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function Kmo(t){return{enc:"fail",codes:t}}function Gmo(...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:Nmo[d.enc];if(p&&(0,Cvr.matchResponse)(r,f,p)){a=d;break}else if(!p&&(0,Cvr.matchStatusCode)(r,f)){a=d;break}}if(!a)return[{ok:!1,error:new wvr.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 wvr.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:mPe(r.headers)}:null,...(0,xvr.isPlainObject)(i)?i:null,request$:n,response$:r,body$:u}:l?c={...o?.extraFields,...a.hdrs?{Headers:mPe(r.headers)}:null,[l]:i}:a.hdrs?c={...o?.extraFields,...a.hdrs?{Headers:mPe(r.headers)}:null,...(0,xvr.isPlainObject)(i)?i:null}:c=i,"err"in a){let d=Ovr(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[Ovr(c,d=>a.schema.parse(d),"Response validation failed",{request:n,response:r,body:u}),i]}}var Xmo=/, */;function mPe(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(Xmo);return e}function Ovr(t,e,r,n){try{return(0,Svr.OK)(e(t))}catch(o){return(0,Svr.ERR)(new Amo.ResponseValidationError(r,{cause:o,rawValue:t,rawMessage:r,...n}))}}});var le=S(Bk=>{"use strict";Object.defineProperty(Bk,"__esModule",{value:!0});Bk.invariant=Zmo;Bk.remap=Ymo;Bk.combineSignals=Qmo;Bk.abortSignalAny=Tvr;Bk.compactMap=eho;Bk.allRequired=tho;var Mst=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function Zmo(t,e){if(!t)throw new Mst(e)}function Ymo(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 Qmo(...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):Tvr(e)}}function Tvr(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 eho(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}function tho(t){if(!Object.values(t).every(e=>e==null))return t}});var Z=S(Pae=>{"use strict";Object.defineProperty(Pae,"__esModule",{value:!0});Pae.parse=nho;Pae.safeParse=oho;Pae.collectExtraKeys=iho;var rho=Q(),Pvr=fPe(),Evr=vd();function nho(t,e,r){try{return e(t)}catch(n){throw n instanceof rho.ZodError?new Pvr.SDKValidationError(r,n,t):n}}function oho(t,e,r){try{return(0,Evr.OK)(e(t))}catch(n){return(0,Evr.ERR)(new Pvr.SDKValidationError(r,n,t))}}function iho(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 mr=S(Z1=>{"use strict";Object.defineProperty(Z1,"__esModule",{value:!0});Z1.SecurityError=Z1.SecurityErrorCode=void 0;Z1.resolveSecurity=Mvr;Z1.resolveGlobalSecurity=uho;Z1.extractSecurity=lho;var aho=vst(),gPe;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(gPe||(Z1.SecurityErrorCode=gPe={}));var yPe=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(gPe.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(gPe.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};Z1.SecurityError=yPe;function Mvr(...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":sho(e,n);break;case"http:custom":break;case"http:bearer":hPe(e,n);break;case"oauth2":hPe(e,n);break;case"oauth2:password":hPe(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":hPe(e,n);break;default:throw yPe.unrecognizedType(o)}}),e)}function sho(t,e){e.value!=null&&(t.basic=e.value)}function hPe(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 uho(t){return Mvr([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,aho.env)().MISTRAL_API_KEY}])}async function lho(t){if(t!=null)return typeof t=="function"?t():t}});var zk=S(ra=>{"use strict";var cho=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]}),dho=ra&&ra.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fho=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"&&cho(r,e,n[o]);return dho(r,e),r}}();Object.defineProperty(ra,"__esModule",{value:!0});ra.CodeInterpreterTool$=ra.CodeInterpreterTool$outboundSchema=ra.CodeInterpreterTool$inboundSchema=ra.CodeInterpreterToolType$=ra.CodeInterpreterToolType$outboundSchema=ra.CodeInterpreterToolType$inboundSchema=ra.CodeInterpreterToolType=void 0;ra.codeInterpreterToolToJSON=mho;ra.codeInterpreterToolFromJSON=hho;var Ist=fho(Q()),pho=Z();ra.CodeInterpreterToolType={CodeInterpreter:"code_interpreter"};ra.CodeInterpreterToolType$inboundSchema=Ist.nativeEnum(ra.CodeInterpreterToolType);ra.CodeInterpreterToolType$outboundSchema=ra.CodeInterpreterToolType$inboundSchema;var Ivr;(function(t){t.inboundSchema=ra.CodeInterpreterToolType$inboundSchema,t.outboundSchema=ra.CodeInterpreterToolType$outboundSchema})(Ivr||(ra.CodeInterpreterToolType$=Ivr={}));ra.CodeInterpreterTool$inboundSchema=Ist.object({type:ra.CodeInterpreterToolType$inboundSchema.default("code_interpreter")});ra.CodeInterpreterTool$outboundSchema=Ist.object({type:ra.CodeInterpreterToolType$outboundSchema.default("code_interpreter")});var Rvr;(function(t){t.inboundSchema=ra.CodeInterpreterTool$inboundSchema,t.outboundSchema=ra.CodeInterpreterTool$outboundSchema})(Rvr||(ra.CodeInterpreterTool$=Rvr={}));function mho(t){return JSON.stringify(ra.CodeInterpreterTool$outboundSchema.parse(t))}function hho(t){return(0,pho.safeParse)(t,e=>ra.CodeInterpreterTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CodeInterpreterTool' from JSON")}});var Rst=S(wd=>{"use strict";var gho=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]}),yho=wd&&wd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bho=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"&&gho(r,e,n[o]);return yho(r,e),r}}();Object.defineProperty(wd,"__esModule",{value:!0});wd.CompletionArgsStop$=wd.CompletionArgsStop$outboundSchema=wd.CompletionArgsStop$inboundSchema=void 0;wd.completionArgsStopToJSON=vho;wd.completionArgsStopFromJSON=who;var Vk=bho(Q()),_ho=Z();wd.CompletionArgsStop$inboundSchema=Vk.union([Vk.string(),Vk.array(Vk.string())]);wd.CompletionArgsStop$outboundSchema=Vk.union([Vk.string(),Vk.array(Vk.string())]);var Avr;(function(t){t.inboundSchema=wd.CompletionArgsStop$inboundSchema,t.outboundSchema=wd.CompletionArgsStop$outboundSchema})(Avr||(wd.CompletionArgsStop$=Avr={}));function vho(t){return JSON.stringify(wd.CompletionArgsStop$outboundSchema.parse(t))}function who(t){return(0,_ho.safeParse)(t,e=>wd.CompletionArgsStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionArgsStop' from JSON")}});var rH=S(Sd=>{"use strict";var Sho=Sd&&Sd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cho=Sd&&Sd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xho=Sd&&Sd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Sho(r,e,n[o]);return Cho(r,e),r}}();Object.defineProperty(Sd,"__esModule",{value:!0});Sd.Prediction$=Sd.Prediction$outboundSchema=Sd.Prediction$inboundSchema=void 0;Sd.predictionToJSON=Tho;Sd.predictionFromJSON=Eho;var i9=xho(Q()),Oho=Z();Sd.Prediction$inboundSchema=i9.object({type:i9.literal("content").default("content"),content:i9.string().default("")});Sd.Prediction$outboundSchema=i9.object({type:i9.literal("content").default("content"),content:i9.string().default("")});var Nvr;(function(t){t.inboundSchema=Sd.Prediction$inboundSchema,t.outboundSchema=Sd.Prediction$outboundSchema})(Nvr||(Sd.Prediction$=Nvr={}));function Tho(t){return JSON.stringify(Sd.Prediction$outboundSchema.parse(t))}function Eho(t){return(0,Oho.safeParse)(t,e=>Sd.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var Ast=S(Cd=>{"use strict";var Pho=Cd&&Cd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Cd&&Cd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Iho=Cd&&Cd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(Cd,"__esModule",{value:!0});Cd.JsonSchema$=Cd.JsonSchema$outboundSchema=Cd.JsonSchema$inboundSchema=void 0;Cd.jsonSchemaToJSON=Aho;Cd.jsonSchemaFromJSON=Nho;var R_=Iho(Q()),Dvr=le(),Rho=Z();Cd.JsonSchema$inboundSchema=R_.object({name:R_.string(),description:R_.nullable(R_.string()).optional(),schema:R_.record(R_.any()),strict:R_.boolean().optional()}).transform(t=>(0,Dvr.remap)(t,{schema:"schemaDefinition"}));Cd.JsonSchema$outboundSchema=R_.object({name:R_.string(),description:R_.nullable(R_.string()).optional(),schemaDefinition:R_.record(R_.any()),strict:R_.boolean().optional()}).transform(t=>(0,Dvr.remap)(t,{schemaDefinition:"schema"}));var jvr;(function(t){t.inboundSchema=Cd.JsonSchema$inboundSchema,t.outboundSchema=Cd.JsonSchema$outboundSchema})(jvr||(Cd.JsonSchema$=jvr={}));function Aho(t){return JSON.stringify(Cd.JsonSchema$outboundSchema.parse(t))}function Nho(t){return(0,Rho.safeParse)(t,e=>Cd.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var Nst=S(xd=>{"use strict";var jho=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]}),Dho=xd&&xd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$ho=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"&&jho(r,e,n[o]);return Dho(r,e),r}}();Object.defineProperty(xd,"__esModule",{value:!0});xd.ResponseFormats$=xd.ResponseFormats$outboundSchema=xd.ResponseFormats$inboundSchema=xd.ResponseFormats=void 0;var Lho=$ho(Q());xd.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};xd.ResponseFormats$inboundSchema=Lho.nativeEnum(xd.ResponseFormats);xd.ResponseFormats$outboundSchema=xd.ResponseFormats$inboundSchema;var $vr;(function(t){t.inboundSchema=xd.ResponseFormats$inboundSchema,t.outboundSchema=xd.ResponseFormats$outboundSchema})($vr||(xd.ResponseFormats$=$vr={}))});var Hk=S(Od=>{"use strict";var Fho=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]}),kho=Od&&Od.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qho=Od&&Od.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Fho(r,e,n[o]);return kho(r,e),r}}();Object.defineProperty(Od,"__esModule",{value:!0});Od.ResponseFormat$=Od.ResponseFormat$outboundSchema=Od.ResponseFormat$inboundSchema=void 0;Od.responseFormatToJSON=Bho;Od.responseFormatFromJSON=zho;var bPe=qho(Q()),Fvr=le(),Uho=Z(),kvr=Ast(),qvr=Nst();Od.ResponseFormat$inboundSchema=bPe.object({type:qvr.ResponseFormats$inboundSchema.optional(),json_schema:bPe.nullable(kvr.JsonSchema$inboundSchema).optional()}).transform(t=>(0,Fvr.remap)(t,{json_schema:"jsonSchema"}));Od.ResponseFormat$outboundSchema=bPe.object({type:qvr.ResponseFormats$outboundSchema.optional(),jsonSchema:bPe.nullable(kvr.JsonSchema$outboundSchema).optional()}).transform(t=>(0,Fvr.remap)(t,{jsonSchema:"json_schema"}));var Lvr;(function(t){t.inboundSchema=Od.ResponseFormat$inboundSchema,t.outboundSchema=Od.ResponseFormat$outboundSchema})(Lvr||(Od.ResponseFormat$=Lvr={}));function Bho(t){return JSON.stringify(Od.ResponseFormat$outboundSchema.parse(t))}function zho(t){return(0,Uho.safeParse)(t,e=>Od.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var nH=S(Td=>{"use strict";var Vho=Td&&Td.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Hho=Td&&Td.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jho=Td&&Td.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Vho(r,e,n[o]);return Hho(r,e),r}}();Object.defineProperty(Td,"__esModule",{value:!0});Td.ToolChoiceEnum$=Td.ToolChoiceEnum$outboundSchema=Td.ToolChoiceEnum$inboundSchema=Td.ToolChoiceEnum=void 0;var Who=Jho(Q());Td.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};Td.ToolChoiceEnum$inboundSchema=Who.nativeEnum(Td.ToolChoiceEnum);Td.ToolChoiceEnum$outboundSchema=Td.ToolChoiceEnum$inboundSchema;var Uvr;(function(t){t.inboundSchema=Td.ToolChoiceEnum$inboundSchema,t.outboundSchema=Td.ToolChoiceEnum$outboundSchema})(Uvr||(Td.ToolChoiceEnum$=Uvr={}))});var JS=S(Ed=>{"use strict";var Kho=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]}),Gho=Ed&&Ed.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xho=Ed&&Ed.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(Ed,"__esModule",{value:!0});Ed.CompletionArgs$=Ed.CompletionArgs$outboundSchema=Ed.CompletionArgs$inboundSchema=void 0;Ed.completionArgsToJSON=Yho;Ed.completionArgsFromJSON=Qho;var ls=Xho(Q()),zvr=le(),Zho=Z(),Vvr=Rst(),Hvr=rH(),Jvr=Hk(),Wvr=nH();Ed.CompletionArgs$inboundSchema=ls.object({stop:ls.nullable(Vvr.CompletionArgsStop$inboundSchema).optional(),presence_penalty:ls.nullable(ls.number()).optional(),frequency_penalty:ls.nullable(ls.number()).optional(),temperature:ls.nullable(ls.number()).optional(),top_p:ls.nullable(ls.number()).optional(),max_tokens:ls.nullable(ls.number().int()).optional(),random_seed:ls.nullable(ls.number().int()).optional(),prediction:ls.nullable(Hvr.Prediction$inboundSchema).optional(),response_format:ls.nullable(Jvr.ResponseFormat$inboundSchema).optional(),tool_choice:Wvr.ToolChoiceEnum$inboundSchema.optional()}).transform(t=>(0,zvr.remap)(t,{presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice"}));Ed.CompletionArgs$outboundSchema=ls.object({stop:ls.nullable(Vvr.CompletionArgsStop$outboundSchema).optional(),presencePenalty:ls.nullable(ls.number()).optional(),frequencyPenalty:ls.nullable(ls.number()).optional(),temperature:ls.nullable(ls.number()).optional(),topP:ls.nullable(ls.number()).optional(),maxTokens:ls.nullable(ls.number().int()).optional(),randomSeed:ls.nullable(ls.number().int()).optional(),prediction:ls.nullable(Hvr.Prediction$outboundSchema).optional(),responseFormat:ls.nullable(Jvr.ResponseFormat$outboundSchema).optional(),toolChoice:Wvr.ToolChoiceEnum$outboundSchema.optional()}).transform(t=>(0,zvr.remap)(t,{presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice"}));var Bvr;(function(t){t.inboundSchema=Ed.CompletionArgs$inboundSchema,t.outboundSchema=Ed.CompletionArgs$outboundSchema})(Bvr||(Ed.CompletionArgs$=Bvr={}));function Yho(t){return JSON.stringify(Ed.CompletionArgs$outboundSchema.parse(t))}function Qho(t){return(0,Zho.safeParse)(t,e=>Ed.CompletionArgs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionArgs' from JSON")}});var Jk=S(na=>{"use strict";var ego=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]}),tgo=na&&na.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rgo=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"&&ego(r,e,n[o]);return tgo(r,e),r}}();Object.defineProperty(na,"__esModule",{value:!0});na.DocumentLibraryTool$=na.DocumentLibraryTool$outboundSchema=na.DocumentLibraryTool$inboundSchema=na.DocumentLibraryToolType$=na.DocumentLibraryToolType$outboundSchema=na.DocumentLibraryToolType$inboundSchema=na.DocumentLibraryToolType=void 0;na.documentLibraryToolToJSON=ogo;na.documentLibraryToolFromJSON=igo;var oH=rgo(Q()),Xvr=le(),ngo=Z();na.DocumentLibraryToolType={DocumentLibrary:"document_library"};na.DocumentLibraryToolType$inboundSchema=oH.nativeEnum(na.DocumentLibraryToolType);na.DocumentLibraryToolType$outboundSchema=na.DocumentLibraryToolType$inboundSchema;var Kvr;(function(t){t.inboundSchema=na.DocumentLibraryToolType$inboundSchema,t.outboundSchema=na.DocumentLibraryToolType$outboundSchema})(Kvr||(na.DocumentLibraryToolType$=Kvr={}));na.DocumentLibraryTool$inboundSchema=oH.object({type:na.DocumentLibraryToolType$inboundSchema.default("document_library"),library_ids:oH.array(oH.string())}).transform(t=>(0,Xvr.remap)(t,{library_ids:"libraryIds"}));na.DocumentLibraryTool$outboundSchema=oH.object({type:na.DocumentLibraryToolType$outboundSchema.default("document_library"),libraryIds:oH.array(oH.string())}).transform(t=>(0,Xvr.remap)(t,{libraryIds:"library_ids"}));var Gvr;(function(t){t.inboundSchema=na.DocumentLibraryTool$inboundSchema,t.outboundSchema=na.DocumentLibraryTool$outboundSchema})(Gvr||(na.DocumentLibraryTool$=Gvr={}));function ogo(t){return JSON.stringify(na.DocumentLibraryTool$outboundSchema.parse(t))}function igo(t){return(0,ngo.safeParse)(t,e=>na.DocumentLibraryTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentLibraryTool' from JSON")}});var _Pe=S(Pd=>{"use strict";var ago=Pd&&Pd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sgo=Pd&&Pd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ugo=Pd&&Pd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ago(r,e,n[o]);return sgo(r,e),r}}();Object.defineProperty(Pd,"__esModule",{value:!0});Pd.FunctionT$=Pd.FunctionT$outboundSchema=Pd.FunctionT$inboundSchema=void 0;Pd.functionToJSON=cgo;Pd.functionFromJSON=dgo;var WS=ugo(Q()),lgo=Z();Pd.FunctionT$inboundSchema=WS.object({name:WS.string(),description:WS.string().optional(),strict:WS.boolean().optional(),parameters:WS.record(WS.any())});Pd.FunctionT$outboundSchema=WS.object({name:WS.string(),description:WS.string().optional(),strict:WS.boolean().optional(),parameters:WS.record(WS.any())});var Zvr;(function(t){t.inboundSchema=Pd.FunctionT$inboundSchema,t.outboundSchema=Pd.FunctionT$outboundSchema})(Zvr||(Pd.FunctionT$=Zvr={}));function cgo(t){return JSON.stringify(Pd.FunctionT$outboundSchema.parse(t))}function dgo(t){return(0,lgo.safeParse)(t,e=>Pd.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var Wk=S(oa=>{"use strict";var fgo=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]}),pgo=oa&&oa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mgo=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"&&fgo(r,e,n[o]);return pgo(r,e),r}}();Object.defineProperty(oa,"__esModule",{value:!0});oa.FunctionTool$=oa.FunctionTool$outboundSchema=oa.FunctionTool$inboundSchema=oa.FunctionToolType$=oa.FunctionToolType$outboundSchema=oa.FunctionToolType$inboundSchema=oa.FunctionToolType=void 0;oa.functionToolToJSON=ggo;oa.functionToolFromJSON=ygo;var jst=mgo(Q()),hgo=Z(),ewr=_Pe();oa.FunctionToolType={Function:"function"};oa.FunctionToolType$inboundSchema=jst.nativeEnum(oa.FunctionToolType);oa.FunctionToolType$outboundSchema=oa.FunctionToolType$inboundSchema;var Yvr;(function(t){t.inboundSchema=oa.FunctionToolType$inboundSchema,t.outboundSchema=oa.FunctionToolType$outboundSchema})(Yvr||(oa.FunctionToolType$=Yvr={}));oa.FunctionTool$inboundSchema=jst.object({type:oa.FunctionToolType$inboundSchema.default("function"),function:ewr.FunctionT$inboundSchema});oa.FunctionTool$outboundSchema=jst.object({type:oa.FunctionToolType$outboundSchema.default("function"),function:ewr.FunctionT$outboundSchema});var Qvr;(function(t){t.inboundSchema=oa.FunctionTool$inboundSchema,t.outboundSchema=oa.FunctionTool$outboundSchema})(Qvr||(oa.FunctionTool$=Qvr={}));function ggo(t){return JSON.stringify(oa.FunctionTool$outboundSchema.parse(t))}function ygo(t){return(0,hgo.safeParse)(t,e=>oa.FunctionTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionTool' from JSON")}});var Kk=S(ia=>{"use strict";var bgo=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]}),_go=ia&&ia.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vgo=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"&&bgo(r,e,n[o]);return _go(r,e),r}}();Object.defineProperty(ia,"__esModule",{value:!0});ia.ImageGenerationTool$=ia.ImageGenerationTool$outboundSchema=ia.ImageGenerationTool$inboundSchema=ia.ImageGenerationToolType$=ia.ImageGenerationToolType$outboundSchema=ia.ImageGenerationToolType$inboundSchema=ia.ImageGenerationToolType=void 0;ia.imageGenerationToolToJSON=Sgo;ia.imageGenerationToolFromJSON=Cgo;var Dst=vgo(Q()),wgo=Z();ia.ImageGenerationToolType={ImageGeneration:"image_generation"};ia.ImageGenerationToolType$inboundSchema=Dst.nativeEnum(ia.ImageGenerationToolType);ia.ImageGenerationToolType$outboundSchema=ia.ImageGenerationToolType$inboundSchema;var twr;(function(t){t.inboundSchema=ia.ImageGenerationToolType$inboundSchema,t.outboundSchema=ia.ImageGenerationToolType$outboundSchema})(twr||(ia.ImageGenerationToolType$=twr={}));ia.ImageGenerationTool$inboundSchema=Dst.object({type:ia.ImageGenerationToolType$inboundSchema.default("image_generation")});ia.ImageGenerationTool$outboundSchema=Dst.object({type:ia.ImageGenerationToolType$outboundSchema.default("image_generation")});var rwr;(function(t){t.inboundSchema=ia.ImageGenerationTool$inboundSchema,t.outboundSchema=ia.ImageGenerationTool$outboundSchema})(rwr||(ia.ImageGenerationTool$=rwr={}));function Sgo(t){return JSON.stringify(ia.ImageGenerationTool$outboundSchema.parse(t))}function Cgo(t){return(0,wgo.safeParse)(t,e=>ia.ImageGenerationTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageGenerationTool' from JSON")}});var Gk=S(aa=>{"use strict";var xgo=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]}),Ogo=aa&&aa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tgo=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"&&xgo(r,e,n[o]);return Ogo(r,e),r}}();Object.defineProperty(aa,"__esModule",{value:!0});aa.WebSearchPremiumTool$=aa.WebSearchPremiumTool$outboundSchema=aa.WebSearchPremiumTool$inboundSchema=aa.WebSearchPremiumToolType$=aa.WebSearchPremiumToolType$outboundSchema=aa.WebSearchPremiumToolType$inboundSchema=aa.WebSearchPremiumToolType=void 0;aa.webSearchPremiumToolToJSON=Pgo;aa.webSearchPremiumToolFromJSON=Mgo;var $st=Tgo(Q()),Ego=Z();aa.WebSearchPremiumToolType={WebSearchPremium:"web_search_premium"};aa.WebSearchPremiumToolType$inboundSchema=$st.nativeEnum(aa.WebSearchPremiumToolType);aa.WebSearchPremiumToolType$outboundSchema=aa.WebSearchPremiumToolType$inboundSchema;var nwr;(function(t){t.inboundSchema=aa.WebSearchPremiumToolType$inboundSchema,t.outboundSchema=aa.WebSearchPremiumToolType$outboundSchema})(nwr||(aa.WebSearchPremiumToolType$=nwr={}));aa.WebSearchPremiumTool$inboundSchema=$st.object({type:aa.WebSearchPremiumToolType$inboundSchema.default("web_search_premium")});aa.WebSearchPremiumTool$outboundSchema=$st.object({type:aa.WebSearchPremiumToolType$outboundSchema.default("web_search_premium")});var owr;(function(t){t.inboundSchema=aa.WebSearchPremiumTool$inboundSchema,t.outboundSchema=aa.WebSearchPremiumTool$outboundSchema})(owr||(aa.WebSearchPremiumTool$=owr={}));function Pgo(t){return JSON.stringify(aa.WebSearchPremiumTool$outboundSchema.parse(t))}function Mgo(t){return(0,Ego.safeParse)(t,e=>aa.WebSearchPremiumTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WebSearchPremiumTool' from JSON")}});var Xk=S(sa=>{"use strict";var Igo=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]}),Rgo=sa&&sa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ago=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"&&Igo(r,e,n[o]);return Rgo(r,e),r}}();Object.defineProperty(sa,"__esModule",{value:!0});sa.WebSearchTool$=sa.WebSearchTool$outboundSchema=sa.WebSearchTool$inboundSchema=sa.WebSearchToolType$=sa.WebSearchToolType$outboundSchema=sa.WebSearchToolType$inboundSchema=sa.WebSearchToolType=void 0;sa.webSearchToolToJSON=jgo;sa.webSearchToolFromJSON=Dgo;var Lst=Ago(Q()),Ngo=Z();sa.WebSearchToolType={WebSearch:"web_search"};sa.WebSearchToolType$inboundSchema=Lst.nativeEnum(sa.WebSearchToolType);sa.WebSearchToolType$outboundSchema=sa.WebSearchToolType$inboundSchema;var iwr;(function(t){t.inboundSchema=sa.WebSearchToolType$inboundSchema,t.outboundSchema=sa.WebSearchToolType$outboundSchema})(iwr||(sa.WebSearchToolType$=iwr={}));sa.WebSearchTool$inboundSchema=Lst.object({type:sa.WebSearchToolType$inboundSchema.default("web_search")});sa.WebSearchTool$outboundSchema=Lst.object({type:sa.WebSearchToolType$outboundSchema.default("web_search")});var awr;(function(t){t.inboundSchema=sa.WebSearchTool$inboundSchema,t.outboundSchema=sa.WebSearchTool$outboundSchema})(awr||(sa.WebSearchTool$=awr={}));function jgo(t){return JSON.stringify(sa.WebSearchTool$outboundSchema.parse(t))}function Dgo(t){return(0,Ngo.safeParse)(t,e=>sa.WebSearchTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WebSearchTool' from JSON")}});var pwr=S(ao=>{"use strict";var $go=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]}),Lgo=ao&&ao.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fgo=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"&&$go(r,e,n[o]);return Lgo(r,e),r}}();Object.defineProperty(ao,"__esModule",{value:!0});ao.Agent$=ao.Agent$outboundSchema=ao.Agent$inboundSchema=ao.AgentObject$=ao.AgentObject$outboundSchema=ao.AgentObject$inboundSchema=ao.AgentTools$=ao.AgentTools$outboundSchema=ao.AgentTools$inboundSchema=ao.AgentObject=void 0;ao.agentToolsToJSON=kgo;ao.agentToolsFromJSON=qgo;ao.agentToJSON=Ugo;ao.agentFromJSON=Bgo;var It=Fgo(Q()),cwr=le(),dwr=Z(),vPe=zk(),fwr=JS(),wPe=Jk(),SPe=Wk(),CPe=Kk(),xPe=Gk(),OPe=Xk();ao.AgentObject={Agent:"agent"};ao.AgentTools$inboundSchema=It.union([wPe.DocumentLibraryTool$inboundSchema.and(It.object({type:It.literal("document_library")}).transform(t=>({type:t.type}))),SPe.FunctionTool$inboundSchema.and(It.object({type:It.literal("function")}).transform(t=>({type:t.type}))),vPe.CodeInterpreterTool$inboundSchema.and(It.object({type:It.literal("code_interpreter")}).transform(t=>({type:t.type}))),CPe.ImageGenerationTool$inboundSchema.and(It.object({type:It.literal("image_generation")}).transform(t=>({type:t.type}))),OPe.WebSearchTool$inboundSchema.and(It.object({type:It.literal("web_search")}).transform(t=>({type:t.type}))),xPe.WebSearchPremiumTool$inboundSchema.and(It.object({type:It.literal("web_search_premium")}).transform(t=>({type:t.type})))]);ao.AgentTools$outboundSchema=It.union([wPe.DocumentLibraryTool$outboundSchema.and(It.object({type:It.literal("document_library")}).transform(t=>({type:t.type}))),SPe.FunctionTool$outboundSchema.and(It.object({type:It.literal("function")}).transform(t=>({type:t.type}))),vPe.CodeInterpreterTool$outboundSchema.and(It.object({type:It.literal("code_interpreter")}).transform(t=>({type:t.type}))),CPe.ImageGenerationTool$outboundSchema.and(It.object({type:It.literal("image_generation")}).transform(t=>({type:t.type}))),OPe.WebSearchTool$outboundSchema.and(It.object({type:It.literal("web_search")}).transform(t=>({type:t.type}))),xPe.WebSearchPremiumTool$outboundSchema.and(It.object({type:It.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var swr;(function(t){t.inboundSchema=ao.AgentTools$inboundSchema,t.outboundSchema=ao.AgentTools$outboundSchema})(swr||(ao.AgentTools$=swr={}));function kgo(t){return JSON.stringify(ao.AgentTools$outboundSchema.parse(t))}function qgo(t){return(0,dwr.safeParse)(t,e=>ao.AgentTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentTools' from JSON")}ao.AgentObject$inboundSchema=It.nativeEnum(ao.AgentObject);ao.AgentObject$outboundSchema=ao.AgentObject$inboundSchema;var uwr;(function(t){t.inboundSchema=ao.AgentObject$inboundSchema,t.outboundSchema=ao.AgentObject$outboundSchema})(uwr||(ao.AgentObject$=uwr={}));ao.Agent$inboundSchema=It.object({instructions:It.nullable(It.string()).optional(),tools:It.array(It.union([wPe.DocumentLibraryTool$inboundSchema.and(It.object({type:It.literal("document_library")}).transform(t=>({type:t.type}))),SPe.FunctionTool$inboundSchema.and(It.object({type:It.literal("function")}).transform(t=>({type:t.type}))),vPe.CodeInterpreterTool$inboundSchema.and(It.object({type:It.literal("code_interpreter")}).transform(t=>({type:t.type}))),CPe.ImageGenerationTool$inboundSchema.and(It.object({type:It.literal("image_generation")}).transform(t=>({type:t.type}))),OPe.WebSearchTool$inboundSchema.and(It.object({type:It.literal("web_search")}).transform(t=>({type:t.type}))),xPe.WebSearchPremiumTool$inboundSchema.and(It.object({type:It.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:fwr.CompletionArgs$inboundSchema.optional(),model:It.string(),name:It.string(),description:It.nullable(It.string()).optional(),handoffs:It.nullable(It.array(It.string())).optional(),object:ao.AgentObject$inboundSchema.default("agent"),id:It.string(),version:It.number().int(),created_at:It.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:It.string().datetime({offset:!0}).transform(t=>new Date(t))}).transform(t=>(0,cwr.remap)(t,{completion_args:"completionArgs",created_at:"createdAt",updated_at:"updatedAt"}));ao.Agent$outboundSchema=It.object({instructions:It.nullable(It.string()).optional(),tools:It.array(It.union([wPe.DocumentLibraryTool$outboundSchema.and(It.object({type:It.literal("document_library")}).transform(t=>({type:t.type}))),SPe.FunctionTool$outboundSchema.and(It.object({type:It.literal("function")}).transform(t=>({type:t.type}))),vPe.CodeInterpreterTool$outboundSchema.and(It.object({type:It.literal("code_interpreter")}).transform(t=>({type:t.type}))),CPe.ImageGenerationTool$outboundSchema.and(It.object({type:It.literal("image_generation")}).transform(t=>({type:t.type}))),OPe.WebSearchTool$outboundSchema.and(It.object({type:It.literal("web_search")}).transform(t=>({type:t.type}))),xPe.WebSearchPremiumTool$outboundSchema.and(It.object({type:It.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:fwr.CompletionArgs$outboundSchema.optional(),model:It.string(),name:It.string(),description:It.nullable(It.string()).optional(),handoffs:It.nullable(It.array(It.string())).optional(),object:ao.AgentObject$outboundSchema.default("agent"),id:It.string(),version:It.number().int(),createdAt:It.date().transform(t=>t.toISOString()),updatedAt:It.date().transform(t=>t.toISOString())}).transform(t=>(0,cwr.remap)(t,{completionArgs:"completion_args",createdAt:"created_at",updatedAt:"updated_at"}));var lwr;(function(t){t.inboundSchema=ao.Agent$inboundSchema,t.outboundSchema=ao.Agent$outboundSchema})(lwr||(ao.Agent$=lwr={}));function Ugo(t){return JSON.stringify(ao.Agent$outboundSchema.parse(t))}function Bgo(t){return(0,dwr.safeParse)(t,e=>ao.Agent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Agent' from JSON")}});var ywr=S(ua=>{"use strict";var zgo=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]}),Vgo=ua&&ua.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hgo=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"&&zgo(r,e,n[o]);return Vgo(r,e),r}}();Object.defineProperty(ua,"__esModule",{value:!0});ua.AgentConversation$=ua.AgentConversation$outboundSchema=ua.AgentConversation$inboundSchema=ua.AgentConversationObject$=ua.AgentConversationObject$outboundSchema=ua.AgentConversationObject$inboundSchema=ua.AgentConversationObject=void 0;ua.agentConversationToJSON=Wgo;ua.agentConversationFromJSON=Kgo;var $m=Hgo(Q()),gwr=le(),Jgo=Z();ua.AgentConversationObject={Conversation:"conversation"};ua.AgentConversationObject$inboundSchema=$m.nativeEnum(ua.AgentConversationObject);ua.AgentConversationObject$outboundSchema=ua.AgentConversationObject$inboundSchema;var mwr;(function(t){t.inboundSchema=ua.AgentConversationObject$inboundSchema,t.outboundSchema=ua.AgentConversationObject$outboundSchema})(mwr||(ua.AgentConversationObject$=mwr={}));ua.AgentConversation$inboundSchema=$m.object({name:$m.nullable($m.string()).optional(),description:$m.nullable($m.string()).optional(),object:ua.AgentConversationObject$inboundSchema.default("conversation"),id:$m.string(),created_at:$m.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:$m.string().datetime({offset:!0}).transform(t=>new Date(t)),agent_id:$m.string()}).transform(t=>(0,gwr.remap)(t,{created_at:"createdAt",updated_at:"updatedAt",agent_id:"agentId"}));ua.AgentConversation$outboundSchema=$m.object({name:$m.nullable($m.string()).optional(),description:$m.nullable($m.string()).optional(),object:ua.AgentConversationObject$outboundSchema.default("conversation"),id:$m.string(),createdAt:$m.date().transform(t=>t.toISOString()),updatedAt:$m.date().transform(t=>t.toISOString()),agentId:$m.string()}).transform(t=>(0,gwr.remap)(t,{createdAt:"created_at",updatedAt:"updated_at",agentId:"agent_id"}));var hwr;(function(t){t.inboundSchema=ua.AgentConversation$inboundSchema,t.outboundSchema=ua.AgentConversation$outboundSchema})(hwr||(ua.AgentConversation$=hwr={}));function Wgo(t){return JSON.stringify(ua.AgentConversation$outboundSchema.parse(t))}function Kgo(t){return(0,Jgo.safeParse)(t,e=>ua.AgentConversation$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentConversation' from JSON")}});var Cwr=S(cs=>{"use strict";var Ggo=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]}),Xgo=cs&&cs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zgo=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"&&Ggo(r,e,n[o]);return Xgo(r,e),r}}();Object.defineProperty(cs,"__esModule",{value:!0});cs.AgentCreationRequest$=cs.AgentCreationRequest$outboundSchema=cs.AgentCreationRequest$inboundSchema=cs.AgentCreationRequestTools$=cs.AgentCreationRequestTools$outboundSchema=cs.AgentCreationRequestTools$inboundSchema=void 0;cs.agentCreationRequestToolsToJSON=Ygo;cs.agentCreationRequestToolsFromJSON=Qgo;cs.agentCreationRequestToJSON=eyo;cs.agentCreationRequestFromJSON=tyo;var Yt=Zgo(Q()),vwr=le(),wwr=Z(),TPe=zk(),Swr=JS(),EPe=Jk(),PPe=Wk(),MPe=Kk(),IPe=Gk(),RPe=Xk();cs.AgentCreationRequestTools$inboundSchema=Yt.union([EPe.DocumentLibraryTool$inboundSchema.and(Yt.object({type:Yt.literal("document_library")}).transform(t=>({type:t.type}))),PPe.FunctionTool$inboundSchema.and(Yt.object({type:Yt.literal("function")}).transform(t=>({type:t.type}))),TPe.CodeInterpreterTool$inboundSchema.and(Yt.object({type:Yt.literal("code_interpreter")}).transform(t=>({type:t.type}))),MPe.ImageGenerationTool$inboundSchema.and(Yt.object({type:Yt.literal("image_generation")}).transform(t=>({type:t.type}))),RPe.WebSearchTool$inboundSchema.and(Yt.object({type:Yt.literal("web_search")}).transform(t=>({type:t.type}))),IPe.WebSearchPremiumTool$inboundSchema.and(Yt.object({type:Yt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);cs.AgentCreationRequestTools$outboundSchema=Yt.union([EPe.DocumentLibraryTool$outboundSchema.and(Yt.object({type:Yt.literal("document_library")}).transform(t=>({type:t.type}))),PPe.FunctionTool$outboundSchema.and(Yt.object({type:Yt.literal("function")}).transform(t=>({type:t.type}))),TPe.CodeInterpreterTool$outboundSchema.and(Yt.object({type:Yt.literal("code_interpreter")}).transform(t=>({type:t.type}))),MPe.ImageGenerationTool$outboundSchema.and(Yt.object({type:Yt.literal("image_generation")}).transform(t=>({type:t.type}))),RPe.WebSearchTool$outboundSchema.and(Yt.object({type:Yt.literal("web_search")}).transform(t=>({type:t.type}))),IPe.WebSearchPremiumTool$outboundSchema.and(Yt.object({type:Yt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var bwr;(function(t){t.inboundSchema=cs.AgentCreationRequestTools$inboundSchema,t.outboundSchema=cs.AgentCreationRequestTools$outboundSchema})(bwr||(cs.AgentCreationRequestTools$=bwr={}));function Ygo(t){return JSON.stringify(cs.AgentCreationRequestTools$outboundSchema.parse(t))}function Qgo(t){return(0,wwr.safeParse)(t,e=>cs.AgentCreationRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentCreationRequestTools' from JSON")}cs.AgentCreationRequest$inboundSchema=Yt.object({instructions:Yt.nullable(Yt.string()).optional(),tools:Yt.array(Yt.union([EPe.DocumentLibraryTool$inboundSchema.and(Yt.object({type:Yt.literal("document_library")}).transform(t=>({type:t.type}))),PPe.FunctionTool$inboundSchema.and(Yt.object({type:Yt.literal("function")}).transform(t=>({type:t.type}))),TPe.CodeInterpreterTool$inboundSchema.and(Yt.object({type:Yt.literal("code_interpreter")}).transform(t=>({type:t.type}))),MPe.ImageGenerationTool$inboundSchema.and(Yt.object({type:Yt.literal("image_generation")}).transform(t=>({type:t.type}))),RPe.WebSearchTool$inboundSchema.and(Yt.object({type:Yt.literal("web_search")}).transform(t=>({type:t.type}))),IPe.WebSearchPremiumTool$inboundSchema.and(Yt.object({type:Yt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:Swr.CompletionArgs$inboundSchema.optional(),model:Yt.string(),name:Yt.string(),description:Yt.nullable(Yt.string()).optional(),handoffs:Yt.nullable(Yt.array(Yt.string())).optional()}).transform(t=>(0,vwr.remap)(t,{completion_args:"completionArgs"}));cs.AgentCreationRequest$outboundSchema=Yt.object({instructions:Yt.nullable(Yt.string()).optional(),tools:Yt.array(Yt.union([EPe.DocumentLibraryTool$outboundSchema.and(Yt.object({type:Yt.literal("document_library")}).transform(t=>({type:t.type}))),PPe.FunctionTool$outboundSchema.and(Yt.object({type:Yt.literal("function")}).transform(t=>({type:t.type}))),TPe.CodeInterpreterTool$outboundSchema.and(Yt.object({type:Yt.literal("code_interpreter")}).transform(t=>({type:t.type}))),MPe.ImageGenerationTool$outboundSchema.and(Yt.object({type:Yt.literal("image_generation")}).transform(t=>({type:t.type}))),RPe.WebSearchTool$outboundSchema.and(Yt.object({type:Yt.literal("web_search")}).transform(t=>({type:t.type}))),IPe.WebSearchPremiumTool$outboundSchema.and(Yt.object({type:Yt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:Swr.CompletionArgs$outboundSchema.optional(),model:Yt.string(),name:Yt.string(),description:Yt.nullable(Yt.string()).optional(),handoffs:Yt.nullable(Yt.array(Yt.string())).optional()}).transform(t=>(0,vwr.remap)(t,{completionArgs:"completion_args"}));var _wr;(function(t){t.inboundSchema=cs.AgentCreationRequest$inboundSchema,t.outboundSchema=cs.AgentCreationRequest$outboundSchema})(_wr||(cs.AgentCreationRequest$=_wr={}));function eyo(t){return JSON.stringify(cs.AgentCreationRequest$outboundSchema.parse(t))}function tyo(t){return(0,wwr.safeParse)(t,e=>cs.AgentCreationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentCreationRequest' from JSON")}});var Fst=S(la=>{"use strict";var ryo=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]}),nyo=la&&la.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oyo=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"&&ryo(r,e,n[o]);return nyo(r,e),r}}();Object.defineProperty(la,"__esModule",{value:!0});la.AgentHandoffDoneEvent$=la.AgentHandoffDoneEvent$outboundSchema=la.AgentHandoffDoneEvent$inboundSchema=la.AgentHandoffDoneEventType$=la.AgentHandoffDoneEventType$outboundSchema=la.AgentHandoffDoneEventType$inboundSchema=la.AgentHandoffDoneEventType=void 0;la.agentHandoffDoneEventToJSON=ayo;la.agentHandoffDoneEventFromJSON=syo;var nw=oyo(Q()),Twr=le(),iyo=Z();la.AgentHandoffDoneEventType={AgentHandoffDone:"agent.handoff.done"};la.AgentHandoffDoneEventType$inboundSchema=nw.nativeEnum(la.AgentHandoffDoneEventType);la.AgentHandoffDoneEventType$outboundSchema=la.AgentHandoffDoneEventType$inboundSchema;var xwr;(function(t){t.inboundSchema=la.AgentHandoffDoneEventType$inboundSchema,t.outboundSchema=la.AgentHandoffDoneEventType$outboundSchema})(xwr||(la.AgentHandoffDoneEventType$=xwr={}));la.AgentHandoffDoneEvent$inboundSchema=nw.object({type:la.AgentHandoffDoneEventType$inboundSchema.default("agent.handoff.done"),created_at:nw.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:nw.number().int().default(0),id:nw.string(),next_agent_id:nw.string(),next_agent_name:nw.string()}).transform(t=>(0,Twr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",next_agent_id:"nextAgentId",next_agent_name:"nextAgentName"}));la.AgentHandoffDoneEvent$outboundSchema=nw.object({type:la.AgentHandoffDoneEventType$outboundSchema.default("agent.handoff.done"),createdAt:nw.date().transform(t=>t.toISOString()).optional(),outputIndex:nw.number().int().default(0),id:nw.string(),nextAgentId:nw.string(),nextAgentName:nw.string()}).transform(t=>(0,Twr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",nextAgentId:"next_agent_id",nextAgentName:"next_agent_name"}));var Owr;(function(t){t.inboundSchema=la.AgentHandoffDoneEvent$inboundSchema,t.outboundSchema=la.AgentHandoffDoneEvent$outboundSchema})(Owr||(la.AgentHandoffDoneEvent$=Owr={}));function ayo(t){return JSON.stringify(la.AgentHandoffDoneEvent$outboundSchema.parse(t))}function syo(t){return(0,iyo.safeParse)(t,e=>la.AgentHandoffDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffDoneEvent' from JSON")}});var Mae=S(zn=>{"use strict";var uyo=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]}),lyo=zn&&zn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cyo=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"&&uyo(r,e,n[o]);return lyo(r,e),r}}();Object.defineProperty(zn,"__esModule",{value:!0});zn.AgentHandoffEntry$=zn.AgentHandoffEntry$outboundSchema=zn.AgentHandoffEntry$inboundSchema=zn.AgentHandoffEntryType$=zn.AgentHandoffEntryType$outboundSchema=zn.AgentHandoffEntryType$inboundSchema=zn.AgentHandoffEntryObject$=zn.AgentHandoffEntryObject$outboundSchema=zn.AgentHandoffEntryObject$inboundSchema=zn.AgentHandoffEntryType=zn.AgentHandoffEntryObject=void 0;zn.agentHandoffEntryToJSON=fyo;zn.agentHandoffEntryFromJSON=pyo;var Md=cyo(Q()),Iwr=le(),dyo=Z();zn.AgentHandoffEntryObject={Entry:"entry"};zn.AgentHandoffEntryType={AgentHandoff:"agent.handoff"};zn.AgentHandoffEntryObject$inboundSchema=Md.nativeEnum(zn.AgentHandoffEntryObject);zn.AgentHandoffEntryObject$outboundSchema=zn.AgentHandoffEntryObject$inboundSchema;var Ewr;(function(t){t.inboundSchema=zn.AgentHandoffEntryObject$inboundSchema,t.outboundSchema=zn.AgentHandoffEntryObject$outboundSchema})(Ewr||(zn.AgentHandoffEntryObject$=Ewr={}));zn.AgentHandoffEntryType$inboundSchema=Md.nativeEnum(zn.AgentHandoffEntryType);zn.AgentHandoffEntryType$outboundSchema=zn.AgentHandoffEntryType$inboundSchema;var Pwr;(function(t){t.inboundSchema=zn.AgentHandoffEntryType$inboundSchema,t.outboundSchema=zn.AgentHandoffEntryType$outboundSchema})(Pwr||(zn.AgentHandoffEntryType$=Pwr={}));zn.AgentHandoffEntry$inboundSchema=Md.object({object:zn.AgentHandoffEntryObject$inboundSchema.default("entry"),type:zn.AgentHandoffEntryType$inboundSchema.default("agent.handoff"),created_at:Md.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Md.nullable(Md.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Md.string().optional(),previous_agent_id:Md.string(),previous_agent_name:Md.string(),next_agent_id:Md.string(),next_agent_name:Md.string()}).transform(t=>(0,Iwr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",previous_agent_id:"previousAgentId",previous_agent_name:"previousAgentName",next_agent_id:"nextAgentId",next_agent_name:"nextAgentName"}));zn.AgentHandoffEntry$outboundSchema=Md.object({object:zn.AgentHandoffEntryObject$outboundSchema.default("entry"),type:zn.AgentHandoffEntryType$outboundSchema.default("agent.handoff"),createdAt:Md.date().transform(t=>t.toISOString()).optional(),completedAt:Md.nullable(Md.date().transform(t=>t.toISOString())).optional(),id:Md.string().optional(),previousAgentId:Md.string(),previousAgentName:Md.string(),nextAgentId:Md.string(),nextAgentName:Md.string()}).transform(t=>(0,Iwr.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 Mwr;(function(t){t.inboundSchema=zn.AgentHandoffEntry$inboundSchema,t.outboundSchema=zn.AgentHandoffEntry$outboundSchema})(Mwr||(zn.AgentHandoffEntry$=Mwr={}));function fyo(t){return JSON.stringify(zn.AgentHandoffEntry$outboundSchema.parse(t))}function pyo(t){return(0,dyo.safeParse)(t,e=>zn.AgentHandoffEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffEntry' from JSON")}});var kst=S(ca=>{"use strict";var myo=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]}),hyo=ca&&ca.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gyo=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"&&myo(r,e,n[o]);return hyo(r,e),r}}();Object.defineProperty(ca,"__esModule",{value:!0});ca.AgentHandoffStartedEvent$=ca.AgentHandoffStartedEvent$outboundSchema=ca.AgentHandoffStartedEvent$inboundSchema=ca.AgentHandoffStartedEventType$=ca.AgentHandoffStartedEventType$outboundSchema=ca.AgentHandoffStartedEventType$inboundSchema=ca.AgentHandoffStartedEventType=void 0;ca.agentHandoffStartedEventToJSON=byo;ca.agentHandoffStartedEventFromJSON=_yo;var ow=gyo(Q()),Nwr=le(),yyo=Z();ca.AgentHandoffStartedEventType={AgentHandoffStarted:"agent.handoff.started"};ca.AgentHandoffStartedEventType$inboundSchema=ow.nativeEnum(ca.AgentHandoffStartedEventType);ca.AgentHandoffStartedEventType$outboundSchema=ca.AgentHandoffStartedEventType$inboundSchema;var Rwr;(function(t){t.inboundSchema=ca.AgentHandoffStartedEventType$inboundSchema,t.outboundSchema=ca.AgentHandoffStartedEventType$outboundSchema})(Rwr||(ca.AgentHandoffStartedEventType$=Rwr={}));ca.AgentHandoffStartedEvent$inboundSchema=ow.object({type:ca.AgentHandoffStartedEventType$inboundSchema.default("agent.handoff.started"),created_at:ow.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:ow.number().int().default(0),id:ow.string(),previous_agent_id:ow.string(),previous_agent_name:ow.string()}).transform(t=>(0,Nwr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",previous_agent_id:"previousAgentId",previous_agent_name:"previousAgentName"}));ca.AgentHandoffStartedEvent$outboundSchema=ow.object({type:ca.AgentHandoffStartedEventType$outboundSchema.default("agent.handoff.started"),createdAt:ow.date().transform(t=>t.toISOString()).optional(),outputIndex:ow.number().int().default(0),id:ow.string(),previousAgentId:ow.string(),previousAgentName:ow.string()}).transform(t=>(0,Nwr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",previousAgentId:"previous_agent_id",previousAgentName:"previous_agent_name"}));var Awr;(function(t){t.inboundSchema=ca.AgentHandoffStartedEvent$inboundSchema,t.outboundSchema=ca.AgentHandoffStartedEvent$outboundSchema})(Awr||(ca.AgentHandoffStartedEvent$=Awr={}));function byo(t){return JSON.stringify(ca.AgentHandoffStartedEvent$outboundSchema.parse(t))}function _yo(t){return(0,yyo.safeParse)(t,e=>ca.AgentHandoffStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffStartedEvent' from JSON")}});var qst=S(da=>{"use strict";var vyo=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]}),wyo=da&&da.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Syo=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"&&vyo(r,e,n[o]);return wyo(r,e),r}}();Object.defineProperty(da,"__esModule",{value:!0});da.AudioChunk$=da.AudioChunk$outboundSchema=da.AudioChunk$inboundSchema=da.AudioChunkType$=da.AudioChunkType$outboundSchema=da.AudioChunkType$inboundSchema=da.AudioChunkType=void 0;da.audioChunkToJSON=xyo;da.audioChunkFromJSON=Oyo;var Iae=Syo(Q()),$wr=le(),Cyo=Z();da.AudioChunkType={InputAudio:"input_audio"};da.AudioChunkType$inboundSchema=Iae.nativeEnum(da.AudioChunkType);da.AudioChunkType$outboundSchema=da.AudioChunkType$inboundSchema;var jwr;(function(t){t.inboundSchema=da.AudioChunkType$inboundSchema,t.outboundSchema=da.AudioChunkType$outboundSchema})(jwr||(da.AudioChunkType$=jwr={}));da.AudioChunk$inboundSchema=Iae.object({input_audio:Iae.string(),type:da.AudioChunkType$inboundSchema.default("input_audio")}).transform(t=>(0,$wr.remap)(t,{input_audio:"inputAudio"}));da.AudioChunk$outboundSchema=Iae.object({inputAudio:Iae.string(),type:da.AudioChunkType$outboundSchema.default("input_audio")}).transform(t=>(0,$wr.remap)(t,{inputAudio:"input_audio"}));var Dwr;(function(t){t.inboundSchema=da.AudioChunk$inboundSchema,t.outboundSchema=da.AudioChunk$outboundSchema})(Dwr||(da.AudioChunk$=Dwr={}));function xyo(t){return JSON.stringify(da.AudioChunk$outboundSchema.parse(t))}function Oyo(t){return(0,Cyo.safeParse)(t,e=>da.AudioChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioChunk' from JSON")}});var iH=S(fa=>{"use strict";var Tyo=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]}),Eyo=fa&&fa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pyo=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"&&Tyo(r,e,n[o]);return Eyo(r,e),r}}();Object.defineProperty(fa,"__esModule",{value:!0});fa.DocumentURLChunk$=fa.DocumentURLChunk$outboundSchema=fa.DocumentURLChunk$inboundSchema=fa.DocumentURLChunkType$=fa.DocumentURLChunkType$outboundSchema=fa.DocumentURLChunkType$inboundSchema=fa.DocumentURLChunkType=void 0;fa.documentURLChunkToJSON=Iyo;fa.documentURLChunkFromJSON=Ryo;var Y1=Pyo(Q()),kwr=le(),Myo=Z();fa.DocumentURLChunkType={DocumentUrl:"document_url"};fa.DocumentURLChunkType$inboundSchema=Y1.nativeEnum(fa.DocumentURLChunkType);fa.DocumentURLChunkType$outboundSchema=fa.DocumentURLChunkType$inboundSchema;var Lwr;(function(t){t.inboundSchema=fa.DocumentURLChunkType$inboundSchema,t.outboundSchema=fa.DocumentURLChunkType$outboundSchema})(Lwr||(fa.DocumentURLChunkType$=Lwr={}));fa.DocumentURLChunk$inboundSchema=Y1.object({document_url:Y1.string(),document_name:Y1.nullable(Y1.string()).optional(),type:fa.DocumentURLChunkType$inboundSchema.default("document_url")}).transform(t=>(0,kwr.remap)(t,{document_url:"documentUrl",document_name:"documentName"}));fa.DocumentURLChunk$outboundSchema=Y1.object({documentUrl:Y1.string(),documentName:Y1.nullable(Y1.string()).optional(),type:fa.DocumentURLChunkType$outboundSchema.default("document_url")}).transform(t=>(0,kwr.remap)(t,{documentUrl:"document_url",documentName:"document_name"}));var Fwr;(function(t){t.inboundSchema=fa.DocumentURLChunk$inboundSchema,t.outboundSchema=fa.DocumentURLChunk$outboundSchema})(Fwr||(fa.DocumentURLChunk$=Fwr={}));function Iyo(t){return JSON.stringify(fa.DocumentURLChunk$outboundSchema.parse(t))}function Ryo(t){return(0,Myo.safeParse)(t,e=>fa.DocumentURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentURLChunk' from JSON")}});var APe=S(Id=>{"use strict";var Ayo=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]}),Nyo=Id&&Id.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jyo=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"&&Ayo(r,e,n[o]);return Nyo(r,e),r}}();Object.defineProperty(Id,"__esModule",{value:!0});Id.FileChunk$=Id.FileChunk$outboundSchema=Id.FileChunk$inboundSchema=void 0;Id.fileChunkToJSON=$yo;Id.fileChunkFromJSON=Lyo;var a9=jyo(Q()),Uwr=le(),Dyo=Z();Id.FileChunk$inboundSchema=a9.object({type:a9.literal("file").default("file"),file_id:a9.string()}).transform(t=>(0,Uwr.remap)(t,{file_id:"fileId"}));Id.FileChunk$outboundSchema=a9.object({type:a9.literal("file").default("file"),fileId:a9.string()}).transform(t=>(0,Uwr.remap)(t,{fileId:"file_id"}));var qwr;(function(t){t.inboundSchema=Id.FileChunk$inboundSchema,t.outboundSchema=Id.FileChunk$outboundSchema})(qwr||(Id.FileChunk$=qwr={}));function $yo(t){return JSON.stringify(Id.FileChunk$outboundSchema.parse(t))}function Lyo(t){return(0,Dyo.safeParse)(t,e=>Id.FileChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileChunk' from JSON")}});var Ust=S(Rd=>{"use strict";var Fyo=Rd&&Rd.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kyo=Rd&&Rd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qyo=Rd&&Rd.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Fyo(r,e,n[o]);return kyo(r,e),r}}();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.ImageURL$=Rd.ImageURL$outboundSchema=Rd.ImageURL$inboundSchema=void 0;Rd.imageURLToJSON=Byo;Rd.imageURLFromJSON=zyo;var Zk=qyo(Q()),Uyo=Z();Rd.ImageURL$inboundSchema=Zk.object({url:Zk.string(),detail:Zk.nullable(Zk.string()).optional()});Rd.ImageURL$outboundSchema=Zk.object({url:Zk.string(),detail:Zk.nullable(Zk.string()).optional()});var Bwr;(function(t){t.inboundSchema=Rd.ImageURL$inboundSchema,t.outboundSchema=Rd.ImageURL$outboundSchema})(Bwr||(Rd.ImageURL$=Bwr={}));function Byo(t){return JSON.stringify(Rd.ImageURL$outboundSchema.parse(t))}function zyo(t){return(0,Uyo.safeParse)(t,e=>Rd.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var aH=S(so=>{"use strict";var Vyo=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]}),Hyo=so&&so.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jyo=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"&&Vyo(r,e,n[o]);return Hyo(r,e),r}}();Object.defineProperty(so,"__esModule",{value:!0});so.ImageURLChunk$=so.ImageURLChunk$outboundSchema=so.ImageURLChunk$inboundSchema=so.ImageURLChunkType$=so.ImageURLChunkType$outboundSchema=so.ImageURLChunkType$inboundSchema=so.ImageURLChunkImageURL$=so.ImageURLChunkImageURL$outboundSchema=so.ImageURLChunkImageURL$inboundSchema=so.ImageURLChunkType=void 0;so.imageURLChunkImageURLToJSON=Wyo;so.imageURLChunkImageURLFromJSON=Kyo;so.imageURLChunkToJSON=Gyo;so.imageURLChunkFromJSON=Xyo;var KC=Jyo(Q()),Jwr=le(),Wwr=Z(),NPe=Ust();so.ImageURLChunkType={ImageUrl:"image_url"};so.ImageURLChunkImageURL$inboundSchema=KC.union([NPe.ImageURL$inboundSchema,KC.string()]);so.ImageURLChunkImageURL$outboundSchema=KC.union([NPe.ImageURL$outboundSchema,KC.string()]);var zwr;(function(t){t.inboundSchema=so.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=so.ImageURLChunkImageURL$outboundSchema})(zwr||(so.ImageURLChunkImageURL$=zwr={}));function Wyo(t){return JSON.stringify(so.ImageURLChunkImageURL$outboundSchema.parse(t))}function Kyo(t){return(0,Wwr.safeParse)(t,e=>so.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}so.ImageURLChunkType$inboundSchema=KC.nativeEnum(so.ImageURLChunkType);so.ImageURLChunkType$outboundSchema=so.ImageURLChunkType$inboundSchema;var Vwr;(function(t){t.inboundSchema=so.ImageURLChunkType$inboundSchema,t.outboundSchema=so.ImageURLChunkType$outboundSchema})(Vwr||(so.ImageURLChunkType$=Vwr={}));so.ImageURLChunk$inboundSchema=KC.object({image_url:KC.union([NPe.ImageURL$inboundSchema,KC.string()]),type:so.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,Jwr.remap)(t,{image_url:"imageUrl"}));so.ImageURLChunk$outboundSchema=KC.object({imageUrl:KC.union([NPe.ImageURL$outboundSchema,KC.string()]),type:so.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,Jwr.remap)(t,{imageUrl:"image_url"}));var Hwr;(function(t){t.inboundSchema=so.ImageURLChunk$inboundSchema,t.outboundSchema=so.ImageURLChunk$outboundSchema})(Hwr||(so.ImageURLChunk$=Hwr={}));function Gyo(t){return JSON.stringify(so.ImageURLChunk$outboundSchema.parse(t))}function Xyo(t){return(0,Wwr.safeParse)(t,e=>so.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var jPe=S(pa=>{"use strict";var Zyo=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]}),Yyo=pa&&pa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qyo=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"&&Zyo(r,e,n[o]);return Yyo(r,e),r}}();Object.defineProperty(pa,"__esModule",{value:!0});pa.ReferenceChunk$=pa.ReferenceChunk$outboundSchema=pa.ReferenceChunk$inboundSchema=pa.ReferenceChunkType$=pa.ReferenceChunkType$outboundSchema=pa.ReferenceChunkType$inboundSchema=pa.ReferenceChunkType=void 0;pa.referenceChunkToJSON=tbo;pa.referenceChunkFromJSON=rbo;var sH=Qyo(Q()),Xwr=le(),ebo=Z();pa.ReferenceChunkType={Reference:"reference"};pa.ReferenceChunkType$inboundSchema=sH.nativeEnum(pa.ReferenceChunkType);pa.ReferenceChunkType$outboundSchema=pa.ReferenceChunkType$inboundSchema;var Kwr;(function(t){t.inboundSchema=pa.ReferenceChunkType$inboundSchema,t.outboundSchema=pa.ReferenceChunkType$outboundSchema})(Kwr||(pa.ReferenceChunkType$=Kwr={}));pa.ReferenceChunk$inboundSchema=sH.object({reference_ids:sH.array(sH.number().int()),type:pa.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,Xwr.remap)(t,{reference_ids:"referenceIds"}));pa.ReferenceChunk$outboundSchema=sH.object({referenceIds:sH.array(sH.number().int()),type:pa.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,Xwr.remap)(t,{referenceIds:"reference_ids"}));var Gwr;(function(t){t.inboundSchema=pa.ReferenceChunk$inboundSchema,t.outboundSchema=pa.ReferenceChunk$outboundSchema})(Gwr||(pa.ReferenceChunk$=Gwr={}));function tbo(t){return JSON.stringify(pa.ReferenceChunk$outboundSchema.parse(t))}function rbo(t){return(0,ebo.safeParse)(t,e=>pa.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var Yk=S(ma=>{"use strict";var nbo=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]}),obo=ma&&ma.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ibo=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"&&nbo(r,e,n[o]);return obo(r,e),r}}();Object.defineProperty(ma,"__esModule",{value:!0});ma.TextChunk$=ma.TextChunk$outboundSchema=ma.TextChunk$inboundSchema=ma.TextChunkType$=ma.TextChunkType$outboundSchema=ma.TextChunkType$inboundSchema=ma.TextChunkType=void 0;ma.textChunkToJSON=sbo;ma.textChunkFromJSON=ubo;var Rae=ibo(Q()),abo=Z();ma.TextChunkType={Text:"text"};ma.TextChunkType$inboundSchema=Rae.nativeEnum(ma.TextChunkType);ma.TextChunkType$outboundSchema=ma.TextChunkType$inboundSchema;var Zwr;(function(t){t.inboundSchema=ma.TextChunkType$inboundSchema,t.outboundSchema=ma.TextChunkType$outboundSchema})(Zwr||(ma.TextChunkType$=Zwr={}));ma.TextChunk$inboundSchema=Rae.object({text:Rae.string(),type:ma.TextChunkType$inboundSchema.default("text")});ma.TextChunk$outboundSchema=Rae.object({text:Rae.string(),type:ma.TextChunkType$outboundSchema.default("text")});var Ywr;(function(t){t.inboundSchema=ma.TextChunk$inboundSchema,t.outboundSchema=ma.TextChunk$outboundSchema})(Ywr||(ma.TextChunk$=Ywr={}));function sbo(t){return JSON.stringify(ma.TextChunk$outboundSchema.parse(t))}function ubo(t){return(0,abo.safeParse)(t,e=>ma.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var uH=S(uo=>{"use strict";var lbo=uo&&uo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cbo=uo&&uo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dbo=uo&&uo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 cbo(r,e),r}}();Object.defineProperty(uo,"__esModule",{value:!0});uo.ThinkChunk$=uo.ThinkChunk$outboundSchema=uo.ThinkChunk$inboundSchema=uo.ThinkChunkType$=uo.ThinkChunkType$outboundSchema=uo.ThinkChunkType$inboundSchema=uo.Thinking$=uo.Thinking$outboundSchema=uo.Thinking$inboundSchema=uo.ThinkChunkType=void 0;uo.thinkingToJSON=fbo;uo.thinkingFromJSON=pbo;uo.thinkChunkToJSON=mbo;uo.thinkChunkFromJSON=hbo;var GC=dbo(Q()),rSr=Z(),DPe=jPe(),$Pe=Yk();uo.ThinkChunkType={Thinking:"thinking"};uo.Thinking$inboundSchema=GC.union([DPe.ReferenceChunk$inboundSchema,$Pe.TextChunk$inboundSchema]);uo.Thinking$outboundSchema=GC.union([DPe.ReferenceChunk$outboundSchema,$Pe.TextChunk$outboundSchema]);var Qwr;(function(t){t.inboundSchema=uo.Thinking$inboundSchema,t.outboundSchema=uo.Thinking$outboundSchema})(Qwr||(uo.Thinking$=Qwr={}));function fbo(t){return JSON.stringify(uo.Thinking$outboundSchema.parse(t))}function pbo(t){return(0,rSr.safeParse)(t,e=>uo.Thinking$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Thinking' from JSON")}uo.ThinkChunkType$inboundSchema=GC.nativeEnum(uo.ThinkChunkType);uo.ThinkChunkType$outboundSchema=uo.ThinkChunkType$inboundSchema;var eSr;(function(t){t.inboundSchema=uo.ThinkChunkType$inboundSchema,t.outboundSchema=uo.ThinkChunkType$outboundSchema})(eSr||(uo.ThinkChunkType$=eSr={}));uo.ThinkChunk$inboundSchema=GC.object({thinking:GC.array(GC.union([DPe.ReferenceChunk$inboundSchema,$Pe.TextChunk$inboundSchema])),closed:GC.boolean().optional(),type:uo.ThinkChunkType$inboundSchema.default("thinking")});uo.ThinkChunk$outboundSchema=GC.object({thinking:GC.array(GC.union([DPe.ReferenceChunk$outboundSchema,$Pe.TextChunk$outboundSchema])),closed:GC.boolean().optional(),type:uo.ThinkChunkType$outboundSchema.default("thinking")});var tSr;(function(t){t.inboundSchema=uo.ThinkChunk$inboundSchema,t.outboundSchema=uo.ThinkChunk$outboundSchema})(tSr||(uo.ThinkChunk$=tSr={}));function mbo(t){return JSON.stringify(uo.ThinkChunk$outboundSchema.parse(t))}function hbo(t){return(0,rSr.safeParse)(t,e=>uo.ThinkChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ThinkChunk' from JSON")}});var s9=S(Ad=>{"use strict";var gbo=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]}),ybo=Ad&&Ad.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bbo=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"&&gbo(r,e,n[o]);return ybo(r,e),r}}();Object.defineProperty(Ad,"__esModule",{value:!0});Ad.ContentChunk$=Ad.ContentChunk$outboundSchema=Ad.ContentChunk$inboundSchema=void 0;Ad.contentChunkToJSON=vbo;Ad.contentChunkFromJSON=wbo;var Gs=bbo(Q()),_bo=Z(),oSr=qst(),iSr=iH(),aSr=APe(),sSr=aH(),uSr=jPe(),lSr=Yk(),cSr=uH();Ad.ContentChunk$inboundSchema=Gs.union([sSr.ImageURLChunk$inboundSchema.and(Gs.object({type:Gs.literal("image_url")}).transform(t=>({type:t.type}))),iSr.DocumentURLChunk$inboundSchema.and(Gs.object({type:Gs.literal("document_url")}).transform(t=>({type:t.type}))),lSr.TextChunk$inboundSchema.and(Gs.object({type:Gs.literal("text")}).transform(t=>({type:t.type}))),uSr.ReferenceChunk$inboundSchema.and(Gs.object({type:Gs.literal("reference")}).transform(t=>({type:t.type}))),aSr.FileChunk$inboundSchema.and(Gs.object({type:Gs.literal("file")}).transform(t=>({type:t.type}))),cSr.ThinkChunk$inboundSchema.and(Gs.object({type:Gs.literal("thinking")}).transform(t=>({type:t.type}))),oSr.AudioChunk$inboundSchema.and(Gs.object({type:Gs.literal("input_audio")}).transform(t=>({type:t.type})))]);Ad.ContentChunk$outboundSchema=Gs.union([sSr.ImageURLChunk$outboundSchema.and(Gs.object({type:Gs.literal("image_url")}).transform(t=>({type:t.type}))),iSr.DocumentURLChunk$outboundSchema.and(Gs.object({type:Gs.literal("document_url")}).transform(t=>({type:t.type}))),lSr.TextChunk$outboundSchema.and(Gs.object({type:Gs.literal("text")}).transform(t=>({type:t.type}))),uSr.ReferenceChunk$outboundSchema.and(Gs.object({type:Gs.literal("reference")}).transform(t=>({type:t.type}))),aSr.FileChunk$outboundSchema.and(Gs.object({type:Gs.literal("file")}).transform(t=>({type:t.type}))),cSr.ThinkChunk$outboundSchema.and(Gs.object({type:Gs.literal("thinking")}).transform(t=>({type:t.type}))),oSr.AudioChunk$outboundSchema.and(Gs.object({type:Gs.literal("input_audio")}).transform(t=>({type:t.type})))]);var nSr;(function(t){t.inboundSchema=Ad.ContentChunk$inboundSchema,t.outboundSchema=Ad.ContentChunk$outboundSchema})(nSr||(Ad.ContentChunk$=nSr={}));function vbo(t){return JSON.stringify(Ad.ContentChunk$outboundSchema.parse(t))}function wbo(t){return(0,_bo.safeParse)(t,e=>Ad.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var Bst=S(ds=>{"use strict";var Sbo=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]}),Cbo=ds&&ds.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xbo=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"&&Sbo(r,e,n[o]);return Cbo(r,e),r}}();Object.defineProperty(ds,"__esModule",{value:!0});ds.FunctionCall$=ds.FunctionCall$outboundSchema=ds.FunctionCall$inboundSchema=ds.Arguments$=ds.Arguments$outboundSchema=ds.Arguments$inboundSchema=void 0;ds.argumentsToJSON=Obo;ds.argumentsFromJSON=Tbo;ds.functionCallToJSON=Ebo;ds.functionCallFromJSON=Pbo;var Nd=xbo(Q()),pSr=Z();ds.Arguments$inboundSchema=Nd.union([Nd.record(Nd.any()),Nd.string()]);ds.Arguments$outboundSchema=Nd.union([Nd.record(Nd.any()),Nd.string()]);var dSr;(function(t){t.inboundSchema=ds.Arguments$inboundSchema,t.outboundSchema=ds.Arguments$outboundSchema})(dSr||(ds.Arguments$=dSr={}));function Obo(t){return JSON.stringify(ds.Arguments$outboundSchema.parse(t))}function Tbo(t){return(0,pSr.safeParse)(t,e=>ds.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}ds.FunctionCall$inboundSchema=Nd.object({name:Nd.string(),arguments:Nd.union([Nd.record(Nd.any()),Nd.string()])});ds.FunctionCall$outboundSchema=Nd.object({name:Nd.string(),arguments:Nd.union([Nd.record(Nd.any()),Nd.string()])});var fSr;(function(t){t.inboundSchema=ds.FunctionCall$inboundSchema,t.outboundSchema=ds.FunctionCall$outboundSchema})(fSr||(ds.FunctionCall$=fSr={}));function Ebo(t){return JSON.stringify(ds.FunctionCall$outboundSchema.parse(t))}function Pbo(t){return(0,pSr.safeParse)(t,e=>ds.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var XC=S(zst=>{"use strict";Object.defineProperty(zst,"__esModule",{value:!0});zst.catchUnrecognizedEnum=Mbo;function Mbo(t){return t}});var Aae=S(jd=>{"use strict";var Ibo=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]}),Rbo=jd&&jd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Abo=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"&&Ibo(r,e,n[o]);return Rbo(r,e),r}}();Object.defineProperty(jd,"__esModule",{value:!0});jd.ToolTypes$=jd.ToolTypes$outboundSchema=jd.ToolTypes$inboundSchema=jd.ToolTypes=void 0;var lH=Abo(Q()),Nbo=XC();jd.ToolTypes={Function:"function"};jd.ToolTypes$inboundSchema=lH.union([lH.nativeEnum(jd.ToolTypes),lH.string().transform(Nbo.catchUnrecognizedEnum)]);jd.ToolTypes$outboundSchema=lH.union([lH.nativeEnum(jd.ToolTypes),lH.string().and(lH.custom())]);var mSr;(function(t){t.inboundSchema=jd.ToolTypes$inboundSchema,t.outboundSchema=jd.ToolTypes$outboundSchema})(mSr||(jd.ToolTypes$=mSr={}))});var LPe=S(Dd=>{"use strict";var jbo=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]}),Dbo=Dd&&Dd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$bo=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"&&jbo(r,e,n[o]);return Dbo(r,e),r}}();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.ToolCall$=Dd.ToolCall$outboundSchema=Dd.ToolCall$inboundSchema=void 0;Dd.toolCallToJSON=Fbo;Dd.toolCallFromJSON=kbo;var u9=$bo(Q()),Lbo=Z(),gSr=Bst(),ySr=Aae();Dd.ToolCall$inboundSchema=u9.object({id:u9.string().default("null"),type:ySr.ToolTypes$inboundSchema.optional(),function:gSr.FunctionCall$inboundSchema,index:u9.number().int().default(0)});Dd.ToolCall$outboundSchema=u9.object({id:u9.string().default("null"),type:ySr.ToolTypes$outboundSchema.optional(),function:gSr.FunctionCall$outboundSchema,index:u9.number().int().default(0)});var hSr;(function(t){t.inboundSchema=Dd.ToolCall$inboundSchema,t.outboundSchema=Dd.ToolCall$outboundSchema})(hSr||(Dd.ToolCall$=hSr={}));function Fbo(t){return JSON.stringify(Dd.ToolCall$outboundSchema.parse(t))}function kbo(t){return(0,Lbo.safeParse)(t,e=>Dd.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var jR=S(lo=>{"use strict";var qbo=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]}),Ubo=lo&&lo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bbo=lo&&lo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 Ubo(r,e),r}}();Object.defineProperty(lo,"__esModule",{value:!0});lo.AssistantMessage$=lo.AssistantMessage$outboundSchema=lo.AssistantMessage$inboundSchema=lo.AssistantMessageRole$=lo.AssistantMessageRole$outboundSchema=lo.AssistantMessageRole$inboundSchema=lo.AssistantMessageContent$=lo.AssistantMessageContent$outboundSchema=lo.AssistantMessageContent$inboundSchema=lo.AssistantMessageRole=void 0;lo.assistantMessageContentToJSON=zbo;lo.assistantMessageContentFromJSON=Vbo;lo.assistantMessageToJSON=Hbo;lo.assistantMessageFromJSON=Jbo;var hc=Bbo(Q()),wSr=le(),SSr=Z(),FPe=s9(),CSr=LPe();lo.AssistantMessageRole={Assistant:"assistant"};lo.AssistantMessageContent$inboundSchema=hc.union([hc.string(),hc.array(FPe.ContentChunk$inboundSchema)]);lo.AssistantMessageContent$outboundSchema=hc.union([hc.string(),hc.array(FPe.ContentChunk$outboundSchema)]);var bSr;(function(t){t.inboundSchema=lo.AssistantMessageContent$inboundSchema,t.outboundSchema=lo.AssistantMessageContent$outboundSchema})(bSr||(lo.AssistantMessageContent$=bSr={}));function zbo(t){return JSON.stringify(lo.AssistantMessageContent$outboundSchema.parse(t))}function Vbo(t){return(0,SSr.safeParse)(t,e=>lo.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}lo.AssistantMessageRole$inboundSchema=hc.nativeEnum(lo.AssistantMessageRole);lo.AssistantMessageRole$outboundSchema=lo.AssistantMessageRole$inboundSchema;var _Sr;(function(t){t.inboundSchema=lo.AssistantMessageRole$inboundSchema,t.outboundSchema=lo.AssistantMessageRole$outboundSchema})(_Sr||(lo.AssistantMessageRole$=_Sr={}));lo.AssistantMessage$inboundSchema=hc.object({content:hc.nullable(hc.union([hc.string(),hc.array(FPe.ContentChunk$inboundSchema)])).optional(),tool_calls:hc.nullable(hc.array(CSr.ToolCall$inboundSchema)).optional(),prefix:hc.boolean().default(!1),role:lo.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,wSr.remap)(t,{tool_calls:"toolCalls"}));lo.AssistantMessage$outboundSchema=hc.object({content:hc.nullable(hc.union([hc.string(),hc.array(FPe.ContentChunk$outboundSchema)])).optional(),toolCalls:hc.nullable(hc.array(CSr.ToolCall$outboundSchema)).optional(),prefix:hc.boolean().default(!1),role:lo.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,wSr.remap)(t,{toolCalls:"tool_calls"}));var vSr;(function(t){t.inboundSchema=lo.AssistantMessage$inboundSchema,t.outboundSchema=lo.AssistantMessage$outboundSchema})(vSr||(lo.AssistantMessage$=vSr={}));function Hbo(t){return JSON.stringify(lo.AssistantMessage$outboundSchema.parse(t))}function Jbo(t){return(0,SSr.safeParse)(t,e=>lo.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var l9=S($d=>{"use strict";var Wbo=$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]}),Kbo=$d&&$d.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gbo=$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"&&Wbo(r,e,n[o]);return Kbo(r,e),r}}();Object.defineProperty($d,"__esModule",{value:!0});$d.MistralPromptMode$=$d.MistralPromptMode$outboundSchema=$d.MistralPromptMode$inboundSchema=$d.MistralPromptMode=void 0;var cH=Gbo(Q()),Xbo=XC();$d.MistralPromptMode={Reasoning:"reasoning"};$d.MistralPromptMode$inboundSchema=cH.union([cH.nativeEnum($d.MistralPromptMode),cH.string().transform(Xbo.catchUnrecognizedEnum)]);$d.MistralPromptMode$outboundSchema=cH.union([cH.nativeEnum($d.MistralPromptMode),cH.string().and(cH.custom())]);var xSr;(function(t){t.inboundSchema=$d.MistralPromptMode$inboundSchema,t.outboundSchema=$d.MistralPromptMode$outboundSchema})(xSr||($d.MistralPromptMode$=xSr={}))});var Vst=S(Ld=>{"use strict";var Zbo=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]}),Ybo=Ld&&Ld.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qbo=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"&&Zbo(r,e,n[o]);return Ybo(r,e),r}}();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.SystemMessageContentChunks$=Ld.SystemMessageContentChunks$outboundSchema=Ld.SystemMessageContentChunks$inboundSchema=void 0;Ld.systemMessageContentChunksToJSON=t_o;Ld.systemMessageContentChunksFromJSON=r_o;var DR=Qbo(Q()),e_o=Z(),TSr=Yk(),ESr=uH();Ld.SystemMessageContentChunks$inboundSchema=DR.union([TSr.TextChunk$inboundSchema.and(DR.object({type:DR.literal("text")}).transform(t=>({type:t.type}))),ESr.ThinkChunk$inboundSchema.and(DR.object({type:DR.literal("thinking")}).transform(t=>({type:t.type})))]);Ld.SystemMessageContentChunks$outboundSchema=DR.union([TSr.TextChunk$outboundSchema.and(DR.object({type:DR.literal("text")}).transform(t=>({type:t.type}))),ESr.ThinkChunk$outboundSchema.and(DR.object({type:DR.literal("thinking")}).transform(t=>({type:t.type})))]);var OSr;(function(t){t.inboundSchema=Ld.SystemMessageContentChunks$inboundSchema,t.outboundSchema=Ld.SystemMessageContentChunks$outboundSchema})(OSr||(Ld.SystemMessageContentChunks$=OSr={}));function t_o(t){return JSON.stringify(Ld.SystemMessageContentChunks$outboundSchema.parse(t))}function r_o(t){return(0,e_o.safeParse)(t,e=>Ld.SystemMessageContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContentChunks' from JSON")}});var Q1=S(co=>{"use strict";var n_o=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]}),o_o=co&&co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i_o=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"&&n_o(r,e,n[o]);return o_o(r,e),r}}();Object.defineProperty(co,"__esModule",{value:!0});co.SystemMessage$=co.SystemMessage$outboundSchema=co.SystemMessage$inboundSchema=co.Role$=co.Role$outboundSchema=co.Role$inboundSchema=co.SystemMessageContent$=co.SystemMessageContent$outboundSchema=co.SystemMessageContent$inboundSchema=co.Role=void 0;co.systemMessageContentToJSON=a_o;co.systemMessageContentFromJSON=s_o;co.systemMessageToJSON=u_o;co.systemMessageFromJSON=l_o;var wb=i_o(Q()),RSr=Z(),kPe=Vst();co.Role={System:"system"};co.SystemMessageContent$inboundSchema=wb.union([wb.string(),wb.array(kPe.SystemMessageContentChunks$inboundSchema)]);co.SystemMessageContent$outboundSchema=wb.union([wb.string(),wb.array(kPe.SystemMessageContentChunks$outboundSchema)]);var PSr;(function(t){t.inboundSchema=co.SystemMessageContent$inboundSchema,t.outboundSchema=co.SystemMessageContent$outboundSchema})(PSr||(co.SystemMessageContent$=PSr={}));function a_o(t){return JSON.stringify(co.SystemMessageContent$outboundSchema.parse(t))}function s_o(t){return(0,RSr.safeParse)(t,e=>co.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}co.Role$inboundSchema=wb.nativeEnum(co.Role);co.Role$outboundSchema=co.Role$inboundSchema;var MSr;(function(t){t.inboundSchema=co.Role$inboundSchema,t.outboundSchema=co.Role$outboundSchema})(MSr||(co.Role$=MSr={}));co.SystemMessage$inboundSchema=wb.object({content:wb.union([wb.string(),wb.array(kPe.SystemMessageContentChunks$inboundSchema)]),role:co.Role$inboundSchema.default("system")});co.SystemMessage$outboundSchema=wb.object({content:wb.union([wb.string(),wb.array(kPe.SystemMessageContentChunks$outboundSchema)]),role:co.Role$outboundSchema.default("system")});var ISr;(function(t){t.inboundSchema=co.SystemMessage$inboundSchema,t.outboundSchema=co.SystemMessage$outboundSchema})(ISr||(co.SystemMessage$=ISr={}));function u_o(t){return JSON.stringify(co.SystemMessage$outboundSchema.parse(t))}function l_o(t){return(0,RSr.safeParse)(t,e=>co.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var c9=S(Fd=>{"use strict";var c_o=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]}),d_o=Fd&&Fd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f_o=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"&&c_o(r,e,n[o]);return d_o(r,e),r}}();Object.defineProperty(Fd,"__esModule",{value:!0});Fd.Tool$=Fd.Tool$outboundSchema=Fd.Tool$inboundSchema=void 0;Fd.toolToJSON=m_o;Fd.toolFromJSON=h_o;var NSr=f_o(Q()),p_o=Z(),jSr=_Pe(),DSr=Aae();Fd.Tool$inboundSchema=NSr.object({type:DSr.ToolTypes$inboundSchema.optional(),function:jSr.FunctionT$inboundSchema});Fd.Tool$outboundSchema=NSr.object({type:DSr.ToolTypes$outboundSchema.optional(),function:jSr.FunctionT$outboundSchema});var ASr;(function(t){t.inboundSchema=Fd.Tool$inboundSchema,t.outboundSchema=Fd.Tool$outboundSchema})(ASr||(Fd.Tool$=ASr={}));function m_o(t){return JSON.stringify(Fd.Tool$outboundSchema.parse(t))}function h_o(t){return(0,p_o.safeParse)(t,e=>Fd.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var Hst=S(kd=>{"use strict";var g_o=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]}),y_o=kd&&kd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b_o=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"&&g_o(r,e,n[o]);return y_o(r,e),r}}();Object.defineProperty(kd,"__esModule",{value:!0});kd.FunctionName$=kd.FunctionName$outboundSchema=kd.FunctionName$inboundSchema=void 0;kd.functionNameToJSON=v_o;kd.functionNameFromJSON=w_o;var qPe=b_o(Q()),__o=Z();kd.FunctionName$inboundSchema=qPe.object({name:qPe.string()});kd.FunctionName$outboundSchema=qPe.object({name:qPe.string()});var $Sr;(function(t){t.inboundSchema=kd.FunctionName$inboundSchema,t.outboundSchema=kd.FunctionName$outboundSchema})($Sr||(kd.FunctionName$=$Sr={}));function v_o(t){return JSON.stringify(kd.FunctionName$outboundSchema.parse(t))}function w_o(t){return(0,__o.safeParse)(t,e=>kd.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var d9=S(qd=>{"use strict";var S_o=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]}),C_o=qd&&qd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x_o=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"&&S_o(r,e,n[o]);return C_o(r,e),r}}();Object.defineProperty(qd,"__esModule",{value:!0});qd.ToolChoice$=qd.ToolChoice$outboundSchema=qd.ToolChoice$inboundSchema=void 0;qd.toolChoiceToJSON=T_o;qd.toolChoiceFromJSON=E_o;var FSr=x_o(Q()),O_o=Z(),kSr=Hst(),qSr=Aae();qd.ToolChoice$inboundSchema=FSr.object({type:qSr.ToolTypes$inboundSchema.optional(),function:kSr.FunctionName$inboundSchema});qd.ToolChoice$outboundSchema=FSr.object({type:qSr.ToolTypes$outboundSchema.optional(),function:kSr.FunctionName$outboundSchema});var LSr;(function(t){t.inboundSchema=qd.ToolChoice$inboundSchema,t.outboundSchema=qd.ToolChoice$outboundSchema})(LSr||(qd.ToolChoice$=LSr={}));function T_o(t){return JSON.stringify(qd.ToolChoice$outboundSchema.parse(t))}function E_o(t){return(0,O_o.safeParse)(t,e=>qd.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var ej=S(fo=>{"use strict";var P_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]}),M_o=fo&&fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I_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"&&P_o(r,e,n[o]);return M_o(r,e),r}}();Object.defineProperty(fo,"__esModule",{value:!0});fo.ToolMessage$=fo.ToolMessage$outboundSchema=fo.ToolMessage$inboundSchema=fo.ToolMessageRole$=fo.ToolMessageRole$outboundSchema=fo.ToolMessageRole$inboundSchema=fo.ToolMessageContent$=fo.ToolMessageContent$outboundSchema=fo.ToolMessageContent$inboundSchema=fo.ToolMessageRole=void 0;fo.toolMessageContentToJSON=R_o;fo.toolMessageContentFromJSON=A_o;fo.toolMessageToJSON=N_o;fo.toolMessageFromJSON=j_o;var _l=I_o(Q()),VSr=le(),HSr=Z(),UPe=s9();fo.ToolMessageRole={Tool:"tool"};fo.ToolMessageContent$inboundSchema=_l.union([_l.string(),_l.array(UPe.ContentChunk$inboundSchema)]);fo.ToolMessageContent$outboundSchema=_l.union([_l.string(),_l.array(UPe.ContentChunk$outboundSchema)]);var USr;(function(t){t.inboundSchema=fo.ToolMessageContent$inboundSchema,t.outboundSchema=fo.ToolMessageContent$outboundSchema})(USr||(fo.ToolMessageContent$=USr={}));function R_o(t){return JSON.stringify(fo.ToolMessageContent$outboundSchema.parse(t))}function A_o(t){return(0,HSr.safeParse)(t,e=>fo.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}fo.ToolMessageRole$inboundSchema=_l.nativeEnum(fo.ToolMessageRole);fo.ToolMessageRole$outboundSchema=fo.ToolMessageRole$inboundSchema;var BSr;(function(t){t.inboundSchema=fo.ToolMessageRole$inboundSchema,t.outboundSchema=fo.ToolMessageRole$outboundSchema})(BSr||(fo.ToolMessageRole$=BSr={}));fo.ToolMessage$inboundSchema=_l.object({content:_l.nullable(_l.union([_l.string(),_l.array(UPe.ContentChunk$inboundSchema)])),tool_call_id:_l.nullable(_l.string()).optional(),name:_l.nullable(_l.string()).optional(),role:fo.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,VSr.remap)(t,{tool_call_id:"toolCallId"}));fo.ToolMessage$outboundSchema=_l.object({content:_l.nullable(_l.union([_l.string(),_l.array(UPe.ContentChunk$outboundSchema)])),toolCallId:_l.nullable(_l.string()).optional(),name:_l.nullable(_l.string()).optional(),role:fo.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,VSr.remap)(t,{toolCallId:"tool_call_id"}));var zSr;(function(t){t.inboundSchema=fo.ToolMessage$inboundSchema,t.outboundSchema=fo.ToolMessage$outboundSchema})(zSr||(fo.ToolMessage$=zSr={}));function N_o(t){return JSON.stringify(fo.ToolMessage$outboundSchema.parse(t))}function j_o(t){return(0,HSr.safeParse)(t,e=>fo.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var tj=S(po=>{"use strict";var D_o=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]}),$_o=po&&po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L_o=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"&&D_o(r,e,n[o]);return $_o(r,e),r}}();Object.defineProperty(po,"__esModule",{value:!0});po.UserMessage$=po.UserMessage$outboundSchema=po.UserMessage$inboundSchema=po.UserMessageRole$=po.UserMessageRole$outboundSchema=po.UserMessageRole$inboundSchema=po.UserMessageContent$=po.UserMessageContent$outboundSchema=po.UserMessageContent$inboundSchema=po.UserMessageRole=void 0;po.userMessageContentToJSON=F_o;po.userMessageContentFromJSON=k_o;po.userMessageToJSON=q_o;po.userMessageFromJSON=U_o;var Mg=L_o(Q()),GSr=Z(),BPe=s9();po.UserMessageRole={User:"user"};po.UserMessageContent$inboundSchema=Mg.union([Mg.string(),Mg.array(BPe.ContentChunk$inboundSchema)]);po.UserMessageContent$outboundSchema=Mg.union([Mg.string(),Mg.array(BPe.ContentChunk$outboundSchema)]);var JSr;(function(t){t.inboundSchema=po.UserMessageContent$inboundSchema,t.outboundSchema=po.UserMessageContent$outboundSchema})(JSr||(po.UserMessageContent$=JSr={}));function F_o(t){return JSON.stringify(po.UserMessageContent$outboundSchema.parse(t))}function k_o(t){return(0,GSr.safeParse)(t,e=>po.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}po.UserMessageRole$inboundSchema=Mg.nativeEnum(po.UserMessageRole);po.UserMessageRole$outboundSchema=po.UserMessageRole$inboundSchema;var WSr;(function(t){t.inboundSchema=po.UserMessageRole$inboundSchema,t.outboundSchema=po.UserMessageRole$outboundSchema})(WSr||(po.UserMessageRole$=WSr={}));po.UserMessage$inboundSchema=Mg.object({content:Mg.nullable(Mg.union([Mg.string(),Mg.array(BPe.ContentChunk$inboundSchema)])),role:po.UserMessageRole$inboundSchema.default("user")});po.UserMessage$outboundSchema=Mg.object({content:Mg.nullable(Mg.union([Mg.string(),Mg.array(BPe.ContentChunk$outboundSchema)])),role:po.UserMessageRole$outboundSchema.default("user")});var KSr;(function(t){t.inboundSchema=po.UserMessage$inboundSchema,t.outboundSchema=po.UserMessage$outboundSchema})(KSr||(po.UserMessage$=KSr={}));function q_o(t){return JSON.stringify(po.UserMessage$outboundSchema.parse(t))}function U_o(t){return(0,GSr.safeParse)(t,e=>po.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var i0r=S(Wr=>{"use strict";var B_o=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]}),z_o=Wr&&Wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V_o=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"&&B_o(r,e,n[o]);return z_o(r,e),r}}();Object.defineProperty(Wr,"__esModule",{value:!0});Wr.AgentsCompletionRequest$=Wr.AgentsCompletionRequest$outboundSchema=Wr.AgentsCompletionRequest$inboundSchema=Wr.AgentsCompletionRequestToolChoice$=Wr.AgentsCompletionRequestToolChoice$outboundSchema=Wr.AgentsCompletionRequestToolChoice$inboundSchema=Wr.AgentsCompletionRequestMessages$=Wr.AgentsCompletionRequestMessages$outboundSchema=Wr.AgentsCompletionRequestMessages$inboundSchema=Wr.AgentsCompletionRequestStop$=Wr.AgentsCompletionRequestStop$outboundSchema=Wr.AgentsCompletionRequestStop$inboundSchema=void 0;Wr.agentsCompletionRequestStopToJSON=H_o;Wr.agentsCompletionRequestStopFromJSON=J_o;Wr.agentsCompletionRequestMessagesToJSON=W_o;Wr.agentsCompletionRequestMessagesFromJSON=K_o;Wr.agentsCompletionRequestToolChoiceToJSON=G_o;Wr.agentsCompletionRequestToolChoiceFromJSON=X_o;Wr.agentsCompletionRequestToJSON=Z_o;Wr.agentsCompletionRequestFromJSON=Y_o;var vt=V_o(Q()),e0r=le(),zPe=Z(),VPe=jR(),t0r=l9(),r0r=rH(),n0r=Hk(),HPe=Q1(),o0r=c9(),JPe=d9(),WPe=nH(),KPe=ej(),GPe=tj();Wr.AgentsCompletionRequestStop$inboundSchema=vt.union([vt.string(),vt.array(vt.string())]);Wr.AgentsCompletionRequestStop$outboundSchema=vt.union([vt.string(),vt.array(vt.string())]);var XSr;(function(t){t.inboundSchema=Wr.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=Wr.AgentsCompletionRequestStop$outboundSchema})(XSr||(Wr.AgentsCompletionRequestStop$=XSr={}));function H_o(t){return JSON.stringify(Wr.AgentsCompletionRequestStop$outboundSchema.parse(t))}function J_o(t){return(0,zPe.safeParse)(t,e=>Wr.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}Wr.AgentsCompletionRequestMessages$inboundSchema=vt.union([HPe.SystemMessage$inboundSchema.and(vt.object({role:vt.literal("system")}).transform(t=>({role:t.role}))),KPe.ToolMessage$inboundSchema.and(vt.object({role:vt.literal("tool")}).transform(t=>({role:t.role}))),GPe.UserMessage$inboundSchema.and(vt.object({role:vt.literal("user")}).transform(t=>({role:t.role}))),VPe.AssistantMessage$inboundSchema.and(vt.object({role:vt.literal("assistant")}).transform(t=>({role:t.role})))]);Wr.AgentsCompletionRequestMessages$outboundSchema=vt.union([HPe.SystemMessage$outboundSchema.and(vt.object({role:vt.literal("system")}).transform(t=>({role:t.role}))),KPe.ToolMessage$outboundSchema.and(vt.object({role:vt.literal("tool")}).transform(t=>({role:t.role}))),GPe.UserMessage$outboundSchema.and(vt.object({role:vt.literal("user")}).transform(t=>({role:t.role}))),VPe.AssistantMessage$outboundSchema.and(vt.object({role:vt.literal("assistant")}).transform(t=>({role:t.role})))]);var ZSr;(function(t){t.inboundSchema=Wr.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=Wr.AgentsCompletionRequestMessages$outboundSchema})(ZSr||(Wr.AgentsCompletionRequestMessages$=ZSr={}));function W_o(t){return JSON.stringify(Wr.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function K_o(t){return(0,zPe.safeParse)(t,e=>Wr.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}Wr.AgentsCompletionRequestToolChoice$inboundSchema=vt.union([JPe.ToolChoice$inboundSchema,WPe.ToolChoiceEnum$inboundSchema]);Wr.AgentsCompletionRequestToolChoice$outboundSchema=vt.union([JPe.ToolChoice$outboundSchema,WPe.ToolChoiceEnum$outboundSchema]);var YSr;(function(t){t.inboundSchema=Wr.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Wr.AgentsCompletionRequestToolChoice$outboundSchema})(YSr||(Wr.AgentsCompletionRequestToolChoice$=YSr={}));function G_o(t){return JSON.stringify(Wr.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function X_o(t){return(0,zPe.safeParse)(t,e=>Wr.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}Wr.AgentsCompletionRequest$inboundSchema=vt.object({max_tokens:vt.nullable(vt.number().int()).optional(),stream:vt.boolean().default(!1),stop:vt.union([vt.string(),vt.array(vt.string())]).optional(),random_seed:vt.nullable(vt.number().int()).optional(),messages:vt.array(vt.union([HPe.SystemMessage$inboundSchema.and(vt.object({role:vt.literal("system")}).transform(t=>({role:t.role}))),KPe.ToolMessage$inboundSchema.and(vt.object({role:vt.literal("tool")}).transform(t=>({role:t.role}))),GPe.UserMessage$inboundSchema.and(vt.object({role:vt.literal("user")}).transform(t=>({role:t.role}))),VPe.AssistantMessage$inboundSchema.and(vt.object({role:vt.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:n0r.ResponseFormat$inboundSchema.optional(),tools:vt.nullable(vt.array(o0r.Tool$inboundSchema)).optional(),tool_choice:vt.union([JPe.ToolChoice$inboundSchema,WPe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:vt.number().optional(),frequency_penalty:vt.number().optional(),n:vt.nullable(vt.number().int()).optional(),prediction:r0r.Prediction$inboundSchema.optional(),parallel_tool_calls:vt.boolean().optional(),prompt_mode:vt.nullable(t0r.MistralPromptMode$inboundSchema).optional(),agent_id:vt.string()}).transform(t=>(0,e0r.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"}));Wr.AgentsCompletionRequest$outboundSchema=vt.object({maxTokens:vt.nullable(vt.number().int()).optional(),stream:vt.boolean().default(!1),stop:vt.union([vt.string(),vt.array(vt.string())]).optional(),randomSeed:vt.nullable(vt.number().int()).optional(),messages:vt.array(vt.union([HPe.SystemMessage$outboundSchema.and(vt.object({role:vt.literal("system")}).transform(t=>({role:t.role}))),KPe.ToolMessage$outboundSchema.and(vt.object({role:vt.literal("tool")}).transform(t=>({role:t.role}))),GPe.UserMessage$outboundSchema.and(vt.object({role:vt.literal("user")}).transform(t=>({role:t.role}))),VPe.AssistantMessage$outboundSchema.and(vt.object({role:vt.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:n0r.ResponseFormat$outboundSchema.optional(),tools:vt.nullable(vt.array(o0r.Tool$outboundSchema)).optional(),toolChoice:vt.union([JPe.ToolChoice$outboundSchema,WPe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:vt.number().optional(),frequencyPenalty:vt.number().optional(),n:vt.nullable(vt.number().int()).optional(),prediction:r0r.Prediction$outboundSchema.optional(),parallelToolCalls:vt.boolean().optional(),promptMode:vt.nullable(t0r.MistralPromptMode$outboundSchema).optional(),agentId:vt.string()}).transform(t=>(0,e0r.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 QSr;(function(t){t.inboundSchema=Wr.AgentsCompletionRequest$inboundSchema,t.outboundSchema=Wr.AgentsCompletionRequest$outboundSchema})(QSr||(Wr.AgentsCompletionRequest$=QSr={}));function Z_o(t){return JSON.stringify(Wr.AgentsCompletionRequest$outboundSchema.parse(t))}function Y_o(t){return(0,zPe.safeParse)(t,e=>Wr.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var h0r=S(Kr=>{"use strict";var Q_o=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]}),evo=Kr&&Kr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tvo=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"&&Q_o(r,e,n[o]);return evo(r,e),r}}();Object.defineProperty(Kr,"__esModule",{value:!0});Kr.AgentsCompletionStreamRequest$=Kr.AgentsCompletionStreamRequest$outboundSchema=Kr.AgentsCompletionStreamRequest$inboundSchema=Kr.AgentsCompletionStreamRequestToolChoice$=Kr.AgentsCompletionStreamRequestToolChoice$outboundSchema=Kr.AgentsCompletionStreamRequestToolChoice$inboundSchema=Kr.AgentsCompletionStreamRequestMessages$=Kr.AgentsCompletionStreamRequestMessages$outboundSchema=Kr.AgentsCompletionStreamRequestMessages$inboundSchema=Kr.AgentsCompletionStreamRequestStop$=Kr.AgentsCompletionStreamRequestStop$outboundSchema=Kr.AgentsCompletionStreamRequestStop$inboundSchema=void 0;Kr.agentsCompletionStreamRequestStopToJSON=rvo;Kr.agentsCompletionStreamRequestStopFromJSON=nvo;Kr.agentsCompletionStreamRequestMessagesToJSON=ovo;Kr.agentsCompletionStreamRequestMessagesFromJSON=ivo;Kr.agentsCompletionStreamRequestToolChoiceToJSON=avo;Kr.agentsCompletionStreamRequestToolChoiceFromJSON=svo;Kr.agentsCompletionStreamRequestToJSON=uvo;Kr.agentsCompletionStreamRequestFromJSON=lvo;var wt=tvo(Q()),c0r=le(),XPe=Z(),ZPe=jR(),d0r=l9(),f0r=rH(),p0r=Hk(),YPe=Q1(),m0r=c9(),QPe=d9(),eMe=nH(),tMe=ej(),rMe=tj();Kr.AgentsCompletionStreamRequestStop$inboundSchema=wt.union([wt.string(),wt.array(wt.string())]);Kr.AgentsCompletionStreamRequestStop$outboundSchema=wt.union([wt.string(),wt.array(wt.string())]);var a0r;(function(t){t.inboundSchema=Kr.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Kr.AgentsCompletionStreamRequestStop$outboundSchema})(a0r||(Kr.AgentsCompletionStreamRequestStop$=a0r={}));function rvo(t){return JSON.stringify(Kr.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function nvo(t){return(0,XPe.safeParse)(t,e=>Kr.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}Kr.AgentsCompletionStreamRequestMessages$inboundSchema=wt.union([YPe.SystemMessage$inboundSchema.and(wt.object({role:wt.literal("system")}).transform(t=>({role:t.role}))),tMe.ToolMessage$inboundSchema.and(wt.object({role:wt.literal("tool")}).transform(t=>({role:t.role}))),rMe.UserMessage$inboundSchema.and(wt.object({role:wt.literal("user")}).transform(t=>({role:t.role}))),ZPe.AssistantMessage$inboundSchema.and(wt.object({role:wt.literal("assistant")}).transform(t=>({role:t.role})))]);Kr.AgentsCompletionStreamRequestMessages$outboundSchema=wt.union([YPe.SystemMessage$outboundSchema.and(wt.object({role:wt.literal("system")}).transform(t=>({role:t.role}))),tMe.ToolMessage$outboundSchema.and(wt.object({role:wt.literal("tool")}).transform(t=>({role:t.role}))),rMe.UserMessage$outboundSchema.and(wt.object({role:wt.literal("user")}).transform(t=>({role:t.role}))),ZPe.AssistantMessage$outboundSchema.and(wt.object({role:wt.literal("assistant")}).transform(t=>({role:t.role})))]);var s0r;(function(t){t.inboundSchema=Kr.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Kr.AgentsCompletionStreamRequestMessages$outboundSchema})(s0r||(Kr.AgentsCompletionStreamRequestMessages$=s0r={}));function ovo(t){return JSON.stringify(Kr.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function ivo(t){return(0,XPe.safeParse)(t,e=>Kr.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}Kr.AgentsCompletionStreamRequestToolChoice$inboundSchema=wt.union([QPe.ToolChoice$inboundSchema,eMe.ToolChoiceEnum$inboundSchema]);Kr.AgentsCompletionStreamRequestToolChoice$outboundSchema=wt.union([QPe.ToolChoice$outboundSchema,eMe.ToolChoiceEnum$outboundSchema]);var u0r;(function(t){t.inboundSchema=Kr.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Kr.AgentsCompletionStreamRequestToolChoice$outboundSchema})(u0r||(Kr.AgentsCompletionStreamRequestToolChoice$=u0r={}));function avo(t){return JSON.stringify(Kr.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function svo(t){return(0,XPe.safeParse)(t,e=>Kr.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}Kr.AgentsCompletionStreamRequest$inboundSchema=wt.object({max_tokens:wt.nullable(wt.number().int()).optional(),stream:wt.boolean().default(!0),stop:wt.union([wt.string(),wt.array(wt.string())]).optional(),random_seed:wt.nullable(wt.number().int()).optional(),messages:wt.array(wt.union([YPe.SystemMessage$inboundSchema.and(wt.object({role:wt.literal("system")}).transform(t=>({role:t.role}))),tMe.ToolMessage$inboundSchema.and(wt.object({role:wt.literal("tool")}).transform(t=>({role:t.role}))),rMe.UserMessage$inboundSchema.and(wt.object({role:wt.literal("user")}).transform(t=>({role:t.role}))),ZPe.AssistantMessage$inboundSchema.and(wt.object({role:wt.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:p0r.ResponseFormat$inboundSchema.optional(),tools:wt.nullable(wt.array(m0r.Tool$inboundSchema)).optional(),tool_choice:wt.union([QPe.ToolChoice$inboundSchema,eMe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:wt.number().optional(),frequency_penalty:wt.number().optional(),n:wt.nullable(wt.number().int()).optional(),prediction:f0r.Prediction$inboundSchema.optional(),parallel_tool_calls:wt.boolean().optional(),prompt_mode:wt.nullable(d0r.MistralPromptMode$inboundSchema).optional(),agent_id:wt.string()}).transform(t=>(0,c0r.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"}));Kr.AgentsCompletionStreamRequest$outboundSchema=wt.object({maxTokens:wt.nullable(wt.number().int()).optional(),stream:wt.boolean().default(!0),stop:wt.union([wt.string(),wt.array(wt.string())]).optional(),randomSeed:wt.nullable(wt.number().int()).optional(),messages:wt.array(wt.union([YPe.SystemMessage$outboundSchema.and(wt.object({role:wt.literal("system")}).transform(t=>({role:t.role}))),tMe.ToolMessage$outboundSchema.and(wt.object({role:wt.literal("tool")}).transform(t=>({role:t.role}))),rMe.UserMessage$outboundSchema.and(wt.object({role:wt.literal("user")}).transform(t=>({role:t.role}))),ZPe.AssistantMessage$outboundSchema.and(wt.object({role:wt.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:p0r.ResponseFormat$outboundSchema.optional(),tools:wt.nullable(wt.array(m0r.Tool$outboundSchema)).optional(),toolChoice:wt.union([QPe.ToolChoice$outboundSchema,eMe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:wt.number().optional(),frequencyPenalty:wt.number().optional(),n:wt.nullable(wt.number().int()).optional(),prediction:f0r.Prediction$outboundSchema.optional(),parallelToolCalls:wt.boolean().optional(),promptMode:wt.nullable(d0r.MistralPromptMode$outboundSchema).optional(),agentId:wt.string()}).transform(t=>(0,c0r.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 l0r;(function(t){t.inboundSchema=Kr.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=Kr.AgentsCompletionStreamRequest$outboundSchema})(l0r||(Kr.AgentsCompletionStreamRequest$=l0r={}));function uvo(t){return JSON.stringify(Kr.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function lvo(t){return(0,XPe.safeParse)(t,e=>Kr.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var w0r=S(fs=>{"use strict";var cvo=fs&&fs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dvo=fs&&fs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fvo=fs&&fs.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cvo(r,e,n[o]);return dvo(r,e),r}}();Object.defineProperty(fs,"__esModule",{value:!0});fs.AgentUpdateRequest$=fs.AgentUpdateRequest$outboundSchema=fs.AgentUpdateRequest$inboundSchema=fs.AgentUpdateRequestTools$=fs.AgentUpdateRequestTools$outboundSchema=fs.AgentUpdateRequestTools$inboundSchema=void 0;fs.agentUpdateRequestToolsToJSON=pvo;fs.agentUpdateRequestToolsFromJSON=mvo;fs.agentUpdateRequestToJSON=hvo;fs.agentUpdateRequestFromJSON=gvo;var Bt=fvo(Q()),b0r=le(),_0r=Z(),nMe=zk(),v0r=JS(),oMe=Jk(),iMe=Wk(),aMe=Kk(),sMe=Gk(),uMe=Xk();fs.AgentUpdateRequestTools$inboundSchema=Bt.union([oMe.DocumentLibraryTool$inboundSchema.and(Bt.object({type:Bt.literal("document_library")}).transform(t=>({type:t.type}))),iMe.FunctionTool$inboundSchema.and(Bt.object({type:Bt.literal("function")}).transform(t=>({type:t.type}))),nMe.CodeInterpreterTool$inboundSchema.and(Bt.object({type:Bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),aMe.ImageGenerationTool$inboundSchema.and(Bt.object({type:Bt.literal("image_generation")}).transform(t=>({type:t.type}))),uMe.WebSearchTool$inboundSchema.and(Bt.object({type:Bt.literal("web_search")}).transform(t=>({type:t.type}))),sMe.WebSearchPremiumTool$inboundSchema.and(Bt.object({type:Bt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);fs.AgentUpdateRequestTools$outboundSchema=Bt.union([oMe.DocumentLibraryTool$outboundSchema.and(Bt.object({type:Bt.literal("document_library")}).transform(t=>({type:t.type}))),iMe.FunctionTool$outboundSchema.and(Bt.object({type:Bt.literal("function")}).transform(t=>({type:t.type}))),nMe.CodeInterpreterTool$outboundSchema.and(Bt.object({type:Bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),aMe.ImageGenerationTool$outboundSchema.and(Bt.object({type:Bt.literal("image_generation")}).transform(t=>({type:t.type}))),uMe.WebSearchTool$outboundSchema.and(Bt.object({type:Bt.literal("web_search")}).transform(t=>({type:t.type}))),sMe.WebSearchPremiumTool$outboundSchema.and(Bt.object({type:Bt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var g0r;(function(t){t.inboundSchema=fs.AgentUpdateRequestTools$inboundSchema,t.outboundSchema=fs.AgentUpdateRequestTools$outboundSchema})(g0r||(fs.AgentUpdateRequestTools$=g0r={}));function pvo(t){return JSON.stringify(fs.AgentUpdateRequestTools$outboundSchema.parse(t))}function mvo(t){return(0,_0r.safeParse)(t,e=>fs.AgentUpdateRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentUpdateRequestTools' from JSON")}fs.AgentUpdateRequest$inboundSchema=Bt.object({instructions:Bt.nullable(Bt.string()).optional(),tools:Bt.array(Bt.union([oMe.DocumentLibraryTool$inboundSchema.and(Bt.object({type:Bt.literal("document_library")}).transform(t=>({type:t.type}))),iMe.FunctionTool$inboundSchema.and(Bt.object({type:Bt.literal("function")}).transform(t=>({type:t.type}))),nMe.CodeInterpreterTool$inboundSchema.and(Bt.object({type:Bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),aMe.ImageGenerationTool$inboundSchema.and(Bt.object({type:Bt.literal("image_generation")}).transform(t=>({type:t.type}))),uMe.WebSearchTool$inboundSchema.and(Bt.object({type:Bt.literal("web_search")}).transform(t=>({type:t.type}))),sMe.WebSearchPremiumTool$inboundSchema.and(Bt.object({type:Bt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:v0r.CompletionArgs$inboundSchema.optional(),model:Bt.nullable(Bt.string()).optional(),name:Bt.nullable(Bt.string()).optional(),description:Bt.nullable(Bt.string()).optional(),handoffs:Bt.nullable(Bt.array(Bt.string())).optional()}).transform(t=>(0,b0r.remap)(t,{completion_args:"completionArgs"}));fs.AgentUpdateRequest$outboundSchema=Bt.object({instructions:Bt.nullable(Bt.string()).optional(),tools:Bt.array(Bt.union([oMe.DocumentLibraryTool$outboundSchema.and(Bt.object({type:Bt.literal("document_library")}).transform(t=>({type:t.type}))),iMe.FunctionTool$outboundSchema.and(Bt.object({type:Bt.literal("function")}).transform(t=>({type:t.type}))),nMe.CodeInterpreterTool$outboundSchema.and(Bt.object({type:Bt.literal("code_interpreter")}).transform(t=>({type:t.type}))),aMe.ImageGenerationTool$outboundSchema.and(Bt.object({type:Bt.literal("image_generation")}).transform(t=>({type:t.type}))),uMe.WebSearchTool$outboundSchema.and(Bt.object({type:Bt.literal("web_search")}).transform(t=>({type:t.type}))),sMe.WebSearchPremiumTool$outboundSchema.and(Bt.object({type:Bt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:v0r.CompletionArgs$outboundSchema.optional(),model:Bt.nullable(Bt.string()).optional(),name:Bt.nullable(Bt.string()).optional(),description:Bt.nullable(Bt.string()).optional(),handoffs:Bt.nullable(Bt.array(Bt.string())).optional()}).transform(t=>(0,b0r.remap)(t,{completionArgs:"completion_args"}));var y0r;(function(t){t.inboundSchema=fs.AgentUpdateRequest$inboundSchema,t.outboundSchema=fs.AgentUpdateRequest$outboundSchema})(y0r||(fs.AgentUpdateRequest$=y0r={}));function hvo(t){return JSON.stringify(fs.AgentUpdateRequest$outboundSchema.parse(t))}function gvo(t){return(0,_0r.safeParse)(t,e=>fs.AgentUpdateRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentUpdateRequest' from JSON")}});var Jst=S(Ud=>{"use strict";var yvo=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]}),bvo=Ud&&Ud.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_vo=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"&&yvo(r,e,n[o]);return bvo(r,e),r}}();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.ApiEndpoint$=Ud.ApiEndpoint$outboundSchema=Ud.ApiEndpoint$inboundSchema=Ud.ApiEndpoint=void 0;var dH=_vo(Q()),vvo=XC();Ud.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"};Ud.ApiEndpoint$inboundSchema=dH.union([dH.nativeEnum(Ud.ApiEndpoint),dH.string().transform(vvo.catchUnrecognizedEnum)]);Ud.ApiEndpoint$outboundSchema=dH.union([dH.nativeEnum(Ud.ApiEndpoint),dH.string().and(dH.custom())]);var S0r;(function(t){t.inboundSchema=Ud.ApiEndpoint$inboundSchema,t.outboundSchema=Ud.ApiEndpoint$outboundSchema})(S0r||(Ud.ApiEndpoint$=S0r={}))});var O0r=S(ha=>{"use strict";var wvo=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]}),Svo=ha&&ha.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cvo=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"&&wvo(r,e,n[o]);return Svo(r,e),r}}();Object.defineProperty(ha,"__esModule",{value:!0});ha.ArchiveFTModelOut$=ha.ArchiveFTModelOut$outboundSchema=ha.ArchiveFTModelOut$inboundSchema=ha.ArchiveFTModelOutObject$=ha.ArchiveFTModelOutObject$outboundSchema=ha.ArchiveFTModelOutObject$inboundSchema=ha.ArchiveFTModelOutObject=void 0;ha.archiveFTModelOutToJSON=Ovo;ha.archiveFTModelOutFromJSON=Tvo;var fH=Cvo(Q()),xvo=Z();ha.ArchiveFTModelOutObject={Model:"model"};ha.ArchiveFTModelOutObject$inboundSchema=fH.nativeEnum(ha.ArchiveFTModelOutObject);ha.ArchiveFTModelOutObject$outboundSchema=ha.ArchiveFTModelOutObject$inboundSchema;var C0r;(function(t){t.inboundSchema=ha.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=ha.ArchiveFTModelOutObject$outboundSchema})(C0r||(ha.ArchiveFTModelOutObject$=C0r={}));ha.ArchiveFTModelOut$inboundSchema=fH.object({id:fH.string(),object:ha.ArchiveFTModelOutObject$inboundSchema.default("model"),archived:fH.boolean().default(!0)});ha.ArchiveFTModelOut$outboundSchema=fH.object({id:fH.string(),object:ha.ArchiveFTModelOutObject$outboundSchema.default("model"),archived:fH.boolean().default(!0)});var x0r;(function(t){t.inboundSchema=ha.ArchiveFTModelOut$inboundSchema,t.outboundSchema=ha.ArchiveFTModelOut$outboundSchema})(x0r||(ha.ArchiveFTModelOut$=x0r={}));function Ovo(t){return JSON.stringify(ha.ArchiveFTModelOut$outboundSchema.parse(t))}function Tvo(t){return(0,xvo.safeParse)(t,e=>ha.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var rj=S(ZC=>{"use strict";var Evo=ZC&&ZC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pvo=ZC&&ZC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mvo=ZC&&ZC.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(ZC,"__esModule",{value:!0});ZC.blobLikeSchema=void 0;ZC.isBlobLike=T0r;var Ivo=Mvo(Q());ZC.blobLikeSchema=Ivo.custom(T0r,{message:"expected a Blob, File or Blob-like object",fatal:!0});function T0r(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 lMe=S(Bd=>{"use strict";var Rvo=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]}),Avo=Bd&&Bd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nvo=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"&&Rvo(r,e,n[o]);return Avo(r,e),r}}();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.FileT$=Bd.FileT$outboundSchema=Bd.FileT$inboundSchema=void 0;Bd.fileToJSON=Dvo;Bd.fileFromJSON=$vo;var A_=Nvo(Q()),jvo=Z();Bd.FileT$inboundSchema=A_.object({fileName:A_.string(),content:A_.union([A_.instanceof(ReadableStream),A_.instanceof(Blob),A_.instanceof(ArrayBuffer),A_.instanceof(Uint8Array)])});Bd.FileT$outboundSchema=A_.object({fileName:A_.string(),content:A_.union([A_.instanceof(ReadableStream),A_.instanceof(Blob),A_.instanceof(ArrayBuffer),A_.instanceof(Uint8Array)])});var E0r;(function(t){t.inboundSchema=Bd.FileT$inboundSchema,t.outboundSchema=Bd.FileT$outboundSchema})(E0r||(Bd.FileT$=E0r={}));function Dvo(t){return JSON.stringify(Bd.FileT$outboundSchema.parse(t))}function $vo(t){return(0,jvo.safeParse)(t,e=>Bd.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}});var cMe=S(zd=>{"use strict";var Lvo=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]}),Fvo=zd&&zd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kvo=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"&&Lvo(r,e,n[o]);return Fvo(r,e),r}}();Object.defineProperty(zd,"__esModule",{value:!0});zd.TimestampGranularity$=zd.TimestampGranularity$outboundSchema=zd.TimestampGranularity$inboundSchema=zd.TimestampGranularity=void 0;var qvo=kvo(Q());zd.TimestampGranularity={Segment:"segment"};zd.TimestampGranularity$inboundSchema=qvo.nativeEnum(zd.TimestampGranularity);zd.TimestampGranularity$outboundSchema=zd.TimestampGranularity$inboundSchema;var P0r;(function(t){t.inboundSchema=zd.TimestampGranularity$inboundSchema,t.outboundSchema=zd.TimestampGranularity$outboundSchema})(P0r||(zd.TimestampGranularity$=P0r={}))});var N0r=S(Vd=>{"use strict";var Uvo=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]}),Bvo=Vd&&Vd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zvo=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"&&Uvo(r,e,n[o]);return Bvo(r,e),r}}();Object.defineProperty(Vd,"__esModule",{value:!0});Vd.AudioTranscriptionRequest$=Vd.AudioTranscriptionRequest$outboundSchema=Vd.AudioTranscriptionRequest$inboundSchema=void 0;Vd.audioTranscriptionRequestToJSON=Jvo;Vd.audioTranscriptionRequestFromJSON=Wvo;var Vl=zvo(Q()),I0r=le(),Vvo=Z(),Hvo=rj(),R0r=lMe(),A0r=cMe();Vd.AudioTranscriptionRequest$inboundSchema=Vl.object({model:Vl.string(),file:R0r.FileT$inboundSchema.optional(),file_url:Vl.nullable(Vl.string()).optional(),file_id:Vl.nullable(Vl.string()).optional(),language:Vl.nullable(Vl.string()).optional(),temperature:Vl.nullable(Vl.number()).optional(),stream:Vl.literal(!1).default(!1),timestamp_granularities:Vl.array(A0r.TimestampGranularity$inboundSchema).optional()}).transform(t=>(0,I0r.remap)(t,{file_url:"fileUrl",file_id:"fileId",timestamp_granularities:"timestampGranularities"}));Vd.AudioTranscriptionRequest$outboundSchema=Vl.object({model:Vl.string(),file:R0r.FileT$outboundSchema.or(Hvo.blobLikeSchema).optional(),fileUrl:Vl.nullable(Vl.string()).optional(),fileId:Vl.nullable(Vl.string()).optional(),language:Vl.nullable(Vl.string()).optional(),temperature:Vl.nullable(Vl.number()).optional(),stream:Vl.literal(!1).default(!1),timestampGranularities:Vl.array(A0r.TimestampGranularity$outboundSchema).optional()}).transform(t=>(0,I0r.remap)(t,{fileUrl:"file_url",fileId:"file_id",timestampGranularities:"timestamp_granularities"}));var M0r;(function(t){t.inboundSchema=Vd.AudioTranscriptionRequest$inboundSchema,t.outboundSchema=Vd.AudioTranscriptionRequest$outboundSchema})(M0r||(Vd.AudioTranscriptionRequest$=M0r={}));function Jvo(t){return JSON.stringify(Vd.AudioTranscriptionRequest$outboundSchema.parse(t))}function Wvo(t){return(0,Vvo.safeParse)(t,e=>Vd.AudioTranscriptionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioTranscriptionRequest' from JSON")}});var F0r=S(Hd=>{"use strict";var Kvo=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]}),Gvo=Hd&&Hd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xvo=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"&&Kvo(r,e,n[o]);return Gvo(r,e),r}}();Object.defineProperty(Hd,"__esModule",{value:!0});Hd.AudioTranscriptionRequestStream$=Hd.AudioTranscriptionRequestStream$outboundSchema=Hd.AudioTranscriptionRequestStream$inboundSchema=void 0;Hd.audioTranscriptionRequestStreamToJSON=Qvo;Hd.audioTranscriptionRequestStreamFromJSON=ewo;var Hl=Xvo(Q()),D0r=le(),Zvo=Z(),Yvo=rj(),$0r=lMe(),L0r=cMe();Hd.AudioTranscriptionRequestStream$inboundSchema=Hl.object({model:Hl.string(),file:$0r.FileT$inboundSchema.optional(),file_url:Hl.nullable(Hl.string()).optional(),file_id:Hl.nullable(Hl.string()).optional(),language:Hl.nullable(Hl.string()).optional(),temperature:Hl.nullable(Hl.number()).optional(),stream:Hl.literal(!0).default(!0),timestamp_granularities:Hl.array(L0r.TimestampGranularity$inboundSchema).optional()}).transform(t=>(0,D0r.remap)(t,{file_url:"fileUrl",file_id:"fileId",timestamp_granularities:"timestampGranularities"}));Hd.AudioTranscriptionRequestStream$outboundSchema=Hl.object({model:Hl.string(),file:$0r.FileT$outboundSchema.or(Yvo.blobLikeSchema).optional(),fileUrl:Hl.nullable(Hl.string()).optional(),fileId:Hl.nullable(Hl.string()).optional(),language:Hl.nullable(Hl.string()).optional(),temperature:Hl.nullable(Hl.number()).optional(),stream:Hl.literal(!0).default(!0),timestampGranularities:Hl.array(L0r.TimestampGranularity$outboundSchema).optional()}).transform(t=>(0,D0r.remap)(t,{fileUrl:"file_url",fileId:"file_id",timestampGranularities:"timestamp_granularities"}));var j0r;(function(t){t.inboundSchema=Hd.AudioTranscriptionRequestStream$inboundSchema,t.outboundSchema=Hd.AudioTranscriptionRequestStream$outboundSchema})(j0r||(Hd.AudioTranscriptionRequestStream$=j0r={}));function Qvo(t){return JSON.stringify(Hd.AudioTranscriptionRequestStream$outboundSchema.parse(t))}function ewo(t){return(0,Zvo.safeParse)(t,e=>Hd.AudioTranscriptionRequestStream$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioTranscriptionRequestStream' from JSON")}});var dMe=S(Jd=>{"use strict";var two=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]}),rwo=Jd&&Jd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nwo=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"&&two(r,e,n[o]);return rwo(r,e),r}}();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.ModelCapabilities$=Jd.ModelCapabilities$outboundSchema=Jd.ModelCapabilities$inboundSchema=void 0;Jd.modelCapabilitiesToJSON=iwo;Jd.modelCapabilitiesFromJSON=awo;var N_=nwo(Q()),q0r=le(),owo=Z();Jd.ModelCapabilities$inboundSchema=N_.object({completion_chat:N_.boolean().default(!0),completion_fim:N_.boolean().default(!1),function_calling:N_.boolean().default(!0),fine_tuning:N_.boolean().default(!1),vision:N_.boolean().default(!1),classification:N_.boolean().default(!1)}).transform(t=>(0,q0r.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));Jd.ModelCapabilities$outboundSchema=N_.object({completionChat:N_.boolean().default(!0),completionFim:N_.boolean().default(!1),functionCalling:N_.boolean().default(!0),fineTuning:N_.boolean().default(!1),vision:N_.boolean().default(!1),classification:N_.boolean().default(!1)}).transform(t=>(0,q0r.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var k0r;(function(t){t.inboundSchema=Jd.ModelCapabilities$inboundSchema,t.outboundSchema=Jd.ModelCapabilities$outboundSchema})(k0r||(Jd.ModelCapabilities$=k0r={}));function iwo(t){return JSON.stringify(Jd.ModelCapabilities$outboundSchema.parse(t))}function awo(t){return(0,owo.safeParse)(t,e=>Jd.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var Wst=S(ps=>{"use strict";var swo=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]}),uwo=ps&&ps.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lwo=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"&&swo(r,e,n[o]);return uwo(r,e),r}}();Object.defineProperty(ps,"__esModule",{value:!0});ps.BaseModelCard$=ps.BaseModelCard$outboundSchema=ps.BaseModelCard$inboundSchema=ps.BaseModelCardType$=ps.BaseModelCardType$outboundSchema=ps.BaseModelCardType$inboundSchema=ps.BaseModelCardType=void 0;ps.baseModelCardToJSON=dwo;ps.baseModelCardFromJSON=fwo;var _i=lwo(Q()),z0r=le(),cwo=Z(),V0r=dMe();ps.BaseModelCardType={Base:"base"};ps.BaseModelCardType$inboundSchema=_i.nativeEnum(ps.BaseModelCardType);ps.BaseModelCardType$outboundSchema=ps.BaseModelCardType$inboundSchema;var U0r;(function(t){t.inboundSchema=ps.BaseModelCardType$inboundSchema,t.outboundSchema=ps.BaseModelCardType$outboundSchema})(U0r||(ps.BaseModelCardType$=U0r={}));ps.BaseModelCard$inboundSchema=_i.object({id:_i.string(),object:_i.string().default("model"),created:_i.number().int().optional(),owned_by:_i.string().default("mistralai"),capabilities:V0r.ModelCapabilities$inboundSchema,name:_i.nullable(_i.string()).optional(),description:_i.nullable(_i.string()).optional(),max_context_length:_i.number().int().default(32768),aliases:_i.array(_i.string()).optional(),deprecation:_i.nullable(_i.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),deprecation_replacement_model:_i.nullable(_i.string()).optional(),default_model_temperature:_i.nullable(_i.number()).optional(),type:_i.literal("base").default("base")}).transform(t=>(0,z0r.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",deprecation_replacement_model:"deprecationReplacementModel",default_model_temperature:"defaultModelTemperature"}));ps.BaseModelCard$outboundSchema=_i.object({id:_i.string(),object:_i.string().default("model"),created:_i.number().int().optional(),ownedBy:_i.string().default("mistralai"),capabilities:V0r.ModelCapabilities$outboundSchema,name:_i.nullable(_i.string()).optional(),description:_i.nullable(_i.string()).optional(),maxContextLength:_i.number().int().default(32768),aliases:_i.array(_i.string()).optional(),deprecation:_i.nullable(_i.date().transform(t=>t.toISOString())).optional(),deprecationReplacementModel:_i.nullable(_i.string()).optional(),defaultModelTemperature:_i.nullable(_i.number()).optional(),type:_i.literal("base").default("base")}).transform(t=>(0,z0r.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",deprecationReplacementModel:"deprecation_replacement_model",defaultModelTemperature:"default_model_temperature"}));var B0r;(function(t){t.inboundSchema=ps.BaseModelCard$inboundSchema,t.outboundSchema=ps.BaseModelCard$outboundSchema})(B0r||(ps.BaseModelCard$=B0r={}));function dwo(t){return JSON.stringify(ps.BaseModelCard$outboundSchema.parse(t))}function fwo(t){return(0,cwo.safeParse)(t,e=>ps.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var Kst=S(Wd=>{"use strict";var pwo=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]}),mwo=Wd&&Wd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hwo=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"&&pwo(r,e,n[o]);return mwo(r,e),r}}();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.BatchError$=Wd.BatchError$outboundSchema=Wd.BatchError$inboundSchema=void 0;Wd.batchErrorToJSON=ywo;Wd.batchErrorFromJSON=bwo;var f9=hwo(Q()),gwo=Z();Wd.BatchError$inboundSchema=f9.object({message:f9.string(),count:f9.number().int().default(1)});Wd.BatchError$outboundSchema=f9.object({message:f9.string(),count:f9.number().int().default(1)});var H0r;(function(t){t.inboundSchema=Wd.BatchError$inboundSchema,t.outboundSchema=Wd.BatchError$outboundSchema})(H0r||(Wd.BatchError$=H0r={}));function ywo(t){return JSON.stringify(Wd.BatchError$outboundSchema.parse(t))}function bwo(t){return(0,gwo.safeParse)(t,e=>Wd.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var G0r=S(Kd=>{"use strict";var _wo=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]}),vwo=Kd&&Kd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wwo=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"&&_wo(r,e,n[o]);return vwo(r,e),r}}();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.BatchJobIn$=Kd.BatchJobIn$outboundSchema=Kd.BatchJobIn$inboundSchema=void 0;Kd.batchJobInToJSON=Cwo;Kd.batchJobInFromJSON=xwo;var Ac=wwo(Q()),W0r=le(),Swo=Z(),K0r=Jst();Kd.BatchJobIn$inboundSchema=Ac.object({input_files:Ac.array(Ac.string()),endpoint:K0r.ApiEndpoint$inboundSchema,model:Ac.nullable(Ac.string()).optional(),agent_id:Ac.nullable(Ac.string()).optional(),metadata:Ac.nullable(Ac.record(Ac.string())).optional(),timeout_hours:Ac.number().int().default(24)}).transform(t=>(0,W0r.remap)(t,{input_files:"inputFiles",agent_id:"agentId",timeout_hours:"timeoutHours"}));Kd.BatchJobIn$outboundSchema=Ac.object({inputFiles:Ac.array(Ac.string()),endpoint:K0r.ApiEndpoint$outboundSchema,model:Ac.nullable(Ac.string()).optional(),agentId:Ac.nullable(Ac.string()).optional(),metadata:Ac.nullable(Ac.record(Ac.string())).optional(),timeoutHours:Ac.number().int().default(24)}).transform(t=>(0,W0r.remap)(t,{inputFiles:"input_files",agentId:"agent_id",timeoutHours:"timeout_hours"}));var J0r;(function(t){t.inboundSchema=Kd.BatchJobIn$inboundSchema,t.outboundSchema=Kd.BatchJobIn$outboundSchema})(J0r||(Kd.BatchJobIn$=J0r={}));function Cwo(t){return JSON.stringify(Kd.BatchJobIn$outboundSchema.parse(t))}function xwo(t){return(0,Swo.safeParse)(t,e=>Kd.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var Gst=S(Gd=>{"use strict";var Owo=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]}),Two=Gd&&Gd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ewo=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"&&Owo(r,e,n[o]);return Two(r,e),r}}();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.BatchJobStatus$=Gd.BatchJobStatus$outboundSchema=Gd.BatchJobStatus$inboundSchema=Gd.BatchJobStatus=void 0;var Pwo=Ewo(Q());Gd.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};Gd.BatchJobStatus$inboundSchema=Pwo.nativeEnum(Gd.BatchJobStatus);Gd.BatchJobStatus$outboundSchema=Gd.BatchJobStatus$inboundSchema;var X0r;(function(t){t.inboundSchema=Gd.BatchJobStatus$inboundSchema,t.outboundSchema=Gd.BatchJobStatus$outboundSchema})(X0r||(Gd.BatchJobStatus$=X0r={}))});var Xst=S(ga=>{"use strict";var Mwo=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]}),Iwo=ga&&ga.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rwo=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"&&Mwo(r,e,n[o]);return Iwo(r,e),r}}();Object.defineProperty(ga,"__esModule",{value:!0});ga.BatchJobOut$=ga.BatchJobOut$outboundSchema=ga.BatchJobOut$inboundSchema=ga.BatchJobOutObject$=ga.BatchJobOutObject$outboundSchema=ga.BatchJobOutObject$inboundSchema=ga.BatchJobOutObject=void 0;ga.batchJobOutToJSON=Nwo;ga.batchJobOutFromJSON=jwo;var cn=Rwo(Q()),Q0r=le(),Awo=Z(),eCr=Kst(),tCr=Gst();ga.BatchJobOutObject={Batch:"batch"};ga.BatchJobOutObject$inboundSchema=cn.nativeEnum(ga.BatchJobOutObject);ga.BatchJobOutObject$outboundSchema=ga.BatchJobOutObject$inboundSchema;var Z0r;(function(t){t.inboundSchema=ga.BatchJobOutObject$inboundSchema,t.outboundSchema=ga.BatchJobOutObject$outboundSchema})(Z0r||(ga.BatchJobOutObject$=Z0r={}));ga.BatchJobOut$inboundSchema=cn.object({id:cn.string(),object:ga.BatchJobOutObject$inboundSchema.default("batch"),input_files:cn.array(cn.string()),metadata:cn.nullable(cn.record(cn.any())).optional(),endpoint:cn.string(),model:cn.nullable(cn.string()).optional(),agent_id:cn.nullable(cn.string()).optional(),output_file:cn.nullable(cn.string()).optional(),error_file:cn.nullable(cn.string()).optional(),errors:cn.array(eCr.BatchError$inboundSchema),status:tCr.BatchJobStatus$inboundSchema,created_at:cn.number().int(),total_requests:cn.number().int(),completed_requests:cn.number().int(),succeeded_requests:cn.number().int(),failed_requests:cn.number().int(),started_at:cn.nullable(cn.number().int()).optional(),completed_at:cn.nullable(cn.number().int()).optional()}).transform(t=>(0,Q0r.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"}));ga.BatchJobOut$outboundSchema=cn.object({id:cn.string(),object:ga.BatchJobOutObject$outboundSchema.default("batch"),inputFiles:cn.array(cn.string()),metadata:cn.nullable(cn.record(cn.any())).optional(),endpoint:cn.string(),model:cn.nullable(cn.string()).optional(),agentId:cn.nullable(cn.string()).optional(),outputFile:cn.nullable(cn.string()).optional(),errorFile:cn.nullable(cn.string()).optional(),errors:cn.array(eCr.BatchError$outboundSchema),status:tCr.BatchJobStatus$outboundSchema,createdAt:cn.number().int(),totalRequests:cn.number().int(),completedRequests:cn.number().int(),succeededRequests:cn.number().int(),failedRequests:cn.number().int(),startedAt:cn.nullable(cn.number().int()).optional(),completedAt:cn.nullable(cn.number().int()).optional()}).transform(t=>(0,Q0r.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 Y0r;(function(t){t.inboundSchema=ga.BatchJobOut$inboundSchema,t.outboundSchema=ga.BatchJobOut$outboundSchema})(Y0r||(ga.BatchJobOut$=Y0r={}));function Nwo(t){return JSON.stringify(ga.BatchJobOut$outboundSchema.parse(t))}function jwo(t){return(0,Awo.safeParse)(t,e=>ga.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var iCr=S(ya=>{"use strict";var Dwo=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]}),$wo=ya&&ya.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lwo=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"&&Dwo(r,e,n[o]);return $wo(r,e),r}}();Object.defineProperty(ya,"__esModule",{value:!0});ya.BatchJobsOut$=ya.BatchJobsOut$outboundSchema=ya.BatchJobsOut$inboundSchema=ya.BatchJobsOutObject$=ya.BatchJobsOutObject$outboundSchema=ya.BatchJobsOutObject$inboundSchema=ya.BatchJobsOutObject=void 0;ya.batchJobsOutToJSON=kwo;ya.batchJobsOutFromJSON=qwo;var pH=Lwo(Q()),Fwo=Z(),oCr=Xst();ya.BatchJobsOutObject={List:"list"};ya.BatchJobsOutObject$inboundSchema=pH.nativeEnum(ya.BatchJobsOutObject);ya.BatchJobsOutObject$outboundSchema=ya.BatchJobsOutObject$inboundSchema;var rCr;(function(t){t.inboundSchema=ya.BatchJobsOutObject$inboundSchema,t.outboundSchema=ya.BatchJobsOutObject$outboundSchema})(rCr||(ya.BatchJobsOutObject$=rCr={}));ya.BatchJobsOut$inboundSchema=pH.object({data:pH.array(oCr.BatchJobOut$inboundSchema).optional(),object:ya.BatchJobsOutObject$inboundSchema.default("list"),total:pH.number().int()});ya.BatchJobsOut$outboundSchema=pH.object({data:pH.array(oCr.BatchJobOut$outboundSchema).optional(),object:ya.BatchJobsOutObject$outboundSchema.default("list"),total:pH.number().int()});var nCr;(function(t){t.inboundSchema=ya.BatchJobsOut$inboundSchema,t.outboundSchema=ya.BatchJobsOut$outboundSchema})(nCr||(ya.BatchJobsOut$=nCr={}));function kwo(t){return JSON.stringify(ya.BatchJobsOut$outboundSchema.parse(t))}function qwo(t){return(0,Fwo.safeParse)(t,e=>ya.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var Qk=S(Xd=>{"use strict";var Uwo=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]}),Bwo=Xd&&Xd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zwo=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"&&Uwo(r,e,n[o]);return Bwo(r,e),r}}();Object.defineProperty(Xd,"__esModule",{value:!0});Xd.BuiltInConnectors$=Xd.BuiltInConnectors$outboundSchema=Xd.BuiltInConnectors$inboundSchema=Xd.BuiltInConnectors=void 0;var Vwo=zwo(Q());Xd.BuiltInConnectors={WebSearch:"web_search",WebSearchPremium:"web_search_premium",CodeInterpreter:"code_interpreter",ImageGeneration:"image_generation",DocumentLibrary:"document_library"};Xd.BuiltInConnectors$inboundSchema=Vwo.nativeEnum(Xd.BuiltInConnectors);Xd.BuiltInConnectors$outboundSchema=Xd.BuiltInConnectors$inboundSchema;var aCr;(function(t){t.inboundSchema=Xd.BuiltInConnectors$inboundSchema,t.outboundSchema=Xd.BuiltInConnectors$outboundSchema})(aCr||(Xd.BuiltInConnectors$=aCr={}))});var Zst=S(ms=>{"use strict";var Hwo=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]}),Jwo=ms&&ms.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wwo=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"&&Hwo(r,e,n[o]);return Jwo(r,e),r}}();Object.defineProperty(ms,"__esModule",{value:!0});ms.InstructRequest$=ms.InstructRequest$outboundSchema=ms.InstructRequest$inboundSchema=ms.InstructRequestMessages$=ms.InstructRequestMessages$outboundSchema=ms.InstructRequestMessages$inboundSchema=void 0;ms.instructRequestMessagesToJSON=Kwo;ms.instructRequestMessagesFromJSON=Gwo;ms.instructRequestToJSON=Xwo;ms.instructRequestFromJSON=Zwo;var di=Wwo(Q()),lCr=Z(),fMe=jR(),pMe=Q1(),mMe=ej(),hMe=tj();ms.InstructRequestMessages$inboundSchema=di.union([pMe.SystemMessage$inboundSchema.and(di.object({role:di.literal("system")}).transform(t=>({role:t.role}))),mMe.ToolMessage$inboundSchema.and(di.object({role:di.literal("tool")}).transform(t=>({role:t.role}))),hMe.UserMessage$inboundSchema.and(di.object({role:di.literal("user")}).transform(t=>({role:t.role}))),fMe.AssistantMessage$inboundSchema.and(di.object({role:di.literal("assistant")}).transform(t=>({role:t.role})))]);ms.InstructRequestMessages$outboundSchema=di.union([pMe.SystemMessage$outboundSchema.and(di.object({role:di.literal("system")}).transform(t=>({role:t.role}))),mMe.ToolMessage$outboundSchema.and(di.object({role:di.literal("tool")}).transform(t=>({role:t.role}))),hMe.UserMessage$outboundSchema.and(di.object({role:di.literal("user")}).transform(t=>({role:t.role}))),fMe.AssistantMessage$outboundSchema.and(di.object({role:di.literal("assistant")}).transform(t=>({role:t.role})))]);var sCr;(function(t){t.inboundSchema=ms.InstructRequestMessages$inboundSchema,t.outboundSchema=ms.InstructRequestMessages$outboundSchema})(sCr||(ms.InstructRequestMessages$=sCr={}));function Kwo(t){return JSON.stringify(ms.InstructRequestMessages$outboundSchema.parse(t))}function Gwo(t){return(0,lCr.safeParse)(t,e=>ms.InstructRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestMessages' from JSON")}ms.InstructRequest$inboundSchema=di.object({messages:di.array(di.union([pMe.SystemMessage$inboundSchema.and(di.object({role:di.literal("system")}).transform(t=>({role:t.role}))),mMe.ToolMessage$inboundSchema.and(di.object({role:di.literal("tool")}).transform(t=>({role:t.role}))),hMe.UserMessage$inboundSchema.and(di.object({role:di.literal("user")}).transform(t=>({role:t.role}))),fMe.AssistantMessage$inboundSchema.and(di.object({role:di.literal("assistant")}).transform(t=>({role:t.role})))]))});ms.InstructRequest$outboundSchema=di.object({messages:di.array(di.union([pMe.SystemMessage$outboundSchema.and(di.object({role:di.literal("system")}).transform(t=>({role:t.role}))),mMe.ToolMessage$outboundSchema.and(di.object({role:di.literal("tool")}).transform(t=>({role:t.role}))),hMe.UserMessage$outboundSchema.and(di.object({role:di.literal("user")}).transform(t=>({role:t.role}))),fMe.AssistantMessage$outboundSchema.and(di.object({role:di.literal("assistant")}).transform(t=>({role:t.role})))]))});var uCr;(function(t){t.inboundSchema=ms.InstructRequest$inboundSchema,t.outboundSchema=ms.InstructRequest$outboundSchema})(uCr||(ms.InstructRequest$=uCr={}));function Xwo(t){return JSON.stringify(ms.InstructRequest$outboundSchema.parse(t))}function Zwo(t){return(0,lCr.safeParse)(t,e=>ms.InstructRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequest' from JSON")}});var Qst=S(ho=>{"use strict";var Ywo=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]}),Qwo=ho&&ho.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eSo=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"&&Ywo(r,e,n[o]);return Qwo(r,e),r}}();Object.defineProperty(ho,"__esModule",{value:!0});ho.Inputs$=ho.Inputs$outboundSchema=ho.Inputs$inboundSchema=ho.InstructRequestInputs$=ho.InstructRequestInputs$outboundSchema=ho.InstructRequestInputs$inboundSchema=ho.InstructRequestInputsMessages$=ho.InstructRequestInputsMessages$outboundSchema=ho.InstructRequestInputsMessages$inboundSchema=void 0;ho.instructRequestInputsMessagesToJSON=tSo;ho.instructRequestInputsMessagesFromJSON=rSo;ho.instructRequestInputsToJSON=nSo;ho.instructRequestInputsFromJSON=oSo;ho.inputsToJSON=iSo;ho.inputsFromJSON=aSo;var mo=eSo(Q()),Yst=Z(),gMe=jR(),pCr=Zst(),yMe=Q1(),bMe=ej(),_Me=tj();ho.InstructRequestInputsMessages$inboundSchema=mo.union([yMe.SystemMessage$inboundSchema.and(mo.object({role:mo.literal("system")}).transform(t=>({role:t.role}))),bMe.ToolMessage$inboundSchema.and(mo.object({role:mo.literal("tool")}).transform(t=>({role:t.role}))),_Me.UserMessage$inboundSchema.and(mo.object({role:mo.literal("user")}).transform(t=>({role:t.role}))),gMe.AssistantMessage$inboundSchema.and(mo.object({role:mo.literal("assistant")}).transform(t=>({role:t.role})))]);ho.InstructRequestInputsMessages$outboundSchema=mo.union([yMe.SystemMessage$outboundSchema.and(mo.object({role:mo.literal("system")}).transform(t=>({role:t.role}))),bMe.ToolMessage$outboundSchema.and(mo.object({role:mo.literal("tool")}).transform(t=>({role:t.role}))),_Me.UserMessage$outboundSchema.and(mo.object({role:mo.literal("user")}).transform(t=>({role:t.role}))),gMe.AssistantMessage$outboundSchema.and(mo.object({role:mo.literal("assistant")}).transform(t=>({role:t.role})))]);var cCr;(function(t){t.inboundSchema=ho.InstructRequestInputsMessages$inboundSchema,t.outboundSchema=ho.InstructRequestInputsMessages$outboundSchema})(cCr||(ho.InstructRequestInputsMessages$=cCr={}));function tSo(t){return JSON.stringify(ho.InstructRequestInputsMessages$outboundSchema.parse(t))}function rSo(t){return(0,Yst.safeParse)(t,e=>ho.InstructRequestInputsMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestInputsMessages' from JSON")}ho.InstructRequestInputs$inboundSchema=mo.object({messages:mo.array(mo.union([yMe.SystemMessage$inboundSchema.and(mo.object({role:mo.literal("system")}).transform(t=>({role:t.role}))),bMe.ToolMessage$inboundSchema.and(mo.object({role:mo.literal("tool")}).transform(t=>({role:t.role}))),_Me.UserMessage$inboundSchema.and(mo.object({role:mo.literal("user")}).transform(t=>({role:t.role}))),gMe.AssistantMessage$inboundSchema.and(mo.object({role:mo.literal("assistant")}).transform(t=>({role:t.role})))]))});ho.InstructRequestInputs$outboundSchema=mo.object({messages:mo.array(mo.union([yMe.SystemMessage$outboundSchema.and(mo.object({role:mo.literal("system")}).transform(t=>({role:t.role}))),bMe.ToolMessage$outboundSchema.and(mo.object({role:mo.literal("tool")}).transform(t=>({role:t.role}))),_Me.UserMessage$outboundSchema.and(mo.object({role:mo.literal("user")}).transform(t=>({role:t.role}))),gMe.AssistantMessage$outboundSchema.and(mo.object({role:mo.literal("assistant")}).transform(t=>({role:t.role})))]))});var dCr;(function(t){t.inboundSchema=ho.InstructRequestInputs$inboundSchema,t.outboundSchema=ho.InstructRequestInputs$outboundSchema})(dCr||(ho.InstructRequestInputs$=dCr={}));function nSo(t){return JSON.stringify(ho.InstructRequestInputs$outboundSchema.parse(t))}function oSo(t){return(0,Yst.safeParse)(t,e=>ho.InstructRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestInputs' from JSON")}ho.Inputs$inboundSchema=mo.union([mo.lazy(()=>ho.InstructRequestInputs$inboundSchema),mo.array(pCr.InstructRequest$inboundSchema)]);ho.Inputs$outboundSchema=mo.union([mo.lazy(()=>ho.InstructRequestInputs$outboundSchema),mo.array(pCr.InstructRequest$outboundSchema)]);var fCr;(function(t){t.inboundSchema=ho.Inputs$inboundSchema,t.outboundSchema=ho.Inputs$outboundSchema})(fCr||(ho.Inputs$=fCr={}));function iSo(t){return JSON.stringify(ho.Inputs$outboundSchema.parse(t))}function aSo(t){return(0,Yst.safeParse)(t,e=>ho.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}});var yCr=S(Zd=>{"use strict";var sSo=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]}),uSo=Zd&&Zd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lSo=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"&&sSo(r,e,n[o]);return uSo(r,e),r}}();Object.defineProperty(Zd,"__esModule",{value:!0});Zd.ChatClassificationRequest$=Zd.ChatClassificationRequest$outboundSchema=Zd.ChatClassificationRequest$inboundSchema=void 0;Zd.chatClassificationRequestToJSON=dSo;Zd.chatClassificationRequestFromJSON=fSo;var vMe=lSo(Q()),hCr=le(),cSo=Z(),gCr=Qst();Zd.ChatClassificationRequest$inboundSchema=vMe.object({model:vMe.string(),input:gCr.Inputs$inboundSchema}).transform(t=>(0,hCr.remap)(t,{input:"inputs"}));Zd.ChatClassificationRequest$outboundSchema=vMe.object({model:vMe.string(),inputs:gCr.Inputs$outboundSchema}).transform(t=>(0,hCr.remap)(t,{inputs:"input"}));var mCr;(function(t){t.inboundSchema=Zd.ChatClassificationRequest$inboundSchema,t.outboundSchema=Zd.ChatClassificationRequest$outboundSchema})(mCr||(Zd.ChatClassificationRequest$=mCr={}));function dSo(t){return JSON.stringify(Zd.ChatClassificationRequest$outboundSchema.parse(t))}function fSo(t){return(0,cSo.safeParse)(t,e=>Zd.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var wMe=S(ba=>{"use strict";var pSo=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]}),mSo=ba&&ba.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hSo=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"&&pSo(r,e,n[o]);return mSo(r,e),r}}();Object.defineProperty(ba,"__esModule",{value:!0});ba.ChatCompletionChoice$=ba.ChatCompletionChoice$outboundSchema=ba.ChatCompletionChoice$inboundSchema=ba.FinishReason$=ba.FinishReason$outboundSchema=ba.FinishReason$inboundSchema=ba.FinishReason=void 0;ba.chatCompletionChoiceToJSON=bSo;ba.chatCompletionChoiceFromJSON=_So;var YC=hSo(Q()),vCr=le(),gSo=Z(),ySo=XC(),wCr=jR();ba.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};ba.FinishReason$inboundSchema=YC.union([YC.nativeEnum(ba.FinishReason),YC.string().transform(ySo.catchUnrecognizedEnum)]);ba.FinishReason$outboundSchema=YC.union([YC.nativeEnum(ba.FinishReason),YC.string().and(YC.custom())]);var bCr;(function(t){t.inboundSchema=ba.FinishReason$inboundSchema,t.outboundSchema=ba.FinishReason$outboundSchema})(bCr||(ba.FinishReason$=bCr={}));ba.ChatCompletionChoice$inboundSchema=YC.object({index:YC.number().int(),message:wCr.AssistantMessage$inboundSchema,finish_reason:ba.FinishReason$inboundSchema}).transform(t=>(0,vCr.remap)(t,{finish_reason:"finishReason"}));ba.ChatCompletionChoice$outboundSchema=YC.object({index:YC.number().int(),message:wCr.AssistantMessage$outboundSchema,finishReason:ba.FinishReason$outboundSchema}).transform(t=>(0,vCr.remap)(t,{finishReason:"finish_reason"}));var _Cr;(function(t){t.inboundSchema=ba.ChatCompletionChoice$inboundSchema,t.outboundSchema=ba.ChatCompletionChoice$outboundSchema})(_Cr||(ba.ChatCompletionChoice$=_Cr={}));function bSo(t){return JSON.stringify(ba.ChatCompletionChoice$outboundSchema.parse(t))}function _So(t){return(0,gSo.safeParse)(t,e=>ba.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var RCr=S(Gr=>{"use strict";var vSo=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]}),wSo=Gr&&Gr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SSo=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"&&vSo(r,e,n[o]);return wSo(r,e),r}}();Object.defineProperty(Gr,"__esModule",{value:!0});Gr.ChatCompletionRequest$=Gr.ChatCompletionRequest$outboundSchema=Gr.ChatCompletionRequest$inboundSchema=Gr.ChatCompletionRequestToolChoice$=Gr.ChatCompletionRequestToolChoice$outboundSchema=Gr.ChatCompletionRequestToolChoice$inboundSchema=Gr.Messages$=Gr.Messages$outboundSchema=Gr.Messages$inboundSchema=Gr.Stop$=Gr.Stop$outboundSchema=Gr.Stop$inboundSchema=void 0;Gr.stopToJSON=CSo;Gr.stopFromJSON=xSo;Gr.messagesToJSON=OSo;Gr.messagesFromJSON=TSo;Gr.chatCompletionRequestToolChoiceToJSON=ESo;Gr.chatCompletionRequestToolChoiceFromJSON=PSo;Gr.chatCompletionRequestToJSON=MSo;Gr.chatCompletionRequestFromJSON=ISo;var it=SSo(Q()),TCr=le(),SMe=Z(),CMe=jR(),ECr=l9(),PCr=rH(),MCr=Hk(),xMe=Q1(),ICr=c9(),OMe=d9(),TMe=nH(),EMe=ej(),PMe=tj();Gr.Stop$inboundSchema=it.union([it.string(),it.array(it.string())]);Gr.Stop$outboundSchema=it.union([it.string(),it.array(it.string())]);var SCr;(function(t){t.inboundSchema=Gr.Stop$inboundSchema,t.outboundSchema=Gr.Stop$outboundSchema})(SCr||(Gr.Stop$=SCr={}));function CSo(t){return JSON.stringify(Gr.Stop$outboundSchema.parse(t))}function xSo(t){return(0,SMe.safeParse)(t,e=>Gr.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}Gr.Messages$inboundSchema=it.union([xMe.SystemMessage$inboundSchema.and(it.object({role:it.literal("system")}).transform(t=>({role:t.role}))),EMe.ToolMessage$inboundSchema.and(it.object({role:it.literal("tool")}).transform(t=>({role:t.role}))),PMe.UserMessage$inboundSchema.and(it.object({role:it.literal("user")}).transform(t=>({role:t.role}))),CMe.AssistantMessage$inboundSchema.and(it.object({role:it.literal("assistant")}).transform(t=>({role:t.role})))]);Gr.Messages$outboundSchema=it.union([xMe.SystemMessage$outboundSchema.and(it.object({role:it.literal("system")}).transform(t=>({role:t.role}))),EMe.ToolMessage$outboundSchema.and(it.object({role:it.literal("tool")}).transform(t=>({role:t.role}))),PMe.UserMessage$outboundSchema.and(it.object({role:it.literal("user")}).transform(t=>({role:t.role}))),CMe.AssistantMessage$outboundSchema.and(it.object({role:it.literal("assistant")}).transform(t=>({role:t.role})))]);var CCr;(function(t){t.inboundSchema=Gr.Messages$inboundSchema,t.outboundSchema=Gr.Messages$outboundSchema})(CCr||(Gr.Messages$=CCr={}));function OSo(t){return JSON.stringify(Gr.Messages$outboundSchema.parse(t))}function TSo(t){return(0,SMe.safeParse)(t,e=>Gr.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}Gr.ChatCompletionRequestToolChoice$inboundSchema=it.union([OMe.ToolChoice$inboundSchema,TMe.ToolChoiceEnum$inboundSchema]);Gr.ChatCompletionRequestToolChoice$outboundSchema=it.union([OMe.ToolChoice$outboundSchema,TMe.ToolChoiceEnum$outboundSchema]);var xCr;(function(t){t.inboundSchema=Gr.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Gr.ChatCompletionRequestToolChoice$outboundSchema})(xCr||(Gr.ChatCompletionRequestToolChoice$=xCr={}));function ESo(t){return JSON.stringify(Gr.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function PSo(t){return(0,SMe.safeParse)(t,e=>Gr.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}Gr.ChatCompletionRequest$inboundSchema=it.object({model:it.string(),temperature:it.nullable(it.number()).optional(),top_p:it.number().optional(),max_tokens:it.nullable(it.number().int()).optional(),stream:it.boolean().default(!1),stop:it.union([it.string(),it.array(it.string())]).optional(),random_seed:it.nullable(it.number().int()).optional(),messages:it.array(it.union([xMe.SystemMessage$inboundSchema.and(it.object({role:it.literal("system")}).transform(t=>({role:t.role}))),EMe.ToolMessage$inboundSchema.and(it.object({role:it.literal("tool")}).transform(t=>({role:t.role}))),PMe.UserMessage$inboundSchema.and(it.object({role:it.literal("user")}).transform(t=>({role:t.role}))),CMe.AssistantMessage$inboundSchema.and(it.object({role:it.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:MCr.ResponseFormat$inboundSchema.optional(),tools:it.nullable(it.array(ICr.Tool$inboundSchema)).optional(),tool_choice:it.union([OMe.ToolChoice$inboundSchema,TMe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:it.number().optional(),frequency_penalty:it.number().optional(),n:it.nullable(it.number().int()).optional(),prediction:PCr.Prediction$inboundSchema.optional(),parallel_tool_calls:it.boolean().optional(),prompt_mode:it.nullable(ECr.MistralPromptMode$inboundSchema).optional(),safe_prompt:it.boolean().optional()}).transform(t=>(0,TCr.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"}));Gr.ChatCompletionRequest$outboundSchema=it.object({model:it.string(),temperature:it.nullable(it.number()).optional(),topP:it.number().optional(),maxTokens:it.nullable(it.number().int()).optional(),stream:it.boolean().default(!1),stop:it.union([it.string(),it.array(it.string())]).optional(),randomSeed:it.nullable(it.number().int()).optional(),messages:it.array(it.union([xMe.SystemMessage$outboundSchema.and(it.object({role:it.literal("system")}).transform(t=>({role:t.role}))),EMe.ToolMessage$outboundSchema.and(it.object({role:it.literal("tool")}).transform(t=>({role:t.role}))),PMe.UserMessage$outboundSchema.and(it.object({role:it.literal("user")}).transform(t=>({role:t.role}))),CMe.AssistantMessage$outboundSchema.and(it.object({role:it.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:MCr.ResponseFormat$outboundSchema.optional(),tools:it.nullable(it.array(ICr.Tool$outboundSchema)).optional(),toolChoice:it.union([OMe.ToolChoice$outboundSchema,TMe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:it.number().optional(),frequencyPenalty:it.number().optional(),n:it.nullable(it.number().int()).optional(),prediction:PCr.Prediction$outboundSchema.optional(),parallelToolCalls:it.boolean().optional(),promptMode:it.nullable(ECr.MistralPromptMode$outboundSchema).optional(),safePrompt:it.boolean().optional()}).transform(t=>(0,TCr.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 OCr;(function(t){t.inboundSchema=Gr.ChatCompletionRequest$inboundSchema,t.outboundSchema=Gr.ChatCompletionRequest$outboundSchema})(OCr||(Gr.ChatCompletionRequest$=OCr={}));function MSo(t){return JSON.stringify(Gr.ChatCompletionRequest$outboundSchema.parse(t))}function ISo(t){return(0,SMe.safeParse)(t,e=>Gr.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var eq=S(Yd=>{"use strict";var RSo=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]}),ASo=Yd&&Yd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NSo=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"&&RSo(r,e,n[o]);return ASo(r,e),r}}();Object.defineProperty(Yd,"__esModule",{value:!0});Yd.UsageInfo$=Yd.UsageInfo$outboundSchema=Yd.UsageInfo$inboundSchema=void 0;Yd.usageInfoToJSON=jSo;Yd.usageInfoFromJSON=DSo;var Sb=NSo(Q()),NCr=le(),jCr=Z();Yd.UsageInfo$inboundSchema=(0,jCr.collectExtraKeys)(Sb.object({prompt_tokens:Sb.number().int().default(0),completion_tokens:Sb.number().int().default(0),total_tokens:Sb.number().int().default(0),prompt_audio_seconds:Sb.nullable(Sb.number().int()).optional()}).catchall(Sb.any()),"additionalProperties",!0).transform(t=>(0,NCr.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",prompt_audio_seconds:"promptAudioSeconds"}));Yd.UsageInfo$outboundSchema=Sb.object({promptTokens:Sb.number().int().default(0),completionTokens:Sb.number().int().default(0),totalTokens:Sb.number().int().default(0),promptAudioSeconds:Sb.nullable(Sb.number().int()).optional(),additionalProperties:Sb.record(Sb.any())}).transform(t=>({...t.additionalProperties,...(0,NCr.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",promptAudioSeconds:"prompt_audio_seconds",additionalProperties:null})}));var ACr;(function(t){t.inboundSchema=Yd.UsageInfo$inboundSchema,t.outboundSchema=Yd.UsageInfo$outboundSchema})(ACr||(Yd.UsageInfo$=ACr={}));function jSo(t){return JSON.stringify(Yd.UsageInfo$outboundSchema.parse(t))}function DSo(t){return(0,jCr.safeParse)(t,e=>Yd.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var FCr=S(Qd=>{"use strict";var $So=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]}),LSo=Qd&&Qd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FSo=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"&&$So(r,e,n[o]);return LSo(r,e),r}}();Object.defineProperty(Qd,"__esModule",{value:!0});Qd.ChatCompletionResponse$=Qd.ChatCompletionResponse$outboundSchema=Qd.ChatCompletionResponse$inboundSchema=void 0;Qd.chatCompletionResponseToJSON=qSo;Qd.chatCompletionResponseFromJSON=USo;var KS=FSo(Q()),kSo=Z(),$Cr=wMe(),LCr=eq();Qd.ChatCompletionResponse$inboundSchema=KS.object({id:KS.string(),object:KS.string(),model:KS.string(),usage:LCr.UsageInfo$inboundSchema,created:KS.number().int(),choices:KS.array($Cr.ChatCompletionChoice$inboundSchema)});Qd.ChatCompletionResponse$outboundSchema=KS.object({id:KS.string(),object:KS.string(),model:KS.string(),usage:LCr.UsageInfo$outboundSchema,created:KS.number().int(),choices:KS.array($Cr.ChatCompletionChoice$outboundSchema)});var DCr;(function(t){t.inboundSchema=Qd.ChatCompletionResponse$inboundSchema,t.outboundSchema=Qd.ChatCompletionResponse$outboundSchema})(DCr||(Qd.ChatCompletionResponse$=DCr={}));function qSo(t){return JSON.stringify(Qd.ChatCompletionResponse$outboundSchema.parse(t))}function USo(t){return(0,kSo.safeParse)(t,e=>Qd.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var KCr=S(Xr=>{"use strict";var BSo=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]}),zSo=Xr&&Xr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VSo=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"&&BSo(r,e,n[o]);return zSo(r,e),r}}();Object.defineProperty(Xr,"__esModule",{value:!0});Xr.ChatCompletionStreamRequest$=Xr.ChatCompletionStreamRequest$outboundSchema=Xr.ChatCompletionStreamRequest$inboundSchema=Xr.ChatCompletionStreamRequestToolChoice$=Xr.ChatCompletionStreamRequestToolChoice$outboundSchema=Xr.ChatCompletionStreamRequestToolChoice$inboundSchema=Xr.ChatCompletionStreamRequestMessages$=Xr.ChatCompletionStreamRequestMessages$outboundSchema=Xr.ChatCompletionStreamRequestMessages$inboundSchema=Xr.ChatCompletionStreamRequestStop$=Xr.ChatCompletionStreamRequestStop$outboundSchema=Xr.ChatCompletionStreamRequestStop$inboundSchema=void 0;Xr.chatCompletionStreamRequestStopToJSON=HSo;Xr.chatCompletionStreamRequestStopFromJSON=JSo;Xr.chatCompletionStreamRequestMessagesToJSON=WSo;Xr.chatCompletionStreamRequestMessagesFromJSON=KSo;Xr.chatCompletionStreamRequestToolChoiceToJSON=GSo;Xr.chatCompletionStreamRequestToolChoiceFromJSON=XSo;Xr.chatCompletionStreamRequestToJSON=ZSo;Xr.chatCompletionStreamRequestFromJSON=YSo;var at=VSo(Q()),zCr=le(),MMe=Z(),IMe=jR(),VCr=l9(),HCr=rH(),JCr=Hk(),RMe=Q1(),WCr=c9(),AMe=d9(),NMe=nH(),jMe=ej(),DMe=tj();Xr.ChatCompletionStreamRequestStop$inboundSchema=at.union([at.string(),at.array(at.string())]);Xr.ChatCompletionStreamRequestStop$outboundSchema=at.union([at.string(),at.array(at.string())]);var kCr;(function(t){t.inboundSchema=Xr.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Xr.ChatCompletionStreamRequestStop$outboundSchema})(kCr||(Xr.ChatCompletionStreamRequestStop$=kCr={}));function HSo(t){return JSON.stringify(Xr.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function JSo(t){return(0,MMe.safeParse)(t,e=>Xr.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}Xr.ChatCompletionStreamRequestMessages$inboundSchema=at.union([RMe.SystemMessage$inboundSchema.and(at.object({role:at.literal("system")}).transform(t=>({role:t.role}))),jMe.ToolMessage$inboundSchema.and(at.object({role:at.literal("tool")}).transform(t=>({role:t.role}))),DMe.UserMessage$inboundSchema.and(at.object({role:at.literal("user")}).transform(t=>({role:t.role}))),IMe.AssistantMessage$inboundSchema.and(at.object({role:at.literal("assistant")}).transform(t=>({role:t.role})))]);Xr.ChatCompletionStreamRequestMessages$outboundSchema=at.union([RMe.SystemMessage$outboundSchema.and(at.object({role:at.literal("system")}).transform(t=>({role:t.role}))),jMe.ToolMessage$outboundSchema.and(at.object({role:at.literal("tool")}).transform(t=>({role:t.role}))),DMe.UserMessage$outboundSchema.and(at.object({role:at.literal("user")}).transform(t=>({role:t.role}))),IMe.AssistantMessage$outboundSchema.and(at.object({role:at.literal("assistant")}).transform(t=>({role:t.role})))]);var qCr;(function(t){t.inboundSchema=Xr.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Xr.ChatCompletionStreamRequestMessages$outboundSchema})(qCr||(Xr.ChatCompletionStreamRequestMessages$=qCr={}));function WSo(t){return JSON.stringify(Xr.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function KSo(t){return(0,MMe.safeParse)(t,e=>Xr.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}Xr.ChatCompletionStreamRequestToolChoice$inboundSchema=at.union([AMe.ToolChoice$inboundSchema,NMe.ToolChoiceEnum$inboundSchema]);Xr.ChatCompletionStreamRequestToolChoice$outboundSchema=at.union([AMe.ToolChoice$outboundSchema,NMe.ToolChoiceEnum$outboundSchema]);var UCr;(function(t){t.inboundSchema=Xr.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Xr.ChatCompletionStreamRequestToolChoice$outboundSchema})(UCr||(Xr.ChatCompletionStreamRequestToolChoice$=UCr={}));function GSo(t){return JSON.stringify(Xr.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function XSo(t){return(0,MMe.safeParse)(t,e=>Xr.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}Xr.ChatCompletionStreamRequest$inboundSchema=at.object({model:at.string(),temperature:at.nullable(at.number()).optional(),top_p:at.number().optional(),max_tokens:at.nullable(at.number().int()).optional(),stream:at.boolean().default(!0),stop:at.union([at.string(),at.array(at.string())]).optional(),random_seed:at.nullable(at.number().int()).optional(),messages:at.array(at.union([RMe.SystemMessage$inboundSchema.and(at.object({role:at.literal("system")}).transform(t=>({role:t.role}))),jMe.ToolMessage$inboundSchema.and(at.object({role:at.literal("tool")}).transform(t=>({role:t.role}))),DMe.UserMessage$inboundSchema.and(at.object({role:at.literal("user")}).transform(t=>({role:t.role}))),IMe.AssistantMessage$inboundSchema.and(at.object({role:at.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:JCr.ResponseFormat$inboundSchema.optional(),tools:at.nullable(at.array(WCr.Tool$inboundSchema)).optional(),tool_choice:at.union([AMe.ToolChoice$inboundSchema,NMe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:at.number().optional(),frequency_penalty:at.number().optional(),n:at.nullable(at.number().int()).optional(),prediction:HCr.Prediction$inboundSchema.optional(),parallel_tool_calls:at.boolean().optional(),prompt_mode:at.nullable(VCr.MistralPromptMode$inboundSchema).optional(),safe_prompt:at.boolean().optional()}).transform(t=>(0,zCr.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"}));Xr.ChatCompletionStreamRequest$outboundSchema=at.object({model:at.string(),temperature:at.nullable(at.number()).optional(),topP:at.number().optional(),maxTokens:at.nullable(at.number().int()).optional(),stream:at.boolean().default(!0),stop:at.union([at.string(),at.array(at.string())]).optional(),randomSeed:at.nullable(at.number().int()).optional(),messages:at.array(at.union([RMe.SystemMessage$outboundSchema.and(at.object({role:at.literal("system")}).transform(t=>({role:t.role}))),jMe.ToolMessage$outboundSchema.and(at.object({role:at.literal("tool")}).transform(t=>({role:t.role}))),DMe.UserMessage$outboundSchema.and(at.object({role:at.literal("user")}).transform(t=>({role:t.role}))),IMe.AssistantMessage$outboundSchema.and(at.object({role:at.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:JCr.ResponseFormat$outboundSchema.optional(),tools:at.nullable(at.array(WCr.Tool$outboundSchema)).optional(),toolChoice:at.union([AMe.ToolChoice$outboundSchema,NMe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:at.number().optional(),frequencyPenalty:at.number().optional(),n:at.nullable(at.number().int()).optional(),prediction:HCr.Prediction$outboundSchema.optional(),parallelToolCalls:at.boolean().optional(),promptMode:at.nullable(VCr.MistralPromptMode$outboundSchema).optional(),safePrompt:at.boolean().optional()}).transform(t=>(0,zCr.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 BCr;(function(t){t.inboundSchema=Xr.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=Xr.ChatCompletionStreamRequest$outboundSchema})(BCr||(Xr.ChatCompletionStreamRequest$=BCr={}));function ZSo(t){return JSON.stringify(Xr.ChatCompletionStreamRequest$outboundSchema.parse(t))}function YSo(t){return(0,MMe.safeParse)(t,e=>Xr.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var exr=S(Zr=>{"use strict";var QSo=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]}),e0o=Zr&&Zr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t0o=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"&&QSo(r,e,n[o]);return e0o(r,e),r}}();Object.defineProperty(Zr,"__esModule",{value:!0});Zr.ChatModerationRequest$=Zr.ChatModerationRequest$outboundSchema=Zr.ChatModerationRequest$inboundSchema=Zr.ChatModerationRequestInputs$=Zr.ChatModerationRequestInputs$outboundSchema=Zr.ChatModerationRequestInputs$inboundSchema=Zr.One$=Zr.One$outboundSchema=Zr.One$inboundSchema=Zr.Two$=Zr.Two$outboundSchema=Zr.Two$inboundSchema=void 0;Zr.twoToJSON=r0o;Zr.twoFromJSON=n0o;Zr.oneToJSON=o0o;Zr.oneFromJSON=i0o;Zr.chatModerationRequestInputsToJSON=a0o;Zr.chatModerationRequestInputsFromJSON=s0o;Zr.chatModerationRequestToJSON=u0o;Zr.chatModerationRequestFromJSON=l0o;var De=t0o(Q()),QCr=le(),$Me=Z(),GS=jR(),XS=Q1(),ZS=ej(),YS=tj();Zr.Two$inboundSchema=De.union([XS.SystemMessage$inboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$inboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$inboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$inboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))]);Zr.Two$outboundSchema=De.union([XS.SystemMessage$outboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$outboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$outboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$outboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))]);var GCr;(function(t){t.inboundSchema=Zr.Two$inboundSchema,t.outboundSchema=Zr.Two$outboundSchema})(GCr||(Zr.Two$=GCr={}));function r0o(t){return JSON.stringify(Zr.Two$outboundSchema.parse(t))}function n0o(t){return(0,$Me.safeParse)(t,e=>Zr.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}Zr.One$inboundSchema=De.union([XS.SystemMessage$inboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$inboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$inboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$inboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))]);Zr.One$outboundSchema=De.union([XS.SystemMessage$outboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$outboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$outboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$outboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))]);var XCr;(function(t){t.inboundSchema=Zr.One$inboundSchema,t.outboundSchema=Zr.One$outboundSchema})(XCr||(Zr.One$=XCr={}));function o0o(t){return JSON.stringify(Zr.One$outboundSchema.parse(t))}function i0o(t){return(0,$Me.safeParse)(t,e=>Zr.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}Zr.ChatModerationRequestInputs$inboundSchema=De.union([De.array(De.union([XS.SystemMessage$inboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$inboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$inboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$inboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))])),De.array(De.array(De.union([XS.SystemMessage$inboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$inboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$inboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$inboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))])))]);Zr.ChatModerationRequestInputs$outboundSchema=De.union([De.array(De.union([XS.SystemMessage$outboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$outboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$outboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$outboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))])),De.array(De.array(De.union([XS.SystemMessage$outboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$outboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$outboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$outboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))])))]);var ZCr;(function(t){t.inboundSchema=Zr.ChatModerationRequestInputs$inboundSchema,t.outboundSchema=Zr.ChatModerationRequestInputs$outboundSchema})(ZCr||(Zr.ChatModerationRequestInputs$=ZCr={}));function a0o(t){return JSON.stringify(Zr.ChatModerationRequestInputs$outboundSchema.parse(t))}function s0o(t){return(0,$Me.safeParse)(t,e=>Zr.ChatModerationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatModerationRequestInputs' from JSON")}Zr.ChatModerationRequest$inboundSchema=De.object({input:De.union([De.array(De.union([XS.SystemMessage$inboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$inboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$inboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$inboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))])),De.array(De.array(De.union([XS.SystemMessage$inboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$inboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$inboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$inboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))])))]),model:De.string()}).transform(t=>(0,QCr.remap)(t,{input:"inputs"}));Zr.ChatModerationRequest$outboundSchema=De.object({inputs:De.union([De.array(De.union([XS.SystemMessage$outboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$outboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$outboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$outboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))])),De.array(De.array(De.union([XS.SystemMessage$outboundSchema.and(De.object({role:De.literal("system")}).transform(t=>({role:t.role}))),ZS.ToolMessage$outboundSchema.and(De.object({role:De.literal("tool")}).transform(t=>({role:t.role}))),YS.UserMessage$outboundSchema.and(De.object({role:De.literal("user")}).transform(t=>({role:t.role}))),GS.AssistantMessage$outboundSchema.and(De.object({role:De.literal("assistant")}).transform(t=>({role:t.role})))])))]),model:De.string()}).transform(t=>(0,QCr.remap)(t,{inputs:"input"}));var YCr;(function(t){t.inboundSchema=Zr.ChatModerationRequest$inboundSchema,t.outboundSchema=Zr.ChatModerationRequest$outboundSchema})(YCr||(Zr.ChatModerationRequest$=YCr={}));function u0o(t){return JSON.stringify(Zr.ChatModerationRequest$outboundSchema.parse(t))}function l0o(t){return(0,$Me.safeParse)(t,e=>Zr.ChatModerationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatModerationRequest' from JSON")}});var eut=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.MetricOut$=ef.MetricOut$outboundSchema=ef.MetricOut$inboundSchema=void 0;ef.metricOutToJSON=m0o;ef.metricOutFromJSON=h0o;var j_=f0o(Q()),rxr=le(),p0o=Z();ef.MetricOut$inboundSchema=j_.object({train_loss:j_.nullable(j_.number()).optional(),valid_loss:j_.nullable(j_.number()).optional(),valid_mean_token_accuracy:j_.nullable(j_.number()).optional()}).transform(t=>(0,rxr.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));ef.MetricOut$outboundSchema=j_.object({trainLoss:j_.nullable(j_.number()).optional(),validLoss:j_.nullable(j_.number()).optional(),validMeanTokenAccuracy:j_.nullable(j_.number()).optional()}).transform(t=>(0,rxr.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var txr;(function(t){t.inboundSchema=ef.MetricOut$inboundSchema,t.outboundSchema=ef.MetricOut$outboundSchema})(txr||(ef.MetricOut$=txr={}));function m0o(t){return JSON.stringify(ef.MetricOut$outboundSchema.parse(t))}function h0o(t){return(0,p0o.safeParse)(t,e=>ef.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var LMe=S(tf=>{"use strict";var g0o=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]}),y0o=tf&&tf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b0o=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"&&g0o(r,e,n[o]);return y0o(r,e),r}}();Object.defineProperty(tf,"__esModule",{value:!0});tf.CheckpointOut$=tf.CheckpointOut$outboundSchema=tf.CheckpointOut$inboundSchema=void 0;tf.checkpointOutToJSON=v0o;tf.checkpointOutFromJSON=w0o;var p9=b0o(Q()),oxr=le(),_0o=Z(),ixr=eut();tf.CheckpointOut$inboundSchema=p9.object({metrics:ixr.MetricOut$inboundSchema,step_number:p9.number().int(),created_at:p9.number().int()}).transform(t=>(0,oxr.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));tf.CheckpointOut$outboundSchema=p9.object({metrics:ixr.MetricOut$outboundSchema,stepNumber:p9.number().int(),createdAt:p9.number().int()}).transform(t=>(0,oxr.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var nxr;(function(t){t.inboundSchema=tf.CheckpointOut$inboundSchema,t.outboundSchema=tf.CheckpointOut$outboundSchema})(nxr||(tf.CheckpointOut$=nxr={}));function v0o(t){return JSON.stringify(tf.CheckpointOut$outboundSchema.parse(t))}function w0o(t){return(0,_0o.safeParse)(t,e=>tf.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var cxr=S(hs=>{"use strict";var S0o=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]}),C0o=hs&&hs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x0o=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"&&S0o(r,e,n[o]);return C0o(r,e),r}}();Object.defineProperty(hs,"__esModule",{value:!0});hs.ClassificationRequest$=hs.ClassificationRequest$outboundSchema=hs.ClassificationRequest$inboundSchema=hs.ClassificationRequestInputs$=hs.ClassificationRequestInputs$outboundSchema=hs.ClassificationRequestInputs$inboundSchema=void 0;hs.classificationRequestInputsToJSON=O0o;hs.classificationRequestInputsFromJSON=T0o;hs.classificationRequestToJSON=E0o;hs.classificationRequestFromJSON=P0o;var rf=x0o(Q()),uxr=le(),lxr=Z();hs.ClassificationRequestInputs$inboundSchema=rf.union([rf.string(),rf.array(rf.string())]);hs.ClassificationRequestInputs$outboundSchema=rf.union([rf.string(),rf.array(rf.string())]);var axr;(function(t){t.inboundSchema=hs.ClassificationRequestInputs$inboundSchema,t.outboundSchema=hs.ClassificationRequestInputs$outboundSchema})(axr||(hs.ClassificationRequestInputs$=axr={}));function O0o(t){return JSON.stringify(hs.ClassificationRequestInputs$outboundSchema.parse(t))}function T0o(t){return(0,lxr.safeParse)(t,e=>hs.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}hs.ClassificationRequest$inboundSchema=rf.object({model:rf.string(),input:rf.union([rf.string(),rf.array(rf.string())])}).transform(t=>(0,uxr.remap)(t,{input:"inputs"}));hs.ClassificationRequest$outboundSchema=rf.object({model:rf.string(),inputs:rf.union([rf.string(),rf.array(rf.string())])}).transform(t=>(0,uxr.remap)(t,{inputs:"input"}));var sxr;(function(t){t.inboundSchema=hs.ClassificationRequest$inboundSchema,t.outboundSchema=hs.ClassificationRequest$outboundSchema})(sxr||(hs.ClassificationRequest$=sxr={}));function E0o(t){return JSON.stringify(hs.ClassificationRequest$outboundSchema.parse(t))}function P0o(t){return(0,lxr.safeParse)(t,e=>hs.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var tut=S(nf=>{"use strict";var M0o=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]}),I0o=nf&&nf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R0o=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"&&M0o(r,e,n[o]);return I0o(r,e),r}}();Object.defineProperty(nf,"__esModule",{value:!0});nf.ClassificationTargetResult$=nf.ClassificationTargetResult$outboundSchema=nf.ClassificationTargetResult$inboundSchema=void 0;nf.classificationTargetResultToJSON=N0o;nf.classificationTargetResultFromJSON=j0o;var m9=R0o(Q()),A0o=Z();nf.ClassificationTargetResult$inboundSchema=m9.object({scores:m9.record(m9.number())});nf.ClassificationTargetResult$outboundSchema=m9.object({scores:m9.record(m9.number())});var dxr;(function(t){t.inboundSchema=nf.ClassificationTargetResult$inboundSchema,t.outboundSchema=nf.ClassificationTargetResult$outboundSchema})(dxr||(nf.ClassificationTargetResult$=dxr={}));function N0o(t){return JSON.stringify(nf.ClassificationTargetResult$outboundSchema.parse(t))}function j0o(t){return(0,A0o.safeParse)(t,e=>nf.ClassificationTargetResult$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationTargetResult' from JSON")}});var mxr=S(of=>{"use strict";var D0o=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]}),$0o=of&&of.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L0o=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"&&D0o(r,e,n[o]);return $0o(r,e),r}}();Object.defineProperty(of,"__esModule",{value:!0});of.ClassificationResponse$=of.ClassificationResponse$outboundSchema=of.ClassificationResponse$inboundSchema=void 0;of.classificationResponseToJSON=k0o;of.classificationResponseFromJSON=q0o;var $R=L0o(Q()),F0o=Z(),pxr=tut();of.ClassificationResponse$inboundSchema=$R.object({id:$R.string(),model:$R.string(),results:$R.array($R.record(pxr.ClassificationTargetResult$inboundSchema))});of.ClassificationResponse$outboundSchema=$R.object({id:$R.string(),model:$R.string(),results:$R.array($R.record(pxr.ClassificationTargetResult$outboundSchema))});var fxr;(function(t){t.inboundSchema=of.ClassificationResponse$inboundSchema,t.outboundSchema=of.ClassificationResponse$outboundSchema})(fxr||(of.ClassificationResponse$=fxr={}));function k0o(t){return JSON.stringify(of.ClassificationResponse$outboundSchema.parse(t))}function q0o(t){return(0,F0o.safeParse)(t,e=>of.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var FMe=S(af=>{"use strict";var U0o=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]}),B0o=af&&af.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z0o=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"&&U0o(r,e,n[o]);return B0o(r,e),r}}();Object.defineProperty(af,"__esModule",{value:!0});af.FTClassifierLossFunction$=af.FTClassifierLossFunction$outboundSchema=af.FTClassifierLossFunction$inboundSchema=af.FTClassifierLossFunction=void 0;var V0o=z0o(Q());af.FTClassifierLossFunction={SingleClass:"single_class",MultiClass:"multi_class"};af.FTClassifierLossFunction$inboundSchema=V0o.nativeEnum(af.FTClassifierLossFunction);af.FTClassifierLossFunction$outboundSchema=af.FTClassifierLossFunction$inboundSchema;var hxr;(function(t){t.inboundSchema=af.FTClassifierLossFunction$inboundSchema,t.outboundSchema=af.FTClassifierLossFunction$outboundSchema})(hxr||(af.FTClassifierLossFunction$=hxr={}))});var kMe=S(sf=>{"use strict";var H0o=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]}),J0o=sf&&sf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W0o=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"&&H0o(r,e,n[o]);return J0o(r,e),r}}();Object.defineProperty(sf,"__esModule",{value:!0});sf.ClassifierTargetOut$=sf.ClassifierTargetOut$outboundSchema=sf.ClassifierTargetOut$inboundSchema=void 0;sf.classifierTargetOutToJSON=G0o;sf.classifierTargetOutFromJSON=X0o;var LR=W0o(Q()),yxr=le(),K0o=Z(),bxr=FMe();sf.ClassifierTargetOut$inboundSchema=LR.object({name:LR.string(),labels:LR.array(LR.string()),weight:LR.number(),loss_function:bxr.FTClassifierLossFunction$inboundSchema}).transform(t=>(0,yxr.remap)(t,{loss_function:"lossFunction"}));sf.ClassifierTargetOut$outboundSchema=LR.object({name:LR.string(),labels:LR.array(LR.string()),weight:LR.number(),lossFunction:bxr.FTClassifierLossFunction$outboundSchema}).transform(t=>(0,yxr.remap)(t,{lossFunction:"loss_function"}));var gxr;(function(t){t.inboundSchema=sf.ClassifierTargetOut$inboundSchema,t.outboundSchema=sf.ClassifierTargetOut$outboundSchema})(gxr||(sf.ClassifierTargetOut$=gxr={}));function G0o(t){return JSON.stringify(sf.ClassifierTargetOut$outboundSchema.parse(t))}function X0o(t){return(0,K0o.safeParse)(t,e=>sf.ClassifierTargetOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTargetOut' from JSON")}});var qMe=S(uf=>{"use strict";var Z0o=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]}),Y0o=uf&&uf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q0o=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"&&Z0o(r,e,n[o]);return Y0o(r,e),r}}();Object.defineProperty(uf,"__esModule",{value:!0});uf.ClassifierTrainingParameters$=uf.ClassifierTrainingParameters$outboundSchema=uf.ClassifierTrainingParameters$inboundSchema=void 0;uf.classifierTrainingParametersToJSON=tCo;uf.classifierTrainingParametersFromJSON=rCo;var Jl=Q0o(Q()),vxr=le(),eCo=Z();uf.ClassifierTrainingParameters$inboundSchema=Jl.object({training_steps:Jl.nullable(Jl.number().int()).optional(),learning_rate:Jl.number().default(1e-4),weight_decay:Jl.nullable(Jl.number()).optional(),warmup_fraction:Jl.nullable(Jl.number()).optional(),epochs:Jl.nullable(Jl.number()).optional(),seq_len:Jl.nullable(Jl.number().int()).optional()}).transform(t=>(0,vxr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen"}));uf.ClassifierTrainingParameters$outboundSchema=Jl.object({trainingSteps:Jl.nullable(Jl.number().int()).optional(),learningRate:Jl.number().default(1e-4),weightDecay:Jl.nullable(Jl.number()).optional(),warmupFraction:Jl.nullable(Jl.number()).optional(),epochs:Jl.nullable(Jl.number()).optional(),seqLen:Jl.nullable(Jl.number().int()).optional()}).transform(t=>(0,vxr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len"}));var _xr;(function(t){t.inboundSchema=uf.ClassifierTrainingParameters$inboundSchema,t.outboundSchema=uf.ClassifierTrainingParameters$outboundSchema})(_xr||(uf.ClassifierTrainingParameters$=_xr={}));function tCo(t){return JSON.stringify(uf.ClassifierTrainingParameters$outboundSchema.parse(t))}function rCo(t){return(0,eCo.safeParse)(t,e=>uf.ClassifierTrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTrainingParameters' from JSON")}});var UMe=S(lf=>{"use strict";var nCo=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]}),oCo=lf&&lf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iCo=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"&&nCo(r,e,n[o]);return oCo(r,e),r}}();Object.defineProperty(lf,"__esModule",{value:!0});lf.EventOut$=lf.EventOut$outboundSchema=lf.EventOut$inboundSchema=void 0;lf.eventOutToJSON=sCo;lf.eventOutFromJSON=uCo;var QS=iCo(Q()),Sxr=le(),aCo=Z();lf.EventOut$inboundSchema=QS.object({name:QS.string(),data:QS.nullable(QS.record(QS.any())).optional(),created_at:QS.number().int()}).transform(t=>(0,Sxr.remap)(t,{created_at:"createdAt"}));lf.EventOut$outboundSchema=QS.object({name:QS.string(),data:QS.nullable(QS.record(QS.any())).optional(),createdAt:QS.number().int()}).transform(t=>(0,Sxr.remap)(t,{createdAt:"created_at"}));var wxr;(function(t){t.inboundSchema=lf.EventOut$inboundSchema,t.outboundSchema=lf.EventOut$outboundSchema})(wxr||(lf.EventOut$=wxr={}));function sCo(t){return JSON.stringify(lf.EventOut$outboundSchema.parse(t))}function uCo(t){return(0,aCo.safeParse)(t,e=>lf.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var h9=S(cf=>{"use strict";var lCo=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]}),cCo=cf&&cf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dCo=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"&&lCo(r,e,n[o]);return cCo(r,e),r}}();Object.defineProperty(cf,"__esModule",{value:!0});cf.JobMetadataOut$=cf.JobMetadataOut$outboundSchema=cf.JobMetadataOut$inboundSchema=void 0;cf.jobMetadataOutToJSON=pCo;cf.jobMetadataOutFromJSON=mCo;var Xs=dCo(Q()),xxr=le(),fCo=Z();cf.JobMetadataOut$inboundSchema=Xs.object({expected_duration_seconds:Xs.nullable(Xs.number().int()).optional(),cost:Xs.nullable(Xs.number()).optional(),cost_currency:Xs.nullable(Xs.string()).optional(),train_tokens_per_step:Xs.nullable(Xs.number().int()).optional(),train_tokens:Xs.nullable(Xs.number().int()).optional(),data_tokens:Xs.nullable(Xs.number().int()).optional(),estimated_start_time:Xs.nullable(Xs.number().int()).optional()}).transform(t=>(0,xxr.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));cf.JobMetadataOut$outboundSchema=Xs.object({expectedDurationSeconds:Xs.nullable(Xs.number().int()).optional(),cost:Xs.nullable(Xs.number()).optional(),costCurrency:Xs.nullable(Xs.string()).optional(),trainTokensPerStep:Xs.nullable(Xs.number().int()).optional(),trainTokens:Xs.nullable(Xs.number().int()).optional(),dataTokens:Xs.nullable(Xs.number().int()).optional(),estimatedStartTime:Xs.nullable(Xs.number().int()).optional()}).transform(t=>(0,xxr.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 Cxr;(function(t){t.inboundSchema=cf.JobMetadataOut$inboundSchema,t.outboundSchema=cf.JobMetadataOut$outboundSchema})(Cxr||(cf.JobMetadataOut$=Cxr={}));function pCo(t){return JSON.stringify(cf.JobMetadataOut$outboundSchema.parse(t))}function mCo(t){return(0,fCo.safeParse)(t,e=>cf.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var g9=S(_a=>{"use strict";var hCo=_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]}),gCo=_a&&_a.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yCo=_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"&&hCo(r,e,n[o]);return gCo(r,e),r}}();Object.defineProperty(_a,"__esModule",{value:!0});_a.WandbIntegrationOut$=_a.WandbIntegrationOut$outboundSchema=_a.WandbIntegrationOut$inboundSchema=_a.WandbIntegrationOutType$=_a.WandbIntegrationOutType$outboundSchema=_a.WandbIntegrationOutType$inboundSchema=_a.WandbIntegrationOutType=void 0;_a.wandbIntegrationOutToJSON=_Co;_a.wandbIntegrationOutFromJSON=vCo;var Ig=yCo(Q()),Exr=le(),bCo=Z();_a.WandbIntegrationOutType={Wandb:"wandb"};_a.WandbIntegrationOutType$inboundSchema=Ig.nativeEnum(_a.WandbIntegrationOutType);_a.WandbIntegrationOutType$outboundSchema=_a.WandbIntegrationOutType$inboundSchema;var Oxr;(function(t){t.inboundSchema=_a.WandbIntegrationOutType$inboundSchema,t.outboundSchema=_a.WandbIntegrationOutType$outboundSchema})(Oxr||(_a.WandbIntegrationOutType$=Oxr={}));_a.WandbIntegrationOut$inboundSchema=Ig.object({type:_a.WandbIntegrationOutType$inboundSchema.default("wandb"),project:Ig.string(),name:Ig.nullable(Ig.string()).optional(),run_name:Ig.nullable(Ig.string()).optional(),url:Ig.nullable(Ig.string()).optional()}).transform(t=>(0,Exr.remap)(t,{run_name:"runName"}));_a.WandbIntegrationOut$outboundSchema=Ig.object({type:_a.WandbIntegrationOutType$outboundSchema.default("wandb"),project:Ig.string(),name:Ig.nullable(Ig.string()).optional(),runName:Ig.nullable(Ig.string()).optional(),url:Ig.nullable(Ig.string()).optional()}).transform(t=>(0,Exr.remap)(t,{runName:"run_name"}));var Txr;(function(t){t.inboundSchema=_a.WandbIntegrationOut$inboundSchema,t.outboundSchema=_a.WandbIntegrationOut$outboundSchema})(Txr||(_a.WandbIntegrationOut$=Txr={}));function _Co(t){return JSON.stringify(_a.WandbIntegrationOut$outboundSchema.parse(t))}function vCo(t){return(0,bCo.safeParse)(t,e=>_a.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var qxr=S(Qt=>{"use strict";var wCo=Qt&&Qt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),SCo=Qt&&Qt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CCo=Qt&&Qt.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(Qt,"__esModule",{value:!0});Qt.ClassifierDetailedJobOut$=Qt.ClassifierDetailedJobOut$outboundSchema=Qt.ClassifierDetailedJobOut$inboundSchema=Qt.ClassifierDetailedJobOutJobType$=Qt.ClassifierDetailedJobOutJobType$outboundSchema=Qt.ClassifierDetailedJobOutJobType$inboundSchema=Qt.ClassifierDetailedJobOutIntegrations$=Qt.ClassifierDetailedJobOutIntegrations$outboundSchema=Qt.ClassifierDetailedJobOutIntegrations$inboundSchema=Qt.ClassifierDetailedJobOutObject$=Qt.ClassifierDetailedJobOutObject$outboundSchema=Qt.ClassifierDetailedJobOutObject$inboundSchema=Qt.ClassifierDetailedJobOutStatus$=Qt.ClassifierDetailedJobOutStatus$outboundSchema=Qt.ClassifierDetailedJobOutStatus$inboundSchema=Qt.ClassifierDetailedJobOutJobType=Qt.ClassifierDetailedJobOutObject=Qt.ClassifierDetailedJobOutStatus=void 0;Qt.classifierDetailedJobOutIntegrationsToJSON=xCo;Qt.classifierDetailedJobOutIntegrationsFromJSON=OCo;Qt.classifierDetailedJobOutToJSON=TCo;Qt.classifierDetailedJobOutFromJSON=ECo;var Dn=CCo(Q()),Nxr=le(),jxr=Z(),Dxr=LMe(),$xr=kMe(),Lxr=qMe(),Fxr=UMe(),kxr=h9(),BMe=g9();Qt.ClassifierDetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Qt.ClassifierDetailedJobOutObject={Job:"job"};Qt.ClassifierDetailedJobOutJobType={Classifier:"classifier"};Qt.ClassifierDetailedJobOutStatus$inboundSchema=Dn.nativeEnum(Qt.ClassifierDetailedJobOutStatus);Qt.ClassifierDetailedJobOutStatus$outboundSchema=Qt.ClassifierDetailedJobOutStatus$inboundSchema;var Pxr;(function(t){t.inboundSchema=Qt.ClassifierDetailedJobOutStatus$inboundSchema,t.outboundSchema=Qt.ClassifierDetailedJobOutStatus$outboundSchema})(Pxr||(Qt.ClassifierDetailedJobOutStatus$=Pxr={}));Qt.ClassifierDetailedJobOutObject$inboundSchema=Dn.nativeEnum(Qt.ClassifierDetailedJobOutObject);Qt.ClassifierDetailedJobOutObject$outboundSchema=Qt.ClassifierDetailedJobOutObject$inboundSchema;var Mxr;(function(t){t.inboundSchema=Qt.ClassifierDetailedJobOutObject$inboundSchema,t.outboundSchema=Qt.ClassifierDetailedJobOutObject$outboundSchema})(Mxr||(Qt.ClassifierDetailedJobOutObject$=Mxr={}));Qt.ClassifierDetailedJobOutIntegrations$inboundSchema=BMe.WandbIntegrationOut$inboundSchema;Qt.ClassifierDetailedJobOutIntegrations$outboundSchema=BMe.WandbIntegrationOut$outboundSchema;var Ixr;(function(t){t.inboundSchema=Qt.ClassifierDetailedJobOutIntegrations$inboundSchema,t.outboundSchema=Qt.ClassifierDetailedJobOutIntegrations$outboundSchema})(Ixr||(Qt.ClassifierDetailedJobOutIntegrations$=Ixr={}));function xCo(t){return JSON.stringify(Qt.ClassifierDetailedJobOutIntegrations$outboundSchema.parse(t))}function OCo(t){return(0,jxr.safeParse)(t,e=>Qt.ClassifierDetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierDetailedJobOutIntegrations' from JSON")}Qt.ClassifierDetailedJobOutJobType$inboundSchema=Dn.nativeEnum(Qt.ClassifierDetailedJobOutJobType);Qt.ClassifierDetailedJobOutJobType$outboundSchema=Qt.ClassifierDetailedJobOutJobType$inboundSchema;var Rxr;(function(t){t.inboundSchema=Qt.ClassifierDetailedJobOutJobType$inboundSchema,t.outboundSchema=Qt.ClassifierDetailedJobOutJobType$outboundSchema})(Rxr||(Qt.ClassifierDetailedJobOutJobType$=Rxr={}));Qt.ClassifierDetailedJobOut$inboundSchema=Dn.object({id:Dn.string(),auto_start:Dn.boolean(),model:Dn.string(),status:Qt.ClassifierDetailedJobOutStatus$inboundSchema,created_at:Dn.number().int(),modified_at:Dn.number().int(),training_files:Dn.array(Dn.string()),validation_files:Dn.nullable(Dn.array(Dn.string())).optional(),object:Qt.ClassifierDetailedJobOutObject$inboundSchema.default("job"),fine_tuned_model:Dn.nullable(Dn.string()).optional(),suffix:Dn.nullable(Dn.string()).optional(),integrations:Dn.nullable(Dn.array(BMe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Dn.nullable(Dn.number().int()).optional(),metadata:Dn.nullable(kxr.JobMetadataOut$inboundSchema).optional(),job_type:Qt.ClassifierDetailedJobOutJobType$inboundSchema.default("classifier"),hyperparameters:Lxr.ClassifierTrainingParameters$inboundSchema,events:Dn.array(Fxr.EventOut$inboundSchema).optional(),checkpoints:Dn.array(Dxr.CheckpointOut$inboundSchema).optional(),classifier_targets:Dn.array($xr.ClassifierTargetOut$inboundSchema)}).transform(t=>(0,Nxr.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"}));Qt.ClassifierDetailedJobOut$outboundSchema=Dn.object({id:Dn.string(),autoStart:Dn.boolean(),model:Dn.string(),status:Qt.ClassifierDetailedJobOutStatus$outboundSchema,createdAt:Dn.number().int(),modifiedAt:Dn.number().int(),trainingFiles:Dn.array(Dn.string()),validationFiles:Dn.nullable(Dn.array(Dn.string())).optional(),object:Qt.ClassifierDetailedJobOutObject$outboundSchema.default("job"),fineTunedModel:Dn.nullable(Dn.string()).optional(),suffix:Dn.nullable(Dn.string()).optional(),integrations:Dn.nullable(Dn.array(BMe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Dn.nullable(Dn.number().int()).optional(),metadata:Dn.nullable(kxr.JobMetadataOut$outboundSchema).optional(),jobType:Qt.ClassifierDetailedJobOutJobType$outboundSchema.default("classifier"),hyperparameters:Lxr.ClassifierTrainingParameters$outboundSchema,events:Dn.array(Fxr.EventOut$outboundSchema).optional(),checkpoints:Dn.array(Dxr.CheckpointOut$outboundSchema).optional(),classifierTargets:Dn.array($xr.ClassifierTargetOut$outboundSchema)}).transform(t=>(0,Nxr.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 Axr;(function(t){t.inboundSchema=Qt.ClassifierDetailedJobOut$inboundSchema,t.outboundSchema=Qt.ClassifierDetailedJobOut$outboundSchema})(Axr||(Qt.ClassifierDetailedJobOut$=Axr={}));function TCo(t){return JSON.stringify(Qt.ClassifierDetailedJobOut$outboundSchema.parse(t))}function ECo(t){return(0,jxr.safeParse)(t,e=>Qt.ClassifierDetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierDetailedJobOut' from JSON")}});var zMe=S(df=>{"use strict";var PCo=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]}),MCo=df&&df.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ICo=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"&&PCo(r,e,n[o]);return MCo(r,e),r}}();Object.defineProperty(df,"__esModule",{value:!0});df.FTModelCapabilitiesOut$=df.FTModelCapabilitiesOut$outboundSchema=df.FTModelCapabilitiesOut$inboundSchema=void 0;df.ftModelCapabilitiesOutToJSON=ACo;df.ftModelCapabilitiesOutFromJSON=NCo;var e0=ICo(Q()),Bxr=le(),RCo=Z();df.FTModelCapabilitiesOut$inboundSchema=e0.object({completion_chat:e0.boolean().default(!0),completion_fim:e0.boolean().default(!1),function_calling:e0.boolean().default(!1),fine_tuning:e0.boolean().default(!1),classification:e0.boolean().default(!1)}).transform(t=>(0,Bxr.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));df.FTModelCapabilitiesOut$outboundSchema=e0.object({completionChat:e0.boolean().default(!0),completionFim:e0.boolean().default(!1),functionCalling:e0.boolean().default(!1),fineTuning:e0.boolean().default(!1),classification:e0.boolean().default(!1)}).transform(t=>(0,Bxr.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var Uxr;(function(t){t.inboundSchema=df.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=df.FTModelCapabilitiesOut$outboundSchema})(Uxr||(df.FTModelCapabilitiesOut$=Uxr={}));function ACo(t){return JSON.stringify(df.FTModelCapabilitiesOut$outboundSchema.parse(t))}function NCo(t){return(0,RCo.safeParse)(t,e=>df.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var Gxr=S(Vn=>{"use strict";var jCo=Vn&&Vn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Vn&&Vn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Co=Vn&&Vn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jCo(r,e,n[o]);return DCo(r,e),r}}();Object.defineProperty(Vn,"__esModule",{value:!0});Vn.ClassifierFTModelOut$=Vn.ClassifierFTModelOut$outboundSchema=Vn.ClassifierFTModelOut$inboundSchema=Vn.ClassifierFTModelOutModelType$=Vn.ClassifierFTModelOutModelType$outboundSchema=Vn.ClassifierFTModelOutModelType$inboundSchema=Vn.ClassifierFTModelOutObject$=Vn.ClassifierFTModelOutObject$outboundSchema=Vn.ClassifierFTModelOutObject$inboundSchema=Vn.ClassifierFTModelOutModelType=Vn.ClassifierFTModelOutObject=void 0;Vn.classifierFTModelOutToJSON=FCo;Vn.classifierFTModelOutFromJSON=kCo;var ki=$Co(Q()),Jxr=le(),LCo=Z(),Wxr=kMe(),Kxr=zMe();Vn.ClassifierFTModelOutObject={Model:"model"};Vn.ClassifierFTModelOutModelType={Classifier:"classifier"};Vn.ClassifierFTModelOutObject$inboundSchema=ki.nativeEnum(Vn.ClassifierFTModelOutObject);Vn.ClassifierFTModelOutObject$outboundSchema=Vn.ClassifierFTModelOutObject$inboundSchema;var zxr;(function(t){t.inboundSchema=Vn.ClassifierFTModelOutObject$inboundSchema,t.outboundSchema=Vn.ClassifierFTModelOutObject$outboundSchema})(zxr||(Vn.ClassifierFTModelOutObject$=zxr={}));Vn.ClassifierFTModelOutModelType$inboundSchema=ki.nativeEnum(Vn.ClassifierFTModelOutModelType);Vn.ClassifierFTModelOutModelType$outboundSchema=Vn.ClassifierFTModelOutModelType$inboundSchema;var Vxr;(function(t){t.inboundSchema=Vn.ClassifierFTModelOutModelType$inboundSchema,t.outboundSchema=Vn.ClassifierFTModelOutModelType$outboundSchema})(Vxr||(Vn.ClassifierFTModelOutModelType$=Vxr={}));Vn.ClassifierFTModelOut$inboundSchema=ki.object({id:ki.string(),object:Vn.ClassifierFTModelOutObject$inboundSchema.default("model"),created:ki.number().int(),owned_by:ki.string(),workspace_id:ki.string(),root:ki.string(),root_version:ki.string(),archived:ki.boolean(),name:ki.nullable(ki.string()).optional(),description:ki.nullable(ki.string()).optional(),capabilities:Kxr.FTModelCapabilitiesOut$inboundSchema,max_context_length:ki.number().int().default(32768),aliases:ki.array(ki.string()).optional(),job:ki.string(),classifier_targets:ki.array(Wxr.ClassifierTargetOut$inboundSchema),model_type:Vn.ClassifierFTModelOutModelType$inboundSchema.default("classifier")}).transform(t=>(0,Jxr.remap)(t,{owned_by:"ownedBy",workspace_id:"workspaceId",root_version:"rootVersion",max_context_length:"maxContextLength",classifier_targets:"classifierTargets",model_type:"modelType"}));Vn.ClassifierFTModelOut$outboundSchema=ki.object({id:ki.string(),object:Vn.ClassifierFTModelOutObject$outboundSchema.default("model"),created:ki.number().int(),ownedBy:ki.string(),workspaceId:ki.string(),root:ki.string(),rootVersion:ki.string(),archived:ki.boolean(),name:ki.nullable(ki.string()).optional(),description:ki.nullable(ki.string()).optional(),capabilities:Kxr.FTModelCapabilitiesOut$outboundSchema,maxContextLength:ki.number().int().default(32768),aliases:ki.array(ki.string()).optional(),job:ki.string(),classifierTargets:ki.array(Wxr.ClassifierTargetOut$outboundSchema),modelType:Vn.ClassifierFTModelOutModelType$outboundSchema.default("classifier")}).transform(t=>(0,Jxr.remap)(t,{ownedBy:"owned_by",workspaceId:"workspace_id",rootVersion:"root_version",maxContextLength:"max_context_length",classifierTargets:"classifier_targets",modelType:"model_type"}));var Hxr;(function(t){t.inboundSchema=Vn.ClassifierFTModelOut$inboundSchema,t.outboundSchema=Vn.ClassifierFTModelOut$outboundSchema})(Hxr||(Vn.ClassifierFTModelOut$=Hxr={}));function FCo(t){return JSON.stringify(Vn.ClassifierFTModelOut$outboundSchema.parse(t))}function kCo(t){return(0,LCo.safeParse)(t,e=>Vn.ClassifierFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierFTModelOut' from JSON")}});var rut=S(er=>{"use strict";var qCo=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]}),UCo=er&&er.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BCo=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"&&qCo(r,e,n[o]);return UCo(r,e),r}}();Object.defineProperty(er,"__esModule",{value:!0});er.ClassifierJobOut$=er.ClassifierJobOut$outboundSchema=er.ClassifierJobOut$inboundSchema=er.ClassifierJobOutJobType$=er.ClassifierJobOutJobType$outboundSchema=er.ClassifierJobOutJobType$inboundSchema=er.ClassifierJobOutIntegrations$=er.ClassifierJobOutIntegrations$outboundSchema=er.ClassifierJobOutIntegrations$inboundSchema=er.ClassifierJobOutObject$=er.ClassifierJobOutObject$outboundSchema=er.ClassifierJobOutObject$inboundSchema=er.ClassifierJobOutStatus$=er.ClassifierJobOutStatus$outboundSchema=er.ClassifierJobOutStatus$inboundSchema=er.ClassifierJobOutJobType=er.ClassifierJobOutObject=er.ClassifierJobOutStatus=void 0;er.classifierJobOutIntegrationsToJSON=zCo;er.classifierJobOutIntegrationsFromJSON=VCo;er.classifierJobOutToJSON=HCo;er.classifierJobOutFromJSON=JCo;var Lo=BCo(Q()),tOr=le(),rOr=Z(),nOr=qMe(),oOr=h9(),VMe=g9();er.ClassifierJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};er.ClassifierJobOutObject={Job:"job"};er.ClassifierJobOutJobType={Classifier:"classifier"};er.ClassifierJobOutStatus$inboundSchema=Lo.nativeEnum(er.ClassifierJobOutStatus);er.ClassifierJobOutStatus$outboundSchema=er.ClassifierJobOutStatus$inboundSchema;var Xxr;(function(t){t.inboundSchema=er.ClassifierJobOutStatus$inboundSchema,t.outboundSchema=er.ClassifierJobOutStatus$outboundSchema})(Xxr||(er.ClassifierJobOutStatus$=Xxr={}));er.ClassifierJobOutObject$inboundSchema=Lo.nativeEnum(er.ClassifierJobOutObject);er.ClassifierJobOutObject$outboundSchema=er.ClassifierJobOutObject$inboundSchema;var Zxr;(function(t){t.inboundSchema=er.ClassifierJobOutObject$inboundSchema,t.outboundSchema=er.ClassifierJobOutObject$outboundSchema})(Zxr||(er.ClassifierJobOutObject$=Zxr={}));er.ClassifierJobOutIntegrations$inboundSchema=VMe.WandbIntegrationOut$inboundSchema;er.ClassifierJobOutIntegrations$outboundSchema=VMe.WandbIntegrationOut$outboundSchema;var Yxr;(function(t){t.inboundSchema=er.ClassifierJobOutIntegrations$inboundSchema,t.outboundSchema=er.ClassifierJobOutIntegrations$outboundSchema})(Yxr||(er.ClassifierJobOutIntegrations$=Yxr={}));function zCo(t){return JSON.stringify(er.ClassifierJobOutIntegrations$outboundSchema.parse(t))}function VCo(t){return(0,rOr.safeParse)(t,e=>er.ClassifierJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierJobOutIntegrations' from JSON")}er.ClassifierJobOutJobType$inboundSchema=Lo.nativeEnum(er.ClassifierJobOutJobType);er.ClassifierJobOutJobType$outboundSchema=er.ClassifierJobOutJobType$inboundSchema;var Qxr;(function(t){t.inboundSchema=er.ClassifierJobOutJobType$inboundSchema,t.outboundSchema=er.ClassifierJobOutJobType$outboundSchema})(Qxr||(er.ClassifierJobOutJobType$=Qxr={}));er.ClassifierJobOut$inboundSchema=Lo.object({id:Lo.string(),auto_start:Lo.boolean(),model:Lo.string(),status:er.ClassifierJobOutStatus$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:er.ClassifierJobOutObject$inboundSchema.default("job"),fine_tuned_model:Lo.nullable(Lo.string()).optional(),suffix:Lo.nullable(Lo.string()).optional(),integrations:Lo.nullable(Lo.array(VMe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Lo.nullable(Lo.number().int()).optional(),metadata:Lo.nullable(oOr.JobMetadataOut$inboundSchema).optional(),job_type:er.ClassifierJobOutJobType$inboundSchema.default("classifier"),hyperparameters:nOr.ClassifierTrainingParameters$inboundSchema}).transform(t=>(0,tOr.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"}));er.ClassifierJobOut$outboundSchema=Lo.object({id:Lo.string(),autoStart:Lo.boolean(),model:Lo.string(),status:er.ClassifierJobOutStatus$outboundSchema,createdAt:Lo.number().int(),modifiedAt:Lo.number().int(),trainingFiles:Lo.array(Lo.string()),validationFiles:Lo.nullable(Lo.array(Lo.string())).optional(),object:er.ClassifierJobOutObject$outboundSchema.default("job"),fineTunedModel:Lo.nullable(Lo.string()).optional(),suffix:Lo.nullable(Lo.string()).optional(),integrations:Lo.nullable(Lo.array(VMe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Lo.nullable(Lo.number().int()).optional(),metadata:Lo.nullable(oOr.JobMetadataOut$outboundSchema).optional(),jobType:er.ClassifierJobOutJobType$outboundSchema.default("classifier"),hyperparameters:nOr.ClassifierTrainingParameters$outboundSchema}).transform(t=>(0,tOr.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 eOr;(function(t){t.inboundSchema=er.ClassifierJobOut$inboundSchema,t.outboundSchema=er.ClassifierJobOut$outboundSchema})(eOr||(er.ClassifierJobOut$=eOr={}));function HCo(t){return JSON.stringify(er.ClassifierJobOut$outboundSchema.parse(t))}function JCo(t){return(0,rOr.safeParse)(t,e=>er.ClassifierJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierJobOut' from JSON")}});var nut=S(ff=>{"use strict";var WCo=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]}),KCo=ff&&ff.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GCo=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"&&WCo(r,e,n[o]);return KCo(r,e),r}}();Object.defineProperty(ff,"__esModule",{value:!0});ff.ClassifierTargetIn$=ff.ClassifierTargetIn$outboundSchema=ff.ClassifierTargetIn$inboundSchema=void 0;ff.classifierTargetInToJSON=ZCo;ff.classifierTargetInFromJSON=YCo;var t0=GCo(Q()),aOr=le(),XCo=Z(),sOr=FMe();ff.ClassifierTargetIn$inboundSchema=t0.object({name:t0.string(),labels:t0.array(t0.string()),weight:t0.number().default(1),loss_function:t0.nullable(sOr.FTClassifierLossFunction$inboundSchema).optional()}).transform(t=>(0,aOr.remap)(t,{loss_function:"lossFunction"}));ff.ClassifierTargetIn$outboundSchema=t0.object({name:t0.string(),labels:t0.array(t0.string()),weight:t0.number().default(1),lossFunction:t0.nullable(sOr.FTClassifierLossFunction$outboundSchema).optional()}).transform(t=>(0,aOr.remap)(t,{lossFunction:"loss_function"}));var iOr;(function(t){t.inboundSchema=ff.ClassifierTargetIn$inboundSchema,t.outboundSchema=ff.ClassifierTargetIn$outboundSchema})(iOr||(ff.ClassifierTargetIn$=iOr={}));function ZCo(t){return JSON.stringify(ff.ClassifierTargetIn$outboundSchema.parse(t))}function YCo(t){return(0,XCo.safeParse)(t,e=>ff.ClassifierTargetIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTargetIn' from JSON")}});var out=S(pf=>{"use strict";var QCo=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]}),exo=pf&&pf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),txo=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"&&QCo(r,e,n[o]);return exo(r,e),r}}();Object.defineProperty(pf,"__esModule",{value:!0});pf.ClassifierTrainingParametersIn$=pf.ClassifierTrainingParametersIn$outboundSchema=pf.ClassifierTrainingParametersIn$inboundSchema=void 0;pf.classifierTrainingParametersInToJSON=nxo;pf.classifierTrainingParametersInFromJSON=oxo;var Wl=txo(Q()),lOr=le(),rxo=Z();pf.ClassifierTrainingParametersIn$inboundSchema=Wl.object({training_steps:Wl.nullable(Wl.number().int()).optional(),learning_rate:Wl.number().default(1e-4),weight_decay:Wl.nullable(Wl.number()).optional(),warmup_fraction:Wl.nullable(Wl.number()).optional(),epochs:Wl.nullable(Wl.number()).optional(),seq_len:Wl.nullable(Wl.number().int()).optional()}).transform(t=>(0,lOr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen"}));pf.ClassifierTrainingParametersIn$outboundSchema=Wl.object({trainingSteps:Wl.nullable(Wl.number().int()).optional(),learningRate:Wl.number().default(1e-4),weightDecay:Wl.nullable(Wl.number()).optional(),warmupFraction:Wl.nullable(Wl.number()).optional(),epochs:Wl.nullable(Wl.number()).optional(),seqLen:Wl.nullable(Wl.number().int()).optional()}).transform(t=>(0,lOr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len"}));var uOr;(function(t){t.inboundSchema=pf.ClassifierTrainingParametersIn$inboundSchema,t.outboundSchema=pf.ClassifierTrainingParametersIn$outboundSchema})(uOr||(pf.ClassifierTrainingParametersIn$=uOr={}));function nxo(t){return JSON.stringify(pf.ClassifierTrainingParametersIn$outboundSchema.parse(t))}function oxo(t){return(0,rxo.safeParse)(t,e=>pf.ClassifierTrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTrainingParametersIn' from JSON")}});var iut=S(gs=>{"use strict";var ixo=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]}),axo=gs&&gs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sxo=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"&&ixo(r,e,n[o]);return axo(r,e),r}}();Object.defineProperty(gs,"__esModule",{value:!0});gs.DeltaMessage$=gs.DeltaMessage$outboundSchema=gs.DeltaMessage$inboundSchema=gs.Content$=gs.Content$outboundSchema=gs.Content$inboundSchema=void 0;gs.contentToJSON=uxo;gs.contentFromJSON=lxo;gs.deltaMessageToJSON=cxo;gs.deltaMessageFromJSON=dxo;var Kl=sxo(Q()),fOr=le(),pOr=Z(),HMe=s9(),mOr=LPe();gs.Content$inboundSchema=Kl.union([Kl.string(),Kl.array(HMe.ContentChunk$inboundSchema)]);gs.Content$outboundSchema=Kl.union([Kl.string(),Kl.array(HMe.ContentChunk$outboundSchema)]);var cOr;(function(t){t.inboundSchema=gs.Content$inboundSchema,t.outboundSchema=gs.Content$outboundSchema})(cOr||(gs.Content$=cOr={}));function uxo(t){return JSON.stringify(gs.Content$outboundSchema.parse(t))}function lxo(t){return(0,pOr.safeParse)(t,e=>gs.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}gs.DeltaMessage$inboundSchema=Kl.object({role:Kl.nullable(Kl.string()).optional(),content:Kl.nullable(Kl.union([Kl.string(),Kl.array(HMe.ContentChunk$inboundSchema)])).optional(),tool_calls:Kl.nullable(Kl.array(mOr.ToolCall$inboundSchema)).optional()}).transform(t=>(0,fOr.remap)(t,{tool_calls:"toolCalls"}));gs.DeltaMessage$outboundSchema=Kl.object({role:Kl.nullable(Kl.string()).optional(),content:Kl.nullable(Kl.union([Kl.string(),Kl.array(HMe.ContentChunk$outboundSchema)])).optional(),toolCalls:Kl.nullable(Kl.array(mOr.ToolCall$outboundSchema)).optional()}).transform(t=>(0,fOr.remap)(t,{toolCalls:"tool_calls"}));var dOr;(function(t){t.inboundSchema=gs.DeltaMessage$inboundSchema,t.outboundSchema=gs.DeltaMessage$outboundSchema})(dOr||(gs.DeltaMessage$=dOr={}));function cxo(t){return JSON.stringify(gs.DeltaMessage$outboundSchema.parse(t))}function dxo(t){return(0,pOr.safeParse)(t,e=>gs.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var aut=S(va=>{"use strict";var fxo=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]}),pxo=va&&va.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mxo=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"&&fxo(r,e,n[o]);return pxo(r,e),r}}();Object.defineProperty(va,"__esModule",{value:!0});va.CompletionResponseStreamChoice$=va.CompletionResponseStreamChoice$outboundSchema=va.CompletionResponseStreamChoice$inboundSchema=va.CompletionResponseStreamChoiceFinishReason$=va.CompletionResponseStreamChoiceFinishReason$outboundSchema=va.CompletionResponseStreamChoiceFinishReason$inboundSchema=va.CompletionResponseStreamChoiceFinishReason=void 0;va.completionResponseStreamChoiceToJSON=yxo;va.completionResponseStreamChoiceFromJSON=bxo;var iw=mxo(Q()),yOr=le(),hxo=Z(),gxo=XC(),bOr=iut();va.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};va.CompletionResponseStreamChoiceFinishReason$inboundSchema=iw.union([iw.nativeEnum(va.CompletionResponseStreamChoiceFinishReason),iw.string().transform(gxo.catchUnrecognizedEnum)]);va.CompletionResponseStreamChoiceFinishReason$outboundSchema=iw.union([iw.nativeEnum(va.CompletionResponseStreamChoiceFinishReason),iw.string().and(iw.custom())]);var hOr;(function(t){t.inboundSchema=va.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=va.CompletionResponseStreamChoiceFinishReason$outboundSchema})(hOr||(va.CompletionResponseStreamChoiceFinishReason$=hOr={}));va.CompletionResponseStreamChoice$inboundSchema=iw.object({index:iw.number().int(),delta:bOr.DeltaMessage$inboundSchema,finish_reason:iw.nullable(va.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,yOr.remap)(t,{finish_reason:"finishReason"}));va.CompletionResponseStreamChoice$outboundSchema=iw.object({index:iw.number().int(),delta:bOr.DeltaMessage$outboundSchema,finishReason:iw.nullable(va.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,yOr.remap)(t,{finishReason:"finish_reason"}));var gOr;(function(t){t.inboundSchema=va.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=va.CompletionResponseStreamChoice$outboundSchema})(gOr||(va.CompletionResponseStreamChoice$=gOr={}));function yxo(t){return JSON.stringify(va.CompletionResponseStreamChoice$outboundSchema.parse(t))}function bxo(t){return(0,hxo.safeParse)(t,e=>va.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var sut=S(mf=>{"use strict";var _xo=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]}),vxo=mf&&mf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wxo=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"&&_xo(r,e,n[o]);return vxo(r,e),r}}();Object.defineProperty(mf,"__esModule",{value:!0});mf.CompletionChunk$=mf.CompletionChunk$outboundSchema=mf.CompletionChunk$inboundSchema=void 0;mf.completionChunkToJSON=Cxo;mf.completionChunkFromJSON=xxo;var r0=wxo(Q()),Sxo=Z(),vOr=aut(),wOr=eq();mf.CompletionChunk$inboundSchema=r0.object({id:r0.string(),object:r0.string().optional(),created:r0.number().int().optional(),model:r0.string(),usage:wOr.UsageInfo$inboundSchema.optional(),choices:r0.array(vOr.CompletionResponseStreamChoice$inboundSchema)});mf.CompletionChunk$outboundSchema=r0.object({id:r0.string(),object:r0.string().optional(),created:r0.number().int().optional(),model:r0.string(),usage:wOr.UsageInfo$outboundSchema.optional(),choices:r0.array(vOr.CompletionResponseStreamChoice$outboundSchema)});var _Or;(function(t){t.inboundSchema=mf.CompletionChunk$inboundSchema,t.outboundSchema=mf.CompletionChunk$outboundSchema})(_Or||(mf.CompletionChunk$=_Or={}));function Cxo(t){return JSON.stringify(mf.CompletionChunk$outboundSchema.parse(t))}function xxo(t){return(0,Sxo.safeParse)(t,e=>mf.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var JMe=S(hf=>{"use strict";var Oxo=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]}),Txo=hf&&hf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Exo=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"&&Oxo(r,e,n[o]);return Txo(r,e),r}}();Object.defineProperty(hf,"__esModule",{value:!0});hf.CompletionTrainingParameters$=hf.CompletionTrainingParameters$outboundSchema=hf.CompletionTrainingParameters$inboundSchema=void 0;hf.completionTrainingParametersToJSON=Mxo;hf.completionTrainingParametersFromJSON=Ixo;var gu=Exo(Q()),COr=le(),Pxo=Z();hf.CompletionTrainingParameters$inboundSchema=gu.object({training_steps:gu.nullable(gu.number().int()).optional(),learning_rate:gu.number().default(1e-4),weight_decay:gu.nullable(gu.number()).optional(),warmup_fraction:gu.nullable(gu.number()).optional(),epochs:gu.nullable(gu.number()).optional(),seq_len:gu.nullable(gu.number().int()).optional(),fim_ratio:gu.nullable(gu.number()).optional()}).transform(t=>(0,COr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen",fim_ratio:"fimRatio"}));hf.CompletionTrainingParameters$outboundSchema=gu.object({trainingSteps:gu.nullable(gu.number().int()).optional(),learningRate:gu.number().default(1e-4),weightDecay:gu.nullable(gu.number()).optional(),warmupFraction:gu.nullable(gu.number()).optional(),epochs:gu.nullable(gu.number()).optional(),seqLen:gu.nullable(gu.number().int()).optional(),fimRatio:gu.nullable(gu.number()).optional()}).transform(t=>(0,COr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len",fimRatio:"fim_ratio"}));var SOr;(function(t){t.inboundSchema=hf.CompletionTrainingParameters$inboundSchema,t.outboundSchema=hf.CompletionTrainingParameters$outboundSchema})(SOr||(hf.CompletionTrainingParameters$=SOr={}));function Mxo(t){return JSON.stringify(hf.CompletionTrainingParameters$outboundSchema.parse(t))}function Ixo(t){return(0,Pxo.safeParse)(t,e=>hf.CompletionTrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionTrainingParameters' from JSON")}});var WMe=S(wa=>{"use strict";var Rxo=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]}),Axo=wa&&wa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nxo=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"&&Rxo(r,e,n[o]);return Axo(r,e),r}}();Object.defineProperty(wa,"__esModule",{value:!0});wa.GithubRepositoryOut$=wa.GithubRepositoryOut$outboundSchema=wa.GithubRepositoryOut$inboundSchema=wa.GithubRepositoryOutType$=wa.GithubRepositoryOutType$outboundSchema=wa.GithubRepositoryOutType$inboundSchema=wa.GithubRepositoryOutType=void 0;wa.githubRepositoryOutToJSON=Dxo;wa.githubRepositoryOutFromJSON=$xo;var Cb=Nxo(Q()),TOr=le(),jxo=Z();wa.GithubRepositoryOutType={Github:"github"};wa.GithubRepositoryOutType$inboundSchema=Cb.nativeEnum(wa.GithubRepositoryOutType);wa.GithubRepositoryOutType$outboundSchema=wa.GithubRepositoryOutType$inboundSchema;var xOr;(function(t){t.inboundSchema=wa.GithubRepositoryOutType$inboundSchema,t.outboundSchema=wa.GithubRepositoryOutType$outboundSchema})(xOr||(wa.GithubRepositoryOutType$=xOr={}));wa.GithubRepositoryOut$inboundSchema=Cb.object({type:wa.GithubRepositoryOutType$inboundSchema.default("github"),name:Cb.string(),owner:Cb.string(),ref:Cb.nullable(Cb.string()).optional(),weight:Cb.number().default(1),commit_id:Cb.string()}).transform(t=>(0,TOr.remap)(t,{commit_id:"commitId"}));wa.GithubRepositoryOut$outboundSchema=Cb.object({type:wa.GithubRepositoryOutType$outboundSchema.default("github"),name:Cb.string(),owner:Cb.string(),ref:Cb.nullable(Cb.string()).optional(),weight:Cb.number().default(1),commitId:Cb.string()}).transform(t=>(0,TOr.remap)(t,{commitId:"commit_id"}));var OOr;(function(t){t.inboundSchema=wa.GithubRepositoryOut$inboundSchema,t.outboundSchema=wa.GithubRepositoryOut$outboundSchema})(OOr||(wa.GithubRepositoryOut$=OOr={}));function Dxo(t){return JSON.stringify(wa.GithubRepositoryOut$outboundSchema.parse(t))}function $xo(t){return(0,jxo.safeParse)(t,e=>wa.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var FOr=S(Ot=>{"use strict";var Lxo=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]}),Fxo=Ot&&Ot.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kxo=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"&&Lxo(r,e,n[o]);return Fxo(r,e),r}}();Object.defineProperty(Ot,"__esModule",{value:!0});Ot.CompletionDetailedJobOut$=Ot.CompletionDetailedJobOut$outboundSchema=Ot.CompletionDetailedJobOut$inboundSchema=Ot.CompletionDetailedJobOutRepositories$=Ot.CompletionDetailedJobOutRepositories$outboundSchema=Ot.CompletionDetailedJobOutRepositories$inboundSchema=Ot.CompletionDetailedJobOutJobType$=Ot.CompletionDetailedJobOutJobType$outboundSchema=Ot.CompletionDetailedJobOutJobType$inboundSchema=Ot.CompletionDetailedJobOutIntegrations$=Ot.CompletionDetailedJobOutIntegrations$outboundSchema=Ot.CompletionDetailedJobOutIntegrations$inboundSchema=Ot.CompletionDetailedJobOutObject$=Ot.CompletionDetailedJobOutObject$outboundSchema=Ot.CompletionDetailedJobOutObject$inboundSchema=Ot.CompletionDetailedJobOutStatus$=Ot.CompletionDetailedJobOutStatus$outboundSchema=Ot.CompletionDetailedJobOutStatus$inboundSchema=Ot.CompletionDetailedJobOutJobType=Ot.CompletionDetailedJobOutObject=Ot.CompletionDetailedJobOutStatus=void 0;Ot.completionDetailedJobOutIntegrationsToJSON=qxo;Ot.completionDetailedJobOutIntegrationsFromJSON=Uxo;Ot.completionDetailedJobOutRepositoriesToJSON=Bxo;Ot.completionDetailedJobOutRepositoriesFromJSON=zxo;Ot.completionDetailedJobOutToJSON=Vxo;Ot.completionDetailedJobOutFromJSON=Hxo;var $n=kxo(Q()),NOr=le(),uut=Z(),jOr=LMe(),DOr=JMe(),$Or=UMe(),KMe=WMe(),LOr=h9(),GMe=g9();Ot.CompletionDetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Ot.CompletionDetailedJobOutObject={Job:"job"};Ot.CompletionDetailedJobOutJobType={Completion:"completion"};Ot.CompletionDetailedJobOutStatus$inboundSchema=$n.nativeEnum(Ot.CompletionDetailedJobOutStatus);Ot.CompletionDetailedJobOutStatus$outboundSchema=Ot.CompletionDetailedJobOutStatus$inboundSchema;var EOr;(function(t){t.inboundSchema=Ot.CompletionDetailedJobOutStatus$inboundSchema,t.outboundSchema=Ot.CompletionDetailedJobOutStatus$outboundSchema})(EOr||(Ot.CompletionDetailedJobOutStatus$=EOr={}));Ot.CompletionDetailedJobOutObject$inboundSchema=$n.nativeEnum(Ot.CompletionDetailedJobOutObject);Ot.CompletionDetailedJobOutObject$outboundSchema=Ot.CompletionDetailedJobOutObject$inboundSchema;var POr;(function(t){t.inboundSchema=Ot.CompletionDetailedJobOutObject$inboundSchema,t.outboundSchema=Ot.CompletionDetailedJobOutObject$outboundSchema})(POr||(Ot.CompletionDetailedJobOutObject$=POr={}));Ot.CompletionDetailedJobOutIntegrations$inboundSchema=GMe.WandbIntegrationOut$inboundSchema;Ot.CompletionDetailedJobOutIntegrations$outboundSchema=GMe.WandbIntegrationOut$outboundSchema;var MOr;(function(t){t.inboundSchema=Ot.CompletionDetailedJobOutIntegrations$inboundSchema,t.outboundSchema=Ot.CompletionDetailedJobOutIntegrations$outboundSchema})(MOr||(Ot.CompletionDetailedJobOutIntegrations$=MOr={}));function qxo(t){return JSON.stringify(Ot.CompletionDetailedJobOutIntegrations$outboundSchema.parse(t))}function Uxo(t){return(0,uut.safeParse)(t,e=>Ot.CompletionDetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOutIntegrations' from JSON")}Ot.CompletionDetailedJobOutJobType$inboundSchema=$n.nativeEnum(Ot.CompletionDetailedJobOutJobType);Ot.CompletionDetailedJobOutJobType$outboundSchema=Ot.CompletionDetailedJobOutJobType$inboundSchema;var IOr;(function(t){t.inboundSchema=Ot.CompletionDetailedJobOutJobType$inboundSchema,t.outboundSchema=Ot.CompletionDetailedJobOutJobType$outboundSchema})(IOr||(Ot.CompletionDetailedJobOutJobType$=IOr={}));Ot.CompletionDetailedJobOutRepositories$inboundSchema=KMe.GithubRepositoryOut$inboundSchema;Ot.CompletionDetailedJobOutRepositories$outboundSchema=KMe.GithubRepositoryOut$outboundSchema;var ROr;(function(t){t.inboundSchema=Ot.CompletionDetailedJobOutRepositories$inboundSchema,t.outboundSchema=Ot.CompletionDetailedJobOutRepositories$outboundSchema})(ROr||(Ot.CompletionDetailedJobOutRepositories$=ROr={}));function Bxo(t){return JSON.stringify(Ot.CompletionDetailedJobOutRepositories$outboundSchema.parse(t))}function zxo(t){return(0,uut.safeParse)(t,e=>Ot.CompletionDetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOutRepositories' from JSON")}Ot.CompletionDetailedJobOut$inboundSchema=$n.object({id:$n.string(),auto_start:$n.boolean(),model:$n.string(),status:Ot.CompletionDetailedJobOutStatus$inboundSchema,created_at:$n.number().int(),modified_at:$n.number().int(),training_files:$n.array($n.string()),validation_files:$n.nullable($n.array($n.string())).optional(),object:Ot.CompletionDetailedJobOutObject$inboundSchema.default("job"),fine_tuned_model:$n.nullable($n.string()).optional(),suffix:$n.nullable($n.string()).optional(),integrations:$n.nullable($n.array(GMe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:$n.nullable($n.number().int()).optional(),metadata:$n.nullable(LOr.JobMetadataOut$inboundSchema).optional(),job_type:Ot.CompletionDetailedJobOutJobType$inboundSchema.default("completion"),hyperparameters:DOr.CompletionTrainingParameters$inboundSchema,repositories:$n.array(KMe.GithubRepositoryOut$inboundSchema).optional(),events:$n.array($Or.EventOut$inboundSchema).optional(),checkpoints:$n.array(jOr.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,NOr.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.CompletionDetailedJobOut$outboundSchema=$n.object({id:$n.string(),autoStart:$n.boolean(),model:$n.string(),status:Ot.CompletionDetailedJobOutStatus$outboundSchema,createdAt:$n.number().int(),modifiedAt:$n.number().int(),trainingFiles:$n.array($n.string()),validationFiles:$n.nullable($n.array($n.string())).optional(),object:Ot.CompletionDetailedJobOutObject$outboundSchema.default("job"),fineTunedModel:$n.nullable($n.string()).optional(),suffix:$n.nullable($n.string()).optional(),integrations:$n.nullable($n.array(GMe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:$n.nullable($n.number().int()).optional(),metadata:$n.nullable(LOr.JobMetadataOut$outboundSchema).optional(),jobType:Ot.CompletionDetailedJobOutJobType$outboundSchema.default("completion"),hyperparameters:DOr.CompletionTrainingParameters$outboundSchema,repositories:$n.array(KMe.GithubRepositoryOut$outboundSchema).optional(),events:$n.array($Or.EventOut$outboundSchema).optional(),checkpoints:$n.array(jOr.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,NOr.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 AOr;(function(t){t.inboundSchema=Ot.CompletionDetailedJobOut$inboundSchema,t.outboundSchema=Ot.CompletionDetailedJobOut$outboundSchema})(AOr||(Ot.CompletionDetailedJobOut$=AOr={}));function Vxo(t){return JSON.stringify(Ot.CompletionDetailedJobOut$outboundSchema.parse(t))}function Hxo(t){return(0,uut.safeParse)(t,e=>Ot.CompletionDetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOut' from JSON")}});var UOr=S(gf=>{"use strict";var Jxo=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]}),Wxo=gf&&gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kxo=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"&&Jxo(r,e,n[o]);return Wxo(r,e),r}}();Object.defineProperty(gf,"__esModule",{value:!0});gf.CompletionEvent$=gf.CompletionEvent$outboundSchema=gf.CompletionEvent$inboundSchema=void 0;gf.completionEventToJSON=Xxo;gf.completionEventFromJSON=Zxo;var Nae=Kxo(Q()),Gxo=Z(),qOr=sut();gf.CompletionEvent$inboundSchema=Nae.object({data:Nae.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:Nae.ZodIssueCode.custom,message:`malformed json: ${r}`}),Nae.NEVER}}).pipe(qOr.CompletionChunk$inboundSchema)});gf.CompletionEvent$outboundSchema=Nae.object({data:qOr.CompletionChunk$outboundSchema});var kOr;(function(t){t.inboundSchema=gf.CompletionEvent$inboundSchema,t.outboundSchema=gf.CompletionEvent$outboundSchema})(kOr||(gf.CompletionEvent$=kOr={}));function Xxo(t){return JSON.stringify(gf.CompletionEvent$outboundSchema.parse(t))}function Zxo(t){return(0,Gxo.safeParse)(t,e=>gf.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var WOr=S(Hn=>{"use strict";var Yxo=Hn&&Hn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Hn&&Hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eOo=Hn&&Hn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(Hn,"__esModule",{value:!0});Hn.CompletionFTModelOut$=Hn.CompletionFTModelOut$outboundSchema=Hn.CompletionFTModelOut$inboundSchema=Hn.ModelType$=Hn.ModelType$outboundSchema=Hn.ModelType$inboundSchema=Hn.CompletionFTModelOutObject$=Hn.CompletionFTModelOutObject$outboundSchema=Hn.CompletionFTModelOutObject$inboundSchema=Hn.ModelType=Hn.CompletionFTModelOutObject=void 0;Hn.completionFTModelOutToJSON=rOo;Hn.completionFTModelOutFromJSON=nOo;var Sa=eOo(Q()),HOr=le(),tOo=Z(),JOr=zMe();Hn.CompletionFTModelOutObject={Model:"model"};Hn.ModelType={Completion:"completion"};Hn.CompletionFTModelOutObject$inboundSchema=Sa.nativeEnum(Hn.CompletionFTModelOutObject);Hn.CompletionFTModelOutObject$outboundSchema=Hn.CompletionFTModelOutObject$inboundSchema;var BOr;(function(t){t.inboundSchema=Hn.CompletionFTModelOutObject$inboundSchema,t.outboundSchema=Hn.CompletionFTModelOutObject$outboundSchema})(BOr||(Hn.CompletionFTModelOutObject$=BOr={}));Hn.ModelType$inboundSchema=Sa.nativeEnum(Hn.ModelType);Hn.ModelType$outboundSchema=Hn.ModelType$inboundSchema;var zOr;(function(t){t.inboundSchema=Hn.ModelType$inboundSchema,t.outboundSchema=Hn.ModelType$outboundSchema})(zOr||(Hn.ModelType$=zOr={}));Hn.CompletionFTModelOut$inboundSchema=Sa.object({id:Sa.string(),object:Hn.CompletionFTModelOutObject$inboundSchema.default("model"),created:Sa.number().int(),owned_by:Sa.string(),workspace_id:Sa.string(),root:Sa.string(),root_version:Sa.string(),archived:Sa.boolean(),name:Sa.nullable(Sa.string()).optional(),description:Sa.nullable(Sa.string()).optional(),capabilities:JOr.FTModelCapabilitiesOut$inboundSchema,max_context_length:Sa.number().int().default(32768),aliases:Sa.array(Sa.string()).optional(),job:Sa.string(),model_type:Hn.ModelType$inboundSchema.default("completion")}).transform(t=>(0,HOr.remap)(t,{owned_by:"ownedBy",workspace_id:"workspaceId",root_version:"rootVersion",max_context_length:"maxContextLength",model_type:"modelType"}));Hn.CompletionFTModelOut$outboundSchema=Sa.object({id:Sa.string(),object:Hn.CompletionFTModelOutObject$outboundSchema.default("model"),created:Sa.number().int(),ownedBy:Sa.string(),workspaceId:Sa.string(),root:Sa.string(),rootVersion:Sa.string(),archived:Sa.boolean(),name:Sa.nullable(Sa.string()).optional(),description:Sa.nullable(Sa.string()).optional(),capabilities:JOr.FTModelCapabilitiesOut$outboundSchema,maxContextLength:Sa.number().int().default(32768),aliases:Sa.array(Sa.string()).optional(),job:Sa.string(),modelType:Hn.ModelType$outboundSchema.default("completion")}).transform(t=>(0,HOr.remap)(t,{ownedBy:"owned_by",workspaceId:"workspace_id",rootVersion:"root_version",maxContextLength:"max_context_length",modelType:"model_type"}));var VOr;(function(t){t.inboundSchema=Hn.CompletionFTModelOut$inboundSchema,t.outboundSchema=Hn.CompletionFTModelOut$outboundSchema})(VOr||(Hn.CompletionFTModelOut$=VOr={}));function rOo(t){return JSON.stringify(Hn.CompletionFTModelOut$outboundSchema.parse(t))}function nOo(t){return(0,tOo.safeParse)(t,e=>Hn.CompletionFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionFTModelOut' from JSON")}});var cut=S(Tt=>{"use strict";var oOo=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]}),iOo=Tt&&Tt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aOo=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"&&oOo(r,e,n[o]);return iOo(r,e),r}}();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.CompletionJobOut$=Tt.CompletionJobOut$outboundSchema=Tt.CompletionJobOut$inboundSchema=Tt.Repositories$=Tt.Repositories$outboundSchema=Tt.Repositories$inboundSchema=Tt.JobType$=Tt.JobType$outboundSchema=Tt.JobType$inboundSchema=Tt.Integrations$=Tt.Integrations$outboundSchema=Tt.Integrations$inboundSchema=Tt.CompletionJobOutObject$=Tt.CompletionJobOutObject$outboundSchema=Tt.CompletionJobOutObject$inboundSchema=Tt.Status$=Tt.Status$outboundSchema=Tt.Status$inboundSchema=Tt.JobType=Tt.CompletionJobOutObject=Tt.Status=void 0;Tt.integrationsToJSON=sOo;Tt.integrationsFromJSON=uOo;Tt.repositoriesToJSON=lOo;Tt.repositoriesFromJSON=cOo;Tt.completionJobOutToJSON=dOo;Tt.completionJobOutFromJSON=fOo;var Io=aOo(Q()),eTr=le(),lut=Z(),tTr=JMe(),XMe=WMe(),rTr=h9(),ZMe=g9();Tt.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Tt.CompletionJobOutObject={Job:"job"};Tt.JobType={Completion:"completion"};Tt.Status$inboundSchema=Io.nativeEnum(Tt.Status);Tt.Status$outboundSchema=Tt.Status$inboundSchema;var KOr;(function(t){t.inboundSchema=Tt.Status$inboundSchema,t.outboundSchema=Tt.Status$outboundSchema})(KOr||(Tt.Status$=KOr={}));Tt.CompletionJobOutObject$inboundSchema=Io.nativeEnum(Tt.CompletionJobOutObject);Tt.CompletionJobOutObject$outboundSchema=Tt.CompletionJobOutObject$inboundSchema;var GOr;(function(t){t.inboundSchema=Tt.CompletionJobOutObject$inboundSchema,t.outboundSchema=Tt.CompletionJobOutObject$outboundSchema})(GOr||(Tt.CompletionJobOutObject$=GOr={}));Tt.Integrations$inboundSchema=ZMe.WandbIntegrationOut$inboundSchema;Tt.Integrations$outboundSchema=ZMe.WandbIntegrationOut$outboundSchema;var XOr;(function(t){t.inboundSchema=Tt.Integrations$inboundSchema,t.outboundSchema=Tt.Integrations$outboundSchema})(XOr||(Tt.Integrations$=XOr={}));function sOo(t){return JSON.stringify(Tt.Integrations$outboundSchema.parse(t))}function uOo(t){return(0,lut.safeParse)(t,e=>Tt.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}Tt.JobType$inboundSchema=Io.nativeEnum(Tt.JobType);Tt.JobType$outboundSchema=Tt.JobType$inboundSchema;var ZOr;(function(t){t.inboundSchema=Tt.JobType$inboundSchema,t.outboundSchema=Tt.JobType$outboundSchema})(ZOr||(Tt.JobType$=ZOr={}));Tt.Repositories$inboundSchema=XMe.GithubRepositoryOut$inboundSchema;Tt.Repositories$outboundSchema=XMe.GithubRepositoryOut$outboundSchema;var YOr;(function(t){t.inboundSchema=Tt.Repositories$inboundSchema,t.outboundSchema=Tt.Repositories$outboundSchema})(YOr||(Tt.Repositories$=YOr={}));function lOo(t){return JSON.stringify(Tt.Repositories$outboundSchema.parse(t))}function cOo(t){return(0,lut.safeParse)(t,e=>Tt.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}Tt.CompletionJobOut$inboundSchema=Io.object({id:Io.string(),auto_start:Io.boolean(),model:Io.string(),status:Tt.Status$inboundSchema,created_at:Io.number().int(),modified_at:Io.number().int(),training_files:Io.array(Io.string()),validation_files:Io.nullable(Io.array(Io.string())).optional(),object:Tt.CompletionJobOutObject$inboundSchema.default("job"),fine_tuned_model:Io.nullable(Io.string()).optional(),suffix:Io.nullable(Io.string()).optional(),integrations:Io.nullable(Io.array(ZMe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Io.nullable(Io.number().int()).optional(),metadata:Io.nullable(rTr.JobMetadataOut$inboundSchema).optional(),job_type:Tt.JobType$inboundSchema.default("completion"),hyperparameters:tTr.CompletionTrainingParameters$inboundSchema,repositories:Io.array(XMe.GithubRepositoryOut$inboundSchema).optional()}).transform(t=>(0,eTr.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.CompletionJobOut$outboundSchema=Io.object({id:Io.string(),autoStart:Io.boolean(),model:Io.string(),status:Tt.Status$outboundSchema,createdAt:Io.number().int(),modifiedAt:Io.number().int(),trainingFiles:Io.array(Io.string()),validationFiles:Io.nullable(Io.array(Io.string())).optional(),object:Tt.CompletionJobOutObject$outboundSchema.default("job"),fineTunedModel:Io.nullable(Io.string()).optional(),suffix:Io.nullable(Io.string()).optional(),integrations:Io.nullable(Io.array(ZMe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Io.nullable(Io.number().int()).optional(),metadata:Io.nullable(rTr.JobMetadataOut$outboundSchema).optional(),jobType:Tt.JobType$outboundSchema.default("completion"),hyperparameters:tTr.CompletionTrainingParameters$outboundSchema,repositories:Io.array(XMe.GithubRepositoryOut$outboundSchema).optional()}).transform(t=>(0,eTr.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=Tt.CompletionJobOut$inboundSchema,t.outboundSchema=Tt.CompletionJobOut$outboundSchema})(QOr||(Tt.CompletionJobOut$=QOr={}));function dOo(t){return JSON.stringify(Tt.CompletionJobOut$outboundSchema.parse(t))}function fOo(t){return(0,lut.safeParse)(t,e=>Tt.CompletionJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionJobOut' from JSON")}});var dut=S(yf=>{"use strict";var pOo=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]}),mOo=yf&&yf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hOo=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"&&pOo(r,e,n[o]);return mOo(r,e),r}}();Object.defineProperty(yf,"__esModule",{value:!0});yf.CompletionTrainingParametersIn$=yf.CompletionTrainingParametersIn$outboundSchema=yf.CompletionTrainingParametersIn$inboundSchema=void 0;yf.completionTrainingParametersInToJSON=yOo;yf.completionTrainingParametersInFromJSON=bOo;var yu=hOo(Q()),oTr=le(),gOo=Z();yf.CompletionTrainingParametersIn$inboundSchema=yu.object({training_steps:yu.nullable(yu.number().int()).optional(),learning_rate:yu.number().default(1e-4),weight_decay:yu.nullable(yu.number()).optional(),warmup_fraction:yu.nullable(yu.number()).optional(),epochs:yu.nullable(yu.number()).optional(),seq_len:yu.nullable(yu.number().int()).optional(),fim_ratio:yu.nullable(yu.number()).optional()}).transform(t=>(0,oTr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen",fim_ratio:"fimRatio"}));yf.CompletionTrainingParametersIn$outboundSchema=yu.object({trainingSteps:yu.nullable(yu.number().int()).optional(),learningRate:yu.number().default(1e-4),weightDecay:yu.nullable(yu.number()).optional(),warmupFraction:yu.nullable(yu.number()).optional(),epochs:yu.nullable(yu.number()).optional(),seqLen:yu.nullable(yu.number().int()).optional(),fimRatio:yu.nullable(yu.number()).optional()}).transform(t=>(0,oTr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len",fimRatio:"fim_ratio"}));var nTr;(function(t){t.inboundSchema=yf.CompletionTrainingParametersIn$inboundSchema,t.outboundSchema=yf.CompletionTrainingParametersIn$outboundSchema})(nTr||(yf.CompletionTrainingParametersIn$=nTr={}));function yOo(t){return JSON.stringify(yf.CompletionTrainingParametersIn$outboundSchema.parse(t))}function bOo(t){return(0,gOo.safeParse)(t,e=>yf.CompletionTrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionTrainingParametersIn' from JSON")}});var fut=S(bf=>{"use strict";var _Oo=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]}),vOo=bf&&bf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wOo=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"&&_Oo(r,e,n[o]);return vOo(r,e),r}}();Object.defineProperty(bf,"__esModule",{value:!0});bf.FunctionCallEntryArguments$=bf.FunctionCallEntryArguments$outboundSchema=bf.FunctionCallEntryArguments$inboundSchema=void 0;bf.functionCallEntryArgumentsToJSON=COo;bf.functionCallEntryArgumentsFromJSON=xOo;var tq=wOo(Q()),SOo=Z();bf.FunctionCallEntryArguments$inboundSchema=tq.union([tq.record(tq.any()),tq.string()]);bf.FunctionCallEntryArguments$outboundSchema=tq.union([tq.record(tq.any()),tq.string()]);var iTr;(function(t){t.inboundSchema=bf.FunctionCallEntryArguments$inboundSchema,t.outboundSchema=bf.FunctionCallEntryArguments$outboundSchema})(iTr||(bf.FunctionCallEntryArguments$=iTr={}));function COo(t){return JSON.stringify(bf.FunctionCallEntryArguments$outboundSchema.parse(t))}function xOo(t){return(0,SOo.safeParse)(t,e=>bf.FunctionCallEntryArguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEntryArguments' from JSON")}});var jae=S(Jn=>{"use strict";var OOo=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]}),TOo=Jn&&Jn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EOo=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"&&OOo(r,e,n[o]);return TOo(r,e),r}}();Object.defineProperty(Jn,"__esModule",{value:!0});Jn.FunctionCallEntry$=Jn.FunctionCallEntry$outboundSchema=Jn.FunctionCallEntry$inboundSchema=Jn.FunctionCallEntryType$=Jn.FunctionCallEntryType$outboundSchema=Jn.FunctionCallEntryType$inboundSchema=Jn.FunctionCallEntryObject$=Jn.FunctionCallEntryObject$outboundSchema=Jn.FunctionCallEntryObject$inboundSchema=Jn.FunctionCallEntryType=Jn.FunctionCallEntryObject=void 0;Jn.functionCallEntryToJSON=MOo;Jn.functionCallEntryFromJSON=IOo;var Oy=EOo(Q()),lTr=le(),POo=Z(),cTr=fut();Jn.FunctionCallEntryObject={Entry:"entry"};Jn.FunctionCallEntryType={FunctionCall:"function.call"};Jn.FunctionCallEntryObject$inboundSchema=Oy.nativeEnum(Jn.FunctionCallEntryObject);Jn.FunctionCallEntryObject$outboundSchema=Jn.FunctionCallEntryObject$inboundSchema;var aTr;(function(t){t.inboundSchema=Jn.FunctionCallEntryObject$inboundSchema,t.outboundSchema=Jn.FunctionCallEntryObject$outboundSchema})(aTr||(Jn.FunctionCallEntryObject$=aTr={}));Jn.FunctionCallEntryType$inboundSchema=Oy.nativeEnum(Jn.FunctionCallEntryType);Jn.FunctionCallEntryType$outboundSchema=Jn.FunctionCallEntryType$inboundSchema;var sTr;(function(t){t.inboundSchema=Jn.FunctionCallEntryType$inboundSchema,t.outboundSchema=Jn.FunctionCallEntryType$outboundSchema})(sTr||(Jn.FunctionCallEntryType$=sTr={}));Jn.FunctionCallEntry$inboundSchema=Oy.object({object:Jn.FunctionCallEntryObject$inboundSchema.default("entry"),type:Jn.FunctionCallEntryType$inboundSchema.default("function.call"),created_at:Oy.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Oy.nullable(Oy.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Oy.string().optional(),tool_call_id:Oy.string(),name:Oy.string(),arguments:cTr.FunctionCallEntryArguments$inboundSchema}).transform(t=>(0,lTr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",tool_call_id:"toolCallId"}));Jn.FunctionCallEntry$outboundSchema=Oy.object({object:Jn.FunctionCallEntryObject$outboundSchema.default("entry"),type:Jn.FunctionCallEntryType$outboundSchema.default("function.call"),createdAt:Oy.date().transform(t=>t.toISOString()).optional(),completedAt:Oy.nullable(Oy.date().transform(t=>t.toISOString())).optional(),id:Oy.string().optional(),toolCallId:Oy.string(),name:Oy.string(),arguments:cTr.FunctionCallEntryArguments$outboundSchema}).transform(t=>(0,lTr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",toolCallId:"tool_call_id"}));var uTr;(function(t){t.inboundSchema=Jn.FunctionCallEntry$inboundSchema,t.outboundSchema=Jn.FunctionCallEntry$outboundSchema})(uTr||(Jn.FunctionCallEntry$=uTr={}));function MOo(t){return JSON.stringify(Jn.FunctionCallEntry$outboundSchema.parse(t))}function IOo(t){return(0,POo.safeParse)(t,e=>Jn.FunctionCallEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEntry' from JSON")}});var YMe=S(Wn=>{"use strict";var ROo=Wn&&Wn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AOo=Wn&&Wn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NOo=Wn&&Wn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 AOo(r,e),r}}();Object.defineProperty(Wn,"__esModule",{value:!0});Wn.FunctionResultEntry$=Wn.FunctionResultEntry$outboundSchema=Wn.FunctionResultEntry$inboundSchema=Wn.FunctionResultEntryType$=Wn.FunctionResultEntryType$outboundSchema=Wn.FunctionResultEntryType$inboundSchema=Wn.FunctionResultEntryObject$=Wn.FunctionResultEntryObject$outboundSchema=Wn.FunctionResultEntryObject$inboundSchema=Wn.FunctionResultEntryType=Wn.FunctionResultEntryObject=void 0;Wn.functionResultEntryToJSON=DOo;Wn.functionResultEntryFromJSON=$Oo;var Ty=NOo(Q()),mTr=le(),jOo=Z();Wn.FunctionResultEntryObject={Entry:"entry"};Wn.FunctionResultEntryType={FunctionResult:"function.result"};Wn.FunctionResultEntryObject$inboundSchema=Ty.nativeEnum(Wn.FunctionResultEntryObject);Wn.FunctionResultEntryObject$outboundSchema=Wn.FunctionResultEntryObject$inboundSchema;var dTr;(function(t){t.inboundSchema=Wn.FunctionResultEntryObject$inboundSchema,t.outboundSchema=Wn.FunctionResultEntryObject$outboundSchema})(dTr||(Wn.FunctionResultEntryObject$=dTr={}));Wn.FunctionResultEntryType$inboundSchema=Ty.nativeEnum(Wn.FunctionResultEntryType);Wn.FunctionResultEntryType$outboundSchema=Wn.FunctionResultEntryType$inboundSchema;var fTr;(function(t){t.inboundSchema=Wn.FunctionResultEntryType$inboundSchema,t.outboundSchema=Wn.FunctionResultEntryType$outboundSchema})(fTr||(Wn.FunctionResultEntryType$=fTr={}));Wn.FunctionResultEntry$inboundSchema=Ty.object({object:Wn.FunctionResultEntryObject$inboundSchema.default("entry"),type:Wn.FunctionResultEntryType$inboundSchema.default("function.result"),created_at:Ty.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Ty.nullable(Ty.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Ty.string().optional(),tool_call_id:Ty.string(),result:Ty.string()}).transform(t=>(0,mTr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",tool_call_id:"toolCallId"}));Wn.FunctionResultEntry$outboundSchema=Ty.object({object:Wn.FunctionResultEntryObject$outboundSchema.default("entry"),type:Wn.FunctionResultEntryType$outboundSchema.default("function.result"),createdAt:Ty.date().transform(t=>t.toISOString()).optional(),completedAt:Ty.nullable(Ty.date().transform(t=>t.toISOString())).optional(),id:Ty.string().optional(),toolCallId:Ty.string(),result:Ty.string()}).transform(t=>(0,mTr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",toolCallId:"tool_call_id"}));var pTr;(function(t){t.inboundSchema=Wn.FunctionResultEntry$inboundSchema,t.outboundSchema=Wn.FunctionResultEntry$outboundSchema})(pTr||(Wn.FunctionResultEntry$=pTr={}));function DOo(t){return JSON.stringify(Wn.FunctionResultEntry$outboundSchema.parse(t))}function $Oo(t){return(0,jOo.safeParse)(t,e=>Wn.FunctionResultEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionResultEntry' from JSON")}});var Dae=S(Ca=>{"use strict";var LOo=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]}),FOo=Ca&&Ca.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kOo=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"&&LOo(r,e,n[o]);return FOo(r,e),r}}();Object.defineProperty(Ca,"__esModule",{value:!0});Ca.ToolFileChunk$=Ca.ToolFileChunk$outboundSchema=Ca.ToolFileChunk$inboundSchema=Ca.ToolFileChunkType$=Ca.ToolFileChunkType$outboundSchema=Ca.ToolFileChunkType$inboundSchema=Ca.ToolFileChunkType=void 0;Ca.toolFileChunkToJSON=UOo;Ca.toolFileChunkFromJSON=BOo;var aw=kOo(Q()),yTr=le(),qOo=Z(),bTr=Qk();Ca.ToolFileChunkType={ToolFile:"tool_file"};Ca.ToolFileChunkType$inboundSchema=aw.nativeEnum(Ca.ToolFileChunkType);Ca.ToolFileChunkType$outboundSchema=Ca.ToolFileChunkType$inboundSchema;var hTr;(function(t){t.inboundSchema=Ca.ToolFileChunkType$inboundSchema,t.outboundSchema=Ca.ToolFileChunkType$outboundSchema})(hTr||(Ca.ToolFileChunkType$=hTr={}));Ca.ToolFileChunk$inboundSchema=aw.object({type:Ca.ToolFileChunkType$inboundSchema.default("tool_file"),tool:bTr.BuiltInConnectors$inboundSchema,file_id:aw.string(),file_name:aw.nullable(aw.string()).optional(),file_type:aw.nullable(aw.string()).optional()}).transform(t=>(0,yTr.remap)(t,{file_id:"fileId",file_name:"fileName",file_type:"fileType"}));Ca.ToolFileChunk$outboundSchema=aw.object({type:Ca.ToolFileChunkType$outboundSchema.default("tool_file"),tool:bTr.BuiltInConnectors$outboundSchema,fileId:aw.string(),fileName:aw.nullable(aw.string()).optional(),fileType:aw.nullable(aw.string()).optional()}).transform(t=>(0,yTr.remap)(t,{fileId:"file_id",fileName:"file_name",fileType:"file_type"}));var gTr;(function(t){t.inboundSchema=Ca.ToolFileChunk$inboundSchema,t.outboundSchema=Ca.ToolFileChunk$outboundSchema})(gTr||(Ca.ToolFileChunk$=gTr={}));function UOo(t){return JSON.stringify(Ca.ToolFileChunk$outboundSchema.parse(t))}function BOo(t){return(0,qOo.safeParse)(t,e=>Ca.ToolFileChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolFileChunk' from JSON")}});var put=S(_f=>{"use strict";var zOo=_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]}),VOo=_f&&_f.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HOo=_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"&&zOo(r,e,n[o]);return VOo(r,e),r}}();Object.defineProperty(_f,"__esModule",{value:!0});_f.MessageInputContentChunks$=_f.MessageInputContentChunks$outboundSchema=_f.MessageInputContentChunks$inboundSchema=void 0;_f.messageInputContentChunksToJSON=WOo;_f.messageInputContentChunksFromJSON=KOo;var vTr=HOo(Q()),JOo=Z(),wTr=iH(),STr=aH(),CTr=Yk(),xTr=uH(),OTr=Dae();_f.MessageInputContentChunks$inboundSchema=vTr.union([OTr.ToolFileChunk$inboundSchema,CTr.TextChunk$inboundSchema,STr.ImageURLChunk$inboundSchema,wTr.DocumentURLChunk$inboundSchema,xTr.ThinkChunk$inboundSchema]);_f.MessageInputContentChunks$outboundSchema=vTr.union([OTr.ToolFileChunk$outboundSchema,CTr.TextChunk$outboundSchema,STr.ImageURLChunk$outboundSchema,wTr.DocumentURLChunk$outboundSchema,xTr.ThinkChunk$outboundSchema]);var _Tr;(function(t){t.inboundSchema=_f.MessageInputContentChunks$inboundSchema,t.outboundSchema=_f.MessageInputContentChunks$outboundSchema})(_Tr||(_f.MessageInputContentChunks$=_Tr={}));function WOo(t){return JSON.stringify(_f.MessageInputContentChunks$outboundSchema.parse(t))}function KOo(t){return(0,JOo.safeParse)(t,e=>_f.MessageInputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputContentChunks' from JSON")}});var $ae=S(tr=>{"use strict";var GOo=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]}),XOo=tr&&tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZOo=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"&&GOo(r,e,n[o]);return XOo(r,e),r}}();Object.defineProperty(tr,"__esModule",{value:!0});tr.MessageInputEntry$=tr.MessageInputEntry$outboundSchema=tr.MessageInputEntry$inboundSchema=tr.MessageInputEntryContent$=tr.MessageInputEntryContent$outboundSchema=tr.MessageInputEntryContent$inboundSchema=tr.MessageInputEntryRole$=tr.MessageInputEntryRole$outboundSchema=tr.MessageInputEntryRole$inboundSchema=tr.MessageInputEntryType$=tr.MessageInputEntryType$outboundSchema=tr.MessageInputEntryType$inboundSchema=tr.ObjectT$=tr.ObjectT$outboundSchema=tr.ObjectT$inboundSchema=tr.MessageInputEntryRole=tr.MessageInputEntryType=tr.ObjectT=void 0;tr.messageInputEntryContentToJSON=YOo;tr.messageInputEntryContentFromJSON=QOo;tr.messageInputEntryToJSON=eTo;tr.messageInputEntryFromJSON=tTo;var Nu=ZOo(Q()),RTr=le(),ATr=Z(),QMe=put();tr.ObjectT={Entry:"entry"};tr.MessageInputEntryType={MessageInput:"message.input"};tr.MessageInputEntryRole={Assistant:"assistant",User:"user"};tr.ObjectT$inboundSchema=Nu.nativeEnum(tr.ObjectT);tr.ObjectT$outboundSchema=tr.ObjectT$inboundSchema;var TTr;(function(t){t.inboundSchema=tr.ObjectT$inboundSchema,t.outboundSchema=tr.ObjectT$outboundSchema})(TTr||(tr.ObjectT$=TTr={}));tr.MessageInputEntryType$inboundSchema=Nu.nativeEnum(tr.MessageInputEntryType);tr.MessageInputEntryType$outboundSchema=tr.MessageInputEntryType$inboundSchema;var ETr;(function(t){t.inboundSchema=tr.MessageInputEntryType$inboundSchema,t.outboundSchema=tr.MessageInputEntryType$outboundSchema})(ETr||(tr.MessageInputEntryType$=ETr={}));tr.MessageInputEntryRole$inboundSchema=Nu.nativeEnum(tr.MessageInputEntryRole);tr.MessageInputEntryRole$outboundSchema=tr.MessageInputEntryRole$inboundSchema;var PTr;(function(t){t.inboundSchema=tr.MessageInputEntryRole$inboundSchema,t.outboundSchema=tr.MessageInputEntryRole$outboundSchema})(PTr||(tr.MessageInputEntryRole$=PTr={}));tr.MessageInputEntryContent$inboundSchema=Nu.union([Nu.string(),Nu.array(QMe.MessageInputContentChunks$inboundSchema)]);tr.MessageInputEntryContent$outboundSchema=Nu.union([Nu.string(),Nu.array(QMe.MessageInputContentChunks$outboundSchema)]);var MTr;(function(t){t.inboundSchema=tr.MessageInputEntryContent$inboundSchema,t.outboundSchema=tr.MessageInputEntryContent$outboundSchema})(MTr||(tr.MessageInputEntryContent$=MTr={}));function YOo(t){return JSON.stringify(tr.MessageInputEntryContent$outboundSchema.parse(t))}function QOo(t){return(0,ATr.safeParse)(t,e=>tr.MessageInputEntryContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputEntryContent' from JSON")}tr.MessageInputEntry$inboundSchema=Nu.object({object:tr.ObjectT$inboundSchema.default("entry"),type:tr.MessageInputEntryType$inboundSchema.default("message.input"),created_at:Nu.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Nu.nullable(Nu.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Nu.string().optional(),role:tr.MessageInputEntryRole$inboundSchema,content:Nu.union([Nu.string(),Nu.array(QMe.MessageInputContentChunks$inboundSchema)]),prefix:Nu.boolean().default(!1)}).transform(t=>(0,RTr.remap)(t,{created_at:"createdAt",completed_at:"completedAt"}));tr.MessageInputEntry$outboundSchema=Nu.object({object:tr.ObjectT$outboundSchema.default("entry"),type:tr.MessageInputEntryType$outboundSchema.default("message.input"),createdAt:Nu.date().transform(t=>t.toISOString()).optional(),completedAt:Nu.nullable(Nu.date().transform(t=>t.toISOString())).optional(),id:Nu.string().optional(),role:tr.MessageInputEntryRole$outboundSchema,content:Nu.union([Nu.string(),Nu.array(QMe.MessageInputContentChunks$outboundSchema)]),prefix:Nu.boolean().default(!1)}).transform(t=>(0,RTr.remap)(t,{createdAt:"created_at",completedAt:"completed_at"}));var ITr;(function(t){t.inboundSchema=tr.MessageInputEntry$inboundSchema,t.outboundSchema=tr.MessageInputEntry$outboundSchema})(ITr||(tr.MessageInputEntry$=ITr={}));function eTo(t){return JSON.stringify(tr.MessageInputEntry$outboundSchema.parse(t))}function tTo(t){return(0,ATr.safeParse)(t,e=>tr.MessageInputEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputEntry' from JSON")}});var eIe=S(xa=>{"use strict";var rTo=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]}),nTo=xa&&xa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oTo=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"&&rTo(r,e,n[o]);return nTo(r,e),r}}();Object.defineProperty(xa,"__esModule",{value:!0});xa.ToolReferenceChunk$=xa.ToolReferenceChunk$outboundSchema=xa.ToolReferenceChunk$inboundSchema=xa.ToolReferenceChunkType$=xa.ToolReferenceChunkType$outboundSchema=xa.ToolReferenceChunkType$inboundSchema=xa.ToolReferenceChunkType=void 0;xa.toolReferenceChunkToJSON=aTo;xa.toolReferenceChunkFromJSON=sTo;var Rg=oTo(Q()),iTo=Z(),DTr=Qk();xa.ToolReferenceChunkType={ToolReference:"tool_reference"};xa.ToolReferenceChunkType$inboundSchema=Rg.nativeEnum(xa.ToolReferenceChunkType);xa.ToolReferenceChunkType$outboundSchema=xa.ToolReferenceChunkType$inboundSchema;var NTr;(function(t){t.inboundSchema=xa.ToolReferenceChunkType$inboundSchema,t.outboundSchema=xa.ToolReferenceChunkType$outboundSchema})(NTr||(xa.ToolReferenceChunkType$=NTr={}));xa.ToolReferenceChunk$inboundSchema=Rg.object({type:xa.ToolReferenceChunkType$inboundSchema.default("tool_reference"),tool:DTr.BuiltInConnectors$inboundSchema,title:Rg.string(),url:Rg.nullable(Rg.string()).optional(),favicon:Rg.nullable(Rg.string()).optional(),description:Rg.nullable(Rg.string()).optional()});xa.ToolReferenceChunk$outboundSchema=Rg.object({type:xa.ToolReferenceChunkType$outboundSchema.default("tool_reference"),tool:DTr.BuiltInConnectors$outboundSchema,title:Rg.string(),url:Rg.nullable(Rg.string()).optional(),favicon:Rg.nullable(Rg.string()).optional(),description:Rg.nullable(Rg.string()).optional()});var jTr;(function(t){t.inboundSchema=xa.ToolReferenceChunk$inboundSchema,t.outboundSchema=xa.ToolReferenceChunk$outboundSchema})(jTr||(xa.ToolReferenceChunk$=jTr={}));function aTo(t){return JSON.stringify(xa.ToolReferenceChunk$outboundSchema.parse(t))}function sTo(t){return(0,iTo.safeParse)(t,e=>xa.ToolReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolReferenceChunk' from JSON")}});var mut=S(vf=>{"use strict";var uTo=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]}),lTo=vf&&vf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cTo=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"&&uTo(r,e,n[o]);return lTo(r,e),r}}();Object.defineProperty(vf,"__esModule",{value:!0});vf.MessageOutputContentChunks$=vf.MessageOutputContentChunks$outboundSchema=vf.MessageOutputContentChunks$inboundSchema=void 0;vf.messageOutputContentChunksToJSON=fTo;vf.messageOutputContentChunksFromJSON=pTo;var LTr=cTo(Q()),dTo=Z(),FTr=iH(),kTr=aH(),qTr=Yk(),UTr=uH(),BTr=Dae(),zTr=eIe();vf.MessageOutputContentChunks$inboundSchema=LTr.union([BTr.ToolFileChunk$inboundSchema,zTr.ToolReferenceChunk$inboundSchema,qTr.TextChunk$inboundSchema,kTr.ImageURLChunk$inboundSchema,FTr.DocumentURLChunk$inboundSchema,UTr.ThinkChunk$inboundSchema]);vf.MessageOutputContentChunks$outboundSchema=LTr.union([BTr.ToolFileChunk$outboundSchema,zTr.ToolReferenceChunk$outboundSchema,qTr.TextChunk$outboundSchema,kTr.ImageURLChunk$outboundSchema,FTr.DocumentURLChunk$outboundSchema,UTr.ThinkChunk$outboundSchema]);var $Tr;(function(t){t.inboundSchema=vf.MessageOutputContentChunks$inboundSchema,t.outboundSchema=vf.MessageOutputContentChunks$outboundSchema})($Tr||(vf.MessageOutputContentChunks$=$Tr={}));function fTo(t){return JSON.stringify(vf.MessageOutputContentChunks$outboundSchema.parse(t))}function pTo(t){return(0,dTo.safeParse)(t,e=>vf.MessageOutputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputContentChunks' from JSON")}});var y9=S(rr=>{"use strict";var mTo=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}),gTo=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"&&mTo(r,e,n[o]);return hTo(r,e),r}}();Object.defineProperty(rr,"__esModule",{value:!0});rr.MessageOutputEntry$=rr.MessageOutputEntry$outboundSchema=rr.MessageOutputEntry$inboundSchema=rr.MessageOutputEntryContent$=rr.MessageOutputEntryContent$outboundSchema=rr.MessageOutputEntryContent$inboundSchema=rr.MessageOutputEntryRole$=rr.MessageOutputEntryRole$outboundSchema=rr.MessageOutputEntryRole$inboundSchema=rr.MessageOutputEntryType$=rr.MessageOutputEntryType$outboundSchema=rr.MessageOutputEntryType$inboundSchema=rr.MessageOutputEntryObject$=rr.MessageOutputEntryObject$outboundSchema=rr.MessageOutputEntryObject$inboundSchema=rr.MessageOutputEntryRole=rr.MessageOutputEntryType=rr.MessageOutputEntryObject=void 0;rr.messageOutputEntryContentToJSON=yTo;rr.messageOutputEntryContentFromJSON=bTo;rr.messageOutputEntryToJSON=_To;rr.messageOutputEntryFromJSON=vTo;var os=gTo(Q()),GTr=le(),XTr=Z(),tIe=mut();rr.MessageOutputEntryObject={Entry:"entry"};rr.MessageOutputEntryType={MessageOutput:"message.output"};rr.MessageOutputEntryRole={Assistant:"assistant"};rr.MessageOutputEntryObject$inboundSchema=os.nativeEnum(rr.MessageOutputEntryObject);rr.MessageOutputEntryObject$outboundSchema=rr.MessageOutputEntryObject$inboundSchema;var VTr;(function(t){t.inboundSchema=rr.MessageOutputEntryObject$inboundSchema,t.outboundSchema=rr.MessageOutputEntryObject$outboundSchema})(VTr||(rr.MessageOutputEntryObject$=VTr={}));rr.MessageOutputEntryType$inboundSchema=os.nativeEnum(rr.MessageOutputEntryType);rr.MessageOutputEntryType$outboundSchema=rr.MessageOutputEntryType$inboundSchema;var HTr;(function(t){t.inboundSchema=rr.MessageOutputEntryType$inboundSchema,t.outboundSchema=rr.MessageOutputEntryType$outboundSchema})(HTr||(rr.MessageOutputEntryType$=HTr={}));rr.MessageOutputEntryRole$inboundSchema=os.nativeEnum(rr.MessageOutputEntryRole);rr.MessageOutputEntryRole$outboundSchema=rr.MessageOutputEntryRole$inboundSchema;var JTr;(function(t){t.inboundSchema=rr.MessageOutputEntryRole$inboundSchema,t.outboundSchema=rr.MessageOutputEntryRole$outboundSchema})(JTr||(rr.MessageOutputEntryRole$=JTr={}));rr.MessageOutputEntryContent$inboundSchema=os.union([os.string(),os.array(tIe.MessageOutputContentChunks$inboundSchema)]);rr.MessageOutputEntryContent$outboundSchema=os.union([os.string(),os.array(tIe.MessageOutputContentChunks$outboundSchema)]);var WTr;(function(t){t.inboundSchema=rr.MessageOutputEntryContent$inboundSchema,t.outboundSchema=rr.MessageOutputEntryContent$outboundSchema})(WTr||(rr.MessageOutputEntryContent$=WTr={}));function yTo(t){return JSON.stringify(rr.MessageOutputEntryContent$outboundSchema.parse(t))}function bTo(t){return(0,XTr.safeParse)(t,e=>rr.MessageOutputEntryContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEntryContent' from JSON")}rr.MessageOutputEntry$inboundSchema=os.object({object:rr.MessageOutputEntryObject$inboundSchema.default("entry"),type:rr.MessageOutputEntryType$inboundSchema.default("message.output"),created_at:os.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:os.nullable(os.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:os.string().optional(),agent_id:os.nullable(os.string()).optional(),model:os.nullable(os.string()).optional(),role:rr.MessageOutputEntryRole$inboundSchema.default("assistant"),content:os.union([os.string(),os.array(tIe.MessageOutputContentChunks$inboundSchema)])}).transform(t=>(0,GTr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",agent_id:"agentId"}));rr.MessageOutputEntry$outboundSchema=os.object({object:rr.MessageOutputEntryObject$outboundSchema.default("entry"),type:rr.MessageOutputEntryType$outboundSchema.default("message.output"),createdAt:os.date().transform(t=>t.toISOString()).optional(),completedAt:os.nullable(os.date().transform(t=>t.toISOString())).optional(),id:os.string().optional(),agentId:os.nullable(os.string()).optional(),model:os.nullable(os.string()).optional(),role:rr.MessageOutputEntryRole$outboundSchema.default("assistant"),content:os.union([os.string(),os.array(tIe.MessageOutputContentChunks$outboundSchema)])}).transform(t=>(0,GTr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",agentId:"agent_id"}));var KTr;(function(t){t.inboundSchema=rr.MessageOutputEntry$inboundSchema,t.outboundSchema=rr.MessageOutputEntry$outboundSchema})(KTr||(rr.MessageOutputEntry$=KTr={}));function _To(t){return JSON.stringify(rr.MessageOutputEntry$outboundSchema.parse(t))}function vTo(t){return(0,XTr.safeParse)(t,e=>rr.MessageOutputEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEntry' from JSON")}});var Lae=S(Kn=>{"use strict";var wTo=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]}),STo=Kn&&Kn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CTo=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"&&wTo(r,e,n[o]);return STo(r,e),r}}();Object.defineProperty(Kn,"__esModule",{value:!0});Kn.ToolExecutionEntry$=Kn.ToolExecutionEntry$outboundSchema=Kn.ToolExecutionEntry$inboundSchema=Kn.ToolExecutionEntryType$=Kn.ToolExecutionEntryType$outboundSchema=Kn.ToolExecutionEntryType$inboundSchema=Kn.ToolExecutionEntryObject$=Kn.ToolExecutionEntryObject$outboundSchema=Kn.ToolExecutionEntryObject$inboundSchema=Kn.ToolExecutionEntryType=Kn.ToolExecutionEntryObject=void 0;Kn.toolExecutionEntryToJSON=OTo;Kn.toolExecutionEntryFromJSON=TTo;var Ch=CTo(Q()),eEr=le(),xTo=Z(),tEr=Qk();Kn.ToolExecutionEntryObject={Entry:"entry"};Kn.ToolExecutionEntryType={ToolExecution:"tool.execution"};Kn.ToolExecutionEntryObject$inboundSchema=Ch.nativeEnum(Kn.ToolExecutionEntryObject);Kn.ToolExecutionEntryObject$outboundSchema=Kn.ToolExecutionEntryObject$inboundSchema;var ZTr;(function(t){t.inboundSchema=Kn.ToolExecutionEntryObject$inboundSchema,t.outboundSchema=Kn.ToolExecutionEntryObject$outboundSchema})(ZTr||(Kn.ToolExecutionEntryObject$=ZTr={}));Kn.ToolExecutionEntryType$inboundSchema=Ch.nativeEnum(Kn.ToolExecutionEntryType);Kn.ToolExecutionEntryType$outboundSchema=Kn.ToolExecutionEntryType$inboundSchema;var YTr;(function(t){t.inboundSchema=Kn.ToolExecutionEntryType$inboundSchema,t.outboundSchema=Kn.ToolExecutionEntryType$outboundSchema})(YTr||(Kn.ToolExecutionEntryType$=YTr={}));Kn.ToolExecutionEntry$inboundSchema=Ch.object({object:Kn.ToolExecutionEntryObject$inboundSchema.default("entry"),type:Kn.ToolExecutionEntryType$inboundSchema.default("tool.execution"),created_at:Ch.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Ch.nullable(Ch.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Ch.string().optional(),name:tEr.BuiltInConnectors$inboundSchema,arguments:Ch.string(),info:Ch.record(Ch.any()).optional()}).transform(t=>(0,eEr.remap)(t,{created_at:"createdAt",completed_at:"completedAt"}));Kn.ToolExecutionEntry$outboundSchema=Ch.object({object:Kn.ToolExecutionEntryObject$outboundSchema.default("entry"),type:Kn.ToolExecutionEntryType$outboundSchema.default("tool.execution"),createdAt:Ch.date().transform(t=>t.toISOString()).optional(),completedAt:Ch.nullable(Ch.date().transform(t=>t.toISOString())).optional(),id:Ch.string().optional(),name:tEr.BuiltInConnectors$outboundSchema,arguments:Ch.string(),info:Ch.record(Ch.any()).optional()}).transform(t=>(0,eEr.remap)(t,{createdAt:"created_at",completedAt:"completed_at"}));var QTr;(function(t){t.inboundSchema=Kn.ToolExecutionEntry$inboundSchema,t.outboundSchema=Kn.ToolExecutionEntry$outboundSchema})(QTr||(Kn.ToolExecutionEntry$=QTr={}));function OTo(t){return JSON.stringify(Kn.ToolExecutionEntry$outboundSchema.parse(t))}function TTo(t){return(0,xTo.safeParse)(t,e=>Kn.ToolExecutionEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionEntry' from JSON")}});var hut=S(wf=>{"use strict";var ETo=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]}),PTo=wf&&wf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MTo=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"&&ETo(r,e,n[o]);return PTo(r,e),r}}();Object.defineProperty(wf,"__esModule",{value:!0});wf.InputEntries$=wf.InputEntries$outboundSchema=wf.InputEntries$inboundSchema=void 0;wf.inputEntriesToJSON=RTo;wf.inputEntriesFromJSON=ATo;var nEr=MTo(Q()),ITo=Z(),oEr=Mae(),iEr=jae(),aEr=YMe(),sEr=$ae(),uEr=y9(),lEr=Lae();wf.InputEntries$inboundSchema=nEr.union([oEr.AgentHandoffEntry$inboundSchema,iEr.FunctionCallEntry$inboundSchema,sEr.MessageInputEntry$inboundSchema,aEr.FunctionResultEntry$inboundSchema,lEr.ToolExecutionEntry$inboundSchema,uEr.MessageOutputEntry$inboundSchema]);wf.InputEntries$outboundSchema=nEr.union([oEr.AgentHandoffEntry$outboundSchema,iEr.FunctionCallEntry$outboundSchema,sEr.MessageInputEntry$outboundSchema,aEr.FunctionResultEntry$outboundSchema,lEr.ToolExecutionEntry$outboundSchema,uEr.MessageOutputEntry$outboundSchema]);var rEr;(function(t){t.inboundSchema=wf.InputEntries$inboundSchema,t.outboundSchema=wf.InputEntries$outboundSchema})(rEr||(wf.InputEntries$=rEr={}));function RTo(t){return JSON.stringify(wf.InputEntries$outboundSchema.parse(t))}function ATo(t){return(0,ITo.safeParse)(t,e=>wf.InputEntries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InputEntries' from JSON")}});var rq=S(Sf=>{"use strict";var NTo=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]}),jTo=Sf&&Sf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DTo=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"&&NTo(r,e,n[o]);return jTo(r,e),r}}();Object.defineProperty(Sf,"__esModule",{value:!0});Sf.ConversationInputs$=Sf.ConversationInputs$outboundSchema=Sf.ConversationInputs$inboundSchema=void 0;Sf.conversationInputsToJSON=LTo;Sf.conversationInputsFromJSON=FTo;var b9=DTo(Q()),$To=Z(),dEr=hut();Sf.ConversationInputs$inboundSchema=b9.union([b9.string(),b9.array(dEr.InputEntries$inboundSchema)]);Sf.ConversationInputs$outboundSchema=b9.union([b9.string(),b9.array(dEr.InputEntries$outboundSchema)]);var cEr;(function(t){t.inboundSchema=Sf.ConversationInputs$inboundSchema,t.outboundSchema=Sf.ConversationInputs$outboundSchema})(cEr||(Sf.ConversationInputs$=cEr={}));function LTo(t){return JSON.stringify(Sf.ConversationInputs$outboundSchema.parse(t))}function FTo(t){return(0,$To.safeParse)(t,e=>Sf.ConversationInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationInputs' from JSON")}});var yEr=S(Oa=>{"use strict";var kTo=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]}),qTo=Oa&&Oa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UTo=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"&&kTo(r,e,n[o]);return qTo(r,e),r}}();Object.defineProperty(Oa,"__esModule",{value:!0});Oa.ConversationAppendRequest$=Oa.ConversationAppendRequest$outboundSchema=Oa.ConversationAppendRequest$inboundSchema=Oa.ConversationAppendRequestHandoffExecution$=Oa.ConversationAppendRequestHandoffExecution$outboundSchema=Oa.ConversationAppendRequestHandoffExecution$inboundSchema=Oa.ConversationAppendRequestHandoffExecution=void 0;Oa.conversationAppendRequestToJSON=zTo;Oa.conversationAppendRequestFromJSON=VTo;var mH=UTo(Q()),mEr=le(),BTo=Z(),hEr=JS(),gEr=rq();Oa.ConversationAppendRequestHandoffExecution={Client:"client",Server:"server"};Oa.ConversationAppendRequestHandoffExecution$inboundSchema=mH.nativeEnum(Oa.ConversationAppendRequestHandoffExecution);Oa.ConversationAppendRequestHandoffExecution$outboundSchema=Oa.ConversationAppendRequestHandoffExecution$inboundSchema;var fEr;(function(t){t.inboundSchema=Oa.ConversationAppendRequestHandoffExecution$inboundSchema,t.outboundSchema=Oa.ConversationAppendRequestHandoffExecution$outboundSchema})(fEr||(Oa.ConversationAppendRequestHandoffExecution$=fEr={}));Oa.ConversationAppendRequest$inboundSchema=mH.object({inputs:gEr.ConversationInputs$inboundSchema,stream:mH.boolean().default(!1),store:mH.boolean().default(!0),handoff_execution:Oa.ConversationAppendRequestHandoffExecution$inboundSchema.default("server"),completion_args:hEr.CompletionArgs$inboundSchema.optional()}).transform(t=>(0,mEr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs"}));Oa.ConversationAppendRequest$outboundSchema=mH.object({inputs:gEr.ConversationInputs$outboundSchema,stream:mH.boolean().default(!1),store:mH.boolean().default(!0),handoffExecution:Oa.ConversationAppendRequestHandoffExecution$outboundSchema.default("server"),completionArgs:hEr.CompletionArgs$outboundSchema.optional()}).transform(t=>(0,mEr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args"}));var pEr;(function(t){t.inboundSchema=Oa.ConversationAppendRequest$inboundSchema,t.outboundSchema=Oa.ConversationAppendRequest$outboundSchema})(pEr||(Oa.ConversationAppendRequest$=pEr={}));function zTo(t){return JSON.stringify(Oa.ConversationAppendRequest$outboundSchema.parse(t))}function VTo(t){return(0,BTo.safeParse)(t,e=>Oa.ConversationAppendRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationAppendRequest' from JSON")}});var CEr=S(Ta=>{"use strict";var HTo=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]}),JTo=Ta&&Ta.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WTo=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"&&HTo(r,e,n[o]);return JTo(r,e),r}}();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.ConversationAppendStreamRequest$=Ta.ConversationAppendStreamRequest$outboundSchema=Ta.ConversationAppendStreamRequest$inboundSchema=Ta.ConversationAppendStreamRequestHandoffExecution$=Ta.ConversationAppendStreamRequestHandoffExecution$outboundSchema=Ta.ConversationAppendStreamRequestHandoffExecution$inboundSchema=Ta.ConversationAppendStreamRequestHandoffExecution=void 0;Ta.conversationAppendStreamRequestToJSON=GTo;Ta.conversationAppendStreamRequestFromJSON=XTo;var hH=WTo(Q()),vEr=le(),KTo=Z(),wEr=JS(),SEr=rq();Ta.ConversationAppendStreamRequestHandoffExecution={Client:"client",Server:"server"};Ta.ConversationAppendStreamRequestHandoffExecution$inboundSchema=hH.nativeEnum(Ta.ConversationAppendStreamRequestHandoffExecution);Ta.ConversationAppendStreamRequestHandoffExecution$outboundSchema=Ta.ConversationAppendStreamRequestHandoffExecution$inboundSchema;var bEr;(function(t){t.inboundSchema=Ta.ConversationAppendStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=Ta.ConversationAppendStreamRequestHandoffExecution$outboundSchema})(bEr||(Ta.ConversationAppendStreamRequestHandoffExecution$=bEr={}));Ta.ConversationAppendStreamRequest$inboundSchema=hH.object({inputs:SEr.ConversationInputs$inboundSchema,stream:hH.boolean().default(!0),store:hH.boolean().default(!0),handoff_execution:Ta.ConversationAppendStreamRequestHandoffExecution$inboundSchema.default("server"),completion_args:wEr.CompletionArgs$inboundSchema.optional()}).transform(t=>(0,vEr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs"}));Ta.ConversationAppendStreamRequest$outboundSchema=hH.object({inputs:SEr.ConversationInputs$outboundSchema,stream:hH.boolean().default(!0),store:hH.boolean().default(!0),handoffExecution:Ta.ConversationAppendStreamRequestHandoffExecution$outboundSchema.default("server"),completionArgs:wEr.CompletionArgs$outboundSchema.optional()}).transform(t=>(0,vEr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args"}));var _Er;(function(t){t.inboundSchema=Ta.ConversationAppendStreamRequest$inboundSchema,t.outboundSchema=Ta.ConversationAppendStreamRequest$outboundSchema})(_Er||(Ta.ConversationAppendStreamRequest$=_Er={}));function GTo(t){return JSON.stringify(Ta.ConversationAppendStreamRequest$outboundSchema.parse(t))}function XTo(t){return(0,KTo.safeParse)(t,e=>Ta.ConversationAppendStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationAppendStreamRequest' from JSON")}});var gut=S(Ea=>{"use strict";var ZTo=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]}),YTo=Ea&&Ea.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QTo=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"&&ZTo(r,e,n[o]);return YTo(r,e),r}}();Object.defineProperty(Ea,"__esModule",{value:!0});Ea.FunctionCallEvent$=Ea.FunctionCallEvent$outboundSchema=Ea.FunctionCallEvent$inboundSchema=Ea.FunctionCallEventType$=Ea.FunctionCallEventType$outboundSchema=Ea.FunctionCallEventType$inboundSchema=Ea.FunctionCallEventType=void 0;Ea.functionCallEventToJSON=tEo;Ea.functionCallEventFromJSON=rEo;var xb=QTo(Q()),TEr=le(),eEo=Z();Ea.FunctionCallEventType={FunctionCallDelta:"function.call.delta"};Ea.FunctionCallEventType$inboundSchema=xb.nativeEnum(Ea.FunctionCallEventType);Ea.FunctionCallEventType$outboundSchema=Ea.FunctionCallEventType$inboundSchema;var xEr;(function(t){t.inboundSchema=Ea.FunctionCallEventType$inboundSchema,t.outboundSchema=Ea.FunctionCallEventType$outboundSchema})(xEr||(Ea.FunctionCallEventType$=xEr={}));Ea.FunctionCallEvent$inboundSchema=xb.object({type:Ea.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,TEr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",tool_call_id:"toolCallId"}));Ea.FunctionCallEvent$outboundSchema=xb.object({type:Ea.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,TEr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",toolCallId:"tool_call_id"}));var OEr;(function(t){t.inboundSchema=Ea.FunctionCallEvent$inboundSchema,t.outboundSchema=Ea.FunctionCallEvent$outboundSchema})(OEr||(Ea.FunctionCallEvent$=OEr={}));function tEo(t){return JSON.stringify(Ea.FunctionCallEvent$outboundSchema.parse(t))}function rEo(t){return(0,eEo.safeParse)(t,e=>Ea.FunctionCallEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEvent' from JSON")}});var yut=S(Cf=>{"use strict";var nEo=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]}),oEo=Cf&&Cf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iEo=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"&&nEo(r,e,n[o]);return oEo(r,e),r}}();Object.defineProperty(Cf,"__esModule",{value:!0});Cf.OutputContentChunks$=Cf.OutputContentChunks$outboundSchema=Cf.OutputContentChunks$inboundSchema=void 0;Cf.outputContentChunksToJSON=sEo;Cf.outputContentChunksFromJSON=uEo;var PEr=iEo(Q()),aEo=Z(),MEr=iH(),IEr=aH(),REr=Yk(),AEr=uH(),NEr=Dae(),jEr=eIe();Cf.OutputContentChunks$inboundSchema=PEr.union([NEr.ToolFileChunk$inboundSchema,jEr.ToolReferenceChunk$inboundSchema,REr.TextChunk$inboundSchema,IEr.ImageURLChunk$inboundSchema,MEr.DocumentURLChunk$inboundSchema,AEr.ThinkChunk$inboundSchema]);Cf.OutputContentChunks$outboundSchema=PEr.union([NEr.ToolFileChunk$outboundSchema,jEr.ToolReferenceChunk$outboundSchema,REr.TextChunk$outboundSchema,IEr.ImageURLChunk$outboundSchema,MEr.DocumentURLChunk$outboundSchema,AEr.ThinkChunk$outboundSchema]);var EEr;(function(t){t.inboundSchema=Cf.OutputContentChunks$inboundSchema,t.outboundSchema=Cf.OutputContentChunks$outboundSchema})(EEr||(Cf.OutputContentChunks$=EEr={}));function sEo(t){return JSON.stringify(Cf.OutputContentChunks$outboundSchema.parse(t))}function uEo(t){return(0,aEo.safeParse)(t,e=>Cf.OutputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OutputContentChunks' from JSON")}});var but=S($r=>{"use strict";var lEo=$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]}),cEo=$r&&$r.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dEo=$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"&&lEo(r,e,n[o]);return cEo(r,e),r}}();Object.defineProperty($r,"__esModule",{value:!0});$r.MessageOutputEvent$=$r.MessageOutputEvent$outboundSchema=$r.MessageOutputEvent$inboundSchema=$r.MessageOutputEventContent$=$r.MessageOutputEventContent$outboundSchema=$r.MessageOutputEventContent$inboundSchema=$r.MessageOutputEventRole$=$r.MessageOutputEventRole$outboundSchema=$r.MessageOutputEventRole$inboundSchema=$r.MessageOutputEventType$=$r.MessageOutputEventType$outboundSchema=$r.MessageOutputEventType$inboundSchema=$r.MessageOutputEventRole=$r.MessageOutputEventType=void 0;$r.messageOutputEventContentToJSON=fEo;$r.messageOutputEventContentFromJSON=pEo;$r.messageOutputEventToJSON=mEo;$r.messageOutputEventFromJSON=hEo;var bu=dEo(Q()),kEr=le(),qEr=Z(),rIe=yut();$r.MessageOutputEventType={MessageOutputDelta:"message.output.delta"};$r.MessageOutputEventRole={Assistant:"assistant"};$r.MessageOutputEventType$inboundSchema=bu.nativeEnum($r.MessageOutputEventType);$r.MessageOutputEventType$outboundSchema=$r.MessageOutputEventType$inboundSchema;var DEr;(function(t){t.inboundSchema=$r.MessageOutputEventType$inboundSchema,t.outboundSchema=$r.MessageOutputEventType$outboundSchema})(DEr||($r.MessageOutputEventType$=DEr={}));$r.MessageOutputEventRole$inboundSchema=bu.nativeEnum($r.MessageOutputEventRole);$r.MessageOutputEventRole$outboundSchema=$r.MessageOutputEventRole$inboundSchema;var $Er;(function(t){t.inboundSchema=$r.MessageOutputEventRole$inboundSchema,t.outboundSchema=$r.MessageOutputEventRole$outboundSchema})($Er||($r.MessageOutputEventRole$=$Er={}));$r.MessageOutputEventContent$inboundSchema=bu.union([bu.string(),rIe.OutputContentChunks$inboundSchema]);$r.MessageOutputEventContent$outboundSchema=bu.union([bu.string(),rIe.OutputContentChunks$outboundSchema]);var LEr;(function(t){t.inboundSchema=$r.MessageOutputEventContent$inboundSchema,t.outboundSchema=$r.MessageOutputEventContent$outboundSchema})(LEr||($r.MessageOutputEventContent$=LEr={}));function fEo(t){return JSON.stringify($r.MessageOutputEventContent$outboundSchema.parse(t))}function pEo(t){return(0,qEr.safeParse)(t,e=>$r.MessageOutputEventContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEventContent' from JSON")}$r.MessageOutputEvent$inboundSchema=bu.object({type:$r.MessageOutputEventType$inboundSchema.default("message.output.delta"),created_at:bu.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:bu.number().int().default(0),id:bu.string(),content_index:bu.number().int().default(0),model:bu.nullable(bu.string()).optional(),agent_id:bu.nullable(bu.string()).optional(),role:$r.MessageOutputEventRole$inboundSchema.default("assistant"),content:bu.union([bu.string(),rIe.OutputContentChunks$inboundSchema])}).transform(t=>(0,kEr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",content_index:"contentIndex",agent_id:"agentId"}));$r.MessageOutputEvent$outboundSchema=bu.object({type:$r.MessageOutputEventType$outboundSchema.default("message.output.delta"),createdAt:bu.date().transform(t=>t.toISOString()).optional(),outputIndex:bu.number().int().default(0),id:bu.string(),contentIndex:bu.number().int().default(0),model:bu.nullable(bu.string()).optional(),agentId:bu.nullable(bu.string()).optional(),role:$r.MessageOutputEventRole$outboundSchema.default("assistant"),content:bu.union([bu.string(),rIe.OutputContentChunks$outboundSchema])}).transform(t=>(0,kEr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",contentIndex:"content_index",agentId:"agent_id"}));var FEr;(function(t){t.inboundSchema=$r.MessageOutputEvent$inboundSchema,t.outboundSchema=$r.MessageOutputEvent$outboundSchema})(FEr||($r.MessageOutputEvent$=FEr={}));function mEo(t){return JSON.stringify($r.MessageOutputEvent$outboundSchema.parse(t))}function hEo(t){return(0,qEr.safeParse)(t,e=>$r.MessageOutputEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEvent' from JSON")}});var nIe=S(xf=>{"use strict";var gEo=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]}),yEo=xf&&xf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bEo=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"&&gEo(r,e,n[o]);return yEo(r,e),r}}();Object.defineProperty(xf,"__esModule",{value:!0});xf.ConversationUsageInfo$=xf.ConversationUsageInfo$outboundSchema=xf.ConversationUsageInfo$inboundSchema=void 0;xf.conversationUsageInfoToJSON=vEo;xf.conversationUsageInfoFromJSON=wEo;var xh=bEo(Q()),BEr=le(),_Eo=Z();xf.ConversationUsageInfo$inboundSchema=xh.object({prompt_tokens:xh.number().int().default(0),completion_tokens:xh.number().int().default(0),total_tokens:xh.number().int().default(0),connector_tokens:xh.nullable(xh.number().int()).optional(),connectors:xh.nullable(xh.record(xh.number().int())).optional()}).transform(t=>(0,BEr.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",connector_tokens:"connectorTokens"}));xf.ConversationUsageInfo$outboundSchema=xh.object({promptTokens:xh.number().int().default(0),completionTokens:xh.number().int().default(0),totalTokens:xh.number().int().default(0),connectorTokens:xh.nullable(xh.number().int()).optional(),connectors:xh.nullable(xh.record(xh.number().int())).optional()}).transform(t=>(0,BEr.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",connectorTokens:"connector_tokens"}));var UEr;(function(t){t.inboundSchema=xf.ConversationUsageInfo$inboundSchema,t.outboundSchema=xf.ConversationUsageInfo$outboundSchema})(UEr||(xf.ConversationUsageInfo$=UEr={}));function vEo(t){return JSON.stringify(xf.ConversationUsageInfo$outboundSchema.parse(t))}function wEo(t){return(0,_Eo.safeParse)(t,e=>xf.ConversationUsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationUsageInfo' from JSON")}});var _ut=S(Pa=>{"use strict";var SEo=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]}),CEo=Pa&&Pa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xEo=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"&&SEo(r,e,n[o]);return CEo(r,e),r}}();Object.defineProperty(Pa,"__esModule",{value:!0});Pa.ResponseDoneEvent$=Pa.ResponseDoneEvent$outboundSchema=Pa.ResponseDoneEvent$inboundSchema=Pa.ResponseDoneEventType$=Pa.ResponseDoneEventType$outboundSchema=Pa.ResponseDoneEventType$inboundSchema=Pa.ResponseDoneEventType=void 0;Pa.responseDoneEventToJSON=TEo;Pa.responseDoneEventFromJSON=EEo;var Fae=xEo(Q()),HEr=le(),OEo=Z(),JEr=nIe();Pa.ResponseDoneEventType={ConversationResponseDone:"conversation.response.done"};Pa.ResponseDoneEventType$inboundSchema=Fae.nativeEnum(Pa.ResponseDoneEventType);Pa.ResponseDoneEventType$outboundSchema=Pa.ResponseDoneEventType$inboundSchema;var zEr;(function(t){t.inboundSchema=Pa.ResponseDoneEventType$inboundSchema,t.outboundSchema=Pa.ResponseDoneEventType$outboundSchema})(zEr||(Pa.ResponseDoneEventType$=zEr={}));Pa.ResponseDoneEvent$inboundSchema=Fae.object({type:Pa.ResponseDoneEventType$inboundSchema.default("conversation.response.done"),created_at:Fae.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),usage:JEr.ConversationUsageInfo$inboundSchema}).transform(t=>(0,HEr.remap)(t,{created_at:"createdAt"}));Pa.ResponseDoneEvent$outboundSchema=Fae.object({type:Pa.ResponseDoneEventType$outboundSchema.default("conversation.response.done"),createdAt:Fae.date().transform(t=>t.toISOString()).optional(),usage:JEr.ConversationUsageInfo$outboundSchema}).transform(t=>(0,HEr.remap)(t,{createdAt:"created_at"}));var VEr;(function(t){t.inboundSchema=Pa.ResponseDoneEvent$inboundSchema,t.outboundSchema=Pa.ResponseDoneEvent$outboundSchema})(VEr||(Pa.ResponseDoneEvent$=VEr={}));function TEo(t){return JSON.stringify(Pa.ResponseDoneEvent$outboundSchema.parse(t))}function EEo(t){return(0,OEo.safeParse)(t,e=>Pa.ResponseDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseDoneEvent' from JSON")}});var vut=S(Ma=>{"use strict";var PEo=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]}),MEo=Ma&&Ma.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IEo=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"&&PEo(r,e,n[o]);return MEo(r,e),r}}();Object.defineProperty(Ma,"__esModule",{value:!0});Ma.ResponseErrorEvent$=Ma.ResponseErrorEvent$outboundSchema=Ma.ResponseErrorEvent$inboundSchema=Ma.ResponseErrorEventType$=Ma.ResponseErrorEventType$outboundSchema=Ma.ResponseErrorEventType$inboundSchema=Ma.ResponseErrorEventType=void 0;Ma.responseErrorEventToJSON=AEo;Ma.responseErrorEventFromJSON=NEo;var nj=IEo(Q()),GEr=le(),REo=Z();Ma.ResponseErrorEventType={ConversationResponseError:"conversation.response.error"};Ma.ResponseErrorEventType$inboundSchema=nj.nativeEnum(Ma.ResponseErrorEventType);Ma.ResponseErrorEventType$outboundSchema=Ma.ResponseErrorEventType$inboundSchema;var WEr;(function(t){t.inboundSchema=Ma.ResponseErrorEventType$inboundSchema,t.outboundSchema=Ma.ResponseErrorEventType$outboundSchema})(WEr||(Ma.ResponseErrorEventType$=WEr={}));Ma.ResponseErrorEvent$inboundSchema=nj.object({type:Ma.ResponseErrorEventType$inboundSchema.default("conversation.response.error"),created_at:nj.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),message:nj.string(),code:nj.number().int()}).transform(t=>(0,GEr.remap)(t,{created_at:"createdAt"}));Ma.ResponseErrorEvent$outboundSchema=nj.object({type:Ma.ResponseErrorEventType$outboundSchema.default("conversation.response.error"),createdAt:nj.date().transform(t=>t.toISOString()).optional(),message:nj.string(),code:nj.number().int()}).transform(t=>(0,GEr.remap)(t,{createdAt:"created_at"}));var KEr;(function(t){t.inboundSchema=Ma.ResponseErrorEvent$inboundSchema,t.outboundSchema=Ma.ResponseErrorEvent$outboundSchema})(KEr||(Ma.ResponseErrorEvent$=KEr={}));function AEo(t){return JSON.stringify(Ma.ResponseErrorEvent$outboundSchema.parse(t))}function NEo(t){return(0,REo.safeParse)(t,e=>Ma.ResponseErrorEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseErrorEvent' from JSON")}});var wut=S(Ia=>{"use strict";var jEo=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]}),DEo=Ia&&Ia.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Eo=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"&&jEo(r,e,n[o]);return DEo(r,e),r}}();Object.defineProperty(Ia,"__esModule",{value:!0});Ia.ResponseStartedEvent$=Ia.ResponseStartedEvent$outboundSchema=Ia.ResponseStartedEvent$inboundSchema=Ia.ResponseStartedEventType$=Ia.ResponseStartedEventType$outboundSchema=Ia.ResponseStartedEventType$inboundSchema=Ia.ResponseStartedEventType=void 0;Ia.responseStartedEventToJSON=FEo;Ia.responseStartedEventFromJSON=kEo;var gH=$Eo(Q()),YEr=le(),LEo=Z();Ia.ResponseStartedEventType={ConversationResponseStarted:"conversation.response.started"};Ia.ResponseStartedEventType$inboundSchema=gH.nativeEnum(Ia.ResponseStartedEventType);Ia.ResponseStartedEventType$outboundSchema=Ia.ResponseStartedEventType$inboundSchema;var XEr;(function(t){t.inboundSchema=Ia.ResponseStartedEventType$inboundSchema,t.outboundSchema=Ia.ResponseStartedEventType$outboundSchema})(XEr||(Ia.ResponseStartedEventType$=XEr={}));Ia.ResponseStartedEvent$inboundSchema=gH.object({type:Ia.ResponseStartedEventType$inboundSchema.default("conversation.response.started"),created_at:gH.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),conversation_id:gH.string()}).transform(t=>(0,YEr.remap)(t,{created_at:"createdAt",conversation_id:"conversationId"}));Ia.ResponseStartedEvent$outboundSchema=gH.object({type:Ia.ResponseStartedEventType$outboundSchema.default("conversation.response.started"),createdAt:gH.date().transform(t=>t.toISOString()).optional(),conversationId:gH.string()}).transform(t=>(0,YEr.remap)(t,{createdAt:"created_at",conversationId:"conversation_id"}));var ZEr;(function(t){t.inboundSchema=Ia.ResponseStartedEvent$inboundSchema,t.outboundSchema=Ia.ResponseStartedEvent$outboundSchema})(ZEr||(Ia.ResponseStartedEvent$=ZEr={}));function FEo(t){return JSON.stringify(Ia.ResponseStartedEvent$outboundSchema.parse(t))}function kEo(t){return(0,LEo.safeParse)(t,e=>Ia.ResponseStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseStartedEvent' from JSON")}});var Sut=S(Of=>{"use strict";var qEo=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]}),UEo=Of&&Of.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BEo=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"&&qEo(r,e,n[o]);return UEo(r,e),r}}();Object.defineProperty(Of,"__esModule",{value:!0});Of.SSETypes$=Of.SSETypes$outboundSchema=Of.SSETypes$inboundSchema=Of.SSETypes=void 0;var zEo=BEo(Q());Of.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"};Of.SSETypes$inboundSchema=zEo.nativeEnum(Of.SSETypes);Of.SSETypes$outboundSchema=Of.SSETypes$inboundSchema;var QEr;(function(t){t.inboundSchema=Of.SSETypes$inboundSchema,t.outboundSchema=Of.SSETypes$outboundSchema})(QEr||(Of.SSETypes$=QEr={}))});var Cut=S(Ra=>{"use strict";var VEo=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]}),HEo=Ra&&Ra.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JEo=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"&&VEo(r,e,n[o]);return HEo(r,e),r}}();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.ToolExecutionDeltaEvent$=Ra.ToolExecutionDeltaEvent$outboundSchema=Ra.ToolExecutionDeltaEvent$inboundSchema=Ra.ToolExecutionDeltaEventType$=Ra.ToolExecutionDeltaEventType$outboundSchema=Ra.ToolExecutionDeltaEventType$inboundSchema=Ra.ToolExecutionDeltaEventType=void 0;Ra.toolExecutionDeltaEventToJSON=KEo;Ra.toolExecutionDeltaEventFromJSON=GEo;var QC=JEo(Q()),rPr=le(),WEo=Z(),nPr=Qk();Ra.ToolExecutionDeltaEventType={ToolExecutionDelta:"tool.execution.delta"};Ra.ToolExecutionDeltaEventType$inboundSchema=QC.nativeEnum(Ra.ToolExecutionDeltaEventType);Ra.ToolExecutionDeltaEventType$outboundSchema=Ra.ToolExecutionDeltaEventType$inboundSchema;var ePr;(function(t){t.inboundSchema=Ra.ToolExecutionDeltaEventType$inboundSchema,t.outboundSchema=Ra.ToolExecutionDeltaEventType$outboundSchema})(ePr||(Ra.ToolExecutionDeltaEventType$=ePr={}));Ra.ToolExecutionDeltaEvent$inboundSchema=QC.object({type:Ra.ToolExecutionDeltaEventType$inboundSchema.default("tool.execution.delta"),created_at:QC.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:QC.number().int().default(0),id:QC.string(),name:nPr.BuiltInConnectors$inboundSchema,arguments:QC.string()}).transform(t=>(0,rPr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));Ra.ToolExecutionDeltaEvent$outboundSchema=QC.object({type:Ra.ToolExecutionDeltaEventType$outboundSchema.default("tool.execution.delta"),createdAt:QC.date().transform(t=>t.toISOString()).optional(),outputIndex:QC.number().int().default(0),id:QC.string(),name:nPr.BuiltInConnectors$outboundSchema,arguments:QC.string()}).transform(t=>(0,rPr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var tPr;(function(t){t.inboundSchema=Ra.ToolExecutionDeltaEvent$inboundSchema,t.outboundSchema=Ra.ToolExecutionDeltaEvent$outboundSchema})(tPr||(Ra.ToolExecutionDeltaEvent$=tPr={}));function KEo(t){return JSON.stringify(Ra.ToolExecutionDeltaEvent$outboundSchema.parse(t))}function GEo(t){return(0,WEo.safeParse)(t,e=>Ra.ToolExecutionDeltaEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionDeltaEvent' from JSON")}});var xut=S(Aa=>{"use strict";var XEo=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]}),ZEo=Aa&&Aa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YEo=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"&&XEo(r,e,n[o]);return ZEo(r,e),r}}();Object.defineProperty(Aa,"__esModule",{value:!0});Aa.ToolExecutionDoneEvent$=Aa.ToolExecutionDoneEvent$outboundSchema=Aa.ToolExecutionDoneEvent$inboundSchema=Aa.ToolExecutionDoneEventType$=Aa.ToolExecutionDoneEventType$outboundSchema=Aa.ToolExecutionDoneEventType$inboundSchema=Aa.ToolExecutionDoneEventType=void 0;Aa.toolExecutionDoneEventToJSON=ePo;Aa.toolExecutionDoneEventFromJSON=tPo;var sw=YEo(Q()),aPr=le(),QEo=Z(),sPr=Qk();Aa.ToolExecutionDoneEventType={ToolExecutionDone:"tool.execution.done"};Aa.ToolExecutionDoneEventType$inboundSchema=sw.nativeEnum(Aa.ToolExecutionDoneEventType);Aa.ToolExecutionDoneEventType$outboundSchema=Aa.ToolExecutionDoneEventType$inboundSchema;var oPr;(function(t){t.inboundSchema=Aa.ToolExecutionDoneEventType$inboundSchema,t.outboundSchema=Aa.ToolExecutionDoneEventType$outboundSchema})(oPr||(Aa.ToolExecutionDoneEventType$=oPr={}));Aa.ToolExecutionDoneEvent$inboundSchema=sw.object({type:Aa.ToolExecutionDoneEventType$inboundSchema.default("tool.execution.done"),created_at:sw.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:sw.number().int().default(0),id:sw.string(),name:sPr.BuiltInConnectors$inboundSchema,info:sw.record(sw.any()).optional()}).transform(t=>(0,aPr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));Aa.ToolExecutionDoneEvent$outboundSchema=sw.object({type:Aa.ToolExecutionDoneEventType$outboundSchema.default("tool.execution.done"),createdAt:sw.date().transform(t=>t.toISOString()).optional(),outputIndex:sw.number().int().default(0),id:sw.string(),name:sPr.BuiltInConnectors$outboundSchema,info:sw.record(sw.any()).optional()}).transform(t=>(0,aPr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var iPr;(function(t){t.inboundSchema=Aa.ToolExecutionDoneEvent$inboundSchema,t.outboundSchema=Aa.ToolExecutionDoneEvent$outboundSchema})(iPr||(Aa.ToolExecutionDoneEvent$=iPr={}));function ePo(t){return JSON.stringify(Aa.ToolExecutionDoneEvent$outboundSchema.parse(t))}function tPo(t){return(0,QEo.safeParse)(t,e=>Aa.ToolExecutionDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionDoneEvent' from JSON")}});var Out=S(Na=>{"use strict";var rPo=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]}),nPo=Na&&Na.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oPo=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"&&rPo(r,e,n[o]);return nPo(r,e),r}}();Object.defineProperty(Na,"__esModule",{value:!0});Na.ToolExecutionStartedEvent$=Na.ToolExecutionStartedEvent$outboundSchema=Na.ToolExecutionStartedEvent$inboundSchema=Na.ToolExecutionStartedEventType$=Na.ToolExecutionStartedEventType$outboundSchema=Na.ToolExecutionStartedEventType$inboundSchema=Na.ToolExecutionStartedEventType=void 0;Na.toolExecutionStartedEventToJSON=aPo;Na.toolExecutionStartedEventFromJSON=sPo;var ex=oPo(Q()),cPr=le(),iPo=Z(),dPr=Qk();Na.ToolExecutionStartedEventType={ToolExecutionStarted:"tool.execution.started"};Na.ToolExecutionStartedEventType$inboundSchema=ex.nativeEnum(Na.ToolExecutionStartedEventType);Na.ToolExecutionStartedEventType$outboundSchema=Na.ToolExecutionStartedEventType$inboundSchema;var uPr;(function(t){t.inboundSchema=Na.ToolExecutionStartedEventType$inboundSchema,t.outboundSchema=Na.ToolExecutionStartedEventType$outboundSchema})(uPr||(Na.ToolExecutionStartedEventType$=uPr={}));Na.ToolExecutionStartedEvent$inboundSchema=ex.object({type:Na.ToolExecutionStartedEventType$inboundSchema.default("tool.execution.started"),created_at:ex.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:ex.number().int().default(0),id:ex.string(),name:dPr.BuiltInConnectors$inboundSchema,arguments:ex.string()}).transform(t=>(0,cPr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));Na.ToolExecutionStartedEvent$outboundSchema=ex.object({type:Na.ToolExecutionStartedEventType$outboundSchema.default("tool.execution.started"),createdAt:ex.date().transform(t=>t.toISOString()).optional(),outputIndex:ex.number().int().default(0),id:ex.string(),name:dPr.BuiltInConnectors$outboundSchema,arguments:ex.string()}).transform(t=>(0,cPr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var lPr;(function(t){t.inboundSchema=Na.ToolExecutionStartedEvent$inboundSchema,t.outboundSchema=Na.ToolExecutionStartedEvent$outboundSchema})(lPr||(Na.ToolExecutionStartedEvent$=lPr={}));function aPo(t){return JSON.stringify(Na.ToolExecutionStartedEvent$outboundSchema.parse(t))}function sPo(t){return(0,iPo.safeParse)(t,e=>Na.ToolExecutionStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionStartedEvent' from JSON")}});var gPr=S(ys=>{"use strict";var uPo=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]}),lPo=ys&&ys.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cPo=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"&&uPo(r,e,n[o]);return lPo(r,e),r}}();Object.defineProperty(ys,"__esModule",{value:!0});ys.ConversationEvents$=ys.ConversationEvents$outboundSchema=ys.ConversationEvents$inboundSchema=ys.ConversationEventsData$=ys.ConversationEventsData$outboundSchema=ys.ConversationEventsData$inboundSchema=void 0;ys.conversationEventsDataToJSON=dPo;ys.conversationEventsDataFromJSON=fPo;ys.conversationEventsToJSON=pPo;ys.conversationEventsFromJSON=mPo;var ht=cPo(Q()),mPr=Z(),oIe=Fst(),iIe=kst(),aIe=gut(),sIe=but(),uIe=_ut(),lIe=vut(),cIe=wut(),hPr=Sut(),dIe=Cut(),fIe=xut(),pIe=Out();ys.ConversationEventsData$inboundSchema=ht.union([aIe.FunctionCallEvent$inboundSchema.and(ht.object({type:ht.literal("function.call.delta")}).transform(t=>({type:t.type}))),oIe.AgentHandoffDoneEvent$inboundSchema.and(ht.object({type:ht.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),iIe.AgentHandoffStartedEvent$inboundSchema.and(ht.object({type:ht.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),dIe.ToolExecutionDeltaEvent$inboundSchema.and(ht.object({type:ht.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),pIe.ToolExecutionStartedEvent$inboundSchema.and(ht.object({type:ht.literal("tool.execution.started")}).transform(t=>({type:t.type}))),lIe.ResponseErrorEvent$inboundSchema.and(ht.object({type:ht.literal("conversation.response.error")}).transform(t=>({type:t.type}))),sIe.MessageOutputEvent$inboundSchema.and(ht.object({type:ht.literal("message.output.delta")}).transform(t=>({type:t.type}))),fIe.ToolExecutionDoneEvent$inboundSchema.and(ht.object({type:ht.literal("tool.execution.done")}).transform(t=>({type:t.type}))),uIe.ResponseDoneEvent$inboundSchema.and(ht.object({type:ht.literal("conversation.response.done")}).transform(t=>({type:t.type}))),cIe.ResponseStartedEvent$inboundSchema.and(ht.object({type:ht.literal("conversation.response.started")}).transform(t=>({type:t.type})))]);ys.ConversationEventsData$outboundSchema=ht.union([aIe.FunctionCallEvent$outboundSchema.and(ht.object({type:ht.literal("function.call.delta")}).transform(t=>({type:t.type}))),oIe.AgentHandoffDoneEvent$outboundSchema.and(ht.object({type:ht.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),iIe.AgentHandoffStartedEvent$outboundSchema.and(ht.object({type:ht.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),dIe.ToolExecutionDeltaEvent$outboundSchema.and(ht.object({type:ht.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),pIe.ToolExecutionStartedEvent$outboundSchema.and(ht.object({type:ht.literal("tool.execution.started")}).transform(t=>({type:t.type}))),lIe.ResponseErrorEvent$outboundSchema.and(ht.object({type:ht.literal("conversation.response.error")}).transform(t=>({type:t.type}))),sIe.MessageOutputEvent$outboundSchema.and(ht.object({type:ht.literal("message.output.delta")}).transform(t=>({type:t.type}))),fIe.ToolExecutionDoneEvent$outboundSchema.and(ht.object({type:ht.literal("tool.execution.done")}).transform(t=>({type:t.type}))),uIe.ResponseDoneEvent$outboundSchema.and(ht.object({type:ht.literal("conversation.response.done")}).transform(t=>({type:t.type}))),cIe.ResponseStartedEvent$outboundSchema.and(ht.object({type:ht.literal("conversation.response.started")}).transform(t=>({type:t.type})))]);var fPr;(function(t){t.inboundSchema=ys.ConversationEventsData$inboundSchema,t.outboundSchema=ys.ConversationEventsData$outboundSchema})(fPr||(ys.ConversationEventsData$=fPr={}));function dPo(t){return JSON.stringify(ys.ConversationEventsData$outboundSchema.parse(t))}function fPo(t){return(0,mPr.safeParse)(t,e=>ys.ConversationEventsData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationEventsData' from JSON")}ys.ConversationEvents$inboundSchema=ht.object({event:hPr.SSETypes$inboundSchema,data:ht.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:ht.ZodIssueCode.custom,message:`malformed json: ${r}`}),ht.NEVER}}).pipe(ht.union([aIe.FunctionCallEvent$inboundSchema.and(ht.object({type:ht.literal("function.call.delta")}).transform(t=>({type:t.type}))),oIe.AgentHandoffDoneEvent$inboundSchema.and(ht.object({type:ht.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),iIe.AgentHandoffStartedEvent$inboundSchema.and(ht.object({type:ht.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),dIe.ToolExecutionDeltaEvent$inboundSchema.and(ht.object({type:ht.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),pIe.ToolExecutionStartedEvent$inboundSchema.and(ht.object({type:ht.literal("tool.execution.started")}).transform(t=>({type:t.type}))),lIe.ResponseErrorEvent$inboundSchema.and(ht.object({type:ht.literal("conversation.response.error")}).transform(t=>({type:t.type}))),sIe.MessageOutputEvent$inboundSchema.and(ht.object({type:ht.literal("message.output.delta")}).transform(t=>({type:t.type}))),fIe.ToolExecutionDoneEvent$inboundSchema.and(ht.object({type:ht.literal("tool.execution.done")}).transform(t=>({type:t.type}))),uIe.ResponseDoneEvent$inboundSchema.and(ht.object({type:ht.literal("conversation.response.done")}).transform(t=>({type:t.type}))),cIe.ResponseStartedEvent$inboundSchema.and(ht.object({type:ht.literal("conversation.response.started")}).transform(t=>({type:t.type})))]))});ys.ConversationEvents$outboundSchema=ht.object({event:hPr.SSETypes$outboundSchema,data:ht.union([aIe.FunctionCallEvent$outboundSchema.and(ht.object({type:ht.literal("function.call.delta")}).transform(t=>({type:t.type}))),oIe.AgentHandoffDoneEvent$outboundSchema.and(ht.object({type:ht.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),iIe.AgentHandoffStartedEvent$outboundSchema.and(ht.object({type:ht.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),dIe.ToolExecutionDeltaEvent$outboundSchema.and(ht.object({type:ht.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),pIe.ToolExecutionStartedEvent$outboundSchema.and(ht.object({type:ht.literal("tool.execution.started")}).transform(t=>({type:t.type}))),lIe.ResponseErrorEvent$outboundSchema.and(ht.object({type:ht.literal("conversation.response.error")}).transform(t=>({type:t.type}))),sIe.MessageOutputEvent$outboundSchema.and(ht.object({type:ht.literal("message.output.delta")}).transform(t=>({type:t.type}))),fIe.ToolExecutionDoneEvent$outboundSchema.and(ht.object({type:ht.literal("tool.execution.done")}).transform(t=>({type:t.type}))),uIe.ResponseDoneEvent$outboundSchema.and(ht.object({type:ht.literal("conversation.response.done")}).transform(t=>({type:t.type}))),cIe.ResponseStartedEvent$outboundSchema.and(ht.object({type:ht.literal("conversation.response.started")}).transform(t=>({type:t.type})))])});var pPr;(function(t){t.inboundSchema=ys.ConversationEvents$inboundSchema,t.outboundSchema=ys.ConversationEvents$outboundSchema})(pPr||(ys.ConversationEvents$=pPr={}));function pPo(t){return JSON.stringify(ys.ConversationEvents$outboundSchema.parse(t))}function mPo(t){return(0,mPr.safeParse)(t,e=>ys.ConversationEvents$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationEvents' from JSON")}});var SPr=S(go=>{"use strict";var hPo=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]}),gPo=go&&go.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yPo=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"&&hPo(r,e,n[o]);return gPo(r,e),r}}();Object.defineProperty(go,"__esModule",{value:!0});go.ConversationHistory$=go.ConversationHistory$outboundSchema=go.ConversationHistory$inboundSchema=go.Entries$=go.Entries$outboundSchema=go.Entries$inboundSchema=go.ConversationHistoryObject$=go.ConversationHistoryObject$outboundSchema=go.ConversationHistoryObject$inboundSchema=go.ConversationHistoryObject=void 0;go.entriesToJSON=bPo;go.entriesFromJSON=_Po;go.conversationHistoryToJSON=vPo;go.conversationHistoryFromJSON=wPo;var tx=yPo(Q()),vPr=le(),wPr=Z(),mIe=Mae(),hIe=jae(),gIe=YMe(),yIe=$ae(),bIe=y9(),_Ie=Lae();go.ConversationHistoryObject={ConversationHistory:"conversation.history"};go.ConversationHistoryObject$inboundSchema=tx.nativeEnum(go.ConversationHistoryObject);go.ConversationHistoryObject$outboundSchema=go.ConversationHistoryObject$inboundSchema;var yPr;(function(t){t.inboundSchema=go.ConversationHistoryObject$inboundSchema,t.outboundSchema=go.ConversationHistoryObject$outboundSchema})(yPr||(go.ConversationHistoryObject$=yPr={}));go.Entries$inboundSchema=tx.union([mIe.AgentHandoffEntry$inboundSchema,hIe.FunctionCallEntry$inboundSchema,yIe.MessageInputEntry$inboundSchema,gIe.FunctionResultEntry$inboundSchema,_Ie.ToolExecutionEntry$inboundSchema,bIe.MessageOutputEntry$inboundSchema]);go.Entries$outboundSchema=tx.union([mIe.AgentHandoffEntry$outboundSchema,hIe.FunctionCallEntry$outboundSchema,yIe.MessageInputEntry$outboundSchema,gIe.FunctionResultEntry$outboundSchema,_Ie.ToolExecutionEntry$outboundSchema,bIe.MessageOutputEntry$outboundSchema]);var bPr;(function(t){t.inboundSchema=go.Entries$inboundSchema,t.outboundSchema=go.Entries$outboundSchema})(bPr||(go.Entries$=bPr={}));function bPo(t){return JSON.stringify(go.Entries$outboundSchema.parse(t))}function _Po(t){return(0,wPr.safeParse)(t,e=>go.Entries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Entries' from JSON")}go.ConversationHistory$inboundSchema=tx.object({object:go.ConversationHistoryObject$inboundSchema.default("conversation.history"),conversation_id:tx.string(),entries:tx.array(tx.union([mIe.AgentHandoffEntry$inboundSchema,hIe.FunctionCallEntry$inboundSchema,yIe.MessageInputEntry$inboundSchema,gIe.FunctionResultEntry$inboundSchema,_Ie.ToolExecutionEntry$inboundSchema,bIe.MessageOutputEntry$inboundSchema]))}).transform(t=>(0,vPr.remap)(t,{conversation_id:"conversationId"}));go.ConversationHistory$outboundSchema=tx.object({object:go.ConversationHistoryObject$outboundSchema.default("conversation.history"),conversationId:tx.string(),entries:tx.array(tx.union([mIe.AgentHandoffEntry$outboundSchema,hIe.FunctionCallEntry$outboundSchema,yIe.MessageInputEntry$outboundSchema,gIe.FunctionResultEntry$outboundSchema,_Ie.ToolExecutionEntry$outboundSchema,bIe.MessageOutputEntry$outboundSchema]))}).transform(t=>(0,vPr.remap)(t,{conversationId:"conversation_id"}));var _Pr;(function(t){t.inboundSchema=go.ConversationHistory$inboundSchema,t.outboundSchema=go.ConversationHistory$outboundSchema})(_Pr||(go.ConversationHistory$=_Pr={}));function vPo(t){return JSON.stringify(go.ConversationHistory$outboundSchema.parse(t))}function wPo(t){return(0,wPr.safeParse)(t,e=>go.ConversationHistory$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationHistory' from JSON")}});var Tut=S(Tf=>{"use strict";var SPo=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]}),CPo=Tf&&Tf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xPo=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"&&SPo(r,e,n[o]);return CPo(r,e),r}}();Object.defineProperty(Tf,"__esModule",{value:!0});Tf.MessageEntries$=Tf.MessageEntries$outboundSchema=Tf.MessageEntries$inboundSchema=void 0;Tf.messageEntriesToJSON=TPo;Tf.messageEntriesFromJSON=EPo;var xPr=xPo(Q()),OPo=Z(),OPr=$ae(),TPr=y9();Tf.MessageEntries$inboundSchema=xPr.union([OPr.MessageInputEntry$inboundSchema,TPr.MessageOutputEntry$inboundSchema]);Tf.MessageEntries$outboundSchema=xPr.union([OPr.MessageInputEntry$outboundSchema,TPr.MessageOutputEntry$outboundSchema]);var CPr;(function(t){t.inboundSchema=Tf.MessageEntries$inboundSchema,t.outboundSchema=Tf.MessageEntries$outboundSchema})(CPr||(Tf.MessageEntries$=CPr={}));function TPo(t){return JSON.stringify(Tf.MessageEntries$outboundSchema.parse(t))}function EPo(t){return(0,OPo.safeParse)(t,e=>Tf.MessageEntries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageEntries' from JSON")}});var RPr=S(ja=>{"use strict";var PPo=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]}),MPo=ja&&ja.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IPo=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"&&PPo(r,e,n[o]);return MPo(r,e),r}}();Object.defineProperty(ja,"__esModule",{value:!0});ja.ConversationMessages$=ja.ConversationMessages$outboundSchema=ja.ConversationMessages$inboundSchema=ja.ConversationMessagesObject$=ja.ConversationMessagesObject$outboundSchema=ja.ConversationMessagesObject$inboundSchema=ja.ConversationMessagesObject=void 0;ja.conversationMessagesToJSON=APo;ja.conversationMessagesFromJSON=NPo;var yH=IPo(Q()),MPr=le(),RPo=Z(),IPr=Tut();ja.ConversationMessagesObject={ConversationMessages:"conversation.messages"};ja.ConversationMessagesObject$inboundSchema=yH.nativeEnum(ja.ConversationMessagesObject);ja.ConversationMessagesObject$outboundSchema=ja.ConversationMessagesObject$inboundSchema;var EPr;(function(t){t.inboundSchema=ja.ConversationMessagesObject$inboundSchema,t.outboundSchema=ja.ConversationMessagesObject$outboundSchema})(EPr||(ja.ConversationMessagesObject$=EPr={}));ja.ConversationMessages$inboundSchema=yH.object({object:ja.ConversationMessagesObject$inboundSchema.default("conversation.messages"),conversation_id:yH.string(),messages:yH.array(IPr.MessageEntries$inboundSchema)}).transform(t=>(0,MPr.remap)(t,{conversation_id:"conversationId"}));ja.ConversationMessages$outboundSchema=yH.object({object:ja.ConversationMessagesObject$outboundSchema.default("conversation.messages"),conversationId:yH.string(),messages:yH.array(IPr.MessageEntries$outboundSchema)}).transform(t=>(0,MPr.remap)(t,{conversationId:"conversation_id"}));var PPr;(function(t){t.inboundSchema=ja.ConversationMessages$inboundSchema,t.outboundSchema=ja.ConversationMessages$outboundSchema})(PPr||(ja.ConversationMessages$=PPr={}));function APo(t){return JSON.stringify(ja.ConversationMessages$outboundSchema.parse(t))}function NPo(t){return(0,RPo.safeParse)(t,e=>ja.ConversationMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationMessages' from JSON")}});var kPr=S(yo=>{"use strict";var jPo=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]}),DPo=yo&&yo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Po=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"&&jPo(r,e,n[o]);return DPo(r,e),r}}();Object.defineProperty(yo,"__esModule",{value:!0});yo.ConversationRequest$=yo.ConversationRequest$outboundSchema=yo.ConversationRequest$inboundSchema=yo.Tools$=yo.Tools$outboundSchema=yo.Tools$inboundSchema=yo.HandoffExecution$=yo.HandoffExecution$outboundSchema=yo.HandoffExecution$inboundSchema=yo.HandoffExecution=void 0;yo.toolsToJSON=LPo;yo.toolsFromJSON=FPo;yo.conversationRequestToJSON=kPo;yo.conversationRequestFromJSON=qPo;var gt=$Po(Q()),DPr=le(),$Pr=Z(),vIe=zk(),LPr=JS(),FPr=rq(),wIe=Jk(),SIe=Wk(),CIe=Kk(),xIe=Gk(),OIe=Xk();yo.HandoffExecution={Client:"client",Server:"server"};yo.HandoffExecution$inboundSchema=gt.nativeEnum(yo.HandoffExecution);yo.HandoffExecution$outboundSchema=yo.HandoffExecution$inboundSchema;var APr;(function(t){t.inboundSchema=yo.HandoffExecution$inboundSchema,t.outboundSchema=yo.HandoffExecution$outboundSchema})(APr||(yo.HandoffExecution$=APr={}));yo.Tools$inboundSchema=gt.union([wIe.DocumentLibraryTool$inboundSchema.and(gt.object({type:gt.literal("document_library")}).transform(t=>({type:t.type}))),SIe.FunctionTool$inboundSchema.and(gt.object({type:gt.literal("function")}).transform(t=>({type:t.type}))),vIe.CodeInterpreterTool$inboundSchema.and(gt.object({type:gt.literal("code_interpreter")}).transform(t=>({type:t.type}))),CIe.ImageGenerationTool$inboundSchema.and(gt.object({type:gt.literal("image_generation")}).transform(t=>({type:t.type}))),OIe.WebSearchTool$inboundSchema.and(gt.object({type:gt.literal("web_search")}).transform(t=>({type:t.type}))),xIe.WebSearchPremiumTool$inboundSchema.and(gt.object({type:gt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);yo.Tools$outboundSchema=gt.union([wIe.DocumentLibraryTool$outboundSchema.and(gt.object({type:gt.literal("document_library")}).transform(t=>({type:t.type}))),SIe.FunctionTool$outboundSchema.and(gt.object({type:gt.literal("function")}).transform(t=>({type:t.type}))),vIe.CodeInterpreterTool$outboundSchema.and(gt.object({type:gt.literal("code_interpreter")}).transform(t=>({type:t.type}))),CIe.ImageGenerationTool$outboundSchema.and(gt.object({type:gt.literal("image_generation")}).transform(t=>({type:t.type}))),OIe.WebSearchTool$outboundSchema.and(gt.object({type:gt.literal("web_search")}).transform(t=>({type:t.type}))),xIe.WebSearchPremiumTool$outboundSchema.and(gt.object({type:gt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var NPr;(function(t){t.inboundSchema=yo.Tools$inboundSchema,t.outboundSchema=yo.Tools$outboundSchema})(NPr||(yo.Tools$=NPr={}));function LPo(t){return JSON.stringify(yo.Tools$outboundSchema.parse(t))}function FPo(t){return(0,$Pr.safeParse)(t,e=>yo.Tools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tools' from JSON")}yo.ConversationRequest$inboundSchema=gt.object({inputs:FPr.ConversationInputs$inboundSchema,stream:gt.boolean().default(!1),store:gt.nullable(gt.boolean()).optional(),handoff_execution:gt.nullable(yo.HandoffExecution$inboundSchema).optional(),instructions:gt.nullable(gt.string()).optional(),tools:gt.nullable(gt.array(gt.union([wIe.DocumentLibraryTool$inboundSchema.and(gt.object({type:gt.literal("document_library")}).transform(t=>({type:t.type}))),SIe.FunctionTool$inboundSchema.and(gt.object({type:gt.literal("function")}).transform(t=>({type:t.type}))),vIe.CodeInterpreterTool$inboundSchema.and(gt.object({type:gt.literal("code_interpreter")}).transform(t=>({type:t.type}))),CIe.ImageGenerationTool$inboundSchema.and(gt.object({type:gt.literal("image_generation")}).transform(t=>({type:t.type}))),OIe.WebSearchTool$inboundSchema.and(gt.object({type:gt.literal("web_search")}).transform(t=>({type:t.type}))),xIe.WebSearchPremiumTool$inboundSchema.and(gt.object({type:gt.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completion_args:gt.nullable(LPr.CompletionArgs$inboundSchema).optional(),name:gt.nullable(gt.string()).optional(),description:gt.nullable(gt.string()).optional(),agent_id:gt.nullable(gt.string()).optional(),model:gt.nullable(gt.string()).optional()}).transform(t=>(0,DPr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",agent_id:"agentId"}));yo.ConversationRequest$outboundSchema=gt.object({inputs:FPr.ConversationInputs$outboundSchema,stream:gt.boolean().default(!1),store:gt.nullable(gt.boolean()).optional(),handoffExecution:gt.nullable(yo.HandoffExecution$outboundSchema).optional(),instructions:gt.nullable(gt.string()).optional(),tools:gt.nullable(gt.array(gt.union([wIe.DocumentLibraryTool$outboundSchema.and(gt.object({type:gt.literal("document_library")}).transform(t=>({type:t.type}))),SIe.FunctionTool$outboundSchema.and(gt.object({type:gt.literal("function")}).transform(t=>({type:t.type}))),vIe.CodeInterpreterTool$outboundSchema.and(gt.object({type:gt.literal("code_interpreter")}).transform(t=>({type:t.type}))),CIe.ImageGenerationTool$outboundSchema.and(gt.object({type:gt.literal("image_generation")}).transform(t=>({type:t.type}))),OIe.WebSearchTool$outboundSchema.and(gt.object({type:gt.literal("web_search")}).transform(t=>({type:t.type}))),xIe.WebSearchPremiumTool$outboundSchema.and(gt.object({type:gt.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completionArgs:gt.nullable(LPr.CompletionArgs$outboundSchema).optional(),name:gt.nullable(gt.string()).optional(),description:gt.nullable(gt.string()).optional(),agentId:gt.nullable(gt.string()).optional(),model:gt.nullable(gt.string()).optional()}).transform(t=>(0,DPr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",agentId:"agent_id"}));var jPr;(function(t){t.inboundSchema=yo.ConversationRequest$inboundSchema,t.outboundSchema=yo.ConversationRequest$outboundSchema})(jPr||(yo.ConversationRequest$=jPr={}));function kPo(t){return JSON.stringify(yo.ConversationRequest$outboundSchema.parse(t))}function qPo(t){return(0,$Pr.safeParse)(t,e=>yo.ConversationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRequest' from JSON")}});var JPr=S(bo=>{"use strict";var UPo=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]}),BPo=bo&&bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zPo=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"&&UPo(r,e,n[o]);return BPo(r,e),r}}();Object.defineProperty(bo,"__esModule",{value:!0});bo.ConversationResponse$=bo.ConversationResponse$outboundSchema=bo.ConversationResponse$inboundSchema=bo.Outputs$=bo.Outputs$outboundSchema=bo.Outputs$inboundSchema=bo.ConversationResponseObject$=bo.ConversationResponseObject$outboundSchema=bo.ConversationResponseObject$inboundSchema=bo.ConversationResponseObject=void 0;bo.outputsToJSON=VPo;bo.outputsFromJSON=HPo;bo.conversationResponseToJSON=JPo;bo.conversationResponseFromJSON=WPo;var rx=zPo(Q()),zPr=le(),VPr=Z(),TIe=Mae(),HPr=nIe(),EIe=jae(),PIe=y9(),MIe=Lae();bo.ConversationResponseObject={ConversationResponse:"conversation.response"};bo.ConversationResponseObject$inboundSchema=rx.nativeEnum(bo.ConversationResponseObject);bo.ConversationResponseObject$outboundSchema=bo.ConversationResponseObject$inboundSchema;var qPr;(function(t){t.inboundSchema=bo.ConversationResponseObject$inboundSchema,t.outboundSchema=bo.ConversationResponseObject$outboundSchema})(qPr||(bo.ConversationResponseObject$=qPr={}));bo.Outputs$inboundSchema=rx.union([TIe.AgentHandoffEntry$inboundSchema,EIe.FunctionCallEntry$inboundSchema,MIe.ToolExecutionEntry$inboundSchema,PIe.MessageOutputEntry$inboundSchema]);bo.Outputs$outboundSchema=rx.union([TIe.AgentHandoffEntry$outboundSchema,EIe.FunctionCallEntry$outboundSchema,MIe.ToolExecutionEntry$outboundSchema,PIe.MessageOutputEntry$outboundSchema]);var UPr;(function(t){t.inboundSchema=bo.Outputs$inboundSchema,t.outboundSchema=bo.Outputs$outboundSchema})(UPr||(bo.Outputs$=UPr={}));function VPo(t){return JSON.stringify(bo.Outputs$outboundSchema.parse(t))}function HPo(t){return(0,VPr.safeParse)(t,e=>bo.Outputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Outputs' from JSON")}bo.ConversationResponse$inboundSchema=rx.object({object:bo.ConversationResponseObject$inboundSchema.default("conversation.response"),conversation_id:rx.string(),outputs:rx.array(rx.union([TIe.AgentHandoffEntry$inboundSchema,EIe.FunctionCallEntry$inboundSchema,MIe.ToolExecutionEntry$inboundSchema,PIe.MessageOutputEntry$inboundSchema])),usage:HPr.ConversationUsageInfo$inboundSchema}).transform(t=>(0,zPr.remap)(t,{conversation_id:"conversationId"}));bo.ConversationResponse$outboundSchema=rx.object({object:bo.ConversationResponseObject$outboundSchema.default("conversation.response"),conversationId:rx.string(),outputs:rx.array(rx.union([TIe.AgentHandoffEntry$outboundSchema,EIe.FunctionCallEntry$outboundSchema,MIe.ToolExecutionEntry$outboundSchema,PIe.MessageOutputEntry$outboundSchema])),usage:HPr.ConversationUsageInfo$outboundSchema}).transform(t=>(0,zPr.remap)(t,{conversationId:"conversation_id"}));var BPr;(function(t){t.inboundSchema=bo.ConversationResponse$inboundSchema,t.outboundSchema=bo.ConversationResponse$outboundSchema})(BPr||(bo.ConversationResponse$=BPr={}));function JPo(t){return JSON.stringify(bo.ConversationResponse$outboundSchema.parse(t))}function WPo(t){return(0,VPr.safeParse)(t,e=>bo.ConversationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationResponse' from JSON")}});var YPr=S(Da=>{"use strict";var KPo=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]}),GPo=Da&&Da.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XPo=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"&&KPo(r,e,n[o]);return GPo(r,e),r}}();Object.defineProperty(Da,"__esModule",{value:!0});Da.ConversationRestartRequest$=Da.ConversationRestartRequest$outboundSchema=Da.ConversationRestartRequest$inboundSchema=Da.ConversationRestartRequestHandoffExecution$=Da.ConversationRestartRequestHandoffExecution$outboundSchema=Da.ConversationRestartRequestHandoffExecution$inboundSchema=Da.ConversationRestartRequestHandoffExecution=void 0;Da.conversationRestartRequestToJSON=YPo;Da.conversationRestartRequestFromJSON=QPo;var oj=XPo(Q()),GPr=le(),ZPo=Z(),XPr=JS(),ZPr=rq();Da.ConversationRestartRequestHandoffExecution={Client:"client",Server:"server"};Da.ConversationRestartRequestHandoffExecution$inboundSchema=oj.nativeEnum(Da.ConversationRestartRequestHandoffExecution);Da.ConversationRestartRequestHandoffExecution$outboundSchema=Da.ConversationRestartRequestHandoffExecution$inboundSchema;var WPr;(function(t){t.inboundSchema=Da.ConversationRestartRequestHandoffExecution$inboundSchema,t.outboundSchema=Da.ConversationRestartRequestHandoffExecution$outboundSchema})(WPr||(Da.ConversationRestartRequestHandoffExecution$=WPr={}));Da.ConversationRestartRequest$inboundSchema=oj.object({inputs:ZPr.ConversationInputs$inboundSchema,stream:oj.boolean().default(!1),store:oj.boolean().default(!0),handoff_execution:Da.ConversationRestartRequestHandoffExecution$inboundSchema.default("server"),completion_args:XPr.CompletionArgs$inboundSchema.optional(),from_entry_id:oj.string()}).transform(t=>(0,GPr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",from_entry_id:"fromEntryId"}));Da.ConversationRestartRequest$outboundSchema=oj.object({inputs:ZPr.ConversationInputs$outboundSchema,stream:oj.boolean().default(!1),store:oj.boolean().default(!0),handoffExecution:Da.ConversationRestartRequestHandoffExecution$outboundSchema.default("server"),completionArgs:XPr.CompletionArgs$outboundSchema.optional(),fromEntryId:oj.string()}).transform(t=>(0,GPr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",fromEntryId:"from_entry_id"}));var KPr;(function(t){t.inboundSchema=Da.ConversationRestartRequest$inboundSchema,t.outboundSchema=Da.ConversationRestartRequest$outboundSchema})(KPr||(Da.ConversationRestartRequest$=KPr={}));function YPo(t){return JSON.stringify(Da.ConversationRestartRequest$outboundSchema.parse(t))}function QPo(t){return(0,ZPo.safeParse)(t,e=>Da.ConversationRestartRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRestartRequest' from JSON")}});var oMr=S($a=>{"use strict";var eMo=$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]}),tMo=$a&&$a.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rMo=$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"&&eMo(r,e,n[o]);return tMo(r,e),r}}();Object.defineProperty($a,"__esModule",{value:!0});$a.ConversationRestartStreamRequest$=$a.ConversationRestartStreamRequest$outboundSchema=$a.ConversationRestartStreamRequest$inboundSchema=$a.ConversationRestartStreamRequestHandoffExecution$=$a.ConversationRestartStreamRequestHandoffExecution$outboundSchema=$a.ConversationRestartStreamRequestHandoffExecution$inboundSchema=$a.ConversationRestartStreamRequestHandoffExecution=void 0;$a.conversationRestartStreamRequestToJSON=oMo;$a.conversationRestartStreamRequestFromJSON=iMo;var ij=rMo(Q()),tMr=le(),nMo=Z(),rMr=JS(),nMr=rq();$a.ConversationRestartStreamRequestHandoffExecution={Client:"client",Server:"server"};$a.ConversationRestartStreamRequestHandoffExecution$inboundSchema=ij.nativeEnum($a.ConversationRestartStreamRequestHandoffExecution);$a.ConversationRestartStreamRequestHandoffExecution$outboundSchema=$a.ConversationRestartStreamRequestHandoffExecution$inboundSchema;var QPr;(function(t){t.inboundSchema=$a.ConversationRestartStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=$a.ConversationRestartStreamRequestHandoffExecution$outboundSchema})(QPr||($a.ConversationRestartStreamRequestHandoffExecution$=QPr={}));$a.ConversationRestartStreamRequest$inboundSchema=ij.object({inputs:nMr.ConversationInputs$inboundSchema,stream:ij.boolean().default(!0),store:ij.boolean().default(!0),handoff_execution:$a.ConversationRestartStreamRequestHandoffExecution$inboundSchema.default("server"),completion_args:rMr.CompletionArgs$inboundSchema.optional(),from_entry_id:ij.string()}).transform(t=>(0,tMr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",from_entry_id:"fromEntryId"}));$a.ConversationRestartStreamRequest$outboundSchema=ij.object({inputs:nMr.ConversationInputs$outboundSchema,stream:ij.boolean().default(!0),store:ij.boolean().default(!0),handoffExecution:$a.ConversationRestartStreamRequestHandoffExecution$outboundSchema.default("server"),completionArgs:rMr.CompletionArgs$outboundSchema.optional(),fromEntryId:ij.string()}).transform(t=>(0,tMr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",fromEntryId:"from_entry_id"}));var eMr;(function(t){t.inboundSchema=$a.ConversationRestartStreamRequest$inboundSchema,t.outboundSchema=$a.ConversationRestartStreamRequest$outboundSchema})(eMr||($a.ConversationRestartStreamRequest$=eMr={}));function oMo(t){return JSON.stringify($a.ConversationRestartStreamRequest$outboundSchema.parse(t))}function iMo(t){return(0,nMo.safeParse)(t,e=>$a.ConversationRestartStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRestartStreamRequest' from JSON")}});var fMr=S(_o=>{"use strict";var aMo=_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]}),sMo=_o&&_o.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uMo=_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"&&aMo(r,e,n[o]);return sMo(r,e),r}}();Object.defineProperty(_o,"__esModule",{value:!0});_o.ConversationStreamRequest$=_o.ConversationStreamRequest$outboundSchema=_o.ConversationStreamRequest$inboundSchema=_o.ConversationStreamRequestTools$=_o.ConversationStreamRequestTools$outboundSchema=_o.ConversationStreamRequestTools$inboundSchema=_o.ConversationStreamRequestHandoffExecution$=_o.ConversationStreamRequestHandoffExecution$outboundSchema=_o.ConversationStreamRequestHandoffExecution$inboundSchema=_o.ConversationStreamRequestHandoffExecution=void 0;_o.conversationStreamRequestToolsToJSON=lMo;_o.conversationStreamRequestToolsFromJSON=cMo;_o.conversationStreamRequestToJSON=dMo;_o.conversationStreamRequestFromJSON=fMo;var yt=uMo(Q()),uMr=le(),lMr=Z(),IIe=zk(),cMr=JS(),dMr=rq(),RIe=Jk(),AIe=Wk(),NIe=Kk(),jIe=Gk(),DIe=Xk();_o.ConversationStreamRequestHandoffExecution={Client:"client",Server:"server"};_o.ConversationStreamRequestHandoffExecution$inboundSchema=yt.nativeEnum(_o.ConversationStreamRequestHandoffExecution);_o.ConversationStreamRequestHandoffExecution$outboundSchema=_o.ConversationStreamRequestHandoffExecution$inboundSchema;var iMr;(function(t){t.inboundSchema=_o.ConversationStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=_o.ConversationStreamRequestHandoffExecution$outboundSchema})(iMr||(_o.ConversationStreamRequestHandoffExecution$=iMr={}));_o.ConversationStreamRequestTools$inboundSchema=yt.union([RIe.DocumentLibraryTool$inboundSchema.and(yt.object({type:yt.literal("document_library")}).transform(t=>({type:t.type}))),AIe.FunctionTool$inboundSchema.and(yt.object({type:yt.literal("function")}).transform(t=>({type:t.type}))),IIe.CodeInterpreterTool$inboundSchema.and(yt.object({type:yt.literal("code_interpreter")}).transform(t=>({type:t.type}))),NIe.ImageGenerationTool$inboundSchema.and(yt.object({type:yt.literal("image_generation")}).transform(t=>({type:t.type}))),DIe.WebSearchTool$inboundSchema.and(yt.object({type:yt.literal("web_search")}).transform(t=>({type:t.type}))),jIe.WebSearchPremiumTool$inboundSchema.and(yt.object({type:yt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);_o.ConversationStreamRequestTools$outboundSchema=yt.union([RIe.DocumentLibraryTool$outboundSchema.and(yt.object({type:yt.literal("document_library")}).transform(t=>({type:t.type}))),AIe.FunctionTool$outboundSchema.and(yt.object({type:yt.literal("function")}).transform(t=>({type:t.type}))),IIe.CodeInterpreterTool$outboundSchema.and(yt.object({type:yt.literal("code_interpreter")}).transform(t=>({type:t.type}))),NIe.ImageGenerationTool$outboundSchema.and(yt.object({type:yt.literal("image_generation")}).transform(t=>({type:t.type}))),DIe.WebSearchTool$outboundSchema.and(yt.object({type:yt.literal("web_search")}).transform(t=>({type:t.type}))),jIe.WebSearchPremiumTool$outboundSchema.and(yt.object({type:yt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var aMr;(function(t){t.inboundSchema=_o.ConversationStreamRequestTools$inboundSchema,t.outboundSchema=_o.ConversationStreamRequestTools$outboundSchema})(aMr||(_o.ConversationStreamRequestTools$=aMr={}));function lMo(t){return JSON.stringify(_o.ConversationStreamRequestTools$outboundSchema.parse(t))}function cMo(t){return(0,lMr.safeParse)(t,e=>_o.ConversationStreamRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationStreamRequestTools' from JSON")}_o.ConversationStreamRequest$inboundSchema=yt.object({inputs:dMr.ConversationInputs$inboundSchema,stream:yt.boolean().default(!0),store:yt.nullable(yt.boolean()).optional(),handoff_execution:yt.nullable(_o.ConversationStreamRequestHandoffExecution$inboundSchema).optional(),instructions:yt.nullable(yt.string()).optional(),tools:yt.nullable(yt.array(yt.union([RIe.DocumentLibraryTool$inboundSchema.and(yt.object({type:yt.literal("document_library")}).transform(t=>({type:t.type}))),AIe.FunctionTool$inboundSchema.and(yt.object({type:yt.literal("function")}).transform(t=>({type:t.type}))),IIe.CodeInterpreterTool$inboundSchema.and(yt.object({type:yt.literal("code_interpreter")}).transform(t=>({type:t.type}))),NIe.ImageGenerationTool$inboundSchema.and(yt.object({type:yt.literal("image_generation")}).transform(t=>({type:t.type}))),DIe.WebSearchTool$inboundSchema.and(yt.object({type:yt.literal("web_search")}).transform(t=>({type:t.type}))),jIe.WebSearchPremiumTool$inboundSchema.and(yt.object({type:yt.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completion_args:yt.nullable(cMr.CompletionArgs$inboundSchema).optional(),name:yt.nullable(yt.string()).optional(),description:yt.nullable(yt.string()).optional(),agent_id:yt.nullable(yt.string()).optional(),model:yt.nullable(yt.string()).optional()}).transform(t=>(0,uMr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",agent_id:"agentId"}));_o.ConversationStreamRequest$outboundSchema=yt.object({inputs:dMr.ConversationInputs$outboundSchema,stream:yt.boolean().default(!0),store:yt.nullable(yt.boolean()).optional(),handoffExecution:yt.nullable(_o.ConversationStreamRequestHandoffExecution$outboundSchema).optional(),instructions:yt.nullable(yt.string()).optional(),tools:yt.nullable(yt.array(yt.union([RIe.DocumentLibraryTool$outboundSchema.and(yt.object({type:yt.literal("document_library")}).transform(t=>({type:t.type}))),AIe.FunctionTool$outboundSchema.and(yt.object({type:yt.literal("function")}).transform(t=>({type:t.type}))),IIe.CodeInterpreterTool$outboundSchema.and(yt.object({type:yt.literal("code_interpreter")}).transform(t=>({type:t.type}))),NIe.ImageGenerationTool$outboundSchema.and(yt.object({type:yt.literal("image_generation")}).transform(t=>({type:t.type}))),DIe.WebSearchTool$outboundSchema.and(yt.object({type:yt.literal("web_search")}).transform(t=>({type:t.type}))),jIe.WebSearchPremiumTool$outboundSchema.and(yt.object({type:yt.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completionArgs:yt.nullable(cMr.CompletionArgs$outboundSchema).optional(),name:yt.nullable(yt.string()).optional(),description:yt.nullable(yt.string()).optional(),agentId:yt.nullable(yt.string()).optional(),model:yt.nullable(yt.string()).optional()}).transform(t=>(0,uMr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",agentId:"agent_id"}));var sMr;(function(t){t.inboundSchema=_o.ConversationStreamRequest$inboundSchema,t.outboundSchema=_o.ConversationStreamRequest$outboundSchema})(sMr||(_o.ConversationStreamRequest$=sMr={}));function dMo(t){return JSON.stringify(_o.ConversationStreamRequest$outboundSchema.parse(t))}function fMo(t){return(0,lMr.safeParse)(t,e=>_o.ConversationStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationStreamRequest' from JSON")}});var mMr=S(Ef=>{"use strict";var pMo=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]}),mMo=Ef&&Ef.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hMo=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"&&pMo(r,e,n[o]);return mMo(r,e),r}}();Object.defineProperty(Ef,"__esModule",{value:!0});Ef.DeleteFileOut$=Ef.DeleteFileOut$outboundSchema=Ef.DeleteFileOut$inboundSchema=void 0;Ef.deleteFileOutToJSON=yMo;Ef.deleteFileOutFromJSON=bMo;var nq=hMo(Q()),gMo=Z();Ef.DeleteFileOut$inboundSchema=nq.object({id:nq.string(),object:nq.string(),deleted:nq.boolean()});Ef.DeleteFileOut$outboundSchema=nq.object({id:nq.string(),object:nq.string(),deleted:nq.boolean()});var pMr;(function(t){t.inboundSchema=Ef.DeleteFileOut$inboundSchema,t.outboundSchema=Ef.DeleteFileOut$outboundSchema})(pMr||(Ef.DeleteFileOut$=pMr={}));function yMo(t){return JSON.stringify(Ef.DeleteFileOut$outboundSchema.parse(t))}function bMo(t){return(0,gMo.safeParse)(t,e=>Ef.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var gMr=S(Pf=>{"use strict";var _Mo=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]}),vMo=Pf&&Pf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wMo=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"&&_Mo(r,e,n[o]);return vMo(r,e),r}}();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.DeleteModelOut$=Pf.DeleteModelOut$outboundSchema=Pf.DeleteModelOut$inboundSchema=void 0;Pf.deleteModelOutToJSON=CMo;Pf.deleteModelOutFromJSON=xMo;var oq=wMo(Q()),SMo=Z();Pf.DeleteModelOut$inboundSchema=oq.object({id:oq.string(),object:oq.string().default("model"),deleted:oq.boolean().default(!0)});Pf.DeleteModelOut$outboundSchema=oq.object({id:oq.string(),object:oq.string().default("model"),deleted:oq.boolean().default(!0)});var hMr;(function(t){t.inboundSchema=Pf.DeleteModelOut$inboundSchema,t.outboundSchema=Pf.DeleteModelOut$outboundSchema})(hMr||(Pf.DeleteModelOut$=hMr={}));function CMo(t){return JSON.stringify(Pf.DeleteModelOut$outboundSchema.parse(t))}function xMo(t){return(0,SMo.safeParse)(t,e=>Pf.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var Eut=S(Mf=>{"use strict";var OMo=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]}),TMo=Mf&&Mf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EMo=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"&&OMo(r,e,n[o]);return TMo(r,e),r}}();Object.defineProperty(Mf,"__esModule",{value:!0});Mf.DocumentOut$=Mf.DocumentOut$outboundSchema=Mf.DocumentOut$inboundSchema=void 0;Mf.documentOutToJSON=MMo;Mf.documentOutFromJSON=IMo;var vo=EMo(Q()),bMr=le(),PMo=Z();Mf.DocumentOut$inboundSchema=vo.object({id:vo.string(),library_id:vo.string(),hash:vo.string(),mime_type:vo.string(),extension:vo.string(),size:vo.number().int(),name:vo.string(),summary:vo.nullable(vo.string()).optional(),created_at:vo.string().datetime({offset:!0}).transform(t=>new Date(t)),last_processed_at:vo.nullable(vo.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),number_of_pages:vo.nullable(vo.number().int()).optional(),processing_status:vo.string(),uploaded_by_id:vo.string(),uploaded_by_type:vo.string(),tokens_processing_main_content:vo.nullable(vo.number().int()).optional(),tokens_processing_summary:vo.nullable(vo.number().int()).optional(),tokens_processing_total:vo.number().int()}).transform(t=>(0,bMr.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"}));Mf.DocumentOut$outboundSchema=vo.object({id:vo.string(),libraryId:vo.string(),hash:vo.string(),mimeType:vo.string(),extension:vo.string(),size:vo.number().int(),name:vo.string(),summary:vo.nullable(vo.string()).optional(),createdAt:vo.date().transform(t=>t.toISOString()),lastProcessedAt:vo.nullable(vo.date().transform(t=>t.toISOString())).optional(),numberOfPages:vo.nullable(vo.number().int()).optional(),processingStatus:vo.string(),uploadedById:vo.string(),uploadedByType:vo.string(),tokensProcessingMainContent:vo.nullable(vo.number().int()).optional(),tokensProcessingSummary:vo.nullable(vo.number().int()).optional(),tokensProcessingTotal:vo.number().int()}).transform(t=>(0,bMr.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 yMr;(function(t){t.inboundSchema=Mf.DocumentOut$inboundSchema,t.outboundSchema=Mf.DocumentOut$outboundSchema})(yMr||(Mf.DocumentOut$=yMr={}));function MMo(t){return JSON.stringify(Mf.DocumentOut$outboundSchema.parse(t))}function IMo(t){return(0,PMo.safeParse)(t,e=>Mf.DocumentOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentOut' from JSON")}});var vMr=S(If=>{"use strict";var RMo=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]}),AMo=If&&If.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NMo=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"&&RMo(r,e,n[o]);return AMo(r,e),r}}();Object.defineProperty(If,"__esModule",{value:!0});If.DocumentTextContent$=If.DocumentTextContent$outboundSchema=If.DocumentTextContent$inboundSchema=void 0;If.documentTextContentToJSON=DMo;If.documentTextContentFromJSON=$Mo;var $Ie=NMo(Q()),jMo=Z();If.DocumentTextContent$inboundSchema=$Ie.object({text:$Ie.string()});If.DocumentTextContent$outboundSchema=$Ie.object({text:$Ie.string()});var _Mr;(function(t){t.inboundSchema=If.DocumentTextContent$inboundSchema,t.outboundSchema=If.DocumentTextContent$outboundSchema})(_Mr||(If.DocumentTextContent$=_Mr={}));function DMo(t){return JSON.stringify(If.DocumentTextContent$outboundSchema.parse(t))}function $Mo(t){return(0,jMo.safeParse)(t,e=>If.DocumentTextContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentTextContent' from JSON")}});var SMr=S(Rf=>{"use strict";var LMo=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]}),FMo=Rf&&Rf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kMo=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"&&LMo(r,e,n[o]);return FMo(r,e),r}}();Object.defineProperty(Rf,"__esModule",{value:!0});Rf.DocumentUpdateIn$=Rf.DocumentUpdateIn$outboundSchema=Rf.DocumentUpdateIn$inboundSchema=void 0;Rf.documentUpdateInToJSON=UMo;Rf.documentUpdateInFromJSON=BMo;var _9=kMo(Q()),qMo=Z();Rf.DocumentUpdateIn$inboundSchema=_9.object({name:_9.nullable(_9.string()).optional()});Rf.DocumentUpdateIn$outboundSchema=_9.object({name:_9.nullable(_9.string()).optional()});var wMr;(function(t){t.inboundSchema=Rf.DocumentUpdateIn$inboundSchema,t.outboundSchema=Rf.DocumentUpdateIn$outboundSchema})(wMr||(Rf.DocumentUpdateIn$=wMr={}));function UMo(t){return JSON.stringify(Rf.DocumentUpdateIn$outboundSchema.parse(t))}function BMo(t){return(0,qMo.safeParse)(t,e=>Rf.DocumentUpdateIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentUpdateIn' from JSON")}});var Put=S(Af=>{"use strict";var zMo=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]}),VMo=Af&&Af.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HMo=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"&&zMo(r,e,n[o]);return VMo(r,e),r}}();Object.defineProperty(Af,"__esModule",{value:!0});Af.EmbeddingDtype$=Af.EmbeddingDtype$outboundSchema=Af.EmbeddingDtype$inboundSchema=Af.EmbeddingDtype=void 0;var JMo=HMo(Q());Af.EmbeddingDtype={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"};Af.EmbeddingDtype$inboundSchema=JMo.nativeEnum(Af.EmbeddingDtype);Af.EmbeddingDtype$outboundSchema=Af.EmbeddingDtype$inboundSchema;var CMr;(function(t){t.inboundSchema=Af.EmbeddingDtype$inboundSchema,t.outboundSchema=Af.EmbeddingDtype$outboundSchema})(CMr||(Af.EmbeddingDtype$=CMr={}))});var Mut=S(Nf=>{"use strict";var WMo=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]}),KMo=Nf&&Nf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GMo=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"&&WMo(r,e,n[o]);return KMo(r,e),r}}();Object.defineProperty(Nf,"__esModule",{value:!0});Nf.EncodingFormat$=Nf.EncodingFormat$outboundSchema=Nf.EncodingFormat$inboundSchema=Nf.EncodingFormat=void 0;var XMo=GMo(Q());Nf.EncodingFormat={Float:"float",Base64:"base64"};Nf.EncodingFormat$inboundSchema=XMo.nativeEnum(Nf.EncodingFormat);Nf.EncodingFormat$outboundSchema=Nf.EncodingFormat$inboundSchema;var xMr;(function(t){t.inboundSchema=Nf.EncodingFormat$inboundSchema,t.outboundSchema=Nf.EncodingFormat$outboundSchema})(xMr||(Nf.EncodingFormat$=xMr={}))});var RMr=S(bs=>{"use strict";var ZMo=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]}),YMo=bs&&bs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QMo=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"&&ZMo(r,e,n[o]);return YMo(r,e),r}}();Object.defineProperty(bs,"__esModule",{value:!0});bs.EmbeddingRequest$=bs.EmbeddingRequest$outboundSchema=bs.EmbeddingRequest$inboundSchema=bs.EmbeddingRequestInputs$=bs.EmbeddingRequestInputs$outboundSchema=bs.EmbeddingRequestInputs$inboundSchema=void 0;bs.embeddingRequestInputsToJSON=eIo;bs.embeddingRequestInputsFromJSON=tIo;bs.embeddingRequestToJSON=rIo;bs.embeddingRequestFromJSON=nIo;var Gl=QMo(Q()),EMr=le(),PMr=Z(),MMr=Put(),IMr=Mut();bs.EmbeddingRequestInputs$inboundSchema=Gl.union([Gl.string(),Gl.array(Gl.string())]);bs.EmbeddingRequestInputs$outboundSchema=Gl.union([Gl.string(),Gl.array(Gl.string())]);var OMr;(function(t){t.inboundSchema=bs.EmbeddingRequestInputs$inboundSchema,t.outboundSchema=bs.EmbeddingRequestInputs$outboundSchema})(OMr||(bs.EmbeddingRequestInputs$=OMr={}));function eIo(t){return JSON.stringify(bs.EmbeddingRequestInputs$outboundSchema.parse(t))}function tIo(t){return(0,PMr.safeParse)(t,e=>bs.EmbeddingRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequestInputs' from JSON")}bs.EmbeddingRequest$inboundSchema=Gl.object({model:Gl.string(),input:Gl.union([Gl.string(),Gl.array(Gl.string())]),output_dimension:Gl.nullable(Gl.number().int()).optional(),output_dtype:MMr.EmbeddingDtype$inboundSchema.optional(),encoding_format:IMr.EncodingFormat$inboundSchema.optional()}).transform(t=>(0,EMr.remap)(t,{input:"inputs",output_dimension:"outputDimension",output_dtype:"outputDtype",encoding_format:"encodingFormat"}));bs.EmbeddingRequest$outboundSchema=Gl.object({model:Gl.string(),inputs:Gl.union([Gl.string(),Gl.array(Gl.string())]),outputDimension:Gl.nullable(Gl.number().int()).optional(),outputDtype:MMr.EmbeddingDtype$outboundSchema.optional(),encodingFormat:IMr.EncodingFormat$outboundSchema.optional()}).transform(t=>(0,EMr.remap)(t,{inputs:"input",outputDimension:"output_dimension",outputDtype:"output_dtype",encodingFormat:"encoding_format"}));var TMr;(function(t){t.inboundSchema=bs.EmbeddingRequest$inboundSchema,t.outboundSchema=bs.EmbeddingRequest$outboundSchema})(TMr||(bs.EmbeddingRequest$=TMr={}));function rIo(t){return JSON.stringify(bs.EmbeddingRequest$outboundSchema.parse(t))}function nIo(t){return(0,PMr.safeParse)(t,e=>bs.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var Iut=S(jf=>{"use strict";var oIo=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]}),iIo=jf&&jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aIo=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"&&oIo(r,e,n[o]);return iIo(r,e),r}}();Object.defineProperty(jf,"__esModule",{value:!0});jf.EmbeddingResponseData$=jf.EmbeddingResponseData$outboundSchema=jf.EmbeddingResponseData$inboundSchema=void 0;jf.embeddingResponseDataToJSON=uIo;jf.embeddingResponseDataFromJSON=lIo;var FR=aIo(Q()),sIo=Z();jf.EmbeddingResponseData$inboundSchema=FR.object({object:FR.string().optional(),embedding:FR.array(FR.number()).optional(),index:FR.number().int().optional()});jf.EmbeddingResponseData$outboundSchema=FR.object({object:FR.string().optional(),embedding:FR.array(FR.number()).optional(),index:FR.number().int().optional()});var AMr;(function(t){t.inboundSchema=jf.EmbeddingResponseData$inboundSchema,t.outboundSchema=jf.EmbeddingResponseData$outboundSchema})(AMr||(jf.EmbeddingResponseData$=AMr={}));function uIo(t){return JSON.stringify(jf.EmbeddingResponseData$outboundSchema.parse(t))}function lIo(t){return(0,sIo.safeParse)(t,e=>jf.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var $Mr=S(Df=>{"use strict";var cIo=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]}),dIo=Df&&Df.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fIo=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"&&cIo(r,e,n[o]);return dIo(r,e),r}}();Object.defineProperty(Df,"__esModule",{value:!0});Df.EmbeddingResponse$=Df.EmbeddingResponse$outboundSchema=Df.EmbeddingResponse$inboundSchema=void 0;Df.embeddingResponseToJSON=mIo;Df.embeddingResponseFromJSON=hIo;var kR=fIo(Q()),pIo=Z(),jMr=Iut(),DMr=eq();Df.EmbeddingResponse$inboundSchema=kR.object({id:kR.string(),object:kR.string(),model:kR.string(),usage:DMr.UsageInfo$inboundSchema,data:kR.array(jMr.EmbeddingResponseData$inboundSchema)});Df.EmbeddingResponse$outboundSchema=kR.object({id:kR.string(),object:kR.string(),model:kR.string(),usage:DMr.UsageInfo$outboundSchema,data:kR.array(jMr.EmbeddingResponseData$outboundSchema)});var NMr;(function(t){t.inboundSchema=Df.EmbeddingResponse$inboundSchema,t.outboundSchema=Df.EmbeddingResponse$outboundSchema})(NMr||(Df.EmbeddingResponse$=NMr={}));function mIo(t){return JSON.stringify(Df.EmbeddingResponse$outboundSchema.parse(t))}function hIo(t){return(0,pIo.safeParse)(t,e=>Df.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var LIe=S($f=>{"use strict";var gIo=$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]}),yIo=$f&&$f.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bIo=$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"&&gIo(r,e,n[o]);return yIo(r,e),r}}();Object.defineProperty($f,"__esModule",{value:!0});$f.EntityType$=$f.EntityType$outboundSchema=$f.EntityType$inboundSchema=$f.EntityType=void 0;var bH=bIo(Q()),_Io=XC();$f.EntityType={User:"User",Workspace:"Workspace",Org:"Org"};$f.EntityType$inboundSchema=bH.union([bH.nativeEnum($f.EntityType),bH.string().transform(_Io.catchUnrecognizedEnum)]);$f.EntityType$outboundSchema=bH.union([bH.nativeEnum($f.EntityType),bH.string().and(bH.custom())]);var LMr;(function(t){t.inboundSchema=$f.EntityType$inboundSchema,t.outboundSchema=$f.EntityType$outboundSchema})(LMr||($f.EntityType$=LMr={}))});var kae=S(Lf=>{"use strict";var vIo=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]}),wIo=Lf&&Lf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SIo=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"&&vIo(r,e,n[o]);return wIo(r,e),r}}();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.FilePurpose$=Lf.FilePurpose$outboundSchema=Lf.FilePurpose$inboundSchema=Lf.FilePurpose=void 0;var _H=SIo(Q()),CIo=XC();Lf.FilePurpose={FineTune:"fine-tune",Batch:"batch",Ocr:"ocr"};Lf.FilePurpose$inboundSchema=_H.union([_H.nativeEnum(Lf.FilePurpose),_H.string().transform(CIo.catchUnrecognizedEnum)]);Lf.FilePurpose$outboundSchema=_H.union([_H.nativeEnum(Lf.FilePurpose),_H.string().and(_H.custom())]);var FMr;(function(t){t.inboundSchema=Lf.FilePurpose$inboundSchema,t.outboundSchema=Lf.FilePurpose$outboundSchema})(FMr||(Lf.FilePurpose$=FMr={}))});var qae=S(Ff=>{"use strict";var xIo=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]}),OIo=Ff&&Ff.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TIo=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"&&xIo(r,e,n[o]);return OIo(r,e),r}}();Object.defineProperty(Ff,"__esModule",{value:!0});Ff.SampleType$=Ff.SampleType$outboundSchema=Ff.SampleType$inboundSchema=Ff.SampleType=void 0;var vH=TIo(Q()),EIo=XC();Ff.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};Ff.SampleType$inboundSchema=vH.union([vH.nativeEnum(Ff.SampleType),vH.string().transform(EIo.catchUnrecognizedEnum)]);Ff.SampleType$outboundSchema=vH.union([vH.nativeEnum(Ff.SampleType),vH.string().and(vH.custom())]);var kMr;(function(t){t.inboundSchema=Ff.SampleType$inboundSchema,t.outboundSchema=Ff.SampleType$outboundSchema})(kMr||(Ff.SampleType$=kMr={}))});var Uae=S(kf=>{"use strict";var PIo=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]}),MIo=kf&&kf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IIo=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"&&PIo(r,e,n[o]);return MIo(r,e),r}}();Object.defineProperty(kf,"__esModule",{value:!0});kf.Source$=kf.Source$outboundSchema=kf.Source$inboundSchema=kf.Source=void 0;var wH=IIo(Q()),RIo=XC();kf.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};kf.Source$inboundSchema=wH.union([wH.nativeEnum(kf.Source),wH.string().transform(RIo.catchUnrecognizedEnum)]);kf.Source$outboundSchema=wH.union([wH.nativeEnum(kf.Source),wH.string().and(wH.custom())]);var qMr;(function(t){t.inboundSchema=kf.Source$inboundSchema,t.outboundSchema=kf.Source$outboundSchema})(qMr||(kf.Source$=qMr={}))});var Rut=S(qf=>{"use strict";var AIo=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]}),NIo=qf&&qf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jIo=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"&&AIo(r,e,n[o]);return NIo(r,e),r}}();Object.defineProperty(qf,"__esModule",{value:!0});qf.FileSchema$=qf.FileSchema$outboundSchema=qf.FileSchema$inboundSchema=void 0;qf.fileSchemaToJSON=$Io;qf.fileSchemaFromJSON=LIo;var Xl=jIo(Q()),BMr=le(),DIo=Z(),zMr=kae(),VMr=qae(),HMr=Uae();qf.FileSchema$inboundSchema=Xl.object({id:Xl.string(),object:Xl.string(),bytes:Xl.number().int(),created_at:Xl.number().int(),filename:Xl.string(),purpose:zMr.FilePurpose$inboundSchema,sample_type:VMr.SampleType$inboundSchema,num_lines:Xl.nullable(Xl.number().int()).optional(),mimetype:Xl.nullable(Xl.string()).optional(),source:HMr.Source$inboundSchema,signature:Xl.nullable(Xl.string()).optional()}).transform(t=>(0,BMr.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));qf.FileSchema$outboundSchema=Xl.object({id:Xl.string(),object:Xl.string(),sizeBytes:Xl.number().int(),createdAt:Xl.number().int(),filename:Xl.string(),purpose:zMr.FilePurpose$outboundSchema,sampleType:VMr.SampleType$outboundSchema,numLines:Xl.nullable(Xl.number().int()).optional(),mimetype:Xl.nullable(Xl.string()).optional(),source:HMr.Source$outboundSchema,signature:Xl.nullable(Xl.string()).optional()}).transform(t=>(0,BMr.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var UMr;(function(t){t.inboundSchema=qf.FileSchema$inboundSchema,t.outboundSchema=qf.FileSchema$outboundSchema})(UMr||(qf.FileSchema$=UMr={}));function $Io(t){return JSON.stringify(qf.FileSchema$outboundSchema.parse(t))}function LIo(t){return(0,DIo.safeParse)(t,e=>qf.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var WMr=S(Uf=>{"use strict";var FIo=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]}),kIo=Uf&&Uf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qIo=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"&&FIo(r,e,n[o]);return kIo(r,e),r}}();Object.defineProperty(Uf,"__esModule",{value:!0});Uf.FileSignedURL$=Uf.FileSignedURL$outboundSchema=Uf.FileSignedURL$inboundSchema=void 0;Uf.fileSignedURLToJSON=BIo;Uf.fileSignedURLFromJSON=zIo;var FIe=qIo(Q()),UIo=Z();Uf.FileSignedURL$inboundSchema=FIe.object({url:FIe.string()});Uf.FileSignedURL$outboundSchema=FIe.object({url:FIe.string()});var JMr;(function(t){t.inboundSchema=Uf.FileSignedURL$inboundSchema,t.outboundSchema=Uf.FileSignedURL$outboundSchema})(JMr||(Uf.FileSignedURL$=JMr={}));function BIo(t){return JSON.stringify(Uf.FileSignedURL$outboundSchema.parse(t))}function zIo(t){return(0,UIo.safeParse)(t,e=>Uf.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var YMr=S(_s=>{"use strict";var VIo=_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]}),HIo=_s&&_s.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JIo=_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"&&VIo(r,e,n[o]);return HIo(r,e),r}}();Object.defineProperty(_s,"__esModule",{value:!0});_s.FIMCompletionRequest$=_s.FIMCompletionRequest$outboundSchema=_s.FIMCompletionRequest$inboundSchema=_s.FIMCompletionRequestStop$=_s.FIMCompletionRequestStop$outboundSchema=_s.FIMCompletionRequestStop$inboundSchema=void 0;_s.fimCompletionRequestStopToJSON=WIo;_s.fimCompletionRequestStopFromJSON=KIo;_s.fimCompletionRequestToJSON=GIo;_s.fimCompletionRequestFromJSON=XIo;var wo=JIo(Q()),XMr=le(),ZMr=Z();_s.FIMCompletionRequestStop$inboundSchema=wo.union([wo.string(),wo.array(wo.string())]);_s.FIMCompletionRequestStop$outboundSchema=wo.union([wo.string(),wo.array(wo.string())]);var KMr;(function(t){t.inboundSchema=_s.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=_s.FIMCompletionRequestStop$outboundSchema})(KMr||(_s.FIMCompletionRequestStop$=KMr={}));function WIo(t){return JSON.stringify(_s.FIMCompletionRequestStop$outboundSchema.parse(t))}function KIo(t){return(0,ZMr.safeParse)(t,e=>_s.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}_s.FIMCompletionRequest$inboundSchema=wo.object({model:wo.string(),temperature:wo.nullable(wo.number()).optional(),top_p:wo.number().default(1),max_tokens:wo.nullable(wo.number().int()).optional(),stream:wo.boolean().default(!1),stop:wo.union([wo.string(),wo.array(wo.string())]).optional(),random_seed:wo.nullable(wo.number().int()).optional(),prompt:wo.string(),suffix:wo.nullable(wo.string()).optional(),min_tokens:wo.nullable(wo.number().int()).optional()}).transform(t=>(0,XMr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));_s.FIMCompletionRequest$outboundSchema=wo.object({model:wo.string(),temperature:wo.nullable(wo.number()).optional(),topP:wo.number().default(1),maxTokens:wo.nullable(wo.number().int()).optional(),stream:wo.boolean().default(!1),stop:wo.union([wo.string(),wo.array(wo.string())]).optional(),randomSeed:wo.nullable(wo.number().int()).optional(),prompt:wo.string(),suffix:wo.nullable(wo.string()).optional(),minTokens:wo.nullable(wo.number().int()).optional()}).transform(t=>(0,XMr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var GMr;(function(t){t.inboundSchema=_s.FIMCompletionRequest$inboundSchema,t.outboundSchema=_s.FIMCompletionRequest$outboundSchema})(GMr||(_s.FIMCompletionRequest$=GMr={}));function GIo(t){return JSON.stringify(_s.FIMCompletionRequest$outboundSchema.parse(t))}function XIo(t){return(0,ZMr.safeParse)(t,e=>_s.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var rIr=S(Bf=>{"use strict";var ZIo=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]}),YIo=Bf&&Bf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QIo=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"&&ZIo(r,e,n[o]);return YIo(r,e),r}}();Object.defineProperty(Bf,"__esModule",{value:!0});Bf.FIMCompletionResponse$=Bf.FIMCompletionResponse$outboundSchema=Bf.FIMCompletionResponse$inboundSchema=void 0;Bf.fimCompletionResponseToJSON=tRo;Bf.fimCompletionResponseFromJSON=rRo;var n0=QIo(Q()),eRo=Z(),eIr=wMe(),tIr=eq();Bf.FIMCompletionResponse$inboundSchema=n0.object({id:n0.string(),object:n0.string(),model:n0.string(),usage:tIr.UsageInfo$inboundSchema,created:n0.number().int(),choices:n0.array(eIr.ChatCompletionChoice$inboundSchema)});Bf.FIMCompletionResponse$outboundSchema=n0.object({id:n0.string(),object:n0.string(),model:n0.string(),usage:tIr.UsageInfo$outboundSchema,created:n0.number().int(),choices:n0.array(eIr.ChatCompletionChoice$outboundSchema)});var QMr;(function(t){t.inboundSchema=Bf.FIMCompletionResponse$inboundSchema,t.outboundSchema=Bf.FIMCompletionResponse$outboundSchema})(QMr||(Bf.FIMCompletionResponse$=QMr={}));function tRo(t){return JSON.stringify(Bf.FIMCompletionResponse$outboundSchema.parse(t))}function rRo(t){return(0,eRo.safeParse)(t,e=>Bf.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var sIr=S(vs=>{"use strict";var nRo=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]}),oRo=vs&&vs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iRo=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"&&nRo(r,e,n[o]);return oRo(r,e),r}}();Object.defineProperty(vs,"__esModule",{value:!0});vs.FIMCompletionStreamRequest$=vs.FIMCompletionStreamRequest$outboundSchema=vs.FIMCompletionStreamRequest$inboundSchema=vs.FIMCompletionStreamRequestStop$=vs.FIMCompletionStreamRequestStop$outboundSchema=vs.FIMCompletionStreamRequestStop$inboundSchema=void 0;vs.fimCompletionStreamRequestStopToJSON=aRo;vs.fimCompletionStreamRequestStopFromJSON=sRo;vs.fimCompletionStreamRequestToJSON=uRo;vs.fimCompletionStreamRequestFromJSON=lRo;var So=iRo(Q()),iIr=le(),aIr=Z();vs.FIMCompletionStreamRequestStop$inboundSchema=So.union([So.string(),So.array(So.string())]);vs.FIMCompletionStreamRequestStop$outboundSchema=So.union([So.string(),So.array(So.string())]);var nIr;(function(t){t.inboundSchema=vs.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=vs.FIMCompletionStreamRequestStop$outboundSchema})(nIr||(vs.FIMCompletionStreamRequestStop$=nIr={}));function aRo(t){return JSON.stringify(vs.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function sRo(t){return(0,aIr.safeParse)(t,e=>vs.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}vs.FIMCompletionStreamRequest$inboundSchema=So.object({model:So.string(),temperature:So.nullable(So.number()).optional(),top_p:So.number().default(1),max_tokens:So.nullable(So.number().int()).optional(),stream:So.boolean().default(!0),stop:So.union([So.string(),So.array(So.string())]).optional(),random_seed:So.nullable(So.number().int()).optional(),prompt:So.string(),suffix:So.nullable(So.string()).optional(),min_tokens:So.nullable(So.number().int()).optional()}).transform(t=>(0,iIr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));vs.FIMCompletionStreamRequest$outboundSchema=So.object({model:So.string(),temperature:So.nullable(So.number()).optional(),topP:So.number().default(1),maxTokens:So.nullable(So.number().int()).optional(),stream:So.boolean().default(!0),stop:So.union([So.string(),So.array(So.string())]).optional(),randomSeed:So.nullable(So.number().int()).optional(),prompt:So.string(),suffix:So.nullable(So.string()).optional(),minTokens:So.nullable(So.number().int()).optional()}).transform(t=>(0,iIr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var oIr;(function(t){t.inboundSchema=vs.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=vs.FIMCompletionStreamRequest$outboundSchema})(oIr||(vs.FIMCompletionStreamRequest$=oIr={}));function uRo(t){return JSON.stringify(vs.FIMCompletionStreamRequest$outboundSchema.parse(t))}function lRo(t){return(0,aIr.safeParse)(t,e=>vs.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var Aut=S(zf=>{"use strict";var cRo=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]}),dRo=zf&&zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fRo=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"&&cRo(r,e,n[o]);return dRo(r,e),r}}();Object.defineProperty(zf,"__esModule",{value:!0});zf.FineTuneableModelType$=zf.FineTuneableModelType$outboundSchema=zf.FineTuneableModelType$inboundSchema=zf.FineTuneableModelType=void 0;var pRo=fRo(Q());zf.FineTuneableModelType={Completion:"completion",Classifier:"classifier"};zf.FineTuneableModelType$inboundSchema=pRo.nativeEnum(zf.FineTuneableModelType);zf.FineTuneableModelType$outboundSchema=zf.FineTuneableModelType$inboundSchema;var uIr;(function(t){t.inboundSchema=zf.FineTuneableModelType$inboundSchema,t.outboundSchema=zf.FineTuneableModelType$outboundSchema})(uIr||(zf.FineTuneableModelType$=uIr={}))});var Nut=S(ws=>{"use strict";var mRo=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]}),hRo=ws&&ws.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gRo=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"&&mRo(r,e,n[o]);return hRo(r,e),r}}();Object.defineProperty(ws,"__esModule",{value:!0});ws.FTModelCard$=ws.FTModelCard$outboundSchema=ws.FTModelCard$inboundSchema=ws.FTModelCardType$=ws.FTModelCardType$outboundSchema=ws.FTModelCardType$inboundSchema=ws.FTModelCardType=void 0;ws.ftModelCardToJSON=bRo;ws.ftModelCardFromJSON=_Ro;var Ro=gRo(Q()),dIr=le(),yRo=Z(),fIr=dMe();ws.FTModelCardType={FineTuned:"fine-tuned"};ws.FTModelCardType$inboundSchema=Ro.nativeEnum(ws.FTModelCardType);ws.FTModelCardType$outboundSchema=ws.FTModelCardType$inboundSchema;var lIr;(function(t){t.inboundSchema=ws.FTModelCardType$inboundSchema,t.outboundSchema=ws.FTModelCardType$outboundSchema})(lIr||(ws.FTModelCardType$=lIr={}));ws.FTModelCard$inboundSchema=Ro.object({id:Ro.string(),object:Ro.string().default("model"),created:Ro.number().int().optional(),owned_by:Ro.string().default("mistralai"),capabilities:fIr.ModelCapabilities$inboundSchema,name:Ro.nullable(Ro.string()).optional(),description:Ro.nullable(Ro.string()).optional(),max_context_length:Ro.number().int().default(32768),aliases:Ro.array(Ro.string()).optional(),deprecation:Ro.nullable(Ro.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),deprecation_replacement_model:Ro.nullable(Ro.string()).optional(),default_model_temperature:Ro.nullable(Ro.number()).optional(),type:Ro.literal("fine-tuned").default("fine-tuned"),job:Ro.string(),root:Ro.string(),archived:Ro.boolean().default(!1)}).transform(t=>(0,dIr.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",deprecation_replacement_model:"deprecationReplacementModel",default_model_temperature:"defaultModelTemperature"}));ws.FTModelCard$outboundSchema=Ro.object({id:Ro.string(),object:Ro.string().default("model"),created:Ro.number().int().optional(),ownedBy:Ro.string().default("mistralai"),capabilities:fIr.ModelCapabilities$outboundSchema,name:Ro.nullable(Ro.string()).optional(),description:Ro.nullable(Ro.string()).optional(),maxContextLength:Ro.number().int().default(32768),aliases:Ro.array(Ro.string()).optional(),deprecation:Ro.nullable(Ro.date().transform(t=>t.toISOString())).optional(),deprecationReplacementModel:Ro.nullable(Ro.string()).optional(),defaultModelTemperature:Ro.nullable(Ro.number()).optional(),type:Ro.literal("fine-tuned").default("fine-tuned"),job:Ro.string(),root:Ro.string(),archived:Ro.boolean().default(!1)}).transform(t=>(0,dIr.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",deprecationReplacementModel:"deprecation_replacement_model",defaultModelTemperature:"default_model_temperature"}));var cIr;(function(t){t.inboundSchema=ws.FTModelCard$inboundSchema,t.outboundSchema=ws.FTModelCard$outboundSchema})(cIr||(ws.FTModelCard$=cIr={}));function bRo(t){return JSON.stringify(ws.FTModelCard$outboundSchema.parse(t))}function _Ro(t){return(0,yRo.safeParse)(t,e=>ws.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var jut=S(La=>{"use strict";var vRo=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]}),wRo=La&&La.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SRo=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"&&vRo(r,e,n[o]);return wRo(r,e),r}}();Object.defineProperty(La,"__esModule",{value:!0});La.GithubRepositoryIn$=La.GithubRepositoryIn$outboundSchema=La.GithubRepositoryIn$inboundSchema=La.GithubRepositoryInType$=La.GithubRepositoryInType$outboundSchema=La.GithubRepositoryInType$inboundSchema=La.GithubRepositoryInType=void 0;La.githubRepositoryInToJSON=xRo;La.githubRepositoryInFromJSON=ORo;var Ob=SRo(Q()),CRo=Z();La.GithubRepositoryInType={Github:"github"};La.GithubRepositoryInType$inboundSchema=Ob.nativeEnum(La.GithubRepositoryInType);La.GithubRepositoryInType$outboundSchema=La.GithubRepositoryInType$inboundSchema;var pIr;(function(t){t.inboundSchema=La.GithubRepositoryInType$inboundSchema,t.outboundSchema=La.GithubRepositoryInType$outboundSchema})(pIr||(La.GithubRepositoryInType$=pIr={}));La.GithubRepositoryIn$inboundSchema=Ob.object({type:La.GithubRepositoryInType$inboundSchema.default("github"),name:Ob.string(),owner:Ob.string(),ref:Ob.nullable(Ob.string()).optional(),weight:Ob.number().default(1),token:Ob.string()});La.GithubRepositoryIn$outboundSchema=Ob.object({type:La.GithubRepositoryInType$outboundSchema.default("github"),name:Ob.string(),owner:Ob.string(),ref:Ob.nullable(Ob.string()).optional(),weight:Ob.number().default(1),token:Ob.string()});var mIr;(function(t){t.inboundSchema=La.GithubRepositoryIn$inboundSchema,t.outboundSchema=La.GithubRepositoryIn$outboundSchema})(mIr||(La.GithubRepositoryIn$=mIr={}));function xRo(t){return JSON.stringify(La.GithubRepositoryIn$outboundSchema.parse(t))}function ORo(t){return(0,CRo.safeParse)(t,e=>La.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var Dut=S(Vf=>{"use strict";var TRo=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]}),ERo=Vf&&Vf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PRo=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"&&TRo(r,e,n[o]);return ERo(r,e),r}}();Object.defineProperty(Vf,"__esModule",{value:!0});Vf.TrainingFile$=Vf.TrainingFile$outboundSchema=Vf.TrainingFile$inboundSchema=void 0;Vf.trainingFileToJSON=IRo;Vf.trainingFileFromJSON=RRo;var v9=PRo(Q()),gIr=le(),MRo=Z();Vf.TrainingFile$inboundSchema=v9.object({file_id:v9.string(),weight:v9.number().default(1)}).transform(t=>(0,gIr.remap)(t,{file_id:"fileId"}));Vf.TrainingFile$outboundSchema=v9.object({fileId:v9.string(),weight:v9.number().default(1)}).transform(t=>(0,gIr.remap)(t,{fileId:"file_id"}));var hIr;(function(t){t.inboundSchema=Vf.TrainingFile$inboundSchema,t.outboundSchema=Vf.TrainingFile$outboundSchema})(hIr||(Vf.TrainingFile$=hIr={}));function IRo(t){return JSON.stringify(Vf.TrainingFile$outboundSchema.parse(t))}function RRo(t){return(0,MRo.safeParse)(t,e=>Vf.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var $ut=S(Fa=>{"use strict";var ARo=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]}),NRo=Fa&&Fa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jRo=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"&&ARo(r,e,n[o]);return NRo(r,e),r}}();Object.defineProperty(Fa,"__esModule",{value:!0});Fa.WandbIntegration$=Fa.WandbIntegration$outboundSchema=Fa.WandbIntegration$inboundSchema=Fa.WandbIntegrationType$=Fa.WandbIntegrationType$outboundSchema=Fa.WandbIntegrationType$inboundSchema=Fa.WandbIntegrationType=void 0;Fa.wandbIntegrationToJSON=$Ro;Fa.wandbIntegrationFromJSON=LRo;var Tb=jRo(Q()),_Ir=le(),DRo=Z();Fa.WandbIntegrationType={Wandb:"wandb"};Fa.WandbIntegrationType$inboundSchema=Tb.nativeEnum(Fa.WandbIntegrationType);Fa.WandbIntegrationType$outboundSchema=Fa.WandbIntegrationType$inboundSchema;var yIr;(function(t){t.inboundSchema=Fa.WandbIntegrationType$inboundSchema,t.outboundSchema=Fa.WandbIntegrationType$outboundSchema})(yIr||(Fa.WandbIntegrationType$=yIr={}));Fa.WandbIntegration$inboundSchema=Tb.object({type:Fa.WandbIntegrationType$inboundSchema.default("wandb"),project:Tb.string(),name:Tb.nullable(Tb.string()).optional(),api_key:Tb.string(),run_name:Tb.nullable(Tb.string()).optional()}).transform(t=>(0,_Ir.remap)(t,{api_key:"apiKey",run_name:"runName"}));Fa.WandbIntegration$outboundSchema=Tb.object({type:Fa.WandbIntegrationType$outboundSchema.default("wandb"),project:Tb.string(),name:Tb.nullable(Tb.string()).optional(),apiKey:Tb.string(),runName:Tb.nullable(Tb.string()).optional()}).transform(t=>(0,_Ir.remap)(t,{apiKey:"api_key",runName:"run_name"}));var bIr;(function(t){t.inboundSchema=Fa.WandbIntegration$inboundSchema,t.outboundSchema=Fa.WandbIntegration$outboundSchema})(bIr||(Fa.WandbIntegration$=bIr={}));function $Ro(t){return JSON.stringify(Fa.WandbIntegration$outboundSchema.parse(t))}function LRo(t){return(0,DRo.safeParse)(t,e=>Fa.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var PIr=S(Yr=>{"use strict";var FRo=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]}),kRo=Yr&&Yr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qRo=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"&&FRo(r,e,n[o]);return kRo(r,e),r}}();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.JobIn$=Yr.JobIn$outboundSchema=Yr.JobIn$inboundSchema=Yr.JobInRepositories$=Yr.JobInRepositories$outboundSchema=Yr.JobInRepositories$inboundSchema=Yr.Hyperparameters$=Yr.Hyperparameters$outboundSchema=Yr.Hyperparameters$inboundSchema=Yr.JobInIntegrations$=Yr.JobInIntegrations$outboundSchema=Yr.JobInIntegrations$inboundSchema=void 0;Yr.jobInIntegrationsToJSON=URo;Yr.jobInIntegrationsFromJSON=BRo;Yr.hyperparametersToJSON=zRo;Yr.hyperparametersFromJSON=VRo;Yr.jobInRepositoriesToJSON=HRo;Yr.jobInRepositoriesFromJSON=JRo;Yr.jobInToJSON=WRo;Yr.jobInFromJSON=KRo;var Si=qRo(Q()),xIr=le(),kIe=Z(),OIr=nut(),qIe=out(),UIe=dut(),TIr=Aut(),BIe=jut(),EIr=Dut(),zIe=$ut();Yr.JobInIntegrations$inboundSchema=zIe.WandbIntegration$inboundSchema;Yr.JobInIntegrations$outboundSchema=zIe.WandbIntegration$outboundSchema;var vIr;(function(t){t.inboundSchema=Yr.JobInIntegrations$inboundSchema,t.outboundSchema=Yr.JobInIntegrations$outboundSchema})(vIr||(Yr.JobInIntegrations$=vIr={}));function URo(t){return JSON.stringify(Yr.JobInIntegrations$outboundSchema.parse(t))}function BRo(t){return(0,kIe.safeParse)(t,e=>Yr.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}Yr.Hyperparameters$inboundSchema=Si.union([UIe.CompletionTrainingParametersIn$inboundSchema,qIe.ClassifierTrainingParametersIn$inboundSchema]);Yr.Hyperparameters$outboundSchema=Si.union([UIe.CompletionTrainingParametersIn$outboundSchema,qIe.ClassifierTrainingParametersIn$outboundSchema]);var wIr;(function(t){t.inboundSchema=Yr.Hyperparameters$inboundSchema,t.outboundSchema=Yr.Hyperparameters$outboundSchema})(wIr||(Yr.Hyperparameters$=wIr={}));function zRo(t){return JSON.stringify(Yr.Hyperparameters$outboundSchema.parse(t))}function VRo(t){return(0,kIe.safeParse)(t,e=>Yr.Hyperparameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Hyperparameters' from JSON")}Yr.JobInRepositories$inboundSchema=BIe.GithubRepositoryIn$inboundSchema;Yr.JobInRepositories$outboundSchema=BIe.GithubRepositoryIn$outboundSchema;var SIr;(function(t){t.inboundSchema=Yr.JobInRepositories$inboundSchema,t.outboundSchema=Yr.JobInRepositories$outboundSchema})(SIr||(Yr.JobInRepositories$=SIr={}));function HRo(t){return JSON.stringify(Yr.JobInRepositories$outboundSchema.parse(t))}function JRo(t){return(0,kIe.safeParse)(t,e=>Yr.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}Yr.JobIn$inboundSchema=Si.object({model:Si.string(),training_files:Si.array(EIr.TrainingFile$inboundSchema).optional(),validation_files:Si.nullable(Si.array(Si.string())).optional(),suffix:Si.nullable(Si.string()).optional(),integrations:Si.nullable(Si.array(zIe.WandbIntegration$inboundSchema)).optional(),auto_start:Si.boolean().optional(),invalid_sample_skip_percentage:Si.number().default(0),job_type:Si.nullable(TIr.FineTuneableModelType$inboundSchema).optional(),hyperparameters:Si.union([UIe.CompletionTrainingParametersIn$inboundSchema,qIe.ClassifierTrainingParametersIn$inboundSchema]),repositories:Si.nullable(Si.array(BIe.GithubRepositoryIn$inboundSchema)).optional(),classifier_targets:Si.nullable(Si.array(OIr.ClassifierTargetIn$inboundSchema)).optional()}).transform(t=>(0,xIr.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart",invalid_sample_skip_percentage:"invalidSampleSkipPercentage",job_type:"jobType",classifier_targets:"classifierTargets"}));Yr.JobIn$outboundSchema=Si.object({model:Si.string(),trainingFiles:Si.array(EIr.TrainingFile$outboundSchema).optional(),validationFiles:Si.nullable(Si.array(Si.string())).optional(),suffix:Si.nullable(Si.string()).optional(),integrations:Si.nullable(Si.array(zIe.WandbIntegration$outboundSchema)).optional(),autoStart:Si.boolean().optional(),invalidSampleSkipPercentage:Si.number().default(0),jobType:Si.nullable(TIr.FineTuneableModelType$outboundSchema).optional(),hyperparameters:Si.union([UIe.CompletionTrainingParametersIn$outboundSchema,qIe.ClassifierTrainingParametersIn$outboundSchema]),repositories:Si.nullable(Si.array(BIe.GithubRepositoryIn$outboundSchema)).optional(),classifierTargets:Si.nullable(Si.array(OIr.ClassifierTargetIn$outboundSchema)).optional()}).transform(t=>(0,xIr.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start",invalidSampleSkipPercentage:"invalid_sample_skip_percentage",jobType:"job_type",classifierTargets:"classifier_targets"}));var CIr;(function(t){t.inboundSchema=Yr.JobIn$inboundSchema,t.outboundSchema=Yr.JobIn$outboundSchema})(CIr||(Yr.JobIn$=CIr={}));function WRo(t){return JSON.stringify(Yr.JobIn$outboundSchema.parse(t))}function KRo(t){return(0,kIe.safeParse)(t,e=>Yr.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var NIr=S(Co=>{"use strict";var GRo=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]}),XRo=Co&&Co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZRo=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"&&GRo(r,e,n[o]);return XRo(r,e),r}}();Object.defineProperty(Co,"__esModule",{value:!0});Co.JobsOut$=Co.JobsOut$outboundSchema=Co.JobsOut$inboundSchema=Co.JobsOutObject$=Co.JobsOutObject$outboundSchema=Co.JobsOutObject$inboundSchema=Co.JobsOutData$=Co.JobsOutData$outboundSchema=Co.JobsOutData$inboundSchema=Co.JobsOutObject=void 0;Co.jobsOutDataToJSON=YRo;Co.jobsOutDataFromJSON=QRo;Co.jobsOutToJSON=eAo;Co.jobsOutFromJSON=tAo;var ju=ZRo(Q()),AIr=Z(),VIe=rut(),HIe=cut();Co.JobsOutObject={List:"list"};Co.JobsOutData$inboundSchema=ju.union([VIe.ClassifierJobOut$inboundSchema.and(ju.object({job_type:ju.literal("classifier")}).transform(t=>({jobType:t.job_type}))),HIe.CompletionJobOut$inboundSchema.and(ju.object({job_type:ju.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Co.JobsOutData$outboundSchema=ju.union([VIe.ClassifierJobOut$outboundSchema.and(ju.object({jobType:ju.literal("classifier")}).transform(t=>({job_type:t.jobType}))),HIe.CompletionJobOut$outboundSchema.and(ju.object({jobType:ju.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var MIr;(function(t){t.inboundSchema=Co.JobsOutData$inboundSchema,t.outboundSchema=Co.JobsOutData$outboundSchema})(MIr||(Co.JobsOutData$=MIr={}));function YRo(t){return JSON.stringify(Co.JobsOutData$outboundSchema.parse(t))}function QRo(t){return(0,AIr.safeParse)(t,e=>Co.JobsOutData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOutData' from JSON")}Co.JobsOutObject$inboundSchema=ju.nativeEnum(Co.JobsOutObject);Co.JobsOutObject$outboundSchema=Co.JobsOutObject$inboundSchema;var IIr;(function(t){t.inboundSchema=Co.JobsOutObject$inboundSchema,t.outboundSchema=Co.JobsOutObject$outboundSchema})(IIr||(Co.JobsOutObject$=IIr={}));Co.JobsOut$inboundSchema=ju.object({data:ju.array(ju.union([VIe.ClassifierJobOut$inboundSchema.and(ju.object({job_type:ju.literal("classifier")}).transform(t=>({jobType:t.job_type}))),HIe.CompletionJobOut$inboundSchema.and(ju.object({job_type:ju.literal("completion")}).transform(t=>({jobType:t.job_type})))])).optional(),object:Co.JobsOutObject$inboundSchema.default("list"),total:ju.number().int()});Co.JobsOut$outboundSchema=ju.object({data:ju.array(ju.union([VIe.ClassifierJobOut$outboundSchema.and(ju.object({jobType:ju.literal("classifier")}).transform(t=>({job_type:t.jobType}))),HIe.CompletionJobOut$outboundSchema.and(ju.object({jobType:ju.literal("completion")}).transform(t=>({job_type:t.jobType})))])).optional(),object:Co.JobsOutObject$outboundSchema.default("list"),total:ju.number().int()});var RIr;(function(t){t.inboundSchema=Co.JobsOut$inboundSchema,t.outboundSchema=Co.JobsOut$outboundSchema})(RIr||(Co.JobsOut$=RIr={}));function eAo(t){return JSON.stringify(Co.JobsOut$outboundSchema.parse(t))}function tAo(t){return(0,AIr.safeParse)(t,e=>Co.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var LIr=S(ka=>{"use strict";var rAo=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]}),nAo=ka&&ka.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oAo=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"&&rAo(r,e,n[o]);return nAo(r,e),r}}();Object.defineProperty(ka,"__esModule",{value:!0});ka.LegacyJobMetadataOut$=ka.LegacyJobMetadataOut$outboundSchema=ka.LegacyJobMetadataOut$inboundSchema=ka.LegacyJobMetadataOutObject$=ka.LegacyJobMetadataOutObject$outboundSchema=ka.LegacyJobMetadataOutObject$inboundSchema=ka.LegacyJobMetadataOutObject=void 0;ka.legacyJobMetadataOutToJSON=aAo;ka.legacyJobMetadataOutFromJSON=sAo;var Fo=oAo(Q()),$Ir=le(),iAo=Z();ka.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};ka.LegacyJobMetadataOutObject$inboundSchema=Fo.nativeEnum(ka.LegacyJobMetadataOutObject);ka.LegacyJobMetadataOutObject$outboundSchema=ka.LegacyJobMetadataOutObject$inboundSchema;var jIr;(function(t){t.inboundSchema=ka.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=ka.LegacyJobMetadataOutObject$outboundSchema})(jIr||(ka.LegacyJobMetadataOutObject$=jIr={}));ka.LegacyJobMetadataOut$inboundSchema=Fo.object({expected_duration_seconds:Fo.nullable(Fo.number().int()).optional(),cost:Fo.nullable(Fo.number()).optional(),cost_currency:Fo.nullable(Fo.string()).optional(),train_tokens_per_step:Fo.nullable(Fo.number().int()).optional(),train_tokens:Fo.nullable(Fo.number().int()).optional(),data_tokens:Fo.nullable(Fo.number().int()).optional(),estimated_start_time:Fo.nullable(Fo.number().int()).optional(),deprecated:Fo.boolean().default(!0),details:Fo.string(),epochs:Fo.nullable(Fo.number()).optional(),training_steps:Fo.nullable(Fo.number().int()).optional(),object:ka.LegacyJobMetadataOutObject$inboundSchema.default("job.metadata")}).transform(t=>(0,$Ir.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"}));ka.LegacyJobMetadataOut$outboundSchema=Fo.object({expectedDurationSeconds:Fo.nullable(Fo.number().int()).optional(),cost:Fo.nullable(Fo.number()).optional(),costCurrency:Fo.nullable(Fo.string()).optional(),trainTokensPerStep:Fo.nullable(Fo.number().int()).optional(),trainTokens:Fo.nullable(Fo.number().int()).optional(),dataTokens:Fo.nullable(Fo.number().int()).optional(),estimatedStartTime:Fo.nullable(Fo.number().int()).optional(),deprecated:Fo.boolean().default(!0),details:Fo.string(),epochs:Fo.nullable(Fo.number()).optional(),trainingSteps:Fo.nullable(Fo.number().int()).optional(),object:ka.LegacyJobMetadataOutObject$outboundSchema.default("job.metadata")}).transform(t=>(0,$Ir.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 DIr;(function(t){t.inboundSchema=ka.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=ka.LegacyJobMetadataOut$outboundSchema})(DIr||(ka.LegacyJobMetadataOut$=DIr={}));function aAo(t){return JSON.stringify(ka.LegacyJobMetadataOut$outboundSchema.parse(t))}function sAo(t){return(0,iAo.safeParse)(t,e=>ka.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var qIr=S(Hf=>{"use strict";var uAo=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]}),lAo=Hf&&Hf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cAo=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"&&uAo(r,e,n[o]);return lAo(r,e),r}}();Object.defineProperty(Hf,"__esModule",{value:!0});Hf.LibraryIn$=Hf.LibraryIn$outboundSchema=Hf.LibraryIn$inboundSchema=void 0;Hf.libraryInToJSON=fAo;Hf.libraryInFromJSON=pAo;var o0=cAo(Q()),kIr=le(),dAo=Z();Hf.LibraryIn$inboundSchema=o0.object({name:o0.string(),description:o0.nullable(o0.string()).optional(),chunk_size:o0.nullable(o0.number().int()).optional()}).transform(t=>(0,kIr.remap)(t,{chunk_size:"chunkSize"}));Hf.LibraryIn$outboundSchema=o0.object({name:o0.string(),description:o0.nullable(o0.string()).optional(),chunkSize:o0.nullable(o0.number().int()).optional()}).transform(t=>(0,kIr.remap)(t,{chunkSize:"chunk_size"}));var FIr;(function(t){t.inboundSchema=Hf.LibraryIn$inboundSchema,t.outboundSchema=Hf.LibraryIn$outboundSchema})(FIr||(Hf.LibraryIn$=FIr={}));function fAo(t){return JSON.stringify(Hf.LibraryIn$outboundSchema.parse(t))}function pAo(t){return(0,dAo.safeParse)(t,e=>Hf.LibraryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryIn' from JSON")}});var BIr=S(Jf=>{"use strict";var mAo=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]}),hAo=Jf&&Jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gAo=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"&&mAo(r,e,n[o]);return hAo(r,e),r}}();Object.defineProperty(Jf,"__esModule",{value:!0});Jf.LibraryInUpdate$=Jf.LibraryInUpdate$outboundSchema=Jf.LibraryInUpdate$inboundSchema=void 0;Jf.libraryInUpdateToJSON=bAo;Jf.libraryInUpdateFromJSON=_Ao;var qR=gAo(Q()),yAo=Z();Jf.LibraryInUpdate$inboundSchema=qR.object({name:qR.nullable(qR.string()).optional(),description:qR.nullable(qR.string()).optional()});Jf.LibraryInUpdate$outboundSchema=qR.object({name:qR.nullable(qR.string()).optional(),description:qR.nullable(qR.string()).optional()});var UIr;(function(t){t.inboundSchema=Jf.LibraryInUpdate$inboundSchema,t.outboundSchema=Jf.LibraryInUpdate$outboundSchema})(UIr||(Jf.LibraryInUpdate$=UIr={}));function bAo(t){return JSON.stringify(Jf.LibraryInUpdate$outboundSchema.parse(t))}function _Ao(t){return(0,yAo.safeParse)(t,e=>Jf.LibraryInUpdate$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryInUpdate' from JSON")}});var Lut=S(Wf=>{"use strict";var vAo=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]}),wAo=Wf&&Wf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SAo=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"&&vAo(r,e,n[o]);return wAo(r,e),r}}();Object.defineProperty(Wf,"__esModule",{value:!0});Wf.LibraryOut$=Wf.LibraryOut$outboundSchema=Wf.LibraryOut$inboundSchema=void 0;Wf.libraryOutToJSON=xAo;Wf.libraryOutFromJSON=OAo;var En=SAo(Q()),VIr=le(),CAo=Z();Wf.LibraryOut$inboundSchema=En.object({id:En.string(),name:En.string(),created_at:En.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:En.string().datetime({offset:!0}).transform(t=>new Date(t)),owner_id:En.string(),owner_type:En.string(),total_size:En.number().int(),nb_documents:En.number().int(),chunk_size:En.nullable(En.number().int()),emoji:En.nullable(En.string()).optional(),description:En.nullable(En.string()).optional(),generated_name:En.nullable(En.string()).optional(),generated_description:En.nullable(En.string()).optional(),explicit_user_members_count:En.nullable(En.number().int()).optional(),explicit_workspace_members_count:En.nullable(En.number().int()).optional(),org_sharing_role:En.nullable(En.string()).optional()}).transform(t=>(0,VIr.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"}));Wf.LibraryOut$outboundSchema=En.object({id:En.string(),name:En.string(),createdAt:En.date().transform(t=>t.toISOString()),updatedAt:En.date().transform(t=>t.toISOString()),ownerId:En.string(),ownerType:En.string(),totalSize:En.number().int(),nbDocuments:En.number().int(),chunkSize:En.nullable(En.number().int()),emoji:En.nullable(En.string()).optional(),description:En.nullable(En.string()).optional(),generatedName:En.nullable(En.string()).optional(),generatedDescription:En.nullable(En.string()).optional(),explicitUserMembersCount:En.nullable(En.number().int()).optional(),explicitWorkspaceMembersCount:En.nullable(En.number().int()).optional(),orgSharingRole:En.nullable(En.string()).optional()}).transform(t=>(0,VIr.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 zIr;(function(t){t.inboundSchema=Wf.LibraryOut$inboundSchema,t.outboundSchema=Wf.LibraryOut$outboundSchema})(zIr||(Wf.LibraryOut$=zIr={}));function xAo(t){return JSON.stringify(Wf.LibraryOut$outboundSchema.parse(t))}function OAo(t){return(0,CAo.safeParse)(t,e=>Wf.LibraryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryOut' from JSON")}});var Fut=S(Kf=>{"use strict";var TAo=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]}),EAo=Kf&&Kf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PAo=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"&&TAo(r,e,n[o]);return EAo(r,e),r}}();Object.defineProperty(Kf,"__esModule",{value:!0});Kf.PaginationInfo$=Kf.PaginationInfo$outboundSchema=Kf.PaginationInfo$inboundSchema=void 0;Kf.paginationInfoToJSON=IAo;Kf.paginationInfoFromJSON=RAo;var i0=PAo(Q()),JIr=le(),MAo=Z();Kf.PaginationInfo$inboundSchema=i0.object({total_items:i0.number().int(),total_pages:i0.number().int(),current_page:i0.number().int(),page_size:i0.number().int(),has_more:i0.boolean()}).transform(t=>(0,JIr.remap)(t,{total_items:"totalItems",total_pages:"totalPages",current_page:"currentPage",page_size:"pageSize",has_more:"hasMore"}));Kf.PaginationInfo$outboundSchema=i0.object({totalItems:i0.number().int(),totalPages:i0.number().int(),currentPage:i0.number().int(),pageSize:i0.number().int(),hasMore:i0.boolean()}).transform(t=>(0,JIr.remap)(t,{totalItems:"total_items",totalPages:"total_pages",currentPage:"current_page",pageSize:"page_size",hasMore:"has_more"}));var HIr;(function(t){t.inboundSchema=Kf.PaginationInfo$inboundSchema,t.outboundSchema=Kf.PaginationInfo$outboundSchema})(HIr||(Kf.PaginationInfo$=HIr={}));function IAo(t){return JSON.stringify(Kf.PaginationInfo$outboundSchema.parse(t))}function RAo(t){return(0,MAo.safeParse)(t,e=>Kf.PaginationInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'PaginationInfo' from JSON")}});var XIr=S(Gf=>{"use strict";var AAo=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]}),NAo=Gf&&Gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jAo=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"&&AAo(r,e,n[o]);return NAo(r,e),r}}();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.ListDocumentOut$=Gf.ListDocumentOut$outboundSchema=Gf.ListDocumentOut$inboundSchema=void 0;Gf.listDocumentOutToJSON=$Ao;Gf.listDocumentOutFromJSON=LAo;var JIe=jAo(Q()),DAo=Z(),KIr=Eut(),GIr=Fut();Gf.ListDocumentOut$inboundSchema=JIe.object({pagination:GIr.PaginationInfo$inboundSchema,data:JIe.array(KIr.DocumentOut$inboundSchema)});Gf.ListDocumentOut$outboundSchema=JIe.object({pagination:GIr.PaginationInfo$outboundSchema,data:JIe.array(KIr.DocumentOut$outboundSchema)});var WIr;(function(t){t.inboundSchema=Gf.ListDocumentOut$inboundSchema,t.outboundSchema=Gf.ListDocumentOut$outboundSchema})(WIr||(Gf.ListDocumentOut$=WIr={}));function $Ao(t){return JSON.stringify(Gf.ListDocumentOut$outboundSchema.parse(t))}function LAo(t){return(0,DAo.safeParse)(t,e=>Gf.ListDocumentOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListDocumentOut' from JSON")}});var QIr=S(Xf=>{"use strict";var FAo=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]}),kAo=Xf&&Xf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qAo=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"&&FAo(r,e,n[o]);return kAo(r,e),r}}();Object.defineProperty(Xf,"__esModule",{value:!0});Xf.ListFilesOut$=Xf.ListFilesOut$outboundSchema=Xf.ListFilesOut$inboundSchema=void 0;Xf.listFilesOutToJSON=BAo;Xf.listFilesOutFromJSON=zAo;var iq=qAo(Q()),UAo=Z(),YIr=Rut();Xf.ListFilesOut$inboundSchema=iq.object({data:iq.array(YIr.FileSchema$inboundSchema),object:iq.string(),total:iq.number().int()});Xf.ListFilesOut$outboundSchema=iq.object({data:iq.array(YIr.FileSchema$outboundSchema),object:iq.string(),total:iq.number().int()});var ZIr;(function(t){t.inboundSchema=Xf.ListFilesOut$inboundSchema,t.outboundSchema=Xf.ListFilesOut$outboundSchema})(ZIr||(Xf.ListFilesOut$=ZIr={}));function BAo(t){return JSON.stringify(Xf.ListFilesOut$outboundSchema.parse(t))}function zAo(t){return(0,UAo.safeParse)(t,e=>Xf.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var rRr=S(Zf=>{"use strict";var VAo=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]}),HAo=Zf&&Zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JAo=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"&&VAo(r,e,n[o]);return HAo(r,e),r}}();Object.defineProperty(Zf,"__esModule",{value:!0});Zf.ListLibraryOut$=Zf.ListLibraryOut$outboundSchema=Zf.ListLibraryOut$inboundSchema=void 0;Zf.listLibraryOutToJSON=KAo;Zf.listLibraryOutFromJSON=GAo;var WIe=JAo(Q()),WAo=Z(),tRr=Lut();Zf.ListLibraryOut$inboundSchema=WIe.object({data:WIe.array(tRr.LibraryOut$inboundSchema)});Zf.ListLibraryOut$outboundSchema=WIe.object({data:WIe.array(tRr.LibraryOut$outboundSchema)});var eRr;(function(t){t.inboundSchema=Zf.ListLibraryOut$inboundSchema,t.outboundSchema=Zf.ListLibraryOut$outboundSchema})(eRr||(Zf.ListLibraryOut$=eRr={}));function KAo(t){return JSON.stringify(Zf.ListLibraryOut$outboundSchema.parse(t))}function GAo(t){return(0,WAo.safeParse)(t,e=>Zf.ListLibraryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListLibraryOut' from JSON")}});var kut=S(Yf=>{"use strict";var XAo=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]}),ZAo=Yf&&Yf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YAo=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"&&XAo(r,e,n[o]);return ZAo(r,e),r}}();Object.defineProperty(Yf,"__esModule",{value:!0});Yf.SharingOut$=Yf.SharingOut$outboundSchema=Yf.SharingOut$inboundSchema=void 0;Yf.sharingOutToJSON=eNo;Yf.sharingOutFromJSON=tNo;var Ey=YAo(Q()),oRr=le(),QAo=Z();Yf.SharingOut$inboundSchema=Ey.object({library_id:Ey.string(),user_id:Ey.nullable(Ey.string()).optional(),org_id:Ey.string(),role:Ey.string(),share_with_type:Ey.string(),share_with_uuid:Ey.string()}).transform(t=>(0,oRr.remap)(t,{library_id:"libraryId",user_id:"userId",org_id:"orgId",share_with_type:"shareWithType",share_with_uuid:"shareWithUuid"}));Yf.SharingOut$outboundSchema=Ey.object({libraryId:Ey.string(),userId:Ey.nullable(Ey.string()).optional(),orgId:Ey.string(),role:Ey.string(),shareWithType:Ey.string(),shareWithUuid:Ey.string()}).transform(t=>(0,oRr.remap)(t,{libraryId:"library_id",userId:"user_id",orgId:"org_id",shareWithType:"share_with_type",shareWithUuid:"share_with_uuid"}));var nRr;(function(t){t.inboundSchema=Yf.SharingOut$inboundSchema,t.outboundSchema=Yf.SharingOut$outboundSchema})(nRr||(Yf.SharingOut$=nRr={}));function eNo(t){return JSON.stringify(Yf.SharingOut$outboundSchema.parse(t))}function tNo(t){return(0,QAo.safeParse)(t,e=>Yf.SharingOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingOut' from JSON")}});var sRr=S(Qf=>{"use strict";var rNo=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]}),nNo=Qf&&Qf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oNo=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"&&rNo(r,e,n[o]);return nNo(r,e),r}}();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.ListSharingOut$=Qf.ListSharingOut$outboundSchema=Qf.ListSharingOut$inboundSchema=void 0;Qf.listSharingOutToJSON=aNo;Qf.listSharingOutFromJSON=sNo;var KIe=oNo(Q()),iNo=Z(),aRr=kut();Qf.ListSharingOut$inboundSchema=KIe.object({data:KIe.array(aRr.SharingOut$inboundSchema)});Qf.ListSharingOut$outboundSchema=KIe.object({data:KIe.array(aRr.SharingOut$outboundSchema)});var iRr;(function(t){t.inboundSchema=Qf.ListSharingOut$inboundSchema,t.outboundSchema=Qf.ListSharingOut$outboundSchema})(iRr||(Qf.ListSharingOut$=iRr={}));function aNo(t){return JSON.stringify(Qf.ListSharingOut$outboundSchema.parse(t))}function sNo(t){return(0,iNo.safeParse)(t,e=>Qf.ListSharingOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListSharingOut' from JSON")}});var mRr=S(xo=>{"use strict";var uNo=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]}),lNo=xo&&xo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cNo=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"&&uNo(r,e,n[o]);return lNo(r,e),r}}();Object.defineProperty(xo,"__esModule",{value:!0});xo.ModelConversation$=xo.ModelConversation$outboundSchema=xo.ModelConversation$inboundSchema=xo.ModelConversationObject$=xo.ModelConversationObject$outboundSchema=xo.ModelConversationObject$inboundSchema=xo.ModelConversationTools$=xo.ModelConversationTools$outboundSchema=xo.ModelConversationTools$inboundSchema=xo.ModelConversationObject=void 0;xo.modelConversationToolsToJSON=dNo;xo.modelConversationToolsFromJSON=fNo;xo.modelConversationToJSON=pNo;xo.modelConversationFromJSON=mNo;var Ht=cNo(Q()),dRr=le(),fRr=Z(),GIe=zk(),pRr=JS(),XIe=Jk(),ZIe=Wk(),YIe=Kk(),QIe=Gk(),eRe=Xk();xo.ModelConversationObject={Conversation:"conversation"};xo.ModelConversationTools$inboundSchema=Ht.union([XIe.DocumentLibraryTool$inboundSchema.and(Ht.object({type:Ht.literal("document_library")}).transform(t=>({type:t.type}))),ZIe.FunctionTool$inboundSchema.and(Ht.object({type:Ht.literal("function")}).transform(t=>({type:t.type}))),GIe.CodeInterpreterTool$inboundSchema.and(Ht.object({type:Ht.literal("code_interpreter")}).transform(t=>({type:t.type}))),YIe.ImageGenerationTool$inboundSchema.and(Ht.object({type:Ht.literal("image_generation")}).transform(t=>({type:t.type}))),eRe.WebSearchTool$inboundSchema.and(Ht.object({type:Ht.literal("web_search")}).transform(t=>({type:t.type}))),QIe.WebSearchPremiumTool$inboundSchema.and(Ht.object({type:Ht.literal("web_search_premium")}).transform(t=>({type:t.type})))]);xo.ModelConversationTools$outboundSchema=Ht.union([XIe.DocumentLibraryTool$outboundSchema.and(Ht.object({type:Ht.literal("document_library")}).transform(t=>({type:t.type}))),ZIe.FunctionTool$outboundSchema.and(Ht.object({type:Ht.literal("function")}).transform(t=>({type:t.type}))),GIe.CodeInterpreterTool$outboundSchema.and(Ht.object({type:Ht.literal("code_interpreter")}).transform(t=>({type:t.type}))),YIe.ImageGenerationTool$outboundSchema.and(Ht.object({type:Ht.literal("image_generation")}).transform(t=>({type:t.type}))),eRe.WebSearchTool$outboundSchema.and(Ht.object({type:Ht.literal("web_search")}).transform(t=>({type:t.type}))),QIe.WebSearchPremiumTool$outboundSchema.and(Ht.object({type:Ht.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var uRr;(function(t){t.inboundSchema=xo.ModelConversationTools$inboundSchema,t.outboundSchema=xo.ModelConversationTools$outboundSchema})(uRr||(xo.ModelConversationTools$=uRr={}));function dNo(t){return JSON.stringify(xo.ModelConversationTools$outboundSchema.parse(t))}function fNo(t){return(0,fRr.safeParse)(t,e=>xo.ModelConversationTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelConversationTools' from JSON")}xo.ModelConversationObject$inboundSchema=Ht.nativeEnum(xo.ModelConversationObject);xo.ModelConversationObject$outboundSchema=xo.ModelConversationObject$inboundSchema;var lRr;(function(t){t.inboundSchema=xo.ModelConversationObject$inboundSchema,t.outboundSchema=xo.ModelConversationObject$outboundSchema})(lRr||(xo.ModelConversationObject$=lRr={}));xo.ModelConversation$inboundSchema=Ht.object({instructions:Ht.nullable(Ht.string()).optional(),tools:Ht.array(Ht.union([XIe.DocumentLibraryTool$inboundSchema.and(Ht.object({type:Ht.literal("document_library")}).transform(t=>({type:t.type}))),ZIe.FunctionTool$inboundSchema.and(Ht.object({type:Ht.literal("function")}).transform(t=>({type:t.type}))),GIe.CodeInterpreterTool$inboundSchema.and(Ht.object({type:Ht.literal("code_interpreter")}).transform(t=>({type:t.type}))),YIe.ImageGenerationTool$inboundSchema.and(Ht.object({type:Ht.literal("image_generation")}).transform(t=>({type:t.type}))),eRe.WebSearchTool$inboundSchema.and(Ht.object({type:Ht.literal("web_search")}).transform(t=>({type:t.type}))),QIe.WebSearchPremiumTool$inboundSchema.and(Ht.object({type:Ht.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:pRr.CompletionArgs$inboundSchema.optional(),name:Ht.nullable(Ht.string()).optional(),description:Ht.nullable(Ht.string()).optional(),object:xo.ModelConversationObject$inboundSchema.default("conversation"),id:Ht.string(),created_at:Ht.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:Ht.string().datetime({offset:!0}).transform(t=>new Date(t)),model:Ht.string()}).transform(t=>(0,dRr.remap)(t,{completion_args:"completionArgs",created_at:"createdAt",updated_at:"updatedAt"}));xo.ModelConversation$outboundSchema=Ht.object({instructions:Ht.nullable(Ht.string()).optional(),tools:Ht.array(Ht.union([XIe.DocumentLibraryTool$outboundSchema.and(Ht.object({type:Ht.literal("document_library")}).transform(t=>({type:t.type}))),ZIe.FunctionTool$outboundSchema.and(Ht.object({type:Ht.literal("function")}).transform(t=>({type:t.type}))),GIe.CodeInterpreterTool$outboundSchema.and(Ht.object({type:Ht.literal("code_interpreter")}).transform(t=>({type:t.type}))),YIe.ImageGenerationTool$outboundSchema.and(Ht.object({type:Ht.literal("image_generation")}).transform(t=>({type:t.type}))),eRe.WebSearchTool$outboundSchema.and(Ht.object({type:Ht.literal("web_search")}).transform(t=>({type:t.type}))),QIe.WebSearchPremiumTool$outboundSchema.and(Ht.object({type:Ht.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:pRr.CompletionArgs$outboundSchema.optional(),name:Ht.nullable(Ht.string()).optional(),description:Ht.nullable(Ht.string()).optional(),object:xo.ModelConversationObject$outboundSchema.default("conversation"),id:Ht.string(),createdAt:Ht.date().transform(t=>t.toISOString()),updatedAt:Ht.date().transform(t=>t.toISOString()),model:Ht.string()}).transform(t=>(0,dRr.remap)(t,{completionArgs:"completion_args",createdAt:"created_at",updatedAt:"updated_at"}));var cRr;(function(t){t.inboundSchema=xo.ModelConversation$inboundSchema,t.outboundSchema=xo.ModelConversation$outboundSchema})(cRr||(xo.ModelConversation$=cRr={}));function pNo(t){return JSON.stringify(xo.ModelConversation$outboundSchema.parse(t))}function mNo(t){return(0,fRr.safeParse)(t,e=>xo.ModelConversation$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelConversation' from JSON")}});var bRr=S(Ss=>{"use strict";var hNo=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]}),gNo=Ss&&Ss.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yNo=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"&&hNo(r,e,n[o]);return gNo(r,e),r}}();Object.defineProperty(Ss,"__esModule",{value:!0});Ss.ModelList$=Ss.ModelList$outboundSchema=Ss.ModelList$inboundSchema=Ss.Data$=Ss.Data$outboundSchema=Ss.Data$inboundSchema=void 0;Ss.dataToJSON=bNo;Ss.dataFromJSON=_No;Ss.modelListToJSON=vNo;Ss.modelListFromJSON=wNo;var Gu=yNo(Q()),yRr=Z(),tRe=Wst(),rRe=Nut();Ss.Data$inboundSchema=Gu.union([rRe.FTModelCard$inboundSchema.and(Gu.object({type:Gu.literal("fine-tuned")}).transform(t=>({type:t.type}))),tRe.BaseModelCard$inboundSchema.and(Gu.object({type:Gu.literal("base")}).transform(t=>({type:t.type})))]);Ss.Data$outboundSchema=Gu.union([rRe.FTModelCard$outboundSchema.and(Gu.object({type:Gu.literal("fine-tuned")}).transform(t=>({type:t.type}))),tRe.BaseModelCard$outboundSchema.and(Gu.object({type:Gu.literal("base")}).transform(t=>({type:t.type})))]);var hRr;(function(t){t.inboundSchema=Ss.Data$inboundSchema,t.outboundSchema=Ss.Data$outboundSchema})(hRr||(Ss.Data$=hRr={}));function bNo(t){return JSON.stringify(Ss.Data$outboundSchema.parse(t))}function _No(t){return(0,yRr.safeParse)(t,e=>Ss.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}Ss.ModelList$inboundSchema=Gu.object({object:Gu.string().default("list"),data:Gu.array(Gu.union([rRe.FTModelCard$inboundSchema.and(Gu.object({type:Gu.literal("fine-tuned")}).transform(t=>({type:t.type}))),tRe.BaseModelCard$inboundSchema.and(Gu.object({type:Gu.literal("base")}).transform(t=>({type:t.type})))])).optional()});Ss.ModelList$outboundSchema=Gu.object({object:Gu.string().default("list"),data:Gu.array(Gu.union([rRe.FTModelCard$outboundSchema.and(Gu.object({type:Gu.literal("fine-tuned")}).transform(t=>({type:t.type}))),tRe.BaseModelCard$outboundSchema.and(Gu.object({type:Gu.literal("base")}).transform(t=>({type:t.type})))])).optional()});var gRr;(function(t){t.inboundSchema=Ss.ModelList$inboundSchema,t.outboundSchema=Ss.ModelList$outboundSchema})(gRr||(Ss.ModelList$=gRr={}));function vNo(t){return JSON.stringify(Ss.ModelList$outboundSchema.parse(t))}function wNo(t){return(0,yRr.safeParse)(t,e=>Ss.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var qut=S(ep=>{"use strict";var SNo=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]}),CNo=ep&&ep.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xNo=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"&&SNo(r,e,n[o]);return CNo(r,e),r}}();Object.defineProperty(ep,"__esModule",{value:!0});ep.ModerationObject$=ep.ModerationObject$outboundSchema=ep.ModerationObject$inboundSchema=void 0;ep.moderationObjectToJSON=TNo;ep.moderationObjectFromJSON=ENo;var UR=xNo(Q()),vRr=le(),ONo=Z();ep.ModerationObject$inboundSchema=UR.object({categories:UR.record(UR.boolean()).optional(),category_scores:UR.record(UR.number()).optional()}).transform(t=>(0,vRr.remap)(t,{category_scores:"categoryScores"}));ep.ModerationObject$outboundSchema=UR.object({categories:UR.record(UR.boolean()).optional(),categoryScores:UR.record(UR.number()).optional()}).transform(t=>(0,vRr.remap)(t,{categoryScores:"category_scores"}));var _Rr;(function(t){t.inboundSchema=ep.ModerationObject$inboundSchema,t.outboundSchema=ep.ModerationObject$outboundSchema})(_Rr||(ep.ModerationObject$=_Rr={}));function TNo(t){return JSON.stringify(ep.ModerationObject$outboundSchema.parse(t))}function ENo(t){return(0,ONo.safeParse)(t,e=>ep.ModerationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModerationObject' from JSON")}});var CRr=S(tp=>{"use strict";var PNo=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]}),MNo=tp&&tp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),INo=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"&&PNo(r,e,n[o]);return MNo(r,e),r}}();Object.defineProperty(tp,"__esModule",{value:!0});tp.ModerationResponse$=tp.ModerationResponse$outboundSchema=tp.ModerationResponse$inboundSchema=void 0;tp.moderationResponseToJSON=ANo;tp.moderationResponseFromJSON=NNo;var aq=INo(Q()),RNo=Z(),SRr=qut();tp.ModerationResponse$inboundSchema=aq.object({id:aq.string(),model:aq.string(),results:aq.array(SRr.ModerationObject$inboundSchema)});tp.ModerationResponse$outboundSchema=aq.object({id:aq.string(),model:aq.string(),results:aq.array(SRr.ModerationObject$outboundSchema)});var wRr;(function(t){t.inboundSchema=tp.ModerationResponse$inboundSchema,t.outboundSchema=tp.ModerationResponse$outboundSchema})(wRr||(tp.ModerationResponse$=wRr={}));function ANo(t){return JSON.stringify(tp.ModerationResponse$outboundSchema.parse(t))}function NNo(t){return(0,RNo.safeParse)(t,e=>tp.ModerationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModerationResponse' from JSON")}});var Uut=S(rp=>{"use strict";var jNo=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]}),DNo=rp&&rp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$No=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"&&jNo(r,e,n[o]);return DNo(r,e),r}}();Object.defineProperty(rp,"__esModule",{value:!0});rp.OCRImageObject$=rp.OCRImageObject$outboundSchema=rp.OCRImageObject$inboundSchema=void 0;rp.ocrImageObjectToJSON=FNo;rp.ocrImageObjectFromJSON=kNo;var _u=$No(Q()),ORr=le(),LNo=Z();rp.OCRImageObject$inboundSchema=_u.object({id:_u.string(),top_left_x:_u.nullable(_u.number().int()),top_left_y:_u.nullable(_u.number().int()),bottom_right_x:_u.nullable(_u.number().int()),bottom_right_y:_u.nullable(_u.number().int()),image_base64:_u.nullable(_u.string()).optional(),image_annotation:_u.nullable(_u.string()).optional()}).transform(t=>(0,ORr.remap)(t,{top_left_x:"topLeftX",top_left_y:"topLeftY",bottom_right_x:"bottomRightX",bottom_right_y:"bottomRightY",image_base64:"imageBase64",image_annotation:"imageAnnotation"}));rp.OCRImageObject$outboundSchema=_u.object({id:_u.string(),topLeftX:_u.nullable(_u.number().int()),topLeftY:_u.nullable(_u.number().int()),bottomRightX:_u.nullable(_u.number().int()),bottomRightY:_u.nullable(_u.number().int()),imageBase64:_u.nullable(_u.string()).optional(),imageAnnotation:_u.nullable(_u.string()).optional()}).transform(t=>(0,ORr.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 xRr;(function(t){t.inboundSchema=rp.OCRImageObject$inboundSchema,t.outboundSchema=rp.OCRImageObject$outboundSchema})(xRr||(rp.OCRImageObject$=xRr={}));function FNo(t){return JSON.stringify(rp.OCRImageObject$outboundSchema.parse(t))}function kNo(t){return(0,LNo.safeParse)(t,e=>rp.OCRImageObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRImageObject' from JSON")}});var But=S(np=>{"use strict";var qNo=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]}),UNo=np&&np.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BNo=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"&&qNo(r,e,n[o]);return UNo(r,e),r}}();Object.defineProperty(np,"__esModule",{value:!0});np.OCRPageDimensions$=np.OCRPageDimensions$outboundSchema=np.OCRPageDimensions$inboundSchema=void 0;np.ocrPageDimensionsToJSON=VNo;np.ocrPageDimensionsFromJSON=HNo;var sq=BNo(Q()),zNo=Z();np.OCRPageDimensions$inboundSchema=sq.object({dpi:sq.number().int(),height:sq.number().int(),width:sq.number().int()});np.OCRPageDimensions$outboundSchema=sq.object({dpi:sq.number().int(),height:sq.number().int(),width:sq.number().int()});var TRr;(function(t){t.inboundSchema=np.OCRPageDimensions$inboundSchema,t.outboundSchema=np.OCRPageDimensions$outboundSchema})(TRr||(np.OCRPageDimensions$=TRr={}));function VNo(t){return JSON.stringify(np.OCRPageDimensions$outboundSchema.parse(t))}function HNo(t){return(0,zNo.safeParse)(t,e=>np.OCRPageDimensions$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRPageDimensions' from JSON")}});var zut=S(op=>{"use strict";var JNo=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]}),WNo=op&&op.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KNo=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"&&JNo(r,e,n[o]);return WNo(r,e),r}}();Object.defineProperty(op,"__esModule",{value:!0});op.OCRPageObject$=op.OCRPageObject$outboundSchema=op.OCRPageObject$inboundSchema=void 0;op.ocrPageObjectToJSON=XNo;op.ocrPageObjectFromJSON=ZNo;var BR=KNo(Q()),GNo=Z(),PRr=Uut(),MRr=But();op.OCRPageObject$inboundSchema=BR.object({index:BR.number().int(),markdown:BR.string(),images:BR.array(PRr.OCRImageObject$inboundSchema),dimensions:BR.nullable(MRr.OCRPageDimensions$inboundSchema)});op.OCRPageObject$outboundSchema=BR.object({index:BR.number().int(),markdown:BR.string(),images:BR.array(PRr.OCRImageObject$outboundSchema),dimensions:BR.nullable(MRr.OCRPageDimensions$outboundSchema)});var ERr;(function(t){t.inboundSchema=op.OCRPageObject$inboundSchema,t.outboundSchema=op.OCRPageObject$outboundSchema})(ERr||(op.OCRPageObject$=ERr={}));function XNo(t){return JSON.stringify(op.OCRPageObject$outboundSchema.parse(t))}function ZNo(t){return(0,GNo.safeParse)(t,e=>op.OCRPageObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRPageObject' from JSON")}});var jRr=S(Cs=>{"use strict";var YNo=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]}),QNo=Cs&&Cs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e1o=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"&&YNo(r,e,n[o]);return QNo(r,e),r}}();Object.defineProperty(Cs,"__esModule",{value:!0});Cs.OCRRequest$=Cs.OCRRequest$outboundSchema=Cs.OCRRequest$inboundSchema=Cs.Document$=Cs.Document$outboundSchema=Cs.Document$inboundSchema=void 0;Cs.documentToJSON=t1o;Cs.documentFromJSON=r1o;Cs.ocrRequestToJSON=n1o;Cs.ocrRequestFromJSON=o1o;var qa=e1o(Q()),ARr=le(),NRr=Z(),oRe=iH(),iRe=APe(),aRe=aH(),nRe=Hk();Cs.Document$inboundSchema=qa.union([iRe.FileChunk$inboundSchema,oRe.DocumentURLChunk$inboundSchema,aRe.ImageURLChunk$inboundSchema]);Cs.Document$outboundSchema=qa.union([iRe.FileChunk$outboundSchema,oRe.DocumentURLChunk$outboundSchema,aRe.ImageURLChunk$outboundSchema]);var IRr;(function(t){t.inboundSchema=Cs.Document$inboundSchema,t.outboundSchema=Cs.Document$outboundSchema})(IRr||(Cs.Document$=IRr={}));function t1o(t){return JSON.stringify(Cs.Document$outboundSchema.parse(t))}function r1o(t){return(0,NRr.safeParse)(t,e=>Cs.Document$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Document' from JSON")}Cs.OCRRequest$inboundSchema=qa.object({model:qa.nullable(qa.string()),id:qa.string().optional(),document:qa.union([iRe.FileChunk$inboundSchema,oRe.DocumentURLChunk$inboundSchema,aRe.ImageURLChunk$inboundSchema]),pages:qa.nullable(qa.array(qa.number().int())).optional(),include_image_base64:qa.nullable(qa.boolean()).optional(),image_limit:qa.nullable(qa.number().int()).optional(),image_min_size:qa.nullable(qa.number().int()).optional(),bbox_annotation_format:qa.nullable(nRe.ResponseFormat$inboundSchema).optional(),document_annotation_format:qa.nullable(nRe.ResponseFormat$inboundSchema).optional()}).transform(t=>(0,ARr.remap)(t,{include_image_base64:"includeImageBase64",image_limit:"imageLimit",image_min_size:"imageMinSize",bbox_annotation_format:"bboxAnnotationFormat",document_annotation_format:"documentAnnotationFormat"}));Cs.OCRRequest$outboundSchema=qa.object({model:qa.nullable(qa.string()),id:qa.string().optional(),document:qa.union([iRe.FileChunk$outboundSchema,oRe.DocumentURLChunk$outboundSchema,aRe.ImageURLChunk$outboundSchema]),pages:qa.nullable(qa.array(qa.number().int())).optional(),includeImageBase64:qa.nullable(qa.boolean()).optional(),imageLimit:qa.nullable(qa.number().int()).optional(),imageMinSize:qa.nullable(qa.number().int()).optional(),bboxAnnotationFormat:qa.nullable(nRe.ResponseFormat$outboundSchema).optional(),documentAnnotationFormat:qa.nullable(nRe.ResponseFormat$outboundSchema).optional()}).transform(t=>(0,ARr.remap)(t,{includeImageBase64:"include_image_base64",imageLimit:"image_limit",imageMinSize:"image_min_size",bboxAnnotationFormat:"bbox_annotation_format",documentAnnotationFormat:"document_annotation_format"}));var RRr;(function(t){t.inboundSchema=Cs.OCRRequest$inboundSchema,t.outboundSchema=Cs.OCRRequest$outboundSchema})(RRr||(Cs.OCRRequest$=RRr={}));function n1o(t){return JSON.stringify(Cs.OCRRequest$outboundSchema.parse(t))}function o1o(t){return(0,NRr.safeParse)(t,e=>Cs.OCRRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRRequest' from JSON")}});var Vut=S(ip=>{"use strict";var i1o=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]}),a1o=ip&&ip.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s1o=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"&&i1o(r,e,n[o]);return a1o(r,e),r}}();Object.defineProperty(ip,"__esModule",{value:!0});ip.OCRUsageInfo$=ip.OCRUsageInfo$outboundSchema=ip.OCRUsageInfo$inboundSchema=void 0;ip.ocrUsageInfoToJSON=l1o;ip.ocrUsageInfoFromJSON=c1o;var uq=s1o(Q()),$Rr=le(),u1o=Z();ip.OCRUsageInfo$inboundSchema=uq.object({pages_processed:uq.number().int(),doc_size_bytes:uq.nullable(uq.number().int()).optional()}).transform(t=>(0,$Rr.remap)(t,{pages_processed:"pagesProcessed",doc_size_bytes:"docSizeBytes"}));ip.OCRUsageInfo$outboundSchema=uq.object({pagesProcessed:uq.number().int(),docSizeBytes:uq.nullable(uq.number().int()).optional()}).transform(t=>(0,$Rr.remap)(t,{pagesProcessed:"pages_processed",docSizeBytes:"doc_size_bytes"}));var DRr;(function(t){t.inboundSchema=ip.OCRUsageInfo$inboundSchema,t.outboundSchema=ip.OCRUsageInfo$outboundSchema})(DRr||(ip.OCRUsageInfo$=DRr={}));function l1o(t){return JSON.stringify(ip.OCRUsageInfo$outboundSchema.parse(t))}function c1o(t){return(0,u1o.safeParse)(t,e=>ip.OCRUsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRUsageInfo' from JSON")}});var URr=S(ap=>{"use strict";var d1o=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]}),f1o=ap&&ap.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p1o=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"&&d1o(r,e,n[o]);return f1o(r,e),r}}();Object.defineProperty(ap,"__esModule",{value:!0});ap.OCRResponse$=ap.OCRResponse$outboundSchema=ap.OCRResponse$inboundSchema=void 0;ap.ocrResponseToJSON=h1o;ap.ocrResponseFromJSON=g1o;var zR=p1o(Q()),FRr=le(),m1o=Z(),kRr=zut(),qRr=Vut();ap.OCRResponse$inboundSchema=zR.object({pages:zR.array(kRr.OCRPageObject$inboundSchema),model:zR.string(),document_annotation:zR.nullable(zR.string()).optional(),usage_info:qRr.OCRUsageInfo$inboundSchema}).transform(t=>(0,FRr.remap)(t,{document_annotation:"documentAnnotation",usage_info:"usageInfo"}));ap.OCRResponse$outboundSchema=zR.object({pages:zR.array(kRr.OCRPageObject$outboundSchema),model:zR.string(),documentAnnotation:zR.nullable(zR.string()).optional(),usageInfo:qRr.OCRUsageInfo$outboundSchema}).transform(t=>(0,FRr.remap)(t,{documentAnnotation:"document_annotation",usageInfo:"usage_info"}));var LRr;(function(t){t.inboundSchema=ap.OCRResponse$inboundSchema,t.outboundSchema=ap.OCRResponse$outboundSchema})(LRr||(ap.OCRResponse$=LRr={}));function h1o(t){return JSON.stringify(ap.OCRResponse$outboundSchema.parse(t))}function g1o(t){return(0,m1o.safeParse)(t,e=>ap.OCRResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRResponse' from JSON")}});var VRr=S(sp=>{"use strict";var y1o=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]}),b1o=sp&&sp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_1o=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"&&y1o(r,e,n[o]);return b1o(r,e),r}}();Object.defineProperty(sp,"__esModule",{value:!0});sp.ProcessingStatusOut$=sp.ProcessingStatusOut$outboundSchema=sp.ProcessingStatusOut$inboundSchema=void 0;sp.processingStatusOutToJSON=w1o;sp.processingStatusOutFromJSON=S1o;var w9=_1o(Q()),zRr=le(),v1o=Z();sp.ProcessingStatusOut$inboundSchema=w9.object({document_id:w9.string(),processing_status:w9.string()}).transform(t=>(0,zRr.remap)(t,{document_id:"documentId",processing_status:"processingStatus"}));sp.ProcessingStatusOut$outboundSchema=w9.object({documentId:w9.string(),processingStatus:w9.string()}).transform(t=>(0,zRr.remap)(t,{documentId:"document_id",processingStatus:"processing_status"}));var BRr;(function(t){t.inboundSchema=sp.ProcessingStatusOut$inboundSchema,t.outboundSchema=sp.ProcessingStatusOut$outboundSchema})(BRr||(sp.ProcessingStatusOut$=BRr={}));function w1o(t){return JSON.stringify(sp.ProcessingStatusOut$outboundSchema.parse(t))}function S1o(t){return(0,v1o.safeParse)(t,e=>sp.ProcessingStatusOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ProcessingStatusOut' from JSON")}});var XRr=S(up=>{"use strict";var C1o=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]}),x1o=up&&up.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O1o=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"&&C1o(r,e,n[o]);return x1o(r,e),r}}();Object.defineProperty(up,"__esModule",{value:!0});up.RetrieveFileOut$=up.RetrieveFileOut$outboundSchema=up.RetrieveFileOut$inboundSchema=void 0;up.retrieveFileOutToJSON=E1o;up.retrieveFileOutFromJSON=P1o;var Xu=O1o(Q()),JRr=le(),T1o=Z(),WRr=kae(),KRr=qae(),GRr=Uae();up.RetrieveFileOut$inboundSchema=Xu.object({id:Xu.string(),object:Xu.string(),bytes:Xu.number().int(),created_at:Xu.number().int(),filename:Xu.string(),purpose:WRr.FilePurpose$inboundSchema,sample_type:KRr.SampleType$inboundSchema,num_lines:Xu.nullable(Xu.number().int()).optional(),mimetype:Xu.nullable(Xu.string()).optional(),source:GRr.Source$inboundSchema,signature:Xu.nullable(Xu.string()).optional(),deleted:Xu.boolean()}).transform(t=>(0,JRr.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));up.RetrieveFileOut$outboundSchema=Xu.object({id:Xu.string(),object:Xu.string(),sizeBytes:Xu.number().int(),createdAt:Xu.number().int(),filename:Xu.string(),purpose:WRr.FilePurpose$outboundSchema,sampleType:KRr.SampleType$outboundSchema,numLines:Xu.nullable(Xu.number().int()).optional(),mimetype:Xu.nullable(Xu.string()).optional(),source:GRr.Source$outboundSchema,signature:Xu.nullable(Xu.string()).optional(),deleted:Xu.boolean()}).transform(t=>(0,JRr.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var HRr;(function(t){t.inboundSchema=up.RetrieveFileOut$inboundSchema,t.outboundSchema=up.RetrieveFileOut$outboundSchema})(HRr||(up.RetrieveFileOut$=HRr={}));function E1o(t){return JSON.stringify(up.RetrieveFileOut$outboundSchema.parse(t))}function P1o(t){return(0,T1o.safeParse)(t,e=>up.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var QRr=S(lp=>{"use strict";var M1o=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]}),I1o=lp&&lp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R1o=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"&&M1o(r,e,n[o]);return I1o(r,e),r}}();Object.defineProperty(lp,"__esModule",{value:!0});lp.Security$=lp.Security$outboundSchema=lp.Security$inboundSchema=void 0;lp.securityToJSON=N1o;lp.securityFromJSON=j1o;var sRe=R1o(Q()),YRr=le(),A1o=Z();lp.Security$inboundSchema=sRe.object({ApiKey:sRe.string().optional()}).transform(t=>(0,YRr.remap)(t,{ApiKey:"apiKey"}));lp.Security$outboundSchema=sRe.object({apiKey:sRe.string().optional()}).transform(t=>(0,YRr.remap)(t,{apiKey:"ApiKey"}));var ZRr;(function(t){t.inboundSchema=lp.Security$inboundSchema,t.outboundSchema=lp.Security$outboundSchema})(ZRr||(lp.Security$=ZRr={}));function N1o(t){return JSON.stringify(lp.Security$outboundSchema.parse(t))}function j1o(t){return(0,A1o.safeParse)(t,e=>lp.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var Hut=S(cp=>{"use strict";var D1o=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]}),$1o=cp&&cp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L1o=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"&&D1o(r,e,n[o]);return $1o(r,e),r}}();Object.defineProperty(cp,"__esModule",{value:!0});cp.ShareEnum$=cp.ShareEnum$outboundSchema=cp.ShareEnum$inboundSchema=cp.ShareEnum=void 0;var SH=L1o(Q()),F1o=XC();cp.ShareEnum={Viewer:"Viewer",Editor:"Editor"};cp.ShareEnum$inboundSchema=SH.union([SH.nativeEnum(cp.ShareEnum),SH.string().transform(F1o.catchUnrecognizedEnum)]);cp.ShareEnum$outboundSchema=SH.union([SH.nativeEnum(cp.ShareEnum),SH.string().and(SH.custom())]);var eAr;(function(t){t.inboundSchema=cp.ShareEnum$inboundSchema,t.outboundSchema=cp.ShareEnum$outboundSchema})(eAr||(cp.ShareEnum$=eAr={}))});var oAr=S(dp=>{"use strict";var k1o=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]}),q1o=dp&&dp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U1o=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"&&k1o(r,e,n[o]);return q1o(r,e),r}}();Object.defineProperty(dp,"__esModule",{value:!0});dp.SharingDelete$=dp.SharingDelete$outboundSchema=dp.SharingDelete$inboundSchema=void 0;dp.sharingDeleteToJSON=z1o;dp.sharingDeleteFromJSON=V1o;var S9=U1o(Q()),rAr=le(),B1o=Z(),nAr=LIe();dp.SharingDelete$inboundSchema=S9.object({org_id:S9.string(),share_with_uuid:S9.string(),share_with_type:nAr.EntityType$inboundSchema}).transform(t=>(0,rAr.remap)(t,{org_id:"orgId",share_with_uuid:"shareWithUuid",share_with_type:"shareWithType"}));dp.SharingDelete$outboundSchema=S9.object({orgId:S9.string(),shareWithUuid:S9.string(),shareWithType:nAr.EntityType$outboundSchema}).transform(t=>(0,rAr.remap)(t,{orgId:"org_id",shareWithUuid:"share_with_uuid",shareWithType:"share_with_type"}));var tAr;(function(t){t.inboundSchema=dp.SharingDelete$inboundSchema,t.outboundSchema=dp.SharingDelete$outboundSchema})(tAr||(dp.SharingDelete$=tAr={}));function z1o(t){return JSON.stringify(dp.SharingDelete$outboundSchema.parse(t))}function V1o(t){return(0,B1o.safeParse)(t,e=>dp.SharingDelete$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingDelete' from JSON")}});var lAr=S(fp=>{"use strict";var H1o=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]}),J1o=fp&&fp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W1o=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"&&H1o(r,e,n[o]);return J1o(r,e),r}}();Object.defineProperty(fp,"__esModule",{value:!0});fp.SharingIn$=fp.SharingIn$outboundSchema=fp.SharingIn$inboundSchema=void 0;fp.sharingInToJSON=G1o;fp.sharingInFromJSON=X1o;var C9=W1o(Q()),aAr=le(),K1o=Z(),sAr=LIe(),uAr=Hut();fp.SharingIn$inboundSchema=C9.object({org_id:C9.string(),level:uAr.ShareEnum$inboundSchema,share_with_uuid:C9.string(),share_with_type:sAr.EntityType$inboundSchema}).transform(t=>(0,aAr.remap)(t,{org_id:"orgId",share_with_uuid:"shareWithUuid",share_with_type:"shareWithType"}));fp.SharingIn$outboundSchema=C9.object({orgId:C9.string(),level:uAr.ShareEnum$outboundSchema,shareWithUuid:C9.string(),shareWithType:sAr.EntityType$outboundSchema}).transform(t=>(0,aAr.remap)(t,{orgId:"org_id",shareWithUuid:"share_with_uuid",shareWithType:"share_with_type"}));var iAr;(function(t){t.inboundSchema=fp.SharingIn$inboundSchema,t.outboundSchema=fp.SharingIn$outboundSchema})(iAr||(fp.SharingIn$=iAr={}));function G1o(t){return JSON.stringify(fp.SharingIn$outboundSchema.parse(t))}function X1o(t){return(0,K1o.safeParse)(t,e=>fp.SharingIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingIn' from JSON")}});var uRe=S(Ua=>{"use strict";var Z1o=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]}),Y1o=Ua&&Ua.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q1o=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"&&Z1o(r,e,n[o]);return Y1o(r,e),r}}();Object.defineProperty(Ua,"__esModule",{value:!0});Ua.TranscriptionSegmentChunk$=Ua.TranscriptionSegmentChunk$outboundSchema=Ua.TranscriptionSegmentChunk$inboundSchema=Ua.Type$=Ua.Type$outboundSchema=Ua.Type$inboundSchema=Ua.Type=void 0;Ua.transcriptionSegmentChunkToJSON=tjo;Ua.transcriptionSegmentChunkFromJSON=rjo;var a0=Q1o(Q()),ejo=le(),fAr=Z();Ua.Type={TranscriptionSegment:"transcription_segment"};Ua.Type$inboundSchema=a0.nativeEnum(Ua.Type);Ua.Type$outboundSchema=Ua.Type$inboundSchema;var cAr;(function(t){t.inboundSchema=Ua.Type$inboundSchema,t.outboundSchema=Ua.Type$outboundSchema})(cAr||(Ua.Type$=cAr={}));Ua.TranscriptionSegmentChunk$inboundSchema=(0,fAr.collectExtraKeys)(a0.object({text:a0.string(),start:a0.number(),end:a0.number(),type:Ua.Type$inboundSchema.default("transcription_segment")}).catchall(a0.any()),"additionalProperties",!0);Ua.TranscriptionSegmentChunk$outboundSchema=a0.object({text:a0.string(),start:a0.number(),end:a0.number(),type:Ua.Type$outboundSchema.default("transcription_segment"),additionalProperties:a0.record(a0.any())}).transform(t=>({...t.additionalProperties,...(0,ejo.remap)(t,{additionalProperties:null})}));var dAr;(function(t){t.inboundSchema=Ua.TranscriptionSegmentChunk$inboundSchema,t.outboundSchema=Ua.TranscriptionSegmentChunk$outboundSchema})(dAr||(Ua.TranscriptionSegmentChunk$=dAr={}));function tjo(t){return JSON.stringify(Ua.TranscriptionSegmentChunk$outboundSchema.parse(t))}function rjo(t){return(0,fAr.safeParse)(t,e=>Ua.TranscriptionSegmentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionSegmentChunk' from JSON")}});var yAr=S(pp=>{"use strict";var njo=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]}),ojo=pp&&pp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ijo=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"&&njo(r,e,n[o]);return ojo(r,e),r}}();Object.defineProperty(pp,"__esModule",{value:!0});pp.TranscriptionResponse$=pp.TranscriptionResponse$outboundSchema=pp.TranscriptionResponse$inboundSchema=void 0;pp.transcriptionResponseToJSON=sjo;pp.transcriptionResponseFromJSON=ujo;var Eb=ijo(Q()),ajo=le(),mAr=Z(),hAr=uRe(),gAr=eq();pp.TranscriptionResponse$inboundSchema=(0,mAr.collectExtraKeys)(Eb.object({model:Eb.string(),text:Eb.string(),segments:Eb.array(hAr.TranscriptionSegmentChunk$inboundSchema).optional(),usage:gAr.UsageInfo$inboundSchema,language:Eb.nullable(Eb.string())}).catchall(Eb.any()),"additionalProperties",!0);pp.TranscriptionResponse$outboundSchema=Eb.object({model:Eb.string(),text:Eb.string(),segments:Eb.array(hAr.TranscriptionSegmentChunk$outboundSchema).optional(),usage:gAr.UsageInfo$outboundSchema,language:Eb.nullable(Eb.string()),additionalProperties:Eb.record(Eb.any())}).transform(t=>({...t.additionalProperties,...(0,ajo.remap)(t,{additionalProperties:null})}));var pAr;(function(t){t.inboundSchema=pp.TranscriptionResponse$inboundSchema,t.outboundSchema=pp.TranscriptionResponse$outboundSchema})(pAr||(pp.TranscriptionResponse$=pAr={}));function sjo(t){return JSON.stringify(pp.TranscriptionResponse$outboundSchema.parse(t))}function ujo(t){return(0,mAr.safeParse)(t,e=>pp.TranscriptionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionResponse' from JSON")}});var Jut=S(Ba=>{"use strict";var ljo=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]}),cjo=Ba&&Ba.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),djo=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"&&ljo(r,e,n[o]);return cjo(r,e),r}}();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.TranscriptionStreamDone$=Ba.TranscriptionStreamDone$outboundSchema=Ba.TranscriptionStreamDone$inboundSchema=Ba.TranscriptionStreamDoneType$=Ba.TranscriptionStreamDoneType$outboundSchema=Ba.TranscriptionStreamDoneType$inboundSchema=Ba.TranscriptionStreamDoneType=void 0;Ba.transcriptionStreamDoneToJSON=pjo;Ba.transcriptionStreamDoneFromJSON=mjo;var Py=djo(Q()),fjo=le(),vAr=Z(),wAr=uRe(),SAr=eq();Ba.TranscriptionStreamDoneType={TranscriptionDone:"transcription.done"};Ba.TranscriptionStreamDoneType$inboundSchema=Py.nativeEnum(Ba.TranscriptionStreamDoneType);Ba.TranscriptionStreamDoneType$outboundSchema=Ba.TranscriptionStreamDoneType$inboundSchema;var bAr;(function(t){t.inboundSchema=Ba.TranscriptionStreamDoneType$inboundSchema,t.outboundSchema=Ba.TranscriptionStreamDoneType$outboundSchema})(bAr||(Ba.TranscriptionStreamDoneType$=bAr={}));Ba.TranscriptionStreamDone$inboundSchema=(0,vAr.collectExtraKeys)(Py.object({model:Py.string(),text:Py.string(),segments:Py.array(wAr.TranscriptionSegmentChunk$inboundSchema).optional(),usage:SAr.UsageInfo$inboundSchema,type:Ba.TranscriptionStreamDoneType$inboundSchema.default("transcription.done"),language:Py.nullable(Py.string())}).catchall(Py.any()),"additionalProperties",!0);Ba.TranscriptionStreamDone$outboundSchema=Py.object({model:Py.string(),text:Py.string(),segments:Py.array(wAr.TranscriptionSegmentChunk$outboundSchema).optional(),usage:SAr.UsageInfo$outboundSchema,type:Ba.TranscriptionStreamDoneType$outboundSchema.default("transcription.done"),language:Py.nullable(Py.string()),additionalProperties:Py.record(Py.any())}).transform(t=>({...t.additionalProperties,...(0,fjo.remap)(t,{additionalProperties:null})}));var _Ar;(function(t){t.inboundSchema=Ba.TranscriptionStreamDone$inboundSchema,t.outboundSchema=Ba.TranscriptionStreamDone$outboundSchema})(_Ar||(Ba.TranscriptionStreamDone$=_Ar={}));function pjo(t){return JSON.stringify(Ba.TranscriptionStreamDone$outboundSchema.parse(t))}function mjo(t){return(0,vAr.safeParse)(t,e=>Ba.TranscriptionStreamDone$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamDone' from JSON")}});var Wut=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.TranscriptionStreamEventTypes$=mp.TranscriptionStreamEventTypes$outboundSchema=mp.TranscriptionStreamEventTypes$inboundSchema=mp.TranscriptionStreamEventTypes=void 0;var bjo=yjo(Q());mp.TranscriptionStreamEventTypes={TranscriptionLanguage:"transcription.language",TranscriptionSegment:"transcription.segment",TranscriptionTextDelta:"transcription.text.delta",TranscriptionDone:"transcription.done"};mp.TranscriptionStreamEventTypes$inboundSchema=bjo.nativeEnum(mp.TranscriptionStreamEventTypes);mp.TranscriptionStreamEventTypes$outboundSchema=mp.TranscriptionStreamEventTypes$inboundSchema;var CAr;(function(t){t.inboundSchema=mp.TranscriptionStreamEventTypes$inboundSchema,t.outboundSchema=mp.TranscriptionStreamEventTypes$outboundSchema})(CAr||(mp.TranscriptionStreamEventTypes$=CAr={}))});var Kut=S(za=>{"use strict";var _jo=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]}),vjo=za&&za.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wjo=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"&&_jo(r,e,n[o]);return vjo(r,e),r}}();Object.defineProperty(za,"__esModule",{value:!0});za.TranscriptionStreamLanguage$=za.TranscriptionStreamLanguage$outboundSchema=za.TranscriptionStreamLanguage$inboundSchema=za.TranscriptionStreamLanguageType$=za.TranscriptionStreamLanguageType$outboundSchema=za.TranscriptionStreamLanguageType$inboundSchema=za.TranscriptionStreamLanguageType=void 0;za.transcriptionStreamLanguageToJSON=Sjo;za.transcriptionStreamLanguageFromJSON=Cjo;var lq=wjo(Q()),TAr=le(),EAr=Z();za.TranscriptionStreamLanguageType={TranscriptionLanguage:"transcription.language"};za.TranscriptionStreamLanguageType$inboundSchema=lq.nativeEnum(za.TranscriptionStreamLanguageType);za.TranscriptionStreamLanguageType$outboundSchema=za.TranscriptionStreamLanguageType$inboundSchema;var xAr;(function(t){t.inboundSchema=za.TranscriptionStreamLanguageType$inboundSchema,t.outboundSchema=za.TranscriptionStreamLanguageType$outboundSchema})(xAr||(za.TranscriptionStreamLanguageType$=xAr={}));za.TranscriptionStreamLanguage$inboundSchema=(0,EAr.collectExtraKeys)(lq.object({type:za.TranscriptionStreamLanguageType$inboundSchema.default("transcription.language"),audio_language:lq.string()}).catchall(lq.any()),"additionalProperties",!0).transform(t=>(0,TAr.remap)(t,{audio_language:"audioLanguage"}));za.TranscriptionStreamLanguage$outboundSchema=lq.object({type:za.TranscriptionStreamLanguageType$outboundSchema.default("transcription.language"),audioLanguage:lq.string(),additionalProperties:lq.record(lq.any())}).transform(t=>({...t.additionalProperties,...(0,TAr.remap)(t,{audioLanguage:"audio_language",additionalProperties:null})}));var OAr;(function(t){t.inboundSchema=za.TranscriptionStreamLanguage$inboundSchema,t.outboundSchema=za.TranscriptionStreamLanguage$outboundSchema})(OAr||(za.TranscriptionStreamLanguage$=OAr={}));function Sjo(t){return JSON.stringify(za.TranscriptionStreamLanguage$outboundSchema.parse(t))}function Cjo(t){return(0,EAr.safeParse)(t,e=>za.TranscriptionStreamLanguage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamLanguage' from JSON")}});var Gut=S(Va=>{"use strict";var xjo=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]}),Ojo=Va&&Va.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tjo=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"&&xjo(r,e,n[o]);return Ojo(r,e),r}}();Object.defineProperty(Va,"__esModule",{value:!0});Va.TranscriptionStreamSegmentDelta$=Va.TranscriptionStreamSegmentDelta$outboundSchema=Va.TranscriptionStreamSegmentDelta$inboundSchema=Va.TranscriptionStreamSegmentDeltaType$=Va.TranscriptionStreamSegmentDeltaType$outboundSchema=Va.TranscriptionStreamSegmentDeltaType$inboundSchema=Va.TranscriptionStreamSegmentDeltaType=void 0;Va.transcriptionStreamSegmentDeltaToJSON=Pjo;Va.transcriptionStreamSegmentDeltaFromJSON=Mjo;var s0=Tjo(Q()),Ejo=le(),IAr=Z();Va.TranscriptionStreamSegmentDeltaType={TranscriptionSegment:"transcription.segment"};Va.TranscriptionStreamSegmentDeltaType$inboundSchema=s0.nativeEnum(Va.TranscriptionStreamSegmentDeltaType);Va.TranscriptionStreamSegmentDeltaType$outboundSchema=Va.TranscriptionStreamSegmentDeltaType$inboundSchema;var PAr;(function(t){t.inboundSchema=Va.TranscriptionStreamSegmentDeltaType$inboundSchema,t.outboundSchema=Va.TranscriptionStreamSegmentDeltaType$outboundSchema})(PAr||(Va.TranscriptionStreamSegmentDeltaType$=PAr={}));Va.TranscriptionStreamSegmentDelta$inboundSchema=(0,IAr.collectExtraKeys)(s0.object({text:s0.string(),start:s0.number(),end:s0.number(),type:Va.TranscriptionStreamSegmentDeltaType$inboundSchema.default("transcription.segment")}).catchall(s0.any()),"additionalProperties",!0);Va.TranscriptionStreamSegmentDelta$outboundSchema=s0.object({text:s0.string(),start:s0.number(),end:s0.number(),type:Va.TranscriptionStreamSegmentDeltaType$outboundSchema.default("transcription.segment"),additionalProperties:s0.record(s0.any())}).transform(t=>({...t.additionalProperties,...(0,Ejo.remap)(t,{additionalProperties:null})}));var MAr;(function(t){t.inboundSchema=Va.TranscriptionStreamSegmentDelta$inboundSchema,t.outboundSchema=Va.TranscriptionStreamSegmentDelta$outboundSchema})(MAr||(Va.TranscriptionStreamSegmentDelta$=MAr={}));function Pjo(t){return JSON.stringify(Va.TranscriptionStreamSegmentDelta$outboundSchema.parse(t))}function Mjo(t){return(0,IAr.safeParse)(t,e=>Va.TranscriptionStreamSegmentDelta$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamSegmentDelta' from JSON")}});var Xut=S(Ha=>{"use strict";var Ijo=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]}),Rjo=Ha&&Ha.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ajo=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"&&Ijo(r,e,n[o]);return Rjo(r,e),r}}();Object.defineProperty(Ha,"__esModule",{value:!0});Ha.TranscriptionStreamTextDelta$=Ha.TranscriptionStreamTextDelta$outboundSchema=Ha.TranscriptionStreamTextDelta$inboundSchema=Ha.TranscriptionStreamTextDeltaType$=Ha.TranscriptionStreamTextDeltaType$outboundSchema=Ha.TranscriptionStreamTextDeltaType$inboundSchema=Ha.TranscriptionStreamTextDeltaType=void 0;Ha.transcriptionStreamTextDeltaToJSON=jjo;Ha.transcriptionStreamTextDeltaFromJSON=Djo;var cq=Ajo(Q()),Njo=le(),NAr=Z();Ha.TranscriptionStreamTextDeltaType={TranscriptionTextDelta:"transcription.text.delta"};Ha.TranscriptionStreamTextDeltaType$inboundSchema=cq.nativeEnum(Ha.TranscriptionStreamTextDeltaType);Ha.TranscriptionStreamTextDeltaType$outboundSchema=Ha.TranscriptionStreamTextDeltaType$inboundSchema;var RAr;(function(t){t.inboundSchema=Ha.TranscriptionStreamTextDeltaType$inboundSchema,t.outboundSchema=Ha.TranscriptionStreamTextDeltaType$outboundSchema})(RAr||(Ha.TranscriptionStreamTextDeltaType$=RAr={}));Ha.TranscriptionStreamTextDelta$inboundSchema=(0,NAr.collectExtraKeys)(cq.object({text:cq.string(),type:Ha.TranscriptionStreamTextDeltaType$inboundSchema.default("transcription.text.delta")}).catchall(cq.any()),"additionalProperties",!0);Ha.TranscriptionStreamTextDelta$outboundSchema=cq.object({text:cq.string(),type:Ha.TranscriptionStreamTextDeltaType$outboundSchema.default("transcription.text.delta"),additionalProperties:cq.record(cq.any())}).transform(t=>({...t.additionalProperties,...(0,Njo.remap)(t,{additionalProperties:null})}));var AAr;(function(t){t.inboundSchema=Ha.TranscriptionStreamTextDelta$inboundSchema,t.outboundSchema=Ha.TranscriptionStreamTextDelta$outboundSchema})(AAr||(Ha.TranscriptionStreamTextDelta$=AAr={}));function jjo(t){return JSON.stringify(Ha.TranscriptionStreamTextDelta$outboundSchema.parse(t))}function Djo(t){return(0,NAr.safeParse)(t,e=>Ha.TranscriptionStreamTextDelta$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamTextDelta' from JSON")}});var FAr=S(xs=>{"use strict";var $jo=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]}),Ljo=xs&&xs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fjo=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"&&$jo(r,e,n[o]);return Ljo(r,e),r}}();Object.defineProperty(xs,"__esModule",{value:!0});xs.TranscriptionStreamEvents$=xs.TranscriptionStreamEvents$outboundSchema=xs.TranscriptionStreamEvents$inboundSchema=xs.TranscriptionStreamEventsData$=xs.TranscriptionStreamEventsData$outboundSchema=xs.TranscriptionStreamEventsData$inboundSchema=void 0;xs.transcriptionStreamEventsDataToJSON=kjo;xs.transcriptionStreamEventsDataFromJSON=qjo;xs.transcriptionStreamEventsToJSON=Ujo;xs.transcriptionStreamEventsFromJSON=Bjo;var ni=Fjo(Q()),$Ar=Z(),lRe=Jut(),LAr=Wut(),cRe=Kut(),dRe=Gut(),fRe=Xut();xs.TranscriptionStreamEventsData$inboundSchema=ni.union([lRe.TranscriptionStreamDone$inboundSchema.and(ni.object({type:ni.literal("transcription.done")}).transform(t=>({type:t.type}))),dRe.TranscriptionStreamSegmentDelta$inboundSchema.and(ni.object({type:ni.literal("transcription.segment")}).transform(t=>({type:t.type}))),cRe.TranscriptionStreamLanguage$inboundSchema.and(ni.object({type:ni.literal("transcription.language")}).transform(t=>({type:t.type}))),fRe.TranscriptionStreamTextDelta$inboundSchema.and(ni.object({type:ni.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]);xs.TranscriptionStreamEventsData$outboundSchema=ni.union([lRe.TranscriptionStreamDone$outboundSchema.and(ni.object({type:ni.literal("transcription.done")}).transform(t=>({type:t.type}))),dRe.TranscriptionStreamSegmentDelta$outboundSchema.and(ni.object({type:ni.literal("transcription.segment")}).transform(t=>({type:t.type}))),cRe.TranscriptionStreamLanguage$outboundSchema.and(ni.object({type:ni.literal("transcription.language")}).transform(t=>({type:t.type}))),fRe.TranscriptionStreamTextDelta$outboundSchema.and(ni.object({type:ni.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]);var jAr;(function(t){t.inboundSchema=xs.TranscriptionStreamEventsData$inboundSchema,t.outboundSchema=xs.TranscriptionStreamEventsData$outboundSchema})(jAr||(xs.TranscriptionStreamEventsData$=jAr={}));function kjo(t){return JSON.stringify(xs.TranscriptionStreamEventsData$outboundSchema.parse(t))}function qjo(t){return(0,$Ar.safeParse)(t,e=>xs.TranscriptionStreamEventsData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamEventsData' from JSON")}xs.TranscriptionStreamEvents$inboundSchema=ni.object({event:LAr.TranscriptionStreamEventTypes$inboundSchema,data:ni.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:ni.ZodIssueCode.custom,message:`malformed json: ${r}`}),ni.NEVER}}).pipe(ni.union([lRe.TranscriptionStreamDone$inboundSchema.and(ni.object({type:ni.literal("transcription.done")}).transform(t=>({type:t.type}))),dRe.TranscriptionStreamSegmentDelta$inboundSchema.and(ni.object({type:ni.literal("transcription.segment")}).transform(t=>({type:t.type}))),cRe.TranscriptionStreamLanguage$inboundSchema.and(ni.object({type:ni.literal("transcription.language")}).transform(t=>({type:t.type}))),fRe.TranscriptionStreamTextDelta$inboundSchema.and(ni.object({type:ni.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]))});xs.TranscriptionStreamEvents$outboundSchema=ni.object({event:LAr.TranscriptionStreamEventTypes$outboundSchema,data:ni.union([lRe.TranscriptionStreamDone$outboundSchema.and(ni.object({type:ni.literal("transcription.done")}).transform(t=>({type:t.type}))),dRe.TranscriptionStreamSegmentDelta$outboundSchema.and(ni.object({type:ni.literal("transcription.segment")}).transform(t=>({type:t.type}))),cRe.TranscriptionStreamLanguage$outboundSchema.and(ni.object({type:ni.literal("transcription.language")}).transform(t=>({type:t.type}))),fRe.TranscriptionStreamTextDelta$outboundSchema.and(ni.object({type:ni.literal("transcription.text.delta")}).transform(t=>({type:t.type})))])});var DAr;(function(t){t.inboundSchema=xs.TranscriptionStreamEvents$inboundSchema,t.outboundSchema=xs.TranscriptionStreamEvents$outboundSchema})(DAr||(xs.TranscriptionStreamEvents$=DAr={}));function Ujo(t){return JSON.stringify(xs.TranscriptionStreamEvents$outboundSchema.parse(t))}function Bjo(t){return(0,$Ar.safeParse)(t,e=>xs.TranscriptionStreamEvents$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamEvents' from JSON")}});var UAr=S(Ja=>{"use strict";var zjo=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]}),Vjo=Ja&&Ja.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hjo=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"&&zjo(r,e,n[o]);return Vjo(r,e),r}}();Object.defineProperty(Ja,"__esModule",{value:!0});Ja.UnarchiveFTModelOut$=Ja.UnarchiveFTModelOut$outboundSchema=Ja.UnarchiveFTModelOut$inboundSchema=Ja.UnarchiveFTModelOutObject$=Ja.UnarchiveFTModelOutObject$outboundSchema=Ja.UnarchiveFTModelOutObject$inboundSchema=Ja.UnarchiveFTModelOutObject=void 0;Ja.unarchiveFTModelOutToJSON=Wjo;Ja.unarchiveFTModelOutFromJSON=Kjo;var CH=Hjo(Q()),Jjo=Z();Ja.UnarchiveFTModelOutObject={Model:"model"};Ja.UnarchiveFTModelOutObject$inboundSchema=CH.nativeEnum(Ja.UnarchiveFTModelOutObject);Ja.UnarchiveFTModelOutObject$outboundSchema=Ja.UnarchiveFTModelOutObject$inboundSchema;var kAr;(function(t){t.inboundSchema=Ja.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=Ja.UnarchiveFTModelOutObject$outboundSchema})(kAr||(Ja.UnarchiveFTModelOutObject$=kAr={}));Ja.UnarchiveFTModelOut$inboundSchema=CH.object({id:CH.string(),object:Ja.UnarchiveFTModelOutObject$inboundSchema.default("model"),archived:CH.boolean().default(!1)});Ja.UnarchiveFTModelOut$outboundSchema=CH.object({id:CH.string(),object:Ja.UnarchiveFTModelOutObject$outboundSchema.default("model"),archived:CH.boolean().default(!1)});var qAr;(function(t){t.inboundSchema=Ja.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=Ja.UnarchiveFTModelOut$outboundSchema})(qAr||(Ja.UnarchiveFTModelOut$=qAr={}));function Wjo(t){return JSON.stringify(Ja.UnarchiveFTModelOut$outboundSchema.parse(t))}function Kjo(t){return(0,Jjo.safeParse)(t,e=>Ja.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var zAr=S(hp=>{"use strict";var Gjo=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]}),Xjo=hp&&hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zjo=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"&&Gjo(r,e,n[o]);return Xjo(r,e),r}}();Object.defineProperty(hp,"__esModule",{value:!0});hp.UpdateFTModelIn$=hp.UpdateFTModelIn$outboundSchema=hp.UpdateFTModelIn$inboundSchema=void 0;hp.updateFTModelInToJSON=Qjo;hp.updateFTModelInFromJSON=eDo;var VR=Zjo(Q()),Yjo=Z();hp.UpdateFTModelIn$inboundSchema=VR.object({name:VR.nullable(VR.string()).optional(),description:VR.nullable(VR.string()).optional()});hp.UpdateFTModelIn$outboundSchema=VR.object({name:VR.nullable(VR.string()).optional(),description:VR.nullable(VR.string()).optional()});var BAr;(function(t){t.inboundSchema=hp.UpdateFTModelIn$inboundSchema,t.outboundSchema=hp.UpdateFTModelIn$outboundSchema})(BAr||(hp.UpdateFTModelIn$=BAr={}));function Qjo(t){return JSON.stringify(hp.UpdateFTModelIn$outboundSchema.parse(t))}function eDo(t){return(0,Yjo.safeParse)(t,e=>hp.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var GAr=S(gp=>{"use strict";var tDo=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]}),rDo=gp&&gp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nDo=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"&&tDo(r,e,n[o]);return rDo(r,e),r}}();Object.defineProperty(gp,"__esModule",{value:!0});gp.UploadFileOut$=gp.UploadFileOut$outboundSchema=gp.UploadFileOut$inboundSchema=void 0;gp.uploadFileOutToJSON=iDo;gp.uploadFileOutFromJSON=aDo;var Zl=nDo(Q()),HAr=le(),oDo=Z(),JAr=kae(),WAr=qae(),KAr=Uae();gp.UploadFileOut$inboundSchema=Zl.object({id:Zl.string(),object:Zl.string(),bytes:Zl.number().int(),created_at:Zl.number().int(),filename:Zl.string(),purpose:JAr.FilePurpose$inboundSchema,sample_type:WAr.SampleType$inboundSchema,num_lines:Zl.nullable(Zl.number().int()).optional(),mimetype:Zl.nullable(Zl.string()).optional(),source:KAr.Source$inboundSchema,signature:Zl.nullable(Zl.string()).optional()}).transform(t=>(0,HAr.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));gp.UploadFileOut$outboundSchema=Zl.object({id:Zl.string(),object:Zl.string(),sizeBytes:Zl.number().int(),createdAt:Zl.number().int(),filename:Zl.string(),purpose:JAr.FilePurpose$outboundSchema,sampleType:WAr.SampleType$outboundSchema,numLines:Zl.nullable(Zl.number().int()).optional(),mimetype:Zl.nullable(Zl.string()).optional(),source:KAr.Source$outboundSchema,signature:Zl.nullable(Zl.string()).optional()}).transform(t=>(0,HAr.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var VAr;(function(t){t.inboundSchema=gp.UploadFileOut$inboundSchema,t.outboundSchema=gp.UploadFileOut$outboundSchema})(VAr||(gp.UploadFileOut$=VAr={}));function iDo(t){return JSON.stringify(gp.UploadFileOut$outboundSchema.parse(t))}function aDo(t){return(0,oDo.safeParse)(t,e=>gp.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var QAr=S(Os=>{"use strict";var sDo=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]}),uDo=Os&&Os.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lDo=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"&&sDo(r,e,n[o]);return uDo(r,e),r}}();Object.defineProperty(Os,"__esModule",{value:!0});Os.ValidationError$=Os.ValidationError$outboundSchema=Os.ValidationError$inboundSchema=Os.Loc$=Os.Loc$outboundSchema=Os.Loc$inboundSchema=void 0;Os.locToJSON=cDo;Os.locFromJSON=dDo;Os.validationErrorToJSON=fDo;Os.validationErrorFromJSON=pDo;var yp=lDo(Q()),YAr=Z();Os.Loc$inboundSchema=yp.union([yp.string(),yp.number().int()]);Os.Loc$outboundSchema=yp.union([yp.string(),yp.number().int()]);var XAr;(function(t){t.inboundSchema=Os.Loc$inboundSchema,t.outboundSchema=Os.Loc$outboundSchema})(XAr||(Os.Loc$=XAr={}));function cDo(t){return JSON.stringify(Os.Loc$outboundSchema.parse(t))}function dDo(t){return(0,YAr.safeParse)(t,e=>Os.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}Os.ValidationError$inboundSchema=yp.object({loc:yp.array(yp.union([yp.string(),yp.number().int()])),msg:yp.string(),type:yp.string()});Os.ValidationError$outboundSchema=yp.object({loc:yp.array(yp.union([yp.string(),yp.number().int()])),msg:yp.string(),type:yp.string()});var ZAr;(function(t){t.inboundSchema=Os.ValidationError$inboundSchema,t.outboundSchema=Os.ValidationError$outboundSchema})(ZAr||(Os.ValidationError$=ZAr={}));function fDo(t){return JSON.stringify(Os.ValidationError$outboundSchema.parse(t))}function pDo(t){return(0,YAr.safeParse)(t,e=>Os.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var kt=S(me=>{"use strict";var mDo=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]}),_e=me&&me.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mDo(e,t,r)};Object.defineProperty(me,"__esModule",{value:!0});_e(pwr(),me);_e(ywr(),me);_e(Cwr(),me);_e(Fst(),me);_e(Mae(),me);_e(kst(),me);_e(i0r(),me);_e(h0r(),me);_e(w0r(),me);_e(Jst(),me);_e(O0r(),me);_e(jR(),me);_e(qst(),me);_e(N0r(),me);_e(F0r(),me);_e(Wst(),me);_e(Kst(),me);_e(G0r(),me);_e(Xst(),me);_e(iCr(),me);_e(Gst(),me);_e(Qk(),me);_e(yCr(),me);_e(wMe(),me);_e(RCr(),me);_e(FCr(),me);_e(KCr(),me);_e(exr(),me);_e(LMe(),me);_e(cxr(),me);_e(mxr(),me);_e(tut(),me);_e(qxr(),me);_e(Gxr(),me);_e(rut(),me);_e(nut(),me);_e(kMe(),me);_e(qMe(),me);_e(out(),me);_e(zk(),me);_e(JS(),me);_e(Rst(),me);_e(sut(),me);_e(FOr(),me);_e(UOr(),me);_e(WOr(),me);_e(cut(),me);_e(aut(),me);_e(JMe(),me);_e(dut(),me);_e(s9(),me);_e(yEr(),me);_e(CEr(),me);_e(gPr(),me);_e(SPr(),me);_e(rq(),me);_e(RPr(),me);_e(kPr(),me);_e(JPr(),me);_e(YPr(),me);_e(oMr(),me);_e(fMr(),me);_e(nIe(),me);_e(mMr(),me);_e(gMr(),me);_e(iut(),me);_e(Jk(),me);_e(Eut(),me);_e(vMr(),me);_e(SMr(),me);_e(iH(),me);_e(Put(),me);_e(RMr(),me);_e($Mr(),me);_e(Iut(),me);_e(Mut(),me);_e(LIe(),me);_e(UMe(),me);_e(lMe(),me);_e(APe(),me);_e(kae(),me);_e(Rut(),me);_e(WMr(),me);_e(YMr(),me);_e(rIr(),me);_e(sIr(),me);_e(Aut(),me);_e(FMe(),me);_e(zMe(),me);_e(Nut(),me);_e(_Pe(),me);_e(Bst(),me);_e(jae(),me);_e(fut(),me);_e(gut(),me);_e(Hst(),me);_e(YMe(),me);_e(Wk(),me);_e(jut(),me);_e(WMe(),me);_e(Kk(),me);_e(Ust(),me);_e(aH(),me);_e(hut(),me);_e(Qst(),me);_e(Zst(),me);_e(PIr(),me);_e(h9(),me);_e(NIr(),me);_e(Ast(),me);_e(LIr(),me);_e(qIr(),me);_e(BIr(),me);_e(Lut(),me);_e(XIr(),me);_e(QIr(),me);_e(rRr(),me);_e(sRr(),me);_e(Tut(),me);_e(put(),me);_e($ae(),me);_e(mut(),me);_e(y9(),me);_e(but(),me);_e(eut(),me);_e(l9(),me);_e(dMe(),me);_e(mRr(),me);_e(bRr(),me);_e(qut(),me);_e(CRr(),me);_e(Uut(),me);_e(But(),me);_e(zut(),me);_e(jRr(),me);_e(URr(),me);_e(Vut(),me);_e(yut(),me);_e(Fut(),me);_e(rH(),me);_e(VRr(),me);_e(jPe(),me);_e(_ut(),me);_e(vut(),me);_e(Hk(),me);_e(Nst(),me);_e(wut(),me);_e(XRr(),me);_e(qae(),me);_e(QRr(),me);_e(Hut(),me);_e(oAr(),me);_e(lAr(),me);_e(kut(),me);_e(Uae(),me);_e(Sut(),me);_e(Q1(),me);_e(Vst(),me);_e(Yk(),me);_e(uH(),me);_e(cMe(),me);_e(c9(),me);_e(LPe(),me);_e(d9(),me);_e(nH(),me);_e(Cut(),me);_e(xut(),me);_e(Lae(),me);_e(Out(),me);_e(Dae(),me);_e(ej(),me);_e(eIe(),me);_e(Aae(),me);_e(Dut(),me);_e(yAr(),me);_e(uRe(),me);_e(Jut(),me);_e(FAr(),me);_e(Wut(),me);_e(Kut(),me);_e(Gut(),me);_e(Xut(),me);_e(UAr(),me);_e(zAr(),me);_e(GAr(),me);_e(eq(),me);_e(tj(),me);_e(QAr(),me);_e($ut(),me);_e(g9(),me);_e(Gk(),me);_e(Xk(),me)});var nNr=S(Oh=>{"use strict";var hDo=Oh&&Oh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gDo=Oh&&Oh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tNr=Oh&&Oh.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 gDo(r,e),r}}();Object.defineProperty(Oh,"__esModule",{value:!0});Oh.HTTPValidationError$=Oh.HTTPValidationError$outboundSchema=Oh.HTTPValidationError$inboundSchema=Oh.HTTPValidationError=void 0;var dq=tNr(Q()),rNr=tNr(kt()),yDo=dPe(),Bae=class extends yDo.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"}};Oh.HTTPValidationError=Bae;Oh.HTTPValidationError$inboundSchema=dq.object({detail:dq.array(rNr.ValidationError$inboundSchema).optional(),request$:dq.instanceof(Request),response$:dq.instanceof(Response),body$:dq.string()}).transform(t=>new Bae(t,{request:t.request$,response:t.response$,body:t.body$}));Oh.HTTPValidationError$outboundSchema=dq.instanceof(Bae).transform(t=>t.data$).pipe(dq.object({detail:dq.array(rNr.ValidationError$outboundSchema).optional()}));var eNr;(function(t){t.inboundSchema=Oh.HTTPValidationError$inboundSchema,t.outboundSchema=Oh.HTTPValidationError$outboundSchema})(eNr||(Oh.HTTPValidationError$=eNr={}))});var Gn=S(nx=>{"use strict";var bDo=nx&&nx.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zae=nx&&nx.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bDo(e,t,r)};Object.defineProperty(nx,"__esModule",{value:!0});zae(rst(),nx);zae(nNr(),nx);zae(Tst(),nx);zae(Pst(),nx);zae(fPe(),nx)});var hr=S(fq=>{"use strict";var oNr=fq&&fq.__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},Vae=fq&&fq.__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)},x9,Hae,iNr;Object.defineProperty(fq,"__esModule",{value:!0});fq.APIPromise=void 0;var Zut=class{constructor(e){x9.set(this,void 0),Hae.set(this,void 0),this[iNr]="APIPromise",oNr(this,x9,e instanceof Promise?e:Promise.resolve(e),"f"),oNr(this,Hae,e instanceof Promise?Vae(this,x9,"f").then(([r])=>r):Promise.resolve(e[0]),"f")}then(e,r){return Vae(this,x9,"f").then(e?([n])=>e(n):void 0,r)}catch(e){return Vae(this,Hae,"f").catch(e)}finally(e){return Vae(this,Hae,"f").finally(e)}$inspect(){return Vae(this,x9,"f")}};fq.APIPromise=Zut;x9=new WeakMap,Hae=new WeakMap,iNr=Symbol.toStringTag});var uNr=S(aj=>{"use strict";var _Do=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]}),vDo=aj&&aj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yut=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"&&_Do(r,e,n[o]);return vDo(r,e),r}}();Object.defineProperty(aj,"__esModule",{value:!0});aj.agentsComplete=EDo;var wDo=wr(),Jae=Yut(pr()),SDo=le(),CDo=Z(),aNr=mr(),xDo=cr(),sNr=Yut(kt()),ODo=Yut(Gn()),TDo=hr();function EDo(t,e,r){return new TDo.APIPromise(PDo(t,e,r))}async function PDo(t,e,r){let n=(0,CDo.safeParse)(e,b=>sNr.AgentsCompletionRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,wDo.encodeJSON)("body",o,{explode:!0}),a=(0,xDo.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,SDo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,aNr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,aNr.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 Jae.match(Jae.json(200,sNr.ChatCompletionResponse$inboundSchema),Jae.jsonErr(422,ODo.HTTPValidationError$inboundSchema),Jae.fail("4XX"),Jae.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var pq=S(pRe=>{"use strict";Object.defineProperty(pRe,"__esModule",{value:!0});pRe.EventStream=void 0;var Qut=class extends ReadableStream{constructor(e,r){let n=e.getReader(),o=new Uint8Array;super({async pull(i){try{for(;;){let a=IDo(o);if(!a){let l=await n.read();if(l.done)return i.close();o=MDo(o,l.value);continue}let s=o.slice(0,a.index);o=o.slice(a.index+a.length);let u=RDo(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}}}};pRe.EventStream=Qut;function MDo(t,e){let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r}function IDo(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 RDo(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 dNr=S(sj=>{"use strict";var ADo=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]}),NDo=sj&&sj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mRe=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"&&ADo(r,e,n[o]);return NDo(r,e),r}}();Object.defineProperty(sj,"__esModule",{value:!0});sj.agentsStream=BDo;var jDo=mRe(Q()),DDo=wr(),$Do=pq(),Wae=mRe(pr()),LDo=le(),FDo=Z(),lNr=mr(),kDo=cr(),cNr=mRe(kt()),qDo=mRe(Gn()),UDo=hr();function BDo(t,e,r){return new UDo.APIPromise(zDo(t,e,r))}async function zDo(t,e,r){let n=(0,FDo.safeParse)(e,b=>cNr.AgentsCompletionStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,DDo.encodeJSON)("body",o,{explode:!0}),a=(0,kDo.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,LDo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,lNr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,lNr.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 Wae.match(Wae.sse(200,jDo.instanceof(ReadableStream).transform(b=>new $Do.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:cNr.CompletionEvent$inboundSchema.parse(_)}))),Wae.jsonErr(422,qDo.HTTPValidationError$inboundSchema),Wae.fail("4XX"),Wae.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var pNr=S(hRe=>{"use strict";Object.defineProperty(hRe,"__esModule",{value:!0});hRe.Agents=void 0;var VDo=uNr(),HDo=dNr(),JDo=Rc(),fNr=vd(),elt=class extends JDo.ClientSDK{async complete(e,r){return(0,fNr.unwrapAsync)((0,VDo.agentsComplete)(this,e,r))}async stream(e,r){return(0,fNr.unwrapAsync)((0,HDo.agentsStream)(this,e,r))}};hRe.Agents=elt});var Kae=S(tlt=>{"use strict";Object.defineProperty(tlt,"__esModule",{value:!0});tlt.isReadableStream=WDo;function WDo(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 yNr=S(uj=>{"use strict";var KDo=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]}),GDo=uj&&uj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gNr=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"&&KDo(r,e,n[o]);return GDo(r,e),r}}();Object.defineProperty(uj,"__esModule",{value:!0});uj.audioTranscriptionsComplete=r$o;var HR=wr(),rlt=JG(),gRe=gNr(pr()),XDo=le(),ZDo=Z(),mNr=mr(),YDo=cr(),hNr=gNr(kt()),QDo=hr(),e$o=rj(),t$o=Kae();function r$o(t,e,r){return new QDo.APIPromise(n$o(t,e,r))}async function n$o(t,e,r){let n=(0,ZDo.safeParse)(e,g=>hNr.AudioTranscriptionRequest$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,HR.appendForm)(i,"model",o.model),o.file!==void 0)if((0,e$o.isBlobLike)(o.file))(0,HR.appendForm)(i,"file",o.file);else if((0,t$o.isReadableStream)(o.file.content)){let g=await(0,rlt.readableStreamToArrayBuffer)(o.file.content),b=(0,rlt.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([g],{type:b});(0,HR.appendForm)(i,"file",_,o.file.fileName)}else{let g=(0,rlt.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,HR.appendForm)(i,"file",new Blob([o.file.content],{type:g}),o.file.fileName)}o.file_id!==void 0&&(0,HR.appendForm)(i,"file_id",o.file_id),o.file_url!==void 0&&(0,HR.appendForm)(i,"file_url",o.file_url),o.language!==void 0&&(0,HR.appendForm)(i,"language",o.language),o.stream!==void 0&&(0,HR.appendForm)(i,"stream",o.stream),o.temperature!==void 0&&(0,HR.appendForm)(i,"temperature",o.temperature),o.timestamp_granularities!==void 0&&(0,HR.appendForm)(i,"timestamp_granularities",o.timestamp_granularities);let a=(0,YDo.pathToFunc)("/v1/audio/transcriptions")(),s=new Headers((0,XDo.compactMap)({Accept:"application/json"})),u=await(0,mNr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,mNr.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 gRe.match(gRe.json(200,hNr.TranscriptionResponse$inboundSchema),gRe.fail("4XX"),gRe.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var vNr=S(lj=>{"use strict";var o$o=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]}),i$o=lj&&lj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),olt=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"&&o$o(r,e,n[o]);return i$o(r,e),r}}();Object.defineProperty(lj,"__esModule",{value:!0});lj.audioTranscriptionsStream=m$o;var a$o=olt(Q()),JR=wr(),s$o=pq(),nlt=JG(),yRe=olt(pr()),u$o=le(),l$o=Z(),bNr=mr(),c$o=cr(),_Nr=olt(kt()),d$o=hr(),f$o=rj(),p$o=Kae();function m$o(t,e,r){return new d$o.APIPromise(h$o(t,e,r))}async function h$o(t,e,r){let n=(0,l$o.safeParse)(e,g=>_Nr.AudioTranscriptionRequestStream$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,JR.appendForm)(i,"model",o.model),o.file!==void 0)if((0,f$o.isBlobLike)(o.file))(0,JR.appendForm)(i,"file",o.file);else if((0,p$o.isReadableStream)(o.file.content)){let g=await(0,nlt.readableStreamToArrayBuffer)(o.file.content),b=(0,nlt.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([g],{type:b});(0,JR.appendForm)(i,"file",_,o.file.fileName)}else{let g=(0,nlt.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,JR.appendForm)(i,"file",new Blob([o.file.content],{type:g}),o.file.fileName)}o.file_id!==void 0&&(0,JR.appendForm)(i,"file_id",o.file_id),o.file_url!==void 0&&(0,JR.appendForm)(i,"file_url",o.file_url),o.language!==void 0&&(0,JR.appendForm)(i,"language",o.language),o.stream!==void 0&&(0,JR.appendForm)(i,"stream",o.stream),o.temperature!==void 0&&(0,JR.appendForm)(i,"temperature",o.temperature),o.timestamp_granularities!==void 0&&(0,JR.appendForm)(i,"timestamp_granularities",o.timestamp_granularities);let a=(0,c$o.pathToFunc)("/v1/audio/transcriptions#stream")(),s=new Headers((0,u$o.compactMap)({Accept:"text/event-stream"})),u=await(0,bNr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,bNr.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 yRe.match(yRe.sse(200,a$o.instanceof(ReadableStream).transform(g=>new s$o.EventStream(g,b=>({value:_Nr.TranscriptionStreamEvents$inboundSchema.parse(b)})))),yRe.fail("4XX"),yRe.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var SNr=S(bRe=>{"use strict";Object.defineProperty(bRe,"__esModule",{value:!0});bRe.Transcriptions=void 0;var g$o=yNr(),y$o=vNr(),b$o=Rc(),wNr=vd(),ilt=class extends b$o.ClientSDK{async complete(e,r){return(0,wNr.unwrapAsync)((0,g$o.audioTranscriptionsComplete)(this,e,r))}async stream(e,r){return(0,wNr.unwrapAsync)((0,y$o.audioTranscriptionsStream)(this,e,r))}};bRe.Transcriptions=ilt});var CNr=S(_Re=>{"use strict";Object.defineProperty(_Re,"__esModule",{value:!0});_Re.Audio=void 0;var _$o=Rc(),v$o=SNr(),alt=class extends _$o.ClientSDK{get transcriptions(){return this._transcriptions??(this._transcriptions=new v$o.Transcriptions(this._options))}};_Re.Audio=alt});var TNr=S(bp=>{"use strict";var w$o=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]}),S$o=bp&&bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C$o=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"&&w$o(r,e,n[o]);return S$o(r,e),r}}();Object.defineProperty(bp,"__esModule",{value:!0});bp.AgentsApiV1AgentsGetRequest$=bp.AgentsApiV1AgentsGetRequest$outboundSchema=bp.AgentsApiV1AgentsGetRequest$inboundSchema=void 0;bp.agentsApiV1AgentsGetRequestToJSON=O$o;bp.agentsApiV1AgentsGetRequestFromJSON=T$o;var vRe=C$o(Q()),ONr=le(),x$o=Z();bp.AgentsApiV1AgentsGetRequest$inboundSchema=vRe.object({agent_id:vRe.string()}).transform(t=>(0,ONr.remap)(t,{agent_id:"agentId"}));bp.AgentsApiV1AgentsGetRequest$outboundSchema=vRe.object({agentId:vRe.string()}).transform(t=>(0,ONr.remap)(t,{agentId:"agent_id"}));var xNr;(function(t){t.inboundSchema=bp.AgentsApiV1AgentsGetRequest$inboundSchema,t.outboundSchema=bp.AgentsApiV1AgentsGetRequest$outboundSchema})(xNr||(bp.AgentsApiV1AgentsGetRequest$=xNr={}));function O$o(t){return JSON.stringify(bp.AgentsApiV1AgentsGetRequest$outboundSchema.parse(t))}function T$o(t){return(0,x$o.safeParse)(t,e=>bp.AgentsApiV1AgentsGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsGetRequest' from JSON")}});var MNr=S(_p=>{"use strict";var E$o=_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]}),P$o=_p&&_p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M$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"&&E$o(r,e,n[o]);return P$o(r,e),r}}();Object.defineProperty(_p,"__esModule",{value:!0});_p.AgentsApiV1AgentsListRequest$=_p.AgentsApiV1AgentsListRequest$outboundSchema=_p.AgentsApiV1AgentsListRequest$inboundSchema=void 0;_p.agentsApiV1AgentsListRequestToJSON=R$o;_p.agentsApiV1AgentsListRequestFromJSON=A$o;var O9=M$o(Q()),PNr=le(),I$o=Z();_p.AgentsApiV1AgentsListRequest$inboundSchema=O9.object({page:O9.number().int().default(0),page_size:O9.number().int().default(20)}).transform(t=>(0,PNr.remap)(t,{page_size:"pageSize"}));_p.AgentsApiV1AgentsListRequest$outboundSchema=O9.object({page:O9.number().int().default(0),pageSize:O9.number().int().default(20)}).transform(t=>(0,PNr.remap)(t,{pageSize:"page_size"}));var ENr;(function(t){t.inboundSchema=_p.AgentsApiV1AgentsListRequest$inboundSchema,t.outboundSchema=_p.AgentsApiV1AgentsListRequest$outboundSchema})(ENr||(_p.AgentsApiV1AgentsListRequest$=ENr={}));function R$o(t){return JSON.stringify(_p.AgentsApiV1AgentsListRequest$outboundSchema.parse(t))}function A$o(t){return(0,I$o.safeParse)(t,e=>_p.AgentsApiV1AgentsListRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsListRequest' from JSON")}});var jNr=S(vp=>{"use strict";var N$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]}),j$o=vp&&vp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RNr=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"&&N$o(r,e,n[o]);return j$o(r,e),r}}();Object.defineProperty(vp,"__esModule",{value:!0});vp.AgentsApiV1AgentsUpdateRequest$=vp.AgentsApiV1AgentsUpdateRequest$outboundSchema=vp.AgentsApiV1AgentsUpdateRequest$inboundSchema=void 0;vp.agentsApiV1AgentsUpdateRequestToJSON=$$o;vp.agentsApiV1AgentsUpdateRequestFromJSON=L$o;var wRe=RNr(Q()),ANr=le(),D$o=Z(),NNr=RNr(kt());vp.AgentsApiV1AgentsUpdateRequest$inboundSchema=wRe.object({agent_id:wRe.string(),AgentUpdateRequest:NNr.AgentUpdateRequest$inboundSchema}).transform(t=>(0,ANr.remap)(t,{agent_id:"agentId",AgentUpdateRequest:"agentUpdateRequest"}));vp.AgentsApiV1AgentsUpdateRequest$outboundSchema=wRe.object({agentId:wRe.string(),agentUpdateRequest:NNr.AgentUpdateRequest$outboundSchema}).transform(t=>(0,ANr.remap)(t,{agentId:"agent_id",agentUpdateRequest:"AgentUpdateRequest"}));var INr;(function(t){t.inboundSchema=vp.AgentsApiV1AgentsUpdateRequest$inboundSchema,t.outboundSchema=vp.AgentsApiV1AgentsUpdateRequest$outboundSchema})(INr||(vp.AgentsApiV1AgentsUpdateRequest$=INr={}));function $$o(t){return JSON.stringify(vp.AgentsApiV1AgentsUpdateRequest$outboundSchema.parse(t))}function L$o(t){return(0,D$o.safeParse)(t,e=>vp.AgentsApiV1AgentsUpdateRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsUpdateRequest' from JSON")}});var LNr=S(wp=>{"use strict";var F$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]}),k$o=wp&&wp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),q$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"&&F$o(r,e,n[o]);return k$o(r,e),r}}();Object.defineProperty(wp,"__esModule",{value:!0});wp.AgentsApiV1AgentsUpdateVersionRequest$=wp.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema=wp.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema=void 0;wp.agentsApiV1AgentsUpdateVersionRequestToJSON=B$o;wp.agentsApiV1AgentsUpdateVersionRequestFromJSON=z$o;var T9=q$o(Q()),$Nr=le(),U$o=Z();wp.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema=T9.object({agent_id:T9.string(),version:T9.number().int()}).transform(t=>(0,$Nr.remap)(t,{agent_id:"agentId"}));wp.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema=T9.object({agentId:T9.string(),version:T9.number().int()}).transform(t=>(0,$Nr.remap)(t,{agentId:"agent_id"}));var DNr;(function(t){t.inboundSchema=wp.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema,t.outboundSchema=wp.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema})(DNr||(wp.AgentsApiV1AgentsUpdateVersionRequest$=DNr={}));function B$o(t){return JSON.stringify(wp.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema.parse(t))}function z$o(t){return(0,U$o.safeParse)(t,e=>wp.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsUpdateVersionRequest' from JSON")}});var BNr=S(Sp=>{"use strict";var V$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}),kNr=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"&&V$o(r,e,n[o]);return H$o(r,e),r}}();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.AgentsApiV1ConversationsAppendRequest$=Sp.AgentsApiV1ConversationsAppendRequest$outboundSchema=Sp.AgentsApiV1ConversationsAppendRequest$inboundSchema=void 0;Sp.agentsApiV1ConversationsAppendRequestToJSON=W$o;Sp.agentsApiV1ConversationsAppendRequestFromJSON=K$o;var SRe=kNr(Q()),qNr=le(),J$o=Z(),UNr=kNr(kt());Sp.AgentsApiV1ConversationsAppendRequest$inboundSchema=SRe.object({conversation_id:SRe.string(),ConversationAppendRequest:UNr.ConversationAppendRequest$inboundSchema}).transform(t=>(0,qNr.remap)(t,{conversation_id:"conversationId",ConversationAppendRequest:"conversationAppendRequest"}));Sp.AgentsApiV1ConversationsAppendRequest$outboundSchema=SRe.object({conversationId:SRe.string(),conversationAppendRequest:UNr.ConversationAppendRequest$outboundSchema}).transform(t=>(0,qNr.remap)(t,{conversationId:"conversation_id",conversationAppendRequest:"ConversationAppendRequest"}));var FNr;(function(t){t.inboundSchema=Sp.AgentsApiV1ConversationsAppendRequest$inboundSchema,t.outboundSchema=Sp.AgentsApiV1ConversationsAppendRequest$outboundSchema})(FNr||(Sp.AgentsApiV1ConversationsAppendRequest$=FNr={}));function W$o(t){return JSON.stringify(Sp.AgentsApiV1ConversationsAppendRequest$outboundSchema.parse(t))}function K$o(t){return(0,J$o.safeParse)(t,e=>Sp.AgentsApiV1ConversationsAppendRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsAppendRequest' from JSON")}});var WNr=S(Cp=>{"use strict";var G$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]}),X$o=Cp&&Cp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VNr=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"&&G$o(r,e,n[o]);return X$o(r,e),r}}();Object.defineProperty(Cp,"__esModule",{value:!0});Cp.AgentsApiV1ConversationsAppendStreamRequest$=Cp.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema=Cp.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema=void 0;Cp.agentsApiV1ConversationsAppendStreamRequestToJSON=Y$o;Cp.agentsApiV1ConversationsAppendStreamRequestFromJSON=Q$o;var CRe=VNr(Q()),HNr=le(),Z$o=Z(),JNr=VNr(kt());Cp.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema=CRe.object({conversation_id:CRe.string(),ConversationAppendStreamRequest:JNr.ConversationAppendStreamRequest$inboundSchema}).transform(t=>(0,HNr.remap)(t,{conversation_id:"conversationId",ConversationAppendStreamRequest:"conversationAppendStreamRequest"}));Cp.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema=CRe.object({conversationId:CRe.string(),conversationAppendStreamRequest:JNr.ConversationAppendStreamRequest$outboundSchema}).transform(t=>(0,HNr.remap)(t,{conversationId:"conversation_id",conversationAppendStreamRequest:"ConversationAppendStreamRequest"}));var zNr;(function(t){t.inboundSchema=Cp.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema,t.outboundSchema=Cp.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema})(zNr||(Cp.AgentsApiV1ConversationsAppendStreamRequest$=zNr={}));function Y$o(t){return JSON.stringify(Cp.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema.parse(t))}function Q$o(t){return(0,Z$o.safeParse)(t,e=>Cp.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsAppendStreamRequest' from JSON")}});var QNr=S(Ts=>{"use strict";var eLo=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]}),tLo=Ts&&Ts.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XNr=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"&&eLo(r,e,n[o]);return tLo(r,e),r}}();Object.defineProperty(Ts,"__esModule",{value:!0});Ts.AgentsApiV1ConversationsGetResponseV1ConversationsGet$=Ts.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema=Ts.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema=Ts.AgentsApiV1ConversationsGetRequest$=Ts.AgentsApiV1ConversationsGetRequest$outboundSchema=Ts.AgentsApiV1ConversationsGetRequest$inboundSchema=void 0;Ts.agentsApiV1ConversationsGetRequestToJSON=rLo;Ts.agentsApiV1ConversationsGetRequestFromJSON=nLo;Ts.agentsApiV1ConversationsGetResponseV1ConversationsGetToJSON=oLo;Ts.agentsApiV1ConversationsGetResponseV1ConversationsGetFromJSON=iLo;var E9=XNr(Q()),ZNr=le(),YNr=Z(),xRe=XNr(kt());Ts.AgentsApiV1ConversationsGetRequest$inboundSchema=E9.object({conversation_id:E9.string()}).transform(t=>(0,ZNr.remap)(t,{conversation_id:"conversationId"}));Ts.AgentsApiV1ConversationsGetRequest$outboundSchema=E9.object({conversationId:E9.string()}).transform(t=>(0,ZNr.remap)(t,{conversationId:"conversation_id"}));var KNr;(function(t){t.inboundSchema=Ts.AgentsApiV1ConversationsGetRequest$inboundSchema,t.outboundSchema=Ts.AgentsApiV1ConversationsGetRequest$outboundSchema})(KNr||(Ts.AgentsApiV1ConversationsGetRequest$=KNr={}));function rLo(t){return JSON.stringify(Ts.AgentsApiV1ConversationsGetRequest$outboundSchema.parse(t))}function nLo(t){return(0,YNr.safeParse)(t,e=>Ts.AgentsApiV1ConversationsGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsGetRequest' from JSON")}Ts.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema=E9.union([xRe.ModelConversation$inboundSchema,xRe.AgentConversation$inboundSchema]);Ts.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema=E9.union([xRe.ModelConversation$outboundSchema,xRe.AgentConversation$outboundSchema]);var GNr;(function(t){t.inboundSchema=Ts.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema,t.outboundSchema=Ts.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema})(GNr||(Ts.AgentsApiV1ConversationsGetResponseV1ConversationsGet$=GNr={}));function oLo(t){return JSON.stringify(Ts.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema.parse(t))}function iLo(t){return(0,YNr.safeParse)(t,e=>Ts.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsGetResponseV1ConversationsGet' from JSON")}});var r1r=S(xp=>{"use strict";var aLo=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]}),sLo=xp&&xp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uLo=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"&&aLo(r,e,n[o]);return sLo(r,e),r}}();Object.defineProperty(xp,"__esModule",{value:!0});xp.AgentsApiV1ConversationsHistoryRequest$=xp.AgentsApiV1ConversationsHistoryRequest$outboundSchema=xp.AgentsApiV1ConversationsHistoryRequest$inboundSchema=void 0;xp.agentsApiV1ConversationsHistoryRequestToJSON=cLo;xp.agentsApiV1ConversationsHistoryRequestFromJSON=dLo;var ORe=uLo(Q()),t1r=le(),lLo=Z();xp.AgentsApiV1ConversationsHistoryRequest$inboundSchema=ORe.object({conversation_id:ORe.string()}).transform(t=>(0,t1r.remap)(t,{conversation_id:"conversationId"}));xp.AgentsApiV1ConversationsHistoryRequest$outboundSchema=ORe.object({conversationId:ORe.string()}).transform(t=>(0,t1r.remap)(t,{conversationId:"conversation_id"}));var e1r;(function(t){t.inboundSchema=xp.AgentsApiV1ConversationsHistoryRequest$inboundSchema,t.outboundSchema=xp.AgentsApiV1ConversationsHistoryRequest$outboundSchema})(e1r||(xp.AgentsApiV1ConversationsHistoryRequest$=e1r={}));function cLo(t){return JSON.stringify(xp.AgentsApiV1ConversationsHistoryRequest$outboundSchema.parse(t))}function dLo(t){return(0,lLo.safeParse)(t,e=>xp.AgentsApiV1ConversationsHistoryRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsHistoryRequest' from JSON")}});var u1r=S(Es=>{"use strict";var fLo=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]}),pLo=Es&&Es.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i1r=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"&&fLo(r,e,n[o]);return pLo(r,e),r}}();Object.defineProperty(Es,"__esModule",{value:!0});Es.ResponseBody$=Es.ResponseBody$outboundSchema=Es.ResponseBody$inboundSchema=Es.AgentsApiV1ConversationsListRequest$=Es.AgentsApiV1ConversationsListRequest$outboundSchema=Es.AgentsApiV1ConversationsListRequest$inboundSchema=void 0;Es.agentsApiV1ConversationsListRequestToJSON=mLo;Es.agentsApiV1ConversationsListRequestFromJSON=hLo;Es.responseBodyToJSON=gLo;Es.responseBodyFromJSON=yLo;var mq=i1r(Q()),a1r=le(),s1r=Z(),TRe=i1r(kt());Es.AgentsApiV1ConversationsListRequest$inboundSchema=mq.object({page:mq.number().int().default(0),page_size:mq.number().int().default(100)}).transform(t=>(0,a1r.remap)(t,{page_size:"pageSize"}));Es.AgentsApiV1ConversationsListRequest$outboundSchema=mq.object({page:mq.number().int().default(0),pageSize:mq.number().int().default(100)}).transform(t=>(0,a1r.remap)(t,{pageSize:"page_size"}));var n1r;(function(t){t.inboundSchema=Es.AgentsApiV1ConversationsListRequest$inboundSchema,t.outboundSchema=Es.AgentsApiV1ConversationsListRequest$outboundSchema})(n1r||(Es.AgentsApiV1ConversationsListRequest$=n1r={}));function mLo(t){return JSON.stringify(Es.AgentsApiV1ConversationsListRequest$outboundSchema.parse(t))}function hLo(t){return(0,s1r.safeParse)(t,e=>Es.AgentsApiV1ConversationsListRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsListRequest' from JSON")}Es.ResponseBody$inboundSchema=mq.union([TRe.ModelConversation$inboundSchema,TRe.AgentConversation$inboundSchema]);Es.ResponseBody$outboundSchema=mq.union([TRe.ModelConversation$outboundSchema,TRe.AgentConversation$outboundSchema]);var o1r;(function(t){t.inboundSchema=Es.ResponseBody$inboundSchema,t.outboundSchema=Es.ResponseBody$outboundSchema})(o1r||(Es.ResponseBody$=o1r={}));function gLo(t){return JSON.stringify(Es.ResponseBody$outboundSchema.parse(t))}function yLo(t){return(0,s1r.safeParse)(t,e=>Es.ResponseBody$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseBody' from JSON")}});var d1r=S(Op=>{"use strict";var bLo=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]}),_Lo=Op&&Op.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vLo=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"&&bLo(r,e,n[o]);return _Lo(r,e),r}}();Object.defineProperty(Op,"__esModule",{value:!0});Op.AgentsApiV1ConversationsMessagesRequest$=Op.AgentsApiV1ConversationsMessagesRequest$outboundSchema=Op.AgentsApiV1ConversationsMessagesRequest$inboundSchema=void 0;Op.agentsApiV1ConversationsMessagesRequestToJSON=SLo;Op.agentsApiV1ConversationsMessagesRequestFromJSON=CLo;var ERe=vLo(Q()),c1r=le(),wLo=Z();Op.AgentsApiV1ConversationsMessagesRequest$inboundSchema=ERe.object({conversation_id:ERe.string()}).transform(t=>(0,c1r.remap)(t,{conversation_id:"conversationId"}));Op.AgentsApiV1ConversationsMessagesRequest$outboundSchema=ERe.object({conversationId:ERe.string()}).transform(t=>(0,c1r.remap)(t,{conversationId:"conversation_id"}));var l1r;(function(t){t.inboundSchema=Op.AgentsApiV1ConversationsMessagesRequest$inboundSchema,t.outboundSchema=Op.AgentsApiV1ConversationsMessagesRequest$outboundSchema})(l1r||(Op.AgentsApiV1ConversationsMessagesRequest$=l1r={}));function SLo(t){return JSON.stringify(Op.AgentsApiV1ConversationsMessagesRequest$outboundSchema.parse(t))}function CLo(t){return(0,wLo.safeParse)(t,e=>Op.AgentsApiV1ConversationsMessagesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsMessagesRequest' from JSON")}});var g1r=S(Tp=>{"use strict";var xLo=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]}),OLo=Tp&&Tp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p1r=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"&&xLo(r,e,n[o]);return OLo(r,e),r}}();Object.defineProperty(Tp,"__esModule",{value:!0});Tp.AgentsApiV1ConversationsRestartRequest$=Tp.AgentsApiV1ConversationsRestartRequest$outboundSchema=Tp.AgentsApiV1ConversationsRestartRequest$inboundSchema=void 0;Tp.agentsApiV1ConversationsRestartRequestToJSON=ELo;Tp.agentsApiV1ConversationsRestartRequestFromJSON=PLo;var PRe=p1r(Q()),m1r=le(),TLo=Z(),h1r=p1r(kt());Tp.AgentsApiV1ConversationsRestartRequest$inboundSchema=PRe.object({conversation_id:PRe.string(),ConversationRestartRequest:h1r.ConversationRestartRequest$inboundSchema}).transform(t=>(0,m1r.remap)(t,{conversation_id:"conversationId",ConversationRestartRequest:"conversationRestartRequest"}));Tp.AgentsApiV1ConversationsRestartRequest$outboundSchema=PRe.object({conversationId:PRe.string(),conversationRestartRequest:h1r.ConversationRestartRequest$outboundSchema}).transform(t=>(0,m1r.remap)(t,{conversationId:"conversation_id",conversationRestartRequest:"ConversationRestartRequest"}));var f1r;(function(t){t.inboundSchema=Tp.AgentsApiV1ConversationsRestartRequest$inboundSchema,t.outboundSchema=Tp.AgentsApiV1ConversationsRestartRequest$outboundSchema})(f1r||(Tp.AgentsApiV1ConversationsRestartRequest$=f1r={}));function ELo(t){return JSON.stringify(Tp.AgentsApiV1ConversationsRestartRequest$outboundSchema.parse(t))}function PLo(t){return(0,TLo.safeParse)(t,e=>Tp.AgentsApiV1ConversationsRestartRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsRestartRequest' from JSON")}});var w1r=S(Ep=>{"use strict";var MLo=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]}),ILo=Ep&&Ep.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),b1r=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"&&MLo(r,e,n[o]);return ILo(r,e),r}}();Object.defineProperty(Ep,"__esModule",{value:!0});Ep.AgentsApiV1ConversationsRestartStreamRequest$=Ep.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema=Ep.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema=void 0;Ep.agentsApiV1ConversationsRestartStreamRequestToJSON=ALo;Ep.agentsApiV1ConversationsRestartStreamRequestFromJSON=NLo;var MRe=b1r(Q()),_1r=le(),RLo=Z(),v1r=b1r(kt());Ep.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema=MRe.object({conversation_id:MRe.string(),ConversationRestartStreamRequest:v1r.ConversationRestartStreamRequest$inboundSchema}).transform(t=>(0,_1r.remap)(t,{conversation_id:"conversationId",ConversationRestartStreamRequest:"conversationRestartStreamRequest"}));Ep.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema=MRe.object({conversationId:MRe.string(),conversationRestartStreamRequest:v1r.ConversationRestartStreamRequest$outboundSchema}).transform(t=>(0,_1r.remap)(t,{conversationId:"conversation_id",conversationRestartStreamRequest:"ConversationRestartStreamRequest"}));var y1r;(function(t){t.inboundSchema=Ep.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema,t.outboundSchema=Ep.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema})(y1r||(Ep.AgentsApiV1ConversationsRestartStreamRequest$=y1r={}));function ALo(t){return JSON.stringify(Ep.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema.parse(t))}function NLo(t){return(0,RLo.safeParse)(t,e=>Ep.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsRestartStreamRequest' from JSON")}});var x1r=S(Pp=>{"use strict";var jLo=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]}),DLo=Pp&&Pp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Lo=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"&&jLo(r,e,n[o]);return DLo(r,e),r}}();Object.defineProperty(Pp,"__esModule",{value:!0});Pp.DeleteModelV1ModelsModelIdDeleteRequest$=Pp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Pp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;Pp.deleteModelV1ModelsModelIdDeleteRequestToJSON=FLo;Pp.deleteModelV1ModelsModelIdDeleteRequestFromJSON=kLo;var IRe=$Lo(Q()),C1r=le(),LLo=Z();Pp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=IRe.object({model_id:IRe.string()}).transform(t=>(0,C1r.remap)(t,{model_id:"modelId"}));Pp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=IRe.object({modelId:IRe.string()}).transform(t=>(0,C1r.remap)(t,{modelId:"model_id"}));var S1r;(function(t){t.inboundSchema=Pp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=Pp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(S1r||(Pp.DeleteModelV1ModelsModelIdDeleteRequest$=S1r={}));function FLo(t){return JSON.stringify(Pp.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function kLo(t){return(0,LLo.safeParse)(t,e=>Pp.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var E1r=S(Mp=>{"use strict";var qLo=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]}),ULo=Mp&&Mp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BLo=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"&&qLo(r,e,n[o]);return ULo(r,e),r}}();Object.defineProperty(Mp,"__esModule",{value:!0});Mp.FilesApiRoutesDeleteFileRequest$=Mp.FilesApiRoutesDeleteFileRequest$outboundSchema=Mp.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;Mp.filesApiRoutesDeleteFileRequestToJSON=VLo;Mp.filesApiRoutesDeleteFileRequestFromJSON=HLo;var RRe=BLo(Q()),T1r=le(),zLo=Z();Mp.FilesApiRoutesDeleteFileRequest$inboundSchema=RRe.object({file_id:RRe.string()}).transform(t=>(0,T1r.remap)(t,{file_id:"fileId"}));Mp.FilesApiRoutesDeleteFileRequest$outboundSchema=RRe.object({fileId:RRe.string()}).transform(t=>(0,T1r.remap)(t,{fileId:"file_id"}));var O1r;(function(t){t.inboundSchema=Mp.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=Mp.FilesApiRoutesDeleteFileRequest$outboundSchema})(O1r||(Mp.FilesApiRoutesDeleteFileRequest$=O1r={}));function VLo(t){return JSON.stringify(Mp.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function HLo(t){return(0,zLo.safeParse)(t,e=>Mp.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var I1r=S(Ip=>{"use strict";var JLo=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]}),WLo=Ip&&Ip.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KLo=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"&&JLo(r,e,n[o]);return WLo(r,e),r}}();Object.defineProperty(Ip,"__esModule",{value:!0});Ip.FilesApiRoutesDownloadFileRequest$=Ip.FilesApiRoutesDownloadFileRequest$outboundSchema=Ip.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;Ip.filesApiRoutesDownloadFileRequestToJSON=XLo;Ip.filesApiRoutesDownloadFileRequestFromJSON=ZLo;var ARe=KLo(Q()),M1r=le(),GLo=Z();Ip.FilesApiRoutesDownloadFileRequest$inboundSchema=ARe.object({file_id:ARe.string()}).transform(t=>(0,M1r.remap)(t,{file_id:"fileId"}));Ip.FilesApiRoutesDownloadFileRequest$outboundSchema=ARe.object({fileId:ARe.string()}).transform(t=>(0,M1r.remap)(t,{fileId:"file_id"}));var P1r;(function(t){t.inboundSchema=Ip.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=Ip.FilesApiRoutesDownloadFileRequest$outboundSchema})(P1r||(Ip.FilesApiRoutesDownloadFileRequest$=P1r={}));function XLo(t){return JSON.stringify(Ip.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function ZLo(t){return(0,GLo.safeParse)(t,e=>Ip.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var N1r=S(Rp=>{"use strict";var YLo=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]}),QLo=Rp&&Rp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eFo=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"&&YLo(r,e,n[o]);return QLo(r,e),r}}();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.FilesApiRoutesGetSignedUrlRequest$=Rp.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Rp.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;Rp.filesApiRoutesGetSignedUrlRequestToJSON=rFo;Rp.filesApiRoutesGetSignedUrlRequestFromJSON=nFo;var P9=eFo(Q()),A1r=le(),tFo=Z();Rp.FilesApiRoutesGetSignedUrlRequest$inboundSchema=P9.object({file_id:P9.string(),expiry:P9.number().int().default(24)}).transform(t=>(0,A1r.remap)(t,{file_id:"fileId"}));Rp.FilesApiRoutesGetSignedUrlRequest$outboundSchema=P9.object({fileId:P9.string(),expiry:P9.number().int().default(24)}).transform(t=>(0,A1r.remap)(t,{fileId:"file_id"}));var R1r;(function(t){t.inboundSchema=Rp.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=Rp.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(R1r||(Rp.FilesApiRoutesGetSignedUrlRequest$=R1r={}));function rFo(t){return JSON.stringify(Rp.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function nFo(t){return(0,tFo.safeParse)(t,e=>Rp.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var L1r=S(Np=>{"use strict";var oFo=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]}),iFo=Np&&Np.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D1r=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"&&oFo(r,e,n[o]);return iFo(r,e),r}}();Object.defineProperty(Np,"__esModule",{value:!0});Np.FilesApiRoutesListFilesRequest$=Np.FilesApiRoutesListFilesRequest$outboundSchema=Np.FilesApiRoutesListFilesRequest$inboundSchema=void 0;Np.filesApiRoutesListFilesRequestToJSON=sFo;Np.filesApiRoutesListFilesRequestFromJSON=uFo;var Ap=D1r(Q()),$1r=le(),aFo=Z(),M9=D1r(kt());Np.FilesApiRoutesListFilesRequest$inboundSchema=Ap.object({page:Ap.number().int().default(0),page_size:Ap.number().int().default(100),sample_type:Ap.nullable(Ap.array(M9.SampleType$inboundSchema)).optional(),source:Ap.nullable(Ap.array(M9.Source$inboundSchema)).optional(),search:Ap.nullable(Ap.string()).optional(),purpose:Ap.nullable(M9.FilePurpose$inboundSchema).optional()}).transform(t=>(0,$1r.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));Np.FilesApiRoutesListFilesRequest$outboundSchema=Ap.object({page:Ap.number().int().default(0),pageSize:Ap.number().int().default(100),sampleType:Ap.nullable(Ap.array(M9.SampleType$outboundSchema)).optional(),source:Ap.nullable(Ap.array(M9.Source$outboundSchema)).optional(),search:Ap.nullable(Ap.string()).optional(),purpose:Ap.nullable(M9.FilePurpose$outboundSchema).optional()}).transform(t=>(0,$1r.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var j1r;(function(t){t.inboundSchema=Np.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=Np.FilesApiRoutesListFilesRequest$outboundSchema})(j1r||(Np.FilesApiRoutesListFilesRequest$=j1r={}));function sFo(t){return JSON.stringify(Np.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function uFo(t){return(0,aFo.safeParse)(t,e=>Np.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var q1r=S(jp=>{"use strict";var lFo=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]}),cFo=jp&&jp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dFo=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"&&lFo(r,e,n[o]);return cFo(r,e),r}}();Object.defineProperty(jp,"__esModule",{value:!0});jp.FilesApiRoutesRetrieveFileRequest$=jp.FilesApiRoutesRetrieveFileRequest$outboundSchema=jp.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;jp.filesApiRoutesRetrieveFileRequestToJSON=pFo;jp.filesApiRoutesRetrieveFileRequestFromJSON=mFo;var NRe=dFo(Q()),k1r=le(),fFo=Z();jp.FilesApiRoutesRetrieveFileRequest$inboundSchema=NRe.object({file_id:NRe.string()}).transform(t=>(0,k1r.remap)(t,{file_id:"fileId"}));jp.FilesApiRoutesRetrieveFileRequest$outboundSchema=NRe.object({fileId:NRe.string()}).transform(t=>(0,k1r.remap)(t,{fileId:"file_id"}));var F1r;(function(t){t.inboundSchema=jp.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=jp.FilesApiRoutesRetrieveFileRequest$outboundSchema})(F1r||(jp.FilesApiRoutesRetrieveFileRequest$=F1r={}));function pFo(t){return JSON.stringify(jp.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function mFo(t){return(0,fFo.safeParse)(t,e=>jp.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var V1r=S(Dp=>{"use strict";var hFo=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]}),gFo=Dp&&Dp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B1r=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"&&hFo(r,e,n[o]);return gFo(r,e),r}}();Object.defineProperty(Dp,"__esModule",{value:!0});Dp.FilesApiRoutesUploadFileMultiPartBodyParams$=Dp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=Dp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=void 0;Dp.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=_Fo;Dp.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=vFo;var z1r=B1r(Q()),yFo=Z(),bFo=rj(),jRe=B1r(kt());Dp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=z1r.object({purpose:jRe.FilePurpose$inboundSchema.optional(),file:jRe.FileT$inboundSchema});Dp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=z1r.object({purpose:jRe.FilePurpose$outboundSchema.optional(),file:jRe.FileT$outboundSchema.or(bFo.blobLikeSchema)});var U1r;(function(t){t.inboundSchema=Dp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=Dp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(U1r||(Dp.FilesApiRoutesUploadFileMultiPartBodyParams$=U1r={}));function _Fo(t){return JSON.stringify(Dp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function vFo(t){return(0,yFo.safeParse)(t,e=>Dp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var W1r=S($p=>{"use strict";var wFo=$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]}),SFo=$p&&$p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CFo=$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"&&wFo(r,e,n[o]);return SFo(r,e),r}}();Object.defineProperty($p,"__esModule",{value:!0});$p.JobsApiRoutesBatchCancelBatchJobRequest$=$p.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=$p.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;$p.jobsApiRoutesBatchCancelBatchJobRequestToJSON=OFo;$p.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=TFo;var DRe=CFo(Q()),J1r=le(),xFo=Z();$p.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=DRe.object({job_id:DRe.string()}).transform(t=>(0,J1r.remap)(t,{job_id:"jobId"}));$p.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=DRe.object({jobId:DRe.string()}).transform(t=>(0,J1r.remap)(t,{jobId:"job_id"}));var H1r;(function(t){t.inboundSchema=$p.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=$p.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(H1r||($p.JobsApiRoutesBatchCancelBatchJobRequest$=H1r={}));function OFo(t){return JSON.stringify($p.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function TFo(t){return(0,xFo.safeParse)(t,e=>$p.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var X1r=S(Lp=>{"use strict";var EFo=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]}),PFo=Lp&&Lp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MFo=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"&&EFo(r,e,n[o]);return PFo(r,e),r}}();Object.defineProperty(Lp,"__esModule",{value:!0});Lp.JobsApiRoutesBatchGetBatchJobRequest$=Lp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=Lp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;Lp.jobsApiRoutesBatchGetBatchJobRequestToJSON=RFo;Lp.jobsApiRoutesBatchGetBatchJobRequestFromJSON=AFo;var $Re=MFo(Q()),G1r=le(),IFo=Z();Lp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=$Re.object({job_id:$Re.string()}).transform(t=>(0,G1r.remap)(t,{job_id:"jobId"}));Lp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=$Re.object({jobId:$Re.string()}).transform(t=>(0,G1r.remap)(t,{jobId:"job_id"}));var K1r;(function(t){t.inboundSchema=Lp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=Lp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(K1r||(Lp.JobsApiRoutesBatchGetBatchJobRequest$=K1r={}));function RFo(t){return JSON.stringify(Lp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function AFo(t){return(0,IFo.safeParse)(t,e=>Lp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var tjr=S(Fp=>{"use strict";var NFo=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]}),jFo=Fp&&Fp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y1r=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"&&NFo(r,e,n[o]);return jFo(r,e),r}}();Object.defineProperty(Fp,"__esModule",{value:!0});Fp.JobsApiRoutesBatchGetBatchJobsRequest$=Fp.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Fp.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;Fp.jobsApiRoutesBatchGetBatchJobsRequestToJSON=$Fo;Fp.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=LFo;var Zs=Y1r(Q()),Q1r=le(),DFo=Z(),ejr=Y1r(kt());Fp.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=Zs.object({page:Zs.number().int().default(0),page_size:Zs.number().int().default(100),model:Zs.nullable(Zs.string()).optional(),agent_id:Zs.nullable(Zs.string()).optional(),metadata:Zs.nullable(Zs.record(Zs.any())).optional(),created_after:Zs.nullable(Zs.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Zs.boolean().default(!1),status:Zs.nullable(Zs.array(ejr.BatchJobStatus$inboundSchema)).optional()}).transform(t=>(0,Q1r.remap)(t,{page_size:"pageSize",agent_id:"agentId",created_after:"createdAfter",created_by_me:"createdByMe"}));Fp.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Zs.object({page:Zs.number().int().default(0),pageSize:Zs.number().int().default(100),model:Zs.nullable(Zs.string()).optional(),agentId:Zs.nullable(Zs.string()).optional(),metadata:Zs.nullable(Zs.record(Zs.any())).optional(),createdAfter:Zs.nullable(Zs.date().transform(t=>t.toISOString())).optional(),createdByMe:Zs.boolean().default(!1),status:Zs.nullable(Zs.array(ejr.BatchJobStatus$outboundSchema)).optional()}).transform(t=>(0,Q1r.remap)(t,{pageSize:"page_size",agentId:"agent_id",createdAfter:"created_after",createdByMe:"created_by_me"}));var Z1r;(function(t){t.inboundSchema=Fp.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=Fp.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(Z1r||(Fp.JobsApiRoutesBatchGetBatchJobsRequest$=Z1r={}));function $Fo(t){return JSON.stringify(Fp.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function LFo(t){return(0,DFo.safeParse)(t,e=>Fp.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var ojr=S(kp=>{"use strict";var FFo=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]}),kFo=kp&&kp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qFo=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"&&FFo(r,e,n[o]);return kFo(r,e),r}}();Object.defineProperty(kp,"__esModule",{value:!0});kp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=kp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=kp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;kp.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=BFo;kp.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=zFo;var LRe=qFo(Q()),njr=le(),UFo=Z();kp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=LRe.object({model_id:LRe.string()}).transform(t=>(0,njr.remap)(t,{model_id:"modelId"}));kp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=LRe.object({modelId:LRe.string()}).transform(t=>(0,njr.remap)(t,{modelId:"model_id"}));var rjr;(function(t){t.inboundSchema=kp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=kp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(rjr||(kp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=rjr={}));function BFo(t){return JSON.stringify(kp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function zFo(t){return(0,UFo.safeParse)(t,e=>kp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var cjr=S(Ps=>{"use strict";var VFo=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]}),HFo=Ps&&Ps.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sjr=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"&&VFo(r,e,n[o]);return HFo(r,e),r}}();Object.defineProperty(Ps,"__esModule",{value:!0});Ps.JobsApiRoutesFineTuningCancelFineTuningJobResponse$=Ps.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema=Ps.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema=Ps.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=Ps.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=Ps.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;Ps.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=JFo;Ps.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=WFo;Ps.jobsApiRoutesFineTuningCancelFineTuningJobResponseToJSON=KFo;Ps.jobsApiRoutesFineTuningCancelFineTuningJobResponseFromJSON=GFo;var D_=sjr(Q()),ujr=le(),ljr=Z(),FRe=sjr(kt());Ps.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=D_.object({job_id:D_.string()}).transform(t=>(0,ujr.remap)(t,{job_id:"jobId"}));Ps.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=D_.object({jobId:D_.string()}).transform(t=>(0,ujr.remap)(t,{jobId:"job_id"}));var ijr;(function(t){t.inboundSchema=Ps.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=Ps.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(ijr||(Ps.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=ijr={}));function JFo(t){return JSON.stringify(Ps.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function WFo(t){return(0,ljr.safeParse)(t,e=>Ps.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}Ps.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema=D_.union([FRe.ClassifierDetailedJobOut$inboundSchema.and(D_.object({job_type:D_.literal("classifier")}).transform(t=>({jobType:t.job_type}))),FRe.CompletionDetailedJobOut$inboundSchema.and(D_.object({job_type:D_.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Ps.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema=D_.union([FRe.ClassifierDetailedJobOut$outboundSchema.and(D_.object({jobType:D_.literal("classifier")}).transform(t=>({job_type:t.jobType}))),FRe.CompletionDetailedJobOut$outboundSchema.and(D_.object({jobType:D_.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var ajr;(function(t){t.inboundSchema=Ps.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema,t.outboundSchema=Ps.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema})(ajr||(Ps.JobsApiRoutesFineTuningCancelFineTuningJobResponse$=ajr={}));function KFo(t){return JSON.stringify(Ps.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema.parse(t))}function GFo(t){return(0,ljr.safeParse)(t,e=>Ps.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobResponse' from JSON")}});var hjr=S(Ms=>{"use strict";var XFo=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]}),ZFo=Ms&&Ms.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pjr=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"&&XFo(r,e,n[o]);return ZFo(r,e),r}}();Object.defineProperty(Ms,"__esModule",{value:!0});Ms.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Ms.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Ms.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=Ms.One$=Ms.One$outboundSchema=Ms.One$inboundSchema=void 0;Ms.oneToJSON=YFo;Ms.oneFromJSON=QFo;Ms.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=eko;Ms.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=tko;var Nc=pjr(Q()),mjr=Z(),WR=pjr(kt());Ms.One$inboundSchema=Nc.union([WR.ClassifierJobOut$inboundSchema.and(Nc.object({job_type:Nc.literal("classifier")}).transform(t=>({jobType:t.job_type}))),WR.CompletionJobOut$inboundSchema.and(Nc.object({job_type:Nc.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Ms.One$outboundSchema=Nc.union([WR.ClassifierJobOut$outboundSchema.and(Nc.object({jobType:Nc.literal("classifier")}).transform(t=>({job_type:t.jobType}))),WR.CompletionJobOut$outboundSchema.and(Nc.object({jobType:Nc.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var djr;(function(t){t.inboundSchema=Ms.One$inboundSchema,t.outboundSchema=Ms.One$outboundSchema})(djr||(Ms.One$=djr={}));function YFo(t){return JSON.stringify(Ms.One$outboundSchema.parse(t))}function QFo(t){return(0,mjr.safeParse)(t,e=>Ms.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}Ms.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=Nc.union([WR.LegacyJobMetadataOut$inboundSchema,Nc.union([WR.ClassifierJobOut$inboundSchema.and(Nc.object({job_type:Nc.literal("classifier")}).transform(t=>({jobType:t.job_type}))),WR.CompletionJobOut$inboundSchema.and(Nc.object({job_type:Nc.literal("completion")}).transform(t=>({jobType:t.job_type})))])]);Ms.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Nc.union([WR.LegacyJobMetadataOut$outboundSchema,Nc.union([WR.ClassifierJobOut$outboundSchema.and(Nc.object({jobType:Nc.literal("classifier")}).transform(t=>({job_type:t.jobType}))),WR.CompletionJobOut$outboundSchema.and(Nc.object({jobType:Nc.literal("completion")}).transform(t=>({job_type:t.jobType})))])]);var fjr;(function(t){t.inboundSchema=Ms.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=Ms.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(fjr||(Ms.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=fjr={}));function eko(t){return JSON.stringify(Ms.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function tko(t){return(0,mjr.safeParse)(t,e=>Ms.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var wjr=S(Is=>{"use strict";var rko=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]}),nko=Is&&Is.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bjr=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"&&rko(r,e,n[o]);return nko(r,e),r}}();Object.defineProperty(Is,"__esModule",{value:!0});Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$=Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;Is.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=oko;Is.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=iko;Is.jobsApiRoutesFineTuningGetFineTuningJobResponseToJSON=ako;Is.jobsApiRoutesFineTuningGetFineTuningJobResponseFromJSON=sko;var $_=bjr(Q()),_jr=le(),vjr=Z(),kRe=bjr(kt());Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=$_.object({job_id:$_.string()}).transform(t=>(0,_jr.remap)(t,{job_id:"jobId"}));Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=$_.object({jobId:$_.string()}).transform(t=>(0,_jr.remap)(t,{jobId:"job_id"}));var gjr;(function(t){t.inboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(gjr||(Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$=gjr={}));function oko(t){return JSON.stringify(Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function iko(t){return(0,vjr.safeParse)(t,e=>Is.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema=$_.union([kRe.ClassifierDetailedJobOut$inboundSchema.and($_.object({job_type:$_.literal("classifier")}).transform(t=>({jobType:t.job_type}))),kRe.CompletionDetailedJobOut$inboundSchema.and($_.object({job_type:$_.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema=$_.union([kRe.ClassifierDetailedJobOut$outboundSchema.and($_.object({jobType:$_.literal("classifier")}).transform(t=>({job_type:t.jobType}))),kRe.CompletionDetailedJobOut$outboundSchema.and($_.object({jobType:$_.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var yjr;(function(t){t.inboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema,t.outboundSchema=Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema})(yjr||(Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$=yjr={}));function ako(t){return JSON.stringify(Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema.parse(t))}function sko(t){return(0,vjr.safeParse)(t,e=>Is.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobResponse' from JSON")}});var Ojr=S(Wa=>{"use strict";var uko=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]}),lko=Wa&&Wa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cko=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"&&uko(r,e,n[o]);return lko(r,e),r}}();Object.defineProperty(Wa,"__esModule",{value:!0});Wa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=Wa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Wa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Wa.Status$=Wa.Status$outboundSchema=Wa.Status$inboundSchema=Wa.Status=void 0;Wa.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=fko;Wa.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=pko;var Ji=cko(Q()),xjr=le(),dko=Z();Wa.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Wa.Status$inboundSchema=Ji.nativeEnum(Wa.Status);Wa.Status$outboundSchema=Wa.Status$inboundSchema;var Sjr;(function(t){t.inboundSchema=Wa.Status$inboundSchema,t.outboundSchema=Wa.Status$outboundSchema})(Sjr||(Wa.Status$=Sjr={}));Wa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=Ji.object({page:Ji.number().int().default(0),page_size:Ji.number().int().default(100),model:Ji.nullable(Ji.string()).optional(),created_after:Ji.nullable(Ji.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_before:Ji.nullable(Ji.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Ji.boolean().default(!1),status:Ji.nullable(Wa.Status$inboundSchema).optional(),wandb_project:Ji.nullable(Ji.string()).optional(),wandb_name:Ji.nullable(Ji.string()).optional(),suffix:Ji.nullable(Ji.string()).optional()}).transform(t=>(0,xjr.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_before:"createdBefore",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));Wa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=Ji.object({page:Ji.number().int().default(0),pageSize:Ji.number().int().default(100),model:Ji.nullable(Ji.string()).optional(),createdAfter:Ji.nullable(Ji.date().transform(t=>t.toISOString())).optional(),createdBefore:Ji.nullable(Ji.date().transform(t=>t.toISOString())).optional(),createdByMe:Ji.boolean().default(!1),status:Ji.nullable(Wa.Status$outboundSchema).optional(),wandbProject:Ji.nullable(Ji.string()).optional(),wandbName:Ji.nullable(Ji.string()).optional(),suffix:Ji.nullable(Ji.string()).optional()}).transform(t=>(0,xjr.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdBefore:"created_before",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var Cjr;(function(t){t.inboundSchema=Wa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=Wa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(Cjr||(Wa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=Cjr={}));function fko(t){return JSON.stringify(Wa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function pko(t){return(0,dko.safeParse)(t,e=>Wa.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var Rjr=S(Rs=>{"use strict";var mko=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]}),hko=Rs&&Rs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pjr=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"&&mko(r,e,n[o]);return hko(r,e),r}}();Object.defineProperty(Rs,"__esModule",{value:!0});Rs.JobsApiRoutesFineTuningStartFineTuningJobResponse$=Rs.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema=Rs.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema=Rs.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Rs.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Rs.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;Rs.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=gko;Rs.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=yko;Rs.jobsApiRoutesFineTuningStartFineTuningJobResponseToJSON=bko;Rs.jobsApiRoutesFineTuningStartFineTuningJobResponseFromJSON=_ko;var L_=Pjr(Q()),Mjr=le(),Ijr=Z(),qRe=Pjr(kt());Rs.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=L_.object({job_id:L_.string()}).transform(t=>(0,Mjr.remap)(t,{job_id:"jobId"}));Rs.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=L_.object({jobId:L_.string()}).transform(t=>(0,Mjr.remap)(t,{jobId:"job_id"}));var Tjr;(function(t){t.inboundSchema=Rs.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=Rs.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})(Tjr||(Rs.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Tjr={}));function gko(t){return JSON.stringify(Rs.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function yko(t){return(0,Ijr.safeParse)(t,e=>Rs.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}Rs.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema=L_.union([qRe.ClassifierDetailedJobOut$inboundSchema.and(L_.object({job_type:L_.literal("classifier")}).transform(t=>({jobType:t.job_type}))),qRe.CompletionDetailedJobOut$inboundSchema.and(L_.object({job_type:L_.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Rs.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema=L_.union([qRe.ClassifierDetailedJobOut$outboundSchema.and(L_.object({jobType:L_.literal("classifier")}).transform(t=>({job_type:t.jobType}))),qRe.CompletionDetailedJobOut$outboundSchema.and(L_.object({jobType:L_.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var Ejr;(function(t){t.inboundSchema=Rs.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema,t.outboundSchema=Rs.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema})(Ejr||(Rs.JobsApiRoutesFineTuningStartFineTuningJobResponse$=Ejr={}));function bko(t){return JSON.stringify(Rs.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema.parse(t))}function _ko(t){return(0,Ijr.safeParse)(t,e=>Rs.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobResponse' from JSON")}});var jjr=S(qp=>{"use strict";var vko=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]}),wko=qp&&qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sko=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"&&vko(r,e,n[o]);return wko(r,e),r}}();Object.defineProperty(qp,"__esModule",{value:!0});qp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=qp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=qp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;qp.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=xko;qp.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=Oko;var URe=Sko(Q()),Njr=le(),Cko=Z();qp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=URe.object({model_id:URe.string()}).transform(t=>(0,Njr.remap)(t,{model_id:"modelId"}));qp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=URe.object({modelId:URe.string()}).transform(t=>(0,Njr.remap)(t,{modelId:"model_id"}));var Ajr;(function(t){t.inboundSchema=qp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=qp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(Ajr||(qp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=Ajr={}));function xko(t){return JSON.stringify(qp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function Oko(t){return(0,Cko.safeParse)(t,e=>qp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var qjr=S(As=>{"use strict";var Tko=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]}),Eko=As&&As.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ljr=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"&&Tko(r,e,n[o]);return Eko(r,e),r}}();Object.defineProperty(As,"__esModule",{value:!0});As.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$=As.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema=As.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema=As.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=As.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=As.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;As.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=Pko;As.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=Mko;As.jobsApiRoutesFineTuningUpdateFineTunedModelResponseToJSON=Iko;As.jobsApiRoutesFineTuningUpdateFineTunedModelResponseFromJSON=Rko;var F_=Ljr(Q()),Fjr=le(),kjr=Z(),I9=Ljr(kt());As.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=F_.object({model_id:F_.string(),UpdateFTModelIn:I9.UpdateFTModelIn$inboundSchema}).transform(t=>(0,Fjr.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));As.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=F_.object({modelId:F_.string(),updateFTModelIn:I9.UpdateFTModelIn$outboundSchema}).transform(t=>(0,Fjr.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var Djr;(function(t){t.inboundSchema=As.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=As.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(Djr||(As.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=Djr={}));function Pko(t){return JSON.stringify(As.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function Mko(t){return(0,kjr.safeParse)(t,e=>As.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}As.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema=F_.union([I9.ClassifierFTModelOut$inboundSchema.and(F_.object({model_type:F_.literal("classifier")}).transform(t=>({modelType:t.model_type}))),I9.CompletionFTModelOut$inboundSchema.and(F_.object({model_type:F_.literal("completion")}).transform(t=>({modelType:t.model_type})))]);As.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema=F_.union([I9.ClassifierFTModelOut$outboundSchema.and(F_.object({modelType:F_.literal("classifier")}).transform(t=>({model_type:t.modelType}))),I9.CompletionFTModelOut$outboundSchema.and(F_.object({modelType:F_.literal("completion")}).transform(t=>({model_type:t.modelType})))]);var $jr;(function(t){t.inboundSchema=As.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema,t.outboundSchema=As.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema})($jr||(As.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$=$jr={}));function Iko(t){return JSON.stringify(As.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema.parse(t))}function Rko(t){return(0,kjr.safeParse)(t,e=>As.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelResponse' from JSON")}});var zjr=S(Up=>{"use strict";var Ako=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]}),Nko=Up&&Up.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jko=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"&&Ako(r,e,n[o]);return Nko(r,e),r}}();Object.defineProperty(Up,"__esModule",{value:!0});Up.LibrariesDeleteV1Request$=Up.LibrariesDeleteV1Request$outboundSchema=Up.LibrariesDeleteV1Request$inboundSchema=void 0;Up.librariesDeleteV1RequestToJSON=$ko;Up.librariesDeleteV1RequestFromJSON=Lko;var BRe=jko(Q()),Bjr=le(),Dko=Z();Up.LibrariesDeleteV1Request$inboundSchema=BRe.object({library_id:BRe.string()}).transform(t=>(0,Bjr.remap)(t,{library_id:"libraryId"}));Up.LibrariesDeleteV1Request$outboundSchema=BRe.object({libraryId:BRe.string()}).transform(t=>(0,Bjr.remap)(t,{libraryId:"library_id"}));var Ujr;(function(t){t.inboundSchema=Up.LibrariesDeleteV1Request$inboundSchema,t.outboundSchema=Up.LibrariesDeleteV1Request$outboundSchema})(Ujr||(Up.LibrariesDeleteV1Request$=Ujr={}));function $ko(t){return JSON.stringify(Up.LibrariesDeleteV1Request$outboundSchema.parse(t))}function Lko(t){return(0,Dko.safeParse)(t,e=>Up.LibrariesDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDeleteV1Request' from JSON")}});var Jjr=S(Bp=>{"use strict";var Fko=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]}),kko=Bp&&Bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qko=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"&&Fko(r,e,n[o]);return kko(r,e),r}}();Object.defineProperty(Bp,"__esModule",{value:!0});Bp.LibrariesDocumentsDeleteV1Request$=Bp.LibrariesDocumentsDeleteV1Request$outboundSchema=Bp.LibrariesDocumentsDeleteV1Request$inboundSchema=void 0;Bp.librariesDocumentsDeleteV1RequestToJSON=Bko;Bp.librariesDocumentsDeleteV1RequestFromJSON=zko;var R9=qko(Q()),Hjr=le(),Uko=Z();Bp.LibrariesDocumentsDeleteV1Request$inboundSchema=R9.object({library_id:R9.string(),document_id:R9.string()}).transform(t=>(0,Hjr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Bp.LibrariesDocumentsDeleteV1Request$outboundSchema=R9.object({libraryId:R9.string(),documentId:R9.string()}).transform(t=>(0,Hjr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var Vjr;(function(t){t.inboundSchema=Bp.LibrariesDocumentsDeleteV1Request$inboundSchema,t.outboundSchema=Bp.LibrariesDocumentsDeleteV1Request$outboundSchema})(Vjr||(Bp.LibrariesDocumentsDeleteV1Request$=Vjr={}));function Bko(t){return JSON.stringify(Bp.LibrariesDocumentsDeleteV1Request$outboundSchema.parse(t))}function zko(t){return(0,Uko.safeParse)(t,e=>Bp.LibrariesDocumentsDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsDeleteV1Request' from JSON")}});var Gjr=S(zp=>{"use strict";var Vko=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]}),Hko=zp&&zp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jko=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"&&Vko(r,e,n[o]);return Hko(r,e),r}}();Object.defineProperty(zp,"__esModule",{value:!0});zp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$=zp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema=zp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema=void 0;zp.librariesDocumentsGetExtractedTextSignedUrlV1RequestToJSON=Kko;zp.librariesDocumentsGetExtractedTextSignedUrlV1RequestFromJSON=Gko;var A9=Jko(Q()),Kjr=le(),Wko=Z();zp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema=A9.object({library_id:A9.string(),document_id:A9.string()}).transform(t=>(0,Kjr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));zp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema=A9.object({libraryId:A9.string(),documentId:A9.string()}).transform(t=>(0,Kjr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var Wjr;(function(t){t.inboundSchema=zp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema,t.outboundSchema=zp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema})(Wjr||(zp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$=Wjr={}));function Kko(t){return JSON.stringify(zp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema.parse(t))}function Gko(t){return(0,Wko.safeParse)(t,e=>zp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetExtractedTextSignedUrlV1Request' from JSON")}});var Yjr=S(Vp=>{"use strict";var Xko=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]}),Zko=Vp&&Vp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yko=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"&&Xko(r,e,n[o]);return Zko(r,e),r}}();Object.defineProperty(Vp,"__esModule",{value:!0});Vp.LibrariesDocumentsGetSignedUrlV1Request$=Vp.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema=Vp.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema=void 0;Vp.librariesDocumentsGetSignedUrlV1RequestToJSON=eqo;Vp.librariesDocumentsGetSignedUrlV1RequestFromJSON=tqo;var N9=Yko(Q()),Zjr=le(),Qko=Z();Vp.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema=N9.object({library_id:N9.string(),document_id:N9.string()}).transform(t=>(0,Zjr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Vp.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema=N9.object({libraryId:N9.string(),documentId:N9.string()}).transform(t=>(0,Zjr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var Xjr;(function(t){t.inboundSchema=Vp.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema,t.outboundSchema=Vp.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema})(Xjr||(Vp.LibrariesDocumentsGetSignedUrlV1Request$=Xjr={}));function eqo(t){return JSON.stringify(Vp.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema.parse(t))}function tqo(t){return(0,Qko.safeParse)(t,e=>Vp.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetSignedUrlV1Request' from JSON")}});var tDr=S(Hp=>{"use strict";var rqo=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]}),nqo=Hp&&Hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oqo=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"&&rqo(r,e,n[o]);return nqo(r,e),r}}();Object.defineProperty(Hp,"__esModule",{value:!0});Hp.LibrariesDocumentsGetStatusV1Request$=Hp.LibrariesDocumentsGetStatusV1Request$outboundSchema=Hp.LibrariesDocumentsGetStatusV1Request$inboundSchema=void 0;Hp.librariesDocumentsGetStatusV1RequestToJSON=aqo;Hp.librariesDocumentsGetStatusV1RequestFromJSON=sqo;var j9=oqo(Q()),eDr=le(),iqo=Z();Hp.LibrariesDocumentsGetStatusV1Request$inboundSchema=j9.object({library_id:j9.string(),document_id:j9.string()}).transform(t=>(0,eDr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Hp.LibrariesDocumentsGetStatusV1Request$outboundSchema=j9.object({libraryId:j9.string(),documentId:j9.string()}).transform(t=>(0,eDr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var Qjr;(function(t){t.inboundSchema=Hp.LibrariesDocumentsGetStatusV1Request$inboundSchema,t.outboundSchema=Hp.LibrariesDocumentsGetStatusV1Request$outboundSchema})(Qjr||(Hp.LibrariesDocumentsGetStatusV1Request$=Qjr={}));function aqo(t){return JSON.stringify(Hp.LibrariesDocumentsGetStatusV1Request$outboundSchema.parse(t))}function sqo(t){return(0,iqo.safeParse)(t,e=>Hp.LibrariesDocumentsGetStatusV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetStatusV1Request' from JSON")}});var oDr=S(Jp=>{"use strict";var uqo=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]}),lqo=Jp&&Jp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cqo=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"&&uqo(r,e,n[o]);return lqo(r,e),r}}();Object.defineProperty(Jp,"__esModule",{value:!0});Jp.LibrariesDocumentsGetTextContentV1Request$=Jp.LibrariesDocumentsGetTextContentV1Request$outboundSchema=Jp.LibrariesDocumentsGetTextContentV1Request$inboundSchema=void 0;Jp.librariesDocumentsGetTextContentV1RequestToJSON=fqo;Jp.librariesDocumentsGetTextContentV1RequestFromJSON=pqo;var D9=cqo(Q()),nDr=le(),dqo=Z();Jp.LibrariesDocumentsGetTextContentV1Request$inboundSchema=D9.object({library_id:D9.string(),document_id:D9.string()}).transform(t=>(0,nDr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Jp.LibrariesDocumentsGetTextContentV1Request$outboundSchema=D9.object({libraryId:D9.string(),documentId:D9.string()}).transform(t=>(0,nDr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var rDr;(function(t){t.inboundSchema=Jp.LibrariesDocumentsGetTextContentV1Request$inboundSchema,t.outboundSchema=Jp.LibrariesDocumentsGetTextContentV1Request$outboundSchema})(rDr||(Jp.LibrariesDocumentsGetTextContentV1Request$=rDr={}));function fqo(t){return JSON.stringify(Jp.LibrariesDocumentsGetTextContentV1Request$outboundSchema.parse(t))}function pqo(t){return(0,dqo.safeParse)(t,e=>Jp.LibrariesDocumentsGetTextContentV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetTextContentV1Request' from JSON")}});var sDr=S(Wp=>{"use strict";var mqo=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}),gqo=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"&&mqo(r,e,n[o]);return hqo(r,e),r}}();Object.defineProperty(Wp,"__esModule",{value:!0});Wp.LibrariesDocumentsGetV1Request$=Wp.LibrariesDocumentsGetV1Request$outboundSchema=Wp.LibrariesDocumentsGetV1Request$inboundSchema=void 0;Wp.librariesDocumentsGetV1RequestToJSON=bqo;Wp.librariesDocumentsGetV1RequestFromJSON=_qo;var $9=gqo(Q()),aDr=le(),yqo=Z();Wp.LibrariesDocumentsGetV1Request$inboundSchema=$9.object({library_id:$9.string(),document_id:$9.string()}).transform(t=>(0,aDr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Wp.LibrariesDocumentsGetV1Request$outboundSchema=$9.object({libraryId:$9.string(),documentId:$9.string()}).transform(t=>(0,aDr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var iDr;(function(t){t.inboundSchema=Wp.LibrariesDocumentsGetV1Request$inboundSchema,t.outboundSchema=Wp.LibrariesDocumentsGetV1Request$outboundSchema})(iDr||(Wp.LibrariesDocumentsGetV1Request$=iDr={}));function bqo(t){return JSON.stringify(Wp.LibrariesDocumentsGetV1Request$outboundSchema.parse(t))}function _qo(t){return(0,yqo.safeParse)(t,e=>Wp.LibrariesDocumentsGetV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetV1Request' from JSON")}});var cDr=S(Kp=>{"use strict";var vqo=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]}),wqo=Kp&&Kp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sqo=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"&&vqo(r,e,n[o]);return wqo(r,e),r}}();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.LibrariesDocumentsListV1Request$=Kp.LibrariesDocumentsListV1Request$outboundSchema=Kp.LibrariesDocumentsListV1Request$inboundSchema=void 0;Kp.librariesDocumentsListV1RequestToJSON=xqo;Kp.librariesDocumentsListV1RequestFromJSON=Oqo;var My=Sqo(Q()),lDr=le(),Cqo=Z();Kp.LibrariesDocumentsListV1Request$inboundSchema=My.object({library_id:My.string(),search:My.nullable(My.string()).optional(),page_size:My.number().int().default(100),page:My.number().int().default(0),sort_by:My.string().default("created_at"),sort_order:My.string().default("desc")}).transform(t=>(0,lDr.remap)(t,{library_id:"libraryId",page_size:"pageSize",sort_by:"sortBy",sort_order:"sortOrder"}));Kp.LibrariesDocumentsListV1Request$outboundSchema=My.object({libraryId:My.string(),search:My.nullable(My.string()).optional(),pageSize:My.number().int().default(100),page:My.number().int().default(0),sortBy:My.string().default("created_at"),sortOrder:My.string().default("desc")}).transform(t=>(0,lDr.remap)(t,{libraryId:"library_id",pageSize:"page_size",sortBy:"sort_by",sortOrder:"sort_order"}));var uDr;(function(t){t.inboundSchema=Kp.LibrariesDocumentsListV1Request$inboundSchema,t.outboundSchema=Kp.LibrariesDocumentsListV1Request$outboundSchema})(uDr||(Kp.LibrariesDocumentsListV1Request$=uDr={}));function xqo(t){return JSON.stringify(Kp.LibrariesDocumentsListV1Request$outboundSchema.parse(t))}function Oqo(t){return(0,Cqo.safeParse)(t,e=>Kp.LibrariesDocumentsListV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsListV1Request' from JSON")}});var pDr=S(Gp=>{"use strict";var Tqo=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]}),Eqo=Gp&&Gp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pqo=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"&&Tqo(r,e,n[o]);return Eqo(r,e),r}}();Object.defineProperty(Gp,"__esModule",{value:!0});Gp.LibrariesDocumentsReprocessV1Request$=Gp.LibrariesDocumentsReprocessV1Request$outboundSchema=Gp.LibrariesDocumentsReprocessV1Request$inboundSchema=void 0;Gp.librariesDocumentsReprocessV1RequestToJSON=Iqo;Gp.librariesDocumentsReprocessV1RequestFromJSON=Rqo;var L9=Pqo(Q()),fDr=le(),Mqo=Z();Gp.LibrariesDocumentsReprocessV1Request$inboundSchema=L9.object({library_id:L9.string(),document_id:L9.string()}).transform(t=>(0,fDr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Gp.LibrariesDocumentsReprocessV1Request$outboundSchema=L9.object({libraryId:L9.string(),documentId:L9.string()}).transform(t=>(0,fDr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var dDr;(function(t){t.inboundSchema=Gp.LibrariesDocumentsReprocessV1Request$inboundSchema,t.outboundSchema=Gp.LibrariesDocumentsReprocessV1Request$outboundSchema})(dDr||(Gp.LibrariesDocumentsReprocessV1Request$=dDr={}));function Iqo(t){return JSON.stringify(Gp.LibrariesDocumentsReprocessV1Request$outboundSchema.parse(t))}function Rqo(t){return(0,Mqo.safeParse)(t,e=>Gp.LibrariesDocumentsReprocessV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsReprocessV1Request' from JSON")}});var bDr=S(Xp=>{"use strict";var Aqo=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]}),Nqo=Xp&&Xp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hDr=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"&&Aqo(r,e,n[o]);return Nqo(r,e),r}}();Object.defineProperty(Xp,"__esModule",{value:!0});Xp.LibrariesDocumentsUpdateV1Request$=Xp.LibrariesDocumentsUpdateV1Request$outboundSchema=Xp.LibrariesDocumentsUpdateV1Request$inboundSchema=void 0;Xp.librariesDocumentsUpdateV1RequestToJSON=Dqo;Xp.librariesDocumentsUpdateV1RequestFromJSON=$qo;var F9=hDr(Q()),gDr=le(),jqo=Z(),yDr=hDr(kt());Xp.LibrariesDocumentsUpdateV1Request$inboundSchema=F9.object({library_id:F9.string(),document_id:F9.string(),DocumentUpdateIn:yDr.DocumentUpdateIn$inboundSchema}).transform(t=>(0,gDr.remap)(t,{library_id:"libraryId",document_id:"documentId",DocumentUpdateIn:"documentUpdateIn"}));Xp.LibrariesDocumentsUpdateV1Request$outboundSchema=F9.object({libraryId:F9.string(),documentId:F9.string(),documentUpdateIn:yDr.DocumentUpdateIn$outboundSchema}).transform(t=>(0,gDr.remap)(t,{libraryId:"library_id",documentId:"document_id",documentUpdateIn:"DocumentUpdateIn"}));var mDr;(function(t){t.inboundSchema=Xp.LibrariesDocumentsUpdateV1Request$inboundSchema,t.outboundSchema=Xp.LibrariesDocumentsUpdateV1Request$outboundSchema})(mDr||(Xp.LibrariesDocumentsUpdateV1Request$=mDr={}));function Dqo(t){return JSON.stringify(Xp.LibrariesDocumentsUpdateV1Request$outboundSchema.parse(t))}function $qo(t){return(0,jqo.safeParse)(t,e=>Xp.LibrariesDocumentsUpdateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUpdateV1Request' from JSON")}});var ODr=S(Ka=>{"use strict";var Lqo=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]}),Fqo=Ka&&Ka.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wDr=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"&&Lqo(r,e,n[o]);return Fqo(r,e),r}}();Object.defineProperty(Ka,"__esModule",{value:!0});Ka.LibrariesDocumentsUploadV1Request$=Ka.LibrariesDocumentsUploadV1Request$outboundSchema=Ka.LibrariesDocumentsUploadV1Request$inboundSchema=Ka.LibrariesDocumentsUploadV1DocumentUpload$=Ka.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema=Ka.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema=void 0;Ka.librariesDocumentsUploadV1DocumentUploadToJSON=qqo;Ka.librariesDocumentsUploadV1DocumentUploadFromJSON=Uqo;Ka.librariesDocumentsUploadV1RequestToJSON=Bqo;Ka.librariesDocumentsUploadV1RequestFromJSON=zqo;var hq=wDr(Q()),SDr=le(),CDr=Z(),kqo=rj(),xDr=wDr(kt());Ka.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema=hq.object({file:xDr.FileT$inboundSchema});Ka.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema=hq.object({file:xDr.FileT$outboundSchema.or(kqo.blobLikeSchema)});var _Dr;(function(t){t.inboundSchema=Ka.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema,t.outboundSchema=Ka.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema})(_Dr||(Ka.LibrariesDocumentsUploadV1DocumentUpload$=_Dr={}));function qqo(t){return JSON.stringify(Ka.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema.parse(t))}function Uqo(t){return(0,CDr.safeParse)(t,e=>Ka.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUploadV1DocumentUpload' from JSON")}Ka.LibrariesDocumentsUploadV1Request$inboundSchema=hq.object({library_id:hq.string(),RequestBody:hq.lazy(()=>Ka.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema)}).transform(t=>(0,SDr.remap)(t,{library_id:"libraryId",RequestBody:"requestBody"}));Ka.LibrariesDocumentsUploadV1Request$outboundSchema=hq.object({libraryId:hq.string(),requestBody:hq.lazy(()=>Ka.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema)}).transform(t=>(0,SDr.remap)(t,{libraryId:"library_id",requestBody:"RequestBody"}));var vDr;(function(t){t.inboundSchema=Ka.LibrariesDocumentsUploadV1Request$inboundSchema,t.outboundSchema=Ka.LibrariesDocumentsUploadV1Request$outboundSchema})(vDr||(Ka.LibrariesDocumentsUploadV1Request$=vDr={}));function Bqo(t){return JSON.stringify(Ka.LibrariesDocumentsUploadV1Request$outboundSchema.parse(t))}function zqo(t){return(0,CDr.safeParse)(t,e=>Ka.LibrariesDocumentsUploadV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUploadV1Request' from JSON")}});var PDr=S(Zp=>{"use strict";var Vqo=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]}),Hqo=Zp&&Zp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jqo=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"&&Vqo(r,e,n[o]);return Hqo(r,e),r}}();Object.defineProperty(Zp,"__esModule",{value:!0});Zp.LibrariesGetV1Request$=Zp.LibrariesGetV1Request$outboundSchema=Zp.LibrariesGetV1Request$inboundSchema=void 0;Zp.librariesGetV1RequestToJSON=Kqo;Zp.librariesGetV1RequestFromJSON=Gqo;var zRe=Jqo(Q()),EDr=le(),Wqo=Z();Zp.LibrariesGetV1Request$inboundSchema=zRe.object({library_id:zRe.string()}).transform(t=>(0,EDr.remap)(t,{library_id:"libraryId"}));Zp.LibrariesGetV1Request$outboundSchema=zRe.object({libraryId:zRe.string()}).transform(t=>(0,EDr.remap)(t,{libraryId:"library_id"}));var TDr;(function(t){t.inboundSchema=Zp.LibrariesGetV1Request$inboundSchema,t.outboundSchema=Zp.LibrariesGetV1Request$outboundSchema})(TDr||(Zp.LibrariesGetV1Request$=TDr={}));function Kqo(t){return JSON.stringify(Zp.LibrariesGetV1Request$outboundSchema.parse(t))}function Gqo(t){return(0,Wqo.safeParse)(t,e=>Zp.LibrariesGetV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesGetV1Request' from JSON")}});var NDr=S(Yp=>{"use strict";var Xqo=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]}),Zqo=Yp&&Yp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IDr=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"&&Xqo(r,e,n[o]);return Zqo(r,e),r}}();Object.defineProperty(Yp,"__esModule",{value:!0});Yp.LibrariesShareCreateV1Request$=Yp.LibrariesShareCreateV1Request$outboundSchema=Yp.LibrariesShareCreateV1Request$inboundSchema=void 0;Yp.librariesShareCreateV1RequestToJSON=Qqo;Yp.librariesShareCreateV1RequestFromJSON=eUo;var VRe=IDr(Q()),RDr=le(),Yqo=Z(),ADr=IDr(kt());Yp.LibrariesShareCreateV1Request$inboundSchema=VRe.object({library_id:VRe.string(),SharingIn:ADr.SharingIn$inboundSchema}).transform(t=>(0,RDr.remap)(t,{library_id:"libraryId",SharingIn:"sharingIn"}));Yp.LibrariesShareCreateV1Request$outboundSchema=VRe.object({libraryId:VRe.string(),sharingIn:ADr.SharingIn$outboundSchema}).transform(t=>(0,RDr.remap)(t,{libraryId:"library_id",sharingIn:"SharingIn"}));var MDr;(function(t){t.inboundSchema=Yp.LibrariesShareCreateV1Request$inboundSchema,t.outboundSchema=Yp.LibrariesShareCreateV1Request$outboundSchema})(MDr||(Yp.LibrariesShareCreateV1Request$=MDr={}));function Qqo(t){return JSON.stringify(Yp.LibrariesShareCreateV1Request$outboundSchema.parse(t))}function eUo(t){return(0,Yqo.safeParse)(t,e=>Yp.LibrariesShareCreateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareCreateV1Request' from JSON")}});var FDr=S(Qp=>{"use strict";var tUo=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]}),rUo=Qp&&Qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DDr=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"&&tUo(r,e,n[o]);return rUo(r,e),r}}();Object.defineProperty(Qp,"__esModule",{value:!0});Qp.LibrariesShareDeleteV1Request$=Qp.LibrariesShareDeleteV1Request$outboundSchema=Qp.LibrariesShareDeleteV1Request$inboundSchema=void 0;Qp.librariesShareDeleteV1RequestToJSON=oUo;Qp.librariesShareDeleteV1RequestFromJSON=iUo;var HRe=DDr(Q()),$Dr=le(),nUo=Z(),LDr=DDr(kt());Qp.LibrariesShareDeleteV1Request$inboundSchema=HRe.object({library_id:HRe.string(),SharingDelete:LDr.SharingDelete$inboundSchema}).transform(t=>(0,$Dr.remap)(t,{library_id:"libraryId",SharingDelete:"sharingDelete"}));Qp.LibrariesShareDeleteV1Request$outboundSchema=HRe.object({libraryId:HRe.string(),sharingDelete:LDr.SharingDelete$outboundSchema}).transform(t=>(0,$Dr.remap)(t,{libraryId:"library_id",sharingDelete:"SharingDelete"}));var jDr;(function(t){t.inboundSchema=Qp.LibrariesShareDeleteV1Request$inboundSchema,t.outboundSchema=Qp.LibrariesShareDeleteV1Request$outboundSchema})(jDr||(Qp.LibrariesShareDeleteV1Request$=jDr={}));function oUo(t){return JSON.stringify(Qp.LibrariesShareDeleteV1Request$outboundSchema.parse(t))}function iUo(t){return(0,nUo.safeParse)(t,e=>Qp.LibrariesShareDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareDeleteV1Request' from JSON")}});var UDr=S(em=>{"use strict";var aUo=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]}),sUo=em&&em.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uUo=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"&&aUo(r,e,n[o]);return sUo(r,e),r}}();Object.defineProperty(em,"__esModule",{value:!0});em.LibrariesShareListV1Request$=em.LibrariesShareListV1Request$outboundSchema=em.LibrariesShareListV1Request$inboundSchema=void 0;em.librariesShareListV1RequestToJSON=cUo;em.librariesShareListV1RequestFromJSON=dUo;var JRe=uUo(Q()),qDr=le(),lUo=Z();em.LibrariesShareListV1Request$inboundSchema=JRe.object({library_id:JRe.string()}).transform(t=>(0,qDr.remap)(t,{library_id:"libraryId"}));em.LibrariesShareListV1Request$outboundSchema=JRe.object({libraryId:JRe.string()}).transform(t=>(0,qDr.remap)(t,{libraryId:"library_id"}));var kDr;(function(t){t.inboundSchema=em.LibrariesShareListV1Request$inboundSchema,t.outboundSchema=em.LibrariesShareListV1Request$outboundSchema})(kDr||(em.LibrariesShareListV1Request$=kDr={}));function cUo(t){return JSON.stringify(em.LibrariesShareListV1Request$outboundSchema.parse(t))}function dUo(t){return(0,lUo.safeParse)(t,e=>em.LibrariesShareListV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareListV1Request' from JSON")}});var JDr=S(tm=>{"use strict";var fUo=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]}),pUo=tm&&tm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zDr=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"&&fUo(r,e,n[o]);return pUo(r,e),r}}();Object.defineProperty(tm,"__esModule",{value:!0});tm.LibrariesUpdateV1Request$=tm.LibrariesUpdateV1Request$outboundSchema=tm.LibrariesUpdateV1Request$inboundSchema=void 0;tm.librariesUpdateV1RequestToJSON=hUo;tm.librariesUpdateV1RequestFromJSON=gUo;var WRe=zDr(Q()),VDr=le(),mUo=Z(),HDr=zDr(kt());tm.LibrariesUpdateV1Request$inboundSchema=WRe.object({library_id:WRe.string(),LibraryInUpdate:HDr.LibraryInUpdate$inboundSchema}).transform(t=>(0,VDr.remap)(t,{library_id:"libraryId",LibraryInUpdate:"libraryInUpdate"}));tm.LibrariesUpdateV1Request$outboundSchema=WRe.object({libraryId:WRe.string(),libraryInUpdate:HDr.LibraryInUpdate$outboundSchema}).transform(t=>(0,VDr.remap)(t,{libraryId:"library_id",libraryInUpdate:"LibraryInUpdate"}));var BDr;(function(t){t.inboundSchema=tm.LibrariesUpdateV1Request$inboundSchema,t.outboundSchema=tm.LibrariesUpdateV1Request$outboundSchema})(BDr||(tm.LibrariesUpdateV1Request$=BDr={}));function hUo(t){return JSON.stringify(tm.LibrariesUpdateV1Request$outboundSchema.parse(t))}function gUo(t){return(0,mUo.safeParse)(t,e=>tm.LibrariesUpdateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesUpdateV1Request' from JSON")}});var YDr=S(Ns=>{"use strict";var yUo=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]}),bUo=Ns&&Ns.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GDr=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"&&yUo(r,e,n[o]);return bUo(r,e),r}}();Object.defineProperty(Ns,"__esModule",{value:!0});Ns.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=Ns.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=Ns.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=Ns.RetrieveModelV1ModelsModelIdGetRequest$=Ns.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=Ns.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;Ns.retrieveModelV1ModelsModelIdGetRequestToJSON=_Uo;Ns.retrieveModelV1ModelsModelIdGetRequestFromJSON=vUo;Ns.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=wUo;Ns.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=SUo;var k_=GDr(Q()),XDr=le(),ZDr=Z(),KRe=GDr(kt());Ns.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=k_.object({model_id:k_.string()}).transform(t=>(0,XDr.remap)(t,{model_id:"modelId"}));Ns.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=k_.object({modelId:k_.string()}).transform(t=>(0,XDr.remap)(t,{modelId:"model_id"}));var WDr;(function(t){t.inboundSchema=Ns.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=Ns.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(WDr||(Ns.RetrieveModelV1ModelsModelIdGetRequest$=WDr={}));function _Uo(t){return JSON.stringify(Ns.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function vUo(t){return(0,ZDr.safeParse)(t,e=>Ns.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}Ns.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=k_.union([KRe.FTModelCard$inboundSchema.and(k_.object({type:k_.literal("fine-tuned")}).transform(t=>({type:t.type}))),KRe.BaseModelCard$inboundSchema.and(k_.object({type:k_.literal("base")}).transform(t=>({type:t.type})))]);Ns.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=k_.union([KRe.FTModelCard$outboundSchema.and(k_.object({type:k_.literal("fine-tuned")}).transform(t=>({type:t.type}))),KRe.BaseModelCard$outboundSchema.and(k_.object({type:k_.literal("base")}).transform(t=>({type:t.type})))]);var KDr;(function(t){t.inboundSchema=Ns.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=Ns.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(KDr||(Ns.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=KDr={}));function wUo(t){return JSON.stringify(Ns.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function SUo(t){return(0,ZDr.safeParse)(t,e=>Ns.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var Xn=S(dn=>{"use strict";var CUo=dn&&dn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ro=dn&&dn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&CUo(e,t,r)};Object.defineProperty(dn,"__esModule",{value:!0});ro(TNr(),dn);ro(MNr(),dn);ro(jNr(),dn);ro(LNr(),dn);ro(BNr(),dn);ro(WNr(),dn);ro(QNr(),dn);ro(r1r(),dn);ro(u1r(),dn);ro(d1r(),dn);ro(g1r(),dn);ro(w1r(),dn);ro(x1r(),dn);ro(E1r(),dn);ro(I1r(),dn);ro(N1r(),dn);ro(L1r(),dn);ro(q1r(),dn);ro(V1r(),dn);ro(W1r(),dn);ro(X1r(),dn);ro(tjr(),dn);ro(ojr(),dn);ro(cjr(),dn);ro(hjr(),dn);ro(wjr(),dn);ro(Ojr(),dn);ro(Rjr(),dn);ro(jjr(),dn);ro(qjr(),dn);ro(zjr(),dn);ro(Jjr(),dn);ro(Gjr(),dn);ro(Yjr(),dn);ro(tDr(),dn);ro(oDr(),dn);ro(sDr(),dn);ro(cDr(),dn);ro(pDr(),dn);ro(bDr(),dn);ro(ODr(),dn);ro(PDr(),dn);ro(NDr(),dn);ro(FDr(),dn);ro(UDr(),dn);ro(JDr(),dn);ro(YDr(),dn)});var e$r=S(cj=>{"use strict";var xUo=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]}),OUo=cj&&cj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),slt=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"&&xUo(r,e,n[o]);return OUo(r,e),r}}();Object.defineProperty(cj,"__esModule",{value:!0});cj.batchJobsCancel=NUo;var TUo=wr(),GRe=slt(pr()),EUo=le(),PUo=Z(),QDr=mr(),MUo=cr(),IUo=slt(kt()),RUo=slt(Xn()),AUo=hr();function NUo(t,e,r){return new AUo.APIPromise(jUo(t,e,r))}async function jUo(t,e,r){let n=(0,PUo.safeParse)(e,b=>RUo.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,TUo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,MUo.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,EUo.compactMap)({Accept:"application/json"})),l=await(0,QDr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,QDr.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 GRe.match(GRe.json(200,IUo.BatchJobOut$inboundSchema),GRe.fail("4XX"),GRe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var o$r=S(dj=>{"use strict";var DUo=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]}),$Uo=dj&&dj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n$r=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"&&DUo(r,e,n[o]);return $Uo(r,e),r}}();Object.defineProperty(dj,"__esModule",{value:!0});dj.batchJobsCreate=BUo;var LUo=wr(),XRe=n$r(pr()),FUo=le(),kUo=Z(),t$r=mr(),qUo=cr(),r$r=n$r(kt()),UUo=hr();function BUo(t,e,r){return new UUo.APIPromise(zUo(t,e,r))}async function zUo(t,e,r){let n=(0,kUo.safeParse)(e,g=>r$r.BatchJobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,LUo.encodeJSON)("body",o,{explode:!0}),a=(0,qUo.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,FUo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,t$r.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,t$r.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 XRe.match(XRe.json(200,r$r.BatchJobOut$inboundSchema),XRe.fail("4XX"),XRe.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var a$r=S(fj=>{"use strict";var VUo=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]}),HUo=fj&&fj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ult=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"&&VUo(r,e,n[o]);return HUo(r,e),r}}();Object.defineProperty(fj,"__esModule",{value:!0});fj.batchJobsGet=QUo;var JUo=wr(),ZRe=ult(pr()),WUo=le(),KUo=Z(),i$r=mr(),GUo=cr(),XUo=ult(kt()),ZUo=ult(Xn()),YUo=hr();function QUo(t,e,r){return new YUo.APIPromise(eBo(t,e,r))}async function eBo(t,e,r){let n=(0,KUo.safeParse)(e,b=>ZUo.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,JUo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,GUo.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,WUo.compactMap)({Accept:"application/json"})),l=await(0,i$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,i$r.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 ZRe.match(ZRe.json(200,XUo.BatchJobOut$inboundSchema),ZRe.fail("4XX"),ZRe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var u$r=S(pj=>{"use strict";var tBo=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]}),rBo=pj&&pj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),llt=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"&&tBo(r,e,n[o]);return rBo(r,e),r}}();Object.defineProperty(pj,"__esModule",{value:!0});pj.batchJobsList=cBo;var nBo=wr(),YRe=llt(pr()),oBo=le(),iBo=Z(),s$r=mr(),aBo=cr(),sBo=llt(kt()),uBo=llt(Xn()),lBo=hr();function cBo(t,e,r){return new lBo.APIPromise(dBo(t,e,r))}async function dBo(t,e,r){let n=(0,iBo.safeParse)(e,b=>uBo.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,aBo.pathToFunc)("/v1/batch/jobs")(),s=(0,nBo.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,oBo.compactMap)({Accept:"application/json"})),l=await(0,s$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,s$r.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 YRe.match(YRe.json(200,sBo.BatchJobsOut$inboundSchema),YRe.fail("4XX"),YRe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var l$r=S(eAe=>{"use strict";Object.defineProperty(eAe,"__esModule",{value:!0});eAe.MistralJobs=void 0;var fBo=e$r(),pBo=o$r(),mBo=a$r(),hBo=u$r(),gBo=Rc(),QRe=vd(),clt=class extends gBo.ClientSDK{async list(e,r){return(0,QRe.unwrapAsync)((0,hBo.batchJobsList)(this,e,r))}async create(e,r){return(0,QRe.unwrapAsync)((0,pBo.batchJobsCreate)(this,e,r))}async get(e,r){return(0,QRe.unwrapAsync)((0,mBo.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,QRe.unwrapAsync)((0,fBo.batchJobsCancel)(this,e,r))}};eAe.MistralJobs=clt});var c$r=S(tAe=>{"use strict";Object.defineProperty(tAe,"__esModule",{value:!0});tAe.Batch=void 0;var yBo=Rc(),bBo=l$r(),dlt=class extends yBo.ClientSDK{get jobs(){return this._jobs??(this._jobs=new bBo.MistralJobs(this._options))}};tAe.Batch=dlt});var p$r=S(mj=>{"use strict";var _Bo=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]}),vBo=mj&&mj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rAe=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"&&_Bo(r,e,n[o]);return vBo(r,e),r}}();Object.defineProperty(mj,"__esModule",{value:!0});mj.betaConversationsAppend=PBo;var d$r=wr(),Gae=rAe(pr()),wBo=le(),SBo=Z(),f$r=mr(),CBo=cr(),xBo=rAe(kt()),OBo=rAe(Gn()),TBo=rAe(Xn()),EBo=hr();function PBo(t,e,r){return new EBo.APIPromise(MBo(t,e,r))}async function MBo(t,e,r){let n=(0,SBo.safeParse)(e,_=>TBo.AgentsApiV1ConversationsAppendRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,d$r.encodeJSON)("body",o.ConversationAppendRequest,{explode:!0}),a={conversation_id:(0,d$r.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,CBo.pathToFunc)("/v1/conversations/{conversation_id}")(a),u=new Headers((0,wBo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,f$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,f$r.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 Gae.match(Gae.json(200,xBo.ConversationResponse$inboundSchema),Gae.jsonErr(422,OBo.HTTPValidationError$inboundSchema),Gae.fail("4XX"),Gae.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var g$r=S(hj=>{"use strict";var IBo=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]}),RBo=hj&&hj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zae=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"&&IBo(r,e,n[o]);return RBo(r,e),r}}();Object.defineProperty(hj,"__esModule",{value:!0});hj.betaConversationsAppendStream=UBo;var ABo=Zae(Q()),m$r=wr(),NBo=pq(),Xae=Zae(pr()),jBo=le(),DBo=Z(),h$r=mr(),$Bo=cr(),LBo=Zae(kt()),FBo=Zae(Gn()),kBo=Zae(Xn()),qBo=hr();function UBo(t,e,r){return new qBo.APIPromise(BBo(t,e,r))}async function BBo(t,e,r){let n=(0,DBo.safeParse)(e,_=>kBo.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,m$r.encodeJSON)("body",o.ConversationAppendStreamRequest,{explode:!0}),a={conversation_id:(0,m$r.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,$Bo.pathToFunc)("/v1/conversations/{conversation_id}#stream")(a),u=new Headers((0,jBo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),l=await(0,h$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,h$r.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 Xae.match(Xae.sse(200,ABo.instanceof(ReadableStream).transform(_=>new NBo.EventStream(_,w=>({value:LBo.ConversationEvents$inboundSchema.parse(w)})))),Xae.jsonErr(422,FBo.HTTPValidationError$inboundSchema),Xae.fail("4XX"),Xae.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var _$r=S(gj=>{"use strict";var zBo=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]}),VBo=gj&&gj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),flt=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"&&zBo(r,e,n[o]);return VBo(r,e),r}}();Object.defineProperty(gj,"__esModule",{value:!0});gj.betaConversationsGet=ZBo;var HBo=wr(),Yae=flt(pr()),JBo=le(),WBo=Z(),y$r=mr(),KBo=cr(),GBo=flt(Gn()),b$r=flt(Xn()),XBo=hr();function ZBo(t,e,r){return new XBo.APIPromise(YBo(t,e,r))}async function YBo(t,e,r){let n=(0,WBo.safeParse)(e,_=>b$r.AgentsApiV1ConversationsGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,HBo.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,KBo.pathToFunc)("/v1/conversations/{conversation_id}")(a),u=new Headers((0,JBo.compactMap)({Accept:"application/json"})),l=await(0,y$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,y$r.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 Yae.match(Yae.json(200,b$r.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema),Yae.jsonErr(422,GBo.HTTPValidationError$inboundSchema),Yae.fail("4XX"),Yae.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var w$r=S(yj=>{"use strict";var QBo=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]}),ezo=yj&&yj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nAe=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"&&QBo(r,e,n[o]);return ezo(r,e),r}}();Object.defineProperty(yj,"__esModule",{value:!0});yj.betaConversationsGetHistory=lzo;var tzo=wr(),Qae=nAe(pr()),rzo=le(),nzo=Z(),v$r=mr(),ozo=cr(),izo=nAe(kt()),azo=nAe(Gn()),szo=nAe(Xn()),uzo=hr();function lzo(t,e,r){return new uzo.APIPromise(czo(t,e,r))}async function czo(t,e,r){let n=(0,nzo.safeParse)(e,_=>szo.AgentsApiV1ConversationsHistoryRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,tzo.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,ozo.pathToFunc)("/v1/conversations/{conversation_id}/history")(a),u=new Headers((0,rzo.compactMap)({Accept:"application/json"})),l=await(0,v$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,v$r.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 Qae.match(Qae.json(200,izo.ConversationHistory$inboundSchema),Qae.jsonErr(422,azo.HTTPValidationError$inboundSchema),Qae.fail("4XX"),Qae.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var C$r=S(bj=>{"use strict";var dzo=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]}),fzo=bj&&bj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oAe=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"&&dzo(r,e,n[o]);return fzo(r,e),r}}();Object.defineProperty(bj,"__esModule",{value:!0});bj.betaConversationsGetMessages=wzo;var pzo=wr(),ese=oAe(pr()),mzo=le(),hzo=Z(),S$r=mr(),gzo=cr(),yzo=oAe(kt()),bzo=oAe(Gn()),_zo=oAe(Xn()),vzo=hr();function wzo(t,e,r){return new vzo.APIPromise(Szo(t,e,r))}async function Szo(t,e,r){let n=(0,hzo.safeParse)(e,_=>_zo.AgentsApiV1ConversationsMessagesRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,pzo.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,gzo.pathToFunc)("/v1/conversations/{conversation_id}/messages")(a),u=new Headers((0,mzo.compactMap)({Accept:"application/json"})),l=await(0,S$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,S$r.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 ese.match(ese.json(200,yzo.ConversationMessages$inboundSchema),ese.jsonErr(422,bzo.HTTPValidationError$inboundSchema),ese.fail("4XX"),ese.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var T$r=S(_j=>{"use strict";var Czo=_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]}),xzo=_j&&_j.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iAe=_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"&&Czo(r,e,n[o]);return xzo(r,e),r}}();Object.defineProperty(_j,"__esModule",{value:!0});_j.betaConversationsList=Azo;var Ozo=iAe(Q()),Tzo=wr(),tse=iAe(pr()),Ezo=le(),Pzo=Z(),x$r=mr(),Mzo=cr(),Izo=iAe(Gn()),O$r=iAe(Xn()),Rzo=hr();function Azo(t,e,r){return new Rzo.APIPromise(Nzo(t,e,r))}async function Nzo(t,e,r){let n=(0,Pzo.safeParse)(e,_=>O$r.AgentsApiV1ConversationsListRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,Mzo.pathToFunc)("/v1/conversations")(),s=(0,Tzo.encodeFormQuery)({page:o?.page,page_size:o?.page_size}),u=new Headers((0,Ezo.compactMap)({Accept:"application/json"})),l=await(0,x$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,x$r.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 tse.match(tse.json(200,Ozo.array(O$r.ResponseBody$inboundSchema)),tse.jsonErr(422,Izo.HTTPValidationError$inboundSchema),tse.fail("4XX"),tse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var M$r=S(vj=>{"use strict";var jzo=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]}),Dzo=vj&&vj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aAe=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"&&jzo(r,e,n[o]);return Dzo(r,e),r}}();Object.defineProperty(vj,"__esModule",{value:!0});vj.betaConversationsRestart=zzo;var E$r=wr(),rse=aAe(pr()),$zo=le(),Lzo=Z(),P$r=mr(),Fzo=cr(),kzo=aAe(kt()),qzo=aAe(Gn()),Uzo=aAe(Xn()),Bzo=hr();function zzo(t,e,r){return new Bzo.APIPromise(Vzo(t,e,r))}async function Vzo(t,e,r){let n=(0,Lzo.safeParse)(e,_=>Uzo.AgentsApiV1ConversationsRestartRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,E$r.encodeJSON)("body",o.ConversationRestartRequest,{explode:!0}),a={conversation_id:(0,E$r.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,Fzo.pathToFunc)("/v1/conversations/{conversation_id}/restart")(a),u=new Headers((0,$zo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,P$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,P$r.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 rse.match(rse.json(200,kzo.ConversationResponse$inboundSchema),rse.jsonErr(422,qzo.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 A$r=S(wj=>{"use strict";var Hzo=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]}),Jzo=wj&&wj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ose=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"&&Hzo(r,e,n[o]);return Jzo(r,e),r}}();Object.defineProperty(wj,"__esModule",{value:!0});wj.betaConversationsRestartStream=r4o;var Wzo=ose(Q()),I$r=wr(),Kzo=pq(),nse=ose(pr()),Gzo=le(),Xzo=Z(),R$r=mr(),Zzo=cr(),Yzo=ose(kt()),Qzo=ose(Gn()),e4o=ose(Xn()),t4o=hr();function r4o(t,e,r){return new t4o.APIPromise(n4o(t,e,r))}async function n4o(t,e,r){let n=(0,Xzo.safeParse)(e,_=>e4o.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,I$r.encodeJSON)("body",o.ConversationRestartStreamRequest,{explode:!0}),a={conversation_id:(0,I$r.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,Zzo.pathToFunc)("/v1/conversations/{conversation_id}/restart#stream")(a),u=new Headers((0,Gzo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),l=await(0,R$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,R$r.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 nse.match(nse.sse(200,Wzo.instanceof(ReadableStream).transform(_=>new Kzo.EventStream(_,w=>({value:Yzo.ConversationEvents$inboundSchema.parse(w)})))),nse.jsonErr(422,Qzo.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 D$r=S(Sj=>{"use strict";var o4o=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]}),i4o=Sj&&Sj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),plt=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"&&o4o(r,e,n[o]);return i4o(r,e),r}}();Object.defineProperty(Sj,"__esModule",{value:!0});Sj.betaConversationsStart=f4o;var a4o=wr(),ise=plt(pr()),s4o=le(),u4o=Z(),N$r=mr(),l4o=cr(),j$r=plt(kt()),c4o=plt(Gn()),d4o=hr();function f4o(t,e,r){return new d4o.APIPromise(p4o(t,e,r))}async function p4o(t,e,r){let n=(0,u4o.safeParse)(e,b=>j$r.ConversationRequest$outboundSchema.parse(b),"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/conversations")(),s=new Headers((0,s4o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,N$r.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,N$r.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 ise.match(ise.json(200,j$r.ConversationResponse$inboundSchema),ise.jsonErr(422,c4o.HTTPValidationError$inboundSchema),ise.fail("4XX"),ise.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var F$r=S(Cj=>{"use strict";var m4o=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]}),h4o=Cj&&Cj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sAe=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"&&m4o(r,e,n[o]);return h4o(r,e),r}}();Object.defineProperty(Cj,"__esModule",{value:!0});Cj.betaConversationsStartStream=x4o;var g4o=sAe(Q()),y4o=wr(),b4o=pq(),ase=sAe(pr()),_4o=le(),v4o=Z(),$$r=mr(),w4o=cr(),L$r=sAe(kt()),S4o=sAe(Gn()),C4o=hr();function x4o(t,e,r){return new C4o.APIPromise(O4o(t,e,r))}async function O4o(t,e,r){let n=(0,v4o.safeParse)(e,b=>L$r.ConversationStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,y4o.encodeJSON)("body",o,{explode:!0}),a=(0,w4o.pathToFunc)("/v1/conversations#stream")(),s=new Headers((0,_4o.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,$$r.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,$$r.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 ase.match(ase.sse(200,g4o.instanceof(ReadableStream).transform(b=>new b4o.EventStream(b,_=>({value:L$r.ConversationEvents$inboundSchema.parse(_)})))),ase.jsonErr(422,S4o.HTTPValidationError$inboundSchema),ase.fail("4XX"),ase.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var k$r=S(uAe=>{"use strict";Object.defineProperty(uAe,"__esModule",{value:!0});uAe.Conversations=void 0;var T4o=p$r(),E4o=g$r(),P4o=_$r(),M4o=w$r(),I4o=C$r(),R4o=T$r(),A4o=M$r(),N4o=A$r(),j4o=D$r(),D4o=F$r(),$4o=Rc(),KR=vd(),mlt=class extends $4o.ClientSDK{async start(e,r){return(0,KR.unwrapAsync)((0,j4o.betaConversationsStart)(this,e,r))}async list(e,r){return(0,KR.unwrapAsync)((0,R4o.betaConversationsList)(this,e,r))}async get(e,r){return(0,KR.unwrapAsync)((0,P4o.betaConversationsGet)(this,e,r))}async append(e,r){return(0,KR.unwrapAsync)((0,T4o.betaConversationsAppend)(this,e,r))}async getHistory(e,r){return(0,KR.unwrapAsync)((0,M4o.betaConversationsGetHistory)(this,e,r))}async getMessages(e,r){return(0,KR.unwrapAsync)((0,I4o.betaConversationsGetMessages)(this,e,r))}async restart(e,r){return(0,KR.unwrapAsync)((0,A4o.betaConversationsRestart)(this,e,r))}async startStream(e,r){return(0,KR.unwrapAsync)((0,D4o.betaConversationsStartStream)(this,e,r))}async appendStream(e,r){return(0,KR.unwrapAsync)((0,E4o.betaConversationsAppendStream)(this,e,r))}async restartStream(e,r){return(0,KR.unwrapAsync)((0,N4o.betaConversationsRestartStream)(this,e,r))}};uAe.Conversations=mlt});var B$r=S(xj=>{"use strict";var L4o=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]}),F4o=xj&&xj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hlt=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"&&L4o(r,e,n[o]);return F4o(r,e),r}}();Object.defineProperty(xj,"__esModule",{value:!0});xj.betaLibrariesCreate=H4o;var k4o=wr(),sse=hlt(pr()),q4o=le(),U4o=Z(),q$r=mr(),B4o=cr(),U$r=hlt(kt()),z4o=hlt(Gn()),V4o=hr();function H4o(t,e,r){return new V4o.APIPromise(J4o(t,e,r))}async function J4o(t,e,r){let n=(0,U4o.safeParse)(e,b=>U$r.LibraryIn$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,k4o.encodeJSON)("body",o,{explode:!0}),a=(0,B4o.pathToFunc)("/v1/libraries")(),s=new Headers((0,q4o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,q$r.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,q$r.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 sse.match(sse.json(201,U$r.LibraryOut$inboundSchema),sse.jsonErr(422,z4o.HTTPValidationError$inboundSchema),sse.fail("4XX"),sse.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var V$r=S(Oj=>{"use strict";var W4o=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]}),K4o=Oj&&Oj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lAe=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"&&W4o(r,e,n[o]);return K4o(r,e),r}}();Object.defineProperty(Oj,"__esModule",{value:!0});Oj.betaLibrariesDelete=n2o;var G4o=wr(),use=lAe(pr()),X4o=le(),Z4o=Z(),z$r=mr(),Y4o=cr(),Q4o=lAe(kt()),e2o=lAe(Gn()),t2o=lAe(Xn()),r2o=hr();function n2o(t,e,r){return new r2o.APIPromise(o2o(t,e,r))}async function o2o(t,e,r){let n=(0,Z4o.safeParse)(e,_=>t2o.LibrariesDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,G4o.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,Y4o.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,X4o.compactMap)({Accept:"application/json"})),l=await(0,z$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,z$r.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,Q4o.LibraryOut$inboundSchema),use.jsonErr(422,e2o.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 J$r=S(Tj=>{"use strict";var i2o=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]}),a2o=Tj&&Tj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cAe=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"&&i2o(r,e,n[o]);return a2o(r,e),r}}();Object.defineProperty(Tj,"__esModule",{value:!0});Tj.betaLibrariesGet=h2o;var s2o=wr(),lse=cAe(pr()),u2o=le(),l2o=Z(),H$r=mr(),c2o=cr(),d2o=cAe(kt()),f2o=cAe(Gn()),p2o=cAe(Xn()),m2o=hr();function h2o(t,e,r){return new m2o.APIPromise(g2o(t,e,r))}async function g2o(t,e,r){let n=(0,l2o.safeParse)(e,_=>p2o.LibrariesGetV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,s2o.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,c2o.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,u2o.compactMap)({Accept:"application/json"})),l=await(0,H$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,H$r.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 lse.match(lse.json(200,d2o.LibraryOut$inboundSchema),lse.jsonErr(422,f2o.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 G$r=S(Ej=>{"use strict";var y2o=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]}),b2o=Ej&&Ej.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K$r=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"&&y2o(r,e,n[o]);return b2o(r,e),r}}();Object.defineProperty(Ej,"__esModule",{value:!0});Ej.betaLibrariesList=C2o;var dAe=K$r(pr()),_2o=le(),W$r=mr(),v2o=cr(),w2o=K$r(kt()),S2o=hr();function C2o(t,e){return new S2o.APIPromise(x2o(t,e))}async function x2o(t,e){let r=(0,v2o.pathToFunc)("/v1/libraries")(),n=new Headers((0,_2o.compactMap)({Accept:"application/json"})),o=await(0,W$r.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,W$r.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 dAe.match(dAe.json(200,w2o.ListLibraryOut$inboundSchema),dAe.fail("4XX"),dAe.fail("5XX"))(d,l);return f.ok?[f,{status:"complete",request:l,response:d}]:[f,{status:"complete",request:l,response:d}]}});var Y$r=S(Pj=>{"use strict";var O2o=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]}),T2o=Pj&&Pj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fAe=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"&&O2o(r,e,n[o]);return T2o(r,e),r}}();Object.defineProperty(Pj,"__esModule",{value:!0});Pj.betaLibrariesUpdate=j2o;var X$r=wr(),cse=fAe(pr()),E2o=le(),P2o=Z(),Z$r=mr(),M2o=cr(),I2o=fAe(kt()),R2o=fAe(Gn()),A2o=fAe(Xn()),N2o=hr();function j2o(t,e,r){return new N2o.APIPromise(D2o(t,e,r))}async function D2o(t,e,r){let n=(0,P2o.safeParse)(e,_=>A2o.LibrariesUpdateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,X$r.encodeJSON)("body",o.LibraryInUpdate,{explode:!0}),a={library_id:(0,X$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,M2o.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,E2o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,Z$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Z$r.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 cse.match(cse.json(200,I2o.LibraryOut$inboundSchema),cse.jsonErr(422,R2o.HTTPValidationError$inboundSchema),cse.fail("4XX"),cse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var tLr=S(Mj=>{"use strict";var $2o=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]}),L2o=Mj&&Mj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pAe=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"&&$2o(r,e,n[o]);return L2o(r,e),r}}();Object.defineProperty(Mj,"__esModule",{value:!0});Mj.betaLibrariesAccessesDelete=H2o;var Q$r=wr(),dse=pAe(pr()),F2o=le(),k2o=Z(),eLr=mr(),q2o=cr(),U2o=pAe(kt()),B2o=pAe(Gn()),z2o=pAe(Xn()),V2o=hr();function H2o(t,e,r){return new V2o.APIPromise(J2o(t,e,r))}async function J2o(t,e,r){let n=(0,k2o.safeParse)(e,_=>z2o.LibrariesShareDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,Q$r.encodeJSON)("body",o.SharingDelete,{explode:!0}),a={library_id:(0,Q$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,q2o.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,F2o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,eLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,eLr.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 dse.match(dse.json(200,U2o.SharingOut$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 nLr=S(Ij=>{"use strict";var W2o=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]}),K2o=Ij&&Ij.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mAe=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"&&W2o(r,e,n[o]);return K2o(r,e),r}}();Object.defineProperty(Ij,"__esModule",{value:!0});Ij.betaLibrariesAccessesList=nVo;var G2o=wr(),fse=mAe(pr()),X2o=le(),Z2o=Z(),rLr=mr(),Y2o=cr(),Q2o=mAe(kt()),eVo=mAe(Gn()),tVo=mAe(Xn()),rVo=hr();function nVo(t,e,r){return new rVo.APIPromise(oVo(t,e,r))}async function oVo(t,e,r){let n=(0,Z2o.safeParse)(e,_=>tVo.LibrariesShareListV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,G2o.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,Y2o.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,X2o.compactMap)({Accept:"application/json"})),l=await(0,rLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,rLr.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 fse.match(fse.json(200,Q2o.ListSharingOut$inboundSchema),fse.jsonErr(422,eVo.HTTPValidationError$inboundSchema),fse.fail("4XX"),fse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var aLr=S(Rj=>{"use strict";var iVo=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]}),aVo=Rj&&Rj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hAe=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"&&iVo(r,e,n[o]);return aVo(r,e),r}}();Object.defineProperty(Rj,"__esModule",{value:!0});Rj.betaLibrariesAccessesUpdateOrCreate=mVo;var oLr=wr(),pse=hAe(pr()),sVo=le(),uVo=Z(),iLr=mr(),lVo=cr(),cVo=hAe(kt()),dVo=hAe(Gn()),fVo=hAe(Xn()),pVo=hr();function mVo(t,e,r){return new pVo.APIPromise(hVo(t,e,r))}async function hVo(t,e,r){let n=(0,uVo.safeParse)(e,_=>fVo.LibrariesShareCreateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,oLr.encodeJSON)("body",o.SharingIn,{explode:!0}),a={library_id:(0,oLr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,lVo.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,sVo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,iLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,iLr.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 pse.match(pse.json(200,cVo.SharingOut$inboundSchema),pse.jsonErr(422,dVo.HTTPValidationError$inboundSchema),pse.fail("4XX"),pse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var sLr=S(gAe=>{"use strict";Object.defineProperty(gAe,"__esModule",{value:!0});gAe.Accesses=void 0;var gVo=tLr(),yVo=nLr(),bVo=aLr(),_Vo=Rc(),glt=vd(),ylt=class extends _Vo.ClientSDK{async list(e,r){return(0,glt.unwrapAsync)((0,yVo.betaLibrariesAccessesList)(this,e,r))}async updateOrCreate(e,r){return(0,glt.unwrapAsync)((0,bVo.betaLibrariesAccessesUpdateOrCreate)(this,e,r))}async delete(e,r){return(0,glt.unwrapAsync)((0,gVo.betaLibrariesAccessesDelete)(this,e,r))}};gAe.Accesses=ylt});var cLr=S(Aj=>{"use strict";var vVo=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]}),wVo=Aj&&Aj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yAe=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"&&vVo(r,e,n[o]);return wVo(r,e),r}}();Object.defineProperty(Aj,"__esModule",{value:!0});Aj.betaLibrariesDocumentsDelete=MVo;var SVo=yAe(Q()),uLr=wr(),mse=yAe(pr()),CVo=le(),xVo=Z(),lLr=mr(),OVo=cr(),TVo=yAe(Gn()),EVo=yAe(Xn()),PVo=hr();function MVo(t,e,r){return new PVo.APIPromise(IVo(t,e,r))}async function IVo(t,e,r){let n=(0,xVo.safeParse)(e,_=>EVo.LibrariesDocumentsDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,uLr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,uLr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,OVo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,CVo.compactMap)({Accept:"application/json"})),l=await(0,lLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,lLr.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 mse.match(mse.nil(204,SVo.void()),mse.jsonErr(422,TVo.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 pLr=S(Nj=>{"use strict";var RVo=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]}),AVo=Nj&&Nj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bAe=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"&&RVo(r,e,n[o]);return AVo(r,e),r}}();Object.defineProperty(Nj,"__esModule",{value:!0});Nj.betaLibrariesDocumentsExtractedTextSignedUrl=qVo;var NVo=bAe(Q()),dLr=wr(),hse=bAe(pr()),jVo=le(),DVo=Z(),fLr=mr(),$Vo=cr(),LVo=bAe(Gn()),FVo=bAe(Xn()),kVo=hr();function qVo(t,e,r){return new kVo.APIPromise(UVo(t,e,r))}async function UVo(t,e,r){let n=(0,DVo.safeParse)(e,_=>FVo.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,dLr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,dLr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,$Vo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/extracted-text-signed-url")(a),u=new Headers((0,jVo.compactMap)({Accept:"application/json"})),l=await(0,fLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,fLr.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 hse.match(hse.json(200,NVo.string()),hse.jsonErr(422,LVo.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 gLr=S(jj=>{"use strict";var BVo=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]}),zVo=jj&&jj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Ae=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"&&BVo(r,e,n[o]);return zVo(r,e),r}}();Object.defineProperty(jj,"__esModule",{value:!0});jj.betaLibrariesDocumentsGet=ZVo;var mLr=wr(),gse=_Ae(pr()),VVo=le(),HVo=Z(),hLr=mr(),JVo=cr(),WVo=_Ae(kt()),KVo=_Ae(Gn()),GVo=_Ae(Xn()),XVo=hr();function ZVo(t,e,r){return new XVo.APIPromise(YVo(t,e,r))}async function YVo(t,e,r){let n=(0,HVo.safeParse)(e,_=>GVo.LibrariesDocumentsGetV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,mLr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,mLr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,JVo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,VVo.compactMap)({Accept:"application/json"})),l=await(0,hLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,hLr.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 gse.match(gse.json(200,WVo.DocumentOut$inboundSchema),gse.jsonErr(422,KVo.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 _Lr=S(Dj=>{"use strict";var QVo=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]}),eHo=Dj&&Dj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vAe=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"&&QVo(r,e,n[o]);return eHo(r,e),r}}();Object.defineProperty(Dj,"__esModule",{value:!0});Dj.betaLibrariesDocumentsGetSignedUrl=uHo;var tHo=vAe(Q()),yLr=wr(),yse=vAe(pr()),rHo=le(),nHo=Z(),bLr=mr(),oHo=cr(),iHo=vAe(Gn()),aHo=vAe(Xn()),sHo=hr();function uHo(t,e,r){return new sHo.APIPromise(lHo(t,e,r))}async function lHo(t,e,r){let n=(0,nHo.safeParse)(e,_=>aHo.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,yLr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,yLr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,oHo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/signed-url")(a),u=new Headers((0,rHo.compactMap)({Accept:"application/json"})),l=await(0,bLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,bLr.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 yse.match(yse.json(200,tHo.string()),yse.jsonErr(422,iHo.HTTPValidationError$inboundSchema),yse.fail("4XX"),yse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var SLr=S($j=>{"use strict";var cHo=$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]}),dHo=$j&&$j.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wAe=$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"&&cHo(r,e,n[o]);return dHo(r,e),r}}();Object.defineProperty($j,"__esModule",{value:!0});$j.betaLibrariesDocumentsList=_Ho;var vLr=wr(),bse=wAe(pr()),fHo=le(),pHo=Z(),wLr=mr(),mHo=cr(),hHo=wAe(kt()),gHo=wAe(Gn()),yHo=wAe(Xn()),bHo=hr();function _Ho(t,e,r){return new bHo.APIPromise(vHo(t,e,r))}async function vHo(t,e,r){let n=(0,pHo.safeParse)(e,w=>yHo.LibrariesDocumentsListV1Request$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,vLr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,mHo.pathToFunc)("/v1/libraries/{library_id}/documents")(a),u=(0,vLr.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,fHo.compactMap)({Accept:"application/json"})),c=await(0,wLr.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,wLr.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 bse.match(bse.json(200,hHo.ListDocumentOut$inboundSchema),bse.jsonErr(422,gHo.HTTPValidationError$inboundSchema),bse.fail("4XX"),bse.fail("5XX"))(g,h,{extraFields:b});return _.ok?[_,{status:"complete",request:h,response:g}]:[_,{status:"complete",request:h,response:g}]}});var OLr=S(Lj=>{"use strict";var wHo=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]}),SHo=Lj&&Lj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SAe=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"&&wHo(r,e,n[o]);return SHo(r,e),r}}();Object.defineProperty(Lj,"__esModule",{value:!0});Lj.betaLibrariesDocumentsReprocess=IHo;var CHo=SAe(Q()),CLr=wr(),_se=SAe(pr()),xHo=le(),OHo=Z(),xLr=mr(),THo=cr(),EHo=SAe(Gn()),PHo=SAe(Xn()),MHo=hr();function IHo(t,e,r){return new MHo.APIPromise(RHo(t,e,r))}async function RHo(t,e,r){let n=(0,OHo.safeParse)(e,_=>PHo.LibrariesDocumentsReprocessV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,CLr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,CLr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,THo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/reprocess")(a),u=new Headers((0,xHo.compactMap)({Accept:"application/json"})),l=await(0,xLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,xLr.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 _se.match(_se.nil(204,CHo.void()),_se.jsonErr(422,EHo.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 PLr=S(Fj=>{"use strict";var AHo=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]}),NHo=Fj&&Fj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CAe=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"&&AHo(r,e,n[o]);return NHo(r,e),r}}();Object.defineProperty(Fj,"__esModule",{value:!0});Fj.betaLibrariesDocumentsStatus=UHo;var TLr=wr(),vse=CAe(pr()),jHo=le(),DHo=Z(),ELr=mr(),$Ho=cr(),LHo=CAe(kt()),FHo=CAe(Gn()),kHo=CAe(Xn()),qHo=hr();function UHo(t,e,r){return new qHo.APIPromise(BHo(t,e,r))}async function BHo(t,e,r){let n=(0,DHo.safeParse)(e,_=>kHo.LibrariesDocumentsGetStatusV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,TLr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,TLr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,$Ho.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/status")(a),u=new Headers((0,jHo.compactMap)({Accept:"application/json"})),l=await(0,ELr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ELr.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 vse.match(vse.json(200,LHo.ProcessingStatusOut$inboundSchema),vse.jsonErr(422,FHo.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 RLr=S(kj=>{"use strict";var zHo=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]}),VHo=kj&&kj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xAe=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"&&zHo(r,e,n[o]);return VHo(r,e),r}}();Object.defineProperty(kj,"__esModule",{value:!0});kj.betaLibrariesDocumentsTextContent=YHo;var MLr=wr(),wse=xAe(pr()),HHo=le(),JHo=Z(),ILr=mr(),WHo=cr(),KHo=xAe(kt()),GHo=xAe(Gn()),XHo=xAe(Xn()),ZHo=hr();function YHo(t,e,r){return new ZHo.APIPromise(QHo(t,e,r))}async function QHo(t,e,r){let n=(0,JHo.safeParse)(e,_=>XHo.LibrariesDocumentsGetTextContentV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,MLr.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,MLr.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,WHo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/text_content")(a),u=new Headers((0,HHo.compactMap)({Accept:"application/json"})),l=await(0,ILr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ILr.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 wse.match(wse.json(200,KHo.DocumentTextContent$inboundSchema),wse.jsonErr(422,GHo.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 NLr=S(qj=>{"use strict";var eJo=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]}),tJo=qj&&qj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OAe=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"&&eJo(r,e,n[o]);return tJo(r,e),r}}();Object.defineProperty(qj,"__esModule",{value:!0});qj.betaLibrariesDocumentsUpdate=lJo;var blt=wr(),Sse=OAe(pr()),rJo=le(),nJo=Z(),ALr=mr(),oJo=cr(),iJo=OAe(kt()),aJo=OAe(Gn()),sJo=OAe(Xn()),uJo=hr();function lJo(t,e,r){return new uJo.APIPromise(cJo(t,e,r))}async function cJo(t,e,r){let n=(0,nJo.safeParse)(e,_=>sJo.LibrariesDocumentsUpdateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,blt.encodeJSON)("body",o.DocumentUpdateIn,{explode:!0}),a={document_id:(0,blt.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,blt.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,oJo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,rJo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,ALr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ALr.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 Sse.match(Sse.json(200,iJo.DocumentOut$inboundSchema),Sse.jsonErr(422,aJo.HTTPValidationError$inboundSchema),Sse.fail("4XX"),Sse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var DLr=S(Uj=>{"use strict";var dJo=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]}),fJo=Uj&&Uj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EAe=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"&&dJo(r,e,n[o]);return fJo(r,e),r}}();Object.defineProperty(Uj,"__esModule",{value:!0});Uj.betaLibrariesDocumentsUpload=SJo;var TAe=wr(),_lt=JG(),Cse=EAe(pr()),pJo=le(),mJo=Z(),jLr=mr(),hJo=cr(),gJo=EAe(kt()),yJo=EAe(Gn()),bJo=EAe(Xn()),_Jo=hr(),vJo=rj(),wJo=Kae();function SJo(t,e,r){return new _Jo.APIPromise(CJo(t,e,r))}async function CJo(t,e,r){let n=(0,mJo.safeParse)(e,_=>bJo.LibrariesDocumentsUploadV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,vJo.isBlobLike)(o.RequestBody.file))(0,TAe.appendForm)(i,"file",o.RequestBody.file);else if((0,wJo.isReadableStream)(o.RequestBody.file.content)){let _=await(0,_lt.readableStreamToArrayBuffer)(o.RequestBody.file.content),w=(0,_lt.getContentTypeFromFileName)(o.RequestBody.file.fileName)||"application/octet-stream",O=new Blob([_],{type:w});(0,TAe.appendForm)(i,"file",O,o.RequestBody.file.fileName)}else{let _=(0,_lt.getContentTypeFromFileName)(o.RequestBody.file.fileName)||"application/octet-stream";(0,TAe.appendForm)(i,"file",new Blob([o.RequestBody.file.content],{type:_}),o.RequestBody.file.fileName)}let a={library_id:(0,TAe.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,hJo.pathToFunc)("/v1/libraries/{library_id}/documents")(a),u=new Headers((0,pJo.compactMap)({Accept:"application/json"})),l=await(0,jLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,jLr.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 Cse.match(Cse.json([200,201],gJo.DocumentOut$inboundSchema),Cse.jsonErr(422,yJo.HTTPValidationError$inboundSchema),Cse.fail("4XX"),Cse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var $Lr=S(PAe=>{"use strict";Object.defineProperty(PAe,"__esModule",{value:!0});PAe.Documents=void 0;var xJo=cLr(),OJo=pLr(),TJo=gLr(),EJo=_Lr(),PJo=SLr(),MJo=OLr(),IJo=PLr(),RJo=RLr(),AJo=NLr(),NJo=DLr(),jJo=Rc(),GR=vd(),vlt=class extends jJo.ClientSDK{async list(e,r){return(0,GR.unwrapAsync)((0,PJo.betaLibrariesDocumentsList)(this,e,r))}async upload(e,r){return(0,GR.unwrapAsync)((0,NJo.betaLibrariesDocumentsUpload)(this,e,r))}async get(e,r){return(0,GR.unwrapAsync)((0,TJo.betaLibrariesDocumentsGet)(this,e,r))}async update(e,r){return(0,GR.unwrapAsync)((0,AJo.betaLibrariesDocumentsUpdate)(this,e,r))}async delete(e,r){return(0,GR.unwrapAsync)((0,xJo.betaLibrariesDocumentsDelete)(this,e,r))}async textContent(e,r){return(0,GR.unwrapAsync)((0,RJo.betaLibrariesDocumentsTextContent)(this,e,r))}async status(e,r){return(0,GR.unwrapAsync)((0,IJo.betaLibrariesDocumentsStatus)(this,e,r))}async getSignedUrl(e,r){return(0,GR.unwrapAsync)((0,EJo.betaLibrariesDocumentsGetSignedUrl)(this,e,r))}async extractedTextSignedUrl(e,r){return(0,GR.unwrapAsync)((0,OJo.betaLibrariesDocumentsExtractedTextSignedUrl)(this,e,r))}async reprocess(e,r){return(0,GR.unwrapAsync)((0,MJo.betaLibrariesDocumentsReprocess)(this,e,r))}};PAe.Documents=vlt});var LLr=S(MAe=>{"use strict";Object.defineProperty(MAe,"__esModule",{value:!0});MAe.Libraries=void 0;var DJo=B$r(),$Jo=V$r(),LJo=J$r(),FJo=G$r(),kJo=Y$r(),qJo=Rc(),xse=vd(),UJo=sLr(),BJo=$Lr(),wlt=class extends qJo.ClientSDK{get documents(){return this._documents??(this._documents=new BJo.Documents(this._options))}get accesses(){return this._accesses??(this._accesses=new UJo.Accesses(this._options))}async list(e){return(0,xse.unwrapAsync)((0,FJo.betaLibrariesList)(this,e))}async create(e,r){return(0,xse.unwrapAsync)((0,DJo.betaLibrariesCreate)(this,e,r))}async get(e,r){return(0,xse.unwrapAsync)((0,LJo.betaLibrariesGet)(this,e,r))}async delete(e,r){return(0,xse.unwrapAsync)((0,$Jo.betaLibrariesDelete)(this,e,r))}async update(e,r){return(0,xse.unwrapAsync)((0,kJo.betaLibrariesUpdate)(this,e,r))}};MAe.Libraries=wlt});var qLr=S(Bj=>{"use strict";var zJo=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]}),VJo=Bj&&Bj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Slt=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"&&zJo(r,e,n[o]);return VJo(r,e),r}}();Object.defineProperty(Bj,"__esModule",{value:!0});Bj.betaAgentsCreate=ZJo;var HJo=wr(),Ose=Slt(pr()),JJo=le(),WJo=Z(),FLr=mr(),KJo=cr(),kLr=Slt(kt()),GJo=Slt(Gn()),XJo=hr();function ZJo(t,e,r){return new XJo.APIPromise(YJo(t,e,r))}async function YJo(t,e,r){let n=(0,WJo.safeParse)(e,b=>kLr.AgentCreationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,HJo.encodeJSON)("body",o,{explode:!0}),a=(0,KJo.pathToFunc)("/v1/agents")(),s=new Headers((0,JJo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,FLr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,FLr.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 Ose.match(Ose.json(200,kLr.Agent$inboundSchema),Ose.jsonErr(422,GJo.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 BLr=S(zj=>{"use strict";var QJo=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]}),e3o=zj&&zj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IAe=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"&&QJo(r,e,n[o]);return e3o(r,e),r}}();Object.defineProperty(zj,"__esModule",{value:!0});zj.betaAgentsGet=l3o;var t3o=wr(),Tse=IAe(pr()),r3o=le(),n3o=Z(),ULr=mr(),o3o=cr(),i3o=IAe(kt()),a3o=IAe(Gn()),s3o=IAe(Xn()),u3o=hr();function l3o(t,e,r){return new u3o.APIPromise(c3o(t,e,r))}async function c3o(t,e,r){let n=(0,n3o.safeParse)(e,_=>s3o.AgentsApiV1AgentsGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={agent_id:(0,t3o.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,o3o.pathToFunc)("/v1/agents/{agent_id}")(a),u=new Headers((0,r3o.compactMap)({Accept:"application/json"})),l=await(0,ULr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ULr.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 Tse.match(Tse.json(200,i3o.Agent$inboundSchema),Tse.jsonErr(422,a3o.HTTPValidationError$inboundSchema),Tse.fail("4XX"),Tse.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var VLr=S(Vj=>{"use strict";var d3o=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]}),f3o=Vj&&Vj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pse=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"&&d3o(r,e,n[o]);return f3o(r,e),r}}();Object.defineProperty(Vj,"__esModule",{value:!0});Vj.betaAgentsList=S3o;var p3o=Pse(Q()),m3o=wr(),Ese=Pse(pr()),h3o=le(),g3o=Z(),zLr=mr(),y3o=cr(),b3o=Pse(kt()),_3o=Pse(Gn()),v3o=Pse(Xn()),w3o=hr();function S3o(t,e,r){return new w3o.APIPromise(C3o(t,e,r))}async function C3o(t,e,r){let n=(0,g3o.safeParse)(e,_=>v3o.AgentsApiV1AgentsListRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,y3o.pathToFunc)("/v1/agents")(),s=(0,m3o.encodeFormQuery)({page:o?.page,page_size:o?.page_size}),u=new Headers((0,h3o.compactMap)({Accept:"application/json"})),l=await(0,zLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,zLr.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 Ese.match(Ese.json(200,p3o.array(b3o.Agent$inboundSchema)),Ese.jsonErr(422,_3o.HTTPValidationError$inboundSchema),Ese.fail("4XX"),Ese.fail("5XX"))(y,m,{extraFields:g});return b.ok?[b,{status:"complete",request:m,response:y}]:[b,{status:"complete",request:m,response:y}]}});var WLr=S(Hj=>{"use strict";var x3o=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]}),O3o=Hj&&Hj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RAe=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"&&x3o(r,e,n[o]);return O3o(r,e),r}}();Object.defineProperty(Hj,"__esModule",{value:!0});Hj.betaAgentsUpdate=N3o;var HLr=wr(),Mse=RAe(pr()),T3o=le(),E3o=Z(),JLr=mr(),P3o=cr(),M3o=RAe(kt()),I3o=RAe(Gn()),R3o=RAe(Xn()),A3o=hr();function N3o(t,e,r){return new A3o.APIPromise(j3o(t,e,r))}async function j3o(t,e,r){let n=(0,E3o.safeParse)(e,_=>R3o.AgentsApiV1AgentsUpdateRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,HLr.encodeJSON)("body",o.AgentUpdateRequest,{explode:!0}),a={agent_id:(0,HLr.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,P3o.pathToFunc)("/v1/agents/{agent_id}")(a),u=new Headers((0,T3o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,JLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,JLr.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 Mse.match(Mse.json(200,M3o.Agent$inboundSchema),Mse.jsonErr(422,I3o.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 XLr=S(Jj=>{"use strict";var D3o=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]}),$3o=Jj&&Jj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AAe=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"&&D3o(r,e,n[o]);return $3o(r,e),r}}();Object.defineProperty(Jj,"__esModule",{value:!0});Jj.betaAgentsUpdateVersion=V3o;var KLr=wr(),Ise=AAe(pr()),L3o=le(),F3o=Z(),GLr=mr(),k3o=cr(),q3o=AAe(kt()),U3o=AAe(Gn()),B3o=AAe(Xn()),z3o=hr();function V3o(t,e,r){return new z3o.APIPromise(H3o(t,e,r))}async function H3o(t,e,r){let n=(0,F3o.safeParse)(e,w=>B3o.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={agent_id:(0,KLr.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,k3o.pathToFunc)("/v1/agents/{agent_id}/version")(a),u=(0,KLr.encodeFormQuery)({version:o.version}),l=new Headers((0,L3o.compactMap)({Accept:"application/json"})),c=await(0,GLr.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,GLr.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 Ise.match(Ise.json(200,q3o.Agent$inboundSchema),Ise.jsonErr(422,U3o.HTTPValidationError$inboundSchema),Ise.fail("4XX"),Ise.fail("5XX"))(g,h,{extraFields:b});return _.ok?[_,{status:"complete",request:h,response:g}]:[_,{status:"complete",request:h,response:g}]}});var ZLr=S(NAe=>{"use strict";Object.defineProperty(NAe,"__esModule",{value:!0});NAe.MistralAgents=void 0;var J3o=qLr(),W3o=BLr(),K3o=VLr(),G3o=WLr(),X3o=XLr(),Z3o=Rc(),Rse=vd(),Clt=class extends Z3o.ClientSDK{async create(e,r){return(0,Rse.unwrapAsync)((0,J3o.betaAgentsCreate)(this,e,r))}async list(e,r){return(0,Rse.unwrapAsync)((0,K3o.betaAgentsList)(this,e,r))}async get(e,r){return(0,Rse.unwrapAsync)((0,W3o.betaAgentsGet)(this,e,r))}async update(e,r){return(0,Rse.unwrapAsync)((0,G3o.betaAgentsUpdate)(this,e,r))}async updateVersion(e,r){return(0,Rse.unwrapAsync)((0,X3o.betaAgentsUpdateVersion)(this,e,r))}};NAe.MistralAgents=Clt});var YLr=S(jAe=>{"use strict";Object.defineProperty(jAe,"__esModule",{value:!0});jAe.Beta=void 0;var Y3o=Rc(),Q3o=k$r(),eWo=LLr(),tWo=ZLr(),xlt=class extends Y3o.ClientSDK{get conversations(){return this._conversations??(this._conversations=new Q3o.Conversations(this._options))}get agents(){return this._agents??(this._agents=new tWo.MistralAgents(this._options))}get libraries(){return this._libraries??(this._libraries=new eWo.Libraries(this._options))}};jAe.Beta=xlt});var tFr=S(Wj=>{"use strict";var rWo=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]}),nWo=Wj&&Wj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Olt=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"&&rWo(r,e,n[o]);return nWo(r,e),r}}();Object.defineProperty(Wj,"__esModule",{value:!0});Wj.chatComplete=cWo;var oWo=wr(),Ase=Olt(pr()),iWo=le(),aWo=Z(),QLr=mr(),sWo=cr(),eFr=Olt(kt()),uWo=Olt(Gn()),lWo=hr();function cWo(t,e,r){return new lWo.APIPromise(dWo(t,e,r))}async function dWo(t,e,r){let n=(0,aWo.safeParse)(e,b=>eFr.ChatCompletionRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,oWo.encodeJSON)("body",o,{explode:!0}),a=(0,sWo.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,iWo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,QLr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,QLr.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 Ase.match(Ase.json(200,eFr.ChatCompletionResponse$inboundSchema),Ase.jsonErr(422,uWo.HTTPValidationError$inboundSchema),Ase.fail("4XX"),Ase.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var oFr=S(Kj=>{"use strict";var fWo=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]}),pWo=Kj&&Kj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DAe=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"&&fWo(r,e,n[o]);return pWo(r,e),r}}();Object.defineProperty(Kj,"__esModule",{value:!0});Kj.chatStream=SWo;var mWo=DAe(Q()),hWo=wr(),gWo=pq(),Nse=DAe(pr()),yWo=le(),bWo=Z(),rFr=mr(),_Wo=cr(),nFr=DAe(kt()),vWo=DAe(Gn()),wWo=hr();function SWo(t,e,r){return new wWo.APIPromise(CWo(t,e,r))}async function CWo(t,e,r){let n=(0,bWo.safeParse)(e,b=>nFr.ChatCompletionStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,hWo.encodeJSON)("body",o,{explode:!0}),a=(0,_Wo.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,yWo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,rFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,rFr.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 Nse.match(Nse.sse(200,mWo.instanceof(ReadableStream).transform(b=>new gWo.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:nFr.CompletionEvent$inboundSchema.parse(_)}))),Nse.jsonErr(422,vWo.HTTPValidationError$inboundSchema),Nse.fail("4XX"),Nse.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var $Ae=S(XR=>{"use strict";Object.defineProperty(XR,"__esModule",{value:!0});XR.getDefaultOptions=XR.defaultOptions=XR.ignoreOverride=void 0;XR.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");XR.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 xWo=t=>typeof t=="string"?{...XR.defaultOptions,name:t}:{...XR.defaultOptions,...t};XR.getDefaultOptions=xWo});var Tlt=S(LAe=>{"use strict";Object.defineProperty(LAe,"__esModule",{value:!0});LAe.getRefs=void 0;var OWo=$Ae(),TWo=t=>{let e=(0,OWo.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}]))}};LAe.getRefs=TWo});var gq=S(k9=>{"use strict";Object.defineProperty(k9,"__esModule",{value:!0});k9.setResponseValueAndErrors=k9.addErrorMessage=void 0;function iFr(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}k9.addErrorMessage=iFr;function EWo(t,e,r,n,o){t[e]=r,iFr(t,e,n,o)}k9.setResponseValueAndErrors=EWo});var Elt=S(FAe=>{"use strict";Object.defineProperty(FAe,"__esModule",{value:!0});FAe.parseAnyDef=void 0;function PWo(){return{}}FAe.parseAnyDef=PWo});var Plt=S(qAe=>{"use strict";Object.defineProperty(qAe,"__esModule",{value:!0});qAe.parseArrayDef=void 0;var MWo=Q(),kAe=gq(),IWo=rm();function RWo(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==MWo.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,IWo.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,kAe.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,kAe.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,kAe.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,kAe.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}qAe.parseArrayDef=RWo});var Mlt=S(UAe=>{"use strict";Object.defineProperty(UAe,"__esModule",{value:!0});UAe.parseBigintDef=void 0;var xH=gq();function AWo(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,xH.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,xH.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,xH.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,xH.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,xH.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,xH.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,xH.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}UAe.parseBigintDef=AWo});var Ilt=S(BAe=>{"use strict";Object.defineProperty(BAe,"__esModule",{value:!0});BAe.parseBooleanDef=void 0;function NWo(){return{type:"boolean"}}BAe.parseBooleanDef=NWo});var VAe=S(zAe=>{"use strict";Object.defineProperty(zAe,"__esModule",{value:!0});zAe.parseBrandedDef=void 0;var jWo=rm();function DWo(t,e){return(0,jWo.parseDef)(t.type._def,e)}zAe.parseBrandedDef=DWo});var Rlt=S(HAe=>{"use strict";Object.defineProperty(HAe,"__esModule",{value:!0});HAe.parseCatchDef=void 0;var $Wo=rm(),LWo=(t,e)=>(0,$Wo.parseDef)(t.innerType._def,e);HAe.parseCatchDef=LWo});var Alt=S(JAe=>{"use strict";Object.defineProperty(JAe,"__esModule",{value:!0});JAe.parseDateDef=void 0;var aFr=gq();function sFr(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>sFr(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 FWo(t,e)}}JAe.parseDateDef=sFr;var FWo=(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,aFr.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,aFr.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var Nlt=S(WAe=>{"use strict";Object.defineProperty(WAe,"__esModule",{value:!0});WAe.parseDefaultDef=void 0;var kWo=rm();function qWo(t,e){return{...(0,kWo.parseDef)(t.innerType._def,e),default:t.defaultValue()}}WAe.parseDefaultDef=qWo});var jlt=S(KAe=>{"use strict";Object.defineProperty(KAe,"__esModule",{value:!0});KAe.parseEffectsDef=void 0;var UWo=rm();function BWo(t,e){return e.effectStrategy==="input"?(0,UWo.parseDef)(t.schema._def,e):{}}KAe.parseEffectsDef=BWo});var Dlt=S(GAe=>{"use strict";Object.defineProperty(GAe,"__esModule",{value:!0});GAe.parseEnumDef=void 0;function zWo(t){return{type:"string",enum:Array.from(t.values)}}GAe.parseEnumDef=zWo});var $lt=S(XAe=>{"use strict";Object.defineProperty(XAe,"__esModule",{value:!0});XAe.parseIntersectionDef=void 0;var uFr=rm(),VWo=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function HWo(t,e){let r=[(0,uFr.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,uFr.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(VWo(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}XAe.parseIntersectionDef=HWo});var Llt=S(ZAe=>{"use strict";Object.defineProperty(ZAe,"__esModule",{value:!0});ZAe.parseLiteralDef=void 0;function JWo(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}}ZAe.parseLiteralDef=JWo});var YAe=S(Ag=>{"use strict";Object.defineProperty(Ag,"__esModule",{value:!0});Ag.parseStringDef=Ag.zodPatterns=void 0;var OH=gq(),Flt;Ag.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:()=>(Flt===void 0&&(Flt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Flt),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 WWo(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,OH.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,OH.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":ox(r,"email",n.message,e);break;case"format:idn-email":ox(r,"idn-email",n.message,e);break;case"pattern:zod":Pb(r,Ag.zodPatterns.email,n.message,e);break}break;case"url":ox(r,"uri",n.message,e);break;case"uuid":ox(r,"uuid",n.message,e);break;case"regex":Pb(r,n.regex,n.message,e);break;case"cuid":Pb(r,Ag.zodPatterns.cuid,n.message,e);break;case"cuid2":Pb(r,Ag.zodPatterns.cuid2,n.message,e);break;case"startsWith":Pb(r,RegExp(`^${klt(n.value,e)}`),n.message,e);break;case"endsWith":Pb(r,RegExp(`${klt(n.value,e)}$`),n.message,e);break;case"datetime":ox(r,"date-time",n.message,e);break;case"date":ox(r,"date",n.message,e);break;case"time":ox(r,"time",n.message,e);break;case"duration":ox(r,"duration",n.message,e);break;case"length":(0,OH.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,OH.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Pb(r,RegExp(klt(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&ox(r,"ipv4",n.message,e),n.version!=="v4"&&ox(r,"ipv6",n.message,e);break}case"base64url":Pb(r,Ag.zodPatterns.base64url,n.message,e);break;case"jwt":Pb(r,Ag.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Pb(r,Ag.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&Pb(r,Ag.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":Pb(r,Ag.zodPatterns.emoji(),n.message,e);break;case"ulid":{Pb(r,Ag.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ox(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,OH.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Pb(r,Ag.zodPatterns.base64,n.message,e);break}}break}case"nanoid":Pb(r,Ag.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}Ag.parseStringDef=WWo;function klt(t,e){return e.patternStrategy==="escape"?GWo(t):t}var KWo=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function GWo(t){let e="";for(let r=0;r<t.length;r++)KWo.has(t[r])||(e+="\\"),e+=t[r];return e}function 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}}})):(0,OH.setResponseValueAndErrors)(t,"format",e,r,n)}function Pb(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:lFr(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,OH.setResponseValueAndErrors)(t,"pattern",lFr(e,n),r,n)}function lFr(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(QAe=>{"use strict";Object.defineProperty(QAe,"__esModule",{value:!0});QAe.parseRecordDef=void 0;var jse=Q(),cFr=rm(),XWo=YAe(),ZWo=VAe();function YWo(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===jse.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,cFr.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,cFr.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===jse.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,XWo.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===jse.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===jse.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===jse.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,ZWo.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}QAe.parseRecordDef=YWo});var qlt=S(tNe=>{"use strict";Object.defineProperty(tNe,"__esModule",{value:!0});tNe.parseMapDef=void 0;var dFr=rm(),QWo=eNe();function e6o(t,e){if(e.mapStrategy==="record")return(0,QWo.parseRecordDef)(t,e);let r=(0,dFr.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,dFr.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}}}tNe.parseMapDef=e6o});var Ult=S(rNe=>{"use strict";Object.defineProperty(rNe,"__esModule",{value:!0});rNe.parseNativeEnumDef=void 0;function t6o(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}}rNe.parseNativeEnumDef=t6o});var Blt=S(nNe=>{"use strict";Object.defineProperty(nNe,"__esModule",{value:!0});nNe.parseNeverDef=void 0;function r6o(){return{not:{}}}nNe.parseNeverDef=r6o});var zlt=S(oNe=>{"use strict";Object.defineProperty(oNe,"__esModule",{value:!0});oNe.parseNullDef=void 0;function n6o(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}oNe.parseNullDef=n6o});var iNe=S(yq=>{"use strict";Object.defineProperty(yq,"__esModule",{value:!0});yq.parseUnionDef=yq.primitiveMappings=void 0;var o6o=rm();yq.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function i6o(t,e){if(e.target==="openApi3")return fFr(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in yq.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=yq.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 fFr(t,e)}yq.parseUnionDef=i6o;var fFr=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,o6o.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 Vlt=S(aNe=>{"use strict";Object.defineProperty(aNe,"__esModule",{value:!0});aNe.parseNullableDef=void 0;var pFr=rm(),mFr=iNe();function a6o(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:mFr.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[mFr.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,pFr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,pFr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}aNe.parseNullableDef=a6o});var Hlt=S(sNe=>{"use strict";Object.defineProperty(sNe,"__esModule",{value:!0});sNe.parseNumberDef=void 0;var bq=gq();function s6o(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,bq.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,bq.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,bq.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,bq.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,bq.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,bq.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,bq.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,bq.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}sNe.parseNumberDef=s6o});var Wlt=S(uNe=>{"use strict";Object.defineProperty(uNe,"__esModule",{value:!0});uNe.parseObjectDef=void 0;var u6o=Q(),Jlt=rm();function l6o(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,Jlt.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,Jlt.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function c6o(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 u6o.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,Jlt.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:l6o(t,e)};return n.required.length||delete n.required,n}uNe.parseObjectDef=c6o});var Klt=S(lNe=>{"use strict";Object.defineProperty(lNe,"__esModule",{value:!0});lNe.parseOptionalDef=void 0;var hFr=rm(),d6o=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,hFr.parseDef)(t.innerType._def,e);let r=(0,hFr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};lNe.parseOptionalDef=d6o});var Glt=S(dNe=>{"use strict";Object.defineProperty(dNe,"__esModule",{value:!0});dNe.parsePipelineDef=void 0;var cNe=rm(),f6o=(t,e)=>{if(e.pipeStrategy==="input")return(0,cNe.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,cNe.parseDef)(t.out._def,e);let r=(0,cNe.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,cNe.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};dNe.parsePipelineDef=f6o});var Xlt=S(fNe=>{"use strict";Object.defineProperty(fNe,"__esModule",{value:!0});fNe.parsePromiseDef=void 0;var p6o=rm();function m6o(t,e){return(0,p6o.parseDef)(t.type._def,e)}fNe.parsePromiseDef=m6o});var Zlt=S(pNe=>{"use strict";Object.defineProperty(pNe,"__esModule",{value:!0});pNe.parseSetDef=void 0;var gFr=gq(),h6o=rm();function g6o(t,e){let n={type:"array",uniqueItems:!0,items:(0,h6o.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,gFr.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,gFr.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}pNe.parseSetDef=g6o});var Qlt=S(mNe=>{"use strict";Object.defineProperty(mNe,"__esModule",{value:!0});mNe.parseTupleDef=void 0;var Ylt=rm();function y6o(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,Ylt.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,Ylt.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,Ylt.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}mNe.parseTupleDef=y6o});var ect=S(hNe=>{"use strict";Object.defineProperty(hNe,"__esModule",{value:!0});hNe.parseUndefinedDef=void 0;function b6o(){return{not:{}}}hNe.parseUndefinedDef=b6o});var tct=S(gNe=>{"use strict";Object.defineProperty(gNe,"__esModule",{value:!0});gNe.parseUnknownDef=void 0;function _6o(){return{}}gNe.parseUnknownDef=_6o});var rct=S(yNe=>{"use strict";Object.defineProperty(yNe,"__esModule",{value:!0});yNe.parseReadonlyDef=void 0;var v6o=rm(),w6o=(t,e)=>(0,v6o.parseDef)(t.innerType._def,e);yNe.parseReadonlyDef=w6o});var rm=S(bNe=>{"use strict";Object.defineProperty(bNe,"__esModule",{value:!0});bNe.parseDef=void 0;var qi=Q(),S6o=Elt(),C6o=Plt(),x6o=Mlt(),O6o=Ilt(),T6o=VAe(),E6o=Rlt(),P6o=Alt(),M6o=Nlt(),I6o=jlt(),R6o=Dlt(),A6o=$lt(),N6o=Llt(),j6o=qlt(),D6o=Ult(),$6o=Blt(),L6o=zlt(),F6o=Vlt(),k6o=Hlt(),q6o=Wlt(),U6o=Klt(),B6o=Glt(),z6o=Xlt(),V6o=eNe(),H6o=Zlt(),J6o=YAe(),W6o=Qlt(),K6o=ect(),G6o=iNe(),X6o=tct(),Z6o=rct(),Y6o=$Ae();function yFr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Y6o.ignoreOverride)return a}if(n&&!r){let a=Q6o(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=t5o(t,t.typeName,e);return i&&r5o(t,e,i),o.jsonSchema=i,i}bNe.parseDef=yFr;var Q6o=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:e5o(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}},e5o=(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("/")},t5o=(t,e,r)=>{switch(e){case qi.ZodFirstPartyTypeKind.ZodString:return(0,J6o.parseStringDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodNumber:return(0,k6o.parseNumberDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodObject:return(0,q6o.parseObjectDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodBigInt:return(0,x6o.parseBigintDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodBoolean:return(0,O6o.parseBooleanDef)();case qi.ZodFirstPartyTypeKind.ZodDate:return(0,P6o.parseDateDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodUndefined:return(0,K6o.parseUndefinedDef)();case qi.ZodFirstPartyTypeKind.ZodNull:return(0,L6o.parseNullDef)(r);case qi.ZodFirstPartyTypeKind.ZodArray:return(0,C6o.parseArrayDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodUnion:case qi.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,G6o.parseUnionDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodIntersection:return(0,A6o.parseIntersectionDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodTuple:return(0,W6o.parseTupleDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodRecord:return(0,V6o.parseRecordDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodLiteral:return(0,N6o.parseLiteralDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodEnum:return(0,R6o.parseEnumDef)(t);case qi.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,D6o.parseNativeEnumDef)(t);case qi.ZodFirstPartyTypeKind.ZodNullable:return(0,F6o.parseNullableDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodOptional:return(0,U6o.parseOptionalDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodMap:return(0,j6o.parseMapDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodSet:return(0,H6o.parseSetDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodLazy:return yFr(t.getter()._def,r);case qi.ZodFirstPartyTypeKind.ZodPromise:return(0,z6o.parsePromiseDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodNaN:case qi.ZodFirstPartyTypeKind.ZodNever:return(0,$6o.parseNeverDef)();case qi.ZodFirstPartyTypeKind.ZodEffects:return(0,I6o.parseEffectsDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodAny:return(0,S6o.parseAnyDef)();case qi.ZodFirstPartyTypeKind.ZodUnknown:return(0,X6o.parseUnknownDef)();case qi.ZodFirstPartyTypeKind.ZodDefault:return(0,M6o.parseDefaultDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodBranded:return(0,T6o.parseBrandedDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodReadonly:return(0,Z6o.parseReadonlyDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodCatch:return(0,E6o.parseCatchDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodPipeline:return(0,B6o.parsePipelineDef)(t,r);case qi.ZodFirstPartyTypeKind.ZodFunction:case qi.ZodFirstPartyTypeKind.ZodVoid:case qi.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},r5o=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var nct=S(_Ne=>{"use strict";Object.defineProperty(_Ne,"__esModule",{value:!0});_Ne.zodToJsonSchema=void 0;var bFr=rm(),n5o=Tlt(),o5o=(t,e)=>{let r=(0,n5o.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,bFr.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,bFr.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};_Ne.zodToJsonSchema=o5o});var _Fr=S(Go=>{"use strict";var i5o=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]}),Wi=Go&&Go.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&i5o(e,t,r)};Object.defineProperty(Go,"__esModule",{value:!0});Wi($Ae(),Go);Wi(Tlt(),Go);Wi(gq(),Go);Wi(rm(),Go);Wi(Elt(),Go);Wi(Plt(),Go);Wi(Mlt(),Go);Wi(Ilt(),Go);Wi(VAe(),Go);Wi(Rlt(),Go);Wi(Alt(),Go);Wi(Nlt(),Go);Wi(jlt(),Go);Wi(Dlt(),Go);Wi($lt(),Go);Wi(Llt(),Go);Wi(qlt(),Go);Wi(Ult(),Go);Wi(Blt(),Go);Wi(zlt(),Go);Wi(Vlt(),Go);Wi(Hlt(),Go);Wi(Wlt(),Go);Wi(Klt(),Go);Wi(Glt(),Go);Wi(Xlt(),Go);Wi(rct(),Go);Wi(eNe(),Go);Wi(Zlt(),Go);Wi(YAe(),Go);Wi(Qlt(),Go);Wi(ect(),Go);Wi(iNe(),Go);Wi(tct(),Go);Wi(nct(),Go);var a5o=nct();Go.default=a5o.zodToJsonSchema});var wFr=S(Dse=>{"use strict";Object.defineProperty(Dse,"__esModule",{value:!0});Dse.transformToChatCompletionRequest=u5o;Dse.convertToParsedChatCompletionResponse=l5o;Dse.responseFormatFromZodObject=vFr;var s5o=_Fr();function u5o(t){let{responseFormat:e,...r}=t,n=vFr(e);return{...r,responseFormat:n}}function l5o(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 vFr(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,s5o.zodToJsonSchema)(t),strict:!0}}}});var xFr=S(wNe=>{"use strict";Object.defineProperty(wNe,"__esModule",{value:!0});wNe.Chat=void 0;var SFr=tFr(),CFr=oFr(),c5o=Rc(),vNe=vd(),oct=wFr(),ict=class extends c5o.ClientSDK{async parse(e,r){let n=(0,oct.transformToChatCompletionRequest)(e),o=await(0,vNe.unwrapAsync)((0,SFr.chatComplete)(this,n,r));return(0,oct.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,oct.transformToChatCompletionRequest)(e);return(0,vNe.unwrapAsync)((0,CFr.chatStream)(this,n,r))}async complete(e,r){return(0,vNe.unwrapAsync)((0,SFr.chatComplete)(this,e,r))}async stream(e,r){return(0,vNe.unwrapAsync)((0,CFr.chatStream)(this,e,r))}};wNe.Chat=ict});var EFr=S(Gj=>{"use strict";var d5o=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]}),f5o=Gj&&Gj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),act=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"&&d5o(r,e,n[o]);return f5o(r,e),r}}();Object.defineProperty(Gj,"__esModule",{value:!0});Gj.classifiersClassify=_5o;var p5o=wr(),$se=act(pr()),m5o=le(),h5o=Z(),OFr=mr(),g5o=cr(),TFr=act(kt()),y5o=act(Gn()),b5o=hr();function _5o(t,e,r){return new b5o.APIPromise(v5o(t,e,r))}async function v5o(t,e,r){let n=(0,h5o.safeParse)(e,b=>TFr.ClassificationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,p5o.encodeJSON)("body",o,{explode:!0}),a=(0,g5o.pathToFunc)("/v1/classifications")(),s=new Headers((0,m5o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,OFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,OFr.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 $se.match($se.json(200,TFr.ClassificationResponse$inboundSchema),$se.jsonErr(422,y5o.HTTPValidationError$inboundSchema),$se.fail("4XX"),$se.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var IFr=S(Xj=>{"use strict";var w5o=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]}),S5o=Xj&&Xj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sct=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"&&w5o(r,e,n[o]);return S5o(r,e),r}}();Object.defineProperty(Xj,"__esModule",{value:!0});Xj.classifiersClassifyChat=M5o;var C5o=wr(),Lse=sct(pr()),x5o=le(),O5o=Z(),PFr=mr(),T5o=cr(),MFr=sct(kt()),E5o=sct(Gn()),P5o=hr();function M5o(t,e,r){return new P5o.APIPromise(I5o(t,e,r))}async function I5o(t,e,r){let n=(0,O5o.safeParse)(e,b=>MFr.ChatClassificationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,C5o.encodeJSON)("body",o,{explode:!0}),a=(0,T5o.pathToFunc)("/v1/chat/classifications")(),s=new Headers((0,x5o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,PFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,PFr.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 Lse.match(Lse.json(200,MFr.ClassificationResponse$inboundSchema),Lse.jsonErr(422,E5o.HTTPValidationError$inboundSchema),Lse.fail("4XX"),Lse.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var NFr=S(Zj=>{"use strict";var R5o=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]}),A5o=Zj&&Zj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uct=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"&&R5o(r,e,n[o]);return A5o(r,e),r}}();Object.defineProperty(Zj,"__esModule",{value:!0});Zj.classifiersModerate=k5o;var N5o=wr(),Fse=uct(pr()),j5o=le(),D5o=Z(),RFr=mr(),$5o=cr(),AFr=uct(kt()),L5o=uct(Gn()),F5o=hr();function k5o(t,e,r){return new F5o.APIPromise(q5o(t,e,r))}async function q5o(t,e,r){let n=(0,D5o.safeParse)(e,b=>AFr.ClassificationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,N5o.encodeJSON)("body",o,{explode:!0}),a=(0,$5o.pathToFunc)("/v1/moderations")(),s=new Headers((0,j5o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,RFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,RFr.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 Fse.match(Fse.json(200,AFr.ModerationResponse$inboundSchema),Fse.jsonErr(422,L5o.HTTPValidationError$inboundSchema),Fse.fail("4XX"),Fse.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var $Fr=S(Yj=>{"use strict";var U5o=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]}),B5o=Yj&&Yj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lct=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"&&U5o(r,e,n[o]);return B5o(r,e),r}}();Object.defineProperty(Yj,"__esModule",{value:!0});Yj.classifiersModerateChat=G5o;var z5o=wr(),kse=lct(pr()),V5o=le(),H5o=Z(),jFr=mr(),J5o=cr(),DFr=lct(kt()),W5o=lct(Gn()),K5o=hr();function G5o(t,e,r){return new K5o.APIPromise(X5o(t,e,r))}async function X5o(t,e,r){let n=(0,H5o.safeParse)(e,b=>DFr.ChatModerationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,z5o.encodeJSON)("body",o,{explode:!0}),a=(0,J5o.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,V5o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),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:"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 kse.match(kse.json(200,DFr.ModerationResponse$inboundSchema),kse.jsonErr(422,W5o.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(CNe=>{"use strict";Object.defineProperty(CNe,"__esModule",{value:!0});CNe.Classifiers=void 0;var Z5o=EFr(),Y5o=IFr(),Q5o=NFr(),eKo=$Fr(),tKo=Rc(),SNe=vd(),cct=class extends tKo.ClientSDK{async moderate(e,r){return(0,SNe.unwrapAsync)((0,Q5o.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,SNe.unwrapAsync)((0,eKo.classifiersModerateChat)(this,e,r))}async classify(e,r){return(0,SNe.unwrapAsync)((0,Z5o.classifiersClassify)(this,e,r))}async classifyChat(e,r){return(0,SNe.unwrapAsync)((0,Y5o.classifiersClassifyChat)(this,e,r))}};CNe.Classifiers=cct});var qFr=S(Qj=>{"use strict";var rKo=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]}),nKo=Qj&&Qj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dct=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"&&rKo(r,e,n[o]);return nKo(r,e),r}}();Object.defineProperty(Qj,"__esModule",{value:!0});Qj.embeddingsCreate=cKo;var oKo=wr(),qse=dct(pr()),iKo=le(),aKo=Z(),FFr=mr(),sKo=cr(),kFr=dct(kt()),uKo=dct(Gn()),lKo=hr();function cKo(t,e,r){return new lKo.APIPromise(dKo(t,e,r))}async function dKo(t,e,r){let n=(0,aKo.safeParse)(e,b=>kFr.EmbeddingRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,oKo.encodeJSON)("body",o,{explode:!0}),a=(0,sKo.pathToFunc)("/v1/embeddings")(),s=new Headers((0,iKo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,FFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,FFr.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 qse.match(qse.json(200,kFr.EmbeddingResponse$inboundSchema),qse.jsonErr(422,uKo.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 UFr=S(xNe=>{"use strict";Object.defineProperty(xNe,"__esModule",{value:!0});xNe.Embeddings=void 0;var fKo=qFr(),pKo=Rc(),mKo=vd(),fct=class extends pKo.ClientSDK{async create(e,r){return(0,mKo.unwrapAsync)((0,fKo.embeddingsCreate)(this,e,r))}};xNe.Embeddings=fct});var zFr=S(eD=>{"use strict";var hKo=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]}),gKo=eD&&eD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pct=eD&&eD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hKo(r,e,n[o]);return gKo(r,e),r}}();Object.defineProperty(eD,"__esModule",{value:!0});eD.filesDelete=xKo;var yKo=wr(),ONe=pct(pr()),bKo=le(),_Ko=Z(),BFr=mr(),vKo=cr(),wKo=pct(kt()),SKo=pct(Xn()),CKo=hr();function xKo(t,e,r){return new CKo.APIPromise(OKo(t,e,r))}async function OKo(t,e,r){let n=(0,_Ko.safeParse)(e,b=>SKo.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,yKo.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,vKo.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,bKo.compactMap)({Accept:"application/json"})),l=await(0,BFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,BFr.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 ONe.match(ONe.json(200,wKo.DeleteFileOut$inboundSchema),ONe.fail("4XX"),ONe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var HFr=S(tD=>{"use strict";var TKo=tD&&tD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),EKo=tD&&tD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mct=tD&&tD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&TKo(r,e,n[o]);return EKo(r,e),r}}();Object.defineProperty(tD,"__esModule",{value:!0});tD.filesDownload=DKo;var PKo=mct(Q()),MKo=wr(),TNe=mct(pr()),IKo=le(),RKo=Z(),VFr=mr(),AKo=cr(),NKo=mct(Xn()),jKo=hr();function DKo(t,e,r){return new jKo.APIPromise($Ko(t,e,r))}async function $Ko(t,e,r){let n=(0,RKo.safeParse)(e,b=>NKo.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,MKo.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,AKo.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,IKo.compactMap)({Accept:"application/octet-stream"})),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:"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 TNe.match(TNe.stream(200,PKo.instanceof(ReadableStream)),TNe.fail("4XX"),TNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var KFr=S(rD=>{"use strict";var LKo=rD&&rD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FKo=rD&&rD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hct=rD&&rD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LKo(r,e,n[o]);return FKo(r,e),r}}();Object.defineProperty(rD,"__esModule",{value:!0});rD.filesGetSignedUrl=HKo;var JFr=wr(),ENe=hct(pr()),kKo=le(),qKo=Z(),WFr=mr(),UKo=cr(),BKo=hct(kt()),zKo=hct(Xn()),VKo=hr();function HKo(t,e,r){return new VKo.APIPromise(JKo(t,e,r))}async function JKo(t,e,r){let n=(0,qKo.safeParse)(e,_=>zKo.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,JFr.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,UKo.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,JFr.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,kKo.compactMap)({Accept:"application/json"})),c=await(0,WFr.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,WFr.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 ENe.match(ENe.json(200,BKo.FileSignedURL$inboundSchema),ENe.fail("4XX"),ENe.fail("5XX"))(g,h);return b.ok?[b,{status:"complete",request:h,response:g}]:[b,{status:"complete",request:h,response:g}]}});var XFr=S(nD=>{"use strict";var WKo=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]}),KKo=nD&&nD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gct=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"&&WKo(r,e,n[o]);return KKo(r,e),r}}();Object.defineProperty(nD,"__esModule",{value:!0});nD.filesList=r8o;var GKo=wr(),PNe=gct(pr()),XKo=le(),ZKo=Z(),GFr=mr(),YKo=cr(),QKo=gct(kt()),e8o=gct(Xn()),t8o=hr();function r8o(t,e,r){return new t8o.APIPromise(n8o(t,e,r))}async function n8o(t,e,r){let n=(0,ZKo.safeParse)(e,b=>e8o.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,YKo.pathToFunc)("/v1/files")(),s=(0,GKo.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,XKo.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:"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 PNe.match(PNe.json(200,QKo.ListFilesOut$inboundSchema),PNe.fail("4XX"),PNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var YFr=S(oD=>{"use strict";var o8o=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]}),i8o=oD&&oD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yct=oD&&oD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&o8o(r,e,n[o]);return i8o(r,e),r}}();Object.defineProperty(oD,"__esModule",{value:!0});oD.filesRetrieve=p8o;var a8o=wr(),MNe=yct(pr()),s8o=le(),u8o=Z(),ZFr=mr(),l8o=cr(),c8o=yct(kt()),d8o=yct(Xn()),f8o=hr();function p8o(t,e,r){return new f8o.APIPromise(m8o(t,e,r))}async function m8o(t,e,r){let n=(0,u8o.safeParse)(e,b=>d8o.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,a8o.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,l8o.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,s8o.compactMap)({Accept:"application/json"})),l=await(0,ZFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ZFr.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 MNe.match(MNe.json(200,c8o.RetrieveFileOut$inboundSchema),MNe.fail("4XX"),MNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var ekr=S(iD=>{"use strict";var h8o=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]}),g8o=iD&&iD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_ct=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"&&h8o(r,e,n[o]);return g8o(r,e),r}}();Object.defineProperty(iD,"__esModule",{value:!0});iD.filesUpload=O8o;var INe=wr(),bct=JG(),RNe=_ct(pr()),y8o=le(),b8o=Z(),QFr=mr(),_8o=cr(),v8o=_ct(kt()),w8o=_ct(Xn()),S8o=hr(),C8o=rj(),x8o=Kae();function O8o(t,e,r){return new S8o.APIPromise(T8o(t,e,r))}async function T8o(t,e,r){let n=(0,b8o.safeParse)(e,g=>w8o.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,C8o.isBlobLike)(o.file))(0,INe.appendForm)(i,"file",o.file);else if((0,x8o.isReadableStream)(o.file.content)){let g=await(0,bct.readableStreamToArrayBuffer)(o.file.content),b=(0,bct.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([g],{type:b});(0,INe.appendForm)(i,"file",_,o.file.fileName)}else{let g=(0,bct.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,INe.appendForm)(i,"file",new Blob([o.file.content],{type:g}),o.file.fileName)}o.purpose!==void 0&&(0,INe.appendForm)(i,"purpose",o.purpose);let a=(0,_8o.pathToFunc)("/v1/files")(),s=new Headers((0,y8o.compactMap)({Accept:"application/json"})),u=await(0,QFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,QFr.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 RNe.match(RNe.json(200,v8o.UploadFileOut$inboundSchema),RNe.fail("4XX"),RNe.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var tkr=S(ANe=>{"use strict";Object.defineProperty(ANe,"__esModule",{value:!0});ANe.Files=void 0;var E8o=zFr(),P8o=HFr(),M8o=KFr(),I8o=XFr(),R8o=YFr(),A8o=ekr(),N8o=Rc(),q9=vd(),vct=class extends N8o.ClientSDK{async upload(e,r){return(0,q9.unwrapAsync)((0,A8o.filesUpload)(this,e,r))}async list(e,r){return(0,q9.unwrapAsync)((0,I8o.filesList)(this,e,r))}async retrieve(e,r){return(0,q9.unwrapAsync)((0,R8o.filesRetrieve)(this,e,r))}async delete(e,r){return(0,q9.unwrapAsync)((0,E8o.filesDelete)(this,e,r))}async download(e,r){return(0,q9.unwrapAsync)((0,P8o.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,q9.unwrapAsync)((0,M8o.filesGetSignedUrl)(this,e,r))}};ANe.Files=vct});var okr=S(aD=>{"use strict";var j8o=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]}),D8o=aD&&aD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wct=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"&&j8o(r,e,n[o]);return D8o(r,e),r}}();Object.defineProperty(aD,"__esModule",{value:!0});aD.fimComplete=B8o;var $8o=wr(),Use=wct(pr()),L8o=le(),F8o=Z(),rkr=mr(),k8o=cr(),nkr=wct(kt()),q8o=wct(Gn()),U8o=hr();function B8o(t,e,r){return new U8o.APIPromise(z8o(t,e,r))}async function z8o(t,e,r){let n=(0,F8o.safeParse)(e,b=>nkr.FIMCompletionRequest$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/fim/completions")(),s=new Headers((0,L8o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,rkr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,rkr.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 Use.match(Use.json(200,nkr.FIMCompletionResponse$inboundSchema),Use.jsonErr(422,q8o.HTTPValidationError$inboundSchema),Use.fail("4XX"),Use.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var skr=S(sD=>{"use strict";var V8o=sD&&sD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=sD&&sD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NNe=sD&&sD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(sD,"__esModule",{value:!0});sD.fimStream=eGo;var J8o=NNe(Q()),W8o=wr(),K8o=pq(),Bse=NNe(pr()),G8o=le(),X8o=Z(),ikr=mr(),Z8o=cr(),akr=NNe(kt()),Y8o=NNe(Gn()),Q8o=hr();function eGo(t,e,r){return new Q8o.APIPromise(tGo(t,e,r))}async function tGo(t,e,r){let n=(0,X8o.safeParse)(e,b=>akr.FIMCompletionStreamRequest$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,Z8o.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,G8o.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,ikr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,ikr.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 Bse.match(Bse.sse(200,J8o.instanceof(ReadableStream).transform(b=>new K8o.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:akr.CompletionEvent$inboundSchema.parse(_)}))),Bse.jsonErr(422,Y8o.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 lkr=S(jNe=>{"use strict";Object.defineProperty(jNe,"__esModule",{value:!0});jNe.Fim=void 0;var rGo=okr(),nGo=skr(),oGo=Rc(),ukr=vd(),Sct=class extends oGo.ClientSDK{async complete(e,r){return(0,ukr.unwrapAsync)((0,rGo.fimComplete)(this,e,r))}async stream(e,r){return(0,ukr.unwrapAsync)((0,nGo.fimStream)(this,e,r))}};jNe.Fim=Sct});var pkr=S(uD=>{"use strict";var iGo=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]}),aGo=uD&&uD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fkr=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"&&iGo(r,e,n[o]);return aGo(r,e),r}}();Object.defineProperty(uD,"__esModule",{value:!0});uD.fineTuningJobsCancel=fGo;var sGo=wr(),DNe=fkr(pr()),uGo=le(),lGo=Z(),ckr=mr(),cGo=cr(),dkr=fkr(Xn()),dGo=hr();function fGo(t,e,r){return new dGo.APIPromise(pGo(t,e,r))}async function pGo(t,e,r){let n=(0,lGo.safeParse)(e,b=>dkr.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,sGo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,cGo.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,uGo.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:"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 DNe.match(DNe.json(200,dkr.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema),DNe.fail("4XX"),DNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var hkr=S(lD=>{"use strict";var mGo=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]}),hGo=lD&&lD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cct=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"&&mGo(r,e,n[o]);return hGo(r,e),r}}();Object.defineProperty(lD,"__esModule",{value:!0});lD.fineTuningJobsCreate=CGo;var gGo=wr(),$Ne=Cct(pr()),yGo=le(),bGo=Z(),mkr=mr(),_Go=cr(),vGo=Cct(kt()),wGo=Cct(Xn()),SGo=hr();function CGo(t,e,r){return new SGo.APIPromise(xGo(t,e,r))}async function xGo(t,e,r){let n=(0,bGo.safeParse)(e,g=>vGo.JobIn$outboundSchema.parse(g),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,gGo.encodeJSON)("body",o,{explode:!0}),a=(0,_Go.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,yGo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,mkr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,mkr.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 $Ne.match($Ne.json(200,wGo.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),$Ne.fail("4XX"),$Ne.fail("5XX"))(h,p);return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var _kr=S(cD=>{"use strict";var OGo=cD&&cD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=cD&&cD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bkr=cD&&cD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&OGo(r,e,n[o]);return TGo(r,e),r}}();Object.defineProperty(cD,"__esModule",{value:!0});cD.fineTuningJobsGet=AGo;var EGo=wr(),LNe=bkr(pr()),PGo=le(),MGo=Z(),gkr=mr(),IGo=cr(),ykr=bkr(Xn()),RGo=hr();function AGo(t,e,r){return new RGo.APIPromise(NGo(t,e,r))}async function NGo(t,e,r){let n=(0,MGo.safeParse)(e,b=>ykr.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,EGo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,IGo.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,PGo.compactMap)({Accept:"application/json"})),l=await(0,gkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,gkr.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 LNe.match(LNe.json(200,ykr.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema),LNe.fail("4XX"),LNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var wkr=S(dD=>{"use strict";var jGo=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]}),DGo=dD&&dD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xct=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"&&jGo(r,e,n[o]);return DGo(r,e),r}}();Object.defineProperty(dD,"__esModule",{value:!0});dD.fineTuningJobsList=zGo;var $Go=wr(),FNe=xct(pr()),LGo=le(),FGo=Z(),vkr=mr(),kGo=cr(),qGo=xct(kt()),UGo=xct(Xn()),BGo=hr();function zGo(t,e,r){return new BGo.APIPromise(VGo(t,e,r))}async function VGo(t,e,r){let n=(0,FGo.safeParse)(e,b=>UGo.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,kGo.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,$Go.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,LGo.compactMap)({Accept:"application/json"})),l=await(0,vkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,vkr.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 FNe.match(FNe.json(200,qGo.JobsOut$inboundSchema),FNe.fail("4XX"),FNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var Okr=S(fD=>{"use strict";var HGo=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]}),JGo=fD&&fD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xkr=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"&&HGo(r,e,n[o]);return JGo(r,e),r}}();Object.defineProperty(fD,"__esModule",{value:!0});fD.fineTuningJobsStart=YGo;var WGo=wr(),kNe=xkr(pr()),KGo=le(),GGo=Z(),Skr=mr(),XGo=cr(),Ckr=xkr(Xn()),ZGo=hr();function YGo(t,e,r){return new ZGo.APIPromise(QGo(t,e,r))}async function QGo(t,e,r){let n=(0,GGo.safeParse)(e,b=>Ckr.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,WGo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,XGo.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,KGo.compactMap)({Accept:"application/json"})),l=await(0,Skr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Skr.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 kNe.match(kNe.json(200,Ckr.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema),kNe.fail("4XX"),kNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var Tkr=S(qNe=>{"use strict";Object.defineProperty(qNe,"__esModule",{value:!0});qNe.Jobs=void 0;var e9o=pkr(),t9o=hkr(),r9o=_kr(),n9o=wkr(),o9o=Okr(),i9o=Rc(),zse=vd(),Oct=class extends i9o.ClientSDK{async list(e,r){return(0,zse.unwrapAsync)((0,n9o.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,zse.unwrapAsync)((0,t9o.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,zse.unwrapAsync)((0,r9o.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,zse.unwrapAsync)((0,e9o.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,zse.unwrapAsync)((0,o9o.fineTuningJobsStart)(this,e,r))}};qNe.Jobs=Oct});var Ekr=S(UNe=>{"use strict";Object.defineProperty(UNe,"__esModule",{value:!0});UNe.FineTuning=void 0;var a9o=Rc(),s9o=Tkr(),Tct=class extends a9o.ClientSDK{get jobs(){return this._jobs??(this._jobs=new s9o.Jobs(this._options))}};UNe.FineTuning=Tct});var Mkr=S(pD=>{"use strict";var u9o=pD&&pD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l9o=pD&&pD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ect=pD&&pD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&u9o(r,e,n[o]);return l9o(r,e),r}}();Object.defineProperty(pD,"__esModule",{value:!0});pD.modelsArchive=y9o;var c9o=wr(),BNe=Ect(pr()),d9o=le(),f9o=Z(),Pkr=mr(),p9o=cr(),m9o=Ect(kt()),h9o=Ect(Xn()),g9o=hr();function y9o(t,e,r){return new g9o.APIPromise(b9o(t,e,r))}async function b9o(t,e,r){let n=(0,f9o.safeParse)(e,b=>h9o.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,c9o.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,p9o.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,d9o.compactMap)({Accept:"application/json"})),l=await(0,Pkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Pkr.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 BNe.match(BNe.json(200,m9o.ArchiveFTModelOut$inboundSchema),BNe.fail("4XX"),BNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var Rkr=S(mD=>{"use strict";var _9o=mD&&mD.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v9o=mD&&mD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zNe=mD&&mD.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_9o(r,e,n[o]);return v9o(r,e),r}}();Object.defineProperty(mD,"__esModule",{value:!0});mD.modelsDelete=M9o;var w9o=wr(),Vse=zNe(pr()),S9o=le(),C9o=Z(),Ikr=mr(),x9o=cr(),O9o=zNe(kt()),T9o=zNe(Gn()),E9o=zNe(Xn()),P9o=hr();function M9o(t,e,r){return new P9o.APIPromise(I9o(t,e,r))}async function I9o(t,e,r){let n=(0,C9o.safeParse)(e,_=>E9o.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,w9o.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,x9o.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,S9o.compactMap)({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:"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 Vse.match(Vse.json(200,O9o.DeleteModelOut$inboundSchema),Vse.jsonErr(422,T9o.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 Nkr=S(hD=>{"use strict";var R9o=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]}),A9o=hD&&hD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Pct=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"&&R9o(r,e,n[o]);return A9o(r,e),r}}();Object.defineProperty(hD,"__esModule",{value:!0});hD.modelsList=F9o;var Hse=Pct(pr()),N9o=le(),Akr=mr(),j9o=cr(),D9o=Pct(kt()),$9o=Pct(Gn()),L9o=hr();function F9o(t,e){return new L9o.APIPromise(k9o(t,e))}async function k9o(t,e){let r=(0,j9o.pathToFunc)("/v1/models")(),n=new Headers((0,N9o.compactMap)({Accept:"application/json"})),o=await(0,Akr.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,Akr.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 Hse.match(Hse.json(200,D9o.ModelList$inboundSchema),Hse.jsonErr(422,$9o.HTTPValidationError$inboundSchema),Hse.fail("4XX"),Hse.fail("5XX"))(d,l,{extraFields:f});return p.ok?[p,{status:"complete",request:l,response:d}]:[p,{status:"complete",request:l,response:d}]}});var $kr=S(gD=>{"use strict";var q9o=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]}),U9o=gD&&gD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mct=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"&&q9o(r,e,n[o]);return U9o(r,e),r}}();Object.defineProperty(gD,"__esModule",{value:!0});gD.modelsRetrieve=K9o;var B9o=wr(),Jse=Mct(pr()),z9o=le(),V9o=Z(),jkr=mr(),H9o=cr(),J9o=Mct(Gn()),Dkr=Mct(Xn()),W9o=hr();function K9o(t,e,r){return new W9o.APIPromise(G9o(t,e,r))}async function G9o(t,e,r){let n=(0,V9o.safeParse)(e,_=>Dkr.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,B9o.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,H9o.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,z9o.compactMap)({Accept:"application/json"})),l=await(0,jkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,jkr.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 Jse.match(Jse.json(200,Dkr.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),Jse.jsonErr(422,J9o.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 Fkr=S(yD=>{"use strict";var X9o=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]}),Z9o=yD&&yD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ict=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"&&X9o(r,e,n[o]);return Z9o(r,e),r}}();Object.defineProperty(yD,"__esModule",{value:!0});yD.modelsUnarchive=i7o;var Y9o=wr(),VNe=Ict(pr()),Q9o=le(),e7o=Z(),Lkr=mr(),t7o=cr(),r7o=Ict(kt()),n7o=Ict(Xn()),o7o=hr();function i7o(t,e,r){return new o7o.APIPromise(a7o(t,e,r))}async function a7o(t,e,r){let n=(0,e7o.safeParse)(e,b=>n7o.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,Y9o.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,t7o.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,Q9o.compactMap)({Accept:"application/json"})),l=await(0,Lkr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Lkr.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 VNe.match(VNe.json(200,r7o.UnarchiveFTModelOut$inboundSchema),VNe.fail("4XX"),VNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var zkr=S(bD=>{"use strict";var s7o=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]}),u7o=bD&&bD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bkr=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"&&s7o(r,e,n[o]);return u7o(r,e),r}}();Object.defineProperty(bD,"__esModule",{value:!0});bD.modelsUpdate=p7o;var kkr=wr(),HNe=Bkr(pr()),l7o=le(),c7o=Z(),qkr=mr(),d7o=cr(),Ukr=Bkr(Xn()),f7o=hr();function p7o(t,e,r){return new f7o.APIPromise(m7o(t,e,r))}async function m7o(t,e,r){let n=(0,c7o.safeParse)(e,b=>Ukr.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,kkr.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,kkr.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,d7o.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,l7o.compactMap)({"Content-Type":"application/json",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:"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 HNe.match(HNe.json(200,Ukr.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema),HNe.fail("4XX"),HNe.fail("5XX"))(y,m);return g.ok?[g,{status:"complete",request:m,response:y}]:[g,{status:"complete",request:m,response:y}]}});var Vkr=S(JNe=>{"use strict";Object.defineProperty(JNe,"__esModule",{value:!0});JNe.Models=void 0;var h7o=Mkr(),g7o=Rkr(),y7o=Nkr(),b7o=$kr(),_7o=Fkr(),v7o=zkr(),w7o=Rc(),U9=vd(),Rct=class extends w7o.ClientSDK{async list(e){return(0,U9.unwrapAsync)((0,y7o.modelsList)(this,e))}async retrieve(e,r){return(0,U9.unwrapAsync)((0,b7o.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,U9.unwrapAsync)((0,g7o.modelsDelete)(this,e,r))}async update(e,r){return(0,U9.unwrapAsync)((0,v7o.modelsUpdate)(this,e,r))}async archive(e,r){return(0,U9.unwrapAsync)((0,h7o.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,U9.unwrapAsync)((0,_7o.modelsUnarchive)(this,e,r))}};JNe.Models=Rct});var Wkr=S(_D=>{"use strict";var S7o=_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]}),C7o=_D&&_D.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Act=_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"&&S7o(r,e,n[o]);return C7o(r,e),r}}();Object.defineProperty(_D,"__esModule",{value:!0});_D.ocrProcess=I7o;var x7o=wr(),Wse=Act(pr()),O7o=le(),T7o=Z(),Hkr=mr(),E7o=cr(),Jkr=Act(kt()),P7o=Act(Gn()),M7o=hr();function I7o(t,e,r){return new M7o.APIPromise(R7o(t,e,r))}async function R7o(t,e,r){let n=(0,T7o.safeParse)(e,b=>Jkr.OCRRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,x7o.encodeJSON)("body",o,{explode:!0}),a=(0,E7o.pathToFunc)("/v1/ocr")(),s=new Headers((0,O7o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,Hkr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,Hkr.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 Wse.match(Wse.json(200,Jkr.OCRResponse$inboundSchema),Wse.jsonErr(422,P7o.HTTPValidationError$inboundSchema),Wse.fail("4XX"),Wse.fail("5XX"))(h,p,{extraFields:y});return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var Kkr=S(WNe=>{"use strict";Object.defineProperty(WNe,"__esModule",{value:!0});WNe.Ocr=void 0;var A7o=Wkr(),N7o=Rc(),j7o=vd(),Nct=class extends N7o.ClientSDK{async process(e,r){return(0,j7o.unwrapAsync)((0,A7o.ocrProcess)(this,e,r))}};WNe.Ocr=Nct});var Gkr=S(KNe=>{"use strict";Object.defineProperty(KNe,"__esModule",{value:!0});KNe.Mistral=void 0;var D7o=Rc(),$7o=pNr(),L7o=CNr(),F7o=c$r(),k7o=YLr(),q7o=xFr(),U7o=LFr(),B7o=UFr(),z7o=tkr(),V7o=lkr(),H7o=Ekr(),J7o=Vkr(),W7o=Kkr(),jct=class extends D7o.ClientSDK{get models(){return this._models??(this._models=new J7o.Models(this._options))}get beta(){return this._beta??(this._beta=new k7o.Beta(this._options))}get files(){return this._files??(this._files=new z7o.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new H7o.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new F7o.Batch(this._options))}get chat(){return this._chat??(this._chat=new q7o.Chat(this._options))}get fim(){return this._fim??(this._fim=new V7o.Fim(this._options))}get agents(){return this._agents??(this._agents=new $7o.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new B7o.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new U7o.Classifiers(this._options))}get ocr(){return this._ocr??(this._ocr=new W7o.Ocr(this._options))}get audio(){return this._audio??(this._audio=new L7o.Audio(this._options))}};KNe.Mistral=jct});var Ykr=S(Iy=>{"use strict";var Xkr=Iy&&Iy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K7o=Iy&&Iy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zkr=Iy&&Iy.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xkr(e,t,r)},G7o=Iy&&Iy.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Xkr(r,e,n[o]);return K7o(r,e),r}}();Object.defineProperty(Iy,"__esModule",{value:!0});Iy.HTTPClient=Iy.files=void 0;Zkr(WEe(),Iy);Iy.files=G7o(JG());var X7o=WG();Object.defineProperty(Iy,"HTTPClient",{enumerable:!0,get:function(){return X7o.HTTPClient}});Zkr(Gkr(),Iy)});function Dct(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(Pl(i)&&i.tool_calls?.length)return i.tool_calls.map(a=>({...a,id:yae(a.id??"")})).map(ck)},o=new Set;for(let i of t)"tool_call_id"in i&&typeof i.tool_call_id=="string"&&o.add(yae(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:yae(i.tool_call_id)}];if(Pl(i)){if(a===void 0)return[{role:e(i.getType()),content:s}];{let u=a.filter(l=>o.has(yae(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 Z7o(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=Bat(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=kC(s,{returnId:!0});i.push({...u,id:u.id??JEe().replace(/-/g,"")})}catch(u){a.push(AS(s,u.message))}return new eo({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 Hs({content:o})}}function Y7o(t,e){if(!t.content&&!t.toolCalls)return e?new Ir({content:"",usage_metadata:e?{input_tokens:e.promptTokens,output_tokens:e.completionTokens,total_tokens:e.totalTokens}:void 0}):null;let r=t.toolCalls?.length?t.toolCalls?.map((s,u)=>({...s,index:u,id:s.id??JEe().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=Bat(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 mv({content:o}):n==="assistant"?new Ir({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 Iw({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new pv({content:o,additional_kwargs:i}):new fv({content:o,role:n})}function Qkr(t){if(!(!t||!t.length))return t.map(e=>{if("function"in e)return{type:e.type??"function",function:e.function};if(bg(e)){let r=e.description??`Tool: ${e.name}`;return{type:"function",function:{name:e.name,description:r,parameters:Ya(e.schema)?Ni(e.schema):e.schema}}}throw new Error(`Unknown tool type passed to ChatMistral: ${JSON.stringify(e,null,2)}`)})}var eqr,tqr,$ct,rqr=v(()=>{C_r();M_r();eqr=L(Ykr(),1),tqr=L(WG(),1);Qa();YI();id();GB();ku();fO();$8();_v();nb();g1();Wv();$ct=class extends md{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??vn("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?Qkr(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=Qkr(e);return new Hw({bound:this,kwargs:{...r??{},tools:n},config:{}})}async completionWithRetry(e,r){let n=new Fw({maxRetries:this.maxRetries}),o=new eqr.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=Dct(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:Z7o(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=Dct(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=Y7o(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 yi({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 tqr.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;Ya(n)?(u=Jw.fromZodSchema(n),f=Ni(n)):u=new vv,s=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"jsonMode"},schema:f}})}else{let f=o??"extract";if(Ya(n)){let p=Ni(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 qC({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 qC({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=Eu.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=Eu.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return Rl.from([{raw:s},d])}}});var nqr=v(()=>{ku();S2();zF()});var oqr=v(()=>{id();GB();ku();zF();voe()});var iqr=v(()=>{rqr();nqr();oqr()});var Lct,aqr=v(()=>{ku();oV();Lct=class extends dk{constructor(e){let r=e?.apiKey||vn("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 sqr=v(()=>{aqr()});var GNe,XNe,uqr,Fct=v(()=>{GNe="RFC3986",XNe={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},uqr="RFC1738"});function cqr(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function qct(t,e){if(Q7o(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var Q7o,ZR,kct,lqr,dqr=v(()=>{Fct();Q7o=Array.isArray,ZR=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),kct=1024,lqr=(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+=kct){let u=i.length>=kct?i.slice(s,s+kct):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===uqr&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=ZR[d];continue}if(d<2048){l[l.length]=ZR[192|d>>6]+ZR[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=ZR[224|d>>12]+ZR[128|d>>6&63]+ZR[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=ZR[240|d>>18]+ZR[128|d>>12&63]+ZR[128|d>>6&63]+ZR[128|d&63]}a+=l.join("")}return a}});function nXo(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function mqr(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,y,g){let b=t,_=g,w=0,O=!1;for(;(_=_.get(Uct))!==void 0&&!O;){let j=_.get(t);if(w+=1,typeof j<"u"){if(j===w)throw new RangeError("Cyclic object value");O=!0}typeof _.get(Uct)>"u"&&(w=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&YR(b)&&(b=qct(b,function(j){return j instanceof Date?f?.(j):j})),b===null){if(i)return u&&!h?u(e,Lm.encoder,y,"key",p):e;b=""}if(nXo(b)||cqr(b)){if(u){let j=h?e:u(e,Lm.encoder,y,"key",p);return[m?.(j)+"="+m?.(u(b,Lm.encoder,y,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let T=[];if(typeof b>"u")return T;let P;if(r==="comma"&&YR(b))h&&u&&(b=qct(b,u)),P=[{value:b.length>0?b.join(",")||null:void 0}];else if(YR(l))P=l;else{let j=Object.keys(b);P=c?j.sort(c):j}let M=s?String(e).replace(/\./g,"%2E"):String(e),I=n&&YR(b)&&b.length===1?M+"[]":M;if(o&&YR(b)&&b.length===0)return I+"[]";for(let j=0;j<P.length;++j){let A=P[j],k=typeof A=="object"&&typeof A.value<"u"?A.value:b[A];if(a&&k===null)continue;let V=d&&s?A.replace(/\./g,"%2E"):A,q=YR(b)?typeof r=="function"?r(I,V):I:I+(d?"."+V:"["+V+"]");g.set(t,w);let J=new WeakMap;J.set(Uct,g),pqr(T,mqr(k,q,r,n,o,i,a,s,r==="comma"&&h&&YR(b)?null:u,l,c,d,f,p,m,h,y,J))}return T}function oXo(t=Lm){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||Lm.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=GNe;if(typeof t.format<"u"){if(!eXo.call(XNe,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=XNe[r],o=Lm.filter;(typeof t.filter=="function"||YR(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in fqr?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=Lm.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:Lm.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Lm.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Lm.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Lm.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Lm.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Lm.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Lm.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Lm.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Lm.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Lm.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Lm.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Lm.strictNullHandling}}function Bct(t,e={}){let r=t,n=oXo(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):YR(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=fqr[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||pqr(a,mqr(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 eXo,fqr,YR,tXo,pqr,rXo,Lm,Uct,hqr=v(()=>{dqr();Fct();eXo=Object.prototype.hasOwnProperty,fqr={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},YR=Array.isArray,tXo=Array.prototype.push,pqr=function(t,e){tXo.apply(t,YR(e)?e:[e])},rXo=Date.prototype.toISOString,Lm={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:lqr,encodeValuesOnly:!1,format:GNe,formatter:XNe[GNe],indices:!1,serializeDate(t){return rXo.call(t)},skipNulls:!1,strictNullHandling:!1};Uct={}});var gqr=v(()=>{hqr()});var TH,yqr=v(()=>{TH="4.95.1"});function _qr(t,e={auto:!1}){if(bqr)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(EH)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${EH}'\``);bqr=e.auto,EH=t.kind,zct=t.fetch,aXo=t.Request,sXo=t.Response,uXo=t.Headers,Vct=t.FormData,lXo=t.Blob,ZNe=t.File,Hct=t.ReadableStream,Jct=t.getMultipartRequestOptions,Wct=t.getDefaultAgent,YNe=t.fileFromPath,Kct=t.isFsReadStream}var bqr,EH,zct,aXo,sXo,uXo,Vct,lXo,ZNe,Hct,Jct,Wct,YNe,Kct,Gct=v(()=>{bqr=!1});var QNe,vqr=v(()=>{QNe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function wqr({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 QNe(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 Sqr=v(()=>{vqr()});var Cqr=v(()=>{Sqr()});var Xct,Kse=v(()=>{Gct();Cqr();Gct();Xct=()=>{EH||_qr(wqr(),{auto:!0})};Xct()});var jr,Fm,nm,_q,vq,Gse,Xse,Zse,Yse,Qse,eue,tue,rue,B9,z9,uw=v(()=>{Ki();jr=class extends Error{},Fm=class t extends jr{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 _q({message:n,cause:e1e(r)});let i=r?.error;return e===400?new Gse(e,i,n,o):e===401?new Xse(e,i,n,o):e===403?new Zse(e,i,n,o):e===404?new Yse(e,i,n,o):e===409?new Qse(e,i,n,o):e===422?new eue(e,i,n,o):e===429?new tue(e,i,n,o):e>=500?new rue(e,i,n,o):new t(e,i,n,o)}},nm=class extends Fm{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},_q=class extends Fm{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},vq=class extends _q{constructor({message:e}={}){super({message:e??"Request timed out."})}},Gse=class extends Fm{},Xse=class extends Fm{},Zse=class extends Fm{},Yse=class extends Fm{},Qse=class extends Fm{},eue=class extends Fm{},tue=class extends Fm{},rue=class extends Fm{},B9=class extends jr{constructor(){super("Could not parse response content as the length limit was reached")}},z9=class extends jr{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}});function pXo(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 xqr(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 t1e,PH,lw,MH,Oqr=v(()=>{uw();t1e=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},PH=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)},MH=class{constructor(){lw.set(this,void 0),this.buffer=new Uint8Array,t1e(this,lw,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=pXo(this.buffer,PH(this,lw,"f")))!=null;){if(i.carriage&&PH(this,lw,"f")==null){t1e(this,lw,i.index,"f");continue}if(PH(this,lw,"f")!=null&&(i.index!==PH(this,lw,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,PH(this,lw,"f")-1))),this.buffer=this.buffer.slice(PH(this,lw,"f")),t1e(this,lw,null,"f");continue}let a=PH(this,lw,"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),t1e(this,lw,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 jr(`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 jr(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new jr("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
|
||
`):[]}};lw=new WeakMap;MH.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);MH.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function Zct(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 Tqr=v(()=>{});async function*mXo(t,e){if(!t.body)throw e.abort(),new jr("Attempted to iterate over a response with no body");let r=new Yct,n=new MH,o=Zct(t.body);for await(let i of hXo(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*hXo(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=xqr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function gXo(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var QR,Yct,r1e=v(()=>{Kse();uw();Oqr();Tqr();Ki();uw();QR=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 mXo(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 Fm(void 0,s.error,void 0,Qct(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 Fm(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 MH,s=Zct(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 Hct({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?.()}})}};Yct=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]=gXo(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function rdt(t,e,r){if(t=await t,Pqr(t))return t;if(Eqr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=nue(o)?[await o.arrayBuffer()]:[o];return new ZNe(i,e,r)}let n=await bXo(t);if(e||(e=vXo(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new ZNe(n,e,r)}async function bXo(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(nue(t))e.push(await t.arrayBuffer());else if(wXo(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${_Xo(t)}`);return e}function _Xo(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function vXo(t){return edt(t.name)||edt(t.filename)||edt(t.path)?.split(/[\\/]/).pop()}var Eqr,Pqr,nue,yXo,edt,wXo,ndt,u0,Mqr,tdt,n1e=v(()=>{Kse();Kse();Eqr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",Pqr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&nue(t),nue=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",yXo=t=>Pqr(t)||Eqr(t)||Kct(t);edt=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},wXo=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",ndt=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",u0=async t=>{let e=await Mqr(t.body);return Jct(e,t)},Mqr=async t=>{let e=new Vct;return await Promise.all(Object.entries(t||{}).map(([r,n])=>tdt(e,r,n))),e},tdt=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(yXo(r)){let n=await rdt(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>tdt(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>tdt(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 Dqr(t){let{response:e}=t;if(t.options.stream)return vD("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):QR.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 vD("response",e.status,e.url,e.headers,a),$qr(a,e)}let i=await e.text();return vD("response",e.status,e.url,e.headers,i),i}function $qr(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 EXo(){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 Lqr(t){if(!t)return!0;for(let e in t)return!1;return!0}function Fqr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Nqr(t,e){for(let r in e){if(!Fqr(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 vD(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)jqr.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)jqr.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}function aue(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var CXo,xXo,o1e,a1e,s1e,oue,idt,Qct,OXo,Xo,TXo,Iqr,Rqr,Aqr,PXo,MXo,IXo,RXo,wD,odt,e1e,iue,jqr,AXo,kqr,NXo,i1e,qqr,Ki=v(()=>{yqr();r1e();uw();Kse();n1e();n1e();CXo=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},xXo=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)};Xct();a1e=class t extends Promise{constructor(e,r=Dqr){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>$qr(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)}},s1e=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=odt("maxRetries",r),this.timeout=odt("timeout",n),this.httpAgent=o,this.fetch=i??zct}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...PXo(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${AXo()}`}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&&nue(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:ndt(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&&odt("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??Wct(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 Nqr(i,a),Nqr(i,r),ndt(e.body)&&EH!=="node"&&delete i["content-type"],i1e(a,"x-stainless-retry-count")===void 0&&i1e(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),i1e(a,"x-stainless-timeout")===void 0&&i1e(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 Fm.generate(e,r,n,o)}request(e,r=null){return new a1e(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}),vD("request",a,n,i.headers),n.signal?.aborted)throw new nm;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(e1e);if(l instanceof Error){if(n.signal?.aborted)throw new nm;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new vq:new _q({cause:l})}let c=Qct(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let y=`retrying, ${r} attempts remaining`;return vD(`response (error; ${y})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(y=>e1e(y).message),f=MXo(d),p=f?void 0:d;throw vD(`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 idt(this,n,e)}buildURL(e,r){let n=RXo(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return Lqr(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 jr(`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 wD(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 ${TH}`}},oue=class{constructor(e,r,n,o){o1e.set(this,void 0),CXo(this,o1e,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 jr("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 xXo(this,o1e,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(o1e=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},idt=class extends a1e{constructor(e,r,n){super(r,async o=>new n(e,o.response,await Dqr(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},Qct=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),OXo={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},Xo=t=>typeof t=="object"&&t!==null&&!Lqr(t)&&Object.keys(t).every(e=>Fqr(OXo,e)),TXo=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":TH,"X-Stainless-OS":Rqr(Deno.build.os),"X-Stainless-Arch":Iqr(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":TH,"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":TH,"X-Stainless-OS":Rqr(process.platform),"X-Stainless-Arch":Iqr(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=EXo();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":TH,"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":TH,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};Iqr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Rqr=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"),PXo=()=>Aqr??(Aqr=TXo()),MXo=t=>{try{return JSON.parse(t)}catch{return}},IXo=/^[a-z][a-z0-9+.-]*:/i,RXo=t=>IXo.test(t),wD=t=>new Promise(e=>setTimeout(e,t)),odt=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new jr(`${t} must be an integer`);if(e<0)throw new jr(`${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)},iue=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};jqr=new Set(["authorization","api-key"]);AXo=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),kqr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",NXo=t=>typeof t?.get=="function",i1e=(t,e)=>{let r=e.toLowerCase();if(NXo(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},qqr=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 eA,Ga,Th=v(()=>{Ki();eA=class extends oue{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}},Ga=class extends oue{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 At,oi=v(()=>{At=class{constructor(e){this._client=e}}});var V9,adt=v(()=>{oi();Ki();sue();V9=class extends At{list(e,r={},n){return Xo(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,u1e,{query:r,...n})}}});var Sq,Cq,u1e,sue=v(()=>{oi();Ki();adt();adt();Th();Sq=class extends At{constructor(){super(...arguments),this.messages=new V9(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 Xo(e)?this.list({},e):this._client.getAPIList("/chat/completions",Cq,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},Cq=class extends Ga{},u1e=class extends Ga{};Sq.ChatCompletionsPage=Cq;Sq.Messages=V9});var SD,sdt=v(()=>{oi();sue();sue();SD=class extends At{constructor(){super(...arguments),this.completions=new Sq(this._client)}};SD.Completions=Sq;SD.ChatCompletionsPage=Cq});var Uqr=v(()=>{sdt()});var Bqr=v(()=>{});var H9,udt=v(()=>{oi();H9=class extends At{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var J9,ldt=v(()=>{oi();Ki();J9=class extends At{create(e,r){return this._client.post("/audio/transcriptions",u0({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}}});var W9,cdt=v(()=>{oi();Ki();W9=class extends At{create(e,r){return this._client.post("/audio/translations",u0({body:e,...r,__metadata:{model:e.model}}))}}});var tA,ddt=v(()=>{oi();udt();udt();ldt();ldt();cdt();cdt();tA=class extends At{constructor(){super(...arguments),this.transcriptions=new J9(this._client),this.translations=new W9(this._client),this.speech=new H9(this._client)}};tA.Transcriptions=J9;tA.Translations=W9;tA.Speech=H9});var xq,IH,fdt=v(()=>{oi();Ki();Th();xq=class extends At{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 Xo(e)?this.list({},e):this._client.getAPIList("/batches",IH,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},IH=class extends Ga{};xq.BatchesPage=IH});var RH,K9,pdt=v(()=>{oi();Ki();Th();RH=class extends At{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 Xo(e)?this.list({},e):this._client.getAPIList("/assistants",K9,{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}})}},K9=class extends Ga{};RH.AssistantsPage=K9});function mdt(t){return typeof t.parse=="function"}var zqr=v(()=>{});var Oq,hdt,gdt,ydt=v(()=>{Oq=t=>t?.role==="assistant",hdt=t=>t?.role==="function",gdt=t=>t?.role==="tool"});var ix,gc,bdt,l1e,c1e,uue,lue,d1e,cue,CD,due,f1e,p1e,G9,Vqr,Tq,m1e=v(()=>{uw();ix=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},gc=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)},Tq=class{constructor(){bdt.add(this),this.controller=new AbortController,l1e.set(this,void 0),c1e.set(this,()=>{}),uue.set(this,()=>{}),lue.set(this,void 0),d1e.set(this,()=>{}),cue.set(this,()=>{}),CD.set(this,{}),due.set(this,!1),f1e.set(this,!1),p1e.set(this,!1),G9.set(this,!1),ix(this,l1e,new Promise((e,r)=>{ix(this,c1e,e,"f"),ix(this,uue,r,"f")}),"f"),ix(this,lue,new Promise((e,r)=>{ix(this,d1e,e,"f"),ix(this,cue,r,"f")}),"f"),gc(this,l1e,"f").catch(()=>{}),gc(this,lue,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},gc(this,bdt,"m",Vqr).bind(this))},0)}_connected(){this.ended||(gc(this,c1e,"f").call(this),this._emit("connect"))}get ended(){return gc(this,due,"f")}get errored(){return gc(this,f1e,"f")}get aborted(){return gc(this,p1e,"f")}abort(){this.controller.abort()}on(e,r){return(gc(this,CD,"f")[e]||(gc(this,CD,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=gc(this,CD,"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(gc(this,CD,"f")[e]||(gc(this,CD,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ix(this,G9,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ix(this,G9,!0,"f"),await gc(this,lue,"f")}_emit(e,...r){if(gc(this,due,"f"))return;e==="end"&&(ix(this,due,!0,"f"),gc(this,d1e,"f").call(this));let n=gc(this,CD,"f")[e];if(n&&(gc(this,CD,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!gc(this,G9,"f")&&!n?.length&&Promise.reject(o),gc(this,uue,"f").call(this,o),gc(this,cue,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!gc(this,G9,"f")&&!n?.length&&Promise.reject(o),gc(this,uue,"f").call(this,o),gc(this,cue,"f").call(this,o),this._emit("end")}}_emitFinal(){}};l1e=new WeakMap,c1e=new WeakMap,uue=new WeakMap,lue=new WeakMap,d1e=new WeakMap,cue=new WeakMap,CD=new WeakMap,due=new WeakMap,f1e=new WeakMap,p1e=new WeakMap,G9=new WeakMap,bdt=new WeakSet,Vqr=function(e){if(ix(this,f1e,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new nm),e instanceof nm)return ix(this,p1e,!0,"f"),this._emit("abort",e);if(e instanceof jr)return this._emit("error",e);if(e instanceof Error){let r=new jr(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new jr(String(e)))}});function fue(t){return t?.$brand==="auto-parseable-response-format"}function AH(t){return t?.$brand==="auto-parseable-tool"}function Hqr(t,e){return!e||!_dt(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}}))}:pue(t,e)}function pue(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new B9;if(n.finish_reason==="content_filter")throw new z9;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>UXo(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?qXo(e,n.message.content):null}}});return{...t,choices:r}}function qXo(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 UXo(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:AH(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function Jqr(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return AH(r)||r?.function.strict||!1}function _dt(t){return fue(t.response_format)?!0:t.tools?.some(e=>AH(e)||e.type==="function"&&e.function.strict===!0)??!1}function Wqr(t){for(let e of t??[]){if(e.type!=="function")throw new jr(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new jr(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var mue=v(()=>{uw()});var q_,Ry,vdt,h1e,wdt,Sdt,Cdt,Gqr,xdt,Kqr,X9,Odt=v(()=>{uw();zqr();ydt();m1e();mue();q_=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)},Kqr=10,X9=class extends Tq{constructor(){super(...arguments),Ry.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),(hdt(e)||gdt(e))&&e.content)this._emit("functionCallResult",e.content);else if(Oq(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(Oq(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 jr("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),q_(this,Ry,"m",vdt).call(this)}async finalMessage(){return await this.done(),q_(this,Ry,"m",h1e).call(this)}async finalFunctionCall(){return await this.done(),q_(this,Ry,"m",wdt).call(this)}async finalFunctionCallResult(){return await this.done(),q_(this,Ry,"m",Sdt).call(this)}async totalUsage(){return await this.done(),q_(this,Ry,"m",Cdt).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=q_(this,Ry,"m",h1e).call(this);r&&this._emit("finalMessage",r);let n=q_(this,Ry,"m",vdt).call(this);n&&this._emit("finalContent",n);let o=q_(this,Ry,"m",wdt).call(this);o&&this._emit("finalFunctionCall",o);let i=q_(this,Ry,"m",Sdt).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",q_(this,Ry,"m",Cdt).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),q_(this,Ry,"m",Gqr).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(pue(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=Kqr}=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 jr("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 O=`Invalid function_call: ${JSON.stringify(h)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,name:h,content:O});continue}}else{let O=`Invalid function_call: ${JSON.stringify(h)}. Available options are: ${d.map(T=>JSON.stringify(T.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:h,content:O});continue}let b;try{b=mdt(g)?await g.parse(y):y}catch(O){this._addMessage({role:o,name:h,content:O instanceof Error?O.message:String(O)});continue}let _=await g.function(b,this),w=q_(this,Ry,"m",xdt).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=Kqr}=n||{},c=r.tools.map(p=>{if(AH(p)){if(!p.$callback)throw new jr("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 jr("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 M=`Invalid tool_call: ${JSON.stringify(b)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:g,content:M});continue}}else{let M=`Invalid tool_call: ${JSON.stringify(b)}. Available options are: ${Object.keys(d).map(I=>JSON.stringify(I)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:g,content:M});continue}let O;try{O=mdt(w)?await w.parse(_):_}catch(M){let I=M instanceof Error?M.message:String(M);this._addMessage({role:o,tool_call_id:g,content:I});continue}let T=await w.function(O,this),P=q_(this,Ry,"m",xdt).call(this,T);if(this._addMessage({role:o,tool_call_id:g,content:P}),u)return}}}};Ry=new WeakSet,vdt=function(){return q_(this,Ry,"m",h1e).call(this).content??null},h1e=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(Oq(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 jr("stream ended without producing a ChatCompletionMessage with role=assistant")},wdt=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Oq(r)&&r?.function_call)return r.function_call;if(Oq(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},Sdt=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(hdt(r)&&r.content!=null||gdt(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}},Cdt=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},Gqr=function(e){if(e.n!=null&&e.n>1)throw new jr("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},xdt=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var hue,Xqr=v(()=>{Odt();ydt();hue=class t extends X9{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),Oq(e)&&e.content&&this._emit("content",e.content)}}});function BXo(t,e=Eh.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return zXo(t.trim(),e)}var Eh,Tdt,Edt,zXo,Pdt,Zqr=v(()=>{Eh={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},Tdt=class extends Error{},Edt=class extends Error{};zXo=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Tdt(`${f} at position ${n}`)},i=f=>{throw new Edt(`${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"||Eh.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||Eh.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||Eh.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||Eh.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||Eh.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||Eh.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(Eh.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&&Eh.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(Eh.OBJ&e)return f;throw m}d(),t[n]===","&&n++}}catch{if(Eh.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(Eh.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},c=()=>{if(n===0){t==="-"&&Eh.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(p){if(Eh.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&&!(Eh.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&Eh.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()},Pdt=t=>BXo(t,Eh.ALL^Eh.NUM)});function VXo(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 jr(`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 jr(`missing role for choice ${d}`);if(h){let{arguments:_,name:w}=h;if(_==null)throw new jr(`missing function_call.arguments for choice ${d}`);if(!w)throw new jr(`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:O,type:T,id:P,...M}=_,{arguments:I,name:j,...A}=O||{};if(P==null)throw new jr(`missing choices[${d}].tool_calls[${w}].id
|
||
${b1e(t)}`);if(T==null)throw new jr(`missing choices[${d}].tool_calls[${w}].type
|
||
${b1e(t)}`);if(j==null)throw new jr(`missing choices[${d}].tool_calls[${w}].function.name
|
||
${b1e(t)}`);if(I==null)throw new jr(`missing choices[${d}].tool_calls[${w}].function.arguments
|
||
${b1e(t)}`);return{...M,id:P,type:T,function:{...A,name:j,arguments:I}}})}}:{...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 Hqr(u,e)}function b1e(t){return JSON.stringify(t)}var Z9,vu,km,xD,Y9,Eq,Mdt,g1e,Idt,Rdt,Adt,y1e,Ndt,Yqr,Q9,jdt=v(()=>{uw();Odt();r1e();mue();Zqr();Z9=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},vu=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)},Q9=class t extends X9{constructor(e){super(),km.add(this),xD.set(this,void 0),Y9.set(this,void 0),Eq.set(this,void 0),Z9(this,xD,e,"f"),Z9(this,Y9,[],"f")}get currentChatCompletionSnapshot(){return vu(this,Eq,"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())),vu(this,km,"m",Mdt).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)vu(this,km,"m",Idt).call(this,a);if(i.controller.signal?.aborted)throw new nm;return this._addChatCompletion(vu(this,km,"m",y1e).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),vu(this,km,"m",Mdt).call(this),this._connected();let o=QR.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(vu(this,km,"m",y1e).call(this)),vu(this,km,"m",Idt).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new nm;return this._addChatCompletion(vu(this,km,"m",y1e).call(this))}[(xD=new WeakMap,Y9=new WeakMap,Eq=new WeakMap,km=new WeakSet,Mdt=function(){this.ended||Z9(this,Eq,void 0,"f")},g1e=function(r){let n=vu(this,Y9,"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},vu(this,Y9,"f")[r.index]=n,n)},Idt=function(r){if(this.ended)return;let n=vu(this,km,"m",Yqr).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=vu(this,km,"m",g1e).call(this,i);i.finish_reason&&(vu(this,km,"m",Adt).call(this,i),a.current_tool_call_index!=null&&vu(this,km,"m",Rdt).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(vu(this,km,"m",Adt).call(this,i),a.current_tool_call_index!=null&&vu(this,km,"m",Rdt).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))}}},Rdt=function(r,n){if(vu(this,km,"m",g1e).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=vu(this,xD,"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:AH(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Adt=function(r){let n=vu(this,km,"m",g1e).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=vu(this,km,"m",Ndt).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}))},y1e=function(){if(this.ended)throw new jr("stream has ended, this shouldn't happen");let r=vu(this,Eq,"f");if(!r)throw new jr("request ended without sending any chunks");return Z9(this,Eq,void 0,"f"),Z9(this,Y9,[],"f"),VXo(r,vu(this,xD,"f"))},Ndt=function(){let r=vu(this,xD,"f")?.response_format;return fue(r)?r:null},Yqr=function(r){var n,o,i,a;let s=vu(this,Eq,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=Z9(this,Eq,{...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:T,refusal:P,...M}=p;Object.assign(h.logprobs,M),T&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...T)),P&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...P))}if(d&&(h.finish_reason=d,vu(this,xD,"f")&&_dt(vu(this,xD,"f")))){if(d==="length")throw new B9;if(d==="content_filter")throw new z9}if(Object.assign(h,m),!c)continue;let{content:y,refusal:g,function_call:b,role:_,tool_calls:w,...O}=c;if(Object.assign(h.message,O),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&&vu(this,km,"m",Ndt).call(this)&&(h.message.parsed=Pdt(h.message.content))),w){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:T,id:P,type:M,function:I,...j}of w){let A=(a=h.message.tool_calls)[T]??(a[T]={});Object.assign(A,j),P&&(A.id=P),M&&(A.type=M),I&&(A.function??(A.function={name:I.name??"",arguments:""})),I?.name&&(A.function.name=I.name),I?.arguments&&(A.function.arguments+=I.arguments,Jqr(vu(this,xD,"f"),A)&&(A.function.parsed_arguments=Pdt(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 QR(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var gue,Qqr=v(()=>{jdt();gue=class t extends Q9{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 yue,eUr=v(()=>{oi();Xqr();Qqr();jdt();mue();yue=class extends At{parse(e,r){return Wqr(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>pue(n,e))}runFunctions(e,r){return e.stream?gue.runFunctions(this._client,e,r):hue.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?gue.runTools(this._client,e,r):hue.runTools(this._client,e,r)}stream(e,r){return Q9.createChatCompletion(this._client,e,r)}}});var e7,tUr=v(()=>{oi();eUr();e7=class extends At{constructor(){super(...arguments),this.completions=new yue(this._client)}};(function(t){t.Completions=yue})(e7||(e7={}))});var t7,Ddt=v(()=>{oi();t7=class extends At{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var r7,$dt=v(()=>{oi();r7=class extends At{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var Pq,Ldt=v(()=>{oi();Ddt();Ddt();$dt();$dt();Pq=class extends At{constructor(){super(...arguments),this.sessions=new t7(this._client),this.transcriptionSessions=new r7(this._client)}};Pq.Sessions=t7;Pq.TranscriptionSessions=r7});var Qr,cw,Ng,Fdt,rA,_1e,ax,jH,n7,NH,S1e,dw,v1e,w1e,vue,bue,_ue,rUr,nUr,oUr,iUr,aUr,sUr,uUr,nA,kdt=v(()=>{Ki();r1e();uw();m1e();Qr=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)},cw=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},nA=class t extends Tq{constructor(){super(...arguments),Ng.add(this),Fdt.set(this,[]),rA.set(this,{}),_1e.set(this,{}),ax.set(this,void 0),jH.set(this,void 0),n7.set(this,void 0),NH.set(this,void 0),S1e.set(this,void 0),dw.set(this,void 0),v1e.set(this,void 0),w1e.set(this,void 0),vue.set(this,void 0)}[(Fdt=new WeakMap,rA=new WeakMap,_1e=new WeakMap,ax=new WeakMap,jH=new WeakMap,n7=new WeakMap,NH=new WeakMap,S1e=new WeakMap,dw=new WeakMap,v1e=new WeakMap,w1e=new WeakMap,vue=new WeakMap,Ng=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=QR.fromReadableStream(e,this.controller);for await(let i of o)Qr(this,Ng,"m",bue).call(this,i);if(o.controller.signal?.aborted)throw new nm;return this._addRun(Qr(this,Ng,"m",_ue).call(this))}toReadableStream(){return new QR(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)Qr(this,Ng,"m",bue).call(this,l);if(u.controller.signal?.aborted)throw new nm;return this._addRun(Qr(this,Ng,"m",_ue).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 Qr(this,v1e,"f")}currentRun(){return Qr(this,w1e,"f")}currentMessageSnapshot(){return Qr(this,ax,"f")}currentRunStepSnapshot(){return Qr(this,vue,"f")}async finalRunSteps(){return await this.done(),Object.values(Qr(this,rA,"f"))}async finalMessages(){return await this.done(),Object.values(Qr(this,_1e,"f"))}async finalRun(){if(await this.done(),!Qr(this,jH,"f"))throw Error("Final run was not received.");return Qr(this,jH,"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)Qr(this,Ng,"m",bue).call(this,s);if(a.controller.signal?.aborted)throw new nm;return this._addRun(Qr(this,Ng,"m",_ue).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)Qr(this,Ng,"m",bue).call(this,u);if(s.controller.signal?.aborted)throw new nm;return this._addRun(Qr(this,Ng,"m",_ue).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(aue(i)&&aue(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(!aue(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)}};bue=function(e){if(!this.ended)switch(cw(this,v1e,e,"f"),Qr(this,Ng,"m",oUr).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":Qr(this,Ng,"m",uUr).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":Qr(this,Ng,"m",nUr).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":Qr(this,Ng,"m",rUr).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},_ue=function(){if(this.ended)throw new jr("stream has ended, this shouldn't happen");if(!Qr(this,jH,"f"))throw Error("Final run has not been received");return Qr(this,jH,"f")},rUr=function(e){let[r,n]=Qr(this,Ng,"m",aUr).call(this,e,Qr(this,ax,"f"));cw(this,ax,r,"f"),Qr(this,_1e,"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!=Qr(this,n7,"f")){if(Qr(this,NH,"f"))switch(Qr(this,NH,"f").type){case"text":this._emit("textDone",Qr(this,NH,"f").text,Qr(this,ax,"f"));break;case"image_file":this._emit("imageFileDone",Qr(this,NH,"f").image_file,Qr(this,ax,"f"));break}cw(this,n7,o.index,"f")}cw(this,NH,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(Qr(this,n7,"f")!==void 0){let o=e.data.content[Qr(this,n7,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,Qr(this,ax,"f"));break;case"text":this._emit("textDone",o.text,Qr(this,ax,"f"));break}}Qr(this,ax,"f")&&this._emit("messageDone",e.data),cw(this,ax,void 0,"f")}},nUr=function(e){let r=Qr(this,Ng,"m",iUr).call(this,e);switch(cw(this,vue,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==Qr(this,S1e,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(Qr(this,dw,"f")&&this._emit("toolCallDone",Qr(this,dw,"f")),cw(this,S1e,i.index,"f"),cw(this,dw,r.step_details.tool_calls[i.index],"f"),Qr(this,dw,"f")&&this._emit("toolCallCreated",Qr(this,dw,"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":cw(this,vue,void 0,"f"),e.data.step_details.type=="tool_calls"&&Qr(this,dw,"f")&&(this._emit("toolCallDone",Qr(this,dw,"f")),cw(this,dw,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},oUr=function(e){Qr(this,Fdt,"f").push(e),this._emit("event",e)},iUr=function(e){switch(e.event){case"thread.run.step.created":return Qr(this,rA,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=Qr(this,rA,"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=nA.accumulateDelta(r,n.delta);Qr(this,rA,"f")[e.data.id]=o}return Qr(this,rA,"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":Qr(this,rA,"f")[e.data.id]=e.data;break}if(Qr(this,rA,"f")[e.data.id])return Qr(this,rA,"f")[e.data.id];throw new Error("No snapshot available")},aUr=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]=Qr(this,Ng,"m",sUr).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")},sUr=function(e,r){return nA.accumulateDelta(r,e)},uUr=function(e){switch(cw(this,w1e,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":cw(this,jH,e.data,"f"),Qr(this,dw,"f")&&(this._emit("toolCallDone",Qr(this,dw,"f")),cw(this,dw,void 0,"f"));break;case"thread.run.cancelling":break}}});var DH,o7,qdt=v(()=>{oi();Ki();Th();DH=class extends At{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 Xo(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,o7,{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}})}},o7=class extends Ga{};DH.MessagesPage=o7});var $H,i7,Udt=v(()=>{oi();Ki();Th();$H=class extends At{retrieve(e,r,n,o={},i){return Xo(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 Xo(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,i7,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},i7=class extends Ga{};$H.RunStepsPage=i7});var OD,a7,Bdt=v(()=>{oi();Ki();kdt();Ki();Udt();Udt();Th();OD=class extends At{constructor(){super(...arguments),this.steps=new $H(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 Xo(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,a7,{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 nA.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 wD(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return nA.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 nA.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},a7=class extends Ga{};OD.RunsPage=a7;OD.Steps=$H;OD.RunStepsPage=i7});var oA,zdt=v(()=>{oi();Ki();kdt();qdt();qdt();Bdt();Bdt();oA=class extends At{constructor(){super(...arguments),this.runs=new OD(this._client),this.messages=new DH(this._client)}create(e={},r){return Xo(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 nA.createThreadAssistantStream(e,this._client.beta.threads,r)}};oA.Runs=OD;oA.RunsPage=a7;oA.Messages=DH;oA.MessagesPage=o7});var sx,Vdt=v(()=>{oi();pdt();tUr();pdt();Ldt();Ldt();zdt();zdt();sx=class extends At{constructor(){super(...arguments),this.realtime=new Pq(this._client),this.chat=new e7(this._client),this.assistants=new RH(this._client),this.threads=new oA(this._client)}};sx.Realtime=Pq;sx.Assistants=RH;sx.AssistantsPage=K9;sx.Threads=oA});var LH,Hdt=v(()=>{oi();LH=class extends At{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var FH,Jdt=v(()=>{oi();Ki();FH=class extends At{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&vD("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(vD("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=qqr(u)}),a)))}}});var kH,s7,Wdt=v(()=>{oi();Ki();Th();kH=class extends At{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return Xo(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,s7,{query:n,...o})}},s7=class extends Ga{};kH.OutputItemListResponsesPage=s7});var TD,u7,Kdt=v(()=>{oi();Ki();Wdt();Wdt();Th();TD=class extends At{constructor(){super(...arguments),this.outputItems=new kH(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 Xo(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,u7,{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)}},u7=class extends Ga{};TD.RunListResponsesPage=u7;TD.OutputItems=kH;TD.OutputItemListResponsesPage=s7});var iA,qH,Gdt=v(()=>{oi();Ki();Kdt();Kdt();Th();iA=class extends At{constructor(){super(...arguments),this.runs=new TD(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 Xo(e)?this.list({},e):this._client.getAPIList("/evals",qH,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},qH=class extends Ga{};iA.EvalListResponsesPage=qH;iA.Runs=TD;iA.RunListResponsesPage=u7});var Mq,UH,Xdt=v(()=>{oi();Ki();Ki();uw();Ki();Th();Mq=class extends At{create(e,r){return this._client.post("/files",u0({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return Xo(e)?this.list({},e):this._client.getAPIList("/files",UH,{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 wD(r),a=await this.retrieve(e),Date.now()-i>n)throw new vq({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},UH=class extends Ga{};Mq.FileObjectsPage=UH});var BH,l7,Zdt=v(()=>{oi();Ki();Th();BH=class extends At{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,l7,{body:r,method:"post",...n})}retrieve(e,r={},n){return Xo(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)}},l7=class extends eA{};BH.PermissionCreateResponsesPage=l7});var Iq,Ydt=v(()=>{oi();Zdt();Zdt();Iq=class extends At{constructor(){super(...arguments),this.permissions=new BH(this._client)}};Iq.Permissions=BH;Iq.PermissionCreateResponsesPage=l7});var zH,c7,Qdt=v(()=>{oi();Ki();Th();zH=class extends At{list(e,r={},n){return Xo(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,c7,{query:r,...n})}},c7=class extends Ga{};zH.FineTuningJobCheckpointsPage=c7});var aA,d7,f7,eft=v(()=>{oi();Ki();Qdt();Qdt();Th();aA=class extends At{constructor(){super(...arguments),this.checkpoints=new zH(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 Xo(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",d7,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return Xo(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,f7,{query:r,...n})}},d7=class extends Ga{},f7=class extends Ga{};aA.FineTuningJobsPage=d7;aA.FineTuningJobEventsPage=f7;aA.Checkpoints=zH;aA.FineTuningJobCheckpointsPage=c7});var ux,tft=v(()=>{oi();Ydt();Ydt();eft();eft();ux=class extends At{constructor(){super(...arguments),this.jobs=new aA(this._client),this.checkpoints=new Iq(this._client)}};ux.Jobs=aA;ux.FineTuningJobsPage=d7;ux.FineTuningJobEventsPage=f7;ux.Checkpoints=Iq});var VH,rft=v(()=>{oi();Ki();VH=class extends At{createVariation(e,r){return this._client.post("/images/variations",u0({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",u0({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}}});var Rq,HH,nft=v(()=>{oi();Th();Rq=class extends At{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",HH,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},HH=class extends eA{};Rq.ModelsPage=HH});var JH,oft=v(()=>{oi();JH=class extends At{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function lUr(t,e){return!e||!sZo(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)}:ift(t,e)}function ift(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:cZo(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:aZo(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||aft(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 aZo(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function sZo(t){return!!fue(t.text?.format)}function uZo(t){return t?.$brand==="auto-parseable-tool"}function lZo(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function cZo(t,e){let r=lZo(t.tools??[],e.name);return{...e,...e,parsed_arguments:uZo(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function aft(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 sft=v(()=>{mue()});var p7,uft=v(()=>{oi();Ki();x1e();p7=class extends At{list(e,r={},n){return Xo(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,C1e,{query:r,...n})}}});function fZo(t,e){return lUr(t,e)}var m7,Aq,h7,O1e,Nq,T1e,cUr,dUr,fUr,pUr,E1e,mUr=v(()=>{uw();m1e();sft();m7=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},Aq=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)},E1e=class t extends Tq{constructor(e){super(),h7.add(this),O1e.set(this,void 0),Nq.set(this,void 0),T1e.set(this,void 0),m7(this,O1e,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())),Aq(this,h7,"m",cUr).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)Aq(this,h7,"m",dUr).call(this,a);if(i.controller.signal?.aborted)throw new nm;return Aq(this,h7,"m",fUr).call(this)}[(O1e=new WeakMap,Nq=new WeakMap,T1e=new WeakMap,h7=new WeakSet,cUr=function(){this.ended||m7(this,Nq,void 0,"f")},dUr=function(r){if(this.ended)return;let n=Aq(this,h7,"m",pUr).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 jr(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new jr(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new jr(`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 jr(`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}},fUr=function(){if(this.ended)throw new jr("stream has ended, this shouldn't happen");let r=Aq(this,Nq,"f");if(!r)throw new jr("request ended without sending any events");m7(this,Nq,void 0,"f");let n=fZo(r,Aq(this,O1e,"f"));return m7(this,T1e,n,"f"),n},pUr=function(r){let n=Aq(this,Nq,"f");if(!n){if(r.type!=="response.created")throw new jr(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=m7(this,Nq,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 jr(`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 jr(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new jr(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new jr(`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 jr(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{m7(this,Nq,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=Aq(this,T1e,"f");if(!e)throw new jr("stream ended without producing a ChatCompletion");return e}}});var jq,C1e,x1e=v(()=>{sft();Ki();oi();uft();uft();mUr();Th();jq=class extends At{constructor(){super(...arguments),this.inputItems=new p7(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"&&aft(n),n))}retrieve(e,r={},n){return Xo(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=>ift(n,e))}stream(e,r){return E1e.createResponse(this._client,e,r)}},C1e=class extends Ga{};jq.InputItems=p7});var g7,lft=v(()=>{oi();Ki();g7=class extends At{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,u0({body:r,...n}))}}});var Dq,cft=v(()=>{oi();lft();lft();Dq=class extends At{constructor(){super(...arguments),this.parts=new g7(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})}};Dq.Parts=g7});var hUr,gUr=v(()=>{hUr=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 $q,Lq,y7,P1e=v(()=>{oi();Ki();Th();$q=class extends At{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 Xo(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,Lq,{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 wD(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`,y7,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},Lq=class extends Ga{},y7=class extends eA{};$q.VectorStoreFilesPage=Lq;$q.FileContentResponsesPage=y7});var b7,dft=v(()=>{oi();Ki();Ki();gUr();P1e();b7=class extends At{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 Xo(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,Lq,{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 wD(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 hUr(d),await this.createAndPoll(e,{file_ids:l})}}});var fw,WH,KH,fft=v(()=>{oi();Ki();dft();dft();P1e();P1e();Th();fw=class extends At{constructor(){super(...arguments),this.files=new $q(this._client),this.fileBatches=new b7(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 Xo(e)?this.list({},e):this._client.getAPIList("/vector_stores",WH,{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`,KH,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},WH=class extends Ga{},KH=class extends eA{};fw.VectorStoresPage=WH;fw.VectorStoreSearchResponsesPage=KH;fw.Files=$q;fw.VectorStoreFilesPage=Lq;fw.FileContentResponsesPage=y7;fw.FileBatches=b7});var yUr=v(()=>{Uqr();Bqr();ddt();fdt();Vdt();Hdt();Jdt();Gdt();Xdt();tft();rft();nft();oft();x1e();cft();fft()});var bUr,ko,_Ur,vUr=v(()=>{gqr();Ki();uw();n1e();yUr();fdt();Hdt();Jdt();Xdt();rft();nft();oft();ddt();Vdt();sdt();Gdt();tft();x1e();cft();fft();sue();ko=class extends s1e{constructor({baseURL:e=iue("OPENAI_BASE_URL"),apiKey:r=iue("OPENAI_API_KEY"),organization:n=iue("OPENAI_ORG_ID")??null,project:o=iue("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new jr("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&&kqr())throw new jr(`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 LH(this),this.chat=new SD(this),this.embeddings=new FH(this),this.files=new Mq(this),this.images=new VH(this),this.audio=new tA(this),this.moderations=new JH(this),this.models=new Rq(this),this.fineTuning=new ux(this),this.vectorStores=new fw(this),this.beta=new sx(this),this.batches=new xq(this),this.uploads=new Dq(this),this.responses=new jq(this),this.evals=new iA(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 Bct(e,{arrayFormat:"brackets"})}};bUr=ko;ko.OpenAI=bUr;ko.DEFAULT_TIMEOUT=6e5;ko.OpenAIError=jr;ko.APIError=Fm;ko.APIConnectionError=_q;ko.APIConnectionTimeoutError=vq;ko.APIUserAbortError=nm;ko.NotFoundError=Yse;ko.ConflictError=Qse;ko.RateLimitError=tue;ko.BadRequestError=Gse;ko.AuthenticationError=Xse;ko.InternalServerError=rue;ko.PermissionDeniedError=Zse;ko.UnprocessableEntityError=eue;ko.toFile=rdt;ko.fileFromPath=YNe;ko.Completions=LH;ko.Chat=SD;ko.ChatCompletionsPage=Cq;ko.Embeddings=FH;ko.Files=Mq;ko.FileObjectsPage=UH;ko.Images=VH;ko.Audio=tA;ko.Moderations=JH;ko.Models=Rq;ko.ModelsPage=HH;ko.FineTuning=ux;ko.VectorStores=fw;ko.VectorStoresPage=WH;ko.VectorStoreSearchResponsesPage=KH;ko.Beta=sx;ko.Batches=xq;ko.BatchesPage=IH;ko.Uploads=Dq;ko.Responses=jq;ko.Evals=iA;ko.EvalListResponsesPage=qH;_Ur=ko});var M1e,wUr=v(()=>{Qa();id();oV();vUr();_t();M1e=class extends UC{constructor(e){let{enableReasoning:r=!1,reasoningEffort:n,...o}=e;super(o),this.enableReasoning=r,this.reasoningEffort=n,this.openaiClient=new _Ur({apiKey:e.apiKey,baseURL:e.configuration?.baseURL||"https://openrouter.ai/api/v1",defaultHeaders:e.configuration?.defaultHeaders,fetch:e.configuration?.fetch,dangerouslyAllowBrowser:!0})}invocationParams(e){let r=super.invocationParams(e);if(this.enableReasoning)if(this.reasoningEffort){let n=this.reasoningEffort==="minimal"?"low":this.reasoningEffort;return B(`OpenRouter reasoning enabled with effort: ${n}`),{...r,reasoning:{effort:n}}}else return B("OpenRouter reasoning enabled with max_tokens: 1024"),{...r,reasoning:{max_tokens:1024}};return r}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 yi({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}:{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 Ir({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 Ir({content:"",response_metadata:{usage:{...e}},usage_metadata:a});return new yi({message:s,text:""})}}});var I1e,SUr=v(()=>{YI();_t();Qa();id();I1e=class extends md{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&&Be("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"}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 p=await i.text();throw new Error(`Amazon Bedrock request failed with status ${i.status}: ${p}`)}let a=await i.json(),s=this.extractText(a);n&&s&&await n.handleLLMNewToken(s);let u=this.extractUsage(a),l=u?this.normaliseUsageMetadata(u):void 0,c={stopReason:a.stop_reason??a.stopReason,usage:u,rawResponse:a};return{generations:[{message:new eo({content:s,response_metadata:c,usage_metadata:l}),text:s,generationInfo:c}],llmOutput:c}}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 Ir({content:m,response_metadata:p.llmOutput??{}});yield new yi({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)}`;B(`[${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(!_){Be(`[${i}] Failed to parse event JSON: ${b.slice(0,100)}...`);continue}let w=_;typeof _.bytes=="string"&&!_.type&&(w={type:"chunk",chunk:{bytes:_.bytes}});let O=await this.processStreamEvent(w,n,c,l);if(c=O.usage??c,l=O.stopReason??l,O.hasText||f.push(this.describeEvent(_)),O.deltaChunks.length>0)for(let T of O.deltaChunks)!(Array.isArray(T.message.content)&&T.message.content.length>0&&T.message.content[0]?.type==="thinking")&&T.text&&(d=!0),yield T;O.debugSummaries.length>0&&f.push(...O.debugSummaries)}}}catch(p){throw ne(`[${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){Be(`[${i}] Stream complete but no answer text yielded (only thinking or no content). Usage: ${JSON.stringify(c)}, stopReason: ${l}`),f.length>0&&B(`[${i}] Amazon Bedrock streaming produced no answer text. Sample events: ${f.slice(0,5).join(" | ")}`),Be(`[${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 yi({message:new Ir({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}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);if(m&&m.length>0){let g=m[0]?.type==="thinking",b=g?m[0].thinking||"":m[0]?.text||"",_={};g&&b&&(_.delta={reasoning:b});let w=new Ir({content:m,response_metadata:p,...Object.keys(_).length>0?{additional_kwargs:_}:{}}),O=new yi({message:w,text:b,generationInfo:p});i.push(O),u=!0,r&&b&&await r.handleLLMNewToken(b)}else{let g=this.extractStreamText(f);if(g){let b=new Ir({content:g,response_metadata:p}),_=new yi({message:b,text:g,generationInfo:p});i.push(_),u=!0,r&&await r.handleLLMNewToken(g)}else if(f.type==="content_block_delta"){let b=`No content in content_block_delta event: ${this.describeEvent(f)}`;l.push(b),Be(`processStreamEvent: ${b}`)}}let h=this.extractUsage(f);h&&(a=h);let y=this.extractStopReason(f);y&&(s=y)}}else{let c=this.buildChunkMetadata(e),d=this.buildContentItemsFromDelta(e);if(d&&d.length>0){let m=d[0]?.type==="thinking",h=m?d[0].thinking||"":d[0]?.text||"",y={};m&&h&&(y.delta={reasoning:h});let g=new Ir({content:d,response_metadata:c,...Object.keys(y).length>0?{additional_kwargs:y}:{}}),b=new yi({message:g,text:h,generationInfo:c});i.push(b),u=!0,r&&h&&await r.handleLLMNewToken(h)}else{let m=this.extractStreamText(e);if(m){let h=new Ir({content:m,response_metadata:c}),y=new yi({message:h,text:m,generationInfo:c});i.push(y),u=!0,r&&await r.handleLLMNewToken(m)}}let f=this.extractUsage(e);f&&(a=f);let p=this.extractStopReason(e);p&&(s=p)}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 Be("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;Be("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){Be(`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){Be(`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 Ir({content:"",response_metadata:o,usage_metadata:n});return new yi({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 ne("Error converting image content:",r),null}}buildRequestBody(e,r){let n=[],o=[];e.forEach(l=>{let c=this.normaliseMessageContent(l);if(!c)return;let d=l._getType();if(d==="system"){let p=typeof c=="string"?c:"";p&&o.push(p);return}let f=[];if(typeof c=="string")f.push({type:"text",text:c});else if(Array.isArray(c))for(let p of c)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:d==="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 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={type:"enabled",budget_tokens:2048},u.temperature=1,B("[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 CUr(t){let e,r,n,o,i,a,s;return u(),{feed:l,reset:u};function u(){e=!0,r="",n=0,o=-1,i=void 0,a=void 0,s=""}function l(d){r=r?r+d:d,e&&yZo(r)&&(r=r.slice(xUr.length)),e=!1;let f=r.length,p=0,m=!1;for(;p<f;){m&&(r[p]===`
|
||
`&&++p,m=!1);let h=-1,y=o,g;for(let b=n;h<0&&b<f;++b)g=r[b],g===":"&&y<0?y=b-p:g==="\r"?(m=!0,h=b-p):g===`
|
||
`&&(h=b-p);if(h<0){n=f-p,o=y;break}else n=0,o=-1;c(r,p,y,h),p+=h+1}p===f?r="":p>0&&(r=r.slice(p))}function c(d,f,p,m){if(m===0){s.length>0&&(t({type:"event",id:i,event:a||void 0,data:s.slice(0,-1)}),s="",i=void 0),a=void 0;return}let h=p<0,y=d.slice(f,f+(h?m:p)),g=0;h?g=m:d[f+p+1]===" "?g=p+2:g=p+1;let b=f+g,_=m-g,w=d.slice(b,b+_).toString();if(y==="data")s+=w?"".concat(w,`
|
||
`):`
|
||
`;else if(y==="event")a=w;else if(y==="id"&&!w.includes("\0"))i=w;else if(y==="retry"){let O=parseInt(w,10);Number.isNaN(O)||t({type:"reconnect-interval",value:O})}}}function yZo(t){return xUr.every((e,r)=>t.charCodeAt(r)===e)}var xUr,OUr=v(()=>{xUr=[239,187,191]});var _7,TUr,bZo,_Zo,vZo,IUr,EUr,wZo,SZo,PUr,CZo,MUr,Fq,R1e=v(()=>{ot();hN();_7=require("obsidian");OUr();TUr="Iv1.b507a08c87ecfe98",bZo="https://github.com/login/device/code",_Zo="https://github.com/login/oauth/access_token",vZo="https://api.github.com/copilot_internal/v2/token",IUr="https://api.githubcopilot.com",EUr=`${IUr}/chat/completions`,wZo=`${IUr}/models`,SZo=60*1e3,PUr=60*60*1e3,CZo=3,MUr={401:"Authentication failed - token may be expired",403:"Access denied - check your Copilot subscription",429:"Rate limited - please wait before retrying"},Fq=class t{constructor(){this.abortController=null;this.refreshPromise=null;this.refreshAttempts=0;this.authGeneration=0}static getInstance(){return t.instance||(t.instance=new t),t.instance}getAuthState(){let e=ae(),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:TUr,scope:"read:user"}).toString(),r=await(0,_7.requestUrl)({url:bZo,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 Error("Authentication cancelled by user.");if(u++,o?.(u),await this.delay(r*1e3,a.signal),a.signal.aborted||this.authGeneration!==i)throw new Error("Authentication cancelled by user.");let l=new URLSearchParams({client_id:TUr,device_code:e,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}).toString(),c=await(0,_7.requestUrl)({url:_Zo,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 Error("Authentication cancelled by user.");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 Error("Authentication cancelled by user.");return t_({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||ae().githubCopilotAccessToken;if(!n)throw new Error("No GitHub access token available");n=await Do(n);let o=await(0,_7.requestUrl)({url:vZo,method:"GET",headers:{Authorization:`Bearer ${n}`,Accept:"application/json"},throw:!1});if(this.authGeneration!==r)throw new Error("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 Error("Authentication was reset during token refresh.");return t_({githubCopilotToken:a,githubCopilotTokenExpiresAt:s}),a}async getValidCopilotToken(){let e=ae(),r=e.githubCopilotTokenExpiresAt,o=!(typeof r=="number"&&r>0)||r<Date.now()+SZo;if(e.githubCopilotToken&&!o)return this.refreshAttempts=0,await Do(e.githubCopilotToken);if(!e.githubCopilotAccessToken)throw new Error("Not authenticated with GitHub Copilot. Please set up authentication first.");if(this.refreshAttempts>=CZo)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.22.2024092501","Editor-Version":"vscode/1.95.1","Copilot-Integration-Id":"vscode-chat","Openai-Intent":"conversation-panel"}}async sendChatMessage(e,r="gpt-4o"){let n=async s=>await(0,_7.requestUrl)({url:EUr,method:"POST",headers:this.buildCopilotHeaders(s),body:JSON.stringify({model:r,messages:e,stream:!1}),throw:!1}),o=await this.getValidCopilotToken(),i=await n(o);if(i.status===401&&(this.clearCopilotToken(),o=await this.getValidCopilotToken(),i=await n(o)),i.status!==200){let s=this.getRequestUrlJson(i),u="";if(s&&typeof s=="object"){let c=s,d=c.error;if(d&&typeof d=="object"){let f=d;typeof f.message=="string"&&(u=f.message)}if(!u&&typeof c.message=="string"&&(u=c.message),!u)try{u=JSON.stringify(s)}catch{u=""}}else typeof s=="string"&&(u=s);let l=MUr[i.status]||`Request failed: ${i.status}`;throw new Error(u?`${l}: ${u}`:l)}let a=this.getRequestUrlJson(i);if(!a||typeof a!="object"||!Array.isArray(a.choices))throw new Error("Invalid response from Copilot API: missing choices array");return a}async*sendChatMessageStream(e,r="gpt-4o",n){let o=async p=>await fetch(EUr,{method:"POST",headers:{...this.buildCopilotHeaders(p),Accept:"text/event-stream"},body:JSON.stringify({model:r,messages:e,stream:!0}),signal:n}),i=await this.getValidCopilotToken(),a=await o(i);if(a.status===401){try{await a.body?.cancel()}catch{}this.clearCopilotToken(),i=await this.getValidCopilotToken(),a=await o(i)}if(!a.ok){let p=await a.text(),m=MUr[a.status]||`Request failed: ${a.status}`;throw new Error(p?`${m}: ${p}`:m)}let s=a.headers.get("content-type")||"";if(!s.includes("text/event-stream"))throw new Error(`Expected text/event-stream but received ${s||"unknown"}`);if(!a.body)throw new Error("Response body is not available for streaming");let u=a.body.getReader(),l=new TextDecoder,c=[],d=!1,f=CUr(p=>{if(p.type!=="event")return;let m=p.data;if(m==="[DONE]"){d=!0;return}try{let h=JSON.parse(m);c.push(h)}catch{}});try{for(;!d;){let{done:m,value:h}=await u.read();if(m)break;let y=l.decode(h,{stream:!0});for(f.feed(y);c.length>0;){let g=c.shift();g&&(yield g)}}let p=l.decode();if(p)for(f.feed(p);c.length>0;){let m=c.shift();m&&(yield m)}}finally{try{await u.cancel()}catch{}u.releaseLock()}}abortPolling(){this.abortController&&(this.abortController.abort(),this.abortController=null)}resetAuth(){this.authGeneration++,this.abortPolling(),this.refreshPromise=null,this.refreshAttempts=0,t_({githubCopilotAccessToken:"",githubCopilotToken:"",githubCopilotTokenExpiresAt:0})}async listModels(){let e=async o=>await(0,_7.requestUrl)({url:wZo,method:"GET",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json","Copilot-Integration-Id":"vscode-chat"},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}`);return this.getRequestUrlJson(n)}clearCopilotToken(){t_({githubCopilotToken:"",githubCopilotTokenExpiresAt:0})}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()+PUr;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()+PUr}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 Error("Authentication cancelled by user.")):new Promise((n,o)=>{let i=()=>{clearTimeout(a),o(new Error("Authentication cancelled by user."))},a=setTimeout(()=>{r.removeEventListener("abort",i),n()},e);r.addEventListener("abort",i,{once:!0})}):new Promise(n=>setTimeout(n,e))}}});var xZo,A1e,RUr=v(()=>{YI();Qa();id();R1e();Zt();xZo=4,A1e=class extends md{constructor(r){super(r);this.lc_serializable=!1;this.lc_namespace=["langchain","chat_models","github_copilot"];this.provider=Fq.getInstance(),this.modelName=r.modelName,this.streaming=r.streaming??!0}_llmType(){return"github-copilot"}convertMessageType(r){switch(r){case"human":return"user";case"ai":return"assistant";case"system":return"system";case"tool":case"function":return"user";case"generic":default:return"user"}}toCopilotMessages(r){return r.map(n=>({role:this.convertMessageType(n._getType()),content:Rz(n.content)}))}async _generate(r,n,o){let i=this.toCopilotMessages(r),a=await this.provider.sendChatMessage(i,this.modelName),s=a.choices?.[0],u=s?.message?.content||"",l=s?.finish_reason,c=a.usage?{promptTokens:a.usage.prompt_tokens,completionTokens:a.usage.completion_tokens,totalTokens:a.usage.total_tokens}:void 0,d={finish_reason:l,tokenUsage:c,model:a.model};return{generations:[{text:u,message:new eo({content:u,response_metadata:d}),generationInfo:{finish_reason:l}}],llmOutput:{tokenUsage:c}}}async*_streamResponseChunks(r,n,o){if(!this.streaming){let u=(await this._generate(r,n,o)).generations[0];if(!u)return;let l=new Ir({content:u.text,response_metadata:u.message.response_metadata}),c=new yi({message:l,text:u.text,generationInfo:u.generationInfo});o&&u.text&&await o.handleLLMNewToken(u.text),yield c;return}let i=this.toCopilotMessages(r),a=!1;for await(let s of this.provider.sendChatMessageStream(i,this.modelName,n?.signal)){let u=s.choices?.[0],l=u?.delta?.content||"",c=u?.finish_reason||s.usage||u?.delta?.role;if(!l&&!c)continue;let d={};u?.finish_reason&&(d.finish_reason=u.finish_reason),u?.delta?.role&&(d.role=u.delta.role),s.usage&&(d.tokenUsage={promptTokens:s.usage.prompt_tokens,completionTokens:s.usage.completion_tokens,totalTokens:s.usage.total_tokens}),s.model&&(d.model=s.model);let f=new Ir({content:l,response_metadata:Object.keys(d).length>0?d:void 0}),p=new yi({message:f,text:l,generationInfo:u?.finish_reason?{finish_reason:u.finish_reason}:void 0});o&&l&&await o.handleLLMNewToken(l),a=!0,yield p}if(!a)throw new Error("GitHub Copilot streaming produced no chunks")}async getNumTokens(r){let n=Rz(r);return n?Math.ceil(n.length/xZo):0}}});var NUr={};Rn(NUr,{default:()=>l0});var AUr,OZo,Zc,l0,v7=v(()=>{qs();Or();hN();_t();ot();Zt();Pyr();Jbr();gQe();Kbr();MQe();S_r();iqr();VQe();oV();sqr();Xw();AUr=require("obsidian");wUr();SUr();RUr();OZo={openai:UC,"azure openai":UC,anthropic:fat,cohereai:pQe,google:EQe,xai:Lct,openrouterai:M1e,ollama:BQe,"lm-studio":UC,groq:Uat,"3rd party (openai-format)":UC,siliconflow:UC,"copilot-plus":UC,mistralai:$ct,deepseek:pat,"amazon-bedrock":I1e,"github-copilot":A1e},Zc=class Zc{constructor(){this.providerApiKeyMap={openai:()=>ae().openAIApiKey,google:()=>ae().googleApiKey,"azure openai":()=>ae().azureOpenAIApiKey,anthropic:()=>ae().anthropicApiKey,cohereai:()=>ae().cohereApiKey,openrouterai:()=>ae().openRouterAiApiKey,groq:()=>ae().groqApiKey,xai:()=>ae().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>ae().plusLicenseKey,mistralai:()=>ae().mistralApiKey,deepseek:()=>ae().deepseekApiKey,"amazon-bedrock":()=>ae().amazonBedrockApiKey,siliconflow:()=>ae().siliconflowApiKey,"github-copilot":()=>ae().githubCopilotToken||ae().githubCopilotAccessToken};this.buildModelMap(),al(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return Zc.instance||(Zc.instance=new Zc),Zc.instance}getTemperatureForModel(e,r,n){if(!e.isThinkingEnabled)return e.isOSeries||e.isGPT5?Zc.REASONING_MODEL_TEMPERATURE:r.temperature??n.temperature}async getModelConfig(e){let r=ae(),n=e.name,o=VW(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 Do(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Nl:void 0,organization:await Do(e.openAIOrgId||r.openAIOrgId)},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},anthropic:{anthropicApiKey:await Do(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?Nl:void 0},...i&&{thinking:{type:"enabled",budget_tokens:Zc.ANTHROPIC_THINKING_BUDGET_TOKENS}}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,apiKey:await Do(e.apiKey||r.azureOpenAIApiKey),configuration:{baseURL:e.baseUrl||`https://${e.azureOpenAIApiInstanceName||r.azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName}`,defaultQuery:{"api-version":e.azureOpenAIApiVersion||r.azureOpenAIApiVersion},defaultHeaders:{"Content-Type":"application/json","api-key":await Do(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?Nl:void 0},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},cohereai:{apiKey:await Do(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await Do(e.apiKey||r.googleApiKey),model:n,safetySettings:[{category:wV.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:SV.BLOCK_NONE},{category:wV.HARM_CATEGORY_HATE_SPEECH,threshold:SV.BLOCK_NONE},{category:wV.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:SV.BLOCK_NONE},{category:wV.HARM_CATEGORY_HARASSMENT,threshold:SV.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await Do(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,apiKey:await Do(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?Nl: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},groq:{apiKey:await Do(e.apiKey||r.groqApiKey),model:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:new Headers({Authorization:`Bearer ${await Do(e.apiKey||"default-key")}`})},"lm-studio":{modelName:n,apiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Nl:void 0}},"3rd party (openai-format)":{modelName:n,apiKey:await Do(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Nl:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},siliconflow:{modelName:n,apiKey:await Do(e.apiKey||r.siliconflowApiKey),configuration:{baseURL:e.baseUrl||rC.siliconflow.host,fetch:e.enableCors?Nl:void 0},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},"copilot-plus":{modelName:n,apiKey:await Do(r.plusLicenseKey),configuration:{baseURL:fN,fetch:e.enableCors?Nl:void 0}},mistralai:{model:n,apiKey:await Do(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await Do(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||rC.deepseek.host,fetch:e.enableCors?Nl:void 0}},"amazon-bedrock":{},"github-copilot":{modelName:n}}[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=ae(),a=VW(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)){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 Do(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?Nl: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=ae().activeModels;Zc.modelMap={};let r=Zc.modelMap;(e??hO).forEach(o=>{if(o.enabled){if(!Object.values(r_).contains(o.provider)){console.warn(`Unknown provider: ${o.provider} for model: ${o.name}`);return}let i=this.getProviderConstructor(o),a=this.hasProviderCredentials(o),s=oo(o);r[s]={hasApiKey:a,AIConstructor:i,vendor:o.provider}}})}hasProviderCredentials(e){if(e.provider==="amazon-bedrock"){let n=ae();return!!(e.apiKey||n.amazonBedrockApiKey)}let r=this.providerApiKeyMap[e.provider];return r?!!(e.apiKey||r()):!!e.apiKey}getProviderConstructor(e){let r=OZo[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(!Zc.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return Zc.chatModel}isModelConfigValid(e,r){let n=oo(e),o=Zc.modelMap[n];return!(!o||!o.hasApiKey||e.plusExclusive&&!r.isPlusUser)}resolveModelForTemperatureOverride(){let e=ae();try{let r=i_();if(r){let n=_O(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);Zc.chatModel=r,VW(e.name).isGPT5&&(e.provider==="openai"||e.provider==="azure openai"||e.provider==="3rd party (openai-format)")&&B(`Chat model set with Responses API for GPT-5: ${e.name}`)}catch(r){throw ne(r),r}}async createModelInstance(e){let r=oo(e),n=Zc.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 Pz("Copilot Plus license key is not configured. Please enter your license key in the Copilot Plus section at the top of Basic Settings."):new Tee(u)}let o=await this.getModelConfig(e),i=VW(e.name),a={...o};return i.isGPT5&&(n.vendor==="openai"||n.vendor==="azure openai"||n.vendor==="3rd party (openai-format)")&&(a.useResponsesApi=!0,B(`Enabling Responses API for GPT-5 model: ${e.name} (${n.vendor})`)),new n.AIConstructor(a)}validateChatModel(e){return e!=null}estimateTokens(e){return e?Math.ceil(e.length/4):0}async countTokens(e){try{return await rh(async()=>Zc.chatModel?.getNumTokens(e)??0)}catch(r){if(r instanceof Error&&r.message.includes("Unknown model"))return B("Using estimated token count due to tokenizer error"),this.estimateTokens(e);throw r}}validateCurrentModel(){if(!Zc.chatModel)return;let e=i_();if(!e)return;Zc.modelMap[e]?.hasApiKey||(Zc.chatModel=null,B("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=VW(e.name),f={maxTokens:c.isThinkingEnabled?4096:30},p={...l,...f};c.isGPT5&&(e.provider==="openai"||e.provider==="azure openai"||e.provider==="3rd party (openai-format)")&&(p.useResponsesApi=!0),await 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 AUr.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: `+Sn(n)+`
|
||
with CORS Error: `+Sn(o);throw new Error(i)}}}findModelByName(e){return ae().activeModels.find(n=>n.name===e)}};Zc.ANTHROPIC_THINKING_BUDGET_TOKENS=2048,Zc.REASONING_MODEL_TEMPERATURE=1;l0=Zc});var N1e={};Rn(N1e,{TieredLexicalRetriever:()=>GH});async function TZo(){try{if(!pft){let e=await Promise.resolve().then(()=>(v7(),NUr));pft=()=>e.default.getInstance()}return pft().getChatModel()}catch{return null}}var mft,pft,GH,w7=v(()=>{_t();ot();vb();Zt();tG();kTe();mft=require("obsidian");qTe();tEe();pft=null;GH=class extends vV{constructor(r,n){super();this.app=r;this.options=n;this.lc_namespace=["tiered_lexical_retriever"];this.searchCore=new eEe(r,TZo),typeof this.searchCore.getChunkManager=="function"?this.chunkManager=this.searchCore.getChunkManager():this.chunkManager=new Ck(r)}async getRelevantDocuments(r,n){try{if(this.options.timeRange)return this.getTimeRangeDocuments(r);let o=mL(r,this.app.vault),i=o.map(p=>p.basename),a=this.resolveTagTerms(r);if(this.options.returnAllTags&&a.length>0)return this.getAllTagDocuments(a,r,o);let s=[...new Set([...this.options.salientTerms,...i])];ae().debug&&B("TieredLexicalRetriever: Starting search",{query:r,salientTerms:s,maxK:this.options.maxK});let u=ae(),l=await this.searchCore.retrieve(r,{maxResults:this.options.returnAllTags?jm:this.options.maxK,salientTerms:s,enableLexicalBoosts:u.enableLexicalBoosts,returnAll:this.options.returnAllTags}),c=await this.getTitleMatches(o),d=await this.convertToDocuments(l),f=this.combineResults(d,c);return ae().debug&&B("TieredLexicalRetriever: Search complete",{totalResults:f.length,titleMatches:c.length,searchResults:l.length}),f}catch(o){return Be("TieredLexicalRetriever: Error during search",o),[]}}async getTimeRangeDocuments(r){if(!this.options.timeRange)return[];let{startTime:n,endTime:o}=this.options.timeRange,i=this.generateDailyNoteDateRange(n,o);ae().debug&&B("TieredLexicalRetriever: Generated daily note titles",{startTime:new Date(n).toISOString(),endTime:new Date(o).toISOString(),titlesCount:i.length,firstTitle:i[0],lastTitle:i[i.length-1]});let a=i.join(", "),s=mL(a,this.app.vault).filter(h=>!Q8(h)),l=(await this.getTitleMatches(s)).map(h=>(h.metadata.includeInContext=!0,h)),c=this.app.vault.getMarkdownFiles().filter(h=>!Q8(h)),d=[],f=this.options.returnAll?jm:Math.min(this.options.maxK,jm);for(let h of c)if(h.stat.mtime>=n&&h.stat.mtime<=o){if(s.some(y=>y.path===h.path))continue;if(d.length>=f)break;try{let y=await this.app.vault.cachedRead(h),g=this.app.metadataCache.getFileCache(h),b=(Date.now()-h.stat.mtime)/(1e3*60*60*24),_=Math.max(.3,Math.min(1,1-b/30));d.push(new Rm({pageContent:y,metadata:{path:h.path,title:h.basename,mtime:h.stat.mtime,ctime:h.stat.ctime,tags:g?.tags?.map(w=>w.tag)||[],includeInContext:!0,score:_,rerank_score:_,source:"time-filtered"}}))}catch(y){Be(`TieredLexicalRetriever: Failed to read file ${h.path}`,y)}}let p=new Map;for(let h of l)p.set(h.metadata.path,h);for(let h of d)p.has(h.metadata.path)||p.set(h.metadata.path,{...h,metadata:{...h.metadata,includeInContext:!0}});let m=Array.from(p.values()).sort((h,y)=>{let g=h.metadata.score||0;return(y.metadata.score||0)-g});return ae().debug&&B("TieredLexicalRetriever: Time range search complete",{timeRange:this.options.timeRange,dailyNotesFound:s.length,timeFilteredDocs:d.length,totalResults:m.length}),m}resolveTagTerms(r){let n=new Set,o=this.options.tagTerms??[];for(let i of o)typeof i=="string"&&i.startsWith("#")&&n.add(i.toLowerCase());if(n.size===0)for(let i of this.options.salientTerms??[])typeof i=="string"&&i.startsWith("#")&&n.add(i.toLowerCase());if(n.size===0)for(let i of this.extractTagsFromQuery(r))n.add(i);return Array.from(n)}extractTagsFromQuery(r){if(!r)return[];let n=null;try{n=r.match(/#[\p{L}\p{N}_/-]+/gu)}catch{n=r.match(/#[a-z0-9_/-]+/g)}if(!n)return[];let o=new Set;for(let i of n){let a=i.trim();a.length<=1||o.add(a.toLowerCase())}return Array.from(o)}async getAllTagDocuments(r,n,o){let i=ae(),a=r.join(" ")||n,s=await this.searchCore.retrieve(a,{maxResults:jm,candidateLimit:jm,salientTerms:r,enableLexicalBoosts:i.enableLexicalBoosts,returnAll:!0}),u=await this.getTitleMatches(o),l=await this.convertToDocuments(s);return this.combineResults(l,u)}generateDailyNoteDateRange(r,n){let o=[],i=new Date(r),a=new Date(n),s=365;Math.ceil((n-r)/(1e3*60*60*24))>s&&(Be(`TieredLexicalRetriever: Date range exceeds ${s} days, limiting to recent ${s} days`),i.setTime(a.getTime()-s*24*60*60*1e3));let l=new Date(i);for(;l<=a;)o.push(`[[${l.toLocaleDateString("en-CA")}]]`),l.setDate(l.getDate()+1);return o}async getTitleMatches(r){let n=[];for(let o of r)if(!Q8(o))try{let i=await this.app.vault.cachedRead(o),a=this.app.metadataCache.getFileCache(o);n.push(new Rm({pageContent:i,metadata:{path:o.path,title:o.basename,mtime:o.stat.mtime,ctime:o.stat.ctime,tags:a?.tags?.map(s=>s.tag)||[],includeInContext:!0,score:1,rerank_score:1,source:"title-match"}}))}catch(i){Be(`TieredLexicalRetriever: Failed to read title-matched file ${o.path}`,i)}return n}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 mft.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 Rm({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 mft.TFile))continue;let s=await this.app.vault.cachedRead(a);if(!s)continue;let u=this.app.metadataCache.getFileCache(a);n.push(new Rm({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){Be(`TieredLexicalRetriever: Failed to convert result ${o.id}`,i)}return B(`TieredLexicalRetriever: Converted ${n.length} results to Documents`),n}combineResults(r,n){let o=[];o.push(...n);for(let i of r)n.some(s=>s.metadata.path===i.metadata.path)||o.push(i);return o.sort((i,a)=>{let s=i.metadata.score||0,l=(a.metadata.score||0)-s;if(Math.abs(l)>.01)return l;if(i.metadata.isChunk&&a.metadata.isChunk&&i.metadata.path===a.metadata.path){let c=parseInt(i.metadata.chunkId?.split("#")[1]||"0"),d=parseInt(a.metadata.chunkId?.split("#")[1]||"0");return c-d}return l})}}});var hft={};Rn(hft,{HybridRetriever:()=>wue});var wue,j1e=v(()=>{Or();mR();aV();k1();_t();Am();ot();Zt();tG();wv();kTe();kOe();_ie();wue=class extends vV{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=ld.fromTemplate(`Please write a passage to answer the question. If you don't know the answer, just make up a passage.
|
||
Question: {question}
|
||
Passage:`)}async getRelevantDocuments(r,n){return rh(async()=>{let o=mL(r,app.vault),i=o.map(h=>h.basename),a=[...new Set([...this.options.salientTerms,...i])],s=await this.getExplicitChunks(o),u=r;n?.runName!=="no_hyde"&&(u=await this.rewriteQuery(r));let l=await this.getOramaChunks(u,a,this.options.textWeight),c=this.filterAndFormatChunks(l,s),d=c;if(c.length===0)return ae().debug&&console.log("No chunks found for query:",r),d;let f=c.reduce((h,y)=>{let g=y.metadata.score;return typeof g=="number"&&!isNaN(g)?Math.max(h,g):h},0),p=c.every(h=>typeof h.metadata.score!="number"||isNaN(h.metadata.score)),m=this.options.useRerankerThreshold&&(f<this.options.useRerankerThreshold||p);return m&&(d=(await pc.getInstance().rerank(r,c.map(y=>y.pageContent.slice(0,3e3)))).response.data.map(y=>({...c[y.index],metadata:{...c[y.index].metadata,rerank_score:y.relevance_score}}))),ae().debug&&(console.log("*** HYBRID RETRIEVER DEBUG INFO: ***"),n?.runName!=="no_hyde"&&(console.log(`
|
||
Original Query: `,r),console.log("Rewritten Query: ",u)),console.log(`
|
||
Explicit Chunks: `,s),console.log("Orama Chunks: ",l),console.log("Combined Chunks: ",c),console.log("Max Orama Score: ",f),m?console.log("Reranked Chunks: ",d):console.log("No reranking applied.")),d})}async rewriteQuery(r){try{return await pge(async()=>{let n=await this.queryRewritePrompt.format({question:r}),o=await rh(async()=>(await Nm.instance.getCurrentChainManager().chatModelManager.getChatModelWithTemperature(0)).invoke(n));if(o&&"content"in o){let i=Az(o.content);return JW(i)}return console.warn("Unexpected rewrittenQuery format. Falling back to original query."),r},KW)}catch(n){return console.error("Error in rewriteQuery:",n),r}}async getExplicitChunks(r){let n=[];for(let o of r){let i=await D1.getInstance().getDb(),a=await yR.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new Rm({pageContent:u.document.content,metadata:{...u.document.metadata,score:u.score,path:u.document.path,mtime:u.document.mtime,ctime:u.document.ctime,title:u.document.title,id:u.document.id,embeddingModel:u.document.embeddingModel,tags:u.document.tags,extension:u.document.extension,created_at:u.document.created_at,nchars:u.document.nchars}}));n.push(...s)}}return n}async getOramaChunks(r,n,o){let i;try{i=await this.convertQueryToVector(r)}catch(l){throw console.error("Error in convertQueryToVector, please ensure your embedding model is working and has an adequate context length:",l,`
|
||
Query:`,r),l}let a=await D1.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&&(ae().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);B("Daily note date range:",d[0],d[d.length-1]);let f=mL(d.join(", "),app.vault),m=(await this.getExplicitChunks(f)).map(_=>({..._,metadata:{..._.metadata,includeInContext:!0}}));B("Modified time range:",l,c),s.where={mtime:{between:[l,c]}};let y=(await x_(a,s)).hits.map(_=>new Rm({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}})),g=[...m,...y];return Array.from(new Set(g.map(_=>_.metadata.id))).map(_=>g.find(w=>w.metadata.id===_)).filter(_=>_!==void 0)}B(`Orama search params:
|
||
`,s);let u=await x_(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 Rm({pageContent:l.document.content||"",metadata:{...l.document.metadata||{},score:l.score,path:l.document.path||"",mtime:l.document.mtime,ctime:l.document.ctime,title:l.document.title||"",id:l.document.id,embeddingModel:l.document.embeddingModel,tags:l.document.tags||[],extension:l.document.extension,created_at:l.document.created_at,nchars:l.document.nchars}}))).filter(l=>l!==null)}async convertQueryToVector(r){let o=await(await gd.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}}))}}});var gft={};Rn(gft,{MergedSemanticRetriever:()=>Sue});var kq,Sue,D1e=v(()=>{j1e();tEe();w7();tG();kTe();kq=class kq extends vV{constructor(r,n){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 o=this.returnAll?jm:Math.min(this.originalMaxK*2,jm),i={...n,maxK:o,returnAll:this.returnAll,returnAllTags:n.returnAllTags,tagTerms:n.tagTerms};this.lexicalRetriever=new GH(r,i);let a=this.returnAll?jm:Math.min(this.originalMaxK*2,jm);this.semanticRetriever=new wue({minSimilarityScore:n.minSimilarityScore??.1,maxK:a,salientTerms:n.salientTerms,timeRange:n.timeRange,textWeight:n.textWeight,returnAll:this.returnAll,useRerankerThreshold:n.useRerankerThreshold})}async getRelevantDocuments(r,n){let[o,i]=await Promise.all([this.lexicalRetriever.getRelevantDocuments(r,n),this.semanticRetriever.getRelevantDocuments(r,n)]),a=new Map;for(let l of o)this.insertResult(a,l,"lexical");for(let l of i)this.insertResult(a,l,"semantic");let s=Array.from(a.values()).sort((l,c)=>(c.metadata?.score??0)-(l.metadata?.score??0)),u=this.returnAll?jm:this.originalMaxK;return s.slice(0,u)}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"?kq.LEXICAL_WEIGHT:kq.SEMANTIC_WEIGHT,s=i*a;return n==="lexical"&&this.hasTagMatch(o)&&(s*=kq.TAG_MATCH_BOOST),o.score=s,o.rerank_score=s,new Rm({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}};kq.LEXICAL_WEIGHT=1,kq.SEMANTIC_WEIGHT=1,kq.TAG_MATCH_BOOST=1.1;Sue=kq});function $Ur(t,e=!0){return e?`
|
||
|
||
<guidance>
|
||
${DUr}
|
||
|
||
IMAGE INCLUSION:
|
||
When the retrieved documents contain relevant images (in formats like  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  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 LUr(t,e=!0){return e?`
|
||
|
||
${DUr}
|
||
|
||
Source Catalog (for reference only):
|
||
${t}`:""}function $1e(t,e,r=!0){if(!r||!e?.length||!t)return t||"";if(MZo(t))return t;let n=e.slice(0,PZo).map((o,i)=>{let a=(o.title||o.path||"Untitled").replace(/^\[\[|\]\]$/g,"");return`[^${i+1}]: [[${a}]]`}).join(`
|
||
`);return`${t}
|
||
|
||
#### Sources:
|
||
|
||
${n}`}function L1e(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 MZo(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 FUr(t){let e=t||"";return/\[\^\d+\]/.test(e)}function kUr(t=!0){return t?`
|
||
|
||
${EZo}`:""}function IZo(t){let e=/([\s\S]*?)\n+(?:####\s*)?Sources\s*:?\s*\n+([\s\S]*)$/i,r=t.match(e);return r?{mainContent:r[1],sourcesBlock:(r[2]||"").trim()}:null}function RZo(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 AZo(t){return t.split(`
|
||
`).map(e=>e.trim()).filter(e=>/^\[\^\d+\]:/.test(e))}function NZo(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 jZo(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 DZo(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 $Zo(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 LZo(t,e){return e.size===0?t:t.replace(/\[(\d+(?:\s*,\s*\d+)*)\]/g,(r,n)=>`[${n.split(/\s*,\s*/).map(a=>{let s=parseInt(a,10);return String(e.get(s)||s)}).join(", ")}]`)}function FZo(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function kZo(t){return t!=null}function qZo(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=FZo(i),r.push({index:r.length+1,html:u})}),r}function jUr(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 qUr(t,e=!0){if(!e)return t;let r=IZo(t);if(!r)return t;let{mainContent:n,sourcesBlock:o}=r;o=RZo(o);let i=AZo(o);if(i.length===0){let d=qZo(o);return jUr(n,d)}let a=NZo(n,i);n=jZo(n,a);let s=DZo(o,a),{uniqueItems:u,consolidationMap:l}=$Zo(s);l.size>0&&(n=LZo(n,l),s=u);let c=s.map((d,f)=>d?{index:f+1,html:d}:null).filter(kZo);return jUr(n,c)}function F1e(t){return t.map(e=>{let r=e.title||e.path||"Untitled",n=e.path||r;return`- [[${r}]] (${n})`})}var DUr,EZo,PZo,Cue=v(()=>{DUr=`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)`,EZo=`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`;PZo=20});var xue,UUr=v(()=>{Or();Xot();Mie();_t();w7();D1e();uit();ot();Zt();Pie();uG();Cue();F1();bV();qs();xue=class extends L1{async run(e,r,n,o,i){let a=ae(),s=i_(),u=!1;try{u=!_O(s,a.activeModels).capabilities?.includes("reasoning")}catch(p){B("Could not determine model capabilities, defaulting to include thinking blocks",p)}let l=new T_(n,void 0,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(Y=>Y.id==="L5_USER")?.text||e.message,y=this.extractTagTerms(h);B("[VaultQA] Extracted tags before condensing:",y);let g=this.chainManager.memoryManager.getMemory(),b=await g.loadMemoryVariables({}),_=lge(b),w=h;_.length>0&&(B("[VaultQA] Condensing query with chat history for better retrieval"),w=await FTe(h,_),B("[VaultQA] Standalone question:",w));let O=ae(),T={minSimilarityScore:.01,maxK:O.maxSourceChunks,salientTerms:y.length>0?[...y]:[],timeRange:void 0,textWeight:void 0,returnAll:!1,useRerankerThreshold:void 0},M=await(O.enableSemanticSearchV3?new Sue(app,{...T,returnAll:y.length>0,returnAllTags:y.length>0,tagTerms:y}):new GH(app,{...T,returnAll:y.length>0,returnAllTags:y.length>0,tagTerms:y})).getRelevantDocuments(w);this.chainManager.storeRetrieverDocuments(M);let I=M.map(Y=>{let se=Y.metadata?.title||"Untitled",ie=Y.metadata?.path||se;return`<${hHe}>
|
||
<title>${se}</title>
|
||
<path>${ie}</path>
|
||
<content>
|
||
${L1e(Y.pageContent)}
|
||
</content>
|
||
</${hHe}>`}).join(`
|
||
|
||
`),j=[],A=this.chainManager.chatModelManager.getChatModel(),k=M.slice(0,Math.max(5,Math.min(20,M.length))).map(Y=>({title:Y.metadata?.title||Y.metadata?.path||"Untitled",path:Y.metadata?.path||Y.metadata?.title||""})),V=F1e(k).join(`
|
||
`),q=`
|
||
|
||
Answer the question based only on the following context:
|
||
`+I+LUr(V,O.enableInlineCitations);B("[VaultQA] Using envelope-based context construction with LayerToMessagesConverter");let J=vR.convert(p,{includeSystemMessage:!0,mergeUserContent:!0,debug:!1}),K=J.find(Y=>Y.role==="system");K&&j.push({role:Iz(A),content:K.content}),await wk(g,j);let ue=J.find(Y=>Y.role==="user");if(ue){let Y=q+`
|
||
|
||
`+ue.content;if(e.content&&Array.isArray(e.content)){let se=e.content.map(ie=>ie.type==="text"?{...ie,text:Y}:ie);j.push({role:"user",content:se})}else j.push({role:"user",content:Y})}let oe=A?.modelName;Sk({messages:j,modelName:oe,contextEnvelope:e.contextEnvelope}),B(`Final Request to AI:
|
||
`,j);let G=await rh(()=>this.chainManager.chatModelManager.getChatModel().stream(j,{signal:r.signal}));for await(let Y of G){if(r.signal.aborted){B("VaultQA stream iteration aborted",{reason:r.signal.reason});break}l.processChunk(Y)}}catch(p){p.name==="AbortError"||r.signal.aborted?B("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=ae();if(!FUr(e))return e;let n=this.chainManager.getRetrievedDocuments(),o=RRt(n).map(i=>({title:i}));return $1e(e,o,r.enableInlineCitations)}extractTagTerms(e){return mG(e)}}});var S7,k1e=v(()=>{S7=["@vault","@websearch","@composer","@memory"]});function q1e(){return e_(qq,{store:pw})}function zUr(){return dL(yft,{store:pw})}function C7(){return pw.get(qq)}function XH(){return pw.get(yft)}function U1e(t){pw.set(qq,t)}function ZH(t){let e=pw.get(qq),r=e.findIndex(n=>n.title===t.title);if(r!==-1){let n=[...e];n[r]=t,pw.set(qq,n)}else pw.set(qq,[...e,t])}function x7(t){let e=pw.get(qq);pw.set(qq,e.filter(r=>r.title!==t))}function Uq(t){pw.set(yft,t)}function Oue(t){pw.set(BUr,t)}function Tue(){return pw.get(BUr)}function Bq(t){bft.add(t)}function zq(t){bft.delete(t)}function ED(t){return bft.has(t)}function B1e(){return ae().defaultSystemPromptTitle}function VUr(){let t=C7(),e=XH();if(e){let n=t.find(o=>o.title===e);if(n)return n.content}let r=B1e();if(r){let n=t.find(o=>o.title===r);if(n)return n.content}return""}function HUr(){let t=B1e();Uq(t)}function _ft(){Oue(!1),Uq("")}var pw,qq,yft,BUr,bft,YH=v(()=>{eC();eC();ot();pw=cL(),qq=Cc([]),yft=Cc(""),BUr=Cc(!1);bft=new Set});function z1e(){return VUr()||ae()?.userSystemPrompt||""}function PD(){let t=z1e();if(Tue())return t;let r=kRt;return t?`${r}
|
||
<user_custom_instructions>
|
||
${t}
|
||
</user_custom_instructions>`:r}async function MD(t){let e=PD();if(!t)return B("No UserMemoryManager provided to getSystemPromptWithMemory"),e;let r=await t.getUserMemoryPrompt();return r?`${r}
|
||
${e}`:e}var Vq=v(()=>{ot();Or();_t();YH()});function lx(){}function JUr(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}function WUr(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 KUr(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 vft(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 wft(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 Eue(t,e){return vft(t,e,"")}function V1e(t,e){return wft(t,e,"")}function GUr(t,e){return e.slice(0,UZo(t,e))}function UZo(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}function XUr(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=WUr(o,a);t.value=wft(t.value,a,u),e.value=Eue(e.value,u),r.value=Eue(r.value,u)}if(n){var l=KUr(i,s);n.value=vft(n.value,s,l),e.value=V1e(e.value,l),r.value=V1e(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=WUr(c,d);e.value=Eue(e.value,p);var m=KUr(Eue(c,p),f);e.value=V1e(e.value,m),n.value=vft(n.value,c,m),t.value=wft(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=GUr(y,h);e.value=V1e(e.value,g)}else if(t){var b=t.value.match(/\s*$/)[0],_=e.value.match(/^\s*/)[0],w=GUr(b,_);e.value=Eue(e.value,w)}}function VZo(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}function ZUr(t,e,r){var n=VZo(r,{ignoreWhitespace:!0});return K1e.diff(t,e,n)}function Sft(t){"@babel/helpers - typeof";return Sft=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},Sft(t)}function Cft(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]=Cft(t[i],e,r,n,o);return e.pop(),r.pop(),a}if(t&&t.toJSON&&(t=t.toJSON()),Sft(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]=Cft(t[u],e,r,n,u);e.pop(),r.pop()}else a=t;return a}function YUr(t,e,r){return J1e.diff(t,e,r)}var Iis,H1e,BZo,W1e,zZo,K1e,HZo,JZo,Pue,J1e,xft=v(()=>{lx.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(JUr(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 O=void 0,T=m[w-1],P=m[w+1];T&&(m[w-1]=void 0);var M=!1;if(P){var I=P.oldPos-w;M=P&&0<=I&&I<u}var j=T&&T.oldPos+1<l;if(!M&&!j){m[w]=void 0;continue}if(!j||M&&T.oldPos<P.oldPos?O=a.addToPath(P,!0,!1,0,o):O=a.addToPath(T,!1,!0,1,o),h=a.extractCommon(O,r,e,w,o),O.oldPos+1>=l&&h+1>=u)return s(JUr(a,O.lastComponent,r,e,a.useLongestToken));m[w]=O,O.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}};Iis=new lx;H1e="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}",BZo=new RegExp("[".concat(H1e,"]+|\\s+|[^").concat(H1e,"]"),"ug"),W1e=new lx;W1e.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};W1e.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(BZo)||[];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};W1e.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};W1e.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)&&XUr(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&XUr(r,o,n,null),t};zZo=new lx;zZo.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(H1e,"]+|[^\\S\\n\\r]+|[^").concat(H1e,"]"),"ug");return t.match(e)||[]};K1e=new lx;K1e.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};K1e.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))),lx.prototype.equals.call(this,t,e,r)};HZo=new lx;HZo.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};JZo=new lx;JZo.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};Pue=new lx;Pue.useLongestToken=!0;Pue.tokenize=K1e.tokenize;Pue.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(Cft(t,null,null,o),o," ")};Pue.equals=function(t,e,r){return lx.prototype.equals.call(Pue,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};J1e=new lx;J1e.tokenize=function(t){return t.slice()};J1e.join=J1e.removeEmpty=function(t){return t}});var Mue,cx,Iue=v(()=>{Mue=L(X());kn();cx=Mue.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 Mue.createElement("div",{role:"switch","aria-checked":t,"aria-disabled":r,"data-state":t?"checked":"unchecked","data-disabled":r?"":void 0,ref:i,tabIndex:r?-1:0,className:Te("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},Mue.createElement("div",{className:Te("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")}))});cx.displayName="SettingSwitch"});function QUr(t){let e=[],r=[];return t.forEach(n=>{n.added||n.removed?r.push(n):(r.length>0&&(e.push(r),r=[]),e.push([n]))}),r.length>0&&e.push(r),e}var eBr=v(()=>{});function WZo(t,e){let r=o=>o.split(/(\s+)/).filter(Boolean);return YUr(r(t),r(e)).map(o=>({value:o.value.join(""),added:o.added,removed:o.removed}))}function Rue(t){let e=t.split(`
|
||
`);return e.length>0&&e[e.length-1]===""&&e.pop(),e}function rBr(t){let e=[],r=0;for(;r<t.length;){let n=t[r];if(!n.added&&!n.removed)Rue(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=Rue(n.value),a=Rue(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 Rue(n.value).forEach(i=>{e.push({original:i,modified:null,isUnchanged:!1})}),r++}else n.added&&Rue(n.value).forEach(o=>{e.push({original:null,modified:o,isUnchanged:!1})}),r++}return e}var ID,qt,tBr,Oft,nBr,Aue,Nue,G1e,oBr,iBr,KZo,Tft=v(()=>{kn();_t();ot();xft();Jr();ID=require("obsidian"),qt=L(X()),tBr=L(dd());to();Iue();Oft=L(X());eBr();Zt();nBr=(0,qt.memo)(({original:t,modified:e,side:r})=>{let n=WZo(t,e);return qt.default.createElement("span",null,n.map((o,i)=>{if(r==="original"){if(o.removed)return qt.default.createElement("span",{key:i,className:"tw-bg-error tw-text-error"},o.value);if(o.added)return null}else{if(o.added)return qt.default.createElement("span",{key:i,className:"tw-bg-success tw-text-success"},o.value);if(o.removed)return null}return qt.default.createElement("span",{key:i},o.value)}))});nBr.displayName="WordDiffSpan";Aue=(0,qt.memo)(({row:t,side:e})=>{let r=e==="original"?t.original:t.modified,n=e==="original"?t.modified:t.original;return r===null?qt.default.createElement("span",{className:"tw-text-muted"},"\xA0"):t.isUnchanged?qt.default.createElement("span",{className:"tw-text-normal"},r||"\xA0"):n!==null?qt.default.createElement(nBr,{original:t.original,modified:t.modified,side:e}):qt.default.createElement("span",{className:e==="original"?"tw-bg-error tw-text-error":"tw-bg-success tw-text-success"},r||"\xA0")});Aue.displayName="DiffCell";Nue="obsidian-copilot-apply-view",G1e=class extends ID.ItemView{constructor(r){super(r);this.root=null;this.state=null;this.result=null}getViewType(){return Nue}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,tBr.createRoot)(n)),this.root.render(qt.default.createElement(KZo,{app:this.app,state:this.state,close:o=>{this.result=o,this.leaf.detach()}}))}},oBr=(0,qt.memo)(({block:t})=>{let e=(0,qt.useMemo)(()=>rBr(t),[t]);return qt.default.createElement("div",{className:"tw-grid tw-grid-cols-2 tw-gap-2"},qt.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)=>qt.default.createElement("div",{key:n,className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},qt.default.createElement(Aue,{row:r,side:"original"})))),qt.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)=>qt.default.createElement("div",{key:n,className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},qt.default.createElement(Aue,{row:r,side:"modified"})))))});oBr.displayName="SideBySideBlock";iBr=(0,qt.memo)(({block:t})=>{let e=t.some(n=>n.added||n.removed),r=(0,qt.useMemo)(()=>rBr(t),[t]);return e?qt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},qt.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-2"},qt.default.createElement("div",{className:"tw-mb-1 tw-text-xs tw-font-medium tw-text-muted"},"Original"),qt.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},r.map((n,o)=>n.original!==null?qt.default.createElement("div",{key:o},qt.default.createElement(Aue,{row:n,side:"original"})):null))),qt.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-2"},qt.default.createElement("div",{className:"tw-mb-1 tw-text-xs tw-font-medium tw-text-muted"},"Modified"),qt.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-font-mono tw-text-sm"},r.map((n,o)=>n.modified!==null?qt.default.createElement("div",{key:o},qt.default.createElement(Aue,{row:n,side:"modified"})):null)))):qt.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)=>qt.default.createElement("span",{key:o},n.value)))});iBr.displayName="SplitBlock";KZo=({app:t,state:e,close:r})=>{let[n,o]=(0,Oft.useState)(()=>e.changes.map(g=>({...g,accepted:null}))),[i,a]=(0,Oft.useState)(()=>ae().diffViewMode??"split"),s=g=>{a(g),Ue("diffViewMode",g)},u=QUr(n),l=(0,qt.useRef)([]);if(!e||!e.changes)return ne("Invalid state:",e),qt.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},qt.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),qt.default.createElement(ge,{onClick:()=>r("failed"),className:"tw-mt-4"},"Close"));let c=async()=>{try{let g=n.map(_=>_.accepted===null?{..._,accepted:!0}:_),b=await p(g);r(b?"accepted":"failed")}catch(g){ne("Error applying changes:",g),new ID.Notice(`Error applying changes: ${g.message}`),r("failed")}},d=async()=>{try{let g=n.map(_=>_.accepted===null?{..._,accepted:!1}:_),b=await p(g);r(b?"rejected":"failed")}catch(g){ne("Error applying changes:",g),new ID.Notice(`Error applying changes: ${g.message}`),r("failed")}},f=async g=>{let b=t.vault.getAbstractFileByPath(g);if(b)return b;if(g.includes("/")){let _=g.split("/").slice(0,-1).join("/");await xc(_)}return await t.vault.create(g,"")},p=async g=>{let b=g.filter(w=>w.added?w.accepted===!0:w.removed?w.accepted===!1:!0).map(w=>w.value).join(""),_=await f(e.path);return!_||!(_ instanceof ID.TFile)?(ne("Error in getting file",e.path),new ID.Notice("Failed to create file"),!1):(await t.vault.modify(_,b),new ID.Notice("Changes applied successfully"),!0)},m=g=>{if(!u)return;let b=-1;for(let _=g+1;_<u.length;_++){let w=u[_],O=w.some(P=>P.added||P.removed),T=w.some(P=>(P.added||P.removed)&&P.accepted===null);if(O&&T){b=_;break}}b!==-1&&l.current[b]&&l.current[b]?.scrollIntoView({behavior:"smooth",block:"center"})},h=g=>{o(b=>{let _=[...b],w=u?.[g];return w&&w.forEach(O=>{let T=_.findIndex(P=>P===O);T!==-1&&(_[T]={..._[T],accepted:!0})}),_}),setTimeout(()=>m(g),0)},y=g=>{o(b=>{let _=[...b],w=u?.[g];return w&&w.forEach(O=>{let T=_.findIndex(P=>P===O);T!==-1&&(_[T]={..._[T],accepted:!1})}),_}),setTimeout(()=>m(g),0)};return qt.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},qt.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"},qt.default.createElement(ge,{variant:"destructive",size:"sm",onClick:d},qt.default.createElement($o,{className:"tw-size-4"}),"Reject"),qt.default.createElement(ge,{variant:"success",size:"sm",onClick:c},qt.default.createElement(Hu,{className:"tw-size-4"}),"Accept")),qt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-border-b tw-border-solid tw-border-border tw-p-2"},qt.default.createElement("div",{className:"tw-text-sm tw-font-medium"},e.path),qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},qt.default.createElement("span",{className:Te("tw-text-xs",i==="split"?"tw-font-medium tw-text-normal":"tw-text-muted")},"Split"),qt.default.createElement(cx,{checked:i==="side-by-side",onCheckedChange:g=>s(g?"side-by-side":"split")}),qt.default.createElement("span",{className:Te("tw-text-xs",i==="side-by-side"?"tw-font-medium tw-text-normal":"tw-text-muted")},"Side-by-side"))),qt.default.createElement("div",{className:"tw-flex-1 tw-overflow-auto tw-p-2"},u?.map((g,b)=>{let _=g.some(O=>O.added||O.removed),w=_?g.every(O=>!O.added&&!O.removed||O.accepted===!0)?"accepted":g.every(O=>!O.added&&!O.removed||O.accepted===!1)?"rejected":"undecided":"unchanged";return qt.default.createElement("div",{key:b,ref:O=>l.current[b]=O,className:Te("tw-mb-4 tw-overflow-hidden tw-rounded-md")},w==="accepted"?qt.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm tw-text-normal"},g.filter(O=>!O.removed).map((O,T)=>qt.default.createElement("div",{key:T},O.value))):w==="rejected"?qt.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm tw-text-normal"},g.filter(O=>!O.added).map((O,T)=>qt.default.createElement("div",{key:T},O.value))):i==="side-by-side"?qt.default.createElement(oBr,{block:g}):qt.default.createElement(iBr,{block:g}),_&&w==="undecided"&&qt.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"},qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},qt.default.createElement(ge,{variant:"destructive",size:"sm",onClick:()=>y(b)},qt.default.createElement($o,{className:"tw-size-4"}),"Reject"),qt.default.createElement(ge,{variant:"success",size:"sm",onClick:()=>h(b)},qt.default.createElement(Hu,{className:"tw-size-4"}),"Accept"))),_&&(w==="accepted"||w==="rejected")&&qt.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"},qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},qt.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},w==="accepted"?qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},qt.default.createElement(Hu,{className:"tw-size-4"}),qt.default.createElement("div",null,"Accepted")):qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},qt.default.createElement($o,{className:"tw-size-4"}),qt.default.createElement("div",null,"Rejected"))),qt.default.createElement(ge,{variant:"secondary",size:"sm",onClick:()=>{o(O=>{let T=[...O],P=u?.[b];return P&&P.forEach(M=>{let I=T.findIndex(j=>j===M);I!==-1&&(T[I]={...T[I],accepted:null})}),T})}},"Revert"))))})))}});var sA=v(()=>{nee();nee()});function Yl(t){return{name:t.name,description:t.description,schema:t.schema,call:async e=>{try{t.schema instanceof Ct.ZodVoid&&e&&typeof e=="object"&&Object.keys(e).length===0&&(e=void 0);let r={};t.requiresUserMessageContent&&e?._userMessageContent&&(r={_userMessageContent:e._userMessageContent},e=Object.fromEntries(Object.entries(e).filter(([i])=>i!=="_userMessageContent")));let o={...t.schema.parse(e),...r};return await t.handler(o)}catch(r){if(r instanceof Ct.ZodError){let n=r.errors.map(o=>`${o.path.join(".")}: ${o.message}`).join(", ");throw new Error(`Tool ${t.name} validation failed: ${n}`)}throw r}},timeoutMs:t.timeoutMs,isBackground:t.isBackground,isPlusOnly:t.isPlusOnly,requiresUserMessageContent:t.requiresUserMessageContent,version:t.version,deprecated:t.deprecated,metadata:t.metadata}}function X1e(t){let e={};if(t instanceof Ct.ZodObject){let r=t.shape;for(let[n,o]of Object.entries(r)){let i=o;e[n]=aBr(i)||"No description"}}else{if(t instanceof Ct.ZodVoid)return{};(t instanceof Ct.ZodUnion||t instanceof Ct.ZodDiscriminatedUnion)&&(e._union="Multiple parameter formats supported")}return e}function aBr(t){return t instanceof Ct.ZodOptional||t instanceof Ct.ZodNullable||t instanceof Ct.ZodDefault?aBr(t._def.innerType):t._def.description||""}var Zis,dx=v(()=>{sA();Zis={emptyParams:Ct.void(),stringParam:t=>Ct.string().describe(t),numberParam:t=>Ct.number().describe(t),booleanParam:t=>Ct.boolean().describe(t),optionalString:t=>Ct.string().optional().describe(t),nonEmptyString:t=>Ct.string().min(1).describe(t),url:t=>Ct.string().url().describe(t),email:t=>Ct.string().email().describe(t)}});async function sBr(t){let e=app.vault.getAbstractFileByPath(t);if(e&&e instanceof O7.TFile)return e;if(e&&!(e instanceof O7.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 xc(r),e=app.vault.getAbstractFileByPath(t),e&&e instanceof O7.TFile)return e;if(e=await app.vault.create(t,""),!(e instanceof O7.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 uBr(t,e){let r=await sBr(t),n=app.workspace.getActiveFile();r&&(!n||n.path!==t)&&await app.workspace.getLeaf().openFile(r);let o="";r&&(o=await app.vault.read(r));let i=ZUr(o,e,{newlineIsToken:!0});return new Promise(a=>{app.workspace.getLeaf(!0).setViewState({type:Nue,active:!0,state:{changes:i,path:t,resultCallback:u=>{a(u)}}})})}function jue(t){return t.replace(/\r\n/g,`
|
||
`).replace(/\r/g,`
|
||
`)}function ZZo(t,e,r){let n=(t.match(/\r\n/g)||[]).length,o=(t.match(/(?<!\r)\n/g)||[]).length,i=n>o,a=jue(t),s=jue(e),u=jue(r),l=a.replaceAll(s,u);return i?l.replace(/\n/g,`\r
|
||
`):l}function YZo(t){let e=[],r=/-{3,}\s*SEARCH\s*(?:\r?\n)?/,n=/(?:\r?\n)?={3,}\s*(?:\r?\n)?/,o=/(?:\r?\n)?\+{3,}\s*REPLACE/,i=new RegExp(r.source+"([\\s\\S]*?)"+n.source+"([\\s\\S]*?)"+o.source,"g"),a;for(;(a=i.exec(t))!==null;){let s=a[1].trim(),u=a[2].trim();e.push({searchText:s,replaceText:u})}return e}var O7,GZo,Z1e,XZo,lBr,Eft=v(()=>{O7=require("obsidian");Tft();xft();sA();dx();Zt();ot();GZo=Ct.object({path:Ct.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:Ct.union([Ct.string(),Ct.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:Ct.preprocess(t=>{if(typeof t=="string"){let e=t.trim().toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return t},Ct.boolean()).optional().default(!0).describe("(Optional) Whether to ask for change confirmation with preview UI before writing changes. Default: true. Set to false to skip preview and apply changes immediately.")}),Z1e=Yl({name:"writeToFile",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:GZo,handler:async({path:t,content:e,confirmation:r=!0})=>{let n=typeof e=="string"?e:JSON.stringify(e,null,2);if(ae().autoAcceptEdits||r===!1)try{let s=await sBr(t);return await app.vault.modify(s,n),JSON.stringify({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(s){return JSON.stringify({result:"failed",message:`Error writing to file without preview: ${s?.message||s}`})}let a=await uBr(t,n);return JSON.stringify({result:a,message:`File change result: ${a}. Do not retry or attempt alternative approaches to modify this file in response to the current user request.`})},timeoutMs:0}),XZo=Ct.object({path:Ct.string().describe("(Required) The path of the file to modify (relative to the root of the vault and include the file extension)."),diff:Ct.string().describe(`(Required) One or more SEARCH/REPLACE blocks. Each block MUST follow this exact format with these exact markers:
|
||
|
||
------- SEARCH
|
||
[exact content to find, including all whitespace and indentation]
|
||
=======
|
||
[new content to replace with]
|
||
+++++++ REPLACE
|
||
|
||
WHEN TO USE THIS TOOL vs writeToFile:
|
||
- Use replaceInFile for: small edits, fixing typos, updating specific sections, targeted changes
|
||
- Use writeToFile for: creating new files, major rewrites, when you can't identify specific text to replace
|
||
|
||
CRITICAL RULES:
|
||
1. SEARCH content must match EXACTLY - every character, space, and line break
|
||
2. Use the exact markers: "------- SEARCH", "=======", "+++++++ REPLACE"
|
||
3. For multiple changes, include multiple SEARCH/REPLACE blocks in order
|
||
4. Keep blocks concise - include only the lines being changed plus minimal context
|
||
|
||
COMMON MISTAKES TO AVOID:
|
||
- Wrong: Using different markers like "---- SEARCH" or "SEARCH -------"
|
||
- Wrong: Including too many unchanged lines
|
||
- Wrong: Not matching whitespace/indentation exactly`)});lBr=Yl({name:"replaceInFile",description:"Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a LARGE file.",schema:XZo,handler:async({path:t,diff:e})=>{let r=app.vault.getAbstractFileByPath(t);if(!r||!(r instanceof O7.TFile))return`File not found at path: ${t}. Please check the file path and try again.`;try{let n=await app.vault.read(r),o=n;if(n.length<3e3)return"File is too small to use this tool. Please use writeToFile instead.";let a=YZo(e);if(a.length===0)return`No valid SEARCH/REPLACE blocks found in diff. Please use the correct format with ------- SEARCH, =======, and +++++++ REPLACE markers.
|
||
diff: ${e}`;let s=0;for(let c of a){let{searchText:d,replaceText:f}=c,p=jue(o),m=jue(d);if(!p.includes(m))if(p.includes(m.trimEnd()))d=d.trimEnd(),f=f.trimEnd();else return`Search text not found in file ${t} : "${d}".`;let h=o;o=ZZo(o,d,f),o!==h&&s++}if(n===o)return`No changes made to ${t}. The search text was not found or replacement resulted in identical content. Call writeToFile instead`;if(ae().autoAcceptEdits)try{return await app.vault.modify(r,o),JSON.stringify({result:"accepted",blocksApplied:s,message:`Applied ${s} SEARCH/REPLACE block(s) without preview. Do not call this tool again to modify this file in response to the current user request.`})}catch(c){return JSON.stringify({result:"failed",blocksApplied:s,message:`Error applying changes without preview: ${c?.message||c}`})}let l=await uBr(t,o);return JSON.stringify({result:l,blocksApplied:s,message:`Applied ${s} SEARCH/REPLACE block(s) (replacing all occurrences). Result: ${l}. Do not call this tool again to modify this file in response to the current user request.`})}catch(n){return`Error performing SEARCH/REPLACE on ${t}: ${n}. Please check the file path and diff format and try again.`}},timeoutMs:0})});var Pft,Mft,RD,Y1e=v(()=>{Pft=require("obsidian"),Mft=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""}},RD=class{static async callTool(e,r){try{if(!e)throw new Error("Tool is undefined");let n=await e.call(r);return n??(console.warn(`Tool ${e.name} returned null/undefined result`),null)}catch(n){return console.error("Error calling tool:",n),n instanceof Error?new Pft.Notice(n.message):new Pft.Notice("An error occurred while executing the tool. Check console for details."),null}}}});function Q1e(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"}function QZo(t){let e=t.trim();return e.length<=cBr?e:`${e.slice(0,cBr)}\u2026`}function eYo(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?QZo(t.message):null,n=typeof t.notePath=="string"?t.notePath:"",i=(typeof t.noteTitle=="string"&&t.noteTitle.trim().length>0?t.noteTitle.trim():Q1e(n))||Q1e(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 cBr,fx,Due=v(()=>{cBr=180;fx=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"writeToFile":return this.formatWriteToFile(o);case"replaceInFile":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=0,n="";if(typeof e=="object")r=e.blocksApplied||0,n=e.result||"";else if(typeof e=="string"){let i=e.match(/Applied (\d+) SEARCH\/REPLACE block/);i&&(r=parseInt(i[1])),n=e}let o=String(n).toLowerCase();if(o.includes("accepted")){let i=r===1?"replacement":"replacements";return r>0?`\u2705 ${r} ${i} accepted`:"\u2705 File replacements: accepted"}else if(o.includes("rejected"))return r===0?"\u274C No replacements made":"\u274C File replacements: rejected";return typeof e=="object"&&e.message?e.message:String(n)}static formatReadNote(e){let r=e;if(typeof e=="string")try{r=JSON.parse(e)}catch{r=null}let n=eYo(r);return n||(typeof e=="string"?e:JSON.stringify(e,null,2))}}});function tYo(t){return"children"in t&&"path"in t}function rYo(t){return"path"in t&&!("children"in t)}function nYo(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function Ift(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=Xc();for(let u of t.children)if(rYo(u)){if(bl(u,i,a)){e&&r.push(u.name);let l=nYo(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(tYo(u)){let l=Ift(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 dBr,fBr=v(()=>{vb();sA();dx();dBr=t=>Yl({name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:Ct.void(),handler:async()=>{let e=Ift(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=Ift(t,!1);return r+JSON.stringify(o)}return r+n},isBackground:!0})});var T7,Hq,eje=v(()=>{T7=require("obsidian");_t();ot();Zt();Qa();Hq=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 T7.TFile?this.recentConversationsContent=await this.app.vault.read(e):(this.recentConversationsContent="",B("[UserMemoryManager] Recent Conversations file not found, skipping memory load"));let r=this.app.vault.getAbstractFileByPath(this.getSavedMemoriesFilePath());r instanceof T7.TFile?this.savedMemoriesContent=await this.app.vault.read(r):(this.savedMemoriesContent="",B("[UserMemoryManager] Saved Memories file not found, skipping saved memory load"))}catch(e){ne("[UserMemoryManager] Error reading memory files:",e),this.recentConversationsContent="",this.savedMemoriesContent=""}}addRecentConversation(e,r){if(!ae().enableRecentConversations){Be("[UserMemoryManager] Recent history referencing is disabled, skipping analysis");return}if(e.length===0){Be("[UserMemoryManager] No messages to analyze for user memory");return}this.updateMemory(e,r).catch(o=>{ne("[UserMemoryManager] Background user memory operation failed:",o)})}async updateSavedMemory(e,r){if(!ae().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=ae(),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 ne("[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){B("[UserMemoryManager] Memory update already in progress, skipping.");return}this.isUpdatingMemory=!0;try{if(await this.ensureMemoryFolderExists(),!r){ne("[UserMemoryManager] No chat model available, skipping memory update");return}if(e.length===0){B("[UserMemoryManager] No messages available, skipping memory update");return}let n=await this.createConversationSection(e,r);await this.addToRecentConversationsFile(this.getRecentConversationFilePath(),n)}catch(n){ne("[UserMemoryManager] Error analyzing chat messages for user memory:",n)}finally{this.isUpdatingMemory=!1}}async ensureMemoryFolderExists(){let r=ae().memoryFolderName;await xc(r)}getRecentConversationFilePath(){return`${ae().memoryFolderName}/Recent Conversations.md`}getSavedMemoriesFilePath(){return`${ae().memoryFolderName}/Saved Memories.md`}async updateSavedMemoryFile(e,r,n){let o=this.app.vault.getAbstractFileByPath(e),i=o instanceof T7.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 Qm(a),new Hs(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 T7.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 T7.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=ae().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 Qm(o),new Hs(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 ne("[UserMemoryManager] Failed to parse LLM response as JSON:",c),{title:"Untitled Conversation",summary:"Summary generation failed"}}}catch(s){return ne("[UserMemoryManager] Failed to extract title and summary:",s),{title:"Untitled Conversation",summary:"Summary generation failed"}}}}});var oYo,tje,Rft=v(()=>{sA();dx();eje();_t();v7();oYo=Ct.object({statement:Ct.string().min(1).describe("The user statement for explicitly updating saved memories")}),tje=Yl({name:"updateMemory",description:"Update the user memory when the user explicitly asks to update the memory",schema:oYo,handler:async({statement:t})=>{try{let e=new Hq(app),r=l0.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 ne("[updateMemoryTool] Error updating memory:",e),{success:!1,message:`Failed to save memory: ${e.message}`}}}})});function rje(t){return t.replace(/\\/g,"/").toLowerCase()}function iYo(t){return t.replace(/\.[^/.]+$/,"")}function aYo(t,e){if(e.length===0)return!1;let n=rje(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=iYo(s);if(!s.includes(a)&&!u.includes(a))return!1}else if(!s.includes(a))return!1}return!0}function Nft(t){return/\.[^/]+$/.test(t)}async function sYo(t){let e=b=>{let _=app.vault.getAbstractFileByPath(b);return _ instanceof $ue.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(!Nft(b))for(let w of[".md",".canvas"]){let O=e(`${b}${w}`);if(O)return{type:"resolved",file:O}}}let c=app.metadataCache,d=u.trim();if(c&&d){let b=new Set([d]);if(!Nft(d))for(let _ of[".md",".canvas"])b.add(`${d}${_}`);for(let _ of b){let w=c.getFirstLinkpathDest?.(_,"");if(w instanceof $ue.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=rje(d),m=new Set([p]);if(!Nft(d))for(let b of[".md",".canvas"])m.add(rje(`${d}${b}`));for(let b of f){let _=rje(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=>aYo(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 uYo(t){try{return await app.vault.cachedRead(t)}catch(e){return Be(`readNote: failed to read ${t.path}`,e),""}}function lYo(){let t=new Map,e=app.vault.getMarkdownFiles?.()??[];for(let r of e)if(r instanceof $ue.TFile){let n=t.get(r.basename)??[];n.push(r),t.set(r.basename,n)}return t}function cYo(t,e,r){let n=t.trim();if(!n)return[];let o=new Map,i=app.metadataCache.getFirstLinkpathDest?.(n,e);if(i instanceof $ue.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 dYo(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=lYo());let p=cYo(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 fYo(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/Aft),i=[];for(let a=0;a<o;a++){let s=a*Aft,u=Math.min((a+1)*Aft,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 $ue,Aft,pYo,pBr,mBr=v(()=>{$ue=require("obsidian");sA();_t();dx();Aft=200;pYo=Ct.object({notePath:Ct.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:Ct.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},Ct.number().int().min(0)).optional().describe("0-based chunk index to read. Omit to read the first chunk.")}),pBr=Yl({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:pYo,handler: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 sYo(r);if(n.type==="not_found")return Be(`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 Be(`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 uYo(o),s=fYo(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];B(`readNote: returning chunk ${l.chunkIndex} of ${u} for ${i}`);let c=l.chunkIndex<u-1,d=dYo(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}}})});async function jft(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(u=>u.name===t.name);if(!o){let u=e.map(l=>l.name).join(", ");return{toolName:t.name,result:`Error: Tool '${t.name}' not found. Available tools: ${u}. Make sure you have the tool enabled in the Agent settings.`,success:!1}}if(o.isPlusOnly&&!await $S())return{toolName:t.name,result:`Error: ${QH(t.name)} requires a Copilot Plus subscription`,success:!1};let i={...t.args};o.requiresUserMessageContent&&r&&(i._userMessageContent=r);let a=6e4;typeof o.timeoutMs=="number"&&(a=o.timeoutMs);let s;return!a||a===1/0?s=await RD.callTool(o,i):s=await Promise.race([RD.callTool(o,i),new Promise((u,l)=>setTimeout(()=>l(new Error(`Tool execution timed out after ${a}ms`)),a))]),s==null?(Be(`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 s=="string"?s:JSON.stringify(s),success:!0}}catch(o){return ne(`Error executing tool ${t.name}:`,o),{toolName:t.name,result:`Error: ${Sn(o)}`,success:!1}}}function QH(t){return t==="localSearch"?ae().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",writeToFile:"file editor",replaceInFile:"file editor"}[t]||t}function E7(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}",writeToFile:"\u270F\uFE0F",replaceInFile:"\u{1F504}",readNote:"\u{1F50D}"}[t]||"\u{1F527}"}function hBr(t,e){if(t=="writeToFile"||t=="replaceInFile")return"Accept / reject in the Preview";if(t==="localSearch"&&e?.salientTerms&&!ae().enableSemanticSearchV3){let n=Array.isArray(e.salientTerms)?e.salientTerms:[];if(n.length>0)return`Terms: ${n.slice(0,3).join(", ")}${n.length>3?"...":""}`}return null}function Dft(t,e){let r=QH(t.name),n=E7(t.name),o=Object.keys(t.args).length>0?JSON.stringify(t.args,null,2):"(no parameters)";B(`${n} [Iteration ${e}] ${r.toUpperCase()}`),B("Parameters:",o),B("---")}function $ft(t,e){if(t==="localSearch")return;let r=QH(t),n=E7(t),o=e.success?"\u2705 SUCCESS":"\u274C FAILED";B(`${n} ${r.toUpperCase()} RESULT: ${o}`);let i=300,a=String(e.result??"");a.length>i?B(`Result: ${a.substring(0,i)}... (truncated, ${a.length} chars total)`):a.length>0&&B("Result:",a)}function Jq(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)}var Lue=v(()=>{_t();Nv();ot();Y1e();Zt()});var Lft,mYo,hYo,nje,Jas,gYo,oje,Fft=v(()=>{Xot();Or();mR();_t();ot();sA();Lue();dx();tEe();Cue();Lft=Ct.object({query:Ct.string().min(1).describe("The search query"),salientTerms:Ct.array(Ct.string()).describe("List of salient terms extracted from the query"),timeRange:Ct.object({startTime:Ct.any(),endTime:Ct.any()}).optional().describe("Time range for search")}),mYo=Yl({name:"lexicalSearch",description:"Search for notes using lexical/keyword-based search",schema:Lft,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=ae(),o=r.filter(g=>g.startsWith("#")),i=t!==void 0,a=o.length>0,s=i||a,u=s?jm:n.maxSourceChunks;B(`lexicalSearch returnAll: ${i} (tags returnAll: ${a})`);let l={minSimilarityScore:s?0:.1,maxK:u,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:bHe,returnAll:i,useRerankerThreshold:.5,returnAllTags:a,tagTerms:o},d=await(n.enableSemanticSearchV3?new(await Promise.resolve().then(()=>(D1e(),gft))).MergedSemanticRetriever(app,l):new(await Promise.resolve().then(()=>(w7(),N1e))).TieredLexicalRetriever(app,l)).getRelevantDocuments(e);B(`lexicalSearch found ${d.length} documents for query: "${e}"`),t&&B(`Time range search from ${new Date(t.startTime.epoch).toISOString()} to ${new Date(t.endTime.epoch).toISOString()}`);let f=d.map(g=>{let b=g.metadata.rerank_score??g.metadata.score??0;return{title:g.metadata.title||"Untitled",content:g.pageContent,path:g.metadata.path||"",score:b,rerank_score:b,includeInContext:g.metadata.includeInContext??!0,source:g.metadata.source,mtime:g.metadata.mtime??null,ctime:g.metadata.ctime??null,chunkId:g.metadata.chunkId??null,isChunk:g.metadata.isChunk??!1,explanation:g.metadata.explanation??null}}),p=f.map(g=>({title:g.title||g.path||"Untitled",path:g.path||g.title||"",score:g.rerank_score||g.score||0})),m=Jq(p),h=new Map;for(let g of f){let b=(g.path||g.title).toLowerCase(),_=h.get(b);(!_||(g.rerank_score||0)>(_.rerank_score||0))&&h.set(b,g)}let y=m.map(g=>h.get((g.path||g.title).toLowerCase())).filter(Boolean);return JSON.stringify({type:"local_search",documents:y})}}),hYo=Yl({name:"semanticSearch",description:"Search for notes using semantic/meaning-based search with embeddings",schema:Lft,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=ae(),o=t!==void 0,i=o?Math.max(n.maxSourceChunks,200):n.maxSourceChunks;B(`semanticSearch returnAll: ${o}`);let s=await new(await Promise.resolve().then(()=>(j1e(),hft))).HybridRetriever({minSimilarityScore:o?0:.1,maxK:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:bHe,returnAll:o,useRerankerThreshold:.5}).getRelevantDocuments(e);B(`semanticSearch found ${s.length} documents for query: "${e}"`),t&&B(`Time range search from ${new Date(t.startTime.epoch).toISOString()} to ${new Date(t.endTime.epoch).toISOString()}`);let u=s.map(p=>{let m=p.metadata.rerank_score??p.metadata.score??0;return{title:p.metadata.title||"Untitled",content:p.pageContent,path:p.metadata.path||"",score:m,rerank_score:m,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}}),l=u.map(p=>({title:p.title||p.path||"Untitled",path:p.path||p.title||"",score:p.rerank_score||p.score||0})),c=Jq(l),d=new Map;for(let p of u){let m=(p.path||p.title).toLowerCase(),h=d.get(m);(!h||(p.rerank_score||0)>(h.rerank_score||0))&&d.set(m,p)}let f=c.map(p=>d.get((p.path||p.title).toLowerCase())).filter(Boolean);return JSON.stringify({type:"local_search",documents:f})}}),nje=Yl({name:"localSearch",description:"Search for notes based on the time range and query",schema:Lft,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=ae();B(`localSearch delegating to ${n.enableSemanticSearchV3?"semantic":"lexical"} search`);let o=r.filter(a=>a.startsWith("#"));return t!==void 0||o.length>0||!n.enableSemanticSearchV3?await mYo.call({timeRange:t,query:e,salientTerms:r}):await hYo.call({timeRange:t,query:e,salientTerms:r})}}),Jas=Yl({name:"indexVault",description:"Index the vault to the Copilot index",schema:Ct.void(),handler:async()=>{if(ae().enableSemanticSearchV3)try{let r=await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().indexVaultToVectorStore();return`Semantic search index refreshed with ${r} documents.
|
||
`+JSON.stringify({success:!0,message:`Semantic search index has been refreshed with ${r} documents.`,documentCount:r})}catch(e){return JSON.stringify({success:!1,message:`Failed to index with semantic search: ${e.message}`})}else return`The tiered lexical retriever builds indexes on demand and doesn't require manual indexing.
|
||
`+JSON.stringify({success:!0,message:"Tiered lexical retriever uses on-demand indexing. No manual indexing required."})},isBackground:!0}),gYo=Ct.object({query:Ct.string().min(1).describe("The search query"),chatHistory:Ct.array(Ct.object({role:Ct.enum(["user","assistant"]),content:Ct.string()})).describe("Previous conversation turns")}),oje=Yl({name:"webSearch",description:"Search the web for information",schema:gYo,isPlusOnly:!0,handler:async({query:t,chatHistory:e})=>{try{let r=await FTe(t,e),n=await pc.getInstance().webSearch(r),o=n.response.citations||[],a=[{type:"web_search",content:n.response.choices[0].message.content,citations:o,instruction:kUr()}];return JSON.stringify(a)}catch(r){return console.error(`Error processing web search query ${t}:`,r),""}}})});function _Yo(){return typeof app>"u"||!app?.metadataCache?null:app.metadataCache}function yBr(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 vYo(t,e,r){let n=t,o=yBr(n.getFrontmatterTags?.()),i=e?yBr(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 wYo(t){let e=t,r=JSON.stringify(e);if(r.length<=kft)return e;let n=e.tags.length;for(;r.length>kft&&n>gBr;)n=Math.max(gBr,Math.floor(n/2)),e={...e,tags:t.tags.slice(0,n),returnedTagCount:n,truncated:!0},r=JSON.stringify(e);return r.length>kft?{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 bBr(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 kft,yYo,gBr,bYo,_Br,vBr=v(()=>{sA();dx();kft=5e5,yYo=500,gBr=50,bYo=Ct.object({includeInline:Ct.boolean().optional().describe("Include inline tags in addition to frontmatter tags. Defaults to true."),maxEntries:Ct.number().int().positive().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.");_Br=()=>Yl({name:"getTagList",description:"Get the list of tags in the vault with occurrence statistics.",schema:bYo,handler:async t=>{let e=_Yo(),r=t?.includeInline??!0,n=t?.maxEntries??yYo;if(!e)return bBr({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=vYo(e,r,n),i=wYo(o);return bBr(i)},isBackground:!0})});var wBr=S((qft,Uft)=>{(function(t,e){typeof qft=="object"&&typeof Uft<"u"?Uft.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(qft,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 Wq=S((Bft,zft)=>{(function(t,e){typeof Bft=="object"&&typeof zft<"u"?zft.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(Bft,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(k){var V=["th","st","nd","rd"],q=k%100;return"["+k+(V[(q-20)%10]||V[q]||V[0])+"]"}},g=function(k,V,q){var J=String(k);return!J||J.length>=V?k:""+Array(V+1-J.length).join(q)+k},b={s:g,z:function(k){var V=-k.utcOffset(),q=Math.abs(V),J=Math.floor(q/60),K=q%60;return(V<=0?"+":"-")+g(J,2,"0")+":"+g(K,2,"0")},m:function k(V,q){if(V.date()<q.date())return-k(q,V);var J=12*(q.year()-V.year())+(q.month()-V.month()),K=V.clone().add(J,l),ue=q-K<0,oe=V.clone().add(J+(ue?-1:1),l);return+(-(J+(q-K)/(ue?K-oe:oe-K))||0)},a:function(k){return k<0?Math.ceil(k)||0:Math.floor(k)},p:function(k){return{M:l,y:d,w:u,d:s,D:f,h:a,m:i,s:o,ms:n,Q:c}[k]||String(k||"").toLowerCase().replace(/s$/,"")},u:function(k){return k===void 0}},_="en",w={};w[_]=y;var O="$isDayjsObject",T=function(k){return k instanceof j||!(!k||!k[O])},P=function k(V,q,J){var K;if(!V)return _;if(typeof V=="string"){var ue=V.toLowerCase();w[ue]&&(K=ue),q&&(w[ue]=q,K=ue);var oe=V.split("-");if(!K&&oe.length>1)return k(oe[0])}else{var G=V.name;w[G]=V,K=G}return!J&&K&&(_=K),K||!J&&_},M=function(k,V){if(T(k))return k.clone();var q=typeof V=="object"?V:{};return q.date=k,q.args=arguments,new j(q)},I=b;I.l=P,I.i=T,I.w=function(k,V){return M(k,{locale:V.$L,utc:V.$u,x:V.$x,$offset:V.$offset})};var j=function(){function k(q){this.$L=P(q.locale,null,!0),this.parse(q),this.$x=this.$x||q.x||{},this[O]=!0}var V=k.prototype;return V.parse=function(q){this.$d=function(J){var K=J.date,ue=J.utc;if(K===null)return new Date(NaN);if(I.u(K))return new Date;if(K instanceof Date)return new Date(K);if(typeof K=="string"&&!/Z$/i.test(K)){var oe=K.match(m);if(oe){var G=oe[2]-1||0,Y=(oe[7]||"0").substring(0,3);return ue?new Date(Date.UTC(oe[1],G,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,Y)):new Date(oe[1],G,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,Y)}}return new Date(K)}(q),this.init()},V.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()},V.$utils=function(){return I},V.isValid=function(){return this.$d.toString()!==p},V.isSame=function(q,J){var K=M(q);return this.startOf(J)<=K&&K<=this.endOf(J)},V.isAfter=function(q,J){return M(q)<this.startOf(J)},V.isBefore=function(q,J){return this.endOf(J)<M(q)},V.$g=function(q,J,K){return I.u(q)?this[J]:this.set(K,q)},V.unix=function(){return Math.floor(this.valueOf()/1e3)},V.valueOf=function(){return this.$d.getTime()},V.startOf=function(q,J){var K=this,ue=!!I.u(J)||J,oe=I.p(q),G=function(R,z){var U=I.w(K.$u?Date.UTC(K.$y,z,R):new Date(K.$y,z,R),K);return ue?U:U.endOf(s)},Y=function(R,z){return I.w(K.toDate()[R].apply(K.toDate("s"),(ue?[0,0,0,0]:[23,59,59,999]).slice(z)),K)},se=this.$W,ie=this.$M,$=this.$D,H="set"+(this.$u?"UTC":"");switch(oe){case d:return ue?G(1,0):G(31,11);case l:return ue?G(1,ie):G(0,ie+1);case u:var re=this.$locale().weekStart||0,D=(se<re?se+7:se)-re;return G(ue?$-D:$+(6-D),ie);case s:case f:return Y(H+"Hours",0);case a:return Y(H+"Minutes",1);case i:return Y(H+"Seconds",2);case o:return Y(H+"Milliseconds",3);default:return this.clone()}},V.endOf=function(q){return this.startOf(q,!1)},V.$set=function(q,J){var K,ue=I.p(q),oe="set"+(this.$u?"UTC":""),G=(K={},K[s]=oe+"Date",K[f]=oe+"Date",K[l]=oe+"Month",K[d]=oe+"FullYear",K[a]=oe+"Hours",K[i]=oe+"Minutes",K[o]=oe+"Seconds",K[n]=oe+"Milliseconds",K)[ue],Y=ue===s?this.$D+(J-this.$W):J;if(ue===l||ue===d){var se=this.clone().set(f,1);se.$d[G](Y),se.init(),this.$d=se.set(f,Math.min(this.$D,se.daysInMonth())).$d}else G&&this.$d[G](Y);return this.init(),this},V.set=function(q,J){return this.clone().$set(q,J)},V.get=function(q){return this[I.p(q)]()},V.add=function(q,J){var K,ue=this;q=Number(q);var oe=I.p(J),G=function(ie){var $=M(ue);return I.w($.date($.date()+Math.round(ie*q)),ue)};if(oe===l)return this.set(l,this.$M+q);if(oe===d)return this.set(d,this.$y+q);if(oe===s)return G(1);if(oe===u)return G(7);var Y=(K={},K[i]=e,K[a]=r,K[o]=t,K)[oe]||1,se=this.$d.getTime()+q*Y;return I.w(se,this)},V.subtract=function(q,J){return this.add(-1*q,J)},V.format=function(q){var J=this,K=this.$locale();if(!this.isValid())return K.invalidDate||p;var ue=q||"YYYY-MM-DDTHH:mm:ssZ",oe=I.z(this),G=this.$H,Y=this.$m,se=this.$M,ie=K.weekdays,$=K.months,H=K.meridiem,re=function(z,U,ee,ce){return z&&(z[U]||z(J,ue))||ee[U].slice(0,ce)},D=function(z){return I.s(G%12||12,z,"0")},R=H||function(z,U,ee){var ce=z<12?"AM":"PM";return ee?ce.toLowerCase():ce};return ue.replace(h,function(z,U){return U||function(ee){switch(ee){case"YY":return String(J.$y).slice(-2);case"YYYY":return I.s(J.$y,4,"0");case"M":return se+1;case"MM":return I.s(se+1,2,"0");case"MMM":return re(K.monthsShort,se,$,3);case"MMMM":return re($,se);case"D":return J.$D;case"DD":return I.s(J.$D,2,"0");case"d":return String(J.$W);case"dd":return re(K.weekdaysMin,J.$W,ie,2);case"ddd":return re(K.weekdaysShort,J.$W,ie,3);case"dddd":return ie[J.$W];case"H":return String(G);case"HH":return I.s(G,2,"0");case"h":return D(1);case"hh":return D(2);case"a":return R(G,Y,!0);case"A":return R(G,Y,!1);case"m":return String(Y);case"mm":return I.s(Y,2,"0");case"s":return String(J.$s);case"ss":return I.s(J.$s,2,"0");case"SSS":return I.s(J.$ms,3,"0");case"Z":return oe}return null}(z)||oe.replace(":","")})},V.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},V.diff=function(q,J,K){var ue,oe=this,G=I.p(J),Y=M(q),se=(Y.utcOffset()-this.utcOffset())*e,ie=this-Y,$=function(){return I.m(oe,Y)};switch(G){case d:ue=$()/12;break;case l:ue=$();break;case c:ue=$()/3;break;case u:ue=(ie-se)/6048e5;break;case s:ue=(ie-se)/864e5;break;case a:ue=ie/r;break;case i:ue=ie/e;break;case o:ue=ie/t;break;default:ue=ie}return K?ue:I.a(ue)},V.daysInMonth=function(){return this.endOf(l).$D},V.$locale=function(){return w[this.$L]},V.locale=function(q,J){if(!q)return this.$L;var K=this.clone(),ue=P(q,J,!0);return ue&&(K.$L=ue),K},V.clone=function(){return I.w(this.$d,this)},V.toDate=function(){return new Date(this.valueOf())},V.toJSON=function(){return this.isValid()?this.toISOString():null},V.toISOString=function(){return this.$d.toISOString()},V.toString=function(){return this.$d.toUTCString()},k}(),A=j.prototype;return M.prototype=A,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",l],["$y",d],["$D",f]].forEach(function(k){A[k[1]]=function(V){return this.$g(V,k[0],k[1])}}),M.extend=function(k,V){return k.$i||(k(V,j,M),k.$i=!0),M},M.locale=P,M.isDayjs=T,M.unix=function(k){return M(1e3*k)},M.en=w[_],M.Ls=w,M.p={},M})});var Xa,om,mw,Kq=v(()=>{(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(Xa||(Xa={}));(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"})(om||(om={}));(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"})(mw||(mw={}))});function SBr(t,e){e=e.add(1,"day"),eJ(t,e),P7(t,e)}function px(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function ije(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",Xa.AM):t.assign("meridiem",Xa.PM)}function eJ(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function P7(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var M7=v(()=>{Kq()});function Gq(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 CBr(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 aje(t,e,r={}){if(t==null)return null;if(typeof t=="number")return t;let n=r[t]??SYo[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,Vft.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,Vft.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}var Vft,SYo,Hft=v(()=>{Vft=L(Wq(),1);Kq();SYo={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=>CBr(t,mw.MARCH,om.SUNDAY,2),dstEnd:t=>CBr(t,mw.OCTOBER,om.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=>Gq(t,mw.MARCH,om.SUNDAY,2,2),dstEnd:t=>Gq(t,mw.NOVEMBER,om.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=>Gq(t,mw.MARCH,om.SUNDAY,2,2),dstEnd:t=>Gq(t,mw.NOVEMBER,om.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=>Gq(t,mw.MARCH,om.SUNDAY,2,2),dstEnd:t=>Gq(t,mw.NOVEMBER,om.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=>Gq(t,mw.MARCH,om.SUNDAY,2,2),dstEnd:t=>Gq(t,mw.NOVEMBER,om.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}});var xBr,Fue,Xq,Za,AD,mx=v(()=>{xBr=L(wBr(),1),Fue=L(Wq(),1);M7();Hft();Fue.default.extend(xBr.default);Xq=class{constructor(e){e=e??new Date,e instanceof Date?this.instant=e:(this.instant=e.instant??new Date,this.timezoneOffset=aje(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}},Za=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,Fue.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,Fue.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,Fue.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?(ije(o,n),px(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(P7(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}},AD=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 Za(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 Jft(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function CYo(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function jg(t){return`(?:${CYo(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var Zq=v(()=>{});function sje(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function Yq(t,e,r){let n=(0,OBr.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 OBr,I7=v(()=>{OBr=L(Wq(),1)});function xYo(t){let e=t.toLowerCase();return Wft[e]!==void 0?Wft[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)}function A7(t){let e=t.toLowerCase();return Kft[e]!==void 0?Kft[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}function eU(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 sje(e)}function d0(t){let e={},r=t,n=TBr.exec(r);for(;n;)TYo(e,n),r=r.substring(n[0].length).trim(),n=TBr.exec(r);return Object.keys(e).length==0?null:e}function TYo(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=xYo(e[1]),n=kue[e[2].toLowerCase()];t[n]=r}var Gft,Xft,c0,Wft,Kft,EBr,kue,PBr,R7,Qq,MBr,TBr,OYo,IBr,ND,tU,qm=v(()=>{Zq();I7();Gft={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},Xft={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},c0={...Xft,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},Wft={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},Kft={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},EBr={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"},kue={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",...EBr},PBr=`(?:${jg(Wft)}|[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)?)`;R7=`(?:${jg(Kft)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;Qq="(?:[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])";MBr=`(${PBr})\\s{0,3}(${jg(kue)})`,TBr=new RegExp(MBr,"i"),OYo=`(${PBr})\\s{0,3}(${jg(EBr)})`,IBr="\\s{0,5},?(?:\\s*and)?\\s{0,5}",ND=Jft("(?:(?:about|around)\\s{0,3})?",MBr,IBr),tU=Jft("(?:(?:about|around)\\s{0,3})?",OYo,IBr)});var Ys,Mb=v(()=>{Ys=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 EYo,PYo,MYo,que,RBr=v(()=>{qm();mx();Mb();EYo=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${ND})(?=\\W|$)`,"i"),PYo=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${ND})(?=\\W|$)`,"i"),MYo=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${tU})(?=\\W|$)`,"i"),que=class extends Ys{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?MYo:e.option.forwardDate?EYo:PYo}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=d0(r[1]);return n?Za.createRelativeFromReference(e.reference,n):null}}});var IYo,ABr,NBr,RYo,jBr,Uue,DBr=v(()=>{I7();qm();qm();qm();Zq();Mb();IYo=new RegExp(`(?:on\\s{0,3})?(${R7})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${R7}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${jg(c0)})(?:(?:-|/|,?\\s{0,3})(${Qq}(?!\\w)))?(?=\\W|$)`,"i"),ABr=1,NBr=2,RYo=3,jBr=4,Uue=class extends Ys{innerPattern(){return IYo}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=c0[r[RYo].toLowerCase()],i=A7(r[ABr]);if(i>31)return r.index=r.index+r[ABr].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[jBr]){let a=eU(r[jBr]);n.start.assign("year",a)}else{let a=Yq(e.refDate,i,o);n.start.imply("year",a)}if(r[NBr]){let a=A7(r[NBr]);n.end=n.start.clone(),n.end.assign("day",a)}return n}}});var AYo,NYo,$Br,Zft,Yft,Bue,LBr=v(()=>{I7();qm();qm();qm();Zq();Mb();AYo=new RegExp(`(${jg(c0)})(?:-|/|\\s*,?\\s*)(${R7})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${R7})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${Qq}))?(?=\\W|$)(?!\\:\\d)`,"i"),NYo=1,$Br=2,Zft=3,Yft=4,Bue=class extends Ys{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return AYo}innerExtract(e,r){let n=c0[r[NYo].toLowerCase()],o=A7(r[$Br]);if(o>31||this.shouldSkipYearLikeDate&&!r[Zft]&&!r[Yft]&&r[$Br].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[Yft]){let u=eU(r[Yft]);i.assign("year",u)}else{let u=Yq(e.refDate,o,n);i.imply("year",u)}if(!r[Zft])return i;let a=A7(r[Zft]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}}});var jYo,DYo,$Yo,FBr,zue,kBr=v(()=>{qm();I7();Zq();qm();Mb();jYo=new RegExp(`((?:in)\\s*)?(${jg(c0)})\\s*(?:[,-]?\\s*(${Qq})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),DYo=1,$Yo=2,FBr=3,zue=class extends Ys{innerPattern(){return jYo}innerExtract(e,r){let n=r[$Yo].toLowerCase();if(r[0].length<=3&&!Xft[n])return null;let o=e.createParsingResult(r.index+(r[DYo]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=c0[n];if(o.start.assign("month",i),r[FBr]){let a=eU(r[FBr]);o.start.assign("year",a)}else{let a=Yq(e.refDate,1,i);o.start.imply("year",a)}return o}}});var LYo,FYo,kYo,qBr,qYo,Vue,UBr=v(()=>{qm();Zq();Mb();LYo=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${jg(c0)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),FYo=1,kYo=2,qBr=3,qYo=4,Vue=class extends Ys{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return LYo}innerExtract(e,r){let n=parseInt(r[FYo]),o=parseInt(r[qYo]),i=r[qBr]?parseInt(r[qBr]):c0[r[kYo].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 UYo,BYo,zYo,Hue,BBr=v(()=>{Mb();UYo=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),BYo=1,zYo=2,Hue=class extends Ys{innerPattern(){return UYo}innerExtract(e,r){let n=parseInt(r[zYo]),o=parseInt(r[BYo]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}}});function VYo(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 HYo(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 zBr,N7,uje,lje,Jue,cje,VBr=v(()=>{Kq();zBr=2,N7=3,uje=4,lje=5,Jue=6,cje=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[zBr]);if(s>100){if(this.strictMode||r[N7]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[N7]!=null){if(r[N7].length==1&&!r[Jue])return null;i=parseInt(r[N7])}if(i>=60)return null;if(s>12&&(a=Xa.PM),r[Jue]!=null){if(s>12)return null;let u=r[Jue][0].toLowerCase();u=="a"&&(a=Xa.AM,s==12&&(s=0)),u=="p"&&(a=Xa.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",Xa.AM):o.imply("meridiem",Xa.PM),r[lje]!=null){let u=parseInt(r[lje].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[uje]!=null){let u=parseInt(r[uje]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[lje]!=null){let u=parseInt(r[lje].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[uje]!=null){let u=parseInt(r[uje]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[zBr]),a=0,s=-1;if(r[N7]!=null?a=parseInt(r[N7]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=Xa.PM),r[Jue]!=null){if(i>12)return null;let u=r[Jue][0].toLowerCase();u=="a"&&(s=Xa.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=Xa.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==Xa.AM?(n.start.imply("meridiem",Xa.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",Xa.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",Xa.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",Xa.PM)):i>12?o.imply("meridiem",Xa.PM):i<=12&&o.imply("meridiem",Xa.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=VYo(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=HYo(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}}});var Wue,HBr=v(()=>{Kq();VBr();Wue=class extends cje{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",Xa.PM)):o<6&&n.assign("meridiem",Xa.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",Xa.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",Xa.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}}});function rU(t){let e={};for(let r in t)e[r]=-t[r];return e}function JBr(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 j7=v(()=>{});var JYo,WYo,Kue,WBr=v(()=>{qm();mx();Mb();j7();JYo=new RegExp(`(${ND})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),WYo=new RegExp(`(${tU})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),Kue=class extends Ys{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?WYo:JYo}innerExtract(e,r){let n=d0(r[1]);if(!n)return null;let o=rU(n);return Za.createRelativeFromReference(e.reference,o)}}});var KYo,GYo,XYo,Gue,KBr=v(()=>{qm();mx();Mb();KYo=new RegExp(`(${ND})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),GYo=new RegExp(`(${tU})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),XYo=1,Gue=class extends Ys{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?GYo:KYo}innerExtract(e,r){let n=d0(r[XYo]);return n?Za.createRelativeFromReference(e.reference,n):null}}});var dje,f0,tJ=v(()=>{dje=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},f0=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 Xue,GBr=v(()=>{tJ();Xue=class extends f0{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 Zue,XBr=v(()=>{GBr();Zue=class extends Xue{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}}});function Qft(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=ZBr(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=ZBr(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?px(s,u):eJ(s,u)}r.end=s}return r}function ZBr(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")==Xa.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 YBr=v(()=>{Kq();M7()});var Yue,QBr=v(()=>{tJ();YBr();Yue=class extends f0{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()?Qft(r,n):Qft(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}}});var D7,ezr=v(()=>{QBr();D7=class extends Yue{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}}});var ZYo,Que,tzr=v(()=>{Hft();ZYo=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),Que=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=ZYo.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=aje(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 YYo,QYo,eQo,tQo,ele,rzr=v(()=>{YYo=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),QYo=1,eQo=2,tQo=3,ele=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=YYo.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[eQo]),s=parseInt(i[tQo]||"0"),u=a*60+s;u>14*60||(i[QYo]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}}});var nU,ept=v(()=>{nU=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 nzr,tle,ozr=v(()=>{nzr=L(Wq(),1);M7();tle=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,nzr.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),eJ(n.start,o),n.end&&n.end.isOnlyTime()&&(eJ(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),eJ(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 rle,izr=v(()=>{tJ();rle=class extends dje{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 rQo,nQo,oQo,iQo,azr,aQo,szr,uzr,sQo,lzr,czr,nle,dzr=v(()=>{Mb();rQo=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"),nQo=1,oQo=2,iQo=3,azr=4,aQo=5,szr=6,uzr=7,sQo=8,lzr=9,czr=10,nle=class extends Ys{innerPattern(){return rQo}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[nQo]),month:parseInt(r[oQo]),day:parseInt(r[iQo])});if(r[azr]!=null&&(n.assign("hour",parseInt(r[azr])),n.assign("minute",parseInt(r[aQo])),r[szr]!=null&&n.assign("second",parseInt(r[szr])),r[uzr]!=null&&n.assign("millisecond",parseInt(r[uzr])),r[sQo]!=null)){let o=0;if(r[lzr]){let i=parseInt(r[lzr]),a=0;r[czr]!=null&&(a=parseInt(r[czr])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}}});var ole,fzr=v(()=>{tJ();ole=class extends f0{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 pzr(t,e=!1){return t.parsers.unshift(new nle),t.refiners.unshift(new ole),t.refiners.unshift(new ele),t.refiners.unshift(new nU),t.refiners.push(new Que),t.refiners.push(new nU),t.refiners.push(new tle),t.refiners.push(new rle(e)),t}var mzr=v(()=>{tzr();rzr();ept();ozr();izr();dzr();fzr()});function hzr(t){let e=(0,$7.default)(t.instant),r=new Za(t,{});return px(r,e),ije(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function gzr(t){let e=(0,$7.default)(t.instant),r=new Za(t,{});return px(r,e),P7(r,e),r.addTag("casualReference/today"),r}function yzr(t){return uQo(t,1).addTag("casualReference/yesterday")}function uQo(t,e){return _zr(t,-e)}function bzr(t){return _zr(t,1).addTag("casualReference/tomorrow")}function _zr(t,e){let r=(0,$7.default)(t.instant),n=new Za(t,{});return r=r.add(e,"day"),px(n,r),P7(n,r),n}function vzr(t,e=22){let r=(0,$7.default)(t.instant),n=new Za(t,{});return px(n,r),n.imply("hour",e),n.imply("meridiem",Xa.PM),n.addTag("casualReference/tonight"),n}function wzr(t,e=20){let r=new Za(t,{});return r.imply("meridiem",Xa.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function Szr(t){let e=new Za(t,{}),r=(0,$7.default)(t.instant);return r.hour()>2&&SBr(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function Czr(t,e=6){let r=new Za(t,{});return r.imply("meridiem",Xa.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function xzr(t,e=15){let r=new Za(t,{});return r.imply("meridiem",Xa.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function Ozr(t){let e=new Za(t,{});return e.imply("meridiem",Xa.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var $7,tpt=v(()=>{mx();$7=L(Wq(),1);M7();Kq()});var Ezr,lQo,ile,Pzr=v(()=>{Ezr=L(Wq(),1);Mb();M7();tpt();lQo=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,ile=class extends Ys{innerPattern(e){return lQo}innerExtract(e,r){let n=(0,Ezr.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=hzr(e.reference);break;case"today":i=gzr(e.reference);break;case"yesterday":i=yzr(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=bzr(e.reference);break;case"tonight":i=vzr(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),px(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}}});var cQo,ale,Mzr=v(()=>{Mb();tpt();cQo=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,ale=class extends Ys{innerPattern(){return cQo}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=xzr(e.reference);break;case"evening":case"night":n=wzr(e.reference);break;case"midnight":n=Szr(e.reference);break;case"morning":n=Czr(e.reference);break;case"noon":case"midday":n=Ozr(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}}});function Izr(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=dQo(n,e,r),i=new Za(t);return i=JBr(i,{day:o}),i.assign("weekday",e),i}function dQo(t,e,r){let n=t.getDay();switch(r){case"this":return fje(t,e);case"last":return Rzr(t,e);case"next":return n==om.SUNDAY?e==om.SUNDAY?7:e:n==om.SATURDAY?e==om.SATURDAY?7:e==om.SUNDAY?8:1+e:e<n&&e!=om.SUNDAY?fje(t,e):fje(t,e)+7}return fQo(t,e)}function fQo(t,e){let r=Rzr(t,e),n=fje(t,e);return n<-r?n:r}function fje(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function Rzr(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var Azr=v(()=>{Kq();mx();j7()});var pQo,mQo,hQo,gQo,sle,Nzr=v(()=>{qm();Zq();Mb();Azr();pQo=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${jg(Gft)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),mQo=1,hQo=2,gQo=3,sle=class extends Ys{innerPattern(){return pQo}innerExtract(e,r){let n=r[hQo].toLowerCase(),o=Gft[n],i=r[mQo],a=r[gQo],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"),Izr(e.reference,o,u)}}});var jzr,yQo,bQo,_Qo,ule,Dzr=v(()=>{qm();mx();jzr=L(Wq(),1);Mb();Zq();yQo=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${jg(kue)})(?=\\s*)(?=\\W|$)`,"i"),bQo=1,_Qo=2,ule=class extends Ys{innerPattern(){return yQo}innerExtract(e,r){let n=r[bQo].toLowerCase(),o=r[_Qo].toLowerCase(),i=kue[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,Za.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,Za.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,jzr.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 vQo,wQo,SQo,$zr,Lzr,rpt,lle,Fzr=v(()=>{I7();vQo=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"),wQo=1,SQo=5,$zr=2,Lzr=3,rpt=4,lle=class{constructor(e){this.groupNumberMonth=e?Lzr:$zr,this.groupNumberDay=e?$zr:Lzr}pattern(){return vQo}extract(e,r){let n=r.index+r[wQo].length,o=r.index+r[0].length-r[SQo].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[rpt]&&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[rpt]){let l=parseInt(r[rpt]),c=sje(l);a.start.assign("year",c)}else{let l=Yq(e.refDate,u,s);a.start.imply("year",l)}return a}}});var CQo,xQo,cle,kzr=v(()=>{qm();mx();Mb();j7();CQo=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${ND})(?=\\W|$)`,"i"),xQo=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${tU})(?=\\W|$)`,"i"),cle=class extends Ys{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?CQo:xQo}innerExtract(e,r){let n=r[1].toLowerCase(),o=d0(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=rU(o);break}return Za.createRelativeFromReference(e.reference,o)}}});function OQo(t){return t.text.match(/^[+-]/i)!=null}function qzr(t){return t.text.match(/^-/i)!=null}var dle,Uzr=v(()=>{tJ();mx();qm();j7();dle=class extends f0{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?OQo(n)||qzr(n):!1}mergeResults(e,r,n,o){let i=d0(n.text);qzr(n)&&(i=rU(i));let a=Za.createRelativeFromReference(new Xq(r.start.date()),i);return new AD(r.reference,r.index,`${r.text}${e}${n.text}`,a)}}});function Bzr(t){return t.text.match(/\s+(before|from)$/i)!=null}function TQo(t){return t.text.match(/\s+(after|since)$/i)!=null}var fle,zzr=v(()=>{tJ();mx();qm();j7();fle=class extends f0{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!Bzr(r)&&!TQo(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=d0(r.text);Bzr(r)&&(o=rU(o));let i=Za.createRelativeFromReference(new Xq(n.start.date()),o);return new AD(n.reference,r.index,`${r.text}${e}${n.text}`,i)}}});var EQo,PQo,ple,Vzr=v(()=>{qm();EQo=new RegExp(`^\\s*(${Qq})`,"i"),PQo=1,ple=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=EQo.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=eU(i[PQo]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}}});var rJ,npt=v(()=>{RBr();DBr();LBr();kBr();UBr();BBr();HBr();WBr();KBr();XBr();ezr();mzr();Pzr();Mzr();Nzr();Dzr();Fzr();kzr();Uzr();zzr();ept();Vzr();rJ=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new ile),r.parsers.push(new ale),r.parsers.push(new zue),r.parsers.push(new ule),r.parsers.push(new cle),r}createConfiguration(e=!0,r=!1){let n=pzr({parsers:[new lle(r),new que(e),new Uue,new Bue(r),new sle,new Hue,new Wue(e),new Kue(e),new Gue(e)],refiners:[new D7]},e);return n.parsers.unshift(new Vue(e)),n.refiners.unshift(new fle),n.refiners.unshift(new dle),n.refiners.unshift(new nU),n.refiners.push(new D7),n.refiners.push(new ple),n.refiners.push(new Zue),n}}});var L7,opt,Hzr=v(()=>{mx();npt();L7=class t{constructor(e){this.defaultConfig=new rJ,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 opt(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 AD?c=l:l instanceof Za?(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}},opt=class{constructor(e,r,n){this.text=e,this.reference=new Xq(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof Za?e:new Za(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 AD(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 ipt,Jzr,MQo,Xls,Wzr=v(()=>{Hzr();npt();ipt=new rJ,Jzr=new L7(ipt.createCasualConfiguration(!1)),MQo=new L7(ipt.createConfiguration(!0,!1)),Xls=new L7(ipt.createCasualConfiguration(!0))});function apt(t,e,r){return Kzr.parse(t,e,r)}function Gzr(t,e,r){return Kzr.parseDate(t,e,r)}var Kzr,Xzr=v(()=>{Wzr();Kzr=Jzr});var jD,pje,mje,hje,hx,F7,jc,gx,oU=v(()=>{jD=class extends Error{},pje=class extends jD{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},mje=class extends jD{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},hje=class extends jD{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},hx=class extends jD{},F7=class extends jD{constructor(e){super(`Invalid unit ${e}`)}},jc=class extends jD{},gx=class extends jD{constructor(){super("Zone is an abstract class")}}});var Gt,yx,hw,iU,mle,spt,hle,gle,yle,ble,_le,vle,wle,Sle,Cle,xle,Ole,Tle,Ele,Ple,upt,Mle,Ile,Rle,Ale,Nle=v(()=>{Gt="numeric",yx="short",hw="long",iU={year:Gt,month:Gt,day:Gt},mle={year:Gt,month:yx,day:Gt},spt={year:Gt,month:yx,day:Gt,weekday:yx},hle={year:Gt,month:hw,day:Gt},gle={year:Gt,month:hw,day:Gt,weekday:hw},yle={hour:Gt,minute:Gt},ble={hour:Gt,minute:Gt,second:Gt},_le={hour:Gt,minute:Gt,second:Gt,timeZoneName:yx},vle={hour:Gt,minute:Gt,second:Gt,timeZoneName:hw},wle={hour:Gt,minute:Gt,hourCycle:"h23"},Sle={hour:Gt,minute:Gt,second:Gt,hourCycle:"h23"},Cle={hour:Gt,minute:Gt,second:Gt,hourCycle:"h23",timeZoneName:yx},xle={hour:Gt,minute:Gt,second:Gt,hourCycle:"h23",timeZoneName:hw},Ole={year:Gt,month:Gt,day:Gt,hour:Gt,minute:Gt},Tle={year:Gt,month:Gt,day:Gt,hour:Gt,minute:Gt,second:Gt},Ele={year:Gt,month:yx,day:Gt,hour:Gt,minute:Gt},Ple={year:Gt,month:yx,day:Gt,hour:Gt,minute:Gt,second:Gt},upt={year:Gt,month:yx,day:Gt,weekday:yx,hour:Gt,minute:Gt},Mle={year:Gt,month:hw,day:Gt,hour:Gt,minute:Gt,timeZoneName:yx},Ile={year:Gt,month:hw,day:Gt,hour:Gt,minute:Gt,second:Gt,timeZoneName:yx},Rle={year:Gt,month:hw,day:Gt,weekday:hw,hour:Gt,minute:Gt,timeZoneName:hw},Ale={year:Gt,month:hw,day:Gt,weekday:hw,hour:Gt,minute:Gt,second:Gt,timeZoneName:hw}});var U_,nJ=v(()=>{oU();U_=class{get type(){throw new gx}get name(){throw new gx}get ianaName(){return this.name}get isUniversal(){throw new gx}offsetName(e,r){throw new gx}formatOffset(e,r){throw new gx}offset(e){throw new gx}equals(e){throw new gx}get isValid(){throw new gx}}});var lpt,aU,yje=v(()=>{Ib();nJ();lpt=null,aU=class t extends U_{static get instance(){return lpt===null&&(lpt=new t),lpt}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return bje(e,r,n)}formatOffset(e,r){return sU(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}});function AQo(t){return vje[t]||(vje[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"})),vje[t]}function jQo(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 DQo(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=NQo[i];i==="era"?n[s]=a:fn(s)||(n[s]=parseInt(a,10))}return n}var vje,NQo,_je,Ay,uU=v(()=>{Ib();nJ();vje={};NQo={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};_je={},Ay=class t extends U_{static create(e){return _je[e]||(_je[e]=new t(e)),_je[e]}static resetCache(){_je={},vje={}}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 bje(e,r,n,this.name)}formatOffset(e,r){return sU(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=AQo(this.name),[o,i,a,s,u,l,c]=n.formatToParts?DQo(n,r):jQo(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=k7({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}}});function $Qo(t,e={}){let r=JSON.stringify([t,e]),n=Zzr[r];return n||(n=new Intl.ListFormat(t,e),Zzr[r]=n),n}function dpt(t,e={}){let r=JSON.stringify([t,e]),n=cpt[r];return n||(n=new Intl.DateTimeFormat(t,e),cpt[r]=n),n}function LQo(t,e={}){let r=JSON.stringify([t,e]),n=fpt[r];return n||(n=new Intl.NumberFormat(t,e),fpt[r]=n),n}function FQo(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=ppt[o];return i||(i=new Intl.RelativeTimeFormat(t,e),ppt[o]=i),i}function kQo(){return jle||(jle=new Intl.DateTimeFormat().resolvedOptions().locale,jle)}function qQo(t){let e=Yzr[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,Yzr[t]=e}return e}function UQo(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=dpt(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=dpt(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function BQo(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function zQo(t){let e=[];for(let r=1;r<=12;r++){let n=Pn.utc(2009,r,1);e.push(t(n))}return e}function VQo(t){let e=[];for(let r=1;r<=7;r++){let n=Pn.utc(2016,11,13+r);e.push(t(n))}return e}function wje(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function HQo(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 Zzr,cpt,fpt,ppt,jle,Yzr,mpt,hpt,gpt,JQo,Ds,$le=v(()=>{Ib();xje();lU();cU();uU();Zzr={};cpt={};fpt={};ppt={};jle=null;Yzr={};mpt=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=LQo(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):q7(e,3);return yc(r,this.padTo)}}},hpt=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&&Ay.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=dpt(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()}},gpt=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&Sje()&&(this.rtf=FQo(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):Qzr(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},JQo={firstDay:1,minimalDays:4,weekend:[6,7]},Ds=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||js.defaultLocale,s=a||(i?"en-US":kQo()),u=r||js.defaultNumberingSystem,l=n||js.defaultOutputCalendar,c=Dle(o)||js.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){jle=null,cpt={},fpt={},ppt={}}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]=UQo(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=BQo(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=HQo(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,Dle(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 wje(this,e,ypt,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=zQo(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return wje(this,e,bpt,()=>{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]=VQo(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return wje(this,void 0,()=>_pt,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Pn.utc(2016,11,13,9),Pn.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return wje(this,e,vpt,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[Pn.utc(-40,1,1),Pn.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 mpt(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new hpt(e,this.intl,r)}relFormatter(e={}){return new gpt(this.intl,this.isEnglish(),e)}listFormatter(e={}){return $Qo(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:Cje()?qQo(this.locale):JQo}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 Spt,Ph,U7=v(()=>{Ib();nJ();Spt=null,Ph=class t extends U_{static get utcInstance(){return Spt===null&&(Spt=new t(0)),Spt}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(oJ(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${sU(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${sU(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return sU(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 B7,Cpt=v(()=>{nJ();B7=class extends U_{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 bx(t,e){let r;if(fn(t)||t===null)return e;if(t instanceof U_)return t;if(e4r(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?aU.instance:n==="utc"||n==="gmt"?Ph.utcInstance:Ph.parseSpecifier(n)||Ay.create(t)}else return _x(t)?Ph.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new B7(t)}var Oje=v(()=>{nJ();uU();U7();Cpt();Ib();yje()});function r4r(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(xpt.hanidec)!==-1)e+=WQo.indexOf(t[r]);else for(let o in t4r){let[i,a]=t4r[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}function n4r(){z7={}}function p0({numberingSystem:t},e=""){let r=t||"latn";return z7[r]||(z7[r]={}),z7[r][e]||(z7[r][e]=new RegExp(`${xpt[r]}${e}`)),z7[r][e]}var xpt,t4r,WQo,z7,Opt=v(()=>{xpt={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"},t4r={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]},WQo=xpt.hanidec.replace(/[\[|\]]/g,"").split("");z7={}});var o4r,i4r,a4r,s4r,u4r,l4r,c4r,d4r,js,lU=v(()=>{yje();uU();$le();cU();Oje();Ib();Opt();o4r=()=>Date.now(),i4r="system",a4r=null,s4r=null,u4r=null,l4r=60,d4r=null,js=class{static get now(){return o4r}static set now(e){o4r=e}static set defaultZone(e){i4r=e}static get defaultZone(){return bx(i4r,aU.instance)}static get defaultLocale(){return a4r}static set defaultLocale(e){a4r=e}static get defaultNumberingSystem(){return s4r}static set defaultNumberingSystem(e){s4r=e}static get defaultOutputCalendar(){return u4r}static set defaultOutputCalendar(e){u4r=e}static get defaultWeekSettings(){return d4r}static set defaultWeekSettings(e){d4r=Dle(e)}static get twoDigitCutoffYear(){return l4r}static set twoDigitCutoffYear(e){l4r=e%100}static get throwOnInvalid(){return c4r}static set throwOnInvalid(e){c4r=e}static resetCaches(){Ds.resetCache(),Ay.resetCache(),Pn.resetCache(),n4r()}}});var Mh,Lle=v(()=>{Mh=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}});function m0(t,e){return new Mh("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function Tje(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 m4r(t,e,r){return r+(aJ(t)?p4r:f4r)[e-1]}function h4r(t,e){let r=aJ(t)?p4r:f4r,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function Eje(t,e){return(t-e+7)%7+1}function Fle(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=m4r(n,o,i),s=Eje(Tje(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=iJ(l,e,r)):u>iJ(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...qle(t)}}function Tpt(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=Eje(Tje(n,1,e),r),s=dU(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=dU(l)):u>s?(l=n+1,u-=dU(n)):l=n;let{month:c,day:d}=h4r(l,u);return{year:l,month:c,day:d,...qle(t)}}function Pje(t){let{year:e,month:r,day:n}=t,o=m4r(e,r,n);return{year:e,ordinal:o,...qle(t)}}function Ept(t){let{year:e,ordinal:r}=t,{month:n,day:o}=h4r(e,r);return{year:e,month:n,day:o,...qle(t)}}function Ppt(t,e){if(!fn(t.localWeekday)||!fn(t.localWeekNumber)||!fn(t.localWeekYear)){if(!fn(t.weekday)||!fn(t.weekNumber)||!fn(t.weekYear))throw new hx("Cannot mix locale-based week fields with ISO-based week fields");return fn(t.localWeekday)||(t.weekday=t.localWeekday),fn(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),fn(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 g4r(t,e=4,r=1){let n=kle(t.weekYear),o=gw(t.weekNumber,1,iJ(t.weekYear,e,r)),i=gw(t.weekday,1,7);return n?o?i?!1:m0("weekday",t.weekday):m0("week",t.weekNumber):m0("weekYear",t.weekYear)}function y4r(t){let e=kle(t.year),r=gw(t.ordinal,1,dU(t.year));return e?r?!1:m0("ordinal",t.ordinal):m0("year",t.year)}function Mpt(t){let e=kle(t.year),r=gw(t.month,1,12),n=gw(t.day,1,V7(t.year,t.month));return e?r?n?!1:m0("day",t.day):m0("month",t.month):m0("year",t.year)}function Ipt(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:m0("millisecond",o):m0("second",n):m0("minute",r):m0("hour",e)}var f4r,p4r,Rpt=v(()=>{Ib();Lle();oU();f4r=[0,31,59,90,120,151,181,212,243,273,304,334],p4r=[0,31,60,91,121,152,182,213,244,274,305,335]});function fn(t){return typeof t>"u"}function _x(t){return typeof t=="number"}function kle(t){return typeof t=="number"&&t%1===0}function e4r(t){return typeof t=="string"}function _4r(t){return Object.prototype.toString.call(t)==="[object Date]"}function Sje(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function Cje(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function v4r(t){return Array.isArray(t)?t:[t]}function Apt(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 w4r(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function fU(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Dle(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 kle(t)&&t>=e&&t<=r}function KQo(t,e){return t-e*Math.floor(t/e)}function yc(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function DD(t){if(!(fn(t)||t===null||t===""))return parseInt(t,10)}function pU(t){if(!(fn(t)||t===null||t===""))return parseFloat(t)}function Ule(t){if(!(fn(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function q7(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function aJ(t){return t%4===0&&(t%100!==0||t%400===0)}function dU(t){return aJ(t)?366:365}function V7(t,e){let r=KQo(e-1,12)+1,n=t+(e-r)/12;return r===2?aJ(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function k7(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 b4r(t,e,r){return-Eje(Tje(t,1,e),r)+e-1}function iJ(t,e=4,r=1){let n=b4r(t,e,r),o=b4r(t+1,e,r);return(dU(t)-n+o)/7}function Ble(t){return t>99?t:t>js.twoDigitCutoffYear?1900+t:2e3+t}function bje(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 oJ(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 Npt(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new jc(`Invalid unit value ${t}`);return e}function H7(t,e){let r={};for(let n in t)if(fU(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=Npt(o)}return r}function sU(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}${yc(r,2)}:${yc(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${yc(r,2)}${yc(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function qle(t){return w4r(t,["hour","minute","second","millisecond"])}var Ib=v(()=>{oU();lU();Rpt()});function ypt(t){switch(t){case"narrow":return[...XQo];case"short":return[...jpt];case"long":return[...GQo];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}}function bpt(t){switch(t){case"narrow":return[...ZQo];case"short":return[...$pt];case"long":return[...Dpt];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}function vpt(t){switch(t){case"narrow":return[...eei];case"short":return[...QQo];case"long":return[...YQo];default:return null}}function S4r(t){return _pt[t.hour<12?0:1]}function C4r(t,e){return bpt(e)[t.weekday-1]}function x4r(t,e){return ypt(e)[t.month-1]}function O4r(t,e){return vpt(e)[t.year<0?0:1]}function Qzr(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}`}var GQo,jpt,XQo,Dpt,$pt,ZQo,_pt,YQo,QQo,eei,xje=v(()=>{Nle();Ib();GQo=["January","February","March","April","May","June","July","August","September","October","November","December"],jpt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],XQo=["J","F","M","A","M","J","J","A","S","O","N","D"];Dpt=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],$pt=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],ZQo=["M","T","W","T","F","S","S"];_pt=["AM","PM"],YQo=["Before Christ","Anno Domini"],QQo=["BC","AD"],eei=["B","A"]});function T4r(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var tei,Ih,zle=v(()=>{xje();Nle();Ib();tei={D:iU,DD:mle,DDD:hle,DDDD:gle,t:yle,tt:ble,ttt:_le,tttt:vle,T:wle,TT:Sle,TTT:Cle,TTTT:xle,f:Ole,ff:Ele,fff:Mle,ffff:Rle,F:Tle,FF:Ple,FFF:Ile,FFFF:Ale},Ih=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 tei[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 yc(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?S4r(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,m)=>n?x4r(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),l=(p,m)=>n?C4r(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?O4r(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 T4r(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 T4r(i,o(s))}}});function W7(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function K7(...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 G7(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 M4r(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=DD(e[r+o]);return[n,null,r+o]}}function J7(t,e,r){let n=t[e];return fn(n)?r:DD(n)}function cei(t,e){return[{year:J7(t,e),month:J7(t,e+1,1),day:J7(t,e+2,1)},null,e+3]}function X7(t,e){return[{hours:J7(t,e,0),minutes:J7(t,e+1,0),seconds:J7(t,e+2,0),milliseconds:Ule(t[e+3])},null,e+4]}function Vle(t,e){let r=!t[e]&&!t[e+1],n=oJ(t[e+1],t[e+2]),o=r?null:Ph.instance(n);return[{},o,e+3]}function Hle(t,e){let r=t[e]?Ay.create(t[e]):null;return[{},r,e+1]}function pei(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(pU(r)),months:f(pU(n)),weeks:f(pU(o)),days:f(pU(i)),hours:f(pU(a)),minutes:f(pU(s)),seconds:f(pU(u),u==="-0"),milliseconds:f(Ule(l),d)}]}function kpt(t,e,r,n,o,i,a){let s={year:e.length===2?Ble(DD(e)):DD(e),month:jpt.indexOf(r)+1,day:DD(n),hour:DD(o),minute:DD(i)};return a&&(s.second=DD(a)),t&&(s.weekday=t.length>3?Dpt.indexOf(t)+1:$pt.indexOf(t)+1),s}function gei(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=kpt(e,o,n,r,i,a,s),p;return u?p=mei[u]:l?p=0:p=oJ(c,d),[f,new Ph(p)]}function yei(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}function E4r(t){let[,e,r,n,o,i,a,s]=t;return[kpt(e,o,n,r,i,a,s),Ph.utcInstance]}function wei(t){let[,e,r,n,o,i,a,s]=t;return[kpt(e,s,r,n,o,i,a),Ph.utcInstance]}function j4r(t){return G7(t,[Sei,N4r],[Cei,Tei],[xei,Eei],[Oei,Pei])}function D4r(t){return G7(yei(t),[hei,gei])}function $4r(t){return G7(t,[bei,E4r],[_ei,E4r],[vei,wei])}function L4r(t){return G7(t,[fei,pei])}function F4r(t){return G7(t,[dei,Mei])}function k4r(t){return G7(t,[Iei,N4r],[Rei,Aei])}var P4r,I4r,rei,Lpt,R4r,Fpt,nei,oei,iei,aei,sei,uei,A4r,lei,dei,fei,mei,hei,bei,_ei,vei,Sei,Cei,xei,Oei,N4r,Tei,Eei,Pei,Mei,Iei,Rei,Aei,qpt=v(()=>{Ib();xje();U7();uU();P4r=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;I4r=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,rei=`(?:${I4r.source}?(?:\\[(${P4r.source})\\])?)?`,Lpt=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,R4r=RegExp(`${Lpt.source}${rei}`),Fpt=RegExp(`(?:T${R4r.source})?`),nei=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,oei=/(\d{4})-?W(\d\d)(?:-?(\d))?/,iei=/(\d{4})-?(\d{3})/,aei=M4r("weekYear","weekNumber","weekDay"),sei=M4r("year","ordinal"),uei=/(\d{4})-(\d\d)-(\d\d)/,A4r=RegExp(`${Lpt.source} ?(?:${I4r.source}|(${P4r.source}))?`),lei=RegExp(`(?: ${A4r.source})?`);dei=RegExp(`^T?${Lpt.source}$`),fei=/^-?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)?)?)$/;mei={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};hei=/^(?:(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)))$/;bei=/^(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$/,_ei=/^(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$/,vei=/^(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})$/;Sei=W7(nei,Fpt),Cei=W7(oei,Fpt),xei=W7(iei,Fpt),Oei=W7(R4r),N4r=K7(cei,X7,Vle,Hle),Tei=K7(aei,X7,Vle,Hle),Eei=K7(sei,X7,Vle,Hle),Pei=K7(X7,Vle,Hle);Mei=K7(X7);Iei=W7(uei,lei),Rei=W7(A4r),Aei=K7(X7,Vle,Hle)});function mU(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 bc(n)}function z4r(t,e){let r=e.milliseconds??0;for(let n of Dei.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function U4r(t,e){let r=z4r(t,e)<0?-1:1;sJ.reduceRight((n,o)=>{if(fn(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),sJ.reduce((n,o)=>{if(fn(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function $ei(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var q4r,B4r,Nei,h0,Z7,jei,sJ,Dei,bc,Jle=v(()=>{oU();zle();Lle();$le();qpt();Ib();lU();cU();q4r="Invalid Duration",B4r={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}},Nei={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},...B4r},h0=146097/400,Z7=146097/4800,jei={years:{quarters:4,months:12,weeks:h0/7,days:h0,hours:h0*24,minutes:h0*24*60,seconds:h0*24*60*60,milliseconds:h0*24*60*60*1e3},quarters:{months:3,weeks:h0/28,days:h0/4,hours:h0*24/4,minutes:h0*24*60/4,seconds:h0*24*60*60/4,milliseconds:h0*24*60*60*1e3/4},months:{weeks:Z7/7,days:Z7,hours:Z7*24,minutes:Z7*24*60,seconds:Z7*24*60*60,milliseconds:Z7*24*60*60*1e3},...B4r},sJ=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],Dei=sJ.slice(0).reverse();bc=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?jei:Nei;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||Ds.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:H7(e,t.normalizeUnit),loc:Ds.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(_x(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]=L4r(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]=F4r(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 Mh?e:new Mh(e,r);if(js.throwOnInvalid)throw new hje(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 F7(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?Ih.create(this.loc,n).formatDurationFromString(this,e):q4r}toHuman(e={}){if(!this.isValid)return q4r;let r=sJ.map(n=>{let o=this.values[n];return fn(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+=q7(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},Pn.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?z4r(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 sJ)(fU(r.values,o)||fU(this.values,o))&&(n[o]=r.get(o)+this.get(o));return mU(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]=Npt(e(this.values[n],n));return mU(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...H7(e,t.normalizeUnit)};return mU(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 mU(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return U4r(this.matrix,e),mU(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=$ei(this.normalize().shiftToAll().toObject());return mU(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 sJ)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;_x(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else _x(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 U4r(this.matrix,r),mU(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 mU(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 sJ)if(!r(this.values[n],e.values[n]))return!1;return!0}}});function Lei(t,e){return!t||!t.isValid?$D.invalid("missing or invalid start"):!e||!e.isValid?$D.invalid("missing or invalid end"):e<t?$D.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 Y7,$D,Upt=v(()=>{cU();Jle();lU();oU();Lle();zle();Nle();Y7="Invalid Interval";$D=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 Mh?e:new Mh(e,r);if(js.throwOnInvalid)throw new mje(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=Q7(e),o=Q7(r),i=Lei(n,o);return i??new t({start:n,end:o})}static after(e,r){let n=bc.fromDurationLike(r),o=Q7(e);return t.fromDateTimes(o,o.plus(n))}static before(e,r){let n=bc.fromDurationLike(r),o=Q7(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=Pn.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=Pn.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return t.fromDateTimes(i,s);if(a){let l=bc.fromISO(o,r);if(l.isValid)return t.after(i,l)}else if(u){let l=bc.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(Q7).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=bc.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()})`:Y7}[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=iU,r={}){return this.isValid?Ih.create(this.s.loc.clone(r),e).formatInterval(this):Y7}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:Y7}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:Y7}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:Y7}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:Y7}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):bc.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}}});var LD,Bpt=v(()=>{cU();lU();$le();uU();Oje();Ib();LD=class{static hasDST(e=js.defaultZone){let r=Pn.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return Ay.isValidZone(e)}static normalizeZone(e){return bx(e,js.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||Ds.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||Ds.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||Ds.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Ds.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||Ds.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Ds.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||Ds.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Ds.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return Ds.create(r,null,"gregory").eras(e)}static features(){return{relative:Sje(),localeWeek:Cje()}}}});function V4r(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(bc.fromMillis(n).as("days"))}function Fei(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=V4r(u,l);return(c-c%7)/7}],["days",V4r]],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 H4r(t,e,r,n){let[o,i,a,s]=Fei(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=bc.fromObject(i,n);return l.length>0?bc.fromMillis(u,n).shiftTo(...l).plus(c):c}var J4r=v(()=>{Jle()});function zs(t,e=r=>r){return{regex:t,deser:([r])=>e(r4r(r))}}function Uei(t){return t.replace(/\./g,"\\.?").replace(X4r,G4r)}function W4r(t){return t.replace(/\./g,"").replace(X4r," ").toLowerCase()}function vx(t,e){return t===null?null:{regex:RegExp(t.map(Uei).join("|")),deser:([r])=>t.findIndex(n=>W4r(r)===W4r(n))+e}}function K4r(t,e){return{regex:t,deser:([,r,n])=>oJ(r,n),groups:e}}function Mje(t){return{regex:t,deser:([e])=>e}}function Bei(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function zei(t,e){let r=p0(e),n=p0(e,"{2}"),o=p0(e,"{3}"),i=p0(e,"{4}"),a=p0(e,"{6}"),s=p0(e,"{1,2}"),u=p0(e,"{1,3}"),l=p0(e,"{1,6}"),c=p0(e,"{1,9}"),d=p0(e,"{2,4}"),f=p0(e,"{4,6}"),p=y=>({regex:RegExp(Bei(y.val)),deser:([g])=>g,literal:!0}),h=(y=>{if(t.literal)return p(y);switch(y.val){case"G":return vx(e.eras("short"),0);case"GG":return vx(e.eras("long"),0);case"y":return zs(l);case"yy":return zs(d,Ble);case"yyyy":return zs(i);case"yyyyy":return zs(f);case"yyyyyy":return zs(a);case"M":return zs(s);case"MM":return zs(n);case"MMM":return vx(e.months("short",!0),1);case"MMMM":return vx(e.months("long",!0),1);case"L":return zs(s);case"LL":return zs(n);case"LLL":return vx(e.months("short",!1),1);case"LLLL":return vx(e.months("long",!1),1);case"d":return zs(s);case"dd":return zs(n);case"o":return zs(u);case"ooo":return zs(o);case"HH":return zs(n);case"H":return zs(s);case"hh":return zs(n);case"h":return zs(s);case"mm":return zs(n);case"m":return zs(s);case"q":return zs(s);case"qq":return zs(n);case"s":return zs(s);case"ss":return zs(n);case"S":return zs(u);case"SSS":return zs(o);case"u":return Mje(c);case"uu":return Mje(s);case"uuu":return zs(r);case"a":return vx(e.meridiems(),0);case"kkkk":return zs(i);case"kk":return zs(d,Ble);case"W":return zs(s);case"WW":return zs(n);case"E":case"c":return zs(r);case"EEE":return vx(e.weekdays("short",!1),1);case"EEEE":return vx(e.weekdays("long",!1),1);case"ccc":return vx(e.weekdays("short",!0),1);case"cccc":return vx(e.weekdays("long",!0),1);case"Z":case"ZZ":return K4r(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return K4r(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return Mje(/[a-z_+-/]{1,256}?/i);case" ":return Mje(/[^\S\n\r]/);default:return p(y)}})(t)||{invalidReason:kei};return h.token=t,h}function Hei(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=Vei[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function Jei(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function Wei(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(fU(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 Kei(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 fn(t.z)||(r=Ay.create(t.z)),fn(t.Z)||(r||(r=new Ph(t.Z)),n=t.Z),fn(t.q)||(t.M=(t.q-1)*3+1),fn(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),fn(t.u)||(t.S=Ule(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}function Gei(){return zpt||(zpt=Pn.fromMillis(1555555555555)),zpt}function Xei(t,e){if(t.literal)return t;let r=Ih.macroTokenToFormatOpts(t.val),n=Jpt(r,e);return n==null||n.includes(void 0)?t:n}function Vpt(t,e){return Array.prototype.concat(...t.map(r=>Xei(r,e)))}function Hpt(t,e,r){return new Wle(t,r).explainFromTokens(e)}function Z4r(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=Hpt(t,e,r);return[n,o,i,a]}function Jpt(t,e){if(!t)return null;let n=Ih.create(e,t).dtFormatter(Gei()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>Hei(a,t,i))}var kei,qei,G4r,X4r,Vei,zpt,Wle,Y4r=v(()=>{Ib();zle();U7();uU();cU();Opt();oU();kei="missing Intl.DateTimeFormat.formatToParts support";qei="\xA0",G4r=`[ ${qei}]`,X4r=new RegExp(G4r,"g");Vei={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"}};zpt=null;Wle=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=Vpt(Ih.parseFormat(r),e),this.units=this.tokens.map(n=>zei(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=Jei(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=Wei(e,this.regex,this.handlers),[o,i,a]=n?Kei(n):[null,null,void 0];if(fU(n,"a")&&fU(n,"H"))throw new hx("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 Kle(t){return new Mh("unsupported zone",`the zone "${t.name}" is not supported`)}function Kpt(t){return t.weekData===null&&(t.weekData=Fle(t.c)),t.weekData}function Gpt(t){return t.localWeekData===null&&(t.localWeekData=Fle(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function uJ(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Pn({...r,...e,old:r})}function a2r(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 Ije(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 Aje(t,e,r){return a2r(k7(t),e,r)}function e2r(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,V7(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=bc.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=k7(i),[u,l]=a2r(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function eX(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=Pn.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return Pn.invalid(new Mh("unparsable",`the input "${o}" can't be parsed as ${n}`))}function Rje(t,e,r=!0){return t.isValid?Ih.create(Ds.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function Xpt(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=yc(t.c.year,r?6:4),e?(n+="-",n+=yc(t.c.month),n+="-",n+=yc(t.c.day)):(n+=yc(t.c.month),n+=yc(t.c.day)),n}function t2r(t,e,r,n,o,i){let a=yc(t.c.hour);return e?(a+=":",a+=yc(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=yc(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=yc(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=yc(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=yc(Math.trunc(-t.o/60)),a+=":",a+=yc(Math.trunc(-t.o%60))):(a+="+",a+=yc(Math.trunc(t.o/60)),a+=":",a+=yc(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}function tti(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 F7(t);return e}function r2r(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return tti(t)}}function rti(t){return jje[t]||(Nje===void 0&&(Nje=js.now()),jje[t]=t.offset(Nje)),jje[t]}function n2r(t,e){let r=bx(e.zone,js.defaultZone);if(!r.isValid)return Pn.invalid(Kle(r));let n=Ds.fromObject(e),o,i;if(fn(t.year))o=js.now();else{for(let u of u2r)fn(t[u])&&(t[u]=s2r[u]);let a=Mpt(t)||Ipt(t);if(a)return Pn.invalid(a);let s=rti(r);[o,i]=Aje(t,s,r)}return new Pn({ts:o,zone:r,loc:n,o:i})}function o2r(t,e,r){let n=fn(r.round)?!0:r.round,o=(a,s)=>(a=q7(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 i2r(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]}function Q7(t){if(Pn.isDateTime(t))return t;if(t&&t.valueOf&&_x(t.valueOf()))return Pn.fromJSDate(t);if(t&&typeof t=="object")return Pn.fromObject(t);throw new jc(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var Wpt,Q4r,s2r,Zei,Yei,u2r,Qei,eti,Nje,jje,Pn,cU=v(()=>{Jle();Upt();lU();Bpt();zle();U7();$le();Ib();Oje();J4r();qpt();Y4r();Rpt();Nle();oU();Lle();Wpt="Invalid DateTime",Q4r=864e13;s2r={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Zei={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Yei={ordinal:1,hour:0,minute:0,second:0,millisecond:0},u2r=["year","month","day","hour","minute","second","millisecond"],Qei=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],eti=["year","ordinal","hour","minute","second","millisecond"];jje={},Pn=class t{constructor(e){let r=e.zone||js.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new Mh("invalid input"):null)||(r.isValid?null:Kle(r));this.ts=fn(e.ts)?js.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=_x(e.o)&&!e.old?e.o:r.offset(this.ts);o=Ije(this.ts,s),n=Number.isNaN(o.year)?new Mh("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||Ds.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]=i2r(arguments),[n,o,i,a,s,u,l]=r;return n2r({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=i2r(arguments),[n,o,i,a,s,u,l]=r;return e.zone=Ph.utcInstance,n2r({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=_4r(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=bx(r.zone,js.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:Ds.fromObject(r)}):t.invalid(Kle(o))}static fromMillis(e,r={}){if(_x(e))return e<-Q4r||e>Q4r?t.invalid("Timestamp out of range"):new t({ts:e,zone:bx(r.zone,js.defaultZone),loc:Ds.fromObject(r)});throw new jc(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(_x(e))return new t({ts:e*1e3,zone:bx(r.zone,js.defaultZone),loc:Ds.fromObject(r)});throw new jc("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=bx(r.zone,js.defaultZone);if(!n.isValid)return t.invalid(Kle(n));let o=Ds.fromObject(r),i=H7(e,r2r),{minDaysInFirstWeek:a,startOfWeek:s}=Ppt(i,o),u=js.now(),l=fn(r.specificOffset)?n.offset(u):r.specificOffset,c=!fn(i.ordinal),d=!fn(i.year),f=!fn(i.month)||!fn(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||c)&&m)throw new hx("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new hx("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,y,g,b=Ije(u,l);h?(y=Qei,g=Zei,b=Fle(b,a,s)):c?(y=eti,g=Yei,b=Pje(b)):(y=u2r,g=s2r);let _=!1;for(let j of y){let A=i[j];fn(A)?_?i[j]=g[j]:i[j]=b[j]:_=!0}let w=h?g4r(i,a,s):c?y4r(i):Mpt(i),O=w||Ipt(i);if(O)return t.invalid(O);let T=h?Tpt(i,a,s):c?Ept(i):i,[P,M]=Aje(T,l,n),I=new t({ts:P,zone:n,o:M,loc:o});return i.weekday&&p&&e.weekday!==I.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${I.toISO()}`):I.isValid?I:t.invalid(I.invalid)}static fromISO(e,r={}){let[n,o]=j4r(e);return eX(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=D4r(e);return eX(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=$4r(e);return eX(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(fn(e)||fn(r))throw new jc("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=Ds.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=Z4r(a,e,r);return c?t.invalid(c):eX(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]=k4r(e);return eX(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 Mh?e:new Mh(e,r);if(js.throwOnInvalid)throw new pje(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=Jpt(e,Ds.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return Vpt(Ih.parseFormat(e),Ds.fromObject(r)).map(o=>o.val).join("")}static resetCache(){Nje=void 0,jje={}}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?Kpt(this).weekYear:NaN}get weekNumber(){return this.isValid?Kpt(this).weekNumber:NaN}get weekday(){return this.isValid?Kpt(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?Gpt(this).weekday:NaN}get localWeekNumber(){return this.isValid?Gpt(this).weekNumber:NaN}get localWeekYear(){return this.isValid?Gpt(this).weekYear:NaN}get ordinal(){return this.isValid?Pje(this.c).ordinal:NaN}get monthShort(){return this.isValid?LD.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?LD.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?LD.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?LD.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=k7(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=Ije(u,a),d=Ije(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[uJ(this,{ts:u}),uJ(this,{ts:l})]:[this]}get isInLeapYear(){return aJ(this.year)}get daysInMonth(){return V7(this.year,this.month)}get daysInYear(){return this.isValid?dU(this.year):NaN}get weeksInWeekYear(){return this.isValid?iJ(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?iJ(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=Ih.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(Ph.instance(e),r)}toLocal(){return this.setZone(js.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=bx(e,js.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]=Aje(a,i,e)}return uJ(this,{ts:o,zone:e})}else return t.invalid(Kle(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return uJ(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=H7(e,r2r),{minDaysInFirstWeek:n,startOfWeek:o}=Ppt(r,this.loc),i=!fn(r.weekYear)||!fn(r.weekNumber)||!fn(r.weekday),a=!fn(r.ordinal),s=!fn(r.year),u=!fn(r.month)||!fn(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new hx("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new hx("Can't mix ordinal dates with month/day");let d;i?d=Tpt({...Fle(this.c,n,o),...r},n,o):fn(r.ordinal)?(d={...this.toObject(),...r},fn(r.day)&&(d.day=Math.min(V7(d.year,d.month),d.day))):d=Ept({...Pje(this.c),...r});let[f,p]=Aje(d,this.o,this.zone);return uJ(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=bc.fromDurationLike(e);return uJ(this,e2r(this,r))}minus(e){if(!this.isValid)return this;let r=bc.fromDurationLike(e).negate();return uJ(this,e2r(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=bc.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?Ih.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):Wpt}toLocaleString(e=iU,r={}){return this.isValid?Ih.create(this.loc.clone(r),e).formatDateTime(this):Wpt}toLocaleParts(e={}){return this.isValid?Ih.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=Xpt(this,a);return s+="T",s+=t2r(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?Xpt(this,e==="extended"):null}toISOWeekDate(){return Rje(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":"")+t2r(this,a==="extended",r,e,n,i):null}toRFC2822(){return Rje(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return Rje(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?Xpt(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")),Rje(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Wpt}[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 bc.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=v4r(r).map(bc.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=H4r(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?$D.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),o2r(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?o2r(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 Apt(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new jc("max requires all arguments be DateTimes");return Apt(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=Ds.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return Hpt(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=Ds.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new Wle(i,e)}static fromFormatParser(e,r,n={}){if(fn(e)||fn(r))throw new jc("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=Ds.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):eX(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return iU}static get DATE_MED(){return mle}static get DATE_MED_WITH_WEEKDAY(){return spt}static get DATE_FULL(){return hle}static get DATE_HUGE(){return gle}static get TIME_SIMPLE(){return yle}static get TIME_WITH_SECONDS(){return ble}static get TIME_WITH_SHORT_OFFSET(){return _le}static get TIME_WITH_LONG_OFFSET(){return vle}static get TIME_24_SIMPLE(){return wle}static get TIME_24_WITH_SECONDS(){return Sle}static get TIME_24_WITH_SHORT_OFFSET(){return Cle}static get TIME_24_WITH_LONG_OFFSET(){return xle}static get DATETIME_SHORT(){return Ole}static get DATETIME_SHORT_WITH_SECONDS(){return Tle}static get DATETIME_MED(){return Ele}static get DATETIME_MED_WITH_SECONDS(){return Ple}static get DATETIME_MED_WITH_WEEKDAY(){return upt}static get DATETIME_FULL(){return Mle}static get DATETIME_FULL_WITH_SECONDS(){return Ile}static get DATETIME_HUGE(){return Rle}static get DATETIME_HUGE_WITH_SECONDS(){return Ale}}});var l2r=v(()=>{cU();Jle();Upt();Bpt();nJ();U7();uU();Cpt();yje();lU()});function Zpt(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 nti(t){let e=Pn.now();if(t)try{let i=Zpt(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(Pn.DATETIME_FULL),localDateString:e.toISODate()||"",timezoneOffset:n,timezone:o}}function oti(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 iti(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 ati(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=apt(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=Pn.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 sti(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|september|oct|october|nov|november|dec|december)$/i);if(!r)return;let n=d2r[r[1]],o=e.year;n>e.month&&o--;let i=Pn.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 uti(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=Pn.fromObject({year:n,month:1,day:1}),i=Pn.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 lti(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=Pn.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 cti(t,e){let r=t.match(/^(jan|january|feb|february|mar|march|apr|april|may|jun|june|jul|july|aug|august|sep|september|oct|october|nov|november|dec|december)\s+(\d{4})$/i);if(!r)return;let n=d2r[r[1].toLowerCase()],o=parseInt(r[2]),i=Pn.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 dti(t){let e=Pn.now(),r=t.toLowerCase().replace("@vault","").trim(),n=oti(r,e)||iti(r,e)||ati(r,e)||sti(r,e)||cti(r,e)||lti(r,e)||uti(r,e);if(n)return{startTime:Gle(n.start),endTime:Gle(n.end)};let o=apt(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=Pn.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?Pn.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:Gle(i),endTime:Gle(a)}}console.warn(`Unable to parse time expression: ${t}`)}function Gle(t){let e=t.toJSDate(),r=t.offset,n=t.offsetNameShort||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:t.toLocaleString(Pn.DATETIME_FULL),localDateString:t.toISODate()||"",timezoneOffset:r,timezone:n}}function fti(t){let e=t.toString().length===10?t*1e3:t,r=Pn.fromMillis(e);return Gle(r)}async function pti(t,e,r){let n=Zpt(e),o=Zpt(r);try{let i=Pn.now().setZone(n),a=Gzr(t,i.toJSDate());if(!a)throw new Error(`Could not parse time: ${t}`);let s=Pn.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(Pn.DATETIME_FULL),localDateString:u.toISODate()||"",timezoneOffset:c,timezone:u.offsetNameShort||o,originalTime:s.toLocaleString(Pn.TIME_SIMPLE)+" "+s.offsetNameShort,convertedTime:u.toLocaleString(Pn.TIME_SIMPLE)+" "+u.offsetNameShort}}catch(i){throw new Error(`Failed to convert time: ${i.message}`)}}var c2r,d2r,f2r,p2r,m2r,h2r=v(()=>{Xzr();l2r();sA();dx();c2r=Yl({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:Ct.object({timezoneOffset:Ct.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)`)}),handler:async({timezoneOffset:t})=>nti(t),isBackground:!0}),d2r={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};f2r=Yl({name:"getTimeRangeMs",description:"Convert natural language time expressions to date ranges for use with localSearch",schema:Ct.object({timeExpression:Ct.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`)}),handler:async({timeExpression:t})=>dti(t),isBackground:!0});p2r=Yl({name:"getTimeInfoByEpoch",description:"Convert a Unix timestamp (in seconds or milliseconds) to detailed time information",schema:Ct.object({epoch:Ct.number().describe("Unix timestamp in seconds or milliseconds")}),handler:async({epoch:t})=>fti(t),isBackground:!0});m2r=Yl({name:"convertTimeBetweenTimezones",description:"Convert a specific time from one timezone to another using UTC offsets",schema:Ct.object({time:Ct.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:Ct.string().describe(`Source UTC offset. Must be numeric, not timezone name.
|
||
Examples: "-8" for PT, "+0" for London, "+8" for Beijing`),toOffset:Ct.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"`)}),handler:async({time:t,fromOffset:e,toOffset:r})=>pti(t,e,r),isBackground:!0})});var g2r,y2r,b2r=v(()=>{mR();Zt();sA();dx();g2r=5e4,y2r=Yl({name:"youtubeTranscription",description:"Get transcripts of YouTube videos when the user provides YouTube URLs",schema:Ct.object({}),isPlusOnly:!0,requiresUserMessageContent:!0,handler:async t=>{let{_userMessageContent:e}=t;if(typeof e!="string")return JSON.stringify({success:!1,message:"Invalid input: User message must be a string"});if(e.length>g2r)return JSON.stringify({success:!1,message:`Input too long: Maximum allowed length is ${g2r} characters`});let r=jRt(e);if(r.length===0)return JSON.stringify({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=await pc.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"}}})),o=n.some(i=>i.success);return JSON.stringify({success:o,results:n,total_urls:r.length})}})});function hti(t){bd.getInstance().register({tool:dBr(t.getRoot()),metadata:{id:"getFileTree",displayName:"File Tree",description:"Browse vault file structure",category:"file",isAlwaysEnabled:!0,requiresVault:!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 usage:
|
||
<use_tool>
|
||
<name>getFileTree</name>
|
||
</use_tool>
|
||
|
||
Example queries that should use getFileTree:
|
||
- "Create a new note in the projects folder" -> call getFileTree to get the exact folder path of projects folder
|
||
- "Create a new note using the quick note template" -> call getFileTree to look up the exact folder path of the quick note template
|
||
- "How many files are in the projects folder" -> call getFileTree to list all files in the projects folder
|
||
`}})}function gti(){bd.getInstance().register({tool:_Br(),metadata:{id:"getTagList",displayName:"Tag List",description:"List vault tags with occurrence statistics",category:"file",isAlwaysEnabled:!0,requiresVault:!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.
|
||
|
||
Example usage (default):
|
||
<use_tool>
|
||
<name>getTagList</name>
|
||
</use_tool>
|
||
|
||
Example usage (frontmatter only):
|
||
<use_tool>
|
||
<name>getTagList</name>
|
||
<includeInline>false</includeInline>
|
||
</use_tool>`}})}function yti(){bd.getInstance().register({tool:tje,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 usage:
|
||
<use_tool>
|
||
<name>updateMemory</name>
|
||
<statement>I'm studying Japanese and I'm preparing for JLPT N3</statement>
|
||
</use_tool>`}})}function tX(t){let e=bd.getInstance(),r=ae(),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(mti),t&&(hti(t),gti()),r.enableSavedMemory&&yti())}var mti,Dje=v(()=>{ot();Eft();fBr();Rft();mBr();Fft();vBr();h2r();yV();b2r();mti=[{tool:nje,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
|
||
|
||
Example usage:
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>piano learning practice</query>
|
||
<salientTerms>["piano", "learning", "practice"]</salientTerms>
|
||
</use_tool>
|
||
|
||
For localSearch with tags in the query (e.g., "#projectx status update"):
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>#projectx status update</query>
|
||
<salientTerms>["#projectx", "status", "update"]</salientTerms>
|
||
</use_tool>
|
||
|
||
For localSearch with time range (e.g., "what did I do last week"):
|
||
Step 1 - Get time range:
|
||
<use_tool>
|
||
<name>getTimeRangeMs</name>
|
||
<timeExpression>last week</timeExpression>
|
||
</use_tool>
|
||
|
||
Step 2 - Search with time range (after receiving time range result):
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>what did I do</query>
|
||
<salientTerms>[]</salientTerms>
|
||
<timeRange>{"startTime": {...}, "endTime": {...}}</timeRange>
|
||
</use_tool>
|
||
|
||
For localSearch with meaningful terms (e.g., "python debugging notes from yesterday"):
|
||
Step 1 - Get time range:
|
||
<use_tool>
|
||
<name>getTimeRangeMs</name>
|
||
<timeExpression>yesterday</timeExpression>
|
||
</use_tool>
|
||
|
||
Step 2 - Search with time range:
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>python debugging notes</query>
|
||
<salientTerms>["python", "debugging", "notes"]</salientTerms>
|
||
<timeRange>{"startTime": {...}, "endTime": {...}}</timeRange>
|
||
</use_tool>
|
||
|
||
For localSearch with non-English query (PRESERVE ORIGINAL LANGUAGE):
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>\u94A2\u7434\u5B66\u4E60</query>
|
||
<salientTerms>["\u94A2\u7434", "\u5B66\u4E60"]</salientTerms>
|
||
</use_tool>`}},{tool:oje,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":
|
||
<use_tool>
|
||
<name>webSearch</name>
|
||
<query>python tutorials</query>
|
||
<chatHistory>[]</chatHistory>
|
||
</use_tool>`}},{tool:c2r,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.
|
||
|
||
Example 1 - "what time is it" (local time):
|
||
<use_tool>
|
||
<name>getCurrentTime</name>
|
||
</use_tool>
|
||
|
||
Example 2 - "what time is it in Tokyo" (UTC+9):
|
||
<use_tool>
|
||
<name>getCurrentTime</name>
|
||
<timezoneOffset>+9</timezoneOffset>
|
||
</use_tool>
|
||
|
||
Example 3 - "what time is it in New York" (UTC-5 or UTC-4 depending on DST):
|
||
<use_tool>
|
||
<name>getCurrentTime</name>
|
||
<timezoneOffset>-5</timezoneOffset>
|
||
</use_tool>`}},{tool:p2r,metadata:{id:"getTimeInfoByEpoch",displayName:"Get Time Info",description:"Convert epoch timestamp to human-readable format",category:"time",isAlwaysEnabled:!0}},{tool:f2r,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:
|
||
<use_tool>
|
||
<name>getTimeRangeMs</name>
|
||
<timeExpression>last week</timeExpression>
|
||
</use_tool>`}},{tool:m2r,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):
|
||
<use_tool>
|
||
<name>convertTimeBetweenTimezones</name>
|
||
<time>6pm</time>
|
||
<fromOffset>-8</fromOffset>
|
||
<toOffset>+9</toOffset>
|
||
</use_tool>`}},{tool:pBr,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.
|
||
|
||
Example (first chunk):
|
||
<use_tool>
|
||
<name>readNote</name>
|
||
<notePath>Projects/launch-plan.md</notePath>
|
||
</use_tool>
|
||
|
||
Example (next chunk):
|
||
<use_tool>
|
||
<name>readNote</name>
|
||
<notePath>Projects/launch-plan.md</notePath>
|
||
<chunkIndex>1</chunkIndex>
|
||
</use_tool>`}},{tool:Z1e,metadata:{id:"writeToFile",displayName:"Write to File",description:"Create or modify files in your vault",category:"file",requiresVault:!0,copilotCommands:["@composer"],customPromptInstructions:`For writeToFile:
|
||
- 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 writeToFile for any intent of updating or creating files
|
||
- Do not call writeToFile tool again if the result is not accepted
|
||
- Do not call writeToFile 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
|
||
|
||
Example usage:
|
||
<use_tool>
|
||
<name>writeToFile</name>
|
||
<path>path/to/note.md</path>
|
||
<content>FULL CONTENT OF THE NOTE</content>
|
||
</use_tool>
|
||
|
||
Example usage with user explicitly asks to skip preview or confirmation:
|
||
<use_tool>
|
||
<name>writeToFile</name>
|
||
<path>path/to/note.md</path>
|
||
<content>FULL CONTENT OF THE NOTE</content>
|
||
<confirmation>false</confirmation>
|
||
</use_tool>
|
||
`}},{tool:lBr,metadata:{id:"replaceInFile",displayName:"Replace in File",description:"Make targeted changes to existing files using SEARCH/REPLACE blocks",category:"file",requiresVault:!0,customPromptInstructions:`For replaceInFile:
|
||
- Remember: Small edits \u2192 replaceInFile, Major rewrites \u2192 writeToFile
|
||
- SEARCH text must match EXACTLY including all whitespace
|
||
|
||
Example usage:
|
||
<use_tool>
|
||
<name>replaceInFile</name>
|
||
<path>notes/meeting.md</path>
|
||
<diff>
|
||
------- SEARCH
|
||
## Attendees
|
||
- John Smith
|
||
- Jane Doe
|
||
=======
|
||
## Attendees
|
||
- John Smith
|
||
- Jane Doe
|
||
- Bob Johnson
|
||
+++++++ REPLACE
|
||
</diff>
|
||
</use_tool>`}},{tool:y2r,metadata:{id:"youtubeTranscription",displayName:"YouTube Transcription",description:"Get transcripts from YouTube videos",category:"media",customPromptInstructions:`For youtubeTranscription:
|
||
- Use when user provides YouTube URLs
|
||
- No parameters needed - the tool will process URLs from the conversation
|
||
|
||
Example usage:
|
||
<use_tool>
|
||
<name>youtubeTranscription</name>
|
||
</use_tool>`}}]});var $je,_2r=v(()=>{Due();$je=class{constructor(e,r){this.toolManager=e;this.writeToFileTool=r;this.buffer=""}findCompleteBlock(e){let r=/<writeToFile>[\s\S]*?<\/writeToFile>/,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.writeToFileTool,{path:u,content:l}),d=fx.format("writeToFile",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)}}}});function Ypt(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.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 v2r(t){try{let e=JSON.parse(t);return Array.isArray(e)?Ypt(e):"Invalid search results format."}catch(e){return Be("Failed to format localSearch result string:",e),"Error processing search results."}}function w2r(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 bti(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 _ti(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 S2r(t){if(!Array.isArray(t)||t.length===0){B("Search Results: (none)");return}let e=0,r=t.map((u,l)=>{let c=bti(u.mtime),d=typeof u.rerank_score=="number"?u.rerank_score:u.score||0,f=(Number.isFinite(d)?d:0).toFixed(4),p=u.chunkId||u.path||"",m=_ti(u.explanation),h=u.includeInContext!==!1;return h&&e++,{idx:String(l+1),in:h?"Y":"",path:p,mtime:c,score:f,explanation:m}}),n=r.length;B(`Search Results (debug table): ${n} rows; in-context ${e}/${n}`),_Rt(r,["idx","in","path","mtime","score","explanation"]);let o=u=>String(u||"").replace(/\|/g,"\\|"),i="| # | IN | PATH | MTIME | SCORE | EXPLANATION |",a="| ---: | :-: | --- | --- | ---: | --- |",s=r.map(u=>`| ${u.idx} | ${u.in} | ${o(u.path)} | ${u.mtime||""} | ${u.score} | ${o(u.explanation)} |`);ige(["",`Results: ${n} rows; in-context ${e}/${n}`,"",i,a,...s,""])}var C2r=v(()=>{_t()});function x2r(t,e){return[t,e].map(n=>n?.trim()).filter(n=>!!n).join(`
|
||
|
||
`)}function O2r(t,e){let r=t?`
|
||
${t}
|
||
`:"";return`<localSearch${e?` timeRange="${e}"`:""}>${r}</localSearch>`}function Qpt(t,e){let r=t.trim();return r?`${r}
|
||
|
||
${e}`:e}function T2r(t,e){let r=e.trim();return!r||t.includes(r)?t:Qpt(t,`[User query]:
|
||
${r}`)}var emt=v(()=>{});function E2r(t){let e=[],r=0;for(;r<t.length;){let n=t.indexOf("![",r);if(n===-1)break;let o=Sti(t,n+2);if(o===null){r=n+2;continue}let i=o+1;for(;i<t.length&&Lje(t[i]);)i++;if(t[i]!=="("){r=i;continue}let a=Cti(t,i);if(a===null){r=i+1;continue}let s=vti(t.slice(i+1,a));s&&e.push(s),r=a+1}return e}function vti(t){let e=t.trim();if(e.length===0)return null;if(e.startsWith("<")){let n=xti(e,0);if(n===null)return null;let o=e.slice(1,n).trim();return o.length>0?o:null}let r=wti(e).trim();return r.length>0?r:null}function wti(t){let e=t.trimEnd();if(e.length===0)return"";let r=e[e.length-1];if(r==='"'||r==="'"){let o=Oti(e,r,e.length-1);if(o!==null){let i=e.slice(0,o);if(i.length>0&&Lje(i[i.length-1]))return i.trimEnd()}}if(r===")"){let n=Tti(e);if(n!==null){let o=e.slice(0,n);if(o.length>0&&Lje(o[o.length-1]))return o.trimEnd()}}return e}function Sti(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 Cti(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(Lje(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 xti(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 Oti(t,e,r){for(let n=r-1;n>=0;n--)if(t[n]===e&&!P2r(t,n))return n;return null}function Tti(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==="(")&&P2r(t,r))){if(n===")"){e++;continue}if(n==="("&&(e--,e===0))return r}}return null}function P2r(t,e){let r=0;for(let n=e-1;n>=0&&t[n]==="\\";n--)r++;return r%2===1}function Lje(t){return t===" "||t===" "||t===`
|
||
`||t==="\r"}var M2r=v(()=>{});function cJ(t){return t.map(e=>e.content).filter(e=>e&&e.trim().length>0).join(`
|
||
|
||
`)}function Fje(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))}var omt,lJ,tmt,rmt,nmt,hU,Xle=v(()=>{_t();omt=50;lJ=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 cJ(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.
|
||
|
||
When you need to use a tool, format it EXACTLY like this:
|
||
<use_tool>
|
||
<name>tool_name_here</name>
|
||
<parameter_name>value</parameter_name>
|
||
<another_parameter>["array", "values"]</another_parameter>
|
||
</use_tool>
|
||
|
||
IMPORTANT: Use the EXACT parameter names as shown in the tool descriptions below. Do NOT use generic names like "param1" or "param".
|
||
`}],l=r.trim();return l.length>0&&u.push({id:"tool-descriptions",label:"Tool XML parameter descriptions",source:"src/LLMProviders/chainRunner/AutonomousAgentChainRunner.ts#generateToolDescriptions",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:`## General Guidelines
|
||
- Think hard about whether a query could potentially be answered from personal knowledge or notes, if yes, call a vault search (localSearch) first
|
||
- 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.
|
||
|
||
IMPORTANT: Do not include any code blocks (\`\`\`) or tool_code blocks in your responses. Only use the <use_tool> format for tool calls.
|
||
|
||
NOTE: Use individual XML parameter tags. For arrays, use JSON format like ["item1", "item2"].`}),u}enhanceUserMessage(e,r){return e}needsSpecialHandling(){return!1}},tmt=class extends lJ{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("writeToFile")||a.includes("replaceInFile"),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
|
||
|
||
Example localSearch without time:
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>piano notes</query>
|
||
<salientTerms>["piano", "notes"]</salientTerms>
|
||
</use_tool>`):u.push("CRITICAL FOR GPT MODELS: You MUST ALWAYS include XML tool calls in your response. Do not just describe what you plan to do - you MUST include the actual XML tool call blocks."),s&&u.push(`\u{1F6A8} FILE EDITING WITH COMPOSER TOOLS - GPT SPECIFIC EXAMPLES \u{1F6A8}
|
||
|
||
When user asks you to edit or modify a file, you MUST:
|
||
1. Determine if it's a small edit (use replaceInFile) or major rewrite (use writeToFile)
|
||
2. Include the tool call immediately in your response
|
||
|
||
EXAMPLE 1 - User says "fix the typo 'teh' to 'the' in my note":
|
||
\u2705 CORRECT RESPONSE:
|
||
"I'll fix the typo in your note.
|
||
|
||
<use_tool>
|
||
<name>replaceInFile</name>
|
||
<path>path/to/note.md</path>
|
||
<diff>
|
||
------- SEARCH
|
||
teh
|
||
=======
|
||
the
|
||
+++++++ REPLACE
|
||
</diff>
|
||
</use_tool>"
|
||
|
||
EXAMPLE 2 - User says "add item 4 to the list":
|
||
\u2705 CORRECT RESPONSE:
|
||
"I'll add item 4 to your list.
|
||
|
||
<use_tool>
|
||
<name>replaceInFile</name>
|
||
<path>path/to/file.md</path>
|
||
<diff>
|
||
------- SEARCH
|
||
- Item 1
|
||
- Item 2
|
||
- Item 3
|
||
=======
|
||
- Item 1
|
||
- Item 2
|
||
- Item 3
|
||
- Item 4
|
||
+++++++ REPLACE
|
||
</diff>
|
||
</use_tool>"
|
||
|
||
\u274C WRONG (DO NOT DO THIS):
|
||
"I'll help you add item 4 to the list. Let me update that for you."
|
||
[No tool call = FAILURE]
|
||
|
||
CRITICAL: The diff parameter MUST contain the SEARCH/REPLACE blocks wrapped in triple backticks EXACTLY as shown above.`),u.push("FINAL REMINDER FOR GPT MODELS: If the user asks you to search, find, edit, or modify anything, you MUST include the appropriate <use_tool> XML block in your very next response. 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: Use the <use_tool> XML format to call the localSearch tool.`:i?`${e}
|
||
|
||
\u{1F6A8} GPT REMINDER: Use replaceInFile for small edits (with SEARCH/REPLACE blocks in diff parameter). The diff parameter MUST contain triple backticks around the SEARCH/REPLACE blocks. Check the examples in your system prompt.`:e}needsSpecialHandling(){return!0}},rmt=class extends lJ{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")}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
|
||
- Place ALL tool calls AFTER your thinking is complete, in the main response body
|
||
- Tool calls must be in the main response body, NOT inside thinking sections
|
||
- Format tool calls exactly as shown in the examples above
|
||
- Do not provide final answers before using tools - use tools first, then provide your response based on the results
|
||
- If you need to use tools, include them immediately after your thinking, before any final response
|
||
|
||
CORRECT FLOW FOR THINKING MODELS:
|
||
1. Think through the problem (this happens automatically)
|
||
2. Use tools to gather information (place tool calls in main response)
|
||
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: <use_tool>...</use_tool>
|
||
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 FIRST RESPONSE PATTERN (when tools needed):
|
||
I'll search your vault for piano practice information.
|
||
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>piano practice</query>
|
||
<salientTerms>["piano", "practice"]</salientTerms>
|
||
</use_tool>
|
||
|
||
\u{1F310} MULTILINGUAL EXAMPLE (PRESERVE ORIGINAL LANGUAGE):
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>\u30D4\u30A2\u30CE\u306E\u7DF4\u7FD2\u65B9\u6CD5</query>
|
||
<salientTerms>["\u30D4\u30A2\u30CE", "\u7DF4\u7FD2", "\u65B9\u6CD5"]</salientTerms>
|
||
</use_tool>
|
||
|
||
<use_tool>
|
||
<name>webSearch</name>
|
||
<query>piano techniques</query>
|
||
<chatHistory>[]</chatHistory>
|
||
</use_tool>
|
||
|
||
[RESPONSE ENDS HERE - NO MORE TEXT]
|
||
|
||
\u{1F3AF} CORRECT FOLLOW-UP RESPONSE PATTERN:
|
||
Let me gather more specific information about practice schedules.
|
||
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>practice schedule</query>
|
||
<salientTerms>["practice", "schedule"]</salientTerms>
|
||
</use_tool>
|
||
|
||
[RESPONSE ENDS HERE - NO MORE TEXT]
|
||
|
||
\u274C WRONG PATTERN (DO NOT DO THIS):
|
||
<use_tool>...</use_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()}detectPrematureResponse(e){let r=e.indexOf("<use_tool>");if(r===-1)return{hasPremature:!1,type:null};let o=e.substring(0,r).trim().replace(/<think>[\s\S]*?<\/think>/g,"").trim();if(o.split(/[.!?]+/).filter(u=>u.trim().length>0).length>2||o.length>200)return{hasPremature:!0,type:"before"};let s=e.lastIndexOf("</use_tool>");return s!==-1&&e.substring(s+11).trim().replace(/<think>[\s\S]*?<\/think>/g,"").trim().length>100?{hasPremature:!0,type:"after"}:{hasPremature:!1,type:null}}sanitizeResponse(e,r){if(!this.isClaudeSonnet4()||r!==1)return e;let n=this.detectPrematureResponse(e);if(!n.hasPremature)return e;if(n.type==="after"){let o=e.lastIndexOf("</use_tool>");if(o!==-1){let i=e.substring(0,o+11),a=e.substring(o+11),s=/<think>[\s\S]*?<\/think>/g,u=a.match(s)||[];return i+(u.length>0?`
|
||
`+u.join(`
|
||
`):"")}}return e}shouldTruncateStreaming(e){if(!this.isClaudeSonnet4())return!1;let r=e.lastIndexOf("</use_tool>");return r===-1?!1:e.substring(r+11).trim().replace(/<think>[\s\S]*?<\/think>/g,"").trim().length>omt}},nmt=class extends lJ{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:
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>piano</query>
|
||
<salientTerms>["piano"]</salientTerms>
|
||
</use_tool>`:""}`.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"
|
||
Your response:
|
||
<use_tool>
|
||
<name>getTimeRangeMs</name>
|
||
<timeExpression>last week</timeExpression>
|
||
</use_tool>
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<timeRange>{"startTime":1234567890,"endTime":9876543210}</timeRange>
|
||
</use_tool>
|
||
|
||
This is WRONG because you're hallucinating the timeRange values! You don't know what getTimeRangeMs will return yet!
|
||
|
||
\u2705 CORRECT (DO THIS):
|
||
User: "Recap my last week"
|
||
Your FIRST response:
|
||
<use_tool>
|
||
<name>getTimeRangeMs</name>
|
||
<timeExpression>last week</timeExpression>
|
||
</use_tool>
|
||
|
||
[STOP HERE - WAIT FOR RESULT]
|
||
|
||
System provides: {"startTime":1753660800000,"endTime":1754265600000}
|
||
|
||
Your SECOND response:
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>recap my last week</query>
|
||
<salientTerms>[]</salientTerms>
|
||
<timeRange>{"startTime":1753660800000,"endTime":1754265600000}</timeRange>
|
||
</use_tool>
|
||
|
||
RULE: NEVER make up or guess parameter values. If you need a tool's output, call that tool FIRST, then WAIT for the result.
|
||
|
||
PATTERN FOR MULTI-STEP REQUESTS:
|
||
User: "based on my project roadmap notes and create summary"
|
||
Your response:
|
||
<use_tool>
|
||
<name>localSearch</name>
|
||
<query>project roadmap</query>
|
||
<salientTerms>["project", "roadmap"]</salientTerms>
|
||
</use_tool>
|
||
|
||
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}},hU=class{static createAdapter(e){let r=(e.modelName||e.model||"").toLowerCase();if(B(`Creating model adapter for: ${r}`),r.includes("gpt")){let n=new tmt(r);return n.isGPT5Model()?B("Using GPTModelAdapter with GPT-5 specific enhancements"):B("Using GPTModelAdapter"),n}return r.includes("claude")?(B("Using ClaudeModelAdapter"),new rmt(r)):r.includes("gemini")||r.includes("google/gemini")?(B("Using GeminiModelAdapter"),new nmt(r)):r.includes("copilot-plus")?(B("Using BaseModelAdapter for Copilot Plus"),new lJ(r)):(B("Using BaseModelAdapter (default)"),new lJ(r))}}});function Yc(t){return typeof t!="string"?"":t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function I2r(t){return typeof t!="string"?"":t.replace(/'/g,"'").replace(/"/g,'"').replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function rX(t){let e=[];try{let r=/<use_tool>([\s\S]*?)(<\/use_tool>|$)/g,n;for(;(n=r.exec(t))!==null;){let o=n[1],i=o.match(/<name>([\s\S]*?)<\/name>/),a=n[2]==="</use_tool>";if(i){let s=i[1].trim();if(!s||s.length===0){Be("Skipping tool call with empty name");continue}let u={},l=o.replace(/<name>[\s\S]*?<\/name>/,""),c=/<([^>]+)>([\s\S]*?)<\/\1>/g,d;for(;(d=c.exec(l))!==null;){let f=d[1].trim(),p=d[2].trim();f&&(u[f]=imt(p,f))}a||Be(`Detected partial tool call block for tool "${s}" - treating as best effort parse`),e.push({name:s,args:u})}}}catch(r){return ne("Error parsing XML tool calls:",r),[]}return e}function imt(t,e){if(!t)return e==="chatHistory"||e==="salientTerms"?[]:"";if(!/<[^>]+>/.test(t)){if(t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}"))try{return JSON.parse(t)}catch{return t}return t}let n=t.match(/<item>([\s\S]*?)<\/item>/g);if(n)return n.map(s=>{let u=s.replace(/<\/?item>/g,"").trim();return imt(u)});let o=/<([^>]+)>([\s\S]*?)<\/\1>/g,i=[],a;for(;(a=o.exec(t))!==null;){let s=a[1].trim(),u=a[2].trim();i.push([s,imt(u)])}return i.length>0?Object.fromEntries(i):t}function R2r(t){t=t.replace(/<use_tool>[\s\S]*?<\/use_tool>/g,"");let e=t.match(/<use_tool>([\s\S]*)/),n=(e?e[1]:t).match(/<name>([\s\S]*?)<\/name>/);return n&&n[1].trim()||null}function Zle(t){let e=t;return e=e.replace(/<use_tool>[\s\S]*?<\/use_tool>/g,""),e=e.replace(/<use_tool>([\s\S]*)$/g,""),e=e.replace(/```\w*\s*```/g,""),e=e.replace(/```tool_code[\s\S]*?```/g,""),e=e.replace(/```[\w]*[\s\n]*```/g,""),e=e.replace(/\n\s*\n\s*\n/g,`
|
||
|
||
`).trim(),e}var Yle=v(()=>{_t()});var uA,kje=v(()=>{k1e();Or();Mie();Fot();_t();Nv();ot();Vq();Eft();Y1e();Due();yV();Dje();Fft();Rft();Zt();Zt();Pie();_2r();uG();Cue();C2r();emt();M2r();bV();Lue();F1();Xle();Yle();dx();k1();qs();uA=class t extends L1{constructor(){super(...arguments);this.lastCitationSources=null}getAvailableToolsForPlanning(){let r=bd.getInstance();return r.getAllTools().length===0&&tX(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")}static generateToolDescriptions(r){return r.map(n=>{let o="",i=X1e(n.schema);return Object.keys(i).length>0&&(o=Object.entries(i).map(([a,s])=>`<${a}>${s}</${a}>`).join(`
|
||
`)),`<${n.name}>
|
||
<description>${n.description}</description>
|
||
<parameters>
|
||
${o}
|
||
</parameters>
|
||
</${n.name}>`}).join(`
|
||
|
||
`)}async planToolCalls(r,n){let o=this.getAvailableToolsForPlanning(),i=hU.createAdapter(n),a=t.generateToolDescriptions(o),s=bd.getInstance(),u=o.map(g=>s.getToolMetadata(g.name)).filter(g=>g!==void 0),l=i.buildSystemPromptSections("You are a helpful AI assistant. Analyze the user's message and determine if any tools should be called.",a,o.map(g=>g.name),u),c=cJ(l);c+=`
|
||
|
||
IMPORTANT: Respond ONLY with XML blocks. Do not include any natural language explanations, apologies, or commentary.
|
||
|
||
Your response must contain:
|
||
1. Tool calls (if needed): <use_tool>...</use_tool>
|
||
2. Salient terms (always): <salient_terms><term>keyword</term></salient_terms>
|
||
|
||
Format for salient terms:
|
||
<salient_terms>
|
||
<term>first keyword</term>
|
||
<term>second keyword</term>
|
||
</salient_terms>
|
||
|
||
Guidelines for salient terms:
|
||
- Extract meaningful nouns, topics, and specific concepts
|
||
- Exclude common words like "what", "how", "my", "the", "a", "an"
|
||
- Exclude time expressions (those are handled separately)
|
||
- If the message has no meaningful search terms, output empty <salient_terms></salient_terms>
|
||
- Use the EXACT words from the user's message (preserve language/spelling)
|
||
|
||
OUTPUT ONLY XML - NO OTHER TEXT.`;let d=[{role:Iz(n),content:c},{role:"user",content:r}];B("[CopilotPlus] Requesting tool planning from model...");let f=await rh(()=>n.invoke(d)),p=typeof f.content=="string"?f.content:String(f.content);B("[CopilotPlus] Model planning response:",p.substring(0,500));let m=rX(p),h=this.extractSalientTerms(p),y=[];for(let g of m){let b=o.find(_=>_.name===g.name);b&&y.push({tool:b,args:g.args})}return{toolCalls:y,salientTerms:h}}extractSalientTerms(r){let n=r.match(/<salient_terms>([\s\S]*?)<\/salient_terms>/);if(!n)return[];let i=n[1].matchAll(/<term>(.*?)<\/term>/g),a=[];for(let s of i){let u=s[1].trim();u&&a.push(u)}return a}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:nje,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 Nm.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),d=lge(c);s.push({tool:oje,args:{query:a,chatHistory:d}})}return i.includes("@memory")&&(s.some(l=>l.tool.name==="updateMemory")||s.push({tool:tje,args:{statement:a}})),s}removeAtCommands(r){return r.split(" ").filter(n=>!S7.includes(n.toLowerCase())).join(" ").trim()}async processImageUrls(r){let n=[],o=await gV.processUrlBatch(r,n,this.chainManager.app.vault);return gV.showFailedImagesNotice(n),o}async processChatInputImages(r){let n=[],o=await gV.processChatImageBatch(r,n,this.chainManager.app.vault);return gV.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?I2r(u[1]):"";if(!l)return[];let d=new RegExp(`<${n.identifierTag}>(.*?)<\\/${n.identifierTag}>`).exec(a),f=d?d[1]:void 0;B(`[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):(Be(`Could not resolve embedded image: ${l} from source: ${n}`),i.push(l))}else i.push(l)}let s=E2r(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=ae(),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>
|
||
${qRt}
|
||
</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.");B("[CopilotPlus] Using envelope-based context construction");let m=vR.convert(p,{includeSystemMessage:!0,mergeUserContent:!0,debug:!1}),h=m.find(w=>w.role==="system");h&&f.push({role:Iz(c),content:h.content}),await wk(l,f);let y=m.find(w=>w.role==="user");if(y){let w,O=o.length>0,T=M=>{let I="[User query]:";if(M.includes(I))return M;let j=M.trimEnd(),A=[];j.length>0&&A.push(j);let k=s.trim()||n.message?.trim()||n.originalMessage?.trim()||"";return k.length>0?A.push(`${I}
|
||
${k}`):A.push(I),A.join(`
|
||
|
||
`)};if(O){let M=this.formatAllToolOutputs(o),I=T(y.content);w=Qpt(M,I)}else w=T(y.content);if(r.includes("<OUTPUT_FORMAT>")&&!w.includes("<OUTPUT_FORMAT>")){let M=r.match(/<OUTPUT_FORMAT>[\s\S]*?<\/OUTPUT_FORMAT>/);M&&(w+=`
|
||
|
||
`+M[0])}let P=d?await this.buildMessageContent(w,n):w;f.push({role:"user",content:P})}B("Final request to AI",{messages:f.length});let g=c?.modelName;Sk({messages:f,modelName:g,contextEnvelope:n.contextEnvelope});let b=new $je(RD,Z1e),_=await rh(()=>this.chainManager.chatModelManager.getChatModel().stream(f,{signal:i.signal}));for await(let w of _){if(i.signal.aborted){B("CopilotPlus multimodal stream iteration aborted",{reason:i.signal.reason});break}for await(let O of b.processChunk(w))a.processChunk(O)}}async run(r,n,o,i,a){let{updateLoadingMessage:s}=a,u=this.chainManager.chatModelManager.getChatModel(),c=!this.hasCapability(u,"reasoning"),d=new T_(o,void 0,c),f=[];if(!await $S({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{B("==== 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 T=w.layers.find(k=>k.id==="L5_USER")?.text||r.originalMessage||r.message;try{let k=this.chainManager.chatModelManager.getChatModel(),V=await this.planToolCalls(T,k),q,J=V.toolCalls.find(ue=>ue.tool.name==="getTimeRangeMs");J&&(q=await RD.callTool(J.tool,J.args),B("[CopilotPlus] Executed getTimeRangeMs, result:",q));let K=V.toolCalls.filter(ue=>ue.tool.name==="getFileTree"&&t6()?(B("Skipping getFileTree in project mode"),!1):ue.tool.name==="getTimeRangeMs"&&q?(B("Skipping getTimeRangeMs - already executed during planning"),!1):!0);_=await this.processAtCommands(T,K,{salientTerms:V.salientTerms,timeRange:q})}catch(k){return this.handleResponse(ORt(k),r,n,i,o)}let P=this.removeAtCommands(r.message),{toolOutputs:M,sources:I}=await this.executeToolCalls(_,s);f=I;let j=M.filter(k=>k.output!=null),A=this.appendComposerInstructionsIfNeeded(P,r);B("Invoking LLM with envelope-based context construction"),await this.streamMultimodalResponse(A,r,j,n,d,P,s)}catch(_){s?.(Sv.DEFAULT),_.name==="AbortError"||n.signal.aborted?B("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=ae(),b=this.lastCitationSources&&this.lastCitationSources.length>0?this.lastCitationSources:(f||[]).map(_=>({title:_.title,path:_.path}));return h=$1e(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){B("Skipping getFileTree since localSearch is already active");continue}B(`Step 2: Calling tool: ${s.tool.name}`),s.tool.name==="localSearch"?n?.(Sv.READING_FILES):s.tool.name==="webSearch"?n?.(Sv.SEARCHING_WEB):s.tool.name==="getFileTree"&&n?.(Sv.READING_FILE_TREE);let u=await RD.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:Jq(i)}}getTimeExpression(r){let n=r.find(o=>o.tool.name==="getTimeRangeMs");return n?n.args.timeExpression:""}prepareLocalSearchResult(r,n){let o=r.filter(y=>y.includeInContext),i=o.reduce((y,g)=>y+(g.content?.length||0),0),a=o;if(i>_He){let y=_He/i;B("Truncating document contents to fit context length. Truncation ratio:",y),a=o.map(g=>({...g,content:g.content?.slice(0,Math.floor((g.content?.length||0)*y))||""}))}let s=a.map((y,g)=>({...y,__sourceId:g+1,content:L1e(y.content||"")})),u=Ypt(s),l=s.slice(0,Math.min(20,s.length)).map(y=>({title:y.title||y.path||"Untitled",path:y.path||y.title||""})),c=F1e(l);this.lastCitationSources=s.slice(0,Math.min(20,s.length)).map(y=>({title:y.title||y.path||"Untitled",path:y.path||void 0}));let d=ae(),f=$Ur(c,d.enableInlineCitations).trim(),m=x2r("Answer the question based only on the following context:",u),h=f?`${m}
|
||
|
||
${f}`:m;return O2r(h,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};S2r(u),o=w2r(u),i=this.prepareLocalSearchResult(u,n||""),a=fx.format("localSearch",i)}catch(s){Be("Failed to parse localSearch results:",s);let u=v2r(r.result);i=n?`<localSearch timeRange="${n}">
|
||
${u}
|
||
</localSearch>`:`<localSearch>
|
||
${u}
|
||
</localSearch>`,a=fx.format("localSearch",i)}return{formattedForLLM:i,formattedForDisplay:a,sources:o}}async getSystemPrompt(){return MD(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 Qle,A2r=v(()=>{kje();Qle=class extends uA{}});function Eti(t){let{systemSections:e,rawHistory:r,adapterName:n,originalUserMessage:o,enhancedUserMessage:i}=t,a=[...e];if(r&&r.length>0){let u=Kot(r);if(u.length>0){let c=Kgr(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 Pti(t){return t.map(e=>`${`[Section: ${e.label} | Source: ${e.source}]`}
|
||
${e.content}`).join(`
|
||
|
||
`)}function N2r(t){let e=Eti(t),r=Pti(e),n=cJ(t.systemSections);return{sections:e,annotatedPrompt:r,systemPrompt:n}}var j2r=v(()=>{Xle();uG()});async function Mti(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=Fje(s.message),m=r.enhanceUserMessage(s.message,p);return N2r({systemSections:u,rawHistory:d,adapterName:r.constructor?.name||"ModelAdapter",originalUserMessage:f,enhancedUserMessage:m})}async function Iti(t){return MD(t.userMemoryManager)}async function D2r(t){let{chainManager:e,adapter:r,availableTools:n,toolDescriptions:o,userMessage:i}=t,a=bd.getInstance(),s=n.map(c=>c.name),u=n.map(c=>a.getToolMetadata(c.name)).filter(c=>c!==void 0),l=await Iti(e);return Mti({chainManager:e,adapter:r,basePrompt:l,toolDescriptions:o,toolNames:s,toolMetadata:u,userMessage:i})}var $2r=v(()=>{Vq();yV();Xle();j2r()});var ece,L2r=v(()=>{Or();_t();Nv();ot();Vq();Dje();dx();yV();Due();Zt();LTe();Qa();kje();uG();Xle();bV();Tie();Lue();emt();Mie();$2r();F1();Yle();ece=class t extends uA{constructor(){super(...arguments);this.llmFormattedMessages=[];this.lastDisplayedContent=""}getAvailableTools(){let r=ae(),n=bd.getInstance();n.getAllTools().length===0&&tX(this.chainManager.app?.vault);let o=new Set(r.autonomousAgentEnabledToolIds||[]);return n.getEnabledTools(o,!!this.chainManager.app?.vault)}static generateToolDescriptions(r){return r.map(o=>{let i="",a=X1e(o.schema);return Object.keys(a).length>0&&(i=Object.entries(a).map(([s,u])=>`<${s}>${u}</${s}>`).join(`
|
||
`)),`<${o.name}>
|
||
<description>${o.description}</description>
|
||
<parameters>
|
||
${i}
|
||
</parameters>
|
||
</${o.name}>`}).join(`
|
||
|
||
`)}static async generateSystemPrompt(r,n,o){let i=await MD(o),a=t.generateToolDescriptions(r),s=r.map(c=>c.name),u=bd.getInstance(),l=r.map(c=>u.getToolMetadata(c.name)).filter(c=>c!==void 0);return n.enhanceSystemPrompt(i,a,s,l)}async buildToolPromptDebugReport(r){let n=this.getAvailableTools(),o=hU.createAdapter(this.chainManager.chatModelManager.getChatModel()),i=t.generateToolDescriptions(n);return D2r({chainManager:this.chainManager,adapter:o,availableTools:n,toolDescriptions:i,userMessage:r})}applyCiCOrderingToLocalSearchResult(r,n){return T2r(r,n)}getTemporaryToolCallId(r,n){return`temporary-tool-call-id-${r}-${n}`}async run(r,n,o,i,a){this.llmFormattedMessages=[],this.lastDisplayedContent="";let s="",u,l=await $S({isAutonomousAgent:!0}),c=this.chainManager.chatModelManager.getChatModel(),d=hU.createAdapter(c),p=!this.hasCapability(c,"reasoning"),m=new T_(o,d,p);if(!l){await this.handleError(new Error("Invalid license key"),m.processErrorChunk.bind(m));let b=m.close().content;return this.handleResponse(b,r,n,i,o,void 0)}let h=c?.modelName;if(!r.contextEnvelope)throw new Error("[Agent] Context envelope is required but not available. Cannot proceed with autonomous agent.");B("[Agent] Using envelope-based context construction");let g=await this.prepareAgentConversation(r,c,a.updateLoadingMessage);try{let b=await this.executeAgentLoop({...g,adapter:d,abortController:n,updateCurrentAiMessage:o});s=b.fullAIResponse,u=b.responseMetadata,g.iterationHistory=b.iterationHistory,g.collectedSources=b.collectedSources,this.llmFormattedMessages=b.llmMessages}catch(b){if(b.name==="AbortError"||n.signal.aborted)B("Autonomous agent stream aborted by user",{reason:n.signal.reason});else{ne("Autonomous agent failed, falling back to regular Plus mode:",b);try{return await new uA(this.chainManager).run(r,n,o,i,a)}catch(_){ne("Fallback to regular Plus mode also failed:",_),this.lastDisplayedContent&&m.processChunk({content:this.lastDisplayedContent});let w=Sn(b),O=`
|
||
|
||
Fallback to regular Plus mode also failed: `+Sn(_);return await this.handleError(new Error(w+O),m.processErrorChunk.bind(m)),s=m.close().content,this.handleResponse(s,r,n,i,o,void 0,s)}}}return await this.finalizeAgentRun({...g,userMessage:r,abortController:n,addMessage:i,updateCurrentAiMessage:o,modelNameForLog:h,responseMetadata:u,fullAIResponse:s})}async prepareAgentConversation(r,n,o){let i=[],a=[],s=[],u=this.getAvailableTools(),l={availableTools:u,getTemporaryToolCallId:this.getTemporaryToolCallId.bind(this),processLocalSearchResult:this.processLocalSearchResult.bind(this),applyCiCOrderingToLocalSearchResult:this.applyCiCOrderingToLocalSearchResult.bind(this)},c=r.contextEnvelope,d=vR.convert(c,{includeSystemMessage:!0,mergeUserContent:!0,debug:!1}),f=this.chainManager.memoryManager.getMemory(),p=d.find(I=>I.role==="system"),m=hU.createAdapter(n),h=t.generateToolDescriptions(u),y=bd.getInstance(),g=u.map(I=>y.getToolMetadata(I.name)).filter(I=>I!==void 0),_=m.buildSystemPromptSections("",h,u.map(I=>I.name),g).filter(I=>I.id!=="base-system-prompt"),w=cJ(_);if(p||w){let I=[p?.content||"",w||""].filter(Boolean).join(`
|
||
|
||
`);i.push({role:Iz(n),content:I})}let T=c.layers.find(I=>I.id==="L5_USER")?.text||"",P=T||r.originalMessage||r.message;await wk(f,i);let M=d.find(I=>I.role==="user");if(M){let I=this.isMultimodalModel(n),j=Fje(T),A=m.enhanceUserMessage(M.content,j),k=I?await this.buildMessageContent(A,r):A;i.push({role:"user",content:k})}return{conversationMessages:i,iterationHistory:a,collectedSources:s,originalUserPrompt:P,loopDeps:l}}async executeAgentLoop(r){let{conversationMessages:n,iterationHistory:o,collectedSources:i,originalUserPrompt:a,loopDeps:s,adapter:u,abortController:l,updateCurrentAiMessage:c}=r,d=[...o],f=[...i],p=[],{availableTools:m}=s,h=ae().autonomousAgentMaxIterations,y=0,g="",b;for(;y<h&&!this.isAbortRequested(l);){y+=1,B(`=== Autonomous Agent Iteration ${y} ===`);let _=[],w=await this.streamResponse(n,l,J=>this.updateStreamingDisplay(J,d,_,c,s),u);b={wasTruncated:w.wasTruncated,tokenUsage:w.tokenUsage??void 0};let O=w.content;if(!O)break;let T=rX(O),P=u.detectPrematureResponse?.(O);if(P?.hasPremature&&y===1&&(P.type==="before"?(Be("\u26A0\uFE0F Model provided premature response BEFORE tool calls!"),Be("Sanitizing response to keep only tool calls for first iteration")):P.type==="after"&&(Be("\u26A0\uFE0F Model provided hallucinated response AFTER tool calls!"),Be("Truncating response at last tool call for first iteration"))),T.length===0){let J=Zle(O),K=[...d];J.trim()&&K.push(J),g=K.join(`
|
||
|
||
`);let ue=jTe(O);n.push({role:"assistant",content:ue}),p.push(O);break}let M=O;u.sanitizeResponse&&P?.hasPremature&&(M=u.sanitizeResponse(O,y));let I=Zle(M);I.trim()&&d.push(I);let j=[],A=new Map;_.splice(T.length);for(let J=0;J<T.length;J+=1){let K=T[J];if(this.isAbortRequested(l))break;Dft(K,y);let oe=m.find(se=>se.name===K.name)?.isBackground||!1,G;if(!oe){let se=E7(K.name),ie=QH(K.name);if(K.name==="readNote"){let D=typeof K.args?.notePath=="string"?K.args.notePath:null;D&&D.trim().length>0&&(ie=Q1e(D))}let $=hBr(K.name);G=`${K.name}-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,A.set(J,G);let H=DTe(G,K.name,ie,se,$||"",!0,"",""),re=_.findIndex(D=>D.includes(s.getTemporaryToolCallId(K.name,J)));re!==-1?_[re]=H:(_.push(H),Be("Created tool call marker for tool call that was not created during streaming",K.name)),c([...d,..._].join(`
|
||
|
||
`))}let Y=await jft(K,m,a);if(Y.success||(Y.displayResult=dG(Y.result,"Tool execution failed")),K.name==="localSearch"){if(Y.success){let se=s.processLocalSearchResult(Y);f.push(...se.sources),Y.result=s.applyCiCOrderingToLocalSearchResult(se.formattedForLLM,a||""),Y.displayResult=se.formattedForDisplay}}else K.name==="readNote"&&Y.success&&(Y.displayResult=fx.format("readNote",Y.result));if(j.push(Y),G&&!oe){let se=_.findIndex(ie=>ie.includes(G));se!==-1&&(_[se]=Jot(_[se],G,Y.displayResult??Y.result)),c([...d,..._].join(`
|
||
|
||
`))}$ft(K.name,Y)}_.length>0&&d.push(_.join(`
|
||
`));let k=M;if(p.push(k),j.length>0){let J=Got(j,!0);J&&p.push(J)}let V=jTe(M);n.push({role:"assistant",content:V});let q=Got(j,!1);n.push({role:"user",content:q}),B("Tool results added to conversation")}if(y>=h&&!g){Be(`Autonomous agent reached maximum iterations (${h}) without completing the task`);let _=`
|
||
|
||
I've reached the maximum number of iterations (${h}) for this task. I attempted to gather information using various tools but couldn't complete the analysis within the iteration limit. You may want to try a more specific question or break down your request into smaller parts.`;g=d.join(`
|
||
|
||
`)+_,n.push({role:"assistant",content:g})}return{fullAIResponse:g,responseMetadata:b,iterationHistory:d,collectedSources:f,llmMessages:p}}updateStreamingDisplay(r,n,o,i,a){let s=Zle(r),u=[...n];s.trim()&&u.push(s);let l=rX(r),c=new Set(a.availableTools.filter(h=>h.isBackground).map(h=>h.name));if(o.length>0&&c.size>0){let h=Array.from(c).map(y=>`temporary-tool-call-id-${y}-`);for(let y=o.length-1;y>=0;y-=1){let g=o[y];h.some(b=>g.includes(b))&&o.splice(y,1)}}let d=[];l.forEach(h=>{c.has(h.name)||d.push(h.name)});let f=R2r(r);if(f){let h=r.lastIndexOf(f);r.length-h>omt&&(c.has(f)||d.push(f))}Array.from(new Set(d)).forEach((h,y)=>{let g=a.getTemporaryToolCallId(h,y);if(o.findIndex(w=>w.includes(g))!==-1)return;let _=DTe(g,h,QH(h),E7(h),"",!0,"","");o.push(_)}),o.length>0&&u.push(o.join(`
|
||
`));let m=u.join(`
|
||
|
||
`);this.lastDisplayedContent=m,i(m)}isAbortRequested(r){return r.signal.aborted}async finalizeAgentRun(r){let{conversationMessages:n,iterationHistory:o,collectedSources:i,userMessage:a,abortController:s,addMessage:u,updateCurrentAiMessage:l,modelNameForLog:c,responseMetadata:d,fullAIResponse:f}=r,p=f,m=Jq(i);!p&&o.length>0&&(Be("fullAIResponse was empty, using iteration history"),p=o.join(`
|
||
|
||
`)),n.length>0&&Sk({messages:[...n],modelName:c,contextEnvelope:a.contextEnvelope}),await Promise.resolve().then(()=>(Tie(),Wot));let h=this.llmFormattedMessages.join(`
|
||
|
||
`);return await this.handleResponse(p,a,s,u,l,m.length>0?m:void 0,h,d),this.lastDisplayedContent="",p}async streamResponse(r,n,o,i){let a=this.chainManager.chatModelManager.getChatModel(),u=!this.hasCapability(a,"reasoning"),l=new T_(o,i,u),c=2,d=0;for(;d<=c;)try{let p=r.map(y=>y.role==="user"?new Hs(y.content):new eo(y.content)),m=await rh(()=>this.chainManager.chatModelManager.getChatModel().stream(p,{signal:n.signal}));for await(let y of m){if(n.signal.aborted)break;l.processChunk(y)}let h=l.close();return{content:h.content,wasTruncated:h.wasTruncated,tokenUsage:h.tokenUsage}}catch(p){if(p.name==="AbortError"||n.signal.aborted){let h=l.close();return{content:h.content,wasTruncated:h.wasTruncated,tokenUsage:h.tokenUsage}}if((p?.message?.includes("overloaded")||p?.message?.includes("Overloaded")||p?.error?.type==="overloaded_error")&&d<c){d++,B(`Retrying autonomous agent request (attempt ${d}/${c+1}) due to overloaded error`),await new Promise(h=>setTimeout(h,1e3*d));continue}throw p}let f=l.close();return{content:f.content,wasTruncated:f.wasTruncated,tokenUsage:f.tokenUsage}}}});var F2r=v(()=>{Pie();Ygr();UUr();kje();A2r();L2r();bV();Yle();Lue()});var Rti,k2r,Ati,q2r,Nti,U2r,jti,B2r,qje=v(()=>{wv();Rti=`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:`,k2r=new lu({inputVariables:["summary","new_lines"],template:Rti}),Ati=`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:`,q2r=new lu({inputVariables:["entities","history","input"],template:Ati}),Nti=`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:`,U2r=new lu({inputVariables:["history","input"],template:Nti}),jti=`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):`,B2r=new lu({inputVariables:["entity","summary","history","input"],template:jti})});var Dti,$ti,z2r,tce,amt=v(()=>{Bo();L$();U$();Rw();Qa();Dti={};Rt(Dti,{BaseChatMessageHistory:()=>$ti,BaseListChatMessageHistory:()=>z2r,InMemoryChatMessageHistory:()=>tce});$ti=class extends Kh{async addMessages(t){for(let e of t)await this.addMessage(e)}},z2r=class extends Kh{addUserMessage(t){return this.addMessage(new Hs(t))}addAIMessage(t){return this.addMessage(new eo(t))}async addMessages(t){for(let e of t)await this.addMessage(e)}clear(){throw new Error("Not implemented.")}},tce=class extends z2r{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=[]}}});function Uje(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 Lti,dJ,V2r,fJ,rce,nce=v(()=>{Bo();Lti={};Rt(Lti,{BaseMemory:()=>dJ,getInputValue:()=>fJ,getOutputValue:()=>rce,getPromptInputKey:()=>Uje});dJ=class{},V2r=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},fJ=(t,e)=>{let r=V2r(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},rce=(t,e)=>{let r=V2r(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}});var Fti,Rb,gU=v(()=>{Zhe();amt();nce();Fti={};NW(Fti,{BaseChatMemory:()=>Rb});Rb=class extends dJ{constructor(e){super();x(this,"chatHistory");x(this,"returnMessages",!1);x(this,"inputKey");x(this,"outputKey");this.chatHistory=e?.chatHistory??new tce,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(fJ(e,this.inputKey)),await this.chatHistory.addAIMessage(rce(r,this.outputKey))}async clear(){await this.chatHistory.clear()}}});function smt(t,e){let r=new Set;for(let n of e)t.has(n)&&r.add(n);return r}function H2r(t,e){let r=new Set(t);for(let n of e)r.add(n);return r}function oce(t,e){let r=new Set(t);for(let n of e)r.delete(n);return r}var J2r=v(()=>{});var umt={};Rn(umt,{SequentialChain:()=>kti,SimpleSequentialChain:()=>qti});function ice(t){return Array.from(t).map(e=>`"${e}"`).join(", ")}var kti,qti,lmt=v(()=>{nX();J2r();kti=class W2r extends Ny{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=smt(n,o);if(i.size>0)throw new Error(`The following keys: ${ice(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=H2r(n,o);for(let s of this.chains){let u=oce(new Set(s.inputKeys),a);if(s.memory&&(u=oce(u,new Set(s.memory.memoryKeys))),u.size>0)throw new Error(`Missing variables for chain "${s._chainType()}": ${ice(u)}. Only got the following variables: ${ice(a)}.`);let l=new Set(s.outputKeys),c=smt(a,l);if(c.size>0)throw new Error(`The following output variables for chain "${s._chainType()}" are overlapping: ${ice(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=oce(a,n);this.outputVariables=Array.from(s)}else this.outputVariables=this.chains[this.chains.length-1].outputKeys;else{let s=oce(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: ${ice(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 Ny.deserialize(s);n.push(u)}return new W2r({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}}},qti=class K2r extends Ny{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 Ny.deserialize(i);n.push(a)}return new K2r({chains:n})}serialize(){let r=[];for(let n of this.chains)r.push(n.serialize());return{_type:this._chainType(),chains:r}}}});var zje={};Rn(zje,{MapReduceDocumentsChain:()=>X2r,RefineDocumentsChain:()=>Y2r,StuffDocumentsChain:()=>Bje});var Bje,X2r,Y2r,ace=v(()=>{nX();pJ();wv();Bje=class G2r extends Ny{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 G2r({llmChain:await Rh.deserialize(r.llm_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize()}}},X2r=class Z2r extends Ny{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 Z2r({llmChain:await Rh.deserialize(r.llm_chain),combineDocumentChain:await Bje.deserialize(r.combine_document_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),combine_document_chain:this.combineDocumentChain.serialize()}}},Y2r=class Q2r extends Ny{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 lu({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 Q2r({llmChain:await Rh.deserialize(n),refineLLMChain:await Rh.deserialize(o)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),refine_llm_chain:this.refineLLMChain.serialize()}}}});var oX,Vje=v(()=>{L$();oX=class extends Kh{constructor(){super(...arguments);x(this,"lc_namespace",["langchain_core","example_selectors","base"])}}});function eVr(t){return t._modelType()==="base_llm"}function aX(t){return t._modelType()==="base_chat_model"}var cmt,iX,tVr=v(()=>{cmt=class{async getPromptAsync(t,e){return this.getPrompt(t).partial(e?.partialVariables??{})}},iX=class extends cmt{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}}});function rVr(t){return t.split(/\n| /).length}var nVr,iVr=v(()=>{Vje();nVr=class oVr extends oX{constructor(r){super(r);x(this,"examples",[]);x(this,"examplePrompt");x(this,"getTextLength",rVr);x(this,"maxLength",2048);x(this,"exampleTextLengths",[]);this.examplePrompt=r.examplePrompt,this.maxLength=r.maxLength??2048,this.getTextLength=r.getTextLength??rVr}async addExample(r){this.examples.push(r);let n=await this.examplePrompt.format(r);this.exampleTextLengths.push(this.getTextLength(n))}async calculateExampleTextLengths(r,n){if(r.length>0)return r;let{examples:o,examplePrompt:i}=n;return(await Promise.all(o.map(s=>i.format(s)))).map(s=>this.getTextLength(s))}async selectExamples(r){let n=Object.values(r).join(" "),o=this.maxLength-this.getTextLength(n),i=0,a=[];for(;o>0&&i<this.examples.length;){let s=o-this.exampleTextLengths[i];if(s<0)break;a.push(this.examples[i]),o=s,i+=1}return a}static async fromExamples(r,n){let o=new oVr(n);return await Promise.all(r.map(i=>o.addExample(i))),o}}});function dmt(t){return Object.keys(t).sort().map(e=>t[e])}var aVr,uVr=v(()=>{Eot();Vje();aVr=class sVr extends oX{constructor(r){super(r);x(this,"vectorStoreRetriever");x(this,"exampleKeys");x(this,"inputKeys");if(this.exampleKeys=r.exampleKeys,this.inputKeys=r.inputKeys,r.vectorStore!==void 0)this.vectorStoreRetriever=r.vectorStore.asRetriever({k:r.k??4,filter:r.filter});else if(r.vectorStoreRetriever)this.vectorStoreRetriever=r.vectorStoreRetriever;else throw new Error('You must specify one of "vectorStore" and "vectorStoreRetriever".')}async addExample(r){let n=this.inputKeys??Object.keys(r),o=dmt(n.reduce((i,a)=>({...i,[a]:r[a]}),{})).join(" ");await this.vectorStoreRetriever.addDocuments([new Rm({pageContent:o,metadata:r})])}async selectExamples(r){let n=this.inputKeys??Object.keys(r),o=dmt(n.reduce((s,u)=>({...s,[u]:r[u]}),{})).join(" "),a=(await this.vectorStoreRetriever.invoke(o)).map(s=>s.metadata);return this.exampleKeys?a.map(s=>this.exampleKeys.reduce((u,l)=>({...u,[l]:s[l]}),{})):a}static async fromExamples(r,n,o,i={}){let a=i.inputKeys??null,s=r.map(l=>dmt(a?a.reduce((c,d)=>({...c,[d]:l[d]}),{}):l).join(" ")),u=await o.fromTexts(s,r,n,i);return new sVr({vectorStore:u,k:i.k??4,exampleKeys:i.exampleKeys,inputKeys:i.inputKeys})}}});var Uti,Hje=v(()=>{Bo();Vje();tVr();iVr();uVr();Uti={};Rt(Uti,{BaseExampleSelector:()=>oX,BasePromptSelector:()=>cmt,ConditionalPromptSelector:()=>iX,LengthBasedExampleSelector:()=>nVr,SemanticSimilarityExampleSelector:()=>aVr,isChatModel:()=>aX,isLLM:()=>eVr})});var Bti,zti,Vti,Hti,lVr,cVr=v(()=>{wv();Hje();Bti=new lu({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"]}),zti=`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}`,Vti=[Gw.fromTemplate(zti),Qb.fromTemplate("{question}")],Hti=ld.fromMessages(Vti),lVr=new iX(Bti,[[aX,Hti]])});var dVr=v(()=>{wv();Hje()});var fVr=v(()=>{wv();Hje()});function pVr(t,e={}){let{prompt:r=lVr.getPrompt(t),verbose:n}=e,o=new Rh({prompt:r,llm:t,verbose:n});return new Bje({llmChain:o,verbose:n})}var mVr=v(()=>{pJ();ace();cVr();dVr();fVr()});var gVr={};Rn(gVr,{VectorDBQAChain:()=>Jti});var Jti,yVr=v(()=>{nX();mVr();Jti=class hVr extends Ny{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 hVr({combineDocumentsChain:await Ny.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=pVr(r);return new this({vectorstore:n,combineDocumentsChain:i,...o})}}});var bVr,_Vr,Wti,vVr,wVr=v(()=>{wv();bVr=`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:`,_Vr=new lu({inputVariables:["api_docs","question"],template:bVr}),Wti=`${bVr} {api_url}
|
||
|
||
Here is the response from the API:
|
||
|
||
{api_response}
|
||
|
||
Summarize this response to answer the original question.
|
||
|
||
Summary:`,vVr=new lu({inputVariables:["api_docs","question","api_url","api_response"],template:Wti})});var CVr={};Rn(CVr,{APIChain:()=>Kti});var Kti,xVr=v(()=>{nX();pJ();wVr();Kti=class SVr extends Ny{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 SVr({apiAnswerChain:await Rh.deserialize(o),apiRequestChain:await Rh.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=_Vr,apiResponsePrompt:a=vVr}=o,s=new Rh({prompt:i,llm:r}),u=new Rh({prompt:a,llm:r});return new this({apiAnswerChain:u,apiRequestChain:s,apiDocs:n,...o})}}});var Ny,nX=v(()=>{_v();Jv();id();z$();Ny=class extends jK{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=Qo(e),n=await this._formatValues(t),i=await(await rc.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,KA,{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,...JA(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(()=>(pJ(),OVr));return r.deserialize(t)}case"sequential_chain":{let{SequentialChain:r}=await Promise.resolve().then(()=>(lmt(),umt));return r.deserialize(t)}case"simple_sequential_chain":{let{SimpleSequentialChain:r}=await Promise.resolve().then(()=>(lmt(),umt));return r.deserialize(t)}case"stuff_documents_chain":{let{StuffDocumentsChain:r}=await Promise.resolve().then(()=>(ace(),zje));return r.deserialize(t)}case"map_reduce_documents_chain":{let{MapReduceDocumentsChain:r}=await Promise.resolve().then(()=>(ace(),zje));return r.deserialize(t)}case"refine_documents_chain":{let{RefineDocumentsChain:r}=await Promise.resolve().then(()=>(ace(),zje));return r.deserialize(t)}case"vector_db_qa":{let{VectorDBQAChain:r}=await Promise.resolve().then(()=>(yVr(),gVr));return r.deserialize(t,e)}case"api_chain":{let{APIChain:r}=await Promise.resolve().then(()=>(xVr(),CVr));return r.deserialize(t)}default:throw new Error(`Invalid prompt type in config: ${t._type}`)}}}});var TVr,EVr=v(()=>{fO();TVr=class extends iN{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 OVr={};Rn(OVr,{LLMChain:()=>Rh});function Gti(t){return typeof t._llmType=="function"}function Jje(t){if(Gti(t))return t;if("bound"in t&&Vo.isRunnable(t.bound))return Jje(t.bound);if("runnable"in t&&"fallbacks"in t&&Vo.isRunnable(t.runnable))return Jje(t.runnable);if("default"in t&&Vo.isRunnable(t.default))return Jje(t.default);throw new Error("Unable to extract BaseLanguageModel from llmLike object.")}var Rh,pJ=v(()=>{nX();EVr();wv();_v();Jv();Rh=class PVr extends Ny{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 TVr,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 PVr({llm:await v2.deserialize(n),prompt:await Ww.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 Jje(this.llm).getNumTokens(r)}}});var sce,MVr,fmt=v(()=>{pJ();qje();gU();Qa();sce=class extends Rb{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",k2r);x(this,"summaryChatMessageClass",Qm);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=ol(e,this.humanPrefix,this.aiPrefix);return await new Rh({llm:this.llm,prompt:this.prompt}).predict({summary:r,new_lines:n})}},MVr=class extends sce{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=""}}});var IVr,RVr=v(()=>{fmt();Qa();IVr=class extends sce{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=ol(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(ol(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(ol(e,this.humanPrefix,this.aiPrefix)))}this.movingSummaryBuffer=await this.predictNewSummary(n,this.movingSummaryBuffer)}}async clear(){await super.clear(),this.movingSummaryBuffer=""}}});var Wje,AVr=v(()=>{gU();Qa();Wje=class extends Rb{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]:ol(r,this.humanPrefix,this.aiPrefix)}}}});var Kje,NVr=v(()=>{gU();Qa();Kje=class extends Rb{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]:ol(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}}});var jVr,DVr=v(()=>{FVe();tG();nce();jVr=class extends dJ{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=fJ(e,this.inputKey),n=await this.vectorStoreRetriever.invoke(r);return{[this.memoryKey]:this.returnDocs?n:_ee(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 Rm({pageContent:o,metadata:n})])}}});var $Vr,LVr=v(()=>{L$();$Vr=class extends Kh{}});var FVr,kVr=v(()=>{LVr();FVr=class extends $Vr{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)}}});var qVr,UVr=v(()=>{pJ();qje();gU();kVr();Qa();nce();qVr=class extends Rb{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 Rh({llm:this.llm,prompt:e.entityExtractionPrompt??U2r}),this.entitySummarizationChain=new Rh({llm:this.llm,prompt:e.entitySummarizationPrompt??B2r}),this.entityStore=e.entityStore??new FVr,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??Uje(e,this.memoryVariables),n=await this.chatHistory.getMessages(),o=ol(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??Uje(e,this.memoryVariables),o=await this.chatHistory.getMessages(),i=ol(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 BVr,zVr=v(()=>{gU();BVr=class extends Rb{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}}});var VVr,HVr=v(()=>{gU();Qa();VVr=class extends Rb{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]:ol(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(ol(n,this.humanPrefix,this.aiPrefix));if(o>this.maxTokenLimit){let i=[];for(;o>this.maxTokenLimit;)i.push(n.shift()),o=await this.llm.getNumTokens(ol(n,this.humanPrefix,this.aiPrefix))}}}});var Xti,pmt=v(()=>{Zhe();qje();gU();fmt();RVr();AVr();NVr();DVr();UVr();zVr();HVr();Qa();amt();nce();Xti={};NW(Xti,{BaseChatMemory:()=>Rb,BaseConversationSummaryMemory:()=>sce,BaseMemory:()=>dJ,BufferMemory:()=>Wje,BufferWindowMemory:()=>Kje,ChatMessageHistory:()=>tce,CombinedMemory:()=>BVr,ConversationSummaryBufferMemory:()=>IVr,ConversationSummaryMemory:()=>MVr,ConversationTokenBufferMemory:()=>VVr,ENTITY_MEMORY_CONVERSATION_TEMPLATE:()=>q2r,EntityMemory:()=>qVr,VectorStoreRetrieverMemory:()=>jVr,getBufferString:()=>ol,getInputValue:()=>fJ,getOutputValue:()=>rce})});var uce,JVr=v(()=>{ot();pmt();uce=class t{constructor(){this.initMemory(),al(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=ae().contextTurns;this.memory=new Kje({k:r*2,memoryKey:"history",inputKey:"input",returnMessages:!0,chatHistory:e}),this.debug&&console.log("Memory initialized with context turns:",r)}getMemory(){return this.memory}async clearChatMemory(){this.debug&&console.log("Clearing chat memory"),await this.memory.clear()}async loadMemoryVariables(){let e=await this.memory.loadMemoryVariables({});return this.debug&&console.log("Loaded memory variables:",e),e}async saveContext(e,r){this.debug&&console.log("Saving to memory - Input:",e,"Output:",r),await this.memory.saveContext(e,r)}}});var lce,WVr=v(()=>{ot();Vq();wv();qs();lce=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),al(()=>{this.initChatPrompt(),this.initQAPrompt()}),e6(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=PD(),r=Uu();r&&t6()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=ld.fromMessages([Gw.fromTemplate(n),new pO("history"),Qb.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=ld.fromMessages([Gw.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 KVr,cce,GVr=v(()=>{qs();Bc();Or();F2r();_t();ot();Vq();Zt();Xw();wv();KVr=require("obsidian");v7();JVr();WVr();eje();cce=class{constructor(e){this.retrievedDocuments=[];this.pendingModelError=null;this.app=e,this.memoryManager=uce.getInstance(),this.chatModelManager=l0.getInstance(),this.promptManager=lce.getInstance(),this.userMemoryManager=new Hq(e),this.initialize(),al(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 kW(e)}}validateChainInitialization(){(!this.chain||!TRt(this.chain))&&(B("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=gN(),i=Uu();if(!(o==="project"&&!i))try{if(n=o==="project"?i?.projectModelKey:i_(),!n)throw new kW("No model key found. Please select a model in settings.");if(r){let a=_O(n,ae().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",n),a=hO[0],n=a.name+"|"+a.provider),o==="project"&&!a.projectEnabled){let u=ae().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,n=u.name+"|"+u.provider,new KVr.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),B(`Setting model to ${n}`)}catch(a){this.pendingModelError=a instanceof Error?a:new Error(String(a)),ne(`createChainWithNewModel failed: ${a}`),B(`modelKey: ${n||i_()}`)}}async setChain(e,r={}){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){console.error("setChain failed: No chat model set.");return}this.validateChainType(e);let n=this.chatModelManager.getChatModel(),o=this.memoryManager.getMemory(),i=this.promptManager.getChatPrompt();switch(e){case"llm_chain":{this.chain=Ree.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Lz("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=ae(),s=a.enableSemanticSearchV3?new(await Promise.resolve().then(()=>(j1e(),hft))).HybridRetriever({minSimilarityScore:.01,maxK:a.maxSourceChunks,salientTerms:[]}):new(await Promise.resolve().then(()=>(w7(),N1e))).TieredLexicalRetriever(app,{minSimilarityScore:.01,maxK:a.maxSourceChunks,salientTerms:[],timeRange:void 0,textWeight:void 0,returnAll:!1,useRerankerThreshold:void 0});this.retrievalChain=Ree.createConversationalRetrievalChain({llm:n,retriever:s,systemMessage:PD()},this.storeRetrieverDocuments.bind(this),ae().debug),Lz("vault_qa"),ae().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=Ree.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Lz("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=Ree.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Lz("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=gN(),r=ae();switch(e){case"llm_chain":return new Iie(this);case"vault_qa":return new xue(this);case"copilot_plus":return r.enableAutonomousAgent?new ece(this):new uA(this);case"project":return new Qle(this);default:throw new Error(`Unsupported chain type: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&ae().enableSemanticSearchV3&&await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().indexVaultToVectorStore(!1)}async runChain(e,r,n,o,i={}){let{ignoreSystemMessage:a=!1}=i;B(`Step 0: Initial user message:
|
||
`,e.message),this.validateChatModel(),this.validateChainInitialization();let s=this.chatModelManager.getChatModel();if(a||Mee(s)){let l=ld.fromMessages([new pO("history"),Qb.fromTemplate("{input}")]);Mee(s)&&(l=ld.fromMessages([[Ws,PD()||""],l])),this.createChainWithNewModel({prompt:l},!1)}return await this.getChainRunner().run(e,r,n,o,i)}async updateMemoryWithLoadedMessages(e){await this.memoryManager.clearChatMemory();for(let r=0;r<e.length;r+=2){let n=e[r],o=e[r+1];n&&o&&n.sender===Ws&&await this.memoryManager.getMemory().saveContext({input:n.message},{output:o.message})}}}});var Gje,XVr=v(()=>{qs();_t();ot();Zt();xie();Gje=class t{constructor(e){this.app=e}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}clearAllLoadStates(){vAt({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=$1(o)?"Rate limit exceeded. (Rate limit: 50 files or 100MB per 3 hours, whichever is reached first)":Sn(o);throw this.setFileOrUrlProcessFailed(e,r,i),o}}setFileOrUrlStartProcess(e){ui.set(qee,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){CO("processingFiles",r=>r.filter(n=>n!==e)),CO("success",r=>r.includes(e)?r:[...r,e])}setFileOrUrlProcessFailed(e,r,n){CO("processingFiles",o=>o.filter(i=>i!==e)),CO("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){B(`[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])];CO("total",s=>a),B(`[preComputeAllItems] Project ${e.name}: Added ${n.length} items to tracking (${a.length} total unique items)`)}}markAllCachedItemsAsSuccess(e,r,n){B(`[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&&B(`[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&&B(`[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&&B(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached files that match current project patterns as successful.`)}}markCachedItemAsSuccess(e){CO("total",r=>r.includes(e)?r:[...r,e]),CO("success",r=>r.includes(e)?r:[...r,e])}makeItemFailed(e,r,n){CO("total",o=>o.includes(e)?o:[...o,e]),CO("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 mJ,Nm,k1=v(()=>{qs();iG();Bc();Or();_t();kot();vb();ot();NTe();Zt();xie();lN();mJ=require("obsidian");mR();GVr();XVr();Nm=class t{constructor(e,r){this.projectUsageTimestampsManager=new $W;this.app=e,this.plugin=r,this.currentProjectId=null,this.chainMangerInstance=new cce(e),this.projectContextCache=Yv.getInstance(),this.fileParserManager=new vk(pc.getInstance(),this.app.vault,!0,null),this.loadTracker=Gje.getInstance(this.app),hAt(async()=>{await this.getCurrentChainManager().createChainWithNewModel()}),gAt(async()=>{if(t6())return;let n=ae(),o=n.enableSemanticSearchV3&&n.indexVaultToVectorStore==="ON MODE SWITCH"&&(gN()==="vault_qa"||gN()==="copilot_plus");await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:o})}),e6(async n=>{await this.switchProject(n)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){al(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=ae().projectList||[],n=r.find(i=>i.id===e.id);if(!n)return;let o=this.projectUsageTimestampsManager.shouldPersist(e.id,n.UsageTimestamps);o!==null&&(Ue("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(),SO(!0),B("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 vk(pc.getInstance(),this.app.vault,!0,e),await this.loadProjectContext(e),this.refreshChatView(),this.touchProjectUsageTimestamps(e),B(`Switched to project: ${e.name}`)}catch(r){throw ne(`Failed to switch project: ${r}`),r}finally{SO(!1)}}async saveCurrentProjectMessage(){await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){await this.plugin.chatUIState.handleProjectSwitch()}async loadProjectContext(e,r=!1){r&&(this.loadTracker.clearAllLoadStates(),SO(!0));try{if(!e.contextSource)return Be(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;B(`[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),B(`[loadProjectContext] Completed for project: ${e.name}.`),i}catch(n){throw ne(`[loadProjectContext] Failed for project ${e.name}:`,n),n}finally{r&&SO(!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),B(`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){ne(`Error comparing project configurations: ${n}`)}}refreshChatView(){let e=this.app.workspace.getLeavesOfType(ac)[0]?.view;e&&e.updateView()}async getProjectContext(e){let r=ae().projectList.find(o=>o.id===e);if(!r)return Be(`[getProjectContext] Project not found for ID: ${e}`),null;B(`[getProjectContext] Getting context for project: ${r.name} (ID: ${e})`);let n=this.projectContextCache.getSync(r);if(!n||n.markdownNeedsReload){n?B(`[getProjectContext] Project ${r.name}: Markdown needs reload. Triggering full load.`):B(`[getProjectContext] Project ${r.name}: Memory cache miss. Triggering full load.`);let o=await this.loadProjectContext(r,!0);if(!o)return ne(`[getProjectContext] Project ${r.name}: loadProjectContext returned null.`),null;n=o}else B(`[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(B(`[processMarkdownFiles] Starting for project: ${e.name}`),r.markdownNeedsReload||!r.markdownContext||!r.markdownContext.trim()){B(`[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,B(`[processMarkdownFiles] Project ${e.name}: Markdown content updated.`)}else B(`[processMarkdownFiles] Project ${e.name}: Markdown content already up-to-date.`);return B(`[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");B(`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,B(`Completed processing markdown file: ${o.path}`)}catch(s){ne(`Error processing file ${o.path}: ${s}`),i=`[Error: ${Sn(s)}]`}return`${a}
|
||
|
||
${i}`}));return B("All markdown files processed for project context"),n.join(`
|
||
|
||
`)}async processWebUrls(e,r){B(`[processWebUrls] Starting for project: ${e.name}`);let n=e.contextSource?.webUrls?.trim()||"";if(!n)return Object.keys(r.webContexts).length>0&&(B(`[processWebUrls] Project ${e.name}: Clearing all Web contexts as none are configured.`),r.webContexts={}),r;let o=n.split(`
|
||
`).filter(c=>c.trim());B(`[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&&B(`[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){B(`[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&&B(`[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&&Be(`[processWebUrls] Project ${e.name}: Fetched empty content for Web URL: ${c.url}`)}),B(`[processWebUrls] Completed for project: ${e.name}. Total Web contexts: ${Object.keys(r.webContexts).length}`),r}async processYoutubeUrls(e,r){B(`[processYoutubeUrls] Starting for project: ${e.name}`);let n=e.contextSource?.youtubeUrls?.trim()||"";if(!n)return Object.keys(r.youtubeContexts).length>0&&(B(`[processYoutubeUrls] Project ${e.name}: Clearing all YouTube contexts as none are configured.`),r.youtubeContexts={}),r;let o=n.split(`
|
||
`).filter(c=>c.trim());B(`[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&&B(`[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){B(`[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&&B(`[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&&Be(`[processYoutubeUrls] Project ${e.name}: Fetched empty transcript for YouTube URL: ${c.url}`)}),B(`[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=aG.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 ne(`Failed to process web URL: ${r}`),""}}async processYoutubeUrlContext(e){if(!e?.trim())return"";try{let r=await this.loadTracker.executeWithProcessTracking(e,"youtube",async()=>pc.getInstance().youtube4llm(e));return r.response.transcript?`
|
||
|
||
YouTube transcript from ${e}:
|
||
${r.response.transcript}`:""}catch(r){return ne(`Failed to process YouTube URL ${e}: ${r}`),new mJ.Notice(`Failed to process YouTube URL ${e}: ${Sn(r)}`),""}}async processNonMarkdownFiles(e,r){let n=r.filter(i=>i.extension!=="md");if(B(`[loadProjectContext] Project ${e.name}: Checking for non-markdown processing: ${n.length} files .`),n.length<=0)return;this.fileParserManager=new vk(pc.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()=>{await this.projectContextCache.getOrReuseFileContext(e,a)||(B(`[loadProjectContext] Project ${e.name}: Parsing/caching new/updated file: ${a}`),await this.fileParserManager.parseFile(i,this.app.vault)),o++})}catch(s){if(ne(`[loadProjectContext] Project ${e.name}: Error parsing file ${a}:`,s),$1(s))throw s}}o>0&&B(`[loadProjectContext] Project ${e.name}: Processed and cached ${o} non-markdown files.`)}async retryFailedItem(e){try{if(!this.currentProjectId){Be("[retryFailedItem] No current project, aborting retry");return}let r=ae().projectList.find(n=>n.id===this.currentProjectId);if(!r){ne(`[retryFailedItem] Current project not found: ${this.currentProjectId}`);return}switch(B(`[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:Be(`[retryFailedItem] Unknown item type: ${e.type}`);return}B(`[retryFailedItem] Successfully retried ${e.type} item: ${e.path}`),new mJ.Notice(`Retry successful: ${e.path}`)}catch(r){ne(`[retryFailedItem] Failed to retry ${e.type} item ${e.path}:`,r),new mJ.Notice(`Retry failed: ${Sn(r)}`)}}async retryWebUrl(e,r){let n=await this.processWebUrlContext(r);if(!n){Be(`[retryWebUrl] Project ${e.name}: Fetched empty content for Web URL: ${r}`);return}B(`[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){Be(`[retryYoutubeUrl] Project ${e.name}: Fetched empty transcript for YouTube URL: ${r}`);return}B(`[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 mJ.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()=>{}),B(`[retryMarkdownFile] Successfully reprocessed markdown file: ${r}`),await this.projectContextCache.invalidateMarkdownContext(e)}catch(o){throw ne(`[retryMarkdownFile] Error processing file ${r}: ${o}`),o}}async retryNonMarkdownFile(e,r){let n=this.app.vault.getAbstractFileByPath(r);if(!(n instanceof mJ.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)),B(`[retryNonMarkdownFile] Successfully reprocessed non-markdown file: ${r}`)}catch(o){throw ne(`[retryNonMarkdownFile] Error processing file ${r}: ${o}`),o}}getProjectAllFiles(e){let{inclusions:r,exclusions:n}=Xc({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0});return this.app.vault.getFiles().filter(o=>bl(o,r,n,!0))}onunload(){this.projectContextCache.cleanup()}}});function bce(t){if(!t)return!1;let e=t.view;return!e||typeof e!="object"?!1:typeof e.getViewType=="function"&&t.view.getViewType()===vJ}function yX(t){let e=t.view?.webview;if(!e||typeof e!="object"||typeof e.executeJavaScript!="function")throw new Mmt("Web Viewer webview is unavailable. The view may not be fully initialized.");return e}var vJ,hDe,_w,pDe,mDe,Mmt,CU,bX=v(()=>{vJ="webviewer",hDe={OPEN:"webviewer:open",SAVE_TO_VAULT:"webviewer:save-to-vault"},_w=class t extends Error{constructor(e){super(e),this.name="WebViewerError",Object.setPrototypeOf(this,t.prototype)}},pDe=class t extends _w{constructor(e){super(e),this.name="WebViewerUnsupportedError",Object.setPrototypeOf(this,t.prototype)}},mDe=class t extends _w{constructor(e){super(e),this.name="WebViewerLeafNotFoundError",Object.setPrototypeOf(this,t.prototype)}},Mmt=class t extends _w{constructor(e){super(e),this.name="WebviewUnavailableError",Object.setPrototypeOf(this,t.prototype)}},CU=class t extends _w{constructor(e){super(e),this.name="WebViewerTimeoutError",Object.setPrototypeOf(this,t.prototype)}}});function Pri(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 Nmt(t,e){return Array(e+1).join(t)}function AHr(t){return t.replace(/^\n*/,"")}function NHr(t){for(var e=t.length;e>0&&t[e-1]===`
|
||
`;)e--;return t.substring(0,e)}function jHr(t){return NHr(AHr(t))}function jmt(t){return Dmt(t,Mri)}function $Hr(t){return Dmt(t,DHr)}function Iri(t){return FHr(t,DHr)}function Rri(t){return Dmt(t,LHr)}function Ari(t){return FHr(t,LHr)}function Dmt(t,e){return e.indexOf(t.nodeName)>=0}function FHr(t,e){return t.getElementsByTagName&&e.some(function(r){return t.getElementsByTagName(r).length})}function gDe(t){return t?t.replace(/(\n+\s*)+/g,`
|
||
`):""}function kHr(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 Imt(t,e,r){for(var n=0;n<t.length;n++){var o=t[n];if(Nri(o,e,r))return o}}function Nri(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 jri(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=IHr(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=Rmt(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=Rmt(u);continue}var c=IHr(s,u,o);s=u,u=c}i&&(i.data=i.data.replace(/ $/,""),i.data||Rmt(i))}}function Rmt(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function IHr(t,e,r){return t&&t.parentNode===e||r(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}function Dri(){var t=$mt.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function $ri(){var t=function(){};return Lri()?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 Lri(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{$mt.ActiveXObject&&(t=!0)}return t}function kri(t,e){var r;if(typeof t=="string"){var n=qri().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");r=n.getElementById("turndown-root")}else r=t.cloneNode(!0);return jri({element:r,isBlock:jmt,isVoid:$Hr,isPre:e.preformattedCode?Uri:null}),r}function qri(){return Amt=Amt||new Fri,Amt}function Uri(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function Bri(t,e){return t.isBlock=jmt(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=zri(t),t.flankingWhitespace=Vri(t,e),t}function zri(t){return!$Hr(t)&&!Rri(t)&&/^\s*$/i.test(t.textContent)&&!Iri(t)&&!Ari(t)}function Vri(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var r=Hri(t.textContent);return r.leadingAscii&&RHr("left",t,e)&&(r.leading=r.leadingNonAscii),r.trailingAscii&&RHr("right",t,e)&&(r.trailing=r.trailingNonAscii),{leading:r.leading,trailing:r.trailing}}function Hri(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 RHr(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&&!jmt(n)&&(i=o.test(n.textContent))),i}function yDe(t){if(!(this instanceof yDe))return new yDe(t);var e={rules:jy,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=Pri({},e,t),this.rules=new kHr(this.options)}function qHr(t){var e=this;return Jri.call(t.childNodes,function(r,n){n=new Bri(n,e.options);var o="";return n.nodeType===3?o=n.isCode?n.nodeValue:e.escape(n.nodeValue):n.nodeType===1&&(o=Gri.call(e,n)),UHr(r,o)},"")}function Kri(t){var e=this;return this.rules.forEach(function(r){typeof r.append=="function"&&(t=UHr(t,r.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function Gri(t){var e=this.rules.forNode(t),r=qHr.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 UHr(t,e){var r=NHr(t),n=AHr(e),o=Math.max(t.length-r.length,e.length-n.length),i=`
|
||
|
||
`.substring(0,o);return r+i+n}function Xri(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}var Mri,DHr,LHr,jy,$mt,Fri,Amt,Jri,Wri,BHr,zHr=v(()=>{Mri=["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"];DHr=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];LHr=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];jy={};jy.paragraph={filter:"p",replacement:function(t){return`
|
||
|
||
`+t+`
|
||
|
||
`}};jy.lineBreak={filter:"br",replacement:function(t,e,r){return r.br+`
|
||
`}};jy.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=Nmt(n===1?"=":"-",t.length);return`
|
||
|
||
`+t+`
|
||
`+o+`
|
||
|
||
`}else return`
|
||
|
||
`+Nmt("#",n)+" "+t+`
|
||
|
||
`}};jy.blockquote={filter:"blockquote",replacement:function(t){return t=jHr(t).replace(/^/gm,"> "),`
|
||
|
||
`+t+`
|
||
|
||
`}};jy.list={filter:["ul","ol"],replacement:function(t,e){var r=e.parentNode;return r.nodeName==="LI"&&r.lastElementChild===e?`
|
||
`+t:`
|
||
|
||
`+t+`
|
||
|
||
`}};jy.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=jHr(t)+(s?`
|
||
`:""),t=t.replace(/\n/gm,`
|
||
`+" ".repeat(n.length)),n+t+(e.nextSibling?`
|
||
`:"")}};jy.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,`
|
||
`)+`
|
||
|
||
`}};jy.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=Nmt(a,s);return`
|
||
|
||
`+c+o+`
|
||
`+i.replace(/\n$/,"")+`
|
||
`+c+`
|
||
|
||
`}};jy.horizontalRule={filter:"hr",replacement:function(t,e,r){return`
|
||
|
||
`+r.hr+`
|
||
|
||
`}};jy.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=gDe(e.getAttribute("title"));return n&&(n=' "'+n.replace(/"/g,'\\"')+'"'),"["+t+"]("+r+n+")"}};jy.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=gDe(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}};jy.emphasis={filter:["em","i"],replacement:function(t,e,r){return t.trim()?r.emDelimiter+t+r.emDelimiter:""}};jy.strong={filter:["strong","b"],replacement:function(t,e,r){return t.trim()?r.strongDelimiter+t+r.strongDelimiter:""}};jy.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}};jy.image={filter:"img",replacement:function(t,e){var r=gDe(e.getAttribute("alt")),n=e.getAttribute("src")||"",o=gDe(e.getAttribute("title")),i=o?' "'+o+'"':"";return n?"":""}};kHr.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=Imt(this.array,t,this.options))||(e=Imt(this._keep,t,this.options))||(e=Imt(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)}};$mt=typeof window<"u"?window:{};Fri=Dri()?$mt.DOMParser:$ri();Jri=Array.prototype.reduce,Wri=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];yDe.prototype={turndown:function(t){if(!Xri(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=qHr.call(this,new kri(t,this.options));return Kri.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 Wri.reduce(function(e,r){return e.replace(r[0],r[1])},t)}};BHr=yDe});function _X(t){return typeof t=="object"&&t!==null}function vX(t){if(typeof t=="string")return t;if(t==null)return"";try{return String(t)}catch{return""}}function WHr(t){return t instanceof Error?t.message:vX(t)}async function Zri(t){await new Promise(e=>setTimeout(e,t))}async function KHr(t,e,r,n){let o=Date.now();for(;;){if(t())return;if(Date.now()-o>=e)throw new _w(`${n} timed out after ${e}ms`);await Zri(r)}}function VHr(t,e){let r=(t??"").trim();if(!r)return"";if(!e)return r;try{return new URL(r,e).href}catch{return r}}function HHr(t){let e=(t??"").trim();return e?/[\s)]/.test(e)?`<${e}>`:e:""}function Yri(t){let e=new BHr({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=HHr(VHr(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=HHr(VHr(a,t));return s?``:""}}),e}function Lmt(t,e){if(!t.trim())return"";let r=Yri(e),i=new DOMParser().parseFromString(`<div>${t}</div>`,"text/html").body.firstElementChild;return i?r.turndown(i).replace(/\n{3,}/g,`
|
||
|
||
`).trim():""}function Fmt(t){let e=t.commands;return!e||!_X(e)||typeof e.executeCommandById!="function"?null:e}function GHr(t,e){let r=Fmt(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 XHr(t,e){return t.workspace.getLeavesOfType(vJ).includes(e)}function JHr(t){if(!_X(t)||t.enabled!==!0)return null;let e=t.instance;if(!e||!_X(e))return null;let r=e;return typeof r.openUrl=="function"||typeof r.handleOpenUrl=="function"?r:null}function ZHr(t,e){let r=t.internalPlugins;if(!r||!_X(r))return null;let n=r.plugins;if(!n)return null;let o=n instanceof Map?n.get(vJ):_X(n)?n[vJ]:null;if(o){let a=JHr(o);if(a)return a}let i;if(n instanceof Map)i=Array.from(n.values());else if(_X(n))i=Object.values(n);else return e&&e(),null;for(let a of i){let s=JHr(a);if(s)return s}return null}var bDe=v(()=>{zHr();bX()});function wX(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 YHr(t,e={}){let{signal:r}=e;if(r?.aborted)throw new CU("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 CU("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 CU||ne("Failed to get reader mode content:",n),n}}async function _De(t,e=!0){let r=yX(t),n='(() => { try { return window.getSelection?.()?.toString?.() ?? ""; } catch { return ""; } })()';try{let o=await r.executeJavaScript(n),i=vX(o);return e?i.trim():i}catch(o){throw ne("Failed to get selected text:",o),o}}async function vDe(t){let e=yX(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=vX(i)}catch(i){throw ne("Failed to get selection HTML:",i),i}try{return Lmt(o,r)}catch(i){throw ne("Failed to convert HTML to Markdown:",i),i}}async function QHr(t){let e=yX(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=vX(i)}catch(i){throw ne("Failed to get page HTML:",i),i}try{return Lmt(o,r)}catch(i){throw ne("Failed to convert page HTML to Markdown:",i),i}}async function eJr(t,e=!0){let r=yX(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 vX(o)}catch(o){throw ne("Failed to get HTML:",o),o}}function wDe(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 tJr(t){return wDe(t)!==null}function Qri(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 rJr(t,e={}){let r=yX(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=wDe(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: Try to extract transcript
|
||
// Check if transcript panel is already open, otherwise click the button
|
||
// =========================================================================
|
||
let segments = document.querySelectorAll('ytd-transcript-segment-renderer');
|
||
let needClose = false;
|
||
|
||
if (segments.length === 0) {
|
||
const btn = document.querySelector('ytd-video-description-transcript-section-renderer button');
|
||
|
||
if (btn) {
|
||
btn.click();
|
||
needClose = true;
|
||
|
||
// Wait for transcript to load (poll every 500ms)
|
||
for (let i = 0; i < ${o}; i++) {
|
||
await new Promise(r => setTimeout(r, 500));
|
||
segments = document.querySelectorAll('ytd-transcript-segment-renderer');
|
||
if (segments.length > 0) break;
|
||
}
|
||
}
|
||
}
|
||
|
||
// Helper to close the transcript panel (called in finally block)
|
||
const closePanel = () => {
|
||
if (needClose) {
|
||
const closeBtn = document.querySelector(
|
||
'ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-searchable-transcript"] #visibility-button button'
|
||
);
|
||
if (closeBtn) closeBtn.click();
|
||
}
|
||
};
|
||
|
||
// =========================================================================
|
||
// Step 4: Extract transcript segments and return result
|
||
// =========================================================================
|
||
try {
|
||
const transcript = [...segments].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);
|
||
|
||
return { videoId, title, channel, description, uploadDate, duration, genre, transcript };
|
||
} finally {
|
||
// Step 5: Always close the transcript panel if we opened it
|
||
closePanel();
|
||
}
|
||
})()`,u=await r.executeJavaScript(s);if(!Qri(u))throw new Error("Invalid transcript data structure");return u}async function nJr(t,e,r={}){let{preferCommand:n=!0,focusLeafBeforeCommand:o=!0}=r;if(n)try{return await e(hDe.SAVE_TO_VAULT,{leaf:t,focusLeaf:o}),B("Saved via webviewer:save-to-vault command"),{method:"command"}}catch(i){Be("save-to-vault command failed, falling back:",i)}try{return await Promise.resolve(t.view.saveAsMarkdown()),B("Saved via view.saveAsMarkdown()"),{method:"view.saveAsMarkdown"}}catch(i){throw ne("Failed to save Web Viewer page:",i),i}}var kmt=v(()=>{_t();bX();bDe()});function Dy(t){if(typeof t!="string")return null;let e=t.trim();return e||null}function SX(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 iJr(t){return Dy(t)??void 0}function qmt(t){let e=Dy(t.url);if(!e)return null;let r=iJr(t.title),n=iJr(t.faviconUrl);return{url:e,title:r,faviconUrl:n,isLoaded:t.isLoaded,isActive:t.isActive?!0:void 0}}function wJ(t){let e=new Map;for(let r of t){let n=qmt(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 aJr(t){let e=wJ(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 CX=v(()=>{});var eni,SDe,sJr=v(()=>{_t();bDe();bX();CX();eni=["did-finish-load","page-favicon-updated","page-title-updated"],SDe=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||!bce(e)?(this.lastActiveLeaf=null,null):XHr(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=SX(n);if(!i)return null;let a=[];for(let c of o){let d=c?.view?.url;if(!d)continue;SX(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:(Be("[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:(Be("[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{bce(o)&&(this.lastActiveLeaf=o)}catch(i){Be("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:eni};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){Be("[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 uJr,CDe,lJr=v(()=>{uJr=require("obsidian");_t();kmt();bDe();sJr();bX();CDe=class{constructor(e){this.internalPluginApi=null;this.internalApiWarned=!1;this.app=e,this.stateManager=new SDe({app:e,isSupportedPlatform:()=>this.isSupportedPlatform(),getActiveLeaf:()=>this.getActiveLeaf(),getLeaves:()=>this.getLeaves(),getPageInfo:r=>wX(r)})}isSupportedPlatform(){return uJr.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}:GHr(this.app,hDe.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 pDe(e.reason??"Web Viewer unsupported.");if(!e.available)throw new _w(e.reason??"Web Viewer is not available.")}getLeaves(){return this.isSupportedPlatform()?this.app.workspace.getLeavesOfType(vJ):[]}getActiveLeaf(){let e=this.app.workspace.activeLeaf;return bce(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 mDe("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 KHr(()=>!!(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=Fmt(this.app);if(!n)throw new _w("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 _w(`Command returned false: ${e}`)}catch(a){throw ne(`Failed to execute command ${e}:`,a),new _w(`Failed to execute command ${e}: ${WHr(a)}`)}}getInternalPluginApi(){if(this.internalPluginApi)return this.internalPluginApi;let e=ZHr(this.app,()=>{this.internalApiWarned||(this.internalApiWarned=!0,Be("[WebViewerService] internalPlugins.plugins has unexpected structure. Web Viewer integration may not work correctly."))});return e&&(this.internalPluginApi=e),e}getPageInfo(e){return wX(e)}async getReaderModeMarkdown(e,r){return YHr(e,r)}async getSelectedText(e,r=!0){return _De(e,r)}async getSelectedMarkdown(e){return vDe(e)}async getPageMarkdown(e){return QHr(e)}async getHtml(e,r=!0){return eJr(e,r)}getYouTubeVideoId(e){return wDe(e)}isYouTubeVideoUrl(e){return tJr(e)}async getYouTubeTranscript(e,r){return rJr(e,r)}async saveToVault(e,r={}){return nJr(e,(n,o)=>this.executeCommand(n,o),r)}}});var dJr={};Rn(dJr,{getWebViewerMarkdown:()=>tni,getWebViewerPageInfo:()=>oni,getWebViewerSelectedMarkdown:()=>nni,getWebViewerSelectedText:()=>rni,getWebViewerService:()=>ed,resolveWebViewerLeaf:()=>xX,saveWebViewerToVault:()=>ini,startActiveWebTabTracking:()=>Umt});function ed(t){let e=cJr.get(t);if(e)return e;let r=new CDe(t);return cJr.set(t,r),r}function Umt(t,e){return ed(t).startActiveWebTabTracking(e)}async function xX(t,e){return ed(t).resolveLeaf(e)}async function tni(t,e){let r=await xX(t,e);return ed(t).getReaderModeMarkdown(r)}async function rni(t,e=!0,r){let n=await xX(t,r);return ed(t).getSelectedText(n,e)}async function nni(t,e){let r=await xX(t,e);return ed(t).getSelectedMarkdown(r)}async function oni(t,e){let r=await xX(t,e);return ed(t).getPageInfo(r)}async function ini(t,e,r){let n=await xX(t,{...r,focus:!0});return ed(t).saveToVault(n,e)}var cJr,SJ=v(()=>{lJr();cJr=new WeakMap});var Rde=S((wZr,KLe)=>{((t,e)=>{typeof define=="function"&&define.amd?define([],e):typeof KLe=="object"&&KLe.exports?KLe.exports=e():t.fuzzysort=e()})(wZr,t=>{"use strict";var e=($,H)=>{if(!$||!H)return G;var re=p($);J(H)||(H=f(H));var D=re.bitflags;return(D&H._bitflags)!==D?G:h(re,H)},r=($,H,re)=>{if(!$)return re?.all?m(H,re):oe;var D=p($),R=D.bitflags,z=D.containsSpace,U=c(re?.threshold||0),ee=re?.limit||K,ce=0,ve=0,Oe=H.length;function Je(Eo){ce<ee?(ie.add(Eo),++ce):(++ve,Eo._score>ie.peek()._score&&ie.replaceTop(Eo))}if(re?.key)for(var tt=re.key,Ke=0;Ke<Oe;++Ke){var dt=H[Ke],Pt=q(dt,tt);if(Pt&&(J(Pt)||(Pt=f(Pt)),(R&Pt._bitflags)===R)){var Nt=h(D,Pt);Nt!==G&&(Nt._score<U||(Nt.obj=dt,Je(Nt)))}}else if(re?.keys){var Ne=re.keys,Tr=Ne.length;e:for(var Ke=0;Ke<Oe;++Ke){var dt=H[Ke];{for(var st=0,Le=0;Le<Tr;++Le){var tt=Ne[Le],Pt=q(dt,tt);if(!Pt){k[Le]=Y;continue}J(Pt)||(Pt=f(Pt)),k[Le]=Pt,st|=Pt._bitflags}if((R&st)!==R)continue}if(z)for(let In=0;In<D.spaceSearches.length;In++)j[In]=ue;for(var Le=0;Le<Tr;++Le){if(Pt=k[Le],Pt===Y){V[Le]=Y;continue}if(V[Le]=h(D,Pt,!1,z),V[Le]===G){V[Le]=Y;continue}if(z)for(let hi=0;hi<D.spaceSearches.length;hi++){if(A[hi]>-1e3&&j[hi]>ue){var rt=(j[hi]+A[hi])/4;rt>j[hi]&&(j[hi]=rt)}A[hi]>j[hi]&&(j[hi]=A[hi])}}if(z){for(let In=0;In<D.spaceSearches.length;In++)if(j[In]===ue)continue e}else{var Fe=!1;for(let In=0;In<Tr;In++)if(V[In]._score!==ue){Fe=!0;break}if(!Fe)continue}var We=new s(Tr);for(let In=0;In<Tr;In++)We[In]=V[In];if(z){var ke=0;for(let In=0;In<D.spaceSearches.length;In++)ke+=j[In]}else{var ke=ue;for(let hi=0;hi<Tr;hi++){var Nt=We[hi];if(Nt._score>-1e3&&ke>ue){var rt=(ke+Nt._score)/4;rt>ke&&(ke=rt)}Nt._score>ke&&(ke=Nt._score)}}if(We.obj=dt,We._score=ke,re?.scoreFn){if(ke=re.scoreFn(We),!ke)continue;ke=c(ke),We._score=ke}ke<U||Je(We)}}else for(var Ke=0;Ke<Oe;++Ke){var Pt=H[Ke];if(Pt&&(J(Pt)||(Pt=f(Pt)),(R&Pt._bitflags)===R)){var Nt=h(D,Pt);Nt!==G&&(Nt._score<U||Je(Nt))}}if(ce===0)return oe;for(var Lt=new Array(ce),Ke=ce-1;Ke>=0;--Ke)Lt[Ke]=ie.poll();return Lt.total=ce+ve,Lt},n=($,H="<b>",re="</b>")=>{for(var D=typeof H=="function"?H:void 0,R=$.target,z=R.length,U=$.indexes,ee="",ce=0,ve=0,Oe=!1,Je=[],tt=0;tt<z;++tt){var Ke=R[tt];if(U[ve]===tt){if(++ve,Oe||(Oe=!0,D?(Je.push(ee),ee=""):ee+=H),ve===U.length){D?(ee+=Ke,Je.push(D(ee,ce++)),ee="",Je.push(R.substr(tt+1))):ee+=Ke+re+R.substr(tt+1);break}}else Oe&&(Oe=!1,D?(Je.push(D(ee,ce++)),ee=""):ee+=re);ee+=Ke}return D?Je:ee},o=$=>{typeof $=="number"?$=""+$:typeof $!="string"&&($="");var H=b($);return u($,{_targetLower:H._lower,_targetLowerCodes:H.lowerCodes,_bitflags:H.bitflags})},i=()=>{O.clear(),T.clear()};class a{get indexes(){return this._indexes.slice(0,this._indexes.len).sort((H,re)=>H-re)}set indexes(H){return this._indexes=H}highlight(H,re){return n(this,H,re)}get score(){return l(this._score)}set score(H){this._score=c(H)}}class s extends Array{get score(){return l(this._score)}set score(H){this._score=c(H)}}var u=($,H)=>{let re=new a;return re.target=$,re.obj=H.obj??G,re._score=H._score??ue,re._indexes=H._indexes??[],re._targetLower=H._targetLower??"",re._targetLowerCodes=H._targetLowerCodes??G,re._nextBeginningIndexes=H._nextBeginningIndexes??G,re._bitflags=H._bitflags??0,re},l=$=>$===ue?0:$>1?$:Math.E**(((-$+1)**.04307-1)*-2),c=$=>$===0?ue:$>1?$:1-Math.pow(Math.log($)/-2+1,1/.04307),d=$=>{typeof $=="number"?$=""+$:typeof $!="string"&&($=""),$=$.trim();var H=b($),re=[];if(H.containsSpace){var D=$.split(/\s+/);D=[...new Set(D)];for(var R=0;R<D.length;R++)if(D[R]!==""){var z=b(D[R]);re.push({lowerCodes:z.lowerCodes,_lower:D[R].toLowerCase(),containsSpace:!1})}}return{lowerCodes:H.lowerCodes,_lower:H._lower,containsSpace:H.containsSpace,bitflags:H.bitflags,spaceSearches:re}},f=$=>{if($.length>999)return o($);var H=O.get($);return H!==void 0||(H=o($),O.set($,H)),H},p=$=>{if($.length>999)return d($);var H=T.get($);return H!==void 0||(H=d($),T.set($,H)),H},m=($,H)=>{var re=[];re.total=$.length;var D=H?.limit||K;if(H?.key)for(var R=0;R<$.length;R++){var z=$[R],U=q(z,H.key);if(U!=G){J(U)||(U=f(U));var ee=u(U.target,{_score:U._score,obj:z});if(re.push(ee),re.length>=D)return re}}else if(H?.keys)for(var R=0;R<$.length;R++){for(var z=$[R],ce=new s(H.keys.length),ve=H.keys.length-1;ve>=0;--ve){var U=q(z,H.keys[ve]);if(!U){ce[ve]=Y;continue}J(U)||(U=f(U)),U._score=ue,U._indexes.len=0,ce[ve]=U}if(ce.obj=z,ce._score=ue,re.push(ce),re.length>=D)return re}else for(var R=0;R<$.length;R++){var U=$[R];if(U!=G&&(J(U)||(U=f(U)),U._score=ue,U._indexes.len=0,re.push(U),re.length>=D))return re}return re},h=($,H,re=!1,D=!1)=>{if(re===!1&&$.containsSpace)return y($,H,D);for(var R=$._lower,z=$.lowerCodes,U=z[0],ee=H._targetLowerCodes,ce=z.length,ve=ee.length,Ke=0,Oe=0,Je=0;;){var tt=U===ee[Oe];if(tt){if(P[Je++]=Oe,++Ke,Ke===ce)break;U=z[Ke]}if(++Oe,Oe>=ve)return G}var Ke=0,dt=!1,Pt=0,Nt=H._nextBeginningIndexes;Nt===G&&(Nt=H._nextBeginningIndexes=w(H.target)),Oe=P[0]===0?0:Nt[P[0]-1];var Ne=0;if(Oe!==ve)for(;;)if(Oe>=ve){if(Ke<=0||(++Ne,Ne>200))break;--Ke;var Tr=M[--Pt];Oe=Nt[Tr]}else{var tt=z[Ke]===ee[Oe];if(tt){if(M[Pt++]=Oe,++Ke,Ke===ce){dt=!0;break}++Oe}else Oe=Nt[Oe]}var st=ce<=1?-1:H._targetLower.indexOf(R,P[0]),Le=!!~st,rt=Le?st===0||H._nextBeginningIndexes[st-1]===st:!1;if(Le&&!rt){for(var Fe=0;Fe<Nt.length;Fe=Nt[Fe])if(!(Fe<=st)){for(var We=0;We<ce&&z[We]===H._targetLowerCodes[Fe+We];We++);if(We===ce){st=Fe,rt=!0;break}}}var ke=In=>{for(var hi=0,Gm=0,Fs=1;Fs<ce;++Fs)In[Fs]-In[Fs-1]!==1&&(hi-=In[Fs],++Gm);var Vb=In[ce-1]-In[0]-(ce-1);if(hi-=(12+Vb)*Gm,In[0]!==0&&(hi-=In[0]*In[0]*.2),!dt)hi*=1e3;else{for(var Jh=1,Fs=Nt[0];Fs<ve;Fs=Nt[Fs])++Jh;Jh>24&&(hi*=(Jh-24)*10)}return hi-=(ve-ce)/2,Le&&(hi/=1+ce*ce*1),rt&&(hi/=1+ce*ce*1),hi-=(ve-ce)/2,hi};if(dt)if(rt){for(var Fe=0;Fe<ce;++Fe)P[Fe]=st+Fe;var Lt=P,Eo=ke(P)}else var Lt=M,Eo=ke(M);else{if(Le)for(var Fe=0;Fe<ce;++Fe)P[Fe]=st+Fe;var Lt=P,Eo=ke(Lt)}H._score=Eo;for(var Fe=0;Fe<ce;++Fe)H._indexes[Fe]=Lt[Fe];H._indexes.len=ce;let xl=new a;return xl.target=H.target,xl._score=H._score,xl._indexes=H._indexes,xl},y=($,H,re)=>{for(var D=new Set,R=0,z=G,U=0,ee=$.spaceSearches,ce=ee.length,ve=0,Oe=()=>{for(let rt=ve-1;rt>=0;rt--)H._nextBeginningIndexes[I[rt*2+0]]=I[rt*2+1]},Je=!1,Le=0;Le<ce;++Le){A[Le]=ue;var tt=ee[Le];if(z=h(tt,H),re){if(z===G)continue;Je=!0}else if(z===G)return Oe(),G;var Ke=Le===ce-1;if(!Ke){var dt=z._indexes,Pt=!0;for(let Fe=0;Fe<dt.len-1;Fe++)if(dt[Fe+1]-dt[Fe]!==1){Pt=!1;break}if(Pt){var Nt=dt[dt.len-1]+1,Ne=H._nextBeginningIndexes[Nt-1];for(let Fe=Nt-1;Fe>=0&&Ne===H._nextBeginningIndexes[Fe];Fe--)H._nextBeginningIndexes[Fe]=Nt,I[ve*2+0]=Fe,I[ve*2+1]=Ne,ve++}}R+=z._score/ce,A[Le]=z._score/ce,z._indexes[0]<U&&(R-=(U-z._indexes[0])*2),U=z._indexes[0];for(var Tr=0;Tr<z._indexes.len;++Tr)D.add(z._indexes[Tr])}if(re&&!Je)return G;Oe();var st=h($,H,!0);if(st!==G&&st._score>R){if(re)for(var Le=0;Le<ce;++Le)A[Le]=st._score/ce;return st}re&&(z=H),z._score=R;var Le=0;for(let rt of D)z._indexes[Le++]=rt;return z._indexes.len=Le,z},g=$=>$.replace(/\p{Script=Latin}+/gu,H=>H.normalize("NFD")).replace(/[\u0300-\u036f]/g,""),b=$=>{$=g($);for(var H=$.length,re=$.toLowerCase(),D=[],R=0,z=!1,U=0;U<H;++U){var ee=D[U]=re.charCodeAt(U);if(ee===32){z=!0;continue}var ce=ee>=97&&ee<=122?ee-97:ee>=48&&ee<=57?26:ee<=127?30:31;R|=1<<ce}return{lowerCodes:D,bitflags:R,containsSpace:z,_lower:re}},_=$=>{for(var H=$.length,re=[],D=0,R=!1,z=!1,U=0;U<H;++U){var ee=$.charCodeAt(U),ce=ee>=65&&ee<=90,ve=ce||ee>=97&&ee<=122||ee>=48&&ee<=57,Oe=ce&&!R||!z||!ve;R=ce,z=ve,Oe&&(re[D++]=U)}return re},w=$=>{$=g($);for(var H=$.length,re=_($),D=[],R=re[0],z=0,U=0;U<H;++U)R>U?D[U]=R:(R=re[++z],D[U]=R===void 0?H:R);return D},O=new Map,T=new Map,P=[],M=[],I=[],j=[],A=[],k=[],V=[],q=($,H)=>{var re=$[H];if(re!==void 0)return re;if(typeof H=="function")return H($);var D=H;Array.isArray(H)||(D=H.split("."));for(var R=D.length,z=-1;$&&++z<R;)$=$[D[z]];return $},J=$=>typeof $=="object"&&typeof $._bitflags=="number",K=1/0,ue=-K,oe=[];oe.total=0;var G=null,Y=o(""),se=$=>{var H=[],re=0,D={},R=z=>{for(var U=0,ee=H[U],ce=1;ce<re;){var ve=ce+1;U=ce,ve<re&&H[ve]._score<H[ce]._score&&(U=ve),H[U-1>>1]=H[U],ce=1+(U<<1)}for(var Oe=U-1>>1;U>0&&ee._score<H[Oe]._score;Oe=(U=Oe)-1>>1)H[U]=H[Oe];H[U]=ee};return D.add=z=>{var U=re;H[re++]=z;for(var ee=U-1>>1;U>0&&z._score<H[ee]._score;ee=(U=ee)-1>>1)H[U]=H[ee];H[U]=z},D.poll=z=>{if(re!==0){var U=H[0];return H[0]=H[--re],R(),U}},D.peek=z=>{if(re!==0)return H[0]},D.replaceTop=z=>{H[0]=z,R()},D},ie=se();return{single:e,go:r,prepare:o,cleanup:i}})});var srn={};Rn(srn,{ContextCompactor:()=>_vt});var _vt,urn=v(()=>{_t();v7();Qa();_vt=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=l0.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}async compact(e){let r=e.length;B(`[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 B(`[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;B(`[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 B(`[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?(B("[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 Hs(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 Tbi={};Rn(Tbi,{default:()=>Bke});module.exports=zfe(Tbi);mR();k1();qs();Ez();Dot();iG();_t();F1();var THr=require("obsidian");to();var Xje=L(X());kn();var Zo=Xje.forwardRef(({className:t,type:e,...r},n)=>Xje.createElement("input",{type:e,className:Te("!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}));Zo.displayName="Input";var Zje=L(X());var eHr=L(X(),1);var ZVr=L(X(),1),Yti=L(cu(),1);Vu();var YVr=L(vr(),1),Qti=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],QVr=Qti.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=ZVr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,YVr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var tHr=L(vr(),1),eri="Label",rHr=eHr.forwardRef((t,e)=>(0,tHr.jsx)(QVr.label,{...t,ref:e,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(t.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));rHr.displayName=eri;var mmt=rHr;Wye();kn();var rri=N6("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),im=Zje.forwardRef(({className:t,...e},r)=>Zje.createElement(mmt,{ref:r,className:Te(rri(),t),...e}));im.displayName=mmt.displayName;var lX=L(X());var yw=L(X(),1);var oHr=L(X(),1);function nHr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function hmt(...t){return e=>{let r=!1,n=t.map(o=>{let i=nHr(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():nHr(t[o],null)}}}}function iHr(...t){return oHr.useCallback(hmt(...t),t)}var FD=L(X(),1),aHr=L(vr(),1);function Yje(t,e=[]){let r=[];function n(i,a){let s=FD.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=FD.useMemo(()=>m,Object.values(m));return(0,aHr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=FD.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=>FD.createContext(a));return function(s){let u=s?.[t]||i;return FD.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,nri(o,...e)]}function nri(...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 FD.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}function gmt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var yU=L(X(),1);var sX=L(X(),1);function ymt(t){let e=sX.useRef(t);return sX.useEffect(()=>{e.current=t}),sX.useMemo(()=>(...r)=>e.current?.(...r),[])}function Qje({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=ori({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=ymt(r),u=yU.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 ori({defaultProp:t,onChange:e}){let r=yU.useState(t),[n]=r,o=yU.useRef(n),i=ymt(e);return yU.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var eDe=L(X(),1);function sHr(t){let e=eDe.useRef({value:t,previous:t});return eDe.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var lHr=L(X(),1);var uHr=L(X(),1),kD=globalThis?.document?uHr.useLayoutEffect:()=>{};function cHr(t){let[e,r]=lHr.useState(void 0);return kD(()=>{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 B_=L(X(),1);var fHr=L(X(),1);function dHr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function iri(...t){return e=>{let r=!1,n=t.map(o=>{let i=dHr(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():dHr(t[o],null)}}}}function pHr(...t){return fHr.useCallback(iri(...t),t)}var mHr=L(X(),1);function ari(t,e){return mHr.useReducer((r,n)=>e[r][n]??r,t)}var dce=t=>{let{present:e,children:r}=t,n=sri(e),o=typeof r=="function"?r({present:n.isPresent}):B_.Children.only(r),i=pHr(n.ref,uri(o));return typeof r=="function"||n.isPresent?B_.cloneElement(o,{ref:i}):null};dce.displayName="Presence";function sri(t){let[e,r]=B_.useState(),n=B_.useRef({}),o=B_.useRef(t),i=B_.useRef("none"),a=t?"mounted":"unmounted",[s,u]=ari(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return B_.useEffect(()=>{let l=tDe(n.current);i.current=s==="mounted"?l:"none"},[s]),kD(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=tDe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),kD(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=tDe(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=tDe(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:B_.useCallback(l=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function tDe(t){return t?.animationName||"none"}function uri(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 hHr=L(X(),1),pri=L(cu(),1);var Dg=L(X(),1);var uX=L(vr(),1),_mt=Dg.forwardRef((t,e)=>{let{children:r,...n}=t,o=Dg.Children.toArray(r),i=o.find(cri);if(i){let a=i.props.children,s=o.map(u=>u===i?Dg.Children.count(a)>1?Dg.Children.only(null):Dg.isValidElement(a)?a.props.children:null:u);return(0,uX.jsx)(bmt,{...n,ref:e,children:Dg.isValidElement(a)?Dg.cloneElement(a,void 0,s):null})}return(0,uX.jsx)(bmt,{...n,ref:e,children:r})});_mt.displayName="Slot";var bmt=Dg.forwardRef((t,e)=>{let{children:r,...n}=t;if(Dg.isValidElement(r)){let o=fri(r);return Dg.cloneElement(r,{...dri(n,r.props),ref:e?hmt(e,o):o})}return Dg.Children.count(r)>1?Dg.Children.only(null):null});bmt.displayName="SlotClone";var lri=({children:t})=>(0,uX.jsx)(uX.Fragment,{children:t});function cri(t){return Dg.isValidElement(t)&&t.type===lri}function dri(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 fri(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 gHr=L(vr(),1),mri=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],vmt=mri.reduce((t,e)=>{let r=hHr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?_mt:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,gHr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var _U=L(vr(),1),wmt="Checkbox",[hri,Xbs]=Yje(wmt),[gri,yri]=hri(wmt),yHr=yw.forwardRef((t,e)=>{let{__scopeCheckbox:r,name:n,checked:o,defaultChecked:i,required:a,disabled:s,value:u="on",onCheckedChange:l,form:c,...d}=t,[f,p]=yw.useState(null),m=iHr(e,w=>p(w)),h=yw.useRef(!1),y=f?c||!!f.closest("form"):!0,[g=!1,b]=Qje({prop:o,defaultProp:i,onChange:l}),_=yw.useRef(g);return yw.useEffect(()=>{let w=f?.form;if(w){let O=()=>b(_.current);return w.addEventListener("reset",O),()=>w.removeEventListener("reset",O)}},[f,b]),(0,_U.jsxs)(gri,{scope:r,state:g,disabled:s,children:[(0,_U.jsx)(vmt.button,{type:"button",role:"checkbox","aria-checked":bU(g)?"mixed":g,"aria-required":a,"data-state":vHr(g),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:m,onKeyDown:gmt(t.onKeyDown,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:gmt(t.onClick,w=>{b(O=>bU(O)?!0:!O),y&&(h.current=w.isPropagationStopped(),h.current||w.stopPropagation())})}),y&&(0,_U.jsx)(bri,{control:f,bubbles:!h.current,name:n,value:u,checked:g,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:bU(i)?!1:i})]})});yHr.displayName=wmt;var bHr="CheckboxIndicator",_Hr=yw.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=yri(bHr,r);return(0,_U.jsx)(dce,{present:n||bU(i.state)||i.state===!0,children:(0,_U.jsx)(vmt.span,{"data-state":vHr(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});_Hr.displayName=bHr;var bri=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=yw.useRef(null),s=sHr(r),u=cHr(e);yw.useEffect(()=>{let c=a.current,d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(s!==r&&p){let m=new Event("click",{bubbles:n});c.indeterminate=bU(r),p.call(c,bU(r)?!1:r),c.dispatchEvent(m)}},[s,r,n]);let l=yw.useRef(bU(r)?!1:r);return(0,_U.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??l.current,...i,tabIndex:-1,ref:a,style:{...t.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function bU(t){return t==="indeterminate"}function vHr(t){return bU(t)?"indeterminate":t?"checked":"unchecked"}var Smt=yHr,wHr=_Hr;Jr();kn();var Qc=lX.forwardRef(({className:t,...e},r)=>lX.createElement(Smt,{ref:r,className:Te("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},lX.createElement(wHr,{className:Te("tw-flex tw-items-center tw-justify-center tw-text-current")},lX.createElement(Hu,{className:"tw-size-4"}))));Qc.displayName=Smt.displayName;var g0=L(X());kn();var bw=g0.forwardRef(({className:t,value:e,...r},n)=>{let o=g0.useRef(null),i=g0.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);g0.useLayoutEffect(()=>{i()},[e,i]),g0.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 g0.createElement("textarea",{className:Te("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})});bw.displayName="Textarea";var $s=L(X()),EHr=L(dd());ot();var lA=L(X());Zt();Jr();Or();var Cmt=({capabilities:t=[],iconSize:e=16})=>lA.default.createElement(lA.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return lA.default.createElement(mC,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return lA.default.createElement(NN,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return lA.default.createElement(cl,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),xmt=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return lA.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-1"},lA.default.createElement("span",{className:"tw-truncate tw-text-sm hover:tw-text-normal"},r),t.capabilities&&t.capabilities.length>0&&lA.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-0.5"},lA.default.createElement(Cmt,{capabilities:t.capabilities,iconSize:e})))},rDe=t=>{let e=t.displayName||t.name,r=`(${tg(t.provider)})`;return`${e} ${r}`},cX=t=>{let e=t.displayName||t.name,r=`(${tg(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}`};kn();Jr();_t();var cA=L(X());function SHr(){return cA.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},cA.default.createElement("li",null,cA.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),cA.default.createElement("li",null,cA.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),cA.default.createElement("li",null,cA.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),cA.default.createElement("li",null,cA.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 Omt="{copilot-selection}";var dX="copilotquickcommand",dA={title:"",content:"",showInContextMenu:!0,showInSlashMenu:!0,order:0,modelKey:"",lastUsedMs:0},qD="copilot-command-context-menu-enabled",UD="copilot-command-slash-enabled",fA="copilot-command-context-menu-order",BD="copilot-command-model-key",zD="copilot-command-last-used",CHr=[{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:
|
||
---
|
||

|
||
|
||
> [!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}];_t();var fX=require("obsidian");ot();eC();eC();var hJ=cL(),gJ=Cc([]),Tmt=new Set;function yJ(t){Tmt.add(t)}function bJ(t){Tmt.delete(t)}function fce(t){return Tmt.has(t)}function pce(t){let e=hJ.get(gJ);hJ.set(gJ,e.filter(r=>r.title!==t))}function _J(t,e){let r=hJ.get(gJ),n;(e?r.findIndex(i=>i.title===e):-1)!==-1?n=r.map(i=>i.title===e?t:i):n=[...r,t],hJ.set(gJ,n)}function nDe(t){hJ.set(gJ,t)}function oDe(){return e_(gJ,{store:hJ})}function z_(){return hJ.get(gJ)}Aee();Zt();lN();Or();function iDe(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 pX(t){return encodeURIComponent(t.toLowerCase())}function vU(){return(0,fX.normalizePath)(ae().customPromptsFolder)}function mX(t){return`${vU()}/${t}.md`}function hX(t){if(!(t instanceof fX.TFile)||t.extension!=="md")return!1;let e=vU();return!(!t.path.startsWith(e+"/")||t.path.slice(e.length+1).includes("/"))}function xHr(t){return app.metadataCache.getFileCache(t)?.frontmatter?.[fA]!=null}async function mce(t){let e=await app.vault.read(t),r=UW(e),n=app.metadataCache.getFileCache(t),o=n?.frontmatter?.[qD]??dA.showInContextMenu,i=n?.frontmatter?.[UD]??dA.showInSlashMenu,a=n?.frontmatter?.[zD]??dA.lastUsedMs,s=n?.frontmatter?.[fA]??dA.order,u=n?.frontmatter?.[BD]??dA.modelKey;return{title:t.basename,modelKey:u,content:r,showInContextMenu:o,showInSlashMenu:i,order:s,lastUsedMs:a}}async function aDe(){let t=app.vault.getFiles().filter(r=>hX(r)),e=await Promise.all(t.map(mce));return nDe(e),e}function hce(t){return mO(t,"manual",{getName:e=>e.title,getCreatedAtMs:()=>0,getLastUsedAtMs:()=>0,getManualOrder:e=>e.order})}function vri(t){return mO(t,"recent",{getName:e=>e.title,getCreatedAtMs:()=>0,getLastUsedAtMs:e=>e.lastUsedMs})}function wri(t){return mO(t,"name",{getName:e=>e.title,getCreatedAtMs:()=>0,getLastUsedAtMs:()=>0})}function sDe(t){switch(ae().promptSortStrategy){case"timestamp":return vri(t);case"alphabetical":return wri(t);case"manual":return hce(t);default:return t}}async function Emt(t,e,r=!1){let o=(await gce(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes(`{${n_}}`)||r)return o;let i=o.indexOf(Omt);return i===-1&&e.trim()?o+`
|
||
|
||
<`+n_+">"+e+"</"+n_+">":o.slice(0,i)+e+o.slice(i+Omt.length)}var Sri=/\{(?!copilot-selection\}|\[\[)([^}]+)\}/g;async function Cri(t,e,r){let n=new Map,o=new Set,i;for(;(i=Sri.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]},u=a.toLowerCase();if(u==="activenote")if(r){let l=await BW(r,e);l&&(s.content=`<${Nz}>
|
||
<path>${r.path}</path>
|
||
## ${uge(r)}
|
||
|
||
${l}
|
||
</${Nz}>`,s.files.push(r))}else new fX.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 sge(e,l),d=[];for(let f of c){let p=await BW(f,e);p&&(d.push(`<${Nz}>
|
||
<path>${f.path}</path>
|
||
## ${uge(f)}
|
||
|
||
${p}
|
||
</${Nz}>`),s.files.push(f))}s.content=d.join(`
|
||
|
||
`)}else{let l=IRt(a),c=await Eee(e,l),d=[];for(let f of c){let p=await BW(f,e);p&&(d.push(`<${Nz}>
|
||
<path>${f.path}</path>
|
||
## ${uge(f)}
|
||
|
||
${p}
|
||
</${Nz}>`),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('"')||Be(`No notes found for variable: ${a}`))}return{variablesMap:n,includedFiles:o}}async function gce(t,e,r,n,o=!1){let i=ae(),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 Cri(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 BW(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+=`
|
||
|
||
<${jee} name="${p}">
|
||
${m}
|
||
</${jee}>`:c+=`<${jee} name="${p}">
|
||
${m}
|
||
</${jee}>`);let f=MRt(l,r);for(let p of f)if(!a.has(p)){let m=await BW(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=`<${Nee}>
|
||
<title>${p.basename}</title>
|
||
<path>${p.path}</path>
|
||
<ctime>${y}</ctime>
|
||
<mtime>${g}</mtime>
|
||
<content>
|
||
${m}
|
||
</content>
|
||
</${Nee}>`;c&&(c+=`
|
||
|
||
`),c+=`${b}`,a.add(p)}}return{processedPrompt:c?`${l}
|
||
|
||
${c}`:`${l}
|
||
|
||
`,includedFiles:Array.from(a)}}function OHr(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 uDe(){let e=z_().reduce((r,n)=>r>n.order?r:n.order,0);return e===Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+10}async function Pmt(t,e){try{yJ(t.path),await app.fileManager.processFrontMatter(t,r=>{r[qD]==null&&(r[qD]=e.showInContextMenu),r[UD]==null&&(r[UD]=e.showInSlashMenu),r[fA]==null&&(r[fA]=e.order),r[BD]==null&&(r[BD]=e.modelKey),r[zD]==null&&(r[zD]=e.lastUsedMs)})}finally{bJ(t.path)}}function lDe(t){let e=t.getCursor("from"),r=t.getCursor("to"),o=t.getValue().split(`
|
||
`),i=!1,a=[],s=0,u=0,l=0;for(;l<o.length;)if(o[l].trim()===`\`\`\`${dX}`){i=!0;let c=l;for(l++;l<o.length&&o[l].trim()!=="```";)l++;l++;let d=l-c;c<=e.line&&(s+=d),c<=r.line&&(u+=d)}else a.push(o[l]),l++;if(i){t.setValue(a.join(`
|
||
`));let c=Math.max(0,e.line-s),d=Math.max(0,r.line-u);t.setSelection({line:c,ch:e.ch},{line:d,ch:r.ch})}return i}function xri({commands:t,command:e,onConfirm:r,onCancel:n}){let i=zr().activeModels.filter(f=>f.enabled).map(f=>({label:rDe(f),value:oo(f)})),[a,s]=(0,$s.useState)(e),[u,l]=(0,$s.useState)({}),c=(f,p)=>{s(m=>({...m,[f]:p})),l(m=>({...m,[f]:void 0}))},d=()=>{let f={},p=iDe(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 $s.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},$s.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},$s.default.createElement(im,{htmlFor:"title"},"Name"),$s.default.createElement(Zo,{id:"title",value:a.title,onChange:f=>c("title",f.target.value),placeholder:"Enter command name"}),u.title&&$s.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.title)),$s.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},$s.default.createElement(im,{htmlFor:"content"},"Prompt"),$s.default.createElement(SHr,null),$s.default.createElement(bw,{id:"content",value:a.content,onChange:f=>c("content",f.target.value),placeholder:"Enter command prompt",className:"tw-min-h-[200px]"}),u.content&&$s.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.content)),$s.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},$s.default.createElement(im,{htmlFor:"modelKey"},"Model (Optional)"),$s.default.createElement("div",{className:"tw-group tw-relative tw-w-full"},$s.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)){ne(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:Te("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")},$s.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>$s.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),$s.default.createElement("div",{className:Te("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")},$s.default.createElement(ts,{className:"tw-size-4"})))),$s.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$s.default.createElement(Qc,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),$s.default.createElement(im,{htmlFor:"showInContextMenu"},"Show in context menu")),$s.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},$s.default.createElement(Qc,{id:"showInSlashMenu",checked:a.showInSlashMenu,onCheckedChange:f=>c("showInSlashMenu",f)}),$s.default.createElement(im,{htmlFor:"showInSlashMenu"},"Show in slash menu")),$s.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},$s.default.createElement(ge,{variant:"secondary",onClick:n},"Cancel"),$s.default.createElement(ge,{variant:"default",onClick:d},"Save")))}var wU=class extends THr.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,EHr.createRoot)(r);let n=o=>{this.onUpdate(o),this.close()};this.root.render($s.default.createElement(xri,{commands:this.commands,command:this.command,onConfirm:n,onCancel:()=>this.close()}))}onClose(){this.root.unmount()}};var yce=require("obsidian");Xw();Zt();var Um=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=mX(e.title);try{yJ(o);let i=e.order;n.autoOrder&&(i=uDe()),e={...e,order:i};let a=vU();await xc(a);let s=app.vault.getAbstractFileByPath(o);!s||!(s instanceof yce.TFile)?s=await app.vault.create(o,e.content):await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[qD]=e.showInContextMenu,u[UD]=e.showInSlashMenu,u[fA]=e.order,u[BD]=e.modelKey,u[zD]=e.lastUsedMs}),n.skipStoreUpdate||_J(e,e.title)}finally{bJ(o)}}async recordUsage(e){this.updateCommand({...e,lastUsedMs:Date.now()},e.title)}async updateCommand(e,r,n=!1){let o=mX(e.title),i=mX(r),a=e.title!==r;try{yJ(o),a&&yJ(i),n||_J(e,r);let s=app.vault.getAbstractFileByPath(o);if(a){if(app.vault.getAbstractFileByPath(o))throw new Ao("Error saving custom prompt. Please check if the title already exists.");let l=app.vault.getAbstractFileByPath(i);l instanceof yce.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(mX(e.title))),s instanceof yce.TFile&&(await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[qD]=e.showInContextMenu,u[UD]=e.showInSlashMenu,u[fA]=e.order,u[BD]=e.modelKey,u[zD]=e.lastUsedMs}))}finally{bJ(o),a&&bJ(i)}}async updateCommands(e){nDe(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=mX(e.title);try{yJ(r),pce(e.title);let n=app.vault.getAbstractFileByPath(r);n instanceof yce.TFile&&await app.vault.delete(n)}finally{bJ(r)}}};var dDe=require("obsidian");qs();to();v7();bV();_t();Zt();wv();_v();pmt();Jr();var wx=require("obsidian"),Sr=L(X()),PHr=L(dd());ot();function Ori(t,e){let[r]=(0,Sr.useState)(new Wje({returnMessages:!0,memoryKey:"history"})),[n,o]=(0,Sr.useState)(null);return(0,Sr.useEffect)(()=>{async function i(){let a=await l0.getInstance().createModelInstance(t),u=ld.fromMessages([Gw.fromTemplate(e||"You are a helpful assistant. You'll help the user with their content editing needs."),new pO("history"),Qb.fromTemplate("{input}")]),l=Rl.from([{input:c=>c.input,memory:()=>r.loadMemoryVariables({})},{input:c=>c.input,history:c=>c.memory.history},u,a]);o(l)}i()},[t,r,e]),{chatChain:n,chatMemory:r}}function Tri({originalText:t,command:e,onInsert:r,onReplace:n,systemPrompt:o}){let[i,a]=(0,Sr.useState)(null),[s,u]=(0,Sr.useState)(null),[l,c]=(0,Sr.useState)(""),d=(0,Sr.useRef)(null),f=(0,Sr.useRef)(null),[p,m]=(0,Sr.useState)(!0),[h]=yL(),y=zr(),g=(0,Sr.useMemo)(()=>_O(e.modelKey||h,y.activeModels),[e.modelKey,h,y.activeModels]),{chatChain:b,chatMemory:_}=Ori(g,o),w=e.title,O=(0,Sr.useMemo)(()=>s||(!p||!i||i.trim()===""?"loading...":i),[s,p,i]),T=(0,Sr.useCallback)(async(k,V)=>{if(!b)return console.error("Chat chain not initialized"),new wx.Notice("Chat engine not ready. Please try again."),m(!1),null;try{a(null),u(null),m(!0);let J=await b.withConfig({signal:V.signal}).stream({input:k}),K=new T_(oe=>{a(oe)},void 0,!0);for await(let oe of J){if(V.signal.aborted)break;K.processChunk(oe)}let ue=K.close();if(!V.signal.aborted){let oe=ue.content.trim();return u(oe),m(!1),await _.saveContext({input:k},{output:oe}),oe}return null}catch(q){return ne("Error generating response:",q),m(!1),null}},[b,_]);(0,Sr.useEffect)(()=>{let k=new AbortController;P.current=k;async function V(){if(b)try{let q=await Emt(e.content,t);await T(q,k)}catch(q){ne("Error in initial response:",q),m(!1)}}return V(),()=>{k.abort()}},[e.content,t,b,T]);let P=(0,Sr.useRef)(null),M=async()=>{if(!l.trim()||!b){b||new wx.Notice("Chat engine not ready. Please try again.");return}let k=new AbortController;P.current=k;let V=await Emt(l,t,!0);try{await T(V,k)&&c("")}finally{k.signal.aborted&&(m(!1),u(i??"")),P.current=null}},I=()=>{P.current&&(P.current.abort(),P.current=null,m(!1))},j=k=>{k.nativeEvent.isComposing||(!p&&s&&!A&&(k.key==="Enter"&&(wx.Platform.isMacOS?k.metaKey:k.ctrlKey)&&!k.shiftKey&&(k.preventDefault(),n(s)),k.key==="Enter"&&(wx.Platform.isMacOS?k.metaKey:k.ctrlKey)&&k.shiftKey&&(k.preventDefault(),r(s))),A&&k.key==="Enter"&&!k.shiftKey&&!k.metaKey&&!k.ctrlKey&&(k.preventDefault(),M()))};(0,Sr.useEffect)(()=>{if(d.current&&i&&p){let k=d.current;k.scrollTop=k.scrollHeight}},[i,p]);let A=!p&&l.trim().length>0;return Sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4",onKeyDown:j},Sr.default.createElement("div",{className:"tw-max-h-60 tw-overflow-y-auto tw-whitespace-pre-wrap tw-text-muted"},t),Sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},w&&Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-font-bold tw-text-normal"},Sr.default.createElement(lS,{className:"tw-size-4"}),w)),Sr.default.createElement("div",{className:"tw-group tw-relative"},Sr.default.createElement("textarea",{ref:d,className:"tw-peer tw-h-60 tw-w-full tw-text-text",value:O,disabled:s==null,onChange:k=>u(k.target.value)}),s&&Sr.default.createElement("button",{className:"tw-absolute tw-right-2 tw-top-2 tw-opacity-0 tw-transition-opacity group-hover:tw-opacity-100 peer-focus-visible:!tw-opacity-0",onClick:()=>{navigator.clipboard.writeText(s),new wx.Notice("Copied to clipboard")}},Sr.default.createElement(ig,{className:"tw-size-4 hover:tw-text-accent"}))),!p&&s&&Sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Sr.default.createElement("textarea",{autoFocus:!0,ref:f,className:"tw-h-20 tw-w-full tw-text-text",placeholder:"Enter follow-up instructions...",value:l,onChange:k=>c(k.target.value)})),Sr.default.createElement("div",{className:"tw-flex tw-justify-between tw-gap-2"},Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs tw-font-bold tw-text-faint"},Sr.default.createElement(Lte,{className:"tw-size-4"}),rDe(g)),Sr.default.createElement("div",{className:"tw-flex tw-gap-2"},p?Sr.default.createElement(ge,{size:"sm",variant:"secondary",onClick:I},"Stop"):A?Sr.default.createElement(ge,{size:"sm",onClick:M,className:"tw-flex tw-items-center tw-gap-1"},Sr.default.createElement("span",null,"Submit"),Sr.default.createElement(fC,{className:"tw-size-3"})):Sr.default.createElement(Sr.default.Fragment,null,Sr.default.createElement(ge,{size:"sm",onClick:()=>r(s??""),className:"tw-flex tw-items-center tw-gap-1"},Sr.default.createElement("span",null,"Insert"),Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs"},wx.Platform.isMacOS?Sr.default.createElement(Sr.default.Fragment,null,Sr.default.createElement(HL,{className:"tw-size-3"}),Sr.default.createElement($6,{className:"tw-size-3"}),Sr.default.createElement(fC,{className:"tw-size-3"})):Sr.default.createElement(Sr.default.Fragment,null,Sr.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Sr.default.createElement($6,{className:"tw-size-3"}),Sr.default.createElement(fC,{className:"tw-size-3"})))),Sr.default.createElement(ge,{size:"sm",onClick:()=>n(s??""),className:"tw-flex tw-items-center tw-gap-1"},Sr.default.createElement("span",null,"Replace"),Sr.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs"},wx.Platform.isMacOS?Sr.default.createElement(Sr.default.Fragment,null,Sr.default.createElement(HL,{className:"tw-size-3"}),Sr.default.createElement(fC,{className:"tw-size-3"})):Sr.default.createElement(Sr.default.Fragment,null,Sr.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),Sr.default.createElement(fC,{className:"tw-size-3"}))))))))}var SU=class extends wx.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,PHr.createRoot)(r);let{selectedText:n,command:o,systemPrompt:i}=this.configs,a=u=>{Mz(u),this.close()},s=u=>{Mz(u,!0),this.close()};this.root.render(Sr.default.createElement(Tri,{originalText:n,command:o,onInsert:a,onReplace:s,systemPrompt:i}))}onClose(){this.root.unmount()}};var cDe=class extends dDe.FuzzySuggestModal{constructor(e){super(e),this.setPlaceholder("Select a custom command to apply...");let r=z_();this.commands=sDe(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(dDe.MarkdownView);if(!n||!n.editor){this.openCommandModal(e,"");return}let o=n.editor.getSelection();this.openCommandModal(e,o)}openCommandModal(e,r){Um.getInstance().recordUsage(e),new SU(this.app,{selectedText:r,command:e}).open()}};mR();to();_t();Zt();var gX=require("obsidian"),Du=L(X()),MHr=L(dd());function Eri({onClose:t}){let[e,r]=Du.useState("input"),[n,o]=Du.useState(""),[i,a]=Du.useState(!1),[s,u]=Du.useState(""),[l,c]=Du.useState(!1),[d,f]=Du.useState(null),p=(w,O=!0)=>{if(!w.trim())return O&&(u(""),c(!1)),{isValid:!1};let T=aHe(w);return T.isValid?(O&&(u(""),c(!0)),{isValid:!0,videoId:T.videoId}):(O&&(u(T.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 O=await pc.getInstance().youtube4llm(n);if(!O.response.transcript)throw new Error("Transcript not available. Only English videos with auto transcript enabled are supported.");let T={videoId:w.videoId,transcript:O.response.transcript,url:ARt(w.videoId)};f(T),r("display")}catch(O){ne("Error downloading YouTube transcript:",O);let T=O instanceof Error?O.message:"An error occurred while downloading the transcript";u(T)}finally{a(!1)}}},y=async()=>{if(d)try{let w=`# YouTube Video Transcript
|
||
|
||
Source: ${d.url}
|
||
|
||
${d.transcript}`;await navigator.clipboard.writeText(w),new gX.Notice("Transcript copied to clipboard!")}catch(w){ne("Failed to copy to clipboard:",w),new gX.Notice("Failed to copy to clipboard")}},g=async()=>{if(d)try{let w=`# YouTube Video Transcript
|
||
|
||
Source: ${d.url}
|
||
|
||
${d.transcript}`;await Mz(w,!1),t()}catch(w){ne("Failed to insert to note:",w),new gX.Notice("Failed to insert to note")}},b=()=>{r("input"),o(""),u(""),f(null)},_=w=>{w.key==="Enter"&&!i&&l&&h()};return e==="display"&&d?Du.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Du.createElement("div",{className:"tw-rounded tw-bg-secondary tw-p-3"},Du.createElement("a",{href:d.url,className:"tw-text-sm tw-text-muted hover:tw-text-normal",target:"_blank",rel:"noopener noreferrer"},d.url)),Du.createElement("div",{className:"tw-max-h-96 tw-overflow-y-auto tw-rounded tw-border tw-border-border tw-bg-primary tw-p-4"},Du.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-sm tw-leading-relaxed"},d.transcript)),Du.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Du.createElement(ge,{variant:"ghost",onClick:b},"Download Another"),Du.createElement(ge,{variant:"default",onClick:y},"Copy to Clipboard"),Du.createElement(ge,{variant:"default",onClick:g},"Insert at Cursor"),Du.createElement(ge,{variant:"secondary",onClick:t},"Close"))):Du.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Du.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Du.createElement("div",{className:"tw-text-sm tw-text-muted"},"Enter a valid YouTube video URL"),Du.createElement(Zo,{placeholder:"https://www.youtube.com/watch?v=...",value:n,onChange:w=>m(w.target.value),onKeyDown:_,disabled:i}),s&&Du.createElement("div",{className:"tw-text-sm tw-text-error"},s)),Du.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Du.createElement(ge,{variant:"secondary",onClick:t,disabled:i},"Cancel"),Du.createElement(ge,{variant:"default",onClick:h,disabled:i||!l},i?"Downloading...":"Download Transcript")))}var fDe=class extends gX.Modal{constructor(e){super(e),this.setTitle("Download YouTube Script (plus)")}onOpen(){let{contentEl:e}=this;this.root=(0,MHr.createRoot)(e);let r=()=>{this.close()};this.root.render(Du.createElement(Eri,{onClose:r}))}onClose(){this.root.unmount()}};Nv();vb();Zt();var Ci=require("obsidian");D$();Or();qs();function Ah(t,e,r){t.addCommand({id:e,name:hge[e],callback:r})}function fJr(t,e,r){t.addCommand({id:e,name:hge[e],editorCallback:r})}function ani(t,e,r){t.addCommand({id:e,name:hge[e],checkCallback:r})}function Bmt(t,e,r){fJr(t,Nn.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 Ci.Notice(`Selected text contains ${i} words and ${a} tokens.`)}),Ah(t,Nn.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let n=await Oot(t.app),o=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(n);new Ci.Notice(`Total tokens in your vault: ${o}`)}catch(n){ne("Error counting tokens: ",n),new Ci.Notice("An error occurred while counting tokens.")}}),Ah(t,Nn.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),Ah(t,Nn.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),Ah(t,Nn.NEW_CHAT,()=>{cG(),t.newChat()}),ani(t,Nn.TRIGGER_QUICK_COMMAND,n=>{let o=t.app.workspace.getActiveViewOfType(Ci.MarkdownView);if(n)return!!(!lHe()&&o&&o.editor);if(lHe())return new Ci.Notice("Quick command is not available in source mode."),!1;if(!o||!o.editor)return new Ci.Notice("No active editor found."),!1;let i=o.editor;if(!i.getSelection().trim())return new Ci.Notice("Please select some text first. Selected text is required for quick commands."),!1;lDe(i);let u=i.getCursor("from").line,l=`\`\`\`${dX}
|
||
\`\`\`
|
||
`;return i.replaceRange(l,{line:u,ch:0}),!0}),Ah(t,Nn.CLEAR_LOCAL_COPILOT_INDEX,async()=>{try{await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().clearIndex(),new Ci.Notice("Cleared local Copilot semantic index.")}catch(n){ne("Error clearing semantic index:",n),new Ci.Notice("Failed to clear semantic index.")}}),Ah(t,Nn.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let o=await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().garbageCollectVectorStore();new Ci.Notice(`Garbage collection completed. Removed ${o} stale documents.`)}catch(n){ne("Error during garbage collection:",n),new Ci.Notice("Failed to garbage collect semantic index.")}}),Ah(t,Nn.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(ot(),See));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().indexVaultToVectorStore(!1);new Ci.Notice(`Semantic search index refreshed with ${a} documents.`)}else new Ci.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ne("Error building index:",n),new Ci.Notice("An error occurred while building the index.")}}),Ah(t,Nn.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(ot(),See));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().indexVaultToVectorStore(!0);new Ci.Notice(`Semantic search index rebuilt with ${a} documents.`)}else new Ci.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ne("Error rebuilding index:",n),new Ci.Notice("An error occurred while rebuilding the index.")}}),Ah(t,Nn.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),Ah(t,Nn.LIST_INDEXED_FILES,async()=>{try{let o=await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().getIndexedFiles(),{getMatchingPatterns:i,shouldIndexFile:a}=await Promise.resolve().then(()=>(vb(),vgr)),{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 O=await t.app.vault.cachedRead(w);!O||O.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 xc(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 Ci.Notice(`Listed ${p.size} indexed files`))}catch(n){ne("Error listing indexed files:",n),new Ci.Notice("Failed to list indexed files.")}}),Ah(t,Nn.INSPECT_COPILOT_INDEX_BY_NOTE_PATHS,async()=>{try{let n=t.app.workspace.getActiveFile();if(!n){new Ci.Notice("No active file. Please open a note first.");return}let o=(await Promise.resolve().then(()=>(Am(),xg))).default,{DBOperations:i}=await Promise.resolve().then(()=>(_ie(),Cgr)),a=await o.getInstance().getDb(),s=await i.getDocsByPath(a,n.path);if(!s||s.length===0){new Ci.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 xc(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 Ci.Notice(`Embedding debug info for ${u.length} chunk(s)`))}catch(n){ne("Error inspecting embeddings:",n),new Ci.Notice("Failed to inspect embeddings. Is the index loaded?")}}),Ah(t,Nn.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await Yv.getInstance().clearAllCache(),await nG.getInstance().clear(),new Ci.Notice("All Copilot caches cleared successfully")}catch(n){ne("Error clearing Copilot caches:",n),new Ci.Notice("Failed to clear Copilot caches")}}),Ah(t,Nn.OPEN_LOG_FILE,async()=>{try{await $Te(),await pm.openLogFile()}catch(n){ne("Error creating Copilot log file:",n),new Ci.Notice("Failed to create Copilot log file.")}}),Ah(t,Nn.CLEAR_LOG_FILE,async()=>{try{await pm.clear(),new Ci.Notice("Copilot log cleared.")}catch(n){ne("Error clearing Copilot log file:",n),new Ci.Notice("Failed to clear Copilot log file.")}}),fJr(t,Nn.ADD_SELECTION_TO_CHAT_CONTEXT,async n=>{let o=n.getSelection();if(!o){new Ci.Notice("No text selected");return}let i=t.app.workspace.getActiveFile();if(!i){new Ci.Notice("No active file");return}let a=n.listSelections()[0];if(!a){new Ci.Notice("Could not determine selection range");return}let s=a.anchor.line+1,u=a.head.line+1,l={id:Zm(),content:o,sourceType:"note",noteTitle:i.basename,notePath:i.path,startLine:Math.min(s,u),endLine:Math.max(s,u)};yN([l]),t.activateView()}),Ah(t,Nn.ADD_WEB_SELECTION_TO_CHAT_CONTEXT,async()=>{let{Platform:n}=await import("obsidian");if(!n.isDesktopApp){new Ci.Notice("Web selection is only available on desktop");return}let{getWebViewerService:o}=await Promise.resolve().then(()=>(SJ(),dJr));try{let i=o(t.app),a=i.getActiveLeaf()??i.getLastActiveLeaf();if(!a){new Ci.Notice("No active Web Tab found");return}let s=await i.getSelectedMarkdown(a);if(!s.trim()){new Ci.Notice("No text selected in Web Tab");return}let u=i.getPageInfo(a),l={id:Zm(),content:s,sourceType:"web",title:u.title||"Untitled",url:u.url,faviconUrl:u.faviconUrl||void 0};yN([l]),t.activateView()}catch(i){ne("Error adding web selection to context:",i),new Ci.Notice("Failed to get web selection")}}),Ah(t,Nn.ADD_CUSTOM_COMMAND,async()=>{let n=z_(),o={...dA};new wU(t.app,n,o,async a=>{await Um.getInstance().createCommand(a)}).open()}),Ah(t,Nn.APPLY_CUSTOM_COMMAND,()=>{new cDe(t.app).open()}),Ah(t,Nn.DOWNLOAD_YOUTUBE_SCRIPT,async()=>{if(!await $S()){new Ci.Notice("Download YouTube Script (plus) is a Copilot Plus feature");return}new fDe(t.app).open()})}qs();var OX={title:"",content:"",createdMs:0,modifiedMs:0,lastUsedMs:0},TX="copilot-system-prompt-created",EX="copilot-system-prompt-modified",PX="copilot-system-prompt-last-used",zmt="copilot-system-prompt-default";var xU=require("obsidian");ot();Zt();YH();_t();function _ce(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 y0(){return(0,xU.normalizePath)(ae().userSystemPromptsFolder)}function b0(t){return(0,xU.normalizePath)(`${y0()}/${t}.md`)}function sni(t,e){let r=e?(0,xU.normalizePath)(e):y0();return(0,xU.normalizePath)(`${r}/${t}.md`)}function MX(t){if(!(t instanceof xU.TFile)||t.extension!=="md")return!1;let e=y0();if(!t.path.startsWith(e+"/"))return!1;let r=t.path.slice(e.length+1);return!(r.startsWith("unsupported/")||r.includes("/"))}function Vmt(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 CJ(t){let e=await app.vault.read(t),r=UW(e),o=app.metadataCache.getFileCache(t)?.frontmatter,i=Vmt(o?.[TX],OX.createdMs),a=Vmt(o?.[EX],OX.modifiedMs),s=Vmt(o?.[PX],OX.lastUsedMs);return{title:t.basename,content:r,createdMs:i,modifiedMs:a,lastUsedMs:s}}async function Hmt(){let t=app.vault.getFiles().filter(e=>MX(e));return await Promise.all(t.map(CJ))}async function IX(){let t=await Hmt();return U1e(t),t}async function xJ(t,e){let r=ED(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||Bq(t.path),await app.fileManager.processFrontMatter(t,s=>{s[TX]==null&&(s[TX]=o),s[EX]==null&&(s[EX]=i),s[PX]==null&&(s[PX]=a)})}finally{r||zq(t.path)}}function pJr(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 Jmt(t,e,r){let n=sni(t,r),o=app.vault.getAbstractFileByPath(n);if(!(o instanceof xU.TFile)){Be(`System prompt file not found for default flag update: ${n}`);return}let i=ED(o.path);try{i||Bq(o.path),await app.fileManager.processFrontMatter(o,a=>{e?a[zmt]=!0:delete a[zmt]})}finally{i||zq(o.path)}}YH();Vq();var vce=require("obsidian");YH();_t();Zt();ot();var OJ=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(){B("Initializing SystemPromptManager"),await IX()}async createPrompt(e,r=!1){let n=C7(),o=_ce(e.title,n);if(o)throw new Error(o);let i=b0(e.title),a=y0();try{Bq(i),await xc(a),await this.vault.create(i,e.content);let s=this.vault.getAbstractFileByPath(i);s instanceof vce.TFile&&await xJ(s,e),r||ZH(e),B(`Created system prompt: ${e.title}`)}finally{zq(i)}}async updatePrompt(e,r,n=!1){let o=b0(e),i=b0(r.title),a=e!==r.title;if(a){let s=C7(),u=_ce(r.title,s,e);if(u)throw new Error(u)}try{if(Bq(i),a&&Bq(o),a){let u=this.vault.getAbstractFileByPath(o);u instanceof vce.TFile&&await app.fileManager.renameFile(u,i)}let s=this.vault.getAbstractFileByPath(i);s instanceof vce.TFile&&(await this.vault.modify(s,r.content),await app.fileManager.processFrontMatter(s,u=>{u[TX]=r.createdMs,u[EX]=r.modifiedMs,u[PX]=r.lastUsedMs})),n||(a&&(x7(e),ae().defaultSystemPromptTitle===e&&(Ue("defaultSystemPromptTitle",r.title),B(`Updated defaultSystemPromptTitle: ${e} -> ${r.title}`))),ZH(r)),B(`Updated system prompt: ${e} -> ${r.title}`)}finally{zq(i),a&&zq(o)}}async deletePrompt(e){let r=b0(e);try{Bq(r);let n=this.vault.getAbstractFileByPath(r);n instanceof vce.TFile&&await this.vault.delete(n),ae().defaultSystemPromptTitle===e&&(Ue("defaultSystemPromptTitle",""),B(`Cleared defaultSystemPromptTitle (deleted: ${e})`)),XH()===e&&(Uq(""),B(`Cleared session selectedPromptTitle (deleted: ${e})`)),x7(e),B(`Deleted system prompt: ${e}`)}finally{zq(r)}}async duplicatePrompt(e){let r=C7(),n=pJr(e.title,r),o=Date.now(),i={title:n,content:e.content,createdMs:o,modifiedMs:o,lastUsedMs:0};return await this.createPrompt(i),B(`Duplicated system prompt: ${e.title} -> ${n}`),i}getPrompts(){return C7()}async reloadPrompts(){return await IX()}async fetchPrompts(){return await Hmt()}};var RX=require("obsidian");YH();ot();var Wmt=L(oG());_t();var wce=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,Wmt.default)(e=>{this.handleSystemPromptsFolderChange(e)},300,{leading:!1,trailing:!0});this.handleFileModify=(0,Wmt.default)(async e=>{if(!(!MX(e)||ED(e.path)))try{let r=await CJ(e);ZH(r)}catch(r){ne(`Error processing system prompt modification: ${e.path}`,r)}},1e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(!(!MX(e)||ED(e.path)))try{let r=await CJ(e);await xJ(e,r);let n=await CJ(e);ZH(n)}catch(r){ne(`Error processing system prompt creation: ${e.path}`,r)}};this.handleFileDeletion=async e=>{if(!(!MX(e)||ED(e.path)))try{x7(e.basename),ae().defaultSystemPromptTitle===e.basename&&Ue("defaultSystemPromptTitle",""),XH()===e.basename&&(Uq(""),new RX.Notice(`System prompt "${e.basename}" was deleted. Cleared current chat selection.`))}catch(r){ne(`Error processing system prompt deletion: ${e.path}`,r)}};this.handleFileRename=async(e,r)=>{if(ED(e.path)||ED(r))return;let n=y0(),o=r.startsWith(n+"/")?r.slice(n.length+1):"",i=o!==""&&!o.includes("/")&&r.endsWith(".md"),a=MX(e)?e:null;if(!(!i&&!a))try{if(i){let s=r.split("/").pop()?.replace(/\.md$/i,"");if(s&&(x7(s),ae().defaultSystemPromptTitle===s&&(a?Ue("defaultSystemPromptTitle",a.basename):Ue("defaultSystemPromptTitle","")),XH()===s)){let l=a?a.basename:"";Uq(l),a?new RX.Notice(`System prompt "${s}" was renamed to "${a.basename}". Updated current chat selection.`):new RX.Notice(`System prompt "${s}" was moved out of the prompts folder. Cleared current chat selection.`)}}if(a){let s=await CJ(a);await xJ(a,s);let u=await CJ(a);ZH(u)}}catch(s){ne(`Error processing system prompt rename: ${e.path}`,s)}};this.plugin=e,this.vault=r,this.manager=OJ.getInstance(r),this.initializeEventListeners()}async initialize(){await this.manager.initialize(),HUr()}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=al(this.handleSettingsChange)}async handleDefaultPromptChange(e,r,n){try{e&&await Jmt(e,!1,n),r&&await Jmt(r,!0),B(`Default system prompt changed: "${e}" -> "${r}"`)}catch(o){ne("Error updating default system prompt frontmatter",o)}}async handleSystemPromptsFolderChange(e){let r=++this.folderChangeRequestId;try{B(`System prompts folder changed to: ${e}`);let n=await this.manager.fetchPrompts();if(r!==this.folderChangeRequestId){B(`Folder change request ${r} superseded by ${this.folderChangeRequestId}, discarding results`);return}U1e(n);let o=new Set(n.map(i=>i.title));this.validatePromptReferences(o)}catch(n){r===this.folderChangeRequestId&&ne(`Error reloading system prompts after folder change to: ${e}`,n)}}validatePromptReferences(e){let r=ae(),n=XH();r.defaultSystemPromptTitle&&!e.has(r.defaultSystemPromptTitle)&&(Ue("defaultSystemPromptTitle",""),B(`Cleared defaultSystemPromptTitle (not found in new folder): ${r.defaultSystemPromptTitle}`),new RX.Notice(`Default system prompt "${r.defaultSystemPromptTitle}" not found in new folder. Cleared default selection.`)),n&&!e.has(n)&&(Uq(""),B(`Cleared selectedPromptTitle (not found in new folder): ${n}`),new RX.Notice(`Current system prompt "${n}" not found in new folder. Cleared chat selection.`))}};var _c=L(X());to();Jr();var AX=require("obsidian"),hJr=L(dd());ot();var pA=L(X());function mJr(){return pA.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},pA.default.createElement("li",null,pA.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),pA.default.createElement("li",null,pA.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),pA.default.createElement("li",null,pA.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)."),pA.default.createElement("li",null,pA.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{folder/path}")," represents notes from a specific folder path."))}_t();function uni({prompts:t,onConfirm:e,onCancel:r,contentEl:n}){let o=zr(),[i,a]=(0,_c.useState)({...OX}),[s,u]=(0,_c.useState)({}),l=(d,f)=>{a(p=>({...p,[d]:f})),u(p=>({...p,[d]:void 0}))},c=()=>{let d={},f=_ce(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 _c.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},_c.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"},_c.default.createElement(mC,{className:"tw-size-5 tw-shrink-0"}),_c.default.createElement("div",{className:"tw-flex-1"},"System prompts are automatically loaded from .md files in your system prompts folder"," ",_c.default.createElement("strong",null,o.userSystemPromptsFolder),". Modifying the files will also update the system prompt settings.")),_c.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},_c.default.createElement(im,{htmlFor:"title"},"Name"),_c.default.createElement(Zo,{id:"title",placeholder:"Enter prompt name",value:i.title,onChange:d=>l("title",d.target.value)}),s.title&&_c.default.createElement("div",{className:"tw-text-sm tw-text-error"},s.title)),_c.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},_c.default.createElement(im,{htmlFor:"content"},"Content"),_c.default.createElement(mJr,null),_c.default.createElement("div",{className:"tw-relative"},_c.default.createElement(bw,{id:"content",placeholder:"Enter your system prompt here...",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&&_c.default.createElement("div",{className:"tw-text-sm tw-text-error"},s.content)),_c.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},_c.default.createElement(ge,{variant:"secondary",onClick:r},"Cancel"),_c.default.createElement(ge,{variant:"default",onClick:c},"Save")))}var Sce=class extends AX.Modal{constructor(r,n){super(r);this.prompts=n;this.setTitle("Add System Prompt")}onOpen(){let{contentEl:r,modalEl:n}=this;AX.Platform.isMobile&&(n.style.height="80%"),this.root=(0,hJr.createRoot)(r);let o=async i=>{let a=Date.now(),s={...i,createdMs:a,modifiedMs:a,lastUsedMs:0};try{await OJ.getInstance().createPrompt(s),this.close()}catch(u){let l=u instanceof Error?u.message:String(u);ne("Failed to create system prompt:",u),new AX.Notice(`Failed to create prompt: ${l}`)}};this.root.render(_c.default.createElement(uni,{prompts:this.prompts,onConfirm:o,onCancel:()=>this.close(),contentEl:r}))}onClose(){this.root.unmount()}};var vJr=require("obsidian");_t();ot();to();var gJr=require("obsidian"),TJ=L(X()),yJr=L(dd());function lni({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return TJ.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-5"},TJ.default.createElement("div",{className:"tw-whitespace-pre-wrap"},t),TJ.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},o&&TJ.default.createElement(ge,{variant:"secondary",onClick:r},o),n&&TJ.default.createElement(ge,{variant:"default",onClick:e},n)))}var vl=class extends gJr.Modal{constructor(r,n,o,i,a="Continue",s="Cancel"){super(r);this.onConfirm=n;this.content=o;this.confirmButtonText=a;this.cancelButtonText=s;this.setTitle(i)}onOpen(){let{contentEl:r}=this;this.root=(0,yJr.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(TJ.default.createElement(lni,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.root.unmount()}};Zt();var bJr="Migrated Custom System Prompt";function cni(t,e){let r=t,n=1;for(;e.getAbstractFileByPath(b0(r));)n++,r=`${t} ${n}`;return r}function Kmt(t){return t.replace(/\r\n/g,`
|
||
`).replace(/\r/g,`
|
||
`)}async function _Jr(t,e,r){let n=y0(),o=`${n}/unsupported`;await xc(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 dni(t,e,r){try{let n=await t.read(e),o=UW(n,{trimStart:!1}),i=Kmt(o).replace(/^\n+/,""),a=Kmt(r).replace(/^\n+/,"");return i!==a?(Be(`Migration verification failed: content mismatch. Expected ${a.length} chars, got ${i.length} chars`),!1):!0}catch(n){return ne("Migration verification failed: unable to read back file",n),!1}}async function Gmt(t){let r=ae().userSystemPrompt;if(!r||r.trim().length===0){B("No legacy userSystemPrompt to migrate");return}try{B("Migrating legacy userSystemPrompt from settings to file system");let n=y0();await xc(n);let o=cni(bJr,t),i=b0(o);o!==bJr&&B(`Default name already exists, using unique name: "${o}"`);let a=Date.now(),s=Kmt(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 vJr.TFile))throw new Error("File not found after creation");if(await xJ(l,u),await dni(t,l,r)){Ue("defaultSystemPromptTitle",o);try{await IX()}catch(d){Be("Failed to reload prompts after migration:",d)}Ue("userSystemPrompt",""),B("Cleared legacy userSystemPrompt field"),new vl(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 _Jr(t,r,"content verification mismatch");try{await IX()}catch(f){Be("Failed to reload prompts after failed migration:",f)}Ue("userSystemPrompt",""),B("Cleared legacy userSystemPrompt field (saved to unsupported)"),new vl(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){ne("Failed to migrate legacy userSystemPrompt:",n);try{let o=await _Jr(t,r,n.message||String(n));Ue("userSystemPrompt",""),B("Cleared legacy userSystemPrompt field (saved to unsupported after error)"),new vl(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 ${y0()}
|
||
3. The prompt will be available immediately`,"Migration Failed","OK","").open()}catch(o){ne("Failed to save to unsupported folder:",o),Be("Preserving userSystemPrompt in settings for manual recovery"),new vl(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 ${y0()}
|
||
- Available disk space
|
||
- Vault is accessible
|
||
|
||
You can retry by reloading the plugin.`,"Migration Failed - Data Preserved","OK","").open()}}}Bc();Bc();qs();function xDe(){let[t]=Cv(),[e]=Oge(),[r]=r6();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"})()}_t();qs();iG();Bc();to();var $u=L(X());var Bm=L(X(),1);var vSs=!!(typeof window<"u"&&window.document&&window.document.createElement);function Cce(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var fni=L(X(),1);function wJr(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=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)}}}}var VD=L(X(),1),CJr=L(vr(),1);function xJr(t,e=[]){let r=[];function n(i,a){let s=VD.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=VD.useMemo(()=>m,Object.values(m));return(0,CJr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=VD.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=>VD.createContext(a));return function(s){let u=s?.[t]||i;return VD.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,pni(o,...e)]}function pni(...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 VD.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var _0=L(X(),1);var OJr=L(X(),1),ODe=globalThis?.document?OJr.useLayoutEffect:()=>{};var TDe=L(X(),1);var mni=_0[" useInsertionEffect ".trim().toString()]||ODe;function TJr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=hni({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=_0.useRef(t!==void 0);_0.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=_0.useCallback(c=>{if(s){let d=gni(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function hni({defaultProp:t,onChange:e}){let[r,n]=_0.useState(t),o=_0.useRef(r),i=_0.useRef(e);return mni(()=>{i.current=e},[e]),_0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function gni(t){return typeof t=="function"}var TSs=Symbol("RADIX:SYNC_STATE");var EJr=L(X(),1),yni=L(cu(),1);Vu();var PJr=L(vr(),1),bni=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],MJr=bni.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=EJr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,PJr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Ur=L(X(),1);var ISs=!!(typeof window<"u"&&window.document&&window.document.createElement);function Dc(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var OU=L(X(),1);var HD=L(X(),1),IJr=L(vr(),1);function RJr(t,e=[]){let r=[];function n(i,a){let s=HD.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=HD.useMemo(()=>m,Object.values(m));return(0,IJr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=HD.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=>HD.createContext(a));return function(s){let u=s?.[t]||i;return HD.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,_ni(o,...e)]}function _ni(...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 HD.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var NJr=L(X(),1);function AJr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function vni(...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)}}}}function Xmt(...t){return NJr.useCallback(vni(...t),t)}Vu();var EDe=L(vr(),1),wni=L(X(),1);var Sni=L(vr(),1);function TU(t){let e=t+"CollectionProvider",[r,n]=RJr(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=h=>{let{scope:y,children:g}=h,b=OU.default.useRef(null),_=OU.default.useRef(new Map).current;return(0,EDe.jsx)(o,{scope:y,itemMap:_,collectionRef:b,children:g})};a.displayName=e;let s=t+"CollectionSlot",u=Fn(s),l=OU.default.forwardRef((h,y)=>{let{scope:g,children:b}=h,_=i(s,g),w=Xmt(y,_.collectionRef);return(0,EDe.jsx)(u,{ref:w,children:b})});l.displayName=s;let c=t+"CollectionItemSlot",d="data-radix-collection-item",f=Fn(c),p=OU.default.forwardRef((h,y)=>{let{scope:g,children:b,..._}=h,w=OU.default.useRef(null),O=Xmt(y,w),T=i(c,g);return OU.default.useEffect(()=>(T.itemMap.set(w,{ref:w,..._}),()=>void T.itemMap.delete(w))),(0,EDe.jsx)(f,{[d]:"",ref:O,children:b})});p.displayName=c;function m(h){let y=i(t+"CollectionConsumer",h);return OU.default.useCallback(()=>{let b=y.collectionRef.current;if(!b)return[];let _=Array.from(b.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((T,P)=>_.indexOf(T.ref.current)-_.indexOf(P.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},m,n]}var DJr=L(X(),1);function jJr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Zmt(...t){return e=>{let r=!1,n=t.map(o=>{let i=jJr(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():jJr(t[o],null)}}}}function EU(...t){return DJr.useCallback(Zmt(...t),t)}var JD=L(X(),1),$Jr=L(vr(),1);function LJr(t,e=[]){let r=[];function n(i,a){let s=JD.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=JD.useMemo(()=>m,Object.values(m));return(0,$Jr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=JD.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=>JD.createContext(a));return function(s){let u=s?.[t]||i;return JD.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Cni(o,...e)]}function Cni(...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 JD.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var PDe=L(X(),1),xni=L(vr(),1),Oni=PDe.createContext(void 0);function FJr(t){let e=PDe.useContext(Oni);return t||e||"ltr"}var vc=L(X(),1);var VSs=!!(typeof window<"u"&&window.document&&window.document.createElement);function MDe(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var kJr=L(X(),1),qJr=L(cu(),1);Vu();var UJr=L(vr(),1),Tni=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ymt=Tni.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=kJr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,UJr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function BJr(t,e){t&&qJr.flushSync(()=>t.dispatchEvent(e))}var VJr=L(X(),1);function zJr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Eni(...t){return e=>{let r=!1,n=t.map(o=>{let i=zJr(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():zJr(t[o],null)}}}}function Qmt(...t){return VJr.useCallback(Eni(...t),t)}var NX=L(X(),1);function eht(t){let e=NX.useRef(t);return NX.useEffect(()=>{e.current=t}),NX.useMemo(()=>(...r)=>e.current?.(...r),[])}var JJr=L(X(),1);var jX=L(X(),1);function HJr(t){let e=jX.useRef(t);return jX.useEffect(()=>{e.current=t}),jX.useMemo(()=>(...r)=>e.current?.(...r),[])}function WJr(t,e=globalThis?.document){let r=HJr(t);JJr.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 rht=L(vr(),1),Pni="DismissableLayer",tht="dismissableLayer.update",Mni="dismissableLayer.pointerDownOutside",Ini="dismissableLayer.focusOutside",KJr,XJr=vc.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sx=vc.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=vc.useContext(XJr),[c,d]=vc.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=vc.useState({}),m=Qmt(e,P=>d(P)),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,O=Nni(P=>{let M=P.target,I=[...l.branches].some(j=>j.contains(M));!w||I||(o?.(P),a?.(P),P.defaultPrevented||s?.())},f),T=jni(P=>{let M=P.target;[...l.branches].some(j=>j.contains(M))||(i?.(P),a?.(P),P.defaultPrevented||s?.())},f);return WJr(P=>{b===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&s&&(P.preventDefault(),s()))},f),vc.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(KJr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),GJr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=KJr)}},[c,f,r,l]),vc.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),GJr())},[c,l]),vc.useEffect(()=>{let P=()=>p({});return document.addEventListener(tht,P),()=>document.removeEventListener(tht,P)},[]),(0,rht.jsx)(Ymt.div,{...u,ref:m,style:{pointerEvents:_?w?"auto":"none":void 0,...t.style},onFocusCapture:MDe(t.onFocusCapture,T.onFocusCapture),onBlurCapture:MDe(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:MDe(t.onPointerDownCapture,O.onPointerDownCapture)})});Sx.displayName=Pni;var Rni="DismissableLayerBranch",Ani=vc.forwardRef((t,e)=>{let r=vc.useContext(XJr),n=vc.useRef(null),o=Qmt(e,n);return vc.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,rht.jsx)(Ymt.div,{...t,ref:o})});Ani.displayName=Rni;function Nni(t,e=globalThis?.document){let r=eht(t),n=vc.useRef(!1),o=vc.useRef(()=>{});return vc.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){ZJr(Mni,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 jni(t,e=globalThis?.document){let r=eht(t),n=vc.useRef(!1);return vc.useEffect(()=>{let o=i=>{i.target&&!n.current&&ZJr(Ini,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 GJr(){let t=new CustomEvent(tht);document.dispatchEvent(t)}function ZJr(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?BJr(o,i):o.dispatchEvent(i)}var QJr=L(X(),1),nht=0;function PU(){QJr.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??YJr()),document.body.insertAdjacentElement("beforeend",t[1]??YJr()),nht++,()=>{nht===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),nht--}},[])}function YJr(){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 v0=L(X(),1);var t3r=L(X(),1);function e3r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Dni(...t){return e=>{let r=!1,n=t.map(o=>{let i=e3r(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():e3r(t[o],null)}}}}function r3r(...t){return t3r.useCallback(Dni(...t),t)}var n3r=L(X(),1),$ni=L(cu(),1);Vu();var o3r=L(vr(),1),Lni=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],i3r=Lni.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=n3r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,o3r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var DX=L(X(),1);function oht(t){let e=DX.useRef(t);return DX.useEffect(()=>{e.current=t}),DX.useMemo(()=>(...r)=>e.current?.(...r),[])}var c3r=L(vr(),1),iht="focusScope.autoFocusOnMount",aht="focusScope.autoFocusOnUnmount",a3r={bubbles:!1,cancelable:!0},Fni="FocusScope",WD=v0.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=v0.useState(null),l=oht(o),c=oht(i),d=v0.useRef(null),f=r3r(e,h=>u(h)),p=v0.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v0.useEffect(()=>{if(n){let b=function(T){if(p.paused||!s)return;let P=T.target;s.contains(P)?d.current=P:MU(d.current,{select:!0})},_=function(T){if(p.paused||!s)return;let P=T.relatedTarget;P!==null&&(s.contains(P)||MU(d.current,{select:!0}))},w=function(T){if(document.activeElement===document.body)for(let M of T)M.removedNodes.length>0&&MU(s)};var h=b,y=_,g=w;document.addEventListener("focusin",b),document.addEventListener("focusout",_);let O=new MutationObserver(w);return s&&O.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",_),O.disconnect()}}},[n,s,p.paused]),v0.useEffect(()=>{if(s){u3r.add(p);let h=document.activeElement;if(!s.contains(h)){let g=new CustomEvent(iht,a3r);s.addEventListener(iht,l),s.dispatchEvent(g),g.defaultPrevented||(kni(Vni(d3r(s)),{select:!0}),document.activeElement===h&&MU(s))}return()=>{s.removeEventListener(iht,l),setTimeout(()=>{let g=new CustomEvent(aht,a3r);s.addEventListener(aht,c),s.dispatchEvent(g),g.defaultPrevented||MU(h??document.body,{select:!0}),s.removeEventListener(aht,c),u3r.remove(p)},0)}}},[s,l,c,p]);let m=v0.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]=qni(b);_&&w?!h.shiftKey&&g===w?(h.preventDefault(),r&&MU(_,{select:!0})):h.shiftKey&&g===_&&(h.preventDefault(),r&&MU(w,{select:!0})):g===b&&h.preventDefault()}},[r,n,p.paused]);return(0,c3r.jsx)(i3r.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});WD.displayName=Fni;function kni(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(MU(n,{select:e}),document.activeElement!==r)return}function qni(t){let e=d3r(t),r=s3r(e,t),n=s3r(e.reverse(),t);return[r,n]}function d3r(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 s3r(t,e){for(let r of t)if(!Uni(r,{upTo:e}))return r}function Uni(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 Bni(t){return t instanceof HTMLInputElement&&"select"in t}function MU(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Bni(t)&&e&&t.select()}}var u3r=zni();function zni(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=l3r(t,e),t.unshift(e)},remove(e){t=l3r(t,e),t[0]?.resume()}}}function l3r(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Vni(t){return t.filter(e=>e.tagName!=="A")}var sht=L(X(),1);var f3r=L(X(),1),xce=globalThis?.document?f3r.useLayoutEffect:()=>{};var Hni=sht[" useId ".trim().toString()]||(()=>{}),Jni=0;function uht(t){let[e,r]=sht.useState(Hni());return xce(()=>{t||r(n=>n??String(Jni++))},[t]),t||(e?`radix-${e}`:"")}var H_=L(X(),1);var h3r=["top","right","bottom","left"];var mA=Math.min,Ab=Math.max,Tce=Math.round,Ece=Math.floor,Cx=t=>({x:t,y:t}),Wni={left:"right",right:"left",bottom:"top",top:"bottom"},Kni={start:"end",end:"start"};function RDe(t,e,r){return Ab(t,mA(e,r))}function hA(t,e){return typeof t=="function"?t(e):t}function gA(t){return t.split("-")[0]}function EJ(t){return t.split("-")[1]}function ADe(t){return t==="x"?"y":"x"}function NDe(t){return t==="y"?"height":"width"}var Gni=new Set(["top","bottom"]);function xx(t){return Gni.has(gA(t))?"y":"x"}function jDe(t){return ADe(xx(t))}function g3r(t,e,r){r===void 0&&(r=!1);let n=EJ(t),o=jDe(t),i=NDe(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=Oce(a)),[a,Oce(a)]}function y3r(t){let e=Oce(t);return[IDe(t),e,IDe(e)]}function IDe(t){return t.replace(/start|end/g,e=>Kni[e])}var p3r=["left","right"],m3r=["right","left"],Xni=["top","bottom"],Zni=["bottom","top"];function Yni(t,e,r){switch(t){case"top":case"bottom":return r?e?m3r:p3r:e?p3r:m3r;case"left":case"right":return e?Xni:Zni;default:return[]}}function b3r(t,e,r,n){let o=EJ(t),i=Yni(gA(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(IDe)))),i}function Oce(t){return t.replace(/left|right|bottom|top/g,e=>Wni[e])}function Qni(t){return{top:0,right:0,bottom:0,left:0,...t}}function lht(t){return typeof t!="number"?Qni(t):{top:t,right:t,bottom:t,left:t}}function PJ(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 _3r(t,e,r){let{reference:n,floating:o}=t,i=xx(e),a=jDe(e),s=NDe(a),u=gA(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(EJ(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var S3r=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}=_3r(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:O}=await g({x:c,y:d,initialPlacement:n,placement:f,strategy:o,middlewareData:p,rects:l,platform:a,elements:{reference:t,floating:e}});c=b??c,d=_??d,p={...p,[y]:{...p[y],...w}},O&&m<=50&&(m++,typeof O=="object"&&(O.placement&&(f=O.placement),O.rects&&(l=O.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:o}):O.rects),{x:c,y:d}=_3r(l,f,u)),h=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function $X(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}=hA(e,t),m=lht(p),y=s[f?d==="floating"?"reference":"floating":d],g=PJ(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},O=PJ(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:_,strategy:u}):b);return{top:(g.top-O.top+m.top)/w.y,bottom:(O.bottom-g.bottom+m.bottom)/w.y,left:(g.left-O.left+m.left)/w.x,right:(O.right-g.right+m.right)/w.x}}var C3r=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}=hA(t,e)||{};if(l==null)return{};let d=lht(c),f={x:r,y:n},p=jDe(o),m=NDe(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],O=f[p]-i.reference[p],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),P=T?T[_]:0;(!P||!await(a.isElement==null?void 0:a.isElement(T)))&&(P=s.floating[_]||i.floating[m]);let M=w/2-O/2,I=P/2-h[m]/2-1,j=mA(d[g],I),A=mA(d[b],I),k=j,V=P-h[m]-A,q=P/2-h[m]/2+M,J=RDe(k,q,V),K=!u.arrow&&EJ(o)!=null&&q!==J&&i.reference[m]/2-(q<k?j:A)-h[m]/2<0,ue=K?q<k?q-k:q-V:0;return{[p]:f[p]+ue,data:{[p]:J,centerOffset:q-J-ue,...K&&{alignmentOffset:ue}},reset:K}}});var x3r=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}=hA(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let g=gA(o),b=xx(s),_=gA(s)===s,w=await(u.isRTL==null?void 0:u.isRTL(l.floating)),O=f||(_||!h?[Oce(s)]:y3r(s)),T=m!=="none";!f&&T&&O.push(...b3r(s,h,m,w));let P=[s,...O],M=await $X(e,y),I=[],j=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&I.push(M[g]),d){let q=g3r(o,a,w);I.push(M[q[0]],M[q[1]])}if(j=[...j,{placement:o,overflows:I}],!I.every(q=>q<=0)){var A,k;let q=(((A=i.flip)==null?void 0:A.index)||0)+1,J=P[q];if(J&&(!(d==="alignment"?b!==xx(J):!1)||j.every(oe=>xx(oe.placement)===b?oe.overflows[0]>0:!0)))return{data:{index:q,overflows:j},reset:{placement:J}};let K=(k=j.filter(ue=>ue.overflows[0]<=0).sort((ue,oe)=>ue.overflows[1]-oe.overflows[1])[0])==null?void 0:k.placement;if(!K)switch(p){case"bestFit":{var V;let ue=(V=j.filter(oe=>{if(T){let G=xx(oe.placement);return G===b||G==="y"}return!0}).map(oe=>[oe.placement,oe.overflows.filter(G=>G>0).reduce((G,Y)=>G+Y,0)]).sort((oe,G)=>oe[1]-G[1])[0])==null?void 0:V[0];ue&&(K=ue);break}case"initialPlacement":K=s;break}if(o!==K)return{reset:{placement:K}}}return{}}}};function v3r(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function w3r(t){return h3r.some(e=>t[e]>=0)}var O3r=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=hA(t,e);switch(n){case"referenceHidden":{let i=await $X(e,{...o,elementContext:"reference"}),a=v3r(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:w3r(a)}}}case"escaped":{let i=await $X(e,{...o,altBoundary:!0}),a=v3r(i,r.floating);return{data:{escapedOffsets:a,escaped:w3r(a)}}}default:return{}}}}};var T3r=new Set(["left","top"]);async function eoi(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=gA(r),s=EJ(r),u=xx(r)==="y",l=T3r.has(a)?-1:1,c=i&&u?-1:1,d=hA(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 E3r=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 eoi(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}}}}},P3r=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}=hA(t,e),l={x:r,y:n},c=await $X(e,u),d=xx(gA(o)),f=ADe(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=RDe(b,p,_)}if(a){let y=d==="y"?"top":"left",g=d==="y"?"bottom":"right",b=m+c[y],_=m-c[g];m=RDe(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}}}}}},M3r=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}=hA(t,e),c={x:r,y:n},d=xx(o),f=ADe(d),p=c[f],m=c[d],h=hA(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,O=i.reference[f]+i.reference[_]-y.mainAxis;p<w?p=w:p>O&&(p=O)}if(l){var g,b;let _=f==="y"?"width":"height",w=T3r.has(gA(o)),O=i.reference[d]-i.floating[_]+(w&&((g=a.offset)==null?void 0:g[d])||0)+(w?0:y.crossAxis),T=i.reference[d]+i.reference[_]+(w?0:((b=a.offset)==null?void 0:b[d])||0)-(w?y.crossAxis:0);m<O?m=O:m>T&&(m=T)}return{[f]:p,[d]:m}}}},I3r=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}=hA(t,e),c=await $X(e,l),d=gA(o),f=EJ(o),p=xx(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=mA(h-c[y],b),O=mA(m-c[g],_),T=!e.middlewareData.shift,P=w,M=O;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(M=_),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(P=b),T&&!f){let j=Ab(c.left,0),A=Ab(c.right,0),k=Ab(c.top,0),V=Ab(c.bottom,0);p?M=m-2*(j!==0||A!==0?j+A:Ab(c.left,c.right)):P=h-2*(k!==0||V!==0?k+V:Ab(c.top,c.bottom))}await u({...e,availableWidth:M,availableHeight:P});let I=await a.getDimensions(s.floating);return m!==I.width||h!==I.height?{reset:{rects:!0}}:{}}}};function DDe(){return typeof window<"u"}function IJ(t){return A3r(t)?(t.nodeName||"").toLowerCase():"#document"}function V_(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ox(t){var e;return(e=(A3r(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function A3r(t){return DDe()?t instanceof Node||t instanceof V_(t).Node:!1}function w0(t){return DDe()?t instanceof Element||t instanceof V_(t).Element:!1}function Tx(t){return DDe()?t instanceof HTMLElement||t instanceof V_(t).HTMLElement:!1}function R3r(t){return!DDe()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof V_(t).ShadowRoot}var toi=new Set(["inline","contents"]);function LX(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=S0(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!toi.has(o)}var roi=new Set(["table","td","th"]);function N3r(t){return roi.has(IJ(t))}var noi=[":popover-open",":modal"];function Pce(t){return noi.some(e=>{try{return t.matches(e)}catch{return!1}})}var ooi=["transform","translate","scale","rotate","perspective"],ioi=["transform","translate","scale","rotate","perspective","filter"],aoi=["paint","layout","strict","content"];function $De(t){let e=LDe(),r=w0(t)?S0(t):t;return ooi.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)||ioi.some(n=>(r.willChange||"").includes(n))||aoi.some(n=>(r.contain||"").includes(n))}function j3r(t){let e=KD(t);for(;Tx(e)&&!RJ(e);){if($De(e))return e;if(Pce(e))return null;e=KD(e)}return null}function LDe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var soi=new Set(["html","body","#document"]);function RJ(t){return soi.has(IJ(t))}function S0(t){return V_(t).getComputedStyle(t)}function Mce(t){return w0(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function KD(t){if(IJ(t)==="html")return t;let e=t.assignedSlot||t.parentNode||R3r(t)&&t.host||Ox(t);return R3r(e)?e.host:e}function D3r(t){let e=KD(t);return RJ(e)?t.ownerDocument?t.ownerDocument.body:t.body:Tx(e)&&LX(e)?e:D3r(e)}function MJ(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=D3r(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=V_(o);if(i){let s=FDe(a);return e.concat(a,a.visualViewport||[],LX(o)?o:[],s&&r?MJ(s):[])}return e.concat(o,MJ(o,[],r))}function FDe(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function k3r(t){let e=S0(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=Tx(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=Tce(r)!==i||Tce(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function dht(t){return w0(t)?t:t.contextElement}function FX(t){let e=dht(t);if(!Tx(e))return Cx(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=k3r(e),a=(i?Tce(r.width):r.width)/n,s=(i?Tce(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var uoi=Cx(0);function q3r(t){let e=V_(t);return!LDe()||!e.visualViewport?uoi:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function loi(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==V_(t)?!1:e}function AJ(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=dht(t),a=Cx(1);e&&(n?w0(n)&&(a=FX(n)):a=FX(t));let s=loi(i,r,n)?q3r(i):Cx(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=V_(i),p=n&&w0(n)?V_(n):n,m=f,h=FDe(m);for(;h&&n&&p!==m;){let y=FX(h),g=h.getBoundingClientRect(),b=S0(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=V_(h),h=FDe(m)}}return PJ({width:c,height:d,x:u,y:l})}function kDe(t,e){let r=Mce(t).scrollLeft;return e?e.left+r:AJ(Ox(t)).left+r}function U3r(t,e){let r=t.getBoundingClientRect(),n=r.left+e.scrollLeft-kDe(t,r),o=r.top+e.scrollTop;return{x:n,y:o}}function coi(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=Ox(n),s=e?Pce(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=Cx(1),c=Cx(0),d=Tx(n);if((d||!d&&!i)&&((IJ(n)!=="body"||LX(a))&&(u=Mce(n)),Tx(n))){let p=AJ(n);l=FX(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?U3r(a,u):Cx(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 doi(t){return Array.from(t.getClientRects())}function foi(t){let e=Ox(t),r=Mce(t),n=t.ownerDocument.body,o=Ab(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Ab(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+kDe(t),s=-r.scrollTop;return S0(n).direction==="rtl"&&(a+=Ab(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}var $3r=25;function poi(t,e){let r=V_(t),n=Ox(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let c=LDe();(!c||c&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}let l=kDe(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<=$3r&&(i-=m)}else l<=$3r&&(i+=l);return{width:i,height:a,x:s,y:u}}var moi=new Set(["absolute","fixed"]);function hoi(t,e){let r=AJ(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=Tx(t)?FX(t):Cx(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 L3r(t,e,r){let n;if(e==="viewport")n=poi(t,r);else if(e==="document")n=foi(Ox(t));else if(w0(e))n=hoi(e,r);else{let o=q3r(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return PJ(n)}function B3r(t,e){let r=KD(t);return r===e||!w0(r)||RJ(r)?!1:S0(r).position==="fixed"||B3r(r,e)}function goi(t,e){let r=e.get(t);if(r)return r;let n=MJ(t,[],!1).filter(s=>w0(s)&&IJ(s)!=="body"),o=null,i=S0(t).position==="fixed",a=i?KD(t):t;for(;w0(a)&&!RJ(a);){let s=S0(a),u=$De(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&moi.has(o.position)||LX(a)&&!u&&B3r(t,a))?n=n.filter(c=>c!==a):o=s,a=KD(a)}return e.set(t,n),n}function yoi(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?Pce(e)?[]:goi(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=L3r(e,c,o);return l.top=Ab(d.top,l.top),l.right=mA(d.right,l.right),l.bottom=mA(d.bottom,l.bottom),l.left=Ab(d.left,l.left),l},L3r(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function boi(t){let{width:e,height:r}=k3r(t);return{width:e,height:r}}function _oi(t,e,r){let n=Tx(e),o=Ox(e),i=r==="fixed",a=AJ(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=Cx(0);function l(){u.x=kDe(o)}if(n||!n&&!i)if((IJ(e)!=="body"||LX(o))&&(s=Mce(e)),n){let p=AJ(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?U3r(o,s):Cx(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 cht(t){return S0(t).position==="static"}function F3r(t,e){if(!Tx(t)||S0(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return Ox(t)===r&&(r=r.ownerDocument.body),r}function z3r(t,e){let r=V_(t);if(Pce(t))return r;if(!Tx(t)){let o=KD(t);for(;o&&!RJ(o);){if(w0(o)&&!cht(o))return o;o=KD(o)}return r}let n=F3r(t,e);for(;n&&N3r(n)&&cht(n);)n=F3r(n,e);return n&&RJ(n)&&cht(n)&&!$De(n)?r:n||j3r(t)||r}var voi=async function(t){let e=this.getOffsetParent||z3r,r=this.getDimensions,n=await r(t.floating);return{reference:_oi(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function woi(t){return S0(t).direction==="rtl"}var V3r={convertOffsetParentRelativeRectToViewportRelativeRect:coi,getDocumentElement:Ox,getClippingRect:yoi,getOffsetParent:z3r,getElementRects:voi,getClientRects:doi,getDimensions:boi,getScale:FX,isElement:w0,isRTL:woi};function H3r(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Soi(t,e){let r=null,n,o=Ox(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=Ece(d),h=Ece(o.clientWidth-(c+f)),y=Ece(o.clientHeight-(d+p)),g=Ece(c),_={rootMargin:-m+"px "+-h+"px "+-y+"px "+-g+"px",threshold:Ab(0,mA(1,u))||1},w=!0;function O(T){let P=T[0].intersectionRatio;if(P!==u){if(!w)return a();P?a(!1,P):n=setTimeout(()=>{a(!1,1e-7)},1e3)}P===1&&!H3r(l,t.getBoundingClientRect())&&a(),w=!1}try{r=new IntersectionObserver(O,{..._,root:o.ownerDocument})}catch{r=new IntersectionObserver(O,_)}r.observe(t)}return a(!0),i}function fht(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=dht(t),c=o||i?[...l?MJ(l):[],...MJ(e)]:[];c.forEach(g=>{o&&g.addEventListener("scroll",r,{passive:!0}),i&&g.addEventListener("resize",r)});let d=l&&s?Soi(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?AJ(t):null;u&&y();function y(){let g=AJ(t);h&&!H3r(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 J3r=E3r;var W3r=P3r,K3r=x3r,G3r=I3r,X3r=O3r,pht=C3r;var Z3r=M3r,mht=(t,e,r)=>{let n=new Map,o={platform:V3r,...r},i={...o.platform,_c:n};return S3r(t,e,{...o,platform:i})};var am=L(X(),1),Q3r=L(X(),1),eWr=L(cu(),1),Coi=typeof document<"u",xoi=function(){},qDe=Coi?Q3r.useLayoutEffect:xoi;function UDe(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(!UDe(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)&&!UDe(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function tWr(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Y3r(t,e){let r=tWr(t);return Math.round(e*r)/r}function hht(t){let e=am.useRef(t);return qDe(()=>{e.current=t}),e}function rWr(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]=am.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=am.useState(n);UDe(f,n)||p(n);let[m,h]=am.useState(null),[y,g]=am.useState(null),b=am.useCallback(oe=>{oe!==T.current&&(T.current=oe,h(oe))},[]),_=am.useCallback(oe=>{oe!==P.current&&(P.current=oe,g(oe))},[]),w=i||m,O=a||y,T=am.useRef(null),P=am.useRef(null),M=am.useRef(c),I=u!=null,j=hht(u),A=hht(o),k=hht(l),V=am.useCallback(()=>{if(!T.current||!P.current)return;let oe={placement:e,strategy:r,middleware:f};A.current&&(oe.platform=A.current),mht(T.current,P.current,oe).then(G=>{let Y={...G,isPositioned:k.current!==!1};q.current&&!UDe(M.current,Y)&&(M.current=Y,eWr.flushSync(()=>{d(Y)}))})},[f,e,r,A,k]);qDe(()=>{l===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,d(oe=>({...oe,isPositioned:!1})))},[l]);let q=am.useRef(!1);qDe(()=>(q.current=!0,()=>{q.current=!1}),[]),qDe(()=>{if(w&&(T.current=w),O&&(P.current=O),w&&O){if(j.current)return j.current(w,O,V);V()}},[w,O,V,j,I]);let J=am.useMemo(()=>({reference:T,floating:P,setReference:b,setFloating:_}),[b,_]),K=am.useMemo(()=>({reference:w,floating:O}),[w,O]),ue=am.useMemo(()=>{let oe={position:r,left:0,top:0};if(!K.floating)return oe;let G=Y3r(K.floating,c.x),Y=Y3r(K.floating,c.y);return s?{...oe,transform:"translate("+G+"px, "+Y+"px)",...tWr(K.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:G,top:Y}},[r,s,K.floating,c.x,c.y]);return am.useMemo(()=>({...c,update:V,refs:J,elements:K,floatingStyles:ue}),[c,V,J,K,ue])}var Ooi=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?pht({element:n.current,padding:o}).fn(r):{}:n?pht({element:n,padding:o}).fn(r):{}}}},nWr=(t,e)=>({...J3r(t),options:[t,e]}),oWr=(t,e)=>({...W3r(t),options:[t,e]}),iWr=(t,e)=>({...Z3r(t),options:[t,e]}),aWr=(t,e)=>({...K3r(t),options:[t,e]}),sWr=(t,e)=>({...G3r(t),options:[t,e]});var uWr=(t,e)=>({...X3r(t),options:[t,e]});var lWr=(t,e)=>({...Ooi(t),options:[t,e]});var pWr=L(X(),1);var cWr=L(X(),1),Toi=L(cu(),1);Vu();var dWr=L(vr(),1),Eoi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fWr=Eoi.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=cWr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,dWr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var ght=L(vr(),1),Poi="Arrow",mWr=pWr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,ght.jsx)(fWr.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,ght.jsx)("polygon",{points:"0,0 30,0 15,10"})})});mWr.displayName=Poi;var hWr=mWr;var yWr=L(X(),1);function gWr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ioi(...t){return e=>{let r=!1,n=t.map(o=>{let i=gWr(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():gWr(t[o],null)}}}}function yht(...t){return yWr.useCallback(Ioi(...t),t)}var GD=L(X(),1),bWr=L(vr(),1);function _Wr(t,e=[]){let r=[];function n(i,a){let s=GD.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=GD.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=GD.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=>GD.createContext(a));return function(s){let u=s?.[t]||i;return GD.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Roi(o,...e)]}function Roi(...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 GD.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var vWr=L(X(),1),Aoi=L(cu(),1);Vu();var wWr=L(vr(),1),Noi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bht=Noi.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=vWr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,wWr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var kX=L(X(),1);function SWr(t){let e=kX.useRef(t);return kX.useEffect(()=>{e.current=t}),kX.useMemo(()=>(...r)=>e.current?.(...r),[])}var CWr=L(X(),1),Ice=globalThis?.document?CWr.useLayoutEffect:()=>{};var xWr=L(X(),1);function OWr(t){let[e,r]=xWr.useState(void 0);return Ice(()=>{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 IU=L(vr(),1);var _ht="Popper",[TWr,C0]=_Wr(_ht),[joi,EWr]=TWr(_ht),PWr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=H_.useState(null);return(0,IU.jsx)(joi,{scope:e,anchor:n,onAnchorChange:o,children:r})};PWr.displayName=_ht;var MWr="PopperAnchor",IWr=H_.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=EWr(MWr,r),a=H_.useRef(null),s=yht(e,a),u=H_.useRef(null);return H_.useEffect(()=>{let l=u.current;u.current=n?.current||a.current,l!==u.current&&i.onAnchorChange(u.current)}),n?null:(0,IU.jsx)(bht.div,{...o,ref:s})});IWr.displayName=MWr;var vht="PopperContent",[Doi,$oi]=TWr(vht),RWr=H_.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=EWr(vht,r),[g,b]=H_.useState(null),_=yht(e,R=>b(R)),[w,O]=H_.useState(null),T=OWr(w),P=T?.width??0,M=T?.height??0,I=n+(i!=="center"?"-"+i:""),j=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},A=Array.isArray(l)?l:[l],k=A.length>0,V={padding:j,boundary:A.filter(Foi),altBoundary:k},{refs:q,floatingStyles:J,placement:K,isPositioned:ue,middlewareData:oe}=rWr({strategy:"fixed",placement:I,whileElementsMounted:(...R)=>fht(...R,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[nWr({mainAxis:o+M,alignmentAxis:a}),u&&oWr({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?iWr():void 0,...V}),u&&aWr({...V}),sWr({...V,apply:({elements:R,rects:z,availableWidth:U,availableHeight:ee})=>{let{width:ce,height:ve}=z.reference,Oe=R.floating.style;Oe.setProperty("--radix-popper-available-width",`${U}px`),Oe.setProperty("--radix-popper-available-height",`${ee}px`),Oe.setProperty("--radix-popper-anchor-width",`${ce}px`),Oe.setProperty("--radix-popper-anchor-height",`${ve}px`)}}),w&&lWr({element:w,padding:s}),koi({arrowWidth:P,arrowHeight:M}),f&&uWr({strategy:"referenceHidden",...V})]}),[G,Y]=jWr(K),se=SWr(m);Ice(()=>{ue&&se?.()},[ue,se]);let ie=oe.arrow?.x,$=oe.arrow?.y,H=oe.arrow?.centerOffset!==0,[re,D]=H_.useState();return Ice(()=>{g&&D(window.getComputedStyle(g).zIndex)},[g]),(0,IU.jsx)("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...J,transform:ue?J.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:re,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(" "),...oe.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,IU.jsx)(Doi,{scope:r,placedSide:G,onArrowChange:O,arrowX:ie,arrowY:$,shouldHideArrow:H,children:(0,IU.jsx)(bht.div,{"data-side":G,"data-align":Y,...h,ref:_,style:{...h.style,animation:ue?void 0:"none"}})})})});RWr.displayName=vht;var AWr="PopperArrow",Loi={top:"bottom",right:"left",bottom:"top",left:"right"},NWr=H_.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=$oi(AWr,n),a=Loi[i.placedSide];return(0,IU.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,IU.jsx)(hWr,{...o,ref:r,style:{...o.style,display:"block"}})})});NWr.displayName=AWr;function Foi(t){return t!==null}var koi=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]=jWr(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 jWr(t){let[e,r="center"]=t.split("-");return[e,r]}var XD=PWr,ZD=IWr,RU=RWr,AU=NWr;var zDe=L(X(),1),qWr=L(cu(),1);var DWr=L(X(),1),qoi=L(cu(),1);Vu();var $Wr=L(vr(),1),Uoi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],LWr=Uoi.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=DWr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,$Wr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var FWr=L(X(),1),kWr=globalThis?.document?FWr.useLayoutEffect:()=>{};var UWr=L(vr(),1),Boi="Portal",Ex=zDe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=zDe.useState(!1);kWr(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?qWr.default.createPortal((0,UWr.jsx)(LWr.div,{...n,ref:e}),a):null});Ex.displayName=Boi;var J_=L(X(),1);var BWr=L(X(),1);function zoi(t,e){return BWr.useReducer((r,n)=>e[r][n]??r,t)}var qX=t=>{let{present:e,children:r}=t,n=Voi(e),o=typeof r=="function"?r({present:n.isPresent}):J_.Children.only(r),i=EU(n.ref,Hoi(o));return typeof r=="function"||n.isPresent?J_.cloneElement(o,{ref:i}):null};qX.displayName="Presence";function Voi(t){let[e,r]=J_.useState(),n=J_.useRef(null),o=J_.useRef(t),i=J_.useRef("none"),a=t?"mounted":"unmounted",[s,u]=zoi(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return J_.useEffect(()=>{let l=VDe(n.current);i.current=s==="mounted"?l:"none"},[s]),xce(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=VDe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),xce(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=VDe(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=VDe(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:J_.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function VDe(t){return t?.animationName||"none"}function Hoi(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 zWr=L(X(),1),VWr=L(cu(),1);Vu();var HWr=L(vr(),1),Joi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],UX=Joi.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=zWr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,HWr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function JWr(t,e){t&&VWr.flushSync(()=>t.dispatchEvent(e))}var Nh=L(X(),1);var cCs=!!(typeof window<"u"&&window.document&&window.document.createElement);function NJ(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var KWr=L(X(),1);function WWr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Woi(...t){return e=>{let r=!1,n=t.map(o=>{let i=WWr(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():WWr(t[o],null)}}}}function GWr(...t){return KWr.useCallback(Woi(...t),t)}var YD=L(X(),1),XWr=L(vr(),1);function ZWr(t,e=[]){let r=[];function n(i,a){let s=YD.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=YD.useMemo(()=>m,Object.values(m));return(0,XWr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=YD.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=>YD.createContext(a));return function(s){let u=s?.[t]||i;return YD.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Koi(o,...e)]}function Koi(...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 YD.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var wht=L(X(),1);var YWr=L(X(),1),HDe=globalThis?.document?YWr.useLayoutEffect:()=>{};var Goi=wht[" useId ".trim().toString()]||(()=>{}),Xoi=0;function QWr(t){let[e,r]=wht.useState(Goi());return HDe(()=>{t||r(n=>n??String(Xoi++))},[t]),t||(e?`radix-${e}`:"")}var e6r=L(X(),1),Zoi=L(cu(),1);Vu();var t6r=L(vr(),1),Yoi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sht=Yoi.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=e6r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,t6r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var BX=L(X(),1);function r6r(t){let e=BX.useRef(t);return BX.useEffect(()=>{e.current=t}),BX.useMemo(()=>(...r)=>e.current?.(...r),[])}var x0=L(X(),1);var JDe=L(X(),1);var Qoi=x0[" useInsertionEffect ".trim().toString()]||HDe;function n6r({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=eii({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=x0.useRef(t!==void 0);x0.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=x0.useCallback(c=>{if(s){let d=tii(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function eii({defaultProp:t,onChange:e}){let[r,n]=x0.useState(t),o=x0.useRef(r),i=x0.useRef(e);return Qoi(()=>{i.current=e},[e]),x0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function tii(t){return typeof t=="function"}var wCs=Symbol("RADIX:SYNC_STATE");var WDe=L(X(),1),rii=L(vr(),1),nii=WDe.createContext(void 0);function o6r(t){let e=WDe.useContext(nii);return t||e||"ltr"}var NU=L(vr(),1),Cht="rovingFocusGroup.onEntryFocus",oii={bubbles:!1,cancelable:!0},Rce="RovingFocusGroup",[xht,i6r,iii]=TU(Rce),[aii,Oht]=ZWr(Rce,[iii]),[sii,uii]=aii(Rce),a6r=Nh.forwardRef((t,e)=>(0,NU.jsx)(xht.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,NU.jsx)(xht.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,NU.jsx)(lii,{...t,ref:e})})}));a6r.displayName=Rce;var lii=Nh.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=Nh.useRef(null),p=GWr(e,f),m=o6r(i),[h,y]=n6r({prop:a,defaultProp:s??null,onChange:u,caller:Rce}),[g,b]=Nh.useState(!1),_=r6r(l),w=i6r(r),O=Nh.useRef(!1),[T,P]=Nh.useState(0);return Nh.useEffect(()=>{let M=f.current;if(M)return M.addEventListener(Cht,_),()=>M.removeEventListener(Cht,_)},[_]),(0,NU.jsx)(sii,{scope:r,orientation:n,dir:m,loop:o,currentTabStopId:h,onItemFocus:Nh.useCallback(M=>y(M),[y]),onItemShiftTab:Nh.useCallback(()=>b(!0),[]),onFocusableItemAdd:Nh.useCallback(()=>P(M=>M+1),[]),onFocusableItemRemove:Nh.useCallback(()=>P(M=>M-1),[]),children:(0,NU.jsx)(Sht.div,{tabIndex:g||T===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:NJ(t.onMouseDown,()=>{O.current=!0}),onFocus:NJ(t.onFocus,M=>{let I=!O.current;if(M.target===M.currentTarget&&I&&!g){let j=new CustomEvent(Cht,oii);if(M.currentTarget.dispatchEvent(j),!j.defaultPrevented){let A=w().filter(K=>K.focusable),k=A.find(K=>K.active),V=A.find(K=>K.id===h),J=[k,V,...A].filter(Boolean).map(K=>K.ref.current);l6r(J,c)}}O.current=!1}),onBlur:NJ(t.onBlur,()=>b(!1))})})}),s6r="RovingFocusGroupItem",u6r=Nh.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,children:a,...s}=t,u=QWr(),l=i||u,c=uii(s6r,r),d=c.currentTabStopId===l,f=i6r(r),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=c;return Nh.useEffect(()=>{if(n)return p(),()=>m()},[n,p,m]),(0,NU.jsx)(xht.ItemSlot,{scope:r,id:l,focusable:n,active:o,children:(0,NU.jsx)(Sht.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...s,ref:e,onMouseDown:NJ(t.onMouseDown,y=>{n?c.onItemFocus(l):y.preventDefault()}),onFocus:NJ(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:NJ(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){c.onItemShiftTab();return}if(y.target!==y.currentTarget)return;let g=fii(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?pii(_,w+1):_.slice(w+1)}setTimeout(()=>l6r(_))}}),children:typeof a=="function"?a({isCurrentTabStop:d,hasTabStop:h!=null}):a})})});u6r.displayName=s6r;var cii={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function dii(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function fii(t,e,r){let n=dii(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return cii[n]}function l6r(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function pii(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var c6r=a6r,d6r=u6r;Vu();var zX=L(X(),1);function KDe(t){let e=zX.useRef(t);return zX.useEffect(()=>{e.current=t}),zX.useMemo(()=>(...r)=>e.current?.(...r),[])}var hii=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},VX=new WeakMap,GDe=new WeakMap,XDe={},Tht=0,f6r=function(t){return t&&(t.host||f6r(t.parentNode))},gii=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=f6r(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})},yii=function(t,e,r,n){var o=gii(e,Array.isArray(t)?t:[t]);XDe[r]||(XDe[r]=new WeakMap);var i=XDe[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=(VX.get(f)||0)+1,y=(i.get(f)||0)+1;VX.set(f,h),i.set(f,y),a.push(f),h===1&&m&&GDe.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(),Tht++,function(){a.forEach(function(d){var f=VX.get(d)-1,p=i.get(d)-1;VX.set(d,f),i.set(d,p),f||(GDe.has(d)||d.removeAttribute(n),GDe.delete(d)),p||d.removeAttribute(r)}),Tht--,Tht||(VX=new WeakMap,VX=new WeakMap,GDe=new WeakMap,XDe={})}},jU=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||hii(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),yii(n,o,r,"aria-hidden")):function(){return null}};var W_=function(){return W_=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},W_.apply(this,arguments)};function ZDe(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 p6r(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 r$e=L(X());var $y=L(X());var jJ="right-scroll-bar-position",DJ="width-before-scroll-bar",Eht="with-scroll-bars-hidden",Pht="--removed-body-scroll-bar-size";function YDe(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var m6r=L(X());function h6r(t,e){var r=(0,m6r.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 QDe=L(X());var bii=typeof window<"u"?QDe.useLayoutEffect:QDe.useEffect,g6r=new WeakMap;function Mht(t,e){var r=h6r(e||null,function(n){return t.forEach(function(o){return YDe(o,n)})});return bii(function(){var n=g6r.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||YDe(s,null)}),i.forEach(function(s){o.has(s)||YDe(s,a)})}g6r.set(r,t)},[t]),r}function _ii(t){return t}function vii(t,e){e===void 0&&(e=_ii);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 Iht(t){t===void 0&&(t={});var e=vii(null);return e.options=W_({async:!0,ssr:!1},t),e}var y6r=L(X()),b6r=function(t){var e=t.sideCar,r=ZDe(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 y6r.createElement(n,W_({},r))};b6r.isSideCarExport=!0;function Rht(t,e){return t.useMedium(e),b6r}var e$e=Iht();var Aht=function(){},Ace=$y.forwardRef(function(t,e){var r=$y.useRef(null),n=$y.useState({onScrollCapture:Aht,onWheelCapture:Aht,onTouchMoveCapture:Aht}),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=ZDe(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=f,T=Mht([r,e]),P=W_(W_({},w),o);return $y.createElement($y.Fragment,null,c&&$y.createElement(O,{sideCar:e$e,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:i,allowPinchZoom:!!y,lockRef:r,gapMode:_}),a?$y.cloneElement($y.Children.only(s),W_(W_({},P),{ref:T})):$y.createElement(b,W_({},P,{className:u,ref:T}),s))});Ace.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ace.classNames={fullWidth:DJ,zeroRight:jJ};var wl=L(X());var JX=L(X());var w6r=L(X());var _6r;var v6r=function(){if(_6r)return _6r;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function wii(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=v6r();return e&&t.setAttribute("nonce",e),t}function Sii(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Cii(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Nht=function(){var t=0,e=null;return{add:function(r){t==0&&(e=wii())&&(Sii(e,r),Cii(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var jht=function(){var t=Nht();return function(e,r){w6r.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var Nce=function(){var t=jht(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var xii={left:0,top:0,right:0,gap:0},Dht=function(t){return parseInt(t||"",10)||0},Oii=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[Dht(r),Dht(n),Dht(o)]},$ht=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return xii;var e=Oii(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 Tii=Nce(),HX="data-scroll-locked",Eii=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(Eht,` {
|
||
overflow: hidden `).concat(n,`;
|
||
padding-right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
body[`).concat(HX,`] {
|
||
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(jJ,` {
|
||
right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
|
||
.`).concat(DJ,` {
|
||
margin-right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
|
||
.`).concat(jJ," .").concat(jJ,` {
|
||
right: 0 `).concat(n,`;
|
||
}
|
||
|
||
.`).concat(DJ," .").concat(DJ,` {
|
||
margin-right: 0 `).concat(n,`;
|
||
}
|
||
|
||
body[`).concat(HX,`] {
|
||
`).concat(Pht,": ").concat(s,`px;
|
||
}
|
||
`)},S6r=function(){var t=parseInt(document.body.getAttribute(HX)||"0",10);return isFinite(t)?t:0},Pii=function(){JX.useEffect(function(){return document.body.setAttribute(HX,(S6r()+1).toString()),function(){var t=S6r()-1;t<=0?document.body.removeAttribute(HX):document.body.setAttribute(HX,t.toString())}},[])},Lht=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;Pii();var i=JX.useMemo(function(){return $ht(o)},[o]);return JX.createElement(Tii,{styles:Eii(i,!e,o,r?"":"!important")})};var Fht=!1;if(typeof window<"u")try{jce=Object.defineProperty({},"passive",{get:function(){return Fht=!0,!0}}),window.addEventListener("test",jce,jce),window.removeEventListener("test",jce,jce)}catch{Fht=!1}var jce,$J=Fht?{passive:!1}:!1;var Mii=function(t){return t.tagName==="TEXTAREA"},C6r=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!Mii(t)&&r[e]==="visible")},Iii=function(t){return C6r(t,"overflowY")},Rii=function(t){return C6r(t,"overflowX")},kht=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=x6r(t,n);if(o){var i=O6r(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Aii=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Nii=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},x6r=function(t,e){return t==="v"?Iii(e):Rii(e)},O6r=function(t,e){return t==="v"?Aii(e):Nii(e)},jii=function(t,e){return t==="h"&&e==="rtl"?-1:1},T6r=function(t,e,r,n,o){var i=jii(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=O6r(t,s),m=p[0],h=p[1],y=p[2],g=h-y-i*m;(m||g)&&x6r(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 t$e=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},E6r=function(t){return[t.deltaX,t.deltaY]},P6r=function(t){return t&&"current"in t?t.current:t},Dii=function(t,e){return t[0]===e[0]&&t[1]===e[1]},$ii=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},Lii=0,WX=[];function M6r(t){var e=wl.useRef([]),r=wl.useRef([0,0]),n=wl.useRef(),o=wl.useState(Lii++)[0],i=wl.useState(Nce)[0],a=wl.useRef(t);wl.useEffect(function(){a.current=t},[t]),wl.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=p6r([t.lockRef.current],(t.shards||[]).map(P6r),!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=wl.useCallback(function(h,y){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var g=t$e(h),b=r.current,_="deltaX"in h?h.deltaX:b[0]-g[0],w="deltaY"in h?h.deltaY:b[1]-g[1],O,T=h.target,P=Math.abs(_)>Math.abs(w)?"h":"v";if("touches"in h&&P==="h"&&T.type==="range")return!1;var M=kht(P,T);if(!M)return!0;if(M?O=P:(O=P==="v"?"h":"v",M=kht(P,T)),!M)return!1;if(!n.current&&"changedTouches"in h&&(_||w)&&(n.current=O),!O)return!0;var I=n.current||O;return T6r(I,y,h,I==="h"?_:w,!0)},[]),u=wl.useCallback(function(h){var y=h;if(!(!WX.length||WX[WX.length-1]!==i)){var g="deltaY"in y?E6r(y):t$e(y),b=e.current.filter(function(O){return O.name===y.type&&(O.target===y.target||y.target===O.shadowParent)&&Dii(O.delta,g)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var _=(a.current.shards||[]).map(P6r).filter(Boolean).filter(function(O){return O.contains(y.target)}),w=_.length>0?s(y,_[0]):!a.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),l=wl.useCallback(function(h,y,g,b){var _={name:h,delta:y,target:g,should:b,shadowParent:Fii(g)};e.current.push(_),setTimeout(function(){e.current=e.current.filter(function(w){return w!==_})},1)},[]),c=wl.useCallback(function(h){r.current=t$e(h),n.current=void 0},[]),d=wl.useCallback(function(h){l(h.type,E6r(h),h.target,s(h,t.lockRef.current))},[]),f=wl.useCallback(function(h){l(h.type,t$e(h),h.target,s(h,t.lockRef.current))},[]);wl.useEffect(function(){return WX.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,$J),document.addEventListener("touchmove",u,$J),document.addEventListener("touchstart",c,$J),function(){WX=WX.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,$J),document.removeEventListener("touchmove",u,$J),document.removeEventListener("touchstart",c,$J)}},[]);var p=t.removeScrollBar,m=t.inert;return wl.createElement(wl.Fragment,null,m?wl.createElement(i,{styles:$ii(o)}):null,p?wl.createElement(Lht,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Fii(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var I6r=Rht(e$e,M6r);var R6r=r$e.forwardRef(function(t,e){return r$e.createElement(Ace,W_({},t,{ref:e,sideCar:I6r}))});R6r.classNames=Ace.classNames;var QD=R6r;var Oo=L(vr(),1),qht=["Enter"," "],kii=["ArrowDown","PageUp","Home"],N6r=["ArrowUp","PageDown","End"],qii=[...kii,...N6r],Uii={ltr:[...qht,"ArrowRight"],rtl:[...qht,"ArrowLeft"]},Bii={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Fce="Menu",[$ce,zii,Vii]=TU(Fce),[LJ,Uht]=LJr(Fce,[Vii,C0,Oht]),kce=C0(),j6r=Oht(),[D6r,DU]=LJ(Fce),[Hii,qce]=LJ(Fce),$6r=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=kce(e),[u,l]=Ur.useState(null),c=Ur.useRef(!1),d=KDe(i),f=FJr(o);return Ur.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,Oo.jsx)(XD,{...s,children:(0,Oo.jsx)(D6r,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,Oo.jsx)(Hii,{scope:e,onClose:Ur.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};$6r.displayName=Fce;var Jii="MenuAnchor",Bht=Ur.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=kce(r);return(0,Oo.jsx)(ZD,{...o,...n,ref:e})});Bht.displayName=Jii;var zht="MenuPortal",[Wii,L6r]=LJ(zht,{forceMount:void 0}),F6r=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=DU(zht,e);return(0,Oo.jsx)(Wii,{scope:e,forceMount:r,children:(0,Oo.jsx)(qX,{present:r||i.open,children:(0,Oo.jsx)(Ex,{asChild:!0,container:o,children:n})})})};F6r.displayName=zht;var O0="MenuContent",[Kii,Vht]=LJ(O0),k6r=Ur.forwardRef((t,e)=>{let r=L6r(O0,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=DU(O0,t.__scopeMenu),a=qce(O0,t.__scopeMenu);return(0,Oo.jsx)($ce.Provider,{scope:t.__scopeMenu,children:(0,Oo.jsx)(qX,{present:n||i.open,children:(0,Oo.jsx)($ce.Slot,{scope:t.__scopeMenu,children:a.modal?(0,Oo.jsx)(Gii,{...o,ref:e}):(0,Oo.jsx)(Xii,{...o,ref:e})})})})}),Gii=Ur.forwardRef((t,e)=>{let r=DU(O0,t.__scopeMenu),n=Ur.useRef(null),o=EU(e,n);return Ur.useEffect(()=>{let i=n.current;if(i)return jU(i)},[]),(0,Oo.jsx)(Hht,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Dc(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Xii=Ur.forwardRef((t,e)=>{let r=DU(O0,t.__scopeMenu);return(0,Oo.jsx)(Hht,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),Zii=Fn("MenuContent.ScrollLock"),Hht=Ur.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=DU(O0,r),g=qce(O0,r),b=kce(r),_=j6r(r),w=zii(r),[O,T]=Ur.useState(null),P=Ur.useRef(null),M=EU(e,P,y.onContentChange),I=Ur.useRef(0),j=Ur.useRef(""),A=Ur.useRef(0),k=Ur.useRef(null),V=Ur.useRef("right"),q=Ur.useRef(0),J=m?QD:Ur.Fragment,K=m?{as:Zii,allowPinchZoom:!0}:void 0,ue=G=>{let Y=j.current+G,se=w().filter(R=>!R.disabled),ie=document.activeElement,$=se.find(R=>R.ref.current===ie)?.textValue,H=se.map(R=>R.textValue),re=cai(H,Y,$),D=se.find(R=>R.textValue===re)?.ref.current;(function R(z){j.current=z,window.clearTimeout(I.current),z!==""&&(I.current=window.setTimeout(()=>R(""),1e3))})(Y),D&&setTimeout(()=>D.focus())};Ur.useEffect(()=>()=>window.clearTimeout(I.current),[]),PU();let oe=Ur.useCallback(G=>V.current===k.current?.side&&fai(G,k.current?.area),[]);return(0,Oo.jsx)(Kii,{scope:r,searchRef:j,onItemEnter:Ur.useCallback(G=>{oe(G)&&G.preventDefault()},[oe]),onItemLeave:Ur.useCallback(G=>{oe(G)||(P.current?.focus(),T(null))},[oe]),onTriggerLeave:Ur.useCallback(G=>{oe(G)&&G.preventDefault()},[oe]),pointerGraceTimerRef:A,onPointerGraceIntentChange:Ur.useCallback(G=>{k.current=G},[]),children:(0,Oo.jsx)(J,{...K,children:(0,Oo.jsx)(WD,{asChild:!0,trapped:o,onMountAutoFocus:Dc(i,G=>{G.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,Oo.jsx)(Sx,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,Oo.jsx)(c6r,{asChild:!0,..._,dir:g.dir,orientation:"vertical",loop:n,currentTabStopId:O,onCurrentTabStopIdChange:T,onEntryFocus:Dc(u,G=>{g.isUsingKeyboardRef.current||G.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,Oo.jsx)(RU,{role:"menu","aria-orientation":"vertical","data-state":t5r(y.open),"data-radix-menu-content":"",dir:g.dir,...b,...h,ref:M,style:{outline:"none",...h.style},onKeyDown:Dc(h.onKeyDown,G=>{let se=G.target.closest("[data-radix-menu-content]")===G.currentTarget,ie=G.ctrlKey||G.altKey||G.metaKey,$=G.key.length===1;se&&(G.key==="Tab"&&G.preventDefault(),!ie&&$&&ue(G.key));let H=P.current;if(G.target!==H||!qii.includes(G.key))return;G.preventDefault();let D=w().filter(R=>!R.disabled).map(R=>R.ref.current);N6r.includes(G.key)&&D.reverse(),uai(D)}),onBlur:Dc(t.onBlur,G=>{G.currentTarget.contains(G.target)||(window.clearTimeout(I.current),j.current="")}),onPointerMove:Dc(t.onPointerMove,Lce(G=>{let Y=G.target,se=q.current!==G.clientX;if(G.currentTarget.contains(Y)&&se){let ie=G.clientX>q.current?"right":"left";V.current=ie,q.current=G.clientX}}))})})})})})})});k6r.displayName=O0;var Yii="MenuGroup",Jht=Ur.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Oo.jsx)(UX.div,{role:"group",...n,ref:e})});Jht.displayName=Yii;var Qii="MenuLabel",q6r=Ur.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Oo.jsx)(UX.div,{...n,ref:e})});q6r.displayName=Qii;var n$e="MenuItem",A6r="menu.itemSelect",i$e=Ur.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=Ur.useRef(null),a=qce(n$e,t.__scopeMenu),s=Vht(n$e,t.__scopeMenu),u=EU(e,i),l=Ur.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(A6r,{bubbles:!0,cancelable:!0});d.addEventListener(A6r,p=>n?.(p),{once:!0}),JWr(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,Oo.jsx)(U6r,{...o,ref:u,disabled:r,onClick:Dc(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:Dc(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:Dc(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||qht.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});i$e.displayName=n$e;var U6r=Ur.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=Vht(n$e,r),s=j6r(r),u=Ur.useRef(null),l=EU(e,u),[c,d]=Ur.useState(!1),[f,p]=Ur.useState("");return Ur.useEffect(()=>{let m=u.current;m&&p((m.textContent??"").trim())},[i.children]),(0,Oo.jsx)($ce.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,Oo.jsx)(d6r,{asChild:!0,...s,focusable:!n,children:(0,Oo.jsx)(UX.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:Dc(t.onPointerMove,Lce(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Dc(t.onPointerLeave,Lce(m=>a.onItemLeave(m))),onFocus:Dc(t.onFocus,()=>d(!0)),onBlur:Dc(t.onBlur,()=>d(!1))})})})}),eai="MenuCheckboxItem",B6r=Ur.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,Oo.jsx)(W6r,{scope:t.__scopeMenu,checked:r,children:(0,Oo.jsx)(i$e,{role:"menuitemcheckbox","aria-checked":o$e(r)?"mixed":r,...o,ref:e,"data-state":Ght(r),onSelect:Dc(o.onSelect,()=>n?.(o$e(r)?!0:!r),{checkForDefaultPrevented:!1})})})});B6r.displayName=eai;var z6r="MenuRadioGroup",[tai,rai]=LJ(z6r,{value:void 0,onValueChange:()=>{}}),V6r=Ur.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=KDe(n);return(0,Oo.jsx)(tai,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,Oo.jsx)(Jht,{...o,ref:e})})});V6r.displayName=z6r;var H6r="MenuRadioItem",J6r=Ur.forwardRef((t,e)=>{let{value:r,...n}=t,o=rai(H6r,t.__scopeMenu),i=r===o.value;return(0,Oo.jsx)(W6r,{scope:t.__scopeMenu,checked:i,children:(0,Oo.jsx)(i$e,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":Ght(i),onSelect:Dc(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});J6r.displayName=H6r;var Wht="MenuItemIndicator",[W6r,nai]=LJ(Wht,{checked:!1}),K6r=Ur.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=nai(Wht,r);return(0,Oo.jsx)(qX,{present:n||o$e(i.checked)||i.checked===!0,children:(0,Oo.jsx)(UX.span,{...o,ref:e,"data-state":Ght(i.checked)})})});K6r.displayName=Wht;var oai="MenuSeparator",G6r=Ur.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,Oo.jsx)(UX.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});G6r.displayName=oai;var iai="MenuArrow",X6r=Ur.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=kce(r);return(0,Oo.jsx)(AU,{...o,...n,ref:e})});X6r.displayName=iai;var Kht="MenuSub",[aai,Z6r]=LJ(Kht),sai=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=DU(Kht,e),a=kce(e),[s,u]=Ur.useState(null),[l,c]=Ur.useState(null),d=KDe(o);return Ur.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,Oo.jsx)(XD,{...a,children:(0,Oo.jsx)(D6r,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,Oo.jsx)(aai,{scope:e,contentId:uht(),triggerId:uht(),trigger:s,onTriggerChange:u,children:r})})})};sai.displayName=Kht;var Dce="MenuSubTrigger",Y6r=Ur.forwardRef((t,e)=>{let r=DU(Dce,t.__scopeMenu),n=qce(Dce,t.__scopeMenu),o=Z6r(Dce,t.__scopeMenu),i=Vht(Dce,t.__scopeMenu),a=Ur.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=Ur.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return Ur.useEffect(()=>c,[c]),Ur.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,Oo.jsx)(Bht,{asChild:!0,...l,children:(0,Oo.jsx)(U6r,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":t5r(r.open),...t,ref:Zmt(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Dc(t.onPointerMove,Lce(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:Dc(t.onPointerLeave,Lce(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:Dc(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||Uii[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});Y6r.displayName=Dce;var Q6r="MenuSubContent",e5r=Ur.forwardRef((t,e)=>{let r=L6r(O0,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=DU(O0,t.__scopeMenu),a=qce(O0,t.__scopeMenu),s=Z6r(Q6r,t.__scopeMenu),u=Ur.useRef(null),l=EU(e,u);return(0,Oo.jsx)($ce.Provider,{scope:t.__scopeMenu,children:(0,Oo.jsx)(qX,{present:n||i.open,children:(0,Oo.jsx)($ce.Slot,{scope:t.__scopeMenu,children:(0,Oo.jsx)(Hht,{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:Dc(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Dc(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:Dc(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=Bii[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});e5r.displayName=Q6r;function t5r(t){return t?"open":"closed"}function o$e(t){return t==="indeterminate"}function Ght(t){return o$e(t)?"indeterminate":t?"checked":"unchecked"}function uai(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function lai(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function cai(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=lai(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 dai(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 fai(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return dai(r,e)}function Lce(t){return e=>e.pointerType==="mouse"?t(e):void 0}var r5r=$6r,n5r=Bht,o5r=F6r,i5r=k6r,a5r=Jht,s5r=q6r,u5r=i$e,l5r=B6r,c5r=V6r,d5r=J6r,f5r=K6r,p5r=G6r,m5r=X6r;var h5r=Y6r,g5r=e5r;var Xht=L(X(),1);var mai=Xht[" useId ".trim().toString()]||(()=>{}),hai=0;function Zht(t){let[e,r]=Xht.useState(mai());return ODe(()=>{t||r(n=>n??String(hai++))},[t]),t||(e?`radix-${e}`:"")}var jh=L(vr(),1),a$e="DropdownMenu",[gai,yOs]=xJr(a$e,[Uht]),Nb=Uht(),[yai,y5r]=gai(a$e),Uce=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=Nb(e),l=Bm.useRef(null),[c,d]=TJr({prop:o,defaultProp:i??!1,onChange:a,caller:a$e});return(0,jh.jsx)(yai,{scope:e,triggerId:Zht(),triggerRef:l,contentId:Zht(),open:c,onOpenChange:d,onOpenToggle:Bm.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,jh.jsx)(r5r,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};Uce.displayName=a$e;var b5r="DropdownMenuTrigger",Bce=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=y5r(b5r,r),a=Nb(r);return(0,jh.jsx)(n5r,{asChild:!0,...a,children:(0,jh.jsx)(MJr.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:SJr(e,i.triggerRef),onPointerDown:Cce(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:Cce(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});Bce.displayName=b5r;var bai="DropdownMenuPortal",_5r=t=>{let{__scopeDropdownMenu:e,...r}=t,n=Nb(e);return(0,jh.jsx)(o5r,{...n,...r})};_5r.displayName=bai;var v5r="DropdownMenuContent",w5r=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=y5r(v5r,r),i=Nb(r),a=Bm.useRef(!1);return(0,jh.jsx)(i5r,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:Cce(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:Cce(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)"}})});w5r.displayName=v5r;var _ai="DropdownMenuGroup",vai=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Nb(r);return(0,jh.jsx)(a5r,{...o,...n,ref:e})});vai.displayName=_ai;var wai="DropdownMenuLabel",S5r=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Nb(r);return(0,jh.jsx)(s5r,{...o,...n,ref:e})});S5r.displayName=wai;var Sai="DropdownMenuItem",C5r=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Nb(r);return(0,jh.jsx)(u5r,{...o,...n,ref:e})});C5r.displayName=Sai;var Cai="DropdownMenuCheckboxItem",x5r=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Nb(r);return(0,jh.jsx)(l5r,{...o,...n,ref:e})});x5r.displayName=Cai;var xai="DropdownMenuRadioGroup",Oai=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Nb(r);return(0,jh.jsx)(c5r,{...o,...n,ref:e})});Oai.displayName=xai;var Tai="DropdownMenuRadioItem",O5r=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Nb(r);return(0,jh.jsx)(d5r,{...o,...n,ref:e})});O5r.displayName=Tai;var Eai="DropdownMenuItemIndicator",T5r=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Nb(r);return(0,jh.jsx)(f5r,{...o,...n,ref:e})});T5r.displayName=Eai;var Pai="DropdownMenuSeparator",E5r=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Nb(r);return(0,jh.jsx)(p5r,{...o,...n,ref:e})});E5r.displayName=Pai;var Mai="DropdownMenuArrow",Iai=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Nb(r);return(0,jh.jsx)(m5r,{...o,...n,ref:e})});Iai.displayName=Mai;var Rai="DropdownMenuSubTrigger",P5r=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Nb(r);return(0,jh.jsx)(h5r,{...o,...n,ref:e})});P5r.displayName=Rai;var Aai="DropdownMenuSubContent",M5r=Bm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=Nb(r);return(0,jh.jsx)(g5r,{...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)"}})});M5r.displayName=Aai;var I5r=Uce,R5r=Bce,A5r=_5r,Yht=w5r;var Qht=S5r,egt=C5r,tgt=x5r;var rgt=O5r,ngt=T5r,ogt=E5r;var igt=P5r,agt=M5r;Jr();kn();var yA=I5r,bA=R5r;var jai=$u.forwardRef(({className:t,inset:e,children:r,...n},o)=>$u.createElement(igt,{ref:o,className:Te("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,$u.createElement(bm,{className:"tw-ml-auto"})));jai.displayName=igt.displayName;var Dai=$u.forwardRef(({className:t,...e},r)=>$u.createElement(agt,{ref:r,className:Te("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}));Dai.displayName=agt.displayName;var K_=$u.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>$u.createElement(A5r,{container:r??activeDocument.body},$u.createElement(Yht,{ref:o,sideOffset:e,className:Te("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})));K_.displayName=Yht.displayName;var Ii=$u.forwardRef(({className:t,inset:e,...r},n)=>$u.createElement(egt,{ref:n,className:Te("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}));Ii.displayName=egt.displayName;var $ai=$u.forwardRef(({className:t,children:e,checked:r,...n},o)=>$u.createElement(tgt,{ref:o,className:Te("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},$u.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},$u.createElement(ngt,null,$u.createElement(Hu,{className:"tw-size-4"}))),e));$ai.displayName=tgt.displayName;var Lai=$u.forwardRef(({className:t,children:e,...r},n)=>$u.createElement(rgt,{ref:n,className:Te("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},$u.createElement("span",{className:"tw-absolute tw-left-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},$u.createElement(ngt,null,$u.createElement(Fte,{className:"tw-size-2 tw-fill-current"}))),e));Lai.displayName=rgt.displayName;var Fai=$u.forwardRef(({className:t,inset:e,...r},n)=>$u.createElement(Qht,{ref:n,className:Te("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));Fai.displayName=Qht.displayName;var kai=$u.forwardRef(({className:t,...e},r)=>$u.createElement(ogt,{ref:r,className:Te("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));kai.displayName=ogt.displayName;var qai=({className:t,...e})=>$u.createElement("span",{className:Te("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});qai.displayName="DropdownMenuShortcut";Iue();var Jce=L(X());var Yo=L(X(),1);var xOs=!!(typeof window<"u"&&window.document&&window.document.createElement);function FJ(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var j5r=L(X(),1);function N5r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Uai(...t){return e=>{let r=!1,n=t.map(o=>{let i=N5r(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():N5r(t[o],null)}}}}function zce(...t){return j5r.useCallback(Uai(...t),t)}var e$=L(X(),1),D5r=L(vr(),1);function $5r(t,e=[]){let r=[];function n(i,a){let s=e$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=e$.useMemo(()=>m,Object.values(m));return(0,D5r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=e$.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=>e$.createContext(a));return function(s){let u=s?.[t]||i;return e$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Bai(o,...e)]}function Bai(...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 e$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var sgt=L(X(),1);var L5r=L(X(),1),kJ=globalThis?.document?L5r.useLayoutEffect:()=>{};var zai=sgt[" useId ".trim().toString()]||(()=>{}),Vai=0;function F5r(t){let[e,r]=sgt.useState(zai());return kJ(()=>{t||r(n=>n??String(Vai++))},[t]),t||(e?`radix-${e}`:"")}var G_=L(X(),1);var k5r=L(X(),1);function Hai(t,e){return k5r.useReducer((r,n)=>e[r][n]??r,t)}var u$e=t=>{let{present:e,children:r}=t,n=Jai(e),o=typeof r=="function"?r({present:n.isPresent}):G_.Children.only(r),i=zce(n.ref,Wai(o));return typeof r=="function"||n.isPresent?G_.cloneElement(o,{ref:i}):null};u$e.displayName="Presence";function Jai(t){let[e,r]=G_.useState(),n=G_.useRef(null),o=G_.useRef(t),i=G_.useRef("none"),a=t?"mounted":"unmounted",[s,u]=Hai(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return G_.useEffect(()=>{let l=s$e(n.current);i.current=s==="mounted"?l:"none"},[s]),kJ(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=s$e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),kJ(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=s$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=s$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:G_.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function s$e(t){return t?.animationName||"none"}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 q5r=L(X(),1),Kai=L(cu(),1);Vu();var U5r=L(vr(),1),Gai=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],B5r=Gai.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=q5r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,U5r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});Vu();var T0=L(X(),1);var l$e=L(X(),1);var Xai=T0[" useInsertionEffect ".trim().toString()]||kJ;function z5r({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Zai({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=T0.useRef(t!==void 0);T0.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=T0.useCallback(c=>{if(s){let d=Yai(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Zai({defaultProp:t,onChange:e}){let[r,n]=T0.useState(t),o=T0.useRef(r),i=T0.useRef(e);return Xai(()=>{i.current=e},[e]),T0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function Yai(t){return typeof t=="function"}var LOs=Symbol("RADIX:SYNC_STATE");var W5r=L(X(),1);var V5r=L(X(),1),Qai=L(cu(),1);Vu();var H5r=L(vr(),1),esi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],J5r=esi.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=V5r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,H5r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var K5r=L(vr(),1),ugt=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"}),tsi="VisuallyHidden",G5r=W5r.forwardRef((t,e)=>(0,K5r.jsx)(J5r.span,{...t,ref:e,style:{...ugt,...t.style}}));G5r.displayName=tsi;var X5r=G5r;var sm=L(vr(),1),[c$e,QOs]=$5r("Tooltip",[C0]),d$e=C0(),Z5r="TooltipProvider",nsi=700,lgt="tooltip.open",[osi,dgt]=c$e(Z5r),Y5r=t=>{let{__scopeTooltip:e,delayDuration:r=nsi,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,a=Yo.useRef(!0),s=Yo.useRef(!1),u=Yo.useRef(0);return Yo.useEffect(()=>{let l=u.current;return()=>window.clearTimeout(l)},[]),(0,sm.jsx)(osi,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:Yo.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:Yo.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:Yo.useCallback(l=>{s.current=l},[]),disableHoverableContent:o,children:i})};Y5r.displayName=Z5r;var Vce="Tooltip",[isi,Hce]=c$e(Vce),Q5r=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=dgt(Vce,t.__scopeTooltip),l=d$e(e),[c,d]=Yo.useState(null),f=F5r(),p=Yo.useRef(0),m=a??u.disableHoverableContent,h=s??u.delayDuration,y=Yo.useRef(!1),[g,b]=z5r({prop:n,defaultProp:o??!1,onChange:P=>{P?(u.onOpen(),document.dispatchEvent(new CustomEvent(lgt))):u.onClose(),i?.(P)},caller:Vce}),_=Yo.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),w=Yo.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y.current=!1,b(!0)},[b]),O=Yo.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),T=Yo.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{y.current=!0,b(!0),p.current=0},h)},[h,b]);return Yo.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,sm.jsx)(XD,{...l,children:(0,sm.jsx)(isi,{scope:e,contentId:f,open:g,stateAttribute:_,trigger:c,onTriggerChange:d,onTriggerEnter:Yo.useCallback(()=>{u.isOpenDelayedRef.current?T():w()},[u.isOpenDelayedRef,T,w]),onTriggerLeave:Yo.useCallback(()=>{m?O():(window.clearTimeout(p.current),p.current=0)},[O,m]),onOpen:w,onClose:O,disableHoverableContent:m,children:r})})};Q5r.displayName=Vce;var cgt="TooltipTrigger",eKr=Yo.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=Hce(cgt,r),i=dgt(cgt,r),a=d$e(r),s=Yo.useRef(null),u=zce(e,s,o.onTriggerChange),l=Yo.useRef(!1),c=Yo.useRef(!1),d=Yo.useCallback(()=>l.current=!1,[]);return Yo.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,sm.jsx)(ZD,{asChild:!0,...a,children:(0,sm.jsx)(B5r.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:FJ(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:FJ(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:FJ(t.onPointerDown,()=>{o.open&&o.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:FJ(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:FJ(t.onBlur,o.onClose),onClick:FJ(t.onClick,o.onClose)})})});eKr.displayName=cgt;var fgt="TooltipPortal",[asi,ssi]=c$e(fgt,{forceMount:void 0}),tKr=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=Hce(fgt,e);return(0,sm.jsx)(asi,{scope:e,forceMount:r,children:(0,sm.jsx)(u$e,{present:r||i.open,children:(0,sm.jsx)(Ex,{asChild:!0,container:o,children:n})})})};tKr.displayName=fgt;var KX="TooltipContent",rKr=Yo.forwardRef((t,e)=>{let r=ssi(KX,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=Hce(KX,t.__scopeTooltip);return(0,sm.jsx)(u$e,{present:n||a.open,children:a.disableHoverableContent?(0,sm.jsx)(nKr,{side:o,...i,ref:e}):(0,sm.jsx)(usi,{side:o,...i,ref:e})})}),usi=Yo.forwardRef((t,e)=>{let r=Hce(KX,t.__scopeTooltip),n=dgt(KX,t.__scopeTooltip),o=Yo.useRef(null),i=zce(e,o),[a,s]=Yo.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=Yo.useCallback(()=>{s(null),d(!1)},[d]),p=Yo.useCallback((m,h)=>{let y=m.currentTarget,g={x:m.clientX,y:m.clientY},b=psi(g,y.getBoundingClientRect()),_=msi(g,b),w=hsi(h.getBoundingClientRect()),O=ysi([..._,...w]);s(O),d(!0)},[d]);return Yo.useEffect(()=>()=>f(),[f]),Yo.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]),Yo.useEffect(()=>{if(a){let m=h=>{let y=h.target,g={x:h.clientX,y:h.clientY},b=u?.contains(y)||c?.contains(y),_=!gsi(g,a);b?f():_&&(f(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[u,c,a,l,f]),(0,sm.jsx)(nKr,{...t,ref:i})}),[lsi,csi]=c$e(Vce,{isInside:!1}),dsi=Xjt("TooltipContent"),nKr=Yo.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=Hce(KX,r),l=d$e(r),{onClose:c}=u;return Yo.useEffect(()=>(document.addEventListener(lgt,c),()=>document.removeEventListener(lgt,c)),[c]),Yo.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,sm.jsx)(Sx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,sm.jsxs)(RU,{"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,sm.jsx)(dsi,{children:n}),(0,sm.jsx)(lsi,{scope:r,isInside:!0,children:(0,sm.jsx)(X5r,{id:u.contentId,role:"tooltip",children:o||n})})]})})});rKr.displayName=KX;var oKr="TooltipArrow",fsi=Yo.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=d$e(r);return csi(oKr,r).isInside?null:(0,sm.jsx)(AU,{...o,...n,ref:e})});fsi.displayName=oKr;function psi(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 msi(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 hsi(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 gsi(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 ysi(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),bsi(e)}function bsi(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=Y5r,iKr=Q5r,aKr=eKr,sKr=tKr,pgt=rKr;kn();var jb=f$e,pn=iKr,mn=aKr,sn=Jce.forwardRef(({className:t,sideOffset:e=4,...r},n)=>Jce.createElement(sKr,{container:activeDocument.body},Jce.createElement(pgt,{ref:n,sideOffset:e,className:Te("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})));sn.displayName=pgt.displayName;Or();_t();Nv();ot();NTe();xie();Jr();var Db=require("obsidian"),dr=L(X());var Mn=L(X());Jr();to();var GX=L(X());to();Jr();var XX=({value:t,onChange:e,placeholder:r="Search..."})=>GX.default.createElement("div",{className:"tw-relative"},GX.default.createElement(Zo,{type:"text",placeholder:r,value:t,onChange:n=>e(n.target.value),className:"tw-pr-10"}),t&&GX.default.createElement(ge,{variant:"secondary",onClick:()=>e(""),className:"tw-absolute tw-right-8 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-rounded-full tw-p-0 tw-transition-colors","aria-label":"Clear search"},GX.default.createElement(IO,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),GX.default.createElement(r4,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}));var Gce=L(X());var Ql=L(X(),1);var aTs=!!(typeof window<"u"&&window.document&&window.document.createElement);function ZX(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var cKr=L(X(),1);function lKr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function _si(...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 Wce(...t){return cKr.useCallback(_si(...t),t)}var t$=L(X(),1),dKr=L(vr(),1);function fKr(t,e=[]){let r=[];function n(i,a){let s=t$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=t$.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=t$.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=>t$.createContext(a));return function(s){let u=s?.[t]||i;return t$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,vsi(o,...e)]}function vsi(...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 t$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var mgt=L(X(),1);var pKr=L(X(),1),qJ=globalThis?.document?pKr.useLayoutEffect:()=>{};var wsi=mgt[" useId ".trim().toString()]||(()=>{}),Ssi=0;function mKr(t){let[e,r]=mgt.useState(wsi());return qJ(()=>{t||r(n=>n??String(Ssi++))},[t]),t||(e?`radix-${e}`:"")}var X_=L(X(),1);var hKr=L(X(),1);function Csi(t,e){return hKr.useReducer((r,n)=>e[r][n]??r,t)}var m$e=t=>{let{present:e,children:r}=t,n=xsi(e),o=typeof r=="function"?r({present:n.isPresent}):X_.Children.only(r),i=Wce(n.ref,Osi(o));return typeof r=="function"||n.isPresent?X_.cloneElement(o,{ref:i}):null};m$e.displayName="Presence";function xsi(t){let[e,r]=X_.useState(),n=X_.useRef(null),o=X_.useRef(t),i=X_.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 X_.useEffect(()=>{let l=p$e(n.current);i.current=s==="mounted"?l:"none"},[s]),qJ(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=p$e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),qJ(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=p$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=p$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:X_.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function p$e(t){return t?.animationName||"none"}function Osi(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 gKr=L(X(),1),Tsi=L(cu(),1);Vu();var yKr=L(vr(),1),Esi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hgt=Esi.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=gKr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,yKr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});Vu();var E0=L(X(),1);var h$e=L(X(),1);var Psi=E0[" useInsertionEffect ".trim().toString()]||qJ;function bKr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Msi({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=E0.useRef(t!==void 0);E0.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=E0.useCallback(c=>{if(s){let d=Isi(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Msi({defaultProp:t,onChange:e}){let[r,n]=E0.useState(t),o=E0.useRef(r),i=E0.useRef(e);return Psi(()=>{i.current=e},[e]),E0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function Isi(t){return typeof t=="function"}var _Ts=Symbol("RADIX:SYNC_STATE");var um=L(vr(),1),g$e="Popover",[_Kr,$Ts]=fKr(g$e,[C0]),Kce=C0(),[Rsi,$U]=_Kr(g$e),vKr=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=Kce(e),u=Ql.useRef(null),[l,c]=Ql.useState(!1),[d,f]=bKr({prop:n,defaultProp:o??!1,onChange:i,caller:g$e});return(0,um.jsx)(XD,{...s,children:(0,um.jsx)(Rsi,{scope:e,contentId:mKr(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:Ql.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Ql.useCallback(()=>c(!0),[]),onCustomAnchorRemove:Ql.useCallback(()=>c(!1),[]),modal:a,children:r})})};vKr.displayName=g$e;var wKr="PopoverAnchor",Asi=Ql.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=$U(wKr,r),i=Kce(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return Ql.useEffect(()=>(a(),()=>s()),[a,s]),(0,um.jsx)(ZD,{...i,...n,ref:e})});Asi.displayName=wKr;var SKr="PopoverTrigger",CKr=Ql.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=$U(SKr,r),i=Kce(r),a=Wce(e,o.triggerRef),s=(0,um.jsx)(hgt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":PKr(o.open),...n,ref:a,onClick:ZX(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,um.jsx)(ZD,{asChild:!0,...i,children:s})});CKr.displayName=SKr;var ggt="PopoverPortal",[Nsi,jsi]=_Kr(ggt,{forceMount:void 0}),xKr=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=$U(ggt,e);return(0,um.jsx)(Nsi,{scope:e,forceMount:r,children:(0,um.jsx)(m$e,{present:r||i.open,children:(0,um.jsx)(Ex,{asChild:!0,container:o,children:n})})})};xKr.displayName=ggt;var YX="PopoverContent",OKr=Ql.forwardRef((t,e)=>{let r=jsi(YX,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=$U(YX,t.__scopePopover);return(0,um.jsx)(m$e,{present:n||i.open,children:i.modal?(0,um.jsx)($si,{...o,ref:e}):(0,um.jsx)(Lsi,{...o,ref:e})})});OKr.displayName=YX;var Dsi=Fn("PopoverContent.RemoveScroll"),$si=Ql.forwardRef((t,e)=>{let r=$U(YX,t.__scopePopover),n=Ql.useRef(null),o=Wce(e,n),i=Ql.useRef(!1);return Ql.useEffect(()=>{let a=n.current;if(a)return jU(a)},[]),(0,um.jsx)(QD,{as:Dsi,allowPinchZoom:!0,children:(0,um.jsx)(TKr,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ZX(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:ZX(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:ZX(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Lsi=Ql.forwardRef((t,e)=>{let r=$U(YX,t.__scopePopover),n=Ql.useRef(!1),o=Ql.useRef(!1);return(0,um.jsx)(TKr,{...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()}})}),TKr=Ql.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=$U(YX,r),p=Kce(r);return PU(),(0,um.jsx)(WD,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,um.jsx)(Sx,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,um.jsx)(RU,{"data-state":PKr(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)"}})})})}),EKr="PopoverClose",Fsi=Ql.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=$U(EKr,r);return(0,um.jsx)(hgt.button,{type:"button",...n,ref:e,onClick:ZX(t.onClick,()=>o.onOpenChange(!1))})});Fsi.displayName=EKr;var ksi="PopoverArrow",qsi=Ql.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=Kce(r);return(0,um.jsx)(AU,{...o,...n,ref:e})});qsi.displayName=ksi;function PKr(t){return t?"open":"closed"}var MKr=vKr;var IKr=CKr,RKr=xKr,ygt=OKr;kn();var LU=MKr,FU=IKr;var r$=Gce.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>Gce.createElement(RKr,{container:n??activeDocument.body},Gce.createElement(ygt,{ref:i,align:e,sideOffset:r,className:Te("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})));r$.displayName=ygt.displayName;var vA=L(X());var en=L(X(),1);var AKr=L(X(),1),Bsi=L(cu(),1);Vu();var NKr=L(vr(),1),zsi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],QX=zsi.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=AKr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,NKr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Z_=L(X(),1);var DKr=L(X(),1);function jKr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Vsi(...t){return e=>{let r=!1,n=t.map(o=>{let i=jKr(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():jKr(t[o],null)}}}}function n$(...t){return DKr.useCallback(Vsi(...t),t)}var $Kr=L(X(),1),Xce=globalThis?.document?$Kr.useLayoutEffect:()=>{};var LKr=L(X(),1);function Hsi(t,e){return LKr.useReducer((r,n)=>e[r][n]??r,t)}var eZ=t=>{let{present:e,children:r}=t,n=Jsi(e),o=typeof r=="function"?r({present:n.isPresent}):Z_.Children.only(r),i=n$(n.ref,Wsi(o));return typeof r=="function"||n.isPresent?Z_.cloneElement(o,{ref:i}):null};eZ.displayName="Presence";function Jsi(t){let[e,r]=Z_.useState(),n=Z_.useRef(null),o=Z_.useRef(t),i=Z_.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 Z_.useEffect(()=>{let l=y$e(n.current);i.current=s==="mounted"?l:"none"},[s]),Xce(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=y$e(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),Xce(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=y$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=y$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:Z_.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function y$e(t){return t?.animationName||"none"}function Wsi(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 o$=L(X(),1),FKr=L(vr(),1);function kKr(t,e=[]){let r=[];function n(i,a){let s=o$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=o$.useMemo(()=>m,Object.values(m));return(0,FKr.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=o$.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=>o$.createContext(a));return function(s){let u=s?.[t]||i;return o$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Ksi(o,...e)]}function Ksi(...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 o$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var tZ=L(X(),1);function kU(t){let e=tZ.useRef(t);return tZ.useEffect(()=>{e.current=t}),tZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var b$e=L(X(),1),Gsi=L(vr(),1),Xsi=b$e.createContext(void 0);function qKr(t){let e=b$e.useContext(Xsi);return t||e||"ltr"}function qU(t,[e,r]){return Math.min(r,Math.max(e,t))}var YTs=!!(typeof window<"u"&&window.document&&window.document.createElement);function UU(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var BKr=L(X(),1),Vs=L(vr(),1);function Zsi(t,e){return BKr.useReducer((r,n)=>e[r][n]??r,t)}var bgt="ScrollArea",[zKr,lEs]=kKr(bgt),[Ysi,P0]=zKr(bgt),VKr=en.forwardRef((t,e)=>{let{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=t,[s,u]=en.useState(null),[l,c]=en.useState(null),[d,f]=en.useState(null),[p,m]=en.useState(null),[h,y]=en.useState(null),[g,b]=en.useState(0),[_,w]=en.useState(0),[O,T]=en.useState(!1),[P,M]=en.useState(!1),I=n$(e,A=>u(A)),j=qKr(o);return(0,Vs.jsx)(Ysi,{scope:r,type:n,dir:j,scrollHideDelay:i,scrollArea:s,viewport:l,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:O,onScrollbarXEnabledChange:T,scrollbarY:h,onScrollbarYChange:y,scrollbarYEnabled:P,onScrollbarYEnabledChange:M,onCornerWidthChange:b,onCornerHeightChange:w,children:(0,Vs.jsx)(QX.div,{dir:j,...a,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":_+"px",...t.style}})})});VKr.displayName=bgt;var HKr="ScrollAreaViewport",JKr=en.forwardRef((t,e)=>{let{__scopeScrollArea:r,children:n,nonce:o,...i}=t,a=P0(HKr,r),s=en.useRef(null),u=n$(e,s,a.onViewportChange);return(0,Vs.jsxs)(Vs.Fragment,{children:[(0,Vs.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,Vs.jsx)(QX.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,Vs.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});JKr.displayName=HKr;var _A="ScrollAreaScrollbar",w$e=en.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=P0(_A,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,s=t.orientation==="horizontal";return en.useEffect(()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)}),[s,i,a]),o.type==="hover"?(0,Vs.jsx)(Qsi,{...n,ref:e,forceMount:r}):o.type==="scroll"?(0,Vs.jsx)(eui,{...n,ref:e,forceMount:r}):o.type==="auto"?(0,Vs.jsx)(WKr,{...n,ref:e,forceMount:r}):o.type==="always"?(0,Vs.jsx)(_gt,{...n,ref:e}):null});w$e.displayName=_A;var Qsi=en.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=P0(_A,t.__scopeScrollArea),[i,a]=en.useState(!1);return en.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,Vs.jsx)(eZ,{present:r||i,children:(0,Vs.jsx)(WKr,{"data-state":i?"visible":"hidden",...n,ref:e})})}),eui=en.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=P0(_A,t.__scopeScrollArea),i=t.orientation==="horizontal",a=C$e(()=>u("SCROLL_END"),100),[s,u]=Zsi("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 en.useEffect(()=>{if(s==="idle"){let l=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,o.scrollHideDelay,u]),en.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,Vs.jsx)(eZ,{present:r||s!=="hidden",children:(0,Vs.jsx)(_gt,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:UU(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:UU(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),WKr=en.forwardRef((t,e)=>{let r=P0(_A,t.__scopeScrollArea),{forceMount:n,...o}=t,[i,a]=en.useState(!1),s=t.orientation==="horizontal",u=C$e(()=>{if(r.viewport){let l=r.viewport.offsetWidth<r.viewport.scrollWidth,c=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?l:c)}},10);return rZ(r.viewport,u),rZ(r.content,u),(0,Vs.jsx)(eZ,{present:n||i,children:(0,Vs.jsx)(_gt,{"data-state":i?"visible":"hidden",...o,ref:e})})}),_gt=en.forwardRef((t,e)=>{let{orientation:r="vertical",...n}=t,o=P0(_A,t.__scopeScrollArea),i=en.useRef(null),a=en.useRef(0),[s,u]=en.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=ZKr(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 aui(f,a.current,s,p)}return r==="horizontal"?(0,Vs.jsx)(tui,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollLeft,p=UKr(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,Vs.jsx)(rui,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollTop,p=UKr(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}),tui=en.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=P0(_A,t.__scopeScrollArea),[a,s]=en.useState(),u=en.useRef(null),l=n$(e,u,i.onScrollbarXChange);return en.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Vs.jsx)(GKr,{"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":S$e(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),QKr(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:v$e(a.paddingLeft),paddingEnd:v$e(a.paddingRight)}})}})}),rui=en.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=P0(_A,t.__scopeScrollArea),[a,s]=en.useState(),u=en.useRef(null),l=n$(e,u,i.onScrollbarYChange);return en.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Vs.jsx)(GKr,{"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":S$e(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),QKr(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:v$e(a.paddingTop),paddingEnd:v$e(a.paddingBottom)}})}})}),[nui,KKr]=zKr(_A),GKr=en.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=P0(_A,r),[m,h]=en.useState(null),y=n$(e,I=>h(I)),g=en.useRef(null),b=en.useRef(""),_=p.viewport,w=n.content-n.viewport,O=kU(c),T=kU(u),P=C$e(d,10);function M(I){if(g.current){let j=I.clientX-g.current.left,A=I.clientY-g.current.top;l({x:j,y:A})}}return en.useEffect(()=>{let I=j=>{let A=j.target;m?.contains(A)&&O(j,w)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[_,m,w,O]),en.useEffect(T,[n,T]),rZ(m,P),rZ(p.content,P),(0,Vs.jsx)(nui,{scope:r,scrollbar:m,hasThumb:o,onThumbChange:kU(i),onThumbPointerUp:kU(a),onThumbPositionChange:T,onThumbPointerDown:kU(s),children:(0,Vs.jsx)(QX.div,{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:UU(t.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),g.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),M(I))}),onPointerMove:UU(t.onPointerMove,M),onPointerUp:UU(t.onPointerUp,I=>{let j=I.target;j.hasPointerCapture(I.pointerId)&&j.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),g.current=null})})})}),_$e="ScrollAreaThumb",vgt=en.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=KKr(_$e,t.__scopeScrollArea);return(0,Vs.jsx)(eZ,{present:r||o.hasThumb,children:(0,Vs.jsx)(oui,{ref:e,...n})})}),oui=en.forwardRef((t,e)=>{let{__scopeScrollArea:r,style:n,...o}=t,i=P0(_$e,r),a=KKr(_$e,r),{onThumbPositionChange:s}=a,u=n$(e,d=>a.onThumbChange(d)),l=en.useRef(void 0),c=C$e(()=>{l.current&&(l.current(),l.current=void 0)},100);return en.useEffect(()=>{let d=i.viewport;if(d){let f=()=>{if(c(),!l.current){let p=sui(d,s);l.current=p,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),(0,Vs.jsx)(QX.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:UU(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:UU(t.onPointerUp,a.onThumbPointerUp)})});vgt.displayName=_$e;var wgt="ScrollAreaCorner",XKr=en.forwardRef((t,e)=>{let r=P0(wgt,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?(0,Vs.jsx)(iui,{...t,ref:e}):null});XKr.displayName=wgt;var iui=en.forwardRef((t,e)=>{let{__scopeScrollArea:r,...n}=t,o=P0(wgt,r),[i,a]=en.useState(0),[s,u]=en.useState(0),l=!!(i&&s);return rZ(o.scrollbarX,()=>{let c=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(c),u(c)}),rZ(o.scrollbarY,()=>{let c=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(c),a(c)}),l?(0,Vs.jsx)(QX.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 v$e(t){return t?parseInt(t,10):0}function ZKr(t,e){let r=t/e;return isNaN(r)?0:r}function S$e(t){let e=ZKr(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function aui(t,e,r,n="ltr"){let o=S$e(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 YKr([u,l],d)(t)}function UKr(t,e,r="ltr"){let n=S$e(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=qU(t,u);return YKr([0,a],[0,s])(l)}function YKr(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 QKr(t,e){return t>0&&t<e}var sui=(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 C$e(t,e){let r=kU(t),n=en.useRef(0);return en.useEffect(()=>()=>window.clearTimeout(n.current),[]),en.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function rZ(t,e){let r=kU(e);Xce(()=>{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 Sgt=VKr,e8r=JKr;var t8r=XKr;kn();var BU=vA.forwardRef(({className:t,children:e,...r},n)=>vA.createElement(Sgt,{ref:n,className:Te("tw-relative tw-overflow-hidden",t),...r},vA.createElement(e8r,{className:"tw-size-full tw-rounded-[inherit] [&>div:first-child]:!tw-block"},e),vA.createElement(r8r,null),vA.createElement(t8r,null)));BU.displayName=Sgt.displayName;var r8r=vA.forwardRef(({className:t,orientation:e="vertical",...r},n)=>vA.createElement(w$e,{ref:n,orientation:e,className:Te("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},vA.createElement(vgt,{className:"tw-relative tw-flex-1 tw-rounded-full tw-bg-[var(--background-modifier-border)]"})));r8r.displayName=w$e.displayName;kn();_t();ot();lN();var n8r=require("obsidian");function o8r({children:t,chatHistory:e,onUpdateTitle:r,onDeleteChat:n,onLoadChat:o,onOpenSourceFile:i}){let[a,s]=(0,Mn.useState)(""),[u,l]=(0,Mn.useState)(null),[c,d]=(0,Mn.useState)(""),[f,p]=(0,Mn.useState)(!1),[m,h]=(0,Mn.useState)(null),y=n8r.Platform.isMobile,g=zr(),b=(0,Mn.useMemo)(()=>a.trim()?e.filter(A=>A.title.toLowerCase().includes(a.toLowerCase())):e,[e,a]),_=(0,Mn.useMemo)(()=>mO(b,g.chatHistorySortStrategy,{getName:A=>A.title,getCreatedAtMs:A=>A.createdAt.getTime(),getLastUsedAtMs:A=>A.lastAccessedAt.getTime()}),[b,g.chatHistorySortStrategy]),w=(0,Mn.useMemo)(()=>{let A=g.chatHistorySortStrategy;if(A==="name")return[{key:"All",label:"All",chats:_,priority:0}];let k=[],V=new Map,q=new Date;return _.forEach(J=>{let K=A==="recent"?J.lastAccessedAt:J.createdAt,ue=q.getTime()-K.getTime(),oe=Math.floor(ue/(1e3*60*60*24)),G,Y;if(oe===0)G="Today",Y=0;else if(oe===1)G="Yesterday",Y=1;else if(oe<7)G=`${oe}d ago`,Y=2+oe;else if(oe<30){let se=Math.floor(oe/7);G=se===1?"1w ago":`${se}w ago`,Y=10+se}else{let se=Math.floor(oe/30);G=se===1?"1m ago":`${se}m ago`,Y=50+se}V.has(G)||(V.set(G,[]),k.push({key:G,label:G,chats:V.get(G),priority:Y})),V.get(G).push(J)}),k.sort((J,K)=>J.priority-K.priority)},[g.chatHistorySortStrategy,_]),O=(A,k)=>{l(A),d(k)},T=async()=>{if(u&&c.trim())try{await r(u,c.trim()),l(null),d("")}catch(A){ne("Error updating title:",A);return}else l(null),d("")},P=()=>{l(null),d("")},M=async A=>{if(m===A)try{await n(A),h(null)}catch(k){ne("Error deleting chat:",k),h(null)}else h(A),setTimeout(()=>{h(null)},3e3)},I=()=>{h(null)},j=async A=>{o&&await o(A),p(!1)};return Mn.default.createElement(LU,{open:f,onOpenChange:p},Mn.default.createElement(FU,{asChild:!0},t),Mn.default.createElement(r$,{className:"tw-w-80 tw-p-0",align:"end",side:"top"},Mn.default.createElement("div",{className:"tw-flex tw-max-h-[400px] tw-flex-col"},Mn.default.createElement("div",{className:"tw-shrink-0 tw-border-b tw-p-1"},Mn.default.createElement(XX,{value:a,onChange:s})),Mn.default.createElement(BU,{className:"tw-min-h-[150px] tw-flex-1 tw-overflow-y-auto"},Mn.default.createElement("div",{className:"tw-p-2"},w.length===0?Mn.default.createElement("div",{className:"tw-py-8 tw-text-center tw-text-muted"},a?"No matching chat history found.":"No chat history"):w.map(A=>Mn.default.createElement("div",{key:A.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"}},Mn.default.createElement("div",{className:"tw-mb-2 tw-px-2 tw-text-xs tw-font-medium tw-tracking-wider tw-text-muted"},A.label),Mn.default.createElement("div",{className:"tw-space-y-1"},A.chats.map(k=>Mn.default.createElement(lui,{key:k.id,chat:k,isEditing:u===k.id,editingTitle:c,onEditingTitleChange:d,onStartEdit:O,onSaveEdit:T,onCancelEdit:P,onDelete:M,onCancelDelete:I,onLoadChat:j,onOpenSourceFile:i,isMobile:y,confirmDeleteId:m}))))))))))}function lui({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?Mn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2"},Mn.default.createElement(F6,{className:"tw-size-3 tw-shrink-0 tw-text-muted"}),Mn.default.createElement(Zo,{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()}}),Mn.default.createElement(ge,{size:"sm",variant:"ghost",onClick:i,className:"tw-size-5 tw-p-0"},Mn.default.createElement(Hu,{className:"tw-size-3"})),Mn.default.createElement(ge,{size:"sm",variant:"ghost",onClick:a,className:"tw-size-5 tw-p-0"},Mn.default.createElement($o,{className:"tw-size-3"}))):Mn.default.createElement("div",{className:Te("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)},Mn.default.createElement(F6,{className:"tw-size-3 tw-shrink-0 tw-text-muted"}),Mn.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},Mn.default.createElement("span",{className:"tw-block tw-truncate tw-text-sm tw-font-medium tw-text-normal"},t.title)),Mn.default.createElement("div",{className:Te("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?Mn.default.createElement(Mn.default.Fragment,null,Mn.default.createElement(ge,{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"},Mn.default.createElement(Hu,{className:"tw-size-3"})),Mn.default.createElement(ge,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),u()},className:"tw-size-5 tw-p-0",title:"Cancel deletion"},Mn.default.createElement($o,{className:"tw-size-3"}))):Mn.default.createElement(Mn.default.Fragment,null,Mn.default.createElement(ge,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),c&&c(t.id)},className:"tw-size-5 tw-p-0",title:"Open the source file"},Mn.default.createElement(MN,{className:"tw-size-4"})),Mn.default.createElement(ge,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),o(t.id,t.title)},className:"tw-size-5 tw-p-0"},Mn.default.createElement(pb,{className:"tw-size-3"})),Mn.default.createElement(ge,{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"},Mn.default.createElement(ly,{className:"tw-size-3"})))))}Jr();var UJ=L(X()),i8r=({tokenCount:t})=>t==null?null:UJ.default.createElement(pn,null,UJ.default.createElement(mn,{asChild:!0},UJ.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-faint"},UJ.default.createElement(qte,{className:"tw-size-3"}),UJ.default.createElement("span",null,(r=>r<1e3?"<1k":`${Math.floor(r/1e3)}k`)(t)))),UJ.default.createElement(sn,null,"Context used: ",t.toLocaleString()));var sr=L(X());to();var BJ=L(X());kn();Jr();function wA({options:t,placeholder:e,containerClassName:r,className:n,...o}){return BJ.default.createElement("div",{className:Te("tw-group tw-relative tw-w-full",r)},BJ.default.createElement("select",{className:Te("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&&BJ.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>BJ.default.createElement("option",{key:i.value,value:i.value},i.label))),BJ.default.createElement("div",{className:Te("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")},BJ.default.createElement(ts,{className:"tw-size-4"})))}var x$e=L(X());var c8r=L(X(),1);var a8r=L(X(),1),cui=L(cu(),1);Vu();var s8r=L(vr(),1),dui=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],u8r=dui.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=a8r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,s8r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var d8r=L(vr(),1),fui="Separator",l8r="horizontal",pui=["horizontal","vertical"],f8r=c8r.forwardRef((t,e)=>{let{decorative:r,orientation:n=l8r,...o}=t,i=mui(n)?n:l8r,s=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return(0,d8r.jsx)(u8r.div,{"data-orientation":i,...s,...o,ref:e})});f8r.displayName=fui;function mui(t){return pui.includes(t)}var Cgt=f8r;kn();var Px=x$e.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},o)=>x$e.createElement(Cgt,{ref:o,decorative:r,orientation:e,className:Te("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}));Px.displayName=Cgt.displayName;Jr();Iue();var Zn=L(X());var nZ=L(X());var qo=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>nZ.default.createElement("div",{className:"tw-space-y-2"},t&&nZ.default.createElement(im,{className:r?"tw-text-error":""},t," ",e&&nZ.default.createElement("span",{className:"tw-text-error"},"*")),n&&nZ.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n),i,r&&nZ.default.createElement("p",{className:"tw-text-xs tw-text-error"},o));var su=L(X());var HJ=L(X());var wu=L(X(),1);function zJ(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var m8r=L(X(),1);function p8r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function gui(...t){return e=>{let r=!1,n=t.map(o=>{let i=p8r(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():p8r(t[o],null)}}}}function VJ(...t){return m8r.useCallback(gui(...t),t)}var i$=L(X(),1),h8r=L(vr(),1);function g8r(t,e=[]){let r=[];function n(i,a){let s=i$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=i$.useMemo(()=>m,Object.values(m));return(0,h8r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=i$.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=>i$.createContext(a));return function(s){let u=s?.[t]||i;return i$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,yui(o,...e)]}function yui(...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 i$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var M0=L(X(),1);var y8r=L(X(),1),O$e=globalThis?.document?y8r.useLayoutEffect:()=>{};var T$e=L(X(),1);var bui=M0[" useInsertionEffect ".trim().toString()]||O$e;function b8r({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=_ui({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=M0.useRef(t!==void 0);M0.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=M0.useCallback(c=>{if(s){let d=vui(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function _ui({defaultProp:t,onChange:e}){let[r,n]=M0.useState(t),o=M0.useRef(r),i=M0.useRef(e);return bui(()=>{i.current=e},[e]),M0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function vui(t){return typeof t=="function"}var UEs=Symbol("RADIX:SYNC_STATE");var E$e=L(X(),1),wui=L(vr(),1),Sui=E$e.createContext(void 0);function _8r(t){let e=E$e.useContext(Sui);return t||e||"ltr"}var P$e=L(X(),1);function v8r(t){let e=P$e.useRef({value:t,previous:t});return P$e.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var w8r=L(X(),1);function S8r(t){let[e,r]=w8r.useState(void 0);return O$e(()=>{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 C8r=L(X(),1),Cui=L(cu(),1);Vu();var x8r=L(vr(),1),xui=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oZ=xui.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=C8r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,x8r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var zm=L(vr(),1),O8r=["PageUp","PageDown"],T8r=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],E8r={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},iZ="Slider",[xgt,Oui,Tui]=TU(iZ),[P8r,iPs]=g8r(iZ,[Tui]),[Eui,M$e]=P8r(iZ),M8r=wu.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=wu.useRef(new Set),g=wu.useRef(0),_=a==="horizontal"?Pui:Mui,[w=[],O]=b8r({prop:c,defaultProp:l,onChange:A=>{[...y.current][g.current]?.focus(),d(A)}}),T=wu.useRef(w);function P(A){let k=jui(w,A);j(A,k)}function M(A){j(A,g.current)}function I(){let A=T.current[g.current];w[g.current]!==A&&f(w)}function j(A,k,{commit:V}={commit:!1}){let q=Fui(i),J=kui(Math.round((A-n)/i)*i+n,q),K=qU(J,[n,o]);O((ue=[])=>{let oe=Aui(ue,K,k);if(Lui(oe,u*i)){g.current=oe.indexOf(K);let G=String(oe)!==String(ue);return G&&V&&f(oe),G?oe:ue}else return ue})}return(0,zm.jsx)(Eui,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:g,thumbs:y.current,values:w,orientation:a,form:m,children:(0,zm.jsx)(xgt.Provider,{scope:t.__scopeSlider,children:(0,zm.jsx)(xgt.Slot,{scope:t.__scopeSlider,children:(0,zm.jsx)(_,{"aria-disabled":s,"data-disabled":s?"":void 0,...h,ref:e,onPointerDown:zJ(h.onPointerDown,()=>{s||(T.current=w)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:P,onSlideMove:s?void 0:M,onSlideEnd:s?void 0:I,onHomeKeyDown:()=>!s&&j(n,0,{commit:!0}),onEndKeyDown:()=>!s&&j(o,w.length-1,{commit:!0}),onStepKeyDown:({event:A,direction:k})=>{if(!s){let J=O8r.includes(A.key)||A.shiftKey&&T8r.includes(A.key)?10:1,K=g.current,ue=w[K],oe=i*J*k;j(ue+oe,K,{commit:!0})}}})})})})});M8r.displayName=iZ;var[I8r,R8r]=P8r(iZ,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Pui=wu.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=wu.useState(null),p=VJ(e,_=>f(_)),m=wu.useRef(void 0),h=_8r(o),y=h==="ltr",g=y&&!i||!y&&i;function b(_){let w=m.current||d.getBoundingClientRect(),O=[0,w.width],P=Egt(O,g?[r,n]:[n,r]);return m.current=w,P(_-w.left)}return(0,zm.jsx)(I8r,{scope:t.__scopeSlider,startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width",children:(0,zm.jsx)(A8r,{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 O=E8r[g?"from-left":"from-right"].includes(_.key);l?.({event:_,direction:O?-1:1})}})})}),Mui=wu.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=wu.useRef(null),d=VJ(e,c),f=wu.useRef(void 0),p=!o;function m(h){let y=f.current||c.current.getBoundingClientRect(),g=[0,y.height],_=Egt(g,p?[n,r]:[r,n]);return f.current=y,_(h-y.top)}return(0,zm.jsx)(I8r,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,zm.jsx)(A8r,{"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=E8r[p?"from-bottom":"from-top"].includes(h.key);u?.({event:h,direction:g?-1:1})}})})}),A8r=wu.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=M$e(iZ,r);return(0,zm.jsx)(oZ.span,{...l,ref:e,onKeyDown:zJ(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):O8r.concat(T8r).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:zJ(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:zJ(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:zJ(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),N8r="SliderTrack",j8r=wu.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=M$e(N8r,r);return(0,zm.jsx)(oZ.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});j8r.displayName=N8r;var Ogt="SliderRange",D8r=wu.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=M$e(Ogt,r),i=R8r(Ogt,r),a=wu.useRef(null),s=VJ(e,a),u=o.values.length,l=o.values.map(f=>F8r(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,zm.jsx)(oZ.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});D8r.displayName=Ogt;var Tgt="SliderThumb",$8r=wu.forwardRef((t,e)=>{let r=Oui(t.__scopeSlider),[n,o]=wu.useState(null),i=VJ(e,s=>o(s)),a=wu.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,zm.jsx)(Iui,{...t,ref:i,index:a})}),Iui=wu.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=M$e(Tgt,r),s=R8r(Tgt,r),[u,l]=wu.useState(null),c=VJ(e,b=>l(b)),d=u?a.form||!!u.closest("form"):!0,f=S8r(u),p=a.values[n],m=p===void 0?0:F8r(p,a.min,a.max),h=Nui(n,a.values.length),y=f?.[s.size],g=y?Dui(y,m,s.direction):0;return wu.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,zm.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${m}% + ${g}px)`},children:[(0,zm.jsx)(xgt.ItemSlot,{scope:t.__scopeSlider,children:(0,zm.jsx)(oZ.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:zJ(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,zm.jsx)(L8r,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});$8r.displayName=Tgt;var Rui="RadioBubbleInput",L8r=wu.forwardRef(({__scopeSlider:t,value:e,...r},n)=>{let o=wu.useRef(null),i=VJ(o,n),a=v8r(e);return wu.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,zm.jsx)(oZ.input,{style:{display:"none"},...r,ref:i,defaultValue:e})});L8r.displayName=Rui;function Aui(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function F8r(t,e,r){let i=100/(r-e)*(t-e);return qU(i,[0,100])}function Nui(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function jui(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 Dui(t,e,r){let n=t/2,i=Egt([0,50],[0,n]);return(n-i(e)*r)*r}function $ui(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function Lui(t,e){if(e>0){let r=$ui(t);return Math.min(...r)>=e}return!0}function Egt(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 Fui(t){return(String(t).split(".")[1]||"").length}function kui(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var Pgt=M8r,k8r=j8r,q8r=D8r,U8r=$8r;kn();var Zce=HJ.forwardRef(({className:t,...e},r)=>HJ.createElement(Pgt,{ref:r,className:Te("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},HJ.createElement(k8r,{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"},HJ.createElement(q8r,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),HJ.createElement(U8r,{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"})));Zce.displayName=Pgt.displayName;to();var Su=L(X());var Xt=L(X(),1),$gt=L(cu(),1);var uPs=!!(typeof window<"u"&&window.document&&window.document.createElement);function Dh(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var z8r=L(X(),1);function B8r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Uui(...t){return e=>{let r=!1,n=t.map(o=>{let i=B8r(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():B8r(t[o],null)}}}}function Mx(...t){return z8r.useCallback(Uui(...t),t)}var a$=L(X(),1),V8r=L(vr(),1);function H8r(t,e=[]){let r=[];function n(i,a){let s=a$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=a$.useMemo(()=>m,Object.values(m));return(0,V8r.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=a$.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=>a$.createContext(a));return function(s){let u=s?.[t]||i;return a$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Bui(o,...e)]}function Bui(...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 a$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var I$e=L(X(),1),zui=L(vr(),1),Vui=I$e.createContext(void 0);function J8r(t){let e=I$e.useContext(Vui);return t||e||"ltr"}var Mgt=L(X(),1);var W8r=L(X(),1),vw=globalThis?.document?W8r.useLayoutEffect:()=>{};var Hui=Mgt[" useId ".trim().toString()]||(()=>{}),Jui=0;function R$e(t){let[e,r]=Mgt.useState(Hui());return vw(()=>{t||r(n=>n??String(Jui++))},[t]),t||(e?`radix-${e}`:"")}var K8r=L(X(),1),Wui=L(cu(),1);Vu();var G8r=L(vr(),1),Kui=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Y_=Kui.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=K8r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,G8r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});Vu();var aZ=L(X(),1);function X8r(t){let e=aZ.useRef(t);return aZ.useEffect(()=>{e.current=t}),aZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var I0=L(X(),1);var A$e=L(X(),1);var Gui=I0[" useInsertionEffect ".trim().toString()]||vw;function Igt({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Xui({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=I0.useRef(t!==void 0);I0.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=I0.useCallback(c=>{if(s){let d=Zui(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Xui({defaultProp:t,onChange:e}){let[r,n]=I0.useState(t),o=I0.useRef(r),i=I0.useRef(e);return Gui(()=>{i.current=e},[e]),I0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function Zui(t){return typeof t=="function"}var vPs=Symbol("RADIX:SYNC_STATE");var N$e=L(X(),1);function Z8r(t){let e=N$e.useRef({value:t,previous:t});return N$e.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Cn=L(vr(),1),Yui=[" ","Enter","ArrowUp","ArrowDown"],Qui=[" ","Enter"],JJ="Select",[D$e,$$e,eli]=TU(JJ),[sZ,VPs]=H8r(JJ,[eli,C0]),L$e=C0(),[tli,zU]=sZ(JJ),[rli,nli]=sZ(JJ),Y8r=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=L$e(e),[y,g]=Xt.useState(null),[b,_]=Xt.useState(null),[w,O]=Xt.useState(!1),T=J8r(l),[P,M]=Igt({prop:n,defaultProp:o??!1,onChange:i,caller:JJ}),[I,j]=Igt({prop:a,defaultProp:s,onChange:u,caller:JJ}),A=Xt.useRef(null),k=y?m||!!y.closest("form"):!0,[V,q]=Xt.useState(new Set),J=Array.from(V).map(K=>K.props.value).join(";");return(0,Cn.jsx)(XD,{...h,children:(0,Cn.jsxs)(tli,{required:p,scope:e,trigger:y,onTriggerChange:g,valueNode:b,onValueNodeChange:_,valueNodeHasChildren:w,onValueNodeHasChildrenChange:O,contentId:R$e(),value:I,onValueChange:j,open:P,onOpenChange:M,dir:T,triggerPointerDownPosRef:A,disabled:f,children:[(0,Cn.jsx)(D$e.Provider,{scope:e,children:(0,Cn.jsx)(rli,{scope:t.__scopeSelect,onNativeOptionAdd:Xt.useCallback(K=>{q(ue=>new Set(ue).add(K))},[]),onNativeOptionRemove:Xt.useCallback(K=>{q(ue=>{let oe=new Set(ue);return oe.delete(K),oe})},[]),children:r})}),k?(0,Cn.jsxs)(SGr,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:I,onChange:K=>j(K.target.value),disabled:f,form:m,children:[I===void 0?(0,Cn.jsx)("option",{value:""}):null,Array.from(V)]},J):null]})})};Y8r.displayName=JJ;var Q8r="SelectTrigger",eGr=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=L$e(r),a=zU(Q8r,r),s=a.disabled||n,u=Mx(e,a.onTriggerChange),l=$$e(r),c=Xt.useRef("touch"),[d,f,p]=xGr(h=>{let y=l().filter(_=>!_.disabled),g=y.find(_=>_.value===a.value),b=OGr(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,Cn.jsx)(ZD,{asChild:!0,...i,children:(0,Cn.jsx)(Y_.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":CGr(a.value)?"":void 0,...o,ref:u,onClick:Dh(o.onClick,h=>{h.currentTarget.focus(),c.current!=="mouse"&&m(h)}),onPointerDown:Dh(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:Dh(o.onKeyDown,h=>{let y=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(y&&h.key===" ")&&Yui.includes(h.key)&&(m(),h.preventDefault())})})})});eGr.displayName=Q8r;var tGr="SelectValue",rGr=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=zU(tGr,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=Mx(e,u.onValueNodeChange);return vw(()=>{l(c)},[l,c]),(0,Cn.jsx)(Y_.span,{...s,ref:d,style:{pointerEvents:"none"},children:CGr(u.value)?(0,Cn.jsx)(Cn.Fragment,{children:a}):i})});rGr.displayName=tGr;var oli="SelectIcon",nGr=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,Cn.jsx)(Y_.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});nGr.displayName=oli;var ili="SelectPortal",oGr=t=>(0,Cn.jsx)(Ex,{asChild:!0,...t});oGr.displayName=ili;var WJ="SelectContent",iGr=Xt.forwardRef((t,e)=>{let r=zU(WJ,t.__scopeSelect),[n,o]=Xt.useState();if(vw(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?$gt.createPortal((0,Cn.jsx)(aGr,{scope:t.__scopeSelect,children:(0,Cn.jsx)(D$e.Slot,{scope:t.__scopeSelect,children:(0,Cn.jsx)("div",{children:t.children})})}),i):null}return(0,Cn.jsx)(sGr,{...t,ref:e})});iGr.displayName=WJ;var Ix=10,[aGr,VU]=sZ(WJ),ali="SelectContentImpl",sli=Fn("SelectContent.RemoveScroll"),sGr=Xt.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=zU(WJ,r),[_,w]=Xt.useState(null),[O,T]=Xt.useState(null),P=Mx(e,R=>w(R)),[M,I]=Xt.useState(null),[j,A]=Xt.useState(null),k=$$e(r),[V,q]=Xt.useState(!1),J=Xt.useRef(!1);Xt.useEffect(()=>{if(_)return jU(_)},[_]),PU();let K=Xt.useCallback(R=>{let[z,...U]=k().map(ve=>ve.ref.current),[ee]=U.slice(-1),ce=document.activeElement;for(let ve of R)if(ve===ce||(ve?.scrollIntoView({block:"nearest"}),ve===z&&O&&(O.scrollTop=0),ve===ee&&O&&(O.scrollTop=O.scrollHeight),ve?.focus(),document.activeElement!==ce))return},[k,O]),ue=Xt.useCallback(()=>K([M,_]),[K,M,_]);Xt.useEffect(()=>{V&&ue()},[V,ue]);let{onOpenChange:oe,triggerPointerDownPosRef:G}=b;Xt.useEffect(()=>{if(_){let R={x:0,y:0},z=ee=>{R={x:Math.abs(Math.round(ee.pageX)-(G.current?.x??0)),y:Math.abs(Math.round(ee.pageY)-(G.current?.y??0))}},U=ee=>{R.x<=10&&R.y<=10?ee.preventDefault():_.contains(ee.target)||oe(!1),document.removeEventListener("pointermove",z),G.current=null};return G.current!==null&&(document.addEventListener("pointermove",z),document.addEventListener("pointerup",U,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",z),document.removeEventListener("pointerup",U,{capture:!0})}}},[_,oe,G]),Xt.useEffect(()=>{let R=()=>oe(!1);return window.addEventListener("blur",R),window.addEventListener("resize",R),()=>{window.removeEventListener("blur",R),window.removeEventListener("resize",R)}},[oe]);let[Y,se]=xGr(R=>{let z=k().filter(ce=>!ce.disabled),U=z.find(ce=>ce.ref.current===document.activeElement),ee=OGr(z,R,U);ee&&setTimeout(()=>ee.ref.current.focus())}),ie=Xt.useCallback((R,z,U)=>{let ee=!J.current&&!U;(b.value!==void 0&&b.value===z||ee)&&(I(R),ee&&(J.current=!0))},[b.value]),$=Xt.useCallback(()=>_?.focus(),[_]),H=Xt.useCallback((R,z,U)=>{let ee=!J.current&&!U;(b.value!==void 0&&b.value===z||ee)&&A(R)},[b.value]),re=n==="popper"?Rgt:uGr,D=re===Rgt?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:y}:{};return(0,Cn.jsx)(aGr,{scope:r,content:_,viewport:O,onViewportChange:T,itemRefCallback:ie,selectedItem:M,onItemLeave:$,itemTextRefCallback:H,focusSelectedItem:ue,selectedItemText:j,position:n,isPositioned:V,searchRef:Y,children:(0,Cn.jsx)(QD,{as:sli,allowPinchZoom:!0,children:(0,Cn.jsx)(WD,{asChild:!0,trapped:b.open,onMountAutoFocus:R=>{R.preventDefault()},onUnmountAutoFocus:Dh(o,R=>{b.trigger?.focus({preventScroll:!0}),R.preventDefault()}),children:(0,Cn.jsx)(Sx,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:R=>R.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,Cn.jsx)(re,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:R=>R.preventDefault(),...g,...D,onPlaced:()=>q(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:Dh(g.onKeyDown,R=>{let z=R.ctrlKey||R.altKey||R.metaKey;if(R.key==="Tab"&&R.preventDefault(),!z&&R.key.length===1&&se(R.key),["ArrowUp","ArrowDown","Home","End"].includes(R.key)){let ee=k().filter(ce=>!ce.disabled).map(ce=>ce.ref.current);if(["ArrowUp","End"].includes(R.key)&&(ee=ee.slice().reverse()),["ArrowUp","ArrowDown"].includes(R.key)){let ce=R.target,ve=ee.indexOf(ce);ee=ee.slice(ve+1)}setTimeout(()=>K(ee)),R.preventDefault()}})})})})})})});sGr.displayName=ali;var uli="SelectItemAlignedPosition",uGr=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=zU(WJ,r),a=VU(WJ,r),[s,u]=Xt.useState(null),[l,c]=Xt.useState(null),d=Mx(e,P=>c(P)),f=$$e(r),p=Xt.useRef(!1),m=Xt.useRef(!0),{viewport:h,selectedItem:y,selectedItemText:g,focusSelectedItem:b}=a,_=Xt.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&h&&y&&g){let P=i.trigger.getBoundingClientRect(),M=l.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),j=g.getBoundingClientRect();if(i.dir!=="rtl"){let ce=j.left-M.left,ve=I.left-ce,Oe=P.left-ve,Je=P.width+Oe,tt=Math.max(Je,M.width),Ke=window.innerWidth-Ix,dt=qU(ve,[Ix,Math.max(Ix,Ke-tt)]);s.style.minWidth=Je+"px",s.style.left=dt+"px"}else{let ce=M.right-j.right,ve=window.innerWidth-I.right-ce,Oe=window.innerWidth-P.right-ve,Je=P.width+Oe,tt=Math.max(Je,M.width),Ke=window.innerWidth-Ix,dt=qU(ve,[Ix,Math.max(Ix,Ke-tt)]);s.style.minWidth=Je+"px",s.style.right=dt+"px"}let A=f(),k=window.innerHeight-Ix*2,V=h.scrollHeight,q=window.getComputedStyle(l),J=parseInt(q.borderTopWidth,10),K=parseInt(q.paddingTop,10),ue=parseInt(q.borderBottomWidth,10),oe=parseInt(q.paddingBottom,10),G=J+K+V+oe+ue,Y=Math.min(y.offsetHeight*5,G),se=window.getComputedStyle(h),ie=parseInt(se.paddingTop,10),$=parseInt(se.paddingBottom,10),H=P.top+P.height/2-Ix,re=k-H,D=y.offsetHeight/2,R=y.offsetTop+D,z=J+K+R,U=G-z;if(z<=H){let ce=A.length>0&&y===A[A.length-1].ref.current;s.style.bottom="0px";let ve=l.clientHeight-h.offsetTop-h.offsetHeight,Oe=Math.max(re,D+(ce?$:0)+ve+ue),Je=z+Oe;s.style.height=Je+"px"}else{let ce=A.length>0&&y===A[0].ref.current;s.style.top="0px";let Oe=Math.max(H,J+h.offsetTop+(ce?ie:0)+D)+U;s.style.height=Oe+"px",h.scrollTop=z-H+h.offsetTop}s.style.margin=`${Ix}px 0`,s.style.minHeight=Y+"px",s.style.maxHeight=k+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,h,y,g,i.dir,n]);vw(()=>_(),[_]);let[w,O]=Xt.useState();vw(()=>{l&&O(window.getComputedStyle(l).zIndex)},[l]);let T=Xt.useCallback(P=>{P&&m.current===!0&&(_(),b?.(),m.current=!1)},[_,b]);return(0,Cn.jsx)(cli,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:T,children:(0,Cn.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:(0,Cn.jsx)(Y_.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});uGr.displayName=uli;var lli="SelectPopperPosition",Rgt=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=Ix,...i}=t,a=L$e(r);return(0,Cn.jsx)(RU,{...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)"}})});Rgt.displayName=lli;var[cli,Lgt]=sZ(WJ,{}),Agt="SelectViewport",lGr=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=VU(Agt,r),a=Lgt(Agt,r),s=Mx(e,i.onViewportChange),u=Xt.useRef(0);return(0,Cn.jsxs)(Cn.Fragment,{children:[(0,Cn.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,Cn.jsx)(D$e.Slot,{scope:r,children:(0,Cn.jsx)(Y_.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Dh(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-Ix*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})})})]})});lGr.displayName=Agt;var cGr="SelectGroup",[dli,fli]=sZ(cGr),pli=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=R$e();return(0,Cn.jsx)(dli,{scope:r,id:o,children:(0,Cn.jsx)(Y_.div,{role:"group","aria-labelledby":o,...n,ref:e})})});pli.displayName=cGr;var dGr="SelectLabel",fGr=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=fli(dGr,r);return(0,Cn.jsx)(Y_.div,{id:o.id,...n,ref:e})});fGr.displayName=dGr;var j$e="SelectItem",[mli,pGr]=sZ(j$e),mGr=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=zU(j$e,r),u=VU(j$e,r),l=s.value===n,[c,d]=Xt.useState(i??""),[f,p]=Xt.useState(!1),m=Mx(e,b=>u.itemRefCallback?.(b,n,o)),h=R$e(),y=Xt.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,Cn.jsx)(mli,{scope:r,value:n,disabled:o,textId:h,isSelected:l,onItemTextChange:Xt.useCallback(b=>{d(_=>_||(b?.textContent??"").trim())},[]),children:(0,Cn.jsx)(D$e.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,Cn.jsx)(Y_.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:Dh(a.onFocus,()=>p(!0)),onBlur:Dh(a.onBlur,()=>p(!1)),onClick:Dh(a.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:Dh(a.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:Dh(a.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:Dh(a.onPointerMove,b=>{y.current=b.pointerType,o?u.onItemLeave?.():y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Dh(a.onPointerLeave,b=>{b.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:Dh(a.onKeyDown,b=>{u.searchRef?.current!==""&&b.key===" "||(Qui.includes(b.key)&&g(),b.key===" "&&b.preventDefault())})})})})});mGr.displayName=j$e;var Yce="SelectItemText",hGr=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=zU(Yce,r),s=VU(Yce,r),u=pGr(Yce,r),l=nli(Yce,r),[c,d]=Xt.useState(null),f=Mx(e,g=>d(g),u.onItemTextChange,g=>s.itemTextRefCallback?.(g,u.value,u.disabled)),p=c?.textContent,m=Xt.useMemo(()=>(0,Cn.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:y}=l;return vw(()=>(h(m),()=>y(m)),[h,y,m]),(0,Cn.jsxs)(Cn.Fragment,{children:[(0,Cn.jsx)(Y_.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?$gt.createPortal(i.children,a.valueNode):null]})});hGr.displayName=Yce;var gGr="SelectItemIndicator",yGr=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return pGr(gGr,r).isSelected?(0,Cn.jsx)(Y_.span,{"aria-hidden":!0,...n,ref:e}):null});yGr.displayName=gGr;var Ngt="SelectScrollUpButton",bGr=Xt.forwardRef((t,e)=>{let r=VU(Ngt,t.__scopeSelect),n=Lgt(Ngt,t.__scopeSelect),[o,i]=Xt.useState(!1),a=Mx(e,n.onScrollButtonChange);return vw(()=>{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,Cn.jsx)(vGr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});bGr.displayName=Ngt;var jgt="SelectScrollDownButton",_Gr=Xt.forwardRef((t,e)=>{let r=VU(jgt,t.__scopeSelect),n=Lgt(jgt,t.__scopeSelect),[o,i]=Xt.useState(!1),a=Mx(e,n.onScrollButtonChange);return vw(()=>{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,Cn.jsx)(vGr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});_Gr.displayName=jgt;var vGr=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=VU("SelectScrollButton",r),a=Xt.useRef(null),s=$$e(r),u=Xt.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return Xt.useEffect(()=>()=>u(),[u]),vw(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,Cn.jsx)(Y_.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:Dh(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:Dh(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:Dh(o.onPointerLeave,()=>{u()})})}),hli="SelectSeparator",wGr=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,Cn.jsx)(Y_.div,{"aria-hidden":!0,...n,ref:e})});wGr.displayName=hli;var Dgt="SelectArrow",gli=Xt.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=L$e(r),i=zU(Dgt,r),a=VU(Dgt,r);return i.open&&a.position==="popper"?(0,Cn.jsx)(AU,{...o,...n,ref:e}):null});gli.displayName=Dgt;var yli="SelectBubbleInput",SGr=Xt.forwardRef(({__scopeSelect:t,value:e,...r},n)=>{let o=Xt.useRef(null),i=Mx(n,o),a=Z8r(e);return Xt.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,Cn.jsx)(Y_.select,{...r,style:{...ugt,...r.style},ref:i,defaultValue:e})});SGr.displayName=yli;function CGr(t){return t===""||t===void 0}function xGr(t){let e=X8r(t),r=Xt.useRef(""),n=Xt.useRef(0),o=Xt.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=Xt.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return Xt.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function OGr(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=bli(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 bli(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var TGr=Y8r,Fgt=eGr,EGr=rGr,PGr=nGr,MGr=oGr,kgt=iGr,IGr=lGr;var qgt=fGr,Ugt=mGr,RGr=hGr,AGr=yGr,Bgt=bGr,zgt=_Gr,Vgt=wGr;Jr();kn();var KJ=TGr;var GJ=EGr,HU=Su.forwardRef(({className:t,children:e,...r},n)=>Su.createElement(Fgt,{ref:n,className:Te("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,Su.createElement(PGr,{asChild:!0},Su.createElement(ts,{className:"tw-size-4"}))));HU.displayName=Fgt.displayName;var NGr=Su.forwardRef(({className:t,...e},r)=>Su.createElement(Bgt,{ref:r,className:Te("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},Su.createElement(fb,{className:"tw-size-4"})));NGr.displayName=Bgt.displayName;var jGr=Su.forwardRef(({className:t,...e},r)=>Su.createElement(zgt,{ref:r,className:Te("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},Su.createElement(ts,{className:"tw-size-4"})));jGr.displayName=zgt.displayName;var JU=Su.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>Su.createElement(MGr,{container:n},Su.createElement(kgt,{ref:i,className:Te("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},Su.createElement(NGr,null),Su.createElement(IGr,{className:Te("tw-p-1",r==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]")},e),Su.createElement(jGr,null))));JU.displayName=kgt.displayName;var vli=Su.forwardRef(({className:t,...e},r)=>Su.createElement(qgt,{ref:r,className:Te("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));vli.displayName=qgt.displayName;var WU=Su.forwardRef(({className:t,children:e,...r},n)=>Su.createElement(Ugt,{ref:n,className:Te("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},Su.createElement("span",{className:"tw-absolute tw-right-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},Su.createElement(AGr,null,Su.createElement(Hu,{className:"tw-size-4"}))),Su.createElement(RGr,null,e)));WU.displayName=Ugt.displayName;var wli=Su.forwardRef(({className:t,...e},r)=>Su.createElement(Vgt,{ref:r,className:Te("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));wli.displayName=Vgt.displayName;Jr();to();Jr();var Rx=L(X()),DGr=require("obsidian"),xi=({content:t,children:e,side:r="bottom",delayDuration:n=0,contentClassName:o,buttonClassName:i})=>{let a=DGr.Platform.isMobile,[s,u]=(0,Rx.useState)(!1),l=Rx.default.useRef(!1),c=()=>{a&&(l.current=!0)},d=()=>{a&&(u(!s),setTimeout(()=>{l.current=!1},100))};return Rx.default.createElement(jb,{delayDuration:n},Rx.default.createElement(pn,{open:s,onOpenChange:f=>{a&&l.current||u(f)}},Rx.default.createElement(mn,{asChild:!0},e?Rx.default.createElement("div",{onClick:d,onTouchStart:c,className:"tw-cursor-pointer"},e):Rx.default.createElement(ge,{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||""}`},Rx.default.createElement(zL,{className:"tw-size-4"}))),Rx.default.createElement(sn,{side:r,className:o},t)))};function KU(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,su.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 su.default.createElement("div",{className:"tw-space-y-3"},su.default.createElement(jb,{delayDuration:0},su.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},su.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},su.default.createElement("span",{className:`tw-font-medium ${s?"tw-text-normal":"tw-text-muted"}`},e),r&&su.default.createElement(xi,{buttonClassName:"tw-size-4 tw-text-muted",content:su.default.createElement("div",{className:"tw-max-w-[300px]"},r)})),su.default.createElement("div",{className:`tw-flex tw-items-center ${o?"tw-gap-3":"tw-gap-0"}`},su.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&&su.default.createElement(pn,null,su.default.createElement(mn,{asChild:!0},su.default.createElement(ge,{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?su.default.createElement(sre,{className:"tw-size-4"}):su.default.createElement(are,{className:"tw-size-4"}))),su.default.createElement(sn,{side:"bottom"},su.default.createElement("span",null,s?"Disable parameters":"Enable parameters")))))),su.default.createElement("div",{className:"tw-relative"},i==="slider"?su.default.createElement(su.default.Fragment,null,su.default.createElement(Zce,{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&&su.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-cursor-not-allowed tw-rounded"})):su.default.createElement(KJ,{value:s?t.value??t.defaultValue??t.options[0]?.value:void 0,onValueChange:d,disabled:!s},su.default.createElement(HU,{className:`tw-w-full ${s?"":"tw-opacity-40"}`},su.default.createElement(GJ,{placeholder:"Select an option"})),su.default.createElement(JU,null,t.options.map(f=>su.default.createElement(WU,{key:f.value,value:f.value},f.label))))))}Or();Or();var Hgt=[{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],$Gr=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}];function Jgt(){return ub.REASONING_EFFORT}function LGr(){return ub.VERBOSITY}var Vm={temperature:{min:0,max:2,step:.01,default:ub.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:ub.MAX_TOKENS}};function F$e({model:t,settings:e,onChange:r,onReset:n,showTokenLimit:o=!0}){let i=t.temperature??e.temperature,a=t.maxTokens??e.maxTokens,s=t.topP,u=t.frequencyPenalty,l=t.reasoningEffort,c=t.verbosity,f=(t.name.startsWith("o1")||t.name.startsWith("o3")||t.name.startsWith("o4")||t.name.startsWith("gpt-5"))&&t.provider==="openai",p=t.name.startsWith("gpt-5")&&t.provider==="openai";return Zn.default.createElement("div",{className:"tw-space-y-4"},o&&Zn.default.createElement(qo,null,Zn.default.createElement(KU,{type:"slider",optional:!1,label:"Token limit",value:a,onChange:m=>r("maxTokens",m),max:Vm.maxTokens.max,min:Vm.maxTokens.min,step:Vm.maxTokens.step,defaultValue:Vm.maxTokens.default,helpText:Zn.default.createElement(Zn.default.Fragment,null,Zn.default.createElement("p",null,"The maximum number of ",Zn.default.createElement("em",null,"output tokens")," to generate. Default is"," ",Vm.maxTokens.default,"."),Zn.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model."))})),Zn.default.createElement(qo,null,Zn.default.createElement(KU,{type:"slider",optional:!1,label:"Temperature",value:i,onChange:m=>r("temperature",m),min:Vm.temperature.min,max:Vm.temperature.max,step:Vm.temperature.step,defaultValue:Vm.temperature.default,helpText:`Default is ${Vm.temperature.default}. Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.`})),Zn.default.createElement(qo,null,Zn.default.createElement(KU,{type:"slider",optional:!0,label:"Top-P",value:s,onChange:m=>r("topP",m),disableFn:n?()=>n("topP"):void 0,min:Vm.topP.min,max:Vm.topP.max,step:Vm.topP.step,defaultValue:Vm.topP.default,helpText:`Default value is ${Vm.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`})),Zn.default.createElement(qo,null,Zn.default.createElement(KU,{type:"slider",optional:!0,label:"Frequency Penalty",value:u,onChange:m=>r("frequencyPenalty",m),disableFn:n?()=>n("frequencyPenalty"):void 0,min:Vm.frequencyPenalty.min,max:Vm.frequencyPenalty.max,step:Vm.frequencyPenalty.step,defaultValue:Vm.frequencyPenalty.default,helpText:Zn.default.createElement(Zn.default.Fragment,null,Zn.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."),Zn.default.createElement("em",null,"The higher the value, the more the model is penalized for repeating words."))})),f&&Zn.default.createElement(qo,null,Zn.default.createElement(KU,{type:"select",optional:!0,label:"Reasoning Effort",value:l,onChange:m=>r("reasoningEffort",m),disableFn:n?()=>n("reasoningEffort"):void 0,defaultValue:e.reasoningEffort??Jgt(),options:[...t.name.startsWith("gpt-5")?[{value:"minimal",label:"Minimal"}]:[],...Hgt.filter(m=>m.value!=="minimal")],helpText:Zn.default.createElement(Zn.default.Fragment,null,Zn.default.createElement("p",null,"Controls the amount of reasoning effort the model uses. Higher effort provides more thorough reasoning but takes longer. Note: thinking tokens are not available yet!"),Zn.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Zn.default.createElement("li",null,"Minimal: Fastest responses, minimal reasoning (GPT-5 only)"),Zn.default.createElement("li",null,"Low: Faster responses, basic reasoning (default)"),Zn.default.createElement("li",null,"Medium: Balanced performance"),Zn.default.createElement("li",null,"High: Thorough reasoning, slower responses")))})),p&&Zn.default.createElement(qo,null,Zn.default.createElement(KU,{type:"select",optional:!0,label:"Verbosity",value:c,onChange:m=>r("verbosity",m),disableFn:n?()=>n("verbosity"):void 0,defaultValue:e.verbosity??LGr(),options:$Gr,helpText:Zn.default.createElement(Zn.default.Fragment,null,Zn.default.createElement("p",null,"Controls the length and detail of the model responses."),Zn.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Zn.default.createElement("li",null,"Low: Concise, brief responses"),Zn.default.createElement("li",null,"Medium: Balanced detail"),Zn.default.createElement("li",null,"High: Detailed, comprehensive responses")))})),t.provider==="openrouterai"&&Zn.default.createElement(qo,null,Zn.default.createElement(KU,{type:"select",optional:!0,label:"Reasoning Effort",value:l,onChange:m=>r("reasoningEffort",m),disableFn:n?()=>n("reasoningEffort"):void 0,defaultValue:e.reasoningEffort??Jgt(),options:Hgt.filter(m=>m.value!=="minimal"),helpText:Zn.default.createElement(Zn.default.Fragment,null,Zn.default.createElement("p",null,"Controls the amount of reasoning effort the model uses. Higher effort provides more thorough reasoning but takes longer."),Zn.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Zn.default.createElement("li",null,"Low: Faster responses, basic reasoning (default)"),Zn.default.createElement("li",null,"Medium: Balanced performance"),Zn.default.createElement("li",null,"High: Thorough reasoning, slower responses")),!t.capabilities?.includes("reasoning")&&Zn.default.createElement("p",{className:"tw-mt-2 tw-text-warning"},'Enable the "Reasoning" capability above to use this feature.'))})))}qs();ot();var FGr=L(oG());var Cli=["topP","frequencyPenalty","reasoningEffort","verbosity"];function kGr(){let t=ae(),e=i_(),r=t.activeModels.find(I=>`${I.name}|${I.provider}`===e),[n,o]=(0,sr.useState)(r),i=q1e(),[a,s]=zUr(),u=B1e(),l=I=>I?i.some(j=>j.title===I):!1,c=l(a)?a:l(u)?u:"",[d,f]=(0,sr.useState)(Tue()),[p,m]=(0,sr.useState)(!1),h=(0,sr.useRef)(null);(0,sr.useEffect)(()=>{o(r)},[r]),(0,sr.useEffect)(()=>{p&&h.current&&h.current.scrollIntoView({behavior:"smooth",block:"end"})},[p]);let y=(0,sr.useMemo)(()=>(0,FGr.default)(I=>{let j=t.activeModels.map(A=>`${A.name}|${A.provider}`===e?I:A);Ue("activeModels",j)},500),[t.activeModels,e]);(0,sr.useEffect)(()=>()=>{y.flush(),y.cancel()},[y]);let g=(0,sr.useCallback)(I=>{if(I||y.flush(),I){let j=Tue();f(j),j||m(!1)}},[y]),b=(0,sr.useCallback)((I,j)=>{if(!n)return;let A={...n,[I]:j};o(A),y(A)},[n,y]),_=(0,sr.useCallback)(I=>{if(!n)return;let j={...n};delete j[I],o(j),y(j)},[n,y]),w=(0,sr.useCallback)(()=>{if(n){let I={...n};Cli.forEach(j=>delete I[j]),o(I),y(I)}s(""),f(!1),m(!1),Oue(!1)},[n,y,s]),O=I=>{I?m(!0):(f(!1),m(!1),Oue(!1))},T=()=>{f(!0),m(!1),Oue(!0)},P=()=>{m(!1)},M=()=>{if(!c)return;let I=b0(c);app.workspace.openLinkText(I,"",!0)};return n?sr.default.createElement(LU,{onOpenChange:g},sr.default.createElement(pn,null,sr.default.createElement(mn,{asChild:!0},sr.default.createElement(FU,{asChild:!0},sr.default.createElement(ge,{variant:"ghost2",size:"icon"},sr.default.createElement(ore,{className:"tw-size-4"})))),sr.default.createElement(sn,null,"Chat Settings")),sr.default.createElement(r$,{className:"tw-w-80 tw-rounded-md tw-p-0",align:"end"},sr.default.createElement("div",{className:"tw-flex tw-max-h-[500px] tw-flex-col"},sr.default.createElement("div",{className:"tw-shrink-0 tw-border-b tw-px-4"},sr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},sr.default.createElement("h3",{className:"tw-font-semibold"},"Chat Settings"),sr.default.createElement(ge,{variant:"ghost",size:"sm",onClick:w,className:"tw-h-8 tw-text-xs"},sr.default.createElement(t4,{className:"tw-mr-1 tw-size-3"}),"Reset"))),sr.default.createElement(Px,null),sr.default.createElement(BU,{className:"tw-flex-1 tw-overflow-y-auto"},sr.default.createElement("div",{className:"tw-space-y-4 tw-p-4"},sr.default.createElement("div",{className:"tw-space-y-2"},sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},sr.default.createElement(im,{htmlFor:"system-prompt",className:"tw-text-sm sm:tw-min-w-fit"},"System Prompt"),sr.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2 sm:tw-flex-1"},sr.default.createElement(wA,{value:c,onChange:I=>{let j=I.target.value;j&&l(j)&&s(j)},options:i.map(I=>({label:I.title===u?`${I.title} (Default)`:I.title,value:I.title})),placeholder:"Select system prompt",containerClassName:"tw-flex-1"}),sr.default.createElement(ge,{variant:"ghost",size:"icon",onClick:M,className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Open the source file",disabled:!c},sr.default.createElement(MN,{className:"tw-size-5"}))))),sr.default.createElement(F$e,{model:n,settings:t,onChange:b,onReset:_,showTokenLimit:!0}),sr.default.createElement(Px,null),sr.default.createElement("div",{className:"tw-space-y-3"},sr.default.createElement("div",{className:"tw-space-y-1.5"},sr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},sr.default.createElement(im,{htmlFor:"disable-builtin",className:"tw-text-sm tw-font-medium"},"Disable Builtin System Prompt"),sr.default.createElement(cx,{checked:d,onCheckedChange:O,disabled:p})),sr.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."," ",sr.default.createElement("span",{className:"tw-text-xs tw-text-error"},"WARNING: This may break expected functionality."))),(d||p)&&sr.default.createElement("div",{ref:h,className:"tw-rounded-md tw-border tw-bg-error/10 tw-p-3 tw-border-error/50"},sr.default.createElement("div",{className:"tw-flex tw-gap-2"},sr.default.createElement(_m,{className:"tw-mt-0.5 tw-size-4 tw-shrink-0 tw-text-error"}),sr.default.createElement("div",{className:"tw-flex-1 tw-space-y-2"},sr.default.createElement("div",{className:"tw-space-y-1"},sr.default.createElement("div",{className:"tw-text-xs tw-font-semibold tw-text-error"},"Copilot Plus Features Will Become Unavailable"),sr.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-gap-2 tw-text-xs tw-leading-relaxed tw-text-muted"},sr.default.createElement("div",null,"When enabled, advanced features such as vault search, web search, and agent mode will become unavailable."," "),sr.default.createElement("div",{className:"tw-italic"},"Only your custom system prompt (configured in Settings) will be used."))),p&&sr.default.createElement("div",{className:"tw-flex tw-gap-2 tw-pt-1"},sr.default.createElement(ge,{size:"sm",variant:"destructive",onClick:T,className:"tw-h-7 tw-text-xs"},"Disable Builtin"),sr.default.createElement(ge,{size:"sm",variant:"ghost",onClick:P,className:"tw-h-7 tw-bg-transparent tw-text-xs"},"Cancel")))))))),sr.default.createElement(Px,null),sr.default.createElement("div",{className:"tw-shrink-0 tw-rounded-md tw-bg-primary tw-px-4 tw-py-1"},sr.default.createElement("div",{className:"tw-flex tw-flex-row tw-flex-wrap"},sr.default.createElement("span",{className:"tw-text-xs tw-text-normal"},sr.default.createElement("span",{className:" tw-italic"},"System Prompt and Disable Builtin System Prompt")," ",sr.default.createElement("strong",null,"apply to this chat session only"),";",sr.default.createElement("br",null),"other settings are ",sr.default.createElement("strong",null,"bound to the current model"),".")))))):null}async function xli(){try{let{getSettings:t}=await Promise.resolve().then(()=>(ot(),See));if(t().enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().indexVaultToVectorStore(!1);new Db.Notice(`Semantic search index refreshed with ${n} documents.`)}else new Db.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error refreshing vault index:",t),new Db.Notice("Failed to refresh vault index. Check console for details.")}}async function Oli(){try{let{getSettings:t}=await Promise.resolve().then(()=>(ot(),See));if(t().enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().indexVaultToVectorStore(!0);new Db.Notice(`Semantic search index rebuilt with ${n} documents.`)}else new Db.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error force reindexing vault:",t),new Db.Notice("Failed to force reindex vault. Check console for details.")}}async function k$e(){let t=Uu();if(!t){new Db.Notice("No project is currently selected to reload.");return}try{SO(!0),await Yv.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new Db.Notice(`Project context for "${t.name}" reloaded successfully.`);else throw new Error("Copilot plugin or ProjectManager not available.")}catch(e){ne("Error reloading project context:",e),$1(e)||new Db.Notice("Failed to reload project context. Check console for details.")}finally{SO(!1)}}async function Tli(){let t=Uu();if(!t){new Db.Notice("No project is currently selected to rebuild.");return}new vl(app,async()=>{try{SO(!0),new Db.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),Oie.resetRateLimitNoticeTimer(),await Yv.getInstance().clearForProject(t),new Db.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 Db.Notice(`Project context for "${t.name}" rebuilt successfully from scratch.`);else throw new Error("Copilot plugin or ProjectManager not available for rebuild.")}catch(r){ne("Error force rebuilding project context:",r),$1(r)||new Db.Notice("Failed to force rebuild project context. Check console for details.")}finally{SO(!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 qGr({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o,chatHistory:i,onUpdateChatTitle:a,onDeleteChat:s,onLoadChat:u,onOpenSourceFile:l,latestTokenCount:c}){let d=zr(),[f,p]=Cv(),m=rG(),h=y=>{p(y),n(y),y!=="project"&&(Fz(null),o?.())};return dr.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},dr.default.createElement("div",{className:"tw-flex-1"},dr.default.createElement(Uce,null,dr.default.createElement(Bce,{asChild:!0},dr.default.createElement(ge,{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"&&dr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},dr.default.createElement(uy,{className:"tw-size-4"}),"copilot plus"),f==="project"&&"projects (alpha)",dr.default.createElement(ts,{className:"tw-mt-0.5 tw-size-5"}))),dr.default.createElement(K_,{align:"start"},dr.default.createElement(Ii,{onSelect:()=>{h("llm_chain")}},"chat (free)"),dr.default.createElement(Ii,{onSelect:()=>{h("vault_qa")}},"vault QA (free)"),m?dr.default.createElement(Ii,{onSelect:()=>{h("copilot_plus")}},dr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},dr.default.createElement(uy,{className:"tw-size-4"}),"copilot plus")):dr.default.createElement(Ii,{onSelect:()=>{n4(pN.CHAT_MODE_SELECT),o?.()}},"copilot plus",dr.default.createElement(DN,{className:"tw-size-3"})),m?dr.default.createElement(Ii,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{h("project")}},dr.default.createElement(e4,{className:"tw-size-4"}),"projects (alpha)"):dr.default.createElement(Ii,{onSelect:()=>{n4(pN.CHAT_MODE_SELECT),o?.()}},"copilot plus",dr.default.createElement(DN,{className:"tw-size-3"}))))),dr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},dr.default.createElement("div",{className:"tw-mr-2"},dr.default.createElement(i8r,{tokenCount:c??null})),dr.default.createElement(pn,null,dr.default.createElement(mn,{asChild:!0},dr.default.createElement(ge,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},dr.default.createElement(tre,{className:"tw-size-4"}))),dr.default.createElement(sn,null,"New Chat")),f!=="project"&&dr.default.createElement(kGr,null),!d.autosaveChat&&dr.default.createElement(pn,null,dr.default.createElement(mn,{asChild:!0},dr.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},dr.default.createElement(Bte,{className:"tw-size-4"}))),dr.default.createElement(sn,null,"Save Chat as Note")),dr.default.createElement(pn,null,dr.default.createElement(o8r,{chatHistory:i,onUpdateTitle:a,onDeleteChat:s,onLoadChat:u,onOpenSourceFile:l},dr.default.createElement(mn,{asChild:!0},dr.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},dr.default.createElement(Zte,{className:"tw-size-4"})))),dr.default.createElement(sn,null,"Chat History")),dr.default.createElement(Uce,null,dr.default.createElement(Bce,{asChild:!0},dr.default.createElement(ge,{variant:"ghost2",size:"icon",title:"Advanced Settings"},dr.default.createElement(JL,{className:"tw-size-4"}))),dr.default.createElement(K_,{align:"end",className:"tw-w-64"},dr.default.createElement(Ii,{className:"tw-flex tw-justify-between",onSelect:y=>{y.preventDefault(),Ue("showSuggestedPrompts",!d.showSuggestedPrompts)}},dr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},dr.default.createElement(uy,{className:"tw-size-4"}),"Suggested Prompt"),dr.default.createElement(cx,{checked:d.showSuggestedPrompts})),dr.default.createElement(Ii,{className:"tw-flex tw-justify-between",onSelect:y=>{y.preventDefault(),Ue("showRelevantNotes",!d.showRelevantNotes)}},dr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},dr.default.createElement(Ju,{className:"tw-size-4"}),"Relevant Note"),dr.default.createElement(cx,{checked:d.showRelevantNotes})),dr.default.createElement(Ii,{className:"tw-flex tw-justify-between",onSelect:y=>{y.preventDefault(),Ue("autoAcceptEdits",!d.autoAcceptEdits)}},dr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},dr.default.createElement(uS,{className:"tw-size-4"}),"Auto-accept Edits"),dr.default.createElement(cx,{checked:d.autoAcceptEdits})),f==="project"?dr.default.createElement(dr.default.Fragment,null,dr.default.createElement(Ii,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>k$e()},dr.default.createElement(WL,{className:"tw-size-4"}),"Reload Current Project"),dr.default.createElement(Ii,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>Tli()},dr.default.createElement(_m,{className:"tw-size-4"}),"Force Rebuild Context")):dr.default.createElement(dr.default.Fragment,null,dr.default.createElement(Ii,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>xli()},dr.default.createElement(WL,{className:"tw-size-4"}),"Refresh Vault Index"),dr.default.createElement(Ii,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new vl(app,()=>Oli(),"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()}},dr.default.createElement(_m,{className:"tw-size-4"}),"Force Reindex Vault"))))))}qs();Bc();var q$e=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()}};to();var Q_=L(X());to();ot();Zt();Jr();kn();pL();function U$e({disabled:t=!1,size:e="fit",variant:r="ghost2",className:n,value:o,onChange:i}){let[a,s]=(0,Q_.useState)(null),u=zr(),l=u.activeModels.find(d=>d.enabled&&oo(d)===o),c=u.activeModels.filter(d=>age(d)||!wRt(d.provider)?!0:!!ab(d.provider,d));return Q_.default.createElement(yA,null,Q_.default.createElement(bA,{asChild:!0},Q_.default.createElement(ge,{variant:r,size:e,disabled:t,className:Te("tw-min-w-0 tw-justify-start tw-text-muted",n)},Q_.default.createElement("div",{className:"tw-min-w-0 tw-flex-1 tw-truncate"},a?Q_.default.createElement("span",{className:"tw-truncate tw-text-error"},"Model Load Failed"):l?Q_.default.createElement(xmt,{model:l,iconSize:8}):Q_.default.createElement("span",{className:"tw-truncate"},"Select Model")),!t&&Q_.default.createElement(ts,{className:"tw-mt-0.5 tw-size-5 tw-shrink-0"}))),Q_.default.createElement(K_,{align:"start",className:"tw-max-h-64 tw-overflow-y-auto"},c.filter(d=>d.enabled).map(d=>{let{hasApiKey:f,errorNotice:p}=HW(d,u);return Q_.default.createElement(Ii,{key:oo(d),onSelect:async m=>{!f&&p&&s(p);try{s(null),i(oo(d))}catch(h){let y="Model switch failed: "+Sn(h);s(y);let g=c.find(b=>b.enabled&&oo(b)===o);g&&i(oo(g))}},className:f?"":"tw-opacity-70"},Q_.default.createElement(xmt,{model:d,iconSize:12}))})))}var or=L(X());Jr();to();Bc();kn();ot();Zt();var UGr=({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=sb(d),p=f&&d!=="project",m=()=>{let b=!a;s(b),Ue("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?or.default.createElement(jb,{delayDuration:0},or.default.createElement("div",{className:"tw-hidden tw-items-center tw-gap-1.5 @[420px]/chat-input:tw-flex"},p&&or.default.createElement(pn,null,or.default.createElement(mn,{asChild:!0},or.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:m,className:Te("tw-text-muted hover:tw-text-accent",a&&"tw-text-accent tw-bg-accent/10")},or.default.createElement(L6,{className:"tw-size-4"}))),or.default.createElement(sn,{className:"tw-px-1 tw-py-0.5"},"Toggle autonomous agent mode")),!a&&or.default.createElement(or.default.Fragment,null,or.default.createElement(pn,null,or.default.createElement(mn,{asChild:!0},or.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:h,className:Te("tw-text-muted hover:tw-text-accent",t&&"tw-text-accent tw-bg-accent/10")},or.default.createElement(RN,{className:"tw-size-4"}))),or.default.createElement(sn,{className:"tw-px-1 tw-py-0.5"},"Toggle vault search")),or.default.createElement(pn,null,or.default.createElement(mn,{asChild:!0},or.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:y,className:Te("tw-text-muted hover:tw-text-accent",r&&"tw-text-accent tw-bg-accent/10")},or.default.createElement(cl,{className:"tw-size-4"}))),or.default.createElement(sn,{className:"tw-px-1 tw-py-0.5"},"Toggle web search")),or.default.createElement(pn,null,or.default.createElement(mn,{asChild:!0},or.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:g,className:Te("tw-text-muted hover:tw-text-accent",o&&"tw-text-accent tw-bg-accent/10")},or.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},or.default.createElement(uy,{className:"tw-size-2"}),or.default.createElement(pb,{className:"tw-size-3"})))),or.default.createElement(sn,{className:"tw-px-1 tw-py-0.5"},"Toggle composer (note editing)")))),or.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5 @[420px]/chat-input:tw-hidden"},or.default.createElement(yA,null,or.default.createElement(bA,{asChild:!0},or.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent"},or.default.createElement(Av,{className:"tw-size-4"}))),or.default.createElement(K_,{align:"end",className:"tw-w-56"},p&&or.default.createElement(Ii,{onClick:m,className:"tw-flex tw-items-center tw-justify-between"},or.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},or.default.createElement(L6,{className:"tw-size-4"}),or.default.createElement("span",null,"Autonomous Agent")),a&&or.default.createElement(Hu,{className:"tw-size-4"})),!a&&or.default.createElement(or.default.Fragment,null,or.default.createElement(Ii,{onClick:h,className:"tw-flex tw-items-center tw-justify-between"},or.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},or.default.createElement(RN,{className:"tw-size-4"}),or.default.createElement("span",null,"Vault Search")),t&&or.default.createElement(Hu,{className:"tw-size-4"})),or.default.createElement(Ii,{onClick:y,className:"tw-flex tw-items-center tw-justify-between"},or.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},or.default.createElement(cl,{className:"tw-size-4"}),or.default.createElement("span",null,"Web Search")),r&&or.default.createElement(Hu,{className:"tw-size-4"})),or.default.createElement(Ii,{onClick:g,className:"tw-flex tw-items-center tw-justify-between"},or.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},or.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},or.default.createElement(uy,{className:"tw-size-2"}),or.default.createElement(pb,{className:"tw-size-3"})),or.default.createElement("span",null,"Composer")),o&&or.default.createElement(Hu,{className:"tw-size-4"}))),a&&or.default.createElement(or.default.Fragment,null,or.default.createElement(Ii,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},or.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},or.default.createElement(RN,{className:"tw-size-4"}),or.default.createElement("span",null,"Vault Search"))),or.default.createElement(Ii,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},or.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},or.default.createElement(cl,{className:"tw-size-4"}),or.default.createElement("span",null,"Web Search"))),or.default.createElement(Ii,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},or.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},or.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},or.default.createElement(uy,{className:"tw-size-2"}),or.default.createElement(pb,{className:"tw-size-3"})),or.default.createElement("span",null,"Composer")))))))):null};Zt();CX();ot();Zt();Jr();var zde=require("obsidian"),zt=L(X());var bbt={};Rn(bbt,{$addUpdateTag:()=>Y7r,$applyNodeReplacement:()=>Sde,$caretFromPoint:()=>oB,$caretRangeFromSelection:()=>Ayt,$cloneWithProperties:()=>iXr,$comparePointCaretNext:()=>hbt,$copyNode:()=>lbt,$create:()=>ndi,$createLineBreakNode:()=>gZ,$createNodeSelection:()=>Gyt,$createParagraphNode:()=>m$,$createPoint:()=>$x,$createRangeSelection:()=>M7r,$createRangeSelectionFromDom:()=>Eci,$createTabNode:()=>_Le,$createTextNode:()=>$h,$extendCaretToRange:()=>pbt,$getAdjacentChildCaret:()=>OZ,$getAdjacentNode:()=>X7r,$getAdjacentSiblingOrParentSiblingCaret:()=>ddi,$getCaretInDirection:()=>iB,$getCaretRange:()=>nB,$getCaretRangeInDirection:()=>ybt,$getCharacterOffsets:()=>xyt,$getChildCaret:()=>y$,$getChildCaretAtIndex:()=>pXr,$getChildCaretOrSelf:()=>uXr,$getCollapsedCaretRange:()=>lXr,$getCommonAncestor:()=>ade,$getCommonAncestorResultBranchOrder:()=>gbt,$getEditor:()=>cbt,$getNearestNodeFromDOMNode:()=>OLe,$getNearestRootOrShadowRoot:()=>eXr,$getNodeByKey:()=>Jm,$getNodeByKeyOrThrow:()=>tXr,$getPreviousSelection:()=>a3,$getRoot:()=>rv,$getSelection:()=>Ls,$getSiblingCaret:()=>Uh,$getState:()=>eLe,$getStateChange:()=>tci,$getTextContent:()=>Ici,$getTextNodeOffset:()=>Dx,$getTextPointCaret:()=>rB,$getTextPointCaretSlice:()=>Iyt,$getWritableNodeState:()=>qyt,$hasAncestor:()=>mLe,$hasUpdateTag:()=>Zci,$insertNodes:()=>Mci,$isBlockElementNode:()=>Tci,$isChildCaret:()=>jx,$isDecoratorNode:()=>Lu,$isElementNode:()=>Ze,$isExtendableTextPointCaret:()=>fXr,$isInlineElementOrDecoratorNode:()=>Yci,$isLeafNode:()=>Kci,$isLineBreakNode:()=>YJ,$isNodeCaret:()=>adi,$isNodeSelection:()=>vLe,$isParagraphNode:()=>kci,$isRangeSelection:()=>un,$isRootNode:()=>ev,$isRootOrShadowRoot:()=>Lx,$isSiblingCaret:()=>i3,$isTabNode:()=>Kyt,$isTextNode:()=>Pr,$isTextPointCaret:()=>h$,$isTextPointCaretSlice:()=>cdi,$isTokenOrSegmented:()=>c$,$isTokenOrTab:()=>ZU,$nodesOfType:()=>Xci,$normalizeCaret:()=>Ax,$normalizeSelection__EXPERIMENTAL:()=>tLe,$onUpdate:()=>Q7r,$parseSerializedNode:()=>Nci,$removeTextFromCaretRange:()=>dXr,$rewindSiblingCaret:()=>MZ,$selectAll:()=>Gci,$setCompositionKey:()=>Fh,$setPointFromCaret:()=>TZ,$setSelection:()=>nv,$setSelectionFromCaretRange:()=>cXr,$setState:()=>rci,$splitAtPointCaretNext:()=>mdi,$splitNode:()=>Qci,$updateRangeSelectionFromCaretRange:()=>sde,ArtificialNode__DO_NOT_USE:()=>dLe,BLUR_COMMAND:()=>m7r,CAN_REDO_COMMAND:()=>mci,CAN_UNDO_COMMAND:()=>hci,CLEAR_EDITOR_COMMAND:()=>fci,CLEAR_HISTORY_COMMAND:()=>pci,CLICK_COMMAND:()=>X9r,COLLABORATION_TAG:()=>$7r,COMMAND_PRIORITY_CRITICAL:()=>Vci,COMMAND_PRIORITY_EDITOR:()=>qci,COMMAND_PRIORITY_HIGH:()=>zci,COMMAND_PRIORITY_LOW:()=>Uci,COMMAND_PRIORITY_NORMAL:()=>Bci,CONTROLLED_TEXT_INSERTION_COMMAND:()=>cZ,COPY_COMMAND:()=>Hyt,CUT_COMMAND:()=>Jyt,DELETE_CHARACTER_COMMAND:()=>mde,DELETE_LINE_COMMAND:()=>gde,DELETE_WORD_COMMAND:()=>hde,DRAGEND_COMMAND:()=>f7r,DRAGOVER_COMMAND:()=>d7r,DRAGSTART_COMMAND:()=>c7r,DROP_COMMAND:()=>l7r,DecoratorNode:()=>yde,ElementNode:()=>tB,FOCUS_COMMAND:()=>p7r,FORMAT_ELEMENT_COMMAND:()=>dci,FORMAT_TEXT_COMMAND:()=>GU,HISTORIC_TAG:()=>jci,HISTORY_MERGE_TAG:()=>X$e,HISTORY_PUSH_TAG:()=>Dci,INDENT_CONTENT_COMMAND:()=>lci,INSERT_LINE_BREAK_COMMAND:()=>rde,INSERT_PARAGRAPH_COMMAND:()=>hyt,INSERT_TAB_COMMAND:()=>uci,INTERNAL_$isBlock:()=>p$,IS_ALL_FORMATTING:()=>D9r,IS_BOLD:()=>$li,IS_CODE:()=>Fli,IS_HIGHLIGHT:()=>gLe,IS_ITALIC:()=>Lli,IS_STRIKETHROUGH:()=>lde,IS_SUBSCRIPT:()=>kli,IS_SUPERSCRIPT:()=>qli,IS_UNDERLINE:()=>cde,KEY_ARROW_DOWN_COMMAND:()=>n7r,KEY_ARROW_LEFT_COMMAND:()=>e7r,KEY_ARROW_RIGHT_COMMAND:()=>Y9r,KEY_ARROW_UP_COMMAND:()=>r7r,KEY_BACKSPACE_COMMAND:()=>i7r,KEY_DELETE_COMMAND:()=>s7r,KEY_DOWN_COMMAND:()=>Z9r,KEY_ENTER_COMMAND:()=>iLe,KEY_ESCAPE_COMMAND:()=>a7r,KEY_MODIFIER_COMMAND:()=>h7r,KEY_SPACE_COMMAND:()=>o7r,KEY_TAB_COMMAND:()=>u7r,LineBreakNode:()=>hZ,MOVE_TO_END:()=>Q9r,MOVE_TO_START:()=>t7r,NODE_STATE_KEY:()=>Kli,OUTDENT_CONTENT_COMMAND:()=>cci,PASTE_COMMAND:()=>Byt,PASTE_TAG:()=>$ci,ParagraphNode:()=>_Z,REDO_COMMAND:()=>Vyt,REMOVE_TEXT_COMMAND:()=>gyt,RootNode:()=>bZ,SELECTION_CHANGE_COMMAND:()=>Uyt,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>sci,SELECT_ALL_COMMAND:()=>yyt,SKIP_COLLAB_TAG:()=>Lci,SKIP_DOM_SELECTION_TAG:()=>F7r,SKIP_SCROLL_INTO_VIEW_TAG:()=>L7r,TEXT_TYPE_TO_FORMAT:()=>Ly,TabNode:()=>yZ,TextNode:()=>r3,UNDO_COMMAND:()=>zyt,buildImportMap:()=>bci,createCommand:()=>To,createEditor:()=>Hci,createSharedNodeState:()=>B9r,createState:()=>eci,flipDirection:()=>aB,getDOMOwnerDocument:()=>sbt,getDOMSelection:()=>OA,getDOMSelectionFromTarget:()=>rXr,getDOMTextNode:()=>o3,getEditorPropertyFromDOMNode:()=>vde,getNearestEditorFromDOMNode:()=>rbt,getRegisteredNode:()=>ebt,getRegisteredNodeOrThrow:()=>Qyt,isBlockDomNode:()=>Pyt,isCurrentlyReadOnlyMode:()=>EZ,isDOMDocumentNode:()=>U7r,isDOMNode:()=>PZ,isDOMTextNode:()=>TA,isDOMUnmanaged:()=>sXr,isDocumentFragment:()=>nXr,isExactShortcutMatch:()=>Qs,isHTMLAnchorElement:()=>edi,isHTMLElement:()=>Fb,isInlineDomNode:()=>oXr,isLexicalEditor:()=>CLe,isModifierMatch:()=>G7r,isSelectionCapturedInDecoratorInput:()=>tbt,isSelectionWithinEditor:()=>_de,makeStepwiseIterator:()=>mbt,removeFromParent:()=>YU,resetRandomKey:()=>Jci,setDOMUnmanaged:()=>rdi,setNodeIndentFromDOM:()=>aXr});function Qe(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 Fx=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Eli=Fx&&"documentMode"in document?document.documentMode:null,xA=Fx&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),QJ=Fx&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Z$e=!(!Fx||!("InputEvent"in window)||Eli)&&"getTargetRanges"in new window.InputEvent("input"),ude=Fx&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),pZ=Fx&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Pli=Fx&&/Android/.test(navigator.userAgent),N9r=Fx&&/^(?=.*Chrome).*/i.test(navigator.userAgent),BGr=Fx&&Pli&&N9r,Y$e=Fx&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!N9r;function Q$e(...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 Mli=1,Ili=3,Rli=9,Ali=11,e3=0,j9r=1,mZ=2,Nli=0,jli=1,Dli=2,$li=1,Lli=2,lde=4,cde=8,Fli=16,kli=32,qli=64,gLe=128,D9r=1792|(112|(3|lde|cde)|gLe),Nyt=1,jyt=2,Dyt=3,$yt=4,Lyt=5,Fyt=6,yLe=ude||pZ||Y$e?"\xA0":"\u200B",g$=`
|
||
|
||
`,Uli=QJ?"\xA0":yLe,$9r="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",L9r="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Bli=new RegExp("^[^"+L9r+"]*["+$9r+"]"),zli=new RegExp("^[^"+$9r+"]*["+L9r+"]"),Ly={bold:1,capitalize:1024,code:16,highlight:gLe,italic:2,lowercase:256,strikethrough:lde,subscript:32,superscript:64,underline:cde,uppercase:512},Vli={directionless:1,unmergeable:2},zGr={center:jyt,end:Fyt,justify:$yt,left:Nyt,right:Dyt,start:Lyt},Hli={[jyt]:"center",[Fyt]:"end",[$yt]:"justify",[Nyt]:"left",[Dyt]:"right",[Lyt]:"start"},Jli={normal:0,segmented:2,token:1},Wli={[Nli]:"normal",[Dli]:"segmented",[jli]:"token"},Kli="$",VGr="$config";function F9r(t,e,r,n,o,i){let a=t.getFirstChild();for(;a!==null;){let s=a.__key;a.__parent===e&&(Ze(a)&&F9r(a,s,r,n,o,i),r.has(s)||i.delete(s),o.push(s)),a=a.getNextSibling()}}var Gli=100,ayt=!1,kyt=0;function Xli(t){kyt=t.timeStamp}function Wgt(t,e,r){let n=t.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(t===o||n&&t.previousSibling===o)||n&&xLe(t,r)!==void 0}function Zli(t,e,r){let n=OA(R0(r)),o=null,i=null;n!==null&&n.anchorNode===t&&(o=n.anchorOffset,i=n.focusOffset);let a=t.nodeValue;a!==null&&ibt(e,a,o,i,!1)}function Yli(t,e,r){if(un(t)){let n=t.anchor.getNode();if(n.is(r)&&t.format!==n.getFormat())return!1}return TA(e)&&r.isAttached()}function Qli(t,e,r,n){for(let o=t;o&&!sXr(o);o=wde(o)){let i=xLe(o,e);if(i!==void 0){let a=Jm(i,r);if(a)return Lu(a)||!Fb(o)?void 0:[o,a]}else if(o===n)return[n,H7r(r)]}}function k9r(t,e,r){ayt=!0;let n=performance.now()-kyt>Gli;try{ww(t,()=>{let o=Ls()||function(f){return f.getEditorState().read(()=>{let p=Ls();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=Qli(h,t,s,a);if(!y)continue;let[g,b]=y;if(m==="characterData")n&&Pr(b)&&TA(h)&&Yli(o,h,b)&&Zli(h,b,t);else if(m==="childList"){l=!0;let _=p.addedNodes;for(let T=0;T<_.length;T++){let P=_[T],M=z7r(P),I=P.parentNode;if(I!=null&&P!==u&&M===null&&!Wgt(P,I,t)){if(QJ){let j=(Fb(P)?P.innerText:null)||P.nodeValue;j&&(c+=j)}I.removeChild(P)}}let w=p.removedNodes,O=w.length;if(O>0){let T=0;for(let P=0;P<O;P++){let M=w[P];(Wgt(M,h,t)||u===M)&&(h.appendChild(M),T++)}O!==T&&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"||Wgt(g,h,t)||b.removeChild(g)}}r.takeRecords()}o!==null&&(l&&nv(o),QJ&&Z7r(t)&&o.insertRawText(c))})}finally{ayt=!1}}function q9r(t){let e=t._observer;e!==null&&k9r(t,e.takeRecords(),e)}function U9r(t){(function(e){kyt===0&&R0(e).addEventListener("textInput",Xli,!0)})(t),t._observer=new MutationObserver((e,r)=>{k9r(t,e,r)})}var syt=class{constructor(e,r){this.key=e,this.parse=r.parse.bind(r),this.unparse=(r.unparse||nci).bind(r),this.isEqual=(r.isEqual||Object.is).bind(r),this.defaultValue=this.parse(void 0)}};function eci(t,e){return new syt(t,e)}function eLe(t,e,r="latest"){let n=(r==="latest"?t.getLatest():t).__state;return n?n.getValue(e):e.defaultValue}function tci(t,e,r){let n=eLe(t,r,"direct"),o=eLe(e,r,"direct");return r.isEqual(n,o)?null:[n,o]}function rci(t,e,r){let n;if(Lh(),typeof r=="function"){let i=t.getLatest(),a=eLe(i,e);if(n=r(a),e.isEqual(a,n))return i}else n=r;let o=t.getWritable();return qyt(o).updateFromKnown(e,n),o}function B9r(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}=dbt(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 uyt=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 HGr(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=HGr(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 qyt(t){let e=t.getWritable(),r=e.__state?e.__state.getWritable(e):new uyt(e,z9r(e));return e.__state=r,r}function z9r(t){return t.__state?t.__state.sharedNodeState:Qyt(cbt(),t.getType()).sharedNodeState}function HGr(t){if(t)for(let e in t)return t}function nci(t){return t}function JGr(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 WGr(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 KGr(t,e){let r=t.__state;return r&&r.node===t?r.getWritable(e):r}function GGr(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&&JGr(f,c,d)||d&&JGr(f,d,c)||c&&WGr(f,c,d)||d&&WGr(f,d,c))}(u,l))}function XGr(t,e){let r=t.mergeWithSibling(e),n=ec()._normalizedNodes;return n.add(t.__key),n.add(e.__key),r}function ZGr(t){let e,r,n=t;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&Pr(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(GGr(e,n)){n=XGr(e,n);break}break}e.remove()}for(;(r=n.getNextSibling())!==null&&Pr(r)&&r.isSimpleText()&&!r.isUnmergeable();){if(r.__text!==""){if(GGr(n,r)){n=XGr(n,r);break}break}r.remove()}}else n.remove()}function tLe(t){return YGr(t.anchor),YGr(t.focus),t}function YGr(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),Pr(n)){t.set(n.__key,o?n.getTextContentSize():0,"text",!0);break}if(!Ze(n))break;t.set(n.__key,o?n.getChildrenSize():0,"element",!0)}}var QU,Lb,dde,bLe,lyt,cyt,t3,Nx,dyt,fde,Hm="",$b="",SA=null,CA="",d$="",V9r=!1,pde=!1,W$e=null;function rLe(t,e){let r=t3.get(t);if(e!==null){let n=myt(t);n.parentNode===e&&e.removeChild(n)}if(Nx.has(t)||Lb._keyToDOMMap.delete(t),Ze(r)){let n=oLe(r,t3);fyt(n,0,n.length-1,null)}r!==void 0&&abt(fde,dde,bLe,r,"destroyed")}function fyt(t,e,r,n){let o=e;for(;o<=r;++o){let i=t[o];i!==void 0&&rLe(i,n)}}function XJ(t,e){t.setProperty("text-align",e)}var oci="40px";function H9r(t,e){let r=QU.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")||oci;t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function J9r(t,e){let r=t.style;e===0?XJ(r,""):e===Nyt?XJ(r,"left"):e===jyt?XJ(r,"center"):e===Dyt?XJ(r,"right"):e===$yt?XJ(r,"justify"):e===Lyt?XJ(r,"start"):e===Fyt&&XJ(r,"end")}function nLe(t,e){let r=Nx.get(t);r===void 0&&Qe(60);let n=r.createDOM(QU,Lb);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,Lb),Pr(r)?n.setAttribute("data-lexical-text","true"):Lu(r)&&n.setAttribute("data-lexical-decorator","true"),Ze(r)){let o=r.__indent,i=r.__size;if(o!==0&&H9r(n,o),i!==0){let s=i-1;(function(u,l,c,d){let f=$b;$b="",pyt(u,c,0,l,c.getDOMSlot(d)),K9r(c,d),$b=f})(oLe(r,Nx),s,r,n)}let a=r.__format;a!==0&&J9r(n,a),r.isInline()||W9r(null,r,n),TLe(r)&&(Hm+=g$,d$+=g$)}else{let o=r.getTextContent();if(Lu(r)){let i=r.decorate(Lb,QU);i!==null&&G9r(t,i),n.contentEditable="false"}else Pr(r)&&(r.isDirectionless()||($b+=o));Hm+=o,d$+=o}return e!==null&&e.insertChild(n),abt(fde,dde,bLe,r,"created"),n}function pyt(t,e,r,n,o){let i=Hm;Hm="";let a=r;for(;a<=n;++a){nLe(t[a],o);let s=Nx.get(t[a]);s!==null&&Pr(s)&&(SA===null&&(SA=s.getFormat()),CA===""&&(CA=s.getStyle()))}TLe(e)&&(Hm+=g$),o.element.__lexicalTextContent=Hm,Hm=i+Hm}function QGr(t,e){if(t){let r=t.__last;if(r){let n=e.get(r);if(n)return YJ(n)?"line-break":Lu(n)&&n.isInline()?"decorator":null}return"empty"}return null}function W9r(t,e,r){let n=QGr(t,t3),o=QGr(e,Nx);n!==o&&e.getDOMSlot(r).setManagedLineBreak(o)}function K9r(t,e){let r=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(r!==$b||n!==W$e){let o=$b==="",i=o?W$e:function(a){return Bli.test(a)?"rtl":zli.test(a)?"ltr":null}($b);if(i!==n){let a=e.classList,s=QU.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=Q$e(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=Q$e(l);l=s[i]=c}l!==void 0&&a.add(...l)}e.dir=i}pde||(t.getWritable().__dir=i)}W$e=i,e.__lexicalDirTextContent=$b,e.__lexicalDir=i}}function ici(t,e,r){let n=$b;var o;$b="",SA=null,CA="",function(i,a,s){let u=Hm,l=i.__size,c=a.__size;Hm="";let d=s.element;if(l===1&&c===1){let f=i.__first,p=a.__first;if(f===p)tde(f,d);else{let h=myt(f),y=nLe(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}rLe(f,null)}let m=Nx.get(p);Pr(m)&&(SA===null&&(SA=m.getFormat()),CA===""&&(CA=m.getStyle()))}else{let f=oLe(i,t3),p=oLe(a,Nx);if(f.length!==l&&Qe(227),p.length!==c&&Qe(228),l===0)c!==0&&pyt(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;fyt(f,0,l-1,m?null:d),m&&(d.textContent="")}}else(function(m,h,y,g,b,_){let w=g-1,O=b-1,T,P,M=_.getFirstChild(),I=0,j=0;for(;I<=w&&j<=O;){let V=h[I],q=y[j];if(V===q)M=Kgt(tde(q,_.element)),I++,j++;else{T===void 0&&(T=new Set(h)),P===void 0&&(P=new Set(y));let K=P.has(V),ue=T.has(q);if(K)if(ue){let oe=wZ(Lb,q);oe===M?M=Kgt(tde(q,_.element)):(_.withBefore(M).insertChild(oe),tde(q,_.element)),I++,j++}else nLe(q,_.withBefore(M)),j++;else M=Kgt(myt(V)),rLe(V,_.element),I++}let J=Nx.get(q);J!==null&&Pr(J)&&(SA===null&&(SA=J.getFormat()),CA===""&&(CA=J.getStyle()))}let A=I>w,k=j>O;if(A&&!k){let V=y[O+1],q=V===void 0?null:Lb.getElementByKey(V);pyt(y,m,j,O,_.withBefore(q))}else k&&!A&&fyt(h,I,w,_.element)})(a,f,p,l,c,s)}TLe(a)&&(Hm+=g$),d.__lexicalTextContent=Hm,Hm=u+Hm}(t,e,e.getDOMSlot(r)),K9r(e,r),o=e,SA==null||SA===o.__textFormat||pde||o.setTextFormat(SA),function(i){CA===""||CA===i.__textStyle||pde||i.setTextStyle(CA)}(e),$b=n}function oLe(t,e){let r=[],n=t.__first;for(;n!==null;){let o=e.get(n);o===void 0&&Qe(101),r.push(n),n=o.__next}return r}function tde(t,e){let r=t3.get(t),n=Nx.get(t);r!==void 0&&n!==void 0||Qe(61);let o=V9r||cyt.has(t)||lyt.has(t),i=wZ(Lb,t);if(r===n&&!o){if(Ze(r)){let a=i.__lexicalTextContent;a!==void 0&&(Hm+=a,d$+=a);let s=i.__lexicalDirTextContent;s!==void 0&&($b+=s)}else{let a=r.getTextContent();Pr(r)&&!r.isDirectionless()&&($b+=a),d$+=a,Hm+=a}return i}if(r!==n&&o&&abt(fde,dde,bLe,n,"updated"),n.updateDOM(r,i,QU)){let a=nLe(t,null);return e===null&&Qe(62),e.replaceChild(a,i),rLe(t,null),a}if(Ze(r)&&Ze(n)){let a=n.__indent;a!==r.__indent&&H9r(i,a);let s=n.__format;s!==r.__format&&J9r(i,s),o&&(ici(r,n,i),ev(n)||n.isInline()||W9r(r,n,i)),TLe(n)&&(Hm+=g$,d$+=g$)}else{let a=n.getTextContent();if(Lu(n)){let s=n.decorate(Lb,QU);s!==null&&G9r(t,s)}else Pr(n)&&!n.isDirectionless()&&($b+=a);Hm+=a,d$+=a}if(!pde&&ev(n)&&n.__cachedText!==d$){let a=n.getWritable();a.__cachedText=d$,n=a}return i}function G9r(t,e){let r=Lb._pendingDecorators,n=Lb._decorators;if(r===null){if(n[t]===e)return;r=V7r(Lb)}r[t]=e}function Kgt(t){let e=t.nextSibling;return e!==null&&e===Lb._blockCursorElement&&(e=e.nextSibling),e}function aci(t,e,r,n,o,i){Hm="",d$="",$b="",V9r=n===mZ,W$e=null,Lb=r,QU=r._config,dde=r._nodes,bLe=Lb._listeners.mutation,lyt=o,cyt=i,t3=t._nodeMap,Nx=e._nodeMap,pde=e._readOnly,dyt=new Map(r._keyToDOMMap);let a=new Map;return fde=a,tde("root",null),Lb=void 0,dde=void 0,lyt=void 0,cyt=void 0,t3=void 0,Nx=void 0,QU=void 0,dyt=void 0,fde=void 0,a}function myt(t){let e=dyt.get(t);return e===void 0&&Qe(75,t),e}function To(t){return{type:t}}var Uyt=To("SELECTION_CHANGE_COMMAND"),sci=To("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),X9r=To("CLICK_COMMAND"),mde=To("DELETE_CHARACTER_COMMAND"),rde=To("INSERT_LINE_BREAK_COMMAND"),hyt=To("INSERT_PARAGRAPH_COMMAND"),cZ=To("CONTROLLED_TEXT_INSERTION_COMMAND"),Byt=To("PASTE_COMMAND"),gyt=To("REMOVE_TEXT_COMMAND"),hde=To("DELETE_WORD_COMMAND"),gde=To("DELETE_LINE_COMMAND"),GU=To("FORMAT_TEXT_COMMAND"),zyt=To("UNDO_COMMAND"),Vyt=To("REDO_COMMAND"),Z9r=To("KEYDOWN_COMMAND"),Y9r=To("KEY_ARROW_RIGHT_COMMAND"),Q9r=To("MOVE_TO_END"),e7r=To("KEY_ARROW_LEFT_COMMAND"),t7r=To("MOVE_TO_START"),r7r=To("KEY_ARROW_UP_COMMAND"),n7r=To("KEY_ARROW_DOWN_COMMAND"),iLe=To("KEY_ENTER_COMMAND"),o7r=To("KEY_SPACE_COMMAND"),i7r=To("KEY_BACKSPACE_COMMAND"),a7r=To("KEY_ESCAPE_COMMAND"),s7r=To("KEY_DELETE_COMMAND"),u7r=To("KEY_TAB_COMMAND"),uci=To("INSERT_TAB_COMMAND"),lci=To("INDENT_CONTENT_COMMAND"),cci=To("OUTDENT_CONTENT_COMMAND"),l7r=To("DROP_COMMAND"),dci=To("FORMAT_ELEMENT_COMMAND"),c7r=To("DRAGSTART_COMMAND"),d7r=To("DRAGOVER_COMMAND"),f7r=To("DRAGEND_COMMAND"),Hyt=To("COPY_COMMAND"),Jyt=To("CUT_COMMAND"),yyt=To("SELECT_ALL_COMMAND"),fci=To("CLEAR_EDITOR_COMMAND"),pci=To("CLEAR_HISTORY_COMMAND"),mci=To("CAN_REDO_COMMAND"),hci=To("CAN_UNDO_COMMAND"),p7r=To("FOCUS_COMMAND"),m7r=To("BLUR_COMMAND"),h7r=To("KEY_MODIFIER_COMMAND"),s$=Object.freeze({}),byt=30,_yt=[["keydown",function(t,e){if(nde=t.timeStamp,g7r=t.key,!e.isComposing()&&!gr(e,Z9r,t)&&t.key!=null){if(Ggt&&E9r(t))return ww(e,()=>{B$e(e,Xgt)}),Ggt=!1,void(Xgt="");if(function(r){return Qs(r,"ArrowRight",{shiftKey:"any"})}(t))gr(e,Y9r,t);else if(function(r){return Qs(r,"ArrowRight",l$)}(t))gr(e,Q9r,t);else if(function(r){return Qs(r,"ArrowLeft",{shiftKey:"any"})}(t))gr(e,e7r,t);else if(function(r){return Qs(r,"ArrowLeft",l$)}(t))gr(e,t7r,t);else if(function(r){return Qs(r,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))gr(e,r7r,t);else if(function(r){return Qs(r,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))gr(e,n7r,t);else if(function(r){return Qs(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))ode=!0,gr(e,iLe,t);else if(function(r){return r.key===" "}(t))gr(e,o7r,t);else if(function(r){return xA&&Qs(r,"o",{ctrlKey:!0})}(t))t.preventDefault(),ode=!0,gr(e,rde,!0);else if(function(r){return Qs(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))ode=!1,gr(e,iLe,t);else if(function(r){return Qs(r,"Backspace",{shiftKey:"any"})||xA&&Qs(r,"h",{ctrlKey:!0})}(t))E9r(t)?gr(e,i7r,t):(t.preventDefault(),gr(e,mde,!0));else if(function(r){return r.key==="Escape"}(t))gr(e,a7r,t);else if(function(r){return Qs(r,"Delete",{})||xA&&Qs(r,"d",{ctrlKey:!0})}(t))(function(r){return r.key==="Delete"})(t)?gr(e,s7r,t):(t.preventDefault(),gr(e,mde,!1));else if(function(r){return Qs(r,"Backspace",T9r)}(t))t.preventDefault(),gr(e,hde,!0);else if(function(r){return Qs(r,"Delete",T9r)}(t))t.preventDefault(),gr(e,hde,!1);else if(function(r){return xA&&Qs(r,"Backspace",{metaKey:!0})}(t))t.preventDefault(),gr(e,gde,!0);else if(function(r){return xA&&(Qs(r,"Delete",{metaKey:!0})||Qs(r,"k",{ctrlKey:!0}))}(t))t.preventDefault(),gr(e,gde,!1);else if(function(r){return Qs(r,"b",l$)}(t))t.preventDefault(),gr(e,GU,"bold");else if(function(r){return Qs(r,"u",l$)}(t))t.preventDefault(),gr(e,GU,"underline");else if(function(r){return Qs(r,"i",l$)}(t))t.preventDefault(),gr(e,GU,"italic");else if(function(r){return Qs(r,"Tab",{shiftKey:"any"})}(t))gr(e,u7r,t);else if(function(r){return Qs(r,"z",l$)}(t))t.preventDefault(),gr(e,zyt,void 0);else if(function(r){return xA?Qs(r,"z",{metaKey:!0,shiftKey:!0}):Qs(r,"y",{ctrlKey:!0})||Qs(r,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),gr(e,Vyt,void 0);else{let r=e._editorState._selection;r===null||un(r)?P9r(t)&&(t.preventDefault(),gr(e,yyt,t)):function(n){return Qs(n,"c",l$)}(t)?(t.preventDefault(),gr(e,Hyt,t)):function(n){return Qs(n,"x",l$)}(t)?(t.preventDefault(),gr(e,Jyt,t)):P9r(t)&&(t.preventDefault(),gr(e,yyt,t))}(function(r){return r.ctrlKey||r.shiftKey||r.altKey||r.metaKey})(t)&&gr(e,h7r,t)}}],["pointerdown",function(t,e){let r=t.target,n=t.pointerType;PZ(r)&&n!=="touch"&&n!=="pen"&&t.button===0&&ww(e,()=>{C9r(r)||(wyt=!0)})}],["compositionstart",function(t,e){ww(e,()=>{let r=Ls();if(un(r)&&!e.isComposing()){let n=r.anchor,o=r.anchor.getNode();Fh(n.key),(t.timeStamp<nde+byt||n.type==="element"||!r.isCollapsed()||o.getFormat()!==r.format||Pr(o)&&o.getStyle()!==r.style)&&gr(e,cZ,Uli)}})}],["compositionend",function(t,e){QJ?Qce=!0:pZ||!ude&&!Y$e?ww(e,()=>{B$e(e,t.data)}):(Ggt=!0,Xgt=t.data)}],["input",function(t,e){t.stopPropagation(),ww(e,()=>{if(Fb(t.target)&&C9r(t.target))return;let r=Ls(),n=t.data,o=w7r(t);if(n!=null&&un(r)&&_7r(r,o,n,t.timeStamp,!1)){Qce&&(B$e(e,n),Qce=!1);let i=r.anchor.getNode(),a=OA(R0(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;Z$e&&!r.isCollapsed()&&Pr(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,u)+n+i.getTextContent().slice(u+l)===K7r(a.anchorNode)||gr(e,cZ,n);let c=n.length;QJ&&c>1&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(r.anchor.offset-=c),ude||pZ||Y$e||!e.isComposing()||(nde=0,Fh(null))}else obt(!1,e,n!==null?n:void 0),Qce&&(B$e(e,n||void 0),Qce=!1);(function(){Lh();let i=ec();q9r(i)})()},{event:t}),uZ=null}],["click",function(t,e){ww(e,()=>{let r=Ls(),n=OA(R0(e)),o=a3();if(n){if(un(r)){let i=r.anchor,a=i.getNode();if(i.type==="element"&&i.offset===0&&r.isCollapsed()&&!ev(a)&&rv().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!==rv()&&c!=null;){if(l(c))return c;c=c.getParent()}return null}(a,u=>Ze(u)&&!u.isInline());Ze(s)&&s.select(0)}}else if(t.pointerType==="touch"||t.pointerType==="pen"){let i=n.anchorNode;(Fb(i)||TA(i))&&nv(wLe(o,n,e,t))}}gr(e,X9r,t)})}],["cut",s$],["copy",s$],["dragstart",s$],["dragover",s$],["dragend",s$],["paste",s$],["focus",s$],["blur",s$],["drop",s$]];Z$e&&_yt.push(["beforeinput",(t,e)=>function(r,n){let o=r.inputType,i=w7r(r);o==="deleteCompositionText"||QJ&&Z7r(n)||o!=="insertCompositionText"&&ww(n,()=>{let a=Ls();if(o==="deleteContentBackward"){if(a===null){let p=a3();if(!un(p))return;nv(p.clone())}if(un(a)){let p=a.anchor.key===a.focus.key;if(s=r.timeStamp,g7r==="MediaLast"&&s<nde+byt&&n.isComposing()&&p){if(Fh(null),nde=0,setTimeout(()=>{ww(n,()=>{Fh(null)})},byt),un(a)){let m=a.anchor.getNode();m.markDirty(),Pr(m)||Qe(142),v7r(a,m)}}else{Fh(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=BGr&&p&&!g&&y;if(b&&a.isCollapsed()&&(b=!Lu(X7r(a.anchor,!0))),!b){gr(n,mde,!0);let _=Ls();BGr&&un(_)&&_.isCollapsed()&&(ZJ=_,setTimeout(()=>ZJ=null))}}return}}var s;if(!un(a))return;let u=r.data;uZ!==null&&obt(!1,n,uZ),a.dirty&&uZ===null||!a.isCollapsed()||ev(a.anchor.getNode())||i===null||a.applyDOMRange(i),uZ=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":gr(n,cZ,r);break;case"insertFromComposition":Fh(null),gr(n,cZ,r);break;case"insertLineBreak":Fh(null),gr(n,rde,!1);break;case"insertParagraph":Fh(null),ode&&!pZ?(ode=!1,gr(n,rde,!1)):gr(n,hyt,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":gr(n,Byt,r);break;case"deleteByComposition":(function(p,m){return p!==m||Ze(p)||Ze(m)||!ZU(p)||!ZU(m)})(d,f)&&gr(n,gyt,r);break;case"deleteByDrag":case"deleteByCut":gr(n,gyt,r);break;case"deleteContent":gr(n,mde,!1);break;case"deleteWordBackward":gr(n,hde,!0);break;case"deleteWordForward":gr(n,hde,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":gr(n,gde,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":gr(n,gde,!1);break;case"formatStrikeThrough":gr(n,GU,"strikethrough");break;case"formatBold":gr(n,GU,"bold");break;case"formatItalic":gr(n,GU,"italic");break;case"formatUnderline":gr(n,GU,"underline");break;case"historyUndo":gr(n,zyt,void 0);break;case"historyRedo":gr(n,Vyt,void 0)}else{if(u===`
|
||
`)r.preventDefault(),gr(n,rde,!1);else if(u===g$)r.preventDefault(),gr(n,hyt,void 0);else if(u==null&&r.dataTransfer){let p=r.dataTransfer.getData("text/plain");r.preventDefault(),a.insertRawText(p)}else u!=null&&_7r(a,i,u,r.timeStamp,!0)?(r.preventDefault(),gr(n,cZ,u)):uZ=u;y7r=r.timeStamp}})}(t,e)]);var nde=0,g7r=null,y7r=0,uZ=null,aLe=new WeakMap,vyt=!1,wyt=!1,ode=!1,Qce=!1,Ggt=!1,Xgt="",ZJ=null,b7r=[0,"",0,"root",0];function _7r(t,e,r,n,o){let i=t.anchor,a=t.focus,s=i.getNode(),u=ec(),l=OA(R0(u)),c=l!==null?l.anchorNode:null,d=i.key,f=u.getElementByKey(d),p=r.length;return d!==a.key||!Pr(s)||(!o&&(!Z$e||y7r<n+50)||s.isDirty()&&p<2||J7r(r))&&i.offset!==a.offset&&!s.isComposing()||c$(s)||s.isDirty()&&p>1||(o||!Z$e)&&f!==null&&!s.isComposing()&&c!==o3(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=ZU(h);return y===0?!h.canInsertTextBefore()||!g.canInsertTextBefore()&&!h.isComposing()||b||function(_){let w=_.getPreviousSibling();return(Pr(w)||Ze(w)&&w.isInline())&&!w.canInsertTextAfter()}(h):y===h.getTextContentSize()&&(!h.canInsertTextAfter()||!g.canInsertTextAfter()&&!h.isComposing()||b)}(t,s)}function e9r(t,e){return TA(t)&&t.nodeValue!==null&&e!==0&&e!==t.nodeValue.length}function t9r(t,e,r){let{anchorNode:n,anchorOffset:o,focusNode:i,focusOffset:a}=t;vyt&&(vyt=!1,e9r(n,o)&&e9r(i,a)&&!ZJ)||ww(e,()=>{if(!r)return void nv(null);if(!_de(e,n,i))return;let s=Ls();if(ZJ&&un(s)&&s.isCollapsed()){let u=s.anchor,l=ZJ.anchor;(u.key===l.key&&u.offset===l.offset+1||u.offset===1&&l.getNode().is(u.getNode().getPreviousSibling()))&&(s=ZJ.clone(),nv(s))}if(ZJ=null,un(s)){let u=s.anchor,l=u.getNode();if(s.isCollapsed()){t.type==="Range"&&t.anchorNode===t.focusNode&&(s.dirty=!0);let c=R0(e).event,d=c?c.timeStamp:performance.now(),[f,p,m,h,y]=b7r,g=rv(),b=e.isComposing()===!1&&g.getTextContent()==="";if(d<y+200&&u.offset===m&&u.key===h)K$e(s,f,p);else if(u.type==="text")Pr(l)||Qe(141),v7r(s,l);else if(u.type==="element"&&!b){Ze(l)||Qe(259);let _=u.getNode();_.isEmpty()?function(w,O){let T=O.getTextFormat(),P=O.getTextStyle();K$e(w,T,P)}(s,_):K$e(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,_=D9r,w=!1;for(let O=0;O<p;O++){let T=f[O],P=T.getTextContentSize();if(Pr(T)&&P!==0&&!(O===0&&T.__key===g&&h===P||O===p-1&&T.__key===b&&y===0)&&(w=!0,_&=T.getFormat(),_===0))break}s.format=w?_:0}}gr(e,Uyt,void 0)})}function K$e(t,e,r){t.format===e&&t.style===r||(t.format=e,t.style=r,t.dirty=!0)}function v7r(t,e){K$e(t,e.getFormat(),e.getStyle())}function w7r(t){if(!t.getTargetRanges)return null;let e=t.getTargetRanges();return e.length===0?null:e[0]}function B$e(t,e){let r=t._compositionKey;if(Fh(null),r!==null&&e!=null){if(e===""){let n=Jm(r),o=o3(t.getElementByKey(r));return void(o!==null&&o.nodeValue!==null&&Pr(n)&&ibt(n,o.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
||
`){let n=Ls();if(un(n)){let o=n.focus;return n.anchor.set(o.key,o.offset,o.type),void gr(t,iLe,null)}}}obt(!0,t,e)}function S7r(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}var dZ=new Map;function C7r(t){let e=rXr(t.target);if(e===null)return;let r=rbt(e.anchorNode);if(r===null)return;wyt&&(wyt=!1,ww(r,()=>{let u=a3(),l=e.anchorNode;(Fb(l)||TA(l))&&nv(wLe(u,e,r,t))}));let n=nbt(r),o=n[n.length-1],i=o._key,a=dZ.get(i),s=a||o;s!==r&&t9r(e,s,!1),t9r(e,r,!0),r!==o?dZ.set(i,r):a&&dZ.delete(i)}function r9r(t){t._lexicalHandled=!0}function n9r(t){return t._lexicalHandled===!0}var gci=()=>{};function yci(t){let e=t.ownerDocument,r=aLe.get(e);if(r===void 0)return void gci();let n=r-1;n>=0||Qe(164),aLe.set(e,n),n===0&&e.removeEventListener("selectionchange",C7r);let o=vde(t);CLe(o)?(function(a){if(a._parentEditor!==null){let s=nbt(a),u=s[s.length-1]._key;dZ.get(u)===a&&dZ.delete(u)}else dZ.delete(a._key)}(o),t.__lexicalEditor=null):o&&Qe(198);let i=S7r(t);for(let a=0;a<i.length;a++)i[a]();t.__lexicalEventHandles=[]}function Syt(t,e,r){Lh();let n=t.__key,o=t.getParent();if(o===null)return;let i=function(s){let u=Ls();if(!un(u)||!Ze(s))return u;let{anchor:l,focus:c}=u,d=l.getNode(),f=c.getNode();return mLe(d,s)&&l.set(s.__key,0,"element"),mLe(f,s)&&c.set(s.__key,0,"element"),u}(t),a=!1;if(un(i)&&e){let s=i.anchor,u=i.focus;s.key===n&&(lLe(s,t,o,t.getPreviousSibling(),t.getNextSibling()),a=!0),u.key===n&&(lLe(u,t,o,t.getPreviousSibling(),t.getNextSibling()),a=!0)}else vLe(i)&&e&&t.isSelected()&&t.selectPrevious();if(un(i)&&e&&!a){let s=t.getIndexWithinParent();YU(t),uLe(i,o,s,-1)}else YU(t);r||Lx(o)||o.canBeEmpty()||!o.isEmpty()||Syt(o,e),e&&i&&ev(o)&&o.isEmpty()&&o.selectEnd()}function bci(t){return t}var eB=class{static getType(){let{ownNodeType:e}=dbt(this);return e===void 0&&Qe(64,this.name),e}static clone(e){Qe(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}),B7r(this,e)}getType(){return this.__type}isInline(){Qe(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;let r=Jm(e);if(r===null)break;e=r.__parent}return!1}isSelected(e){let r=e||Ls();if(r==null)return!1;let n=r.getNodes().some(o=>o.__key===this.__key);if(Pr(this))return n;if(un(r)&&r.anchor.type==="element"&&r.focus.type==="element"){if(r.isCollapsed())return!1;let o=this.getParent();if(Lu(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:Jm(e)}getParentOrThrow(){let e=this.getParent();return e===null&&Qe(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let r=e.getParent();if(Lx(r))return Ze(e)||e===this&&Lu(e)||Qe(194),e;e=r}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&Qe(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:Jm(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:Jm(e)}getNextSiblings(){let e=[],r=this.getNextSibling();for(;r!==null;)e.push(r),r=r.getNextSibling();return e}getCommonAncestor(e){let r=Ze(this)?this:this.getParent(),n=Ze(e)?e:e.getParent(),o=r&&n?ade(r,n):null;return o?o.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let r=ade(this,e);return r!==null&&(r.type==="descendant"||(r.type==="branch"?gbt(r)===-1:(r.type!=="same"&&r.type!=="ancestor"&&Qe(279),!1)))}isParentOf(e){let r=ade(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=Ze(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&&Qe(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=ec()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){let e=Jm(this.__key);return e===null&&Qe(113),e}getWritable(){Lh();let e=b$(),r=ec(),n=e._nodeMap,o=this.__key,i=this.getLatest(),a=r._cloneNotNeeded,s=Ls();if(s!==null&&s.setCachedNodes(null),a.has(o))return pLe(i),i;let u=iXr(i);return a.add(o),pLe(u),n.set(o,u),u}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,r){Qe(70)}updateDOM(e,r,n){Qe(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){Qe(18,this.name)}updateFromJSON(e){return function(r,n){let o=r.getWritable(),i=n.$,a=i;for(let s of z9r(o).flatKeys)s in n&&(a!==void 0&&a!==i||(a={...i}),a[s]=n[s]);return(o.__state||a)&&qyt(r).updateFromJSON(a),o}(this,e)}static transform(){return null}remove(e){Syt(this,!0,e)}replace(e,r){Lh();let n=Ls();n!==null&&(n=n.clone()),ryt(this,e);let o=this.getLatest(),i=this.__key,a=e.__key,s=e.getWritable(),u=this.getParentOrThrow().getWritable(),l=u.__size;YU(s);let c=o.getPreviousSibling(),d=o.getNextSibling(),f=o.__prev,p=o.__next,m=o.__parent;if(Syt(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&&(Ze(this)&&Ze(s)||Qe(139),this.getChildren().forEach(h=>{s.append(h)})),un(n)){nv(n);let h=n.anchor,y=n.focus;h.key===i&&s9r(h,s),y.key===i&&s9r(y,s)}return XU()===i&&Fh(a),s}insertAfter(e,r=!0){Lh(),ryt(this,e);let n=this.getWritable(),o=e.getWritable(),i=o.getParent(),a=Ls(),s=!1,u=!1;if(i!==null){let p=e.getIndexWithinParent();if(YU(o),un(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&&un(a)){let p=this.getIndexWithinParent();uLe(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){Lh(),ryt(this,e);let n=this.getWritable(),o=e.getWritable(),i=o.__key;YU(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=Ls();return r&&un(c)&&uLe(c,this.getParentOrThrow(),l),e}isParentRequired(){return!1}createParentElementNode(){return m$()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,r){Lh();let n=this.getPreviousSibling(),o=this.getParentOrThrow();if(n===null)return o.select(0,0);if(Ze(n))return n.select();if(!Pr(n)){let i=n.getIndexWithinParent()+1;return o.select(i,i)}return n.select(e,r)}selectNext(e,r){Lh();let n=this.getNextSibling(),o=this.getParentOrThrow();if(n===null)return o.select();if(Ze(n))return n.select(0,0);if(!Pr(n)){let i=n.getIndexWithinParent();return o.select(i,i)}return n.select(e,r)}markDirty(){this.getWritable()}reconcileObservedMutation(e,r){this.markDirty()}},hZ=class t extends eB{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&&Pyt(n)){let o=n.firstChild;if(o===r||o.nextSibling===r&&z$e(o)){let i=n.lastChild;if(i===r||i.previousSibling===r&&z$e(i))return!0}}return!1}(e)||function(r){let n=r.parentElement;if(n!==null&&Pyt(n)){let o=n.firstChild;if(o===r||o.nextSibling===r&&z$e(o))return!1;let i=n.lastChild;if(i===r||i.previousSibling===r&&z$e(i))return!0}return!1}(e)?null:{conversion:_ci,priority:0}}}static importJSON(e){return gZ().updateFromJSON(e)}};function _ci(t){return{node:gZ()}}function gZ(){return Sde(new hZ)}function YJ(t){return t instanceof hZ}function z$e(t){return TA(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function Zgt(t,e){return 16&e?"code":e&gLe?"mark":32&e?"sub":64&e?"sup":null}function Ygt(t,e){return 1&e?"strong":2&e?"em":"span"}function x7r(t,e,r,n,o){let i=n.classList,a=fZ(o,"base");a!==void 0&&i.add(...a),a=fZ(o,"underlineStrikethrough");let s=!1,u=e&cde&&e&lde;a!==void 0&&(r&cde&&r&lde?(s=!0,u||i.add(...a)):u&&i.remove(...a));for(let l in Ly){let c=Ly[l];if(a=fZ(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 O7r(t,e,r){let n=e.firstChild,o=r.isComposing(),i=t+(o?yLe:"");if(n==null)e.textContent=i;else{let a=n.nodeValue;if(a!==i)if(o||QJ){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 o9r(t,e,r,n,o,i){O7r(o,t,e);let a=i.theme.text;a!==void 0&&x7r(0,0,n,t,a)}function V$e(t,e){let r=document.createElement(e);return r.appendChild(t),r}var r3=class t extends eB{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 Wli[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===XU()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let r=Ly[e];return!!(this.getFormat()&r)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,r){return fLe(this.getLatest().__format,e,r)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,r){let n=this.__format,o=Zgt(0,n),i=Ygt(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)),o9r(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=Zgt(0,i),u=Zgt(0,a),l=Ygt(0,i),c=Ygt(0,a);if((s===null?l:s)!==(u===null?c:u))return!0;if(s===u&&l!==c){let h=r.firstChild;h==null&&Qe(48);let y=document.createElement(c);return o9r(y,this,0,a,o,n),r.replaceChild(y,h),!1}let d=r;u!==null&&s!==null&&(d=r.firstChild,d==null&&Qe(49)),O7r(o,d,this);let f=n.theme.text;f!==void 0&&i!==a&&x7r(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:Cci,priority:0}),b:()=>({conversion:wci,priority:0}),code:()=>({conversion:u$,priority:0}),em:()=>({conversion:u$,priority:0}),i:()=>({conversion:u$,priority:0}),mark:()=>({conversion:u$,priority:0}),s:()=>({conversion:u$,priority:0}),span:()=>({conversion:vci,priority:0}),strong:()=>({conversion:u$,priority:0}),sub:()=>({conversion:u$,priority:0}),sup:()=>({conversion:u$,priority:0}),u:()=>({conversion:u$,priority:0})}}static importJSON(e){return $h().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 Fb(r)||Qe(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=V$e(r,"b")),this.hasFormat("italic")&&(r=V$e(r,"i")),this.hasFormat("strikethrough")&&(r=V$e(r,"s")),this.hasFormat("underline")&&(r=V$e(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"?Ly[e]:e,r}setDetail(e){let r=this.getWritable();return r.__detail=typeof e=="string"?Vli[e]:e,r}setStyle(e){let r=this.getWritable();return r.__style=e,r}toggleFormat(e){let r=fLe(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=Jli[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){Lh();let n=e,o=r,i=Ls(),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(!un(i))return P7r(s,n,s,o,"text","text");{let u=XU();u!==i.anchor.key&&u!==i.focus.key||Fh(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=Ls();if(o&&un(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){Lh();let r=this.getLatest(),n=r.getTextContent();if(n==="")return[];let o=r.__key,i=XU(),a=n.length;e.sort((M,I)=>M-I),e.push(a);let s=[],u=e.length;for(let M=0,I=0;M<a&&I<=u;I++){let j=e[I];j>M&&(s.push(n.slice(M,j)),M=j)}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,_=Ls();if(un(_)){let[M,I]=_.isBackward()?[_.focus,_.anchor]:[_.anchor,_.focus];M.type==="text"&&M.key===o&&(g=M),I.type==="text"&&I.key===o&&(b=I)}r.isSegmented()?(f=$h(c),f.__format=p,f.__style=m,f.__detail=h,f.__state=KGr(r,f),y=!0):f=r.setTextContent(c);let w=[f];for(let M=1;M<l;M++){let I=$h(s[M]);I.__format=p,I.__style=m,I.__detail=h,I.__state=KGr(r,I);let j=I.__key;i===o&&Fh(j),w.push(I)}let O=g?g.offset:null,T=b?b.offset:null,P=0;for(let M of w){if(!g&&!b)break;let I=P+M.getTextContentSize();if(g!==null&&O!==null&&O<=I&&O>=P&&(g.set(M.getKey(),O-P,"text"),O<I&&(g=null)),b!==null&&T!==null&&T<=I&&T>=P){b.set(M.getKey(),T-P,"text");break}P=I}if(d!==null){(function(j){let A=j.getPreviousSibling(),k=j.getNextSibling();A!==null&&pLe(A),k!==null&&pLe(k)})(this);let M=d.getWritable(),I=this.getIndexWithinParent();y?(M.splice(I,0,w),this.remove()):M.splice(I,1,w),un(_)&&uLe(_,d,I,l-1)}return w}mergeWithSibling(e){let r=e===this.getPreviousSibling();r||e===this.getNextSibling()||Qe(50);let n=this.__key,o=e.__key,i=this.__text,a=i.length;XU()===o&&Fh(n);let s=Ls();if(un(s)){let d=s.anchor,f=s.focus;d!==null&&d.key===o&&m9r(d,r,n,e,a),f!==null&&f.key===o&&m9r(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 vci(t){return{forChild:Wyt(t.style),node:null}}function wci(t){let e=t,r=e.style.fontWeight==="normal";return{forChild:Wyt(e.style,r?void 0:"bold"),node:null}}var i9r=new WeakMap;function Sci(t){if(!Fb(t))return!1;if(t.nodeName==="PRE")return!0;let e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function Cci(t){let e=t;t.parentElement===null&&Qe(129);let r=e.textContent||"";if(function(n){let o,i=n.parentNode,a=[n];for(;i!==null&&(o=i9r.get(i))===void 0&&!Sci(i);)a.push(i),i=i.parentNode;let s=o===void 0?i:o;for(let u=0;u<a.length;u++)i9r.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(gZ()):s===" "?o.push(_Le()):s!==""&&o.push($h(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=a9r(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=a9r(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:$h(r)}}function a9r(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,Fb(r)){let i=r.style.display;if(i===""&&!oXr(r)||i!==""&&!i.startsWith("inline"))return null}let o=r;for(;(o=e?r.firstChild:r.lastChild)!==null;)r=o;if(TA(r))return r;if(r.nodeName==="BR")return null}}var xci={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function u$(t){let e=xci[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Wyt(t.style,e),node:null}}function $h(t=""){return Sde(new r3(t))}function Pr(t){return t instanceof r3}function Wyt(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=>(Pr(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 yZ=class t extends r3{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=fZ(e.theme,"tab");return n!==void 0&&r.classList.add(...n),r}static importJSON(e){return _Le().updateFromJSON(e)}setTextContent(e){return e!==" "&&e!==""&&Qe(126),super.setTextContent(" ")}spliceText(e,r,n,o){return n===""&&r===0||n===" "&&r===1||Qe(286),this}setDetail(e){return e!==2&&Qe(127),this}setMode(e){return e!=="normal"&&Qe(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function _Le(){return Sde(new yZ)}function Kyt(t){return t instanceof yZ}var Cyt=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:hbt(Ax(oB(this,"next")),Ax(oB(e,"next")))<0}getNode(){let e=Jm(this.key);return e===null&&Qe(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,EZ()||(XU()===a&&Fh(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function $x(t,e,r){return new Cyt(t,e,r)}function Qgt(t,e){let r=e.__key,n=t.offset,o="element";if(Pr(e)){o="text";let i=e.getTextContentSize();n>i&&(n=i)}else if(!Ze(e)){let i=e.getNextSibling();if(Pr(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 s9r(t,e){if(Ze(e)){let r=e.getLastDescendant();Ze(r)||Pr(r)?Qgt(t,r):Qgt(t,e)}else Qgt(t,e)}var sLe=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(!vLe(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(Pr(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=Jm(o);i!==null&&n.push(i)}return EZ()||(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((Ls()||a3())===this&&e[0]){let r=Uh(e[0],"next");cXr(nB(r,r))}for(let r of e)r.remove()}};function un(t){return t instanceof n3}var n3=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!!un(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(jx(l)){let{origin:c}=l;o.length===0?s.add(c):(u.add(c),o.push(c))}else{let{origin:c}=l;Ze(c)&&u.has(c)||o.push(c)}if(a&&o.push(a.caret.origin),i3(n.focus)&&Ze(n.focus.origin)&&n.focus.getNodeAtCaret()===null)for(let l=y$(n.focus.origin,"previous");jx(l)&&s.has(l.origin)&&!l.origin.isEmpty()&&l.origin.is(o[o.length-1]);l=OZ(l))s.delete(l.origin),o.pop();for(;o.length>1;){let l=o[o.length-1];if(!Ze(l)||u.has(l)||l.isEmpty()||s.has(l))break;o.pop()}if(o.length===0&&n.isCollapsed()){let l=Ax(n.anchor),c=Ax(n.anchor.getFlipped()),d=p=>h$(p)?p.origin:p.getNodeAtCaret(),f=d(l)||d(c)||(n.anchor.getNodeAtCaret()?l.origin:c.origin);o.push(f)}return o}(ybt(Ayt(this),"next"));return EZ()||(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]=xyt(this),l="",c=!0;for(let d=0;d<e.length;d++){let f=e[d];if(Ze(f)&&!f.isInline())c||(l+=`
|
||
`),c=!f.isEmpty();else if(c=!1,Pr(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!Lu(f)&&!YJ(f)||f===n&&this.isCollapsed()||(l+=f.getTextContent())}return l}applyDOMRange(e){let r=ec(),n=r.getEditorState()._selection,o=E7r(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),tLe(this)}clone(){let e=this.anchor,r=this.focus;return new t($x(e.key,e.offset,e.type),$x(r.key,r.offset,r.type),this.format,this.style)}toggleFormat(e){this.format=fLe(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=Ly[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(gZ()):a===" "?n.push(_Le()):n.push($h(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(),O=w.getChildAtIndex(y.offset),T=$h(),P=ev(w)?m$().append(T):T;T.setFormat(b),T.setStyle(_),O===null?w.append(P):O.insertBefore(P),y.is(g)&&g.set(T.__key,0,"text"),y.set(T.__key,0,"text")}(a,s,o,i),s.type==="element"&&TZ(s,Ax(oB(s,"next")));let u=a.offset,l=s.offset,c=this.getNodes(),d=c.length,f=c[0];Pr(f)||Qe(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&&(c$(f)||!f.canInsertTextAfter()||!m.canInsertTextAfter()&&f.getNextSibling()===null)){let y=f.getNextSibling();if(Pr(y)&&y.canInsertTextBefore()&&!c$(y)||(y=$h(),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&&(c$(f)||!f.canInsertTextBefore()||!m.canInsertTextBefore()&&f.getPreviousSibling()===null)){let y=f.getPreviousSibling();if(Pr(y)&&!c$(y)||(y=$h(),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=$h(f.getTextContent());y.setFormat(o),f.replace(y),f=y}else if(!this.isCollapsed()&&e!==""){let y=h.getParent();if(!m.canInsertTextBefore()||!m.canInsertTextAfter()||Ze(y)&&(!y.canInsertTextBefore()||!y.canInsertTextAfter()))return this.insertText(""),T7r(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(ZU(f)){let _=$h(e);return _.select(),void f.replace(_)}let y=f.getFormat(),g=f.getStyle();if(u!==l||y===o&&g===i){if(Kyt(f)){let _=$h(e);return _.setFormat(o),_.setStyle(i),_.select(),void f.replace(_)}}else{if(f.getTextContent()!==""){let _=$h(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=Ze(f)?f:f.getParentOrThrow(),b=Ze(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(Pr(h)&&!ZU(h)&&l!==h.getTextContentSize()){if(h.isSegmented()){let M=$h(h.getTextContent());h.replace(M),h=M}ev(s.getNode())||s.type!=="text"||(h=h.spliceText(0,l,"")),y.add(h.__key)}else{let M=h.getParentOrThrow();M.canBeEmpty()||M.getChildrenSize()!==1?h.remove():M.remove()}else y.add(h.__key);let w=b.getChildren(),O=new Set(c),T=g.is(b),P=g.isInline()&&f.getNextSibling()===null?g:f;for(let M=w.length-1;M>=0;M--){let I=w[M];if(I.is(f)||Ze(I)&&I.isParentOf(f))break;I.isAttached()&&(!O.has(I)||I.is(_)?T||P.insertAfter(I,!1):I.remove())}if(!T){let M=b,I=null;for(;M!==null;){let j=M.getChildren(),A=j.length;(A===0||j[A-1].is(I))&&(y.delete(M.__key),I=M),M=M.getParent()}}if(ZU(f))if(u===p)f.select();else{let M=$h(e);M.select(),f.replace(M)}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 M=1;M<d;M++){let I=c[M],j=I.__key;y.has(j)||I.remove()}}}removeText(){let e=Ls()===this;sde(this,dXr(Ayt(this))),e&&Ls()!==this&&nv(this)}formatText(e,r=null){if(this.isCollapsed())return this.toggleFormat(e),void Fh(null);let n=this.getNodes(),o=[];for(let w of n)Pr(w)&&o.push(w);let i=w=>{n.forEach(O=>{if(Ze(O)){let T=O.getFormatFlags(e,w);O.setTextFormat(T)}})},a=o.length;if(a===0)return this.toggleFormat(e),Fh(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(c$(p)||m===0&&b===p.getTextContentSize())p.setFormat(h);else{let w=p.splitText(m,b),O=m===0?w[0]:w[1];O.setFormat(h),c.type==="text"&&c.set(O.__key,0,"text"),d.type==="text"&&d.set(O.__key,b-m,"text")}return void(this.format=h)}m===0||c$(p)||([,p]=p.splitText(m),m=0),p.setFormat(h);let _=g.getFormatFlags(e,h);b>0&&(b===g.getTextContentSize()||c$(g)||([g]=g.splitText(b)),g.setFormat(_));for(let w=f+1;w<y;w++){let O=o[w],T=O.getFormatFlags(e,_);O.setFormat(T)}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=Ls();return un(m)||Qe(134),m.insertNodes(e)}let r=(this.isBackward()?this.focus:this.anchor).getNode(),n=oyt(r,p$),o=e[e.length-1];if(Ze(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{let m=eyt(this);n.splice(m,0,e),o.selectEnd()}return}if(!e.some(m=>(Ze(m)||Lu(m))&&!m.isInline())){Ze(n)||Qe(211,r.constructor.name,r.getType());let m=eyt(this);return n.splice(m,0,e),void o.selectEnd()}let i=function(m){let h=m$(),y=null;for(let g=0;g<m.length;g++){let b=m[g],_=YJ(b);if(_||Lu(b)&&b.isInline()||Ze(b)&&b.isInline()||Pr(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=!Ze(n)||!n.isEmpty()?this.insertParagraph():null,l=s[s.length-1],c=s[0];var d;Ze(d=c)&&p$(d)&&!d.isEmpty()&&Ze(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(Ze(n)||Qe(211,r.constructor.name,r.getType()),n.append(...c.getChildren()),c=s[1]),c&&(n===null&&Qe(212,r.constructor.name,r.getType()),function(m,h,y){let g=h.getParentOrThrow().getLastChild(),b=h,_=[h];for(;b!==g;)b.getNextSibling()||Qe(140),b=b.getNextSibling(),_.push(b);let w=m;for(let O of _)w=w.insertAfter(O)}(n,c));let f=oyt(a,p$);u&&Ze(f)&&(u.canMergeWhenEmpty()||p$(l))&&(f.append(...u.getChildren()),u.remove()),Ze(n)&&n.isEmpty()&&n.remove(),a.selectEnd();let p=Ze(n)?n.getLastChild():null;YJ(p)&&f!==n&&p.remove()}insertParagraph(){if(this.anchor.key==="root"){let a=m$();return rv().splice(this.anchor.offset,0,[a]),a.select(),a}let e=eyt(this),r=oyt(this.anchor.getNode(),p$);Ze(r)||Qe(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=gZ();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]=xyt(this);if(r===0)return[];if(r===1){if(Pr(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(Pr(a)){let d=c?u:l;d===a.getTextContentSize()?e.shift():d!==0&&([,a]=a.splitText(d),e[0]=a)}if(Pr(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(h9r(this,e,r,n))return;let o=e==="move",i=ec(),a=OA(R0(i));if(!a)return;let s=i._blockCursorElement,u=i._rootElement,l=this.focus.getNode();if(u===null||s===null||!Ze(l)||l.isInline()||l.canBeEmpty()||Eyt(s,i,u),this.dirty){let c=wZ(i,this.anchor.key),d=wZ(i,this.focus.key);this.anchor.type==="text"&&(c=o3(c)),this.focus.type==="text"&&(d=o3(d)),c&&d&&I7r(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=ev(d)?d:eXr(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];mLe(g,f)?m.push(g):h=!0}if(h&&m.length>0)if(r){let y=m[0];Ze(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{let y=m[m.length-1];Ze(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,O=b.type;b.set(g.key,g.offset,g.type,!0),g.set(_,w,O,!0)}(this)}}n==="lineboundary"&&h9r(this,e,r,n,"decorators")}forwardDeletion(e,r,n){if(!n&&(e.type==="element"&&Ze(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(Ze(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=pbt(oB(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(jx(u)){if(!u.origin.isInline()){if(u.origin.isShadowRoot()){if(s.type==="merge-block")break;if(Ze(i.anchor.origin)&&i.anchor.origin.isEmpty()){let l=Ax(u);sde(this,nB(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(i3(u)){if(Ze(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(Lu(u.origin)){if(!u.origin.isIsolated())if(s.type==="merge-next-block"&&(u.origin.isKeyboardSelectable()||!u.origin.isInline())&&Ze(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();let l=Gyt();l.add(u.origin.getKey()),nv(l)}else u.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:u,block:l}=s;return sde(this,nB(!u.origin.isEmpty()&&l.isEmpty()?MZ(Uh(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&&l9r(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 c9r(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 c9r(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!(J7r(w)||Oci(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()&&ev(n.getParent())&&n.getPreviousSibling()===null&&l9r(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 vLe(t){return t instanceof sLe}function u9r(t){let e=t.offset;if(t.type==="text")return e;let r=t.getNode();return e===r.getChildrenSize()?r.getTextContent().length:0}function xyt(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]:[u9r(r),u9r(n)]}function l9r(t,e){for(let r=e;r;r=r.getParent()){if(Ze(r)){if(r.collapseAtStart(t))return!0;if(Lx(r))break}if(r.getPreviousSibling())break}return!1}var Oci=(()=>{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 c9r(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 d9r(t,e,r,n){let o,i=e;if(Fb(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=lZ(c),Pr(o))i=Dx(o,a?"next":"previous");else{let f=lZ(t);if(f===null)return null;if(Ze(f)){let p=n.getElementByKey(f.getKey());p===null&&Qe(214),[f,i]=f.getDOMSlot(p).resolveChildIndex(f,p,t,e),Ze(f)||Qe(215),a&&i>=f.getChildrenSize()&&(i=Math.max(0,f.getChildrenSize()-1));let h=f.getChildAtIndex(i);if(Ze(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=Ze(h)?h:h.getParentOrThrow()),i=0}Pr(h)?(o=h,f=null,i=Dx(h,a?"next":"previous")):h!==f&&a&&!d&&(Ze(f)||Qe(216),i=Math.min(f.getChildrenSize(),i+1))}else{let p=f.getIndexWithinParent();i=e===0&&Lu(f)&&lZ(t)===f?p:p+1,f=f.getParentOrThrow()}if(Ze(f))return $x(f.__key,i,"element")}}else o=lZ(t);return Pr(o)?$x(o.__key,Dx(o,i,"clamp"),"text"):null}function f9r(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&&Ze(a)&&a.isInline()){let s=a.getPreviousSibling();Pr(s)&&t.set(s.__key,s.getTextContent().length,"text")}}else Ze(i)&&!r&&i.isInline()?t.set(i.__key,i.getChildrenSize(),"element"):Pr(i)&&t.set(i.__key,i.getTextContent().length,"text")}else if(n===o.getTextContent().length){let i=o.getNextSibling(),a=o.getParent();if(e&&Ze(i)&&i.isInline())t.set(i.__key,0,"element");else if((r||e)&&i===null&&Ze(a)&&a.isInline()&&!a.canInsertTextAfter()){let s=a.getNextSibling();Pr(s)&&t.set(s.__key,0,"text")}}}function T7r(t,e,r){if(t.type==="text"&&e.type==="text"){let n=t.isBefore(e),o=t.is(e);f9r(t,n,o),f9r(e,!n,o),o&&e.set(t.key,t.offset,t.type);let i=ec();if(i.isComposing()&&i._compositionKey!==t.key&&un(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 E7r(t,e,r,n,o,i){if(t===null||r===null||!_de(o,t,r))return null;let a=d9r(t,e,un(i)?i.anchor:null,o);if(a===null)return null;let s=d9r(r,n,un(i)?i.focus:null,o);if(s===null)return null;if(a.type==="element"&&s.type==="element"){let u=lZ(t),l=lZ(r);if(Lu(u)&&Lu(l))return null}return T7r(a,s,i),[a,s]}function Tci(t){return Ze(t)&&!t.isInline()}function P7r(t,e,r,n,o,i){let a=b$(),s=new n3($x(t,e,o),$x(r,n,i),0,"");return s.dirty=!0,a._selection=s,s}function M7r(){let t=$x("root",0,"element"),e=$x("root",0,"element");return new n3(t,e,0,"")}function Gyt(){return new sLe(new Set)}function Eci(t,e){return wLe(null,t,e,null)}function wLe(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=!ayt&&(s||a==="beforeinput"||a==="compositionstart"||a==="compositionend"||a==="click"&&i&&i.detail===3||a==="drop"||a===void 0),l,c,d,f;if(un(t)&&!u)return t.clone();if(e===null)return null;if(l=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,s&&un(t)&&!_de(r,l,c))return t.clone();let p=E7r(l,d,c,f,r,t);if(p===null)return null;let[m,h]=p;return new n3(m,h,un(t)?t.format:0,un(t)?t.style:"")}function Ls(){return b$()._selection}function a3(){return ec()._editorState._selection}function uLe(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"),p9r(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")}}p9r(t)}function p9r(t){let e=t.anchor,r=e.offset,n=t.focus,o=n.offset,i=e.getNode(),a=n.getNode();if(t.isCollapsed()){if(!Ze(i))return;let s=i.getChildrenSize(),u=r>=s,l=u?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Pr(l)){let c=0;u&&(c=l.getTextContentSize()),e.set(l.__key,c,"text"),n.set(l.__key,c,"text")}}else{if(Ze(i)){let s=i.getChildrenSize(),u=r>=s,l=u?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(Pr(l)){let c=0;u&&(c=l.getTextContentSize()),e.set(l.__key,c,"text")}}if(Ze(a)){let s=a.getChildrenSize(),u=o>=s,l=u?a.getChildAtIndex(s-1):a.getChildAtIndex(o);if(Pr(l)){let c=0;u&&(c=l.getTextContentSize()),n.set(l.__key,c,"text")}}}}function lLe(t,e,r,n,o){let i=null,a=0,s=null;n!==null?(i=n.__key,Pr(n)?(a=n.getTextContentSize(),s="text"):Ze(n)&&(a=n.getChildrenSize(),s="element")):o!==null&&(i=o.__key,Pr(o)?s="text":Ze(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 m9r(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 I7r(t,e,r,n,o){try{t.setBaseAndExtent(e,r,n,o)}catch{}}function Pci(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($7r)&&d!==i||d!==null&&tbt(d))return;if(!un(e))return void(t!==null&&_de(r,s,u)&&n.removeAllRanges());let f=e.anchor,p=e.focus,m=f.key,h=p.key,y=wZ(r,m),g=wZ(r,h),b=f.offset,_=p.offset,w=e.format,O=e.style,T=e.isCollapsed(),P=y,M=g,I=!1;if(f.type==="text"){P=o3(y);let J=f.getNode();I=J.getFormat()!==w||J.getStyle()!==O}else un(t)&&t.anchor.type==="text"&&(I=!0);var j,A,k,V,q;if(p.type==="text"&&(M=o3(g)),P!==null&&M!==null&&(T&&(t===null||I||un(t)&&(t.format!==w||t.style!==O))&&(j=w,A=O,k=b,V=m,q=performance.now(),b7r=[j,A,k,V,q]),l!==b||c!==_||s!==P||u!==M||n.type==="Range"&&T||(d!==null&&i.contains(d)||i.focus({preventScroll:!0}),f.type==="element"))){if(I7r(n,P,b,M,_),!o.has(L7r)&&e.isCollapsed()&&i!==null&&i===document.activeElement){let J=un(e)&&e.anchor.type==="element"?P.childNodes[b]||null:n.rangeCount>0?n.getRangeAt(0):null;if(J!==null){let K;if(J instanceof Text){let ue=document.createRange();ue.selectNode(J),K=ue.getBoundingClientRect()}else K=J.getBoundingClientRect();(function(ue,oe,G){let Y=sbt(G),se=ubt(Y);if(Y===null||se===null)return;let{top:ie,bottom:$}=oe,H=0,re=0,D=G;for(;D!==null;){let R=D===Y.body;if(R)H=0,re=R0(ue).innerHeight;else{let U=D.getBoundingClientRect();H=U.top,re=U.bottom}let z=0;if(ie<H?z=-(H-ie):$>re&&(z=$-re),z!==0)if(R)se.scrollBy(0,z);else{let U=D.scrollTop;D.scrollTop+=z;let ee=D.scrollTop-U;ie-=ee,$-=ee}if(R)break;D=wde(D)}})(r,K,i)}}vyt=!0}}function Mci(t){let e=Ls()||a3();e===null&&(e=rv().selectEnd()),e.insertNodes(t)}function Ici(){let t=Ls();return t===null?"":t.getTextContent()}function eyt(t){let e=t;t.isCollapsed()||e.removeText();let r=Ls();un(r)&&(e=r),un(e)||Qe(161);let n=e.anchor,o=n.getNode(),i=n.offset;for(;!p$(o);){let a=o;if([o,i]=Rci(o,i),a.is(o))break}return i}function Rci(t,e){let r=t.getParent();if(!r){let o=m$();return rv().append(o),o.select(),[rv(),0]}if(Pr(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(!Ze(t)||e===0)return[r,t.getIndexWithinParent()];let n=t.getChildAtIndex(e);if(n){let o=new n3($x(t.__key,e,"element"),$x(t.__key,e,"element"),0,""),i=t.insertNewAfter(o);i&&i.append(n,...n.getNextSiblings())}return[r,t.getIndexWithinParent()+1]}function h9r(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=oB(t.focus,r?"previous":"next"),a=n==="lineboundary",s=e==="move",u=i,l=o==="decorators-and-blocks";if(!fXr(u)){for(let c of u){l=!1;let{origin:d}=c;if(!Lu(d)||d.isIsolated()||(u=c,!a||!d.isInline()))break}if(l)for(let c of pbt(i).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(jx(c))c.origin.isInline()||(u=c);else{if(Ze(c.origin))continue;Lu(c.origin)&&!c.origin.isInline()&&(u=c)}break}}if(u===i)return!1;if(s&&!a&&Lu(u.origin)&&u.origin.isKeyboardSelectable()){let c=Gyt();return c.add(u.origin.getKey()),nv(c),!0}return u=Ax(u),s&&TZ(t.anchor,u),TZ(t.focus,u),l||!a}var kh=null,qh=null,tv=!1,tyt=!1,G$e=0,g9r={characterData:!0,childList:!0,subtree:!0};function EZ(){return tv||kh!==null&&kh._readOnly}function Lh(){tv&&Qe(13)}function R7r(){G$e>99&&Qe(14)}function b$(){return kh===null&&Qe(195,A7r()),kh}function ec(){return qh===null&&Qe(196,A7r()),qh}function A7r(){let t=0,e=new Set,r=vZ.version;if(typeof window<"u")for(let o of document.querySelectorAll("[contenteditable]")){let i=vde(o);if(CLe(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 Aci(){return qh}function y9r(t,e,r){let n=e.__type,o=Qyt(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 b9r(t,e){return t!==void 0&&t.__key!==e&&t.isAttached()}function N7r(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 Nci(t){return Xyt(t,ec()._nodes)}function Xyt(t,e){let r=t.type,n=e.get(r);n===void 0&&Qe(17,r);let o=n.klass;t.type!==o.getType()&&Qe(18,o.name);let i=o.importJSON(t),a=t.children;if(Ze(i)&&Array.isArray(a))for(let s=0;s<a.length;s++){let u=Xyt(a[s],e);i.append(u)}return i}function _9r(t,e,r){let n=kh,o=tv,i=qh;kh=e,tv=!0,qh=t;try{return r()}finally{kh=n,tv=o,qh=i}}function f$(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!==e3,l=kh,c=tv,d=qh,f=t._updating,p=t._observer,m=null;if(t._pendingEditorState=null,t._editorState=r,!o&&u&&p!==null){qh=t,kh=r,tv=!1,t._updating=!0;try{let T=t._dirtyType,P=t._dirtyElements,M=t._dirtyLeaves;p.disconnect(),m=aci(i,r,t,T,P,M)}catch(T){if(T instanceof Error&&t._onError(T),tyt)throw T;return k7r(t,null,n,r),U9r(t),t._dirtyType=mZ,tyt=!0,f$(t,i),void(tyt=!1)}finally{p.observe(n,g9r),t._updating=f,kh=l,tv=c,qh=d}}r._readOnly||(r._readOnly=!0);let h=t._dirtyLeaves,y=t._dirtyElements,g=t._normalizedNodes,b=t._updateTags,_=t._deferred;u&&(t._dirtyType=e3,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),function(T,P){let M=T._decorators,I=T._pendingDecorators||M,j=P._nodeMap,A;for(A in I)j.has(A)||(I===M&&(I=V7r(T)),delete I[A])}(t,r);let w=o?null:OA(R0(t));if(t._editable&&w!==null&&(u||s===null||s.dirty)&&n!==null&&!b.has(F7r)){qh=t,kh=r;try{if(p!==null&&p.disconnect(),u||s===null||s.dirty){let T=t._blockCursorElement;T!==null&&Eyt(T,t,n),Pci(a,s,t,w,b,n)}(function(T,P,M){let I=T._blockCursorElement;if(un(M)&&M.isCollapsed()&&M.anchor.type==="element"&&P.contains(document.activeElement)){let j=M.anchor,A=j.getNode(),k=j.offset,V=!1,q=null;if(k===A.getChildrenSize())nyt(A.getChildAtIndex(k-1))&&(V=!0);else{let J=A.getChildAtIndex(k);if(J!==null&&nyt(J)){let K=J.getPreviousSibling();(K===null||nyt(K))&&(V=!0,q=T.getElementByKey(J.__key))}}if(V){let J=T.getElementByKey(A.__key);return I===null&&(T._blockCursorElement=I=function(K){let ue=K.theme,oe=document.createElement("div");oe.contentEditable="false",oe.setAttribute("data-lexical-cursor","true");let G=ue.blockCursor;if(G!==void 0){if(typeof G=="string"){let Y=Q$e(G);G=ue.blockCursor=Y}G!==void 0&&oe.classList.add(...G)}return oe}(T._config)),P.style.caretColor="transparent",void(q===null?J.appendChild(I):J.insertBefore(I,q))}}I!==null&&Eyt(I,T,P)})(t,n,s)}finally{p!==null&&p.observe(n,g9r),qh=d,kh=l}}m!==null&&function(T,P,M,I,j){let A=Array.from(T._listeners.mutation),k=A.length;for(let V=0;V<k;V++){let[q,J]=A[V];for(let K of J){let ue=P.get(K);ue!==void 0&&q(ue,{dirtyLeaves:I,prevEditorState:j,updateTags:M})}}}(t,m,b,h,i),un(s)||s===null||a!==null&&a.is(s)||t.dispatchCommand(Uyt,void 0);let O=t._pendingDecorators;O!==null&&(t._decorators=O,t._pendingDecorators=null,ide("decorator",t,!0,O)),function(T,P,M){let I=x9r(P),j=x9r(M);I!==j&&ide("textcontent",T,!0,j)}(t,e||i,r),ide("update",t,!0,{dirtyElements:y,dirtyLeaves:h,editorState:r,mutatedNodes:m,normalizedNodes:g,prevEditorState:e||i,tags:b}),function(T,P){if(T._deferred=[],P.length!==0){let M=T._updating;T._updating=!0;try{for(let I=0;I<P.length;I++)P[I]()}finally{T._updating=M}}}(t,_),function(T){let P=T._updates;if(P.length!==0){let M=P.shift();if(M){let[I,j]=M;SLe(T,I,j)}}}(t)}function ide(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 v9r(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&&Qe(191),s._flushSync=!0),u&&t._deferred.push(u),N7r(t,a.tag)),s==null?SLe(t,i,a):i()}}return n}function SLe(t,e,r){let n=t._updateTags,o,i=!1,a=!1;r!==void 0&&(o=r.onUpdate,N7r(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=j7r(u||s),l=!0),u._flushSync=a;let c=kh,d=tv,f=qh,p=t._updating;kh=u,tv=!1,t._updating=!0,qh=t;let m=t._headless||t.getRootElement()===null;Yyt(null);try{l&&(m?s._selection!==null&&(u._selection=s._selection.clone()):u._selection=function(b,_){let w=b.getEditorState()._selection,O=OA(R0(b));return un(w)||w==null?wLe(w,O,b,_):w.clone()}(t,r&&r.event||null));let y=t._compositionKey;e(),i=v9r(t,i),function(b,_){let w=_.getEditorState()._selection,O=b._selection;if(un(O)){let T=O.anchor,P=O.focus,M;if(T.type==="text"&&(M=T.getNode(),M.selectionTransform(w,O)),P.type==="text"){let I=P.getNode();M!==I&&I.selectionTransform(w,O)}}}(u,t),t._dirtyType!==e3&&(i?function(b,_){let w=_._dirtyLeaves,O=b._nodeMap;for(let T of w){let P=O.get(T);Pr(P)&&P.isAttached()&&P.isSimpleText()&&!P.isUnmergeable()&&ZGr(P)}}(u,t):function(b,_){let w=_._dirtyLeaves,O=_._dirtyElements,T=b._nodeMap,P=XU(),M=new Map,I=w,j=I.size,A=O,k=A.size;for(;j>0||k>0;){if(j>0){_._dirtyLeaves=new Set;for(let V of I){let q=T.get(V);Pr(q)&&q.isAttached()&&q.isSimpleText()&&!q.isUnmergeable()&&ZGr(q),q!==void 0&&b9r(q,P)&&y9r(_,q,M),w.add(V)}if(I=_._dirtyLeaves,j=I.size,j>0){G$e++;continue}}_._dirtyLeaves=new Set,_._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(let V of A){let q=V[0],J=V[1];if(O.set(q,J),!J)continue;let K=T.get(q);K!==void 0&&b9r(K,P)&&y9r(_,K,M)}I=_._dirtyLeaves,j=I.size,A=_._dirtyElements,k=A.size,G$e++}_._dirtyLeaves=w,_._dirtyElements=O}(u,t),v9r(t),function(b,_,w,O){let T=b._nodeMap,P=_._nodeMap,M=[];for(let[I]of O){let j=P.get(I);j!==void 0&&(j.isAttached()||(Ze(j)&&F9r(j,I,T,P,M,O),T.has(I)||O.delete(I),M.push(I)))}for(let I of M)P.delete(I);for(let I of w){let j=P.get(I);j===void 0||j.isAttached()||(T.has(I)||w.delete(I),P.delete(I))}}(s,u,t._dirtyLeaves,t._dirtyElements)),y!==t._compositionKey&&(u._flushSync=!0);let g=u._selection;if(un(g)){let b=u._nodeMap,_=g.anchor.key,w=g.focus.key;b.get(_)!==void 0&&b.get(w)!==void 0||Qe(19)}else vLe(g)&&g._nodes.size===0&&(u._selection=null)}catch(y){return y instanceof Error&&t._onError(y),t._pendingEditorState=s,t._dirtyType=mZ,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),void f$(t)}finally{kh=c,tv=d,qh=f,t._updating=p,G$e=0}t._dirtyType!==e3||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,f$(t)):l&&Wci(()=>{f$(t)}):(u._flushSync=!1,l&&(n.clear(),t._deferred=[],t._pendingEditorState=null))}function ww(t,e,r){qh===t&&r===void 0?e():SLe(t,e,r)}var Oyt=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&&Qe(222),this.element.insertBefore(e,r),this}removeChild(e){return e.parentElement!==this.element&&Qe(223),this.element.removeChild(e),this}replaceChild(e,r){return r.parentElement!==this.element&&Qe(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"&&(pZ||ude);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=w9r(r,n);i.push(o);let a=w9r(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 w9r(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&&Qe(225),r.reverse()}var tB=class extends eB{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 Hli[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=ec()._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(Pr(r)&&e.push(r),Ze(r)){let n=r.getAllTextNodes();e.push(...n)}r=r.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Ze(e);){let r=e.getFirstChild();if(r===null)break;e=r}return e}getLastDescendant(){let e=this.getLastChild();for(;Ze(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 Ze(i)&&i.getLastDescendant()||i||null}let o=r[e];return Ze(o)&&o.getFirstDescendant()||o||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:Jm(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&Qe(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:Jm(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&Qe(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(),Ze(i)&&o!==n-1&&!i.isInline()&&(e+=g$)}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(),Ze(i)&&o!==n-1&&!i.isInline()&&(e+=g$.length)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){let r=zGr[e];return!!(this.getFormat()&r)}return!1}hasTextFormat(e){let r=Ly[e];return!!(this.getTextFormat()&r)}getFormatFlags(e,r){return fLe(this.getLatest().__textFormat,e,r)}getTextStyle(){return this.getLatest().__textStyle}select(e,r){Lh();let n=Ls(),o=e,i=r,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&r===0){let u=this.getFirstChild();if(Pr(u)||Ze(u))return u.select(0,0)}else if(!(e!==void 0&&e!==a||r!==void 0&&r!==a)){let u=this.getLastChild();if(Pr(u)||Ze(u))return u.select()}}o===void 0&&(o=a),i===void 0&&(i=a);let s=this.__key;return un(n)?(n.anchor.set(s,o,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):P7r(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!==""?zGr[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||Qe(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&&Qe(100);let y=m.getNextSibling(),g=m.__key;YU(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--,YU(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&&Qe(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=Ls();if(un(m)){let h=new Set(l),y=new Set(u),{anchor:g,focus:b}=m;S9r(g,h,y)&&lLe(g,g.getNode(),this,d,c),S9r(b,h,y)&&lLe(b,b.getNode(),this,d,c),f!==0||this.canBeEmpty()||Lx(this)||this.remove()}}return a}getDOMSlot(e){return new Oyt(e)}exportDOM(e){let{element:r}=super.exportDOM(e);if(Fb(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 Ze(t){return t instanceof tB}function S9r(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 yde=class extends eB{decorate(e,r){Qe(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Lu(t){return t instanceof yde}var bZ=class t extends tB{static getType(){return"root"}static clone(){return new t}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){Qe(51)}getTextContent(){let e=this.__cachedText;return!EZ()&&ec()._dirtyType!==e3||e===null?super.getTextContent():e}remove(){Qe(52)}replace(e){Qe(53)}insertBefore(e){Qe(54)}insertAfter(e){Qe(55)}updateDOM(e,r){return!1}splice(e,r,n){for(let o of n)Ze(o)||Lu(o)||Qe(282);return super.splice(e,r,n)}static importJSON(e){return rv().updateFromJSON(e)}collapseAtStart(){return!0}};function ev(t){return t instanceof bZ}function j7r(t){return new cLe(new Map(t._nodeMap))}function Zyt(){return new cLe(new Map([["root",new bZ]]))}function D7r(t){let e=t.exportJSON(),r=t.constructor;if(e.type!==r.getType()&&Qe(130,r.name),Ze(t)){let n=e.children;Array.isArray(n)||Qe(59,r.name);let o=t.getChildren();for(let i=0;i<o.length;i++){let a=D7r(o[i]);n.push(a)}}return e}var cLe=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 _9r(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 _9r(null,this,()=>({root:D7r(rv())}))}},jci="historic",Dci="history-push",X$e="history-merge",$ci="paste",$7r="collaboration",Lci="skip-collab",L7r="skip-scroll-into-view",F7r="skip-dom-selection",dLe=class extends tB{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}},_Z=class t extends tB{static getType(){return"paragraph"}static clone(e){return new t(e.__key)}createDOM(e){let r=document.createElement("p"),n=fZ(e.theme,"paragraph");return n!==void 0&&r.classList.add(...n),r}updateDOM(e,r,n){return!1}static importDOM(){return{p:e=>({conversion:Fci,priority:0})}}exportDOM(e){let{element:r}=super.exportDOM(e);if(Fb(r)){this.isEmpty()&&r.append(document.createElement("br"));let n=this.getFormatType();n&&(r.style.textAlign=n)}return{element:r}}static importJSON(e){return m$().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,r){let n=m$();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||Pr(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 Fci(t){let e=m$();return t.style&&(e.setFormat(t.style.textAlign),aXr(t,e)),{node:e}}function m$(){return Sde(new _Z)}function kci(t){return t instanceof _Z}var qci=0,Uci=1,Bci=2,zci=3,Vci=4;function k7r(t,e,r,n){let o=t._keyToDOMMap;o.clear(),t._editorState=Zyt(),t._pendingEditorState=n,t._compositionKey=null,t._dirtyType=e3,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 Hci(t){let e=t||{},r=Aci(),n=e.theme||{},o=t===void 0?r:e.parentEditor||null,i=e.disableEvents||!1,a=Zyt(),s=e.namespace||(o!==null?o._config.namespace:W7r()),u=e.editorState,l=[bZ,r3,hZ,yZ,_Z,dLe,...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 P=y;y=P.replace,g=P.with,b=P.withKlass||null}let{ownNodeConfig:_}=dbt(y),w=y.getType(),O=y.transform(),T=new Set;_&&_.$transform&&T.add(_.$transform),O!==null&&T.add(O),p.set(w,{exportDOM:d&&d.export?d.export.get(y):void 0,klass:y,replace:g,replaceWithKlass:b,sharedNodeState:B9r(l[h]),transforms:T})}}let m=new vZ(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(O=>{let T=g.get(O);T===void 0&&(T=[],g.set(O,T)),T.push(w[O])})};return h.forEach(w=>{let O=w.klass.importDOM;if(O==null||b.has(O))return;b.add(O);let T=O.call(w.klass);T!==null&&_(T)}),y&&_(y),g}(p,d?d.import:void 0),f,t);return u!==void 0&&(m._pendingEditorState=u,m._dirtyType=mZ),m}var vZ=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=e3,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=W7r(),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&&Qe(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&&Qe(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&&Qe(37,e.name),r}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,r){let n=this._editorState,o=Myt(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=Myt(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=Jm(d);f&&f.markDirty()}},a._pendingEditorState===null?{tag:X$e}: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 gr(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=fZ(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,k7r(this,r,e,o),r!==null&&(this._config.disableEvents||yci(r),n!=null&&r.classList.remove(...n)),e!==null){let i=ubt(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=mZ,U9r(this),this._updateTags.add(X$e),f$(this),this._config.disableEvents||function(s,u){let l=s.ownerDocument,c=aLe.get(l);(c===void 0||c<1)&&l.addEventListener("selectionchange",C7r),aLe.set(l,(c||0)+1),s.__lexicalEditor=u;let d=S7r(s);for(let f=0;f<_yt.length;f++){let[p,m]=_yt[f],h=typeof m=="function"?y=>{n9r(y)||(r9r(y),(u.isEditable()||p==="click")&&m(y,u))}:y=>{if(n9r(y))return;r9r(y);let g=u.isEditable();switch(p){case"cut":return g&&gr(u,Jyt,y);case"copy":return gr(u,Hyt,y);case"paste":return g&&gr(u,Byt,y);case"dragstart":return g&&gr(u,c7r,y);case"dragover":return g&&gr(u,d7r,y);case"dragend":return g&&gr(u,f7r,y);case"focus":return g&&gr(u,p7r,y);case"blur":return g&&gr(u,m7r,y);case"drop":return g&&gr(u,l7r,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(X$e),f$(this);ide("root",this,!1,e,r)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,r){e.isEmpty()&&Qe(38);let n=e;n._readOnly&&(n=j7r(e),n._selection=e._selection?e._selection.clone():null),q9r(this);let o=this._pendingEditorState,i=this._updateTags,a=r!==void 0?r.tag:null;o===null||o.isEmpty()||(a!=null&&i.add(a),f$(this)),this._pendingEditorState=n,this._dirtyType=mZ,this._dirtyElements.set("root",!1),this._compositionKey=null,a!=null&&i.add(a),this._updating||f$(this)}parseEditorState(e,r){return function(n,o,i){let a=Zyt(),s=kh,u=tv,l=qh,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,kh=a,tv=!1,qh=o,Yyt(null);try{let m=o._nodes;Xyt(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,kh=s,tv=u,qh=l}return a}(typeof e=="string"?JSON.parse(e):e,this,r)}read(e){return f$(this),this.getEditorState().read(e,{editor:this})}update(e,r){(function(n,o,i){n._updating?n._updates.push([o,i]):SLe(n,o,i)})(this,e,r)}focus(e,r={}){let n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),ww(this,()=>{let o=Ls(),i=rv();o!==null?o.dirty||nv(o.clone()):i.getChildrenSize()!==0&&(r.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),Y7r("focus"),Q7r(()=>{n.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){let e=this._rootElement;e!==null&&e.blur();let r=OA(this._window);r!==null&&r.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,ide("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};vZ.version="0.34.0+prod.esm";var Tyt=null;function Yyt(t){Tyt=t}var q7r=1;function Jci(){q7r=1}function Qyt(t,e){let r=ebt(t,e);return r===void 0&&Qe(30,e),r}function ebt(t,e){return t._nodes.get(e)}var Wci=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function C9r(t){return Lu(OLe(t))}function tbt(t){let e=document.activeElement;if(!Fb(e))return!1;let r=e.nodeName;return Lu(OLe(t))&&(r==="INPUT"||r==="TEXTAREA"||e.contentEditable==="true"&&vde(e)==null)}function _de(t,e,r){let n=t.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(r)&&e!==null&&!tbt(e)&&rbt(e)===t}catch{return!1}}function CLe(t){return t instanceof vZ}function rbt(t){let e=t;for(;e!=null;){let r=vde(e);if(CLe(r))return r;e=wde(e)}return null}function vde(t){return t?t.__lexicalEditor:null}function ZU(t){return Kyt(t)||t.isToken()}function c$(t){return ZU(t)||t.isSegmented()}function TA(t){return PZ(t)&&t.nodeType===Ili}function U7r(t){return PZ(t)&&t.nodeType===Rli}function o3(t){let e=t;for(;e!=null;){if(TA(e))return e;e=e.firstChild}return null}function fLe(t,e,r){let n=Ly[e];if(r!==null&&(t&n)==(r&n))return t;let o=t^n;return e==="subscript"?o&=~Ly.superscript:e==="superscript"?o&=~Ly.subscript:e==="lowercase"?(o&=~Ly.uppercase,o&=~Ly.capitalize):e==="uppercase"?(o&=~Ly.lowercase,o&=~Ly.capitalize):e==="capitalize"&&(o&=~Ly.lowercase,o&=~Ly.uppercase),o}function Kci(t){return Pr(t)||YJ(t)||Lu(t)}function B7r(t,e){let r=function(){let a=Tyt;return Tyt=null,a}();if((e=e||r&&r.__key)!=null)return void(t.__key=e);Lh(),R7r();let n=ec(),o=b$(),i=""+q7r++;o._nodeMap.set(i,t),Ze(t)?n._dirtyElements.set(i,!0):n._dirtyLeaves.add(i),n._cloneNotNeeded.add(i),n._dirtyType=j9r,t.__key=i}function YU(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 pLe(t){R7r();let e=t.getLatest(),r=e.__parent,n=b$(),o=ec(),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=j9r,Ze(t)?a.set(s,!0):o._dirtyLeaves.add(s)}function Fh(t){Lh();let e=ec(),r=e._compositionKey;if(t!==r){if(e._compositionKey=t,r!==null){let n=Jm(r);n!==null&&n.getWritable()}if(t!==null){let n=Jm(t);n!==null&&n.getWritable()}}}function XU(){return EZ()?null:ec()._compositionKey}function Jm(t,e){let r=(e||b$())._nodeMap.get(t);return r===void 0?null:r}function z7r(t,e){let r=xLe(t,ec());return r!==void 0?Jm(r,e):null}function xLe(t,e){return t[`__lexicalKey_${e._key}`]}function OLe(t,e){let r=t;for(;r!=null;){let n=z7r(r,e);if(n!==null)return n;r=wde(r)}return null}function V7r(t){let e=t._decorators,r=Object.assign({},e);return t._pendingDecorators=r,r}function x9r(t){return t.read(()=>rv().getTextContent())}function rv(){return H7r(b$())}function H7r(t){return t._nodeMap.get("root")}function nv(t){Lh();let e=b$();t!==null&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function lZ(t){let e=ec(),r=function(n,o){let i=n;for(;i!=null;){let a=xLe(i,o);if(a!==void 0)return a;i=wde(i)}return null}(t,e);return r===null?t===e.getRootElement()?Jm("root"):null:Jm(r)}function J7r(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function nbt(t){let e=[],r=t;for(;r!==null;)e.push(r),r=r._parentEditor;return e}function W7r(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function K7r(t){return TA(t)?t.nodeValue:null}function obt(t,e,r){let n=OA(R0(e));if(n===null)return;let o=n.anchorNode,{anchorOffset:i,focusOffset:a}=n;if(o!==null){let s=K7r(o),u=OLe(o);if(s!==null&&Pr(u)){if(s===yLe&&r){let l=r.length;s=r,i=l,a=l}s!==null&&ibt(u,s,i,a,t)}}}function ibt(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]===yLe&&(s=e.slice(0,-1));let u=i.getTextContent();if(o||s!==u){if(s===""){if(Fh(null),ude||pZ||Y$e)i.remove();else{let h=ec();setTimeout(()=>{h.update(()=>{i.isAttached()&&i.remove()})},20)}return}let l=i.getParent(),c=a3(),d=i.getTextContentSize(),f=XU(),p=i.getKey();if(i.isToken()||f!==null&&p===f&&!a||un(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=Ls();if(!un(m)||r===null||n===null)return void O9r(i,s,m);if(m.setTextNodeRange(i,r,i,n),i.isSegmented()){let h=$h(i.getTextContent());i.replace(h),i=h}O9r(i,s,m)}}}function O9r(t,e,r){if(t.setTextContent(e),un(r)){let n=t.getKey();for(let o of["anchor","focus"]){let i=r[o];i.type==="text"&&i.key===n&&(i.offset=Dx(t,i.offset,"clamp"))}}}function H$e(t,e,r){let n=e[r]||!1;return n==="any"||n===t[r]}function G7r(t,e){return H$e(t,e,"altKey")&&H$e(t,e,"ctrlKey")&&H$e(t,e,"shiftKey")&&H$e(t,e,"metaKey")}function Qs(t,e,r){return G7r(t,r)&&t.key.toLowerCase()===e.toLowerCase()}var l$={ctrlKey:!xA,metaKey:xA},T9r={altKey:xA,ctrlKey:!xA};function E9r(t){return t.key==="Backspace"}function P9r(t){return Qs(t,"a",l$)}function Gci(t){let e=rv();if(un(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"),tLe(t),t}{let r=e.select(0,e.getChildrenSize());return nv(tLe(r)),r}}function fZ(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=Q$e(o);return r[e]=i,i}return o}function abt(t,e,r,n,o){if(r.size===0)return;let i=n.__type,a=n.__key,s=e.get(i);s===void 0&&Qe(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 Xci(t){let e=t.getType(),r=b$();if(r._readOnly){let i=Myt(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 M9r(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 X7r(t,e){let r=t.offset;if(t.type==="element")return M9r(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?M9r(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):o}}return null}function Z7r(t){let e=R0(t).event,r=e&&e.inputType;return r==="insertFromPaste"||r==="insertFromPasteAsQuotation"}function gr(t,e,r){return function(n,o,i){let a=nbt(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(ww(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 TLe(t){return!ev(t)&&!t.isLastChild()&&!t.isInline()}function wZ(t,e){let r=t._keyToDOMMap.get(e);return r===void 0&&Qe(75,e),r}function wde(t){let e=t.assignedSlot||t.parentElement;return nXr(e)?e.host:e}function sbt(t){return U7r(t)?t:Fb(t)?t.ownerDocument:null}function Zci(t){return ec()._updateTags.has(t)}function Y7r(t){Lh(),ec()._updateTags.add(t)}function Q7r(t){Lh(),ec()._deferred.push(t)}function mLe(t,e){let r=t.getParent();for(;r!==null;){if(r.is(e))return!0;r=r.getParent()}return!1}function ubt(t){let e=sbt(t);return e?e.defaultView:null}function R0(t){let e=t._window;return e===null&&Qe(78),e}function Yci(t){return Ze(t)&&t.isInline()||Lu(t)&&t.isInline()}function eXr(t){let e=t.getParentOrThrow();for(;e!==null;){if(Lx(e))return e;e=e.getParentOrThrow()}return e}function Lx(t){return ev(t)||Ze(t)&&t.isShadowRoot()}function lbt(t){let e=t.constructor.clone(t);return B7r(e,null),e.afterCloneFrom(t),e}function Sde(t){let e=ec(),r=t.getType(),n=ebt(e,r);n===void 0&&Qe(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||Qe(201,i.name,i.getType(),s.name,s.getType(),t.constructor.name,r):a instanceof t.constructor&&s!==t.constructor||Qe(202,s.name,s.getType(),t.constructor.name,r),a.__key===t.__key&&Qe(203,t.constructor.name,r,s.name,s.getType()),a}return t}function ryt(t,e){!ev(t.getParent())||Ze(e)||Lu(e)||Qe(99)}function tXr(t){let e=Jm(t);return e===null&&Qe(63,t),e}function nyt(t){return(Lu(t)||Ze(t)&&!t.canBeEmpty())&&!t.isInline()}function Eyt(t,e,r){r.style.removeProperty("caret-color"),e._blockCursorElement=null;let n=t.parentElement;n!==null&&n.removeChild(t)}function OA(t){return Fx?(t||window).getSelection():null}function rXr(t){let e=ubt(t);return e?e.getSelection():null}function Qci(t,e){let r=t.getChildAtIndex(e);r==null&&(r=t),Lx(t)&&Qe(102);let n=a=>{let s=a.getParentOrThrow(),u=Lx(s),l=a!==r||u?lbt(a):a;if(u)return Ze(a)&&Ze(l)||Qe(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 edi(t){return Fb(t)&&t.tagName==="A"}function Fb(t){return PZ(t)&&t.nodeType===Mli}function PZ(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"}function nXr(t){return PZ(t)&&t.nodeType===Ali}function oXr(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 Pyt(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 p$(t){if(Lu(t)&&!t.isInline())return!0;if(!Ze(t)||Lx(t))return!1;let e=t.getFirstChild(),r=e===null||YJ(e)||Pr(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&r}function oyt(t,e){let r=t;for(;r!==null&&r.getParent()!==null&&!e(r);)r=r.getParentOrThrow();return e(r)?r:null}function cbt(){return ec()}var I9r=new WeakMap,tdi=new Map;function Myt(t){if(!t._readOnly&&t.isEmpty())return tdi;t._readOnly||Qe(192);let e=I9r.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),I9r.set(t,e)),e}function iXr(t){let e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function aXr(t,e){let r=parseInt(t.style.paddingInlineStart,10)||0,n=Math.round(r/40);e.setIndent(n)}function rdi(t){t.__lexicalUnmanaged=!0}function sXr(t){return t.__lexicalUnmanaged===!0}function ede(t,e){return function(r,n){return Object.prototype.hasOwnProperty.call(r,n)}(t,e)&&t[e]!==eB[e]}function dbt(t){let e=VGr in t.prototype?t.prototype[VGr]():void 0,r=function(a){return a===yde||a===tB||a===eB}(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=>(Yyt(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 ndi(t){let e=cbt();return Lh(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t))).klass}var odi={next:"previous",previous:"next"},SZ=class{constructor(e){this.origin=e}[Symbol.iterator](){return mbt({hasNext:i3,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Uh(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Uh(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&&Qe(263,Array.from(s).join(" "))}else i.insert(u);i=Uh(u,this.direction)}for(let u of s.values())u.remove();return this}},bde=class t extends SZ{constructor(){super(...arguments);x(this,"type","child")}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:y$(r,this.direction)}getParentCaret(r="root"){return Uh(fbt(this.getParentAtCaret(),r),this.direction)}getFlipped(){let r=aB(this.direction);return Uh(this.getNodeAtCaret(),r)||y$(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)}},idi={root:ev,shadowRoot:Lx};function aB(t){return odi[t]}function fbt(t,e="root"){return idi[e](t)?null:t}var CZ=class t extends SZ{constructor(){super(...arguments);x(this,"type","sibling")}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:Uh(r,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Ze(this.origin)?y$(this.origin,this.direction):null}getParentCaret(r="root"){return Uh(fbt(this.getParentAtCaret(),r),this.direction)}getFlipped(){let r=aB(this.direction);return Uh(this.getNodeAtCaret(),r)||y$(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 xZ)&&this.direction===r.direction&&this.origin.is(r.origin)}},xZ=class t extends SZ{constructor(r,n){super(r);x(this,"type","text");this.offset=n}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:rB(r,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(r="root"){return Uh(fbt(this.getParentAtCaret(),r),this.direction)}getFlipped(){return rB(this.origin,aB(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 CZ||r instanceof t)&&this.direction===r.direction&&this.origin.is(r.origin)}getSiblingCaret(){return Uh(this.origin,this.direction)}};function h$(t){return t instanceof xZ}function adi(t){return t instanceof SZ}function i3(t){return t instanceof CZ}function jx(t){return t instanceof bde}var sdi={next:class extends xZ{constructor(){super(...arguments);x(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends xZ{constructor(){super(...arguments);x(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},udi={next:class extends CZ{constructor(){super(...arguments);x(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends CZ{constructor(){super(...arguments);x(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},ldi={next:class extends bde{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 bde{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 Uh(t,e){return t?new udi[e](t):null}function rB(t,e,r){return t?new sdi[e](t,Dx(t,r)):null}function Dx(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 Iyt(t,e){return new hLe(t,e)}function y$(t,e){return Ze(t)?new ldi[e](t):null}function uXr(t){return t&&t.getChildCaret()||t}function OZ(t){return t&&uXr(t.getAdjacentCaret())}var Ryt=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 h$(i)?function(a,s){let{direction:u,origin:l}=a,c=Dx(l,s==="focus"?aB(u):u);return Iyt(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[Iyt(o,i.offset-o.offset),null]}return[r,n]}iterNodeCarets(e="root"){let r=h$(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),o=h$(n),i=a=>a.isSameNodeCaret(n)?null:OZ(a)||a.getParentCaret(e);return mbt({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")}},hLe=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 rB(e.setTextContent(i.slice(0,n)+i.slice(o)),r,n)}};function cdi(t){return t instanceof hLe}function pbt(t){return nB(t,Uh(rv(),t.direction))}function lXr(t){return nB(t,t)}function nB(t,e){return t.direction!==e.direction&&Qe(265),new Ryt(t,e,t.direction)}function mbt(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 hbt(t,e){let r=ade(t.origin,e.origin);switch(r===null&&Qe(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 gbt(r)}}function gbt(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 J$e(t,e){return e.is(t)}function R9r(t){return Ze(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function ade(t,e){if(t.is(e))return{commonAncestor:t,type:"same"};let r=new Map;for(let[n,o]=R9r(t);n;o=n,n=n.getParent())r.set(n,o);for(let[n,o]=R9r(e);n;o=n,n=n.getParent()){let i=r.get(n);if(i!==void 0)return i===null?(J$e(t,n)||Qe(276),{commonAncestor:n,type:"ancestor"}):o===null?(J$e(e,n)||Qe(277),{commonAncestor:n,type:"descendant"}):((Ze(i)||J$e(t,i))&&(Ze(o)||J$e(e,o))&&n.is(i.getParent())&&n.is(o.getParent())||Qe(278),{a:i,b:o,commonAncestor:n,type:"branch"})}return null}function oB(t,e){let{type:r,key:n,offset:o}=t,i=tXr(t.key);return r==="text"?(Pr(i)||Qe(266,i.getType(),n),rB(i,e,o)):(Ze(i)||Qe(267,i.getType(),n),pXr(i,t.offset,e))}function TZ(t,e){let{origin:r,direction:n}=e,o=n==="next";h$(e)?t.set(r.getKey(),e.offset,"text"):i3(e)?Pr(r)?t.set(r.getKey(),Dx(r,n),"text"):t.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(o?1:0),"element"):(jx(e)&&Ze(r)||Qe(268),t.set(r.getKey(),o?0:r.getChildrenSize(),"element"))}function cXr(t){let e=Ls(),r=un(e)?e:M7r();return sde(r,t),nv(r),r}function sde(t,e){TZ(t.anchor,e.anchor),TZ(t.focus,e.focus)}function Ayt(t){let{anchor:e,focus:r}=t,n=oB(e,"next"),o=oB(r,"next"),i=hbt(n,o)<=0?"next":"previous";return nB(iB(n,i),iB(o,i))}function MZ(t){let{direction:e,origin:r}=t,n=Uh(r,aB(e)).getNodeAtCaret();return n?Uh(n,e):y$(r.getParentOrThrow(),e)}function A9r(t,e="root"){let r=[t];for(let n=jx(t)?t.getParentCaret(e):t.getSiblingCaret();n!==null;n=n.getParentCaret(e))r.push(MZ(n));return r}function iyt(t){return!!t&&t.origin.isAttached()}function dXr(t,e="removeEmptySlices"){if(t.isCollapsed())return t;let r="root",n="next",o=e,i=ybt(t,n),a=A9r(i.anchor,r),s=A9r(i.focus.getFlipped(),r),u=new Set,l=[];for(let m of i.iterNodeCarets(r))if(jx(m))u.add(m.origin.getKey());else if(i3(m)){let{origin:h}=m;Ze(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=MZ(Uh(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 O=_.origin,T=$h(O.getTextContent()).setStyle(O.getStyle()).setFormat(O.getFormat());g.replaceOrInsert(T),_=rB(T,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(iyt(m)){c=Ax(m);break}for(let m of s)if(iyt(m)){d=Ax(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 O=Math.min(_.length,w.length),T;for(T=0;T<O&&_[T]===w[T];T++);let P=(j,A)=>{let k;for(let V=T;V<j.length;V++){let q=j[V];if(Lx(q))return;!k&&A(q)&&(k=q)}return k},M=P(_,p$),I=M&&P(w,j=>y.has(j.getKey())&&p$(j));return M&&I?[M,I]:null}(c,d,u);if(f){let[m,h]=f;y$(m,"previous").splice(0,h.getChildren()),h.remove()}let p=[c,d,...a,...s].find(iyt);if(p)return lXr(iB(Ax(p),t.direction));Qe(269,JSON.stringify(a.map(m=>m.origin.__key)))}function Ax(t){let e=function(o){let i=o;for(;jx(i);){let a=OZ(i);if(!jx(a))break;i=a}return i}(t.getLatest()),{direction:r}=e;if(Pr(e.origin))return h$(e)?e:rB(e.origin,r,r);let n=e.getAdjacentCaret();return i3(n)&&Pr(n.origin)?rB(n.origin,r,aB(r)):e}function fXr(t){return h$(t)&&t.offset!==Dx(t.origin,t.direction)}function iB(t,e){return t.direction===e?t:t.getFlipped()}function ybt(t,e){return t.direction===e?t:nB(iB(t.focus,e),iB(t.anchor,e))}function pXr(t,e,r){let n=y$(t,"next");for(let o=0;o<e;o++){let i=n.getAdjacentCaret();if(i===null)break;n=i}return iB(n,r)}function ddi(t,e="root"){let r=0,n=t,o=OZ(n);for(;o===null;){if(r--,o=n.getParentCaret(e),!o)return null;n=o,o=OZ(n)}return o&&[o,r]}function fdi(t){let{origin:e,offset:r,direction:n}=t;if(r===Dx(e,n))return t.getSiblingCaret();if(r===Dx(e,aB(n)))return MZ(t.getSiblingCaret());let[o]=e.splitText(r);return Pr(o)||Qe(281),iB(Uh(o,"next"),n)}function pdi(t,e){return!0}function mdi(t,{$copyElementNode:e=lbt,$splitTextPointCaretNext:r=fdi,rootMode:n="shadowRoot",$shouldSplit:o=pdi}={}){if(h$(t))return r(t);let i=t.getParentCaret(n);if(i){let{origin:a}=i;if(jx(t)&&(!a.canBeEmpty()||!o(a,"first")))return MZ(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 he=bbt,SIs=he.$addUpdateTag,CIs=he.$applyNodeReplacement,IZ=he.$caretFromPoint,mXr=he.$caretRangeFromSelection,sB=he.$cloneWithProperties,xIs=he.$comparePointCaretNext,OIs=he.$copyNode,TIs=he.$create,_bt=he.$createLineBreakNode,EIs=he.$createNodeSelection,_$=he.$createParagraphNode,PIs=he.$createPoint,ELe=he.$createRangeSelection,MIs=he.$createRangeSelectionFromDom,hXr=he.$createTabNode,Sw=he.$createTextNode,gXr=he.$extendCaretToRange,Cde=he.$getAdjacentChildCaret,IIs=he.$getAdjacentNode,RIs=he.$getAdjacentSiblingOrParentSiblingCaret,vbt=he.$getCaretInDirection,yXr=he.$getCaretRange,AIs=he.$getCaretRangeInDirection,bXr=he.$getCharacterOffsets,uB=he.$getChildCaret,NIs=he.$getChildCaretAtIndex,wbt=he.$getChildCaretOrSelf,_Xr=he.$getCollapsedCaretRange,jIs=he.$getCommonAncestor,DIs=he.$getCommonAncestorResultBranchOrder,PLe=he.$getEditor,$Is=he.$getNearestNodeFromDOMNode,LIs=he.$getNearestRootOrShadowRoot,vXr=he.$getNodeByKey,FIs=he.$getNodeByKeyOrThrow,xde=he.$getPreviousSelection,Ri=he.$getRoot,hn=he.$getSelection,v$=he.$getSiblingCaret,wXr=he.$getState,kIs=he.$getStateChange,qIs=he.$getTextContent,UIs=he.$getTextNodeOffset,BIs=he.$getTextPointCaret,zIs=he.$getTextPointCaretSlice,VIs=he.$getWritableNodeState,SXr=he.$hasAncestor,HIs=he.$hasUpdateTag,JIs=he.$insertNodes,MLe=he.$isBlockElementNode,Ode=he.$isChildCaret,ILe=he.$isDecoratorNode,fi=he.$isElementNode,CXr=he.$isExtendableTextPointCaret,WIs=he.$isInlineElementOrDecoratorNode,xXr=he.$isLeafNode,KIs=he.$isLineBreakNode,GIs=he.$isNodeCaret,XIs=he.$isNodeSelection,OXr=he.$isParagraphNode,Rr=he.$isRangeSelection,RZ=he.$isRootNode,s3=he.$isRootOrShadowRoot,TXr=he.$isSiblingCaret,ZIs=he.$isTabNode,Gi=he.$isTextNode,RLe=he.$isTextPointCaret,YIs=he.$isTextPointCaretSlice,Sbt=he.$isTokenOrSegmented,QIs=he.$isTokenOrTab,eRs=he.$nodesOfType,EXr=he.$normalizeCaret,tRs=he.$normalizeSelection__EXPERIMENTAL,rRs=he.$onUpdate,PXr=he.$parseSerializedNode,nRs=he.$removeTextFromCaretRange,MXr=he.$rewindSiblingCaret,ALe=he.$selectAll,oRs=he.$setCompositionKey,iRs=he.$setPointFromCaret,u3=he.$setSelection,IXr=he.$setSelectionFromCaretRange,RXr=he.$setState,AXr=he.$splitAtPointCaretNext,NXr=he.$splitNode,aRs=he.$updateRangeSelectionFromCaretRange,Cbt=he.ArtificialNode__DO_NOT_USE,jXr=he.BLUR_COMMAND,Tde=he.CAN_REDO_COMMAND,Ede=he.CAN_UNDO_COMMAND,DXr=he.CLEAR_EDITOR_COMMAND,$Xr=he.CLEAR_HISTORY_COMMAND,sRs=he.CLICK_COMMAND,uRs=he.COLLABORATION_TAG,NLe=he.COMMAND_PRIORITY_CRITICAL,Zu=he.COMMAND_PRIORITY_EDITOR,w$=he.COMMAND_PRIORITY_HIGH,LXr=he.COMMAND_PRIORITY_LOW,lRs=he.COMMAND_PRIORITY_NORMAL,FXr=he.CONTROLLED_TEXT_INSERTION_COMMAND,jLe=he.COPY_COMMAND,kXr=he.CUT_COMMAND,AZ=he.DELETE_CHARACTER_COMMAND,qXr=he.DELETE_LINE_COMMAND,UXr=he.DELETE_WORD_COMMAND,cRs=he.DRAGEND_COMMAND,dRs=he.DRAGOVER_COMMAND,BXr=he.DRAGSTART_COMMAND,zXr=he.DROP_COMMAND,DLe=he.DecoratorNode,fRs=he.ElementNode,pRs=he.FOCUS_COMMAND,mRs=he.FORMAT_ELEMENT_COMMAND,hRs=he.FORMAT_TEXT_COMMAND,$Le=he.HISTORIC_TAG,NZ=he.HISTORY_MERGE_TAG,VXr=he.HISTORY_PUSH_TAG,gRs=he.INDENT_CONTENT_COMMAND,xbt=he.INSERT_LINE_BREAK_COMMAND,HXr=he.INSERT_PARAGRAPH_COMMAND,yRs=he.INSERT_TAB_COMMAND,Pde=he.INTERNAL_$isBlock,bRs=he.IS_ALL_FORMATTING,_Rs=he.IS_BOLD,vRs=he.IS_CODE,wRs=he.IS_HIGHLIGHT,SRs=he.IS_ITALIC,CRs=he.IS_STRIKETHROUGH,xRs=he.IS_SUBSCRIPT,ORs=he.IS_SUPERSCRIPT,TRs=he.IS_UNDERLINE,JXr=he.KEY_ARROW_DOWN_COMMAND,WXr=he.KEY_ARROW_LEFT_COMMAND,KXr=he.KEY_ARROW_RIGHT_COMMAND,GXr=he.KEY_ARROW_UP_COMMAND,XXr=he.KEY_BACKSPACE_COMMAND,ZXr=he.KEY_DELETE_COMMAND,ERs=he.KEY_DOWN_COMMAND,jZ=he.KEY_ENTER_COMMAND,YXr=he.KEY_ESCAPE_COMMAND,PRs=he.KEY_MODIFIER_COMMAND,MRs=he.KEY_SPACE_COMMAND,QXr=he.KEY_TAB_COMMAND,IRs=he.LineBreakNode,RRs=he.MOVE_TO_END,ARs=he.MOVE_TO_START,NRs=he.NODE_STATE_KEY,jRs=he.OUTDENT_CONTENT_COMMAND,LLe=he.PASTE_COMMAND,eZr=he.PASTE_TAG,DRs=he.ParagraphNode,tZr=he.REDO_COMMAND,rZr=he.REMOVE_TEXT_COMMAND,$Rs=he.RootNode,LRs=he.SELECTION_CHANGE_COMMAND,nZr=he.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,oZr=he.SELECT_ALL_COMMAND,FRs=he.SKIP_COLLAB_TAG,kRs=he.SKIP_DOM_SELECTION_TAG,qRs=he.SKIP_SCROLL_INTO_VIEW_TAG,URs=he.TEXT_TYPE_TO_FORMAT,BRs=he.TabNode,EA=he.TextNode,iZr=he.UNDO_COMMAND,zRs=he.buildImportMap,aZr=he.createCommand,sZr=he.createEditor,VRs=he.createSharedNodeState,HRs=he.createState,JRs=he.flipDirection,WRs=he.getDOMOwnerDocument,Obt=he.getDOMSelection,KRs=he.getDOMSelectionFromTarget,uZr=he.getDOMTextNode,GRs=he.getEditorPropertyFromDOMNode,XRs=he.getNearestEditorFromDOMNode,lZr=he.getRegisteredNode,ZRs=he.getRegisteredNodeOrThrow,cZr=he.isBlockDomNode,YRs=he.isCurrentlyReadOnlyMode,QRs=he.isDOMDocumentNode,eAs=he.isDOMNode,tAs=he.isDOMTextNode,rAs=he.isDOMUnmanaged,Tbt=he.isDocumentFragment,nAs=he.isExactShortcutMatch,dZr=he.isHTMLAnchorElement,FLe=he.isHTMLElement,Mde=he.isInlineDomNode,oAs=he.isLexicalEditor,iAs=he.isModifierMatch,aAs=he.isSelectionCapturedInDecoratorInput,fZr=he.isSelectionWithinEditor,Ebt=he.makeStepwiseIterator,sAs=he.removeFromParent,uAs=he.resetRandomKey,lAs=he.setDOMUnmanaged,cAs=he.setNodeIndentFromDOM;var MZr=L(X());Jr();var EZr=require("obsidian"),Yn=L(X());to();var kLe=L(X());Wye();kn();var hdi=N6("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"}}),Bh=kLe.forwardRef(({className:t,variant:e,...r},n)=>kLe.createElement("div",{ref:n,className:Te(hdi({variant:e}),t),...r}));Bh.displayName="Badge";var nr=L(X());Jr();to();var DZ=L(X());kn();var qLe=L(X()),gdi=2;function ydi(t,e){return e&&e>1?t.current?t.current.offsetHeight<t.current.scrollHeight:!1:(t.current&&t.current?.offsetWidth+gdi<t.current?.scrollWidth)??!1}function bdi(t){switch(t){case 2:return"tw-line-clamp-2";case 3:return"tw-line-clamp-3";default:return""}}var tc=({children:t,className:e,lineClamp:r,tooltipContent:n,alwaysShowTooltip:o=!1,...i})=>{let a=(0,qLe.useRef)(null),[s,u]=(0,qLe.useState)(!1);return DZ.default.createElement(jb,{delayDuration:0},DZ.default.createElement(pn,{open:s,onOpenChange:c=>{u(c&&(o||ydi(a,r)))}},DZ.default.createElement(mn,{asChild:!0},DZ.default.createElement("div",{...i,ref:a,className:Te("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&bdi(r),e),"data-testid":"truncatedText"},t)),DZ.default.createElement(sn,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};Zt();kn();var pZr=L(X());kn();function PA({children:t,className:e,hasRemoveButton:r=!1,isClickable:n=!1,...o}){return pZr.default.createElement(Bh,{variant:"default",className:Te("tw-items-center tw-border tw-border-solid tw-border-border tw-py-0 tw-pl-2 tw-text-xs",r?"tw-pr-0.5":"tw-pr-2",n&&"tw-cursor-pointer hover:tw-bg-interactive-hover",e),...o},t)}function ULe(t){return t.sourceType==="web"}function Ide({faviconUrl:t,isLoaded:e=!0,className:r="tw-size-3"}){let[n,o]=nr.default.useState(!!t);return nr.default.useEffect(()=>{o(!!t)},[t]),e?n&&t?nr.default.createElement("img",{src:t,alt:"",referrerPolicy:"no-referrer",loading:"lazy",decoding:"async",className:Te(r,"tw-rounded-sm"),onError:()=>o(!1)}):nr.default.createElement(cl,{className:r}):nr.default.createElement(IN,{className:Te(r,"tw-text-muted")})}function mZr({currentActiveFile:t,onRemove:e,onClick:r}){if(!t)return null;let n=nr.default.createElement("div",{className:"tw-text-left"},t.path),o=t.extension==="pdf",i=t.extension==="canvas";return nr.default.createElement(PA,{hasRemoveButton:!!e,isClickable:!!r,onClick:r},nr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},nr.default.createElement(Ju,{className:"tw-size-3"}),nr.default.createElement(tc,{className:"tw-max-w-40",tooltipContent:n,alwaysShowTooltip:!0},t.basename),nr.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),o&&nr.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf"),i&&nr.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"canvas")),e&&nr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:a=>{a.stopPropagation(),e()},"aria-label":"Remove from context",className:"tw-text-muted"},nr.default.createElement($o,{className:"tw-size-4"})))}function hZr({activeWebTab:t,onRemove:e,onClick:r}){if(!t)return null;let n=cN(t.url),o=t.title||n||t.url||"Untitled",i=nr.default.createElement("div",{className:"tw-text-left"},t.url);return nr.default.createElement(PA,{hasRemoveButton:!!e,isClickable:!!r,onClick:r},nr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},nr.default.createElement(Ide,{faviconUrl:t.faviconUrl}),nr.default.createElement(tc,{className:"tw-max-w-40",tooltipContent:i,alwaysShowTooltip:!0},o),nr.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current")),e&&nr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:a=>{a.stopPropagation(),e()},"aria-label":"Remove from context",className:"tw-text-muted"},nr.default.createElement($o,{className:"tw-size-4"})))}function BLe({note:t,onRemove:e,onClick:r}){let n=nr.default.createElement("div",{className:"tw-text-left"},t.path),o=t.extension==="pdf",i=t.extension==="canvas";return nr.default.createElement(PA,{hasRemoveButton:!!e,isClickable:!!r,onClick:r},nr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},nr.default.createElement(Ju,{className:"tw-size-3"}),nr.default.createElement(tc,{className:"tw-max-w-40",tooltipContent:n,alwaysShowTooltip:!0},t.basename),o&&nr.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf"),i&&nr.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"canvas")),e&&nr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:a=>{a.stopPropagation(),e()},"aria-label":"Remove from context",className:"tw-text-muted"},nr.default.createElement($o,{className:"tw-size-4"})))}function zLe({url:t,onRemove:e}){return nr.default.createElement(PA,{hasRemoveButton:!!e},nr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},nr.default.createElement(AN,{className:"tw-size-3"}),nr.default.createElement(tc,{className:"tw-max-w-40",tooltipContent:t},cN(t))),e&&nr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,"aria-label":"Remove from context",className:"tw-text-muted"},nr.default.createElement($o,{className:"tw-size-4"})))}function VLe({webTab:t,onRemove:e,onClick:r}){let n=t.isLoaded!==!1,o=cN(t.url),i=t.title||o||t.url||"Untitled",a=n?t.url:"Tab not loaded - switch to this tab to load content";return nr.default.createElement(PA,{hasRemoveButton:!!e,isClickable:!!r,onClick:r,className:Te(!n&&"tw-opacity-60")},nr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},nr.default.createElement(Ide,{faviconUrl:t.faviconUrl,isLoaded:n}),nr.default.createElement(tc,{className:Te("tw-max-w-40",!n&&"tw-italic"),tooltipContent:a},i),!n&&nr.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"(not loaded)")),e&&nr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:s=>{s.stopPropagation(),e()},"aria-label":"Remove from context",className:"tw-text-muted"},nr.default.createElement($o,{className:"tw-size-4"})))}function gZr({tag:t,onRemove:e}){let r=t.startsWith("#")?t.slice(1):t;return nr.default.createElement(PA,{hasRemoveButton:!!e},nr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},nr.default.createElement(Xte,{className:"tw-size-3"}),nr.default.createElement(tc,{className:"tw-max-w-40",tooltipContent:t},r)),e&&nr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,"aria-label":"Remove from context",className:"tw-text-muted"},nr.default.createElement($o,{className:"tw-size-4"})))}function HLe({folder:t,onRemove:e}){return nr.default.createElement(PA,{hasRemoveButton:!!e},nr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},nr.default.createElement(ah,{className:"tw-size-3"}),nr.default.createElement(tc,{className:"tw-max-w-40",tooltipContent:t,alwaysShowTooltip:!0},t)),e&&nr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,"aria-label":"Remove from context",className:"tw-text-muted"},nr.default.createElement($o,{className:"tw-size-4"})))}function yZr({selectedText:t,onRemove:e}){if(ULe(t)){let o=cN(t.url),i=nr.default.createElement("div",{className:"tw-text-left"},t.url);return nr.default.createElement(PA,{hasRemoveButton:!!e},nr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},nr.default.createElement(Ide,{faviconUrl:t.faviconUrl}),nr.default.createElement(tc,{className:"tw-max-w-40",tooltipContent:i,alwaysShowTooltip:!0},t.title||o),nr.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Selection")),e&&nr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,"aria-label":"Remove from context",className:"tw-text-muted"},nr.default.createElement($o,{className:"tw-size-4"})))}let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`,n=nr.default.createElement("div",{className:"tw-text-left"},t.notePath," (",r,")");return nr.default.createElement(PA,{hasRemoveButton:!!e},nr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},nr.default.createElement(Ju,{className:"tw-size-3"}),nr.default.createElement(tc,{className:"tw-max-w-40",tooltipContent:n,alwaysShowTooltip:!0},t.noteTitle),nr.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),e&&nr.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,"aria-label":"Remove from context",className:"tw-text-muted"},nr.default.createElement($o,{className:"tw-size-4"})))}Bc();qs();Zt();CX();var ov=L(X());var bZr=L(X());var Cu=L(X());Jr();kn();var _di=120,vdi=240;function JLe({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,Cu.useRef)(null),m=(0,Cu.useRef)(null),[h,y]=Cu.default.useState(null);(0,Cu.useEffect)(()=>{y(null)},[e]),(0,Cu.useEffect)(()=>{p.current&&p.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[e]);let g=w=>{let O=w.target.value;l?.(O)},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 Cu.default.createElement("div",{className:Te("tw-flex tw-flex-col",d)},_&&Cu.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:_di,maxHeight:vdi,...f&&{width:f}}},Cu.default.createElement("div",{className:"tw-mb-1 tw-text-xs tw-text-muted"},"Preview"),t[e].subtitle&&Cu.default.createElement("div",{className:"tw-mb-2 tw-text-xs tw-text-muted"},t[e].subtitle),Cu.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-normal"},t[e].content)),Cu.default.createElement("div",{className:"tw-overflow-hidden tw-rounded-lg tw-bg-primary",style:{...f&&{width:f}}},Cu.default.createElement("div",{className:"tw-overflow-y-auto",style:{minHeight:Math.min(t.length*44+16,100),maxHeight:240}},Cu.default.createElement("div",{className:"tw-p-2 tw-text-normal"},t.map((w,O)=>{let T=O===e,P=O===h,M=w.disabled??!1,I=(T||P)&&!M,j=i==="category"&&!o&&w.icon&&!("data"in w);return Cu.default.createElement("div",{key:w.key,ref:T?p:void 0,className:Te("tw-flex tw-items-center tw-rounded-md tw-px-3 tw-py-2 tw-text-sm",M?"tw-cursor-not-allowed tw-text-muted tw-opacity-50":"tw-cursor-pointer tw-text-normal",I&&"tw-bg-modifier-hover"),title:M?w.disabledReason:void 0,onMouseDown:A=>{A.preventDefault(),!M&&r(w)},onMouseEnter:()=>{M||(y(O),n(O))},onMouseLeave:()=>y(null)},j?Cu.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between"},Cu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},w.icon,Cu.default.createElement("span",{className:"tw-font-medium"},w.title)),Cu.default.createElement(bm,{className:"tw-size-4 tw-text-muted"})):Cu.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center tw-gap-2"},w.icon&&Cu.default.createElement("div",{className:"tw-flex tw-h-full tw-shrink-0 tw-items-center"},w.icon),Cu.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col tw-gap-0.5"},Cu.default.createElement("div",{className:"tw-truncate tw-font-medium tw-text-normal"},w.title),w.subtitle&&Cu.default.createElement("div",{className:"tw-truncate tw-text-xs tw-text-muted"},w.subtitle))))}))),s&&Cu.default.createElement("div",{className:"tw-border-t tw-border-solid tw-border-border tw-p-0.5"},Cu.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 _Zr({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 bZr.default.createElement(JLe,{options:t,selectedIndex:e,onSelect:r,onHighlight:n,query:o,mode:i,showPreview:a,searchBarMode:s,searchQuery:u,onSearchChange:l,onKeyDown:c})}var l3=L(X()),vZr=require("obsidian");Jr();var wdi=[{key:"notes",title:"Notes",subtitle:"Reference notes in your vault",category:"notes",icon:l3.default.createElement(Ju,{className:"tw-size-4"})},{key:"webTabs",title:"Web Tabs",subtitle:"Reference open browser tabs",category:"webTabs",icon:l3.default.createElement(cl,{className:"tw-size-4"})},{key:"tools",title:"Tools",subtitle:"AI tools and commands",category:"tools",icon:l3.default.createElement(Av,{className:"tw-size-4"})},{key:"folders",title:"Folders",subtitle:"Reference vault folders",category:"folders",icon:l3.default.createElement(ah,{className:"tw-size-4"})}];function WLe(t=!1){return(0,l3.useMemo)(()=>wdi.filter(e=>e.category==="tools"?t:e.category==="webTabs"?vZr.Platform.isDesktopApp:!0),[t])}var Fy=L(X()),Nbt=require("obsidian");Jr();var jbt=L(Rde());Y1e();k1e();var SZr=L(X());eC();eC();var kx=require("obsidian"),Ade=L(oG());ot();Zt();_t();var GLe=250,Pbt=Cc([]),Mbt=Cc([]),Ibt=Cc([]),Rbt=Cc([]),c3=class c3{constructor(){this.initialized=!1;this.handleFileCreate=e=>{e instanceof kx.TFile?bO(e)&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof kx.TFolder&&this.debouncedRefreshFolders()};this.handleFileDelete=e=>{e instanceof kx.TFile?bO(e)&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof kx.TFolder&&this.debouncedRefreshFolders()};this.handleFileRename=(e,r)=>{e instanceof kx.TFile?bO(e)&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof kx.TFolder&&this.debouncedRefreshFolders()};this.handleFileModify=e=>{e instanceof kx.TFile&&e.extension==="md"&&this.debouncedRefreshTagsAll()};this.handleMetadataChange=e=>{e.extension==="md"&&(this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll())};this.debouncedRefreshNotes=(0,Ade.default)(()=>this.refreshNotes(),GLe,{leading:!0,trailing:!0});this.debouncedRefreshFolders=(0,Ade.default)(()=>this.refreshFolders(),GLe,{leading:!0,trailing:!0});this.debouncedRefreshTagsFrontmatter=(0,Ade.default)(()=>this.refreshTagsFrontmatter(),GLe,{leading:!0,trailing:!0});this.debouncedRefreshTagsAll=(0,Ade.default)(()=>this.refreshTagsAll(),GLe,{leading:!0,trailing:!0});this.refreshNotes=()=>{if(!app?.vault)return;let r=app.vault.getFiles().filter(n=>n instanceof kx.TFile&&bO(n));ui.set(Pbt,r)};this.refreshFolders=()=>{if(!app?.vault)return;let e=app.vault.getAllLoadedFiles().filter(r=>r instanceof kx.TFolder);ui.set(Mbt,e)};this.refreshTagsFrontmatter=()=>{if(!app?.vault||!app?.metadataCache)return;let e=new Set;app.vault.getMarkdownFiles().forEach(n=>{yO(n,!0).forEach(i=>{let a=i.startsWith("#")?i:`#${i}`;e.add(a)})});let r=Array.from(e).sort();ui.set(Ibt,r)};this.refreshTagsAll=()=>{if(!app?.vault||!app?.metadataCache)return;let e=new Set;app.vault.getMarkdownFiles().forEach(n=>{yO(n,!1).forEach(i=>{let a=i.startsWith("#")?i:`#${i}`;e.add(a)})});let r=Array.from(e).sort();ui.set(Rbt,r)}}static getInstance(){return c3.instance||(c3.instance=new c3),c3.instance}initialize(){if(this.initialized){B("VaultDataManager: Already initialized, skipping");return}if(!app?.vault){B("VaultDataManager: app.vault not available, deferring initialization");return}B("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&&(B("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()}};c3.instance=null;var Nde=c3;ot();function XLe(t=!1){let e=e_(Pbt,{store:ui});return(0,SZr.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])}eC();ot();function CZr(){return e_(Mbt,{store:ui})}var $Z=L(X()),xZr=require("obsidian");SJ();var Sdi=6e3;function Cdi(){try{let t=ed(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 xdi(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 OZr(t={}){let{enabled:e=!0}=t,[r,n]=(0,$Z.useState)([]),o=(0,$Z.useRef)(null);return(0,$Z.useEffect)(()=>{if(!e){n([]);return}if(!xZr.Platform.isDesktopApp){n([]);return}let i=!1,a=()=>{if(i)return;let p=Cdi();n(m=>xdi(m,p)?m:p)},s=()=>{i||o.current===null&&(o.current=window.requestAnimationFrame(()=>{o.current=null,a()}))};a();let l=ed(app).subscribeToWebviewLoad(s),c=app.workspace.on("layout-change",s),d=app.workspace.on("active-leaf-change",s),f=window.setInterval(s,Sdi);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 YLe=L(X()),Abt=require("obsidian");SJ();var ZLe={activeWebTabForMentions:null,activeOrLastWebTab:null};function lB(){let[t,e]=(0,YLe.useState)(()=>{if(!Abt.Platform.isDesktopApp)return ZLe;try{return ed(app).getActiveWebTabState()}catch{return ZLe}});return(0,YLe.useEffect)(()=>{if(!Abt.Platform.isDesktopApp){e(ZLe);return}let r;try{let n=ed(app);e(n.getActiveWebTabState()),r=n.subscribeActiveWebTabState(e)}catch{e(ZLe)}return()=>{r?.()}},[]),t}ot();var jde=30;function QLe(t,e,r,n,o,i=null){let a=XLe(n),s=CZr(),u=Nbt.Platform.isDesktopApp&&(e==="category"&&t.trim().length>0||e==="search"&&r==="webTabs"),l=OZr({enabled:u}),{activeWebTabForMentions:c}=lB(),d=(0,Fy.useMemo)(()=>a.map((h,y)=>({key:`note-${h.basename}-${y}`,title:h.basename,subtitle:h.path,category:"notes",data:h,content:void 0,icon:Fy.default.createElement(Ju,{className:"tw-size-4"}),searchKeyword:h.path})),[a]),f=(0,Fy.useMemo)(()=>n?S7.map(h=>({key:`tool-${h}`,title:h,subtitle:Mft(h),category:"tools",data:h,content:Mft(h),icon:Fy.default.createElement(Av,{className:"tw-size-4"})})):[],[n]),p=(0,Fy.useMemo)(()=>s.map(h=>({key:`folder-${h.path}`,title:h.name,subtitle:h.path,category:"folders",data:h,content:void 0,icon:Fy.default.createElement(ah,{className:"tw-size-4"}),searchKeyword:h.path})),[s]),m=(0,Fy.useMemo)(()=>Nbt.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?Fy.default.createElement(cl,{className:"tw-size-4"}):Fy.default.createElement(IN,{className:"tw-size-4 tw-text-muted"}),searchKeyword:`${h.title||""} ${h.url||""}`}}):[],[l]);return(0,Fy.useMemo)(()=>{if(e==="category"){if(!t){let j=o.map(k=>({...k,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:Fy.default.createElement(cl,{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:Fy.default.createElement(jN,{className:"tw-size-4"})}),A.length>0?[...A,...j]:j}let h=t.toLowerCase(),y=f.filter(j=>j.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:Fy.default.createElement(jN,{className:"tw-size-4"})}:null,T="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:Fy.default.createElement(cl,{className:"tw-size-4"})}:null,P=[...d,...p,...m],I=jbt.default.go(t,P,{keys:["searchKeyword"],limit:jde,threshold:-1e4}).map(j=>j.obj);return[...y,...T?[T]:[],..._?[_]:[],...I].slice(0,jde)}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=ae().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,jde)}return h.slice(0,jde)}return jbt.default.go(t,h,{keys:["title","subtitle"],limit:jde,threshold:-1e4}).map(g=>g.obj)}},[e,t,r,d,f,p,m,o,c,i])}function Odi(t){return"data"in t}function Tdi(t){return"icon"in t&&!("data"in t)}function TZr({isOpen:t,onClose:e,onSelect:r,isCopilotPlus:n=!1,currentActiveFile:o=null}){let[i,a]=(0,ov.useState)(""),[s,u]=(0,ov.useState)(0),[l,c]=(0,ov.useState)({mode:"category"}),d=WLe(n),f=QLe(i,l.mode,l.selectedCategory,n,d,o),p=(0,ov.useCallback)(g=>{if(!g?.disabled){if(l.mode==="category"&&Tdi(g)&&!i){c(b=>({...b,mode:"search",selectedCategory:g.category})),a(""),u(0);return}Odi(g)&&(r(g.category,g.data),e())}},[l.mode,i,r,e]),m=(0,ov.useCallback)(g=>{u(g)},[]),h=(0,ov.useCallback)(g=>{a(g),u(0)},[]),y=(0,ov.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,ov.useEffect)(()=>{t||(a(""),u(0),c({mode:"category",selectedCategory:void 0}))},[t]),(0,ov.useEffect)(()=>{u(0)},[f.length]),t?ov.default.createElement(_Zr,{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 Edi({selectedText:t,onRemoveContext:e}){if(ULe(t)){let n=cN(t.url);return Yn.default.createElement(Bh,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Yn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Yn.default.createElement(Ide,{faviconUrl:t.faviconUrl}),Yn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.title||n),Yn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Selection")),Yn.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>e("selectedText",t.id),"aria-label":"Remove from context",className:"tw-text-muted"},Yn.default.createElement($o,{className:"tw-size-4"})))}let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`;return Yn.default.createElement(Bh,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},Yn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Yn.default.createElement(Ju,{className:"tw-size-3"}),Yn.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.noteTitle),Yn.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),Yn.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>e("selectedText",t.id),"aria-label":"Remove from context",className:"tw-text-muted"},Yn.default.createElement($o,{className:"tw-size-4"})))}var PZr=({includeActiveNote:t,currentActiveFile:e,includeActiveWebTab:r,activeWebTab:n,contextNotes:o,contextUrls:i,contextFolders:a,contextWebTabs:s,selectedTextContexts:u=[],onRemoveContext:l,showProgressCard:c,onTypeaheadSelect:d,lexicalEditorRef:f})=>{let[p]=Cv(),m=xDe(),[h,y]=(0,Yn.useState)(!1),g=(0,Yn.useRef)(null),b=sb(p),_=()=>{y(!1)},w=(q,J)=>{d(q,J),setTimeout(()=>{f?.current&&f.current.focus()},100)},O=q=>{LRt(q)},T=Yn.default.useMemo(()=>{let q=new Map(o.map(J=>[J.path,J]));return Array.from(q.values())},[o]),P=Yn.default.useMemo(()=>Array.from(new Set(i)),[i]),M=Yn.default.useMemo(()=>wJ(s),[s]),I=u.length>0,j=t&&!I&&!!e,A=r&&!I&&!!n&&EZr.Platform.isDesktopApp,k=T.length>0||P.length>0||u.length>0||a.length>0||M.length>0||j||A,V=()=>{switch(m){case"success":return Yn.default.createElement(uS,{className:"tw-size-4 tw-text-success"});case"loading":return Yn.default.createElement(du,{className:"tw-size-4 tw-animate-spin tw-text-loading"});case"error":return Yn.default.createElement(sS,{className:"tw-size-4 tw-text-error"});case"initial":return Yn.default.createElement(IN,{className:"tw-size-4 tw-text-faint"})}};return Yn.default.createElement("div",{className:"tw-flex tw-w-full tw-items-start tw-gap-1"},Yn.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Yn.default.createElement(LU,{open:h,onOpenChange:y},Yn.default.createElement(FU,{asChild:!0},Yn.default.createElement(ge,{ref:g,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border tw-text-muted"},Yn.default.createElement("span",{className:"tw-text-base tw-font-medium tw-leading-none"},"@"),!k&&Yn.default.createElement("span",{className:"tw-pr-1 tw-text-sm tw-leading-4"},"Add context"))),Yn.default.createElement(r$,{className:"tw-w-[400px] tw-p-0",align:"start",side:"top",sideOffset:4},Yn.default.createElement(TZr,{isOpen:h,onClose:_,onSelect:w,isCopilotPlus:b,currentActiveFile:e})))),Yn.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},j&&e&&Yn.default.createElement(mZr,{currentActiveFile:e,onRemove:()=>l("activeNote",""),onClick:()=>O(e)}),A&&n&&Yn.default.createElement(hZr,{activeWebTab:n,onRemove:()=>l("activeWebTab","")}),T.map(q=>Yn.default.createElement(BLe,{key:q.path,note:q,onRemove:()=>l("notes",q.path),onClick:()=>O(q)})),P.map(q=>Yn.default.createElement(zLe,{key:q,url:q,onRemove:()=>l("urls",q)})),a.map(q=>Yn.default.createElement(HLe,{key:q,folder:q,onRemove:()=>l("folders",q)})),M.map(q=>Yn.default.createElement(VLe,{key:q.url,webTab:q,onRemove:()=>l("webTabs",q.url)})),u.map(q=>Yn.default.createElement(Edi,{key:q.id,selectedText:q,onRemoveContext:l}))),p==="project"&&Yn.default.createElement(Yn.default.Fragment,null,Yn.default.createElement(Px,{orientation:"vertical"}),Yn.default.createElement("div",{className:""},Yn.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>c()},V()))))};var IZr=({contextNotes:t,includeActiveNote:e,activeNote:r,includeActiveWebTab:n,activeWebTab:o,contextUrls:i,contextFolders:a,contextWebTabs:s,selectedTextContexts:u,showProgressCard:l,lexicalEditorRef:c,onAddToContext:d,onRemoveFromContext:f})=>MZr.default.createElement(PZr,{includeActiveNote:e,currentActiveFile:r,includeActiveWebTab:n,activeWebTab:o,contextNotes:t,onRemoveContext:(h,y)=>{f(h,y)},contextUrls:i,contextFolders:a,contextWebTabs:s,selectedTextContexts:u,showProgressCard:l,onTypeaheadSelect:(h,y)=>{d(h,y)},lexicalEditorRef:c});var cB=L(X());var AZr=L(X());var RZr=L(X());kn();function $g({children:t,className:e,...r}){return RZr.default.createElement(Bh,{variant:"secondary",className:Te("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 ky=class extends DLe{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 AZr.default.createElement($g,null,this.__value)}};var Cw=L(X());kn();function MA({content:t,openBracket:e,closeBracket:r,className:n,maxWidth:o="tw-max-w-40",tooltipContent:i}){let a=(0,Cw.useRef)(null),[s,u]=(0,Cw.useState)(!1);return Cw.default.createElement(jb,{delayDuration:300},Cw.default.createElement(pn,{open:s,onOpenChange:c=>{let d=a.current?a.current.offsetWidth<a.current.scrollWidth:!1;u(c&&d)}},Cw.default.createElement(mn,{asChild:!0},Cw.default.createElement("span",{className:Te("tw-inline-flex tw-items-center",o,n)},Cw.default.createElement("span",{className:"tw-shrink-0"},e),Cw.default.createElement("span",{ref:a,className:"tw-min-w-0 tw-truncate"},t),Cw.default.createElement("span",{className:"tw-shrink-0"},r))),Cw.default.createElement(sn,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},i||`${e}${t}${r}`)))}var LZ=class t extends ky{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:Pdi,priority:1}:null}}static importJSON(e){let{noteTitle:r,notePath:n}=e;return Dde(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 cB.default.createElement(Mdi,{node:this})}};function Pdi(t){let e=t.getAttribute("data-note-title"),r=t.getAttribute("data-note-path");return e&&r?{node:Dde(e,r)}:null}function Mdi({node:t}){let e=t.getNoteTitle(),r=t.getNotePath(),n=r.toLowerCase(),o=n.endsWith(".pdf"),i=n.endsWith(".canvas");return cB.default.createElement($g,null,cB.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},cB.default.createElement(MA,{content:e,openBracket:"[[",closeBracket:"]]",tooltipContent:cB.default.createElement("div",{className:"tw-text-left"},r)}),o&&cB.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf"),i&&cB.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"canvas")))}function Dde(t,e){return new LZ(t,e)}function Dbt(t){return t instanceof LZ}function NZr(t){let e=Ri(),r=0;function n(o){if(Dbt(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 A0=L(X());var FZ=L(X()),jZr=(0,FZ.createContext)(void 0);function DZr(){let t=(0,FZ.useContext)(jZr);return t===void 0?null:t.currentActiveFile}function $Zr({currentActiveFile:t,children:e}){return FZ.default.createElement(jZr.Provider,{value:{currentActiveFile:t}},e)}var kZ=class t extends ky{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:Idi,priority:2}:null}}static importJSON(e){return $de()}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 A0.default.createElement(Rdi,null)}};function Idi(t){return{node:$de()}}function Rdi(){let t=DZr();if(!t)return A0.default.createElement($g,null,A0.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},A0.default.createElement(MA,{content:"activeNote",openBracket:"{",closeBracket:"}",tooltipContent:A0.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 A0.default.createElement($g,null,A0.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},A0.default.createElement(MA,{content:e,openBracket:"[[",closeBracket:"]]",tooltipContent:A0.default.createElement("div",{className:"tw-text-left"},r)}),A0.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),n&&A0.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")))}function $de(){return new kZ}function $bt(t){return t instanceof kZ}function LZr(){let t=Ri(),e=0;function r(n){if($bt(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 Lde=L(X());var d3=class t extends ky{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:Adi,priority:1}:null}}static importJSON(e){let{url:r,title:n,isActive:o}=e;return eFe(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 Lde.default.createElement($g,{className:"tw-whitespace-nowrap"},Lde.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Lde.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e),this.__isActive&&Lde.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Active")))}};function Adi(t){let e=t.getAttribute("data-url"),r=t.getAttribute("data-title");return e!==null?{node:eFe(e,r||void 0)}:null}function eFe(t,e,r=!1){return new d3(t,e,r)}function Ndi(){let t=Ri(),e=[];function r(n){if(n instanceof d3&&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 FZr(t){let e=Ndi();for(let r of e)r.getURL()===t&&r.remove()}function kZr(t){return t instanceof d3}var tFe=L(X());var f3=class t extends ky{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:jdi,priority:1}:null}}static importJSON(e){let{value:r}=e;return Fde(r)}exportJSON(){return{...super.exportJSON(),type:"folder-pill"}}decorate(){let e=tFe.default.createElement("div",{className:"tw-text-left"},this.getFolderPath());return tFe.default.createElement($g,null,tFe.default.createElement(MA,{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 jdi(t){let e=t.getAttribute("data-pill-value");return e!==null?{node:Fde(e)}:null}function Fde(t){return new f3(t)}function qZr(t){return t instanceof f3}function Ddi(){let t=Ri(),e=[];function r(n){if(n instanceof f3&&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 UZr(t){let e=Ddi();for(let r of e)r.getValue()===t&&r.remove()}var p3=class t extends ky{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:$di,priority:1}:null}}static importJSON(e){let{value:r}=e;return m3(r)}exportJSON(){return{...super.exportJSON(),type:"tool-pill"}}getToolName(){return this.getValue()}};function $di(t){let e=t.getAttribute("data-pill-value");return e!==null?{node:m3(e)}:null}function m3(t){return new p3(t)}function BZr(t){return t instanceof p3}function Ldi(){let t=Ri(),e=[];function r(n){if(n instanceof p3&&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 kde(t){let e=Ldi();for(let r of e)r.getValue()===t&&r.remove()}var Lg=L(X());Jr();var zZr=require("obsidian");Or();var qZ=class t extends ky{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:Fdi,priority:2}:null}}static importJSON(e){return rFe()}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=Lee,{element:e}}getTextContent(){return Lee}decorate(){return Lg.default.createElement(kdi,null)}};function Fdi(t){return{node:rFe()}}function kdi(){let{activeWebTabForMentions:t}=lB();return zZr.Platform.isDesktopApp?t?Lg.default.createElement($g,null,Lg.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Lg.default.createElement(cl,{className:"tw-size-3"}),Lg.default.createElement("span",{className:"tw-max-w-40 tw-truncate",title:t.url},t.title??"Untitled"),Lg.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"))):Lg.default.createElement($g,null,Lg.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Lg.default.createElement(cl,{className:"tw-size-3"}),Lg.default.createElement(MA,{content:"activeWebTab",openBracket:"{",closeBracket:"}",tooltipContent:Lg.default.createElement("div",{className:"tw-text-left"},"Will use the active web tab at the time the message is sent")}))):Lg.default.createElement($g,null,Lg.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Lg.default.createElement(cl,{className:"tw-size-3"}),Lg.default.createElement(MA,{content:"activeWebTab",openBracket:"{",closeBracket:"}",tooltipContent:Lg.default.createElement("div",{className:"tw-text-left"},"Web Viewer not supported on mobile")})))}function rFe(){return new qZ}function Lbt(t){return t instanceof qZ}function VZr(){let t=Ri(),e=0;function r(n){if(Lbt(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 qde=L(X());Jr();Zt();function HZr(t,e){return`[\u{1F310}: ${e?.trim()||cN(t)||"Untitled"}]`}var h3=class t extends ky{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:qdi,priority:1}:null}}static importJSON(e){let{url:r,title:n,faviconUrl:o}=e;return nFe(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=HZr(this.__url,this.__title),{element:e}}getTextContent(){return HZr(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 qde.default.createElement($g,{className:"tw-whitespace-nowrap"},qde.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},qde.default.createElement(cl,{className:"tw-size-3"}),qde.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e)))}};function qdi(t){let e=t.getAttribute("data-url"),r=t.getAttribute("data-title"),n=t.getAttribute("data-favicon-url");return e!==null?{node:nFe(e,r||void 0,n||void 0)}:null}function nFe(t,e,r){return new h3(t,e,r)}function JZr(t){return t instanceof h3}function Fbt(){let t=Ri(),e=[];function r(n){if(n instanceof h3&&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 WZr(t){let e=Fbt();for(let r of e)r.getURL()===t&&r.remove()}var Xi=L(X());var kbt={};Rn(kbt,{LexicalComposerContext:()=>KZr,createLexicalComposerContext:()=>Udi,useLexicalComposerContext:()=>Bdi});var oFe=L(X(),1),KZr=(0,oFe.createContext)(null);function Udi(t,e){let r=null;return t!=null&&(r=t[1]),{getTheme:function(){return e??(r!=null?r.getTheme():null)}}}function Bdi(){let t=(0,oFe.useContext)(KZr);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 qbt=kbt,GZr=qbt.LexicalComposerContext,XZr=qbt.createLexicalComposerContext,Ai=qbt.useLexicalComposerContext;var Ubt={};Rn(Ubt,{LexicalComposer:()=>Vdi});var UZ=L(X(),1),ZZr=L(vr(),1),YZr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,zdi=YZr?UZ.useLayoutEffect:UZ.useEffect,iFe={tag:NZ};function Vdi({initialConfig:t,children:e}){let r=(0,UZ.useMemo)(()=>{let{theme:n,namespace:o,nodes:i,onError:a,editorState:s,html:u}=t,l=XZr(null,n),c=sZr({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=Ri();if(p.isEmpty()){let m=_$();p.append(m);let h=YZr?document.activeElement:null;(hn()!==null||h!==null&&h===d.getRootElement())&&m.select()}},iFe);else if(f!==null)switch(typeof f){case"string":{let p=d.parseEditorState(f);d.setEditorState(p,iFe);break}case"object":d.setEditorState(f,iFe);break;case"function":d.update(()=>{Ri().isEmpty()&&f(d)},iFe)}}}(c,s),[c,l]},[]);return zdi(()=>{let n=t.editable,[o]=r;o.setEditable(n===void 0||n)},[]),(0,ZZr.jsx)(GZr.Provider,{value:r,children:e})}var Hdi=Ubt,QZr=Hdi.LexicalComposer;var Bbt={};Rn(Bbt,{useLexicalEditable:()=>Kdi});var IA=L(X(),1),Jdi=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?IA.useLayoutEffect:IA.useEffect;function Wdi(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}function Kdi(){return function(t){let[e]=Ai(),r=(0,IA.useMemo)(()=>t(e),[e,t]),[n,o]=(0,IA.useState)(()=>r.initialValueFn()),i=(0,IA.useRef)(n);return Jdi(()=>{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}(Wdi)}var Gdi=Bbt,eYr=Gdi.useLexicalEditable;var Vbt={};Rn(Vbt,{$canShowPlaceholder:()=>rYr,$canShowPlaceholderCurry:()=>Zdi,$findTextIntersectionFromCharacters:()=>Ydi,$isRootTextContentEmpty:()=>zbt,$isRootTextContentEmptyCurry:()=>Xdi,$rootTextContent:()=>tYr,registerLexicalTextEntity:()=>efi});function tYr(){return Ri().getTextContent()}function zbt(t,e=!0){if(t)return!1;let r=tYr();return e&&(r=r.trim()),r===""}function Xdi(t,e){return()=>zbt(t,e)}function rYr(t){if(!zbt(t,!1))return!1;let e=Ri().getChildren(),r=e.length;if(r>1)return!1;for(let n=0;n<r;n++){let o=e[n];if(ILe(o))return!1;if(fi(o)){if(!OXr(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(!Gi(u))return!1}}}return!0}function Zdi(t){return()=>rYr(t)}function Ydi(t,e){let r=t.getFirstChild(),n=0;e:for(;r!==null;){if(fi(r)){let a=r.getFirstChild();if(a!==null){r=a;continue}}else if(Gi(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 Qdi(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 efi(t,e,r,n){let o=a=>a instanceof r,i=a=>{let s=Sw(a.getTextContent());s.setFormat(a.getFormat()),a.replace(s)};return[t.registerNodeTransform(EA,a=>{if(!a.isSimpleText())return;let s,u=a.getPreviousSibling(),l=a.getTextContent(),c=a;if(Gi(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(Gi(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&&Gi(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&&Qdi(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();Gi(l)&&l.isTextEntity()&&(i(l),i(a));let c=a.getNextSibling();Gi(c)&&c.isTextEntity()&&(i(c),o(a)&&i(a))})]}var g3=Vbt,qjs=g3.$canShowPlaceholder,aFe=g3.$canShowPlaceholderCurry,Ujs=g3.$findTextIntersectionFromCharacters,Bjs=g3.$isRootTextContentEmpty,zjs=g3.$isRootTextContentEmptyCurry,Vjs=g3.$rootTextContent,Hjs=g3.registerLexicalTextEntity;var Xbt={};Rn(Xbt,{$addNodeStyle:()=>ifi,$cloneWithProperties:()=>sB,$copyBlockFormatIndent:()=>dYr,$ensureForwardRangeSelection:()=>cYr,$forEachSelectedTextNode:()=>lYr,$getSelectionStyleValueForProperty:()=>pfi,$isAtNodeEnd:()=>ofi,$isParentElementRTL:()=>Gbt,$moveCaretSelection:()=>pYr,$moveCharacter:()=>dfi,$patchStyleText:()=>afi,$selectAll:()=>ALe,$setBlocksType:()=>sfi,$shouldOverrideDefaultCharacterSelection:()=>cfi,$sliceSelectedTextNodeContent:()=>nfi,$trimTextContentFromAnchor:()=>uYr,$wrapNodes:()=>lfi,createDOMRange:()=>tfi,createRectsFromDOMRange:()=>rfi,getCSSFromStyleObject:()=>sYr,getStyleObjectFromCSS:()=>uFe,trimTextContentFromAnchor:()=>mfi});function Kbt(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 sFe=new Map;function nYr(t){let e=t;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function oYr(t){let e=t.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}function tfi(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(Gi(e)&&(u=nYr(u)),Gi(n)&&(l=nYr(l)),e===void 0||n===void 0||u===null||l===null)return null;u.nodeName==="BR"&&([u,c]=oYr(u)),l.nodeName==="BR"&&([l,d]=oYr(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 rfi(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 aYr(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 uFe(t){let e=sFe.get(t);return e===void 0&&(e=aYr(t),sFe.set(t,e)),e}function sYr(t){let e="";for(let r in t)r&&(e+=`${r}: ${t[r]};`);return e}function nfi(t,e){let r=t.getStartEndPoints();if(e.isSelected(t)&&!Sbt(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]=bXr(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 ofi(t){if(t.type==="text")return t.offset===t.getNode().getTextContentSize();let e=t.getNode();return fi(e)||Kbt(177),t.offset===e.getChildrenSize()}function uYr(t,e,r){let n=e.getNode(),o=r;if(fi(n)){let i=n.getDescendantByIndex(e.offset);i!==null&&(n=i)}for(;o>0&&n!==null;){if(fi(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===""&&fi(n)&&!n.isInline()&&(s=`
|
||
|
||
`);let u=s.length;if(!Gi(n)||o>=u){let l=n.getParent();n.remove(),l==null||l.getChildrenSize()!==0||RZ(l)||l.remove(),o-=u+a,n=i}else{let l=n.getKey(),c=t.getEditorState().read(()=>{let p=vXr(l);return Gi(p)&&p.isSimpleText()?p.getTextContent():null}),d=u-o,f=s.slice(0,d);if(c!==null&&c!==s){let p=xde(),m=n;if(n.isSimpleText())n.setTextContent(c);else{let h=Sw(c);n.replace(h),m=h}if(Rr(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=Sw(f);n.replace(p)}o=0}}}function ifi(t){let e=t.getStyle(),r=aYr(e);sFe.set(e,r)}function Hbt(t,e){(Rr(t)?t.isCollapsed():Gi(t)||fi(t))||Kbt(280);let r=uFe(Rr(t)?t.style:Gi(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=sYr(n);Rr(t)||Gi(t)?t.setStyle(o):t.setTextStyle(o),sFe.set(o,n)}function afi(t,e){if(Rr(t)&&t.isCollapsed()){Hbt(t,e);let r=t.anchor.getNode();fi(r)&&r.isEmpty()&&Hbt(r,e)}lYr(r=>{Hbt(r,e)})}function lYr(t){let e=hn();if(!e)return;let r=new Map;if(Rr(e))for(let i of mXr(e).getTextSlices())i&&r.set(i.caret.origin.getKey(),i.getSliceIndices());let n=e.getNodes();for(let i of n){if(!Gi(i)||!i.canHaveFormat())continue;let[a,s]=(o=i,r.get(o.getKey())||[0,o.getTextContentSize()]);s!==a&&(Sbt(i)||a===0&&s===i.getTextContentSize()?t(i):t(i.splitText(a,s)[a===0?0:1]))}var o;Rr(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&cYr(e)}function cYr(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 dYr(t,e){let r=t.getFormatType(),n=t.getIndent();r!==e.getFormatType()&&e.setFormat(r),n!==e.getIndent()&&e.setIndent(n)}function sfi(t,e,r=dYr){if(t===null)return;let n=t.getStartEndPoints(),o=new Map,i=null;if(n){let[a,s]=n;i=ELe(),i.anchor.set(a.key,a.offset,a.type),i.focus.set(s.key,s.offset,s.type);let u=Wbt(a.getNode(),Pde),l=Wbt(s.getNode(),Pde);fi(u)&&o.set(u.getKey(),u),fi(l)&&o.set(l.getKey(),l)}for(let a of t.getNodes())if(fi(a)&&Pde(a))o.set(a.getKey(),a);else if(n===null){let s=Wbt(a,Pde);fi(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(hn())&&u3(i)}function iYr(t){return t.getNode().isAttached()}function ufi(t){let e=t;for(;e!==null&&!s3(e);){let r=e.getLatest(),n=e.getParent();r.getChildrenSize()===0&&e.remove(!0),e=n}}function lfi(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];s3(c)?(Jbt(t,u,u.length,e,r),u=[],s=c):s===null||s!==null&&SXr(c,s)?u.push(c):(Jbt(t,u,u.length,e,r),u=[c])}Jbt(t,u,u.length,e,r)}function Jbt(t,e,r,n,o=null){if(e.length===0)return;let i=e[0],a=new Map,s=[],u=fi(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(),s3(u))break}let c=new Set;for(let m=0;m<r;m++){let h=e[m];fi(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&&xXr(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()),fi(_)&&_.getChildrenKeys().forEach(w=>d.add(w))}),ufi(y)}}else if(c.has(h.getKey())){fi(h)||Kbt(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(s3(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(fi(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=xde();Rr(p)&&iYr(p.anchor)&&iYr(p.focus)?u3(p.clone()):f!==null?f.selectEnd():t.dirty=!0}function fYr(t){let e=t.anchor.getNode(),r=RZ(e)?e:e.getParentOrThrow(),n=PLe().getElementByKey(r.getKey());if(n===null)return!1;let o=n.ownerDocument.defaultView;return o===null?!1:o.getComputedStyle(n).writingMode==="vertical-rl"}function cfi(t,e){let r=fYr(t)?!e:e;Gbt(t)&&(r=!r);let n=IZ(t.focus,r?"previous":"next");if(CXr(n))return!1;for(let o of gXr(n)){if(Ode(o))return!o.origin.isInline();if(!fi(o.origin)){if(ILe(o.origin))return!0;break}}return!1}function pYr(t,e,r,n){t.modify(e?"extend":"move",r,n)}function Gbt(t){let e=t.anchor.getNode();return(RZ(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function dfi(t,e,r){let n=Gbt(t),o;o=fYr(t)||n?!r:r,pYr(t,e,o,"character")}function ffi(t,e,r){let n=uFe(t.getStyle());return n!==null&&n[e]||r}function pfi(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(Rr(t)&&t.isCollapsed()&&t.style!==""){let c=uFe(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))&&Gi(d)){let f=ffi(d,e,r);if(n===null)n=f;else if(n!==f){n="";break}}}return n===null?r:n}function Wbt(t,e){let r=t;for(;r!==null&&r.getParent()!==null&&!e(r);)r=r.getParentOrThrow();return e(r)?r:null}var mfi=uYr;var $c=Xbt,mYr=$c.$addNodeStyle,Gjs=$c.$cloneWithProperties,Xjs=$c.$copyBlockFormatIndent,Zjs=$c.$ensureForwardRangeSelection,Yjs=$c.$forEachSelectedTextNode,Qjs=$c.$getSelectionStyleValueForProperty,eDs=$c.$isAtNodeEnd,tDs=$c.$isParentElementRTL,rDs=$c.$moveCaretSelection,Zbt=$c.$moveCharacter,nDs=$c.$patchStyleText,oDs=$c.$selectAll,iDs=$c.$setBlocksType,Ybt=$c.$shouldOverrideDefaultCharacterSelection,lFe=$c.$sliceSelectedTextNodeContent,aDs=$c.$trimTextContentFromAnchor,sDs=$c.$wrapNodes,uDs=$c.createDOMRange,hYr=$c.createRectsFromDOMRange,lDs=$c.getCSSFromStyleObject,cDs=$c.getStyleObjectFromCSS,dDs=$c.trimTextContentFromAnchor;var r_t={};Rn(r_t,{$descendantsMatching:()=>Qfi,$dfs:()=>$fi,$dfsIterator:()=>OYr,$filter:()=>Kfi,$findMatchingParent:()=>MYr,$firstToLastIterator:()=>epi,$getAdjacentCaret:()=>Lfi,$getAdjacentSiblingOrParentSiblingCaret:()=>Ude,$getDepth:()=>EYr,$getNearestBlockElementAncestorOrThrow:()=>Bfi,$getNearestNodeOfType:()=>Ufi,$getNextRightPreorderNode:()=>qfi,$getNextSiblingOrParentSibling:()=>kfi,$insertFirst:()=>Gfi,$insertNodeToNearestRoot:()=>Hfi,$insertNodeToNearestRootAtCaret:()=>IYr,$isEditorIsNestedEditor:()=>Zfi,$lastToFirstIterator:()=>t_t,$restoreEditorState:()=>Vfi,$reverseDfs:()=>Ffi,$reverseDfsIterator:()=>PYr,$splitNode:()=>NXr,$unwrapAndFilterDescendants:()=>Yfi,$unwrapNode:()=>tpi,$wrapNodeInElement:()=>Jfi,CAN_USE_BEFORE_INPUT:()=>Ofi,CAN_USE_DOM:()=>SYr,IS_ANDROID:()=>Tfi,IS_ANDROID_CHROME:()=>Efi,IS_APPLE:()=>Pfi,IS_APPLE_WEBKIT:()=>Mfi,IS_CHROME:()=>Ifi,IS_FIREFOX:()=>CYr,IS_IOS:()=>Rfi,IS_SAFARI:()=>Afi,addClassNamesToElement:()=>Nfi,calculateZoomLevel:()=>Xfi,isBlockDomNode:()=>cZr,isHTMLAnchorElement:()=>dZr,isHTMLElement:()=>FLe,isInlineDomNode:()=>Mde,isMimeType:()=>xYr,makeStateWrapper:()=>rpi,markSelection:()=>wYr,mediaFileReader:()=>Dfi,mergeRegister:()=>_Yr,objectKlassEquals:()=>Wfi,positionNodeOnRange:()=>vYr,registerNestedElementResolver:()=>zfi,removeClassNamesFromElement:()=>jfi,selectionAlwaysOnDisplay:()=>xfi});function cFe(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 qx=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,hfi=qx&&"documentMode"in document?document.documentMode:null,gfi=qx&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),yfi=qx&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),bfi=!(!qx||!("InputEvent"in window)||hfi)&&"getTargetRanges"in new window.InputEvent("input"),_fi=qx&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),vfi=qx&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,yYr=qx&&/Android/.test(navigator.userAgent),e_t=qx&&/^(?=.*Chrome).*/i.test(navigator.userAgent),wfi=qx&&yYr&&e_t,Sfi=qx&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!e_t;function bYr(...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 _Yr(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function RA(t){return`${t}px`}var Cfi={attributes:!0,characterData:!0,childList:!0,subtree:!0};function vYr(t,e,r){let n=null,o=null,i=null,a=[],s=document.createElement("div");function u(){n===null&&cFe(182),o===null&&cFe(183);let{left:d,top:f}=o.getBoundingClientRect(),p=hYr(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 O=RA(b.left-d);w.left!==O&&(w.left=O,y=!0);let T=RA(b.top-f);w.top!==T&&(_.style.top=T,y=!0);let P=RA(b.width);w.width!==P&&(_.style.width=P,y=!0);let M=RA(b.height);w.height!==M&&(_.style.height=M,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(!FLe(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,Cfi),u()});return()=>{c(),l()}}function gYr(t,e,r){if(t.type!=="text"&&fi(e)){let n=e.getDOMSlot(r);return[n.element,n.getFirstChildOffset()+t.offset]}return[uZr(r)||r,t.offset]}function wYr(t,e){let r=null,n=null,o=null,i=null,a=null,s=null,u=()=>{};function l(c){c.read(()=>{let d=hn();if(!Rr(d))return r=null,o=null,i=null,s=null,u(),void(u=()=>{});let[f,p]=function(M){let I=M.getStartEndPoints();return M.isBackward()?[I[1],I[0]]:I}(d),m=f.getNode(),h=m.getKey(),y=f.offset,g=p.getNode(),b=g.getKey(),_=p.offset,w=t.getElementByKey(h),O=t.getElementByKey(b),T=r===null||w!==n||y!==o||h!==r.getKey(),P=i===null||O!==a||_!==s||b!==i.getKey();if((T||P)&&w!==null&&O!==null){let M=function(I,j,A,k,V,q,J){let K=(I._window?I._window.document:document).createRange();return K.setStart(...gYr(j,A,k)),K.setEnd(...gYr(V,q,J)),K}(t,f,m,w,p,g,O);u(),u=vYr(t,M,I=>{if(e===void 0)for(let j of I){let A=j.style;A.background!=="Highlight"&&(A.background="Highlight"),A.color!=="HighlightText"&&(A.color="HighlightText"),A.marginTop!==RA(-1.5)&&(A.marginTop=RA(-1.5)),A.paddingTop!==RA(4)&&(A.paddingTop=RA(4)),A.paddingBottom!==RA(0)&&(A.paddingBottom=RA(0))}else e(I)})}r=m,n=w,o=y,i=g,a=O,s=_})}return l(t.getEditorState()),_Yr(t.registerUpdateListener(({editorState:c})=>l(c)),()=>{u()})}function xfi(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=wYr(t))};return document.addEventListener("selectionchange",r),()=>{e!==null&&e(),document.removeEventListener("selectionchange",r)}}var Ofi=bfi,SYr=qx,Tfi=yYr,Efi=wfi,Pfi=gfi,Mfi=Sfi,Ifi=e_t,CYr=yfi,Rfi=vfi,Afi=_fi;function Nfi(t,...e){let r=bYr(...e);r.length>0&&t.classList.add(...r)}function jfi(t,...e){let r=bYr(...e);r.length>0&&t.classList.remove(...r)}function xYr(t,e){for(let r of e)if(t.type.startsWith(r))return!0;return!1}function Dfi(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()}),xYr(u,e)?l.readAsDataURL(u):a()};a()})}function $fi(t,e){return Array.from(OYr(t,e))}function Lfi(t){return t?t.getAdjacentCaret():null}function Ffi(t,e){return Array.from(PYr(t,e))}function OYr(t,e){return TYr("next",t,e)}function TYr(t,e,r){let n=Ri(),o=e||n,i=fi(o)?uB(o,t):v$(o,t),a=EYr(o),s=r?Cde(wbt(v$(r,t))):function(l,c){let d=Ude(v$(l,c));return d&&d[0]}(o,t),u=a;return Ebt({hasNext:l=>l!==null,initial:i,map:l=>({depth:u,node:l.origin}),step:l=>{if(l.isSameNodeCaret(s))return null;Ode(l)&&u++;let c=Ude(l);return!c||c[0].isSameNodeCaret(s)?null:(u+=c[1],c[0])}})}function kfi(t){let e=Ude(v$(t,"next"));return e&&[e[0].origin,e[1]]}function EYr(t){let e=-1;for(let r=t;r!==null;r=r.getParent())e++;return e}function qfi(t){let e=Ude(wbt(v$(t,"previous")),"root");return e&&e[0].origin}function PYr(t,e){return TYr("previous",t,e)}function Ufi(t,e){let r=t;for(;r!=null;){if(r instanceof e)return r;r=r.getParent()}return null}function Bfi(t){let e=MYr(t,r=>fi(r)&&!r.isInline());return fi(e)||cFe(4,t.__key),e}var MYr=(t,e)=>{let r=t;for(;r!==Ri()&&r!=null;){if(e(r))return r;r=r.getParent()}return null};function zfi(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 Vfi(t,e){let r=new Map,n=t._pendingEditorState;for(let[i,a]of e._nodeMap)r.set(i,sB(a));n&&(n._nodeMap=r),t._dirtyType=2;let o=e._selection;u3(o===null?null:o.clone())}function Hfi(t){let e=hn()||xde(),r;if(Rr(e))r=IZ(e.focus,"next");else{if(e!=null){let a=e.getNodes(),s=a[a.length-1];s&&(r=v$(s,"next"))}r=r||uB(Ri(),"previous").getFlipped().insert(_$())}let n=IYr(t,r),o=Cde(n),i=Ode(o)?EXr(o):n;return IXr(_Xr(i)),t.getLatest()}function IYr(t,e,r){let n=vbt(e,"next");for(let o=n;o;o=AXr(o,r))n=o;return RLe(n)&&cFe(283),n.insert(t.isInline()?_$().append(t):t),vbt(v$(t.getLatest(),"next"),e.direction)}function Jfi(t,e){let r=e();return t.replace(r),r.append(t),r}function Wfi(t,e){return t!==null&&Object.getPrototypeOf(t).constructor.name===e.name}function Kfi(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 Gfi(t,e){uB(t,"next").insert(e)}var Qbt=!(CYr||!SYr)&&void 0;function Xfi(t){let e=1;if(function(){if(Qbt===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"),Qbt=r.getBoundingClientRect().width===n.width,document.body.removeChild(r)}return Qbt}())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return e}function Zfi(t){return t._parentEditor!==null}function Yfi(t,e){return RYr(t,e,null)}function RYr(t,e,r){let n=!1;for(let o of t_t(t))e(o)?r!==null&&r(o):(n=!0,fi(o)&&RYr(o,e,r||(i=>o.insertAfter(i))),o.remove());return n}function Qfi(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(fi(o))for(let i of t_t(o))n.push(i);return r}function epi(t){return AYr(uB(t,"next"))}function t_t(t){return AYr(uB(t,"previous"))}function AYr(t){return Ebt({hasNext:TXr,initial:t.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function tpi(t){MXr(v$(t,"next")).splice(1,t.getChildren())}function Ude(t,e="root"){let r=0,n=t,o=Cde(n);for(;o===null;){if(r--,o=n.getParentCaret(e),!o)return null;n=o,o=Cde(n)}return o&&[o,r]}function rpi(t){let e=n=>wXr(n,t),r=(n,o)=>RXr(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 xn=r_t,gDs=xn.$descendantsMatching,yDs=xn.$dfs,bDs=xn.$dfsIterator,_Ds=xn.$filter,vDs=xn.$findMatchingParent,wDs=xn.$firstToLastIterator,SDs=xn.$getAdjacentCaret,CDs=xn.$getAdjacentSiblingOrParentSiblingCaret,xDs=xn.$getDepth,ODs=xn.$getNearestBlockElementAncestorOrThrow,TDs=xn.$getNearestNodeOfType,EDs=xn.$getNextRightPreorderNode,PDs=xn.$getNextSiblingOrParentSibling,MDs=xn.$insertFirst,IDs=xn.$insertNodeToNearestRoot,RDs=xn.$insertNodeToNearestRootAtCaret,ADs=xn.$isEditorIsNestedEditor,NDs=xn.$lastToFirstIterator,jDs=xn.$restoreEditorState,DDs=xn.$reverseDfs,$Ds=xn.$reverseDfsIterator,LDs=xn.$splitNode,FDs=xn.$unwrapAndFilterDescendants,kDs=xn.$unwrapNode,qDs=xn.$wrapNodeInElement,UDs=xn.CAN_USE_BEFORE_INPUT,BDs=xn.CAN_USE_DOM,zDs=xn.IS_ANDROID,VDs=xn.IS_ANDROID_CHROME,HDs=xn.IS_APPLE,JDs=xn.IS_APPLE_WEBKIT,WDs=xn.IS_CHROME,KDs=xn.IS_FIREFOX,GDs=xn.IS_IOS,XDs=xn.IS_SAFARI,ZDs=xn.addClassNamesToElement,YDs=xn.calculateZoomLevel,n_t=xn.isBlockDomNode,QDs=xn.isHTMLAnchorElement,NYr=xn.isHTMLElement,e$s=xn.isInlineDomNode,t$s=xn.isMimeType,r$s=xn.makeStateWrapper,n$s=xn.markSelection,o$s=xn.mediaFileReader,S$=xn.mergeRegister,Bde=xn.objectKlassEquals,i$s=xn.positionNodeOnRange,a$s=xn.registerNestedElementResolver,s$s=xn.removeClassNamesFromElement,u$s=xn.selectionAlwaysOnDisplay;var o_t={};Rn(o_t,{registerDragonSupport:()=>npi});function npi(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=hn();if(Rr(h)){let y=h.anchor,g=y.getNode(),b=0,_=0;if(Gi(g)&&l>=0&&c>=0&&(b=l,_=l+c,h.setTextNodeRange(g,b,g,_)),b===_&&d===""||(h.insertRawText(d),g=y.getNode()),Gi(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 opi=o_t,jYr=opi.registerDragonSupport;var i_t={};Rn(i_t,{$generateHtmlFromNodes:()=>api,$generateNodesFromDOM:()=>ipi});function ipi(t,e){let r=e.body?e.body.childNodes:[],n=[],o=[];for(let i=0;i<r.length;i++){let a=r[i];if(!$Yr.has(a.nodeName)){let s=LYr(a,t,o,!1);s!==null&&(n=n.concat(s))}}return function(i){for(let a of i)a.getNextSibling()instanceof Cbt&&a.insertAfter(_bt());for(let a of i){let s=a.getChildren();for(let u of s)a.insertBefore(u);a.remove()}}(o),n}function api(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=Ri().getChildren();for(let o=0;o<n.length;o++)DYr(t,n[o],r,e);return r.innerHTML}function DYr(t,e,r,n=null){let o=n===null||e.isSelected(n),i=fi(e)&&e.excludeFromCopy("html"),a=e;if(n!==null){let p=sB(e);p=Gi(p)&&n!==null?lFe(n,p):p,a=p}let s=fi(a)?a.getChildren():[],u=lZr(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=DYr(t,m,f,n);!o&&fi(e)&&h&&e.extractWithChild(m,n,"html")&&(o=!0)}if(o&&!i){if((NYr(c)||Tbt(c))&&c.append(f),r.append(c),d){let p=d.call(a,c);p&&(Tbt(c)?c.replaceChildren(p):c.replaceWith(p))}}else r.append(f);return o}var $Yr=new Set(["STYLE","SCRIPT"]);function LYr(t,e,r,n,o=new Map,i){let a=[];if($Yr.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||!s3(s))&&(s!=null&&MLe(s)||n);for(let m=0;m<d.length;m++)f.push(...LYr(d[m],e,r,p,new Map(o),s));return c!=null&&(f=c(f)),n_t(t)&&(f=spi(t,f,p?()=>{let m=new Cbt;return r.push(m),m}:_$)),s==null?f.length>0?a=a.concat(f):n_t(t)&&function(m){return m.nextSibling==null||m.previousSibling==null?!1:Mde(m.nextSibling)&&Mde(m.previousSibling)}(t)&&(a=a.concat(_bt())):fi(s)&&s.append(...f),a}function spi(t,e,r){let n=t.style.textAlign,o=[],i=[];for(let a=0;a<e.length;a++){let s=e[a];if(MLe(s))n&&!s.getFormat()&&s.setFormat(n),o.push(s);else if(i.push(s),a===e.length-1||a<e.length-1&&MLe(e[a+1])){let u=r();u.setFormat(n),u.append(...i),o.push(u),i=[]}}return o}var FYr=i_t,kYr=FYr.$generateHtmlFromNodes,qYr=FYr.$generateNodesFromDOM;var s_t={};Rn(s_t,{$generateJSONFromSelectedNodes:()=>HYr,$generateNodesFromSerializedNodes:()=>JYr,$getClipboardDataFromSelection:()=>WYr,$getHtmlContent:()=>BYr,$getLexicalContent:()=>zYr,$insertDataTransferForPlainText:()=>upi,$insertDataTransferForRichText:()=>lpi,$insertGeneratedNodes:()=>a_t,copyToClipboard:()=>cpi,setLexicalClipboardDataTransfer:()=>KYr});function dFe(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 BYr(t,e=hn()){return e==null&&dFe(166),Rr(e)&&e.isCollapsed()||e.getNodes().length===0?"":kYr(t,e)}function zYr(t,e=hn()){return e==null&&dFe(166),Rr(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(HYr(t,e))}function upi(t,e){let r=t.getData("text/plain")||t.getData("text/uri-list");r!=null&&e.insertRawText(r)}function lpi(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 a_t(r,JYr(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 a_t(r,qYr(r,s),e)}catch{}let a=i||t.getData("text/uri-list");if(a!=null)if(Rr(e)){let s=a.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let u=0;u<s.length;u++){let l=hn();if(Rr(l)){let c=s[u];c===`
|
||
`||c===`\r
|
||
`?l.insertParagraph():c===" "?l.insertNodes([hXr()]):l.insertText(c)}}}else e.insertRawText(a)}function a_t(t,e,r){t.dispatchCommand(nZr,{nodes:e,selection:r})||(r.insertNodes(e),function(n){if(Rr(n)&&n.isCollapsed()){let o=n.anchor,i=null,a=IZ(o,"previous");if(a)if(RLe(a))i=a.origin;else{let s=yXr(a,uB(Ri(),"next").getFlipped());for(let u of s){if(Gi(u.origin)){i=u.origin;break}if(fi(u.origin)&&!u.origin.isInline())break}}if(i&&Gi(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 VYr(t,e,r,n=[]){let o=e===null||r.isSelected(e),i=fi(r)&&r.excludeFromCopy("html"),a=r;if(e!==null){let l=sB(r);l=Gi(l)&&e!==null?lFe(e,l):l,a=l}let s=fi(a)?a.getChildren():[],u=function(l){let c=l.exportJSON(),d=l.constructor;if(c.type!==d.getType()&&dFe(58,d.name),fi(l)){let f=c.children;Array.isArray(f)||dFe(59,d.name)}return c}(a);if(Gi(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=VYr(t,e,c,u.children);!o&&fi(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 HYr(t,e){let r=[],n=Ri().getChildren();for(let o=0;o<n.length;o++)VYr(t,e,n[o],r);return{namespace:t._config.namespace,nodes:r}}function JYr(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r],o=PXr(n);Gi(o)&&mYr(o),e.push(o)}return e}var BZ=null;async function cpi(t,e,r){if(BZ!==null)return!1;if(e!==null)return new Promise((l,c)=>{t.update(()=>{l(UYr(t,e,r))})});let n=t.getRootElement(),o=t._window||window,i=window.document,a=Obt(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(jLe,f=>(Bde(f,ClipboardEvent)&&(d(),BZ!==null&&(window.clearTimeout(BZ),BZ=null),l(UYr(t,f,r))),!0),NLe);BZ=window.setTimeout(()=>{d(),BZ=null,l(!1)},50),i.execCommand("copy"),s.remove()})}function UYr(t,e,r){if(r===void 0){let o=Obt(t._window);if(!o)return!1;let i=o.anchorNode,a=o.focusNode;if(i!==null&&a!==null&&!fZr(t,i,a))return!1;let s=hn();if(s===null)return!1;r=WYr(s)}e.preventDefault();let n=e.clipboardData;return n!==null&&(KYr(n,r),!0)}var dpi=[["text/html",BYr],["application/x-lexical-editor",zYr]];function WYr(t=hn()){let e={"text/plain":t?t.getTextContent():""};if(t){let r=PLe();for(let[n,o]of dpi){let i=o(r,t);i!==null&&(e[n]=i)}}return e}function KYr(t,e){for(let r in e){let n=e[r];n!==void 0&&t.setData(r,n)}}var AA=s_t,v$s=AA.$generateJSONFromSelectedNodes,w$s=AA.$generateNodesFromSerializedNodes,S$s=AA.$getClipboardDataFromSelection,GYr=AA.$getHtmlContent,C$s=AA.$getLexicalContent,u_t=AA.$insertDataTransferForPlainText,x$s=AA.$insertDataTransferForRichText,O$s=AA.$insertGeneratedNodes,T$s=AA.copyToClipboard,E$s=AA.setLexicalClipboardDataTransfer;var l_t={};Rn(l_t,{registerPlainText:()=>ypi});var zZ=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,fpi=zZ&&"documentMode"in document?document.documentMode:null,ppi=!(!zZ||!("InputEvent"in window)||fpi)&&"getTargetRanges"in new window.InputEvent("input"),mpi=zZ&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),XYr=zZ&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,hpi=zZ&&/^(?=.*Chrome).*/i.test(navigator.userAgent),gpi=zZ&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!hpi;function ZYr(t,e){e.update(()=>{if(t!==null){let r=Bde(t,KeyboardEvent)?null:t.clipboardData,n=hn();if(n!==null&&r!=null){t.preventDefault();let o=GYr(e);o!==null&&r.setData("text/html",o),r.setData("text/plain",n.getTextContent())}}})}function ypi(t){return S$(t.registerCommand(AZ,e=>{let r=hn();return!!Rr(r)&&(r.deleteCharacter(e),!0)},Zu),t.registerCommand(UXr,e=>{let r=hn();return!!Rr(r)&&(r.deleteWord(e),!0)},Zu),t.registerCommand(qXr,e=>{let r=hn();return!!Rr(r)&&(r.deleteLine(e),!0)},Zu),t.registerCommand(FXr,e=>{let r=hn();if(!Rr(r))return!1;if(typeof e=="string")r.insertText(e);else{let n=e.dataTransfer;if(n!=null)u_t(n,r);else{let o=e.data;o&&r.insertText(o)}}return!0},Zu),t.registerCommand(rZr,()=>{let e=hn();return!!Rr(e)&&(e.removeText(),!0)},Zu),t.registerCommand(xbt,e=>{let r=hn();return!!Rr(r)&&(r.insertLineBreak(e),!0)},Zu),t.registerCommand(HXr,()=>{let e=hn();return!!Rr(e)&&(e.insertLineBreak(),!0)},Zu),t.registerCommand(WXr,e=>{let r=hn();if(!Rr(r))return!1;let n=e,o=n.shiftKey;return!!Ybt(r,!0)&&(n.preventDefault(),Zbt(r,o,!0),!0)},Zu),t.registerCommand(KXr,e=>{let r=hn();if(!Rr(r))return!1;let n=e,o=n.shiftKey;return!!Ybt(r,!1)&&(n.preventDefault(),Zbt(r,o,!1),!0)},Zu),t.registerCommand(XXr,e=>{let r=hn();return!!Rr(r)&&(!XYr||navigator.language!=="ko-KR")&&(e.preventDefault(),t.dispatchCommand(AZ,!0))},Zu),t.registerCommand(ZXr,e=>{let r=hn();return!!Rr(r)&&(e.preventDefault(),t.dispatchCommand(AZ,!1))},Zu),t.registerCommand(jZ,e=>{let r=hn();if(!Rr(r))return!1;if(e!==null){if((XYr||mpi||gpi)&&ppi)return!1;e.preventDefault()}return t.dispatchCommand(xbt,!1)},Zu),t.registerCommand(oZr,()=>(ALe(),!0),Zu),t.registerCommand(jLe,e=>{let r=hn();return!!Rr(r)&&(ZYr(e,t),!0)},Zu),t.registerCommand(kXr,e=>{let r=hn();return!!Rr(r)&&(function(n,o){ZYr(n,o),o.update(()=>{let i=hn();Rr(i)&&i.removeText()})}(e,t),!0)},Zu),t.registerCommand(LLe,e=>{let r=hn();return!!Rr(r)&&(function(n,o){n.preventDefault(),o.update(()=>{let i=hn(),a=Bde(n,ClipboardEvent)?n.clipboardData:null;a!=null&&Rr(i)&&u_t(a,i)},{tag:eZr})}(e,t),!0)},Zu),t.registerCommand(zXr,e=>{let r=hn();return!!Rr(r)&&(e.preventDefault(),!0)},Zu),t.registerCommand(BXr,e=>{let r=hn();return!!Rr(r)&&(e.preventDefault(),!0)},Zu))}var bpi=l_t,YYr=bpi.registerPlainText;var d_t={};Rn(d_t,{PlainTextPlugin:()=>_pi});var N0=L(X(),1),fFe=L(cu(),1),dB=L(vr(),1);var c_t=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?N0.useLayoutEffect:N0.useEffect;function QYr(t){return t.getEditorState().read(aFe(t.isComposing()))}function _pi({contentEditable:t,placeholder:e=null,ErrorBoundary:r}){let[n]=Ai(),o=function(i,a){let[s,u]=(0,N0.useState)(()=>i.getDecorators());return c_t(()=>i.registerDecoratorListener(l=>{(0,fFe.flushSync)(()=>{u(l)})}),[i]),(0,N0.useEffect)(()=>{u(i.getDecorators())},[i]),(0,N0.useMemo)(()=>{let l=[],c=Object.keys(s);for(let d=0;d<c.length;d++){let f=c[d],p=(0,dB.jsx)(a,{onError:h=>i._onError(h),children:(0,dB.jsx)(N0.Suspense,{fallback:null,children:s[f]})}),m=i.getElementByKey(f);m!==null&&l.push((0,fFe.createPortal)(p,m,f))}return l},[a,s,i])}(n,r);return function(i){c_t(()=>S$(YYr(i),jYr(i)),[i])}(n),(0,dB.jsxs)(dB.Fragment,{children:[t,(0,dB.jsx)(vpi,{content:e}),o]})}function vpi({content:t}){let[e]=Ai(),r=function(o){let[i,a]=(0,N0.useState)(()=>QYr(o));return c_t(()=>{function s(){let u=QYr(o);a(u)}return s(),S$(o.registerUpdateListener(()=>{s()}),o.registerEditableListener(()=>{s()}))},[o]),i}(e),n=eYr();return r?typeof t=="function"?t(n):t:null}var wpi=d_t,eQr=wpi.PlainTextPlugin;var f_t={};Rn(f_t,{ContentEditable:()=>Cpi,ContentEditableElement:()=>nQr});var qy=L(X(),1),C$=L(vr(),1);var rQr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?qy.useLayoutEffect:qy.useEffect;function Spi({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,...O},T){let[P,M]=(0,qy.useState)(t.isEditable()),I=(0,qy.useCallback)(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?t.setRootElement(A):t.setRootElement(null)},[t]),j=(0,qy.useMemo)(()=>function(...A){return k=>{A.forEach(V=>{typeof V=="function"?V(k):V!=null&&(V.current=k)})}}(T,I),[I,T]);return rQr(()=>(M(t.isEditable()),t.registerEditableListener(A=>{M(A)})),[t]),(0,C$.jsx)("div",{"aria-activedescendant":P?e:void 0,"aria-autocomplete":P?r:"none","aria-controls":P?n:void 0,"aria-describedby":o,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":P&&y==="combobox"?!!a:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":u,"aria-labelledby":l,"aria-multiline":c,"aria-owns":P?d:void 0,"aria-readonly":!P||void 0,"aria-required":f,autoCapitalize:p,className:m,contentEditable:P,"data-testid":w,id:h,ref:j,role:y,spellCheck:g,style:b,tabIndex:_,...O})}var nQr=(0,qy.forwardRef)(Spi);function tQr(t){return t.getEditorState().read(aFe(t.isComposing()))}var Cpi=(0,qy.forwardRef)(xpi);function xpi(t,e){let{placeholder:r,...n}=t,[o]=Ai();return(0,C$.jsxs)(C$.Fragment,{children:[(0,C$.jsx)(nQr,{editor:o,...n,ref:e}),r!=null&&(0,C$.jsx)(Opi,{editor:o,content:r})]})}function Opi({content:t,editor:e}){let r=function(a){let[s,u]=(0,qy.useState)(()=>tQr(a));return rQr(()=>{function l(){let c=tQr(a);u(c)}return l(),S$(a.registerUpdateListener(()=>{l()}),a.registerEditableListener(()=>{l()}))},[a]),s}(e),[n,o]=(0,qy.useState)(e.isEditable());if((0,qy.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,C$.jsx)("div",{"aria-hidden":!0,children:i})}var oQr=f_t,iQr=oQr.ContentEditable,V$s=oQr.ContentEditableElement;var h_t={};Rn(h_t,{createEmptyHistoryState:()=>Api,registerHistory:()=>Rpi});var pFe=0,p_t=1,m_t=2,Ux=0,Tpi=1,aQr=2,Epi=3,Ppi=4;function Mpi(t,e,r,n,o){if(t===null||r.size===0&&n.size===0&&!o)return Ux;let i=e._selection,a=t._selection;if(o)return Tpi;if(!(Rr(i)&&Rr(a)&&a.isCollapsed()&&i.isCollapsed()))return Ux;let s=function(g,b,_){let w=g._nodeMap,O=[];for(let T of b){let P=w.get(T);P!==void 0&&O.push(P)}for(let[T,P]of _){if(!P)continue;let M=w.get(T);M===void 0||RZ(M)||O.push(M)}return O}(e,r,n);if(s.length===0)return Ux;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)&&Gi(b)&&b.__text.length===1&&i.anchor.offset===1?aQr:Ux}let u=s[0],l=t._nodeMap.get(u.__key);if(!Gi(l)||!Gi(u)||l.__mode!==u.__mode)return Ux;let c=l.__text,d=u.__text;if(c===d)return Ux;let f=i.anchor,p=a.anchor;if(f.key!==p.key||f.type!=="text")return Ux;let m=f.offset,h=p.offset,y=d.length-c.length;return y===1&&h===m-1?aQr:y===-1&&h===m+1?Epi:y===-1&&h===m?Ppi:Ux}function Ipi(t,e){let r=Date.now(),n=Ux;return(o,i,a,s,u,l)=>{let c=Date.now();if(l.has($Le))return n=Ux,r=c,m_t;let d=Mpi(o,i,s,u,t.isComposing()),f=(()=>{let p=a===null||a.editor===t,m=l.has(VXr);if(!m&&p&&l.has(NZ))return pFe;if(o===null)return p_t;let h=i._selection;return s.size>0||u.size>0?m===!1&&d!==Ux&&d===n&&c<r+e&&p||s.size===1&&function(y,g,b){let _=g._nodeMap.get(y),w=b._nodeMap.get(y),O=g._selection,T=b._selection;return!(Rr(O)&&Rr(T)&&O.anchor.type==="element"&&O.focus.type==="element"&&T.anchor.type==="text"&&T.focus.type==="text"||!Gi(_)||!Gi(w)||_.__parent!==w.__parent)&&JSON.stringify(g.read(()=>_.exportJSON()))===JSON.stringify(b.read(()=>w.exportJSON()))}(Array.from(s)[0],o,i)?pFe:p_t:h!==null?pFe:m_t})();return r=c,n=d,f}}function sQr(t){t.undoStack=[],t.redoStack=[],t.current=null}function Rpi(t,e,r){let n=Ipi(t,r);return S$(t.registerCommand(iZr,()=>(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(Tde,!0)),u.length===0&&i.dispatchCommand(Ede,!1),a.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:$Le})}}(t,e),!0),Zu),t.registerCommand(tZr,()=>(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(Ede,!0));let c=s.pop();s.length===0&&i.dispatchCommand(Tde,!1),a.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:$Le})}}(t,e),!0),Zu),t.registerCommand(DXr,()=>(sQr(e),!1),Zu),t.registerCommand($Xr,()=>(sQr(e),t.dispatchCommand(Tde,!1),t.dispatchCommand(Ede,!1),!0),Zu),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===p_t)d.length!==0&&(e.redoStack=[],t.dispatchCommand(Tde,!1)),c!==null&&(f.push({...c}),t.dispatchCommand(Ede,!0));else if(m===m_t)return;e.current={editor:t,editorState:i}}))}function Api(){return{current:null,redoStack:[],undoStack:[]}}var uQr=h_t,mFe=uQr.createEmptyHistoryState,lQr=uQr.registerHistory;var g_t={};Rn(g_t,{HistoryPlugin:()=>Npi,createEmptyHistoryState:()=>mFe});var hFe=L(X(),1);function Npi({delay:t,externalHistoryState:e}){let[r]=Ai();return function(n,o,i=1e3){let a=(0,hFe.useMemo)(()=>o||mFe(),[o]);(0,hFe.useEffect)(()=>lQr(n,a,i),[i,n,a])}(r,e,t),null}var cQr=g_t,dQr=cQr.HistoryPlugin,Y$s=cQr.createEmptyHistoryState;var y_t={};Rn(y_t,{OnChangePlugin:()=>Dpi});var gFe=L(X(),1),jpi=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?gFe.useLayoutEffect:gFe.useEffect;function Dpi({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:r}){let[n]=Ai();return jpi(()=>{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(NZ)||s.isEmpty()||r(o,n,u)})},[n,t,e,r]),null}var $pi=y_t,fQr=$pi.OnChangePlugin;var v_t={};Rn(v_t,{LexicalErrorBoundary:()=>Fpi});var VZ=L(X(),1),b_t=L(vr(),1);function __t(t,e){return __t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},__t(t,e)}var pQr={error:null},Lpi=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=pQr,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,__t(e,r),n.getDerivedStateFromError=function(i){return{error:i}};var o=n.prototype;return o.reset=function(){this.setState(pQr)},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(VZ.isValidElement(l))return l;if(typeof s=="function")return s(c);if(u)return VZ.createElement(u,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(VZ.Component);function Fpi({children:t,onError:e}){return(0,b_t.jsx)(Lpi,{fallback:(0,b_t.jsx)("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:t})}var kpi=v_t,mQr=kpi.LexicalErrorBoundary;var zx=L(X());var S_t=L(Rde());var Bx=L(X()),gQr=L(cu());function yQr(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 hQr=400,qpi=.9;function fB({options:t,selectedIndex:e,onSelect:r,onHighlight:n,range:o,query:i,showPreview:a=!1,mode:s="search",onKeyDown:u}){let[l,c]=(0,Bx.useState)(null),d=(0,Bx.useCallback)(()=>{let m=Math.floor(window.innerWidth*qpi);if(t.length===0)return Math.min(hQr,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),hQr);return Math.min(b,m)},[t]),f=(0,Bx.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,Bx.useEffect)(()=>{f()},[f]),(0,Bx.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=Bx.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}},Bx.default.createElement(JLe,{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,gQr.createPortal)(p,document.body)}var NA=require("obsidian");_t();k1e();function Upi(t){let{type:e,title:r,data:n}=t;switch(e){case"active-note":return $de();case"notes":if(n instanceof NA.TFile&&r)return Dde(r,n.path);break;case"tools":if(typeof n=="string")return m3(n);break;case"folders":if(n instanceof NA.TFolder)return Fde(n.path);break;case"webTabs":if(n&&typeof n=="object"&&"url"in n){let o=n;return nFe(o.url,o.title,o.faviconUrl)}break;case"activeWebTab":return rFe()}throw new Error(`Invalid pill data: ${JSON.stringify(t)}`)}function w_t(t,e,r){return{beforeText:t.slice(0,e),afterText:t.slice(r)}}function Bpi(t,e,r=!0){if(e.length===1&&e[0].getType()==="text")t.replace(e[0]),r&&bQr(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];bQr(n)}}}function zpi(t,e,r,n,o){let i=o?n?" "+n:" ":n;e?(t.setTextContent(e),t.insertAfter(r),i&&r.insertAfter(Sw(i))):(t.replace(r),i&&r.insertAfter(Sw(i))),r.selectNext()}function bQr(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=ELe(),n=t.getIndexWithinParent();r.anchor.set(e.getKey(),n+1,"element"),r.focus.set(e.getKey(),n+1,"element"),u3(r)}}}var yFe=aZr("INSERT_TEXT_WITH_PILLS_COMMAND");function Vpi(t){try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function Hpi(t){let e=t.startsWith("@")?t:`@${t}`;return S7.includes(e)?e:null}function Jpi(t){if(!app?.vault)return null;try{let e=app.vault.getAllLoadedFiles().filter(n=>n instanceof NA.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 B("Error resolving folder reference:",e),null}}function Wpi(t){if(!app?.vault||!app?.metadataCache)return null;try{let e=app.metadataCache.getFirstLinkpathDest(t,"");if(e&&e instanceof NA.TFile)return e;if(!t.endsWith(".md")){let i=app.metadataCache.getFirstLinkpathDest(t+".md","");if(i&&i instanceof NA.TFile)return i}if(!t.endsWith(".pdf")){let i=app.metadataCache.getFirstLinkpathDest(t+".pdf","");if(i&&i instanceof NA.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 NA.TFile&&i.extension==="pdf");for(let i of o)if(i.basename===t||i.name===t)return i;return null}catch(e){return B("Error resolving note reference:",e),null}}function bFe(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=Wpi(m);if(h&&h instanceof NA.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(/,+$/,"");Vpi(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=Hpi(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=Jpi(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 _Fe(t){let e=[];for(let r of t)r.type==="text"&&r.content?e.push(Sw(r.content)):r.type==="active-note-pill"?e.push($de()):r.type==="note-pill"&&r.file?e.push(Dde(r.content,r.file.path)):r.type==="url-pill"&&r.url?e.push(eFe(r.url)):r.type==="tool-pill"&&r.toolName?e.push(m3(r.toolName)):r.type==="folder-pill"&&r.folder&&e.push(Fde(r.folder.path));return e}function _Qr(t,e={}){let{enableURLPills:r=!1,insertAtSelection:n=!0}=e;if(!t)return;let o=hn();if(!Rr(o)){B("No range selection available for text insertion");return}let i=bFe(t,{includeNotes:!0,includeURLs:r}),a=_Fe(i);a.length>0&&(n||o.removeText(),o.insertNodes(a))}function vQr(t,e,r,n={}){let{enableURLPills:o=!1,enableToolPills:i=!1,enableCustomTemplatePills:a=!1}=n,s=hn();if(!Rr(s))return;let l=s.anchor.getNode();if(l.getType()!=="text")return;let c=l,d=c.getTextContent(),f=bFe(r,{includeNotes:!0,includeURLs:o,includeTools:i,includeCustomTemplates:a});if(f.length===1&&f[0].type==="text"){let{beforeText:p,afterText:m}=w_t(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}=w_t(d,t,e),h=[];p&&h.push(Sw(p)),h.push(..._Fe(f)),m&&h.push(Sw(m)),Bpi(c,h)}}function HZ(t,e,r=!0){let n=hn();if(!Rr(n))return;let o=n.anchor,i=o.getNode();if(!(i instanceof EA))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}=w_t(a,u,s),d=Upi(e);zpi(i,l,d,c,r)}var xw=L(X());function pB({triggerConfig:t,options:e,onSelect:r,onStateChange:n,onHighlight:o}){let[i]=Ai(),[a,s]=(0,xw.useState)({isOpen:!1,query:"",selectedIndex:0,range:null});(0,xw.useEffect)(()=>{n?.(a)},[a,n]);let u=(0,xw.useCallback)(()=>{s({isOpen:!1,query:"",selectedIndex:0,range:null})},[]),l=(0,xw.useCallback)(f=>{s(p=>({...p,selectedIndex:f})),o&&e[f]&&o(f,e[f])},[o,e]),c=(0,xw.useCallback)(f=>{if(!f||!a.isOpen)return!1;switch(f.key){case"ArrowDown":{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":{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,xw.useEffect)(()=>{let f=i.registerCommand(JXr,b=>c(b),w$),p=i.registerCommand(GXr,b=>c(b),w$),m=i.registerCommand(jZ,b=>c(b),w$),h=i.registerCommand(QXr,b=>c(b),w$),y=i.registerCommand(YXr,b=>c(b),w$),g=i.registerCommand(jXr,()=>(a.isOpen&&u(),!1),w$);return()=>{f(),p(),m(),h(),y(),g()}},[i,c,a.isOpen,u]);let d=(0,xw.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,xw.useEffect)(()=>i.registerUpdateListener(({editorState:f})=>{f.read(()=>{let p=hn();if(!Rr(p)||!p.isCollapsed()){a.isOpen&&u();return}let m=p.anchor,h=m.getNode();if(!(h instanceof EA)){a.isOpen&&u();return}let y=h.getTextContent(),g=m.offset,b=d(y,g);if(b){let{triggerIndex:_,query:w}=b,O=i._window??window,T=yQr(_,O);T&&s(P=>({...P,isOpen:!0,query:w,selectedIndex:0,range:T}))}else a.isOpen&&u()})}),[i,a.isOpen,u,d]),(0,xw.useEffect)(()=>{s(f=>({...f,selectedIndex:0}))},[e.length]),(0,xw.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 wQr(){let[t]=Ai(),e=oDe(),[r,n]=(0,zx.useState)(""),o=(0,zx.useMemo)(()=>sDe(e.filter(c=>c.showInSlashMenu)).map((c,d)=>({key:`${c.title}-${d}`,title:c.title,content:c.content,command:c})),[e]),i=(0,zx.useMemo)(()=>{if(!r)return o;let l=r,c=S_t.default.go(l,o,{key:"title",threshold:-1e4});return c.length>0?c.map(f=>f.obj):S_t.default.go(l,o,{key:"content",threshold:-1e4}).map(f=>f.obj)},[o,r]),a=(0,zx.useCallback)(l=>{Um.getInstance().recordUsage(l.command),t.update(()=>{let c=hn();if(!Rr(c))return;let d=c.anchor,f=d.getNode();if(f instanceof EA){let m=f.getTextContent().lastIndexOf("/",d.offset);if(m!==-1){let h=l.content||l.title;vQr(m,d.offset,h,{enableURLPills:!0,enableToolPills:!0,enableCustomTemplatePills:!0})}}})},[t]),{state:s,handleHighlight:u}=pB({triggerConfig:{char:"/",allowWhitespace:!0},options:i,onSelect:a,onStateChange:l=>{n(l.query)}});return zx.default.createElement(zx.default.Fragment,null,s.isOpen&&zx.default.createElement(fB,{options:i,selectedIndex:s.selectedIndex,onSelect:a,onHighlight:u,range:s.range,query:s.query,showPreview:!0}))}var Ow=L(X());var y3=L(X());Jr();var SQr=L(Rde());ot();var Kpi={limit:30,threshold:-1e4};function CQr(t,e=!1,r={},n=null){let o=XLe(e),i=(0,y3.useMemo)(()=>o.map((s,u)=>({key:`${s.basename}-${u}`,title:s.basename,subtitle:s.path,content:"",icon:y3.default.createElement(Ju,{className:"tw-size-4"}),file:s})),[o]);return(0,y3.useMemo)(()=>{let s={...Kpi,...r},u=ae().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:y3.default.createElement(jN,{className:"tw-size-4"}),file:n},O=[...g,...b].slice(0,s.limit-1);return[w,...O]}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:y3.default.createElement(jN,{className:"tw-size-4"}),file:n}:null,m=p?s.limit-1:s.limit,y=SQr.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 Gpi(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 vFe=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 Gpi(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 xQr({isCopilotPlus:t=!1,currentActiveFile:e=null}){let[r]=Ai(),[n,o]=(0,Ow.useState)(""),[i]=(0,Ow.useState)(()=>new vFe),[a,s]=(0,Ow.useState)(new Map),u=(0,Ow.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=CQr(n,t,{},e).map(m=>({...m,content:a.get(m.file.path)||""})),d=(0,Ow.useCallback)(m=>{if(m.category==="activeNote")r.update(()=>{HZ("[[",{type:"active-note"})});else{let h={type:"notes",title:m.title,data:m.file};r.update(()=>{HZ("[[",h)})}},[r]),{state:f,handleHighlight:p}=pB({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,Ow.useEffect)(()=>{c.length>0&&!a.has(c[0].file.path)&&u(c[0].file)},[c,a,u]),Ow.default.createElement(Ow.default.Fragment,null,f.isOpen&&Ow.default.createElement(fB,{options:c,selectedIndex:f.selectedIndex,onSelect:d,onHighlight:p,range:f.range,query:f.query,showPreview:!0}))}var mB=L(X());var wFe=L(X()),TQr=L(Rde());eC();ot();function OQr(t=!1){let e=e_(Ibt,{store:ui}),r=e_(Rbt,{store:ui});return t?e:r}var Xpi={limit:10,threshold:-1e4,frontmatterOnly:!1};function EQr(t,e={}){let r=(0,wFe.useMemo)(()=>({...Xpi,...e}),[e]),n=OQr(r.frontmatterOnly),o=(0,wFe.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,wFe.useMemo)(()=>{if(!t.trim())return o.slice(0,r.limit);let a=t.trim();return TQr.default.go(a,o,{key:"title",limit:r.limit,threshold:r.threshold}).map(u=>u.obj)},[o,t,r])}function PQr({onTagSelected:t}){let[e]=Ai(),[r,n]=(0,mB.useState)(""),o=EQr(r,{limit:10}),i=(0,mB.useCallback)(u=>{e.update(()=>{let l=hn();if(!Rr(l))return;let c=l.anchor,d=c.getNode();if(!(d instanceof EA))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}=pB({triggerConfig:{char:"#",multiChar:!1,allowWhitespace:!1},options:o,onSelect:i,onStateChange:u=>{n(u.query)}});return mB.default.createElement(mB.default.Fragment,null,a.isOpen&&mB.default.createElement(fB,{options:o,selectedIndex:a.selectedIndex,onSelect:i,onHighlight:s,range:a.range,query:a.query,showPreview:!1}))}var zh=L(X());var C_t=require("obsidian");function MQr({isCopilotPlus:t=!1,currentActiveFile:e=null}){let[r]=Ai(),[n,o]=(0,zh.useState)({mode:"category"}),[i,a]=(0,zh.useState)(""),s=WLe(t),u=(0,zh.useCallback)(async _=>{try{if(_.extension==="pdf"||_.extension==="canvas"){a("");return}let O=(await app.vault.cachedRead(_)).replace(/^---\s*\n[\s\S]*?\n---\s*\n?/,"").trim(),T=O.length>300?O.slice(0,300)+"...":O;a(T)}catch{a("Failed to load content")}},[]),[l,c]=(0,zh.useState)(""),d=QLe(l,n.mode,n.selectedCategory,t,s,e),f=(0,zh.useCallback)(_=>"data"in _,[]),p=(0,zh.useCallback)(_=>"icon"in _&&!("data"in _),[]),m=(0,zh.useCallback)(_=>{if(n.mode==="category"&&p(_)&&!l){o(w=>({...w,mode:"search",selectedCategory:_.category}));return}if(f(_))if(_.category==="activeNote")r.update(()=>{HZ("@",{type:"active-note"})});else{let w={type:_.category,title:_.title,data:_.data};r.update(()=>{HZ("@",w)})}},[n.mode,l,p,f,r]),h=(0,zh.useCallback)(_=>{c(_.query),_.isOpen||o({mode:"category",selectedCategory:void 0})},[]),{state:y,handleHighlight:g}=pB({triggerConfig:{char:"@",allowWhitespace:!0},options:d,onSelect:m,onStateChange:h});(0,zh.useEffect)(()=>{let _=d[y.selectedIndex];_&&f(_)&&_.category==="notes"&&_.data instanceof C_t.TFile?u(_.data):a("")},[y.selectedIndex,d,f,u]);let b=(0,zh.useMemo)(()=>d.map((_,w)=>w===y.selectedIndex&&f(_)&&_.category==="notes"&&_.data instanceof C_t.TFile?{..._,content:i}:_),[d,y.selectedIndex,i,f]);return zh.default.createElement(zh.default.Fragment,null,y.isOpen&&zh.default.createElement(fB,{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 IQr=L(X());function x_t(t){return t instanceof DLe?typeof t.isPill=="function"&&t.isPill()===!0:!1}function RQr(){let[t]=Ai();return IQr.default.useEffect(()=>{let e=t.registerCommand(AZ,r=>{let n=!1;return t.update(()=>{let o=hn();if(!Rr(o)||!o.isCollapsed()){n=!1;return}let i=o.anchor,a=i.getNode();if(x_t(a)){(r&&i.offset===1||!r&&i.offset===0)&&(a.remove(),n=!0);return}if(fi(a)&&r&&i.offset>0){let u=a.getChildren()[i.offset-1];if(x_t(u)){u.remove(),n=!0;return}}if(r&&i.offset===0){let s=a.getPreviousSibling();if(x_t(s)){s.remove(),n=!0;return}}n=!1}),n},NLe);return()=>{e()}},[t]),null}var AQr=L(X());Or();function NQr({onSubmit:t,sendShortcut:e}){let[r]=Ai();return AQr.default.useEffect(()=>r.registerCommand(jZ,n=>n.isComposing?!1:Zpi(n,e)?(n.preventDefault(),t(),!0):!1,LXr),[r,t,e]),null}function Zpi(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 jQr=L(X());function DQr({value:t}){let[e]=Ai();return jQr.default.useEffect(()=>{e.update(()=>{let r=Ri();r.getTextContent()!==t&&(r.clear(),t&&r.append(_$().append(Sw(t))))})},[e,t]),null}var $Qr=L(X());function LQr({onFocus:t,onEditorReady:e}){let[r]=Ai();return $Qr.default.useEffect(()=>{t(()=>{r.focus()}),e&&e(r)},[r,t,e]),null}var FQr=L(X());var SFe=L(X());function Vx({config:t,onChange:e,onRemoved:r}){let[n]=Ai(),o=SFe.default.useRef([]),{isPillNode:i,extractData:a,getKey:s=c=>String(c),getChangeKey:u}=t,l=SFe.default.useMemo(()=>u??s,[u,s]);return SFe.default.useEffect(()=>{if(!(!e&&!r))return n.registerUpdateListener(({editorState:c})=>{c.read(()=>{let d=[],f=Ri();function p(I){if(i(I)){let j=a(I);d.push(j)}if(typeof I.getChildren=="function"){let j=I.getChildren();for(let A of j)p(A)}}p(f);let m=new Set,y=d.filter(I=>{let j=s(I);return m.has(j)?!1:(m.add(j),!0)}).sort((I,j)=>s(I).localeCompare(s(j))),g=o.current,b=y.map(s),_=g.map(s),w=y.map(l),O=g.map(l),T=b.length!==_.length||b.some((I,j)=>I!==_[j]),P=w.length!==O.length||w.some((I,j)=>I!==O[j]);if(T||P){if(r){let I=new Set(b),j=g.filter(A=>!I.has(s(A)));j.length>0&&r(j)}o.current=y,e&&e(y)}})})},[n,e,r,i,a,s,l]),null}var Ypi={isPillNode:Dbt,extractData:t=>({path:t.getNotePath(),basename:t.getNoteTitle()}),getKey:t=>t.path};function kQr({onNotesChange:t,onNotesRemoved:e}){return FQr.default.createElement(Vx,{config:Ypi,onChange:t,onRemoved:e})}var qQr=L(X());var Qpi={isPillNode:kZr,extractData:t=>t.getURL()};function UQr({onURLsChange:t,onURLsRemoved:e}){return qQr.default.createElement(Vx,{config:Qpi,onChange:t,onRemoved:e})}var BQr=L(X());var emi={isPillNode:BZr,extractData:t=>t.getToolName()};function zQr({onToolsChange:t,onToolsRemoved:e}){return BQr.default.createElement(Vx,{config:emi,onChange:t,onRemoved:e})}var VQr=L(X());var tmi={isPillNode:qZr,extractData:t=>t.getFolderPath()};function HQr({onFoldersChange:t,onFoldersRemoved:e}){return VQr.default.createElement(Vx,{config:tmi,onChange:t,onRemoved:e})}var JQr=L(X());function WQr({onActiveNoteAdded:t,onActiveNoteRemoved:e}){let[r]=Ai();return(0,JQr.useEffect)(()=>{let n=!1,o=r.registerUpdateListener(({editorState:i})=>{i.read(()=>{let a=Ri(),s=!1;function u(l){if($bt(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 hB=L(X());var rmi={isPillNode:JZr,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 KQr({onWebTabsChange:t,onWebTabsRemoved:e,onActiveWebTabAdded:r,onActiveWebTabRemoved:n}){return hB.default.createElement(hB.default.Fragment,null,hB.default.createElement(Vx,{config:rmi,onChange:t,onRemoved:e}),(r||n)&&hB.default.createElement(nmi,{onActiveWebTabAdded:r,onActiveWebTabRemoved:n}))}function nmi({onActiveWebTabAdded:t,onActiveWebTabRemoved:e}){let r={isPillNode:Lbt,extractData:()=>!0,getKey:()=>"active-web-tab"},n=hB.default.useCallback(i=>{i.length>0&&t&&t()},[t]),o=hB.default.useCallback(i=>{i.length>0&&e&&e()},[e]);return hB.default.createElement(Vx,{config:r,onChange:n,onRemoved:o})}var GQr=L(X());function XQr({enableURLPills:t=!1,onImagePaste:e}){let[r]=Ai();return GQr.default.useEffect(()=>r.registerCommand(LLe,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=bFe(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=hn();if(!Rr(p))return;let m=_Fe(d);m.length>0&&p.insertNodes(m)}),!0):!1},w$),[r,t,e]),null}var ZQr=L(X());function YQr(){let[t]=Ai();return ZQr.default.useEffect(()=>t.registerCommand(yFe,e=>{let{text:r,options:n={}}=e;return t.update(()=>{_Qr(r,n)}),!0},Zu),[t]),null}var iv=L(X());var QQr=(0,iv.createContext)(void 0);function gB(){let t=(0,iv.useContext)(QQr);if(t===void 0)throw new Error("useChatInput must be used within a ChatInputProvider");return t}function een({children:t}){let[e,r]=(0,iv.useState)(null),[n,o]=(0,iv.useState)(null),i=(0,iv.useCallback)(c=>{r(c)},[]),a=(0,iv.useCallback)(c=>{o(()=>c)},[]),s=(0,iv.useCallback)((c,d=!1)=>{e&&e.dispatchCommand(yFe,{text:c,options:{enableURLPills:d,insertAtSelection:!0}})},[e]),u=(0,iv.useCallback)(()=>{n&&n()},[n]),l={insertTextWithPills:s,focusInput:u,registerEditor:i,registerFocusHandler:a};return iv.default.createElement(QQr.Provider,{value:l},t)}kn();_t();Bc();ot();var omi=({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:O,onTagSelected:T,isCopilotPlus:P=!1,currentActiveFile:M=null,currentChain:I})=>{let[j,A]=Xi.default.useState(null),[k,V]=Xi.default.useState(null),q=gB(),J=zr(),K=Xi.default.useCallback(Y=>{A(()=>Y)},[]);(0,Xi.useEffect)(()=>{k&&q.registerEditor(k)},[k,q]),(0,Xi.useEffect)(()=>{j&&q.registerFocusHandler(j)},[j,q]);let ue=Xi.default.useMemo(()=>({namespace:"ChatEditor",theme:{root:"tw-outline-none",paragraph:"tw-m-0"},nodes:[LZ,kZ,p3,f3,h3,qZ,...u?[d3]:[]],onError:Y=>{ne("Lexical error:",Y)},editable:!o}),[u,o]),oe=(0,Xi.useCallback)(Y=>{Y.read(()=>{let ie=Ri().getTextContent();e(ie)})},[e]),G=(0,Xi.useCallback)(Y=>{V(Y),w?.(Y)},[w]);return Xi.default.createElement(QZr,{initialConfig:ue},Xi.default.createElement($Zr,{currentActiveFile:M},Xi.default.createElement("div",{className:Te("tw-relative",i)},Xi.default.createElement(eQr,{contentEditable:Xi.default.createElement(iQr,{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:Xi.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:mQr}),Xi.default.createElement(fQr,{onChange:oe}),Xi.default.createElement(dQr,null),Xi.default.createElement(NQr,{onSubmit:r,sendShortcut:J.defaultSendShortcut}),Xi.default.createElement(DQr,{value:t}),Xi.default.createElement(LQr,{onFocus:K,onEditorReady:G}),Xi.default.createElement(kQr,{onNotesChange:a,onNotesRemoved:s}),u&&Xi.default.createElement(UQr,{onURLsChange:u,onURLsRemoved:l}),Xi.default.createElement(zQr,{onToolsChange:c,onToolsRemoved:d}),Xi.default.createElement(HQr,{onFoldersChange:f,onFoldersRemoved:p}),Xi.default.createElement(WQr,{onActiveNoteAdded:m,onActiveNoteRemoved:h}),Xi.default.createElement(KQr,{onWebTabsChange:y,onWebTabsRemoved:g,onActiveWebTabAdded:b,onActiveWebTabRemoved:_}),Xi.default.createElement(RQr,null),Xi.default.createElement(XQr,{enableURLPills:!!u,onImagePaste:O}),Xi.default.createElement(wQr,null),Xi.default.createElement(xQr,{isCopilotPlus:P,currentActiveFile:M}),I&&I!=="llm_chain"&&Xi.default.createElement(PQr,{onTagSelected:T}),Xi.default.createElement(MQr,{isCopilotPlus:P,currentActiveFile:M}),Xi.default.createElement(YQr,null))))},ten=omi;var ren=({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:_,editMode:w=!1,onEditSave:O,onEditCancel:T,initialContext:P})=>{let[M,I]=(0,zt.useState)(P?.urls||[]),[j,A]=(0,zt.useState)(P?.folders||[]),[k,V]=(0,zt.useState)([]),q=(0,zt.useRef)(null),J=(0,zt.useRef)(null),[K,ue]=yL(),[oe]=Cv(),[G]=Oge(),Y=zr(),[se,ie]=(0,zt.useState)(()=>{let Ft=i.workspace.getActiveFile();return bO(Ft)?Ft:null}),[$,H]=(0,zt.useState)(null),[re,D]=(0,zt.useState)([]),[R,z]=(0,zt.useState)([]),[U,ee]=(0,zt.useState)([]),[ce,ve]=(0,zt.useState)([]),[Oe,Je]=(0,zt.useState)([]),tt=sb(oe),Ke=(0,zt.useMemo)(()=>wJ([...k,...Oe]),[k,Oe]),dt=()=>{let Ft=J.current;return Ft?Ft.read(()=>Fbt().map(Ee=>({url:Ee.getURL(),title:Ee.getTitle(),faviconUrl:Ee.getFaviconUrl()}))):Oe},[Pt,Nt]=(0,zt.useState)(!1),[Ne,Tr]=(0,zt.useState)(!1),[st,Le]=(0,zt.useState)(!1),[rt,Fe]=(0,zt.useState)(Y.enableAutonomousAgent),[We,ke]=(0,zt.useState)(0),Lt=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,zt.useEffect)(()=>{oe==="project"?Fe(!1):Fe(Y.enableAutonomousAgent)},[Y.enableAutonomousAgent,oe]),(0,zt.useEffect)(()=>{if(oe==="project"){H(Uu());let Ft=e6(Ge=>{H(Ge)});return()=>{Ft()}}else H(null)},[oe]),(0,zt.useEffect)(()=>{if(!G)return;let Ft=setInterval(()=>{ke(Ge=>(Ge+1)%Lt.length)},3e3);return()=>clearInterval(Ft)},[G,Lt.length]);let Eo=()=>$&&oe==="project"&&$.projectModelKey?$.projectModelKey:K,xl=()=>{if(w&&O){O(t,{notes:a,urls:M,folders:j});return}let Ft=dt(),Ge=wJ([...k,...Ft]);if(!tt){r({webTabs:Ge});return}let Ee=[];if(!rt){let yr=t.toLowerCase();Pt&&!yr.includes("@vault")&&Ee.push("@vault"),Ne&&!yr.includes("@websearch")&&!yr.includes("@web")&&Ee.push("@websearch"),st&&!yr.includes("@composer")&&Ee.push("@composer")}r({toolCalls:Ee,contextNotes:a,urls:M,contextFolders:j,webTabs:Ge})},In=Ft=>{let Ge=new Set(Ft.map(Ee=>Ee.path));s(Ee=>Ee.filter(yr=>!Ge.has(yr.path)))},hi=Ft=>{let Ge=new Set(Ft);I(Ee=>Ee.filter(yr=>!Ge.has(yr)))},Gm=Ft=>{!tt||rt||Ft.forEach(Ge=>{switch(Ge){case"@vault":Nt(!1);break;case"@websearch":case"@web":Tr(!1);break;case"@composer":Le(!1);break}})};(0,zt.useEffect)(()=>{if(!tt||rt)return;let Ft=ce.includes("@vault"),Ge=ce.includes("@websearch")||ce.includes("@web"),Ee=ce.includes("@composer");Nt(Ft),Tr(Ge),Le(Ee)},[ce,tt,rt]);let Fs=Ft=>{J.current&&J.current.update(()=>{NZr(Ft)}),D(Ge=>Ge.filter(Ee=>Ee.path!==Ft))},Vb=Ft=>{J.current&&J.current.update(()=>{FZr(Ft)}),z(Ge=>Ge.filter(Ee=>Ee!==Ft))},Jh=Ft=>{J.current&&J.current.update(()=>{UZr(Ft)}),ee(Ge=>Ge.filter(Ee=>Ee!==Ft))},Mw=(Ft,Ge)=>{switch(Ft){case"activeNote":l(!0);break;case"notes":if(Ge instanceof zde.TFile){let Ee=i.workspace.getActiveFile();Ee&&Ge.path===Ee.path?(l(!0),s(yr=>yr.filter(ii=>ii.path!==Ge.path))):s(yr=>yr.find(is=>is.path===Ge.path)?yr:[...yr,Ge])}break;case"tools":typeof Ge=="string"&&J.current&&J.current.update(()=>{let Ee=hn();if(Rr(Ee)){let yr=m3(Ge);Ee.insertNodes([yr])}});break;case"folders":if(Ge&&Ge.path){let Ee=Ge.path;A(yr=>yr.find(is=>is===Ee)?yr:[...yr,Ee])}break;case"webTabs":if(Ge&&typeof Ge.url=="string"){let Ee=qmt(Ge);if(!Ee)break;let yr=Dy(f?.url);if(yr&&Ee.url===yr){d(!0),V(ii=>ii.filter(is=>Dy(is.url)!==yr));break}V(ii=>wJ([...ii,Ee]))}break;case"activeWebTab":d(!0);{let Ee=Dy(f?.url);Ee&&V(yr=>yr.filter(ii=>Dy(ii.url)!==Ee))}break}},zi=(Ft,Ge)=>{switch(Ft){case"activeNote":l(!1),J.current&&J.current.update(()=>{LZr()});break;case"notes":typeof Ge=="string"&&(se?.path===Ge&&u?l(!1):s(Ee=>Ee.filter(yr=>yr.path!==Ge)),Fs(Ge));break;case"urls":typeof Ge=="string"&&(I(Ee=>Ee.filter(yr=>yr!==Ge)),Vb(Ge));break;case"folders":typeof Ge=="string"&&(A(Ee=>Ee.filter(yr=>yr!==Ge)),Jh(Ge));break;case"selectedText":typeof Ge=="string"&&b?.(Ge);break;case"activeWebTab":d(!1),J.current&&J.current.update(()=>{VZr()});break;case"webTabs":if(typeof Ge=="string"){let Ee=Dy(Ge);if(!Ee)break;V(yr=>yr.filter(ii=>Dy(ii.url)!==Ee)),Je(yr=>yr.filter(ii=>Dy(ii.url)!==Ee)),J.current&&J.current.update(()=>{WZr(Ee)})}break}},pt=Ft=>{let Ge=new Set(Ft);A(Ee=>Ee.filter(yr=>!Ge.has(yr)))};(0,zt.useEffect)(()=>{s(Ft=>{let Ge=new Set(Ft.map(ii=>ii.path)),Ee=re.filter(ii=>!Ge.has(ii.path)),yr=[];return Ee.forEach(ii=>{let is=i.vault.getAbstractFileByPath(ii.path);is instanceof zde.TFile&&yr.push(is)}),[...Ft,...yr]})},[re,i.vault,s]),(0,zt.useEffect)(()=>{sb(oe)?I(Ft=>{let Ge=new Set(Ft),Ee=R.filter(yr=>!Ge.has(yr));return Ee.length>0?Array.from(new Set([...Ft,...Ee])):Ft}):I([])},[R,oe]),(0,zt.useEffect)(()=>{A(Ft=>{let Ge=new Set(Ft),Ee=U.filter(yr=>!Ge.has(yr));return[...Ft,...Ee]})},[U]),(0,zt.useEffect)(()=>{let Ft,Ge=()=>{clearTimeout(Ft),Ft=setTimeout(()=>{let yr=i.workspace.getActiveFile();ie(bO(yr)?yr:null)},100)},Ee=i.workspace.on("active-leaf-change",Ge);return()=>{clearTimeout(Ft),i.workspace.offref(Ee)}},[i.workspace]);let Br=(0,zt.useCallback)(Ft=>{J.current=Ft},[]);(0,zt.useEffect)(()=>{if(!w||!T)return;let Ft=Ge=>{Ge.key==="Escape"&&(Ge.preventDefault(),T())};return document.addEventListener("keydown",Ft),()=>document.removeEventListener("keydown",Ft)},[w,T]);let Ti=(0,zt.useCallback)(()=>{J.current&&tt&&J.current.update(()=>{kde("@vault")})},[tt]),Ei=(0,zt.useCallback)(()=>{J.current&&tt&&J.current.update(()=>{kde("@websearch"),kde("@web")})},[tt]),tu=(0,zt.useCallback)(()=>{J.current&&tt&&J.current.update(()=>{kde("@composer")})},[tt]),Pi=(0,zt.useCallback)(()=>{l(!0)},[l]),tl=(0,zt.useCallback)(()=>{l(!1)},[l]),rl=(0,zt.useCallback)(()=>{d(!0)},[d]),Ol=(0,zt.useCallback)(()=>{d(!1)},[d]),Xm=(0,zt.useCallback)(()=>{tt&&!rt&&!Pt&&(Nt(!0),new zde.Notice("Vault search enabled for tag query"))},[tt,rt,Pt]);return zt.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:q},!w&&zt.default.createElement(IZr,{contextNotes:a,includeActiveNote:u,activeNote:se,includeActiveWebTab:c,activeWebTab:f,contextUrls:M,contextFolders:j,contextWebTabs:Ke,selectedTextContexts:g,showProgressCard:_,lexicalEditorRef:J,onAddToContext:Mw,onRemoveFromContext:zi}),p.length>0&&zt.default.createElement("div",{className:"selected-images"},p.map((Ft,Ge)=>zt.default.createElement("div",{key:Ge,className:"image-preview-container"},zt.default.createElement("img",{src:URL.createObjectURL(Ft),alt:Ft.name,className:"selected-image-preview"}),zt.default.createElement("button",{className:"remove-image-button",onClick:()=>h(Ee=>Ee.filter((yr,ii)=>ii!==Ge)),title:"Remove image"},zt.default.createElement($o,{className:"tw-size-4"}))))),zt.default.createElement("div",{className:"tw-relative"},G&&zt.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"},zt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zt.default.createElement(du,{className:"tw-size-4 tw-animate-spin"}),zt.default.createElement("span",{className:"tw-text-sm"},Lt[We]))),zt.default.createElement(ten,{value:t,onChange:Ft=>e(Ft),onSubmit:xl,onNotesChange:D,onNotesRemoved:In,onActiveNoteAdded:Pi,onActiveNoteRemoved:tl,onURLsChange:tt?z:void 0,onURLsRemoved:tt?hi:void 0,onToolsChange:tt?ve:void 0,onToolsRemoved:tt?Gm:void 0,onFoldersChange:ee,onFoldersRemoved:pt,onWebTabsChange:Je,onActiveWebTabAdded:rl,onActiveWebTabRemoved:Ol,onEditorReady:Br,onImagePaste:m,onTagSelected:Xm,placeholder:"Your AI assistant for Obsidian \u2022 @ to add context \u2022 / for custom prompts",disabled:G,isCopilotPlus:tt,currentActiveFile:se,currentChain:oe})),zt.default.createElement("div",{className:"tw-flex tw-h-6 tw-justify-between tw-gap-1 tw-px-1"},n?zt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-px-1 tw-text-sm tw-text-muted"},zt.default.createElement(du,{className:"tw-size-3 tw-animate-spin"}),zt.default.createElement("span",null,"Generating...")):zt.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},zt.default.createElement(U$e,{variant:"ghost2",size:"fit",disabled:y,value:Eo(),onChange:Ft=>{oe!=="project"&&ue(Ft)},className:"tw-max-w-full tw-truncate"})),zt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?zt.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},zt.default.createElement(VL,{className:"tw-size-4"}),"Stop"):zt.default.createElement(zt.default.Fragment,null,zt.default.createElement(UGr,{vaultToggle:Pt,setVaultToggle:Nt,webToggle:Ne,setWebToggle:Tr,composerToggle:st,setComposerToggle:Le,autonomousAgentToggle:rt,setAutonomousAgentToggle:Fe,currentChain:oe,onVaultToggleOff:Ti,onWebToggleOff:Ei,onComposerToggleOff:tu}),zt.default.createElement(jb,{delayDuration:0},zt.default.createElement(pn,null,zt.default.createElement(mn,{asChild:!0},zt.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent",onClick:()=>{new q$e(i,m).open()}},zt.default.createElement(Yte,{className:"tw-size-4"}))),zt.default.createElement(sn,{className:"tw-px-1 tw-py-0.5"},"Add image(s)"))),w&&T&&zt.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:T},zt.default.createElement("span",null,"cancel")),zt.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>xl()},zt.default.createElement(fC,{className:"!tw-size-3"}),zt.default.createElement("span",null,w?"save":"chat"))))))};ren.displayName="ChatInput";var CFe=ren;to();Or();kn();Jr();var nen=require("obsidian"),Qn=L(X()),oen=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>Qn.default.createElement("div",{className:Te("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!nen.Platform.isMobile})},t.sender===Ws?Qn.default.createElement(Qn.default.Fragment,null,Qn.default.createElement(pn,null,Qn.default.createElement(mn,{asChild:!0},Qn.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Qn.default.createElement(Hu,{className:"tw-size-4"}):Qn.default.createElement(ig,{className:"tw-size-4"}))),Qn.default.createElement(sn,null,"Copy")),Qn.default.createElement(pn,null,Qn.default.createElement(mn,{asChild:!0},Qn.default.createElement(ge,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},Qn.default.createElement(d_,{className:"tw-size-4"}))),Qn.default.createElement(sn,null,"Edit")),Qn.default.createElement(pn,null,Qn.default.createElement(mn,{asChild:!0},Qn.default.createElement(ge,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Qn.default.createElement(ly,{className:"tw-size-4"}))),Qn.default.createElement(sn,null,"Delete"))):Qn.default.createElement(Qn.default.Fragment,null,u&&Qn.default.createElement(pn,null,Qn.default.createElement(mn,{asChild:!0},Qn.default.createElement(ge,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},Qn.default.createElement(e4,{className:"tw-size-4"}))),Qn.default.createElement(sn,null,"Show Sources")),Qn.default.createElement(pn,null,Qn.default.createElement(mn,{asChild:!0},Qn.default.createElement(ge,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},Qn.default.createElement(ire,{className:"tw-size-4"}))),Qn.default.createElement(sn,null,"Insert / Replace at cursor")),Qn.default.createElement(pn,null,Qn.default.createElement(mn,{asChild:!0},Qn.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Qn.default.createElement(Hu,{className:"tw-size-4"}):Qn.default.createElement(ig,{className:"tw-size-4"}))),Qn.default.createElement(sn,null,"Copy")),Qn.default.createElement(pn,null,Qn.default.createElement(mn,{asChild:!0},Qn.default.createElement(ge,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},Qn.default.createElement(nre,{className:"tw-size-4"}))),Qn.default.createElement(sn,null,"Regenerate")),Qn.default.createElement(pn,null,Qn.default.createElement(mn,{asChild:!0},Qn.default.createElement(ge,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Qn.default.createElement(ly,{className:"tw-size-4"}))),Qn.default.createElement(sn,null,"Delete"))));var ien=require("obsidian"),xFe=class extends ien.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.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 Uy=L(X());var aen=({initialValue:t,initialContext:e,onSave:r,onCancel:n,app:o})=>{let[i,a]=(0,Uy.useState)(t),[s,u]=(0,Uy.useState)(e?.notes?.map(M=>M)||[]),[l,c]=(0,Uy.useState)(!1),[d,f]=(0,Uy.useState)(!1),[p,m]=(0,Uy.useState)([]),{activeWebTabForMentions:h}=lB(),y=(0,Uy.useCallback)((M,I)=>{let j={notes:I.notes,urls:I.urls,tags:I.tags,folders:I.folders,selectedTextContexts:e?.selectedTextContexts||[]};r(M,j)},[r,e?.selectedTextContexts]),g=(0,Uy.useCallback)(()=>{n()},[n]),b=(0,Uy.useCallback)(()=>{},[]),_=(0,Uy.useCallback)(()=>{},[]),w=(0,Uy.useCallback)(M=>{m(I=>[...I,...M])},[]),O=(0,Uy.useCallback)(M=>{},[]),T=(0,Uy.useCallback)(()=>{},[]),P={notes:s,urls:e?.urls||[],tags:e?.tags||[],folders:e?.folders||[]};return Uy.default.createElement(CFe,{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:O,showProgressCard:T,editMode:!0,onEditSave:y,onEditCancel:g,initialContext:P})};qs();to();ot();to();var Tw=L(X());kn();Jr();hN();_t();Zt();function jA({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,Tw.useState)(!1),s=(0,Tw.useRef)(null),u=(0,Tw.useRef)(!0);return(0,Tw.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await Do(t)}catch(c){ne("Failed to decrypt value:"+Sn(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),Tw.default.createElement("div",{className:Te("tw-relative",o)},Tw.default.createElement(Zo,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:Te("tw-w-full !tw-pr-7")}),Tw.default.createElement("div",{onClick:()=>!n&&a(!i),className:Te("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?Tw.default.createElement(zte,{className:Te("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):Tw.default.createElement(NN,{className:Te("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}Or();ot();Zt();pL();var OFe=require("obsidian"),ln=L(X()),sen=L(dd());var imi=({model:t,onUpdate:e,isEmbeddingModel:r,onCancel:n})=>{let[o,i]=(0,ln.useState)(t),[a,s]=(0,ln.useState)(t),[u,l]=(0,ln.useState)({}),c=ae(),d=o.provider==="amazon-bedrock";(0,ln.useEffect)(()=>{i(t),s(t),t.provider&&l(dN(t.provider))},[t]);let f=(0,ln.useMemo)(()=>dge((_,w)=>{e(r,_,w)},500),[r,e]),p=(0,ln.useCallback)((_,w)=>{i(O=>{let T={...O,[_]:w};return f(a,T),T})},[a,f]),m=(0,ln.useCallback)(_=>{i(w=>{let O={...w};return delete O[_],f(a,O),O})},[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]",O=o.azureOpenAIApiVersion||"[api-version]",T=o.isEmbeddingModel?"embeddings":"chat/completions";return`https://${_}.openai.azure.com/openai/deployments/${w}/${T}?api-version=${O}`},y=Object.entries(hL).map(([_,w])=>({id:_,label:_.charAt(0).toUpperCase()+_.slice(1),description:w})),g=ab(o.provider,o),b=!r&&o.provider!=="copilot-plus-jina";return ln.default.createElement("div",{className:"tw-space-y-3 tw-p-4"},ln.default.createElement("div",{className:"tw-space-y-3"},ln.default.createElement(qo,{label:"Model Name",required:!0},ln.default.createElement(Zo,{type:"text",disabled:o.core,value:o.name,onChange:_=>p("name",_.target.value),placeholder:"Enter model name"})),ln.default.createElement(qo,{label:ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ln.default.createElement("span",{className:"tw-leading-none"},"Display Name"),ln.default.createElement(xi,{content:ln.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},ln.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),ln.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),ln.default.createElement("div",{className:"tw-text-[12px]"},"Example:",ln.default.createElement("li",null,"Direct-Paid:Ds-r1"),ln.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),ln.default.createElement("li",null,"Perplexity-Paid:lg"))),contentClassName:"tw-max-w-96"}))},ln.default.createElement(Zo,{type:"text",placeholder:"Custom display name (optional)",value:o.displayName||"",onChange:_=>p("displayName",_.target.value)})),ln.default.createElement(qo,{label:"Provider"},ln.default.createElement(Zo,{type:"text",value:tg(o.provider),disabled:!0})),ln.default.createElement(qo,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},ln.default.createElement(Zo,{type:"text",placeholder:h(),value:o.baseUrl||"",onChange:_=>p("baseUrl",_.target.value)})),d&&ln.default.createElement(qo,{label:"Region (optional)",description:"Defaults to us-east-1 when left blank. With inference profiles (global., us., eu., apac.), region is auto-managed."},ln.default.createElement(Zo,{type:"text",placeholder:"Enter AWS region (e.g. us-east-1)",value:o.bedrockRegion||"",onChange:_=>p("bedrockRegion",_.target.value)})),ln.default.createElement(qo,{label:"API Key"},ln.default.createElement(jA,{placeholder:`Enter ${u.label||"Provider"} API Key`,value:g,onChange:_=>p("apiKey",_)}),u.keyManagementURL&&ln.default.createElement("p",{className:"tw-text-xs tw-text-muted"},ln.default.createElement("a",{href:u.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",u.label," API Key"))),b&&ln.default.createElement(ln.default.Fragment,null,ln.default.createElement(qo,{label:ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ln.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),ln.default.createElement(xi,{content:ln.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"}))},ln.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},y.map(({id:_,label:w,description:O})=>ln.default.createElement("div",{key:_,className:"tw-flex tw-items-center tw-gap-2"},ln.default.createElement(Qc,{id:_,checked:o.capabilities?.includes(_),onCheckedChange:T=>{let P=o.capabilities||[],M=T?[...P,_]:P.filter(I=>I!==_);p("capabilities",M)}}),ln.default.createElement(xi,{content:O},ln.default.createElement(im,{htmlFor:_,className:"tw-text-sm"},w)))))),ln.default.createElement(F$e,{model:o,settings:c,onChange:p,onReset:m,showTokenLimit:!0}))),ln.default.createElement("div",{className:"tw-mt-6 tw-flex tw-justify-end tw-gap-2 tw-border-t tw-border-border tw-pt-4"},ln.default.createElement(ge,{variant:"secondary",onClick:n},"Close")))},JZ=class extends OFe.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;OFe.Platform.isMobile&&(n.style.height="80%"),this.root=(0,sen.createRoot)(r);let o=(a,s,u)=>{this.onUpdate(a,s,u)},i=()=>{this.close()};this.root.render(ln.default.createElement(imi,{model:this.model,isEmbeddingModel:this.isEmbeddingModel,onUpdate:o,onCancel:i}))}onClose(){this.root.unmount()}};Jr();var uen=require("obsidian"),x$=L(X()),len=({message:t,app:e})=>{let r=()=>{let n=ae(),o=i_(),i=n.activeModels.find(u=>oo(u)===o);if(!i){new uen.Notice("Could not find the current model settings");return}let a=(u,l,c)=>{let d=n.activeModels.map(f=>f===l?c:f);Ue("activeModels",d)};new JZ(e,i,!1,a).open()};return x$.default.createElement("div",{className:"tw-mt-3 tw-rounded-md tw-border tw-border-border tw-bg-callout-warning/20 tw-p-4"},x$.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-3"},x$.default.createElement(_m,{className:"tw-size-5 tw-shrink-0 tw-text-warning"}),x$.default.createElement("div",{className:"tw-flex-1"},x$.default.createElement("div",{className:"tw-mb-2 tw-font-semibold tw-text-warning"},"Response Truncated"),x$.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&&x$.default.createElement("div",{className:"tw-mb-3 tw-text-sm tw-text-muted"},"Output tokens used: ",t.responseMetadata.tokenUsage.outputTokens||"N/A"),x$.default.createElement(ge,{variant:"secondary",size:"sm",onClick:r,className:"tw-text-warning hover:tw-bg-callout-warning/10"},"Open Model Settings"))))};var j_t=L(X()),D_t=L(dd());var TFe=L(X()),cen=({errorContent:t})=>TFe.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"},TFe.default.createElement("div",{className:"tw-mb-2 tw-text-sm tw-font-semibold tw-text-error"},"\u26A0\uFE0F Error occurred"),TFe.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-xs tw-text-error"},t.trim()));var kg=L(X(),1);function den(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var pen=L(X(),1);function fen(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function O_t(...t){return e=>{let r=!1,n=t.map(o=>{let i=fen(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():fen(t[o],null)}}}}function men(...t){return pen.useCallback(O_t(...t),t)}var hen=L(X(),1),cmi=L(cu(),1);var Fg=L(X(),1);var WZ=L(vr(),1),E_t=Fg.forwardRef((t,e)=>{let{children:r,...n}=t,o=Fg.Children.toArray(r),i=o.find(smi);if(i){let a=i.props.children,s=o.map(u=>u===i?Fg.Children.count(a)>1?Fg.Children.only(null):Fg.isValidElement(a)?a.props.children:null:u);return(0,WZ.jsx)(T_t,{...n,ref:e,children:Fg.isValidElement(a)?Fg.cloneElement(a,void 0,s):null})}return(0,WZ.jsx)(T_t,{...n,ref:e,children:r})});E_t.displayName="Slot";var T_t=Fg.forwardRef((t,e)=>{let{children:r,...n}=t;if(Fg.isValidElement(r)){let o=lmi(r);return Fg.cloneElement(r,{...umi(n,r.props),ref:e?O_t(e,o):o})}return Fg.Children.count(r)>1?Fg.Children.only(null):null});T_t.displayName="SlotClone";var ami=({children:t})=>(0,WZ.jsx)(WZ.Fragment,{children:t});function smi(t){return Fg.isValidElement(t)&&t.type===ami}function umi(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 lmi(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 gen=L(vr(),1),dmi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],EFe=dmi.reduce((t,e)=>{let r=hen.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?E_t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,gen.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var PFe=L(X(),1);var fmi=PFe.useId||(()=>{}),pmi=0;function yen(t){let[e,r]=PFe.useState(fmi());return kD(()=>{t||r(n=>n??String(pmi++))},[t]),t||(e?`radix-${e}`:"")}var b3=L(vr(),1),P_t="Collapsible",[mmi,$Us]=Yje(P_t),[hmi,M_t]=mmi(P_t),ben=kg.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=Qje({prop:n,defaultProp:o,onChange:a});return(0,b3.jsx)(hmi,{scope:r,disabled:i,contentId:yen(),open:u,onOpenToggle:kg.useCallback(()=>l(c=>!c),[l]),children:(0,b3.jsx)(EFe.div,{"data-state":N_t(u),"data-disabled":i?"":void 0,...s,ref:e})})});ben.displayName=P_t;var _en="CollapsibleTrigger",I_t=kg.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=M_t(_en,r);return(0,b3.jsx)(EFe.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":N_t(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:den(t.onClick,o.onOpenToggle)})});I_t.displayName=_en;var R_t="CollapsibleContent",A_t=kg.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=M_t(R_t,t.__scopeCollapsible);return(0,b3.jsx)(dce,{present:r||o.open,children:({present:i})=>(0,b3.jsx)(gmi,{...n,ref:e,present:i})})});A_t.displayName=R_t;var gmi=kg.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=M_t(R_t,r),[s,u]=kg.useState(n),l=kg.useRef(null),c=men(e,l),d=kg.useRef(0),f=d.current,p=kg.useRef(0),m=p.current,h=a.open||s,y=kg.useRef(h),g=kg.useRef(void 0);return kg.useEffect(()=>{let b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),kD(()=>{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,b3.jsx)(EFe.div,{"data-state":N_t(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!h,...i,ref:c,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...t.style},children:h&&o})});function N_t(t){return t?"open":"closed"}var ven=ben;var kb=ven,O$=I_t,qb=A_t;kn();Due();Jr();var Yu=L(X()),bmi="shimmer 2s ease-in-out infinite",Vde=5e3,_mi=(t,e)=>{if(!e)return null;if(e.length>Vde)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=fx.format(t,e);return r.length>Vde?r.slice(0,Vde)+`
|
||
|
||
\u2026 (truncated ${(r.length-Vde).toLocaleString()} characters for display)`:r}catch{return e.length>Vde?`Tool '${t}' returned ${e.length.toLocaleString()} characters. The full output is preserved in chat history but omitted here to keep the UI responsive.`:e}},wen=({toolName:t,displayName:e,emoji:r,isExecuting:n,result:o,confirmationMessage:i,onAccept:a,onReject:s})=>{let[u,l]=(0,Yu.useState)(!1),c=(0,Yu.useMemo)(()=>_mi(t,o),[t,o]),d=n&&!o,f=!d&&c!==null;return Yu.default.createElement(kb,{open:f?u:!1,onOpenChange:l,disabled:!f,"aria-disabled":!f,className:"tw-my-3 tw-w-full sm:tw-max-w-sm"},Yu.default.createElement("div",{className:Te("tw-rounded-md tw-border tw-border-border tw-bg-secondary/50",d&&"tw-relative tw-overflow-hidden")},d&&Yu.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-[1] tw-overflow-hidden"},Yu.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:bmi}})),Yu.default.createElement(O$,{className:Te("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")},Yu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Yu.default.createElement("span",{className:"tw-text-base"},r),Yu.default.createElement("span",{className:"tw-font-medium"},t==="readNote"?`${d?"Reading":"Read"} ${e}`:`${d?"Calling":"Called"} ${e}`,d&&t!=="readNote"&&"..."),d&&i&&Yu.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"\u2022 ",i,"...")),Yu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},!d&&a&&s&&Yu.default.createElement(Yu.default.Fragment,null,Yu.default.createElement("button",{onClick:p=>{p.stopPropagation(),a()},className:"hover:tw-bg-green-rgb/20 tw-rounded tw-p-1",title:"Accept"},Yu.default.createElement(Hu,{className:"tw-size-4 tw-text-success"})),Yu.default.createElement("button",{onClick:p=>{p.stopPropagation(),s()},className:"hover:tw-bg-red-rgb/20 tw-rounded tw-p-1",title:"Reject"},Yu.default.createElement($o,{className:"tw-size-4 tw-text-error"}))),f&&Yu.default.createElement(bm,{className:Te("tw-size-4 tw-text-muted tw-transition-transform",u&&"tw-rotate-90")}))),Yu.default.createElement(qb,null,Yu.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"},Yu.default.createElement("div",{className:"tw-text-sm tw-text-muted"},Yu.default.createElement("pre",{className:"tw-overflow-x-auto tw-whitespace-pre-wrap tw-font-mono tw-text-xs"},c??"No result available"))))))};_t();var Sen=60*60*1e3,KZ=()=>(window.__copilotToolCallRoots||(window.__copilotToolCallRoots=new Map),window.__copilotToolCallRoots),GZ=()=>(window.__copilotErrorBlocks||(window.__copilotErrorBlocks=new Map),window.__copilotErrorBlocks),$_t=(t,e,r)=>{if(e.size>0)return;r.get(t)===e&&r.delete(t)},L_t=(t,e,r,n,o,i)=>{try{n.root.unmount()}catch(a){Be(`Error unmounting tool call root during ${o}`,r,a)}n.isUnmounting=!1,e.get(r)===n&&e.delete(r),$_t(t,e,i)},Cen=(t,e,r,n,o,i)=>{e.delete(r),n.isUnmounting=!0,setTimeout(()=>{try{n.root.unmount()}catch(a){Be(`Error unmounting tool call root during ${o}`,r,a)}n.isUnmounting=!1,$_t(t,e,i)},0)},yB=(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,$_t(t,e,i);return}L_t(t,a,r,s,o,i)},0))},xen=(t,e,r,n,o)=>{let i=e.get(r);return i?.isUnmounting&&(L_t(t,e,r,i,`${o} (finalizing stale root)`,KZ()),i=void 0),i&&i.container&&i.container!==n&&(Cen(t,e,r,i,`${o} (container changed)`,KZ()),i=void 0),i||(i={root:(0,D_t.createRoot)(n),isUnmounting:!1,container:n},e.set(r,i)),i},Oen=(t,e,r,n,o)=>{let i=e.get(r);return i?.isUnmounting&&(L_t(t,e,r,i,`${o} (finalizing stale error root)`,GZ()),i=void 0),i&&i.container&&i.container!==n&&(Cen(t,e,r,i,`${o} (container changed)`,GZ()),i=void 0),i||(i={root:(0,D_t.createRoot)(n),isUnmounting:!1,container:n},e.set(r,i)),i},Ten=(t,e)=>{t.root.render(j_t.default.createElement(wen,{toolName:e.toolName,displayName:e.displayName,emoji:e.emoji,isExecuting:e.isExecuting,result:e.result||null,confirmationMessage:e.confirmationMessage}))},Een=(t,e)=>{t.root.render(j_t.default.createElement(cen,{errorContent:e.errorContent}))},Pen=(t,e,r,n)=>{let o=e.get(r);o&&yB(t,e,r,o,n,KZ())},Men=(t,e,r,n)=>{let o=e.get(r);o&&yB(t,e,r,o,n,GZ())},Ien=t=>{let e=KZ(),r=e.get(t);return r||(r=new Map,e.set(t,r)),r},Ren=t=>{let e=GZ(),r=e.get(t);return r||(r=new Map,e.set(t,r)),r},Aen=(t=Date.now())=>{let e=KZ();e.forEach((r,n)=>{r.forEach((o,i)=>{if(o.container){if(o.container.isConnected)return;yB(n,r,i,o,"stale cleanup (detached container)",e);return}let a=Number.parseInt(n,10);Number.isNaN(a)||t-a<Sen||yB(n,r,i,o,"stale cleanup (legacy record)",e)})})},Nen=(t=Date.now())=>{let e=GZ();e.forEach((r,n)=>{r.forEach((o,i)=>{if(o.container){if(o.container.isConnected)return;yB(n,r,i,o,"stale error cleanup (detached container)",e);return}let a=Number.parseInt(n,10);Number.isNaN(a)||t-a<Sen||yB(n,r,i,o,"stale error cleanup (legacy record)",e)})})},jen=(t,e,r)=>{let n=KZ();e.forEach((o,i)=>{yB(t,e,i,o,r,n)})},Den=(t,e,r)=>{let n=GZ();e.forEach((o,i)=>{yB(t,e,i,o,r,n)})};Or();kn();Tie();Cue();Zt();var _3=require("obsidian"),ur=L(X());ot();var MFe="copilot-collapsible",vmi=()=>(window.__copilotCollapsibleStates||(window.__copilotCollapsibleStates=new Map),window.__copilotCollapsibleStates),$en=t=>{let e=vmi(),r=e.get(t);return r||(r=new Map,e.set(t,r)),r},F_t=(t,e)=>{let r=t.replace(/[^a-zA-Z0-9_-]/g,"_");return`${MFe}-${r}-${e}`},Len=(t,e,r={})=>{let n=r.overwriteExisting??!0;t.querySelectorAll(`details[id^="${MFe}-"]`).forEach(i=>{let a=i.id;a&&(!n&&e.has(a)||e.set(a,i.open))})},IFe=(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(`${MFe}-`)&&e.contains(a))return a}let n=t.target;if(!(n instanceof Element))return null;let o=n.closest(`details[id^="${MFe}-"]`);return o instanceof HTMLElement&&o.tagName==="DETAILS"&&e.contains(o)?o:null},k_t=(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 wmi=/^\d+-\d+$/,Smi=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||!wmi.test(n))return;let[o]=n.split("-");o&&o!==n&&(r.textContent=o)})};function Cmi({context:t}){return!t||!t.notes?.length&&!t.urls?.length&&!t.webTabs?.length&&!t.tags?.length&&!t.folders?.length&&!t.selectedTextContexts?.length?null:ur.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map((e,r)=>ur.default.createElement(pn,{key:`note-${r}-${e.path}`},ur.default.createElement(mn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(BLe,{note:e}))),ur.default.createElement(sn,{className:"tw-max-w-sm tw-break-words"},e.path))),t.urls.map((e,r)=>ur.default.createElement(pn,{key:`url-${r}-${e}`},ur.default.createElement(mn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(zLe,{url:e}))),ur.default.createElement(sn,{className:"tw-max-w-sm tw-break-words"},e))),t.webTabs?.map((e,r)=>ur.default.createElement(pn,{key:`webTab-${r}-${e.url}`},ur.default.createElement(mn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(VLe,{webTab:e}))),ur.default.createElement(sn,{className:"tw-max-w-sm tw-break-words"},e.title?ur.default.createElement("div",{className:"tw-text-left"},ur.default.createElement("div",{className:"tw-font-medium"},e.title),ur.default.createElement("div",null,e.url)):e.url))),t.tags?.map((e,r)=>ur.default.createElement(pn,{key:`tag-${r}-${e}`},ur.default.createElement(mn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(gZr,{tag:e}))),ur.default.createElement(sn,{className:"tw-max-w-sm tw-break-words"},e))),t.folders?.map((e,r)=>ur.default.createElement(pn,{key:`folder-${r}-${e}`},ur.default.createElement(mn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(HLe,{folder:e}))),ur.default.createElement(sn,{className:"tw-max-w-sm tw-break-words"},e))),t.selectedTextContexts?.map((e,r)=>ur.default.createElement(pn,{key:`selectedText-${r}-${e.id}`},ur.default.createElement(mn,{asChild:!0},ur.default.createElement("div",null,ur.default.createElement(yZr,{selectedText:e}))),ur.default.createElement(sn,{className:"tw-max-w-sm tw-break-words"},e.sourceType==="web"?e.url:e.notePath))))}var xmi=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i})=>{let[a,s]=(0,ur.useState)(!1),[u,l]=(0,ur.useState)(!1),c=(0,ur.useRef)(null),d=(0,ur.useRef)(null),f=(0,ur.useRef)(!1),p=(0,ur.useRef)(t.id||(t.timestamp?.epoch?String(t.timestamp.epoch):`temp-${Date.now()}-${Math.random()}`)),m=(0,ur.useRef)(Ien(p.current)),h=(0,ur.useRef)(Ren(p.current)),g=(0,ur.useRef)($en(p.current)).current,b=zr(),_=()=>{if(!navigator.clipboard||!navigator.clipboard.writeText)return;let A=cge(t.message);navigator.clipboard.writeText(A).then(()=>{s(!0),setTimeout(()=>{s(!1)},2e3)})},w=(0,ur.useCallback)(A=>{let k=e.workspace.getActiveFile(),V=k?k.path:"",q=U=>(U=U.replace(/```dataview(\s*(?:\n|$))/g,"```text$1"),U=U.replace(/```dataviewjs(\s*(?:\n|$))/g,"```javascript$1"),U),J=U=>(U=U.replace(/```tasks(\s*(?:\n|$))/g,"```text$1"),U),K=(U,ee,ce,ve)=>{let Oe="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",Je="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",tt="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)",Ke=`<${ee}>`,dt=0;if(r&&U.includes(Ke)){let Nt=new RegExp(`<${ee}>([\\s\\S]*?)<\\/${ee}>`,"g");U=U.replace(Nt,(Tr,st)=>{let Le=`${ee}-${dt}`;dt+=1;let rt=F_t(p.current,Le),Fe=g.get(rt)?" open":"";return`<details id="${rt}"${Fe} style="${Oe}">
|
||
<summary style="${Je}">${ce}</summary>
|
||
<div class="tw-text-muted" style="${tt}">${st.trim()}</div>
|
||
</details>
|
||
|
||
`});let Ne=new RegExp(`<${ee}>([\\s\\S]*)$`);return U=U.replace(Ne,(Tr,st)=>`<div style="${Oe}">
|
||
<div style="${Je}">${ve}</div>
|
||
<div class="tw-text-muted" style="${tt}">${st.trim()}</div>
|
||
</div>`),U}let Pt=new RegExp(`<${ee}>([\\s\\S]*?)<\\/${ee}>`,"g");return U.replace(Pt,(Nt,Ne)=>{let Tr=`${ee}-${dt}`;dt+=1;let st=F_t(p.current,Tr),Le=g.get(st)?" open":"";return`<details id="${st}"${Le} style="${Oe}">
|
||
<summary style="${Je}">${ce}</summary>
|
||
<div class="tw-text-muted" style="${tt}">${Ne.trim()}</div>
|
||
</details>
|
||
|
||
`})},ue=U=>K(U,"think","Thought for a while","Thinking..."),oe=U=>{let ee=Oe=>{let Je=/```(?:xml)?\s*([\s\S]*?<writeToFile>[\s\S]*?<\/writeToFile>[\s\S]*?)\s*```/g;return Oe.replace(Je,(tt,Ke)=>Ke.trim())},ce=Oe=>{if(!r)return Oe;let Je=/```xml\s*([\s\S]*?<writeToFile>[\s\S]*?)$/g;return Oe.replace(Je,(tt,Ke)=>Ke.trim())},ve=ee(U);return ve=ce(ve),K(ve,"writeToFile","Generated new content","Generating changes...")},G=(U,ee,ce)=>U.split(/(```[\s\S]*?```|`[^`]*`)/g).map((Oe,Je)=>Je%2===0?Oe.replace(ee,(tt,Ke)=>{let dt=e.metadataCache.getFirstLinkpathDest(Ke,V);return dt?ce(dt):tt}):Oe).join(""),Y=q(A),ie=J(Y).replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),$=G(ie,/!\[\[(.*?)]]/g,U=>`})`),H=ue($),re=oe(H),D=qUr(re,b.enableInlineCitations),R=G(D,/(?<!!)\[\[([^\]]+)]]/g,U=>`<a href="obsidian://open?file=${encodeURIComponent(U.path)}">${U.basename}</a>`);return(U=>{if(!r)return U;let ee=/!\[([^\]]*)\]\(([^)]+)\)/g;return U.replace(ee,(ce,ve,Oe)=>{let Je=sHe(Oe);if(!Je)return ce;let tt=ve||"YouTube Video",Ke=`https://i.ytimg.com/vi/${Je}/hqdefault.jpg`;return`[](${Oe})`})})(R)},[e,r,b.enableInlineCitations,g]);(0,ur.useEffect)(()=>{let A=c.current;if(!A||t.sender===Ws||!r)return;let k=J=>{if(J instanceof PointerEvent&&(J.button!==0||!J.isPrimary))return;let K=IFe(J,A);if(!K||!k_t(J,K))return;let ue=!K.open;K.open=ue,g.set(K.id,ue)},V=J=>{let K=IFe(J,A);!K||!k_t(J,K)||J.preventDefault()},q=J=>{let K=IFe(J,A);K&&g.set(K.id,K.open)};return A.addEventListener("pointerdown",k,!0),A.addEventListener("click",V,!0),A.addEventListener("toggle",q,!0),()=>{A.removeEventListener("pointerdown",k,!0),A.removeEventListener("click",V,!0),A.removeEventListener("toggle",q,!0)}},[r,t.sender,g]),(0,ur.useEffect)(()=>{if(f.current=!1,c.current&&t.sender!==Ws){d.current||(d.current=new _3.Component),Len(c.current,g,{overwriteExisting:!r});let A=t.message,k=w(A),V=Hot(k,p.current);if(!f.current){let q=new Set,J=new Set;c.current.querySelectorAll('[id^="tool-call-"]').forEach(ie=>{let $=ie.id.replace("tool-call-","");q.add($)}),c.current.querySelectorAll('[id^="error-block-"]').forEach(ie=>{let $=ie.id.replace("error-block-","");J.add($)}),c.current.querySelectorAll(".message-segment").forEach(ie=>ie.remove());let G=0;V.segments.forEach(ie=>{if(ie.type==="text"&&ie.content.trim()){let $=c.current.children[G],H=document.createElement("div");H.className="message-segment",$?c.current.insertBefore(H,$):c.current.appendChild(H),_3.MarkdownRenderer.renderMarkdown(ie.content,H,"",d.current),Smi(H),G++}else if(ie.type==="toolCall"&&ie.toolCall){let $=ie.toolCall.id,H=document.getElementById(`tool-call-${$}`);if(!H){let D=c.current.children[G],R=document.createElement("div");R.className="tool-call-container",R.id=`tool-call-${$}`,D?c.current.insertBefore(R,D):c.current.appendChild(R),H=R}let re=xen(p.current,m.current,$,H,"render refresh");!f.current&&!re.isUnmounting&&Ten(re,ie.toolCall),G++}else if(ie.type==="error"&&ie.error){let $=ie.error.id,H=document.getElementById(`error-block-${$}`);if(!H){let D=c.current.children[G],R=document.createElement("div");R.className="error-block-container",R.id=`error-block-${$}`,D?c.current.insertBefore(R,D):c.current.appendChild(R),H=R}let re=Oen(p.current,h.current,$,H,"error render");!f.current&&!re.isUnmounting&&Een(re,ie.error),G++}});let Y=new Set(V.segments.filter(ie=>ie.type==="toolCall"&&ie.toolCall).map(ie=>ie.toolCall.id));q.forEach(ie=>{if(!Y.has(ie)){let $=document.getElementById(`tool-call-${ie}`);$&&(Pen(p.current,m.current,ie,"tool call removal"),$.remove())}});let se=new Set(V.segments.filter(ie=>ie.type==="error"&&ie.error).map(ie=>ie.error.id));J.forEach(ie=>{if(!se.has(ie)){let $=document.getElementById(`error-block-${ie}`);$&&(Men(p.current,h.current,ie,"error block removal"),$.remove())}})}}return()=>{f.current=!0}},[t,e,d,r,w,g]),(0,ur.useEffect)(()=>{let A=d,k=p.current,V=m.current,q=h.current;return(()=>{Aen(),Nen()})(),()=>{f.current=!0,setTimeout(()=>{A.current&&(A.current.unload(),A.current=null),k.startsWith("temp-")&&(jen(k,V,"component cleanup"),Den(k,q,"component cleanup"))},0)}},[]);let O=()=>{l(!0)},T=()=>{l(!1)},P=A=>{l(!1),o&&o(A)},M=()=>{t.sources&&t.sources.length>0&&new xFe(e,t.sources).open()},I=()=>{let A=e.workspace.getMostRecentLeaf();if((!A||!(A.view instanceof _3.MarkdownView))&&(A=e.workspace.getLeaf(!1),!A||!(A.view instanceof _3.MarkdownView)))return;let V=A.view.editor.getSelection().length>0,q=cge(t.message);Mz(q,V)},j=()=>t.content?ur.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((A,k)=>A.type==="text"?ur.default.createElement("div",{key:k},t.sender===Ws?ur.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):ur.default.createElement("div",{ref:c,className:t.isErrorMessage?"tw-text-error":""})):A.type==="image_url"?ur.default.createElement("div",{key:k,className:"message-image-content"},ur.default.createElement("img",{src:A.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===Ws?ur.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):ur.default.createElement("div",{ref:c,className:t.isErrorMessage?"tw-text-error":""});return u&&t.sender===Ws?ur.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},ur.default.createElement(aen,{initialValue:t.message,initialContext:t.context,onSave:P,onCancel:T,app:e})):ur.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},ur.default.createElement("div",{className:Te("tw-group tw-mx-2 tw-rounded-md tw-p-2",t.sender===Ws&&"tw-border tw-border-solid tw-border-border"),style:t.sender===Ws?{backgroundColor:"var(--background-modifier-hover)"}:void 0},ur.default.createElement("div",{className:"tw-flex tw-max-w-full tw-flex-col tw-gap-2 tw-overflow-hidden"},!u&&ur.default.createElement(Cmi,{context:t.context}),ur.default.createElement("div",{className:"message-content"},j()),t.responseMetadata?.wasTruncated&&t.sender!==Ws&&ur.default.createElement(len,{message:t,app:e}),!r&&ur.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},ur.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),ur.default.createElement(oen,{message:t,onCopy:_,isCopied:a,onInsertIntoEditor:I,onRegenerate:n,onEdit:O,onDelete:i,onShowSources:M,hasSources:!!(t.sources&&t.sources.length>0)})))))},q_t=xmi;to();Or();var U_t=L(X()),RFe=U_t.createContext(void 0),XZ=U_t.createContext(void 0);var ZZ=L(X());function B_t(){let[t,e]=(0,ZZ.useState)(null),r=(0,ZZ.useContext)(XZ);return(0,ZZ.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(Zw.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(Zw.ACTIVE_LEAF_CHANGE,n)}},[r]),t}kn();Aee();var Fen=require("obsidian");function ken(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 qen(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 Fen.TFile&&(r.push(i),r.length>=e))break}return r}_ie();ot();var V_t=require("obsidian"),z_t=20,Uen=.7,AFe=.3;async function Omi(t,e){let r=ae().debug,n=await yR.getDocsByPath(e,t);if(!n)return r&&console.log("No hits found for note:",t),[];let o=[];for(let i of n){if(!i?.document?.embedding){r&&console.log("No embedding found for note:",t);continue}o.push(i.document.embedding)}return o}function Tmi(t,e){let r=new Map;for(let n of t){let o=r.get(n.document.path);o?n.score>o&&r.set(n.document.path,n.score):r.set(n.document.path,n.score)}return r.delete(e),r}async function Emi({db:t,filePath:e}){let r=ae().debug,n=await Omi(e,t);if(n.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let o=n.map(l=>yR.getDocsByEmbedding(t,l,{limit:z_t,similarity:0})),a=(await Promise.all(o)).flat(),s=Tmi(a,e);if(s.size<=z_t)return s;let u=Array.from(s.entries()).sort((l,c)=>c[1]-l[1]).slice(0,z_t);return new Map(u)}function Pmi(t){let e=new Map,n=ken(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=qen(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 Mmi(t,e){let r=new Map,n=Uen+AFe;for(let[o,i]of t)r.set(o,i*Uen/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=AFe:(i.links||i.backlinks)&&(a=AFe*.8),r.set(o,(r.get(o)??0)+a)}return r}async function Ben({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof V_t.TFile))return[];let n=await Emi({db:t,filePath:e}),o=Pmi(r),i=Mmi(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=NFe(n.get(l)??0),f=NFe(n.get(c)??0);return d!==f?f-d:u[1]-s[1]}).map(([s,u])=>{let l=app.vault.getAbstractFileByPath(s);return!(l instanceof V_t.TFile)||l.extension!=="md"?null:{document:{path:s,title:l.basename},metadata:{score:u,similarityScore:n.get(s),hasOutgoingLinks:o.get(s)?.links??!1,hasBacklinks:o.get(s)?.backlinks??!1}}}).filter(s=>s!==null)}function NFe(t){return t>.7?3:t>.55?2:1}Jr();var Hde=require("obsidian"),Dt=L(X());function Imi(t){let[e,r]=(0,Dt.useState)([]),n=B_t();return(0,Dt.useEffect)(()=>{async function o(){if(n?.path)try{let a=await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().getDb();if(!a){r([]);return}let s=await Ben({db:a,filePath:n.path});r(s)}catch(i){console.warn("Failed to fetch relevant notes:",i),r([])}}o()},[n?.path,t]),e}function Rmi(t,e){let[r,n]=(0,Dt.useState)(!0);return(0,Dt.useEffect)(()=>{if(!t)return;async function o(){try{let a=await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().hasIndex(t);n(a)}catch{n(!1)}}o()},[t,e]),r}function Ami({score:t}){let e=NFe(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),Dt.default.createElement("span",{className:"tw-text-sm"},r)}function Nmi({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,Dt.useState)(!1),[i,a]=(0,Dt.useState)(null),s=(0,Dt.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(t.document.path);if(u instanceof Hde.TFile){let l=await app.vault.cachedRead(u),c=l;if(l.startsWith("---")){let d=l.indexOf("---",3);d!==-1&&(c=l.slice(d+3).trim())}a(c.slice(0,1e3)+(c.length>1e3?"...":""))}},[i,t.document.path]);return(0,Dt.useEffect)(()=>{n&&s()},[n,s]),Dt.default.createElement(kb,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},Dt.default.createElement("div",{className:Te("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},Dt.default.createElement(ge,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},Dt.default.createElement(O$,null,Dt.default.createElement(bm,{className:Te("tw-size-4 tw-transition-transform tw-duration-200",{"rotate-90":n})}))),Dt.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-2"},Dt.default.createElement(Ami,{score:t.metadata.similarityScore??0})),Dt.default.createElement("div",{className:"tw-flex-1 tw-overflow-hidden"},Dt.default.createElement("a",{onClick:u=>{u.preventDefault();let l=u.metaKey||u.ctrlKey;r(l)},onAuxClick:u=>{u.button===1&&(u.preventDefault(),r(!0))},className:"tw-block tw-w-full tw-truncate tw-text-sm tw-font-bold tw-text-normal",title:t.document.title},t.document.title)),Dt.default.createElement(pn,null,Dt.default.createElement(mn,{asChild:!0},Dt.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},Dt.default.createElement(Iv,{className:"tw-size-4"}))),Dt.default.createElement(sn,null,"Add to Chat"))),Dt.default.createElement(qb,null,Dt.default.createElement("div",{className:"tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2"},Dt.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&&Dt.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)),Dt.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&&Dt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Dt.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&Dt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Dt.default.createElement(Wte,{className:"tw-size-4"}),Dt.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&Dt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Dt.default.createElement(Jte,{className:"tw-size-4"}),Dt.default.createElement("span",null,"Backlinks")))))}function jmi({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return Dt.default.createElement(LU,{key:t.document.path},Dt.default.createElement(FU,{asChild:!0},n),Dt.default.createElement(r$,{className:"tw-flex tw-w-fit tw-min-w-72 tw-max-w-96 tw-flex-col tw-gap-2 tw-overflow-hidden"},Dt.default.createElement("span",{className:"tw-text-sm tw-text-normal"},t.document.title),Dt.default.createElement("span",{className:"tw-text-xs tw-text-muted"},t.document.path),Dt.default.createElement("div",{className:"tw-flex tw-gap-2"},Dt.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 ",Dt.default.createElement(Iv,{className:"tw-size-4"})),Dt.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 ",Dt.default.createElement($te,{className:"tw-size-4"})))))}var jFe=(0,Dt.memo)(({className:t,defaultOpen:e=!1})=>{let[r,n]=(0,Dt.useState)(0),[o,i]=(0,Dt.useState)(e),a=Imi(r),s=B_t(),u=gB(),l=Rmi(s?.path??"",r),c=(p,m=!1)=>{let h=app.vault.getAbstractFileByPath(p);h instanceof Hde.TFile&&app.workspace.getLeaf(m).openFile(h)},d=p=>{u.insertTextWithPills(`[[${p}]]`,!0)},f=async()=>{s&&(await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().reindexFile(s),new Hde.Notice(`Refreshed index for ${s.basename}`),n(r+1))};return Dt.default.createElement("div",{className:Te("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},Dt.default.createElement(kb,{open:o,onOpenChange:i},Dt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-pb-2 tw-pl-1"},Dt.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Dt.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Relevant Notes"),Dt.default.createElement(xi,{content:"Relevance is a combination of semantic similarity and links.",contentClassName:"tw-w-64",buttonClassName:"tw-size-4 tw-text-muted"}),!l&&Dt.default.createElement(xi,{content:"Note has not been indexed",side:"bottom"},Dt.default.createElement(_m,{className:"tw-size-4 tw-text-warning"}))),Dt.default.createElement("div",{className:"tw-flex tw-items-center"},Dt.default.createElement(pn,null,Dt.default.createElement(mn,{asChild:!0},Dt.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:f},Dt.default.createElement(rre,{className:"tw-size-4"}))),Dt.default.createElement(sn,{side:"bottom"},"Reindex Current Note")),a.length>0&&Dt.default.createElement(O$,{asChild:!0},Dt.default.createElement(ge,{variant:"ghost2",size:"icon"},o?Dt.default.createElement(fb,{className:"tw-size-5"}):Dt.default.createElement(ts,{className:"tw-size-5"}))))),a.length===0&&Dt.default.createElement("div",{className:"tw-flex tw-max-h-12 tw-flex-wrap tw-gap-x-2 tw-gap-y-1 tw-overflow-y-hidden tw-px-1"},Dt.default.createElement("span",{className:"tw-text-xs tw-text-muted"},l?"No relevant notes found":"No index available. Click refresh to build index.")),!o&&a.length>0&&Dt.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(p=>Dt.default.createElement(jmi,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)},Dt.default.createElement(Bh,{variant:"outline",key:p.document.path,className:"tw-max-w-40 tw-text-xs tw-text-muted hover:tw-cursor-pointer hover:tw-bg-interactive-hover"},Dt.default.createElement("span",{className:"tw-truncate"},p.document.title))))),Dt.default.createElement(qb,null,Dt.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(p=>Dt.default.createElement(Nmi,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)}))))))});jFe.displayName="RelevantNotes";qs();Bc();to();var av=L(X());kn();var v3=av.forwardRef(({className:t,...e},r)=>av.createElement("div",{ref:r,className:Te("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));v3.displayName="Card";var w3=av.forwardRef(({className:t,...e},r)=>av.createElement("div",{ref:r,className:Te("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));w3.displayName="CardHeader";var Jde=av.forwardRef(({className:t,...e},r)=>av.createElement("div",{ref:r,className:Te("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));Jde.displayName="CardTitle";var Dmi=av.forwardRef(({className:t,...e},r)=>av.createElement("div",{ref:r,className:Te("tw-text-sm tw-text-muted",t),...e}));Dmi.displayName="CardDescription";var S3=av.forwardRef(({className:t,...e},r)=>av.createElement("div",{ref:r,className:Te("tw-p-6 tw-pt-0",t),...e}));S3.displayName="CardContent";var $mi=av.forwardRef(({className:t,...e},r)=>av.createElement("div",{ref:r,className:Te("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));$mi.displayName="CardFooter";Or();ot();Jr();var Qu=L(X());var H_t={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>]]"]}},zen={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function Lmi(t="llm_chain"){let e=zen[t]||zen.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...H_t[n].prompts].sort(()=>Math.random()-.5)),{title:H_t[n].title,text:r[n].pop()||H_t[n].prompts[0]}))}var Ven=({onClick:t})=>{let[e]=Cv(),r=(0,Qu.useMemo)(()=>Lmi(e),[e]),o=zr().indexVaultToVectorStore;return Qu.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Qu.default.createElement(v3,{className:"tw-w-full tw-bg-transparent"},Qu.default.createElement(w3,{className:"tw-px-2"},Qu.default.createElement(Jde,null,"Suggested Prompts")),Qu.default.createElement(S3,{className:"tw-p-2 tw-pt-0"},Qu.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>Qu.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"},Qu.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},Qu.default.createElement("div",{className:"tw-text-muted"},i.title),Qu.default.createElement("div",null,i.text)),Qu.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Qu.default.createElement(pn,null,Qu.default.createElement(mn,{asChild:!0},Qu.default.createElement(ge,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},Qu.default.createElement(Iv,{className:"tw-size-4"}))),Qu.default.createElement(sn,null,"Add to Chat")))))))),e==="vault_qa"&&Qu.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"&&Qu.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},Qu.default.createElement("div",null,Qu.default.createElement(_m,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",Qu.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",Qu.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",Qu.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};Or();Or();var Ub=L(X()),Hen=({chatHistory:t})=>{let[e,r]=(0,Ub.useState)(0),n=(0,Ub.useRef)(null),o=(0,Ub.useRef)(null),i=(0,Ub.useCallback)((l,c)=>`message-${l.id||l.timestamp?.epoch||c}`,[]),a=(0,Ub.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===Ws).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,Ub.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,Ub.useEffect)(()=>{if(n.current&&t.length>0){let l=a();r(l)}},[t,a]),(0,Ub.useEffect)(()=>()=>{o.current&&o.current.disconnect()},[]);let u=(0,Ub.useCallback)((l="smooth")=>{n.current&&n.current.scrollTo({top:n.current.scrollHeight,behavior:l})},[]);return(0,Ub.useEffect)(()=>{u("instant")},[u]),(0,Ub.useEffect)(()=>{if(t.length>0){let l=t[t.length-1];l&&l.sender===Ws&&u()}},[t.length,t,u]),{containerMinHeight:e,scrollContainerCallbackRef:s,getMessageKey:i}};ot();var qg=L(X()),Jen=(0,qg.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,qg.useState)(""),p=zr(),{containerMinHeight:m,scrollContainerCallbackRef:h,getMessageKey:y}=Hen({chatHistory:t});if((0,qg.useEffect)(()=>{let b;return n?b=setInterval(()=>{f(_=>_.length<6?_+".":"")},200):f(""),()=>clearInterval(b)},[n]),!t.filter(b=>b.isVisible).length&&!e)return qg.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},c&&p.showRelevantNotes&&qg.default.createElement(jFe,{defaultOpen:!0,key:"relevant-notes-before-chat"}),c&&p.showSuggestedPrompts&&qg.default.createElement(Ven,{onClick:l}));let g=()=>o?`${o} ${d}`:d;return qg.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},c&&p.showRelevantNotes&&qg.default.createElement(jFe,{className:"tw-mb-4",defaultOpen:!1,key:"relevant-notes-in-chat"}),qg.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(P=>P.isVisible),T=_===w.length-1&&b.sender!==Ws;return b.isVisible&&qg.default.createElement("div",{key:y(b,_),"data-message-key":y(b,_),className:"tw-w-full",style:{minHeight:T?`${m}px`:"auto"}},qg.default.createElement(q_t,{message:b,app:i,isStreaming:!1,onRegenerate:()=>a(_),onEdit:P=>s(_,P),onDelete:()=>u(_)}))}),(e||n)&&qg.default.createElement("div",{className:"tw-w-full",style:{minHeight:`${m}px`}},qg.default.createElement(q_t,{key:r??"ai_message_streaming",message:{id:r??void 0,sender:"AI",message:e||g(),isVisible:!0,timestamp:null},app:i,isStreaming:!0,onDelete:()=>{}}))))});Jen.displayName="ChatMessages";var Wen=Jen;to();Zt();var DFe=L(X());function $Fe(t){let[e,r]=(0,DFe.useState)(null);(0,DFe.useEffect)(()=>{(async()=>{let i=await DRt();i.version&&r(i.version)})()},[]);let n=e!==null&&fge(e,t);return{latestVersion:e,hasUpdate:n}}kn();ot();Zt();Jr();var j0=L(X());function Ken({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=$Fe(t),n=zr().lastDismissedVersion,[o,i]=(0,j0.useState)(!0),a=r&&e&&fge(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{Ue("lastDismissedVersion",e)},300))};return a?j0.default.createElement("div",{className:Te("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")},j0.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"},j0.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},j0.default.createElement("span",{className:"tw-font-medium"},"Update available:"),j0.default.createElement("a",{href:"https://github.com/logancyang/obsidian-copilot/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"tw-text-normal"},"v",e)),j0.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},j0.default.createElement(ge,{size:"fit",variant:"ghost2",className:"tw-text-accent hover:tw-text-accent-hover",onClick:()=>{window.open("obsidian://show-plugin?id=copilot","_blank"),s()}},"Update"),j0.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:s},j0.default.createElement($o,{className:"tw-size-4"}))))):null}qs();qs();qs();iG();var Gen=require("obsidian");vb();var YZ=class extends Gen.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=yie(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 J_t=require("obsidian");var LFe=require("obsidian");Zt();Bc();var QZ=class extends LFe.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 LFe.TFile&&zW(a,this.chainType)&&!e.includes(a.path)&&a.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(a=>zW(a,this.chainType)).filter(a=>!r.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote&&zW(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 Wde=class extends QZ{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 J_t.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 J_t.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}};Zt();var Xen=require("obsidian"),eY=class extends Xen.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)yO(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};to();var Yde=L(X());Jr();var itn=L(X(),1),Cr=L(X(),1),BFe=(0,Cr.createContext)(null);BFe.displayName="PanelGroupContext";var Lc={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"},Q_t=10,x3=Cr.useLayoutEffect,Zen=itn.useId,Fmi=typeof Zen=="function"?Zen:()=>null,kmi=0;function evt(t=null){let e=Fmi(),r=(0,Cr.useRef)(t||e||null);return r.current===null&&(r.current=""+kmi++),t??r.current}function atn({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,Cr.useContext)(BFe);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:g,expandPanel:b,getPanelSize:_,getPanelStyle:w,groupId:O,isPanelCollapsed:T,reevaluatePanelConstraints:P,registerPanel:M,resizePanel:I,unregisterPanel:j}=y,A=evt(a),k=(0,Cr.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,Cr.useRef)({didLogMissingDefaultSizeWarning:!1}),x3(()=>{let{callbacks:q,constraints:J}=k.current,K={...J};k.current.id=A,k.current.idIsFromProps=a!==void 0,k.current.order=f,q.onCollapse=l,q.onExpand=c,q.onResize=d,J.collapsedSize=r,J.collapsible=n,J.defaultSize=o,J.maxSize=s,J.minSize=u,(K.collapsedSize!==J.collapsedSize||K.collapsible!==J.collapsible||K.maxSize!==J.maxSize||K.minSize!==J.minSize)&&P(k.current,K)}),x3(()=>{let q=k.current;return M(q),()=>{j(q)}},[f,A,M,j]),(0,Cr.useImperativeHandle)(i,()=>({collapse:()=>{g(k.current)},expand:q=>{b(k.current,q)},getId(){return A},getSize(){return _(k.current)},isCollapsed(){return T(k.current)},isExpanded(){return!T(k.current)},resize:q=>{I(k.current,q)}}),[g,b,_,T,A,I]);let V=w(k.current,o);return(0,Cr.createElement)(m,{...h,children:t,className:e,id:A,style:{...V,...p},[Lc.groupId]:O,[Lc.panel]:"",[Lc.panelCollapsible]:n||void 0,[Lc.panelId]:A,[Lc.panelSize]:parseFloat(""+V.flexGrow).toFixed(1)})}var tvt=(0,Cr.forwardRef)((t,e)=>(0,Cr.createElement)(atn,{...t,forwardedRef:e}));atn.displayName="Panel";tvt.displayName="forwardRef(Panel)";var qmi;function Umi(){return qmi}var Y_t=null,Bmi=!0,kFe=-1,T$=null;function zmi(t,e){if(e){let r=(e&dtn)!==0,n=(e&ftn)!==0,o=(e&ptn)!==0,i=(e&mtn)!==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 Vmi(){T$!==null&&(document.head.removeChild(T$),Y_t=null,T$=null,kFe=-1)}function W_t(t,e){var r,n;if(!Bmi)return;let o=zmi(t,e);if(Y_t!==o){if(Y_t=o,T$===null){T$=document.createElement("style");let a=Umi();a&&T$.setAttribute("nonce",a),document.head.appendChild(T$)}if(kFe>=0){var i;(i=T$.sheet)===null||i===void 0||i.removeRule(kFe)}kFe=(r=(n=T$.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function stn(t){return t.type==="keydown"}function utn(t){return t.type.startsWith("pointer")}function ltn(t){return t.type.startsWith("mouse")}function zFe(t){if(utn(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(ltn(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function Hmi(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Jmi(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 Wmi(t,e){if(t===e)throw new Error("Cannot compare node with itself");let r={a:etn(t),b:etn(e)},n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;pi(n,"Stacking order can only be calculated for elements with a common ancestor");let o={a:Qen(Yen(r.a)),b:Qen(Yen(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 Kmi=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Gmi(t){var e;let r=getComputedStyle((e=ctn(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function Xmi(t){let e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||Gmi(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"||Kmi.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function Yen(t){let e=t.length;for(;e--;){let r=t[e];if(pi(r,"Missing node"),Xmi(r))return r}return null}function Qen(t){return t&&Number(getComputedStyle(t).zIndex)||0}function etn(t){let e=[];for(;t;)e.push(t),t=ctn(t);return e}function ctn(t){let{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}var dtn=1,ftn=2,ptn=4,mtn=8,Zmi=Hmi()==="coarse",Hx=[],oY=!1,bB=new Map,VFe=new Map,Xde=new Set;function Ymi(t,e,r,n,o){var i;let{ownerDocument:a}=e,s={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:o},u=(i=bB.get(a))!==null&&i!==void 0?i:0;return bB.set(a,u+1),Xde.add(s),qFe(),function(){var c;VFe.delete(t),Xde.delete(s);let d=(c=bB.get(a))!==null&&c!==void 0?c:1;if(bB.set(a,d-1),qFe(),d===1&&bB.delete(a),Hx.includes(s)){let f=Hx.indexOf(s);f>=0&&Hx.splice(f,1),nvt(),o("up",!0,null)}}}function Qmi(t){let{target:e}=t,{x:r,y:n}=zFe(t);oY=!0,rvt({target:e,x:r,y:n}),qFe(),Hx.length>0&&(UFe("down",t),t.preventDefault(),htn(e)||t.stopImmediatePropagation())}function K_t(t){let{x:e,y:r}=zFe(t);if(oY&&t.buttons===0&&(oY=!1,UFe("up",t)),!oY){let{target:n}=t;rvt({target:n,x:e,y:r})}UFe("move",t),nvt(),Hx.length>0&&t.preventDefault()}function G_t(t){let{target:e}=t,{x:r,y:n}=zFe(t);VFe.clear(),oY=!1,Hx.length>0&&(t.preventDefault(),htn(e)||t.stopImmediatePropagation()),UFe("up",t),rvt({target:e,x:r,y:n}),nvt(),qFe()}function htn(t){let e=t;for(;e;){if(e.hasAttribute(Lc.resizeHandle))return!0;e=e.parentElement}return!1}function rvt({target:t,x:e,y:r}){Hx.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),Xde.forEach(o=>{let{element:i,hitAreaMargins:a}=o,s=i.getBoundingClientRect(),{bottom:u,left:l,right:c,top:d}=s,f=Zmi?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)&&Wmi(n,i)>0){let m=n,h=!1;for(;m&&!m.contains(i);){if(Jmi(m.getBoundingClientRect(),s,!0)){h=!0;break}m=m.parentElement}if(h)return}Hx.push(o)}})}function X_t(t,e){VFe.set(t,e)}function nvt(){let t=!1,e=!1;Hx.forEach(n=>{let{direction:o}=n;o==="horizontal"?t=!0:e=!0});let r=0;VFe.forEach(n=>{r|=n}),t&&e?W_t("intersection",r):t?W_t("horizontal",r):e?W_t("vertical",r):Vmi()}var Z_t=new AbortController;function qFe(){Z_t.abort(),Z_t=new AbortController;let t={capture:!0,signal:Z_t.signal};Xde.size&&(oY?(Hx.length>0&&bB.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",G_t,t),n.addEventListener("pointerleave",K_t,t),n.addEventListener("pointermove",K_t,t))}),bB.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",G_t,t),n.addEventListener("pointercancel",G_t,t)})):bB.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",Qmi,t),n.addEventListener("pointermove",K_t,t))}))}function UFe(t,e){Xde.forEach(r=>{let{setResizeHandlerState:n}=r,o=Hx.includes(r);n(t,o,e)})}function ehi(){let[t,e]=(0,Cr.useState)(0);return(0,Cr.useCallback)(()=>e(r=>r+1),[])}function pi(t,e){if(!t)throw console.error(e),Error(e)}function O3(t,e,r=Q_t){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function E$(t,e,r=Q_t){return O3(t,e,r)===0}function Ew(t,e,r){return O3(t,e,r)===0}function thi(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(!Ew(o,i,r))return!1}return!0}function nY({panelConstraints:t,panelIndex:e,size:r}){let n=t[e];pi(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=n;if(O3(r,s)<0)if(i){let u=(o+s)/2;O3(r,u)<0?r=o:r=s}else r=s;return r=Math.min(a,r),r=parseFloat(r.toFixed(Q_t)),r}function Kde({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:n,prevLayout:o,trigger:i}){if(Ew(t,0))return e;let a=[...e],[s,u]=n;pi(s!=null,"Invalid first pivot index"),pi(u!=null,"Invalid second pivot index");let l=0;if(i==="keyboard"){{let d=t<0?u:s,f=r[d];pi(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(pi(y!=null,`Previous layout not found for panel index ${d}`),Ew(y,p)){let g=h-y;O3(g,Math.abs(t))>0&&(t=t<0?0-g:g)}}}{let d=t<0?s:u,f=r[d];pi(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(pi(y!=null,`Previous layout not found for panel index ${d}`),Ew(y,h)){let g=y-p;O3(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];pi(h!=null,`Previous layout not found for panel index ${f}`);let g=nY({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];pi(m!=null,`Previous layout not found for panel index ${f}`);let h=m-p,y=nY({panelConstraints:r,panelIndex:f,size:h});if(!Ew(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(thi(o,a))return o;{let d=t<0?u:s,f=e[d];pi(f!=null,`Previous layout not found for panel index ${d}`);let p=f+l,m=nY({panelConstraints:r,panelIndex:d,size:p});if(a[d]=m,!Ew(m,p)){let h=p-m,g=t<0?u:s;for(;g>=0&&g<r.length;){let b=a[g];pi(b!=null,`Previous layout not found for panel index ${g}`);let _=b+h,w=nY({panelConstraints:r,panelIndex:g,size:_});if(Ew(b,w)||(h-=w-b,a[g]=w),Ew(h,0))break;t>0?g--:g++}}}let c=a.reduce((d,f)=>f+d,0);return Ew(c,100)?a:o}function rhi({layout:t,panelsArray:e,pivotIndices:r}){let n=0,o=100,i=0,a=0,s=r[0];pi(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 Zde(t,e=document){return Array.from(e.querySelectorAll(`[${Lc.resizeHandleId}][data-panel-group-id="${t}"]`))}function gtn(t,e,r=document){let o=Zde(t,r).findIndex(i=>i.getAttribute(Lc.resizeHandleId)===e);return o??null}function ytn(t,e,r){let n=gtn(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function nhi(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function btn(t,e=document){if(nhi(e)&&e.dataset.panelGroupId==t)return e;let r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function HFe(t,e=document){let r=e.querySelector(`[${Lc.resizeHandleId}="${t}"]`);return r||null}function ohi(t,e,r,n=document){var o,i,a,s;let u=HFe(e,n),l=Zde(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 ihi({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:o,panelGroupElement:i,setLayout:a}){(0,Cr.useRef)({didWarnAboutMissingResizeHandle:!1}),x3(()=>{if(!i)return;let s=Zde(r,i);for(let u=0;u<o.length-1;u++){let{valueMax:l,valueMin:c,valueNow:d}=rhi({layout:n,panelsArray:o,pivotIndices:[u,u+1]}),f=s[u];if(f!=null){let p=o[u];pi(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,Cr.useEffect)(()=>{if(!i)return;let s=e.current;pi(s,"Eager values not found");let{panelDataArray:u}=s,l=btn(r,i);pi(l!=null,`No group found for id "${r}"`);let c=Zde(r,i);pi(c,`No resize handles found for group id "${r}"`);let d=c.map(f=>{let p=f.getAttribute(Lc.resizeHandleId);pi(p,"Resize handle element has no handle id attribute");let[m,h]=ohi(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];pi(_,`No panel data found for index ${b}`);let w=n[b],{collapsedSize:O=0,collapsible:T,minSize:P=0}=_.constraints;if(w!=null&&T){let M=Kde({delta:Ew(w,O)?P-O:O-w,initialLayout:n,panelConstraints:u.map(I=>I.constraints),pivotIndices:ytn(r,p,i),prevLayout:n,trigger:"keyboard"});n!==M&&a(M)}}break}}};return f.addEventListener("keydown",y),()=>{f.removeEventListener("keydown",y)}});return()=>{d.forEach(f=>f())}},[i,t,e,r,n,o,a])}function ttn(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 _tn(t,e){let r=t==="horizontal",{x:n,y:o}=zFe(e);return r?n:o}function ahi(t,e,r,n,o){let i=r==="horizontal",a=HFe(e,o);pi(a,`No resize handle element found for id "${e}"`);let s=a.getAttribute(Lc.groupId);pi(s,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=n,l=_tn(r,t),c=btn(s,o);pi(c,`No group element found for id "${s}"`);let d=c.getBoundingClientRect(),f=i?d.width:d.height;return(l-u)/f*100}function shi(t,e,r,n,o,i){if(stn(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:ahi(t,e,r,n,i)}function uhi({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];pi(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];pi(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 tY(t,e,r){e.forEach((n,o)=>{let i=t[o];pi(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||E$(d,l))&&!E$(n,l)&&p(),f&&(d==null||!E$(d,l))&&E$(n,l)&&f())}})}function FFe(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 lhi({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 chi(t,e=10){let r=null;return(...o)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...o)},e)}}function rtn(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 vtn(t){return`react-resizable-panels:${t}`}function wtn(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 Stn(t,e){try{let r=vtn(t),n=e.getItem(r);if(n){let o=JSON.parse(n);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function dhi(t,e,r){var n,o;let i=(n=Stn(t,r))!==null&&n!==void 0?n:{},a=wtn(e);return(o=i[a])!==null&&o!==void 0?o:null}function fhi(t,e,r,n,o){var i;let a=vtn(t),s=wtn(e),u=(i=Stn(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 ntn({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(!Ew(n,100)&&r.length>0)for(let i=0;i<e.length;i++){let a=r[i];pi(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];pi(a!=null,`No layout data found for index ${i}`);let s=nY({panelConstraints:e,panelIndex:i,size:a});a!=s&&(o+=a-s,r[i]=s)}if(!Ew(o,0))for(let i=0;i<e.length;i++){let a=r[i];pi(a!=null,`No layout data found for index ${i}`);let s=a+o,u=nY({panelConstraints:e,panelIndex:i,size:s});if(a!==u&&(o-=u-a,r[i]=u,Ew(o,0)))break}return r}var phi=100,Gde={getItem:t=>(rtn(Gde),Gde.getItem(t)),setItem:(t,e)=>{rtn(Gde),Gde.setItem(t,e)}},otn={};function Ctn({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:s=null,storage:u=Gde,style:l,tagName:c="div",...d}){let f=evt(i),p=(0,Cr.useRef)(null),[m,h]=(0,Cr.useState)(null),[y,g]=(0,Cr.useState)([]),b=ehi(),_=(0,Cr.useRef)({}),w=(0,Cr.useRef)(new Map),O=(0,Cr.useRef)(0),T=(0,Cr.useRef)({autoSaveId:t,direction:n,dragState:m,id:f,keyboardResizeBy:s,onLayout:a,storage:u}),P=(0,Cr.useRef)({layout:y,panelDataArray:[],panelDataArrayChanged:!1});(0,Cr.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,Cr.useImperativeHandle)(o,()=>({getId:()=>T.current.id,getLayout:()=>{let{layout:$}=P.current;return $},setLayout:$=>{let{onLayout:H}=T.current,{layout:re,panelDataArray:D}=P.current,R=ntn({layout:$,panelConstraints:D.map(z=>z.constraints)});ttn(re,R)||(g(R),P.current.layout=R,H&&H(R),tY(D,R,_.current))}}),[]),x3(()=>{T.current.autoSaveId=t,T.current.direction=n,T.current.dragState=m,T.current.id=f,T.current.onLayout=a,T.current.storage=u}),ihi({committedValuesRef:T,eagerValuesRef:P,groupId:f,layout:y,panelDataArray:P.current.panelDataArray,setLayout:g,panelGroupElement:p.current}),(0,Cr.useEffect)(()=>{let{panelDataArray:$}=P.current;if(t){if(y.length===0||y.length!==$.length)return;let H=otn[t];H==null&&(H=chi(fhi,phi),otn[t]=H);let re=[...$],D=new Map(w.current);H(t,re,D,y,u)}},[t,y,u]),(0,Cr.useEffect)(()=>{});let M=(0,Cr.useCallback)($=>{let{onLayout:H}=T.current,{layout:re,panelDataArray:D}=P.current;if($.constraints.collapsible){let R=D.map(ce=>ce.constraints),{collapsedSize:z=0,panelSize:U,pivotIndices:ee}=C3(D,$,re);if(pi(U!=null,`Panel size not found for panel "${$.id}"`),!E$(U,z)){w.current.set($.id,U);let ve=rY(D,$)===D.length-1?U-z:z-U,Oe=Kde({delta:ve,initialLayout:re,panelConstraints:R,pivotIndices:ee,prevLayout:re,trigger:"imperative-api"});FFe(re,Oe)||(g(Oe),P.current.layout=Oe,H&&H(Oe),tY(D,Oe,_.current))}}},[]),I=(0,Cr.useCallback)(($,H)=>{let{onLayout:re}=T.current,{layout:D,panelDataArray:R}=P.current;if($.constraints.collapsible){let z=R.map(Je=>Je.constraints),{collapsedSize:U=0,panelSize:ee=0,minSize:ce=0,pivotIndices:ve}=C3(R,$,D),Oe=H??ce;if(E$(ee,U)){let Je=w.current.get($.id),tt=Je!=null&&Je>=Oe?Je:Oe,dt=rY(R,$)===R.length-1?ee-tt:tt-ee,Pt=Kde({delta:dt,initialLayout:D,panelConstraints:z,pivotIndices:ve,prevLayout:D,trigger:"imperative-api"});FFe(D,Pt)||(g(Pt),P.current.layout=Pt,re&&re(Pt),tY(R,Pt,_.current))}}},[]),j=(0,Cr.useCallback)($=>{let{layout:H,panelDataArray:re}=P.current,{panelSize:D}=C3(re,$,H);return pi(D!=null,`Panel size not found for panel "${$.id}"`),D},[]),A=(0,Cr.useCallback)(($,H)=>{let{panelDataArray:re}=P.current,D=rY(re,$);return lhi({defaultSize:H,dragState:m,layout:y,panelData:re,panelIndex:D})},[m,y]),k=(0,Cr.useCallback)($=>{let{layout:H,panelDataArray:re}=P.current,{collapsedSize:D=0,collapsible:R,panelSize:z}=C3(re,$,H);return pi(z!=null,`Panel size not found for panel "${$.id}"`),R===!0&&E$(z,D)},[]),V=(0,Cr.useCallback)($=>{let{layout:H,panelDataArray:re}=P.current,{collapsedSize:D=0,collapsible:R,panelSize:z}=C3(re,$,H);return pi(z!=null,`Panel size not found for panel "${$.id}"`),!R||O3(z,D)>0},[]),q=(0,Cr.useCallback)($=>{let{panelDataArray:H}=P.current;H.push($),H.sort((re,D)=>{let R=re.order,z=D.order;return R==null&&z==null?0:R==null?-1:z==null?1:R-z}),P.current.panelDataArrayChanged=!0,b()},[b]);x3(()=>{if(P.current.panelDataArrayChanged){P.current.panelDataArrayChanged=!1;let{autoSaveId:$,onLayout:H,storage:re}=T.current,{layout:D,panelDataArray:R}=P.current,z=null;if($){let ee=dhi($,R,re);ee&&(w.current=new Map(Object.entries(ee.expandToSizes)),z=ee.layout)}z==null&&(z=uhi({panelDataArray:R}));let U=ntn({layout:z,panelConstraints:R.map(ee=>ee.constraints)});ttn(D,U)||(g(U),P.current.layout=U,H&&H(U),tY(R,U,_.current))}}),x3(()=>{let $=P.current;return()=>{$.layout=[]}},[]);let J=(0,Cr.useCallback)($=>{let H=!1,re=p.current;return re&&window.getComputedStyle(re,null).getPropertyValue("direction")==="rtl"&&(H=!0),function(R){R.preventDefault();let z=p.current;if(!z)return()=>null;let{direction:U,dragState:ee,id:ce,keyboardResizeBy:ve,onLayout:Oe}=T.current,{layout:Je,panelDataArray:tt}=P.current,{initialLayout:Ke}=ee??{},dt=ytn(ce,$,z),Pt=shi(R,$,U,ee,ve,z),Nt=U==="horizontal";Nt&&H&&(Pt=-Pt);let Ne=tt.map(Le=>Le.constraints),Tr=Kde({delta:Pt,initialLayout:Ke??Je,panelConstraints:Ne,pivotIndices:dt,prevLayout:Je,trigger:stn(R)?"keyboard":"mouse-or-touch"}),st=!FFe(Je,Tr);(utn(R)||ltn(R))&&O.current!=Pt&&(O.current=Pt,!st&&Pt!==0?Nt?X_t($,Pt<0?dtn:ftn):X_t($,Pt<0?ptn:mtn):X_t($,0)),st&&(g(Tr),P.current.layout=Tr,Oe&&Oe(Tr),tY(tt,Tr,_.current))}},[]),K=(0,Cr.useCallback)(($,H)=>{let{onLayout:re}=T.current,{layout:D,panelDataArray:R}=P.current,z=R.map(Je=>Je.constraints),{panelSize:U,pivotIndices:ee}=C3(R,$,D);pi(U!=null,`Panel size not found for panel "${$.id}"`);let ve=rY(R,$)===R.length-1?U-H:H-U,Oe=Kde({delta:ve,initialLayout:D,panelConstraints:z,pivotIndices:ee,prevLayout:D,trigger:"imperative-api"});FFe(D,Oe)||(g(Oe),P.current.layout=Oe,re&&re(Oe),tY(R,Oe,_.current))},[]),ue=(0,Cr.useCallback)(($,H)=>{let{layout:re,panelDataArray:D}=P.current,{collapsedSize:R=0,collapsible:z}=H,{collapsedSize:U=0,collapsible:ee,maxSize:ce=100,minSize:ve=0}=$.constraints,{panelSize:Oe}=C3(D,$,re);Oe!=null&&(z&&ee&&E$(Oe,R)?E$(R,U)||K($,U):Oe<ve?K($,ve):Oe>ce&&K($,ce))},[K]),oe=(0,Cr.useCallback)(($,H)=>{let{direction:re}=T.current,{layout:D}=P.current;if(!p.current)return;let R=HFe($,p.current);pi(R,`Drag handle element not found for id "${$}"`);let z=_tn(re,H);h({dragHandleId:$,dragHandleRect:R.getBoundingClientRect(),initialCursorPosition:z,initialLayout:D})},[]),G=(0,Cr.useCallback)(()=>{h(null)},[]),Y=(0,Cr.useCallback)($=>{let{panelDataArray:H}=P.current,re=rY(H,$);re>=0&&(H.splice(re,1),delete _.current[$.id],P.current.panelDataArrayChanged=!0,b())},[b]),se=(0,Cr.useMemo)(()=>({collapsePanel:M,direction:n,dragState:m,expandPanel:I,getPanelSize:j,getPanelStyle:A,groupId:f,isPanelCollapsed:k,isPanelExpanded:V,reevaluatePanelConstraints:ue,registerPanel:q,registerResizeHandle:J,resizePanel:K,startDragging:oe,stopDragging:G,unregisterPanel:Y,panelGroupElement:p.current}),[M,m,n,I,j,A,f,k,V,ue,q,J,K,oe,G,Y]),ie={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,Cr.createElement)(BFe.Provider,{value:se},(0,Cr.createElement)(c,{...d,children:e,className:r,id:i,ref:p,style:{...ie,...l},[Lc.group]:"",[Lc.groupDirection]:n,[Lc.groupId]:f}))}var ovt=(0,Cr.forwardRef)((t,e)=>(0,Cr.createElement)(Ctn,{...t,forwardedRef:e}));Ctn.displayName="PanelGroup";ovt.displayName="forwardRef(PanelGroup)";function rY(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function C3(t,e,r){let n=rY(t,e),i=n===t.length-1?[n-1,n]:[n,n+1],a=r[n];return{...e.constraints,panelSize:a,pivotIndices:i}}function mhi({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){(0,Cr.useEffect)(()=>{if(t||r==null||n==null)return;let o=HFe(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(Lc.groupId);pi(s,`No group element found for id "${s}"`);let u=Zde(s,n),l=gtn(s,e,n);pi(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 ivt({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,Cr.useRef)(null),b=(0,Cr.useRef)({onClick:a,onDragging:s,onPointerDown:l,onPointerUp:c});(0,Cr.useEffect)(()=>{b.current.onClick=a,b.current.onDragging=s,b.current.onPointerDown=l,b.current.onPointerUp=c});let _=(0,Cr.useContext)(BFe);if(_===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:w,groupId:O,registerResizeHandle:T,startDragging:P,stopDragging:M,panelGroupElement:I}=_,j=evt(o),[A,k]=(0,Cr.useState)("inactive"),[V,q]=(0,Cr.useState)(!1),[J,K]=(0,Cr.useState)(null),ue=(0,Cr.useRef)({state:A});x3(()=>{ue.current.state=A}),(0,Cr.useEffect)(()=>{if(r)K(null);else{let se=T(j);K(()=>se)}},[r,j,T]);let oe=(h=n?.coarse)!==null&&h!==void 0?h:15,G=(y=n?.fine)!==null&&y!==void 0?y:5;return(0,Cr.useEffect)(()=>{if(r||J==null)return;let se=g.current;pi(se,"Element ref not attached");let ie=!1;return Ymi(j,se,w,{coarse:oe,fine:G},(H,re,D)=>{if(!re){k("inactive");return}switch(H){case"down":{k("drag"),ie=!1,pi(D,'Expected event to be defined for "down" action'),P(j,D);let{onDragging:R,onPointerDown:z}=b.current;R?.(!0),z?.();break}case"move":{let{state:R}=ue.current;ie=!0,R!=="drag"&&k("hover"),pi(D,'Expected event to be defined for "move" action'),J(D);break}case"up":{k("hover"),M();let{onClick:R,onDragging:z,onPointerUp:U}=b.current;z?.(!1),U?.(),ie||R?.();break}}})},[oe,w,r,G,T,j,J,P,M]),mhi({disabled:r,handleId:j,resizeHandler:J,panelGroupElement:I}),(0,Cr.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,[Lc.groupDirection]:w,[Lc.groupId]:O,[Lc.resizeHandle]:"",[Lc.resizeHandleActive]:A==="drag"?"pointer":V?"keyboard":void 0,[Lc.resizeHandleEnabled]:!r,[Lc.resizeHandleId]:j,[Lc.resizeHandleState]:A})}ivt.displayName="PanelResizeHandle";kn();var xtn=({className:t,...e})=>Yde.createElement(ovt,{className:Te("tw-flex tw-size-full data-[panel-group-direction=vertical]:tw-flex-col",t),...e}),avt=tvt,Otn=({withHandle:t,className:e,...r})=>Yde.createElement(ivt,{className:Te("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&&Yde.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"},Yde.createElement(pC,{className:"tw-size-2.5"})));kn();vb();Zt();Jr();var aY=require("obsidian"),Ve=L(X()),Mtn=L(dd());function ghi({extension:t,size:e="tw-size-4"}){let r=t.toLowerCase().replace("*.","");return["jpg","jpeg","png","gif","svg"].includes(r)?Ve.default.createElement(Hte,{className:`tw-text-context-manager-blue ${e}`}):["mp3","wav","ogg"].includes(r)?Ve.default.createElement(Vte,{className:`tw-text-context-manager-purple ${e}`}):["mp4","mov","avi"].includes(r)?Ve.default.createElement(Kte,{className:`tw-text-context-manager-orange ${e}`}):["md","txt","mdx","markdown"].includes(r)?Ve.default.createElement(Ju,{className:`${e}`}):Ve.default.createElement(Ju,{className:`tw-text-faint ${e}`})}var svt=({IconComponent:t,title:e,iconColorClassName:r,onAddClick:n,tooltip:o})=>Ve.default.createElement("div",{className:"tw-mb-3 tw-flex tw-items-center tw-justify-between"},Ve.default.createElement("div",{className:"tw-flex tw-items-center"},Ve.default.createElement(t,{className:`tw-mr-2 tw-size-4 ${r}`}),Ve.default.createElement("h3",{className:`tw-text-sm tw-font-semibold ${r}`},e),o&&Ve.default.createElement(xi,{buttonClassName:"tw-ml-2 tw-size-4 tw-text-muted",content:Ve.default.createElement("div",{className:"tw-max-w-80"},o)})),Ve.default.createElement(ge,{variant:"ghost",size:"fit",className:"tw-text-muted hover:tw-bg-secondary",title:`Add new ${e.toLowerCase()}`,onClick:n},Ve.default.createElement(Iv,{className:`tw-size-4 ${r}`}))),Ttn=({title:t,IconComponent:e,iconColorClassName:r,items:n,activeItem:o,activeSection:i,sectionType:a,renderIcon:s,onItemClick:u,onAddClick:l,onDeleteItem:c,tooltip:d})=>Ve.default.createElement("div",null,Ve.default.createElement(svt,{IconComponent:e,title:t,iconColorClassName:r,onAddClick:l,tooltip:d}),Ve.default.createElement("div",{className:"tw-space-y-1"},n.map(f=>Ve.default.createElement("div",{key:f.id,className:Te("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)},Ve.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center"},s?s(f):Ve.default.createElement(e,{className:`tw-mr-2 tw-size-4 ${r}`}),Ve.default.createElement(tc,{className:"tw-flex-1 tw-text-sm"},f.name)),Ve.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ve.default.createElement("span",{className:"tw-text-xs tw-text-muted group-hover:tw-hidden"},f.count||0),Ve.default.createElement($o,{className:"tw-hidden tw-size-4 tw-shrink-0 tw-text-muted hover:tw-text-warning group-hover:tw-block group-hover:tw-flex-none",onClick:p=>c(p,f)}))))));function yhi(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 Etn={success:"Processed",failed:"Failed",processing:"Processing",notStarted:"Not started"};function bhi({item:t,viewMode:e,loadStatus:r,onDelete:n}){let o=t.id.split(".").pop()||"",i=t.isIgnored?Rv:$o;return Ve.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"},Ve.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},Ve.default.createElement(ghi,{extension:o,size:"tw-size-8"})),Ve.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Ve.default.createElement(tc,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.isIgnored&&Ve.default.createElement("span",{className:"tw-text-sm tw-text-error"}," (Ignored files)"),t.name),t.id&&Ve.default.createElement(tc,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.id)),Ve.default.createElement("div",{className:"tw-ml-auto tw-flex tw-min-w-[24px] tw-items-center tw-justify-end tw-gap-2"},r&&Ve.default.createElement(Bh,{variant:"outline",className:Te("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}`:Etn[r.status]},r.status==="processing"?Ve.default.createElement(du,{className:"tw-size-3 tw-animate-spin"}):r.status==="success"?Ve.default.createElement(uS,{className:"tw-size-3"}):r.status==="failed"?Ve.default.createElement(sS,{className:"tw-size-3"}):Ve.default.createElement("div",{className:"tw-size-2 tw-rounded-full tw-border tw-border-solid tw-border-border"}),Ve.default.createElement("span",{className:"tw-hidden md:tw-inline"},Etn[r.status])),Ve.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 _hi({item:t,onClick:e}){let r,n;switch(t.type){case"tag":r=KL,n="tw-text-context-manager-orange";break;case"folder":r=ah,n="tw-text-context-manager-yellow";break;case"files":r=Ju,n="tw-text-context-manager-blue";break;case"ignoreFiles":r=$o,n="tw-text-context-manager-red";break}return Ve.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)},Ve.default.createElement("div",{className:"tw-mr-2 tw-shrink-0"},Ve.default.createElement(r,{className:`tw-size-6 ${n}`})),Ve.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Ve.default.createElement(tc,{className:"tw-flex-1 tw-text-sm tw-font-medium"},t.type==="tag"&&Ve.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),t.name),Ve.default.createElement(tc,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.count," ",t.count===1?"item":"items")))}function Ptn(t){return"type"in t}function vhi({initialProject:t,onSave:e,onCancel:r,app:n}){let o=aY.Platform.isMobile,[i]=r6(),[a,s]=(0,Ve.useState)(null);(0,Ve.useEffect)(()=>{let z=!0;return(async()=>{let ee=await Yv.getInstance().get(t);z&&s(ee)})(),()=>{z=!1}},[t]);let u=(0,Ve.useMemo)(()=>Uu()?.id===t.id,[t.id]),l=(0,Ve.useMemo)(()=>a?.fileContexts?new Set(Object.entries(a.fileContexts).filter(([,z])=>z?.cacheKey).map(([z])=>z)):new Set,[a]),c=(0,Ve.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,Ve.useMemo)(()=>Xc({inclusions:t?.contextSource.inclusions,exclusions:t?.contextSource.exclusions,isProject:!0}),[t.contextSource]),p=(0,Ve.useMemo)(()=>n.vault.getFiles(),[n.vault]),m=(0,Ve.useCallback)((z,U,ee)=>{let ce=z.filter(dt=>bl(dt,U,ee,!0)),ve=(dt,Pt,Nt,Ne)=>{Pt&&Pt.forEach(Tr=>{let st={[Nt]:[Tr]};bl(dt,st,null,!0)&&!Ne[Tr].some(Le=>Le.id===dt.path)&&Ne[Tr].push({id:dt.path,name:dt.basename})})},Oe={},Je={},tt={},Ke=[];return(U?.tagPatterns??[]).forEach(dt=>{Oe[dt]=[]}),(U?.folderPatterns??[]).forEach(dt=>{Je[dt]=[]}),(U?.extensionPatterns??[]).forEach(dt=>{tt[dt]=[]}),ce.forEach(dt=>{ve(dt,U?.tagPatterns,"tagPatterns",Oe),ve(dt,U?.folderPatterns,"folderPatterns",Je),ve(dt,U?.extensionPatterns,"extensionPatterns",tt),U?.notePatterns&&bl(dt,{notePatterns:U.notePatterns},null,!0)&&!Ke.some(Pt=>Pt.id===dt.path)&&Ke.push({id:dt.path,name:dt.basename})}),{tags:Oe,folders:Je,extensions:tt,notes:Ke}},[]),[h,y]=(0,Ve.useState)(()=>m(p,d,f)),[g,b]=(0,Ve.useState)(()=>{let z=p.filter(U=>f&&bl(U,f,null,!0));return{files:new Set(z)}}),_=(0,Ve.useRef)(h),w=(0,Ve.useRef)(g),[O,T]=(0,Ve.useState)(""),[P,M]=(0,Ve.useState)(null),[I,j]=(0,Ve.useState)(null),A=(0,Ve.useCallback)((z,U)=>{let ee=Object.keys(z.tags),ce=Object.keys(z.folders),ve=Object.keys(z.extensions),Oe=z.notes.map(Je=>{let tt=U.find(Ke=>Ke.path===Je.id);if(tt)return Y8(tt)}).filter(Boolean);return Z8({tagPatterns:ee,folderPatterns:ce,extensionPatterns:ve,notePatterns:Oe})},[]),k=(0,Ve.useCallback)(z=>{let U=new Array(...z.files).map(ee=>Y8(ee));return Z8({notePatterns:U})||""},[]);(0,Ve.useEffect)(()=>{_.current=h,w.current=g},[h,g]);let V=(0,Ve.useMemo)(()=>{let z=[],U=(ce,ve)=>{ve.forEach(Oe=>{ce.some(Je=>Je.id===Oe.id)||ce.push({id:Oe.id,name:Oe.name})})};return[h.tags,h.folders,h.extensions,{notes:h.notes}].forEach(ce=>{Object.values(ce).forEach(ve=>{U(z,ve)})}),z},[h]),q=(0,Ve.useCallback)(z=>{let U=[],ee=[],ce=[];return z.split(",").map(Oe=>Oe.trim()).filter(Oe=>Oe).forEach(Oe=>{Oe.startsWith("#")?U.push(Oe.substring(1)):Oe.startsWith(".")||Oe.startsWith("*.")?ce.push(Oe.replace("*","")):ee.push(Oe)}),{tags:U,titles:ee,extensions:ce}},[]),J=(0,Ve.useCallback)(z=>[...z].sort((U,ee)=>U.name.toLowerCase().localeCompare(ee.name.toLowerCase())),[]),K=(0,Ve.useMemo)(()=>{if(O){let z=q(O);return V.filter(U=>{let ee=p.find(Ke=>Ke.path===U.id);if(!ee)return!1;let ce=ee.extension==="md",ve=z.tags.length>0&&ce&&z.tags.some(Ke=>yO(ee).some(Pt=>(Pt.startsWith("#")?Pt.substring(1):Pt).toLowerCase().includes(Ke.toLowerCase()))),Oe=z.titles.length>0&&z.titles.some(Ke=>ee.basename.toLowerCase().includes(Ke.toLowerCase())),Je=z.extensions.length>0&&z.extensions.some(Ke=>`.${ee.extension}`.toLowerCase()===Ke.toLowerCase());return z.tags.length>0||z.titles.length>0||z.extensions.length>0?ve||Oe||Je:!1}).map(U=>({id:U.id,name:U.name}))}if(P==="tags"&&I){let z=h.tags[I];return z||[]}if(P==="folders"&&I){let z=h.folders[I];return z||[]}if(P==="files")return h.notes;if(P==="extensions"&&I){let z=h.extensions[I];return z||[]}if(P==="ignoreFiles")return Array.from(g.files).map(z=>({id:z.path,name:z.basename}));if(!P){let z=J(Object.entries(h.tags).map(([ve,Oe])=>({id:`tag:${ve}`,name:ve.slice(1),type:"tag",originalId:ve,count:Oe.length}))),U=J(Object.entries(h.folders).map(([ve,Oe])=>({id:`folder:${ve}`,name:ve,type:"folder",originalId:ve,count:Oe.length}))),ee=h.notes.length>0?[{id:"files:all",name:"Files",type:"files",count:h.notes.length}]:[],ce=g.files.size>0?[{id:"ignoreFiles:all",name:"Ignore Files",type:"ignoreFiles",count:g.files.size}]:[];return[...z,...U,...ee,...ce]}return[]},[O,P,I,q,V,p,h.tags,h.folders,h.notes,h.extensions,g.files,J]),ue=(0,Ve.useCallback)((z,U)=>Object.entries(z).sort(([ee],[ce])=>ee.localeCompare(ce)).map(([ee,ce])=>({id:ee,name:U?U(ee):ee,count:ce.length})),[]),oe=(0,Ve.useCallback)((z,U,ee)=>{let ce=Je=>p.filter(tt=>bl(tt,Je,null,!0)).map(tt=>({id:tt.path,name:tt.basename})),ve=[...w.current.files],Oe=ce(ee).map(Je=>({...Je,isIgnored:ve.some(tt=>tt.path===Je.id)}));y(Je=>({...Je,[z]:{...Je[z],[U]:Oe}}))},[p]),G=(0,Ve.useCallback)((z,U)=>{let ee={tags:{...z.tags},folders:{...z.folders},extensions:{...z.extensions},notes:[...z.notes]},ce=ve=>{Object.keys(ve).forEach(Oe=>{ve[Oe]=ve[Oe].filter(Je=>Je.id!==U)})};return ce(ee.tags),ce(ee.folders),ce(ee.extensions),ee.notes=ee.notes.filter(ve=>ve.id!==U),ee},[]),Y=(0,Ve.useCallback)((z,U=null,ee=!0)=>{M(z),j(U),ee&&T("")},[]),se=(0,Ve.useMemo)(()=>{let z=U=>(ee,ce)=>{ee.stopPropagation(),y(ve=>{let Oe={...ve[U]};return delete Oe[ce.id],{...ve,[U]:Oe}})};return{delete:{tag:z("tags"),folder:z("folders"),extension:z("extensions")},add:{tag:()=>{new eY(n,U=>{let ee=bie(U);oe("tags",ee,{tagPatterns:[ee]})}).open()},folder:()=>{new YZ(n,U=>{oe("folders",U,{folderPatterns:[U]})}).open()},file:()=>{new Wde({app:n,onFileSelect:U=>{h.notes.find(ce=>ce.id===U.path)||(b(ce=>{let ve=new Set(ce.files);return ve.delete(U),{...ce,files:ve}}),y(ce=>({...ce,notes:[...ce.notes,{id:U.path,name:U.basename}]})))},excludeFilePaths:[],titleOnly:!1}).open()},extension:()=>{new aY.Notice("Adding extension is temporarily not supported.")},ignoreFile:()=>{new Wde({app:n,onFileSelect:U=>{g.files.has(U)||(b(ce=>{let ve=new Set(ce.files);return ve.add(U),{...ce,files:ve}}),y(ce=>G(ce,U.path)))},excludeFilePaths:[],titleOnly:!1}).open()}},click:{tag:U=>{Y("tags",U)},folder:U=>{Y("folders",U)},extension:U=>{Y("extensions",U)},files:()=>{Y("files")},ignoreFiles:()=>{Y("ignoreFiles")}}}},[n,h.notes,g.files,oe,G,Y]),ie=(0,Ve.useCallback)(z=>{z.type==="tag"&&z.originalId?se.click.tag(z.originalId):z.type==="folder"&&z.originalId?se.click.folder(z.originalId):z.type==="files"?se.click.files():z.type==="ignoreFiles"&&se.click.ignoreFiles()},[se]),$=()=>O?`Search Results for: "${O}"`:P==="tags"&&I?`Tag: ${I}`:P==="folders"&&I?`Folder: ${I}`:P==="files"?"Files":P==="extensions"&&I?`Extension: ${I}`:P==="ignoreFiles"?"Ignore Files":"All Categories",H=(z,U)=>{z.stopPropagation();let ee=p.find(ce=>ce.path===U.id);ee&&(b(ce=>{let ve=new Set(ce.files);return ve.add(ee),{...ce,files:ve}}),y(ce=>G(ce,U.id)))},re=(0,Ve.useCallback)(()=>{let z=A(_.current,p),U=k(w.current),{inclusions:ee,exclusions:ce}=Xc({inclusions:z,exclusions:U,isProject:!0}),ve=m(p,ee,ce);y(ve)},[p,k,A,m]),D=(z,U)=>{z.stopPropagation();let ee=p.find(ce=>ce.path===U.id);ee&&(b(ce=>{let ve=new Set(ce.files);return ve.delete(ee),{...ce,files:ve}}),re())},R=()=>{let z=A(h,p),U=k(g);e({...t,contextSource:{...t.contextSource,inclusions:z,exclusions:U}})};return Ve.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ve.default.createElement(xtn,{direction:"horizontal",className:"tw-flex-1"},Ve.default.createElement(avt,{defaultSize:o?35:30,minSize:20,maxSize:40},Ve.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ve.default.createElement("div",{className:"tw-border-b tw-p-4"},Ve.default.createElement("h2",{className:"tw-text-lg tw-font-semibold"},"File Context")),Ve.default.createElement(BU,{className:"tw-max-h-[500px] tw-flex-1"},Ve.default.createElement("div",{className:"tw-space-y-6 tw-p-4"},Ve.default.createElement(Ttn,{title:"Tags",IconComponent:KL,iconColorClassName:"tw-text-context-manager-orange",items:ue(h.tags,z=>z.slice(1)),activeItem:I,activeSection:P,sectionType:"tags",renderIcon:z=>Ve.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),onItemClick:se.click.tag,onAddClick:se.add.tag,onDeleteItem:(z,U)=>se.delete.tag(z,U),tooltip:"must be in note property"}),Ve.default.createElement(Px,null),Ve.default.createElement(Ttn,{title:"Folders",IconComponent:ah,iconColorClassName:"tw-text-context-manager-yellow",items:ue(h.folders),activeItem:I,activeSection:P,sectionType:"folders",onItemClick:se.click.folder,onAddClick:se.add.folder,onDeleteItem:(z,U)=>se.delete.folder(z,U)}),Ve.default.createElement(Px,null),Ve.default.createElement("div",null,Ve.default.createElement(svt,{IconComponent:Ju,title:"Files",iconColorClassName:"tw-text-context-manager-blue",onAddClick:se.add.file}),Ve.default.createElement("div",{className:Te("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",P==="files"&&"tw-bg-secondary tw-text-normal"),onClick:se.click.files},"Files (",h.notes.length,")")),Ve.default.createElement(Px,null),Ve.default.createElement("div",null,Ve.default.createElement(svt,{IconComponent:$o,title:"Ignore Files",iconColorClassName:"tw-text-context-manager-red",onAddClick:se.add.ignoreFile}),Ve.default.createElement("div",{className:Te("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",P==="ignoreFiles"&&"tw-bg-secondary tw-text-normal"),onClick:se.click.ignoreFiles},"Files (",g.files.size,")")))))),Ve.default.createElement(Otn,{withHandle:!0}),Ve.default.createElement(avt,{defaultSize:o?65:70},Ve.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ve.default.createElement("div",{className:"tw-border-b tw-p-4"},Ve.default.createElement(XX,{placeholder:"Custom search: title, #tag1, .jpg",value:O,onChange:z=>{T(z),z&&Y("search",null,!1)}})),Ve.default.createElement("div",{className:"tw-p-4"},Ve.default.createElement("h3",{className:"tw-text-lg tw-font-medium tw-text-muted"},$())),Ve.default.createElement(BU,{className:"tw-max-h-[400px] tw-flex-1 tw-p-4 tw-pt-0"},K.length===0?Ve.default.createElement("div",{className:"tw-mt-10 tw-text-center tw-text-muted"},P?"No items found.":"No categories found. Add tags, folders, or files using the sidebar."):Ve.default.createElement("div",{className:"tw-space-y-2",style:{display:"block"}},P||O?J(K).map(z=>Ptn(z)?null:Ve.default.createElement(bhi,{key:z.id,item:z,viewMode:"list",loadStatus:P==="ignoreFiles"||z.isIgnored?void 0:yhi(z.id,c),onDelete:P==="ignoreFiles"||z.isIgnored?D:H})).filter(Boolean):K.map(z=>Ptn(z)?Ve.default.createElement(_hi,{key:z.id,item:z,onClick:ie}):null).filter(Boolean)))))),Ve.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2 tw-border-t tw-p-1"},Ve.default.createElement(ge,{variant:"ghost",onClick:r},"Cancel"),Ve.default.createElement(ge,{onClick:R},"Save")))}var iY=class extends aY.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r,modalEl:n}=this;this.root=(0,Mtn.createRoot)(r),n.style.minWidth="50vw";let o=a=>{this.onSave(a),this.close()},i=()=>{this.close()};this.root.render(Ve.default.createElement(vhi,{initialProject:this.initialProject,onSave:o,onCancel:i,app:this.app}))}onClose(){this.root&&this.root.unmount()}};to();var _B=L(X());kn();function Qde({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a,suffix:s}){let[u,l]=(0,_B.useState)(t);return(0,_B.useEffect)(()=>{l(t)},[t]),_B.default.createElement("div",{className:Te("tw-flex tw-items-center tw-gap-4",a)},_B.default.createElement(Zce,{value:[u],onValueChange:([c])=>l(c),onValueCommit:([c])=>e?.(c),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),_B.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))}Or();vb();ot();Zt();var efe=require("obsidian"),gn=L(X()),Itn=L(dd());function whi({initialProject:t,onSave:e,onCancel:r}){let n=zr(),[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:$Rt(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:ub.TEMPERATURE,maxTokens:ub.MAX_TOKENS},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=O_(u.contextSource.inclusions||u.contextSource.exclusions||"nothing").reverse().join(","),d=h=>{let y=h;if(t?.id){let b=Uu();b?.id===h.id&&(y=b)}new iY(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("."),O=g[b];if(typeof O=="object"&&O!==null)return{...g,[b]:{...O,[_]: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 efe.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(g){new efe.Notice(Sn(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(qo,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},gn.default.createElement(Zo,{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(qo,{label:"Description",description:"Briefly describe the purpose and goals of the project"},gn.default.createElement(Zo,{type:"text",value:u.description,onChange:h=>p("description",h.target.value),className:"tw-w-full"})),gn.default.createElement(qo,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},gn.default.createElement(bw,{value:u.systemPrompt,onChange:h=>p("systemPrompt",h.target.value),onBlur:()=>s(h=>({...h,systemPrompt:!0})),className:"tw-min-h-32"})),gn.default.createElement(qo,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},gn.default.createElement(wA,{value:u.projectModelKey,onChange:h=>{let y=h.target.value,g=n.activeModels.find(w=>w.enabled&&oo(w)===y);if(!g)return;let{hasApiKey:b,errorNotice:_}=HW(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:cX(h),value:oo(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(qo,{label:"Temperature"},gn.default.createElement(Qde,{value:u.modelConfigs?.temperature??ub.TEMPERATURE,onChange:h=>p("modelConfigs.temperature",h),min:0,max:2,step:.01,className:"tw-w-full"})),gn.default.createElement(qo,{label:"Token Limit"},gn.default.createElement(Qde,{value:u.modelConfigs?.maxTokens??ub.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(qo,{label:gn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},gn.default.createElement("span",null,"File Context"),gn.default.createElement(xi,{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(tc,{className:"tw-max-w-[100px] tw-text-sm tw-text-accent"},c)),gn.default.createElement(ge,{variant:"secondary",onClick:()=>{d(u)}},"Manage Context"))),gn.default.createElement(qo,{label:"Web URLs"},gn.default.createElement(bw,{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(qo,{label:"YouTube URLs"},gn.default.createElement(bw,{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(ge,{variant:"ghost",onClick:r,disabled:o},"Cancel"),gn.default.createElement(ge,{onClick:m,disabled:o||!f()},o?"Saving...":"Save")))}var tfe=class extends efe.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,Itn.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(gn.default.createElement(whi,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};to();kn();_t();ot();lN();Jr();var Atn=require("obsidian"),et=L(X());function Shi(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 Rtn(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>Shi(n,e,r)):t}function Chi(t){let[e,r]=(0,et.useState)(()=>t?.getRevision()??0);return(0,et.useEffect)(()=>{if(!t){r(0);return}return r(t.getRevision()),t.subscribe(()=>{r(t.getRevision())})},[t]),e}function xhi({project:t,loadContext:e,onEdit:r,onDelete:n}){return et.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)},et.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},et.default.createElement("div",{className:"tw-text-accent"},et.default.createElement(ah,{className:"tw-size-4"})),et.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},et.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&et.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),et.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},et.default.createElement(pn,null,et.default.createElement(mn,{asChild:!0},et.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},et.default.createElement(pb,{className:"tw-size-4"}))),et.default.createElement(sn,{side:"bottom"},"Edit Project")),et.default.createElement(pn,null,et.default.createElement(mn,{asChild:!0},et.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},et.default.createElement(k6,{className:"tw-size-4"}))),et.default.createElement(sn,{side:"bottom"},"Start Chat")),et.default.createElement(pn,null,et.default.createElement(mn,{asChild:!0},et.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new vl(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},et.default.createElement(ly,{className:"tw-size-4"}))),et.default.createElement(sn,{side:"bottom"},"Delete Project"))))}var uvt=(0,et.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,et.useState)(r),[p,m]=(0,et.useState)(!1),[h,y]=(0,et.useState)(null),[g,b]=(0,et.useState)(""),_=gB(),w=zr(),O=o?.projectManager?.getProjectUsageTimestampsManager?.(),T=Chi(O);(0,et.useEffect)(()=>{s&&f(!1)},[s]);let P=(0,et.useMemo)(()=>mO(e,w.projectListSortStrategy,{getName:q=>q.name,getCreatedAtMs:q=>q.created,getLastUsedAtMs:q=>O?O.getEffectiveLastUsedAt(q.id,q.UsageTimestamps):q.UsageTimestamps}),[e,w.projectListSortStrategy,O,T]),M=(0,et.useMemo)(()=>Rtn(P,g),[P,g]),I=()=>{new tfe(n,async J=>{i(J)}).open()},j=q=>{new tfe(n,async K=>{a(q,K),h&&h.name===q.name&&y(K)},q).open()},A=q=>{let K=(e||[]).filter(ue=>ue.name!==q.name);h?.name===q.name&&k(!1),Ue("projectList",K),new Atn.Notice(`Project "${q.name}" deleted successfully`)},k=(q,J)=>{if(q){if(!J){ne("Must be exist one project.");return}y(J),m(!0),f(!1)}else{y(null),m(!1),f(!0),u(!1),Fz(null);return}},V=q=>{y(q),m(!0),f(!1),u(!0),Fz(q),setTimeout(()=>{_.focusInput()},0)};return et.default.createElement("div",{className:Te("tw-flex tw-flex-col",t)},et.default.createElement("div",{className:"tw-overflow-y-auto"},et.default.createElement("div",{className:"tw-flex tw-flex-col"},p&&h?et.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},et.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},et.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),et.default.createElement(KJ,{value:h.name,onValueChange:q=>{let J=P.find(K=>K.name===q);J&&V(J)}},et.default.createElement(HU,{className:"tw-truncate"},et.default.createElement(GJ,null,et.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},et.default.createElement(ah,{className:"tw-size-4 tw-shrink-0 tw-text-accent/70"}),et.default.createElement("span",{className:"tw-flex-1 tw-truncate"},h.name)))),et.default.createElement(JU,{className:"tw-truncate"},P.map(q=>et.default.createElement(WU,{key:q.name,value:q.name,className:"tw-flex tw-items-center tw-gap-2"},et.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},et.default.createElement(ah,{className:"tw-size-4 tw-shrink-0"}),et.default.createElement("span",{className:"tw-truncate"},q.name))))))),et.default.createElement("div",{className:"tw-ml-1 tw-flex tw-items-center tw-gap-2"},et.default.createElement(ge,{variant:"secondary",onClick:()=>j(h),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},et.default.createElement(pb,{className:"tw-mr-1 tw-size-4"}),"Edit"),et.default.createElement(pn,null,et.default.createElement(mn,{asChild:!0},et.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:()=>{k(!1),c()},"aria-label":"Close Current Project"},et.default.createElement($o,{className:"tw-size-4"}))),et.default.createElement(sn,{side:"bottom"},"Close Current Project")))):et.default.createElement(kb,{open:d,onOpenChange:f,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},et.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},et.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},et.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),et.default.createElement(xi,{content:"Manage your projects with different contexts and configurations.",contentClassName:"tw-w-64",buttonClassName:"tw-size-4 tw-text-muted"})),et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},et.default.createElement(ge,{className:"tw-px-2",variant:"secondary",onClick:I},"Create",et.default.createElement(Rv,{className:"tw-size-3"})),e.length>0&&et.default.createElement(O$,{asChild:!0},et.default.createElement(ge,{variant:"ghost2",size:"icon"},d?et.default.createElement(fb,{className:"tw-size-5"}):et.default.createElement(ts,{className:"tw-size-5"}))),et.default.createElement(pn,null,et.default.createElement(mn,{asChild:!0},et.default.createElement(ge,{variant:"ghost2",size:"icon",onClick:()=>l(),"aria-label":"close project mode"},et.default.createElement($o,{className:"tw-size-4"}))),et.default.createElement(sn,{side:"bottom"},"Close Project Mode")))),e.length===0&&et.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),et.default.createElement(qb,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},et.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&et.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},et.default.createElement(XX,{value:g,onChange:b,placeholder:"Search projects..."})),et.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},et.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"},M.map(q=>et.default.createElement(xhi,{key:q.name,project:q,loadContext:V,onEdit:j,onDelete:A}))),g.trim()&&M.length===0&&et.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},et.default.createElement(r4,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),et.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),et.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&et.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&&et.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"},et.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},et.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),et.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},et.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},et.default.createElement(k6,{className:"tw-size-4"}),et.default.createElement("span",null,"Click a project card to start chatting")))))))});uvt.displayName="ProjectList";var _n=L(X()),hvt=L(X());var rfe=L(X());var cvt=L(X(),1);var P$=L(X(),1),Ntn=L(vr(),1);function jtn(t,e=[]){let r=[];function n(i,a){let s=P$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=P$.useMemo(()=>m,Object.values(m));return(0,Ntn.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=P$.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>P$.createContext(a));return function(s){let u=s?.[t]||i;return P$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Ohi(o,...e)]}function Ohi(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return P$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var Dtn=L(X(),1),Thi=L(cu(),1);Vu();var $tn=L(vr(),1),Ehi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lvt=Ehi.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=Dtn.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,$tn.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var JFe=L(vr(),1),dvt="Progress",fvt=100,[Phi,J4s]=jtn(dvt),[Mhi,Ihi]=Phi(dvt),ktn=cvt.forwardRef((t,e)=>{let{__scopeProgress:r,value:n=null,max:o,getValueLabel:i=Rhi,...a}=t;(o||o===0)&&!Ltn(o)&&console.error(Ahi(`${o}`,"Progress"));let s=Ltn(o)?o:fvt;n!==null&&!Ftn(n,s)&&console.error(Nhi(`${n}`,"Progress"));let u=Ftn(n,s)?n:null,l=WFe(u)?i(u,s):void 0;return(0,JFe.jsx)(Mhi,{scope:r,value:u,max:s,children:(0,JFe.jsx)(lvt.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":WFe(u)?u:void 0,"aria-valuetext":l,role:"progressbar","data-state":Btn(u,s),"data-value":u??void 0,"data-max":s,...a,ref:e})})});ktn.displayName=dvt;var qtn="ProgressIndicator",Utn=cvt.forwardRef((t,e)=>{let{__scopeProgress:r,...n}=t,o=Ihi(qtn,r);return(0,JFe.jsx)(lvt.div,{"data-state":Btn(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...n,ref:e})});Utn.displayName=qtn;function Rhi(t,e){return`${Math.round(t/e*100)}%`}function Btn(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function WFe(t){return typeof t=="number"}function Ltn(t){return WFe(t)&&!isNaN(t)&&t>0}function Ftn(t,e){return WFe(t)&&!isNaN(t)&&t<=e&&t>=0}function Ahi(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${fvt}\`.`}function Nhi(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 ${fvt} if no \`max\` prop is set)
|
||
- \`null\` or \`undefined\` if the progress is indeterminate.
|
||
|
||
Defaulting to \`null\`.`}var pvt=ktn,ztn=Utn;kn();var mvt=rfe.forwardRef(({className:t,value:e,...r},n)=>rfe.createElement(pvt,{ref:n,className:Te("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},rfe.createElement(ztn,{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)}%)`}})));mvt.displayName=pvt.displayName;Jr();qs();to();_t();function gvt({plugin:t,setHiddenCard:e,onEditContext:r}){let[n]=r6(),o=n.total,i=n.success,a=n.failed,s=n.processingFiles,[u,l]=(0,hvt.useState)(!1),[c,d]=(0,hvt.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){ne("ProjectManager not available");return}try{await t.projectManager.retryFailedItem(y)}catch(g){ne(`Error retrying failed item: ${g}`)}};return _n.createElement(v3,{className:"tw-w-full tw-border tw-border-solid tw-border-border tw-bg-transparent tw-shadow-none"},_n.createElement(w3,null,_n.createElement(Jde,{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},_n.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},_n.createElement(Ju,{className:"tw-size-5"}),"Context Loading",_n.createElement(ge,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Edit Context",onClick:()=>r?.()},_n.createElement(bm,{className:"tw-size-4"}),_n.createElement("span",{className:"tw-sr-only"},"Edit Context"))),_n.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-rounded tw-p-1"},_n.createElement(ge,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Close Progress Bar",onClick:()=>e(!0)},_n.createElement($o,{className:"tw-size-4"}))))),_n.createElement(S3,{className:"tw-space-y-6"},_n.createElement("div",{className:"tw-space-y-2"},_n.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-text-sm"},_n.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},_n.createElement("span",{className:"tw-text-muted"},"Total progress"),_n.createElement("span",{className:"tw-text-xs tw-text-muted"},"(Success:"," ",_n.createElement("span",{className:"tw-font-medium tw-text-success"},i.length),", Failed: ",_n.createElement("span",{className:"tw-font-medium tw-text-error"},a.length),")")),_n.createElement("span",{className:"tw-font-medium"},f,"/",o.length," (",p,"%)")),_n.createElement(mvt,{value:p,className:"tw-h-2"})),s.length>0&&_n.createElement("div",{className:"tw-space-y-3"},_n.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)},_n.createElement(du,{className:"tw-size-4 tw-animate-spin tw-text-accent"}),_n.createElement("span",{className:"tw-text-sm tw-font-medium"},"Processing"),u?_n.createElement(ts,{className:"tw-ml-auto tw-size-4"}):_n.createElement(bm,{className:"tw-ml-auto tw-size-4"})),u&&_n.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},s.map((y,g)=>_n.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"},_n.createElement("div",{className:"tw-size-2 tw-animate-pulse tw-rounded-full tw-bg-interactive-accent"}),_n.createElement(tc,{className:"tw-flex-1",title:y},y))))),a.length>0&&_n.createElement("div",{className:"tw-space-y-3"},_n.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},_n.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)},_n.createElement(sS,{className:"tw-size-4 tw-text-error"}),_n.createElement("span",{className:"tw-text-sm tw-font-medium"},"Failed"),_n.createElement(Bh,{variant:"destructive",className:"tw-text-xs"},a.length," files"),c?_n.createElement(ts,{className:"tw-ml-auto tw-size-4"}):_n.createElement(bm,{className:"tw-ml-auto tw-size-4"}))),c&&_n.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},a.map((y,g)=>_n.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"},_n.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col tw-gap-1"},_n.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},_n.createElement("div",{className:"tw-size-2 tw-rounded-full tw-bg-error/80"}),_n.createElement(tc,{className:"tw-flex-1 tw-font-bold",title:y.path},m(y))),_n.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},_n.createElement("div",{className:"tw-size-2 tw-rounded-full"}),y.error&&_n.createElement(tc,{className:"tw-flex-1 tw-text-xs tw-text-error/80",title:y.error},_n.createElement("span",{className:"tw-text-sm tw-text-error"},"Loading Error: "),y.error))),_n.createElement(ge,{size:"sm",variant:"ghost",className:"tw-size-5 tw-p-0",title:`Retry ${y.type} item`,onClick:async b=>{b.stopPropagation(),await h(y)}},_n.createElement(t4,{className:"tw-size-3"}))))))))}Or();var By=L(X());function Vtn(t){let[e,r]=(0,By.useState)([]);(0,By.useEffect)(()=>(r([...t.getMessages()]),t.subscribe(()=>{r([...t.getMessages()])})),[t]);let n=(0,By.useCallback)(async(m,h,y,g=!1,b=!1)=>await t.sendMessage(m,h,y,g,b),[t]),o=(0,By.useCallback)(async(m,h,y,g=!1)=>await t.editMessage(m,h,y,g),[t]),i=(0,By.useCallback)(async(m,h,y)=>await t.regenerateMessage(m,h,y),[t]),a=(0,By.useCallback)(async m=>await t.deleteMessage(m),[t]),s=(0,By.useCallback)(()=>{t.clearMessages()},[t]),u=(0,By.useCallback)(async m=>{await t.truncateAfterMessageId(m)},[t]),l=(0,By.useCallback)(m=>{t.addMessage(m)},[t]),c=(0,By.useCallback)(m=>{t.loadMessages(m)},[t]),d=(0,By.useCallback)(m=>t.getMessage(m),[t]),f=(0,By.useCallback)(()=>t.getLLMMessages(),[t]),p=(0,By.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}}Zt();var T3=require("obsidian"),KFe=L(X());function Dhi(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 T3.TFile||(o=t.vault.getAbstractFileByPath(n+".md"),o instanceof T3.TFile)?o:null}function $hi(t,e){let r=e.split(`
|
||
`).filter(o=>o.trim()),n=[];for(let o of r){let i=Dhi(t,o.trim());i&&n.push(i)}return n}function Htn(t){let{app:e,contextNotes:r,setContextNotes:n,selectedImages:o,onAddImage:i,containerRef:a}=t,[s,u]=(0,KFe.useState)(!1);return(0,KFe.useEffect)(()=>{let l=a.current;if(!l)return;let c=p=>{if(p.preventDefault(),p.dataTransfer){p.dataTransfer.dropEffect="copy";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(O=>{w.getAsString(T=>O(T))})),b=await Promise.all(g),_=new Map;for(let w of b){let O=$hi(e,w);for(let T of O)_.set(T.path,T)}for(let w of _.values())if(["png","gif","jpeg","jpg","webp"].includes(w.extension)){if(o.some(j=>j.name===w.name)){new T3.Notice("This image is already in the context");continue}let P=await e.vault.readBinary(w),M=new Blob([P]),I=new File([M],w.name,{type:`image/${w.extension}`});i([I])}else if(bO(w)){if(r.some(P=>P.path===w.path)){new T3.Notice("This note is already in the context");continue}n(P=>[...P,w])}else new T3.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}}Or();Zt();_t();D$();LTe();var yvt=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){ne("Model request failed:",s);let u=dG("Model request failed: "+Sn(s));r({id:Zm(),sender:nC,isErrorMessage:!0,message:u,isVisible:!0,timestamp:eg(new Date)})}};F1();Ez();Nv();ot();Zt();ETe();var Sl=require("obsidian");var lr=L(X());D$();var Lhi=({chainManager:t,onSaveChat:e,updateUserMessageHistory:r,fileParserManager:n,plugin:o,chatUIState:i,chatInput:a})=>{let s=zr(),u=(0,lr.useContext)(XZ),{messages:l,addMessage:c}=Vtn(i),[d]=yL(),[f]=Cv(),[p,m]=(0,lr.useState)(""),[h,y]=(0,lr.useState)(""),[g,b]=(0,lr.useState)(null),_=(0,lr.useRef)(null),w=(0,lr.useRef)(null),O=(0,lr.useCallback)(pt=>{let Br=w.current,Ei=Br&&pt.sender===nC&&!pt.isErrorMessage&&!pt.id?{...pt,id:Br}:pt;c(Ei),Ei.sender===nC&&Ei.responseMetadata?.tokenUsage?.totalTokens&&b(Ei.responseMetadata.tokenUsage.totalTokens)},[c]),T=(0,lr.useCallback)(pt=>{_.current=pt},[]),[P,M]=(0,lr.useState)(!1),[I,j]=(0,lr.useState)(Sv.DEFAULT),[A,k]=(0,lr.useState)([]),[V,q]=(0,lr.useState)(!1),[J,K]=(0,lr.useState)(!1),[ue,oe]=(0,lr.useState)([]),[G,Y]=(0,lr.useState)(!1),[se,ie]=(0,lr.useState)([]),[$,H]=(0,lr.useState)(null),re=(0,lr.useRef)(!1),D=(0,lr.useRef)(null),R=(0,lr.useMemo)(()=>({setCurrentAiMessage:pt=>re.current&&m(pt),setLoadingMessage:pt=>re.current&&j(pt),setLoading:pt=>re.current&&M(pt)}),[]),[z]=_At(),U=z.length>0,ee=V&&!U,ce=J&&!U,{activeWebTabForMentions:ve}=lB(),Oe=xDe(),Je=()=>dt!=="project"?!1:$!==null?$:Oe==="loading"||Oe==="error";(0,lr.useEffect)(()=>{H(null)},[Oe]),(0,lr.useEffect)(()=>{l.length===0&&b(null)},[l]);let[tt,Ke]=(0,lr.useState)(null),[dt,Pt]=Cv(),Nt=rG(),Ne=(0,lr.useContext)(RFe),Tr=o.app||Ne,{isDragActive:st}=Htn({app:Tr,contextNotes:A,setContextNotes:k,selectedImages:ue,onAddImage:pt=>oe(Br=>[...Br,...pt]),containerRef:D}),Le=async({toolCalls:pt,urls:Br,contextNotes:Ti,contextTags:Ei,contextFolders:tu,webTabs:Pi}={})=>{if(!h&&ue.length===0)return;Br&&Br.length>0&&!sb(f)&&new Sl.Notice(GW.URL_PROCESSING_RESTRICTED);try{let rl=[];h&&rl.push({type:"text",text:h});for(let ii of ue){let is=await ii.arrayBuffer(),cv=bk(is);rl.push({type:"image_url",image_url:{url:`data:${ii.type};base64,${cv}`}})}let Xm=[...Ti||[],...A].filter((ii,is,cv)=>cv.findIndex(gi=>gi.path===ii.path)===is),Ft=h;pt&&(Ft+=" "+pt.join(`
|
||
`));let Ge={notes:Xm,urls:sb(f)?Br||[]:[],tags:Ei||[],folders:tu||[],selectedTextContexts:z,webTabs:Pi||[]};y(""),oe([]),w.current=`msg-${Zm()}`,R.setLoading(!0),R.setLoadingMessage(Sv.DEFAULT);let Ee=await i.sendMessage(Ft,Ge,f,ee,ce,rl.length>0?rl:void 0,R.setLoadingMessage);h&&r(h),s.autosaveChat&&rt();let yr=i.getLLMMessage(Ee);yr&&await yvt(yr,t,O,R.setCurrentAiMessage,T,{debug:s.debug,updateLoadingMessage:R.setLoadingMessage}),s.autosaveChat&&rt()}catch(rl){ne("Error sending message:",rl),new Sl.Notice("Failed to send message. Please try again.")}finally{R.setLoading(!1),R.setLoadingMessage(Sv.DEFAULT),w.current=null}},rt=(0,lr.useCallback)(async()=>{if(!Tr){ne("App instance is not available.");return}try{await i.saveChat(d)}catch(pt){ne("Error saving chat as note:",Sn(pt)),new Sl.Notice("Failed to save chat as note. Check console for details.")}},[Tr,i,d]),Fe=(0,lr.useCallback)(pt=>{_.current&&(B(`stopping generation..., reason: ${pt}`),_.current.abort(pt),R.setLoading(!1),R.setLoadingMessage(Sv.DEFAULT))},[R]);(0,lr.useEffect)(()=>(re.current=!0,()=>{re.current=!1,_.current&&_.current.abort("component-unmount")}),[]);let We=(0,lr.useCallback)(async pt=>{if(pt<=0){new Sl.Notice("Cannot regenerate the first message.");return}let Br=l[pt];if(!Br){new Sl.Notice("Message not found.");return}R.setCurrentAiMessage(""),w.current=`msg-${Zm()}`,R.setLoading(!0);try{await i.regenerateMessage(Br.id,R.setCurrentAiMessage,O)?s.debug&&console.log("Message regenerated successfully"):new Sl.Notice("Failed to regenerate message. Please try again."),s.autosaveChat&&rt()}catch(Ti){ne("Error regenerating message:",Ti),new Sl.Notice("Failed to regenerate message. Please try again.")}finally{R.setLoading(!1),w.current=null}},[l,i,s.debug,s.autosaveChat,rt,O,R]),ke=(0,lr.useCallback)(async(pt,Br)=>{let Ti=l[pt];if(!(!Ti||Ti.message===Br))try{if(!await i.editMessage(Ti.id,Br,f,ee)){new Sl.Notice("Failed to edit message. Please try again.");return}if(Ti.sender===Ws){let tu=pt<l.length-1;if(await i.truncateAfterMessageId(Ti.id),tu){w.current=`msg-${Zm()}`,R.setLoading(!0);try{let Pi=i.getLLMMessage(Ti.id);Pi&&await yvt(Pi,t,O,R.setCurrentAiMessage,T,{debug:s.debug,updateLoadingMessage:R.setLoadingMessage})}catch(Pi){ne("Error regenerating AI response:",Pi),new Sl.Notice("Failed to regenerate AI response. Please try again.")}finally{R.setLoading(!1),w.current=null}}}s.autosaveChat&&rt()}catch(Ei){ne("Error editing message:",Ei),new Sl.Notice("Failed to edit message. Please try again.")}},[l,i,f,ee,O,t,s.debug,s.autosaveChat,rt,R,T]);(0,lr.useEffect)(()=>{e&&e(rt)},[e,rt]);let Lt=(0,lr.useCallback)(pt=>{let Br=s.projectList||[];if(Br.findIndex(Pi=>Pi.name===pt.name)>=0)throw new Error(`Project "${pt.name}" already exists, please use a different name`);let Ei=[...Br,pt];return Ue("projectList",Ei),Uu()?.id===pt.id?k$e().then(()=>{new Sl.Notice(`${pt.name} added and context loaded`)}).catch(Pi=>{ne("Error loading project context:",Pi),new Sl.Notice(`${pt.name} added but context loading failed`)}):new Sl.Notice(`${pt.name} added successfully`),!0},[s.projectList]),Eo=(0,lr.useCallback)((pt,Br)=>{let Ti=s.projectList||[];if(!Ti.find(tl=>tl.name===pt.name))throw new Error(`Project "${pt.name}" does not exist`);let tu=Ti.map(tl=>tl.name===pt.name?Br:tl);return Ue("projectList",tu),Uu()?.id===pt.id?(Fz(Br),k$e().then(()=>{new Sl.Notice(`${pt.name} updated and context reloaded`)}).catch(tl=>{ne("Error reloading project context:",tl),new Sl.Notice(`${pt.name} updated but context reload failed`)})):new Sl.Notice(`${pt.name} updated successfully`),!0},[s.projectList]),xl=(0,lr.useCallback)(pt=>{let Br=z.find(Ti=>Ti.id===pt);yAt(pt),Br?.sourceType==="web"&&o.suppressCurrentWebSelection(Br.url)},[o,z]);(0,lr.useEffect)(()=>{let pt=()=>{a.focusInput()};return u?.addEventListener(Zw.CHAT_IS_VISIBLE,pt),()=>{u?.removeEventListener(Zw.CHAT_IS_VISIBLE,pt)}},[u,a]);let In=(0,lr.useCallback)(async pt=>{let Br=l[pt];if(!Br){new Sl.Notice("Message not found.");return}try{await i.deleteMessage(Br.id)||new Sl.Notice("Failed to delete message. Please try again.")}catch(Ti){ne("Error deleting message:",Ti),new Sl.Notice("Failed to delete message. Please try again.")}},[l,i]),hi=(0,lr.useCallback)(async()=>{if(cG(),await pm.clear(),Fe("new-chat"),s.enableRecentConversations)try{let Br=t.chatModelManager.getChatModel();o.userMemoryManager.addRecentConversation(i.getMessages(),Br)}catch(Br){B("Failed to analyze chat messages for memory:",Br)}s.autosaveChat&&await rt(),i.clearMessages(),_ft(),R.setCurrentAiMessage(""),k([]),b(null);let pt=z.find(Br=>Br.sourceType==="web")?.url;bAt(),o.suppressCurrentWebSelection(pt),dt==="project"?(q(!1),K(!1)):(q(s.autoAddActiveContentToContext),K(s.autoAddActiveContentToContext))},[Fe,t.chatModelManager,i,s.autosaveChat,s.enableRecentConversations,s.autoAddActiveContentToContext,dt,rt,R,o,z]),Gm=(0,lr.useCallback)(async()=>{try{let pt=await o.getChatHistoryItems();ie(pt)}catch(pt){ne("Error loading chat history:",pt),new Sl.Notice("Failed to load chat history.")}},[o]),Fs=(0,lr.useCallback)(async(pt,Br)=>{try{await o.updateChatTitle(pt,Br),await Gm()}catch(Ti){throw ne("Error updating chat title:",Ti),new Sl.Notice("Failed to update chat title."),Ti}},[o,Gm]),Vb=(0,lr.useCallback)(async pt=>{try{await o.deleteChatHistory(pt),await Gm()}catch(Br){throw ne("Error deleting chat:",Br),new Sl.Notice("Failed to delete chat."),Br}},[o,Gm]),Jh=(0,lr.useCallback)(async pt=>{try{await o.loadChatById(pt),_ft()}catch(Br){ne("Error loading chat:",Br),new Sl.Notice("Failed to load chat.")}},[o]),Mw=(0,lr.useCallback)(async pt=>{try{await o.openChatSourceFile(pt)}catch(Br){ne("Error opening source file:",Br),new Sl.Notice("Failed to open source file.")}},[o]);(0,lr.useEffect)(()=>{let pt=Br=>{let Ti=Br.detail?.reason||"new-chat";Fe(Ti)};return u?.addEventListener(Zw.ABORT_STREAM,pt),()=>{u?.removeEventListener(Zw.ABORT_STREAM,pt)}},[u,Fe]),(0,lr.useEffect)(()=>{s.autoAddActiveContentToContext!==void 0&&(dt==="project"?(q(!1),K(!1)):(q(s.autoAddActiveContentToContext),K(s.autoAddActiveContentToContext)))},[s.autoAddActiveContentToContext,dt]);let zi=()=>lr.default.createElement(lr.default.Fragment,null,lr.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},lr.default.createElement(Ken,{currentVersion:o.manifest.version}),lr.default.createElement(Wen,{chatHistory:l,currentAiMessage:p,streamingMessageId:w.current,loading:P,loadingMessage:I,app:Tr,onRegenerate:We,onEdit:ke,onDelete:In,onReplaceChat:y,showHelperComponents:dt!=="project"}),Je()?lr.default.createElement("div",{className:"tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-rounded-xl"},lr.default.createElement(gvt,{plugin:o,setHiddenCard:()=>{H(!1)},onEditContext:()=>{let pt=Uu();pt&&new iY(Tr,Br=>{Eo(pt,Br)},pt).open()}})):lr.default.createElement(lr.default.Fragment,null,lr.default.createElement(qGr,{onNewChat:hi,onSaveAsNote:()=>rt(),onLoadHistory:Gm,onModeChange:pt=>{Ke(dt),pt==="project"&&Y(!1)},chatHistory:se,onUpdateChatTitle:Fs,onDeleteChat:Vb,onLoadChat:Jh,onOpenSourceFile:Mw,latestTokenCount:g}),lr.default.createElement(CFe,{inputMessage:h,setInputMessage:y,handleSendMessage:Le,isGenerating:P,onStopGenerating:()=>Fe("user-stopped"),app:Tr,contextNotes:A,setContextNotes:k,includeActiveNote:V,setIncludeActiveNote:q,includeActiveWebTab:J,setIncludeActiveWebTab:K,activeWebTab:ve,selectedImages:ue,onAddImage:pt=>oe(Br=>[...Br,...pt]),setSelectedImages:oe,disableModelSwitch:dt==="project",selectedTextContexts:z,onRemoveSelectedText:xl,showProgressCard:()=>{H(!0)}}))));return lr.default.createElement("div",{ref:D,className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},lr.default.createElement("div",{className:"tw-h-full"},lr.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},st&&lr.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"},lr.default.createElement("span",null,"Drop files here...")),dt==="project"&&lr.default.createElement("div",{className:`${dt==="project"?"tw-z-modal":""}`},lr.default.createElement(uvt,{projects:s.projectList||[],defaultOpen:!0,app:Tr,plugin:o,hasMessages:!1,onProjectAdded:Lt,onEditProject:Eo,onClose:()=>{tt?(Pt(tt),Ke(null)):Pt(Nt?"copilot_plus":"llm_chain")},showChatUI:pt=>Y(pt),onProjectClose:()=>{H(null)}})),(dt!=="project"||dt==="project"&&G)&&zi())))},Fhi=t=>lr.default.createElement(een,null,lr.default.createElement(khi,{...t})),khi=t=>{let e=gB();return lr.default.createElement(Lhi,{...t,chatInput:e})},Jtn=Fhi;Or();var Wtn=require("obsidian"),nfe=L(X()),Ktn=L(dd()),vB=class extends Wtn.ItemView{constructor(r,n){super(r);this.plugin=n;this.root=null;this.handleSaveAsNote=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 ac}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,Ktn.createRoot)(this.containerEl.children[1]);let r=o=>{this.handleSaveAsNote=o},n=o=>{this.plugin.updateUserMessageHistory(o)};this.renderView(r,n)}renderView(r,n){this.root&&this.root.render(nfe.createElement(RFe.Provider,{value:this.app},nfe.createElement(XZ.Provider,{value:this.eventTarget},nfe.createElement(f$e,{delayDuration:0},nfe.createElement(Jtn,{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.root&&(this.root.unmount(),this.root=null)}};Tft();Zt();function ofe(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 ife(t){let e=app.metadataCache.getFileCache(t)?.frontmatter;return e&&e.epoch?new Date(e.epoch):new Date(t.stat.ctime)}function afe(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 Gtn(t){let e=ofe(t),r=ife(t),n=eg(r);return`${e} - ${n.display}`}ot();lN();var Xtn=require("obsidian"),GFe=class extends Xtn.FuzzySuggestModal{constructor(r,n,o,i){super(r);this.chatFiles=n;this.chatHistoryLastAccessedAtManager=o;this.onChooseFile=i}getItems(){let r=ae().chatHistorySortStrategy;return mO(this.chatFiles,r,{getName:n=>ofe(n),getCreatedAtMs:n=>ife(n).getTime(),getLastUsedAtMs:n=>{let o=afe(n);return this.chatHistoryLastAccessedAtManager.getEffectiveLastUsedAt(n.path,o)}})}getItemText(r){return Gtn(r)}onChooseItem(r,n){this.onChooseFile(r)}};Or();function Ztn(t){t.addItem(e=>{e.setTitle("Copilot"),e.setSubmenu();let r=e.submenu;if(!r)return;r.addItem(i=>{i.setTitle("Add selection to chat context").onClick(()=>{app.commands.executeCommandById(`copilot:${Nn.ADD_SELECTION_TO_CHAT_CONTEXT}`)})}),r.addItem(i=>{i.setTitle("Trigger quick command").onClick(()=>{app.commands.executeCommandById(`copilot:${Nn.TRIGGER_QUICK_COMMAND}`)})});let o=z_().filter(i=>i.showInContextMenu);o.length>0&&r.addSeparator(),hce(o).forEach(i=>{r.addItem(a=>{a.setTitle(i.title).onClick(()=>{app.commands.executeCommandById(`copilot:${pX(i.title)}`)})})})})}var Ytn=L(oG());_t();var XFe=class{constructor(e,r){this.handleFileModify=(0,Ytn.default)(async e=>{if(!hX(e)||fce(e.path))return;let r=await mce(e);this.registerCommand(r),_J(r,r.title)},1e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(!(!hX(e)||fce(e.path)))try{let r=await mce(e);if(!xHr(e)){let n=uDe();r={...r,order:n}}await Pmt(e,r),_J(r,r.title),this.registerCommand(r)}catch(r){ne(`Error processing custom command creation: ${e.path}`,r)}};this.handleFileDeletion=async e=>{if(!hX(e)||fce(e.path))return;let r=pX(e.basename);this.plugin.removeCommand(r),pce(e.basename)};this.handleFileRename=async(e,r)=>{if(fce(e.path))return;let n=r.split("/").pop()?.replace(/\.md$/,"");if(n){let o=pX(n);this.plugin.removeCommand(o),pce(n)}if(hX(e)){let o=await mce(e);this.registerCommand(o),_J(o,o.title),await Pmt(e,o)}};this.plugin=e,this.vault=r,this.initializeEventListeners()}async initialize(){await aDe(),this.registerCommands()}async registerCommands(){z_().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=pX(e.title);this.plugin.removeCommand(r),this.plugin.addCommand({id:r,name:e.title,editorCallback:n=>{new SU(this.plugin.app,{selectedText:n.getSelection(),command:e}).open(),Um.getInstance().recordUsage(e)}})}};ot();Zt();async function qhi(t){let r=`${vU()}/unsupported`;return await xc(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[qD]=n.showInContextMenu,a[UD]=n.showInSlashMenu,a[fA]=n.order,a[BD]=n.modelKey,a[zD]=0})}))}async function Qtn(){let t=ae().inlineEditCommands;if(!t||t.length===0)return;let e=[],r=[],n=z_(),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=iDe(a.title,n);s?r.push({...a,title:encodeURIComponent(a.title),content:`> ${s}
|
||
|
||
Original name: ${a.title}
|
||
|
||
${a.content}`}):e.push(a)}await Um.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 ${vU()}.`;r.length>0&&(await qhi(r),i+=`
|
||
|
||
We found ${r.length} unsupported commands. They are saved in ${vU()}/unsupported. To fix them, please resolve the errors and move the note file out of the unsupported folder.`),Ue("inlineEditCommands",[]),new vl(app,()=>{},i,"\u{1F680} New Copilot Custom Commands","OK","").open()}async function bvt(){let t=z_(),e=CHr.filter(n=>!t.some(o=>o.title===n.title)),r=[...t,...e];Um.getInstance().updateCommands(r)}async function ern(){if(ae().suggestedDefaultCommands)return;z_().length===0&&(new vl(app,()=>{bvt()},"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(),Ue("suggestedDefaultCommands",!0))}var Fc=L(X()),sfe=require("obsidian"),trn=L(dd());to();qs();ot();function Uhi({plugin:t,onRemove:e}){let[r,n]=(0,Fc.useState)(""),o=zr(),[i,a]=(0,Fc.useState)(""),[s]=yL(),u=(0,Fc.useRef)(null),l=o.quickCommandModelKey??s,c=o.quickCommandIncludeNoteContext;(0,Fc.useEffect)(()=>{let y=t.app.workspace.getActiveViewOfType(sfe.MarkdownView);if(y&&y.editor){let g=y.editor.getSelection();a(g)}},[t.app]),(0,Fc.useEffect)(()=>{u.current&&u.current.focus()},[]);let d=async()=>{if(!r.trim()){new sfe.Notice("Please enter a prompt");return}let y=`
|
||
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).
|
||
`,g=r;if(c){let w=g.includes("{}"),O=/\{activenote\}/i.test(g),T=[];w||T.push("{}"),O||T.push("{activeNote}"),T.length>0&&(g+=`
|
||
|
||
${T.join(`
|
||
|
||
`)}`)}let b={title:"Quick Command",content:g,showInContextMenu:!1,showInSlashMenu:!1,order:0,modelKey:l,lastUsedMs:Date.now()};new SU(t.app,{selectedText:i,command:b,systemPrompt:y}).open(),e()},f=()=>{e()},p=y=>{y.key==="Escape"?(y.preventDefault(),f()):y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),d())},m=y=>{Ue("quickCommandModelKey",y)},h=y=>{Ue("quickCommandIncludeNoteContext",y)};return Fc.default.createElement("div",{className:"tw-rounded-lg tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-4",onKeyDown:p},Fc.default.createElement("div",{className:"tw-space-y-4"},Fc.default.createElement(bw,{ref:u,value:r,onChange:y=>n(y.target.value),placeholder:"Ask me anything...",className:"tw-min-h-24 tw-resize-none",rows:3}),Fc.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-4"},Fc.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},Fc.default.createElement(U$e,{size:"sm",variant:"ghost",value:l,onChange:m}),Fc.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fc.default.createElement(Qc,{id:"includeActiveNote",checked:c,onCheckedChange:y=>h(!!y)}),Fc.default.createElement("label",{htmlFor:"includeActiveNote",className:"tw-cursor-pointer tw-text-sm tw-text-muted"},"Include note context"))),Fc.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fc.default.createElement(ge,{variant:"secondary",onClick:f,size:"sm"},"Cancel"),Fc.default.createElement(ge,{onClick:d,size:"sm"},"Submit")))))}function rrn({plugin:t,element:e}){let r=document.createElement("div");e.appendChild(r);let n=(0,trn.createRoot)(r),o=()=>{let i=t.app.workspace.getActiveViewOfType(sfe.MarkdownView);i&&i.editor&&lDe(i.editor),n.unmount(),r.remove()};return n.render(Fc.default.createElement(Uhi,{plugin:t,onRemove:o})),{root:n,container:r}}Or();ot();Vq();Bc();qs();_t();k1();Or();async function nrn(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===Ws){let o=t[r+1];o?.sender===nC&&await e.getMemory().saveContext({input:n.message},{output:o.message})}}}qs();Bc();Or();var arn=L(mV());_t();var orn=["L1_SYSTEM","L2_PREVIOUS","L3_TURN","L4_STRIP","L5_USER"],irn={L1_SYSTEM:"System Instructions",L2_PREVIOUS:"Previous Turn Context",L3_TURN:"Current Turn Context",L4_STRIP:"Conversation Strip",L5_USER:"User Message"};var wB=class wB{constructor(){}static getInstance(){return wB.instance||(wB.instance=new wB),wB.instance}buildEnvelope(e){let r=orn.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&&B(`[PromptContextEngine] Built envelope for ${a}`,o),{version:wB.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:irn[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,arn.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}};wB.ENVELOPE_VERSION=1;var ZFe=wB;qs();Or();_t();Yle();SJ();bX();Zt();CX();var ufe=require("obsidian");Or();var YFe=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 ufe.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],`
|
||
|
||
<${Dee}>
|
||
<name>${s}</name>
|
||
<content>
|
||
${l}
|
||
</content>
|
||
</${Dee}>
|
||
|
||
`)}catch(l){ne(`Error processing embedded PDF ${s}:`,l),e=e.replace(a[0],`
|
||
|
||
<${Dee}>
|
||
<name>${s}</name>
|
||
<error>Could not process PDF</error>
|
||
</${Dee}>
|
||
|
||
`)}}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=`
|
||
|
||
<${$ee}>
|
||
<query_type>${l}</query_type>
|
||
<original_query>
|
||
${c}
|
||
</original_query>
|
||
<executed_result>
|
||
${p}
|
||
</executed_result>
|
||
</${$ee}>
|
||
|
||
`;e=e.slice(0,d)+m+e.slice(f)}catch(p){ne("Error executing Dataview query:",p);let m=`
|
||
|
||
<${$ee}>
|
||
<query_type>${l}</query_type>
|
||
<original_query>
|
||
${c}
|
||
</original_query>
|
||
<error>${p instanceof Error?p.message:"Query execution failed"}</error>
|
||
</${$ee}>
|
||
|
||
`;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),sb(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 ufe.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 sb(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){Be("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=`
|
||
|
||
<${mHe}>
|
||
<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+=`
|
||
</${mHe}>
|
||
|
||
`,u}async processContextNotes(e,r,n,o,i,a,s){let u="",l=async(d,f=Nee)=>{try{if(e.has(d.path)){B(`Skipping note ${d.path} as it was included via custom prompt.`);return}if(!r.supportsExtension(d.extension)){Be(`Unsupported file type: ${d.extension}`);return}if(!sb(s)&&d.extension!=="md"&&d.extension!=="canvas"){Be(`File type ${d.extension} requires Copilot Plus mode for context processing.`),new ufe.Notice(GW.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>${d.basename}</title>
|
||
<path>${d.path}</path>
|
||
<ctime>${h}</ctime>
|
||
<mtime>${y}</mtime>
|
||
<content>
|
||
${p}
|
||
</content>
|
||
</${f}>`}catch(p){ne(`Error processing file ${d.path}:`,p),u+=`
|
||
|
||
<${f}_error>
|
||
<title>${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=bL();if(!e||e.length===0)return"";let r="";for(let n of e)n.sourceType==="web"?r+=`
|
||
|
||
<${pHe}>
|
||
<title>${Yc(n.title)}</title>
|
||
<url>${Yc(n.url)}</url>
|
||
<content>
|
||
${Yc(n.content)}
|
||
</content>
|
||
</${pHe}>`:r+=`
|
||
|
||
<${n_}>
|
||
<title>${Yc(n.noteTitle)}</title>
|
||
<path>${Yc(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>${Yc(_.title)}</title>`,`
|
||
<url>${Yc(_.url)}</url>`];return _.mode&&w.push(`
|
||
<mode>${Yc(_.mode)}</mode>`),_.error?w.push(`
|
||
<error>${Yc(_.error)}</error>`):_.content!==void 0&&w.push(`
|
||
<content>
|
||
${Yc(_.content)}
|
||
</content>`),w.push(`
|
||
</${b}>`),w.join("")},s=b=>{let _=[`
|
||
|
||
<${yHe}>`,`
|
||
<title>${Yc(b.title)}</title>`,`
|
||
<url>${Yc(b.url)}</url>`,`
|
||
<video_id>${Yc(b.videoId)}</video_id>`];b.isActive&&_.push(`
|
||
<is_active>true</is_active>`),b.channel&&_.push(`
|
||
<channel>${Yc(b.channel)}</channel>`),b.uploadDate&&_.push(`
|
||
<upload_date>${Yc(b.uploadDate)}</upload_date>`),b.duration&&_.push(`
|
||
<duration>${Yc(b.duration)}</duration>`),b.genre&&_.push(`
|
||
<genre>${Yc(b.genre)}</genre>`),b.description&&_.push(`
|
||
<description>${Yc(b.description)}</description>`),b.error&&_.push(`
|
||
<error>${Yc(b.error)}</error>`);let w=b.transcript||"No transcript available for this video";return _.push(`
|
||
<content>
|
||
${Yc(w)}
|
||
</content>`),_.push(`
|
||
</${yHe}>`),_.join("")},u=null,l=[],c=new Set,d=new Set,f=ed(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 _=Dy(b.url);_&&b.isActive&&!u&&(u={...b,url:_},p(_))}for(let b of e){let _=Dy(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(mge,{title:u.title||"Unknown",url:u.url,error:b}));for(let w of l)_.push(a(gHe,{title:w.title||"Unknown",url:w.url,error:b}));return _.join("")}let h=async(b,_)=>{try{let w=b.url,O=f.getYouTubeVideoId(w);if(O)return await y(b,O,_===mge);let T=f.findLeafByUrl(w,{title:b.title});if(!T)return a(_,{title:b.title||"Unknown",url:w,error:"Web tab not found or closed"});let P=f.getPageInfo(T),M=T.view;if(!(M.webviewMounted===void 0||M.webviewFirstLoadFinished===void 0?!0:!!(M.webviewMounted&&M.webviewFirstLoadFinished)))try{await f.waitForWebviewReady(T,r),P=f.getPageInfo(T)}catch(k){return Be(`Web tab content not loaded yet for ${w}:`,k),a(_,{title:P.title||b.title||"Untitled",url:P.url||w,mode:P.mode,error:"Web tab content not loaded yet"})}let j=new AbortController,A=setTimeout(()=>{j.abort()},n);try{let k=await f.getReaderModeMarkdown(T,{signal:j.signal});return P=f.getPageInfo(T),a(_,{title:P.title||b.title||"Untitled",url:P.url||w,mode:P.mode,content:k})}finally{clearTimeout(A)}}catch(w){return ne(`Error processing web tab ${b.url}:`,w),a(_,{title:b.title||"Unknown",url:b.url,error:w instanceof CU?"Web tab content extraction timed out":"Could not process web tab"})}},y=async(b,_,w)=>{try{let O=null,T=b.url;for(let A of f.getLeaves()){let k=f.getPageInfo(A).url;if(f.getYouTubeVideoId(k)===_){O=A,T=k;break}}if(!O)return s({title:b.title||"YouTube Video",url:b.url,videoId:_,isActive:w,error:"Web tab not found or closed"});let P=O.view;if(!(P.webviewMounted===void 0||P.webviewFirstLoadFinished===void 0?!0:!!(P.webviewMounted&&P.webviewFirstLoadFinished)))try{await f.waitForWebviewReady(O,r)}catch(A){return Be(`YouTube tab content not loaded yet for ${T}:`,A),s({title:b.title||"YouTube Video",url:T,videoId:_,isActive:w,error:"Web tab content not loaded yet"})}let I=await f.getYouTubeTranscript(O,{timeoutMs:o}),j=I.transcript.length>0?I.transcript.map(A=>`${A.timestamp}: ${A.text}`).join(`
|
||
`):void 0;return s({title:I.title||b.title||"YouTube Video",url:T,videoId:I.videoId,channel:I.channel,description:I.description,uploadDate:I.uploadDate,duration:I.duration,genre:I.genre,transcript:j,isActive:w})}catch(O){return Be(`YouTube transcript extraction failed for ${b.url}:`,O),s({title:b.title||"YouTube Video",url:b.url,videoId:_,isActive:w,error:O instanceof Error?O.message:"Failed to extract video info"})}},g=[];if(u){let b=await h(u,mge);g.push(b)}for(let b=0;b<l.length;b+=i){let _=l.slice(b,b+i),w=await Promise.all(_.map(O=>h(O,gHe)));g.push(...w)}return g.join("")}};_t();kot();ot();Zt();var vvt=null;async function Bhi(){return vvt||(vvt=(await Promise.resolve().then(()=>(urn(),srn))).ContextCompactor),vvt.getInstance()}var QFe=class t{constructor(){this.contextProcessor=YFe.getInstance(),this.mention=aG.getInstance(),this.promptContextEngine=ZFe.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{B(`[ContextManager] Processing context for message ${e.id}`);let d=e.originalMessage||e.message,{processedPrompt:f,includedFiles:p}=await gce(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(H=>H.path),...l.map(H=>H.path),...h]),_=new Set,O=(e.context?.notes||[]).filter(H=>!h.has(H.path));i&&o!=="project"&&a&&!b.has(a.path)&&!O.some(H=>H.path===a.path)&&O.push(a);let T=await this.contextProcessor.processContextNotes(b,r,n,O,i,a,o);O.forEach(H=>{b.add(H.path),_.add(H.path)});let P=e.context?.tags||[],M="",I=[];if(P.length>0){let re=sge(n,P).filter(D=>!b.has(D.path));re.length>0&&(M=await this.contextProcessor.processContextNotes(new Set,r,n,re,!1,null,o),re.forEach(D=>{b.add(D.path),_.add(D.path),I.push(D.path)}))}let j=e.context?.folders||[],A="",k=[];if(j.length>0){let re=j.flatMap(D=>Eee(n,D)).filter(D=>!b.has(D.path));re.length>0&&(A=await this.contextProcessor.processContextNotes(new Set,r,n,re,!1,null,o),re.forEach(D=>{b.add(D.path),_.add(D.path),k.push(D.path)}))}let V=this.contextProcessor.processSelectedTextContexts(),q=e.context?.webTabs||[],J=await this.contextProcessor.processContextWebTabs(q),K=m+T+M+A+g.urlContext+V+J,ue=f+K,Y=(o==="project"?1e6:ae().autoCompactThreshold)*4,se=!1,ie=K;if(ue.length>Y){c?.(Sv.COMPACTING);let re=await(await Bhi()).compact(K);re.wasCompacted&&(ie=re.content,ue=f+ie,se=!0,B(`[ContextManager] Compacted context: ${re.originalCharCount} -> ${re.compactedCharCount} chars`)),c?.(Sv.DEFAULT)}B(`[ContextManager] Successfully processed context for message ${e.id}`);let $=se?this.buildCompactedEnvelope({chainType:o,message:e,systemPrompt:u||"",processedUserMessage:f,compactedContext:ie,compactedPaths:Array.from(_)}):this.buildPromptContextEnvelope({chainType:o,message:e,systemPrompt:u||"",processedUserMessage:f,l2PreviousContext:m,noteContextAddition:T,tagContextAddition:M,tagNotePaths:I,folderContextAddition:A,folderNotePaths:k,urlContext:g.urlContext,selectedText:V,webTabContext:J});return{processedContent:ue,contextEnvelope:$}}catch(d){return B(`[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;B(`[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),B(`[ContextManager] Completed context reprocessing for message ${e}`)}buildL2ContextFromPreviousTurns(e,r){let n=r.getDisplayMessages(),o=n.findIndex(l=>l.id===e);if(o===-1||o===0)return{l2Context:"",l2Paths:new Set};let i=n.slice(0,o).filter(l=>l.sender==="user"),a=[],s=new Set,u=-1;for(let l=i.length-1;l>=0;l--)if(i[l].contextEnvelope?.layers?.find(p=>p.id==="L3_TURN")?.segments?.some(p=>p.metadata?.wasCompacted)){u=l;break}for(let l=0;l<i.length;l++){let d=i[l].contextEnvelope?.layers?.find(f=>f.id==="L3_TURN");if(d){if(l>=u){let f=[];for(let p of d.segments||[])p.content&&f.push(p.content);f.length>0&&a.push(f.join(`
|
||
`))}for(let f of d.segments||[]){if(f.metadata?.notePath&&s.add(f.metadata.notePath),f.metadata?.compactedPaths)for(let p of f.metadata.compactedPaths)s.add(p);if(f.metadata?.notePaths)for(let p of f.metadata.notePaths)s.add(p)}}}return{l2Context:a.join(`
|
||
`),l2Paths:s}}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.appendTurnContextSegment(o,"tags",e.tagContextAddition,{source:"tags",notePaths:e.tagNotePaths}),this.appendTurnContextSegment(o,"folders",e.folderContextAddition,{source:"folders",notePaths:e.folderNotePaths}),this.appendTurnContextSegment(o,"urls",e.urlContext,{source:"urls"}),this.appendTurnContextSegment(o,"selected_text",e.selectedText,{source:"selected_text"}),this.appendTurnContextSegment(o,"web_tabs",e.webTabContext,{source:"web_tabs"}),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){if(!e.trim())return[];let n=[],o=/<(?:note_context|active_note)>[\s\S]*?<\/(?:note_context|active_note)>/g,i;for(;(i=o.exec(e))!==null;){let a=i[0],s=/<path>([^<]+)<\/path>/.exec(a);if(!s)continue;let u=s[1];n.push({id:u,content:a,stable:r,metadata:{source:r?"previous_turns":"current_turn",notePath:u}})}return n}appendTurnContextSegment(e,r,n,o){let i=(n||"").trim();i&&e.push({id:`${r}`,content:i,stable:!1,metadata:o})}createMessageContext(e,r,n=bL()){return{notes:e,urls:r,selectedTextContexts:n}}async extractContextNotes(e,r,n=[]){return[...await mL(e,r),...n].filter((s,u,l)=>l.findIndex(c=>c.path===s.path)===u)}needsContextReprocessing(e){return e.needsContextReprocessing===!0}getSelectedTextContexts(){return bL()}};Zt();_t();var sY=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||eg(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),B(`[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=eg(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),B(`[MessageRepository] Added message with ID: ${s}`),s}editMessage(e,r){let n=this.messages.find(o=>o.id===e);return n?n.displayText===r?(B(`[MessageRepository] No changes needed for message: ${e}`),!0):(n.displayText=r,n.sender==="user"||n.sender==="USER"?B(`[MessageRepository] Edited user message ${e}, needs context reprocessing`):(n.processedText=r,B(`[MessageRepository] Edited AI message ${e}`)),!0):(B(`[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,B(`[MessageRepository] Updated processed text for message ${e}`),!0):(B(`[MessageRepository] Message not found for processed text update: ${e}`),!1)}deleteMessage(e){let r=this.messages.findIndex(n=>n.id===e);return r===-1?(B(`[MessageRepository] Message not found for deletion: ${e}`),!1):(this.messages.splice(r,1),B(`[MessageRepository] Deleted message ${e}`),!0)}clear(){this.messages=[],B("[MessageRepository] Cleared all messages")}truncateAfter(e){this.messages=this.messages.slice(0,e+1),B(`[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),B(`[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||eg(new Date),context:r.context,contextEnvelope:r.contextEnvelope,isVisible:r.isVisible!==!1,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content})}),B(`[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}}};qs();Or();_t();ot();Zt();var sv=require("obsidian"),wvt=100;function zhi(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 sv.Notice("No messages to save.");return}let n=ae(),o=this.formatChatContent(r),i=r[0].timestamp?.epoch||Date.now();await xc(n.defaultSaveFolder);let a=await this.findFileByEpoch(i),s=a?this.app.metadataCache.getFileCache(a)?.frontmatter:void 0,u=s?.topic,l=s?.lastAccessedAt,c=a?a.path:this.generateFileName(r,i,u),d=this.generateNoteContent(o,i,e,u,l),f=a;if(a)await this.app.vault.modify(a,d),B(`[ChatPersistenceManager] Updated existing chat file: ${a.path}`);else try{f=await this.app.vault.create(c,d),new sv.Notice(`Chat saved as note: ${c}`),B(`[ChatPersistenceManager] Created new chat file: ${c}`)}catch(p){if(this.isFileAlreadyExistsError(p)){let m=this.app.vault.getAbstractFileByPath(c);if(m&&m instanceof sv.TFile){let h=this.app.metadataCache.getFileCache(m)?.frontmatter;u=h?.topic??u;let y=h?.lastAccessedAt,g=this.generateNoteContent(o,i,e,u,y);await this.app.vault.modify(m,g),f=m,new sv.Notice("Existing chat note found - updating it now."),B(`[ChatPersistenceManager] Resolved save conflict by updating existing chat file: ${m.path}`)}else throw p}else if(this.isNameTooLongError(p)){let m=Uu(),h=m?`${m.id}__`:"",y=`${n.defaultSaveFolder}/${h}chat-${i}.md`;try{f=await this.app.vault.create(y,d),new sv.Notice(`Chat saved as note: ${y}`),Be(`[ChatPersistenceManager] Used minimal filename due to length constraints: ${y}`)}catch(g){if(this.isFileAlreadyExistsError(g)){let b=this.app.vault.getAbstractFileByPath(y);if(b&&b instanceof sv.TFile){let _=this.app.metadataCache.getFileCache(b)?.frontmatter,w=_?.lastAccessedAt,O=_?.topic,T=this.generateNoteContent(o,i,e,O,w);await this.app.vault.modify(b,T),f=b,new sv.Notice("Existing chat note found - updating it now."),B(`[ChatPersistenceManager] Resolved fallback save conflict by updating existing chat file: ${b.path}`)}else throw g}else throw g}}else throw p}this.generateTopicAsyncIfNeeded(r,f,u)}catch(r){ne("[ChatPersistenceManager] Error saving chat:",r),new sv.Notice("Failed to save chat as note. Check console for details.")}}async loadChat(e){try{let r=await this.app.vault.read(e),n=this.parseChatContent(r);return B(`[ChatPersistenceManager] Loaded ${n.length} messages from ${e.path}`),n}catch(r){return ne("[ChatPersistenceManager] Error loading chat:",r),new sv.Notice("Failed to load chat history. Check console for details."),[]}}async getChatHistoryFiles(){let e=ae(),r=this.app.vault.getAbstractFileByPath(e.defaultSaveFolder);if(!(r instanceof sv.TFolder))return[];let o=this.app.vault.getMarkdownFiles().filter(a=>a.path.startsWith(r.path)),i=Uu();return o.filter(a=>i?a.basename.startsWith(`${i.id}__`):!a.basename.includes("__")||!a.basename.split("__")[0])}formatChatContent(e){return e.map(r=>{let n=r.timestamp?r.timestamp.display:"Unknown time",o=`**${r.sender}**: ${r.message}`;if(r.context){let i=[];r.context.notes?.length&&i.push(`Notes: ${r.context.notes.map(a=>a.path).join(", ")}`),r.context.urls?.length&&i.push(`URLs: ${r.context.urls.join(", ")}`),r.context.webTabs?.length&&i.push(`Web Tabs: ${r.context.webTabs.map(a=>a.url).join(", ")}`),r.context.tags?.length&&i.push(`Tags: ${r.context.tags.join(", ")}`),r.context.folders?.length&&i.push(`Folders: ${r.context.folders.join(", ")}`),i.length>0&&(o+=`
|
||
[Context: ${i.join(" | ")}]`)}return o+=`
|
||
[Timestamp: ${n}]`,o}).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"?Ws:nC,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--}}c=l.slice(0,p).join(`
|
||
`).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 sv.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?(B(`[ChatPersistenceManager] Resolved legacy basename "${c}" to ${d[0].path}`),d[0]):(d.length>1?Be(`[ChatPersistenceManager] Ambiguous basename "${c}", skipping. Matches: ${d.map(f=>f.path).join(", ")}`):Be(`[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,i=typeof o?.epoch=="number"?o.epoch:typeof o?.epoch=="string"?Number(o.epoch):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 Rz(u).trim().replace(/^["']|["']$/g,"").replace(/[\\/:*?"<>|]/g,"").slice(0,50)||void 0}catch(r){ne("[ChatPersistenceManager] Error generating AI topic:",r);return}}generateFileName(e,r,n){let o=ae(),a=eg(new Date(r)).fileName,s;if(n)s=n;else{let w=e.find(O=>O.sender===Ws);s=w&&w.message.replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/[{}[\]]/g,"").split(/\s+/).slice(0,10).join(" ").replace(/[\\/:*?"<>|\x00-\x1F]/g,"").trim()||"Untitled Chat"}let u=o.defaultConversationNoteName||"{$date}_{$time}__{$topic}",l=Uu(),c=l?`${l.id}__`:"",d=Iee(".md"),f=Iee(c),p=u.replace("{$topic}","").replace("{$date}",a.split("_")[0]).replace("{$time}",a.split("_")[1]),m=Iee(p),h=Math.max(20,wvt-d-f-m),y=s.replace(/\s+/g,"_"),g=cHe(y,h);u=u.replace("{$topic}",g).replace("{$date}",a.split("_")[0]).replace("{$time}",a.split("_")[1]);let b=u.replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/[{}[\]]/g,"_").replace(/[\\/:*?"<>|\x00-\x1F]/g,"_"),_=`${c}${b}.md`;if(Iee(_)>wvt){let w=wvt-d-f,O=cHe(b,w);return`${o.defaultSaveFolder}/${c}${O}.md`}return`${o.defaultSaveFolder}/${_}`}generateNoteContent(e,r,n,o,i){let a=ae(),s=Uu();return`---
|
||
epoch: ${r}
|
||
modelKey: "${zhi(n)}"
|
||
${o?`topic: "${o}"`:""}
|
||
${i?`lastAccessedAt: ${i}`:""}
|
||
${s?`projectId: ${s.id}`:""}
|
||
${s?`projectName: ${s.name}`:""}
|
||
tags:
|
||
- ${a.defaultConversationTag}
|
||
---
|
||
|
||
${e}`}generateTopicAsyncIfNeeded(e,r,n){!ae().generateAIChatTitleOnSave||!r||n||(async()=>{try{let i=await this.generateAITopic(e);if(!i)return;await this.applyTopicToFrontmatter(r,i)}catch(i){ne("[ChatPersistenceManager] Error during async topic generation:",i)}})()}async applyTopicToFrontmatter(e,r){try{if(!this.app.fileManager?.processFrontMatter)return;let n=r.trim();await this.app.fileManager.processFrontMatter(e,o=>{o.topic!==n&&(o.topic=n)}),B(`[ChatPersistenceManager] Applied AI topic to chat file: ${e.path}`)}catch(n){ne("[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}};Or();SJ();CX();var eke=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=QFe.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&&(B(`[ChatManager] Project changed from ${this.lastKnownProjectId} to ${e}`),this.lastKnownProjectId=e),!this.projectMessageRepos.has(r)){B(`[ChatManager] Creating new message repository for project: ${r}`);let o=new sY;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(!ae().enableCustomPromptTemplating)return{processedPrompt:e,includedFiles:[]};try{let i=await gce(e,"",r,n,!0);return{processedPrompt:i.processedPrompt.trimEnd(),includedFiles:i.includedFiles}}catch(i){return Be("[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:(B("[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}`:(B("[ChatManager] basePromptWithMemory does not end with systemPromptWithoutMemory; returning original base prompt."),r)}async getSystemPromptForMessage(e,r,n){let o=z1e(),i=[],a=await MD(this.chainManager.userMemoryManager),s=PD(),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=Uu();if(l){let c=await Nm.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>`;return c&&(f+=`
|
||
|
||
<project_context>
|
||
${c}
|
||
</project_context>`),{processedPrompt:f,includedFiles:i}}}return{processedPrompt:u,includedFiles:i}}buildWebTabsWithActiveSnapshot(e,r){let n=aJr(e);if(!r)return n;try{let a=ed(this.plugin.app).getActiveWebTabState().activeWebTabForMentions,s=SX(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=>SX(c.url)===s);if(l>=0){let c=u[l];return u[l]={...c,url:Dy(a?.url)??c.url,title:a?.title??c.title,faviconUrl:a?.faviconUrl??c.faviconUrl,isActive:!0},u}return[...u,{url:Dy(a?.url)??s,title:a?.title,faviconUrl:a?.faviconUrl,isActive:!0}]}catch(o){return Be("[ChatManager] Failed to resolve active web tab:",o),n}}async sendMessage(e,r,n,o=!1,i=!1,a,s){try{B(`[ChatManager] Sending message: "${e}"`);let u=this.plugin.app.workspace.getActiveFile(),l={...r};if(o&&u){let _=r.notes||[],w=_.some(O=>O.path===u.path);l.notes=w?_:[..._,u]}let d=!((l.selectedTextContexts||[]).length>0)&&(i||e.includes(Lee));l.webTabs=this.buildWebTabsWithActiveSnapshot(l.webTabs||[],d);let f=this.getCurrentMessageRepo(),p=f.addMessage(e,e,Ws,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),B(`[ChatManager] Successfully sent message ${p}`),p}catch(u){throw B("[ChatManager] Error sending message:",u),u}}async editMessage(e,r,n,o=!1){try{B(`[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(),B(`[ChatManager] Successfully edited message ${e}`),!0}catch(i){return B(`[ChatManager] Error editing message ${e}:`,i),!1}}async regenerateMessage(e,r,n,o){try{B(`[ChatManager] Regenerating message ${e}`);let i=this.getCurrentMessageRepo();if(!i.getMessage(e))return B(`[ChatManager] Message not found: ${e}`),!1;let s=i.getDisplayMessages(),u=s.findIndex(f=>f.id===e);if(u<=0)return B("[ChatManager] Cannot regenerate first message or no user message found"),!1;let l=s[u-1];if(l.sender!==Ws)return B("[ChatManager] Previous message is not from user"),!1;if(i.truncateAfter(u-1),o&&o(),await this.updateChainMemory(),!l.id)return B("[ChatManager] User message has no ID for regeneration"),!1;let c=i.getLLMMessage(l.id);if(!c)return B("[ChatManager] LLM message not found for regeneration"),!1;let d=new AbortController;return await this.chainManager.runChain(c,d,r,n,{debug:ae().debug}),B(`[ChatManager] Successfully regenerated message ${e}`),!0}catch(i){return B(`[ChatManager] Error regenerating message ${e}:`,i),!1}}async deleteMessage(e){try{return B(`[ChatManager] Deleting message ${e}`),this.getCurrentMessageRepo().deleteMessage(e)?(await this.updateChainMemory(),B(`[ChatManager] Successfully deleted message ${e}`),!0):!1}catch(r){return B(`[ChatManager] Error deleting message ${e}:`,r),!1}}addMessage(e){return this.getCurrentMessageRepo().addMessage(e)}clearMessages(){this.getCurrentMessageRepo().clear(),this.chainManager.memoryManager.clearChatMemory(),B("[ChatManager] Cleared all messages")}async truncateAfterMessageId(e){this.getCurrentMessageRepo().truncateAfterMessageId(e),await this.updateChainMemory(),B(`[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 nrn(r,this.chainManager.memoryManager),B(`[ChatManager] Updated chain memory with ${r.length} messages`)}catch(e){B("[ChatManager] Error updating chain memory:",e)}}async loadMessages(e){let r=this.getCurrentMessageRepo();r.clear(),e.forEach(n=>{r.addMessage(n)}),await this.updateChainMemory(),B(`[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();B(`[ChatManager] Handling project switch to: ${e}`),this.lastKnownProjectId=null;let r=this.getCurrentMessageRepo();await this.updateChainMemory(),B(`[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(),B(`[ChatManager] Loaded ${r.length} messages from chat history`)}};hN();_t();Ez();eje();F1();Nv();SJ();kmt();D$();var tke=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=wX(e),o=n.url;if(this.isValidUrl(o))r.consecutiveInvalidUrlChecks=0;else{r.consecutiveEmptyChecks=0,this.maybeClearSelectionForInvalidUrl(e,r);return}let i=await _De(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 vDe(e);if(!a.trim()||this.shouldSuppressSelectionForUrl(o,i))return;r.lastSelection={url:o,text:i};let s={id:Zm(),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=wX(e);this.suppressSelectionForUrl(r.url)}};Am();Or();ot();_t();var Ife=require("obsidian"),Jvt=L(X()),don=L(dd());var rke=class extends vl{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")}};to();var cfe=L(X());kn();var lrn=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>cfe.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:Te("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")},cfe.default.createElement("div",{className:Te("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),cfe.default.createElement("span",{className:Te("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)),crn=({id:t,children:e,isSelected:r})=>r?cfe.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:Te("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 Pw=L(X()),drn=(0,Pw.createContext)(void 0),frn=({children:t})=>{let[e,r]=(0,Pw.useState)("basic"),[n,o]=(0,Pw.useState)(null),i=(0,Pw.useRef)(!1);return(0,Pw.useEffect)(()=>{if(!i.current){let a=document.querySelector(".modal-container");o(a),i.current=!0}},[]),Pw.default.createElement(drn.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},SB=()=>{let t=(0,Pw.useContext)(drn);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};ot();var Et=L(X());to();var eu=L(X());to();kn();var rd=L(X());var He=L(X()),N3=L(cu());var td=L(X());function mrn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,td.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var dfe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function E3(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function nke(t){return"nodeType"in t}function Bb(t){var e,r;return t?E3(t)?t:nke(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function oke(t){let{Document:e}=Bb(t);return t instanceof e}function uY(t){return E3(t)?!1:t instanceof Bb(t).HTMLElement}function Cvt(t){return t instanceof Bb(t).SVGElement}function P3(t){return t?E3(t)?t.document:nke(t)?oke(t)?t:uY(t)||Cvt(t)?t.ownerDocument:document:document:document}var $0=dfe?td.useLayoutEffect:td.useEffect;function ike(t){let e=(0,td.useRef)(t);return $0(()=>{e.current=t}),(0,td.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 hrn(){let t=(0,td.useRef)(null),e=(0,td.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,td.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function lY(t,e){e===void 0&&(e=[t]);let r=(0,td.useRef)(t);return $0(()=>{r.current!==t&&(r.current=t)},e),r}function cY(t,e){let r=(0,td.useRef)();return(0,td.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function ffe(t){let e=ike(t),r=(0,td.useRef)(null),n=(0,td.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function ake(t){let e=(0,td.useRef)();return(0,td.useEffect)(()=>{e.current=t},[t]),e.current}var Svt={};function M3(t,e){return(0,td.useMemo)(()=>{if(e)return e;let r=Svt[t]==null?0:Svt[t]+1;return Svt[t]=r,t+"-"+r},[t,e])}function grn(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 I3=grn(1),R3=grn(-1);function Vhi(t){return"clientX"in t&&"clientY"in t}function pfe(t){if(!t)return!1;let{KeyboardEvent:e}=Bb(t.target);return e&&t instanceof e}function Hhi(t){if(!t)return!1;let{TouchEvent:e}=Bb(t.target);return e&&t instanceof e}function ske(t){if(Hhi(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 Vhi(t)?{x:t.clientX,y:t.clientY}:null}var D0=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[D0.Translate.toString(t),D0.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:r,easing:n}=t;return e+" "+r+"ms "+n}}}),prn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function yrn(t){return t.matches(prn)?t:t.querySelector(prn)}var A3=L(X()),Jhi={display:"none"};function brn(t){let{id:e,value:r}=t;return A3.default.createElement("div",{id:e,style:Jhi},r)}function _rn(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 A3.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function vrn(){let[t,e]=(0,A3.useState)("");return{announce:(0,A3.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var Nrn=(0,He.createContext)(null);function Whi(t){let e=(0,He.useContext)(Nrn);(0,He.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Khi(){let[t]=(0,He.useState)(()=>new Set),e=(0,He.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,He.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 Ghi={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.
|
||
`},Xhi={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 Zhi(t){let{announcements:e=Xhi,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Ghi}=t,{announce:i,announcement:a}=vrn(),s=M3("DndLiveRegion"),[u,l]=(0,He.useState)(!1);if((0,He.useEffect)(()=>{l(!0)},[]),Whi((0,He.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=He.default.createElement(He.default.Fragment,null,He.default.createElement(brn,{id:n,value:o.draggable}),He.default.createElement(_rn,{id:s,announcement:a}));return r?(0,N3.createPortal)(c,r):c}var Wm;(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"})(Wm||(Wm={}));function lke(){}function dY(t,e){return(0,He.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function dke(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,He.useMemo)(()=>[...e].filter(n=>n!=null),[...e])}var Jx=Object.freeze({x:0,y:0});function jrn(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Drn(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function Yhi(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function wrn(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 Avt(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function Srn(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 fY=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=Srn(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=jrn(Srn(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(Drn)},$rn=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=wrn(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=wrn(u),c=o.reduce((f,p,m)=>f+jrn(l[m],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(Drn)};function Qhi(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 egi=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=Qhi(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(Yhi)};function tgi(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function Lrn(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Jx}function rgi(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 ngi=rgi(1);function ogi(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 igi(t,e,r){let n=ogi(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 agi={ignoreTransform:!1};function $3(t,e){e===void 0&&(e=agi);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=Bb(t).getComputedStyle(t);l&&(r=igi(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 Crn(t){return $3(t,{ignoreTransform:!0})}function sgi(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function ugi(t,e){return e===void 0&&(e=Bb(t).getComputedStyle(t)),e.position==="fixed"}function lgi(t,e){e===void 0&&(e=Bb(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 bfe(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(oke(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!uY(o)||Cvt(o)||r.includes(o))return r;let i=Bb(t).getComputedStyle(o);return o!==t&&lgi(o,i)&&r.push(o),ugi(o,i)?r:n(o.parentNode)}return t?n(t):r}function Frn(t){let[e]=bfe(t,1);return e??null}function xvt(t){return!dfe||!t?null:E3(t)?t:nke(t)?oke(t)||t===P3(t).scrollingElement?window:uY(t)?t:null:null}function krn(t){return E3(t)?t.scrollX:t.scrollLeft}function qrn(t){return E3(t)?t.scrollY:t.scrollTop}function Evt(t){return{x:krn(t),y:qrn(t)}}var Vh;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Vh||(Vh={}));function Urn(t){return!dfe||!t?!1:t===document.scrollingElement}function Brn(t){let e={x:0,y:0},r=Urn(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 cgi={x:.2,y:.2};function dgi(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=cgi);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=Brn(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=Vh.Backward,m.y=n*Math.abs((e.top+h.height-i)/h.height)):!c&&u>=e.bottom-h.height&&(p.y=Vh.Forward,m.y=n*Math.abs((e.bottom-h.height-u)/h.height)),!f&&s>=e.right-h.width?(p.x=Vh.Forward,m.x=n*Math.abs((e.right-h.width-s)/h.width)):!d&&a<=e.left+h.width&&(p.x=Vh.Backward,m.x=n*Math.abs((e.left+h.width-a)/h.width)),{direction:p,speed:m}}function fgi(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 zrn(t){return t.reduce((e,r)=>I3(e,Evt(r)),Jx)}function pgi(t){return t.reduce((e,r)=>e+krn(r),0)}function mgi(t){return t.reduce((e,r)=>e+qrn(r),0)}function hgi(t,e){if(e===void 0&&(e=$3),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);Frn(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var ggi=[["x",["left","right"],pgi],["y",["top","bottom"],mgi]],hfe=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=bfe(r),o=zrn(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of ggi)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})}},j3=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 ygi(t){let{EventTarget:e}=Bb(t);return t instanceof e?t:P3(t)}function Ovt(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 L0;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(L0||(L0={}));function xrn(t){t.preventDefault()}function bgi(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 Vrn={start:[Ui.Space,Ui.Enter],cancel:[Ui.Esc],end:[Ui.Space,Ui.Enter,Ui.Tab]},_gi=(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}}},xB=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 j3(P3(r)),this.windowListeners=new j3(Bb(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(L0.Resize,this.handleCancel),this.windowListeners.add(L0.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(L0.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:r}=this.props,n=e.node.current;n&&hgi(n),r(Jx)}handleKeyDown(e){if(pfe(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=Vrn,coordinateGetter:a=_gi,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}:Jx;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=R3(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:O,minScroll:T}=Brn(h),P=fgi(h),M={x:Math.min(y===Ui.Right?P.right-P.width/2:P.right,Math.max(y===Ui.Right?P.left:P.left+P.width/2,d.x)),y:Math.min(y===Ui.Down?P.bottom-P.height/2:P.bottom,Math.max(y===Ui.Down?P.top:P.top+P.height/2,d.y))},I=y===Ui.Right&&!b||y===Ui.Left&&!_,j=y===Ui.Down&&!w||y===Ui.Up&&!g;if(I&&M.x!==d.x){let A=h.scrollLeft+f.x,k=y===Ui.Right&&A<=O.x||y===Ui.Left&&A>=T.x;if(k&&!f.y){h.scrollTo({left:A,behavior:s});return}k?p.x=h.scrollLeft-A:p.x=y===Ui.Right?h.scrollLeft-O.x:h.scrollLeft-T.x,p.x&&h.scrollBy({left:-p.x,behavior:s});break}else if(j&&M.y!==d.y){let A=h.scrollTop+f.y,k=y===Ui.Down&&A<=O.y||y===Ui.Up&&A>=T.y;if(k&&!f.x){h.scrollTo({top:A,behavior:s});return}k?p.y=h.scrollTop-A:p.y=y===Ui.Down?h.scrollTop-O.y:h.scrollTop-T.y,p.y&&h.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,I3(R3(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()}};xB.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=Vrn,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 Orn(t){return!!(t&&"distance"in t)}function Trn(t){return!!(t&&"delay"in t)}var gfe=class{constructor(e,r,n){var o;n===void 0&&(n=ygi(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=P3(a),this.documentListeners=new j3(this.document),this.listeners=new j3(n),this.windowListeners=new j3(Bb(a)),this.initialCoordinates=(o=ske(i))!=null?o:Jx,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(L0.Resize,this.handleCancel),this.windowListeners.add(L0.DragStart,xrn),this.windowListeners.add(L0.VisibilityChange,this.handleCancel),this.windowListeners.add(L0.ContextMenu,xrn),this.documentListeners.add(L0.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Trn(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Orn(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(L0.Click,bgi,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(L0.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=ske(e))!=null?r:Jx,l=R3(o,u);if(!n&&s){if(Orn(s)){if(s.tolerance!=null&&Ovt(l,s.tolerance))return this.handleCancel();if(Ovt(l,s.distance))return this.handleStart()}if(Trn(s)&&Ovt(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()}},vgi={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},OB=class extends gfe{constructor(e){let{event:r}=e,n=P3(r.target);super(e,vgi,n)}};OB.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 wgi={move:{name:"mousemove"},end:{name:"mouseup"}},Pvt;(function(t){t[t.RightClick=2]="RightClick"})(Pvt||(Pvt={}));var Mvt=class extends gfe{constructor(e){super(e,wgi,P3(e.event.target))}};Mvt.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===Pvt.RightClick?!1:(n?.({event:r}),!0)}}];var Tvt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Ivt=class extends gfe{constructor(e){super(e,Tvt)}static setup(){return window.addEventListener(Tvt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Tvt.move.name,e)};function e(){}}};Ivt.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 mfe;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(mfe||(mfe={}));var cke;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(cke||(cke={}));function Sgi(t){let{acceleration:e,activator:r=mfe.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=cke.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=xgi({delta:d,disabled:!i}),[m,h]=hrn(),y=(0,He.useRef)({x:0,y:0}),g=(0,He.useRef)({x:0,y:0}),b=(0,He.useMemo)(()=>{switch(r){case mfe.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case mfe.DraggableRect:return o}},[r,o,u]),_=(0,He.useRef)(null),w=(0,He.useCallback)(()=>{let T=_.current;if(!T)return;let P=y.current.x*g.current.x,M=y.current.y*g.current.y;T.scrollBy(P,M)},[]),O=(0,He.useMemo)(()=>s===cke.TreeOrder?[...l].reverse():l,[s,l]);(0,He.useEffect)(()=>{if(!i||!l.length||!b){h();return}for(let T of O){if(n?.(T)===!1)continue;let P=l.indexOf(T),M=c[P];if(!M)continue;let{direction:I,speed:j}=dgi(T,M,b,e,f);for(let A of["x","y"])p[A][I[A]]||(j[A]=0,I[A]=0);if(j.x>0||j.y>0){h(),_.current=T,m(w,a),y.current=j,g.current=I;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,O,c,JSON.stringify(f)])}var Cgi={x:{[Vh.Backward]:!1,[Vh.Forward]:!1},y:{[Vh.Backward]:!1,[Vh.Forward]:!1}};function xgi(t){let{delta:e,disabled:r}=t,n=ake(e);return cY(o=>{if(r||!n||!o)return Cgi;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[Vh.Backward]:o.x[Vh.Backward]||i.x===-1,[Vh.Forward]:o.x[Vh.Forward]||i.x===1},y:{[Vh.Backward]:o.y[Vh.Backward]||i.y===-1,[Vh.Forward]:o.y[Vh.Forward]||i.y===1}}},[r,e,n])}function Ogi(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return cY(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function Tgi(t,e){return(0,He.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 yfe;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(yfe||(yfe={}));var Rvt;(function(t){t.Optimized="optimized"})(Rvt||(Rvt={}));var Ern=new Map;function Egi(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,He.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,He.useRef)(t),d=y(),f=lY(d),p=(0,He.useCallback)(function(g){g===void 0&&(g=[]),!f.current&&a(b=>b===null?g:b.concat(g.filter(_=>!b.includes(_))))},[f]),m=(0,He.useRef)(null),h=cY(g=>{if(d&&!r)return Ern;if(!g||g===Ern||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,O=w?new hfe(u(w),w):null;_.rect.current=O,O&&b.set(_.id,O)}return b}return g},[t,i,r,d,u]);return(0,He.useEffect)(()=>{c.current=t},[t]),(0,He.useEffect)(()=>{d||p()},[r,d]),(0,He.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,He.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 yfe.Always:return!1;case yfe.BeforeDragging:return r;default:return!r}}}function Hrn(t,e){return cY(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function Pgi(t,e){return Hrn(t,e)}function Mgi(t){let{callback:e,disabled:r}=t,n=ike(e),o=(0,He.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,He.useEffect)(()=>()=>o?.disconnect(),[o]),o}function fke(t){let{callback:e,disabled:r}=t,n=ike(e),o=(0,He.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,He.useEffect)(()=>()=>o?.disconnect(),[o]),o}function Igi(t){return new hfe($3(t),t)}function Prn(t,e,r){e===void 0&&(e=Igi);let[n,o]=(0,He.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=Mgi({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=fke({callback:i});return $0(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function Rgi(t){let e=Hrn(t);return Lrn(t,e)}var Mrn=[];function Agi(t){let e=(0,He.useRef)(t),r=cY(n=>t?n&&n!==Mrn&&t&&e.current&&t.parentNode===e.current.parentNode?n:bfe(t):Mrn,[t]);return(0,He.useEffect)(()=>{e.current=t},[t]),r}function Ngi(t){let[e,r]=(0,He.useState)(null),n=(0,He.useRef)(t),o=(0,He.useCallback)(i=>{let a=xvt(i.target);a&&r(s=>s?(s.set(a,Evt(a)),new Map(s)):null)},[]);return(0,He.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=xvt(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,Evt(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=xvt(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,He.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>I3(i,a),Jx):zrn(t):Jx,[t,e])}function Irn(t,e){e===void 0&&(e=[]);let r=(0,He.useRef)(null);return(0,He.useEffect)(()=>{r.current=null},e),(0,He.useEffect)(()=>{let n=t!==Jx;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?R3(t,r.current):Jx}function jgi(t){(0,He.useEffect)(()=>{if(!dfe)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 Dgi(t,e){return(0,He.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function Jrn(t){return(0,He.useMemo)(()=>t?sgi(t):null,[t])}var Rrn=[];function $gi(t,e){e===void 0&&(e=$3);let[r]=t,n=Jrn(r?Bb(r):null),[o,i]=(0,He.useState)(Rrn);function a(){i(()=>t.length?t.map(u=>Urn(u)?n:new hfe(e(u),u)):Rrn)}let s=fke({callback:a});return $0(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function Lgi(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return uY(e)?e:t}function Fgi(t){let{measure:e}=t,[r,n]=(0,He.useState)(null),o=(0,He.useCallback)(l=>{for(let{target:c}of l)if(uY(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=fke({callback:o}),a=(0,He.useCallback)(l=>{let c=Lgi(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=ffe(a);return(0,He.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var kgi=[{sensor:OB,options:{}},{sensor:xB,options:{}}],qgi={current:{}},uke={draggable:{measure:Crn},droppable:{measure:Crn,strategy:yfe.WhileDragging,frequency:Rvt.Optimized},dragOverlay:{measure:$3}},D3=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}},Ugi={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new D3,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:lke},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:uke,measureDroppableContainers:lke,windowRect:null,measuringScheduled:!1},Bgi={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:lke,draggableNodes:new Map,over:null,measureDroppableContainers:lke},pke=(0,He.createContext)(Bgi),Wrn=(0,He.createContext)(Ugi);function zgi(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new D3}}}function Vgi(t,e){switch(e.type){case Wm.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Wm.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 Wm.DragEnd:case Wm.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Wm.RegisterDroppable:{let{element:r}=e,{id:n}=r,o=new D3(t.droppable.containers);return o.set(n,r),{...t,droppable:{...t.droppable,containers:o}}}case Wm.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 D3(t.droppable.containers);return a.set(r,{...i,disabled:o}),{...t,droppable:{...t.droppable,containers:a}}}case Wm.UnregisterDroppable:{let{id:r,key:n}=e,o=t.droppable.containers.get(r);if(!o||n!==o.key)return t;let i=new D3(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function Hgi(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,He.useContext)(pke),i=ake(n),a=ake(r?.id);return(0,He.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!pfe(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=yrn(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function Jgi(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function Wgi(t){return(0,He.useMemo)(()=>({draggable:{...uke.draggable,...t?.draggable},droppable:{...uke.droppable,...t?.droppable},dragOverlay:{...uke.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function Kgi(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,He.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;$0(()=>{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=Lrn(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=Frn(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var Krn=(0,He.createContext)({...Jx,scaleX:1,scaleY:1}),CB;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(CB||(CB={}));var pY=(0,He.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=kgi,collisionDetection:d=egi,measuring:f,modifiers:p,...m}=e,h=(0,He.useReducer)(Vgi,void 0,zgi),[y,g]=h,[b,_]=Khi(),[w,O]=(0,He.useState)(CB.Uninitialized),T=w===CB.Initialized,{draggable:{active:P,nodes:M,translate:I},droppable:{containers:j}}=y,A=P!=null?M.get(P):null,k=(0,He.useRef)({initial:null,translated:null}),V=(0,He.useMemo)(()=>{var Ei;return P!=null?{id:P,data:(Ei=A?.data)!=null?Ei:qgi,rect:k}:null},[P,A]),q=(0,He.useRef)(null),[J,K]=(0,He.useState)(null),[ue,oe]=(0,He.useState)(null),G=lY(m,Object.values(m)),Y=M3("DndDescribedBy",a),se=(0,He.useMemo)(()=>j.getEnabled(),[j]),ie=Wgi(f),{droppableRects:$,measureDroppableContainers:H,measuringScheduled:re}=Egi(se,{dragging:T,dependencies:[I.x,I.y],config:ie.droppable}),D=Ogi(M,P),R=(0,He.useMemo)(()=>ue?ske(ue):null,[ue]),z=Ti(),U=Pgi(D,ie.draggable.measure);Kgi({activeNode:P!=null?M.get(P):null,config:z.layoutShiftCompensation,initialRect:U,measure:ie.draggable.measure});let ee=Prn(D,ie.draggable.measure,U),ce=Prn(D?D.parentElement:null),ve=(0,He.useRef)({activatorEvent:null,active:null,activeNode:D,collisionRect:null,collisions:null,droppableRects:$,draggableNodes:M,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Oe=j.getNodeFor((r=ve.current.over)==null?void 0:r.id),Je=Fgi({measure:ie.dragOverlay.measure}),tt=(n=Je.nodeRef.current)!=null?n:D,Ke=T?(o=Je.rect)!=null?o:ee:null,dt=!!(Je.nodeRef.current&&Je.rect),Pt=Rgi(dt?null:ee),Nt=Jrn(tt?Bb(tt):null),Ne=Agi(T?Oe??D:null),Tr=$gi(Ne),st=Jgi(p,{transform:{x:I.x-Pt.x,y:I.y-Pt.y,scaleX:1,scaleY:1},activatorEvent:ue,active:V,activeNodeRect:ee,containerNodeRect:ce,draggingNodeRect:Ke,over:ve.current.over,overlayNodeRect:Je.rect,scrollableAncestors:Ne,scrollableAncestorRects:Tr,windowRect:Nt}),Le=R?I3(R,I):null,rt=Ngi(Ne),Fe=Irn(rt),We=Irn(rt,[ee]),ke=I3(st,Fe),Lt=Ke?ngi(Ke,st):null,Eo=V&&Lt?d({active:V,collisionRect:Lt,droppableRects:$,droppableContainers:se,pointerCoordinates:Le}):null,xl=Avt(Eo,"id"),[In,hi]=(0,He.useState)(null),Gm=dt?st:I3(st,We),Fs=tgi(Gm,(i=In?.rect)!=null?i:null,ee),Vb=(0,He.useRef)(null),Jh=(0,He.useCallback)((Ei,tu)=>{let{sensor:Pi,options:tl}=tu;if(q.current==null)return;let rl=M.get(q.current);if(!rl)return;let Ol=Ei.nativeEvent,Xm=new Pi({active:q.current,activeNode:rl,event:Ol,options:tl,context:ve,onAbort(Ge){if(!M.get(Ge))return;let{onDragAbort:yr}=G.current,ii={id:Ge};yr?.(ii),b({type:"onDragAbort",event:ii})},onPending(Ge,Ee,yr,ii){if(!M.get(Ge))return;let{onDragPending:cv}=G.current,gi={id:Ge,constraint:Ee,initialCoordinates:yr,offset:ii};cv?.(gi),b({type:"onDragPending",event:gi})},onStart(Ge){let Ee=q.current;if(Ee==null)return;let yr=M.get(Ee);if(!yr)return;let{onDragStart:ii}=G.current,is={activatorEvent:Ol,active:{id:Ee,data:yr.data,rect:k}};(0,N3.unstable_batchedUpdates)(()=>{ii?.(is),O(CB.Initializing),g({type:Wm.DragStart,initialCoordinates:Ge,active:Ee}),b({type:"onDragStart",event:is}),K(Vb.current),oe(Ol)})},onMove(Ge){g({type:Wm.DragMove,coordinates:Ge})},onEnd:Ft(Wm.DragEnd),onCancel:Ft(Wm.DragCancel)});Vb.current=Xm;function Ft(Ge){return async function(){let{active:yr,collisions:ii,over:is,scrollAdjustedTranslate:cv}=ve.current,gi=null;if(yr&&cv){let{cancelDrop:U0}=G.current;gi={activatorEvent:Ol,active:yr,collisions:ii,delta:cv,over:is},Ge===Wm.DragEnd&&typeof U0=="function"&&await Promise.resolve(U0(gi))&&(Ge=Wm.DragCancel)}q.current=null,(0,N3.unstable_batchedUpdates)(()=>{g({type:Ge}),O(CB.Uninitialized),hi(null),K(null),oe(null),Vb.current=null;let U0=Ge===Wm.DragEnd?"onDragEnd":"onDragCancel";if(gi){let SY=G.current[U0];SY?.(gi),b({type:U0,event:gi})}})}}},[M]),Mw=(0,He.useCallback)((Ei,tu)=>(Pi,tl)=>{let rl=Pi.nativeEvent,Ol=M.get(tl);if(q.current!==null||!Ol||rl.dndKit||rl.defaultPrevented)return;let Xm={active:Ol};Ei(Pi,tu.options,Xm)===!0&&(rl.dndKit={capturedBy:tu.sensor},q.current=tl,Jh(Pi,tu))},[M,Jh]),zi=Tgi(c,Mw);jgi(c),$0(()=>{ee&&w===CB.Initializing&&O(CB.Initialized)},[ee,w]),(0,He.useEffect)(()=>{let{onDragMove:Ei}=G.current,{active:tu,activatorEvent:Pi,collisions:tl,over:rl}=ve.current;if(!tu||!Pi)return;let Ol={active:tu,activatorEvent:Pi,collisions:tl,delta:{x:ke.x,y:ke.y},over:rl};(0,N3.unstable_batchedUpdates)(()=>{Ei?.(Ol),b({type:"onDragMove",event:Ol})})},[ke.x,ke.y]),(0,He.useEffect)(()=>{let{active:Ei,activatorEvent:tu,collisions:Pi,droppableContainers:tl,scrollAdjustedTranslate:rl}=ve.current;if(!Ei||q.current==null||!tu||!rl)return;let{onDragOver:Ol}=G.current,Xm=tl.get(xl),Ft=Xm&&Xm.rect.current?{id:Xm.id,rect:Xm.rect.current,data:Xm.data,disabled:Xm.disabled}:null,Ge={active:Ei,activatorEvent:tu,collisions:Pi,delta:{x:rl.x,y:rl.y},over:Ft};(0,N3.unstable_batchedUpdates)(()=>{hi(Ft),Ol?.(Ge),b({type:"onDragOver",event:Ge})})},[xl]),$0(()=>{ve.current={activatorEvent:ue,active:V,activeNode:D,collisionRect:Lt,collisions:Eo,droppableRects:$,draggableNodes:M,draggingNode:tt,draggingNodeRect:Ke,droppableContainers:j,over:In,scrollableAncestors:Ne,scrollAdjustedTranslate:ke},k.current={initial:Ke,translated:Lt}},[V,D,Eo,Lt,M,tt,Ke,$,j,In,Ne,ke]),Sgi({...z,delta:I,draggingRect:Lt,pointerCoordinates:Le,scrollableAncestors:Ne,scrollableAncestorRects:Tr});let pt=(0,He.useMemo)(()=>({active:V,activeNode:D,activeNodeRect:ee,activatorEvent:ue,collisions:Eo,containerNodeRect:ce,dragOverlay:Je,draggableNodes:M,droppableContainers:j,droppableRects:$,over:In,measureDroppableContainers:H,scrollableAncestors:Ne,scrollableAncestorRects:Tr,measuringConfiguration:ie,measuringScheduled:re,windowRect:Nt}),[V,D,ee,ue,Eo,ce,Je,M,j,$,In,H,Ne,Tr,ie,re,Nt]),Br=(0,He.useMemo)(()=>({activatorEvent:ue,activators:zi,active:V,activeNodeRect:ee,ariaDescribedById:{draggable:Y},dispatch:g,draggableNodes:M,over:In,measureDroppableContainers:H}),[ue,zi,V,ee,g,Y,M,In,H]);return He.default.createElement(Nrn.Provider,{value:_},He.default.createElement(pke.Provider,{value:Br},He.default.createElement(Wrn.Provider,{value:pt},He.default.createElement(Krn.Provider,{value:Fs},l)),He.default.createElement(Hgi,{disabled:s?.restoreFocus===!1})),He.default.createElement(Zhi,{...s,hiddenTextDescribedById:Y}));function Ti(){let Ei=J?.autoScrollEnabled===!1,tu=typeof u=="object"?u.enabled===!1:u===!1,Pi=T&&!Ei&&!tu;return typeof u=="object"?{...u,enabled:Pi}:{enabled:Pi}}}),Ggi=(0,He.createContext)(null),Arn="button",Xgi="Draggable";function Grn(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=M3(Xgi),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,He.useContext)(pke),{role:p=Arn,roleDescription:m="draggable",tabIndex:h=0}=o??{},y=u?.id===e,g=(0,He.useContext)(y?Krn:Ggi),[b,_]=ffe(),[w,O]=ffe(),T=Dgi(a,e),P=lY(r);$0(()=>(d.set(e,{id:e,key:i,node:b,activatorNode:w,data:P}),()=>{let I=d.get(e);I&&I.key===i&&d.delete(e)}),[d,e]);let M=(0,He.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":y&&p===Arn?!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:M,isDragging:y,listeners:n?void 0:T,node:b,over:f,setNodeRef:_,setActivatorNodeRef:O,transform:g}}function Xrn(){return(0,He.useContext)(Wrn)}var Zgi="Droppable",Ygi={timeout:25};function Zrn(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=M3(Zgi),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,He.useContext)(pke),c=(0,He.useRef)({disabled:r}),d=(0,He.useRef)(!1),f=(0,He.useRef)(null),p=(0,He.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:y}={...Ygi,...o},g=lY(h??n),b=(0,He.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]),_=fke({callback:b,disabled:m||!a}),w=(0,He.useCallback)((M,I)=>{_&&(I&&(_.unobserve(I),d.current=!1),M&&_.observe(M))},[_]),[O,T]=ffe(w),P=lY(e);return(0,He.useEffect)(()=>{!_||!O.current||(_.disconnect(),d.current=!1,_.observe(O.current))},[O,_]),(0,He.useEffect)(()=>(s({type:Wm.RegisterDroppable,element:{id:n,key:i,disabled:r,node:O,rect:f,data:P}}),()=>s({type:Wm.UnregisterDroppable,key:i,id:n})),[n]),(0,He.useEffect)(()=>{r!==c.current.disabled&&(s({type:Wm.SetDroppableDisabled,id:n,key:i,disabled:r}),c.current.disabled=r)},[n,i,r,s]),{active:a,rect:f,isOver:u?.id===n,node:O,over:u,setNodeRef:T}}function yke(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function Qgi(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function mke(t){return t!==null&&t>=0}function eyi(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 tyi(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var Yrn=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=yke(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 hke={scaleX:1,scaleY:1},mY=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,...hke}:null}let u=ryi(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...hke}:o<r&&o>=a?{x:0,y:s.height+u,...hke}:{x:0,y:0,...hke}};function ryi(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 Qrn="Sortable",enn=rd.default.createContext({activeIndex:-1,containerId:Qrn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Yrn,disabled:{draggable:!1,droppable:!1}});function hY(t){let{children:e,id:r,items:n,strategy:o=Yrn,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=Xrn(),d=M3(Qrn,r),f=s.rect!==null,p=(0,rd.useMemo)(()=>n.map(T=>typeof T=="object"&&"id"in T?T.id:T),[n]),m=a!=null,h=a?p.indexOf(a.id):-1,y=l?p.indexOf(l.id):-1,g=(0,rd.useRef)(p),b=!eyi(p,g.current),_=y!==-1&&h===-1||b,w=tyi(i);$0(()=>{b&&m&&c(p)},[b,p,m,c]),(0,rd.useEffect)(()=>{g.current=p},[p]);let O=(0,rd.useMemo)(()=>({activeIndex:h,containerId:d,disabled:w,disableTransforms:_,items:p,overIndex:y,useDragOverlay:f,sortedRects:Qgi(p,u),strategy:o}),[h,d,w.draggable,w.droppable,_,p,y,u,f,o]);return rd.default.createElement(enn.Provider,{value:O},e)}var nyi=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return yke(r,n,o).indexOf(e)},oyi=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},iyi={duration:200,easing:"ease"},tnn="transform",ayi=D0.Transition.toString({property:tnn,duration:0,easing:"linear"}),syi={roleDescription:"sortable"};function uyi(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,rd.useState)(null),s=(0,rd.useRef)(r);return $0(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=$3(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,rd.useEffect)(()=>{i&&a(null)},[i]),i}function gY(t){let{animateLayoutChanges:e=oyi,attributes:r,disabled:n,data:o,getNewIndex:i=nyi,id:a,strategy:s,resizeObserverConfig:u,transition:l=iyi}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:y,useDragOverlay:g,strategy:b}=(0,rd.useContext)(enn),_=lyi(n,p),w=c.indexOf(a),O=(0,rd.useMemo)(()=>({sortable:{containerId:d,index:w,items:c},...o}),[d,o,w,c]),T=(0,rd.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:P,node:M,isOver:I,setNodeRef:j}=Zrn({id:a,data:O,disabled:_.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...u}}),{active:A,activatorEvent:k,activeNodeRect:V,attributes:q,setNodeRef:J,listeners:K,isDragging:ue,over:oe,setActivatorNodeRef:G,transform:Y}=Grn({id:a,data:O,attributes:{...syi,...r},disabled:_.draggable}),se=mrn(j,J),ie=!!A,$=ie&&!m&&mke(f)&&mke(y),H=!g&&ue,re=H&&$?Y:null,R=$?re??(s??b)({rects:h,activeNodeRect:V,activeIndex:f,overIndex:y,index:w}):null,z=mke(f)&&mke(y)?i({id:a,items:c,activeIndex:f,overIndex:y}):w,U=A?.id,ee=(0,rd.useRef)({activeId:U,items:c,newIndex:z,containerId:d}),ce=c!==ee.current.items,ve=e({active:A,containerId:d,isDragging:ue,isSorting:ie,id:a,index:w,items:c,newIndex:ee.current.newIndex,previousItems:ee.current.items,previousContainerId:ee.current.containerId,transition:l,wasDragging:ee.current.activeId!=null}),Oe=uyi({disabled:!ve,index:w,node:M,rect:P});return(0,rd.useEffect)(()=>{ie&&ee.current.newIndex!==z&&(ee.current.newIndex=z),d!==ee.current.containerId&&(ee.current.containerId=d),c!==ee.current.items&&(ee.current.items=c)},[ie,z,d,c]),(0,rd.useEffect)(()=>{if(U===ee.current.activeId)return;if(U!=null&&ee.current.activeId==null){ee.current.activeId=U;return}let tt=setTimeout(()=>{ee.current.activeId=U},50);return()=>clearTimeout(tt)},[U]),{active:A,activeIndex:f,attributes:q,data:O,rect:P,index:w,newIndex:z,items:c,isOver:I,isSorting:ie,isDragging:ue,listeners:K,node:M,overIndex:y,over:oe,setNodeRef:se,setActivatorNodeRef:G,setDroppableNodeRef:j,setDraggableNodeRef:J,transform:Oe??R,transition:Je()};function Je(){if(Oe||ce&&ee.current.newIndex===w)return ayi;if(!(H&&!pfe(k)||!l)&&(ie||ve))return D0.Transition.toString({...l,property:tnn})}}function lyi(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 gke(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 cyi=[Ui.Down,Ui.Right,Ui.Up,Ui.Left],bke=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(cyi.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=$rn({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=Avt(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=bfe(m).some((T,P)=>s[P]!==T),g=rnn(d,f),b=dyi(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:R3(w,_)}}}};function rnn(t,e){return!gke(t)||!gke(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function dyi(t,e){return!gke(t)||!gke(e)||!rnn(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}Jr();function _ke({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,eu.useState)(u),{attributes:g,listeners:b,setNodeRef:_,transform:w,transition:O,isDragging:T}=gY({id:t,disabled:!a}),P={transform:D0.Transform.toString(w),transition:O},M=()=>{if(s){let j=!h;y(j),m?.(j)}},I=d.length>0;return eu.default.createElement(v3,{ref:_,style:P,className:Te("tw-mb-2",T&&["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)},eu.default.createElement(w3,{className:"tw-p-3"},eu.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},a&&eu.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...g,...b},eu.default.createElement(pC,{className:"tw-size-4"})),eu.default.createElement("div",{className:"tw-flex-1 tw-touch-auto",onClick:s?M:void 0,style:{cursor:s?"pointer":"default"}},eu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},s&&eu.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},h?eu.default.createElement(ts,{className:"tw-size-3 tw-stroke-[7]"}):eu.default.createElement(bm,{className:"tw-size-3 tw-stroke-[7]"})),i&&eu.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},i),eu.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},eu.default.createElement("div",{className:"tw-break-words tw-font-medium tw-leading-relaxed"},r,o&&eu.default.createElement("span",{className:"tw-ml-1 tw-inline-flex tw-items-center"},o)),n&&eu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},eu.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},n))))),eu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},c&&eu.default.createElement(ge,{variant:"ghost",size:"icon",onClick:j=>{j.stopPropagation(),c.onClick(e)},title:c.tooltip},c.icon),I&&eu.default.createElement(yA,null,eu.default.createElement(bA,{asChild:!0},eu.default.createElement(ge,{variant:"ghost",size:"icon"},eu.default.createElement(RO,{className:"tw-size-4"}))),eu.default.createElement(K_,{align:"end",container:f?.current},d.map((j,A)=>eu.default.createElement(Ii,{key:A,onClick:k=>{k.stopPropagation(),j.onClick(e)},className:Te(j.variant==="destructive"&&"tw-text-error")},eu.default.createElement("span",{className:"tw-mr-2 tw-flex tw-size-4 tw-items-center tw-justify-center"},j.icon),j.label))))))),s&&eu.default.createElement("div",{className:Te("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")},eu.default.createElement(S3,{className:"tw-p-3 tw-pt-0"},l)))}Jr();var Km=L(X());kn();var _fe=Km.forwardRef(({className:t,...e},r)=>Km.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},Km.createElement("table",{ref:r,className:Te("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));_fe.displayName="Table";var vfe=Km.forwardRef(({className:t,...e},r)=>Km.createElement("thead",{ref:r,className:Te("[&_tr]:tw-border-b",t),...e}));vfe.displayName="TableHeader";var wfe=Km.forwardRef(({className:t,...e},r)=>Km.createElement("tbody",{ref:r,className:t,...e}));wfe.displayName="TableBody";var fyi=Km.forwardRef(({className:t,...e},r)=>Km.createElement("tfoot",{ref:r,className:Te("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));fyi.displayName="TableFooter";var TB=Km.forwardRef(({className:t,...e},r)=>Km.createElement("tr",{ref:r,className:Te("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));TB.displayName="TableRow";var zb=Km.forwardRef(({className:t,...e},r)=>Km.createElement("th",{ref:r,className:Te("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}));zb.displayName="TableHead";var zy=Km.forwardRef(({className:t,...e},r)=>Km.createElement("td",{ref:r,className:Te("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));zy.displayName="TableCell";var pyi=Km.forwardRef(({className:t,...e},r)=>Km.createElement("caption",{ref:r,className:Te("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));pyi.displayName="TableCaption";kn();_t();ot();Aee();var Cl=L(X());kn();Iue();Jr();var Ug=L(X());var el=L(X(),1);var fJs=!!(typeof window<"u"&&window.document&&window.document.createElement);function yY(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var onn=L(X(),1);function nnn(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function myi(...t){return e=>{let r=!1,n=t.map(o=>{let i=nnn(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():nnn(t[o],null)}}}}function bY(...t){return onn.useCallback(myi(...t),t)}var F0=L(X(),1),Nvt=L(vr(),1);function inn(t,e){let r=F0.createContext(e),n=i=>{let{children:a,...s}=i,u=F0.useMemo(()=>s,Object.values(s));return(0,Nvt.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=F0.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 ann(t,e=[]){let r=[];function n(i,a){let s=F0.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,y=F0.useMemo(()=>m,Object.values(m));return(0,Nvt.jsx)(h.Provider,{value:y,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=F0.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=>F0.createContext(a));return function(s){let u=s?.[t]||i;return F0.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,hyi(o,...e)]}function hyi(...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 F0.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var jvt=L(X(),1);var snn=L(X(),1),L3=globalThis?.document?snn.useLayoutEffect:()=>{};var gyi=jvt[" useId ".trim().toString()]||(()=>{}),yyi=0;function vke(t){let[e,r]=jvt.useState(gyi());return L3(()=>{t||r(n=>n??String(yyi++))},[t]),t||(e?`radix-${e}`:"")}var k0=L(X(),1);var wke=L(X(),1);var byi=k0[" useInsertionEffect ".trim().toString()]||L3;function unn({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=_yi({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=k0.useRef(t!==void 0);k0.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=k0.useCallback(c=>{if(s){let d=vyi(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function _yi({defaultProp:t,onChange:e}){let[r,n]=k0.useState(t),o=k0.useRef(r),i=k0.useRef(e);return byi(()=>{i.current=e},[e]),k0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function vyi(t){return typeof t=="function"}var vJs=Symbol("RADIX:SYNC_STATE");var uv=L(X(),1);var lnn=L(X(),1);function wyi(t,e){return lnn.useReducer((r,n)=>e[r][n]??r,t)}var Sfe=t=>{let{present:e,children:r}=t,n=Syi(e),o=typeof r=="function"?r({present:n.isPresent}):uv.Children.only(r),i=bY(n.ref,Cyi(o));return typeof r=="function"||n.isPresent?uv.cloneElement(o,{ref:i}):null};Sfe.displayName="Presence";function Syi(t){let[e,r]=uv.useState(),n=uv.useRef(null),o=uv.useRef(t),i=uv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=wyi(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return uv.useEffect(()=>{let l=Ske(n.current);i.current=s==="mounted"?l:"none"},[s]),L3(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=Ske(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),L3(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=Ske(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=Ske(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:uv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function Ske(t){return t?.animationName||"none"}function Cyi(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 cnn=L(X(),1),xyi=L(cu(),1);Vu();var dnn=L(vr(),1),Oyi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_Y=Oyi.reduce((t,e)=>{let r=Fn(`Primitive.${e}`),n=cnn.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,dnn.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});Vu();var xu=L(vr(),1),xke="Dialog",[fnn,UJs]=ann(xke),[Tyi,Wx]=fnn(xke),pnn=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=el.useRef(null),u=el.useRef(null),[l,c]=unn({prop:n,defaultProp:o??!1,onChange:i,caller:xke});return(0,xu.jsx)(Tyi,{scope:e,triggerRef:s,contentRef:u,contentId:vke(),titleId:vke(),descriptionId:vke(),open:l,onOpenChange:c,onOpenToggle:el.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};pnn.displayName=xke;var mnn="DialogTrigger",hnn=el.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Wx(mnn,r),i=bY(e,o.triggerRef);return(0,xu.jsx)(_Y.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Lvt(o.open),...n,ref:i,onClick:yY(t.onClick,o.onOpenToggle)})});hnn.displayName=mnn;var Dvt="DialogPortal",[Eyi,gnn]=fnn(Dvt,{forceMount:void 0}),ynn=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=Wx(Dvt,e);return(0,xu.jsx)(Eyi,{scope:e,forceMount:r,children:el.Children.map(n,a=>(0,xu.jsx)(Sfe,{present:r||i.open,children:(0,xu.jsx)(Ex,{asChild:!0,container:o,children:a})}))})};ynn.displayName=Dvt;var Cke="DialogOverlay",bnn=el.forwardRef((t,e)=>{let r=gnn(Cke,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=Wx(Cke,t.__scopeDialog);return i.modal?(0,xu.jsx)(Sfe,{present:n||i.open,children:(0,xu.jsx)(Myi,{...o,ref:e})}):null});bnn.displayName=Cke;var Pyi=Fn("DialogOverlay.RemoveScroll"),Myi=el.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Wx(Cke,r);return(0,xu.jsx)(QD,{as:Pyi,allowPinchZoom:!0,shards:[o.contentRef],children:(0,xu.jsx)(_Y.div,{"data-state":Lvt(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),F3="DialogContent",_nn=el.forwardRef((t,e)=>{let r=gnn(F3,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=Wx(F3,t.__scopeDialog);return(0,xu.jsx)(Sfe,{present:n||i.open,children:i.modal?(0,xu.jsx)(Iyi,{...o,ref:e}):(0,xu.jsx)(Ryi,{...o,ref:e})})});_nn.displayName=F3;var Iyi=el.forwardRef((t,e)=>{let r=Wx(F3,t.__scopeDialog),n=el.useRef(null),o=bY(e,r.contentRef,n);return el.useEffect(()=>{let i=n.current;if(i)return jU(i)},[]),(0,xu.jsx)(vnn,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:yY(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:yY(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:yY(t.onFocusOutside,i=>i.preventDefault())})}),Ryi=el.forwardRef((t,e)=>{let r=Wx(F3,t.__scopeDialog),n=el.useRef(!1),o=el.useRef(!1);return(0,xu.jsx)(vnn,{...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()}})}),vnn=el.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=Wx(F3,r),u=el.useRef(null),l=bY(e,u);return PU(),(0,xu.jsxs)(xu.Fragment,{children:[(0,xu.jsx)(WD,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,xu.jsx)(Sx,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Lvt(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,xu.jsxs)(xu.Fragment,{children:[(0,xu.jsx)(Ayi,{titleId:s.titleId}),(0,xu.jsx)(jyi,{contentRef:u,descriptionId:s.descriptionId})]})]})}),$vt="DialogTitle",wnn=el.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Wx($vt,r);return(0,xu.jsx)(_Y.h2,{id:o.titleId,...n,ref:e})});wnn.displayName=$vt;var Snn="DialogDescription",Cnn=el.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Wx(Snn,r);return(0,xu.jsx)(_Y.p,{id:o.descriptionId,...n,ref:e})});Cnn.displayName=Snn;var xnn="DialogClose",Onn=el.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=Wx(xnn,r);return(0,xu.jsx)(_Y.button,{type:"button",...n,ref:e,onClick:yY(t.onClick,()=>o.onOpenChange(!1))})});Onn.displayName=xnn;function Lvt(t){return t?"open":"closed"}var Tnn="DialogTitleWarning",[BJs,Enn]=inn(Tnn,{contentName:F3,titleName:$vt,docsSlug:"dialog"}),Ayi=({titleId:t})=>{let e=Enn(Tnn),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 el.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},Nyi="DialogDescriptionWarning",jyi=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Enn(Nyi).contentName}}.`;return el.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},Pnn=pnn,Mnn=hnn,Inn=ynn,Fvt=bnn,kvt=_nn,qvt=wnn,Uvt=Cnn,Rnn=Onn;Jr();kn();var Oke=Pnn,Ann=Mnn,$yi=Inn;var Nnn=Ug.forwardRef(({className:t,...e},r)=>Ug.createElement(Fvt,{ref:r,className:Te("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}));Nnn.displayName=Fvt.displayName;var Cfe=Ug.forwardRef(({className:t,children:e,container:r,...n},o)=>Ug.createElement($yi,{container:r},Ug.createElement(Nnn,null),Ug.createElement(kvt,{ref:o,className:Te("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,Ug.createElement(Rnn,{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"},Ug.createElement($o,{className:"tw-size-4"}),Ug.createElement("span",{className:"tw-sr-only"},"Close")))));Cfe.displayName=kvt.displayName;var xfe=({className:t,...e})=>Ug.createElement("div",{className:Te("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});xfe.displayName="DialogHeader";var Lyi=({className:t,...e})=>Ug.createElement("div",{className:Te("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});Lyi.displayName="DialogFooter";var Ofe=Ug.forwardRef(({className:t,...e},r)=>Ug.createElement(qvt,{ref:r,className:Te("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));Ofe.displayName=qvt.displayName;var Tfe=Ug.forwardRef(({className:t,...e},r)=>Ug.createElement(Uvt,{ref:r,className:Te("tw-text-sm tw-text-muted",t),...e}));Tfe.displayName=Uvt.displayName;Zt();function on(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=SB(),a="onChange"in t?t.onChange:void 0,s=(0,Cl.useMemo)(()=>{if(a)return dge(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return Cl.default.createElement(Zo,{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 Cl.default.createElement(jA,{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 Cl.default.createElement(bw,{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 Cl.default.createElement(cx,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return Cl.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},Cl.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:Te("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&&Cl.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>Cl.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),Cl.default.createElement("div",{className:Te("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")},Cl.default.createElement(ts,{className:"tw-size-4"})));case"slider":return Cl.default.createElement(Qde,{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 Cl.default.createElement(Oke,null,Cl.default.createElement(Ann,{asChild:!0},t.trigger),Cl.default.createElement(Cfe,{container:i},(t.dialogTitle||t.dialogDescription)&&Cl.default.createElement(xfe,null,t.dialogTitle&&Cl.default.createElement(Ofe,null,t.dialogTitle),t.dialogDescription&&Cl.default.createElement(Tfe,null,t.dialogDescription)),t.children));case"custom":return t.children}};return Cl.default.createElement("div",{className:Te("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)},Cl.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},Cl.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&Cl.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),Cl.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}var Tke=require("obsidian"),Fyi=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o,containerRef:i})=>{let a=l=>{new wU(app,e,l,async d=>{await r(d,l.title)}).open()},s=[{icon:Et.default.createElement(lS,{className:"tw-size-4"}),label:"Edit",onClick:a},{icon:Et.default.createElement(ig,{className:"tw-size-4"}),label:"Copy",onClick:o},{icon:Et.default.createElement(ly,{className:"tw-size-4"}),label:"Delete",onClick:l=>{new vl(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(xi,{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(Qc,{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(xi,{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(Qc,{checked:t.showInSlashMenu,onCheckedChange:l=>r({...t,showInSlashMenu:l===!0},t.title)})));return Et.default.createElement(_ke,{id:t.title,item:t,title:t.title,isDraggable:!0,isExpandable:!0,expandedContent:u,primaryAction:{icon:Et.default.createElement(lS,{className:"tw-size-4"}),onClick:a,tooltip:"Edit Command"},dropdownActions:s,containerRef:i})},kyi=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=gY({id:t.title}),d={transform:D0.Transform.toString(u),transition:l},f=()=>{n(t)};return Et.default.createElement(TB,{ref:s,style:d,className:Te("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(zy,{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(pC,{className:"tw-size-4"}))),Et.default.createElement(zy,null,t.title),Et.default.createElement(zy,{className:"tw-text-center"},Et.default.createElement(Qc,{checked:t.showInContextMenu,onCheckedChange:p=>{r({...t,showInContextMenu:p===!0},t.title)},className:"tw-mx-auto"})),Et.default.createElement(zy,{className:"tw-text-center"},Et.default.createElement(Qc,{checked:t.showInSlashMenu,onCheckedChange:p=>r({...t,showInSlashMenu:p===!0},t.title),className:"tw-mx-auto"})),Et.default.createElement(zy,{className:"tw-text-center"},Et.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},Et.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>{new wU(app,e,t,async m=>{await r(m,t.title)}).open()}},Et.default.createElement(lS,{className:"tw-size-4"})),Et.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>o(t),title:"Copy command"},Et.default.createElement(ig,{className:"tw-size-4"})),Et.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>{new vl(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(ly,{className:"tw-size-4"})))))},jnn=()=>{let t=oDe(),e=(0,Et.useMemo)(()=>hce([...t]),[t]),r=zr(),n=(0,Et.useRef)(null),o=dke(dY(OB,{activationConstraint:{distance:8}}),dY(xB,{coordinateGetter:bke})),i=async(d,f)=>{await Um.getInstance().updateCommand(d,f)},a=async d=>{await Um.getInstance().createCommand(d)},s=async d=>{try{await Um.getInstance().deleteCommand(d),new Tke.Notice(`Command "${d.title}" deleted successfully!`)}catch(f){throw ne("Failed to delete command:",f),new Tke.Notice("Failed to delete command. Please try again."),f}},u=async d=>{try{let f=OHr(d.title,e),p={...d,title:f};await Um.getInstance().createCommand(p,{autoOrder:!1})}catch(f){ne("Failed to copy command:",f),new Tke.Notice("Failed to copy 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 Um.getInstance().reorderCommands(y)},c=()=>Et.default.createElement("div",{className:"tw-relative md:tw-hidden"},Et.default.createElement(pY,{sensors:o,collisionDetection:fY,onDragEnd:l},Et.default.createElement(hY,{items:e.map(d=>d.title),strategy:mY},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(Fyi,{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(on,{type:"text",title:"Custom Prompts Folder Name",description:"Folder where custom prompts are stored",value:r.customPromptsFolder,onChange:d=>{Ue("customPromptsFolder",d),aDe()},placeholder:"copilot/copilot-custom-prompts"}),Et.default.createElement(on,{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=>{Ue("enableCustomPromptTemplating",d)}}),Et.default.createElement(on,{type:"select",title:"Custom Prompts Sort Strategy",description:"Sort order for slash command menu prompts",value:r.promptSortStrategy,onChange:d=>Ue("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(mC,{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(ge,{variant:"secondary",onClick:()=>new vl(app,bvt,"This will add default commands to your custom prompts folder. Do you want to continue?","Generate Default Commands").open()},"Generate Default")),Et.default.createElement(ge,{variant:"default",className:"tw-gap-2",onClick:()=>{let d={...dA};new wU(app,e,d,async p=>{await a(p)}).open()}},Et.default.createElement(Rv,{className:"tw-size-2 md:tw-size-4"}),"Add Cmd")),Et.default.createElement("div",{className:"tw-hidden md:tw-block"},Et.default.createElement(pY,{sensors:o,collisionDetection:fY,onDragEnd:l},Et.default.createElement(_fe,null,Et.default.createElement(vfe,null,Et.default.createElement(TB,null,Et.default.createElement(zb,{className:"tw-w-10"}),Et.default.createElement(zb,null,"Name"),Et.default.createElement(zb,{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(xi,{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(zb,{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(xi,{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(zb,{className:"tw-w-32 tw-text-center"},"Actions"))),Et.default.createElement(hY,{items:e.map(d=>d.title),strategy:mY},Et.default.createElement(wfe,null,e.length===0?Et.default.createElement(TB,null,Et.default.createElement(zy,{colSpan:5,className:"tw-py-8 tw-text-center tw-text-muted"},"No custom prompt files found.")):e.map(d=>Et.default.createElement(kyi,{key:d.title,command:d,commands:e,onUpdate:i,onRemove:s,onCopy:u}))))))),c())))};Jr();var Bi=L(X());to();Ez();F1();ot();Jr();var Hh=L(X());YH();var Dnn=()=>{let t=zr(),e=q1e(),n=e.some(s=>s.title===t.defaultSystemPromptTitle)?t.defaultSystemPromptTitle:"",o=s=>{s&&Ue("defaultSystemPromptTitle",s)},i=()=>{if(!n)return;let s=b0(n);app.setting.close(),app.workspace.openLinkText(s,"",!0)},a=()=>{new Sce(app,e).open()};return Hh.default.createElement("div",{className:"tw-space-y-4"},Hh.default.createElement("section",{className:"tw-space-y-4 tw-rounded-lg tw-border tw-p-4"},Hh.default.createElement("h3",{className:"tw-text-lg tw-font-semibold"},"User System Prompt"),Hh.default.createElement(on,{type:"custom",title:"Default System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!"},Hh.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Hh.default.createElement(wA,{value:n,onChange:s=>o(s.target.value),options:e.map(s=>({label:s.title===t.defaultSystemPromptTitle?`${s.title} (Default)`:s.title,value:s.title})),placeholder:"Select system prompt",containerClassName:"tw-flex-1"}),Hh.default.createElement(ge,{variant:"ghost",size:"icon",onClick:i,className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Open the source file",disabled:!n},Hh.default.createElement(MN,{className:"tw-size-5"})),Hh.default.createElement(ge,{variant:"default",size:"icon",onClick:a,title:"Add new prompt"},Hh.default.createElement(Rv,{className:"tw-size-4"})))),Hh.default.createElement(on,{type:"text",title:"System Prompts Folder Name",description:"Folder where system prompts are stored.",value:t.userSystemPromptsFolder,onChange:s=>Ue("userSystemPromptsFolder",s),placeholder:"copilot/system-prompts"})),Hh.default.createElement("section",{className:"tw-space-y-4 tw-rounded-lg tw-border tw-p-4"},Hh.default.createElement("h3",{className:"tw-text-lg tw-font-semibold"},"Others"),Hh.default.createElement(on,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:s=>{Ue("enableEncryption",s)}}),Hh.default.createElement(on,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:s=>{Ue("debug",s)}}),Hh.default.createElement(on,{type:"custom",title:"Create Log File",description:`Open the Copilot log file (${pm.getLogPath()}) for easy sharing when reporting issues.`},Hh.default.createElement(ge,{variant:"secondary",size:"sm",onClick:async()=>{await $Te(),await pm.flush(),await pm.openLogFile()}},"Create Log File"))))};Bc();to();Or();kn();Nv();ot();var lm=L(X()),$nn=require("obsidian"),Lnn=L(dd());to();Nv();ot();Jr();function qyi({onConfirm:t,onCancel:e}){let r=ae();return lm.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},lm.default.createElement("div",null,lm.default.createElement("p",null,"Thanks for purchasing ",lm.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!"),lm.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),lm.default.createElement("ul",{className:"tw-pl-4"},lm.default.createElement("li",null,"Default mode: ",lm.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),lm.default.createElement("li",null,"Chat model: ",lm.default.createElement("b",{className:"tw-text-accent"},Iot)),lm.default.createElement("li",null,lm.default.createElement("div",null,"Embedding model:"," ",lm.default.createElement("b",{className:"tw-text-accent"},Rot)),r.embeddingModelKey!==Aot&&lm.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},lm.default.createElement(_m,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),lm.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},lm.default.createElement(ge,{variant:"ghost",onClick:e},"Apply Later"),lm.default.createElement(ge,{variant:"default",onClick:t},"Apply Now")))}var Eke=class extends $nn.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,Lnn.createRoot)(e);let r=()=>{Ngr(),this.close()},n=()=>{this.close()};this.root.render(lm.default.createElement(qyi,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};to();Or();Nv();ot();Jr();var kc=L(X());function Fnn(){let t=zr(),[e,r]=(0,kc.useState)(null),[n,o]=(0,kc.useState)(!1),i=rG(),[a,s]=(0,kc.useState)(t.plusLicenseKey);return(0,kc.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),kc.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},kc.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},kc.default.createElement("span",null,"Copilot Plus"),i&&kc.default.createElement(Bh,{variant:"outline",className:"tw-text-success"},"Active")),kc.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},kc.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:"," ",kc.default.createElement("strong",null," ","including chat context, PDF and image support, web search integration, exclusive chat and embedding models, and much more.")),kc.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!")),kc.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},kc.default.createElement(jA,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),kc.default.createElement(ge,{disabled:n,onClick:async()=>{Ue("plusLicenseKey",a),o(!0);let u=await $S();o(!1),u?(r(null),new Eke(app).open()):r("Invalid license key")},className:"tw-min-w-10 tw-text-xs md:tw-text-sm"},n?kc.default.createElement(du,{className:"tw-size-2 tw-animate-spin md:tw-size-4"}):"Apply"),kc.default.createElement(ge,{className:"tw-text-xs md:tw-text-sm",variant:"secondary",onClick:()=>n4(pN.SETTINGS)},"Join Now ",kc.default.createElement(AN,{className:"tw-size-2 md:tw-size-4"}))),kc.default.createElement("div",{className:"tw-text-error"},e))}Zt();lN();Jr();var Efe=require("obsidian"),ft=L(X());to();Or();ot();to();Or();R1e();ot();to();_t();ot();Or();hN();R1e();k1();_t();Or();_t();var Uyi={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"}))||[]},Byi=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})):[],zyi=t=>Uyi[t]||Byi(t),Bvt=(t,e)=>{let r=zyi(t);try{return r(e)}catch(n){return ne(`Error parsing ${t} model data:`,n),[]}};Zt();pL();async function knn(t){try{if(t==="github-copilot"){let l=await Fq.getInstance().listModels();return{success:!0,models:Bvt(t,l)}}let e=ab(t);if(!e)return{success:!1,models:[],error:"API key not configured"};e=await Do(e);let r=dN(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?Nl:fetch)(r,{headers:n,signal:l.signal,method:"GET"});if(!d.ok){let f=Sn(await d.json());throw ne(f),new Error(`Failed to fetch models: ${d.statusText}
|
||
detail: `+f)}return d}finally{clearTimeout(c)}},i;try{i=await o(!1)}catch(u){Be("First fetch attempt failed, trying with safeFetch...");try{i=await o(!0)}catch(l){let c=`
|
||
without CORS Error: `+Sn(u)+`
|
||
with CORS Error: `+Sn(l);throw new Error(c)}}let a=await i.json();return{success:!0,models:Bvt(t,a)}}catch(e){return ne(`Error fetching models for ${t}:`,e),{success:!1,models:[],error:Sn(e)}}}async function qnn(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:ab(t.provider),s={name:t.name,provider:t.provider,apiKey:a,enabled:!0},u=!1,l;if(!n)try{await Nm.instance.getCurrentChainManager().chatModelManager.ping(s)}catch(c){u=!0,l=Sn(c),ne("Model verification failed:",c)}return{success:!0,alreadyExists:i,verificationFailed:u,verificationError:l}}function Unn(t){return{name:t.name,provider:t.provider,enabled:!0}}Zt();Jr();var M$=require("obsidian"),Fu=L(X());function Pke({provider:t,isReady:e,expanded:r=!1,skipVerification:n=!1,credentialVersion:o}){let i=zr(),[a,s]=(0,Fu.useState)(null),[u,l]=(0,Fu.useState)(!1),[c,d]=(0,Fu.useState)(null),[f,p]=(0,Fu.useState)(null),[m,h]=(0,Fu.useState)(!1),y=(0,Fu.useRef)(!1),g=(0,Fu.useCallback)(async()=>{if(!(y.current||!e)){y.current=!0,l(!0),d(null);try{let w=await knn(t);w.success?s(w.models):(d(w.error||"Failed to load models"),new M$.Notice(`Failed to load models for ${tg(t)}: ${w.error}`,5e3))}catch(w){let O=Sn(w);d(O),new M$.Notice(`Failed to load models for ${tg(t)}: ${O}`,5e3)}finally{l(!1),y.current=!1}}},[t,e]);(0,Fu.useEffect)(()=>{s(null),p(null),d(null)},[t,o]),(0,Fu.useEffect)(()=>{r&&e&&a===null&&!u&&!c&&g()},[r,e,a,u,c,g]);let b=async()=>{if(!f){new M$.Notice("Please select a model first");return}h(!0);try{let w=await qnn({id:f.id,name:f.name,provider:t},i.activeModels,{skipVerification:n});if(w.alreadyExists)w.verificationFailed?new M$.Notice(`Model ${f.name} already exists (verification failed: ${w.verificationError})`,1e4):new M$.Notice(`Model ${f.name} verified successfully! It already exists in your models list.`);else{let O=Unn({id:f.id,name:f.name,provider:t}),T=[...i.activeModels,O];Ue("activeModels",T),w.verificationFailed?new M$.Notice(`Model ${f.name} added (verification failed: ${w.verificationError})`,1e4):new M$.Notice(`Model ${f.name} verified and added to your models list!`)}}catch(w){ne("Error adding model:",w),new M$.Notice(`Failed to add model: ${Sn(w)}`)}finally{h(!1)}},_=a?.filter((w,O,T)=>T.findIndex(P=>P.id===w.id)===O).sort((w,O)=>w.name.localeCompare(O.name));return Fu.default.createElement(qo,{label:"Model",description:"Add the selected model to your models list. After adding, check the Model Tab."},Fu.default.createElement("div",null,Fu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Fu.default.createElement("div",{className:"tw-flex-1"},Fu.default.createElement(wA,{options:_?.map(w=>({label:w.name,value:w.id}))||[],onChange:w=>{let O=w.target.value,T=a?.find(P=>P.id===O);T&&p(T)},onClick:()=>{a===null&&!u&&g()},value:f?.id||"",placeholder:"Select Model",disabled:!e||u})),Fu.default.createElement("div",{className:"tw-w-[72px]"},Fu.default.createElement(ge,{onClick:b,disabled:!f||m,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},m?Fu.default.createElement(du,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),Fu.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},u&&Fu.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),c&&Fu.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed to load models. ",c),a&&a.length===0&&Fu.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models available."),a===null&&!u&&!c&&Fu.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load available models."))))}Jr();var I$=require("obsidian"),Ar=L(X());function Bnn(){let t=zr(),[e]=(0,Ar.useState)(()=>Fq.getInstance()),[r,n]=(0,Ar.useState)("idle"),[o,i]=(0,Ar.useState)(null),[a,s]=(0,Ar.useState)(null),[u,l]=(0,Ar.useState)(!1),c=(0,Ar.useRef)(0),d=(0,Ar.useRef)(!0);(0,Ar.useEffect)(()=>(d.current=!0,()=>{d.current=!1,c.current+=1,e.abortPolling()}),[e]),(0,Ar.useEffect)(()=>{e.getAuthState().status==="authenticated"&&n("done")},[e]),(0,Ar.useEffect)(()=>{e.getAuthState().status==="authenticated"?r!=="pending"&&r!=="user"&&r!=="polling"&&n("done"):r==="done"&&n("idle")},[t.githubCopilotToken,t.githubCopilotAccessToken,t.githubCopilotTokenExpiresAt,e,r]);let f=async()=>{let _=++c.current;n("pending"),s(null);try{let w=await e.startDeviceCodeFlow();if(!d.current||_!==c.current)return;i(w),n("user"),l(!0),new I$.Notice("Please authorize in your browser, then click 'Complete'")}catch(w){if(!d.current||_!==c.current)return;let O=w instanceof Error?w.message:String(w);s(O),n("error"),new I$.Notice(`Failed to start authentication: ${O}`)}},p=async()=>{if(!o){new I$.Notice("Please start authentication first");return}let _=++c.current;n("polling"),s(null);try{if(await e.pollForAccessToken(o.deviceCode,o.interval,o.expiresIn),await e.fetchCopilotToken(),!d.current||_!==c.current)return;n("done"),i(null),new I$.Notice("GitHub Copilot connected successfully!")}catch(w){if(!d.current||_!==c.current)return;let O=w instanceof Error?w.message:String(w);s(O),n("error"),new I$.Notice(`Authentication failed: ${O}`)}},m=()=>{c.current+=1,e.resetAuth(),n("idle"),i(null),s(null),l(!1),new I$.Notice("GitHub Copilot disconnected")},h=async _=>{try{await navigator.clipboard.writeText(_),new I$.Notice("Copied to clipboard!")}catch{new I$.Notice("Failed to copy to clipboard")}},y=r==="done",g=r==="pending"||r==="polling";return Ar.default.createElement(Ar.default.Fragment,null,Ar.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-font-medium"},Ar.default.createElement("div",{className:"tw-truncate"},"GitHub Copilot"),Ar.default.createElement(xi,{content:Ar.default.createElement("div",{className:"tw-max-w-[250px]"},Ar.default.createElement("div",{className:"tw-font-semibold"},"Unofficial Integration"),Ar.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:"right"},Ar.default.createElement("span",{className:"tw-cursor-help tw-text-warning"},"\u26A0\uFE0F"))),Ar.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Ar.default.createElement("div",{className:"tw-flex-1"},Ar.default.createElement("div",{className:`tw-flex tw-h-9 tw-w-full tw-items-center tw-rounded-md tw-border tw-border-border tw-px-3 tw-text-sm ${y?"tw-text-success":g?"tw-text-warning":r==="error"?"tw-text-error":"tw-text-muted"}`},y?"\u2713 Connected":g?"Authenticating...":r==="error"?"Error - Click Setup to retry":"Not connected")),Ar.default.createElement("div",null,y&&Ar.default.createElement(ge,{onClick:m,variant:"ghost",className:"tw-flex tw-items-center tw-justify-center tw-whitespace-nowrap tw-px-4 tw-py-2 tw-text-warning hover:tw-text-warning"},"Disconnect")),Ar.default.createElement("div",null,Ar.default.createElement(ge,{onClick:()=>{!y&&!g?f():l(!u)},disabled: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"},g?Ar.default.createElement(du,{className:"tw-size-4 tw-animate-spin"}):y?Ar.default.createElement(Ar.default.Fragment,null,"Add Model",u?Ar.default.createElement(fb,{className:"tw-ml-1 tw-size-4"}):Ar.default.createElement(ts,{className:"tw-ml-1 tw-size-4"})):"Setup"))),Ar.default.createElement("div",null,Ar.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"))),Ar.default.createElement(kb,{open:u},Ar.default.createElement(qb,{className:"tw-rounded-md tw-p-3"},Ar.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},(r==="user"||r==="polling")&&o&&Ar.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"},Ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs"},Ar.default.createElement("span",{className:"tw-font-semibold"},"1."),Ar.default.createElement("span",{className:"tw-text-muted"},"Go to:"),Ar.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),Ar.default.createElement(ge,{variant:"ghost",size:"sm",onClick:()=>h(o.verificationUri),className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Copy URL"},Ar.default.createElement(ig,{className:"tw-size-3.5"}))),Ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs"},Ar.default.createElement("span",{className:"tw-font-semibold"},"2."),Ar.default.createElement("span",{className:"tw-text-muted"},"Enter code:"),Ar.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),Ar.default.createElement(ge,{variant:"ghost",size:"sm",onClick:()=>h(o.userCode),className:"tw-size-5 tw-shrink-0 tw-p-0",title:"Copy code"},Ar.default.createElement(ig,{className:"tw-size-3.5"}))),Ar.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-border-t tw-pt-1 tw-border-border/50"},Ar.default.createElement(ge,{onClick:p,disabled:r==="polling",variant:"secondary",size:"sm"},r==="polling"?Ar.default.createElement(Ar.default.Fragment,null,Ar.default.createElement(du,{className:"tw-mr-1.5 tw-size-3.5 tw-animate-spin"}),"Waiting..."):"Complete"),Ar.default.createElement(ge,{onClick:m,variant:"ghost",size:"sm"},"Cancel"))),y&&Ar.default.createElement(Pke,{provider:"github-copilot",isReady:y,expanded:u,credentialVersion:t.githubCopilotToken}),a&&Ar.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"},a)))))}to();Or();k1();_t();ot();Zt();Jr();var R$=require("obsidian"),mi=L(X());function znn(t){return t.trim().replace(/\/+$/,"").replace(/\/v1$/i,"")}async function Vyi(t,e){let r=znn(t);return e==="ollama"?((await(0,R$.requestUrl)({url:`${r}/api/tags`,method:"GET"})).json?.models||[]).map(s=>({id:s.name,name:s.name})):((await(0,R$.requestUrl)({url:`${r}/v1/models`,method:"GET"})).json?.data||[]).map(i=>({id:i.id,name:i.id}))}function Hyi({service:t,expanded:e,onToggleExpand:r}){let n=zr(),[o,i]=(0,mi.useState)(t.url),[a,s]=(0,mi.useState)(null),[u,l]=(0,mi.useState)(!1),[c,d]=(0,mi.useState)(null),[f,p]=(0,mi.useState)(""),[m,h]=(0,mi.useState)(!1),y=async()=>{l(!0),d(null);try{let _=await Vyi(o,t.kind);s(_)}catch(_){ne(`Error fetching models for ${t.name}:`,_),d(Sn(_)),s(null)}finally{l(!1)}},g=()=>{r(),!e&&!a&&!u&&y()},b=async()=>{if(!f||!a)return;let _=a.find(T=>T.id===f);if(!_)return;h(!0);let w=!1,O="";try{let T=t.kind,P=znn(o),M=t.kind==="ollama"?P:`${P}/v1`,I={name:_.name,provider:T,baseUrl:M,enabled:!0};try{await Nm.instance.getCurrentChainManager().chatModelManager.ping(I)}catch(A){w=!0,O=Sn(A),ne("Model verification failed:",A)}n.activeModels.find(A=>A.name===I.name&&A.provider===I.provider)?w?new R$.Notice(`Model ${_.name} already exists (verification failed: ${O})`,5e3):new R$.Notice(`Model ${_.name} already exists.`):(Ue("activeModels",[...n.activeModels,I]),w?new R$.Notice(`Model ${_.name} added (verification failed: ${O})`,5e3):new R$.Notice(`Model ${_.name} added!`))}catch(T){new R$.Notice(`Failed to add model: ${Sn(T)}`)}finally{h(!1)}};return mi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},mi.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},mi.default.createElement("div",{className:"tw-truncate"},t.name)),mi.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},mi.default.createElement("div",{className:"tw-flex-1"},mi.default.createElement(Zo,{className:"tw-max-w-full",value:o,onChange:_=>{i(_.target.value),s(null),p(""),d(null)}})),mi.default.createElement("div",null,mi.default.createElement(ge,{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?mi.default.createElement(fb,{className:"tw-ml-1 tw-size-4"}):mi.default.createElement(ts,{className:"tw-ml-1 tw-size-4"})))),mi.default.createElement(kb,{open:e,className:"tw-mt-2"},mi.default.createElement(qb,{className:"tw-rounded-md tw-p-3"},mi.default.createElement(qo,{label:"Model",description:"Add the currently selected model to model List."},mi.default.createElement("div",null,mi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},mi.default.createElement("div",{className:"tw-flex-1"},mi.default.createElement(wA,{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})),mi.default.createElement("div",{className:"tw-w-[72px]"},mi.default.createElement(ge,{onClick:b,disabled:!f||m,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},m?mi.default.createElement(du,{className:"tw-size-4 tw-animate-spin"}):"Add"))),mi.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},u&&mi.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),c&&mi.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed: ",c),a&&a.length===0&&mi.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models found.")))))))}function Vnn(){let[t,e]=(0,mi.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 mi.default.createElement("div",{className:"tw-mt-6 tw-border-t tw-border-border tw-pt-4"},mi.default.createElement("div",{className:"tw-mb-3"},mi.default.createElement("h3",{className:"tw-m-0 tw-text-base tw-font-bold"},"Local Services"),mi.default.createElement("div",{className:"tw-mt-1 tw-text-xs tw-text-muted"},"Need help?"," ",mi.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"))),mi.default.createElement("div",{className:"tw-space-y-4"},r.map(n=>mi.default.createElement(Hyi,{key:n.id,service:n,expanded:t===n.id,onToggleExpand:()=>e(o=>o===n.id?null:n.id)}))))}Zt();Jr();pL();var Hnn=require("obsidian"),Uo=L(X()),Jnn=L(dd());function Jyi({onClose:t,onGoToModelTab:e}){let[r,n]=(0,Uo.useState)(null);(0,Uo.useEffect)(()=>{n(null)},[]);let o=uHe().map(a=>{let s=a,u=ab(s);return{provider:s,apiKey:u}}),i=(a,s)=>{ab(a)!==s&&Ue(xee[a],s)};return Uo.default.createElement("div",{className:"tw-p-4 sm:tw-max-w-[500px]"},Uo.default.createElement("div",{className:"tw-mb-4"},Uo.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),Uo.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),Uo.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},Uo.default.createElement("div",{className:"tw-space-y-4"},o.map(a=>{let s=dN(a.provider),u=!!s.listModelURL,l=r===a.provider;return Uo.default.createElement(Uo.default.Fragment,{key:a.provider},Uo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Uo.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},Uo.default.createElement("div",{className:"tw-truncate"},tg(a.provider))),Uo.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},Uo.default.createElement("div",{className:"tw-flex-1"},Uo.default.createElement(jA,{className:"tw-max-w-full",value:a.apiKey,onChange:c=>i(a.provider,c)})),u&&Uo.default.createElement("div",null,Uo.default.createElement(ge,{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?Uo.default.createElement(fb,{className:"tw-ml-1 tw-size-4"}):Uo.default.createElement(ts,{className:"tw-ml-1 tw-size-4"})))),Uo.default.createElement("div",null,s.keyManagementURL&&Uo.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 ",tg(a.provider)," Key"))),u&&Uo.default.createElement(kb,{open:l,className:"tw-mt-2"},Uo.default.createElement(qb,{className:"tw-rounded-md tw-p-3"},Uo.default.createElement(Pke,{provider:a.provider,isReady:!!a.apiKey,expanded:l,credentialVersion:a.apiKey}))))})),Uo.default.createElement(Bnn,null),Uo.default.createElement(Vnn,null),e&&Uo.default.createElement("div",{className:"tw-mt-4 tw-border-t tw-border-border tw-pt-4"},Uo.default.createElement("div",{className:"tw-rounded-lg tw-border tw-p-4 tw-bg-secondary/30 tw-border-border/60"},Uo.default.createElement("div",{className:"tw-flex tw-gap-3"},Uo.default.createElement("div",{className:"tw-mt-0.5 tw-shrink-0"},Uo.default.createElement(Qte,{className:"tw-size-5 tw-text-accent"})),Uo.default.createElement("div",{className:"tw-flex-1"},Uo.default.createElement("h4",{className:"tw-mb-1 tw-text-sm tw-font-semibold"},"Looking for Azure OpenAI or Custom Providers?"),Uo.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.)."),Uo.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",Uo.default.createElement(bm,{className:"tw-size-4 tw-transition-transform group-hover:tw-translate-x-0.5"}))))))),Uo.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},Uo.default.createElement(ge,{onClick:t},"Close")))}var Mke=class extends Hnn.Modal{constructor(e,r){super(e),this.onGoToModelTab=r}onOpen(){let{contentEl:e}=this;this.root=(0,Jnn.createRoot)(e),this.root.render(Uo.default.createElement(Jyi,{onClose:()=>this.close(),onGoToModelTab:this.onGoToModelTab}))}onClose(){this.root.unmount()}};var Kyi={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus",project:"Projects (alpha)"},Wnn=()=>{let t=zr(),{setSelectedTab:e}=SB(),[r,n]=(0,ft.useState)(!1),[o,i]=(0,ft.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 Efe.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 Efe.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:m}=eg(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]);Ue("defaultConversationNoteName",l),i(l),new Efe.Notice(`Format applied successfully! Example: ${y}`,4e3)}catch(l){new Efe.Notice(`Error applying format: ${l.message}`,4e3)}finally{n(!1)}},s=!!t.activeModels.find(l=>l.enabled&&oo(l)===t.defaultModelKey),u=t.activeModels.filter(l=>l.enabled).map(l=>({label:cX(l),value:oo(l)}));return ft.default.createElement("div",{className:"tw-space-y-4"},ft.default.createElement(Fnn,null),ft.default.createElement("section",null,ft.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),ft.default.createElement("div",{className:"tw-space-y-4"},ft.default.createElement("div",{className:"tw-space-y-4"},ft.default.createElement(on,{type:"custom",title:"API Keys",description:ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ft.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),ft.default.createElement(xi,{content:ft.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},ft.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),ft.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."))}))},ft.default.createElement(ge,{onClick:()=>{new Mke(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",ft.default.createElement(ere,{className:"tw-size-4"})))),ft.default.createElement(on,{type:"select",title:"Default Chat Model",description:ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ft.default.createElement("span",{className:"tw-leading-none"},"Select the Chat model to use"),ft.default.createElement(xi,{content:ft.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},ft.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Default model is OpenRouter Gemini 2.5 Flash"),ft.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&&oo(p)===l);if(!c)return;let{hasApiKey:d,errorNotice:f}=HW(c,t);Ue("defaultModelKey",l)},options:s?u:[{label:"Select Model",value:"Select Model"},...u],placeholder:"Model"}),ft.default.createElement(on,{type:"select",title:"Default Mode",description:ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ft.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),ft.default.createElement(xi,{content:ft.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},ft.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},ft.default.createElement("li",null,ft.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",ft.default.createElement("i",null,"Free to use with your own API key.")),ft.default.createElement("li",null,ft.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",ft.default.createElement("i",null,"Free to use with your own API key.")),ft.default.createElement("li",null,ft.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"," ",ft.default.createElement("a",{href:Not(pN.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=>Ue("defaultChainType",l),options:Object.entries(Kyi).map(([l,c])=>({label:c,value:l}))}),ft.default.createElement(on,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:l=>Ue("defaultOpenArea",l),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),ft.default.createElement(on,{type:"select",title:"Send Shortcut",description:ft.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},ft.default.createElement("span",{className:"tw-leading-none"},"Choose keyboard shortcut to send messages"),ft.default.createElement(xi,{content:ft.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},ft.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Shortcut not working?"),ft.default.createElement("div",{className:"tw-text-xs tw-text-muted"},"If your selected shortcut doesn't work, check",ft.default.createElement("strong",null," Obsidian's Settings \u2192 Hotkeys")," to see if another command is using the same key combination. ",ft.default.createElement("br",null),"You may need to remove or change the conflicting hotkey first."))})),value:t.defaultSendShortcut,onChange:l=>Ue("defaultSendShortcut",l),options:[{label:"Enter",value:"enter"},{label:"Shift + Enter",value:"shift+enter"}]}),ft.default.createElement(on,{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=>{Ue("autoAddActiveContentToContext",l)}}),ft.default.createElement(on,{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=>{Ue("autoAddSelectionToContext",l)}}),ft.default.createElement(on,{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=>{Ue("passMarkdownImages",l)}}),ft.default.createElement(on,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:l=>Ue("showSuggestedPrompts",l)}),ft.default.createElement(on,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:l=>Ue("showRelevantNotes",l)}))),ft.default.createElement("section",null,ft.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Saving Conversations"),ft.default.createElement("div",{className:"tw-space-y-4"},ft.default.createElement(on,{type:"switch",title:"Autosave Chat",description:"Automatically saves the chat after every user message and AI response.",checked:t.autosaveChat,onCheckedChange:l=>Ue("autosaveChat",l)}),ft.default.createElement(on,{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=>Ue("generateAIChatTitleOnSave",l)}),ft.default.createElement(on,{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=>Ue("defaultSaveFolder",l),placeholder:"copilot/copilot-conversations"}),ft.default.createElement(on,{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=>Ue("defaultConversationTag",l),placeholder:"ai-conversations"}),ft.default.createElement(on,{type:"custom",title:"Conversation Filename Template",description:ft.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},ft.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),ft.default.createElement(xi,{content:ft.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},ft.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),ft.default.createElement("div",null,ft.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),ft.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},ft.default.createElement("li",null,ft.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),ft.default.createElement("li",null,ft.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),ft.default.createElement("li",null,ft.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),ft.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]")))}))},ft.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},ft.default.createElement(Zo,{type:"text",className:Te("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}),ft.default.createElement(ge,{onClick:()=>a(),disabled:r,variant:"secondary"},r?ft.default.createElement(ft.default.Fragment,null,ft.default.createElement(du,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))))),ft.default.createElement("section",null,ft.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"Sorting"),ft.default.createElement("div",{className:"tw-space-y-4"},ft.default.createElement(on,{type:"select",title:"Chat History Sort Strategy",description:"Sort order for the chat history list",value:t.chatHistorySortStrategy,onChange:l=>{LW(l)&&Ue("chatHistorySortStrategy",l)},options:[{label:"Recency",value:"recent"},{label:"Created",value:"created"},{label:"Alphabetical",value:"name"}]}),ft.default.createElement(on,{type:"select",title:"Project List Sort Strategy",description:"Sort order for the project list",value:t.projectListSortStrategy,onChange:l=>{LW(l)&&Ue("projectListSortStrategy",l)},options:[{label:"Recency",value:"recent"},{label:"Created",value:"created"},{label:"Alphabetical",value:"name"}]}))))};ot();var Vy=L(X());var Kx=L(X());yV();ot();var Knn=()=>{let t=zr(),e=bd.getInstance(),r=new Set(t.autonomousAgentEnabledToolIds||[]),n=e.getToolsByCategory(),o=e.getConfigurableTools(),i=(s,u)=>{let l=new Set(r);u?l.add(s):l.delete(s),Ue("autonomousAgentEnabledToolIds",Array.from(l))},a=()=>Array.from(n.entries()).filter(([u,l])=>l.some(c=>o.includes(c))).map(([u,l])=>{let c=l.filter(d=>o.includes(d));return c.length===0?null:Kx.default.createElement(Kx.default.Fragment,{key:u},c.map(({metadata:d})=>Kx.default.createElement(on,{key:d.id,type:"switch",title:d.displayName,description:d.description,checked:r.has(d.id),onCheckedChange:f=>i(d.id,f)})))});return Kx.default.createElement(Kx.default.Fragment,null,Kx.default.createElement(on,{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:s=>{Ue("autonomousAgentMaxIterations",s)},min:4,max:8,step:1}),Kx.default.createElement("div",{className:"tw-mt-4 tw-rounded-lg tw-bg-secondary tw-p-4"},Kx.default.createElement("div",{className:"tw-mb-2 tw-text-sm tw-font-medium"},"Agent Accessible Tools"),Kx.default.createElement("div",{className:"tw-mb-4 tw-text-xs tw-text-muted"},"Toggle which tools the autonomous agent can use"),Kx.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},a())))};var Gnn=()=>{let t=zr();return Vy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Vy.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},Vy.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},Vy.default.createElement(Bh,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),Vy.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Vy.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autonomous Agent"),Vy.default.createElement(on,{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:e=>{Ue("enableAutonomousAgent",e)}}),t.enableAutonomousAgent&&Vy.default.createElement(Vy.default.Fragment,null,Vy.default.createElement(Knn,null)),Vy.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Memory (experimental)"),Vy.default.createElement(on,{type:"text",title:"Memory Folder Name",description:"Specify the folder where memory data is stored.",value:t.memoryFolderName,onChange:e=>{Ue("memoryFolderName",e)},placeholder:"copilot/memory"}),Vy.default.createElement(on,{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:e=>{Ue("enableRecentConversations",e)}}),t.enableRecentConversations&&Vy.default.createElement(on,{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:e=>Ue("maxRecentConversations",e)}),Vy.default.createElement(on,{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:e=>{Ue("enableSavedMemory",e)}}))))};Or();aV();k1();_t();ot();to();Or();_t();ot();Zt();Or();hN();var Gyi="2023-06-01",Xyi="bedrock-2023-05-31",vY="Hello!",Ike="Hello!",Xnn=64,Zyi=256,Yyi=256,Qyi=256,ebi=new Set(["openai","openai","openrouterai","groq","xai","siliconflow","siliconflow","3rd party (openai-format)","3rd party (openai-format)","lm-studio","lm-studio","mistralai","deepseek"]);function EB(t){return t.replace(/\/+$/g,"")}function tbi(t){try{return new URL(t)}catch{return null}}function Pfe(t){return t.replace(/'/g,`'"'"'`)}function Rke(t){let e=rC[t];return(e?.curlBaseURL??e?.host??"").trim()}async function wY(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 Do(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 rbi(t){let e=EB(t),r=["/chat/completions","/embeddings","/responses"];for(let n of r)if(e.endsWith(n))return e.slice(0,-n.length);return e}function nbi(t){let e=EB(t);return e.endsWith("/models")&&(e=e.slice(0,-7)),!e.includes("/v1beta")&&!e.includes("/v1")&&(e=`${e}/v1beta`),e}function obi(t){let e=EB(t),r=["/api/v1","/v1","/api"];for(let n of r)if(e.endsWith(n))return e.slice(0,-n.length);return e}function k3(t){let e=[],r=Pfe(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 '${Pfe(`${a}: ${o[a]}`)}'`));for(let a of Object.keys(o).sort())i.has(a)||e.push(` --header '${Pfe(`${a}: ${o[a]}`)}'`);if(t.body!==void 0){let a=JSON.stringify(t.body,null,2);e.push(` --data-raw '${Pfe(a)}'`)}return e.join(` \\
|
||
`)}async function ibi(t,e){let r=[],n=t.provider?.trim()??"",o=Rke(n),i=t.baseUrl?.trim()??"",a=EB(i||o||"https://api.example.com/v1"),s=rbi(a),u=t.name?.trim()||"<MODEL_NAME>";t.name?.trim()||r.push("Model name is empty; using placeholder.");let l=await wY(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:Ike}}}:{ok:!0,warnings:r,spec:{method:"POST",url:`${s}/chat/completions`,headers:c,body:{model:u,messages:[{role:"user",content:vY}],stream:!1,max_tokens:Xnn}}}}function abi(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=tbi(a);if(s){let u=EB(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 sbi(t,e){let r=[],n=await wY(t.apiKey);r.push(...n.warnings);let o=e?t.azureOpenAIApiEmbeddingDeploymentName?.trim()||"[deployment]":t.azureOpenAIApiDeploymentName?.trim()||"[deployment]";(!o||o==="[deployment]")&&r.push("Azure deployment name is empty; using placeholder.");let i=t.azureOpenAIApiVersion?.trim()||"[api-version]";t.azureOpenAIApiVersion?.trim()||r.push("Azure api-version is empty; using placeholder.");let s=abi(t,o,e?"embeddings":"chat/completions",i);r.push(...s.warnings);let u=e?{input:Ike}:{messages:[{role:"user",content:vY}],stream:!1,max_tokens:Xnn};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 ubi(t){let e=[],r=t.baseUrl?.trim()??"",n=Rke("anthropic"),o=EB(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 wY(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":Gyi},body:{model:u,max_tokens:Zyi,messages:[{role:"user",content:vY}]}}}}async function lbi(t,e){let r=[],n=t.baseUrl?.trim()??"",o=Rke("google"),a=nbi(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 wY(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:Ike}]}}}}:{ok:!0,warnings:r,spec:{method:"POST",url:`${a}/${u}:generateContent`,headers:c,body:{contents:[{role:"user",parts:[{text:vY}]}],generationConfig:{maxOutputTokens:Qyi}}}}}function cbi(t){return/(^|\.)anthropic\./.test(t)}async function dbi(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=`${EB(o||`https://bedrock-runtime.${n}.amazonaws.com`)}/model/${encodeURIComponent(r)}/invoke`,s={messages:[{role:"user",content:[{type:"text",text:vY}]}],max_tokens:Yyi};cbi(r)?s.anthropic_version=Xyi:e.push("Model ID does not look like Anthropic; request body may need adjustment.");let u=await wY(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:${Pfe(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)",k3(l),"","# Option B: IAM auth (AWS SigV4)",k3(c)].join(`
|
||
`),warnings:e}}async function fbi(t,e){let r=[],n=t.baseUrl?.trim()??"",o=Rke("ollama"),i=obi(EB(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 wY(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:Ike,truncate:!0}}}:{ok:!0,warnings:r,spec:{method:"POST",url:`${i}/api/chat`,headers:s,body:{model:a,messages:[{role:"user",content:vY}],stream:!1}}}}async function Znn(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 sbi(t,n);return o.ok?{ok:!0,command:k3(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 ubi(t);return o.ok?{ok:!0,command:k3(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 dbi(t);if(r==="google"||r==="google"){let o=await lbi(t,n);return o.ok?{ok:!0,command:k3(o.spec),warnings:o.warnings}:o}if(r==="ollama"||r==="ollama"){let o=await fbi(t,n);return o.ok?{ok:!0,command:k3(o.spec),warnings:o.warnings}:o}if(ebi.has(r)){let o=await ibi(t,n);return o.ok?{ok:!0,command:k3(o.spec),warnings:o.warnings}:o}return{ok:!1,error:`Provider "${r}" is not supported for curl generation.`,warnings:e}}Jr();pL();var PB=require("obsidian"),Xe=L(X()),zvt=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=SB(),a=ae(),s=o?"openai":"openrouterai",u=$=>$==="azure openai",[l,c]=(0,Xe.useState)(null),[d,f]=(0,Xe.useState)(u(s)),[p,m]=(0,Xe.useState)(!1),[h,y]=(0,Xe.useState)("idle"),[g,b]=(0,Xe.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1,bedrockRegion:!1}),_=($,H)=>{b(re=>({...re,[$]:H}))},w=()=>{b({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1,bedrockRegion:!1})},O=()=>{let $=!0,H={...g};return H.name=!P.name,P.name||($=!1),P.provider==="azure openai"&&(H.instanceName=!P.azureOpenAIApiInstanceName,H.apiVersion=!P.azureOpenAIApiVersion,o?(H.embeddingDeploymentName=!P.azureOpenAIApiEmbeddingDeploymentName,P.azureOpenAIApiEmbeddingDeploymentName||($=!1)):(H.deploymentName=!P.azureOpenAIApiDeploymentName,P.azureOpenAIApiDeploymentName||($=!1)),(!P.azureOpenAIApiInstanceName||!P.azureOpenAIApiVersion)&&($=!1)),P.provider,"amazon-bedrock",H.bedrockRegion=!1,b(H),$},T=($=s)=>{let H={name:"",provider:$,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:ab($),isEmbeddingModel:o,capabilities:[]};if(!o){let re={...H,stream:!0};return $==="amazon-bedrock"?{...re,bedrockRegion:a.amazonBedrockRegion}:re}return H},[P,M]=(0,Xe.useState)(T()),I=$=>{M(H=>({...H,...$})),y("idle")},j=$=>({...$,name:$.name?.trim(),baseUrl:$.baseUrl?.trim(),apiKey:$.apiKey?.trim(),openAIOrgId:$.openAIOrgId?.trim(),azureOpenAIApiInstanceName:$.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:$.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:$.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:$.azureOpenAIApiVersion?.trim(),bedrockRegion:$.bedrockRegion?.trim()}),[A,k]=(0,Xe.useState)(dN(s)),V=()=>!!(P.name&&P.provider),q=()=>p||!V(),J=()=>{if(!O()){new PB.Notice("Please fill in all required fields");return}let $=j(P);r($),e(!1),M(T()),w(),y("idle"),f(!1)},K=$=>{k(dN($)),y("idle"),M({...P,provider:$,apiKey:ab($),...$==="openai"?{openAIOrgId:a.openAIOrgId}:{},...$==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{},...$==="amazon-bedrock"?{bedrockRegion:a.amazonBedrockRegion}:{bedrockRegion:void 0}}),f(u($))},ue=$=>{$||(M(T()),w(),y("idle"),f(!1)),e($)},oe=async()=>{if(!O()){new PB.Notice("Please fill in all required fields");return}m(!0),y("idle");try{let $=j(P);await n($),y("success"),new PB.Notice("Model verification successful!")}catch($){ne($);let H=Sn($);y("failed"),new PB.Notice("Model verification failed: "+H)}finally{m(!1)}},G=async()=>{try{let $=j(P),H=await Znn($);if(!H.ok){new PB.Notice(H.error);return}await navigator.clipboard.writeText(H.command);let D=!H.warnings.some(U=>U.includes("placeholder"))?" Warning: contains real API key!":"",R=H.warnings.filter(U=>!U.includes("placeholder")),z=R.length>0?` (${R[0]})`:"";new PB.Notice(`Copied curl command.${D}${z}`)}catch($){ne($),new PB.Notice("Failed to copy curl command: "+Sn($))}},Y=()=>{let H=(()=>{switch(P.provider){case"openai":return Xe.default.createElement(qo,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},Xe.default.createElement(Zo,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:P.openAIOrgId||"",onChange:re=>I({openAIOrgId:re.target.value})}));case"azure openai":return Xe.default.createElement(Xe.default.Fragment,null,Xe.default.createElement(qo,{label:"Instance Name",required:!0,error:g.instanceName,errorMessage:"Instance name is required"},Xe.default.createElement(Zo,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:P.azureOpenAIApiInstanceName||"",onChange:re=>{I({azureOpenAIApiInstanceName:re.target.value}),_("instanceName",!1)}})),o?Xe.default.createElement(qo,{label:"Embedding Deployment Name",required:!0,error:g.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},Xe.default.createElement(Zo,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:P.azureOpenAIApiEmbeddingDeploymentName||"",onChange:re=>{I({azureOpenAIApiEmbeddingDeploymentName:re.target.value}),_("embeddingDeploymentName",!1)}})):Xe.default.createElement(qo,{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."},Xe.default.createElement(Zo,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:P.azureOpenAIApiDeploymentName||"",onChange:re=>{I({azureOpenAIApiDeploymentName:re.target.value}),_("deploymentName",!1)}})),Xe.default.createElement(qo,{label:"API Version",required:!0,error:g.apiVersion,errorMessage:"API version is required"},Xe.default.createElement(Zo,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:P.azureOpenAIApiVersion||"",onChange:re=>{I({azureOpenAIApiVersion:re.target.value}),_("apiVersion",!1)}})));case"amazon-bedrock":return Xe.default.createElement(qo,{label:"Region (optional)",description:"Defaults to us-east-1 when left blank. With inference profiles (global., us., eu., apac.), region is auto-managed."},Xe.default.createElement("div",{className:"tw-flex tw-gap-2"},Xe.default.createElement(Zo,{className:"tw-flex-1",type:"text",placeholder:"Enter AWS region (e.g. us-east-1)",value:P.bedrockRegion||"",onChange:re=>{I({bedrockRegion:re.target.value}),_("bedrockRegion",!1)}}),Xe.default.createElement(KJ,{onValueChange:re=>{I({bedrockRegion:re}),_("bedrockRegion",!1)}},Xe.default.createElement(HU,{className:"tw-w-[140px]"},Xe.default.createElement(GJ,{placeholder:"Presets"})),Xe.default.createElement(JU,{container:l},["us-east-1","us-west-2","eu-west-1","ap-northeast-1","ap-southeast-1"].map(re=>Xe.default.createElement(WU,{key:re,value:re},re))))));default:return null}})();return H?Xe.default.createElement(kb,{open:d,onOpenChange:f,className:"tw-rounded-lg tw-border tw-bg-secondary/30 tw-border-border/60"},Xe.default.createElement(O$,{asChild:!0},Xe.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"},Xe.default.createElement("span",{className:"tw-text-sm tw-font-medium"},"Additional ",tg(P.provider)," Settings"),Xe.default.createElement(ts,{className:`tw-size-4 tw-text-muted tw-transition-transform tw-duration-200 ${d?"tw-rotate-180":""}`}))),Xe.default.createElement(qb,{className:"tw-space-y-4 tw-px-3 tw-pb-3"},H)):null},se=()=>{if(P.provider!=="azure openai")return A.host;let $=P.azureOpenAIApiInstanceName||"[instance]",H=o?P.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":P.azureOpenAIApiDeploymentName||"[deployment]",re=P.azureOpenAIApiVersion||"[api-version]";return`https://${$}.openai.azure.com/openai/deployments/${H}/${o?"embeddings":"chat/completions"}?api-version=${re}`},ie=Object.entries(hL).map(([$,H])=>({id:$,label:$.charAt(0).toUpperCase()+$.slice(1),description:H}));return Xe.default.createElement(Oke,{open:t,onOpenChange:ue},Xe.default.createElement(Cfe,{className:"tw-max-h-[80vh] tw-overflow-y-auto sm:tw-max-w-[425px]",container:i,ref:$=>c($)},Xe.default.createElement(xfe,null,Xe.default.createElement(Ofe,null,"Add Custom ",o?"Embedding":"Chat"," Model"),Xe.default.createElement(Tfe,null,"Add a new model to your collection.")),Xe.default.createElement("div",{className:"tw-space-y-3"},Xe.default.createElement(qo,{label:"Model Name",required:!0,error:g.name,errorMessage:"Model name is required",description:P.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},Xe.default.createElement(Zo,{type:"text",placeholder:`Enter model name (e.g. ${P.provider==="amazon-bedrock"&&!o?"global.anthropic.claude-sonnet-4-5-20250929-v1:0":o?"text-embedding-3-small":"gpt-4"})`,value:P.name,onChange:$=>{I({name:$.target.value}),_("name",!1)}})),Xe.default.createElement(qo,{label:Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Xe.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Xe.default.createElement(xi,{content:Xe.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Xe.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Xe.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Xe.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Xe.default.createElement("li",null,"Direct-Paid:Ds-r1"),Xe.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Xe.default.createElement("li",null,"Perplexity-Paid:lg"))),contentClassName:"tw-max-w-96"}))},Xe.default.createElement(Zo,{type:"text",placeholder:"Custom display name (optional)",value:P.displayName||"",onChange:$=>{M({...P,displayName:$.target.value})}})),Xe.default.createElement(qo,{label:"Provider"},Xe.default.createElement(KJ,{value:P.provider,onValueChange:K},Xe.default.createElement(HU,null,Xe.default.createElement(GJ,{placeholder:"Select provider"})),Xe.default.createElement(JU,{container:l},Object.values(o?Pee(gO,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):Pee(r_,["COPILOT_PLUS"])).map($=>Xe.default.createElement(WU,{key:$,value:$},tg($)))))),Xe.default.createElement(qo,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Xe.default.createElement(Zo,{type:"text",placeholder:se()||"https://api.example.com/v1",value:P.baseUrl||"",onChange:$=>I({baseUrl:$.target.value})})),Xe.default.createElement(qo,{label:"API Key"},Xe.default.createElement(jA,{placeholder:`Enter ${A.label} API Key`,value:P.apiKey||"",onChange:$=>I({apiKey:$})}),A.keyManagementURL&&Xe.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Xe.default.createElement("a",{href:A.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",A.label," API Key"))),!o&&Xe.default.createElement(qo,{label:Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Xe.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Xe.default.createElement(xi,{content:Xe.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"}))},Xe.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-items-center tw-gap-x-6 tw-gap-y-2"},ie.map(({id:$,label:H,description:re})=>Xe.default.createElement("div",{key:$,className:"tw-flex tw-items-center tw-gap-2"},Xe.default.createElement(Qc,{id:$,checked:P.capabilities?.includes($),onCheckedChange:D=>{let R=P.capabilities||[];M({...P,capabilities:D?[...R,$]:R.filter(z=>z!==$)})}}),Xe.default.createElement(xi,{content:re},Xe.default.createElement(im,{htmlFor:$,className:"tw-text-sm"},H)))))),Y()),Xe.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-3"},Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Xe.default.createElement(Qc,{id:"enable-cors",checked:P.enableCors||!1,onCheckedChange:$=>M({...P,enableCors:$})}),Xe.default.createElement(im,{htmlFor:"enable-cors",className:"tw-cursor-pointer"},Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Xe.default.createElement("span",{className:"tw-text-sm"},"CORS"),Xe.default.createElement(xi,{content:Xe.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"})))),Xe.default.createElement(jb,null,Xe.default.createElement(pn,null,Xe.default.createElement(mn,{asChild:!0},Xe.default.createElement(ge,{variant:"ghost",size:"sm",onClick:G,disabled:!P.name,className:"tw-text-muted hover:tw-text-normal"},"CURL")),Xe.default.createElement(sn,null,Xe.default.createElement("p",null,"Copy curl command for testing"))))),Xe.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-end tw-gap-2"},h==="success"&&Xe.default.createElement(BL,{className:"tw-size-5 tw-text-success"}),h==="failed"&&Xe.default.createElement(IO,{className:"tw-size-5 tw-text-error"}),Xe.default.createElement(jb,null,Xe.default.createElement(pn,null,Xe.default.createElement(mn,{asChild:!0},Xe.default.createElement(ge,{variant:"secondary",size:"sm",onClick:oe,disabled:q(),className:"tw-min-w-[72px]"},p?Xe.default.createElement(Xe.default.Fragment,null,Xe.default.createElement(du,{className:"tw-mr-1.5 tw-size-3.5 tw-animate-spin"}),"Test"):"Test")),Xe.default.createElement(sn,null,Xe.default.createElement("p",null,"Optional: test API call")))),Xe.default.createElement(ge,{variant:"default",size:"sm",onClick:J,disabled:q()},"Add Model")))))};to();Or();kn();ot();Zt();Jr();var Ut=L(X());pL();var pbi={reasoning:{icon:mC,color:"tw-text-model-capabilities-blue",tooltip:hL.reasoning},vision:{icon:NN,color:"tw-text-model-capabilities-green",tooltip:hL.vision},websearch:{icon:cl,color:"tw-text-model-capabilities-blue",tooltip:hL.websearch}},mbi=["reasoning","vision","websearch"],hbi=({title:t,onRefresh:e,onAdd:r})=>Ut.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"},Ut.default.createElement("h3",{className:"tw-text-xl tw-font-bold"},t),Ut.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&&Ut.default.createElement(ge,{onClick:e,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Ut.default.createElement(WL,{className:"tw-size-2 md:tw-size-4"}),"Refresh Built-ins"),Ut.default.createElement(ge,{onClick:r,variant:"default",className:"tw-flex tw-items-center tw-gap-2"},Ut.default.createElement(Rv,{className:"tw-size-2 md:tw-size-4"}),"Add Model"))),gbi=t=>Ut.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},mbi.map(e=>{let r=pbi[e];if(!r)return Ut.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?Ut.default.createElement(xi,{key:e,content:r.tooltip,side:"bottom"},Ut.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},Ut.default.createElement(n,{className:Te("tw-size-4",r.color)}))):Ut.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},Ut.default.createElement("div",{className:"tw-size-4"}))})),ybi=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,id:i,containerRef:a})=>{let s=[];e&&s.push({icon:Ut.default.createElement(q6,{className:"tw-size-4"}),label:"Edit",onClick:e}),r&&!t.core&&s.push({icon:Ut.default.createElement(ig,{className:"tw-size-4"}),label:"Copy",onClick:r}),t.core||s.push({icon:Ut.default.createElement(ly,{className:"tw-size-4"}),label:"Delete",onClick:()=>n(oo(t)),variant:"destructive"});let u=Ut.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&Ut.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ut.default.createElement("span",{className:"tw-text-sm"},"Enabled"),Ut.default.createElement(Qc,{checked:t.enabled,onCheckedChange:l=>o({...t,enabled:l})})),Ut.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ut.default.createElement("span",{className:"tw-text-sm"},"CORS"),Ut.default.createElement(Qc,{checked:t.enableCors,onCheckedChange:l=>o({...t,enableCors:l})})));return Ut.default.createElement(_ke,{id:i,item:t,title:t.displayName||t.name,subtitle:tg(t.provider,t),badge:t.capabilities&&t.capabilities.length>0?Ut.default.createElement(Cmt,{capabilities:t.capabilities,iconSize:14}):void 0,isDraggable:!t.core,isExpandable:!0,expandedContent:u,primaryAction:e?{icon:Ut.default.createElement(U6,{className:"tw-size-4"}),onClick:e,tooltip:"Edit Model"}:void 0,dropdownActions:s,containerRef:a})},bbi=({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}=gY({id:oo(t),disabled:t.core}),p={transform:D0.Transform.toString(c),transition:d},m=e||!t.core||r&&!t.core;return Ut.default.createElement(TB,{ref:l,style:p,className:Te("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")},Ut.default.createElement(zy,{className:"tw-w-6 tw-px-2"},!t.core&&Ut.default.createElement(ge,{variant:"ghost",size:"icon",className:"tw-size-6 tw-cursor-grab tw-touch-none tw-p-0 hover:tw-cursor-grab active:tw-cursor-grabbing",...s,...u},Ut.default.createElement(pC,{className:"tw-size-4 tw-transition-colors"}))),Ut.default.createElement(zy,{className:"tw-pl-0"},t.displayName||t.name),Ut.default.createElement(zy,null,tg(t.provider,t)),Ut.default.createElement(zy,null,gbi(t)),!i&&Ut.default.createElement(zy,{className:"tw-text-center"},Ut.default.createElement(Qc,{id:`${oo(t)}-enabled`,checked:t.enabled,disabled:t.enabled&&age(t),onCheckedChange:h=>o({...t,enabled:h}),className:"tw-mx-auto"})),Ut.default.createElement(zy,{className:"tw-text-center"},Ut.default.createElement(Qc,{id:`${oo(t)}-enableCors`,checked:t.enableCors,onCheckedChange:h=>o({...t,enableCors:h}),className:"tw-mx-auto"})),Ut.default.createElement(zy,{className:"tw-text-center"},Ut.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&Ut.default.createElement(ge,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},Ut.default.createElement(U6,{className:"tw-size-4"})),m&&Ut.default.createElement(yA,null,Ut.default.createElement(bA,{asChild:!0},Ut.default.createElement(ge,{variant:"ghost",size:"icon"},Ut.default.createElement(RO,{className:"tw-size-4"}))),Ut.default.createElement(K_,{align:"end",container:a.current},e&&Ut.default.createElement(Ii,{onClick:()=>e(t)},Ut.default.createElement(q6,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Ut.default.createElement(Ii,{onClick:()=>r(t)},Ut.default.createElement(ig,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Ut.default.createElement(Ii,{onClick:()=>n(oo(t)),className:"tw-text-error"},Ut.default.createElement(ly,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},Vvt=({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=dke(dY(OB),dY(xB,{coordinateGetter:bke})),d=(0,Ut.useRef)(null),f=t.findIndex(y=>!y.core),p=y=>g=>{let{transform:b,active:_,activeNodeRect:w,over:O}=g;if(!_||!w)return b;let T=t.findIndex(A=>oo(A)===_.id),P=t.filter(A=>!A.core).length,M=w.height,I=(f-T)*M,j=(f+P-1-T)*M;if(y&&O){let A=t.findIndex(V=>oo(V)===O.id);if(t[A].core||A<f)return{...b,x:0,y:0}}return{...b,x:0,y:Math.min(Math.max(I,b.y),j)}},m=y=>{let{active:g,over:b}=y;if(b&&g.id!==b.id){let _=t.findIndex(P=>oo(P)===g.id),w=t.findIndex(P=>oo(P)===b.id),O=t[w];if(w<f||O.core)return;let T=yke(t,_,w);a?.(T)}},h=()=>Ut.default.createElement("div",{className:"tw-relative md:tw-hidden"},Ut.default.createElement(pY,{sensors:c,collisionDetection:fY,onDragEnd:m,modifiers:[p(!0)],autoScroll:{enabled:!0,acceleration:10,threshold:{x:0,y:.2}}},Ut.default.createElement(hY,{items:t.map(y=>oo(y)),strategy:mY},Ut.default.createElement("div",{className:"tw-relative tw-touch-auto tw-space-y-2 tw-overflow-auto tw-pb-2"},t.map(y=>Ut.default.createElement(ybi,{key:oo(y),id:oo(y),containerRef:d,model:y,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i}))))));return Ut.default.createElement("div",{ref:d,className:"tw-mb-4"},Ut.default.createElement(hbi,{title:u,onRefresh:s,onAdd:o}),Ut.default.createElement("div",{className:"tw-hidden md:tw-block"},Ut.default.createElement(pY,{sensors:c,collisionDetection:fY,onDragEnd:m,modifiers:[p(!1)]},Ut.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},Ut.default.createElement(_fe,null,Ut.default.createElement(vfe,null,Ut.default.createElement(TB,null,Ut.default.createElement(zb,{className:"tw-w-6 tw-px-2"}),Ut.default.createElement(zb,{className:"tw-pl-0"},"Model"),Ut.default.createElement(zb,null,"Provider"),Ut.default.createElement(zb,{className:"tw-text-center"},"Capabilities"),!l&&Ut.default.createElement(zb,{className:"tw-text-center"},"Enable"),Ut.default.createElement(zb,{className:"tw-text-center"},"CORS"),Ut.default.createElement(zb,{className:"tw-w-[100px] tw-text-center"},"Actions"))),Ut.default.createElement(wfe,{className:"tw-relative"},Ut.default.createElement(hY,{items:t.map(y=>oo(y)),strategy:mY},t.map(y=>Ut.default.createElement(bbi,{key:oo(y),containerRef:d,model:y,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i,isEmbeddingModel:l})))))))),h())};Zt();var Ake=require("obsidian"),lv=L(X()),Ynn=()=>{let t=zr(),[e,r]=(0,lv.useState)(!1),[n,o]=(0,lv.useState)(!1),i=(h,y=!1)=>{let g={...Pee(h,["isBuiltIn","core","projectEnabled","plusExclusive","believerExclusive","capabilities","displayName","dimensions"]),name:`${h.name} (copy)`},b=y?"activeEmbeddingModels":"activeModels";Ue(b,[...t[b],g])},a=(h,y=!1)=>{Ue(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(O=>O.enabled);_=w?`${w.name}|${w.provider}`:""}t_({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,Ue(b,w)}else new Ake.Notice("Could not find model to update"),ne("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);Ue("activeModels",y)},c=h=>{let[y,g]=h.split("|"),b=t.activeEmbeddingModels.filter(_=>!(_.name===y&&_.provider===g));Ue("activeEmbeddingModels",b)},d=h=>{let y=t.activeEmbeddingModels.map(g=>g.name===h.name&&g.provider===h.provider?h:g);Ue("activeEmbeddingModels",y)},f=()=>{let h=t.activeModels.filter(g=>!g.isBuiltIn),y=[...hO,...h];Ue("activeModels",y),new Ake.Notice("Chat models refreshed successfully")},p=()=>{let h=t.activeEmbeddingModels.filter(g=>!g.isBuiltIn),y=[...Tz,...h];Ue("activeEmbeddingModels",y),new Ake.Notice("Embedding models refreshed successfully")},m=(h,y=!1)=>{new JZ(app,h,y,u).open()};return lv.default.createElement("div",{className:"tw-space-y-4"},lv.default.createElement("section",null,lv.default.createElement(Vvt,{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"}),lv.default.createElement(zvt,{open:e,onOpenChange:r,onAdd:h=>{let y=[...t.activeModels,h];Ue("activeModels",y)},ping:h=>Nm.instance.getCurrentChainManager().chatModelManager.ping(h)}),lv.default.createElement("div",{className:"tw-space-y-4"},lv.default.createElement(on,{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=>Ue("contextTurns",h),min:1,max:50,step:1}),lv.default.createElement(on,{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=>Ue("autoCompactThreshold",h)}))),lv.default.createElement("section",null,lv.default.createElement(Vvt,{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"}),lv.default.createElement(zvt,{open:n,onOpenChange:o,onAdd:h=>{let y=[...t.activeEmbeddingModels,h];Ue("activeEmbeddingModels",y)},isEmbeddingModel:!0,ping:h=>gd.getInstance().ping(h)})))};var non=require("obsidian");to();var Oi=L(X()),oon=L(dd());vb();Jr();var jke=require("obsidian");Bc();Zt();Or();var Nke=class extends QZ{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(!zW(e,this.chainType)){new jke.Notice(GW.NON_MARKDOWN_FILES_RESTRICTED);return}this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof jke.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 Qnn=require("obsidian"),q0=L(X()),eon=L(dd());to();function _bi({onConfirm:t,onCancel:e}){let[r,n]=(0,q0.useState)(""),[o,i]=(0,q0.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return q0.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},q0.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},q0.default.createElement(Zo,{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&&q0.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),q0.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},q0.default.createElement(ge,{variant:"secondary",onClick:e},"Cancel"),q0.default.createElement(ge,{variant:"default",onClick:()=>a(r)},"Confirm")))}var Dke=class extends Qnn.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,eon.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(q0.default.createElement(_bi,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var ton=require("obsidian"),Gx=L(X()),ron=L(dd());to();function vbi({onConfirm:t,onCancel:e}){let[r,n]=(0,Gx.useState)("");return Gx.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Gx.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Gx.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"),Gx.default.createElement(Zo,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),Gx.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Gx.default.createElement(ge,{variant:"secondary",onClick:e},"Cancel"),Gx.default.createElement(ge,{variant:"default",onClick:()=>t(r)},"Confirm")))}var $ke=class extends ton.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,ron.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(Gx.default.createElement(vbi,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};function Lke({title:t,patterns:e,onRemove:r}){return Oi.default.createElement("div",{className:"tw-grid tw-grid-cols-4 tw-gap-2"},Oi.default.createElement("div",{className:"tw-font-bold"},t),Oi.default.createElement("ul",{className:"tw-col-span-3 tw-m-0 tw-flex tw-list-inside tw-list-disc tw-flex-col tw-gap-1 tw-pl-0"},e.map(n=>Oi.default.createElement("li",{key:n,className:"tw-flex tw-gap-2 tw-rounded-md tw-pl-2 tw-pr-1 hover:tw-bg-modifier-hover"},Oi.default.createElement(tc,{className:"tw-flex-1"},n),Oi.default.createElement(ge,{variant:"ghost2",size:"fit",onClick:()=>r(n)},Oi.default.createElement($o,{className:"tw-size-4"}))))))}function wbi({value:t,onUpdate:e,container:r}){let[n,o]=(0,Oi.useState)(t),i=O_(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=X8(i),c=f=>{let p=Z8({tagPatterns:f.tagPatterns??a,extensionPatterns:f.extensionPatterns??s,folderPatterns:f.folderPatterns??u,notePatterns:f.notePatterns??l});o(p),e(p)},d=a.length>0||s.length>0||u.length>0||l.length>0;return Oi.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-4"},Oi.default.createElement("div",{className:"tw-flex tw-max-h-[400px] tw-flex-col tw-gap-2 tw-overflow-y-auto tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-4"},!d&&Oi.default.createElement("div",{className:"tw-text-center tw-text-sm"},"No patterns specified"),a.length>0&&Oi.default.createElement(Lke,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(m=>m!==f);c({tagPatterns:p})}}),s.length>0&&Oi.default.createElement(Lke,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(m=>m!==f);c({extensionPatterns:p})}}),u.length>0&&Oi.default.createElement(Lke,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(m=>m!==f);c({folderPatterns:p})}}),l.length>0&&Oi.default.createElement(Lke,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(m=>m!==f);c({notePatterns:p})}})),Oi.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Oi.default.createElement(yA,null,Oi.default.createElement(bA,{asChild:!0},Oi.default.createElement(ge,{variant:"secondary"},"Add...")),Oi.default.createElement(K_,{align:"start",container:r},Oi.default.createElement(Ii,{onSelect:()=>{new eY(app,f=>{let p=bie(f);a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},Oi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Oi.default.createElement(KL,{className:"tw-size-4"}),"Tag")),Oi.default.createElement(Ii,{onSelect:()=>{new YZ(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},Oi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Oi.default.createElement(ah,{className:"tw-size-4"}),"Folder")),Oi.default.createElement(Ii,{onSelect:()=>{new Nke({app,onNoteSelect:f=>{let p=Y8(f);l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},Oi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Oi.default.createElement(Ju,{className:"tw-size-4"}),"Note")),Oi.default.createElement(Ii,{onSelect:()=>{new Dke(app,f=>{let p=Tot(f);s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},Oi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Oi.default.createElement(Gte,{className:"tw-size-4"}),"Extension")),Oi.default.createElement(Ii,{onSelect:()=>{new $ke(app,f=>{let p=O_(f),{tagPatterns:m,extensionPatterns:h,folderPatterns:y,notePatterns:g}=X8(p);c({tagPatterns:[...a,...m],extensionPatterns:[...s,...h],folderPatterns:[...u,...y],notePatterns:[...l,...g]})}).open()}},Oi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Oi.default.createElement(Av,{className:"tw-size-4"}),"Custom"))))))}var Mfe=class extends non.Modal{constructor(r,n,o,i){super(r);this.onUpdate=n;this.value=o;this.setTitle(i)}onOpen(){let{contentEl:r}=this;this.root=(0,oon.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(Oi.default.createElement(wbi,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};var Fke=class extends vl{constructor(e,r){super(e,r,"Changing this setting means you have to rebuild the index for your entire vault, do you wish to proceed?","Rebuild Index")}};var kke=class extends vl{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")}};to();Or();ot();var ion=require("obsidian"),tn=L(X()),aon=()=>{let t=zr(),e=async r=>{if(r!==t.embeddingModelKey){if(t.enableSemanticSearchV3){new Fke(app,async()=>{Ue("embeddingModelKey",r),await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().indexVaultToVectorStore(!1)}).open();return}Ue("embeddingModelKey",r),new ion.Notice("Embedding model saved. Enable Semantic Search to build the index.")}};return tn.default.createElement("div",{className:"tw-space-y-4"},tn.default.createElement("section",null,tn.default.createElement("div",{className:"tw-space-y-4"},tn.default.createElement(on,{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:r=>{new kke(app,async()=>{Ue("enableSemanticSearchV3",r),r&&await(await Promise.resolve().then(()=>(Am(),xg))).default.getInstance().indexVaultToVectorStore(!1)},r).open()}}),tn.default.createElement(on,{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:r=>Ue("enableInlineCitations",r)}),tn.default.createElement(on,{type:"select",title:"Embedding Model",description:tn.default.createElement("div",{className:"tw-space-y-2"},tn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},tn.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."),tn.default.createElement(xi,{content:tn.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},tn.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:"),tn.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},tn.default.createElement("li",null,"Require rebuilding your vault's vector index"),tn.default.createElement("li",null,"Affect semantic search quality"),tn.default.createElement("li",null,"Impact Question Answering feature performance")))}))),value:t.embeddingModelKey,onChange:e,options:t.activeEmbeddingModels.map(r=>({label:cX(r),value:oo(r)})),placeholder:"Model"}),tn.default.createElement(on,{type:"select",title:"Auto-Index Strategy",description:tn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},tn.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),tn.default.createElement(xi,{content:tn.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},tn.default.createElement("div",{className:"tw-space-y-1"},tn.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),tn.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},tn.default.createElement("li",null,tn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},tn.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),tn.default.createElement("span",null,"Manual indexing via command or refresh only"))),tn.default.createElement("li",null,tn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},tn.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),tn.default.createElement("span",null,"Index updates when plugin loads or reloads"))),tn.default.createElement("li",null,tn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},tn.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),tn.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),tn.default.createElement("p",{className:"tw-text-sm tw-text-callout-warning"},"Warning: Cost implications for large vaults with paid models"))})),value:t.indexVaultToVectorStore,onChange:r=>{Ue("indexVaultToVectorStore",r)},options:URt.map(r=>({label:r,value:r})),placeholder:"Strategy"}),tn.default.createElement(on,{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 15. Increase if you want more notes included in the answer generation step.",min:1,max:128,step:1,value:t.maxSourceChunks,onChange:r=>Ue("maxSourceChunks",r)}),t.enableSemanticSearchV3&&tn.default.createElement(tn.default.Fragment,null,tn.default.createElement(on,{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:r=>Ue("embeddingRequestsPerMin",r)}),tn.default.createElement(on,{type:"slider",title:"Embedding Batch Size",description:"Default is 16. Increase if you are rate limited by your embedding provider.",min:1,max:128,step:1,value:t.embeddingBatchSize,onChange:r=>Ue("embeddingBatchSize",r)}),tn.default.createElement(on,{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:r=>Ue("numPartitions",Number(r)),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"})),tn.default.createElement(on,{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:r=>Ue("lexicalSearchRamLimit",r),suffix:" MB"}),tn.default.createElement(on,{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:r=>Ue("enableLexicalBoosts",r)}),tn.default.createElement(on,{type:"custom",title:"Exclusions",description:tn.default.createElement(tn.default.Fragment,null,tn.default.createElement("p",null,"Exclude folders, tags, note titles or file extensions from being indexed. Previously indexed files will remain until a force re-index is performed."))},tn.default.createElement(ge,{variant:"secondary",onClick:()=>new Mfe(app,r=>Ue("qaExclusions",r),t.qaExclusions,"Manage Exclusions").open()},"Manage")),tn.default.createElement(on,{type:"custom",title:"Inclusions",description:tn.default.createElement("p",null,"Index only the specified paths, tags, or note titles. Exclusions take precedence over inclusions. Previously indexed files will remain until a force re-index is performed.")},tn.default.createElement(ge,{variant:"secondary",onClick:()=>new Mfe(app,r=>Ue("qaInclusions",r),t.qaInclusions,"Manage Inclusions").open()},"Manage")),tn.default.createElement(on,{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:r=>Ue("enableIndexSync",r)}),tn.default.createElement(on,{type:"switch",title:"Disable index loading on mobile",description:"When enabled, Copilot index won't be loaded on mobile devices to save resources. Only chat mode will be available. Any existing index from desktop sync will be preserved. Uncheck to enable QA modes on mobile.",checked:t.disableIndexOnMobile,onCheckedChange:r=>Ue("disableIndexOnMobile",r)}))))};var uon=["basic","model","QA","command","plus","advanced"],Sbi={basic:Bi.default.createElement(kte,{className:"tw-size-5"}),model:Bi.default.createElement(Ute,{className:"tw-size-5"}),QA:Bi.default.createElement(RN,{className:"tw-size-5"}),command:Bi.default.createElement(HL,{className:"tw-size-5"}),plus:Bi.default.createElement(uy,{className:"tw-size-5"}),advanced:Bi.default.createElement(Av,{className:"tw-size-5"})},Cbi={basic:()=>Bi.default.createElement(Wnn,null),model:()=>Bi.default.createElement(Ynn,null),QA:()=>Bi.default.createElement(aon,null),command:()=>Bi.default.createElement(jnn,null),plus:()=>Bi.default.createElement(Gnn,null),advanced:()=>Bi.default.createElement(Dnn,null)},son=uon.map(t=>({id:t,icon:Sbi[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),xbi=()=>{let{selectedTab:t,setSelectedTab:e}=SB();return Bi.default.createElement("div",{className:"tw-flex tw-flex-col"},Bi.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-rounded-lg"},son.map((r,n)=>Bi.default.createElement(lrn,{key:r.id,tab:r,isSelected:t===r.id,onClick:()=>e(r.id),isFirst:n===0,isLast:n===son.length-1}))),Bi.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),Bi.default.createElement("div",null,uon.map(r=>{let n=Cbi[r];return Bi.default.createElement(crn,{key:r,id:r,isSelected:t===r},Bi.default.createElement(n,null))})))},Obi=({plugin:t})=>{let[e,r]=Bi.default.useState(0),{latestVersion:n,hasUpdate:o}=$Fe(t.manifest.version),i=async()=>{new rke(app,async()=>{YVe(),r(s=>s+1)}).open()};return Bi.default.createElement(frn,null,Bi.default.createElement("div",null,Bi.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Bi.default.createElement("h1",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},Bi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Bi.default.createElement("span",null,"Copilot Settings"),Bi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Bi.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"v",t.manifest.version),n&&Bi.default.createElement(Bi.default.Fragment,null,o?Bi.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,")"):Bi.default.createElement("span",{className:"tw-text-xs tw-text-normal"}," (up to date)")))),Bi.default.createElement("div",{className:"tw-self-end sm:tw-self-auto"},Bi.default.createElement(ge,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),Bi.default.createElement(xbi,{key:e})))},lon=Obi;var Hvt=L(X()),con=(0,Hvt.createContext)(null);var qke=class extends Ife.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{let e=this.app.workspace.getLeavesOfType(ac)[0]?.view;if(e&&ae().enableRecentConversations)try{let o=this.plugin.projectManager.getCurrentChainManager().chatModelManager.getChatModel();this.plugin.userMemoryManager.addRecentConversation(this.plugin.chatUIState.getMessages(),o)}catch(n){B("Failed to analyze chat messages for memory:",n)}e&&ae().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 Ife.Notice("Plugin reloaded successfully.")}catch(e){new Ife.Notice("Failed to reload the plugin. Please reload manually."),ne("Error reloading plugin:",e)}}display(){let{containerEl:e}=this;e.empty(),e.style.userSelect="text";let r=e.createDiv("div");(0,don.createRoot)(r).render(Jvt.default.createElement(con.Provider,{value:e},Jvt.default.createElement(lon,{plugin:this.plugin})))}};ot();_t();var Uke=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){B("[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()}};NTe();Dje();var cm=require("obsidian");lN();D$();var Bke=class extends cm.Plugin{constructor(){super(...arguments);this.userMessageHistory=[];this.chatHistoryLastAccessedAtManager=new $W}async onload(){await this.loadSettings(),this.settingsUnsubscriber=al(async(a,s)=>{s.enableEncryption?await this.saveData(await lAt(s)):await this.saveData(s),Bmt(this,a,s)}),this.addSettingTab(new qke(this.app,this)),tX(this.app.vault),this.brevilabsClient=pc.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),$S(),this.projectManager=Nm.getInstance(this.app,this),this.vectorStoreManager=D1.getInstance(),Nde.getInstance().initialize(),this.fileParserManager=new vk(this.brevilabsClient,this.app.vault);let n=new sY,o=this.projectManager.getCurrentChainManager(),i=new eke(n,o,this.fileParserManager,this);if(this.chatUIState=new Uke(i),this.userMemoryManager=new Hq(this.app),cm.Platform.isDesktopApp){let{activeLeafRef:a,layoutRef:s}=Umt(this.app,{preserveOnViewTypes:[ac]});this.registerEvent(a),this.registerEvent(s)}this.registerView(ac,a=>new vB(a,this)),this.registerView(Nue,a=>new G1e(a)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",a=>{this.activateView()}),Bmt(this,void 0,ae()),this.registerMarkdownCodeBlockProcessor(dX,(a,s)=>{rrn({plugin:this,element:s}),s.parentElement&&(s.parentElement.className="")}),this.registerEvent(this.app.workspace.on("editor-menu",a=>Ztn(a))),this.registerEvent(this.app.workspace.on("active-leaf-change",a=>{if(a&&a.view instanceof cm.MarkdownView&&a.view.file){let u=this.app.workspace.getLeavesOfType(ac).find(l=>l.view instanceof vB)?.view;if(u){let l=new CustomEvent(Zw.ACTIVE_LEAF_CHANGE);u.eventTarget.dispatchEvent(l)}}})),this.customCommandRegister=new XFe(this,this.app.vault),this.systemPromptRegister=new wce(this,this.app.vault),this.app.workspace.onLayoutReady(()=>{this.customCommandRegister.initialize().then(Qtn).then(ern),this.systemPromptRegister.initialize().then(()=>Gmt(this.app.vault))}),this.initSelectionHandler(),this.initWebSelectionWatcher()}async onunload(){this.projectManager&&this.projectManager.onunload(),Nde.getInstance().cleanup(),this.customCommandRegister.cleanup(),this.systemPromptRegister.cleanup(),this.settingsUnsubscriber?.(),this.cleanupSelectionHandler(),this.cleanupWebSelectionWatcher(),this.clearSelectionContext();try{ed(this.app).stopActiveWebTabTracking()}catch{}await pm.flush(),B("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(ae().autosaveChat){let r=this.app.workspace.getLeavesOfType(ac)[0]?.view;r&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(ac).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(ac).find(l=>l.view instanceof vB)?.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(ac).find(n=>n.view instanceof vB)?.view;if(r){let n=new CustomEvent(Zw.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===ac&&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(){yN([])}clearWebSelectionContextForUrl(r){let n=bL(),o=n.filter(i=>i.sourceType!=="web"||i.url!==r);o.length!==n.length&&yN(o)}setSelectionContext(r){yN([r])}handleSelectionChange(){if(!ae().autoAddSelectionToContext)return;let n=this.app.workspace.getActiveViewOfType(cm.MarkdownView);if(!n||!n.editor)return;let o=n.editor,i=o.getSelection();if(!i||!i.trim())return;let a=this.app.workspace.getActiveFile();if(!a)return;let s=o.listSelections()[0];if(!s)return;let u=s.anchor.line+1,l=s.head.line+1,c=Math.min(u,l),d=Math.max(u,l),f={id:Zm(),content:i,sourceType:"note",noteTitle:a.basename,notePath:a.path,startLine:c,endLine:d};this.setSelectionContext(f)}initWebSelectionWatcher(){if(!cm.Platform.isDesktopApp)return;let r=ed(this.app);this.webSelectionTracker=new tke({intervalMs:500,emptySelectionDebounceCount:2,isEnabled:()=>ae().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(cm.MarkdownView);return{getSelection:()=>{let n=r?.editor?.getSelection();if(n)return n;let o=this.app.workspace.getActiveFile();return o?this.app.vault.cachedRead(o):""},replaceSelection:r?.editor?.replaceSelection.bind(r.editor)||(()=>{})}}processCustomPrompt(r,n){let o=this.getCurrentEditorOrDummy();this.processText(o,r,n,!1)}toggleView(){this.app.workspace.getLeavesOfType(ac).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(ac);r.length===0?ae().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:ac,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:ac,active:!0}):this.app.workspace.revealLeaf(r[0]),setTimeout(()=>{this.emitChatIsVisible()},50)}async deactivateView(){this.app.workspace.detachLeavesOfType(ac)}async loadSettings(){let r=await this.loadData(),n=QVe(r);t_(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=oo(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 cm.Notice("No chat history found.");return}new GFe(this.app,r,this.chatHistoryLastAccessedAtManager,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(ae().defaultSaveFolder);if(!(r instanceof cm.TFolder))return[];let o=this.app.vault.getMarkdownFiles().filter(s=>s.path.startsWith(r.path)),a=Uu()?.id;if(a){let s=`${a}__`;return o.filter(u=>u.basename.startsWith(s))}else return o.filter(s=>!s.basename.match(/^[a-zA-Z0-9-]+__/))}async getChatHistoryItems(){return(await this.getChatHistoryFiles()).map(n=>{let o=ife(n),i=afe(n),a=this.chatHistoryLastAccessedAtManager.getEffectiveLastUsedAt(n.path,i??o.getTime()),s=new Date(a);return{id:n.path,title:ofe(n),createdAt:o,lastAccessedAt:s}})}async touchChatHistoryLastAccessedAt(r){try{this.chatHistoryLastAccessedAtManager.touch(r.path);let n=afe(r),o=this.chatHistoryLastAccessedAtManager.shouldPersist(r.path,n);if(o===null||!this.app.fileManager?.processFrontMatter)return;let i=o;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)}),this.chatHistoryLastAccessedAtManager.markPersisted(r.path,i)}catch(n){Be(`[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(ac)[0];n||this.activateView(),await this.chatUIState.loadChatHistory(r),this.touchChatHistoryLastAccessedAt(r);let o=(n||this.app.workspace.getLeavesOfType(ac)[0])?.view;o&&o.updateView()}async loadChatById(r){let n=this.app.vault.getAbstractFileByPath(r);if(n instanceof cm.TFile)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 cm.TFile)await this.app.workspace.getLeaf(!0).openFile(n);else throw new Error("Chat file not found.")}async updateChatTitle(r,n){let o=this.app.vault.getAbstractFileByPath(r);if(o instanceof cm.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 cm.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 cm.TFile)await this.app.vault.delete(n),new cm.Notice("Chat deleted.");else throw new Error("Chat file not found.")}async handleNewChat(){if(cG(),await pm.clear(),ae().enableRecentConversations)try{let o=this.projectManager.getCurrentChainManager().chatModelManager.getChatModel();this.userMemoryManager.addRecentConversation(this.chatUIState.getMessages(),o)}catch(n){B("Failed to analyze chat messages for memory:",n)}await this.autosaveCurrentChat();let r=this.app.workspace.getLeavesOfType(ac)[0];if(r){let n=r.view,o=new CustomEvent(Zw.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){return(await(ae().enableSemanticSearchV3?new(await Promise.resolve().then(()=>(D1e(),gft))).MergedSemanticRetriever(this.app,{minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o,returnAll:!1}):new(await Promise.resolve().then(()=>(w7(),N1e))).TieredLexicalRetriever(this.app,{minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o,timeRange:void 0,returnAll:!1,useRerankerThreshold:void 0})).getRelevantDocuments(r)).map(u=>({content:u.pageContent,metadata:u.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/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-big-up.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/arrow-right.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/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/bot.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/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/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.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This 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/file.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/folder.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/globe.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/grip-vertical.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/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.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/pen-line.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/pen.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/pencil-line.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/pencil.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/plus.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/refresh-ccw.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/refresh-cw.js:
|
||
(**
|
||
* @license lucide-react v0.462.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*)
|
||
|
||
lucide-react/dist/esm/icons/rotate-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/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/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> *)
|
||
|
||
@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
|
||
*)
|
||
|
||
@google/generative-ai/dist/index.mjs:
|
||
(**
|
||
* @license
|
||
* Copyright 2024 Google LLC
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*)
|
||
*/
|
||
|
||
/* nosourcemap */ |