2937 lines
5.0 MiB
2937 lines
5.0 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 _sn=Object.create;var cY=Object.defineProperty;var vsn=Object.getOwnPropertyDescriptor;var wsn=Object.getOwnPropertyNames;var Ssn=Object.getPrototypeOf,Csn=Object.prototype.hasOwnProperty;var Wwt=t=>{throw TypeError(t)};var xsn=(t,e,r)=>e in t?cY(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),Xn=(t,e)=>{for(var r in e)cY(t,r,{get:e[r],enumerable:!0})},Gwt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of wsn(e))!Csn.call(t,o)&&o!==r&&cY(t,o,{get:()=>e[o],enumerable:!(n=vsn(e,o))||n.enumerable});return t};var L=(t,e,r)=>(r=t!=null?_sn(Ssn(t)):{},Gwt(e||!t||!t.__esModule?cY(r,"default",{value:t,enumerable:!0}):r,t)),Nfe=t=>Gwt(cY({},"__esModule",{value:!0}),t);var M=(t,e,r)=>xsn(t,typeof e!="symbol"?e+"":e,r),Osn=(t,e,r)=>e.has(t)||Wwt("Cannot "+r);var dY=(t,e,r)=>e.has(t)?Wwt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var Zwt=(t,e,r)=>(Osn(t,e,"access private method"),r);function nke(){if(!jfe&&(jfe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!jfe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return jfe(Tsn)}var jfe,Tsn,Xwt=v(()=>{Tsn=new Uint8Array(16)});function Ywt(t,e=0){return Hh[t[e+0]]+Hh[t[e+1]]+Hh[t[e+2]]+Hh[t[e+3]]+"-"+Hh[t[e+4]]+Hh[t[e+5]]+"-"+Hh[t[e+6]]+Hh[t[e+7]]+"-"+Hh[t[e+8]]+Hh[t[e+9]]+"-"+Hh[t[e+10]]+Hh[t[e+11]]+Hh[t[e+12]]+Hh[t[e+13]]+Hh[t[e+14]]+Hh[t[e+15]]}var Hh,Qwt=v(()=>{Hh=[];for(let t=0;t<256;++t)Hh.push((t+256).toString(16).slice(1))});var Esn,oke,eSt=v(()=>{Esn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),oke={randomUUID:Esn}});function Psn(t,e,r){if(oke.randomUUID&&!e&&!t)return oke.randomUUID();t=t||{};let n=t.random||(t.rng||nke)();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 Ywt(n)}var H0,tSt=v(()=>{eSt();Xwt();Qwt();H0=Psn});var J3=v(()=>{tSt()});var Msn,Et,Do=v(()=>{Msn=Object.defineProperty,Et=(t,e)=>{for(var r in e)Msn(t,r,{get:e[r],enumerable:!0})}});function fY(t,e=UU){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 UU(t){if(typeof t>"u")return null;try{return JSON.parse(t)}catch{}let e="",r=[],n=!1,o=!1;for(let i of t){if(n)i==='"'&&!o?n=!1:i===`
|
||
`&&!o?i="\\n":i==="\\"?o=!o:o=!1;else if(i==='"')n=!0,o=!1;else if(i==="{")r.push("}");else if(i==="[")r.push("]");else if(i==="}"||i==="]")if(r&&r[r.length-1]===i)r.pop();else return null;e+=i}n&&(e+='"');for(let i=r.length-1;i>=0;i-=1)e+=r[i];try{return JSON.parse(e)}catch{return null}}var pY=v(()=>{});function H$(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
|
||
`,t}var mY=v(()=>{});var nSt=S((mgi,rSt)=>{"use strict";rSt.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 cSt=S((hgi,ike)=>{"use strict";var Rsn=/[\p{Lu}]/u,Asn=/[\p{Ll}]/u,oSt=/^[\p{Lu}](?![\p{Lu}])/gu,sSt=/([\p{Alpha}\p{N}_]|$)/u,uSt=/[_.\- ]+/,Isn=new RegExp("^"+uSt.source),iSt=new RegExp(uSt.source+sSt.source,"gu"),aSt=new RegExp("\\d+"+sSt.source,"gu"),Nsn=(t,e,r)=>{let n=!1,o=!1,i=!1;for(let a=0;a<t.length;a++){let s=t[a];n&&Rsn.test(s)?(t=t.slice(0,a)+"-"+t.slice(a),n=!1,i=o,o=!0,a++):o&&i&&Asn.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},jsn=(t,e)=>(oSt.lastIndex=0,t.replace(oSt,r=>e(r))),Dsn=(t,e)=>(iSt.lastIndex=0,aSt.lastIndex=0,t.replace(iSt,(r,n)=>e(n)).replace(aSt,r=>e(r))),lSt=(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=Nsn(t,r,n)),t=t.replace(Isn,""),e.preserveConsecutiveUppercase?t=jsn(t,r):t=r(t),e.pascalCase&&(t=n(t.charAt(0))+t.slice(1)),Dsn(t,n))};ike.exports=lSt;ike.exports.default=lSt});function fSt(t,e){return e?.[t]||(0,dSt.default)(t)}function pSt(t,e,r){let n={};for(let o in t)Object.hasOwn(t,o)&&(n[e(o,r)]=t[o]);return n}var dSt,$sn,mSt=v(()=>{dSt=L(nSt(),1),$sn=L(cSt(),1)});function hSt(t){return Array.isArray(t)?[...t]:{...t}}function Fsn(t,e){let r=hSt(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]=hSt(s[u]),s=s[u]}s[i]!==void 0&&(s[i]={lc:1,type:"secret",id:[o]})}return r}function Dfe(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 Lsn,Vh,V$=v(()=>{Do();mSt();Lsn={};Et(Lsn,{Serializable:()=>Vh,get_lc_unique_name:()=>Dfe});Vh=class gSt{constructor(e,...r){M(this,"lc_serializable",!1);M(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,Dfe(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 gSt||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,i)=>(o[i]=i in this?this[i]:this.lc_kwargs[i],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));return Object.keys(r).forEach(o=>{let i=this,a=n,[s,...u]=o.split(".").reverse();for(let l of u.reverse()){if(!(l in i)||i[l]===void 0)return;(!(l in a)||a[l]===void 0)&&(typeof i[l]=="object"&&i[l]!=null?a[l]={}:Array.isArray(i[l])&&(a[l]=[])),i=i[l],a=a[l]}s in i&&i[s]!==void 0&&(a[s]=a[s]||i[s])}),{lc:1,type:"constructor",id:this.lc_id,kwargs:pSt(Object.keys(r).length?Fsn(n,r):n,fSt,e)}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}}});function J$(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="tool_call")}function ySt(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 K3,$fe=v(()=>{K3=class extends Error{constructor(e,r){super(e);M(this,"output");this.output=r}}});var bSt,K$,_St,W$,hY=v(()=>{bSt=Symbol.for("ls:tracing_async_local_storage"),K$=Symbol.for("lc:context_variables"),_St=t=>{globalThis[bSt]=t},W$=()=>globalThis[bSt]});function Zm(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 W3(t){return Zm(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function G3(t){return Zm(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function vSt(t){return Zm(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function Lfe(t){return Zm(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function Ffe(t){if(Zm(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 gY(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 Hg({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 oO(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 yY=v(()=>{});function Mr(t,e){return Cn(t)&&t.type===e}function Cn(t){return typeof t=="object"&&t!==null}function Jb(t){return Array.isArray(t)}function er(t){return typeof t=="string"}function gv(t){return typeof t=="number"}function kfe(t){return t instanceof Uint8Array}function ake(t){try{return JSON.parse(t)}catch{return}}var iN,zU=v(()=>{iN=t=>t()});function ksn(t){if(t.type==="char_location"&&er(t.document_title)&&gv(t.start_char_index)&&gv(t.end_char_index)&&er(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"&&er(t.document_title)&&gv(t.start_page_number)&&gv(t.end_page_number)&&er(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"&&er(t.document_title)&&gv(t.start_block_index)&&gv(t.end_block_index)&&er(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"&&er(t.url)&&er(t.title)&&er(t.encrypted_index)&&er(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"&&er(t.source)&&er(t.title)&&gv(t.start_block_index)&&gv(t.end_block_index)&&er(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 SSt(t){if(Mr(t,"document")&&Cn(t.source)&&"type"in t.source){if(t.source.type==="base64"&&er(t.source.media_type)&&er(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&er(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&er(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&er(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(Mr(t,"image")&&Cn(t.source)&&"type"in t.source){if(t.source.type==="base64"&&er(t.source.media_type)&&er(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&er(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&er(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function CSt(t){function*e(){for(let r of t){let n=SSt(r);n?yield n:yield r}}return Array.from(e())}function wSt(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")&&er(n.text)){let{text:o,citations:i,...a}=n;if(Jb(i)&&i.length){let s=i.reduce((u,l)=>{let c=ksn(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")&&er(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")&&er(n.name)&&er(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(Mr(n,"input_json_delta")){if(qsn(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")&&er(n.name)&&er(n.id)){let{name:o,id:i}=n;if(o==="web_search"){let a=iN(()=>{if(typeof n.input=="string")return n.input;if(Cn(n.input)&&er(n.input.query))return n.input.query;if(er(n.partial_json)){let s=ake(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=iN(()=>{if(typeof n.input=="string")return n.input;if(Cn(n.input)&&er(n.input.code))return n.input.code;if(er(n.partial_json)){let s=ake(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")&&er(n.tool_use_id)&&Jb(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")&&er(n.tool_use_id)&&Cn(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")&&er(n.tool_use_id)&&Cn(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=SSt(n);if(o){yield o;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}function qsn(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}var xSt,ske=v(()=>{zU();xSt={translateContent:wSt,translateContentChunk:wSt}});function Bsn(t){return W3(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:G3(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:Lfe(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function OSt(t){return t.map(Bsn)}function TSt(t){return!!(Mr(t,"image_url")&&Cn(t.image_url)||Mr(t,"input_audio")&&Cn(t.input_audio)||Mr(t,"file")&&Cn(t.file))}function ESt(t){if(Mr(t,"image_url")&&Cn(t.image_url)&&er(t.image_url.url)){let e=Hg({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")&&Cn(t.input_audio)&&er(t.input_audio.data)&&er(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(Mr(t,"file")&&Cn(t.file)&&er(t.file.data)){let e=Hg({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(er(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}var uke=v(()=>{yY();zU()});function Usn(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...qfe(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 zsn(t){let e=[];typeof t.content=="string"?e.push({type:"text",text:t.content}):e.push(...qfe(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 qfe(t){let e=[];for(let r of t)TSt(r)?e.push(ESt(r)):e.push(r);return e}function Hsn(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 PSt(t){function*e(){Cn(t.additional_kwargs?.reasoning)&&Jb(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((o,i)=>Cn(i)&&er(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(Hsn)}: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(Cn(t.additional_kwargs)&&Jb(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(er(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),Jb(n.outputs)){let o=iN(()=>{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}Cn(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function Vsn(t){function*e(){yield*PSt(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 MSt,lke=v(()=>{zU();uke();MSt={translateContent:t=>typeof t.content=="string"?Usn(t):PSt(t),translateContentChunk:t=>typeof t.content=="string"?zsn(t):Vsn(t)}});function Bfe(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}var cke=v(()=>{});function Kb(t,e){return typeof t=="string"?t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.some(r=>Zm(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e]:Array.isArray(e)?HU(t,e)??[...t,...e]:e===""?t:Array.isArray(t)&&t.some(r=>Zm(r))?[...t,{type:"file",source_type:"text",text:e}]:[...t,{type:"text",text:e}]}function Ufe(t,e){return t==="error"||e==="error"?"error":"success"}function Jsn(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 ASt(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}function xl(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)?r[n]=o:r[n]+=o}else if(typeof r[n]=="object"&&!Array.isArray(r[n]))r[n]=xl(r[n],o);else if(Array.isArray(r[n]))r[n]=HU(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 HU(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]=xl(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 zfe(t,e){if(!t&&!e)throw new Error("Cannot merge two undefined objects.");if(!t||!e)return t||e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types.
|
||
Left ${typeof t}
|
||
Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return HU(t,e);if(typeof t=="object"&&typeof e=="object")return xl(t,e);if(t===e)return t;throw new Error(`Can not merge objects of different types.
|
||
Left ${t}
|
||
Right ${e}`)}function Hfe(t){return typeof t.role=="string"}function Xm(t){return typeof t?._getType=="function"}function Z3(t){return Xm(t)&&typeof t.concat=="function"}var dke,RSt,Jc,Wb,Vg=v(()=>{V$();yY();ske();uke();lke();cke();dke=Symbol.for("langchain.message");Jc=class extends Vh{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);M(this,"lc_namespace",["langchain_core","messages"]);M(this,"lc_serializable",!0);M(this,RSt,!0);M(this,"id");M(this,"name");M(this,"content");M(this,"additional_kwargs");M(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[OSt,qfe,CSt].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&&dke in e&&e[dke]===!0&&Bfe(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[(RSt=dke,Symbol.toStringTag)](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let r=Jsn(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${r}`}};Wb=class extends Jc{static isInstance(t){return super.isInstance(t)&&"concat"in t&&typeof t.concat=="function"}}});function bY(t){return t!=null&&typeof t=="object"&&"lc_direct_tool_output"in t&&t.lc_direct_tool_output===!0}function _Y(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 vY(t){return typeof t=="object"&&t!==null&&"getType"in t&&typeof t.getType=="function"&&t.getType()==="tool"}function fke(t){return t._getType()==="tool"}var Ksn,Gb,Aw,X3=v(()=>{Do();Vg();Ksn={};Et(Ksn,{ToolMessage:()=>Gb,ToolMessageChunk:()=>Aw,defaultToolCallParser:()=>_Y,isDirectToolOutput:()=>bY,isToolMessage:()=>vY,isToolMessageChunk:()=>fke});Gb=class extends Jc{constructor(e,r,n){let o=typeof e=="string"||Array.isArray(e)?{content:e,name:n,tool_call_id:r}:e;super(o);M(this,"lc_direct_tool_output",!0);M(this,"type","tool");M(this,"status");M(this,"tool_call_id");M(this,"metadata");M(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}}},Aw=class extends Wb{constructor(e){super(e);M(this,"type","tool");M(this,"tool_call_id");M(this,"status");M(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:Kb(this.content,e.content),additional_kwargs:xl(this.additional_kwargs,e.additional_kwargs),response_metadata:xl(this.response_metadata,e.response_metadata),artifact:zfe(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:Ufe(this.status,e.status)})}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}}});function pke(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 Wsn(t){if(Cn(t.document)&&Cn(t.document.source)){let e=Cn(t.document)&&er(t.document.format)?t.document.format:"",r=pke(e);if(Cn(t.document.source)){if(Cn(t.document.source.s3Location)&&er(t.document.source.s3Location.uri))return{type:"file",mimeType:r,fileId:t.document.source.s3Location.uri};if(kfe(t.document.source.bytes))return{type:"file",mimeType:r,data:t.document.source.bytes};if(er(t.document.source.text))return{type:"file",mimeType:r,data:Buffer.from(t.document.source.text).toString("base64")};if(Jb(t.document.source.content)){let n=t.document.source.content.reduce((o,i)=>Cn(i)&&er(i.text)?o+i.text:o,"");return{type:"file",mimeType:r,data:n}}}}return{type:"non_standard",value:t}}function Gsn(t){if(Mr(t,"image")&&Cn(t.image)){let e=Cn(t.image)&&er(t.image.format)?t.image.format:"",r=pke(e);if(Cn(t.image.source)){if(Cn(t.image.source.s3Location)&&er(t.image.source.s3Location.uri))return{type:"image",mimeType:r,fileId:t.image.source.s3Location.uri};if(kfe(t.image.source.bytes))return{type:"image",mimeType:r,data:t.image.source.bytes}}}return{type:"non_standard",value:t}}function Zsn(t){if(Mr(t,"video")&&Cn(t.video)){let e=Cn(t.video)&&er(t.video.format)?t.video.format:"",r=pke(e);if(Cn(t.video.source)){if(Cn(t.video.source.s3Location)&&er(t.video.source.s3Location.uri))return{type:"video",mimeType:r,fileId:t.video.source.s3Location.uri};if(kfe(t.video.source.bytes))return{type:"video",mimeType:r,data:t.video.source.bytes}}}return{type:"non_standard",value:t}}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,"cache_point")){yield{type:"non_standard",value:n};continue}else if(Mr(n,"citations_content")&&Cn(n.citationsContent)){let o=Jb(n.citationsContent.content)?n.citationsContent.content.reduce((a,s)=>Cn(s)&&er(s.text)?a+s.text:a,""):"",i=Jb(n.citationsContent.citations)?n.citationsContent.citations.reduce((a,s)=>{if(Cn(s)){let u=Jb(s.sourceContent)?s.sourceContent.reduce((c,d)=>Cn(d)&&er(d.text)?c+d.text:c,""):"",l=iN(()=>{if(Cn(s.location)){let c=s.location.documentChar||s.location.documentPage||s.location.documentChunk;if(Cn(c))return{source:gv(c.documentIndex)?c.documentIndex.toString():void 0,startIndex:gv(c.start)?c.start:void 0,endIndex:gv(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")&&Cn(n.document)){yield Wsn(n);continue}else if(Mr(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(Mr(n,"image")&&Cn(n.image)){yield Gsn(n);continue}else if(Mr(n,"reasoning_content")&&er(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(Mr(n,"text")&&er(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")&&Cn(n.video)){yield Zsn(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var NSt,jSt=v(()=>{zU();NSt={translateContent:ISt,translateContentChunk:ISt}});function DSt(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")&&er(n.text)){yield{type:"text",text:n.text};continue}else if(Mr(n,"inlineData")&&Cn(n.inlineData)&&er(n.inlineData.mimeType)&&er(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(Mr(n,"functionCall")&&Cn(n.functionCall)&&er(n.functionCall.name)&&Cn(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")&&Cn(n.fileData)&&er(n.fileData.mimeType)&&er(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 $St,LSt=v(()=>{zU();$St={translateContent:DSt,translateContentChunk:DSt}});function FSt(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")&&er(n.reasoning)){let o=iN(()=>{let i=r.indexOf(n);if(Jb(t.additional_kwargs?.signatures)&&i>=0)return t.additional_kwargs.signatures.at(i)});er(o)?yield{type:"reasoning",reasoning:n.reasoning,signature:o}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(Mr(n,"text")&&er(n.text)){yield{type:"text",text:n.text};continue}else if(Mr(n,"image_url")){if(er(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")&&er(n.mimeType)&&er(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(e())}var kSt,qSt=v(()=>{zU();kSt={translateContent:FSt,translateContentChunk:FSt}});function mke(t){return globalThis.lc_block_translators_registry.get(t)}var BSt=v(()=>{ske();lke();jSt();LSt();qSt();globalThis.lc_block_translators_registry??(globalThis.lc_block_translators_registry=new Map([["anthropic",xSt],["bedrock-converse",NSt],["google-genai",$St],["google-vertexai",kSt],["openai",MSt]]))});function Vfe(t,e){return xl(t??{},e??{})}function USt(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 Xsn(t,e){let r={...USt(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 Ysn(t,e){let r={...USt(t,e)};return(t?.reasoning!==void 0||e?.reasoning!==void 0)&&(r.reasoning=(t?.reasoning??0)+(e?.reasoning??0)),r}function Jfe(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:Xsn(t?.input_token_details,e?.input_token_details),output_token_details:Ysn(t?.output_token_details,e?.output_token_details)}}var hke=v(()=>{Vg()});function Us(t){return t._getType()==="ai"}function wY(t){return t._getType()==="ai"}var li,Ur,V0=v(()=>{pY();Vg();BSt();hke();X3();li=class extends Jc{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]=_Y(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.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);M(this,"type","ai");M(this,"tool_calls",[]);M(this,"invalid_tool_calls",[]);M(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=mke(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=>({...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"}};Ur=class extends Wb{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)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=e.tool_call_chunks.reduce((a,s)=>{let u=a.findIndex(([l])=>"id"in s&&s.id&&"index"in s&&s.index!==void 0?s.id===l.id&&s.index===l.index:"id"in s&&s.id?s.id===l.id:"index"in s&&s.index!==void 0?s.index===l.index:!1);return u!==-1?a[u].push(s):a.push([s]),a},[]),o=[],i=[];for(let a of n){let s=null,u=a[0]?.name??"",l=a.map(f=>f.args||"").join(""),c=l.length?l:"{}",d=a[0]?.id;try{if(s=UU(c),!d||s===null||typeof s!="object"||Array.isArray(s))throw new Error("Malformed tool call chunk args.");o.push({name:u,args:s,id:d,type:"tool_call"})}catch{i.push({name:u,args:c,id:d,error:"Malformed args.",type:"invalid_tool_call"})}}r={...e,tool_calls:o,invalid_tool_calls:i,usage_metadata:e.usage_metadata!==void 0?e.usage_metadata:void 0}}super(r);M(this,"type","ai");M(this,"tool_calls",[]);M(this,"invalid_tool_calls",[]);M(this,"tool_call_chunks",[]);M(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=mke(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:Kb(this.content,e.content),additional_kwargs:xl(this.additional_kwargs,e.additional_kwargs),response_metadata:Vfe(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=HU(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=Jfe(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 HSt(t){return t._getType()==="generic"}function VSt(t){return t._getType()==="generic"}var cd,yv,SY=v(()=>{Vg();cd=class zSt extends Jc{constructor(r,n){(typeof r=="string"||Array.isArray(r))&&(r={content:r,role:n});super(r);M(this,"type","generic");M(this,"role");this.role=r.role}static lc_name(){return"ChatMessage"}static _chatMessageClass(){return zSt}static isInstance(r){return super.isInstance(r)&&r.type==="generic"}get _printableFields(){return{...super._printableFields,role:this.role}}},yv=class extends Wb{constructor(e,r){(typeof e=="string"||Array.isArray(e))&&(e={content:e,role:r});super(e);M(this,"type","generic");M(this,"role");this.role=e.role}static lc_name(){return"ChatMessageChunk"}concat(e){let r=this.constructor;return new r({content:Kb(this.content,e.content),additional_kwargs:xl(this.additional_kwargs,e.additional_kwargs),response_metadata:xl(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 JSt(t){return t._getType()==="function"}function KSt(t){return t._getType()==="function"}var VU,bv,Kfe=v(()=>{Vg();VU=class extends Jc{constructor(e){super(e);M(this,"type","function");M(this,"name");this.name=e.name}static lc_name(){return"FunctionMessage"}},bv=class extends Wb{constructor(){super(...arguments);M(this,"type","function")}static lc_name(){return"FunctionMessageChunk"}concat(e){let r=this.constructor;return new r({content:Kb(this.content,e.content),additional_kwargs:xl(this.additional_kwargs,e.additional_kwargs),response_metadata:xl(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}}});function WSt(t){return t.getType()==="human"}function GSt(t){return t.getType()==="human"}var su,_v,G$=v(()=>{Vg();su=class extends Jc{constructor(e){super(e);M(this,"type","human")}static lc_name(){return"HumanMessage"}static isInstance(e){return super.isInstance(e)&&e.type==="human"}},_v=class extends Wb{constructor(e){super(e);M(this,"type","human")}static lc_name(){return"HumanMessageChunk"}concat(e){let r=this.constructor;return new r({content:Kb(this.content,e.content),additional_kwargs:xl(this.additional_kwargs,e.additional_kwargs),response_metadata:xl(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="human"}}});function ZSt(t){return t._getType()==="system"}function XSt(t){return t._getType()==="system"}var Ym,Ky,CY=v(()=>{Vg();Ym=class extends Jc{constructor(e){super(e);M(this,"type","system")}static lc_name(){return"SystemMessage"}static isInstance(e){return super.isInstance(e)&&e.type==="system"}},Ky=class extends Wb{constructor(e){super(e);M(this,"type","system")}static lc_name(){return"SystemMessageChunk"}concat(e){let r=this.constructor;return new r({content:Kb(this.content,e.content),additional_kwargs:xl(this.additional_kwargs,e.additional_kwargs),response_metadata:xl(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&e.type==="system"}}});var JU,Wfe=v(()=>{Vg();JU=class extends Jc{constructor(e){super({...e,content:[]});M(this,"type","remove");M(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 Qsn(t){return J$(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 eun(t){return typeof t=="object"&&t!=null&&t.lc===1&&Array.isArray(t.id)&&t.kwargs!=null&&typeof t.kwargs=="object"}function gke(t){let e,r;if(eun(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 su(r);if(e==="ai"||e==="assistant"){let{tool_calls:n,...o}=r;if(!Array.isArray(n))return new li(r);let i=n.map(Qsn);return new li({...o,tool_calls:i})}else{if(e==="system")return new Ym(r);if(e==="developer")return new Ym({...r,additional_kwargs:{...r.additional_kwargs,__openai_role__:"developer"}});if(e==="tool"&&"tool_call_id"in r)return new Gb({...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 JU({...r,id:r.id});throw H$(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 Iw(t){if(typeof t=="string")return new su(t);if(Xm(t))return t;if(Array.isArray(t)){let[e,r]=t;return gke({type:e,content:r})}else if(Hfe(t)){let{role:e,...r}=t;return gke({...r,type:e})}else return gke(t)}function rl(t,e="Human",r="AI"){let n=[];for(let o of t){let i;if(o._getType()==="human")i=e;else if(o._getType()==="ai")i=r;else if(o._getType()==="system")i="System";else if(o._getType()==="tool")i="Tool";else if(o._getType()==="generic")i=o.role;else throw new Error(`Got unsupported message type: ${o._getType()}`);let a=o.name?`${o.name}, `:"",s=typeof o.content=="string"?o.content:JSON.stringify(o.content,null,2);n.push(`${i}: ${a}${s}`)}return n.join(`
|
||
`)}function tun(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 xY(t){let e=tun(t);switch(e.type){case"human":return new su(e.data);case"ai":return new li(e.data);case"system":return new Ym(e.data);case"function":if(e.data.name===void 0)throw new Error("Name must be defined for function messages");return new VU(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 Gb(e.data);case"generic":if(e.data.role===void 0)throw new Error("Role must be defined for chat messages");return new cd(e.data);default:throw new Error(`Got unexpected type: ${e.type}`)}}function QSt(t){return t.map(xY)}function e0t(t){return t.map(e=>e.toDict())}function KU(t){let e=t._getType();if(e==="human")return new _v({...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 Ur({...r})}else{if(e==="system")return new Ky({...t});if(e==="function")return new bv({...t});if(cd.isInstance(t))return new yv({...t});throw new Error("Unknown message type.")}}var YSt,iO=v(()=>{Vg();X3();V0();SY();Kfe();G$();CY();mY();$fe();Wfe();YSt=t=>t()});function _ke(){return yke===void 0&&(yke={library:"langchain-js",runtime:bke()}),yke}function gn(t){try{return typeof process<"u"?process.env?.[t]:Gfe()?Deno?.env.get(t):void 0}catch{return}}var run,t0t,r0t,n0t,Gfe,o0t,bke,yke,nl=v(()=>{Do();run={};Et(run,{getEnv:()=>bke,getEnvironmentVariable:()=>gn,getRuntimeEnvironment:()=>_ke,isBrowser:()=>t0t,isDeno:()=>Gfe,isJsDom:()=>n0t,isNode:()=>o0t,isWebWorker:()=>r0t});t0t=()=>typeof window<"u"&&typeof window.document<"u",r0t=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",n0t=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),Gfe=()=>typeof Deno<"u",o0t=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!Gfe(),bke=()=>{let t;return t0t()?t="browser":o0t()?t="node":r0t()?t="webworker":n0t()?t="jsdom":Gfe()?t="deno":t="other",t}});var i0t,a0t=v(()=>{i0t=/^(?:[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 nun(t){return typeof t=="string"&&i0t.test(t)}var Y3,s0t=v(()=>{a0t();Y3=nun});function u0t(t,e=0){return(Jh[t[e+0]]+Jh[t[e+1]]+Jh[t[e+2]]+Jh[t[e+3]]+"-"+Jh[t[e+4]]+Jh[t[e+5]]+"-"+Jh[t[e+6]]+Jh[t[e+7]]+"-"+Jh[t[e+8]]+Jh[t[e+9]]+"-"+Jh[t[e+10]]+Jh[t[e+11]]+Jh[t[e+12]]+Jh[t[e+13]]+Jh[t[e+14]]+Jh[t[e+15]]).toLowerCase()}var Jh,Zfe,l0t=v(()=>{Jh=[];for(Zfe=0;Zfe<256;++Zfe)Jh.push((Zfe+256).toString(16).slice(1))});function vke(){if(!Xfe&&(Xfe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Xfe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xfe(oun)}var Xfe,oun,c0t=v(()=>{oun=new Uint8Array(16)});var iun,wke,d0t=v(()=>{iun=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),wke={randomUUID:iun}});function aun(t,e,r){if(wke.randomUUID&&!e&&!t)return wke.randomUUID();t=t||{};var n=t.random||(t.rng||vke)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return u0t(n)}var Zb,f0t=v(()=>{d0t();c0t();l0t();Zb=aun});var OY=v(()=>{f0t();s0t()});function TY(t){return"lc_prefer_streaming"in t&&t.lc_prefer_streaming}var uun,lun,WU,Ske,EY=v(()=>{Do();V$();nl();OY();uun={};Et(uun,{BaseCallbackHandler:()=>WU,callbackHandlerPrefersStreaming:()=>TY,isBaseCallbackHandler:()=>Ske});lun=class{};WU=class extends lun{constructor(e){super();M(this,"lc_serializable",!1);M(this,"lc_kwargs");M(this,"ignoreLLM",!1);M(this,"ignoreChain",!1);M(this,"ignoreAgent",!1);M(this,"ignoreRetriever",!1);M(this,"ignoreCustomEvent",!1);M(this,"raiseError",!1);M(this,"awaitHandlers",gn("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,Dfe(this.constructor)]}copy(){return new this.constructor(this)}toJSON(){return Vh.prototype.toJSON.call(this)}toJSONNotImplemented(){return Vh.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){class r extends WU{constructor(){super();M(this,"name",Zb());Object.assign(this,e)}}return new r}},Ske=t=>{let e=t;return e!==void 0&&typeof e.copy=="function"&&typeof e.name=="string"&&typeof e.awaitHandlers=="boolean"}});var p0t,m0t=v(()=>{p0t=/^(?:[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 cun(t){return typeof t=="string"&&p0t.test(t)}var h0t,g0t=v(()=>{m0t();h0t=cun});function dun(t){if(!h0t(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 y0t,b0t=v(()=>{g0t();y0t=dun});function Qfe(t,e=0){return(Kh[t[e+0]]+Kh[t[e+1]]+Kh[t[e+2]]+Kh[t[e+3]]+"-"+Kh[t[e+4]]+Kh[t[e+5]]+"-"+Kh[t[e+6]]+Kh[t[e+7]]+"-"+Kh[t[e+8]]+Kh[t[e+9]]+"-"+Kh[t[e+10]]+Kh[t[e+11]]+Kh[t[e+12]]+Kh[t[e+13]]+Kh[t[e+14]]+Kh[t[e+15]]).toLowerCase()}var Kh,Yfe,Cke=v(()=>{Kh=[];for(Yfe=0;Yfe<256;++Yfe)Kh.push((Yfe+256).toString(16).slice(1))});function xke(){if(!epe&&(epe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!epe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return epe(fun)}var epe,fun,_0t=v(()=>{fun=new Uint8Array(16)});function pun(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}function Oke(t,e,r){function n(o,i,a,s){var u;if(typeof o=="string"&&(o=pun(o)),typeof i=="string"&&(i=y0t(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 Qfe(l)}try{n.name=t}catch{}return n.DNS=mun,n.URL=hun,n}var mun,hun,v0t=v(()=>{Cke();b0t();mun="6ba7b810-9dad-11d1-80b4-00c04fd430c8",hun="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});var gun,Tke,w0t=v(()=>{gun=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Tke={randomUUID:gun}});function yun(t,e,r){if(Tke.randomUUID&&!e&&!t)return Tke.randomUUID();t=t||{};var n=t.random||(t.rng||xke)();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 Qfe(n)}var aN,S0t=v(()=>{w0t();_0t();Cke();aN=yun});function bun(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 Eke(t,e){return t<<e|t>>>32-e}function _un(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]=Eke(f[m-3]^f[m-8]^f[m-14]^f[m-16],1);for(var h=r[0],g=r[1],y=r[2],b=r[3],_=r[4],w=0;w<80;++w){var x=Math.floor(w/20),O=Eke(h,5)+bun(x,g,y,b)+_+e[x]+f[w]>>>0;_=b,b=y,y=Eke(g,30)>>>0,g=h,h=O}r[0]=r[0]+h>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+y>>>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 C0t,x0t=v(()=>{C0t=_un});var vun,tpe,O0t=v(()=>{v0t();x0t();vun=Oke("v5",80,C0t),tpe=vun});var Pke=v(()=>{S0t();O0t()});var E0t,P0t,Mke,M0t,Rke,Ake,Ike,R0t,A0t,I0t,N0t,j0t,D0t,$0t,L0t,F0t,k0t,q0t,B0t,U0t,z0t,H0t,V0t,J0t,K0t,W0t,G0t,Z0t,X0t,Y0t,Nke,Q0t,eCt,tCt=v(()=>{E0t="gen_ai.operation.name",P0t="gen_ai.system",Mke="gen_ai.request.model",M0t="gen_ai.response.model",Rke="gen_ai.usage.input_tokens",Ake="gen_ai.usage.output_tokens",Ike="gen_ai.usage.total_tokens",R0t="gen_ai.request.max_tokens",A0t="gen_ai.request.temperature",I0t="gen_ai.request.top_p",N0t="gen_ai.request.frequency_penalty",j0t="gen_ai.request.presence_penalty",D0t="gen_ai.response.finish_reasons",$0t="gen_ai.prompt",L0t="gen_ai.completion",F0t="gen_ai.request.extra_query",k0t="gen_ai.request.extra_body",q0t="gen_ai.serialized.name",B0t="gen_ai.serialized.signature",U0t="gen_ai.serialized.doc",z0t="gen_ai.response.id",H0t="gen_ai.response.service_tier",V0t="gen_ai.response.system_fingerprint",J0t="gen_ai.usage.input_token_details",K0t="gen_ai.usage.output_token_details",W0t="langsmith.trace.session_id",G0t="langsmith.trace.session_name",Z0t="langsmith.span.kind",X0t="langsmith.trace.name",Y0t="langsmith.metadata",Nke="langsmith.span.tags",Q0t="langsmith.request.streaming",eCt="langsmith.request.headers"});var Sun,rCt,nCt,oCt,jke=v(()=>{sN();Sun=(...t)=>fetch(...t),rCt=Symbol.for("ls:fetch_implementation"),nCt=()=>{let t=globalThis[rCt];return t?typeof t=="function"&&"Headers"in t&&"Request"in t&&"Response"in t:!1},oCt=t=>async(...e)=>{if(t||dd("DEBUG")==="true"){let[n,o]=e;console.log(`\u2192 ${o?.method||"GET"} ${n}`)}let r=await(globalThis[rCt]??Sun)(...e);return(t||dd("DEBUG")==="true")&&console.log(`\u2190 ${r.status} ${r.statusText} ${r.url}`),r}});var PY,Dke=v(()=>{sN();PY=()=>dd("PROJECT")??vv("LANGCHAIN_SESSION")??"default"});var rpe,npe=v(()=>{$ke();Lke();jke();Dke();rpe="0.3.74"});function ope(){if(Fke===void 0){let t=qke(),e=Pun();Fke={library:"langsmith",runtime:t,sdk:"langsmith-js",sdk_version:rpe,...e}}return Fke}function Bke(){let t=Eun(),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 Eun(){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 vv(t){try{return typeof process<"u"?process.env?.[t]:void 0}catch{return}}function dd(t){return vv(`LANGSMITH_${t}`)||vv(`LANGCHAIN_${t}`)}function Pun(){if(kke!==void 0)return kke;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=vv(r);n!==void 0&&(e[r]=n)}return kke=e,e}function ipe(){return vv("OTEL_ENABLED")==="true"||dd("OTEL_ENABLED")==="true"}var aO,Cun,xun,Oun,iCt,Tun,qke,Fke,kke,sN=v(()=>{npe();Cun=()=>typeof window<"u"&&typeof window.document<"u",xun=()=>typeof globalThis=="object"&&globalThis.constructor&&globalThis.constructor.name==="DedicatedWorkerGlobalScope",Oun=()=>typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&navigator.userAgent.includes("jsdom"),iCt=()=>typeof Deno<"u",Tun=()=>typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"&&!iCt(),qke=()=>aO||(typeof Bun<"u"?aO="bun":Cun()?aO="browser":Tun()?aO="node":xun()?aO="webworker":Oun()?aO="jsdom":iCt()?aO="deno":aO="other",aO)});function ape(){return Wke.getTraceInstance()}function sCt(){return Wke.getContextInstance()}function uCt(){return Wke.getDefaultOTLPTracerComponents()}var Hke,Vke,Jke,Uke,zke,aCt,Mun,Run,Kke,Wke,Gke=v(()=>{sN();Hke=class{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...r){!this.hasWarned&&ipe()&&(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()}},Vke=class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new Hke})}getTracer(e,r){return this.mockTracer}getActiveSpan(){}setSpan(e,r){return e}getSpan(e){}setSpanContext(e,r){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},Jke=class{active(){return{}}with(e,r){return r()}},Uke=Symbol.for("ls:otel_trace"),zke=Symbol.for("ls:otel_context"),aCt=Symbol.for("ls:otel_get_default_otlp_tracer_provider"),Mun=new Vke,Run=new Jke,Kke=class{getTraceInstance(){return globalThis[Uke]??Mun}getContextInstance(){return globalThis[zke]??Run}initializeGlobalInstances(e){globalThis[Uke]===void 0&&(globalThis[Uke]=e.trace),globalThis[zke]===void 0&&(globalThis[zke]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[aCt]=e}getDefaultOTLPTracerComponents(){return globalThis[aCt]??void 0}},Wke=new Kke});function Iun(t){return Aun[t]||t}var Aun,spe,lCt=v(()=>{tCt();Gke();Aun={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};spe=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&&ape().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(Z0t,r.run_type);let s=Iun(r.run_type||"chain");e.setAttribute(E0t,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(G0t,r.session_name),this.setGenAiSystem(e,r);let o=this.extractModelName(r);o&&e.setAttribute(Mke,o),"prompt_tokens"in r&&typeof r.prompt_tokens=="number"&&e.setAttribute(Rke,r.prompt_tokens),"completion_tokens"in r&&typeof r.completion_tokens=="number"&&e.setAttribute(Ake,r.completion_tokens),"total_tokens"in r&&typeof r.total_tokens=="number"&&e.setAttribute(Ike,r.total_tokens),this.setInvocationParameters(e,r);let i=r.extra?.metadata||{};for(let[s,u]of Object.entries(i))u!=null&&e.setAttribute(`${Y0t}.${s}`,String(u));let a=r.tags;if(a&&Array.isArray(a)?e.setAttribute(Nke,a.join(", ")):a&&e.setAttribute(Nke,String(a)),"serialized"in r&&typeof r.serialized=="object"){let s=r.serialized;s.name&&e.setAttribute(q0t,String(s.name)),s.signature&&e.setAttribute(B0t,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(P0t,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(R0t,n.max_tokens),n.temperature!==void 0&&e.setAttribute(A0t,n.temperature),n.top_p!==void 0&&e.setAttribute(I0t,n.top_p),n.frequency_penalty!==void 0&&e.setAttribute(N0t,n.frequency_penalty),n.presence_penalty!==void 0&&e.setAttribute(j0t,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(Mke,n.model),n.stream!==void 0&&e.setAttribute(Q0t,n.stream),n.extra_headers&&e.setAttribute(eCt,JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute(F0t,JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute(k0t,JSON.stringify(n.extra_body))),e.setAttribute($0t,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(Rke,o[0]),e.setAttribute(Ake,o[1]),e.setAttribute(Ike,o[0]+o[1])),n&&typeof n=="object"){if(n.model&&e.setAttribute(M0t,String(n.model)),n.id&&e.setAttribute(z0t,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(D0t,i.join(", "))}if(n.service_tier&&e.setAttribute(H0t,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(J0t,JSON.stringify(i.input_token_details)),i.output_token_details&&e.setAttribute(K0t,JSON.stringify(i.output_token_details))}}e.setAttribute(L0t,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]}}});var dCt=S((i_i,cCt)=>{function Nw(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}cCt.exports=Nw;Nw.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Nw.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Nw.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r),this._options.unref&&this._timer.unref(),!0};Nw.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Nw.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Nw.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Nw.prototype.start=Nw.prototype.try;Nw.prototype.errors=function(){return this._errors};Nw.prototype.attempts=function(){return this._attempts};Nw.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e}});var fCt=S(ZU=>{var Nun=dCt();ZU.operation=function(t){var e=ZU.timeouts(t);return new Nun(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};ZU.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(i,a){return i-a}),n};ZU.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};ZU.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var o=0;o<r.length;o++){var i=r[o],a=t[i];t[i]=function(u){var l=ZU.operation(e),c=Array.prototype.slice.call(arguments,1),d=c.pop();c.push(function(f){l.retry(f)||(f&&(arguments[0]=l.mainError()),d.apply(this,arguments))}),l.attempt(function(){u.apply(t,c)})}.bind(t,a),t[i].options=e}}});var mCt=S((s_i,pCt)=>{pCt.exports=fCt()});var cpe=S((u_i,lpe)=>{"use strict";var jun=mCt(),Dun=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"],upe=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}},$un=(t,e,r)=>{let n=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=n,t},Lun=t=>Dun.includes(t),hCt=(t,e)=>new Promise((r,n)=>{e={onFailedAttempt:()=>{},retries:10,...e};let o=jun.operation(e);o.attempt(async i=>{try{r(await t(i))}catch(a){if(!(a instanceof Error)){n(new TypeError(`Non-error was thrown: "${a}". You should only throw errors.`));return}if(a instanceof upe)o.stop(),n(a.originalError);else if(a instanceof TypeError&&!Lun(a.message))o.stop(),n(a);else{$un(a,i,e);try{await e.onFailedAttempt(a)}catch(s){n(s);return}o.retry(a)||n(o.mainError())}}})});lpe.exports=hCt;lpe.exports.default=hCt;lpe.exports.AbortError=upe});var Xke=S((l_i,Zke)=>{"use strict";var Fun=Object.prototype.hasOwnProperty,Wy="~";function MY(){}Object.create&&(MY.prototype=Object.create(null),new MY().__proto__||(Wy=!1));function kun(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function gCt(t,e,r,n,o){if(typeof r!="function")throw new TypeError("The listener must be a function");var i=new kun(r,n||t,o),a=Wy?Wy+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 dpe(t,e){--t._eventsCount===0?t._events=new MY:delete t._events[e]}function Jg(){this._events=new MY,this._eventsCount=0}Jg.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)Fun.call(r,n)&&e.push(Wy?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};Jg.prototype.listeners=function(e){var r=Wy?Wy+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};Jg.prototype.listenerCount=function(e){var r=Wy?Wy+e:e,n=this._events[r];return n?n.fn?1:n.length:0};Jg.prototype.emit=function(e,r,n,o,i,a){var s=Wy?Wy+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};Jg.prototype.on=function(e,r,n){return gCt(this,e,r,n,!1)};Jg.prototype.once=function(e,r,n){return gCt(this,e,r,n,!0)};Jg.prototype.removeListener=function(e,r,n,o){var i=Wy?Wy+e:e;if(!this._events[i])return this;if(!r)return dpe(this,i),this;var a=this._events[i];if(a.fn)a.fn===r&&(!o||a.once)&&(!n||a.context===n)&&dpe(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:dpe(this,i)}return this};Jg.prototype.removeAllListeners=function(e){var r;return e?(r=Wy?Wy+e:e,this._events[r]&&dpe(this,r)):(this._events=new MY,this._eventsCount=0),this};Jg.prototype.off=Jg.prototype.removeListener;Jg.prototype.addListener=Jg.prototype.on;Jg.prefixed=Wy;Jg.EventEmitter=Jg;typeof Zke<"u"&&(Zke.exports=Jg)});var Yke=S((c_i,yCt)=>{"use strict";yCt.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 _Ct=S((d_i,ppe)=>{"use strict";var qun=Yke(),fpe=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},bCt=(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 fpe(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);qun(t.then(n,o),()=>{clearTimeout(i)})});ppe.exports=bCt;ppe.exports.default=bCt;ppe.exports.TimeoutError=fpe});var vCt=S(Qke=>{"use strict";Object.defineProperty(Qke,"__esModule",{value:!0});function Uun(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}Qke.default=Uun});var wCt=S(tqe=>{"use strict";Object.defineProperty(tqe,"__esModule",{value:!0});var zun=vCt(),eqe=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=zun.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}};tqe.default=eqe});var CCt=S(nqe=>{"use strict";Object.defineProperty(nqe,"__esModule",{value:!0});var Hun=Xke(),SCt=_Ct(),Vun=wCt(),mpe=()=>{},Jun=new SCt.TimeoutError,rqe=class extends Hun{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=mpe,this._resolveIdle=mpe,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:Vun.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=mpe,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=mpe,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():SCt.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(Jun)});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}};nqe.default=rqe});var xCt,hpe,Kun,RY,OCt=v(()=>{xCt=L(cpe(),1),hpe=L(CCt(),1),Kun=[429,500,502,503,504],RY=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,"default"in hpe.default?this.queue=new hpe.default.default({concurrency:this.maxConcurrency}):this.queue=new hpe.default({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...r){let n=this.onFailedResponseHook;return this.queue.add(()=>(0,xCt.default)(()=>e(...r).catch(o=>{throw o instanceof Error?o:new Error(o)}),{async onFailedAttempt(o){if(o.message.startsWith("Cancel")||o.message.startsWith("TimeoutError")||o.name==="TimeoutError"||o.message.startsWith("AbortError")||o?.code==="ECONNABORTED")throw o;let i=o?.response;if(n&&await n(i))return;let a=i?.status??o?.status;if(a&&!Kun.includes(+a))throw o},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,r,...n){return e.signal?Promise.race([this.call(r,...n),new Promise((o,i)=>{e.signal?.addEventListener("abort",()=>{i(new Error("AbortError"))})})]):this.call(r,...n)}}});function oqe(t){return typeof t?._getType=="function"}function iqe(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(()=>{});function To(t,e){if(!Wun.test(t)){let r=e!==void 0?`Invalid UUID for ${e}: ${t}`:`Invalid UUID: ${t}`;throw new Error(r)}return t}var Wun,ECt=v(()=>{Wun=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});function AY(t){PCt[t]||(console.warn(t),PCt[t]=!0)}var PCt,aqe=v(()=>{PCt={}});var IY=S((__i,MCt)=>{"use strict";var Gun="2.0.0",Zun=Number.MAX_SAFE_INTEGER||9007199254740991,Xun=16,Yun=250,Qun=["major","premajor","minor","preminor","patch","prepatch","prerelease"];MCt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Xun,MAX_SAFE_BUILD_LENGTH:Yun,MAX_SAFE_INTEGER:Zun,RELEASE_TYPES:Qun,SEMVER_SPEC_VERSION:Gun,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var NY=S((v_i,RCt)=>{"use strict";var eln=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};RCt.exports=eln});var Q3=S((sO,ACt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:sqe,MAX_SAFE_BUILD_LENGTH:tln,MAX_LENGTH:rln}=IY(),nln=NY();sO=ACt.exports={};var oln=sO.re=[],iln=sO.safeRe=[],cr=sO.src=[],aln=sO.safeSrc=[],dr=sO.t={},sln=0,uqe="[a-zA-Z0-9-]",uln=[["\\s",1],["\\d",rln],[uqe,tln]],lln=t=>{for(let[e,r]of uln)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Mo=(t,e,r)=>{let n=lln(e),o=sln++;nln(t,o,e),dr[t]=o,cr[o]=e,aln[o]=n,oln[o]=new RegExp(e,r?"g":void 0),iln[o]=new RegExp(n,r?"g":void 0)};Mo("NUMERICIDENTIFIER","0|[1-9]\\d*");Mo("NUMERICIDENTIFIERLOOSE","\\d+");Mo("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${uqe}*`);Mo("MAINVERSION",`(${cr[dr.NUMERICIDENTIFIER]})\\.(${cr[dr.NUMERICIDENTIFIER]})\\.(${cr[dr.NUMERICIDENTIFIER]})`);Mo("MAINVERSIONLOOSE",`(${cr[dr.NUMERICIDENTIFIERLOOSE]})\\.(${cr[dr.NUMERICIDENTIFIERLOOSE]})\\.(${cr[dr.NUMERICIDENTIFIERLOOSE]})`);Mo("PRERELEASEIDENTIFIER",`(?:${cr[dr.NONNUMERICIDENTIFIER]}|${cr[dr.NUMERICIDENTIFIER]})`);Mo("PRERELEASEIDENTIFIERLOOSE",`(?:${cr[dr.NONNUMERICIDENTIFIER]}|${cr[dr.NUMERICIDENTIFIERLOOSE]})`);Mo("PRERELEASE",`(?:-(${cr[dr.PRERELEASEIDENTIFIER]}(?:\\.${cr[dr.PRERELEASEIDENTIFIER]})*))`);Mo("PRERELEASELOOSE",`(?:-?(${cr[dr.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${cr[dr.PRERELEASEIDENTIFIERLOOSE]})*))`);Mo("BUILDIDENTIFIER",`${uqe}+`);Mo("BUILD",`(?:\\+(${cr[dr.BUILDIDENTIFIER]}(?:\\.${cr[dr.BUILDIDENTIFIER]})*))`);Mo("FULLPLAIN",`v?${cr[dr.MAINVERSION]}${cr[dr.PRERELEASE]}?${cr[dr.BUILD]}?`);Mo("FULL",`^${cr[dr.FULLPLAIN]}$`);Mo("LOOSEPLAIN",`[v=\\s]*${cr[dr.MAINVERSIONLOOSE]}${cr[dr.PRERELEASELOOSE]}?${cr[dr.BUILD]}?`);Mo("LOOSE",`^${cr[dr.LOOSEPLAIN]}$`);Mo("GTLT","((?:<|>)?=?)");Mo("XRANGEIDENTIFIERLOOSE",`${cr[dr.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Mo("XRANGEIDENTIFIER",`${cr[dr.NUMERICIDENTIFIER]}|x|X|\\*`);Mo("XRANGEPLAIN",`[v=\\s]*(${cr[dr.XRANGEIDENTIFIER]})(?:\\.(${cr[dr.XRANGEIDENTIFIER]})(?:\\.(${cr[dr.XRANGEIDENTIFIER]})(?:${cr[dr.PRERELEASE]})?${cr[dr.BUILD]}?)?)?`);Mo("XRANGEPLAINLOOSE",`[v=\\s]*(${cr[dr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${cr[dr.XRANGEIDENTIFIERLOOSE]})(?:\\.(${cr[dr.XRANGEIDENTIFIERLOOSE]})(?:${cr[dr.PRERELEASELOOSE]})?${cr[dr.BUILD]}?)?)?`);Mo("XRANGE",`^${cr[dr.GTLT]}\\s*${cr[dr.XRANGEPLAIN]}$`);Mo("XRANGELOOSE",`^${cr[dr.GTLT]}\\s*${cr[dr.XRANGEPLAINLOOSE]}$`);Mo("COERCEPLAIN",`(^|[^\\d])(\\d{1,${sqe}})(?:\\.(\\d{1,${sqe}}))?(?:\\.(\\d{1,${sqe}}))?`);Mo("COERCE",`${cr[dr.COERCEPLAIN]}(?:$|[^\\d])`);Mo("COERCEFULL",cr[dr.COERCEPLAIN]+`(?:${cr[dr.PRERELEASE]})?(?:${cr[dr.BUILD]})?(?:$|[^\\d])`);Mo("COERCERTL",cr[dr.COERCE],!0);Mo("COERCERTLFULL",cr[dr.COERCEFULL],!0);Mo("LONETILDE","(?:~>?)");Mo("TILDETRIM",`(\\s*)${cr[dr.LONETILDE]}\\s+`,!0);sO.tildeTrimReplace="$1~";Mo("TILDE",`^${cr[dr.LONETILDE]}${cr[dr.XRANGEPLAIN]}$`);Mo("TILDELOOSE",`^${cr[dr.LONETILDE]}${cr[dr.XRANGEPLAINLOOSE]}$`);Mo("LONECARET","(?:\\^)");Mo("CARETTRIM",`(\\s*)${cr[dr.LONECARET]}\\s+`,!0);sO.caretTrimReplace="$1^";Mo("CARET",`^${cr[dr.LONECARET]}${cr[dr.XRANGEPLAIN]}$`);Mo("CARETLOOSE",`^${cr[dr.LONECARET]}${cr[dr.XRANGEPLAINLOOSE]}$`);Mo("COMPARATORLOOSE",`^${cr[dr.GTLT]}\\s*(${cr[dr.LOOSEPLAIN]})$|^$`);Mo("COMPARATOR",`^${cr[dr.GTLT]}\\s*(${cr[dr.FULLPLAIN]})$|^$`);Mo("COMPARATORTRIM",`(\\s*)${cr[dr.GTLT]}\\s*(${cr[dr.LOOSEPLAIN]}|${cr[dr.XRANGEPLAIN]})`,!0);sO.comparatorTrimReplace="$1$2$3";Mo("HYPHENRANGE",`^\\s*(${cr[dr.XRANGEPLAIN]})\\s+-\\s+(${cr[dr.XRANGEPLAIN]})\\s*$`);Mo("HYPHENRANGELOOSE",`^\\s*(${cr[dr.XRANGEPLAINLOOSE]})\\s+-\\s+(${cr[dr.XRANGEPLAINLOOSE]})\\s*$`);Mo("STAR","(<|>)?=?\\s*\\*");Mo("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Mo("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var gpe=S((w_i,ICt)=>{"use strict";var cln=Object.freeze({loose:!0}),dln=Object.freeze({}),fln=t=>t?typeof t!="object"?cln:t:dln;ICt.exports=fln});var lqe=S((S_i,DCt)=>{"use strict";var NCt=/^[0-9]+$/,jCt=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=NCt.test(t),n=NCt.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},pln=(t,e)=>jCt(e,t);DCt.exports={compareIdentifiers:jCt,rcompareIdentifiers:pln}});var Kg=S((C_i,LCt)=>{"use strict";var ype=NY(),{MAX_LENGTH:$Ct,MAX_SAFE_INTEGER:bpe}=IY(),{safeRe:_pe,t:vpe}=Q3(),mln=gpe(),{compareIdentifiers:cqe}=lqe(),dqe=class t{constructor(e,r){if(r=mln(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>$Ct)throw new TypeError(`version is longer than ${$Ct} characters`);ype("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?_pe[vpe.LOOSE]:_pe[vpe.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>bpe||this.major<0)throw new TypeError("Invalid major version");if(this.minor>bpe||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>bpe||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<bpe)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(ype("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(ype("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 cqe(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(ype("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 cqe(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[vpe.PRERELEASELOOSE]:_pe[vpe.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]),cqe(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}};LCt.exports=dqe});var XU=S((x_i,kCt)=>{"use strict";var FCt=Kg(),hln=(t,e,r=!1)=>{if(t instanceof FCt)return t;try{return new FCt(t,e)}catch(n){if(!r)return null;throw n}};kCt.exports=hln});var BCt=S((O_i,qCt)=>{"use strict";var gln=XU(),yln=(t,e)=>{let r=gln(t,e);return r?r.version:null};qCt.exports=yln});var zCt=S((T_i,UCt)=>{"use strict";var bln=XU(),_ln=(t,e)=>{let r=bln(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};UCt.exports=_ln});var JCt=S((E_i,VCt)=>{"use strict";var HCt=Kg(),vln=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new HCt(t instanceof HCt?t.version:t,r).inc(e,n,o).version}catch{return null}};VCt.exports=vln});var GCt=S((P_i,WCt)=>{"use strict";var KCt=XU(),wln=(t,e)=>{let r=KCt(t,null,!0),n=KCt(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"};WCt.exports=wln});var XCt=S((M_i,ZCt)=>{"use strict";var Sln=Kg(),Cln=(t,e)=>new Sln(t,e).major;ZCt.exports=Cln});var QCt=S((R_i,YCt)=>{"use strict";var xln=Kg(),Oln=(t,e)=>new xln(t,e).minor;YCt.exports=Oln});var txt=S((A_i,ext)=>{"use strict";var Tln=Kg(),Eln=(t,e)=>new Tln(t,e).patch;ext.exports=Eln});var nxt=S((I_i,rxt)=>{"use strict";var Pln=XU(),Mln=(t,e)=>{let r=Pln(t,e);return r&&r.prerelease.length?r.prerelease:null};rxt.exports=Mln});var jw=S((N_i,ixt)=>{"use strict";var oxt=Kg(),Rln=(t,e,r)=>new oxt(t,r).compare(new oxt(e,r));ixt.exports=Rln});var sxt=S((j_i,axt)=>{"use strict";var Aln=jw(),Iln=(t,e,r)=>Aln(e,t,r);axt.exports=Iln});var lxt=S((D_i,uxt)=>{"use strict";var Nln=jw(),jln=(t,e)=>Nln(t,e,!0);uxt.exports=jln});var wpe=S(($_i,dxt)=>{"use strict";var cxt=Kg(),Dln=(t,e,r)=>{let n=new cxt(t,r),o=new cxt(e,r);return n.compare(o)||n.compareBuild(o)};dxt.exports=Dln});var pxt=S((L_i,fxt)=>{"use strict";var $ln=wpe(),Lln=(t,e)=>t.sort((r,n)=>$ln(r,n,e));fxt.exports=Lln});var hxt=S((F_i,mxt)=>{"use strict";var Fln=wpe(),kln=(t,e)=>t.sort((r,n)=>Fln(n,r,e));mxt.exports=kln});var jY=S((k_i,gxt)=>{"use strict";var qln=jw(),Bln=(t,e,r)=>qln(t,e,r)>0;gxt.exports=Bln});var Spe=S((q_i,yxt)=>{"use strict";var Uln=jw(),zln=(t,e,r)=>Uln(t,e,r)<0;yxt.exports=zln});var fqe=S((B_i,bxt)=>{"use strict";var Hln=jw(),Vln=(t,e,r)=>Hln(t,e,r)===0;bxt.exports=Vln});var pqe=S((U_i,_xt)=>{"use strict";var Jln=jw(),Kln=(t,e,r)=>Jln(t,e,r)!==0;_xt.exports=Kln});var Cpe=S((z_i,vxt)=>{"use strict";var Wln=jw(),Gln=(t,e,r)=>Wln(t,e,r)>=0;vxt.exports=Gln});var xpe=S((H_i,wxt)=>{"use strict";var Zln=jw(),Xln=(t,e,r)=>Zln(t,e,r)<=0;wxt.exports=Xln});var mqe=S((V_i,Sxt)=>{"use strict";var Yln=fqe(),Qln=pqe(),ecn=jY(),tcn=Cpe(),rcn=Spe(),ncn=xpe(),ocn=(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 Yln(t,r,n);case"!=":return Qln(t,r,n);case">":return ecn(t,r,n);case">=":return tcn(t,r,n);case"<":return rcn(t,r,n);case"<=":return ncn(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};Sxt.exports=ocn});var xxt=S((J_i,Cxt)=>{"use strict";var icn=Kg(),acn=XU(),{safeRe:Ope,t:Tpe}=Q3(),scn=(t,e)=>{if(t instanceof icn)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?Ope[Tpe.COERCEFULL]:Ope[Tpe.COERCE]);else{let u=e.includePrerelease?Ope[Tpe.COERCERTLFULL]:Ope[Tpe.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 acn(`${n}.${o}.${i}${a}${s}`,e)};Cxt.exports=scn});var Txt=S((K_i,Oxt)=>{"use strict";var hqe=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}};Oxt.exports=hqe});var Dw=S((W_i,Rxt)=>{"use strict";var ucn=/\s+/g,gqe=class t{constructor(e,r){if(r=ccn(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof yqe)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=>!Pxt(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&&ycn(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&&hcn)|(this.options.loose&&gcn))+":"+e,o=Ext.get(n);if(o)return o;let i=this.options.loose,a=i?Gy[Wg.HYPHENRANGELOOSE]:Gy[Wg.HYPHENRANGE];e=e.replace(a,Ecn(this.options.includePrerelease)),ol("hyphen replace",e),e=e.replace(Gy[Wg.COMPARATORTRIM],fcn),ol("comparator trim",e),e=e.replace(Gy[Wg.TILDETRIM],pcn),ol("tilde trim",e),e=e.replace(Gy[Wg.CARETTRIM],mcn),ol("caret trim",e);let s=e.split(" ").map(d=>bcn(d,this.options)).join(" ").split(/\s+/).map(d=>Tcn(d,this.options));i&&(s=s.filter(d=>(ol("loose invalid filter",d,this.options),!!d.match(Gy[Wg.COMPARATORLOOSE])))),ol("range list",s);let u=new Map,l=s.map(d=>new yqe(d,this.options));for(let d of l){if(Pxt(d))return[d];u.set(d.value,d)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return Ext.set(n,c),c}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>Mxt(n,r)&&e.set.some(o=>Mxt(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 dcn(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Pcn(this.set[r],e,this.options))return!0;return!1}};Rxt.exports=gqe;var lcn=Txt(),Ext=new lcn,ccn=gpe(),yqe=DY(),ol=NY(),dcn=Kg(),{safeRe:Gy,t:Wg,comparatorTrimReplace:fcn,tildeTrimReplace:pcn,caretTrimReplace:mcn}=Q3(),{FLAG_INCLUDE_PRERELEASE:hcn,FLAG_LOOSE:gcn}=IY(),Pxt=t=>t.value==="<0.0.0-0",ycn=t=>t.value==="",Mxt=(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},bcn=(t,e)=>(t=t.replace(Gy[Wg.BUILD],""),ol("comp",t,e),t=wcn(t,e),ol("caret",t),t=_cn(t,e),ol("tildes",t),t=Ccn(t,e),ol("xrange",t),t=Ocn(t,e),ol("stars",t),t),Zy=t=>!t||t.toLowerCase()==="x"||t==="*",_cn=(t,e)=>t.trim().split(/\s+/).map(r=>vcn(r,e)).join(" "),vcn=(t,e)=>{let r=e.loose?Gy[Wg.TILDELOOSE]:Gy[Wg.TILDE];return t.replace(r,(n,o,i,a,s)=>{ol("tilde",t,n,o,i,a,s);let u;return Zy(o)?u="":Zy(i)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:Zy(a)?u=`>=${o}.${i}.0 <${o}.${+i+1}.0-0`:s?(ol("replaceTilde pr",s),u=`>=${o}.${i}.${a}-${s} <${o}.${+i+1}.0-0`):u=`>=${o}.${i}.${a} <${o}.${+i+1}.0-0`,ol("tilde return",u),u})},wcn=(t,e)=>t.trim().split(/\s+/).map(r=>Scn(r,e)).join(" "),Scn=(t,e)=>{ol("caret",t,e);let r=e.loose?Gy[Wg.CARETLOOSE]:Gy[Wg.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,i,a,s,u)=>{ol("caret",t,o,i,a,s,u);let l;return Zy(i)?l="":Zy(a)?l=`>=${i}.0.0${n} <${+i+1}.0.0-0`:Zy(s)?i==="0"?l=`>=${i}.${a}.0${n} <${i}.${+a+1}.0-0`:l=`>=${i}.${a}.0${n} <${+i+1}.0.0-0`:u?(ol("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`):(ol("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`),ol("caret return",l),l})},Ccn=(t,e)=>(ol("replaceXRanges",t,e),t.split(/\s+/).map(r=>xcn(r,e)).join(" ")),xcn=(t,e)=>{t=t.trim();let r=e.loose?Gy[Wg.XRANGELOOSE]:Gy[Wg.XRANGE];return t.replace(r,(n,o,i,a,s,u)=>{ol("xRange",t,n,o,i,a,s,u);let l=Zy(i),c=l||Zy(a),d=c||Zy(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`),ol("xRange return",n),n})},Ocn=(t,e)=>(ol("replaceStars",t,e),t.trim().replace(Gy[Wg.STAR],"")),Tcn=(t,e)=>(ol("replaceGTE0",t,e),t.trim().replace(Gy[e.includePrerelease?Wg.GTE0PRE:Wg.GTE0],"")),Ecn=t=>(e,r,n,o,i,a,s,u,l,c,d,f)=>(Zy(n)?r="":Zy(o)?r=`>=${n}.0.0${t?"-0":""}`:Zy(i)?r=`>=${n}.${o}.0${t?"-0":""}`:a?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Zy(l)?u="":Zy(c)?u=`<${+l+1}.0.0-0`:Zy(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()),Pcn=(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(ol(t[n].semver),t[n].semver!==yqe.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 DY=S((G_i,$xt)=>{"use strict";var $Y=Symbol("SemVer ANY"),vqe=class t{static get ANY(){return $Y}constructor(e,r){if(r=Axt(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),_qe("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===$Y?this.value="":this.value=this.operator+this.semver.version,_qe("comp",this)}parse(e){let r=this.options.loose?Ixt[Nxt.COMPARATORLOOSE]:Ixt[Nxt.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 jxt(n[2],this.options.loose):this.semver=$Y}toString(){return this.value}test(e){if(_qe("Comparator.test",e,this.options.loose),this.semver===$Y||e===$Y)return!0;if(typeof e=="string")try{e=new jxt(e,this.options)}catch{return!1}return bqe(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 Dxt(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Dxt(this.value,r).test(e.semver):(r=Axt(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("=")||bqe(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||bqe(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};$xt.exports=vqe;var Axt=gpe(),{safeRe:Ixt,t:Nxt}=Q3(),bqe=mqe(),_qe=NY(),jxt=Kg(),Dxt=Dw()});var LY=S((Z_i,Lxt)=>{"use strict";var Mcn=Dw(),Rcn=(t,e,r)=>{try{e=new Mcn(e,r)}catch{return!1}return e.test(t)};Lxt.exports=Rcn});var kxt=S((X_i,Fxt)=>{"use strict";var Acn=Dw(),Icn=(t,e)=>new Acn(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Fxt.exports=Icn});var Bxt=S((Y_i,qxt)=>{"use strict";var Ncn=Kg(),jcn=Dw(),Dcn=(t,e,r)=>{let n=null,o=null,i=null;try{i=new jcn(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===-1)&&(n=a,o=new Ncn(n,r))}),n};qxt.exports=Dcn});var zxt=S((Q_i,Uxt)=>{"use strict";var $cn=Kg(),Lcn=Dw(),Fcn=(t,e,r)=>{let n=null,o=null,i=null;try{i=new Lcn(e,r)}catch{return null}return t.forEach(a=>{i.test(a)&&(!n||o.compare(a)===1)&&(n=a,o=new $cn(n,r))}),n};Uxt.exports=Fcn});var Jxt=S((evi,Vxt)=>{"use strict";var wqe=Kg(),kcn=Dw(),Hxt=jY(),qcn=(t,e)=>{t=new kcn(t,e);let r=new wqe("0.0.0");if(t.test(r)||(r=new wqe("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 wqe(a.semver.version);switch(a.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!i||Hxt(s,i))&&(i=s);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),i&&(!r||Hxt(r,i))&&(r=i)}return r&&t.test(r)?r:null};Vxt.exports=qcn});var Wxt=S((tvi,Kxt)=>{"use strict";var Bcn=Dw(),Ucn=(t,e)=>{try{return new Bcn(t,e).range||"*"}catch{return null}};Kxt.exports=Ucn});var Epe=S((rvi,Yxt)=>{"use strict";var zcn=Kg(),Xxt=DY(),{ANY:Hcn}=Xxt,Vcn=Dw(),Jcn=LY(),Gxt=jY(),Zxt=Spe(),Kcn=xpe(),Wcn=Cpe(),Gcn=(t,e,r,n)=>{t=new zcn(t,n),e=new Vcn(e,n);let o,i,a,s,u;switch(r){case">":o=Gxt,i=Kcn,a=Zxt,s=">",u=">=";break;case"<":o=Zxt,i=Wcn,a=Gxt,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Jcn(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===Hcn&&(p=new Xxt(">=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};Yxt.exports=Gcn});var eOt=S((nvi,Qxt)=>{"use strict";var Zcn=Epe(),Xcn=(t,e,r)=>Zcn(t,e,">",r);Qxt.exports=Xcn});var rOt=S((ovi,tOt)=>{"use strict";var Ycn=Epe(),Qcn=(t,e,r)=>Ycn(t,e,"<",r);tOt.exports=Qcn});var iOt=S((ivi,oOt)=>{"use strict";var nOt=Dw(),edn=(t,e,r)=>(t=new nOt(t,r),e=new nOt(e,r),t.intersects(e,r));oOt.exports=edn});var sOt=S((avi,aOt)=>{"use strict";var tdn=LY(),rdn=jw();aOt.exports=(t,e,r)=>{let n=[],o=null,i=null,a=t.sort((c,d)=>rdn(c,d,r));for(let c of a)tdn(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 pOt=S((svi,fOt)=>{"use strict";var uOt=Dw(),Cqe=DY(),{ANY:Sqe}=Cqe,FY=LY(),xqe=jw(),ndn=(t,e,r={})=>{if(t===e)return!0;t=new uOt(t,r),e=new uOt(e,r);let n=!1;e:for(let o of t.set){for(let i of e.set){let a=idn(o,i,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},odn=[new Cqe(">=0.0.0-0")],lOt=[new Cqe(">=0.0.0")],idn=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Sqe){if(e.length===1&&e[0].semver===Sqe)return!0;r.includePrerelease?t=odn:t=lOt}if(e.length===1&&e[0].semver===Sqe){if(r.includePrerelease)return!0;e=lOt}let n=new Set,o,i;for(let p of t)p.operator===">"||p.operator===">="?o=cOt(o,p,r):p.operator==="<"||p.operator==="<="?i=dOt(i,p,r):n.add(p.semver);if(n.size>1)return null;let a;if(o&&i){if(a=xqe(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&&!FY(p,String(o),r)||i&&!FY(p,String(i),r))return null;for(let m of e)if(!FY(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=cOt(o,p,r),s===p&&s!==o)return!1}else if(o.operator===">="&&!FY(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=dOt(i,p,r),u===p&&u!==i)return!1}else if(i.operator==="<="&&!FY(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)},cOt=(t,e,r)=>{if(!t)return e;let n=xqe(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},dOt=(t,e,r)=>{if(!t)return e;let n=xqe(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};fOt.exports=ndn});var yOt=S((uvi,gOt)=>{"use strict";var Oqe=Q3(),mOt=IY(),adn=Kg(),hOt=lqe(),sdn=XU(),udn=BCt(),ldn=zCt(),cdn=JCt(),ddn=GCt(),fdn=XCt(),pdn=QCt(),mdn=txt(),hdn=nxt(),gdn=jw(),ydn=sxt(),bdn=lxt(),_dn=wpe(),vdn=pxt(),wdn=hxt(),Sdn=jY(),Cdn=Spe(),xdn=fqe(),Odn=pqe(),Tdn=Cpe(),Edn=xpe(),Pdn=mqe(),Mdn=xxt(),Rdn=DY(),Adn=Dw(),Idn=LY(),Ndn=kxt(),jdn=Bxt(),Ddn=zxt(),$dn=Jxt(),Ldn=Wxt(),Fdn=Epe(),kdn=eOt(),qdn=rOt(),Bdn=iOt(),Udn=sOt(),zdn=pOt();gOt.exports={parse:sdn,valid:udn,clean:ldn,inc:cdn,diff:ddn,major:fdn,minor:pdn,patch:mdn,prerelease:hdn,compare:gdn,rcompare:ydn,compareLoose:bdn,compareBuild:_dn,sort:vdn,rsort:wdn,gt:Sdn,lt:Cdn,eq:xdn,neq:Odn,gte:Tdn,lte:Edn,cmp:Pdn,coerce:Mdn,Comparator:Rdn,Range:Adn,satisfies:Idn,toComparators:Ndn,maxSatisfying:jdn,minSatisfying:Ddn,minVersion:$dn,validRange:Ldn,outside:Fdn,gtr:kdn,ltr:qdn,intersects:Bdn,simplifyRange:Udn,subset:zdn,SemVer:adn,re:Oqe.re,src:Oqe.src,tokens:Oqe.t,SEMVER_SPEC_VERSION:mOt.SEMVER_SPEC_VERSION,RELEASE_TYPES:mOt.RELEASE_TYPES,compareIdentifiers:hOt.compareIdentifiers,rcompareIdentifiers:hOt.rcompareIdentifiers}});function uN(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 Hdn,bOt=v(()=>{Hdn=L(yOt(),1)});async function Fr(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===409)throw new Tqe(o);let i=new Error(o);throw i.status=t.status,i}function vOt(t){return typeof t=="object"&&t!==null&&t.code===_Ot}var Tqe,_Ot,Ppe,Eqe=v(()=>{Tqe=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}};_Ot="ERR_CONFLICTING_ENDPOINTS",Ppe=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:_Ot}),this.name="ConflictingEndpointsError"}}});function Kdn(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Mpe(t){return Jdn.encode(t)}function SOt(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 Wdn(t){return function(e,r){if(t){let n=t.call(this,e,r);if(n!==void 0)return n}return SOt(r)}}function Xb(t,e,r,n,o){try{let i=JSON.stringify(t,Wdn(r),n);return Mpe(i)}catch(i){if(!i.message?.includes("Converting circular structure to JSON"))return console.warn(`[WARNING]: LangSmith received unserializable value.${e?`
|
||
Context: ${e}`:""}`),Mpe("[Unserializable]");dd("SUPPRESS_CIRCULAR_JSON_WARNINGS")!=="true"&&console.warn(`[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. ${e?`
|
||
Context: ${e}`:""}`),typeof o>"u"&&(o=Kdn()),Mqe(t,"",0,[],void 0,0,o);let a;try{e6.length===0?a=JSON.stringify(t,r,n):a=JSON.stringify(t,Gdn(r),n)}catch{return Mpe("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Rpe.length!==0;){let s=Rpe.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return Mpe(a)}}function Pqe(t,e,r,n){var o=Object.getOwnPropertyDescriptor(n,r);o.get!==void 0?o.configurable?(Object.defineProperty(n,r,{value:t}),Rpe.push([n,r,e,o])):e6.push([e,r,t]):(n[r]=t,Rpe.push([n,r,e]))}function Mqe(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){Pqe(Vdn,t,e,o);return}if(typeof a.depthLimit<"u"&&i>a.depthLimit){Pqe(wOt,t,e,o);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Pqe(wOt,t,e,o);return}if(n.push(t),Array.isArray(t))for(s=0;s<t.length;s++)Mqe(t[s],s,s,n,t,i,a);else{t=SOt(t);var u=Object.keys(t);for(s=0;s<u.length;s++){var l=u[s];Mqe(t[l],l,s,n,t,i,a)}}n.pop()}}function Gdn(t){return t=typeof t<"u"?t:function(e,r){return r},function(e,r){if(e6.length>0)for(var n=0;n<e6.length;n++){var o=e6[n];if(o[1]===e&&o[0]===r){r=o[2],e6.splice(n,1);break}}return t.call(this,e,r)}}var wOt,Vdn,Rpe,e6,Jdn,COt=v(()=>{sN();wOt="[...]",Vdn={result:"[Circular]"},Rpe=[],e6=[],Jdn=new TextEncoder});function xOt(t,e){let r=ope(),n=e??Bke(),o=t.extra??{},i=o.metadata;return t.extra={...o,runtime:{...r,...o?.runtime},metadata:{...n,...n.revision_id||"revision_id"in t&&t.revision_id?{revision_id:("revision_id"in t?t.revision_id:void 0)??n.revision_id}:{},...i}},t}async function Ydn(t){let e=[];for await(let r of t)e.push(r);return e}function Ape(t){if(t!==void 0)return t.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}function OOt(t){return typeof t=="number"?Number(t.toFixed(4)):t}function EOt(t){return"dataset_id"in t||"dataset_name"in t}var Zdn,Xdn,Qdn,Rqe,efn,tfn,rfn,TOt,GU,$ke=v(()=>{Pke();lCt();Gke();OCt();TCt();sN();npe();ECt();aqe();bOt();Eqe();jke();COt();Zdn=t=>{let e=t?.toString()??dd("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},Xdn=t=>{let r=t.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return r==="localhost"||r==="127.0.0.1"||r==="::1"};Qdn=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};Rqe=class{constructor(){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0})}peek(){return this.items[0]}push(e){let r,n=new Promise(i=>{r=i}),o=Xb(e.item,`Serializing run with id: ${e.item.id}`).length;return 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})),()=>n.forEach(i=>i.itemPromiseResolve())]}},efn=24*1024*1024,tfn=1e4,rfn=100,TOt="https://api.smith.langchain.com",GU=class t{get _fetch(){return this.fetchImplementation||oCt(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,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"filteredPostUuids",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:new Rqe}),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:vv("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,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:vv("LANGSMITH_DEBUG")==="true"});let r=t.getDefaultClientConfig();if(this.tracingSampleRate=Zdn(e.tracingSamplingRate),this.apiUrl=Ape(e.apiUrl??r.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1)),this.apiKey=Ape(e.apiKey??r.apiKey),this.webUrl=Ape(e.webUrl??r.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=Ape(e.workspaceId??dd("WORKSPACE_ID")),this.timeout_ms=e.timeout_ms??9e4,this.caller=new RY({...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,this.batchIngestCaller=new RY({maxRetries:2,maxConcurrency:this.traceBatchConcurrency,...e.callerOptions??{},onFailedResponseHook:Qdn,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??r.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??r.hideOutputs,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit,this.fetchOptions=e.fetchOptions||{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,ipe()&&(this.langSmithToOTELTranslator=new spe),this.cachedLSEnvVarsForMetadata=Bke()}static getDefaultClientConfig(){let e=dd("API_KEY"),r=dd("ENDPOINT")??TOt,n=dd("HIDE_INPUTS")==="true",o=dd("HIDE_OUTPUTS")==="true";return{apiUrl:r,apiKey:e,webUrl:void 0,hideInputs:n,hideOutputs:o}}getHostUrl(){return this.webUrl?this.webUrl:Xdn(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/${rpe}`};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 Fr(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 Fr(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 Fr(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??efn}async _getBatchSizeLimit(){let e=await this._ensureServerInfo();return this.batchSizeLimit??e.batch_ingest_config?.size_limit??rfn}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)try{if(this.langSmithToOTELTranslator!==void 0)this._sendBatchToOTELTranslator(e);else{let n={runCreates:e.filter(i=>i.action==="create").map(i=>i.item),runUpdates:e.filter(i=>i.action==="update").map(i=>i.item)},o=await this._ensureServerInfo();if(o?.batch_ingest_config?.use_multipart_endpoint){let i=o?.instance_flags?.gzip_body_enabled;await this.multipartIngestRuns(n,{...r,useGzip:i})}else await this.batchIngestRuns(n,r)}}catch(n){console.error("Error exporting batch:",n)}}_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=xOt(e.item,this.cachedLSEnvVarsForMetadata);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(tfn),...this.fetchOptions});return await Fr(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=ape(),r=sCt();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=xOt(i,this.cachedLSEnvVarsForMetadata);r?.apiKey!==void 0&&(n["x-api-key"]=r.apiKey),r?.workspaceId!==void 0&&(n["x-tenant-id"]=r.workspaceId);let s=Xb(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 Fr(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(Xb(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.call(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 Fr(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:g,extra:y,error:b,serialized:_,attachments:w,...x}=p,O={inputs:m,outputs:h,events:g,extra:y,error:b,serialized:_},E=Xb(x,`Serializing for multipart ingestion of run with id: ${x.id}`);c.push({name:`${d}.${x.id}`,payload:new Blob([E],{type:`application/json; length=${E.length}`})});for(let[T,R]of Object.entries(O)){if(R===void 0)continue;let N=Xb(R,`Serializing ${T} for multipart ingestion of run with id: ${x.id}`);c.push({name:`${d}.${x.id}.${T}`,payload:new Blob([N],{type:`application/json; length=${N.length}`})})}if(x.id!==void 0){let T=o[x.id];if(T){delete o[x.id];for(let[R,N]of Object.entries(T)){let D,F;if(Array.isArray(N)?[D,F]=N:(D=N.mimeType,F=N.data),R.includes(".")){console.warn(`Skipping attachment '${R}' for run ${x.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`);continue}c.push({name:`attachment.${x.id}.${R}`,payload:new Blob([F],{type:`${D}; length=${F.byteLength}`})})}}}l.push(`trace=${x.trace_id},id=${x.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=nCt(),a=()=>this._createNodeFetchBody(e,o),s=()=>this._createMultipartStream(e,o),u=async l=>this.batchIngestCaller.call(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 Fr(p,"Failed to send multipart request",!0),p});try{let l,c=!1;!i&&!this.multipartStreamingDisabled&&qke()!=="bun"?(c=!0,l=await u(s)):l=await u(a),(!this.multipartStreamingDisabled||c)&&l.status===422&&(n?.apiUrl??this.apiUrl)!==TOt&&(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){console.warn(`${l.message.trim()}
|
||
|
||
Context: ${r}`)}}async updateRun(e,r,n){To(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=Xb(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 Fr(s,"update run",!0),s})}async readRun(e,{loadChildRuns:r}={loadChildRuns:!1}){To(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:dd("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 Ydn(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:g,limit:y,select:b,order:_}=e,w=[];if(r&&(w=Array.isArray(r)?r:[r]),n){let T=Array.isArray(n)?n:[n],R=await Promise.all(T.map(N=>this.readProject({projectName:N}).then(D=>D.id)));w.push(...R)}let x=["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],O={session:w.length?w:null,run_type:c,reference_example:a,query:p,filter:m,trace_filter:h,tree_filter:g,execution_order:u,parent_run:o,start_time:s?s.toISOString():null,error:d,id:f,limit:y,trace:i,select:b||x,is_root:l,order:_};O.select.includes("child_run_ids")&&AY("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let E=0;for await(let T of this._getCursorPaginatedList("/runs/query",O))if(y){if(E>=y)break;if(T.length+E>y){yield*T.slice(0,y-E);break}E+=T.length,yield*T}else yield*T}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},g=Object.fromEntries(Object.entries(h).filter(([O,E])=>E!==void 0)),y=JSON.stringify(g),_=await(await this.caller.call(async()=>{let O=await this._fetch(m,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:y});return await Fr(O,`Failed to fetch ${p}`),O})).json(),{groups:w,total:x}=_;if(w.length===0)break;for(let O of w)yield O;if(f+=w.length,f>=x)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:g}){let y=a||[];i&&(y=[...a||[],...await Promise.all(i.map(E=>this.readProject({projectName:E}).then(T=>T.id)))]);let _=Object.fromEntries(Object.entries({id:e,trace:r,parent_run:n,run_type:o,session:y,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:g}).filter(([E,T])=>T!==void 0)),w=JSON.stringify(_);return await(await this.caller.call(async()=>{let E=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:w});return await Fr(E,"get run stats"),E})).json()}async shareRun(e,{shareId:r}={}){let n={run_id:e,share_token:r||aN()};To(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 Fr(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){To(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 Fr(r,"unshare run",!0),r})}async readRunSharedLink(e){To(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 Fr(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 To(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 Fr(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),To(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 Fr(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};To(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 Fr(s,"share dataset"),s})).json();return a.url=`${this.getHostUrl()}/public/${a.share_token}/d`,a}async unshareDataset(e){To(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 Fr(r,"unshare dataset",!0),r})}async readSharedDataset(e){return To(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 Fr(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 Fr(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 Fr(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 Fr(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)To(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 Fr(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)To(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,To(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 Fr(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 Fr(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 Fr(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)To(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;To(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 Fr(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;To(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 Fr(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)To(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 Fr(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),To(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 Fr(u,"index dataset"),u})).json()}async similarExamples(e,r,n,{filter:o}={}){let i={limit:n,inputs:e};o!==void 0&&(i.filter=o),To(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 Fr(l,"fetch similar examples"),l})).json()).examples}async createExample(e,r,n){if(EOt(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;EOt(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]??aN())}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 x=await this._uploadExamplesMultipart(_,b);return await Promise.all(x.example_ids.map(E=>this.readExample(E)))}let{inputs:r,outputs:n,metadata:o,splits:i,sourceRunIds:a,useSourceRunIOs:s,useSourceRunAttachments:u,attachments:l,exampleIds:c,datasetId:d,datasetName:f}=e;if(r===void 0)throw new Error("Must provide inputs when using legacy parameters");let p=d,m=f;if(p===void 0&&m===void 0)throw new Error("Must provide either datasetName or datasetId");if(p!==void 0&&m!==void 0)throw new Error("Must provide either datasetName or datasetId, not both");p===void 0&&(p=(await this.readDataset({datasetName:m})).id);let h=r.map((b,_)=>({dataset_id:p,inputs:b,outputs:n?.[_],metadata:o?.[_],split:i?.[_],id:c?.[_],attachments:l?.[_],source_run_id:a?.[_],use_source_run_io:s?.[_],use_source_run_attachments:u?.[_]})),g=await this._uploadExamplesMultipart(p,h);return await Promise.all(g.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=>oqe(a)?iqe(a):a),i=oqe(r)?iqe(r):r;return this.createExample({input:o},{output:i},n)}async readExample(e){To(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 y of n)p.append("id",y);if(i!==void 0)for(let y of i)p.append("splits",y);if(s!==void 0){let y=JSON.stringify(s);p.append("metadata",y)}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(y=>p.append("select",y));let g=0;for await(let y of this._getPaginated("/examples",p)){for(let b of y){let{attachment_urls:_,...w}=b,x=w;_&&(x.attachments=Object.entries(_).reduce((O,[E,T])=>(O[E.slice(11)]={presigned_url:T.presigned_url,mime_type:T.mime_type||void 0},O),{})),yield x,g++}if(u!==void 0&&g>=u)break}}async deleteExample(e){To(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 Fr(n,`delete ${r}`,!0),n})}async updateExample(e,r){let n;r?n=e:n=e.id,To(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,To(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 Fr(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,To(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,To(a);let s={split_name:n,examples:o.map(l=>(To(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 Fr(l,"update dataset splits",!0),l})}async evaluateRun(e,r,{sourceInfo:n,loadChildRuns:o,referenceExample:i}={loadChildRuns:!1}){AY("This method is deprecated and will be removed in future LangSmith versions, use `evaluate` from `langsmith/evaluation` instead.");let a;if(typeof e=="string")a=await this.readRun(e,{loadChildRuns:o});else if(typeof e=="object"&&"id"in e)a=e;else throw new Error(`Invalid run type: ${typeof e}`);a.reference_example_id!==null&&a.reference_example_id!==void 0&&(i=await this.readExample(a.reference_example_id));let s=await r.evaluateRun(a,i),[u,l]=await this._logEvaluationFeedback(s,a,n);return l[0]}async createFeedback(e,r,{score:n,value:o,correction:i,comment:a,sourceInfo:s,feedbackSourceType:u="api",sourceRunId:l,feedbackId:c,feedbackConfig:d,projectId:f,comparativeExperimentId:p}){if(!e&&!f)throw new Error("One of runId or projectId must be provided");if(e&&f)throw new Error("Only one of runId or projectId can be provided");let m={type:u??"api",metadata:s??{}};l!==void 0&&m?.metadata!==void 0&&!m.metadata.__run&&(m.metadata.__run={run_id:l}),m?.metadata!==void 0&&m.metadata.__run?.run_id!==void 0&&To(m.metadata.__run.run_id);let h={id:c??aN(),run_id:e,key:r,score:OOt(n),value:o,correction:i,comment:a,feedback_source:m,comparative_experiment_id:p,feedbackConfig:d,session_id:f},g=JSON.stringify(h),y=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{let b=await this._fetch(y,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:g});return await Fr(b,"create feedback",!0),b}),h}async updateFeedback(e,{score:r,value:n,correction:o,comment:i}){let a={};r!=null&&(a.score=OOt(r)),n!=null&&(a.value=n),o!=null&&(a.correction=o),i!=null&&(a.comment=i),To(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 Fr(u,"update feedback",!0),u})}async readFeedback(e){To(e);let r=`/feedback/${e}`;return await this._get(r)}async deleteFeedback(e){To(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 Fr(n,`delete ${r}`,!0),n})}async*listFeedback({runIds:e,feedbackKeys:r,feedbackSourceTypes:n}={}){let o=new URLSearchParams;if(e)for(let i of e)To(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 Fr(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 Fr(d,"create comparative experiment"),d})).json()}async*listPresignedFeedbackTokens(e){To(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)=>{To(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||aN(),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 Fr(l,"create annotation queue"),l})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{let n=await this._fetch(`${this.apiUrl}/annotation-queues/${To(e,"queueId")}`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Fr(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/${To(e,"queueId")}`,{method:"PATCH",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await Fr(s,"update annotation queue",!0),s})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{let r=await this._fetch(`${this.apiUrl}/annotation-queues/${To(e,"queueId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Fr(r,"delete annotation queue",!0),r})}async addRunsToAnnotationQueue(e,r){let n=JSON.stringify(r.map((o,i)=>To(o,`runIds[${i}]`).toString()));await this.caller.call(async()=>{let o=await this._fetch(`${this.apiUrl}/annotation-queues/${To(e,"queueId")}/runs`,{method:"POST",headers:{...this.headers,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await Fr(o,"add runs to annotation queue",!0),o})}async getRunFromAnnotationQueue(e,r){let n=`/annotation-queues/${To(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 Fr(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/${To(e,"queueId")}/runs/${To(r,"queueRunId")}`,{method:"DELETE",headers:{...this.headers,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Fr(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/${To(e,"queueId")}/size`,{method:"GET",headers:this.headers,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await Fr(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 Fr(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]=uN(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 Fr(u,`${r?"like":"unlike"} prompt`),u})).json()}async _getPromptUrl(e){let[r,n,o]=uN(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]=uN(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 Fr(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]=uN(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 Fr(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]=uN(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 Fr(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=Xb(u,`Serializing body for example with id: ${s}`),c=new Blob([l],{type:"application/json"});if(n.append(s,c),a.inputs){let d=Xb(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=Xb(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=Xb(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 Fr(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??aN()).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=Xb(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=Xb(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=Xb(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 Fr(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]=uN(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 Fr(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]=uN(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 Fr(a,"delete prompt"),a})).json()}async pullPromptCommit(e,r){let[n,o,i]=uN(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 Fr(u,"pull prompt commit"),u})).json();return{owner:n,repo:o,commit_hash:s.commit_hash,manifest:s.manifest,examples:s.examples}}async _pullPrompt(e,r){let n=await this.pullPromptCommit(e,{includeModel:r?.includeModel});return JSON.stringify(n.manifest)}async pushPrompt(e,r){return await this.promptExists(e)?r&&Object.keys(r).some(o=>o!=="object")&&await this.updatePrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}):await this.createPrompt(e,{description:r?.description,readme:r?.readme,tags:r?.tags,isPublic:r?.isPublic}),r?.object?await this.createCommit(e,r?.object,{parentCommitHash:r?.parentCommitHash}):await this._getPromptUrl(e)}async clonePublicDataset(e,r={}){let{sourceApiUrl:n=this.apiUrl,datasetName:o}=r,[i,a]=this.parseTokenOrUrl(e,n),s=new t({apiUrl:i,apiKey:"placeholder"}),u=await s.readSharedDataset(a),l=o||u.name;try{if(await this.hasDataset({datasetId:l})){console.log(`Dataset ${l} already exists in your tenant. Skipping.`);return}}catch{}let c=await s.listSharedExamples(a),d=await this.createDataset(l,{description:u.description,dataType:u.data_type||"kv",inputsSchema:u.inputs_schema_definition??void 0,outputsSchema:u.outputs_schema_definition??void 0});try{await this.createExamples({inputs:c.map(f=>f.inputs),outputs:c.flatMap(f=>f.outputs?[f.outputs]:[]),datasetId:d.id})}catch(f){throw console.error(`An error occurred while creating dataset ${l}. You should delete it manually.`),f}}parseTokenOrUrl(e,r,n=2,o="dataset"){try{return To(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}`)}}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 Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),this.langSmithToOTELTranslator!==void 0&&await uCt()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush()}}});var POt,MOt=v(()=>{sN();POt=t=>t!==void 0?t:!!["TRACING_V2","TRACING"].find(r=>dd(r)==="true")});var Ipe,ROt=v(()=>{Ipe=Symbol.for("lc:context_variables")});function nfn(t){return t.replace(/[-:.]/g,"")}function Aqe(t,e,r=1){let n=r.toFixed(0).slice(0,3).padStart(3,"0"),o=`${new Date(t).toISOString().slice(0,-1)}${n}Z`;return{dottedOrder:nfn(o)+e,microsecondPrecisionDatestring:o}}function IOt(t){return t!=null&&typeof t.createChild=="function"&&typeof t.postRun=="function"}function NOt(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=>NOt(e))}function ofn(t){return typeof t=="object"&&t!=null&&Array.isArray(t.handlers)}function ifn(t){return t!=null&&typeof t.callbacks=="object"&&(AOt(t.callbacks?.handlers)||AOt(t.callbacks))}function afn(t){return t.split(".").map(r=>{let n=r.slice(0,-36),o=r.slice(-36),i=parseInt(n.slice(0,4)),a=parseInt(n.slice(4,6))-1,s=parseInt(n.slice(6,8)),u=parseInt(n.slice(9,11)),l=parseInt(n.slice(11,13)),c=parseInt(n.slice(13,15)),d=parseInt(n.slice(15,21));return[new Date(i,a,s,u,l,c,d/1e3),o]})}function sfn(){let t=vv("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){lfn(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(vOt(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 ufn(t){return t?t.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):sfn()}function lfn(t){if(Object.keys(t).length>0&&dd("ENDPOINT"))throw new Ppe}var Npe,J0,Lke=v(()=>{Pke();$ke();MOt();Eqe();ROt();sN();Dke();sN();aqe();Npe=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))}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(",")}},J0=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,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),IOt(e)){Object.assign(this,{...e});return}let r=t.getDefaultConfig(),{metadata:n,...o}=e,i=o.client??t.getSharedClient(),a={...n,...o?.extra?.metadata};if(o.extra={...o.extra,metadata:a},Object.assign(this,{...r,...o,client:i}),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=ufn(this.replicas),this.execution_order??(this.execution_order=1),this.child_execution_order??(this.child_execution_order=1),!this.dotted_order){let{dottedOrder:s,microsecondPrecisionDatestring:u}=Aqe(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+s:this.dotted_order=s,this._serialized_start_time=u}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){return{id:aN(),run_type:"chain",project_name:PY(),child_runs:[],api_url:vv("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:vv("LANGCHAIN_API_KEY"),caller_options:{},start_time:Date.now(),serialized:{},inputs:{},extra:{}}}static getSharedClient(){return t.sharedClient||(t.sharedClient=new GU),t.sharedClient}createChild(e){let r=this.child_execution_order+1,n=new t({...e,parent_run:this,project_name:this.project_name,replicas:this.replicas,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:r,child_execution_order:r});Ipe in this&&(n[Ipe]=this[Ipe]);let o=Symbol.for("lc:child_config"),i=e.extra?.[o]??this.extra[o];if(ifn(i)){let u={...i},l=ofn(u.callbacks)?u.callbacks.copy?.():void 0;l&&(Object.assign(l,{_parentRunId:n.id}),l.handlers?.find(NOt)?.updateFromRunTree?.(n),u.callbacks=l),n.extra[o]=u}let a=new Set,s=this;for(;s!=null&&!a.has(s.id);)a.add(s.id),s.child_execution_order=Math.max(s.child_execution_order,r),s=s.parent_run;return this.child_runs.push(n),n}async end(e,r,n=Date.now(),o){this.outputs=this.outputs??e,this.error=this.error??r,this.end_time=this.end_time??n,o&&Object.keys(o).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...o}}:{metadata:o})}_convertToCreate(e,r,n=!0){let o=e.extra??{};if(o?.runtime?.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}}_remapForProject(e,r,n=!0){let o=this._convertToCreate(this,r,n);if(e===this.project_name)return o;let i=d=>tpe(`${d}:${e}`,tpe.DNS),a=i(o.id),s=o.trace_id?i(o.trace_id):void 0,u=o.parent_run_id?i(o.parent_run_id):void 0,l;if(o.dotted_order){let d=afn(o.dotted_order),f=[];for(let m=0;m<d.length-1;m++){let[h,g]=d[m],y=i(g);f.push(h.toISOString().replace(/[-:]/g,"").replace(".","")+y)}let[p]=d[d.length-1];f.push(p.toISOString().replace(/[-:]/g,"").replace(".","")+a),l=f.join(".")}else l=void 0;return{...o,id:a,trace_id:s,parent_run_id:u,dotted_order:l,session_name:e}}async postRun(e=!0){try{let r=ope();if(this.replicas&&this.replicas.length>0)for(let{projectName:n,apiKey:o,apiUrl:i,workspaceId:a}of this.replicas){let s=this._remapForProject(n??this.project_name,r,!0);await this.client.createRun(s,{apiKey:o,apiUrl:i,workspaceId:a})}else{let n=this._convertToCreate(this,r,e);await this.client.createRun(n)}if(!e){AY("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)}}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}of this.replicas){let s=this._remapForProject(r??this.project_name),u={id:s.id,outputs:s.outputs,error:s.error,parent_run_id:s.parent_run_id,session_name:s.session_name,reference_example_id:s.reference_example_id,end_time:s.end_time,dotted_order:s.dotted_order,trace_id:s.trace_id,events:s.events,tags:s.tags,extra:s.extra,attachments:this.attachments,...a};e?.excludeInputs||(u.inputs=s.inputs),await this.client.updateRun(s.id,u,{apiKey:n,apiUrl:o,workspaceId:i})}else try{let r={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)}}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=POt();if(n){let l=n?.getParentRunId?.()??"",c=n?.handlers?.find(d=>d?.name=="langchain_tracer");o=c?.getRun?.(l),i=c?.projectName,a=c?.client,s=s||!!c}return o?new t({name:o.name,id:o.id,trace_id:o.trace_id,dotted_order:o.dotted_order,client:a,tracingEnabled:s,project_name:i,tags:[...new Set((o?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...o?.extra?.metadata,...e?.metadata}}}).createChild(r):new t({...r,client:a,tracingEnabled:s,project_name:i})}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,r){let n="get"in e&&typeof e.get=="function"?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,o=n["langsmith-trace"];if(!o||typeof o!="string")return;let i=o.trim(),a=i.split(".").map(l=>{let[c,d]=l.split("Z");return{strTime:c,time:Date.parse(c+"Z"),uuid:d}}),s=a[0].uuid,u={...r,name:r?.name??"parent",run_type:r?.run_type??"chain",start_time:r?.start_time??Date.now(),id:a.at(-1)?.uuid,trace_id:s,dotted_order:i};if(n.baggage&&typeof n.baggage=="string"){let l=Npe.fromHeader(n.baggage);u.metadata=l.metadata,u.tags=l.tags,u.project_name=l.project_name,u.replicas=l.replicas}return new t(u)}toHeaders(e){let r={"langsmith-trace":this.dotted_order,baggage:new Npe(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(J0,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null})});var jpe=v(()=>{Lke()});function Nqe(t,e){if(t)return new J0({...t,start_time:t._serialized_start_time??t.start_time,parent_run:Nqe(e),child_runs:t.child_runs.map(r=>Nqe(r)).filter(r=>r!==void 0),extra:{...t.extra,runtime:_ke()},tracingEnabled:!1})}function Iqe(t,e){return t&&!Array.isArray(t)&&typeof t=="object"?t:{[e]:t}}function YU(t){return typeof t._addRunToRunMap=="function"}var cfn,dfn,K0,QU=v(()=>{Do();nl();EY();jpe();cfn={};Et(cfn,{BaseTracer:()=>K0,isBaseTracer:()=>YU});dfn=t=>{if(t)return t.events=t.events??[],t.child_runs=t.child_runs??[],t};K0=class extends WU{constructor(e){super(...arguments);M(this,"runMap",new Map);M(this,"runTreeMap",new Map);M(this,"usesRunTreeMap",!1)}copy(){return this}getRunById(e){if(e!==void 0)return this.usesRunTreeMap?dfn(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}=Aqe(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.trace_id=o.id,o.dotted_order=r,o._serialized_start_time=n),this.usesRunTreeMap){let a=Nqe(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){let l=this._getExecutionOrder(o),c=Date.now(),d={id:n,name:u??e.id[e.id.length-1],parent_run_id:o,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:r,execution_order:l,child_execution_order:l,run_type:s??"chain",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(d)}async handleChainStart(e,r,n,o,i,a,s,u){let l=this.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=Iqe(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),i?.inputs!==void 0&&(a.inputs=Iqe(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=Iqe(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 LOt=S((Kvi,$Ot)=>{"use strict";var jOt=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,DOt=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`;function ffn(){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=jOt(),e.color.ansi16m=DOt(),e.bgColor.ansi256=jOt(10),e.bgColor.ansi16m=DOt(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($Ot,"exports",{enumerable:!0,get:ffn})});function Xy(t,e){return`${t.open}${e}${t.close}`}function $w(t,e){try{return JSON.stringify(t,null,2)}catch{return e}}function FOt(t){return typeof t=="string"?t.trim():t==null?t:$w(t,t.toString())}function Z$(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 jqe,pfn,Yb,Dpe,kOt=v(()=>{Do();QU();jqe=L(LOt(),1),pfn={};Et(pfn,{ConsoleCallbackHandler:()=>Dpe});({color:Yb}=jqe.default),Dpe=class extends K0{constructor(){super(...arguments);M(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?Xy(jqe.default.bold,s):s}).join(" > ");return Xy(Yb.grey,n)}onChainStart(e){let r=this.getBreadcrumbs(e);console.log(`${Xy(Yb.green,"[chain/start]")} [${r}] Entering Chain run with input: ${$w(e.inputs,"[inputs]")}`)}onChainEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Xy(Yb.cyan,"[chain/end]")} [${r}] [${Z$(e)}] Exiting Chain run with output: ${$w(e.outputs,"[outputs]")}`)}onChainError(e){let r=this.getBreadcrumbs(e);console.log(`${Xy(Yb.red,"[chain/error]")} [${r}] [${Z$(e)}] Chain run errored with error: ${$w(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(`${Xy(Yb.green,"[llm/start]")} [${r}] Entering LLM run with input: ${$w(n,"[inputs]")}`)}onLLMEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Xy(Yb.cyan,"[llm/end]")} [${r}] [${Z$(e)}] Exiting LLM run with output: ${$w(e.outputs,"[response]")}`)}onLLMError(e){let r=this.getBreadcrumbs(e);console.log(`${Xy(Yb.red,"[llm/error]")} [${r}] [${Z$(e)}] LLM run errored with error: ${$w(e.error,"[error]")}`)}onToolStart(e){let r=this.getBreadcrumbs(e);console.log(`${Xy(Yb.green,"[tool/start]")} [${r}] Entering Tool run with input: "${FOt(e.inputs.input)}"`)}onToolEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Xy(Yb.cyan,"[tool/end]")} [${r}] [${Z$(e)}] Exiting Tool run with output: "${FOt(e.outputs?.output)}"`)}onToolError(e){let r=this.getBreadcrumbs(e);console.log(`${Xy(Yb.red,"[tool/error]")} [${r}] [${Z$(e)}] Tool run errored with error: ${$w(e.error,"[error]")}`)}onRetrieverStart(e){let r=this.getBreadcrumbs(e);console.log(`${Xy(Yb.green,"[retriever/start]")} [${r}] Entering Retriever run with input: ${$w(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){let r=this.getBreadcrumbs(e);console.log(`${Xy(Yb.cyan,"[retriever/end]")} [${r}] [${Z$(e)}] Exiting Retriever run with output: ${$w(e.outputs,"[outputs]")}`)}onRetrieverError(e){let r=this.getBreadcrumbs(e);console.log(`${Xy(Yb.red,"[retriever/error]")} [${r}] [${Z$(e)}] Retriever run errored with error: ${$w(e.error,"[error]")}`)}onAgentAction(e){let r=e,n=this.getBreadcrumbs(e);console.log(`${Xy(Yb.blue,"[agent/action]")} [${n}] Agent selected action: ${$w(r.actions[r.actions.length-1],"[action]")}`)}}});var $pe=v(()=>{npe()});var Dqe,Lpe,$qe=v(()=>{nl();$pe();Lpe=()=>{if(Dqe===void 0){let t=gn("LANGCHAIN_CALLBACKS_BACKGROUND")==="false"?{blockOnRootRunFinalization:!0}:{};Dqe=new GU(t)}return Dqe}});function qOt(t=!1){let e=hfn.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 Fpe(t){return typeof t=="function"&&"langsmith:traceable"in t}var Fqe,Lqe,mfn,kqe,hfn,owi,BOt=v(()=>{Fqe=class{getStore(){}run(e,r){return r()}},Lqe=Symbol.for("ls:tracing_async_local_storage"),mfn=new Fqe,kqe=class{getInstance(){return globalThis[Lqe]??mfn}initializeGlobalInstance(e){globalThis[Lqe]===void 0&&(globalThis[Lqe]=e)}},hfn=new kqe;owi=Symbol.for("langsmith:traceable:root")});var qqe=v(()=>{BOt()});var gfn,kY,zOt=v(()=>{Do();QU();$qe();qqe();jpe();$pe();gfn={};Et(gfn,{LangChainTracer:()=>kY});kY=class UOt extends K0{constructor(r={}){super(r);M(this,"name","langchain_tracer");M(this,"projectName");M(this,"exampleId");M(this,"client");M(this,"replicas");M(this,"usesRunTreeMap",!0);let{exampleId:n,projectName:o,client:i,replicas:a}=r;this.projectName=o??PY(),this.replicas=a,this.exampleId=n,this.client=i??Lpe();let s=UOt.getTraceableRunTree();s&&this.updateFromRunTree(s)}async persistRun(r){}async onRunCreate(r){await this.getRunTreeWithTracingConfig(r.id)?.postRun()}async onRunUpdate(r){await this.getRunTreeWithTracingConfig(r.id)?.patchRun()}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 J0({...n,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return qOt(!0)}catch{return}}}});var VOt=S((gwi,qpe)=>{"use strict";var yfn=Yke(),kpe=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},HOt=(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 kpe(a);typeof t.cancel=="function"&&t.cancel(),o(s)},e);yfn(t.then(n,o),()=>{clearTimeout(i)})});qpe.exports=HOt;qpe.exports.default=HOt;qpe.exports.TimeoutError=kpe});var JOt=S(Bqe=>{"use strict";Object.defineProperty(Bqe,"__esModule",{value:!0});function bfn(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}Bqe.default=bfn});var KOt=S(zqe=>{"use strict";Object.defineProperty(zqe,"__esModule",{value:!0});var _fn=JOt(),Uqe=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=_fn.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}};zqe.default=Uqe});var Jqe=S(Vqe=>{"use strict";Object.defineProperty(Vqe,"__esModule",{value:!0});var vfn=Xke(),WOt=VOt(),wfn=KOt(),Bpe=()=>{},Sfn=new WOt.TimeoutError,Hqe=class extends vfn{constructor(e){var r,n,o,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Bpe,this._resolveIdle=Bpe,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:wfn.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=Bpe,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=Bpe,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():WOt.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&o(Sfn)});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}};Vqe.default=Hqe});function Cfn(){let t="default"in Upe.default?Upe.default.default:Upe.default;return new t({autoStart:!0,concurrency:1})}function xfn(){return typeof ez>"u"&&(ez=Cfn()),ez}async function xc(t,e){if(e===!0){let r=W$();r!==void 0?await r.run(void 0,async()=>t()):await t()}else ez=xfn(),ez.add(async()=>{let r=W$();r!==void 0?await r.run(void 0,async()=>t()):await t()})}async function GOt(){let t=Lpe();await Promise.allSettled([typeof ez<"u"?ez.onIdle():Promise.resolve(),t.awaitPendingTraceBatches()])}var Upe,ez,Kqe=v(()=>{$qe();hY();Upe=L(Jqe(),1)});var Ofn,ZOt=v(()=>{Do();Kqe();Ofn={};Et(Ofn,{awaitAllCallbacks:()=>GOt,consumeCallback:()=>xc})});var XOt,YOt=v(()=>{nl();XOt=t=>t!==void 0?t:!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(r=>gn(r)==="true")});function Wqe(t){let e=W$();return e===void 0?void 0:e.getStore()?.[K$]?.[t]}var Tfn,QOt,eTt=v(()=>{hY();jpe();Tfn=Symbol("lc:configure_hooks"),QOt=()=>Wqe(Tfn)||[]});function lN(t){return t?Array.isArray(t)||"name"in t?{callbacks:t}:t:{}}function t6(t){return"name"in t?t:WU.fromMethods(t)}var Efn,tTt,BY,rTt,Gqe,nTt,oTt,Yl,X$=v(()=>{Do();iO();nl();EY();QU();kOt();zOt();Kqe();ZOt();YOt();eTt();OY();Efn={};Et(Efn,{BaseCallbackManager:()=>tTt,BaseRunManager:()=>BY,CallbackManager:()=>Yl,CallbackManagerForChainRun:()=>nTt,CallbackManagerForLLMRun:()=>Gqe,CallbackManagerForRetrieverRun:()=>rTt,CallbackManagerForToolRun:()=>oTt,ensureHandler:()=>t6,parseCallbackConfigArg:()=>lN});tTt=class{setHandler(t){return this.setHandlers([t])}},BY=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=>xc(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=>xc(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)))}},rTt=class extends BY{getChild(t){let e=new Yl(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=>xc(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=>xc(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)))}},Gqe=class extends BY{async handleLLMNewToken(t,e,r,n,o,i){await Promise.all(this.handlers.map(a=>xc(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=>xc(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=>xc(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)))}},nTt=class extends BY{getChild(t){let e=new Yl(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=>xc(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=>xc(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=>xc(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=>xc(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)))}},oTt=class extends BY{getChild(t){let e=new Yl(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=>xc(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=>xc(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)))}},Yl=class qY extends tTt{constructor(r,n){super();M(this,"handlers",[]);M(this,"inheritableHandlers",[]);M(this,"tags",[]);M(this,"inheritableTags",[]);M(this,"metadata",{});M(this,"inheritableMetadata",{});M(this,"name","callback_manager");M(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:Zb();return await Promise.all(this.handlers.map(p=>{if(!p.ignoreLLM)return YU(p)&&p._createRunForLLMStart(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l),xc(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 Gqe(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:Zb();return await Promise.all(this.handlers.map(p=>{if(!p.ignoreLLM)return YU(p)&&p._createRunForChatModelStart(r,[c],f,this._parentRunId,a,this.tags,this.metadata,l),xc(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=rl(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 Gqe(f,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(r,n,o=Zb(),i=void 0,a=void 0,s=void 0,u=void 0){return await Promise.all(this.handlers.map(l=>{if(!l.ignoreChain)return YU(l)&&l._createRunForChainStart(r,n,o,this._parentRunId,this.tags,this.metadata,i,u),xc(async()=>{try{await l.handleChainStart?.(r,n,o,this._parentRunId,this.tags,this.metadata,i,u)}catch(c){if((l.raiseError?console.error:console.warn)(`Error in handler ${l.constructor.name}, handleChainStart: ${c}`),l.raiseError)throw c}},l.awaitHandlers)})),new nTt(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(r,n,o=Zb(),i=void 0,a=void 0,s=void 0,u=void 0){return await Promise.all(this.handlers.map(l=>{if(!l.ignoreAgent)return YU(l)&&l._createRunForToolStart(r,n,o,this._parentRunId,this.tags,this.metadata,u),xc(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 oTt(o,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(r,n,o=Zb(),i=void 0,a=void 0,s=void 0,u=void 0){return await Promise.all(this.handlers.map(l=>{if(!l.ignoreRetriever)return YU(l)&&l._createRunForRetrieverStart(r,n,o,this._parentRunId,this.tags,this.metadata,u),xc(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 rTt(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=>xc(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 qY(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 WU{constructor(){super();M(this,"name",Zb());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 qY,l.setHandlers(r?.map(t6)??[],!0)):l=r,l=l.copy(Array.isArray(n)?n.map(t6):n?.handlers,!1));let c=gn("LANGCHAIN_VERBOSE")==="true"||u?.verbose,d=kY.getTraceableRunTree()?.tracingEnabled||XOt(),f=d||(gn("LANGCHAIN_TRACING")??!1);if(c||f){if(l||(l=new qY),c&&!l.handlers.some(p=>p.name===Dpe.prototype.name)){let p=new Dpe;l.addHandler(p,!0)}if(f&&!l.handlers.some(p=>p.name==="langchain_tracer")&&d){let p=new kY;l.addHandler(p,!0)}if(d){let p=kY.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:g}of QOt()){let y=g&&gn(g)==="true"&&h,b,_=p!==void 0?Wqe(p):void 0;_&&Ske(_)?b=_:y&&(b=new h({})),b!==void 0&&(l||(l=new qY),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 Zqe,Pfn,iTt,Mfn,Qm,tz=v(()=>{hY();X$();$pe();Zqe=class{getStore(){}run(t,e){return e()}enterWith(t){}},Pfn=new Zqe,iTt=Symbol.for("lc:child_config"),Mfn=class{getInstance(){return W$()??Pfn}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[iTt]}runWithConfig(t,e,r){let n=Yl._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 J0({name:"<runnable_lambda>",tracingEnabled:!1})),u&&(u.extra={...u.extra,[iTt]:t}),i!==void 0&&i[K$]!==void 0&&(u===void 0&&(u={}),u[K$]=i[K$]),o.run(u,e)}initializeGlobalInstance(t){W$()===void 0&&_St(t)}},Qm=new Mfn});var Rfn,rz=v(()=>{Do();hY();tz();Rfn={};Et(Rfn,{AsyncLocalStorageProviderSingleton:()=>Qm,MockAsyncLocalStorage:()=>Zqe,_CONTEXT_VARIABLES_KEY:()=>K$})});async function Gg(t){return Yl._configureSync(t?.callbacks,void 0,t?.tags,void 0,t?.metadata)}function nz(...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(t6(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(t6(s),!0);e.callbacks=a}else e.callbacks=new Yl(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 Jo(t){let e=Qm.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))Afn.has(typeof r.configurable[n])&&!r.metadata?.[n]&&(r.metadata||(r.metadata={}),r.metadata[n]=r.configurable[n]);if(r.timeout!==void 0){if(r.timeout<=0)throw new Error("Timeout must be a positive number");let n=AbortSignal.timeout(r.timeout);r.signal!==void 0?"any"in AbortSignal&&(r.signal=AbortSignal.any([r.signal,n])):r.signal=n,delete r.timeout}return r}function zs(t={},{callbacks:e,maxConcurrency:r,recursionLimit:n,runName:o,configurable:i,runId:a}={}){let s=Jo(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){return t?{configurable:t.configurable,recursionLimit:t.recursionLimit,callbacks:t.callbacks,tags:t.tags,metadata:t.metadata,maxConcurrency:t.maxConcurrency,timeout:t.timeout,signal:t.signal}:void 0}var zpe,Afn,uO=v(()=>{X$();tz();rz();zpe=25;Afn=new Set(["string","number","boolean"])});async function lO(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(Y$(e))},e.addEventListener("abort",r),e.aborted&&o(Y$(e))})]).finally(()=>e.removeEventListener("abort",r))}function Y$(t){return t?.reason instanceof Error?t.reason:typeof t?.reason=="string"?new Error(t.reason):new Error("Aborted")}var UY=v(()=>{});function Hpe(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 Yqe(t,e,r,n,...o){let i=new Q$({generator:e,startSetup:r,signal:n}),a=await i.setup;return{output:t(i,a,...o),setup:a}}var Ifn,Qy,Q$,cO=v(()=>{Do();tz();rz();uO();UY();Ifn={};Et(Ifn,{AsyncGeneratorWithSetup:()=>Q$,IterableReadableStream:()=>Qy,atee:()=>Hpe,concat:()=>eb,pipeGeneratorWithSetup:()=>Yqe});Qy=class Xqe extends ReadableStream{constructor(){super(...arguments);M(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 Xqe({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 Xqe({async pull(n){let{value:o,done:i}=await r.next();i&&n.close(),n.enqueue(o)},async cancel(n){await r.return(n)}})}};Q$=class{constructor(t){M(this,"generator");M(this,"setup");M(this,"config");M(this,"signal");M(this,"firstResult");M(this,"firstResultUsed",!1);this.generator=t.generator,this.config=t.config,this.signal=t.signal??this.config?.signal,this.setup=new Promise((e,r)=>{Qm.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?Qm.runWithConfig(Yy(this.config),this.signal?async()=>lO(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 Jpe(t,e){return Nfn.call(t,e)}function Kpe(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)Jpe(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 Wpe(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 cN(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function Gpe(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function Vpe(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(Vpe(t[r]))return!0}else if(typeof t=="object"){let r=Kpe(t),n=r.length;for(var e=0;e<n;e++)if(Vpe(t[r[e]]))return!0}}return!1}function aTt(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 Nfn,Zpe,Xpe=v(()=>{Nfn=Object.prototype.hasOwnProperty;Zpe=class extends Error{constructor(t,e,r,n,o){super(aTt(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=aTt(t,{name:e,index:r,operation:n,tree:o})}}});function Ype(t,e){if(e=="")return t;var r={op:"_get",path:e};return oz(t,r),r.value}function oz(t,e,r=!1,n=!0,o=!0,i=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):Qpe(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=Ype(t,e.from),e.op==="move"&&(a.removed=t),a;if(e.op==="test"){if(a.test=zY(t,e.value),a.test===!1)throw new Oc("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 Oc("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=Qpe;;){if(f=s[l],f&&f.indexOf("~")!=-1&&(f=Gpe(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&&!Wpe(f))throw new Oc("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);Wpe(f)&&(f=~~f)}if(l>=c){if(r&&e.op==="add"&&f>u.length)throw new Oc("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=Dfn[e.op].call(e,u,f,t);if(m.test===!1)throw new Oc("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}}else if(l>=c){let m=r6[e.op].call(e,u,f,t);if(m.test===!1)throw new Oc("Test operation failed","TEST_OPERATION_FAILED",i,e,t);return m}if(u=u[f],r&&l<c&&(!u||typeof u!="object"))throw new Oc("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,t)}}}function eL(t,e,r,n=!0,o=!0){if(r&&!Array.isArray(e))throw new Oc("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]=oz(t,e[a],r,!0,o,a),t=i[a].newDocument;return i.newDocument=t,i}function $fn(t,e,r){let n=oz(t,e);if(n.test===!1)throw new Oc("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function Qpe(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new Oc("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(r6[t.op]){if(typeof t.path!="string")throw new Oc("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new Oc('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 Oc("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 Oc("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")&&Vpe(t.value))throw new Oc("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 Oc("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 Oc("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=sTt([a],r);if(s&&s.name==="OPERATION_PATH_UNRESOLVABLE")throw new Oc("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new Oc("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function sTt(t,e,r){try{if(!Array.isArray(t))throw new Oc("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)eL(tb(e),tb(t),r||!0);else{r=r||Qpe;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof Oc)return o;throw o}}function zY(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(!zY(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],!zY(t[a],e[a]))return!1;return!0}return t!==t&&e!==e}var Qqe,Oc,jfn,r6,Dfn,HY=v(()=>{Do();Xpe();Qqe={};Et(Qqe,{JsonPatchError:()=>Oc,_areEquals:()=>zY,applyOperation:()=>oz,applyPatch:()=>eL,applyReducer:()=>$fn,deepClone:()=>jfn,getValueByPointer:()=>Ype,validate:()=>sTt,validator:()=>Qpe});Oc=Zpe,jfn=tb,r6={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){let n=Ype(r,this.path);n&&(n=tb(n));let o=oz(r,{op:"remove",path:this.from}).removed;return oz(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){let n=Ype(r,this.from);return oz(r,{op:"add",path:this.path,value:tb(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:zY(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},Dfn={add:function(t,e,r){return Wpe(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:r6.move,copy:r6.copy,test:r6.test,_get:r6._get}});function uTt(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=Kpe(e),a=Kpe(t),s=!1,u=!1,l=a.length-1;l>=0;l--){var c=a[l],d=t[c];if(Jpe(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)?uTt(d,f,r,n+"/"+cN(c),o):d!==f&&(s=!0,o&&r.push({op:"test",path:n+"/"+cN(c),value:tb(d)}),r.push({op:"replace",path:n+"/"+cN(c),value:tb(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+cN(c),value:tb(d)}),r.push({op:"remove",path:n+"/"+cN(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];!Jpe(t,c)&&e[c]!==void 0&&r.push({op:"add",path:n+"/"+cN(c),value:tb(e[c])})}}}function n6(t,e,r=!1){var n=[];return uTt(t,e,n,"",r),n}var VY=v(()=>{Xpe();HY()});var kSi,eBe=v(()=>{Xpe();HY();VY();kSi={...Qqe,JsonPatchError:Zpe,deepClone:tb,escapePathComponent:cN,unescapePathComponent:Gpe}});async function lTt(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 cTt(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 Ffn(t){return t!==void 0&&t.message!==void 0}var Lfn,dO,eme,rBe,tme,dTt=v(()=>{Do();V0();HY();eBe();QU();cO();Lfn={};Et(Lfn,{LogStreamCallbackHandler:()=>tme,RunLog:()=>eme,RunLogPatch:()=>dO,isLogStreamHandler:()=>rBe});dO=class{constructor(t){M(this,"ops");this.ops=t.ops??[]}concat(t){let e=this.ops.concat(t.ops),r=eL({},e);return new eme({ops:e,state:r[r.length-1].newDocument})}},eme=class tBe extends dO{constructor(r){super(r);M(this,"state");this.state=r.state}concat(r){let n=this.ops.concat(r.ops),o=eL(this.state,r.ops);return new tBe({ops:n,state:o[o.length-1].newDocument})}static fromRunLogPatch(r){let n=eL({},r.ops);return new tBe({ops:r.ops,state:n[n.length-1].newDocument})}},rBe=t=>t.name==="log_stream_tracer";tme=class extends K0{constructor(e){super({_awaitHandler:!0,...e});M(this,"autoClose",!0);M(this,"includeNames");M(this,"includeTypes");M(this,"includeTags");M(this,"excludeNames");M(this,"excludeTypes");M(this,"excludeTags");M(this,"_schemaFormat","original");M(this,"rootId");M(this,"keyMapByRunId",{});M(this,"counterMapByRunName",{});M(this,"transformStream");M(this,"writer");M(this,"receiveStream");M(this,"name","log_stream_tracer");M(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 dO({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 dO({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 lTt(e,this._schemaFormat)),await this.writer.write(new dO({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 lTt(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${r}/final_output`,value:await cTt(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 dO({ops:n});await this.writer.write(o)}finally{if(e.id===this.rootId){let r=new dO({ops:[{op:"replace",path:"/final_output",value:await cTt(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?Ffn(n?.chunk)?a=n?.chunk:a=new Ur({id:`run-${e.id}`,content:r}):a=r;let s=new dO({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 kfn,dN,Lw,Hi,ym=v(()=>{Do();kfn={};Et(kfn,{ChatGenerationChunk:()=>Hi,GenerationChunk:()=>Lw,RUN_KEY:()=>dN});dN="__run",Lw=class fTt{constructor(e){M(this,"text");M(this,"generationInfo");this.text=e.text,this.generationInfo=e.generationInfo}concat(e){return new fTt({text:this.text+e.text,generationInfo:{...this.generationInfo,...e.generationInfo}})}},Hi=class pTt extends Lw{constructor(r){super(r);M(this,"message");this.message=r.message}concat(r){return new pTt({text:this.text+r.text,generationInfo:{...this.generationInfo,...r.generationInfo},message:this.message.concat(r.message)})}}});function rme({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 mTt,hTt,gTt=v(()=>{V0();QU();cO();ym();mTt=t=>t.name==="event_stream_tracer",hTt=class extends K0{constructor(e){super({_awaitHandler:!0,...e});M(this,"autoClose",!0);M(this,"includeNames");M(this,"includeTypes");M(this,"includeTags");M(this,"excludeNames");M(this,"excludeTypes");M(this,"excludeTags");M(this,"runInfoMap",new Map);M(this,"tappedPromises",new Map);M(this,"transformStream");M(this,"writer");M(this,"receiveStream");M(this,"name","event_stream_tracer");M(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,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._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=rme(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 Ur({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=rme(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=rme(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=rme(e),o={tags:e.tags??[],metadata:e.extra?.metadata??{},name:r,runType:"retriever",inputs:{query:e.inputs.query}};this.runInfoMap.set(e.id,o),await this.send({event:"on_retriever_start",data:{input:{query:e.inputs.query}},name:r,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},o)}async onRetrieverEnd(e){let r=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),r===void 0)throw new Error(`onRetrieverEnd: Run ID ${e.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:e.outputs?.documents??e.outputs,input:r.inputs},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}async handleCustomEvent(e,r,n){let o=this.runInfoMap.get(n);if(o===void 0)throw new Error(`handleCustomEvent: Run ID ${n} not found in run map.`);await this.send({event:"on_custom_event",run_id:n,name:e,tags:o.tags,metadata:o.metadata,data:r},o)}async finish(){let e=[...this.tappedPromises.values()];Promise.all(e).finally(()=>{this.writer.close()})}}});var yTt,nme,qfn,Bfn,Ufn,Fw,iz=v(()=>{Do();UY();yTt=L(cpe(),1),nme=L(Jqe(),1),qfn={};Et(qfn,{AsyncCaller:()=>Fw});Bfn=[400,401,402,403,404,405,406,407,409],Ufn=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&&Bfn.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){M(this,"maxConcurrency");M(this,"maxRetries");M(this,"onFailedAttempt");M(this,"queue");this.maxConcurrency=t.maxConcurrency??1/0,this.maxRetries=t.maxRetries??6,this.onFailedAttempt=t.onFailedAttempt??Ufn;let e="default"in nme.default?nme.default.default:nme.default;this.queue=new e({concurrency:this.maxConcurrency})}call(t,...e){return this.queue.add(()=>(0,yTt.default)(()=>t(...e).catch(r=>{throw r instanceof Error?r:new Error(r)}),{onFailedAttempt:this.onFailedAttempt,retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(t,e,...r){return t.signal?Promise.race([this.call(e,...r),new Promise((n,o)=>{t.signal?.addEventListener("abort",()=>{o(Y$(t.signal))})})]):this.call(e,...r)}fetch(...t){return this.call(()=>fetch(...t).then(e=>e.ok?e:Promise.reject(e)))}}});var nBe,bTt=v(()=>{QU();nBe=class extends K0{constructor({config:e,onStart:r,onEnd:n,onError:o}){super({_awaitHandler:!0});M(this,"name","RootListenersTracer");M(this,"rootId");M(this,"config");M(this,"argOnStart");M(this,"argOnEnd");M(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 JY(t){return t?t.lc_runnable:!1}var _Tt,oBe=v(()=>{_Tt=class{constructor(t){M(this,"includeNames");M(this,"includeTypes");M(this,"includeTags");M(this,"excludeNames");M(this,"excludeTypes");M(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}}});function we(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 fd(t){return t&&Object.assign(KY,t),KY}var iBe,aBe,fO,KY,o6=v(()=>{iBe=Object.freeze({status:"aborted"});aBe=Symbol("zod_brand"),fO=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},KY={}});var xt={};Xn(xt,{BIGINT_FORMAT_RANGES:()=>gBe,Class:()=>uBe,NUMBER_FORMAT_RANGES:()=>hBe,aborted:()=>sz,allowsEval:()=>fBe,assert:()=>Kfn,assertEqual:()=>zfn,assertIs:()=>Vfn,assertNever:()=>Jfn,assertNotEqual:()=>Hfn,assignProp:()=>dBe,cached:()=>ZY,captureStackTrace:()=>ome,cleanEnum:()=>apn,cleanRegex:()=>XY,clone:()=>Kc,createTransparentProxy:()=>Qfn,defineLazy:()=>Ds,esc:()=>az,escapeRegex:()=>fN,extend:()=>rpn,finalizeIssue:()=>wv,floatSafeRemainder:()=>cBe,getElementAtPath:()=>Wfn,getEnumValues:()=>GY,getLengthableOrigin:()=>eQ,getParsedType:()=>Yfn,getSizableOrigin:()=>QY,isObject:()=>i6,isPlainObject:()=>a6,issue:()=>yBe,joinValues:()=>Be,jsonStringifyReplacer:()=>lBe,merge:()=>npn,normalizeParams:()=>dt,nullish:()=>tL,numKeys:()=>Xfn,omit:()=>tpn,optionalKeys:()=>mBe,partial:()=>opn,pick:()=>epn,prefixIssues:()=>Qb,primitiveTypes:()=>pBe,promiseAllObject:()=>Gfn,propertyKeyTypes:()=>YY,randomString:()=>Zfn,required:()=>ipn,stringifyPrimitive:()=>Nt,unwrapMessage:()=>WY});function zfn(t){return t}function Hfn(t){return t}function Vfn(t){}function Jfn(t){throw new Error}function Kfn(t){}function GY(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 Be(t,e="|"){return t.map(r=>Nt(r)).join(e)}function lBe(t,e){return typeof e=="bigint"?e.toString():e}function ZY(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function tL(t){return t==null}function XY(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function cBe(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 Ds(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 dBe(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Wfn(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Gfn(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 Zfn(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function az(t){return JSON.stringify(t)}function i6(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function a6(t){if(i6(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(i6(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Xfn(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function fN(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Kc(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function dt(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 Qfn(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 Nt(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function mBe(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function epn(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 Kc(t,{...t._zod.def,shape:r,checks:[]})}function tpn(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 Kc(t,{...t._zod.def,shape:r,checks:[]})}function rpn(t,e){if(!a6(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 dBe(this,"shape",n),n},checks:[]};return Kc(t,r)}function npn(t,e){return Kc(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return dBe(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function opn(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 Kc(e,{...e._zod.def,shape:o,checks:[]})}function ipn(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 Kc(e,{...e._zod.def,shape:o,checks:[]})}function sz(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Qb(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function WY(t){return typeof t=="string"?t:t?.message}function wv(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=WY(t.inst?._zod.def?.error?.(t))??WY(e?.error?.(t))??WY(r.customError?.(t))??WY(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function QY(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function eQ(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function yBe(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function apn(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var ome,fBe,Yfn,YY,pBe,hBe,gBe,uBe,In=v(()=>{ome=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};fBe=ZY(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});Yfn=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}`)}},YY=new Set(["string","number","symbol"]),pBe=new Set(["string","number","bigint","boolean","symbol","undefined"]);hBe={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]},gBe={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};uBe=class{constructor(...e){}}});function rQ(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 nQ(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 bBe(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 wTt(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 _Be(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 ${wTt(n.path)}`);return e.join(`
|
||
`)}var vTt,tQ,s6,vBe=v(()=>{o6();In();vTt=(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,lBe,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},tQ=we("$ZodError",vTt),s6=we("$ZodError",vTt,{Parent:Error})});var ime,pO,ame,uz,sme,wBe,ume,SBe,lme=v(()=>{o6();vBe();In();ime=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 fO;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>wv(u,i,fd())));throw ome(s,o?.callee),s}return a.value},pO=ime(s6),ame=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=>wv(u,i,fd())));throw ome(s,o?.callee),s}return a.value},uz=ame(s6),sme=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 fO;return i.issues.length?{success:!1,error:new(t??tQ)(i.issues.map(a=>wv(a,o,fd())))}:{success:!0,data:i.value}},wBe=sme(s6),ume=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=>wv(a,o,fd())))}:{success:!0,data:i.value}},SBe=ume(s6)});var cz={};Xn(cz,{_emoji:()=>STt,base64:()=>LBe,base64url:()=>cme,bigint:()=>HBe,boolean:()=>KBe,browserEmail:()=>hpn,cidrv4:()=>DBe,cidrv6:()=>$Be,cuid:()=>CBe,cuid2:()=>xBe,date:()=>qBe,datetime:()=>UBe,domain:()=>gpn,duration:()=>MBe,e164:()=>kBe,email:()=>ABe,emoji:()=>IBe,extendedDuration:()=>upn,guid:()=>RBe,hostname:()=>FBe,html5Email:()=>fpn,integer:()=>VBe,ipv4:()=>NBe,ipv6:()=>jBe,ksuid:()=>EBe,lowercase:()=>ZBe,nanoid:()=>PBe,null:()=>WBe,number:()=>JBe,rfc5322Email:()=>ppn,string:()=>zBe,time:()=>BBe,ulid:()=>OBe,undefined:()=>GBe,unicodeEmail:()=>mpn,uppercase:()=>XBe,uuid:()=>lz,uuid4:()=>lpn,uuid6:()=>cpn,uuid7:()=>dpn,xid:()=>TBe});function IBe(){return new RegExp(STt,"u")}function xTt(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 BBe(t){return new RegExp(`^${xTt(t)}$`)}function UBe(t){let e=xTt({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(`^${CTt}T(?:${n})$`)}var CBe,xBe,OBe,TBe,EBe,PBe,MBe,upn,RBe,lz,lpn,cpn,dpn,ABe,fpn,ppn,mpn,hpn,STt,NBe,jBe,DBe,$Be,LBe,cme,FBe,gpn,kBe,CTt,qBe,zBe,HBe,VBe,JBe,KBe,WBe,GBe,ZBe,XBe,dme=v(()=>{CBe=/^[cC][^\s-]{8,}$/,xBe=/^[0-9a-z]+$/,OBe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,TBe=/^[0-9a-vA-V]{20}$/,EBe=/^[A-Za-z0-9]{27}$/,PBe=/^[a-zA-Z0-9_-]{21}$/,MBe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,upn=/^[-+]?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)?)??$/,RBe=/^([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})$/,lz=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)$/,lpn=lz(4),cpn=lz(6),dpn=lz(7),ABe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,fpn=/^[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])?)*$/,ppn=/^(([^<>()\[\]\\.,;:\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,}))$/,mpn=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,hpn=/^[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])?)*$/,STt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";NBe=/^(?:(?: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])$/,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})$/,DBe=/^((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])$/,$Be=/^(([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])$/,LBe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cme=/^[A-Za-z0-9_-]*$/,FBe=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,gpn=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,kBe=/^\+(?:[0-9]){6,14}[0-9]$/,CTt="(?:(?:\\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])))",qBe=new RegExp(`^${CTt}$`);zBe=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},HBe=/^\d+n?$/,VBe=/^\d+$/,JBe=/^-?\d+(?:\.\d+)?/i,KBe=/true|false/i,WBe=/null/i,GBe=/undefined/i,ZBe=/^[^A-Z]*$/,XBe=/^[^a-z]*$/});function OTt(t,e,r){t.issues.length&&e.issues.push(...Qb(r,t.issues))}var Ql,TTt,fme,pme,YBe,QBe,eUe,tUe,rUe,nUe,oUe,iUe,aUe,u6,sUe,uUe,lUe,cUe,dUe,fUe,pUe,mUe,hUe,mme=v(()=>{o6();dme();In();Ql=we("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),TTt={number:"number",bigint:"bigint",object:"date"},fme=we("$ZodCheckLessThan",(t,e)=>{Ql.init(t,e);let r=TTt[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})}}),pme=we("$ZodCheckGreaterThan",(t,e)=>{Ql.init(t,e);let r=TTt[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})}}),YBe=we("$ZodCheckMultipleOf",(t,e)=>{Ql.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):cBe(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})}}),QBe=we("$ZodCheckNumberFormat",(t,e)=>{Ql.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=hBe[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=VBe)}),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})}}),eUe=we("$ZodCheckBigIntFormat",(t,e)=>{Ql.init(t,e);let[r,n]=gBe[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})}}),tUe=we("$ZodCheckMaxSize",(t,e)=>{var r;Ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!tL(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:QY(o),code:"too_big",maximum:e.maximum,input:o,inst:t,continue:!e.abort})}}),rUe=we("$ZodCheckMinSize",(t,e)=>{var r;Ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!tL(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:QY(o),code:"too_small",minimum:e.minimum,input:o,inst:t,continue:!e.abort})}}),nUe=we("$ZodCheckSizeEquals",(t,e)=>{var r;Ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!tL(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:QY(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})}}),oUe=we("$ZodCheckMaxLength",(t,e)=>{var r;Ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!tL(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=eQ(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),iUe=we("$ZodCheckMinLength",(t,e)=>{var r;Ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!tL(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=eQ(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),aUe=we("$ZodCheckLengthEquals",(t,e)=>{var r;Ql.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!tL(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=eQ(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})}}),u6=we("$ZodCheckStringFormat",(t,e)=>{var r,n;Ql.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=()=>{})}),sUe=we("$ZodCheckRegex",(t,e)=>{u6.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})}}),uUe=we("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=ZBe),u6.init(t,e)}),lUe=we("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=XBe),u6.init(t,e)}),cUe=we("$ZodCheckIncludes",(t,e)=>{Ql.init(t,e);let r=fN(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),dUe=we("$ZodCheckStartsWith",(t,e)=>{Ql.init(t,e);let r=new RegExp(`^${fN(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),fUe=we("$ZodCheckEndsWith",(t,e)=>{Ql.init(t,e);let r=new RegExp(`.*${fN(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});pUe=we("$ZodCheckProperty",(t,e)=>{Ql.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=>OTt(o,r,e.property));OTt(n,r,e.property)}}),mUe=we("$ZodCheckMimeType",(t,e)=>{Ql.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})}}),hUe=we("$ZodCheckOverwrite",(t,e)=>{Ql.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var oQ,gUe=v(()=>{oQ=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 yUe,bUe=v(()=>{yUe={major:4,minor:0,patch:0}});function kUe(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function kTt(t){if(!cme.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return kUe(r)}function qTt(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 PTt(t,e,r){t.issues.length&&e.issues.push(...Qb(r,t.issues)),e.value[r]=t.value}function hme(t,e,r){t.issues.length&&e.issues.push(...Qb(r,t.issues)),e.value[r]=t.value}function MTt(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(...Qb(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function RTt(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=>wv(i,n,fd())))}),e}function _Ue(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(a6(t)&&a6(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=_Ue(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=_Ue(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 ATt(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),sz(t))return t;let n=_Ue(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 gme(t,e,r){t.issues.length&&e.issues.push(...Qb(r,t.issues)),e.value[r]=t.value}function ITt(t,e,r,n,o,i,a){t.issues.length&&(YY.has(typeof n)?r.issues.push(...Qb(n,t.issues)):r.issues.push({origin:"map",code:"invalid_key",input:o,inst:i,issues:t.issues.map(s=>wv(s,a,fd()))})),e.issues.length&&(YY.has(typeof n)?r.issues.push(...Qb(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>wv(s,a,fd()))})),r.value.set(t.value,e.value)}function NTt(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function jTt(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function DTt(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 $Tt(t,e,r){return sz(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}function LTt(t){return t.value=Object.freeze(t.value),t}function FTt(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(yBe(o))}}var Yn,dz,Cu,vUe,wUe,SUe,CUe,xUe,OUe,TUe,EUe,PUe,MUe,RUe,AUe,IUe,NUe,jUe,DUe,$Ue,LUe,FUe,qUe,BUe,UUe,zUe,HUe,yme,VUe,iQ,bme,JUe,KUe,WUe,GUe,ZUe,rL,aQ,XUe,YUe,sQ,QUe,_me,eze,tze,fz,rze,nze,oze,ize,aze,sze,uQ,l6,uze,lze,cze,dze,fze,pze,mze,lQ,hze,gze,yze,bze,_ze,cQ=v(()=>{mme();o6();gUe();lme();dme();In();bUe();In();Yn=we("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=yUe;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=sz(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 fO;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(u||(u=sz(i,d)))});else{if(i.issues.length===d)continue;u||(u=sz(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 fO;return s.then(u=>o(u,n,a))}return o(s,n,a)}}t["~standard"]={validate:o=>{try{let i=wBe(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return SBe(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),dz=we("$ZodString",(t,e)=>{Yn.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??zBe(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}}),Cu=we("$ZodStringFormat",(t,e)=>{u6.init(t,e),dz.init(t,e)}),vUe=we("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=RBe),Cu.init(t,e)}),wUe=we("$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=lz(n))}else e.pattern??(e.pattern=lz());Cu.init(t,e)}),SUe=we("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=ABe),Cu.init(t,e)}),CUe=we("$ZodURL",(t,e)=>{Cu.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:FBe.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})}}}),xUe=we("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=IBe()),Cu.init(t,e)}),OUe=we("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=PBe),Cu.init(t,e)}),TUe=we("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=CBe),Cu.init(t,e)}),EUe=we("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=xBe),Cu.init(t,e)}),PUe=we("$ZodULID",(t,e)=>{e.pattern??(e.pattern=OBe),Cu.init(t,e)}),MUe=we("$ZodXID",(t,e)=>{e.pattern??(e.pattern=TBe),Cu.init(t,e)}),RUe=we("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=EBe),Cu.init(t,e)}),AUe=we("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=UBe(e)),Cu.init(t,e)}),IUe=we("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=qBe),Cu.init(t,e)}),NUe=we("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=BBe(e)),Cu.init(t,e)}),jUe=we("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=MBe),Cu.init(t,e)}),DUe=we("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=NBe),Cu.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),$Ue=we("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=jBe),Cu.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})}}}),LUe=we("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=DBe),Cu.init(t,e)}),FUe=we("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=$Be),Cu.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})}}});qUe=we("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=LBe),Cu.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{kUe(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});BUe=we("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=cme),Cu.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{kTt(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),UUe=we("$ZodE164",(t,e)=>{e.pattern??(e.pattern=kBe),Cu.init(t,e)});zUe=we("$ZodJWT",(t,e)=>{Cu.init(t,e),t._zod.check=r=>{qTt(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),HUe=we("$ZodCustomStringFormat",(t,e)=>{Cu.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})}}),yme=we("$ZodNumber",(t,e)=>{Yn.init(t,e),t._zod.pattern=t._zod.bag.pattern??JBe,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}}),VUe=we("$ZodNumber",(t,e)=>{QBe.init(t,e),yme.init(t,e)}),iQ=we("$ZodBoolean",(t,e)=>{Yn.init(t,e),t._zod.pattern=KBe,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}}),bme=we("$ZodBigInt",(t,e)=>{Yn.init(t,e),t._zod.pattern=HBe,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}}),JUe=we("$ZodBigInt",(t,e)=>{eUe.init(t,e),bme.init(t,e)}),KUe=we("$ZodSymbol",(t,e)=>{Yn.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}}),WUe=we("$ZodUndefined",(t,e)=>{Yn.init(t,e),t._zod.pattern=GBe,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}}),GUe=we("$ZodNull",(t,e)=>{Yn.init(t,e),t._zod.pattern=WBe,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}}),ZUe=we("$ZodAny",(t,e)=>{Yn.init(t,e),t._zod.parse=r=>r}),rL=we("$ZodUnknown",(t,e)=>{Yn.init(t,e),t._zod.parse=r=>r}),aQ=we("$ZodNever",(t,e)=>{Yn.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),XUe=we("$ZodVoid",(t,e)=>{Yn.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}}),YUe=we("$ZodDate",(t,e)=>{Yn.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}});sQ=we("$ZodArray",(t,e)=>{Yn.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=>PTt(l,r,a))):PTt(u,r,a)}return i.length?Promise.all(i).then(()=>r):r}});QUe=we("$ZodObject",(t,e)=>{Yn.init(t,e);let r=ZY(()=>{let d=Object.keys(e.shape);for(let p of d)if(!(e.shape[p]instanceof Yn))throw new Error(`Invalid element at key "${p}": expected a Zod schema`);let f=mBe(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(f)}});Ds(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 oQ(["shape","payload","ctx"]),p=r.value,m=b=>{let _=az(b);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};f.write("const input = payload.value;");let h=Object.create(null),g=0;for(let b of p.keys)h[b]=`key_${g++}`;f.write("const newResult = {}");for(let b of p.keys)if(p.optionalKeys.has(b)){let _=h[b];f.write(`const ${_} = ${m(b)};`);let w=az(b);f.write(`
|
||
if (${_}.issues.length) {
|
||
if (input[${w}] === undefined) {
|
||
if (${w} in input) {
|
||
newResult[${w}] = undefined;
|
||
}
|
||
} else {
|
||
payload.issues = payload.issues.concat(
|
||
${_}.issues.map((iss) => ({
|
||
...iss,
|
||
path: iss.path ? [${w}, ...iss.path] : [${w}],
|
||
}))
|
||
);
|
||
}
|
||
} else if (${_}.value === undefined) {
|
||
if (${w} in input) newResult[${w}] = undefined;
|
||
} else {
|
||
newResult[${w}] = ${_}.value;
|
||
}
|
||
`)}else{let _=h[b];f.write(`const ${_} = ${m(b)};`),f.write(`
|
||
if (${_}.issues.length) payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
|
||
...iss,
|
||
path: iss.path ? [${az(b)}, ...iss.path] : [${az(b)}]
|
||
})));`),f.write(`newResult[${az(b)}] = ${_}.value`)}f.write("payload.value = newResult;"),f.write("return payload;");let y=f.compile();return(b,_)=>y(d,b,_)},o,i=i6,a=!KY.jitless,u=a&&fBe.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 x=_[w],O=x._zod.run({value:p[w],issues:[]},f),E=x._zod.optin==="optional"&&x._zod.optout==="optional";O instanceof Promise?m.push(O.then(T=>E?MTt(T,d,w,p):hme(T,d,w))):E?MTt(O,d,w,p):hme(O,d,w)}}if(!l)return m.length?Promise.all(m).then(()=>d):d;let h=[],g=c.keySet,y=l._zod,b=y.def.type;for(let _ of Object.keys(p)){if(g.has(_))continue;if(b==="never"){h.push(_);continue}let w=y.run({value:p[_],issues:[]},f);w instanceof Promise?m.push(w.then(x=>hme(x,d,_))):hme(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}});_me=we("$ZodUnion",(t,e)=>{Yn.init(t,e),Ds(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),Ds(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),Ds(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),Ds(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=>XY(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=>RTt(a,r,t,n)):RTt(i,r,t,n)}}),eze=we("$ZodDiscriminatedUnion",(t,e)=>{_me.init(t,e);let r=t._zod.parse;Ds(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=ZY(()=>{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(!i6(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)}}),tze=we("$ZodIntersection",(t,e)=>{Yn.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])=>ATt(r,u,l)):ATt(r,i,a)}});fz=we("$ZodTuple",(t,e)=>{Yn.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=>gme(d,o,u))):gme(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=>gme(f,o,u))):gme(d,o,u)}}return s.length?Promise.all(s).then(()=>o):o}});rze=we("$ZodRecord",(t,e)=>{Yn.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!a6(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(...Qb(u,c.issues)),r.value[u]=c.value})):(l.issues.length&&r.issues.push(...Qb(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=>wv(l,n,fd())),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(...Qb(a,l.issues)),r.value[s.value]=l.value})):(u.issues.length&&r.issues.push(...Qb(a,u.issues)),r.value[s.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),nze=we("$ZodMap",(t,e)=>{Yn.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])=>{ITt(c,d,r,a,o,t,n)})):ITt(u,l,r,a,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});oze=we("$ZodSet",(t,e)=>{Yn.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=>NTt(u,r))):NTt(s,r)}return i.length?Promise.all(i).then(()=>r):r}});ize=we("$ZodEnum",(t,e)=>{Yn.init(t,e);let r=GY(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>YY.has(typeof n)).map(n=>typeof n=="string"?fN(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return t._zod.values.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:t}),n}}),aze=we("$ZodLiteral",(t,e)=>{Yn.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?fN(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),r}}),sze=we("$ZodFile",(t,e)=>{Yn.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}}),uQ=we("$ZodTransform",(t,e)=>{Yn.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 fO;return r.value=o,r}}),l6=we("$ZodOptional",(t,e)=>{Yn.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Ds(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Ds(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${XY(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)}),uze=we("$ZodNullable",(t,e)=>{Yn.init(t,e),Ds(t._zod,"optin",()=>e.innerType._zod.optin),Ds(t._zod,"optout",()=>e.innerType._zod.optout),Ds(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${XY(r.source)}|null)$`):void 0}),Ds(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)}),lze=we("$ZodDefault",(t,e)=>{Yn.init(t,e),t._zod.optin="optional",Ds(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=>jTt(i,e)):jTt(o,e)}});cze=we("$ZodPrefault",(t,e)=>{Yn.init(t,e),t._zod.optin="optional",Ds(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))}),dze=we("$ZodNonOptional",(t,e)=>{Yn.init(t,e),Ds(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=>DTt(i,t)):DTt(o,t)}});fze=we("$ZodSuccess",(t,e)=>{Yn.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)}}),pze=we("$ZodCatch",(t,e)=>{Yn.init(t,e),t._zod.optin="optional",Ds(t._zod,"optout",()=>e.innerType._zod.optout),Ds(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=>wv(a,n,fd()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>wv(i,n,fd()))},input:r.value}),r.issues=[]),r)}}),mze=we("$ZodNaN",(t,e)=>{Yn.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)}),lQ=we("$ZodPipe",(t,e)=>{Yn.init(t,e),Ds(t._zod,"values",()=>e.in._zod.values),Ds(t._zod,"optin",()=>e.in._zod.optin),Ds(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=>$Tt(i,e,n)):$Tt(o,e,n)}});hze=we("$ZodReadonly",(t,e)=>{Yn.init(t,e),Ds(t._zod,"propValues",()=>e.innerType._zod.propValues),Ds(t._zod,"values",()=>e.innerType._zod.values),Ds(t._zod,"optin",()=>e.innerType._zod.optin),Ds(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(LTt):LTt(o)}});gze=we("$ZodTemplateLiteral",(t,e)=>{Yn.init(t,e);let r=[];for(let n of e.parts)if(n instanceof Yn){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||pBe.has(typeof n))r.push(fN(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"template_literal",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),n)}),yze=we("$ZodPromise",(t,e)=>{Yn.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),bze=we("$ZodLazy",(t,e)=>{Yn.init(t,e),Ds(t._zod,"innerType",()=>e.getter()),Ds(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),Ds(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),Ds(t._zod,"optin",()=>t._zod.innerType._zod.optin),Ds(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),_ze=we("$ZodCustom",(t,e)=>{Ql.init(t,e),Yn.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=>FTt(i,r,n,t));FTt(o,r,n,t)}})});function UTt(){return{localeError:ypn()}}var ypn,zTt=v(()=>{In();ypn=()=>{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 ${Nt(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: ${Be(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":""}: ${Be(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 HTt(){return{localeError:bpn()}}var bpn,VTt=v(()=>{In();bpn=()=>{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 ${Nt(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${Be(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":""}: ${Be(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 JTt(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 KTt(){return{localeError:_pn()}}var _pn,WTt=v(()=>{In();_pn=()=>{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 ${Nt(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 ${Be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);if(a){let s=Number(o.maximum),u=JTt(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=JTt(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"}: ${Be(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 GTt(){return{localeError:vpn()}}var vpn,ZTt=v(()=>{In();vpn=()=>{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 ${Nt(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${Be(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":""}: ${Be(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 XTt(){return{localeError:wpn()}}var wpn,YTt=v(()=>{In();wpn=()=>{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 ${Nt(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${Be(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: ${Be(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 QTt(){return{localeError:Spn()}}var Spn,eEt=v(()=>{In();Spn=()=>{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 ${Nt(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${Be(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"}: ${Be(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 vme(){return{localeError:xpn()}}var Cpn,xpn,vze=v(()=>{In();Cpn=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},xpn=()=>{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 ${Cpn(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${Nt(n.values[0])}`:`Invalid option: expected one of ${Be(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":""}: ${Be(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 tEt(){return{localeError:Tpn()}}var Opn,Tpn,rEt=v(()=>{In();Opn=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},Tpn=()=>{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 ${Opn(n.input)}`;case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${Nt(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${Be(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":""}: ${Be(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 nEt(){return{localeError:Epn()}}var Epn,oEt=v(()=>{In();Epn=()=>{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 ${Nt(o.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${Be(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":""}: ${Be(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 iEt(){return{localeError:Ppn()}}var Ppn,aEt=v(()=>{In();Ppn=()=>{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 ${Nt(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 ${Be(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: ${Be(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 sEt(){return{localeError:Mpn()}}var Mpn,uEt=v(()=>{In();Mpn=()=>{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 ${Nt(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${Be(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"}: ${Be(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 lEt(){return{localeError:Rpn()}}var Rpn,cEt=v(()=>{In();Rpn=()=>{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 : ${Nt(o.values[0])} attendu`:`Option invalide : une valeur parmi ${Be(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":""} : ${Be(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 dEt(){return{localeError:Apn()}}var Apn,fEt=v(()=>{In();Apn=()=>{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 ${Nt(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${Be(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":""} : ${Be(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 pEt(){return{localeError:Ipn()}}var Ipn,mEt=v(()=>{In();Ipn=()=>{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 ${Nt(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 ${Be(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"}: ${Be(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 hEt(){return{localeError:Npn()}}var Npn,gEt=v(()=>{In();Npn=()=>{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 ${Nt(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${Be(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":""}: ${Be(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 yEt(){return{localeError:jpn()}}var jpn,bEt=v(()=>{In();jpn=()=>{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 ${Nt(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${Be(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":""}: ${Be(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 _Et(){return{localeError:Dpn()}}var Dpn,vEt=v(()=>{In();Dpn=()=>{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 ${Nt(o.values[0])}`:`Opzione non valida: atteso uno tra ${Be(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"}: ${Be(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 wEt(){return{localeError:$pn()}}var $pn,SEt=v(()=>{In();$pn=()=>{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: ${Nt(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${Be(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":""}: ${Be(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 CEt(){return{localeError:Lpn()}}var Lpn,xEt=v(()=>{In();Lpn=()=>{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 ${Nt(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 ${Be(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 ${Be(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 OEt(){return{localeError:Fpn()}}var Fpn,TEt=v(()=>{In();Fpn=()=>{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 ${Nt(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${Be(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: ${Be(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 EEt(){return{localeError:kpn()}}var kpn,PEt=v(()=>{In();kpn=()=>{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 ${Nt(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 ${Be(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"}: ${Be(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 MEt(){return{localeError:qpn()}}var qpn,REt=v(()=>{In();qpn=()=>{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 ${Nt(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${Be(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: ${Be(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 AEt(){return{localeError:Bpn()}}var Bpn,IEt=v(()=>{In();Bpn=()=>{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 ${Nt(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${Be(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":""}: ${Be(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 NEt(){return{localeError:Upn()}}var Upn,jEt=v(()=>{In();Upn=()=>{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 ${Nt(o.values[0])}`:`Ugyldig valg: forventet en av ${Be(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"}: ${Be(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 DEt(){return{localeError:zpn()}}var zpn,$Et=v(()=>{In();zpn=()=>{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 ${Nt(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${Be(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":""}: ${Be(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 LEt(){return{localeError:Hpn()}}var Hpn,FEt=v(()=>{In();Hpn=()=>{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 ${Nt(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${Be(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"}: ${Be(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 kEt(){return{localeError:Vpn()}}var Vpn,qEt=v(()=>{In();Vpn=()=>{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 ${Nt(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${Be(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":""}: ${Be(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 BEt(){return{localeError:Jpn()}}var Jpn,UEt=v(()=>{In();Jpn=()=>{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 ${Nt(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${Be(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":""}: ${Be(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 zEt(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 HEt(){return{localeError:Kpn()}}var Kpn,VEt=v(()=>{In();Kpn=()=>{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 ${Nt(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 ${Be(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);if(a){let s=Number(o.maximum),u=zEt(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=zEt(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":""}: ${Be(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 JEt(){return{localeError:Wpn()}}var Wpn,KEt=v(()=>{In();Wpn=()=>{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 ${Nt(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${Be(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"}: ${Be(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 WEt(){return{localeError:Gpn()}}var Gpn,GEt=v(()=>{In();Gpn=()=>{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 ${Nt(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${Be(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"}: ${Be(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 ZEt(){return{localeError:Zpn()}}var Zpn,XEt=v(()=>{In();Zpn=()=>{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 ${Nt(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 ${Be(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":""}: ${Be(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 YEt(){return{localeError:Xpn()}}var Xpn,QEt=v(()=>{In();Xpn=()=>{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 ${Nt(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 ${Be(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: ${Be(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 ePt(){return{localeError:Qpn()}}var Ypn,Qpn,tPt=v(()=>{In();Ypn=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},Qpn=()=>{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 ${Ypn(n.input)}`;case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${Nt(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${Be(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":""}: ${Be(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 rPt(){return{localeError:emn()}}var emn,nPt=v(()=>{In();emn=()=>{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 ${Nt(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 ${Be(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":""}: ${Be(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 oPt(){return{localeError:tmn()}}var tmn,iPt=v(()=>{In();tmn=()=>{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: ${Nt(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${Be(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":""}: ${Be(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 aPt(){return{localeError:rmn()}}var rmn,sPt=v(()=>{In();rmn=()=>{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 ${Nt(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 ${Be(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: ${Be(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 uPt(){return{localeError:nmn()}}var nmn,lPt=v(()=>{In();nmn=()=>{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 ${Nt(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${Be(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): ${Be(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 cPt(){return{localeError:omn()}}var omn,dPt=v(()=>{In();omn=()=>{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 ${Nt(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${Be(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${Be(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={};Xn(dQ,{ar:()=>UTt,az:()=>HTt,be:()=>KTt,ca:()=>GTt,cs:()=>XTt,de:()=>QTt,en:()=>vme,eo:()=>tEt,es:()=>nEt,fa:()=>iEt,fi:()=>sEt,fr:()=>lEt,frCA:()=>dEt,he:()=>pEt,hu:()=>hEt,id:()=>yEt,it:()=>_Et,ja:()=>wEt,kh:()=>CEt,ko:()=>OEt,mk:()=>EEt,ms:()=>MEt,nl:()=>AEt,no:()=>NEt,ota:()=>DEt,pl:()=>kEt,ps:()=>LEt,pt:()=>BEt,ru:()=>HEt,sl:()=>JEt,sv:()=>WEt,ta:()=>ZEt,th:()=>YEt,tr:()=>ePt,ua:()=>rPt,ur:()=>oPt,vi:()=>aPt,zhCN:()=>uPt,zhTW:()=>cPt});var wze=v(()=>{zTt();VTt();WTt();ZTt();YTt();eEt();vze();rEt();oEt();aEt();uEt();cEt();fEt();mEt();gEt();bEt();vEt();SEt();xEt();TEt();PEt();REt();IEt();jEt();$Et();FEt();qEt();UEt();VEt();KEt();GEt();XEt();QEt();tPt();nPt();iPt();sPt();lPt();dPt()});function wme(){return new c6}var Sze,Cze,c6,Ol,xze=v(()=>{Sze=Symbol("ZodOutput"),Cze=Symbol("ZodInput"),c6=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)}};Ol=wme()});function Oze(t,e){return new t({type:"string",...dt(e)})}function Tze(t,e){return new t({type:"string",coerce:!0,...dt(e)})}function Sme(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...dt(e)})}function fQ(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...dt(e)})}function Cme(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...dt(e)})}function xme(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...dt(e)})}function Ome(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...dt(e)})}function Tme(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...dt(e)})}function Eme(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...dt(e)})}function Pme(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...dt(e)})}function Mme(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...dt(e)})}function Rme(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...dt(e)})}function Ame(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...dt(e)})}function Ime(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...dt(e)})}function Nme(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...dt(e)})}function jme(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...dt(e)})}function Dme(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...dt(e)})}function $me(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...dt(e)})}function Lme(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...dt(e)})}function Fme(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...dt(e)})}function kme(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...dt(e)})}function qme(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...dt(e)})}function Bme(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...dt(e)})}function Ume(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...dt(e)})}function Pze(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...dt(e)})}function Mze(t,e){return new t({type:"string",format:"date",check:"string_format",...dt(e)})}function Rze(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...dt(e)})}function Aze(t,e){return new t({type:"string",format:"duration",check:"string_format",...dt(e)})}function Ize(t,e){return new t({type:"number",checks:[],...dt(e)})}function Nze(t,e){return new t({type:"number",coerce:!0,checks:[],...dt(e)})}function jze(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...dt(e)})}function Dze(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...dt(e)})}function $ze(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...dt(e)})}function Lze(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...dt(e)})}function Fze(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...dt(e)})}function kze(t,e){return new t({type:"boolean",...dt(e)})}function qze(t,e){return new t({type:"boolean",coerce:!0,...dt(e)})}function Bze(t,e){return new t({type:"bigint",...dt(e)})}function Uze(t,e){return new t({type:"bigint",coerce:!0,...dt(e)})}function zze(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...dt(e)})}function Hze(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...dt(e)})}function Vze(t,e){return new t({type:"symbol",...dt(e)})}function Jze(t,e){return new t({type:"undefined",...dt(e)})}function Kze(t,e){return new t({type:"null",...dt(e)})}function Wze(t){return new t({type:"any"})}function nL(t){return new t({type:"unknown"})}function pQ(t,e){return new t({type:"never",...dt(e)})}function Gze(t,e){return new t({type:"void",...dt(e)})}function Zze(t,e){return new t({type:"date",...dt(e)})}function Xze(t,e){return new t({type:"date",coerce:!0,...dt(e)})}function Yze(t,e){return new t({type:"nan",...dt(e)})}function pN(t,e){return new fme({check:"less_than",...dt(e),value:t,inclusive:!1})}function kw(t,e){return new fme({check:"less_than",...dt(e),value:t,inclusive:!0})}function mN(t,e){return new pme({check:"greater_than",...dt(e),value:t,inclusive:!1})}function e_(t,e){return new pme({check:"greater_than",...dt(e),value:t,inclusive:!0})}function Qze(t){return mN(0,t)}function e4e(t){return pN(0,t)}function t4e(t){return kw(0,t)}function r4e(t){return e_(0,t)}function pz(t,e){return new YBe({check:"multiple_of",...dt(e),value:t})}function d6(t,e){return new tUe({check:"max_size",...dt(e),maximum:t})}function mz(t,e){return new rUe({check:"min_size",...dt(e),minimum:t})}function mQ(t,e){return new nUe({check:"size_equals",...dt(e),size:t})}function f6(t,e){return new oUe({check:"max_length",...dt(e),maximum:t})}function oL(t,e){return new iUe({check:"min_length",...dt(e),minimum:t})}function p6(t,e){return new aUe({check:"length_equals",...dt(e),length:t})}function hQ(t,e){return new sUe({check:"string_format",format:"regex",...dt(e),pattern:t})}function gQ(t){return new uUe({check:"string_format",format:"lowercase",...dt(t)})}function yQ(t){return new lUe({check:"string_format",format:"uppercase",...dt(t)})}function bQ(t,e){return new cUe({check:"string_format",format:"includes",...dt(e),includes:t})}function _Q(t,e){return new dUe({check:"string_format",format:"starts_with",...dt(e),prefix:t})}function vQ(t,e){return new fUe({check:"string_format",format:"ends_with",...dt(e),suffix:t})}function n4e(t,e,r){return new pUe({check:"property",property:t,schema:e,...dt(r)})}function wQ(t,e){return new mUe({check:"mime_type",mime:t,...dt(e)})}function hN(t){return new hUe({check:"overwrite",tx:t})}function SQ(t){return hN(e=>e.normalize(t))}function CQ(){return hN(t=>t.trim())}function xQ(){return hN(t=>t.toLowerCase())}function OQ(){return hN(t=>t.toUpperCase())}function TQ(t,e,r){return new t({type:"array",element:e,...dt(r)})}function imn(t,e,r){return new t({type:"union",options:e,...dt(r)})}function amn(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...dt(n)})}function smn(t,e,r){return new t({type:"intersection",left:e,right:r})}function o4e(t,e,r,n){let o=r instanceof Yn,i=o?n:r,a=o?r:null;return new t({type:"tuple",items:e,rest:a,...dt(i)})}function umn(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...dt(n)})}function lmn(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...dt(n)})}function cmn(t,e,r){return new t({type:"set",valueType:e,...dt(r)})}function dmn(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new t({type:"enum",entries:n,...dt(r)})}function fmn(t,e,r){return new t({type:"enum",entries:e,...dt(r)})}function pmn(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...dt(r)})}function i4e(t,e){return new t({type:"file",...dt(e)})}function mmn(t,e){return new t({type:"transform",transform:e})}function hmn(t,e){return new t({type:"optional",innerType:e})}function gmn(t,e){return new t({type:"nullable",innerType:e})}function ymn(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():r}})}function bmn(t,e,r){return new t({type:"nonoptional",innerType:e,...dt(r)})}function _mn(t,e){return new t({type:"success",innerType:e})}function vmn(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function wmn(t,e,r){return new t({type:"pipe",in:e,out:r})}function Smn(t,e){return new t({type:"readonly",innerType:e})}function Cmn(t,e,r){return new t({type:"template_literal",parts:e,...dt(r)})}function xmn(t,e){return new t({type:"lazy",getter:e})}function Omn(t,e){return new t({type:"promise",innerType:e})}function a4e(t,e,r){let n=dt(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function s4e(t,e,r){return new t({type:"custom",check:"custom",fn:e,...dt(r)})}function u4e(t,e){let r=dt(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??lQ,u=t.Boolean??iQ,l=t.String??dz,c=t.Transform??uQ,d=new c({type:"transform",transform:(m,h)=>{let g=m;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:a.has(g)?!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 l4e(t,e,r,n={}){let o=dt(n),i={...dt(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 Eze,c4e=v(()=>{mme();cQ();In();Eze={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function d4e(t){return new zme({type:"function",input:Array.isArray(t?.input)?o4e(fz,t?.input):t?.input??TQ(sQ,nL(rL)),output:t?.output??nL(rL)})}var zme,fPt=v(()=>{c4e();lme();cQ();cQ();zme=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?pO(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?pO(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 uz(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?uz(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 fz({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 iL(t,e){if(t instanceof c6){let n=new EQ(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 EQ(e);return r.process(t),r.emit(t,e)}function bm(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 bm(o.element,r);case"object":{for(let i in o.shape)if(bm(o.shape[i],r))return!0;return!1}case"union":{for(let i of o.options)if(bm(i,r))return!0;return!1}case"intersection":return bm(o.left,r)||bm(o.right,r);case"tuple":{for(let i of o.items)if(bm(i,r))return!0;return!!(o.rest&&bm(o.rest,r))}case"record":return bm(o.keyType,r)||bm(o.valueType,r);case"map":return bm(o.keyType,r)||bm(o.valueType,r);case"set":return bm(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return bm(o.innerType,r);case"lazy":return bm(o.getter(),r);case"default":return bm(o.innerType,r);case"prefault":return bm(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return bm(o.in,r)||bm(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var EQ,pPt=v(()=>{xze();In();EQ=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ol,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:g,format:y,patterns:b,contentEncoding:_}=e._zod.bag;if(typeof h=="number"&&(m.minLength=h),typeof g=="number"&&(m.maxLength=g),y&&(m.format=i[y]??y,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(x=>({...this.target==="draft-7"?{type:"string"}:{},pattern:x.source}))])}break}case"number":{let m=p,{minimum:h,maximum:g,format:y,multipleOf:b,exclusiveMaximum:_,exclusiveMinimum:w}=e._zod.bag;typeof y=="string"&&y.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 g=="number"&&(m.maximum=g,typeof _=="number"&&(_<=g?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:g}=e._zod.bag;typeof h=="number"&&(m.minItems=h),typeof g=="number"&&(m.maxItems=g),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 g=new Set(Object.keys(h)),y=new Set([...g].filter(b=>{let _=o.shape[b]._zod;return this.io==="input"?_.optin===void 0:_.optout===void 0}));y.size>0&&(m.required=Array.from(y)),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,g)=>this.process(h,{...d,path:[...d.path,"anyOf",g]}));break}case"intersection":{let m=p,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),g=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),y=_=>"allOf"in _&&Object.keys(_).length===1,b=[...y(h)?h.allOf:[h],...y(g)?g.allOf:[g]];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:g,maximum:y}=e._zod.bag;typeof g=="number"&&(m.minItems=g),typeof y=="number"&&(m.maxItems=y);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=GY(o.entries);h.every(g=>typeof g=="number")&&(m.type="number"),h.every(g=>typeof g=="string")&&(m.type="string"),m.enum=h;break}case"literal":{let m=p,h=[];for(let g of o.values)if(g===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(g))}else h.push(g);if(h.length!==0)if(h.length===1){let g=h[0];m.type=g===null?"null":typeof g,m.const=g}else h.every(g=>typeof g=="number")&&(m.type="number"),h.every(g=>typeof g=="string")&&(m.type="string"),h.every(g=>typeof g=="boolean")&&(m.type="string"),h.every(g=>g===null)&&(m.type="null"),m.enum=h;break}case"file":{let m=p,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:y,mime:b}=e._zod.bag;g!==void 0&&(h.minLength=g),y!==void 0&&(h.maxLength=y),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"&&bm(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,g=n.external.uri??(b=>b);if(h)return{ref:g(h)};let y=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=y,{defId:y,ref:`${g("__shared")}#/${d}/${y}`}}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 g=this.seen.get(h).schema;g.$ref&&d.target==="draft-7"?(p.allOf=p.allOf??[],p.allOf.push(g)):(Object.assign(p,g),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 mPt={};var hPt=v(()=>{});var gN={};Xn(gN,{$ZodAny:()=>ZUe,$ZodArray:()=>sQ,$ZodAsyncError:()=>fO,$ZodBase64:()=>qUe,$ZodBase64URL:()=>BUe,$ZodBigInt:()=>bme,$ZodBigIntFormat:()=>JUe,$ZodBoolean:()=>iQ,$ZodCIDRv4:()=>LUe,$ZodCIDRv6:()=>FUe,$ZodCUID:()=>TUe,$ZodCUID2:()=>EUe,$ZodCatch:()=>pze,$ZodCheck:()=>Ql,$ZodCheckBigIntFormat:()=>eUe,$ZodCheckEndsWith:()=>fUe,$ZodCheckGreaterThan:()=>pme,$ZodCheckIncludes:()=>cUe,$ZodCheckLengthEquals:()=>aUe,$ZodCheckLessThan:()=>fme,$ZodCheckLowerCase:()=>uUe,$ZodCheckMaxLength:()=>oUe,$ZodCheckMaxSize:()=>tUe,$ZodCheckMimeType:()=>mUe,$ZodCheckMinLength:()=>iUe,$ZodCheckMinSize:()=>rUe,$ZodCheckMultipleOf:()=>YBe,$ZodCheckNumberFormat:()=>QBe,$ZodCheckOverwrite:()=>hUe,$ZodCheckProperty:()=>pUe,$ZodCheckRegex:()=>sUe,$ZodCheckSizeEquals:()=>nUe,$ZodCheckStartsWith:()=>dUe,$ZodCheckStringFormat:()=>u6,$ZodCheckUpperCase:()=>lUe,$ZodCustom:()=>_ze,$ZodCustomStringFormat:()=>HUe,$ZodDate:()=>YUe,$ZodDefault:()=>lze,$ZodDiscriminatedUnion:()=>eze,$ZodE164:()=>UUe,$ZodEmail:()=>SUe,$ZodEmoji:()=>xUe,$ZodEnum:()=>ize,$ZodError:()=>tQ,$ZodFile:()=>sze,$ZodFunction:()=>zme,$ZodGUID:()=>vUe,$ZodIPv4:()=>DUe,$ZodIPv6:()=>$Ue,$ZodISODate:()=>IUe,$ZodISODateTime:()=>AUe,$ZodISODuration:()=>jUe,$ZodISOTime:()=>NUe,$ZodIntersection:()=>tze,$ZodJWT:()=>zUe,$ZodKSUID:()=>RUe,$ZodLazy:()=>bze,$ZodLiteral:()=>aze,$ZodMap:()=>nze,$ZodNaN:()=>mze,$ZodNanoID:()=>OUe,$ZodNever:()=>aQ,$ZodNonOptional:()=>dze,$ZodNull:()=>GUe,$ZodNullable:()=>uze,$ZodNumber:()=>yme,$ZodNumberFormat:()=>VUe,$ZodObject:()=>QUe,$ZodOptional:()=>l6,$ZodPipe:()=>lQ,$ZodPrefault:()=>cze,$ZodPromise:()=>yze,$ZodReadonly:()=>hze,$ZodRealError:()=>s6,$ZodRecord:()=>rze,$ZodRegistry:()=>c6,$ZodSet:()=>oze,$ZodString:()=>dz,$ZodStringFormat:()=>Cu,$ZodSuccess:()=>fze,$ZodSymbol:()=>KUe,$ZodTemplateLiteral:()=>gze,$ZodTransform:()=>uQ,$ZodTuple:()=>fz,$ZodType:()=>Yn,$ZodULID:()=>PUe,$ZodURL:()=>CUe,$ZodUUID:()=>wUe,$ZodUndefined:()=>WUe,$ZodUnion:()=>_me,$ZodUnknown:()=>rL,$ZodVoid:()=>XUe,$ZodXID:()=>MUe,$brand:()=>aBe,$constructor:()=>we,$input:()=>Cze,$output:()=>Sze,Doc:()=>oQ,JSONSchema:()=>mPt,JSONSchemaGenerator:()=>EQ,NEVER:()=>iBe,TimePrecision:()=>Eze,_any:()=>Wze,_array:()=>TQ,_base64:()=>kme,_base64url:()=>qme,_bigint:()=>Bze,_boolean:()=>kze,_catch:()=>vmn,_cidrv4:()=>Lme,_cidrv6:()=>Fme,_coercedBigint:()=>Uze,_coercedBoolean:()=>qze,_coercedDate:()=>Xze,_coercedNumber:()=>Nze,_coercedString:()=>Tze,_cuid:()=>Rme,_cuid2:()=>Ame,_custom:()=>a4e,_date:()=>Zze,_default:()=>ymn,_discriminatedUnion:()=>amn,_e164:()=>Bme,_email:()=>Sme,_emoji:()=>Pme,_endsWith:()=>vQ,_enum:()=>dmn,_file:()=>i4e,_float32:()=>Dze,_float64:()=>$ze,_gt:()=>mN,_gte:()=>e_,_guid:()=>fQ,_includes:()=>bQ,_int:()=>jze,_int32:()=>Lze,_int64:()=>zze,_intersection:()=>smn,_ipv4:()=>Dme,_ipv6:()=>$me,_isoDate:()=>Mze,_isoDateTime:()=>Pze,_isoDuration:()=>Aze,_isoTime:()=>Rze,_jwt:()=>Ume,_ksuid:()=>jme,_lazy:()=>xmn,_length:()=>p6,_literal:()=>pmn,_lowercase:()=>gQ,_lt:()=>pN,_lte:()=>kw,_map:()=>lmn,_max:()=>kw,_maxLength:()=>f6,_maxSize:()=>d6,_mime:()=>wQ,_min:()=>e_,_minLength:()=>oL,_minSize:()=>mz,_multipleOf:()=>pz,_nan:()=>Yze,_nanoid:()=>Mme,_nativeEnum:()=>fmn,_negative:()=>e4e,_never:()=>pQ,_nonnegative:()=>r4e,_nonoptional:()=>bmn,_nonpositive:()=>t4e,_normalize:()=>SQ,_null:()=>Kze,_nullable:()=>gmn,_number:()=>Ize,_optional:()=>hmn,_overwrite:()=>hN,_parse:()=>ime,_parseAsync:()=>ame,_pipe:()=>wmn,_positive:()=>Qze,_promise:()=>Omn,_property:()=>n4e,_readonly:()=>Smn,_record:()=>umn,_refine:()=>s4e,_regex:()=>hQ,_safeParse:()=>sme,_safeParseAsync:()=>ume,_set:()=>cmn,_size:()=>mQ,_startsWith:()=>_Q,_string:()=>Oze,_stringFormat:()=>l4e,_stringbool:()=>u4e,_success:()=>_mn,_symbol:()=>Vze,_templateLiteral:()=>Cmn,_toLowerCase:()=>xQ,_toUpperCase:()=>OQ,_transform:()=>mmn,_trim:()=>CQ,_tuple:()=>o4e,_uint32:()=>Fze,_uint64:()=>Hze,_ulid:()=>Ime,_undefined:()=>Jze,_union:()=>imn,_unknown:()=>nL,_uppercase:()=>yQ,_url:()=>Eme,_uuid:()=>Cme,_uuidv4:()=>xme,_uuidv6:()=>Ome,_uuidv7:()=>Tme,_void:()=>Gze,_xid:()=>Nme,clone:()=>Kc,config:()=>fd,flattenError:()=>rQ,formatError:()=>nQ,function:()=>d4e,globalConfig:()=>KY,globalRegistry:()=>Ol,isValidBase64:()=>kUe,isValidBase64URL:()=>kTt,isValidJWT:()=>qTt,locales:()=>dQ,parse:()=>pO,parseAsync:()=>uz,prettifyError:()=>_Be,regexes:()=>cz,registry:()=>wme,safeParse:()=>wBe,safeParseAsync:()=>SBe,toDotPath:()=>wTt,toJSONSchema:()=>iL,treeifyError:()=>bBe,util:()=>xt,version:()=>yUe});var Zg=v(()=>{o6();lme();vBe();cQ();mme();bUe();In();dme();wze();xze();gUe();fPt();c4e();pPt();hPt()});function il(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 ec(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 gPt(t){return il(t)&&console.warn("[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior."),ec(t)}function Ga(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!!(il(t)||ec(t))}function f4e(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 p4e(t){return il(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 yPt(t){return!!(f4e(t)||p4e(t))}async function sL(t,e){if(il(t))try{return{success:!0,data:await uz(t,e)}}catch(r){return{success:!1,error:r}}if(ec(t))return await t.safeParseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}async function uL(t,e){if(il(t))return await uz(t,e);if(ec(t))return await t.parseAsync(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function bPt(t,e){if(il(t))try{return{success:!0,data:pO(t,e)}}catch(r){return{success:!1,error:r}}if(ec(t))return t.safeParse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function _Pt(t,e){if(il(t))return pO(t,e);if(ec(t))return t.parse(e);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function lL(t){if(il(t))return Ol.get(t)?.description;if(ec(t)||"description"in t&&typeof t.description=="string")return t.description}function vPt(t){if(!Ga(t))return!1;if(ec(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(il(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 h6(t){return Ga(t)?ec(t)?t._def.typeName==="ZodString":il(t)?t._zod.def.type==="string":!1:!1}function Jme(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 il(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 PQ(t){return il(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 wPt(t){return!!(Jme(t)||qw(t))}function Hme(t){if(ec(t))return t.shape;if(il(t))return t._zod.def.shape;throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function SPt(t,e){if(ec(t))return t.extend(e);if(il(t))return xt.extend(t,e);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function CPt(t){if(ec(t))return t.partial();if(il(t))return xt.partial(l6,t,void 0);throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function m6(t,e=!1){if(ec(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=m6(a,e);r[i]=u}else if(PQ(a)){let u=a._zod.def.element;qw(u)&&(u=m6(u,e)),r[i]=Kc(a,{...a._zod.def,element:u})}else r[i]=a;let s=Ol.get(a);s&&Ol.add(r[i],s)}let n=Kc(t,{...t._zod.def,shape:r,catchall:pQ(aQ)}),o=Ol.get(t);return o&&Ol.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function Vme(t,e=!1){if(Jme(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=Vme(a,e);r[i]=u}else if(PQ(a)){let u=a._zod.def.element;qw(u)&&(u=Vme(u,e)),r[i]=Kc(a,{...a._zod.def,element:u})}else r[i]=a;let s=Ol.get(a);s&&Ol.add(r[i],s)}let n=Kc(t,{...t._zod.def,shape:r,catchall:nL(rL)}),o=Ol.get(t);return o&&Ol.add(n,o),n}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function xPt(t){if(ec(t))try{let e=t.parse(void 0);return()=>e}catch{return}if(il(t))try{let e=pO(t,void 0);return()=>e}catch{return}}function Tmn(t){return ec(t)&&"typeName"in t._def&&t._def.typeName==="ZodEffects"}function Emn(t){return il(t)&&t._zod.def.type==="pipe"}function aL(t,e=!1){if(ec(t))return Tmn(t)?aL(t._def.schema,e):t;if(il(t)){let r=t;if(Emn(t)&&(r=aL(t._zod.def.in,e)),e){if(qw(r)){let o=r._zod.def.shape;for(let[i,a]of Object.entries(r._zod.def.shape))o[i]=aL(a,e);r=Kc(r,{...r._zod.def,shape:o})}else if(PQ(r)){let o=aL(r._zod.def.element,e);r=Kc(r,{...r._zod.def,element:o})}}let n=Ol.get(t);return n&&Ol.add(r,n),r}throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function OPt(t,e){if(ec(t)){let r=Hme(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(il(t)){let r=Hme(t),n={...t._zod.def.shape};for(let[a,s]of Object.entries(r))e(a,s)&&(n[a]=new l6({type:"optional",innerType:s}));let o=Kc(t,{...t._zod.def,shape:n}),i=Ol.get(t);return i&&Ol.add(o,i),o}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}var yN=v(()=>{Zg()});function m4e(t){return t.replace(/[^a-zA-Z-_0-9]/g,"_")}function Mmn(t){let e="";for(let[r,n]of Object.entries(t))e+=` classDef ${r} ${n};
|
||
`;return e}function TPt(t,e,r){let{firstNode:n,lastNode:o,nodeColors:i,withStyles:a=!0,curveStyle:s="linear",wrapLabelNWords:u=9}=r??{},l=a?`%%{init: {'flowchart': {'curve': '${s}'}}}%%
|
||
graph TD;
|
||
`:`graph TD;
|
||
`;if(a){let p="default",m={[p]:"{0}({1})"};n!==void 0&&(m[n]="{0}([{1}]):::first"),o!==void 0&&(m[o]="{0}([{1}]):::last");for(let[h,g]of Object.entries(t)){let y=g.name.split(":").pop()??"",_=Pmn.some(x=>y.startsWith(x)&&y.endsWith(x))?`<p>${y}</p>`:y;Object.keys(g.metadata??{}).length&&(_+=`<hr/><small><em>${Object.entries(g.metadata??{}).map(([x,O])=>`${x} = ${O}`).join(`
|
||
`)}</em></small>`);let w=(m[h]??m[p]).replace("{0}",m4e(h)).replace("{1}",_);l+=` ${w}
|
||
`}}let c={};for(let p of e){let m=p.source.split(":"),h=p.target.split(":"),g=m.filter((y,b)=>y===h[b]).join(":");c[g]||(c[g]=[]),c[g].push(p)}let d=new Set;function f(p,m){let h=p.length===1&&p[0].source===p[0].target;if(m&&!h){let g=m.split(":").pop();if(d.has(g))throw new Error(`Found duplicate subgraph '${g}' -- 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(g),l+=` subgraph ${g}
|
||
`}for(let g of p){let{source:y,target:b,data:_,conditional:w}=g,x="";if(_!==void 0){let O=_,E=O.split(" ");E.length>u&&(O=Array.from({length:Math.ceil(E.length/u)},(T,R)=>E.slice(R*u,(R+1)*u).join(" ")).join(" <br> ")),x=w?` -. ${O} .-> `:` -- ${O} --> `}else x=w?" -.-> ":" --> ";l+=` ${m4e(y)}${x}${m4e(b)};
|
||
`}for(let g in c)g.startsWith(`${m}:`)&&g!==m&&f(c[g],g);m&&!h&&(l+=` end
|
||
`)}f(c[""]??[],"");for(let p in c)!p.includes(":")&&p!==""&&f(c[p],p);return a&&(l+=Mmn(i??{})),l}async function EPt(t,e){let r=e?.backgroundColor??"white",n=e?.imageType??"png",o=btoa(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 Pmn,PPt=v(()=>{Pmn=["*","_","`"]});var RPt,MPt,APt,Kme=v(()=>{RPt=Symbol("Let zodToJsonSchema decide on which parser to use"),MPt={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"},APt=t=>typeof t=="string"?{...MPt,name:t}:{...MPt,...t}});var IPt,h4e=v(()=>{Kme();IPt=t=>{let e=APt(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 Wme,Gme=v(()=>{Wme=(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 Tl(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Wme(e,t.currentPath):e.join("/")}}var Bw=v(()=>{Gme()});function g4e(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Di(t,e,r,n,o){t[e]=r,g4e(t,e,n,o)}var cL=v(()=>{});var vi,y4e,nr,mO,MQ=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})(vi||(vi={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(y4e||(y4e={}));nr=vi.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mO=t=>{switch(typeof t){case"undefined":return nr.undefined;case"string":return nr.string;case"number":return Number.isNaN(t)?nr.nan:nr.number;case"boolean":return nr.boolean;case"function":return nr.function;case"bigint":return nr.bigint;case"symbol":return nr.symbol;case"object":return Array.isArray(t)?nr.array:t===null?nr.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?nr.promise:typeof Map<"u"&&t instanceof Map?nr.map:typeof Set<"u"&&t instanceof Set?nr.set:typeof Date<"u"&&t instanceof Date?nr.date:nr.object;default:return nr.unknown}}});var Xe,Rmn,t_,Zme=v(()=>{MQ();Xe=vi.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"]),Rmn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),t_=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,vi.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()}};t_.create=t=>new t_(t)});var Amn,bN,b4e=v(()=>{Zme();MQ();Amn=(t,e)=>{let r;switch(t.code){case Xe.invalid_type:t.received===nr.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Xe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,vi.jsonStringifyReplacer)}`;break;case Xe.unrecognized_keys:r=`Unrecognized key(s) in object: ${vi.joinValues(t.keys,", ")}`;break;case Xe.invalid_union:r="Invalid input";break;case Xe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${vi.joinValues(t.options)}`;break;case Xe.invalid_enum_value:r=`Invalid enum value. Expected ${vi.joinValues(t.options)}, received '${t.received}'`;break;case Xe.invalid_arguments:r="Invalid function arguments";break;case Xe.invalid_return_type:r="Invalid function return type";break;case Xe.invalid_date:r="Invalid date";break;case Xe.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}"`:vi.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Xe.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 Xe.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 Xe.custom:r="Invalid input";break;case Xe.invalid_intersection_types:r="Intersection results could not be merged";break;case Xe.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Xe.not_finite:r="Number must be finite";break;default:r=e.defaultError,vi.assertNever(t)}return{message:r}},bN=Amn});function Imn(t){NPt=t}function g6(){return NPt}var NPt,Xme=v(()=>{b4e();NPt=bN});function Bt(t,e){let r=g6(),n=RQ({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===bN?void 0:bN].filter(o=>!!o)});t.common.issues.push(n)}var RQ,Nmn,Wh,yn,hz,Xg,Yme,Qme,dL,y6,_4e=v(()=>{Xme();b4e();RQ=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}},Nmn=[];Wh=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 yn;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 yn;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}}},yn=Object.freeze({status:"aborted"}),hz=t=>({status:"dirty",value:t}),Xg=t=>({status:"valid",value:t}),Yme=t=>t.status==="aborted",Qme=t=>t.status==="dirty",dL=t=>t.status==="valid",y6=t=>typeof Promise<"u"&&t instanceof Promise});var jPt=v(()=>{});var Rr,DPt=v(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Rr||(Rr={}))});function $o(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 kPt(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 Zmn(t){return new RegExp(`^${kPt(t)}$`)}function qPt(t){let e=`${FPt}T${kPt(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 Xmn(t,e){return!!((e==="v4"||!e)&&zmn.test(t)||(e==="v6"||!e)&&Vmn.test(t))}function Ymn(t,e){if(!kmn.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 Qmn(t,e){return!!((e==="v4"||!e)&&Hmn.test(t)||(e==="v6"||!e)&&Jmn.test(t))}function ehn(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 b6(t){if(t instanceof r_){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Uw.create(b6(n))}return new r_({...t._def,shape:()=>e})}else return t instanceof wN?new wN({...t._def,type:b6(t.element)}):t instanceof Uw?Uw.create(b6(t.unwrap())):t instanceof gO?gO.create(b6(t.unwrap())):t instanceof hO?hO.create(t.items.map(e=>b6(e))):t}function w4e(t,e){let r=mO(t),n=mO(e);if(t===e)return{valid:!0,data:t};if(r===nr.object&&n===nr.object){let o=vi.objectKeys(e),i=vi.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=w4e(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===nr.array&&n===nr.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=w4e(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===nr.date&&n===nr.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function BPt(t,e){return new Tz({values:t,typeName:Ie.ZodEnum,...$o(e)})}function LPt(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function UPt(t,e={},r){return t?pL.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=LPt(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=LPt(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):pL.create()}var zw,$Pt,Qo,jmn,Dmn,$mn,Lmn,Fmn,kmn,qmn,Bmn,Umn,v4e,zmn,Hmn,Vmn,Jmn,Kmn,Wmn,FPt,Gmn,fL,gz,yz,bz,_z,_6,vz,wz,pL,vN,W0,v6,wN,r_,Sz,_N,ehe,Cz,hO,the,w6,S6,rhe,xz,Oz,Tz,Ez,mL,Hw,Uw,gO,Pz,Mz,C6,thn,AQ,IQ,Rz,rhn,Ie,nhn,zPt,HPt,ohn,ihn,VPt,ahn,shn,uhn,lhn,chn,dhn,fhn,phn,mhn,hhn,ghn,yhn,bhn,_hn,vhn,whn,Shn,Chn,xhn,Ohn,Thn,Ehn,Phn,Mhn,Rhn,Ahn,Ihn,Nhn,jhn,Dhn,$hn,Lhn,Fhn,khn,JPt=v(()=>{Zme();Xme();DPt();_4e();MQ();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}},$Pt=(t,e)=>{if(dL(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 t_(t.common.issues);return this._error=r,this._error}}};Qo=class{get description(){return this._def.description}_getType(e){return mO(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:mO(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Wh,ctx:{common:e.parent.common,data:e.data,parsedType:mO(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(y6(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:mO(e)},o=this._parseSync({data:e,path:n.path,parent:n});return $Pt(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mO(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return dL(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=>dL(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:mO(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(y6(o)?o:Promise.resolve(o));return $Pt(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:Xe.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 Hw({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 Uw.create(this,this._def)}nullable(){return gO.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wN.create(this)}promise(){return mL.create(this,this._def)}or(e){return Sz.create([this,e],this._def)}and(e){return Cz.create(this,e,this._def)}transform(e){return new Hw({...$o(this._def),schema:this,typeName:Ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Pz({...$o(this._def),innerType:this,defaultValue:r,typeName:Ie.ZodDefault})}brand(){return new AQ({typeName:Ie.ZodBranded,type:this,...$o(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Mz({...$o(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 IQ.create(this,e)}readonly(){return Rz.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},jmn=/^c[^\s-]{8,}$/i,Dmn=/^[0-9a-z]+$/,$mn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Lmn=/^[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,Fmn=/^[a-z0-9_-]{21}$/i,kmn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qmn=/^[-+]?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)?)??$/,Bmn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Umn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",zmn=/^(?:(?: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])$/,Hmn=/^(?:(?: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])$/,Vmn=/^(([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]))$/,Jmn=/^(([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])$/,Kmn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wmn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,FPt="((\\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])))",Gmn=new RegExp(`^${FPt}$`);fL=class t extends Qo{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==nr.string){let i=this._getOrReturnCtx(e);return Bt(i,{code:Xe.invalid_type,expected:nr.string,received:i.parsedType}),yn}let n=new Wh,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),Bt(o,{code:Xe.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),Bt(o,{code:Xe.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?Bt(o,{code:Xe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&Bt(o,{code:Xe.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Bmn.test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"email",code:Xe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")v4e||(v4e=new RegExp(Umn,"u")),v4e.test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"emoji",code:Xe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Lmn.test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"uuid",code:Xe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Fmn.test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"nanoid",code:Xe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")jmn.test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"cuid",code:Xe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Dmn.test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"cuid2",code:Xe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")$mn.test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"ulid",code:Xe.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),Bt(o,{validation:"url",code:Xe.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),Bt(o,{validation:"regex",code:Xe.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),Bt(o,{code:Xe.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),Bt(o,{code:Xe.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),Bt(o,{code:Xe.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?qPt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{code:Xe.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Gmn.test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{code:Xe.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Zmn(i).test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{code:Xe.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?qmn.test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"duration",code:Xe.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Xmn(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"ip",code:Xe.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Ymn(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"jwt",code:Xe.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Qmn(e.data,i.version)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"cidr",code:Xe.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Kmn.test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"base64",code:Xe.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Wmn.test(e.data)||(o=this._getOrReturnCtx(e,o),Bt(o,{validation:"base64url",code:Xe.invalid_string,message:i.message}),n.dirty()):vi.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:Xe.invalid_string,...Rr.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Rr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Rr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Rr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Rr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Rr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Rr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Rr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Rr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Rr.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Rr.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Rr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Rr.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Rr.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,...Rr.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,...Rr.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Rr.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Rr.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Rr.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Rr.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Rr.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Rr.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Rr.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Rr.errToObj(r)})}nonempty(e){return this.min(1,Rr.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}};fL.create=t=>new fL({checks:[],typeName:Ie.ZodString,coerce:t?.coerce??!1,...$o(t)});gz=class t extends Qo{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)!==nr.number){let i=this._getOrReturnCtx(e);return Bt(i,{code:Xe.invalid_type,expected:nr.number,received:i.parsedType}),yn}let n,o=new Wh;for(let i of this._def.checks)i.kind==="int"?vi.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Bt(n,{code:Xe.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),Bt(n,{code:Xe.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),Bt(n,{code:Xe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?ehn(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),Bt(n,{code:Xe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Bt(n,{code:Xe.not_finite,message:i.message}),o.dirty()):vi.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Rr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Rr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Rr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Rr.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Rr.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Rr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Rr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Rr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Rr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Rr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Rr.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Rr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Rr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Rr.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"&&vi.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)}};gz.create=t=>new gz({checks:[],typeName:Ie.ZodNumber,coerce:t?.coerce||!1,...$o(t)});yz=class t extends Qo{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)!==nr.bigint)return this._getInvalidInput(e);let n,o=new Wh;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),Bt(n,{code:Xe.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),Bt(n,{code:Xe.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),Bt(n,{code:Xe.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):vi.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Bt(r,{code:Xe.invalid_type,expected:nr.bigint,received:r.parsedType}),yn}gte(e,r){return this.setLimit("min",e,!0,Rr.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Rr.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Rr.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Rr.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Rr.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:Rr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Rr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Rr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Rr.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Rr.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}};yz.create=t=>new yz({checks:[],typeName:Ie.ZodBigInt,coerce:t?.coerce??!1,...$o(t)});bz=class extends Qo{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==nr.boolean){let n=this._getOrReturnCtx(e);return Bt(n,{code:Xe.invalid_type,expected:nr.boolean,received:n.parsedType}),yn}return Xg(e.data)}};bz.create=t=>new bz({typeName:Ie.ZodBoolean,coerce:t?.coerce||!1,...$o(t)});_z=class t extends Qo{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==nr.date){let i=this._getOrReturnCtx(e);return Bt(i,{code:Xe.invalid_type,expected:nr.date,received:i.parsedType}),yn}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return Bt(i,{code:Xe.invalid_date}),yn}let n=new Wh,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),Bt(o,{code:Xe.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),Bt(o,{code:Xe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):vi.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:Rr.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Rr.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}};_z.create=t=>new _z({checks:[],coerce:t?.coerce||!1,typeName:Ie.ZodDate,...$o(t)});_6=class extends Qo{_parse(e){if(this._getType(e)!==nr.symbol){let n=this._getOrReturnCtx(e);return Bt(n,{code:Xe.invalid_type,expected:nr.symbol,received:n.parsedType}),yn}return Xg(e.data)}};_6.create=t=>new _6({typeName:Ie.ZodSymbol,...$o(t)});vz=class extends Qo{_parse(e){if(this._getType(e)!==nr.undefined){let n=this._getOrReturnCtx(e);return Bt(n,{code:Xe.invalid_type,expected:nr.undefined,received:n.parsedType}),yn}return Xg(e.data)}};vz.create=t=>new vz({typeName:Ie.ZodUndefined,...$o(t)});wz=class extends Qo{_parse(e){if(this._getType(e)!==nr.null){let n=this._getOrReturnCtx(e);return Bt(n,{code:Xe.invalid_type,expected:nr.null,received:n.parsedType}),yn}return Xg(e.data)}};wz.create=t=>new wz({typeName:Ie.ZodNull,...$o(t)});pL=class extends Qo{constructor(){super(...arguments),this._any=!0}_parse(e){return Xg(e.data)}};pL.create=t=>new pL({typeName:Ie.ZodAny,...$o(t)});vN=class extends Qo{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Xg(e.data)}};vN.create=t=>new vN({typeName:Ie.ZodUnknown,...$o(t)});W0=class extends Qo{_parse(e){let r=this._getOrReturnCtx(e);return Bt(r,{code:Xe.invalid_type,expected:nr.never,received:r.parsedType}),yn}};W0.create=t=>new W0({typeName:Ie.ZodNever,...$o(t)});v6=class extends Qo{_parse(e){if(this._getType(e)!==nr.undefined){let n=this._getOrReturnCtx(e);return Bt(n,{code:Xe.invalid_type,expected:nr.void,received:n.parsedType}),yn}return Xg(e.data)}};v6.create=t=>new v6({typeName:Ie.ZodVoid,...$o(t)});wN=class t extends Qo{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==nr.array)return Bt(r,{code:Xe.invalid_type,expected:nr.array,received:r.parsedType}),yn;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(Bt(r,{code:a?Xe.too_big:Xe.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&&(Bt(r,{code:Xe.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&&(Bt(r,{code:Xe.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=>Wh.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new zw(r,a,r.path,s)));return Wh.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Rr.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Rr.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Rr.toString(r)}})}nonempty(e){return this.min(1,e)}};wN.create=(t,e)=>new wN({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ie.ZodArray,...$o(e)});r_=class t extends Qo{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=vi.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==nr.object){let l=this._getOrReturnCtx(e);return Bt(l,{code:Xe.invalid_type,expected:nr.object,received:l.parsedType}),yn}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof W0&&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 W0){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&&(Bt(o,{code:Xe.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=>Wh.mergeObjectSync(n,l)):Wh.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return Rr.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:Rr.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 vi.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 vi.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return b6(this)}partial(e){let r={};for(let n of vi.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 vi.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Uw;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return BPt(vi.objectKeys(this.shape))}};r_.create=(t,e)=>new r_({shape:()=>t,unknownKeys:"strip",catchall:W0.create(),typeName:Ie.ZodObject,...$o(e)});r_.strictCreate=(t,e)=>new r_({shape:()=>t,unknownKeys:"strict",catchall:W0.create(),typeName:Ie.ZodObject,...$o(e)});r_.lazycreate=(t,e)=>new r_({shape:t,unknownKeys:"strip",catchall:W0.create(),typeName:Ie.ZodObject,...$o(e)});Sz=class extends Qo{_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 t_(s.ctx.common.issues));return Bt(r,{code:Xe.invalid_union,unionErrors:a}),yn}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 t_(u));return Bt(r,{code:Xe.invalid_union,unionErrors:s}),yn}}get options(){return this._def.options}};Sz.create=(t,e)=>new Sz({options:t,typeName:Ie.ZodUnion,...$o(e)});_N=t=>t instanceof xz?_N(t.schema):t instanceof Hw?_N(t.innerType()):t instanceof Oz?[t.value]:t instanceof Tz?t.options:t instanceof Ez?vi.objectValues(t.enum):t instanceof Pz?_N(t._def.innerType):t instanceof vz?[void 0]:t instanceof wz?[null]:t instanceof Uw?[void 0,..._N(t.unwrap())]:t instanceof gO?[null,..._N(t.unwrap())]:t instanceof AQ||t instanceof Rz?_N(t.unwrap()):t instanceof Mz?_N(t._def.innerType):[],ehe=class t extends Qo{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nr.object)return Bt(r,{code:Xe.invalid_type,expected:nr.object,received:r.parsedType}),yn;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}):(Bt(r,{code:Xe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),yn)}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=_N(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,...$o(n)})}};Cz=class extends Qo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(Yme(i)||Yme(a))return yn;let s=w4e(i.value,a.value);return s.valid?((Qme(i)||Qme(a))&&r.dirty(),{status:r.value,value:s.data}):(Bt(n,{code:Xe.invalid_intersection_types}),yn)};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}))}};Cz.create=(t,e,r)=>new Cz({left:t,right:e,typeName:Ie.ZodIntersection,...$o(r)});hO=class t extends Qo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==nr.array)return Bt(n,{code:Xe.invalid_type,expected:nr.array,received:n.parsedType}),yn;if(n.data.length<this._def.items.length)return Bt(n,{code:Xe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),yn;!this._def.rest&&n.data.length>this._def.items.length&&(Bt(n,{code:Xe.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=>Wh.mergeArray(r,a)):Wh.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};hO.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new hO({items:t,typeName:Ie.ZodTuple,rest:null,...$o(e)})};the=class t extends Qo{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!==nr.object)return Bt(n,{code:Xe.invalid_type,expected:nr.object,received:n.parsedType}),yn;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?Wh.mergeObjectAsync(r,o):Wh.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Qo?new t({keyType:e,valueType:r,typeName:Ie.ZodRecord,...$o(n)}):new t({keyType:fL.create(),valueType:e,typeName:Ie.ZodRecord,...$o(r)})}},w6=class extends Qo{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!==nr.map)return Bt(n,{code:Xe.invalid_type,expected:nr.map,received:n.parsedType}),yn;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 yn;(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 yn;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};w6.create=(t,e,r)=>new w6({valueType:e,keyType:t,typeName:Ie.ZodMap,...$o(r)});S6=class t extends Qo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==nr.set)return Bt(n,{code:Xe.invalid_type,expected:nr.set,received:n.parsedType}),yn;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Bt(n,{code:Xe.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&&(Bt(n,{code:Xe.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 yn;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:Rr.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Rr.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};S6.create=(t,e)=>new S6({valueType:t,minSize:null,maxSize:null,typeName:Ie.ZodSet,...$o(e)});rhe=class t extends Qo{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nr.function)return Bt(r,{code:Xe.invalid_type,expected:nr.function,received:r.parsedType}),yn;function n(s,u){return RQ({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,g6(),bN].filter(l=>!!l),issueData:{code:Xe.invalid_arguments,argumentsError:u}})}function o(s,u){return RQ({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,g6(),bN].filter(l=>!!l),issueData:{code:Xe.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof mL){let s=this;return Xg(async function(...u){let l=new t_([]),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 Xg(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new t_([n(u,l.error)]);let c=Reflect.apply(a,this,l.data),d=s._def.returns.safeParse(c,i);if(!d.success)throw new t_([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:hO.create(e).rest(vN.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||hO.create([]).rest(vN.create()),returns:r||vN.create(),typeName:Ie.ZodFunction,...$o(n)})}},xz=class extends Qo{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})}};xz.create=(t,e)=>new xz({getter:t,typeName:Ie.ZodLazy,...$o(e)});Oz=class extends Qo{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Bt(r,{received:r.data,code:Xe.invalid_literal,expected:this._def.value}),yn}return{status:"valid",value:e.data}}get value(){return this._def.value}};Oz.create=(t,e)=>new Oz({value:t,typeName:Ie.ZodLiteral,...$o(e)});Tz=class t extends Qo{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Bt(r,{expected:vi.joinValues(n),received:r.parsedType,code:Xe.invalid_type}),yn}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 Bt(r,{received:r.data,code:Xe.invalid_enum_value,options:n}),yn}return Xg(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})}};Tz.create=BPt;Ez=class extends Qo{_parse(e){let r=vi.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==nr.string&&n.parsedType!==nr.number){let o=vi.objectValues(r);return Bt(n,{expected:vi.joinValues(o),received:n.parsedType,code:Xe.invalid_type}),yn}if(this._cache||(this._cache=new Set(vi.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=vi.objectValues(r);return Bt(n,{received:n.data,code:Xe.invalid_enum_value,options:o}),yn}return Xg(e.data)}get enum(){return this._def.values}};Ez.create=(t,e)=>new Ez({values:t,typeName:Ie.ZodNativeEnum,...$o(e)});mL=class extends Qo{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==nr.promise&&r.common.async===!1)return Bt(r,{code:Xe.invalid_type,expected:nr.promise,received:r.parsedType}),yn;let n=r.parsedType===nr.promise?r.data:Promise.resolve(r.data);return Xg(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};mL.create=(t,e)=>new mL({type:t,typeName:Ie.ZodPromise,...$o(e)});Hw=class extends Qo{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=>{Bt(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 yn;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?yn:u.status==="dirty"?hz(u.value):r.value==="dirty"?hz(u.value):u});{if(r.value==="aborted")return yn;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?yn:s.status==="dirty"?hz(s.value):r.value==="dirty"?hz(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"?yn:(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"?yn:(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(!dL(a))return yn;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=>dL(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):yn);vi.assertNever(o)}};Hw.create=(t,e,r)=>new Hw({schema:t,typeName:Ie.ZodEffects,effect:e,...$o(r)});Hw.createWithPreprocess=(t,e,r)=>new Hw({schema:e,effect:{type:"preprocess",transform:t},typeName:Ie.ZodEffects,...$o(r)});Uw=class extends Qo{_parse(e){return this._getType(e)===nr.undefined?Xg(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Uw.create=(t,e)=>new Uw({innerType:t,typeName:Ie.ZodOptional,...$o(e)});gO=class extends Qo{_parse(e){return this._getType(e)===nr.null?Xg(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gO.create=(t,e)=>new gO({innerType:t,typeName:Ie.ZodNullable,...$o(e)});Pz=class extends Qo{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===nr.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Pz.create=(t,e)=>new Pz({innerType:t,typeName:Ie.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...$o(e)});Mz=class extends Qo{_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 y6(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new t_(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new t_(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Mz.create=(t,e)=>new Mz({innerType:t,typeName:Ie.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...$o(e)});C6=class extends Qo{_parse(e){if(this._getType(e)!==nr.nan){let n=this._getOrReturnCtx(e);return Bt(n,{code:Xe.invalid_type,expected:nr.nan,received:n.parsedType}),yn}return{status:"valid",value:e.data}}};C6.create=t=>new C6({typeName:Ie.ZodNaN,...$o(t)});thn=Symbol("zod_brand"),AQ=class extends Qo{_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}},IQ=class t extends Qo{_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"?yn:i.status==="dirty"?(r.dirty(),hz(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"?yn: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})}},Rz=class extends Qo{_parse(e){let r=this._def.innerType._parse(e),n=o=>(dL(o)&&(o.value=Object.freeze(o.value)),o);return y6(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Rz.create=(t,e)=>new Rz({innerType:t,typeName:Ie.ZodReadonly,...$o(e)});rhn={object:r_.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={}));nhn=(t,e={message:`Input not instance of ${t.name}`})=>UPt(r=>r instanceof t,e),zPt=fL.create,HPt=gz.create,ohn=C6.create,ihn=yz.create,VPt=bz.create,ahn=_z.create,shn=_6.create,uhn=vz.create,lhn=wz.create,chn=pL.create,dhn=vN.create,fhn=W0.create,phn=v6.create,mhn=wN.create,hhn=r_.create,ghn=r_.strictCreate,yhn=Sz.create,bhn=ehe.create,_hn=Cz.create,vhn=hO.create,whn=the.create,Shn=w6.create,Chn=S6.create,xhn=rhe.create,Ohn=xz.create,Thn=Oz.create,Ehn=Tz.create,Phn=Ez.create,Mhn=mL.create,Rhn=Hw.create,Ahn=Uw.create,Ihn=gO.create,Nhn=Hw.createWithPreprocess,jhn=IQ.create,Dhn=()=>zPt().optional(),$hn=()=>HPt().optional(),Lhn=()=>VPt().optional(),Fhn={string:t=>fL.create({...t,coerce:!0}),number:t=>gz.create({...t,coerce:!0}),boolean:t=>bz.create({...t,coerce:!0}),bigint:t=>yz.create({...t,coerce:!0}),date:t=>_z.create({...t,coerce:!0})},khn=yn});var Ct={};Xn(Ct,{BRAND:()=>thn,DIRTY:()=>hz,EMPTY_PATH:()=>Nmn,INVALID:()=>yn,NEVER:()=>khn,OK:()=>Xg,ParseStatus:()=>Wh,Schema:()=>Qo,ZodAny:()=>pL,ZodArray:()=>wN,ZodBigInt:()=>yz,ZodBoolean:()=>bz,ZodBranded:()=>AQ,ZodCatch:()=>Mz,ZodDate:()=>_z,ZodDefault:()=>Pz,ZodDiscriminatedUnion:()=>ehe,ZodEffects:()=>Hw,ZodEnum:()=>Tz,ZodError:()=>t_,ZodFirstPartyTypeKind:()=>Ie,ZodFunction:()=>rhe,ZodIntersection:()=>Cz,ZodIssueCode:()=>Xe,ZodLazy:()=>xz,ZodLiteral:()=>Oz,ZodMap:()=>w6,ZodNaN:()=>C6,ZodNativeEnum:()=>Ez,ZodNever:()=>W0,ZodNull:()=>wz,ZodNullable:()=>gO,ZodNumber:()=>gz,ZodObject:()=>r_,ZodOptional:()=>Uw,ZodParsedType:()=>nr,ZodPipeline:()=>IQ,ZodPromise:()=>mL,ZodReadonly:()=>Rz,ZodRecord:()=>the,ZodSchema:()=>Qo,ZodSet:()=>S6,ZodString:()=>fL,ZodSymbol:()=>_6,ZodTransformer:()=>Hw,ZodTuple:()=>hO,ZodType:()=>Qo,ZodUndefined:()=>vz,ZodUnion:()=>Sz,ZodUnknown:()=>vN,ZodVoid:()=>v6,addIssueToContext:()=>Bt,any:()=>chn,array:()=>mhn,bigint:()=>ihn,boolean:()=>VPt,coerce:()=>Fhn,custom:()=>UPt,date:()=>ahn,datetimeRegex:()=>qPt,defaultErrorMap:()=>bN,discriminatedUnion:()=>bhn,effect:()=>Rhn,enum:()=>Ehn,function:()=>xhn,getErrorMap:()=>g6,getParsedType:()=>mO,instanceof:()=>nhn,intersection:()=>_hn,isAborted:()=>Yme,isAsync:()=>y6,isDirty:()=>Qme,isValid:()=>dL,late:()=>rhn,lazy:()=>Ohn,literal:()=>Thn,makeIssue:()=>RQ,map:()=>Shn,nan:()=>ohn,nativeEnum:()=>Phn,never:()=>fhn,null:()=>lhn,nullable:()=>Ihn,number:()=>HPt,object:()=>hhn,objectUtil:()=>y4e,oboolean:()=>Lhn,onumber:()=>$hn,optional:()=>Ahn,ostring:()=>Dhn,pipeline:()=>jhn,preprocess:()=>Nhn,promise:()=>Mhn,quotelessJson:()=>Rmn,record:()=>whn,set:()=>Chn,setErrorMap:()=>Imn,strictObject:()=>ghn,string:()=>zPt,symbol:()=>shn,transformer:()=>Rhn,tuple:()=>vhn,undefined:()=>uhn,union:()=>yhn,unknown:()=>dhn,util:()=>vi,void:()=>phn});var NQ=v(()=>{Xme();_4e();jPt();MQ();JPt();Zme()});var yO=v(()=>{NQ();NQ()});function KPt(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==Ie.ZodAny&&(r.items=xn(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Di(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Di(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Di(r,"minItems",t.exactLength.value,t.exactLength.message,e),Di(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var S4e=v(()=>{cL();pd();yO()});function WPt(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?Di(r,"minimum",n.value,n.message,e):Di(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Di(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Di(r,"maximum",n.value,n.message,e):Di(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Di(r,"maximum",n.value,n.message,e));break;case"multipleOf":Di(r,"multipleOf",n.value,n.message,e);break}return r}var C4e=v(()=>{cL()});function GPt(){return{type:"boolean"}}var x4e=v(()=>{});function nhe(t,e){return xn(t.type._def,e)}var ohe=v(()=>{pd()});var ZPt,O4e=v(()=>{pd();ZPt=(t,e)=>xn(t.innerType._def,e)});function T4e(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(o=>T4e(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 qhn(t,e)}}var qhn,E4e=v(()=>{cL();qhn=(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":Di(r,"minimum",n.value,n.message,e);break;case"max":Di(r,"maximum",n.value,n.message,e);break}return r}});function XPt(t,e){return{...xn(t.innerType._def,e),default:t.defaultValue()}}var P4e=v(()=>{pd()});function YPt(t,e){return e.effectStrategy==="input"?xn(t.schema._def,e):Tl(e)}var M4e=v(()=>{Bw();pd()});function QPt(t){return{type:"string",enum:Array.from(t.values)}}var R4e=v(()=>{});function eMt(t,e){let r=[xn(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),xn(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(Bhn(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 Bhn,A4e=v(()=>{pd();Bhn=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function tMt(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 I4e=v(()=>{});function ihe(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":Di(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":Di(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":Z0(r,"email",n.message,e);break;case"format:idn-email":Z0(r,"idn-email",n.message,e);break;case"pattern:zod":rb(r,G0.email,n.message,e);break}break;case"url":Z0(r,"uri",n.message,e);break;case"uuid":Z0(r,"uuid",n.message,e);break;case"regex":rb(r,n.regex,n.message,e);break;case"cuid":rb(r,G0.cuid,n.message,e);break;case"cuid2":rb(r,G0.cuid2,n.message,e);break;case"startsWith":rb(r,RegExp(`^${j4e(n.value,e)}`),n.message,e);break;case"endsWith":rb(r,RegExp(`${j4e(n.value,e)}$`),n.message,e);break;case"datetime":Z0(r,"date-time",n.message,e);break;case"date":Z0(r,"date",n.message,e);break;case"time":Z0(r,"time",n.message,e);break;case"duration":Z0(r,"duration",n.message,e);break;case"length":Di(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),Di(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":rb(r,RegExp(j4e(n.value,e)),n.message,e);break;case"ip":n.version!=="v6"&&Z0(r,"ipv4",n.message,e),n.version!=="v4"&&Z0(r,"ipv6",n.message,e);break;case"base64url":rb(r,G0.base64url,n.message,e);break;case"jwt":rb(r,G0.jwt,n.message,e);break;case"cidr":n.version!=="v6"&&rb(r,G0.ipv4Cidr,n.message,e),n.version!=="v4"&&rb(r,G0.ipv6Cidr,n.message,e);break;case"emoji":rb(r,G0.emoji(),n.message,e);break;case"ulid":rb(r,G0.ulid,n.message,e);break;case"base64":switch(e.base64Strategy){case"format:binary":Z0(r,"binary",n.message,e);break;case"contentEncoding:base64":Di(r,"contentEncoding","base64",n.message,e);break;case"pattern:zod":rb(r,G0.base64,n.message,e);break}break;case"nanoid":rb(r,G0.nanoid,n.message,e);break;case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function j4e(t,e){return e.patternStrategy==="escape"?zhn(t):t}function zhn(t){let e="";for(let r=0;r<t.length;r++)Uhn.has(t[r])||(e+="\\"),e+=t[r];return e}function Z0(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}}})):Di(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:rMt(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Di(t,"pattern",rMt(e,n),r,n)}function rMt(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 N4e,G0,Uhn,ahe=v(()=>{cL();G0={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:()=>(N4e===void 0&&(N4e=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),N4e),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-_]*$/};Uhn=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function she(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]:xn(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??Tl(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:xn(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}=ihe(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}=nhe(t.keyType._def,e);return{...r,propertyNames:o}}}return r}var uhe=v(()=>{Bw();ohe();ahe();pd();yO()});function nMt(t,e){if(e.mapStrategy==="record")return she(t,e);let r=xn(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Tl(e),n=xn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Tl(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}var D4e=v(()=>{Bw();uhe();pd()});function oMt(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 $4e=v(()=>{});function iMt(t){return t.target==="openAi"?void 0:{not:Tl({...t,currentPath:[...t.currentPath,"not"]})}}var L4e=v(()=>{Bw()});function aMt(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var F4e=v(()=>{});function uMt(t,e){if(e.target==="openApi3")return sMt(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in jQ&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=jQ[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 sMt(t,e)}var jQ,sMt,lhe=v(()=>{pd();jQ={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};sMt=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>xn(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 lMt(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:jQ[t.innerType._def.typeName],nullable:!0}:{type:[jQ[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=xn(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=xn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var k4e=v(()=>{lhe();pd()});function cMt(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",g4e(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Di(r,"minimum",n.value,n.message,e):Di(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Di(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Di(r,"maximum",n.value,n.message,e):Di(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Di(r,"maximum",n.value,n.message,e));break;case"multipleOf":Di(r,"multipleOf",n.value,n.message,e);break}return r}var q4e=v(()=>{cL()});function dMt(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=Vhn(u);l&&r&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),l=!1);let c=xn(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=Hhn(t,e);return a!==void 0&&(n.additionalProperties=a),n}function Hhn(t,e){if(t.catchall._def.typeName!=="ZodNever")return xn(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 Vhn(t){try{return t.isOptional()}catch{return!0}}var B4e=v(()=>{pd()});var fMt,U4e=v(()=>{Bw();pd();fMt=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return xn(t.innerType._def,e);let r=xn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Tl(e)},r]}:Tl(e)}});var pMt,z4e=v(()=>{pd();pMt=(t,e)=>{if(e.pipeStrategy==="input")return xn(t.in._def,e);if(e.pipeStrategy==="output")return xn(t.out._def,e);let r=xn(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=xn(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function mMt(t,e){return xn(t.type._def,e)}var H4e=v(()=>{pd()});function hMt(t,e){let n={type:"array",uniqueItems:!0,items:xn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Di(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Di(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var V4e=v(()=>{cL();pd()});function gMt(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>xn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:xn(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>xn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var J4e=v(()=>{pd()});function yMt(t){return{not:Tl(t)}}var K4e=v(()=>{Bw()});function bMt(t){return Tl(t)}var W4e=v(()=>{Bw()});var _Mt,G4e=v(()=>{pd();_Mt=(t,e)=>xn(t.innerType._def,e)});var vMt,Z4e=v(()=>{Bw();S4e();C4e();x4e();ohe();O4e();E4e();P4e();M4e();R4e();A4e();I4e();ahe();uhe();D4e();$4e();L4e();F4e();lhe();k4e();q4e();B4e();U4e();z4e();H4e();V4e();J4e();K4e();W4e();G4e();yO();vMt=(t,e,r)=>{switch(e){case Ie.ZodString:return ihe(t,r);case Ie.ZodNumber:return cMt(t,r);case Ie.ZodObject:return dMt(t,r);case Ie.ZodBigInt:return WPt(t,r);case Ie.ZodBoolean:return GPt();case Ie.ZodDate:return T4e(t,r);case Ie.ZodUndefined:return yMt(r);case Ie.ZodNull:return aMt(r);case Ie.ZodArray:return KPt(t,r);case Ie.ZodUnion:case Ie.ZodDiscriminatedUnion:return uMt(t,r);case Ie.ZodIntersection:return eMt(t,r);case Ie.ZodTuple:return gMt(t,r);case Ie.ZodRecord:return she(t,r);case Ie.ZodLiteral:return tMt(t,r);case Ie.ZodEnum:return QPt(t);case Ie.ZodNativeEnum:return oMt(t);case Ie.ZodNullable:return lMt(t,r);case Ie.ZodOptional:return fMt(t,r);case Ie.ZodMap:return nMt(t,r);case Ie.ZodSet:return hMt(t,r);case Ie.ZodLazy:return()=>t.getter()._def;case Ie.ZodPromise:return mMt(t,r);case Ie.ZodNaN:case Ie.ZodNever:return iMt(r);case Ie.ZodEffects:return YPt(t,r);case Ie.ZodAny:return Tl(r);case Ie.ZodUnknown:return bMt(r);case Ie.ZodDefault:return XPt(t,r);case Ie.ZodBranded:return nhe(t,r);case Ie.ZodReadonly:return _Mt(t,r);case Ie.ZodCatch:return ZPt(t,r);case Ie.ZodPipeline:return pMt(t,r);case Ie.ZodFunction:case Ie.ZodVoid:case Ie.ZodSymbol:return;default:return(n=>{})(e)}}});function xn(t,e,r=!1){let n=e.seen.get(t);if(e.override){let s=e.override?.(t,e,n,r);if(s!==RPt)return s}if(n&&!r){let s=Jhn(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=vMt(t,t.typeName,e),a=typeof i=="function"?xn(i(),e):i;if(a&&Khn(t,e,a),e.postProcess){let s=e.postProcess(a,t,e);return o.jsonSchema=a,s}return o.jsonSchema=a,a}var Jhn,Khn,pd=v(()=>{Kme();Gme();Bw();Z4e();Jhn=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Wme(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`),Tl(e)):e.$refStrategy==="seen"?Tl(e):void 0}},Khn=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var wMt,X4e=v(()=>{h4e();Bw();pd();wMt=(t,e)=>{let r=IPt(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:xn(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??Tl(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,i=xn(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??Tl(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 SMt=v(()=>{Kme();h4e();cL();Gme();Bw();S4e();C4e();x4e();ohe();O4e();E4e();P4e();M4e();R4e();A4e();I4e();ahe();uhe();D4e();$4e();L4e();F4e();lhe();k4e();q4e();B4e();U4e();z4e();H4e();V4e();J4e();K4e();W4e();G4e();Z4e();pd();X4e()});function bO(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(!bO(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(!bO(t[a],e[a]))return!1;return!0}return t===e}var Y4e=v(()=>{});function Sv(t){return encodeURI(Whn(t))}function Whn(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}var che=v(()=>{});function X0(t,e=Object.create(null),r=Yhn,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:X0(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(Xhn[i])continue;let a=`${n}/${Sv(i)}`,s=t[i];if(Array.isArray(s)){if(Ghn[i]){let u=s.length;for(let l=0;l<u;l++)X0(s[l],e,r,`${a}/${l}`)}}else if(Zhn[i])for(let u in s)X0(s[u],e,r,`${a}/${Sv(u)}`);else X0(s,e,r,a)}return e}var Ghn,Zhn,Xhn,Yhn,dhe=v(()=>{che();Ghn={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Zhn={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Xhn={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},Yhn=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 n_(t){return t.test.bind(t)}function _gn(t){return t%4===0&&(t%100!==0||t%400===0)}function CMt(t){let e=t.match(Qhn);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n==2&&_gn(r)?29:egn[n])}function xMt(t,e){let r=e.match(tgn);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 wgn(t){let e=t.split(vgn);return e.length==2&&CMt(e[0])&&xMt(!0,e[1])}function xgn(t){return Sgn.test(t)&&Cgn.test(t)}function Tgn(t){if(Ogn.test(t))return!1;try{return new RegExp(t,"u"),!0}catch{return!1}}var Qhn,egn,tgn,rgn,ngn,ogn,ign,agn,sgn,ugn,lgn,cgn,dgn,fgn,pgn,mgn,hgn,ggn,ygn,bgn,Q4e,vgn,Sgn,Cgn,Ogn,e2e=v(()=>{Qhn=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,egn=[0,31,28,31,30,31,30,31,31,30,31,30,31],tgn=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,rgn=/^(?=.{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,ngn=/^(?:[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,ogn=/^(?:(?:[^\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,ign=/^(?:(?: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,agn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,sgn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ugn=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,lgn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,cgn=/^\d\d\d\d-[0-1]\d-[0-3]\d$/,dgn=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,fgn=/^\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,pgn=/^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,mgn=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))},hgn=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ggn=/^((([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,ygn=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));bgn={date:CMt,time:xMt.bind(void 0,!1),"date-time":wgn,duration:ygn,uri:xgn,"uri-reference":n_(ngn),"uri-template":n_(ogn),url:n_(ign),email:mgn,hostname:n_(rgn),ipv4:n_(hgn),ipv6:n_(ggn),regex:Tgn,uuid:n_(agn),"json-pointer":n_(sgn),"json-pointer-uri-fragment":n_(ugn),"relative-json-pointer":n_(lgn)},Q4e={...bgn,date:n_(cgn),time:n_(dgn),"date-time":n_(fgn),"uri-reference":n_(pgn)};vgn=/t|\s/i;Sgn=/\/|:/,Cgn=/^(?:[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;Ogn=/[^\\]\\Z/});var OMt,TMt=v(()=>{(function(t){t[t.Flag=1]="Flag",t[t.Basic=2]="Basic",t[t.Detailed=4]="Detailed"})(OMt||(OMt={}))});function EMt(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 t2e=v(()=>{});function Fu(t,e,r="2019-09",n=X0(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:g,required:y,not:b,anyOf:_,allOf:w,oneOf:x,if:O,then:E,else:T,format:R,properties:N,patternProperties:D,additionalProperties:F,unevaluatedProperties:B,minProperties:U,maxProperties:H,propertyNames:G,dependentRequired:ie,dependentSchemas:oe,dependencies:z,prefixItems:Q,items:re,additionalItems:Z,unevaluatedItems:$,contains:q,minContains:Y,maxContains:j,minItems:A,maxItems:W,uniqueItems:V,minimum:se,maximum:be,exclusiveMinimum:Ee,exclusiveMaximum:Ae,multipleOf:ht,minLength:Rt,maxLength:Ze,pattern:Dr,__absolute_ref__:Vt,__absolute_recursive_ref__:jt}=e,Fe=[];if(p===!0&&i===null&&(i=e),f==="#"){let gt=i===null?n[jt]:i,qe=`${s}/$recursiveRef`,Te=Fu(t,i===null?e:i,r,n,o,gt,a,qe,u);Te.valid||Fe.push({instanceLocation:a,keyword:"$recursiveRef",keywordLocation:qe,error:"A subschema had errors."},...Te.errors)}if(d!==void 0){let qe=n[Vt||d];if(qe===void 0){let De=`Unresolved $ref "${d}".`;throw Vt&&Vt!==d&&(De+=` Absolute URI "${Vt}".`),De+=`
|
||
Known schemas:
|
||
- ${Object.keys(n).join(`
|
||
- `)}`,new Error(De)}let Te=`${s}/$ref`,Ce=Fu(t,qe,r,n,o,i,a,Te,u);if(Ce.valid||Fe.push({instanceLocation:a,keyword:"$ref",keywordLocation:Te,error:"A subschema had errors."},...Ce.errors),r==="4"||r==="7")return{valid:Fe.length===0,errors:Fe}}if(Array.isArray(m)){let gt=m.length,qe=!1;for(let Te=0;Te<gt;Te++)if(c===m[Te]||m[Te]==="integer"&&c==="number"&&t%1===0&&t===t){qe=!0;break}qe||Fe.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)&&Fe.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`}):m!==void 0&&c!==m&&Fe.push({instanceLocation:a,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${m}".`});if(h!==void 0&&(c==="object"||c==="array"?bO(t,h)||Fe.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):t!==h&&Fe.push({instanceLocation:a,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),g!==void 0&&(c==="object"||c==="array"?g.some(gt=>bO(t,gt))||Fe.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(gt=>t===gt)||Fe.push({instanceLocation:a,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`})),b!==void 0){let gt=`${s}/not`;Fu(t,b,r,n,o,i,a,gt).valid&&Fe.push({instanceLocation:a,keyword:"not",keywordLocation:gt,error:'Instance matched "not" schema.'})}let hn=[];if(_!==void 0){let gt=`${s}/anyOf`,qe=Fe.length,Te=!1;for(let Ce=0;Ce<_.length;Ce++){let De=_[Ce],Re=Object.create(u),nt=Fu(t,De,r,n,o,p===!0?i:null,a,`${gt}/${Ce}`,Re);Fe.push(...nt.errors),Te=Te||nt.valid,nt.valid&&hn.push(Re)}Te?Fe.length=qe:Fe.splice(qe,0,{instanceLocation:a,keyword:"anyOf",keywordLocation:gt,error:"Instance does not match any subschemas."})}if(w!==void 0){let gt=`${s}/allOf`,qe=Fe.length,Te=!0;for(let Ce=0;Ce<w.length;Ce++){let De=w[Ce],Re=Object.create(u),nt=Fu(t,De,r,n,o,p===!0?i:null,a,`${gt}/${Ce}`,Re);Fe.push(...nt.errors),Te=Te&&nt.valid,nt.valid&&hn.push(Re)}Te?Fe.length=qe:Fe.splice(qe,0,{instanceLocation:a,keyword:"allOf",keywordLocation:gt,error:"Instance does not match every subschema."})}if(x!==void 0){let gt=`${s}/oneOf`,qe=Fe.length,Te=x.filter((Ce,De)=>{let Re=Object.create(u),nt=Fu(t,Ce,r,n,o,p===!0?i:null,a,`${gt}/${De}`,Re);return Fe.push(...nt.errors),nt.valid&&hn.push(Re),nt.valid}).length;Te===1?Fe.length=qe:Fe.splice(qe,0,{instanceLocation:a,keyword:"oneOf",keywordLocation:gt,error:`Instance does not match exactly one subschema (${Te} matches).`})}if((c==="object"||c==="array")&&Object.assign(u,...hn),O!==void 0){let gt=`${s}/if`;if(Fu(t,O,r,n,o,i,a,gt,u).valid){if(E!==void 0){let Te=Fu(t,E,r,n,o,i,a,`${s}/then`,u);Te.valid||Fe.push({instanceLocation:a,keyword:"if",keywordLocation:gt,error:'Instance does not match "then" schema.'},...Te.errors)}}else if(T!==void 0){let Te=Fu(t,T,r,n,o,i,a,`${s}/else`,u);Te.valid||Fe.push({instanceLocation:a,keyword:"if",keywordLocation:gt,error:'Instance does not match "else" schema.'},...Te.errors)}}if(c==="object"){if(y!==void 0)for(let Ce of y)Ce in t||Fe.push({instanceLocation:a,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${Ce}".`});let gt=Object.keys(t);if(U!==void 0&>.length<U&&Fe.push({instanceLocation:a,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${U} properties.`}),H!==void 0&>.length>H&&Fe.push({instanceLocation:a,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${H} properties.`}),G!==void 0){let Ce=`${s}/propertyNames`;for(let De in t){let Re=`${a}/${Sv(De)}`,nt=Fu(De,G,r,n,o,i,Re,Ce);nt.valid||Fe.push({instanceLocation:a,keyword:"propertyNames",keywordLocation:Ce,error:`Property name "${De}" does not match schema.`},...nt.errors)}}if(ie!==void 0){let Ce=`${s}/dependantRequired`;for(let De in ie)if(De in t){let Re=ie[De];for(let nt of Re)nt in t||Fe.push({instanceLocation:a,keyword:"dependentRequired",keywordLocation:Ce,error:`Instance has "${De}" but does not have "${nt}".`})}}if(oe!==void 0)for(let Ce in oe){let De=`${s}/dependentSchemas`;if(Ce in t){let Re=Fu(t,oe[Ce],r,n,o,i,a,`${De}/${Sv(Ce)}`,u);Re.valid||Fe.push({instanceLocation:a,keyword:"dependentSchemas",keywordLocation:De,error:`Instance has "${Ce}" but does not match dependant schema.`},...Re.errors)}}if(z!==void 0){let Ce=`${s}/dependencies`;for(let De in z)if(De in t){let Re=z[De];if(Array.isArray(Re))for(let nt of Re)nt in t||Fe.push({instanceLocation:a,keyword:"dependencies",keywordLocation:Ce,error:`Instance has "${De}" but does not have "${nt}".`});else{let nt=Fu(t,Re,r,n,o,i,a,`${Ce}/${Sv(De)}`);nt.valid||Fe.push({instanceLocation:a,keyword:"dependencies",keywordLocation:Ce,error:`Instance has "${De}" but does not match dependant schema.`},...nt.errors)}}}let qe=Object.create(null),Te=!1;if(N!==void 0){let Ce=`${s}/properties`;for(let De in N){if(!(De in t))continue;let Re=`${a}/${Sv(De)}`,nt=Fu(t[De],N[De],r,n,o,i,Re,`${Ce}/${Sv(De)}`);if(nt.valid)u[De]=qe[De]=!0;else if(Te=o,Fe.push({instanceLocation:a,keyword:"properties",keywordLocation:Ce,error:`Property "${De}" does not match schema.`},...nt.errors),Te)break}}if(!Te&&D!==void 0){let Ce=`${s}/patternProperties`;for(let De in D){let Re=new RegExp(De,"u"),nt=D[De];for(let _n in t){if(!Re.test(_n))continue;let He=`${a}/${Sv(_n)}`,wt=Fu(t[_n],nt,r,n,o,i,He,`${Ce}/${Sv(De)}`);wt.valid?u[_n]=qe[_n]=!0:(Te=o,Fe.push({instanceLocation:a,keyword:"patternProperties",keywordLocation:Ce,error:`Property "${_n}" matches pattern "${De}" but does not match associated schema.`},...wt.errors))}}}if(!Te&&F!==void 0){let Ce=`${s}/additionalProperties`;for(let De in t){if(qe[De])continue;let Re=`${a}/${Sv(De)}`,nt=Fu(t[De],F,r,n,o,i,Re,Ce);nt.valid?u[De]=!0:(Te=o,Fe.push({instanceLocation:a,keyword:"additionalProperties",keywordLocation:Ce,error:`Property "${De}" does not match additional properties schema.`},...nt.errors))}}else if(!Te&&B!==void 0){let Ce=`${s}/unevaluatedProperties`;for(let De in t)if(!u[De]){let Re=`${a}/${Sv(De)}`,nt=Fu(t[De],B,r,n,o,i,Re,Ce);nt.valid?u[De]=!0:Fe.push({instanceLocation:a,keyword:"unevaluatedProperties",keywordLocation:Ce,error:`Property "${De}" does not match unevaluated properties schema.`},...nt.errors)}}}else if(c==="array"){W!==void 0&&t.length>W&&Fe.push({instanceLocation:a,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${t.length} > ${W}).`}),A!==void 0&&t.length<A&&Fe.push({instanceLocation:a,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${t.length} < ${A}).`});let gt=t.length,qe=0,Te=!1;if(Q!==void 0){let Ce=`${s}/prefixItems`,De=Math.min(Q.length,gt);for(;qe<De;qe++){let Re=Fu(t[qe],Q[qe],r,n,o,i,`${a}/${qe}`,`${Ce}/${qe}`);if(u[qe]=!0,!Re.valid&&(Te=o,Fe.push({instanceLocation:a,keyword:"prefixItems",keywordLocation:Ce,error:"Items did not match schema."},...Re.errors),Te))break}}if(re!==void 0){let Ce=`${s}/items`;if(Array.isArray(re)){let De=Math.min(re.length,gt);for(;qe<De;qe++){let Re=Fu(t[qe],re[qe],r,n,o,i,`${a}/${qe}`,`${Ce}/${qe}`);if(u[qe]=!0,!Re.valid&&(Te=o,Fe.push({instanceLocation:a,keyword:"items",keywordLocation:Ce,error:"Items did not match schema."},...Re.errors),Te))break}}else for(;qe<gt;qe++){let De=Fu(t[qe],re,r,n,o,i,`${a}/${qe}`,Ce);if(u[qe]=!0,!De.valid&&(Te=o,Fe.push({instanceLocation:a,keyword:"items",keywordLocation:Ce,error:"Items did not match schema."},...De.errors),Te))break}if(!Te&&Z!==void 0){let De=`${s}/additionalItems`;for(;qe<gt;qe++){let Re=Fu(t[qe],Z,r,n,o,i,`${a}/${qe}`,De);u[qe]=!0,Re.valid||(Te=o,Fe.push({instanceLocation:a,keyword:"additionalItems",keywordLocation:De,error:"Items did not match additional items schema."},...Re.errors))}}}if(q!==void 0)if(gt===0&&Y===void 0)Fe.push({instanceLocation:a,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(Y!==void 0&><Y)Fe.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${gt}) than minContains (${Y}).`});else{let Ce=`${s}/contains`,De=Fe.length,Re=0;for(let nt=0;nt<gt;nt++){let _n=Fu(t[nt],q,r,n,o,i,`${a}/${nt}`,Ce);_n.valid?(u[nt]=!0,Re++):Fe.push(..._n.errors)}Re>=(Y||0)&&(Fe.length=De),Y===void 0&&j===void 0&&Re===0?Fe.splice(De,0,{instanceLocation:a,keyword:"contains",keywordLocation:Ce,error:"Array does not contain item matching schema."}):Y!==void 0&&Re<Y?Fe.push({instanceLocation:a,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${Y} items matching schema. Only ${Re} items were found.`}):j!==void 0&&Re>j&&Fe.push({instanceLocation:a,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${j} items matching schema. ${Re} items were found.`})}if(!Te&&$!==void 0){let Ce=`${s}/unevaluatedItems`;for(qe;qe<gt;qe++){if(u[qe])continue;let De=Fu(t[qe],$,r,n,o,i,`${a}/${qe}`,Ce);u[qe]=!0,De.valid||Fe.push({instanceLocation:a,keyword:"unevaluatedItems",keywordLocation:Ce,error:"Items did not match unevaluated items schema."},...De.errors)}}if(V)for(let Ce=0;Ce<gt;Ce++){let De=t[Ce],Re=typeof De=="object"&&De!==null;for(let nt=0;nt<gt;nt++){if(Ce===nt)continue;let _n=t[nt];(De===_n||Re&&(typeof _n=="object"&&_n!==null)&&bO(De,_n))&&(Fe.push({instanceLocation:a,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${Ce} and ${nt}.`}),Ce=Number.MAX_SAFE_INTEGER,nt=Number.MAX_SAFE_INTEGER)}}}else if(c==="number"){if(r==="4"?(se!==void 0&&(Ee===!0&&t<=se||t<se)&&Fe.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${Ee?"or equal to ":""} ${se}.`}),be!==void 0&&(Ae===!0&&t>=be||t>be)&&Fe.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${Ae?"or equal to ":""} ${be}.`})):(se!==void 0&&t<se&&Fe.push({instanceLocation:a,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${t} is less than ${se}.`}),be!==void 0&&t>be&&Fe.push({instanceLocation:a,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${t} is greater than ${be}.`}),Ee!==void 0&&t<=Ee&&Fe.push({instanceLocation:a,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${t} is less than ${Ee}.`}),Ae!==void 0&&t>=Ae&&Fe.push({instanceLocation:a,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${t} is greater than or equal to ${Ae}.`})),ht!==void 0){let gt=t%ht;Math.abs(0-gt)>=11920929e-14&&Math.abs(ht-gt)>=11920929e-14&&Fe.push({instanceLocation:a,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${t} is not a multiple of ${ht}.`})}}else if(c==="string"){let gt=Rt===void 0&&Ze===void 0?0:EMt(t);Rt!==void 0&><Rt&&Fe.push({instanceLocation:a,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${gt} < ${Rt}).`}),Ze!==void 0&>>Ze&&Fe.push({instanceLocation:a,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${gt} > ${Ze}).`}),Dr!==void 0&&!new RegExp(Dr,"u").test(t)&&Fe.push({instanceLocation:a,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),R!==void 0&&Q4e[R]&&!Q4e[R](t)&&Fe.push({instanceLocation:a,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${R}".`})}return{valid:Fe.length===0,errors:Fe}}var r2e=v(()=>{Y4e();dhe();e2e();che();t2e()});var fhe,PMt=v(()=>{dhe();r2e();fhe=class{constructor(e,r="2019-09",n=!0){M(this,"schema");M(this,"draft");M(this,"shortCircuit");M(this,"lookup");this.schema=e,this.draft=r,this.shortCircuit=n,this.lookup=X0(e)}validate(e){return Fu(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,r){r&&(e={...e,$id:r}),X0(e,this.lookup)}}});var phe=v(()=>{Y4e();dhe();e2e();che();TMt();t2e();r2e();PMt()});function Vi(t){if(il(t)){let e=aL(t,!0);if(qw(e)){let r=m6(e,!0);return iL(r)}else return iL(t)}return ec(t)?wMt(t):t}function x6(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=>x6(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=>x6(r))}if("not"in t)return!1;if("$ref"in t&&typeof t.$ref=="string"){let e=t.$ref,r=X0(t);return r[e]?x6(r[e]):!1}return!1}var Egn,o_=v(()=>{Do();yN();X4e();SMt();Zg();phe();Egn={};Et(Egn,{Validator:()=>fhe,deepCompareStrict:()=>bO,toJsonSchema:()=>Vi,validatesOnlyStrings:()=>x6})});function Mgn(t,e){if(t!==void 0&&!Y3(t))return t;if(JY(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 Rgn(t){return JY(t.data)?{type:"runnable",data:{id:t.data.lc_id,name:t.data.getName()}}:{type:"schema",data:{...Vi(t.data.schema),title:t.data.name}}}function MMt(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 RMt(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 Pgn,mhe,IMt=v(()=>{Do();oBe();PPt();o_();OY();Pgn={};Et(Pgn,{Graph:()=>mhe});mhe=class AMt{constructor(e){M(this,"nodes",{});M(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]=Y3(r.id)?n:r.id}),{nodes:Object.values(this.nodes).map(r=>({id:e[r.id],...Rgn(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??Zb(),i={id:o,data:e,name:Mgn(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 MMt(this)}lastNode(){return RMt(this)}extend(e,r=""){let n=r;Object.values(e.nodes).map(l=>l.id).every(Y3)&&(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&&MMt(this,[e.id])&&this.removeNode(e)}trimLastNode(){let e=this.lastNode();e&&RMt(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 Y3(o)&&r.get(i)===1?i:o};return new AMt({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 TPt(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 EPt(r,{backgroundColor:e?.backgroundColor})}}});function NMt(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 jMt=v(()=>{cO()});function n2e(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.iterator]=="function"&&typeof t.next=="function"}function hhe(t){return typeof t=="object"&&t!==null&&typeof t[Symbol.asyncIterator]=="function"}function*o2e(t,e){for(;;){let{value:r,done:n}=Qm.runWithConfig(Yy(t),e.next.bind(e),!0);if(n)break;yield r}}async function*ghe(t,e){let r=e[Symbol.asyncIterator]();for(;;){let{value:n,done:o}=await Qm.runWithConfig(Yy(t),r.next.bind(e),!0);if(o)break;yield n}}var DMt,$Mt=v(()=>{tz();rz();uO();DMt=t=>t!=null&&typeof t=="object"&&"next"in t&&typeof t.next=="function"});function md(t,e){return t&&!Array.isArray(t)&&!(t instanceof Date)&&typeof t=="object"?t:{[e]:t}}function Ign(t){if(Fpe(t))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}function Cv(t){if(typeof t=="function")return new i_({func:t});if(Lo.isRunnable(t))return t;if(!Array.isArray(t)&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[r]=Cv(n);return new hL({steps:e})}else throw new Error(`Expected a Runnable, function or object.
|
||
Instead got an unsupported type.`)}function Ngn(t,e){let r=e.name??t.getName(),n=e.description??lL(e.schema);return h6(e.schema)?new yhe({name:r,description:n,schema:Ct.object({input:Ct.string()}).transform(o=>o.input),bound:t}):new yhe({name:r,description:n,schema:e.schema,bound:t})}var i2e,Lo,Vw,FMt,bhe,El,hL,Agn,i_,zMt,a2e,$Q,s2e,yhe,Gh=v(()=>{V$();$fe();tz();rz();uO();UY();cO();dTt();gTt();iz();bTt();oBe();yN();IMt();jMt();$Mt();yO();i2e=L(cpe(),1);OY();qqe();Lo=class extends Vh{constructor(){super(...arguments);M(this,"lc_runnable",!0);M(this,"name")}getName(e){let r=this.name??this.constructor.lc_name()??this.constructor.name;return e?`${r}${e}`:r}withRetry(e){return new bhe({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new Vw({bound:this,config:e,kwargs:{}})}withFallbacks(e){let r=Array.isArray(e)?e:e.fallbacks;return new a2e({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(Jo);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)=>Jo(i===0?e:n))}return Array.from({length:r},()=>Jo(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=Jo(r),o=new Q$({generator:this._streamIterator(e,n),config:n});return await o.setup,Qy.fromAsyncGenerator(o)}_separateRunnableConfigFromCallOptions(e){let r;e===void 0?r=Jo(e):r=Jo({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=Jo(n),a=await(await Gg(o))?.handleChainStart(this.toJSON(),md(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 lO(u,n?.signal)}catch(u){throw await a?.handleChainError(u),u}return await a?.handleChainEnd(md(s,"output")),s}async _batchWithConfig(e,r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(Gg)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),md(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 lO(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(md(u,"output")))),u}_concatOutputChunks(e,r){return eb(e,r)}async*_transformStreamWithConfig(e,r,n){let o,i=!0,a,s=!0,u=Jo(n),l=await Gg(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 Yqe(r.bind(this),d(),async()=>l?.handleChainStart(this.toJSON(),{input:""},u.runId,u.runType,void 0,void 0,u.runName??this.getName()),n?.signal,u);delete u.runId,f=p.setup;let m=f?.handlers.find(mTt),h=p.output;m!==void 0&&f!==void 0&&(h=m.tapOutputIterable(f.runId,h));let g=f?.handlers.find(rBe);g!==void 0&&f!==void 0&&(h=g.tapOutputIterable(f.runId,h));for await(let y of h)if(yield y,s)if(a===void 0)a=y;else try{a=this._concatOutputChunks(a,y)}catch{a=void 0,s=!1}}catch(p){throw await f?.handleChainError(p,void 0,void 0,void 0,{inputs:md(o,"input")}),p}await f?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:md(o,"input")})}getGraph(e){let r=new mhe,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 El({first:this,last:Cv(e)})}pick(e){return this.pipe(new s2e(e))}assign(e){return this.pipe(new $Q(new hL({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,Jo(r))}async*streamLog(e,r,n){let o=new tme({...n,autoClose:!1,_schemaFormat:"original"}),i=Jo(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 dO({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"?NMt(o):Qy.fromAsyncGenerator(o)}async*_streamEventsV2(e,r,n){let o=new hTt({...n,autoClose:!1}),i=Jo(r),a=i.runId??Zb();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 g=await l.stream(e,{...i,signal:m}),y=o.tapOutputIterable(a,g);for await(let b of y)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=Jo(r),s=a.tags??[],u=a.metadata??{},l=a.runName??this.getName(),c=new tme({...n,autoClose:!1,_schemaFormat:"streaming_events"}),d=new _Tt({...n}),f=this._streamLog(e,c,a);for await(let m of f){if(o?o=o.concat(m):o=eme.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]),g=[...new Set(h)];for(let b of g){let _,w={},x=o.state.logs[b];if(x.end_time===void 0?x.streamed_output.length>0?_="stream":_="start":_="end",_==="start")x.inputs!==void 0&&(w.input=x.inputs);else if(_==="end")x.inputs!==void 0&&(w.input=x.inputs),w.output=x.final_output;else if(_==="stream"){let O=x.streamed_output.length;if(O!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${O} instead. Encountered in: "${x.name}"`);w={chunk:x.streamed_output[0]},x.streamed_output=[]}yield{event:`on_${x.type}_${_}`,name:x.name,run_id:x.id,tags:x.tags,metadata:x.metadata,data:w}}let{state:y}=o;if(y.streamed_output.length>0){let b=y.streamed_output.length;if(b!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${b} instead. Encountered in: "${y.name}"`);let _={chunk:y.streamed_output[0]};y.streamed_output=[];let w={event:`on_${y.type}_stream`,run_id:y.id,tags:s,metadata:u,name:l,data:_};d.includeEvent(w,y.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 JY(e)}withListeners({onStart:e,onEnd:r,onError:n}){return new Vw({bound:this,config:{},configFactories:[o=>({callbacks:[new nBe({config:o,onStart:e,onEnd:r,onError:n})]})]})}asTool(e){return Ngn(this,e)}},Vw=class LMt extends Lo{constructor(r){super(r);M(this,"lc_namespace",["langchain_core","runnables"]);M(this,"lc_serializable",!0);M(this,"bound");M(this,"config");M(this,"kwargs");M(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=nz(this.config,...r);return nz(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 bhe({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(Jo(a),this.kwargs))):await this._mergeConfig(Jo(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(Jo(n),this.kwargs))}async stream(r,n){return this.bound.stream(r,await this._mergeConfig(Jo(n),this.kwargs))}async*transform(r,n){yield*this.bound.transform(r,await this._mergeConfig(Jo(n),this.kwargs))}streamEvents(r,n,o){let i=this,a=async function*(){yield*i.bound.streamEvents(r,{...await i._mergeConfig(Jo(n),i.kwargs),version:n.version},o)};return Qy.fromAsyncGenerator(a())}static isRunnableBinding(r){return r.bound&&Lo.isRunnable(r.bound)}withListeners({onStart:r,onEnd:n,onError:o}){return new LMt({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[i=>({callbacks:[new nBe({config:i,onStart:r,onEnd:n,onError:o})]})]})}},FMt=class kMt extends Lo{constructor(r){super(r);M(this,"lc_serializable",!0);M(this,"lc_namespace",["langchain_core","runnables"]);M(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,zs(n,{callbacks:o?.getChild()}))}withListeners({onStart:r,onEnd:n,onError:o}){return new kMt({bound:this.bound.withListeners({onStart:r,onEnd:n,onError:o})})}},bhe=class extends Vw{constructor(e){super(e);M(this,"lc_namespace",["langchain_core","runnables"]);M(this,"maxAttemptNumber",3);M(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 zs(r,{callbacks:n?.getChild(o)})}async _invoke(e,r,n){return(0,i2e.default)(o=>super.invoke(e,this._patchConfigForRetry(o,r,n)),{onFailedAttempt:o=>this.onFailedAttempt(o,e),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(e,r){return this._callWithConfig(this._invoke.bind(this),e,r)}async _batch(e,r,n,o){let i={};try{await(0,i2e.default)(async a=>{let s=e.map((f,p)=>p).filter(f=>i[f.toString()]===void 0||i[f.toString()]instanceof Error),u=s.map(f=>e[f]),l=s.map(f=>this._patchConfigForRetry(a,r?.[f],n?.[f])),c=await super.batch(u,l,{...o,returnExceptions:!0}),d;for(let f=0;f<c.length;f+=1){let p=c[f],m=s[f];p instanceof Error&&d===void 0&&(d=p,d.input=u[f]),i[m.toString()]=p}if(d)throw d;return c},{onFailedAttempt:a=>this.onFailedAttempt(a,a.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(a){if(o?.returnExceptions!==!0)throw a}return Object.keys(i).sort((a,s)=>parseInt(a,10)-parseInt(s,10)).map(a=>i[parseInt(a,10)])}async batch(e,r,n){return this._batchWithConfig(this._batch.bind(this),e,r,n)}},El=class DQ extends Lo{constructor(r){super(r);M(this,"first");M(this,"middle",[]);M(this,"last");M(this,"omitSequenceTags",!1);M(this,"lc_serializable",!0);M(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=Jo(n),a=await(await Gg(o))?.handleChainStart(this.toJSON(),md(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,zs(o,{callbacks:a?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`)}));s=await lO(f,n?.signal)}if(n?.signal?.aborted)throw Y$(n.signal);u=await this.last.invoke(s,zs(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(md(u,"output")),u}async batch(r,n,o){let i=this._getOptionsList(n??{},r.length),a=await Promise.all(i.map(Gg)),s=await Promise.all(a.map(async(l,c)=>{let d=await l?.handleChainStart(this.toJSON(),md(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 zs(i[p],{callbacks:m})}),o);u=await lO(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(md(u,"output")))),u}_concatOutputChunks(r,n){return this.last._concatOutputChunks(r,n)}async*_streamIterator(r,n){let o=await Gg(n),{runId:i,...a}=n??{},s=await o?.handleChainStart(this.toJSON(),md(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(),zs(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,zs(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(md(c,"output"))}getGraph(r){let n=new mhe,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 DQ.isRunnableSequence(r)?new DQ({first:this.first,middle:this.middle.concat([this.last,r.first,...r.middle]),last:r.last,name:this.name??r.name}):new DQ({first:this.first,middle:[...this.middle,this.last],last:Cv(r),name:this.name})}static isRunnableSequence(r){return Array.isArray(r.middle)&&Lo.isRunnable(r)}static from([r,...n],o){let i={};return typeof o=="string"?i.name=o:o!==void 0&&(i=o),new DQ({...i,first:Cv(r),middle:n.slice(0,-1).map(Cv),last:Cv(n[n.length-1])})}},hL=class qMt extends Lo{constructor(r){super(r);M(this,"lc_namespace",["langchain_core","runnables"]);M(this,"lc_serializable",!0);M(this,"steps");this.steps={};for(let[n,o]of Object.entries(r.steps))this.steps[n]=Cv(o)}static lc_name(){return"RunnableMap"}getStepsKeys(){return Object.keys(this.steps)}static from(r){return new qMt({steps:r})}async invoke(r,n){let o=Jo(n),a=await(await Gg(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,zs(o,{callbacks:a?.getChild(`map:key:${l}`)}))});await lO(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=Hpe(r,Object.keys(i).length),s=new Map(Object.entries(i).map(([u,l],c)=>{let d=l.transform(a[c],zs(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 lO(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=Jo(n),a=new Q$({generator:this.transform(o(),i),config:i});return await a.setup,Qy.fromAsyncGenerator(a)}},Agn=class BMt extends Lo{constructor(r){super(r);M(this,"lc_serializable",!1);M(this,"lc_namespace",["langchain_core","runnables"]);M(this,"func");if(!Fpe(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 Gg(o),a=this.func(zs(o,{callbacks:i}),r);return lO(a,o?.signal)}async*_streamIterator(r,n){let[o]=this._getOptionsList(n??{},1),i=await this.invoke(r,n);if(hhe(i)){for await(let a of i)o?.signal?.throwIfAborted(),yield a;return}if(DMt(i)){for(;;){o?.signal?.throwIfAborted();let a=i.next();if(a.done)break;yield a.value}return}yield i}static from(r){return new BMt({func:r})}};i_=class UMt extends Lo{constructor(r){if(Fpe(r.func))return Agn.from(r.func);super(r);M(this,"lc_namespace",["langchain_core","runnables"]);M(this,"func");Ign(r.func),this.func=r.func}static lc_name(){return"RunnableLambda"}static from(r){return new UMt({func:r})}async _invoke(r,n,o){return new Promise((i,a)=>{let s=zs(n,{callbacks:o?.getChild(),recursionLimit:(n?.recursionLimit??zpe)-1});Qm.runWithConfig(Yy(s),async()=>{try{let u=await this.func(r,{...s});if(u&&Lo.isRunnable(u)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");u=await u.invoke(r,{...s,recursionLimit:(s.recursionLimit??zpe)-1})}else if(hhe(u)){let l;for await(let c of ghe(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(n2e(u)){let l;for(let c of o2e(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=zs(o,{callbacks:n?.getChild(),recursionLimit:(o?.recursionLimit??zpe)-1}),s=await new Promise((u,l)=>{Qm.runWithConfig(Yy(a),async()=>{try{let c=await this.func(i,{...a,config:a});u(c)}catch(c){l(c)}})});if(s&&Lo.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(hhe(s))for await(let u of ghe(a,s))o?.signal?.throwIfAborted(),yield u;else if(n2e(s))for(let u of o2e(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=Jo(n),a=new Q$({generator:this.transform(o(),i),config:i});return await a.setup,Qy.fromAsyncGenerator(a)}},zMt=class extends hL{},a2e=class extends Lo{constructor(e){super(e);M(this,"lc_namespace",["langchain_core","runnables"]);M(this,"lc_serializable",!0);M(this,"runnable");M(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=Jo(r),o=await Gg(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),md(e,"input"),i,void 0,void 0,void 0,a?.runName),u=zs(a,{callbacks:s?.getChild()});return await Qm.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(md(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=Jo(r),o=await Gg(n),{runId:i,...a}=n,s=await o?.handleChainStart(this.toJSON(),md(e,"input"),i,void 0,void 0,void 0,a?.runName),u,l;for(let d of this.runnables()){n?.signal?.throwIfAborted();let f=zs(a,{callbacks:s?.getChild()});try{let p=await d.stream(e,f);l=ghe(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(md(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=>Gg(u))),a=await Promise.all(i.map(async(u,l)=>{let c=await u?.handleChainStart(this.toJSON(),md(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)=>zs(o[d],{callbacks:c?.getChild()})),n);return await Promise.all(a.map((c,d)=>c?.handleChainEnd(md(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.")}};$Q=class extends Lo{constructor(e){e instanceof hL&&(e={mapper:e});super(e);M(this,"lc_namespace",["langchain_core","runnables"]);M(this,"lc_serializable",!0);M(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]=Hpe(e),s=this.mapper.transform(a,zs(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=Jo(r),i=new Q$({generator:this.transform(n(),o),config:o});return await i.setup,Qy.fromAsyncGenerator(i)}},s2e=class extends Lo{constructor(e){(typeof e=="string"||Array.isArray(e))&&(e={keys:e});super(e);M(this,"lc_namespace",["langchain_core","runnables"]);M(this,"lc_serializable",!0);M(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=Jo(r),i=new Q$({generator:this.transform(n(),o),config:o});return await i.setup,Qy.fromAsyncGenerator(i)}},yhe=class extends Vw{constructor(e){let r=El.from([i_.from(async n=>{let o;if(J$(n))try{o=await uL(this.schema,n.args)}catch{throw new K3("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??{}});M(this,"name");M(this,"description");M(this,"schema");this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}}});var xu,_he=v(()=>{uO();cO();Gh();xu=class extends Lo{constructor(e){super(e);M(this,"lc_namespace",["langchain_core","runnables"]);M(this,"lc_serializable",!0);M(this,"func");e&&(this.func=e.func)}static lc_name(){return"RunnablePassthrough"}async invoke(e,r){let n=Jo(r);return this.func&&await this.func(e,n),this._callWithConfig(o=>Promise.resolve(o),e,n)}async*transform(e,r){let n=Jo(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 $Q(new hL({steps:e}))}}});var HMt,VMt=v(()=>{uO();Gh();HMt=class extends Lo{constructor(e){super(e);M(this,"lc_namespace",["langchain_core","runnables"]);M(this,"lc_serializable",!0);M(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,Jo(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,g)=>s[g].invoke(h,u[g])),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 JMt,KMt=v(()=>{uO();cO();Gh();JMt=class extends Lo{constructor(e){super(e);M(this,"lc_namespace",["langchain_core","runnables"]);M(this,"lc_serializable",!0);M(this,"default");M(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])=>[Cv(i),Cv(a)]),o=Cv(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,zs(r,{callbacks:n?.getChild(`condition:${i+1}`)}))){o=await s.invoke(e,zs(r,{callbacks:n?.getChild(`branch:${i+1}`)}));break}}return o||(o=await this.default.invoke(e,zs(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 Gg(r))?.handleChainStart(this.toJSON(),md(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,zs(r,{callbacks:o?.getChild(`condition:${u+1}`)}))){s=await c.stream(e,zs(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,zs(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 YMt(t,e){return Array.isArray(t)?WMt(t,e):i_.from(r=>WMt(r,t))}function WMt(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&&vhe(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&&vhe(l,o)||a&&l.id&&a.some(c=>c===l.id))&&u.push(l):u.push(l)}return u}function QMt(t){return Array.isArray(t)?GMt(t):i_.from(GMt)}function GMt(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=KU(o),a=KU(n),s=i.concat(a);typeof i.content=="string"&&typeof a.content=="string"&&(s.content=`${i.content}
|
||
${a.content}`),e.push(Dgn(s))}}return e}function eRt(t,e){if(Array.isArray(t)){let r=t;if(!e)throw new Error("Options parameter is required when providing messages.");return ZMt(r,e)}else{let r=t;return i_.from(n=>ZMt(n,r)).withConfig({runName:"trim_messages"})}}async function ZMt(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=l2e;if(l&&("splitText"in l?d=l.splitText:d=async f=>l(f)),o==="first")return tRt(t,{maxTokens:r,tokenCounter:c,textSplitter:d,partialStrategy:i?"first":void 0,endOn:a});if(o==="last")return jgn(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 tRt(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_"))),g=u2e(c.getType(),{...h,content:m}),y=[...s.slice(0,u),g];if(await n(y)<=r)s=y,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&&!vhe(s[u-1],l);)u-=1}return s.slice(0,u)}async function jgn(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 u2e(c.getType(),d,Z3(c))});if(o){let c=Array.isArray(o)?o:[o];for(;s.length>0&&!vhe(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 tRt(l,{...a,partialStrategy:r?"last":void 0,endOn:i}),u?[l[0],...l.slice(1).reverse()]:l.reverse()}function u2e(t,e,r){let n,o;switch(t){case"human":r?n=new _v(e):o=new su(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 Ur(i)}else o=new li(e);break;case"system":r?n=new Ky(e):o=new Ym(e);break;case"developer":r?n=new Ky({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}}):o=new Ym({...e,additional_kwargs:{...e.additional_kwargs,__openai_role__:"developer"}});break;case"tool":if("tool_call_id"in e)r?n=new Aw(e):o=new Gb(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 bv(e);else{if(!e.name)throw new Error("FunctionMessage must have a 'name' field");o=new VU(e)}break;case"generic":if("role"in e)r?n=new yv(e):o=new cd(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 Dgn(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 XMt&&(r=u2e(e,n)),!r)throw new Error(`Unrecognized message chunk class ${e}. Supported classes are ${Object.keys(XMt)}`);return r}function l2e(t){let e=t.split(`
|
||
`);return Promise.resolve([...e.slice(0,-1).map(r=>`${r}
|
||
`),e[e.length-1]])}var vhe,XMt,rRt=v(()=>{Vg();X3();V0();SY();Kfe();G$();CY();Wfe();iO();Gh();vhe=(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)};XMt={human:{message:su,messageChunk:_v},ai:{message:li,messageChunk:Ur},system:{message:Ym,messageChunk:Ky},developer:{message:Ym,messageChunk:Ky},tool:{message:Gb,messageChunk:Aw},function:{message:VU,messageChunk:bv},generic:{message:cd,messageChunk:yv},remove:{message:JU,messageChunk:JU}}});var nRt,oRt=v(()=>{nRt=["tool_call","tool_call_chunk","invalid_tool_call","server_tool_call","server_tool_call_chunk","server_tool_call_result"]});var iRt,aRt=v(()=>{iRt=["image","video","audio","text-plain","file"]});var sRt,uRt=v(()=>{oRt();aRt();sRt=["text","reasoning",...nRt,...iRt]});var $gn,$s=v(()=>{Do();yY();cke();Vg();hke();X3();V0();SY();Kfe();G$();CY();Wfe();iO();rRt();uRt();$gn={};Et($gn,{AIMessage:()=>li,AIMessageChunk:()=>Ur,BaseMessage:()=>Jc,BaseMessageChunk:()=>Wb,ChatMessage:()=>cd,ChatMessageChunk:()=>yv,FunctionMessage:()=>VU,FunctionMessageChunk:()=>bv,HumanMessage:()=>su,HumanMessageChunk:()=>_v,KNOWN_BLOCK_TYPES:()=>sRt,RemoveMessage:()=>JU,SystemMessage:()=>Ym,SystemMessageChunk:()=>Ky,ToolMessage:()=>Gb,ToolMessageChunk:()=>Aw,_isMessageFieldWithRole:()=>Hfe,_mergeDicts:()=>xl,_mergeLists:()=>HU,_mergeObj:()=>zfe,_mergeStatus:()=>Ufe,coerceMessageLikeToMessage:()=>Iw,convertToChunk:()=>KU,convertToOpenAIImageBlock:()=>Ffe,convertToProviderContentBlock:()=>oO,defaultTextSplitter:()=>l2e,defaultToolCallParser:()=>_Y,filterMessages:()=>YMt,getBufferString:()=>rl,iife:()=>YSt,isAIMessage:()=>Us,isAIMessageChunk:()=>wY,isBase64ContentBlock:()=>G3,isBaseMessage:()=>Xm,isBaseMessageChunk:()=>Z3,isChatMessage:()=>HSt,isChatMessageChunk:()=>VSt,isDataContentBlock:()=>Zm,isDirectToolOutput:()=>bY,isFunctionMessage:()=>JSt,isFunctionMessageChunk:()=>KSt,isHumanMessage:()=>WSt,isHumanMessageChunk:()=>GSt,isIDContentBlock:()=>Lfe,isMessage:()=>Bfe,isOpenAIToolCallArray:()=>ASt,isPlainTextContentBlock:()=>vSt,isSystemMessage:()=>ZSt,isSystemMessageChunk:()=>XSt,isToolMessage:()=>vY,isToolMessageChunk:()=>fke,isURLContentBlock:()=>W3,mapChatMessagesToStoredMessages:()=>e0t,mapStoredMessageToChatMessage:()=>xY,mapStoredMessagesToChatMessages:()=>QSt,mergeContent:()=>Kb,mergeMessageRuns:()=>QMt,mergeResponseMetadata:()=>Vfe,mergeUsageMetadata:()=>Jfe,parseBase64DataUrl:()=>Hg,parseMimeType:()=>gY,trimMessages:()=>eRt})});var lRt,cRt=v(()=>{Vg();V0();G$();Gh();$s();_he();lRt=class extends Vw{constructor(e){let r=i_.from((a,s)=>this._enterHistory(a,s??{})).withConfig({runName:"loadHistory"}),n=e.historyMessagesKey??e.inputMessagesKey;n&&(r=xu.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});M(this,"runnable");M(this,"inputMessagesKey");M(this,"outputMessagesKey");M(this,"historyMessagesKey");M(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)&&!Xm(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 su(r)];if(Array.isArray(r))return r;if(Xm(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)&&!Xm(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 li(r)];if(Array.isArray(r))return r;if(Xm(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 Lgn,xv=v(()=>{Do();uO();Gh();_he();VMt();KMt();cRt();Lgn={};Et(Lgn,{RouterRunnable:()=>HMt,Runnable:()=>Lo,RunnableAssign:()=>$Q,RunnableBinding:()=>Vw,RunnableBranch:()=>JMt,RunnableEach:()=>FMt,RunnableLambda:()=>i_,RunnableMap:()=>hL,RunnableParallel:()=>zMt,RunnablePassthrough:()=>xu,RunnablePick:()=>s2e,RunnableRetry:()=>bhe,RunnableSequence:()=>El,RunnableToolLike:()=>yhe,RunnableWithFallbacks:()=>a2e,RunnableWithMessageHistory:()=>lRt,_coerceToRunnable:()=>Cv,ensureConfig:()=>Jo,getCallbackManagerForConfig:()=>Gg,mergeConfigs:()=>nz,patchConfig:()=>zs,pickRunnableConfigKeys:()=>Yy})});var Az,SN,eh,O6=v(()=>{mY();Gh();xv();Az=class extends Lo{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"})}},SN=class extends Az{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")}},eh=class extends Error{constructor(e,r,n,o=!1){super(e);M(this,"llmOutput");M(this,"observation");M(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");H$(this,"OUTPUT_PARSING_FAILURE")}}});var CN,gL,yL=v(()=>{Vg();iO();ym();O6();phe();CN=class extends SN{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"})}},gL=class extends CN{constructor(e){super(e);M(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(Z3(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Hi({message:o,text:o.content})}else if(Xm(o)){if(typeof o.content!="string")throw new Error("Cannot handle non-string message output.");i=new Hi({message:KU(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&&!bO(a,r)&&(this.diff?yield this._diff(r,a):yield a,r=a)}}getFormatInstructions(){return""}}});var dRt,fRt=v(()=>{yL();dRt=class extends CN{constructor(){super(...arguments);M(this,"lc_namespace",["langchain_core","output_parsers","bytes"]);M(this,"lc_serializable",!0);M(this,"textEncoder",new TextEncoder)}static lc_name(){return"BytesOutputParser"}parse(e){return Promise.resolve(this.textEncoder.encode(e))}getFormatInstructions(){return""}}});var T6,pRt,mRt,hRt,gRt,yRt=v(()=>{O6();yL();T6=class extends CN{constructor(){super(...arguments);M(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]}},pRt=class extends T6{constructor(){super(...arguments);M(this,"lc_namespace",["langchain_core","output_parsers","list"]);M(this,"lc_serializable",!0)}static lc_name(){return"CommaSeparatedListOutputParser"}async parse(e){try{return e.trim().split(",").map(r=>r.trim())}catch{throw new eh(`Could not parse output: ${e}`,e)}}getFormatInstructions(){return"Your response should be a list of comma separated values, eg: `foo, bar, baz`"}},mRt=class extends T6{constructor({length:e,separator:r}){super(...arguments);M(this,"lc_namespace",["langchain_core","output_parsers","list"]);M(this,"length");M(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 eh(`Incorrect number of items. Expected ${this.length}, got ${r.length}.`);return r}catch(r){throw Object.getPrototypeOf(r)===eh.prototype?r:new eh(`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\`)`}},hRt=class extends T6{constructor(){super(...arguments);M(this,"lc_namespace",["langchain_core","output_parsers","list"]);M(this,"lc_serializable",!0);M(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])}},gRt=class extends T6{constructor(){super(...arguments);M(this,"lc_namespace",["langchain_core","output_parsers","list"]);M(this,"lc_serializable",!0);M(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 whe,bRt=v(()=>{yL();whe=class extends CN{constructor(){super(...arguments);M(this,"lc_namespace",["langchain_core","output_parsers","string"]);M(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,c2e,_Rt,vRt=v(()=>{yN();o_();O6();yO();Jw=class extends SN{constructor(e){super(e);M(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(Vi(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 uL(this.schema,JSON.parse(o))}catch(r){throw new eh(`Failed to parse. Text: "${e}". Error: ${r}`,e)}}},c2e=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(Vi(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)}},_Rt=class extends SN{constructor({inputSchema:e}){super(...arguments);M(this,"structuredInputParser");this.structuredInputParser=new c2e(e)}async parse(e){let r;try{r=await this.structuredInputParser.parse(e)}catch(n){throw new eh(`Failed to parse. Text: "${e}". Error: ${n}`,e)}return this.outputProcessor(r)}getFormatInstructions(){return this.structuredInputParser.getFormatInstructions()}}});var Fgn,d2e=v(()=>{Do();HY();VY();eBe();Fgn={};Et(Fgn,{applyPatch:()=>eL,compare:()=>n6})});var Ov,f2e=v(()=>{pY();VY();yL();d2e();Ov=class extends gL{constructor(){super(...arguments);M(this,"lc_namespace",["langchain_core","output_parsers"]);M(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?n6(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return fY(e[0].text)}async parse(e){return fY(e,JSON.parse)}getFormatInstructions(){return""}}});var kgn,wRt,SRt=v(()=>{kgn=function(){let t={};t.parser=function(j,A){return new r(j,A)},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(j,A){if(!(this instanceof r))return new r(j,A);var W=this;o(W),W.q=W.c="",W.bufferCheckPosition=t.MAX_BUFFER_LENGTH,W.opt=A||{},W.opt.lowercase=W.opt.lowercase||W.opt.lowercasetags,W.looseCase=W.opt.lowercase?"toLowerCase":"toUpperCase",W.tags=[],W.closed=W.closedRoot=W.sawRoot=!1,W.tag=W.error=null,W.strict=!!j,W.noscript=!!(j||W.opt.noscript),W.state=T.BEGIN,W.strictEntities=W.opt.strictEntities,W.ENTITIES=W.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),W.attribList=[],W.opt.xmlns&&(W.ns=Object.create(m)),W.trackPosition=W.opt.position!==!1,W.trackPosition&&(W.position=W.line=W.column=0),N(W,"onready")}Object.create||(Object.create=function(j){function A(){}A.prototype=j;var W=new A;return W}),Object.keys||(Object.keys=function(j){var A=[];for(var W in j)j.hasOwnProperty(W)&&A.push(W);return A});function n(j){for(var A=Math.max(t.MAX_BUFFER_LENGTH,10),W=0,V=0,se=e.length;V<se;V++){var be=j[e[V]].length;if(be>A)switch(e[V]){case"textNode":F(j);break;case"cdata":D(j,"oncdata",j.cdata),j.cdata="";break;case"script":D(j,"onscript",j.script),j.script="";break;default:U(j,"Max buffer length exceeded: "+e[V])}W=Math.max(W,be)}var Ee=t.MAX_BUFFER_LENGTH-W;j.bufferCheckPosition=Ee+j.position}function o(j){for(var A=0,W=e.length;A<W;A++)j[e[A]]=""}function i(j){F(j),j.cdata!==""&&(D(j,"oncdata",j.cdata),j.cdata=""),j.script!==""&&(D(j,"onscript",j.script),j.script="")}r.prototype={end:function(){H(this)},write:Y,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(j){return j!=="error"&&j!=="end"});function u(j,A){return new l(j,A)}function l(j,A){if(!(this instanceof l))return new l(j,A);a.apply(this),this._parser=new r(j,A),this.writable=!0,this.readable=!0;var W=this;this._parser.onend=function(){W.emit("end")},this._parser.onerror=function(V){W.emit("error",V),W._parser.error=null},this._decoder=null,s.forEach(function(V){Object.defineProperty(W,"on"+V,{get:function(){return W._parser["on"+V]},set:function(se){if(!se)return W.removeAllListeners(V),W._parser["on"+V]=se,se;W.on(V,se)},enumerable:!0,configurable:!1})})}l.prototype=Object.create(a.prototype,{constructor:{value:l}}),l.prototype.write=function(j){return this._parser.write(j.toString()),this.emit("data",j),!0},l.prototype.end=function(j){return j&&j.length&&this.write(j),this._parser.end(),!0},l.prototype.on=function(j,A){var W=this;return!W._parser["on"+j]&&s.indexOf(j)!==-1&&(W._parser["on"+j]=function(){var V=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);V.splice(0,0,j),W.emit.apply(W,V)}),a.prototype.on.call(W,j,A)};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]/,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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,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]/,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 _(j){return j===" "||j===`
|
||
`||j==="\r"||j===" "}function w(j){return j==='"'||j==="'"}function x(j){return j===">"||_(j)}function O(j,A){return j.test(A)}function E(j,A){return!O(j,A)}var T=0;t.STATE={BEGIN:T++,BEGIN_WHITESPACE:T++,TEXT:T++,TEXT_ENTITY:T++,OPEN_WAKA:T++,SGML_DECL:T++,SGML_DECL_QUOTED:T++,DOCTYPE:T++,DOCTYPE_QUOTED:T++,DOCTYPE_DTD:T++,DOCTYPE_DTD_QUOTED:T++,COMMENT_STARTING:T++,COMMENT:T++,COMMENT_ENDING:T++,COMMENT_ENDED:T++,CDATA:T++,CDATA_ENDING:T++,CDATA_ENDING_2:T++,PROC_INST:T++,PROC_INST_BODY:T++,PROC_INST_ENDING:T++,OPEN_TAG:T++,OPEN_TAG_SLASH:T++,ATTRIB:T++,ATTRIB_NAME:T++,ATTRIB_NAME_SAW_WHITE:T++,ATTRIB_VALUE:T++,ATTRIB_VALUE_QUOTED:T++,ATTRIB_VALUE_CLOSED:T++,ATTRIB_VALUE_UNQUOTED:T++,ATTRIB_VALUE_ENTITY_Q:T++,ATTRIB_VALUE_ENTITY_U:T++,CLOSE_TAG:T++,CLOSE_TAG_SAW_WHITE:T++,SCRIPT:T++,SCRIPT_ENDING:T++},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(j){var A=t.ENTITIES[j],W=typeof A=="number"?String.fromCharCode(A):A;t.ENTITIES[j]=W});for(var R in t.STATE)t.STATE[t.STATE[R]]=R;T=t.STATE;function N(j,A,W){j[A]&&j[A](W)}function D(j,A,W){j.textNode&&F(j),N(j,A,W)}function F(j){j.textNode=B(j.opt,j.textNode),j.textNode&&N(j,"ontext",j.textNode),j.textNode=""}function B(j,A){return j.trim&&(A=A.trim()),j.normalize&&(A=A.replace(/\s+/g," ")),A}function U(j,A){return F(j),j.trackPosition&&(A+=`
|
||
Line: `+j.line+`
|
||
Column: `+j.column+`
|
||
Char: `+j.c),A=new Error(A),j.error=A,N(j,"onerror",A),j}function H(j){return j.sawRoot&&!j.closedRoot&&G(j,"Unclosed root tag"),j.state!==T.BEGIN&&j.state!==T.BEGIN_WHITESPACE&&j.state!==T.TEXT&&U(j,"Unexpected end"),F(j),j.c="",j.closed=!0,N(j,"onend"),r.call(j,j.strict,j.opt),j}function G(j,A){if(typeof j!="object"||!(j instanceof r))throw new Error("bad call to strictFail");j.strict&&U(j,A)}function ie(j){j.strict||(j.tagName=j.tagName[j.looseCase]());var A=j.tags[j.tags.length-1]||j,W=j.tag={name:j.tagName,attributes:{}};j.opt.xmlns&&(W.ns=A.ns),j.attribList.length=0,D(j,"onopentagstart",W)}function oe(j,A){var W=j.indexOf(":"),V=W<0?["",j]:j.split(":"),se=V[0],be=V[1];return A&&j==="xmlns"&&(se="xmlns",be=""),{prefix:se,local:be}}function z(j){if(j.strict||(j.attribName=j.attribName[j.looseCase]()),j.attribList.indexOf(j.attribName)!==-1||j.tag.attributes.hasOwnProperty(j.attribName)){j.attribName=j.attribValue="";return}if(j.opt.xmlns){var A=oe(j.attribName,!0),W=A.prefix,V=A.local;if(W==="xmlns")if(V==="xml"&&j.attribValue!==f)G(j,"xml: prefix must be bound to "+f+`
|
||
Actual: `+j.attribValue);else if(V==="xmlns"&&j.attribValue!==p)G(j,"xmlns: prefix must be bound to "+p+`
|
||
Actual: `+j.attribValue);else{var se=j.tag,be=j.tags[j.tags.length-1]||j;se.ns===be.ns&&(se.ns=Object.create(be.ns)),se.ns[V]=j.attribValue}j.attribList.push([j.attribName,j.attribValue])}else j.tag.attributes[j.attribName]=j.attribValue,D(j,"onattribute",{name:j.attribName,value:j.attribValue});j.attribName=j.attribValue=""}function Q(j,A){if(j.opt.xmlns){var W=j.tag,V=oe(j.tagName);W.prefix=V.prefix,W.local=V.local,W.uri=W.ns[V.prefix]||"",W.prefix&&!W.uri&&(G(j,"Unbound namespace prefix: "+JSON.stringify(j.tagName)),W.uri=V.prefix);var se=j.tags[j.tags.length-1]||j;W.ns&&se.ns!==W.ns&&Object.keys(W.ns).forEach(function(hn){D(j,"onopennamespace",{prefix:hn,uri:W.ns[hn]})});for(var be=0,Ee=j.attribList.length;be<Ee;be++){var Ae=j.attribList[be],ht=Ae[0],Rt=Ae[1],Ze=oe(ht,!0),Dr=Ze.prefix,Vt=Ze.local,jt=Dr===""?"":W.ns[Dr]||"",Fe={name:ht,value:Rt,prefix:Dr,local:Vt,uri:jt};Dr&&Dr!=="xmlns"&&!jt&&(G(j,"Unbound namespace prefix: "+JSON.stringify(Dr)),Fe.uri=Dr),j.tag.attributes[ht]=Fe,D(j,"onattribute",Fe)}j.attribList.length=0}j.tag.isSelfClosing=!!A,j.sawRoot=!0,j.tags.push(j.tag),D(j,"onopentag",j.tag),A||(!j.noscript&&j.tagName.toLowerCase()==="script"?j.state=T.SCRIPT:j.state=T.TEXT,j.tag=null,j.tagName=""),j.attribName=j.attribValue="",j.attribList.length=0}function re(j){if(!j.tagName){G(j,"Weird empty close tag."),j.textNode+="</>",j.state=T.TEXT;return}if(j.script){if(j.tagName!=="script"){j.script+="</"+j.tagName+">",j.tagName="",j.state=T.SCRIPT;return}D(j,"onscript",j.script),j.script=""}var A=j.tags.length,W=j.tagName;j.strict||(W=W[j.looseCase]());for(var V=W;A--;){var se=j.tags[A];if(se.name!==V)G(j,"Unexpected close tag");else break}if(A<0){G(j,"Unmatched closing tag: "+j.tagName),j.textNode+="</"+j.tagName+">",j.state=T.TEXT;return}j.tagName=W;for(var be=j.tags.length;be-- >A;){var Ee=j.tag=j.tags.pop();j.tagName=j.tag.name,D(j,"onclosetag",j.tagName);var Ae={};for(var ht in Ee.ns)Ae[ht]=Ee.ns[ht];var Rt=j.tags[j.tags.length-1]||j;j.opt.xmlns&&Ee.ns!==Rt.ns&&Object.keys(Ee.ns).forEach(function(Ze){var Dr=Ee.ns[Ze];D(j,"onclosenamespace",{prefix:Ze,uri:Dr})})}A===0&&(j.closedRoot=!0),j.tagName=j.attribValue=j.attribName="",j.attribList.length=0,j.state=T.TEXT}function Z(j){var A=j.entity,W=A.toLowerCase(),V,se="";return j.ENTITIES[A]?j.ENTITIES[A]:j.ENTITIES[W]?j.ENTITIES[W]:(A=W,A.charAt(0)==="#"&&(A.charAt(1)==="x"?(A=A.slice(2),V=parseInt(A,16),se=V.toString(16)):(A=A.slice(1),V=parseInt(A,10),se=V.toString(10))),A=A.replace(/^0+/,""),isNaN(V)||se.toLowerCase()!==A?(G(j,"Invalid character entity"),"&"+j.entity+";"):String.fromCodePoint(V))}function $(j,A){A==="<"?(j.state=T.OPEN_WAKA,j.startTagPosition=j.position):_(A)||(G(j,"Non-whitespace before first tag."),j.textNode=A,j.state=T.TEXT)}function q(j,A){var W="";return A<j.length&&(W=j.charAt(A)),W}function Y(j){var A=this;if(this.error)throw this.error;if(A.closed)return U(A,"Cannot write after close. Assign an onready handler.");if(j===null)return H(A);typeof j=="object"&&(j=j.toString());for(var W=0,V="";V=q(j,W++),A.c=V,!!V;)switch(A.trackPosition&&(A.position++,V===`
|
||
`?(A.line++,A.column=0):A.column++),A.state){case T.BEGIN:if(A.state=T.BEGIN_WHITESPACE,V==="\uFEFF")continue;$(A,V);continue;case T.BEGIN_WHITESPACE:$(A,V);continue;case T.TEXT:if(A.sawRoot&&!A.closedRoot){for(var se=W-1;V&&V!=="<"&&V!=="&";)V=q(j,W++),V&&A.trackPosition&&(A.position++,V===`
|
||
`?(A.line++,A.column=0):A.column++);A.textNode+=j.substring(se,W-1)}V==="<"&&!(A.sawRoot&&A.closedRoot&&!A.strict)?(A.state=T.OPEN_WAKA,A.startTagPosition=A.position):(!_(V)&&(!A.sawRoot||A.closedRoot)&&G(A,"Text data outside of root node."),V==="&"?A.state=T.TEXT_ENTITY:A.textNode+=V);continue;case T.SCRIPT:V==="<"?A.state=T.SCRIPT_ENDING:A.script+=V;continue;case T.SCRIPT_ENDING:V==="/"?A.state=T.CLOSE_TAG:(A.script+="<"+V,A.state=T.SCRIPT);continue;case T.OPEN_WAKA:if(V==="!")A.state=T.SGML_DECL,A.sgmlDecl="";else if(!_(V))if(O(h,V))A.state=T.OPEN_TAG,A.tagName=V;else if(V==="/")A.state=T.CLOSE_TAG,A.tagName="";else if(V==="?")A.state=T.PROC_INST,A.procInstName=A.procInstBody="";else{if(G(A,"Unencoded <"),A.startTagPosition+1<A.position){var be=A.position-A.startTagPosition;V=new Array(be).join(" ")+V}A.textNode+="<"+V,A.state=T.TEXT}continue;case T.SGML_DECL:(A.sgmlDecl+V).toUpperCase()===c?(D(A,"onopencdata"),A.state=T.CDATA,A.sgmlDecl="",A.cdata=""):A.sgmlDecl+V==="--"?(A.state=T.COMMENT,A.comment="",A.sgmlDecl=""):(A.sgmlDecl+V).toUpperCase()===d?(A.state=T.DOCTYPE,(A.doctype||A.sawRoot)&&G(A,"Inappropriately located doctype declaration"),A.doctype="",A.sgmlDecl=""):V===">"?(D(A,"onsgmldeclaration",A.sgmlDecl),A.sgmlDecl="",A.state=T.TEXT):(w(V)&&(A.state=T.SGML_DECL_QUOTED),A.sgmlDecl+=V);continue;case T.SGML_DECL_QUOTED:V===A.q&&(A.state=T.SGML_DECL,A.q=""),A.sgmlDecl+=V;continue;case T.DOCTYPE:V===">"?(A.state=T.TEXT,D(A,"ondoctype",A.doctype),A.doctype=!0):(A.doctype+=V,V==="["?A.state=T.DOCTYPE_DTD:w(V)&&(A.state=T.DOCTYPE_QUOTED,A.q=V));continue;case T.DOCTYPE_QUOTED:A.doctype+=V,V===A.q&&(A.q="",A.state=T.DOCTYPE);continue;case T.DOCTYPE_DTD:A.doctype+=V,V==="]"?A.state=T.DOCTYPE:w(V)&&(A.state=T.DOCTYPE_DTD_QUOTED,A.q=V);continue;case T.DOCTYPE_DTD_QUOTED:A.doctype+=V,V===A.q&&(A.state=T.DOCTYPE_DTD,A.q="");continue;case T.COMMENT:V==="-"?A.state=T.COMMENT_ENDING:A.comment+=V;continue;case T.COMMENT_ENDING:V==="-"?(A.state=T.COMMENT_ENDED,A.comment=B(A.opt,A.comment),A.comment&&D(A,"oncomment",A.comment),A.comment=""):(A.comment+="-"+V,A.state=T.COMMENT);continue;case T.COMMENT_ENDED:V!==">"?(G(A,"Malformed comment"),A.comment+="--"+V,A.state=T.COMMENT):A.state=T.TEXT;continue;case T.CDATA:V==="]"?A.state=T.CDATA_ENDING:A.cdata+=V;continue;case T.CDATA_ENDING:V==="]"?A.state=T.CDATA_ENDING_2:(A.cdata+="]"+V,A.state=T.CDATA);continue;case T.CDATA_ENDING_2:V===">"?(A.cdata&&D(A,"oncdata",A.cdata),D(A,"onclosecdata"),A.cdata="",A.state=T.TEXT):V==="]"?A.cdata+="]":(A.cdata+="]]"+V,A.state=T.CDATA);continue;case T.PROC_INST:V==="?"?A.state=T.PROC_INST_ENDING:_(V)?A.state=T.PROC_INST_BODY:A.procInstName+=V;continue;case T.PROC_INST_BODY:if(!A.procInstBody&&_(V))continue;V==="?"?A.state=T.PROC_INST_ENDING:A.procInstBody+=V;continue;case T.PROC_INST_ENDING:V===">"?(D(A,"onprocessinginstruction",{name:A.procInstName,body:A.procInstBody}),A.procInstName=A.procInstBody="",A.state=T.TEXT):(A.procInstBody+="?"+V,A.state=T.PROC_INST_BODY);continue;case T.OPEN_TAG:O(g,V)?A.tagName+=V:(ie(A),V===">"?Q(A):V==="/"?A.state=T.OPEN_TAG_SLASH:(_(V)||G(A,"Invalid character in tag name"),A.state=T.ATTRIB));continue;case T.OPEN_TAG_SLASH:V===">"?(Q(A,!0),re(A)):(G(A,"Forward-slash in opening tag not followed by >"),A.state=T.ATTRIB);continue;case T.ATTRIB:if(_(V))continue;V===">"?Q(A):V==="/"?A.state=T.OPEN_TAG_SLASH:O(h,V)?(A.attribName=V,A.attribValue="",A.state=T.ATTRIB_NAME):G(A,"Invalid attribute name");continue;case T.ATTRIB_NAME:V==="="?A.state=T.ATTRIB_VALUE:V===">"?(G(A,"Attribute without value"),A.attribValue=A.attribName,z(A),Q(A)):_(V)?A.state=T.ATTRIB_NAME_SAW_WHITE:O(g,V)?A.attribName+=V:G(A,"Invalid attribute name");continue;case T.ATTRIB_NAME_SAW_WHITE:if(V==="=")A.state=T.ATTRIB_VALUE;else{if(_(V))continue;G(A,"Attribute without value"),A.tag.attributes[A.attribName]="",A.attribValue="",D(A,"onattribute",{name:A.attribName,value:""}),A.attribName="",V===">"?Q(A):O(h,V)?(A.attribName=V,A.state=T.ATTRIB_NAME):(G(A,"Invalid attribute name"),A.state=T.ATTRIB)}continue;case T.ATTRIB_VALUE:if(_(V))continue;w(V)?(A.q=V,A.state=T.ATTRIB_VALUE_QUOTED):(G(A,"Unquoted attribute value"),A.state=T.ATTRIB_VALUE_UNQUOTED,A.attribValue=V);continue;case T.ATTRIB_VALUE_QUOTED:if(V!==A.q){V==="&"?A.state=T.ATTRIB_VALUE_ENTITY_Q:A.attribValue+=V;continue}z(A),A.q="",A.state=T.ATTRIB_VALUE_CLOSED;continue;case T.ATTRIB_VALUE_CLOSED:_(V)?A.state=T.ATTRIB:V===">"?Q(A):V==="/"?A.state=T.OPEN_TAG_SLASH:O(h,V)?(G(A,"No whitespace between attributes"),A.attribName=V,A.attribValue="",A.state=T.ATTRIB_NAME):G(A,"Invalid attribute name");continue;case T.ATTRIB_VALUE_UNQUOTED:if(!x(V)){V==="&"?A.state=T.ATTRIB_VALUE_ENTITY_U:A.attribValue+=V;continue}z(A),V===">"?Q(A):A.state=T.ATTRIB;continue;case T.CLOSE_TAG:if(A.tagName)V===">"?re(A):O(g,V)?A.tagName+=V:A.script?(A.script+="</"+A.tagName,A.tagName="",A.state=T.SCRIPT):(_(V)||G(A,"Invalid tagname in closing tag"),A.state=T.CLOSE_TAG_SAW_WHITE);else{if(_(V))continue;E(h,V)?A.script?(A.script+="</"+V,A.state=T.SCRIPT):G(A,"Invalid tagname in closing tag."):A.tagName=V}continue;case T.CLOSE_TAG_SAW_WHITE:if(_(V))continue;V===">"?re(A):G(A,"Invalid characters in closing tag");continue;case T.TEXT_ENTITY:case T.ATTRIB_VALUE_ENTITY_Q:case T.ATTRIB_VALUE_ENTITY_U:var Ee,Ae;switch(A.state){case T.TEXT_ENTITY:Ee=T.TEXT,Ae="textNode";break;case T.ATTRIB_VALUE_ENTITY_Q:Ee=T.ATTRIB_VALUE_QUOTED,Ae="attribValue";break;case T.ATTRIB_VALUE_ENTITY_U:Ee=T.ATTRIB_VALUE_UNQUOTED,Ae="attribValue";break}if(V===";")if(A.opt.unparsedEntities){var ht=Z(A);A.entity="",A.state=Ee,A.write(ht)}else A[Ae]+=Z(A),A.entity="",A.state=Ee;else O(A.entity.length?b:y,V)?A.entity+=V:(G(A,"Invalid character in entity name"),A[Ae]+="&"+A.entity+V,A.entity="",A.state=Ee);continue;default:throw new Error(A,"Unknown state: "+A.state)}return A.position>=A.bufferCheckPosition&&n(A),A}return String.fromCodePoint||function(){var j=String.fromCharCode,A=Math.floor,W=function(){var V=16384,se=[],be,Ee,Ae=-1,ht=arguments.length;if(!ht)return"";for(var Rt="";++Ae<ht;){var Ze=Number(arguments[Ae]);if(!isFinite(Ze)||Ze<0||Ze>1114111||A(Ze)!==Ze)throw RangeError("Invalid code point: "+Ze);Ze<=65535?se.push(Ze):(Ze-=65536,be=(Ze>>10)+55296,Ee=Ze%1024+56320,se.push(be,Ee)),(Ae+1===ht||se.length>V)&&(Rt+=j.apply(null,se),se.length=0)}return Rt};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:W,configurable:!0,writable:!0}):String.fromCodePoint=W}(),t},wRt=kgn()});function Che(t){let e=qgn(t),r=wRt.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]),xRt(n)}var She,CRt,qgn,xRt,ORt=v(()=>{VY();yL();d2e();SRt();She=`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}
|
||
\`\`\``,CRt=class extends gL{constructor(e){super(e);M(this,"tags");M(this,"lc_namespace",["langchain_core","output_parsers"]);M(this,"lc_serializable",!0);this.tags=e?.tags}static lc_name(){return"XMLOutputParser"}_diff(e,r){if(r)return e?n6(e,r):[{op:"replace",path:"",value:r}]}async parsePartialResult(e){return Che(e[0].text)}async parse(e){return Che(e)}getFormatInstructions(){return!!(this.tags&&this.tags.length>0)?She.replace("{tags}",this.tags?.join(", ")??""):She}},qgn=t=>t.split(`
|
||
`).map(e=>e.replace(/^\s+/,"")).join(`
|
||
`).trim(),xRt=t=>{if(Object.keys(t).length===0)return{};let e={};return t.children.length>0?(e[t.name]=t.children.map(xRt),e):(e[t.name]=t.text??void 0,e)}});var Bgn,_O=v(()=>{Do();pY();O6();yL();fRt();yRt();bRt();vRt();f2e();ORt();Bgn={};Et(Bgn,{AsymmetricStructuredOutputParser:()=>_Rt,BaseCumulativeTransformOutputParser:()=>gL,BaseLLMOutputParser:()=>Az,BaseOutputParser:()=>SN,BaseTransformOutputParser:()=>CN,BytesOutputParser:()=>dRt,CommaSeparatedListOutputParser:()=>pRt,CustomListOutputParser:()=>mRt,JsonMarkdownStructuredOutputParser:()=>c2e,JsonOutputParser:()=>Ov,ListOutputParser:()=>T6,MarkdownListOutputParser:()=>gRt,NumberedListOutputParser:()=>hRt,OutputParserException:()=>eh,StringOutputParser:()=>whe,StructuredOutputParser:()=>Jw,XMLOutputParser:()=>CRt,XML_FORMAT_INSTRUCTIONS:()=>She,parseJsonMarkdown:()=>fY,parsePartialJson:()=>UU,parseXMLMarkdown:()=>Che})});var Kw,E6=v(()=>{Gh();Kw=class extends Lo{constructor(e){super(e);M(this,"lc_serializable",!0);M(this,"lc_namespace",["langchain_core","prompts",this._getPromptType()]);M(this,"inputVariables");M(this,"outputParser");M(this,"partialVariables");M(this,"metadata");M(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 Ugn,xhe,LQ,FQ,p2e,kQ=v(()=>{Do();V$();G$();iO();Ugn={};Et(Ugn,{BasePromptValue:()=>xhe,ChatPromptValue:()=>FQ,ImagePromptValue:()=>p2e,StringPromptValue:()=>LQ});xhe=class extends Vh{},LQ=class extends xhe{constructor(e){super({value:e});M(this,"lc_namespace",["langchain_core","prompt_values"]);M(this,"lc_serializable",!0);M(this,"value");this.value=e}static lc_name(){return"StringPromptValue"}toString(){return this.value}toChatMessages(){return[new su(this.value)]}},FQ=class extends xhe{constructor(e){Array.isArray(e)&&(e={messages:e});super(e);M(this,"lc_namespace",["langchain_core","prompt_values"]);M(this,"lc_serializable",!0);M(this,"messages");this.messages=e.messages}static lc_name(){return"ChatPromptValue"}toString(){return rl(this.messages)}toChatMessages(){return this.messages}},p2e=class extends xhe{constructor(e){"imageUrl"in e||(e={imageUrl:e});super(e);M(this,"lc_namespace",["langchain_core","prompt_values"]);M(this,"lc_serializable",!0);M(this,"imageUrl");M(this,"value");this.imageUrl=e.imageUrl}static lc_name(){return"ImagePromptValue"}toString(){return this.imageUrl.url}toChatMessages(){return[new su({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}}});var xN,qQ=v(()=>{kQ();E6();xN=class extends Kw{async formatPromptValue(t){let e=await this.format(t);return new LQ(e)}}});function h2e(t){return typeof t=="function"}function Hgn(t){return M6(t)?"array":typeof t}function m2e(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function TRt(t,e){return t!=null&&typeof t=="object"&&e in t}function Vgn(t,e){return t!=null&&typeof t!="object"&&t.hasOwnProperty&&t.hasOwnProperty(e)}function Kgn(t,e){return Jgn.call(t,e)}function Ggn(t){return!Kgn(Wgn,t)}function Xgn(t){return String(t).replace(/[&<>"'`=\/]/g,function(r){return Zgn[r]})}function ryn(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(T){if(typeof T=="string"&&(T=T.split(Qgn,2)),!M6(T)||T.length!==2)throw new Error("Invalid tags: "+T);d=new RegExp(m2e(T[0])+"\\s*"),f=new RegExp("\\s*"+m2e(T[1])),p=new RegExp("\\s*"+m2e("}"+T[1]))}m(e||Ww.tags);for(var h=new UQ(t),g,y,b,_,w,x;!h.eos();){if(g=h.pos,b=h.scanUntil(d),b)for(var O=0,E=b.length;O<E;++O)_=b.charAt(O),Ggn(_)?(i.push(o.length),u+=_):(s=!0,r=!0,u+=" "),o.push(["text",_,g,g+1]),g+=1,_===`
|
||
`&&(c(),u="",l=0,r=!1);if(!h.scan(d))break;if(a=!0,y=h.scan(tyn)||"name",h.scan(Ygn),y==="="?(b=h.scanUntil(ERt),h.scan(ERt),h.scanUntil(f)):y==="{"?(b=h.scanUntil(p),h.scan(eyn),h.scanUntil(f),y="&"):b=h.scanUntil(f),!h.scan(f))throw new Error("Unclosed tag at "+h.pos);if(y==">"?w=[y,b,g,h.pos,u,l,r]:w=[y,b,g,h.pos],l++,o.push(w),y==="#"||y==="^")n.push(w);else if(y==="/"){if(x=n.pop(),!x)throw new Error('Unopened section "'+b+'" at '+g);if(x[1]!==b)throw new Error('Unclosed section "'+x[1]+'" at '+g)}else y==="name"||y==="{"||y==="&"?s=!0:y==="="&&m(b)}if(c(),x=n.pop(),x)throw new Error('Unclosed section "'+x[1]+'" at '+h.pos);return oyn(nyn(o))}function nyn(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 oyn(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 UQ(t){this.string=t,this.tail=t,this.pos=0}function P6(t,e){this.view=t,this.cache={".":this.view},this.parent=e}function nb(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}var zgn,M6,Jgn,Wgn,Zgn,Ygn,Qgn,ERt,eyn,tyn,Ww,BQ,Ohe,PRt=v(()=>{zgn=Object.prototype.toString,M6=Array.isArray||function(e){return zgn.call(e)==="[object Array]"};Jgn=RegExp.prototype.test;Wgn=/\S/;Zgn={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};Ygn=/\s*/,Qgn=/\s+/,ERt=/\s*=/,eyn=/\s*\}/,tyn=/#|\^|\/|>|\{|&|=|!/;UQ.prototype.eos=function(){return this.tail===""};UQ.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};UQ.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};P6.prototype.push=function(e){return new P6(e,this)};P6.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=TRt(i,a[s])||Vgn(i,a[s])),i=i[a[s++]];else i=o.view[e],u=TRt(o.view,e);if(u){n=i;break}o=o.parent}r[e]=n}return h2e(n)&&(n=n.call(this.view)),n};nb.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};nb.prototype.parse=function(e,r){var n=this.templateCache,o=e+":"+(r||Ww.tags).join(":"),i=typeof n<"u",a=i?n.get(o):void 0;return a==null&&(a=ryn(e,r),i&&n.set(o,a)),a};nb.prototype.render=function(e,r,n,o){var i=this.getConfigTags(o),a=this.parse(e,i),s=r instanceof P6?r:new P6(r,void 0);return this.renderTokens(a,s,n,e,o)};nb.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};nb.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(M6(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(h2e(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}};nb.prototype.renderInverted=function(e,r,n,o,i){var a=r.lookup(e[1]);if(!a||M6(a)&&a.length===0)return this.renderTokens(e[4],r,n,o,i)};nb.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(`
|
||
`)};nb.prototype.renderPartial=function(e,r,n,o){if(n){var i=this.getConfigTags(o),a=h2e(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)}}};nb.prototype.unescapedValue=function(e,r){var n=r.lookup(e[1]);if(n!=null)return n};nb.prototype.escapedValue=function(e,r,n){var o=this.getConfigEscape(n)||Ww.escape,i=r.lookup(e[1]);if(i!=null)return typeof i=="number"&&o===Ww.escape?String(i):o(i)};nb.prototype.rawValue=function(e){return e[1]};nb.prototype.getConfigTags=function(e){return M6(e)?e:e&&typeof e=="object"?e.tags:void 0};nb.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!M6(e))return e.escape};Ww={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){BQ.templateCache=t},get templateCache(){return BQ.templateCache}},BQ=new nb;Ww.clearCache=function(){return BQ.clearCache()};Ww.parse=function(e,r){return BQ.parse(e,r)};Ww.render=function(e,r,n,o){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Hgn(e)+'" was given as the first argument for mustache#render(template, view, partials)');return BQ.render(e,r,n,o)};Ww.escape=Xgn;Ww.Scanner=UQ;Ww.Context=P6;Ww.Writer=nb;Ohe=Ww});function MRt(){Ohe.escape=t=>t}var Iz,RRt,R6,g2e,y2e,zQ,b2e,Yg,Nz,ON,jz=v(()=>{mY();PRt();Iz=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},RRt=(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=RRt(n[4],o);r.push(...i)}}else r.push({type:"literal",text:n[1]});return r},R6=t=>{MRt();let e=Ohe.parse(t);return RRt(e)},g2e=(t,e)=>Iz(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},""),y2e=(t,e)=>(MRt(),Ohe.render(t,e)),zQ={"f-string":g2e,mustache:y2e},b2e={"f-string":Iz,mustache:R6},Yg=(t,e,r)=>{try{return zQ[e](t,r)}catch(n){throw H$(n,"INVALID_PROMPT_INPUT")}},Nz=(t,e)=>b2e[e](t),ON=(t,e,r)=>{if(!(e in zQ)){let n=Object.keys(zQ);throw new Error(`Invalid template format. Got \`${e}\`;
|
||
should be one of ${n}`)}try{let n=r.reduce((o,i)=>(o[i]="foo",o),{});Array.isArray(t)?t.forEach(o=>{if(o.type==="text"&&"text"in o&&typeof o.text=="string")Yg(o.text,e,n);else if(o.type==="image_url"){if(typeof o.image_url=="string")Yg(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;Yg(i,e,n)}}else throw new Error(`Invalid message template received. ${JSON.stringify(o,null,2)}`)}):Yg(t,e,n)}catch(n){throw new Error(`Invalid prompt schema: ${n.message}`)}}});var uu,The=v(()=>{qQ();jz();uu=class HQ extends xN{constructor(r){super(r);M(this,"template");M(this,"templateFormat","f-string");M(this,"validateTemplate",!0);M(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))),ON(this.template,this.templateFormat,n)}}static lc_name(){return"PromptTemplate"}_getPromptType(){return"prompt"}async format(r){let n=await this.mergePartialAndUserVariables(r);return Yg(this.template,this.templateFormat,n)}static fromExamples(r,n,o,i=`
|
||
|
||
`,a=""){let s=[a,...r,n].join(i);return new HQ({inputVariables:o,template:s})}static fromTemplate(r,n){let{templateFormat:o="f-string",...i}=n??{},a=new Set;return Nz(r,o).forEach(s=>{s.type==="variable"&&a.add(s.name)}),new HQ({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 HQ(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 HQ({inputVariables:r.input_variables,template:r.template,templateFormat:r.template_format})}}});var A6,_2e=v(()=>{kQ();E6();jz();A6=class ARt extends Kw{constructor(r){super(r);M(this,"lc_namespace",["langchain_core","prompts","image"]);M(this,"template");M(this,"templateFormat","f-string");M(this,"validateTemplate",!0);M(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))),ON([{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 ARt(i)}async format(r){let n={};for(let[s,u]of Object.entries(this.template))typeof u=="string"?n[s]=Yg(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 p2e(n)}}});function v2e(t,e){let r=[];for(let n of Object.values(t))if(typeof n=="string")Nz(n,e).forEach(o=>{o.type==="variable"&&r.push(o.name)});else if(Array.isArray(n))for(let o of n)typeof o=="string"?Nz(o,e).forEach(i=>{i.type==="variable"&&r.push(i.name)}):typeof o=="object"&&r.push(...v2e(o,e));else typeof n=="object"&&n!==null&&r.push(...v2e(n,e));return Array.from(new Set(r))}function w2e(t,e,r){let n={};for(let[o,i]of Object.entries(t))if(typeof i=="string")n[o]=Yg(i,r,e);else if(Array.isArray(i)){let a=[];for(let s of i)typeof s=="string"?a.push(Yg(s,r,e)):typeof s=="object"&&a.push(w2e(s,e,r));n[o]=a}else typeof i=="object"&&i!==null?n[o]=w2e(i,e,r):n[o]=i;return n}var VQ,S2e=v(()=>{Gh();jz();VQ=class extends Lo{constructor(e){let r=e.templateFormat??"f-string",n=v2e(e.template,r);super({inputVariables:n,...e});M(this,"lc_namespace",["langchain_core","prompts","dict"]);M(this,"lc_serializable",!0);M(this,"template");M(this,"templateFormat");M(this,"inputVariables");this.template=e.template,this.templateFormat=r,this.inputVariables=n}static lc_name(){return"DictPromptTemplate"}async format(e){return w2e(this.template,e,this.templateFormat)}async invoke(e){return await this._callWithConfig(this.format.bind(this),e,{runType:"prompt"})}}});function iyn(t){return t===null||typeof t!="object"||Array.isArray(t)?!1:Object.keys(t).length===1&&"text"in t&&typeof t.text=="string"}function ayn(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 syn(t){return typeof t.formatMessages=="function"}function uyn(t,e){if(syn(t)||Xm(t))return t;if(Array.isArray(t)&&t[0]==="placeholder"){let o=t[1];if(e?.templateFormat==="mustache"&&typeof o=="string"&&o.slice(0,2)==="{{"&&o.slice(-2)==="}}"){let i=o.slice(2,-2);return new vO({variableName:i,optional:!0})}else if(typeof o=="string"&&o[0]==="{"&&o[o.length-1]==="}"){let i=o.slice(1,-1);return new vO({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=Iw(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 a_.fromTemplate(n,e);if(r._getType()==="ai")return Phe.fromTemplate(n,e);if(r._getType()==="system")return Gw.fromTemplate(n,e);if(cd.isInstance(r))return x2e.fromTemplate(r.content,r.role,e);throw new Error(`Could not coerce message prompt template from input. Received message type: "${r._getType()}".`)}function lyn(t){return t.constructor.lc_name()==="MessagesPlaceholder"}var JQ,vO,C2e,KQ,x2e,O2e,a_,Phe,Gw,hd,WQ=v(()=>{Vg();V0();SY();G$();CY();mY();iO();Gh();$s();kQ();E6();qQ();jz();The();_2e();S2e();JQ=class extends Lo{constructor(){super(...arguments);M(this,"lc_namespace",["langchain_core","prompts","chat"]);M(this,"lc_serializable",!0)}async invoke(e,r){return this._callWithConfig(n=>this.formatMessages(n),e,{...r,runType:"prompt"})}},vO=class extends JQ{constructor(e){typeof e=="string"&&(e={variableName:e});super(e);M(this,"variableName");M(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(Iw):n=[Iw(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}},C2e=class extends JQ{constructor(e){"prompt"in e||(e={prompt:e});super(e);M(this,"prompt");this.prompt=e.prompt}get inputVariables(){return this.prompt.inputVariables}async formatMessages(e){return[await this.format(e)]}},KQ=class extends Kw{constructor(t){super(t)}async format(t){return(await this.formatPromptValue(t)).toString()}async formatPromptValue(t){let e=await this.formatMessages(t);return new FQ(e)}},x2e=class extends C2e{constructor(e,r){"prompt"in e||(e={prompt:e,role:r});super(e);M(this,"role");this.role=e.role}static lc_name(){return"ChatMessagePromptTemplate"}async format(e){return new cd(await this.prompt.format(e),this.role)}static fromTemplate(e,r,n){return new this(uu.fromTemplate(e,{templateFormat:n?.templateFormat}),r)}};O2e=class extends JQ{constructor(e,r){"prompt"in e||(e={prompt:e});super(e);M(this,"lc_namespace",["langchain_core","prompts","chat"]);M(this,"lc_serializable",!0);M(this,"inputVariables",[]);M(this,"additionalOptions",{});M(this,"prompt");M(this,"messageClass");M(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(uu.fromTemplate(e,r));let n=[];for(let o of e)if(typeof o=="string")n.push(uu.fromTemplate(o,r));else if(o!==null)if(iyn(o)){let i="";typeof o.text=="string"&&(i=o.text??"");let a={...r,additionalContentFields:o};n.push(uu.fromTemplate(i,a))}else if(ayn(o)){let i=o.image_url??"",a,s=[];if(typeof i=="string"){let u;r?.templateFormat==="mustache"?u=R6(i):u=Iz(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 A6({template:i,inputVariables:s,templateFormat:r?.templateFormat,additionalContentFields:o})}else if(typeof i=="object"){if("url"in i){let u;r?.templateFormat==="mustache"?u=R6(i.url):u=Iz(i.url),s=u.flatMap(l=>l.type==="variable"?[l.name]:[])}else s=[];a=new A6({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 VQ({template:o,templateFormat:r?.templateFormat}));return new this({prompt:n,additionalOptions:r})}async format(e){if(this.prompt instanceof xN){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 xN){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 A6){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 VQ){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)]}},a_=class extends O2e{static _messageClass(){return su}static lc_name(){return"HumanMessagePromptTemplate"}},Phe=class extends O2e{static _messageClass(){return li}static lc_name(){return"AIMessagePromptTemplate"}},Gw=class extends O2e{static _messageClass(){return Ym}static lc_name(){return"SystemMessagePromptTemplate"}};hd=class Ehe extends KQ{constructor(r){super(r);M(this,"promptMessages");M(this,"validateTemplate",!0);M(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 Jc))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 uu.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 Jc)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)&&!(lyn(i)&&i.optional))throw H$(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 Ehe(i)}static fromTemplate(r,n){let o=uu.fromTemplate(r,n),i=new a_({prompt:o});return this.fromMessages([i])}static fromMessages(r,n){let o=r.reduce((s,u)=>s.concat(u instanceof Ehe?u.promptMessages:[uyn(u,n)]),[]),i=r.reduce((s,u)=>u instanceof Ehe?Object.assign(s,u.partialVariables):s,Object.create(null)),a=new Set;for(let s of o)if(!(s instanceof Jc))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 IRt,NRt,DRt=v(()=>{qQ();jz();The();WQ();IRt=class T2e extends xN{constructor(r){super(r);M(this,"lc_serializable",!1);M(this,"examples");M(this,"exampleSelector");M(this,"examplePrompt");M(this,"suffix","");M(this,"exampleSeparator",`
|
||
|
||
`);M(this,"prefix","");M(this,"templateFormat","f-string");M(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))),ON(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 T2e(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 Yg(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 uu.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 T2e({inputVariables:r.input_variables,examplePrompt:o,examples:i,exampleSeparator:r.example_separator,prefix:r.prefix,suffix:r.suffix,templateFormat:r.template_format})}},NRt=class jRt extends KQ{constructor(r){super(r);M(this,"lc_serializable",!0);M(this,"examples");M(this,"exampleSelector");M(this,"examplePrompt");M(this,"suffix","");M(this,"exampleSeparator",`
|
||
|
||
`);M(this,"prefix","");M(this,"templateFormat","f-string");M(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))),ON(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 Yg(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 jRt(i)}}});var $Rt,LRt=v(()=>{E6();WQ();$Rt=class Mhe extends Kw{constructor(r){super({...r,inputVariables:[]});M(this,"pipelinePrompts");M(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=Mhe.extractRequiredInputValues(n,i.inputVariables);i instanceof hd?n[o]=await i.formatMessages(a):n[o]=await i.format(a)}return Mhe.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 Mhe(n)}serialize(){throw new Error("Not implemented.")}_getPromptType(){return"pipeline"}}});function FRt(t){return typeof t=="object"&&t!=null&&"withStructuredOutput"in t&&typeof t.withStructuredOutput=="function"}function cyn(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 kRt,BRt=v(()=>{Gh();WQ();kRt=class qRt extends hd{constructor(r){super(r);M(this,"schema");M(this,"method");M(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(FRt(r))return super.pipe(r.withStructuredOutput(this.schema));if(cyn(r)&&FRt(r.bound))return super.pipe(new Vw({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 qRt.fromMessages(r,{schema:n,method:o})}}});var dyn,Tv=v(()=>{Do();E6();qQ();jz();The();_2e();S2e();WQ();DRt();LRt();BRt();dyn={};Et(dyn,{AIMessagePromptTemplate:()=>Phe,BaseChatPromptTemplate:()=>KQ,BaseMessagePromptTemplate:()=>JQ,BaseMessageStringPromptTemplate:()=>C2e,BasePromptTemplate:()=>Kw,BaseStringPromptTemplate:()=>xN,ChatMessagePromptTemplate:()=>x2e,ChatPromptTemplate:()=>hd,DEFAULT_FORMATTER_MAPPING:()=>zQ,DEFAULT_PARSER_MAPPING:()=>b2e,DictPromptTemplate:()=>VQ,FewShotChatMessagePromptTemplate:()=>NRt,FewShotPromptTemplate:()=>IRt,HumanMessagePromptTemplate:()=>a_,ImagePromptTemplate:()=>A6,MessagesPlaceholder:()=>vO,PipelinePromptTemplate:()=>$Rt,PromptTemplate:()=>uu,StructuredPrompt:()=>kRt,SystemMessagePromptTemplate:()=>Gw,checkValidTemplate:()=>ON,interpolateFString:()=>g2e,interpolateMustache:()=>y2e,parseFString:()=>Iz,parseMustache:()=>R6,parseTemplate:()=>Nz,renderTemplate:()=>Yg})});var fyn,I6,Rhe=v(()=>{fyn=Object.defineProperty,I6=(t,e)=>{for(var r in e)fyn(t,r,{get:e[r],enumerable:!0})}});var pyn,GQ,E2e=v(()=>{Rhe();pyn={};I6(pyn,{formatDocumentsAsString:()=>GQ});GQ=t=>t.map(e=>e.pageContent).join(`
|
||
|
||
`)});function th(t,e){let r=`atom${++myn}`,n={toString(){return(Pl.env?Pl.env.MODE:void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof t=="function"?n.read=t:(n.init=t,n.read=hyn,n.write=gyn),e&&(n.write=e),n}function hyn(t){return t(this)}function gyn(t,e,r){return e(this,typeof r=="function"?r(t(this)):r)}var Pl,myn,URt,P2e,M2e,Ihe,A2e,yyn,byn,I2e,zRt,Ahe,JRt,HRt,N6,R2e,_yn,vyn,VRt,bL,KRt,j6,ZQ,WRt,N2e=v(()=>{Pl={},myn=0;URt=(t,e)=>t.unstable_is?t.unstable_is(e):e===t,P2e=t=>"init"in t,M2e=t=>!!t.write,Ihe=new WeakMap,A2e=t=>{var e;return I2e(t)&&!((e=Ihe.get(t))!=null&&e[1])},yyn=(t,e)=>{let r=Ihe.get(t);if(r)r[1]=!0,r[0].forEach(n=>n(e));else if((Pl.env?Pl.env.MODE:void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},byn=t=>{if(Ihe.has(t))return;let e=[new Set,!1];Ihe.set(t,e);let r=()=>{e[1]=!0};t.then(r,r),t.onCancel=n=>{e[0].add(n)}},I2e=t=>typeof t?.then=="function",zRt=t=>"v"in t||"e"in t,Ahe=t=>{if("e"in t)throw t.e;if((Pl.env?Pl.env.MODE:void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v},JRt=(t,e,r)=>{r.p.has(t)||(r.p.add(t),e.then(()=>{r.p.delete(t)},()=>{r.p.delete(t)}))},HRt=(t,e,r,n,o)=>{var i;if((Pl.env?Pl.env.MODE:void 0)!=="production"&&n===e)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),A2e(r.v)&&JRt(e,r.v,o),(i=o.m)==null||i.t.add(e),t&&_yn(t,n,e)},N6=()=>[new Map,new Map,new Set],R2e=(t,e,r)=>{t[0].has(e)||t[0].set(e,new Set),t[1].set(e,r)},_yn=(t,e,r)=>{let n=t[0].get(e);n&&n.add(r)},vyn=(t,e)=>t[0].get(e),VRt=(t,e)=>{t[2].add(e)},bL=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},KRt=(...[t,e,r,n])=>{let o;(Pl.env?Pl.env.MODE:void 0)!=="production"&&(o=new Set);let i=(_,w,x)=>{let O="v"in w,E=w.v,T=A2e(w.v)?w.v:null;if(I2e(x)){byn(x);for(let R of w.d.keys())JRt(_,x,t(R));w.v=x,delete w.e}else w.v=x,delete w.e;(!O||!Object.is(E,w.v))&&(++w.n,T&&yyn(T,x))},a=(_,w,x)=>{var O;let E=t(w);if(zRt(E)&&(E.m&&!x?.has(w)||Array.from(E.d).every(([B,U])=>a(_,B,x).n===U)))return E;E.d.clear();let T=!0,R=B=>{if(URt(w,B)){let H=t(B);if(!zRt(H))if(P2e(B))i(B,H,B.init);else throw new Error("no atom init");return Ahe(H)}let U=a(_,B,x);try{return Ahe(U)}finally{if(T)HRt(_,w,E,B,U);else{let H=N6();HRt(H,w,E,B,U),p(H,w,E),bL(H)}}},N,D,F={get signal(){return N||(N=new AbortController),N.signal},get setSelf(){return(Pl.env?Pl.env.MODE:void 0)!=="production"&&!M2e(w)&&console.warn("setSelf function cannot be used with read-only atom"),!D&&M2e(w)&&(D=(...B)=>{if((Pl.env?Pl.env.MODE:void 0)!=="production"&&T&&console.warn("setSelf function cannot be called in sync"),!T)return f(w,...B)}),D}};try{let B=e(w,R,F);if(i(w,E,B),I2e(B)){(O=B.onCancel)==null||O.call(B,()=>N?.abort());let U=()=>{if(E.m){let H=N6();p(H,w,E),bL(H)}};B.then(U,U)}return E}catch(B){return delete E.v,E.e=B,++E.n,E}finally{T=!1}},s=_=>Ahe(a(void 0,_)),u=(_,w,x)=>{var O,E;let T=new Map;for(let R of((O=x.m)==null?void 0:O.t)||[])T.set(R,t(R));for(let R of x.p)T.set(R,t(R));return(E=vyn(_,w))==null||E.forEach(R=>{T.set(R,t(R))}),T};function l(_,w,x){let O=[],E=new Set,T=new Set,R=[[w,x]];for(;R.length>0;){let[N,D]=R[R.length-1];if(T.has(N)){R.pop();continue}if(E.has(N)){O.push([N,D,D.n]),T.add(N),R.pop();continue}E.add(N);for(let[F,B]of u(_,N,D))N!==F&&!E.has(F)&&R.push([F,B])}return[O,T]}let c=(_,w,x)=>{let[O,E]=l(_,w,x),T=new Set([w]);for(let R=O.length-1;R>=0;--R){let[N,D,F]=O[R],B=!1;for(let U of D.d.keys())if(U!==N&&T.has(U)){B=!0;break}B&&(a(_,N,E),p(_,N,D),F!==D.n&&(R2e(_,N,D),T.add(N))),E.delete(N)}},d=(_,w,...x)=>{let O=!0,E=R=>Ahe(a(_,R)),T=(R,...N)=>{let D=t(R);try{if(URt(w,R)){if(!P2e(R))throw new Error("atom not writable");let F=D.n,B=N[0];i(R,D,B),p(_,R,D),F!==D.n&&(R2e(_,R,D),c(_,R,D));return}else return d(_,R,...N)}finally{O||bL(_)}};try{return r(w,E,T,...x)}finally{O=!1}},f=(_,...w)=>{let x=N6();try{return d(x,_,...w)}finally{bL(x)}},p=(_,w,x)=>{if(x.m&&!A2e(x.v)){for(let O of x.d.keys())x.m.d.has(O)||(m(_,O,t(O)).t.add(w),x.m.d.add(O));for(let O of x.m.d||[])if(!x.d.has(O)){x.m.d.delete(O);let E=h(_,O,t(O));E?.t.delete(w)}}},m=(_,w,x)=>{if(!x.m){a(_,w);for(let O of x.d.keys())m(_,O,t(O)).t.add(w);if(x.m={l:new Set,d:new Set(x.d.keys()),t:new Set},(Pl.env?Pl.env.MODE:void 0)!=="production"&&o.add(w),M2e(w)){let O=x.m,E,T=(R,N)=>{let D=!0;E=(...F)=>{try{return d(R,w,...F)}finally{D||bL(R)}};try{return N()}finally{D=!1}};VRt(_,()=>{let R=T(_,()=>n(w,(...N)=>E(...N)));R&&(O.u=N=>T(N,R))})}}return x.m},h=(_,w,x)=>{if(x.m&&!x.m.l.size&&!Array.from(x.m.t).some(O=>{var E;return(E=t(O).m)==null?void 0:E.d.has(w)})){let O=x.m.u;O&&VRt(_,()=>O(_)),delete x.m,(Pl.env?Pl.env.MODE:void 0)!=="production"&&o.delete(w);for(let E of x.d.keys()){let T=h(_,E,t(E));T?.t.delete(w)}return}return x.m},b={get:s,set:f,sub:(_,w)=>{let x=N6(),O=t(_),T=m(x,_,O).l;return T.add(w),bL(x),()=>{T.delete(w);let R=N6();h(R,_,O),bL(R)}},unstable_derive:_=>KRt(..._(t,e,r,n))};return(Pl.env?Pl.env.MODE:void 0)!=="production"&&Object.assign(b,{dev4_get_internal_weak_map:()=>({get:w=>{let x=t(w);if(x.n!==0)return x}}),dev4_get_mounted_atoms:()=>o,dev4_restore_atoms:w=>{let x=N6();for(let[O,E]of w)if(P2e(O)){let T=t(O),R=T.n;i(O,T,E),p(x,O,T),R!==T.n&&(R2e(x,O,T),c(x,O,T))}bL(x)}}),b},j6=()=>{let t=new WeakMap;return KRt(r=>{if((Pl.env?Pl.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)})},WRt=()=>(ZQ||(ZQ=j6(),(Pl.env?Pl.env.MODE:void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=ZQ),globalThis.__JOTAI_DEFAULT_STORE__!==ZQ&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),ZQ)});var iAt=S(Oi=>{"use strict";var XQ=Symbol.for("react.element"),wyn=Symbol.for("react.portal"),Syn=Symbol.for("react.fragment"),Cyn=Symbol.for("react.strict_mode"),xyn=Symbol.for("react.profiler"),Oyn=Symbol.for("react.provider"),Tyn=Symbol.for("react.context"),Eyn=Symbol.for("react.forward_ref"),Pyn=Symbol.for("react.suspense"),Myn=Symbol.for("react.memo"),Ryn=Symbol.for("react.lazy"),GRt=Symbol.iterator;function Ayn(t){return t===null||typeof t!="object"?null:(t=GRt&&t[GRt]||t["@@iterator"],typeof t=="function"?t:null)}var YRt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},QRt=Object.assign,eAt={};function D6(t,e,r){this.props=t,this.context=e,this.refs=eAt,this.updater=r||YRt}D6.prototype.isReactComponent={};D6.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")};D6.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function tAt(){}tAt.prototype=D6.prototype;function D2e(t,e,r){this.props=t,this.context=e,this.refs=eAt,this.updater=r||YRt}var $2e=D2e.prototype=new tAt;$2e.constructor=D2e;QRt($2e,D6.prototype);$2e.isPureReactComponent=!0;var ZRt=Array.isArray,rAt=Object.prototype.hasOwnProperty,L2e={current:null},nAt={key:!0,ref:!0,__self:!0,__source:!0};function oAt(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)rAt.call(e,n)&&!nAt.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:XQ,type:t,key:i,ref:a,props:o,_owner:L2e.current}}function Iyn(t,e){return{$$typeof:XQ,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function F2e(t){return typeof t=="object"&&t!==null&&t.$$typeof===XQ}function Nyn(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(r){return e[r]})}var XRt=/\/+/g;function j2e(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Nyn(""+t.key):e.toString(36)}function jhe(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 XQ:case wyn:a=!0}}if(a)return a=t,o=o(a),t=n===""?"."+j2e(a,0):n,ZRt(o)?(r="",t!=null&&(r=t.replace(XRt,"$&/")+"/"),jhe(o,e,r,"",function(l){return l})):o!=null&&(F2e(o)&&(o=Iyn(o,r+(!o.key||a&&a.key===o.key?"":(""+o.key).replace(XRt,"$&/")+"/")+t)),e.push(o)),1;if(a=0,n=n===""?".":n+":",ZRt(t))for(var s=0;s<t.length;s++){i=t[s];var u=n+j2e(i,s);a+=jhe(i,e,r,u,o)}else if(u=Ayn(t),typeof u=="function")for(t=u.call(t),s=0;!(i=t.next()).done;)i=i.value,u=n+j2e(i,s++),a+=jhe(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 Nhe(t,e,r){if(t==null)return t;var n=[],o=0;return jhe(t,n,"","",function(i){return e.call(r,i,o++)}),n}function jyn(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 ob={current:null},Dhe={transition:null},Dyn={ReactCurrentDispatcher:ob,ReactCurrentBatchConfig:Dhe,ReactCurrentOwner:L2e};Oi.Children={map:Nhe,forEach:function(t,e,r){Nhe(t,function(){e.apply(this,arguments)},r)},count:function(t){var e=0;return Nhe(t,function(){e++}),e},toArray:function(t){return Nhe(t,function(e){return e})||[]},only:function(t){if(!F2e(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Oi.Component=D6;Oi.Fragment=Syn;Oi.Profiler=xyn;Oi.PureComponent=D2e;Oi.StrictMode=Cyn;Oi.Suspense=Pyn;Oi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Dyn;Oi.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=QRt({},t.props),o=t.key,i=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,a=L2e.current),e.key!==void 0&&(o=""+e.key),t.type&&t.type.defaultProps)var s=t.type.defaultProps;for(u in e)rAt.call(e,u)&&!nAt.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:XQ,type:t.type,key:o,ref:i,props:n,_owner:a}};Oi.createContext=function(t){return t={$$typeof:Tyn,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Oyn,_context:t},t.Consumer=t};Oi.createElement=oAt;Oi.createFactory=function(t){var e=oAt.bind(null,t);return e.type=t,e};Oi.createRef=function(){return{current:null}};Oi.forwardRef=function(t){return{$$typeof:Eyn,render:t}};Oi.isValidElement=F2e;Oi.lazy=function(t){return{$$typeof:Ryn,_payload:{_status:-1,_result:t},_init:jyn}};Oi.memo=function(t,e){return{$$typeof:Myn,type:t,compare:e===void 0?null:e}};Oi.startTransition=function(t){var e=Dhe.transition;Dhe.transition={};try{t()}finally{Dhe.transition=e}};Oi.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};Oi.useCallback=function(t,e){return ob.current.useCallback(t,e)};Oi.useContext=function(t){return ob.current.useContext(t)};Oi.useDebugValue=function(){};Oi.useDeferredValue=function(t){return ob.current.useDeferredValue(t)};Oi.useEffect=function(t,e){return ob.current.useEffect(t,e)};Oi.useId=function(){return ob.current.useId()};Oi.useImperativeHandle=function(t,e,r){return ob.current.useImperativeHandle(t,e,r)};Oi.useInsertionEffect=function(t,e){return ob.current.useInsertionEffect(t,e)};Oi.useLayoutEffect=function(t,e){return ob.current.useLayoutEffect(t,e)};Oi.useMemo=function(t,e){return ob.current.useMemo(t,e)};Oi.useReducer=function(t,e,r){return ob.current.useReducer(t,e,r)};Oi.useRef=function(t){return ob.current.useRef(t)};Oi.useState=function(t){return ob.current.useState(t)};Oi.useSyncExternalStore=function(t,e,r){return ob.current.useSyncExternalStore(t,e,r)};Oi.useTransition=function(){return ob.current.useTransition()};Oi.version="18.2.0"});var X=S((a1i,aAt)=>{"use strict";aAt.exports=iAt()});function Zw(t,e){let r=uAt(e),[[n,o,i],a]=(0,Qg.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,Qg.useEffect)(()=>{let l=r.sub(t,()=>{if(typeof u=="number"){let c=r.get(t);q2e(c)&&lAt(sAt(c)),setTimeout(a,u);return}a()});return a(),l},[r,t,u]),(0,Qg.useDebugValue)(s),q2e(s)){let l=sAt(s);return Lyn(l)}return s}function Fyn(t,e){let r=uAt(e);return(0,Qg.useCallback)((...o)=>{if(($he.env?$he.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return r.set(t,...o)},[r,t])}function $6(t,e){return[Zw(t,e),Fyn(t,e)]}var Qg,$he,$yn,uAt,q2e,lAt,Lyn,k2e,sAt,cAt=v(()=>{"use client";Qg=L(X(),1);N2e();$he={},$yn=(0,Qg.createContext)(void 0),uAt=t=>{let e=(0,Qg.useContext)($yn);return t?.store||e||WRt()},q2e=t=>typeof t?.then=="function",lAt=t=>{t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e})},Lyn=Qg.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(lAt(t),t)}),k2e=new WeakMap,sAt=t=>{let e=k2e.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(($he.env?$he.env.MODE:void 0)!=="production"&&l===u)throw new Error("[Bug] p is not updated even after cancelation");q2e(l)?(k2e.set(l,e),o=l,l.then(i(l),a(l)),s(l)):r(l)})};t.then(i(t),a(t)),s(t)}),k2e.set(t,e)),e}});var TN=v(()=>{N2e();cAt()});var YQ={};Xn(YQ,{getModelKeyFromModel:()=>Qn,getSettings:()=>ce,getSystemPrompt:()=>Y0,getSystemPromptWithMemory:()=>PN,resetSettings:()=>B2e,sanitizeQaExclusions:()=>fAt,sanitizeSettings:()=>U2e,setSettings:()=>EN,settingsAtom:()=>_L,settingsStore:()=>ei,subscribeToSettingsChange:()=>Ou,updateSetting:()=>et,useSettingsValue:()=>So});function EN(t){let e=kyn({...ce(),...t});e.enableAutocomplete=!1,e.enableWordCompletion=!1,ei.set(_L,e)}function fAt(t){let r=(typeof t=="string"?t:z2e).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===wO){n.set(wO,wO);return}if(!n.has(a)){let s=i.length>0&&o.endsWith("/")?`${i}/`:o;n.set(a,s)}}),n.set(wO,wO),Array.from(n.values()).map(o=>encodeURIComponent(o)).join(",")}function et(t,e){let r=ce();EN({...r,[t]:e})}function ce(){return ei.get(_L)}function B2e(){let t={...Ls,activeModels:SO.map(e=>({...e,enabled:!0})),activeEmbeddingModels:Dz.map(e=>({...e,enabled:!0}))};EN(t)}function Ou(t){let e=ce();return ei.sub(_L,()=>{let r=ce();t(e,r),e=r})}function So(){return Zw(_L,{store:ei})}function U2e(t){let e=t||Ls;e.userId||(e.userId=H0()),e.activeEmbeddingModels?e.activeEmbeddingModels=e.activeEmbeddingModels.map(p=>({...p,provider:p.provider==="azure_openai"?"azure openai":p.provider})):e.activeEmbeddingModels=Dz.map(p=>({...p,enabled:!0}));let r={...e},n=Number(e.temperature);r.temperature=isNaN(n)?Ls.temperature:n;let o=Number(e.maxTokens);r.maxTokens=isNaN(o)?Ls.maxTokens:o;let i=Number(e.contextTurns);r.contextTurns=isNaN(i)?Ls.contextTurns:i;let a=Number(e.embeddingRequestsPerMin);r.embeddingRequestsPerMin=isNaN(a)?Ls.embeddingRequestsPerMin:a;let s=Number(e.embeddingBatchSize);r.embeddingBatchSize=isNaN(s)?Ls.embeddingBatchSize:s;let u=Number(e.lexicalSearchRamLimit);isNaN(u)?r.lexicalSearchRamLimit=Ls.lexicalSearchRamLimit:r.lexicalSearchRamLimit=Math.min(1e3,Math.max(20,u)),typeof r.includeActiveNoteAsContext!="boolean"&&(r.includeActiveNoteAsContext=Ls.includeActiveNoteAsContext),typeof r.generateAIChatTitleOnSave!="boolean"&&(r.generateAIChatTitleOnSave=Ls.generateAIChatTitleOnSave),typeof r.passMarkdownImages!="boolean"&&(r.passMarkdownImages=Ls.passMarkdownImages),typeof r.enableInlineCitations!="boolean"&&(r.enableInlineCitations=Ls.enableInlineCitations),typeof r.enableCustomPromptTemplating!="boolean"&&(r.enableCustomPromptTemplating=Ls.enableCustomPromptTemplating),typeof r.allowAdditionalContext!="boolean"&&(r.allowAdditionalContext=Ls.allowAdditionalContext),typeof r.enableWordCompletion!="boolean"&&(r.enableWordCompletion=Ls.enableWordCompletion),r.enableAutocomplete=!1,r.enableWordCompletion=!1;let l=Number(e.autonomousAgentMaxIterations);isNaN(l)||l<4||l>8?r.autonomousAgentMaxIterations=Ls.autonomousAgentMaxIterations:r.autonomousAgentMaxIterations=l,Array.isArray(r.autonomousAgentEnabledToolIds)||(r.autonomousAgentEnabledToolIds=Ls.autonomousAgentEnabledToolIds),(!r.memoryFolderName||typeof r.memoryFolderName!="string")&&(r.memoryFolderName=Ls.memoryFolderName),typeof r.enableRecentConversations!="boolean"&&(r.enableRecentConversations=Ls.enableRecentConversations),typeof r.enableSavedMemory!="boolean"&&(r.enableSavedMemory=Ls.enableSavedMemory);let c=Number(e.maxRecentConversations);isNaN(c)||c<10||c>50?r.maxRecentConversations=Ls.maxRecentConversations:r.maxRecentConversations=c,typeof r.autosaveChat!="boolean"&&(r.autosaveChat=Ls.autosaveChat),typeof r.quickCommandIncludeNoteContext!="boolean"&&(r.quickCommandIncludeNoteContext=Ls.quickCommandIncludeNoteContext),e.quickCommandModelKey!==void 0&&typeof e.quickCommandModelKey!="string"&&(r.quickCommandModelKey=Ls.quickCommandModelKey);let d=(e.defaultSaveFolder||"").trim();r.defaultSaveFolder=d.length>0?d:Ls.defaultSaveFolder;let f=(e.customPromptsFolder||"").trim();return r.customPromptsFolder=f.length>0?f:Ls.customPromptsFolder,r.qaExclusions=fAt(e.qaExclusions),r}function Y0(){let t=ce().userSystemPrompt,e=pAt;return t?`${e}
|
||
<user_custom_instructions>
|
||
${t}
|
||
</user_custom_instructions>`:e}async function PN(t){let e=Y0();if(!t)return J("No UserMemoryManager provided to getSystemPromptWithMemory"),e;let r=await t.getUserMemoryPrompt();return r?`${r}
|
||
${e}`:e}function kyn(t){return t.activeModels=dAt(t.activeModels,SO),t.activeEmbeddingModels=dAt(t.activeEmbeddingModels,Dz),t}function Qn(t){return`${t.name}|${t.provider}`}function dAt(t,e){let r=new Map;return e.filter(n=>n.core).forEach(n=>{r.set(Qn(n),{...n})}),t.forEach(n=>{let o=Qn(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 ei,_L,Pt=v(()=>{TN();J3();zr();Dt();ei=j6(),_L=th(Ls)});function Eo(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 H2e=v(()=>{});var V2e,ey,L6=v(()=>{H2e();wr();V2e=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(){if(!this.initialized)try{if(!this.hasVault()){this.initialized=!0;return}let e=this.getLogPath();if(await app.vault.adapter.exists(e)){let o=(await app.vault.adapter.read(e)).split(/\r?\n/).filter(i=>i.length>0);o.length>this.maxLines?this.buffer=o.slice(o.length-this.maxLines):this.buffer=o}}catch{this.buffer=[]}finally{this.initialized=!0}}hasVault(){try{return typeof app<"u"&&!!app.vault?.adapter}catch{return!1}}sanitizeForSingleLine(e){if(e instanceof Error){let r=Eo(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{}}async openLogFile(){if(await this.flush(),!this.hasVault())return;let e=this.getLogPath(),r=app.vault.getAbstractFileByPath(e);try{if(!r){let o=e.includes("/")?e.split("/").slice(0,-1).join("/"):"";o&&await ty(o),r=await app.vault.create(e,this.buffer.join(`
|
||
`)+(this.buffer.length?`
|
||
`:""))}await app.workspace.getLeaf(!0).openFile(r)}catch{}}},ey=V2e.getInstance()});function J(...t){ce().debug&&console.log(...t),ey.append("INFO",...t)}function ue(...t){ce().debug&&console.error(...t),ey.append("ERROR",...t)}function Ot(...t){ce().debug&&console.warn(...t),ey.append("WARN",...t)}function Lhe(t){ey.appendMarkdownBlock(t)}function mAt(t,e){if(ce().debug)try{if(typeof console.table=="function"){Array.isArray(e)&&e.length>0?console.table(t,e):console.table(t);return}}catch{}J("Table:",JSON.stringify(t))}var Dt=v(()=>{Pt();L6()});var hAt=S((J2e,F6)=>{(function(t,e){typeof J2e=="object"&&typeof F6<"u"?F6.exports=e():typeof define=="function"&&define.amd?define(e):t.moment=e()})(J2e,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,P){return Object.prototype.hasOwnProperty.call(C,P)}function a(C){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(C).length===0;var P;for(P in C)if(i(C,P))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,P){var I=[],k,K=C.length;for(k=0;k<K;++k)I.push(P(C[k],k));return I}function d(C,P){for(var I in P)i(P,I)&&(C[I]=P[I]);return i(P,"toString")&&(C.toString=P.toString),i(P,"valueOf")&&(C.valueOf=P.valueOf),C}function f(C,P,I,k){return Twt(C,P,I,k,!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 P=Object(this),I=P.length>>>0,k;for(k=0;k<I;k++)if(k in P&&C.call(this,P[k],k,P))return!0;return!1};function g(C){if(C._isValid==null){var P=m(C),I=h.call(P.parsedDateParts,function(K){return K!=null}),k=!isNaN(C._d.getTime())&&P.overflow<0&&!P.empty&&!P.invalidEra&&!P.invalidMonth&&!P.invalidWeekday&&!P.weekdayMismatch&&!P.nullInput&&!P.invalidFormat&&!P.userInvalidated&&(!P.meridiem||P.meridiem&&I);if(C._strict&&(k=k&&P.charsLeftOver===0&&P.unusedTokens.length===0&&P.bigHour===void 0),Object.isFrozen==null||!Object.isFrozen(C))C._isValid=k;else return k}return C._isValid}function y(C){var P=f(NaN);return C!=null?d(m(P),C):m(P).userInvalidated=!0,P}var b=e.momentProperties=[],_=!1;function w(C,P){var I,k,K,le=b.length;if(s(P._isAMomentObject)||(C._isAMomentObject=P._isAMomentObject),s(P._i)||(C._i=P._i),s(P._f)||(C._f=P._f),s(P._l)||(C._l=P._l),s(P._strict)||(C._strict=P._strict),s(P._tzm)||(C._tzm=P._tzm),s(P._isUTC)||(C._isUTC=P._isUTC),s(P._offset)||(C._offset=P._offset),s(P._pf)||(C._pf=m(P)),s(P._locale)||(C._locale=P._locale),le>0)for(I=0;I<le;I++)k=b[I],K=P[k],s(K)||(C[k]=K);return C}function x(C){w(this,C),this._d=new Date(C._d!=null?C._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),_===!1&&(_=!0,e.updateOffset(this),_=!1)}function O(C){return C instanceof x||C!=null&&C._isAMomentObject!=null}function E(C){e.suppressDeprecationWarnings===!1&&typeof console<"u"&&console.warn&&console.warn("Deprecation warning: "+C)}function T(C,P){var I=!0;return d(function(){if(e.deprecationHandler!=null&&e.deprecationHandler(null,C),I){var k=[],K,le,je,en=arguments.length;for(le=0;le<en;le++){if(K="",typeof arguments[le]=="object"){K+=`
|
||
[`+le+"] ";for(je in arguments[0])i(arguments[0],je)&&(K+=je+": "+arguments[0][je]+", ");K=K.slice(0,-2)}else K=arguments[le];k.push(K)}E(C+`
|
||
Arguments: `+Array.prototype.slice.call(k).join("")+`
|
||
`+new Error().stack),I=!1}return P.apply(this,arguments)},P)}var R={};function N(C,P){e.deprecationHandler!=null&&e.deprecationHandler(C,P),R[C]||(E(P),R[C]=!0)}e.suppressDeprecationWarnings=!1,e.deprecationHandler=null;function D(C){return typeof Function<"u"&&C instanceof Function||Object.prototype.toString.call(C)==="[object Function]"}function F(C){var P,I;for(I in C)i(C,I)&&(P=C[I],D(P)?this[I]=P:this["_"+I]=P);this._config=C,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function B(C,P){var I=d({},C),k;for(k in P)i(P,k)&&(o(C[k])&&o(P[k])?(I[k]={},d(I[k],C[k]),d(I[k],P[k])):P[k]!=null?I[k]=P[k]:delete I[k]);for(k in C)i(C,k)&&!i(P,k)&&o(C[k])&&(I[k]=d({},I[k]));return I}function U(C){C!=null&&this.set(C)}var H;Object.keys?H=Object.keys:H=function(C){var P,I=[];for(P in C)i(C,P)&&I.push(P);return I};var G={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function ie(C,P,I){var k=this._calendar[C]||this._calendar.sameElse;return D(k)?k.call(P,I):k}function oe(C,P,I){var k=""+Math.abs(C),K=P-k.length,le=C>=0;return(le?I?"+":"":"-")+Math.pow(10,Math.max(0,K)).toString().substr(1)+k}var z=/(\[[^\[]*\])|(\\)?([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,Q=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,re={},Z={};function $(C,P,I,k){var K=k;typeof k=="string"&&(K=function(){return this[k]()}),C&&(Z[C]=K),P&&(Z[P[0]]=function(){return oe(K.apply(this,arguments),P[1],P[2])}),I&&(Z[I]=function(){return this.localeData().ordinal(K.apply(this,arguments),C)})}function q(C){return C.match(/\[[\s\S]/)?C.replace(/^\[|\]$/g,""):C.replace(/\\/g,"")}function Y(C){var P=C.match(z),I,k;for(I=0,k=P.length;I<k;I++)Z[P[I]]?P[I]=Z[P[I]]:P[I]=q(P[I]);return function(K){var le="",je;for(je=0;je<k;je++)le+=D(P[je])?P[je].call(K,C):P[je];return le}}function j(C,P){return C.isValid()?(P=A(P,C.localeData()),re[P]=re[P]||Y(P),re[P](C)):C.localeData().invalidDate()}function A(C,P){var I=5;function k(K){return P.longDateFormat(K)||K}for(Q.lastIndex=0;I>=0&&Q.test(C);)C=C.replace(Q,k),Q.lastIndex=0,I-=1;return C}var W={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 V(C){var P=this._longDateFormat[C],I=this._longDateFormat[C.toUpperCase()];return P||!I?P:(this._longDateFormat[C]=I.match(z).map(function(k){return k==="MMMM"||k==="MM"||k==="DD"||k==="dddd"?k.slice(1):k}).join(""),this._longDateFormat[C])}var se="Invalid date";function be(){return this._invalidDate}var Ee="%d",Ae=/\d{1,2}/;function ht(C){return this._ordinal.replace("%d",C)}var Rt={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 Ze(C,P,I,k){var K=this._relativeTime[I];return D(K)?K(C,P,I,k):K.replace(/%d/i,C)}function Dr(C,P){var I=this._relativeTime[C>0?"future":"past"];return D(I)?I(P):I.replace(/%s/i,P)}var Vt={};function jt(C,P){var I=C.toLowerCase();Vt[I]=Vt[I+"s"]=Vt[P]=C}function Fe(C){return typeof C=="string"?Vt[C]||Vt[C.toLowerCase()]:void 0}function hn(C){var P={},I,k;for(k in C)i(C,k)&&(I=Fe(k),I&&(P[I]=C[k]));return P}var gt={};function qe(C,P){gt[C]=P}function Te(C){var P=[],I;for(I in C)i(C,I)&&P.push({unit:I,priority:gt[I]});return P.sort(function(k,K){return k.priority-K.priority}),P}function Ce(C){return C%4===0&&C%100!==0||C%400===0}function De(C){return C<0?Math.ceil(C)||0:Math.floor(C)}function Re(C){var P=+C,I=0;return P!==0&&isFinite(P)&&(I=De(P)),I}function nt(C,P){return function(I){return I!=null?(He(this,C,I),e.updateOffset(this,P),this):_n(this,C)}}function _n(C,P){return C.isValid()?C._d["get"+(C._isUTC?"UTC":"")+P]():NaN}function He(C,P,I){C.isValid()&&!isNaN(I)&&(P==="FullYear"&&Ce(C.year())&&C.month()===1&&C.date()===29?(I=Re(I),C._d["set"+(C._isUTC?"UTC":"")+P](I,C.month(),wfe(I,C.month()))):C._d["set"+(C._isUTC?"UTC":"")+P](I))}function wt(C){return C=Fe(C),D(this[C])?this[C]():this}function _r(C,P){if(typeof C=="object"){C=hn(C);var I=Te(C),k,K=I.length;for(k=0;k<K;k++)this[I[k].unit](C[I[k].unit])}else if(C=Fe(C),D(this[C]))return this[C](P);return this}var Sl=/\d/,Vo=/\d\d/,Su=/\d{3}/,Wa=/\d{4}/,zy=/[+-]?\d{6}/,ui=/\d\d?/,mv=/\d\d\d\d?/,q0=/\d\d\d\d\d\d?/,Xt=/\d{1,3}/,ct=/\d{1,4}/,pr=/[+-]?\d{1,6}/,Or=/\d+/,js=/[+-]?\d+/,el=/Z|[+-]\d\d:?\d\d/gi,Hc=/Z|[+-]\d\d(?::?\d\d)?/gi,Vb=/[+-]?\d+(\.\d{1,3})?/,Hy=/[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,xi;xi={};function St(C,P,I){xi[C]=D(P)?P:function(k,K){return k&&I?I:P}}function Vy(C,P){return i(xi,C)?xi[C](P._strict,P._locale):new RegExp(hv(C))}function hv(C){return hm(C.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(P,I,k,K,le){return I||k||K||le}))}function hm(C){return C.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var ZI={};function _i(C,P){var I,k=P,K;for(typeof C=="string"&&(C=[C]),u(P)&&(k=function(le,je){je[P]=Re(le)}),K=C.length,I=0;I<K;I++)ZI[C[I]]=k}function B0(C,P){_i(C,function(I,k,K,le){K._w=K._w||{},P(I,K._w,K,le)})}function nY(C,P,I){P!=null&&i(ZI,C)&&ZI[C](P,I._a,I,C)}var zg=0,XI=1,nO=2,gm=3,U0=4,YI=5,kU=6,Hnn=7,Vnn=8;function Jnn(C,P){return(C%P+P)%P}var Vc;Array.prototype.indexOf?Vc=Array.prototype.indexOf:Vc=function(C){var P;for(P=0;P<this.length;++P)if(this[P]===C)return P;return-1};function wfe(C,P){if(isNaN(C)||isNaN(P))return NaN;var I=Jnn(P,12);return C+=(P-I)/12,I===1?Ce(C)?29:28:31-I%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)}),jt("month","M"),qe("month",8),St("M",ui),St("MM",ui,Vo),St("MMM",function(C,P){return P.monthsShortRegex(C)}),St("MMMM",function(C,P){return P.monthsRegex(C)}),_i(["M","MM"],function(C,P){P[XI]=Re(C)-1}),_i(["MMM","MMMM"],function(C,P,I,k){var K=I._locale.monthsParse(C,k,I._strict);K!=null?P[XI]=K:m(I).invalidMonth=C});var Knn="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),dwt="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),fwt=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Wnn=Hy,Gnn=Hy;function Znn(C,P){return C?n(this._months)?this._months[C.month()]:this._months[(this._months.isFormat||fwt).test(P)?"format":"standalone"][C.month()]:n(this._months)?this._months:this._months.standalone}function Xnn(C,P){return C?n(this._monthsShort)?this._monthsShort[C.month()]:this._monthsShort[fwt.test(P)?"format":"standalone"][C.month()]:n(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function Ynn(C,P,I){var k,K,le,je=C.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],k=0;k<12;++k)le=f([2e3,k]),this._shortMonthsParse[k]=this.monthsShort(le,"").toLocaleLowerCase(),this._longMonthsParse[k]=this.months(le,"").toLocaleLowerCase();return I?P==="MMM"?(K=Vc.call(this._shortMonthsParse,je),K!==-1?K:null):(K=Vc.call(this._longMonthsParse,je),K!==-1?K:null):P==="MMM"?(K=Vc.call(this._shortMonthsParse,je),K!==-1?K:(K=Vc.call(this._longMonthsParse,je),K!==-1?K:null)):(K=Vc.call(this._longMonthsParse,je),K!==-1?K:(K=Vc.call(this._shortMonthsParse,je),K!==-1?K:null))}function Qnn(C,P,I){var k,K,le;if(this._monthsParseExact)return Ynn.call(this,C,P,I);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),k=0;k<12;k++){if(K=f([2e3,k]),I&&!this._longMonthsParse[k]&&(this._longMonthsParse[k]=new RegExp("^"+this.months(K,"").replace(".","")+"$","i"),this._shortMonthsParse[k]=new RegExp("^"+this.monthsShort(K,"").replace(".","")+"$","i")),!I&&!this._monthsParse[k]&&(le="^"+this.months(K,"")+"|^"+this.monthsShort(K,""),this._monthsParse[k]=new RegExp(le.replace(".",""),"i")),I&&P==="MMMM"&&this._longMonthsParse[k].test(C))return k;if(I&&P==="MMM"&&this._shortMonthsParse[k].test(C))return k;if(!I&&this._monthsParse[k].test(C))return k}}function pwt(C,P){var I;if(!C.isValid())return C;if(typeof P=="string"){if(/^\d+$/.test(P))P=Re(P);else if(P=C.localeData().monthsParse(P),!u(P))return C}return I=Math.min(C.date(),wfe(C.year(),P)),C._d["set"+(C._isUTC?"UTC":"")+"Month"](P,I),C}function mwt(C){return C!=null?(pwt(this,C),e.updateOffset(this,!0),this):_n(this,"Month")}function eon(){return wfe(this.year(),this.month())}function ton(C){return this._monthsParseExact?(i(this,"_monthsRegex")||hwt.call(this),C?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=Wnn),this._monthsShortStrictRegex&&C?this._monthsShortStrictRegex:this._monthsShortRegex)}function ron(C){return this._monthsParseExact?(i(this,"_monthsRegex")||hwt.call(this),C?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=Gnn),this._monthsStrictRegex&&C?this._monthsStrictRegex:this._monthsRegex)}function hwt(){function C(je,en){return en.length-je.length}var P=[],I=[],k=[],K,le;for(K=0;K<12;K++)le=f([2e3,K]),P.push(this.monthsShort(le,"")),I.push(this.months(le,"")),k.push(this.months(le,"")),k.push(this.monthsShort(le,""));for(P.sort(C),I.sort(C),k.sort(C),K=0;K<12;K++)P[K]=hm(P[K]),I[K]=hm(I[K]);for(K=0;K<24;K++)k[K]=hm(k[K]);this._monthsRegex=new RegExp("^("+k.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+P.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"),jt("year","y"),qe("year",1),St("Y",js),St("YY",ui,Vo),St("YYYY",ct,Wa),St("YYYYY",pr,zy),St("YYYYYY",pr,zy),_i(["YYYYY","YYYYYY"],zg),_i("YYYY",function(C,P){P[zg]=C.length===2?e.parseTwoDigitYear(C):Re(C)}),_i("YY",function(C,P){P[zg]=e.parseTwoDigitYear(C)}),_i("Y",function(C,P){P[zg]=parseInt(C,10)});function oY(C){return Ce(C)?366:365}e.parseTwoDigitYear=function(C){return Re(C)+(Re(C)>68?1900:2e3)};var gwt=nt("FullYear",!0);function non(){return Ce(this.year())}function oon(C,P,I,k,K,le,je){var en;return C<100&&C>=0?(en=new Date(C+400,P,I,k,K,le,je),isFinite(en.getFullYear())&&en.setFullYear(C)):en=new Date(C,P,I,k,K,le,je),en}function iY(C){var P,I;return C<100&&C>=0?(I=Array.prototype.slice.call(arguments),I[0]=C+400,P=new Date(Date.UTC.apply(null,I)),isFinite(P.getUTCFullYear())&&P.setUTCFullYear(C)):P=new Date(Date.UTC.apply(null,arguments)),P}function Sfe(C,P,I){var k=7+P-I,K=(7+iY(C,0,k).getUTCDay()-P)%7;return-K+k-1}function ywt(C,P,I,k,K){var le=(7+I-k)%7,je=Sfe(C,k,K),en=1+7*(P-1)+le+je,Yo,au;return en<=0?(Yo=C-1,au=oY(Yo)+en):en>oY(C)?(Yo=C+1,au=en-oY(C)):(Yo=C,au=en),{year:Yo,dayOfYear:au}}function aY(C,P,I){var k=Sfe(C.year(),P,I),K=Math.floor((C.dayOfYear()-k-1)/7)+1,le,je;return K<1?(je=C.year()-1,le=K+QI(je,P,I)):K>QI(C.year(),P,I)?(le=K-QI(C.year(),P,I),je=C.year()+1):(je=C.year(),le=K),{week:le,year:je}}function QI(C,P,I){var k=Sfe(C,P,I),K=Sfe(C+1,P,I);return(oY(C)-k+K)/7}$("w",["ww",2],"wo","week"),$("W",["WW",2],"Wo","isoWeek"),jt("week","w"),jt("isoWeek","W"),qe("week",5),qe("isoWeek",5),St("w",ui),St("ww",ui,Vo),St("W",ui),St("WW",ui,Vo),B0(["w","ww","W","WW"],function(C,P,I,k){P[k.substr(0,1)]=Re(C)});function ion(C){return aY(C,this._week.dow,this._week.doy).week}var aon={dow:0,doy:6};function son(){return this._week.dow}function uon(){return this._week.doy}function lon(C){var P=this.localeData().week(this);return C==null?P:this.add((C-P)*7,"d")}function con(C){var P=aY(this,1,4).week;return C==null?P:this.add((C-P)*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"),jt("day","d"),jt("weekday","e"),jt("isoWeekday","E"),qe("day",11),qe("weekday",11),qe("isoWeekday",11),St("d",ui),St("e",ui),St("E",ui),St("dd",function(C,P){return P.weekdaysMinRegex(C)}),St("ddd",function(C,P){return P.weekdaysShortRegex(C)}),St("dddd",function(C,P){return P.weekdaysRegex(C)}),B0(["dd","ddd","dddd"],function(C,P,I,k){var K=I._locale.weekdaysParse(C,k,I._strict);K!=null?P.d=K:m(I).invalidWeekday=C}),B0(["d","e","E"],function(C,P,I,k){P[k]=Re(C)});function don(C,P){return typeof C!="string"?C:isNaN(C)?(C=P.weekdaysParse(C),typeof C=="number"?C:null):parseInt(C,10)}function fon(C,P){return typeof C=="string"?P.weekdaysParse(C)%7||7:isNaN(C)?null:C}function qFe(C,P){return C.slice(P,7).concat(C.slice(0,P))}var pon="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),bwt="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),mon="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),hon=Hy,gon=Hy,yon=Hy;function bon(C,P){var I=n(this._weekdays)?this._weekdays:this._weekdays[C&&C!==!0&&this._weekdays.isFormat.test(P)?"format":"standalone"];return C===!0?qFe(I,this._week.dow):C?I[C.day()]:I}function _on(C){return C===!0?qFe(this._weekdaysShort,this._week.dow):C?this._weekdaysShort[C.day()]:this._weekdaysShort}function von(C){return C===!0?qFe(this._weekdaysMin,this._week.dow):C?this._weekdaysMin[C.day()]:this._weekdaysMin}function won(C,P,I){var k,K,le,je=C.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],k=0;k<7;++k)le=f([2e3,1]).day(k),this._minWeekdaysParse[k]=this.weekdaysMin(le,"").toLocaleLowerCase(),this._shortWeekdaysParse[k]=this.weekdaysShort(le,"").toLocaleLowerCase(),this._weekdaysParse[k]=this.weekdays(le,"").toLocaleLowerCase();return I?P==="dddd"?(K=Vc.call(this._weekdaysParse,je),K!==-1?K:null):P==="ddd"?(K=Vc.call(this._shortWeekdaysParse,je),K!==-1?K:null):(K=Vc.call(this._minWeekdaysParse,je),K!==-1?K:null):P==="dddd"?(K=Vc.call(this._weekdaysParse,je),K!==-1||(K=Vc.call(this._shortWeekdaysParse,je),K!==-1)?K:(K=Vc.call(this._minWeekdaysParse,je),K!==-1?K:null)):P==="ddd"?(K=Vc.call(this._shortWeekdaysParse,je),K!==-1||(K=Vc.call(this._weekdaysParse,je),K!==-1)?K:(K=Vc.call(this._minWeekdaysParse,je),K!==-1?K:null)):(K=Vc.call(this._minWeekdaysParse,je),K!==-1||(K=Vc.call(this._weekdaysParse,je),K!==-1)?K:(K=Vc.call(this._shortWeekdaysParse,je),K!==-1?K:null))}function Son(C,P,I){var k,K,le;if(this._weekdaysParseExact)return won.call(this,C,P,I);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),k=0;k<7;k++){if(K=f([2e3,1]).day(k),I&&!this._fullWeekdaysParse[k]&&(this._fullWeekdaysParse[k]=new RegExp("^"+this.weekdays(K,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[k]=new RegExp("^"+this.weekdaysShort(K,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[k]=new RegExp("^"+this.weekdaysMin(K,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[k]||(le="^"+this.weekdays(K,"")+"|^"+this.weekdaysShort(K,"")+"|^"+this.weekdaysMin(K,""),this._weekdaysParse[k]=new RegExp(le.replace(".",""),"i")),I&&P==="dddd"&&this._fullWeekdaysParse[k].test(C))return k;if(I&&P==="ddd"&&this._shortWeekdaysParse[k].test(C))return k;if(I&&P==="dd"&&this._minWeekdaysParse[k].test(C))return k;if(!I&&this._weekdaysParse[k].test(C))return k}}function Con(C){if(!this.isValid())return C!=null?this:NaN;var P=this._isUTC?this._d.getUTCDay():this._d.getDay();return C!=null?(C=don(C,this.localeData()),this.add(C-P,"d")):P}function xon(C){if(!this.isValid())return C!=null?this:NaN;var P=(this.day()+7-this.localeData()._week.dow)%7;return C==null?P:this.add(C-P,"d")}function Oon(C){if(!this.isValid())return C!=null?this:NaN;if(C!=null){var P=fon(C,this.localeData());return this.day(this.day()%7?P:P-7)}else return this.day()||7}function Ton(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||BFe.call(this),C?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=hon),this._weekdaysStrictRegex&&C?this._weekdaysStrictRegex:this._weekdaysRegex)}function Eon(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||BFe.call(this),C?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=gon),this._weekdaysShortStrictRegex&&C?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Pon(C){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||BFe.call(this),C?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=yon),this._weekdaysMinStrictRegex&&C?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function BFe(){function C(Jy,oN){return oN.length-Jy.length}var P=[],I=[],k=[],K=[],le,je,en,Yo,au;for(le=0;le<7;le++)je=f([2e3,1]).day(le),en=hm(this.weekdaysMin(je,"")),Yo=hm(this.weekdaysShort(je,"")),au=hm(this.weekdays(je,"")),P.push(en),I.push(Yo),k.push(au),K.push(en),K.push(Yo),K.push(au);P.sort(C),I.sort(C),k.sort(C),K.sort(C),this._weekdaysRegex=new RegExp("^("+K.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+k.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+I.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+P.join("|")+")","i")}function UFe(){return this.hours()%12||12}function Mon(){return this.hours()||24}$("H",["HH",2],0,"hour"),$("h",["hh",2],0,UFe),$("k",["kk",2],0,Mon),$("hmm",0,0,function(){return""+UFe.apply(this)+oe(this.minutes(),2)}),$("hmmss",0,0,function(){return""+UFe.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 _wt(C,P){$(C,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),P)})}_wt("a",!0),_wt("A",!1),jt("hour","h"),qe("hour",13);function vwt(C,P){return P._meridiemParse}St("a",vwt),St("A",vwt),St("H",ui),St("h",ui),St("k",ui),St("HH",ui,Vo),St("hh",ui,Vo),St("kk",ui,Vo),St("hmm",mv),St("hmmss",q0),St("Hmm",mv),St("Hmmss",q0),_i(["H","HH"],gm),_i(["k","kk"],function(C,P,I){var k=Re(C);P[gm]=k===24?0:k}),_i(["a","A"],function(C,P,I){I._isPm=I._locale.isPM(C),I._meridiem=C}),_i(["h","hh"],function(C,P,I){P[gm]=Re(C),m(I).bigHour=!0}),_i("hmm",function(C,P,I){var k=C.length-2;P[gm]=Re(C.substr(0,k)),P[U0]=Re(C.substr(k)),m(I).bigHour=!0}),_i("hmmss",function(C,P,I){var k=C.length-4,K=C.length-2;P[gm]=Re(C.substr(0,k)),P[U0]=Re(C.substr(k,2)),P[YI]=Re(C.substr(K)),m(I).bigHour=!0}),_i("Hmm",function(C,P,I){var k=C.length-2;P[gm]=Re(C.substr(0,k)),P[U0]=Re(C.substr(k))}),_i("Hmmss",function(C,P,I){var k=C.length-4,K=C.length-2;P[gm]=Re(C.substr(0,k)),P[U0]=Re(C.substr(k,2)),P[YI]=Re(C.substr(K))});function Ron(C){return(C+"").toLowerCase().charAt(0)==="p"}var Aon=/[ap]\.?m?\.?/i,Ion=nt("Hours",!0);function Non(C,P,I){return C>11?I?"pm":"PM":I?"am":"AM"}var wwt={calendar:G,longDateFormat:W,invalidDate:se,ordinal:Ee,dayOfMonthOrdinalParse:Ae,relativeTime:Rt,months:Knn,monthsShort:dwt,week:aon,weekdays:pon,weekdaysMin:mon,weekdaysShort:bwt,meridiemParse:Aon},Cl={},sY={},uY;function jon(C,P){var I,k=Math.min(C.length,P.length);for(I=0;I<k;I+=1)if(C[I]!==P[I])return I;return k}function Swt(C){return C&&C.toLowerCase().replace("_","-")}function Don(C){for(var P=0,I,k,K,le;P<C.length;){for(le=Swt(C[P]).split("-"),I=le.length,k=Swt(C[P+1]),k=k?k.split("-"):null;I>0;){if(K=Cfe(le.slice(0,I).join("-")),K)return K;if(k&&k.length>=I&&jon(le,k)>=I-1)break;I--}P++}return uY}function $on(C){return C.match("^[^/\\\\]*$")!=null}function Cfe(C){var P=null,I;if(Cl[C]===void 0&&typeof F6<"u"&&F6&&F6.exports&&$on(C))try{P=uY._abbr,I=require,I("./locale/"+C),B$(P)}catch{Cl[C]=null}return Cl[C]}function B$(C,P){var I;return C&&(s(P)?I=eN(C):I=zFe(C,P),I?uY=I:typeof console<"u"&&console.warn&&console.warn("Locale "+C+" not found. Did you forget to load it?")),uY._abbr}function zFe(C,P){if(P!==null){var I,k=wwt;if(P.abbr=C,Cl[C]!=null)N("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),k=Cl[C]._config;else if(P.parentLocale!=null)if(Cl[P.parentLocale]!=null)k=Cl[P.parentLocale]._config;else if(I=Cfe(P.parentLocale),I!=null)k=I._config;else return sY[P.parentLocale]||(sY[P.parentLocale]=[]),sY[P.parentLocale].push({name:C,config:P}),null;return Cl[C]=new U(B(k,P)),sY[C]&&sY[C].forEach(function(K){zFe(K.name,K.config)}),B$(C),Cl[C]}else return delete Cl[C],null}function Lon(C,P){if(P!=null){var I,k,K=wwt;Cl[C]!=null&&Cl[C].parentLocale!=null?Cl[C].set(B(Cl[C]._config,P)):(k=Cfe(C),k!=null&&(K=k._config),P=B(K,P),k==null&&(P.abbr=C),I=new U(P),I.parentLocale=Cl[C],Cl[C]=I),B$(C)}else Cl[C]!=null&&(Cl[C].parentLocale!=null?(Cl[C]=Cl[C].parentLocale,C===B$()&&B$(C)):Cl[C]!=null&&delete Cl[C]);return Cl[C]}function eN(C){var P;if(C&&C._locale&&C._locale._abbr&&(C=C._locale._abbr),!C)return uY;if(!n(C)){if(P=Cfe(C),P)return P;C=[C]}return Don(C)}function Fon(){return H(Cl)}function HFe(C){var P,I=C._a;return I&&m(C).overflow===-2&&(P=I[XI]<0||I[XI]>11?XI:I[nO]<1||I[nO]>wfe(I[zg],I[XI])?nO:I[gm]<0||I[gm]>24||I[gm]===24&&(I[U0]!==0||I[YI]!==0||I[kU]!==0)?gm:I[U0]<0||I[U0]>59?U0:I[YI]<0||I[YI]>59?YI:I[kU]<0||I[kU]>999?kU:-1,m(C)._overflowDayOfYear&&(P<zg||P>nO)&&(P=nO),m(C)._overflowWeeks&&P===-1&&(P=Hnn),m(C)._overflowWeekday&&P===-1&&(P=Vnn),m(C).overflow=P),C}var kon=/^\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)?)?$/,qon=/^\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)?)?$/,Bon=/Z|[+-]\d\d(?::?\d\d)?/,xfe=[["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]],VFe=[["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/]],Uon=/^\/?Date\((-?\d+)/i,zon=/^(?:(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}))$/,Hon={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 Cwt(C){var P,I,k=C._i,K=kon.exec(k)||qon.exec(k),le,je,en,Yo,au=xfe.length,Jy=VFe.length;if(K){for(m(C).iso=!0,P=0,I=au;P<I;P++)if(xfe[P][1].exec(K[1])){je=xfe[P][0],le=xfe[P][2]!==!1;break}if(je==null){C._isValid=!1;return}if(K[3]){for(P=0,I=Jy;P<I;P++)if(VFe[P][1].exec(K[3])){en=(K[2]||" ")+VFe[P][0];break}if(en==null){C._isValid=!1;return}}if(!le&&en!=null){C._isValid=!1;return}if(K[4])if(Bon.exec(K[4]))Yo="Z";else{C._isValid=!1;return}C._f=je+(en||"")+(Yo||""),KFe(C)}else C._isValid=!1}function Von(C,P,I,k,K,le){var je=[Jon(C),dwt.indexOf(P),parseInt(I,10),parseInt(k,10),parseInt(K,10)];return le&&je.push(parseInt(le,10)),je}function Jon(C){var P=parseInt(C,10);return P<=49?2e3+P:P<=999?1900+P:P}function Kon(C){return C.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Won(C,P,I){if(C){var k=bwt.indexOf(C),K=new Date(P[0],P[1],P[2]).getDay();if(k!==K)return m(I).weekdayMismatch=!0,I._isValid=!1,!1}return!0}function Gon(C,P,I){if(C)return Hon[C];if(P)return 0;var k=parseInt(I,10),K=k%100,le=(k-K)/100;return le*60+K}function xwt(C){var P=zon.exec(Kon(C._i)),I;if(P){if(I=Von(P[4],P[3],P[2],P[5],P[6],P[7]),!Won(P[1],I,C))return;C._a=I,C._tzm=Gon(P[8],P[9],P[10]),C._d=iY.apply(null,C._a),C._d.setUTCMinutes(C._d.getUTCMinutes()-C._tzm),m(C).rfc2822=!0}else C._isValid=!1}function Zon(C){var P=Uon.exec(C._i);if(P!==null){C._d=new Date(+P[1]);return}if(Cwt(C),C._isValid===!1)delete C._isValid;else return;if(xwt(C),C._isValid===!1)delete C._isValid;else return;C._strict?C._isValid=!1:e.createFromInputFallback(C)}e.createFromInputFallback=T("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 B3(C,P,I){return C??P??I}function Xon(C){var P=new Date(e.now());return C._useUTC?[P.getUTCFullYear(),P.getUTCMonth(),P.getUTCDate()]:[P.getFullYear(),P.getMonth(),P.getDate()]}function JFe(C){var P,I,k=[],K,le,je;if(!C._d){for(K=Xon(C),C._w&&C._a[nO]==null&&C._a[XI]==null&&Yon(C),C._dayOfYear!=null&&(je=B3(C._a[zg],K[zg]),(C._dayOfYear>oY(je)||C._dayOfYear===0)&&(m(C)._overflowDayOfYear=!0),I=iY(je,0,C._dayOfYear),C._a[XI]=I.getUTCMonth(),C._a[nO]=I.getUTCDate()),P=0;P<3&&C._a[P]==null;++P)C._a[P]=k[P]=K[P];for(;P<7;P++)C._a[P]=k[P]=C._a[P]==null?P===2?1:0:C._a[P];C._a[gm]===24&&C._a[U0]===0&&C._a[YI]===0&&C._a[kU]===0&&(C._nextDay=!0,C._a[gm]=0),C._d=(C._useUTC?iY:oon).apply(null,k),le=C._useUTC?C._d.getUTCDay():C._d.getDay(),C._tzm!=null&&C._d.setUTCMinutes(C._d.getUTCMinutes()-C._tzm),C._nextDay&&(C._a[gm]=24),C._w&&typeof C._w.d<"u"&&C._w.d!==le&&(m(C).weekdayMismatch=!0)}}function Yon(C){var P,I,k,K,le,je,en,Yo,au;P=C._w,P.GG!=null||P.W!=null||P.E!=null?(le=1,je=4,I=B3(P.GG,C._a[zg],aY(tl(),1,4).year),k=B3(P.W,1),K=B3(P.E,1),(K<1||K>7)&&(Yo=!0)):(le=C._locale._week.dow,je=C._locale._week.doy,au=aY(tl(),le,je),I=B3(P.gg,C._a[zg],au.year),k=B3(P.w,au.week),P.d!=null?(K=P.d,(K<0||K>6)&&(Yo=!0)):P.e!=null?(K=P.e+le,(P.e<0||P.e>6)&&(Yo=!0)):K=le),k<1||k>QI(I,le,je)?m(C)._overflowWeeks=!0:Yo!=null?m(C)._overflowWeekday=!0:(en=ywt(I,k,K,le,je),C._a[zg]=en.year,C._dayOfYear=en.dayOfYear)}e.ISO_8601=function(){},e.RFC_2822=function(){};function KFe(C){if(C._f===e.ISO_8601){Cwt(C);return}if(C._f===e.RFC_2822){xwt(C);return}C._a=[],m(C).empty=!0;var P=""+C._i,I,k,K,le,je,en=P.length,Yo=0,au,Jy;for(K=A(C._f,C._locale).match(z)||[],Jy=K.length,I=0;I<Jy;I++)le=K[I],k=(P.match(Vy(le,C))||[])[0],k&&(je=P.substr(0,P.indexOf(k)),je.length>0&&m(C).unusedInput.push(je),P=P.slice(P.indexOf(k)+k.length),Yo+=k.length),Z[le]?(k?m(C).empty=!1:m(C).unusedTokens.push(le),nY(le,k,C)):C._strict&&!k&&m(C).unusedTokens.push(le);m(C).charsLeftOver=en-Yo,P.length>0&&m(C).unusedInput.push(P),C._a[gm]<=12&&m(C).bigHour===!0&&C._a[gm]>0&&(m(C).bigHour=void 0),m(C).parsedDateParts=C._a.slice(0),m(C).meridiem=C._meridiem,C._a[gm]=Qon(C._locale,C._a[gm],C._meridiem),au=m(C).era,au!==null&&(C._a[zg]=C._locale.erasConvertYear(au,C._a[zg])),JFe(C),HFe(C)}function Qon(C,P,I){var k;return I==null?P:C.meridiemHour!=null?C.meridiemHour(P,I):(C.isPM!=null&&(k=C.isPM(I),k&&P<12&&(P+=12),!k&&P===12&&(P=0)),P)}function ein(C){var P,I,k,K,le,je,en=!1,Yo=C._f.length;if(Yo===0){m(C).invalidFormat=!0,C._d=new Date(NaN);return}for(K=0;K<Yo;K++)le=0,je=!1,P=w({},C),C._useUTC!=null&&(P._useUTC=C._useUTC),P._f=C._f[K],KFe(P),g(P)&&(je=!0),le+=m(P).charsLeftOver,le+=m(P).unusedTokens.length*10,m(P).score=le,en?le<k&&(k=le,I=P):(k==null||le<k||je)&&(k=le,I=P,je&&(en=!0));d(C,I||P)}function tin(C){if(!C._d){var P=hn(C._i),I=P.day===void 0?P.date:P.day;C._a=c([P.year,P.month,I,P.hour,P.minute,P.second,P.millisecond],function(k){return k&&parseInt(k,10)}),JFe(C)}}function rin(C){var P=new x(HFe(Owt(C)));return P._nextDay&&(P.add(1,"d"),P._nextDay=void 0),P}function Owt(C){var P=C._i,I=C._f;return C._locale=C._locale||eN(C._l),P===null||I===void 0&&P===""?y({nullInput:!0}):(typeof P=="string"&&(C._i=P=C._locale.preparse(P)),O(P)?new x(HFe(P)):(l(P)?C._d=P:n(I)?ein(C):I?KFe(C):nin(C),g(C)||(C._d=null),C))}function nin(C){var P=C._i;s(P)?C._d=new Date(e.now()):l(P)?C._d=new Date(P.valueOf()):typeof P=="string"?Zon(C):n(P)?(C._a=c(P.slice(0),function(I){return parseInt(I,10)}),JFe(C)):o(P)?tin(C):u(P)?C._d=new Date(P):e.createFromInputFallback(C)}function Twt(C,P,I,k,K){var le={};return(P===!0||P===!1)&&(k=P,P=void 0),(I===!0||I===!1)&&(k=I,I=void 0),(o(C)&&a(C)||n(C)&&C.length===0)&&(C=void 0),le._isAMomentObject=!0,le._useUTC=le._isUTC=K,le._l=I,le._i=C,le._f=P,le._strict=k,rin(le)}function tl(C,P,I,k){return Twt(C,P,I,k,!1)}var oin=T("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var C=tl.apply(null,arguments);return this.isValid()&&C.isValid()?C<this?this:C:y()}),iin=T("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var C=tl.apply(null,arguments);return this.isValid()&&C.isValid()?C>this?this:C:y()});function Ewt(C,P){var I,k;if(P.length===1&&n(P[0])&&(P=P[0]),!P.length)return tl();for(I=P[0],k=1;k<P.length;++k)(!P[k].isValid()||P[k][C](I))&&(I=P[k]);return I}function ain(){var C=[].slice.call(arguments,0);return Ewt("isBefore",C)}function sin(){var C=[].slice.call(arguments,0);return Ewt("isAfter",C)}var uin=function(){return Date.now?Date.now():+new Date},lY=["year","quarter","month","week","day","hour","minute","second","millisecond"];function lin(C){var P,I=!1,k,K=lY.length;for(P in C)if(i(C,P)&&!(Vc.call(lY,P)!==-1&&(C[P]==null||!isNaN(C[P]))))return!1;for(k=0;k<K;++k)if(C[lY[k]]){if(I)return!1;parseFloat(C[lY[k]])!==Re(C[lY[k]])&&(I=!0)}return!0}function cin(){return this._isValid}function din(){return z0(NaN)}function Ofe(C){var P=hn(C),I=P.year||0,k=P.quarter||0,K=P.month||0,le=P.week||P.isoWeek||0,je=P.day||0,en=P.hour||0,Yo=P.minute||0,au=P.second||0,Jy=P.millisecond||0;this._isValid=lin(P),this._milliseconds=+Jy+au*1e3+Yo*6e4+en*1e3*60*60,this._days=+je+le*7,this._months=+K+k*3+I*12,this._data={},this._locale=eN(),this._bubble()}function Tfe(C){return C instanceof Ofe}function WFe(C){return C<0?Math.round(-1*C)*-1:Math.round(C)}function fin(C,P,I){var k=Math.min(C.length,P.length),K=Math.abs(C.length-P.length),le=0,je;for(je=0;je<k;je++)(I&&C[je]!==P[je]||!I&&Re(C[je])!==Re(P[je]))&&le++;return le+K}function Pwt(C,P){$(C,0,0,function(){var I=this.utcOffset(),k="+";return I<0&&(I=-I,k="-"),k+oe(~~(I/60),2)+P+oe(~~I%60,2)})}Pwt("Z",":"),Pwt("ZZ",""),St("Z",Hc),St("ZZ",Hc),_i(["Z","ZZ"],function(C,P,I){I._useUTC=!0,I._tzm=GFe(Hc,C)});var pin=/([\+\-]|\d\d)/gi;function GFe(C,P){var I=(P||"").match(C),k,K,le;return I===null?null:(k=I[I.length-1]||[],K=(k+"").match(pin)||["-",0,0],le=+(K[1]*60)+Re(K[2]),le===0?0:K[0]==="+"?le:-le)}function ZFe(C,P){var I,k;return P._isUTC?(I=P.clone(),k=(O(C)||l(C)?C.valueOf():tl(C).valueOf())-I.valueOf(),I._d.setTime(I._d.valueOf()+k),e.updateOffset(I,!1),I):tl(C).local()}function XFe(C){return-Math.round(C._d.getTimezoneOffset())}e.updateOffset=function(){};function min(C,P,I){var k=this._offset||0,K;if(!this.isValid())return C!=null?this:NaN;if(C!=null){if(typeof C=="string"){if(C=GFe(Hc,C),C===null)return this}else Math.abs(C)<16&&!I&&(C=C*60);return!this._isUTC&&P&&(K=XFe(this)),this._offset=C,this._isUTC=!0,K!=null&&this.add(K,"m"),k!==C&&(!P||this._changeInProgress?Iwt(this,z0(C-k,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?k:XFe(this)}function hin(C,P){return C!=null?(typeof C!="string"&&(C=-C),this.utcOffset(C,P),this):-this.utcOffset()}function gin(C){return this.utcOffset(0,C)}function yin(C){return this._isUTC&&(this.utcOffset(0,C),this._isUTC=!1,C&&this.subtract(XFe(this),"m")),this}function bin(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var C=GFe(el,this._i);C!=null?this.utcOffset(C):this.utcOffset(0,!0)}return this}function _in(C){return this.isValid()?(C=C?tl(C).utcOffset():0,(this.utcOffset()-C)%60===0):!1}function vin(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function win(){if(!s(this._isDSTShifted))return this._isDSTShifted;var C={},P;return w(C,this),C=Owt(C),C._a?(P=C._isUTC?f(C._a):tl(C._a),this._isDSTShifted=this.isValid()&&fin(C._a,P.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function Sin(){return this.isValid()?!this._isUTC:!1}function Cin(){return this.isValid()?this._isUTC:!1}function Mwt(){return this.isValid()?this._isUTC&&this._offset===0:!1}var xin=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,Oin=/^(-|\+)?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,P){var I=C,k=null,K,le,je;return Tfe(C)?I={ms:C._milliseconds,d:C._days,M:C._months}:u(C)||!isNaN(+C)?(I={},P?I[P]=+C:I.milliseconds=+C):(k=xin.exec(C))?(K=k[1]==="-"?-1:1,I={y:0,d:Re(k[nO])*K,h:Re(k[gm])*K,m:Re(k[U0])*K,s:Re(k[YI])*K,ms:Re(WFe(k[kU]*1e3))*K}):(k=Oin.exec(C))?(K=k[1]==="-"?-1:1,I={y:qU(k[2],K),M:qU(k[3],K),w:qU(k[4],K),d:qU(k[5],K),h:qU(k[6],K),m:qU(k[7],K),s:qU(k[8],K)}):I==null?I={}:typeof I=="object"&&("from"in I||"to"in I)&&(je=Tin(tl(I.from),tl(I.to)),I={},I.ms=je.milliseconds,I.M=je.months),le=new Ofe(I),Tfe(C)&&i(C,"_locale")&&(le._locale=C._locale),Tfe(C)&&i(C,"_isValid")&&(le._isValid=C._isValid),le}z0.fn=Ofe.prototype,z0.invalid=din;function qU(C,P){var I=C&&parseFloat(C.replace(",","."));return(isNaN(I)?0:I)*P}function Rwt(C,P){var I={};return I.months=P.month()-C.month()+(P.year()-C.year())*12,C.clone().add(I.months,"M").isAfter(P)&&--I.months,I.milliseconds=+P-+C.clone().add(I.months,"M"),I}function Tin(C,P){var I;return C.isValid()&&P.isValid()?(P=ZFe(P,C),C.isBefore(P)?I=Rwt(C,P):(I=Rwt(P,C),I.milliseconds=-I.milliseconds,I.months=-I.months),I):{milliseconds:0,months:0}}function Awt(C,P){return function(I,k){var K,le;return k!==null&&!isNaN(+k)&&(N(P,"moment()."+P+"(period, number) is deprecated. Please use moment()."+P+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),le=I,I=k,k=le),K=z0(I,k),Iwt(this,K,C),this}}function Iwt(C,P,I,k){var K=P._milliseconds,le=WFe(P._days),je=WFe(P._months);C.isValid()&&(k=k??!0,je&&pwt(C,_n(C,"Month")+je*I),le&&He(C,"Date",_n(C,"Date")+le*I),K&&C._d.setTime(C._d.valueOf()+K*I),k&&e.updateOffset(C,le||je))}var Ein=Awt(1,"add"),Pin=Awt(-1,"subtract");function Nwt(C){return typeof C=="string"||C instanceof String}function Min(C){return O(C)||l(C)||Nwt(C)||u(C)||Ain(C)||Rin(C)||C===null||C===void 0}function Rin(C){var P=o(C)&&!a(C),I=!1,k=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],K,le,je=k.length;for(K=0;K<je;K+=1)le=k[K],I=I||i(C,le);return P&&I}function Ain(C){var P=n(C),I=!1;return P&&(I=C.filter(function(k){return!u(k)&&Nwt(C)}).length===0),P&&I}function Iin(C){var P=o(C)&&!a(C),I=!1,k=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],K,le;for(K=0;K<k.length;K+=1)le=k[K],I=I||i(C,le);return P&&I}function Nin(C,P){var I=C.diff(P,"days",!0);return I<-6?"sameElse":I<-1?"lastWeek":I<0?"lastDay":I<1?"sameDay":I<2?"nextDay":I<7?"nextWeek":"sameElse"}function jin(C,P){arguments.length===1&&(arguments[0]?Min(arguments[0])?(C=arguments[0],P=void 0):Iin(arguments[0])&&(P=arguments[0],C=void 0):(C=void 0,P=void 0));var I=C||tl(),k=ZFe(I,this).startOf("day"),K=e.calendarFormat(this,k)||"sameElse",le=P&&(D(P[K])?P[K].call(this,I):P[K]);return this.format(le||this.localeData().calendar(K,this,tl(I)))}function Din(){return new x(this)}function $in(C,P){var I=O(C)?C:tl(C);return this.isValid()&&I.isValid()?(P=Fe(P)||"millisecond",P==="millisecond"?this.valueOf()>I.valueOf():I.valueOf()<this.clone().startOf(P).valueOf()):!1}function Lin(C,P){var I=O(C)?C:tl(C);return this.isValid()&&I.isValid()?(P=Fe(P)||"millisecond",P==="millisecond"?this.valueOf()<I.valueOf():this.clone().endOf(P).valueOf()<I.valueOf()):!1}function Fin(C,P,I,k){var K=O(C)?C:tl(C),le=O(P)?P:tl(P);return this.isValid()&&K.isValid()&&le.isValid()?(k=k||"()",(k[0]==="("?this.isAfter(K,I):!this.isBefore(K,I))&&(k[1]===")"?this.isBefore(le,I):!this.isAfter(le,I))):!1}function kin(C,P){var I=O(C)?C:tl(C),k;return this.isValid()&&I.isValid()?(P=Fe(P)||"millisecond",P==="millisecond"?this.valueOf()===I.valueOf():(k=I.valueOf(),this.clone().startOf(P).valueOf()<=k&&k<=this.clone().endOf(P).valueOf())):!1}function qin(C,P){return this.isSame(C,P)||this.isAfter(C,P)}function Bin(C,P){return this.isSame(C,P)||this.isBefore(C,P)}function Uin(C,P,I){var k,K,le;if(!this.isValid())return NaN;if(k=ZFe(C,this),!k.isValid())return NaN;switch(K=(k.utcOffset()-this.utcOffset())*6e4,P=Fe(P),P){case"year":le=Efe(this,k)/12;break;case"month":le=Efe(this,k);break;case"quarter":le=Efe(this,k)/3;break;case"second":le=(this-k)/1e3;break;case"minute":le=(this-k)/6e4;break;case"hour":le=(this-k)/36e5;break;case"day":le=(this-k-K)/864e5;break;case"week":le=(this-k-K)/6048e5;break;default:le=this-k}return I?le:De(le)}function Efe(C,P){if(C.date()<P.date())return-Efe(P,C);var I=(P.year()-C.year())*12+(P.month()-C.month()),k=C.clone().add(I,"months"),K,le;return P-k<0?(K=C.clone().add(I-1,"months"),le=(P-k)/(k-K)):(K=C.clone().add(I+1,"months"),le=(P-k)/(K-k)),-(I+le)||0}e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",e.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function zin(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function Hin(C){if(!this.isValid())return null;var P=C!==!0,I=P?this.clone().utc():this;return I.year()<0||I.year()>9999?j(I,P?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):D(Date.prototype.toISOString)?P?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",j(I,"Z")):j(I,P?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Vin(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var C="moment",P="",I,k,K,le;return this.isLocal()||(C=this.utcOffset()===0?"moment.utc":"moment.parseZone",P="Z"),I="["+C+'("]',k=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",K="-MM-DD[T]HH:mm:ss.SSS",le=P+'[")]',this.format(I+k+K+le)}function Jin(C){C||(C=this.isUtc()?e.defaultFormatUtc:e.defaultFormat);var P=j(this,C);return this.localeData().postformat(P)}function Kin(C,P){return this.isValid()&&(O(C)&&C.isValid()||tl(C).isValid())?z0({to:this,from:C}).locale(this.locale()).humanize(!P):this.localeData().invalidDate()}function Win(C){return this.from(tl(),C)}function Gin(C,P){return this.isValid()&&(O(C)&&C.isValid()||tl(C).isValid())?z0({from:this,to:C}).locale(this.locale()).humanize(!P):this.localeData().invalidDate()}function Zin(C){return this.to(tl(),C)}function jwt(C){var P;return C===void 0?this._locale._abbr:(P=eN(C),P!=null&&(this._locale=P),this)}var Dwt=T("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 $wt(){return this._locale}var Pfe=1e3,U3=60*Pfe,Mfe=60*U3,Lwt=(365*400+97)*24*Mfe;function z3(C,P){return(C%P+P)%P}function Fwt(C,P,I){return C<100&&C>=0?new Date(C+400,P,I)-Lwt:new Date(C,P,I).valueOf()}function kwt(C,P,I){return C<100&&C>=0?Date.UTC(C+400,P,I)-Lwt:Date.UTC(C,P,I)}function Xin(C){var P,I;if(C=Fe(C),C===void 0||C==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?kwt:Fwt,C){case"year":P=I(this.year(),0,1);break;case"quarter":P=I(this.year(),this.month()-this.month()%3,1);break;case"month":P=I(this.year(),this.month(),1);break;case"week":P=I(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":P=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":P=I(this.year(),this.month(),this.date());break;case"hour":P=this._d.valueOf(),P-=z3(P+(this._isUTC?0:this.utcOffset()*U3),Mfe);break;case"minute":P=this._d.valueOf(),P-=z3(P,U3);break;case"second":P=this._d.valueOf(),P-=z3(P,Pfe);break}return this._d.setTime(P),e.updateOffset(this,!0),this}function Yin(C){var P,I;if(C=Fe(C),C===void 0||C==="millisecond"||!this.isValid())return this;switch(I=this._isUTC?kwt:Fwt,C){case"year":P=I(this.year()+1,0,1)-1;break;case"quarter":P=I(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":P=I(this.year(),this.month()+1,1)-1;break;case"week":P=I(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":P=I(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":P=I(this.year(),this.month(),this.date()+1)-1;break;case"hour":P=this._d.valueOf(),P+=Mfe-z3(P+(this._isUTC?0:this.utcOffset()*U3),Mfe)-1;break;case"minute":P=this._d.valueOf(),P+=U3-z3(P,U3)-1;break;case"second":P=this._d.valueOf(),P+=Pfe-z3(P,Pfe)-1;break}return this._d.setTime(P),e.updateOffset(this,!0),this}function Qin(){return this._d.valueOf()-(this._offset||0)*6e4}function ean(){return Math.floor(this.valueOf()/1e3)}function tan(){return new Date(this.valueOf())}function ran(){var C=this;return[C.year(),C.month(),C.date(),C.hour(),C.minute(),C.second(),C.millisecond()]}function nan(){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 oan(){return this.isValid()?this.toISOString():null}function ian(){return g(this)}function aan(){return d({},m(this))}function san(){return m(this).overflow}function uan(){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"),St("N",YFe),St("NN",YFe),St("NNN",YFe),St("NNNN",_an),St("NNNNN",van),_i(["N","NN","NNN","NNNN","NNNNN"],function(C,P,I,k){var K=I._locale.erasParse(C,k,I._strict);K?m(I).era=K:m(I).invalidEra=C}),St("y",Or),St("yy",Or),St("yyy",Or),St("yyyy",Or),St("yo",wan),_i(["y","yy","yyy","yyyy"],zg),_i(["yo"],function(C,P,I,k){var K;I._locale._eraYearOrdinalRegex&&(K=C.match(I._locale._eraYearOrdinalRegex)),I._locale.eraYearOrdinalParse?P[zg]=I._locale.eraYearOrdinalParse(C,K):P[zg]=parseInt(C,10)});function lan(C,P){var I,k,K,le=this._eras||eN("en")._eras;for(I=0,k=le.length;I<k;++I){switch(typeof le[I].since){case"string":K=e(le[I].since).startOf("day"),le[I].since=K.valueOf();break}switch(typeof le[I].until){case"undefined":le[I].until=1/0;break;case"string":K=e(le[I].until).startOf("day").valueOf(),le[I].until=K.valueOf();break}}return le}function can(C,P,I){var k,K,le=this.eras(),je,en,Yo;for(C=C.toUpperCase(),k=0,K=le.length;k<K;++k)if(je=le[k].name.toUpperCase(),en=le[k].abbr.toUpperCase(),Yo=le[k].narrow.toUpperCase(),I)switch(P){case"N":case"NN":case"NNN":if(en===C)return le[k];break;case"NNNN":if(je===C)return le[k];break;case"NNNNN":if(Yo===C)return le[k];break}else if([je,en,Yo].indexOf(C)>=0)return le[k]}function dan(C,P){var I=C.since<=C.until?1:-1;return P===void 0?e(C.since).year():e(C.since).year()+(P-C.offset)*I}function fan(){var C,P,I,k=this.localeData().eras();for(C=0,P=k.length;C<P;++C)if(I=this.clone().startOf("day").valueOf(),k[C].since<=I&&I<=k[C].until||k[C].until<=I&&I<=k[C].since)return k[C].name;return""}function pan(){var C,P,I,k=this.localeData().eras();for(C=0,P=k.length;C<P;++C)if(I=this.clone().startOf("day").valueOf(),k[C].since<=I&&I<=k[C].until||k[C].until<=I&&I<=k[C].since)return k[C].narrow;return""}function man(){var C,P,I,k=this.localeData().eras();for(C=0,P=k.length;C<P;++C)if(I=this.clone().startOf("day").valueOf(),k[C].since<=I&&I<=k[C].until||k[C].until<=I&&I<=k[C].since)return k[C].abbr;return""}function han(){var C,P,I,k,K=this.localeData().eras();for(C=0,P=K.length;C<P;++C)if(I=K[C].since<=K[C].until?1:-1,k=this.clone().startOf("day").valueOf(),K[C].since<=k&&k<=K[C].until||K[C].until<=k&&k<=K[C].since)return(this.year()-e(K[C].since).year())*I+K[C].offset;return this.year()}function gan(C){return i(this,"_erasNameRegex")||QFe.call(this),C?this._erasNameRegex:this._erasRegex}function yan(C){return i(this,"_erasAbbrRegex")||QFe.call(this),C?this._erasAbbrRegex:this._erasRegex}function ban(C){return i(this,"_erasNarrowRegex")||QFe.call(this),C?this._erasNarrowRegex:this._erasRegex}function YFe(C,P){return P.erasAbbrRegex(C)}function _an(C,P){return P.erasNameRegex(C)}function van(C,P){return P.erasNarrowRegex(C)}function wan(C,P){return P._eraYearOrdinalRegex||Or}function QFe(){var C=[],P=[],I=[],k=[],K,le,je=this.eras();for(K=0,le=je.length;K<le;++K)P.push(hm(je[K].name)),C.push(hm(je[K].abbr)),I.push(hm(je[K].narrow)),k.push(hm(je[K].name)),k.push(hm(je[K].abbr)),k.push(hm(je[K].narrow));this._erasRegex=new RegExp("^("+k.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+P.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+C.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+I.join("|")+")","i")}$(0,["gg",2],0,function(){return this.weekYear()%100}),$(0,["GG",2],0,function(){return this.isoWeekYear()%100});function Rfe(C,P){$(0,[C,C.length],0,P)}Rfe("gggg","weekYear"),Rfe("ggggg","weekYear"),Rfe("GGGG","isoWeekYear"),Rfe("GGGGG","isoWeekYear"),jt("weekYear","gg"),jt("isoWeekYear","GG"),qe("weekYear",1),qe("isoWeekYear",1),St("G",js),St("g",js),St("GG",ui,Vo),St("gg",ui,Vo),St("GGGG",ct,Wa),St("gggg",ct,Wa),St("GGGGG",pr,zy),St("ggggg",pr,zy),B0(["gggg","ggggg","GGGG","GGGGG"],function(C,P,I,k){P[k.substr(0,2)]=Re(C)}),B0(["gg","GG"],function(C,P,I,k){P[k]=e.parseTwoDigitYear(C)});function San(C){return qwt.call(this,C,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Can(C){return qwt.call(this,C,this.isoWeek(),this.isoWeekday(),1,4)}function xan(){return QI(this.year(),1,4)}function Oan(){return QI(this.isoWeekYear(),1,4)}function Tan(){var C=this.localeData()._week;return QI(this.year(),C.dow,C.doy)}function Ean(){var C=this.localeData()._week;return QI(this.weekYear(),C.dow,C.doy)}function qwt(C,P,I,k,K){var le;return C==null?aY(this,k,K).year:(le=QI(C,k,K),P>le&&(P=le),Pan.call(this,C,P,I,k,K))}function Pan(C,P,I,k,K){var le=ywt(C,P,I,k,K),je=iY(le.year,0,le.dayOfYear);return this.year(je.getUTCFullYear()),this.month(je.getUTCMonth()),this.date(je.getUTCDate()),this}$("Q",0,"Qo","quarter"),jt("quarter","Q"),qe("quarter",7),St("Q",Sl),_i("Q",function(C,P){P[XI]=(Re(C)-1)*3});function Man(C){return C==null?Math.ceil((this.month()+1)/3):this.month((C-1)*3+this.month()%3)}$("D",["DD",2],"Do","date"),jt("date","D"),qe("date",9),St("D",ui),St("DD",ui,Vo),St("Do",function(C,P){return C?P._dayOfMonthOrdinalParse||P._ordinalParse:P._dayOfMonthOrdinalParseLenient}),_i(["D","DD"],nO),_i("Do",function(C,P){P[nO]=Re(C.match(ui)[0])});var Bwt=nt("Date",!0);$("DDD",["DDDD",3],"DDDo","dayOfYear"),jt("dayOfYear","DDD"),qe("dayOfYear",4),St("DDD",Xt),St("DDDD",Su),_i(["DDD","DDDD"],function(C,P,I){I._dayOfYear=Re(C)});function Ran(C){var P=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return C==null?P:this.add(C-P,"d")}$("m",["mm",2],0,"minute"),jt("minute","m"),qe("minute",14),St("m",ui),St("mm",ui,Vo),_i(["m","mm"],U0);var Aan=nt("Minutes",!1);$("s",["ss",2],0,"second"),jt("second","s"),qe("second",15),St("s",ui),St("ss",ui,Vo),_i(["s","ss"],YI);var Ian=nt("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}),jt("millisecond","ms"),qe("millisecond",16),St("S",Xt,Sl),St("SS",Xt,Vo),St("SSS",Xt,Su);var U$,Uwt;for(U$="SSSS";U$.length<=9;U$+="S")St(U$,Or);function Nan(C,P){P[kU]=Re(("0."+C)*1e3)}for(U$="S";U$.length<=9;U$+="S")_i(U$,Nan);Uwt=nt("Milliseconds",!1),$("z",0,0,"zoneAbbr"),$("zz",0,0,"zoneName");function jan(){return this._isUTC?"UTC":""}function Dan(){return this._isUTC?"Coordinated Universal Time":""}var rt=x.prototype;rt.add=Ein,rt.calendar=jin,rt.clone=Din,rt.diff=Uin,rt.endOf=Yin,rt.format=Jin,rt.from=Kin,rt.fromNow=Win,rt.to=Gin,rt.toNow=Zin,rt.get=wt,rt.invalidAt=san,rt.isAfter=$in,rt.isBefore=Lin,rt.isBetween=Fin,rt.isSame=kin,rt.isSameOrAfter=qin,rt.isSameOrBefore=Bin,rt.isValid=ian,rt.lang=Dwt,rt.locale=jwt,rt.localeData=$wt,rt.max=iin,rt.min=oin,rt.parsingFlags=aan,rt.set=_r,rt.startOf=Xin,rt.subtract=Pin,rt.toArray=ran,rt.toObject=nan,rt.toDate=tan,rt.toISOString=Hin,rt.inspect=Vin,typeof Symbol<"u"&&Symbol.for!=null&&(rt[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),rt.toJSON=oan,rt.toString=zin,rt.unix=ean,rt.valueOf=Qin,rt.creationData=uan,rt.eraName=fan,rt.eraNarrow=pan,rt.eraAbbr=man,rt.eraYear=han,rt.year=gwt,rt.isLeapYear=non,rt.weekYear=San,rt.isoWeekYear=Can,rt.quarter=rt.quarters=Man,rt.month=mwt,rt.daysInMonth=eon,rt.week=rt.weeks=lon,rt.isoWeek=rt.isoWeeks=con,rt.weeksInYear=Tan,rt.weeksInWeekYear=Ean,rt.isoWeeksInYear=xan,rt.isoWeeksInISOWeekYear=Oan,rt.date=Bwt,rt.day=rt.days=Con,rt.weekday=xon,rt.isoWeekday=Oon,rt.dayOfYear=Ran,rt.hour=rt.hours=Ion,rt.minute=rt.minutes=Aan,rt.second=rt.seconds=Ian,rt.millisecond=rt.milliseconds=Uwt,rt.utcOffset=min,rt.utc=gin,rt.local=yin,rt.parseZone=bin,rt.hasAlignedHourOffset=_in,rt.isDST=vin,rt.isLocal=Sin,rt.isUtcOffset=Cin,rt.isUtc=Mwt,rt.isUTC=Mwt,rt.zoneAbbr=jan,rt.zoneName=Dan,rt.dates=T("dates accessor is deprecated. Use date instead.",Bwt),rt.months=T("months accessor is deprecated. Use month instead",mwt),rt.years=T("years accessor is deprecated. Use year instead",gwt),rt.zone=T("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",hin),rt.isDSTShifted=T("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",win);function $an(C){return tl(C*1e3)}function Lan(){return tl.apply(null,arguments).parseZone()}function zwt(C){return C}var rs=U.prototype;rs.calendar=ie,rs.longDateFormat=V,rs.invalidDate=be,rs.ordinal=ht,rs.preparse=zwt,rs.postformat=zwt,rs.relativeTime=Ze,rs.pastFuture=Dr,rs.set=F,rs.eras=lan,rs.erasParse=can,rs.erasConvertYear=dan,rs.erasAbbrRegex=yan,rs.erasNameRegex=gan,rs.erasNarrowRegex=ban,rs.months=Znn,rs.monthsShort=Xnn,rs.monthsParse=Qnn,rs.monthsRegex=ron,rs.monthsShortRegex=ton,rs.week=ion,rs.firstDayOfYear=uon,rs.firstDayOfWeek=son,rs.weekdays=bon,rs.weekdaysMin=von,rs.weekdaysShort=_on,rs.weekdaysParse=Son,rs.weekdaysRegex=Ton,rs.weekdaysShortRegex=Eon,rs.weekdaysMinRegex=Pon,rs.isPM=Ron,rs.meridiem=Non;function Afe(C,P,I,k){var K=eN(),le=f().set(k,P);return K[I](le,C)}function Hwt(C,P,I){if(u(C)&&(P=C,C=void 0),C=C||"",P!=null)return Afe(C,P,I,"month");var k,K=[];for(k=0;k<12;k++)K[k]=Afe(C,k,I,"month");return K}function eke(C,P,I,k){typeof C=="boolean"?(u(P)&&(I=P,P=void 0),P=P||""):(P=C,I=P,C=!1,u(P)&&(I=P,P=void 0),P=P||"");var K=eN(),le=C?K._week.dow:0,je,en=[];if(I!=null)return Afe(P,(I+le)%7,k,"day");for(je=0;je<7;je++)en[je]=Afe(P,(je+le)%7,k,"day");return en}function Fan(C,P){return Hwt(C,P,"months")}function kan(C,P){return Hwt(C,P,"monthsShort")}function qan(C,P,I){return eke(C,P,I,"weekdays")}function Ban(C,P,I){return eke(C,P,I,"weekdaysShort")}function Uan(C,P,I){return eke(C,P,I,"weekdaysMin")}B$("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 P=C%10,I=Re(C%100/10)===1?"th":P===1?"st":P===2?"nd":P===3?"rd":"th";return C+I}}),e.lang=T("moment.lang is deprecated. Use moment.locale instead.",B$),e.langData=T("moment.langData is deprecated. Use moment.localeData instead.",eN);var tN=Math.abs;function zan(){var C=this._data;return this._milliseconds=tN(this._milliseconds),this._days=tN(this._days),this._months=tN(this._months),C.milliseconds=tN(C.milliseconds),C.seconds=tN(C.seconds),C.minutes=tN(C.minutes),C.hours=tN(C.hours),C.months=tN(C.months),C.years=tN(C.years),this}function Vwt(C,P,I,k){var K=z0(P,I);return C._milliseconds+=k*K._milliseconds,C._days+=k*K._days,C._months+=k*K._months,C._bubble()}function Han(C,P){return Vwt(this,C,P,1)}function Van(C,P){return Vwt(this,C,P,-1)}function Jwt(C){return C<0?Math.floor(C):Math.ceil(C)}function Jan(){var C=this._milliseconds,P=this._days,I=this._months,k=this._data,K,le,je,en,Yo;return C>=0&&P>=0&&I>=0||C<=0&&P<=0&&I<=0||(C+=Jwt(tke(I)+P)*864e5,P=0,I=0),k.milliseconds=C%1e3,K=De(C/1e3),k.seconds=K%60,le=De(K/60),k.minutes=le%60,je=De(le/60),k.hours=je%24,P+=De(je/24),Yo=De(Kwt(P)),I+=Yo,P-=Jwt(tke(Yo)),en=De(I/12),I%=12,k.days=P,k.months=I,k.years=en,this}function Kwt(C){return C*4800/146097}function tke(C){return C*146097/4800}function Kan(C){if(!this.isValid())return NaN;var P,I,k=this._milliseconds;if(C=Fe(C),C==="month"||C==="quarter"||C==="year")switch(P=this._days+k/864e5,I=this._months+Kwt(P),C){case"month":return I;case"quarter":return I/3;case"year":return I/12}else switch(P=this._days+Math.round(tke(this._months)),C){case"week":return P/7+k/6048e5;case"day":return P+k/864e5;case"hour":return P*24+k/36e5;case"minute":return P*1440+k/6e4;case"second":return P*86400+k/1e3;case"millisecond":return Math.floor(P*864e5)+k;default:throw new Error("Unknown unit "+C)}}function Wan(){return this.isValid()?this._milliseconds+this._days*864e5+this._months%12*2592e6+Re(this._months/12)*31536e6:NaN}function rN(C){return function(){return this.as(C)}}var Gan=rN("ms"),Zan=rN("s"),Xan=rN("m"),Yan=rN("h"),Qan=rN("d"),esn=rN("w"),tsn=rN("M"),rsn=rN("Q"),nsn=rN("y");function osn(){return z0(this)}function isn(C){return C=Fe(C),this.isValid()?this[C+"s"]():NaN}function BU(C){return function(){return this.isValid()?this._data[C]:NaN}}var asn=BU("milliseconds"),ssn=BU("seconds"),usn=BU("minutes"),lsn=BU("hours"),csn=BU("days"),dsn=BU("months"),fsn=BU("years");function psn(){return De(this.days()/7)}var nN=Math.round,H3={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function msn(C,P,I,k,K){return K.relativeTime(P||1,!!I,C,k)}function hsn(C,P,I,k){var K=z0(C).abs(),le=nN(K.as("s")),je=nN(K.as("m")),en=nN(K.as("h")),Yo=nN(K.as("d")),au=nN(K.as("M")),Jy=nN(K.as("w")),oN=nN(K.as("y")),z$=le<=I.ss&&["s",le]||le<I.s&&["ss",le]||je<=1&&["m"]||je<I.m&&["mm",je]||en<=1&&["h"]||en<I.h&&["hh",en]||Yo<=1&&["d"]||Yo<I.d&&["dd",Yo];return I.w!=null&&(z$=z$||Jy<=1&&["w"]||Jy<I.w&&["ww",Jy]),z$=z$||au<=1&&["M"]||au<I.M&&["MM",au]||oN<=1&&["y"]||["yy",oN],z$[2]=P,z$[3]=+C>0,z$[4]=k,msn.apply(null,z$)}function gsn(C){return C===void 0?nN:typeof C=="function"?(nN=C,!0):!1}function ysn(C,P){return H3[C]===void 0?!1:P===void 0?H3[C]:(H3[C]=P,C==="s"&&(H3.ss=P-1),!0)}function bsn(C,P){if(!this.isValid())return this.localeData().invalidDate();var I=!1,k=H3,K,le;return typeof C=="object"&&(P=C,C=!1),typeof C=="boolean"&&(I=C),typeof P=="object"&&(k=Object.assign({},H3,P),P.s!=null&&P.ss==null&&(k.ss=P.s-1)),K=this.localeData(),le=hsn(this,!I,k,K),I&&(le=K.pastFuture(+this,le)),K.postformat(le)}var rke=Math.abs;function V3(C){return(C>0)-(C<0)||+C}function Ife(){if(!this.isValid())return this.localeData().invalidDate();var C=rke(this._milliseconds)/1e3,P=rke(this._days),I=rke(this._months),k,K,le,je,en=this.asSeconds(),Yo,au,Jy,oN;return en?(k=De(C/60),K=De(k/60),C%=60,k%=60,le=De(I/12),I%=12,je=C?C.toFixed(3).replace(/\.?0+$/,""):"",Yo=en<0?"-":"",au=V3(this._months)!==V3(en)?"-":"",Jy=V3(this._days)!==V3(en)?"-":"",oN=V3(this._milliseconds)!==V3(en)?"-":"",Yo+"P"+(le?au+le+"Y":"")+(I?au+I+"M":"")+(P?Jy+P+"D":"")+(K||k||C?"T":"")+(K?oN+K+"H":"")+(k?oN+k+"M":"")+(C?oN+je+"S":"")):"P0D"}var zi=Ofe.prototype;zi.isValid=cin,zi.abs=zan,zi.add=Han,zi.subtract=Van,zi.as=Kan,zi.asMilliseconds=Gan,zi.asSeconds=Zan,zi.asMinutes=Xan,zi.asHours=Yan,zi.asDays=Qan,zi.asWeeks=esn,zi.asMonths=tsn,zi.asQuarters=rsn,zi.asYears=nsn,zi.valueOf=Wan,zi._bubble=Jan,zi.clone=osn,zi.get=isn,zi.milliseconds=asn,zi.seconds=ssn,zi.minutes=usn,zi.hours=lsn,zi.days=csn,zi.weeks=psn,zi.months=dsn,zi.years=fsn,zi.humanize=bsn,zi.toISOString=Ife,zi.toString=Ife,zi.toJSON=Ife,zi.locale=jwt,zi.localeData=$wt,zi.toIsoString=T("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Ife),zi.lang=Dwt,$("X",0,0,"unix"),$("x",0,0,"valueOf"),St("x",js),St("X",Vb),_i("X",function(C,P,I){I._d=new Date(parseFloat(C)*1e3)}),_i("x",function(C,P,I){I._d=new Date(Re(C))});return e.version="2.29.4",r(tl),e.fn=rt,e.min=ain,e.max=sin,e.now=uin,e.utc=f,e.unix=$an,e.months=Fan,e.isDate=l,e.locale=B$,e.invalid=y,e.duration=z0,e.isMoment=O,e.weekdays=qan,e.parseZone=Lan,e.localeData=eN,e.isDuration=Tfe,e.monthsShort=kan,e.weekdaysMin=Uan,e.defineLocale=zFe,e.updateLocale=Lon,e.locales=Fon,e.weekdaysShort=Ban,e.normalizeUnits=Fe,e.relativeTimeRounding=gsn,e.relativeTimeThreshold=ysn,e.calendarFormat=Nin,e.prototype=rt,e.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},e})});var gAt={};Xn(gAt,{CustomError:()=>Po,TimeoutError:()=>QQ});var Po,QQ,MN=v(()=>{Po=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype)}},QQ=class t extends Error{constructor(e,r){super(`${e} timed out after ${r}ms`),this.name="TimeoutError",Object.setPrototypeOf(this,t.prototype)}}});function bAt(t){let e=t?.detail||{};return{status:e.status,message:e.message||t?.message,reason:e.reason}}function qyn(t){let e=bAt(t);return e.reason==="Invalid license key"||t?.message==="Invalid license key"||t?.message?.includes("status 403")||e.status===403}function _At(t){let e=bAt(t);return qyn(t)?K2e.INVALID_LICENSE_KEY_USER:e.message||(e.reason?`Error: ${e.reason}`:K2e.UNKNOWN_ERROR)}function k6(t){return t.replace(/^#/,"").trim()}function CO(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(k6(a)))}return n&&(Array.isArray(n)?n.forEach(i=>{typeof i=="string"&&o.add(k6(i))}):typeof n=="string"&&o.add(k6(n))),Array.from(o)}function Fhe(t,e,r){if(e.length===0)return[];e=e.map(i=>k6(i));let n=r&&r.length>0?r:eee(t,"/"),o=[];for(let i of n){let a=CO(i);e.some(s=>a.includes(s))&&o.push(i)}return o}async function ty(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 q6(t,e){return t.extension!="md"&&t.extension!="canvas"?null:await e.cachedRead(t)}function khe(t){return t.basename}function G2e(t){return t?t.extension==="md"||t.extension==="pdf"||t.extension==="canvas":!1}function s_(t){return t==="copilot_plus"||t==="project"}function B6(t,e){return t?t.extension==="md"||t.extension==="canvas"?!0:s_(e):!1}function wAt(t,e){return!t||!e?!1:t.includes(W2e)&&e.includes(W2e)||t==="small"&&e==="cohereai"||t==="cohereai"&&e==="small"?!0:t===e}function U6(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 xO(t,e){let r=/\[\[(.*?)\]\]/g,n=t.match(r),o=new Map;return n&&n.forEach(i=>{let a=i.slice(2,-2),s=e.getAbstractFileByPath(a);if(s instanceof ry.TFile)o.set(s.path,s);else{let l=e.getMarkdownFiles().filter(c=>c.basename===a);l.length>0&&(zyn(a,e)?o.set(l[0].path,l[0]):console.warn(`Found multiple files with title "${a}". Expected a full path for duplicate titles.`))}}),Array.from(o.values())}function zyn(t,e){return e.getMarkdownFiles().filter(n=>n.basename===t).length===1}function SAt(t){return t=t.trim(),t.startsWith("[[")&&t.endsWith("]]")?`${t.slice(2,-2).trim()}.md`:t}function CAt(t){let e=new Set;return t.forEach(r=>{r.metadata?.title&&e.add(r.metadata?.title)}),Array.from(e)}function Z2e(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=Vyn(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 Vyn(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 xAt(t){return`https://www.youtube.com/watch?v=${t}`}function OAt(t){return Z2e(t).isValid}function TAt(t){let e=t.matchAll(new RegExp(Hyn,"g"));return Array.from(e,r=>r[0])}async function Wc(t,e={}){let r=new Headers(e.headers),n=Object.fromEntries(r.entries());delete n["content-length"],J("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(K2e.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:Jyn(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 Jyn(t){return new ReadableStream({start(e){let n=new TextEncoder().encode(t);e.enqueue(n),e.close()}})}function tee(t,e){let r={...t};return e.forEach(n=>{delete r[n]}),r}function qhe(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 RN(t){let e=J6[t];return{...e,label:e.label||t}}function ib(t,e){let r=J6[t]?.label||t;return r+(e?.believerExclusive&&r==="Copilot Plus"?"(Believer)":"")}function Bhe(t){let e=t;return e=Lz(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 $z(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=Bhe(t);e?n.replaceRange(a,o,i):n.replaceRange(a,i),new ry.Notice("Message inserted into the active note.")}function Uhe(t,e){let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>t(...n),e)}}function zhe(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 EAt(){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 ree(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 Kyn(t){return typeof t=="string"?t.startsWith("gpt-5"):(t.modelName||t.model||"").startsWith("gpt-5")}function z6(t){let e=typeof t=="string"?t:t.modelName||t.model||"",r=ree(e),n=Kyn(e),o=e.startsWith("claude-3-7-sonnet")||e.startsWith("claude-sonnet-4");return{isOSeries:r,isGPT5:n,isThinkingEnabled:o}}function wL(t,e="system"){return ree(t)?"human":e}function X2e(){let t=["3rd party (openai-format)","ollama","lm-studio","azure openai","copilot-plus","copilot-plus-jina"];return Object.entries(J6).filter(([e])=>!t.includes(e)).map(([e])=>e)}function H6(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."};let r=!!X2e().find(i=>i===t.provider),n=AN[t.provider],o=!t.apiKey&&!e[n];return r&&o?{hasApiKey:!1,errorNotice:`Please configure API Key for ${t.name} in settings first.
|
||
Path: Settings > copilot plugin > Basic Tab > Set Keys`}:{hasApiKey:!0}}function Hhe(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>e.type==="text").map(e=>e.text).join(""):String(t||"")}function Lz(t){let r=Hhe(t).replace(/<think>[\s\S]*?<\/think>/g,"");return r=r.replace(/<think>[\s\S]*$/g,""),r.trim()}function V6(t){return Hhe(t).replace(/<errorChunk>[\s\S]*?<\/errorChunk>/g,"").trim()}function PAt(){return crypto.randomUUID()}async function Xh(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 Vhe(t,e,r="Operation"){let{TimeoutError:n}=await Promise.resolve().then(()=>(MN(),gAt)),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 Y2e(){let t=app.workspace.getActiveViewOfType(ry.MarkdownView);return t?t.getState().source===!0:!0}function nee(t){return new TextEncoder().encode(t).length}function Q2e(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}var yAt,ry,K2e,eee,Byn,Uyn,vAt,Zh,Hyn,wr=v(()=>{gd();zr();Dt();yAt=L(hAt()),ry=require("obsidian");H2e();K2e={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})};Byn=t=>t.last?.modelName||t.last?.model,Uyn=t=>t.last?.retriever!==void 0,vAt=t=>Byn(t)||Uyn(t),Zh=(t,e="local")=>{let r=(0,yAt.default)(t);return e==="utc"&&r.utc(),{fileName:r.format("YYYYMMDD_HHmmss"),display:r.format("YYYY/MM/DD HH:mm:ss"),epoch:r.valueOf()}};Hyn=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|shorts\/)|youtu\.be\/)([^\s&]+)/});var K6,eHe,oee,gd=v(()=>{_O();Tv();xv();E2e();wr();K6=class K6{static createNewLLMChain(e){let{llm:r,memory:n,prompt:o,abortController:i}=e,a=r.withConfig({signal:i?.signal}),s=El.from([{input:u=>u.input,memory:()=>n.loadMemoryVariables({})},{input:u=>u.input,history:u=>u.memory.history},o,a]);return K6.instances.set("llm_chain",s),console.log("New LLM chain created."),s}static getLLMChainFromMap(e){let r=K6.instances.get("llm_chain");return r||(r=K6.createNewLLMChain(e)),r}static createConversationalRetrievalChain(e,r,n){let{llm:o,retriever:i,systemMessage:a}=e,u=uu.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=uu.fromTemplate(`{system_message}
|
||
|
||
Answer the question with as detailed as possible based only on the following context:
|
||
{context}
|
||
|
||
Question: {question}
|
||
`),d=g=>g.map(b=>`Human: ${b[0]}
|
||
Assistant: ${b[1]}`).join(`
|
||
`),f=El.from([{question:g=>(n&&console.log("Input Question: ",g.question),g.question),chat_history:g=>{let y=d(g.chat_history);return n&&console.log("Formatted Chat History: ",y),y}},u,o,new whe,g=>{let y=Lz(g),b=V6(y);return n&&console.log("Standalone Question: ",b),b}]),p=async g=>(r(g),GQ(g)),m=El.from([{context:i.pipe(p),question:new xu,system_message:()=>a},c,o]);return f.pipe(m)}};K6.instances=new Map;eHe=K6,oee=eHe});var iee=v(()=>{});var tHe,Fz,Tc,Xs,TO,wO,Wyn,Gyn,Zyn,z2e,pAt,RAt,aee,u_,see,kz,uee,lee,rHe,qz,nHe,oHe,W6,EO,IN,ny,OO,SL,SO,vL,Dz,W2e,J6,AN,AAt,Nn,Jhe,Xw,G6,Ls,Yw,zr=v(()=>{J3();gd();iee();tHe="https://api.brevilabs.com/v1",Fz="https://models.brevilabs.com/v1",Tc="copilot-chat-view",Xs="user",TO="ai",wO="copilot",Wyn=`${wO}/copilot-conversations`,Gyn=`${wO}/copilot-custom-prompts`,Zyn=`${wO}/memory`,z2e=wO,pAt=`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.`,RAt=`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.
|
||
`,aee="note_context",u_="selected_text",see="variable",kz="variable_note",uee="embedded_pdf",lee="dataview_block",rHe="retrieved_document",qz=6e3,nHe=.4,oHe=448e3,W6=3e4,EO={DEFAULT:"",READING_FILES:"Reading files",SEARCHING_WEB:"Searching the web",READING_FILE_TREE:"Reading file tree"},IN={SETTINGS:"settings",EXPIRED_MODAL:"expired_modal",CHAT_MODE_SELECT:"chat_mode_select",MODE_SELECT_TOOLTIP:"mode_select_tooltip"},ny={MAX_TOKENS:6e3,TEMPERATURE:.1,REASONING_EFFORT:"low",VERBOSITY:"medium"},OO=(h=>(h.OPENAI="openai",h.OPENAI_FORMAT="3rd party (openai-format)",h.AZURE_OPENAI="azure openai",h.ANTHROPIC="anthropic",h.COHEREAI="cohereai",h.GOOGLE="google",h.XAI="xai",h.OPENROUTERAI="openrouterai",h.GROQ="groq",h.OLLAMA="ollama",h.LM_STUDIO="lm-studio",h.COPILOT_PLUS="copilot-plus",h.MISTRAL="mistralai",h.DEEPSEEK="deepseek",h.AMAZON_BEDROCK="amazon-bedrock",h))(OO||{}),SL={reasoning:"This model supports general reasoning tasks.",vision:"This model supports image inputs.",websearch:"This model can access the internet."},SO=[{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:"x-ai/grok-4-fast",provider:"openrouterai",enabled:!0,isBuiltIn:!0,core:!1,projectEnabled:!0},{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-5-nano",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:"gpt-4.1-nano",provider:"openai",enabled:!0,isBuiltIn:!0,capabilities:["vision"]},{name:"claude-sonnet-4-20250514",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"claude-3-7-sonnet-latest",provider:"anthropic",enabled:!0,isBuiltIn:!0,capabilities:["vision","reasoning"]},{name:"grok-3-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"grok-3-mini-beta",provider:"xai",enabled:!0,isBuiltIn:!0},{name:"gemini-2.5-flash",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"]}],vL=(l=>(l.OPENAI="openai",l.COHEREAI="cohereai",l.GOOGLE="google",l.AZURE_OPENAI="azure openai",l.OLLAMA="ollama",l.LM_STUDIO="lm-studio",l.OPENAI_FORMAT="3rd party (openai-format)",l.COPILOT_PLUS="copilot-plus",l.COPILOT_PLUS_JINA="copilot-plus-jina",l))(vL||{}),Dz=[{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}],W2e="nomic-embed-text",J6={openrouterai:{label:"OpenRouter",host:"https://openrouter.ai/api/v1/",keyManagementURL:"https://openrouter.ai/keys",listModelURL:"https://openrouter.ai/api/v1/models",testModel:"openai/chatgpt-4o-latest"},google:{label:"Gemini",host:"https://generativelanguage.googleapis.com",keyManagementURL:"https://makersuite.google.com/app/apikey",listModelURL:"https://generativelanguage.googleapis.com/v1beta/models",testModel:"gemini-2.5-flash"},openai:{label:"OpenAI",host:"https://api.openai.com",keyManagementURL:"https://platform.openai.com/api-keys",listModelURL:"https://api.openai.com/v1/models",testModel:"gpt-4.1"},"azure openai":{label:"Azure OpenAI",host:"",keyManagementURL:"",listModelURL:"",testModel:"azure-openai"},anthropic:{label:"Anthropic",host:"https://api.anthropic.com/",keyManagementURL:"https://console.anthropic.com/settings/keys",listModelURL:"https://api.anthropic.com/v1/models",testModel:"claude-3-5-sonnet-latest"},cohereai:{label:"Cohere",host:"https://api.cohere.com",keyManagementURL:"https://dashboard.cohere.ai/api-keys",listModelURL:"https://api.cohere.com/v1/models",testModel:"command-r"},xai:{label:"XAI",host:"https://api.x.ai/v1",keyManagementURL:"https://console.x.ai",listModelURL:"https://api.x.ai/v1/models",testModel:"grok-3-beta"},groq:{label:"Groq",host:"https://api.groq.com/openai",keyManagementURL:"https://console.groq.com/keys",listModelURL:"https://api.groq.com/openai/v1/models",testModel:"llama3-8b-8192"},ollama:{label:"Ollama",host:"http://localhost:11434/v1/",keyManagementURL:"",listModelURL:""},"lm-studio":{label:"LM Studio",host:"http://localhost:1234/v1",keyManagementURL:"",listModelURL:""},"3rd party (openai-format)":{label:"OpenAI Format",host:"https://api.example.com/v1",keyManagementURL:"",listModelURL:""},mistralai:{label:"Mistral",host:"https://api.mistral.ai/v1",keyManagementURL:"https://console.mistral.ai/api-keys",listModelURL:"https://api.mistral.ai/v1/models",testModel:"mistral-tiny-latest"},deepseek:{label:"DeepSeek",host:"https://api.deepseek.com/",keyManagementURL:"https://platform.deepseek.com/api-keys",listModelURL:"https://api.deepseek.com/models",testModel:"deepseek-chat"},"amazon-bedrock":{label:"Amazon Bedrock",host:"https://bedrock-runtime.{region}.amazonaws.com",keyManagementURL:"https://console.aws.amazon.com/iam/home#/security_credentials",listModelURL:""},"copilot-plus":{label:"Copilot Plus",host:Fz,keyManagementURL:"",listModelURL:""},"copilot-plus-jina":{label:"Copilot Plus",host:Fz,keyManagementURL:"",listModelURL:""}},AN={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"},AAt=["NEVER","ON STARTUP","ON MODE SWITCH"],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",TOGGLE_AUTOCOMPLETE:"toggle-autocomplete",ADD_SELECTION_TO_CHAT_CONTEXT:"add-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"},Jhe={[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.TOGGLE_AUTOCOMPLETE]:"Toggle autocomplete",[Nn.ADD_SELECTION_TO_CHAT_CONTEXT]:"Add 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)"},Xw={DELAY_MS:600,MIN_TRIGGER_LENGTH:3,MAX_CONTEXT_LENGTH:1e4,KEYBIND:"Tab"},G6={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.`},Ls={userId:H0(),isPlusUser:!1,plusLicenseKey:"",openAIApiKey:"",openAIOrgId:"",huggingfaceApiKey:"",cohereApiKey:"",anthropicApiKey:"",azureOpenAIApiKey:"",azureOpenAIApiInstanceName:"",azureOpenAIApiDeploymentName:"",azureOpenAIApiVersion:"",azureOpenAIApiEmbeddingDeploymentName:"",googleApiKey:"",openRouterAiApiKey:"",xaiApiKey:"",mistralApiKey:"",deepseekApiKey:"",amazonBedrockApiKey:"",amazonBedrockRegion:"",defaultChainType:"llm_chain",defaultModelKey:"google/gemini-2.5-flash|openrouterai",embeddingModelKey:"text-embedding-3-small|openai",temperature:ny.TEMPERATURE,maxTokens:ny.MAX_TOKENS,contextTurns:15,userSystemPrompt:"",openAIProxyBaseUrl:"",openAIEmbeddingProxyBaseUrl:"",stream:!0,defaultSaveFolder:Wyn,defaultConversationTag:"copilot-conversation",autosaveChat:!0,generateAIChatTitleOnSave:!0,includeActiveNoteAsContext:!0,defaultOpenArea:"view",customPromptsFolder:Gyn,indexVaultToVectorStore:"ON MODE SWITCH",qaExclusions:z2e,qaInclusions:"",chatNoteContextPath:"",chatNoteContextTags:[],enableIndexSync:!0,debug:!1,enableEncryption:!1,maxSourceChunks:15,groqApiKey:"",activeModels:SO,activeEmbeddingModels:Dz,embeddingRequestsPerMin:60,embeddingBatchSize:16,disableIndexOnMobile:!0,showSuggestedPrompts:!0,showRelevantNotes:!0,numPartitions:1,lexicalSearchRamLimit:100,promptUsageTimestamps:{},promptSortStrategy:"timestamp",defaultConversationNoteName:"{$topic}@{$date}_{$time}",inlineEditCommands:[],projectList:[],enableAutocomplete:!1,autocompleteAcceptKey:Xw.KEYBIND,allowAdditionalContext:!0,enableWordCompletion:!1,lastDismissedVersion:null,passMarkdownImages:!0,enableAutonomousAgent:!1,enableCustomPromptTemplating:!0,enableSemanticSearchV3:!1,enableLexicalBoosts:!0,suggestedDefaultCommands:!1,autonomousAgentMaxIterations:4,autonomousAgentEnabledToolIds:["localSearch","readNote","webSearch","pomodoro","youtubeTranscription","writeToFile","replaceInFile","updateMemory"],reasoningEffort:ny.REASONING_EFFORT,verbosity:ny.VERBOSITY,memoryFolderName:Zyn,enableRecentConversations:!0,maxRecentConversations:30,enableSavedMemory:!0,enableInlineCitations:!0,quickCommandModelKey:void 0,quickCommandIncludeNoteContext:!0},Yw={CHAT_IS_VISIBLE:"chat-is-visible",ACTIVE_LEAF_CHANGE:"active-leaf-change",ABORT_STREAM:"abort-stream"}});var aHe=S(Khe=>{"use strict";Khe.byteLength=Yyn;Khe.toByteArray=ebn;Khe.fromByteArray=nbn;var PO=[],Qw=[],Xyn=typeof Uint8Array<"u"?Uint8Array:Array,iHe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Bz=0,IAt=iHe.length;Bz<IAt;++Bz)PO[Bz]=iHe[Bz],Qw[iHe.charCodeAt(Bz)]=Bz;var Bz,IAt;Qw[45]=62;Qw[95]=63;function NAt(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 Yyn(t){var e=NAt(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Qyn(t,e,r){return(e+r)*3/4-r}function ebn(t){var e,r=NAt(t),n=r[0],o=r[1],i=new Xyn(Qyn(t,n,o)),a=0,s=o>0?n-4:n,u;for(u=0;u<s;u+=4)e=Qw[t.charCodeAt(u)]<<18|Qw[t.charCodeAt(u+1)]<<12|Qw[t.charCodeAt(u+2)]<<6|Qw[t.charCodeAt(u+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=Qw[t.charCodeAt(u)]<<2|Qw[t.charCodeAt(u+1)]>>4,i[a++]=e&255),o===1&&(e=Qw[t.charCodeAt(u)]<<10|Qw[t.charCodeAt(u+1)]<<4|Qw[t.charCodeAt(u+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function tbn(t){return PO[t>>18&63]+PO[t>>12&63]+PO[t>>6&63]+PO[t&63]}function rbn(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(tbn(n));return o.join("")}function nbn(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,s=r-n;a<s;a+=i)o.push(rbn(t,a,a+i>s?s:a+i));return n===1?(e=t[r-1],o.push(PO[e>>2]+PO[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(PO[e>>10]+PO[e>>4&63]+PO[e<<2&63]+"=")),o.join("")}});var jAt=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 eS=S(Q6=>{"use strict";var uHe=aHe(),X6=jAt(),DAt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Q6.Buffer=ke;Q6.SlowBuffer=lbn;Q6.INSPECT_MAX_BYTES=50;var Whe=2147483647;Q6.kMaxLength=Whe;ke.TYPED_ARRAY_SUPPORT=obn();!ke.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 obn(){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(ke.prototype,"parent",{enumerable:!0,get:function(){if(ke.isBuffer(this))return this.buffer}});Object.defineProperty(ke.prototype,"offset",{enumerable:!0,get:function(){if(ke.isBuffer(this))return this.byteOffset}});function NN(t){if(t>Whe)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,ke.prototype),e}function ke(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 fHe(t)}return kAt(t,e,r)}ke.poolSize=8192;function kAt(t,e,r){if(typeof t=="string")return abn(t,e);if(ArrayBuffer.isView(t))return sbn(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(MO(t,ArrayBuffer)||t&&MO(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(MO(t,SharedArrayBuffer)||t&&MO(t.buffer,SharedArrayBuffer)))return cHe(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 ke.from(n,e,r);let o=ubn(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return ke.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)}ke.from=function(t,e,r){return kAt(t,e,r)};Object.setPrototypeOf(ke.prototype,Uint8Array.prototype);Object.setPrototypeOf(ke,Uint8Array);function qAt(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 ibn(t,e,r){return qAt(t),t<=0?NN(t):e!==void 0?typeof r=="string"?NN(t).fill(e,r):NN(t).fill(e):NN(t)}ke.alloc=function(t,e,r){return ibn(t,e,r)};function fHe(t){return qAt(t),NN(t<0?0:pHe(t)|0)}ke.allocUnsafe=function(t){return fHe(t)};ke.allocUnsafeSlow=function(t){return fHe(t)};function abn(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!ke.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=BAt(t,e)|0,n=NN(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function lHe(t){let e=t.length<0?0:pHe(t.length)|0,r=NN(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function sbn(t){if(MO(t,Uint8Array)){let e=new Uint8Array(t);return cHe(e.buffer,e.byteOffset,e.byteLength)}return lHe(t)}function cHe(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,ke.prototype),n}function ubn(t){if(ke.isBuffer(t)){let e=pHe(t.length)|0,r=NN(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||hHe(t.length)?NN(0):lHe(t);if(t.type==="Buffer"&&Array.isArray(t.data))return lHe(t.data)}function pHe(t){if(t>=Whe)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Whe.toString(16)+" bytes");return t|0}function lbn(t){return+t!=t&&(t=0),ke.alloc(+t)}ke.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==ke.prototype};ke.compare=function(e,r){if(MO(e,Uint8Array)&&(e=ke.from(e,e.offset,e.byteLength)),MO(r,Uint8Array)&&(r=ke.from(r,r.offset,r.byteLength)),!ke.isBuffer(e)||!ke.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};ke.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}};ke.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return ke.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let o=ke.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){let a=e[n];if(MO(a,Uint8Array))i+a.length>o.length?(ke.isBuffer(a)||(a=ke.from(a)),a.copy(o,i)):Uint8Array.prototype.set.call(o,a,i);else if(ke.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function BAt(t,e){if(ke.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||MO(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 dHe(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ZAt(t).length;default:if(o)return n?-1:dHe(t).length;e=(""+e).toLowerCase(),o=!0}}ke.byteLength=BAt;function cbn(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 vbn(this,e,r);case"utf8":case"utf-8":return zAt(this,e,r);case"ascii":return bbn(this,e,r);case"latin1":case"binary":return _bn(this,e,r);case"base64":return gbn(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wbn(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}ke.prototype._isBuffer=!0;function Uz(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}ke.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)Uz(this,r,r+1);return this};ke.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)Uz(this,r,r+3),Uz(this,r+1,r+2);return this};ke.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)Uz(this,r,r+7),Uz(this,r+1,r+6),Uz(this,r+2,r+5),Uz(this,r+3,r+4);return this};ke.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?zAt(this,0,e):cbn.apply(this,arguments)};ke.prototype.toLocaleString=ke.prototype.toString;ke.prototype.equals=function(e){if(!ke.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:ke.compare(this,e)===0};ke.prototype.inspect=function(){let e="",r=Q6.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};DAt&&(ke.prototype[DAt]=ke.prototype.inspect);ke.prototype.compare=function(e,r,n,o,i){if(MO(e,Uint8Array)&&(e=ke.from(e,e.offset,e.byteLength)),!ke.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 UAt(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,hHe(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=ke.from(e,n)),ke.isBuffer(e))return e.length===0?-1:$At(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):$At(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function $At(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}ke.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};ke.prototype.indexOf=function(e,r,n){return UAt(this,e,r,n,!0)};ke.prototype.lastIndexOf=function(e,r,n){return UAt(this,e,r,n,!1)};function dbn(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(hHe(s))return a;t[r+a]=s}return a}function fbn(t,e,r,n){return Ghe(dHe(e,t.length-r),t,r,n)}function pbn(t,e,r,n){return Ghe(Obn(e),t,r,n)}function mbn(t,e,r,n){return Ghe(ZAt(e),t,r,n)}function hbn(t,e,r,n){return Ghe(Tbn(e,t.length-r),t,r,n)}ke.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 dbn(this,e,r,n);case"utf8":case"utf-8":return fbn(this,e,r,n);case"ascii":case"latin1":case"binary":return pbn(this,e,r,n);case"base64":return mbn(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hbn(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};ke.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function gbn(t,e,r){return e===0&&r===t.length?uHe.fromByteArray(t):uHe.fromByteArray(t.slice(e,r))}function zAt(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 ybn(n)}var LAt=4096;function ybn(t){let e=t.length;if(e<=LAt)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=LAt));return r}function bbn(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 _bn(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 vbn(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+=Ebn[t[i]];return o}function wbn(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}ke.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,ke.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")}ke.prototype.readUintLE=ke.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};ke.prototype.readUintBE=ke.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};ke.prototype.readUint8=ke.prototype.readUInt8=function(e,r){return e=e>>>0,r||nh(e,1,this.length),this[e]};ke.prototype.readUint16LE=ke.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||nh(e,2,this.length),this[e]|this[e+1]<<8};ke.prototype.readUint16BE=ke.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||nh(e,2,this.length),this[e]<<8|this[e+1]};ke.prototype.readUint32LE=ke.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};ke.prototype.readUint32BE=ke.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])};ke.prototype.readBigUInt64LE=CL(function(e){e=e>>>0,Y6(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&cee(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))});ke.prototype.readBigUInt64BE=CL(function(e){e=e>>>0,Y6(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&cee(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)});ke.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};ke.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};ke.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]};ke.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};ke.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};ke.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};ke.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]};ke.prototype.readBigInt64LE=CL(function(e){e=e>>>0,Y6(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&cee(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)});ke.prototype.readBigInt64BE=CL(function(e){e=e>>>0,Y6(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&cee(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)});ke.prototype.readFloatLE=function(e,r){return e=e>>>0,r||nh(e,4,this.length),X6.read(this,e,!0,23,4)};ke.prototype.readFloatBE=function(e,r){return e=e>>>0,r||nh(e,4,this.length),X6.read(this,e,!1,23,4)};ke.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||nh(e,8,this.length),X6.read(this,e,!0,52,8)};ke.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||nh(e,8,this.length),X6.read(this,e,!1,52,8)};function l_(t,e,r,n,o,i){if(!ke.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")}ke.prototype.writeUintLE=ke.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;l_(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};ke.prototype.writeUintBE=ke.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;l_(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};ke.prototype.writeUint8=ke.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||l_(this,e,r,1,255,0),this[r]=e&255,r+1};ke.prototype.writeUint16LE=ke.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||l_(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};ke.prototype.writeUint16BE=ke.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||l_(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};ke.prototype.writeUint32LE=ke.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||l_(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};ke.prototype.writeUint32BE=ke.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||l_(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 HAt(t,e,r,n,o){GAt(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 VAt(t,e,r,n,o){GAt(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}ke.prototype.writeBigUInt64LE=CL(function(e,r=0){return HAt(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});ke.prototype.writeBigUInt64BE=CL(function(e,r=0){return VAt(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});ke.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);l_(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};ke.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){let u=Math.pow(2,8*n-1);l_(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};ke.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||l_(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};ke.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||l_(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};ke.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||l_(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};ke.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||l_(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};ke.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||l_(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};ke.prototype.writeBigInt64LE=CL(function(e,r=0){return HAt(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ke.prototype.writeBigInt64BE=CL(function(e,r=0){return VAt(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function JAt(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 KAt(t,e,r,n,o){return e=+e,r=r>>>0,o||JAt(t,e,r,4,34028234663852886e22,-34028234663852886e22),X6.write(t,e,r,n,23,4),r+4}ke.prototype.writeFloatLE=function(e,r,n){return KAt(this,e,r,!0,n)};ke.prototype.writeFloatBE=function(e,r,n){return KAt(this,e,r,!1,n)};function WAt(t,e,r,n,o){return e=+e,r=r>>>0,o||JAt(t,e,r,8,17976931348623157e292,-17976931348623157e292),X6.write(t,e,r,n,52,8),r+8}ke.prototype.writeDoubleLE=function(e,r,n){return WAt(this,e,r,!0,n)};ke.prototype.writeDoubleBE=function(e,r,n){return WAt(this,e,r,!1,n)};ke.prototype.copy=function(e,r,n,o){if(!ke.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};ke.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"&&!ke.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=ke.isBuffer(e)?e:ke.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 Z6={};function mHe(t,e,r){Z6[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=FAt(String(r)):typeof r=="bigint"&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=FAt(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function FAt(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Sbn(t,e,r){Y6(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&cee(e,t.length-(r+1))}function GAt(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 Z6.ERR_OUT_OF_RANGE("value",s,t)}Sbn(n,o,i)}function Y6(t,e){if(typeof t!="number")throw new Z6.ERR_INVALID_ARG_TYPE(e,"number",t)}function cee(t,e,r){throw Math.floor(t)!==t?(Y6(t,r),new Z6.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Z6.ERR_BUFFER_OUT_OF_BOUNDS:new Z6.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Cbn=/[^+/0-9A-Za-z-_]/g;function xbn(t){if(t=t.split("=")[0],t=t.trim().replace(Cbn,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function dHe(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 Obn(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Tbn(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 ZAt(t){return uHe.toByteArray(xbn(t))}function Ghe(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 MO(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function hHe(t){return t!==t}var Ebn=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 CL(t){return typeof BigInt>"u"?Pbn:t}function Pbn(){throw new Error("BigInt not supported")}});function dee(){return YAt.Platform.isDesktop&&Zhe||(Zhe=require("electron")?.remote?.safeStorage),Zhe}async function vHe(){return await crypto.subtle.importKey("raw",Mbn,Xhe.name,!1,["encrypt","decrypt"])}async function QAt(t){if(!t.enableEncryption)return t;let e={...t},r=Object.keys(t).filter(n=>n.toLowerCase().includes("apikey")||n==="plusLicenseKey");for(let n of r){let o=t[n];e[n]=await gHe(o)}return Array.isArray(t.activeModels)&&(e.activeModels=await Promise.all(t.activeModels.map(async n=>({...n,apiKey:await gHe(n.apiKey||"")})))),Array.isArray(t.activeEmbeddingModels)&&(e.activeEmbeddingModels=await Promise.all(t.activeEmbeddingModels.map(async n=>({...n,apiKey:await gHe(n.apiKey||"")})))),e}async function gHe(t){if(!t||t.startsWith(wHe))return t;eIt(t)&&(t=t.replace(Yhe,""));try{if(dee()?.isEncryptionAvailable()){let o=dee().encryptString(t);return bHe+o.toString("base64")}let e=await vHe(),r=new TextEncoder().encode(t),n=await crypto.subtle.encrypt(Xhe,e,r);return _He+Abn(n)}catch(e){return console.error("Encryption failed:",e),t}}async function $i(t){if(!t||Rbn(t))return t;if(eIt(t))return t.replace(Yhe,"");if(t.startsWith(bHe)){let r=t.replace(bHe,""),n=yHe.Buffer.from(r,"base64");return dee().decryptString(n)}if(t.startsWith(_He)){let r=t.replace(_He,""),n=await vHe(),o=XAt(r),i=await crypto.subtle.decrypt(Xhe,n,o);return new TextDecoder().decode(i)}let e=t.replace(wHe,"");try{if(dee()?.isEncryptionAvailable())try{let i=yHe.Buffer.from(e,"base64");return dee().decryptString(i)}catch{}let r=await vHe(),n=XAt(e),o=await crypto.subtle.decrypt(Xhe,r,n);return new TextDecoder().decode(o)}catch(r){return console.error("Decryption failed:",r),"Copilot failed to decrypt API keys!"}}function Rbn(t){return!t.startsWith(wHe)&&!t.startsWith(Yhe)}function eIt(t){return t.startsWith(Yhe)}function Abn(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 XAt(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 yHe,YAt,Zhe,bHe,_He,wHe,Yhe,Mbn,Xhe,zz=v(()=>{yHe=L(eS()),YAt=require("obsidian"),Zhe=null;bHe="enc_desk_",_He="enc_web_",wHe="enc_",Yhe="dec_",Mbn=new TextEncoder().encode("obsidian-copilot-v1"),Xhe={name:"AES-GCM",iv:new Uint8Array(12)}});function oIt(t){ei.set(ege,t)}function eK(){return ei.get(ege)}function iIt(t){return ei.sub(ege,t)}function xL(){return $6(ege,{store:ei})}function jN(){return ei.get(tge)}function Hz(t){ei.set(tge,t)}function aIt(t){return ei.sub(tge,t)}function Ev(){return $6(tge,{store:ei})}function Vz(t){ei.set(Qhe,t)}function tc(){return ei.get(Qhe)}function tK(t){return ei.sub(Qhe,()=>{t(ei.get(Qhe))})}function RO(t){ei.set(nIt,t)}function rge(){return $6(nIt,{store:ei})}function Jz(){return jN()==="project"}function CHe(t){ei.set(SHe,t)}function Kz(){return ei.get(SHe)}function sIt(t){let e=Kz();CHe([...e,t])}function uIt(t){let e=Kz();CHe(e.filter(r=>r.id!==t))}function lIt(){CHe([])}function cIt(){return $6(SHe,{store:ei})}function dIt(t){ei.set(fee,t)}function AO(t,e){ei.set(fee,r=>({...r,[t]:e(r[t])}))}function nge(){return $6(fee,{store:ei})}var tIt,ege,rIt,tge,Qhe,nIt,fee,SHe,Tu=v(()=>{gd();Pt();TN();tIt=th(null),ege=th(t=>{let e=t(tIt);return e!==null?e:t(_L).defaultModelKey},(t,e,r)=>{e(tIt,r)}),rIt=th(null),tge=th(t=>{let e=t(rIt);return e!==null?e:t(_L).defaultChainType},(t,e,r)=>{e(rIt,r)}),Qhe=th(null),nIt=th(!1),fee=th({success:[],failed:[],processingFiles:[],total:[]}),SHe=th([])});var wIt=S(ku=>{"use strict";function EHe(t,e){var r=t.length;t.push(e);e:for(;0<r;){var n=r-1>>>1,o=t[n];if(0<oge(o,e))t[n]=e,t[r]=o,r=n;else break e}}function Q0(t){return t.length===0?null:t[0]}function age(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>oge(s,r))u<o&&0>oge(l,s)?(t[n]=l,t[u]=r,n=u):(t[n]=s,t[a]=r,n=a);else if(u<o&&0>oge(l,r))t[n]=l,t[u]=r,n=u;else break e}}return e}function oge(t,e){var r=t.sortIndex-e.sortIndex;return r!==0?r:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(fIt=performance,ku.unstable_now=function(){return fIt.now()}):(xHe=Date,pIt=xHe.now(),ku.unstable_now=function(){return xHe.now()-pIt});var fIt,xHe,pIt,IO=[],OL=[],Ibn=1,tS=null,oy=3,sge=!1,Wz=!1,mee=!1,gIt=typeof setTimeout=="function"?setTimeout:null,yIt=typeof clearTimeout=="function"?clearTimeout:null,mIt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function PHe(t){for(var e=Q0(OL);e!==null;){if(e.callback===null)age(OL);else if(e.startTime<=t)age(OL),e.sortIndex=e.expirationTime,EHe(IO,e);else break;e=Q0(OL)}}function MHe(t){if(mee=!1,PHe(t),!Wz)if(Q0(IO)!==null)Wz=!0,AHe(RHe);else{var e=Q0(OL);e!==null&&IHe(MHe,e.startTime-t)}}function RHe(t,e){Wz=!1,mee&&(mee=!1,yIt(hee),hee=-1),sge=!0;var r=oy;try{for(PHe(e),tS=Q0(IO);tS!==null&&(!(tS.expirationTime>e)||t&&!vIt());){var n=tS.callback;if(typeof n=="function"){tS.callback=null,oy=tS.priorityLevel;var o=n(tS.expirationTime<=e);e=ku.unstable_now(),typeof o=="function"?tS.callback=o:tS===Q0(IO)&&age(IO),PHe(e)}else age(IO);tS=Q0(IO)}if(tS!==null)var i=!0;else{var a=Q0(OL);a!==null&&IHe(MHe,a.startTime-e),i=!1}return i}finally{tS=null,oy=r,sge=!1}}var uge=!1,ige=null,hee=-1,bIt=5,_It=-1;function vIt(){return!(ku.unstable_now()-_It<bIt)}function OHe(){if(ige!==null){var t=ku.unstable_now();_It=t;var e=!0;try{e=ige(!0,t)}finally{e?pee():(uge=!1,ige=null)}}else uge=!1}var pee;typeof mIt=="function"?pee=function(){mIt(OHe)}:typeof MessageChannel<"u"?(THe=new MessageChannel,hIt=THe.port2,THe.port1.onmessage=OHe,pee=function(){hIt.postMessage(null)}):pee=function(){gIt(OHe,0)};var THe,hIt;function AHe(t){ige=t,uge||(uge=!0,pee())}function IHe(t,e){hee=gIt(function(){t(ku.unstable_now())},e)}ku.unstable_IdlePriority=5;ku.unstable_ImmediatePriority=1;ku.unstable_LowPriority=4;ku.unstable_NormalPriority=3;ku.unstable_Profiling=null;ku.unstable_UserBlockingPriority=2;ku.unstable_cancelCallback=function(t){t.callback=null};ku.unstable_continueExecution=function(){Wz||sge||(Wz=!0,AHe(RHe))};ku.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"):bIt=0<t?Math.floor(1e3/t):5};ku.unstable_getCurrentPriorityLevel=function(){return oy};ku.unstable_getFirstCallbackNode=function(){return Q0(IO)};ku.unstable_next=function(t){switch(oy){case 1:case 2:case 3:var e=3;break;default:e=oy}var r=oy;oy=e;try{return t()}finally{oy=r}};ku.unstable_pauseExecution=function(){};ku.unstable_requestPaint=function(){};ku.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=oy;oy=t;try{return e()}finally{oy=r}};ku.unstable_scheduleCallback=function(t,e,r){var n=ku.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:Ibn++,callback:e,priorityLevel:t,startTime:r,expirationTime:o,sortIndex:-1},r>n?(t.sortIndex=r,EHe(OL,t),Q0(IO)===null&&t===Q0(OL)&&(mee?(yIt(hee),hee=-1):mee=!0,IHe(MHe,r-n))):(t.sortIndex=o,EHe(IO,t),Wz||sge||(Wz=!0,AHe(RHe))),t};ku.unstable_shouldYield=vIt;ku.unstable_wrapCallback=function(t){var e=oy;return function(){var r=oy;oy=e;try{return t.apply(this,arguments)}finally{oy=r}}}});var CIt=S((rji,SIt)=>{"use strict";SIt.exports=wIt()});var Mjt=S(Nv=>{"use strict";var RNt=X(),Av=CIt();function tt(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 ANt=new Set,Lee={};function s4(t,e){SK(t,e),SK(t+"Capture",e)}function SK(t,e){for(Lee[t]=e,t=0;t<e.length;t++)ANt.add(e[t])}var qN=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tVe=Object.prototype.hasOwnProperty,Nbn=/^[: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]*$/,xIt={},OIt={};function jbn(t){return tVe.call(OIt,t)?!0:tVe.call(xIt,t)?!1:Nbn.test(t)?OIt[t]=!0:(xIt[t]=!0,!1)}function Dbn(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 $bn(t,e,r,n){if(e===null||typeof e>"u"||Dbn(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 ub(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 eg={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){eg[t]=new ub(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];eg[e]=new ub(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){eg[t]=new ub(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){eg[t]=new ub(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){eg[t]=new ub(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){eg[t]=new ub(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){eg[t]=new ub(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){eg[t]=new ub(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){eg[t]=new ub(t,5,!1,t.toLowerCase(),null,!1,!1)});var KVe=/[\-:]([a-z])/g;function WVe(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(KVe,WVe);eg[e]=new ub(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(KVe,WVe);eg[e]=new ub(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(KVe,WVe);eg[e]=new ub(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){eg[t]=new ub(t,1,!1,t.toLowerCase(),null,!1,!1)});eg.xlinkHref=new ub("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){eg[t]=new ub(t,1,!1,t.toLowerCase(),null,!0,!0)});function GVe(t,e,r,n){var o=eg.hasOwnProperty(e)?eg[e]:null;(o!==null?o.type!==0:n||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&($bn(e,r,o,n)&&(r=null),n||o===null?jbn(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 HN=RNt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,lge=Symbol.for("react.element"),oK=Symbol.for("react.portal"),iK=Symbol.for("react.fragment"),ZVe=Symbol.for("react.strict_mode"),rVe=Symbol.for("react.profiler"),INt=Symbol.for("react.provider"),NNt=Symbol.for("react.context"),XVe=Symbol.for("react.forward_ref"),nVe=Symbol.for("react.suspense"),oVe=Symbol.for("react.suspense_list"),YVe=Symbol.for("react.memo"),EL=Symbol.for("react.lazy");Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var jNt=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden");Symbol.for("react.cache");Symbol.for("react.tracing_marker");var TIt=Symbol.iterator;function gee(t){return t===null||typeof t!="object"?null:(t=TIt&&t[TIt]||t["@@iterator"],typeof t=="function"?t:null)}var oc=Object.assign,NHe;function xee(t){if(NHe===void 0)try{throw Error()}catch(r){var e=r.stack.trim().match(/\n( *(at )?)/);NHe=e&&e[1]||""}return`
|
||
`+NHe+t}var jHe=!1;function DHe(t,e){if(!t||jHe)return"";jHe=!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{jHe=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?xee(t):""}function Lbn(t){switch(t.tag){case 5:return xee(t.type);case 16:return xee("Lazy");case 13:return xee("Suspense");case 19:return xee("SuspenseList");case 0:case 2:case 15:return t=DHe(t.type,!1),t;case 11:return t=DHe(t.type.render,!1),t;case 1:return t=DHe(t.type,!0),t;default:return""}}function iVe(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 iK:return"Fragment";case oK:return"Portal";case rVe:return"Profiler";case ZVe:return"StrictMode";case nVe:return"Suspense";case oVe:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case NNt:return(t.displayName||"Context")+".Consumer";case INt:return(t._context.displayName||"Context")+".Provider";case XVe:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case YVe:return e=t.displayName||null,e!==null?e:iVe(t.type)||"Memo";case EL:e=t._payload,t=t._init;try{return iVe(t(e))}catch{}}return null}function Fbn(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 iVe(e);case 8:return e===ZVe?"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 BL(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function DNt(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function kbn(t){var e=DNt(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 cge(t){t._valueTracker||(t._valueTracker=kbn(t))}function $Nt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=DNt(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Fge(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 aVe(t,e){var r=e.checked;return oc({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function EIt(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=BL(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 LNt(t,e){e=e.checked,e!=null&&GVe(t,"checked",e,!1)}function sVe(t,e){LNt(t,e);var r=BL(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")?uVe(t,e.type,r):e.hasOwnProperty("defaultValue")&&uVe(t,e.type,BL(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function PIt(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 uVe(t,e,r){(e!=="number"||Fge(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var Oee=Array.isArray;function gK(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=""+BL(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 lVe(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(tt(91));return oc({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function MIt(t,e){var r=e.value;if(r==null){if(r=e.children,e=e.defaultValue,r!=null){if(e!=null)throw Error(tt(92));if(Oee(r)){if(1<r.length)throw Error(tt(93));r=r[0]}e=r}e==null&&(e=""),r=e}t._wrapperState={initialValue:BL(r)}}function FNt(t,e){var r=BL(e.value),n=BL(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 RIt(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 cVe(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 dge,qNt=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(dge=dge||document.createElement("div"),dge.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=dge.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Fee(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var Pee={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},qbn=["Webkit","ms","Moz","O"];Object.keys(Pee).forEach(function(t){qbn.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Pee[e]=Pee[t]})});function BNt(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||Pee.hasOwnProperty(t)&&Pee[t]?(""+e).trim():e+"px"}function UNt(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,o=BNt(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,o):t[r]=o}}var Bbn=oc({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 dVe(t,e){if(e){if(Bbn[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(tt(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(tt(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(tt(61))}if(e.style!=null&&typeof e.style!="object")throw Error(tt(62))}}function fVe(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 pVe=null;function QVe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var mVe=null,yK=null,bK=null;function AIt(t){if(t=rte(t)){if(typeof mVe!="function")throw Error(tt(280));var e=t.stateNode;e&&(e=fye(e),mVe(t.stateNode,t.type,e))}}function zNt(t){yK?bK?bK.push(t):bK=[t]:yK=t}function HNt(){if(yK){var t=yK,e=bK;if(bK=yK=null,AIt(t),e)for(t=0;t<e.length;t++)AIt(e[t])}}function VNt(t,e){return t(e)}function JNt(){}var $He=!1;function KNt(t,e,r){if($He)return t(e,r);$He=!0;try{return VNt(t,e,r)}finally{$He=!1,(yK!==null||bK!==null)&&(JNt(),HNt())}}function kee(t,e){var r=t.stateNode;if(r===null)return null;var n=fye(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(tt(231,e,typeof r));return r}var hVe=!1;if(qN)try{rK={},Object.defineProperty(rK,"passive",{get:function(){hVe=!0}}),window.addEventListener("test",rK,rK),window.removeEventListener("test",rK,rK)}catch{hVe=!1}var rK;function Ubn(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 Mee=!1,kge=null,qge=!1,gVe=null,zbn={onError:function(t){Mee=!0,kge=t}};function Hbn(t,e,r,n,o,i,a,s,u){Mee=!1,kge=null,Ubn.apply(zbn,arguments)}function Vbn(t,e,r,n,o,i,a,s,u){if(Hbn.apply(this,arguments),Mee){if(Mee){var l=kge;Mee=!1,kge=null}else throw Error(tt(198));qge||(qge=!0,gVe=l)}}function u4(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 WNt(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 IIt(t){if(u4(t)!==t)throw Error(tt(188))}function Jbn(t){var e=t.alternate;if(!e){if(e=u4(t),e===null)throw Error(tt(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 IIt(o),t;if(i===n)return IIt(o),e;i=i.sibling}throw Error(tt(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(tt(189))}}if(r.alternate!==n)throw Error(tt(190))}if(r.tag!==3)throw Error(tt(188));return r.stateNode.current===r?t:e}function GNt(t){return t=Jbn(t),t!==null?ZNt(t):null}function ZNt(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=ZNt(t);if(e!==null)return e;t=t.sibling}return null}var XNt=Av.unstable_scheduleCallback,NIt=Av.unstable_cancelCallback,Kbn=Av.unstable_shouldYield,Wbn=Av.unstable_requestPaint,Gc=Av.unstable_now,Gbn=Av.unstable_getCurrentPriorityLevel,eJe=Av.unstable_ImmediatePriority,YNt=Av.unstable_UserBlockingPriority,Bge=Av.unstable_NormalPriority,Zbn=Av.unstable_LowPriority,QNt=Av.unstable_IdlePriority,uye=null,$O=null;function Xbn(t){if($O&&typeof $O.onCommitFiberRoot=="function")try{$O.onCommitFiberRoot(uye,t,void 0,(t.current.flags&128)===128)}catch{}}var oC=Math.clz32?Math.clz32:e_n,Ybn=Math.log,Qbn=Math.LN2;function e_n(t){return t>>>=0,t===0?32:31-(Ybn(t)/Qbn|0)|0}var fge=64,pge=4194304;function Tee(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 Uge(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=Tee(s):(i&=a,i!==0&&(n=Tee(i)))}else a=r&~o,a!==0?n=Tee(a):i!==0&&(n=Tee(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-oC(e),o=1<<r,n|=t[r],e&=~o;return n}function t_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 r_n(t,e){for(var r=t.suspendedLanes,n=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes;0<i;){var a=31-oC(i),s=1<<a,u=o[a];u===-1?((s&r)===0||(s&n)!==0)&&(o[a]=t_n(s,e)):u<=e&&(t.expiredLanes|=s),i&=~s}}function yVe(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function e1t(){var t=fge;return fge<<=1,(fge&4194240)===0&&(fge=64),t}function LHe(t){for(var e=[],r=0;31>r;r++)e.push(t);return e}function ete(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-oC(e),t[e]=r}function n_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-oC(r),i=1<<o;e[o]=0,n[o]=-1,t[o]=-1,r&=~i}}function tJe(t,e){var r=t.entangledLanes|=e;for(t=t.entanglements;r;){var n=31-oC(r),o=1<<n;o&e|t[n]&e&&(t[n]|=e),r&=~o}}var Ys=0;function t1t(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var r1t,rJe,n1t,o1t,i1t,bVe=!1,mge=[],NL=null,jL=null,DL=null,qee=new Map,Bee=new Map,ML=[],o_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 jIt(t,e){switch(t){case"focusin":case"focusout":NL=null;break;case"dragenter":case"dragleave":jL=null;break;case"mouseover":case"mouseout":DL=null;break;case"pointerover":case"pointerout":qee.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bee.delete(e.pointerId)}}function yee(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=rte(e),e!==null&&rJe(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function i_n(t,e,r,n,o){switch(e){case"focusin":return NL=yee(NL,t,e,r,n,o),!0;case"dragenter":return jL=yee(jL,t,e,r,n,o),!0;case"mouseover":return DL=yee(DL,t,e,r,n,o),!0;case"pointerover":var i=o.pointerId;return qee.set(i,yee(qee.get(i)||null,t,e,r,n,o)),!0;case"gotpointercapture":return i=o.pointerId,Bee.set(i,yee(Bee.get(i)||null,t,e,r,n,o)),!0}return!1}function a1t(t){var e=Xz(t.target);if(e!==null){var r=u4(e);if(r!==null){if(e=r.tag,e===13){if(e=WNt(r),e!==null){t.blockedOn=e,i1t(t.priority,function(){n1t(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 Pge(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var r=_Ve(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(r===null){r=t.nativeEvent;var n=new r.constructor(r.type,r);pVe=n,r.target.dispatchEvent(n),pVe=null}else return e=rte(r),e!==null&&rJe(e),t.blockedOn=r,!1;e.shift()}return!0}function DIt(t,e,r){Pge(t)&&r.delete(e)}function a_n(){bVe=!1,NL!==null&&Pge(NL)&&(NL=null),jL!==null&&Pge(jL)&&(jL=null),DL!==null&&Pge(DL)&&(DL=null),qee.forEach(DIt),Bee.forEach(DIt)}function bee(t,e){t.blockedOn===e&&(t.blockedOn=null,bVe||(bVe=!0,Av.unstable_scheduleCallback(Av.unstable_NormalPriority,a_n)))}function Uee(t){function e(o){return bee(o,t)}if(0<mge.length){bee(mge[0],t);for(var r=1;r<mge.length;r++){var n=mge[r];n.blockedOn===t&&(n.blockedOn=null)}}for(NL!==null&&bee(NL,t),jL!==null&&bee(jL,t),DL!==null&&bee(DL,t),qee.forEach(e),Bee.forEach(e),r=0;r<ML.length;r++)n=ML[r],n.blockedOn===t&&(n.blockedOn=null);for(;0<ML.length&&(r=ML[0],r.blockedOn===null);)a1t(r),r.blockedOn===null&&ML.shift()}var _K=HN.ReactCurrentBatchConfig,zge=!0;function s_n(t,e,r,n){var o=Ys,i=_K.transition;_K.transition=null;try{Ys=1,nJe(t,e,r,n)}finally{Ys=o,_K.transition=i}}function u_n(t,e,r,n){var o=Ys,i=_K.transition;_K.transition=null;try{Ys=4,nJe(t,e,r,n)}finally{Ys=o,_K.transition=i}}function nJe(t,e,r,n){if(zge){var o=_Ve(t,e,r,n);if(o===null)HHe(t,e,n,Hge,r),jIt(t,n);else if(i_n(o,t,e,r,n))n.stopPropagation();else if(jIt(t,n),e&4&&-1<o_n.indexOf(t)){for(;o!==null;){var i=rte(o);if(i!==null&&r1t(i),i=_Ve(t,e,r,n),i===null&&HHe(t,e,n,Hge,r),i===o)break;o=i}o!==null&&n.stopPropagation()}else HHe(t,e,n,null,r)}}var Hge=null;function _Ve(t,e,r,n){if(Hge=null,t=QVe(n),t=Xz(t),t!==null)if(e=u4(t),e===null)t=null;else if(r=e.tag,r===13){if(t=WNt(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 Hge=t,null}function s1t(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(Gbn()){case eJe:return 1;case YNt:return 4;case Bge:case Zbn:return 16;case QNt:return 536870912;default:return 16}default:return 16}}var AL=null,oJe=null,Mge=null;function u1t(){if(Mge)return Mge;var t,e=oJe,r=e.length,n,o="value"in AL?AL.value:AL.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 Mge=o.slice(t,1<n?1-n:void 0)}function Rge(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 hge(){return!0}function $It(){return!1}function Iv(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)?hge:$It,this.isPropagationStopped=$It,this}return oc(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=hge)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=hge)},persist:function(){},isPersistent:hge}),e}var MK={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},iJe=Iv(MK),tte=oc({},MK,{view:0,detail:0}),l_n=Iv(tte),FHe,kHe,_ee,lye=oc({},tte,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:aJe,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!==_ee&&(_ee&&t.type==="mousemove"?(FHe=t.screenX-_ee.screenX,kHe=t.screenY-_ee.screenY):kHe=FHe=0,_ee=t),FHe)},movementY:function(t){return"movementY"in t?t.movementY:kHe}}),LIt=Iv(lye),c_n=oc({},lye,{dataTransfer:0}),d_n=Iv(c_n),f_n=oc({},tte,{relatedTarget:0}),qHe=Iv(f_n),p_n=oc({},MK,{animationName:0,elapsedTime:0,pseudoElement:0}),m_n=Iv(p_n),h_n=oc({},MK,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),g_n=Iv(h_n),y_n=oc({},MK,{data:0}),FIt=Iv(y_n),b_n={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},__n={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"},v_n={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function w_n(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=v_n[t])?!!e[t]:!1}function aJe(){return w_n}var S_n=oc({},tte,{key:function(t){if(t.key){var e=b_n[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Rge(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?__n[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:aJe,charCode:function(t){return t.type==="keypress"?Rge(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Rge(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),C_n=Iv(S_n),x_n=oc({},lye,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),kIt=Iv(x_n),O_n=oc({},tte,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:aJe}),T_n=Iv(O_n),E_n=oc({},MK,{propertyName:0,elapsedTime:0,pseudoElement:0}),P_n=Iv(E_n),M_n=oc({},lye,{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}),R_n=Iv(M_n),A_n=[9,13,27,32],sJe=qN&&"CompositionEvent"in window,Ree=null;qN&&"documentMode"in document&&(Ree=document.documentMode);var I_n=qN&&"TextEvent"in window&&!Ree,l1t=qN&&(!sJe||Ree&&8<Ree&&11>=Ree),qIt=" ",BIt=!1;function c1t(t,e){switch(t){case"keyup":return A_n.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function d1t(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var aK=!1;function N_n(t,e){switch(t){case"compositionend":return d1t(e);case"keypress":return e.which!==32?null:(BIt=!0,qIt);case"textInput":return t=e.data,t===qIt&&BIt?null:t;default:return null}}function j_n(t,e){if(aK)return t==="compositionend"||!sJe&&c1t(t,e)?(t=u1t(),Mge=oJe=AL=null,aK=!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 l1t&&e.locale!=="ko"?null:e.data;default:return null}}var D_n={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 UIt(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!D_n[t.type]:e==="textarea"}function f1t(t,e,r,n){zNt(n),e=Vge(e,"onChange"),0<e.length&&(r=new iJe("onChange","change",null,r,n),t.push({event:r,listeners:e}))}var Aee=null,zee=null;function $_n(t){C1t(t,0)}function cye(t){var e=lK(t);if($Nt(e))return t}function L_n(t,e){if(t==="change")return e}var p1t=!1;qN&&(qN?(yge="oninput"in document,yge||(BHe=document.createElement("div"),BHe.setAttribute("oninput","return;"),yge=typeof BHe.oninput=="function"),gge=yge):gge=!1,p1t=gge&&(!document.documentMode||9<document.documentMode));var gge,yge,BHe;function zIt(){Aee&&(Aee.detachEvent("onpropertychange",m1t),zee=Aee=null)}function m1t(t){if(t.propertyName==="value"&&cye(zee)){var e=[];f1t(e,zee,t,QVe(t)),KNt($_n,e)}}function F_n(t,e,r){t==="focusin"?(zIt(),Aee=e,zee=r,Aee.attachEvent("onpropertychange",m1t)):t==="focusout"&&zIt()}function k_n(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return cye(zee)}function q_n(t,e){if(t==="click")return cye(e)}function B_n(t,e){if(t==="input"||t==="change")return cye(e)}function U_n(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var aC=typeof Object.is=="function"?Object.is:U_n;function Hee(t,e){if(aC(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(!tVe.call(e,o)||!aC(t[o],e[o]))return!1}return!0}function HIt(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function VIt(t,e){var r=HIt(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=HIt(r)}}function h1t(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?h1t(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function g1t(){for(var t=window,e=Fge();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Fge(t.document)}return e}function uJe(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 z_n(t){var e=g1t(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&h1t(r.ownerDocument.documentElement,r)){if(n!==null&&uJe(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=VIt(r,i);var a=VIt(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 H_n=qN&&"documentMode"in document&&11>=document.documentMode,sK=null,vVe=null,Iee=null,wVe=!1;function JIt(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;wVe||sK==null||sK!==Fge(n)||(n=sK,"selectionStart"in n&&uJe(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}),Iee&&Hee(Iee,n)||(Iee=n,n=Vge(vVe,"onSelect"),0<n.length&&(e=new iJe("onSelect","select",null,e,r),t.push({event:e,listeners:n}),e.target=sK)))}function bge(t,e){var r={};return r[t.toLowerCase()]=e.toLowerCase(),r["Webkit"+t]="webkit"+e,r["Moz"+t]="moz"+e,r}var uK={animationend:bge("Animation","AnimationEnd"),animationiteration:bge("Animation","AnimationIteration"),animationstart:bge("Animation","AnimationStart"),transitionend:bge("Transition","TransitionEnd")},UHe={},y1t={};qN&&(y1t=document.createElement("div").style,"AnimationEvent"in window||(delete uK.animationend.animation,delete uK.animationiteration.animation,delete uK.animationstart.animation),"TransitionEvent"in window||delete uK.transitionend.transition);function dye(t){if(UHe[t])return UHe[t];if(!uK[t])return t;var e=uK[t],r;for(r in e)if(e.hasOwnProperty(r)&&r in y1t)return UHe[t]=e[r];return t}var b1t=dye("animationend"),_1t=dye("animationiteration"),v1t=dye("animationstart"),w1t=dye("transitionend"),S1t=new Map,KIt="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 zL(t,e){S1t.set(t,e),s4(e,[t])}for(_ge=0;_ge<KIt.length;_ge++)vge=KIt[_ge],WIt=vge.toLowerCase(),GIt=vge[0].toUpperCase()+vge.slice(1),zL(WIt,"on"+GIt);var vge,WIt,GIt,_ge;zL(b1t,"onAnimationEnd");zL(_1t,"onAnimationIteration");zL(v1t,"onAnimationStart");zL("dblclick","onDoubleClick");zL("focusin","onFocus");zL("focusout","onBlur");zL(w1t,"onTransitionEnd");SK("onMouseEnter",["mouseout","mouseover"]);SK("onMouseLeave",["mouseout","mouseover"]);SK("onPointerEnter",["pointerout","pointerover"]);SK("onPointerLeave",["pointerout","pointerover"]);s4("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));s4("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));s4("onBeforeInput",["compositionend","keypress","textInput","paste"]);s4("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));s4("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));s4("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Eee="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(" "),V_n=new Set("cancel close invalid load scroll toggle".split(" ").concat(Eee));function ZIt(t,e,r){var n=t.type||"unknown-event";t.currentTarget=r,Vbn(n,e,void 0,t),t.currentTarget=null}function C1t(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;ZIt(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;ZIt(o,s,l),i=u}}}if(qge)throw t=gVe,qge=!1,gVe=null,t}function al(t,e){var r=e[TVe];r===void 0&&(r=e[TVe]=new Set);var n=t+"__bubble";r.has(n)||(x1t(e,t,2,!1),r.add(n))}function zHe(t,e,r){var n=0;e&&(n|=4),x1t(r,t,n,e)}var wge="_reactListening"+Math.random().toString(36).slice(2);function Vee(t){if(!t[wge]){t[wge]=!0,ANt.forEach(function(r){r!=="selectionchange"&&(V_n.has(r)||zHe(r,!1,t),zHe(r,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[wge]||(e[wge]=!0,zHe("selectionchange",!1,e))}}function x1t(t,e,r,n){switch(s1t(e)){case 1:var o=s_n;break;case 4:o=u_n;break;default:o=nJe}r=o.bind(null,e,r,t),o=void 0,!hVe||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 HHe(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=Xz(s),a===null)return;if(u=a.tag,u===5||u===6){n=i=a;continue e}s=s.parentNode}}n=n.return}KNt(function(){var l=i,c=QVe(r),d=[];e:{var f=S1t.get(t);if(f!==void 0){var p=iJe,m=t;switch(t){case"keypress":if(Rge(r)===0)break e;case"keydown":case"keyup":p=C_n;break;case"focusin":m="focus",p=qHe;break;case"focusout":m="blur",p=qHe;break;case"beforeblur":case"afterblur":p=qHe;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=LIt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=d_n;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=T_n;break;case b1t:case _1t:case v1t:p=m_n;break;case w1t:p=P_n;break;case"scroll":p=l_n;break;case"wheel":p=R_n;break;case"copy":case"cut":case"paste":p=g_n;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=kIt}var h=(e&4)!==0,g=!h&&t==="scroll",y=h?f!==null?f+"Capture":null:f;h=[];for(var b=l,_;b!==null;){_=b;var w=_.stateNode;if(_.tag===5&&w!==null&&(_=w,y!==null&&(w=kee(b,y),w!=null&&h.push(Jee(b,w,_)))),g)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!==pVe&&(m=r.relatedTarget||r.fromElement)&&(Xz(m)||m[BN]))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?Xz(m):null,m!==null&&(g=u4(m),m!==g||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=l),p!==m)){if(h=LIt,w="onMouseLeave",y="onMouseEnter",b="mouse",(t==="pointerout"||t==="pointerover")&&(h=kIt,w="onPointerLeave",y="onPointerEnter",b="pointer"),g=p==null?f:lK(p),_=m==null?f:lK(m),f=new h(w,b+"leave",p,r,c),f.target=g,f.relatedTarget=_,w=null,Xz(c)===l&&(h=new h(y,b+"enter",m,r,c),h.target=_,h.relatedTarget=g,w=h),g=w,p&&m)t:{for(h=p,y=m,b=0,_=h;_;_=nK(_))b++;for(_=0,w=y;w;w=nK(w))_++;for(;0<b-_;)h=nK(h),b--;for(;0<_-b;)y=nK(y),_--;for(;b--;){if(h===y||y!==null&&h===y.alternate)break t;h=nK(h),y=nK(y)}h=null}else h=null;p!==null&&XIt(d,f,p,h,!1),m!==null&&g!==null&&XIt(d,g,m,h,!0)}}e:{if(f=l?lK(l):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var x=L_n;else if(UIt(f))if(p1t)x=B_n;else{x=k_n;var O=F_n}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(x=q_n);if(x&&(x=x(t,l))){f1t(d,x,r,c);break e}O&&O(t,f,l),t==="focusout"&&(O=f._wrapperState)&&O.controlled&&f.type==="number"&&uVe(f,"number",f.value)}switch(O=l?lK(l):window,t){case"focusin":(UIt(O)||O.contentEditable==="true")&&(sK=O,vVe=l,Iee=null);break;case"focusout":Iee=vVe=sK=null;break;case"mousedown":wVe=!0;break;case"contextmenu":case"mouseup":case"dragend":wVe=!1,JIt(d,r,c);break;case"selectionchange":if(H_n)break;case"keydown":case"keyup":JIt(d,r,c)}var E;if(sJe)e:{switch(t){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else aK?c1t(t,r)&&(T="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(T="onCompositionStart");T&&(l1t&&r.locale!=="ko"&&(aK||T!=="onCompositionStart"?T==="onCompositionEnd"&&aK&&(E=u1t()):(AL=c,oJe="value"in AL?AL.value:AL.textContent,aK=!0)),O=Vge(l,T),0<O.length&&(T=new FIt(T,t,null,r,c),d.push({event:T,listeners:O}),E?T.data=E:(E=d1t(r),E!==null&&(T.data=E)))),(E=I_n?N_n(t,r):j_n(t,r))&&(l=Vge(l,"onBeforeInput"),0<l.length&&(c=new FIt("onBeforeInput","beforeinput",null,r,c),d.push({event:c,listeners:l}),c.data=E))}C1t(d,e)})}function Jee(t,e,r){return{instance:t,listener:e,currentTarget:r}}function Vge(t,e){for(var r=e+"Capture",n=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=kee(t,r),i!=null&&n.unshift(Jee(t,i,o)),i=kee(t,e),i!=null&&n.push(Jee(t,i,o))),t=t.return}return n}function nK(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function XIt(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=kee(r,i),u!=null&&a.unshift(Jee(r,u,s))):o||(u=kee(r,i),u!=null&&a.push(Jee(r,u,s)))),r=r.return}a.length!==0&&t.push({event:e,listeners:a})}var J_n=/\r\n?/g,K_n=/\u0000|\uFFFD/g;function YIt(t){return(typeof t=="string"?t:""+t).replace(J_n,`
|
||
`).replace(K_n,"")}function Sge(t,e,r){if(e=YIt(e),YIt(t)!==e&&r)throw Error(tt(425))}function Jge(){}var SVe=null,CVe=null;function xVe(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 OVe=typeof setTimeout=="function"?setTimeout:void 0,W_n=typeof clearTimeout=="function"?clearTimeout:void 0,QIt=typeof Promise=="function"?Promise:void 0,G_n=typeof queueMicrotask=="function"?queueMicrotask:typeof QIt<"u"?function(t){return QIt.resolve(null).then(t).catch(Z_n)}:OVe;function Z_n(t){setTimeout(function(){throw t})}function VHe(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),Uee(e);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=o}while(r);Uee(e)}function $L(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 eNt(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 RK=Math.random().toString(36).slice(2),DO="__reactFiber$"+RK,Kee="__reactProps$"+RK,BN="__reactContainer$"+RK,TVe="__reactEvents$"+RK,X_n="__reactListeners$"+RK,Y_n="__reactHandles$"+RK;function Xz(t){var e=t[DO];if(e)return e;for(var r=t.parentNode;r;){if(e=r[BN]||r[DO]){if(r=e.alternate,e.child!==null||r!==null&&r.child!==null)for(t=eNt(t);t!==null;){if(r=t[DO])return r;t=eNt(t)}return e}t=r,r=t.parentNode}return null}function rte(t){return t=t[DO]||t[BN],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function lK(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(tt(33))}function fye(t){return t[Kee]||null}var EVe=[],cK=-1;function HL(t){return{current:t}}function sl(t){0>cK||(t.current=EVe[cK],EVe[cK]=null,cK--)}function qu(t,e){cK++,EVe[cK]=t.current,t.current=e}var UL={},uy=HL(UL),f_=HL(!1),r4=UL;function CK(t,e){var r=t.type.contextTypes;if(!r)return UL;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 p_(t){return t=t.childContextTypes,t!=null}function Kge(){sl(f_),sl(uy)}function tNt(t,e,r){if(uy.current!==UL)throw Error(tt(168));qu(uy,e),qu(f_,r)}function O1t(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(tt(108,Fbn(t)||"Unknown",o));return oc({},r,n)}function Wge(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||UL,r4=uy.current,qu(uy,t),qu(f_,f_.current),!0}function rNt(t,e,r){var n=t.stateNode;if(!n)throw Error(tt(169));r?(t=O1t(t,e,r4),n.__reactInternalMemoizedMergedChildContext=t,sl(f_),sl(uy),qu(uy,t)):sl(f_),qu(f_,r)}var $N=null,pye=!1,JHe=!1;function T1t(t){$N===null?$N=[t]:$N.push(t)}function Q_n(t){pye=!0,T1t(t)}function VL(){if(!JHe&&$N!==null){JHe=!0;var t=0,e=Ys;try{var r=$N;for(Ys=1;t<r.length;t++){var n=r[t];do n=n(!0);while(n!==null)}$N=null,pye=!1}catch(o){throw $N!==null&&($N=$N.slice(t+1)),XNt(eJe,VL),o}finally{Ys=e,JHe=!1}}return null}var dK=[],fK=0,Gge=null,Zge=0,rS=[],nS=0,n4=null,LN=1,FN="";function Gz(t,e){dK[fK++]=Zge,dK[fK++]=Gge,Gge=t,Zge=e}function E1t(t,e,r){rS[nS++]=LN,rS[nS++]=FN,rS[nS++]=n4,n4=t;var n=LN;t=FN;var o=32-oC(n)-1;n&=~(1<<o),r+=1;var i=32-oC(e)+o;if(30<i){var a=o-o%5;i=(n&(1<<a)-1).toString(32),n>>=a,o-=a,LN=1<<32-oC(e)+o|r<<o|n,FN=i+t}else LN=1<<i|r<<o|n,FN=t}function lJe(t){t.return!==null&&(Gz(t,1),E1t(t,1,0))}function cJe(t){for(;t===Gge;)Gge=dK[--fK],dK[fK]=null,Zge=dK[--fK],dK[fK]=null;for(;t===n4;)n4=rS[--nS],rS[nS]=null,FN=rS[--nS],rS[nS]=null,LN=rS[--nS],rS[nS]=null}var Rv=null,Mv=null,Ml=!1,nC=null;function P1t(t,e){var r=oS(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 nNt(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,Rv=t,Mv=$L(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Rv=t,Mv=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(r=n4!==null?{id:LN,overflow:FN}:null,t.memoizedState={dehydrated:e,treeContext:r,retryLane:1073741824},r=oS(18,null,null,0),r.stateNode=e,r.return=t,t.child=r,Rv=t,Mv=null,!0):!1;default:return!1}}function PVe(t){return(t.mode&1)!==0&&(t.flags&128)===0}function MVe(t){if(Ml){var e=Mv;if(e){var r=e;if(!nNt(t,e)){if(PVe(t))throw Error(tt(418));e=$L(r.nextSibling);var n=Rv;e&&nNt(t,e)?P1t(n,r):(t.flags=t.flags&-4097|2,Ml=!1,Rv=t)}}else{if(PVe(t))throw Error(tt(418));t.flags=t.flags&-4097|2,Ml=!1,Rv=t}}}function oNt(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Rv=t}function Cge(t){if(t!==Rv)return!1;if(!Ml)return oNt(t),Ml=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!xVe(t.type,t.memoizedProps)),e&&(e=Mv)){if(PVe(t))throw M1t(),Error(tt(418));for(;e;)P1t(t,e),e=$L(e.nextSibling)}if(oNt(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(tt(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"){if(e===0){Mv=$L(t.nextSibling);break e}e--}else r!=="$"&&r!=="$!"&&r!=="$?"||e++}t=t.nextSibling}Mv=null}}else Mv=Rv?$L(t.stateNode.nextSibling):null;return!0}function M1t(){for(var t=Mv;t;)t=$L(t.nextSibling)}function xK(){Mv=Rv=null,Ml=!1}function dJe(t){nC===null?nC=[t]:nC.push(t)}var evn=HN.ReactCurrentBatchConfig;function tC(t,e){if(t&&t.defaultProps){e=oc({},e),t=t.defaultProps;for(var r in t)e[r]===void 0&&(e[r]=t[r]);return e}return e}var Xge=HL(null),Yge=null,pK=null,fJe=null;function pJe(){fJe=pK=Yge=null}function mJe(t){var e=Xge.current;sl(Xge),t._currentValue=e}function RVe(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 vK(t,e){Yge=t,fJe=pK=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&e)!==0&&(d_=!0),t.firstContext=null)}function aS(t){var e=t._currentValue;if(fJe!==t)if(t={context:t,memoizedValue:e,next:null},pK===null){if(Yge===null)throw Error(tt(308));pK=t,Yge.dependencies={lanes:0,firstContext:t}}else pK=pK.next=t;return e}var Yz=null;function hJe(t){Yz===null?Yz=[t]:Yz.push(t)}function R1t(t,e,r,n){var o=e.interleaved;return o===null?(r.next=r,hJe(e)):(r.next=o.next,o.next=r),e.interleaved=r,UN(t,n)}function UN(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 PL=!1;function gJe(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function A1t(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 kN(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function LL(t,e,r){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,(Za&2)!==0){var o=n.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),n.pending=e,UN(t,r)}return o=n.interleaved,o===null?(e.next=e,hJe(n)):(e.next=o.next,o.next=e),n.interleaved=e,UN(t,r)}function Age(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,tJe(t,r)}}function iNt(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 Qge(t,e,r,n){var o=t.updateQueue;PL=!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=oc({},d,f);break e;case 2:PL=!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);i4|=a,t.lanes=a,t.memoizedState=d}}function aNt(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(tt(191,o));o.call(n)}}}var I1t=new RNt.Component().refs;function AVe(t,e,r,n){e=t.memoizedState,r=r(n,e),r=r==null?e:oc({},e,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var mye={isMounted:function(t){return(t=t._reactInternals)?u4(t)===t:!1},enqueueSetState:function(t,e,r){t=t._reactInternals;var n=sb(),o=kL(t),i=kN(n,o);i.payload=e,r!=null&&(i.callback=r),e=LL(t,i,o),e!==null&&(iC(e,t,o,n),Age(e,t,o))},enqueueReplaceState:function(t,e,r){t=t._reactInternals;var n=sb(),o=kL(t),i=kN(n,o);i.tag=1,i.payload=e,r!=null&&(i.callback=r),e=LL(t,i,o),e!==null&&(iC(e,t,o,n),Age(e,t,o))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var r=sb(),n=kL(t),o=kN(r,n);o.tag=2,e!=null&&(o.callback=e),e=LL(t,o,n),e!==null&&(iC(e,t,n,r),Age(e,t,n))}};function sNt(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?!Hee(r,n)||!Hee(o,i):!0}function N1t(t,e,r){var n=!1,o=UL,i=e.contextType;return typeof i=="object"&&i!==null?i=aS(i):(o=p_(e)?r4:uy.current,n=e.contextTypes,i=(n=n!=null)?CK(t,o):UL),e=new e(r,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=mye,t.stateNode=e,e._reactInternals=t,n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function uNt(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&&mye.enqueueReplaceState(e,e.state,null)}function IVe(t,e,r,n){var o=t.stateNode;o.props=r,o.state=t.memoizedState,o.refs=I1t,gJe(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=aS(i):(i=p_(e)?r4:uy.current,o.context=CK(t,i)),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(AVe(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&&mye.enqueueReplaceState(o,o.state,null),Qge(t,r,o,n),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308)}function vee(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(tt(309));var n=r.stateNode}if(!n)throw Error(tt(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===I1t&&(s=o.refs={}),a===null?delete s[i]:s[i]=a},e._stringRef=i,e)}if(typeof t!="string")throw Error(tt(284));if(!r._owner)throw Error(tt(290,t))}return t}function xge(t,e){throw t=Object.prototype.toString.call(e),Error(tt(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function lNt(t){var e=t._init;return e(t._payload)}function j1t(t){function e(y,b){if(t){var _=y.deletions;_===null?(y.deletions=[b],y.flags|=16):_.push(b)}}function r(y,b){if(!t)return null;for(;b!==null;)e(y,b),b=b.sibling;return null}function n(y,b){for(y=new Map;b!==null;)b.key!==null?y.set(b.key,b):y.set(b.index,b),b=b.sibling;return y}function o(y,b){return y=qL(y,b),y.index=0,y.sibling=null,y}function i(y,b,_){return y.index=_,t?(_=y.alternate,_!==null?(_=_.index,_<b?(y.flags|=2,b):_):(y.flags|=2,b)):(y.flags|=1048576,b)}function a(y){return t&&y.alternate===null&&(y.flags|=2),y}function s(y,b,_,w){return b===null||b.tag!==6?(b=QHe(_,y.mode,w),b.return=y,b):(b=o(b,_),b.return=y,b)}function u(y,b,_,w){var x=_.type;return x===iK?c(y,b,_.props.children,w,_.key):b!==null&&(b.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===EL&&lNt(x)===b.type)?(w=o(b,_.props),w.ref=vee(y,b,_),w.return=y,w):(w=Lge(_.type,_.key,_.props,null,y.mode,w),w.ref=vee(y,b,_),w.return=y,w)}function l(y,b,_,w){return b===null||b.tag!==4||b.stateNode.containerInfo!==_.containerInfo||b.stateNode.implementation!==_.implementation?(b=eVe(_,y.mode,w),b.return=y,b):(b=o(b,_.children||[]),b.return=y,b)}function c(y,b,_,w,x){return b===null||b.tag!==7?(b=t4(_,y.mode,w,x),b.return=y,b):(b=o(b,_),b.return=y,b)}function d(y,b,_){if(typeof b=="string"&&b!==""||typeof b=="number")return b=QHe(""+b,y.mode,_),b.return=y,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case lge:return _=Lge(b.type,b.key,b.props,null,y.mode,_),_.ref=vee(y,null,b),_.return=y,_;case oK:return b=eVe(b,y.mode,_),b.return=y,b;case EL:var w=b._init;return d(y,w(b._payload),_)}if(Oee(b)||gee(b))return b=t4(b,y.mode,_,null),b.return=y,b;xge(y,b)}return null}function f(y,b,_,w){var x=b!==null?b.key:null;if(typeof _=="string"&&_!==""||typeof _=="number")return x!==null?null:s(y,b,""+_,w);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case lge:return _.key===x?u(y,b,_,w):null;case oK:return _.key===x?l(y,b,_,w):null;case EL:return x=_._init,f(y,b,x(_._payload),w)}if(Oee(_)||gee(_))return x!==null?null:c(y,b,_,w,null);xge(y,_)}return null}function p(y,b,_,w,x){if(typeof w=="string"&&w!==""||typeof w=="number")return y=y.get(_)||null,s(b,y,""+w,x);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case lge:return y=y.get(w.key===null?_:w.key)||null,u(b,y,w,x);case oK:return y=y.get(w.key===null?_:w.key)||null,l(b,y,w,x);case EL:var O=w._init;return p(y,b,_,O(w._payload),x)}if(Oee(w)||gee(w))return y=y.get(_)||null,c(b,y,w,x,null);xge(b,w)}return null}function m(y,b,_,w){for(var x=null,O=null,E=b,T=b=0,R=null;E!==null&&T<_.length;T++){E.index>T?(R=E,E=null):R=E.sibling;var N=f(y,E,_[T],w);if(N===null){E===null&&(E=R);break}t&&E&&N.alternate===null&&e(y,E),b=i(N,b,T),O===null?x=N:O.sibling=N,O=N,E=R}if(T===_.length)return r(y,E),Ml&&Gz(y,T),x;if(E===null){for(;T<_.length;T++)E=d(y,_[T],w),E!==null&&(b=i(E,b,T),O===null?x=E:O.sibling=E,O=E);return Ml&&Gz(y,T),x}for(E=n(y,E);T<_.length;T++)R=p(E,y,T,_[T],w),R!==null&&(t&&R.alternate!==null&&E.delete(R.key===null?T:R.key),b=i(R,b,T),O===null?x=R:O.sibling=R,O=R);return t&&E.forEach(function(D){return e(y,D)}),Ml&&Gz(y,T),x}function h(y,b,_,w){var x=gee(_);if(typeof x!="function")throw Error(tt(150));if(_=x.call(_),_==null)throw Error(tt(151));for(var O=x=null,E=b,T=b=0,R=null,N=_.next();E!==null&&!N.done;T++,N=_.next()){E.index>T?(R=E,E=null):R=E.sibling;var D=f(y,E,N.value,w);if(D===null){E===null&&(E=R);break}t&&E&&D.alternate===null&&e(y,E),b=i(D,b,T),O===null?x=D:O.sibling=D,O=D,E=R}if(N.done)return r(y,E),Ml&&Gz(y,T),x;if(E===null){for(;!N.done;T++,N=_.next())N=d(y,N.value,w),N!==null&&(b=i(N,b,T),O===null?x=N:O.sibling=N,O=N);return Ml&&Gz(y,T),x}for(E=n(y,E);!N.done;T++,N=_.next())N=p(E,y,T,N.value,w),N!==null&&(t&&N.alternate!==null&&E.delete(N.key===null?T:N.key),b=i(N,b,T),O===null?x=N:O.sibling=N,O=N);return t&&E.forEach(function(F){return e(y,F)}),Ml&&Gz(y,T),x}function g(y,b,_,w){if(typeof _=="object"&&_!==null&&_.type===iK&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case lge:e:{for(var x=_.key,O=b;O!==null;){if(O.key===x){if(x=_.type,x===iK){if(O.tag===7){r(y,O.sibling),b=o(O,_.props.children),b.return=y,y=b;break e}}else if(O.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===EL&&lNt(x)===O.type){r(y,O.sibling),b=o(O,_.props),b.ref=vee(y,O,_),b.return=y,y=b;break e}r(y,O);break}else e(y,O);O=O.sibling}_.type===iK?(b=t4(_.props.children,y.mode,w,_.key),b.return=y,y=b):(w=Lge(_.type,_.key,_.props,null,y.mode,w),w.ref=vee(y,b,_),w.return=y,y=w)}return a(y);case oK:e:{for(O=_.key;b!==null;){if(b.key===O)if(b.tag===4&&b.stateNode.containerInfo===_.containerInfo&&b.stateNode.implementation===_.implementation){r(y,b.sibling),b=o(b,_.children||[]),b.return=y,y=b;break e}else{r(y,b);break}else e(y,b);b=b.sibling}b=eVe(_,y.mode,w),b.return=y,y=b}return a(y);case EL:return O=_._init,g(y,b,O(_._payload),w)}if(Oee(_))return m(y,b,_,w);if(gee(_))return h(y,b,_,w);xge(y,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,b!==null&&b.tag===6?(r(y,b.sibling),b=o(b,_),b.return=y,y=b):(r(y,b),b=QHe(_,y.mode,w),b.return=y,y=b),a(y)):r(y,b)}return g}var OK=j1t(!0),D1t=j1t(!1),nte={},LO=HL(nte),Wee=HL(nte),Gee=HL(nte);function Qz(t){if(t===nte)throw Error(tt(174));return t}function yJe(t,e){switch(qu(Gee,e),qu(Wee,t),qu(LO,nte),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:cVe(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=cVe(e,t)}sl(LO),qu(LO,e)}function TK(){sl(LO),sl(Wee),sl(Gee)}function $1t(t){Qz(Gee.current);var e=Qz(LO.current),r=cVe(e,t.type);e!==r&&(qu(Wee,t),qu(LO,r))}function bJe(t){Wee.current===t&&(sl(LO),sl(Wee))}var rc=HL(0);function eye(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 KHe=[];function _Je(){for(var t=0;t<KHe.length;t++)KHe[t]._workInProgressVersionPrimary=null;KHe.length=0}var Ige=HN.ReactCurrentDispatcher,WHe=HN.ReactCurrentBatchConfig,o4=0,nc=null,_m=null,oh=null,tye=!1,Nee=!1,Zee=0,tvn=0;function iy(){throw Error(tt(321))}function vJe(t,e){if(e===null)return!1;for(var r=0;r<e.length&&r<t.length;r++)if(!aC(t[r],e[r]))return!1;return!0}function wJe(t,e,r,n,o,i){if(o4=i,nc=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Ige.current=t===null||t.memoizedState===null?ivn:avn,t=r(n,o),Nee){i=0;do{if(Nee=!1,Zee=0,25<=i)throw Error(tt(301));i+=1,oh=_m=null,e.updateQueue=null,Ige.current=svn,t=r(n,o)}while(Nee)}if(Ige.current=rye,e=_m!==null&&_m.next!==null,o4=0,oh=_m=nc=null,tye=!1,e)throw Error(tt(300));return t}function SJe(){var t=Zee!==0;return Zee=0,t}function jO(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return oh===null?nc.memoizedState=oh=t:oh=oh.next=t,oh}function sS(){if(_m===null){var t=nc.alternate;t=t!==null?t.memoizedState:null}else t=_m.next;var e=oh===null?nc.memoizedState:oh.next;if(e!==null)oh=e,_m=t;else{if(t===null)throw Error(tt(310));_m=t,t={memoizedState:_m.memoizedState,baseState:_m.baseState,baseQueue:_m.baseQueue,queue:_m.queue,next:null},oh===null?nc.memoizedState=oh=t:oh=oh.next=t}return oh}function Xee(t,e){return typeof e=="function"?e(t):e}function GHe(t){var e=sS(),r=e.queue;if(r===null)throw Error(tt(311));r.lastRenderedReducer=t;var n=_m,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((o4&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,nc.lanes|=c,i4|=c}l=l.next}while(l!==null&&l!==i);u===null?a=n:u.next=s,aC(n,e.memoizedState)||(d_=!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,nc.lanes|=i,i4|=i,o=o.next;while(o!==t)}else o===null&&(r.lanes=0);return[e.memoizedState,r.dispatch]}function ZHe(t){var e=sS(),r=e.queue;if(r===null)throw Error(tt(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);aC(i,e.memoizedState)||(d_=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),r.lastRenderedState=i}return[i,n]}function L1t(){}function F1t(t,e){var r=nc,n=sS(),o=e(),i=!aC(n.memoizedState,o);if(i&&(n.memoizedState=o,d_=!0),n=n.queue,CJe(B1t.bind(null,r,n,t),[t]),n.getSnapshot!==e||i||oh!==null&&oh.memoizedState.tag&1){if(r.flags|=2048,Yee(9,q1t.bind(null,r,n,o,e),void 0,null),ih===null)throw Error(tt(349));(o4&30)!==0||k1t(r,e,o)}return o}function k1t(t,e,r){t.flags|=16384,t={getSnapshot:e,value:r},e=nc.updateQueue,e===null?(e={lastEffect:null,stores:null},nc.updateQueue=e,e.stores=[t]):(r=e.stores,r===null?e.stores=[t]:r.push(t))}function q1t(t,e,r,n){e.value=r,e.getSnapshot=n,U1t(e)&&z1t(t)}function B1t(t,e,r){return r(function(){U1t(e)&&z1t(t)})}function U1t(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!aC(t,r)}catch{return!0}}function z1t(t){var e=UN(t,1);e!==null&&iC(e,t,1,-1)}function cNt(t){var e=jO();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xee,lastRenderedState:t},e.queue=t,t=t.dispatch=ovn.bind(null,nc,t),[e.memoizedState,t]}function Yee(t,e,r,n){return t={tag:t,create:e,destroy:r,deps:n,next:null},e=nc.updateQueue,e===null?(e={lastEffect:null,stores:null},nc.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 H1t(){return sS().memoizedState}function Nge(t,e,r,n){var o=jO();nc.flags|=t,o.memoizedState=Yee(1|e,r,void 0,n===void 0?null:n)}function hye(t,e,r,n){var o=sS();n=n===void 0?null:n;var i=void 0;if(_m!==null){var a=_m.memoizedState;if(i=a.destroy,n!==null&&vJe(n,a.deps)){o.memoizedState=Yee(e,r,i,n);return}}nc.flags|=t,o.memoizedState=Yee(1|e,r,i,n)}function dNt(t,e){return Nge(8390656,8,t,e)}function CJe(t,e){return hye(2048,8,t,e)}function V1t(t,e){return hye(4,2,t,e)}function J1t(t,e){return hye(4,4,t,e)}function K1t(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 W1t(t,e,r){return r=r!=null?r.concat([t]):null,hye(4,4,K1t.bind(null,e,t),r)}function xJe(){}function G1t(t,e){var r=sS();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&vJe(e,n[1])?n[0]:(r.memoizedState=[t,e],t)}function Z1t(t,e){var r=sS();e=e===void 0?null:e;var n=r.memoizedState;return n!==null&&e!==null&&vJe(e,n[1])?n[0]:(t=t(),r.memoizedState=[t,e],t)}function X1t(t,e,r){return(o4&21)===0?(t.baseState&&(t.baseState=!1,d_=!0),t.memoizedState=r):(aC(r,e)||(r=e1t(),nc.lanes|=r,i4|=r,t.baseState=!0),e)}function rvn(t,e){var r=Ys;Ys=r!==0&&4>r?r:4,t(!0);var n=WHe.transition;WHe.transition={};try{t(!1),e()}finally{Ys=r,WHe.transition=n}}function Y1t(){return sS().memoizedState}function nvn(t,e,r){var n=kL(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},Q1t(t))ejt(e,r);else if(r=R1t(t,e,r,n),r!==null){var o=sb();iC(r,t,n,o),tjt(r,e,n)}}function ovn(t,e,r){var n=kL(t),o={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(Q1t(t))ejt(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,aC(s,a)){var u=e.interleaved;u===null?(o.next=o,hJe(e)):(o.next=u.next,u.next=o),e.interleaved=o;return}}catch{}finally{}r=R1t(t,e,o,n),r!==null&&(o=sb(),iC(r,t,n,o),tjt(r,e,n))}}function Q1t(t){var e=t.alternate;return t===nc||e!==null&&e===nc}function ejt(t,e){Nee=tye=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function tjt(t,e,r){if((r&4194240)!==0){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,tJe(t,r)}}var rye={readContext:aS,useCallback:iy,useContext:iy,useEffect:iy,useImperativeHandle:iy,useInsertionEffect:iy,useLayoutEffect:iy,useMemo:iy,useReducer:iy,useRef:iy,useState:iy,useDebugValue:iy,useDeferredValue:iy,useTransition:iy,useMutableSource:iy,useSyncExternalStore:iy,useId:iy,unstable_isNewReconciler:!1},ivn={readContext:aS,useCallback:function(t,e){return jO().memoizedState=[t,e===void 0?null:e],t},useContext:aS,useEffect:dNt,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,Nge(4194308,4,K1t.bind(null,e,t),r)},useLayoutEffect:function(t,e){return Nge(4194308,4,t,e)},useInsertionEffect:function(t,e){return Nge(4,2,t,e)},useMemo:function(t,e){var r=jO();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=jO();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=nvn.bind(null,nc,t),[n.memoizedState,t]},useRef:function(t){var e=jO();return t={current:t},e.memoizedState=t},useState:cNt,useDebugValue:xJe,useDeferredValue:function(t){return jO().memoizedState=t},useTransition:function(){var t=cNt(!1),e=t[0];return t=rvn.bind(null,t[1]),jO().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=nc,o=jO();if(Ml){if(r===void 0)throw Error(tt(407));r=r()}else{if(r=e(),ih===null)throw Error(tt(349));(o4&30)!==0||k1t(n,e,r)}o.memoizedState=r;var i={value:r,getSnapshot:e};return o.queue=i,dNt(B1t.bind(null,n,i,t),[t]),n.flags|=2048,Yee(9,q1t.bind(null,n,i,r,e),void 0,null),r},useId:function(){var t=jO(),e=ih.identifierPrefix;if(Ml){var r=FN,n=LN;r=(n&~(1<<32-oC(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Zee++,0<r&&(e+="H"+r.toString(32)),e+=":"}else r=tvn++,e=":"+e+"r"+r.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},avn={readContext:aS,useCallback:G1t,useContext:aS,useEffect:CJe,useImperativeHandle:W1t,useInsertionEffect:V1t,useLayoutEffect:J1t,useMemo:Z1t,useReducer:GHe,useRef:H1t,useState:function(){return GHe(Xee)},useDebugValue:xJe,useDeferredValue:function(t){var e=sS();return X1t(e,_m.memoizedState,t)},useTransition:function(){var t=GHe(Xee)[0],e=sS().memoizedState;return[t,e]},useMutableSource:L1t,useSyncExternalStore:F1t,useId:Y1t,unstable_isNewReconciler:!1},svn={readContext:aS,useCallback:G1t,useContext:aS,useEffect:CJe,useImperativeHandle:W1t,useInsertionEffect:V1t,useLayoutEffect:J1t,useMemo:Z1t,useReducer:ZHe,useRef:H1t,useState:function(){return ZHe(Xee)},useDebugValue:xJe,useDeferredValue:function(t){var e=sS();return _m===null?e.memoizedState=t:X1t(e,_m.memoizedState,t)},useTransition:function(){var t=ZHe(Xee)[0],e=sS().memoizedState;return[t,e]},useMutableSource:L1t,useSyncExternalStore:F1t,useId:Y1t,unstable_isNewReconciler:!1};function EK(t,e){try{var r="",n=e;do r+=Lbn(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 XHe(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function NVe(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var uvn=typeof WeakMap=="function"?WeakMap:Map;function rjt(t,e,r){r=kN(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){oye||(oye=!0,zVe=n),NVe(t,e)},r}function njt(t,e,r){r=kN(-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(){NVe(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){NVe(t,e),typeof n!="function"&&(FL===null?FL=new Set([this]):FL.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),r}function fNt(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new uvn;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=Svn.bind(null,t,e,r),e.then(t,t))}function pNt(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 mNt(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=kN(-1,1),e.tag=2,LL(r,e,1))),r.lanes|=1),t):(t.flags|=65536,t.lanes=o,t)}var lvn=HN.ReactCurrentOwner,d_=!1;function ab(t,e,r,n){e.child=t===null?D1t(e,null,r,n):OK(e,t.child,r,n)}function hNt(t,e,r,n,o){r=r.render;var i=e.ref;return vK(e,o),n=wJe(t,e,r,n,i,o),r=SJe(),t!==null&&!d_?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,zN(t,e,o)):(Ml&&r&&lJe(e),e.flags|=1,ab(t,e,n,o),e.child)}function gNt(t,e,r,n,o){if(t===null){var i=r.type;return typeof i=="function"&&!IJe(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=i,ojt(t,e,i,n,o)):(t=Lge(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:Hee,r(a,n)&&t.ref===e.ref)return zN(t,e,o)}return e.flags|=1,t=qL(i,n),t.ref=e.ref,t.return=e,e.child=t}function ojt(t,e,r,n,o){if(t!==null){var i=t.memoizedProps;if(Hee(i,n)&&t.ref===e.ref)if(d_=!1,e.pendingProps=n=i,(t.lanes&o)!==0)(t.flags&131072)!==0&&(d_=!0);else return e.lanes=t.lanes,zN(t,e,o)}return jVe(t,e,r,n,o)}function ijt(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},qu(hK,Pv),Pv|=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,qu(hK,Pv),Pv|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,qu(hK,Pv),Pv|=n}else i!==null?(n=i.baseLanes|r,e.memoizedState=null):n=r,qu(hK,Pv),Pv|=n;return ab(t,e,o,r),e.child}function ajt(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function jVe(t,e,r,n,o){var i=p_(r)?r4:uy.current;return i=CK(e,i),vK(e,o),r=wJe(t,e,r,n,i,o),n=SJe(),t!==null&&!d_?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,zN(t,e,o)):(Ml&&n&&lJe(e),e.flags|=1,ab(t,e,r,o),e.child)}function yNt(t,e,r,n,o){if(p_(r)){var i=!0;Wge(e)}else i=!1;if(vK(e,o),e.stateNode===null)jge(t,e),N1t(e,r,n),IVe(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=aS(l):(l=p_(r)?r4:uy.current,l=CK(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)&&uNt(e,a,n,l),PL=!1;var f=e.memoizedState;a.state=f,Qge(e,n,a,o),u=e.memoizedState,s!==n||f!==u||f_.current||PL?(typeof c=="function"&&(AVe(e,r,c,n),u=e.memoizedState),(s=PL||sNt(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,A1t(t,e),s=e.memoizedProps,l=e.type===e.elementType?s:tC(e.type,s),a.props=l,d=e.pendingProps,f=a.context,u=r.contextType,typeof u=="object"&&u!==null?u=aS(u):(u=p_(r)?r4:uy.current,u=CK(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)&&uNt(e,a,n,u),PL=!1,f=e.memoizedState,a.state=f,Qge(e,n,a,o);var m=e.memoizedState;s!==d||f!==m||f_.current||PL?(typeof p=="function"&&(AVe(e,r,p,n),m=e.memoizedState),(l=PL||sNt(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 DVe(t,e,r,n,i,o)}function DVe(t,e,r,n,o,i){ajt(t,e);var a=(e.flags&128)!==0;if(!n&&!a)return o&&rNt(e,r,!1),zN(t,e,i);n=e.stateNode,lvn.current=e;var s=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&a?(e.child=OK(e,t.child,null,i),e.child=OK(e,null,s,i)):ab(t,e,s,i),e.memoizedState=n.state,o&&rNt(e,r,!0),e.child}function sjt(t){var e=t.stateNode;e.pendingContext?tNt(t,e.pendingContext,e.pendingContext!==e.context):e.context&&tNt(t,e.context,!1),yJe(t,e.containerInfo)}function bNt(t,e,r,n,o){return xK(),dJe(o),e.flags|=256,ab(t,e,r,n),e.child}var $Ve={dehydrated:null,treeContext:null,retryLane:0};function LVe(t){return{baseLanes:t,cachePool:null,transitions:null}}function ujt(t,e,r){var n=e.pendingProps,o=rc.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),qu(rc,o&1),t===null)return MVe(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=bye(a,n,0,null),t=t4(t,n,r,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=LVe(r),e.memoizedState=$Ve,t):OJe(e,a));if(o=t.memoizedState,o!==null&&(s=o.dehydrated,s!==null))return cvn(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=qL(o,u),n.subtreeFlags=o.subtreeFlags&14680064),s!==null?i=qL(s,i):(i=t4(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?LVe(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=t.childLanes&~r,e.memoizedState=$Ve,n}return i=t.child,t=i.sibling,n=qL(i,{mode:"visible",children:n.children}),(e.mode&1)===0&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function OJe(t,e){return e=bye({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Oge(t,e,r,n){return n!==null&&dJe(n),OK(e,t.child,null,r),t=OJe(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function cvn(t,e,r,n,o,i,a){if(r)return e.flags&256?(e.flags&=-257,n=XHe(Error(tt(422))),Oge(t,e,a,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=n.fallback,o=e.mode,n=bye({mode:"visible",children:n.children},o,0,null),i=t4(i,o,a,null),i.flags|=2,n.return=e,i.return=e,n.sibling=i,e.child=n,(e.mode&1)!==0&&OK(e,t.child,null,a),e.child.memoizedState=LVe(a),e.memoizedState=$Ve,i);if((e.mode&1)===0)return Oge(t,e,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(tt(419)),n=XHe(i,n,void 0),Oge(t,e,a,n)}if(s=(a&t.childLanes)!==0,d_||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,UN(t,o),iC(n,t,o,-1))}return AJe(),n=XHe(Error(tt(421))),Oge(t,e,a,n)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=Cvn.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,Mv=$L(o.nextSibling),Rv=e,Ml=!0,nC=null,t!==null&&(rS[nS++]=LN,rS[nS++]=FN,rS[nS++]=n4,LN=t.id,FN=t.overflow,n4=e),e=OJe(e,n.children),e.flags|=4096,e)}function _Nt(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),RVe(t.return,e,r)}function YHe(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 ljt(t,e,r){var n=e.pendingProps,o=n.revealOrder,i=n.tail;if(ab(t,e,n.children,r),n=rc.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&&_Nt(t,r,e);else if(t.tag===19)_Nt(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(qu(rc,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&&eye(t)===null&&(o=r),r=r.sibling;r=o,r===null?(o=e.child,e.child=null):(o=r.sibling,r.sibling=null),YHe(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&&eye(t)===null){e.child=o;break}t=o.sibling,o.sibling=r,r=o,o=t}YHe(e,!0,r,null,i);break;case"together":YHe(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function jge(t,e){(e.mode&1)===0&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function zN(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),i4|=e.lanes,(r&e.childLanes)===0)return null;if(t!==null&&e.child!==t.child)throw Error(tt(153));if(e.child!==null){for(t=e.child,r=qL(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=qL(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function dvn(t,e,r){switch(e.tag){case 3:sjt(e),xK();break;case 5:$1t(e);break;case 1:p_(e.type)&&Wge(e);break;case 4:yJe(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,o=e.memoizedProps.value;qu(Xge,n._currentValue),n._currentValue=o;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(qu(rc,rc.current&1),e.flags|=128,null):(r&e.child.childLanes)!==0?ujt(t,e,r):(qu(rc,rc.current&1),t=zN(t,e,r),t!==null?t.sibling:null);qu(rc,rc.current&1);break;case 19:if(n=(r&e.childLanes)!==0,(t.flags&128)!==0){if(n)return ljt(t,e,r);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),qu(rc,rc.current),n)break;return null;case 22:case 23:return e.lanes=0,ijt(t,e,r)}return zN(t,e,r)}var cjt,FVe,djt,fjt;cjt=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}};FVe=function(){};djt=function(t,e,r,n){var o=t.memoizedProps;if(o!==n){t=e.stateNode,Qz(LO.current);var i=null;switch(r){case"input":o=aVe(t,o),n=aVe(t,n),i=[];break;case"select":o=oc({},o,{value:void 0}),n=oc({},n,{value:void 0}),i=[];break;case"textarea":o=lVe(t,o),n=lVe(t,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Jge)}dVe(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"&&(Lee.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"&&(Lee.hasOwnProperty(l)?(u!=null&&l==="onScroll"&&al("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)}};fjt=function(t,e,r,n){r!==n&&(e.flags|=4)};function wee(t,e){if(!Ml)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 ay(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 fvn(t,e,r){var n=e.pendingProps;switch(cJe(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ay(e),null;case 1:return p_(e.type)&&Kge(),ay(e),null;case 3:return n=e.stateNode,TK(),sl(f_),sl(uy),_Je(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Cge(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,nC!==null&&(JVe(nC),nC=null))),FVe(t,e),ay(e),null;case 5:bJe(e);var o=Qz(Gee.current);if(r=e.type,t!==null&&e.stateNode!=null)djt(t,e,r,n,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(tt(166));return ay(e),null}if(t=Qz(LO.current),Cge(e)){n=e.stateNode,r=e.type;var i=e.memoizedProps;switch(n[DO]=e,n[Kee]=i,t=(e.mode&1)!==0,r){case"dialog":al("cancel",n),al("close",n);break;case"iframe":case"object":case"embed":al("load",n);break;case"video":case"audio":for(o=0;o<Eee.length;o++)al(Eee[o],n);break;case"source":al("error",n);break;case"img":case"image":case"link":al("error",n),al("load",n);break;case"details":al("toggle",n);break;case"input":EIt(n,i),al("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},al("invalid",n);break;case"textarea":MIt(n,i),al("invalid",n)}dVe(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&&Sge(n.textContent,s,t),o=["children",s]):typeof s=="number"&&n.textContent!==""+s&&(i.suppressHydrationWarning!==!0&&Sge(n.textContent,s,t),o=["children",""+s]):Lee.hasOwnProperty(a)&&s!=null&&a==="onScroll"&&al("scroll",n)}switch(r){case"input":cge(n),PIt(n,i,!0);break;case"textarea":cge(n),RIt(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=Jge)}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[DO]=e,t[Kee]=n,cjt(t,e,!1,!1),e.stateNode=t;e:{switch(a=fVe(r,n),r){case"dialog":al("cancel",t),al("close",t),o=n;break;case"iframe":case"object":case"embed":al("load",t),o=n;break;case"video":case"audio":for(o=0;o<Eee.length;o++)al(Eee[o],t);o=n;break;case"source":al("error",t),o=n;break;case"img":case"image":case"link":al("error",t),al("load",t),o=n;break;case"details":al("toggle",t),o=n;break;case"input":EIt(t,n),o=aVe(t,n),al("invalid",t);break;case"option":o=n;break;case"select":t._wrapperState={wasMultiple:!!n.multiple},o=oc({},n,{value:void 0}),al("invalid",t);break;case"textarea":MIt(t,n),o=lVe(t,n),al("invalid",t);break;default:o=n}dVe(r,o),s=o;for(i in s)if(s.hasOwnProperty(i)){var u=s[i];i==="style"?UNt(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&qNt(t,u)):i==="children"?typeof u=="string"?(r!=="textarea"||u!=="")&&Fee(t,u):typeof u=="number"&&Fee(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Lee.hasOwnProperty(i)?u!=null&&i==="onScroll"&&al("scroll",t):u!=null&&GVe(t,i,u,a))}switch(r){case"input":cge(t),PIt(t,n,!1);break;case"textarea":cge(t),RIt(t);break;case"option":n.value!=null&&t.setAttribute("value",""+BL(n.value));break;case"select":t.multiple=!!n.multiple,i=n.value,i!=null?gK(t,!!n.multiple,i,!1):n.defaultValue!=null&&gK(t,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=Jge)}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 ay(e),null;case 6:if(t&&e.stateNode!=null)fjt(t,e,t.memoizedProps,n);else{if(typeof n!="string"&&e.stateNode===null)throw Error(tt(166));if(r=Qz(Gee.current),Qz(LO.current),Cge(e)){if(n=e.stateNode,r=e.memoizedProps,n[DO]=e,(i=n.nodeValue!==r)&&(t=Rv,t!==null))switch(t.tag){case 3:Sge(n.nodeValue,r,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Sge(n.nodeValue,r,(t.mode&1)!==0)}i&&(e.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[DO]=e,e.stateNode=n}return ay(e),null;case 13:if(sl(rc),n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Ml&&Mv!==null&&(e.mode&1)!==0&&(e.flags&128)===0)M1t(),xK(),e.flags|=98560,i=!1;else if(i=Cge(e),n!==null&&n.dehydrated!==null){if(t===null){if(!i)throw Error(tt(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(tt(317));i[DO]=e}else xK(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;ay(e),i=!1}else nC!==null&&(JVe(nC),nC=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||(rc.current&1)!==0?vm===0&&(vm=3):AJe())),e.updateQueue!==null&&(e.flags|=4),ay(e),null);case 4:return TK(),FVe(t,e),t===null&&Vee(e.stateNode.containerInfo),ay(e),null;case 10:return mJe(e.type._context),ay(e),null;case 17:return p_(e.type)&&Kge(),ay(e),null;case 19:if(sl(rc),i=e.memoizedState,i===null)return ay(e),null;if(n=(e.flags&128)!==0,a=i.rendering,a===null)if(n)wee(i,!1);else{if(vm!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(a=eye(t),a!==null){for(e.flags|=128,wee(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 qu(rc,rc.current&1|2),e.child}t=t.sibling}i.tail!==null&&Gc()>PK&&(e.flags|=128,n=!0,wee(i,!1),e.lanes=4194304)}else{if(!n)if(t=eye(a),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),wee(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Ml)return ay(e),null}else 2*Gc()-i.renderingStartTime>PK&&r!==1073741824&&(e.flags|=128,n=!0,wee(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=Gc(),e.sibling=null,r=rc.current,qu(rc,n?r&1|2:r&1),e):(ay(e),null);case 22:case 23:return RJe(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&(e.mode&1)!==0?(Pv&1073741824)!==0&&(ay(e),e.subtreeFlags&6&&(e.flags|=8192)):ay(e),null;case 24:return null;case 25:return null}throw Error(tt(156,e.tag))}function pvn(t,e){switch(cJe(e),e.tag){case 1:return p_(e.type)&&Kge(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return TK(),sl(f_),sl(uy),_Je(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 5:return bJe(e),null;case 13:if(sl(rc),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(tt(340));xK()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return sl(rc),null;case 4:return TK(),null;case 10:return mJe(e.type._context),null;case 22:case 23:return RJe(),null;case 24:return null;default:return null}}var Tge=!1,sy=!1,mvn=typeof WeakSet=="function"?WeakSet:Set,gr=null;function mK(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Ec(t,e,n)}else r.current=null}function kVe(t,e,r){try{r()}catch(n){Ec(t,e,n)}}var vNt=!1;function hvn(t,e){if(SVe=zge,t=g1t(),uJe(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(CVe={focusedElem:t,selectionRange:r},zge=!1,gr=e;gr!==null;)if(e=gr,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,gr=t;else for(;gr!==null;){e=gr;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,g=m.memoizedState,y=e.stateNode,b=y.getSnapshotBeforeUpdate(e.elementType===e.type?h:tC(e.type,h),g);y.__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(tt(163))}}catch(w){Ec(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,gr=t;break}gr=e.return}return m=vNt,vNt=!1,m}function jee(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&&kVe(e,r,i)}o=o.next}while(o!==n)}}function gye(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 qVe(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 pjt(t){var e=t.alternate;e!==null&&(t.alternate=null,pjt(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[DO],delete e[Kee],delete e[TVe],delete e[X_n],delete e[Y_n])),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 mjt(t){return t.tag===5||t.tag===3||t.tag===4}function wNt(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||mjt(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 BVe(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=Jge));else if(n!==4&&(t=t.child,t!==null))for(BVe(t,e,r),t=t.sibling;t!==null;)BVe(t,e,r),t=t.sibling}function UVe(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(UVe(t,e,r),t=t.sibling;t!==null;)UVe(t,e,r),t=t.sibling}var Yh=null,rC=!1;function TL(t,e,r){for(r=r.child;r!==null;)hjt(t,e,r),r=r.sibling}function hjt(t,e,r){if($O&&typeof $O.onCommitFiberUnmount=="function")try{$O.onCommitFiberUnmount(uye,r)}catch{}switch(r.tag){case 5:sy||mK(r,e);case 6:var n=Yh,o=rC;Yh=null,TL(t,e,r),Yh=n,rC=o,Yh!==null&&(rC?(t=Yh,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Yh.removeChild(r.stateNode));break;case 18:Yh!==null&&(rC?(t=Yh,r=r.stateNode,t.nodeType===8?VHe(t.parentNode,r):t.nodeType===1&&VHe(t,r),Uee(t)):VHe(Yh,r.stateNode));break;case 4:n=Yh,o=rC,Yh=r.stateNode.containerInfo,rC=!0,TL(t,e,r),Yh=n,rC=o;break;case 0:case 11:case 14:case 15:if(!sy&&(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)&&kVe(r,e,a),o=o.next}while(o!==n)}TL(t,e,r);break;case 1:if(!sy&&(mK(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Ec(r,e,s)}TL(t,e,r);break;case 21:TL(t,e,r);break;case 22:r.mode&1?(sy=(n=sy)||r.memoizedState!==null,TL(t,e,r),sy=n):TL(t,e,r);break;default:TL(t,e,r)}}function SNt(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new mvn),e.forEach(function(n){var o=xvn.bind(null,t,n);r.has(n)||(r.add(n),n.then(o,o))})}}function eC(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:Yh=s.stateNode,rC=!1;break e;case 3:Yh=s.stateNode.containerInfo,rC=!0;break e;case 4:Yh=s.stateNode.containerInfo,rC=!0;break e}s=s.return}if(Yh===null)throw Error(tt(160));hjt(i,a,o),Yh=null,rC=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(l){Ec(o,e,l)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)gjt(e,t),e=e.sibling}function gjt(t,e){var r=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(eC(e,t),NO(t),n&4){try{jee(3,t,t.return),gye(3,t)}catch(h){Ec(t,t.return,h)}try{jee(5,t,t.return)}catch(h){Ec(t,t.return,h)}}break;case 1:eC(e,t),NO(t),n&512&&r!==null&&mK(r,r.return);break;case 5:if(eC(e,t),NO(t),n&512&&r!==null&&mK(r,r.return),t.flags&32){var o=t.stateNode;try{Fee(o,"")}catch(h){Ec(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&&LNt(o,i),fVe(s,a);var l=fVe(s,i);for(a=0;a<u.length;a+=2){var c=u[a],d=u[a+1];c==="style"?UNt(o,d):c==="dangerouslySetInnerHTML"?qNt(o,d):c==="children"?Fee(o,d):GVe(o,c,d,l)}switch(s){case"input":sVe(o,i);break;case"textarea":FNt(o,i);break;case"select":var f=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?gK(o,!!i.multiple,p,!1):f!==!!i.multiple&&(i.defaultValue!=null?gK(o,!!i.multiple,i.defaultValue,!0):gK(o,!!i.multiple,i.multiple?[]:"",!1))}o[Kee]=i}catch(h){Ec(t,t.return,h)}}break;case 6:if(eC(e,t),NO(t),n&4){if(t.stateNode===null)throw Error(tt(162));o=t.stateNode,i=t.memoizedProps;try{o.nodeValue=i}catch(h){Ec(t,t.return,h)}}break;case 3:if(eC(e,t),NO(t),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Uee(e.containerInfo)}catch(h){Ec(t,t.return,h)}break;case 4:eC(e,t),NO(t);break;case 13:eC(e,t),NO(t),o=t.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(PJe=Gc())),n&4&&SNt(t);break;case 22:if(c=r!==null&&r.memoizedState!==null,t.mode&1?(sy=(l=sy)||c,eC(e,t),sy=l):eC(e,t),NO(t),n&8192){if(l=t.memoizedState!==null,(t.stateNode.isHidden=l)&&!c&&(t.mode&1)!==0)for(gr=t,c=t.child;c!==null;){for(d=gr=c;gr!==null;){switch(f=gr,p=f.child,f.tag){case 0:case 11:case 14:case 15:jee(4,f,f.return);break;case 1:mK(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){Ec(n,r,h)}}break;case 5:mK(f,f.return);break;case 22:if(f.memoizedState!==null){xNt(d);continue}}p!==null?(p.return=f,gr=p):xNt(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=BNt("display",a))}catch(h){Ec(t,t.return,h)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=l?"":d.memoizedProps}catch(h){Ec(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:eC(e,t),NO(t),n&4&&SNt(t);break;case 21:break;default:eC(e,t),NO(t)}}function NO(t){var e=t.flags;if(e&2){try{e:{for(var r=t.return;r!==null;){if(mjt(r)){var n=r;break e}r=r.return}throw Error(tt(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(Fee(o,""),n.flags&=-33);var i=wNt(t);UVe(t,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,s=wNt(t);BVe(t,s,a);break;default:throw Error(tt(161))}}catch(u){Ec(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function gvn(t,e,r){gr=t,yjt(t,e,r)}function yjt(t,e,r){for(var n=(t.mode&1)!==0;gr!==null;){var o=gr,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||Tge;if(!a){var s=o.alternate,u=s!==null&&s.memoizedState!==null||sy;s=Tge;var l=sy;if(Tge=a,(sy=u)&&!l)for(gr=o;gr!==null;)a=gr,u=a.child,a.tag===22&&a.memoizedState!==null?ONt(o):u!==null?(u.return=a,gr=u):ONt(o);for(;i!==null;)gr=i,yjt(i,e,r),i=i.sibling;gr=o,Tge=s,sy=l}CNt(t,e,r)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,gr=i):CNt(t,e,r)}}function CNt(t){for(;gr!==null;){var e=gr;if((e.flags&8772)!==0){var r=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:sy||gye(5,e);break;case 1:var n=e.stateNode;if(e.flags&4&&!sy)if(r===null)n.componentDidMount();else{var o=e.elementType===e.type?r.memoizedProps:tC(e.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&aNt(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}aNt(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&&Uee(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(tt(163))}sy||e.flags&512&&qVe(e)}catch(f){Ec(e,e.return,f)}}if(e===t){gr=null;break}if(r=e.sibling,r!==null){r.return=e.return,gr=r;break}gr=e.return}}function xNt(t){for(;gr!==null;){var e=gr;if(e===t){gr=null;break}var r=e.sibling;if(r!==null){r.return=e.return,gr=r;break}gr=e.return}}function ONt(t){for(;gr!==null;){var e=gr;try{switch(e.tag){case 0:case 11:case 15:var r=e.return;try{gye(4,e)}catch(u){Ec(e,r,u)}break;case 1:var n=e.stateNode;if(typeof n.componentDidMount=="function"){var o=e.return;try{n.componentDidMount()}catch(u){Ec(e,o,u)}}var i=e.return;try{qVe(e)}catch(u){Ec(e,i,u)}break;case 5:var a=e.return;try{qVe(e)}catch(u){Ec(e,a,u)}}}catch(u){Ec(e,e.return,u)}if(e===t){gr=null;break}var s=e.sibling;if(s!==null){s.return=e.return,gr=s;break}gr=e.return}}var yvn=Math.ceil,nye=HN.ReactCurrentDispatcher,TJe=HN.ReactCurrentOwner,iS=HN.ReactCurrentBatchConfig,Za=0,ih=null,yd=null,Qh=0,Pv=0,hK=HL(0),vm=0,Qee=null,i4=0,yye=0,EJe=0,Dee=null,c_=null,PJe=0,PK=1/0,DN=null,oye=!1,zVe=null,FL=null,Ege=!1,IL=null,iye=0,$ee=0,HVe=null,Dge=-1,$ge=0;function sb(){return(Za&6)!==0?Gc():Dge!==-1?Dge:Dge=Gc()}function kL(t){return(t.mode&1)===0?1:(Za&2)!==0&&Qh!==0?Qh&-Qh:evn.transition!==null?($ge===0&&($ge=e1t()),$ge):(t=Ys,t!==0||(t=window.event,t=t===void 0?16:s1t(t.type)),t)}function iC(t,e,r,n){if(50<$ee)throw $ee=0,HVe=null,Error(tt(185));ete(t,r,n),((Za&2)===0||t!==ih)&&(t===ih&&((Za&2)===0&&(yye|=r),vm===4&&RL(t,Qh)),m_(t,n),r===1&&Za===0&&(e.mode&1)===0&&(PK=Gc()+500,pye&&VL()))}function m_(t,e){var r=t.callbackNode;r_n(t,e);var n=Uge(t,t===ih?Qh:0);if(n===0)r!==null&&NIt(r),t.callbackNode=null,t.callbackPriority=0;else if(e=n&-n,t.callbackPriority!==e){if(r!=null&&NIt(r),e===1)t.tag===0?Q_n(TNt.bind(null,t)):T1t(TNt.bind(null,t)),G_n(function(){(Za&6)===0&&VL()}),r=null;else{switch(t1t(n)){case 1:r=eJe;break;case 4:r=YNt;break;case 16:r=Bge;break;case 536870912:r=QNt;break;default:r=Bge}r=Ojt(r,bjt.bind(null,t))}t.callbackPriority=e,t.callbackNode=r}}function bjt(t,e){if(Dge=-1,$ge=0,(Za&6)!==0)throw Error(tt(327));var r=t.callbackNode;if(wK()&&t.callbackNode!==r)return null;var n=Uge(t,t===ih?Qh:0);if(n===0)return null;if((n&30)!==0||(n&t.expiredLanes)!==0||e)e=aye(t,n);else{e=n;var o=Za;Za|=2;var i=vjt();(ih!==t||Qh!==e)&&(DN=null,PK=Gc()+500,e4(t,e));do try{vvn();break}catch(s){_jt(t,s)}while(!0);pJe(),nye.current=i,Za=o,yd!==null?e=0:(ih=null,Qh=0,e=vm)}if(e!==0){if(e===2&&(o=yVe(t),o!==0&&(n=o,e=VVe(t,o))),e===1)throw r=Qee,e4(t,0),RL(t,n),m_(t,Gc()),r;if(e===6)RL(t,n);else{if(o=t.current.alternate,(n&30)===0&&!bvn(o)&&(e=aye(t,n),e===2&&(i=yVe(t),i!==0&&(n=i,e=VVe(t,i))),e===1))throw r=Qee,e4(t,0),RL(t,n),m_(t,Gc()),r;switch(t.finishedWork=o,t.finishedLanes=n,e){case 0:case 1:throw Error(tt(345));case 2:Zz(t,c_,DN);break;case 3:if(RL(t,n),(n&130023424)===n&&(e=PJe+500-Gc(),10<e)){if(Uge(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){sb(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=OVe(Zz.bind(null,t,c_,DN),e);break}Zz(t,c_,DN);break;case 4:if(RL(t,n),(n&4194240)===n)break;for(e=t.eventTimes,o=-1;0<n;){var a=31-oC(n);i=1<<a,a=e[a],a>o&&(o=a),n&=~i}if(n=o,n=Gc()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*yvn(n/1960))-n,10<n){t.timeoutHandle=OVe(Zz.bind(null,t,c_,DN),n);break}Zz(t,c_,DN);break;case 5:Zz(t,c_,DN);break;default:throw Error(tt(329))}}}return m_(t,Gc()),t.callbackNode===r?bjt.bind(null,t):null}function VVe(t,e){var r=Dee;return t.current.memoizedState.isDehydrated&&(e4(t,e).flags|=256),t=aye(t,e),t!==2&&(e=c_,c_=r,e!==null&&JVe(e)),t}function JVe(t){c_===null?c_=t:c_.push.apply(c_,t)}function bvn(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(!aC(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 RL(t,e){for(e&=~EJe,e&=~yye,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var r=31-oC(e),n=1<<r;t[r]=-1,e&=~n}}function TNt(t){if((Za&6)!==0)throw Error(tt(327));wK();var e=Uge(t,0);if((e&1)===0)return m_(t,Gc()),null;var r=aye(t,e);if(t.tag!==0&&r===2){var n=yVe(t);n!==0&&(e=n,r=VVe(t,n))}if(r===1)throw r=Qee,e4(t,0),RL(t,e),m_(t,Gc()),r;if(r===6)throw Error(tt(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Zz(t,c_,DN),m_(t,Gc()),null}function MJe(t,e){var r=Za;Za|=1;try{return t(e)}finally{Za=r,Za===0&&(PK=Gc()+500,pye&&VL())}}function a4(t){IL!==null&&IL.tag===0&&(Za&6)===0&&wK();var e=Za;Za|=1;var r=iS.transition,n=Ys;try{if(iS.transition=null,Ys=1,t)return t()}finally{Ys=n,iS.transition=r,Za=e,(Za&6)===0&&VL()}}function RJe(){Pv=hK.current,sl(hK)}function e4(t,e){t.finishedWork=null,t.finishedLanes=0;var r=t.timeoutHandle;if(r!==-1&&(t.timeoutHandle=-1,W_n(r)),yd!==null)for(r=yd.return;r!==null;){var n=r;switch(cJe(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Kge();break;case 3:TK(),sl(f_),sl(uy),_Je();break;case 5:bJe(n);break;case 4:TK();break;case 13:sl(rc);break;case 19:sl(rc);break;case 10:mJe(n.type._context);break;case 22:case 23:RJe()}r=r.return}if(ih=t,yd=t=qL(t.current,null),Qh=Pv=e,vm=0,Qee=null,EJe=yye=i4=0,c_=Dee=null,Yz!==null){for(e=0;e<Yz.length;e++)if(r=Yz[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}Yz=null}return t}function _jt(t,e){do{var r=yd;try{if(pJe(),Ige.current=rye,tye){for(var n=nc.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}tye=!1}if(o4=0,oh=_m=nc=null,Nee=!1,Zee=0,TJe.current=null,r===null||r.return===null){vm=1,Qee=e,yd=null;break}e:{var i=t,a=r.return,s=r,u=e;if(e=Qh,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=pNt(a);if(p!==null){p.flags&=-257,mNt(p,a,s,i,e),p.mode&1&&fNt(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){fNt(i,l,e),AJe();break e}u=Error(tt(426))}}else if(Ml&&s.mode&1){var g=pNt(a);if(g!==null){(g.flags&65536)===0&&(g.flags|=256),mNt(g,a,s,i,e),dJe(EK(u,s));break e}}i=u=EK(u,s),vm!==4&&(vm=2),Dee===null?Dee=[i]:Dee.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var y=rjt(i,u,e);iNt(i,y);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"&&(FL===null||!FL.has(_)))){i.flags|=65536,e&=-e,i.lanes|=e;var w=njt(i,s,e);iNt(i,w);break e}}i=i.return}while(i!==null)}Sjt(r)}catch(x){e=x,yd===r&&r!==null&&(yd=r=r.return);continue}break}while(!0)}function vjt(){var t=nye.current;return nye.current=rye,t===null?rye:t}function AJe(){(vm===0||vm===3||vm===2)&&(vm=4),ih===null||(i4&268435455)===0&&(yye&268435455)===0||RL(ih,Qh)}function aye(t,e){var r=Za;Za|=2;var n=vjt();(ih!==t||Qh!==e)&&(DN=null,e4(t,e));do try{_vn();break}catch(o){_jt(t,o)}while(!0);if(pJe(),Za=r,nye.current=n,yd!==null)throw Error(tt(261));return ih=null,Qh=0,vm}function _vn(){for(;yd!==null;)wjt(yd)}function vvn(){for(;yd!==null&&!Kbn();)wjt(yd)}function wjt(t){var e=xjt(t.alternate,t,Pv);t.memoizedProps=t.pendingProps,e===null?Sjt(t):yd=e,TJe.current=null}function Sjt(t){var e=t;do{var r=e.alternate;if(t=e.return,(e.flags&32768)===0){if(r=fvn(r,e,Pv),r!==null){yd=r;return}}else{if(r=pvn(r,e),r!==null){r.flags&=32767,yd=r;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{vm=6,yd=null;return}}if(e=e.sibling,e!==null){yd=e;return}yd=e=t}while(e!==null);vm===0&&(vm=5)}function Zz(t,e,r){var n=Ys,o=iS.transition;try{iS.transition=null,Ys=1,wvn(t,e,r,n)}finally{iS.transition=o,Ys=n}return null}function wvn(t,e,r,n){do wK();while(IL!==null);if((Za&6)!==0)throw Error(tt(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(tt(177));t.callbackNode=null,t.callbackPriority=0;var i=r.lanes|r.childLanes;if(n_n(t,i),t===ih&&(yd=ih=null,Qh=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||Ege||(Ege=!0,Ojt(Bge,function(){return wK(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=iS.transition,iS.transition=null;var a=Ys;Ys=1;var s=Za;Za|=4,TJe.current=null,hvn(t,r),gjt(r,t),z_n(CVe),zge=!!SVe,CVe=SVe=null,t.current=r,gvn(r,t,o),Wbn(),Za=s,Ys=a,iS.transition=i}else t.current=r;if(Ege&&(Ege=!1,IL=t,iye=o),i=t.pendingLanes,i===0&&(FL=null),Xbn(r.stateNode,n),m_(t,Gc()),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(oye)throw oye=!1,t=zVe,zVe=null,t;return(iye&1)!==0&&t.tag!==0&&wK(),i=t.pendingLanes,(i&1)!==0?t===HVe?$ee++:($ee=0,HVe=t):$ee=0,VL(),null}function wK(){if(IL!==null){var t=t1t(iye),e=iS.transition,r=Ys;try{if(iS.transition=null,Ys=16>t?16:t,IL===null)var n=!1;else{if(t=IL,IL=null,iye=0,(Za&6)!==0)throw Error(tt(331));var o=Za;for(Za|=4,gr=t.current;gr!==null;){var i=gr,a=i.child;if((gr.flags&16)!==0){var s=i.deletions;if(s!==null){for(var u=0;u<s.length;u++){var l=s[u];for(gr=l;gr!==null;){var c=gr;switch(c.tag){case 0:case 11:case 15:jee(8,c,i)}var d=c.child;if(d!==null)d.return=c,gr=d;else for(;gr!==null;){c=gr;var f=c.sibling,p=c.return;if(pjt(c),c===l){gr=null;break}if(f!==null){f.return=p,gr=f;break}gr=p}}}var m=i.alternate;if(m!==null){var h=m.child;if(h!==null){m.child=null;do{var g=h.sibling;h.sibling=null,h=g}while(h!==null)}}gr=i}}if((i.subtreeFlags&2064)!==0&&a!==null)a.return=i,gr=a;else e:for(;gr!==null;){if(i=gr,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:jee(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,gr=y;break e}gr=i.return}}var b=t.current;for(gr=b;gr!==null;){a=gr;var _=a.child;if((a.subtreeFlags&2064)!==0&&_!==null)_.return=a,gr=_;else e:for(a=b;gr!==null;){if(s=gr,(s.flags&2048)!==0)try{switch(s.tag){case 0:case 11:case 15:gye(9,s)}}catch(x){Ec(s,s.return,x)}if(s===a){gr=null;break e}var w=s.sibling;if(w!==null){w.return=s.return,gr=w;break e}gr=s.return}}if(Za=o,VL(),$O&&typeof $O.onPostCommitFiberRoot=="function")try{$O.onPostCommitFiberRoot(uye,t)}catch{}n=!0}return n}finally{Ys=r,iS.transition=e}}return!1}function ENt(t,e,r){e=EK(r,e),e=rjt(t,e,1),t=LL(t,e,1),e=sb(),t!==null&&(ete(t,1,e),m_(t,e))}function Ec(t,e,r){if(t.tag===3)ENt(t,t,r);else for(;e!==null;){if(e.tag===3){ENt(e,t,r);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(FL===null||!FL.has(n))){t=EK(r,t),t=njt(e,t,1),e=LL(e,t,1),t=sb(),e!==null&&(ete(e,1,t),m_(e,t));break}}e=e.return}}function Svn(t,e,r){var n=t.pingCache;n!==null&&n.delete(e),e=sb(),t.pingedLanes|=t.suspendedLanes&r,ih===t&&(Qh&r)===r&&(vm===4||vm===3&&(Qh&130023424)===Qh&&500>Gc()-PJe?e4(t,0):EJe|=r),m_(t,e)}function Cjt(t,e){e===0&&((t.mode&1)===0?e=1:(e=pge,pge<<=1,(pge&130023424)===0&&(pge=4194304)));var r=sb();t=UN(t,e),t!==null&&(ete(t,e,r),m_(t,r))}function Cvn(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),Cjt(t,r)}function xvn(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(tt(314))}n!==null&&n.delete(e),Cjt(t,r)}var xjt;xjt=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||f_.current)d_=!0;else{if((t.lanes&r)===0&&(e.flags&128)===0)return d_=!1,dvn(t,e,r);d_=(t.flags&131072)!==0}else d_=!1,Ml&&(e.flags&1048576)!==0&&E1t(e,Zge,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;jge(t,e),t=e.pendingProps;var o=CK(e,uy.current);vK(e,r),o=wJe(null,e,n,t,o,r);var i=SJe();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,p_(n)?(i=!0,Wge(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,gJe(e),o.updater=mye,e.stateNode=o,o._reactInternals=e,IVe(e,n,t,r),e=DVe(null,e,n,!0,i,r)):(e.tag=0,Ml&&i&&lJe(e),ab(null,e,o,r),e=e.child),e;case 16:n=e.elementType;e:{switch(jge(t,e),t=e.pendingProps,o=n._init,n=o(n._payload),e.type=n,o=e.tag=Tvn(n),t=tC(n,t),o){case 0:e=jVe(null,e,n,t,r);break e;case 1:e=yNt(null,e,n,t,r);break e;case 11:e=hNt(null,e,n,t,r);break e;case 14:e=gNt(null,e,n,tC(n.type,t),r);break e}throw Error(tt(306,n,""))}return e;case 0:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:tC(n,o),jVe(t,e,n,o,r);case 1:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:tC(n,o),yNt(t,e,n,o,r);case 3:e:{if(sjt(e),t===null)throw Error(tt(387));n=e.pendingProps,i=e.memoizedState,o=i.element,A1t(t,e),Qge(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=EK(Error(tt(423)),e),e=bNt(t,e,n,r,o);break e}else if(n!==o){o=EK(Error(tt(424)),e),e=bNt(t,e,n,r,o);break e}else for(Mv=$L(e.stateNode.containerInfo.firstChild),Rv=e,Ml=!0,nC=null,r=D1t(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(xK(),n===o){e=zN(t,e,r);break e}ab(t,e,n,r)}e=e.child}return e;case 5:return $1t(e),t===null&&MVe(e),n=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,a=o.children,xVe(n,o)?a=null:i!==null&&xVe(n,i)&&(e.flags|=32),ajt(t,e),ab(t,e,a,r),e.child;case 6:return t===null&&MVe(e),null;case 13:return ujt(t,e,r);case 4:return yJe(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=OK(e,null,n,r):ab(t,e,n,r),e.child;case 11:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:tC(n,o),hNt(t,e,n,o,r);case 7:return ab(t,e,e.pendingProps,r),e.child;case 8:return ab(t,e,e.pendingProps.children,r),e.child;case 12:return ab(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,qu(Xge,n._currentValue),n._currentValue=a,i!==null)if(aC(i.value,a)){if(i.children===o.children&&!f_.current){e=zN(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=kN(-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),RVe(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(tt(341));a.lanes|=r,s=a.alternate,s!==null&&(s.lanes|=r),RVe(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}ab(t,e,o.children,r),e=e.child}return e;case 9:return o=e.type,n=e.pendingProps.children,vK(e,r),o=aS(o),n=n(o),e.flags|=1,ab(t,e,n,r),e.child;case 14:return n=e.type,o=tC(n,e.pendingProps),o=tC(n.type,o),gNt(t,e,n,o,r);case 15:return ojt(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,o=e.pendingProps,o=e.elementType===n?o:tC(n,o),jge(t,e),e.tag=1,p_(n)?(t=!0,Wge(e)):t=!1,vK(e,r),N1t(e,n,o),IVe(e,n,o,r),DVe(null,e,n,!0,t,r);case 19:return ljt(t,e,r);case 22:return ijt(t,e,r)}throw Error(tt(156,e.tag))};function Ojt(t,e){return XNt(t,e)}function Ovn(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 oS(t,e,r,n){return new Ovn(t,e,r,n)}function IJe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Tvn(t){if(typeof t=="function")return IJe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===XVe)return 11;if(t===YVe)return 14}return 2}function qL(t,e){var r=t.alternate;return r===null?(r=oS(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 Lge(t,e,r,n,o,i){var a=2;if(n=t,typeof t=="function")IJe(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case iK:return t4(r.children,o,i,e);case ZVe:a=8,o|=8;break;case rVe:return t=oS(12,r,e,o|2),t.elementType=rVe,t.lanes=i,t;case nVe:return t=oS(13,r,e,o),t.elementType=nVe,t.lanes=i,t;case oVe:return t=oS(19,r,e,o),t.elementType=oVe,t.lanes=i,t;case jNt:return bye(r,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case INt:a=10;break e;case NNt:a=9;break e;case XVe:a=11;break e;case YVe:a=14;break e;case EL:a=16,n=null;break e}throw Error(tt(130,t==null?t:typeof t,""))}return e=oS(a,r,e,o),e.elementType=t,e.type=n,e.lanes=i,e}function t4(t,e,r,n){return t=oS(7,t,n,e),t.lanes=r,t}function bye(t,e,r,n){return t=oS(22,t,n,e),t.elementType=jNt,t.lanes=r,t.stateNode={isHidden:!1},t}function QHe(t,e,r){return t=oS(6,t,null,e),t.lanes=r,t}function eVe(t,e,r){return e=oS(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Evn(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=LHe(0),this.expirationTimes=LHe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=LHe(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function NJe(t,e,r,n,o,i,a,s,u){return t=new Evn(t,e,r,s,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=oS(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},gJe(i),t}function Pvn(t,e,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:oK,key:n==null?null:""+n,children:t,containerInfo:e,implementation:r}}function Tjt(t){if(!t)return UL;t=t._reactInternals;e:{if(u4(t)!==t||t.tag!==1)throw Error(tt(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(p_(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(tt(171))}if(t.tag===1){var r=t.type;if(p_(r))return O1t(t,r,e)}return e}function Ejt(t,e,r,n,o,i,a,s,u){return t=NJe(r,n,!0,t,o,i,a,s,u),t.context=Tjt(null),r=t.current,n=sb(),o=kL(r),i=kN(n,o),i.callback=e??null,LL(r,i,o),t.current.lanes=o,ete(t,o,n),m_(t,n),t}function _ye(t,e,r,n){var o=e.current,i=sb(),a=kL(o);return r=Tjt(r),e.context===null?e.context=r:e.pendingContext=r,e=kN(i,a),e.payload={element:t},n=n===void 0?null:n,n!==null&&(e.callback=n),t=LL(o,e,a),t!==null&&(iC(t,o,a,i),Age(t,o,a)),a}function sye(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 PNt(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<e?r:e}}function jJe(t,e){PNt(t,e),(t=t.alternate)&&PNt(t,e)}function Mvn(){return null}var Pjt=typeof reportError=="function"?reportError:function(t){console.error(t)};function DJe(t){this._internalRoot=t}vye.prototype.render=DJe.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(tt(409));_ye(t,e,null,null)};vye.prototype.unmount=DJe.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;a4(function(){_ye(null,t,null,null)}),e[BN]=null}};function vye(t){this._internalRoot=t}vye.prototype.unstable_scheduleHydration=function(t){if(t){var e=o1t();t={blockedOn:null,target:t,priority:e};for(var r=0;r<ML.length&&e!==0&&e<ML[r].priority;r++);ML.splice(r,0,t),r===0&&a1t(t)}};function $Je(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function wye(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function MNt(){}function Rvn(t,e,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var l=sye(a);i.call(l)}}var a=Ejt(e,n,t,0,null,!1,!1,"",MNt);return t._reactRootContainer=a,t[BN]=a.current,Vee(t.nodeType===8?t.parentNode:t),a4(),a}for(;o=t.lastChild;)t.removeChild(o);if(typeof n=="function"){var s=n;n=function(){var l=sye(u);s.call(l)}}var u=NJe(t,0,!1,null,null,!1,!1,"",MNt);return t._reactRootContainer=u,t[BN]=u.current,Vee(t.nodeType===8?t.parentNode:t),a4(function(){_ye(e,u,r,n)}),u}function Sye(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=sye(a);s.call(u)}}_ye(e,a,t,o)}else a=Rvn(r,e,t,o,n);return sye(a)}r1t=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var r=Tee(e.pendingLanes);r!==0&&(tJe(e,r|1),m_(e,Gc()),(Za&6)===0&&(PK=Gc()+500,VL()))}break;case 13:a4(function(){var n=UN(t,1);if(n!==null){var o=sb();iC(n,t,1,o)}}),jJe(t,1)}};rJe=function(t){if(t.tag===13){var e=UN(t,134217728);if(e!==null){var r=sb();iC(e,t,134217728,r)}jJe(t,134217728)}};n1t=function(t){if(t.tag===13){var e=kL(t),r=UN(t,e);if(r!==null){var n=sb();iC(r,t,e,n)}jJe(t,e)}};o1t=function(){return Ys};i1t=function(t,e){var r=Ys;try{return Ys=t,e()}finally{Ys=r}};mVe=function(t,e,r){switch(e){case"input":if(sVe(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=fye(n);if(!o)throw Error(tt(90));$Nt(n),sVe(n,o)}}}break;case"textarea":FNt(t,r);break;case"select":e=r.value,e!=null&&gK(t,!!r.multiple,e,!1)}};VNt=MJe;JNt=a4;var Avn={usingClientEntryPoint:!1,Events:[rte,lK,fye,zNt,HNt,MJe]},See={findFiberByHostInstance:Xz,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},Ivn={bundleType:See.bundleType,version:See.version,rendererPackageName:See.rendererPackageName,rendererConfig:See.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:HN.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=GNt(t),t===null?null:t.stateNode},findFiberByHostInstance:See.findFiberByHostInstance||Mvn,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Cee=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Cee.isDisabled&&Cee.supportsFiber))try{uye=Cee.inject(Ivn),$O=Cee}catch{}var Cee;Nv.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Avn;Nv.createPortal=function(t,e){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!$Je(e))throw Error(tt(200));return Pvn(t,e,null,r)};Nv.createRoot=function(t,e){if(!$Je(t))throw Error(tt(299));var r=!1,n="",o=Pjt;return e!=null&&(e.unstable_strictMode===!0&&(r=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onRecoverableError!==void 0&&(o=e.onRecoverableError)),e=NJe(t,1,!1,null,null,r,!1,n,o),t[BN]=e.current,Vee(t.nodeType===8?t.parentNode:t),new DJe(e)};Nv.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(tt(188)):(t=Object.keys(t).join(","),Error(tt(268,t)));return t=GNt(e),t=t===null?null:t.stateNode,t};Nv.flushSync=function(t){return a4(t)};Nv.hydrate=function(t,e,r){if(!wye(e))throw Error(tt(200));return Sye(null,t,e,!0,r)};Nv.hydrateRoot=function(t,e,r){if(!$Je(t))throw Error(tt(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=Pjt;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),e=Ejt(e,null,t,1,r??null,o,!1,i,a),t[BN]=e.current,Vee(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 vye(e)};Nv.render=function(t,e,r){if(!wye(e))throw Error(tt(200));return Sye(null,t,e,!1,r)};Nv.unmountComponentAtNode=function(t){if(!wye(t))throw Error(tt(40));return t._reactRootContainer?(a4(function(){Sye(null,null,t,!1,function(){t._reactRootContainer=null,t[BN]=null})}),!0):!1};Nv.unstable_batchedUpdates=MJe;Nv.unstable_renderSubtreeIntoContainer=function(t,e,r,n){if(!wye(r))throw Error(tt(200));if(t==null||t._reactInternals===void 0)throw Error(tt(38));return Sye(t,e,r,!1,n)};Nv.version="18.2.0-next-9e3b772b8-20220608"});var Bu=S((oji,Ajt)=>{"use strict";function Rjt(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Rjt)}catch(t){console.error(t)}}Rjt(),Ajt.exports=Mjt()});var wm=S(LJe=>{"use strict";var Ijt=Bu();LJe.createRoot=Ijt.createRoot,LJe.hydrateRoot=Ijt.hydrateRoot;var iji});function Njt(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function jjt(...t){return e=>{let r=!1,n=t.map(o=>{let i=Njt(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():Njt(t[o],null)}}}}var Nvn,Djt=v(()=>{Nvn=L(X(),1)});var Ljt=S(Cye=>{"use strict";var jvn=X(),Dvn=Symbol.for("react.element"),$vn=Symbol.for("react.fragment"),Lvn=Object.prototype.hasOwnProperty,Fvn=jvn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,kvn={key:!0,ref:!0,__self:!0,__source:!0};function $jt(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)Lvn.call(e,n)&&!kvn.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:Dvn,type:t,key:i,ref:a,props:o,_owner:Fvn.current}}Cye.Fragment=$vn;Cye.jsx=$jt;Cye.jsxs=$jt});var mt=S((lji,Fjt)=>{"use strict";Fjt.exports=Ljt()});function Ji(t){let e=qvn(t),r=Sm.forwardRef((n,o)=>{let{children:i,...a}=n,s=Sm.Children.toArray(i),u=s.find(Bvn);if(u){let l=u.props.children,c=s.map(d=>d===u?Sm.Children.count(l)>1?Sm.Children.only(null):Sm.isValidElement(l)?l.props.children:null:d);return(0,AK.jsx)(e,{...a,ref:o,children:Sm.isValidElement(l)?Sm.cloneElement(l,void 0,c):null})}return(0,AK.jsx)(e,{...a,ref:o,children:i})});return r.displayName=`${t}.Slot`,r}function qvn(t){let e=Sm.forwardRef((r,n)=>{let{children:o,...i}=r;if(Sm.isValidElement(o)){let a=zvn(o),s=Uvn(i,o.props);return o.type!==Sm.Fragment&&(s.ref=n?jjt(n,a):a),Sm.cloneElement(o,s)}return Sm.Children.count(o)>1?Sm.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}function Bjt(t){let e=({children:r})=>(0,AK.jsx)(AK.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=qjt,e}function Bvn(t){return Sm.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===qjt}function Uvn(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 zvn(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 Sm,AK,kjt,qjt,ah=v(()=>{Sm=L(X(),1);Djt();AK=L(mt(),1);kjt=Ji("Slot");qjt=Symbol("radix.slottable")});function Ujt(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=Ujt(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function xye(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=Ujt(t))&&(n&&(n+=" "),n+=e);return n}var FJe=v(()=>{});var zjt,Hjt,IK,Oye=v(()=>{FJe();zjt=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Hjt=xye,IK=(t,e)=>r=>{var n;if(e?.variants==null)return Hjt(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=zjt(c)||zjt(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,g]=m;return Array.isArray(g)?g.includes({...i,...s}[h]):{...i,...s}[h]===g})?[...l,d,f]:l},[]);return Hjt(t,a,u,r?.class,r?.className)}});function twn(){let t=0,e,r,n="";for(;t<arguments.length;)(e=arguments[t++])&&(r=Xjt(e))&&(n&&(n+=" "),n+=r);return n}function Kjt(t,...e){let r,n,o,i=a;function a(u){let l=e.reduce((c,d)=>d(c),t());return r=Yvn(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=ewn(u,r);return o(u,c),c}return function(){return i(twn.apply(null,arguments))}}var BJe,Hvn,Gjt,Vjt,Vvn,Jvn,qJe,Jjt,Kvn,Wvn,Gvn,Zjt,Zvn,Xvn,Yvn,Qvn,ewn,Xjt,ul,Yjt,rwn,nwn,own,iwn,awn,swn,uwn,VN,JL,NK,kJe,ote,lwn,Ko,KL,cwn,dwn,fwn,pwn,mwn,hwn,ite,jK,gwn,Qjt,ywn,bwn,Wjt,_wn,ate,vwn,wwn,eDt,tDt=v(()=>{BJe="-",Hvn=t=>{let e=Jvn(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:a=>{let s=a.split(BJe);return s[0]===""&&s.length!==1&&s.shift(),Gjt(s,e)||Vvn(a)},getConflictingClassGroupIds:(a,s)=>{let u=r[a]||[];return s&&n[a]?[...u,...n[a]]:u}}},Gjt=(t,e)=>{if(t.length===0)return e.classGroupId;let r=t[0],n=e.nextPart.get(r),o=n?Gjt(t.slice(1),n):void 0;if(o)return o;if(e.validators.length===0)return;let i=t.join(BJe);return e.validators.find(({validator:a})=>a(i))?.classGroupId},Vjt=/^\[(.+)\]$/,Vvn=t=>{if(Vjt.test(t)){let e=Vjt.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},Jvn=t=>{let{theme:e,prefix:r}=t,n={nextPart:new Map,validators:[]};return Wvn(Object.entries(t.classGroups),r).forEach(([i,a])=>{qJe(a,n,i,e)}),n},qJe=(t,e,r,n)=>{t.forEach(o=>{if(typeof o=="string"){let i=o===""?e:Jjt(e,o);i.classGroupId=r;return}if(typeof o=="function"){if(Kvn(o)){qJe(o(n),e,r,n);return}e.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([i,a])=>{qJe(a,Jjt(e,i),r,n)})})},Jjt=(t,e)=>{let r=t;return e.split(BJe).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Kvn=t=>t.isThemeGetter,Wvn=(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,Gvn=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)}}},Zjt="!",Zvn=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 g=0;g<s.length;g++){let y=s[g];if(l===0){if(y===o&&(n||s.slice(g,g+i)===e)){u.push(s.slice(c,g)),c=g+i;continue}if(y==="/"){d=g;continue}}y==="["?l++:y==="]"&&l--}let f=u.length===0?s:s.substring(c),p=f.startsWith(Zjt),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},Xvn=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},Yvn=t=>({cache:Gvn(t.cacheSize),parseClassName:Zvn(t),...Hvn(t)}),Qvn=/\s+/,ewn=(t,e)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=e,i=[],a=t.trim().split(Qvn),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 g=Xvn(c).join(":"),y=d?g+Zjt:g,b=y+h;if(i.includes(b))continue;i.push(b);let _=o(h,m);for(let w=0;w<_.length;++w){let x=_[w];i.push(y+x)}s=l+(s.length>0?" "+s:s)}return s};Xjt=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=Xjt(t[n]))&&(r&&(r+=" "),r+=e);return r};ul=t=>{let e=r=>r[t]||[];return e.isThemeGetter=!0,e},Yjt=/^\[(?:([a-z-]+):)?(.+)\]$/i,rwn=/^\d+\/\d+$/,nwn=new Set(["px","full","screen"]),own=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,iwn=/\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$/,awn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,swn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,uwn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,VN=t=>NK(t)||nwn.has(t)||rwn.test(t),JL=t=>jK(t,"length",gwn),NK=t=>!!t&&!Number.isNaN(Number(t)),kJe=t=>jK(t,"number",NK),ote=t=>!!t&&Number.isInteger(Number(t)),lwn=t=>t.endsWith("%")&&NK(t.slice(0,-1)),Ko=t=>Yjt.test(t),KL=t=>own.test(t),cwn=new Set(["length","size","percentage"]),dwn=t=>jK(t,cwn,Qjt),fwn=t=>jK(t,"position",Qjt),pwn=new Set(["image","url"]),mwn=t=>jK(t,pwn,bwn),hwn=t=>jK(t,"",ywn),ite=()=>!0,jK=(t,e,r)=>{let n=Yjt.exec(t);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):r(n[2]):!1},gwn=t=>iwn.test(t)&&!awn.test(t),Qjt=()=>!1,ywn=t=>swn.test(t),bwn=t=>uwn.test(t),Wjt=()=>{let t=ul("colors"),e=ul("spacing"),r=ul("blur"),n=ul("brightness"),o=ul("borderColor"),i=ul("borderRadius"),a=ul("borderSpacing"),s=ul("borderWidth"),u=ul("contrast"),l=ul("grayscale"),c=ul("hueRotate"),d=ul("invert"),f=ul("gap"),p=ul("gradientColorStops"),m=ul("gradientColorStopPositions"),h=ul("inset"),g=ul("margin"),y=ul("opacity"),b=ul("padding"),_=ul("saturate"),w=ul("scale"),x=ul("sepia"),O=ul("skew"),E=ul("space"),T=ul("translate"),R=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",Ko,e],F=()=>[Ko,e],B=()=>["",VN,JL],U=()=>["auto",NK,Ko],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],G=()=>["solid","dashed","dotted","double","none"],ie=()=>["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"],z=()=>["","0",Ko],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],re=()=>[NK,Ko];return{cacheSize:500,separator:":",theme:{colors:[ite],spacing:[VN,JL],blur:["none","",KL,Ko],brightness:re(),borderColor:[t],borderRadius:["none","","full",KL,Ko],borderSpacing:F(),borderWidth:B(),contrast:re(),grayscale:z(),hueRotate:re(),invert:z(),gap:F(),gradientColorStops:[t],gradientColorStopPositions:[lwn,JL],inset:D(),margin:D(),opacity:re(),padding:F(),saturate:re(),scale:re(),sepia:z(),skew:re(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",Ko]}],container:["container"],columns:[{columns:[KL]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"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:[...H(),Ko]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[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",ote,Ko]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ko]}],grow:[{grow:z()}],shrink:[{shrink:z()}],order:[{order:["first","last","none",ote,Ko]}],"grid-cols":[{"grid-cols":[ite]}],"col-start-end":[{col:["auto",{span:["full",ote,Ko]},Ko]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[ite]}],"row-start-end":[{row:["auto",{span:[ote,Ko]},Ko]}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ko]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ko]}],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:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ko,e]}],"min-w":[{"min-w":[Ko,e,"min","max","fit"]}],"max-w":[{"max-w":[Ko,e,"none","full","min","max","fit","prose",{screen:[KL]},KL]}],h:[{h:[Ko,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ko,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ko,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ko,e,"auto","min","max","fit"]}],"font-size":[{text:["base",KL,JL]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kJe]}],"font-family":[{font:[ite]}],"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",Ko]}],"line-clamp":[{"line-clamp":["none",NK,kJe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",VN,Ko]}],"list-image":[{"list-image":["none",Ko]}],"list-style-type":[{list:["none","disc","decimal",Ko]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",VN,JL]}],"underline-offset":[{"underline-offset":["auto",VN,Ko]}],"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:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ko]}],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",Ko]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),fwn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",dwn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},mwn]}],"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":[y]}],"border-style":[{border:[...G(),"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":[y]}],"divide-style":[{divide:G()}],"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:["",...G()]}],"outline-offset":[{"outline-offset":[VN,Ko]}],"outline-w":[{outline:[VN,JL]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[VN,JL]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",KL,hwn]}],"shadow-color":[{shadow:[ite]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...ie(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ie()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",KL,Ko]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[d]}],saturate:[{saturate:[_]}],sepia:[{sepia:[x]}],"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":[y]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"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",Ko]}],duration:[{duration:re()}],ease:[{ease:["linear","in","out","in-out",Ko]}],delay:[{delay:re()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ko]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[ote,Ko]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[O]}],"skew-y":[{"skew-y":[O]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ko]}],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",Ko]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ko]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[VN,JL,kJe]}],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"]}}},_wn=(t,{cacheSize:e,prefix:r,separator:n,experimentalParseClassName:o,extend:i={},override:a={}})=>{ate(t,"cacheSize",e),ate(t,"prefix",r),ate(t,"separator",n),ate(t,"experimentalParseClassName",o);for(let s in a)vwn(t[s],a[s]);for(let s in i)wwn(t[s],i[s]);return t},ate=(t,e,r)=>{r!==void 0&&(t[e]=r)},vwn=(t,e)=>{if(e)for(let r in e)ate(t,r,e[r])},wwn=(t,e)=>{if(e)for(let r in e){let n=e[r];n!==void 0&&(t[r]=(t[r]||[]).concat(n))}},eDt=(t,...e)=>typeof t=="function"?Kjt(Wjt,t,...e):Kjt(()=>_wn(Wjt(),t),...e)});function Oe(...t){return Swn(xye(t))}var Swn,jn=v(()=>{FJe();tDt();Swn=eDt({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 Tye,Cwn,ve,Ro=v(()=>{Tye=L(X());ah();Oye();jn();Cwn=IK("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"}}),ve=Tye.forwardRef(({className:t,variant:e,size:r,asChild:n=!1,...o},i)=>Tye.createElement(n?kjt:"button",{className:Oe(Cwn({variant:e,size:r,className:t})),ref:i,...o}));ve.displayName="Button"});var rDt,Eye,UJe=v(()=>{rDt=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Eye=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim()});var nDt,oDt=v(()=>{nDt={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 ste,iDt,aDt=v(()=>{ste=L(X());oDt();UJe();iDt=(0,ste.forwardRef)(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:i,iconNode:a,...s},u)=>(0,ste.createElement)("svg",{ref:u,...nDt,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:Eye("lucide",o),...s},[...a.map(([l,c])=>(0,ste.createElement)(l,c)),...Array.isArray(i)?i:[i]]))});var Pye,Pe,Yt=v(()=>{Pye=L(X());UJe();aDt();Pe=(t,e)=>{let r=(0,Pye.forwardRef)(({className:n,...o},i)=>(0,Pye.createElement)(iDt,{ref:i,iconNode:e,className:Eye(`lucide-${rDt(t)}`,n),...o}));return r.displayName=`${t}`,r}});var DK,sDt=v(()=>{Yt();DK=Pe("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]])});var ute,uDt=v(()=>{Yt();ute=Pe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])});var lte,lDt=v(()=>{Yt();lte=Pe("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]])});var cte,cDt=v(()=>{Yt();cte=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 $K,dDt=v(()=>{Yt();$K=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 Uu,fDt=v(()=>{Yt();Uu=Pe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])});var Qs,pDt=v(()=>{Yt();Qs=Pe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])});var tg,mDt=v(()=>{Yt();tg=Pe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])});var sC,hDt=v(()=>{Yt();sC=Pe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])});var FO,gDt=v(()=>{Yt();FO=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 WL,yDt=v(()=>{Yt();WL=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 dte,bDt=v(()=>{Yt();dte=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 GL,_Dt=v(()=>{Yt();GL=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 jv,vDt=v(()=>{Yt();jv=Pe("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]])});var ZL,wDt=v(()=>{Yt();ZL=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 XL,SDt=v(()=>{Yt();XL=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,CDt=v(()=>{Yt();fte=Pe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])});var pte,xDt=v(()=>{Yt();pte=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 mte,ODt=v(()=>{Yt();mte=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 YL,TDt=v(()=>{Yt();YL=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 h_,EDt=v(()=>{Yt();h_=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 uC,PDt=v(()=>{Yt();uC=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 hte,MDt=v(()=>{Yt();hte=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 JN,RDt=v(()=>{Yt();JN=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 gte,ADt=v(()=>{Yt();gte=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 kO,IDt=v(()=>{Yt();kO=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 QL,NDt=v(()=>{Yt();QL=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 KN,jDt=v(()=>{Yt();KN=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 yte,DDt=v(()=>{Yt();yte=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 WN,$Dt=v(()=>{Yt();WN=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 bte,LDt=v(()=>{Yt();bte=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 GN,FDt=v(()=>{Yt();GN=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 _te,kDt=v(()=>{Yt();_te=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 vte,qDt=v(()=>{Yt();vte=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,BDt=v(()=>{Yt();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 ic,UDt=v(()=>{Yt();ic=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 Ste,zDt=v(()=>{Yt();Ste=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 Cte,HDt=v(()=>{Yt();Cte=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 sh,VDt=v(()=>{Yt();sh=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 lC,JDt=v(()=>{Yt();lC=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 cC,KDt=v(()=>{Yt();cC=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,WDt=v(()=>{Yt();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 Ote,GDt=v(()=>{Yt();Ote=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 Tte,ZDt=v(()=>{Yt();Tte=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 Ete,XDt=v(()=>{Yt();Ete=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 l4,YDt=v(()=>{Yt();l4=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 ZN,QDt=v(()=>{Yt();ZN=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 Zc,e$t=v(()=>{Yt();Zc=Pe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])});var Pte,t$t=v(()=>{Yt();Pte=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 LK,r$t=v(()=>{Yt();LK=Pe("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]])});var FK,n$t=v(()=>{Yt();FK=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 uS,o$t=v(()=>{Yt();uS=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 lb,i$t=v(()=>{Yt();lb=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 kK,a$t=v(()=>{Yt();kK=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 qK,s$t=v(()=>{Yt();qK=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 dC,u$t=v(()=>{Yt();dC=Pe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])});var Mte,l$t=v(()=>{Yt();Mte=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 qO,c$t=v(()=>{Yt();qO=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 Rte,d$t=v(()=>{Yt();Rte=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 Ate,f$t=v(()=>{Yt();Ate=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 c4,p$t=v(()=>{Yt();c4=Pe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])});var ly,m$t=v(()=>{Yt();ly=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 XN,h$t=v(()=>{Yt();XN=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 g_,g$t=v(()=>{Yt();g_=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 eF,y$t=v(()=>{Yt();eF=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 Ite,b$t=v(()=>{Yt();Ite=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 cy,_$t=v(()=>{Yt();cy=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 rg,v$t=v(()=>{Yt();rg=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 Dv,w$t=v(()=>{Yt();Dv=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 pi,S$t=v(()=>{Yt();pi=Pe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])});var Nte,C$t=v(()=>{Yt();Nte=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 jte,x$t=v(()=>{Yt();jte=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 On=v(()=>{gDt();yDt();_Dt();vDt();wDt();SDt();IDt();NDt();e$t();o$t();i$t();m$t();h$t();g$t();v$t();sDt();uDt();lDt();cDt();dDt();fDt();pDt();mDt();hDt();bDt();CDt();xDt();ODt();TDt();EDt();PDt();MDt();RDt();ADt();jDt();DDt();$Dt();LDt();FDt();kDt();qDt();BDt();UDt();zDt();HDt();VDt();JDt();KDt();WDt();GDt();ZDt();XDt();YDt();QDt();t$t();r$t();n$t();a$t();s$t();u$t();l$t();c$t();d$t();f$t();p$t();y$t();b$t();_$t();w$t();S$t();C$t();x$t();});function xwn({onCancel:t}){let e=ce(),r=zJe(e.defaultModelKey)&&zJe(e.embeddingModelKey);return BO.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},BO.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},BO.default.createElement("div",null,"Your Copilot Plus license key is no longer valid. Please renew your subscription to continue using Copilot Plus."),r&&BO.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.")),BO.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},BO.default.createElement(ve,{variant:"ghost",onClick:t},"Close"),BO.default.createElement(ve,{variant:"default",onClick:()=>{d4(IN.EXPIRED_MODAL)}},"Renew Now ",BO.default.createElement(KN,{className:"tw-size-4"}))))}var BO,O$t,T$t,Mye,E$t=v(()=>{BO=L(X()),O$t=require("obsidian"),T$t=L(wm());Ro();$v();zr();On();Pt();Mye=class extends O$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,T$t.createRoot)(e);let r=()=>{this.close()};this.root.render(BO.default.createElement(xwn,{onCancel:r}))}onClose(){this.root.unmount()}}});var M$t=S(P$t=>{"use strict";Object.defineProperty(P$t,"__esModule",{value:!0})});var R$t=S(Rye=>{"use strict";Object.defineProperty(Rye,"__esModule",{value:!0});Rye.V2ChatStreamRequestSafetyMode=void 0;Rye.V2ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",Off:"OFF"}});var A$t=S(Aye=>{"use strict";Object.defineProperty(Aye,"__esModule",{value:!0});Aye.V2ChatStreamRequestToolChoice=void 0;Aye.V2ChatStreamRequestToolChoice={Required:"REQUIRED",None:"NONE"}});var N$t=S(I$t=>{"use strict";Object.defineProperty(I$t,"__esModule",{value:!0})});var D$t=S(j$t=>{"use strict";Object.defineProperty(j$t,"__esModule",{value:!0})});var $$t=S(Iye=>{"use strict";Object.defineProperty(Iye,"__esModule",{value:!0});Iye.V2ChatRequestSafetyMode=void 0;Iye.V2ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",Off:"OFF"}});var L$t=S(Nye=>{"use strict";Object.defineProperty(Nye,"__esModule",{value:!0});Nye.V2ChatRequestToolChoice=void 0;Nye.V2ChatRequestToolChoice={Required:"REQUIRED",None:"NONE"}});var k$t=S(F$t=>{"use strict";Object.defineProperty(F$t,"__esModule",{value:!0})});var q$t=S(jye=>{"use strict";Object.defineProperty(jye,"__esModule",{value:!0});jye.V2EmbedRequestTruncate=void 0;jye.V2EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var U$t=S(B$t=>{"use strict";Object.defineProperty(B$t,"__esModule",{value:!0})});var H$t=S(z$t=>{"use strict";Object.defineProperty(z$t,"__esModule",{value:!0})});var HJe=S(ng=>{"use strict";var Own=ng&&ng.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fC=ng&&ng.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Own(e,t,r)};Object.defineProperty(ng,"__esModule",{value:!0});fC(M$t(),ng);fC(R$t(),ng);fC(A$t(),ng);fC(N$t(),ng);fC(D$t(),ng);fC($$t(),ng);fC(L$t(),ng);fC(k$t(),ng);fC(q$t(),ng);fC(U$t(),ng);fC(H$t(),ng)});var VJe=S(V$t=>{"use strict";Object.defineProperty(V$t,"__esModule",{value:!0})});var J$t=S(f4=>{"use strict";var Twn=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]}),Ewn=f4&&f4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Twn(e,t,r)};Object.defineProperty(f4,"__esModule",{value:!0});Ewn(VJe(),f4)});var W$t=S(tF=>{"use strict";var Pwn=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]}),K$t=tF&&tF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Pwn(e,t,r)};Object.defineProperty(tF,"__esModule",{value:!0});K$t(HJe(),tF);K$t(J$t(),tF)});var G$t=S(Dye=>{"use strict";Object.defineProperty(Dye,"__esModule",{value:!0});Dye.CreateEmbedJobRequestTruncate=void 0;Dye.CreateEmbedJobRequestTruncate={Start:"START",End:"END"}});var JJe=S(p4=>{"use strict";var Mwn=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]}),Rwn=p4&&p4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Mwn(e,t,r)};Object.defineProperty(p4,"__esModule",{value:!0});Rwn(G$t(),p4)});var KJe=S(Z$t=>{"use strict";Object.defineProperty(Z$t,"__esModule",{value:!0})});var X$t=S(m4=>{"use strict";var Awn=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]}),Iwn=m4&&m4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Awn(e,t,r)};Object.defineProperty(m4,"__esModule",{value:!0});Iwn(KJe(),m4)});var Q$t=S(rF=>{"use strict";var Nwn=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]}),Y$t=rF&&rF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Nwn(e,t,r)};Object.defineProperty(rF,"__esModule",{value:!0});Y$t(JJe(),rF);Y$t(X$t(),rF)});var tLt=S(eLt=>{"use strict";Object.defineProperty(eLt,"__esModule",{value:!0})});var nLt=S(rLt=>{"use strict";Object.defineProperty(rLt,"__esModule",{value:!0})});var iLt=S(oLt=>{"use strict";Object.defineProperty(oLt,"__esModule",{value:!0})});var sLt=S(aLt=>{"use strict";Object.defineProperty(aLt,"__esModule",{value:!0})});var WJe=S(UO=>{"use strict";var jwn=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]}),$ye=UO&&UO.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jwn(e,t,r)};Object.defineProperty(UO,"__esModule",{value:!0});$ye(tLt(),UO);$ye(nLt(),UO);$ye(iLt(),UO);$ye(sLt(),UO)});var GJe=S(uLt=>{"use strict";Object.defineProperty(uLt,"__esModule",{value:!0})});var lLt=S(h4=>{"use strict";var Dwn=h4&&h4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$wn=h4&&h4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Dwn(e,t,r)};Object.defineProperty(h4,"__esModule",{value:!0});$wn(GJe(),h4)});var dLt=S(nF=>{"use strict";var Lwn=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]}),cLt=nF&&nF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Lwn(e,t,r)};Object.defineProperty(nF,"__esModule",{value:!0});cLt(WJe(),nF);cLt(lLt(),nF)});var fLt=S(Lye=>{"use strict";Object.defineProperty(Lye,"__esModule",{value:!0});Lye.BaseType=void 0;Lye.BaseType={BaseTypeUnspecified:"BASE_TYPE_UNSPECIFIED",BaseTypeGenerative:"BASE_TYPE_GENERATIVE",BaseTypeClassification:"BASE_TYPE_CLASSIFICATION",BaseTypeRerank:"BASE_TYPE_RERANK",BaseTypeChat:"BASE_TYPE_CHAT"}});var pLt=S(Fye=>{"use strict";Object.defineProperty(Fye,"__esModule",{value:!0});Fye.Strategy=void 0;Fye.Strategy={StrategyUnspecified:"STRATEGY_UNSPECIFIED",StrategyVanilla:"STRATEGY_VANILLA",StrategyTfew:"STRATEGY_TFEW"}});var hLt=S(mLt=>{"use strict";Object.defineProperty(mLt,"__esModule",{value:!0})});var gLt=S(kye=>{"use strict";Object.defineProperty(kye,"__esModule",{value:!0});kye.LoraTargetModules=void 0;kye.LoraTargetModules={LoraTargetModulesUnspecified:"LORA_TARGET_MODULES_UNSPECIFIED",LoraTargetModulesQv:"LORA_TARGET_MODULES_QV",LoraTargetModulesQkvo:"LORA_TARGET_MODULES_QKVO",LoraTargetModulesQkvoFfn:"LORA_TARGET_MODULES_QKVO_FFN"}});var bLt=S(yLt=>{"use strict";Object.defineProperty(yLt,"__esModule",{value:!0})});var vLt=S(_Lt=>{"use strict";Object.defineProperty(_Lt,"__esModule",{value:!0})});var SLt=S(wLt=>{"use strict";Object.defineProperty(wLt,"__esModule",{value:!0})});var CLt=S(qye=>{"use strict";Object.defineProperty(qye,"__esModule",{value:!0});qye.Status=void 0;qye.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 OLt=S(xLt=>{"use strict";Object.defineProperty(xLt,"__esModule",{value:!0})});var ELt=S(TLt=>{"use strict";Object.defineProperty(TLt,"__esModule",{value:!0})});var MLt=S(PLt=>{"use strict";Object.defineProperty(PLt,"__esModule",{value:!0})});var ALt=S(RLt=>{"use strict";Object.defineProperty(RLt,"__esModule",{value:!0})});var NLt=S(ILt=>{"use strict";Object.defineProperty(ILt,"__esModule",{value:!0})});var DLt=S(jLt=>{"use strict";Object.defineProperty(jLt,"__esModule",{value:!0})});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 BLt=S(qLt=>{"use strict";Object.defineProperty(qLt,"__esModule",{value:!0})});var zLt=S(ULt=>{"use strict";Object.defineProperty(ULt,"__esModule",{value:!0})});var ZJe=S(Rl=>{"use strict";var Fwn=Rl&&Rl.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uh=Rl&&Rl.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Fwn(e,t,r)};Object.defineProperty(Rl,"__esModule",{value:!0});uh(fLt(),Rl);uh(pLt(),Rl);uh(hLt(),Rl);uh(gLt(),Rl);uh(bLt(),Rl);uh(vLt(),Rl);uh(SLt(),Rl);uh(CLt(),Rl);uh(OLt(),Rl);uh(ELt(),Rl);uh(MLt(),Rl);uh(ALt(),Rl);uh(NLt(),Rl);uh(DLt(),Rl);uh(LLt(),Rl);uh(kLt(),Rl);uh(BLt(),Rl);uh(zLt(),Rl)});var HLt=S(g4=>{"use strict";var kwn=g4&&g4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qwn=g4&&g4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&kwn(e,t,r)};Object.defineProperty(g4,"__esModule",{value:!0});qwn(ZJe(),g4)});var JLt=S(Lv=>{"use strict";var VLt=Lv&&Lv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Bwn=Lv&&Lv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uwn=Lv&&Lv.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&VLt(r,e,n[o]);return Bwn(r,e),r}}(),zwn=Lv&&Lv.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&VLt(e,t,r)};Object.defineProperty(Lv,"__esModule",{value:!0});Lv.finetuning=void 0;Lv.finetuning=Uwn(HLt());zwn(ZJe(),Lv)});var XJe=S(KLt=>{"use strict";Object.defineProperty(KLt,"__esModule",{value:!0})});var WLt=S(y4=>{"use strict";var Hwn=y4&&y4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Vwn=y4&&y4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Hwn(e,t,r)};Object.defineProperty(y4,"__esModule",{value:!0});Vwn(XJe(),y4)});var ZLt=S(oF=>{"use strict";var Jwn=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]}),GLt=oF&&oF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jwn(e,t,r)};Object.defineProperty(oF,"__esModule",{value:!0});GLt(JLt(),oF);GLt(WLt(),oF)});var YJe=S(XLt=>{"use strict";Object.defineProperty(XLt,"__esModule",{value:!0})});var YLt=S(b4=>{"use strict";var Kwn=b4&&b4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wwn=b4&&b4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Kwn(e,t,r)};Object.defineProperty(b4,"__esModule",{value:!0});Wwn(YJe(),b4)});var QLt=S(_4=>{"use strict";var Gwn=_4&&_4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=_4&&_4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Gwn(e,t,r)};Object.defineProperty(_4,"__esModule",{value:!0});Zwn(YLt(),_4)});var QJe=S(eFt=>{"use strict";Object.defineProperty(eFt,"__esModule",{value:!0})});var tFt=S(v4=>{"use strict";var Xwn=v4&&v4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ywn=v4&&v4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Xwn(e,t,r)};Object.defineProperty(v4,"__esModule",{value:!0});Ywn(QJe(),v4)});var rFt=S(w4=>{"use strict";var Qwn=w4&&w4.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eSn=w4&&w4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Qwn(e,t,r)};Object.defineProperty(w4,"__esModule",{value:!0});eSn(tFt(),w4)});var oFt=S(Fs=>{"use strict";var nFt=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]}),tSn=Fs&&Fs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BK=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"&&nFt(r,e,n[o]);return tSn(r,e),r}}(),YN=Fs&&Fs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nFt(e,t,r)};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.models=Fs.connectors=Fs.finetuning=Fs.datasets=Fs.embedJobs=Fs.v2=void 0;Fs.v2=BK(W$t());YN(HJe(),Fs);Fs.embedJobs=BK(Q$t());YN(JJe(),Fs);Fs.datasets=BK(dLt());YN(WJe(),Fs);Fs.finetuning=BK(ZLt());Fs.connectors=BK(QLt());Fs.models=BK(rFt());YN(VJe(),Fs);YN(KJe(),Fs);YN(GJe(),Fs);YN(YJe(),Fs);YN(QJe(),Fs);YN(XJe(),Fs)});var iFt=S(Bye=>{"use strict";Object.defineProperty(Bye,"__esModule",{value:!0});Bye.ChatStreamRequestPromptTruncation=void 0;Bye.ChatStreamRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var aFt=S(Uye=>{"use strict";Object.defineProperty(Uye,"__esModule",{value:!0});Uye.ChatStreamRequestCitationQuality=void 0;Uye.ChatStreamRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var sFt=S(zye=>{"use strict";Object.defineProperty(zye,"__esModule",{value:!0});zye.ChatStreamRequestSafetyMode=void 0;zye.ChatStreamRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var lFt=S(uFt=>{"use strict";Object.defineProperty(uFt,"__esModule",{value:!0})});var cFt=S(Hye=>{"use strict";Object.defineProperty(Hye,"__esModule",{value:!0});Hye.ChatRequestPromptTruncation=void 0;Hye.ChatRequestPromptTruncation={Off:"OFF",Auto:"AUTO",AutoPreserveOrder:"AUTO_PRESERVE_ORDER"}});var dFt=S(Vye=>{"use strict";Object.defineProperty(Vye,"__esModule",{value:!0});Vye.ChatRequestCitationQuality=void 0;Vye.ChatRequestCitationQuality={Fast:"fast",Accurate:"accurate",Off:"off"}});var fFt=S(Jye=>{"use strict";Object.defineProperty(Jye,"__esModule",{value:!0});Jye.ChatRequestSafetyMode=void 0;Jye.ChatRequestSafetyMode={Contextual:"CONTEXTUAL",Strict:"STRICT",None:"NONE"}});var mFt=S(pFt=>{"use strict";Object.defineProperty(pFt,"__esModule",{value:!0})});var hFt=S(Kye=>{"use strict";Object.defineProperty(Kye,"__esModule",{value:!0});Kye.GenerateStreamRequestTruncate=void 0;Kye.GenerateStreamRequestTruncate={None:"NONE",Start:"START",End:"END"}});var gFt=S(Wye=>{"use strict";Object.defineProperty(Wye,"__esModule",{value:!0});Wye.GenerateStreamRequestReturnLikelihoods=void 0;Wye.GenerateStreamRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var bFt=S(yFt=>{"use strict";Object.defineProperty(yFt,"__esModule",{value:!0})});var _Ft=S(Gye=>{"use strict";Object.defineProperty(Gye,"__esModule",{value:!0});Gye.GenerateRequestTruncate=void 0;Gye.GenerateRequestTruncate={None:"NONE",Start:"START",End:"END"}});var vFt=S(Zye=>{"use strict";Object.defineProperty(Zye,"__esModule",{value:!0});Zye.GenerateRequestReturnLikelihoods=void 0;Zye.GenerateRequestReturnLikelihoods={Generation:"GENERATION",All:"ALL",None:"NONE"}});var SFt=S(wFt=>{"use strict";Object.defineProperty(wFt,"__esModule",{value:!0})});var CFt=S(Xye=>{"use strict";Object.defineProperty(Xye,"__esModule",{value:!0});Xye.EmbedRequestTruncate=void 0;Xye.EmbedRequestTruncate={None:"NONE",Start:"START",End:"END"}});var OFt=S(xFt=>{"use strict";Object.defineProperty(xFt,"__esModule",{value:!0})});var EFt=S(TFt=>{"use strict";Object.defineProperty(TFt,"__esModule",{value:!0})});var MFt=S(PFt=>{"use strict";Object.defineProperty(PFt,"__esModule",{value:!0})});var AFt=S(RFt=>{"use strict";Object.defineProperty(RFt,"__esModule",{value:!0})});var NFt=S(IFt=>{"use strict";Object.defineProperty(IFt,"__esModule",{value:!0})});var jFt=S(Yye=>{"use strict";Object.defineProperty(Yye,"__esModule",{value:!0});Yye.ClassifyRequestTruncate=void 0;Yye.ClassifyRequestTruncate={None:"NONE",Start:"START",End:"END"}});var $Ft=S(DFt=>{"use strict";Object.defineProperty(DFt,"__esModule",{value:!0})});var LFt=S(Qye=>{"use strict";Object.defineProperty(Qye,"__esModule",{value:!0});Qye.ClassifyResponseClassificationsItemClassificationType=void 0;Qye.ClassifyResponseClassificationsItemClassificationType={SingleLabel:"single-label",MultiLabel:"multi-label"}});var kFt=S(FFt=>{"use strict";Object.defineProperty(FFt,"__esModule",{value:!0})});var BFt=S(qFt=>{"use strict";Object.defineProperty(qFt,"__esModule",{value:!0})});var UFt=S(ebe=>{"use strict";Object.defineProperty(ebe,"__esModule",{value:!0});ebe.SummarizeRequestLength=void 0;ebe.SummarizeRequestLength={Short:"short",Medium:"medium",Long:"long"}});var zFt=S(tbe=>{"use strict";Object.defineProperty(tbe,"__esModule",{value:!0});tbe.SummarizeRequestFormat=void 0;tbe.SummarizeRequestFormat={Paragraph:"paragraph",Bullets:"bullets"}});var HFt=S(rbe=>{"use strict";Object.defineProperty(rbe,"__esModule",{value:!0});rbe.SummarizeRequestExtractiveness=void 0;rbe.SummarizeRequestExtractiveness={Low:"low",Medium:"medium",High:"high"}});var JFt=S(VFt=>{"use strict";Object.defineProperty(VFt,"__esModule",{value:!0})});var WFt=S(KFt=>{"use strict";Object.defineProperty(KFt,"__esModule",{value:!0})});var ZFt=S(GFt=>{"use strict";Object.defineProperty(GFt,"__esModule",{value:!0})});var YFt=S(XFt=>{"use strict";Object.defineProperty(XFt,"__esModule",{value:!0})});var ekt=S(QFt=>{"use strict";Object.defineProperty(QFt,"__esModule",{value:!0})});var rkt=S(tkt=>{"use strict";Object.defineProperty(tkt,"__esModule",{value:!0})});var 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 Ckt=S(nbe=>{"use strict";Object.defineProperty(nbe,"__esModule",{value:!0});nbe.ChatCitationType=void 0;nbe.ChatCitationType={TextContent:"TEXT_CONTENT",Plan:"PLAN"}});var Okt=S(xkt=>{"use strict";Object.defineProperty(xkt,"__esModule",{value:!0})});var Ekt=S(Tkt=>{"use strict";Object.defineProperty(Tkt,"__esModule",{value:!0})});var Mkt=S(Pkt=>{"use strict";Object.defineProperty(Pkt,"__esModule",{value:!0})});var Akt=S(Rkt=>{"use strict";Object.defineProperty(Rkt,"__esModule",{value:!0})});var Ikt=S(obe=>{"use strict";Object.defineProperty(obe,"__esModule",{value:!0});obe.FinishReason=void 0;obe.FinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",Error:"ERROR",ErrorToxic:"ERROR_TOXIC",ErrorLimit:"ERROR_LIMIT",UserCancel:"USER_CANCEL",MaxTokens:"MAX_TOKENS"}});var jkt=S(Nkt=>{"use strict";Object.defineProperty(Nkt,"__esModule",{value:!0})});var $kt=S(Dkt=>{"use strict";Object.defineProperty(Dkt,"__esModule",{value:!0})});var Fkt=S(Lkt=>{"use strict";Object.defineProperty(Lkt,"__esModule",{value:!0})});var qkt=S(kkt=>{"use strict";Object.defineProperty(kkt,"__esModule",{value:!0})});var Ukt=S(Bkt=>{"use strict";Object.defineProperty(Bkt,"__esModule",{value:!0})});var Hkt=S(zkt=>{"use strict";Object.defineProperty(zkt,"__esModule",{value:!0})});var Jkt=S(Vkt=>{"use strict";Object.defineProperty(Vkt,"__esModule",{value:!0})});var Wkt=S(Kkt=>{"use strict";Object.defineProperty(Kkt,"__esModule",{value:!0})});var Zkt=S(Gkt=>{"use strict";Object.defineProperty(Gkt,"__esModule",{value:!0})});var Ykt=S(Xkt=>{"use strict";Object.defineProperty(Xkt,"__esModule",{value:!0})});var eqt=S(Qkt=>{"use strict";Object.defineProperty(Qkt,"__esModule",{value:!0})});var tqt=S(ibe=>{"use strict";Object.defineProperty(ibe,"__esModule",{value:!0});ibe.ChatStreamEndEventFinishReason=void 0;ibe.ChatStreamEndEventFinishReason={Complete:"COMPLETE",ErrorLimit:"ERROR_LIMIT",MaxTokens:"MAX_TOKENS",Error:"ERROR",ErrorToxic:"ERROR_TOXIC"}});var nqt=S(rqt=>{"use strict";Object.defineProperty(rqt,"__esModule",{value:!0})});var iqt=S(oqt=>{"use strict";Object.defineProperty(oqt,"__esModule",{value:!0})});var sqt=S(aqt=>{"use strict";Object.defineProperty(aqt,"__esModule",{value:!0})});var lqt=S(uqt=>{"use strict";Object.defineProperty(uqt,"__esModule",{value:!0})});var dqt=S(cqt=>{"use strict";Object.defineProperty(cqt,"__esModule",{value:!0})});var fqt=S(abe=>{"use strict";Object.defineProperty(abe,"__esModule",{value:!0});abe.ImageUrlDetail=void 0;abe.ImageUrlDetail={Auto:"auto",Low:"low",High:"high"}});var mqt=S(pqt=>{"use strict";Object.defineProperty(pqt,"__esModule",{value:!0})});var gqt=S(hqt=>{"use strict";Object.defineProperty(hqt,"__esModule",{value:!0})});var bqt=S(yqt=>{"use strict";Object.defineProperty(yqt,"__esModule",{value:!0})});var vqt=S(_qt=>{"use strict";Object.defineProperty(_qt,"__esModule",{value:!0})});var Sqt=S(wqt=>{"use strict";Object.defineProperty(wqt,"__esModule",{value:!0})});var xqt=S(Cqt=>{"use strict";Object.defineProperty(Cqt,"__esModule",{value:!0})});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 Rqt=S(Mqt=>{"use strict";Object.defineProperty(Mqt,"__esModule",{value:!0})});var Iqt=S(Aqt=>{"use strict";Object.defineProperty(Aqt,"__esModule",{value:!0})});var jqt=S(Nqt=>{"use strict";Object.defineProperty(Nqt,"__esModule",{value:!0})});var Dqt=S(sbe=>{"use strict";Object.defineProperty(sbe,"__esModule",{value:!0});sbe.CitationType=void 0;sbe.CitationType={TextContent:"TEXT_CONTENT",ThinkingContent:"THINKING_CONTENT",Plan:"PLAN"}});var Lqt=S($qt=>{"use strict";Object.defineProperty($qt,"__esModule",{value:!0})});var kqt=S(Fqt=>{"use strict";Object.defineProperty(Fqt,"__esModule",{value:!0})});var Bqt=S(qqt=>{"use strict";Object.defineProperty(qqt,"__esModule",{value:!0})});var zqt=S(Uqt=>{"use strict";Object.defineProperty(Uqt,"__esModule",{value:!0})});var Vqt=S(Hqt=>{"use strict";Object.defineProperty(Hqt,"__esModule",{value:!0})});var Kqt=S(Jqt=>{"use strict";Object.defineProperty(Jqt,"__esModule",{value:!0})});var Gqt=S(Wqt=>{"use strict";Object.defineProperty(Wqt,"__esModule",{value:!0})});var Xqt=S(Zqt=>{"use strict";Object.defineProperty(Zqt,"__esModule",{value:!0})});var Qqt=S(Yqt=>{"use strict";Object.defineProperty(Yqt,"__esModule",{value:!0})});var tBt=S(eBt=>{"use strict";Object.defineProperty(eBt,"__esModule",{value:!0})});var nBt=S(rBt=>{"use strict";Object.defineProperty(rBt,"__esModule",{value:!0})});var iBt=S(oBt=>{"use strict";Object.defineProperty(oBt,"__esModule",{value:!0})});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 mBt=S(ube=>{"use strict";Object.defineProperty(ube,"__esModule",{value:!0});ube.CitationOptionsMode=void 0;ube.CitationOptionsMode={Fast:"FAST",Accurate:"ACCURATE",Off:"OFF"}});var gBt=S(hBt=>{"use strict";Object.defineProperty(hBt,"__esModule",{value:!0})});var bBt=S(yBt=>{"use strict";Object.defineProperty(yBt,"__esModule",{value:!0})});var vBt=S(_Bt=>{"use strict";Object.defineProperty(_Bt,"__esModule",{value:!0})});var SBt=S(wBt=>{"use strict";Object.defineProperty(wBt,"__esModule",{value:!0})});var CBt=S(lbe=>{"use strict";Object.defineProperty(lbe,"__esModule",{value:!0});lbe.ThinkingType=void 0;lbe.ThinkingType={Enabled:"enabled",Disabled:"disabled"}});var OBt=S(xBt=>{"use strict";Object.defineProperty(xBt,"__esModule",{value:!0})});var TBt=S(cbe=>{"use strict";Object.defineProperty(cbe,"__esModule",{value:!0});cbe.ChatFinishReason=void 0;cbe.ChatFinishReason={Complete:"COMPLETE",StopSequence:"STOP_SEQUENCE",MaxTokens:"MAX_TOKENS",ToolCall:"TOOL_CALL",Error:"ERROR"}});var PBt=S(EBt=>{"use strict";Object.defineProperty(EBt,"__esModule",{value:!0})});var RBt=S(MBt=>{"use strict";Object.defineProperty(MBt,"__esModule",{value:!0})});var IBt=S(ABt=>{"use strict";Object.defineProperty(ABt,"__esModule",{value:!0})});var jBt=S(NBt=>{"use strict";Object.defineProperty(NBt,"__esModule",{value:!0})});var $Bt=S(DBt=>{"use strict";Object.defineProperty(DBt,"__esModule",{value:!0})});var FBt=S(LBt=>{"use strict";Object.defineProperty(LBt,"__esModule",{value:!0})});var qBt=S(kBt=>{"use strict";Object.defineProperty(kBt,"__esModule",{value:!0})});var UBt=S(BBt=>{"use strict";Object.defineProperty(BBt,"__esModule",{value:!0})});var HBt=S(zBt=>{"use strict";Object.defineProperty(zBt,"__esModule",{value:!0})});var JBt=S(VBt=>{"use strict";Object.defineProperty(VBt,"__esModule",{value:!0})});var KBt=S(dbe=>{"use strict";Object.defineProperty(dbe,"__esModule",{value:!0});dbe.ChatContentStartEventDeltaMessageContentType=void 0;dbe.ChatContentStartEventDeltaMessageContentType={Text:"text",Thinking:"thinking"}});var GBt=S(WBt=>{"use strict";Object.defineProperty(WBt,"__esModule",{value:!0})});var XBt=S(ZBt=>{"use strict";Object.defineProperty(ZBt,"__esModule",{value:!0})});var QBt=S(YBt=>{"use strict";Object.defineProperty(YBt,"__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 EUt=S(TUt=>{"use strict";Object.defineProperty(TUt,"__esModule",{value:!0})});var MUt=S(PUt=>{"use strict";Object.defineProperty(PUt,"__esModule",{value:!0})});var AUt=S(RUt=>{"use strict";Object.defineProperty(RUt,"__esModule",{value:!0})});var NUt=S(IUt=>{"use strict";Object.defineProperty(IUt,"__esModule",{value:!0})});var DUt=S(jUt=>{"use strict";Object.defineProperty(jUt,"__esModule",{value:!0})});var LUt=S($Ut=>{"use strict";Object.defineProperty($Ut,"__esModule",{value:!0})});var kUt=S(FUt=>{"use strict";Object.defineProperty(FUt,"__esModule",{value:!0})});var BUt=S(qUt=>{"use strict";Object.defineProperty(qUt,"__esModule",{value:!0})});var zUt=S(UUt=>{"use strict";Object.defineProperty(UUt,"__esModule",{value:!0})});var VUt=S(HUt=>{"use strict";Object.defineProperty(HUt,"__esModule",{value:!0})});var KUt=S(JUt=>{"use strict";Object.defineProperty(JUt,"__esModule",{value:!0})});var GUt=S(WUt=>{"use strict";Object.defineProperty(WUt,"__esModule",{value:!0})});var XUt=S(ZUt=>{"use strict";Object.defineProperty(ZUt,"__esModule",{value:!0})});var QUt=S(YUt=>{"use strict";Object.defineProperty(YUt,"__esModule",{value:!0})});var tzt=S(ezt=>{"use strict";Object.defineProperty(ezt,"__esModule",{value:!0})});var nzt=S(rzt=>{"use strict";Object.defineProperty(rzt,"__esModule",{value:!0})});var izt=S(ozt=>{"use strict";Object.defineProperty(ozt,"__esModule",{value:!0})});var szt=S(azt=>{"use strict";Object.defineProperty(azt,"__esModule",{value:!0})});var lzt=S(uzt=>{"use strict";Object.defineProperty(uzt,"__esModule",{value:!0})});var czt=S(fbe=>{"use strict";Object.defineProperty(fbe,"__esModule",{value:!0});fbe.EmbedInputType=void 0;fbe.EmbedInputType={SearchDocument:"search_document",SearchQuery:"search_query",Classification:"classification",Clustering:"clustering",Image:"image"}});var dzt=S(pbe=>{"use strict";Object.defineProperty(pbe,"__esModule",{value:!0});pbe.EmbeddingType=void 0;pbe.EmbeddingType={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary",Base64:"base64"}});var pzt=S(fzt=>{"use strict";Object.defineProperty(fzt,"__esModule",{value:!0})});var hzt=S(mzt=>{"use strict";Object.defineProperty(mzt,"__esModule",{value:!0})});var yzt=S(gzt=>{"use strict";Object.defineProperty(gzt,"__esModule",{value:!0})});var _zt=S(bzt=>{"use strict";Object.defineProperty(bzt,"__esModule",{value:!0})});var wzt=S(vzt=>{"use strict";Object.defineProperty(vzt,"__esModule",{value:!0})});var Czt=S(Szt=>{"use strict";Object.defineProperty(Szt,"__esModule",{value:!0})});var 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(mbe=>{"use strict";Object.defineProperty(mbe,"__esModule",{value:!0});mbe.EmbedJobStatus=void 0;mbe.EmbedJobStatus={Processing:"processing",Complete:"complete",Cancelling:"cancelling",Cancelled:"cancelled",Failed:"failed"}});var Azt=S(hbe=>{"use strict";Object.defineProperty(hbe,"__esModule",{value:!0});hbe.EmbedJobTruncate=void 0;hbe.EmbedJobTruncate={Start:"START",End:"END"}});var Nzt=S(Izt=>{"use strict";Object.defineProperty(Izt,"__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 Bzt=S(qzt=>{"use strict";Object.defineProperty(qzt,"__esModule",{value:!0})});var Uzt=S(gbe=>{"use strict";Object.defineProperty(gbe,"__esModule",{value:!0});gbe.DatasetValidationStatus=void 0;gbe.DatasetValidationStatus={Unknown:"unknown",Queued:"queued",Processing:"processing",Failed:"failed",Validated:"validated",Skipped:"skipped"}});var zzt=S(ybe=>{"use strict";Object.defineProperty(ybe,"__esModule",{value:!0});ybe.DatasetType=void 0;ybe.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 Vzt=S(Hzt=>{"use strict";Object.defineProperty(Hzt,"__esModule",{value:!0})});var Kzt=S(Jzt=>{"use strict";Object.defineProperty(Jzt,"__esModule",{value:!0})});var Gzt=S(Wzt=>{"use strict";Object.defineProperty(Wzt,"__esModule",{value:!0})});var Xzt=S(Zzt=>{"use strict";Object.defineProperty(Zzt,"__esModule",{value:!0})});var Qzt=S(Yzt=>{"use strict";Object.defineProperty(Yzt,"__esModule",{value:!0})});var t4t=S(e4t=>{"use strict";Object.defineProperty(e4t,"__esModule",{value:!0})});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 c4t=S(bbe=>{"use strict";Object.defineProperty(bbe,"__esModule",{value:!0});bbe.ConnectorAuthStatus=void 0;bbe.ConnectorAuthStatus={Valid:"valid",Expired:"expired"}});var f4t=S(d4t=>{"use strict";Object.defineProperty(d4t,"__esModule",{value:!0})});var m4t=S(p4t=>{"use strict";Object.defineProperty(p4t,"__esModule",{value:!0})});var g4t=S(h4t=>{"use strict";Object.defineProperty(h4t,"__esModule",{value:!0})});var y4t=S(_be=>{"use strict";Object.defineProperty(_be,"__esModule",{value:!0});_be.AuthTokenType=void 0;_be.AuthTokenType={Bearer:"bearer",Basic:"basic",Noscheme:"noscheme"}});var _4t=S(b4t=>{"use strict";Object.defineProperty(b4t,"__esModule",{value:!0})});var w4t=S(v4t=>{"use strict";Object.defineProperty(v4t,"__esModule",{value:!0})});var C4t=S(S4t=>{"use strict";Object.defineProperty(S4t,"__esModule",{value:!0})});var O4t=S(x4t=>{"use strict";Object.defineProperty(x4t,"__esModule",{value:!0})});var E4t=S(T4t=>{"use strict";Object.defineProperty(T4t,"__esModule",{value:!0})});var M4t=S(P4t=>{"use strict";Object.defineProperty(P4t,"__esModule",{value:!0})});var R4t=S(vbe=>{"use strict";Object.defineProperty(vbe,"__esModule",{value:!0});vbe.CompatibleEndpoint=void 0;vbe.CompatibleEndpoint={Chat:"chat",Embed:"embed",Classify:"classify",Summarize:"summarize",Rerank:"rerank",Rate:"rate",Generate:"generate"}});var I4t=S(A4t=>{"use strict";Object.defineProperty(A4t,"__esModule",{value:!0})});var j4t=S(N4t=>{"use strict";Object.defineProperty(N4t,"__esModule",{value:!0})});var D4t=S(de=>{"use strict";var rSn=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]}),he=de&&de.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rSn(e,t,r)};Object.defineProperty(de,"__esModule",{value:!0});he(iFt(),de);he(aFt(),de);he(sFt(),de);he(lFt(),de);he(cFt(),de);he(dFt(),de);he(fFt(),de);he(mFt(),de);he(hFt(),de);he(gFt(),de);he(bFt(),de);he(_Ft(),de);he(vFt(),de);he(SFt(),de);he(CFt(),de);he(OFt(),de);he(EFt(),de);he(MFt(),de);he(AFt(),de);he(NFt(),de);he(jFt(),de);he($Ft(),de);he(LFt(),de);he(kFt(),de);he(BFt(),de);he(UFt(),de);he(zFt(),de);he(HFt(),de);he(JFt(),de);he(WFt(),de);he(ZFt(),de);he(YFt(),de);he(ekt(),de);he(rkt(),de);he(okt(),de);he(akt(),de);he(ukt(),de);he(ckt(),de);he(fkt(),de);he(mkt(),de);he(gkt(),de);he(bkt(),de);he(vkt(),de);he(Skt(),de);he(Ckt(),de);he(Okt(),de);he(Ekt(),de);he(Mkt(),de);he(Akt(),de);he(Ikt(),de);he(jkt(),de);he($kt(),de);he(Fkt(),de);he(qkt(),de);he(Ukt(),de);he(Hkt(),de);he(Jkt(),de);he(Wkt(),de);he(Zkt(),de);he(Ykt(),de);he(eqt(),de);he(tqt(),de);he(nqt(),de);he(iqt(),de);he(sqt(),de);he(lqt(),de);he(dqt(),de);he(fqt(),de);he(mqt(),de);he(gqt(),de);he(bqt(),de);he(vqt(),de);he(Sqt(),de);he(xqt(),de);he(Tqt(),de);he(Pqt(),de);he(Rqt(),de);he(Iqt(),de);he(jqt(),de);he(Dqt(),de);he(Lqt(),de);he(kqt(),de);he(Bqt(),de);he(zqt(),de);he(Vqt(),de);he(Kqt(),de);he(Gqt(),de);he(Xqt(),de);he(Qqt(),de);he(tBt(),de);he(nBt(),de);he(iBt(),de);he(sBt(),de);he(lBt(),de);he(dBt(),de);he(pBt(),de);he(mBt(),de);he(gBt(),de);he(bBt(),de);he(vBt(),de);he(SBt(),de);he(CBt(),de);he(OBt(),de);he(TBt(),de);he(PBt(),de);he(RBt(),de);he(IBt(),de);he(jBt(),de);he($Bt(),de);he(FBt(),de);he(qBt(),de);he(UBt(),de);he(HBt(),de);he(JBt(),de);he(KBt(),de);he(GBt(),de);he(XBt(),de);he(QBt(),de);he(tUt(),de);he(nUt(),de);he(iUt(),de);he(sUt(),de);he(lUt(),de);he(dUt(),de);he(pUt(),de);he(hUt(),de);he(yUt(),de);he(_Ut(),de);he(wUt(),de);he(CUt(),de);he(OUt(),de);he(EUt(),de);he(MUt(),de);he(AUt(),de);he(NUt(),de);he(DUt(),de);he(LUt(),de);he(kUt(),de);he(BUt(),de);he(zUt(),de);he(VUt(),de);he(KUt(),de);he(GUt(),de);he(XUt(),de);he(QUt(),de);he(tzt(),de);he(nzt(),de);he(izt(),de);he(szt(),de);he(lzt(),de);he(czt(),de);he(dzt(),de);he(pzt(),de);he(hzt(),de);he(yzt(),de);he(_zt(),de);he(wzt(),de);he(Czt(),de);he(Ozt(),de);he(Ezt(),de);he(Mzt(),de);he(Rzt(),de);he(Azt(),de);he(Nzt(),de);he(Dzt(),de);he(Lzt(),de);he(kzt(),de);he(Bzt(),de);he(Uzt(),de);he(zzt(),de);he(Vzt(),de);he(Kzt(),de);he(Gzt(),de);he(Xzt(),de);he(Qzt(),de);he(t4t(),de);he(n4t(),de);he(i4t(),de);he(s4t(),de);he(l4t(),de);he(c4t(),de);he(f4t(),de);he(m4t(),de);he(g4t(),de);he(y4t(),de);he(_4t(),de);he(w4t(),de);he(C4t(),de);he(O4t(),de);he(E4t(),de);he(M4t(),de);he(R4t(),de);he(I4t(),de);he(j4t(),de)});var wbe=S(Dte=>{"use strict";Object.defineProperty(Dte,"__esModule",{value:!0});Dte.toJson=void 0;Dte.fromJson=oSn;var nSn=(t,e,r)=>JSON.stringify(t,e,r);Dte.toJson=nSn;function oSn(t,e){return JSON.parse(t,e)}});var $4t=S(Sbe=>{"use strict";Object.defineProperty(Sbe,"__esModule",{value:!0});Sbe.CohereError=void 0;var iSn=wbe(),e3e=class t extends Error{constructor({message:e,statusCode:r,body:n,rawResponse:o}){super(aSn({message:e,statusCode:r,body:n})),Object.setPrototypeOf(this,t.prototype),this.statusCode=r,this.body=n,this.rawResponse=o}};Sbe.CohereError=e3e;function aSn({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,iSn.toJson)(r,void 0,2)}`),n.join(`
|
||
`)}});var L4t=S(Cbe=>{"use strict";Object.defineProperty(Cbe,"__esModule",{value:!0});Cbe.CohereTimeoutError=void 0;var t3e=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}};Cbe.CohereTimeoutError=t3e});var Pc=S(UK=>{"use strict";Object.defineProperty(UK,"__esModule",{value:!0});UK.CohereTimeoutError=UK.CohereError=void 0;var sSn=$4t();Object.defineProperty(UK,"CohereError",{enumerable:!0,get:function(){return sSn.CohereError}});var uSn=L4t();Object.defineProperty(UK,"CohereTimeoutError",{enumerable:!0,get:function(){return uSn.CohereTimeoutError}})});var F4t=S(zO=>{"use strict";var lSn=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]}),cSn=zO&&zO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dSn=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"&&lSn(r,e,n[o]);return cSn(r,e),r}}();Object.defineProperty(zO,"__esModule",{value:!0});zO.BadRequestError=void 0;var fSn=dSn(Pc()),r3e=class t extends fSn.CohereError{constructor(e,r){super({message:"BadRequestError",statusCode:400,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};zO.BadRequestError=r3e});var k4t=S(HO=>{"use strict";var pSn=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]}),mSn=HO&&HO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hSn=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"&&pSn(r,e,n[o]);return mSn(r,e),r}}();Object.defineProperty(HO,"__esModule",{value:!0});HO.UnauthorizedError=void 0;var gSn=hSn(Pc()),n3e=class t extends gSn.CohereError{constructor(e,r){super({message:"UnauthorizedError",statusCode:401,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};HO.UnauthorizedError=n3e});var q4t=S(VO=>{"use strict";var ySn=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]}),bSn=VO&&VO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Sn=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"&&ySn(r,e,n[o]);return bSn(r,e),r}}();Object.defineProperty(VO,"__esModule",{value:!0});VO.ForbiddenError=void 0;var vSn=_Sn(Pc()),o3e=class t extends vSn.CohereError{constructor(e,r){super({message:"ForbiddenError",statusCode:403,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};VO.ForbiddenError=o3e});var B4t=S(JO=>{"use strict";var wSn=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]}),SSn=JO&&JO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CSn=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"&&wSn(r,e,n[o]);return SSn(r,e),r}}();Object.defineProperty(JO,"__esModule",{value:!0});JO.NotFoundError=void 0;var xSn=CSn(Pc()),i3e=class t extends xSn.CohereError{constructor(e,r){super({message:"NotFoundError",statusCode:404,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};JO.NotFoundError=i3e});var U4t=S(KO=>{"use strict";var OSn=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]}),TSn=KO&&KO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ESn=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"&&OSn(r,e,n[o]);return TSn(r,e),r}}();Object.defineProperty(KO,"__esModule",{value:!0});KO.UnprocessableEntityError=void 0;var PSn=ESn(Pc()),a3e=class t extends PSn.CohereError{constructor(e,r){super({message:"UnprocessableEntityError",statusCode:422,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};KO.UnprocessableEntityError=a3e});var z4t=S(WO=>{"use strict";var MSn=WO&&WO.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RSn=WO&&WO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ASn=WO&&WO.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&MSn(r,e,n[o]);return RSn(r,e),r}}();Object.defineProperty(WO,"__esModule",{value:!0});WO.TooManyRequestsError=void 0;var ISn=ASn(Pc()),s3e=class t extends ISn.CohereError{constructor(e,r){super({message:"TooManyRequestsError",statusCode:429,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};WO.TooManyRequestsError=s3e});var H4t=S(GO=>{"use strict";var NSn=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]}),jSn=GO&&GO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DSn=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"&&NSn(r,e,n[o]);return jSn(r,e),r}}();Object.defineProperty(GO,"__esModule",{value:!0});GO.InvalidTokenError=void 0;var $Sn=DSn(Pc()),u3e=class t extends $Sn.CohereError{constructor(e,r){super({message:"InvalidTokenError",statusCode:498,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};GO.InvalidTokenError=u3e});var V4t=S(ZO=>{"use strict";var LSn=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]}),FSn=ZO&&ZO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kSn=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"&&LSn(r,e,n[o]);return FSn(r,e),r}}();Object.defineProperty(ZO,"__esModule",{value:!0});ZO.ClientClosedRequestError=void 0;var qSn=kSn(Pc()),l3e=class t extends qSn.CohereError{constructor(e,r){super({message:"ClientClosedRequestError",statusCode:499,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};ZO.ClientClosedRequestError=l3e});var J4t=S(XO=>{"use strict";var BSn=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]}),USn=XO&&XO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zSn=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"&&BSn(r,e,n[o]);return USn(r,e),r}}();Object.defineProperty(XO,"__esModule",{value:!0});XO.InternalServerError=void 0;var HSn=zSn(Pc()),c3e=class t extends HSn.CohereError{constructor(e,r){super({message:"InternalServerError",statusCode:500,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};XO.InternalServerError=c3e});var K4t=S(YO=>{"use strict";var VSn=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]}),JSn=YO&&YO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KSn=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"&&VSn(r,e,n[o]);return JSn(r,e),r}}();Object.defineProperty(YO,"__esModule",{value:!0});YO.NotImplementedError=void 0;var WSn=KSn(Pc()),d3e=class t extends WSn.CohereError{constructor(e,r){super({message:"NotImplementedError",statusCode:501,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};YO.NotImplementedError=d3e});var W4t=S(QO=>{"use strict";var GSn=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]}),ZSn=QO&&QO.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XSn=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"&&GSn(r,e,n[o]);return ZSn(r,e),r}}();Object.defineProperty(QO,"__esModule",{value:!0});QO.ServiceUnavailableError=void 0;var YSn=XSn(Pc()),f3e=class t extends YSn.CohereError{constructor(e,r){super({message:"ServiceUnavailableError",statusCode:503,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};QO.ServiceUnavailableError=f3e});var G4t=S(eT=>{"use strict";var QSn=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]}),e0n=eT&&eT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t0n=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"&&QSn(r,e,n[o]);return e0n(r,e),r}}();Object.defineProperty(eT,"__esModule",{value:!0});eT.GatewayTimeoutError=void 0;var r0n=t0n(Pc()),p3e=class t extends r0n.CohereError{constructor(e,r){super({message:"GatewayTimeoutError",statusCode:504,body:e,rawResponse:r}),Object.setPrototypeOf(this,t.prototype)}};eT.GatewayTimeoutError=p3e});var Z4t=S(lh=>{"use strict";var n0n=lh&&lh.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lS=lh&&lh.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&n0n(e,t,r)};Object.defineProperty(lh,"__esModule",{value:!0});lS(F4t(),lh);lS(k4t(),lh);lS(q4t(),lh);lS(B4t(),lh);lS(U4t(),lh);lS(z4t(),lh);lS(H4t(),lh);lS(V4t(),lh);lS(J4t(),lh);lS(K4t(),lh);lS(W4t(),lh);lS(G4t(),lh)});var Y4t=S(X4t=>{"use strict";Object.defineProperty(X4t,"__esModule",{value:!0})});var Q4t=S(S4=>{"use strict";var o0n=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]}),i0n=S4&&S4.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&o0n(e,t,r)};Object.defineProperty(S4,"__esModule",{value:!0});i0n(Y4t(),S4)});var QN=S(tT=>{"use strict";var a0n=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]}),xbe=tT&&tT.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&a0n(e,t,r)};Object.defineProperty(tT,"__esModule",{value:!0});xbe(oFt(),tT);xbe(D4t(),tT);xbe(Z4t(),tT);xbe(Q4t(),tT)});var g3e={};Xn(g3e,{__addDisposableResource:()=>v2t,__assign:()=>Obe,__asyncDelegator:()=>f2t,__asyncGenerator:()=>d2t,__asyncValues:()=>p2t,__await:()=>zK,__awaiter:()=>i2t,__classPrivateFieldGet:()=>y2t,__classPrivateFieldIn:()=>_2t,__classPrivateFieldSet:()=>b2t,__createBinding:()=>Ebe,__decorate:()=>r2t,__disposeResources:()=>w2t,__esDecorate:()=>s0n,__exportStar:()=>s2t,__extends:()=>e2t,__generator:()=>a2t,__importDefault:()=>g2t,__importStar:()=>h2t,__makeTemplateObject:()=>m2t,__metadata:()=>o2t,__param:()=>n2t,__propKey:()=>l0n,__read:()=>h3e,__rest:()=>t2t,__runInitializers:()=>u0n,__setFunctionName:()=>c0n,__spread:()=>u2t,__spreadArray:()=>c2t,__spreadArrays:()=>l2t,__values:()=>Tbe,default:()=>p0n});function e2t(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");m3e(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function t2t(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 r2t(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 n2t(t,e){return function(r,n){e(r,n,t)}}function s0n(t,e,r,n,o,i){function a(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}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(y){if(f)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(y||null))};var g=(0,r[p])(s==="accessor"?{get:c.get,set:c.set}:c[u],m);if(s==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(d=a(g.get))&&(c.get=d),(d=a(g.set))&&(c.set=d),(d=a(g.init))&&o.unshift(d)}else(d=a(g))&&(s==="field"?o.unshift(d):c[u]=d)}l&&Object.defineProperty(l,n.name,c),f=!0}function u0n(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 l0n(t){return typeof t=="symbol"?t:"".concat(t)}function c0n(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 o2t(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function i2t(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 a2t(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 s2t(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ebe(e,t,r)}function Tbe(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 h3e(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 u2t(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(h3e(arguments[e]));return t}function l2t(){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 c2t(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 zK(t){return this instanceof zK?(this.v=t,this):new zK(t)}function d2t(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(g,y){i.push([p,h,g,y])>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 zK?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 f2t(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:zK(t[o](a)),done:!1}:i?i(a):a}:i}}function p2t(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 Tbe=="function"?Tbe(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 m2t(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function h2t(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ebe(e,t,r);return d0n(e,t),e}function g2t(t){return t&&t.__esModule?t:{default:t}}function y2t(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 b2t(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 _2t(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 v2t(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 w2t(t){function e(i){t.error=t.hasError?new f0n(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 m3e,Obe,Ebe,d0n,f0n,p0n,y3e=v(()=>{m3e=function(t,e){return m3e=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])},m3e(t,e)};Obe=function(){return Obe=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},Obe.apply(this,arguments)};Ebe=Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};f0n=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};p0n={__extends:e2t,__assign:Obe,__rest:t2t,__decorate:r2t,__param:n2t,__metadata:o2t,__awaiter:i2t,__generator:a2t,__createBinding:Ebe,__exportStar:s2t,__values:Tbe,__read:h3e,__spread:u2t,__spreadArrays:l2t,__spreadArray:c2t,__await:zK,__asyncGenerator:d2t,__asyncDelegator:f2t,__asyncValues:p2t,__makeTemplateObject:m2t,__importStar:h2t,__importDefault:g2t,__classPrivateFieldGet:y2t,__classPrivateFieldSet:b2t,__classPrivateFieldIn:_2t,__addDisposableResource:v2t,__disposeResources:w2t}});var b3e=S(cS=>{"use strict";Object.defineProperty(cS,"__esModule",{value:!0});cS.MAX_HASHABLE_LENGTH=cS.INIT=cS.KEY=cS.DIGEST_LENGTH=cS.BLOCK_SIZE=void 0;cS.BLOCK_SIZE=64;cS.DIGEST_LENGTH=32;cS.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]);cS.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];cS.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1});var S2t=S(Pbe=>{"use strict";Object.defineProperty(Pbe,"__esModule",{value:!0});Pbe.RawSha256=void 0;var dS=b3e(),m0n=function(){function t(){this.state=Int32Array.from(dS.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>dS.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===dS.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%dS.BLOCK_SIZE>=dS.BLOCK_SIZE-8){for(var o=this.bufferLength;o<dS.BLOCK_SIZE;o++)r.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(var o=this.bufferLength;o<dS.BLOCK_SIZE-8;o++)r.setUint8(o,0);r.setUint32(dS.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),r.setUint32(dS.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(dS.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<dS.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 g=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&l^~u&c)|0)+(d+(dS.KEY[f]+this.temp[f]|0)|0)|0,y=((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+g|0,s=a,a=i,i=o,o=g+y|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}();Pbe.RawSha256=m0n});var O2t=S((Vzi,x2t)=>{var Mbe=Object.defineProperty,h0n=Object.getOwnPropertyDescriptor,g0n=Object.getOwnPropertyNames,y0n=Object.prototype.hasOwnProperty,b0n=(t,e)=>Mbe(t,"name",{value:e,configurable:!0}),_0n=(t,e)=>{for(var r in e)Mbe(t,r,{get:e[r],enumerable:!0})},v0n=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of g0n(e))!y0n.call(t,o)&&o!==r&&Mbe(t,o,{get:()=>e[o],enumerable:!(n=h0n(e,o))||n.enumerable});return t},w0n=t=>v0n(Mbe({},"__esModule",{value:!0}),t),C2t={};_0n(C2t,{isArrayBuffer:()=>S0n});x2t.exports=w0n(C2t);var S0n=b0n(t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]","isArrayBuffer")});var M2t=S((Jzi,P2t)=>{var Rbe=Object.defineProperty,C0n=Object.getOwnPropertyDescriptor,x0n=Object.getOwnPropertyNames,O0n=Object.prototype.hasOwnProperty,T2t=(t,e)=>Rbe(t,"name",{value:e,configurable:!0}),T0n=(t,e)=>{for(var r in e)Rbe(t,r,{get:e[r],enumerable:!0})},E0n=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of x0n(e))!O0n.call(t,o)&&o!==r&&Rbe(t,o,{get:()=>e[o],enumerable:!(n=C0n(e,o))||n.enumerable});return t},P0n=t=>E0n(Rbe({},"__esModule",{value:!0}),t),E2t={};T0n(E2t,{fromArrayBuffer:()=>R0n,fromString:()=>A0n});P2t.exports=P0n(E2t);var M0n=O2t(),_3e=eS(),R0n=T2t((t,e=0,r=t.byteLength-e)=>{if(!(0,M0n.isArrayBuffer)(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return _3e.Buffer.from(t,e,r)},"fromArrayBuffer"),A0n=T2t((t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?_3e.Buffer.from(t,e):_3e.Buffer.from(t)},"fromString")});var j2t=S((Kzi,N2t)=>{var Abe=Object.defineProperty,I0n=Object.getOwnPropertyDescriptor,N0n=Object.getOwnPropertyNames,j0n=Object.prototype.hasOwnProperty,v3e=(t,e)=>Abe(t,"name",{value:e,configurable:!0}),D0n=(t,e)=>{for(var r in e)Abe(t,r,{get:e[r],enumerable:!0})},$0n=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of N0n(e))!j0n.call(t,o)&&o!==r&&Abe(t,o,{get:()=>e[o],enumerable:!(n=I0n(e,o))||n.enumerable});return t},L0n=t=>$0n(Abe({},"__esModule",{value:!0}),t),R2t={};D0n(R2t,{fromUtf8:()=>I2t,toUint8Array:()=>F0n,toUtf8:()=>k0n});N2t.exports=L0n(R2t);var A2t=M2t(),I2t=v3e(t=>{let e=(0,A2t.fromString)(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},"fromUtf8"),F0n=v3e(t=>typeof t=="string"?I2t(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),"toUint8Array"),k0n=v3e(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,A2t.fromArrayBuffer)(t.buffer,t.byteOffset,t.byteLength).toString("utf8")},"toUtf8")});var D2t=S(Ibe=>{"use strict";Object.defineProperty(Ibe,"__esModule",{value:!0});Ibe.convertToBuffer=void 0;var q0n=j2t(),B0n=typeof Buffer<"u"&&Buffer.from?function(t){return Buffer.from(t,"utf8")}:q0n.fromUtf8;function U0n(t){return t instanceof Uint8Array?t:typeof t=="string"?B0n(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)}Ibe.convertToBuffer=U0n});var $2t=S(Nbe=>{"use strict";Object.defineProperty(Nbe,"__esModule",{value:!0});Nbe.isEmptyData=void 0;function z0n(t){return typeof t=="string"?t.length===0:t.byteLength===0}Nbe.isEmptyData=z0n});var L2t=S(jbe=>{"use strict";Object.defineProperty(jbe,"__esModule",{value:!0});jbe.numToUint8=void 0;function H0n(t){return new Uint8Array([(t&4278190080)>>24,(t&16711680)>>16,(t&65280)>>8,t&255])}jbe.numToUint8=H0n});var F2t=S(Dbe=>{"use strict";Object.defineProperty(Dbe,"__esModule",{value:!0});Dbe.uint32ArrayFrom=void 0;function V0n(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)}Dbe.uint32ArrayFrom=V0n});var $be=S(rT=>{"use strict";Object.defineProperty(rT,"__esModule",{value:!0});rT.uint32ArrayFrom=rT.numToUint8=rT.isEmptyData=rT.convertToBuffer=void 0;var J0n=D2t();Object.defineProperty(rT,"convertToBuffer",{enumerable:!0,get:function(){return J0n.convertToBuffer}});var K0n=$2t();Object.defineProperty(rT,"isEmptyData",{enumerable:!0,get:function(){return K0n.isEmptyData}});var W0n=L2t();Object.defineProperty(rT,"numToUint8",{enumerable:!0,get:function(){return W0n.numToUint8}});var G0n=F2t();Object.defineProperty(rT,"uint32ArrayFrom",{enumerable:!0,get:function(){return G0n.uint32ArrayFrom}})});var q2t=S(kbe=>{"use strict";Object.defineProperty(kbe,"__esModule",{value:!0});kbe.Sha256=void 0;var k2t=(y3e(),Nfe(g3e)),Fbe=b3e(),Lbe=S2t(),w3e=$be(),Z0n=function(){function t(e){this.secret=e,this.hash=new Lbe.RawSha256,this.reset()}return t.prototype.update=function(e){if(!((0,w3e.isEmptyData)(e)||this.error))try{this.hash.update((0,w3e.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 k2t.__awaiter(this,void 0,void 0,function(){return k2t.__generator(this,function(e){return[2,this.digestSync()]})})},t.prototype.reset=function(){if(this.hash=new Lbe.RawSha256,this.secret){this.outer=new Lbe.RawSha256;var e=X0n(this.secret),r=new Uint8Array(Fbe.BLOCK_SIZE);r.set(e);for(var n=0;n<Fbe.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}();kbe.Sha256=Z0n;function X0n(t){var e=(0,w3e.convertToBuffer)(t);if(e.byteLength>Fbe.BLOCK_SIZE){var r=new Lbe.RawSha256;r.update(e),e=r.digest()}var n=new Uint8Array(Fbe.BLOCK_SIZE);return n.set(e),n}});var C3e=S(S3e=>{"use strict";Object.defineProperty(S3e,"__esModule",{value:!0});var Y0n=(y3e(),Nfe(g3e));Y0n.__exportStar(q2t(),S3e)});var B2t=v(()=>{});var U2t=v(()=>{});var z2t=v(()=>{});var C4,$te=v(()=>{C4=class t extends Error{constructor(e,r=!0){let n,o=!0;typeof r=="boolean"?(n=void 0,o=r):r!=null&&typeof r=="object"&&(n=r.logger,o=r.tryNextLink??!0),super(e),this.name="ProviderError",this.tryNextLink=o,Object.setPrototypeOf(this,t.prototype),n?.debug?.(`@smithy/property-provider ${o?"->":"(!)"} ${e}`)}static from(e,r=!0){return Object.assign(new this(e.message,r),e)}}});var Cm,H2t=v(()=>{$te();Cm=class t extends C4{constructor(e,r=!0){super(e,r),this.name="CredentialsProviderError",Object.setPrototypeOf(this,t.prototype)}}});var V2t=v(()=>{$te()});var J2t=v(()=>{$te()});var K2t=v(()=>{});var W2t,G2t=v(()=>{W2t=(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 e1=v(()=>{H2t();$te();V2t();J2t();K2t();G2t()});function qbe(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 x3e=v(()=>{});var Z2t=v(()=>{});var X2t=v(()=>{Z2t()});var Y2t=v(()=>{});var Q2t,eHt=v(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(Q2t||(Q2t={}))});var O3e,tHt=v(()=>{(function(t){t.HEADER="header",t.QUERY="query"})(O3e||(O3e={}))});var rHt=v(()=>{});var nHt=v(()=>{});var oHt=v(()=>{});var iHt=v(()=>{});var aHt=v(()=>{eHt();tHt();rHt();nHt();oHt();iHt()});var sHt=v(()=>{});var uHt=v(()=>{});var lHt=v(()=>{});var cHt=v(()=>{});var dHt=v(()=>{});var fHt=v(()=>{});var pHt=v(()=>{});var mHt=v(()=>{dHt();fHt();pHt()});var hHt=v(()=>{});var gHt=v(()=>{});var HK,yHt=v(()=>{(function(t){t.HTTP="http",t.HTTPS="https"})(HK||(HK={}))});var bHt=v(()=>{});var _Ht=v(()=>{});var vHt=v(()=>{});var wHt=v(()=>{});var SHt=v(()=>{});var CHt=v(()=>{bHt();_Ht();vHt();wHt();SHt()});var xHt=v(()=>{});var VK,T3e=v(()=>{(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(VK||(VK={}))});var OHt=v(()=>{T3e()});var THt=v(()=>{});var EHt=v(()=>{OHt();THt();T3e()});var Fv,PHt=v(()=>{(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(Fv||(Fv={}))});var MHt=v(()=>{});var RHt=v(()=>{});var AHt=v(()=>{});var IHt=v(()=>{});var NHt=v(()=>{});var jHt=v(()=>{RHt();AHt();IHt();NHt()});var DHt=v(()=>{});var JK,$Ht=v(()=>{JK="__smithy_context"});var LHt=v(()=>{});var FHt,kHt=v(()=>{(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(FHt||(FHt={}))});var qHt=v(()=>{});var BHt=v(()=>{});var UHt=v(()=>{});var zHt=v(()=>{});var HHt=v(()=>{});var VHt=v(()=>{});var JHt=v(()=>{});var KHt=v(()=>{});var WHt=v(()=>{});var GHt,ZHt=v(()=>{(function(t){t.HTTP_0_9="http/0.9",t.HTTP_1_0="http/1.0",t.TDS_8_0="tds/8.0"})(GHt||(GHt={}))});var XHt=v(()=>{});var YHt=v(()=>{});var QHt=v(()=>{});var eVt=v(()=>{});var tVt=v(()=>{});var rVt=v(()=>{});var bd=v(()=>{Y2t();aHt();sHt();uHt();lHt();cHt();mHt();hHt();gHt();yHt();CHt();xHt();EHt();PHt();MHt();jHt();DHt();$Ht();LHt();kHt();qHt();BHt();UHt();zHt();HHt();VHt();JHt();KHt();WHt();ZHt();XHt();YHt();QHt();eVt();tVt();rVt()});var nVt=v(()=>{bd()});var oVt=v(()=>{});var iVt=v(()=>{});function Q0n(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Bbe,aVt=v(()=>{Bbe=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=Q0n(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 sVt=v(()=>{});var uVt=v(()=>{});var lVt=v(()=>{});var cVt=v(()=>{X2t();nVt();oVt();iVt();aVt();sVt();uVt();lVt()});var eCn,tCn,Ube,E3e=v(()=>{cVt();eCn=t=>e=>async r=>{if(!Bbe.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)},tCn={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Ube=t=>({applyToStack:e=>{e.add(eCn(t),tCn)}})});var rCn,nCn,zbe,dVt=v(()=>{rCn=()=>(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}},nCn={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},zbe=t=>({applyToStack:e=>{e.add(rCn(),nCn)}})});var P3e=v(()=>{dVt()});var fVt=v(()=>{});var pVt=v(()=>{fVt()});var mVt=v(()=>{bd()});var hVt=v(()=>{});var gVt=v(()=>{});function oCn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Hbe,yVt=v(()=>{Hbe=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=oCn(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 bVt=v(()=>{});var _Vt=v(()=>{});var vVt=v(()=>{});var wVt=v(()=>{pVt();mVt();hVt();gVt();yVt();bVt();_Vt();vVt()});var SVt,iCn,aCn,sCn,uCn,Vbe,M3e=v(()=>{wVt();SVt="X-Amzn-Trace-Id",iCn="AWS_LAMBDA_FUNCTION_NAME",aCn="_X_AMZN_TRACE_ID",sCn=t=>e=>async r=>{let{request:n}=r;if(!Hbe.isInstance(n)||t.runtime!=="node"||n.headers.hasOwnProperty(SVt))return e(r);let o=process.env[iCn],i=process.env[aCn],a=s=>typeof s=="string"&&s.length>0;return a(o)&&a(i)&&(n.headers[SVt]=i),e({...r,request:n})},uCn={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},Vbe=t=>({applyToStack:e=>{e.add(sCn(t),uCn)}})});function Jbe(t){return{...t,customUserAgent:typeof t.customUserAgent=="string"?[[t.customUserAgent]]:t.customUserAgent}}var CVt=v(()=>{});var lCn,Lte,R3e=v(()=>{lCn=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}$"),Lte=t=>lCn.test(t)||t.startsWith("[")&&t.endsWith("]")});var cCn,Fte,A3e=v(()=>{cCn=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Fte=(t,e=!1)=>{if(!e)return cCn.test(t);let r=t.split(".");for(let n of r)if(!Fte(n))return!1;return!0}});var t1,Kbe=v(()=>{t1={}});var r1,xVt=v(()=>{r1="endpoints"});function fS(t){return typeof t!="object"||t==null?t:"ref"in t?`$${fS(t.ref)}`:"fn"in t?`${t.fn}(${(t.argv||[]).map(fS).join(", ")})`:JSON.stringify(t,null,2)}var OVt=v(()=>{});var kte=v(()=>{xVt();OVt()});var zu,TVt=v(()=>{zu=class extends Error{constructor(e){super(e),this.name="EndpointError"}}});var EVt=v(()=>{});var PVt=v(()=>{});var MVt=v(()=>{});var RVt=v(()=>{});var AVt=v(()=>{});var IVt=v(()=>{});var pS=v(()=>{TVt();EVt();PVt();MVt();RVt();AVt();IVt()});var NVt,jVt=v(()=>{NVt=(t,e)=>t===e});var DVt,$Vt=v(()=>{pS();DVt=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 zu(`Path: '${t}' does not end with ']'`);let i=n.slice(o+1,-1);if(Number.isNaN(parseInt(i)))throw new zu(`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 Wbe,LVt=v(()=>{pS();$Vt();Wbe=(t,e)=>DVt(e).reduce((r,n)=>{if(typeof r!="object")throw new zu(`Index '${n}' in '${e}' not found in '${JSON.stringify(t)}'`);return Array.isArray(r)?r[parseInt(n)]:r[n]},t)});var FVt,kVt=v(()=>{FVt=t=>t!=null});var qVt,BVt=v(()=>{qVt=t=>!t});var I3e,UVt,zVt=v(()=>{bd();R3e();I3e={[HK.HTTP]:80,[HK.HTTPS]:443},UVt=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:g={}}=t,y=new URL(`${m}//${f}${p?`:${p}`:""}${h}`);return y.search=Object.entries(g).map(([b,_])=>`${b}=${_}`).join("&"),y}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(HK).includes(u))return null;let l=Lte(o),c=r.includes(`${n}:${I3e[u]}`)||typeof t=="string"&&t.includes(`${n}:${I3e[u]}`),d=`${n}${c?`:${I3e[u]}`:""}`;return{scheme:u,authority:d,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:l}}});var HVt,VVt=v(()=>{HVt=(t,e)=>t===e});var JVt,KVt=v(()=>{JVt=(t,e,r,n)=>e>=r||t.length<r?null:n?t.substring(t.length-r,t.length-e):t.substring(e,r)});var WVt,GVt=v(()=>{WVt=t=>encodeURIComponent(t).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var N3e=v(()=>{jVt();LVt();kVt();A3e();BVt();zVt();VVt();KVt();GVt()});var ZVt,XVt=v(()=>{N3e();ZVt={booleanEquals:NVt,getAttr:Wbe,isSet:FVt,isValidHostLabel:Fte,not:qVt,parseURL:UVt,stringEquals:HVt,substring:JVt,uriEncode:WVt}});var Gbe,j3e=v(()=>{N3e();Gbe=(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(Wbe(n[u],l))}else r.push(n[s]);o=a+1}return r.join("")}});var YVt,QVt=v(()=>{YVt=({ref:t},e)=>({...e.endpointParams,...e.referenceRecord})[t]});var iF,qte=v(()=>{pS();D3e();j3e();QVt();iF=(t,e,r)=>{if(typeof t=="string")return Gbe(t,r);if(t.fn)return Zbe(t,r);if(t.ref)return YVt(t,r);throw new zu(`'${e}': ${String(t)} is not a string, function or reference.`)}});var Zbe,D3e=v(()=>{Kbe();XVt();qte();Zbe=({fn:t,argv:e},r)=>{let n=e.map(i=>["boolean","number"].includes(typeof i)?i:iF(i,"arg",r)),o=t.split(".");return o[0]in t1&&o[1]!=null?t1[o[0]][o[1]](...n):ZVt[t](...n)}});var eJt,tJt=v(()=>{kte();pS();D3e();eJt=({assign:t,...e},r)=>{if(t&&t in r.referenceRecord)throw new zu(`'${t}' is already defined in Reference Record.`);let n=Zbe(e,r);return r.logger?.debug?.(`${r1} evaluateCondition: ${fS(e)} = ${fS(n)}`),{result:n===""?!0:!!n,...t!=null&&{toAssign:{name:t,value:n}}}}});var KK,Xbe=v(()=>{kte();tJt();KK=(t=[],e)=>{let r={};for(let n of t){let{result:o,toAssign:i}=eJt(n,{...e,referenceRecord:{...e.referenceRecord,...r}});if(!o)return{result:o};i&&(r[i.name]=i.value,e.logger?.debug?.(`${r1} assign: ${i.name} := ${fS(i.value)}`))}return{result:!0,referenceRecord:r}}});var rJt,nJt=v(()=>{pS();qte();rJt=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:o.map(i=>{let a=iF(i,"Header value entry",e);if(typeof a!="string")throw new zu(`Header '${n}' value '${a}' is not a string`);return a})}),{})});var $3e,oJt=v(()=>{pS();j3e();L3e();$3e=(t,e)=>{if(Array.isArray(t))return t.map(r=>$3e(r,e));switch(typeof t){case"string":return Gbe(t,e);case"object":if(t===null)throw new zu(`Unexpected endpoint property: ${t}`);return Ybe(t,e);case"boolean":return t;default:throw new zu(`Unexpected endpoint property type: ${typeof t}`)}}});var Ybe,L3e=v(()=>{oJt();Ybe=(t,e)=>Object.entries(t).reduce((r,[n,o])=>({...r,[n]:$3e(o,e)}),{})});var iJt,aJt=v(()=>{pS();qte();iJt=(t,e)=>{let r=iF(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 zu(`Endpoint URL must be a string, got ${typeof r}`)}});var sJt,uJt=v(()=>{kte();Xbe();nJt();L3e();aJt();sJt=(t,e)=>{let{conditions:r,endpoint:n}=t,{result:o,referenceRecord:i}=KK(r,e);if(!o)return;let a={...e,referenceRecord:{...e.referenceRecord,...i}},{url:s,properties:u,headers:l}=n;return e.logger?.debug?.(`${r1} Resolving endpoint from template: ${fS(n)}`),{...l!=null&&{headers:rJt(l,a)},...u!=null&&{properties:Ybe(u,a)},url:iJt(s,a)}}});var lJt,cJt=v(()=>{pS();Xbe();qte();lJt=(t,e)=>{let{conditions:r,error:n}=t,{result:o,referenceRecord:i}=KK(r,e);if(o)throw new zu(iF(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...i}}))}});var dJt,fJt=v(()=>{Xbe();F3e();dJt=(t,e)=>{let{conditions:r,rules:n}=t,{result:o,referenceRecord:i}=KK(r,e);if(o)return Qbe(n,{...e,referenceRecord:{...e.referenceRecord,...i}})}});var Qbe,F3e=v(()=>{pS();uJt();cJt();fJt();Qbe=(t,e)=>{for(let r of t)if(r.type==="endpoint"){let n=sJt(r,e);if(n)return n}else if(r.type==="error")lJt(r,e);else if(r.type==="tree"){let n=dJt(r,e);if(n)return n}else throw new zu(`Unknown endpoint rule: ${r}`);throw new zu("Rules evaluation failed")}});var pJt=v(()=>{Kbe();F3e()});var Bte,mJt=v(()=>{kte();pS();pJt();Bte=(t,e)=>{let{endpointParams:r,logger:n}=e,{parameters:o,rules:i}=t;e.logger?.debug?.(`${r1} Initial EndpointParams: ${fS(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 zu(`Missing required parameter: '${l}'`);let u=Qbe(i,{endpointParams:r,logger:n,referenceRecord:{}});if(e.endpointParams?.Endpoint)try{let l=new URL(e.endpointParams.Endpoint),{protocol:c,port:d}=l;u.url.protocol=c,u.url.port=d}catch{}return e.logger?.debug?.(`${r1} Resolved endpoint: ${fS(u)}`),u}});var aF=v(()=>{R3e();A3e();Kbe();mJt();pS()});var k3e=v(()=>{aF()});var q3e,hJt=v(()=>{aF();k3e();q3e=(t,e=!1)=>{if(e){for(let r of t.split("."))if(!q3e(r))return!1;return!0}return!(!Fte(t)||t.length<3||t.length>63||t!==t.toLowerCase()||Lte(t))}});var gJt,dCn,yJt,bJt=v(()=>{gJt=":",dCn="/",yJt=t=>{let e=t.split(gJt);if(e.length<6)return null;let[r,n,o,i,a,...s]=e;if(r!=="arn"||n===""||o===""||s.join(gJt)==="")return null;let u=s.map(l=>l.split(dCn)).flat();return{partition:n,service:o,region:i,accountId:a,resourceId:u}}});var vJt,_Jt=v(()=>{vJt={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"aws-global":{description:"AWS Standard global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"AWS China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"AWS GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],version:"1.1"}});var pCn,mCn,wJt,SJt,B3e=v(()=>{_Jt();pCn=vJt,mCn="",wJt=t=>{let{partitions:e}=pCn;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}},SJt=()=>mCn});var Ute,CJt=v(()=>{aF();hJt();bJt();B3e();Ute={isVirtualHostableS3Bucket:q3e,parseArn:yJt,partition:wJt};t1.aws=Ute});var xJt=v(()=>{aF()});var OJt=v(()=>{aF()});var TJt=v(()=>{});var EJt=v(()=>{});var PJt=v(()=>{});var MJt=v(()=>{});var RJt=v(()=>{});var AJt=v(()=>{OJt();TJt();EJt();PJt();MJt();RJt()});var e_e=v(()=>{CJt();B3e();k3e();xJt();AJt()});var IJt=v(()=>{});var NJt=v(()=>{IJt()});var jJt=v(()=>{bd()});var DJt=v(()=>{});var $Jt=v(()=>{});function hCn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var t_e,LJt=v(()=>{t_e=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=hCn(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 FJt=v(()=>{});var kJt=v(()=>{});var qJt=v(()=>{});var BJt=v(()=>{NJt();jJt();DJt();$Jt();LJt();FJt();kJt();qJt()});var U3e,r_e,z3e,n_e,UJt,zJt,H3e,HJt=v(()=>{U3e="user-agent",r_e="x-amz-user-agent",z3e=" ",n_e="/",UJt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,zJt=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,H3e="-"});var gCn,V3e,yCn,o_e,VJt=v(()=>{e_e();BJt();HJt();gCn=t=>(e,r)=>async n=>{let{request:o}=n;if(!t_e.isInstance(o))return e(n);let{headers:i}=o,a=r?.userAgent?.map(V3e)||[],s=(await t.defaultUserAgentProvider()).map(V3e),u=t?.customUserAgent?.map(V3e)||[],l=SJt(),c=(l?[l]:[]).concat([...s,...a,...u]).join(z3e),d=[...s.filter(f=>f.startsWith("aws-sdk-")),...u].join(z3e);return t.runtime!=="browser"?(d&&(i[r_e]=i[r_e]?`${i[U3e]} ${d}`:d),i[U3e]=c):i[r_e]=c,e({...n,request:o})},V3e=t=>{let e=t[0].split(n_e).map(a=>a.replace(UJt,H3e)).join(n_e),r=t[1]?.replace(zJt,H3e),n=e.indexOf(n_e),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}`}},"")},yCn={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},o_e=t=>({applyToStack:e=>{e.add(gCn(t),yCn)}})});var J3e=v(()=>{CVt();VJt()});var JJt=v(()=>{});var KJt=v(()=>{});var i_e,WJt=v(()=>{(function(t){t.ENV="env",t.CONFIG="shared config entry"})(i_e||(i_e={}))});var K3e=v(()=>{JJt();KJt();WJt()});var a_e,GJt=v(()=>{K3e();a_e=!1});var s_e,ZJt=v(()=>{K3e();s_e=!1});var nT,XJt=v(()=>{bd();nT=t=>t[JK]||(t[JK]={})});var dy,YJt=v(()=>{dy=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var pC=v(()=>{XJt();YJt()});var QJt=v(()=>{pC()});var e3t=v(()=>{});var t3t=v(()=>{pC();e3t()});var r3t=v(()=>{GJt();ZJt();QJt();t3t()});var n3t=v(()=>{});var u_e,W3e=v(()=>{u_e=t=>typeof t=="string"&&(t.startsWith("fips-")||t.endsWith("-fips"))});var G3e,o3t=v(()=>{W3e();G3e=t=>u_e(t)?["fips-aws-global","aws-fips"].includes(t)?"us-east-1":t.replace(/fips-(dkr-|prod-)?|-fips/,""):t});var l_e,i3t=v(()=>{o3t();W3e();l_e=t=>{let{region:e,useFipsEndpoint:r}=t;if(!e)throw new Error("Region is missing");return{...t,region:async()=>{if(typeof e=="string")return G3e(e);let n=await e();return G3e(n)},useFipsEndpoint:async()=>{let n=typeof e=="string"?e:await e();return u_e(n)?!0:typeof r!="function"?Promise.resolve(!!r):r()}}}});var a3t=v(()=>{n3t();i3t()});var s3t=v(()=>{});var u3t=v(()=>{});var l3t=v(()=>{});var c3t=v(()=>{});var d3t=v(()=>{});var f3t=v(()=>{});var p3t=v(()=>{l3t();c3t();d3t();f3t()});var m3t=v(()=>{s3t();u3t();p3t()});var zte=v(()=>{r3t();a3t();m3t()});function _Cn(t){let e=new Map;for(let r of t)e.set(r.schemeId,r);return e}var Z3e,c_e=v(()=>{bd();pC();Z3e=(t,e)=>(r,n)=>async o=>{let i=t.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(t,n,o.input)),a=_Cn(t.httpAuthSchemes),s=nT(n),u=[];for(let l of i){let c=a.get(l.schemeId);if(!c){u.push(`HttpAuthScheme \`${l.schemeId}\` was not enabled for this service.`);continue}let d=c.identityProvider(await e.identityProviderConfigProvider(t));if(!d){u.push(`HttpAuthScheme \`${l.schemeId}\` did not have an IdentityProvider configured.`);continue}let{identityProperties:f={},signingProperties:p={}}=l.propertiesExtractor?.(t,n)||{};l.identityProperties=Object.assign(l.identityProperties||{},f),l.signingProperties=Object.assign(l.signingProperties||{},p),s.selectedHttpAuthScheme={httpAuthOption:l,identity:await d(l.identityProperties),signer:c.signer};break}if(!s.selectedHttpAuthScheme)throw new Error(u.join(`
|
||
`));return r(o)}});var h3t,vCn,wCn,SCn,CCn,xCn,g3t=v(()=>{h3t=async t=>{let e=t?.Bucket||"";if(typeof t.Bucket=="string"&&(t.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),xCn(e)){if(t.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!CCn(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},vCn=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,wCn=/(\d+\.){3}\d+/,SCn=/\.\./,CCn=t=>vCn.test(t)&&!wCn.test(t)&&!SCn.test(t),xCn=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 y3t=v(()=>{g3t()});var b3t,_3t=v(()=>{b3t=(t,e,r)=>{let n=async()=>{let o=r[t]??r[e];return typeof o=="function"?o():o};return t==="credentialScope"||e==="CredentialScope"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.credentialScope??o?.CredentialScope}:t==="accountId"||e==="AccountId"?async()=>{let o=typeof r.credentials=="function"?await r.credentials():r.credentials;return o?.accountId??o?.AccountId}:t==="endpoint"||e==="endpoint"?async()=>{let o=await n();if(o&&typeof o=="object"){if("url"in o)return o.url.href;if("hostname"in o){let{protocol:i,hostname:a,port:s,path:u}=o;return`${i}//${a}${s?":"+s:""}${u}`}}return o}:n}});var v3t,w3t=v(()=>{v3t=async t=>{}});function S3t(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 C3t=v(()=>{});var sF,d_e=v(()=>{C3t();sF=t=>{if(typeof t=="string")return sF(new URL(t));let{hostname:e,pathname:r,port:n,protocol:o,search:i}=t,a;return i&&(a=S3t(i)),{hostname:e,port:n?parseInt(n):void 0,protocol:o,path:r,query:a}}});var f_e,p_e=v(()=>{d_e();f_e=t=>typeof t=="object"?"url"in t?sF(t.url):t:sF(t)});var x3t,OCn,X3e=v(()=>{y3t();_3t();w3t();p_e();x3t=async(t,e,r,n)=>{if(!r.endpoint){let a=await v3t(r.serviceId||"");a&&(r.endpoint=()=>Promise.resolve(f_e(a)))}let o=await OCn(t,e,r);if(typeof r.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return r.endpointProvider(o,n)},OCn=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 b3t(a.name,i,r)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(a))}return Object.keys(o).length===0&&Object.assign(n,r),String(r.serviceId).toLowerCase()==="s3"&&await h3t(n),n}});var O3t=v(()=>{X3e();p_e()});var T3t,Y3e=v(()=>{pC();X3e();T3t=({config:t,instructions:e})=>(r,n)=>async o=>{let i=await x3t(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=nT(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 E3t,Q3e=v(()=>{E3t=(t,e)=>r=>async n=>{let{response:o}=await r(n);try{let i=await e(o,t);return{response:o,output:i}}catch(i){if(Object.defineProperty(i,"$response",{value:o}),!("$metadata"in i)){let a="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";i.message+=`
|
||
`+a,typeof i.$responseBodyText<"u"&&i.$response&&(i.$response.body=i.$responseBodyText)}throw i}}});var P3t,e6e=v(()=>{P3t=(t,e)=>(r,n)=>async o=>{let i=n.endpointV2?.url&&t.urlParser?async()=>t.urlParser(n.endpointV2.url):t.endpoint;if(!i)throw new Error("No valid endpoint provider available.");let a=await e(o.input,{...t,endpoint:i});return r({...o,request:a})}});function Tr(t,e,r){return{applyToStack:n=>{n.add(E3t(t,r),TCn),n.add(P3t(t,e),Hte)}}}var TCn,Hte,M3t=v(()=>{Q3e();e6e();TCn={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},Hte={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0}});var Ki=v(()=>{Q3e();M3t();e6e()});var t6e,Er,R3t=v(()=>{Ki();Y3e();t6e={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:Hte.name},Er=(t,e)=>({applyToStack:r=>{r.addRelativeTo(T3t({config:t,instructions:e}),t6e)}})});var m_e,A3t=v(()=>{pC();p_e();m_e=t=>{let e=t.tls??!0,{endpoint:r}=t,n=r!=null?async()=>f_e(await dy(r)()):void 0;return{...t,endpoint:n,tls:e,isCustomEndpoint:!!r,useDualstackEndpoint:dy(t.useDualstackEndpoint??!1),useFipsEndpoint:dy(t.useFipsEndpoint??!1)}}});var I3t=v(()=>{});var Li=v(()=>{O3t();Y3e();R3t();A3t();I3t()});var ECn,h_e,N3t=v(()=>{Li();c_e();ECn={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:t6e.name},h_e=(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r})=>({applyToStack:n=>{n.addRelativeTo(Z3e(t,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:r}),ECn)}})});var MKi,j3t=v(()=>{Ki();c_e();MKi={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Hte.name}});var D3t=v(()=>{c_e();N3t();j3t()});var $3t=v(()=>{});var L3t=v(()=>{$3t()});var F3t=v(()=>{bd()});var k3t=v(()=>{});var q3t=v(()=>{});function PCn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var x4,B3t=v(()=>{x4=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=PCn(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 U3t=v(()=>{});var z3t=v(()=>{});var H3t=v(()=>{});var Vte=v(()=>{L3t();F3t();k3t();q3t();B3t();U3t();z3t();H3t()});var MCn,RCn,V3t,r6e=v(()=>{Vte();bd();pC();MCn=t=>e=>{throw e},RCn=(t,e)=>{},V3t=t=>(e,r)=>async n=>{if(!x4.isInstance(n.request))return e(n);let i=nT(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||MCn)(a));return(u.successHandler||RCn)(l.response,a),l}});var mC,oT,Jte,g_e=v(()=>{(function(t){t.STANDARD="standard",t.ADAPTIVE="adaptive"})(mC||(mC={}));oT=3,Jte=mC.STANDARD});var J3t,K3t,W3t,G3t,Z3t=v(()=>{J3t=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],K3t=["TimeoutError","RequestTimeout","RequestTimeoutException"],W3t=[500,502,503,504],G3t=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"]});var ACn,WK,y_e,X3t,Kte=v(()=>{Z3t();ACn=t=>t.$metadata?.clockSkewCorrected,WK=t=>t.$metadata?.httpStatusCode===429||J3t.includes(t.name)||t.$retryable?.throttling==!0,y_e=t=>ACn(t)||K3t.includes(t.name)||G3t.includes(t?.code||"")||W3t.includes(t.$metadata?.httpStatusCode||0),X3t=t=>{if(t.$metadata?.httpStatusCode!==void 0){let e=t.$metadata.httpStatusCode;return 500<=e&&e<=599&&!y_e(t)}return!1}});var Wte,n6e=v(()=>{Kte();Wte=class{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;let r=this.getCurrentTimeInSeconds();this.lastThrottleTime=r,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){let r=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise(n=>setTimeout(n,r))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){let e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}let r=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+r),this.lastTimestamp=e}updateClientSendingRate(e){let r;if(this.updateMeasuredRate(),WK(e)){let o=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=o,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(o),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());let n=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){let e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){let n=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(n*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}}});var b_e,__e,GK=v(()=>{b_e="amz-sdk-invocation-id",__e="amz-sdk-request"});var Y3t,Q3t=v(()=>{GK();Y3t=()=>{let t=100;return{computeNextBackoffDelay:n=>Math.floor(Math.min(2e4,Math.random()*2**n*t)),setDelayBase:n=>{t=n}}}});var o6e,e6t=v(()=>{GK();o6e=({retryDelay:t,retryCount:e,retryCost:r})=>({getRetryCount:()=>e,getRetryDelay:()=>Math.min(2e4,t),getRetryCost:()=>r})});var O4,w_e=v(()=>{g_e();GK();Q3t();e6t();O4=class{constructor(e){this.maxAttempts=e,this.mode=mC.STANDARD,this.capacity=500,this.retryBackoffStrategy=Y3t(),this.maxAttemptsProvider=typeof e=="function"?e:async()=>e}async acquireInitialRetryToken(e){return o6e({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,o6e({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 ${oT}`),oT}}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 S_e,i6t=v(()=>{g_e();n6e();w_e();S_e=class{constructor(e,r){this.maxAttemptsProvider=e,this.mode=mC.ADAPTIVE;let{rateLimiter:n}=r??{};this.rateLimiter=n??new Wte,this.standardRetryStrategy=new O4(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 a6t=v(()=>{GK();w_e()});var s6t=v(()=>{});var iT=v(()=>{i6t();a6t();n6e();w_e();g_e();GK();s6t()});var u6t=v(()=>{});var l6t=v(()=>{u6t()});var c6t=v(()=>{bd()});var d6t=v(()=>{});var f6t=v(()=>{});function ICn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var XK,p6t=v(()=>{XK=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=ICn(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 Gte,m6t=v(()=>{Gte=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var h6t=v(()=>{});var g6t=v(()=>{});var C_e=v(()=>{l6t();c6t();d6t();f6t();p6t();m6t();h6t();g6t()});var y6t=v(()=>{iT()});var a6e=v(()=>{iT()});var s6e=v(()=>{Kte()});var u6e,l6e=v(()=>{u6e=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 c6e=v(()=>{C_e();Kte();iT();y6t();a6e();s6e();l6e()});var b6t=v(()=>{iT();c6e()});var x_e,_6t=v(()=>{pC();iT();x_e=t=>{let{retryStrategy:e}=t,r=dy(t.maxAttempts??oT);return{...t,maxAttempts:r,retryStrategy:async()=>e||(await dy(t.retryMode)()===mC.ADAPTIVE?new S_e(r):new O4(r))}}});var v6t=v(()=>{C_e();iT()});var uF,w6t=v(()=>{uF=class{trace(){}debug(){}info(){}warn(){}error(){}}});var T4,lF,YK,S6t,C6t,x6t=v(()=>{T4=(t,e)=>{let r=[];if(t&&r.push(t),e)for(let n of e)r.push(n);return r},lF=(t,e)=>`${t||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,YK=()=>{let t=[],e=[],r=!1,n=new Set,o=d=>d.sort((f,p)=>S6t[p.step]-S6t[f.step]||C6t[p.priority||"normal"]-C6t[f.priority||"normal"]),i=d=>{let f=!1,p=m=>{let h=T4(m.name,m.aliases);if(h.includes(d)){f=!0;for(let g of h)n.delete(g);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 T4(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(g=>{let y={...g,before:[],after:[]};for(let b of T4(y.name,y.aliases))m[b]=y;f.push(y)}),e.forEach(g=>{let y={...g,before:[],after:[]};for(let b of T4(y.name,y.aliases))m[b]=y;p.push(y)}),p.forEach(g=>{if(g.toMiddleware){let y=m[g.toMiddleware];if(y===void 0){if(d)return;throw new Error(`${g.toMiddleware} is not found when adding ${lF(g.name,g.aliases)} middleware ${g.relation} ${g.toMiddleware}`)}g.relation==="after"&&y.after.push(g),g.relation==="before"&&y.before.push(g)}}),o(f).map(u).reduce((g,y)=>(g.push(...y),g),[])},c={add:(d,f={})=>{let{name:p,override:m,aliases:h}=f,g={step:"initialize",priority:"normal",middleware:d,...f},y=T4(p,h);if(y.length>0){if(y.some(b=>n.has(b))){if(!m)throw new Error(`Duplicate middleware name '${lF(p,h)}'`);for(let b of y){let _=t.findIndex(x=>x.name===b||x.aliases?.some(O=>O===b));if(_===-1)continue;let w=t[_];if(w.step!==g.step||g.priority!==w.priority)throw new Error(`"${lF(w.name,w.aliases)}" middleware with ${w.priority} priority in ${w.step} step cannot be overridden by "${lF(p,h)}" middleware with ${g.priority} priority in ${g.step} step.`);t.splice(_,1)}}for(let b of y)n.add(b)}t.push(g)},addRelativeTo:(d,f)=>{let{name:p,override:m,aliases:h}=f,g={middleware:d,...f},y=T4(p,h);if(y.length>0){if(y.some(b=>n.has(b))){if(!m)throw new Error(`Duplicate middleware name '${lF(p,h)}'`);for(let b of y){let _=e.findIndex(x=>x.name===b||x.aliases?.some(O=>O===b));if(_===-1)continue;let w=e[_];if(w.toMiddleware!==g.toMiddleware||w.relation!==g.relation)throw new Error(`"${lF(w.name,w.aliases)}" middleware ${w.relation} "${w.toMiddleware}" middleware cannot be overridden by "${lF(p,h)}" middleware ${g.relation} "${g.toMiddleware}" middleware.`);e.splice(_,1)}}for(let b of y)n.add(b)}e.push(g)},clone:()=>s(YK()),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:g,aliases:y}=m;if(h&&h.includes(d)){let b=T4(g,y);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(YK());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 lF(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},S6t={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},C6t={high:3,normal:2,low:1}});var d6e=v(()=>{x6t()});var E4,O6t=v(()=>{d6e();E4=class{constructor(e){this.middlewareStack=YK(),this.config=e}send(e,r,n){let o=typeof r!="function"?r:void 0,i=typeof r=="function"?r:n,a=e.resolveMiddleware(this.middlewareStack,this.config,o);if(i)a(e).then(s=>i(null,s.output),s=>i(s)).catch(()=>{});else return a(e).then(s=>s.output)}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}});var n1,P4,cF,M4,T6t,f6e=v(()=>{n1={},P4=new Array(64);for(let t=0,e=65,r=90;t+e<=r;t++){let n=String.fromCharCode(t+e);n1[n]=t,P4[t]=n}for(let t=0,e=97,r=122;t+e<=r;t++){let n=String.fromCharCode(t+e),o=t+26;n1[n]=o,P4[o]=n}for(let t=0;t<10;t++){n1[t.toString(10)]=t+52;let e=t.toString(10),r=t+52;n1[e]=r,P4[r]=e}n1["+"]=62;P4[62]="+";n1["/"]=63;P4[63]="/";cF=6,M4=8,T6t=63});var dF,E6t=v(()=>{f6e();dF=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 n1))throw new TypeError(`Invalid character ${t[l]} in base64 string.`);i|=n1[t[l]]<<(c-l)*cF,a+=cF}else i>>=cF;let s=o/4*3;i>>=a%M4;let u=Math.floor(a/M4);for(let l=0;l<u;l++){let c=(u-l-1)*M4;n.setUint8(s+l,(i&255<<c)>>c)}}return new Uint8Array(r)}});var p6e,m6e=v(()=>{p6e=t=>new TextEncoder().encode(t)});var P6t=v(()=>{m6e()});var M6t=v(()=>{});var R6t=v(()=>{m6e();P6t();M6t()});function fF(t){let e;typeof t=="string"?e=p6e(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)*M4,s+=M4;let u=Math.ceil(s/cF);a<<=u*cF-s;for(let l=1;l<=u;l++){let c=(u-l)*cF;o+=P4[(a&T6t<<c)>>c]}o+="==".slice(0,4-u)}return o}var A6t=v(()=>{R6t();f6e()});var QK=v(()=>{E6t();A6t()});var h6e,g6e=v(()=>{h6e=t=>new TextEncoder().encode(t)});var I6t=v(()=>{g6e()});var O_e,N6t=v(()=>{O_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 y6e=v(()=>{g6e();I6t();N6t()});function j6t(t,e="utf-8"){return e==="base64"?fF(t):O_e(t)}function D6t(t,e){return e==="base64"?o1.mutate(dF(t)):o1.mutate(h6e(t))}var $6t=v(()=>{QK();y6e();b6e()});var o1,b6e=v(()=>{$6t();o1=class t extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return D6t(e,r);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,t.prototype),e}transformToString(e="utf-8"){return j6t(this,e)}}});var L6t=v(()=>{});var F6t=v(()=>{});var k6t=v(()=>{F6t()});var q6t=v(()=>{bd()});var B6t=v(()=>{});var U6t=v(()=>{});var z6t=v(()=>{});var Zte,H6t=v(()=>{Zte=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var V6t=v(()=>{});var J6t=v(()=>{});var K6t=v(()=>{k6t();q6t();B6t();U6t();z6t();H6t();V6t();J6t()});var mS,NCn,_6e=v(()=>{mS=t=>encodeURIComponent(t).replace(/[!'()*]/g,NCn),NCn=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`});var W6t=v(()=>{_6e()});var T_e=v(()=>{_6e();W6t()});function G6t(t){let e=[];for(let r of Object.keys(t).sort()){let n=t[r];if(r=mS(r),Array.isArray(n))for(let o=0,i=n.length;o<i;o++)e.push(`${r}=${mS(n[o])}`);else{let o=r;(n||typeof n=="string")&&(o+=`=${mS(n)}`),e.push(o)}}return e.join("&")}var Z6t=v(()=>{T_e()});function X6t(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 Y6t=v(()=>{});var v6e,pF,Q6t=v(()=>{K6t();Z6t();Y6t();v6e={supported:void 0},pF=class t{static create(e){return typeof e?.handle=="function"?e:new t(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(r=>r||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),v6e.supported===void 0&&(v6e.supported=typeof Request<"u"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r}={}){this.config||(this.config=await this.configProvider);let n=this.config.requestTimeout,o=this.config.keepAlive===!0,i=this.config.credentials;if(r?.aborted){let y=new Error("Request aborted");return y.name="AbortError",Promise.reject(y)}let a=e.path,s=G6t(e.query||{});s&&(a+=`?${s}`),e.fragment&&(a+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){let y=e.username??"",b=e.password??"";u=`${y}:${b}@`}let{port:l,method:c}=e,d=`${e.protocol}//${u}${e.hostname}${l?`:${l}`:""}${a}`,f=c==="GET"||c==="HEAD"?void 0:e.body,p={body:f,headers:new Headers(e.headers),method:c,credentials:i};f&&(p.duplex="half"),typeof AbortController<"u"&&(p.signal=r),v6e.supported&&(p.keepalive=o);let m=()=>{},h=new Request(d,p),g=[fetch(h).then(y=>{let b=y.headers,_={};for(let x of b.entries())_[x[0]]=x[1];return y.body!=null?{response:new Zte({headers:_,reason:y.statusText,statusCode:y.status,body:y.body})}:y.blob().then(x=>({response:new Zte({headers:_,reason:y.statusText,statusCode:y.status,body:x})}))}),X6t(n)];return r&&g.push(new Promise((y,b)=>{let _=()=>{let w=new Error("Request aborted");w.name="AbortError",b(w)};if(typeof r.addEventListener=="function"){let w=r;w.addEventListener("abort",_,{once:!0}),m=()=>w.removeEventListener("abort",_)}else r.onabort=_})),Promise.race(g).finally(m)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=r,n))}httpHandlerConfigs(){return this.config??{}}}});async function jCn(t){let e=await $Cn(t),r=dF(e);return new Uint8Array(r)}async function DCn(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 $Cn(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 e5,eKt=v(()=>{QK();e5=t=>typeof Blob=="function"&&t instanceof Blob?jCn(t):DCn(t)});var Xte=v(()=>{Q6t();eKt()});function rKt(t){let e="";for(let r=0;r<t.byteLength;r++)e+=tKt[t[r]];return e}var tKt,LCn,nKt=v(()=>{tKt={},LCn={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),tKt[t]=e,LCn[e]=t}});var w6e,S6e=v(()=>{w6e=t=>typeof ReadableStream=="function"&&(t?.constructor?.name===ReadableStream.name||t instanceof ReadableStream)});var oKt,aKt,iKt,sKt=v(()=>{Xte();QK();nKt();y6e();S6e();oKt="The stream has already been transformed.",aKt=t=>{if(!iKt(t)&&!w6e(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(oKt);return e=!0,await e5(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 fF(i);if(o==="hex")return rKt(i);if(o===void 0||o==="utf8"||o==="utf-8")return O_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(oKt);if(e=!0,iKt(t))return n(t);if(w6e(t))return t;throw new Error(`Cannot transform payload to web stream, got ${t}`)}})},iKt=t=>typeof Blob=="function"&&t instanceof Blob});var uKt=v(()=>{});var lKt=v(()=>{});var C6e=v(()=>{b6e();L6t();sKt();uKt();lKt();S6e()});var mF,cKt=v(()=>{C6e();mF=async(t=new Uint8Array,e)=>{if(t instanceof Uint8Array)return o1.mutate(t);if(!t)return o1.mutate(new Uint8Array);let r=e.streamCollector(t);return o1.mutate(await r)}});var yr,x6e,dKt=v(()=>{d6e();bd();yr=class{constructor(){this.middlewareStack=YK()}static classBuilder(){return new x6e}resolveMiddlewareWithContext(e,r,n,{middlewareFn:o,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,smithyContext:l,additionalContext:c,CommandCtor:d}){for(let g of o.bind(this)(d,e,r,n))this.middlewareStack.use(g);let f=e.concat(this.middlewareStack),{logger:p}=r,m={logger:p,clientName:i,commandName:a,inputFilterSensitiveLog:s,outputFilterSensitiveLog:u,[JK]:{commandInstance:this,...l},...c},{requestHandler:h}=r;return f.resolve(g=>h.handle(g.request,n||{}),m)}},x6e=class{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=e=>e,this._outputFilterSensitiveLog=e=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,n={}){return this._smithyContext={service:e,operation:r,...n},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=n=>n,r=n=>n){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){let e=this,r;return r=class extends yr{static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=n??{},e._init(this)}resolveMiddleware(n,o,i){return this.resolveMiddlewareWithContext(n,o,i,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}});var E_e,fKt=v(()=>{E_e="***SensitiveInformation***"});var P_e,pKt=v(()=>{P_e=(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 R4,FCn,mKt,kCn,hKt,gKt,yKt,O6e,qCn,t5,ti,bKt,_Kt,BCn,Yte,Qte,T6e,vKt,wKt,SKt,E6e=v(()=>{R4=t=>{if(t!=null){if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return String(e)!==String(t)&&SKt.warn(wKt(`Expected number but observed string: ${t}`)),e}if(typeof t=="number")return t;throw new TypeError(`Expected number, got ${typeof t}: ${t}`)}},FCn=Math.ceil(34028234663852886e22),mKt=t=>{let e=R4(t);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>FCn)throw new TypeError(`Expected 32-bit float, got ${t}`);return e},kCn=t=>{if(t!=null){if(Number.isInteger(t)&&!Number.isNaN(t))return t;throw new TypeError(`Expected integer, got ${typeof t}: ${t}`)}},hKt=t=>O6e(t,32),gKt=t=>O6e(t,16),yKt=t=>O6e(t,8),O6e=(t,e)=>{let r=kCn(t);if(r!==void 0&&qCn(r,e)!==r)throw new TypeError(`Expected ${e}-bit integer, got ${t}`);return r},qCn=(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]}},t5=(t,e)=>{if(t==null)throw e?new TypeError(`Expected a non-null value for ${e}`):new TypeError("Expected a non-null value");return t},ti=t=>{if(t!=null){if(typeof t=="string")return t;if(["boolean","number","bigint"].includes(typeof t))return SKt.warn(wKt(`Expected string, got ${typeof t}: ${t}`)),String(t);throw new TypeError(`Expected string, got ${typeof t}: ${t}`)}},bKt=t=>R4(typeof t=="string"?Yte(t):t),_Kt=t=>mKt(typeof t=="string"?Yte(t):t),BCn=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Yte=t=>{let e=t.match(BCn);if(e===null||e[0].length!==t.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(t)},Qte=t=>hKt(typeof t=="string"?Yte(t):t),T6e=t=>gKt(typeof t=="string"?Yte(t):t),vKt=t=>yKt(typeof t=="string"?Yte(t):t),wKt=t=>String(new TypeError(t).stack||t).split(`
|
||
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
|
||
`),SKt={warn:console.warn}});var UCn,zCn,CKt,HCn,xKt,CGi,xGi,OGi,M_e,OKt,TGi,VCn,JCn,KCn,A4,WCn,GCn,P6e,TKt=v(()=>{E6e();UCn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],zCn=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),CKt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=zCn.exec(t);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");let[r,n,o,i,a,s,u,l]=e,c=T6e(P6e(n)),d=A4(o,"month",1,12),f=A4(i,"day",1,31);return OKt(c,d,f,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l})},HCn=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),xKt=t=>{if(t==null)return;if(typeof t!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let e=HCn.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=T6e(P6e(n)),f=A4(o,"month",1,12),p=A4(i,"day",1,31),m=OKt(d,f,p,{hours:a,minutes:s,seconds:u,fractionalMilliseconds:l});return c.toUpperCase()!="Z"&&m.setTime(m.getTime()-GCn(c)),m},CGi=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$/),xGi=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$/),OGi=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})$/),M_e=t=>{if(t==null)return;let e;if(typeof t=="number")e=t;else if(typeof t=="string")e=bKt(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))},OKt=(t,e,r,n)=>{let o=e-1;return JCn(t,o,r),new Date(Date.UTC(t,o,r,A4(n.hours,"hour",0,23),A4(n.minutes,"minute",0,59),A4(n.seconds,"seconds",0,60),WCn(n.fractionalMilliseconds)))},TGi=50*365*24*60*60*1e3,VCn=[31,28,31,30,31,30,31,31,30,31,30,31],JCn=(t,e,r)=>{let n=VCn[e];if(e===1&&KCn(t)&&(n=29),r>n)throw new TypeError(`Invalid day for ${UCn[e]} in ${t}: ${r}`)},KCn=t=>t%4===0&&(t%100!==0||t%400===0),A4=(t,e,r,n)=>{let o=vKt(P6e(t));if(o<r||o>n)throw new TypeError(`${e} must be between ${r} and ${n}, inclusive`);return o},WCn=t=>t==null?0:_Kt("0."+t)*1e3,GCn=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},P6e=t=>{let e=0;for(;e<t.length-1&&t.charAt(e)==="0";)e++;return e===0?t:t.slice(e)}});var r5,ac,M6e=v(()=>{r5=class t extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,t.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}},ac=(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 ZCn,R_e,XCn,EKt=v(()=>{M6e();ZCn=({output:t,parsedBody:e,exceptionCtor:r,errorCode:n})=>{let o=XCn(t),i=o.httpStatusCode?o.httpStatusCode+"":void 0,a=new r({name:e?.code||e?.Code||n||i||"UnknownError",$fault:"client",$metadata:o});throw ac(a,e)},R_e=t=>({output:e,parsedBody:r,errorCode:n})=>{ZCn({output:e,parsedBody:r,exceptionCtor:t,errorCode:n})},XCn=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]})});var A_e,PKt=v(()=>{A_e=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 MKt=v(()=>{});var RKt,AKt,IKt=v(()=>{bd();RKt=t=>{let e=[];for(let r in VK){let n=VK[r];t[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>t[n]})}return{_checksumAlgorithms:e,addChecksumAlgorithm(r){this._checksumAlgorithms.push(r)},checksumAlgorithms(){return this._checksumAlgorithms}}},AKt=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e}});var NKt,jKt,DKt=v(()=>{NKt=t=>{let e=t.retryStrategy;return{setRetryStrategy(r){e=r},retryStrategy(){return e}}},jKt=t=>{let e={};return e.retryStrategy=t.retryStrategy(),e}});var I_e,N_e,$Kt=v(()=>{IKt();DKt();I_e=t=>({...RKt(t),...NKt(t)}),N_e=t=>({...AKt(t),...jKt(t)})});var LKt=v(()=>{$Kt()});function j_e(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}var R6e=v(()=>{});var FKt=v(()=>{});var A6e,kKt=v(()=>{A6e=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]=A6e(t[r]));return t}});var I6e,qKt=v(()=>{I6e=function(){let t=Object.getPrototypeOf(this).constructor,e=Function.bind.apply(String,[null,...arguments]),r=new e;return Object.setPrototypeOf(r,t.prototype),r};I6e.prototype=Object.create(String.prototype,{constructor:{value:I6e,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(I6e,String)});var ere,YCn,QCn,exn,BKt=v(()=>{ere=(t,e)=>{let r={};for(let n in e)YCn(r,t,e,n);return r},YCn=(t,e,r,n)=>{if(e!==null){let a=r[n];typeof a=="function"&&(a=[,a]);let[s=QCn,u=exn,l=n]=a;(typeof s=="function"&&s(e[l])||typeof s!="function"&&s)&&(t[n]=u(e[l]));return}let[o,i]=r[n];if(typeof i=="function"){let a,s=o===void 0&&(a=i())!=null,u=typeof o=="function"&&!!o(void 0)||typeof o!="function"&&!!o;s?t[n]=a:u&&(t[n]=i())}else{let a=o===void 0&&i!=null,s=typeof o=="function"&&!!o(i)||typeof o!="function"&&!!o;(a||s)&&(t[n]=i)}},QCn=t=>t!=null,exn=t=>t});var UKt=v(()=>{R6e()});var zKt=v(()=>{});var rn,HKt=v(()=>{rn=t=>{if(t==null)return{};if(Array.isArray(t))return t.filter(e=>e!=null).map(rn);if(typeof t=="object"){let e={};for(let r of Object.keys(t))t[r]!=null&&(e[r]=rn(t[r]));return e}return t}});var VKt=v(()=>{});var an=v(()=>{w6t();O6t();cKt();dKt();fKt();pKt();TKt();EKt();PKt();MKt();LKt();M6e();R6e();FKt();kKt();qKt();BKt();E6e();UKt();zKt();HKt();VKt()});var JKt,KKt=v(()=>{JKt=t=>t?.body instanceof ReadableStream});var txn,rxn,nxn,oxn,N6e,D_e,ixn,WKt=v(()=>{C_e();Kte();an();iT();J3();KKt();l6e();txn=t=>(e,r)=>async n=>{let o=await t.retryStrategy(),i=await t.maxAttempts();if(rxn(o)){o=o;let a=await o.acquireInitialRetryToken(r.partition_id),s=new Error,u=0,l=0,{request:c}=n,d=XK.isInstance(c);for(d&&(c.headers[b_e]=H0());;)try{d&&(c.headers[__e]=`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=nxn(f);if(s=u6e(f),d&&JKt(c))throw(r.logger instanceof uF?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)},rxn=t=>typeof t.acquireInitialRetryToken<"u"&&typeof t.refreshRetryTokenForRetry<"u"&&typeof t.recordSuccess<"u",nxn=t=>{let e={error:t,errorType:oxn(t)},r=ixn(t.$response);return r&&(e.retryAfterHint=r),e},oxn=t=>WK(t)?"THROTTLING":y_e(t)?"TRANSIENT":X3t(t)?"SERVER_ERROR":"CLIENT_ERROR",N6e={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},D_e=t=>({applyToStack:e=>{e.add(txn(t),N6e)}}),ixn=t=>{if(!Gte.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 $_e=v(()=>{b6t();c6e();_6t();a6e();v6t();s6e();WKt()});var axn,L_e,GKt=v(()=>{$_e();r6e();axn={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:N6e.name},L_e=t=>({applyToStack:e=>{e.addRelativeTo(V3t(t),axn)}})});var ZKt=v(()=>{r6e();GKt()});var n5,XKt=v(()=>{n5=class{constructor(e){this.authSchemes=new Map;for(let[r,n]of Object.entries(e))n!==void 0&&this.authSchemes.set(r,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}});var YKt=v(()=>{Vte();bd()});var QKt=v(()=>{Vte()});var o5,e5t=v(()=>{o5=class{async sign(e,r,n){return e}}});var t5t=v(()=>{YKt();QKt();e5t()});var sxn,r5t,j6e,n5t,o5t=v(()=>{sxn=t=>e=>j6e(e)&&e.expiration.getTime()-Date.now()<t,r5t=sxn(3e5),j6e=t=>t.expiration!==void 0,n5t=(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 i5t=v(()=>{XKt();t5t();o5t()});var a5t=v(()=>{bd()});var i5,s5t=v(()=>{i5=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e}});var u5t=v(()=>{Vte();an()});function D6e(t,e,r,n,o){return async function*(a,s,...u){let l=a.startingToken||void 0,c=!0,d;for(;c;){if(s[r]=l,o&&(s[o]=s[o]??a.pageSize),a.client instanceof t)d=await uxn(e,a.client,s,...u);else throw new Error(`Invalid client, expected instance of ${t.name}`);yield d;let f=l;l=lxn(d,n),c=!!(l&&(!a.stopOnSameToken||l!==f))}return void 0}}var uxn,lxn,l5t=v(()=>{uxn=async(t,e,r,...n)=>await e.send(new t(r),...n);lxn=(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 hF=v(()=>{D3t();ZKt();i5t();a5t();s5t();u5t();l5t()});var c5t=v(()=>{});var d5t=v(()=>{c5t()});var f5t=v(()=>{bd()});var p5t=v(()=>{});var m5t=v(()=>{});function cxn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var F_e,h5t=v(()=>{F_e=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=cxn(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 g5t=v(()=>{});var y5t=v(()=>{});var b5t=v(()=>{});var _5t=v(()=>{d5t();f5t();p5t();m5t();h5t();g5t();y5t();b5t()});function dxn(t){return e=>async r=>{let n=r.request;if(F_e.isInstance(n)){let{body:o,headers:i}=n;if(o&&Object.keys(i).map(a=>a.toLowerCase()).indexOf(v5t)===-1)try{let a=t(o);n.headers={...n.headers,[v5t]:String(a)}}catch{}}return e({...r,request:n})}}var v5t,fxn,k_e,$6e=v(()=>{_5t();v5t="content-length";fxn={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},k_e=t=>({applyToStack:e=>{e.add(dxn(t.bodyLengthChecker),fxn)}})});var w5t=v(()=>{});var S5t=v(()=>{w5t()});var C5t=v(()=>{});var x5t=v(()=>{C5t()});var O5t=v(()=>{bd()});var T5t=v(()=>{});var E5t=v(()=>{});function pxn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var gF,P5t=v(()=>{gF=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=pxn(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 q_e,M5t=v(()=>{q_e=class{constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;let r=e;return typeof r.statusCode=="number"&&typeof r.headers=="object"}}});var R5t=v(()=>{});var A5t=v(()=>{});var tre=v(()=>{x5t();O5t();T5t();E5t();P5t();M5t();R5t();A5t()});var L6e,I5t=v(()=>{tre();L6e=t=>q_e.isInstance(t)?t.headers?.date??t.headers?.Date:void 0});var B_e,F6e=v(()=>{B_e=t=>new Date(Date.now()+t)});var N5t,j5t=v(()=>{F6e();N5t=(t,e)=>Math.abs(B_e(e).getTime()-t)>=3e5});var k6e,D5t=v(()=>{j5t();k6e=(t,e)=>{let r=Date.parse(t);return N5t(r,e)?r-Date.now():e}});var $5t=v(()=>{I5t();F6e();D5t()});var rre,L5t,I4,F5t=v(()=>{tre();$5t();rre=(t,e)=>{if(!e)throw new Error(`Property \`${t}\` is not resolved for AWS SDK SigV4Auth`);return e},L5t=async t=>{let e=rre("context",t.context),r=rre("config",t.config),n=e.endpointV2?.properties?.authSchemes?.[0],i=await rre("signer",r.signer)(n),a=t?.signingRegion,s=t?.signingRegionSet,u=t?.signingName;return{config:r,signer:i,signingRegion:a,signingRegionSet:s,signingName:u}},I4=class{async sign(e,r,n){if(!gF.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");let o=await L5t(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:B_e(i.systemClockOffset),signingRegion:s,signingService:u})}errorHandler(e){return r=>{let n=r.ServerTime??L6e(r.$response);if(n){let o=rre("config",e.config),i=o.systemClockOffset;o.systemClockOffset=k6e(n,o.systemClockOffset),o.systemClockOffset!==i&&r.$metadata&&(r.$metadata.clockSkewCorrected=!0)}throw r}}successHandler(e,r){let n=L6e(e);if(n){let o=rre("config",r.config);o.systemClockOffset=k6e(n,o.systemClockOffset)}}}});var k5t=v(()=>{hF();e1()});function B5t(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 q6e)e[r/2]=q6e[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function hC(t){let e="";for(let r=0;r<t.byteLength;r++)e+=q5t[t[r]];return e}var q5t,q6e,nre=v(()=>{q5t={},q6e={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),q5t[t]=e,q6e[e]=t}});var ore,B6e=v(()=>{ore=t=>new TextEncoder().encode(t)});var yF,U5t=v(()=>{B6e();yF=t=>typeof t=="string"?ore(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t)});var z5t=v(()=>{});var ire=v(()=>{B6e();U5t();z5t()});var H5t,V5t,U6e,J5t,K5t,z6e,H6e,V6e,J6e,mxn,W5t,G5t,are,Z5t,X5t,Y5t,Q5t,U_e,eWt,tWt,rWt,K6e,nWt,N4=v(()=>{H5t="X-Amz-Algorithm",V5t="X-Amz-Credential",U6e="X-Amz-Date",J5t="X-Amz-SignedHeaders",K5t="X-Amz-Expires",z6e="X-Amz-Signature",H6e="X-Amz-Security-Token",V6e="authorization",J6e=U6e.toLowerCase(),mxn="date",W5t=[V6e,J6e,mxn],G5t=z6e.toLowerCase(),are="x-amz-content-sha256",Z5t=H6e.toLowerCase(),X5t={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},Y5t=/^proxy-/,Q5t=/^sec-/,U_e="AWS4-HMAC-SHA256",eWt="AWS4-HMAC-SHA256-PAYLOAD",tWt="UNSIGNED-PAYLOAD",rWt=50,K6e="aws4_request",nWt=60*60*24*7});var z_e,W6e,H_e,iWt,oWt,G6e=v(()=>{nre();ire();N4();z_e={},W6e=[],H_e=(t,e,r)=>`${t}/${e}/${r}/${K6e}`,iWt=async(t,e,r,n,o)=>{let i=await oWt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${hC(i)}:${e.sessionToken}`;if(a in z_e)return z_e[a];for(W6e.push(a);W6e.length>rWt;)delete z_e[W6e.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,K6e])s=await oWt(t,s,u);return z_e[a]=s},oWt=(t,e,r)=>{let n=new t(e);return n.update(yF(r)),n.digest()}});var V_e,Z6e=v(()=>{N4();V_e=({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 X5t||e?.has(i)||Y5t.test(i)||Q5t.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n}});var X6e,Y6e=v(()=>{T_e();N4();X6e=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t).sort()){if(n.toLowerCase()===G5t)continue;e.push(n);let o=t[n];typeof o=="string"?r[n]=`${mS(n)}=${mS(o)}`:Array.isArray(o)&&(r[n]=o.slice(0).reduce((i,a)=>i.concat([`${mS(n)}=${mS(a)}`]),[]).sort().join("&"))}return e.map(n=>r[n]).filter(n=>n).join("&")}});var aWt,sWt=v(()=>{aWt=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]"});var sre,Q6e=v(()=>{sWt();nre();ire();N4();sre=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===are)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||aWt(e)){let n=new r;return n.update(yF(e)),hC(await n.digest())}return tWt}});function lWt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var J_e,uWt,hxn,eKe,cWt=v(()=>{nre();ire();J_e=class{format(e){let r=[];for(let i of Object.keys(e)){let a=ore(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=ore(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(eKe.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!hxn.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(B5t(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"})(uWt||(uWt={}));hxn=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,eKe=class t{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);let r=new Uint8Array(8);for(let n=7,o=Math.abs(Math.round(e));n>-1&&o>0;n--,o/=256)r[n]=o;return e<0&&lWt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&lWt(e),parseInt(hC(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}});var dWt,fWt=v(()=>{dWt=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1}});var tKe,rKe=v(()=>{tre();tKe=(t,e={})=>{let{headers:r,query:n={}}=gF.clone(t);for(let o of Object.keys(r)){let i=o.toLowerCase();i.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(i)&&(n[o]=r[o],delete r[o])}return{...t,headers:r,query:n}}});var K_e,nKe=v(()=>{tre();N4();K_e=t=>{t=gF.clone(t);for(let e of Object.keys(t.headers))W5t.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t}});var pWt,gxn,mWt=v(()=>{pWt=t=>gxn(t).toISOString().replace(/\.\d{3}Z$/,"Z"),gxn=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t});var ure,W_e,hWt,gWt=v(()=>{nre();pC();T_e();ire();N4();G6e();Z6e();Y6e();Q6e();cWt();fWt();rKe();nKe();mWt();ure=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new J_e,this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=dy(n),this.credentialProvider=dy(r)}async presign(e,r={}){let{signingDate:n=new Date,expiresIn:o=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:s,signingRegion:u,signingService:l}=r,c=await this.credentialProvider();this.validateResolvedCredentials(c);let d=u??await this.regionProvider(),{longDate:f,shortDate:p}=W_e(n);if(o>nWt)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let m=H_e(p,d,l??this.service),h=tKe(K_e(e),{unhoistableHeaders:a});c.sessionToken&&(h.query[H6e]=c.sessionToken),h.query[H5t]=U_e,h.query[V5t]=`${c.accessKeyId}/${m}`,h.query[U6e]=f,h.query[K5t]=o.toString(10);let g=V_e(h,i,s);return h.query[J5t]=hWt(g),h.query[z6e]=await this.getSignature(f,m,this.getSigningKey(c,d,p,l),this.createCanonicalRequest(h,g,await sre(e,this.sha256))),h}async sign(e,r){return typeof e=="string"?this.signString(e,r):e.headers&&e.payload?this.signEvent(e,r):e.message?this.signMessage(e,r):this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:n=new Date,priorSignature:o,signingRegion:i,signingService:a}){let s=i??await this.regionProvider(),{shortDate:u,longDate:l}=W_e(n),c=H_e(u,s,a??this.service),d=await sre({headers:{},body:r},this.sha256),f=new this.sha256;f.update(e);let p=hC(await f.digest()),m=[eWt,l,c,o,p,d].join(`
|
||
`);return this.signString(m,{signingDate:n,signingRegion:s,signingService:a})}async signMessage(e,{signingDate:r=new Date,signingRegion:n,signingService:o}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:n,signingService:o,priorSignature:e.priorSignature}).then(a=>({message:e.message,signature:a}))}async signString(e,{signingDate:r=new Date,signingRegion:n,signingService:o}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:s}=W_e(r),u=new this.sha256(await this.getSigningKey(i,a,s,o));return u.update(yF(e)),hC(await u.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:n,unsignableHeaders:o,signingRegion:i,signingService:a}={}){let s=await this.credentialProvider();this.validateResolvedCredentials(s);let u=i??await this.regionProvider(),l=K_e(e),{longDate:c,shortDate:d}=W_e(r),f=H_e(d,u,a??this.service);l.headers[J6e]=c,s.sessionToken&&(l.headers[Z5t]=s.sessionToken);let p=await sre(l,this.sha256);!dWt(are,l.headers)&&this.applyChecksum&&(l.headers[are]=p);let m=V_e(l,o,n),h=await this.getSignature(c,f,this.getSigningKey(s,u,d,a),this.createCanonicalRequest(l,m,p));return l.headers[V6e]=`${U_e} Credential=${s.accessKeyId}/${f}, SignedHeaders=${hWt(m)}, Signature=${h}`,l}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
|
||
${this.getCanonicalPath(e)}
|
||
${X6e(e)}
|
||
${o.map(i=>`${i}:${r[i]}`).join(`
|
||
`)}
|
||
|
||
${o.join(";")}
|
||
${n}`}async createStringToSign(e,r,n){let o=new this.sha256;o.update(yF(n));let i=await o.digest();return`${U_e}
|
||
${e}
|
||
${r}
|
||
${hC(i)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let r=[];for(let i of e.split("/"))i?.length!==0&&i!=="."&&(i===".."?r.pop():r.push(i));let n=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return mS(n).replace(/%2F/g,"/")}return e}async getSignature(e,r,n,o){let i=await this.createStringToSign(e,r,o),a=new this.sha256(await n);return a.update(yF(i)),hC(await a.digest())}getSigningKey(e,r,n,o){return iWt(this.sha256,e,n,r,o||this.service)}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}},W_e=t=>{let e=pWt(t).replace(/[\-:]/g,"");return{longDate:e,shortDate:e.slice(0,8)}},hWt=t=>Object.keys(t).sort().join(";")});var yWt=v(()=>{gWt();Z6e();Y6e();Q6e();rKe();nKe();G6e()});var G_e,bWt=v(()=>{hF();yWt();G_e=t=>{let e;t.credentials&&(e=n5t(t.credentials,r5t,j6e)),e||(t.credentialDefaultProvider?e=i5(t.credentialDefaultProvider(Object.assign({},t,{parentClientConfig:t}))):e=async()=>{throw new Error("`credentials` is missing")});let{signingEscapePath:r=!0,systemClockOffset:n=t.systemClockOffset||0,sha256:o}=t,i;return t.signer?i=i5(t.signer):t.regionInfoProvider?i=()=>i5(t.region)().then(async a=>[await t.regionInfoProvider(a,{useFipsEndpoint:await t.useFipsEndpoint(),useDualstackEndpoint:await t.useDualstackEndpoint()})||{},a]).then(([a,s])=>{let{signingRegion:u,signingService:l}=a;t.signingRegion=t.signingRegion||u||s,t.signingName=t.signingName||l||t.serviceId;let c={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:o,uriEscapePath:r},d=t.signerConstructor||ure;return new d(c)}):i=async a=>{a=Object.assign({},{name:"sigv4",signingName:t.signingName||t.defaultSigningName,signingRegion:await i5(t.region)(),properties:{}},a);let s=a.signingRegion,u=a.signingName;t.signingRegion=t.signingRegion||s,t.signingName=t.signingName||u||t.serviceId;let l={...t,credentials:e,region:t.signingRegion,service:t.signingName,sha256:o,uriEscapePath:r},c=t.signerConstructor||ure;return new c(l)},{...t,systemClockOffset:n,signingEscapePath:r,credentials:e,signer:i}}});var _Wt=v(()=>{F5t();k5t();bWt()});var vWt=v(()=>{_Wt()});var wWt=v(()=>{});var SWt=v(()=>{an()});var Z_e,oKe=v(()=>{an();Z_e=(t,e)=>mF(t,e).then(r=>e.utf8Encoder(r))});var Xc,CWt,xWt,OWt=v(()=>{oKe();Xc=(t,e)=>Z_e(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{}}),CWt=async(t,e)=>{let r=await Xc(t,e);return r.message=r.message??r.Message,r},xWt=(t,e)=>{let r=(i,a)=>Object.keys(i).find(s=>s.toLowerCase()===a.toLowerCase()),n=i=>{let a=i;return typeof a=="number"&&(a=a.toString()),a.indexOf(",")>=0&&(a=a.split(",")[0]),a.indexOf(":")>=0&&(a=a.split(":")[0]),a.indexOf("#")>=0&&(a=a.split("#")[1]),a},o=r(t.headers,"x-amzn-errortype");if(o!==void 0)return n(t.headers[o]);if(e.code!==void 0)return n(e.code);if(e.__type!==void 0)return n(e.__type)}});var X_e=S(i1=>{"use strict";var TWt=":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",yxn=TWt+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",EWt="["+TWt+"]["+yxn+"]*",bxn=new RegExp("^"+EWt+"$"),_xn=function(t,e){let r=[],n=e.exec(t);for(;n;){let o=[];o.startIndex=e.lastIndex-n[0].length;let i=n.length;for(let a=0;a<i;a++)o.push(n[a]);r.push(o),n=e.exec(t)}return r},vxn=function(t){let e=bxn.exec(t);return!(e===null||typeof e>"u")};i1.isExist=function(t){return typeof t<"u"};i1.isEmptyObject=function(t){return Object.keys(t).length===0};i1.merge=function(t,e,r){if(e){let n=Object.keys(e),o=n.length;for(let i=0;i<o;i++)r==="strict"?t[n[i]]=[e[n[i]]]:t[n[i]]=e[n[i]]}};i1.getValue=function(t){return i1.isExist(t)?t:""};i1.isName=vxn;i1.getAllMatches=_xn;i1.nameRegexp=EWt});var aKe=S(IWt=>{"use strict";var iKe=X_e(),wxn={allowBooleanAttributes:!1,unpairedTags:[]};IWt.validate=function(t,e){e=Object.assign({},wxn,e);let r=[],n=!1,o=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let i=0;i<t.length;i++)if(t[i]==="<"&&t[i+1]==="?"){if(i+=2,i=MWt(t,i),i.err)return i}else if(t[i]==="<"){let a=i;if(i++,t[i]==="!"){i=RWt(t,i);continue}else{let s=!1;t[i]==="/"&&(s=!0,i++);let u="";for(;i<t.length&&t[i]!==">"&&t[i]!==" "&&t[i]!==" "&&t[i]!==`
|
||
`&&t[i]!=="\r";i++)u+=t[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!Mxn(u)){let d;return u.trim().length===0?d="Invalid space after '<'.":d="Tag '"+u+"' is an invalid name.",Yc("InvalidTag",d,cb(t,i))}let l=xxn(t,i);if(l===!1)return Yc("InvalidAttr","Attributes for '"+u+"' have open quote.",cb(t,i));let c=l.value;if(i=l.index,c[c.length-1]==="/"){let d=i-c.length;c=c.substring(0,c.length-1);let f=AWt(c,e);if(f===!0)n=!0;else return Yc(f.err.code,f.err.msg,cb(t,d+f.err.line))}else if(s)if(l.tagClosed){if(c.trim().length>0)return Yc("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",cb(t,a));if(r.length===0)return Yc("InvalidTag","Closing tag '"+u+"' has not been opened.",cb(t,a));{let d=r.pop();if(u!==d.tagName){let f=cb(t,d.tagStartPos);return Yc("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+u+"'.",cb(t,a))}r.length==0&&(o=!0)}}else return Yc("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",cb(t,i));else{let d=AWt(c,e);if(d!==!0)return Yc(d.err.code,d.err.msg,cb(t,i-c.length+d.err.line));if(o===!0)return Yc("InvalidXml","Multiple possible root nodes found.",cb(t,i));e.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:a}),n=!0}for(i++;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="!"){i++,i=RWt(t,i);continue}else if(t[i+1]==="?"){if(i=MWt(t,++i),i.err)return i}else break;else if(t[i]==="&"){let d=Exn(t,i);if(d==-1)return Yc("InvalidChar","char '&' is not expected.",cb(t,i));i=d}else if(o===!0&&!PWt(t[i]))return Yc("InvalidXml","Extra text at the end",cb(t,i));t[i]==="<"&&i--}}else{if(PWt(t[i]))continue;return Yc("InvalidChar","char '"+t[i]+"' is not expected.",cb(t,i))}if(n){if(r.length==1)return Yc("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",cb(t,r[0].tagStartPos));if(r.length>0)return Yc("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Yc("InvalidXml","Start tag expected.",1);return!0};function PWt(t){return t===" "||t===" "||t===`
|
||
`||t==="\r"}function MWt(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let n=t.substr(r,e-r);if(e>5&&n==="xml")return Yc("InvalidXml","XML declaration allowed only at the start of the document.",cb(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function RWt(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var Sxn='"',Cxn="'";function xxn(t,e){let r="",n="",o=!1;for(;e<t.length;e++){if(t[e]===Sxn||t[e]===Cxn)n===""?n=t[e]:n!==t[e]||(n="");else if(t[e]===">"&&n===""){o=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:o}}var Oxn=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function AWt(t,e){let r=iKe.getAllMatches(t,Oxn),n={};for(let o=0;o<r.length;o++){if(r[o][1].length===0)return Yc("InvalidAttr","Attribute '"+r[o][2]+"' has no space in starting.",lre(r[o]));if(r[o][3]!==void 0&&r[o][4]===void 0)return Yc("InvalidAttr","Attribute '"+r[o][2]+"' is without value.",lre(r[o]));if(r[o][3]===void 0&&!e.allowBooleanAttributes)return Yc("InvalidAttr","boolean attribute '"+r[o][2]+"' is not allowed.",lre(r[o]));let i=r[o][2];if(!Pxn(i))return Yc("InvalidAttr","Attribute '"+i+"' is an invalid name.",lre(r[o]));if(!n.hasOwnProperty(i))n[i]=1;else return Yc("InvalidAttr","Attribute '"+i+"' is repeated.",lre(r[o]))}return!0}function Txn(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function Exn(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Txn(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function Yc(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function Pxn(t){return iKe.isName(t)}function Mxn(t){return iKe.isName(t)}function cb(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function lre(t){return t.startIndex+t[1].length}});var jWt=S(sKe=>{var NWt={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}},Rxn=function(t){return Object.assign({},NWt,t)};sKe.buildOptions=Rxn;sKe.defaultOptions=NWt});var $Wt=S((ZXi,DWt)=>{"use strict";var uKe=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};DWt.exports=uKe});var FWt=S((XXi,LWt)=>{var Axn=X_e();function Ixn(t,e){let r={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let n=1,o=!1,i=!1,a="";for(;e<t.length;e++)if(t[e]==="<"&&!i){if(o&&Dxn(t,e))e+=7,[entityName,val,e]=Nxn(t,e+1),val.indexOf("&")===-1&&(r[kxn(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(o&&$xn(t,e))e+=8;else if(o&&Lxn(t,e))e+=8;else if(o&&Fxn(t,e))e+=9;else if(jxn)i=!0;else throw new Error("Invalid DOCTYPE");n++,a=""}else if(t[e]===">"){if(i?t[e-1]==="-"&&t[e-2]==="-"&&(i=!1,n--):n--,n===0)break}else t[e]==="["?o=!0:a+=t[e];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:e}}function Nxn(t,e){let r="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)r+=t[e];if(r=r.trim(),r.indexOf(" ")!==-1)throw new Error("External entites are not supported");let n=t[e++],o="";for(;e<t.length&&t[e]!==n;e++)o+=t[e];return[r,o,e]}function jxn(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function Dxn(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function $xn(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function Lxn(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function Fxn(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function kxn(t){if(Axn.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}LWt.exports=Ixn});var qWt=S((YXi,kWt)=>{var qxn=/^[-+]?0x[a-fA-F0-9]+$/,Bxn=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var Uxn={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function zxn(t,e={}){if(e=Object.assign({},Uxn,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(e.hex&&qxn.test(r))return Number.parseInt(r,16);{let n=Bxn.exec(r);if(n){let o=n[1],i=n[2],a=Hxn(n[3]),s=n[4]||n[6];if(!e.leadingZeros&&i.length>0&&o&&r[2]!==".")return t;if(!e.leadingZeros&&i.length>0&&!o&&r[1]!==".")return t;{let u=Number(r),l=""+u;return l.search(/[eE]/)!==-1||s?e.eNotation?u:t:r.indexOf(".")!==-1?l==="0"&&a===""||l===a||o&&l==="-"+a?u:t:i?a===l||o+a===l?u:t:r===l||r===o+l?u:t}}else return t}}function Hxn(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}kWt.exports=zxn});var zWt=S((QXi,UWt)=>{"use strict";var BWt=X_e(),cre=$Wt(),Vxn=FWt(),Jxn=qWt(),lKe=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,16))}},this.addExternalEntities=Kxn,this.parseXml=Yxn,this.parseTextData=Wxn,this.resolveNameSpace=Gxn,this.buildAttributesMap=Xxn,this.isItStopNode=rOn,this.replaceEntitiesValue=eOn,this.readStopNodeData=oOn,this.saveTextToParentTag=tOn,this.addChild=Qxn}};function Kxn(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:t[n]}}}function Wxn(t,e,r,n,o,i,a){if(t!==void 0&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));let s=this.options.tagValueProcessor(e,t,r,o,i);return s==null?t:typeof s!=typeof t||s!==t?s:this.options.trimValues?dKe(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?dKe(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function Gxn(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var Zxn=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Xxn(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=BWt.getAllMatches(t,Zxn),o=n.length,i={};for(let a=0;a<o;a++){let s=this.resolveNameSpace(n[a][1]),u=n[a][4],l=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u);let c=this.options.attributeValueProcessor(s,u,e);c==null?i[l]=u:typeof c!=typeof u||c!==u?i[l]=c:i[l]=dKe(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[l]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let a={};return a[this.options.attributesGroupName]=i,a}return i}}var Yxn=function(t){t=t.replace(/\r\n?/g,`
|
||
`);let e=new cre("!xml"),r=e,n="",o="";for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let s=j4(t,">",i,"Closing Tag is not closed."),u=t.substring(i+2,s).trim();if(this.options.removeNSPrefix){let d=u.indexOf(":");d!==-1&&(u=u.substr(d+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&(n=this.saveTextToParentTag(n,r,o));let l=o.substring(o.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let c=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(c=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=o.lastIndexOf("."),o=o.substring(0,c),r=this.tagsNodeStack.pop(),n="",i=s}else if(t[i+1]==="?"){let s=cKe(t,i,!1,"?>");if(!s)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,o),!(this.options.ignoreDeclaration&&s.tagName==="?xml"||this.options.ignorePiTags)){let u=new cre(s.tagName);u.add(this.options.textNodeName,""),s.tagName!==s.tagExp&&s.attrExpPresent&&(u[":@"]=this.buildAttributesMap(s.tagExp,o,s.tagName)),this.addChild(r,u,o)}i=s.closeIndex+1}else if(t.substr(i+1,3)==="!--"){let s=j4(t,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let u=t.substring(i+4,s-2);n=this.saveTextToParentTag(n,r,o),r.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=s}else if(t.substr(i+1,2)==="!D"){let s=Vxn(t,i);this.docTypeEntities=s.entities,i=s.i}else if(t.substr(i+1,2)==="!["){let s=j4(t,"]]>",i,"CDATA is not closed.")-2,u=t.substring(i+9,s);n=this.saveTextToParentTag(n,r,o);let l=this.parseTextData(u,r.tagname,o,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):r.add(this.options.textNodeName,l),i=s+2}else{let s=cKe(t,i,this.options.removeNSPrefix),u=s.tagName,l=s.rawTagName,c=s.tagExp,d=s.attrExpPresent,f=s.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,o,!1));let p=r;if(p&&this.options.unpairedTags.indexOf(p.tagname)!==-1&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==e.tagname&&(o+=o?"."+u:u),this.isItStopNode(this.options.stopNodes,o,u)){let m="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),i=s.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=s.closeIndex;else{let g=this.readStopNodeData(t,l,f+1);if(!g)throw new Error(`Unexpected end of ${l}`);i=g.i,m=g.tagContent}let h=new cre(u);u!==c&&d&&(h[":@"]=this.buildAttributesMap(c,o,u)),m&&(m=this.parseTextData(m,u,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),h.add(this.options.textNodeName,m),this.addChild(r,h,o)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),c=u):c=c.substr(0,c.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));let m=new cre(u);u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),o=o.substr(0,o.lastIndexOf("."))}else{let m=new cre(u);this.tagsNodeStack.push(r),u!==c&&d&&(m[":@"]=this.buildAttributesMap(c,o,u)),this.addChild(r,m,o),r=m}n="",i=f}}else n+=t[i];return e.child};function Qxn(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var eOn=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){let r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(let e in this.lastEntities){let r=this.lastEntities[e];t=t.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){let r=this.htmlEntities[e];t=t.replace(r.regex,r.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function tOn(t,e,r,n){return t&&(n===void 0&&(n=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function rOn(t,e,r){let n="*."+r;for(let o in t){let i=t[o];if(n===i||e===i)return!0}return!1}function nOn(t,e,r=">"){let n,o="";for(let i=e;i<t.length;i++){let a=t[i];if(n)a===n&&(n="");else if(a==='"'||a==="'")n=a;else if(a===r[0])if(r[1]){if(t[i+1]===r[1])return{data:o,index:i}}else return{data:o,index:i};else a===" "&&(a=" ");o+=a}}function j4(t,e,r,n){let o=t.indexOf(e,r);if(o===-1)throw new Error(n);return o+e.length-1}function cKe(t,e,r,n=">"){let o=nOn(t,e+1,n);if(!o)return;let i=o.data,a=o.index,s=i.search(/\s/),u=i,l=!0;s!==-1&&(u=i.substring(0,s),i=i.substring(s+1).trimStart());let c=u;if(r){let d=u.indexOf(":");d!==-1&&(u=u.substr(d+1),l=u!==o.data.substr(d+1))}return{tagName:u,tagExp:i,closeIndex:a,attrExpPresent:l,rawTagName:c}}function oOn(t,e,r){let n=r,o=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let i=j4(t,">",r,`${e} is not closed`);if(t.substring(r+2,i).trim()===e&&(o--,o===0))return{tagContent:t.substring(n,r),i};r=i}else if(t[r+1]==="?")r=j4(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=j4(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=j4(t,"]]>",r,"StopNode is not closed.")-2;else{let i=cKe(t,r,">");i&&((i&&i.tagName)===e&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,r=i.closeIndex)}}function dKe(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:Jxn(t,r)}else return BWt.isExist(t)?t:""}UWt.exports=lKe});var JWt=S(VWt=>{"use strict";function iOn(t,e){return HWt(t,e)}function HWt(t,e,r){let n,o={};for(let i=0;i<t.length;i++){let a=t[i],s=aOn(a),u="";if(r===void 0?u=s:u=r+"."+s,s===e.textNodeName)n===void 0?n=a[s]:n+=""+a[s];else{if(s===void 0)continue;if(a[s]){let l=HWt(a[s],e,u),c=uOn(l,e);a[":@"]?sOn(l,a[":@"],u,e):Object.keys(l).length===1&&l[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?l=l[e.textNodeName]:Object.keys(l).length===0&&(e.alwaysCreateTextNode?l[e.textNodeName]="":l=""),o[s]!==void 0&&o.hasOwnProperty(s)?(Array.isArray(o[s])||(o[s]=[o[s]]),o[s].push(l)):e.isArray(s,u,c)?o[s]=[l]:o[s]=l}}}return typeof n=="string"?n.length>0&&(o[e.textNodeName]=n):n!==void 0&&(o[e.textNodeName]=n),o}function aOn(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function sOn(t,e,r,n){if(e){let o=Object.keys(e),i=o.length;for(let a=0;a<i;a++){let s=o[a];n.isArray(s,r+"."+s,!0,!0)?t[s]=[e[s]]:t[s]=e[s]}}}function uOn(t,e){let{textNodeName:r}=e,n=Object.keys(t).length;return!!(n===0||n===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}VWt.prettify=iOn});var WWt=S((tYi,KWt)=>{var{buildOptions:lOn}=jWt(),cOn=zWt(),{prettify:dOn}=JWt(),fOn=aKe(),fKe=class{constructor(e){this.externalEntities={},this.options=lOn(e)}parse(e,r){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let i=fOn.validate(e,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new cOn(this.options);n.addExternalEntities(this.externalEntities);let o=n.parseXml(e);return this.options.preserveOrder||o===void 0?o:dOn(o,this.options)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};KWt.exports=fKe});var QWt=S((rYi,YWt)=>{var pOn=`
|
||
`;function mOn(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=pOn),ZWt(t,e,"",r)}function ZWt(t,e,r,n){let o="",i=!1;for(let a=0;a<t.length;a++){let s=t[a],u=hOn(s);if(u===void 0)continue;let l="";if(r.length===0?l=u:l=`${r}.${u}`,u===e.textNodeName){let m=s[u];gOn(l,e)||(m=e.tagValueProcessor(u,m),m=XWt(m,e)),i&&(o+=n),o+=m,i=!1;continue}else if(u===e.cdataPropName){i&&(o+=n),o+=`<![CDATA[${s[u][0][e.textNodeName]}]]>`,i=!1;continue}else if(u===e.commentPropName){o+=n+`<!--${s[u][0][e.textNodeName]}-->`,i=!0;continue}else if(u[0]==="?"){let m=GWt(s[":@"],e),h=u==="?xml"?"":n,g=s[u][0][e.textNodeName];g=g.length!==0?" "+g:"",o+=h+`<${u}${g}${m}?>`,i=!0;continue}let c=n;c!==""&&(c+=e.indentBy);let d=GWt(s[":@"],e),f=n+`<${u}${d}`,p=ZWt(s[u],e,l,c);e.unpairedTags.indexOf(u)!==-1?e.suppressUnpairedNode?o+=f+">":o+=f+"/>":(!p||p.length===0)&&e.suppressEmptyNode?o+=f+"/>":p&&p.endsWith(">")?o+=f+`>${p}${n}</${u}>`:(o+=f+">",p&&n!==""&&(p.includes("/>")||p.includes("</"))?o+=n+e.indentBy+p+n:o+=p,o+=`</${u}>`),i=!0}return o}function hOn(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(t.hasOwnProperty(n)&&n!==":@")return n}}function GWt(t,e){let r="";if(t&&!e.ignoreAttributes)for(let n in t){if(!t.hasOwnProperty(n))continue;let o=e.attributeValueProcessor(n,t[n]);o=XWt(o,e),o===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${o}"`}return r}function gOn(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let r=t.substr(t.lastIndexOf(".")+1);for(let n in e.stopNodes)if(e.stopNodes[n]===t||e.stopNodes[n]==="*."+r)return!0;return!1}function XWt(t,e){if(t&&t.length>0&&e.processEntities)for(let r=0;r<e.entities.length;r++){let n=e.entities[r];t=t.replace(n.regex,n.val)}return t}YWt.exports=mOn});var t8t=S((nYi,e8t)=>{"use strict";var yOn=QWt(),bOn={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function bF(t){this.options=Object.assign({},bOn,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=wOn),this.processTextOrObjNode=_On,this.options.format?(this.indentate=vOn,this.tagEndChar=`>
|
||
`,this.newLine=`
|
||
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}bF.prototype.build=function(t){return this.options.preserveOrder?yOn(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};bF.prototype.j2x=function(t,e){let r="",n="";for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o))if(typeof t[o]>"u")this.isAttribute(o)&&(n+="");else if(t[o]===null)this.isAttribute(o)?n+="":o[0]==="?"?n+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(t[o]instanceof Date)n+=this.buildTextValNode(t[o],o,"",e);else if(typeof t[o]!="object"){let i=this.isAttribute(o);if(i)r+=this.buildAttrPairStr(i,""+t[o]);else if(o===this.options.textNodeName){let a=this.options.tagValueProcessor(o,""+t[o]);n+=this.replaceEntitiesValue(a)}else n+=this.buildTextValNode(t[o],o,"",e)}else if(Array.isArray(t[o])){let i=t[o].length,a="",s="";for(let u=0;u<i;u++){let l=t[o][u];if(!(typeof l>"u"))if(l===null)o[0]==="?"?n+=this.indentate(e)+"<"+o+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+o+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){let c=this.j2x(l,e+1);a+=c.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(s+=c.attrStr)}else a+=this.processTextOrObjNode(l,o,e);else if(this.options.oneListGroup){let c=this.options.tagValueProcessor(o,l);c=this.replaceEntitiesValue(c),a+=c}else a+=this.buildTextValNode(l,o,"",e)}this.options.oneListGroup&&(a=this.buildObjectNode(a,o,s,e)),n+=a}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){let i=Object.keys(t[o]),a=i.length;for(let s=0;s<a;s++)r+=this.buildAttrPairStr(i[s],""+t[o][i[s]])}else n+=this.processTextOrObjNode(t[o],o,e);return{attrStr:r,val:n}};bF.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function _On(t,e,r){let n=this.j2x(t,r+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}bF.prototype.buildObjectNode=function(t,e,r,n){if(t==="")return e[0]==="?"?this.indentate(n)+"<"+e+r+"?"+this.tagEndChar:this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar;{let o="</"+e+this.tagEndChar,i="";return e[0]==="?"&&(i="?",o=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(n)+"<"+e+r+i+">"+t+o:this.options.commentPropName!==!1&&e===this.options.commentPropName&&i.length===0?this.indentate(n)+`<!--${t}-->`+this.newLine:this.indentate(n)+"<"+e+r+i+this.tagEndChar+t+this.indentate(n)+o}};bF.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};bF.prototype.buildTextValNode=function(t,e,r,n){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(e,t);return o=this.replaceEntitiesValue(o),o===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+o+"</"+e+this.tagEndChar}};bF.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){let r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function vOn(t){return this.options.indentBy.repeat(t)}function wOn(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}e8t.exports=bF});var n8t=S((oYi,r8t)=>{"use strict";var SOn=aKe(),COn=WWt(),xOn=t8t();r8t.exports={XMLParser:COn,XMLValidator:SOn,XMLBuilder:xOn}});var o8t,aT,i8t,a8t=v(()=>{an();o8t=L(n8t());oKe();aT=(t,e)=>Z_e(t,e).then(r=>{if(r.length){let n=new o8t.XMLParser({attributeNamePrefix:"",htmlEntities:!0,ignoreAttributes:!1,ignoreDeclaration:!0,parseTagValue:!1,trimValues:!1,tagValueProcessor:(u,l)=>l.trim()===""&&l.includes(`
|
||
`)?"":void 0});n.addEntity("#xD","\r"),n.addEntity("#10",`
|
||
`);let o;try{o=n.parse(r,!0)}catch(u){throw u&&typeof u=="object"&&Object.defineProperty(u,"$responseBodyText",{value:r}),u}let i="#text",a=Object.keys(o)[0],s=o[a];return s[i]&&(s[a]=s[i],delete s[i]),A6e(s)}return{}}),i8t=async(t,e)=>{let r=await aT(t,e);return r.Error&&(r.Error.message=r.Error.message??r.Error.Message),r}});var s8t=v(()=>{wWt();SWt();OWt();a8t()});var D4=v(()=>{S5t();vWt();s8t()});function OOn(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function Y_e(t){return{schemeId:"smithy.api#noAuth"}}var u8t,l8t,c8t,pKe=v(()=>{D4();pC();u8t=async(t,e,r)=>({operation:nT(e).operation,region:await dy(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(Y_e(t));break}case"GetId":{e.push(Y_e(t));break}case"GetOpenIdToken":{e.push(Y_e(t));break}case"UnlinkIdentity":{e.push(Y_e(t));break}default:e.push(OOn(t))}return e},c8t=t=>({...G_e(t)})});var d8t,eo,ll=v(()=>{d8t=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),eo={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}});var p8t,f8t=v(()=>{p8t={name:"@aws-sdk/client-cognito-identity",description:"AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native",version:"3.645.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-cognito-identity","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo cognito-identity","test:e2e":"ts-mocha test/**/*.ispec.ts && karma start karma.conf.js"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.645.0","@aws-sdk/client-sts":"3.645.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.645.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.645.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.645.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},devDependencies:{"@aws-sdk/client-iam":"3.645.0","@tsconfig/node16":"16.1.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-cognito-identity"}}});var mKe,hKe,m8t,h8t=v(()=>{mKe={name:"SHA-256"},hKe={name:"HMAC",hash:mKe},m8t=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 a5(){return typeof window<"u"?window:typeof self<"u"?self:EOn}var EOn,gKe=v(()=>{EOn={}});var s5,yKe,bKe=v(()=>{s5=L($be());h8t();gKe();yKe=function(){function t(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return t.prototype.update=function(e){if(!(0,s5.isEmptyData)(e)){var r=(0,s5.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 a5().crypto.subtle.sign(hKe,r,e.toHash).then(function(n){return new Uint8Array(n)})}):(0,s5.isEmptyData)(this.toHash)?Promise.resolve(m8t):Promise.resolve().then(function(){return a5().crypto.subtle.digest(mKe,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){a5().crypto.subtle.importKey("raw",(0,s5.convertToBuffer)(e.secret),hKe,!1,["sign"]).then(r,n)}),this.key.catch(function(){}))},t}()});function g8t(t){if(MOn(t)&&typeof t.crypto.subtle=="object"){var e=t.crypto.subtle;return ROn(e)}return!1}function MOn(t){if(typeof t=="object"&&typeof t.crypto=="object"){var e=t.crypto.getRandomValues;return typeof e=="function"}return!1}function ROn(t){return t&&POn.every(function(e){return typeof t[e]=="function"})}var POn,y8t=v(()=>{POn=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"]});var b8t=v(()=>{y8t()});var _8t,v8t,Q_e,w8t=v(()=>{bKe();_8t=L(C3e());b8t();gKe();v8t=L($be()),Q_e=function(){function t(e){g8t(a5())?this.hash=new yKe(e):this.hash=new _8t.Sha256(e)}return t.prototype.update=function(e,r){this.hash.update((0,v8t.convertToBuffer)(e))},t.prototype.digest=function(){return this.hash.digest()},t.prototype.reset=function(){this.hash.reset()},t}()});var _Ke=v(()=>{w8t();bKe()});var wKe=S((dre,vKe)=>{(function(t,e){typeof dre=="object"&&typeof vKe=="object"?vKe.exports=e():typeof define=="function"&&define.amd?define([],e):typeof dre=="object"?dre.bowser=e():t.bowser=e()})(dre,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(n,o,i){r.o(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:i})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,o){if(1&o&&(n=r(n)),8&o||4&o&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&o&&typeof n!="string")for(var a in n)r.d(i,a,function(s){return n[s]}.bind(null,a));return i},r.n=function(n){var o=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(o,"a",o),o},r.o=function(n,o){return Object.prototype.hasOwnProperty.call(n,o)},r.p="",r(r.s=90)}({17:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=r(18),o=function(){function i(){}return i.getFirstMatch=function(a,s){var u=s.match(a);return u&&u.length>0&&u[1]||""},i.getSecondMatch=function(a,s){var u=s.match(a);return u&&u.length>1&&u[2]||""},i.matchAndReturnConst=function(a,s,u){if(a.test(s))return u},i.getWindowsVersionName=function(a){switch(a){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),s[0]===10)switch(s[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},i.getAndroidVersionName=function(a){var s=a.split(".").splice(0,2).map(function(u){return parseInt(u,10)||0});if(s.push(0),!(s[0]===1&&s[1]<5))return s[0]===1&&s[1]<6?"Cupcake":s[0]===1&&s[1]>=6?"Donut":s[0]===2&&s[1]<2?"Eclair":s[0]===2&&s[1]===2?"Froyo":s[0]===2&&s[1]>2?"Gingerbread":s[0]===3?"Honeycomb":s[0]===4&&s[1]<1?"Ice Cream Sandwich":s[0]===4&&s[1]<4?"Jelly Bean":s[0]===4&&s[1]>=4?"KitKat":s[0]===5?"Lollipop":s[0]===6?"Marshmallow":s[0]===7?"Nougat":s[0]===8?"Oreo":s[0]===9?"Pie":void 0},i.getVersionPrecision=function(a){return a.split(".").length},i.compareVersions=function(a,s,u){u===void 0&&(u=!1);var l=i.getVersionPrecision(a),c=i.getVersionPrecision(s),d=Math.max(l,c),f=0,p=i.map([a,s],function(m){var h=d-i.getVersionPrecision(m),g=m+new Array(h+1).join(".0");return i.map(g.split("."),function(y){return new Array(20-y.length).join("0")+y}).reverse()});for(u&&(f=d-Math.min(l,c)),d-=1;d>=f;){if(p[0][d]>p[1][d])return 1;if(p[0][d]===p[1][d]){if(d===f)return 0;d-=1}else if(p[0][d]<p[1][d])return-1}},i.map=function(a,s){var u,l=[];if(Array.prototype.map)return Array.prototype.map.call(a,s);for(u=0;u<a.length;u+=1)l.push(s(a[u]));return l},i.find=function(a,s){var u,l;if(Array.prototype.find)return Array.prototype.find.call(a,s);for(u=0,l=a.length;u<l;u+=1){var c=a[u];if(s(c,u))return c}},i.assign=function(a){for(var s,u,l=a,c=arguments.length,d=new Array(c>1?c-1:0),f=1;f<c;f++)d[f-1]=arguments[f];if(Object.assign)return Object.assign.apply(Object,[a].concat(d));var p=function(){var m=d[s];typeof m=="object"&&m!==null&&Object.keys(m).forEach(function(h){l[h]=m[h]})};for(s=0,u=d.length;s<u;s+=1)p();return a},i.getBrowserAlias=function(a){return n.BROWSER_ALIASES_MAP[a]},i.getBrowserTypeByAlias=function(a){return n.BROWSER_MAP[a]||""},i}();e.default=o,t.exports=e.default},18:function(t,e,r){"use strict";e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},e.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(91))&&n.__esModule?n:{default:n},i=r(18);function a(u,l){for(var c=0;c<l.length;c++){var d=l[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(u,d.key,d)}}var s=function(){function u(){}var l,c,d;return u.getParser=function(f,p){if(p===void 0&&(p=!1),typeof f!="string")throw new Error("UserAgent should be a string");return new o.default(f,p)},u.parse=function(f){return new o.default(f).getResult()},l=u,d=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}],(c=null)&&a(l.prototype,c),d&&a(l,d),u}();e.default=s,t.exports=e.default},91:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n=u(r(92)),o=u(r(93)),i=u(r(94)),a=u(r(95)),s=u(r(17));function u(c){return c&&c.__esModule?c:{default:c}}var l=function(){function c(f,p){if(p===void 0&&(p=!1),f==null||f==="")throw new Error("UserAgent parameter can't be empty");this._ua=f,this.parsedResult={},p!==!0&&this.parse()}var d=c.prototype;return d.getUA=function(){return this._ua},d.test=function(f){return f.test(this._ua)},d.parseBrowser=function(){var f=this;this.parsedResult.browser={};var p=s.default.find(n.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.browser=p.describe(this.getUA())),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(f){return f?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var f=this;this.parsedResult.os={};var p=s.default.find(o.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.os=p.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(f){var p=this.getOS().name;return f?String(p).toLowerCase()||"":p||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(f){f===void 0&&(f=!1);var p=this.getPlatform().type;return f?String(p).toLowerCase()||"":p||""},d.parsePlatform=function(){var f=this;this.parsedResult.platform={};var p=s.default.find(i.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.platform=p.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(f){return f?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var f=this;this.parsedResult.engine={};var p=s.default.find(a.default,function(m){if(typeof m.test=="function")return m.test(f);if(m.test instanceof Array)return m.test.some(function(h){return f.test(h)});throw new Error("Browser's test function is not valid")});return p&&(this.parsedResult.engine=p.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return s.default.assign({},this.parsedResult)},d.satisfies=function(f){var p=this,m={},h=0,g={},y=0;if(Object.keys(f).forEach(function(R){var N=f[R];typeof N=="string"?(g[R]=N,y+=1):typeof N=="object"&&(m[R]=N,h+=1)}),h>0){var b=Object.keys(m),_=s.default.find(b,function(R){return p.isOS(R)});if(_){var w=this.satisfies(m[_]);if(w!==void 0)return w}var x=s.default.find(b,function(R){return p.isPlatform(R)});if(x){var O=this.satisfies(m[x]);if(O!==void 0)return O}}if(y>0){var E=Object.keys(g),T=s.default.find(E,function(R){return p.isBrowser(R,!0)});if(T!==void 0)return this.compareVersion(g[T])}},d.isBrowser=function(f,p){p===void 0&&(p=!1);var m=this.getBrowserName().toLowerCase(),h=f.toLowerCase(),g=s.default.getBrowserTypeByAlias(h);return p&&g&&(h=g.toLowerCase()),h===m},d.compareVersion=function(f){var p=[0],m=f,h=!1,g=this.getBrowserVersion();if(typeof g=="string")return f[0]===">"||f[0]==="<"?(m=f.substr(1),f[1]==="="?(h=!0,m=f.substr(2)):p=[],f[0]===">"?p.push(1):p.push(-1)):f[0]==="="?m=f.substr(1):f[0]==="~"&&(h=!0,m=f.substr(1)),p.indexOf(s.default.compareVersions(g,m,h))>-1},d.isOS=function(f){return this.getOSName(!0)===String(f).toLowerCase()},d.isPlatform=function(f){return this.getPlatformType(!0)===String(f).toLowerCase()},d.isEngine=function(f){return this.getEngineName(!0)===String(f).toLowerCase()},d.is=function(f,p){return p===void 0&&(p=!1),this.isBrowser(f,p)||this.isOS(f)||this.isPlatform(f)},d.some=function(f){var p=this;return f===void 0&&(f=[]),f.some(function(m){return p.is(m)})},c}();e.default=l,t.exports=e.default},92:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(s){var u={name:"Googlebot"},l=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/opera/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opr\/|opios/i],describe:function(s){var u={name:"Opera"},l=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/SamsungBrowser/i],describe:function(s){var u={name:"Samsung Internet for Android"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Whale/i],describe:function(s){var u={name:"NAVER Whale Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MZBrowser/i],describe:function(s){var u={name:"MZ Browser"},l=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/focus/i],describe:function(s){var u={name:"Focus"},l=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/swing/i],describe:function(s){var u={name:"Swing"},l=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/coast/i],describe:function(s){var u={name:"Opera Coast"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(s){var u={name:"Opera Touch"},l=o.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/yabrowser/i],describe:function(s){var u={name:"Yandex Browser"},l=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/ucbrowser/i],describe:function(s){var u={name:"UC Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/Maxthon|mxios/i],describe:function(s){var u={name:"Maxthon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/epiphany/i],describe:function(s){var u={name:"Epiphany"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/puffin/i],describe:function(s){var u={name:"Puffin"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sleipnir/i],describe:function(s){var u={name:"Sleipnir"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/k-meleon/i],describe:function(s){var u={name:"K-Meleon"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/micromessenger/i],describe:function(s){var u={name:"WeChat"},l=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qqbrowser/i],describe:function(s){var u={name:/qqbrowserlite/i.test(s)?"QQ Browser Lite":"QQ Browser"},l=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/msie|trident/i],describe:function(s){var u={name:"Internet Explorer"},l=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/\sedg\//i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/edg([ea]|ios)/i],describe:function(s){var u={name:"Microsoft Edge"},l=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/vivaldi/i],describe:function(s){var u={name:"Vivaldi"},l=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/seamonkey/i],describe:function(s){var u={name:"SeaMonkey"},l=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/sailfish/i],describe:function(s){var u={name:"Sailfish"},l=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,s);return l&&(u.version=l),u}},{test:[/silk/i],describe:function(s){var u={name:"Amazon Silk"},l=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/phantom/i],describe:function(s){var u={name:"PhantomJS"},l=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/slimerjs/i],describe:function(s){var u={name:"SlimerJS"},l=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u={name:"BlackBerry"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u={name:"WebOS Browser"},l=o.default.getFirstMatch(i,s)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/bada/i],describe:function(s){var u={name:"Bada"},l=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/tizen/i],describe:function(s){var u={name:"Tizen"},l=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/qupzilla/i],describe:function(s){var u={name:"QupZilla"},l=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/firefox|iceweasel|fxios/i],describe:function(s){var u={name:"Firefox"},l=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/electron/i],describe:function(s){var u={name:"Electron"},l=o.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/MiuiBrowser/i],describe:function(s){var u={name:"Miui"},l=o.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/chromium/i],describe:function(s){var u={name:"Chromium"},l=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,s)||o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/chrome|crios|crmo/i],describe:function(s){var u={name:"Chrome"},l=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/GSA/i],describe:function(s){var u={name:"Google Search"},l=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u={name:"Android Browser"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/playstation 4/i],describe:function(s){var u={name:"PlayStation 4"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/safari|applewebkit/i],describe:function(s){var u={name:"Safari"},l=o.default.getFirstMatch(i,s);return l&&(u.version=l),u}},{test:[/.*/i],describe:function(s){var u=s.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(u,s),version:o.default.getSecondMatch(u,s)}}}];e.default=a,t.exports=e.default},93:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/Roku\/DVP/],describe:function(s){var u=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,s);return{name:i.OS_MAP.Roku,version:u}}},{test:[/windows phone/i],describe:function(s){var u=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.WindowsPhone,version:u}}},{test:[/windows /i],describe:function(s){var u=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,s),l=o.default.getWindowsVersionName(u);return{name:i.OS_MAP.Windows,version:u,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(s){var u={name:i.OS_MAP.iOS},l=o.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,s);return l&&(u.version=l),u}},{test:[/macintosh/i],describe:function(s){var u=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,s).replace(/[_\s]/g,"."),l=o.default.getMacOSVersionName(u),c={name:i.OS_MAP.MacOS,version:u};return l&&(c.versionName=l),c}},{test:[/(ipod|iphone|ipad)/i],describe:function(s){var u=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,s).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:u}}},{test:function(s){var u=!s.test(/like android/i),l=s.test(/android/i);return u&&l},describe:function(s){var u=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,s),l=o.default.getAndroidVersionName(u),c={name:i.OS_MAP.Android,version:u};return l&&(c.versionName=l),c}},{test:[/(web|hpw)[o0]s/i],describe:function(s){var u=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,s),l={name:i.OS_MAP.WebOS};return u&&u.length&&(l.version=u),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(s){var u=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,s)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,s)||o.default.getFirstMatch(/\bbb(\d+)/i,s);return{name:i.OS_MAP.BlackBerry,version:u}}},{test:[/bada/i],describe:function(s){var u=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Bada,version:u}}},{test:[/tizen/i],describe:function(s){var u=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.Tizen,version:u}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(s){var u=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,s);return{name:i.OS_MAP.PlayStation4,version:u}}}];e.default=a,t.exports=e.default},94:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(s){var u=o.default.getFirstMatch(/(can-l01)/i,s)&&"Nova",l={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return u&&(l.model=u),l}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){var u=s.test(/ipod|iphone/i),l=s.test(/like (ipod|iphone)/i);return u&&!l},describe:function(s){var u=o.default.getFirstMatch(/(ipod|iphone)/i,s);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:u}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(s){return s.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(s){var u=Number(String(s.getOSVersion()).split(".")[0]);return s.getOSName(!0)==="android"&&u>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(s){return s.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(s){return s.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(s){return s.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(s){return s.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(s){return s.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];e.default=a,t.exports=e.default},95:function(t,e,r){"use strict";e.__esModule=!0,e.default=void 0;var n,o=(n=r(17))&&n.__esModule?n:{default:n},i=r(18),a=[{test:function(s){return s.getBrowserName(!0)==="microsoft edge"},describe:function(s){if(/\sedg\//i.test(s))return{name:i.ENGINE_MAP.Blink};var u=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,s);return{name:i.ENGINE_MAP.EdgeHTML,version:u}}},{test:[/trident/i],describe:function(s){var u={name:i.ENGINE_MAP.Trident},l=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){return s.test(/presto/i)},describe:function(s){var u={name:i.ENGINE_MAP.Presto},l=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:function(s){var u=s.test(/gecko/i),l=s.test(/like gecko/i);return u&&!l},describe:function(s){var u={name:i.ENGINE_MAP.Gecko},l=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(s){var u={name:i.ENGINE_MAP.WebKit},l=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,s);return l&&(u.version=l),u}}];e.default=a,t.exports=e.default}})})});var S8t,eve,SKe=v(()=>{S8t=L(wKe()),eve=({serviceId:t,clientVersion:e})=>async()=>{let r=typeof window<"u"&&window?.navigator?.userAgent?S8t.default.parse(window.navigator.userAgent):void 0,n=[["aws-sdk-js",e],["ua","2.0"],[`os/${r?.os?.name||"other"}`,r?.os?.version],["lang/js"],["md/browser",`${r?.browser?.name??"unknown"}_${r?.browser?.version??"unknown"}`]];return t&&n.push([`api/${t}`,e]),n}});var C8t=v(()=>{});var tve,x8t=v(()=>{tve=t=>()=>Promise.reject(t)});var CKe=v(()=>{C8t();x8t()});var O8t,rve,T8t=v(()=>{O8t=typeof TextEncoder=="function"?new TextEncoder:null,rve=t=>{if(typeof t=="string"){if(O8t)return O8t.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 xKe=v(()=>{T8t()});var OKe,TKe=v(()=>{OKe=t=>new TextEncoder().encode(t)});var E8t=v(()=>{TKe()});var P8t,M8t=v(()=>{P8t=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 R8t=v(()=>{TKe();E8t();M8t()});var q8t,uT,lT,l5,A8t,pre,u5,fre,a1,EKe,I8t,N8t,j8t,B8t,U8t,sT,D8t,$8t,L8t,F8t,k8t,AOn,z8t,H8t=v(()=>{q8t="required",uT="fn",lT="argv",l5="ref",A8t="isSet",pre="booleanEquals",u5="error",fre="endpoint",a1="tree",EKe="PartitionResult",I8t={[q8t]:!1,type:"String"},N8t={[q8t]:!0,default:!1,type:"Boolean"},j8t={[l5]:"Endpoint"},B8t={[uT]:pre,[lT]:[{[l5]:"UseFIPS"},!0]},U8t={[uT]:pre,[lT]:[{[l5]:"UseDualStack"},!0]},sT={},D8t={[uT]:"getAttr",[lT]:[{[l5]:EKe},"supportsFIPS"]},$8t={[uT]:pre,[lT]:[!0,{[uT]:"getAttr",[lT]:[{[l5]:EKe},"supportsDualStack"]}]},L8t=[B8t],F8t=[U8t],k8t=[{[l5]:"Region"}],AOn={version:"1.0",parameters:{Region:I8t,UseDualStack:N8t,UseFIPS:N8t,Endpoint:I8t},rules:[{conditions:[{[uT]:A8t,[lT]:[j8t]}],rules:[{conditions:L8t,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:u5},{conditions:F8t,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:u5},{endpoint:{url:j8t,properties:sT,headers:sT},type:fre}],type:a1},{conditions:[{[uT]:A8t,[lT]:k8t}],rules:[{conditions:[{[uT]:"aws.partition",[lT]:k8t,assign:EKe}],rules:[{conditions:[B8t,U8t],rules:[{conditions:[{[uT]:pre,[lT]:[!0,D8t]},$8t],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:sT,headers:sT},type:fre}],type:a1},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:u5}],type:a1},{conditions:L8t,rules:[{conditions:[{[uT]:pre,[lT]:[D8t,!0]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:sT,headers:sT},type:fre}],type:a1},{error:"FIPS is enabled but this partition does not support FIPS",type:u5}],type:a1},{conditions:F8t,rules:[{conditions:[$8t],rules:[{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:sT,headers:sT},type:fre}],type:a1},{error:"DualStack is enabled but this partition does not support DualStack",type:u5}],type:a1},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:sT,headers:sT},type:fre}],type:a1}],type:a1},{error:"Invalid Configuration: Missing Region",type:u5}]},z8t=AOn});var V8t,J8t=v(()=>{e_e();aF();H8t();V8t=(t,e={})=>Bte(z8t,{endpointParams:t,logger:e.logger});t1.aws=Ute});var K8t,W8t=v(()=>{D4();hF();an();d_e();QK();R8t();pKe();J8t();K8t=t=>({apiVersion:"2014-06-30",base64Decoder:t?.base64Decoder??dF,base64Encoder:t?.base64Encoder??fF,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??V8t,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??l8t,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new I4},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new o5}],logger:t?.logger??new uF,serviceId:t?.serviceId??"Cognito Identity",urlParser:t?.urlParser??sF,utf8Decoder:t?.utf8Decoder??OKe,utf8Encoder:t?.utf8Encoder??P8t})});var G8t,Z8t=v(()=>{G8t=["in-region","cross-region","mobile","standard","legacy"]});var X8t,nve,IOn,Y8t=v(()=>{e1();X8t=L(wKe());Z8t();nve=({defaultsMode:t}={})=>W2t(async()=>{let e=typeof t=="function"?await t():t;switch(e?.toLowerCase()){case"auto":return Promise.resolve(IOn()?"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 ${G8t.join(", ")}, got ${e}`)}}),IOn=()=>{let e=(typeof window<"u"&&window?.navigator?.userAgent?X8t.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return e==="tablet"||e==="mobile"}});var PKe=v(()=>{Y8t()});var Q8t,eGt=v(()=>{f8t();_Ke();SKe();zte();Xte();CKe();xKe();iT();W8t();an();PKe();Q8t=t=>{let e=nve(t),r=()=>e().then(A_e),n=K8t(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??rve,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??eve({serviceId:n.serviceId,clientVersion:p8t.version}),maxAttempts:t?.maxAttempts??oT,region:t?.region??tve("Region is missing"),requestHandler:pF.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||Jte),sha256:t?.sha256??Q_e,streamCollector:t?.streamCollector??e5,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(a_e)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(s_e))}}});var ove,ive,tGt=v(()=>{ove=t=>{let e=async()=>{if(t.region===void 0)throw new Error("Region is missing from runtimeConfig");let r=t.region;return typeof r=="string"?r:r()};return{setRegion(r){e=r},region(){return e}}},ive=t=>({region:t.region()})});var rGt=v(()=>{});var MKe=v(()=>{});var nGt=v(()=>{MKe()});var oGt=v(()=>{nGt();MKe()});var iGt=v(()=>{rGt();oGt()});var RKe=v(()=>{tGt();iGt()});var aGt,sGt,uGt=v(()=>{aGt=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},sGt=t=>({httpHandler:t.httpHandler()})});var lGt=v(()=>{uGt()});var cGt=v(()=>{bd()});var dGt=v(()=>{});var fGt=v(()=>{});function jOn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var ave,pGt=v(()=>{ave=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=jOn(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 mGt=v(()=>{});var hGt=v(()=>{});var gGt=v(()=>{});var AKe=v(()=>{lGt();cGt();dGt();fGt();pGt();mGt();hGt();gGt()});var yGt,bGt,_Gt=v(()=>{yGt=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}}},bGt=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var sve,vGt,wGt=v(()=>{RKe();AKe();an();_Gt();sve=t=>t,vGt=(t,e)=>{let r={...sve(ove(t)),...sve(I_e(t)),...sve(aGt(t)),...sve(yGt(t))};return e.forEach(n=>n.configure(r)),{...t,...ive(r),...N_e(r),...sGt(r),...bGt(r)}}});var _F,uve=v(()=>{E3e();P3e();M3e();J3e();zte();hF();$6e();Li();$_e();an();pKe();ll();eGt();wGt();_F=class extends E4{constructor(...[e]){let r=Q8t(e||{}),n=d8t(r),o=Jbe(n),i=x_e(o),a=l_e(i),s=a,u=m_e(s),l=c8t(u),c=vGt(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(o_e(this.config)),this.middlewareStack.use(D_e(this.config)),this.middlewareStack.use(k_e(this.config)),this.middlewareStack.use(Ube(this.config)),this.middlewareStack.use(zbe(this.config)),this.middlewareStack.use(Vbe(this.config)),this.middlewareStack.use(h_e(this.config,{httpAuthSchemeParametersProvider:u8t,identityProviderConfigProvider:async d=>new n5({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(L_e(this.config))}destroy(){super.destroy()}}});var fy,IKe=v(()=>{an();fy=class t extends r5{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var lve,cve,dve,fve,pve,mve,hve,gve,yve,bve,_ve,NKe=v(()=>{IKe();lve=class t extends fy{constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),this.name="InternalErrorException",this.$fault="server",Object.setPrototypeOf(this,t.prototype)}},cve=class t extends fy{constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),this.name="InvalidParameterException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},dve=class t extends fy{constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),this.name="LimitExceededException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},fve=class t extends fy{constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),this.name="NotAuthorizedException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},pve=class t extends fy{constructor(e){super({name:"ResourceConflictException",$fault:"client",...e}),this.name="ResourceConflictException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},mve=class t extends fy{constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),this.name="TooManyRequestsException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},hve=class t extends fy{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},gve=class t extends fy{constructor(e){super({name:"ExternalServiceException",$fault:"client",...e}),this.name="ExternalServiceException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yve=class t extends fy{constructor(e){super({name:"InvalidIdentityPoolConfigurationException",$fault:"client",...e}),this.name="InvalidIdentityPoolConfigurationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bve=class t extends fy{constructor(e){super({name:"DeveloperUserAlreadyRegisteredException",$fault:"client",...e}),this.name="DeveloperUserAlreadyRegisteredException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_ve=class t extends fy{constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),this.name="ConcurrentModificationException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}}});function lc(t){return{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityService.${t}`}}var SGt,CGt,xGt,OGt,TGt,EGt,PGt,MGt,RGt,AGt,IGt,NGt,jGt,DGt,$Gt,LGt,FGt,kGt,qGt,BGt,UGt,zGt,HGt,VGt,JGt,KGt,WGt,GGt,ZGt,XGt,YGt,QGt,e9t,t9t,r9t,n9t,o9t,i9t,a9t,s9t,u9t,l9t,c9t,d9t,f9t,p9t,sc,$On,LOn,FOn,kOn,qOn,BOn,UOn,zOn,HOn,VOn,JOn,KOn,WOn,GOn,m9t,ZOn,Wi,XOn,uc,Al=v(()=>{D4();AKe();an();IKe();NKe();SGt=async(t,e)=>{let r=lc("CreateIdentityPool"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},CGt=async(t,e)=>{let r=lc("DeleteIdentities"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},xGt=async(t,e)=>{let r=lc("DeleteIdentityPool"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},OGt=async(t,e)=>{let r=lc("DescribeIdentity"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},TGt=async(t,e)=>{let r=lc("DescribeIdentityPool"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},EGt=async(t,e)=>{let r=lc("GetCredentialsForIdentity"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},PGt=async(t,e)=>{let r=lc("GetId"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},MGt=async(t,e)=>{let r=lc("GetIdentityPoolRoles"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},RGt=async(t,e)=>{let r=lc("GetOpenIdToken"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},AGt=async(t,e)=>{let r=lc("GetOpenIdTokenForDeveloperIdentity"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},IGt=async(t,e)=>{let r=lc("GetPrincipalTagAttributeMap"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},NGt=async(t,e)=>{let r=lc("ListIdentities"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},jGt=async(t,e)=>{let r=lc("ListIdentityPools"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},DGt=async(t,e)=>{let r=lc("ListTagsForResource"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},$Gt=async(t,e)=>{let r=lc("LookupDeveloperIdentity"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},LGt=async(t,e)=>{let r=lc("MergeDeveloperIdentities"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},FGt=async(t,e)=>{let r=lc("SetIdentityPoolRoles"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},kGt=async(t,e)=>{let r=lc("SetPrincipalTagAttributeMap"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},qGt=async(t,e)=>{let r=lc("TagResource"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},BGt=async(t,e)=>{let r=lc("UnlinkDeveloperIdentity"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},UGt=async(t,e)=>{let r=lc("UnlinkIdentity"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},zGt=async(t,e)=>{let r=lc("UntagResource"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},HGt=async(t,e)=>{let r=lc("UpdateIdentityPool"),n;return n=JSON.stringify(rn(t)),uc(e,r,"/",void 0,n)},VGt=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},JGt=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},KGt=async(t,e)=>t.statusCode>=300?sc(t,e):(await mF(t.body,e),{$metadata:Wi(t)}),WGt=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=m9t(r,e),{$metadata:Wi(t),...n}},GGt=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},ZGt=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=WOn(r,e),{$metadata:Wi(t),...n}},XGt=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},YGt=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},QGt=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},e9t=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},t9t=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},r9t=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=ZOn(r,e),{$metadata:Wi(t),...n}},n9t=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},o9t=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},i9t=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},a9t=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},s9t=async(t,e)=>t.statusCode>=300?sc(t,e):(await mF(t.body,e),{$metadata:Wi(t)}),u9t=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},l9t=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},c9t=async(t,e)=>t.statusCode>=300?sc(t,e):(await mF(t.body,e),{$metadata:Wi(t)}),d9t=async(t,e)=>t.statusCode>=300?sc(t,e):(await mF(t.body,e),{$metadata:Wi(t)}),f9t=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},p9t=async(t,e)=>{if(t.statusCode>=300)return sc(t,e);let r=await Xc(t.body,e),n={};return n=rn(r),{$metadata:Wi(t),...n}},sc=async(t,e)=>{let r={...t,body:await CWt(t.body,e)},n=xWt(t,r.body);switch(n){case"InternalErrorException":case"com.amazonaws.cognitoidentity#InternalErrorException":throw await kOn(r,e);case"InvalidParameterException":case"com.amazonaws.cognitoidentity#InvalidParameterException":throw await BOn(r,e);case"LimitExceededException":case"com.amazonaws.cognitoidentity#LimitExceededException":throw await UOn(r,e);case"NotAuthorizedException":case"com.amazonaws.cognitoidentity#NotAuthorizedException":throw await zOn(r,e);case"ResourceConflictException":case"com.amazonaws.cognitoidentity#ResourceConflictException":throw await HOn(r,e);case"TooManyRequestsException":case"com.amazonaws.cognitoidentity#TooManyRequestsException":throw await JOn(r,e);case"ResourceNotFoundException":case"com.amazonaws.cognitoidentity#ResourceNotFoundException":throw await VOn(r,e);case"ExternalServiceException":case"com.amazonaws.cognitoidentity#ExternalServiceException":throw await FOn(r,e);case"InvalidIdentityPoolConfigurationException":case"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException":throw await qOn(r,e);case"DeveloperUserAlreadyRegisteredException":case"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException":throw await LOn(r,e);case"ConcurrentModificationException":case"com.amazonaws.cognitoidentity#ConcurrentModificationException":throw await $On(r,e);default:let o=r.body;return XOn({output:t,parsedBody:o,errorCode:n})}},$On=async(t,e)=>{let r=t.body,n=rn(r),o=new _ve({$metadata:Wi(t),...n});return ac(o,r)},LOn=async(t,e)=>{let r=t.body,n=rn(r),o=new bve({$metadata:Wi(t),...n});return ac(o,r)},FOn=async(t,e)=>{let r=t.body,n=rn(r),o=new gve({$metadata:Wi(t),...n});return ac(o,r)},kOn=async(t,e)=>{let r=t.body,n=rn(r),o=new lve({$metadata:Wi(t),...n});return ac(o,r)},qOn=async(t,e)=>{let r=t.body,n=rn(r),o=new yve({$metadata:Wi(t),...n});return ac(o,r)},BOn=async(t,e)=>{let r=t.body,n=rn(r),o=new cve({$metadata:Wi(t),...n});return ac(o,r)},UOn=async(t,e)=>{let r=t.body,n=rn(r),o=new dve({$metadata:Wi(t),...n});return ac(o,r)},zOn=async(t,e)=>{let r=t.body,n=rn(r),o=new fve({$metadata:Wi(t),...n});return ac(o,r)},HOn=async(t,e)=>{let r=t.body,n=rn(r),o=new pve({$metadata:Wi(t),...n});return ac(o,r)},VOn=async(t,e)=>{let r=t.body,n=rn(r),o=new hve({$metadata:Wi(t),...n});return ac(o,r)},JOn=async(t,e)=>{let r=t.body,n=rn(r),o=new mve({$metadata:Wi(t),...n});return ac(o,r)},KOn=(t,e)=>ere(t,{AccessKeyId:ti,Expiration:r=>t5(M_e(R4(r))),SecretKey:ti,SessionToken:ti}),WOn=(t,e)=>ere(t,{Credentials:r=>KOn(r,e),IdentityId:ti}),GOn=(t,e)=>(t||[]).filter(n=>n!=null).map(n=>m9t(n,e)),m9t=(t,e)=>ere(t,{CreationDate:r=>t5(M_e(R4(r))),IdentityId:ti,LastModifiedDate:r=>t5(M_e(R4(r))),Logins:rn}),ZOn=(t,e)=>ere(t,{Identities:r=>GOn(r,e),IdentityPoolId:ti,NextToken:ti}),Wi=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),XOn=R_e(fy),uc=async(t,e,r,n,o)=>{let{hostname:i,protocol:a="https",port:s,path:u}=await t.endpoint(),l={protocol:a,hostname:i,port:s,method:"POST",path:u.endsWith("/")?u.slice(0,-1)+r:u+r,headers:e};return n!==void 0&&(l.hostname=n),o!==void 0&&(l.body=o),new ave(l)}});var vve,jKe=v(()=>{Li();Ki();an();ll();Al();vve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","CreateIdentityPool",{}).n("CognitoIdentityClient","CreateIdentityPoolCommand").f(void 0,void 0).ser(SGt).de(VGt).build(){}});var wve,DKe=v(()=>{Li();Ki();an();ll();Al();wve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentities",{}).n("CognitoIdentityClient","DeleteIdentitiesCommand").f(void 0,void 0).ser(CGt).de(JGt).build(){}});var Sve,$Ke=v(()=>{Li();Ki();an();ll();Al();Sve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DeleteIdentityPool",{}).n("CognitoIdentityClient","DeleteIdentityPoolCommand").f(void 0,void 0).ser(xGt).de(KGt).build(){}});var Cve,LKe=v(()=>{Li();Ki();an();ll();Al();Cve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentity",{}).n("CognitoIdentityClient","DescribeIdentityCommand").f(void 0,void 0).ser(OGt).de(WGt).build(){}});var xve,FKe=v(()=>{Li();Ki();an();ll();Al();xve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","DescribeIdentityPool",{}).n("CognitoIdentityClient","DescribeIdentityPoolCommand").f(void 0,void 0).ser(TGt).de(GGt).build(){}});var c5,kKe=v(()=>{Li();Ki();an();ll();Al();c5=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetCredentialsForIdentity",{}).n("CognitoIdentityClient","GetCredentialsForIdentityCommand").f(void 0,void 0).ser(EGt).de(ZGt).build(){}});var d5,qKe=v(()=>{Li();Ki();an();ll();Al();d5=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetId",{}).n("CognitoIdentityClient","GetIdCommand").f(void 0,void 0).ser(PGt).de(XGt).build(){}});var Ove,BKe=v(()=>{Li();Ki();an();ll();Al();Ove=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetIdentityPoolRoles",{}).n("CognitoIdentityClient","GetIdentityPoolRolesCommand").f(void 0,void 0).ser(MGt).de(YGt).build(){}});var Tve,UKe=v(()=>{Li();Ki();an();ll();Al();Tve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdToken",{}).n("CognitoIdentityClient","GetOpenIdTokenCommand").f(void 0,void 0).ser(RGt).de(QGt).build(){}});var Eve,zKe=v(()=>{Li();Ki();an();ll();Al();Eve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetOpenIdTokenForDeveloperIdentity",{}).n("CognitoIdentityClient","GetOpenIdTokenForDeveloperIdentityCommand").f(void 0,void 0).ser(AGt).de(e9t).build(){}});var Pve,HKe=v(()=>{Li();Ki();an();ll();Al();Pve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","GetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","GetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(IGt).de(t9t).build(){}});var Mve,VKe=v(()=>{Li();Ki();an();ll();Al();Mve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentities",{}).n("CognitoIdentityClient","ListIdentitiesCommand").f(void 0,void 0).ser(NGt).de(r9t).build(){}});var f5,Rve=v(()=>{Li();Ki();an();ll();Al();f5=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListIdentityPools",{}).n("CognitoIdentityClient","ListIdentityPoolsCommand").f(void 0,void 0).ser(jGt).de(n9t).build(){}});var Ave,JKe=v(()=>{Li();Ki();an();ll();Al();Ave=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","ListTagsForResource",{}).n("CognitoIdentityClient","ListTagsForResourceCommand").f(void 0,void 0).ser(DGt).de(o9t).build(){}});var Ive,KKe=v(()=>{Li();Ki();an();ll();Al();Ive=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","LookupDeveloperIdentity",{}).n("CognitoIdentityClient","LookupDeveloperIdentityCommand").f(void 0,void 0).ser($Gt).de(i9t).build(){}});var Nve,WKe=v(()=>{Li();Ki();an();ll();Al();Nve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","MergeDeveloperIdentities",{}).n("CognitoIdentityClient","MergeDeveloperIdentitiesCommand").f(void 0,void 0).ser(LGt).de(a9t).build(){}});var jve,GKe=v(()=>{Li();Ki();an();ll();Al();jve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetIdentityPoolRoles",{}).n("CognitoIdentityClient","SetIdentityPoolRolesCommand").f(void 0,void 0).ser(FGt).de(s9t).build(){}});var Dve,ZKe=v(()=>{Li();Ki();an();ll();Al();Dve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","SetPrincipalTagAttributeMap",{}).n("CognitoIdentityClient","SetPrincipalTagAttributeMapCommand").f(void 0,void 0).ser(kGt).de(u9t).build(){}});var $ve,XKe=v(()=>{Li();Ki();an();ll();Al();$ve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","TagResource",{}).n("CognitoIdentityClient","TagResourceCommand").f(void 0,void 0).ser(qGt).de(l9t).build(){}});var Lve,YKe=v(()=>{Li();Ki();an();ll();Al();Lve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkDeveloperIdentity",{}).n("CognitoIdentityClient","UnlinkDeveloperIdentityCommand").f(void 0,void 0).ser(BGt).de(c9t).build(){}});var Fve,QKe=v(()=>{Li();Ki();an();ll();Al();Fve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UnlinkIdentity",{}).n("CognitoIdentityClient","UnlinkIdentityCommand").f(void 0,void 0).ser(UGt).de(d9t).build(){}});var kve,e5e=v(()=>{Li();Ki();an();ll();Al();kve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UntagResource",{}).n("CognitoIdentityClient","UntagResourceCommand").f(void 0,void 0).ser(zGt).de(f9t).build(){}});var qve,t5e=v(()=>{Li();Ki();an();ll();Al();qve=class extends yr.classBuilder().ep({...eo}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityService","UpdateIdentityPool",{}).n("CognitoIdentityClient","UpdateIdentityPoolCommand").f(void 0,void 0).ser(HGt).de(p9t).build(){}});var YOn,r5e,h9t=v(()=>{an();uve();jKe();DKe();$Ke();LKe();FKe();kKe();qKe();BKe();UKe();zKe();HKe();VKe();Rve();JKe();KKe();WKe();GKe();ZKe();XKe();YKe();QKe();e5e();t5e();YOn={CreateIdentityPoolCommand:vve,DeleteIdentitiesCommand:wve,DeleteIdentityPoolCommand:Sve,DescribeIdentityCommand:Cve,DescribeIdentityPoolCommand:xve,GetCredentialsForIdentityCommand:c5,GetIdCommand:d5,GetIdentityPoolRolesCommand:Ove,GetOpenIdTokenCommand:Tve,GetOpenIdTokenForDeveloperIdentityCommand:Eve,GetPrincipalTagAttributeMapCommand:Pve,ListIdentitiesCommand:Mve,ListIdentityPoolsCommand:f5,ListTagsForResourceCommand:Ave,LookupDeveloperIdentityCommand:Ive,MergeDeveloperIdentitiesCommand:Nve,SetIdentityPoolRolesCommand:jve,SetPrincipalTagAttributeMapCommand:Dve,TagResourceCommand:$ve,UnlinkDeveloperIdentityCommand:Lve,UnlinkIdentityCommand:Fve,UntagResourceCommand:kve,UpdateIdentityPoolCommand:qve},r5e=class extends _F{};P_e(YOn,r5e)});var g9t=v(()=>{jKe();DKe();$Ke();LKe();FKe();kKe();qKe();BKe();UKe();zKe();HKe();VKe();Rve();JKe();KKe();WKe();GKe();ZKe();XKe();YKe();QKe();e5e();t5e()});var y9t=v(()=>{});var yoa,b9t=v(()=>{hF();uve();Rve();yoa=D6e(_F,f5,"NextToken","NextToken","MaxResults")});var _9t=v(()=>{y9t();b9t()});var v9t=v(()=>{NKe()});var w9t=v(()=>{uve();h9t();g9t();_9t();v9t()});var n5e={};Xn(n5e,{CognitoIdentityClient:()=>_F,GetCredentialsForIdentityCommand:()=>c5,GetIdCommand:()=>d5});var o5e=v(()=>{w9t()});function Bve(t){return async()=>{t.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let{GetCredentialsForIdentityCommand:e,CognitoIdentityClient:r}=await Promise.resolve().then(()=>(o5e(),n5e)),{Credentials:{AccessKeyId:n=QOn(t.logger),Expiration:o,SecretKey:i=tTn(t.logger),SessionToken:a}=eTn(t.logger)}=await(t.client??new r(Object.assign({},t.clientConfig??{},{region:t.clientConfig?.region??t.parentClientConfig?.region}))).send(new e({CustomRoleArn:t.customRoleArn,IdentityId:t.identityId,Logins:t.logins?await qbe(t.logins):void 0}));return{identityId:t.identityId,accessKeyId:n,secretAccessKey:i,sessionToken:a,expiration:o}}}function QOn(t){throw new Cm("Response from Amazon Cognito contained no access key ID",{logger:t})}function eTn(t){throw new Cm("Response from Amazon Cognito contained no credentials",{logger:t})}function tTn(t){throw new Cm("Response from Amazon Cognito contained no secret key",{logger:t})}var i5e=v(()=>{e1();x3e()});var a5e,Uve,S9t=v(()=>{a5e="IdentityIds",Uve=class{constructor(e="aws:cognito-identity-ids"){this.dbName=e}getItem(e){return this.withObjectStore("readonly",r=>{let n=r.get(e);return new Promise(o=>{n.onerror=()=>o(null),n.onsuccess=()=>o(n.result?n.result.value:null)})}).catch(()=>null)}removeItem(e){return this.withObjectStore("readwrite",r=>{let n=r.delete(e);return new Promise((o,i)=>{n.onerror=()=>i(n.error),n.onsuccess=()=>o()})})}setItem(e,r){return this.withObjectStore("readwrite",n=>{let o=n.put({id:e,value:r});return new Promise((i,a)=>{o.onerror=()=>a(o.error),o.onsuccess=()=>i()})})}getDb(){let e=self.indexedDB.open(this.dbName,1);return new Promise((r,n)=>{e.onsuccess=()=>{r(e.result)},e.onerror=()=>{n(e.error)},e.onblocked=()=>{n(new Error("Unable to access DB"))},e.onupgradeneeded=()=>{let o=e.result;o.onerror=()=>{n(new Error("Failed to create object store"))},o.createObjectStore(a5e,{keyPath:"id"})}})}withObjectStore(e,r){return this.getDb().then(n=>{let o=n.transaction(a5e,e);return o.oncomplete=()=>n.close(),new Promise((i,a)=>{o.onerror=()=>a(o.error),i(r(o.objectStore(a5e)))}).catch(i=>{throw n.close(),i})})}}});var zve,C9t=v(()=>{zve=class{constructor(e={}){this.store=e}getItem(e){return e in this.store?this.store[e]:null}removeItem(e){delete this.store[e]}setItem(e,r){this.store[e]=r}}});function x9t(){return typeof self=="object"&&self.indexedDB?new Uve:typeof window=="object"&&window.localStorage?window.localStorage:rTn}var rTn,O9t=v(()=>{S9t();C9t();rTn=new zve});function T9t({accountId:t,cache:e=x9t(),client:r,clientConfig:n,customRoleArn:o,identityPoolId:i,logins:a,userIdentifier:s=!a||Object.keys(a).length===0?"ANONYMOUS":void 0,logger:u,parentClientConfig:l}){u?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");let c=s?`aws:cognito-identity-credentials:${i}:${s}`:void 0,d=async()=>{let{GetIdCommand:f,CognitoIdentityClient:p}=await Promise.resolve().then(()=>(o5e(),n5e)),m=r??new p(Object.assign({},n??{},{region:n?.region??l?.region})),h=c&&await e.getItem(c);if(!h){let{IdentityId:g=nTn(u)}=await m.send(new f({AccountId:t,IdentityPoolId:i,Logins:a?await qbe(a):void 0}));h=g,c&&Promise.resolve(e.setItem(c,h)).catch(()=>{})}return d=Bve({client:m,customRoleArn:o,logins:a,identityId:h}),d()};return()=>d().catch(async f=>{throw c&&Promise.resolve(e.removeItem(c)).catch(()=>{}),f})}function nTn(t){throw new Cm("Response from Amazon Cognito contained no identity ID",{logger:t})}var E9t=v(()=>{e1();i5e();O9t();x3e()});var s5e=v(()=>{B2t();U2t();z2t();i5e();E9t()});var oTn,P9t=v(()=>{s5e();oTn=t=>Bve({...t})});var iTn,M9t=v(()=>{s5e();iTn=t=>T9t({...t})});var aTn,sTn,uTn,R9t,A9t=v(()=>{e1();aTn="169.254.170.2",sTn="169.254.170.23",uTn="[fd00:ec2::23]",R9t=(t,e)=>{if(t.protocol!=="https:"&&!(t.hostname===aTn||t.hostname===sTn||t.hostname===uTn)){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 Cm(`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 I9t=v(()=>{});var N9t=v(()=>{I9t()});var j9t=v(()=>{bd()});var D9t=v(()=>{});var $9t=v(()=>{});function lTn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Hve,L9t=v(()=>{Hve=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=lTn(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 F9t=v(()=>{});var k9t=v(()=>{});var q9t=v(()=>{});var B9t=v(()=>{N9t();j9t();D9t();$9t();L9t();F9t();k9t();q9t()});function U9t(t){return new Hve({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 z9t(t,e){let n=await aKt(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 Cm("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:CKt(o.Expiration)}}if(t.statusCode>=400&&t.statusCode<500){let o={};try{o=JSON.parse(n)}catch{}throw Object.assign(new Cm(`Server responded with status: ${t.statusCode}`,{logger:e}),{Code:o.Code,Message:o.Message})}throw new Cm(`Server responded with status: ${t.statusCode}`,{logger:e})}var H9t=v(()=>{e1();B9t();an();C6e()});var V9t,J9t=v(()=>{V9t=(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 u5e,K9t=v(()=>{Xte();e1();A9t();H9t();J9t();u5e=(t={})=>{t.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let e,r=t.credentialsFullUri;if(r)e=r;else throw new Cm("No HTTP credential provider host provided.",{logger:t.logger});let n=new URL(e);R9t(n,t.logger);let o=new pF;return V9t(async()=>{let i=U9t(n);t.authorizationToken&&(i.headers.Authorization=t.authorizationToken);let a=await o.handle(i);return z9t(a.response)},t.maxRetries??3,t.timeout??1e3)}});var W9t=v(()=>{K9t()});function cTn(t){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sts",region:t.region},propertiesExtractor:(e,r)=>({signingProperties:{config:e,context:r}})}}function G9t(t){return{schemeId:"smithy.api#noAuth"}}var Z9t,X9t,dTn,Y9t,l5e=v(()=>{D4();pC();mre();Z9t=async(t,e,r)=>({operation:nT(e).operation,region:await dy(t.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});X9t=t=>{let e=[];switch(t.operation){case"AssumeRoleWithSAML":{e.push(G9t(t));break}case"AssumeRoleWithWebIdentity":{e.push(G9t(t));break}default:e.push(cTn(t))}return e},dTn=t=>({...t,stsClientCtor:hS}),Y9t=t=>{let e=dTn(t);return{...G_e(e)}}});var Q9t,py,cT=v(()=>{Q9t=t=>({...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,useGlobalEndpoint:t.useGlobalEndpoint??!1,defaultSigningName:"sts"}),py={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 t7t,e7t=v(()=>{t7t={name:"@aws-sdk/client-sts",description:"AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native",version:"3.645.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-sts","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"rimraf ./dist-types tsconfig.types.tsbuildinfo && tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo sts",test:"yarn test:unit","test:unit":"jest"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.645.0","@aws-sdk/core":"3.635.0","@aws-sdk/credential-provider-node":"3.645.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.645.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.645.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.4.0","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.15","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.2.0","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.15","@smithy/util-defaults-mode-node":"^3.0.15","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},devDependencies:{"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sts",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-sts"}}});var c5e,d5e=v(()=>{c5e=t=>new TextEncoder().encode(t)});var r7t=v(()=>{d5e()});var n7t,o7t=v(()=>{n7t=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 i7t=v(()=>{d5e();r7t();o7t()});var g7t,Wo,ns,os,wF,vF,og,y7t,b7t,_7t,Il,a7t,dT,p5,p5e,s7t,f5e,v7t,u7t,ig,l7t,w7t,S7t,my,kv,c7t,C7t,x7t,d7t,O7t,f7t,p7t,m7t,h7t,pTn,T7t,E7t=v(()=>{g7t="required",Wo="type",ns="fn",os="argv",wF="ref",vF="booleanEquals",og="stringEquals",y7t="sigv4",b7t="sts",_7t="us-east-1",Il="endpoint",a7t="https://sts.{Region}.{PartitionResult#dnsSuffix}",dT="tree",p5="error",p5e="getAttr",s7t={[g7t]:!1,[Wo]:"String"},f5e={[g7t]:!0,default:!1,[Wo]:"Boolean"},v7t={[wF]:"Endpoint"},u7t={[ns]:"isSet",[os]:[{[wF]:"Region"}]},ig={[wF]:"Region"},l7t={[ns]:"aws.partition",[os]:[ig],assign:"PartitionResult"},w7t={[wF]:"UseFIPS"},S7t={[wF]:"UseDualStack"},my={url:"https://sts.amazonaws.com",properties:{authSchemes:[{name:y7t,signingName:b7t,signingRegion:_7t}]},headers:{}},kv={},c7t={conditions:[{[ns]:og,[os]:[ig,"aws-global"]}],[Il]:my,[Wo]:Il},C7t={[ns]:vF,[os]:[w7t,!0]},x7t={[ns]:vF,[os]:[S7t,!0]},d7t={[ns]:p5e,[os]:[{[wF]:"PartitionResult"},"supportsFIPS"]},O7t={[wF]:"PartitionResult"},f7t={[ns]:vF,[os]:[!0,{[ns]:p5e,[os]:[O7t,"supportsDualStack"]}]},p7t=[{[ns]:"isSet",[os]:[v7t]}],m7t=[C7t],h7t=[x7t],pTn={version:"1.0",parameters:{Region:s7t,UseDualStack:f5e,UseFIPS:f5e,Endpoint:s7t,UseGlobalEndpoint:f5e},rules:[{conditions:[{[ns]:vF,[os]:[{[wF]:"UseGlobalEndpoint"},!0]},{[ns]:"not",[os]:p7t},u7t,l7t,{[ns]:vF,[os]:[w7t,!1]},{[ns]:vF,[os]:[S7t,!1]}],rules:[{conditions:[{[ns]:og,[os]:[ig,"ap-northeast-1"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"ap-south-1"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"ap-southeast-1"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"ap-southeast-2"]}],endpoint:my,[Wo]:Il},c7t,{conditions:[{[ns]:og,[os]:[ig,"ca-central-1"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"eu-central-1"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"eu-north-1"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"eu-west-1"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"eu-west-2"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"eu-west-3"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"sa-east-1"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,_7t]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"us-east-2"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"us-west-1"]}],endpoint:my,[Wo]:Il},{conditions:[{[ns]:og,[os]:[ig,"us-west-2"]}],endpoint:my,[Wo]:Il},{endpoint:{url:a7t,properties:{authSchemes:[{name:y7t,signingName:b7t,signingRegion:"{Region}"}]},headers:kv},[Wo]:Il}],[Wo]:dT},{conditions:p7t,rules:[{conditions:m7t,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[Wo]:p5},{conditions:h7t,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[Wo]:p5},{endpoint:{url:v7t,properties:kv,headers:kv},[Wo]:Il}],[Wo]:dT},{conditions:[u7t],rules:[{conditions:[l7t],rules:[{conditions:[C7t,x7t],rules:[{conditions:[{[ns]:vF,[os]:[!0,d7t]},f7t],rules:[{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:kv,headers:kv},[Wo]:Il}],[Wo]:dT},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[Wo]:p5}],[Wo]:dT},{conditions:m7t,rules:[{conditions:[{[ns]:vF,[os]:[d7t,!0]}],rules:[{conditions:[{[ns]:og,[os]:[{[ns]:p5e,[os]:[O7t,"name"]},"aws-us-gov"]}],endpoint:{url:"https://sts.{Region}.amazonaws.com",properties:kv,headers:kv},[Wo]:Il},{endpoint:{url:"https://sts-fips.{Region}.{PartitionResult#dnsSuffix}",properties:kv,headers:kv},[Wo]:Il}],[Wo]:dT},{error:"FIPS is enabled but this partition does not support FIPS",[Wo]:p5}],[Wo]:dT},{conditions:h7t,rules:[{conditions:[f7t],rules:[{endpoint:{url:"https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:kv,headers:kv},[Wo]:Il}],[Wo]:dT},{error:"DualStack is enabled but this partition does not support DualStack",[Wo]:p5}],[Wo]:dT},c7t,{endpoint:{url:a7t,properties:kv,headers:kv},[Wo]:Il}],[Wo]:dT}],[Wo]:dT},{error:"Invalid Configuration: Missing Region",[Wo]:p5}]},T7t=pTn});var P7t,M7t=v(()=>{e_e();aF();E7t();P7t=(t,e={})=>Bte(T7t,{endpointParams:t,logger:e.logger});t1.aws=Ute});var R7t,A7t=v(()=>{D4();hF();an();d_e();QK();i7t();l5e();M7t();R7t=t=>({apiVersion:"2011-06-15",base64Decoder:t?.base64Decoder??dF,base64Encoder:t?.base64Encoder??fF,disableHostPrefix:t?.disableHostPrefix??!1,endpointProvider:t?.endpointProvider??P7t,extensions:t?.extensions??[],httpAuthSchemeProvider:t?.httpAuthSchemeProvider??X9t,httpAuthSchemes:t?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new I4},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new o5}],logger:t?.logger??new uF,serviceId:t?.serviceId??"STS",urlParser:t?.urlParser??sF,utf8Decoder:t?.utf8Decoder??c5e,utf8Encoder:t?.utf8Encoder??n7t})});var I7t,N7t=v(()=>{e7t();_Ke();SKe();zte();Xte();CKe();xKe();iT();A7t();an();PKe();I7t=t=>{let e=nve(t),r=()=>e().then(A_e),n=R7t(t);return{...n,...t,runtime:"browser",defaultsMode:e,bodyLengthChecker:t?.bodyLengthChecker??rve,credentialDefaultProvider:t?.credentialDefaultProvider??(o=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:t?.defaultUserAgentProvider??eve({serviceId:n.serviceId,clientVersion:t7t.version}),maxAttempts:t?.maxAttempts??oT,region:t?.region??tve("Region is missing"),requestHandler:pF.create(t?.requestHandler??r),retryMode:t?.retryMode??(async()=>(await r()).retryMode||Jte),sha256:t?.sha256??Q_e,streamCollector:t?.streamCollector??e5,useDualstackEndpoint:t?.useDualstackEndpoint??(()=>Promise.resolve(a_e)),useFipsEndpoint:t?.useFipsEndpoint??(()=>Promise.resolve(s_e))}}});var j7t,D7t,$7t=v(()=>{j7t=t=>{let e=t.httpHandler;return{setHttpHandler(r){e=r},httpHandler(){return e},updateHttpClientConfig(r,n){e.updateHttpClientConfig(r,n)},httpHandlerConfigs(){return e.httpHandlerConfigs()}}},D7t=t=>({httpHandler:t.httpHandler()})});var L7t=v(()=>{$7t()});var F7t=v(()=>{bd()});var k7t=v(()=>{});var q7t=v(()=>{});function mTn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var Vve,B7t=v(()=>{Vve=class t{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){let r=new t({...e,headers:{...e.headers}});return r.query&&(r.query=mTn(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 U7t=v(()=>{});var z7t=v(()=>{});var H7t=v(()=>{});var m5e=v(()=>{L7t();F7t();k7t();q7t();B7t();U7t();z7t();H7t()});var V7t,J7t,K7t=v(()=>{V7t=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}}},J7t=t=>({httpAuthSchemes:t.httpAuthSchemes(),httpAuthSchemeProvider:t.httpAuthSchemeProvider(),credentials:t.credentials()})});var Jve,W7t,G7t=v(()=>{RKe();m5e();an();K7t();Jve=t=>t,W7t=(t,e)=>{let r={...Jve(ove(t)),...Jve(I_e(t)),...Jve(j7t(t)),...Jve(V7t(t))};return e.forEach(n=>n.configure(r)),{...t,...ive(r),...N_e(r),...D7t(r),...J7t(r)}}});var hS,mre=v(()=>{E3e();P3e();M3e();J3e();zte();hF();$6e();Li();$_e();an();l5e();cT();N7t();G7t();hS=class extends E4{constructor(...[e]){let r=I7t(e||{}),n=Q9t(r),o=Jbe(n),i=x_e(o),a=l_e(i),s=a,u=m_e(s),l=Y9t(u),c=W7t(l,e?.extensions||[]);super(c),this.config=c,this.middlewareStack.use(o_e(this.config)),this.middlewareStack.use(D_e(this.config)),this.middlewareStack.use(k_e(this.config)),this.middlewareStack.use(Ube(this.config)),this.middlewareStack.use(zbe(this.config)),this.middlewareStack.use(Vbe(this.config)),this.middlewareStack.use(h_e(this.config,{httpAuthSchemeParametersProvider:Z9t,identityProviderConfigProvider:async d=>new n5({"aws.auth#sigv4":d.credentials})})),this.middlewareStack.use(L_e(this.config))}destroy(){super.destroy()}}});var db,Kve=v(()=>{an();db=class t extends r5{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});var hre,gre,yre,bre,_re,vre,wre,Sre,m5,h5e,g5e,y5e,b5e,_5e,v5e,w5e,SF=v(()=>{an();Kve();hre=class t extends db{constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),this.name="ExpiredTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},gre=class t extends db{constructor(e){super({name:"MalformedPolicyDocumentException",$fault:"client",...e}),this.name="MalformedPolicyDocumentException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},yre=class t extends db{constructor(e){super({name:"PackedPolicyTooLargeException",$fault:"client",...e}),this.name="PackedPolicyTooLargeException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},bre=class t extends db{constructor(e){super({name:"RegionDisabledException",$fault:"client",...e}),this.name="RegionDisabledException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},_re=class t extends db{constructor(e){super({name:"IDPRejectedClaimException",$fault:"client",...e}),this.name="IDPRejectedClaimException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},vre=class t extends db{constructor(e){super({name:"InvalidIdentityTokenException",$fault:"client",...e}),this.name="InvalidIdentityTokenException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},wre=class t extends db{constructor(e){super({name:"IDPCommunicationErrorException",$fault:"client",...e}),this.name="IDPCommunicationErrorException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},Sre=class t extends db{constructor(e){super({name:"InvalidAuthorizationMessageException",$fault:"client",...e}),this.name="InvalidAuthorizationMessageException",this.$fault="client",Object.setPrototypeOf(this,t.prototype)}},m5=t=>({...t,...t.SecretAccessKey&&{SecretAccessKey:E_e}}),h5e=t=>({...t,...t.Credentials&&{Credentials:m5(t.Credentials)}}),g5e=t=>({...t,...t.SAMLAssertion&&{SAMLAssertion:E_e}}),y5e=t=>({...t,...t.Credentials&&{Credentials:m5(t.Credentials)}}),b5e=t=>({...t,...t.WebIdentityToken&&{WebIdentityToken:E_e}}),_5e=t=>({...t,...t.Credentials&&{Credentials:m5(t.Credentials)}}),v5e=t=>({...t,...t.Credentials&&{Credentials:m5(t.Credentials)}}),w5e=t=>({...t,...t.Credentials&&{Credentials:m5(t.Credentials)}})});var Z7t,X7t,Y7t,Q7t,eZt,tZt,rZt,nZt,oZt,iZt,aZt,sZt,uZt,lZt,cZt,dZt,CF,hTn,gTn,yTn,bTn,_Tn,vTn,wTn,STn,CTn,xTn,OTn,TTn,ETn,PTn,MTn,RTn,Wve,ATn,ITn,NTn,jTn,DTn,fZt,Z5e,$Tn,LTn,FTn,Cre,kTn,qTn,BTn,UTn,zTn,HTn,VTn,JTn,KTn,WTn,GTn,ZTn,XTn,YTn,hy,QTn,xF,OF,TF,EF,h5,eEn,S5e,s1,tEn,rEn,g5,u1,y5,fb,C5e,nEn,x5e,pb,O5e,T5e,E5e,P5e,M5e,oEn,iEn,aEn,sEn,R5e,A5e,I5e,N5e,gS,yS,j5e,D5e,$5e,L5e,bS,F5e,l1,b5,k5e,q5e,B5e,U5e,_S,_5,z5e,H5e,v5,w5,V5e,J5e,PF,K5e,W5e,G5e,Nl,MF,uEn,c1=v(()=>{D4();m5e();an();SF();Kve();Z7t=async(t,e)=>{let r=OF,n;return n=MF({...CTn(t,e),[EF]:eEn,[PF]:TF}),xF(e,r,"/",void 0,n)},X7t=async(t,e)=>{let r=OF,n;return n=MF({...xTn(t,e),[EF]:tEn,[PF]:TF}),xF(e,r,"/",void 0,n)},Y7t=async(t,e)=>{let r=OF,n;return n=MF({...OTn(t,e),[EF]:rEn,[PF]:TF}),xF(e,r,"/",void 0,n)},Q7t=async(t,e)=>{let r=OF,n;return n=MF({...TTn(t,e),[EF]:nEn,[PF]:TF}),xF(e,r,"/",void 0,n)},eZt=async(t,e)=>{let r=OF,n;return n=MF({...ETn(t,e),[EF]:oEn,[PF]:TF}),xF(e,r,"/",void 0,n)},tZt=async(t,e)=>{let r=OF,n;return n=MF({...PTn(t,e),[EF]:iEn,[PF]:TF}),xF(e,r,"/",void 0,n)},rZt=async(t,e)=>{let r=OF,n;return n=MF({...MTn(t,e),[EF]:aEn,[PF]:TF}),xF(e,r,"/",void 0,n)},nZt=async(t,e)=>{let r=OF,n;return n=MF({...RTn(t,e),[EF]:sEn,[PF]:TF}),xF(e,r,"/",void 0,n)},oZt=async(t,e)=>{if(t.statusCode>=300)return CF(t,e);let r=await aT(t.body,e),n={};return n=$Tn(r.AssumeRoleResult,e),{$metadata:hy(t),...n}},iZt=async(t,e)=>{if(t.statusCode>=300)return CF(t,e);let r=await aT(t.body,e),n={};return n=LTn(r.AssumeRoleWithSAMLResult,e),{$metadata:hy(t),...n}},aZt=async(t,e)=>{if(t.statusCode>=300)return CF(t,e);let r=await aT(t.body,e),n={};return n=FTn(r.AssumeRoleWithWebIdentityResult,e),{$metadata:hy(t),...n}},sZt=async(t,e)=>{if(t.statusCode>=300)return CF(t,e);let r=await aT(t.body,e),n={};return n=kTn(r.DecodeAuthorizationMessageResult,e),{$metadata:hy(t),...n}},uZt=async(t,e)=>{if(t.statusCode>=300)return CF(t,e);let r=await aT(t.body,e),n={};return n=UTn(r.GetAccessKeyInfoResult,e),{$metadata:hy(t),...n}},lZt=async(t,e)=>{if(t.statusCode>=300)return CF(t,e);let r=await aT(t.body,e),n={};return n=zTn(r.GetCallerIdentityResult,e),{$metadata:hy(t),...n}},cZt=async(t,e)=>{if(t.statusCode>=300)return CF(t,e);let r=await aT(t.body,e),n={};return n=HTn(r.GetFederationTokenResult,e),{$metadata:hy(t),...n}},dZt=async(t,e)=>{if(t.statusCode>=300)return CF(t,e);let r=await aT(t.body,e),n={};return n=VTn(r.GetSessionTokenResult,e),{$metadata:hy(t),...n}},CF=async(t,e)=>{let r={...t,body:await i8t(t.body,e)},n=uEn(t,r.body);switch(n){case"ExpiredTokenException":case"com.amazonaws.sts#ExpiredTokenException":throw await hTn(r,e);case"MalformedPolicyDocument":case"com.amazonaws.sts#MalformedPolicyDocumentException":throw await vTn(r,e);case"PackedPolicyTooLarge":case"com.amazonaws.sts#PackedPolicyTooLargeException":throw await wTn(r,e);case"RegionDisabledException":case"com.amazonaws.sts#RegionDisabledException":throw await STn(r,e);case"IDPRejectedClaim":case"com.amazonaws.sts#IDPRejectedClaimException":throw await yTn(r,e);case"InvalidIdentityToken":case"com.amazonaws.sts#InvalidIdentityTokenException":throw await _Tn(r,e);case"IDPCommunicationError":case"com.amazonaws.sts#IDPCommunicationErrorException":throw await gTn(r,e);case"InvalidAuthorizationMessageException":case"com.amazonaws.sts#InvalidAuthorizationMessageException":throw await bTn(r,e);default:let o=r.body;return QTn({output:t,parsedBody:o.Error,errorCode:n})}},hTn=async(t,e)=>{let r=t.body,n=qTn(r.Error,e),o=new hre({$metadata:hy(t),...n});return ac(o,r)},gTn=async(t,e)=>{let r=t.body,n=JTn(r.Error,e),o=new wre({$metadata:hy(t),...n});return ac(o,r)},yTn=async(t,e)=>{let r=t.body,n=KTn(r.Error,e),o=new _re({$metadata:hy(t),...n});return ac(o,r)},bTn=async(t,e)=>{let r=t.body,n=WTn(r.Error,e),o=new Sre({$metadata:hy(t),...n});return ac(o,r)},_Tn=async(t,e)=>{let r=t.body,n=GTn(r.Error,e),o=new vre({$metadata:hy(t),...n});return ac(o,r)},vTn=async(t,e)=>{let r=t.body,n=ZTn(r.Error,e),o=new gre({$metadata:hy(t),...n});return ac(o,r)},wTn=async(t,e)=>{let r=t.body,n=XTn(r.Error,e),o=new yre({$metadata:hy(t),...n});return ac(o,r)},STn=async(t,e)=>{let r=t.body,n=YTn(r.Error,e),o=new bre({$metadata:hy(t),...n});return ac(o,r)},CTn=(t,e)=>{let r={};if(t[l1]!=null&&(r[l1]=t[l1]),t[b5]!=null&&(r[b5]=t[b5]),t[yS]!=null){let n=Wve(t[yS],e);t[yS]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[gS]!=null&&(r[gS]=t[gS]),t[pb]!=null&&(r[pb]=t[pb]),t[v5]!=null){let n=fZt(t[v5],e);t[v5]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}if(t[V5e]!=null){let n=DTn(t[V5e],e);t[V5e]?.length===0&&(r.TransitiveTagKeys=[]),Object.entries(n).forEach(([o,i])=>{let a=`TransitiveTagKeys.${o}`;r[a]=i})}if(t[T5e]!=null&&(r[T5e]=t[T5e]),t[_5]!=null&&(r[_5]=t[_5]),t[w5]!=null&&(r[w5]=t[w5]),t[_S]!=null&&(r[_S]=t[_S]),t[$5e]!=null){let n=NTn(t[$5e],e);t[$5e]?.length===0&&(r.ProvidedContexts=[]),Object.entries(n).forEach(([o,i])=>{let a=`ProvidedContexts.${o}`;r[a]=i})}return r},xTn=(t,e)=>{let r={};if(t[l1]!=null&&(r[l1]=t[l1]),t[j5e]!=null&&(r[j5e]=t[j5e]),t[B5e]!=null&&(r[B5e]=t[B5e]),t[yS]!=null){let n=Wve(t[yS],e);t[yS]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[gS]!=null&&(r[gS]=t[gS]),t[pb]!=null&&(r[pb]=t[pb]),r},OTn=(t,e)=>{let r={};if(t[l1]!=null&&(r[l1]=t[l1]),t[b5]!=null&&(r[b5]=t[b5]),t[W5e]!=null&&(r[W5e]=t[W5e]),t[L5e]!=null&&(r[L5e]=t[L5e]),t[yS]!=null){let n=Wve(t[yS],e);t[yS]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}return t[gS]!=null&&(r[gS]=t[gS]),t[pb]!=null&&(r[pb]=t[pb]),r},TTn=(t,e)=>{let r={};return t[E5e]!=null&&(r[E5e]=t[E5e]),r},ETn=(t,e)=>{let r={};return t[h5]!=null&&(r[h5]=t[h5]),r},PTn=(t,e)=>({}),MTn=(t,e)=>{let r={};if(t[I5e]!=null&&(r[I5e]=t[I5e]),t[gS]!=null&&(r[gS]=t[gS]),t[yS]!=null){let n=Wve(t[yS],e);t[yS]?.length===0&&(r.PolicyArns=[]),Object.entries(n).forEach(([o,i])=>{let a=`PolicyArns.${o}`;r[a]=i})}if(t[pb]!=null&&(r[pb]=t[pb]),t[v5]!=null){let n=fZt(t[v5],e);t[v5]?.length===0&&(r.Tags=[]),Object.entries(n).forEach(([o,i])=>{let a=`Tags.${o}`;r[a]=i})}return r},RTn=(t,e)=>{let r={};return t[pb]!=null&&(r[pb]=t[pb]),t[_5]!=null&&(r[_5]=t[_5]),t[w5]!=null&&(r[w5]=t[w5]),r},Wve=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=ATn(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},ATn=(t,e)=>{let r={};return t[G5e]!=null&&(r[G5e]=t[G5e]),r},ITn=(t,e)=>{let r={};return t[D5e]!=null&&(r[D5e]=t[D5e]),t[C5e]!=null&&(r[C5e]=t[C5e]),r},NTn=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=ITn(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},jTn=(t,e)=>{let r={};return t[A5e]!=null&&(r[A5e]=t[A5e]),t[K5e]!=null&&(r[K5e]=t[K5e]),r},DTn=(t,e)=>{let r={},n=1;for(let o of t)o!==null&&(r[`member.${n}`]=o,n++);return r},fZt=(t,e)=>{let r={},n=1;for(let o of t){if(o===null)continue;let i=jTn(o,e);Object.entries(i).forEach(([a,s])=>{r[`member.${n}.${a}`]=s}),n++}return r},Z5e=(t,e)=>{let r={};return t[S5e]!=null&&(r[S5e]=ti(t[S5e])),t[u1]!=null&&(r[u1]=ti(t[u1])),r},$Tn=(t,e)=>{let r={};return t[fb]!=null&&(r[fb]=Cre(t[fb],e)),t[s1]!=null&&(r[s1]=Z5e(t[s1],e)),t[bS]!=null&&(r[bS]=Qte(t[bS])),t[_S]!=null&&(r[_S]=ti(t[_S])),r},LTn=(t,e)=>{let r={};return t[fb]!=null&&(r[fb]=Cre(t[fb],e)),t[s1]!=null&&(r[s1]=Z5e(t[s1],e)),t[bS]!=null&&(r[bS]=Qte(t[bS])),t[k5e]!=null&&(r[k5e]=ti(t[k5e])),t[z5e]!=null&&(r[z5e]=ti(t[z5e])),t[R5e]!=null&&(r[R5e]=ti(t[R5e])),t[y5]!=null&&(r[y5]=ti(t[y5])),t[N5e]!=null&&(r[N5e]=ti(t[N5e])),t[_S]!=null&&(r[_S]=ti(t[_S])),r},FTn=(t,e)=>{let r={};return t[fb]!=null&&(r[fb]=Cre(t[fb],e)),t[U5e]!=null&&(r[U5e]=ti(t[U5e])),t[s1]!=null&&(r[s1]=Z5e(t[s1],e)),t[bS]!=null&&(r[bS]=Qte(t[bS])),t[F5e]!=null&&(r[F5e]=ti(t[F5e])),t[y5]!=null&&(r[y5]=ti(t[y5])),t[_S]!=null&&(r[_S]=ti(t[_S])),r},Cre=(t,e)=>{let r={};return t[h5]!=null&&(r[h5]=ti(t[h5])),t[q5e]!=null&&(r[q5e]=ti(t[q5e])),t[H5e]!=null&&(r[H5e]=ti(t[H5e])),t[O5e]!=null&&(r[O5e]=t5(xKt(t[O5e]))),r},kTn=(t,e)=>{let r={};return t[x5e]!=null&&(r[x5e]=ti(t[x5e])),r},qTn=(t,e)=>{let r={};return t[Nl]!=null&&(r[Nl]=ti(t[Nl])),r},BTn=(t,e)=>{let r={};return t[M5e]!=null&&(r[M5e]=ti(t[M5e])),t[u1]!=null&&(r[u1]=ti(t[u1])),r},UTn=(t,e)=>{let r={};return t[g5]!=null&&(r[g5]=ti(t[g5])),r},zTn=(t,e)=>{let r={};return t[J5e]!=null&&(r[J5e]=ti(t[J5e])),t[g5]!=null&&(r[g5]=ti(t[g5])),t[u1]!=null&&(r[u1]=ti(t[u1])),r},HTn=(t,e)=>{let r={};return t[fb]!=null&&(r[fb]=Cre(t[fb],e)),t[P5e]!=null&&(r[P5e]=BTn(t[P5e],e)),t[bS]!=null&&(r[bS]=Qte(t[bS])),r},VTn=(t,e)=>{let r={};return t[fb]!=null&&(r[fb]=Cre(t[fb],e)),r},JTn=(t,e)=>{let r={};return t[Nl]!=null&&(r[Nl]=ti(t[Nl])),r},KTn=(t,e)=>{let r={};return t[Nl]!=null&&(r[Nl]=ti(t[Nl])),r},WTn=(t,e)=>{let r={};return t[Nl]!=null&&(r[Nl]=ti(t[Nl])),r},GTn=(t,e)=>{let r={};return t[Nl]!=null&&(r[Nl]=ti(t[Nl])),r},ZTn=(t,e)=>{let r={};return t[Nl]!=null&&(r[Nl]=ti(t[Nl])),r},XTn=(t,e)=>{let r={};return t[Nl]!=null&&(r[Nl]=ti(t[Nl])),r},YTn=(t,e)=>{let r={};return t[Nl]!=null&&(r[Nl]=ti(t[Nl])),r},hy=t=>({httpStatusCode:t.statusCode,requestId:t.headers["x-amzn-requestid"]??t.headers["x-amzn-request-id"]??t.headers["x-amz-request-id"],extendedRequestId:t.headers["x-amz-id-2"],cfId:t.headers["x-amz-cf-id"]}),QTn=R_e(db),xF=async(t,e,r,n,o)=>{let{hostname:i,protocol:a="https",port:s,path:u}=await t.endpoint(),l={protocol:a,hostname:i,port:s,method:"POST",path:u.endsWith("/")?u.slice(0,-1)+r:u+r,headers:e};return n!==void 0&&(l.hostname=n),o!==void 0&&(l.body=o),new Vve(l)},OF={"content-type":"application/x-www-form-urlencoded"},TF="2011-06-15",EF="Action",h5="AccessKeyId",eEn="AssumeRole",S5e="AssumedRoleId",s1="AssumedRoleUser",tEn="AssumeRoleWithSAML",rEn="AssumeRoleWithWebIdentity",g5="Account",u1="Arn",y5="Audience",fb="Credentials",C5e="ContextAssertion",nEn="DecodeAuthorizationMessage",x5e="DecodedMessage",pb="DurationSeconds",O5e="Expiration",T5e="ExternalId",E5e="EncodedMessage",P5e="FederatedUser",M5e="FederatedUserId",oEn="GetAccessKeyInfo",iEn="GetCallerIdentity",aEn="GetFederationToken",sEn="GetSessionToken",R5e="Issuer",A5e="Key",I5e="Name",N5e="NameQualifier",gS="Policy",yS="PolicyArns",j5e="PrincipalArn",D5e="ProviderArn",$5e="ProvidedContexts",L5e="ProviderId",bS="PackedPolicySize",F5e="Provider",l1="RoleArn",b5="RoleSessionName",k5e="Subject",q5e="SecretAccessKey",B5e="SAMLAssertion",U5e="SubjectFromWebIdentityToken",_S="SourceIdentity",_5="SerialNumber",z5e="SubjectType",H5e="SessionToken",v5="Tags",w5="TokenCode",V5e="TransitiveTagKeys",J5e="UserId",PF="Version",K5e="Value",W5e="WebIdentityToken",G5e="arn",Nl="message",MF=t=>Object.entries(t).map(([e,r])=>j_e(e)+"="+j_e(r)).join("&"),uEn=(t,e)=>{if(e.Error?.Code!==void 0)return e.Error.Code;if(t.statusCode==404)return"NotFound"}});var d1,Gve=v(()=>{Li();Ki();an();cT();SF();c1();d1=class extends yr.classBuilder().ep({...py}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRole",{}).n("STSClient","AssumeRoleCommand").f(void 0,h5e).ser(Z7t).de(oZt).build(){}});var xre,X5e=v(()=>{Li();Ki();an();cT();SF();c1();xre=class extends yr.classBuilder().ep({...py}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithSAML",{}).n("STSClient","AssumeRoleWithSAMLCommand").f(g5e,y5e).ser(X7t).de(iZt).build(){}});var $4,Zve=v(()=>{Li();Ki();an();cT();SF();c1();$4=class extends yr.classBuilder().ep({...py}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","AssumeRoleWithWebIdentity",{}).n("STSClient","AssumeRoleWithWebIdentityCommand").f(b5e,_5e).ser(Y7t).de(aZt).build(){}});var Ore,Y5e=v(()=>{Li();Ki();an();cT();c1();Ore=class extends yr.classBuilder().ep({...py}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","DecodeAuthorizationMessage",{}).n("STSClient","DecodeAuthorizationMessageCommand").f(void 0,void 0).ser(Q7t).de(sZt).build(){}});var Tre,Q5e=v(()=>{Li();Ki();an();cT();c1();Tre=class extends yr.classBuilder().ep({...py}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetAccessKeyInfo",{}).n("STSClient","GetAccessKeyInfoCommand").f(void 0,void 0).ser(eZt).de(uZt).build(){}});var Ere,eWe=v(()=>{Li();Ki();an();cT();c1();Ere=class extends yr.classBuilder().ep({...py}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetCallerIdentity",{}).n("STSClient","GetCallerIdentityCommand").f(void 0,void 0).ser(tZt).de(lZt).build(){}});var Pre,tWe=v(()=>{Li();Ki();an();cT();SF();c1();Pre=class extends yr.classBuilder().ep({...py}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetFederationToken",{}).n("STSClient","GetFederationTokenCommand").f(void 0,v5e).ser(rZt).de(cZt).build(){}});var Mre,rWe=v(()=>{Li();Ki();an();cT();SF();c1();Mre=class extends yr.classBuilder().ep({...py}).m(function(e,r,n,o){return[Tr(n,this.serialize,this.deserialize),Er(n,e.getEndpointParameterInstructions())]}).s("AWSSecurityTokenServiceV20110615","GetSessionToken",{}).n("STSClient","GetSessionTokenCommand").f(void 0,w5e).ser(nZt).de(dZt).build(){}});var lEn,Xve,pZt=v(()=>{an();Gve();X5e();Zve();Y5e();Q5e();eWe();tWe();rWe();mre();lEn={AssumeRoleCommand:d1,AssumeRoleWithSAMLCommand:xre,AssumeRoleWithWebIdentityCommand:$4,DecodeAuthorizationMessageCommand:Ore,GetAccessKeyInfoCommand:Tre,GetCallerIdentityCommand:Ere,GetFederationTokenCommand:Pre,GetSessionTokenCommand:Mre},Xve=class extends hS{};P_e(lEn,Xve)});var mZt=v(()=>{Gve();X5e();Zve();Y5e();Q5e();eWe();tWe();rWe()});var hZt=v(()=>{SF()});var gZt,yZt,bZt,_Zt,vZt,wZt,SZt=v(()=>{Gve();Zve();gZt="us-east-1",yZt=t=>{if(typeof t?.Arn=="string"){let e=t.Arn.split(":");if(e.length>4&&e[4]!=="")return e[4]}},bZt=async(t,e,r)=>{let n=typeof t=="function"?await t():t,o=typeof e=="function"?await e():e;return r?.debug?.("@aws-sdk/client-sts::resolveRegion","accepting first of:",`${n} (provider)`,`${o} (parent client)`,`${gZt} (STS default)`),n??o??gZt},_Zt=(t,e)=>{let r,n;return async(o,i)=>{if(n=o,!r){let{logger:l=t?.parentClientConfig?.logger,region:c,requestHandler:d=t?.parentClientConfig?.requestHandler,credentialProviderLogger:f}=t,p=await bZt(c,t?.parentClientConfig?.region,f),m=!wZt(d);r=new e({credentialDefaultProvider:()=>async()=>n,region:p,requestHandler:m?d:void 0,logger:l})}let{Credentials:a,AssumedRoleUser:s}=await r.send(new d1(i));if(!a||!a.AccessKeyId||!a.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRole call with role ${i.RoleArn}`);let u=yZt(s);return{accessKeyId:a.AccessKeyId,secretAccessKey:a.SecretAccessKey,sessionToken:a.SessionToken,expiration:a.Expiration,...a.CredentialScope&&{credentialScope:a.CredentialScope},...u&&{accountId:u}}}},vZt=(t,e)=>{let r;return async n=>{if(!r){let{logger:s=t?.parentClientConfig?.logger,region:u,requestHandler:l=t?.parentClientConfig?.requestHandler,credentialProviderLogger:c}=t,d=await bZt(u,t?.parentClientConfig?.region,c),f=!wZt(l);r=new e({region:d,requestHandler:f?l:void 0,logger:s})}let{Credentials:o,AssumedRoleUser:i}=await r.send(new $4(n));if(!o||!o.AccessKeyId||!o.SecretAccessKey)throw new Error(`Invalid response from STS.assumeRoleWithWebIdentity call with role ${n.RoleArn}`);let a=yZt(i);return{accessKeyId:o.AccessKeyId,secretAccessKey:o.SecretAccessKey,sessionToken:o.SessionToken,expiration:o.Expiration,...o.CredentialScope&&{credentialScope:o.CredentialScope},...a&&{accountId:a}}}},wZt=t=>t?.metadata?.handlerProtocol==="h2"});var CZt,xZt,OZt,cEn,TZt=v(()=>{SZt();mre();CZt=(t,e)=>e?class extends t{constructor(n){super(n);for(let o of e)this.middlewareStack.use(o)}}:t,xZt=(t={},e)=>_Zt(t,CZt(hS,e)),OZt=(t={},e)=>vZt(t,CZt(hS,e)),cEn=t=>e=>t({roleAssumer:xZt(e),roleAssumerWithWebIdentity:OZt(e),...e})});var EZt={};Xn(EZt,{$Command:()=>yr,AssumeRoleCommand:()=>d1,AssumeRoleResponseFilterSensitiveLog:()=>h5e,AssumeRoleWithSAMLCommand:()=>xre,AssumeRoleWithSAMLRequestFilterSensitiveLog:()=>g5e,AssumeRoleWithSAMLResponseFilterSensitiveLog:()=>y5e,AssumeRoleWithWebIdentityCommand:()=>$4,AssumeRoleWithWebIdentityRequestFilterSensitiveLog:()=>b5e,AssumeRoleWithWebIdentityResponseFilterSensitiveLog:()=>_5e,CredentialsFilterSensitiveLog:()=>m5,DecodeAuthorizationMessageCommand:()=>Ore,ExpiredTokenException:()=>hre,GetAccessKeyInfoCommand:()=>Tre,GetCallerIdentityCommand:()=>Ere,GetFederationTokenCommand:()=>Pre,GetFederationTokenResponseFilterSensitiveLog:()=>v5e,GetSessionTokenCommand:()=>Mre,GetSessionTokenResponseFilterSensitiveLog:()=>w5e,IDPCommunicationErrorException:()=>wre,IDPRejectedClaimException:()=>_re,InvalidAuthorizationMessageException:()=>Sre,InvalidIdentityTokenException:()=>vre,MalformedPolicyDocumentException:()=>gre,PackedPolicyTooLargeException:()=>yre,RegionDisabledException:()=>bre,STS:()=>Xve,STSClient:()=>hS,STSServiceException:()=>db,__Client:()=>E4,decorateDefaultCredentialProvider:()=>cEn,getDefaultRoleAssumer:()=>xZt,getDefaultRoleAssumerWithWebIdentity:()=>OZt});var nWe=v(()=>{mre();pZt();mZt();hZt();TZt();Kve()});var PZt={};Xn(PZt,{AssumeRoleCommand:()=>d1,STSClient:()=>hS});var MZt=v(()=>{nWe()});var dEn,RZt=v(()=>{e1();dEn=t=>{let e;return async()=>{t.logger?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");let r={...t.params,RoleSessionName:t.params.RoleSessionName??"aws-sdk-js-"+Date.now()};if(r?.SerialNumber){if(!t.mfaCodeProvider)throw new Cm("Temporary credential requires multi-factor authentication, but no MFA code callback was provided.",{tryNextLink:!1,logger:t.logger});r.TokenCode=await t.mfaCodeProvider(r?.SerialNumber)}let{AssumeRoleCommand:n,STSClient:o}=await Promise.resolve().then(()=>(MZt(),PZt));if(e||(e=new o({...t.clientConfig,credentials:t.masterCredentials})),t.clientPlugins)for(let a of t.clientPlugins)e.middlewareStack.use(a);let{Credentials:i}=await e.send(new n(r));if(!i||!i.AccessKeyId||!i.SecretAccessKey)throw new Cm(`Invalid response from STS.assumeRole call with role ${r.RoleArn}`,{logger:t.logger});return{accessKeyId:i.AccessKeyId,secretAccessKey:i.SecretAccessKey,sessionToken:i.SessionToken,expiration:i.Expiration,credentialScope:i.CredentialScope}}}});var AZt=v(()=>{});var IZt,NZt=v(()=>{IZt=t=>async()=>{t.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:e,roleSessionName:r,webIdentityToken:n,providerId:o,policyArns:i,policy:a,durationSeconds:s}=t,{roleAssumerWithWebIdentity:u}=t;if(!u){let{getDefaultRoleAssumerWithWebIdentity:l}=await Promise.resolve().then(()=>(nWe(),EZt));u=l({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:t.parentClientConfig},t.clientPlugins)}return u({RoleArn:e,RoleSessionName:r??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:n,ProviderId:o,PolicyArns:i,Policy:a,DurationSeconds:s})}});var jZt=v(()=>{AZt();NZt()});var fEn,DZt=v(()=>{jZt();fEn=t=>IZt({...t})});var $Zt={};Xn($Zt,{fromCognitoIdentity:()=>oTn,fromCognitoIdentityPool:()=>iTn,fromHttp:()=>u5e,fromTemporaryCredentials:()=>dEn,fromWebToken:()=>fEn});var LZt=v(()=>{P9t();M9t();W9t();RZt();DZt()});var oWe=S(Eu=>{"use strict";Eu.HttpAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(Eu.HttpAuthLocation||(Eu.HttpAuthLocation={}));Eu.HttpApiKeyAuthLocation=void 0;(function(t){t.HEADER="header",t.QUERY="query"})(Eu.HttpApiKeyAuthLocation||(Eu.HttpApiKeyAuthLocation={}));Eu.EndpointURLScheme=void 0;(function(t){t.HTTP="http",t.HTTPS="https"})(Eu.EndpointURLScheme||(Eu.EndpointURLScheme={}));Eu.AlgorithmId=void 0;(function(t){t.MD5="md5",t.CRC32="crc32",t.CRC32C="crc32c",t.SHA1="sha1",t.SHA256="sha256"})(Eu.AlgorithmId||(Eu.AlgorithmId={}));var pEn=t=>{let e=[];return t.sha256!==void 0&&e.push({algorithmId:()=>Eu.AlgorithmId.SHA256,checksumConstructor:()=>t.sha256}),t.md5!=null&&e.push({algorithmId:()=>Eu.AlgorithmId.MD5,checksumConstructor:()=>t.md5}),{addChecksumAlgorithm(r){e.push(r)},checksumAlgorithms(){return e}}},mEn=t=>{let e={};return t.checksumAlgorithms().forEach(r=>{e[r.algorithmId()]=r.checksumConstructor()}),e},hEn=t=>pEn(t),gEn=t=>mEn(t);Eu.FieldPosition=void 0;(function(t){t[t.HEADER=0]="HEADER",t[t.TRAILER=1]="TRAILER"})(Eu.FieldPosition||(Eu.FieldPosition={}));var yEn="__smithy_context";Eu.IniSectionType=void 0;(function(t){t.PROFILE="profile",t.SSO_SESSION="sso-session",t.SERVICES="services"})(Eu.IniSectionType||(Eu.IniSectionType={}));Eu.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"})(Eu.RequestHandlerProtocol||(Eu.RequestHandlerProtocol={}));Eu.SMITHY_CONTEXT_KEY=yEn;Eu.getDefaultClientConfiguration=hEn;Eu.resolveDefaultRuntimeConfig=gEn});var lWe=S(RF=>{"use strict";var bEn=oWe(),_En=t=>({setHttpHandler(e){t.httpHandler=e},httpHandler(){return t.httpHandler},updateHttpClientConfig(e,r){t.httpHandler?.updateHttpClientConfig(e,r)},httpHandlerConfigs(){return t.httpHandler.httpHandlerConfigs()}}),vEn=t=>({httpHandler:t.httpHandler()}),iWe=class{constructor({name:e,kind:r=bEn.FieldPosition.HEADER,values:n=[]}){M(this,"name");M(this,"kind");M(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}},aWe=class{constructor({fields:e=[],encoding:r="utf-8"}){M(this,"entries",{});M(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)}},sWe=class t{constructor(e){M(this,"method");M(this,"protocol");M(this,"hostname");M(this,"port");M(this,"path");M(this,"query");M(this,"headers");M(this,"username");M(this,"password");M(this,"fragment");M(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=wEn(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 wEn(t){return Object.keys(t).reduce((e,r)=>{let n=t[r];return{...e,[r]:Array.isArray(n)?[...n]:n}},{})}var uWe=class{constructor(e){M(this,"statusCode");M(this,"reason");M(this,"headers");M(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 SEn(t){return/^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/.test(t)}RF.Field=iWe;RF.Fields=aWe;RF.HttpRequest=sWe;RF.HttpResponse=uWe;RF.getHttpHandlerExtensionConfiguration=_En;RF.isValidHostname=SEn;RF.resolveHttpHandlerRuntimeConfig=vEn});var kZt=S(dWe=>{"use strict";var FZt={},cWe={};for(let t=0;t<256;t++){let e=t.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),FZt[t]=e,cWe[e]=t}function CEn(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 cWe)e[r/2]=cWe[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function xEn(t){let e="";for(let r=0;r<t.byteLength;r++)e+=FZt[t[r]];return e}dWe.fromHex=CEn;dWe.toHex=xEn});var fWe=S(qZt=>{"use strict";var OEn=t=>typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Object.prototype.toString.call(t)==="[object ArrayBuffer]";qZt.isArrayBuffer=OEn});var BZt=S(mWe=>{"use strict";var TEn=fWe(),pWe=eS(),EEn=(t,e=0,r=t.byteLength-e)=>{if(!TEn.isArrayBuffer(t))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof t} (${t})`);return pWe.Buffer.from(t,e,r)},PEn=(t,e)=>{if(typeof t!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof t} (${t})`);return e?pWe.Buffer.from(t,e):pWe.Buffer.from(t)};mWe.fromArrayBuffer=EEn;mWe.fromString=PEn});var HZt=S(Yve=>{"use strict";var UZt=BZt(),zZt=t=>{let e=UZt.fromString(t,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)},MEn=t=>typeof t=="string"?zZt(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(t),REn=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 UZt.fromArrayBuffer(t.buffer,t.byteOffset,t.byteLength).toString("utf8")};Yve.fromUtf8=zZt;Yve.toUint8Array=MEn;Yve.toUtf8=REn});var JZt=S(hWe=>{"use strict";var VZt=oWe(),AEn=t=>t[VZt.SMITHY_CONTEXT_KEY]||(t[VZt.SMITHY_CONTEXT_KEY]={}),IEn=t=>{if(typeof t=="function")return t;let e=Promise.resolve(t);return()=>e};hWe.getSmithyContext=AEn;hWe.normalizeProvider=IEn});var WZt=S(gWe=>{"use strict";var KZt=t=>encodeURIComponent(t).replace(/[!'()*]/g,NEn),NEn=t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`,jEn=t=>t.split("/").map(KZt).join("/");gWe.escapeUri=KZt;gWe.escapeUriPath=jEn});var bXt=S(ri=>{"use strict";var AF=kZt(),L4=HZt(),DEn=fWe(),YZt=lWe(),GZt=JZt(),Qve=WZt(),QZt="X-Amz-Algorithm",eXt="X-Amz-Credential",SWe="X-Amz-Date",tXt="X-Amz-SignedHeaders",rXt="X-Amz-Expires",CWe="X-Amz-Signature",xWe="X-Amz-Security-Token",$En="X-Amz-Region-Set",OWe="authorization",TWe=SWe.toLowerCase(),nXt="date",oXt=[OWe,TWe,nXt],iXt=CWe.toLowerCase(),owe="x-amz-content-sha256",aXt=xWe.toLowerCase(),LEn="host",sXt={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},uXt=/^proxy-/,lXt=/^sec-/,FEn=[/^proxy-/i,/^sec-/i],ewe="AWS4-HMAC-SHA256",kEn="AWS4-ECDSA-P256-SHA256",cXt="AWS4-HMAC-SHA256-PAYLOAD",dXt="UNSIGNED-PAYLOAD",fXt=50,EWe="aws4_request",pXt=60*60*24*7,S5={},twe=[],rwe=(t,e,r)=>`${t}/${e}/${r}/${EWe}`,mXt=async(t,e,r,n,o)=>{let i=await ZZt(t,e.secretAccessKey,e.accessKeyId),a=`${r}:${n}:${o}:${AF.toHex(i)}:${e.sessionToken}`;if(a in S5)return S5[a];for(twe.push(a);twe.length>fXt;)delete S5[twe.shift()];let s=`AWS4${e.secretAccessKey}`;for(let u of[r,n,o,EWe])s=await ZZt(t,s,u);return S5[a]=s},qEn=()=>{twe.length=0,Object.keys(S5).forEach(t=>{delete S5[t]})},ZZt=(t,e,r)=>{let n=new t(e);return n.update(L4.toUint8Array(r)),n.digest()},yWe=({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 sXt||e?.has(i)||uXt.test(i)||lXt.test(i))&&(!r||r&&!r.has(i))||(n[i]=t[o].trim().replace(/\s+/g," "))}return n},nwe=async({headers:t,body:e},r)=>{for(let n of Object.keys(t))if(n.toLowerCase()===owe)return t[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||DEn.isArrayBuffer(e)){let n=new r;return n.update(L4.toUint8Array(e)),AF.toHex(await n.digest())}return dXt},bWe=class{format(e){let r=[];for(let i of Object.keys(e)){let a=L4.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=L4.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(_We.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!BEn.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);let d=new Uint8Array(17);return d[0]=9,d.set(AF.fromHex(e.value.replace(/\-/g,"")),1),d}}},BEn=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,_We=class t{constructor(e){M(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&&XZt(r),new t(r)}valueOf(){let e=this.bytes.slice(0),r=e[0]&128;return r&&XZt(e),parseInt(AF.toHex(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}};function XZt(t){for(let e=0;e<8;e++)t[e]^=255;for(let e=7;e>-1&&(t[e]++,t[e]===0);e--);}var hXt=(t,e)=>{t=t.toLowerCase();for(let r of Object.keys(e))if(t===r.toLowerCase())return!0;return!1},gXt=(t,e={})=>{let{headers:r,query:n={}}=YZt.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}},vWe=t=>{t=YZt.HttpRequest.clone(t);for(let e of Object.keys(t.headers))oXt.indexOf(e.toLowerCase())>-1&&delete t.headers[e];return t},yXt=({query:t={}})=>{let e=[],r={};for(let n of Object.keys(t)){if(n.toLowerCase()===iXt)continue;let o=Qve.escapeUri(n);e.push(o);let i=t[n];typeof i=="string"?r[o]=`${o}=${Qve.escapeUri(i)}`:Array.isArray(i)&&(r[o]=i.slice(0).reduce((a,s)=>a.concat([`${o}=${Qve.escapeUri(s)}`]),[]).sort().join("&"))}return e.sort().map(n=>r[n]).filter(n=>n).join("&")},UEn=t=>zEn(t).toISOString().replace(/\.\d{3}Z$/,"Z"),zEn=t=>typeof t=="number"?new Date(t*1e3):typeof t=="string"?Number(t)?new Date(Number(t)*1e3):new Date(t):t,iwe=class{constructor({applyChecksum:e,credentials:r,region:n,service:o,sha256:i,uriEscapePath:a=!0}){M(this,"service");M(this,"regionProvider");M(this,"credentialProvider");M(this,"sha256");M(this,"uriEscapePath");M(this,"applyChecksum");this.service=o,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=GZt.normalizeProvider(n),this.credentialProvider=GZt.normalizeProvider(r)}createCanonicalRequest(e,r,n){let o=Object.keys(r).sort();return`${e.method}
|
||
${this.getCanonicalPath(e)}
|
||
${yXt(e)}
|
||
${o.map(i=>`${i}:${r[i]}`).join(`
|
||
`)}
|
||
|
||
${o.join(";")}
|
||
${n}`}async createStringToSign(e,r,n,o){let i=new this.sha256;i.update(L4.toUint8Array(n));let a=await i.digest();return`${o}
|
||
${e}
|
||
${r}
|
||
${AF.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 Qve.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=UEn(e).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}},wWe=class extends iwe{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});M(this,"headerFormatter",new bWe)}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>pXt)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");let g=rwe(h,p,d??this.service),y=gXt(vWe(r),{unhoistableHeaders:s,hoistableHeaders:l});f.sessionToken&&(y.query[xWe]=f.sessionToken),y.query[QZt]=ewe,y.query[eXt]=`${f.accessKeyId}/${g}`,y.query[SWe]=m,y.query[rXt]=i.toString(10);let b=yWe(y,a,u);return y.query[tXt]=this.getCanonicalHeaderList(b),y.query[CWe]=await this.getSignature(m,g,this.getSigningKey(f,p,h,d),this.createCanonicalRequest(y,b,await nwe(r,this.sha256))),y}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=rwe(l,u,s??this.service),f=await nwe({headers:{},body:n},this.sha256),p=new this.sha256;p.update(r);let m=AF.toHex(await p.digest()),h=[cXt,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(L4.toUint8Array(r)),AF.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=vWe(r),{longDate:d,shortDate:f}=this.formatDate(n),p=rwe(f,l,s??this.service);c.headers[TWe]=d,u.sessionToken&&(c.headers[aXt]=u.sessionToken);let m=await nwe(c,this.sha256);!hXt(owe,c.headers)&&this.applyChecksum&&(c.headers[owe]=m);let h=yWe(c,i,o),g=await this.getSignature(d,p,this.getSigningKey(u,l,f,s),this.createCanonicalRequest(c,h,m));return c.headers[OWe]=`${ewe} Credential=${u.accessKeyId}/${p}, SignedHeaders=${this.getCanonicalHeaderList(h)}, Signature=${g}`,c}async getSignature(r,n,o,i){let a=await this.createStringToSign(r,n,i,ewe),s=new this.sha256(await o);return s.update(L4.toUint8Array(a)),AF.toHex(await s.digest())}getSigningKey(r,n,o,i){return mXt(this.sha256,r,o,n,i||this.service)}},HEn={SignatureV4a:null};ri.ALGORITHM_IDENTIFIER=ewe;ri.ALGORITHM_IDENTIFIER_V4A=kEn;ri.ALGORITHM_QUERY_PARAM=QZt;ri.ALWAYS_UNSIGNABLE_HEADERS=sXt;ri.AMZ_DATE_HEADER=TWe;ri.AMZ_DATE_QUERY_PARAM=SWe;ri.AUTH_HEADER=OWe;ri.CREDENTIAL_QUERY_PARAM=eXt;ri.DATE_HEADER=nXt;ri.EVENT_ALGORITHM_IDENTIFIER=cXt;ri.EXPIRES_QUERY_PARAM=rXt;ri.GENERATED_HEADERS=oXt;ri.HOST_HEADER=LEn;ri.KEY_TYPE_IDENTIFIER=EWe;ri.MAX_CACHE_SIZE=fXt;ri.MAX_PRESIGNED_TTL=pXt;ri.PROXY_HEADER_PATTERN=uXt;ri.REGION_SET_PARAM=$En;ri.SEC_HEADER_PATTERN=lXt;ri.SHA256_HEADER=owe;ri.SIGNATURE_HEADER=iXt;ri.SIGNATURE_QUERY_PARAM=CWe;ri.SIGNED_HEADERS_QUERY_PARAM=tXt;ri.SignatureV4=wWe;ri.SignatureV4Base=iwe;ri.TOKEN_HEADER=aXt;ri.TOKEN_QUERY_PARAM=xWe;ri.UNSIGNABLE_PATTERNS=FEn;ri.UNSIGNED_PAYLOAD=dXt;ri.clearCredentialCache=qEn;ri.createScope=rwe;ri.getCanonicalHeaders=yWe;ri.getCanonicalQuery=yXt;ri.getPayloadHash=nwe;ri.getSigningKey=mXt;ri.hasHeader=hXt;ri.moveHeadersToQuery=gXt;ri.prepareRequest=vWe;ri.signatureV4aContainer=HEn});var cc=S((wla,_Xt)=>{"use strict";_Xt.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((Sla,awe)=>{"use strict";var{AbortController:vXt,AbortSignal:VEn}=typeof self<"u"?self:typeof window<"u"?window:void 0;awe.exports=vXt;awe.exports.AbortSignal=VEn;awe.exports.default=vXt});var Rre=S((Cla,PWe)=>{"use strict";var x5=typeof Reflect=="object"?Reflect:null,wXt=x5&&typeof x5.apply=="function"?x5.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},swe;x5&&typeof x5.ownKeys=="function"?swe=x5.ownKeys:Object.getOwnPropertySymbols?swe=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:swe=function(e){return Object.getOwnPropertyNames(e)};function JEn(t){console&&console.warn&&console.warn(t)}var CXt=Number.isNaN||function(e){return e!==e};function lu(){lu.init.call(this)}PWe.exports=lu;PWe.exports.once=ZEn;lu.EventEmitter=lu;lu.prototype._events=void 0;lu.prototype._eventsCount=0;lu.prototype._maxListeners=void 0;var SXt=10;function uwe(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(lu,"defaultMaxListeners",{enumerable:!0,get:function(){return SXt},set:function(t){if(typeof t!="number"||t<0||CXt(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");SXt=t}});lu.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};lu.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||CXt(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 xXt(t){return t._maxListeners===void 0?lu.defaultMaxListeners:t._maxListeners}lu.prototype.getMaxListeners=function(){return xXt(this)};lu.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")wXt(u,this,r);else for(var l=u.length,c=MXt(u,l),n=0;n<l;++n)wXt(c[n],this,r);return!0};function OXt(t,e,r,n){var o,i,a;if(uwe(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=xXt(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,JEn(s)}return t}lu.prototype.addListener=function(e,r){return OXt(this,e,r,!1)};lu.prototype.on=lu.prototype.addListener;lu.prototype.prependListener=function(e,r){return OXt(this,e,r,!0)};function KEn(){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 TXt(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=KEn.bind(n);return o.listener=r,n.wrapFn=o,o}lu.prototype.once=function(e,r){return uwe(r),this.on(e,TXt(this,e,r)),this};lu.prototype.prependOnceListener=function(e,r){return uwe(r),this.prependListener(e,TXt(this,e,r)),this};lu.prototype.removeListener=function(e,r){var n,o,i,a,s;if(uwe(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():WEn(n,i),n.length===1&&(o[e]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",e,s||r)}return this};lu.prototype.off=lu.prototype.removeListener;lu.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 EXt(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?GEn(o):MXt(o,o.length)}lu.prototype.listeners=function(e){return EXt(this,e,!0)};lu.prototype.rawListeners=function(e){return EXt(this,e,!1)};lu.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):PXt.call(t,e)};lu.prototype.listenerCount=PXt;function PXt(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}lu.prototype.eventNames=function(){return this._eventsCount>0?swe(this._events):[]};function MXt(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function WEn(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function GEn(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function ZEn(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))}RXt(t,e,i,{once:!0}),e!=="error"&&XEn(t,o,{once:!0})})}function XEn(t,e,r){typeof t.on=="function"&&RXt(t,"error",e,r)}function RXt(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 gy=S((xla,RWe)=>{"use strict";var YEn=eS(),{kResistStopPropagation:QEn,SymbolDispose:ePn}=cc(),tPn=globalThis.AbortSignal||C5().AbortSignal,rPn=globalThis.AbortController||C5().AbortController,nPn=Object.getPrototypeOf(async function(){}).constructor,AXt=globalThis.Blob||YEn.Blob,oPn=typeof AXt<"u"?function(e){return e instanceof AXt}:function(e){return!1},IXt=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},iPn=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},MWe=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}};RWe.exports={AggregateError:MWe,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 nPn},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:oPn,deprecate(t,e){return t},addAbortListener:Rre().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);IXt(e,"signal"),iPn(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[QEn]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[ePn](){var o;(o=n)===null||o===void 0||o()}}},AbortSignalAny:tPn.any||function(e){if(e.length===1)return e[0];let r=new rPn,n=()=>r.abort();return e.forEach(o=>{IXt(o,"signals"),o.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(o=>o.removeEventListener("abort",n))},{once:!0}),r.signal}};RWe.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var mb=S((Ola,DXt)=>{"use strict";var{format:aPn,inspect:lwe,AggregateError:sPn}=gy(),uPn=globalThis.AggregateError||sPn,lPn=Symbol("kIsNodeError"),cPn=["string","function","number","object","Function","Object","boolean","bigint","symbol"],dPn=/^([A-Z][a-z0-9]*)+$/,fPn="__node_internal_",cwe={};function F4(t,e){if(!t)throw new cwe.ERR_INTERNAL_ASSERTION(e)}function NXt(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 pPn(t,e,r){if(typeof e=="function")return F4(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 F4(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:aPn(e,...r)}function ag(t,e,r){r||(r=Error);class n extends r{constructor(...i){super(pPn(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[lPn]=!0,cwe[t]=n}function jXt(t){let e=fPn+t.name;return Object.defineProperty(t,"name",{value:e}),t}function mPn(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new uPn([e,t],e.message);return r.code=e.code,r}return t||e}var AWe=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new cwe.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};ag("ERR_ASSERTION","%s",Error);ag("ERR_INVALID_ARG_TYPE",(t,e,r)=>{F4(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)F4(typeof u=="string","All expected entries have to be of type string"),cPn.includes(u)?o.push(u.toLowerCase()):dPn.test(u)?i.push(u):(F4(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=lwe(r,{depth:-1});n+=`. Received ${u}`}}else{let u=lwe(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);ag("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=lwe(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);ag("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let o=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${o}.`},TypeError);ag("ERR_MISSING_ARGS",(...t)=>{F4(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);ag("ERR_OUT_OF_RANGE",(t,e,r)=>{F4(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=NXt(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=NXt(n)),n+="n"):n=lwe(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);ag("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);ag("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);ag("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);ag("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);ag("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);ag("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);ag("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);ag("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);ag("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);ag("ERR_STREAM_WRITE_AFTER_END","write after end",Error);ag("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);DXt.exports={AbortError:AWe,aggregateTwoErrors:jXt(mPn),hideStackFrames:jXt,codes:cwe}});var T5=S((Tla,VXt)=>{"use strict";var{ArrayIsArray:NWe,ArrayPrototypeIncludes:kXt,ArrayPrototypeJoin:qXt,ArrayPrototypeMap:hPn,NumberIsInteger:jWe,NumberIsNaN:gPn,NumberMAX_SAFE_INTEGER:yPn,NumberMIN_SAFE_INTEGER:bPn,NumberParseInt:_Pn,ObjectPrototypeHasOwnProperty:vPn,RegExpPrototypeExec:BXt,String:wPn,StringPrototypeToUpperCase:SPn,StringPrototypeTrim:CPn}=cc(),{hideStackFrames:vS,codes:{ERR_SOCKET_BAD_PORT:xPn,ERR_INVALID_ARG_TYPE:yy,ERR_INVALID_ARG_VALUE:O5,ERR_OUT_OF_RANGE:k4,ERR_UNKNOWN_SIGNAL:$Xt}}=mb(),{normalizeEncoding:OPn}=gy(),{isAsyncFunction:TPn,isArrayBufferView:EPn}=gy().types,LXt={};function PPn(t){return t===(t|0)}function MPn(t){return t===t>>>0}var RPn=/^[0-7]+$/,APn="must be a 32-bit unsigned integer or an octal string";function IPn(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(BXt(RPn,t)===null)throw new O5(e,t,APn);t=_Pn(t,8)}return UXt(t,e),t}var NPn=vS((t,e,r=bPn,n=yPn)=>{if(typeof t!="number")throw new yy(e,"number",t);if(!jWe(t))throw new k4(e,"an integer",t);if(t<r||t>n)throw new k4(e,`>= ${r} && <= ${n}`,t)}),jPn=vS((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new yy(e,"number",t);if(!jWe(t))throw new k4(e,"an integer",t);if(t<r||t>n)throw new k4(e,`>= ${r} && <= ${n}`,t)}),UXt=vS((t,e,r=!1)=>{if(typeof t!="number")throw new yy(e,"number",t);if(!jWe(t))throw new k4(e,"an integer",t);let n=r?1:0,o=4294967295;if(t<n||t>o)throw new k4(e,`>= ${n} && <= ${o}`,t)});function DWe(t,e){if(typeof t!="string")throw new yy(e,"string",t)}function DPn(t,e,r=void 0,n){if(typeof t!="number")throw new yy(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&gPn(t))throw new k4(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var $Pn=vS((t,e,r)=>{if(!kXt(r,t)){let o="must be one of: "+qXt(hPn(r,i=>typeof i=="string"?`'${i}'`:wPn(i)),", ");throw new O5(e,t,o)}});function zXt(t,e){if(typeof t!="boolean")throw new yy(e,"boolean",t)}function IWe(t,e,r){return t==null||!vPn(t,e)?r:t[e]}var LPn=vS((t,e,r=null)=>{let n=IWe(r,"allowArray",!1),o=IWe(r,"allowFunction",!1);if(!IWe(r,"nullable",!1)&&t===null||!n&&NWe(t)||typeof t!="object"&&(!o||typeof t!="function"))throw new yy(e,"Object",t)}),FPn=vS((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new yy(e,"a dictionary",t)}),dwe=vS((t,e,r=0)=>{if(!NWe(t))throw new yy(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new O5(e,t,n)}});function kPn(t,e){dwe(t,e);for(let r=0;r<t.length;r++)DWe(t[r],`${e}[${r}]`)}function qPn(t,e){dwe(t,e);for(let r=0;r<t.length;r++)zXt(t[r],`${e}[${r}]`)}function BPn(t,e){dwe(t,e);for(let r=0;r<t.length;r++){let n=t[r],o=`${e}[${r}]`;if(n==null)throw new yy(o,"AbortSignal",n);HXt(n,o)}}function UPn(t,e="signal"){if(DWe(t,e),LXt[t]===void 0)throw LXt[SPn(t)]!==void 0?new $Xt(t+" (signals must use all capital letters)"):new $Xt(t)}var zPn=vS((t,e="buffer")=>{if(!EPn(t))throw new yy(e,["Buffer","TypedArray","DataView"],t)});function HPn(t,e){let r=OPn(e),n=t.length;if(r==="hex"&&n%2!==0)throw new O5("encoding",e,`is invalid for data of length ${n}`)}function VPn(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&CPn(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new xPn(e,t,r);return t|0}var HXt=vS((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new yy(e,"AbortSignal",t)}),JPn=vS((t,e)=>{if(typeof t!="function")throw new yy(e,"Function",t)}),KPn=vS((t,e)=>{if(typeof t!="function"||TPn(t))throw new yy(e,"Function",t)}),WPn=vS((t,e)=>{if(t!==void 0)throw new yy(e,"undefined",t)});function GPn(t,e,r){if(!kXt(r,t))throw new yy(e,`('${qXt(r,"|")}')`,t)}var ZPn=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function FXt(t,e){if(typeof t>"u"||!BXt(ZPn,t))throw new O5(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function XPn(t){if(typeof t=="string")return FXt(t,"hints"),t;if(NWe(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let o=t[n];FXt(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"')}VXt.exports={isInt32:PPn,isUint32:MPn,parseFileMode:IPn,validateArray:dwe,validateStringArray:kPn,validateBooleanArray:qPn,validateAbortSignalArray:BPn,validateBoolean:zXt,validateBuffer:zPn,validateDictionary:FPn,validateEncoding:HPn,validateFunction:JPn,validateInt32:jPn,validateInteger:NPn,validateNumber:DPn,validateObject:LPn,validateOneOf:$Pn,validatePlainFunction:KPn,validatePort:VPn,validateSignalName:UPn,validateString:DWe,validateUint32:UXt,validateUndefined:WPn,validateUnion:GPn,validateAbortSignal:HXt,validateLinkHeaderValue:XPn}});var IF=S((Ela,GXt)=>{var Qc=GXt.exports={},fT,pT;function $We(){throw new Error("setTimeout has not been defined")}function LWe(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?fT=setTimeout:fT=$We}catch{fT=$We}try{typeof clearTimeout=="function"?pT=clearTimeout:pT=LWe}catch{pT=LWe}})();function JXt(t){if(fT===setTimeout)return setTimeout(t,0);if((fT===$We||!fT)&&setTimeout)return fT=setTimeout,setTimeout(t,0);try{return fT(t,0)}catch{try{return fT.call(null,t,0)}catch{return fT.call(this,t,0)}}}function YPn(t){if(pT===clearTimeout)return clearTimeout(t);if((pT===LWe||!pT)&&clearTimeout)return pT=clearTimeout,clearTimeout(t);try{return pT(t)}catch{try{return pT.call(null,t)}catch{return pT.call(this,t)}}}var f1=[],E5=!1,q4,fwe=-1;function QPn(){!E5||!q4||(E5=!1,q4.length?f1=q4.concat(f1):fwe=-1,f1.length&&KXt())}function KXt(){if(!E5){var t=JXt(QPn);E5=!0;for(var e=f1.length;e;){for(q4=f1,f1=[];++fwe<e;)q4&&q4[fwe].run();fwe=-1,e=f1.length}q4=null,E5=!1,YPn(t)}}Qc.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];f1.push(new WXt(t,e)),f1.length===1&&!E5&&JXt(KXt)};function WXt(t,e){this.fun=t,this.array=e}WXt.prototype.run=function(){this.fun.apply(null,this.array)};Qc.title="browser";Qc.browser=!0;Qc.env={};Qc.argv=[];Qc.version="";Qc.versions={};function p1(){}Qc.on=p1;Qc.addListener=p1;Qc.once=p1;Qc.off=p1;Qc.removeListener=p1;Qc.removeAllListeners=p1;Qc.emit=p1;Qc.prependListener=p1;Qc.prependOnceListener=p1;Qc.listeners=function(t){return[]};Qc.binding=function(t){throw new Error("process.binding is not supported")};Qc.cwd=function(){return"/"};Qc.chdir=function(t){throw new Error("process.chdir is not supported")};Qc.umask=function(){return 0}});var hT=S((Pla,cYt)=>{"use strict";var{SymbolAsyncIterator:ZXt,SymbolIterator:XXt,SymbolFor:B4}=cc(),YXt=B4("nodejs.stream.destroyed"),QXt=B4("nodejs.stream.errored"),FWe=B4("nodejs.stream.readable"),kWe=B4("nodejs.stream.writable"),eYt=B4("nodejs.stream.disturbed"),eMn=B4("nodejs.webstream.isClosedPromise"),tMn=B4("nodejs.webstream.controllerErrorFunction");function pwe(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 mwe(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 rMn(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function mT(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function tYt(t){return!!(t&&!mT(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function rYt(t){return!!(t&&!mT(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function nYt(t){return!!(t&&!mT(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function nMn(t){return tYt(t)||rYt(t)||nYt(t)}function oMn(t,e){return t==null?!1:e===!0?typeof t[ZXt]=="function":e===!1?typeof t[XXt]=="function":typeof t[ZXt]=="function"||typeof t[XXt]=="function"}function hwe(t){if(!mT(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[YXt]||n!=null&&n.destroyed)}function oYt(t){if(!mwe(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 iMn(t,e){if(!mwe(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 aMn(t){if(!pwe(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 iYt(t,e){if(!pwe(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 aYt(t){return t&&t[FWe]!=null?t[FWe]:typeof t?.readable!="boolean"?null:hwe(t)?!1:pwe(t)&&t.readable&&!iYt(t)}function sYt(t){return t&&t[kWe]!=null?t[kWe]:typeof t?.writable!="boolean"?null:hwe(t)?!1:mwe(t)&&t.writable&&!oYt(t)}function sMn(t,e){return mT(t)?hwe(t)?!0:!(e?.readable!==!1&&aYt(t)||e?.writable!==!1&&sYt(t)):null}function uMn(t){var e,r;return mT(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 lMn(t){var e,r;return mT(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 cMn(t){if(!mT(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"&&uYt(t)?t._closed:null}function uYt(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function lYt(t){return typeof t._sent100=="boolean"&&uYt(t)}function dMn(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 fMn(t){if(!mT(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&lYt(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function pMn(t){var e;return!!(t&&((e=t[eYt])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function mMn(t){var e,r,n,o,i,a,s,u,l,c;return!!(t&&((e=(r=(n=(o=(i=(a=t[QXt])!==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))}cYt.exports={isDestroyed:hwe,kIsDestroyed:YXt,isDisturbed:pMn,kIsDisturbed:eYt,isErrored:mMn,kIsErrored:QXt,isReadable:aYt,kIsReadable:FWe,kIsClosedPromise:eMn,kControllerErrorFunction:tMn,kIsWritable:kWe,isClosed:cMn,isDuplexNodeStream:rMn,isFinished:sMn,isIterable:oMn,isReadableNodeStream:pwe,isReadableStream:tYt,isReadableEnded:aMn,isReadableFinished:iYt,isReadableErrored:lMn,isNodeStream:mT,isWebStream:nMn,isWritable:sYt,isWritableNodeStream:mwe,isWritableStream:rYt,isWritableEnded:oYt,isWritableFinished:iMn,isWritableErrored:uMn,isServerRequest:dMn,isServerResponse:lYt,willEmitClose:fMn,isTransformStream:nYt}});var m1=S((Mla,HWe)=>{var NF=IF(),{AbortError:_Yt,codes:hMn}=mb(),{ERR_INVALID_ARG_TYPE:gMn,ERR_STREAM_PREMATURE_CLOSE:dYt}=hMn,{kEmptyObject:BWe,once:UWe}=gy(),{validateAbortSignal:yMn,validateFunction:bMn,validateObject:_Mn,validateBoolean:vMn}=T5(),{Promise:wMn,PromisePrototypeThen:SMn,SymbolDispose:vYt}=cc(),{isClosed:CMn,isReadable:fYt,isReadableNodeStream:qWe,isReadableStream:xMn,isReadableFinished:pYt,isReadableErrored:mYt,isWritable:hYt,isWritableNodeStream:gYt,isWritableStream:OMn,isWritableFinished:yYt,isWritableErrored:bYt,isNodeStream:TMn,willEmitClose:EMn,kIsClosedPromise:PMn}=hT(),P5;function MMn(t){return t.setHeader&&typeof t.abort=="function"}var zWe=()=>{};function wYt(t,e,r){var n,o;if(arguments.length===2?(r=e,e=BWe):e==null?e=BWe:_Mn(e,"options"),bMn(r,"callback"),yMn(e.signal,"options.signal"),r=UWe(r),xMn(t)||OMn(t))return RMn(t,e,r);if(!TMn(t))throw new gMn("stream",["ReadableStream","WritableStream","Stream"],t);let i=(n=e.readable)!==null&&n!==void 0?n:qWe(t),a=(o=e.writable)!==null&&o!==void 0?o:gYt(t),s=t._writableState,u=t._readableState,l=()=>{t.writable||f()},c=EMn(t)&&qWe(t)===i&&gYt(t)===a,d=yYt(t,!1),f=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||i))&&(!i||p)&&r.call(t)},p=pYt(t,!1),m=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||a))&&(!a||d)&&r.call(t)},h=x=>{r.call(t,x)},g=CMn(t),y=()=>{g=!0;let x=bYt(t)||mYt(t);if(x&&typeof x!="boolean")return r.call(t,x);if(i&&!p&&qWe(t,!0)&&!pYt(t,!1))return r.call(t,new dYt);if(a&&!d&&!yYt(t,!1))return r.call(t,new dYt);r.call(t)},b=()=>{g=!0;let x=bYt(t)||mYt(t);if(x&&typeof x!="boolean")return r.call(t,x);r.call(t)},_=()=>{t.req.on("finish",f)};MMn(t)?(t.on("complete",f),c||t.on("abort",y),t.req?_():t.on("request",_)):a&&!s&&(t.on("end",l),t.on("close",l)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",y),t.on("end",m),t.on("finish",f),e.error!==!1&&t.on("error",h),t.on("close",y),g?NF.nextTick(y):s!=null&&s.errorEmitted||u!=null&&u.errorEmitted?c||NF.nextTick(b):(!i&&(!c||fYt(t))&&(d||hYt(t)===!1)||!a&&(!c||hYt(t))&&(p||fYt(t)===!1)||u&&t.req&&t.aborted)&&NF.nextTick(b);let w=()=>{r=zWe,t.removeListener("aborted",y),t.removeListener("complete",f),t.removeListener("abort",y),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",y)};if(e.signal&&!g){let x=()=>{let O=r;w(),O.call(t,new _Yt(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)NF.nextTick(x);else{P5=P5||gy().addAbortListener;let O=P5(e.signal,x),E=r;r=UWe((...T)=>{O[vYt](),E.apply(t,T)})}}return w}function RMn(t,e,r){let n=!1,o=zWe;if(e.signal)if(o=()=>{n=!0,r.call(t,new _Yt(void 0,{cause:e.signal.reason}))},e.signal.aborted)NF.nextTick(o);else{P5=P5||gy().addAbortListener;let a=P5(e.signal,o),s=r;r=UWe((...u)=>{a[vYt](),s.apply(t,u)})}let i=(...a)=>{n||NF.nextTick(()=>r.apply(t,a))};return SMn(t[PMn].promise,i,i),zWe}function AMn(t,e){var r;let n=!1;return e===null&&(e=BWe),(r=e)!==null&&r!==void 0&&r.cleanup&&(vMn(e.cleanup,"cleanup"),n=e.cleanup),new wMn((o,i)=>{let a=wYt(t,e,s=>{n&&a(),s?i(s):o()})})}HWe.exports=wYt;HWe.exports.finished=AMn});var U4=S((Rla,MYt)=>{"use strict";var gT=IF(),{aggregateTwoErrors:IMn,codes:{ERR_MULTIPLE_CALLBACK:NMn},AbortError:jMn}=mb(),{Symbol:xYt}=cc(),{kIsDestroyed:DMn,isDestroyed:$Mn,isFinished:LMn,isServerRequest:FMn}=hT(),OYt=xYt("kDestroy"),VWe=xYt("kConstruct");function TYt(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function kMn(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):(TYt(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?SYt(this,t,e):this.once(OYt,function(i){SYt(this,IMn(i,t),e)}),this)}function SYt(t,e,r){let n=!1;function o(i){if(n)return;n=!0;let a=t._readableState,s=t._writableState;TYt(i,s,a),s&&(s.closed=!0),a&&(a.closed=!0),typeof r=="function"&&r(i),i?gT.nextTick(qMn,t,i):gT.nextTick(EYt,t)}try{t._destroy(e||null,o)}catch(i){o(i)}}function qMn(t,e){JWe(t,e),EYt(t)}function EYt(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 JWe(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 BMn(){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 KWe(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?gT.nextTick(JWe,t,e):JWe(t,e))}function UMn(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(VWe,e),!(t.listenerCount(VWe)>1)&&gT.nextTick(zMn,t)}function zMn(t){let e=!1;function r(n){if(e){KWe(t,n??new NMn);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(OYt,n):n?KWe(t,n,!0):gT.nextTick(HMn,t)}try{t._construct(n=>{gT.nextTick(r,n)})}catch(n){gT.nextTick(r,n)}}function HMn(t){t.emit(VWe)}function CYt(t){return t?.setHeader&&typeof t.abort=="function"}function PYt(t){t.emit("close")}function VMn(t,e){t.emit("error",e),gT.nextTick(PYt,t)}function JMn(t,e){!t||$Mn(t)||(!e&&!LMn(t)&&(e=new jMn),FMn(t)?(t.socket=null,t.destroy(e)):CYt(t)?t.abort():CYt(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?gT.nextTick(VMn,t,e):gT.nextTick(PYt,t),t.destroyed||(t[DMn]=!0))}MYt.exports={construct:UMn,destroyer:JMn,destroy:kMn,undestroy:BMn,errorOrDestroy:KWe}});var bwe=S((Ala,AYt)=>{"use strict";var{ArrayIsArray:KMn,ObjectSetPrototypeOf:RYt}=cc(),{EventEmitter:gwe}=Rre();function ywe(t){gwe.call(this,t)}RYt(ywe.prototype,gwe.prototype);RYt(ywe,gwe);ywe.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(),gwe.listenerCount(this,"error")===0&&this.emit("error",c)}WWe(r,"error",u),WWe(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 WWe(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):KMn(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}AYt.exports={Stream:ywe,prependListener:WWe}});var Are=S((Ila,_we)=>{"use strict";var{SymbolDispose:WMn}=cc(),{AbortError:IYt,codes:GMn}=mb(),{isNodeStream:NYt,isWebStream:ZMn,kControllerErrorFunction:XMn}=hT(),YMn=m1(),{ERR_INVALID_ARG_TYPE:jYt}=GMn,GWe,QMn=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new jYt(e,"AbortSignal",t)};_we.exports.addAbortSignal=function(e,r){if(QMn(e,"signal"),!NYt(r)&&!ZMn(r))throw new jYt("stream",["ReadableStream","WritableStream","Stream"],r);return _we.exports.addAbortSignalNoValidate(e,r)};_we.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=NYt(e)?()=>{e.destroy(new IYt(void 0,{cause:t.reason}))}:()=>{e[XMn](new IYt(void 0,{cause:t.reason}))};if(t.aborted)r();else{GWe=GWe||gy().addAbortListener;let n=GWe(t,r);YMn(e,n[WMn])}return e}});var LYt=S((jla,$Yt)=>{"use strict";var{StringPrototypeSlice:DYt,SymbolIterator:eRn,TypedArrayPrototypeSet:vwe,Uint8Array:tRn}=cc(),{Buffer:ZWe}=eS(),{inspect:rRn}=gy();$Yt.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 ZWe.alloc(0);let r=ZWe.allocUnsafe(e>>>0),n=this.head,o=0;for(;n;)vwe(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}*[eRn](){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+=DYt(i,0,e),this.head=n,n.data=DYt(i,e));break}++o}while((n=n.next)!==null);return this.length-=o,r}_getBuffer(e){let r=ZWe.allocUnsafe(e),n=e,o=this.head,i=0;do{let a=o.data;if(e>a.length)vwe(r,a,n-e),e-=a.length;else{e===a.length?(vwe(r,a,n-e),++i,o.next?this.head=o.next:this.head=this.tail=null):(vwe(r,new tRn(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 rRn(this,{...r,depth:0,customInspect:!1})}}});var Ire=S((Dla,BYt)=>{"use strict";var{MathFloor:nRn,NumberIsInteger:oRn}=cc(),{validateInteger:iRn}=T5(),{ERR_INVALID_ARG_VALUE:aRn}=mb().codes,FYt=16*1024,kYt=16;function sRn(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function qYt(t){return t?kYt:FYt}function uRn(t,e){iRn(e,"value",0),t?kYt=e:FYt=e}function lRn(t,e,r,n){let o=sRn(e,n,r);if(o!=null){if(!oRn(o)||o<0){let i=n?`options.${r}`:"options.highWaterMark";throw new aRn(i,o)}return nRn(o)}return qYt(t.objectMode)}BYt.exports={getHighWaterMark:lRn,getDefaultHighWaterMark:qYt,setDefaultHighWaterMark:uRn}});var HYt=S((XWe,zYt)=>{var wwe=eS(),yT=wwe.Buffer;function UYt(t,e){for(var r in t)e[r]=t[r]}yT.from&&yT.alloc&&yT.allocUnsafe&&yT.allocUnsafeSlow?zYt.exports=wwe:(UYt(wwe,XWe),XWe.Buffer=z4);function z4(t,e,r){return yT(t,e,r)}z4.prototype=Object.create(yT.prototype);UYt(yT,z4);z4.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return yT(t,e,r)};z4.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=yT(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};z4.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return yT(t)};z4.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return wwe.SlowBuffer(t)}});var KYt=S(JYt=>{"use strict";var QWe=HYt().Buffer,VYt=QWe.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 cRn(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 dRn(t){var e=cRn(t);if(typeof e!="string"&&(QWe.isEncoding===VYt||!VYt(t)))throw new Error("Unknown encoding: "+t);return e||t}JYt.StringDecoder=Nre;function Nre(t){this.encoding=dRn(t);var e;switch(this.encoding){case"utf16le":this.text=yRn,this.end=bRn,e=4;break;case"utf8":this.fillLast=mRn,e=4;break;case"base64":this.text=_Rn,this.end=vRn,e=3;break;default:this.write=wRn,this.end=SRn;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=QWe.allocUnsafe(e)}Nre.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||""};Nre.prototype.end=gRn;Nre.prototype.text=hRn;Nre.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 YWe(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function fRn(t,e,r){var n=e.length-1;if(n<r)return 0;var o=YWe(e[n]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--n<r||o===-2?0:(o=YWe(e[n]),o>=0?(o>0&&(t.lastNeed=o-2),o):--n<r||o===-2?0:(o=YWe(e[n]),o>=0?(o>0&&(o===2?o=0:t.lastNeed=o-3),o):0))}function pRn(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 mRn(t){var e=this.lastTotal-this.lastNeed,r=pRn(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 hRn(t,e){var r=fRn(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 gRn(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function yRn(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 bRn(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 _Rn(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 vRn(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function wRn(t){return t.toString(this.encoding)}function SRn(t){return t&&t.length?this.write(t):""}});var e8e=S((Lla,XYt)=>{"use strict";var WYt=IF(),{PromisePrototypeThen:CRn,SymbolAsyncIterator:GYt,SymbolIterator:ZYt}=cc(),{Buffer:xRn}=eS(),{ERR_INVALID_ARG_TYPE:ORn,ERR_STREAM_NULL_VALUES:TRn}=mb().codes;function ERn(t,e,r){let n;if(typeof e=="string"||e instanceof xRn)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let o;if(e&&e[GYt])o=!0,n=e[GYt]();else if(e&&e[ZYt])o=!1,n=e[ZYt]();else throw new ORn("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){CRn(s(l),()=>WYt.nextTick(c,l),d=>WYt.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 TRn;if(i.push(d))continue;a=!1}}catch(l){i.destroy(l)}break}}return i}XYt.exports=ERn});var Dre=S((Fla,hQt)=>{var gC=IF(),{ArrayPrototypeIndexOf:PRn,NumberIsInteger:MRn,NumberIsNaN:RRn,NumberParseInt:ARn,ObjectDefineProperties:u8e,ObjectKeys:IRn,ObjectSetPrototypeOf:eQt,Promise:tQt,SafeSet:NRn,SymbolAsyncDispose:jRn,SymbolAsyncIterator:DRn,Symbol:$Rn}=cc();hQt.exports=ni;ni.ReadableState=Owe;var{EventEmitter:LRn}=Rre(),{Stream:jF,prependListener:FRn}=bwe(),{Buffer:t8e}=eS(),{addAbortSignal:kRn}=Are(),rQt=m1(),Ti=gy().debuglog("stream",t=>{Ti=t}),qRn=LYt(),A5=U4(),{getHighWaterMark:BRn,getDefaultHighWaterMark:URn}=Ire(),{aggregateTwoErrors:YYt,codes:{ERR_INVALID_ARG_TYPE:zRn,ERR_METHOD_NOT_IMPLEMENTED:HRn,ERR_OUT_OF_RANGE:VRn,ERR_STREAM_PUSH_AFTER_EOF:JRn,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:KRn},AbortError:WRn}=mb(),{validateObject:GRn}=T5(),H4=$Rn("kPaused"),{StringDecoder:nQt}=KYt(),ZRn=e8e();eQt(ni.prototype,jF.prototype);eQt(ni,jF);var r8e=()=>{},{errorOrDestroy:M5}=A5,R5=1,XRn=2,oQt=4,jre=8,iQt=16,Swe=32,Cwe=64,aQt=128,YRn=256,QRn=512,eAn=1024,a8e=2048,s8e=4096,tAn=8192,rAn=16384,nAn=32768,sQt=65536,oAn=1<<17,iAn=1<<18;function xm(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}u8e(Owe.prototype,{objectMode:xm(R5),ended:xm(XRn),endEmitted:xm(oQt),reading:xm(jre),constructed:xm(iQt),sync:xm(Swe),needReadable:xm(Cwe),emittedReadable:xm(aQt),readableListening:xm(YRn),resumeScheduled:xm(QRn),errorEmitted:xm(eAn),emitClose:xm(a8e),autoDestroy:xm(s8e),destroyed:xm(tAn),closed:xm(rAn),closeEmitted:xm(nAn),multiAwaitDrain:xm(sQt),readingMore:xm(oAn),dataEmitted:xm(iAn)});function Owe(t,e,r){typeof r!="boolean"&&(r=e instanceof bT()),this.state=a8e|s8e|iQt|Swe,t&&t.objectMode&&(this.state|=R5),r&&t&&t.readableObjectMode&&(this.state|=R5),this.highWaterMark=t?BRn(this,t,"readableHighWaterMark",r):URn(!1),this.buffer=new qRn,this.length=0,this.pipes=[],this.flowing=null,this[H4]=null,t&&t.emitClose===!1&&(this.state&=~a8e),t&&t.autoDestroy===!1&&(this.state&=~s8e),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new nQt(t.encoding),this.encoding=t.encoding)}function ni(t){if(!(this instanceof ni))return new ni(t);let e=this instanceof bT();this._readableState=new Owe(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&&kRn(t.signal,this)),jF.call(this,t),A5.construct(this,()=>{this._readableState.needReadable&&xwe(this,this._readableState)})}ni.prototype.destroy=A5.destroy;ni.prototype._undestroy=A5.undestroy;ni.prototype._destroy=function(t,e){e(t)};ni.prototype[LRn.captureRejectionSymbol]=function(t){this.destroy(t)};ni.prototype[jRn]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new WRn,this.destroy(t)),new tQt((e,r)=>rQt(this,n=>n&&n!==t?r(n):e(null)))};ni.prototype.push=function(t,e){return uQt(this,t,e,!1)};ni.prototype.unshift=function(t,e){return uQt(this,t,e,!0)};function uQt(t,e,r,n){Ti("readableAddChunk",e);let o=t._readableState,i;if((o.state&R5)===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="":jF._isUint8Array(e)?(e=jF._uint8ArrayToBuffer(e),r=""):e!=null&&(i=new zRn("chunk",["string","Buffer","Uint8Array"],e))),i)M5(t,i);else if(e===null)o.state&=~jre,uAn(t,o);else if((o.state&R5)!==0||e&&e.length>0)if(n)if((o.state&oQt)!==0)M5(t,new KRn);else{if(o.destroyed||o.errored)return!1;n8e(t,o,e,!0)}else if(o.ended)M5(t,new JRn);else{if(o.destroyed||o.errored)return!1;o.state&=~jre,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||e.length!==0?n8e(t,o,e,!1):xwe(t,o)):n8e(t,o,e,!1)}else n||(o.state&=~jre,xwe(t,o));return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function n8e(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&sQt)!==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&Cwe)!==0&&Twe(t)),xwe(t,e)}ni.prototype.isPaused=function(){let t=this._readableState;return t[H4]===!0||t.flowing===!1};ni.prototype.setEncoding=function(t){let e=new nQt(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 aAn=1073741824;function sAn(t){if(t>aAn)throw new VRn("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function QYt(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&R5)!==0?1:RRn(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}ni.prototype.read=function(t){Ti("read",t),t===void 0?t=NaN:MRn(t)||(t=ARn(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=sAn(t)),t!==0&&(e.state&=~aQt),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return Ti("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?o8e(this):Twe(this),null;if(t=QYt(t,e),t===0&&e.ended)return e.length===0&&o8e(this),null;let n=(e.state&Cwe)!==0;if(Ti("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,Ti("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,Ti("reading, ended or constructing",n);else if(n){Ti("do read"),e.state|=jre|Swe,e.length===0&&(e.state|=Cwe);try{this._read(e.highWaterMark)}catch(i){M5(this,i)}e.state&=~Swe,e.reading||(t=QYt(r,e))}let o;return t>0?o=pQt(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&&o8e(this)),o!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",o)),o};function uAn(t,e){if(Ti("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?Twe(t):(e.needReadable=!1,e.emittedReadable=!0,lQt(t))}}function Twe(t){let e=t._readableState;Ti("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(Ti("emitReadable",e.flowing),e.emittedReadable=!0,gC.nextTick(lQt,t))}function lQt(t){let e=t._readableState;Ti("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,dQt(t)}function xwe(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,gC.nextTick(lAn,t,e))}function lAn(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(Ti("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}ni.prototype._read=function(t){throw new HRn("_read()")};ni.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new NRn(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),Ti("pipe count=%d opts=%j",n.pipes.length,e);let i=(!e||e.end!==!1)&&t!==gC.stdout&&t!==gC.stderr?s:g;n.endEmitted?gC.nextTick(i):r.once("end",i),t.on("unpipe",a);function a(y,b){Ti("onunpipe"),y===r&&b&&b.hasUnpiped===!1&&(b.hasUnpiped=!0,c())}function s(){Ti("onend"),t.end()}let u,l=!1;function c(){Ti("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",g),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?(Ti("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(Ti("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=cAn(r,t),t.on("drain",u))}r.on("data",f);function f(y){Ti("ondata");let b=t.write(y);Ti("dest.write",b),b===!1&&d()}function p(y){if(Ti("onerror",y),g(),t.removeListener("error",p),t.listenerCount("error")===0){let b=t._writableState||t._readableState;b&&!b.errorEmitted?M5(t,y):t.emit("error",y)}}FRn(t,"error",p);function m(){t.removeListener("finish",h),g()}t.once("close",m);function h(){Ti("onfinish"),t.removeListener("close",m),g()}t.once("finish",h);function g(){Ti("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?d():n.flowing||(Ti("pipe resume"),r.resume()),t};function cAn(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(Ti("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(Ti("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}ni.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=PRn(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};ni.prototype.on=function(t,e){let r=jF.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,Ti("on readable",n.length,n.reading),n.length?Twe(this):n.reading||gC.nextTick(dAn,this)),r};ni.prototype.addListener=ni.prototype.on;ni.prototype.removeListener=function(t,e){let r=jF.prototype.removeListener.call(this,t,e);return t==="readable"&&gC.nextTick(cQt,this),r};ni.prototype.off=ni.prototype.removeListener;ni.prototype.removeAllListeners=function(t){let e=jF.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&gC.nextTick(cQt,this),e};function cQt(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[H4]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function dAn(t){Ti("readable nexttick read 0"),t.read(0)}ni.prototype.resume=function(){let t=this._readableState;return t.flowing||(Ti("resume"),t.flowing=!t.readableListening,fAn(this,t)),t[H4]=!1,this};function fAn(t,e){e.resumeScheduled||(e.resumeScheduled=!0,gC.nextTick(pAn,t,e))}function pAn(t,e){Ti("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),dQt(t),e.flowing&&!e.reading&&t.read(0)}ni.prototype.pause=function(){return Ti("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ti("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[H4]=!0,this};function dQt(t){let e=t._readableState;for(Ti("flow",e.flowing);e.flowing&&t.read()!==null;);}ni.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=IRn(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};ni.prototype[DRn]=function(){return fQt(this)};ni.prototype.iterator=function(t){return t!==void 0&&GRn(t,"options"),fQt(this,t)};function fQt(t,e){typeof t.read!="function"&&(t=ni.wrap(t,{objectMode:!0}));let r=mAn(t,e);return r.stream=t,r}async function*mAn(t,e){let r=r8e;function n(a){this===t?(r(),r=r8e):r=a}t.on("readable",n);let o,i=rQt(t,{writable:!1},a=>{o=a?YYt(o,a):null,r(),r=r8e});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 tQt(n)}}}catch(a){throw o=YYt(o,a),o}finally{(o||e?.destroyOnReturn!==!1)&&(o===void 0||t._readableState.autoDestroy)?A5.destroyer(t,null):(t.off("readable",n),i())}}u8e(ni.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}}});u8e(Owe.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[H4]!==!1},set(t){this[H4]=!!t}}});ni._fromList=pQt;function pQt(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 o8e(t){let e=t._readableState;Ti("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,gC.nextTick(hAn,e,t))}function hAn(t,e){if(Ti("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)gC.nextTick(gAn,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function gAn(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}ni.from=function(t,e){return ZRn(ni,t,e)};var i8e;function mQt(){return i8e===void 0&&(i8e={}),i8e}ni.fromWeb=function(t,e){return mQt().newStreamReadableFromReadableStream(t,e)};ni.toWeb=function(t,e){return mQt().newReadableStreamFromStreamReadable(t,e)};ni.wrap=function(t,e){var r,n;return new ni({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(o,i){A5.destroyer(t,o),i(o)}}).wrap(t)}});var Awe=S((kla,EQt)=>{var V4=IF(),{ArrayPrototypeSlice:bQt,Error:yAn,FunctionPrototypeSymbolHasInstance:_Qt,ObjectDefineProperty:vQt,ObjectDefineProperties:bAn,ObjectSetPrototypeOf:wQt,StringPrototypeToLowerCase:_An,Symbol:vAn,SymbolHasInstance:wAn}=cc();EQt.exports=dc;dc.WritableState=Fre;var{EventEmitter:SAn}=Rre(),$re=bwe().Stream,{Buffer:Ewe}=eS(),Rwe=U4(),{addAbortSignal:CAn}=Are(),{getHighWaterMark:xAn,getDefaultHighWaterMark:OAn}=Ire(),{ERR_INVALID_ARG_TYPE:TAn,ERR_METHOD_NOT_IMPLEMENTED:EAn,ERR_MULTIPLE_CALLBACK:SQt,ERR_STREAM_CANNOT_PIPE:PAn,ERR_STREAM_DESTROYED:Lre,ERR_STREAM_ALREADY_FINISHED:MAn,ERR_STREAM_NULL_VALUES:RAn,ERR_STREAM_WRITE_AFTER_END:AAn,ERR_UNKNOWN_ENCODING:CQt}=mb().codes,{errorOrDestroy:I5}=Rwe;wQt(dc.prototype,$re.prototype);wQt(dc,$re);function d8e(){}var N5=vAn("kOnFinished");function Fre(t,e,r){typeof r!="boolean"&&(r=e instanceof bT()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?xAn(this,t,"writableHighWaterMark",r):OAn(!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=NAn.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Mwe(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 Mwe(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Fre.prototype.getBuffer=function(){return bQt(this.buffered,this.bufferedIndex)};vQt(Fre.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function dc(t){let e=this instanceof bT();if(!e&&!_Qt(dc,this))return new dc(t);this._writableState=new Fre(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&&CAn(t.signal,this)),$re.call(this,t),Rwe.construct(this,()=>{let r=this._writableState;r.writing||p8e(this,r),m8e(this,r)})}vQt(dc,wAn,{__proto__:null,value:function(t){return _Qt(this,t)?!0:this!==dc?!1:t&&t._writableState instanceof Fre}});dc.prototype.pipe=function(){I5(this,new PAn)};function xQt(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"&&!Ewe.isEncoding(r))throw new CQt(r);typeof n!="function"&&(n=d8e)}if(e===null)throw new RAn;if(!o.objectMode)if(typeof e=="string")o.decodeStrings!==!1&&(e=Ewe.from(e,r),r="buffer");else if(e instanceof Ewe)r="buffer";else if($re._isUint8Array(e))e=$re._uint8ArrayToBuffer(e),r="buffer";else throw new TAn("chunk",["string","Buffer","Uint8Array"],e);let i;return o.ending?i=new AAn:o.destroyed&&(i=new Lre("write")),i?(V4.nextTick(n,i),I5(t,i,!0),i):(o.pendingcb++,IAn(t,o,e,r,n))}dc.prototype.write=function(t,e,r){return xQt(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||p8e(this,t))};dc.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=_An(e)),!Ewe.isEncoding(e))throw new CQt(e);return this._writableState.defaultEncoding=e,this};function IAn(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!==d8e&&(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 gQt(t,e,r,n,o,i,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Lre("write")):r?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function yQt(t,e,r,n){--e.pendingcb,n(r),f8e(e),I5(t,r)}function NAn(t,e){let r=t._writableState,n=r.sync,o=r.writecb;if(typeof o!="function"){I5(t,new SQt);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?V4.nextTick(yQt,t,r,e,o):yQt(t,r,e,o)):(r.buffered.length>r.bufferedIndex&&p8e(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:t,state:r},V4.nextTick(jAn,r.afterWriteTickInfo)):OQt(t,r,1,o))}function jAn({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,OQt(t,e,r,n)}function OQt(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&&f8e(e),m8e(t,e)}function f8e(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 Lre("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 Lre("end"))}Mwe(t)}function p8e(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?d8e:l=>{for(let c=a;c<r.length;++c)r[c].callback(l)},u=e.allNoop&&a===0?r:bQt(r,a);u.allBuffers=e.allBuffers,gQt(t,e,!0,e.length,u,"",s),Mwe(e)}else{do{let{chunk:s,encoding:u,callback:l}=r[a];r[a++]=null;let c=o?1:s.length;gQt(t,e,!1,c,s,u,l)}while(a<r.length&&!e.writing);a===r.length?Mwe(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 EAn("_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=xQt(this,t,e);i instanceof yAn&&(o=i)}return n.corked&&(n.corked=1,this.uncork()),o||(!n.errored&&!n.ending?(n.ending=!0,m8e(this,n,!0),n.ended=!0):n.finished?o=new MAn("end"):n.destroyed&&(o=new Lre("end"))),typeof r=="function"&&(o||n.finished?V4.nextTick(r,o):n[N5].push(r)),this};function Pwe(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 DAn(t,e){let r=!1;function n(o){if(r){I5(t,o??SQt());return}if(r=!0,e.pendingcb--,o){let i=e[N5].splice(0);for(let a=0;a<i.length;a++)i[a](o);I5(t,o,e.sync)}else Pwe(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,V4.nextTick(c8e,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(o){n(o)}e.sync=!1}function $An(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,DAn(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function m8e(t,e,r){Pwe(e)&&($An(t,e),e.pendingcb===0&&(r?(e.pendingcb++,V4.nextTick((n,o)=>{Pwe(o)?c8e(n,o):o.pendingcb--},t,e)):Pwe(e)&&(e.pendingcb++,c8e(t,e))))}function c8e(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()}}bAn(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 LAn=Rwe.destroy;dc.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[N5].length)&&V4.nextTick(f8e,r),LAn.call(this,t,e),this};dc.prototype._undestroy=Rwe.undestroy;dc.prototype._destroy=function(t,e){e(t)};dc.prototype[SAn.captureRejectionSymbol]=function(t){this.destroy(t)};var l8e;function TQt(){return l8e===void 0&&(l8e={}),l8e}dc.fromWeb=function(t,e){return TQt().newStreamWritableFromWritableStream(t,e)};dc.toWeb=function(t){return TQt().newWritableStreamFromStreamWritable(t)}});var UQt=S((qla,BQt)=>{var h8e=IF(),FAn=eS(),{isReadable:kAn,isWritable:qAn,isIterable:PQt,isNodeStream:BAn,isReadableNodeStream:MQt,isWritableNodeStream:RQt,isDuplexNodeStream:UAn,isReadableStream:AQt,isWritableStream:IQt}=hT(),NQt=m1(),{AbortError:kQt,codes:{ERR_INVALID_ARG_TYPE:zAn,ERR_INVALID_RETURN_VALUE:jQt}}=mb(),{destroyer:D5}=U4(),HAn=bT(),qQt=Dre(),VAn=Awe(),{createDeferredPromise:DQt}=gy(),$Qt=e8e(),LQt=globalThis.Blob||FAn.Blob,JAn=typeof LQt<"u"?function(e){return e instanceof LQt}:function(e){return!1},KAn=globalThis.AbortController||C5().AbortController,{FunctionPrototypeCall:FQt}=cc(),DF=class extends HAn{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)}};BQt.exports=function t(e,r){if(UAn(e))return e;if(MQt(e))return j5({readable:e});if(RQt(e))return j5({writable:e});if(BAn(e))return j5({writable:!1,readable:!1});if(AQt(e))return j5({readable:qQt.fromWeb(e)});if(IQt(e))return j5({writable:VAn.fromWeb(e)});if(typeof e=="function"){let{value:o,write:i,final:a,destroy:s}=WAn(e);if(PQt(o))return $Qt(DF,o,{objectMode:!0,write:i,final:a,destroy:s});let u=o?.then;if(typeof u=="function"){let l,c=FQt(u,o,d=>{if(d!=null)throw new jQt("nully","body",d)},d=>{D5(l,d)});return l=new DF({objectMode:!0,readable:!1,write:i,final(d){a(async()=>{try{await c,h8e.nextTick(d,null)}catch(f){h8e.nextTick(d,f)}})},destroy:s})}throw new jQt("Iterable, AsyncIterable or AsyncFunction",r,o)}if(JAn(e))return t(e.arrayBuffer());if(PQt(e))return $Qt(DF,e,{objectMode:!0,writable:!1});if(AQt(e?.readable)&&IQt(e?.writable))return DF.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let o=e!=null&&e.readable?MQt(e?.readable)?e?.readable:t(e.readable):void 0,i=e!=null&&e.writable?RQt(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 FQt(n,e,i=>{i!=null&&o.push(i),o.push(null)},i=>{D5(o,i)}),o=new DF({objectMode:!0,writable:!1,read(){}})}throw new zAn(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function WAn(t){let{promise:e,resolve:r}=DQt(),n=new KAn,o=n.signal;return{value:t(async function*(){for(;;){let a=e;e=null;let{chunk:s,done:u,cb:l}=await a;if(h8e.nextTick(l),u)return;if(o.aborted)throw new kQt(void 0,{cause:o.reason});({promise:e,resolve:r}=DQt()),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"?qQt.wrap(t.readable):t.readable,r=t.writable,n=!!kAn(e),o=!!qAn(r),i,a,s,u,l;function c(d){let f=u;u=null,f?f(d):d&&l.destroy(d)}return l=new DF({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:o}),o&&(NQt(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&&(NQt(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 kQt),s=null,i=null,a=null,u===null?f(d):(u=f,D5(r,d),D5(e,d))},l}});var bT=S((Bla,VQt)=>{"use strict";var{ObjectDefineProperties:GAn,ObjectGetOwnPropertyDescriptor:h1,ObjectKeys:ZAn,ObjectSetPrototypeOf:zQt}=cc();VQt.exports=yC;var b8e=Dre(),wS=Awe();zQt(yC.prototype,b8e.prototype);zQt(yC,b8e);{let t=ZAn(wS.prototype);for(let e=0;e<t.length;e++){let r=t[e];yC.prototype[r]||(yC.prototype[r]=wS.prototype[r])}}function yC(t){if(!(this instanceof yC))return new yC(t);b8e.call(this,t),wS.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}GAn(yC.prototype,{writable:{__proto__:null,...h1(wS.prototype,"writable")},writableHighWaterMark:{__proto__:null,...h1(wS.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...h1(wS.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...h1(wS.prototype,"writableBuffer")},writableLength:{__proto__:null,...h1(wS.prototype,"writableLength")},writableFinished:{__proto__:null,...h1(wS.prototype,"writableFinished")},writableCorked:{__proto__:null,...h1(wS.prototype,"writableCorked")},writableEnded:{__proto__:null,...h1(wS.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...h1(wS.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 g8e;function HQt(){return g8e===void 0&&(g8e={}),g8e}yC.fromWeb=function(t,e){return HQt().newStreamDuplexFromReadableWritablePair(t,e)};yC.toWeb=function(t){return HQt().newReadableWritablePairFromDuplex(t)};var y8e;yC.from=function(t){return y8e||(y8e=UQt()),y8e(t,"body")}});var w8e=S((Ula,KQt)=>{"use strict";var{ObjectSetPrototypeOf:JQt,Symbol:XAn}=cc();KQt.exports=g1;var{ERR_METHOD_NOT_IMPLEMENTED:YAn}=mb().codes,v8e=bT(),{getHighWaterMark:QAn}=Ire();JQt(g1.prototype,v8e.prototype);JQt(g1,v8e);var kre=XAn("kCallback");function g1(t){if(!(this instanceof g1))return new g1(t);let e=t?QAn(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),v8e.call(this,t),this._readableState.sync=!1,this[kre]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",eIn)}function _8e(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 eIn(){this._final!==_8e&&_8e.call(this)}g1.prototype._final=_8e;g1.prototype._transform=function(t,e,r){throw new YAn("_transform()")};g1.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[kre]=r})};g1.prototype._read=function(){if(this[kre]){let t=this[kre];this[kre]=null,t()}}});var C8e=S((zla,GQt)=>{"use strict";var{ObjectSetPrototypeOf:WQt}=cc();GQt.exports=$5;var S8e=w8e();WQt($5.prototype,S8e.prototype);WQt($5,S8e);function $5(t){if(!(this instanceof $5))return new $5(t);S8e.call(this,t)}$5.prototype._transform=function(t,e,r){r(null,t)}});var Dwe=S((Hla,eer)=>{var qre=IF(),{ArrayIsArray:tIn,Promise:rIn,SymbolAsyncIterator:nIn,SymbolDispose:oIn}=cc(),jwe=m1(),{once:iIn}=gy(),aIn=U4(),ZQt=bT(),{aggregateTwoErrors:sIn,codes:{ERR_INVALID_ARG_TYPE:I8e,ERR_INVALID_RETURN_VALUE:x8e,ERR_MISSING_ARGS:uIn,ERR_STREAM_DESTROYED:lIn,ERR_STREAM_PREMATURE_CLOSE:cIn},AbortError:dIn}=mb(),{validateFunction:fIn,validateAbortSignal:pIn}=T5(),{isIterable:J4,isReadable:O8e,isReadableNodeStream:Nwe,isNodeStream:XQt,isTransformStream:L5,isWebStream:mIn,isReadableStream:T8e,isReadableFinished:hIn}=hT(),gIn=globalThis.AbortController||C5().AbortController,E8e,P8e,M8e;function YQt(t,e,r){let n=!1;t.on("close",()=>{n=!0});let o=jwe(t,{readable:e,writable:r},i=>{n=!i});return{destroy:i=>{n||(n=!0,aIn.destroyer(t,i||new lIn("pipe")))},cleanup:o}}function yIn(t){return fIn(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function R8e(t){if(J4(t))return t;if(Nwe(t))return bIn(t);throw new I8e("val",["Readable","Iterable","AsyncIterable"],t)}async function*bIn(t){P8e||(P8e=Dre()),yield*P8e.prototype[nIn].call(t)}async function Iwe(t,e,r,{end:n}){let o,i=null,a=l=>{if(l&&(o=l),i){let c=i;i=null,c()}},s=()=>new rIn((l,c)=>{o?c(o):i=()=>{o?c(o):l()}});e.on("drain",a);let u=jwe(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?sIn(o,l):l)}finally{u(),e.off("drain",a)}}async function A8e(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 _In(...t){return QQt(t,iIn(yIn(t)))}function QQt(t,e,r){if(t.length===1&&tIn(t[0])&&(t=t[0]),t.length<2)throw new uIn("streams");let n=new gIn,o=n.signal,i=r?.signal,a=[];pIn(i,"options.signal");function s(){m(new dIn)}M8e=M8e||gy().addAbortListener;let u;i&&(u=M8e(i,s));let l,c,d=[],f=0;function p(_){m(_,--f===0)}function m(_,w){var x;if(_&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=_),!(!l&&!w)){for(;d.length;)d.shift()(l);(x=u)===null||x===void 0||x[oIn](),n.abort(),w&&(l||a.forEach(O=>O()),qre.nextTick(e,l,c))}}let h;for(let _=0;_<t.length;_++){let w=t[_],x=_<t.length-1,O=_>0,E=x||r?.end!==!1,T=_===t.length-1;if(XQt(w)){let R=function(N){N&&N.name!=="AbortError"&&N.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(N)};var b=R;if(E){let{destroy:N,cleanup:D}=YQt(w,x,O);d.push(N),O8e(w)&&T&&a.push(D)}w.on("error",R),O8e(w)&&T&&a.push(()=>{w.removeListener("error",R)})}if(_===0)if(typeof w=="function"){if(h=w({signal:o}),!J4(h))throw new x8e("Iterable, AsyncIterable or Stream","source",h)}else J4(w)||Nwe(w)||L5(w)?h=w:h=ZQt.from(w);else if(typeof w=="function"){if(L5(h)){var g;h=R8e((g=h)===null||g===void 0?void 0:g.readable)}else h=R8e(h);if(h=w(h,{signal:o}),x){if(!J4(h,!0))throw new x8e("AsyncIterable",`transform[${_-1}]`,h)}else{var y;E8e||(E8e=C8e());let R=new E8e({objectMode:!0}),N=(y=h)===null||y===void 0?void 0:y.then;if(typeof N=="function")f++,N.call(h,B=>{c=B,B!=null&&R.write(B),E&&R.end(),qre.nextTick(p)},B=>{R.destroy(B),qre.nextTick(p,B)});else if(J4(h,!0))f++,Iwe(h,R,p,{end:E});else if(T8e(h)||L5(h)){let B=h.readable||h;f++,Iwe(B,R,p,{end:E})}else throw new x8e("AsyncIterable or Promise","destination",h);h=R;let{destroy:D,cleanup:F}=YQt(h,!1,!0);d.push(D),T&&a.push(F)}}else if(XQt(w)){if(Nwe(h)){f+=2;let R=vIn(h,w,p,{end:E});O8e(w)&&T&&a.push(R)}else if(L5(h)||T8e(h)){let R=h.readable||h;f++,Iwe(R,w,p,{end:E})}else if(J4(h))f++,Iwe(h,w,p,{end:E});else throw new I8e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=w}else if(mIn(w)){if(Nwe(h))f++,A8e(R8e(h),w,p,{end:E});else if(T8e(h)||J4(h))f++,A8e(h,w,p,{end:E});else if(L5(h))f++,A8e(h.readable,w,p,{end:E});else throw new I8e("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=w}else h=ZQt.from(w)}return(o!=null&&o.aborted||i!=null&&i.aborted)&&qre.nextTick(s),h}function vIn(t,e,r,{end:n}){let o=!1;if(e.on("close",()=>{o||r(new cIn)}),t.pipe(e,{end:!1}),n){let a=function(){o=!0,e.end()};var i=a;hIn(t)?qre.nextTick(a):t.once("end",a)}else r();return jwe(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)}),jwe(e,{readable:!1,writable:!0},r)}eer.exports={pipelineImpl:QQt,pipeline:_In}});var j8e=S((Vla,aer)=>{"use strict";var{pipeline:wIn}=Dwe(),$we=bT(),{destroyer:SIn}=U4(),{isNodeStream:Lwe,isReadable:ter,isWritable:rer,isWebStream:N8e,isTransformStream:K4,isWritableStream:ner,isReadableStream:oer}=hT(),{AbortError:CIn,codes:{ERR_INVALID_ARG_VALUE:ier,ERR_MISSING_ARGS:xIn}}=mb(),OIn=m1();aer.exports=function(...e){if(e.length===0)throw new xIn("streams");if(e.length===1)return $we.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=$we.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=$we.from(e[p])}for(let p=0;p<e.length;++p)if(!(!Lwe(e[p])&&!N8e(e[p]))){if(p<e.length-1&&!(ter(e[p])||oer(e[p])||K4(e[p])))throw new ier(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(rer(e[p])||ner(e[p])||K4(e[p])))throw new ier(`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=wIn(e,u),d=!!(rer(l)||ner(l)||K4(l)),f=!!(ter(c)||oer(c)||K4(c));if(s=new $we({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:d,readable:f}),d){if(Lwe(l))s._write=function(m,h,g){l.write(m,h)?g():n=g},s._final=function(m){l.end(),o=m},l.on("drain",function(){if(n){let m=n;n=null,m()}});else if(N8e(l)){let h=(K4(l)?l.writable:l).getWriter();s._write=async function(g,y,b){try{await h.ready,h.write(g).catch(()=>{}),b()}catch(_){b(_)}},s._final=async function(g){try{await h.ready,h.close().catch(()=>{}),o=g}catch(y){g(y)}}}let p=K4(c)?c.readable:c;OIn(p,()=>{if(o){let m=o;o=null,m()}})}if(f){if(Lwe(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(N8e(c)){let m=(K4(c)?c.readable:c).getReader();s._read=async function(){for(;;)try{let{value:h,done:g}=await m.read();if(!s.push(h))return;if(g){s.push(null);return}}catch{return}}}}return s._destroy=function(p,m){!p&&a!==null&&(p=new CIn),i=null,n=null,o=null,a===null?m(p):(a=m,Lwe(c)&&SIn(c,p))},s}});var ger=S((Jla,L8e)=>{"use strict";var TIn=globalThis.AbortController||C5().AbortController,{codes:{ERR_INVALID_ARG_VALUE:EIn,ERR_INVALID_ARG_TYPE:Bre,ERR_MISSING_ARGS:PIn,ERR_OUT_OF_RANGE:MIn},AbortError:_T}=mb(),{validateAbortSignal:W4,validateInteger:ser,validateObject:G4}=T5(),RIn=cc().Symbol("kWeak"),AIn=cc().Symbol("kResistStopPropagation"),{finished:IIn}=m1(),NIn=j8e(),{addAbortSignalNoValidate:jIn}=Are(),{isWritable:DIn,isNodeStream:$In}=hT(),{deprecate:LIn}=gy(),{ArrayPrototypePush:FIn,Boolean:kIn,MathFloor:uer,Number:qIn,NumberIsNaN:BIn,Promise:ler,PromiseReject:cer,PromiseResolve:UIn,PromisePrototypeThen:der,Symbol:per}=cc(),Fwe=per("kEmpty"),fer=per("kEof");function zIn(t,e){if(e!=null&&G4(e,"options"),e?.signal!=null&&W4(e.signal,"options.signal"),$In(t)&&!DIn(t))throw new EIn("stream",t,"must be writable");let r=NIn(this,t);return e!=null&&e.signal&&jIn(e.signal,r),r}function kwe(t,e){if(typeof t!="function")throw new Bre("fn",["Function","AsyncFunction"],t);e!=null&&G4(e,"options"),e?.signal!=null&&W4(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=uer(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=uer(e.highWaterMark)),ser(r,"options.concurrency",1),ser(n,"options.highWaterMark",0),n+=r,async function*(){let i=gy().AbortSignalAny([e?.signal].filter(kIn)),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 g(){try{for await(let y of a){if(d)return;if(i.aborted)throw new _T;try{if(y=t(y,u),y===Fwe)continue;y=UIn(y)}catch(b){y=cer(b)}f+=1,der(y,m,p),s.push(y),l&&(l(),l=null),!d&&(s.length>=n||f>=r)&&await new ler(b=>{c=b})}s.push(fer)}catch(y){let b=cer(y);der(b,m,p),s.push(b)}finally{d=!0,l&&(l(),l=null)}}g();try{for(;;){for(;s.length>0;){let y=await s[0];if(y===fer)return;if(i.aborted)throw new _T;y!==Fwe&&(yield y),s.shift(),h()}await new ler(y=>{l=y})}}finally{d=!0,c&&(c(),c=null)}}.call(this)}function HIn(t=void 0){return t!=null&&G4(t,"options"),t?.signal!=null&&W4(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 _T({cause:t.signal.reason});yield[r++,o]}}.call(this)}async function mer(t,e=void 0){for await(let r of $8e.call(this,t,e))return!0;return!1}async function VIn(t,e=void 0){if(typeof t!="function")throw new Bre("fn",["Function","AsyncFunction"],t);return!await mer.call(this,async(...r)=>!await t(...r),e)}async function JIn(t,e){for await(let r of $8e.call(this,t,e))return r}async function KIn(t,e){if(typeof t!="function")throw new Bre("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o),Fwe}for await(let n of kwe.call(this,r,e));}function $8e(t,e){if(typeof t!="function")throw new Bre("fn",["Function","AsyncFunction"],t);async function r(n,o){return await t(n,o)?n:Fwe}return kwe.call(this,r,e)}var D8e=class extends PIn{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function WIn(t,e,r){var n;if(typeof t!="function")throw new Bre("reducer",["Function","AsyncFunction"],t);r!=null&&G4(r,"options"),r?.signal!=null&&W4(r.signal,"options.signal");let o=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let l=new _T(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await IIn(this.destroy(l)),l}let i=new TIn,a=i.signal;if(r!=null&&r.signal){let l={once:!0,[RIn]:this,[AIn]:!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 _T;o?e=await t(e,l,{signal:a}):(e=l,o=!0)}if(!s&&!o)throw new D8e}finally{i.abort()}return e}async function GIn(t){t!=null&&G4(t,"options"),t?.signal!=null&&W4(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 _T(void 0,{cause:t.signal.reason});FIn(e,n)}return e}function ZIn(t,e){let r=kwe.call(this,t,e);return async function*(){for await(let o of r)yield*o}.call(this)}function her(t){if(t=qIn(t),BIn(t))return 0;if(t<0)throw new MIn("number",">= 0",t);return t}function XIn(t,e=void 0){return e!=null&&G4(e,"options"),e?.signal!=null&&W4(e.signal,"options.signal"),t=her(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new _T;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new _T;t--<=0&&(yield i)}}.call(this)}function YIn(t,e=void 0){return e!=null&&G4(e,"options"),e?.signal!=null&&W4(e.signal,"options.signal"),t=her(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new _T;for await(let i of this){var o;if(e!=null&&(o=e.signal)!==null&&o!==void 0&&o.aborted)throw new _T;if(t-- >0&&(yield i),t<=0)return}}.call(this)}L8e.exports.streamReturningOperators={asIndexedPairs:LIn(HIn,"readable.asIndexedPairs will be removed in a future version."),drop:XIn,filter:$8e,flatMap:ZIn,map:kwe,take:YIn,compose:zIn};L8e.exports.promiseReturningOperators={every:VIn,forEach:KIn,reduce:WIn,toArray:GIn,some:mer,find:JIn}});var F8e=S((Kla,yer)=>{"use strict";var{ArrayPrototypePop:QIn,Promise:eNn}=cc(),{isIterable:tNn,isNodeStream:rNn,isWebStream:nNn}=hT(),{pipelineImpl:oNn}=Dwe(),{finished:iNn}=m1();k8e();function aNn(...t){return new eNn((e,r)=>{let n,o,i=t[t.length-1];if(i&&typeof i=="object"&&!rNn(i)&&!tNn(i)&&!nNn(i)){let a=QIn(t);n=a.signal,o=a.end}oNn(t,(a,s)=>{a?r(a):e(s)},{signal:n,end:o})})}yer.exports={finished:iNn,pipeline:aNn}});var k8e=S((Wla,Ter)=>{var{Buffer:sNn}=eS(),{ObjectDefineProperty:y1,ObjectKeys:ver,ReflectApply:wer}=cc(),{promisify:{custom:Ser}}=gy(),{streamReturningOperators:ber,promiseReturningOperators:_er}=ger(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Cer}}=mb(),uNn=j8e(),{setDefaultHighWaterMark:lNn,getDefaultHighWaterMark:cNn}=Ire(),{pipeline:xer}=Dwe(),{destroyer:dNn}=U4(),Oer=m1(),q8e=F8e(),Ure=hT(),cl=Ter.exports=bwe().Stream;cl.isDestroyed=Ure.isDestroyed;cl.isDisturbed=Ure.isDisturbed;cl.isErrored=Ure.isErrored;cl.isReadable=Ure.isReadable;cl.isWritable=Ure.isWritable;cl.Readable=Dre();for(let t of ver(ber)){let r=function(...n){if(new.target)throw Cer();return cl.Readable.from(wer(e,this,n))};B8e=r;let e=ber[t];y1(r,"name",{__proto__:null,value:e.name}),y1(r,"length",{__proto__:null,value:e.length}),y1(cl.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var B8e;for(let t of ver(_er)){let r=function(...o){if(new.target)throw Cer();return wer(e,this,o)};B8e=r;let e=_er[t];y1(r,"name",{__proto__:null,value:e.name}),y1(r,"length",{__proto__:null,value:e.length}),y1(cl.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var B8e;cl.Writable=Awe();cl.Duplex=bT();cl.Transform=w8e();cl.PassThrough=C8e();cl.pipeline=xer;var{addAbortSignal:fNn}=Are();cl.addAbortSignal=fNn;cl.finished=Oer;cl.destroy=dNn;cl.compose=uNn;cl.setDefaultHighWaterMark=lNn;cl.getDefaultHighWaterMark=cNn;y1(cl,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return q8e}});y1(xer,Ser,{__proto__:null,enumerable:!0,get(){return q8e.pipeline}});y1(Oer,Ser,{__proto__:null,enumerable:!0,get(){return q8e.finished}});cl.Stream=cl;cl._isUint8Array=function(e){return e instanceof Uint8Array};cl._uint8ArrayToBuffer=function(e){return sNn.from(e.buffer,e.byteOffset,e.byteLength)}});var zre=S((Gla,ed)=>{"use strict";var Om=k8e(),pNn=F8e(),mNn=Om.Readable.destroy;ed.exports=Om.Readable;ed.exports._uint8ArrayToBuffer=Om._uint8ArrayToBuffer;ed.exports._isUint8Array=Om._isUint8Array;ed.exports.isDisturbed=Om.isDisturbed;ed.exports.isErrored=Om.isErrored;ed.exports.isReadable=Om.isReadable;ed.exports.Readable=Om.Readable;ed.exports.Writable=Om.Writable;ed.exports.Duplex=Om.Duplex;ed.exports.Transform=Om.Transform;ed.exports.PassThrough=Om.PassThrough;ed.exports.addAbortSignal=Om.addAbortSignal;ed.exports.finished=Om.finished;ed.exports.destroy=Om.destroy;ed.exports.destroy=mNn;ed.exports.pipeline=Om.pipeline;ed.exports.compose=Om.compose;Object.defineProperty(Om,"promises",{configurable:!0,enumerable:!0,get(){return pNn}});ed.exports.Stream=Om.Stream;ed.exports.default=ed.exports});var Mer=S(Hre=>{"use strict";Object.defineProperty(Hre,"__esModule",{value:!0});Hre.Headers=void 0;var Eer;typeof globalThis.Headers<"u"?Hre.Headers=Eer=globalThis.Headers:Hre.Headers=Eer=class Per{constructor(e){if(this.headers=new Map,e)if(e instanceof Per)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 U8e=S(Z4=>{"use strict";Object.defineProperty(Z4,"__esModule",{value:!0});Z4.unknownRawResponse=Z4.abortRawResponse=void 0;Z4.toRawResponse=hNn;var Rer=Mer();Z4.abortRawResponse={headers:new Rer.Headers,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""};Z4.unknownRawResponse={headers:new Rer.Headers,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function hNn(t){return{headers:t.headers,redirected:t.redirected,status:t.status,statusText:t.statusText,type:t.type,url:t.url}}});var X4=S((Yla,Aer)=>{"use strict";Aer.exports=TypeError});var Ier=S(()=>{});var Wre=S((tca,Yer)=>{var Y8e=typeof Map=="function"&&Map.prototype,z8e=Object.getOwnPropertyDescriptor&&Y8e?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Bwe=Y8e&&z8e&&typeof z8e.get=="function"?z8e.get:null,Ner=Y8e&&Map.prototype.forEach,Q8e=typeof Set=="function"&&Set.prototype,H8e=Object.getOwnPropertyDescriptor&&Q8e?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Uwe=Q8e&&H8e&&typeof H8e.get=="function"?H8e.get:null,jer=Q8e&&Set.prototype.forEach,gNn=typeof WeakMap=="function"&&WeakMap.prototype,Jre=gNn?WeakMap.prototype.has:null,yNn=typeof WeakSet=="function"&&WeakSet.prototype,Kre=yNn?WeakSet.prototype.has:null,bNn=typeof WeakRef=="function"&&WeakRef.prototype,Der=bNn?WeakRef.prototype.deref:null,_Nn=Boolean.prototype.valueOf,vNn=Object.prototype.toString,wNn=Function.prototype.toString,SNn=String.prototype.match,eGe=String.prototype.slice,$F=String.prototype.replace,CNn=String.prototype.toUpperCase,$er=String.prototype.toLowerCase,Ver=RegExp.prototype.test,Ler=Array.prototype.concat,vT=Array.prototype.join,xNn=Array.prototype.slice,Fer=Math.floor,K8e=typeof BigInt=="function"?BigInt.prototype.valueOf:null,V8e=Object.getOwnPropertySymbols,W8e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,F5=typeof Symbol=="function"&&typeof Symbol.iterator=="object",by=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===F5||!0)?Symbol.toStringTag:null,Jer=Object.prototype.propertyIsEnumerable,ker=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function qer(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Ver.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-Fer(-t):Fer(t);if(n!==t){var o=String(n),i=eGe.call(e,o.length+1);return $F.call(o,r,"$&_")+"."+$F.call($F.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return $F.call(e,r,"$&_")}var G8e=Ier(),Ber=G8e.custom,Uer=Ger(Ber)?Ber:null,Ker={__proto__:null,double:'"',single:"'"},ONn={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Yer.exports=function t(e,r,n,o){var i=r||{};if(b1(i,"quoteStyle")&&!b1(Ker,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(b1(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=b1(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(b1(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(b1(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 Xer(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return s?qer(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return s?qer(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 Z8e(e)?"[Array]":"[Object]";var d=zNn(i,n);if(typeof o>"u")o=[];else if(Zer(o,e)>=0)return"[Circular]";function f(B,U,H){if(U&&(o=xNn.call(o),o.push(U)),H){var G={depth:i.depth};return b1(i,"quoteStyle")&&(G.quoteStyle=i.quoteStyle),t(B,G,n+1,o)}return t(B,i,n+1,o)}if(typeof e=="function"&&!zer(e)){var p=jNn(e),m=qwe(e,f);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(m.length>0?" { "+vT.call(m,", ")+" }":"")}if(Ger(e)){var h=F5?$F.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):W8e.call(e);return typeof e=="object"&&!F5?Vre(h):h}if(qNn(e)){for(var g="<"+$er.call(String(e.nodeName)),y=e.attributes||[],b=0;b<y.length;b++)g+=" "+y[b].name+"="+Wer(TNn(y[b].value),"double",i);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+$er.call(String(e.nodeName))+">",g}if(Z8e(e)){if(e.length===0)return"[]";var _=qwe(e,f);return d&&!UNn(_)?"["+X8e(_,d)+"]":"[ "+vT.call(_,", ")+" ]"}if(PNn(e)){var w=qwe(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!Jer.call(e,"cause")?"{ ["+String(e)+"] "+vT.call(Ler.call("[cause]: "+f(e.cause),w),", ")+" }":w.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+vT.call(w,", ")+" }"}if(typeof e=="object"&&a){if(Uer&&typeof e[Uer]=="function"&&G8e)return G8e(e,{depth:c-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(DNn(e)){var x=[];return Ner&&Ner.call(e,function(B,U){x.push(f(U,e,!0)+" => "+f(B,e))}),Her("Map",Bwe.call(e),x,d)}if(FNn(e)){var O=[];return jer&&jer.call(e,function(B){O.push(f(B,e))}),Her("Set",Uwe.call(e),O,d)}if($Nn(e))return J8e("WeakMap");if(kNn(e))return J8e("WeakSet");if(LNn(e))return J8e("WeakRef");if(RNn(e))return Vre(f(Number(e)));if(INn(e))return Vre(f(K8e.call(e)));if(ANn(e))return Vre(_Nn.call(e));if(MNn(e))return Vre(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(!ENn(e)&&!zer(e)){var E=qwe(e,f),T=ker?ker(e)===Object.prototype:e instanceof Object||e.constructor===Object,R=e instanceof Object?"":"null prototype",N=!T&&by&&Object(e)===e&&by in e?eGe.call(LF(e),8,-1):R?"Object":"",D=T||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",F=D+(N||R?"["+vT.call(Ler.call([],N||[],R||[]),": ")+"] ":"");return E.length===0?F+"{}":d?F+"{"+X8e(E,d)+"}":F+"{ "+vT.call(E,", ")+" }"}return String(e)};function Wer(t,e,r){var n=r.quoteStyle||e,o=Ker[n];return o+t+o}function TNn(t){return $F.call(String(t),/"/g,""")}function Z8e(t){return LF(t)==="[object Array]"&&(!by||!(typeof t=="object"&&by in t))}function ENn(t){return LF(t)==="[object Date]"&&(!by||!(typeof t=="object"&&by in t))}function zer(t){return LF(t)==="[object RegExp]"&&(!by||!(typeof t=="object"&&by in t))}function PNn(t){return LF(t)==="[object Error]"&&(!by||!(typeof t=="object"&&by in t))}function MNn(t){return LF(t)==="[object String]"&&(!by||!(typeof t=="object"&&by in t))}function RNn(t){return LF(t)==="[object Number]"&&(!by||!(typeof t=="object"&&by in t))}function ANn(t){return LF(t)==="[object Boolean]"&&(!by||!(typeof t=="object"&&by in t))}function Ger(t){if(F5)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!W8e)return!1;try{return W8e.call(t),!0}catch{}return!1}function INn(t){if(!t||typeof t!="object"||!K8e)return!1;try{return K8e.call(t),!0}catch{}return!1}var NNn=Object.prototype.hasOwnProperty||function(t){return t in this};function b1(t,e){return NNn.call(t,e)}function LF(t){return vNn.call(t)}function jNn(t){if(t.name)return t.name;var e=SNn.call(wNn.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function Zer(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 DNn(t){if(!Bwe||!t||typeof t!="object")return!1;try{Bwe.call(t);try{Uwe.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function $Nn(t){if(!Jre||!t||typeof t!="object")return!1;try{Jre.call(t,Jre);try{Kre.call(t,Kre)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function LNn(t){if(!Der||!t||typeof t!="object")return!1;try{return Der.call(t),!0}catch{}return!1}function FNn(t){if(!Uwe||!t||typeof t!="object")return!1;try{Uwe.call(t);try{Bwe.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function kNn(t){if(!Kre||!t||typeof t!="object")return!1;try{Kre.call(t,Kre);try{Jre.call(t,Jre)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function qNn(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function Xer(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return Xer(eGe.call(t,0,e.maxStringLength),e)+n}var o=ONn[e.quoteStyle||"single"];o.lastIndex=0;var i=$F.call($F.call(t,o,"\\$1"),/[\x00-\x1f]/g,BNn);return Wer(i,"single",e)}function BNn(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":"")+CNn.call(e.toString(16))}function Vre(t){return"Object("+t+")"}function J8e(t){return t+" { ? }"}function Her(t,e,r,n){var o=n?X8e(r,n):vT.call(r,", ");return t+" ("+e+") {"+o+"}"}function UNn(t){for(var e=0;e<t.length;e++)if(Zer(t[e],`
|
||
`)>=0)return!1;return!0}function zNn(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=vT.call(Array(t.indent+1)," ");else return null;return{base:r,prev:vT.call(Array(e+1),r)}}function X8e(t,e){if(t.length===0)return"";var r=`
|
||
`+e.prev+e.base;return r+vT.call(t,","+r)+`
|
||
`+e.prev}function qwe(t,e){var r=Z8e(t),n=[];if(r){n.length=t.length;for(var o=0;o<t.length;o++)n[o]=b1(t,o)?e(t[o],t):""}var i=typeof V8e=="function"?V8e(t):[],a;if(F5){a={};for(var s=0;s<i.length;s++)a["$"+i[s]]=i[s]}for(var u in t)b1(t,u)&&(r&&String(Number(u))===u&&u<t.length||F5&&a["$"+u]instanceof Symbol||(Ver.call(/[^\w$]/,u)?n.push(e(u,t)+": "+e(t[u],t)):n.push(u+": "+e(t[u],t))));if(typeof V8e=="function")for(var l=0;l<i.length;l++)Jer.call(t,i[l])&&n.push("["+e(i[l])+"]: "+e(t[i[l]],t));return n}});var etr=S((rca,Qer)=>{"use strict";var HNn=Wre(),VNn=X4(),zwe=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},JNn=function(t,e){if(t){var r=zwe(t,e);return r&&r.value}},KNn=function(t,e,r){var n=zwe(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},WNn=function(t,e){return t?!!zwe(t,e):!1},GNn=function(t,e){if(t)return zwe(t,e,!0)};Qer.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new VNn("Side channel does not contain "+HNn(n))},delete:function(n){var o=e&&e.next,i=GNn(e,n);return i&&o&&o===i&&(e=void 0),!!i},get:function(n){return JNn(e,n)},has:function(n){return WNn(e,n)},set:function(n,o){e||(e={next:void 0}),KNn(e,n,o)}};return r}});var tGe=S((nca,ttr)=>{"use strict";ttr.exports=Object});var ntr=S((oca,rtr)=>{"use strict";rtr.exports=Error});var itr=S((ica,otr)=>{"use strict";otr.exports=EvalError});var str=S((aca,atr)=>{"use strict";atr.exports=RangeError});var ltr=S((sca,utr)=>{"use strict";utr.exports=ReferenceError});var dtr=S((uca,ctr)=>{"use strict";ctr.exports=SyntaxError});var ptr=S((lca,ftr)=>{"use strict";ftr.exports=URIError});var htr=S((cca,mtr)=>{"use strict";mtr.exports=Math.abs});var ytr=S((dca,gtr)=>{"use strict";gtr.exports=Math.floor});var _tr=S((fca,btr)=>{"use strict";btr.exports=Math.max});var wtr=S((pca,vtr)=>{"use strict";vtr.exports=Math.min});var Ctr=S((mca,Str)=>{"use strict";Str.exports=Math.pow});var Otr=S((hca,xtr)=>{"use strict";xtr.exports=Math.round});var Etr=S((gca,Ttr)=>{"use strict";Ttr.exports=Number.isNaN||function(e){return e!==e}});var Mtr=S((yca,Ptr)=>{"use strict";var ZNn=Etr();Ptr.exports=function(e){return ZNn(e)||e===0?e:e<0?-1:1}});var Atr=S((bca,Rtr)=>{"use strict";Rtr.exports=Object.getOwnPropertyDescriptor});var rGe=S((_ca,Itr)=>{"use strict";var Hwe=Atr();if(Hwe)try{Hwe([],"length")}catch{Hwe=null}Itr.exports=Hwe});var jtr=S((vca,Ntr)=>{"use strict";var Vwe=Object.defineProperty||!1;if(Vwe)try{Vwe({},"a",{value:1})}catch{Vwe=!1}Ntr.exports=Vwe});var $tr=S((wca,Dtr)=>{"use strict";Dtr.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 ktr=S((Sca,Ftr)=>{"use strict";var Ltr=typeof Symbol<"u"&&Symbol,XNn=$tr();Ftr.exports=function(){return typeof Ltr!="function"||typeof Symbol!="function"||typeof Ltr("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:XNn()}});var nGe=S((Cca,qtr)=>{"use strict";qtr.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var oGe=S((xca,Btr)=>{"use strict";var YNn=tGe();Btr.exports=YNn.getPrototypeOf||null});var Htr=S((Oca,ztr)=>{"use strict";var QNn="Function.prototype.bind called on incompatible ",e1n=Object.prototype.toString,t1n=Math.max,r1n="[object Function]",Utr=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},n1n=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},o1n=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};ztr.exports=function(e){var r=this;if(typeof r!="function"||e1n.apply(r)!==r1n)throw new TypeError(QNn+r);for(var n=n1n(arguments,1),o,i=function(){if(this instanceof o){var c=r.apply(this,Utr(n,arguments));return Object(c)===c?c:this}return r.apply(e,Utr(n,arguments))},a=t1n(0,r.length-n.length),s=[],u=0;u<a;u++)s[u]="$"+u;if(o=Function("binder","return function ("+o1n(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 Gre=S((Tca,Vtr)=>{"use strict";var i1n=Htr();Vtr.exports=Function.prototype.bind||i1n});var Jwe=S((Eca,Jtr)=>{"use strict";Jtr.exports=Function.prototype.call});var iGe=S((Pca,Ktr)=>{"use strict";Ktr.exports=Function.prototype.apply});var Gtr=S((Mca,Wtr)=>{"use strict";Wtr.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Xtr=S((Rca,Ztr)=>{"use strict";var a1n=Gre(),s1n=iGe(),u1n=Jwe(),l1n=Gtr();Ztr.exports=l1n||a1n.call(u1n,s1n)});var aGe=S((Aca,Ytr)=>{"use strict";var c1n=Gre(),d1n=X4(),f1n=Jwe(),p1n=Xtr();Ytr.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new d1n("a function is required");return p1n(c1n,f1n,e)}});var orr=S((Ica,nrr)=>{"use strict";var m1n=aGe(),Qtr=rGe(),trr;try{trr=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var sGe=!!trr&&Qtr&&Qtr(Object.prototype,"__proto__"),rrr=Object,err=rrr.getPrototypeOf;nrr.exports=sGe&&typeof sGe.get=="function"?m1n([sGe.get]):typeof err=="function"?function(e){return err(e==null?e:rrr(e))}:!1});var lrr=S((Nca,urr)=>{"use strict";var irr=nGe(),arr=oGe(),srr=orr();urr.exports=irr?function(e){return irr(e)}:arr?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return arr(e)}:srr?function(e){return srr(e)}:null});var drr=S((jca,crr)=>{"use strict";var h1n=Function.prototype.call,g1n=Object.prototype.hasOwnProperty,y1n=Gre();crr.exports=y1n.call(h1n,g1n)});var Gwe=S((Dca,yrr)=>{"use strict";var Ei,b1n=tGe(),_1n=ntr(),v1n=itr(),w1n=str(),S1n=ltr(),U5=dtr(),B5=X4(),C1n=ptr(),x1n=htr(),O1n=ytr(),T1n=_tr(),E1n=wtr(),P1n=Ctr(),M1n=Otr(),R1n=Mtr(),hrr=Function,uGe=function(t){try{return hrr('"use strict"; return ('+t+").constructor;")()}catch{}},Zre=rGe(),A1n=jtr(),lGe=function(){throw new B5},I1n=Zre?function(){try{return arguments.callee,lGe}catch{try{return Zre(arguments,"callee").get}catch{return lGe}}}():lGe,k5=ktr()(),ch=lrr(),N1n=oGe(),j1n=nGe(),grr=iGe(),Xre=Jwe(),q5={},D1n=typeof Uint8Array>"u"||!ch?Ei:ch(Uint8Array),Y4={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Ei:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Ei:ArrayBuffer,"%ArrayIteratorPrototype%":k5&&ch?ch([][Symbol.iterator]()):Ei,"%AsyncFromSyncIteratorPrototype%":Ei,"%AsyncFunction%":q5,"%AsyncGenerator%":q5,"%AsyncGeneratorFunction%":q5,"%AsyncIteratorPrototype%":q5,"%Atomics%":typeof Atomics>"u"?Ei:Atomics,"%BigInt%":typeof BigInt>"u"?Ei:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Ei:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Ei:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Ei:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":_1n,"%eval%":eval,"%EvalError%":v1n,"%Float32Array%":typeof Float32Array>"u"?Ei:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Ei:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Ei:FinalizationRegistry,"%Function%":hrr,"%GeneratorFunction%":q5,"%Int8Array%":typeof Int8Array>"u"?Ei:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Ei:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Ei:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":k5&&ch?ch(ch([][Symbol.iterator]())):Ei,"%JSON%":typeof JSON=="object"?JSON:Ei,"%Map%":typeof Map>"u"?Ei:Map,"%MapIteratorPrototype%":typeof Map>"u"||!k5||!ch?Ei:ch(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":b1n,"%Object.getOwnPropertyDescriptor%":Zre,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Ei:Promise,"%Proxy%":typeof Proxy>"u"?Ei:Proxy,"%RangeError%":w1n,"%ReferenceError%":S1n,"%Reflect%":typeof Reflect>"u"?Ei:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Ei:Set,"%SetIteratorPrototype%":typeof Set>"u"||!k5||!ch?Ei:ch(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Ei:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":k5&&ch?ch(""[Symbol.iterator]()):Ei,"%Symbol%":k5?Symbol:Ei,"%SyntaxError%":U5,"%ThrowTypeError%":I1n,"%TypedArray%":D1n,"%TypeError%":B5,"%Uint8Array%":typeof Uint8Array>"u"?Ei:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Ei:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Ei:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Ei:Uint32Array,"%URIError%":C1n,"%WeakMap%":typeof WeakMap>"u"?Ei:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Ei:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Ei:WeakSet,"%Function.prototype.call%":Xre,"%Function.prototype.apply%":grr,"%Object.defineProperty%":A1n,"%Object.getPrototypeOf%":N1n,"%Math.abs%":x1n,"%Math.floor%":O1n,"%Math.max%":T1n,"%Math.min%":E1n,"%Math.pow%":P1n,"%Math.round%":M1n,"%Math.sign%":R1n,"%Reflect.getPrototypeOf%":j1n};if(ch)try{null.error}catch(t){frr=ch(ch(t)),Y4["%Error.prototype%"]=frr}var frr,$1n=function t(e){var r;if(e==="%AsyncFunction%")r=uGe("async function () {}");else if(e==="%GeneratorFunction%")r=uGe("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=uGe("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&ch&&(r=ch(o.prototype))}return Y4[e]=r,r},prr={__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"]},Yre=Gre(),Kwe=drr(),L1n=Yre.call(Xre,Array.prototype.concat),F1n=Yre.call(grr,Array.prototype.splice),mrr=Yre.call(Xre,String.prototype.replace),Wwe=Yre.call(Xre,String.prototype.slice),k1n=Yre.call(Xre,RegExp.prototype.exec),q1n=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,B1n=/\\(\\)?/g,U1n=function(e){var r=Wwe(e,0,1),n=Wwe(e,-1);if(r==="%"&&n!=="%")throw new U5("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new U5("invalid intrinsic syntax, expected opening `%`");var o=[];return mrr(e,q1n,function(i,a,s,u){o[o.length]=s?mrr(u,B1n,"$1"):a||i}),o},z1n=function(e,r){var n=e,o;if(Kwe(prr,n)&&(o=prr[n],n="%"+o[0]+"%"),Kwe(Y4,n)){var i=Y4[n];if(i===q5&&(i=$1n(n)),typeof i>"u"&&!r)throw new B5("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new U5("intrinsic "+e+" does not exist!")};yrr.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new B5("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new B5('"allowMissing" argument must be a boolean');if(k1n(/^%?[^%]*%?$/,e)===null)throw new U5("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=U1n(e),o=n.length>0?n[0]:"",i=z1n("%"+o+"%",r),a=i.name,s=i.value,u=!1,l=i.alias;l&&(o=l[0],F1n(n,L1n([0,1],l)));for(var c=1,d=!0;c<n.length;c+=1){var f=n[c],p=Wwe(f,0,1),m=Wwe(f,-1);if((p==='"'||p==="'"||p==="`"||m==='"'||m==="'"||m==="`")&&p!==m)throw new U5("property names with quotes must have matching quotes");if((f==="constructor"||!d)&&(u=!0),o+="."+f,a="%"+o+"%",Kwe(Y4,a))s=Y4[a];else if(s!=null){if(!(f in s)){if(!r)throw new B5("base intrinsic for "+e+" exists, but the property is not available.");return}if(Zre&&c+1>=n.length){var h=Zre(s,f);d=!!h,d&&"get"in h&&!("originalValue"in h.get)?s=h.get:s=s[f]}else d=Kwe(s,f),s=s[f];d&&!u&&(Y4[a]=s)}}return s}});var cGe=S(($ca,vrr)=>{"use strict";var brr=Gwe(),_rr=aGe(),H1n=_rr([brr("%String.prototype.indexOf%")]);vrr.exports=function(e,r){var n=brr(e,!!r);return typeof n=="function"&&H1n(e,".prototype.")>-1?_rr([n]):n}});var dGe=S((Lca,Srr)=>{"use strict";var V1n=Gwe(),Qre=cGe(),J1n=Wre(),K1n=X4(),wrr=V1n("%Map%",!0),W1n=Qre("Map.prototype.get",!0),G1n=Qre("Map.prototype.set",!0),Z1n=Qre("Map.prototype.has",!0),X1n=Qre("Map.prototype.delete",!0),Y1n=Qre("Map.prototype.size",!0);Srr.exports=!!wrr&&function(){var e,r={assert:function(n){if(!r.has(n))throw new K1n("Side channel does not contain "+J1n(n))},delete:function(n){if(e){var o=X1n(e,n);return Y1n(e)===0&&(e=void 0),o}return!1},get:function(n){if(e)return W1n(e,n)},has:function(n){return e?Z1n(e,n):!1},set:function(n,o){e||(e=new wrr),G1n(e,n,o)}};return r}});var xrr=S((Fca,Crr)=>{"use strict";var Q1n=Gwe(),Xwe=cGe(),ejn=Wre(),Zwe=dGe(),tjn=X4(),z5=Q1n("%WeakMap%",!0),rjn=Xwe("WeakMap.prototype.get",!0),njn=Xwe("WeakMap.prototype.set",!0),ojn=Xwe("WeakMap.prototype.has",!0),ijn=Xwe("WeakMap.prototype.delete",!0);Crr.exports=z5?function(){var e,r,n={assert:function(o){if(!n.has(o))throw new tjn("Side channel does not contain "+ejn(o))},delete:function(o){if(z5&&o&&(typeof o=="object"||typeof o=="function")){if(e)return ijn(e,o)}else if(Zwe&&r)return r.delete(o);return!1},get:function(o){return z5&&o&&(typeof o=="object"||typeof o=="function")&&e?rjn(e,o):r&&r.get(o)},has:function(o){return z5&&o&&(typeof o=="object"||typeof o=="function")&&e?ojn(e,o):!!r&&r.has(o)},set:function(o,i){z5&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new z5),njn(e,o,i)):Zwe&&(r||(r=Zwe()),r.set(o,i))}};return n}:Zwe});var Trr=S((kca,Orr)=>{"use strict";var ajn=X4(),sjn=Wre(),ujn=etr(),ljn=dGe(),cjn=xrr(),djn=cjn||ljn||ujn;Orr.exports=function(){var e,r={assert:function(n){if(!r.has(n))throw new ajn("Side channel does not contain "+sjn(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=djn()),e.set(n,o)}};return r}});var Ywe=S((qca,Err)=>{"use strict";var fjn=String.prototype.replace,pjn=/%20/g,fGe={RFC1738:"RFC1738",RFC3986:"RFC3986"};Err.exports={default:fGe.RFC3986,formatters:{RFC1738:function(t){return fjn.call(t,pjn,"+")},RFC3986:function(t){return String(t)}},RFC1738:fGe.RFC1738,RFC3986:fGe.RFC3986}});var hGe=S((Bca,Mrr)=>{"use strict";var mjn=Ywe(),pGe=Object.prototype.hasOwnProperty,Q4=Array.isArray,wT=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),hjn=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(Q4(n)){for(var o=[],i=0;i<n.length;++i)typeof n[i]<"u"&&o.push(n[i]);r.obj[r.prop]=o}}},Prr=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},gjn=function t(e,r,n){if(!r)return e;if(typeof r!="object"&&typeof r!="function"){if(Q4(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!pGe.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var o=e;return Q4(e)&&!Q4(r)&&(o=Prr(e,n)),Q4(e)&&Q4(r)?(r.forEach(function(i,a){if(pGe.call(e,a)){var s=e[a];s&&typeof s=="object"&&i&&typeof i=="object"?e[a]=t(s,i,n):e.push(i)}else e[a]=i}),e):Object.keys(r).reduce(function(i,a){var s=r[a];return pGe.call(i,a)?i[a]=t(i[a],s,n):i[a]=s,i},o)},yjn=function(e,r){return Object.keys(r).reduce(function(n,o){return n[o]=r[o],n},e)},bjn=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}},mGe=1024,_jn=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+=mGe){for(var l=a.length>=mGe?a.slice(u,u+mGe):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===mjn.RFC1738&&(f===40||f===41)){c[c.length]=l.charAt(d);continue}if(f<128){c[c.length]=wT[f];continue}if(f<2048){c[c.length]=wT[192|f>>6]+wT[128|f&63];continue}if(f<55296||f>=57344){c[c.length]=wT[224|f>>12]+wT[128|f>>6&63]+wT[128|f&63];continue}d+=1,f=65536+((f&1023)<<10|l.charCodeAt(d)&1023),c[c.length]=wT[240|f>>18]+wT[128|f>>12&63]+wT[128|f>>6&63]+wT[128|f&63]}s+=c.join("")}return s},vjn=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 hjn(r),e},wjn=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Sjn=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Cjn=function(e,r){return[].concat(e,r)},xjn=function(e,r){if(Q4(e)){for(var n=[],o=0;o<e.length;o+=1)n.push(r(e[o]));return n}return r(e)};Mrr.exports={arrayToObject:Prr,assign:yjn,combine:Cjn,compact:vjn,decode:bjn,encode:_jn,isBuffer:Sjn,isRegExp:wjn,maybeMap:xjn,merge:gjn}});var Drr=S((Uca,jrr)=>{"use strict";var Arr=Trr(),Qwe=hGe(),ene=Ywe(),Ojn=Object.prototype.hasOwnProperty,Irr={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},ST=Array.isArray,Tjn=Array.prototype.push,Nrr=function(t,e){Tjn.apply(t,ST(e)?e:[e])},Ejn=Date.prototype.toISOString,Rrr=ene.default,Tm={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Qwe.encode,encodeValuesOnly:!1,filter:void 0,format:Rrr,formatter:ene.formatters[Rrr],indices:!1,serializeDate:function(e){return Ejn.call(e)},skipNulls:!1,strictNullHandling:!1},Pjn=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},gGe={},Mjn=function t(e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,g,y,b){for(var _=e,w=b,x=0,O=!1;(w=w.get(gGe))!==void 0&&!O;){var E=w.get(e);if(x+=1,typeof E<"u"){if(E===x)throw new RangeError("Cyclic object value");O=!0}typeof w.get(gGe)>"u"&&(x=0)}if(typeof c=="function"?_=c(r,_):_ instanceof Date?_=p(_):n==="comma"&&ST(_)&&(_=Qwe.maybeMap(_,function(Q){return Q instanceof Date?p(Q):Q})),_===null){if(a)return l&&!g?l(r,Tm.encoder,y,"key",m):r;_=""}if(Pjn(_)||Qwe.isBuffer(_)){if(l){var T=g?r:l(r,Tm.encoder,y,"key",m);return[h(T)+"="+h(l(_,Tm.encoder,y,"value",m))]}return[h(r)+"="+h(String(_))]}var R=[];if(typeof _>"u")return R;var N;if(n==="comma"&&ST(_))g&&l&&(_=Qwe.maybeMap(_,l)),N=[{value:_.length>0?_.join(",")||null:void 0}];else if(ST(c))N=c;else{var D=Object.keys(_);N=d?D.sort(d):D}var F=u?String(r).replace(/\./g,"%2E"):String(r),B=o&&ST(_)&&_.length===1?F+"[]":F;if(i&&ST(_)&&_.length===0)return B+"[]";for(var U=0;U<N.length;++U){var H=N[U],G=typeof H=="object"&&H&&typeof H.value<"u"?H.value:_[H];if(!(s&&G===null)){var ie=f&&u?String(H).replace(/\./g,"%2E"):String(H),oe=ST(_)?typeof n=="function"?n(B,ie):B:B+(f?"."+ie:"["+ie+"]");b.set(e,x);var z=Arr();z.set(gGe,b),Nrr(R,t(G,oe,n,o,i,a,s,u,n==="comma"&&g&&ST(_)?null:l,c,d,f,p,m,h,g,y,z))}}return R},Rjn=function(e){if(!e)return Tm;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||Tm.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=ene.default;if(typeof e.format<"u"){if(!Ojn.call(ene.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var o=ene.formatters[n],i=Tm.filter;(typeof e.filter=="function"||ST(e.filter))&&(i=e.filter);var a;if(e.arrayFormat in Irr?a=e.arrayFormat:"indices"in e?a=e.indices?"indices":"repeat":a=Tm.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:Tm.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:Tm.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Tm.allowEmptyArrays,arrayFormat:a,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Tm.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?Tm.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Tm.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:Tm.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:Tm.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Tm.encodeValuesOnly,filter:i,format:n,formatter:o,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Tm.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Tm.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Tm.strictNullHandling}};jrr.exports=function(t,e){var r=t,n=Rjn(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):ST(n.filter)&&(i=n.filter,o=i);var a=[];if(typeof r!="object"||r===null)return"";var s=Irr[n.arrayFormat],u=s==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);for(var l=Arr(),c=0;c<o.length;++c){var d=o[c],f=r[d];n.skipNulls&&f===null||Nrr(a,Mjn(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 krr=S((zca,Frr)=>{"use strict";var e2=hGe(),yGe=Object.prototype.hasOwnProperty,$rr=Array.isArray,Mc={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:e2.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},Ajn=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},Lrr=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},Ijn="utf8=%26%2310003%3B",Njn="utf8=%E2%9C%93",jjn=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]===Njn?l="utf-8":a[u]===Ijn&&(l="iso-8859-1"),s=u,u=a.length);for(u=0;u<a.length;++u)if(u!==s){var c=a[u],d=c.indexOf("]="),f=d===-1?c.indexOf("="):d+1,p,m;f===-1?(p=r.decoder(c,Mc.decoder,l,"key"),m=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,f),Mc.decoder,l,"key"),m=e2.maybeMap(Lrr(c.slice(f+1),r,$rr(n[p])?n[p].length:0),function(g){return r.decoder(g,Mc.decoder,l,"value")})),m&&r.interpretNumericEntities&&l==="iso-8859-1"&&(m=Ajn(String(m))),c.indexOf("[]=")>-1&&(m=$rr(m)?[m]:m);var h=yGe.call(n,p);h&&r.duplicates==="combine"?n[p]=e2.combine(n[p],m):(!h||r.duplicates==="last")&&(n[p]=m)}return n},Djn=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:Lrr(e,r,o),s=t.length-1;s>=0;--s){var u,l=t[s];if(l==="[]"&&r.parseArrays)u=r.allowEmptyArrays&&(a===""||r.strictNullHandling&&a===null)?[]:e2.combine([],a);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},$jn=function(e,r,n,o){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,u=n.depth>0&&a.exec(i),l=u?i.slice(0,u.index):i,c=[];if(l){if(!n.plainObjects&&yGe.call(Object.prototype,l)&&!n.allowPrototypes)return;c.push(l)}for(var d=0;n.depth>0&&(u=s.exec(i))!==null&&d<n.depth;){if(d+=1,!n.plainObjects&&yGe.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(u[1])}if(u){if(n.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+n.depth+" and strictDepth is true");c.push("["+i.slice(u.index)+"]")}return Djn(c,r,n,o)}},Ljn=function(e){if(!e)return Mc;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"?Mc.charset:e.charset,n=typeof e.duplicates>"u"?Mc.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:Mc.allowDots:!!e.allowDots;return{allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:Mc.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Mc.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Mc.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Mc.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Mc.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Mc.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:Mc.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:Mc.decoder,delimiter:typeof e.delimiter=="string"||e2.isRegExp(e.delimiter)?e.delimiter:Mc.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Mc.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Mc.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Mc.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Mc.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:Mc.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Mc.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}};Frr.exports=function(t,e){var r=Ljn(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?{__proto__:null}:{};for(var n=typeof t=="string"?jjn(t,r):t,o=r.plainObjects?{__proto__:null}:{},i=Object.keys(n),a=0;a<i.length;++a){var s=i[a],u=$jn(s,n[s],r,typeof t=="string");o=e2.merge(o,u,r)}return r.allowSparse===!0?o:e2.compact(o)}});var bGe=S((Hca,qrr)=>{"use strict";var Fjn=Drr(),kjn=krr(),qjn=Ywe();qrr.exports={formats:qjn,parse:kjn,stringify:Fjn}});var Brr=S(tne=>{"use strict";var Bjn=tne&&tne.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(tne,"__esModule",{value:!0});tne.createRequestUrl=zjn;var Ujn=Bjn(bGe());function zjn(t,e){return Object.keys(e??{}).length>0?`${t}?${Ujn.default.stringify(e,{arrayFormat:"repeat"})}`:t}});var Urr=S(eSe=>{"use strict";Object.defineProperty(eSe,"__esModule",{value:!0});eSe.RUNTIME=void 0;eSe.RUNTIME=Hjn();function Hjn(){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 H5=S(tSe=>{"use strict";Object.defineProperty(tSe,"__esModule",{value:!0});tSe.RUNTIME=void 0;var Vjn=Urr();Object.defineProperty(tSe,"RUNTIME",{enumerable:!0,get:function(){return Vjn.RUNTIME}})});var _Ge=S((V5,zrr)=>{"use strict";var Jjn=function(){if(typeof self<"u")return self;if(typeof window<"u"||typeof window<"u")return window;throw new Error("unable to locate global object")},t2=Jjn();zrr.exports=V5=t2.fetch;t2.fetch&&(V5.default=t2.fetch.bind(t2));V5.Headers=t2.Headers;V5.Request=t2.Request;V5.Response=t2.Response});var Vrr=S(bC=>{"use strict";var Kjn=bC&&bC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Wjn=bC&&bC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hrr=bC&&bC.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Kjn(r,e,n[o]);return Wjn(r,e),r}}(),Gjn=bC&&bC.__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(bC,"__esModule",{value:!0});bC.getFetchFn=Zjn;var rSe=H5();function Zjn(){return Gjn(this,void 0,void 0,function*(){return rSe.RUNTIME.type==="node"&&rSe.RUNTIME.parsedVersion!=null&&rSe.RUNTIME.parsedVersion>=18?fetch:rSe.RUNTIME.type==="node"?(yield Promise.resolve().then(()=>Hrr(_Ge()))).default:typeof fetch=="function"?fetch:(yield Promise.resolve().then(()=>Hrr(_Ge()))).default})}});var Jrr=S(rne=>{"use strict";var Xjn=rne&&rne.__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(rne,"__esModule",{value:!0});rne.getRequestBody=Qjn;var Yjn=wbe();function Qjn(t){return Xjn(this,arguments,void 0,function*({body:e,type:r}){return r.includes("json")?(0,Yjn.toJson)(e):e})}});var Krr=S(J5=>{"use strict";var _C=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 vGe=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=>_C(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",()=>_C(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.on("error",r=>_C(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=>_C(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",()=>_C(this,void 0,void 0,function*(){e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end()})),this.off("error",r=>_C(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 _C(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 _C(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 _C(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 _C(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:()=>_C(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=vGe});var Wrr=S(K5=>{"use strict";var nne=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.UndiciStreamWrapper=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=>{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 nne(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 nne(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 nne(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 nne(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:()=>nne(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}}}};K5.UndiciStreamWrapper=wGe});var Grr=S(FF=>{"use strict";var nSe=FF&&FF.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},eDn=FF&&FF.__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(FF,"__esModule",{value:!0});FF.NodePre18StreamWrapper=void 0;var SGe=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 nSe(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 nSe(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=eDn(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 nSe(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 nSe(this,void 0,void 0,function*(){let{value:n,done:o}=yield r.next();return{value:n,done:o}})},[Symbol.asyncIterator](){return this}}}};FF.NodePre18StreamWrapper=SGe});var Zrr=S(vC=>{"use strict";var tDn=vC&&vC.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rDn=vC&&vC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CGe=vC&&vC.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tDn(r,e,n[o]);return rDn(r,e),r}}(),nDn=vC&&vC.__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(vC,"__esModule",{value:!0});vC.chooseStreamWrapper=oDn;var oSe=H5();function oDn(t){return nDn(this,void 0,void 0,function*(){return oSe.RUNTIME.type==="node"&&oSe.RUNTIME.parsedVersion!=null&&oSe.RUNTIME.parsedVersion>=18?new(yield Promise.resolve().then(()=>CGe(Krr()))).Node18UniversalStreamWrapper(t):oSe.RUNTIME.type!=="node"&&typeof fetch=="function"?new(yield Promise.resolve().then(()=>CGe(Wrr()))).UndiciStreamWrapper(t):new(yield Promise.resolve().then(()=>CGe(Grr()))).NodePre18StreamWrapper(t)})}});var Xrr=S(one=>{"use strict";var iDn=one&&one.__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(one,"__esModule",{value:!0});one.getResponseBody=sDn;var aDn=Zrr();function sDn(t,e){return iDn(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,aDn.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 Yrr=S(iSe=>{"use strict";Object.defineProperty(iSe,"__esModule",{value:!0});iSe.getTimeoutSignal=lDn;iSe.anySignal=cDn;var uDn="timeout";function lDn(t){let e=new AbortController,r=setTimeout(()=>e.abort(uDn),t);return{signal:e.signal,abortId:r}}function cDn(...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 enr=S(W5=>{"use strict";var dDn=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.makeRequest=void 0;var Qrr=Yrr(),fDn=(t,e,r,n,o,i,a,s,u)=>dDn(void 0,void 0,void 0,function*(){let l=[],c;if(i!=null){let{signal:p,abortId:m}=(0,Qrr.getTimeoutSignal)(i);c=m,l.push(p)}a!=null&&l.push(a);let d=(0,Qrr.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});W5.makeRequest=fDn});var tnr=S(ine=>{"use strict";var pDn=ine&&ine.__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(ine,"__esModule",{value:!0});ine.requestWithRetries=_Dn;var mDn=1e3,hDn=6e4,gDn=2,yDn=.2;function bDn(t){let e=1+(Math.random()*2-1)*yDn;return t*e}function _Dn(t){return pDn(this,arguments,void 0,function*(e,r=gDn){let n=yield e();for(let o=0;o<r&&([408,429].includes(n.status)||n.status>=500);++o){let i=Math.min(mDn*Math.pow(2,o),hDn),a=bDn(i);yield new Promise(s=>setTimeout(s,a)),n=yield e()}return n})}});var onr=S(r2=>{"use strict";var rnr=r2&&r2.__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(r2,"__esModule",{value:!0});r2.fetcher=void 0;r2.fetcherImpl=nnr;var vDn=wbe(),G5=U8e(),wDn=Brr(),SDn=Vrr(),CDn=Jrr(),xDn=Xrr(),ODn=enr(),TDn=tnr();function nnr(t){return rnr(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,wDn.createRequestUrl)(t.url,t.queryParameters),n=yield(0,CDn.getRequestBody)({body:t.body,type:t.requestType==="json"?"json":"other"}),o=yield(0,SDn.getFetchFn)();try{let i=yield(0,TDn.requestWithRetries)(()=>rnr(this,void 0,void 0,function*(){return(0,ODn.makeRequest)(o,r,t.method,e,n,t.timeoutMs,t.abortSignal,t.withCredentials,t.duplex)}),t.maxRetries),a=yield(0,xDn.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,vDn.toJson)(i)},rawResponse:G5.unknownRawResponse}}})}r2.fetcher=nnr});var inr=S(xGe=>{"use strict";Object.defineProperty(xGe,"__esModule",{value:!0});xGe.getHeader=EDn;function EDn(t,e){for(let[r,n]of Object.entries(t))if(r.toLowerCase()===e.toLowerCase())return n}});var anr=S(Z5=>{"use strict";var PDn=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.Supplier=void 0;Z5.Supplier={get:t=>PDn(void 0,void 0,void 0,function*(){return typeof t=="function"?t():t})}});var snr=S(X5=>{"use strict";var MDn=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.HttpResponsePromise=void 0;var OGe=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 MDn(this,void 0,void 0,function*(){return yield this.innerPromise})}};X5.HttpResponsePromise=OGe});var unr=S(_y=>{"use strict";Object.defineProperty(_y,"__esModule",{value:!0});_y.HttpResponsePromise=_y.unknownRawResponse=_y.toRawResponse=_y.abortRawResponse=_y.Supplier=_y.getHeader=_y.fetcher=void 0;var RDn=onr();Object.defineProperty(_y,"fetcher",{enumerable:!0,get:function(){return RDn.fetcher}});var ADn=inr();Object.defineProperty(_y,"getHeader",{enumerable:!0,get:function(){return ADn.getHeader}});var IDn=anr();Object.defineProperty(_y,"Supplier",{enumerable:!0,get:function(){return IDn.Supplier}});var TGe=U8e();Object.defineProperty(_y,"abortRawResponse",{enumerable:!0,get:function(){return TGe.abortRawResponse}});Object.defineProperty(_y,"toRawResponse",{enumerable:!0,get:function(){return TGe.toRawResponse}});Object.defineProperty(_y,"unknownRawResponse",{enumerable:!0,get:function(){return TGe.unknownRawResponse}});var NDn=snr();Object.defineProperty(_y,"HttpResponsePromise",{enumerable:!0,get:function(){return NDn.HttpResponsePromise}})});var lnr=S((EGe,PGe)=>{(function(t,e){typeof EGe=="object"&&typeof PGe<"u"?PGe.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:EGe,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 q={};return $.forEach(function(Y,j){return q[Y]=j}),q}(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(q){return q=="+"?"-":"_"})},f=function($){return $.replace(/[^A-Za-z0-9\+\/]/g,"")},p=function($){for(var q,Y,j,A,W="",V=$.length%3,se=0;se<$.length;){if((Y=$.charCodeAt(se++))>255||(j=$.charCodeAt(se++))>255||(A=$.charCodeAt(se++))>255)throw new TypeError("invalid character found");q=Y<<16|j<<8|A,W+=a[q>>18&63]+a[q>>12&63]+a[q>>6&63]+a[q&63]}return V?W.slice(0,V-3)+"===".substring(V):W},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 q=4096,Y=[],j=0,A=$.length;j<A;j+=q)Y.push(l.apply(null,$.subarray(j,j+q)));return m(Y.join(""))},g=function($,q){return q===void 0&&(q=!1),q?d(h($)):h($)},y=function($){if($.length<2){var q=$.charCodeAt(0);return q<128?$:q<2048?l(192|q>>>6)+l(128|q&63):l(224|q>>>12&15)+l(128|q>>>6&63)+l(128|q&63)}else{var q=65536+($.charCodeAt(0)-55296)*1024+($.charCodeAt(1)-56320);return l(240|q>>>18&7)+l(128|q>>>12&63)+l(128|q>>>6&63)+l(128|q&63)}},b=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,_=function($){return $.replace(b,y)},w=r?function($){return Buffer.from($,"utf8").toString("base64")}:o?function($){return h(o.encode($))}:function($){return m(_($))},x=function($,q){return q===void 0&&(q=!1),q?d(w($)):w($)},O=function($){return x($,!0)},E=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,T=function($){switch($.length){case 4:var q=(7&$.charCodeAt(0))<<18|(63&$.charCodeAt(1))<<12|(63&$.charCodeAt(2))<<6|63&$.charCodeAt(3),Y=q-65536;return l((Y>>>10)+55296)+l((Y&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))}},R=function($){return $.replace(E,T)},N=function($){if($=$.replace(/\s+/g,""),!u.test($))throw new TypeError("malformed base64.");$+="==".slice(2-($.length&3));for(var q,Y="",j,A,W=0;W<$.length;)q=s[$.charAt(W++)]<<18|s[$.charAt(W++)]<<12|(j=s[$.charAt(W++)])<<6|(A=s[$.charAt(W++)]),Y+=j===64?l(q>>16&255):A===64?l(q>>16&255,q>>8&255):l(q>>16&255,q>>8&255,q&255);return Y},D=typeof atob=="function"?function($){return atob(f($))}:r?function($){return Buffer.from($,"base64").toString("binary")}:N,F=r?function($){return c(Buffer.from($,"base64"))}:function($){return c(D($).split("").map(function(q){return q.charCodeAt(0)}))},B=function($){return F(H($))},U=r?function($){return Buffer.from($,"base64").toString("utf8")}:n?function($){return n.decode(F($))}:function($){return R(D($))},H=function($){return f($.replace(/[-_]/g,function(q){return q=="-"?"+":"/"}))},G=function($){return U(H($))},ie=function($){if(typeof $!="string")return!1;var q=$.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(q)||!/[^\s0-9a-zA-Z\-_]/.test(q)},oe=function($){return{value:$,enumerable:!1,writable:!0,configurable:!0}},z=function(){var $=function(q,Y){return Object.defineProperty(String.prototype,q,oe(Y))};$("fromBase64",function(){return G(this)}),$("toBase64",function(q){return x(this,q)}),$("toBase64URI",function(){return x(this,!0)}),$("toBase64URL",function(){return x(this,!0)}),$("toUint8Array",function(){return B(this)})},Q=function(){var $=function(q,Y){return Object.defineProperty(Uint8Array.prototype,q,oe(Y))};$("toBase64",function(q){return g(this,q)}),$("toBase64URI",function(){return g(this,!0)}),$("toBase64URL",function(){return g(this,!0)})},re=function(){z(),Q()},Z={version:t,VERSION:e,atob:D,atobPolyfill:N,btoa:m,btoaPolyfill:p,fromBase64:G,toBase64:x,encode:x,encodeURI:O,encodeURL:O,utob:_,btou:R,decode:G,isValid:ie,fromUint8Array:g,toUint8Array:B,extendString:z,extendUint8Array:Q,extendBuiltins:re};return Z.Base64={},Object.keys(Z).forEach(function($){return Z.Base64[$]=Z[$]}),Z})});var dnr=S(aSe=>{"use strict";Object.defineProperty(aSe,"__esModule",{value:!0});aSe.BasicAuth=void 0;var cnr=lnr(),jDn=/^Basic /i;aSe.BasicAuth={toAuthorizationHeader:t=>t==null?void 0:`Basic ${cnr.Base64.encode(`${t.username}:${t.password}`)}`,fromAuthorizationHeader:t=>{let e=t.replace(jDn,""),r=cnr.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 fnr=S(sSe=>{"use strict";Object.defineProperty(sSe,"__esModule",{value:!0});sSe.BearerToken=void 0;var DDn=/^Bearer /i;sSe.BearerToken={toAuthorizationHeader:t=>{if(t!=null)return`Bearer ${t}`},fromAuthorizationHeader:t=>t.replace(DDn,"").trim()}});var pnr=S(Y5=>{"use strict";Object.defineProperty(Y5,"__esModule",{value:!0});Y5.BearerToken=Y5.BasicAuth=void 0;var $Dn=dnr();Object.defineProperty(Y5,"BasicAuth",{enumerable:!0,get:function(){return $Dn.BasicAuth}});var LDn=fnr();Object.defineProperty(Y5,"BearerToken",{enumerable:!0,get:function(){return LDn.BearerToken}})});var RGe=S(qv=>{"use strict";var mnr=qv&&qv.__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())})},hnr=qv&&qv.__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)}},wC=qv&&qv.__await||function(t){return this instanceof wC?(this.v=t,this):new wC(t)},gnr=qv&&qv.__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(g,y){i.push([p,h,g,y])>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 wC?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(qv,"__esModule",{value:!0});qv.Stream=void 0;qv.readableStreamAsyncIterable=ynr;var FDn=H5(),kDn="data:",MGe=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=kDn,this.messageTerminator=`
|
||
`,this.streamTerminator=n.streamTerminator):this.messageTerminator=n.messageTerminator,o?.addEventListener("abort",()=>this.controller.abort())}iterMessages(){return gnr(this,arguments,function*(){var r,n,o,i;this.controller.signal;let a=ynr(this.stream),s="",u=!1;try{for(var l=!0,c=hnr(a),d;d=yield wC(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 g=m.indexOf(this.prefix);if(g===-1)continue;u=!0,m=m.slice(g+this.prefix.length)}if(this.streamTerminator!=null&&m.includes(this.streamTerminator))return yield wC(void 0);let h=yield wC(this.parse(JSON.parse(m)));yield yield wC(h),u=!1}}}catch(f){n={error:f}}finally{try{!l&&!r&&(o=c.return)&&(yield wC(o.call(c)))}finally{if(n)throw n.error}}})}[Symbol.asyncIterator](){return gnr(this,arguments,function*(){var r,n,o,i;try{for(var a=!0,s=hnr(this.iterMessages()),u;u=yield wC(s.next()),r=u.done,!r;a=!0)i=u.value,a=!1,yield yield wC(i)}catch(l){n={error:l}}finally{try{!a&&!r&&(o=s.return)&&(yield wC(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 FDn.RUNTIME.type==="node"&&typeof e<"u"&&(r+=Buffer.isBuffer(e)?e:Buffer.from(e));return r}};qv.Stream=MGe;function ynr(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return mnr(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 mnr(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 bnr=S(uSe=>{"use strict";Object.defineProperty(uSe,"__esModule",{value:!0});uSe.Stream=void 0;var qDn=RGe();Object.defineProperty(uSe,"Stream",{enumerable:!0,get:function(){return qDn.Stream}})});var _nr=S(ane=>{"use strict";var BDn=ane&&ane.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ane,"__esModule",{value:!0});ane.encodeAsFormParameter=zDn;var UDn=BDn(bGe());function zDn(t){let r=UDn.default.stringify(t,{encode:!1}).split("&").map(n=>{let[o,i]=n.split("=");return[o,i]});return Object.fromEntries(r)}});var Snr=S((hda,wnr)=>{"use strict";var AGe=Object.defineProperty,HDn=Object.getOwnPropertyDescriptor,VDn=Object.getOwnPropertyNames,JDn=Object.prototype.hasOwnProperty,KDn=(t,e)=>{for(var r in e)AGe(t,r,{get:e[r],enumerable:!0})},WDn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of VDn(e))!JDn.call(t,o)&&o!==r&&AGe(t,o,{get:()=>e[o],enumerable:!(n=HDn(e,o))||n.enumerable});return t},GDn=t=>WDn(AGe({},"__esModule",{value:!0}),t),vnr={};KDn(vnr,{Blob:()=>YDn,File:()=>QDn,FormData:()=>XDn});wnr.exports=GDn(vnr);var ZDn=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:XDn,Blob:YDn,File:QDn}=ZDn});var Dnr=S((gda,jnr)=>{"use strict";var jGe=Object.defineProperty,e$n=Object.getOwnPropertyDescriptor,t$n=Object.getOwnPropertyNames,r$n=Object.prototype.hasOwnProperty,n$n=(t,e)=>{for(var r in e)jGe(t,r,{get:e[r],enumerable:!0})},o$n=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of t$n(e))!r$n.call(t,o)&&o!==r&&jGe(t,o,{get:()=>e[o],enumerable:!(n=e$n(e,o))||n.enumerable});return t},i$n=t=>o$n(jGe({},"__esModule",{value:!0}),t),DGe=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},Rc=(t,e,r)=>(DGe(t,e,"read from private field"),r?r.call(t):e.get(t)),CT=(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)},sne=(t,e,r,n)=>(DGe(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),IGe=(t,e,r)=>(DGe(t,e,"access private method"),r),Mnr={};n$n(Mnr,{FormDataEncoder:()=>p$n,isFile:()=>o2,isFormData:()=>Inr});jnr.exports=i$n(Mnr);var _1=t=>typeof t=="function",a$n=t=>_1(t[Symbol.asyncIterator]),Cnr=65536;function*Rnr(t){if(t.byteLength<=Cnr){yield t;return}let e=0;for(;e<t.byteLength;){let r=Math.min(t.byteLength-e,Cnr),n=t.buffer.slice(e,e+r);e+=n.byteLength,yield new Uint8Array(n)}}async function*s$n(t){let e=t.getReader();for(;;){let{done:r,value:n}=await e.read();if(r)break;yield n}}async function*xnr(t){for await(let e of t)yield*Rnr(e)}var u$n=t=>{if(a$n(t))return xnr(t);if(_1(t.getReader))return xnr(s$n(t));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},Onr="abcdefghijklmnopqrstuvwxyz0123456789";function l$n(){let t=16,e="";for(;t--;)e+=Onr[Math.random()*Onr.length<<0];return e}var Anr=t=>String(t).replace(/\r|\n/g,(e,r,n)=>e==="\r"&&n[r+1]!==`
|
||
`||e===`
|
||
`&&n[r-1]!=="\r"?`\r
|
||
`:e),c$n=t=>Object.prototype.toString.call(t).slice(8,-1).toLowerCase();function Tnr(t){if(c$n(t)!=="object")return!1;let e=Object.getPrototypeOf(t);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}function Enr(t,e){if(typeof e=="string"){for(let[r,n]of Object.entries(t))if(e.toLowerCase()===r.toLowerCase())return n}}var d$n=t=>new Proxy(t,{get:(e,r)=>Enr(e,r),has:(e,r)=>Enr(e,r)!==void 0}),Inr=t=>!!(t&&_1(t.constructor)&&t[Symbol.toStringTag]==="FormData"&&_1(t.append)&&_1(t.getAll)&&_1(t.entries)&&_1(t[Symbol.iterator])),Pnr=t=>String(t).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),o2=t=>!!(t&&typeof t=="object"&&_1(t.constructor)&&t[Symbol.toStringTag]==="File"&&_1(t.stream)&&t.name!=null),f$n={enableAdditionalHeaders:!1},lSe={writable:!1,configurable:!1},kF,une,cSe,lne,n2,cne,dne,dSe,fSe,$Ge,NGe,Nnr,p$n=class{constructor(t,e,r){if(CT(this,fSe),CT(this,NGe),CT(this,kF,`\r
|
||
`),CT(this,une,void 0),CT(this,cSe,void 0),CT(this,lne,"-".repeat(2)),CT(this,n2,new TextEncoder),CT(this,cne,void 0),CT(this,dne,void 0),CT(this,dSe,void 0),!Inr(t))throw new TypeError("Expected first argument to be a FormData instance.");let n;if(Tnr(e)?r=e:n=e,n||(n=l$n()),typeof n!="string")throw new TypeError("Expected boundary argument to be a string.");if(r&&!Tnr(r))throw new TypeError("Expected options argument to be an object.");sne(this,dne,Array.from(t.entries())),sne(this,dSe,{...f$n,...r}),sne(this,une,Rc(this,n2).encode(Rc(this,kF))),sne(this,cSe,Rc(this,une).byteLength),this.boundary=`form-data-boundary-${n}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,sne(this,cne,Rc(this,n2).encode(`${Rc(this,lne)}${this.boundary}${Rc(this,lne)}${Rc(this,kF).repeat(2)}`));let o={"Content-Type":this.contentType},i=IGe(this,NGe,Nnr).call(this);i&&(this.contentLength=i,o["Content-Length"]=i),this.headers=d$n(Object.freeze(o)),Object.defineProperties(this,{boundary:lSe,contentType:lSe,contentLength:lSe,headers:lSe})}*values(){for(let[t,e]of Rc(this,dne)){let r=o2(e)?e:Rc(this,n2).encode(Anr(e));yield IGe(this,fSe,$Ge).call(this,t,r),yield r,yield Rc(this,une)}yield Rc(this,cne)}async*encode(){for(let t of this.values())o2(t)?yield*u$n(t.stream()):yield*Rnr(t)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};kF=new WeakMap;une=new WeakMap;cSe=new WeakMap;lne=new WeakMap;n2=new WeakMap;cne=new WeakMap;dne=new WeakMap;dSe=new WeakMap;fSe=new WeakSet;$Ge=function(t,e){let r="";if(r+=`${Rc(this,lne)}${this.boundary}${Rc(this,kF)}`,r+=`Content-Disposition: form-data; name="${Pnr(t)}"`,o2(e)&&(r+=`; filename="${Pnr(e.name)}"${Rc(this,kF)}`,r+=`Content-Type: ${e.type||"application/octet-stream"}`),Rc(this,dSe).enableAdditionalHeaders===!0){let n=o2(e)?e.size:e.byteLength;n!=null&&!isNaN(n)&&(r+=`${Rc(this,kF)}Content-Length: ${n}`)}return Rc(this,n2).encode(`${r}${Rc(this,kF).repeat(2)}`)};NGe=new WeakSet;Nnr=function(){let t=0;for(let[e,r]of Rc(this,dne)){let n=o2(r)?r:Rc(this,n2).encode(Anr(r)),o=o2(n)?n.size:n.byteLength;if(o==null||isNaN(o))return;t+=IGe(this,fSe,$Ge).call(this,e,n).byteLength,t+=o,t+=Rc(this,cSe)}return String(t+Rc(this,cne).byteLength)}});var Lnr=S((bda,$nr)=>{"use strict";$nr.exports=typeof self=="object"?self.FormData:window.FormData});var Fnr=S(sg=>{"use strict";var m$n=sg&&sg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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$n=sg&&sg.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q5=sg&&sg.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&m$n(r,e,n[o]);return h$n(r,e),r}}(),qF=sg&&sg.__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(sg,"__esModule",{value:!0});sg.WebFormData=sg.Node16FormData=sg.Node18FormData=void 0;sg.newFormData=g$n;var pSe=H5();function LGe(t){return typeof t=="object"&&t!=null&&"name"in t}function g$n(){return qF(this,void 0,void 0,function*(){let t;return pSe.RUNTIME.type==="node"&&pSe.RUNTIME.parsedVersion!=null&&pSe.RUNTIME.parsedVersion>=18?t=new mSe:pSe.RUNTIME.type==="node"?t=new hSe:t=new gSe,yield t.setup(),t})}var mSe=class{setup(){return qF(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>Q5(Snr()))).FormData})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){return qF(this,void 0,void 0,function*(){var o,i;n==null&&LGe(r)&&(n=r.name),r instanceof(yield Promise.resolve().then(()=>Q5(zre()))).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 qF(this,void 0,void 0,function*(){let e=new(yield Promise.resolve().then(()=>Q5(Dnr()))).FormDataEncoder(this.fd);return{body:yield(yield Promise.resolve().then(()=>Q5(zre()))).Readable.from(e),headers:e.headers,duplex:"half"}})}};sg.Node18FormData=mSe;var hSe=class{setup(){return qF(this,void 0,void 0,function*(){this.fd=new(yield Promise.resolve().then(()=>Q5(Lnr()))).default})}append(e,r){var n;(n=this.fd)===null||n===void 0||n.append(e,r)}appendFile(e,r,n){return qF(this,void 0,void 0,function*(){var o,i;n==null&&LGe(r)&&(n=r.name);let a;r instanceof(yield Promise.resolve().then(()=>Q5(zre()))).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():{}}}};sg.Node16FormData=hSe;var gSe=class{setup(){return qF(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 qF(this,void 0,void 0,function*(){var o;n==null&&LGe(r)&&(n=r.name),(o=this.fd)===null||o===void 0||o.append(e,new Blob([r]),n)})}getRequest(){return{body:this.fd,headers:{}}}};sg.WebFormData=gSe});var knr=S(v1=>{"use strict";var y$n=v1&&v1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b$n=v1&&v1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&y$n(e,t,r)};Object.defineProperty(v1,"__esModule",{value:!0});v1.encodeAsFormParameter=void 0;var _$n=_nr();Object.defineProperty(v1,"encodeAsFormParameter",{enumerable:!0,get:function(){return _$n.encodeAsFormParameter}});b$n(Fnr(),v1)});var dh=S(ySe=>{"use strict";Object.defineProperty(ySe,"__esModule",{value:!0});ySe.SchemaType=void 0;ySe.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 hb=S(FGe=>{"use strict";Object.defineProperty(FGe,"__esModule",{value:!0});FGe.getErrorMessageForIncorrectType=v$n;function v$n(t,e){return`Expected ${e}. Received ${w$n(t)}.`}function w$n(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 xT=S(kGe=>{"use strict";Object.defineProperty(kGe,"__esModule",{value:!0});kGe.maybeSkipValidation=S$n;function S$n(t){return Object.assign(Object.assign({},t),{json:qnr(t.json),parse:qnr(t.parse)})}function qnr(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 BGe=S(qGe=>{"use strict";Object.defineProperty(qGe,"__esModule",{value:!0});qGe.stringifyValidationError=C$n;function C$n(t){return t.path.length===0?t.message:`${t.path.join(" -> ")}: ${t.message}`}});var zGe=S(bSe=>{"use strict";Object.defineProperty(bSe,"__esModule",{value:!0});bSe.JsonError=void 0;var x$n=BGe(),UGe=class t extends Error{constructor(e){super(e.map(x$n.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};bSe.JsonError=UGe});var VGe=S(_Se=>{"use strict";Object.defineProperty(_Se,"__esModule",{value:!0});_Se.ParseError=void 0;var O$n=BGe(),HGe=class t extends Error{constructor(e){super(e.map(O$n.stringifyValidationError).join("; ")),this.errors=e,Object.setPrototypeOf(this,t.prototype)}};_Se.ParseError=HGe});var Vnr=S(i2=>{"use strict";Object.defineProperty(i2,"__esModule",{value:!0});i2.getSchemaUtils=fne;i2.nullable=Bnr;i2.optional=Unr;i2.optionalNullable=znr;i2.transform=Hnr;var JGe=dh(),T$n=zGe(),E$n=VGe();function fne(t){return{nullable:()=>Bnr(t),optional:()=>Unr(t),optionalNullable:()=>znr(t),transform:e=>Hnr(t,e),parseOrThrow:(e,r)=>{let n=t.parse(e,r);if(n.ok)return n.value;throw new E$n.ParseError(n.errors)},jsonOrThrow:(e,r)=>{let n=t.json(e,r);if(n.ok)return n.value;throw new T$n.JsonError(n.errors)}}}function Bnr(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:()=>JGe.SchemaType.NULLABLE};return Object.assign(Object.assign({},e),fne(e))}function Unr(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:()=>JGe.SchemaType.OPTIONAL};return Object.assign(Object.assign({},e),fne(e))}function znr(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:()=>JGe.SchemaType.OPTIONAL_NULLABLE};return Object.assign(Object.assign({},e),fne(e))}function Hnr(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),fne(r))}});var y_=S(SS=>{"use strict";Object.defineProperty(SS,"__esModule",{value:!0});SS.ParseError=SS.JsonError=SS.transform=SS.optional=SS.getSchemaUtils=void 0;var KGe=Vnr();Object.defineProperty(SS,"getSchemaUtils",{enumerable:!0,get:function(){return KGe.getSchemaUtils}});Object.defineProperty(SS,"optional",{enumerable:!0,get:function(){return KGe.optional}});Object.defineProperty(SS,"transform",{enumerable:!0,get:function(){return KGe.transform}});var P$n=zGe();Object.defineProperty(SS,"JsonError",{enumerable:!0,get:function(){return P$n.JsonError}});var M$n=VGe();Object.defineProperty(SS,"ParseError",{enumerable:!0,get:function(){return M$n.ParseError}})});var Knr=S(WGe=>{"use strict";Object.defineProperty(WGe,"__esModule",{value:!0});WGe.bigint=N$n;var R$n=dh(),Jnr=hb(),A$n=xT(),I$n=y_();function N$n(){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,Jnr.getErrorMessageForIncorrectType)(e,"bigint | number")}]},json:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="bigint"?{ok:!1,errors:[{path:r,message:(0,Jnr.getErrorMessageForIncorrectType)(e,"bigint")}]}:{ok:!0,value:e},getType:()=>R$n.SchemaType.BIGINT};return Object.assign(Object.assign({},(0,A$n.maybeSkipValidation)(t)),(0,I$n.getSchemaUtils)(t))}});var Wnr=S(vSe=>{"use strict";Object.defineProperty(vSe,"__esModule",{value:!0});vSe.bigint=void 0;var j$n=Knr();Object.defineProperty(vSe,"bigint",{enumerable:!0,get:function(){return j$n.bigint}})});var Gnr=S(ZGe=>{"use strict";Object.defineProperty(ZGe,"__esModule",{value:!0});ZGe.date=k$n;var D$n=dh(),GGe=hb(),$$n=xT(),L$n=y_(),F$n=/^([+-]?\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 k$n(){let t={parse:(e,{breadcrumbsPrefix:r=[]}={})=>typeof e!="string"?{ok:!1,errors:[{path:r,message:(0,GGe.getErrorMessageForIncorrectType)(e,"string")}]}:F$n.test(e)?{ok:!0,value:new Date(e)}:{ok:!1,errors:[{path:r,message:(0,GGe.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,GGe.getErrorMessageForIncorrectType)(e,"Date object")}]},getType:()=>D$n.SchemaType.DATE};return Object.assign(Object.assign({},(0,$$n.maybeSkipValidation)(t)),(0,L$n.getSchemaUtils)(t))}});var Znr=S(wSe=>{"use strict";Object.defineProperty(wSe,"__esModule",{value:!0});wSe.date=void 0;var q$n=Gnr();Object.defineProperty(wSe,"date",{enumerable:!0,get:function(){return q$n.date}})});var w1=S(XGe=>{"use strict";Object.defineProperty(XGe,"__esModule",{value:!0});XGe.createIdentitySchemaCreator=z$n;var B$n=y_(),U$n=xT();function z$n(t,e){return()=>{let r={parse:e,json:e,getType:()=>t};return Object.assign(Object.assign({},(0,U$n.maybeSkipValidation)(r)),(0,B$n.getSchemaUtils)(r))}}});var Ynr=S(YGe=>{"use strict";Object.defineProperty(YGe,"__esModule",{value:!0});YGe.enum_=J$n;var H$n=dh(),V$n=w1(),Xnr=hb();function J$n(t){let e=new Set(t);return(0,V$n.createIdentitySchemaCreator)(H$n.SchemaType.ENUM,(n,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:i=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:i,message:(0,Xnr.getErrorMessageForIncorrectType)(n,"string")}]}:!e.has(n)&&!o?{ok:!1,errors:[{path:i,message:(0,Xnr.getErrorMessageForIncorrectType)(n,"enum")}]}:{ok:!0,value:n})()}});var QGe=S(SSe=>{"use strict";Object.defineProperty(SSe,"__esModule",{value:!0});SSe.enum_=void 0;var K$n=Ynr();Object.defineProperty(SSe,"enum_",{enumerable:!0,get:function(){return K$n.enum_}})});var e9e=S(pne=>{"use strict";Object.defineProperty(pne,"__esModule",{value:!0});pne.lazy=G$n;pne.constructLazyBaseSchema=Qnr;pne.getMemoizedSchema=CSe;var W$n=y_();function G$n(t){let e=Qnr(t);return Object.assign(Object.assign({},e),(0,W$n.getSchemaUtils)(e))}function Qnr(t){return{parse:(e,r)=>CSe(t).parse(e,r),json:(e,r)=>CSe(t).json(e,r),getType:()=>CSe(t).getType()}}function CSe(t){let e=t;return e.__zurg_memoized==null&&(e.__zurg_memoized=t()),e.__zurg_memoized}});var r9e=S(t9e=>{"use strict";Object.defineProperty(t9e,"__esModule",{value:!0});t9e.entries=Z$n;function Z$n(t){return Object.entries(t)}});var o9e=S(n9e=>{"use strict";Object.defineProperty(n9e,"__esModule",{value:!0});n9e.filterObject=X$n;function X$n(t,e){let r=new Set(e);return Object.entries(t).reduce((n,[o,i])=>(r.has(o)&&(n[o]=i),n),{})}});var mne=S(i9e=>{"use strict";Object.defineProperty(i9e,"__esModule",{value:!0});i9e.isPlainObject=Y$n;function Y$n(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 s9e=S(a9e=>{"use strict";Object.defineProperty(a9e,"__esModule",{value:!0});a9e.keys=Q$n;function Q$n(t){return Object.keys(t)}});var eor=S(u9e=>{"use strict";Object.defineProperty(u9e,"__esModule",{value:!0});u9e.partition=eLn;function eLn(t,e){let r=[],n=[];for(let o of t)e(o)?r.push(o):n.push(o);return[r,n]}});var nor=S(xSe=>{"use strict";Object.defineProperty(xSe,"__esModule",{value:!0});xSe.getObjectLikeUtils=tor;xSe.withParsedProperties=ror;var tLn=o9e(),rLn=hb(),nLn=mne(),oLn=y_();function tor(t){return{withParsedProperties:e=>ror(t,e)}}function ror(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,nLn.isPlainObject)(n))return{ok:!1,errors:[{path:(i=o?.breadcrumbsPrefix)!==null&&i!==void 0?i:[],message:(0,rLn.getErrorMessageForIncorrectType)(n,"object")}]};let a=new Set(Object.keys(e)),s=(0,tLn.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,oLn.getSchemaUtils)(r)),tor(r))}});var hne=S(eW=>{"use strict";Object.defineProperty(eW,"__esModule",{value:!0});eW.withParsedProperties=eW.getObjectLikeUtils=void 0;var oor=nor();Object.defineProperty(eW,"getObjectLikeUtils",{enumerable:!0,get:function(){return oor.getObjectLikeUtils}});Object.defineProperty(eW,"withParsedProperties",{enumerable:!0,get:function(){return oor.withParsedProperties}})});var l9e=S(OSe=>{"use strict";Object.defineProperty(OSe,"__esModule",{value:!0});OSe.property=iLn;OSe.isProperty=aLn;function iLn(t,e){return{rawKey:t,valueSchema:e,isProperty:!0}}function aLn(t){return t.isProperty}});var f9e=S(ESe=>{"use strict";Object.defineProperty(ESe,"__esModule",{value:!0});ESe.object=dLn;ESe.getObjectUtils=TSe;var a2=dh(),ior=r9e(),aor=o9e(),sLn=hb(),uLn=mne(),cor=s9e(),lLn=xT(),cLn=eor(),c9e=hne(),d9e=y_(),gne=l9e();function dLn(t){let e={_getRawProperties:()=>Object.entries(t).map(([r,n])=>(0,gne.isProperty)(n)?n.rawKey:r),_getParsedProperties:()=>(0,cor.keys)(t),parse:(r,n)=>{let o={},i=[];for(let[a,s]of(0,ior.entries)(t)){let u=(0,gne.isProperty)(s)?s.rawKey:a,l=(0,gne.isProperty)(s)?s.valueSchema:s,c={rawKey:u,parsedKey:a,valueSchema:l};o[u]=c,lor(l)&&i.push(u)}return sor({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,ior.entries)(t)){let s=(0,gne.isProperty)(a)?a.valueSchema:a;lor(s)&&o.push(i)}return sor({value:r,requiredKeys:o,getProperty:i=>{let a=t[i];if(a!=null)return(0,gne.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:()=>a2.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},(0,lLn.maybeSkipValidation)(e)),(0,d9e.getSchemaUtils)(e)),(0,c9e.getObjectLikeUtils)(e)),TSe(e))}function sor({value:t,requiredKeys:e,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:o=!1,breadcrumbsPrefix:i=[]}){if(!(0,uLn.isPlainObject)(t))return{ok:!1,errors:[{path:i,message:(0,sLn.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 TSe(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:()=>a2.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),(0,d9e.getSchemaUtils)(r)),(0,c9e.getObjectLikeUtils)(r)),TSe(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:()=>a2.SchemaType.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,d9e.getSchemaUtils)(e)),(0,c9e.getObjectLikeUtils)(e)),TSe(e))}}}function uor({extensionKeys:t,value:e,transformBase:r,transformExtension:n}){let o=new Set(t),[i,a]=(0,cLn.partition)((0,cor.keys)(e),l=>o.has(l)),s=r((0,aor.filterObject)(e,a)),u=n((0,aor.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 lor(t){return!fLn(t)}function fLn(t){switch(t.getType()){case a2.SchemaType.ANY:case a2.SchemaType.UNKNOWN:case a2.SchemaType.OPTIONAL:case a2.SchemaType.OPTIONAL_NULLABLE:return!0;default:return!1}}});var dor=S(p9e=>{"use strict";Object.defineProperty(p9e,"__esModule",{value:!0});p9e.objectWithoutOptionalProperties=mLn;var pLn=f9e();function mLn(t){return(0,pLn.object)(t)}});var m9e=S(CS=>{"use strict";Object.defineProperty(CS,"__esModule",{value:!0});CS.property=CS.isProperty=CS.objectWithoutOptionalProperties=CS.object=CS.getObjectUtils=void 0;var por=f9e();Object.defineProperty(CS,"getObjectUtils",{enumerable:!0,get:function(){return por.getObjectUtils}});Object.defineProperty(CS,"object",{enumerable:!0,get:function(){return por.object}});var hLn=dor();Object.defineProperty(CS,"objectWithoutOptionalProperties",{enumerable:!0,get:function(){return hLn.objectWithoutOptionalProperties}});var mor=l9e();Object.defineProperty(CS,"isProperty",{enumerable:!0,get:function(){return mor.isProperty}});Object.defineProperty(CS,"property",{enumerable:!0,get:function(){return mor.property}})});var hor=S(g9e=>{"use strict";Object.defineProperty(g9e,"__esModule",{value:!0});g9e.lazyObject=_Ln;var gLn=m9e(),yLn=hne(),bLn=y_(),h9e=e9e();function _Ln(t){let e=Object.assign(Object.assign({},(0,h9e.constructLazyBaseSchema)(t)),{_getRawProperties:()=>(0,h9e.getMemoizedSchema)(t)._getRawProperties(),_getParsedProperties:()=>(0,h9e.getMemoizedSchema)(t)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},e),(0,bLn.getSchemaUtils)(e)),(0,yLn.getObjectLikeUtils)(e)),(0,gLn.getObjectUtils)(e))}});var gor=S(tW=>{"use strict";Object.defineProperty(tW,"__esModule",{value:!0});tW.lazyObject=tW.lazy=void 0;var vLn=e9e();Object.defineProperty(tW,"lazy",{enumerable:!0,get:function(){return vLn.lazy}});var wLn=hor();Object.defineProperty(tW,"lazyObject",{enumerable:!0,get:function(){return wLn.lazyObject}})});var bor=S(y9e=>{"use strict";Object.defineProperty(y9e,"__esModule",{value:!0});y9e.list=TLn;var SLn=dh(),CLn=hb(),xLn=xT(),OLn=y_();function TLn(t){let e={parse:(r,n)=>yor(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)=>yor(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:()=>SLn.SchemaType.LIST};return Object.assign(Object.assign({},(0,xLn.maybeSkipValidation)(e)),(0,OLn.getSchemaUtils)(e))}function yor(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,CLn.getErrorMessageForIncorrectType)(t,"list"),path:[]}]}}});var b9e=S(PSe=>{"use strict";Object.defineProperty(PSe,"__esModule",{value:!0});PSe.list=void 0;var ELn=bor();Object.defineProperty(PSe,"list",{enumerable:!0,get:function(){return ELn.list}})});var _or=S(_9e=>{"use strict";Object.defineProperty(_9e,"__esModule",{value:!0});_9e.stringLiteral=ALn;var PLn=dh(),MLn=w1(),RLn=hb();function ALn(t){return(0,MLn.createIdentitySchemaCreator)(PLn.SchemaType.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,RLn.getErrorMessageForIncorrectType)(r,`"${t}"`)}]})()}});var vor=S(v9e=>{"use strict";Object.defineProperty(v9e,"__esModule",{value:!0});v9e.booleanLiteral=DLn;var ILn=dh(),NLn=w1(),jLn=hb();function DLn(t){return(0,NLn.createIdentitySchemaCreator)(ILn.SchemaType.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===t?{ok:!0,value:t}:{ok:!1,errors:[{path:n,message:(0,jLn.getErrorMessageForIncorrectType)(r,`${t.toString()}`)}]})()}});var wor=S(rW=>{"use strict";Object.defineProperty(rW,"__esModule",{value:!0});rW.booleanLiteral=rW.stringLiteral=void 0;var $Ln=_or();Object.defineProperty(rW,"stringLiteral",{enumerable:!0,get:function(){return $Ln.stringLiteral}});var LLn=vor();Object.defineProperty(rW,"booleanLiteral",{enumerable:!0,get:function(){return LLn.booleanLiteral}})});var Sor=S(MSe=>{"use strict";Object.defineProperty(MSe,"__esModule",{value:!0});MSe.any=void 0;var FLn=dh(),kLn=w1();MSe.any=(0,kLn.createIdentitySchemaCreator)(FLn.SchemaType.ANY,t=>({ok:!0,value:t}))});var Cor=S(RSe=>{"use strict";Object.defineProperty(RSe,"__esModule",{value:!0});RSe.boolean=void 0;var qLn=dh(),BLn=w1(),ULn=hb();RSe.boolean=(0,BLn.createIdentitySchemaCreator)(qLn.SchemaType.BOOLEAN,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="boolean"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,ULn.getErrorMessageForIncorrectType)(t,"boolean")}]})});var xor=S(ASe=>{"use strict";Object.defineProperty(ASe,"__esModule",{value:!0});ASe.number=void 0;var zLn=dh(),HLn=w1(),VLn=hb();ASe.number=(0,HLn.createIdentitySchemaCreator)(zLn.SchemaType.NUMBER,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="number"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,VLn.getErrorMessageForIncorrectType)(t,"number")}]})});var Oor=S(ISe=>{"use strict";Object.defineProperty(ISe,"__esModule",{value:!0});ISe.string=void 0;var JLn=dh(),KLn=w1(),WLn=hb();ISe.string=(0,KLn.createIdentitySchemaCreator)(JLn.SchemaType.STRING,(t,{breadcrumbsPrefix:e=[]}={})=>typeof t=="string"?{ok:!0,value:t}:{ok:!1,errors:[{path:e,message:(0,WLn.getErrorMessageForIncorrectType)(t,"string")}]})});var Tor=S(NSe=>{"use strict";Object.defineProperty(NSe,"__esModule",{value:!0});NSe.unknown=void 0;var GLn=dh(),ZLn=w1();NSe.unknown=(0,ZLn.createIdentitySchemaCreator)(GLn.SchemaType.UNKNOWN,t=>({ok:!0,value:t}))});var Eor=S(xS=>{"use strict";Object.defineProperty(xS,"__esModule",{value:!0});xS.unknown=xS.string=xS.number=xS.boolean=xS.any=void 0;var XLn=Sor();Object.defineProperty(xS,"any",{enumerable:!0,get:function(){return XLn.any}});var YLn=Cor();Object.defineProperty(xS,"boolean",{enumerable:!0,get:function(){return YLn.boolean}});var QLn=xor();Object.defineProperty(xS,"number",{enumerable:!0,get:function(){return QLn.number}});var eFn=Oor();Object.defineProperty(xS,"string",{enumerable:!0,get:function(){return eFn.string}});var tFn=Tor();Object.defineProperty(xS,"unknown",{enumerable:!0,get:function(){return tFn.unknown}})});var Mor=S(S9e=>{"use strict";Object.defineProperty(S9e,"__esModule",{value:!0});S9e.record=sFn;var w9e=dh(),rFn=r9e(),nFn=hb(),oFn=mne(),iFn=xT(),aFn=y_();function sFn(t,e){let r={parse:(n,o)=>Por({value:n,isKeyNumeric:t.getType()===w9e.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)=>Por({value:n,isKeyNumeric:t.getType()===w9e.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:()=>w9e.SchemaType.RECORD};return Object.assign(Object.assign({},(0,iFn.maybeSkipValidation)(r)),(0,aFn.getSchemaUtils)(r))}function Por({value:t,isKeyNumeric:e,transformKey:r,transformValue:n,breadcrumbsPrefix:o=[]}){return(0,oFn.isPlainObject)(t)?(0,rFn.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,nFn.getErrorMessageForIncorrectType)(t,"object")}]}}});var Ror=S(jSe=>{"use strict";Object.defineProperty(jSe,"__esModule",{value:!0});jSe.record=void 0;var uFn=Mor();Object.defineProperty(jSe,"record",{enumerable:!0,get:function(){return uFn.record}})});var Aor=S(C9e=>{"use strict";Object.defineProperty(C9e,"__esModule",{value:!0});C9e.set=mFn;var lFn=dh(),cFn=hb(),dFn=xT(),fFn=b9e(),pFn=y_();function mFn(t){let e=(0,fFn.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,cFn.getErrorMessageForIncorrectType)(n,"Set")}]}},getType:()=>lFn.SchemaType.SET};return Object.assign(Object.assign({},(0,dFn.maybeSkipValidation)(r)),(0,pFn.getSchemaUtils)(r))}});var Ior=S(DSe=>{"use strict";Object.defineProperty(DSe,"__esModule",{value:!0});DSe.set=void 0;var hFn=Aor();Object.defineProperty(DSe,"set",{enumerable:!0,get:function(){return hFn.set}})});var jor=S(x9e=>{"use strict";Object.defineProperty(x9e,"__esModule",{value:!0});x9e.undiscriminatedUnion=_Fn;var gFn=dh(),yFn=xT(),bFn=y_();function _Fn(t){let e={parse:(r,n)=>Nor((o,i)=>o.parse(r,i),t,n),json:(r,n)=>Nor((o,i)=>o.json(r,i),t,n),getType:()=>gFn.SchemaType.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},(0,yFn.maybeSkipValidation)(e)),(0,bFn.getSchemaUtils)(e))}function Nor(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 Dor=S($Se=>{"use strict";Object.defineProperty($Se,"__esModule",{value:!0});$Se.undiscriminatedUnion=void 0;var vFn=jor();Object.defineProperty($Se,"undiscriminatedUnion",{enumerable:!0,get:function(){return vFn.undiscriminatedUnion}})});var $or=S(O9e=>{"use strict";Object.defineProperty(O9e,"__esModule",{value:!0});O9e.discriminant=wFn;function wFn(t,e){return{parsedDiscriminant:t,rawDiscriminant:e}}});var For=S(yne=>{"use strict";var SFn=yne&&yne.__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(yne,"__esModule",{value:!0});yne.union=AFn;var CFn=dh(),xFn=hb(),OFn=mne(),TFn=s9e(),EFn=xT(),PFn=QGe(),MFn=hne(),RFn=y_();function AFn(t,e){let r=typeof t=="string"?t:t.rawDiscriminant,n=typeof t=="string"?t:t.parsedDiscriminant,o=(0,PFn.enum_)((0,TFn.keys)(e)),i={parse:(a,s)=>Lor({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)=>Lor({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:()=>CFn.SchemaType.UNION};return Object.assign(Object.assign(Object.assign({},(0,EFn.maybeSkipValidation)(i)),(0,RFn.getSchemaUtils)(i)),(0,MFn.getObjectLikeUtils)(i))}function Lor({value:t,discriminant:e,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:i=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!(0,OFn.isPlainObject)(t))return{ok:!1,errors:[{path:s,message:(0,xFn.getErrorMessageForIncorrectType)(t,"object")}]};let u=t,l=e,c=u[l],d=SFn(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 kor=S(nW=>{"use strict";Object.defineProperty(nW,"__esModule",{value:!0});nW.union=nW.discriminant=void 0;var IFn=$or();Object.defineProperty(nW,"discriminant",{enumerable:!0,get:function(){return IFn.discriminant}});var NFn=For();Object.defineProperty(nW,"union",{enumerable:!0,get:function(){return NFn.union}})});var qor=S(_d=>{"use strict";var jFn=_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]}),b_=_d&&_d.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&jFn(e,t,r)};Object.defineProperty(_d,"__esModule",{value:!0});b_(Wnr(),_d);b_(Znr(),_d);b_(QGe(),_d);b_(gor(),_d);b_(b9e(),_d);b_(wor(),_d);b_(m9e(),_d);b_(hne(),_d);b_(Eor(),_d);b_(Ror(),_d);b_(y_(),_d);b_(Ior(),_d);b_(Dor(),_d);b_(kor(),_d)});var Bor=S(s2=>{"use strict";var DFn=s2&&s2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),$Fn=s2&&s2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DFn(e,t,r)};Object.defineProperty(s2,"__esModule",{value:!0});$Fn(qor(),s2)});var ne=S(ug=>{"use strict";var Uor=ug&&ug.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=ug&&ug.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bne=ug&&ug.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Uor(e,t,r)},FFn=ug&&ug.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Uor(r,e,n[o]);return LFn(r,e),r}}();Object.defineProperty(ug,"__esModule",{value:!0});ug.serialization=void 0;bne(unr(),ug);bne(H5(),ug);bne(pnr(),ug);bne(bnr(),ug);bne(knr(),ug);ug.serialization=FFn(Bor())});var Hor=S(lg=>{"use strict";var _ne=lg&&lg.__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())})},vne=lg&&lg.__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)}},jl=lg&&lg.__await||function(t){return this instanceof jl?(this.v=t,this):new jl(t)},wne=lg&&lg.__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(g,y){i.push([p,h,g,y])>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 jl?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(lg,"__esModule",{value:!0});lg.LineDecoder=lg.StreamUtils=void 0;lg._iterSSEMessages=zor;lg._decodeChunks=BFn;lg.readableStreamAsyncIterable=P9e;var oW=Pc(),T9e=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1;function o(){return wne(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=vne(zor(e,r)),p;p=yield jl(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(g){throw console.error("Could not parse message into JSON:",m.data),console.error("From chunk:",m.raw),g}if(h&&h.error)throw new oW.CohereError({message:`Error: ${h.error}`});yield yield jl(h)}else{let h;try{h=JSON.parse(m.data)}catch(g){throw console.error("Could not parse message into JSON:",m.data),console.error("From chunk:",m.raw),g}if(m.event=="error")throw new oW.CohereError({message:`Error: ${h.message}, ${h.error}`});yield yield jl({event:m.event,data:h})}}}}catch(m){s={error:m}}finally{try{!d&&!a&&(u=f.return)&&(yield jl(u.call(f)))}finally{if(s)throw s.error}}c=!0}catch(m){if(m instanceof Error&&m.name==="AbortError")return yield jl(void 0);throw m}finally{c||r?.abort()}})}return new t(o,r)}static fromReadableStream(e,r){let n=!1;function o(){return wne(this,arguments,function*(){var s,u,l,c;let d=new BF,f=P9e(e);try{for(var p=!0,m=vne(f),h;h=yield jl(m.next()),s=h.done,!s;p=!0){c=h.value,p=!1;let g=c;for(let y of d.decode(g))yield yield jl(y)}}catch(g){u={error:g}}finally{try{!p&&!s&&(l=m.return)&&(yield jl(l.call(m)))}finally{if(u)throw u.error}}for(let g of d.flush())yield yield jl(g)})}function i(){return wne(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=vne(o()),m;m=yield jl(p.next()),s=m.done,!s;f=!0){c=m.value,f=!1;let h=c;d||h&&(yield yield jl(JSON.parse(h)))}}catch(h){u={error:h}}finally{try{!f&&!s&&(l=p.return)&&(yield jl(l.call(p)))}finally{if(u)throw u.error}}d=!0}catch(h){if(h instanceof Error&&h.name==="AbortError")return yield jl(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 _ne(this,void 0,void 0,function*(){r=e[Symbol.asyncIterator]()})},pull(o){return _ne(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 _ne(this,void 0,void 0,function*(){var o;yield(o=r.return)===null||o===void 0?void 0:o.call(r)})}})}};lg.StreamUtils=T9e;function zor(t,e){return wne(this,arguments,function*(){var n,o,i,a;if(!t.body)throw e?.abort(),new oW.CohereError({message:"Attempted to iterate over a response with no body"});let s=new E9e,u=new BF,l=P9e(t.body);try{for(var c=!0,d=vne(kFn(l)),f;f=yield jl(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 jl(h))}}}catch(p){o={error:p}}finally{try{!c&&!n&&(i=d.return)&&(yield jl(i.call(d)))}finally{if(o)throw o.error}}for(let p of u.flush()){let m=s.decode(p);m&&(yield yield jl(m))}})}function kFn(t){return wne(this,arguments,function*(){var r,n,o,i;let a=new Uint8Array;try{for(var s=!0,u=vne(t),l;l=yield jl(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=qFn(a))!==-1;)yield yield jl(a.slice(0,p)),a=a.slice(p)}}catch(c){n={error:c}}finally{try{!s&&!r&&(o=u.return)&&(yield jl(o.call(u)))}finally{if(n)throw n.error}}a.length>0&&(yield yield jl(a))})}function qFn(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 E9e=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]=UFn(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},BF=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 oW.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 oW.CohereError({message:`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`})}throw new oW.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}};lg.LineDecoder=BF;BF.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);BF.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function BFn(t){let e=new BF,r=[];for(let n of t)r.push(...e.decode(n));return r}function UFn(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function P9e(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{next(){return _ne(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 _ne(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 Cne=S(OT=>{"use strict";var zFn=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]}),HFn=OT&&OT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VFn=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"&&zFn(r,e,n[o]);return HFn(r,e),r}}();Object.defineProperty(OT,"__esModule",{value:!0});OT.Document=void 0;var Sne=VFn(ne());OT.Document=Sne.serialization.object({data:Sne.serialization.record(Sne.serialization.string(),Sne.serialization.unknown()),id:Sne.serialization.string().optional()})});var M9e=S(TT=>{"use strict";var JFn=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]}),KFn=TT&&TT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WFn=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"&&JFn(r,e,n[o]);return KFn(r,e),r}}();Object.defineProperty(TT,"__esModule",{value:!0});TT.V2ChatStreamRequestDocumentsItem=void 0;var Vor=WFn(ne()),GFn=Cne();TT.V2ChatStreamRequestDocumentsItem=Vor.serialization.undiscriminatedUnion([Vor.serialization.string(),GFn.Document])});var R9e=S(ET=>{"use strict";var ZFn=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]}),XFn=ET&&ET.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YFn=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"&&ZFn(r,e,n[o]);return XFn(r,e),r}}();Object.defineProperty(ET,"__esModule",{value:!0});ET.V2ChatStreamRequestSafetyMode=void 0;var QFn=YFn(ne());ET.V2ChatStreamRequestSafetyMode=QFn.serialization.enum_(["CONTEXTUAL","STRICT","OFF"])});var A9e=S(PT=>{"use strict";var ekn=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]}),tkn=PT&&PT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rkn=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"&&ekn(r,e,n[o]);return tkn(r,e),r}}();Object.defineProperty(PT,"__esModule",{value:!0});PT.V2ChatStreamRequestToolChoice=void 0;var nkn=rkn(ne());PT.V2ChatStreamRequestToolChoice=nkn.serialization.enum_(["REQUIRED","NONE"])});var I9e=S(MT=>{"use strict";var okn=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]}),ikn=MT&&MT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),akn=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"&&okn(r,e,n[o]);return ikn(r,e),r}}();Object.defineProperty(MT,"__esModule",{value:!0});MT.ChatMessageStartEventDeltaMessage=void 0;var Jor=akn(ne());MT.ChatMessageStartEventDeltaMessage=Jor.serialization.object({role:Jor.serialization.stringLiteral("assistant").optional()})});var N9e=S(RT=>{"use strict";var skn=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]}),ukn=RT&&RT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lkn=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"&&skn(r,e,n[o]);return ukn(r,e),r}}();Object.defineProperty(RT,"__esModule",{value:!0});RT.ChatMessageStartEventDelta=void 0;var ckn=lkn(ne()),dkn=I9e();RT.ChatMessageStartEventDelta=ckn.serialization.object({message:dkn.ChatMessageStartEventDeltaMessage.optional()})});var Bv=S(AT=>{"use strict";var fkn=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]}),pkn=AT&&AT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mkn=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"&&fkn(r,e,n[o]);return pkn(r,e),r}}();Object.defineProperty(AT,"__esModule",{value:!0});AT.ChatStreamEventType=void 0;var hkn=mkn(ne());AT.ChatStreamEventType=hkn.serialization.object({})});var j9e=S(IT=>{"use strict";var gkn=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]}),ykn=IT&&IT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bkn=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"&&gkn(r,e,n[o]);return ykn(r,e),r}}();Object.defineProperty(IT,"__esModule",{value:!0});IT.ChatMessageStartEvent=void 0;var Kor=bkn(ne()),_kn=N9e(),vkn=Bv();IT.ChatMessageStartEvent=Kor.serialization.object({id:Kor.serialization.string().optional(),delta:_kn.ChatMessageStartEventDelta.optional()}).extend(vkn.ChatStreamEventType)});var D9e=S(NT=>{"use strict";var wkn=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]}),Skn=NT&&NT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ckn=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"&&wkn(r,e,n[o]);return Skn(r,e),r}}();Object.defineProperty(NT,"__esModule",{value:!0});NT.ChatContentStartEventDeltaMessageContentType=void 0;var xkn=Ckn(ne());NT.ChatContentStartEventDeltaMessageContentType=xkn.serialization.enum_(["text","thinking"])});var L9e=S(jT=>{"use strict";var Okn=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]}),Tkn=jT&&jT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ekn=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"&&Okn(r,e,n[o]);return Tkn(r,e),r}}();Object.defineProperty(jT,"__esModule",{value:!0});jT.ChatContentStartEventDeltaMessageContent=void 0;var $9e=Ekn(ne()),Pkn=D9e();jT.ChatContentStartEventDeltaMessageContent=$9e.serialization.object({thinking:$9e.serialization.string().optional(),text:$9e.serialization.string().optional(),type:Pkn.ChatContentStartEventDeltaMessageContentType.optional()})});var F9e=S(DT=>{"use strict";var Mkn=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]}),Rkn=DT&&DT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Akn=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"&&Mkn(r,e,n[o]);return Rkn(r,e),r}}();Object.defineProperty(DT,"__esModule",{value:!0});DT.ChatContentStartEventDeltaMessage=void 0;var Ikn=Akn(ne()),Nkn=L9e();DT.ChatContentStartEventDeltaMessage=Ikn.serialization.object({content:Nkn.ChatContentStartEventDeltaMessageContent.optional()})});var k9e=S($T=>{"use strict";var jkn=$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]}),Dkn=$T&&$T.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$kn=$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"&&jkn(r,e,n[o]);return Dkn(r,e),r}}();Object.defineProperty($T,"__esModule",{value:!0});$T.ChatContentStartEventDelta=void 0;var Lkn=$kn(ne()),Fkn=F9e();$T.ChatContentStartEventDelta=Lkn.serialization.object({message:Fkn.ChatContentStartEventDeltaMessage.optional()})});var q9e=S(LT=>{"use strict";var kkn=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]}),qkn=LT&<.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bkn=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"&&kkn(r,e,n[o]);return qkn(r,e),r}}();Object.defineProperty(LT,"__esModule",{value:!0});LT.ChatContentStartEvent=void 0;var Wor=Bkn(ne()),Ukn=k9e(),zkn=Bv();LT.ChatContentStartEvent=Wor.serialization.object({index:Wor.serialization.number().optional(),delta:Ukn.ChatContentStartEventDelta.optional()}).extend(zkn.ChatStreamEventType)});var U9e=S(FT=>{"use strict";var Hkn=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]}),Vkn=FT&&FT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jkn=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"&&Hkn(r,e,n[o]);return Vkn(r,e),r}}();Object.defineProperty(FT,"__esModule",{value:!0});FT.ChatContentDeltaEventDeltaMessageContent=void 0;var B9e=Jkn(ne());FT.ChatContentDeltaEventDeltaMessageContent=B9e.serialization.object({thinking:B9e.serialization.string().optional(),text:B9e.serialization.string().optional()})});var z9e=S(kT=>{"use strict";var Kkn=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]}),Wkn=kT&&kT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gkn=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"&&Kkn(r,e,n[o]);return Wkn(r,e),r}}();Object.defineProperty(kT,"__esModule",{value:!0});kT.ChatContentDeltaEventDeltaMessage=void 0;var Zkn=Gkn(ne()),Xkn=U9e();kT.ChatContentDeltaEventDeltaMessage=Zkn.serialization.object({content:Xkn.ChatContentDeltaEventDeltaMessageContent.optional()})});var H9e=S(qT=>{"use strict";var Ykn=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]}),Qkn=qT&&qT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eqn=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"&&Ykn(r,e,n[o]);return Qkn(r,e),r}}();Object.defineProperty(qT,"__esModule",{value:!0});qT.ChatContentDeltaEventDelta=void 0;var tqn=eqn(ne()),rqn=z9e();qT.ChatContentDeltaEventDelta=tqn.serialization.object({message:rqn.ChatContentDeltaEventDeltaMessage.optional()})});var LSe=S(BT=>{"use strict";var nqn=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]}),oqn=BT&&BT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iqn=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"&&nqn(r,e,n[o]);return oqn(r,e),r}}();Object.defineProperty(BT,"__esModule",{value:!0});BT.LogprobItem=void 0;var u2=iqn(ne());BT.LogprobItem=u2.serialization.object({text:u2.serialization.string().optional(),tokenIds:u2.serialization.property("token_ids",u2.serialization.list(u2.serialization.number())),logprobs:u2.serialization.list(u2.serialization.number()).optional()})});var V9e=S(UT=>{"use strict";var aqn=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]}),sqn=UT&&UT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uqn=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"&&aqn(r,e,n[o]);return sqn(r,e),r}}();Object.defineProperty(UT,"__esModule",{value:!0});UT.ChatContentDeltaEvent=void 0;var Gor=uqn(ne()),lqn=H9e(),cqn=LSe(),dqn=Bv();UT.ChatContentDeltaEvent=Gor.serialization.object({index:Gor.serialization.number().optional(),delta:lqn.ChatContentDeltaEventDelta.optional(),logprobs:cqn.LogprobItem.optional()}).extend(dqn.ChatStreamEventType)});var J9e=S(zT=>{"use strict";var fqn=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]}),pqn=zT&&zT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mqn=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"&&fqn(r,e,n[o]);return pqn(r,e),r}}();Object.defineProperty(zT,"__esModule",{value:!0});zT.ChatContentEndEvent=void 0;var Zor=mqn(ne()),hqn=Bv();zT.ChatContentEndEvent=Zor.serialization.object({index:Zor.serialization.number().optional()}).extend(hqn.ChatStreamEventType)});var W9e=S(HT=>{"use strict";var gqn=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]}),yqn=HT&&HT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bqn=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"&&gqn(r,e,n[o]);return yqn(r,e),r}}();Object.defineProperty(HT,"__esModule",{value:!0});HT.ChatToolPlanDeltaEventDeltaMessage=void 0;var K9e=bqn(ne());HT.ChatToolPlanDeltaEventDeltaMessage=K9e.serialization.object({toolPlan:K9e.serialization.property("tool_plan",K9e.serialization.string().optional())})});var G9e=S(VT=>{"use strict";var _qn=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]}),vqn=VT&&VT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wqn=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"&&_qn(r,e,n[o]);return vqn(r,e),r}}();Object.defineProperty(VT,"__esModule",{value:!0});VT.ChatToolPlanDeltaEventDelta=void 0;var Sqn=wqn(ne()),Cqn=W9e();VT.ChatToolPlanDeltaEventDelta=Sqn.serialization.object({message:Cqn.ChatToolPlanDeltaEventDeltaMessage.optional()})});var Z9e=S(JT=>{"use strict";var xqn=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]}),Oqn=JT&&JT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tqn=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"&&xqn(r,e,n[o]);return Oqn(r,e),r}}();Object.defineProperty(JT,"__esModule",{value:!0});JT.ChatToolPlanDeltaEvent=void 0;var Eqn=Tqn(ne()),Pqn=G9e(),Mqn=Bv();JT.ChatToolPlanDeltaEvent=Eqn.serialization.object({delta:Pqn.ChatToolPlanDeltaEventDelta.optional()}).extend(Mqn.ChatStreamEventType)});var Y9e=S(KT=>{"use strict";var Rqn=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]}),Aqn=KT&&KT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Iqn=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"&&Rqn(r,e,n[o]);return Aqn(r,e),r}}();Object.defineProperty(KT,"__esModule",{value:!0});KT.ToolCallV2Function=void 0;var X9e=Iqn(ne());KT.ToolCallV2Function=X9e.serialization.object({name:X9e.serialization.string().optional(),arguments:X9e.serialization.string().optional()})});var xne=S(WT=>{"use strict";var Nqn=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]}),jqn=WT&&WT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dqn=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"&&Nqn(r,e,n[o]);return jqn(r,e),r}}();Object.defineProperty(WT,"__esModule",{value:!0});WT.ToolCallV2=void 0;var Q9e=Dqn(ne()),$qn=Y9e();WT.ToolCallV2=Q9e.serialization.object({id:Q9e.serialization.string().optional(),type:Q9e.serialization.stringLiteral("function").optional(),function:$qn.ToolCallV2Function.optional()})});var e7e=S(GT=>{"use strict";var Lqn=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]}),Fqn=GT&>.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kqn=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"&&Lqn(r,e,n[o]);return Fqn(r,e),r}}();Object.defineProperty(GT,"__esModule",{value:!0});GT.ChatToolCallStartEventDeltaMessage=void 0;var Xor=kqn(ne()),qqn=xne();GT.ChatToolCallStartEventDeltaMessage=Xor.serialization.object({toolCalls:Xor.serialization.property("tool_calls",qqn.ToolCallV2.optional())})});var t7e=S(ZT=>{"use strict";var Bqn=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]}),Uqn=ZT&&ZT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zqn=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"&&Bqn(r,e,n[o]);return Uqn(r,e),r}}();Object.defineProperty(ZT,"__esModule",{value:!0});ZT.ChatToolCallStartEventDelta=void 0;var Hqn=zqn(ne()),Vqn=e7e();ZT.ChatToolCallStartEventDelta=Hqn.serialization.object({message:Vqn.ChatToolCallStartEventDeltaMessage.optional()})});var r7e=S(XT=>{"use strict";var Jqn=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]}),Kqn=XT&&XT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wqn=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"&&Jqn(r,e,n[o]);return Kqn(r,e),r}}();Object.defineProperty(XT,"__esModule",{value:!0});XT.ChatToolCallStartEvent=void 0;var Yor=Wqn(ne()),Gqn=t7e(),Zqn=Bv();XT.ChatToolCallStartEvent=Yor.serialization.object({index:Yor.serialization.number().optional(),delta:Gqn.ChatToolCallStartEventDelta.optional()}).extend(Zqn.ChatStreamEventType)});var n7e=S(YT=>{"use strict";var Xqn=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]}),Yqn=YT&&YT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qqn=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"&&Xqn(r,e,n[o]);return Yqn(r,e),r}}();Object.defineProperty(YT,"__esModule",{value:!0});YT.ChatToolCallDeltaEventDeltaMessageToolCallsFunction=void 0;var Qor=Qqn(ne());YT.ChatToolCallDeltaEventDeltaMessageToolCallsFunction=Qor.serialization.object({arguments:Qor.serialization.string().optional()})});var o7e=S(QT=>{"use strict";var eBn=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]}),tBn=QT&&QT.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rBn=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"&&eBn(r,e,n[o]);return tBn(r,e),r}}();Object.defineProperty(QT,"__esModule",{value:!0});QT.ChatToolCallDeltaEventDeltaMessageToolCalls=void 0;var nBn=rBn(ne()),oBn=n7e();QT.ChatToolCallDeltaEventDeltaMessageToolCalls=nBn.serialization.object({function:oBn.ChatToolCallDeltaEventDeltaMessageToolCallsFunction.optional()})});var i7e=S(eE=>{"use strict";var iBn=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]}),aBn=eE&&eE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sBn=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"&&iBn(r,e,n[o]);return aBn(r,e),r}}();Object.defineProperty(eE,"__esModule",{value:!0});eE.ChatToolCallDeltaEventDeltaMessage=void 0;var eir=sBn(ne()),uBn=o7e();eE.ChatToolCallDeltaEventDeltaMessage=eir.serialization.object({toolCalls:eir.serialization.property("tool_calls",uBn.ChatToolCallDeltaEventDeltaMessageToolCalls.optional())})});var a7e=S(tE=>{"use strict";var lBn=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]}),cBn=tE&&tE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dBn=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"&&lBn(r,e,n[o]);return cBn(r,e),r}}();Object.defineProperty(tE,"__esModule",{value:!0});tE.ChatToolCallDeltaEventDelta=void 0;var fBn=dBn(ne()),pBn=i7e();tE.ChatToolCallDeltaEventDelta=fBn.serialization.object({message:pBn.ChatToolCallDeltaEventDeltaMessage.optional()})});var s7e=S(rE=>{"use strict";var mBn=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]}),hBn=rE&&rE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gBn=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"&&mBn(r,e,n[o]);return hBn(r,e),r}}();Object.defineProperty(rE,"__esModule",{value:!0});rE.ChatToolCallDeltaEvent=void 0;var tir=gBn(ne()),yBn=a7e(),bBn=Bv();rE.ChatToolCallDeltaEvent=tir.serialization.object({index:tir.serialization.number().optional(),delta:yBn.ChatToolCallDeltaEventDelta.optional()}).extend(bBn.ChatStreamEventType)});var u7e=S(nE=>{"use strict";var _Bn=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]}),vBn=nE&&nE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wBn=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"&&_Bn(r,e,n[o]);return vBn(r,e),r}}();Object.defineProperty(nE,"__esModule",{value:!0});nE.ChatToolCallEndEvent=void 0;var rir=wBn(ne()),SBn=Bv();nE.ChatToolCallEndEvent=rir.serialization.object({index:rir.serialization.number().optional()}).extend(SBn.ChatStreamEventType)});var l7e=S(oE=>{"use strict";var CBn=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]}),xBn=oE&&oE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OBn=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"&&CBn(r,e,n[o]);return xBn(r,e),r}}();Object.defineProperty(oE,"__esModule",{value:!0});oE.ChatToolSource=void 0;var iW=OBn(ne());oE.ChatToolSource=iW.serialization.object({id:iW.serialization.string().optional(),toolOutput:iW.serialization.property("tool_output",iW.serialization.record(iW.serialization.string(),iW.serialization.unknown()).optional())})});var c7e=S(iE=>{"use strict";var TBn=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]}),EBn=iE&&iE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PBn=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"&&TBn(r,e,n[o]);return EBn(r,e),r}}();Object.defineProperty(iE,"__esModule",{value:!0});iE.ChatDocumentSource=void 0;var One=PBn(ne());iE.ChatDocumentSource=One.serialization.object({id:One.serialization.string().optional(),document:One.serialization.record(One.serialization.string(),One.serialization.unknown()).optional()})});var d7e=S(aE=>{"use strict";var MBn=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]}),RBn=aE&&aE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ABn=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"&&MBn(r,e,n[o]);return RBn(r,e),r}}();Object.defineProperty(aE,"__esModule",{value:!0});aE.Source=void 0;var IBn=ABn(ne()),NBn=l7e(),jBn=c7e();aE.Source=IBn.serialization.union("type",{tool:NBn.ChatToolSource,document:jBn.ChatDocumentSource}).transform({transform:t=>t,untransform:t=>t})});var f7e=S(sE=>{"use strict";var DBn=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]}),$Bn=sE&&sE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LBn=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"&&DBn(r,e,n[o]);return $Bn(r,e),r}}();Object.defineProperty(sE,"__esModule",{value:!0});sE.CitationType=void 0;var FBn=LBn(ne());sE.CitationType=FBn.serialization.enum_(["TEXT_CONTENT","THINKING_CONTENT","PLAN"])});var Tne=S(uE=>{"use strict";var kBn=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]}),qBn=uE&&uE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BBn=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"&&kBn(r,e,n[o]);return qBn(r,e),r}}();Object.defineProperty(uE,"__esModule",{value:!0});uE.Citation=void 0;var l2=BBn(ne()),UBn=d7e(),zBn=f7e();uE.Citation=l2.serialization.object({start:l2.serialization.number().optional(),end:l2.serialization.number().optional(),text:l2.serialization.string().optional(),sources:l2.serialization.list(UBn.Source).optional(),contentIndex:l2.serialization.property("content_index",l2.serialization.number().optional()),type:zBn.CitationType.optional()})});var p7e=S(lE=>{"use strict";var HBn=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]}),VBn=lE&&lE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JBn=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"&&HBn(r,e,n[o]);return VBn(r,e),r}}();Object.defineProperty(lE,"__esModule",{value:!0});lE.CitationStartEventDeltaMessage=void 0;var KBn=JBn(ne()),WBn=Tne();lE.CitationStartEventDeltaMessage=KBn.serialization.object({citations:WBn.Citation.optional()})});var m7e=S(cE=>{"use strict";var GBn=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]}),ZBn=cE&&cE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),XBn=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"&&GBn(r,e,n[o]);return ZBn(r,e),r}}();Object.defineProperty(cE,"__esModule",{value:!0});cE.CitationStartEventDelta=void 0;var YBn=XBn(ne()),QBn=p7e();cE.CitationStartEventDelta=YBn.serialization.object({message:QBn.CitationStartEventDeltaMessage.optional()})});var h7e=S(dE=>{"use strict";var eUn=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]}),tUn=dE&&dE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rUn=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"&&eUn(r,e,n[o]);return tUn(r,e),r}}();Object.defineProperty(dE,"__esModule",{value:!0});dE.CitationStartEvent=void 0;var nir=rUn(ne()),nUn=m7e(),oUn=Bv();dE.CitationStartEvent=nir.serialization.object({index:nir.serialization.number().optional(),delta:nUn.CitationStartEventDelta.optional()}).extend(oUn.ChatStreamEventType)});var g7e=S(fE=>{"use strict";var iUn=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]}),aUn=fE&&fE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sUn=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"&&iUn(r,e,n[o]);return aUn(r,e),r}}();Object.defineProperty(fE,"__esModule",{value:!0});fE.CitationEndEvent=void 0;var oir=sUn(ne()),uUn=Bv();fE.CitationEndEvent=oir.serialization.object({index:oir.serialization.number().optional()}).extend(uUn.ChatStreamEventType)});var FSe=S(pE=>{"use strict";var lUn=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]}),cUn=pE&&pE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dUn=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"&&lUn(r,e,n[o]);return cUn(r,e),r}}();Object.defineProperty(pE,"__esModule",{value:!0});pE.ChatFinishReason=void 0;var fUn=dUn(ne());pE.ChatFinishReason=fUn.serialization.enum_(["COMPLETE","STOP_SEQUENCE","MAX_TOKENS","TOOL_CALL","ERROR"])});var y7e=S(mE=>{"use strict";var pUn=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]}),mUn=mE&&mE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hUn=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"&&pUn(r,e,n[o]);return mUn(r,e),r}}();Object.defineProperty(mE,"__esModule",{value:!0});mE.UsageBilledUnits=void 0;var UF=hUn(ne());mE.UsageBilledUnits=UF.serialization.object({inputTokens:UF.serialization.property("input_tokens",UF.serialization.number().optional()),outputTokens:UF.serialization.property("output_tokens",UF.serialization.number().optional()),searchUnits:UF.serialization.property("search_units",UF.serialization.number().optional()),classifications:UF.serialization.number().optional()})});var b7e=S(hE=>{"use strict";var gUn=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]}),yUn=hE&&hE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bUn=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"&&gUn(r,e,n[o]);return yUn(r,e),r}}();Object.defineProperty(hE,"__esModule",{value:!0});hE.UsageTokens=void 0;var Ene=bUn(ne());hE.UsageTokens=Ene.serialization.object({inputTokens:Ene.serialization.property("input_tokens",Ene.serialization.number().optional()),outputTokens:Ene.serialization.property("output_tokens",Ene.serialization.number().optional())})});var kSe=S(gE=>{"use strict";var _Un=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]}),vUn=gE&&gE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wUn=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"&&_Un(r,e,n[o]);return vUn(r,e),r}}();Object.defineProperty(gE,"__esModule",{value:!0});gE.Usage=void 0;var iir=wUn(ne()),SUn=y7e(),CUn=b7e();gE.Usage=iir.serialization.object({billedUnits:iir.serialization.property("billed_units",SUn.UsageBilledUnits.optional()),tokens:CUn.UsageTokens.optional()})});var v7e=S(yE=>{"use strict";var xUn=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]}),OUn=yE&&yE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TUn=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"&&xUn(r,e,n[o]);return OUn(r,e),r}}();Object.defineProperty(yE,"__esModule",{value:!0});yE.ChatMessageEndEventDelta=void 0;var _7e=TUn(ne()),EUn=FSe(),PUn=kSe();yE.ChatMessageEndEventDelta=_7e.serialization.object({error:_7e.serialization.string().optional(),finishReason:_7e.serialization.property("finish_reason",EUn.ChatFinishReason.optional()),usage:PUn.Usage.optional()})});var w7e=S(bE=>{"use strict";var MUn=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]}),RUn=bE&&bE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AUn=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"&&MUn(r,e,n[o]);return RUn(r,e),r}}();Object.defineProperty(bE,"__esModule",{value:!0});bE.ChatMessageEndEvent=void 0;var air=AUn(ne()),IUn=v7e(),NUn=Bv();bE.ChatMessageEndEvent=air.serialization.object({id:air.serialization.string().optional(),delta:IUn.ChatMessageEndEventDelta.optional()}).extend(NUn.ChatStreamEventType)});var SC=S(_E=>{"use strict";var jUn=_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]}),DUn=_E&&_E.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Un=_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"&&jUn(r,e,n[o]);return DUn(r,e),r}}();Object.defineProperty(_E,"__esModule",{value:!0});_E.ChatStreamEvent=void 0;var LUn=$Un(ne());_E.ChatStreamEvent=LUn.serialization.object({})});var qSe=S(vE=>{"use strict";var FUn=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]}),kUn=vE&&vE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qUn=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"&&FUn(r,e,n[o]);return kUn(r,e),r}}();Object.defineProperty(vE,"__esModule",{value:!0});vE.ChatDebugEvent=void 0;var sir=qUn(ne()),BUn=SC();vE.ChatDebugEvent=sir.serialization.object({prompt:sir.serialization.string().optional()}).extend(BUn.ChatStreamEvent)});var uir=S(wE=>{"use strict";var UUn=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]}),zUn=wE&&wE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HUn=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"&&UUn(r,e,n[o]);return zUn(r,e),r}}();Object.defineProperty(wE,"__esModule",{value:!0});wE.V2ChatStreamResponse=void 0;var VUn=HUn(ne()),JUn=j9e(),KUn=q9e(),WUn=V9e(),GUn=J9e(),ZUn=Z9e(),XUn=r7e(),YUn=s7e(),QUn=u7e(),ezn=h7e(),tzn=g7e(),rzn=w7e(),nzn=qSe();wE.V2ChatStreamResponse=VUn.serialization.union("type",{"message-start":JUn.ChatMessageStartEvent,"content-start":KUn.ChatContentStartEvent,"content-delta":WUn.ChatContentDeltaEvent,"content-end":GUn.ChatContentEndEvent,"tool-plan-delta":ZUn.ChatToolPlanDeltaEvent,"tool-call-start":XUn.ChatToolCallStartEvent,"tool-call-delta":YUn.ChatToolCallDeltaEvent,"tool-call-end":QUn.ChatToolCallEndEvent,"citation-start":ezn.CitationStartEvent,"citation-end":tzn.CitationEndEvent,"message-end":rzn.ChatMessageEndEvent,debug:nzn.ChatDebugEvent}).transform({transform:t=>t,untransform:t=>t})});var S7e=S(SE=>{"use strict";var ozn=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]}),izn=SE&&SE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),azn=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"&&ozn(r,e,n[o]);return izn(r,e),r}}();Object.defineProperty(SE,"__esModule",{value:!0});SE.V2ChatRequestDocumentsItem=void 0;var lir=azn(ne()),szn=Cne();SE.V2ChatRequestDocumentsItem=lir.serialization.undiscriminatedUnion([lir.serialization.string(),szn.Document])});var C7e=S(CE=>{"use strict";var uzn=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]}),lzn=CE&&CE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),czn=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"&&uzn(r,e,n[o]);return lzn(r,e),r}}();Object.defineProperty(CE,"__esModule",{value:!0});CE.V2ChatRequestSafetyMode=void 0;var dzn=czn(ne());CE.V2ChatRequestSafetyMode=dzn.serialization.enum_(["CONTEXTUAL","STRICT","OFF"])});var x7e=S(xE=>{"use strict";var fzn=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]}),pzn=xE&&xE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mzn=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"&&fzn(r,e,n[o]);return pzn(r,e),r}}();Object.defineProperty(xE,"__esModule",{value:!0});xE.V2ChatRequestToolChoice=void 0;var hzn=mzn(ne());xE.V2ChatRequestToolChoice=hzn.serialization.enum_(["REQUIRED","NONE"])});var c2=S(OE=>{"use strict";var gzn=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]}),yzn=OE&&OE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bzn=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"&&gzn(r,e,n[o]);return yzn(r,e),r}}();Object.defineProperty(OE,"__esModule",{value:!0});OE.ChatTextContent=void 0;var cir=bzn(ne());OE.ChatTextContent=cir.serialization.object({text:cir.serialization.string()})});var BSe=S(TE=>{"use strict";var _zn=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]}),vzn=TE&&TE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wzn=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"&&_zn(r,e,n[o]);return vzn(r,e),r}}();Object.defineProperty(TE,"__esModule",{value:!0});TE.ChatThinkingContent=void 0;var dir=wzn(ne());TE.ChatThinkingContent=dir.serialization.object({thinking:dir.serialization.string()})});var O7e=S(EE=>{"use strict";var Szn=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]}),Czn=EE&&EE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xzn=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"&&Szn(r,e,n[o]);return Czn(r,e),r}}();Object.defineProperty(EE,"__esModule",{value:!0});EE.AssistantMessageResponseContentItem=void 0;var Ozn=xzn(ne()),Tzn=c2(),Ezn=BSe();EE.AssistantMessageResponseContentItem=Ozn.serialization.union("type",{text:Tzn.ChatTextContent,thinking:Ezn.ChatThinkingContent}).transform({transform:t=>t,untransform:t=>t})});var T7e=S(PE=>{"use strict";var Pzn=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]}),Mzn=PE&&PE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rzn=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"&&Pzn(r,e,n[o]);return Mzn(r,e),r}}();Object.defineProperty(PE,"__esModule",{value:!0});PE.AssistantMessageResponse=void 0;var zF=Rzn(ne()),Azn=xne(),Izn=O7e(),Nzn=Tne();PE.AssistantMessageResponse=zF.serialization.object({role:zF.serialization.stringLiteral("assistant"),toolCalls:zF.serialization.property("tool_calls",zF.serialization.list(Azn.ToolCallV2).optional()),toolPlan:zF.serialization.property("tool_plan",zF.serialization.string().optional()),content:zF.serialization.list(Izn.AssistantMessageResponseContentItem).optional(),citations:zF.serialization.list(Nzn.Citation).optional()})});var fir=S(ME=>{"use strict";var jzn=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]}),Dzn=ME&&ME.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$zn=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"&&jzn(r,e,n[o]);return Dzn(r,e),r}}();Object.defineProperty(ME,"__esModule",{value:!0});ME.V2ChatResponse=void 0;var USe=$zn(ne()),Lzn=FSe(),Fzn=T7e(),kzn=kSe(),qzn=LSe();ME.V2ChatResponse=USe.serialization.object({id:USe.serialization.string(),finishReason:USe.serialization.property("finish_reason",Lzn.ChatFinishReason),message:Fzn.AssistantMessageResponse,usage:kzn.Usage.optional(),logprobs:USe.serialization.list(qzn.LogprobItem).optional()})});var E7e=S(RE=>{"use strict";var Bzn=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]}),Uzn=RE&&RE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zzn=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"&&Bzn(r,e,n[o]);return Uzn(r,e),r}}();Object.defineProperty(RE,"__esModule",{value:!0});RE.V2EmbedRequestTruncate=void 0;var Hzn=zzn(ne());RE.V2EmbedRequestTruncate=Hzn.serialization.enum_(["NONE","START","END"])});var P7e=S(AE=>{"use strict";var Vzn=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]}),Jzn=AE&&AE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kzn=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"&&Vzn(r,e,n[o]);return Jzn(r,e),r}}();Object.defineProperty(AE,"__esModule",{value:!0});AE.V2RerankResponseResultsItem=void 0;var zSe=Kzn(ne());AE.V2RerankResponseResultsItem=zSe.serialization.object({index:zSe.serialization.number(),relevanceScore:zSe.serialization.property("relevance_score",zSe.serialization.number())})});var M7e=S(IE=>{"use strict";var Wzn=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]}),Gzn=IE&&IE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zzn=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"&&Wzn(r,e,n[o]);return Gzn(r,e),r}}();Object.defineProperty(IE,"__esModule",{value:!0});IE.ApiMetaApiVersion=void 0;var aW=Zzn(ne());IE.ApiMetaApiVersion=aW.serialization.object({version:aW.serialization.string(),isDeprecated:aW.serialization.property("is_deprecated",aW.serialization.boolean().optional()),isExperimental:aW.serialization.property("is_experimental",aW.serialization.boolean().optional())})});var R7e=S(NE=>{"use strict";var Xzn=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]}),Yzn=NE&&NE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qzn=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"&&Xzn(r,e,n[o]);return Yzn(r,e),r}}();Object.defineProperty(NE,"__esModule",{value:!0});NE.ApiMetaBilledUnits=void 0;var S1=Qzn(ne());NE.ApiMetaBilledUnits=S1.serialization.object({images:S1.serialization.number().optional(),inputTokens:S1.serialization.property("input_tokens",S1.serialization.number().optional()),outputTokens:S1.serialization.property("output_tokens",S1.serialization.number().optional()),searchUnits:S1.serialization.property("search_units",S1.serialization.number().optional()),classifications:S1.serialization.number().optional()})});var A7e=S(jE=>{"use strict";var e4n=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]}),t4n=jE&&jE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r4n=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"&&e4n(r,e,n[o]);return t4n(r,e),r}}();Object.defineProperty(jE,"__esModule",{value:!0});jE.ApiMetaTokens=void 0;var Pne=r4n(ne());jE.ApiMetaTokens=Pne.serialization.object({inputTokens:Pne.serialization.property("input_tokens",Pne.serialization.number().optional()),outputTokens:Pne.serialization.property("output_tokens",Pne.serialization.number().optional())})});var __=S(DE=>{"use strict";var n4n=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]}),o4n=DE&&DE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i4n=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"&&n4n(r,e,n[o]);return o4n(r,e),r}}();Object.defineProperty(DE,"__esModule",{value:!0});DE.ApiMeta=void 0;var Mne=i4n(ne()),a4n=M7e(),s4n=R7e(),u4n=A7e();DE.ApiMeta=Mne.serialization.object({apiVersion:Mne.serialization.property("api_version",a4n.ApiMetaApiVersion.optional()),billedUnits:Mne.serialization.property("billed_units",s4n.ApiMetaBilledUnits.optional()),tokens:u4n.ApiMetaTokens.optional(),warnings:Mne.serialization.list(Mne.serialization.string()).optional()})});var pir=S($E=>{"use strict";var l4n=$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]}),c4n=$E&&$E.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d4n=$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"&&l4n(r,e,n[o]);return c4n(r,e),r}}();Object.defineProperty($E,"__esModule",{value:!0});$E.V2RerankResponse=void 0;var I7e=d4n(ne()),f4n=P7e(),p4n=__();$E.V2RerankResponse=I7e.serialization.object({id:I7e.serialization.string().optional(),results:I7e.serialization.list(f4n.V2RerankResponseResultsItem),meta:p4n.ApiMeta.optional()})});var N7e=S(cg=>{"use strict";var m4n=cg&&cg.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CC=cg&&cg.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&m4n(e,t,r)};Object.defineProperty(cg,"__esModule",{value:!0});CC(M9e(),cg);CC(R9e(),cg);CC(A9e(),cg);CC(uir(),cg);CC(S7e(),cg);CC(C7e(),cg);CC(x7e(),cg);CC(fir(),cg);CC(E7e(),cg);CC(P7e(),cg);CC(pir(),cg)});var j7e=S(LE=>{"use strict";var h4n=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]}),g4n=LE&&LE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y4n=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"&&h4n(r,e,n[o]);return g4n(r,e),r}}();Object.defineProperty(LE,"__esModule",{value:!0});LE.ImageUrlDetail=void 0;var b4n=y4n(ne());LE.ImageUrlDetail=b4n.serialization.enum_(["auto","low","high"])});var D7e=S(FE=>{"use strict";var _4n=FE&&FE.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v4n=FE&&FE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w4n=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"&&_4n(r,e,n[o]);return v4n(r,e),r}}();Object.defineProperty(FE,"__esModule",{value:!0});FE.ImageUrl=void 0;var mir=w4n(ne()),S4n=j7e();FE.ImageUrl=mir.serialization.object({url:mir.serialization.string(),detail:S4n.ImageUrlDetail.optional()})});var $7e=S(kE=>{"use strict";var C4n=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]}),x4n=kE&&kE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O4n=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"&&C4n(r,e,n[o]);return x4n(r,e),r}}();Object.defineProperty(kE,"__esModule",{value:!0});kE.ImageContent=void 0;var hir=O4n(ne()),T4n=D7e();kE.ImageContent=hir.serialization.object({imageUrl:hir.serialization.property("image_url",T4n.ImageUrl)})});var L7e=S(qE=>{"use strict";var E4n=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]}),P4n=qE&&qE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M4n=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"&&E4n(r,e,n[o]);return P4n(r,e),r}}();Object.defineProperty(qE,"__esModule",{value:!0});qE.Content=void 0;var R4n=M4n(ne()),A4n=c2(),I4n=$7e();qE.Content=R4n.serialization.union("type",{text:A4n.ChatTextContent,image_url:I4n.ImageContent}).transform({transform:t=>t,untransform:t=>t})});var k7e=S(BE=>{"use strict";var N4n=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]}),j4n=BE&&BE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D4n=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"&&N4n(r,e,n[o]);return j4n(r,e),r}}();Object.defineProperty(BE,"__esModule",{value:!0});BE.UserMessageV2Content=void 0;var F7e=D4n(ne()),$4n=L7e();BE.UserMessageV2Content=F7e.serialization.undiscriminatedUnion([F7e.serialization.string(),F7e.serialization.list($4n.Content)])});var q7e=S(UE=>{"use strict";var L4n=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]}),F4n=UE&&UE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k4n=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"&&L4n(r,e,n[o]);return F4n(r,e),r}}();Object.defineProperty(UE,"__esModule",{value:!0});UE.UserMessageV2=void 0;var q4n=k4n(ne()),B4n=k7e();UE.UserMessageV2=q4n.serialization.object({content:B4n.UserMessageV2Content})});var B7e=S(zE=>{"use strict";var U4n=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]}),z4n=zE&&zE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H4n=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"&&U4n(r,e,n[o]);return z4n(r,e),r}}();Object.defineProperty(zE,"__esModule",{value:!0});zE.AssistantMessageV2ContentItem=void 0;var V4n=H4n(ne()),J4n=c2(),K4n=BSe();zE.AssistantMessageV2ContentItem=V4n.serialization.union("type",{text:J4n.ChatTextContent,thinking:K4n.ChatThinkingContent}).transform({transform:t=>t,untransform:t=>t})});var z7e=S(HE=>{"use strict";var W4n=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]}),G4n=HE&&HE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z4n=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"&&W4n(r,e,n[o]);return G4n(r,e),r}}();Object.defineProperty(HE,"__esModule",{value:!0});HE.AssistantMessageV2Content=void 0;var U7e=Z4n(ne()),X4n=B7e();HE.AssistantMessageV2Content=U7e.serialization.undiscriminatedUnion([U7e.serialization.string(),U7e.serialization.list(X4n.AssistantMessageV2ContentItem)])});var H7e=S(VE=>{"use strict";var Y4n=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]}),Q4n=VE&&VE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e2n=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"&&Y4n(r,e,n[o]);return Q4n(r,e),r}}();Object.defineProperty(VE,"__esModule",{value:!0});VE.AssistantMessage=void 0;var sW=e2n(ne()),t2n=xne(),r2n=z7e(),n2n=Tne();VE.AssistantMessage=sW.serialization.object({toolCalls:sW.serialization.property("tool_calls",sW.serialization.list(t2n.ToolCallV2).optional()),toolPlan:sW.serialization.property("tool_plan",sW.serialization.string().optional()),content:r2n.AssistantMessageV2Content.optional(),citations:sW.serialization.list(n2n.Citation).optional()})});var V7e=S(JE=>{"use strict";var o2n=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]}),i2n=JE&&JE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a2n=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"&&o2n(r,e,n[o]);return i2n(r,e),r}}();Object.defineProperty(JE,"__esModule",{value:!0});JE.SystemMessageV2ContentItem=void 0;var s2n=a2n(ne()),u2n=c2();JE.SystemMessageV2ContentItem=s2n.serialization.union("type",{text:u2n.ChatTextContent}).transform({transform:t=>t,untransform:t=>t})});var K7e=S(KE=>{"use strict";var l2n=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]}),c2n=KE&&KE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d2n=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"&&l2n(r,e,n[o]);return c2n(r,e),r}}();Object.defineProperty(KE,"__esModule",{value:!0});KE.SystemMessageV2Content=void 0;var J7e=d2n(ne()),f2n=V7e();KE.SystemMessageV2Content=J7e.serialization.undiscriminatedUnion([J7e.serialization.string(),J7e.serialization.list(f2n.SystemMessageV2ContentItem)])});var W7e=S(WE=>{"use strict";var p2n=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]}),m2n=WE&&WE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h2n=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"&&p2n(r,e,n[o]);return m2n(r,e),r}}();Object.defineProperty(WE,"__esModule",{value:!0});WE.SystemMessageV2=void 0;var g2n=h2n(ne()),y2n=K7e();WE.SystemMessageV2=g2n.serialization.object({content:y2n.SystemMessageV2Content})});var G7e=S(GE=>{"use strict";var b2n=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]}),_2n=GE&&GE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v2n=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"&&b2n(r,e,n[o]);return _2n(r,e),r}}();Object.defineProperty(GE,"__esModule",{value:!0});GE.DocumentContent=void 0;var w2n=v2n(ne()),S2n=Cne();GE.DocumentContent=w2n.serialization.object({document:S2n.Document})});var Z7e=S(ZE=>{"use strict";var C2n=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]}),x2n=ZE&&ZE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O2n=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"&&C2n(r,e,n[o]);return x2n(r,e),r}}();Object.defineProperty(ZE,"__esModule",{value:!0});ZE.ToolContent=void 0;var T2n=O2n(ne()),E2n=c2(),P2n=G7e();ZE.ToolContent=T2n.serialization.union("type",{text:E2n.ChatTextContent,document:P2n.DocumentContent}).transform({transform:t=>t,untransform:t=>t})});var Y7e=S(XE=>{"use strict";var M2n=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]}),R2n=XE&&XE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A2n=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"&&M2n(r,e,n[o]);return R2n(r,e),r}}();Object.defineProperty(XE,"__esModule",{value:!0});XE.ToolMessageV2Content=void 0;var X7e=A2n(ne()),I2n=Z7e();XE.ToolMessageV2Content=X7e.serialization.undiscriminatedUnion([X7e.serialization.string(),X7e.serialization.list(I2n.ToolContent)])});var eZe=S(YE=>{"use strict";var N2n=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]}),j2n=YE&&YE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D2n=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"&&N2n(r,e,n[o]);return j2n(r,e),r}}();Object.defineProperty(YE,"__esModule",{value:!0});YE.ToolMessageV2=void 0;var Q7e=D2n(ne()),$2n=Y7e();YE.ToolMessageV2=Q7e.serialization.object({toolCallId:Q7e.serialization.property("tool_call_id",Q7e.serialization.string()),content:$2n.ToolMessageV2Content})});var tZe=S(QE=>{"use strict";var L2n=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]}),F2n=QE&&QE.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k2n=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"&&L2n(r,e,n[o]);return F2n(r,e),r}}();Object.defineProperty(QE,"__esModule",{value:!0});QE.ChatMessageV2=void 0;var q2n=k2n(ne()),B2n=q7e(),U2n=H7e(),z2n=W7e(),H2n=eZe();QE.ChatMessageV2=q2n.serialization.union("role",{user:B2n.UserMessageV2,assistant:U2n.AssistantMessage,system:z2n.SystemMessageV2,tool:H2n.ToolMessageV2}).transform({transform:t=>t,untransform:t=>t})});var HSe=S(eP=>{"use strict";var V2n=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]}),J2n=eP&&eP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K2n=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"&&V2n(r,e,n[o]);return J2n(r,e),r}}();Object.defineProperty(eP,"__esModule",{value:!0});eP.ChatMessages=void 0;var W2n=K2n(ne()),G2n=tZe();eP.ChatMessages=W2n.serialization.list(G2n.ChatMessageV2)});var rZe=S(tP=>{"use strict";var Z2n=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]}),X2n=tP&&tP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y2n=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"&&Z2n(r,e,n[o]);return X2n(r,e),r}}();Object.defineProperty(tP,"__esModule",{value:!0});tP.ToolV2Function=void 0;var uW=Y2n(ne());tP.ToolV2Function=uW.serialization.object({name:uW.serialization.string(),description:uW.serialization.string().optional(),parameters:uW.serialization.record(uW.serialization.string(),uW.serialization.unknown())})});var VSe=S(rP=>{"use strict";var Q2n=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]}),eHn=rP&&rP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tHn=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"&&Q2n(r,e,n[o]);return eHn(r,e),r}}();Object.defineProperty(rP,"__esModule",{value:!0});rP.ToolV2=void 0;var gir=tHn(ne()),rHn=rZe();rP.ToolV2=gir.serialization.object({type:gir.serialization.stringLiteral("function").optional(),function:rHn.ToolV2Function.optional()})});var nZe=S(nP=>{"use strict";var nHn=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]}),oHn=nP&&nP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iHn=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"&&nHn(r,e,n[o]);return oHn(r,e),r}}();Object.defineProperty(nP,"__esModule",{value:!0});nP.CitationOptionsMode=void 0;var aHn=iHn(ne());nP.CitationOptionsMode=aHn.serialization.enum_(["FAST","ACCURATE","OFF"])});var JSe=S(oP=>{"use strict";var sHn=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]}),uHn=oP&&oP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lHn=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"&&sHn(r,e,n[o]);return uHn(r,e),r}}();Object.defineProperty(oP,"__esModule",{value:!0});oP.CitationOptions=void 0;var cHn=lHn(ne()),dHn=nZe();oP.CitationOptions=cHn.serialization.object({mode:dHn.CitationOptionsMode.optional()})});var oZe=S(iP=>{"use strict";var fHn=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]}),pHn=iP&&iP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mHn=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"&&fHn(r,e,n[o]);return pHn(r,e),r}}();Object.defineProperty(iP,"__esModule",{value:!0});iP.ChatTextResponseFormatV2=void 0;var hHn=mHn(ne());iP.ChatTextResponseFormatV2=hHn.serialization.object({})});var iZe=S(aP=>{"use strict";var gHn=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]}),yHn=aP&&aP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bHn=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"&&gHn(r,e,n[o]);return yHn(r,e),r}}();Object.defineProperty(aP,"__esModule",{value:!0});aP.JsonResponseFormatV2=void 0;var Rne=bHn(ne());aP.JsonResponseFormatV2=Rne.serialization.object({jsonSchema:Rne.serialization.property("json_schema",Rne.serialization.record(Rne.serialization.string(),Rne.serialization.unknown()).optional())})});var KSe=S(sP=>{"use strict";var _Hn=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]}),vHn=sP&&sP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wHn=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"&&_Hn(r,e,n[o]);return vHn(r,e),r}}();Object.defineProperty(sP,"__esModule",{value:!0});sP.ResponseFormatV2=void 0;var SHn=wHn(ne()),CHn=oZe(),xHn=iZe();sP.ResponseFormatV2=SHn.serialization.union("type",{text:CHn.ChatTextResponseFormatV2,json_object:xHn.JsonResponseFormatV2}).transform({transform:t=>t,untransform:t=>t})});var aZe=S(uP=>{"use strict";var OHn=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]}),THn=uP&&uP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EHn=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"&&OHn(r,e,n[o]);return THn(r,e),r}}();Object.defineProperty(uP,"__esModule",{value:!0});uP.ThinkingType=void 0;var PHn=EHn(ne());uP.ThinkingType=PHn.serialization.enum_(["enabled","disabled"])});var WSe=S(lP=>{"use strict";var MHn=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]}),RHn=lP&&lP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AHn=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"&&MHn(r,e,n[o]);return RHn(r,e),r}}();Object.defineProperty(lP,"__esModule",{value:!0});lP.Thinking=void 0;var sZe=AHn(ne()),IHn=aZe();lP.Thinking=sZe.serialization.object({type:IHn.ThinkingType,tokenBudget:sZe.serialization.property("token_budget",sZe.serialization.number().optional())})});var yir=S(cP=>{"use strict";var NHn=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]}),jHn=cP&&cP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DHn=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"&&NHn(r,e,n[o]);return jHn(r,e),r}}();Object.defineProperty(cP,"__esModule",{value:!0});cP.V2ChatStreamRequest=void 0;var Dl=DHn(ne()),$Hn=HSe(),LHn=VSe(),FHn=M9e(),kHn=JSe(),qHn=KSe(),BHn=R9e(),UHn=A9e(),zHn=WSe();cP.V2ChatStreamRequest=Dl.serialization.object({model:Dl.serialization.string(),messages:$Hn.ChatMessages,tools:Dl.serialization.list(LHn.ToolV2).optional(),strictTools:Dl.serialization.property("strict_tools",Dl.serialization.boolean().optional()),documents:Dl.serialization.list(FHn.V2ChatStreamRequestDocumentsItem).optional(),citationOptions:Dl.serialization.property("citation_options",kHn.CitationOptions.optional()),responseFormat:Dl.serialization.property("response_format",qHn.ResponseFormatV2.optional()),safetyMode:Dl.serialization.property("safety_mode",BHn.V2ChatStreamRequestSafetyMode.optional()),maxTokens:Dl.serialization.property("max_tokens",Dl.serialization.number().optional()),stopSequences:Dl.serialization.property("stop_sequences",Dl.serialization.list(Dl.serialization.string()).optional()),temperature:Dl.serialization.number().optional(),seed:Dl.serialization.number().optional(),frequencyPenalty:Dl.serialization.property("frequency_penalty",Dl.serialization.number().optional()),presencePenalty:Dl.serialization.property("presence_penalty",Dl.serialization.number().optional()),k:Dl.serialization.number().optional(),p:Dl.serialization.number().optional(),logprobs:Dl.serialization.boolean().optional(),toolChoice:Dl.serialization.property("tool_choice",UHn.V2ChatStreamRequestToolChoice.optional()),thinking:zHn.Thinking.optional()})});var bir=S(dP=>{"use strict";var HHn=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]}),VHn=dP&&dP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JHn=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"&&HHn(r,e,n[o]);return VHn(r,e),r}}();Object.defineProperty(dP,"__esModule",{value:!0});dP.V2ChatRequest=void 0;var $l=JHn(ne()),KHn=HSe(),WHn=VSe(),GHn=S7e(),ZHn=JSe(),XHn=KSe(),YHn=C7e(),QHn=x7e(),eVn=WSe();dP.V2ChatRequest=$l.serialization.object({model:$l.serialization.string(),messages:KHn.ChatMessages,tools:$l.serialization.list(WHn.ToolV2).optional(),strictTools:$l.serialization.property("strict_tools",$l.serialization.boolean().optional()),documents:$l.serialization.list(GHn.V2ChatRequestDocumentsItem).optional(),citationOptions:$l.serialization.property("citation_options",ZHn.CitationOptions.optional()),responseFormat:$l.serialization.property("response_format",XHn.ResponseFormatV2.optional()),safetyMode:$l.serialization.property("safety_mode",YHn.V2ChatRequestSafetyMode.optional()),maxTokens:$l.serialization.property("max_tokens",$l.serialization.number().optional()),stopSequences:$l.serialization.property("stop_sequences",$l.serialization.list($l.serialization.string()).optional()),temperature:$l.serialization.number().optional(),seed:$l.serialization.number().optional(),frequencyPenalty:$l.serialization.property("frequency_penalty",$l.serialization.number().optional()),presencePenalty:$l.serialization.property("presence_penalty",$l.serialization.number().optional()),k:$l.serialization.number().optional(),p:$l.serialization.number().optional(),logprobs:$l.serialization.boolean().optional(),toolChoice:$l.serialization.property("tool_choice",QHn.V2ChatRequestToolChoice.optional()),thinking:eVn.Thinking.optional()})});var Ane=S(fP=>{"use strict";var tVn=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]}),rVn=fP&&fP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nVn=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"&&tVn(r,e,n[o]);return rVn(r,e),r}}();Object.defineProperty(fP,"__esModule",{value:!0});fP.EmbedInputType=void 0;var oVn=nVn(ne());fP.EmbedInputType=oVn.serialization.enum_(["search_document","search_query","classification","clustering","image"])});var uZe=S(pP=>{"use strict";var iVn=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]}),aVn=pP&&pP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sVn=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"&&iVn(r,e,n[o]);return aVn(r,e),r}}();Object.defineProperty(pP,"__esModule",{value:!0});pP.EmbedImageUrl=void 0;var _ir=sVn(ne());pP.EmbedImageUrl=_ir.serialization.object({url:_ir.serialization.string()})});var lZe=S(mP=>{"use strict";var uVn=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]}),lVn=mP&&mP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cVn=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"&&uVn(r,e,n[o]);return lVn(r,e),r}}();Object.defineProperty(mP,"__esModule",{value:!0});mP.EmbedImage=void 0;var vir=cVn(ne()),dVn=uZe();mP.EmbedImage=vir.serialization.object({imageUrl:vir.serialization.property("image_url",dVn.EmbedImageUrl.optional())})});var cZe=S(hP=>{"use strict";var fVn=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]}),pVn=hP&&hP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mVn=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"&&fVn(r,e,n[o]);return pVn(r,e),r}}();Object.defineProperty(hP,"__esModule",{value:!0});hP.EmbedText=void 0;var wir=mVn(ne());hP.EmbedText=wir.serialization.object({text:wir.serialization.string().optional()})});var dZe=S(gP=>{"use strict";var hVn=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]}),gVn=gP&&gP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yVn=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"&&hVn(r,e,n[o]);return gVn(r,e),r}}();Object.defineProperty(gP,"__esModule",{value:!0});gP.EmbedContent=void 0;var bVn=yVn(ne()),_Vn=lZe(),vVn=cZe();gP.EmbedContent=bVn.serialization.union("type",{image_url:_Vn.EmbedImage,text:vVn.EmbedText}).transform({transform:t=>t,untransform:t=>t})});var fZe=S(yP=>{"use strict";var wVn=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]}),SVn=yP&&yP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CVn=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"&&wVn(r,e,n[o]);return SVn(r,e),r}}();Object.defineProperty(yP,"__esModule",{value:!0});yP.EmbedInput=void 0;var Sir=CVn(ne()),xVn=dZe();yP.EmbedInput=Sir.serialization.object({content:Sir.serialization.list(xVn.EmbedContent)})});var Ine=S(bP=>{"use strict";var OVn=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]}),TVn=bP&&bP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EVn=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"&&OVn(r,e,n[o]);return TVn(r,e),r}}();Object.defineProperty(bP,"__esModule",{value:!0});bP.EmbeddingType=void 0;var PVn=EVn(ne());bP.EmbeddingType=PVn.serialization.enum_(["float","int8","uint8","binary","ubinary","base64"])});var Cir=S(_P=>{"use strict";var MVn=_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]}),RVn=_P&&_P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AVn=_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"&&MVn(r,e,n[o]);return RVn(r,e),r}}();Object.defineProperty(_P,"__esModule",{value:!0});_P.V2EmbedRequest=void 0;var v_=AVn(ne()),IVn=Ane(),NVn=fZe(),jVn=Ine(),DVn=E7e();_P.V2EmbedRequest=v_.serialization.object({texts:v_.serialization.list(v_.serialization.string()).optional(),images:v_.serialization.list(v_.serialization.string()).optional(),model:v_.serialization.string(),inputType:v_.serialization.property("input_type",IVn.EmbedInputType),inputs:v_.serialization.list(NVn.EmbedInput).optional(),maxTokens:v_.serialization.property("max_tokens",v_.serialization.number().optional()),outputDimension:v_.serialization.property("output_dimension",v_.serialization.number().optional()),embeddingTypes:v_.serialization.property("embedding_types",v_.serialization.list(jVn.EmbeddingType).optional()),truncate:DVn.V2EmbedRequestTruncate.optional()})});var xir=S(vP=>{"use strict";var $Vn=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]}),LVn=vP&&vP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FVn=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"&&$Vn(r,e,n[o]);return LVn(r,e),r}}();Object.defineProperty(vP,"__esModule",{value:!0});vP.V2RerankRequest=void 0;var C1=FVn(ne());vP.V2RerankRequest=C1.serialization.object({model:C1.serialization.string(),query:C1.serialization.string(),documents:C1.serialization.list(C1.serialization.string()),topN:C1.serialization.property("top_n",C1.serialization.number().optional()),maxTokensPerDoc:C1.serialization.property("max_tokens_per_doc",C1.serialization.number().optional())})});var pZe=S(wP=>{"use strict";Object.defineProperty(wP,"__esModule",{value:!0});wP.V2RerankRequest=wP.V2EmbedRequest=wP.V2ChatRequest=wP.V2ChatStreamRequest=void 0;var kVn=yir();Object.defineProperty(wP,"V2ChatStreamRequest",{enumerable:!0,get:function(){return kVn.V2ChatStreamRequest}});var qVn=bir();Object.defineProperty(wP,"V2ChatRequest",{enumerable:!0,get:function(){return qVn.V2ChatRequest}});var BVn=Cir();Object.defineProperty(wP,"V2EmbedRequest",{enumerable:!0,get:function(){return BVn.V2EmbedRequest}});var UVn=xir();Object.defineProperty(wP,"V2RerankRequest",{enumerable:!0,get:function(){return UVn.V2RerankRequest}})});var Oir=S(d2=>{"use strict";var zVn=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]}),HVn=d2&&d2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&zVn(e,t,r)};Object.defineProperty(d2,"__esModule",{value:!0});HVn(pZe(),d2)});var Eir=S(HF=>{"use strict";var VVn=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]}),Tir=HF&&HF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&VVn(e,t,r)};Object.defineProperty(HF,"__esModule",{value:!0});Tir(N7e(),HF);Tir(Oir(),HF)});var mZe=S(SP=>{"use strict";var JVn=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]}),KVn=SP&&SP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WVn=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"&&JVn(r,e,n[o]);return KVn(r,e),r}}();Object.defineProperty(SP,"__esModule",{value:!0});SP.CreateEmbedJobRequestTruncate=void 0;var GVn=WVn(ne());SP.CreateEmbedJobRequestTruncate=GVn.serialization.enum_(["START","END"])});var hZe=S(f2=>{"use strict";var ZVn=f2&&f2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=f2&&f2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ZVn(e,t,r)};Object.defineProperty(f2,"__esModule",{value:!0});XVn(mZe(),f2)});var Pir=S(CP=>{"use strict";var YVn=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]}),QVn=CP&&CP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eJn=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"&&YVn(r,e,n[o]);return QVn(r,e),r}}();Object.defineProperty(CP,"__esModule",{value:!0});CP.CreateEmbedJobRequest=void 0;var VF=eJn(ne()),tJn=Ane(),rJn=Ine(),nJn=mZe();CP.CreateEmbedJobRequest=VF.serialization.object({model:VF.serialization.string(),datasetId:VF.serialization.property("dataset_id",VF.serialization.string()),inputType:VF.serialization.property("input_type",tJn.EmbedInputType),name:VF.serialization.string().optional(),embeddingTypes:VF.serialization.property("embedding_types",VF.serialization.list(rJn.EmbeddingType).optional()),truncate:nJn.CreateEmbedJobRequestTruncate.optional()})});var gZe=S(GSe=>{"use strict";Object.defineProperty(GSe,"__esModule",{value:!0});GSe.CreateEmbedJobRequest=void 0;var oJn=Pir();Object.defineProperty(GSe,"CreateEmbedJobRequest",{enumerable:!0,get:function(){return oJn.CreateEmbedJobRequest}})});var Mir=S(p2=>{"use strict";var iJn=p2&&p2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=p2&&p2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&iJn(e,t,r)};Object.defineProperty(p2,"__esModule",{value:!0});aJn(gZe(),p2)});var Air=S(JF=>{"use strict";var sJn=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]}),Rir=JF&&JF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sJn(e,t,r)};Object.defineProperty(JF,"__esModule",{value:!0});Rir(hZe(),JF);Rir(Mir(),JF)});var yZe=S(xP=>{"use strict";var uJn=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]}),lJn=xP&&xP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cJn=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"&&uJn(r,e,n[o]);return lJn(r,e),r}}();Object.defineProperty(xP,"__esModule",{value:!0});xP.DatasetType=void 0;var dJn=cJn(ne());xP.DatasetType=dJn.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 bZe=S(OP=>{"use strict";var fJn=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]}),pJn=OP&&OP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mJn=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"&&fJn(r,e,n[o]);return pJn(r,e),r}}();Object.defineProperty(OP,"__esModule",{value:!0});OP.DatasetValidationStatus=void 0;var hJn=mJn(ne());OP.DatasetValidationStatus=hJn.serialization.enum_(["unknown","queued","processing","failed","validated","skipped"])});var _Ze=S(TP=>{"use strict";var gJn=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]}),yJn=TP&&TP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bJn=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"&&gJn(r,e,n[o]);return yJn(r,e),r}}();Object.defineProperty(TP,"__esModule",{value:!0});TP.DatasetPart=void 0;var Uv=bJn(ne());TP.DatasetPart=Uv.serialization.object({id:Uv.serialization.string(),name:Uv.serialization.string(),url:Uv.serialization.string().optional(),index:Uv.serialization.number().optional(),sizeBytes:Uv.serialization.property("size_bytes",Uv.serialization.number().optional()),numRows:Uv.serialization.property("num_rows",Uv.serialization.number().optional()),originalUrl:Uv.serialization.property("original_url",Uv.serialization.string().optional()),samples:Uv.serialization.list(Uv.serialization.string()).optional()})});var ZSe=S(EP=>{"use strict";var _Jn=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]}),vJn=EP&&EP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wJn=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"&&_Jn(r,e,n[o]);return vJn(r,e),r}}();Object.defineProperty(EP,"__esModule",{value:!0});EP.Dataset=void 0;var fc=wJn(ne()),SJn=yZe(),CJn=bZe(),xJn=_Ze();EP.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",SJn.DatasetType),validationStatus:fc.serialization.property("validation_status",CJn.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(xJn.DatasetPart).optional()),validationWarnings:fc.serialization.property("validation_warnings",fc.serialization.list(fc.serialization.string()).optional())})});var Nir=S(PP=>{"use strict";var OJn=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]}),TJn=PP&&PP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EJn=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"&&OJn(r,e,n[o]);return TJn(r,e),r}}();Object.defineProperty(PP,"__esModule",{value:!0});PP.DatasetsListResponse=void 0;var Iir=EJn(ne()),PJn=ZSe();PP.DatasetsListResponse=Iir.serialization.object({datasets:Iir.serialization.list(PJn.Dataset).optional()})});var Dir=S(MP=>{"use strict";var MJn=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]}),RJn=MP&&MP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AJn=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"&&MJn(r,e,n[o]);return RJn(r,e),r}}();Object.defineProperty(MP,"__esModule",{value:!0});MP.DatasetsCreateResponse=void 0;var jir=AJn(ne());MP.DatasetsCreateResponse=jir.serialization.object({id:jir.serialization.string().optional()})});var $ir=S(RP=>{"use strict";var IJn=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]}),NJn=RP&&RP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jJn=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"&&IJn(r,e,n[o]);return NJn(r,e),r}}();Object.defineProperty(RP,"__esModule",{value:!0});RP.DatasetsGetUsageResponse=void 0;var vZe=jJn(ne());RP.DatasetsGetUsageResponse=vZe.serialization.object({organizationUsage:vZe.serialization.property("organization_usage",vZe.serialization.number().optional())})});var Lir=S(AP=>{"use strict";var DJn=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]}),$Jn=AP&&AP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LJn=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"&&DJn(r,e,n[o]);return $Jn(r,e),r}}();Object.defineProperty(AP,"__esModule",{value:!0});AP.DatasetsGetResponse=void 0;var FJn=LJn(ne()),kJn=ZSe();AP.DatasetsGetResponse=FJn.serialization.object({dataset:kJn.Dataset})});var wZe=S(IP=>{"use strict";var qJn=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]}),XSe=IP&&IP.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qJn(e,t,r)};Object.defineProperty(IP,"__esModule",{value:!0});XSe(Nir(),IP);XSe(Dir(),IP);XSe($ir(),IP);XSe(Lir(),IP)});var Fir=S(NP=>{"use strict";var BJn=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]}),UJn=NP&&NP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zJn=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"&&BJn(r,e,n[o]);return UJn(r,e),r}}();Object.defineProperty(NP,"__esModule",{value:!0});NP.Response=void 0;var SZe=zJn(ne());NP.Response=SZe.serialization.record(SZe.serialization.string(),SZe.serialization.unknown())});var kir=S(jP=>{"use strict";var HJn=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]}),VJn=jP&&jP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JJn=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"&&HJn(r,e,n[o]);return VJn(r,e),r}}();Object.defineProperty(jP,"__esModule",{value:!0});jP.delete=void 0;jP.delete=JJn(Fir())});var Bir=S(KF=>{"use strict";var KJn=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]}),qir=KF&&KF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&KJn(e,t,r)};Object.defineProperty(KF,"__esModule",{value:!0});qir(wZe(),KF);qir(kir(),KF)});var CZe=S(DP=>{"use strict";var WJn=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]}),GJn=DP&&DP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZJn=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"&&WJn(r,e,n[o]);return GJn(r,e),r}}();Object.defineProperty(DP,"__esModule",{value:!0});DP.BaseType=void 0;var XJn=ZJn(ne());DP.BaseType=XJn.serialization.enum_(["BASE_TYPE_UNSPECIFIED","BASE_TYPE_GENERATIVE","BASE_TYPE_CLASSIFICATION","BASE_TYPE_RERANK","BASE_TYPE_CHAT"])});var xZe=S($P=>{"use strict";var YJn=$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]}),QJn=$P&&$P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e3n=$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"&&YJn(r,e,n[o]);return QJn(r,e),r}}();Object.defineProperty($P,"__esModule",{value:!0});$P.Strategy=void 0;var t3n=e3n(ne());$P.Strategy=t3n.serialization.enum_(["STRATEGY_UNSPECIFIED","STRATEGY_VANILLA","STRATEGY_TFEW"])});var OZe=S(LP=>{"use strict";var r3n=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]}),n3n=LP&&LP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o3n=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"&&r3n(r,e,n[o]);return n3n(r,e),r}}();Object.defineProperty(LP,"__esModule",{value:!0});LP.BaseModel=void 0;var YSe=o3n(ne()),i3n=CZe(),a3n=xZe();LP.BaseModel=YSe.serialization.object({name:YSe.serialization.string().optional(),version:YSe.serialization.string().optional(),baseType:YSe.serialization.property("base_type",i3n.BaseType),strategy:a3n.Strategy.optional()})});var TZe=S(FP=>{"use strict";var s3n=FP&&FP.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u3n=FP&&FP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l3n=FP&&FP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&s3n(r,e,n[o]);return u3n(r,e),r}}();Object.defineProperty(FP,"__esModule",{value:!0});FP.LoraTargetModules=void 0;var c3n=l3n(ne());FP.LoraTargetModules=c3n.serialization.enum_(["LORA_TARGET_MODULES_UNSPECIFIED","LORA_TARGET_MODULES_QV","LORA_TARGET_MODULES_QKVO","LORA_TARGET_MODULES_QKVO_FFN"])});var EZe=S(kP=>{"use strict";var d3n=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]}),f3n=kP&&kP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p3n=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"&&d3n(r,e,n[o]);return f3n(r,e),r}}();Object.defineProperty(kP,"__esModule",{value:!0});kP.Hyperparameters=void 0;var vy=p3n(ne()),m3n=TZe();kP.Hyperparameters=vy.serialization.object({earlyStoppingPatience:vy.serialization.property("early_stopping_patience",vy.serialization.number().optional()),earlyStoppingThreshold:vy.serialization.property("early_stopping_threshold",vy.serialization.number().optional()),trainBatchSize:vy.serialization.property("train_batch_size",vy.serialization.number().optional()),trainEpochs:vy.serialization.property("train_epochs",vy.serialization.number().optional()),learningRate:vy.serialization.property("learning_rate",vy.serialization.number().optional()),loraAlpha:vy.serialization.property("lora_alpha",vy.serialization.number().optional()),loraRank:vy.serialization.property("lora_rank",vy.serialization.number().optional()),loraTargetModules:vy.serialization.property("lora_target_modules",m3n.LoraTargetModules.optional())})});var PZe=S(qP=>{"use strict";var h3n=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]}),g3n=qP&&qP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y3n=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"&&h3n(r,e,n[o]);return g3n(r,e),r}}();Object.defineProperty(qP,"__esModule",{value:!0});qP.WandbConfig=void 0;var Nne=y3n(ne());qP.WandbConfig=Nne.serialization.object({project:Nne.serialization.string(),apiKey:Nne.serialization.property("api_key",Nne.serialization.string()),entity:Nne.serialization.string().optional()})});var QSe=S(BP=>{"use strict";var b3n=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]}),_3n=BP&&BP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v3n=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"&&b3n(r,e,n[o]);return _3n(r,e),r}}();Object.defineProperty(BP,"__esModule",{value:!0});BP.Settings=void 0;var lW=v3n(ne()),w3n=OZe(),S3n=EZe(),C3n=PZe();BP.Settings=lW.serialization.object({baseModel:lW.serialization.property("base_model",w3n.BaseModel),datasetId:lW.serialization.property("dataset_id",lW.serialization.string()),hyperparameters:S3n.Hyperparameters.optional(),multiLabel:lW.serialization.property("multi_label",lW.serialization.boolean().optional()),wandb:C3n.WandbConfig.optional()})});var jne=S(UP=>{"use strict";var x3n=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]}),O3n=UP&&UP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),T3n=UP&&UP.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&x3n(r,e,n[o]);return O3n(r,e),r}}();Object.defineProperty(UP,"__esModule",{value:!0});UP.Status=void 0;var E3n=T3n(ne());UP.Status=E3n.serialization.enum_(["STATUS_UNSPECIFIED","STATUS_FINETUNING","STATUS_DEPLOYING_API","STATUS_READY","STATUS_FAILED","STATUS_DELETED","STATUS_TEMPORARILY_OFFLINE","STATUS_PAUSED","STATUS_QUEUED"])});var cW=S(zP=>{"use strict";var P3n=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]}),M3n=zP&&zP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R3n=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"&&P3n(r,e,n[o]);return M3n(r,e),r}}();Object.defineProperty(zP,"__esModule",{value:!0});zP.FinetunedModel=void 0;var gb=R3n(ne()),A3n=QSe(),I3n=jne();zP.FinetunedModel=gb.serialization.object({id:gb.serialization.string().optional(),name:gb.serialization.string(),creatorId:gb.serialization.property("creator_id",gb.serialization.string().optional()),organizationId:gb.serialization.property("organization_id",gb.serialization.string().optional()),settings:A3n.Settings,status:I3n.Status.optional(),createdAt:gb.serialization.property("created_at",gb.serialization.date().optional()),updatedAt:gb.serialization.property("updated_at",gb.serialization.date().optional()),completedAt:gb.serialization.property("completed_at",gb.serialization.date().optional()),lastUsed:gb.serialization.property("last_used",gb.serialization.date().optional())})});var Uir=S(HP=>{"use strict";var N3n=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]}),j3n=HP&&HP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D3n=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"&&N3n(r,e,n[o]);return j3n(r,e),r}}();Object.defineProperty(HP,"__esModule",{value:!0});HP.ListFinetunedModelsResponse=void 0;var m2=D3n(ne()),$3n=cW();HP.ListFinetunedModelsResponse=m2.serialization.object({finetunedModels:m2.serialization.property("finetuned_models",m2.serialization.list($3n.FinetunedModel).optional()),nextPageToken:m2.serialization.property("next_page_token",m2.serialization.string().optional()),totalSize:m2.serialization.property("total_size",m2.serialization.number().optional())})});var Hir=S(VP=>{"use strict";var L3n=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]}),F3n=VP&&VP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k3n=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"&&L3n(r,e,n[o]);return F3n(r,e),r}}();Object.defineProperty(VP,"__esModule",{value:!0});VP.CreateFinetunedModelResponse=void 0;var zir=k3n(ne()),q3n=cW();VP.CreateFinetunedModelResponse=zir.serialization.object({finetunedModel:zir.serialization.property("finetuned_model",q3n.FinetunedModel.optional())})});var Jir=S(JP=>{"use strict";var B3n=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]}),U3n=JP&&JP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z3n=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"&&B3n(r,e,n[o]);return U3n(r,e),r}}();Object.defineProperty(JP,"__esModule",{value:!0});JP.GetFinetunedModelResponse=void 0;var Vir=z3n(ne()),H3n=cW();JP.GetFinetunedModelResponse=Vir.serialization.object({finetunedModel:Vir.serialization.property("finetuned_model",H3n.FinetunedModel.optional())})});var Kir=S(KP=>{"use strict";var V3n=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]}),J3n=KP&&KP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K3n=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"&&V3n(r,e,n[o]);return J3n(r,e),r}}();Object.defineProperty(KP,"__esModule",{value:!0});KP.DeleteFinetunedModelResponse=void 0;var MZe=K3n(ne());KP.DeleteFinetunedModelResponse=MZe.serialization.record(MZe.serialization.string(),MZe.serialization.unknown())});var Gir=S(WP=>{"use strict";var W3n=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]}),G3n=WP&&WP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z3n=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"&&W3n(r,e,n[o]);return G3n(r,e),r}}();Object.defineProperty(WP,"__esModule",{value:!0});WP.UpdateFinetunedModelResponse=void 0;var Wir=Z3n(ne()),X3n=cW();WP.UpdateFinetunedModelResponse=Wir.serialization.object({finetunedModel:Wir.serialization.property("finetuned_model",X3n.FinetunedModel.optional())})});var RZe=S(GP=>{"use strict";var Y3n=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]}),Q3n=GP&&GP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e6n=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"&&Y3n(r,e,n[o]);return Q3n(r,e),r}}();Object.defineProperty(GP,"__esModule",{value:!0});GP.Event=void 0;var Dne=e6n(ne()),t6n=jne();GP.Event=Dne.serialization.object({userId:Dne.serialization.property("user_id",Dne.serialization.string().optional()),status:t6n.Status.optional(),createdAt:Dne.serialization.property("created_at",Dne.serialization.date().optional())})});var Zir=S(ZP=>{"use strict";var r6n=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]}),n6n=ZP&&ZP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o6n=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"&&r6n(r,e,n[o]);return n6n(r,e),r}}();Object.defineProperty(ZP,"__esModule",{value:!0});ZP.ListEventsResponse=void 0;var dW=o6n(ne()),i6n=RZe();ZP.ListEventsResponse=dW.serialization.object({events:dW.serialization.list(i6n.Event).optional(),nextPageToken:dW.serialization.property("next_page_token",dW.serialization.string().optional()),totalSize:dW.serialization.property("total_size",dW.serialization.number().optional())})});var AZe=S(XP=>{"use strict";var a6n=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]}),s6n=XP&&XP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u6n=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"&&a6n(r,e,n[o]);return s6n(r,e),r}}();Object.defineProperty(XP,"__esModule",{value:!0});XP.TrainingStepMetrics=void 0;var WF=u6n(ne());XP.TrainingStepMetrics=WF.serialization.object({createdAt:WF.serialization.property("created_at",WF.serialization.date().optional()),stepNumber:WF.serialization.property("step_number",WF.serialization.number().optional()),metrics:WF.serialization.record(WF.serialization.string(),WF.serialization.number()).optional()})});var Xir=S(YP=>{"use strict";var l6n=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]}),c6n=YP&&YP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d6n=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"&&l6n(r,e,n[o]);return c6n(r,e),r}}();Object.defineProperty(YP,"__esModule",{value:!0});YP.ListTrainingStepMetricsResponse=void 0;var $ne=d6n(ne()),f6n=AZe();YP.ListTrainingStepMetricsResponse=$ne.serialization.object({stepMetrics:$ne.serialization.property("step_metrics",$ne.serialization.list(f6n.TrainingStepMetrics).optional()),nextPageToken:$ne.serialization.property("next_page_token",$ne.serialization.string().optional())})});var IZe=S(Ll=>{"use strict";var p6n=Ll&&Ll.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fh=Ll&&Ll.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&p6n(e,t,r)};Object.defineProperty(Ll,"__esModule",{value:!0});fh(CZe(),Ll);fh(xZe(),Ll);fh(OZe(),Ll);fh(TZe(),Ll);fh(EZe(),Ll);fh(PZe(),Ll);fh(QSe(),Ll);fh(jne(),Ll);fh(cW(),Ll);fh(Uir(),Ll);fh(Hir(),Ll);fh(Jir(),Ll);fh(Kir(),Ll);fh(Gir(),Ll);fh(RZe(),Ll);fh(Zir(),Ll);fh(AZe(),Ll);fh(Xir(),Ll)});var Yir=S(h2=>{"use strict";var m6n=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]}),h6n=h2&&h2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&m6n(e,t,r)};Object.defineProperty(h2,"__esModule",{value:!0});h6n(IZe(),h2)});var ear=S(zv=>{"use strict";var Qir=zv&&zv.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g6n=zv&&zv.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y6n=zv&&zv.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Qir(r,e,n[o]);return g6n(r,e),r}}(),b6n=zv&&zv.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Qir(e,t,r)};Object.defineProperty(zv,"__esModule",{value:!0});zv.finetuning=void 0;zv.finetuning=y6n(Yir());b6n(IZe(),zv)});var rar=S(QP=>{"use strict";var _6n=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]}),v6n=QP&&QP.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w6n=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"&&_6n(r,e,n[o]);return v6n(r,e),r}}();Object.defineProperty(QP,"__esModule",{value:!0});QP.FinetuningUpdateFinetunedModelRequest=void 0;var tar=w6n(ne()),S6n=QSe(),C6n=jne();QP.FinetuningUpdateFinetunedModelRequest=tar.serialization.object({name:tar.serialization.string(),settings:S6n.Settings,status:C6n.Status.optional()})});var NZe=S(e0e=>{"use strict";Object.defineProperty(e0e,"__esModule",{value:!0});e0e.FinetuningUpdateFinetunedModelRequest=void 0;var x6n=rar();Object.defineProperty(e0e,"FinetuningUpdateFinetunedModelRequest",{enumerable:!0,get:function(){return x6n.FinetuningUpdateFinetunedModelRequest}})});var nar=S(g2=>{"use strict";var O6n=g2&&g2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),T6n=g2&&g2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&O6n(e,t,r)};Object.defineProperty(g2,"__esModule",{value:!0});T6n(NZe(),g2)});var iar=S(GF=>{"use strict";var E6n=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]}),oar=GF&&GF.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&E6n(e,t,r)};Object.defineProperty(GF,"__esModule",{value:!0});oar(ear(),GF);oar(nar(),GF)});var t0e=S(tM=>{"use strict";var P6n=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]}),M6n=tM&&tM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),R6n=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"&&P6n(r,e,n[o]);return M6n(r,e),r}}();Object.defineProperty(tM,"__esModule",{value:!0});tM.CreateConnectorOAuth=void 0;var eM=R6n(ne());tM.CreateConnectorOAuth=eM.serialization.object({clientId:eM.serialization.property("client_id",eM.serialization.string().optional()),clientSecret:eM.serialization.property("client_secret",eM.serialization.string().optional()),authorizeUrl:eM.serialization.property("authorize_url",eM.serialization.string().optional()),tokenUrl:eM.serialization.property("token_url",eM.serialization.string().optional()),scope:eM.serialization.string().optional()})});var jZe=S(rM=>{"use strict";var A6n=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]}),I6n=rM&&rM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),N6n=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"&&A6n(r,e,n[o]);return I6n(r,e),r}}();Object.defineProperty(rM,"__esModule",{value:!0});rM.AuthTokenType=void 0;var j6n=N6n(ne());rM.AuthTokenType=j6n.serialization.enum_(["bearer","basic","noscheme"])});var r0e=S(nM=>{"use strict";var D6n=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]}),$6n=nM&&nM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),L6n=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"&&D6n(r,e,n[o]);return $6n(r,e),r}}();Object.defineProperty(nM,"__esModule",{value:!0});nM.CreateConnectorServiceAuth=void 0;var aar=L6n(ne()),F6n=jZe();nM.CreateConnectorServiceAuth=aar.serialization.object({type:F6n.AuthTokenType,token:aar.serialization.string()})});var sar=S(iM=>{"use strict";var k6n=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]}),q6n=iM&&iM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B6n=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"&&k6n(r,e,n[o]);return q6n(r,e),r}}();Object.defineProperty(iM,"__esModule",{value:!0});iM.CreateConnectorRequest=void 0;var oM=B6n(ne()),U6n=t0e(),z6n=r0e();iM.CreateConnectorRequest=oM.serialization.object({name:oM.serialization.string(),description:oM.serialization.string().optional(),url:oM.serialization.string(),excludes:oM.serialization.list(oM.serialization.string()).optional(),oauth:U6n.CreateConnectorOAuth.optional(),active:oM.serialization.boolean().optional(),continueOnFailure:oM.serialization.property("continue_on_failure",oM.serialization.boolean().optional()),serviceAuth:oM.serialization.property("service_auth",z6n.CreateConnectorServiceAuth.optional())})});var uar=S(aM=>{"use strict";var H6n=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]}),V6n=aM&&aM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J6n=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"&&H6n(r,e,n[o]);return V6n(r,e),r}}();Object.defineProperty(aM,"__esModule",{value:!0});aM.UpdateConnectorRequest=void 0;var x1=J6n(ne()),K6n=t0e(),W6n=r0e();aM.UpdateConnectorRequest=x1.serialization.object({name:x1.serialization.string().optional(),url:x1.serialization.string().optional(),excludes:x1.serialization.list(x1.serialization.string()).optional(),oauth:K6n.CreateConnectorOAuth.optional(),active:x1.serialization.boolean().optional(),continueOnFailure:x1.serialization.property("continue_on_failure",x1.serialization.boolean().optional()),serviceAuth:x1.serialization.property("service_auth",W6n.CreateConnectorServiceAuth.optional())})});var DZe=S(fW=>{"use strict";Object.defineProperty(fW,"__esModule",{value:!0});fW.UpdateConnectorRequest=fW.CreateConnectorRequest=void 0;var G6n=sar();Object.defineProperty(fW,"CreateConnectorRequest",{enumerable:!0,get:function(){return G6n.CreateConnectorRequest}});var Z6n=uar();Object.defineProperty(fW,"UpdateConnectorRequest",{enumerable:!0,get:function(){return Z6n.UpdateConnectorRequest}})});var lar=S(y2=>{"use strict";var X6n=y2&&y2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y6n=y2&&y2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&X6n(e,t,r)};Object.defineProperty(y2,"__esModule",{value:!0});Y6n(DZe(),y2)});var car=S(b2=>{"use strict";var Q6n=b2&&b2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eKn=b2&&b2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Q6n(e,t,r)};Object.defineProperty(b2,"__esModule",{value:!0});eKn(lar(),b2)});var far=S(Pu=>{"use strict";var dar=Pu&&Pu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),tKn=Pu&&Pu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Lne=Pu&&Pu.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&dar(r,e,n[o]);return tKn(r,e),r}}(),_2=Pu&&Pu.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dar(e,t,r)};Object.defineProperty(Pu,"__esModule",{value:!0});Pu.connectors=Pu.finetuning=Pu.datasets=Pu.embedJobs=Pu.v2=void 0;Pu.v2=Lne(Eir());_2(N7e(),Pu);Pu.embedJobs=Lne(Air());_2(hZe(),Pu);Pu.datasets=Lne(Bir());_2(wZe(),Pu);Pu.finetuning=Lne(iar());_2(pZe(),Pu);_2(gZe(),Pu);Pu.connectors=Lne(car());_2(DZe(),Pu);_2(NZe(),Pu)});var $Ze=S(sM=>{"use strict";var rKn=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]}),nKn=sM&&sM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oKn=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"&&rKn(r,e,n[o]);return nKn(r,e),r}}();Object.defineProperty(sM,"__esModule",{value:!0});sM.ChatStreamRequestPromptTruncation=void 0;var iKn=oKn(ne());sM.ChatStreamRequestPromptTruncation=iKn.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var LZe=S(uM=>{"use strict";var aKn=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]}),sKn=uM&&uM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uKn=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"&&aKn(r,e,n[o]);return sKn(r,e),r}}();Object.defineProperty(uM,"__esModule",{value:!0});uM.ChatStreamRequestCitationQuality=void 0;var lKn=uKn(ne());uM.ChatStreamRequestCitationQuality=lKn.serialization.enum_(["fast","accurate","off"])});var FZe=S(lM=>{"use strict";var cKn=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]}),dKn=lM&&lM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fKn=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"&&cKn(r,e,n[o]);return dKn(r,e),r}}();Object.defineProperty(lM,"__esModule",{value:!0});lM.ChatStreamRequestSafetyMode=void 0;var pKn=fKn(ne());lM.ChatStreamRequestSafetyMode=pKn.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var qZe=S(cM=>{"use strict";var mKn=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]}),hKn=cM&&cM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gKn=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"&&mKn(r,e,n[o]);return hKn(r,e),r}}();Object.defineProperty(cM,"__esModule",{value:!0});cM.ChatStreamStartEvent=void 0;var kZe=gKn(ne()),yKn=SC();cM.ChatStreamStartEvent=kZe.serialization.object({generationId:kZe.serialization.property("generation_id",kZe.serialization.string())}).extend(yKn.ChatStreamEvent)});var Fne=S(dM=>{"use strict";var bKn=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]}),_Kn=dM&&dM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vKn=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"&&bKn(r,e,n[o]);return _Kn(r,e),r}}();Object.defineProperty(dM,"__esModule",{value:!0});dM.ChatSearchQuery=void 0;var n0e=vKn(ne());dM.ChatSearchQuery=n0e.serialization.object({text:n0e.serialization.string(),generationId:n0e.serialization.property("generation_id",n0e.serialization.string())})});var UZe=S(fM=>{"use strict";var wKn=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]}),SKn=fM&&fM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CKn=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"&&wKn(r,e,n[o]);return SKn(r,e),r}}();Object.defineProperty(fM,"__esModule",{value:!0});fM.ChatSearchQueriesGenerationEvent=void 0;var BZe=CKn(ne()),xKn=Fne(),OKn=SC();fM.ChatSearchQueriesGenerationEvent=BZe.serialization.object({searchQueries:BZe.serialization.property("search_queries",BZe.serialization.list(xKn.ChatSearchQuery))}).extend(OKn.ChatStreamEvent)});var zZe=S(pM=>{"use strict";var TKn=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]}),EKn=pM&&pM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PKn=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"&&TKn(r,e,n[o]);return EKn(r,e),r}}();Object.defineProperty(pM,"__esModule",{value:!0});pM.ChatSearchResultConnector=void 0;var par=PKn(ne());pM.ChatSearchResultConnector=par.serialization.object({id:par.serialization.string()})});var o0e=S(mM=>{"use strict";var MKn=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]}),RKn=mM&&mM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),AKn=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"&&MKn(r,e,n[o]);return RKn(r,e),r}}();Object.defineProperty(mM,"__esModule",{value:!0});mM.ChatSearchResult=void 0;var O1=AKn(ne()),IKn=Fne(),NKn=zZe();mM.ChatSearchResult=O1.serialization.object({searchQuery:O1.serialization.property("search_query",IKn.ChatSearchQuery.optional()),connector:NKn.ChatSearchResultConnector,documentIds:O1.serialization.property("document_ids",O1.serialization.list(O1.serialization.string())),errorMessage:O1.serialization.property("error_message",O1.serialization.string().optional()),continueOnFailure:O1.serialization.property("continue_on_failure",O1.serialization.boolean().optional())})});var pW=S(hM=>{"use strict";var jKn=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]}),DKn=hM&&hM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Kn=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"&&jKn(r,e,n[o]);return DKn(r,e),r}}();Object.defineProperty(hM,"__esModule",{value:!0});hM.ChatDocument=void 0;var HZe=$Kn(ne());hM.ChatDocument=HZe.serialization.record(HZe.serialization.string(),HZe.serialization.string())});var VZe=S(gM=>{"use strict";var LKn=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]}),FKn=gM&&gM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kKn=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"&&LKn(r,e,n[o]);return FKn(r,e),r}}();Object.defineProperty(gM,"__esModule",{value:!0});gM.ChatSearchResultsEvent=void 0;var i0e=kKn(ne()),qKn=o0e(),BKn=pW(),UKn=SC();gM.ChatSearchResultsEvent=i0e.serialization.object({searchResults:i0e.serialization.property("search_results",i0e.serialization.list(qKn.ChatSearchResult).optional()),documents:i0e.serialization.list(BKn.ChatDocument).optional()}).extend(UKn.ChatStreamEvent)});var JZe=S(yM=>{"use strict";var zKn=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]}),HKn=yM&&yM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VKn=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"&&zKn(r,e,n[o]);return HKn(r,e),r}}();Object.defineProperty(yM,"__esModule",{value:!0});yM.ChatTextGenerationEvent=void 0;var mar=VKn(ne()),JKn=SC();yM.ChatTextGenerationEvent=mar.serialization.object({text:mar.serialization.string()}).extend(JKn.ChatStreamEvent)});var KZe=S(bM=>{"use strict";var KKn=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]}),WKn=bM&&bM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GKn=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"&&KKn(r,e,n[o]);return WKn(r,e),r}}();Object.defineProperty(bM,"__esModule",{value:!0});bM.ChatCitationType=void 0;var ZKn=GKn(ne());bM.ChatCitationType=ZKn.serialization.enum_(["TEXT_CONTENT","PLAN"])});var a0e=S(_M=>{"use strict";var XKn=_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]}),YKn=_M&&_M.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QKn=_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"&&XKn(r,e,n[o]);return YKn(r,e),r}}();Object.defineProperty(_M,"__esModule",{value:!0});_M.ChatCitation=void 0;var v2=QKn(ne()),e5n=KZe();_M.ChatCitation=v2.serialization.object({start:v2.serialization.number(),end:v2.serialization.number(),text:v2.serialization.string(),documentIds:v2.serialization.property("document_ids",v2.serialization.list(v2.serialization.string())),type:e5n.ChatCitationType.optional()})});var WZe=S(vM=>{"use strict";var t5n=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]}),r5n=vM&&vM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n5n=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"&&t5n(r,e,n[o]);return r5n(r,e),r}}();Object.defineProperty(vM,"__esModule",{value:!0});vM.ChatCitationGenerationEvent=void 0;var har=n5n(ne()),o5n=a0e(),i5n=SC();vM.ChatCitationGenerationEvent=har.serialization.object({citations:har.serialization.list(o5n.ChatCitation)}).extend(i5n.ChatStreamEvent)});var mW=S(wM=>{"use strict";var a5n=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]}),s5n=wM&&wM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u5n=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"&&a5n(r,e,n[o]);return s5n(r,e),r}}();Object.defineProperty(wM,"__esModule",{value:!0});wM.ToolCall=void 0;var kne=u5n(ne());wM.ToolCall=kne.serialization.object({name:kne.serialization.string(),parameters:kne.serialization.record(kne.serialization.string(),kne.serialization.unknown())})});var GZe=S(SM=>{"use strict";var l5n=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]}),c5n=SM&&SM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d5n=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"&&l5n(r,e,n[o]);return c5n(r,e),r}}();Object.defineProperty(SM,"__esModule",{value:!0});SM.ChatToolCallsGenerationEvent=void 0;var s0e=d5n(ne()),f5n=mW(),p5n=SC();SM.ChatToolCallsGenerationEvent=s0e.serialization.object({text:s0e.serialization.string().optional(),toolCalls:s0e.serialization.property("tool_calls",s0e.serialization.list(f5n.ToolCall))}).extend(p5n.ChatStreamEvent)});var ZZe=S(CM=>{"use strict";var m5n=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]}),h5n=CM&&CM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g5n=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"&&m5n(r,e,n[o]);return h5n(r,e),r}}();Object.defineProperty(CM,"__esModule",{value:!0});CM.ChatStreamEndEventFinishReason=void 0;var y5n=g5n(ne());CM.ChatStreamEndEventFinishReason=y5n.serialization.enum_(["COMPLETE","ERROR_LIMIT","MAX_TOKENS","ERROR","ERROR_TOXIC"])});var hW=S(xM=>{"use strict";var b5n=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]}),_5n=xM&&xM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),v5n=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"&&b5n(r,e,n[o]);return _5n(r,e),r}}();Object.defineProperty(xM,"__esModule",{value:!0});xM.FinishReason=void 0;var w5n=v5n(ne());xM.FinishReason=w5n.serialization.enum_(["COMPLETE","STOP_SEQUENCE","ERROR","ERROR_TOXIC","ERROR_LIMIT","USER_CANCEL","MAX_TOKENS"])});var XZe=S(OM=>{"use strict";var S5n=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]}),C5n=OM&&OM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),x5n=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"&&S5n(r,e,n[o]);return C5n(r,e),r}}();Object.defineProperty(OM,"__esModule",{value:!0});OM.ChatMessage=void 0;var u0e=x5n(ne()),O5n=mW();OM.ChatMessage=u0e.serialization.object({message:u0e.serialization.string(),toolCalls:u0e.serialization.property("tool_calls",u0e.serialization.list(O5n.ToolCall).optional())})});var Bne=S(TM=>{"use strict";var T5n=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]}),E5n=TM&&TM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P5n=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"&&T5n(r,e,n[o]);return E5n(r,e),r}}();Object.defineProperty(TM,"__esModule",{value:!0});TM.ToolResult=void 0;var qne=P5n(ne()),M5n=mW();TM.ToolResult=qne.serialization.object({call:M5n.ToolCall,outputs:qne.serialization.list(qne.serialization.record(qne.serialization.string(),qne.serialization.unknown()))})});var QZe=S(EM=>{"use strict";var R5n=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]}),A5n=EM&&EM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I5n=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"&&R5n(r,e,n[o]);return A5n(r,e),r}}();Object.defineProperty(EM,"__esModule",{value:!0});EM.ChatToolMessage=void 0;var YZe=I5n(ne()),N5n=Bne();EM.ChatToolMessage=YZe.serialization.object({toolResults:YZe.serialization.property("tool_results",YZe.serialization.list(N5n.ToolResult).optional())})});var Une=S(PM=>{"use strict";var j5n=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]}),D5n=PM&&PM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$5n=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"&&j5n(r,e,n[o]);return D5n(r,e),r}}();Object.defineProperty(PM,"__esModule",{value:!0});PM.Message=void 0;var L5n=$5n(ne()),eXe=XZe(),F5n=QZe();PM.Message=L5n.serialization.union("role",{CHATBOT:eXe.ChatMessage,SYSTEM:eXe.ChatMessage,USER:eXe.ChatMessage,TOOL:F5n.ChatToolMessage}).transform({transform:t=>t,untransform:t=>t})});var tXe=S(MM=>{"use strict";var k5n=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]}),q5n=MM&&MM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B5n=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"&&k5n(r,e,n[o]);return q5n(r,e),r}}();Object.defineProperty(MM,"__esModule",{value:!0});MM.NonStreamedChatResponse=void 0;var Em=B5n(ne()),U5n=a0e(),z5n=pW(),H5n=Fne(),V5n=o0e(),J5n=hW(),K5n=mW(),W5n=Une(),G5n=__();MM.NonStreamedChatResponse=Em.serialization.object({text:Em.serialization.string(),generationId:Em.serialization.property("generation_id",Em.serialization.string().optional()),responseId:Em.serialization.property("response_id",Em.serialization.string().optional()),citations:Em.serialization.list(U5n.ChatCitation).optional(),documents:Em.serialization.list(z5n.ChatDocument).optional(),isSearchRequired:Em.serialization.property("is_search_required",Em.serialization.boolean().optional()),searchQueries:Em.serialization.property("search_queries",Em.serialization.list(H5n.ChatSearchQuery).optional()),searchResults:Em.serialization.property("search_results",Em.serialization.list(V5n.ChatSearchResult).optional()),finishReason:Em.serialization.property("finish_reason",J5n.FinishReason.optional()),toolCalls:Em.serialization.property("tool_calls",Em.serialization.list(K5n.ToolCall).optional()),chatHistory:Em.serialization.property("chat_history",Em.serialization.list(W5n.Message).optional()),meta:G5n.ApiMeta.optional()})});var rXe=S(RM=>{"use strict";var Z5n=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]}),X5n=RM&&RM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y5n=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"&&Z5n(r,e,n[o]);return X5n(r,e),r}}();Object.defineProperty(RM,"__esModule",{value:!0});RM.ChatStreamEndEvent=void 0;var gar=Y5n(ne()),Q5n=ZZe(),eWn=tXe(),tWn=SC();RM.ChatStreamEndEvent=gar.serialization.object({finishReason:gar.serialization.property("finish_reason",Q5n.ChatStreamEndEventFinishReason),response:eWn.NonStreamedChatResponse}).extend(tWn.ChatStreamEvent)});var nXe=S(AM=>{"use strict";var rWn=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]}),nWn=AM&&AM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oWn=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"&&rWn(r,e,n[o]);return nWn(r,e),r}}();Object.defineProperty(AM,"__esModule",{value:!0});AM.ToolCallDelta=void 0;var zne=oWn(ne());AM.ToolCallDelta=zne.serialization.object({name:zne.serialization.string().optional(),index:zne.serialization.number().optional(),parameters:zne.serialization.string().optional(),text:zne.serialization.string().optional()})});var iXe=S(IM=>{"use strict";var iWn=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]}),aWn=IM&&IM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sWn=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"&&iWn(r,e,n[o]);return aWn(r,e),r}}();Object.defineProperty(IM,"__esModule",{value:!0});IM.ChatToolCallsChunkEvent=void 0;var oXe=sWn(ne()),uWn=nXe(),lWn=SC();IM.ChatToolCallsChunkEvent=oXe.serialization.object({toolCallDelta:oXe.serialization.property("tool_call_delta",uWn.ToolCallDelta),text:oXe.serialization.string().optional()}).extend(lWn.ChatStreamEvent)});var bar=S(NM=>{"use strict";var cWn=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]}),dWn=NM&&NM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fWn=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"&&cWn(r,e,n[o]);return dWn(r,e),r}}();Object.defineProperty(NM,"__esModule",{value:!0});NM.StreamedChatResponse=void 0;var yar=fWn(ne()),pWn=qZe(),mWn=UZe(),hWn=VZe(),gWn=JZe(),yWn=WZe(),bWn=GZe(),_Wn=rXe(),vWn=iXe(),wWn=qSe();NM.StreamedChatResponse=yar.serialization.union(yar.serialization.discriminant("eventType","event_type"),{"stream-start":pWn.ChatStreamStartEvent,"search-queries-generation":mWn.ChatSearchQueriesGenerationEvent,"search-results":hWn.ChatSearchResultsEvent,"text-generation":gWn.ChatTextGenerationEvent,"citation-generation":yWn.ChatCitationGenerationEvent,"tool-calls-generation":bWn.ChatToolCallsGenerationEvent,"stream-end":_Wn.ChatStreamEndEvent,"tool-calls-chunk":vWn.ChatToolCallsChunkEvent,debug:wWn.ChatDebugEvent}).transform({transform:t=>t,untransform:t=>t})});var aXe=S(jM=>{"use strict";var SWn=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]}),CWn=jM&&jM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xWn=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"&&SWn(r,e,n[o]);return CWn(r,e),r}}();Object.defineProperty(jM,"__esModule",{value:!0});jM.ChatRequestPromptTruncation=void 0;var OWn=xWn(ne());jM.ChatRequestPromptTruncation=OWn.serialization.enum_(["OFF","AUTO","AUTO_PRESERVE_ORDER"])});var sXe=S(DM=>{"use strict";var TWn=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]}),EWn=DM&&DM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PWn=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"&&TWn(r,e,n[o]);return EWn(r,e),r}}();Object.defineProperty(DM,"__esModule",{value:!0});DM.ChatRequestCitationQuality=void 0;var MWn=PWn(ne());DM.ChatRequestCitationQuality=MWn.serialization.enum_(["fast","accurate","off"])});var uXe=S($M=>{"use strict";var RWn=$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]}),AWn=$M&&$M.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IWn=$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"&&RWn(r,e,n[o]);return AWn(r,e),r}}();Object.defineProperty($M,"__esModule",{value:!0});$M.ChatRequestSafetyMode=void 0;var NWn=IWn(ne());$M.ChatRequestSafetyMode=NWn.serialization.enum_(["CONTEXTUAL","STRICT","NONE"])});var lXe=S(LM=>{"use strict";var jWn=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]}),DWn=LM&&LM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Wn=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"&&jWn(r,e,n[o]);return DWn(r,e),r}}();Object.defineProperty(LM,"__esModule",{value:!0});LM.GenerateStreamRequestTruncate=void 0;var LWn=$Wn(ne());LM.GenerateStreamRequestTruncate=LWn.serialization.enum_(["NONE","START","END"])});var cXe=S(FM=>{"use strict";var FWn=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]}),kWn=FM&&FM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qWn=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"&&FWn(r,e,n[o]);return kWn(r,e),r}}();Object.defineProperty(FM,"__esModule",{value:!0});FM.GenerateStreamRequestReturnLikelihoods=void 0;var BWn=qWn(ne());FM.GenerateStreamRequestReturnLikelihoods=BWn.serialization.enum_(["GENERATION","ALL","NONE"])});var Hne=S(kM=>{"use strict";var UWn=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]}),zWn=kM&&kM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HWn=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"&&UWn(r,e,n[o]);return zWn(r,e),r}}();Object.defineProperty(kM,"__esModule",{value:!0});kM.GenerateStreamEvent=void 0;var VWn=HWn(ne());kM.GenerateStreamEvent=VWn.serialization.object({})});var dXe=S(qM=>{"use strict";var JWn=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]}),KWn=qM&&qM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WWn=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"&&JWn(r,e,n[o]);return KWn(r,e),r}}();Object.defineProperty(qM,"__esModule",{value:!0});qM.GenerateStreamText=void 0;var Vne=WWn(ne()),GWn=Hne();qM.GenerateStreamText=Vne.serialization.object({text:Vne.serialization.string(),index:Vne.serialization.number().optional(),isFinished:Vne.serialization.property("is_finished",Vne.serialization.boolean())}).extend(GWn.GenerateStreamEvent)});var fXe=S(BM=>{"use strict";var ZWn=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]}),XWn=BM&&BM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YWn=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"&&ZWn(r,e,n[o]);return XWn(r,e),r}}();Object.defineProperty(BM,"__esModule",{value:!0});BM.SingleGenerationInStream=void 0;var Jne=YWn(ne()),QWn=hW();BM.SingleGenerationInStream=Jne.serialization.object({id:Jne.serialization.string(),text:Jne.serialization.string(),index:Jne.serialization.number().optional(),finishReason:Jne.serialization.property("finish_reason",QWn.FinishReason)})});var pXe=S(UM=>{"use strict";var e8n=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]}),t8n=UM&&UM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r8n=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"&&e8n(r,e,n[o]);return t8n(r,e),r}}();Object.defineProperty(UM,"__esModule",{value:!0});UM.GenerateStreamEndResponse=void 0;var l0e=r8n(ne()),n8n=fXe();UM.GenerateStreamEndResponse=l0e.serialization.object({id:l0e.serialization.string(),prompt:l0e.serialization.string().optional(),generations:l0e.serialization.list(n8n.SingleGenerationInStream).optional()})});var mXe=S(zM=>{"use strict";var o8n=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]}),i8n=zM&&zM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a8n=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"&&o8n(r,e,n[o]);return i8n(r,e),r}}();Object.defineProperty(zM,"__esModule",{value:!0});zM.GenerateStreamEnd=void 0;var c0e=a8n(ne()),s8n=hW(),u8n=pXe(),l8n=Hne();zM.GenerateStreamEnd=c0e.serialization.object({isFinished:c0e.serialization.property("is_finished",c0e.serialization.boolean()),finishReason:c0e.serialization.property("finish_reason",s8n.FinishReason.optional()),response:u8n.GenerateStreamEndResponse}).extend(l8n.GenerateStreamEvent)});var hXe=S(HM=>{"use strict";var c8n=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]}),d8n=HM&&HM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),f8n=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"&&c8n(r,e,n[o]);return d8n(r,e),r}}();Object.defineProperty(HM,"__esModule",{value:!0});HM.GenerateStreamError=void 0;var gW=f8n(ne()),p8n=hW(),m8n=Hne();HM.GenerateStreamError=gW.serialization.object({index:gW.serialization.number().optional(),isFinished:gW.serialization.property("is_finished",gW.serialization.boolean()),finishReason:gW.serialization.property("finish_reason",p8n.FinishReason),err:gW.serialization.string()}).extend(m8n.GenerateStreamEvent)});var war=S(VM=>{"use strict";var h8n=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]}),g8n=VM&&VM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y8n=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"&&h8n(r,e,n[o]);return g8n(r,e),r}}();Object.defineProperty(VM,"__esModule",{value:!0});VM.GenerateStreamedResponse=void 0;var _ar=y8n(ne()),b8n=dXe(),_8n=mXe(),v8n=hXe();VM.GenerateStreamedResponse=_ar.serialization.union(_ar.serialization.discriminant("eventType","event_type"),{"text-generation":b8n.GenerateStreamText,"stream-end":_8n.GenerateStreamEnd,"stream-error":v8n.GenerateStreamError}).transform({transform:t=>t,untransform:t=>t})});var gXe=S(JM=>{"use strict";var w8n=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]}),S8n=JM&&JM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C8n=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"&&w8n(r,e,n[o]);return S8n(r,e),r}}();Object.defineProperty(JM,"__esModule",{value:!0});JM.GenerateRequestTruncate=void 0;var x8n=C8n(ne());JM.GenerateRequestTruncate=x8n.serialization.enum_(["NONE","START","END"])});var yXe=S(KM=>{"use strict";var O8n=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]}),T8n=KM&&KM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),E8n=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"&&O8n(r,e,n[o]);return T8n(r,e),r}}();Object.defineProperty(KM,"__esModule",{value:!0});KM.GenerateRequestReturnLikelihoods=void 0;var P8n=E8n(ne());KM.GenerateRequestReturnLikelihoods=P8n.serialization.enum_(["GENERATION","ALL","NONE"])});var _Xe=S(WM=>{"use strict";var M8n=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]}),R8n=WM&&WM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A8n=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"&&M8n(r,e,n[o]);return R8n(r,e),r}}();Object.defineProperty(WM,"__esModule",{value:!0});WM.SingleGenerationTokenLikelihoodsItem=void 0;var bXe=A8n(ne());WM.SingleGenerationTokenLikelihoodsItem=bXe.serialization.object({token:bXe.serialization.string(),likelihood:bXe.serialization.number()})});var vXe=S(GM=>{"use strict";var I8n=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]}),N8n=GM&&GM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j8n=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"&&I8n(r,e,n[o]);return N8n(r,e),r}}();Object.defineProperty(GM,"__esModule",{value:!0});GM.SingleGeneration=void 0;var w2=j8n(ne()),D8n=_Xe();GM.SingleGeneration=w2.serialization.object({id:w2.serialization.string(),text:w2.serialization.string(),index:w2.serialization.number().optional(),likelihood:w2.serialization.number().optional(),tokenLikelihoods:w2.serialization.property("token_likelihoods",w2.serialization.list(D8n.SingleGenerationTokenLikelihoodsItem).optional())})});var Sar=S(ZM=>{"use strict";var $8n=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]}),L8n=ZM&&ZM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F8n=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"&&$8n(r,e,n[o]);return L8n(r,e),r}}();Object.defineProperty(ZM,"__esModule",{value:!0});ZM.Generation=void 0;var d0e=F8n(ne()),k8n=vXe(),q8n=__();ZM.Generation=d0e.serialization.object({id:d0e.serialization.string(),prompt:d0e.serialization.string().optional(),generations:d0e.serialization.list(k8n.SingleGeneration),meta:q8n.ApiMeta.optional()})});var wXe=S(XM=>{"use strict";var B8n=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]}),U8n=XM&&XM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z8n=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"&&B8n(r,e,n[o]);return U8n(r,e),r}}();Object.defineProperty(XM,"__esModule",{value:!0});XM.EmbedRequestTruncate=void 0;var H8n=z8n(ne());XM.EmbedRequestTruncate=H8n.serialization.enum_(["NONE","START","END"])});var f0e=S(YM=>{"use strict";var V8n=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]}),J8n=YM&&YM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K8n=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"&&V8n(r,e,n[o]);return J8n(r,e),r}}();Object.defineProperty(YM,"__esModule",{value:!0});YM.Image=void 0;var yW=K8n(ne());YM.Image=yW.serialization.object({width:yW.serialization.number(),height:yW.serialization.number(),format:yW.serialization.string(),bitDepth:yW.serialization.property("bit_depth",yW.serialization.number())})});var SXe=S(QM=>{"use strict";var W8n=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]}),G8n=QM&&QM.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Z8n=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"&&W8n(r,e,n[o]);return G8n(r,e),r}}();Object.defineProperty(QM,"__esModule",{value:!0});QM.EmbedFloatsResponse=void 0;var ZF=Z8n(ne()),X8n=f0e(),Y8n=__();QM.EmbedFloatsResponse=ZF.serialization.object({id:ZF.serialization.string(),embeddings:ZF.serialization.list(ZF.serialization.list(ZF.serialization.number())),texts:ZF.serialization.list(ZF.serialization.string()),images:ZF.serialization.list(X8n.Image).optional(),meta:Y8n.ApiMeta.optional()})});var CXe=S(eR=>{"use strict";var Q8n=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]}),eGn=eR&&eR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tGn=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"&&Q8n(r,e,n[o]);return eGn(r,e),r}}();Object.defineProperty(eR,"__esModule",{value:!0});eR.EmbedByTypeResponseEmbeddings=void 0;var ph=tGn(ne());eR.EmbedByTypeResponseEmbeddings=ph.serialization.object({float:ph.serialization.list(ph.serialization.list(ph.serialization.number())).optional(),int8:ph.serialization.list(ph.serialization.list(ph.serialization.number())).optional(),uint8:ph.serialization.list(ph.serialization.list(ph.serialization.number())).optional(),binary:ph.serialization.list(ph.serialization.list(ph.serialization.number())).optional(),ubinary:ph.serialization.list(ph.serialization.list(ph.serialization.number())).optional(),base64:ph.serialization.list(ph.serialization.string()).optional()})});var xXe=S(tR=>{"use strict";var rGn=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]}),nGn=tR&&tR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oGn=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"&&rGn(r,e,n[o]);return nGn(r,e),r}}();Object.defineProperty(tR,"__esModule",{value:!0});tR.EmbedByTypeResponse=void 0;var Kne=oGn(ne()),iGn=CXe(),aGn=f0e(),sGn=__();tR.EmbedByTypeResponse=Kne.serialization.object({id:Kne.serialization.string(),embeddings:iGn.EmbedByTypeResponseEmbeddings,texts:Kne.serialization.list(Kne.serialization.string()).optional(),images:Kne.serialization.list(aGn.Image).optional(),meta:sGn.ApiMeta.optional()})});var xar=S(rR=>{"use strict";var uGn=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]}),lGn=rR&&rR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cGn=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"&&uGn(r,e,n[o]);return lGn(r,e),r}}();Object.defineProperty(rR,"__esModule",{value:!0});rR.EmbedResponse=void 0;var Car=cGn(ne()),dGn=SXe(),fGn=xXe();rR.EmbedResponse=Car.serialization.union(Car.serialization.discriminant("responseType","response_type"),{embeddings_floats:dGn.EmbedFloatsResponse,embeddings_by_type:fGn.EmbedByTypeResponse}).transform({transform:t=>t,untransform:t=>t})});var TXe=S(nR=>{"use strict";var pGn=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]}),mGn=nR&&nR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hGn=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"&&pGn(r,e,n[o]);return mGn(r,e),r}}();Object.defineProperty(nR,"__esModule",{value:!0});nR.RerankDocument=void 0;var OXe=hGn(ne());nR.RerankDocument=OXe.serialization.record(OXe.serialization.string(),OXe.serialization.string())});var EXe=S(oR=>{"use strict";var gGn=oR&&oR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yGn=oR&&oR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bGn=oR&&oR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&gGn(r,e,n[o]);return yGn(r,e),r}}();Object.defineProperty(oR,"__esModule",{value:!0});oR.RerankRequestDocumentsItem=void 0;var Oar=bGn(ne()),_Gn=TXe();oR.RerankRequestDocumentsItem=Oar.serialization.undiscriminatedUnion([Oar.serialization.string(),_Gn.RerankDocument])});var PXe=S(iR=>{"use strict";var vGn=iR&&iR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wGn=iR&&iR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SGn=iR&&iR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&vGn(r,e,n[o]);return wGn(r,e),r}}();Object.defineProperty(iR,"__esModule",{value:!0});iR.RerankResponseResultsItemDocument=void 0;var Tar=SGn(ne());iR.RerankResponseResultsItemDocument=Tar.serialization.object({text:Tar.serialization.string()})});var MXe=S(aR=>{"use strict";var CGn=aR&&aR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xGn=aR&&aR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OGn=aR&&aR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&CGn(r,e,n[o]);return xGn(r,e),r}}();Object.defineProperty(aR,"__esModule",{value:!0});aR.RerankResponseResultsItem=void 0;var p0e=OGn(ne()),TGn=PXe();aR.RerankResponseResultsItem=p0e.serialization.object({document:TGn.RerankResponseResultsItemDocument.optional(),index:p0e.serialization.number(),relevanceScore:p0e.serialization.property("relevance_score",p0e.serialization.number())})});var Ear=S(sR=>{"use strict";var EGn=sR&&sR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PGn=sR&&sR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MGn=sR&&sR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&EGn(r,e,n[o]);return PGn(r,e),r}}();Object.defineProperty(sR,"__esModule",{value:!0});sR.RerankResponse=void 0;var RXe=MGn(ne()),RGn=MXe(),AGn=__();sR.RerankResponse=RXe.serialization.object({id:RXe.serialization.string().optional(),results:RXe.serialization.list(RGn.RerankResponseResultsItem),meta:AGn.ApiMeta.optional()})});var AXe=S(uR=>{"use strict";var IGn=uR&&uR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),NGn=uR&&uR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jGn=uR&&uR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&IGn(r,e,n[o]);return NGn(r,e),r}}();Object.defineProperty(uR,"__esModule",{value:!0});uR.ClassifyRequestTruncate=void 0;var DGn=jGn(ne());uR.ClassifyRequestTruncate=DGn.serialization.enum_(["NONE","START","END"])});var IXe=S(lR=>{"use strict";var $Gn=lR&&lR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LGn=lR&&lR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FGn=lR&&lR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$Gn(r,e,n[o]);return LGn(r,e),r}}();Object.defineProperty(lR,"__esModule",{value:!0});lR.ClassifyResponseClassificationsItemLabelsValue=void 0;var Par=FGn(ne());lR.ClassifyResponseClassificationsItemLabelsValue=Par.serialization.object({confidence:Par.serialization.number().optional()})});var NXe=S(cR=>{"use strict";var kGn=cR&&cR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qGn=cR&&cR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BGn=cR&&cR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&kGn(r,e,n[o]);return qGn(r,e),r}}();Object.defineProperty(cR,"__esModule",{value:!0});cR.ClassifyResponseClassificationsItemClassificationType=void 0;var UGn=BGn(ne());cR.ClassifyResponseClassificationsItemClassificationType=UGn.serialization.enum_(["single-label","multi-label"])});var jXe=S(dR=>{"use strict";var zGn=dR&&dR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HGn=dR&&dR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VGn=dR&&dR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&zGn(r,e,n[o]);return HGn(r,e),r}}();Object.defineProperty(dR,"__esModule",{value:!0});dR.ClassifyResponseClassificationsItem=void 0;var OS=VGn(ne()),JGn=IXe(),KGn=NXe();dR.ClassifyResponseClassificationsItem=OS.serialization.object({id:OS.serialization.string(),input:OS.serialization.string().optional(),prediction:OS.serialization.string().optional(),predictions:OS.serialization.list(OS.serialization.string()),confidence:OS.serialization.number().optional(),confidences:OS.serialization.list(OS.serialization.number()),labels:OS.serialization.record(OS.serialization.string(),JGn.ClassifyResponseClassificationsItemLabelsValue),classificationType:OS.serialization.property("classification_type",KGn.ClassifyResponseClassificationsItemClassificationType)})});var Mar=S(fR=>{"use strict";var WGn=fR&&fR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),GGn=fR&&fR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZGn=fR&&fR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&WGn(r,e,n[o]);return GGn(r,e),r}}();Object.defineProperty(fR,"__esModule",{value:!0});fR.ClassifyResponse=void 0;var DXe=ZGn(ne()),XGn=jXe(),YGn=__();fR.ClassifyResponse=DXe.serialization.object({id:DXe.serialization.string(),classifications:DXe.serialization.list(XGn.ClassifyResponseClassificationsItem),meta:YGn.ApiMeta.optional()})});var $Xe=S(pR=>{"use strict";var QGn=pR&&pR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),e9n=pR&&pR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t9n=pR&&pR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&QGn(r,e,n[o]);return e9n(r,e),r}}();Object.defineProperty(pR,"__esModule",{value:!0});pR.SummarizeRequestLength=void 0;var r9n=t9n(ne());pR.SummarizeRequestLength=r9n.serialization.enum_(["short","medium","long"])});var LXe=S(mR=>{"use strict";var n9n=mR&&mR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o9n=mR&&mR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i9n=mR&&mR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&n9n(r,e,n[o]);return o9n(r,e),r}}();Object.defineProperty(mR,"__esModule",{value:!0});mR.SummarizeRequestFormat=void 0;var a9n=i9n(ne());mR.SummarizeRequestFormat=a9n.serialization.enum_(["paragraph","bullets"])});var FXe=S(hR=>{"use strict";var s9n=hR&&hR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),u9n=hR&&hR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l9n=hR&&hR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&s9n(r,e,n[o]);return u9n(r,e),r}}();Object.defineProperty(hR,"__esModule",{value:!0});hR.SummarizeRequestExtractiveness=void 0;var c9n=l9n(ne());hR.SummarizeRequestExtractiveness=c9n.serialization.enum_(["low","medium","high"])});var Rar=S(gR=>{"use strict";var d9n=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]}),f9n=gR&&gR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),p9n=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"&&d9n(r,e,n[o]);return f9n(r,e),r}}();Object.defineProperty(gR,"__esModule",{value:!0});gR.SummarizeResponse=void 0;var kXe=p9n(ne()),m9n=__();gR.SummarizeResponse=kXe.serialization.object({id:kXe.serialization.string().optional(),summary:kXe.serialization.string().optional(),meta:m9n.ApiMeta.optional()})});var Aar=S(yR=>{"use strict";var h9n=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]}),g9n=yR&&yR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y9n=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"&&h9n(r,e,n[o]);return g9n(r,e),r}}();Object.defineProperty(yR,"__esModule",{value:!0});yR.TokenizeResponse=void 0;var bW=y9n(ne()),b9n=__();yR.TokenizeResponse=bW.serialization.object({tokens:bW.serialization.list(bW.serialization.number()),tokenStrings:bW.serialization.property("token_strings",bW.serialization.list(bW.serialization.string())),meta:b9n.ApiMeta.optional()})});var Nar=S(bR=>{"use strict";var _9n=bR&&bR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),v9n=bR&&bR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w9n=bR&&bR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_9n(r,e,n[o]);return v9n(r,e),r}}();Object.defineProperty(bR,"__esModule",{value:!0});bR.DetokenizeResponse=void 0;var Iar=w9n(ne()),S9n=__();bR.DetokenizeResponse=Iar.serialization.object({text:Iar.serialization.string(),meta:S9n.ApiMeta.optional()})});var jar=S(_R=>{"use strict";var C9n=_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]}),x9n=_R&&_R.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O9n=_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"&&C9n(r,e,n[o]);return x9n(r,e),r}}();Object.defineProperty(_R,"__esModule",{value:!0});_R.CheckApiKeyResponse=void 0;var _W=O9n(ne());_R.CheckApiKeyResponse=_W.serialization.object({valid:_W.serialization.boolean(),organizationId:_W.serialization.property("organization_id",_W.serialization.string().optional()),ownerId:_W.serialization.property("owner_id",_W.serialization.string().optional())})});var m0e=S(vR=>{"use strict";var T9n=vR&&vR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E9n=vR&&vR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P9n=vR&&vR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T9n(r,e,n[o]);return E9n(r,e),r}}();Object.defineProperty(vR,"__esModule",{value:!0});vR.ChatConnector=void 0;var T1=P9n(ne());vR.ChatConnector=T1.serialization.object({id:T1.serialization.string(),userAccessToken:T1.serialization.property("user_access_token",T1.serialization.string().optional()),continueOnFailure:T1.serialization.property("continue_on_failure",T1.serialization.boolean().optional()),options:T1.serialization.record(T1.serialization.string(),T1.serialization.unknown()).optional()})});var qXe=S(wR=>{"use strict";var M9n=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]}),R9n=wR&&wR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A9n=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"&&M9n(r,e,n[o]);return R9n(r,e),r}}();Object.defineProperty(wR,"__esModule",{value:!0});wR.ToolParameterDefinitionsValue=void 0;var h0e=A9n(ne());wR.ToolParameterDefinitionsValue=h0e.serialization.object({description:h0e.serialization.string().optional(),type:h0e.serialization.string(),required:h0e.serialization.boolean().optional()})});var g0e=S(SR=>{"use strict";var I9n=SR&&SR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),N9n=SR&&SR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j9n=SR&&SR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&I9n(r,e,n[o]);return N9n(r,e),r}}();Object.defineProperty(SR,"__esModule",{value:!0});SR.Tool=void 0;var vW=j9n(ne()),D9n=qXe();SR.Tool=vW.serialization.object({name:vW.serialization.string(),description:vW.serialization.string(),parameterDefinitions:vW.serialization.property("parameter_definitions",vW.serialization.record(vW.serialization.string(),D9n.ToolParameterDefinitionsValue).optional())})});var BXe=S(CR=>{"use strict";var $9n=CR&&CR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L9n=CR&&CR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F9n=CR&&CR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$9n(r,e,n[o]);return L9n(r,e),r}}();Object.defineProperty(CR,"__esModule",{value:!0});CR.ChatTextResponseFormat=void 0;var k9n=F9n(ne());CR.ChatTextResponseFormat=k9n.serialization.object({})});var UXe=S(xR=>{"use strict";var q9n=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]}),B9n=xR&&xR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U9n=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"&&q9n(r,e,n[o]);return B9n(r,e),r}}();Object.defineProperty(xR,"__esModule",{value:!0});xR.JsonResponseFormat=void 0;var y0e=U9n(ne());xR.JsonResponseFormat=y0e.serialization.object({schema:y0e.serialization.record(y0e.serialization.string(),y0e.serialization.unknown()).optional()})});var b0e=S(OR=>{"use strict";var z9n=OR&&OR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),H9n=OR&&OR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V9n=OR&&OR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&z9n(r,e,n[o]);return H9n(r,e),r}}();Object.defineProperty(OR,"__esModule",{value:!0});OR.ResponseFormat=void 0;var J9n=V9n(ne()),K9n=BXe(),W9n=UXe();OR.ResponseFormat=J9n.serialization.union("type",{text:K9n.ChatTextResponseFormat,json_object:W9n.JsonResponseFormat}).transform({transform:t=>t,untransform:t=>t})});var zXe=S(TR=>{"use strict";var G9n=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]}),Z9n=TR&&TR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X9n=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"&&G9n(r,e,n[o]);return Z9n(r,e),r}}();Object.defineProperty(TR,"__esModule",{value:!0});TR.EmbedJobStatus=void 0;var Y9n=X9n(ne());TR.EmbedJobStatus=Y9n.serialization.enum_(["processing","complete","cancelling","cancelled","failed"])});var HXe=S(ER=>{"use strict";var Q9n=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]}),e7n=ER&&ER.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),t7n=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"&&Q9n(r,e,n[o]);return e7n(r,e),r}}();Object.defineProperty(ER,"__esModule",{value:!0});ER.EmbedJobTruncate=void 0;var r7n=t7n(ne());ER.EmbedJobTruncate=r7n.serialization.enum_(["START","END"])});var VXe=S(PR=>{"use strict";var n7n=PR&&PR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o7n=PR&&PR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i7n=PR&&PR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&n7n(r,e,n[o]);return o7n(r,e),r}}();Object.defineProperty(PR,"__esModule",{value:!0});PR.EmbedJob=void 0;var xC=i7n(ne()),a7n=zXe(),s7n=HXe(),u7n=__();PR.EmbedJob=xC.serialization.object({jobId:xC.serialization.property("job_id",xC.serialization.string()),name:xC.serialization.string().optional(),status:a7n.EmbedJobStatus,createdAt:xC.serialization.property("created_at",xC.serialization.date()),inputDatasetId:xC.serialization.property("input_dataset_id",xC.serialization.string()),outputDatasetId:xC.serialization.property("output_dataset_id",xC.serialization.string().optional()),model:xC.serialization.string(),truncate:s7n.EmbedJobTruncate,meta:u7n.ApiMeta.optional()})});var Dar=S(MR=>{"use strict";var l7n=MR&&MR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),c7n=MR&&MR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d7n=MR&&MR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&l7n(r,e,n[o]);return c7n(r,e),r}}();Object.defineProperty(MR,"__esModule",{value:!0});MR.ListEmbedJobResponse=void 0;var JXe=d7n(ne()),f7n=VXe();MR.ListEmbedJobResponse=JXe.serialization.object({embedJobs:JXe.serialization.property("embed_jobs",JXe.serialization.list(f7n.EmbedJob).optional())})});var $ar=S(RR=>{"use strict";var p7n=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]}),m7n=RR&&RR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h7n=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"&&p7n(r,e,n[o]);return m7n(r,e),r}}();Object.defineProperty(RR,"__esModule",{value:!0});RR.CreateEmbedJobResponse=void 0;var KXe=h7n(ne()),g7n=__();RR.CreateEmbedJobResponse=KXe.serialization.object({jobId:KXe.serialization.property("job_id",KXe.serialization.string()),meta:g7n.ApiMeta.optional()})});var GXe=S(AR=>{"use strict";var y7n=AR&&AR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),b7n=AR&&AR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_7n=AR&&AR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&y7n(r,e,n[o]);return b7n(r,e),r}}();Object.defineProperty(AR,"__esModule",{value:!0});AR.ClassifyExample=void 0;var WXe=_7n(ne());AR.ClassifyExample=WXe.serialization.object({text:WXe.serialization.string().optional(),label:WXe.serialization.string().optional()})});var Lar=S(IR=>{"use strict";var v7n=IR&&IR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),w7n=IR&&IR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S7n=IR&&IR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&v7n(r,e,n[o]);return w7n(r,e),r}}();Object.defineProperty(IR,"__esModule",{value:!0});IR.ParseInfo=void 0;var ZXe=S7n(ne());IR.ParseInfo=ZXe.serialization.object({separator:ZXe.serialization.string().optional(),delimiter:ZXe.serialization.string().optional()})});var Far=S(NR=>{"use strict";var C7n=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]}),x7n=NR&&NR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O7n=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"&&C7n(r,e,n[o]);return x7n(r,e),r}}();Object.defineProperty(NR,"__esModule",{value:!0});NR.RerankerDataMetrics=void 0;var Hv=O7n(ne());NR.RerankerDataMetrics=Hv.serialization.object({numTrainQueries:Hv.serialization.property("num_train_queries",Hv.serialization.number().optional()),numTrainRelevantPassages:Hv.serialization.property("num_train_relevant_passages",Hv.serialization.number().optional()),numTrainHardNegatives:Hv.serialization.property("num_train_hard_negatives",Hv.serialization.number().optional()),numEvalQueries:Hv.serialization.property("num_eval_queries",Hv.serialization.number().optional()),numEvalRelevantPassages:Hv.serialization.property("num_eval_relevant_passages",Hv.serialization.number().optional()),numEvalHardNegatives:Hv.serialization.property("num_eval_hard_negatives",Hv.serialization.number().optional())})});var kar=S(jR=>{"use strict";var T7n=jR&&jR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),E7n=jR&&jR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P7n=jR&&jR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&T7n(r,e,n[o]);return E7n(r,e),r}}();Object.defineProperty(jR,"__esModule",{value:!0});jR.ChatDataMetrics=void 0;var wW=P7n(ne());jR.ChatDataMetrics=wW.serialization.object({numTrainTurns:wW.serialization.property("num_train_turns",wW.serialization.number().optional()),numEvalTurns:wW.serialization.property("num_eval_turns",wW.serialization.number().optional()),preamble:wW.serialization.string().optional()})});var XXe=S(DR=>{"use strict";var M7n=DR&&DR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),R7n=DR&&DR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A7n=DR&&DR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&M7n(r,e,n[o]);return R7n(r,e),r}}();Object.defineProperty(DR,"__esModule",{value:!0});DR.LabelMetric=void 0;var SW=A7n(ne());DR.LabelMetric=SW.serialization.object({totalExamples:SW.serialization.property("total_examples",SW.serialization.number().optional()),label:SW.serialization.string().optional(),samples:SW.serialization.list(SW.serialization.string()).optional()})});var qar=S($R=>{"use strict";var I7n=$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]}),N7n=$R&&$R.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),j7n=$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"&&I7n(r,e,n[o]);return N7n(r,e),r}}();Object.defineProperty($R,"__esModule",{value:!0});$R.ClassifyDataMetrics=void 0;var YXe=j7n(ne()),D7n=XXe();$R.ClassifyDataMetrics=YXe.serialization.object({labelMetrics:YXe.serialization.property("label_metrics",YXe.serialization.list(D7n.LabelMetric).optional())})});var QXe=S(LR=>{"use strict";var $7n=LR&&LR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),L7n=LR&&LR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F7n=LR&&LR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&$7n(r,e,n[o]);return L7n(r,e),r}}();Object.defineProperty(LR,"__esModule",{value:!0});LR.FinetuneDatasetMetrics=void 0;var Vv=F7n(ne());LR.FinetuneDatasetMetrics=Vv.serialization.object({trainableTokenCount:Vv.serialization.property("trainable_token_count",Vv.serialization.number().optional()),totalExamples:Vv.serialization.property("total_examples",Vv.serialization.number().optional()),trainExamples:Vv.serialization.property("train_examples",Vv.serialization.number().optional()),trainSizeBytes:Vv.serialization.property("train_size_bytes",Vv.serialization.number().optional()),evalExamples:Vv.serialization.property("eval_examples",Vv.serialization.number().optional()),evalSizeBytes:Vv.serialization.property("eval_size_bytes",Vv.serialization.number().optional())})});var Uar=S(FR=>{"use strict";var k7n=FR&&FR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),q7n=FR&&FR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B7n=FR&&FR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&k7n(r,e,n[o]);return q7n(r,e),r}}();Object.defineProperty(FR,"__esModule",{value:!0});FR.Metrics=void 0;var Bar=B7n(ne()),U7n=QXe();FR.Metrics=Bar.serialization.object({finetuneDatasetMetrics:Bar.serialization.property("finetune_dataset_metrics",U7n.FinetuneDatasetMetrics.optional())})});var eYe=S(qR=>{"use strict";var z7n=qR&&qR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),H7n=qR&&qR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),V7n=qR&&qR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&z7n(r,e,n[o]);return H7n(r,e),r}}();Object.defineProperty(qR,"__esModule",{value:!0});qR.ConnectorOAuth=void 0;var kR=V7n(ne());qR.ConnectorOAuth=kR.serialization.object({clientId:kR.serialization.property("client_id",kR.serialization.string().optional()),clientSecret:kR.serialization.property("client_secret",kR.serialization.string().optional()),authorizeUrl:kR.serialization.property("authorize_url",kR.serialization.string()),tokenUrl:kR.serialization.property("token_url",kR.serialization.string()),scope:kR.serialization.string().optional()})});var tYe=S(BR=>{"use strict";var J7n=BR&&BR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),K7n=BR&&BR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W7n=BR&&BR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&J7n(r,e,n[o]);return K7n(r,e),r}}();Object.defineProperty(BR,"__esModule",{value:!0});BR.ConnectorAuthStatus=void 0;var G7n=W7n(ne());BR.ConnectorAuthStatus=G7n.serialization.enum_(["valid","expired"])});var CW=S(UR=>{"use strict";var Z7n=UR&&UR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),X7n=UR&&UR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Y7n=UR&&UR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Z7n(r,e,n[o]);return X7n(r,e),r}}();Object.defineProperty(UR,"__esModule",{value:!0});UR.Connector=void 0;var Pm=Y7n(ne()),Q7n=eYe(),eZn=tYe();UR.Connector=Pm.serialization.object({id:Pm.serialization.string(),organizationId:Pm.serialization.property("organization_id",Pm.serialization.string().optional()),name:Pm.serialization.string(),description:Pm.serialization.string().optional(),url:Pm.serialization.string().optional(),createdAt:Pm.serialization.property("created_at",Pm.serialization.date()),updatedAt:Pm.serialization.property("updated_at",Pm.serialization.date()),excludes:Pm.serialization.list(Pm.serialization.string()).optional(),authType:Pm.serialization.property("auth_type",Pm.serialization.string().optional()),oauth:Q7n.ConnectorOAuth.optional(),authStatus:Pm.serialization.property("auth_status",eZn.ConnectorAuthStatus.optional()),active:Pm.serialization.boolean().optional(),continueOnFailure:Pm.serialization.property("continue_on_failure",Pm.serialization.boolean().optional())})});var zar=S(zR=>{"use strict";var tZn=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]}),rZn=zR&&zR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nZn=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"&&tZn(r,e,n[o]);return rZn(r,e),r}}();Object.defineProperty(zR,"__esModule",{value:!0});zR.ListConnectorsResponse=void 0;var _0e=nZn(ne()),oZn=CW();zR.ListConnectorsResponse=_0e.serialization.object({connectors:_0e.serialization.list(oZn.Connector),totalCount:_0e.serialization.property("total_count",_0e.serialization.number().optional())})});var Har=S(HR=>{"use strict";var iZn=HR&&HR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aZn=HR&&HR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sZn=HR&&HR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&iZn(r,e,n[o]);return aZn(r,e),r}}();Object.defineProperty(HR,"__esModule",{value:!0});HR.CreateConnectorResponse=void 0;var uZn=sZn(ne()),lZn=CW();HR.CreateConnectorResponse=uZn.serialization.object({connector:lZn.Connector})});var Var=S(VR=>{"use strict";var cZn=VR&&VR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),dZn=VR&&VR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fZn=VR&&VR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&cZn(r,e,n[o]);return dZn(r,e),r}}();Object.defineProperty(VR,"__esModule",{value:!0});VR.GetConnectorResponse=void 0;var pZn=fZn(ne()),mZn=CW();VR.GetConnectorResponse=pZn.serialization.object({connector:mZn.Connector})});var Jar=S(JR=>{"use strict";var hZn=JR&&JR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gZn=JR&&JR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yZn=JR&&JR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&hZn(r,e,n[o]);return gZn(r,e),r}}();Object.defineProperty(JR,"__esModule",{value:!0});JR.DeleteConnectorResponse=void 0;var rYe=yZn(ne());JR.DeleteConnectorResponse=rYe.serialization.record(rYe.serialization.string(),rYe.serialization.unknown())});var Kar=S(KR=>{"use strict";var bZn=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]}),_Zn=KR&&KR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vZn=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"&&bZn(r,e,n[o]);return _Zn(r,e),r}}();Object.defineProperty(KR,"__esModule",{value:!0});KR.UpdateConnectorResponse=void 0;var wZn=vZn(ne()),SZn=CW();KR.UpdateConnectorResponse=wZn.serialization.object({connector:SZn.Connector})});var War=S(WR=>{"use strict";var CZn=WR&&WR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xZn=WR&&WR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OZn=WR&&WR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&CZn(r,e,n[o]);return xZn(r,e),r}}();Object.defineProperty(WR,"__esModule",{value:!0});WR.OAuthAuthorizeResponse=void 0;var nYe=OZn(ne());WR.OAuthAuthorizeResponse=nYe.serialization.object({redirectUrl:nYe.serialization.property("redirect_url",nYe.serialization.string().optional())})});var oYe=S(GR=>{"use strict";var TZn=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]}),EZn=GR&&GR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PZn=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"&&TZn(r,e,n[o]);return EZn(r,e),r}}();Object.defineProperty(GR,"__esModule",{value:!0});GR.CompatibleEndpoint=void 0;var MZn=PZn(ne());GR.CompatibleEndpoint=MZn.serialization.enum_(["chat","embed","classify","summarize","rerank","rate","generate"])});var iYe=S(ZR=>{"use strict";var RZn=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]}),AZn=ZR&&ZR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IZn=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"&&RZn(r,e,n[o]);return AZn(r,e),r}}();Object.defineProperty(ZR,"__esModule",{value:!0});ZR.GetModelResponse=void 0;var wy=IZn(ne()),Gar=oYe();ZR.GetModelResponse=wy.serialization.object({name:wy.serialization.string().optional(),isDeprecated:wy.serialization.property("is_deprecated",wy.serialization.boolean().optional()),endpoints:wy.serialization.list(Gar.CompatibleEndpoint).optional(),finetuned:wy.serialization.boolean().optional(),contextLength:wy.serialization.property("context_length",wy.serialization.number().optional()),tokenizerUrl:wy.serialization.property("tokenizer_url",wy.serialization.string().optional()),supportsVision:wy.serialization.property("supports_vision",wy.serialization.boolean().optional()),defaultEndpoints:wy.serialization.property("default_endpoints",wy.serialization.list(Gar.CompatibleEndpoint).optional()),features:wy.serialization.list(wy.serialization.string()).optional()})});var Zar=S(XR=>{"use strict";var NZn=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]}),jZn=XR&&XR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DZn=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"&&NZn(r,e,n[o]);return jZn(r,e),r}}();Object.defineProperty(XR,"__esModule",{value:!0});XR.ListModelsResponse=void 0;var v0e=DZn(ne()),$Zn=iYe();XR.ListModelsResponse=v0e.serialization.object({models:v0e.serialization.list($Zn.GetModelResponse),nextPageToken:v0e.serialization.property("next_page_token",v0e.serialization.string().optional())})});var Xar=S(fe=>{"use strict";var LZn=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]}),ge=fe&&fe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&LZn(e,t,r)};Object.defineProperty(fe,"__esModule",{value:!0});ge($Ze(),fe);ge(LZe(),fe);ge(FZe(),fe);ge(bar(),fe);ge(aXe(),fe);ge(sXe(),fe);ge(uXe(),fe);ge(tXe(),fe);ge(lXe(),fe);ge(cXe(),fe);ge(war(),fe);ge(gXe(),fe);ge(yXe(),fe);ge(Sar(),fe);ge(wXe(),fe);ge(xar(),fe);ge(EXe(),fe);ge(PXe(),fe);ge(MXe(),fe);ge(Ear(),fe);ge(AXe(),fe);ge(IXe(),fe);ge(NXe(),fe);ge(jXe(),fe);ge(Mar(),fe);ge($Xe(),fe);ge(LXe(),fe);ge(FXe(),fe);ge(Rar(),fe);ge(Aar(),fe);ge(Nar(),fe);ge(jar(),fe);ge(mW(),fe);ge(XZe(),fe);ge(Bne(),fe);ge(QZe(),fe);ge(Une(),fe);ge(m0e(),fe);ge(pW(),fe);ge(qXe(),fe);ge(g0e(),fe);ge(BXe(),fe);ge(UXe(),fe);ge(b0e(),fe);ge(KZe(),fe);ge(a0e(),fe);ge(Fne(),fe);ge(zZe(),fe);ge(o0e(),fe);ge(hW(),fe);ge(M7e(),fe);ge(R7e(),fe);ge(A7e(),fe);ge(__(),fe);ge(SC(),fe);ge(qZe(),fe);ge(UZe(),fe);ge(VZe(),fe);ge(JZe(),fe);ge(WZe(),fe);ge(GZe(),fe);ge(ZZe(),fe);ge(rXe(),fe);ge(nXe(),fe);ge(iXe(),fe);ge(qSe(),fe);ge(c2(),fe);ge(j7e(),fe);ge(D7e(),fe);ge($7e(),fe);ge(L7e(),fe);ge(k7e(),fe);ge(q7e(),fe);ge(Y9e(),fe);ge(xne(),fe);ge(BSe(),fe);ge(l7e(),fe);ge(c7e(),fe);ge(d7e(),fe);ge(f7e(),fe);ge(Tne(),fe);ge(B7e(),fe);ge(z7e(),fe);ge(H7e(),fe);ge(V7e(),fe);ge(K7e(),fe);ge(W7e(),fe);ge(Cne(),fe);ge(G7e(),fe);ge(Z7e(),fe);ge(Y7e(),fe);ge(eZe(),fe);ge(tZe(),fe);ge(HSe(),fe);ge(rZe(),fe);ge(VSe(),fe);ge(nZe(),fe);ge(JSe(),fe);ge(oZe(),fe);ge(iZe(),fe);ge(KSe(),fe);ge(aZe(),fe);ge(WSe(),fe);ge(FSe(),fe);ge(O7e(),fe);ge(T7e(),fe);ge(y7e(),fe);ge(b7e(),fe);ge(kSe(),fe);ge(LSe(),fe);ge(Bv(),fe);ge(I9e(),fe);ge(N9e(),fe);ge(j9e(),fe);ge(D9e(),fe);ge(L9e(),fe);ge(F9e(),fe);ge(k9e(),fe);ge(q9e(),fe);ge(U9e(),fe);ge(z9e(),fe);ge(H9e(),fe);ge(V9e(),fe);ge(J9e(),fe);ge(W9e(),fe);ge(G9e(),fe);ge(Z9e(),fe);ge(e7e(),fe);ge(t7e(),fe);ge(r7e(),fe);ge(n7e(),fe);ge(o7e(),fe);ge(i7e(),fe);ge(a7e(),fe);ge(s7e(),fe);ge(u7e(),fe);ge(p7e(),fe);ge(m7e(),fe);ge(h7e(),fe);ge(g7e(),fe);ge(v7e(),fe);ge(w7e(),fe);ge(_Xe(),fe);ge(vXe(),fe);ge(Hne(),fe);ge(dXe(),fe);ge(fXe(),fe);ge(pXe(),fe);ge(mXe(),fe);ge(hXe(),fe);ge(Ane(),fe);ge(Ine(),fe);ge(f0e(),fe);ge(SXe(),fe);ge(CXe(),fe);ge(xXe(),fe);ge(uZe(),fe);ge(lZe(),fe);ge(cZe(),fe);ge(dZe(),fe);ge(fZe(),fe);ge(zXe(),fe);ge(HXe(),fe);ge(VXe(),fe);ge(Dar(),fe);ge($ar(),fe);ge(TXe(),fe);ge(GXe(),fe);ge(bZe(),fe);ge(yZe(),fe);ge(_Ze(),fe);ge(Lar(),fe);ge(Far(),fe);ge(kar(),fe);ge(XXe(),fe);ge(qar(),fe);ge(QXe(),fe);ge(Uar(),fe);ge(ZSe(),fe);ge(eYe(),fe);ge(tYe(),fe);ge(CW(),fe);ge(zar(),fe);ge(t0e(),fe);ge(jZe(),fe);ge(r0e(),fe);ge(Har(),fe);ge(Var(),fe);ge(Jar(),fe);ge(Kar(),fe);ge(War(),fe);ge(oYe(),fe);ge(iYe(),fe);ge(Zar(),fe)});var Yar=S(YR=>{"use strict";var FZn=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]}),kZn=YR&&YR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qZn=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"&&FZn(r,e,n[o]);return kZn(r,e),r}}();Object.defineProperty(YR,"__esModule",{value:!0});YR.ChatStreamRequest=void 0;var mi=qZn(ne()),BZn=Une(),UZn=$Ze(),zZn=m0e(),HZn=pW(),VZn=LZe(),JZn=g0e(),KZn=Bne(),WZn=b0e(),GZn=FZe();YR.ChatStreamRequest=mi.serialization.object({message:mi.serialization.string(),model:mi.serialization.string().optional(),preamble:mi.serialization.string().optional(),chatHistory:mi.serialization.property("chat_history",mi.serialization.list(BZn.Message).optional()),conversationId:mi.serialization.property("conversation_id",mi.serialization.string().optional()),promptTruncation:mi.serialization.property("prompt_truncation",UZn.ChatStreamRequestPromptTruncation.optional()),connectors:mi.serialization.list(zZn.ChatConnector).optional(),searchQueriesOnly:mi.serialization.property("search_queries_only",mi.serialization.boolean().optional()),documents:mi.serialization.list(HZn.ChatDocument).optional(),citationQuality:mi.serialization.property("citation_quality",VZn.ChatStreamRequestCitationQuality.optional()),temperature:mi.serialization.number().optional(),maxTokens:mi.serialization.property("max_tokens",mi.serialization.number().optional()),maxInputTokens:mi.serialization.property("max_input_tokens",mi.serialization.number().optional()),k:mi.serialization.number().optional(),p:mi.serialization.number().optional(),seed:mi.serialization.number().optional(),stopSequences:mi.serialization.property("stop_sequences",mi.serialization.list(mi.serialization.string()).optional()),frequencyPenalty:mi.serialization.property("frequency_penalty",mi.serialization.number().optional()),presencePenalty:mi.serialization.property("presence_penalty",mi.serialization.number().optional()),rawPrompting:mi.serialization.property("raw_prompting",mi.serialization.boolean().optional()),tools:mi.serialization.list(JZn.Tool).optional(),toolResults:mi.serialization.property("tool_results",mi.serialization.list(KZn.ToolResult).optional()),forceSingleStep:mi.serialization.property("force_single_step",mi.serialization.boolean().optional()),responseFormat:mi.serialization.property("response_format",WZn.ResponseFormat.optional()),safetyMode:mi.serialization.property("safety_mode",GZn.ChatStreamRequestSafetyMode.optional())})});var Qar=S(QR=>{"use strict";var ZZn=QR&&QR.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XZn=QR&&QR.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YZn=QR&&QR.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ZZn(r,e,n[o]);return XZn(r,e),r}}();Object.defineProperty(QR,"__esModule",{value:!0});QR.ChatRequest=void 0;var hi=YZn(ne()),QZn=Une(),eXn=aXe(),tXn=m0e(),rXn=pW(),nXn=sXe(),oXn=g0e(),iXn=Bne(),aXn=b0e(),sXn=uXe();QR.ChatRequest=hi.serialization.object({message:hi.serialization.string(),model:hi.serialization.string().optional(),preamble:hi.serialization.string().optional(),chatHistory:hi.serialization.property("chat_history",hi.serialization.list(QZn.Message).optional()),conversationId:hi.serialization.property("conversation_id",hi.serialization.string().optional()),promptTruncation:hi.serialization.property("prompt_truncation",eXn.ChatRequestPromptTruncation.optional()),connectors:hi.serialization.list(tXn.ChatConnector).optional(),searchQueriesOnly:hi.serialization.property("search_queries_only",hi.serialization.boolean().optional()),documents:hi.serialization.list(rXn.ChatDocument).optional(),citationQuality:hi.serialization.property("citation_quality",nXn.ChatRequestCitationQuality.optional()),temperature:hi.serialization.number().optional(),maxTokens:hi.serialization.property("max_tokens",hi.serialization.number().optional()),maxInputTokens:hi.serialization.property("max_input_tokens",hi.serialization.number().optional()),k:hi.serialization.number().optional(),p:hi.serialization.number().optional(),seed:hi.serialization.number().optional(),stopSequences:hi.serialization.property("stop_sequences",hi.serialization.list(hi.serialization.string()).optional()),frequencyPenalty:hi.serialization.property("frequency_penalty",hi.serialization.number().optional()),presencePenalty:hi.serialization.property("presence_penalty",hi.serialization.number().optional()),rawPrompting:hi.serialization.property("raw_prompting",hi.serialization.boolean().optional()),tools:hi.serialization.list(oXn.Tool).optional(),toolResults:hi.serialization.property("tool_results",hi.serialization.list(iXn.ToolResult).optional()),forceSingleStep:hi.serialization.property("force_single_step",hi.serialization.boolean().optional()),responseFormat:hi.serialization.property("response_format",aXn.ResponseFormat.optional()),safetyMode:hi.serialization.property("safety_mode",sXn.ChatRequestSafetyMode.optional())})});var esr=S(eA=>{"use strict";var uXn=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]}),lXn=eA&&eA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cXn=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"&&uXn(r,e,n[o]);return lXn(r,e),r}}();Object.defineProperty(eA,"__esModule",{value:!0});eA.GenerateStreamRequest=void 0;var dl=cXn(ne()),dXn=lXe(),fXn=cXe();eA.GenerateStreamRequest=dl.serialization.object({prompt:dl.serialization.string(),model:dl.serialization.string().optional(),numGenerations:dl.serialization.property("num_generations",dl.serialization.number().optional()),maxTokens:dl.serialization.property("max_tokens",dl.serialization.number().optional()),truncate:dXn.GenerateStreamRequestTruncate.optional(),temperature:dl.serialization.number().optional(),seed:dl.serialization.number().optional(),preset:dl.serialization.string().optional(),endSequences:dl.serialization.property("end_sequences",dl.serialization.list(dl.serialization.string()).optional()),stopSequences:dl.serialization.property("stop_sequences",dl.serialization.list(dl.serialization.string()).optional()),k:dl.serialization.number().optional(),p:dl.serialization.number().optional(),frequencyPenalty:dl.serialization.property("frequency_penalty",dl.serialization.number().optional()),presencePenalty:dl.serialization.property("presence_penalty",dl.serialization.number().optional()),returnLikelihoods:dl.serialization.property("return_likelihoods",fXn.GenerateStreamRequestReturnLikelihoods.optional()),rawPrompting:dl.serialization.property("raw_prompting",dl.serialization.boolean().optional())})});var tsr=S(tA=>{"use strict";var pXn=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]}),mXn=tA&&tA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hXn=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"&&pXn(r,e,n[o]);return mXn(r,e),r}}();Object.defineProperty(tA,"__esModule",{value:!0});tA.GenerateRequest=void 0;var fl=hXn(ne()),gXn=gXe(),yXn=yXe();tA.GenerateRequest=fl.serialization.object({prompt:fl.serialization.string(),model:fl.serialization.string().optional(),numGenerations:fl.serialization.property("num_generations",fl.serialization.number().optional()),maxTokens:fl.serialization.property("max_tokens",fl.serialization.number().optional()),truncate:gXn.GenerateRequestTruncate.optional(),temperature:fl.serialization.number().optional(),seed:fl.serialization.number().optional(),preset:fl.serialization.string().optional(),endSequences:fl.serialization.property("end_sequences",fl.serialization.list(fl.serialization.string()).optional()),stopSequences:fl.serialization.property("stop_sequences",fl.serialization.list(fl.serialization.string()).optional()),k:fl.serialization.number().optional(),p:fl.serialization.number().optional(),frequencyPenalty:fl.serialization.property("frequency_penalty",fl.serialization.number().optional()),presencePenalty:fl.serialization.property("presence_penalty",fl.serialization.number().optional()),returnLikelihoods:fl.serialization.property("return_likelihoods",yXn.GenerateRequestReturnLikelihoods.optional()),rawPrompting:fl.serialization.property("raw_prompting",fl.serialization.boolean().optional())})});var rsr=S(rA=>{"use strict";var bXn=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]}),_Xn=rA&&rA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vXn=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"&&bXn(r,e,n[o]);return _Xn(r,e),r}}();Object.defineProperty(rA,"__esModule",{value:!0});rA.EmbedRequest=void 0;var E1=vXn(ne()),wXn=Ane(),SXn=Ine(),CXn=wXe();rA.EmbedRequest=E1.serialization.object({texts:E1.serialization.list(E1.serialization.string()).optional(),images:E1.serialization.list(E1.serialization.string()).optional(),model:E1.serialization.string().optional(),inputType:E1.serialization.property("input_type",wXn.EmbedInputType.optional()),embeddingTypes:E1.serialization.property("embedding_types",E1.serialization.list(SXn.EmbeddingType).optional()),truncate:CXn.EmbedRequestTruncate.optional()})});var nsr=S(nA=>{"use strict";var xXn=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]}),OXn=nA&&nA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TXn=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"&&xXn(r,e,n[o]);return OXn(r,e),r}}();Object.defineProperty(nA,"__esModule",{value:!0});nA.RerankRequest=void 0;var Jv=TXn(ne()),EXn=EXe();nA.RerankRequest=Jv.serialization.object({model:Jv.serialization.string().optional(),query:Jv.serialization.string(),documents:Jv.serialization.list(EXn.RerankRequestDocumentsItem),topN:Jv.serialization.property("top_n",Jv.serialization.number().optional()),rankFields:Jv.serialization.property("rank_fields",Jv.serialization.list(Jv.serialization.string()).optional()),returnDocuments:Jv.serialization.property("return_documents",Jv.serialization.boolean().optional()),maxChunksPerDoc:Jv.serialization.property("max_chunks_per_doc",Jv.serialization.number().optional())})});var osr=S(oA=>{"use strict";var PXn=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]}),MXn=oA&&oA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RXn=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"&&PXn(r,e,n[o]);return MXn(r,e),r}}();Object.defineProperty(oA,"__esModule",{value:!0});oA.ClassifyRequest=void 0;var xW=RXn(ne()),AXn=GXe(),IXn=AXe();oA.ClassifyRequest=xW.serialization.object({inputs:xW.serialization.list(xW.serialization.string()),examples:xW.serialization.list(AXn.ClassifyExample).optional(),model:xW.serialization.string().optional(),preset:xW.serialization.string().optional(),truncate:IXn.ClassifyRequestTruncate.optional()})});var isr=S(iA=>{"use strict";var NXn=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]}),jXn=iA&&iA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DXn=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"&&NXn(r,e,n[o]);return jXn(r,e),r}}();Object.defineProperty(iA,"__esModule",{value:!0});iA.SummarizeRequest=void 0;var OW=DXn(ne()),$Xn=$Xe(),LXn=LXe(),FXn=FXe();iA.SummarizeRequest=OW.serialization.object({text:OW.serialization.string(),length:$Xn.SummarizeRequestLength.optional(),format:LXn.SummarizeRequestFormat.optional(),model:OW.serialization.string().optional(),extractiveness:FXn.SummarizeRequestExtractiveness.optional(),temperature:OW.serialization.number().optional(),additionalCommand:OW.serialization.property("additional_command",OW.serialization.string().optional())})});var asr=S(aA=>{"use strict";var kXn=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]}),qXn=aA&&aA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BXn=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"&&kXn(r,e,n[o]);return qXn(r,e),r}}();Object.defineProperty(aA,"__esModule",{value:!0});aA.TokenizeRequest=void 0;var aYe=BXn(ne());aA.TokenizeRequest=aYe.serialization.object({text:aYe.serialization.string(),model:aYe.serialization.string()})});var ssr=S(sA=>{"use strict";var UXn=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]}),zXn=sA&&sA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HXn=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"&&UXn(r,e,n[o]);return zXn(r,e),r}}();Object.defineProperty(sA,"__esModule",{value:!0});sA.DetokenizeRequest=void 0;var w0e=HXn(ne());sA.DetokenizeRequest=w0e.serialization.object({tokens:w0e.serialization.list(w0e.serialization.number()),model:w0e.serialization.string()})});var usr=S(Ac=>{"use strict";Object.defineProperty(Ac,"__esModule",{value:!0});Ac.DetokenizeRequest=Ac.TokenizeRequest=Ac.SummarizeRequest=Ac.ClassifyRequest=Ac.RerankRequest=Ac.EmbedRequest=Ac.GenerateRequest=Ac.GenerateStreamRequest=Ac.ChatRequest=Ac.ChatStreamRequest=void 0;var VXn=Yar();Object.defineProperty(Ac,"ChatStreamRequest",{enumerable:!0,get:function(){return VXn.ChatStreamRequest}});var JXn=Qar();Object.defineProperty(Ac,"ChatRequest",{enumerable:!0,get:function(){return JXn.ChatRequest}});var KXn=esr();Object.defineProperty(Ac,"GenerateStreamRequest",{enumerable:!0,get:function(){return KXn.GenerateStreamRequest}});var WXn=tsr();Object.defineProperty(Ac,"GenerateRequest",{enumerable:!0,get:function(){return WXn.GenerateRequest}});var GXn=rsr();Object.defineProperty(Ac,"EmbedRequest",{enumerable:!0,get:function(){return GXn.EmbedRequest}});var ZXn=nsr();Object.defineProperty(Ac,"RerankRequest",{enumerable:!0,get:function(){return ZXn.RerankRequest}});var XXn=osr();Object.defineProperty(Ac,"ClassifyRequest",{enumerable:!0,get:function(){return XXn.ClassifyRequest}});var YXn=isr();Object.defineProperty(Ac,"SummarizeRequest",{enumerable:!0,get:function(){return YXn.SummarizeRequest}});var QXn=asr();Object.defineProperty(Ac,"TokenizeRequest",{enumerable:!0,get:function(){return QXn.TokenizeRequest}});var eYn=ssr();Object.defineProperty(Ac,"DetokenizeRequest",{enumerable:!0,get:function(){return eYn.DetokenizeRequest}})});var lsr=S(S2=>{"use strict";var tYn=S2&&S2.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=S2&&S2.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tYn(e,t,r)};Object.defineProperty(S2,"__esModule",{value:!0});rYn(usr(),S2)});var M1=S(P1=>{"use strict";var nYn=P1&&P1.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),sYe=P1&&P1.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nYn(e,t,r)};Object.defineProperty(P1,"__esModule",{value:!0});sYe(far(),P1);sYe(Xar(),P1);sYe(lsr(),P1)});var uYe=S(eu=>{"use strict";var oYn=eu&&eu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iYn=eu&&eu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aYn=eu&&eu.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oYn(r,e,n[o]);return iYn(r,e),r}}(),S0e=eu&&eu.__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())})},sYn=eu&&eu.__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(eu,"__esModule",{value:!0});eu.fetchOverride=eu.parseAWSEvent=eu.getAuthHeaders=eu.getUrl=eu.mapResponseFromBedrock=void 0;var uYn=C3e(),lYn=(LZt(),Nfe($Zt)),cYn=lWe(),dYn=bXt(),fYn=zre(),pYn=ne(),mYn=RGe(),hYn=Hor(),TS=aYn(M1()),gYn=(t,e)=>S0e(void 0,void 0,void 0,function*(){let r=Object.assign({},process.env);try{return t(),yield e()}finally{process.env=r}}),yYn={1:{chat:TS.StreamedChatResponse,generate:TS.GenerateStreamedResponse},2:{chat:TS.V2ChatStreamResponse,generate:TS.GenerateStreamedResponse}},bYn={1:{chat:TS.NonStreamedChatResponse,embed:TS.EmbedResponse,generate:TS.Generation,rerank:TS.RerankResponse},2:{chat:TS.V2ChatResponse,embed:TS.EmbedByTypeResponse,generate:TS.Generation,rerank:TS.V2RerankResponse}},_Yn=(t,e,r,n)=>S0e(void 0,void 0,void 0,function*(){let o=t?yYn[r][e]:bYn[r][e],i={unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0,skipValidation:!0,breadcrumbsPrefix:["response"]},a=yield o.parseOrThrow(n,i);return o.jsonOrThrow(a,i)});eu.mapResponseFromBedrock=_Yn;var vYn=(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]};eu.getUrl=vYn;var wYn=(t,e,r,n,o,i)=>S0e(void 0,void 0,void 0,function*(){let a=(0,lYn.fromNodeProviderChain)(),s=yield gYn(()=>{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 dYn.SignatureV4({service:o,region:i.awsRegion,credentials:s,sha256:uYn.Sha256});delete r.connection,r.host=t.hostname;let l=new cYn.HttpRequest({method:e.toUpperCase(),protocol:t.protocol,path:t.pathname,headers:r,body:n});return(yield u.sign(l)).headers});eu.getAuthHeaders=wYn;var SYn=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}}};eu.parseAWSEvent=SYn;var CYn=t=>({v1:1,v2:2})[t]||1,xYn=(t,{awsRegion:e,awsAccessKey:r,awsSecretKey:n,awsSessionToken:o})=>i=>S0e(void 0,void 0,void 0,function*(){var a,s,u,l;let c=i.url.split("/"),d=c.pop(),f=CYn(c.pop()),p=i.body;console.assert(p.model,"model is required");let m=!!p.stream,h=(0,eu.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 g=yield(0,eu.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=g;let y=yield(0,pYn.fetcher)(i);if(!y.ok)return y;try{if(m){let x=(0,mYn.readableStreamAsyncIterable)(y.body),O=new hYn.LineDecoder,E=new fYn.PassThrough;try{for(var b=!0,_=sYn(x),w;w=yield _.next(),a=w.done,!a;b=!0){l=w.value,b=!1;let T=l;for(let R of O.decode(T)){let N=(0,eu.parseAWSEvent)(R);if(N){let D=yield(0,eu.mapResponseFromBedrock)(m,d,f,N);E.push(JSON.stringify(D)+`
|
||
`)}}}}catch(T){s={error:T}}finally{try{!b&&!a&&(u=_.return)&&(yield u.call(_))}finally{if(s)throw s.error}}for(let T of O.flush()){let R=(0,eu.parseAWSEvent)(T);if(R){let N=yield(0,eu.mapResponseFromBedrock)(m,d,f,R);E.push(JSON.stringify(N)+`
|
||
`)}}return E.end(),{ok:!0,body:E,rawResponse:y.rawResponse}}else{let x=yield y.body;return{ok:!0,body:yield(0,eu.mapResponseFromBedrock)(m,d,f,x),rawResponse:y.rawResponse}}}catch(x){throw x}});eu.fetchOverride=xYn});var R1=S(C0e=>{"use strict";Object.defineProperty(C0e,"__esModule",{value:!0});C0e.CohereEnvironment=void 0;C0e.CohereEnvironment={Production:"https://api.cohere.com"}});var XF=S((csr,x0e)=>{(function(t,e,r){typeof x0e<"u"&&x0e.exports?x0e.exports=r():typeof define=="function"&&define.amd?define(r):e[t]=r()})("urljoin",csr,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 cYe=S(w_=>{"use strict";var OYn=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]}),TYn=w_&&w_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wne=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"&&OYn(r,e,n[o]);return TYn(r,e),r}}(),TW=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())})},EYn=w_&&w_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(w_,"__esModule",{value:!0});w_.V2=void 0;var O0e=Wne(R1()),Gi=Wne(ne()),Dn=Wne(QN()),YF=Wne(M1()),T0e=EYn(XF()),dg=Wne(Pc()),lYe=class{constructor(e={}){this._options=e}chatStream(e,r){return Gi.HttpResponsePromise.fromPromise(this.__chatStream(e,r))}__chatStream(e,r){return TW(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Gi.fetcher)({url:(0,T0e.default)((i=(o=yield Gi.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Gi.Supplier.get(this._options.environment))!==null&&i!==void 0?i:O0e.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gi.Supplier.get(this._options.clientName))!=null?yield Gi.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":Gi.RUNTIME.type,"X-Fern-Runtime-Version":Gi.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},YF.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 Gi.Stream({stream:a.body,parse:s=>TW(this,void 0,void 0,function*(){return YF.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 Dn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Dn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Dn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Dn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Dn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Dn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Dn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Dn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Dn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Dn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Dn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Dn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new dg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new dg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new dg.CohereTimeoutError("Timeout exceeded when calling POST /v2/chat.");case"unknown":throw new dg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}chat(e,r){return Gi.HttpResponsePromise.fromPromise(this.__chat(e,r))}__chat(e,r){return TW(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Gi.fetcher)({url:(0,T0e.default)((i=(o=yield Gi.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Gi.Supplier.get(this._options.environment))!==null&&i!==void 0?i:O0e.CohereEnvironment.Production,"v2/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gi.Supplier.get(this._options.clientName))!=null?yield Gi.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":Gi.RUNTIME.type,"X-Fern-Runtime-Version":Gi.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},YF.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:YF.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 Dn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Dn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Dn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Dn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Dn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Dn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Dn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Dn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Dn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Dn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Dn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Dn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new dg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new dg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new dg.CohereTimeoutError("Timeout exceeded when calling POST /v2/chat.");case"unknown":throw new dg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}embed(e,r){return Gi.HttpResponsePromise.fromPromise(this.__embed(e,r))}__embed(e,r){return TW(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Gi.fetcher)({url:(0,T0e.default)((i=(o=yield Gi.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Gi.Supplier.get(this._options.environment))!==null&&i!==void 0?i:O0e.CohereEnvironment.Production,"v2/embed"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gi.Supplier.get(this._options.clientName))!=null?yield Gi.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":Gi.RUNTIME.type,"X-Fern-Runtime-Version":Gi.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:YF.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:YF.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 Dn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Dn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Dn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Dn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Dn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Dn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Dn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Dn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Dn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Dn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Dn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Dn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new dg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new dg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new dg.CohereTimeoutError("Timeout exceeded when calling POST /v2/embed.");case"unknown":throw new dg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}rerank(e,r){return Gi.HttpResponsePromise.fromPromise(this.__rerank(e,r))}__rerank(e,r){return TW(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Gi.fetcher)({url:(0,T0e.default)((i=(o=yield Gi.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Gi.Supplier.get(this._options.environment))!==null&&i!==void 0?i:O0e.CohereEnvironment.Production,"v2/rerank"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Gi.Supplier.get(this._options.clientName))!=null?yield Gi.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":Gi.RUNTIME.type,"X-Fern-Runtime-Version":Gi.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:YF.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:YF.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 Dn.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Dn.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Dn.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Dn.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Dn.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Dn.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Dn.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Dn.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Dn.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Dn.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Dn.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Dn.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new dg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new dg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new dg.CohereTimeoutError("Timeout exceeded when calling POST /v2/rerank.");case"unknown":throw new dg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return TW(this,void 0,void 0,function*(){var e;let r=(e=yield Gi.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new dg.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_.V2=lYe});var dsr=S(S_=>{"use strict";var PYn=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]}),MYn=S_&&S_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zne=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"&&PYn(r,e,n[o]);return MYn(r,e),r}}(),Gne=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())})},RYn=S_&&S_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(S_,"__esModule",{value:!0});S_.EmbedJobs=void 0;var E0e=Zne(R1()),Xa=Zne(ne()),$n=Zne(QN()),P0e=RYn(XF()),M0e=Zne(M1()),fg=Zne(Pc()),dYe=class{constructor(e={}){this._options=e}list(e){return Xa.HttpResponsePromise.fromPromise(this.__list(e))}__list(e){return Gne(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Xa.fetcher)({url:(0,P0e.default)((o=(n=yield Xa.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield Xa.Supplier.get(this._options.environment))!==null&&o!==void 0?o:E0e.CohereEnvironment.Production,"v1/embed-jobs"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xa.Supplier.get(this._options.clientName))!=null?yield Xa.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":Xa.RUNTIME.type,"X-Fern-Runtime-Version":Xa.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:M0e.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 $n.BadRequestError(i.error.body,i.rawResponse);case 401:throw new $n.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new $n.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new $n.NotFoundError(i.error.body,i.rawResponse);case 422:throw new $n.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new $n.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new $n.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new $n.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new $n.InternalServerError(i.error.body,i.rawResponse);case 501:throw new $n.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new $n.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new $n.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new fg.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new fg.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new fg.CohereTimeoutError("Timeout exceeded when calling GET /v1/embed-jobs.");case"unknown":throw new fg.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}create(e,r){return Xa.HttpResponsePromise.fromPromise(this.__create(e,r))}__create(e,r){return Gne(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xa.fetcher)({url:(0,P0e.default)((i=(o=yield Xa.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Xa.Supplier.get(this._options.environment))!==null&&i!==void 0?i:E0e.CohereEnvironment.Production,"v1/embed-jobs"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xa.Supplier.get(this._options.clientName))!=null?yield Xa.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":Xa.RUNTIME.type,"X-Fern-Runtime-Version":Xa.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:M0e.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:M0e.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 $n.BadRequestError(a.error.body,a.rawResponse);case 401:throw new $n.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new $n.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new $n.NotFoundError(a.error.body,a.rawResponse);case 422:throw new $n.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new $n.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new $n.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new $n.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new $n.InternalServerError(a.error.body,a.rawResponse);case 501:throw new $n.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new $n.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new $n.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new fg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new fg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new fg.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed-jobs.");case"unknown":throw new fg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}get(e,r){return Xa.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return Gne(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xa.fetcher)({url:(0,P0e.default)((i=(o=yield Xa.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Xa.Supplier.get(this._options.environment))!==null&&i!==void 0?i:E0e.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xa.Supplier.get(this._options.clientName))!=null?yield Xa.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":Xa.RUNTIME.type,"X-Fern-Runtime-Version":Xa.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:M0e.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 $n.BadRequestError(a.error.body,a.rawResponse);case 401:throw new $n.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new $n.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new $n.NotFoundError(a.error.body,a.rawResponse);case 422:throw new $n.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new $n.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new $n.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new $n.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new $n.InternalServerError(a.error.body,a.rawResponse);case 501:throw new $n.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new $n.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new $n.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new fg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new fg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new fg.CohereTimeoutError("Timeout exceeded when calling GET /v1/embed-jobs/{id}.");case"unknown":throw new fg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}cancel(e,r){return Xa.HttpResponsePromise.fromPromise(this.__cancel(e,r))}__cancel(e,r){return Gne(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Xa.fetcher)({url:(0,P0e.default)((i=(o=yield Xa.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Xa.Supplier.get(this._options.environment))!==null&&i!==void 0?i:E0e.CohereEnvironment.Production,`v1/embed-jobs/${encodeURIComponent(e)}/cancel`),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Xa.Supplier.get(this._options.clientName))!=null?yield Xa.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":Xa.RUNTIME.type,"X-Fern-Runtime-Version":Xa.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 $n.BadRequestError(a.error.body,a.rawResponse);case 401:throw new $n.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new $n.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new $n.NotFoundError(a.error.body,a.rawResponse);case 422:throw new $n.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new $n.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new $n.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new $n.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new $n.InternalServerError(a.error.body,a.rawResponse);case 501:throw new $n.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new $n.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new $n.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new fg.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new fg.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new fg.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed-jobs/{id}/cancel.");case"unknown":throw new fg.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return Gne(this,void 0,void 0,function*(){var e;let r=(e=yield Xa.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new fg.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};S_.EmbedJobs=dYe});var fsr=S(C_=>{"use strict";var AYn=C_&&C_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),IYn=C_&&C_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qne=C_&&C_.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 IYn(r,e),r}}(),EW=C_&&C_.__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())})},NYn=C_&&C_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(C_,"__esModule",{value:!0});C_.Datasets=void 0;var Xne=Qne(R1()),Fo=Qne(ne()),Ir=Qne(QN()),C2=Qne(M1()),Yne=NYn(XF()),td=Qne(Pc()),fYe=class{constructor(e={}){this._options=e}list(e={},r){return Fo.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return EW(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=C2.DatasetValidationStatus.jsonOrThrow(d,{unrecognizedObjectKeys:"passthrough",allowUnrecognizedUnionMembers:!0,allowUnrecognizedEnumValues:!0}));let p=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Fo.fetcher)({url:(0,Yne.default)((i=(o=yield Fo.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Fo.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Xne.CohereEnvironment.Production,"v1/datasets"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Fo.Supplier.get(this._options.clientName))!=null?yield Fo.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":Fo.RUNTIME.type,"X-Fern-Runtime-Version":Fo.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:C2.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 Ir.BadRequestError(p.error.body,p.rawResponse);case 401:throw new Ir.UnauthorizedError(p.error.body,p.rawResponse);case 403:throw new Ir.ForbiddenError(p.error.body,p.rawResponse);case 404:throw new Ir.NotFoundError(p.error.body,p.rawResponse);case 422:throw new Ir.UnprocessableEntityError(p.error.body,p.rawResponse);case 429:throw new Ir.TooManyRequestsError(p.error.body,p.rawResponse);case 498:throw new Ir.InvalidTokenError(p.error.body,p.rawResponse);case 499:throw new Ir.ClientClosedRequestError(p.error.body,p.rawResponse);case 500:throw new Ir.InternalServerError(p.error.body,p.rawResponse);case 501:throw new Ir.NotImplementedError(p.error.body,p.rawResponse);case 503:throw new Ir.ServiceUnavailableError(p.error.body,p.rawResponse);case 504:throw new Ir.GatewayTimeoutError(p.error.body,p.rawResponse);default:throw new td.CohereError({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new td.CohereError({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new td.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets.");case"unknown":throw new td.CohereError({message:p.error.errorMessage,rawResponse:p.rawResponse})}})}create(e,r,n,o){return Fo.HttpResponsePromise.fromPromise(this.__create(e,r,n,o))}__create(e,r,n,o){return EW(this,void 0,void 0,function*(){var i,a,s;let u={};u.name=n.name,u.type=C2.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 Fo.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:Fo.fetcher)({url:(0,Yne.default)((s=(a=yield Fo.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Fo.Supplier.get(this._options.environment))!==null&&s!==void 0?s:Xne.CohereEnvironment.Production,"v1/datasets"),method:"POST",headers:Object.assign(Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Fo.Supplier.get(this._options.clientName))!=null?yield Fo.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":Fo.RUNTIME.type,"X-Fern-Runtime-Version":Fo.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:C2.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 Ir.BadRequestError(d.error.body,d.rawResponse);case 401:throw new Ir.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new Ir.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new Ir.NotFoundError(d.error.body,d.rawResponse);case 422:throw new Ir.UnprocessableEntityError(d.error.body,d.rawResponse);case 429:throw new Ir.TooManyRequestsError(d.error.body,d.rawResponse);case 498:throw new Ir.InvalidTokenError(d.error.body,d.rawResponse);case 499:throw new Ir.ClientClosedRequestError(d.error.body,d.rawResponse);case 500:throw new Ir.InternalServerError(d.error.body,d.rawResponse);case 501:throw new Ir.NotImplementedError(d.error.body,d.rawResponse);case 503:throw new Ir.ServiceUnavailableError(d.error.body,d.rawResponse);case 504:throw new Ir.GatewayTimeoutError(d.error.body,d.rawResponse);default:throw new td.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new td.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new td.CohereTimeoutError("Timeout exceeded when calling POST /v1/datasets.");case"unknown":throw new td.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}getUsage(e){return Fo.HttpResponsePromise.fromPromise(this.__getUsage(e))}__getUsage(e){return EW(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:Fo.fetcher)({url:(0,Yne.default)((o=(n=yield Fo.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield Fo.Supplier.get(this._options.environment))!==null&&o!==void 0?o:Xne.CohereEnvironment.Production,"v1/datasets/usage"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Fo.Supplier.get(this._options.clientName))!=null?yield Fo.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":Fo.RUNTIME.type,"X-Fern-Runtime-Version":Fo.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:C2.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 Ir.BadRequestError(i.error.body,i.rawResponse);case 401:throw new Ir.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new Ir.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new Ir.NotFoundError(i.error.body,i.rawResponse);case 422:throw new Ir.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new Ir.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new Ir.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new Ir.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new Ir.InternalServerError(i.error.body,i.rawResponse);case 501:throw new Ir.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new Ir.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new Ir.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new td.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new td.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new td.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets/usage.");case"unknown":throw new td.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}get(e,r){return Fo.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return EW(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Fo.fetcher)({url:(0,Yne.default)((i=(o=yield Fo.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Fo.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Xne.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Fo.Supplier.get(this._options.clientName))!=null?yield Fo.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":Fo.RUNTIME.type,"X-Fern-Runtime-Version":Fo.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:C2.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 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 td.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new td.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new td.CohereTimeoutError("Timeout exceeded when calling GET /v1/datasets/{id}.");case"unknown":throw new td.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}delete(e,r){return Fo.HttpResponsePromise.fromPromise(this.__delete(e,r))}__delete(e,r){return EW(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Fo.fetcher)({url:(0,Yne.default)((i=(o=yield Fo.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Fo.Supplier.get(this._options.environment))!==null&&i!==void 0?i:Xne.CohereEnvironment.Production,`v1/datasets/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Fo.Supplier.get(this._options.clientName))!=null?yield Fo.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":Fo.RUNTIME.type,"X-Fern-Runtime-Version":Fo.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:C2.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 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 td.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new td.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new td.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/datasets/{id}.");case"unknown":throw new td.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}_getAuthorizationHeader(){return EW(this,void 0,void 0,function*(){var e;let r=(e=yield Fo.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new td.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}`})}};C_.Datasets=fYe});var psr=S(x_=>{"use strict";var jYn=x_&&x_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),DYn=x_&&x_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eoe=x_&&x_.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jYn(r,e,n[o]);return DYn(r,e),r}}(),x2=x_&&x_.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},$Yn=x_&&x_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(x_,"__esModule",{value:!0});x_.Connectors=void 0;var PW=eoe(R1()),Tn=eoe(ne()),tr=eoe(QN()),MW=$Yn(XF()),QF=eoe(M1()),pl=eoe(Pc()),pYe=class{constructor(e={}){this._options=e}list(e={},r){return Tn.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return x2(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:Tn.fetcher)({url:(0,MW.default)((i=(o=yield Tn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Tn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PW.CohereEnvironment.Production,"v1/connectors"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Tn.Supplier.get(this._options.clientName))!=null?yield Tn.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":Tn.RUNTIME.type,"X-Fern-Runtime-Version":Tn.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:QF.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 tr.BadRequestError(l.error.body,l.rawResponse);case 401:throw new tr.UnauthorizedError(l.error.body,l.rawResponse);case 403:throw new tr.ForbiddenError(l.error.body,l.rawResponse);case 404:throw new tr.NotFoundError(l.error.body,l.rawResponse);case 422:throw new tr.UnprocessableEntityError(l.error.body,l.rawResponse);case 429:throw new tr.TooManyRequestsError(l.error.body,l.rawResponse);case 498:throw new tr.InvalidTokenError(l.error.body,l.rawResponse);case 499:throw new tr.ClientClosedRequestError(l.error.body,l.rawResponse);case 500:throw new tr.InternalServerError(l.error.body,l.rawResponse);case 501:throw new tr.NotImplementedError(l.error.body,l.rawResponse);case 503:throw new tr.ServiceUnavailableError(l.error.body,l.rawResponse);case 504:throw new tr.GatewayTimeoutError(l.error.body,l.rawResponse);default:throw new pl.CohereError({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new pl.CohereError({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new pl.CohereTimeoutError("Timeout exceeded when calling GET /v1/connectors.");case"unknown":throw new pl.CohereError({message:l.error.errorMessage,rawResponse:l.rawResponse})}})}create(e,r){return Tn.HttpResponsePromise.fromPromise(this.__create(e,r))}__create(e,r){return x2(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Tn.fetcher)({url:(0,MW.default)((i=(o=yield Tn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Tn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PW.CohereEnvironment.Production,"v1/connectors"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Tn.Supplier.get(this._options.clientName))!=null?yield Tn.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":Tn.RUNTIME.type,"X-Fern-Runtime-Version":Tn.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:QF.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:QF.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 tr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new tr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new tr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new tr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new tr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new tr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new tr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new tr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new tr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new tr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new tr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new tr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new pl.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new pl.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new pl.CohereTimeoutError("Timeout exceeded when calling POST /v1/connectors.");case"unknown":throw new pl.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}get(e,r){return Tn.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return x2(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Tn.fetcher)({url:(0,MW.default)((i=(o=yield Tn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Tn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PW.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Tn.Supplier.get(this._options.clientName))!=null?yield Tn.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":Tn.RUNTIME.type,"X-Fern-Runtime-Version":Tn.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:QF.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 tr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new tr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new tr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new tr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new tr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new tr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new tr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new tr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new tr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new tr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new tr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new tr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new pl.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new pl.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new pl.CohereTimeoutError("Timeout exceeded when calling GET /v1/connectors/{id}.");case"unknown":throw new pl.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}delete(e,r){return Tn.HttpResponsePromise.fromPromise(this.__delete(e,r))}__delete(e,r){return x2(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:Tn.fetcher)({url:(0,MW.default)((i=(o=yield Tn.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield Tn.Supplier.get(this._options.environment))!==null&&i!==void 0?i:PW.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Tn.Supplier.get(this._options.clientName))!=null?yield Tn.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":Tn.RUNTIME.type,"X-Fern-Runtime-Version":Tn.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:QF.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 tr.BadRequestError(a.error.body,a.rawResponse);case 401:throw new tr.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new tr.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new tr.NotFoundError(a.error.body,a.rawResponse);case 422:throw new tr.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new tr.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new tr.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new tr.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new tr.InternalServerError(a.error.body,a.rawResponse);case 501:throw new tr.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new tr.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new tr.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new pl.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new pl.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new pl.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/connectors/{id}.");case"unknown":throw new pl.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}update(e,r={},n){return Tn.HttpResponsePromise.fromPromise(this.__update(e,r,n))}__update(e){return x2(this,arguments,void 0,function*(r,n={},o){var i,a,s;let u=yield((i=this._options.fetcher)!==null&&i!==void 0?i:Tn.fetcher)({url:(0,MW.default)((s=(a=yield Tn.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Tn.Supplier.get(this._options.environment))!==null&&s!==void 0?s:PW.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(r)}`),method:"PATCH",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Tn.Supplier.get(this._options.clientName))!=null?yield Tn.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":Tn.RUNTIME.type,"X-Fern-Runtime-Version":Tn.RUNTIME.version},o?.headers),contentType:"application/json",requestType:"json",body:QF.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:QF.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 tr.BadRequestError(u.error.body,u.rawResponse);case 401:throw new tr.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new tr.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new tr.NotFoundError(u.error.body,u.rawResponse);case 422:throw new tr.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new tr.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new tr.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new tr.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new tr.InternalServerError(u.error.body,u.rawResponse);case 501:throw new tr.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new tr.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new tr.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new pl.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new pl.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new pl.CohereTimeoutError("Timeout exceeded when calling PATCH /v1/connectors/{id}.");case"unknown":throw new pl.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}oAuthAuthorize(e,r={},n){return Tn.HttpResponsePromise.fromPromise(this.__oAuthAuthorize(e,r,n))}__oAuthAuthorize(e){return x2(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:Tn.fetcher)({url:(0,MW.default)((s=(a=yield Tn.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield Tn.Supplier.get(this._options.environment))!==null&&s!==void 0?s:PW.CohereEnvironment.Production,`v1/connectors/${encodeURIComponent(r)}/oauth/authorize`),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield Tn.Supplier.get(this._options.clientName))!=null?yield Tn.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":Tn.RUNTIME.type,"X-Fern-Runtime-Version":Tn.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:QF.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 tr.BadRequestError(c.error.body,c.rawResponse);case 401:throw new tr.UnauthorizedError(c.error.body,c.rawResponse);case 403:throw new tr.ForbiddenError(c.error.body,c.rawResponse);case 404:throw new tr.NotFoundError(c.error.body,c.rawResponse);case 422:throw new tr.UnprocessableEntityError(c.error.body,c.rawResponse);case 429:throw new tr.TooManyRequestsError(c.error.body,c.rawResponse);case 498:throw new tr.InvalidTokenError(c.error.body,c.rawResponse);case 499:throw new tr.ClientClosedRequestError(c.error.body,c.rawResponse);case 500:throw new tr.InternalServerError(c.error.body,c.rawResponse);case 501:throw new tr.NotImplementedError(c.error.body,c.rawResponse);case 503:throw new tr.ServiceUnavailableError(c.error.body,c.rawResponse);case 504:throw new tr.GatewayTimeoutError(c.error.body,c.rawResponse);default:throw new pl.CohereError({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new pl.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new pl.CohereTimeoutError("Timeout exceeded when calling POST /v1/connectors/{id}/oauth/authorize.");case"unknown":throw new pl.CohereError({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}_getAuthorizationHeader(){return x2(this,void 0,void 0,function*(){var e;let r=(e=yield Tn.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new pl.CohereError({message:"Please specify a bearer by either passing it in to the constructor or initializing a CO_API_KEY environment variable"});return`Bearer ${r}`})}};x_.Connectors=pYe});var gsr=S(O_=>{"use strict";var LYn=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]}),FYn=O_&&O_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),toe=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"&&LYn(r,e,n[o]);return FYn(r,e),r}}(),mYe=O_&&O_.__awaiter||function(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})},kYn=O_&&O_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(O_,"__esModule",{value:!0});O_.Models=void 0;var msr=toe(R1()),pg=toe(ne()),Fl=toe(QN()),hsr=kYn(XF()),hYe=toe(M1()),A1=toe(Pc()),gYe=class{constructor(e={}){this._options=e}get(e,r){return pg.HttpResponsePromise.fromPromise(this.__get(e,r))}__get(e,r){return mYe(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:pg.fetcher)({url:(0,hsr.default)((i=(o=yield pg.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield pg.Supplier.get(this._options.environment))!==null&&i!==void 0?i:msr.CohereEnvironment.Production,`v1/models/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield pg.Supplier.get(this._options.clientName))!=null?yield pg.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":pg.RUNTIME.type,"X-Fern-Runtime-Version":pg.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:hYe.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 Fl.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Fl.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Fl.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Fl.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Fl.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Fl.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Fl.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Fl.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Fl.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Fl.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Fl.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Fl.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new A1.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new A1.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new A1.CohereTimeoutError("Timeout exceeded when calling GET /v1/models/{model}.");case"unknown":throw new A1.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}list(e={},r){return pg.HttpResponsePromise.fromPromise(this.__list(e,r))}__list(){return mYe(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=hYe.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:pg.fetcher)({url:(0,hsr.default)((i=(o=yield pg.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield pg.Supplier.get(this._options.environment))!==null&&i!==void 0?i:msr.CohereEnvironment.Production,"v1/models"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield pg.Supplier.get(this._options.clientName))!=null?yield pg.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":pg.RUNTIME.type,"X-Fern-Runtime-Version":pg.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:hYe.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 Fl.BadRequestError(d.error.body,d.rawResponse);case 401:throw new Fl.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new Fl.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new Fl.NotFoundError(d.error.body,d.rawResponse);case 422:throw new Fl.UnprocessableEntityError(d.error.body,d.rawResponse);case 429:throw new Fl.TooManyRequestsError(d.error.body,d.rawResponse);case 498:throw new Fl.InvalidTokenError(d.error.body,d.rawResponse);case 499:throw new Fl.ClientClosedRequestError(d.error.body,d.rawResponse);case 500:throw new Fl.InternalServerError(d.error.body,d.rawResponse);case 501:throw new Fl.NotImplementedError(d.error.body,d.rawResponse);case 503:throw new Fl.ServiceUnavailableError(d.error.body,d.rawResponse);case 504:throw new Fl.GatewayTimeoutError(d.error.body,d.rawResponse);default:throw new A1.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new A1.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new A1.CohereTimeoutError("Timeout exceeded when calling GET /v1/models.");case"unknown":throw new A1.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return mYe(this,void 0,void 0,function*(){var e;let r=(e=yield pg.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new A1.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}`})}};O_.Models=gYe});var ysr=S(T_=>{"use strict";var qYn=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]}),BYn=T_&&T_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),roe=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"&&qYn(r,e,n[o]);return BYn(r,e),r}}(),ek=T_&&T_.__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())})},UYn=T_&&T_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(T_,"__esModule",{value:!0});T_.Finetuning=void 0;var O2=roe(R1()),kr=roe(ne()),ko=roe(QN()),T2=UYn(XF()),I1=roe(M1()),tu=roe(Pc()),yYe=class{constructor(e={}){this._options=e}listFinetunedModels(e={},r){return kr.HttpResponsePromise.fromPromise(this.__listFinetunedModels(e,r))}__listFinetunedModels(){return ek(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:kr.fetcher)({url:(0,T2.default)((i=(o=yield kr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield kr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:O2.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield kr.Supplier.get(this._options.clientName))!=null?yield kr.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":kr.RUNTIME.type,"X-Fern-Runtime-Version":kr.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:I1.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 ko.BadRequestError(c.error.body,c.rawResponse);case 401:throw new ko.UnauthorizedError(c.error.body,c.rawResponse);case 403:throw new ko.ForbiddenError(c.error.body,c.rawResponse);case 404:throw new ko.NotFoundError(c.error.body,c.rawResponse);case 500:throw new ko.InternalServerError(c.error.body,c.rawResponse);case 503:throw new ko.ServiceUnavailableError(c.error.body,c.rawResponse);default:throw new tu.CohereError({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new tu.CohereError({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new tu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models.");case"unknown":throw new tu.CohereError({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}createFinetunedModel(e,r){return kr.HttpResponsePromise.fromPromise(this.__createFinetunedModel(e,r))}__createFinetunedModel(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:kr.fetcher)({url:(0,T2.default)((i=(o=yield kr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield kr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:O2.CohereEnvironment.Production,"v1/finetuning/finetuned-models"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield kr.Supplier.get(this._options.clientName))!=null?yield kr.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":kr.RUNTIME.type,"X-Fern-Runtime-Version":kr.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:I1.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:I1.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 ko.BadRequestError(a.error.body,a.rawResponse);case 401:throw new ko.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new ko.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new ko.NotFoundError(a.error.body,a.rawResponse);case 500:throw new ko.InternalServerError(a.error.body,a.rawResponse);case 503:throw new ko.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new tu.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new tu.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new tu.CohereTimeoutError("Timeout exceeded when calling POST /v1/finetuning/finetuned-models.");case"unknown":throw new tu.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}getFinetunedModel(e,r){return kr.HttpResponsePromise.fromPromise(this.__getFinetunedModel(e,r))}__getFinetunedModel(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:kr.fetcher)({url:(0,T2.default)((i=(o=yield kr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield kr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:O2.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield kr.Supplier.get(this._options.clientName))!=null?yield kr.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":kr.RUNTIME.type,"X-Fern-Runtime-Version":kr.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:I1.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 ko.BadRequestError(a.error.body,a.rawResponse);case 401:throw new ko.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new ko.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new ko.NotFoundError(a.error.body,a.rawResponse);case 500:throw new ko.InternalServerError(a.error.body,a.rawResponse);case 503:throw new ko.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new tu.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new tu.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new tu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new tu.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}deleteFinetunedModel(e,r){return kr.HttpResponsePromise.fromPromise(this.__deleteFinetunedModel(e,r))}__deleteFinetunedModel(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:kr.fetcher)({url:(0,T2.default)((i=(o=yield kr.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield kr.Supplier.get(this._options.environment))!==null&&i!==void 0?i:O2.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"DELETE",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield kr.Supplier.get(this._options.clientName))!=null?yield kr.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":kr.RUNTIME.type,"X-Fern-Runtime-Version":kr.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:I1.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 ko.BadRequestError(a.error.body,a.rawResponse);case 401:throw new ko.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new ko.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new ko.NotFoundError(a.error.body,a.rawResponse);case 500:throw new ko.InternalServerError(a.error.body,a.rawResponse);case 503:throw new ko.ServiceUnavailableError(a.error.body,a.rawResponse);default:throw new tu.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new tu.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new tu.CohereTimeoutError("Timeout exceeded when calling DELETE /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new tu.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}updateFinetunedModel(e,r,n){return kr.HttpResponsePromise.fromPromise(this.__updateFinetunedModel(e,r,n))}__updateFinetunedModel(e,r,n){return ek(this,void 0,void 0,function*(){var o,i,a;let s=yield((o=this._options.fetcher)!==null&&o!==void 0?o:kr.fetcher)({url:(0,T2.default)((a=(i=yield kr.Supplier.get(this._options.baseUrl))!==null&&i!==void 0?i:yield kr.Supplier.get(this._options.environment))!==null&&a!==void 0?a:O2.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(e)}`),method:"PATCH",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield kr.Supplier.get(this._options.clientName))!=null?yield kr.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":kr.RUNTIME.type,"X-Fern-Runtime-Version":kr.RUNTIME.version},n?.headers),contentType:"application/json",requestType:"json",body:I1.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:I1.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 ko.BadRequestError(s.error.body,s.rawResponse);case 401:throw new ko.UnauthorizedError(s.error.body,s.rawResponse);case 403:throw new ko.ForbiddenError(s.error.body,s.rawResponse);case 404:throw new ko.NotFoundError(s.error.body,s.rawResponse);case 500:throw new ko.InternalServerError(s.error.body,s.rawResponse);case 503:throw new ko.ServiceUnavailableError(s.error.body,s.rawResponse);default:throw new tu.CohereError({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new tu.CohereError({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new tu.CohereTimeoutError("Timeout exceeded when calling PATCH /v1/finetuning/finetuned-models/{id}.");case"unknown":throw new tu.CohereError({message:s.error.errorMessage,rawResponse:s.rawResponse})}})}listEvents(e,r={},n){return kr.HttpResponsePromise.fromPromise(this.__listEvents(e,r,n))}__listEvents(e){return ek(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:kr.fetcher)({url:(0,T2.default)((s=(a=yield kr.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield kr.Supplier.get(this._options.environment))!==null&&s!==void 0?s:O2.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(r)}/events`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield kr.Supplier.get(this._options.clientName))!=null?yield kr.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":kr.RUNTIME.type,"X-Fern-Runtime-Version":kr.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:I1.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 ko.BadRequestError(f.error.body,f.rawResponse);case 401:throw new ko.UnauthorizedError(f.error.body,f.rawResponse);case 403:throw new ko.ForbiddenError(f.error.body,f.rawResponse);case 404:throw new ko.NotFoundError(f.error.body,f.rawResponse);case 500:throw new ko.InternalServerError(f.error.body,f.rawResponse);case 503:throw new ko.ServiceUnavailableError(f.error.body,f.rawResponse);default:throw new tu.CohereError({statusCode:f.error.statusCode,body:f.error.body,rawResponse:f.rawResponse})}switch(f.error.reason){case"non-json":throw new tu.CohereError({statusCode:f.error.statusCode,body:f.error.rawBody,rawResponse:f.rawResponse});case"timeout":throw new tu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/events.");case"unknown":throw new tu.CohereError({message:f.error.errorMessage,rawResponse:f.rawResponse})}})}listTrainingStepMetrics(e,r={},n){return kr.HttpResponsePromise.fromPromise(this.__listTrainingStepMetrics(e,r,n))}__listTrainingStepMetrics(e){return ek(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:kr.fetcher)({url:(0,T2.default)((s=(a=yield kr.Supplier.get(this._options.baseUrl))!==null&&a!==void 0?a:yield kr.Supplier.get(this._options.environment))!==null&&s!==void 0?s:O2.CohereEnvironment.Production,`v1/finetuning/finetuned-models/${encodeURIComponent(r)}/training-step-metrics`),method:"GET",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield kr.Supplier.get(this._options.clientName))!=null?yield kr.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":kr.RUNTIME.type,"X-Fern-Runtime-Version":kr.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:I1.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 ko.BadRequestError(d.error.body,d.rawResponse);case 401:throw new ko.UnauthorizedError(d.error.body,d.rawResponse);case 403:throw new ko.ForbiddenError(d.error.body,d.rawResponse);case 404:throw new ko.NotFoundError(d.error.body,d.rawResponse);case 500:throw new ko.InternalServerError(d.error.body,d.rawResponse);case 503:throw new ko.ServiceUnavailableError(d.error.body,d.rawResponse);default:throw new tu.CohereError({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new tu.CohereError({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new tu.CohereTimeoutError("Timeout exceeded when calling GET /v1/finetuning/finetuned-models/{finetuned_model_id}/training-step-metrics.");case"unknown":throw new tu.CohereError({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return ek(this,void 0,void 0,function*(){var e;let r=(e=yield kr.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new tu.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}`})}};T_.Finetuning=yYe});var R0e=S(Sy=>{"use strict";var zYn=Sy&&Sy.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),HYn=Sy&&Sy.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),noe=Sy&&Sy.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 HYn(r,e),r}}(),E_=Sy&&Sy.__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())})},bsr=Sy&&Sy.__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},VYn=Sy&&Sy.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Sy,"__esModule",{value:!0});Sy.CohereClient=void 0;var OC=noe(R1()),ot=noe(ne()),Ne=noe(QN()),rd=noe(M1()),TC=VYn(XF()),Co=noe(Pc()),JYn=cYe(),KYn=dsr(),WYn=fsr(),GYn=psr(),ZYn=gsr(),XYn=ysr(),bYe=class{constructor(e={}){this._options=e}get v2(){var e;return(e=this._v2)!==null&&e!==void 0?e:this._v2=new JYn.V2(this._options)}get embedJobs(){var e;return(e=this._embedJobs)!==null&&e!==void 0?e:this._embedJobs=new KYn.EmbedJobs(this._options)}get datasets(){var e;return(e=this._datasets)!==null&&e!==void 0?e:this._datasets=new WYn.Datasets(this._options)}get connectors(){var e;return(e=this._connectors)!==null&&e!==void 0?e:this._connectors=new GYn.Connectors(this._options)}get models(){var e;return(e=this._models)!==null&&e!==void 0?e:this._models=new ZYn.Models(this._options)}get finetuning(){var e;return(e=this._finetuning)!==null&&e!==void 0?e:this._finetuning=new XYn.Finetuning(this._options)}chatStream(e,r){return ot.HttpResponsePromise.fromPromise(this.__chatStream(e,r))}__chatStream(e,r){return E_(this,void 0,void 0,function*(){var n,o,i;let{accepts:a}=e,s=bsr(e,["accepts"]),u=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ot.fetcher)({url:(0,TC.default)((i=(o=yield ot.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ot.Supplier.get(this._options.environment))!==null&&i!==void 0?i:OC.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ot.Supplier.get(this._options.clientName))!=null?yield ot.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":ot.RUNTIME.type,"X-Fern-Runtime-Version":ot.RUNTIME.version,Accepts:a??void 0},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},rd.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 ot.Stream({stream:u.body,parse:l=>E_(this,void 0,void 0,function*(){return rd.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 Ne.BadRequestError(u.error.body,u.rawResponse);case 401:throw new Ne.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new Ne.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new Ne.NotFoundError(u.error.body,u.rawResponse);case 422:throw new Ne.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new Ne.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new Ne.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new Ne.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new Ne.InternalServerError(u.error.body,u.rawResponse);case 501:throw new Ne.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new Ne.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new Ne.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new Co.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Co.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new Co.CohereTimeoutError("Timeout exceeded when calling POST /v1/chat.");case"unknown":throw new Co.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}chat(e,r){return ot.HttpResponsePromise.fromPromise(this.__chat(e,r))}__chat(e,r){return E_(this,void 0,void 0,function*(){var n,o,i;let{accepts:a}=e,s=bsr(e,["accepts"]),u=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ot.fetcher)({url:(0,TC.default)((i=(o=yield ot.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ot.Supplier.get(this._options.environment))!==null&&i!==void 0?i:OC.CohereEnvironment.Production,"v1/chat"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ot.Supplier.get(this._options.clientName))!=null?yield ot.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":ot.RUNTIME.type,"X-Fern-Runtime-Version":ot.RUNTIME.version,Accepts:a??void 0},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},rd.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:rd.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 Ne.BadRequestError(u.error.body,u.rawResponse);case 401:throw new Ne.UnauthorizedError(u.error.body,u.rawResponse);case 403:throw new Ne.ForbiddenError(u.error.body,u.rawResponse);case 404:throw new Ne.NotFoundError(u.error.body,u.rawResponse);case 422:throw new Ne.UnprocessableEntityError(u.error.body,u.rawResponse);case 429:throw new Ne.TooManyRequestsError(u.error.body,u.rawResponse);case 498:throw new Ne.InvalidTokenError(u.error.body,u.rawResponse);case 499:throw new Ne.ClientClosedRequestError(u.error.body,u.rawResponse);case 500:throw new Ne.InternalServerError(u.error.body,u.rawResponse);case 501:throw new Ne.NotImplementedError(u.error.body,u.rawResponse);case 503:throw new Ne.ServiceUnavailableError(u.error.body,u.rawResponse);case 504:throw new Ne.GatewayTimeoutError(u.error.body,u.rawResponse);default:throw new Co.CohereError({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Co.CohereError({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new Co.CohereTimeoutError("Timeout exceeded when calling POST /v1/chat.");case"unknown":throw new Co.CohereError({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}generateStream(e,r){return ot.HttpResponsePromise.fromPromise(this.__generateStream(e,r))}__generateStream(e,r){return E_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ot.fetcher)({url:(0,TC.default)((i=(o=yield ot.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ot.Supplier.get(this._options.environment))!==null&&i!==void 0?i:OC.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ot.Supplier.get(this._options.clientName))!=null?yield ot.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":ot.RUNTIME.type,"X-Fern-Runtime-Version":ot.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},rd.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 ot.Stream({stream:a.body,parse:s=>E_(this,void 0,void 0,function*(){return rd.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 Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Co.CohereTimeoutError("Timeout exceeded when calling POST /v1/generate.");case"unknown":throw new Co.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}generate(e,r){return ot.HttpResponsePromise.fromPromise(this.__generate(e,r))}__generate(e,r){return E_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ot.fetcher)({url:(0,TC.default)((i=(o=yield ot.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ot.Supplier.get(this._options.environment))!==null&&i!==void 0?i:OC.CohereEnvironment.Production,"v1/generate"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ot.Supplier.get(this._options.clientName))!=null?yield ot.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":ot.RUNTIME.type,"X-Fern-Runtime-Version":ot.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:Object.assign(Object.assign({},rd.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:rd.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 Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Co.CohereTimeoutError("Timeout exceeded when calling POST /v1/generate.");case"unknown":throw new Co.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}embed(e={},r){return ot.HttpResponsePromise.fromPromise(this.__embed(e,r))}__embed(){return E_(this,arguments,void 0,function*(e={},r){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ot.fetcher)({url:(0,TC.default)((i=(o=yield ot.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ot.Supplier.get(this._options.environment))!==null&&i!==void 0?i:OC.CohereEnvironment.Production,"v1/embed"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ot.Supplier.get(this._options.clientName))!=null?yield ot.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":ot.RUNTIME.type,"X-Fern-Runtime-Version":ot.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:rd.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:rd.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 Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Co.CohereTimeoutError("Timeout exceeded when calling POST /v1/embed.");case"unknown":throw new Co.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}rerank(e,r){return ot.HttpResponsePromise.fromPromise(this.__rerank(e,r))}__rerank(e,r){return E_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ot.fetcher)({url:(0,TC.default)((i=(o=yield ot.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ot.Supplier.get(this._options.environment))!==null&&i!==void 0?i:OC.CohereEnvironment.Production,"v1/rerank"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ot.Supplier.get(this._options.clientName))!=null?yield ot.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":ot.RUNTIME.type,"X-Fern-Runtime-Version":ot.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:rd.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:rd.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 Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Co.CohereTimeoutError("Timeout exceeded when calling POST /v1/rerank.");case"unknown":throw new Co.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}classify(e,r){return ot.HttpResponsePromise.fromPromise(this.__classify(e,r))}__classify(e,r){return E_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ot.fetcher)({url:(0,TC.default)((i=(o=yield ot.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ot.Supplier.get(this._options.environment))!==null&&i!==void 0?i:OC.CohereEnvironment.Production,"v1/classify"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ot.Supplier.get(this._options.clientName))!=null?yield ot.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":ot.RUNTIME.type,"X-Fern-Runtime-Version":ot.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:rd.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:rd.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 Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Co.CohereTimeoutError("Timeout exceeded when calling POST /v1/classify.");case"unknown":throw new Co.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}summarize(e,r){return ot.HttpResponsePromise.fromPromise(this.__summarize(e,r))}__summarize(e,r){return E_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ot.fetcher)({url:(0,TC.default)((i=(o=yield ot.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ot.Supplier.get(this._options.environment))!==null&&i!==void 0?i:OC.CohereEnvironment.Production,"v1/summarize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ot.Supplier.get(this._options.clientName))!=null?yield ot.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":ot.RUNTIME.type,"X-Fern-Runtime-Version":ot.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:rd.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:rd.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 Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Co.CohereTimeoutError("Timeout exceeded when calling POST /v1/summarize.");case"unknown":throw new Co.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}tokenize(e,r){return ot.HttpResponsePromise.fromPromise(this.__tokenize(e,r))}__tokenize(e,r){return E_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ot.fetcher)({url:(0,TC.default)((i=(o=yield ot.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ot.Supplier.get(this._options.environment))!==null&&i!==void 0?i:OC.CohereEnvironment.Production,"v1/tokenize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ot.Supplier.get(this._options.clientName))!=null?yield ot.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":ot.RUNTIME.type,"X-Fern-Runtime-Version":ot.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:rd.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:rd.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 Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Co.CohereTimeoutError("Timeout exceeded when calling POST /v1/tokenize.");case"unknown":throw new Co.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}detokenize(e,r){return ot.HttpResponsePromise.fromPromise(this.__detokenize(e,r))}__detokenize(e,r){return E_(this,void 0,void 0,function*(){var n,o,i;let a=yield((n=this._options.fetcher)!==null&&n!==void 0?n:ot.fetcher)({url:(0,TC.default)((i=(o=yield ot.Supplier.get(this._options.baseUrl))!==null&&o!==void 0?o:yield ot.Supplier.get(this._options.environment))!==null&&i!==void 0?i:OC.CohereEnvironment.Production,"v1/detokenize"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ot.Supplier.get(this._options.clientName))!=null?yield ot.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":ot.RUNTIME.type,"X-Fern-Runtime-Version":ot.RUNTIME.version},r?.headers),contentType:"application/json",requestType:"json",body:rd.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:rd.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 Ne.BadRequestError(a.error.body,a.rawResponse);case 401:throw new Ne.UnauthorizedError(a.error.body,a.rawResponse);case 403:throw new Ne.ForbiddenError(a.error.body,a.rawResponse);case 404:throw new Ne.NotFoundError(a.error.body,a.rawResponse);case 422:throw new Ne.UnprocessableEntityError(a.error.body,a.rawResponse);case 429:throw new Ne.TooManyRequestsError(a.error.body,a.rawResponse);case 498:throw new Ne.InvalidTokenError(a.error.body,a.rawResponse);case 499:throw new Ne.ClientClosedRequestError(a.error.body,a.rawResponse);case 500:throw new Ne.InternalServerError(a.error.body,a.rawResponse);case 501:throw new Ne.NotImplementedError(a.error.body,a.rawResponse);case 503:throw new Ne.ServiceUnavailableError(a.error.body,a.rawResponse);case 504:throw new Ne.GatewayTimeoutError(a.error.body,a.rawResponse);default:throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.body,rawResponse:a.rawResponse})}switch(a.error.reason){case"non-json":throw new Co.CohereError({statusCode:a.error.statusCode,body:a.error.rawBody,rawResponse:a.rawResponse});case"timeout":throw new Co.CohereTimeoutError("Timeout exceeded when calling POST /v1/detokenize.");case"unknown":throw new Co.CohereError({message:a.error.errorMessage,rawResponse:a.rawResponse})}})}checkApiKey(e){return ot.HttpResponsePromise.fromPromise(this.__checkApiKey(e))}__checkApiKey(e){return E_(this,void 0,void 0,function*(){var r,n,o;let i=yield((r=this._options.fetcher)!==null&&r!==void 0?r:ot.fetcher)({url:(0,TC.default)((o=(n=yield ot.Supplier.get(this._options.baseUrl))!==null&&n!==void 0?n:yield ot.Supplier.get(this._options.environment))!==null&&o!==void 0?o:OC.CohereEnvironment.Production,"v1/check-api-key"),method:"POST",headers:Object.assign({Authorization:yield this._getAuthorizationHeader(),"X-Client-Name":(yield ot.Supplier.get(this._options.clientName))!=null?yield ot.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":ot.RUNTIME.type,"X-Fern-Runtime-Version":ot.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:rd.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 Ne.BadRequestError(i.error.body,i.rawResponse);case 401:throw new Ne.UnauthorizedError(i.error.body,i.rawResponse);case 403:throw new Ne.ForbiddenError(i.error.body,i.rawResponse);case 404:throw new Ne.NotFoundError(i.error.body,i.rawResponse);case 422:throw new Ne.UnprocessableEntityError(i.error.body,i.rawResponse);case 429:throw new Ne.TooManyRequestsError(i.error.body,i.rawResponse);case 498:throw new Ne.InvalidTokenError(i.error.body,i.rawResponse);case 499:throw new Ne.ClientClosedRequestError(i.error.body,i.rawResponse);case 500:throw new Ne.InternalServerError(i.error.body,i.rawResponse);case 501:throw new Ne.NotImplementedError(i.error.body,i.rawResponse);case 503:throw new Ne.ServiceUnavailableError(i.error.body,i.rawResponse);case 504:throw new Ne.GatewayTimeoutError(i.error.body,i.rawResponse);default:throw new Co.CohereError({statusCode:i.error.statusCode,body:i.error.body,rawResponse:i.rawResponse})}switch(i.error.reason){case"non-json":throw new Co.CohereError({statusCode:i.error.statusCode,body:i.error.rawBody,rawResponse:i.rawResponse});case"timeout":throw new Co.CohereTimeoutError("Timeout exceeded when calling POST /v1/check-api-key.");case"unknown":throw new Co.CohereError({message:i.error.errorMessage,rawResponse:i.rawResponse})}})}_getAuthorizationHeader(){return E_(this,void 0,void 0,function*(){var e;let r=(e=yield ot.Supplier.get(this._options.token))!==null&&e!==void 0?e:process==null?void 0:process.env.CO_API_KEY;if(r==null)throw new Co.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}`})}};Sy.CohereClient=bYe});var vYe=S(A0e=>{"use strict";Object.defineProperty(A0e,"__esModule",{value:!0});A0e.CohereClientV2=void 0;var YYn=cYe(),QYn=R0e(),_Ye=class{constructor(e){this._options=e,this.client=new QYn.CohereClient(this._options),this.clientV2=new YYn.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}};A0e.CohereClientV2=_Ye});var CYe=S(RW=>{"use strict";Object.defineProperty(RW,"__esModule",{value:!0});RW.AwsClientV2=RW.AwsClient=void 0;var eQn=R0e(),tQn=vYe(),wYe=class extends eQn.CohereClient{constructor(e){e.token="n/a",super(e)}};RW.AwsClient=wYe;var SYe=class extends tQn.CohereClientV2{constructor(e){e.token="n/a",super(e)}};RW.AwsClientV2=SYe});var wsr=S(AW=>{"use strict";Object.defineProperty(AW,"__esModule",{value:!0});AW.BedrockClientV2=AW.BedrockClient=void 0;var _sr=uYe(),vsr=CYe(),xYe=class extends vsr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,_sr.fetchOverride)("bedrock",e)}))}};AW.BedrockClient=xYe;var OYe=class extends vsr.AwsClientV2{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,_sr.fetchOverride)("bedrock",e)}))}};AW.BedrockClientV2=OYe});var Ssr=S(I0e=>{"use strict";Object.defineProperty(I0e,"__esModule",{value:!0});I0e.CustomClient=void 0;var rQn=R0e(),TYe=class extends rQn.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}};I0e.CustomClient=TYe});var Osr=S(IW=>{"use strict";Object.defineProperty(IW,"__esModule",{value:!0});IW.SagemakerClientV2=IW.SagemakerClient=void 0;var Csr=CYe(),xsr=uYe(),EYe=class extends Csr.AwsClient{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,xsr.fetchOverride)("sagemaker",e)}))}};IW.SagemakerClient=EYe;var PYe=class extends Csr.AwsClientV2{constructor(e){super(Object.assign(Object.assign({},e),{fetcher:(0,xsr.fetchOverride)("sagemaker",e)}))}};IW.SagemakerClientV2=PYe});var Msr=S(cu=>{"use strict";var nQn=cu&&cu.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oQn=cu&&cu.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iQn=cu&&cu.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(cu,"__esModule",{value:!0});cu.SagemakerClientV2=cu.SagemakerClient=cu.CohereTimeoutError=cu.CohereError=cu.CohereEnvironment=cu.CohereClient=cu.CohereClientV2=cu.BedrockClientV2=cu.BedrockClient=cu.Cohere=void 0;cu.Cohere=iQn(QN());var Tsr=wsr();Object.defineProperty(cu,"BedrockClient",{enumerable:!0,get:function(){return Tsr.BedrockClient}});Object.defineProperty(cu,"BedrockClientV2",{enumerable:!0,get:function(){return Tsr.BedrockClientV2}});var aQn=vYe();Object.defineProperty(cu,"CohereClientV2",{enumerable:!0,get:function(){return aQn.CohereClientV2}});var sQn=Ssr();Object.defineProperty(cu,"CohereClient",{enumerable:!0,get:function(){return sQn.CustomClient}});var uQn=R1();Object.defineProperty(cu,"CohereEnvironment",{enumerable:!0,get:function(){return uQn.CohereEnvironment}});var Esr=Pc();Object.defineProperty(cu,"CohereError",{enumerable:!0,get:function(){return Esr.CohereError}});Object.defineProperty(cu,"CohereTimeoutError",{enumerable:!0,get:function(){return Esr.CohereTimeoutError}});var Psr=Osr();Object.defineProperty(cu,"SagemakerClient",{enumerable:!0,get:function(){return Psr.SagemakerClient}});Object.defineProperty(cu,"SagemakerClientV2",{enumerable:!0,get:function(){return Psr.SagemakerClientV2}})});function NW(t){if(t?.client)return t.client;let e=t?.apiKey??gn("COHERE_API_KEY");if(!e)throw new Error("COHERE_API_KEY must be set");return new Rsr.CohereClient({token:e})}var Rsr,ooe=v(()=>{Rsr=L(Msr(),1);nl()});function PC(t,e){e?(mh[0]=mh[16]=mh[1]=mh[2]=mh[3]=mh[4]=mh[5]=mh[6]=mh[7]=mh[8]=mh[9]=mh[10]=mh[11]=mh[12]=mh[13]=mh[14]=mh[15]=0,this.blocks=mh):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 Sr,lQn,EC,N0e,mh,j0e,MYe=v(()=>{Sr="0123456789abcdef".split(""),lQn=[-2147483648,8388608,32768,128],EC=[24,16,8,0],N0e=[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],mh=[];PC.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]<<EC[i++&3];else for(i=this.start;o<a&&i<64;++o)n=t.charCodeAt(o),n<128?s[i>>>2]|=n<<EC[i++&3]:n<2048?(s[i>>>2]|=(192|n>>>6)<<EC[i++&3],s[i>>>2]|=(128|n&63)<<EC[i++&3]):n<55296||n>=57344?(s[i>>>2]|=(224|n>>>12)<<EC[i++&3],s[i>>>2]|=(128|n>>>6&63)<<EC[i++&3],s[i>>>2]|=(128|n&63)<<EC[i++&3]):(n=65536+((n&1023)<<10|t.charCodeAt(++o)&1023),s[i>>>2]|=(240|n>>>18)<<EC[i++&3],s[i>>>2]|=(128|n>>>12&63)<<EC[i++&3],s[i>>>2]|=(128|n>>>6&63)<<EC[i++&3],s[i>>>2]|=(128|n&63)<<EC[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}};PC.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>>2]|=lQn[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()}};PC.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,g,y,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?(g=300032,p=u[0]-1413257819,s=p-150054599<<0,n=p+24177077<<0):(g=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),g=t&e,f=g^t&r^_,h=o&i^~o&a,p=s+d+h+N0e[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),y=n&t,f=y^n&e^g,h=a&s^~a&o,p=i+d+h+N0e[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^y,h=i&a^~i&s,p=o+d+h+N0e[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+N0e[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};PC.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=Sr[t>>>28&15]+Sr[t>>>24&15]+Sr[t>>>20&15]+Sr[t>>>16&15]+Sr[t>>>12&15]+Sr[t>>>8&15]+Sr[t>>>4&15]+Sr[t&15]+Sr[e>>>28&15]+Sr[e>>>24&15]+Sr[e>>>20&15]+Sr[e>>>16&15]+Sr[e>>>12&15]+Sr[e>>>8&15]+Sr[e>>>4&15]+Sr[e&15]+Sr[r>>>28&15]+Sr[r>>>24&15]+Sr[r>>>20&15]+Sr[r>>>16&15]+Sr[r>>>12&15]+Sr[r>>>8&15]+Sr[r>>>4&15]+Sr[r&15]+Sr[n>>>28&15]+Sr[n>>>24&15]+Sr[n>>>20&15]+Sr[n>>>16&15]+Sr[n>>>12&15]+Sr[n>>>8&15]+Sr[n>>>4&15]+Sr[n&15]+Sr[o>>>28&15]+Sr[o>>>24&15]+Sr[o>>>20&15]+Sr[o>>>16&15]+Sr[o>>>12&15]+Sr[o>>>8&15]+Sr[o>>>4&15]+Sr[o&15]+Sr[i>>>28&15]+Sr[i>>>24&15]+Sr[i>>>20&15]+Sr[i>>>16&15]+Sr[i>>>12&15]+Sr[i>>>8&15]+Sr[i>>>4&15]+Sr[i&15]+Sr[a>>>28&15]+Sr[a>>>24&15]+Sr[a>>>20&15]+Sr[a>>>16&15]+Sr[a>>>12&15]+Sr[a>>>8&15]+Sr[a>>>4&15]+Sr[a&15];return this.is224||(u+=Sr[s>>>28&15]+Sr[s>>>24&15]+Sr[s>>>20&15]+Sr[s>>>16&15]+Sr[s>>>12&15]+Sr[s>>>8&15]+Sr[s>>>4&15]+Sr[s&15]),u};PC.prototype.toString=PC.prototype.hex;PC.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};PC.prototype.array=PC.prototype.digest;PC.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};j0e=(...t)=>new PC(!1,!0).update(t.join("")).hex()});var cQn,Asr=v(()=>{Do();MYe();cQn={};Et(cQn,{sha256:()=>j0e})});function fQn(t){return t.message!==void 0?{text:t.text,message:xY(t.message)}:{text:t.text}}function pQn(t){let e={text:t.text};return t.message!==void 0&&(e.message=t.message.toDict()),e}var dQn,Isr,Nsr,mQn,RYe,Dsr=v(()=>{Do();iO();MYe();Asr();dQn={};Et(dQn,{BaseCache:()=>Nsr,InMemoryCache:()=>RYe,defaultHashKeyEncoder:()=>Isr,deserializeStoredGeneration:()=>fQn,serializeGeneration:()=>pQn});Isr=(...t)=>j0e(t.join("_"));Nsr=class{constructor(){M(this,"keyEncoder",Isr)}makeDefaultKeyEncoder(t){this.keyEncoder=t}},mQn=new Map,RYe=class jsr extends Nsr{constructor(r){super();M(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 jsr(mQn)}}});function bQn(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 _Qn(t,e){return t.length===1?[e.get(t.join(","))]:bQn(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function vQn(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}function IYe(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 $sr,hQn,gQn,yQn,AYe,D0e,Lsr=v(()=>{$sr=L(aHe(),1),hQn=Object.defineProperty,gQn=(t,e,r)=>e in t?hQn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yQn=(t,e,r)=>(gQn(t,typeof e!="symbol"?e+"":e,r),r);AYe=class{constructor(t,e){M(this,"specialTokens");M(this,"inverseSpecialTokens");M(this,"patStr");M(this,"textEncoder",new TextEncoder);M(this,"textDecoder",new TextDecoder("utf-8"));M(this,"rankMap",new Map);M(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=$sr.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=AYe.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=AYe.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(..._Qn(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)}},D0e=AYe;yQn(D0e,"specialTokenRegex",t=>new RegExp(t.map(e=>vQn(e)).join("|"),"g"))});var Fsr=v(()=>{Lsr()});async function NYe(t){return t in $0e||($0e[t]=SQn.fetch(`https://tiktoken.pages.dev/js/${t}.json`).then(e=>e.json()).then(e=>new D0e(e)).catch(e=>{throw delete $0e[t],e})),await $0e[t]}async function L0e(t){return NYe(IYe(t))}var wQn,$0e,SQn,jYe=v(()=>{Do();iz();Fsr();wQn={};Et(wQn,{encodingForModel:()=>L0e,getEncoding:()=>NYe});$0e={},SQn=new Fw({})});function Kv(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 CQn,F0e,xQn,ksr,qsr,OQn,jW,E2,Wv=v(()=>{Do();iO();iz();Gh();kQ();Dsr();jYe();CQn={};Et(CQn,{BaseLangChain:()=>jW,BaseLanguageModel:()=>E2,calculateMaxTokens:()=>qsr,getEmbeddingContextSize:()=>xQn,getModelContextSize:()=>ksr,getModelNameForTiktoken:()=>F0e,isOpenAITool:()=>Kv});F0e=t=>t.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":t.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":t.startsWith("gpt-4-32k")?"gpt-4-32k":t.startsWith("gpt-4-")?"gpt-4":t.startsWith("gpt-4o")?"gpt-4o":t,xQn=t=>{switch(t){case"text-embedding-ada-002":return 8191;default:return 2046}},ksr=t=>{switch(F0e(t)){case"gpt-3.5-turbo-16k":return 16384;case"gpt-3.5-turbo":return 4096;case"gpt-4-32k":return 32768;case"gpt-4":return 8192;case"text-davinci-003":return 4097;case"text-curie-001":return 2048;case"text-babbage-001":return 2048;case"text-ada-001":return 2048;case"code-davinci-002":return 8e3;case"code-cushman-001":return 2048;default:return 4097}};qsr=async({prompt:t,modelName:e})=>{let r;try{r=(await L0e(F0e(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 ksr(e)-r},OQn=()=>!1,jW=class extends Lo{constructor(e){super(e);M(this,"verbose");M(this,"callbacks");M(this,"tags");M(this,"metadata");this.verbose=e.verbose??OQn(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{}}get lc_attributes(){return{callbacks:void 0,verbose:void 0}}},E2=class extends jW{constructor({callbacks:e,callbackManager:r,...n}){let{cache:o,...i}=n;super({callbacks:e??r,...i});M(this,"caller");M(this,"cache");M(this,"_encoding");typeof o=="object"?this.cache=o:o?this.cache=RYe.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 L0e("modelName"in this?F0e(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 LQ(e):Array.isArray(e)?new FQ(e.map(Iw)):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")}}});function ioe(t){return t!==void 0&&Array.isArray(t.lc_namespace)}function aoe(t){return t!==void 0&&Lo.isRunnable(t)&&"lc_name"in t.constructor&&typeof t.constructor.lc_name=="function"&&t.constructor.lc_name()==="RunnableToolLike"}function soe(t){return!!t&&typeof t=="object"&&"name"in t&&"schema"in t&&(Ga(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 mg(t){return soe(t)||aoe(t)||ioe(t)}var DYe=v(()=>{yN();Gh()});function Bsr(t,e){let r=typeof e=="number"?void 0:e;return{name:t.name,description:t.description,parameters:Vi(t.schema),...r?.strict!==void 0?{strict:r.strict}:{}}}function N1(t,e){let r=typeof e=="number"?void 0:e,n;return mg(t)?n={type:"function",function:Bsr(t)}:n=t,r?.strict!==void 0&&(n.function.strict=r.strict),n}var TQn,j1=v(()=>{Do();o_();DYe();TQn={};Et(TQn,{convertToOpenAIFunction:()=>Bsr,convertToOpenAITool:()=>N1,isLangChainTool:()=>mg,isRunnableToolLike:()=>aoe,isStructuredTool:()=>ioe,isStructuredToolParams:()=>soe})});function k0e(t){let e=t.constructor;return new e({...t,content:t.contentBlocks,response_metadata:{...t.response_metadata,output_version:"v1"}})}var Usr,zsr=v(()=>{Usr=t=>t()});function $Ye(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];(W3(i)||G3(i))&&n===r&&(n=new r.constructor({...n,content:[...r.content.slice(0,o),Ffe(i),...r.content.slice(o+1)]}))}e.push(n)}return e}var EQn,hh,PQn,D1=v(()=>{Do();yY();Vg();V0();iO();nl();EY();X$();cO();ym();yN();o_();Gh();$s();Wv();_he();zsr();EQn={};Et(EQn,{BaseChatModel:()=>hh,SimpleChatModel:()=>PQn});hh=class P2 extends E2{constructor(r){super(r);M(this,"lc_namespace",["langchain","chat_models",this._llmType()]);M(this,"disableStreaming",!1);M(this,"outputVersion");this.outputVersion=Usr(()=>{let n=r.outputVersion??gn("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=P2._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===P2.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(r,n);else{let i=P2._convertInputToPromptValue(r).toChatMessages(),[a,s]=this._separateRunnableConfigFromCallOptionsCompat(n),u={...a.metadata,...this.getLsParams(s)},l=await Yl.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(),[$Ye(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 g=f?.at(0)?.runId;g!=null&&h.message._updateId(`run-${g}`)}h.message.response_metadata={...h.generationInfo,...h.message.response_metadata},d==="v1"?yield k0e(h.message):yield h.message,p?p=p.concat(h):p=h,wY(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(g=>g?.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(Iw)),s;if(i!==void 0&&i.length===a.length)s=i;else{let p={...o.metadata,...this.getLsParams(n)},m=await Yl.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($Ye),o.runId,void 0,h,void 0,void 0,o.runName)}let u=n.outputVersion??this.outputVersion,l=[],c=[];if(!!s?.[0].handlers.find(TY)&&!this.disableStreaming&&a.length===1&&this._streamResponseChunks!==P2.prototype._streamResponseChunks)try{let p=await this._streamResponseChunks(a[0],n,s?.[0]),m,h;for await(let g of p){if(g.message.id==null){let y=s?.at(0)?.runId;y!=null&&g.message._updateId(`run-${y}`)}m===void 0?m=g:m=eb(m,g),wY(g.message)&&g.message.usage_metadata!==void 0&&(h={tokenUsage:{promptTokens:g.message.usage_metadata.input_tokens,completionTokens:g.message.usage_metadata.output_tokens,totalTokens:g.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 g=await this._generate(m,{...n,promptIndex:h},s?.[h]);if(u==="v1")for(let y of g.generations)y.message=k0e(y.message);return g}));await Promise.all(p.map(async(m,h)=>{if(m.status==="fulfilled"){let g=m.value;for(let y of g.generations){if(y.message.id==null){let b=s?.at(0)?.runId;b!=null&&y.message._updateId(`run-${b}`)}y.message.response_metadata={...y.generationInfo,...y.message.response_metadata}}return g.generations.length===1&&(g.generations[0].message.response_metadata={...g.llmOutput,...g.generations[0].message.response_metadata}),l[h]=g.generations,c[h]=g.llmOutput,s?.[h]?.handleLLMEnd({generations:[g.generations],llmOutput:g.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,dN,{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(Iw)),u={...a.metadata,...this.getLsParams(i)},l=await Yl.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($Ye),a.runId,void 0,c,void 0,void 0,a.runName),f=[],m=(await Promise.allSettled(s.map(async(b,_)=>{let w=P2._convertInputToPromptValue(b).toString(),x=await n.lookup(w,o);return x==null&&f.push(_),x}))).map((b,_)=>({result:b,runManager:d?.[_]})).filter(({result:b})=>b.status==="fulfilled"&&b.value!=null||b.status==="rejected"),h=i.outputVersion??this.outputVersion,g=[];await Promise.all(m.map(async({result:b,runManager:_},w)=>{if(b.status==="fulfilled"){let x=b.value;return g[w]=x.map(O=>("message"in O&&Xm(O.message)&&Us(O.message)&&(O.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},h==="v1"&&(O.message=k0e(O.message))),O.generationInfo={...O.generationInfo,tokenUsage:{}},O)),x.length&&await _?.handleLLMNewToken(x[0].text),_?.handleLLMEnd({generations:[x]},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 y={generations:g,missingPromptIndices:f,startedRunManagers:d};return Object.defineProperty(y,dN,{value:d?{runIds:d?.map(b=>b.runId)}:void 0,configurable:!0}),y}async generate(r,n,o){let i;Array.isArray(n)?i={stop:n}:i=n;let a=r.map(h=>h.map(Iw)),[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(g=>a[g]),u,s,p!==void 0?f.map(g=>p?.[g]):void 0);await Promise.all(h.generations.map(async(g,y)=>{let b=f[y];d[b]=g;let _=P2._convertInputToPromptValue(a[b]).toString();return l.update(_,c,g)})),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=lL(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;Ga(o)?c=[{type:"function",function:{name:l,description:a,parameters:Vi(o)}}]:("name"in o&&(l=o.name),c=[{type:"function",function:{name:l,description:a,parameters:o}}]);let d=this.bindTools(c),f=i_.from(g=>{if(!Ur.isInstance(g))throw new Error("Input is not an AIMessageChunk.");if(!g.tool_calls||g.tool_calls.length===0)throw new Error("No tool calls found in the response.");let y=g.tool_calls.find(b=>b.name===l);if(!y)throw new Error(`No tool call found with name ${l}.`);return y.args});if(!u)return d.pipe(f).withConfig({runName:"StructuredOutput"});let p=xu.assign({parsed:(g,y)=>f.invoke(g.raw,y)}),m=xu.assign({parsed:()=>null}),h=p.withFallbacks({fallbacks:[m]});return El.from([{raw:d},h]).withConfig({runName:"StructuredOutputRunnable"})}},PQn=class extends hh{async _generate(t,e,r){let n=await this._call(t,e,r),o=new li(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 Hsr(t,e=0){return(hg[t[e+0]]+hg[t[e+1]]+hg[t[e+2]]+hg[t[e+3]]+"-"+hg[t[e+4]]+hg[t[e+5]]+"-"+hg[t[e+6]]+hg[t[e+7]]+"-"+hg[t[e+8]]+hg[t[e+9]]+"-"+hg[t[e+10]]+hg[t[e+11]]+hg[t[e+12]]+hg[t[e+13]]+hg[t[e+14]]+hg[t[e+15]]).toLowerCase()}var hg,q0e,Vsr=v(()=>{hg=[];for(q0e=0;q0e<256;++q0e)hg.push((q0e+256).toString(16).slice(1))});function LYe(){if(!B0e&&(B0e=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!B0e))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return B0e(MQn)}var B0e,MQn,Jsr=v(()=>{MQn=new Uint8Array(16)});var RQn,FYe,Ksr=v(()=>{RQn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),FYe={randomUUID:RQn}});function AQn(t,e,r){if(FYe.randomUUID&&!e&&!t)return FYe.randomUUID();t=t||{};var n=t.random||(t.rng||LYe)();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 Hsr(n)}var kYe,Wsr=v(()=>{Ksr();Jsr();Vsr();kYe=AQn});var Gsr=v(()=>{Wsr()});var NQn,Gv=v(()=>{Do();yN();NQn={};Et(NQn,{extendInteropZodObject:()=>SPt,getInteropZodDefaultGetter:()=>xPt,getInteropZodObjectShape:()=>Hme,getSchemaDescription:()=>lL,interopParse:()=>_Pt,interopParseAsync:()=>uL,interopSafeParse:()=>bPt,interopSafeParseAsync:()=>sL,interopZodObjectMakeFieldsOptional:()=>OPt,interopZodObjectPartial:()=>CPt,interopZodObjectPassthrough:()=>Vme,interopZodObjectStrict:()=>m6,interopZodTransformInputSchema:()=>aL,isInteropZodLiteral:()=>yPt,isInteropZodObject:()=>wPt,isInteropZodSchema:()=>Ga,isShapelessZodSchema:()=>vPt,isSimpleStringZodSchema:()=>h6,isZodArrayV4:()=>PQ,isZodLiteralV3:()=>f4e,isZodLiteralV4:()=>p4e,isZodObjectV3:()=>Jme,isZodObjectV4:()=>qw,isZodSchema:()=>gPt,isZodSchemaV3:()=>ec,isZodSchemaV4:()=>il})});function Zsr(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 U0e(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=>Us(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 jQn(t){return"name"in t&&"description"in t&&"parameterDefinitions"in t}function Xsr(t){return t._getType()==="tool"}function Ysr(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 DQn(t){if(t){if(t.every(jQn))return t;if(t.every(Kv))return t.map(e=>({name:e.function.name,description:e.function.description??"",parameterDefinitions:Ysr(e.function.parameters)}));if(t.every(mg))return t.map(e=>{let r=Ga(e.schema)?Vi(e.schema):e.schema;return{name:e.name,description:e.description??"",parameterDefinitions:Ysr(r)}});throw new Error("Can not pass in a mix of tool schema types to ChatCohere.")}else return}var qYe,Qsr=v(()=>{ooe();$s();Wv();j1();D1();ym();Gsr();Gv();o_();qYe=class extends hh{constructor(e){super(e??{});M(this,"lc_serializable",!0);M(this,"client");M(this,"model","command-r-plus");M(this,"temperature",.3);M(this,"streaming",!1);M(this,"streamUsage",!0);this.client=NW(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:DQn(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(!(Us(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=U0e(c,s);i.push(d),s=[]}}else i.push(U0e(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=U0e(c,s);i.push(d),s=[]}}else i.push(U0e(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(Xsr(o)){let i=o,a=n.filter(s=>Us(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:Zsr(i.content)})))}}return r}_messageToCohereToolResults(e,r){let n=[],o=e[r];if(!Xsr(o))throw new Error("The message index does not correspond to an instance of ToolMessage");let a=e.slice(0,r).filter(s=>Us(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:Zsr(o.content)}))),n}_formatCohereToolCalls(e=null){if(!e)return[];let r=[];for(let n of e)r.push({id:kYe().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 li({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 Hi({text:a.text,message:new Ur({content:a.text})}),await n?.handleLLMNewToken(a.text);else if(a.eventType!=="stream-end")yield new Hi({text:"",message:new Ur({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 Hi({text:"",message:new Ur({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 $Qn,BYe,z0e,loe=v(()=>{Do();EY();X$();cO();ym();Wv();$Qn={};Et($Qn,{BaseLLM:()=>BYe,LLM:()=>z0e});BYe=class uoe extends E2{constructor(){super(...arguments);M(this,"lc_namespace",["langchain","llms",this._llmType()])}async invoke(r,n){let o=uoe._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===uoe.prototype._streamResponseChunks)yield this.invoke(r,n);else{let o=uoe._convertInputToPromptValue(r),[i,a]=this._separateRunnableConfigFromCallOptionsCompat(n),s=await Yl.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 Yl.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(TY),u;if(s&&r.length===1&&this._streamResponseChunks!==uoe.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,dN,{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 Yl.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(g,y)=>{let b=await n.lookup(g,o);return b==null&&d.push(y),b}))).map((g,y)=>({result:g,runManager:c?.[y]})).filter(({result:g})=>g.status==="fulfilled"&&g.value!=null||g.status==="rejected"),m=[];await Promise.all(p.map(async({result:g,runManager:y},b)=>{if(g.status==="fulfilled"){let _=g.value;return m[b]=_.map(w=>(w.generationInfo={...w.generationInfo,tokenUsage:{}},w)),_.length&&await y?.handleLLMNewToken(_[0].text),y?.handleLLMEnd({generations:[_]},void 0,void 0,void 0,{cached:!0})}else return await y?.handleLLMError(g.reason,void 0,void 0,void 0,{cached:!0}),Promise.reject(g.reason)}));let h={generations:m,missingPromptIndices:d,startedRunManagers:c};return Object.defineProperty(h,dN,{value:c?{runIds:c?.map(g=>g.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,g)=>{let y=d[g];return c[y]=h,u.update(r[y],l,h)})),p=m.llmOutput??{}}return{generations:c,llmOutput:p}}_identifyingParams(){return{}}_modelType(){return"base_llm"}},z0e=class extends BYe{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 eur=v(()=>{ooe();loe()});var LQn,ES,M2=v(()=>{Do();iz();LQn={};Et(LQn,{Embeddings:()=>ES});ES=class{constructor(t){M(this,"caller");this.caller=new Fw(t??{})}}});var FQn,PS,tk=v(()=>{Do();FQn={};Et(FQn,{chunkArray:()=>PS});PS=(t,e)=>t.reduce((r,n,o)=>{let i=Math.floor(o/e),a=r[i]||[];return r[i]=a.concat([n]),r},[])});var UYe,tur=v(()=>{ooe();M2();tk();UYe=class extends ES{constructor(e){let r={maxConcurrency:2,...e};super(r);M(this,"model");M(this,"batchSize",48);M(this,"embeddingTypes",["float"]);M(this,"client");if(this.client=NW(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=PS(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 kQn,rur,nur=v(()=>{Do();kQn={};Et(kQn,{BaseDocumentCompressor:()=>rur});rur=class{static isBaseDocumentCompressor(t){return t?.compressDocuments!==void 0}}});var our=v(()=>{ooe();nur()});var zYe=v(()=>{Qsr();eur();tur();our()});function $1(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($1):typeof e[r]=="object"&&e[r]!==null&&(e[r]=$1(e[r])));return e}return t}function coe(t){let e=$1(Ga(t)?Vi(t):t),{$schema:r,...n}=e;return n}function iur(t){let e=$1(t),{$schema:r,...n}=e;return n}var H0e=v(()=>{Gv();o_()});function aur(t,e=0){return(gg[t[e+0]]+gg[t[e+1]]+gg[t[e+2]]+gg[t[e+3]]+"-"+gg[t[e+4]]+gg[t[e+5]]+"-"+gg[t[e+6]]+gg[t[e+7]]+"-"+gg[t[e+8]]+gg[t[e+9]]+"-"+gg[t[e+10]]+gg[t[e+11]]+gg[t[e+12]]+gg[t[e+13]]+gg[t[e+14]]+gg[t[e+15]]).toLowerCase()}var gg,sur=v(()=>{gg=[];for(let t=0;t<256;++t)gg.push((t+256).toString(16).slice(1))});function VYe(){if(!HYe){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");HYe=crypto.getRandomValues.bind(crypto)}return HYe(qQn)}var HYe,qQn,uur=v(()=>{qQn=new Uint8Array(16)});var BQn,JYe,lur=v(()=>{BQn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),JYe={randomUUID:BQn}});function UQn(t,e,r){if(JYe.randomUUID&&!e&&!t)return JYe.randomUUID();t=t||{};let n=t.random??t.rng?.()??VYe();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 aur(n)}var V0e,cur=v(()=>{lur();uur();sur();V0e=UQn});var dur=v(()=>{cur()});function zQn(t){let e=t._getType();return cd.isInstance(t)?t.role:e==="tool"?e:t.name??e}function HQn(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 VQn(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 JQn(t,e){return e.map(r=>Us(r)?r.tool_calls??[]:[]).flat().find(r=>r.id===t.tool_call_id)?.name}function KQn(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=Hg({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=Hg({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=Hg({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 fur(t,e){if(Zm(t))return oO(t,KQn(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 VQn(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 WQn(t,e,r){if(vY(t)){let i=t.name??JQn(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=>fur(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=>fur(i,e)).filter(i=>i!==void 0)),Us(t)&&t.tool_calls?.length&&(n=t.tool_calls.map(i=>({functionCall:{name:i.name,args:i.args}}))),[...o,...n]}function KYe(t,e,r=!1){return t.reduce((n,o,i)=>{if(!Xm(o))throw new Error("Unsupported message input");let a=zQn(o);if(a==="system"&&i!==0)throw new Error("System message should be the first one");let s=HQn(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=WQn(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 pur(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 li({content:a??"",tool_calls:r?.map(l=>({...l,type:"tool_call",id:"id"in l&&typeof l.id=="string"?l.id:V0e()})),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 mur(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:V0e()}))),new Hi({text:s,message:new Ur({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 hur(t){return t.every(e=>"functionDeclarations"in e&&Array.isArray(e.functionDeclarations))?t:[{functionDeclarations:t.map(e=>{if(mg(e)){let r=coe(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 Kv(e)?{name:e.function.name,description:e.function.description??"A function available to call.",parameters:iur(e.function.parameters)}:e})}]}var WYe=v(()=>{H0e();$s();ym();j1();Wv();dur()});var GYe,gur=v(()=>{Gv();_O();GYe=class extends Az{constructor(e){super(e);M(this,"lc_namespace",["langchain","google_genai","output_parsers"]);M(this,"returnId",!1);M(this,"keyName");M(this,"returnSingle",!1);M(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 sL(this.zodSchema,e);if(r.success)return r.data;throw new eh(`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 QQn(t){let e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${YQn}/${XQn}`),e.join(" ")}async function eeo(t){var e;let r=new Headers;r.append("Content-Type","application/json"),r.append("x-goog-api-client",QQn(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 uA(`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 uA(`Cannot set reserved header name ${o}`);if(o==="x-goog-api-client")throw new uA(`Header name ${o} can only be set using the apiClient field`);r.append(o,i)}}return r}async function teo(t,e,r,n,o,i){let a=new ZYe(t,e,r,n,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},ieo(i)),{method:"POST",headers:await eeo(a),body:o})}}async function moe(t,e,r,n,o,i={},a=fetch){let{url:s,fetchOptions:u}=await teo(t,e,r,n,o,i);return reo(s,u,a)}async function reo(t,e,r=fetch){let n;try{n=await r(t,e)}catch(o){neo(o,t)}return n.ok||await oeo(n,t),n}function neo(t,e){let r=t;throw r.name==="AbortError"?(r=new W0e(`Request aborted when fetching ${e.toString()}: ${t.message}`),r.stack=t.stack):t instanceof K0e||t instanceof uA||(r=new gh(`Error fetching from ${e.toString()}: ${t.message}`),r.stack=t.stack),r}async function oeo(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 K0e(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${r}`,t.status,t.statusText,n)}function ieo(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 YYe(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.`),J0e(t.candidates[0]))throw new rk(`${nk(t)}`,t);return aeo(t)}else if(t.promptFeedback)throw new rk(`Text not available. ${nk(t)}`,t);return""},t.functionCall=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),J0e(t.candidates[0]))throw new rk(`${nk(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),Eur(t)[0]}else if(t.promptFeedback)throw new rk(`Function call not available. ${nk(t)}`,t)},t.functionCalls=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),J0e(t.candidates[0]))throw new rk(`${nk(t)}`,t);return Eur(t)}else if(t.promptFeedback)throw new rk(`Function call not available. ${nk(t)}`,t)},t}function aeo(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 Eur(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 J0e(t){return!!t.finishReason&&seo.includes(t.finishReason)}function nk(t){var e,r,n;let o="";if((!t.candidates||t.candidates.length===0)&&t.promptFeedback)o+="Response was blocked",!((e=t.promptFeedback)===null||e===void 0)&&e.blockReason&&(o+=` due to ${t.promptFeedback.blockReason}`),!((r=t.promptFeedback)===null||r===void 0)&&r.blockReasonMessage&&(o+=`: ${t.promptFeedback.blockReasonMessage}`);else if(!((n=t.candidates)===null||n===void 0)&&n[0]){let i=t.candidates[0];J0e(i)&&(o+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(o+=`: ${i.finishMessage}`))}return o}function foe(t){return this instanceof foe?(this.v=t,this):new foe(t)}function ueo(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 foe?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 leo(t){let e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),r=feo(e),[n,o]=r.tee();return{stream:deo(n),response:ceo(o)}}async function ceo(t){let e=[],r=t.getReader();for(;;){let{done:n,value:o}=await r.read();if(n)return YYe(peo(e));e.push(o)}}function deo(t){return ueo(this,arguments,function*(){let r=t.getReader();for(;;){let{value:n,done:o}=yield foe(r.read());if(o)break;yield yield foe(YYe(n))}})}function feo(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(Pur),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(Pur)}return i()}).catch(a=>{let s=a;throw s.stack=a.stack,s.name==="AbortError"?s=new W0e("Request aborted when reading from the stream"):s=new gh("Error reading from the stream"),s})}}})}function peo(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 Nur(t,e,r,n){let o=await moe(e,A2.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(r),n);return leo(o)}async function jur(t,e,r,n){let i=await(await moe(e,A2.GENERATE_CONTENT,t,!1,JSON.stringify(r),n)).json();return{response:YYe(i)}}function Dur(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 poe(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 meo(e)}function meo(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 heo(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 uA("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=poe(t);n.contents=[i]}return{generateContentRequest:n}}function Mur(t){let e;return t.contents?e=t:e={contents:[poe(t)]},t.systemInstruction&&(e.systemInstruction=Dur(t.systemInstruction)),e}function geo(t){return typeof t=="string"||Array.isArray(t)?{content:poe(t)}:t}function beo(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(!vur.includes(n))throw new gh(`Each item should include role field. Got ${n} but valid roles are: ${JSON.stringify(vur)}`);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 Rur)u in s&&(i[u]+=1);let a=yeo[n];for(let s of Rur)if(!a.includes(s)&&i[s]>0)throw new gh(`Content with role '${n}' can't contain '${s}' part`);e=!0}}function Aur(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 _eo(t,e,r,n){return(await moe(e,A2.COUNT_TOKENS,t,!1,JSON.stringify(r),n)).json()}async function veo(t,e,r,n){return(await moe(e,A2.EMBED_CONTENT,t,!1,JSON.stringify(r),n)).json()}async function weo(t,e,r,n){let o=r.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await moe(e,A2.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:o}),n)).json()}var yur,bur,_ur,vur,wur,Sur,Cur,xur,doe,Our,R2,Tur,gh,rk,K0e,uA,W0e,GQn,ZQn,XQn,YQn,A2,ZYe,seo,Pur,Rur,yeo,Iur,XYe,G0e,I2,Z0e=v(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(yur||(yur={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(bur||(bur={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(_ur||(_ur={}));vur=["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"})(wur||(wur={}));(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"})(Sur||(Sur={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(Cur||(Cur={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(xur||(xur={}));(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"})(doe||(doe={}));(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"})(Our||(Our={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(R2||(R2={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(Tur||(Tur={}));gh=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},rk=class extends gh{constructor(e,r){super(e),this.response=r}},K0e=class extends gh{constructor(e,r,n,o){super(e),this.status=r,this.statusText=n,this.errorDetails=o}},uA=class extends gh{},W0e=class extends gh{};GQn="https://generativelanguage.googleapis.com",ZQn="v1beta",XQn="0.24.1",YQn="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"})(A2||(A2={}));ZYe=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)||ZQn,i=`${((r=this.requestOptions)===null||r===void 0?void 0:r.baseUrl)||GQn}/${n}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}};seo=[doe.RECITATION,doe.SAFETY,doe.LANGUAGE];Pur=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;Rur=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],yeo={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};Iur="SILENT_ERROR",XYe=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&&(beo(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=poe(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(()=>jur(this._apiKey,this.model,c,d)).then(p=>{var m;if(Aur(p.response)){this._history.push(l);let h=Object.assign({parts:[],role:"model"},(m=p.response.candidates)===null||m===void 0?void 0:m[0].content);this._history.push(h)}else{let h=nk(p.response);h&&console.warn(`sendMessage() was unsuccessful. ${h}. Inspect response object for details.`)}f=p}).catch(p=>{throw this._sendPromise=Promise.resolve(),p}),await this._sendPromise,f}async sendMessageStream(e,r={}){var n,o,i,a,s,u;await this._sendPromise;let l=poe(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=Nur(this._apiKey,this.model,c,d);return this._sendPromise=this._sendPromise.then(()=>f).catch(p=>{throw new Error(Iur)}).then(p=>p.response).then(p=>{if(Aur(p)){this._history.push(l);let m=Object.assign({},p.candidates[0].content);m.role||(m.role="model"),this._history.push(m)}else{let m=nk(p);m&&console.warn(`sendMessageStream() was unsuccessful. ${m}. Inspect response object for details.`)}}).catch(p=>{p.message!==Iur&&console.error(p)}),f}};G0e=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=Dur(r.systemInstruction),this.cachedContent=r.cachedContent}async generateContent(e,r={}){var n;let o=Mur(e),i=Object.assign(Object.assign({},this._requestOptions),r);return jur(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=Mur(e),i=Object.assign(Object.assign({},this._requestOptions),r);return Nur(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 XYe(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=heo(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 _eo(this.apiKey,this.model,n,o)}async embedContent(e,r={}){let n=geo(e),o=Object.assign(Object.assign({},this._requestOptions),r);return veo(this.apiKey,this.model,n,o)}async batchEmbedContents(e,r={}){let n=Object.assign(Object.assign({},this._requestOptions),r);return weo(this.apiKey,this.model,e,n)}};I2=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 G0e(this.apiKey,e,r)}getGenerativeModelFromCachedContent(e,r,n){if(!e.name)throw new uA("Cached content must contain a `name` field.");if(!e.model)throw new uA("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 uA(`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 G0e(this.apiKey,i,n)}}});function QYe(t,e){let r=Seo(t),n=xeo(r,e);return{tools:r,toolConfig:n}}function Seo(t){let e=[],r=[];return t.forEach(o=>{if(mg(o)){let[i]=hur([o]);i.functionDeclarations&&e.push(...i.functionDeclarations)}else if(Kv(o)){let{functionDeclarations:i}=Ceo(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 Ceo(t){return{functionDeclarations:[{name:t.function.name,description:t.function.description,parameters:$1(t.function.parameters)}]}}function xeo(t,e){if(!t.length||!e)return;let{toolChoice:r,allowedFunctionNames:n}=e,o={any:R2.ANY,auto:R2.AUTO,none:R2.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:R2.ANY,allowedFunctionNames:[...n??[],...r&&typeof r=="string"?[r]:[]]}}}var $ur=v(()=>{H0e();WYe();Z0e();j1();Wv()});var eQe,Lur=v(()=>{H0e();WYe();gur();$ur();Z0e();nl();D1();xv();Gv();_O();eQe=class extends hh{constructor(e){super(e);M(this,"lc_serializable",!0);M(this,"lc_namespace",["langchain","chat_models","google_genai"]);M(this,"model");M(this,"temperature");M(this,"maxOutputTokens");M(this,"topP");M(this,"topK");M(this,"stopSequences",[]);M(this,"safetySettings");M(this,"apiKey");M(this,"streaming",!1);M(this,"json");M(this,"streamUsage",!0);M(this,"convertSystemMessageToHumanContent");M(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??gn("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 I2(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 I2(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:QYe(e)?.tools,...r})}invocationParams(e){let r=e?.tools?.length?QYe(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=KYe(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=pur(s.response,{usageMetadata:u});return l.generations?.length>0&&await n?.handleLLMNewToken(l.generations[0]?.text??""),l}async*_streamResponseChunks(e,r,n){let o=KYe(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 g=m.usageMetadata.promptTokenCount??0;l.input_tokens=Math.max(0,g-c),c=g;let y=m.usageMetadata.candidatesTokenCount??0;l.output_tokens=Math.max(0,y-d),d=y;let b=m.usageMetadata.totalTokenCount??0;l.total_tokens=Math.max(0,b-f),f=b}let h=mur(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(Ga(n)){let m=coe(n);p=[{functionDeclarations:[{name:f,description:m.description??"A function available to call.",parameters:m}]}],u=new GYe({returnSingle:!0,keyName:f,zodSchema:n})}else{let m;typeof n.name=="string"&&typeof n.parameters=="object"&&n.parameters!=null?(m=n,m.parameters=$1(n.parameters),f=n.name):m={name:f,description:n.description??"",parameters:$1(n)},p=[{functionDeclarations:[m]}],u=new GYe({returnSingle:!0,keyName:f})}s=this.bindTools(p).withConfig({allowedFunctionNames:[f]})}else{let f=coe(n);s=this.withConfig({responseSchema:f}),u=new Ov}if(!a)return s.pipe(u).withConfig({runName:"ChatGoogleGenerativeAIStructuredOutput"});let l=xu.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=xu.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return El.from([{raw:s},d]).withConfig({runName:"StructuredOutputRunnable"})}}});var tQe,Fur=v(()=>{Z0e();nl();M2();tk();tQe=class extends ES{constructor(e){super(e??{});M(this,"apiKey");M(this,"modelName","embedding-001");M(this,"model","embedding-001");M(this,"taskType");M(this,"title");M(this,"stripNewLines",!0);M(this,"maxBatchSize",100);M(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??gn("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 I2(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=PS(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 rQe=v(()=>{Lur();Fur()});function kur(t,e=0){return(yg[t[e+0]]+yg[t[e+1]]+yg[t[e+2]]+yg[t[e+3]]+"-"+yg[t[e+4]]+yg[t[e+5]]+"-"+yg[t[e+6]]+yg[t[e+7]]+"-"+yg[t[e+8]]+yg[t[e+9]]+"-"+yg[t[e+10]]+yg[t[e+11]]+yg[t[e+12]]+yg[t[e+13]]+yg[t[e+14]]+yg[t[e+15]]).toLowerCase()}var yg,X0e,qur=v(()=>{yg=[];for(X0e=0;X0e<256;++X0e)yg.push((X0e+256).toString(16).slice(1))});function nQe(){if(!Y0e&&(Y0e=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Y0e))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Y0e(Oeo)}var Y0e,Oeo,Bur=v(()=>{Oeo=new Uint8Array(16)});var Teo,oQe,Uur=v(()=>{Teo=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),oQe={randomUUID:Teo}});function Eeo(t,e,r){if(oQe.randomUUID&&!e&&!t)return oQe.randomUUID();t=t||{};var n=t.random||(t.rng||nQe)();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 kur(n)}var iQe,zur=v(()=>{Uur();Bur();qur();iQe=Eeo});var Hur=v(()=>{zur()});function Jur(t,e){return new Ur({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:iQe()})),response_metadata:e?.responseMetadata,usage_metadata:e?.usageMetadata})}function Vur(t){let e=t.match(/^data:.*?;base64,(.*)$/);return e?e[1]:""}function Peo(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 Meo(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:[Vur(e.image_url)]};if(e.image_url.url&&typeof e.image_url.url=="string")return{role:"user",content:"",images:[Vur(e.image_url.url)]}}throw new Error(`Unsupported content type: ${e.type}`)})}function Reo(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 Aeo(t){if(typeof t.content!="string")throw new Error("Non string tool message content is not supported");return[{role:"tool",content:t.content}]}function Kur(t){return t.flatMap(e=>{if(["human","generic"].includes(e._getType()))return Meo(e);if(e._getType()==="ai")return Peo(e);if(e._getType()==="system")return Reo(e);if(e._getType()==="tool")return Aeo(e);throw new Error(`Unsupported message type: ${e._getType()}`)})}var Wur=v(()=>{$s();Hur()});function Ieo(t){return t&&DataView.prototype.isPrototypeOf(t)}function DW(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 sQe(t){return typeof t!="string"&&(t=String(t)),t}function uQe(t){var e={next:function(){var r=t.shift();return{done:r===void 0,value:r}}};return yb.iterable&&(e[Symbol.iterator]=function(){return e}),e}function Mm(t){this.map={},t instanceof Mm?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 aQe(t){if(!t._noBody){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}}function Yur(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function Neo(t){var e=new FileReader,r=Yur(e);return e.readAsArrayBuffer(t),r}function jeo(t){var e=new FileReader,r=Yur(e),n=/charset=([A-Za-z0-9_-]+)/.exec(t.type),o=n?n[1]:"utf-8";return e.readAsText(t,o),r}function Deo(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 Zur(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function Qur(){return this.bodyUsed=!1,this._initBody=function(t){this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:yb.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:yb.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:yb.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():yb.arrayBuffer&&yb.blob&&Ieo(t)?(this._bodyArrayBuffer=Zur(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):yb.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||Xur(t))?this._bodyArrayBuffer=Zur(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):yb.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},yb.blob&&(this.blob=function(){var t=aQe(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=aQe(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(yb.blob)return this.blob().then(Neo);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var t=aQe(this);if(t)return t;if(this._bodyBlob)return jeo(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Deo(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},yb.formData&&(this.formData=function(){return this.text().then(Feo)}),this.json=function(){return this.text().then(JSON.parse)},this}function Leo(t){var e=t.toUpperCase();return $eo.indexOf(e)>-1?e:t}function j2(t,e){if(!(this instanceof j2))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 j2){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new Mm(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 Mm(e.headers)),this.method=Leo(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in bg){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 Feo(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 keo(t){var e=new Mm,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 lA(t,e){if(!(this instanceof lA))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 Mm(e.headers),this.url=e.url||"",this._initBody(t)}function elr(t,e){return new Promise(function(r,n){var o=new j2(t,e);if(o.signal&&o.signal.aborted)return n(new N2("Aborted","AbortError"));var i=new XMLHttpRequest;function a(){i.abort()}i.onload=function(){var l={statusText:i.statusText,headers:keo(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 lA(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 N2("Aborted","AbortError"))},0)};function s(l){try{return l===""&&bg.location.href?bg.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&&(yb.blob?i.responseType="blob":yb.arrayBuffer&&(i.responseType="arraybuffer")),e&&typeof e.headers=="object"&&!(e.headers instanceof Mm||bg.Headers&&e.headers instanceof bg.Headers)){var u=[];Object.getOwnPropertyNames(e.headers).forEach(function(l){u.push(DW(l)),i.setRequestHeader(l,sQe(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 bg,yb,Gur,Xur,$eo,qeo,N2,tlr=v(()=>{bg=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof window<"u"&&window||{},yb={searchParams:"URLSearchParams"in bg,iterable:"Symbol"in bg&&"iterator"in Symbol,blob:"FileReader"in bg&&"Blob"in bg&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in bg,arrayBuffer:"ArrayBuffer"in bg};yb.arrayBuffer&&(Gur=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Xur=ArrayBuffer.isView||function(t){return t&&Gur.indexOf(Object.prototype.toString.call(t))>-1});Mm.prototype.append=function(t,e){t=DW(t),e=sQe(e);var r=this.map[t];this.map[t]=r?r+", "+e:e};Mm.prototype.delete=function(t){delete this.map[DW(t)]};Mm.prototype.get=function(t){return t=DW(t),this.has(t)?this.map[t]:null};Mm.prototype.has=function(t){return this.map.hasOwnProperty(DW(t))};Mm.prototype.set=function(t,e){this.map[DW(t)]=sQe(e)};Mm.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)};Mm.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),uQe(t)};Mm.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),uQe(t)};Mm.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),uQe(t)};yb.iterable&&(Mm.prototype[Symbol.iterator]=Mm.prototype.entries);$eo=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];j2.prototype.clone=function(){return new j2(this,{body:this._bodyInit})};Qur.call(j2.prototype);Qur.call(lA.prototype);lA.prototype.clone=function(){return new lA(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Mm(this.headers),url:this.url})};lA.error=function(){var t=new lA(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};qeo=[301,302,303,307,308];lA.redirect=function(t,e){if(qeo.indexOf(e)===-1)throw new RangeError("Invalid status code");return new lA(null,{status:e,headers:{location:t}})};N2=bg.DOMException;try{new N2}catch{N2=function(e,r){this.message=e,this.name=r;var n=Error(e);this.stack=n.stack},N2.prototype=Object.create(Error.prototype),N2.prototype.constructor=N2}elr.polyfill=!0;bg.fetch||(bg.fetch=elr,bg.Headers=Mm,bg.Request=j2,bg.Response=lA)});function Heo(){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 Veo(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 nlr,olr,Beo,Ueo,zeo,lQe,dQe,fQe,pQe,mQe,rlr,$W,Jeo,Keo,Weo,Geo,Zeo,cQe,LW,pwa,Q0e=v(()=>{tlr();nlr="11434",olr=`http://127.0.0.1:${nlr}`,Beo="0.5.18",Ueo=Object.defineProperty,zeo=(t,e,r)=>e in t?Ueo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lQe=(t,e,r)=>(zeo(t,typeof e!="symbol"?e+"":e,r),r),dQe=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)}},fQe=class{constructor(e,r,n){lQe(this,"abortController"),lQe(this,"itr"),lQe(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.")}},pQe=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 dQe(e,t.status)};mQe=async(t,e,r={})=>{let n={"Content-Type":"application/json",Accept:"application/json","User-Agent":`ollama-js/${Beo} (${Heo()})`};r.headers=Veo(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)},rlr=async(t,e,r)=>{let n=await mQe(t,e,{headers:r?.headers});return await pQe(n),n},$W=async(t,e,r,n)=>{let i=(s=>s!==null&&typeof s=="object"&&!Array.isArray(s))(r)?JSON.stringify(r):r,a=await mQe(t,e,{method:"POST",body:i,signal:n?.signal,headers:n?.headers});return await pQe(a),a},Jeo=async(t,e,r,n)=>{let o=await mQe(t,e,{method:"DELETE",body:JSON.stringify(r),headers:n?.headers});return await pQe(o),o},Keo=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)}},Weo=t=>{if(!t)return olr;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=nlr);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},Geo=Object.defineProperty,Zeo=(t,e,r)=>e in t?Geo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cQe=(t,e,r)=>(Zeo(t,typeof e!="symbol"?e+"":e,r),r),LW=class{constructor(e){cQe(this,"config"),cQe(this,"fetch"),cQe(this,"ongoingStreamedRequests",[]),this.config={host:"",headers:e?.headers},e?.proxy||(this.config.host=Weo(e?.host??olr)),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 $W(this.fetch,n,r,{signal:i.signal,headers:this.config.headers});if(!a.body)throw new Error("Missing body");let s=Keo(a.body),u=new fQe(i,s,()=>{let l=this.ongoingStreamedRequests.indexOf(u);l>-1&&this.ongoingStreamedRequests.splice(l,1)});return this.ongoingStreamedRequests.push(u),u}return await(await $W(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 Jeo(this.fetch,`${this.config.host}/api/delete`,{name:e.model},{headers:this.config.headers}),{status:"success"}}async copy(e){return await $W(this.fetch,`${this.config.host}/api/copy`,{...e},{headers:this.config.headers}),{status:"success"}}async list(){return await(await rlr(this.fetch,`${this.config.host}/api/tags`,{headers:this.config.headers})).json()}async show(e){return await(await $W(this.fetch,`${this.config.host}/api/show`,{...e},{headers:this.config.headers})).json()}async embed(e){return await(await $W(this.fetch,`${this.config.host}/api/embed`,{...e},{headers:this.config.headers})).json()}async embeddings(e){return await(await $W(this.fetch,`${this.config.host}/api/embeddings`,{...e},{headers:this.config.headers})).json()}async ps(){return await(await rlr(this.fetch,`${this.config.host}/api/ps`,{headers:this.config.headers})).json()}},pwa=new LW});var hQe,ilr=v(()=>{Wur();$s();D1();Q0e();ym();xv();j1();cO();_O();Gv();o_();hQe=class extends hh{constructor(e){super(e??{});M(this,"model","llama3");M(this,"numa");M(this,"numCtx");M(this,"numBatch");M(this,"numGpu");M(this,"mainGpu");M(this,"lowVram");M(this,"f16Kv");M(this,"logitsAll");M(this,"vocabOnly");M(this,"useMmap");M(this,"useMlock");M(this,"embeddingOnly");M(this,"numThread");M(this,"numKeep");M(this,"seed");M(this,"numPredict");M(this,"topK");M(this,"topP");M(this,"tfsZ");M(this,"typicalP");M(this,"repeatLastN");M(this,"temperature");M(this,"repeatPenalty");M(this,"presencePenalty");M(this,"frequencyPenalty");M(this,"mirostat");M(this,"mirostatTau");M(this,"mirostatEta");M(this,"penalizeNewline");M(this,"streaming");M(this,"format");M(this,"keepAlive");M(this,"client");M(this,"checkOrPullModel",!1);M(this,"baseUrl","http://127.0.0.1:11434");M(this,"think");this.client=new LW({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=>N1(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=>N1(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 li({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=Kur(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 Hi({text:f,message:Jur(c)}),await n?.handleLLMNewToken(f)}yield new Hi({text:"",message:new Ur({content:"",response_metadata:u,usage_metadata:a})})}withStructuredOutput(e,r){if(r?.method===void 0||r?.method==="jsonSchema"){let n=Ga(e),o=n?Vi(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:Vi(e)}}),a=n?Jw.fromZodSchema(e):new Ov;if(!r?.includeRaw)return i.pipe(a);let s=xu.assign({parsed:(c,d)=>a.invoke(c.raw,d)}),u=xu.assign({parsed:()=>null}),l=s.withFallbacks({fallbacks:[u]});return El.from([{raw:i},l])}else return super.withStructuredOutput(e,r)}}});var gQe,alr=v(()=>{Q0e();M2();gQe=class extends ES{constructor(e){super({maxConcurrency:1,...e});M(this,"model","mxbai-embed-large");M(this,"baseUrl","http://localhost:11434");M(this,"keepAlive");M(this,"requestOptions");M(this,"client");M(this,"truncate",!1);this.client=new LW({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 slr=v(()=>{Q0e();ym();loe()});var yQe=v(()=>{ilr();alr();slr()});function cA(t){return t?!!(/^o\d/.test(t??"")||t.startsWith("gpt-5")&&!t.startsWith("gpt-5-chat")):!1}function Xeo(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 dA(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(!cd.isInstance(t))throw new Error("Invalid generic chat message");return Xeo(t);default:throw new Error(`Unknown message type: ${e}`)}}var MC,ok=v(()=>{$s();MC=t=>t()});function fA(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 bQe(t){return typeof Headers<"u"&&t!==null&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Headers]"}function hoe(t){let e=MC(()=>{if(bQe(t))return t;if(Array.isArray(t))return new Headers(t);if(typeof t=="object"&&t!==null&&"values"in t&&bQe(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())}var ik=v(()=>{ok()});function ulr(t,e){let r;return mg(t)?r=N1(t):r=t,e?.strict!==void 0&&(r.function.strict=e.strict),r}function Yeo(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function llr(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(clr(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
|
||
`)}function clr(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}: ${eCe(o,e)},`):r.push(`${n}?: ${eCe(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
|
||
`)}function eCe(t,e){if(Yeo(t))return t.anyOf.map(r=>eCe(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["{",clr(t,e+2),"}"].join(`
|
||
`);case"array":return t.items?`${eCe(t.items,e)}[]`:"any[]";default:return""}}function tCe(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 FW(t){return"type"in t&&t.type!=="function"}function dlr(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function D2(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 rCe(t){return"type"in t&&t.type==="custom"&&"custom"in t&&typeof t.custom=="object"&&t.custom!==null}function flr(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 plr(t){return t.type==="tool_call"&&"isCustomTool"in t&&t.isCustomTool===!0}function mlr(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 hlr(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 goe=v(()=>{Gv();o_();j1()});function yoe(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var boe,nCe=v(()=>{boe=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)}});var kt,Rm,Ic,ak,pA,kW,qW,BW,UW,zW,HW,VW,JW,KW,WW,mA,hA=v(()=>{nCe();kt=class extends Error{},Rm=class t extends kt{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let i=r;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new ak({message:n,cause:boe(r)});let i=r?.error;return e===400?new kW(e,i,n,o):e===401?new qW(e,i,n,o):e===403?new BW(e,i,n,o):e===404?new UW(e,i,n,o):e===409?new zW(e,i,n,o):e===422?new HW(e,i,n,o):e===429?new VW(e,i,n,o):e>=500?new JW(e,i,n,o):new t(e,i,n,o)}},Ic=class extends Rm{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},ak=class extends Rm{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},pA=class extends ak{constructor({message:e}={}){super({message:e??"Request timed out."})}},kW=class extends Rm{},qW=class extends Rm{},BW=class extends Rm{},UW=class extends Rm{},zW=class extends Rm{},HW=class extends Rm{},VW=class extends Rm{},JW=class extends Rm{},KW=class extends kt{constructor(){super("Could not parse response content as the length limit was reached")}},WW=class extends kt{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},mA=class extends Error{constructor(e){super(e)}}});var RC=v(()=>{hA()});function _oe(t){return t!==void 0&&"function"in t&&t.function!==void 0}function glr(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function voe(t){return t?.$brand==="auto-parseable-response-format"}function $2(t){return t?.$brand==="auto-parseable-tool"}function ylr(t,e){return!e||!_Qe(e)?{...t,choices:t.choices.map(r=>(_lr(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:woe(t,e)}function woe(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new KW;if(n.finish_reason==="content_filter")throw new WW;return _lr(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>rto(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?tto(e,n.message.content):null}}});return{...t,choices:r}}function tto(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 rto(t,e){let r=t.tools?.find(n=>_oe(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:$2(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function blr(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>_oe(n)&&n.function?.name===e.function.name);return _oe(r)&&($2(r)||r?.function.strict||!1)}function _Qe(t){return voe(t.response_format)?!0:t.tools?.some(e=>$2(e)||e.type==="function"&&e.function.strict===!0)??!1}function _lr(t){for(let e of t||[])if(e.type!=="function")throw new kt(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function vlr(t){for(let e of t??[]){if(e.type!=="function")throw new kt(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new kt(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var GW=v(()=>{RC()});var Slr,wlr,Clr,oCe=v(()=>{Slr=Symbol("Let zodToJsonSchema decide on which parser to use"),wlr={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"},Clr=t=>typeof t=="string"?{...wlr,basePath:["#"],definitions:{},name:t}:{...wlr,basePath:["#"],definitions:{},...t}});function xlr(t){if(!t)return!0;for(let e in t)return!1;return!0}var Soe,vQe=v(()=>{Soe=t=>"_def"in t?t._def:t});var Olr,wQe=v(()=>{oCe();vQe();Olr=t=>{let e=Clr(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])=>[Soe(o),{def:Soe(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}}});function SQe(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function Fi(t,e,r,n,o){t[e]=r,SQe(t,e,n,o)}var sk=v(()=>{});function Tlr(){return{}}var CQe=v(()=>{});function Elr(t,e){let r={type:"array"};return t.type?._def?.typeName!==Ie.ZodAny&&(r.items=vn(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&Fi(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&Fi(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(Fi(r,"minItems",t.exactLength.value,t.exactLength.message,e),Fi(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var xQe=v(()=>{yO();sk();vd()});function Plr(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?Fi(r,"minimum",n.value,n.message,e):Fi(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Fi(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Fi(r,"maximum",n.value,n.message,e):Fi(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Fi(r,"maximum",n.value,n.message,e));break;case"multipleOf":Fi(r,"multipleOf",n.value,n.message,e);break}return r}var OQe=v(()=>{sk()});function Mlr(){return{type:"boolean"}}var TQe=v(()=>{});function Rlr(t,e){return vn(t.type._def,e)}var EQe=v(()=>{vd()});var Alr,PQe=v(()=>{vd();Alr=(t,e)=>vn(t.innerType._def,e)});function MQe(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>MQe(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 nto(t,e)}}var nto,RQe=v(()=>{sk();nto=(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":Fi(r,"minimum",n.value,n.message,e);break;case"max":Fi(r,"maximum",n.value,n.message,e);break}return r}});function Ilr(t,e){return{...vn(t.innerType._def,e),default:t.defaultValue()}}var AQe=v(()=>{vd()});function Nlr(t,e,r){return e.effectStrategy==="input"?vn(t.schema._def,e,r):{}}var IQe=v(()=>{vd()});function jlr(t){return{type:"string",enum:[...t.values]}}var NQe=v(()=>{});function Dlr(t,e){let r=[vn(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),vn(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(oto(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 oto,jQe=v(()=>{vd();oto=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function $lr(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 DQe=v(()=>{});function iCe(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?ito(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":Fi(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":Fi(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":AC(r,"email",o.message,e);break;case"format:idn-email":AC(r,"idn-email",o.message,e);break;case"pattern:zod":IC(r,L2.email,o.message,e);break}break;case"url":AC(r,"uri",o.message,e);break;case"uuid":AC(r,"uuid",o.message,e);break;case"regex":IC(r,o.regex,o.message,e);break;case"cuid":IC(r,L2.cuid,o.message,e);break;case"cuid2":IC(r,L2.cuid2,o.message,e);break;case"startsWith":IC(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":IC(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":AC(r,"date-time",o.message,e);break;case"date":AC(r,"date",o.message,e);break;case"time":AC(r,"time",o.message,e);break;case"duration":AC(r,"duration",o.message,e);break;case"length":Fi(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),Fi(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{IC(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&AC(r,"ipv4",o.message,e),o.version!=="v4"&&AC(r,"ipv6",o.message,e);break}case"emoji":IC(r,L2.emoji,o.message,e);break;case"ulid":{IC(r,L2.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{AC(r,"binary",o.message,e);break}case"contentEncoding:base64":{Fi(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{IC(r,L2.base64,o.message,e);break}}break}case"nanoid":IC(r,L2.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var $Qe,L2,ito,AC,IC,Llr,aCe=v(()=>{sk();L2={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:()=>($Qe===void 0&&($Qe=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),$Qe),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}$/};ito=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),AC=(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}}})):Fi(t,"format",e,r,n)},IC=(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:Llr(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):Fi(t,"pattern",Llr(e,n),r,n)},Llr=(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 sCe(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]:vn(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:vn(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(iCe(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 uCe=v(()=>{yO();vd();aCe()});function Flr(t,e){if(e.mapStrategy==="record")return sCe(t,e);let r=vn(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=vn(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 LQe=v(()=>{vd();uCe()});function klr(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 FQe=v(()=>{});function qlr(){return{not:{}}}var kQe=v(()=>{});function Blr(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var qQe=v(()=>{});function zlr(t,e){if(e.target==="openApi3")return Ulr(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Coe&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=Coe[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 Ulr(t,e)}var Coe,Ulr,lCe=v(()=>{vd();Coe={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};Ulr=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>vn(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 Hlr(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:Coe[t.innerType._def.typeName],nullable:!0}:{type:[Coe[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=vn(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=vn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var BQe=v(()=>{vd();lCe()});function Vlr(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",SQe(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?Fi(r,"minimum",n.value,n.message,e):Fi(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),Fi(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?Fi(r,"maximum",n.value,n.message,e):Fi(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),Fi(r,"maximum",n.value,n.message,e));break;case"multipleOf":Fi(r,"multipleOf",n.value,n.message,e);break}return r}var UQe=v(()=>{sk()});function ato(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":vn(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":vn(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function Jlr(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=vn(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:ato(t,e)};return r.required.length||delete r.required,r}var zQe=v(()=>{vd()});var Klr,HQe=v(()=>{vd();Klr=(t,e)=>{if(e.propertyPath&&e.currentPath.slice(0,e.propertyPath.length).toString()===e.propertyPath.toString())return vn(t.innerType._def,{...e,currentPath:e.currentPath});let r=vn(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}}});var Wlr,VQe=v(()=>{vd();Wlr=(t,e)=>{if(e.pipeStrategy==="input")return vn(t.in._def,e);if(e.pipeStrategy==="output")return vn(t.out._def,e);let r=vn(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=vn(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}}});function Glr(t,e){return vn(t.type._def,e)}var JQe=v(()=>{vd()});function Zlr(t,e){let n={type:"array",uniqueItems:!0,items:vn(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&Fi(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&Fi(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}var KQe=v(()=>{sk();vd()});function Xlr(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>vn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:vn(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>vn(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}var WQe=v(()=>{vd()});function Ylr(){return{not:{}}}var GQe=v(()=>{});function Qlr(){return{}}var ZQe=v(()=>{});var ecr,XQe=v(()=>{vd();ecr=(t,e)=>vn(t.innerType._def,e)});function vn(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==Slr)return a}if(n&&!r){let a=sto(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=lto(t,t.typeName,e,r);return i&&cto(t,e,i),o.jsonSchema=i,i}var sto,uto,lto,cto,vd=v(()=>{yO();CQe();xQe();OQe();TQe();EQe();PQe();RQe();AQe();IQe();NQe();jQe();DQe();LQe();FQe();kQe();qQe();BQe();UQe();zQe();HQe();VQe();JQe();uCe();KQe();aCe();WQe();GQe();lCe();ZQe();XQe();oCe();sto=(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:uto(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}},uto=(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("/")},lto=(t,e,r,n)=>{switch(e){case Ie.ZodString:return iCe(t,r);case Ie.ZodNumber:return Vlr(t,r);case Ie.ZodObject:return Jlr(t,r);case Ie.ZodBigInt:return Plr(t,r);case Ie.ZodBoolean:return Mlr();case Ie.ZodDate:return MQe(t,r);case Ie.ZodUndefined:return Ylr();case Ie.ZodNull:return Blr(r);case Ie.ZodArray:return Elr(t,r);case Ie.ZodUnion:case Ie.ZodDiscriminatedUnion:return zlr(t,r);case Ie.ZodIntersection:return Dlr(t,r);case Ie.ZodTuple:return Xlr(t,r);case Ie.ZodRecord:return sCe(t,r);case Ie.ZodLiteral:return $lr(t,r);case Ie.ZodEnum:return jlr(t);case Ie.ZodNativeEnum:return klr(t);case Ie.ZodNullable:return Hlr(t,r);case Ie.ZodOptional:return Klr(t,r);case Ie.ZodMap:return Flr(t,r);case Ie.ZodSet:return Zlr(t,r);case Ie.ZodLazy:return vn(t.getter()._def,r);case Ie.ZodPromise:return Glr(t,r);case Ie.ZodNaN:case Ie.ZodNever:return qlr();case Ie.ZodEffects:return Nlr(t,r,n);case Ie.ZodAny:return Tlr();case Ie.ZodUnknown:return Qlr();case Ie.ZodDefault:return Ilr(t,r);case Ie.ZodBranded:return Rlr(t,r);case Ie.ZodReadonly:return ecr(t,r);case Ie.ZodCatch:return Alr(t,r);case Ie.ZodPipeline:return Wlr(t,r);case Ie.ZodFunction:case Ie.ZodVoid:case Ie.ZodSymbol:return;default:return(o=>{})(e)}},cto=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var YQe,QQe=v(()=>{vd();wQe();vQe();YQe=(t,e)=>{let r=Olr(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=vn(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(xlr(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]=vn(Soe(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 tcr=v(()=>{oCe();wQe();sk();vd();CQe();xQe();OQe();TQe();EQe();PQe();RQe();AQe();IQe();NQe();jQe();DQe();LQe();FQe();kQe();qQe();BQe();UQe();zQe();HQe();VQe();JQe();XQe();uCe();KQe();aCe();WQe();GQe();lCe();ZQe();QQe();QQe()});function rcr(t,e){return!e||!fto(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)}:eet(t,e)}function eet(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:hto(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:dto(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||cCe(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 dto(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function fto(t){return!!voe(t.text?.format)}function pto(t){return t?.$brand==="auto-parseable-tool"}function mto(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function hto(t,e){let r=mto(t.tools??[],e.name);return{...e,...e,parsed_arguments:pto(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function cCe(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 dCe=v(()=>{RC();GW()});function gto(t,e){return YQe(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function ncr(t,e,r){return glr({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:gto(t,{name:e})}},n=>t.parse(JSON.parse(n)))}var ocr=v(()=>{GW();tcr();dCe()});function acr(t,e){if(typeof e<"u"&&!icr.includes(e))throw new Error(`Invalid method: ${e}. Supported methods are: ${icr.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 yto(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function scr(t,e,r){if(ec(t))return ncr(t,e,r);if(il(t))return yto({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:iL(t,{cycles:"ref",reused:"ref",override(n){n.jsonSchema.title=e}})}},n=>pO(t,JSON.parse(n)));throw new Error("Unsupported schema response format")}function ucr(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}function tet(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}}var icr,fCe=v(()=>{Gv();Zg();ocr();icr=["jsonSchema","functionCalling","jsonMode"]});function qr(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 MS=v(()=>{});var ret,net=v(()=>{ret=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return ret=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 iet(t){return typeof t!="object"?{}:t??{}}function ccr(t){if(!t)return!0;for(let e in t)return!1;return!0}function dcr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ZW(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var bto,lcr,Cy,oet,fcr,pcr,L1=v(()=>{hA();bto=/^[a-z][a-z0-9+.-]*:/i,lcr=t=>bto.test(t),Cy=t=>(Cy=Array.isArray,Cy(t)),oet=Cy;fcr=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new kt(`${t} must be an integer`);if(e<0)throw new kt(`${t} must be a positive integer`);return e},pcr=t=>{try{return JSON.parse(t)}catch{return}}});var gA,XW=v(()=>{gA=t=>new Promise(e=>setTimeout(e,t))});var uk,aet=v(()=>{uk="6.5.0"});function _to(){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 wto(){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 ycr,vto,mcr,hcr,gcr,bcr,set=v(()=>{aet();ycr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";vto=()=>{let t=_to();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uk,"X-Stainless-OS":hcr(Deno.build.os),"X-Stainless-Arch":mcr(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":uk,"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":uk,"X-Stainless-OS":hcr(globalThis.process.platform??"unknown"),"X-Stainless-Arch":mcr(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=wto();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":uk,"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":uk,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};mcr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",hcr=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"),bcr=()=>gcr??(gcr=vto())});function _cr(){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 uet(...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 pCe(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return uet({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function cet(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 vcr(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 xoe=v(()=>{});var wcr,Scr=v(()=>{wcr=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});var mCe,det,hCe,fet,gCe=v(()=>{mCe="RFC3986",det=t=>String(t),hCe={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:det},fet="RFC1738"});function xcr(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function met(t,e){if(Cy(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var yCe,yA,pet,Ccr,Ocr=v(()=>{gCe();L1();yCe=(t,e)=>(yCe=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),yCe(t,e)),yA=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),pet=1024,Ccr=(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+=pet){let u=i.length>=pet?i.slice(s,s+pet):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===fet&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=yA[d];continue}if(d<2048){l[l.length]=yA[192|d>>6]+yA[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=yA[224|d>>12]+yA[128|d>>6&63]+yA[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=yA[240|d>>18]+yA[128|d>>12&63]+yA[128|d>>6&63]+yA[128|d&63]}a+=l.join("")}return a}});function xto(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function Mcr(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,g,y){let b=t,_=y,w=0,x=!1;for(;(_=_.get(het))!==void 0&&!x;){let N=_.get(t);if(w+=1,typeof N<"u"){if(N===w)throw new RangeError("Cyclic object value");x=!0}typeof _.get(het)>"u"&&(w=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&Cy(b)&&(b=met(b,function(N){return N instanceof Date?f?.(N):N})),b===null){if(i)return u&&!h?u(e,Am.encoder,g,"key",p):e;b=""}if(xto(b)||xcr(b)){if(u){let N=h?e:u(e,Am.encoder,g,"key",p);return[m?.(N)+"="+m?.(u(b,Am.encoder,g,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let O=[];if(typeof b>"u")return O;let E;if(r==="comma"&&Cy(b))h&&u&&(b=met(b,u)),E=[{value:b.length>0?b.join(",")||null:void 0}];else if(Cy(l))E=l;else{let N=Object.keys(b);E=c?N.sort(c):N}let T=s?String(e).replace(/\./g,"%2E"):String(e),R=n&&Cy(b)&&b.length===1?T+"[]":T;if(o&&Cy(b)&&b.length===0)return R+"[]";for(let N=0;N<E.length;++N){let D=E[N],F=typeof D=="object"&&typeof D.value<"u"?D.value:b[D];if(a&&F===null)continue;let B=d&&s?D.replace(/\./g,"%2E"):D,U=Cy(b)?typeof r=="function"?r(R,B):R:R+(d?"."+B:"["+B+"]");y.set(t,w);let H=new WeakMap;H.set(het,y),Pcr(O,Mcr(F,U,r,n,o,i,a,s,r==="comma"&&h&&Cy(b)?null:u,l,c,d,f,p,m,h,g,H))}return O}function Oto(t=Am){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||Am.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=mCe;if(typeof t.format<"u"){if(!yCe(hCe,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=hCe[r],o=Am.filter;(typeof t.filter=="function"||Cy(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in Ecr?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=Am.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:Am.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Am.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Am.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Am.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Am.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Am.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Am.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Am.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Am.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Am.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Am.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Am.strictNullHandling}}function get(t,e={}){let r=t,n=Oto(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Cy(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=Ecr[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||Pcr(a,Mcr(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 Ecr,Pcr,Tcr,Am,het,Rcr=v(()=>{Ocr();gCe();L1();Ecr={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},Pcr=function(t,e){Array.prototype.push.apply(t,Cy(e)?e:[e])},Am={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Ccr,encodeValuesOnly:!1,format:mCe,formatter:det,indices:!1,serializeDate(t){return(Tcr??(Tcr=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};het={}});var Acr=v(()=>{gCe();Rcr()});function jcr(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 YW(t){let e;return(Icr??(e=new globalThis.TextEncoder,Icr=e.encode.bind(e)))(t)}function yet(t){let e;return(Ncr??(e=new globalThis.TextDecoder,Ncr=e.decode.bind(e)))(t)}var Icr,Ncr,bCe=v(()=>{});function Eto(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 Dcr(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 Zv,Xv,F2,$cr=v(()=>{MS();bCe();F2=class{constructor(){Zv.set(this,void 0),Xv.set(this,void 0),qr(this,Zv,new Uint8Array,"f"),qr(this,Xv,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?YW(e):e;qr(this,Zv,jcr([xe(this,Zv,"f"),r]),"f");let n=[],o;for(;(o=Eto(xe(this,Zv,"f"),xe(this,Xv,"f")))!=null;){if(o.carriage&&xe(this,Xv,"f")==null){qr(this,Xv,o.index,"f");continue}if(xe(this,Xv,"f")!=null&&(o.index!==xe(this,Xv,"f")+1||o.carriage)){n.push(yet(xe(this,Zv,"f").subarray(0,xe(this,Xv,"f")-1))),qr(this,Zv,xe(this,Zv,"f").subarray(xe(this,Xv,"f")),"f"),qr(this,Xv,null,"f");continue}let i=xe(this,Xv,"f")!==null?o.preceding-1:o.preceding,a=yet(xe(this,Zv,"f").subarray(0,i));n.push(a),qr(this,Zv,xe(this,Zv,"f").subarray(o.index),"f"),qr(this,Xv,null,"f")}return n}flush(){return xe(this,Zv,"f").length?this.decode(`
|
||
`):[]}};Zv=new WeakMap,Xv=new WeakMap;F2.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);F2.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function Ooe(){}function _Ce(t,e,r){return!e||vCe[t]>vCe[r]?Ooe:e[t].bind(e)}function nd(t){let e=t.logger,r=t.logLevel??"off";if(!e)return Pto;let n=Lcr.get(e);if(n&&n[0]===r)return n[1];let o={error:_Ce("error",e,r),warn:_Ce("warn",e,r),info:_Ce("info",e,r),debug:_Ce("debug",e,r)};return Lcr.set(e,[r,o]),o}var vCe,bet,Pto,Lcr,F1,Toe=v(()=>{L1();vCe={off:0,error:200,warn:300,info:400,debug:500},bet=(t,e,r)=>{if(t){if(dcr(vCe,t))return t;nd(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(vCe))}`)}};Pto={error:Ooe,warn:Ooe,info:Ooe,debug:Ooe},Lcr=new WeakMap;F1=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*Mto(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new kt("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new kt("Attempted to iterate over a response with no body");let r=new _et,n=new F2,o=cet(t.body);for await(let i of Rto(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*Rto(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"?YW(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=Dcr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function Ato(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var Eoe,bA,_et,vet=v(()=>{MS();hA();xoe();$cr();xoe();nCe();bCe();Toe();hA();bA=class t{constructor(e,r,n){this.iterator=e,Eoe.set(this,void 0),this.controller=r,qr(this,Eoe,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?nd(n):console;async function*a(){if(o)throw new kt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of Mto(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 Rm(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 Rm(void 0,l.error,l.message,void 0);yield{event:u.event,data:l}}}s=!0}catch(u){if(yoe(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 F2,u=cet(e);for await(let l of u)for(let c of s.decode(l))yield c;for(let l of s.flush())yield l}async function*a(){if(o)throw new kt("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of i())s||u&&(yield JSON.parse(u));s=!0}catch(u){if(yoe(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[(Eoe=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,Eoe,"f")),new t(()=>o(r),this.controller,xe(this,Eoe,"f"))]}toReadableStream(){let e=this,r;return uet({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=YW(JSON.stringify(o)+`
|
||
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};_et=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]=Ato(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function wCe(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return nd(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):bA.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 wet(d,r)}return await r.text()})();return nd(t).debug(`[${n}] response parsed`,F1({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function wet(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 Cet=v(()=>{vet();Toe()});var Poe,k2,SCe=v(()=>{MS();Cet();k2=class t extends Promise{constructor(e,r,n=wCe){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,Poe.set(this,void 0),qr(this,Poe,e,"f")}_thenUnwrap(e){return new t(xe(this,Poe,"f"),this.responsePromise,async(r,n)=>wet(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,Poe,"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)}};Poe=new WeakMap});var CCe,Moe,Roe,_A,Go,k1,Mu=v(()=>{MS();hA();Cet();SCe();L1();Moe=class{constructor(e,r,n,o){CCe.set(this,void 0),qr(this,CCe,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new kt("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await xe(this,CCe,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(CCe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Roe=class extends k2{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await wCe(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},_A=class extends Moe{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}},Go=class extends Moe{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:{...iet(this.options.query),after:r}}:null}},k1=class extends Moe{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:{...iet(this.options.query),after:e}}:null}}});function QW(t,e,r){return Tet(),new File(t,e??"unknown_file",r)}function Aoe(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 Nto(t){let e=typeof t=="function"?t:t.fetch,r=Fcr.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 Fcr.set(e,n),n}var Tet,xCe,Eet,Yv,Fcr,kcr,qcr,jto,xet,Oet,vA=v(()=>{xoe();Tet=()=>{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`.":""))}};xCe=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Eet=async(t,e)=>xet(t.body)?{...t,body:await kcr(t.body,e)}:t,Yv=async(t,e)=>({...t,body:await kcr(t.body,e)}),Fcr=new WeakMap;kcr=async(t,e)=>{if(!await Nto(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])=>Oet(r,n,o))),r},qcr=t=>t instanceof Blob&&"name"in t,jto=t=>typeof t=="object"&&t!==null&&(t instanceof Response||xCe(t)||qcr(t)),xet=t=>{if(jto(t))return!0;if(Array.isArray(t))return t.some(xet);if(t&&typeof t=="object"){for(let e in t)if(xet(t[e]))return!0}return!1},Oet=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,QW([await r.blob()],Aoe(r)));else if(xCe(r))t.append(e,QW([await new Response(pCe(r)).blob()],Aoe(r)));else if(qcr(r))t.append(e,r,Aoe(r));else if(Array.isArray(r))await Promise.all(r.map(n=>Oet(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>Oet(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 Ioe(t,e,r){if(Tet(),t=await t,Dto(t))return t instanceof File?t:QW([await t.arrayBuffer()],t.name);if($to(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),QW(await Pet(o),e,r)}let n=await Pet(t);if(e||(e=Aoe(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return QW(n,e,r)}async function Pet(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Bcr(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(xCe(t))for await(let r of t)e.push(...await Pet(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${Lto(t)}`)}return e}function Lto(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var Bcr,Dto,$to,Ucr=v(()=>{vA();vA();Bcr=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",Dto=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Bcr(t),$to=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var Met=v(()=>{Ucr()});var Ue,Br=v(()=>{Ue=class{constructor(e){this._client=e}}});function Hcr(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var zcr,kto,$e,Ya=v(()=>{hA();zcr=Object.freeze(Object.create(null)),kto=(t=Hcr)=>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??zcr)??zcr)?.toString)&&(m=p+"",i.push({start:c.length+d.length,length:m.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),c+d+(f===n.length?"":m)},""),s=a.split(/[?#]/,1)[0],u=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=u.exec(s))!==null;)i.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(i.sort((c,d)=>c.start-d.start),i.length>0){let c=0,d=i.reduce((f,p)=>{let m=" ".repeat(p.start-c),h="^".repeat(p.length);return c=p.start+p.length,f+m+h},"");throw new kt(`Path parameters result in path with invalid segments:
|
||
${i.map(f=>f.error).join(`
|
||
`)}
|
||
${a}
|
||
${d}`)}return a},$e=kto(Hcr)});var q2,OCe=v(()=>{Br();Mu();Ya();q2=class extends Ue{list(e,r={},n){return this._client.getAPIList($e`/chat/completions/${e}/messages`,Go,{query:r,...n})}}});var e8,Ret,Aet=v(()=>{e8=t=>t?.role==="assistant",Ret=t=>t?.role==="tool"});var Iet,TCe,ECe,Noe,joe,PCe,Doe,q1,$oe,MCe,RCe,t8,Vcr,lk,ACe=v(()=>{MS();RC();lk=class{constructor(){Iet.add(this),this.controller=new AbortController,TCe.set(this,void 0),ECe.set(this,()=>{}),Noe.set(this,()=>{}),joe.set(this,void 0),PCe.set(this,()=>{}),Doe.set(this,()=>{}),q1.set(this,{}),$oe.set(this,!1),MCe.set(this,!1),RCe.set(this,!1),t8.set(this,!1),qr(this,TCe,new Promise((e,r)=>{qr(this,ECe,e,"f"),qr(this,Noe,r,"f")}),"f"),qr(this,joe,new Promise((e,r)=>{qr(this,PCe,e,"f"),qr(this,Doe,r,"f")}),"f"),xe(this,TCe,"f").catch(()=>{}),xe(this,joe,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},xe(this,Iet,"m",Vcr).bind(this))},0)}_connected(){this.ended||(xe(this,ECe,"f").call(this),this._emit("connect"))}get ended(){return xe(this,$oe,"f")}get errored(){return xe(this,MCe,"f")}get aborted(){return xe(this,RCe,"f")}abort(){this.controller.abort()}on(e,r){return(xe(this,q1,"f")[e]||(xe(this,q1,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=xe(this,q1,"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,q1,"f")[e]||(xe(this,q1,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{qr(this,t8,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){qr(this,t8,!0,"f"),await xe(this,joe,"f")}_emit(e,...r){if(xe(this,$oe,"f"))return;e==="end"&&(qr(this,$oe,!0,"f"),xe(this,PCe,"f").call(this));let n=xe(this,q1,"f")[e];if(n&&(xe(this,q1,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!xe(this,t8,"f")&&!n?.length&&Promise.reject(o),xe(this,Noe,"f").call(this,o),xe(this,Doe,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!xe(this,t8,"f")&&!n?.length&&Promise.reject(o),xe(this,Noe,"f").call(this,o),xe(this,Doe,"f").call(this,o),this._emit("end")}}_emitFinal(){}};TCe=new WeakMap,ECe=new WeakMap,Noe=new WeakMap,joe=new WeakMap,PCe=new WeakMap,Doe=new WeakMap,q1=new WeakMap,$oe=new WeakMap,MCe=new WeakMap,RCe=new WeakMap,t8=new WeakMap,Iet=new WeakSet,Vcr=function(e){if(qr(this,MCe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new Ic),e instanceof Ic)return qr(this,RCe,!0,"f"),this._emit("abort",e);if(e instanceof kt)return this._emit("error",e);if(e instanceof Error){let r=new kt(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new kt(String(e)))}});function Jcr(t){return typeof t.parse=="function"}var Net=v(()=>{});var bb,jet,ICe,Det,$et,Let,Kcr,Wcr,Bto,r8,Fet=v(()=>{MS();RC();GW();Aet();ACe();Net();Bto=10,r8=class extends lk{constructor(){super(...arguments),bb.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),Ret(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(e8(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new kt("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),xe(this,bb,"m",jet).call(this)}async finalMessage(){return await this.done(),xe(this,bb,"m",ICe).call(this)}async finalFunctionToolCall(){return await this.done(),xe(this,bb,"m",Det).call(this)}async finalFunctionToolCallResult(){return await this.done(),xe(this,bb,"m",$et).call(this)}async totalUsage(){return await this.done(),xe(this,bb,"m",Let).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=xe(this,bb,"m",ICe).call(this);r&&this._emit("finalMessage",r);let n=xe(this,bb,"m",jet).call(this);n&&this._emit("finalContent",n);let o=xe(this,bb,"m",Det).call(this);o&&this._emit("finalFunctionToolCall",o);let i=xe(this,bb,"m",$et).call(this);i!=null&&this._emit("finalFunctionToolCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",xe(this,bb,"m",Let).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,bb,"m",Kcr).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(woe(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=Bto}=n||{},c=r.tools.map(p=>{if($2(p)){if(!p.$callback)throw new kt("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:p.$callback,name:p.function.name,description:p.function.description||"",parameters:p.function.parameters,parse:p.$parseRaw,strict:!0}}}return p}),d={};for(let p of c)p.type==="function"&&(d[p.function.name||p.function.function.name]=p.function);let f="tools"in r?c.map(p=>p.type==="function"?{type:"function",function:{name:p.function.name||p.function.function.name,parameters:p.function.parameters,description:p.function.description,strict:p.function.strict}}:p):void 0;for(let p of r.messages)this._addMessage(p,!1);for(let p=0;p<l;++p){let h=(await this._createChatCompletion(e,{...s,tool_choice:i,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!h)throw new kt("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let g of h.tool_calls){if(g.type!=="function")continue;let y=g.id,{name:b,arguments:_}=g.function,w=d[b];if(w){if(u&&u!==b){let T=`Invalid tool_call: ${JSON.stringify(b)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:y,content:T});continue}}else{let T=`Invalid tool_call: ${JSON.stringify(b)}. Available options are: ${Object.keys(d).map(R=>JSON.stringify(R)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:y,content:T});continue}let x;try{x=Jcr(w)?await w.parse(_):_}catch(T){let R=T instanceof Error?T.message:String(T);this._addMessage({role:o,tool_call_id:y,content:R});continue}let O=await w.function(x,this),E=xe(this,bb,"m",Wcr).call(this,O);if(this._addMessage({role:o,tool_call_id:y,content:E}),u)return}}}};bb=new WeakSet,jet=function(){return xe(this,bb,"m",ICe).call(this).content??null},ICe=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(e8(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new kt("stream ended without producing a ChatCompletionMessage with role=assistant")},Det=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(e8(r)&&r?.tool_calls?.length)return r.tool_calls.filter(n=>n.type==="function").at(-1)?.function}},$et=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Ret(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}},Let=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},Kcr=function(e){if(e.n!=null&&e.n>1)throw new kt("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},Wcr=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var Loe,ket=v(()=>{Fet();Aet();Loe=class t extends r8{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),e8(e)&&e.content&&this._emit("content",e.content)}}});function Uto(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 zto(t.trim(),e)}var yh,qet,Bet,zto,Uet,Gcr=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},qet=class extends Error{},Bet=class extends Error{};zto=(t,e)=>{let r=t.length,n=0,o=f=>{throw new qet(`${f} at position ${n}`)},i=f=>{throw new Bet(`${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()},Uet=t=>Uto(t,yh.ALL^yh.NUM)});var zet=v(()=>{vet()});function Hto(t,e){let{id:r,choices:n,created:o,model:i,system_fingerprint:a,...s}=t,u={...s,id:r,choices:n.map(({message:l,finish_reason:c,index:d,logprobs:f,...p})=>{if(!c)throw new kt(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:g,...y}=l,b=l.role;if(!b)throw new kt(`missing role for choice ${d}`);if(h){let{arguments:_,name:w}=h;if(_==null)throw new kt(`missing function_call.arguments for choice ${d}`);if(!w)throw new kt(`missing function_call.name for choice ${d}`);return{...p,message:{content:m,function_call:{arguments:_,name:w},role:b,refusal:l.refusal??null},finish_reason:c,index:d,logprobs:f}}return g?{...p,index:d,finish_reason:c,logprobs:f,message:{...y,role:b,content:m,refusal:l.refusal??null,tool_calls:g.map((_,w)=>{let{function:x,type:O,id:E,...T}=_,{arguments:R,name:N,...D}=x||{};if(E==null)throw new kt(`missing choices[${d}].tool_calls[${w}].id
|
||
${DCe(t)}`);if(O==null)throw new kt(`missing choices[${d}].tool_calls[${w}].type
|
||
${DCe(t)}`);if(N==null)throw new kt(`missing choices[${d}].tool_calls[${w}].function.name
|
||
${DCe(t)}`);if(R==null)throw new kt(`missing choices[${d}].tool_calls[${w}].function.arguments
|
||
${DCe(t)}`);return{...T,id:E,type:O,function:{...D,name:N,arguments:R}}})}}:{...p,message:{...y,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 ylr(u,e)}function DCe(t){return JSON.stringify(t)}var Im,B1,n8,ck,Het,NCe,Vet,Jet,Ket,jCe,Wet,Zcr,B2,$Ce=v(()=>{MS();Gcr();RC();GW();zet();Fet();B2=class t extends r8{constructor(e){super(),Im.add(this),B1.set(this,void 0),n8.set(this,void 0),ck.set(this,void 0),qr(this,B1,e,"f"),qr(this,n8,[],"f")}get currentChatCompletionSnapshot(){return xe(this,ck,"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,Im,"m",Het).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,Im,"m",Vet).call(this,a);if(i.controller.signal?.aborted)throw new Ic;return this._addChatCompletion(xe(this,Im,"m",jCe).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),xe(this,Im,"m",Het).call(this),this._connected();let o=bA.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(xe(this,Im,"m",jCe).call(this)),xe(this,Im,"m",Vet).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new Ic;return this._addChatCompletion(xe(this,Im,"m",jCe).call(this))}[(B1=new WeakMap,n8=new WeakMap,ck=new WeakMap,Im=new WeakSet,Het=function(){this.ended||qr(this,ck,void 0,"f")},NCe=function(r){let n=xe(this,n8,"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,n8,"f")[r.index]=n,n)},Vet=function(r){if(this.ended)return;let n=xe(this,Im,"m",Zcr).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,Im,"m",NCe).call(this,i);i.finish_reason&&(xe(this,Im,"m",Ket).call(this,i),a.current_tool_call_index!=null&&xe(this,Im,"m",Jet).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,Im,"m",Ket).call(this,i),a.current_tool_call_index!=null&&xe(this,Im,"m",Jet).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))}}},Jet=function(r,n){if(xe(this,Im,"m",NCe).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,B1,"f")?.tools?.find(s=>_oe(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:$2(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},Ket=function(r){let n=xe(this,Im,"m",NCe).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=xe(this,Im,"m",Wet).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}))},jCe=function(){if(this.ended)throw new kt("stream has ended, this shouldn't happen");let r=xe(this,ck,"f");if(!r)throw new kt("request ended without sending any chunks");return qr(this,ck,void 0,"f"),qr(this,n8,[],"f"),Hto(r,xe(this,B1,"f"))},Wet=function(){let r=xe(this,B1,"f")?.response_format;return voe(r)?r:null},Zcr=function(r){var n,o,i,a;let s=xe(this,ck,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=qr(this,ck,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=s.choices[f];if(h||(h=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:O,refusal:E,...T}=p;Object.assign(h.logprobs,T),O&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...O)),E&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...E))}if(d&&(h.finish_reason=d,xe(this,B1,"f")&&_Qe(xe(this,B1,"f")))){if(d==="length")throw new KW;if(d==="content_filter")throw new WW}if(Object.assign(h,m),!c)continue;let{content:g,refusal:y,function_call:b,role:_,tool_calls:w,...x}=c;if(Object.assign(h.message,x),y&&(h.message.refusal=(h.message.refusal||"")+y),_&&(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),g&&(h.message.content=(h.message.content||"")+g,!h.message.refusal&&xe(this,Im,"m",Wet).call(this)&&(h.message.parsed=Uet(h.message.content))),w){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:O,id:E,type:T,function:R,...N}of w){let D=(a=h.message.tool_calls)[O]??(a[O]={});Object.assign(D,N),E&&(D.id=E),T&&(D.type=T),R&&(D.function??(D.function={name:R.name??"",arguments:""})),R?.name&&(D.function.name=R.name),R?.arguments&&(D.function.arguments+=R.arguments,blr(xe(this,B1,"f"),D)&&(D.function.parsed_arguments=Uet(D.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 bA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var Foe,Get=v(()=>{$Ce();Foe=class t extends B2{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 U1,koe=v(()=>{Br();OCe();OCe();Mu();Ya();ket();Get();$Ce();GW();Get();Net();$Ce();ket();U1=class extends Ue{constructor(){super(...arguments),this.messages=new q2(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($e`/chat/completions/${e}`,r)}update(e,r,n){return this._client.post($e`/chat/completions/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/chat/completions",Go,{query:e,...r})}delete(e,r){return this._client.delete($e`/chat/completions/${e}`,r)}parse(e,r){return vlr(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>woe(n,e))}runTools(e,r){return e.stream?Foe.runTools(this._client,e,r):Loe.runTools(this._client,e,r)}stream(e,r){return B2.createChatCompletion(this._client,e,r)}};U1.Messages=q2});var dk,Zet=v(()=>{Br();koe();koe();dk=class extends Ue{constructor(){super(...arguments),this.completions=new U1(this._client)}};dk.Completions=U1});var Xcr=v(()=>{koe();koe();OCe()});var Ycr=v(()=>{Zet();Xcr()});var Qcr=v(()=>{});function*Jto(t){if(!t)return;if(edr 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():oet(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=oet(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 edr,at,kl=v(()=>{L1();edr=Symbol("brand.privateNullableHeaders");at=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,a]of Jto(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{[edr]:!0,values:e,nulls:r}}});var o8,Xet=v(()=>{Br();kl();o8=class extends Ue{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:at([{Accept:"application/octet-stream"},r?.headers]),__binaryResponse:!0})}}});var i8,Yet=v(()=>{Br();vA();i8=class extends Ue{create(e,r){return this._client.post("/audio/transcriptions",Yv({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}}});var a8,Qet=v(()=>{Br();vA();a8=class extends Ue{create(e,r){return this._client.post("/audio/translations",Yv({body:e,...r,__metadata:{model:e.model}},this._client))}}});var wA,ett=v(()=>{Br();Xet();Xet();Yet();Yet();Qet();Qet();wA=class extends Ue{constructor(){super(...arguments),this.transcriptions=new i8(this._client),this.translations=new a8(this._client),this.speech=new o8(this._client)}};wA.Transcriptions=i8;wA.Translations=a8;wA.Speech=o8});var U2,ttt=v(()=>{Br();Mu();Ya();U2=class extends Ue{create(e,r){return this._client.post("/batches",{body:e,...r})}retrieve(e,r){return this._client.get($e`/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/batches",Go,{query:e,...r})}cancel(e,r){return this._client.post($e`/batches/${e}/cancel`,r)}}});var s8,rtt=v(()=>{Br();Mu();kl();Ya();s8=class extends Ue{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get($e`/assistants/${e}`,{...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post($e`/assistants/${e}`,{body:r,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/assistants",Go,{query:e,...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete($e`/assistants/${e}`,{...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var u8,ntt=v(()=>{Br();kl();u8=class extends Ue{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var l8,ott=v(()=>{Br();kl();l8=class extends Ue{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}}});var fk,itt=v(()=>{Br();ntt();ntt();ott();ott();fk=class extends Ue{constructor(){super(...arguments),this.sessions=new u8(this._client),this.transcriptionSessions=new l8(this._client)}};fk.Sessions=u8;fk.TranscriptionSessions=l8});var c8,att=v(()=>{Br();kl();Ya();c8=class extends Ue{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:at([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}cancel(e,r){return this._client.post($e`/chatkit/sessions/${e}/cancel`,{...r,headers:at([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}}});var d8,stt=v(()=>{Br();Mu();kl();Ya();d8=class extends Ue{retrieve(e,r){return this._client.get($e`/chatkit/threads/${e}`,{...r,headers:at([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}list(e={},r){return this._client.getAPIList("/chatkit/threads",k1,{query:e,...r,headers:at([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}delete(e,r){return this._client.delete($e`/chatkit/threads/${e}`,{...r,headers:at([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers])})}listItems(e,r={},n){return this._client.getAPIList($e`/chatkit/threads/${e}/items`,k1,{query:r,...n,headers:at([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers])})}}});var pk,utt=v(()=>{Br();att();att();stt();stt();pk=class extends Ue{constructor(){super(...arguments),this.sessions=new c8(this._client),this.threads=new d8(this._client)}};pk.Sessions=c8;pk.Threads=d8});var f8,ltt=v(()=>{Br();Mu();kl();Ya();f8=class extends Ue{create(e,r,n){return this._client.post($e`/threads/${e}/messages`,{body:r,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get($e`/threads/${o}/messages/${e}`,{...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post($e`/threads/${o}/messages/${e}`,{body:i,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList($e`/threads/${e}/messages`,Go,{query:r,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete($e`/threads/${o}/messages/${e}`,{...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var p8,ctt=v(()=>{Br();Mu();kl();Ya();p8=class extends Ue{retrieve(e,r,n){let{thread_id:o,run_id:i,...a}=r;return this._client.get($e`/threads/${o}/runs/${i}/steps/${e}`,{query:a,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r,n){let{thread_id:o,...i}=r;return this._client.getAPIList($e`/threads/${o}/runs/${e}/steps`,Go,{query:i,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var tdr,rdr=v(()=>{hA();bCe();tdr=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,dtt=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 qoe=v(()=>{L1();rdr();dtt();Toe();net();XW()});var _g,H2,ftt,SA,LCe,jC,V2,m8,z2,qCe,Qv,FCe,kCe,zoe,Boe,Uoe,ndr,odr,idr,adr,sdr,udr,ldr,z1,ptt=v(()=>{MS();zet();RC();ACe();qoe();z1=class extends lk{constructor(){super(...arguments),_g.add(this),ftt.set(this,[]),SA.set(this,{}),LCe.set(this,{}),jC.set(this,void 0),V2.set(this,void 0),m8.set(this,void 0),z2.set(this,void 0),qCe.set(this,void 0),Qv.set(this,void 0),FCe.set(this,void 0),kCe.set(this,void 0),zoe.set(this,void 0)}[(ftt=new WeakMap,SA=new WeakMap,LCe=new WeakMap,jC=new WeakMap,V2=new WeakMap,m8=new WeakMap,z2=new WeakMap,qCe=new WeakMap,Qv=new WeakMap,FCe=new WeakMap,kCe=new WeakMap,zoe=new WeakMap,_g=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 H2;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=bA.fromReadableStream(e,this.controller);for await(let i of o)xe(this,_g,"m",Boe).call(this,i);if(o.controller.signal?.aborted)throw new Ic;return this._addRun(xe(this,_g,"m",Uoe).call(this))}toReadableStream(){return new bA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let i=new H2;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,_g,"m",Boe).call(this,u);if(s.controller.signal?.aborted)throw new Ic;return this._addRun(xe(this,_g,"m",Uoe).call(this))}static createThreadAssistantStream(e,r,n){let o=new H2;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 H2;return i._run(()=>i._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),i}currentEvent(){return xe(this,FCe,"f")}currentRun(){return xe(this,kCe,"f")}currentMessageSnapshot(){return xe(this,jC,"f")}currentRunStepSnapshot(){return xe(this,zoe,"f")}async finalRunSteps(){return await this.done(),Object.values(xe(this,SA,"f"))}async finalMessages(){return await this.done(),Object.values(xe(this,LCe,"f"))}async finalRun(){if(await this.done(),!xe(this,V2,"f"))throw Error("Final run was not received.");return xe(this,V2,"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,_g,"m",Boe).call(this,s);if(a.controller.signal?.aborted)throw new Ic;return this._addRun(xe(this,_g,"m",Uoe).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,_g,"m",Boe).call(this,u);if(s.controller.signal?.aborted)throw new Ic;return this._addRun(xe(this,_g,"m",Uoe).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(ZW(i)&&ZW(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(!ZW(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)}};H2=z1,Boe=function(e){if(!this.ended)switch(qr(this,FCe,e,"f"),xe(this,_g,"m",idr).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,_g,"m",ldr).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,_g,"m",odr).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,_g,"m",ndr).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},Uoe=function(){if(this.ended)throw new kt("stream has ended, this shouldn't happen");if(!xe(this,V2,"f"))throw Error("Final run has not been received");return xe(this,V2,"f")},ndr=function(e){let[r,n]=xe(this,_g,"m",sdr).call(this,e,xe(this,jC,"f"));qr(this,jC,r,"f"),xe(this,LCe,"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,m8,"f")){if(xe(this,z2,"f"))switch(xe(this,z2,"f").type){case"text":this._emit("textDone",xe(this,z2,"f").text,xe(this,jC,"f"));break;case"image_file":this._emit("imageFileDone",xe(this,z2,"f").image_file,xe(this,jC,"f"));break}qr(this,m8,o.index,"f")}qr(this,z2,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(xe(this,m8,"f")!==void 0){let o=e.data.content[xe(this,m8,"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),qr(this,jC,void 0,"f")}},odr=function(e){let r=xe(this,_g,"m",adr).call(this,e);switch(qr(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,qCe,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(xe(this,Qv,"f")&&this._emit("toolCallDone",xe(this,Qv,"f")),qr(this,qCe,i.index,"f"),qr(this,Qv,r.step_details.tool_calls[i.index],"f"),xe(this,Qv,"f")&&this._emit("toolCallCreated",xe(this,Qv,"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":qr(this,zoe,void 0,"f"),e.data.step_details.type=="tool_calls"&&xe(this,Qv,"f")&&(this._emit("toolCallDone",xe(this,Qv,"f")),qr(this,Qv,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},idr=function(e){xe(this,ftt,"f").push(e),this._emit("event",e)},adr=function(e){switch(e.event){case"thread.run.step.created":return xe(this,SA,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=xe(this,SA,"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=H2.accumulateDelta(r,n.delta);xe(this,SA,"f")[e.data.id]=o}return xe(this,SA,"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,SA,"f")[e.data.id]=e.data;break}if(xe(this,SA,"f")[e.data.id])return xe(this,SA,"f")[e.data.id];throw new Error("No snapshot available")},sdr=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,_g,"m",udr).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")},udr=function(e,r){return H2.accumulateDelta(r,e)},ldr=function(e){switch(qr(this,kCe,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":qr(this,V2,e.data,"f"),xe(this,Qv,"f")&&(this._emit("toolCallDone",xe(this,Qv,"f")),qr(this,Qv,void 0,"f"));break;case"thread.run.cancelling":break}}});var J2,mtt=v(()=>{Br();ctt();ctt();Mu();kl();ptt();XW();Ya();J2=class extends Ue{constructor(){super(...arguments),this.steps=new p8(this._client)}create(e,r,n){let{include:o,...i}=r;return this._client.post($e`/threads/${e}/runs`,{query:{include:o},body:i,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get($e`/threads/${o}/runs/${e}`,{...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{thread_id:o,...i}=r;return this._client.post($e`/threads/${o}/runs/${e}`,{body:i,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList($e`/threads/${e}/runs`,Go,{query:r,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post($e`/threads/${o}/runs/${e}/cancel`,{...n,headers:at([{"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 z1.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=at([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 gA(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return z1.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...i}=r;return this._client.post($e`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:at([{"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 z1.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};J2.Steps=p8});var mk,htt=v(()=>{Br();ltt();ltt();mtt();mtt();kl();ptt();Ya();mk=class extends Ue{constructor(){super(...arguments),this.runs=new J2(this._client),this.messages=new f8(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get($e`/threads/${e}`,{...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post($e`/threads/${e}`,{body:r,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r){return this._client.delete($e`/threads/${e}`,{...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:at([{"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 z1.createThreadAssistantStream(e,this._client.beta.threads,r)}};mk.Runs=J2;mk.Messages=f8});var DC,gtt=v(()=>{Br();rtt();rtt();itt();itt();utt();utt();htt();htt();DC=class extends Ue{constructor(){super(...arguments),this.realtime=new fk(this._client),this.chatkit=new pk(this._client),this.assistants=new s8(this._client),this.threads=new mk(this._client)}};DC.Realtime=fk;DC.ChatKit=pk;DC.Assistants=s8;DC.Threads=mk});var K2,ytt=v(()=>{Br();K2=class extends Ue{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var h8,btt=v(()=>{Br();kl();Ya();h8=class extends Ue{retrieve(e,r,n){let{container_id:o}=r;return this._client.get($e`/containers/${o}/files/${e}/content`,{...n,headers:at([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}}});var W2,_tt=v(()=>{Br();btt();btt();Mu();kl();vA();Ya();W2=class extends Ue{constructor(){super(...arguments),this.content=new h8(this._client)}create(e,r,n){return this._client.post($e`/containers/${e}/files`,Yv({body:r,...n},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get($e`/containers/${o}/files/${e}`,n)}list(e,r={},n){return this._client.getAPIList($e`/containers/${e}/files`,Go,{query:r,...n})}delete(e,r,n){let{container_id:o}=r;return this._client.delete($e`/containers/${o}/files/${e}`,{...n,headers:at([{Accept:"*/*"},n?.headers])})}};W2.Content=h8});var hk,vtt=v(()=>{Br();_tt();_tt();Mu();kl();Ya();hk=class extends Ue{constructor(){super(...arguments),this.files=new W2(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r})}retrieve(e,r){return this._client.get($e`/containers/${e}`,r)}list(e={},r){return this._client.getAPIList("/containers",Go,{query:e,...r})}delete(e,r){return this._client.delete($e`/containers/${e}`,{...r,headers:at([{Accept:"*/*"},r?.headers])})}};hk.Files=W2});var g8,wtt=v(()=>{Br();Mu();Ya();g8=class extends Ue{create(e,r,n){let{include:o,...i}=r;return this._client.post($e`/conversations/${e}/items`,{query:{include:o},body:i,...n})}retrieve(e,r,n){let{conversation_id:o,...i}=r;return this._client.get($e`/conversations/${o}/items/${e}`,{query:i,...n})}list(e,r={},n){return this._client.getAPIList($e`/conversations/${e}/items`,k1,{query:r,...n})}delete(e,r,n){let{conversation_id:o}=r;return this._client.delete($e`/conversations/${o}/items/${e}`,n)}}});var gk,Stt=v(()=>{Br();wtt();wtt();Ya();gk=class extends Ue{constructor(){super(...arguments),this.items=new g8(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r})}retrieve(e,r){return this._client.get($e`/conversations/${e}`,r)}update(e,r,n){return this._client.post($e`/conversations/${e}`,{body:r,...n})}delete(e,r){return this._client.delete($e`/conversations/${e}`,r)}};gk.Items=g8});var G2,Ctt=v(()=>{Br();qoe();G2=class extends Ue{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&nd(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:(nd(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=tdr(u)}),a)))}}});var y8,xtt=v(()=>{Br();Mu();Ya();y8=class extends Ue{retrieve(e,r,n){let{eval_id:o,run_id:i}=r;return this._client.get($e`/evals/${o}/runs/${i}/output_items/${e}`,n)}list(e,r,n){let{eval_id:o,...i}=r;return this._client.getAPIList($e`/evals/${o}/runs/${e}/output_items`,Go,{query:i,...n})}}});var Z2,Ott=v(()=>{Br();xtt();xtt();Mu();Ya();Z2=class extends Ue{constructor(){super(...arguments),this.outputItems=new y8(this._client)}create(e,r,n){return this._client.post($e`/evals/${e}/runs`,{body:r,...n})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get($e`/evals/${o}/runs/${e}`,n)}list(e,r={},n){return this._client.getAPIList($e`/evals/${e}/runs`,Go,{query:r,...n})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete($e`/evals/${o}/runs/${e}`,n)}cancel(e,r,n){let{eval_id:o}=r;return this._client.post($e`/evals/${o}/runs/${e}`,n)}};Z2.OutputItems=y8});var yk,Ttt=v(()=>{Br();Ott();Ott();Mu();Ya();yk=class extends Ue{constructor(){super(...arguments),this.runs=new Z2(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r})}retrieve(e,r){return this._client.get($e`/evals/${e}`,r)}update(e,r,n){return this._client.post($e`/evals/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/evals",Go,{query:e,...r})}delete(e,r){return this._client.delete($e`/evals/${e}`,r)}};yk.Runs=Z2});var X2,Ett=v(()=>{Br();Mu();kl();XW();RC();vA();Ya();X2=class extends Ue{create(e,r){return this._client.post("/files",Yv({body:e,...r},this._client))}retrieve(e,r){return this._client.get($e`/files/${e}`,r)}list(e={},r){return this._client.getAPIList("/files",Go,{query:e,...r})}delete(e,r){return this._client.delete($e`/files/${e}`,r)}content(e,r){return this._client.get($e`/files/${e}/content`,{...r,headers:at([{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 gA(r),a=await this.retrieve(e),Date.now()-i>n)throw new pA({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}}});var b8,Ptt=v(()=>{Br();b8=class extends Ue{}});var _8,Mtt=v(()=>{Br();_8=class extends Ue{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 Y2,Rtt=v(()=>{Br();Mtt();Mtt();Y2=class extends Ue{constructor(){super(...arguments),this.graders=new _8(this._client)}};Y2.Graders=_8});var v8,Att=v(()=>{Br();Mu();Ya();v8=class extends Ue{create(e,r,n){return this._client.getAPIList($e`/fine_tuning/checkpoints/${e}/permissions`,_A,{body:r,method:"post",...n})}retrieve(e,r={},n){return this._client.get($e`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete($e`/fine_tuning/checkpoints/${o}/permissions/${e}`,n)}}});var Q2,Itt=v(()=>{Br();Att();Att();Q2=class extends Ue{constructor(){super(...arguments),this.permissions=new v8(this._client)}};Q2.Permissions=v8});var w8,Ntt=v(()=>{Br();Mu();Ya();w8=class extends Ue{list(e,r={},n){return this._client.getAPIList($e`/fine_tuning/jobs/${e}/checkpoints`,Go,{query:r,...n})}}});var eH,jtt=v(()=>{Br();Ntt();Ntt();Mu();Ya();eH=class extends Ue{constructor(){super(...arguments),this.checkpoints=new w8(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r})}retrieve(e,r){return this._client.get($e`/fine_tuning/jobs/${e}`,r)}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",Go,{query:e,...r})}cancel(e,r){return this._client.post($e`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return this._client.getAPIList($e`/fine_tuning/jobs/${e}/events`,Go,{query:r,...n})}pause(e,r){return this._client.post($e`/fine_tuning/jobs/${e}/pause`,r)}resume(e,r){return this._client.post($e`/fine_tuning/jobs/${e}/resume`,r)}};eH.Checkpoints=w8});var $C,Dtt=v(()=>{Br();Ptt();Ptt();Rtt();Rtt();Itt();Itt();jtt();jtt();$C=class extends Ue{constructor(){super(...arguments),this.methods=new b8(this._client),this.jobs=new eH(this._client),this.checkpoints=new Q2(this._client),this.alpha=new Y2(this._client)}};$C.Methods=b8;$C.Jobs=eH;$C.Checkpoints=Q2;$C.Alpha=Y2});var S8,$tt=v(()=>{Br();S8=class extends Ue{}});var bk,Ltt=v(()=>{Br();$tt();$tt();bk=class extends Ue{constructor(){super(...arguments),this.graderModels=new S8(this._client)}};bk.GraderModels=S8});var tH,Ftt=v(()=>{Br();vA();tH=class extends Ue{createVariation(e,r){return this._client.post("/images/variations",Yv({body:e,...r},this._client))}edit(e,r){return this._client.post("/images/edits",Yv({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 rH,ktt=v(()=>{Br();Mu();Ya();rH=class extends Ue{retrieve(e,r){return this._client.get($e`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",_A,e)}delete(e,r){return this._client.delete($e`/models/${e}`,r)}}});var nH,qtt=v(()=>{Br();nH=class extends Ue{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});var C8,Btt=v(()=>{Br();kl();Ya();C8=class extends Ue{accept(e,r,n){return this._client.post($e`/realtime/calls/${e}/accept`,{body:r,...n,headers:at([{Accept:"*/*"},n?.headers])})}hangup(e,r){return this._client.post($e`/realtime/calls/${e}/hangup`,{...r,headers:at([{Accept:"*/*"},r?.headers])})}refer(e,r,n){return this._client.post($e`/realtime/calls/${e}/refer`,{body:r,...n,headers:at([{Accept:"*/*"},n?.headers])})}reject(e,r={},n){return this._client.post($e`/realtime/calls/${e}/reject`,{body:r,...n,headers:at([{Accept:"*/*"},n?.headers])})}}});var x8,Utt=v(()=>{Br();x8=class extends Ue{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r})}}});var H1,ztt=v(()=>{Br();Btt();Btt();Utt();Utt();H1=class extends Ue{constructor(){super(...arguments),this.clientSecrets=new x8(this._client),this.calls=new C8(this._client)}};H1.ClientSecrets=x8;H1.Calls=C8});function Sro(t,e){return rcr(t,e)}var O8,BCe,_k,UCe,cdr,ddr,fdr,pdr,zCe,mdr=v(()=>{MS();RC();ACe();dCe();zCe=class t extends lk{constructor(e){super(),O8.add(this),BCe.set(this,void 0),_k.set(this,void 0),UCe.set(this,void 0),qr(this,BCe,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,O8,"m",cdr).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,O8,"m",ddr).call(this,s,a);if(i.controller.signal?.aborted)throw new Ic;return xe(this,O8,"m",fdr).call(this)}[(BCe=new WeakMap,_k=new WeakMap,UCe=new WeakMap,O8=new WeakSet,cdr=function(){this.ended||qr(this,_k,void 0,"f")},ddr=function(r,n){if(this.ended)return;let o=(a,s)=>{(n==null||s.sequence_number>n)&&this._emit(a,s)},i=xe(this,O8,"m",pdr).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let a=i.output[r.output_index];if(!a)throw new kt(`missing output at index ${r.output_index}`);if(a.type==="message"){let s=a.content[r.content_index];if(!s)throw new kt(`missing content at index ${r.content_index}`);if(s.type!=="output_text")throw new kt(`expected content to be 'output_text', got ${s.type}`);o("response.output_text.delta",{...r,snapshot:s.text})}break}case"response.function_call_arguments.delta":{let a=i.output[r.output_index];if(!a)throw new kt(`missing output at index ${r.output_index}`);a.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:a.arguments});break}default:o(r.type,r);break}},fdr=function(){if(this.ended)throw new kt("stream has ended, this shouldn't happen");let r=xe(this,_k,"f");if(!r)throw new kt("request ended without sending any events");qr(this,_k,void 0,"f");let n=Sro(r,xe(this,BCe,"f"));return qr(this,UCe,n,"f"),n},pdr=function(r){let n=xe(this,_k,"f");if(!n){if(r.type!=="response.created")throw new kt(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=qr(this,_k,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new kt(`missing output at index ${r.output_index}`);let i=o.type,a=r.part;i==="message"&&a.type!=="reasoning_text"?o.content.push(a):i==="reasoning"&&a.type==="reasoning_text"&&(o.content||(o.content=[]),o.content.push(a));break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new kt(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new kt(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new kt(`expected content to be 'output_text', got ${i.type}`);i.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new kt(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.reasoning_text.delta":{let o=n.output[r.output_index];if(!o)throw new kt(`missing output at index ${r.output_index}`);if(o.type==="reasoning"){let i=o.content?.[r.content_index];if(!i)throw new kt(`missing content at index ${r.content_index}`);if(i.type!=="reasoning_text")throw new kt(`expected content to be 'reasoning_text', got ${i.type}`);i.text+=r.delta}break}case"response.completed":{qr(this,_k,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,UCe,"f");if(!e)throw new kt("stream ended without producing a ChatCompletion");return e}}});var T8,Htt=v(()=>{Br();Mu();Ya();T8=class extends Ue{list(e,r={},n){return this._client.getAPIList($e`/responses/${e}/input_items`,Go,{query:r,...n})}}});var vk,Vtt=v(()=>{dCe();mdr();Br();Htt();Htt();kl();Ya();vk=class extends Ue{constructor(){super(...arguments),this.inputItems=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"&&cCe(n),n))}retrieve(e,r={},n){return this._client.get($e`/responses/${e}`,{query:r,...n,stream:r?.stream??!1})._thenUnwrap(o=>("object"in o&&o.object==="response"&&cCe(o),o))}delete(e,r){return this._client.delete($e`/responses/${e}`,{...r,headers:at([{Accept:"*/*"},r?.headers])})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>eet(n,e))}stream(e,r){return zCe.createResponse(this._client,e,r)}cancel(e,r){return this._client.post($e`/responses/${e}/cancel`,r)}};vk.InputItems=T8});var E8,Jtt=v(()=>{Br();vA();Ya();E8=class extends Ue{create(e,r,n){return this._client.post($e`/uploads/${e}/parts`,Yv({body:r,...n},this._client))}}});var wk,Ktt=v(()=>{Br();Jtt();Jtt();Ya();wk=class extends Ue{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($e`/uploads/${e}/cancel`,r)}complete(e,r,n){return this._client.post($e`/uploads/${e}/complete`,{body:r,...n})}};wk.Parts=E8});var hdr,gdr=v(()=>{hdr=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,Wtt=v(()=>{Br();Mu();kl();XW();gdr();Ya();P8=class extends Ue{create(e,r,n){return this._client.post($e`/vector_stores/${e}/file_batches`,{body:r,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get($e`/vector_stores/${o}/file_batches/${e}`,{...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post($e`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:at([{"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($e`/vector_stores/${o}/file_batches/${e}/files`,Go,{query:i,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}async poll(e,r,n){let o=at([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 gA(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 hdr(d),await this.createAndPoll(e,{file_ids:l})}}});var M8,Gtt=v(()=>{Br();Mu();kl();qoe();Ya();M8=class extends Ue{create(e,r,n){return this._client.post($e`/vector_stores/${e}/files`,{body:r,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get($e`/vector_stores/${o}/files/${e}`,{...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}update(e,r,n){let{vector_store_id:o,...i}=r;return this._client.post($e`/vector_stores/${o}/files/${e}`,{body:i,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e,r={},n){return this._client.getAPIList($e`/vector_stores/${e}/files`,Go,{query:r,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete($e`/vector_stores/${o}/files/${e}`,{...n,headers:at([{"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=at([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 gA(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($e`/vector_stores/${o}/files/${e}/content`,_A,{...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}}});var V1,Ztt=v(()=>{Br();Wtt();Wtt();Gtt();Gtt();Mu();kl();Ya();V1=class extends Ue{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:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}retrieve(e,r){return this._client.get($e`/vector_stores/${e}`,{...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}update(e,r,n){return this._client.post($e`/vector_stores/${e}`,{body:r,...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}list(e={},r){return this._client.getAPIList("/vector_stores",Go,{query:e,...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}delete(e,r){return this._client.delete($e`/vector_stores/${e}`,{...r,headers:at([{"OpenAI-Beta":"assistants=v2"},r?.headers])})}search(e,r,n){return this._client.getAPIList($e`/vector_stores/${e}/search`,_A,{body:r,method:"post",...n,headers:at([{"OpenAI-Beta":"assistants=v2"},n?.headers])})}};V1.Files=M8;V1.FileBatches=P8});var oH,Xtt=v(()=>{Br();Mu();kl();vA();Ya();oH=class extends Ue{create(e,r){return this._client.post("/videos",Eet({body:e,...r},this._client))}retrieve(e,r){return this._client.get($e`/videos/${e}`,r)}list(e={},r){return this._client.getAPIList("/videos",k1,{query:e,...r})}delete(e,r){return this._client.delete($e`/videos/${e}`,r)}downloadContent(e,r={},n){return this._client.get($e`/videos/${e}/content`,{query:r,...n,headers:at([{Accept:"application/binary"},n?.headers]),__binaryResponse:!0})}remix(e,r,n){return this._client.post($e`/videos/${e}/remix`,Eet({body:r,...n},this._client))}}});var R8,ydr,HCe,iH,Ytt=v(()=>{MS();RC();Br();kl();iH=class extends Ue{constructor(){super(...arguments),R8.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,R8,"m",ydr).call(this,n);let i=at([r]).values,a=xe(this,R8,"m",HCe).call(this,i,"webhook-signature"),s=xe(this,R8,"m",HCe).call(this,i,"webhook-timestamp"),u=xe(this,R8,"m",HCe).call(this,i,"webhook-id"),l=parseInt(s,10);if(isNaN(l))throw new mA("Invalid webhook timestamp format");let c=Math.floor(Date.now()/1e3);if(c-l>o)throw new mA("Webhook timestamp is too old");if(l>c+o)throw new mA("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 g=Buffer.from(h,"base64");if(await crypto.subtle.verify("HMAC",m,g,new TextEncoder().encode(p)))return}catch{continue}throw new mA("The given webhook signature does not match the expected signature")}};R8=new WeakSet,ydr=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")},HCe=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 bdr=v(()=>{Ycr();Qcr();ett();ttt();gtt();ytt();vtt();Stt();Ctt();Ttt();Ett();Dtt();Ltt();Ftt();ktt();qtt();ztt();Vtt();Ktt();Ztt();Xtt();Ytt()});var Qtt,ert,VCe,_dr,fn,JCe=v(()=>{MS();net();L1();XW();nCe();set();xoe();Scr();Acr();aet();hA();Mu();Met();bdr();SCe();ttt();ytt();Ctt();Ett();Ftt();ktt();qtt();Xtt();Ytt();ett();gtt();Zet();vtt();Stt();Ttt();Dtt();Ltt();ztt();Vtt();Ktt();Ztt();set();kl();dtt();Toe();L1();fn=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(Qtt.add(this),VCe.set(this,void 0),this.completions=new K2(this),this.chat=new dk(this),this.embeddings=new G2(this),this.files=new X2(this),this.images=new tH(this),this.audio=new wA(this),this.moderations=new nH(this),this.models=new rH(this),this.fineTuning=new $C(this),this.graders=new bk(this),this.vectorStores=new V1(this),this.webhooks=new iH(this),this.beta=new DC(this),this.batches=new U2(this),this.uploads=new wk(this),this.responses=new vk(this),this.realtime=new H1(this),this.conversations=new gk(this),this.evals=new yk(this),this.containers=new hk(this),this.videos=new oH(this),r===void 0)throw new kt("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let s={apiKey:r,organization:n,project:o,webhookSecret:i,...a,baseURL:e||"https://api.openai.com/v1"};if(!s.dangerouslyAllowBrowser&&ycr())throw new kt(`It looks like you're running in a browser-like environment.
|
||
|
||
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
||
If you understand the risks and have appropriate mitigations in place,
|
||
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
||
|
||
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
|
||
|
||
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
||
`);this.baseURL=s.baseURL,this.timeout=s.timeout??ert.DEFAULT_TIMEOUT,this.logger=s.logger??console;let u="warn";this.logLevel=u,this.logLevel=bet(s.logLevel,"ClientOptions.logLevel",this)??bet(NC("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??u,this.fetchOptions=s.fetchOptions,this.maxRetries=s.maxRetries??2,this.fetch=s.fetch??_cr(),qr(this,VCe,wcr,"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 at([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return get(e,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${uk}`}defaultIdempotencyKey(){return`stainless-node-retry-${ret()}`}makeStatusError(e,r,n,o){return Rm.generate(e,r,n,o)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof kt?n:new kt(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new kt(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let o=!xe(this,Qtt,"m",_dr).call(this)&&n||this.baseURL,i=lcr(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return ccr(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 k2(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(nd(this).debug(`[${l}] sending request`,F1({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(boe),m=Date.now();if(p instanceof globalThis.Error){let y=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new Ic;let b=yoe(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return nd(this).info(`[${l}] connection ${b?"timed out":"failed"} - ${y}`),nd(this).debug(`[${l}] connection ${b?"timed out":"failed"} (${y})`,F1({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),this.retryRequest(o,r,n??l);throw nd(this).info(`[${l}] connection ${b?"timed out":"failed"} - error; no more retries left`),nd(this).debug(`[${l}] connection ${b?"timed out":"failed"} (error; no more retries left)`,F1({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),b?new pA:new ak({cause:p})}let h=[...p.headers.entries()].filter(([y])=>y==="x-request-id").map(([y,b])=>", "+y+": "+JSON.stringify(b)).join(""),g=`[${l}${c}${h}] ${a.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let y=await this.shouldRetry(p);if(r&&y){let E=`retrying, ${r} attempts remaining`;return await vcr(p.body),nd(this).info(`${g} - ${E}`),nd(this).debug(`[${l}] response error (${E})`,F1({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??l,p.headers)}let b=y?"error; no more retries left":"error; not retryable";nd(this).info(`${g} - ${b}`);let _=await p.text().catch(E=>boe(E).message),w=pcr(_),x=w?void 0:_;throw nd(this).debug(`[${l}] response error (${b})`,F1({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:x,durationMs:Date.now()-d})),this.makeStatusError(p.status,w,x,p.headers)}return nd(this).info(g),nd(this).debug(`[${l}] response start`,F1({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 Roe(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 gA(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&&fcr("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=at([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))}:{},...bcr(),"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=at([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:pCe(e)}:xe(this,VCe,"f").call(this,{body:e,headers:n})}};ert=fn,VCe=new WeakMap,Qtt=new WeakSet,_dr=function(){return this.baseURL!=="https://api.openai.com/v1"};fn.OpenAI=ert;fn.DEFAULT_TIMEOUT=6e5;fn.OpenAIError=kt;fn.APIError=Rm;fn.APIConnectionError=ak;fn.APIConnectionTimeoutError=pA;fn.APIUserAbortError=Ic;fn.NotFoundError=UW;fn.ConflictError=zW;fn.RateLimitError=VW;fn.BadRequestError=kW;fn.AuthenticationError=qW;fn.InternalServerError=JW;fn.PermissionDeniedError=BW;fn.UnprocessableEntityError=HW;fn.InvalidWebhookSignatureError=mA;fn.toFile=Ioe;fn.Completions=K2;fn.Chat=dk;fn.Embeddings=G2;fn.Files=X2;fn.Images=tH;fn.Audio=wA;fn.Moderations=nH;fn.Models=rH;fn.FineTuning=$C;fn.Graders=bk;fn.VectorStores=V1;fn.Webhooks=iH;fn.Beta=DC;fn.Batches=U2;fn.Uploads=wk;fn.Responses=vk;fn.Realtime=H1;fn.Conversations=gk;fn.Evals=yk;fn.Containers=hk;fn.Videos=oH});var aH,Pro,vdr=v(()=>{kl();RC();qoe();JCe();aH=class extends fn{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 kt("The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).");if(typeof a=="function"&&(s=!0),!a&&!r)throw new kt("Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.");if(a&&r)throw new kt("The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.");if(u.defaultQuery={...u.defaultQuery,"api-version":n},e){if(o)throw new kt("baseURL and endpoint are mutually exclusive")}else{if(o||(o=process.env.AZURE_OPENAI_ENDPOINT),!o)throw new kt("Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable");e=`${o}/openai`}super({apiKey:a??r,baseURL:e,...u,...s!==void 0?{dangerouslyAllowBrowser:s}:{}}),this.apiVersion="",this.apiVersion=n,this.deploymentName=i}async buildRequest(e,r={}){if(Pro.has(e.path)&&e.method==="post"&&e.body!==void 0){if(!ZW(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"?at([{"api-key":this.apiKey}]):super.authHeaders(e)}},Pro=new Set(["/completions","/chat/completions","/embeddings","/audio/transcriptions","/audio/translations","/audio/speech","/images/generations","/batches","/images/edits"])});var CA=v(()=>{JCe();Met();SCe();JCe();Mu();hA();vdr()});function LC(t,e){if(t.function===void 0)return;let r;if(e?.partial)try{r=UU(t.function.arguments??"{}")}catch{return}else try{r=JSON.parse(t.function.arguments)}catch(o){throw new eh([`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 Sk(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 FC(t,e){return{name:t.function?.name,args:t.function?.arguments,id:t.id,error:e,type:"invalid_tool_call"}}var trt,kC,wdr=v(()=>{pY();V0();yN();O6();yL();f2e();trt=class extends gL{constructor(e){super(e);M(this,"returnId",!1);M(this,"lc_namespace",["langchain","output_parsers","openai_tools"]);M(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(Us(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=>LC(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}},kC=class extends trt{constructor(e){super(e);M(this,"lc_namespace",["langchain","output_parsers","openai_tools"]);M(this,"lc_serializable",!0);M(this,"returnId",!1);M(this,"keyName");M(this,"returnSingle",!1);M(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 sL(this.zodSchema,e);if(r.success)return r.data;throw new eh(`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 Mro,sH=v(()=>{Do();wdr();Mro={};Et(Mro,{JsonOutputKeyToolsParser:()=>kC,JsonOutputToolsParser:()=>trt,convertLangChainToolCallToOpenAI:()=>Sk,makeInvalidToolCall:()=>FC,parseToolCall:()=>LC})});var uH,Hoe=v(()=>{ok();ik();goe();fCe();CA();nl();D1();Wv();xv();_O();sH();Gv();o_();uH=class extends hh{constructor(e){super(e??{});M(this,"temperature");M(this,"topP");M(this,"frequencyPenalty");M(this,"presencePenalty");M(this,"n");M(this,"logitBias");M(this,"model","gpt-3.5-turbo");M(this,"modelKwargs");M(this,"stop");M(this,"stopSequences");M(this,"user");M(this,"timeout");M(this,"streaming",!1);M(this,"streamUsage",!0);M(this,"maxTokens");M(this,"logprobs");M(this,"topLogprobs");M(this,"apiKey");M(this,"organization");M(this,"__includeRawResponse");M(this,"client");M(this,"clientConfig");M(this,"supportsStrictToolCalling");M(this,"audio");M(this,"modalities");M(this,"reasoning");M(this,"zdrEnabled");M(this,"service_tier");M(this,"promptCacheKey");M(this,"verbosity");M(this,"defaultOptions");M(this,"lc_serializable",!0);let r=typeof e?.configuration?.apiKey=="string"?e?.configuration?.apiKey:void 0;this.apiKey=e?.apiKey??r??gn("OPENAI_API_KEY"),this.organization=e?.configuration?.organization??gn("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.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","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(!cA(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&&Ga(e.json_schema.schema)?scr(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=fA(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new fn(i)}return{...this.clientConfig,...e}}_convertChatOpenAIToolToCompletionsTool(e,r){return D2(e)?hlr(e.metadata.customTool):Kv(e)?r?.strict!==void 0?{...e,function:{...e.function,strict:r.strict}}:e:ulr(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=>FW(o)||D2(o)?o: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(dA(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=llr(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}_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=acr(this.model,r?.method);if(u==="jsonMode"){Ga(i)?o=Jw.fromZodSchema(i):o=new Ov;let f=Vi(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:lL(i),schema:i,strict:r?.strict},p=Vi(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}}}),Ga(i)){let m=Jw.fromZodSchema(i);o=i_.from(h=>"parsed"in h.additional_kwargs?h.additional_kwargs.parsed:m)}else o=new Ov}else{let f=a??"extract";if(Ga(i)){let p=Vi(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 kC({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=Vi(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 kC({returnSingle:!0,keyName:f})}}if(!s)return n.pipe(o);let l=xu.assign({parsed:(f,p)=>o.invoke(f.raw,p)}),c=xu.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return El.from([{raw:n},d])}}});function Voe(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
|
||
`,t}var Sdr=v(()=>{});function xA(t){if(!t||typeof t!="object")return t;let e;return t.constructor.name===pA.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=Voe(t,"INVALID_TOOL_RESULTS"):"status"in t&&t.status===401?e=Voe(t,"MODEL_AUTHENTICATION"):"status"in t&&t.status===429?e=Voe(t,"MODEL_RATE_LIMIT"):"status"in t&&t.status===404?e=Voe(t,"MODEL_NOT_FOUND"):e=t,e}var lH=v(()=>{Sdr();CA()});function Rro(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=MC(()=>{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)return{type:"file",file:{file_data:t.data.toString()}};if(t.fileId)return{type:"file",file:{file_id:t.fileId}}}}function Cdr(t,e){let r=dA(t);if(r==="system"&&cA(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"&&Gb.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=Rro(i);a&&(yield a)}}return{role:"user",content:Array.from(n(t.contentBlocks))}}function xdr(t){let e=Us(t)&&t.response_metadata?.model_provider==="openai";function*r(){let n=MC(()=>{try{let y=dA(t);return y==="system"||y==="developer"||y==="assistant"||y==="user"?y:"assistant"}catch{return"assistant"}}),o,i=new Set,a=new Set,s=new Map,u=new Map;function*l(){if(!o)return;let y=o.content;(typeof y=="string"&&y.length>0||Array.isArray(y)&&y.length>0)&&(yield o),o=void 0}let c=y=>{o||(o={type:"message",role:n,content:[]}),typeof o.content=="string"?o.content=o.content.length>0?[{type:"input_text",text:o.content},...y]:[...y]:o.content.push(...y)},d=y=>{if(typeof y=="string")return y;try{return JSON.stringify(y??{})}catch{return"{}"}},f=y=>{let b=MC(()=>{let _=y.metadata?.detail;return _==="low"||_==="high"||_==="auto"?_:"auto"});if(y.fileId)return{type:"input_image",detail:b,file_id:y.fileId};if(y.url)return{type:"input_image",detail:b,image_url:y.url};if(y.data){let _=typeof y.data=="string"?y.data:Buffer.from(y.data).toString("base64"),w=y.mimeType??"image/png";return{type:"input_image",detail:b,image_url:`data:${w};base64,${_}`}}},p=y=>{let b=y.metadata?.filename??y.metadata?.name??y.metadata?.title;if(y.fileId&&typeof b=="string")return{type:"input_file",file_id:y.fileId,...b?{filename:b}:{}};if(y.url&&typeof b=="string")return{type:"input_file",file_url:y.url,...b?{filename:b}:{}};if(y.data&&typeof b=="string"){let _=typeof y.data=="string"?y.data:Buffer.from(y.data).toString("base64");return{type:"input_file",file_data:`data:${y.mimeType??"application/octet-stream"};base64,${_}`,...b?{filename:b}:{}}}},m=y=>{let b=MC(()=>{if(Array.isArray(y.summary)){let O=y.summary?.map(E=>E?.text).filter(E=>typeof E=="string")??[];if(O.length>0)return O}return y.reasoning?[y.reasoning]:[]}),_=b.length>0?b.map(x=>({type:"summary_text",text:x})):[{type:"summary_text",text:""}],w={type:"reasoning",id:y.id??"",summary:_};return y.reasoning&&(w.content=[{type:"reasoning_text",text:y.reasoning}]),w},h=y=>({type:"function_call",name:y.name??"",call_id:y.id??"",arguments:d(y.args)}),g=y=>{let b=d(y.output),_=y.status==="success"?"completed":y.status==="error"?"incomplete":void 0;return{type:"function_call_output",call_id:y.toolCallId??"",output:b,..._?{status:_}:{}}};for(let y of t.contentBlocks)if(y.type==="text")c([{type:"input_text",text:y.text}]);else if(y.type!=="invalid_tool_call"){if(y.type==="reasoning")yield*l(),yield m(y);else if(y.type==="tool_call"){yield*l();let b=y.id??"";b&&(i.add(b),s.delete(b)),yield h(y)}else if(y.type==="tool_call_chunk"){if(y.id){let b=s.get(y.id)??{name:y.name,args:[]};y.name&&(b.name=y.name),y.args&&b.args.push(y.args),s.set(y.id,b)}}else if(y.type==="server_tool_call"){yield*l();let b=y.id??"";b&&(a.add(b),u.delete(b)),yield h(y)}else if(y.type==="server_tool_call_chunk"){if(y.id){let b=u.get(y.id)??{name:y.name,args:[]};y.name&&(b.name=y.name),y.args&&b.args.push(y.args),u.set(y.id,b)}}else if(y.type==="server_tool_call_result")yield*l(),yield g(y);else if(y.type!=="audio")if(y.type==="file"){let b=p(y);b&&c([b])}else if(y.type==="image"){let b=f(y);b&&c([b])}else if(y.type==="video"){let b=p(y);b&&c([b])}else y.type==="text-plain"?y.text&&c([{type:"input_text",text:y.text}]):y.type==="non_standard"&&e&&(yield*l(),yield y.value)}yield*l();for(let[y,b]of s){if(!y||i.has(y))continue;let _=b.args.join("");!b.name&&!_||(yield{type:"function_call",call_id:y,name:b.name??"",arguments:_})}for(let[y,b]of u){if(!y||a.has(y))continue;let _=b.args.join("");!b.name&&!_||(yield{type:"function_call",call_id:y,name:b.name??"",arguments:_})}}return Array.from(r())}var rrt=v(()=>{ok();$s()});function Joe(t,e){return t.flatMap(r=>{if("output_version"in r.response_metadata&&r.response_metadata?.output_version==="v1")return Cdr(r);let n=dA(r);n==="system"&&cA(e)&&(n="developer");let o=typeof r.content=="string"?r.content:r.content.map(a=>Zm(a)?oO(a,nrt):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,i.content=""),Us(r)&&r.tool_calls?.length?(i.tool_calls=r.tool_calls.map(Sk),i.content=""):(r.additional_kwargs.tool_calls!=null&&(i.tool_calls=r.additional_kwargs.tool_calls),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 nrt,Koe=v(()=>{ok();rrt();sH();$s();nrt={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=Hg({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=gY(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=gY(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"){if(!Hg({dataUrl:t.url}))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:t.metadata?.filename||t.metadata?.name}:{}}}}if(t.source_type==="base64")return{type:"file",file:{file_data:`data:${t.mime_type??""};base64,${t.data}`,...t.metadata?.filename||t.metadata?.name||t.metadata?.title?{filename:t.metadata?.filename||t.metadata?.name||t.metadata?.title}:{}}};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`)}}});var A8,KCe,WCe=v(()=>{ok();goe();fCe();Hoe();lH();rrt();Koe();Wv();sH();$s();ym();A8="__openai_function_call_ids__",KCe=class extends uH{invocationParams(t){let e;t?.strict!==void 0?e=t.strict: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:dlr(t?.tool_choice)?t?.tool_choice:(()=>{let o=tCe(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,...this.zdrEnabled?{store:!1}:{},...this.modelKwargs},n=this._getReasoningParams(t);return n!==void 0&&(r.reasoning=n),r}async _generate(t,e){let r=this.invocationParams(e);if(r.stream){let n=this._streamResponseChunks(t,e),o;for await(let i of n)i.message.response_metadata={...i.generationInfo,...i.message.response_metadata},o=o?.concat(i)??i;return{generations:o?[o]:[],llmOutput:{estimatedTokenUsage:o?.message?.usage_metadata}}}else{let n=this._convertMessagesToResponsesParams(t),o=await this.completionWithRetry({input:n,...r,stream:!1},{signal:e?.signal,...e?.options});return{generations:[{text:o.output_text,message:this._convertResponsesMessageToBaseMessage(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:this._convertMessagesToResponsesParams(t),stream:!0},e);for await(let o of n){let i=this._convertResponsesDeltaToBaseMessageChunk(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 xA(n)}})}_convertResponsesMessageToBaseMessage(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(LC(u,{returnId:!0}))}catch(l){let c;typeof l=="object"&&l!=null&&"message"in l&&typeof l.message=="string"&&(c=l.message),o.push(FC(u,c))}a[A8]??(a[A8]={}),s.id&&(a[A8][s.call_id]=s.id)}else if(s.type==="reasoning")a.reasoning=s;else if(s.type==="custom_tool_call"){let u=flr(s);u?n.push(u):o.push(FC(s,"Malformed custom tool call"))}else a.tool_outputs??(a.tool_outputs=[]),a.tool_outputs.push(s);return new li({id:e,content:r,tool_calls:n,invalid_tool_calls:o,usage_metadata:tet(t.usage),additional_kwargs:a,response_metadata:i})}_convertResponsesDeltaToBaseMessageChunk(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[A8]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&["web_search_call","file_search_call","computer_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=this._convertResponsesMessageToBaseMessage(t.response);n=tet(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 Hi({text:e.map(u=>u.text).join(""),message:new Ur({id:s,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:a,response_metadata:i}),generationInfo:r})}_convertMessagesToResponsesParams(t){return t.flatMap(e=>{let r=e.response_metadata;if(r?.output_version==="v1")return xdr(e);let n=e.additional_kwargs,o=dA(e);if(o==="system"&&cA(this.model)&&(o="developer"),o==="function")throw new Error("Function messages are not supported in Responses API");if(o==="tool"){let i=e;return n?.type==="computer_call_output"?{type:"computer_call_output",output:(()=>{if(typeof i.content=="string")return{type:"computer_screenshot",image_url:i.content};if(Array.isArray(i.content)){let s=i.content.find(l=>l.type==="computer_screenshot");if(s)return s;let u=i.content.find(l=>l.type==="image_url");if(u)return{type:"computer_screenshot",image_url:typeof u.image_url=="string"?u.image_url:u.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:i.tool_call_id}:i.additional_kwargs?.customTool?{type:"custom_tool_call_output",call_id:i.tool_call_id,output:i.content}:{type:"function_call_output",call_id:i.tool_call_id,id:i.id?.startsWith("fc_")?i.id:void 0,output:typeof i.content!="string"?JSON.stringify(i.content):i.content}}if(o==="assistant"){if(!this.zdrEnabled&&r?.output!=null&&Array.isArray(r?.output)&&r?.output.length>0&&r?.output.every(c=>"type"in c))return r?.output;let i=[];if(n?.reasoning&&!this.zdrEnabled){let c=this._convertReasoningSummary(n.reasoning);i.push(c)}let{content:a}=e;n?.refusal&&(typeof a=="string"&&(a=[{type:"output_text",text:a,annotations:[]}]),a=[...a,{type:"refusal",refusal:n.refusal}]),(typeof a=="string"||a.length>0)&&i.push({type:"message",role:"assistant",...e.id&&!this.zdrEnabled&&e.id.startsWith("msg_")?{id:e.id}:{},content:MC(()=>typeof a=="string"?a:a.flatMap(c=>c.type==="text"?{type:"output_text",text:c.text,annotations:c.annotations??[]}:c.type==="output_text"||c.type==="refusal"?c:[]))});let s=n?.[A8];Us(e)&&e.tool_calls?.length?i.push(...e.tool_calls.map(c=>plr(c)?{type:"custom_tool_call",id:c.call_id,call_id:c.id??"",input:c.args.input,name:c.name}:{type:"function_call",name:c.name,arguments:JSON.stringify(c.args),call_id:c.id,...this.zdrEnabled?{id:s?.[c.id]}:{}})):n?.tool_calls&&i.push(...n.tool_calls.map(c=>({type:"function_call",name:c.function.name,call_id:c.id,arguments:c.function.arguments,...this.zdrEnabled?{id:s?.[c.id]}:{}})));let u=r?.output?.length?r?.output:n.tool_outputs,l=["computer_call","mcp_call","code_interpreter_call","image_generation_call"];if(u!=null){let d=u?.filter(f=>l.includes(f.type));d.length>0&&i.push(...d)}return i}if(o==="user"||o==="system"||o==="developer"){if(typeof e.content=="string")return{type:"message",role:o,content:e.content};let i=[],a=e.content.flatMap(s=>{if(s.type==="mcp_approval_response"&&i.push({type:"mcp_approval_response",approval_request_id:s.approval_request_id,approve:s.approve}),Zm(s))return oO(s,nrt);if(s.type==="text")return{type:"input_text",text:s.text};if(s.type==="image_url"){let u=MC(()=>{if(typeof s.image_url=="string")return s.image_url;if(typeof s.image_url=="object"&&s.image_url!==null&&"url"in s.image_url)return s.image_url.url}),l=MC(()=>{if(typeof s.image_url=="string")return"auto";if(typeof s.image_url=="object"&&s.image_url!==null&&"detail"in s.image_url)return s.image_url.detail});return{type:"input_image",image_url:u,detail:l}}return s.type==="input_text"||s.type==="input_image"||s.type==="input_file"?s:[]});return a.length>0&&i.push({type:"message",role:o,content:a}),i}return console.warn(`Unsupported role found when converting to OpenAI Responses API: ${o}`),[]})}_convertReasoningSummary(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}}_reduceChatOpenAITools(t,e){let r=[];for(let n of t)if(FW(n))n.type==="image_generation"&&e?.stream&&(n.partial_images=1),r.push(n);else if(D2(n)){let o=n.metadata.customTool;r.push({type:"custom",name:o.name,description:o.description,format:o.format})}else Kv(n)?r.push({type:"function",name:n.function.name,parameters:n.function.parameters,description:n.function.description,strict:e?.strict??null}):rCe(n)&&r.push(mlr(n));return r}}});var Ck,GCe=v(()=>{ok();goe();fCe();Hoe();lH();Koe();sH();$s();ym();Ck=class extends uH{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:tCe(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,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),cA(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=Joe(t,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}:{}},Us(h.message)&&(h.message.usage_metadata=n),h.message=new li(Object.fromEntries(Object.entries(h.message).filter(([g])=>!g.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=Joe(t,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 Hi({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 Hi({message:new Ur({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 xA(o)}})}_convertCompletionsMessageToBaseMessage(t,e){let r=t.tool_calls;switch(t.role){case"assistant":{let n=[],o=[];for(let u of r??[])try{n.push(LC(u,{returnId:!0}))}catch(l){o.push(FC(u,l.message))}let i={function_call:t.function_call,tool_calls:r};this.__includeRawResponse!==void 0&&(i.__raw_response=e);let a={model_provider:"openai",model_name:e.model,...e.system_fingerprint?{usage:{...e.usage},system_fingerprint:e.system_fingerprint}:{}};t.audio&&(i.audio=t.audio);let s=ucr(t.content||"",e.choices?.[0]?.message);return new li({content:s,tool_calls:n,invalid_tool_calls:o,additional_kwargs:i,response_metadata:a,id:e.id})}default:return new cd(t.content||"",t.role??"unknown")}}_convertCompletionsDeltaToBaseMessageChunk(t,e,r){let n=t.role??r,o=t.content??"",i;t.function_call?i={function_call:t.function_call}:t.tool_calls?i={tool_calls:t.tool_calls}:i={},this.__includeRawResponse&&(i.__raw_response=e),t.audio&&(i.audio={...t.audio,index:e.choices[0].index});let a={model_provider:"openai",usage:{...e.usage}};if(n==="user")return new _v({content:o,response_metadata:a});if(n==="assistant"){let s=[];if(Array.isArray(t.tool_calls))for(let u of t.tool_calls)s.push({name:u.function?.name,args:u.function?.arguments,id:u.id,index:u.index,type:"tool_call_chunk"});return new Ur({content:o,tool_call_chunks:s,additional_kwargs:i,id:e.id,response_metadata:a})}else return n==="system"?new Ky({content:o,response_metadata:a}):n==="developer"?new Ky({content:o,response_metadata:a,additional_kwargs:{__openai_role__:"developer"}}):n==="function"?new bv({content:o,additional_kwargs:i,name:t.name,response_metadata:a}):n==="tool"?new Aw({content:o,additional_kwargs:i,tool_call_id:t.tool_call_id,response_metadata:a}):new yv({content:o,role:n,response_metadata:a})}}});var OA,ort=v(()=>{goe();Hoe();WCe();GCe();OA=class Odr extends uH{constructor(r){super(r);M(this,"useResponsesApi",!1);M(this,"responses");M(this,"completions");this.fields=r,this.useResponsesApi=r?.useResponsesApi??!1,this.responses=r?.responses??new KCe(r),this.completions=r?.completions??new Ck(r)}get lc_serializable_keys(){return[...super.lc_serializable_keys,"useResponsesApi"]}get callKeys(){return[...super.callKeys,"useResponsesApi"]}_useResponsesApi(r){let n=r?.tools?.some(FW),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(rCe)||r?.tools?.some(D2);return this.useResponsesApi||n||o||i}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 Odr(this.fields);return n.defaultOptions={...this.defaultOptions,...r},n}}});var ZCe=v(()=>{ik();CA();nl()});var irt=v(()=>{GCe();ZCe()});var art=v(()=>{WCe();ZCe()});var Adr=v(()=>{ort();ZCe();irt();art()});var srt=v(()=>{ik();lH();CA();nl();Wv();ym();loe();tk()});var Idr=v(()=>{ik();srt();CA();nl()});var xk,urt=v(()=>{ik();lH();CA();nl();tk();M2();xk=class extends ES{constructor(e){let r={maxConcurrency:2,...e};super(r);M(this,"model","text-embedding-ada-002");M(this,"modelName");M(this,"batchSize",512);M(this,"stripNewLines",!0);M(this,"dimensions");M(this,"timeout");M(this,"organization");M(this,"encodingFormat");M(this,"client");M(this,"clientConfig");let n=r?.apiKey??r?.openAIApiKey??gn("OPENAI_API_KEY");this.organization=r?.configuration?.organization??gn("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=PS(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=fA(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};i.baseURL||delete i.baseURL,this.client=new fn(i)}let r={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw xA(n)}})}}});var lrt,Ndr=v(()=>{ik();lH();urt();CA();nl();lrt=class extends xk{constructor(e){super(e);M(this,"azureOpenAIApiVersion");M(this,"azureOpenAIApiKey");M(this,"azureADTokenProvider");M(this,"azureOpenAIApiInstanceName");M(this,"azureOpenAIApiDeploymentName");M(this,"azureOpenAIBasePath");this.batchSize=e?.batchSize??1,this.azureOpenAIApiKey=e?.azureOpenAIApiKey??e?.apiKey??gn("AZURE_OPENAI_API_KEY"),this.azureOpenAIApiVersion=e?.azureOpenAIApiVersion??e?.openAIApiVersion??gn("AZURE_OPENAI_API_VERSION"),this.azureOpenAIBasePath=e?.azureOpenAIBasePath??gn("AZURE_OPENAI_BASE_PATH"),this.azureOpenAIApiInstanceName=e?.azureOpenAIApiInstanceName??gn("AZURE_OPENAI_API_INSTANCE_NAME"),this.azureOpenAIApiDeploymentName=(e?.azureOpenAIApiEmbeddingsDeploymentName||e?.azureOpenAIApiDeploymentName)??(gn("AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME")||gn("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=fA(n),i={...this.clientConfig,baseURL:o,timeout:this.timeout,maxRetries:0};this.azureADTokenProvider||(i.apiKey=n.azureOpenAIApiKey),i.baseURL||delete i.baseURL;let a=hoe(i.defaultHeaders);i.defaultHeaders={...i.defaultHeaders,"User-Agent":a["User-Agent"]?`${a["User-Agent"]}: langchainjs-azure-openai-v2`:"langchainjs-azure-openai-v2"},this.client=new aH({apiVersion:this.azureOpenAIApiVersion,azureADTokenProvider:this.azureADTokenProvider,deployment:this.azureOpenAIApiDeploymentName,...i})}let r={};return this.azureOpenAIApiKey&&(r.headers={"api-key":this.azureOpenAIApiKey,...r.headers},r.query={"api-version":this.azureOpenAIApiVersion,...r.query}),this.caller.call(async()=>{try{return await this.client.embeddings.create(e,r)}catch(n){throw xA(n)}})}}});var crt=v(()=>{Zg()});var txe={};Xn(txe,{ZodISODate:()=>YCe,ZodISODateTime:()=>XCe,ZodISODuration:()=>exe,ZodISOTime:()=>QCe,date:()=>frt,datetime:()=>drt,duration:()=>mrt,time:()=>prt});function drt(t){return Pze(XCe,t)}function frt(t){return Mze(YCe,t)}function prt(t){return Rze(QCe,t)}function mrt(t){return Aze(exe,t)}var XCe,YCe,QCe,exe,rxe=v(()=>{Zg();nxe();XCe=we("ZodISODateTime",(t,e)=>{AUe.init(t,e),Hu.init(t,e)});YCe=we("ZodISODate",(t,e)=>{IUe.init(t,e),Hu.init(t,e)});QCe=we("ZodISOTime",(t,e)=>{NUe.init(t,e),Hu.init(t,e)});exe=we("ZodISODuration",(t,e)=>{jUe.init(t,e),Hu.init(t,e)})});var Ddr,$ro,I8,hrt=v(()=>{Zg();Zg();Ddr=(t,e)=>{tQ.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>nQ(t,r)},flatten:{value:r=>rQ(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},$ro=we("ZodError",Ddr),I8=we("ZodError",Ddr,{Parent:Error})});var grt,yrt,brt,_rt,vrt=v(()=>{Zg();hrt();grt=ime(I8),yrt=ame(I8),brt=sme(I8),_rt=ume(I8)});function wrt(t){return Oze(Goe,t)}function Fro(t){return Sme(xrt,t)}function kro(t){return fQ(oxe,t)}function qro(t){return Cme(J1,t)}function Bro(t){return xme(J1,t)}function Uro(t){return Ome(J1,t)}function zro(t){return Tme(J1,t)}function Hro(t){return Eme(Ort,t)}function Vro(t){return Pme(Trt,t)}function Jro(t){return Mme(Ert,t)}function Kro(t){return Rme(Prt,t)}function Wro(t){return Ame(Mrt,t)}function Gro(t){return Ime(Rrt,t)}function Zro(t){return Nme(Art,t)}function Xro(t){return jme(Irt,t)}function Yro(t){return Dme(Nrt,t)}function Qro(t){return $me(jrt,t)}function eno(t){return Lme(Drt,t)}function tno(t){return Fme($rt,t)}function rno(t){return kme(Lrt,t)}function nno(t){return qme(Frt,t)}function ono(t){return Bme(krt,t)}function ino(t){return Ume(qrt,t)}function ano(t,e,r={}){return l4e($dr,t,e,r)}function Ldr(t){return Ize(Zoe,t)}function Srt(t){return jze(N8,t)}function sno(t){return Dze(N8,t)}function uno(t){return $ze(N8,t)}function lno(t){return Lze(N8,t)}function cno(t){return Fze(N8,t)}function Fdr(t){return kze(Xoe,t)}function dno(t){return Bze(Yoe,t)}function fno(t){return zze(Brt,t)}function pno(t){return Hze(Brt,t)}function mno(t){return Vze(kdr,t)}function hno(t){return Jze(qdr,t)}function Udr(t){return Kze(Bdr,t)}function gno(){return Wze(zdr)}function ixe(){return nL(Hdr)}function lxe(t){return pQ(Vdr,t)}function yno(t){return Gze(Jdr,t)}function bno(t){return Zze(cxe,t)}function Urt(t,e){return TQ(Kdr,t,e)}function _no(t){let e=t._zod.def.shape;return nfr(Object.keys(e))}function vno(t,e){let r={type:"object",get shape(){return xt.assignProp(this,"shape",{...t}),this.shape},...xt.normalizeParams(e)};return new dxe(r)}function wno(t,e){return new dxe({type:"object",get shape(){return xt.assignProp(this,"shape",{...t}),this.shape},catchall:lxe(),...xt.normalizeParams(e)})}function Sno(t,e){return new dxe({type:"object",get shape(){return xt.assignProp(this,"shape",{...t}),this.shape},catchall:ixe(),...xt.normalizeParams(e)})}function fxe(t,e){return new zrt({type:"union",options:t,...xt.normalizeParams(e)})}function Cno(t,e,r){return new Wdr({type:"union",options:e,discriminator:t,...xt.normalizeParams(r)})}function Zdr(t,e){return new Gdr({type:"intersection",left:t,right:e})}function xno(t,e,r){let n=e instanceof Yn,o=n?r:e,i=n?e:null;return new Xdr({type:"tuple",items:t,rest:i,...xt.normalizeParams(o)})}function Ydr(t,e,r){return new Hrt({type:"record",keyType:t,valueType:e,...xt.normalizeParams(r)})}function Ono(t,e,r){return new Hrt({type:"record",keyType:fxe([t,lxe()]),valueType:e,...xt.normalizeParams(r)})}function Tno(t,e,r){return new Qdr({type:"map",keyType:t,valueType:e,...xt.normalizeParams(r)})}function Eno(t,e){return new efr({type:"set",valueType:t,...xt.normalizeParams(e)})}function tfr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Woe({type:"enum",entries:r,...xt.normalizeParams(e)})}function Pno(t,e){return new Woe({type:"enum",entries:t,...xt.normalizeParams(e)})}function nfr(t,e){return new rfr({type:"literal",values:Array.isArray(t)?t:[t],...xt.normalizeParams(e)})}function Mno(t){return i4e(ofr,t)}function Jrt(t){return new Vrt({type:"transform",transform:t})}function axe(t){return new Krt({type:"optional",innerType:t})}function sxe(t){return new ifr({type:"nullable",innerType:t})}function Rno(t){return axe(sxe(t))}function sfr(t,e){return new afr({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function lfr(t,e){return new ufr({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function cfr(t,e){return new Wrt({type:"nonoptional",innerType:t,...xt.normalizeParams(e)})}function Ano(t){return new dfr({type:"success",innerType:t})}function pfr(t,e){return new ffr({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function Ino(t){return Yze(mfr,t)}function uxe(t,e){return new Grt({type:"pipe",in:t,out:e})}function gfr(t){return new hfr({type:"readonly",innerType:t})}function Nno(t,e){return new yfr({type:"template_literal",parts:t,...xt.normalizeParams(e)})}function _fr(t){return new bfr({type:"lazy",getter:t})}function jno(t){return new vfr({type:"promise",innerType:t})}function wfr(t){let e=new Ql({check:"custom"});return e._zod.check=t,e}function Dno(t,e){return a4e(pxe,t??(()=>!0),e)}function Sfr(t,e={}){return s4e(pxe,t,e)}function Cfr(t){let e=wfr(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(xt.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(xt.issue(o))}},t(r.value,r)));return e}function $no(t,e={error:`Input not instance of ${t.name}`}){let r=new pxe({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...xt.normalizeParams(e)});return r._zod.bag.Class=t,r}function Fno(t){let e=_fr(()=>fxe([wrt(t),Ldr(),Fdr(),Udr(),Urt(e),Ydr(wrt(),e)]));return e}function kno(t,e){return uxe(Jrt(t),e)}var ci,Crt,Goe,Hu,xrt,oxe,J1,Ort,Trt,Ert,Prt,Mrt,Rrt,Art,Irt,Nrt,jrt,Drt,$rt,Lrt,Frt,krt,qrt,$dr,Zoe,N8,Xoe,Yoe,Brt,kdr,qdr,Bdr,zdr,Hdr,Vdr,Jdr,cxe,Kdr,dxe,zrt,Wdr,Gdr,Xdr,Hrt,Qdr,efr,Woe,rfr,ofr,Vrt,Krt,ifr,afr,ufr,Wrt,dfr,ffr,mfr,Grt,hfr,yfr,bfr,vfr,pxe,Lno,nxe=v(()=>{Zg();Zg();crt();rxe();vrt();ci=we("ZodType",(t,e)=>(Yn.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)=>Kc(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>grt(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>brt(t,r,n),t.parseAsync=async(r,n)=>yrt(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>_rt(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(Sfr(r,n)),t.superRefine=r=>t.check(Cfr(r)),t.overwrite=r=>t.check(hN(r)),t.optional=()=>axe(t),t.nullable=()=>sxe(t),t.nullish=()=>axe(sxe(t)),t.nonoptional=r=>cfr(t,r),t.array=()=>Urt(t),t.or=r=>fxe([t,r]),t.and=r=>Zdr(t,r),t.transform=r=>uxe(t,Jrt(r)),t.default=r=>sfr(t,r),t.prefault=r=>lfr(t,r),t.catch=r=>pfr(t,r),t.pipe=r=>uxe(t,r),t.readonly=()=>gfr(t),t.describe=r=>{let n=t.clone();return Ol.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ol.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ol.get(t);let n=t.clone();return Ol.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Crt=we("_ZodString",(t,e)=>{dz.init(t,e),ci.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(hQ(...n)),t.includes=(...n)=>t.check(bQ(...n)),t.startsWith=(...n)=>t.check(_Q(...n)),t.endsWith=(...n)=>t.check(vQ(...n)),t.min=(...n)=>t.check(oL(...n)),t.max=(...n)=>t.check(f6(...n)),t.length=(...n)=>t.check(p6(...n)),t.nonempty=(...n)=>t.check(oL(1,...n)),t.lowercase=n=>t.check(gQ(n)),t.uppercase=n=>t.check(yQ(n)),t.trim=()=>t.check(CQ()),t.normalize=(...n)=>t.check(SQ(...n)),t.toLowerCase=()=>t.check(xQ()),t.toUpperCase=()=>t.check(OQ())}),Goe=we("ZodString",(t,e)=>{dz.init(t,e),Crt.init(t,e),t.email=r=>t.check(Sme(xrt,r)),t.url=r=>t.check(Eme(Ort,r)),t.jwt=r=>t.check(Ume(qrt,r)),t.emoji=r=>t.check(Pme(Trt,r)),t.guid=r=>t.check(fQ(oxe,r)),t.uuid=r=>t.check(Cme(J1,r)),t.uuidv4=r=>t.check(xme(J1,r)),t.uuidv6=r=>t.check(Ome(J1,r)),t.uuidv7=r=>t.check(Tme(J1,r)),t.nanoid=r=>t.check(Mme(Ert,r)),t.guid=r=>t.check(fQ(oxe,r)),t.cuid=r=>t.check(Rme(Prt,r)),t.cuid2=r=>t.check(Ame(Mrt,r)),t.ulid=r=>t.check(Ime(Rrt,r)),t.base64=r=>t.check(kme(Lrt,r)),t.base64url=r=>t.check(qme(Frt,r)),t.xid=r=>t.check(Nme(Art,r)),t.ksuid=r=>t.check(jme(Irt,r)),t.ipv4=r=>t.check(Dme(Nrt,r)),t.ipv6=r=>t.check($me(jrt,r)),t.cidrv4=r=>t.check(Lme(Drt,r)),t.cidrv6=r=>t.check(Fme($rt,r)),t.e164=r=>t.check(Bme(krt,r)),t.datetime=r=>t.check(drt(r)),t.date=r=>t.check(frt(r)),t.time=r=>t.check(prt(r)),t.duration=r=>t.check(mrt(r))});Hu=we("ZodStringFormat",(t,e)=>{Cu.init(t,e),Crt.init(t,e)}),xrt=we("ZodEmail",(t,e)=>{SUe.init(t,e),Hu.init(t,e)});oxe=we("ZodGUID",(t,e)=>{vUe.init(t,e),Hu.init(t,e)});J1=we("ZodUUID",(t,e)=>{wUe.init(t,e),Hu.init(t,e)});Ort=we("ZodURL",(t,e)=>{CUe.init(t,e),Hu.init(t,e)});Trt=we("ZodEmoji",(t,e)=>{xUe.init(t,e),Hu.init(t,e)});Ert=we("ZodNanoID",(t,e)=>{OUe.init(t,e),Hu.init(t,e)});Prt=we("ZodCUID",(t,e)=>{TUe.init(t,e),Hu.init(t,e)});Mrt=we("ZodCUID2",(t,e)=>{EUe.init(t,e),Hu.init(t,e)});Rrt=we("ZodULID",(t,e)=>{PUe.init(t,e),Hu.init(t,e)});Art=we("ZodXID",(t,e)=>{MUe.init(t,e),Hu.init(t,e)});Irt=we("ZodKSUID",(t,e)=>{RUe.init(t,e),Hu.init(t,e)});Nrt=we("ZodIPv4",(t,e)=>{DUe.init(t,e),Hu.init(t,e)});jrt=we("ZodIPv6",(t,e)=>{$Ue.init(t,e),Hu.init(t,e)});Drt=we("ZodCIDRv4",(t,e)=>{LUe.init(t,e),Hu.init(t,e)});$rt=we("ZodCIDRv6",(t,e)=>{FUe.init(t,e),Hu.init(t,e)});Lrt=we("ZodBase64",(t,e)=>{qUe.init(t,e),Hu.init(t,e)});Frt=we("ZodBase64URL",(t,e)=>{BUe.init(t,e),Hu.init(t,e)});krt=we("ZodE164",(t,e)=>{UUe.init(t,e),Hu.init(t,e)});qrt=we("ZodJWT",(t,e)=>{zUe.init(t,e),Hu.init(t,e)});$dr=we("ZodCustomStringFormat",(t,e)=>{HUe.init(t,e),Hu.init(t,e)});Zoe=we("ZodNumber",(t,e)=>{yme.init(t,e),ci.init(t,e),t.gt=(n,o)=>t.check(mN(n,o)),t.gte=(n,o)=>t.check(e_(n,o)),t.min=(n,o)=>t.check(e_(n,o)),t.lt=(n,o)=>t.check(pN(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(Srt(n)),t.safe=n=>t.check(Srt(n)),t.positive=n=>t.check(mN(0,n)),t.nonnegative=n=>t.check(e_(0,n)),t.negative=n=>t.check(pN(0,n)),t.nonpositive=n=>t.check(kw(0,n)),t.multipleOf=(n,o)=>t.check(pz(n,o)),t.step=(n,o)=>t.check(pz(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});N8=we("ZodNumberFormat",(t,e)=>{VUe.init(t,e),Zoe.init(t,e)});Xoe=we("ZodBoolean",(t,e)=>{iQ.init(t,e),ci.init(t,e)});Yoe=we("ZodBigInt",(t,e)=>{bme.init(t,e),ci.init(t,e),t.gte=(n,o)=>t.check(e_(n,o)),t.min=(n,o)=>t.check(e_(n,o)),t.gt=(n,o)=>t.check(mN(n,o)),t.gte=(n,o)=>t.check(e_(n,o)),t.min=(n,o)=>t.check(e_(n,o)),t.lt=(n,o)=>t.check(pN(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(mN(BigInt(0),n)),t.negative=n=>t.check(pN(BigInt(0),n)),t.nonpositive=n=>t.check(kw(BigInt(0),n)),t.nonnegative=n=>t.check(e_(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(pz(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});Brt=we("ZodBigIntFormat",(t,e)=>{JUe.init(t,e),Yoe.init(t,e)});kdr=we("ZodSymbol",(t,e)=>{KUe.init(t,e),ci.init(t,e)});qdr=we("ZodUndefined",(t,e)=>{WUe.init(t,e),ci.init(t,e)});Bdr=we("ZodNull",(t,e)=>{GUe.init(t,e),ci.init(t,e)});zdr=we("ZodAny",(t,e)=>{ZUe.init(t,e),ci.init(t,e)});Hdr=we("ZodUnknown",(t,e)=>{rL.init(t,e),ci.init(t,e)});Vdr=we("ZodNever",(t,e)=>{aQ.init(t,e),ci.init(t,e)});Jdr=we("ZodVoid",(t,e)=>{XUe.init(t,e),ci.init(t,e)});cxe=we("ZodDate",(t,e)=>{YUe.init(t,e),ci.init(t,e),t.min=(n,o)=>t.check(e_(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});Kdr=we("ZodArray",(t,e)=>{sQ.init(t,e),ci.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(oL(r,n)),t.nonempty=r=>t.check(oL(1,r)),t.max=(r,n)=>t.check(f6(r,n)),t.length=(r,n)=>t.check(p6(r,n)),t.unwrap=()=>t.element});dxe=we("ZodObject",(t,e)=>{QUe.init(t,e),ci.init(t,e),xt.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>tfr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ixe()}),t.loose=()=>t.clone({...t._zod.def,catchall:ixe()}),t.strict=()=>t.clone({...t._zod.def,catchall:lxe()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>xt.extend(t,r),t.merge=r=>xt.merge(t,r),t.pick=r=>xt.pick(t,r),t.omit=r=>xt.omit(t,r),t.partial=(...r)=>xt.partial(Krt,t,r[0]),t.required=(...r)=>xt.required(Wrt,t,r[0])});zrt=we("ZodUnion",(t,e)=>{_me.init(t,e),ci.init(t,e),t.options=e.options});Wdr=we("ZodDiscriminatedUnion",(t,e)=>{zrt.init(t,e),eze.init(t,e)});Gdr=we("ZodIntersection",(t,e)=>{tze.init(t,e),ci.init(t,e)});Xdr=we("ZodTuple",(t,e)=>{fz.init(t,e),ci.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});Hrt=we("ZodRecord",(t,e)=>{rze.init(t,e),ci.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});Qdr=we("ZodMap",(t,e)=>{nze.init(t,e),ci.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});efr=we("ZodSet",(t,e)=>{oze.init(t,e),ci.init(t,e),t.min=(...r)=>t.check(mz(...r)),t.nonempty=r=>t.check(mz(1,r)),t.max=(...r)=>t.check(d6(...r)),t.size=(...r)=>t.check(mQ(...r))});Woe=we("ZodEnum",(t,e)=>{ize.init(t,e),ci.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 Woe({...e,checks:[],...xt.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 Woe({...e,checks:[],...xt.normalizeParams(o),entries:i})}});rfr=we("ZodLiteral",(t,e)=>{aze.init(t,e),ci.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]}})});ofr=we("ZodFile",(t,e)=>{sze.init(t,e),ci.init(t,e),t.min=(r,n)=>t.check(mz(r,n)),t.max=(r,n)=>t.check(d6(r,n)),t.mime=(r,n)=>t.check(wQ(Array.isArray(r)?r:[r],n))});Vrt=we("ZodTransform",(t,e)=>{uQ.init(t,e),ci.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=i=>{if(typeof i=="string")r.issues.push(xt.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(xt.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});Krt=we("ZodOptional",(t,e)=>{l6.init(t,e),ci.init(t,e),t.unwrap=()=>t._zod.def.innerType});ifr=we("ZodNullable",(t,e)=>{uze.init(t,e),ci.init(t,e),t.unwrap=()=>t._zod.def.innerType});afr=we("ZodDefault",(t,e)=>{lze.init(t,e),ci.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});ufr=we("ZodPrefault",(t,e)=>{cze.init(t,e),ci.init(t,e),t.unwrap=()=>t._zod.def.innerType});Wrt=we("ZodNonOptional",(t,e)=>{dze.init(t,e),ci.init(t,e),t.unwrap=()=>t._zod.def.innerType});dfr=we("ZodSuccess",(t,e)=>{fze.init(t,e),ci.init(t,e),t.unwrap=()=>t._zod.def.innerType});ffr=we("ZodCatch",(t,e)=>{pze.init(t,e),ci.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});mfr=we("ZodNaN",(t,e)=>{mze.init(t,e),ci.init(t,e)});Grt=we("ZodPipe",(t,e)=>{lQ.init(t,e),ci.init(t,e),t.in=e.in,t.out=e.out});hfr=we("ZodReadonly",(t,e)=>{hze.init(t,e),ci.init(t,e)});yfr=we("ZodTemplateLiteral",(t,e)=>{gze.init(t,e),ci.init(t,e)});bfr=we("ZodLazy",(t,e)=>{bze.init(t,e),ci.init(t,e),t.unwrap=()=>t._zod.def.getter()});vfr=we("ZodPromise",(t,e)=>{yze.init(t,e),ci.init(t,e),t.unwrap=()=>t._zod.def.innerType});pxe=we("ZodCustom",(t,e)=>{_ze.init(t,e),ci.init(t,e)});Lno=(...t)=>u4e({Pipe:Grt,Boolean:Xoe,String:Goe,Transform:Vrt},...t)});function Bno(t){fd({customError:t})}function Uno(){return fd().customError}var qno,xfr=v(()=>{Zg();qno={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 Zrt={};Xn(Zrt,{bigint:()=>Jno,boolean:()=>Vno,date:()=>Kno,number:()=>Hno,string:()=>zno});function zno(t){return Tze(Goe,t)}function Hno(t){return Nze(Zoe,t)}function Vno(t){return qze(Xoe,t)}function Jno(t){return Uze(Yoe,t)}function Kno(t){return Xze(cxe,t)}var Ofr=v(()=>{Zg();nxe()});var mxe={};Xn(mxe,{$brand:()=>aBe,$input:()=>Cze,$output:()=>Sze,NEVER:()=>iBe,TimePrecision:()=>Eze,ZodAny:()=>zdr,ZodArray:()=>Kdr,ZodBase64:()=>Lrt,ZodBase64URL:()=>Frt,ZodBigInt:()=>Yoe,ZodBigIntFormat:()=>Brt,ZodBoolean:()=>Xoe,ZodCIDRv4:()=>Drt,ZodCIDRv6:()=>$rt,ZodCUID:()=>Prt,ZodCUID2:()=>Mrt,ZodCatch:()=>ffr,ZodCustom:()=>pxe,ZodCustomStringFormat:()=>$dr,ZodDate:()=>cxe,ZodDefault:()=>afr,ZodDiscriminatedUnion:()=>Wdr,ZodE164:()=>krt,ZodEmail:()=>xrt,ZodEmoji:()=>Trt,ZodEnum:()=>Woe,ZodError:()=>$ro,ZodFile:()=>ofr,ZodGUID:()=>oxe,ZodIPv4:()=>Nrt,ZodIPv6:()=>jrt,ZodISODate:()=>YCe,ZodISODateTime:()=>XCe,ZodISODuration:()=>exe,ZodISOTime:()=>QCe,ZodIntersection:()=>Gdr,ZodIssueCode:()=>qno,ZodJWT:()=>qrt,ZodKSUID:()=>Irt,ZodLazy:()=>bfr,ZodLiteral:()=>rfr,ZodMap:()=>Qdr,ZodNaN:()=>mfr,ZodNanoID:()=>Ert,ZodNever:()=>Vdr,ZodNonOptional:()=>Wrt,ZodNull:()=>Bdr,ZodNullable:()=>ifr,ZodNumber:()=>Zoe,ZodNumberFormat:()=>N8,ZodObject:()=>dxe,ZodOptional:()=>Krt,ZodPipe:()=>Grt,ZodPrefault:()=>ufr,ZodPromise:()=>vfr,ZodReadonly:()=>hfr,ZodRealError:()=>I8,ZodRecord:()=>Hrt,ZodSet:()=>efr,ZodString:()=>Goe,ZodStringFormat:()=>Hu,ZodSuccess:()=>dfr,ZodSymbol:()=>kdr,ZodTemplateLiteral:()=>yfr,ZodTransform:()=>Vrt,ZodTuple:()=>Xdr,ZodType:()=>ci,ZodULID:()=>Rrt,ZodURL:()=>Ort,ZodUUID:()=>J1,ZodUndefined:()=>qdr,ZodUnion:()=>zrt,ZodUnknown:()=>Hdr,ZodVoid:()=>Jdr,ZodXID:()=>Art,_ZodString:()=>Crt,_default:()=>sfr,any:()=>gno,array:()=>Urt,base64:()=>rno,base64url:()=>nno,bigint:()=>dno,boolean:()=>Fdr,catch:()=>pfr,check:()=>wfr,cidrv4:()=>eno,cidrv6:()=>tno,clone:()=>Kc,coerce:()=>Zrt,config:()=>fd,core:()=>gN,cuid:()=>Kro,cuid2:()=>Wro,custom:()=>Dno,date:()=>bno,discriminatedUnion:()=>Cno,e164:()=>ono,email:()=>Fro,emoji:()=>Vro,endsWith:()=>vQ,enum:()=>tfr,file:()=>Mno,flattenError:()=>rQ,float32:()=>sno,float64:()=>uno,formatError:()=>nQ,function:()=>d4e,getErrorMap:()=>Uno,globalRegistry:()=>Ol,gt:()=>mN,gte:()=>e_,guid:()=>kro,includes:()=>bQ,instanceof:()=>$no,int:()=>Srt,int32:()=>lno,int64:()=>fno,intersection:()=>Zdr,ipv4:()=>Yro,ipv6:()=>Qro,iso:()=>txe,json:()=>Fno,jwt:()=>ino,keyof:()=>_no,ksuid:()=>Xro,lazy:()=>_fr,length:()=>p6,literal:()=>nfr,locales:()=>dQ,looseObject:()=>Sno,lowercase:()=>gQ,lt:()=>pN,lte:()=>kw,map:()=>Tno,maxLength:()=>f6,maxSize:()=>d6,mime:()=>wQ,minLength:()=>oL,minSize:()=>mz,multipleOf:()=>pz,nan:()=>Ino,nanoid:()=>Jro,nativeEnum:()=>Pno,negative:()=>e4e,never:()=>lxe,nonnegative:()=>r4e,nonoptional:()=>cfr,nonpositive:()=>t4e,normalize:()=>SQ,null:()=>Udr,nullable:()=>sxe,nullish:()=>Rno,number:()=>Ldr,object:()=>vno,optional:()=>axe,overwrite:()=>hN,parse:()=>grt,parseAsync:()=>yrt,partialRecord:()=>Ono,pipe:()=>uxe,positive:()=>Qze,prefault:()=>lfr,preprocess:()=>kno,prettifyError:()=>_Be,promise:()=>jno,property:()=>n4e,readonly:()=>gfr,record:()=>Ydr,refine:()=>Sfr,regex:()=>hQ,regexes:()=>cz,registry:()=>wme,safeParse:()=>brt,safeParseAsync:()=>_rt,set:()=>Eno,setErrorMap:()=>Bno,size:()=>mQ,startsWith:()=>_Q,strictObject:()=>wno,string:()=>wrt,stringFormat:()=>ano,stringbool:()=>Lno,success:()=>Ano,superRefine:()=>Cfr,symbol:()=>mno,templateLiteral:()=>Nno,toJSONSchema:()=>iL,toLowerCase:()=>xQ,toUpperCase:()=>OQ,transform:()=>Jrt,treeifyError:()=>bBe,trim:()=>CQ,tuple:()=>xno,uint32:()=>cno,uint64:()=>pno,ulid:()=>Gro,undefined:()=>hno,union:()=>fxe,unknown:()=>ixe,uppercase:()=>yQ,url:()=>Hro,uuid:()=>qro,uuidv4:()=>Bro,uuidv6:()=>Uro,uuidv7:()=>zro,void:()=>yno,xid:()=>Zro});var Xrt=v(()=>{Zg();nxe();crt();hrt();vrt();xfr();Zg();vze();Zg();wze();rxe();rxe();Ofr();fd(vme())});var Tfr=v(()=>{Xrt();Xrt()});var Efr=v(()=>{Tfr()});function Zno(t,e){let r=h6(e.schema),n=x6(e.schema);if(!e.schema||r||n)return new ent({...e,description:e.description??e.schema?.description??`${e.name} tool`,func:async(a,s,u)=>new Promise((l,c)=>{let d=zs(u,{callbacks:s?.getChild()});Qm.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 Pfr({...e,description:i,schema:o,func:async(a,s,u)=>new Promise((l,c)=>{u?.signal&&u.signal.addEventListener("abort",()=>c(Y$(u.signal)));let d=zs(u,{callbacks:s?.getChild()});Qm.runWithConfig(Yy(d),async()=>{try{let f=await t(a,d);if(u?.signal?.aborted)return;l(f)}catch(f){c(f)}})})})}function Xno(t){let{content:e,artifact:r,toolCallId:n,metadata:o}=t;return n&&!bY(e)?typeof e=="string"||Array.isArray(e)&&e.every(i=>typeof i=="object")?new Gb({status:"success",content:e,artifact:r,tool_call_id:n,name:t.name,metadata:o}):new Gb({status:"success",content:Yno(e),artifact:r,tool_call_id:n,name:t.name,metadata:o}):e}function Yno(t){try{return JSON.stringify(t,null,2)??""}catch{return`${t}`}}var Wno,Yrt,Qrt,ent,Pfr,Gno,tnt=v(()=>{Do();X3();$fe();X$();tz();rz();uO();UY();yN();o_();Wv();DYe();yO();phe();Efr();Wno={};Et(Wno,{BaseToolkit:()=>Gno,DynamicStructuredTool:()=>Pfr,DynamicTool:()=>ent,StructuredTool:()=>Yrt,Tool:()=>Qrt,ToolInputParsingException:()=>K3,isLangChainTool:()=>mg,isRunnableToolLike:()=>aoe,isStructuredTool:()=>ioe,isStructuredToolParams:()=>soe,tool:()=>Zno});Yrt=class extends jW{constructor(e){super(e??{});M(this,"returnDirect",!1);M(this,"verboseParsingErrors",!1);M(this,"responseFormat","content");M(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}get lc_namespace(){return["langchain","tools"]}async invoke(e,r){let n,o=Jo(nz(this.defaultConfig,r));return J$(e)?(n=e.args,o={...o,toolCall:e}):n=e,this.call(n,o)}async call(e,r,n){let o=J$(e)?e.args:e,i;if(Ga(this.schema))try{i=await uL(this.schema,o)}catch(m){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
|
||
Details: ${m.message}`),m instanceof Error&&m.constructor.name==="ZodError"&&(h=`${h}
|
||
|
||
${mxe.prettifyError(m)}`),new K3(h,JSON.stringify(e))}else{let m=Fu(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(g=>`${g.keywordLocation}: ${g.error}`).join(`
|
||
`)}`),new K3(h,JSON.stringify(e))}i=o}let a=lN(r),u=await Yl.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;J$(e)&&(f=e.id),!f&&ySt(a)&&(f=a.toolCall.id);let p=Xno({content:c,artifact:d,toolCallId:f,name:this.name,metadata:this.metadata});return await u?.handleToolEnd(p),p}},Qrt=class extends Yrt{constructor(e){super(e);M(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)}},ent=class extends Qrt{constructor(e){super(e);M(this,"name");M(this,"description");M(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=lN(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)}},Pfr=class extends Yrt{constructor(e){super(e);M(this,"name");M(this,"description");M(this,"func");M(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=lN(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)}},Gno=class{getTools(){return this.tools}}});var rnt=v(()=>{CA();nl();tnt()});var Mfr=v(()=>{rnt()});var Rfr=v(()=>{xv();tnt();rz()});var Afr=v(()=>{Koe()});var cH=v(()=>{ok();ik();Hoe();lH();Koe();WCe();GCe();ort();irt();art();Adr();srt();Idr();urt();Ndr();rnt();Mfr();Rfr();Afr();CA()});var Nfr=S((oja,Ifr)=>{Ifr.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 Qno,eoo,jfr,Dfr=v(()=>{Qno=L(Nfr(),1),eoo=Object.defineProperty,jfr=(t,e)=>{for(var r in e)eoo(t,r,{get:e[r],enumerable:!0})}});var too,nnt,$fr=v(()=>{Dfr();nl();M2();tk();too={};jfr(too,{JinaEmbeddings:()=>nnt});nnt=class extends ES{constructor(e){let r={maxConcurrency:2,...e};super(r);M(this,"model","jina-clip-v2");M(this,"batchSize",24);M(this,"baseUrl","https://api.jina.ai/v1/embeddings");M(this,"stripNewLines",!0);M(this,"dimensions",1024);M(this,"apiKey");M(this,"normalized",!0);let n=r?.apiKey||gn("JINA_API_KEY")||gn("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=PS(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 hxe,Lfr=v(()=>{$fr();hxe=class extends nnt{constructor(e){super(e),e?.baseUrl&&(this.baseUrl=e.baseUrl)}}});var Qoe,Ffr=v(()=>{cH();Qoe=class extends xk{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 gxe,roo,wd,dH=v(()=>{zr();zz();MN();Pt();wr();zYe();rQe();yQe();cH();gxe=require("obsidian");RS();Lfr();Ffr();roo={"copilot-plus":Qoe,"copilot-plus-jina":hxe,openai:xk,cohereai:UYe,google:tQe,"azure openai":lrt,ollama:gQe,"lm-studio":Qoe,"3rd party (openai-format)":xk},wd=class t{constructor(){this.providerApiKeyMap={"copilot-plus":()=>ce().plusLicenseKey,"copilot-plus-jina":()=>ce().plusLicenseKey,openai:()=>ce().openAIApiKey,cohereai:()=>ce().cohereApiKey,google:()=>ce().googleApiKey,"azure openai":()=>ce().azureOpenAIApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key"};this.initialize(),Ou(()=>this.initialize())}initialize(){let e=ce().activeEmbeddingModels;this.activeEmbeddingModels=e,this.buildModelMap(e)}static getInstance(){return t.instance||(t.instance=new t),t.instance}getProviderConstructor(e){let r=roo[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(vL).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=Qn(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=Qn(r);return e===n})[0]}async getEmbeddingsAPI(){let{embeddingModelKey:e}=ce();if(!t.modelMap.hasOwnProperty(e))throw new Po(`No embedding model found for: ${e}`);let r=this.getCustomModel(e);if(r.plusExclusive&&!ce().isPlusUser)throw new gxe.Notice("Plus-only model, please consider upgrading to Plus to access it."),new Po("Plus-only model selected but user is not on Plus plan");if(r.believerExclusive){let a=await Ru.getInstance().validateLicenseKey();if(!a.plan||a.plan.toLowerCase()!=="believer")throw new gxe.Notice("Believer-only model, please consider upgrading to Believer to access it."),new Po("Believer-only model selected but user is not on Believer plan")}let n=t.modelMap[e];if(!n.hasApiKey)throw new Po(`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 Po(`Error creating embedding model: ${e}. ${i.message}`)}}async getEmbeddingConfig(e){let r=ce(),n=e.name,o={maxRetries:3,maxConcurrency:3},a={"copilot-plus":{modelName:n,apiKey:await $i(r.plusLicenseKey),timeout:1e4,batchSize:ce().embeddingBatchSize,configuration:{baseURL:Fz,fetch:e.enableCors?Wc:void 0}},"copilot-plus-jina":{model:n,apiKey:await $i(r.plusLicenseKey),timeout:1e4,batchSize:ce().embeddingBatchSize,dimensions:e.dimensions,baseUrl:Fz+"/embeddings",configuration:{fetch:e.enableCors?Wc:void 0}},openai:{modelName:n,apiKey:await $i(e.apiKey||r.openAIApiKey),timeout:1e4,batchSize:ce().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Wc:void 0}},cohereai:{model:n,apiKey:await $i(e.apiKey||r.cohereApiKey)},google:{modelName:n,apiKey:await $i(r.googleApiKey)},"azure openai":{modelName:n,azureOpenAIApiKey:await $i(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 $i(e.apiKey||"default-key")}`}},"lm-studio":{modelName:n,openAIApiKey:await $i(e.apiKey||"default-key"),configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Wc:void 0}},"3rd party (openai-format)":{modelName:n,openAIApiKey:await $i(e.apiKey||""),batchSize:ce().embeddingBatchSize,configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Wc:void 0,dangerouslyAllowBrowser:!0}}}[e.provider]||{};return{...o,...a}}async ping(e){let r=async n=>{let o={...e,enableCors:n},i=await this.getEmbeddingConfig(o);await new(this.getProviderConstructor(o))(i).embedQuery("test")};try{return await r(!1),!0}catch(n){console.log("First ping attempt failed, trying with CORS...");try{return await r(!0),new gxe.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: `+Eo(n)+`
|
||
with CORS Error: `+Eo(o);throw new Error(i)}}}}});function Bfr(t){return t!==void 0&&eie.includes(t)?kfr[t]:void 0}var kfr,qfr,eie,yxe=v(()=>{kfr={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"},qfr={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},eie=Object.keys(kfr)});function Au(t,e){if(e.length<ont)Array.prototype.push.apply(t,e);else{let r=e.length;for(let n=0;n<r;n+=ont)Array.prototype.push.apply(t,e.slice(n,n+ont))}}function Jfr(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 ioo(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function aoo(){return typeof process<"u"&&process.release&&process.release.name==="node"}function Vfr(){return BigInt(Math.floor(performance.now()*1e6))}function fH(t){return typeof t=="number"&&(t=BigInt(t)),t<Ufr?`${t}ns`:t<zfr?`${t/Ufr}\u03BCs`:t<Hfr?`${t/zfr}ms`:`${t/Hfr}s`}function qC(){return ioo()?Vfr():aoo()||typeof process<"u"&&typeof process?.hrtime?.bigint=="function"?process.hrtime.bigint():typeof performance<"u"?Vfr():BigInt(0)}function tie(){return`${noo}-${ooo++}`}function j8(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 Kfr(t,e){return e[1]===t[1]?t[0]-e[0]:e[1]-t[1]}function D8(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 bxe(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 $8(t,e){return bxe(t,[e])[e]}function int(t,e){let r=soo[e];if(r===void 0)throw new Error(jr("INVALID_DISTANCE_SUFFIX",t).message);return t*r}function _xe(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 Sd(t){return t?.constructor?.name==="AsyncFunction"}var noo,ooo,Ufr,zfr,Hfr,ont,soo,od=v(()=>{bh();noo=Date.now().toString().slice(5),ooo=0,Ufr=BigInt(1e3),zfr=BigInt(1e6),Hfr=BigInt(1e9),ont=65535;soo={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344}});function jr(t,...e){let r=new Error(Jfr(loo[t]??`Unsupported Orama Error code: ${t}`,...e));return r.code=t,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(r),r}var uoo,loo,bh=v(()=>{yxe();od();uoo=eie.join(`
|
||
- `),loo={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:
|
||
- ${uoo}`,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 Wfr(t){return{raw:Number(t),formatted:fH(t)}}function Gfr(t){if(t.id){if(typeof t.id!="string")throw jr("DOCUMENT_ID_MUST_BE_STRING",typeof t.id);return t.id}return tie()}function ant(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(K1(n)){let i=unt(n);if(!Array.isArray(o)||o.length!==i)throw jr("INVALID_INPUT_VECTOR",r,i,o.length);continue}if(L8(n)){if(!Array.isArray(o))return r;let i=snt(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=ant(o,n);if(i)return r+"."+i;continue}if(typeof o!==n)return r}}}function Zfr(t){return t==="geopoint"}function K1(t){return typeof t=="string"&&/^vector\[\d+\]$/.test(t)}function L8(t){return typeof t=="string"&&coo[t]}function snt(t){return doo[t]}function unt(t){let e=Number(t.slice(7,-1));switch(!0){case isNaN(e):throw jr("INVALID_VECTOR_VALUE",t);case e<=0:throw jr("INVALID_VECTOR_SIZE",t);default:return e}}var coo,doo,rie=v(()=>{bh();od();od();coo={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},doo={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"}});function Xfr(){return{idToInternalId:new Map,internalIdToId:[],save:foo,load:poo}}function foo(t){return{internalIdToId:t.internalIdToId}}function poo(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 ru(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?ru(t,e.toString()):e}function AS(t,e){if(t.internalIdToId.length<e)throw new Error(`Invalid internalId ${e}`);return t.internalIdToId[e-1]}var IS=v(()=>{});function hoo(t,e){return{sharedInternalDocumentStore:e,docs:{},count:0}}function goo(t,e){let r=ru(t.sharedInternalDocumentStore,e);return t.docs[r]}function yoo(t,e){let r=e.length,n=Array.from({length:r});for(let o=0;o<r;o++){let i=ru(t.sharedInternalDocumentStore,e[o]);n[o]=t.docs[i]}return n}function boo(t){return t.docs}function _oo(t,e,r){let n=ru(t.sharedInternalDocumentStore,e);return typeof t.docs[n]<"u"?!1:(t.docs[n]=r,t.count++,!0)}function voo(t,e){let r=ru(t.sharedInternalDocumentStore,e);return typeof t.docs[r]>"u"?!1:(delete t.docs[r],t.count--,!0)}function woo(t){return t.count}function Soo(t,e){let r=e;return{docs:r.docs,count:r.count,sharedInternalDocumentStore:t}}function Coo(t){return{docs:t.docs,count:t.count}}function Yfr(){return{create:hoo,get:goo,getMultiple:yoo,getAll:boo,store:_oo,remove:voo,count:woo,load:Soo,save:Coo}}var lnt=v(()=>{IS()});function epr(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),jr("PLUGIN_CRASHED")}return r}var Qfr,tpr=v(()=>{bh();Qfr=["beforeInsert","afterInsert","beforeRemove","afterRemove","beforeUpdate","afterUpdate","beforeSearch","afterSearch","beforeInsertMultiple","afterInsertMultiple","beforeRemoveMultiple","afterRemoveMultiple","beforeUpdateMultiple","afterUpdateMultiple","beforeLoad","afterLoad","afterCreate"]});function BC(t,e,r,n){if(t.some(Sd))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function pH(t,e,r){if(t.some(Sd))return(async()=>{for(let o of t)await o(e,r)})();for(let o of t)o(e,r)}function F8(t,e,r,n,o){if(t.some(Sd))return(async()=>{for(let a of t)await a(e,r,n,o)})();for(let a of t)a(e,r,n,o)}function k8(t,e,r,n){if(t.some(Sd))return(async()=>{for(let i of t)await i(e,r,n)})();for(let i of t)i(e,r,n)}function npr(t,e){if(t.some(Sd))return(async()=>{for(let n of t)await n(e)})();for(let n of t)n(e)}var rpr,cnt,Ok=v(()=>{od();rpr=["tokenizer","index","documentsStore","sorter"],cnt=["validateSchema","getDocumentIndexId","getDocumentProperties","formatElapsedTime"]});function dnt(t){let e=t.r;return t.r=e.l,e.l=t,t.h=Math.max(NS(t.l),NS(t.r))+1,e.h=Math.max(NS(e.l),NS(e.r))+1,e}function fnt(t){let e=t.l;return t.l=e.r,e.r=t,t.h=Math.max(NS(t.l),NS(t.r))+1,e.h=Math.max(NS(e.l),NS(e.r))+1,e}function ipr(t,e,r){let n=[];function o(i){i!==null&&(e<i.k&&o(i.l),i.k>=e&&i.k<=r&&Au(n,i.v),r>i.k&&o(i.r))}return o(t.root),n}function pnt(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&&Au(n,i.v),!r&&i.k>e&&Au(n,i.v),o.push(i.r),o.push(i.l))}return n}function mnt(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&&Au(n,i.v),!r&&i.k<e&&Au(n,i.v),o.push(i.r),o.push(i.l))}return n}function apr(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 spr(t,e){return{root:{k:t,v:e,l:null,r:null,h:0}}}function upr(t,e,r,n=500){function o(i,a,s){if(i===null)return opr++,{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 opr%n===0?Ooo(i,a):i}t.root=o(t.root,e,r)}function Ooo(t,e){t.h=1+Math.max(NS(t.l),NS(t.r));let r=NS(t.l)-NS(t.r);return r>1&&e<t.l.k?fnt(t):r<-1&&e>t.r.k?dnt(t):r>1&&e>t.l.k?(t.l=dnt(t.l),fnt(t)):r<-1&&e<t.r.k?(t.r=fnt(t.r),dnt(t)):t}function NS(t){return t!==null?t.h:-1}function lpr(t,e){let r=apr(t.root,e);return r===null?null:r.v}function Too(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 cpr(t,e,r){let n=apr(t.root,r);if(n){if(n.v.length===1){Too(t,r);return}n.v.splice(n.v.indexOf(e),1)}}var opr,dpr=v(()=>{od();opr=0});function fpr(){return{numberToDocumentId:new Map}}function ppr(t,e,r){return t.numberToDocumentId.has(e)?(t.numberToDocumentId.get(e).push(r),t):(t.numberToDocumentId.set(e,[r]),t)}function mpr(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 hpr(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&&Au(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&&Au(i,u)}return i}}throw new Error("Invalid operation")}function gpr(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 D8(i)}}throw new Error("Invalid operation")}var ypr=v(()=>{od()});function Eoo(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=Eoo(t,e,r);return{distance:n,isBounded:n>=0}}var gnt=v(()=>{});function q8(t,e){t.w=e.w+t.s}function vxe(t,e){t.d.push(e)}function Poo(t,e){let r=t.d.indexOf(e);return r===-1?!1:(t.d.splice(r,1),!0)}function bnt(t,e,r,n,o){if(t.e){let{w:i,d:a}=t;if(n&&i!==r)return{};if(j8(e,i)==null&&(o?Math.abs(r.length-i.length)<=o&&hnt(r,i,o).isBounded&&(e[i]=[]):e[i]=[]),j8(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))bnt(t.c[i],e,r,n,o);return e}function bpr(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 mH(t=!1,e="",r=""){return new ynt(r,e,t)}function _pr(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=bpr(u,a),d=c.length;if(u===a){vxe(s,r),s.e=!0;return}let f=u[d];if(d<l&&d===a.length){let p=mH(!0,a,i);p.c[f]=s;let m=p.c[f];m.s=u.substring(d),m.k=f,t.c[i]=p,q8(p,t),q8(m,p),vxe(p,r);return}if(d<l&&d<a.length){let p=mH(!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],g=mH(!0,e.substring(o+d),h);vxe(g,r),p.c[h]=g,q8(p,t),q8(g,p),q8(m,p);return}o+=l-1,t=s}else{let u=mH(!0,a,i);vxe(u,r),t.c[i]=u,q8(u,t);return}}}function nie(t,e,r,n,o,i){if(!(n<0)){if(t.w.startsWith(e)){bnt(t,i,e,!1,0);return}if(t.e){let{w:a,d:s}=t;if(a&&(hnt(e,a,o).isBounded&&(i[a]=[]),j8(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&&nie(t.c[e[r]],e,r+1,n,o,i),nie(t,e,r+1,n-1,o,i);for(let a in t.c)nie(t.c[a],e,r,n-1,o,i);for(let a in t.c)a!==e[r]&&nie(t.c[a],e,r+1,n-1,o,i)}}}function _nt(t,{term:e,exact:r,tolerance:n}){if(n&&!r){let o={};return n=n||0,nie(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=bpr(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 bnt(t,i,e,r,n),i}}function vpr(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||Poo(t,r)}else return!1}return!0}var ynt,wpr=v(()=>{gnt();od();ynt=class{constructor(e,r,n){M(this,"k");M(this,"s");M(this,"c",{});M(this,"d",[]);M(this,"e");M(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 Spr(){return{root:null}}function Cpr(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 xpr(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 Opr(t,e,r,n=!0,o="asc",i=!1){let a=i?Ppr:Epr,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 Tpr(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=Roo(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=Moo(e);if(n){let u=o?Ppr:Epr;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 Moo(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 Roo(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 Epr(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 Ppr(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,g,y=1e3,b,_,w,x,O;do{let F=Math.sin(h),B=Math.cos(h);w=Math.sqrt(m*F*(m*F)+(f*p-d*m*B)*(f*p-d*m*B)),x=d*p+f*m*B,O=Math.atan2(w,x),b=f*m*F/w,_=1-b*b;let U=x-2*d*p/_,H=n/16*_*(4+n*(4-3*_));g=h,h=u+(1-H)*n*b*(O+H*w*(U+H*x*(-1+2*U*U)))}while(Math.abs(h-g)>1e-12&&--y>0);let E=_*(6378137*6378137-o*o)/(o*o),T=1+E/16384*(4096+E*(-768+E*(320-175*E))),R=E/1024*(256+E*(-128+E*(74-47*E))),N=R*w*(x-2*d*p/_+R/4*(x*(-1+2*w*w)-R/6*O*(-3+4*w*w)*(-3+4*O*O)));return o*T*(O-N)}var Mpr=v(()=>{});function wxe(t,e,r=0,n){if(e===0)throw jr("INVALID_BOOST_VALUE");let o=new Map,i=t.length;for(let h=0;h<i;h++){let g=t[h],y=g.length;for(let b=0;b<y;b++){let[_,w]=g[b],x=w*e,O=o.get(_)?.[0];O!==void 0?o.set(_,[O*1.5+x,(o?.get(_)?.[1]||0)+1]):o.set(_,[x,1])}}let a=[];for(let h of o.entries())a.push([h[0],h[1][0]]);let s=a.sort((h,g)=>g[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,g)=>h[2]>g[2]?-1:h[2]<g[2]?1:h[1]>g[1]?-1:h[1]<g[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 vnt(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 oie=v(()=>{bh()});function wnt(t,e){let r=0;for(let n=0;n<e;n++)r+=t[n]*t[n];return Math.sqrt(r)}function Sxe(t,e,r,n=.8){let o=wnt(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 Cxe=v(()=>{});function Aoo(t,e,r,n,o){let i=ru(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 Ioo(t,e,r,n,o){let i=0;for(let u of n)u===o&&i++;let a=ru(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 Noo(t,e,r,n){let o=ru(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 joo(t,e,r){t.tokenOccurrences[e][r]--}function Doo(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=ru(e.sharedInternalDocumentStore,i[p]),h=l?.[m]?.[n]??0,g=vnt(h,c,t.docsCount,s[m],a,t.params.relevance);d.push([m,g])}return d}function Apr(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)){Apr(t,e,a,n,s);continue}if(K1(a))n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a,n.vectorIndexes[s]={size:unt(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:spr(0,[]),isArray:u};break;case"string":case"string[]":n.indexes[s]={type:"Radix",node:mH(),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:fpr(),isArray:u};break;case"geopoint":n.indexes[s]={type:"BKD",node:Spr(),isArray:u};break;default:throw jr("INVALID_SCHEMA_TYPE",Array.isArray(a)?"array":a,s)}n.searchableProperties.push(s),n.searchablePropertiesWithTypes[s]=a}}return n}function $oo(t,e,r,n,o,i,a,s){return u=>{let l=ru(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;upr(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),_pr(d,p,l);break}case"Flat":{ppr(d,u,l);break}case"BKD":{Cpr(d,u,[l]);break}}}}function Loo(t,e,r,n,o,i,a,s,u,l){if(K1(i))return Foo(e,r,o,n);let c=$oo(t,e,r,n,a,s,u,l);if(!L8(i))return c(o);let d=o,f=d.length;for(let p=0;p<f;p++)c(d[p])}function Foo(t,e,r,n){r instanceof Float32Array||(r=new Float32Array(r));let o=t.vectorIndexes[e].size,i=wnt(r,o);t.vectorIndexes[e].vectors[n]=[i,r]}function Rpr(t,e,r,n,o,i,a,s,u){let l=ru(e.sharedInternalDocumentStore,n);if(K1(i))return delete e.vectorIndexes[r].vectors[n],!0;let{type:c,node:d}=e.indexes[r];switch(c){case"AVL":return cpr(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),vpr(d,p,l);return!0}case"Flat":return mpr(d,l,o),!0;case"BKD":return xpr(d,o,l),!1}}function koo(t,e,r,n,o,i,a,s,u){if(!L8(i))return Rpr(t,e,r,n,o,i,a,s,u);let l=snt(i),c=o,d=c.length;for(let f=0;f<d;f++)Rpr(t,e,r,n,c[f],l,a,s,u);return!0}function qoo(t,e,r,n){if(!(r in e.tokenOccurrences))return[];let{node:o,type:i}=e.indexes[r];if(i!=="Radix")throw jr("WRONG_SEARCH_PROPERTY_TYPE",r);let{exact:a,tolerance:s}=t.params,u=_nt(o,{term:n,exact:a,tolerance:s}),l=new Set;for(let c in u)if(j8(u,c))for(let f of u[c])l.add(f);return t.index.calculateResultScores(t,e,r,n,Array.from(l))}function Boo(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 jr("UNKNOWN_FILTER_PROPERTY",i);let{node:s,type:u,isArray:l}=e.indexes[i];if(u==="Bool"){let f=s[a.toString()];Au(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:g=!1}=a[d],y=int(f,m),b=Opr(s.root,p,y,h,void 0,g);Au(o[i],b.flatMap(({docIDs:_})=>_))}else{let{coordinates:f,inside:p=!0,highPrecision:m=!1}=a[d],h=Tpr(s.root,f,p,void 0,m);Au(o[i],h.flatMap(({docIDs:g})=>g))}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=_nt(s,{term:p,exact:!0});Au(o[i],Object.values(m).flat())}}continue}let c=Object.keys(a);if(c.length>1)throw jr("INVALID_FILTER_OPERATION",c.length);if(u==="Flat"){let d=l?gpr:hpr;Au(o[i],d(s,a));continue}if(u==="AVL"){let d=c[0],f=a[d],p=[];switch(d){case"gt":{p=pnt(s,f,!1);break}case"gte":{p=pnt(s,f,!0);break}case"lt":{p=mnt(s,f,!1);break}case"lte":{p=mnt(s,f,!0);break}case"eq":{p=lpr(s,f)??[];break}case"between":{let[m,h]=f;p=ipr(s,m,h);break}}Au(o[i],p)}}return D8(Object.values(o))}function Uoo(t){return t.searchableProperties}function zoo(t){return t.searchablePropertiesWithTypes}function Ipr(t){let e=mH(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]=Ipr(t.c[r]);return e}function Hoo(t){return{numberToDocumentId:new Map(t)}}function Voo(t){return Array.from(t.numberToDocumentId.entries())}function Joo(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:Ipr(p),isArray:h};break;case"Flat":c[f]={type:"Flat",node:Hoo(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 Koo(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:Voo(p),isArray:m}}return{indexes:c,vectorIndexes:l,searchableProperties:n,searchablePropertiesWithTypes:o,frequencies:i,tokenOccurrences:a,avgFieldLength:s,fieldLengths:u}}function Npr(){return{create:Apr,insert:Loo,remove:koo,insertDocumentScoreParameters:Aoo,insertTokenScoreParameters:Ioo,removeDocumentScoreParameters:Noo,removeTokenScoreParameters:joo,calculateResultScores:Doo,search:qoo,searchByWhereClause:Boo,getSearchableProperties:Uoo,getSearchablePropertiesWithTypes:zoo,load:Joo,save:Koo}}var Snt=v(()=>{bh();dpr();ypr();wpr();Mpr();od();oie();Cxe();rie();IS()});function jpr(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=jpr(t,e,s,n,u);Au(i.sortableProperties,l.sortableProperties),i.sorts={...i.sorts,...l.sorts},i.sortablePropertiesWithTypes={...i.sortablePropertiesWithTypes,...l.sortablePropertiesWithTypes};continue}if(!K1(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 jr("INVALID_SORT_SCHEMA_TYPE",Array.isArray(s)?"array":s,u)}}}return i}function Goo(t,e,r,n){return n?.enabled!==!1?jpr(t,e,r,(n||{}).unsortableProperties||[],""):{disabled:!0}}function Zoo(t,e,r,n){if(!t.enabled)return;t.isSorted=!1;let o=ru(t.sharedInternalDocumentStore,r),i=t.sorts[e];i.orderedDocsToRemove.has(o)&&Cnt(t,e),i.docs.set(o,i.orderedDocs.length),i.orderedDocs.push([o,n])}function Dpr(t){if(t.isSorted||!t.enabled)return;let e=Object.keys(t.sorts);for(let r of e)eio(t,r);t.isSorted=!0}function Xoo(t,e,r){return e[1].localeCompare(r[1],Bfr(t))}function Yoo(t,e){return t[1]-e[1]}function Qoo(t,e){return e[1]?-1:1}function eio(t,e){let r=t.sorts[e],n;switch(r.type){case"string":n=Xoo.bind(null,t.language);break;case"number":n=Yoo.bind(null);break;case"boolean":n=Qoo.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 tio(t){let e=Object.keys(t.sorts);for(let r of e)Cnt(t,r)}function Cnt(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 rio(t,e,r){if(!t.enabled)return;let n=t.sorts[e],o=ru(t.sharedInternalDocumentStore,r);n.docs.get(o)&&(n.docs.delete(o),n.orderedDocsToRemove.set(o,!0))}function nio(t,e,r){if(!t.enabled)throw jr("SORT_DISABLED");let n=r.property,o=r.order==="DESC",i=t.sorts[n];if(!i)throw jr("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",n,t.sortableProperties.join(", "));return Cnt(t,n),Dpr(t),e.sort((a,s)=>{let u=i.docs.get(ru(t.sharedInternalDocumentStore,a[0])),l=i.docs.get(ru(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 oio(t){return t.enabled?t.sortableProperties:[]}function iio(t){return t.enabled?t.sortablePropertiesWithTypes:{}}function aio(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 sio(t){if(!t.enabled)return{enabled:!1};tio(t),Dpr(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 $pr(){return{create:Goo,insert:Zoo,remove:rio,save:sio,load:aio,sortBy:nio,getSortableProperties:oio,getSortablePropertiesWithTypes:iio}}var xnt=v(()=>{bh();rie();IS();od();yxe()});function cio(t){return t<192||t>383?t:lio[t-192]||t}function Lpr(t){let e=[];for(let r=0;r<t.length;r++)e[r]=cio(t.charCodeAt(r));return String.fromCharCode(...e)}var lio,Fpr=v(()=>{lio=[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 qpr(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(Ont),n.test(u[1])&&(n=/.$/,t=t.replace(n,""))}else o.test(t)&&(e=o.exec(t)[1],o=new RegExp(kpr),o.test(e)&&(t=e,o=/(at|bl|iz)$/,i=new RegExp("([^aeiouylsz])\\1$"),a=new RegExp("^"+TA+Oxe+"[^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(kpr),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(Ont),e&&n.test(e)&&(t=e+dio[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(Ont),e&&n.test(e)&&(t=e+fio[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(xxe),e&&n.test(e)&&(t=e);else if(o.test(t)){let u=o.exec(t);e=u?.[1]??""+u?.[2]??"",o=new RegExp(xxe),o.test(e)&&(t=e)}return n=/^(.+?)e$/,n.test(t)&&(e=n.exec(t)?.[1],n=new RegExp(xxe),o=new RegExp(mio),i=new RegExp("^"+TA+Oxe+"[^aeiouwxy]$"),e&&(n.test(e)||o.test(e)&&!i.test(e))&&(t=e)),n=/ll$/,o=new RegExp(xxe),n.test(t)&&o.test(t)&&(n=/.$/,t=t.replace(n,"")),s=="y"&&(t=s.toLowerCase()+t.substring(1)),t}var dio,fio,pio,Oxe,TA,iie,Ont,mio,xxe,kpr,Bpr=v(()=>{dio={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"},fio={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},pio="[^aeiou]",Oxe="[aeiouy]",TA=pio+"[^aeiouy]*",iie=Oxe+"[aeiou]*",Ont="^("+TA+")?"+iie+TA,mio="^("+TA+")?"+iie+TA+"("+iie+")?$",xxe="^("+TA+")?"+iie+TA+iie+TA,kpr="^("+TA+")?"+Oxe});function Tnt(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=Lpr(e),this.normalizationCache.set(r,e),e)}function hio(t){for(;t[t.length-1]==="";)t.pop();for(;t[0]==="";)t.shift();return t}function Upr(t,e,r){if(e&&e!==this.language)throw jr("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=qfr[this.language];n=t.toLowerCase().split(i).map(this.normalizeToken.bind(this,r??"")).filter(Boolean)}let o=hio(n);return this.allowDuplicates?o:Array.from(new Set(o))}function Ent(t={}){if(!t.language)t.language="english";else if(!eie.includes(t.language))throw jr("LANGUAGE_NOT_SUPPORTED",t.language);let e;if(t.stemming||t.stemmer&&!("stemming"in t))if(t.stemmer){if(typeof t.stemmer!="function")throw jr("INVALID_STEMMER_FUNCTION_TYPE");e=t.stemmer}else if(t.language==="english")e=qpr;else throw jr("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 jr("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw jr("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(let o of r)if(typeof o!="string")throw jr("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}let n={tokenize:Upr,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:Tnt,normalizationCache:new Map};return n.tokenize=Upr.bind(n),n.normalizeToken=Tnt,n}var Txe=v(()=>{bh();Fpr();yxe();Bpr()});function yio(t){let e={formatElapsedTime:Wfr,getDocumentIndexId:Gfr,getDocumentProperties:bxe,validateSchema:ant};for(let r of cnt){let n=r;if(t[n]){if(typeof t[n]!="function")throw jr("COMPONENT_MUST_BE_FUNCTION",n)}else t[n]=e[n]}for(let r of Object.keys(t))if(!rpr.includes(r)&&!cnt.includes(r))throw jr("UNSUPPORTED_COMPONENT",r)}function B8({schema:t,sort:e,language:r,components:n,id:o,plugins:i}){n||(n={}),o||(o=tie());let a=n.tokenizer,s=n.index,u=n.documentsStore,l=n.sorter;if(a?a.tokenize?a=a:a=Ent(a):a=Ent({language:r??"english"}),n.tokenizer&&r)throw jr("NO_LANGUAGE_WITH_CUSTOM_TOKENIZER");let c=Xfr();s||(s=Npr()),l||(l=$pr()),u||(u=Yfr()),yio(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:bio()};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 y of Qfr)h[y]=(h[y]??[]).concat(epr(h,y));let g=h.afterCreate;return g&&npr(g,h),h}function bio(){return"{{VERSION}}"}var zpr=v(()=>{rie();lnt();tpr();Ok();Snt();IS();xnt();Txe();bh();od()});var Hpr=v(()=>{});var Pnt=v(()=>{rie();lnt();Snt();Txe();xnt();IS()});var Exe,Mnt,Rnt,Ant=v(()=>{Exe="fulltext",Mnt="hybrid",Rnt="vector"});var Tk,Ek,Int=v(()=>{Ant();Tk=Symbol("orama.insertions"),Ek=Symbol("orama.removals")});function Nnt(t){typeof t[Tk]!="number"&&(queueMicrotask(()=>{t[Tk]=void 0}),t[Tk]=0),t[Tk]>1e3?(Vpr("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[Tk]=-1):t[Tk]>=0&&t[Tk]++}function jnt(t){typeof t[Ek]!="number"&&(queueMicrotask(()=>{t[Ek]=void 0}),t[Ek]=0),t[Ek]>1e3?(Vpr("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[Ek]=-1):t[Ek]>=0&&t[Ek]++}var Vpr,Dnt=v(()=>{Int();Vpr=globalThis.process?.emitWarning??function(e,r){console.warn(`[WARNING] [${r.code}] ${e}`)}});function aie(t,e,r,n,o){let i=t.validateSchema(e,t.schema);if(i)throw jr("SCHEMA_VALIDATION_FAILURE",i);return Sd(t.index.beforeInsert)||Sd(t.index.insert)||Sd(t.index.afterInsert)?Sio(t,e,r,n,o):Cio(t,e,r,n,o)}async function Sio(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw jr("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw jr("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||await BC(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];Jpr(m,h,f,p)}return await xio(t,s,l,d,u,r,e,o),n||await BC(t.afterInsert,t,s,e),Nnt(t),s}function Cio(t,e,r,n,o){let{index:i,docs:a}=t.data,s=t.getDocumentIndexId(e);if(typeof s!="string")throw jr("DOCUMENT_ID_MUST_BE_STRING",typeof s);if(!t.documentsStore.store(a,s,e))throw jr("DOCUMENT_ALREADY_EXISTS",s);let u=t.documentsStore.count(a);n||BC(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];Jpr(m,h,f,p)}return Oio(t,s,l,d,u,r,e,o),n||BC(t.afterInsert,t,s,e),Nnt(t),s}function Jpr(t,e,r,n){if(!(Zfr(e)&&typeof n=="object"&&typeof n.lon=="number"&&typeof n.lat=="number")&&!(K1(e)&&Array.isArray(n))&&!(L8(e)&&Array.isArray(n))&&!(vio.has(e)&&wio.has(t))&&t!==e)throw jr("INVALID_DOCUMENT_PROPERTY",r,e,t)}async function xio(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 Oio(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 vio,wio,$nt=v(()=>{Pnt();od();Ok();Dnt();bh();vio=new Set(["enum","enum[]"]),wio=new Set(["string","number"])});function hH(t,e,r,n){return Sd(t.index.beforeRemove)||Sd(t.index.remove)||Sd(t.index.afterRemove)?Tio(t,e,r,n):Eio(t,e,r,n)}async function Tio(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=AS(t.internalDocumentIDStore,ru(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||await BC(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 g=f[h];if(typeof g>"u")continue;let y=d[h];await t.index.beforeRemove?.(t.data.index,h,u,g,y,r,t.tokenizer,l),await t.index.remove(t.index,t.data.index,h,e,g,y,r,t.tokenizer,l)||(o=!1),await t.index.afterRemove?.(t.data.index,h,u,g,y,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 BC(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),jnt(t),o}function Eio(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=AS(t.internalDocumentIDStore,ru(t.internalDocumentIDStore,e)),l=t.documentsStore.count(a);n||BC(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 g=f[h];if(typeof g>"u")continue;let y=d[h];t.index.beforeRemove?.(t.data.index,h,u,g,y,r,t.tokenizer,l),t.index.remove(t.index,t.data.index,h,e,g,y,r,t.tokenizer,l)||(o=!1),t.index.afterRemove?.(t.data.index,h,u,g,y,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||BC(t.afterRemove,t,u),t.documentsStore.remove(t.data.docs,e),jnt(t),o}function sie(t,e,r,n,o){return Sd(t.index.beforeRemove)||Sd(t.index.remove)||Sd(t.index.afterRemove)||Sd(t.beforeRemoveMultiple)||Sd(t.afterRemoveMultiple)?Pio(t,e,r,n,o):Mio(t,e,r,n,o)}async function Pio(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(s=>AS(t.internalDocumentIDStore,ru(t.internalDocumentIDStore,s)));return o||await pH(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 hH(t,f,n,o)&&i++}catch(p){u(p)}setTimeout(c,0)}setTimeout(c,0)}),o||await pH(t.afterRemoveMultiple,t,a),i}function Mio(t,e,r,n,o){let i=0;r||(r=1e3);let a=o?[]:e.map(l=>AS(t.internalDocumentIDStore,ru(t.internalDocumentIDStore,l)));o||pH(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)hH(t,c,n,o)&&i++;setTimeout(u,0)}}return u(),o||pH(t.afterRemoveMultiple,t,a),i}var Lnt=v(()=>{Ok();IS();Dnt();od()});function Rio(t,e){return t[1]-e[1]}function Aio(t,e){return e[1]-t[1]}function Iio(t="desc"){return t.toLowerCase()==="asc"?Rio:Aio}function U8(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(".")?$8(c,d):c[d],p=s[d],m=n[d].values;switch(p){case"number":{let h=r[d].ranges;Kpr(h,m)(f);break}case"number[]":{let h=new Set,g=r[d].ranges,y=Kpr(g,m,h);for(let b of f)y(b);break}case"boolean":case"enum":case"string":{Wpr(m,p)(f);break}case"boolean[]":case"enum[]":case"string[]":{let y=Wpr(m,p==="boolean[]"?"boolean":"string",new Set);for(let b of f)y(b);break}default:throw jr("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=Iio(d.sort);c.values=Object.fromEntries(Object.entries(c.values).sort(f).slice(d.offset??0,d.limit??10))}}return n}function Kpr(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 Wpr(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 Pxe=v(()=>{bh();od()});function z8(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 Mxe=v(()=>{});function H8(t,e,r){let n=r.properties,o=n.length,i=t.index.getSearchablePropertiesWithTypes(t.data.index);for(let y=0;y<o;y++){let b=n[y];if(typeof i[b]>"u")throw jr("UNKNOWN_GROUP_BY_PROPERTY",b);if(!Gpr.includes(i[b]))throw jr("INVALID_GROUP_BY_PROPERTY",b,Gpr.join(", "),i[b])}let a=e.map(([y])=>AS(t.internalDocumentIDStore,y)),s=t.documentsStore.getMultiple(t.data.docs,a),u=s.length,l=r.maxResult||Number.MAX_SAFE_INTEGER,c=[],d={};for(let y=0;y<o;y++){let b=n[y],_={property:b,perValue:{}},w=new Set;for(let x=0;x<u;x++){let O=s[x],E=$8(O,b);if(typeof E>"u")continue;let T=typeof E!="boolean"?E:""+E,R=_.perValue[T]??{indexes:[],count:0};R.count>=l||(R.indexes.push(x),R.count++,_.perValue[T]=R,w.add(E))}c.push(Array.from(w)),d[b]=_}let f=Zpr(c),p=f.length,m=[];for(let y=0;y<p;y++){let b=f[y],_=b.length,w={values:[],indexes:[]},x=[];for(let O=0;O<_;O++){let E=b[O],T=n[O];x.push(d[T].perValue[typeof E!="boolean"?E:""+E].indexes),w.values.push(E)}w.indexes=D8(x).sort((O,E)=>O-E),w.indexes.length!==0&&m.push(w)}let h=m.length,g=Array.from({length:h});for(let y=0;y<h;y++){let b=m[y],_=r.reduce||Nio,w=b.indexes.map(T=>({id:a[T],score:e[T][1],document:s[T]})),x=_.reducer.bind(null,b.values),O=_.getInitialValue(b.indexes.length),E=w.reduce(x,O);g[y]={values:b.values,result:E}}return g}function Zpr(t,e=0){if(e+1===t.length)return t[e].map(i=>[i]);let r=t[e],n=Zpr(t,e+1),o=[];for(let i of r)for(let a of n){let s=[i];Au(s,a),o.push(s)}return o}var Nio,Gpr,Rxe=v(()=>{bh();od();IS();Nio={reducer:(t,e,r,n)=>(e[n]=r,e),getInitialValue:t=>Array.from({length:t})},Gpr=["string","number","boolean"]});function Xpr(t,e,r){let n=qC(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){e.relevance=Object.assign(Axe,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,g=e.preflight===!0,{index:y,docs:b}=t.data,_=t.tokenizer.tokenize(d??"",r),w=t.caches.propertiesToSearch;if(!w){let F=t.index.getSearchablePropertiesWithTypes(y);w=t.index.getSearchableProperties(y),w=w.filter(B=>F[B].startsWith("string")),t.caches.propertiesToSearch=w}if(f&&f!=="*"){for(let F of f)if(!w.includes(F))throw jr("UNKNOWN_INDEX",F,w.join(", "));w=w.filter(F=>f.includes(F))}let x=gH(t.tokenizer,t.index,t.documentsStore,r,e,w,_,t.documentsStore.count(b),n),O=Object.keys(e.where??{}).length>0,E=[];O&&(E=t.index.searchByWhereClause(x,y,e.where));let T=_.length;if(T||f?.length){let F=w.length;for(let B=0;B<F;B++){let U=w[B],H=x.indexMap[U];if(T!==0)for(let z=0;z<T;z++){let Q=_[z],re=t.index.search(x,y,U,Q);Au(H[Q],re)}else{H[""]=[];let z=t.index.search(x,y,U,"");Au(H[""],z)}let G=Object.values(H);x.docsIntersection[U]=wxe(G,e?.boost?.[U]??1,p,T);let ie=x.docsIntersection[U],oe=ie.length;for(let z=0;z<oe;z++){let[Q,re]=ie[z],Z=x.uniqueDocsIDs[Q];Z?x.uniqueDocsIDs[Q]=Z+re+.5:x.uniqueDocsIDs[Q]=re}}}else _.length===0&&d?x.uniqueDocsIDs={}:x.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(F=>[F,0]));let R=Object.entries(x.uniqueDocsIDs).map(([F,B])=>[+F,B]);if(O&&(R=z8(E,R)),e.sortBy)if(typeof e.sortBy=="function"){let F=R.map(([H])=>H),U=t.documentsStore.getMultiple(t.data.docs,F).map((H,G)=>[R[G][0],R[G][1],H]);U.sort(e.sortBy),R=U.map(([H,G])=>[H,G])}else R=t.sorter.sortBy(t.data.sorting,R,e.sortBy).map(([F,B])=>[ru(t.internalDocumentIDStore,F),B]);else R=R.sort(Kfr);let N;g||(N=m?Qpr(t,R,c,l,m):Ixe(t,R,c,l));let D={elapsed:{formatted:"",raw:0},hits:[],count:R.length};if(typeof N<"u"&&(D.hits=N.filter(Boolean),h||_xe(D,s)),u){let F=U8(t,R,e.facets);D.facets=F}return e.groupBy&&(D.groups=H8(t,R,e.groupBy)),D.elapsed=t.formatElapsedTime(qC()-x.timeStart),D}async function a(){t.beforeSearch&&await k8(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await F8(t.afterSearch,t,e,r,s),s}return o?a():i()}var Ypr=v(()=>{oie();Pxe();Mxe();Rxe();Ok();IS();bh();od();yH()});function Fnt(t,e,r="english"){let n=qC(),o=t.beforeSearch?.length||t.afterSearch?.length;function i(){let{vector:s}=e;if(s&&(!("value"in s)||!("property"in s)))throw jr("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:g,docs:y}=t.data;if(s?.value.length!==f)throw s?.property===void 0||s?.value.length===void 0?jr("INVALID_INPUT_VECTOR","undefined",f,"undefined"):jr("INVALID_INPUT_VECTOR",s.property,f,s.value.length);s instanceof Float32Array||(s.value=new Float32Array(s.value));let b=Sxe(s.value,p,f,e.similarity).map(([F,B])=>[ru(t.internalDocumentIDStore,F),B]),_=t.caches.propertiesToSearch;if(!_){let F=t.index.getSearchablePropertiesWithTypes(g);_=t.index.getSearchableProperties(g),_=_.filter(B=>F[B].startsWith("string")),t.caches.propertiesToSearch=_}let w=[],x=gH(t.tokenizer,t.index,t.documentsStore,r,e,_,w,t.documentsStore.count(y),n),O=[];h&&(O=t.index.searchByWhereClause(x,g,e.where),b=z8(O,b));let E=[];m&&(E=U8(t,b,e.facets));let T=Array.from({length:u});for(let F=0;F<u;F++){let B=b[F+l];if(!B)break;let U=t.data.docs.docs[B[0]];if(U){c||(U[s.property]=null);let H={id:AS(t.internalDocumentIDStore,B[0]),score:B[1],document:U};T[F]=H}}let R=[];e.groupBy&&(R=H8(t,b,e.groupBy));let D=qC()-n;return{count:b.length,hits:T.filter(Boolean),elapsed:{raw:Number(D),formatted:fH(D)},...E?{facets:E}:{},...R?{groups:R}:{}}}async function a(){t.beforeSearch&&await k8(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await F8(t.afterSearch,t,e,r,s),s}return o?a():i()}var knt=v(()=>{yH();od();Pxe();bh();Cxe();Mxe();Rxe();IS();Ok()});function tmr(t,e,r){let n=qC(),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=jio(t,e,r),f=Dio(t,e),{index:p,docs:m}=t.data,h=e.hybridWeights,g=Lio(d,f,e.term??"",h),y=t.tokenizer.tokenize(e.term??"",r),b=t.caches.propertiesToSearch;if(!b){let D=t.index.getSearchablePropertiesWithTypes(p);b=t.index.getSearchableProperties(p),b=b.filter(F=>D[F].startsWith("string")),t.caches.propertiesToSearch=b}if(e.properties&&e.properties!=="*"){for(let D of e.properties)if(!b.includes(D))throw jr("UNKNOWN_INDEX",D,b.join(", "));b=b.filter(D=>e.properties.includes(D))}let _=gH(t.tokenizer,t.index,t.documentsStore,r,e,b,y,t.documentsStore.count(m),n),w=Object.keys(e.where??{}).length>0,x=[];w&&(x=t.index.searchByWhereClause(_,p,e.where),g=z8(x,g));let O;c&&(O=U8(t,g,e.facets));let E;e.groupBy&&(E=H8(t,g,e.groupBy));let T=Ixe(t,g,s,u).filter(Boolean),R=qC(),N={count:g.length,elapsed:{raw:Number(R-n),formatted:fH(R-n)},hits:T,...O?{facets:O}:{},...E?{groups:E}:{}};if(!l){let D=Object.keys(t.data.index.vectorIndexes);_xe(N,D)}return N}async function a(){t.beforeSearch&&await k8(t.beforeSearch,t,e,r);let s=i();return t.afterSearch&&await F8(t.afterSearch,t,e,r,s),s}return o?a():i()}function jio(t,e,r){let n=qC();e.relevance=Object.assign(Axe,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 g of i)if(!m.has(g))throw jr("UNKNOWN_INDEX",g,c.join(", "));c=c.filter(g=>h.has(g))}let d=gH(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 g=c[h];if(f!==0)for(let x=0;x<f;x++){let O=l[x],E=t.index.search(d,s,g,O);Au(d.indexMap[g][O],E)}else{let x=[];d.indexMap[g][""]=x;let O=t.index.search(d,s,g,"");Au(x,O)}let y=d.indexMap[g],b=Object.values(y);d.docsIntersection[g]=wxe(b,e?.boost?.[g]??1,a,f);let _=d.docsIntersection[g],w=_.length;for(let x=0;x<w;x++){let[O,E]=_[x],T=d.uniqueDocsIDs[O];d.uniqueDocsIDs[O]=T?T+E+.5:E}}}else l.length===0&&o?d.uniqueDocsIDs={}:d.uniqueDocsIDs=Object.fromEntries(Object.keys(t.documentsStore.getAll(t.data.docs)).map(m=>[m,0]));let p=Object.entries(d.uniqueDocsIDs).map(([m,h])=>[+m,h]).sort((m,h)=>h[1]-m[1]);return rmr(p)}function Dio(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 jr("INVALID_VECTOR_INPUT",Object.keys(r).join(", "));if(r.value.length!==o)throw jr("INVALID_INPUT_VECTOR",r.property,o,r.value.length);r instanceof Float32Array||(r.value=new Float32Array(r.value));let a=Sxe(r.value,i,o,e.similarity).map(([s,u])=>[ru(t.internalDocumentIDStore,s),u]);return rmr(a)}function qnt([,t]){return t}function rmr(t){let e=Math.max.apply(Math,t.map(qnt));return t.map(([r,n])=>[r,n/e])}function emr(t,e){return t/e}function $io(t,e){return(r,n)=>r*t+n*e}function Lio(t,e,r,n){let o=Math.max.apply(Math,t.map(qnt)),i=Math.max.apply(Math,e.map(qnt)),a=n&&n.text&&n.vector,{text:s,vector:u}=a?n:Fio(r),l=new Map,c=t.length,d=$io(s,u);for(let p=0;p<c;p++){let[m,h]=t[p],g=emr(h,o),y=d(g,0);l.set(m,y)}let f=e.length;for(let p=0;p<f;p++){let[m,h]=e[p],g=emr(h,i),y=l.get(m)??0;l.set(m,y+d(0,g))}return[...l].sort((p,m)=>m[1]-p[1])}function Fio(t){return{text:.5,vector:.5}}var nmr=v(()=>{od();Mxe();oie();bh();yH();Pxe();Rxe();Cxe();IS();yH();Ok()});function gH(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 _b(t,e,r){let n=e.mode??Exe;if(n===Exe)return Xpr(t,e,r);if(n===Rnt)return Fnt(t,e);if(n===Mnt)return tmr(t,e);throw jr("INVALID_SEARCH_MODE",n)}function Qpr(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),g=$8(h,o);if(!(typeof g>"u"||a.has(g))&&(a.set(g,!0),c++,!(c<=r)&&(s.push({id:AS(t.internalDocumentIDStore,p),score:m,document:h}),u.add(p),c>=r+n)))break}return s}function Ixe(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:AS(t.internalDocumentIDStore,l),score:c,document:d},a.add(l)}}return i}var Axe,yH=v(()=>{IS();bh();od();Ant();Ypr();knt();nmr();Axe={k:1.2,b:.75,d:.5}});function Nxe(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 Bnt(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 omr=v(()=>{});var imr=v(()=>{Ok();bh();$nt();Lnt();od()});var amr=v(()=>{bh();yH()});var smr=v(()=>{gnt();od();oie();Txe()});var jxe=v(()=>{zpr();Hpr();$nt();Lnt();yH();knt();omr();imr();amr();Int();Pnt();smr()});function Uio(t,e){let r=umr(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function umr(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var RLa,ALa,qio,Bio,Unt,zio,bH,znt=v(()=>{RLa=new Error("timeout while waiting for mutex to become available"),ALa=new Error("mutex already locked"),qio=new Error("request for lock canceled"),Bio=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())})},Unt=class{constructor(e,r=qio){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=umr(this._queue,s=>r<=s.priority);a===-1&&e<=this._value?this._dispatchItem(i):this._queue.splice(a+1,0,i)})}runExclusive(e){return Bio(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]=[]),Uio(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}};zio=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())})},bH=class{constructor(e){this._semaphore=new Unt(1,e)}acquire(){return zio(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 lmr=S(()=>{});var Pi=S((Dxe,cmr)=>{(function(t,e){typeof Dxe=="object"?cmr.exports=Dxe=e():typeof define=="function"&&define.amd?define([],e):t.CryptoJS=e()})(Dxe,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=lmr()}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 y(){}return function(b){var _;return y.prototype=b,_=new y,y.prototype=null,_}}(),a={},s=a.lib={},u=s.Base=function(){return{extend:function(y){var b=i(this);return y&&b.mixIn(y),(!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 y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var b in y)y.hasOwnProperty(b)&&(this[b]=y[b]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=s.WordArray=u.extend({init:function(y,b){y=this.words=y||[],b!=r?this.sigBytes=b:this.sigBytes=y.length*4},toString:function(y){return(y||d).stringify(this)},concat:function(y){var b=this.words,_=y.words,w=this.sigBytes,x=y.sigBytes;if(this.clamp(),w%4)for(var O=0;O<x;O++){var E=_[O>>>2]>>>24-O%4*8&255;b[w+O>>>2]|=E<<24-(w+O)%4*8}else for(var T=0;T<x;T+=4)b[w+T>>>2]=_[T>>>2];return this.sigBytes+=x,this},clamp:function(){var y=this.words,b=this.sigBytes;y[b>>>2]&=4294967295<<32-b%4*8,y.length=e.ceil(b/4)},clone:function(){var y=u.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var b=[],_=0;_<y;_+=4)b.push(o());return new l.init(b,y)}}),c=a.enc={},d=c.Hex={stringify:function(y){for(var b=y.words,_=y.sigBytes,w=[],x=0;x<_;x++){var O=b[x>>>2]>>>24-x%4*8&255;w.push((O>>>4).toString(16)),w.push((O&15).toString(16))}return w.join("")},parse:function(y){for(var b=y.length,_=[],w=0;w<b;w+=2)_[w>>>3]|=parseInt(y.substr(w,2),16)<<24-w%8*4;return new l.init(_,b/2)}},f=c.Latin1={stringify:function(y){for(var b=y.words,_=y.sigBytes,w=[],x=0;x<_;x++){var O=b[x>>>2]>>>24-x%4*8&255;w.push(String.fromCharCode(O))}return w.join("")},parse:function(y){for(var b=y.length,_=[],w=0;w<b;w++)_[w>>>2]|=(y.charCodeAt(w)&255)<<24-w%4*8;return new l.init(_,b)}},p=c.Utf8={stringify:function(y){try{return decodeURIComponent(escape(f.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return f.parse(unescape(encodeURIComponent(y)))}},m=s.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(y){typeof y=="string"&&(y=p.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var b,_=this._data,w=_.words,x=_.sigBytes,O=this.blockSize,E=O*4,T=x/E;y?T=e.ceil(T):T=e.max((T|0)-this._minBufferSize,0);var R=T*O,N=e.min(R*4,x);if(R){for(var D=0;D<R;D+=O)this._doProcessBlock(w,D);b=w.splice(0,R),_.sigBytes-=N}return new l.init(b,N)},clone:function(){var y=u.clone.call(this);return y._data=this._data.clone(),y},_minBufferSize:0}),h=s.Hasher=m.extend({cfg:u.extend(),init:function(y){this.cfg=this.cfg.extend(y),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(y){return this._append(y),this._process(),this},finalize:function(y){y&&this._append(y);var b=this._doFinalize();return b},blockSize:512/32,_createHelper:function(y){return function(b,_){return new y.init(_).finalize(b)}},_createHmacHelper:function(y){return function(b,_){return new g.HMAC.init(y,_).finalize(b)}}}),g=a.algo={};return a}(Math);return t})});var uie=S(($xe,dmr)=>{(function(t,e){typeof $xe=="object"?dmr.exports=$xe=e(Pi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})($xe,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 pmr=S((Lxe,fmr)=>{(function(t,e){typeof Lxe=="object"?fmr.exports=Lxe=e(Pi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Lxe,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 hmr=S((Fxe,mmr)=>{(function(t,e){typeof Fxe=="object"?mmr.exports=Fxe=e(Pi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Fxe,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 Pk=S((kxe,gmr)=>{(function(t,e){typeof kxe=="object"?gmr.exports=kxe=e(Pi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(kxe,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,g=p<<16|m<<8|h,y=0;y<4&&f+y*.75<l;y++)d.push(c.charAt(g>>>6*(3-y)&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 bmr=S((qxe,ymr)=>{(function(t,e){typeof qxe=="object"?ymr.exports=qxe=e(Pi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(qxe,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,g=l[p+2>>>2]>>>24-(p+2)%4*8&255,y=m<<16|h<<8|g,b=0;b<4&&p+b*.75<c;b++)f.push(d.charAt(y>>>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 Mk=S((Bxe,_mr)=>{(function(t,e){typeof Bxe=="object"?_mr.exports=Bxe=e(Pi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Bxe,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 g=m+h,y=p[g];p[g]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360}var b=this._hash.words,_=p[m+0],w=p[m+1],x=p[m+2],O=p[m+3],E=p[m+4],T=p[m+5],R=p[m+6],N=p[m+7],D=p[m+8],F=p[m+9],B=p[m+10],U=p[m+11],H=p[m+12],G=p[m+13],ie=p[m+14],oe=p[m+15],z=b[0],Q=b[1],re=b[2],Z=b[3];z=l(z,Q,re,Z,_,7,s[0]),Z=l(Z,z,Q,re,w,12,s[1]),re=l(re,Z,z,Q,x,17,s[2]),Q=l(Q,re,Z,z,O,22,s[3]),z=l(z,Q,re,Z,E,7,s[4]),Z=l(Z,z,Q,re,T,12,s[5]),re=l(re,Z,z,Q,R,17,s[6]),Q=l(Q,re,Z,z,N,22,s[7]),z=l(z,Q,re,Z,D,7,s[8]),Z=l(Z,z,Q,re,F,12,s[9]),re=l(re,Z,z,Q,B,17,s[10]),Q=l(Q,re,Z,z,U,22,s[11]),z=l(z,Q,re,Z,H,7,s[12]),Z=l(Z,z,Q,re,G,12,s[13]),re=l(re,Z,z,Q,ie,17,s[14]),Q=l(Q,re,Z,z,oe,22,s[15]),z=c(z,Q,re,Z,w,5,s[16]),Z=c(Z,z,Q,re,R,9,s[17]),re=c(re,Z,z,Q,U,14,s[18]),Q=c(Q,re,Z,z,_,20,s[19]),z=c(z,Q,re,Z,T,5,s[20]),Z=c(Z,z,Q,re,B,9,s[21]),re=c(re,Z,z,Q,oe,14,s[22]),Q=c(Q,re,Z,z,E,20,s[23]),z=c(z,Q,re,Z,F,5,s[24]),Z=c(Z,z,Q,re,ie,9,s[25]),re=c(re,Z,z,Q,O,14,s[26]),Q=c(Q,re,Z,z,D,20,s[27]),z=c(z,Q,re,Z,G,5,s[28]),Z=c(Z,z,Q,re,x,9,s[29]),re=c(re,Z,z,Q,N,14,s[30]),Q=c(Q,re,Z,z,H,20,s[31]),z=d(z,Q,re,Z,T,4,s[32]),Z=d(Z,z,Q,re,D,11,s[33]),re=d(re,Z,z,Q,U,16,s[34]),Q=d(Q,re,Z,z,ie,23,s[35]),z=d(z,Q,re,Z,w,4,s[36]),Z=d(Z,z,Q,re,E,11,s[37]),re=d(re,Z,z,Q,N,16,s[38]),Q=d(Q,re,Z,z,B,23,s[39]),z=d(z,Q,re,Z,G,4,s[40]),Z=d(Z,z,Q,re,_,11,s[41]),re=d(re,Z,z,Q,O,16,s[42]),Q=d(Q,re,Z,z,R,23,s[43]),z=d(z,Q,re,Z,F,4,s[44]),Z=d(Z,z,Q,re,H,11,s[45]),re=d(re,Z,z,Q,oe,16,s[46]),Q=d(Q,re,Z,z,x,23,s[47]),z=f(z,Q,re,Z,_,6,s[48]),Z=f(Z,z,Q,re,N,10,s[49]),re=f(re,Z,z,Q,ie,15,s[50]),Q=f(Q,re,Z,z,T,21,s[51]),z=f(z,Q,re,Z,H,6,s[52]),Z=f(Z,z,Q,re,O,10,s[53]),re=f(re,Z,z,Q,B,15,s[54]),Q=f(Q,re,Z,z,w,21,s[55]),z=f(z,Q,re,Z,D,6,s[56]),Z=f(Z,z,Q,re,oe,10,s[57]),re=f(re,Z,z,Q,R,15,s[58]),Q=f(Q,re,Z,z,G,21,s[59]),z=f(z,Q,re,Z,E,6,s[60]),Z=f(Z,z,Q,re,U,10,s[61]),re=f(re,Z,z,Q,x,15,s[62]),Q=f(Q,re,Z,z,F,21,s[63]),b[0]=b[0]+z|0,b[1]=b[1]+Q|0,b[2]=b[2]+re|0,b[3]=b[3]+Z|0},_doFinalize:function(){var p=this._data,m=p.words,h=this._nDataBytes*8,g=p.sigBytes*8;m[g>>>5]|=128<<24-g%32;var y=e.floor(h/4294967296),b=h;m[(g+64>>>9<<4)+15]=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,m[(g+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,x=0;x<4;x++){var O=w[x];w[x]=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360}return _},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,m,h,g,y,b,_){var w=p+(m&h|~m&g)+y+_;return(w<<b|w>>>32-b)+m}function c(p,m,h,g,y,b,_){var w=p+(m&g|h&~g)+y+_;return(w<<b|w>>>32-b)+m}function d(p,m,h,g,y,b,_){var w=p+(m^h^g)+y+_;return(w<<b|w>>>32-b)+m}function f(p,m,h,g,y,b,_){var w=p+(h^(m|~g))+y+_;return(w<<b|w>>>32-b)+m}r.MD5=i._createHelper(u),r.HmacMD5=i._createHmacHelper(u)}(Math),t.MD5})});var Hnt=S((Uxe,vmr)=>{(function(t,e){typeof Uxe=="object"?vmr.exports=Uxe=e(Pi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Uxe,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],g=0;g<80;g++){if(g<16)a[g]=u[l+g]|0;else{var y=a[g-3]^a[g-8]^a[g-14]^a[g-16];a[g]=y<<1|y>>>31}var b=(d<<5|d>>>27)+h+a[g];g<20?b+=(f&p|~f&m)+1518500249:g<40?b+=(f^p^m)+1859775393:g<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 Hxe=S((zxe,wmr)=>{(function(t,e){typeof zxe=="object"?wmr.exports=zxe=e(Pi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(zxe,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 g=e.sqrt(h),y=2;y<=g;y++)if(!(h%y))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],g=p[2],y=p[3],b=p[4],_=p[5],w=p[6],x=p[7],O=0;O<64;O++){if(O<16)l[O]=d[f+O]|0;else{var E=l[O-15],T=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,R=l[O-2],N=(R<<15|R>>>17)^(R<<13|R>>>19)^R>>>10;l[O]=T+l[O-7]+N+l[O-16]}var D=b&_^~b&w,F=m&h^m&g^h&g,B=(m<<30|m>>>2)^(m<<19|m>>>13)^(m<<10|m>>>22),U=(b<<26|b>>>6)^(b<<21|b>>>11)^(b<<7|b>>>25),H=x+U+D+u[O]+l[O],G=B+F;x=w,w=_,_=b,b=y+H|0,y=g,g=h,h=m,m=H+G|0}p[0]=p[0]+m|0,p[1]=p[1]+h|0,p[2]=p[2]+g|0,p[3]=p[3]+y|0,p[4]=p[4]+b|0,p[5]=p[5]+_|0,p[6]=p[6]+w|0,p[7]=p[7]+x|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 Cmr=S((Vxe,Smr)=>{(function(t,e,r){typeof Vxe=="object"?Smr.exports=Vxe=e(Pi(),Hxe()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(t.CryptoJS)})(Vxe,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 Vnt=S((Jxe,xmr)=>{(function(t,e,r){typeof Jxe=="object"?xmr.exports=Jxe=e(Pi(),uie()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Jxe,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],g=m[1],y=m[2],b=m[3],_=m[4],w=m[5],x=m[6],O=m[7],E=h.high,T=h.low,R=g.high,N=g.low,D=y.high,F=y.low,B=b.high,U=b.low,H=_.high,G=_.low,ie=w.high,oe=w.low,z=x.high,Q=x.low,re=O.high,Z=O.low,$=E,q=T,Y=R,j=N,A=D,W=F,V=B,se=U,be=H,Ee=G,Ae=ie,ht=oe,Rt=z,Ze=Q,Dr=re,Vt=Z,jt=0;jt<80;jt++){var Fe,hn,gt=c[jt];if(jt<16)hn=gt.high=f[p+jt*2]|0,Fe=gt.low=f[p+jt*2+1]|0;else{var qe=c[jt-15],Te=qe.high,Ce=qe.low,De=(Te>>>1|Ce<<31)^(Te>>>8|Ce<<24)^Te>>>7,Re=(Ce>>>1|Te<<31)^(Ce>>>8|Te<<24)^(Ce>>>7|Te<<25),nt=c[jt-2],_n=nt.high,He=nt.low,wt=(_n>>>19|He<<13)^(_n<<3|He>>>29)^_n>>>6,_r=(He>>>19|_n<<13)^(He<<3|_n>>>29)^(He>>>6|_n<<26),Sl=c[jt-7],Vo=Sl.high,Su=Sl.low,Wa=c[jt-16],zy=Wa.high,ui=Wa.low;Fe=Re+Su,hn=De+Vo+(Fe>>>0<Re>>>0?1:0),Fe=Fe+_r,hn=hn+wt+(Fe>>>0<_r>>>0?1:0),Fe=Fe+ui,hn=hn+zy+(Fe>>>0<ui>>>0?1:0),gt.high=hn,gt.low=Fe}var mv=be&Ae^~be&Rt,q0=Ee&ht^~Ee&Ze,Xt=$&Y^$&A^Y&A,ct=q&j^q&W^j&W,pr=($>>>28|q<<4)^($<<30|q>>>2)^($<<25|q>>>7),Or=(q>>>28|$<<4)^(q<<30|$>>>2)^(q<<25|$>>>7),js=(be>>>14|Ee<<18)^(be>>>18|Ee<<14)^(be<<23|Ee>>>9),el=(Ee>>>14|be<<18)^(Ee>>>18|be<<14)^(Ee<<23|be>>>9),Hc=l[jt],Vb=Hc.high,Hy=Hc.low,xi=Vt+el,St=Dr+js+(xi>>>0<Vt>>>0?1:0),xi=xi+q0,St=St+mv+(xi>>>0<q0>>>0?1:0),xi=xi+Hy,St=St+Vb+(xi>>>0<Hy>>>0?1:0),xi=xi+Fe,St=St+hn+(xi>>>0<Fe>>>0?1:0),Vy=Or+ct,hv=pr+Xt+(Vy>>>0<Or>>>0?1:0);Dr=Rt,Vt=Ze,Rt=Ae,Ze=ht,Ae=be,ht=Ee,Ee=se+xi|0,be=V+St+(Ee>>>0<se>>>0?1:0)|0,V=A,se=W,A=Y,W=j,Y=$,j=q,q=xi+Vy|0,$=St+hv+(q>>>0<xi>>>0?1:0)|0}T=h.low=T+q,h.high=E+$+(T>>>0<q>>>0?1:0),N=g.low=N+j,g.high=R+Y+(N>>>0<j>>>0?1:0),F=y.low=F+W,y.high=D+A+(F>>>0<W>>>0?1:0),U=b.low=U+se,b.high=B+V+(U>>>0<se>>>0?1:0),G=_.low=G+Ee,_.high=H+be+(G>>>0<Ee>>>0?1:0),oe=w.low=oe+ht,w.high=ie+Ae+(oe>>>0<ht>>>0?1:0),Q=x.low=Q+Ze,x.high=z+Rt+(Q>>>0<Ze>>>0?1:0),Z=O.low=Z+Vt,O.high=re+Dr+(Z>>>0<Vt>>>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 g=this._hash.toX32();return g},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 Tmr=S((Kxe,Omr)=>{(function(t,e,r){typeof Kxe=="object"?Omr.exports=Kxe=e(Pi(),uie(),Vnt()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(t.CryptoJS)})(Kxe,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 Pmr=S((Wxe,Emr)=>{(function(t,e,r){typeof Wxe=="object"?Emr.exports=Wxe=e(Pi(),uie()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(t.CryptoJS)})(Wxe,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,g=0;g<24;g++){l[m+5*h]=(g+1)*(g+2)/2%64;var y=h%5,b=(2*m+3*h)%5;m=y,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 x=0,O=0,E=0;E<7;E++){if(_&1){var T=(1<<E)-1;T<32?O^=1<<T:x^=1<<T-32}_&128?_=_<<1^113:_<<=1}d[w]=s.create(x,O)}})();var f=[];(function(){for(var m=0;m<25;m++)f[m]=s.create()})();var p=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var m=this._state=[],h=0;h<25;h++)m[h]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(m,h){for(var g=this._state,y=this.blockSize/2,b=0;b<y;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 x=g[b];x.high^=w,x.low^=_}for(var O=0;O<24;O++){for(var E=0;E<5;E++){for(var T=0,R=0,N=0;N<5;N++){var x=g[E+5*N];T^=x.high,R^=x.low}var D=f[E];D.high=T,D.low=R}for(var E=0;E<5;E++)for(var F=f[(E+4)%5],B=f[(E+1)%5],U=B.high,H=B.low,T=F.high^(U<<1|H>>>31),R=F.low^(H<<1|U>>>31),N=0;N<5;N++){var x=g[E+5*N];x.high^=T,x.low^=R}for(var G=1;G<25;G++){var T,R,x=g[G],ie=x.high,oe=x.low,z=l[G];z<32?(T=ie<<z|oe>>>32-z,R=oe<<z|ie>>>32-z):(T=oe<<z-32|ie>>>64-z,R=ie<<z-32|oe>>>64-z);var Q=f[c[G]];Q.high=T,Q.low=R}var re=f[0],Z=g[0];re.high=Z.high,re.low=Z.low;for(var E=0;E<5;E++)for(var N=0;N<5;N++){var G=E+5*N,x=g[G],$=f[G],q=f[(E+1)%5+5*N],Y=f[(E+2)%5+5*N];x.high=$.high^~q.high&Y.high,x.low=$.low^~q.low&Y.low}var x=g[0],j=d[O];x.high^=j.high,x.low^=j.low}},_doFinalize:function(){var m=this._data,h=m.words,g=this._nDataBytes*8,y=m.sigBytes*8,b=this.blockSize*32;h[y>>>5]|=1<<24-y%32,h[(e.ceil((y+1)/b)*b>>>5)-1]|=128,m.sigBytes=h.length*4,this._process();for(var _=this._state,w=this.cfg.outputLength/8,x=w/8,O=[],E=0;E<x;E++){var T=_[E],R=T.high,N=T.low;R=(R<<8|R>>>24)&16711935|(R<<24|R>>>8)&4278255360,N=(N<<8|N>>>24)&16711935|(N<<24|N>>>8)&4278255360,O.push(N),O.push(R)}return new o.init(O,w)},clone:function(){for(var m=i.clone.call(this),h=m._state=this._state.slice(0),g=0;g<25;g++)h[g]=h[g].clone();return m}});r.SHA3=i._createHelper(p),r.HmacSHA3=i._createHmacHelper(p)}(Math),t.SHA3})});var Rmr=S((Gxe,Mmr)=>{(function(t,e){typeof Gxe=="object"?Mmr.exports=Gxe=e(Pi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Gxe,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,x){for(var O=0;O<16;O++){var E=x+O,T=w[E];w[E]=(T<<8|T>>>24)&16711935|(T<<24|T>>>8)&4278255360}var R=this._hash.words,N=d.words,D=f.words,F=s.words,B=u.words,U=l.words,H=c.words,G,ie,oe,z,Q,re,Z,$,q,Y;re=G=R[0],Z=ie=R[1],$=oe=R[2],q=z=R[3],Y=Q=R[4];for(var j,O=0;O<80;O+=1)j=G+w[x+F[O]]|0,O<16?j+=m(ie,oe,z)+N[0]:O<32?j+=h(ie,oe,z)+N[1]:O<48?j+=g(ie,oe,z)+N[2]:O<64?j+=y(ie,oe,z)+N[3]:j+=b(ie,oe,z)+N[4],j=j|0,j=_(j,U[O]),j=j+Q|0,G=Q,Q=z,z=_(oe,10),oe=ie,ie=j,j=re+w[x+B[O]]|0,O<16?j+=b(Z,$,q)+D[0]:O<32?j+=y(Z,$,q)+D[1]:O<48?j+=g(Z,$,q)+D[2]:O<64?j+=h(Z,$,q)+D[3]:j+=m(Z,$,q)+D[4],j=j|0,j=_(j,H[O]),j=j+Y|0,re=Y,Y=q,q=_($,10),$=Z,Z=j;j=R[1]+oe+q|0,R[1]=R[2]+z+Y|0,R[2]=R[3]+Q+re|0,R[3]=R[4]+G+Z|0,R[4]=R[0]+ie+$|0,R[0]=j},_doFinalize:function(){var w=this._data,x=w.words,O=this._nDataBytes*8,E=w.sigBytes*8;x[E>>>5]|=128<<24-E%32,x[(E+64>>>9<<4)+14]=(O<<8|O>>>24)&16711935|(O<<24|O>>>8)&4278255360,w.sigBytes=(x.length+1)*4,this._process();for(var T=this._hash,R=T.words,N=0;N<5;N++){var D=R[N];R[N]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}return T},clone:function(){var w=i.clone.call(this);return w._hash=this._hash.clone(),w}});function m(w,x,O){return w^x^O}function h(w,x,O){return w&x|~w&O}function g(w,x,O){return(w|~x)^O}function y(w,x,O){return w&O|x&~O}function b(w,x,O){return w^(x|~O)}function _(w,x){return w<<x|w>>>32-x}r.RIPEMD160=i._createHelper(p),r.HmacRIPEMD160=i._createHmacHelper(p)}(Math),t.RIPEMD160})});var Xxe=S((Zxe,Amr)=>{(function(t,e){typeof Zxe=="object"?Amr.exports=Zxe=e(Pi()):typeof define=="function"&&define.amd?define(["./core"],e):e(t.CryptoJS)})(Zxe,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,g=0;g<c;g++)m[g]^=1549556828,h[g]^=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 Nmr=S((Yxe,Imr)=>{(function(t,e,r){typeof Yxe=="object"?Imr.exports=Yxe=e(Pi(),Hxe(),Xxe()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(t.CryptoJS)})(Yxe,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,g=m.words,y=d.keySize,b=d.iterations;h.length<y;){var _=f.update(c).finalize(m);f.reset();for(var w=_.words,x=w.length,O=_,E=1;E<b;E++){O=f.finalize(O),f.reset();for(var T=O.words,R=0;R<x;R++)w[R]^=T[R]}p.concat(_),g[0]++}return p.sigBytes=y*4,p}});e.PBKDF2=function(l,c,d){return u.create(d).compute(l,c)}}(),t.PBKDF2})});var W1=S((Qxe,jmr)=>{(function(t,e,r){typeof Qxe=="object"?jmr.exports=Qxe=e(Pi(),Hnt(),Xxe()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(t.CryptoJS)})(Qxe,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,g=d.iterations;m.length<h;){c&&f.update(c),c=f.update(u).finalize(l),f.reset();for(var y=1;y<g;y++)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 Nm=S((eOe,Dmr)=>{(function(t,e,r){typeof eOe=="object"?Dmr.exports=eOe=e(Pi(),W1()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(t.CryptoJS)})(eOe,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(D,F){return this.create(this._ENC_XFORM_MODE,D,F)},createDecryptor:function(D,F){return this.create(this._DEC_XFORM_MODE,D,F)},init:function(D,F,B){this.cfg=this.cfg.extend(B),this._xformMode=D,this._key=F,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(D){return this._append(D),this._process()},finalize:function(D){D&&this._append(D);var F=this._doFinalize();return F},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function D(F){return typeof F=="string"?N:E}return function(F){return{encrypt:function(B,U,H){return D(U).encrypt(F,B,U,H)},decrypt:function(B,U,H){return D(U).decrypt(F,B,U,H)}}}}()}),p=n.StreamCipher=f.extend({_doFinalize:function(){var D=this._process(!0);return D},blockSize:1}),m=r.mode={},h=n.BlockCipherMode=o.extend({createEncryptor:function(D,F){return this.Encryptor.create(D,F)},createDecryptor:function(D,F){return this.Decryptor.create(D,F)},init:function(D,F){this._cipher=D,this._iv=F}}),g=m.CBC=function(){var D=h.extend();D.Encryptor=D.extend({processBlock:function(B,U){var H=this._cipher,G=H.blockSize;F.call(this,B,U,G),H.encryptBlock(B,U),this._prevBlock=B.slice(U,U+G)}}),D.Decryptor=D.extend({processBlock:function(B,U){var H=this._cipher,G=H.blockSize,ie=B.slice(U,U+G);H.decryptBlock(B,U),F.call(this,B,U,G),this._prevBlock=ie}});function F(B,U,H){var G,ie=this._iv;ie?(G=ie,this._iv=e):G=this._prevBlock;for(var oe=0;oe<H;oe++)B[U+oe]^=G[oe]}return D}(),y=r.pad={},b=y.Pkcs7={pad:function(D,F){for(var B=F*4,U=B-D.sigBytes%B,H=U<<24|U<<16|U<<8|U,G=[],ie=0;ie<U;ie+=4)G.push(H);var oe=i.create(G,U);D.concat(oe)},unpad:function(D){var F=D.words[D.sigBytes-1>>>2]&255;D.sigBytes-=F}},_=n.BlockCipher=f.extend({cfg:f.cfg.extend({mode:g,padding:b}),reset:function(){var D;f.reset.call(this);var F=this.cfg,B=F.iv,U=F.mode;this._xformMode==this._ENC_XFORM_MODE?D=U.createEncryptor:(D=U.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==D?this._mode.init(this,B&&B.words):(this._mode=D.call(U,this,B&&B.words),this._mode.__creator=D)},_doProcessBlock:function(D,F){this._mode.processBlock(D,F)},_doFinalize:function(){var D,F=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(F.pad(this._data,this.blockSize),D=this._process(!0)):(D=this._process(!0),F.unpad(D)),D},blockSize:128/32}),w=n.CipherParams=o.extend({init:function(D){this.mixIn(D)},toString:function(D){return(D||this.formatter).stringify(this)}}),x=r.format={},O=x.OpenSSL={stringify:function(D){var F,B=D.ciphertext,U=D.salt;return U?F=i.create([1398893684,1701076831]).concat(U).concat(B):F=B,F.toString(l)},parse:function(D){var F,B=l.parse(D),U=B.words;return U[0]==1398893684&&U[1]==1701076831&&(F=i.create(U.slice(2,4)),U.splice(0,4),B.sigBytes-=16),w.create({ciphertext:B,salt:F})}},E=n.SerializableCipher=o.extend({cfg:o.extend({format:O}),encrypt:function(D,F,B,U){U=this.cfg.extend(U);var H=D.createEncryptor(B,U),G=H.finalize(F),ie=H.cfg;return w.create({ciphertext:G,key:B,iv:ie.iv,algorithm:D,mode:ie.mode,padding:ie.padding,blockSize:D.blockSize,formatter:U.format})},decrypt:function(D,F,B,U){U=this.cfg.extend(U),F=this._parse(F,U.format);var H=D.createDecryptor(B,U).finalize(F.ciphertext);return H},_parse:function(D,F){return typeof D=="string"?F.parse(D,this):D}}),T=r.kdf={},R=T.OpenSSL={execute:function(D,F,B,U,H){if(U||(U=i.random(64/8)),H)var G=d.create({keySize:F+B,hasher:H}).compute(D,U);else var G=d.create({keySize:F+B}).compute(D,U);var ie=i.create(G.words.slice(F),B*4);return G.sigBytes=F*4,w.create({key:G,iv:ie,salt:U})}},N=n.PasswordBasedCipher=E.extend({cfg:E.cfg.extend({kdf:R}),encrypt:function(D,F,B,U){U=this.cfg.extend(U);var H=U.kdf.execute(B,D.keySize,D.ivSize,U.salt,U.hasher);U.iv=H.iv;var G=E.encrypt.call(this,D,F,H.key,U);return G.mixIn(H),G},decrypt:function(D,F,B,U){U=this.cfg.extend(U),F=this._parse(F,U.format);var H=U.kdf.execute(B,D.keySize,D.ivSize,F.salt,U.hasher);U.iv=H.iv;var G=E.decrypt.call(this,D,F,H.key,U);return G}})}()})});var Lmr=S((tOe,$mr)=>{(function(t,e,r){typeof tOe=="object"?$mr.exports=tOe=e(Pi(),Nm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(tOe,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 kmr=S((rOe,Fmr)=>{(function(t,e,r){typeof rOe=="object"?Fmr.exports=rOe=e(Pi(),Nm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(rOe,function(t){return t.mode.CTR=function(){var e=t.lib.BlockCipherMode.extend(),r=e.Encryptor=e.extend({processBlock:function(n,o){var i=this._cipher,a=i.blockSize,s=this._iv,u=this._counter;s&&(u=this._counter=s.slice(0),this._iv=void 0);var l=u.slice(0);i.encryptBlock(l,0),u[a-1]=u[a-1]+1|0;for(var c=0;c<a;c++)n[o+c]^=l[c]}});return e.Decryptor=r,e}(),t.mode.CTR})});var Bmr=S((nOe,qmr)=>{(function(t,e,r){typeof nOe=="object"?qmr.exports=nOe=e(Pi(),Nm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(nOe,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 zmr=S((oOe,Umr)=>{(function(t,e,r){typeof oOe=="object"?Umr.exports=oOe=e(Pi(),Nm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(oOe,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 Vmr=S((iOe,Hmr)=>{(function(t,e,r){typeof iOe=="object"?Hmr.exports=iOe=e(Pi(),Nm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(iOe,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 Kmr=S((aOe,Jmr)=>{(function(t,e,r){typeof aOe=="object"?Jmr.exports=aOe=e(Pi(),Nm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(aOe,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 Gmr=S((sOe,Wmr)=>{(function(t,e,r){typeof sOe=="object"?Wmr.exports=sOe=e(Pi(),Nm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(sOe,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 Xmr=S((uOe,Zmr)=>{(function(t,e,r){typeof uOe=="object"?Zmr.exports=uOe=e(Pi(),Nm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(uOe,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 Qmr=S((lOe,Ymr)=>{(function(t,e,r){typeof lOe=="object"?Ymr.exports=lOe=e(Pi(),Nm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(lOe,function(t){return t.pad.ZeroPadding={pad:function(e,r){var n=r*4;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){for(var r=e.words,n=e.sigBytes-1,n=e.sigBytes-1;n>=0;n--)if(r[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},t.pad.ZeroPadding})});var thr=S((cOe,ehr)=>{(function(t,e,r){typeof cOe=="object"?ehr.exports=cOe=e(Pi(),Nm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(cOe,function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding})});var nhr=S((dOe,rhr)=>{(function(t,e,r){typeof dOe=="object"?rhr.exports=dOe=e(Pi(),Nm()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(t.CryptoJS)})(dOe,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 ihr=S((fOe,ohr)=>{(function(t,e,r){typeof fOe=="object"?ohr.exports=fOe=e(Pi(),Pk(),Mk(),W1(),Nm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(fOe,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 y=[],b=0;b<256;b++)b<128?y[b]=b<<1:y[b]=b<<1^283;for(var _=0,w=0,b=0;b<256;b++){var x=w^w<<1^w<<2^w<<3^w<<4;x=x>>>8^x&255^99,i[_]=x,a[x]=_;var O=y[_],E=y[O],T=y[E],R=y[x]*257^x*16843008;s[_]=R<<24|R>>>8,u[_]=R<<16|R>>>16,l[_]=R<<8|R>>>24,c[_]=R;var R=T*16843009^E*65537^O*257^_*16843008;d[x]=R<<24|R>>>8,f[x]=R<<16|R>>>16,p[x]=R<<8|R>>>24,m[x]=R,_?(_=O^y[y[y[T^O]]],w^=y[y[w]]):_=w=1}})();var h=[0,1,2,4,8,16,32,64,128,27,54],g=o.AES=n.extend({_doReset:function(){var y;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var b=this._keyPriorReset=this._key,_=b.words,w=b.sigBytes/4,x=this._nRounds=w+6,O=(x+1)*4,E=this._keySchedule=[],T=0;T<O;T++)T<w?E[T]=_[T]:(y=E[T-1],T%w?w>6&&T%w==4&&(y=i[y>>>24]<<24|i[y>>>16&255]<<16|i[y>>>8&255]<<8|i[y&255]):(y=y<<8|y>>>24,y=i[y>>>24]<<24|i[y>>>16&255]<<16|i[y>>>8&255]<<8|i[y&255],y^=h[T/w|0]<<24),E[T]=E[T-w]^y);for(var R=this._invKeySchedule=[],N=0;N<O;N++){var T=O-N;if(N%4)var y=E[T];else var y=E[T-4];N<4||T<=4?R[N]=y:R[N]=d[i[y>>>24]]^f[i[y>>>16&255]]^p[i[y>>>8&255]]^m[i[y&255]]}}},encryptBlock:function(y,b){this._doCryptBlock(y,b,this._keySchedule,s,u,l,c,i)},decryptBlock:function(y,b){var _=y[b+1];y[b+1]=y[b+3],y[b+3]=_,this._doCryptBlock(y,b,this._invKeySchedule,d,f,p,m,a);var _=y[b+1];y[b+1]=y[b+3],y[b+3]=_},_doCryptBlock:function(y,b,_,w,x,O,E,T){for(var R=this._nRounds,N=y[b]^_[0],D=y[b+1]^_[1],F=y[b+2]^_[2],B=y[b+3]^_[3],U=4,H=1;H<R;H++){var G=w[N>>>24]^x[D>>>16&255]^O[F>>>8&255]^E[B&255]^_[U++],ie=w[D>>>24]^x[F>>>16&255]^O[B>>>8&255]^E[N&255]^_[U++],oe=w[F>>>24]^x[B>>>16&255]^O[N>>>8&255]^E[D&255]^_[U++],z=w[B>>>24]^x[N>>>16&255]^O[D>>>8&255]^E[F&255]^_[U++];N=G,D=ie,F=oe,B=z}var G=(T[N>>>24]<<24|T[D>>>16&255]<<16|T[F>>>8&255]<<8|T[B&255])^_[U++],ie=(T[D>>>24]<<24|T[F>>>16&255]<<16|T[B>>>8&255]<<8|T[N&255])^_[U++],oe=(T[F>>>24]<<24|T[B>>>16&255]<<16|T[N>>>8&255]<<8|T[D&255])^_[U++],z=(T[B>>>24]<<24|T[N>>>16&255]<<16|T[D>>>8&255]<<8|T[F&255])^_[U++];y[b]=G,y[b+1]=ie,y[b+2]=oe,y[b+3]=z},keySize:256/32});e.AES=n._createHelper(g)}(),t.AES})});var shr=S((pOe,ahr)=>{(function(t,e,r){typeof pOe=="object"?ahr.exports=pOe=e(Pi(),Pk(),Mk(),W1(),Nm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(pOe,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,g=h.words,y=[],b=0;b<56;b++){var _=a[b]-1;y[b]=g[_>>>5]>>>31-_%32&1}for(var w=this._subKeys=[],x=0;x<16;x++){for(var O=w[x]=[],E=u[x],b=0;b<24;b++)O[b/6|0]|=y[(s[b]-1+E)%28]<<31-b%6,O[4+(b/6|0)]|=y[28+(s[b+24]-1+E)%28]<<31-b%6;O[0]=O[0]<<1|O[0]>>>31;for(var b=1;b<7;b++)O[b]=O[b]>>>(b-1)*4+3;O[7]=O[7]<<5|O[7]>>>27}for(var T=this._invSubKeys=[],b=0;b<16;b++)T[b]=w[15-b]},encryptBlock:function(h,g){this._doCryptBlock(h,g,this._subKeys)},decryptBlock:function(h,g){this._doCryptBlock(h,g,this._invSubKeys)},_doCryptBlock:function(h,g,y){this._lBlock=h[g],this._rBlock=h[g+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 _=y[b],w=this._lBlock,x=this._rBlock,O=0,E=0;E<8;E++)O|=l[E][((x^_[E])&c[E])>>>0];this._lBlock=x,this._rBlock=w^O}var T=this._lBlock;this._lBlock=this._rBlock,this._rBlock=T,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[g]=this._lBlock,h[g+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function f(h,g){var y=(this._lBlock>>>h^this._rBlock)&g;this._rBlock^=y,this._lBlock^=y<<h}function p(h,g){var y=(this._rBlock>>>h^this._lBlock)&g;this._lBlock^=y,this._rBlock^=y<<h}e.DES=o._createHelper(d);var m=i.TripleDES=o.extend({_doReset:function(){var h=this._key,g=h.words;if(g.length!==2&&g.length!==4&&g.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var y=g.slice(0,2),b=g.length<4?g.slice(0,2):g.slice(2,4),_=g.length<6?g.slice(0,2):g.slice(4,6);this._des1=d.createEncryptor(n.create(y)),this._des2=d.createEncryptor(n.create(b)),this._des3=d.createEncryptor(n.create(_))},encryptBlock:function(h,g){this._des1.encryptBlock(h,g),this._des2.decryptBlock(h,g),this._des3.encryptBlock(h,g)},decryptBlock:function(h,g){this._des3.decryptBlock(h,g),this._des2.encryptBlock(h,g),this._des1.decryptBlock(h,g)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=o._createHelper(m)}(),t.TripleDES})});var lhr=S((mOe,uhr)=>{(function(t,e,r){typeof mOe=="object"?uhr.exports=mOe=e(Pi(),Pk(),Mk(),W1(),Nm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(mOe,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 g=d[f];d[f]=d[p],d[p]=g}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 dhr=S((hOe,chr)=>{(function(t,e,r){typeof hOe=="object"?chr.exports=hOe=e(Pi(),Pk(),Mk(),W1(),Nm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(hOe,function(t){return function(){var e=t,r=e.lib,n=r.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,g=h[0],y=h[1],b=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,_=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,w=b>>>16|_&4294901760,x=_<<16|b&65535;m[0]^=b,m[1]^=w,m[2]^=_,m[3]^=x,m[4]^=b,m[5]^=w,m[6]^=_,m[7]^=x;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,g=((m*m>>>17)+m*h>>>15)+h*h,y=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=g^y}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 phr=S((gOe,fhr)=>{(function(t,e,r){typeof gOe=="object"?fhr.exports=gOe=e(Pi(),Pk(),Mk(),W1(),Nm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(gOe,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,g=h[0],y=h[1],b=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,_=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,w=b>>>16|_&4294901760,x=_<<16|b&65535;p[0]^=b,p[1]^=w,p[2]^=_,p[3]^=x,p[4]^=b,p[5]^=w,p[6]^=_,p[7]^=x;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,g=((m*m>>>17)+m*h>>>15)+h*h,y=((p&4294901760)*p|0)+((p&65535)*p|0);s[f]=g^y}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 hhr=S((yOe,mhr)=>{(function(t,e,r){typeof yOe=="object"?mhr.exports=yOe=e(Pi(),Pk(),Mk(),W1(),Nm()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(t.CryptoJS)})(yOe,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 g=h>>24&255,y=h>>16&255,b=h>>8&255,_=h&255,w=m.sbox[0][g]+m.sbox[1][y];return w=w^m.sbox[2][b],w=w+m.sbox[3][_],w}function c(m,h,g){let y=h,b=g,_;for(let w=0;w<i;++w)y=y^m.pbox[w],b=l(m,y)^b,_=y,y=b,b=_;return _=y,y=b,b=_,b=b^m.pbox[i],y=y^m.pbox[i+1],{left:y,right:b}}function d(m,h,g){let y=h,b=g,_;for(let w=i+1;w>1;--w)y=y^m.pbox[w],b=l(m,y)^b,_=y,y=b,b=_;return _=y,y=b,b=_,b=b^m.pbox[1],y=y^m.pbox[0],{left:y,right:b}}function f(m,h,g){for(let x=0;x<4;x++){m.sbox[x]=[];for(let O=0;O<256;O++)m.sbox[x][O]=s[x][O]}let y=0;for(let x=0;x<i+2;x++)m.pbox[x]=a[x]^h[y],y++,y>=g&&(y=0);let b=0,_=0,w=0;for(let x=0;x<i+2;x+=2)w=c(m,b,_),b=w.left,_=w.right,m.pbox[x]=b,m.pbox[x+1]=_;for(let x=0;x<4;x++)for(let O=0;O<256;O+=2)w=c(m,b,_),b=w.left,_=w.right,m.sbox[x][O]=b,m.sbox[x][O+1]=_;return!0}var p=o.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var m=this._keyPriorReset=this._key,h=m.words,g=m.sigBytes/4;f(u,h,g)}},encryptBlock:function(m,h){var g=c(u,m[h],m[h+1]);m[h]=g.left,m[h+1]=g.right},decryptBlock:function(m,h){var g=d(u,m[h],m[h+1]);m[h]=g.left,m[h+1]=g.right},blockSize:64/32,keySize:128/32,ivSize:64/32});e.Blowfish=n._createHelper(p)}(),t.Blowfish})});var V8=S((bOe,ghr)=>{(function(t,e,r){typeof bOe=="object"?ghr.exports=bOe=e(Pi(),uie(),pmr(),hmr(),Pk(),bmr(),Mk(),Hnt(),Hxe(),Cmr(),Vnt(),Tmr(),Pmr(),Rmr(),Xxe(),Nmr(),W1(),Nm(),Lmr(),kmr(),Bmr(),zmr(),Vmr(),Kmr(),Gmr(),Xmr(),Qmr(),thr(),nhr(),ihr(),shr(),lhr(),dhr(),phr(),hhr()):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)})(bOe,function(t){return t})});var Jnt,Hio,_Oe,yhr=v(()=>{MN();Pt();jxe();Jnt="copilot-index-chunk-",Hio=".json",_Oe=class{constructor(e,r,n){this.app=e;this.baseDir=r;this.identifier=n}getChunkPath(e){return`${this.baseDir}/${Jnt}${this.identifier}-${e}.json`}getMetadataPath(){return`${this.baseDir}/${Jnt}${this.identifier}-metadata.json`}getLegacyPath(){return`${this.baseDir}/copilot-index-${this.identifier}${Hio}`}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,[]);ce().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,ce().debug&&console.log(`Partition ${s+1}: ${a.length} documents`)}),ce().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 Bnt(e),n=ce().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(ce().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)),ce().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)),ce().debug&&console.log(`Saved partition ${l+1}/${n}`)}ce().debug&&console.log("Saved all partitions")}catch(r){throw console.error("Error saving database:",r),new Po(`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 Po("Invalid legacy database format");let l=await B8({schema:u.schema,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return await Nxe(l,u),l}let r=await this.loadMetadata(),n=await B8({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 Po("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++):ce().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 Nxe(n,o),n}catch(e){throw console.error("Error loading database:",e),new Po(`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}/${Jnt}${this.identifier}`)&&await this.app.vault.adapter.remove(n)}catch(e){throw console.error("Error clearing storage:",e),new Po(`Failed to clear storage: ${e.message}`)}}async exists(){let e=this.getLegacyPath();if(ce().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 Po("No existing database found");let r=JSON.parse(await this.app.vault.adapter.read(e));if(!r?.schema)throw new Po("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 whr={};Xn(whr,{categorizePatterns:()=>J8,createPatternSettingsValue:()=>K8,extractAppIgnoreSettings:()=>lie,getAllQAMarkdownContent:()=>Gnt,getDecodedPatterns:()=>P_,getExtensionPattern:()=>Znt,getFilePattern:()=>W8,getInternalExcludePaths:()=>_hr,getMatchingPatterns:()=>id,getTagPattern:()=>cie,getVectorLength:()=>Wnt,isInternalExcludedFile:()=>G8,isInternalExcludedPath:()=>vhr,previewPatternValue:()=>Kio,shouldIndexFile:()=>ml});async function Wnt(t){if(!t)throw new Po("Embedding instance not found.");try{let r=await t.embedQuery("Sample text for embedding");if(!r||r.length===0)throw new Po("Failed to get valid embedding vector length");return console.log(`Detected vector length: ${r.length} for model: ${wd.getModelName(t)}`),r.length}catch(e){throw console.error("Error getting vector length:",e),new Po("Failed to determine embedding vector length. Please check your embedding model settings.")}}async function Gnt(t){let e="",{inclusions:r,exclusions:n}=id(),o=t.vault.getMarkdownFiles().filter(i=>ml(i,r,n));return await Promise.all(o.map(i=>t.vault.cachedRead(i))).then(i=>i.map(a=>e+=a+" ")),e}function P_(t){let e=[];return e.push(...t.split(",").map(r=>decodeURIComponent(r.trim())).filter(r=>r.length>0)),e}function Vio(){return ce().qaExclusions?P_(ce().qaExclusions):[]}function Jio(){return ce().qaInclusions?P_(ce().qaInclusions):[]}function id(t){let e=t?.inclusions?P_(t.inclusions):t?.isProject?[]:Jio(),r=t?.exclusions?P_(t.exclusions):t?.isProject?[]:Vio();return{inclusions:e.length>0?J8(e):null,exclusions:r.length>0?J8(r):null}}function ml(t,e,r,n){return!(G8(t)||r&&bhr(t.path,r)||e&&!bhr(t.path,e)||n&&!e)}function J8(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 Kio(t){return P_(t).join(", ")}function K8({tagPatterns:t,extensionPatterns:e,folderPatterns:r,notePatterns:n}){return[...t??[],...e??[],...n??[],...r??[]].map(i=>encodeURIComponent(i)).join(",")}function Wio(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);if(r instanceof Knt.TFile){let n=CO(r);if(e.some(o=>n.some(i=>i.toLowerCase()===k6(o).toLowerCase())))return!0}return!1}function Gio(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 Zio(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 Xio(t,e){if(e.length===0)return!1;let r=app.vault.getAbstractFileByPath(t);return!!(r instanceof Knt.TFile&&e.some(n=>n.slice(2,-2)===r.basename))}function bhr(t,e){if(!e)return!1;let{tagPatterns:r,extensionPatterns:n,folderPatterns:o,notePatterns:i}=e;return Wio(t,r??[])||Gio(t,n??[])||Zio(t,o??[])||Xio(t,i??[])}function lie(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 cie(t){return`#${t}`}function W8(t){return`[[${t.basename}]]`}function Znt(t){return`*.${t}`}function _hr(){return[ey.getLogPath()]}function vhr(t){return new Set(_hr()).has(t)}function G8(t){return vhr(t.path)}var Knt,vb=v(()=>{MN();dH();Pt();L6();wr();Knt=require("obsidian")});var Shr,EA,G1,vOe=v(()=>{dH();MN();Dt();Pt();wr();jxe();znt();Shr=L(V8()),EA=require("obsidian");yhr();vb();G1=class t{constructor(e){this.app=e;this.isInitialized=!1;this.isIndexLoaded=!1;this.hasUnsavedChanges=!1;this.filesWithoutEmbeddings=new Set;this.upsertMutex=new bH;Ou(async()=>{let r=ce();EA.Platform.isMobile&&r.disableIndexOnMobile?(this.isIndexLoaded=!1,this.oramaDb=void 0):EA.Platform.isMobile&&!r.disableIndexOnMobile&&!this.oramaDb&&await this.initializeDB(await wd.getInstance().getEmbeddingsAPI());let n=await this.getDbPath();this.dbPath&&n!==this.dbPath&&(J("Path change detected, reinitializing database..."),this.dbPath=n,await this.initializeChunkedStorage(),await this.initializeDB(await wd.getInstance().getEmbeddingsAPI()),J("Database reinitialized with new path:",n))})}async initializeChunkedStorage(){if(!this.app.vault.adapter)throw new Po("Vault adapter not available. Please try again later.");let e=await this.getDbPath();this.chunkedStorage=new _Oe(this.app,e,this.getVaultIdentifier()),this.isInitialized=!0}async initializeDB(e){try{if(this.isInitialized||(this.dbPath=await this.getDbPath(),await this.initializeChunkedStorage()),EA.Platform.isMobile&&ce().disableIndexOnMobile){this.isIndexLoaded=!1,this.oramaDb=void 0;return}if(!this.chunkedStorage)throw new Po("Storage not initialized properly");try{if(await this.chunkedStorage.exists())return this.oramaDb=await this.chunkedStorage.loadDatabase(),J("Loaded existing chunked semantic index database from disk."),this.oramaDb}catch(n){ue("Failed to load existing semantic index database, creating new one:",n)}let r=await this.createNewDb(e);return this.oramaDb=r,r}catch(r){ue("Error initializing semantic index database:",r),new EA.Notice("Failed to initialize Copilot database. Some features may be limited.");return}}async saveDB(){if(!(EA.Platform.isMobile&&ce().disableIndexOnMobile)){if(!this.oramaDb||!this.chunkedStorage)try{if(await this.initializeDB(await wd.getInstance().getEmbeddingsAPI()),!this.oramaDb||!this.chunkedStorage)throw new Po("Semantic index database not found.")}catch(e){throw ue("Failed to initialize database during save:",e),new Po("Failed to initialize and save database.")}try{await this.chunkedStorage.saveDatabase(this.oramaDb),this.hasUnsavedChanges=!1,ce().debug&&J("Semantic index database saved successfully at:",this.dbPath)}catch(e){throw ue("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 EA.Notice("Local Copilot index cleared successfully."),J("Local Copilot index cleared successfully, new instance created.")}catch(r){throw ue("Error clearing the local Copilot index:",r),new EA.Notice("An error occurred while clearing the local Copilot index."),r}}async removeDocs(e){if(!this.oramaDb)throw new Po("Semantic index database not found.");try{let r=await _b(this.oramaDb,{term:e,properties:["path"]});r.hits.length>0&&(await sie(this.oramaDb,r.hits.map(n=>n.id),500),ce().debug&&J(`Deleted document from local Copilot index: ${e}`)),this.markUnsavedChanges()}catch(r){ue("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(ce().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),J("Created directory:",r))}return r}getVaultIdentifier(){let e=this.app.vault.getName();return(0,Shr.MD5)(e).toString()}markUnsavedChanges(){this.hasUnsavedChanges=!0}async createNewDb(e){if(!e)throw new Po("Embedding instance not found.");let r=await Wnt(e);if(!r||r===0)throw new Po("Invalid vector length detected. Please check if your embedding model is working.");let n=this.createDynamicSchema(r),o=await B8({schema:n,components:{tokenizer:{stemmer:void 0,stopWords:void 0}}});return J(`Created new semantic index database for ${this.dbPath}. Embedding model: ${wd.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 _b(e,{term:r,properties:["path"],exact:!0,includeVectors:!0})).hits:void 0}static async getDocsByEmbedding(e,r,n){return(await _b(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 _b(e,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return r.hits.length>0?r.hits[0].document.mtime:0}catch(r){return ue("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,ce().numPartitions),o=await _b(r,{term:e.id,properties:["id"],limit:1});o.hits.length>0&&await hH(r,o.hits[0].id);try{return await aie(r,e),J(`${o.hits.length>0?"Updated":"Inserted"} document ${e.id} in partition ${n}`),this.markUnsavedChanges(),e}catch(i){if(ue(`Failed to ${o.hits.length>0?"update":"insert"} document ${e.id}:`,i),o.hits.length>0)try{await aie(r,o.hits[0].document)}catch(a){ue("Failed to restore previous document version:",a)}return}}catch(n){ue(`Error upserting document ${e.id}:`,n);return}})}async getLatestFileMtime(){if(!this.oramaDb)throw new Error("DB not initialized");try{let e=await _b(this.oramaDb,{term:"",limit:1,sortBy:{property:"mtime",order:"DESC"}});return e.hits.length>0?e.hits[0].document.mtime:0}catch(e){return ue("Error getting latest file mtime from VectorDB:",e),0}}async checkAndHandleEmbeddingModelChange(e){if(!this.oramaDb){J("Semantic index database not loaded in memory. Checking for existing index...");try{await this.initializeDB(e)}catch(o){throw ue("Failed to initialize database:",o),new Po("Failed to initialize semantic index database. Please check your embedding model settings.")}if(!this.oramaDb)return J("No existing index found. Will create new index."),!1}let r=await _b(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=wd.getModelName(e);if(!wAt(n,o))return new EA.Notice("New embedding model detected. Rebuilding Copilot index from scratch."),J(`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 J("No previous embedding model found in the database.");return!1}static async getAllDocuments(e){return(await _b(e,{term:"",limit:1e5,includeVectors:!0})).hits.map(n=>n.document)}async garbageCollect(){if(!this.oramaDb){J("Semantic index database not found during garbage collection. Attempting to initialize...");try{let e=await wd.getInstance().getEmbeddingsAPI();if(!e)throw new Po("No embedding model available.");if(await this.initializeDB(e),!this.oramaDb)throw new Po("Failed to initialize database after attempt.")}catch(e){throw ue("Failed to initialize database during garbage collection:",e),new Po("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}=id(),i=new Set(e.filter(u=>ml(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:(J("Copilot index: Docs to remove during garbage collection:",Array.from(new Set(s.map(u=>u.path))).join(", ")),s.length===1?await hH(this.oramaDb,s[0].id):await sie(this.oramaDb,s.map(u=>u.id),500),await this.saveDB(),s.length)}catch(e){throw ue("Error garbage collecting the Copilot index:",e),new Po("Failed to garbage collect the Copilot index.")}}async getIndexedFiles(){if(!this.oramaDb)throw new Po("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 ue("Error getting indexed files:",e),new Po("Failed to retrieve indexed files.")}}async isIndexEmpty(){if(!this.oramaDb)return!0;try{return(await _b(this.oramaDb,{term:"",limit:1})).hits.length===0}catch(e){throw ue("Error checking if database is empty:",e),new Po("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 Po("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 Po("Orama database not found.");try{let e=await this.getIndexedFiles();for(let n of e)await this.hasEmbeddings(n)||this.markFileMissingEmbeddings(n);let r=this.getFilesMissingEmbeddings();r.length>0?J("Files missing embeddings after integrity check:",r.join(", ")):J("Index integrity check completed. All documents have embeddings.")}catch(e){throw ue("Error checking index integrity:",e),new Po("Failed to check index integrity.")}}}});var Z8,Yio,wOe,Chr=v(()=>{Tu();gd();Dt();Pt();Z8=require("obsidian");vb();Yio=5e3,wOe=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()||Z8.Platform.isMobile&&ce().disableIndexOnMobile||jN()!=="copilot_plus")return;let n=this.lastActiveFile,o=this.lastActiveFileMtime,i=e?.view;if(this.lastActiveFile=i instanceof Z8.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}=id(),u=ml(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(()=>{ce().debug&&console.log("Copilot Plus: Triggering reindex for file ",e.path),this.indexOps.reindexFile(e),this.debounceTimer=null},Yio))};this.handleFileDelete=async e=>{this.shouldHandleEvents()&&e instanceof Z8.TFile&&await this.dbOps.removeDocs(e.path)};this.syncEventListeners(),Ou(()=>{this.syncEventListeners()})}shouldHandleEvents(){return ce().enableSemanticSearchV3}syncEventListeners(){let e=this.shouldHandleEvents();e&&!this.listenersActive?(J("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 die,xhr=v(()=>{die=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 jm,Xnt=v(()=>{jm=class{constructor(t){M(this,"pageContent");M(this,"metadata");M(this,"id");this.pageContent=t.pageContent!==void 0?t.pageContent.toString():"",this.metadata=t.metadata??{},this.id=t.id}}});var fie,Ohr,Thr=v(()=>{Gh();fie=class extends Lo{constructor(){super(...arguments);M(this,"lc_namespace",["langchain_core","documents","transformers"])}invoke(e,r){return this.transformDocuments(e)}},Ohr=class extends fie{async transformDocuments(t){let e=[];for(let r of t){let n=await this._transformDocument(r);e.push(n)}return e}}});var Qio,X8=v(()=>{Do();Xnt();Thr();Qio={};Et(Qio,{BaseDocumentTransformer:()=>fie,Document:()=>jm,MappingDocumentTransformer:()=>Ohr})});var Ehr,pie,Phr=v(()=>{X8();jYe();Ehr=class extends fie{constructor(e){super(e);M(this,"lc_namespace",["langchain","document_transformers","text_splitters"]);M(this,"chunkSize",1e3);M(this,"chunkOverlap",200);M(this,"keepSeparator",!1);M(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,g=c.indexOf(m,p+1);if(f===null){let w=this.numberOfNewLines(c,0,g);d+=w}else{let w=p+await this.lengthFunction(f);if(w<g){let x=this.numberOfNewLines(c,w,g);d+=x}else if(w>g){let x=this.numberOfNewLines(c,g,w);d-=x}s&&(h+=a)}let y=this.numberOfNewLines(m),b=o[l].loc&&typeof o[l].loc=="object"?{...o[l].loc}:{};b.lines={from:d,to:d+y};let _={...o[l],loc:b};h+=m,u.push(new jm({pageContent:h,metadata:_})),d+=y,f=m,p=g}}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}},pie=class Ynt extends Ehr{constructor(r){super(r);M(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 Ynt({...n,separators:Ynt.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 Qnt=v(()=>{Phr()});var Mhr,PA,SOe,Rhr=v(()=>{zr();dH();Dt();xhr();Pt();wr();Mhr=L(V8());Qnt();PA=require("obsidian");vb();SOe=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=ce();this.rateLimiter=new die(o.embeddingRequestsPerMin),this.embeddingBatchSize=o.embeddingBatchSize,this.checkpointInterval=8*this.embeddingBatchSize,Ou(async()=>{let i=ce();this.rateLimiter=new die(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 PA.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 PA.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){ue(`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(()=>{J("Copilot index final save completed."),this.dbOps.checkIndexIntegrity().catch(s=>{ue("Background integrity check failed:",s)})}).catch(s=>{ue("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=wd.getModelName(r),o=pie.fromLanguage("markdown",{chunkSize:qz}),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:Zh(new Date(a.stat.ctime)).display,modified:Zh(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,Mhr.MD5)(e).toString()}async getFilesToIndex(e){let{inclusions:r,exclusions:n}=id(),o=this.app.vault.getMarkdownFiles();if(e)return o.filter(c=>ml(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(!ml(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 J([`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 PA.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 PA.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=ce(),o=P_(n.qaInclusions);o.length>0&&r.push(`Inclusions: ${o.join(", ")}`);let a=[...lie(this.app),...P_(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 PA.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 PA.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 PA.Notice("Indexing cancelled");return}e.length>0?new PA.Notice(`Indexing completed with ${e.length} errors. Check console for details.`):new PA.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(),ce().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 vg={};Xn(vg,{default:()=>Z1});var mie,Z1,Dm=v(()=>{MN();dH();Pt();mie=require("obsidian");vOe();Chr();Rhr();Z1=class t{constructor(){this.embeddingsManager=wd.getInstance(),this.dbOps=new G1(app),this.indexOps=new SOe(app,this.dbOps,this.embeddingsManager),this.eventHandler=new wOe(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={...ce()};let e=async()=>{let r=ce(),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())}};Ou(()=>{this.initializationPromise=e()})}async initialize(){if(ce().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 Po&&n.message.includes("Vault adapter not available")&&(r--,r>0)){await new Promise(o=>setTimeout(o,100));continue}new mie.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(),mie.Platform.isMobile&&ce().disableIndexOnMobile?(new mie.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 zJe(t){return t.split("|")[1]==="copilot-plus"}function Y8(){return So().isPlusUser}async function jS(t){return ce().plusLicenseKey?(await Ru.getInstance().validateLicenseKey(t)).isValid:(oot(),!1)}function Ihr(){let t=eao,e=rot,r=ce().embeddingModelKey;J("applyPlusSettings: Changing embedding model",{from:r,to:e,changed:r!==e}),oIt(t),Hz("copilot_plus"),EN({defaultModelKey:t,embeddingModelKey:e,defaultChainType:"copilot_plus"}),r!==e?(J("applyPlusSettings: Embedding model changed, triggering indexing"),Promise.resolve().then(()=>(Dm(),vg)).then(async n=>{await n.default.getInstance().indexVaultToVectorStore()}).catch(n=>{ue("Failed to trigger indexing after Plus settings applied:",n),new Ahr.Notice("Failed to update Copilot index. Please try force reindexing from the command palette.")})):J("applyPlusSettings: No embedding model change, skipping indexing")}function not(t){return`https://www.obsidiancopilot.com?utm_source=obsidian&utm_medium=${t}`}function d4(t){window.open(not(t),"_blank")}function Nhr(){et("isPlusUser",!0)}function oot(){let t=ce().isPlusUser;et("isPlusUser",!1),t&&new Mye(app).open()}var Ahr,eot,eao,tot,rot,pka,mka,$v=v(()=>{Tu();gd();E$t();zr();RS();Dt();Pt();Ahr=require("obsidian"),eot="copilot-plus-flash",eao=eot+"|"+"copilot-plus",tot="copilot-plus-small",rot=tot+"|"+"copilot-plus",pka=Ls.defaultModelKey,mka=Ls.embeddingModelKey});function Rk(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 COe=v(()=>{});var jhr,Ru,RS=v(()=>{zr();zz();Dt();$v();Pt();COe();jhr=require("obsidian"),Ru=class t{constructor(){this.pluginVersion="Unknown"}static getInstance(){return t.instance||(t.instance=new t),t.instance}checkLicenseKey(){if(!ce().plusLicenseKey)throw new jhr.Notice("Copilot Plus license key not found. Please enter your license key in the settings."),new Error("License key not initialized")}setPluginVersion(e){this.pluginVersion=e}async makeRequest(e,r,n="POST",o=!1,i=!1){i||this.checkLicenseKey(),r.user_id=ce().userId;let a=new URL(`${tHe}${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 $i(ce().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 J(`[API ${e} request]:`,u),{data:u}}async makeFormDataRequest(e,r,n=!1){n||this.checkLicenseKey(),r.append("user_id",ce().userId);let o=new URL(`${tHe}${e}`);try{let i=await fetch(o.toString(),{method:"POST",headers:{Authorization:`Bearer ${await $i(ce().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 J(`[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 $i(ce().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"?(oot(),{isValid:!1}):{isValid:void 0}:(Nhr(),{isValid:!0,plan:n?.plan})}async broca(e,r){let{data:n,error:o}=await this.makeRequest("/broca",{message:e,is_project_mode:r});if(o)throw o;if(!n)throw new Error("No data returned from broca");return n}async rerank(e,r){let{data:n,error:o}=await this.makeRequest("/rerank",{query:e,documents:r,model:"rerank-2"});if(o)throw o;if(!n)throw new Error("No data returned from rerank");return n}async url4llm(e){let{data:r,error:n}=await this.makeRequest("/url4llm",{url:e});if(n)throw n;if(!r)throw new Error("No data returned from url4llm");return r}async pdf4llm(e){let r=Rk(e),{data:n,error:o}=await this.makeRequest("/pdf4llm",{pdf:r});if(o)throw o;if(!n)throw new Error("No data returned from pdf4llm");return n}async docs4llm(e,r){let n=new FormData,o=this.getMimeTypeFromExtension(r),i=new Blob([e],{type:o}),a=`file.${r}`,s=new File([i],a,{type:o});n.append("files",s),n.append("file_type",r);let{data:u,error:l}=await this.makeFormDataRequest("/docs4llm",n);if(l)throw l;if(!u)throw new Error("No data returned from docs4llm");return u}getMimeTypeFromExtension(e){return{pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",epub:"application/epub+zip",txt:"text/plain",rtf:"application/rtf",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",tiff:"image/tiff",webp:"image/webp",html:"text/html",htm:"text/html",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xls:"application/vnd.ms-excel",csv:"text/csv",mp3:"audio/mpeg",mp4:"video/mp4",wav:"audio/wav",webm:"video/webm"}[e.toLowerCase()]||"application/octet-stream"}async webSearch(e){let{data:r,error:n}=await this.makeRequest("/websearch",{query:e});if(n)throw n;if(!r)throw new Error("No data returned from websearch");return r}async youtube4llm(e){let{data:r,error:n}=await this.makeRequest("/youtube4llm",{url:e});if(n)throw n;if(!r)throw new Error("No data returned from youtube4llm");return r}async autocomplete(e,r="",n=""){let{data:o,error:i}=await this.makeRequest("/autocomplete",{prompt:e,note_context:r,relevant_notes:n,max_tokens:64});if(i)throw i;if(!o)throw new Error("No data returned from autocomplete");return o}async wordcomplete(e,r="",n){let{data:o,error:i}=await this.makeRequest("/wordcomplete",{prefix:e,suffix:r,suggestions:n});if(i)throw i;if(!o)throw new Error("No data returned from wordcomplete");return o}}});var Dhr,Q8,iot=v(()=>{Dt();Dhr=L(V8()),Q8=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)||(J("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,Dhr.MD5)(n).toString()}getCachePath(e){return`${this.cacheDir}/${e}.md`}async get(e){try{let r=this.memoryCache.get(e);if(r)return J("Memory cache hit for file:",e),r.content;let n=this.getCachePath(e);if(await app.vault.adapter.exists(n)){J("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 J("Cache miss for file:",e),null}catch(r){return ue("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),J("Cached file content:",e)}catch(n){ue("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),J("Removed file from cache:",e))}catch(r){ue("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);J("Clearing file cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ue("Error clearing file cache:",e)}}}});var xOe=S((Tka,Fhr)=>{var tao="Expected a function",$hr=NaN,rao="[object Symbol]",nao=/^\s+|\s+$/g,oao=/^[-+]0x[0-9a-f]+$/i,iao=/^0b[01]+$/i,aao=/^0o[0-7]+$/i,sao=parseInt,uao=typeof window=="object"&&window&&window.Object===Object&&window,lao=typeof self=="object"&&self&&self.Object===Object&&self,cao=uao||lao||Function("return this")(),dao=Object.prototype,fao=dao.toString,pao=Math.max,mao=Math.min,aot=function(){return cao.Date.now()};function hao(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(tao);e=Lhr(e)||0,sot(r)&&(c=!!r.leading,d="maxWait"in r,i=d?pao(Lhr(r.maxWait)||0,e):i,f="trailing"in r?!!r.trailing:f);function p(O){var E=n,T=o;return n=o=void 0,l=O,a=t.apply(T,E),a}function m(O){return l=O,s=setTimeout(y,e),c?p(O):a}function h(O){var E=O-u,T=O-l,R=e-E;return d?mao(R,i-T):R}function g(O){var E=O-u,T=O-l;return u===void 0||E>=e||E<0||d&&T>=i}function y(){var O=aot();if(g(O))return b(O);s=setTimeout(y,h(O))}function b(O){return s=void 0,f&&n?p(O):(n=o=void 0,a)}function _(){s!==void 0&&clearTimeout(s),l=0,n=u=o=s=void 0}function w(){return s===void 0?a:b(aot())}function x(){var O=aot(),E=g(O);if(n=arguments,o=this,u=O,E){if(s===void 0)return m(u);if(d)return s=setTimeout(y,e),p(u)}return s===void 0&&(s=setTimeout(y,e)),a}return x.cancel=_,x.flush=w,x}function sot(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function gao(t){return!!t&&typeof t=="object"}function yao(t){return typeof t=="symbol"||gao(t)&&fao.call(t)==rao}function Lhr(t){if(typeof t=="number")return t;if(yao(t))return $hr;if(sot(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=sot(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(nao,"");var r=iao.test(t);return r||aao.test(t)?sao(t.slice(2),r?2:8):oao.test(t)?$hr:+t}Fhr.exports=hao});var khr,OOe,qhr,Ak,UC,hie=v(()=>{iot();Dt();vb();Pt();khr=L(V8()),OOe=require("obsidian"),qhr=L(xOe());znt();Ak=class Ak{constructor(){this.cacheDir=".copilot/project-context-cache";this.memoryCache=new Map;this.projectMutexMap=new Map;this.mutexCreationMutex=new bH;this.handleFileEvent=e=>{e instanceof OOe.TFile&&this.debouncedHandleFileChange(e)};this.handleFileChange=async e=>{try{if(e.extension!=="md")return;let n=ce().projectList||[];for(let o of n){let{inclusions:i,exclusions:a}=id({inclusions:o.contextSource.inclusions,exclusions:o.contextSource.exclusions,isProject:!0});ml(e,i,a,!0)&&(await this.invalidateMarkdownContext(o),J(`Invalidated markdown context for project ${o.name} due to file change: ${e.path}`))}}catch(r){ue("Error handling file change for project context cache:",r)}};this.debouncedHandleFileChange=(0,qhr.default)(e=>{this.handleFileChange(e)},Ak.DEBOUNCE_DELAY,{leading:!0,trailing:!0});this.vault=app.vault,this.fileCache=Q8.getInstance(),this.initializeEventListeners()}static getInstance(){return Ak.instance||(Ak.instance=new Ak),Ak.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)||(J("Creating project context cache directory:",this.cacheDir),await this.vault.adapter.mkdir(this.cacheDir))}getCacheKey(e){return(0,khr.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 bH;return this.projectMutexMap.set(r,i),J(`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 J("Memory cache hit for project:",e.name),n;let o=this.getCachePath(r);if(await this.vault.adapter.exists(o)){J("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 J("Cache miss for project:",e.name),null}catch(r){return ue("Error reading from project context cache:",r),null}}async getOrInitializeCache(e){let r=await this.get(e);if(r)return J(`[getOrInitializeCache] Project ${e.name}: Existing cache found. MarkdownNeedsReload: ${r.markdownNeedsReload}`),r;J(`[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?(J("Memory cache hit for project:",e.name),n):(J("Memory cache miss for project:",e.name),null)}catch(r){return ue("Error reading from project context memory cache:",r),null}}async set(e,r){let n=await this.getOrCreateProjectMutex(e);return n.isLocked()&&J(`Waiting for project cache lock for project: ${e.name}`),await n.runExclusive(async()=>(J(`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);J("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 ue("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);J("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);J(`Cleared ${e.size} file content cache entries associated with projects`)}catch(e){ue("Error clearing project context cache:",e)}}async clearForProject(e){try{J(`[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){J(`[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++):Ot(`[clearForProject] Project ${e.name}: Skipped removing FileCache entry for file ${s} due to missing cacheKey.`)}J(`[clearForProject] Project ${e.name}: Attempted to clear ${o} entries from FileCache.`)}}else J(`[clearForProject] Project ${e.name}: No fileContexts found in existing project cache to clear from FileCache.`);this.memoryCache.delete(r),J(`[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),J(`[clearForProject] Project ${e.name}: Successfully removed main project cache file: ${i}`)):J(`[clearForProject] Project ${e.name}: Main project cache file not found (already deleted or never existed): ${i}`),this.projectMutexMap.delete(e.id),J(`[clearForProject] Cleaned up mutex for project: ${e.name}`),J(`[clearForProject] Completed for project: ${e.name}`)}catch(r){ue(`[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={},J(`Flagged Web/YouTube contexts for full reload for project ${e.name}`));let o=this.cleanupFileReferencesInCache(e,n);return J(`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,J(`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),J(`Reused cached content from other project for: ${r} in project ${e.name}`),o.content):null}catch(n){return ue(`Error in getOrReuseFileContext for ${r} in project ${e.name}:`,n),null}}async getFileContext(e,r){try{if(!r||typeof r!="string")return ue("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 Ot(`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"?(Ot(`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 ue(`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 OOe.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},J(`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),J(`Removed file context for ${r} in project ${e.name}`)}return n})}async searchOtherProjectsForFile(e){try{let n=ce().projectList||[];if(n.length===0)return null;J(`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 J(`Found content for file ${e} in project ${o.name}`),{content:s,cacheKey:a}}}return J(`No content found in any project for file: ${e}`),null}catch(r){return ue(`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},J(`Associated cache with project ${e.name} for file: ${r}`),o))}cleanupFileReferencesInCache(e,r){if(!r.fileContexts)return r;let{inclusions:n,exclusions:o}=id({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 OOe.TFile)||!ml(u,n,o,!0)?i++:a[s]=r.fileContexts[s]}return i>0&&(r.fileContexts=a,J(`Removed ${i} file references from project ${e.name} that no longer match inclusion patterns`)),r}async cleanupProjectFileReferences(e){J(`[cleanupProjectFileReferences] Starting for project: ${e.name}`);try{await this.updateCacheSafely(e,r=>this.cleanupFileReferencesInCache(e,r),!0)}catch(r){ue(`Error cleaning up project file references for ${e.name}:`,r)}}async updateProjectFilesFromPatterns(e,r){try{J(`[updateProjectFilesFromPatterns] Starting for project: ${e.name}`),r.fileContexts||(r.fileContexts={});let{inclusions:n,exclusions:o}=id({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0}),i=this.vault.getFiles(),a=0;for(let s of i)if(ml(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&&J(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${a} new file references to context (in memory).`),J(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(n){ue(`[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&&J(`[updateProjectFilesFromPatterns] Project ${e.name}: Added ${i} new file references to context (in memory).`),J(`[updateProjectFilesFromPatterns] Completed for project: ${e.name}. Total markdown fileContexts in memory: ${Object.keys(r.fileContexts).length}`)}catch(o){ue(`[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];J(`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,J(`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];J(`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,J(`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 ue(`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 ue(`Error updating cache for project ${e.name}:`,i),i}})}async setCacheSafely(e,r){return await(await this.getOrCreateProjectMutex(e)).runExclusive(async()=>(J(`External safe set for project: ${e.name}`),await this.setWithoutMutex(e,r)))}};Ak.DEBOUNCE_DELAY=5e3;UC=Ak});var _H,MA,vH,uot=v(()=>{Dt();wr();COe();_H=require("obsidian"),MA=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 ue(`Unsupported image format from URL path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;try{let c=(await Wc(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?(ue(`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 _H.TFile?i.stat.size>this.MAX_IMAGE_SIZE?(ue(`Vault file too large: ${i.stat.size} bytes for path: ${e}`),!1):!0:(ue(`File with image extension not found in vault: ${e}.`),!1)}else return n&&ue(`Unsupported image format for potential vault path: .${n}. Supported formats: ${this.IMAGE_EXTENSIONS.join(", ")}`,e),!1;return ue(`Could not determine image status for URL/path: ${e}`),!1}catch(n){return ue(`Unexpected error in isImageUrl for "${e}":`,n),!1}}static async handleVaultImage(e,r){try{if(e.stat.size>this.MAX_IMAGE_SIZE)return ue(`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 ue(`Invalid MIME type: ${o}, skipping: ${e.path}`),null;let i=Rk(n);return`data:${o};base64,${i}`}catch(n){return ue("Error processing vault image:",n),null}}static async handleWebImage(e){try{let r=await Wc(e,{method:"GET",headers:{}});if(!r.ok)return ue(`Failed to fetch image: ${r.statusText}, URL: ${e}`),null;let n=r.headers.get("content-type");if(!n?.startsWith("image/"))return ue(`Invalid content type: ${n}, URL: ${e}`),null;let o=await r.arrayBuffer();if(o.byteLength>this.MAX_IMAGE_SIZE)return ue(`Image too large: ${o.byteLength} bytes, URL: ${e}`),null;let i=Rk(o);return`data:${n};base64,${i}`}catch(r){return ue("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 _H.TFile))return ue(`Local image not found: ${n}`),null;if(o.stat.size>this.MAX_IMAGE_SIZE)return ue(`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 ue(`Invalid MIME type: ${a}, path: ${n}`),null;let s=Rk(i);return`data:${a};base64,${s}`}catch(n){return ue("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 _H.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 _H.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}}:(ue(`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 ue(i),new Error(i)}return o}};MA.IMAGE_EXTENSIONS=[".jpg",".jpeg",".png",".gif",".webp",".bmp"],MA.MAX_IMAGE_SIZE=3*1024*1024,MA.MIME_TYPES={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp"};vH=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 ue("Error processing URL batch:",o),{successfulImages:[],failureDescriptions:e.map(i=>`Image read failed for: ${i}`)}}}static async processSingleUrl(e,r,n){try{if(!await MA.isImageUrl(e,n))return null;let o=await MA.convertToBase64(e,n);return o||(r.push(e),null)}catch(o){return ue(`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){ue("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 MA.convertToBase64(e.image_url.url,n);return o||(r.push(e.image_url.url),null)}catch(o){return ue(`Failed to process chat image: ${e.image_url.url}`,o),r.push(e.image_url.url),null}}static showFailedImagesNotice(e){e.length>0&&new _H.Notice(`Failed to process images:
|
||
${e.join(`
|
||
`)}`)}}});var eG,lot=v(()=>{uot();RS();wr();Dt();eG=class t{constructor(){this.mentions=new Map,this.brevilabsClient=Ru.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=Eo(r);return ue(`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=Eo(r);return ue(`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 MA.isImageUrl(s,app.vault))return n.push(s),{type:"image",url:s};if(OAt(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 Bhr,TOe,Uhr=v(()=>{Dt();Bhr=L(V8()),TOe=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)||(J("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,Bhr.MD5)(r).toString();return J("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)){J("Cache hit for PDF:",e.path);let o=await app.vault.adapter.read(n);return JSON.parse(o)}return J("Cache miss for PDF:",e.path),null}catch(r){return ue("Error reading from PDF cache:",r),null}}async set(e,r){try{await this.ensureCacheDir();let n=this.getCacheKey(e),o=this.getCachePath(n);J("Caching PDF response for:",e.path),await app.vault.adapter.write(o,JSON.stringify(r))}catch(n){ue("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);J("Clearing PDF cache, removing files:",e.files.length);for(let r of e.files)await app.vault.adapter.remove(r)}}catch(e){ue("Error clearing PDF cache:",e)}}}});function X1(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 zhr(t){let r=(t?.message||t?.toString()||"").match(/Try again in ([\d\w\s]+)/);return r?r[1]:"some time"}var gie=v(()=>{});var Hhr,POe,Vhr,EOe,Jhr=v(()=>{Hhr=require("obsidian"),EOe=class{constructor(e){this.vault=e;dY(this,POe)}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 Hhr.TFile?await this.vault.cachedRead(l):"";return{...u,content:c}}return u.type==="text"?{...u,content:u.text??""}:{...u,content:""}})),a=[...o];Zwt(this,POe,Vhr).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}};POe=new WeakSet,Vhr=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 Khr,cot,MOe,dot,tG,yie,Ik,ROe=v(()=>{Uhr();hie();Dt();gie();Khr=require("obsidian");Jhr();cot=class{constructor(){this.supportedExtensions=["md"]}async parseFile(e,r){return await r.read(e)}},MOe=class{constructor(e){this.supportedExtensions=["pdf"];this.brevilabsClient=e,this.pdfCache=TOe.getInstance()}async parseFile(e,r){try{J("Parsing PDF file:",e.path);let n=await this.pdfCache.get(e);if(n)return J("Using cached PDF content for:",e.path),n.response;let o=await r.readBinary(e);J("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 ue(`Error extracting content from PDF ${e.path}:`,n),`[Error: Could not extract content from PDF ${e.basename}]`}}async clearCache(){J("Clearing PDF cache"),await this.pdfCache.clear()}},dot=class{constructor(){this.supportedExtensions=["canvas"]}async parseFile(e,r){try{J("Parsing Canvas file:",e.path);let n=new EOe(r),o=await n.load(e);return n.buildPrompt(o)}catch(n){return ue(`Error parsing Canvas file ${e.path}:`,n),`[Error: Could not parse Canvas file ${e.basename}]`}}},tG=class tG{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=UC.getInstance(),this.currentProject=r}static resetRateLimitNoticeTimer(){tG.lastRateLimitNoticeTime=0}async parseFile(e,r){try{if(J(`[Docs4LLMParser] Project ${this.currentProject?.name}: Parsing ${e.extension} file: ${e.path}`),!this.currentProject)throw ue("[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 J(`[Docs4LLMParser] Project ${this.currentProject.name}: Using cached content for: ${e.path}`),n;J(`[Docs4LLMParser] Project ${this.currentProject.name}: Cache miss for: ${e.path}. Proceeding to API call.`);let o=await r.readBinary(e);J(`[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),J(`[Docs4LLMParser] Project ${this.currentProject.name}: Successfully processed and cached: ${e.path}`),a}catch(n){throw ue(`[Docs4LLMParser] Project ${this.currentProject?.name}: Error processing file ${e.path}:`,n),X1(n)&&this.showRateLimitNotice(n),n}}showRateLimitNotice(e){let r=Date.now();if(r-tG.lastRateLimitNoticeTime<6e4)return;tG.lastRateLimitNoticeTime=r;let n=zhr(e);new Khr.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(){J("Cache clearing is now handled at the project level")}};tG.lastRateLimitNoticeTime=0;yie=tG,Ik=class{constructor(e,r,n=!1,o=null){this.parsers=new Map;this.isProjectMode=n,this.currentProject=o,this.registerParser(new cot),this.registerParser(new yie(e,o)),n||this.registerParser(new MOe(e)),this.registerParser(new dot)}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 MOe&&await e.clearCache()}}});var yot={};Xn(yot,{createToolCallMarker:()=>IOe,decodeResultFromMarker:()=>mot,decodeToolCallMarkerResults:()=>vao,ensureEncodedToolCallMarkerResults:()=>AOe,parseToolCallMarkers:()=>hot,updateToolCallMarker:()=>got});function pot(t){try{return`ENC:${encodeURIComponent(t)}`}catch{return t}}function mot(t){if(typeof t!="string"||!t.startsWith("ENC:"))return t;try{return decodeURIComponent(t.slice(4))}catch{return t}}function _ao(t){return`Tool '${t}' ${bao}`}function vao(t){return!t||typeof t!="string"?t:t.replace(/<!--TOOL_CALL_END:([^:]+):(ENC:[\s\S]*?)-->/g,(e,r,n)=>{let o=mot(n)||n;return`<!--TOOL_CALL_END:${r}:${o}-->`})}function AOe(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=pot(n);return`<!--TOOL_CALL_END:${r}:${o}-->`})}function fot(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);fot(_,o,e).forEach(x=>{x.type==="text"&&x.content.trim()?r.push({type:"text",content:x.content}):x.type==="error"&&x.error&&r.push({type:"error",content:x.content,error:x.error})})}let[a,s,u,l,c,d,f,p,m]=i,g=mot(typeof m=="string"?m:""),b=(typeof g=="string"?g.length:0)>5e3?_ao(u):g??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);fot(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&&fot(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 IOe(t,e,r,n,o="",i=!0,a="",s=""){let u=s&&pot(s);return`<!--TOOL_CALL_START:${t}:${e}:${r}:${n}:${o}:${i}-->${a}<!--TOOL_CALL_END:${t}:${u}-->`}function got(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=pot(r);return t.replace(o,`$1false$2${i}-->`)}var bao,bie=v(()=>{bao=`Result omitted to keep the UI responsive (payload exceeded ${5e3.toLocaleString()} characters).`});var Y1,vie=v(()=>{zr();Dt();wr();Y1=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:TO,isVisible:!0,timestamp:Zh(new Date),sources:a,responseMetadata:u};o(m),i("")}else n.signal.reason==="new-chat"&&i("");let c=this.chainManager.memoryManager.getMemory().chatHistory.messages;J(`Chat memory updated:
|
||
`,{turns:Array.isArray(c)?c.length:0});let d=2e3;try{let{parseToolCallMarkers:f}=await Promise.resolve().then(()=>(bie(),yot)),m=f(e).segments.map(g=>g.type==="text"?g.content:"").join("").trim();m||(m=e||"");let h=m.length>d?m.slice(0,d)+"... (truncated)":m;J(`Final AI response (truncated):
|
||
`,h)}catch{let f=typeof e=="string"?e:String(e??""),p=f.length>d?f.slice(0,d)+"... (truncated)":f;J(`Final AI response (truncated):
|
||
`,p)}return e}async handleError(e,r){let n=Eo(e);ue("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}`,ue(o),r(this.enhancedErrorMsg(a,n))}enhancedErrorMsg(e,r){let n=e.search("Troubleshooting URL");return e=n!==-1?e.slice(0,n):e,r.search(/401|invalid|not valid/gi)!==-1&&(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}}});function Whr(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 Ghr(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 Zhr=v(()=>{});function wao(){return 1e4}function Sao(t,e){let r=e??wao();if(!t||t.length<=r)return t;let n=t.substring(0,r),o=t.length-r;return`${n}
|
||
|
||
... (truncated ${o.toLocaleString()} characters)`}function Cao(t,e,r){let n=Sao(e,r);return`Tool '${t}' result: ${n}`}function bot(t,e=!1){return t.map(r=>e?Cao(r.toolName,r.result):`Tool '${r.toolName}' result: ${r.result}`).join(`
|
||
|
||
`)}function xao(t){return`<errorChunk>${t}</errorChunk>`}function rG(t,e){let r=xao(t);return e?`${e}
|
||
${r}`:`
|
||
${r}`}var NOe=v(()=>{});var M_,wH=v(()=>{Zhr();NOe();M_=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}handleClaude37Chunk(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){let r=!1;if(e.additional_kwargs?.delta?.reasoning){if(this.excludeThinking)return!0;this.hasOpenThinkBlock||(this.fullResponse+=`
|
||
<think>`,this.hasOpenThinkBlock=!0),this.fullResponse+=e.additional_kwargs.delta.reasoning,r=!0}if(e.additional_kwargs?.reasoning_details){let n=e.additional_kwargs.reasoning_details;if(Array.isArray(n)&&n.length>0){if(this.excludeThinking)return!0;for(let o of n)o.encrypted?(this.hasOpenThinkBlock||(this.fullResponse+=`
|
||
<think>`,this.hasOpenThinkBlock=!0),this.fullResponse+="[Encrypted reasoning]",r=!0):o.text?(this.hasOpenThinkBlock||(this.fullResponse+=`
|
||
<think>`,this.hasOpenThinkBlock=!0),this.fullResponse+=o.text,r=!0):o.summary&&(this.hasOpenThinkBlock||(this.fullResponse+=`
|
||
<think>`,this.hasOpenThinkBlock=!0),this.fullResponse+=o.summary,r=!0)}}return typeof e.content=="string"&&e.content&&this.hasOpenThinkBlock&&(this.fullResponse+="</think>",this.hasOpenThinkBlock=!1),typeof e.content=="string"&&e.content&&(this.fullResponse+=e.content),r}processChunk(e){if(this.shouldTruncate)return;Whr(e).wasTruncated&&(this.wasTruncated=!0);let n=Ghr(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.handleClaude37Chunk(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=rG(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 wie,Xhr=v(()=>{zr();Dt();Pt();wr();vie();wH();wie=class extends Y1{async run(e,r,n,o,i){let a=new M_(n);try{let c=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),d=U6(c),f=[],p=await PN(this.chainManager.userMemoryManager),m=this.chainManager.chatModelManager.getChatModel();p&&f.push({role:wL(m),content:p});for(let g of d)f.push({role:g.role,content:g.content});if(e.content&&Array.isArray(e.content)){let g=e.content.map(y=>y.type==="text"?{...y,text:e.message}:y);f.push({role:"user",content:g})}else f.push({role:"user",content:e.message});J(`Final Request to AI:
|
||
`,f);let h=await Xh(()=>this.chainManager.chatModelManager.getChatModel().stream(f,{signal:r.signal}));for await(let g of h){if(r.signal.aborted){J("Stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(g)}}catch(l){l.name==="AbortError"||r.signal.aborted?J("Stream aborted by user",{reason:r.signal.reason}):await this.handleError(l,a.processErrorChunk.bind(a))}let s=a.close(),u={wasTruncated:s.wasTruncated,tokenUsage:s.tokenUsage??void 0};return r.signal.aborted&&r.signal.reason==="new-chat"?(n(""),""):(await this.handleResponse(s.content,e,r,o,n,void 0,void 0,u),s.content)}}});var Oao,SH,jOe=v(()=>{Do();X$();uO();Gh();Oao={};Et(Oao,{BaseRetriever:()=>SH});SH=class extends Lo{constructor(e){super(e);M(this,"callbacks");M(this,"tags");M(this,"metadata");M(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=Jo(lN(r)),i=await(await Yl.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 vot,_ot,Nk,DOe=v(()=>{Dt();zr();vot=require("obsidian");Qnt();_ot={maxChars:qz,overlap:0,maxBytesTotal:10*1024*1024},Nk=class{constructor(e){this.app=e;this.cache=new Map;this.memoryUsage=0;this.splitter=pie.fromLanguage("markdown",{chunkSize:qz,chunkOverlap:0,separators:[`
|
||
|
||
`,`
|
||
`,". "," ",""],keepSeparator:!1})}async getChunks(e,r={}){try{if(!Array.isArray(e))return Ot("ChunkManager: Invalid notePaths provided"),[];if(e.length===0)return[];e.length>1e3&&(Ot("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 Ot("ChunkManager: No valid note paths provided"),[];let o={..._ot,...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):Ot(`ChunkManager: Skipping cache for ${a}, would exceed memory budget`)}i.push(...s)}return J(`ChunkManager: Retrieved ${i.length} chunks from ${n.length} notes (${this.formatMemoryUsage()})`),i}catch(n){return Ot("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||Ot(`ChunkManager: Chunk ${e} not found after regeneration`),o||null}async getValidatedChunks(e){let r=this.cache.get(e);if(!r&&(J(`ChunkManager: Cache miss for ${e}, regenerating...`),r=await this.regenerateChunks(e),!r||r.length===0))return Ot(`ChunkManager: Failed to regenerate chunks for ${e}`),[];let n=this.app.vault.getAbstractFileByPath(e);return n&&n instanceof vot.TFile&&r.length>0&&n.stat.mtime>r[0].mtime&&(J(`ChunkManager: File ${e} modified, regenerating chunks`),r=await this.regenerateChunks(e),!r||r.length===0)?(Ot(`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||"":(Ot(`ChunkManager: Chunk not in cache: ${e} (use async getChunkText for auto-regeneration)`),"")}async regenerateChunks(e){try{let r=await this.generateChunksForNote(e,_ot);if(r.length>0){let n=this.calculateChunkBytes(r);if(this.memoryUsage+n<=_ot.maxBytesTotal){let o=this.cache.get(e);o&&(this.memoryUsage-=this.calculateChunkBytes(o)),this.cache.set(e,r),this.memoryUsage+=n}else Ot(`ChunkManager: Cannot cache regenerated chunks for ${e}, would exceed memory budget`)}return r}catch(r){return Ot(`ChunkManager: Failed to regenerate chunks for ${e}`,r),[]}}clearCache(){this.cache.clear(),this.memoryUsage=0,J("ChunkManager: Cache cleared")}async generateChunksForNote(e,r){try{let n=this.app.vault.getAbstractFileByPath(e);if(!n||!(n instanceof vot.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 Ot(`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){Ot(`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 Ot(`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 wot=S(()=>{});function wg(t,e,r){let n=typeof r,o=typeof t;if(n!=="undefined"){if(o!=="undefined"){if(r){if(o==="function"&&n===o)return function(s){return t(r(s))};if(e=t.constructor,e===r.constructor){if(e===Array)return r.concat(t);if(e===Map){var i=new Map(r);for(var a of t)i.set(a[0],a[1]);return i}if(e===Set){a=new Set(r);for(i of t.values())a.add(i);return a}}}return t}return r}return o==="undefined"?e:t}function nG(t,e){return typeof t>"u"?e:t}function Nc(){return Object.create(null)}function zC(t){return typeof t=="string"}function Cie(t){return typeof t=="object"}function xie(t,e){if(zC(e))t=t[e];else for(let r=0;t&&r<e.length;r++)t=t[e[r]];return t}function sG(t={}){if(!this||this.constructor!==sG)return new sG(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}function xH(t){t.F=null,t.B.clear(),t.D.clear()}function Pot(t,e,r){r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):r=t),r&&(t=r.query||t,e=r.limit||e);let n=""+(e||0);r&&(n+=(r.offset||0)+!!r.context+!!r.suggest+(r.resolve!==!1)+(r.resolution||this.resolution)+(r.boost||0)),t=(""+t).toLowerCase(),this.cache||(this.cache=new EH);let o=this.cache.get(t+n);if(!o){let i=r&&r.cache;i&&(r.cache=!1),o=this.search(t,e,r),i&&(r.cache=i),this.cache.set(t+n,o)}return o}function EH(t){this.limit=t&&t!==!0?t:1e3,this.cache=new Map,this.h=""}function ngr(t,e,r,n){let o=[];for(let i=0,a;i<t.index.length;i++)if(a=t.index[i],e>=a.length)e-=a.length;else{e=a[n?"splice":"slice"](e,r);let s=e.length;if(s&&(o=o.length?o.concat(e):e,r-=s,n&&(t.length-=s),!r))break;e=0}return o}function uG(t){if(!this||this.constructor!==uG)return new uG(t);this.index=t?[t]:[],this.length=t?t.length:0;let e=this;return new Proxy([],{get(r,n){if(n==="length")return e.length;if(n==="push")return function(o){e.index[e.index.length-1].push(o),e.length++};if(n==="pop")return function(){if(e.length)return e.length--,e.index[e.index.length-1].pop()};if(n==="indexOf")return function(o){let i=0;for(let a=0,s,u;a<e.index.length;a++){if(s=e.index[a],u=s.indexOf(o),u>=0)return i+u;i+=s.length}return-1};if(n==="includes")return function(o){for(let i=0;i<e.index.length;i++)if(e.index[i].includes(o))return!0;return!1};if(n==="slice")return function(o,i){return ngr(e,o||0,i||e.length,!1)};if(n==="splice")return function(o,i){return ngr(e,o||0,i||e.length,!0)};if(n==="constructor")return Array;if(typeof n!="symbol")return(r=e.index[n/2**31|0])&&r[n]},set(r,n,o){return r=n/2**31|0,(e.index[r]||(e.index[r]=[]))[n]=o,e.length++,!0}})}function HC(t=8){if(!this||this.constructor!==HC)return new HC(t);this.index=Nc(),this.h=[],this.size=0,t>32?(this.B=dgr,this.A=BigInt(t)):(this.B=cgr,this.A=t)}function VC(t=8){if(!this||this.constructor!==VC)return new VC(t);this.index=Nc(),this.h=[],this.size=0,t>32?(this.B=dgr,this.A=BigInt(t)):(this.B=cgr,this.A=t)}function cgr(t){let e=2**this.A-1;if(typeof t=="number")return t&e;let r=0,n=this.A+1;for(let o=0;o<t.length;o++)r=(r*n^t.charCodeAt(o))&e;return this.A===32?r+2**31:r}function dgr(t){let e=BigInt(2)**this.A-BigInt(1);var r=typeof t;if(r==="bigint")return t&e;if(r==="number")return BigInt(t)&e;r=BigInt(0);let n=this.A+BigInt(1);for(let o=0;o<t.length;o++)r=(r*n^BigInt(t.charCodeAt(o)))&e;return r}async function Rao(t){t=t.data;var e=t.task;let r=t.id,n=t.args;switch(e){case"init":Sie=t.options||{},(e=t.factory)?(Function("return "+e)()(self),oG=new self.FlexSearch.Index(Sie),delete self.FlexSearch):oG=new JC(Sie),postMessage({id:r});break;default:let o;e==="export"&&(n[1]?(n[0]=Sie.export,n[2]=0,n[3]=1):n=null),e==="import"?n[0]&&(t=await Sie.import.call(oG,n[0]),oG.import(n[0],t)):((o=n&&oG[e].apply(oG,n))&&o.then&&(o=await o),o&&o.await&&(o=await o.await),e==="search"&&o.result&&(o=o.result)),postMessage(e==="search"?{id:r,msg:o}:{id:r})}}function Rot(t){iG.call(t,"add"),iG.call(t,"append"),iG.call(t,"search"),iG.call(t,"update"),iG.call(t,"remove"),iG.call(t,"searchCache")}function Aao(){xot=kOe=0}function iG(t){this[t+"Async"]=function(){let e=arguments;var r=e[e.length-1];let n;if(typeof r=="function"&&(n=r,delete e[e.length-1]),xot?kOe||(kOe=Date.now()-ogr>=this.priority*this.priority*3):(xot=setTimeout(Aao,0),ogr=Date.now()),kOe){let i=this;return new Promise(a=>{setTimeout(function(){a(i[t+"Async"].apply(i,e))},0)})}let o=this[t].apply(this,e);return r=o.then?o:new Promise(i=>i(o)),n&&r.then(n),r}}function OH(t={},e){function r(s){function u(l){l=l.data||l;let c=l.id,d=c&&i.h[c];d&&(d(l.msg),delete i.h[c])}if(this.worker=s,this.h=Nc(),this.worker)return o?this.worker.on("message",u):this.worker.onmessage=u,t.config?new Promise(function(l){jk>1e9&&(jk=0),i.h[++jk]=function(){l(i)},i.worker.postMessage({id:jk,task:"init",factory:n,options:t})}):(this.priority=t.priority||4,this.encoder=e||null,this.worker.postMessage({task:"init",factory:n,options:t}),this)}if(!this||this.constructor!==OH)return new OH(t);let n=typeof self<"u"?self._factory:typeof window<"u"?window._factory:null;n&&(n=n.toString());let o=typeof window>"u",i=this,a=Iao(n,o,t.worker);return a.then?a.then(function(s){return r.call(i,s)}):r.call(this,a)}function Dk(t){OH.prototype[t]=function(){let e=this,r=[].slice.call(arguments);var n=r[r.length-1];let o;return typeof n=="function"&&(o=n,r.pop()),n=new Promise(function(i){t==="export"&&typeof r[0]=="function"&&(r[0]=null),jk>1e9&&(jk=0),e.h[++jk]=i,e.worker.postMessage({task:t,id:jk,args:r})}),o?(n.then(o),this):n}}function Iao(t,e,r){return e?typeof module<"u"?new(wot()).Worker(__dirname+"/worker/node.js"):Promise.resolve().then(()=>L(wot())).then(function(n){return new n.Worker(zao.dirname+"/node/node.mjs")}):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Rao.toString()],{type:"text/javascript"}))):new window.Worker(typeof r=="string"?r:import_meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js"),{type:"module"})}function Oot(t,e,r,n,o,i){if(t=t[o],n===r.length-1)e[o]=i||t;else if(t)if(t.constructor===Array)for(e=e[o]=Array(t.length),o=0;o<t.length;o++)Oot(t,e,r,n,o);else e=e[o]||(e[o]=Nc()),o=r[++n],Oot(t,e,r,n,o)}function Tot(t,e,r,n,o,i,a,s){if(t=t[a])if(n===e.length-1){if(t.constructor===Array){if(r[n]){for(e=0;e<t.length;e++)o.add(i,t[e],!0,!0);return}t=t.join(" ")}o.add(i,t,s,!0)}else if(t.constructor===Array)for(a=0;a<t.length;a++)Tot(t,e,r,n,o,i,a,s);else a=e[++n],Tot(t,e,r,n,o,i,a,s)}function Aot(t,e,r,n){if(!t.length)return t;if(t.length===1)return t=t[0],t=r||t.length>e?t.slice(r,r+e):t,n?aG.call(this,t):t;let o=[];for(let i=0,a,s;i<t.length;i++)if((a=t[i])&&(s=a.length)){if(r){if(r>=s){r-=s;continue}a=a.slice(r,r+e),s=a.length,r=0}if(s>e&&(a=a.slice(0,e),s=e),!o.length&&s>=e)return n?aG.call(this,a):a;if(o.push(a),e-=s,!e)break}return o=o.length>1?[].concat.apply([],o):o[0],n?aG.call(this,o):o}function JOe(t,e,r,n){var o=n[0];if(o[0]&&o[0].query)return t[e].apply(t,o);if(!(e!=="and"&&e!=="not"||t.result.length||t.await||o.suggest))return n.length>1&&(o=n[n.length-1]),(n=o.resolve)?t.await||t.result:t;let i=[],a=0,s=0,u,l,c,d,f;for(e=0;e<n.length;e++)if(o=n[e]){var p=void 0;if(o.constructor===Vu)p=o.await||o.result;else if(o.then||o.constructor===Array)p=o;else{a=o.limit||0,s=o.offset||0,c=o.suggest,l=o.resolve,u=((d=o.highlight||t.highlight)||o.enrich)&&l,p=o.queue;let m=o.async||p,h=o.index,g=o.query;if(h?t.index||(t.index=h):h=t.index,g||o.tag){let y=o.field||o.pluck;if(y&&(!g||t.query&&!d||(t.query=g,t.field=y,t.highlight=d),h=h.index.get(y)),p&&(f||t.await)){f=1;let b,_=t.C.length,w=new Promise(function(x){b=x});(function(x,O){w.h=function(){O.index=null,O.resolve=!1;let E=m?x.searchAsync(O):x.search(O);return E.then?E.then(function(T){return t.C[_]=T=T.result||T,b(T),T}):(E=E.result||E,b(E),E)}})(h,Object.assign({},o)),t.C.push(w),i[e]=w;continue}else o.resolve=!1,o.index=null,p=m?h.searchAsync(o):h.search(o),o.resolve=l,o.index=h}else if(o.and)p=LOe(o,"and",h);else if(o.or)p=LOe(o,"or",h);else if(o.not)p=LOe(o,"not",h);else if(o.xor)p=LOe(o,"xor",h);else continue}p.await?(f=1,p=p.await):p.then?(f=1,p=p.then(function(m){return m.result||m})):p=p.result||p,i[e]=p}if(f&&!t.await&&(t.await=new Promise(function(m){t.return=m})),f){let m=Promise.all(i).then(function(h){for(let g=0;g<t.C.length;g++)if(t.C[g]===m){t.C[g]=function(){return r.call(t,h,a,s,u,l,c,d)};break}Iot(t)});t.C.push(m)}else if(t.await)t.C.push(function(){return r.call(t,i,a,s,u,l,c,d)});else return r.call(t,i,a,s,u,l,c,d);return l?t.await||t.result:t}function LOe(t,e,r){t=t[e];let n=t[0]||t;return n.index||(n.index=r),r=new Vu(n),t.length>1&&(r=r[e].apply(r,t.slice(1))),r}function Nao(t,e,r,n,o,i,a){return t.length&&(this.result.length&&t.push(this.result),t.length<2?this.result=t[0]:(this.result=fgr(t,e,r,!1,this.h),r=0)),o&&(this.await=null),o?this.resolve(e,r,n,a):this}function jao(t,e,r,n,o,i,a){if(!i&&!this.result.length)return o?this.result:this;let s;if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{let u=0;for(let l=0,c,d;l<t.length;l++)if((c=t[l])&&(d=c.length))u<d&&(u=d);else if(!i){u=0;break}u?(this.result=BOe(t,u,e,r,i,this.h,o),s=!0):this.result=[]}else i||(this.result=t);return o&&(this.await=null),o?this.resolve(e,r,n,a,s):this}function Dao(t,e,r,n,o,i,a){if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{e:{i=r;var s=this.h;let u=[],l=Nc(),c=0;for(let d=0,f;d<t.length;d++)if(f=t[d]){c<f.length&&(c=f.length);for(let p=0,m;p<f.length;p++)if(m=f[p])for(let h=0,g;h<m.length;h++)g=m[h],l[g]=l[g]?2:1}for(let d=0,f,p=0;d<c;d++)for(let m=0,h;m<t.length;m++)if((h=t[m])&&(f=h[d])){for(let g=0,y;g<f.length;g++)if(y=f[g],l[y]===1)if(i)i--;else if(o){if(u.push(y),u.length===e){t=u;break e}}else{let b=d+(m?s:0);if(u[b]||(u[b]=[]),u[b].push(y),++p===e){t=u;break e}}}t=u}this.result=t,s=!0}else i||(this.result=t);return o&&(this.await=null),o?this.resolve(e,r,n,a,s):this}function $ao(t,e,r,n,o,i,a){if(!i&&!this.result.length)return o?this.result:this;if(t.length&&this.result.length){e:{i=r;var s=[];t=new Set(t.flat().flat());for(let u=0,l,c=0;u<this.result.length;u++)if(l=this.result[u]){for(let d=0,f;d<l.length;d++)if(f=l[d],!t.has(f)){if(i)i--;else if(o){if(s.push(f),s.length===e){t=s;break e}}else if(s[u]||(s[u]=[]),s[u].push(f),++c===e){t=s;break e}}}t=s}this.result=t,s=!0}return o&&(this.await=null),o?this.resolve(e,r,n,a,s):this}function qOe(t,e,r,n,o){let i,a,s;typeof o=="string"?(i=o,o=""):i=o.template,a=i.indexOf("$1"),s=i.substring(a+2),a=i.substring(0,a);let u=o&&o.boundary,l=!o||o.clip!==!1,c=o&&o.merge&&s&&a&&new RegExp(s+" "+a,"g");o=o&&o.ellipsis;var d=0;if(typeof o=="object"){var f=o.template;d=f.length-2,o=o.pattern}typeof o!="string"&&(o=o===!1?"":"..."),d&&(o=f.replace("$1",o)),f=o.length-d;let p,m;typeof u=="object"&&(p=u.before,p===0&&(p=-1),m=u.after,m===0&&(m=-1),u=u.total||9e5),d=new Map;for(let ie=0,oe,z,Q;ie<e.length;ie++){let re;if(n)re=e,Q=n;else{var h=e[ie];if(Q=h.field,!Q)continue;re=h.result}z=r.get(Q),oe=z.encoder,h=d.get(oe),typeof h!="string"&&(h=oe.encode(t),d.set(oe,h));for(let Z=0;Z<re.length;Z++){var g=re[Z].doc;if(!g||(g=xie(g,Q),!g))continue;var y=g.trim().split(/\s+/);if(!y.length)continue;g="";var b=[];let $=[];for(var _=-1,w=-1,x=0,O=0;O<y.length;O++){var E=y[O],T=oe.encode(E);T=T.length>1?T.join(" "):T[0];let q;if(T&&E){for(var R=E.length,N=(oe.split?E.replace(oe.split,""):E).length-T.length,D="",F=0,B=0;B<h.length;B++){var U=h[B];if(U){var H=U.length;H+=N,F&&H<=F||(U=T.indexOf(U),U>-1&&(D=(U?E.substring(0,U):"")+a+E.substring(U,U+H)+s+(U+H<R?E.substring(U+H):""),F=H,q=!0))}}D&&(u&&(_<0&&(_=g.length+(g?1:0)),w=g.length+(g?1:0)+D.length,x+=R,$.push(b.length),b.push({match:D})),g+=(g?" ":"")+D)}if(!q)E=y[O],g+=(g?" ":"")+E,u&&b.push({text:E});else if(u&&x>=u)break}if(x=$.length*(i.length-2),p||m||u&&g.length-x>u)if(x=u+x-f*2,O=w-_,p>0&&(O+=p),m>0&&(O+=m),O<=x)y=p?_-(p>0?p:0):_-((x-O)/2|0),b=m?w+(m>0?m:0):y+x,l||(y>0&&g.charAt(y)!==" "&&g.charAt(y-1)!==" "&&(y=g.indexOf(" ",y),y<0&&(y=0)),b<g.length&&g.charAt(b-1)!==" "&&g.charAt(b)!==" "&&(b=g.lastIndexOf(" ",b),b<w?b=w:++b)),g=(y?o:"")+g.substring(y,b)+(b<g.length?o:"");else{for(w=[],_={},x={},O={},E={},T={},D=N=R=0,B=F=1;;){var G=void 0;for(let q=0,Y;q<$.length;q++){if(Y=$[q],D)if(N!==D){if(O[q+1])continue;if(Y+=D,_[Y]){R-=f,x[q+1]=1,O[q+1]=1;continue}if(Y>=b.length-1){if(Y>=b.length){O[q+1]=1,Y>=y.length&&(x[q+1]=1);continue}R-=f}if(g=b[Y].text,H=m&&T[q])if(H>0){if(g.length>H)if(O[q+1]=1,l)g=g.substring(0,H);else continue;(H-=g.length)||(H=-1),T[q]=H}else{O[q+1]=1;continue}if(R+g.length+1<=u)g=" "+g,w[q]+=g;else if(l)G=u-R-1,G>0&&(g=" "+g.substring(0,G),w[q]+=g),O[q+1]=1;else{O[q+1]=1;continue}}else{if(O[q])continue;if(Y-=N,_[Y]){R-=f,O[q]=1,x[q]=1;continue}if(Y<=0){if(Y<0){O[q]=1,x[q]=1;continue}R-=f}if(g=b[Y].text,H=p&&E[q])if(H>0){if(g.length>H)if(O[q]=1,l)g=g.substring(g.length-H);else continue;(H-=g.length)||(H=-1),E[q]=H}else{O[q]=1;continue}if(R+g.length+1<=u)g+=" ",w[q]=g+w[q];else if(l)G=g.length+1-(u-R),G>=0&&G<g.length&&(g=g.substring(G)+" ",w[q]=g+w[q]),O[q]=1;else{O[q]=1;continue}}else{g=b[Y].match,p&&(E[q]=p),m&&(T[q]=m),q&&R++;let j;if(Y?!q&&f&&(R+=f):(x[q]=1,O[q]=1),Y>=y.length-1||Y<b.length-1&&b[Y+1].match?j=1:f&&(R+=f),R-=i.length-2,!q||R+g.length<=u)w[q]=g;else{G=F=B=x[q]=0;break}j&&(x[q+1]=1,O[q+1]=1)}R+=g.length,G=_[Y]=1}if(G)N===D?D++:N++;else{if(N===D?F=0:B=0,!F&&!B)break;F?(N++,D=N):D++}}g="";for(let q=0,Y;q<w.length;q++)Y=(q&&x[q]?" ":(q&&!o?" ":"")+o)+w[q],g+=Y;o&&!x[w.length]&&(g+=o)}c&&(g=g.replace(c," ")),re[Z].highlight=g}if(n)break}return e}function Vu(t,e){if(!this||this.constructor!==Vu)return new Vu(t,e);let r=0,n,o,i,a,s,u;if(t&&t.index){let l=t;if(e=l.index,r=l.boost||0,o=l.query){i=l.field||l.pluck,a=l.highlight;let c=l.resolve;t=l.async||l.queue,l.resolve=!1,l.index=null,t=t?e.searchAsync(l):e.search(l),l.resolve=c,l.index=e,t=t.result||t}else t=[]}if(t&&t.then){let l=this;t=t.then(function(c){l.C[0]=l.result=c.result||c,Iot(l)}),n=[t],t=[],s=new Promise(function(c){u=c})}this.index=e||null,this.result=t||[],this.h=r,this.C=n||[],this.await=s||null,this.return=u||null,this.highlight=a||null,this.query=o||"",this.field=i||""}function Iot(t,e){let r=t.result;var n=t.await;t.await=null;for(let o=0,i;o<t.C.length;o++)if(i=t.C[o]){if(typeof i=="function")r=i(),t.C[o]=r=r.result||r,o--;else if(i.h)r=i.h(),t.C[o]=r=r.result||r,o--;else if(i.then)return t.await=n}return n=t.return,t.C=[],t.return=null,e||n(r),r}function BOe(t,e,r,n,o,i,a){let s=t.length,u=[],l,c;l=Nc();for(let d=0,f,p,m,h;d<e;d++)for(let g=0;g<s;g++)if(m=t[g],d<m.length&&(f=m[d]))for(let y=0;y<f.length;y++){if(p=f[y],(c=l[p])?l[p]++:(c=0,l[p]=1),h=u[c]||(u[c]=[]),!a){let b=d+(g||!o?0:i||0);h=h[b]||(h[b]=[])}if(h.push(p),a&&r&&c===s-1&&h.length-n===r)return n?h.slice(n):h}if(t=u.length)if(o)u=u.length>1?fgr(u,r,n,a,i):(u=u[0])&&r&&u.length>r||n?u.slice(n,r+n):u;else{if(t<s)return[];if(u=u[t-1],r||n)if(a)(u.length>r||n)&&(u=u.slice(n,r+n));else{o=[];for(let d=0,f;d<u.length;d++)if(f=u[d]){if(n&&f.length>n)n-=f.length;else if((r&&f.length>r||n)&&(f=f.slice(n,r+n),r-=f.length,n&&(n-=f.length)),o.push(f),!r)break}u=o}}return u}function fgr(t,e,r,n,o){let i=[],a=Nc(),s;var u=t.length;let l;if(n){for(o=u-1;o>=0;o--)if(l=(n=t[o])&&n.length){for(u=0;u<l;u++)if(s=n[u],!a[s]){if(a[s]=1,r)r--;else if(i.push(s),i.length===e)return i}}}else for(let c=u-1,d,f=0;c>=0;c--){d=t[c];for(let p=0;p<d.length;p++)if(l=(n=d[p])&&n.length){for(let m=0;m<l;m++)if(s=n[m],!a[s])if(a[s]=1,r)r--;else{let h=(p+(c<u-1&&o||0))/(c+1)|0;if((i[h]||(i[h]=[])).push(s),++f===e)return i}}}return i}function Lao(t,e,r){let n=Nc(),o=[];for(let i=0,a;i<e.length;i++){a=e[i];for(let s=0;s<a.length;s++)n[a[s]]=1}if(r)for(let i=0,a;i<t.length;i++)a=t[i],n[a]&&(o.push(a),n[a]=0);else for(let i=0,a,s;i<t.result.length;i++)for(a=t.result[i],e=0;e<a.length;e++)s=a[e],n[s]&&((o[i]||(o[i]=[])).push(s),n[s]=0);return o}function igr(t){let e=[],r=Nc(),n=Nc();for(let o=0,i,a,s,u,l,c,d;o<t.length;o++){i=t[o],a=i.field,s=i.result;for(let f=0;f<s.length;f++)l=s[f],typeof l!="object"?l={id:u=l}:u=l.id,(c=r[u])?c.push(a):(l.field=r[u]=[a],e.push(l)),(d=l.highlight)&&(c=n[u],c||(n[u]=c={},l.highlight=c),c[a]=d)}return e}function Fao(t,e,r,n,o){return t=this.tag.get(t),t?(t=t.get(e),t?(e=t.length-n,e>0&&((r&&e>r||n)&&(t=t.slice(n,n+r)),o&&(t=aG.call(this,t))),t):[]):[]}function aG(t){if(!this||!this.store)return t;if(this.db)return this.index.get(this.field[0]).db.enrich(t);let e=Array(t.length);for(let r=0,n;r<t.length;r++)n=t[r],e[r]={id:n,doc:this.store.get(n)};return e}function TH(t){if(!this||this.constructor!==TH)return new TH(t);let e=t.document||t.doc||t,r,n;if(this.B=[],this.field=[],this.D=[],this.key=(r=e.key||e.id)&&UOe(r,this.D)||"id",(n=t.keystore||0)&&(this.keystore=n),this.fastupdate=!!t.fastupdate,this.reg=!this.fastupdate||t.worker||t.db?n?new VC(n):new Set:n?new HC(n):new Map,this.h=(r=e.store||null)&&r&&r!==!0&&[],this.store=r?n?new HC(n):new Map:null,this.cache=(r=t.cache||null)&&new EH(r),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=kao.call(this,t,e),this.tag=null,(r=e.tag)&&(typeof r=="string"&&(r=[r]),r.length)){this.tag=new Map,this.A=[],this.F=[];for(let o=0,i,a;o<r.length;o++){if(i=r[o],a=i.field||i,!a)throw Error("The tag field from the document descriptor is undefined.");i.custom?this.A[o]=i.custom:(this.A[o]=UOe(a,this.D),i.filter&&(typeof this.A[o]=="string"&&(this.A[o]=new String(this.A[o])),this.A[o].G=i.filter)),this.F[o]=a,this.tag.set(a,new Map)}}if(this.worker){this.fastupdate=!1,t=[];for(let o of this.index.values())o.then&&t.push(o);if(t.length){let o=this;return Promise.all(t).then(function(i){let a=0;for(let s of o.index.entries()){let u=s[0],l=s[1];l.then&&(l=i[a],o.index.set(u,l),a++)}return o})}}else t.db&&(this.fastupdate=!1,this.mount(t.db))}function kao(t,e){let r=new Map,n=e.index||e.field||e;zC(n)&&(n=[n]);for(let i=0,a,s;i<n.length;i++){if(a=n[i],zC(a)||(s=a,a=a.field),s=Cie(s)?Object.assign({},t,s):t,this.worker){var o=void 0;o=(o=s.encoder)&&o.encode?o:new sG(typeof o=="string"?Mot[o]:o||{}),o=new OH(s,o),r.set(a,o)}this.worker||r.set(a,new JC(s,this.reg)),s.custom?this.B[i]=s.custom:(this.B[i]=UOe(a,this.D),s.filter&&(typeof this.B[i]=="string"&&(this.B[i]=new String(this.B[i])),this.B[i].G=s.filter)),this.field[i]=a}if(this.h){t=e.store,zC(t)&&(t=[t]);for(let i=0,a,s;i<t.length;i++)a=t[i],s=a.field||a,a.custom?(this.h[i]=a.custom,a.custom.O=s):(this.h[i]=UOe(s,this.D),a.filter&&(typeof this.h[i]=="string"&&(this.h[i]=new String(this.h[i])),this.h[i].G=a.filter))}return r}function UOe(t,e){let r=t.split(":"),n=0;for(let o=0;o<r.length;o++)t=r[o],t[t.length-1]==="]"&&(t=t.substring(0,t.length-2))&&(e[n]=!0),t&&(r[n++]=t);return n<r.length&&(r.length=n),n>1?r:r[0]}function Not(t,e=0){let r=[],n=[];e&&(e=25e4/e*5e3|0);for(let o of t.entries())n.push(o),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function jot(t,e){e||(e=new Map);for(let r=0,n;r<t.length;r++)n=t[r],e.set(n[0],n[1]);return e}function pgr(t,e=0){let r=[],n=[];e&&(e=25e4/e*1e3|0);for(let o of t.entries())n.push([o[0],Not(o[1])[0]]),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function mgr(t,e){e||(e=new Map);for(let r=0,n,o;r<t.length;r++)n=t[r],o=e.get(n[0]),e.set(n[0],jot(n[1],o));return e}function hgr(t){let e=[],r=[];for(let n of t.keys())r.push(n),r.length===25e4&&(e.push(r),r=[]);return r.length&&e.push(r),e}function ggr(t,e){e||(e=new Set);for(let r=0;r<t.length;r++)e.add(t[r]);return e}function zOe(t,e,r,n,o,i,a=0){let s=n&&n.constructor===Array;var u=s?n.shift():n;if(!u)return this.export(t,e,o,i+1);if((u=t((e?e+".":"")+(a+1)+"."+r,JSON.stringify(u)))&&u.then){let l=this;return u.then(function(){return zOe.call(l,t,e,r,s?n:null,o,i,a+1)})}return zOe.call(this,t,e,r,s?n:null,o,i,a+1)}function qao(t,e,r=0,n=0){if(r<this.field.length){let a=this.field[r];if((e=this.index.get(a).export(t,a,r,n=1))&&e.then){let s=this;return e.then(function(){return s.export(t,a,r+1)})}return this.export(t,a,r+1)}let o,i;switch(n){case 0:o="reg",i=hgr(this.reg),e=null;break;case 1:o="tag",i=this.tag&&pgr(this.tag,this.reg.size),e=null;break;case 2:o="doc",i=this.store&&Not(this.store),e=null;break;default:return}return zOe.call(this,t,e,o,i||null,r,n)}function Bao(t,e){var r=t.split(".");r[r.length-1]==="json"&&r.pop();let n=r.length>2?r[0]:"";if(r=r.length>2?r[2]:r[1],this.worker&&n)return this.index.get(n).import(t);if(e){if(typeof e=="string"&&(e=JSON.parse(e)),n)return this.index.get(n).import(r,e);switch(r){case"reg":this.fastupdate=!1,this.reg=ggr(e,this.reg);for(let o=0,i;o<this.field.length;o++)i=this.index.get(this.field[o]),i.fastupdate=!1,i.reg=this.reg;if(this.worker){e=[];for(let o of this.index.values())e.push(o.import(t));return Promise.all(e)}break;case"tag":this.tag=mgr(e,this.tag);break;case"doc":this.store=jot(e,this.store)}}}function agr(t,e){let r="";for(let n of t.entries()){t=n[0];let o=n[1],i="";for(let a=0,s;a<o.length;a++){s=o[a]||[""];let u="";for(let l=0;l<s.length;l++)u+=(u?",":"")+(e==="string"?'"'+s[l]+'"':s[l]);u="["+u+"]",i+=(i?",":"")+u}i='["'+t+'",['+i+"]]",r+=(r?",":"")+i}return r}function Oie(t,e){let r=0;var n=typeof e>"u";if(t.constructor===Array){for(let o=0,i,a,s;o<t.length;o++)if((i=t[o])&&i.length){if(n)return 1;if(a=i.indexOf(e),a>=0){if(i.length>1)return i.splice(a,1),1;if(delete t[o],r)return 1;s=1}else{if(s)return 1;r++}}}else for(let o of t.entries())n=o[0],Oie(o[1],e)?r++:t.delete(n);return r}function Q1(t,e,r,n,o,i,a){let s,u;if(!(s=e[r])||a&&!s[a]){if(a?(e=s||(e[r]=Nc()),e[a]=1,u=t.ctx,(s=u.get(a))?u=s:u.set(a,u=t.keystore?new HC(t.keystore):new Map)):(u=t.map,e[r]=1),(s=u.get(r))?u=s:u.set(r,u=s=[]),i){for(let l=0,c;l<s.length;l++)if((c=s[l])&&c.includes(o)){if(l<=n)return;c.splice(c.indexOf(o),1),t.fastupdate&&(e=t.reg.get(o))&&e.splice(e.indexOf(c),1);break}}if(u=u[n]||(u[n]=[]),u.push(o),u.length===2**31-1){if(e=new uG(u),t.fastupdate)for(let l of t.reg.values())l.includes(u)&&(l[l.indexOf(u)]=e);s[n]=u=e}t.fastupdate&&((n=t.reg.get(o))?n.push(u):t.reg.set(o,[u]))}}function FOe(t,e,r,n,o){return r&&t>1?e+(n||0)<=t?r+(o||0):(t-1)/(e+(n||0))*(r+(o||0))+1|0:0}function sgr(t,e,r,n,o,i,a){let s=t.length,u=t;if(s>1)u=BOe(t,e,r,n,o,i,a);else if(s===1)return a?Aot.call(null,t[0],r,n):new Vu(t[0],this);return a?u:new Vu(u,this)}function ugr(t,e,r,n,o,i,a){return t=Eot(this,t,e,r,n,o,i,a),this.db?t.then(function(s){return o?s||[]:new Vu(s,this)}):t&&t.length?o?Aot.call(this,t,r,n):new Vu(t,this):o?[]:new Vu([],this)}function lgr(t,e,r,n){let o=[];if(t&&t.length){if(t.length<=n){e.push(t);return}for(let i=0,a;i<n;i++)(a=t[i])&&(o[i]=a);if(o.length){e.push(o);return}}if(!r)return o}function Eot(t,e,r,n,o,i,a,s){let u;return r&&(u=t.bidirectional&&e>r)&&(u=r,r=e,e=u),t.db?t.db.get(e,r,n,o,i,a,s):(t=r?(t=t.ctx.get(r))&&t.get(e):t.map.get(e),t)}function JC(t,e){if(!this||this.constructor!==JC)return new JC(t);if(t){var r=zC(t)?t:t.preset;r&&(t=Object.assign({},Uao[r],t))}else t={};r=t.context;let n=r===!0?{depth:1}:r||{},o=zC(t.encoder)?Mot[t.encoder]:t.encode||t.encoder||{};this.encoder=o.encode?o:typeof o=="object"?new sG(o):{encode:o},this.resolution=t.resolution||9,this.tokenize=r=(r=t.tokenize)&&r!=="default"&&r!=="exact"&&r||"strict",this.depth=r==="strict"&&n.depth||0,this.bidirectional=n.bidirectional!==!1,this.fastupdate=!!t.fastupdate,this.score=t.score||null,(r=t.keystore||0)&&(this.keystore=r),this.map=r?new HC(r):new Map,this.ctx=r?new HC(r):new Map,this.reg=e||(this.fastupdate?r?new HC(r):new Map:r?new VC(r):new Set),this.N=n.resolution||3,this.rtl=o.rtl||t.rtl||!1,this.cache=(r=t.cache||null)&&new EH(r),this.resolve=t.resolve!==!1,(r=t.db)&&(this.db=this.mount(r)),this.M=t.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=t.priority||4}function ygr(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}function VOe(t,e={}){if(!this||this.constructor!==VOe)return new VOe(t,e);typeof t=="object"&&(e=t,t=t.name),t||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(t?":"+t.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=e.field?e.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=e.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}function Cot(t,e,r){let n=t.value,o,i=0;for(let a=0,s;a<n.length;a++){if(s=r?n:n[a]){for(let u=0,l,c;u<e.length;u++)if(c=e[u],l=s.indexOf(c),l>=0)if(o=1,s.length>1)s.splice(l,1);else{n[a]=[];break}i+=s.length}if(r)break}i?o&&t.update(n):t.delete(),t.continue()}function $k(t,e){return new Promise((r,n)=>{t.onsuccess=t.oncomplete=function(){e&&e(this.result),e=null,r(this.result)},t.onerror=t.onblocked=n,t=null})}var zao,Cr,Tao,Eao,Pao,Mao,Yhr,Qhr,$Oe,Sot,egr,tgr,rgr,Mot,oG,Sie,xot,ogr,kOe,jk,Uao,bgr,HOe,CH,_gr,vgr=v(()=>{zao={};Tao=/[^\p{L}\p{N}]+/u,Eao=/(\d{3})/g,Pao=/(\D)(\d{3})/g,Mao=/(\d{3})(\D)/g,Yhr=/[\u0300-\u036f]/g;Cr=sG.prototype;Cr.assign=function(t){this.normalize=wg(t.normalize,!0,this.normalize);let e=t.include,r=e||t.exclude||t.split,n;if(r||r===""){if(typeof r=="object"&&r.constructor!==RegExp){let o="";n=!e,e||(o+="\\p{Z}"),r.letter&&(o+="\\p{L}"),r.number&&(o+="\\p{N}",n=!!e),r.symbol&&(o+="\\p{S}"),r.punctuation&&(o+="\\p{P}"),r.control&&(o+="\\p{C}"),(r=r.char)&&(o+=typeof r=="object"?r.join(""):r);try{this.split=new RegExp("["+(e?"^":"")+o+"]+","u")}catch{this.split=/\s+/}}else this.split=r,n=r===!1||"a1a".split(r).length<2;this.numeric=wg(t.numeric,n)}else{try{this.split=wg(this.split,Tao)}catch{this.split=/\s+/}this.numeric=wg(t.numeric,wg(this.numeric,!0))}if(this.prepare=wg(t.prepare,null,this.prepare),this.finalize=wg(t.finalize,null,this.finalize),r=t.filter,this.filter=typeof r=="function"?r:wg(r&&new Set(r),null,this.filter),this.dedupe=wg(t.dedupe,!0,this.dedupe),this.matcher=wg((r=t.matcher)&&new Map(r),null,this.matcher),this.mapper=wg((r=t.mapper)&&new Map(r),null,this.mapper),this.stemmer=wg((r=t.stemmer)&&new Map(r),null,this.stemmer),this.replacer=wg(t.replacer,null,this.replacer),this.minlength=wg(t.minlength,1,this.minlength),this.maxlength=wg(t.maxlength,1024,this.maxlength),this.rtl=wg(t.rtl,!1,this.rtl),(this.cache=r=wg(t.cache,!0,this.cache))&&(this.F=null,this.L=typeof r=="number"?r:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(let o of this.matcher.keys())this.h+=(this.h?"|":"")+o;if(this.stemmer)for(let o of this.stemmer.keys())this.A+=(this.A?"|":"")+o;return this};Cr.addStemmer=function(t,e){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(t,e),this.A+=(this.A?"|":"")+t,this.K=null,this.cache&&xH(this),this};Cr.addFilter=function(t){return typeof t=="function"?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&xH(this),this};Cr.addMapper=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length>1?this.addMatcher(t,e):(this.mapper||(this.mapper=new Map),this.mapper.set(t,e),this.cache&&xH(this),this)};Cr.addMatcher=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length<2&&(this.dedupe||this.mapper)?this.addMapper(t,e):(this.matcher||(this.matcher=new Map),this.matcher.set(t,e),this.h+=(this.h?"|":"")+t,this.J=null,this.cache&&xH(this),this)};Cr.addReplacer=function(t,e){return typeof t=="string"?this.addMatcher(t,e):(this.replacer||(this.replacer=[]),this.replacer.push(t,e),this.cache&&xH(this),this)};Cr.encode=function(t,e){if(this.cache&&t.length<=this.H)if(this.F){if(this.B.has(t))return this.B.get(t)}else this.F=setTimeout(xH,50,this);this.normalize&&(typeof this.normalize=="function"?t=this.normalize(t):t=Yhr?t.normalize("NFKD").replace(Yhr,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(Pao,"$1 $2").replace(Mao,"$1 $2").replace(Eao,"$1 "));let r=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer),n=[],o=Nc(),i,a,s=this.split||this.split===""?t.split(this.split):[t];for(let l=0,c,d;l<s.length;l++)if((c=d=s[l])&&!(c.length<this.minlength||c.length>this.maxlength)){if(e){if(o[c])continue;o[c]=1}else{if(i===c)continue;i=c}if(r)n.push(c);else if(!this.filter||(typeof this.filter=="function"?this.filter(c):!this.filter.has(c))){if(this.cache&&c.length<=this.I)if(this.F){var u=this.D.get(c);if(u||u===""){u&&n.push(u);continue}}else this.F=setTimeout(xH,50,this);if(this.stemmer){this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));let f;for(;f!==c&&c.length>2;)f=c,c=c.replace(this.K,p=>this.stemmer.get(p))}if(c&&(this.mapper||this.dedupe&&c.length>1)){u="";for(let f=0,p="",m,h;f<c.length;f++)m=c.charAt(f),m===p&&this.dedupe||((h=this.mapper&&this.mapper.get(m))||h===""?h===p&&this.dedupe||!(p=h)||(u+=h):u+=p=m);c=u}if(this.matcher&&c.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),c=c.replace(this.J,f=>this.matcher.get(f))),c&&this.replacer)for(u=0;c&&u<this.replacer.length;u+=2)c=c.replace(this.replacer[u],this.replacer[u+1]);if(this.cache&&d.length<=this.I&&(this.D.set(d,c),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),c){if(c!==d)if(e){if(o[c])continue;o[c]=1}else{if(a===c)continue;a=c}n.push(c)}}}return this.finalize&&(n=this.finalize(n)||n),this.cache&&t.length<=this.H&&(this.B.set(t,n),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),n};EH.prototype.set=function(t,e){this.cache.set(this.h=t,e),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};EH.prototype.get=function(t){let e=this.cache.get(t);return e&&this.h!==t&&(this.cache.delete(t),this.cache.set(this.h=t,e)),e};EH.prototype.remove=function(t){for(let e of this.cache){let r=e[0];e[1].includes(t)&&this.cache.delete(r)}};EH.prototype.clear=function(){this.cache.clear(),this.h=""};Qhr={normalize:!1,numeric:!1,dedupe:!1},$Oe={},Sot=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),egr=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),tgr=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],rgr={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,\u00DF:2,d:3,t:3,l:4,m:5,n:5,r:6},Mot={Exact:Qhr,Default:$Oe,Normalize:$Oe,LatinBalance:{mapper:Sot},LatinAdvanced:{mapper:Sot,matcher:egr,replacer:tgr},LatinExtra:{mapper:Sot,replacer:tgr.concat([/(?!^)[aeo]/g,""]),matcher:egr},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(t){for(let r=0;r<t.length;r++){var e=t[r];let n=e.charAt(0),o=rgr[n];for(let i=1,a;i<e.length&&(a=e.charAt(i),a==="h"||a==="w"||!(a=rgr[a])||a===o||(n+=a,o=a,n.length!==4));i++);t[r]=n}}},CJK:{split:""},LatinExact:Qhr,LatinDefault:$Oe,LatinSimple:$Oe};uG.prototype.clear=function(){this.index.length=0};uG.prototype.push=function(){};HC.prototype.get=function(t){let e=this.index[this.B(t)];return e&&e.get(t)};HC.prototype.set=function(t,e){var r=this.B(t);let n=this.index[r];n?(r=n.size,n.set(t,e),(r-=n.size)&&this.size++):(this.index[r]=n=new Map([[t,e]]),this.h.push(n),this.size++)};VC.prototype.add=function(t){var e=this.B(t);let r=this.index[e];r?(e=r.size,r.add(t),(e-=r.size)&&this.size++):(this.index[e]=r=new Set([t]),this.h.push(r),this.size++)};Cr=HC.prototype;Cr.has=VC.prototype.has=function(t){let e=this.index[this.B(t)];return e&&e.has(t)};Cr.delete=VC.prototype.delete=function(t){let e=this.index[this.B(t)];e&&e.delete(t)&&this.size--};Cr.clear=VC.prototype.clear=function(){this.index=Nc(),this.h=[],this.size=0};Cr.values=VC.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e};Cr.keys=VC.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e};Cr.entries=VC.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].entries())yield e};jk=0;Dk("add");Dk("append");Dk("search");Dk("update");Dk("remove");Dk("clear");Dk("export");Dk("import");OH.prototype.searchCache=Pot;Rot(OH.prototype);TH.prototype.add=function(t,e,r){if(Cie(t)&&(e=t,t=xie(e,this.key)),e&&(t||t===0)){if(!r&&this.reg.has(t))return this.update(t,e);for(let s=0,u;s<this.field.length;s++){u=this.B[s];var n=this.index.get(this.field[s]);if(typeof u=="function"){var o=u(e);o&&n.add(t,o,r,!0)}else o=u.G,(!o||o(e))&&(u.constructor===String?u=[""+u]:zC(u)&&(u=[u]),Tot(e,u,this.D,0,n,t,u[0],r))}if(this.tag)for(n=0;n<this.A.length;n++){var i=this.A[n];o=this.tag.get(this.F[n]);let s=Nc();if(typeof i=="function"){if(i=i(e),!i)continue}else{var a=i.G;if(a&&!a(e))continue;i.constructor===String&&(i=""+i),i=xie(e,i)}if(o&&i){zC(i)&&(i=[i]);for(let u=0,l,c;u<i.length;u++)if(l=i[u],!s[l]&&(s[l]=1,(a=o.get(l))?c=a:o.set(l,c=[]),!r||!c.includes(t))){if(c.length===2**31-1){if(a=new uG(c),this.fastupdate)for(let d of this.reg.values())d.includes(c)&&(d[d.indexOf(c)]=a);o.set(l,c=a)}c.push(t),this.fastupdate&&((a=this.reg.get(t))?a.push(c):this.reg.set(t,[c]))}}}if(this.store&&(!r||!this.store.has(t))){let s;if(this.h){s=Nc();for(let u=0,l;u<this.h.length;u++){if(l=this.h[u],(r=l.G)&&!r(e))continue;let c;if(typeof l=="function"){if(c=l(e),!c)continue;l=[l.O]}else if(zC(l)||l.constructor===String){s[l]=e[l];continue}Oot(e,s,l,0,l[0],c)}}this.store.set(t,s||e)}this.worker&&(this.fastupdate||this.reg.add(t))}return this};Vu.prototype.or=function(){return JOe(this,"or",Nao,arguments)};Vu.prototype.and=function(){return JOe(this,"and",jao,arguments)};Vu.prototype.xor=function(){return JOe(this,"xor",Dao,arguments)};Vu.prototype.not=function(){return JOe(this,"not",$ao,arguments)};Cr=Vu.prototype;Cr.limit=function(t){if(this.await){let e=this;this.C.push(function(){return e.limit(t).result})}else if(this.result.length){let e=[];for(let r=0,n;r<this.result.length;r++)if(n=this.result[r])if(n.length<=t){if(e[r]=n,t-=n.length,!t)break}else{e[r]=n.slice(0,t);break}this.result=e}return this};Cr.offset=function(t){if(this.await){let e=this;this.C.push(function(){return e.offset(t).result})}else if(this.result.length){let e=[];for(let r=0,n;r<this.result.length;r++)(n=this.result[r])&&(n.length<=t?t-=n.length:(e[r]=n.slice(t),t=0));this.result=e}return this};Cr.boost=function(t){if(this.await){let e=this;this.C.push(function(){return e.boost(t).result})}else this.h+=t;return this};Cr.resolve=function(t,e,r,n,o){let i=this.await?Iot(this,!0):this.result;if(i.then){let a=this;return i.then(function(){return a.resolve(t,e,r,n,o)})}return i.length&&(typeof t=="object"?(n=t.highlight||this.highlight,r=!!n||t.enrich,e=t.offset,t=t.limit):(n=n||this.highlight,r=!!n||r),i=o?r?aG.call(this.index,i):i:Aot.call(this.index,i,t||100,e,r)),this.finalize(i,n)};Cr.finalize=function(t,e){if(t.then){let n=this;return t.then(function(o){return n.finalize(o,e)})}e&&t.length&&this.query&&(t=qOe(this.query,t,this.index.index,this.field,e));let r=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",r&&r(t),t};Nc();TH.prototype.search=function(t,e,r,n){r||(!e&&Cie(t)?(r=t,t=""):Cie(e)&&(r=e,e=0));let o=[];var i=[];let a,s,u,l,c,d,f=0,p=!0,m;if(r){r.constructor===Array&&(r={index:r}),t=r.query||t,a=r.pluck,s=r.merge,l=r.boost,d=a||r.field||(d=r.index)&&(d.index?null:d);var h=this.tag&&r.tag;u=r.suggest,p=r.resolve!==!1,c=r.cache,m=p&&this.store&&r.highlight;var g=!!m||p&&this.store&&r.enrich;e=r.limit||e;var y=r.offset||0;if(e||(e=p?100:0),h&&(!this.db||!n)){h.constructor!==Array&&(h=[h]);var b=[];for(let E=0,T;E<h.length;E++)if(T=h[E],T.field&&T.tag){var _=T.tag;if(_.constructor===Array)for(var w=0;w<_.length;w++)b.push(T.field,_[w]);else b.push(T.field,_)}else{_=Object.keys(T);for(let R=0,N,D;R<_.length;R++)if(N=_[R],D=T[N],D.constructor===Array)for(w=0;w<D.length;w++)b.push(N,D[w]);else b.push(N,D)}if(h=b,!t){if(i=[],b.length)for(h=0;h<b.length;h+=2){if(this.db){if(n=this.index.get(b[h]),!n)continue;i.push(n=n.db.tag(b[h+1],e,y,g))}else n=Fao.call(this,b[h],b[h+1],e,y,g);o.push(p?{field:b[h],tag:b[h+1],result:n}:[n])}if(i.length){let E=this;return Promise.all(i).then(function(T){for(let R=0;R<T.length;R++)p?o[R].result=T[R]:o[R]=T[R];return p?o:new Vu(o.length>1?BOe(o,1,0,0,u,l):o[0],E)})}return p?o:new Vu(o.length>1?BOe(o,1,0,0,u,l):o[0],this)}}p||a||!(d=d||this.field)||(zC(d)?a=d:(d.constructor===Array&&d.length===1&&(d=d[0]),a=d.field||d.index)),d&&d.constructor!==Array&&(d=[d])}d||(d=this.field);let x;b=(this.worker||this.db)&&!n&&[];for(let E=0,T,R,N;E<d.length;E++){if(R=d[E],this.db&&this.tag&&!this.B[E])continue;let D;if(zC(R)||(D=R,R=D.field,t=D.query||t,e=nG(D.limit,e),y=nG(D.offset,y),u=nG(D.suggest,u),m=p&&this.store&&nG(D.highlight,m),g=!!m||p&&this.store&&nG(D.enrich,g),c=nG(D.cache,c)),n)T=n[E];else{_=D||r||{},w=_.enrich;var O=this.index.get(R);if(h&&(this.db&&(_.tag=h,x=O.db.support_tag_search,_.field=d),!x&&w&&(_.enrich=!1)),T=c?O.searchCache(t,e,_):O.search(t,e,_),w&&(_.enrich=w),b){b[E]=T;continue}}if(N=(T=T.result||T)&&T.length,h&&N){if(_=[],w=0,this.db&&n){if(!x)for(O=d.length;O<n.length;O++){let F=n[O];if(F&&F.length)w++,_.push(F);else if(!u)return p?o:new Vu(o,this)}}else for(let F=0,B,U;F<h.length;F+=2){if(B=this.tag.get(h[F]),!B){if(u)continue;return p?o:new Vu(o,this)}if(U=(B=B&&B.get(h[F+1]))&&B.length)w++,_.push(B);else if(!u)return p?o:new Vu(o,this)}if(w){if(T=Lao(T,_,p),N=T.length,!N&&!u)return p?T:new Vu(T,this);w--}}if(N)i[f]=R,o.push(T),f++;else if(d.length===1)return p?o:new Vu(o,this)}if(b){if(this.db&&h&&h.length&&!x)for(g=0;g<h.length;g+=2){if(i=this.index.get(h[g]),!i){if(u)continue;return p?o:new Vu(o,this)}b.push(i.db.tag(h[g+1],e,y,!1))}let E=this;return Promise.all(b).then(function(T){return r&&(r.resolve=p),T.length&&(T=E.search(t,e,r,T)),T})}if(!f)return p?o:new Vu(o,this);if(a&&(!g||!this.store))return o=o[0],p?o:new Vu(o,this);for(b=[],y=0;y<i.length;y++){if(h=o[y],g&&h.length&&typeof h[0].doc>"u"&&(this.db?b.push(h=this.index.get(this.field[0]).db.enrich(h)):h=aG.call(this,h)),a)return p?m?qOe(t,h,this.index,a,m):h:new Vu(h,this);o[y]={field:i[y],result:h}}if(g&&this.db&&b.length){let E=this;return Promise.all(b).then(function(T){for(let R=0;R<T.length;R++)o[R].result=T[R];return m&&(o=qOe(t,o,E.index,a,m)),s?igr(o):o})}return m&&(o=qOe(t,o,this.index,a,m)),s?igr(o):o};Cr=TH.prototype;Cr.mount=function(t){let e=this.field;if(this.tag)for(let i=0,a;i<this.F.length;i++){a=this.F[i];var r=void 0;this.index.set(a,r=new JC({},this.reg)),e===this.field&&(e=e.slice(0)),e.push(a),r.tag=this.tag.get(a)}r=[];let n={db:t.db,type:t.type,fastupdate:t.fastupdate};for(let i=0,a,s;i<e.length;i++){n.field=s=e[i],a=this.index.get(s);let u=new t.constructor(t.id,n);u.id=t.id,r[i]=u.mount(a),a.document=!0,i?a.bypass=!0:a.store=this.store}let o=this;return this.db=Promise.all(r).then(function(){o.db=!0})};Cr.commit=async function(){let t=[];for(let e of this.index.values())t.push(e.commit());await Promise.all(t),this.reg.clear()};Cr.destroy=function(){let t=[];for(let e of this.index.values())t.push(e.destroy());return Promise.all(t)};Cr.append=function(t,e){return this.add(t,e,!0)};Cr.update=function(t,e){return this.remove(t).add(t,e)};Cr.remove=function(t){Cie(t)&&(t=xie(t,this.key));for(var e of this.index.values())e.remove(t,!0);if(this.reg.has(t)){if(this.tag&&!this.fastupdate)for(let r of this.tag.values())for(let n of r){e=n[0];let o=n[1],i=o.indexOf(t);i>-1&&(o.length>1?o.splice(i,1):r.delete(e))}this.store&&this.store.delete(t),this.reg.delete(t)}return this.cache&&this.cache.remove(t),this};Cr.clear=function(){let t=[];for(let e of this.index.values()){let r=e.clear();r.then&&t.push(r)}if(this.tag)for(let e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),t.length?Promise.all(t):this};Cr.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)};Cr.cleanup=function(){for(let t of this.index.values())t.cleanup();return this};Cr.get=function(t){return this.db?this.index.get(this.field[0]).db.enrich(t).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(t)||null};Cr.set=function(t,e){return typeof t=="object"&&(e=t,t=xie(e,this.key)),this.store.set(t,e),this};Cr.searchCache=Pot;Cr.export=qao;Cr.import=Bao;Rot(TH.prototype);JC.prototype.remove=function(t,e){let r=this.reg.size&&(this.fastupdate?this.reg.get(t):this.reg.has(t));if(r){if(this.fastupdate){for(let n=0,o,i;n<r.length;n++)if((o=r[n])&&(i=o.length))if(o[i-1]===t)o.pop();else{let a=o.indexOf(t);a>=0&&o.splice(a,1)}}else Oie(this.map,t),this.depth&&Oie(this.ctx,t);e||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&ygr(this)),this.cache&&this.cache.remove(t),this};Uao={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};JC.prototype.add=function(t,e,r,n){if(e&&(t||t===0)){if(!n&&!r&&this.reg.has(t))return this.update(t,e);n=this.depth,e=this.encoder.encode(e,!n);let l=e.length;if(l){let c=Nc(),d=Nc(),f=this.resolution;for(let p=0;p<l;p++){let m=e[this.rtl?l-1-p:p];var o=m.length;if(o&&(n||!d[m])){var i=this.score?this.score(e,m,p,null,0):FOe(f,l,p),a="";switch(this.tokenize){case"tolerant":if(Q1(this,d,m,i,t,r),o>2){for(let h=1,g,y,b,_;h<o-1;h++)g=m.charAt(h),y=m.charAt(h+1),b=m.substring(0,h)+y,_=m.substring(h+2),a=b+g+_,Q1(this,d,a,i,t,r),a=b+_,Q1(this,d,a,i,t,r);Q1(this,d,m.substring(0,m.length-1),i,t,r)}break;case"full":if(o>2){for(let h=0,g;h<o;h++)for(i=o;i>h;i--){a=m.substring(h,i),g=this.rtl?o-1-h:h;var s=this.score?this.score(e,m,p,a,g):FOe(f,l,p,o,g);Q1(this,d,a,s,t,r)}break}case"bidirectional":case"reverse":if(o>1){for(s=o-1;s>0;s--){a=m[this.rtl?o-1-s:s]+a;var u=this.score?this.score(e,m,p,a,s):FOe(f,l,p,o,s);Q1(this,d,a,u,t,r)}a=""}case"forward":if(o>1){for(s=0;s<o;s++)a+=m[this.rtl?o-1-s:s],Q1(this,d,a,i,t,r);break}default:if(Q1(this,d,m,i,t,r),n&&l>1&&p<l-1)for(o=this.N,a=m,i=Math.min(n+1,this.rtl?p+1:l-p),s=1;s<i;s++){m=e[this.rtl?l-1-p-s:p+s],u=this.bidirectional&&m>a;let h=this.score?this.score(e,a,p,m,s-1):FOe(o+(l/2>o?0:1),l,p,i-1,s-1);Q1(this,c,u?a:m,h,t,r,u?m:a)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(r?{ins:t}:{del:t}),this.M&&ygr(this)),this};JC.prototype.search=function(t,e,r){if(r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):(r=t,t="")),r&&r.cache)return r.cache=!1,t=this.searchCache(t,e,r),r.cache=!0,t;let n=[],o,i,a,s=0,u,l,c,d,f;r&&(t=r.query||t,e=r.limit||e,s=r.offset||0,i=r.context,a=r.suggest,f=(u=r.resolve)&&r.enrich,c=r.boost,d=r.resolution,l=this.db&&r.tag),typeof u>"u"&&(u=this.resolve),i=this.depth&&i!==!1;let p=this.encoder.encode(t,!i);if(o=p.length,e=e||(u?100:0),o===1)return ugr.call(this,p[0],"",e,s,u,f,l);if(o===2&&i&&!a)return ugr.call(this,p[1],p[0],e,s,u,f,l);let m=Nc(),h=0,g;if(i&&(g=p[0],h=1),d||d===0||(d=g?this.N:this.resolution),this.db){if(this.db.search&&(r=this.db.search(this,p,e,s,a,u,f,l),r!==!1))return r;let y=this;return async function(){for(let b,_;h<o;h++){if((_=p[h])&&!m[_]){if(m[_]=1,b=await Eot(y,_,g,0,0,!1,!1),b=lgr(b,n,a,d)){n=b;break}g&&(a&&b&&n.length||(g=_))}a&&g&&h===o-1&&!n.length&&(d=y.resolution,g="",h=-1,m=Nc())}return sgr(n,d,e,s,a,c,u)}()}for(let y,b;h<o;h++){if((b=p[h])&&!m[b]){if(m[b]=1,y=Eot(this,b,g,0,0,!1,!1),y=lgr(y,n,a,d)){n=y;break}g&&(a&&y&&n.length||(g=b))}a&&g&&h===o-1&&!n.length&&(d=this.resolution,g="",h=-1,m=Nc())}return sgr(n,d,e,s,a,c,u)};Cr=JC.prototype;Cr.mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)};Cr.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)};Cr.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};Cr.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this};Cr.append=function(t,e){return this.add(t,e,!0)};Cr.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)};Cr.update=function(t,e){let r=this,n=this.remove(t);return n&&n.then?n.then(()=>r.add(t,e)):this.add(t,e)};Cr.cleanup=function(){return this.fastupdate?(Oie(this.map),this.depth&&Oie(this.ctx),this):this};Cr.searchCache=Pot;Cr.export=function(t,e,r=0,n=0){let o,i;switch(n){case 0:o="reg",i=hgr(this.reg);break;case 1:o="cfg",i=null;break;case 2:o="map",i=Not(this.map,this.reg.size);break;case 3:o="ctx",i=pgr(this.ctx,this.reg.size);break;default:return}return zOe.call(this,t,e,o,i,r,n)};Cr.import=function(t,e){if(e)switch(typeof e=="string"&&(e=JSON.parse(e)),t=t.split("."),t[t.length-1]==="json"&&t.pop(),t.length===3&&t.shift(),t=t.length>1?t[1]:t[0],t){case"reg":this.fastupdate=!1,this.reg=ggr(e,this.reg);break;case"map":this.map=jot(e,this.map);break;case"ctx":this.ctx=mgr(e,this.ctx)}};Cr.serialize=function(t=!0){let e="",r="",n="";if(this.reg.size){let i;for(var o of this.reg.keys())i||(i=typeof o),e+=(e?",":"")+(i==="string"?'"'+o+'"':o);e="index.reg=new Set(["+e+"]);",r=agr(this.map,i),r="index.map=new Map(["+r+"]);";for(let a of this.ctx.entries()){o=a[0];let s=agr(a[1],i);s="new Map(["+s+"])",s='["'+o+'",'+s+"]",n+=(n?",":"")+s}n="index.ctx=new Map(["+n+"]);"}return t?"function inject(index){"+e+r+n+"}":e+r+n};Rot(JC.prototype);bgr=typeof window<"u"&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),HOe=["map","ctx","tag","reg","cfg"],CH=Nc();Cr=VOe.prototype;Cr.mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())};Cr.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist(),CH[t.id]||(CH[t.id]=[]),CH[t.id].push(t.field);let e=bgr.open(t.id,1);return e.onupgradeneeded=function(){let r=t.db=this.result;for(let n=0,o;n<HOe.length;n++){o=HOe[n];for(let i=0,a;i<CH[t.id].length;i++)a=CH[t.id][i],r.objectStoreNames.contains(o+(o!=="reg"&&a?":"+a:""))||r.createObjectStore(o+(o!=="reg"&&a?":"+a:""))}},t.db=$k(e,function(r){t.db=r,t.db.onversionchange=function(){t.close()}})};Cr.close=function(){this.db&&this.db.close(),this.db=null};Cr.destroy=function(){let t=bgr.deleteDatabase(this.id);return $k(t)};Cr.clear=function(){let t=[];for(let r=0,n;r<HOe.length;r++){n=HOe[r];for(let o=0,i;o<CH[this.id].length;o++)i=CH[this.id][o],t.push(n+(n!=="reg"&&i?":"+i:""))}let e=this.db.transaction(t,"readwrite");for(let r=0;r<t.length;r++)e.objectStore(t[r]).clear();return $k(e)};Cr.get=function(t,e,r=0,n=0,o=!0,i=!1){t=this.db.transaction((e?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((e?"ctx":"map")+(this.field?":"+this.field:"")).get(e?e+":"+t:t);let a=this;return $k(t).then(function(s){let u=[];if(!s||!s.length)return u;if(o){if(!r&&!n&&s.length===1)return s[0];for(let l=0,c;l<s.length;l++)if((c=s[l])&&c.length){if(n>=c.length){n-=c.length;continue}let d=r?n+Math.min(c.length-n,r):c.length;for(let f=n;f<d;f++)u.push(c[f]);if(n=0,u.length===r)break}return i?a.enrich(u):u}return s})};Cr.tag=function(t,e=0,r=0,n=!1){t=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(t);let o=this;return $k(t).then(function(i){return!i||!i.length||r>=i.length?[]:!e&&!r?i:(i=i.slice(r,r+e),n?o.enrich(i):i)})};Cr.enrich=function(t){typeof t!="object"&&(t=[t]);let e=this.db.transaction("reg","readonly").objectStore("reg"),r=[];for(let n=0;n<t.length;n++)r[n]=$k(e.get(t[n]));return Promise.all(r).then(function(n){for(let o=0;o<n.length;o++)n[o]={id:t[o],doc:n[o]?JSON.parse(n[o]):null};return n})};Cr.has=function(t){return t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t),$k(t).then(function(e){return!!e})};Cr.search=null;Cr.info=function(){};Cr.transaction=function(t,e,r){t+=t!=="reg"&&this.field?":"+this.field:"";let n=this.h[t+":"+e];if(n)return r.call(this,n);let o=this.db.transaction(t,e);this.h[t+":"+e]=n=o.objectStore(t);let i=r.call(this,n);return this.h[t+":"+e]=null,$k(o).finally(function(){return o=n=null,i})};Cr.commit=async function(t){let e=t.commit_task,r=[];t.commit_task=[];for(let n=0,o;n<e.length;n++)o=e[n],o.del&&r.push(o.del);r.length&&await this.remove(r),t.reg.size&&(await this.transaction("map","readwrite",function(n){for(let o of t.map){let i=o[0],a=o[1];a.length&&(n.get(i).onsuccess=function(){let s=this.result;var u;if(s&&s.length){let l=Math.max(s.length,a.length);for(let c=0,d,f;c<l;c++)if((f=a[c])&&f.length){if((d=s[c])&&d.length)for(u=0;u<f.length;u++)d.push(f[u]);else s[c]=f;u=1}}else s=a,u=1;u&&n.put(s,i)})}}),await this.transaction("ctx","readwrite",function(n){for(let o of t.ctx){let i=o[0],a=o[1];for(let s of a){let u=s[0],l=s[1];l.length&&(n.get(i+":"+u).onsuccess=function(){let c=this.result;var d;if(c&&c.length){let f=Math.max(c.length,l.length);for(let p=0,m,h;p<f;p++)if((h=l[p])&&h.length){if((m=c[p])&&m.length)for(d=0;d<h.length;d++)m.push(h[d]);else c[p]=h;d=1}}else c=l,d=1;d&&n.put(c,i+":"+u)})}}}),t.store?await this.transaction("reg","readwrite",function(n){for(let o of t.store){let i=o[0],a=o[1];n.put(typeof a=="object"?JSON.stringify(a):1,i)}}):t.bypass||await this.transaction("reg","readwrite",function(n){for(let o of t.reg.keys())n.put(1,o)}),t.tag&&await this.transaction("tag","readwrite",function(n){for(let o of t.tag){let i=o[0],a=o[1];a.length&&(n.get(i).onsuccess=function(){let s=this.result;s=s&&s.length?s.concat(a):a,n.put(s,i)})}}),t.map.clear(),t.ctx.clear(),t.tag&&t.tag.clear(),t.store&&t.store.clear(),t.document||t.reg.clear())};Cr.remove=function(t){return typeof t!="object"&&(t=[t]),Promise.all([this.transaction("map","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&Cot(r,t)}}),this.transaction("ctx","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&Cot(r,t)}}),this.transaction("tag","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&Cot(r,t,!0)}}),this.transaction("reg","readwrite",function(e){for(let r=0;r<t.length;r++)e.delete(t[r])})])};_gr={Index:JC,Charset:Mot,Encoder:sG,Document:TH,Worker:OH,Resolver:Vu,IndexedDB:VOe,Language:{}}});var lG,KOe,wgr=v(()=>{Dt();Pt();lG=class lG{constructor(){this.bytesUsed=0;let e=ce(),r=Math.min(1e3,Math.max(20,e.lexicalSearchRamLimit||100));this.maxBytes=r*lG.MB_TO_BYTES,this.candidateLimit=Math.min(lG.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,J(`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}};lG.DEFAULT_CANDIDATE_LIMIT=500,lG.MB_TO_BYTES=1024*1024;KOe=lG});var Tie,Iu,WOe,Sgr=v(()=>{Dt();zr();vgr();Tie=require("obsidian");DOe();wgr();Iu=class Iu{constructor(e,r){this.app=e;this.indexedChunks=new Set;this.memoryManager=new KOe,this.chunkManager=r||new Nk(e),this.index=null}createIndex(){let e=_gr.Document,r=this.tokenizeMixed.bind(this);return new e({encode:!1,tokenize:r,cache:!1,document:{id:"id",index:[{field:"title",tokenize:r,weight:3},{field:"heading",tokenize:r,weight:2.5},{field:"path",tokenize:r,weight:2},{field:"tags",tokenize:r,weight:4},{field:"body",tokenize:r,weight:1}],store:["id","notePath","title","heading","chunkIndex"]}})}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){if(J(`FullTextEngine: [CHUNKS] Starting with ${e.length} candidate notes`),this.indexedChunks.clear(),this.memoryManager.reset(),!this.index){await new Promise(l=>setTimeout(l,0));let s=Date.now();this.index=this.createIndex();let u=Date.now()-s;J(`FullTextEngine: FlexSearch index created in ${u}ms`)}let r={maxChars:qz,overlap:0,maxBytesTotal:this.memoryManager.getMaxBytes()*Iu.CHUNK_MEMORY_PERCENTAGE},n=await this.chunkManager.getChunks(e,r);if(n.length===0)return J("FullTextEngine: No chunks generated"),0;J(`FullTextEngine: Generated ${n.length} chunks from ${e.length} notes`);let o=0,i=Iu.BATCH_SIZE,a=new Map;for(let s=0;s<n.length;s++){let u=n[s],l=Buffer.byteLength(u.content,"utf8");if(!this.memoryManager.canAddContent(l)){J(`FullTextEngine: Memory limit reached at ${o} chunks`);break}let c=u.notePath.replace(/\.md$/,"").split("/").join(" "),d=a.get(u.notePath);if(!d){let p=this.app.vault.getAbstractFileByPath(u.notePath);if(p instanceof Tie.TFile){let m=this.app.metadataCache.getFileCache(p),h=m?.frontmatter??{},g=m?(0,Tie.getAllTags)(m)??[]:[],y=this.extractFrontmatterTags(h),b=this.normalizeTagList([...g,...y]),_=this.app.metadataCache.resolvedLinks[p.path]??{},w=this.app.metadataCache.getBacklinksForFile(p)?.data??{},x=Object.keys(_),O=Object.keys(w),E=[...x,...O],T=this.extractPropertyValues(h);d={tags:b,links:E,props:T},a.set(u.notePath,d)}else d={tags:[],links:[],props:[]}}let f=[u.content,...d.props].join(" ");this.index.add({id:u.id,title:u.title,heading:u.heading,path:c,body:f,tags:d.tags,links:d.links,props:d.props.join(" "),notePath:u.notePath,chunkIndex:u.chunkIndex}),this.memoryManager.addBytes(l),this.indexedChunks.add(u.id),o++,s>0&&s%i===0&&await new Promise(p=>setTimeout(p,0))}return J(`FullTextEngine: [CHUNKS] Indexed ${o}/${n.length} chunks (${this.memoryManager.getUsagePercent()}% memory)`),o}async createNoteDoc(e){try{let r=this.app.metadataCache.getFileCache(e),n=await this.app.vault.cachedRead(e);n.length>Iu.MAX_CONTENT_SIZE&&(J(`FullText: File ${e.path} exceeds size limit (${n.length} bytes), truncating`),n=n.substring(0,Iu.MAX_CONTENT_SIZE));let o=r?(0,Tie.getAllTags)(r)??[]:[],i=r?.headings?.map(p=>p.heading)??[],a=r?.frontmatter??{},s=this.app.metadataCache.resolvedLinks[e.path]??{},u=this.app.metadataCache.getBacklinksForFile(e)?.data??{},l=Object.keys(s),c=Object.keys(u),d=a,f=d?.title||d?.name||e.basename;return{id:e.path,title:f,headings:i,tags:o,props:a,linksOut:l,linksIn:c,body:n}}catch(r){return J(`FullText: Skipped ${e.path}: ${r}`),null}}extractPropertyValues(e){let r=[];if(e&&typeof e=="object")for(let n of Object.values(e))this.extractPrimitiveValues(n,r,Iu.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,Iu.MAX_ARRAY_ITEMS).forEach(o=>{if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){let i=typeof o=="string"?o.trim():String(o);i&&r.push(i)}})}search(e,r=30,n=[],o){if(!this.index)return[];let i=new Set;for(let u of e){let l=this.normalizeQueryTerm(u);if(l)try{let c=this.index.search(l,{limit:r*3,enrich:!0});if(Array.isArray(c)){for(let d of c)if(d?.result)for(let f of d.result){let p=typeof f=="string"?f:f?.id;p&&i.add(p)}}}catch(c){J(`FullText: Search failed for "${u}": ${c}`)}}J(`FullText: Found ${i.size} unique documents from all queries (recall phase)`);let a=new Map,s=n.length>0?[...n]:o?[o]:[];if(s.length>0&&i.size>0){for(let u of s)this.scoreWithQuery(u,i,a,r);J(`FullText: Scored with ${s.length} terms (${n.length>0?"salient terms":"original query fallback"})`)}return this.buildFinalResults(a,r)}scoreWithQuery(e,r,n,o){let i=this.normalizeQueryTerm(e);if(i)try{let a=this.index.search(i,{limit:o*3,enrich:!0});if(!Array.isArray(a))return;let s=i,u=s.includes(" "),l=s.startsWith("#"),c=l?s:null,d=u?1.5:1,f=new Set;for(let g of a)if(!(!g?.result||!g?.field))for(let y of g.result){let b=typeof y=="string"?y:y?.id;b&&r.has(b)&&f.add(b)}let p=f.size===0||r.size===0?0:f.size/r.size,m=l?1:1-Math.min(.6,p*.6),h=d*m;for(let g of a){if(!g?.result||!g?.field)continue;let y=g.field,b=this.getFieldWeight(y);for(let _=0;_<g.result.length;_++){let w=g.result[_],x=typeof w=="string"?w:w?.id;if(!x||!r.has(x))continue;let E=1/(_+1)*b*h,T=n.get(x)??{score:0,fieldMatches:new Set,queriesMatched:new Set,lexicalMatches:[],tagQueryMatches:new Set,tagFieldMatches:new Set},R=new Set(T.fieldMatches);R.add(y);let N=new Set(T.queriesMatched);N.add(s);let D=y==="tags"||!s.startsWith("#")?s:s.replace(/^#/,""),F=[...T.lexicalMatches,{field:y,query:D,weight:b}],B=new Set(T.tagQueryMatches),U=new Set(T.tagFieldMatches);if(l&&c){B.add(c);let G=y==="tags"?"metadata":y;U.add(G),E*=y==="tags"?Iu.TAG_PRIMARY_FIELD_BOOST:Iu.TAG_SECONDARY_FIELD_BOOST,y==="tags"&&(E+=Iu.TAG_METADATA_SCORE_BONUS)}let H={score:T.score+E,fieldMatches:R,queriesMatched:N,lexicalMatches:F,tagQueryMatches:B,tagFieldMatches:U};n.set(x,H)}}}catch(a){J(`FullText: Scoring failed for query "${e}": ${a}`)}}buildFinalResults(e,r){let n=[];for(let[o,i]of e.entries()){let a=1+(i.fieldMatches.size-1)*.2,s=1+Math.max(0,i.queriesMatched.size-1)*.1,u=this.calculateTagBonus(i.tagQueryMatches,i.tagFieldMatches),l=i.score*a*s*u;l=this.applyPhraseInPathBonus(o,i.queriesMatched,l);let c={lexicalMatches:i.lexicalMatches,baseScore:i.score,finalScore:l};n.push({id:o,score:l,engine:"fulltext",explanation:c})}return n.sort((o,i)=>i.score-o.score),n.slice(0,r)}calculateTagBonus(e,r){if(!e||e.size===0)return 1;let n=1+e.size*Iu.TAG_BASE_MATCH_BONUS,o=r?r.size:0,i=o>1?1+(o-1)*Iu.TAG_DIVERSITY_BONUS:1,a=r?.has("metadata")?Iu.TAG_METADATA_MATCH_BOOST:1;return n*i*a}normalizeQueryTerm(e){if(!e)return null;let r=e.trim();return r.length===0?null:r.toLowerCase()}applyPhraseInPathBonus(e,r,n){let o=e.replace(/\.md$/,"").split("/").join(" ").toLowerCase();for(let i of r)if(i.includes(" ")){let a=i.toLowerCase();if(o.includes(a))return n*1.5}return n}getFieldWeight(e){return Iu.FIELD_WEIGHTS[e]||1}clear(){try{if(this.index){try{let e=this.index;if(e!=null&&typeof e=="object")try{"destroy"in e&&typeof e.destroy=="function"?e.destroy():"clear"in e&&typeof e.clear=="function"&&e.clear()}catch(r){Ot(`FullTextEngine: Index method call error: ${r}`)}}catch(e){Ot(`FullTextEngine: Index cleanup error (type: ${typeof this.index}): ${e}`)}this.index=null}this.indexedChunks.clear(),this.memoryManager.reset(),J("FullTextEngine: Cleanup completed successfully")}catch(e){Ot(`FullTextEngine: Cleanup error: ${e}`)}}getStats(){return{documentsIndexed:this.indexedChunks.size,memoryUsed:this.memoryManager.getBytesUsed(),memoryPercent:this.memoryManager.getUsagePercent()}}};Iu.MAX_CONTENT_SIZE=10*1024*1024,Iu.BATCH_SIZE=10,Iu.CHUNK_MEMORY_PERCENTAGE=.35,Iu.MAX_ARRAY_ITEMS=10,Iu.MAX_EXTRACTION_DEPTH=2,Iu.FIELD_WEIGHTS={title:3,heading:2.5,headings:1.5,path:1.5,tags:4,props:1.5,links:1.5,body:1},Iu.TAG_PRIMARY_FIELD_BOOST=6,Iu.TAG_SECONDARY_FIELD_BOOST=3,Iu.TAG_BASE_MATCH_BONUS=2,Iu.TAG_METADATA_MATCH_BOOST=2.5,Iu.TAG_DIVERSITY_BONUS=.4,Iu.TAG_METADATA_SCORE_BONUS=5;WOe=Iu});function Eie(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 Dot=v(()=>{});var GOe,Cgr=v(()=>{GOe=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 XOe,ZOe,xgr=v(()=>{zr();MN();Dt();Dot();wr();Cgr();XOe=class XOe{constructor(e={}){this.options=e;this.cache=new Map;this.config={maxVariants:e.maxVariants??2,timeout:e.timeout??W6,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),J(`QueryExpander: Using cached expansion for "${e}"`),r;try{let n=await this.expandWithTimeout(e);return this.cacheResult(e,n),n}catch(n){return Ot(`QueryExpander: Failed to expand query "${e}":`,n),this.fallbackExpansion(e)}}async expandWithTimeout(e){try{return await Vhe(r=>this.expandWithLLM(e,r),this.config.timeout,"Query expansion")}catch(r){if(r instanceof QQ)return J(`QueryExpander: Timeout reached for "${e}"`),this.fallbackExpansion(e);throw r}}async expandWithLLM(e,r){try{if(!this.options.getChatModel)return J("QueryExpander: No chat model getter provided"),this.fallbackExpansion(e);let n=await this.options.getChatModel();if(!n)return J("QueryExpander: No chat model available"),this.fallbackExpansion(e);let o=XOe.PROMPT_TEMPLATE.replace("{count}",this.config.maxVariants.toString()).replace("{query}",e),i=await Xh(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 J(`QueryExpander: Expanded "${e}" to ${s.queries.length} queries and ${s.salientTerms.length} terms`),s}catch(n){return ue("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=Eie(e);return this.combineBaseAndTagTerms(r,n,e)}parseXMLResponse(e,r){let n=[r],o=new Set,i=/<query>(.*?)<\/query>/g,a;for(;(a=i.exec(e))!==null;){let d=a[1]?.trim();d&&d!==r&&n.length<=this.config.maxVariants&&n.push(d)}let s=/<term>(.*?)<\/term>/g,u;for(;(u=s.exec(e))!==null;){let d=u[1]?.trim().toLowerCase();d&&this.isValidTerm(d)&&o.add(d)}if(n.length===1&&o.size===0)return this.parseLegacyFormat(e,r);let l=this.extractSalientTermsFromOriginal(r),c=n.slice(1);return{queries:n.slice(0,this.config.maxVariants+1),salientTerms:l,originalQuery:r,expandedQueries:c.slice(0,this.config.maxVariants),expandedTerms:Array.from(o)}}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=Eie(e),o=this.combineBaseAndTagTerms(r,n,e),i=new Set([e]);for(let s of o)if(!s.startsWith("#")&&s.length>=3){let u=GOe.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(),J("QueryExpander: Cache cleared")}getCacheSize(){return this.cache.size}async expandQueries(e){return(await this.expand(e)).queries}};XOe.PROMPT_TEMPLATE=`Generate alternative search queries and semantically related terms for the following query:
|
||
"{query}"
|
||
|
||
Instructions:
|
||
1. Generate {count} alternative search queries that capture the same intent
|
||
2. Extract semantically related terms that someone might use when searching for this topic
|
||
3. Include:
|
||
- Keywords from the original query
|
||
- Synonyms and related concepts
|
||
- Domain-specific terminology
|
||
- Associated terms someone might use
|
||
4. Keep the SAME LANGUAGE as the original query
|
||
5. Focus on NOUNS and meaningful concepts
|
||
6. EXCLUDE common action verbs in ANY language (find, search, get, \u67E5\u627E, chercher, buscar, etc.)
|
||
|
||
Example: "find my piano notes"
|
||
- Queries: "piano lesson notes", "piano practice sheets"
|
||
- Terms: piano, notes, music, sheet, practice, lesson, piece, scales, exercises
|
||
|
||
Example: "typescript interfaces"
|
||
- Queries: "typescript type definitions", "typescript contracts"
|
||
- Terms: typescript, interfaces, types, definitions, contracts, typing, declarations
|
||
|
||
Example: "\u67E5\u627E\u6211\u7684\u7B14\u8BB0" (Chinese)
|
||
- Queries: "\u6211\u7684\u5B66\u4E60\u7B14\u8BB0", "\u4E2A\u4EBA\u7B14\u8BB0\u6587\u6863"
|
||
- Terms: \u7B14\u8BB0, \u6587\u6863, \u8BB0\u5F55, \u8D44\u6599, \u5B66\u4E60, \u5907\u5FD8\u5F55 (keep in Chinese)
|
||
|
||
Example: "rechercher documents projet" (French)
|
||
- Queries: "documents de projet", "fichiers projet"
|
||
- Terms: documents, projet, fichiers, dossiers, archives (keep in French)
|
||
|
||
Format your response using XML tags:
|
||
<queries>
|
||
<query>alternative query 1</query>
|
||
<query>alternative query 2</query>
|
||
</queries>
|
||
<terms>
|
||
<term>keyword1</term>
|
||
<term>keyword2</term>
|
||
<term>keyword3</term>
|
||
<term>related_term1</term>
|
||
<term>related_term2</term>
|
||
</terms>`;ZOe=XOe});var Pie,YOe,Ogr=v(()=>{Dt();vb();Pie=class Pie{constructor(e){this.app=e}async batchCachedReadGrep(e,r){let{inclusions:n,exclusions:o}=id(),a=this.app.vault.getMarkdownFiles().filter(d=>ml(d,n,o)),s=new Set,u=Pie.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 g of l)if(m.includes(g)){s.add(p.path),h=!0;break}if(!h){let y=(await this.app.vault.cachedRead(p)).toLowerCase();for(let b of l)if(y.includes(b)){s.add(p.path);break}}}catch(m){J(`GrepScanner: Skipping file ${p.path}: ${m}`)}})),d%Pie.CONFIG.YIELD_INTERVAL===0&&await new Promise(p=>setTimeout(p,0))}let c=Array.from(s).slice(0,r);return c.length>0&&J(` 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}}};Pie.CONFIG={BATCH_SIZE:30,YIELD_INTERVAL:100};YOe=Pie});var Hao,QOe,Tgr=v(()=>{Dt();Hao={enabled:!0,minDocsForBoost:2,maxBoostFactor:1.15,minRelevanceRatio:.4},QOe=class{constructor(e){this.config=Hao;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&&(J(`Folder boost: Boosting ${r.length} folders with significant relevance`),r.slice(0,5).forEach(n=>{let o=(n.relevanceRatio*100).toFixed(1);J(` ${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 Vao,eTe,Egr=v(()=>{Dt();Vao={enabled:!0,maxCandidates:10,backlinkWeight:1,coCitationWeight:.5,sharedTagWeight:.3,boostStrength:.1,maxBoostMultiplier:1.2},eTe=class{constructor(e,r={}){this.metadataCache=e.metadataCache,this.config={...Vao,...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&&J(`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&&J(`GraphBoost: Limited to top ${this.config.maxCandidates} candidates (from ${n})`),r}setConfig(e){this.config={...this.config,...e}}}});var tTe,Pgr=v(()=>{tTe=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 $ot,$m,rTe,nTe=v(()=>{zr();Dt();DOe();Sgr();xgr();Ogr();Tgr();Egr();Pgr();$ot=2,$m=100,rTe=class{constructor(e,r){this.app=e;this.getChatModel=r;this.grepScanner=new YOe(e),this.chunkManager=new Nk(e),this.fullTextEngine=new WOe(e,this.chunkManager),this.queryExpander=new ZOe({getChatModel:this.getChatModel,maxVariants:3,timeout:W6}),this.folderBoostCalculator=new QOe(e),this.graphBoostCalculator=new eTe(e,{enabled:!0,maxCandidates:10,boostStrength:.1,maxBoostMultiplier:1.15}),this.scoreNormalizer=new tTe({method:"minmax",clipMin:.02,clipMax:.98})}async retrieve(e,r={}){if(!e||typeof e!="string")return Ot("SearchCore: Invalid query provided"),[];let n=e.trim();if(n.length===0)return Ot("SearchCore: Empty query provided"),[];n.length>1e3?(Ot("SearchCore: Query too long, truncating"),e=n.substring(0,1e3)):e=n;let o=!!r.returnAll,i=o?$m:Math.min(Math.max(1,r.maxResults||30),100),a=o?$m:Math.min(Math.max(10,r.candidateLimit||500),1e3),s=!!(r.enableLexicalBoosts??!0);try{J(`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 x=w.toLowerCase();x.length===0||p.has(x)||(p.add(x),f.push(x))};l.forEach(m),u.expandedTerms.forEach(m),c.forEach(m),d.forEach(m),(l.length>1||c.length>0||u.expandedTerms.length>0)&&J(`Query expansion: variants=${JSON.stringify(l)}, salient=${JSON.stringify(c)}, recall=${JSON.stringify(u.expandedTerms)}`);let h=o?$m:200,g=await this.grepScanner.batchCachedReadGrep(f,h),y=g.slice(0,a);J(`SearchCore: ${y.length} candidates (from ${g.length} grep hits)`);let _=await this.executeLexicalSearch(y,f,c,i,u.originalQuery,o);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);J(`SearchCore: ${_.length} results found (top: ${w?.name||_[0].id})`)}else J("SearchCore: No results found");return _}catch(u){ue("SearchCore: Retrieval failed",u);try{return await this.fallbackSearch(e,i)}catch(l){return ue("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 ue("SearchCore: Fallback search failed",n),[]}}getStats(){return{fullTextStats:this.fullTextEngine.getStats()}}getChunkManager(){return this.chunkManager}clear(){this.fullTextEngine.clear(),this.queryExpander.clearCache(),J("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){try{let s=Date.now(),u=await this.fullTextEngine.buildFromCandidates(e),l=Date.now()-s,c=Date.now(),d=a?$m:Number.isFinite(o)?Math.min(o,1e3):e.length||30,f=a?$m*$ot:Math.max(d*$ot,$ot),p=this.fullTextEngine.search(r,f,n,i),m=Date.now()-c;return J(`Full-text: ${u} docs indexed (${l}ms), ${p.length} results (${m}ms)`),p}catch(s){return ue("Full-text search failed",s),[]}}}});var Mgr,Rgr,Agr,PH,MH,Igr,Ngr,Mie,jgr,Dgr,$gr,Lgr,vBa,Fgr=v(()=>{(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(Mgr||(Mgr={}));(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(Rgr||(Rgr={}));(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(Agr||(Agr={}));(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"})(PH||(PH={}));(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"})(MH||(MH={}));(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(Igr||(Igr={}));(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(Ngr||(Ngr={}));(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"})(Mie||(Mie={}));(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"})(jgr||(jgr={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(Dgr||(Dgr={}));(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})($gr||($gr={}));(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(Lgr||(Lgr={}));vBa=[Mie.RECITATION,Mie.SAFETY,Mie.LANGUAGE];});function Fot(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 Lot,kot=v(()=>{Gv();_O();Lot=class extends Az{constructor(e){super(e);M(this,"lc_namespace",["langchain","anthropic","output_parsers"]);M(this,"returnId",!1);M(this,"keyName");M(this,"returnSingle",!1);M(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 eh(`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 sL(this.zodSchema,r);if(n.success)return n.data;throw new eh(`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)?Fot(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 kgr(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 qgr=v(()=>{});function Bgr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="thinking"}function Ugr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="redacted_thinking"}function zgr(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="search_result"}function Hgr(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 Vgr,Jgr=v(()=>{$s();Vgr={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=Hg({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 Kgr,Wgr=v(()=>{Kgr=t=>t()});function Jao(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="citation"}function Kao(t){function*e(){for(let r of t)Jao(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 Rie(t){return typeof t=="string"?t:Wao(t)}function Wao(t){let e=[];for(let r=0,{length:n}=t;r<n;r++)e.push(String.fromCharCode(t[r]));return btoa(e.join(""))}function qot(t){return(t??"").split(";")[0].toLowerCase()}function Aie(t,e){if(t!=null&&typeof t=="object"&&e in t)return t[e]}function cG(t,e){let r=Aie(e,"cache_control");r!==void 0&&(t.cache_control=r);let n=Aie(e,"citations");n!==void 0&&(t.citations=n);let o=Aie(e,"context");o!==void 0&&(t.context=o);let i=Aie(e,"title");return i!==void 0&&(t.title=i),t}function Bot(t,e){let r=Aie(e,"cache_control");return r!==void 0&&(t.cache_control=r),t}function Ggr(t){return new Set(["image/jpeg","image/png","image/gif","image/webp"]).has(t)}function Zgr(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:Kao(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=Kgr(()=>{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(cG({type:"document",source:{type:"file",file_id:o.fileId}},i));continue}if(o.url){let a=qot(o.mimeType);if(a==="application/pdf"||a===""){e.push(cG({type:"document",source:{type:"url",url:o.url}},i));continue}}if(o.data){let a=qot(o.mimeType);if(a===""||a==="application/pdf")e.push(cG({type:"document",source:{type:"base64",data:Rie(o.data),media_type:"application/pdf"}},i));else if(a==="text/plain")e.push(cG({type:"document",source:{type:"text",data:Rie(o.data),media_type:"text/plain"}},i));else if(Ggr(a))e.push(cG({type:"document",source:{type:"content",content:[{type:"image",source:{type:"base64",data:Rie(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(Bot({type:"image",source:{type:"file",file_id:o.fileId}},i));continue}if(o.url){e.push(Bot({type:"image",source:{type:"url",url:o.url}},i));continue}if(o.data){let a=qot(o.mimeType)||"image/png";Ggr(a)&&e.push(Bot({type:"image",source:{type:"base64",data:Rie(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(cG({type:"document",source:{type:"text",data:Rie(o.data),media_type:"text/plain"}},o.metadata)):o.type==="non_standard"&&n&&e.push(o.value))}return e}var Xgr=v(()=>{Wgr()});function Ygr(t){let e=Hg({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 Gao(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 su({content:[{type:"tool_result",content:r.content,tool_use_id:r.tool_call_id}]}))}else e.push(new su({content:[{type:"tool_result",...r.content!=null?{content:Uot(r)}:{},tool_use_id:r.tool_call_id}]}));else e.push(r);return e}function Qgr(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*Zao(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){Zm(n)&&(yield oO(n,Vgr));let o="cache_control"in n?n.cache_control:void 0;if(n.type==="image_url"){let i;typeof n.image_url=="string"?i=Ygr(n.image_url):typeof n.image_url=="object"&&n.image_url!==null&&"url"in n.image_url&&typeof n.image_url.url=="string"&&(i=Ygr(n.image_url.url)),i&&(yield{type:"image",source:i,...o?{cache_control:o}:{}})}else{if(Hgr(n))return n;if(n.type==="document")yield{...n,...o?{cache_control:o}:{}};else if(Bgr(n))yield{type:"thinking",thinking:n.thinking,signature:n.signature,...o?{cache_control:o}:{}};else if(Ugr(n))yield{type:"redacted_thinking",data:n.data,...o?{cache_control:o}:{}};else if(zgr(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 Uot(t){let{content:e}=t;return typeof e=="string"?e:Array.from(Zao(e))}function oTe(t){let e=Gao(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(Us(i)&&i.response_metadata?.output_version==="v1")return{role:a,content:Zgr(i)};if(Us(i)&&i.tool_calls?.length){if(typeof i.content=="string")return i.content===""?{role:a,content:i.tool_calls.map(Qgr)}:{role:a,content:[{type:"text",text:i.content},...i.tool_calls.map(Qgr)]};{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:Uot(i)}}}else return{role:a,content:Uot(i)}});return{messages:Xao(o),system:r}}function Xao(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 zot=v(()=>{Jgr();Xgr();$s()});function eyr(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 Ur({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 Ur({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 Ur({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 Ur({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 Ur({content:[{index:t.index,...n,type:"thinking"}],response_metadata:r})}:{chunk:new Ur({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 Ur({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 Ur({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 Ur({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 Ur({content:e.coerceContentToString?n:[{index:t.index,...t.content_block}],response_metadata:r})}}}}return null}function tyr(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 li({content:t[0].text,additional_kwargs:e,usage_metadata:o,response_metadata:r,id:e.id})}];{let i=Fot(t);return[{text:"",message:new li({content:t,additional_kwargs:e,tool_calls:i,usage_metadata:o,response_metadata:r,id:e.id})}]}}var ryr=v(()=>{kot();$s()});function iTe(t,e){return t.lc_error_code=e,t.message=`${t.message}
|
||
|
||
Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/${e}/
|
||
`,t}function Hot(t){let e;return t.status===400&&t.message.includes("tool")?e=iTe(t,"INVALID_TOOL_RESULTS"):t.status===401?e=iTe(t,"MODEL_AUTHENTICATION"):t.status===404?e=iTe(t,"MODEL_NOT_FOUND"):t.status===429?e=iTe(t,"MODEL_RATE_LIMIT"):e=t,e}var nyr=v(()=>{});function ir(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 ej=v(()=>{});var Vot,oyr=v(()=>{Vot=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return Vot=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 tj(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var Iie,dG=v(()=>{Iie=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 tn,_h,Sg,Lk,fG,pG,mG,hG,gG,yG,bG,_G,vG,KC=v(()=>{dG();tn=class extends Error{},_h=class t extends tn{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 Lk({message:n,cause:Iie(r)});let i=r;return e===400?new pG(e,i,n,o):e===401?new mG(e,i,n,o):e===403?new hG(e,i,n,o):e===404?new gG(e,i,n,o):e===409?new yG(e,i,n,o):e===422?new bG(e,i,n,o):e===429?new _G(e,i,n,o):e>=500?new vG(e,i,n,o):new t(e,i,n,o)}},Sg=class extends _h{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Lk=class extends _h{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},fG=class extends Lk{constructor({message:e}={}){super({message:e??"Request timed out."})}},pG=class extends _h{},mG=class extends _h{},hG=class extends _h{},gG=class extends _h{},yG=class extends _h{},bG=class extends _h{},_G=class extends _h{},vG=class extends _h{}});function Wot(t){return typeof t!="object"?{}:t??{}}function ayr(t){if(!t)return!0;for(let e in t)return!1;return!0}function syr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Qao,iyr,Jot,Kot,uyr,aTe,RH=v(()=>{KC();Qao=/^[a-z][a-z0-9+.-]*:/i,iyr=t=>Qao.test(t),Jot=t=>(Jot=Array.isArray,Jot(t)),Kot=Jot;uyr=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new tn(`${t} must be an integer`);if(e<0)throw new tn(`${t} must be a positive integer`);return e},aTe=t=>{try{return JSON.parse(t)}catch{return}}});var lyr,cyr=v(()=>{lyr=t=>new Promise(e=>setTimeout(e,t))});var Fk,Got=v(()=>{Fk="0.65.0"});function eso(){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 rso(){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 myr,tso,dyr,fyr,pyr,hyr,Zot=v(()=>{Got();myr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";tso=()=>{let t=eso();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Fk,"X-Stainless-OS":fyr(Deno.build.os),"X-Stainless-Arch":dyr(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":Fk,"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":Fk,"X-Stainless-OS":fyr(globalThis.process.platform??"unknown"),"X-Stainless-Arch":dyr(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=rso();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Fk,"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":Fk,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};dyr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",fyr=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"),hyr=()=>pyr??(pyr=tso())});function gyr(){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 Xot(...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 sTe(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return Xot({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function Nie(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 yyr(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 wG=v(()=>{});var byr,_yr=v(()=>{byr=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)})});function Syr(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 jie(t){let e;return(vyr??(e=new globalThis.TextEncoder,vyr=e.encode.bind(e)))(t)}function Yot(t){let e;return(wyr??(e=new globalThis.TextDecoder,wyr=e.decode.bind(e)))(t)}var vyr,wyr,Qot=v(()=>{});function iso(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 Cyr(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var ew,tw,rj,eit=v(()=>{ej();Qot();rj=class{constructor(){ew.set(this,void 0),tw.set(this,void 0),ir(this,ew,new Uint8Array,"f"),ir(this,tw,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?jie(e):e;ir(this,ew,Syr([Me(this,ew,"f"),r]),"f");let n=[],o;for(;(o=iso(Me(this,ew,"f"),Me(this,tw,"f")))!=null;){if(o.carriage&&Me(this,tw,"f")==null){ir(this,tw,o.index,"f");continue}if(Me(this,tw,"f")!=null&&(o.index!==Me(this,tw,"f")+1||o.carriage)){n.push(Yot(Me(this,ew,"f").subarray(0,Me(this,tw,"f")-1))),ir(this,ew,Me(this,ew,"f").subarray(Me(this,tw,"f")),"f"),ir(this,tw,null,"f");continue}let i=Me(this,tw,"f")!==null?o.preceding-1:o.preceding,a=Yot(Me(this,ew,"f").subarray(0,i));n.push(a),ir(this,ew,Me(this,ew,"f").subarray(o.index),"f"),ir(this,tw,null,"f")}return n}flush(){return Me(this,ew,"f").length?this.decode(`
|
||
`):[]}};ew=new WeakMap,tw=new WeakMap;rj.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);rj.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function Die(){}function uTe(t,e,r){return!e||lTe[t]>lTe[r]?Die:e[t].bind(e)}function vh(t){let e=t.logger,r=t.logLevel??"off";if(!e)return aso;let n=xyr.get(e);if(n&&n[0]===r)return n[1];let o={error:uTe("error",e,r),warn:uTe("warn",e,r),info:uTe("info",e,r),debug:uTe("debug",e,r)};return xyr.set(e,[r,o]),o}var lTe,tit,aso,xyr,nj,cTe=v(()=>{RH();lTe={off:0,error:200,warn:300,info:400,debug:500},tit=(t,e,r)=>{if(t){if(syr(lTe,t))return t;vh(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(lTe))}`)}};aso={error:Die,warn:Die,info:Die,debug:Die},xyr=new WeakMap;nj=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*sso(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new tn("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 tn("Attempted to iterate over a response with no body");let r=new rit,n=new rj,o=Nie(t.body);for await(let i of uso(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*uso(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"?jie(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=Cyr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function lso(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var $ie,RA,rit,nit=v(()=>{ej();KC();wG();eit();wG();dG();RH();Qot();cTe();KC();RA=class t{constructor(e,r,n){this.iterator=e,$ie.set(this,void 0),this.controller=r,ir(this,$ie,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?vh(n):console;async function*a(){if(o)throw new tn("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of sso(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,aTe(u.data)??u.data,void 0,e.headers)}s=!0}catch(u){if(tj(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 rj,u=Nie(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 tn("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(tj(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[($ie=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,$ie,"f")),new t(()=>o(r),this.controller,Me(this,$ie,"f"))]}toReadableStream(){let e=this,r;return Xot({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=jie(JSON.stringify(o)+`
|
||
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};rit=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]=lso(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function dTe(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):RA.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 oit(d,r)}return await r.text()})();return vh(t).debug(`[${n}] response parsed`,nj({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}function oit(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 iit=v(()=>{nit();cTe()});var Lie,AH,fTe=v(()=>{ej();iit();AH=class t extends Promise{constructor(e,r,n=dTe){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,Lie.set(this,void 0),ir(this,Lie,e,"f")}_thenUnwrap(e){return new t(Me(this,Lie,"f"),this.responsePromise,async(r,n)=>oit(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,Lie,"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)}};Lie=new WeakMap});var pTe,ait,Fie,DS,kk=v(()=>{ej();KC();iit();fTe();RH();ait=class{constructor(e,r,n,o){pTe.set(this,void 0),ir(this,pTe,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 tn("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await Me(this,pTe,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(pTe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Fie=class extends AH{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await dTe(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},DS=class extends ait{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:{...Wot(this.options.query),before_id:r}}:null}let e=this.last_id;return e?{...this.options,query:{...Wot(this.options.query),after_id:e}}:null}}});function IH(t,e,r){return uit(),new File(t,e??"unknown_file",r)}function kie(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 dso(t){let e=typeof t=="function"?t:t.fetch,r=Oyr.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 Oyr.set(e,n),n}var uit,lit,Tyr,Oyr,fso,pso,sit,mTe=v(()=>{wG();uit=()=>{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`.":""))}};lit=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Tyr=async(t,e)=>({...t,body:await fso(t.body,e)}),Oyr=new WeakMap;fso=async(t,e)=>{if(!await dso(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])=>sit(r,n,o))),r},pso=t=>t instanceof Blob&&"name"in t,sit=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,IH([await r.blob()],kie(r),n))}else if(lit(r))t.append(e,IH([await new Response(sTe(r)).blob()],kie(r)));else if(pso(r))t.append(e,IH([r],kie(r),{type:r.type}));else if(Array.isArray(r))await Promise.all(r.map(n=>sit(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>sit(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 hTe(t,e,r){if(uit(),t=await t,e||(e=kie(t)),mso(t))return t instanceof File&&e==null&&r==null?t:IH([await t.arrayBuffer()],e??t.name,{type:t.type,lastModified:t.lastModified,...r});if(hso(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),IH(await cit(o),e,r)}let n=await cit(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 IH(n,e,r)}async function cit(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Eyr(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(lit(t))for await(let r of t)e.push(...await cit(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${gso(t)}`)}return e}function gso(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var Eyr,mso,hso,Pyr=v(()=>{mTe();mTe();Eyr=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",mso=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Eyr(t),hso=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function"});var dit=v(()=>{Pyr()});var Myr=v(()=>{});var Cd,AA=v(()=>{Cd=class{constructor(e){this._client=e}}});function*bso(t){if(!t)return;if(Ryr 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():Kot(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=Kot(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 Ryr,Zi,IA=v(()=>{RH();Ryr=Symbol.for("brand.privateNullableHeaders");Zi=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,a]of bso(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{[Ryr]:!0,values:e,nulls:r}}});function Iyr(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Ayr,_so,xy,SG=v(()=>{KC();Ayr=Object.freeze(Object.create(null)),_so=(t=Iyr)=>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??Ayr)??Ayr)?.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 tn(`Path parameters result in path with invalid segments:
|
||
${i.map(f=>f.error).join(`
|
||
`)}
|
||
${a}
|
||
${d}`)}return a},xy=_so(Iyr)});var CG,fit=v(()=>{AA();kk();IA();mTe();SG();CG=class extends Cd{list(e={},r){let{betas:n,...o}=e??{};return this._client.getAPIList("/v1/files",DS,{query:o,...r,headers:Zi([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])})}delete(e,r={},n){let{betas:o}=r??{};return this._client.delete(xy`/v1/files/${e}`,{...n,headers:Zi([{"anthropic-beta":[...o??[],"files-api-2025-04-14"].toString()},n?.headers])})}download(e,r={},n){let{betas:o}=r??{};return this._client.get(xy`/v1/files/${e}/content`,{...n,headers:Zi([{"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(xy`/v1/files/${e}`,{...n,headers:Zi([{"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",Tyr({body:o,...r,headers:Zi([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},r?.headers])},this._client))}}});var xG,pit=v(()=>{AA();kk();IA();SG();xG=class extends Cd{retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(xy`/v1/models/${e}?beta=true`,{...n,headers:Zi([{...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",DS,{query:o,...r,headers:Zi([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}}});var OG,mit=v(()=>{KC();wG();eit();OG=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new rj;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 tn("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 tn("Attempted to iterate over a response with no body");return new t(Nie(e.body),r)}}});var qie=v(()=>{KC()});var TG,hit=v(()=>{AA();kk();IA();mit();qie();SG();TG=class extends Cd{create(e,r){let{betas:n,...o}=e;return this._client.post("/v1/messages/batches?beta=true",{body:o,...r,headers:Zi([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(xy`/v1/messages/batches/${e}?beta=true`,{...n,headers:Zi([{"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",DS,{query:o,...r,headers:Zi([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},r?.headers])})}delete(e,r={},n){let{betas:o}=r??{};return this._client.delete(xy`/v1/messages/batches/${e}?beta=true`,{...n,headers:Zi([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString()},n?.headers])})}cancel(e,r={},n){let{betas:o}=r??{};return this._client.post(xy`/v1/messages/batches/${e}/cancel?beta=true`,{...n,headers:Zi([{"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 tn(`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:Zi([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},n?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((a,s)=>OG.fromResponse(s.response,s.controller))}}});var git=v(()=>{nit()});var Cso,EG,xso,Oso,gTe,yit=v(()=>{Cso=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},EG=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),EG(t);break;case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),EG(t);case"string":let n=t[t.length-2];if(n?.type==="delimiter")return t=t.slice(0,t.length-1),EG(t);if(n?.type==="brace"&&n.value==="{")return t=t.slice(0,t.length-1),EG(t);break;case"delimiter":return t=t.slice(0,t.length-1),EG(t);break}return t},xso=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},Oso=t=>{let e="";return t.map(r=>{switch(r.type){case"string":e+='"'+r.value+'"';break;default:e+=r.value;break}}),e},gTe=t=>JSON.parse(Oso(xso(EG(Cso(t)))))});function $yr(t){return t.type==="tool_use"||t.type==="server_tool_use"||t.type==="mcp_tool_use"}var $S,qk,Bie,yTe,Uie,zie,bTe,Hie,oj,Vie,_Te,vTe,PG,wTe,STe,bit,Nyr,CTe,_it,vit,wit,jyr,Dyr,xTe,Lyr=v(()=>{ej();dG();qie();git();yit();Dyr="__json_buf";xTe=class t{constructor(){$S.add(this),this.messages=[],this.receivedMessages=[],qk.set(this,void 0),this.controller=new AbortController,Bie.set(this,void 0),yTe.set(this,()=>{}),Uie.set(this,()=>{}),zie.set(this,void 0),bTe.set(this,()=>{}),Hie.set(this,()=>{}),oj.set(this,{}),Vie.set(this,!1),_Te.set(this,!1),vTe.set(this,!1),PG.set(this,!1),wTe.set(this,void 0),STe.set(this,void 0),CTe.set(this,e=>{if(ir(this,_Te,!0,"f"),tj(e)&&(e=new Sg),e instanceof Sg)return ir(this,vTe,!0,"f"),this._emit("abort",e);if(e instanceof tn)return this._emit("error",e);if(e instanceof Error){let r=new tn(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new tn(String(e)))}),ir(this,Bie,new Promise((e,r)=>{ir(this,yTe,e,"f"),ir(this,Uie,r,"f")}),"f"),ir(this,zie,new Promise((e,r)=>{ir(this,bTe,e,"f"),ir(this,Hie,r,"f")}),"f"),Me(this,Bie,"f").catch(()=>{}),Me(this,zie,"f").catch(()=>{})}get response(){return Me(this,wTe,"f")}get request_id(){return Me(this,STe,"f")}async withResponse(){let e=await Me(this,Bie,"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,CTe,"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,$S,"m",_it).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,$S,"m",vit).call(this,u);if(s.controller.signal?.aborted)throw new Sg;Me(this,$S,"m",wit).call(this)}finally{o&&i&&o.removeEventListener("abort",i)}}_connected(e){this.ended||(ir(this,wTe,e,"f"),ir(this,STe,e?.headers.get("request-id"),"f"),Me(this,yTe,"f").call(this,e),this._emit("connect"))}get ended(){return Me(this,Vie,"f")}get errored(){return Me(this,_Te,"f")}get aborted(){return Me(this,vTe,"f")}abort(){this.controller.abort()}on(e,r){return(Me(this,oj,"f")[e]||(Me(this,oj,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Me(this,oj,"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,oj,"f")[e]||(Me(this,oj,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ir(this,PG,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ir(this,PG,!0,"f"),await Me(this,zie,"f")}get currentMessage(){return Me(this,qk,"f")}async finalMessage(){return await this.done(),Me(this,$S,"m",bit).call(this)}async finalText(){return await this.done(),Me(this,$S,"m",Nyr).call(this)}_emit(e,...r){if(Me(this,Vie,"f"))return;e==="end"&&(ir(this,Vie,!0,"f"),Me(this,bTe,"f").call(this));let n=Me(this,oj,"f")[e];if(n&&(Me(this,oj,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Me(this,PG,"f")&&!n?.length&&Promise.reject(o),Me(this,Uie,"f").call(this,o),Me(this,Hie,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Me(this,PG,"f")&&!n?.length&&Promise.reject(o),Me(this,Uie,"f").call(this,o),Me(this,Hie,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",Me(this,$S,"m",bit).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,$S,"m",_it).call(this),this._connected(null);let i=RA.fromReadableStream(e,this.controller);for await(let a of i)Me(this,$S,"m",vit).call(this,a);if(i.controller.signal?.aborted)throw new Sg;Me(this,$S,"m",wit).call(this)}finally{n&&o&&n.removeEventListener("abort",o)}}[(qk=new WeakMap,Bie=new WeakMap,yTe=new WeakMap,Uie=new WeakMap,zie=new WeakMap,bTe=new WeakMap,Hie=new WeakMap,oj=new WeakMap,Vie=new WeakMap,_Te=new WeakMap,vTe=new WeakMap,PG=new WeakMap,wTe=new WeakMap,STe=new WeakMap,CTe=new WeakMap,$S=new WeakSet,bit=function(){if(this.receivedMessages.length===0)throw new tn("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},Nyr=function(){if(this.receivedMessages.length===0)throw new tn("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 tn("stream ended without producing a content block with type=text");return r.join(" ")},_it=function(){this.ended||ir(this,qk,void 0,"f")},vit=function(r){if(this.ended)return;let n=Me(this,$S,"m",jyr).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":{$yr(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":{ir(this,qk,n,"f");break}case"content_block_start":case"message_delta":break}},wit=function(){if(this.ended)throw new tn("stream has ended, this shouldn't happen");let r=Me(this,qk,"f");if(!r)throw new tn("request ended without sending any chunks");return ir(this,qk,void 0,"f"),r},jyr=function(r){let n=Me(this,qk,"f");if(r.type==="message_start"){if(n)throw new tn(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new tn(`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&&$yr(o)){let i=o[Dyr]||"";i+=r.delta.partial_json;let a={...o};if(Object.defineProperty(a,Dyr,{value:i,enumerable:!1,writable:!0}),i)try{a.input=gTe(i)}catch(s){let u=new tn(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${i}`);Me(this,CTe,"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 RA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var OTe,Sit=v(()=>{OTe={"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 Fyr(){let t,e;return{promise:new Promise((n,o)=>{t=n,e=o}),resolve:t,reject:e}}async function Tso(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 TTe,MG,NH,R_,Jie,NA,ij,Bk,Kie,Cit,RG,xit=v(()=>{ej();KC();IA();RG=class{constructor(e,r,n){TTe.add(this),this.client=e,MG.set(this,!1),NH.set(this,!1),R_.set(this,void 0),Jie.set(this,void 0),NA.set(this,void 0),ij.set(this,void 0),Bk.set(this,void 0),Kie.set(this,0),ir(this,R_,{params:{...r,messages:structuredClone(r.messages)}},"f"),ir(this,Jie,{...n,headers:Zi([{"x-stainless-helper":"BetaToolRunner"},n?.headers])},"f"),ir(this,Bk,Fyr(),"f")}async*[(MG=new WeakMap,NH=new WeakMap,R_=new WeakMap,Jie=new WeakMap,NA=new WeakMap,ij=new WeakMap,Bk=new WeakMap,Kie=new WeakMap,TTe=new WeakSet,Symbol.asyncIterator)](){var e;if(Me(this,MG,"f"))throw new tn("Cannot iterate over a consumed stream");ir(this,MG,!0,"f"),ir(this,NH,!0,"f"),ir(this,ij,void 0,"f");try{for(;;){let r;try{if(Me(this,R_,"f").params.max_iterations&&Me(this,Kie,"f")>=Me(this,R_,"f").params.max_iterations)break;ir(this,NH,!1,"f"),ir(this,NA,void 0,"f"),ir(this,ij,void 0,"f"),ir(this,Kie,(e=Me(this,Kie,"f"),e++,e),"f");let{max_iterations:n,...o}=Me(this,R_,"f").params;if(o.stream?(r=this.client.beta.messages.stream({...o},Me(this,Jie,"f")),ir(this,NA,r.finalMessage(),"f"),yield r):(ir(this,NA,this.client.beta.messages.create({...o,stream:!1},Me(this,Jie,"f")),"f"),yield Me(this,NA,"f")),!Me(this,NH,"f")){let{role:a,content:s}=await Me(this,NA,"f");Me(this,R_,"f").params.messages.push({role:a,content:s})}let i=await Me(this,TTe,"m",Cit).call(this,Me(this,R_,"f").params.messages.at(-1));if(i&&Me(this,R_,"f").params.messages.push(i),!i&&!Me(this,NH,"f"))break}finally{r&&r.abort()}}if(!Me(this,NA,"f"))throw new tn("ToolRunner concluded without a message from the server");Me(this,Bk,"f").resolve(await Me(this,NA,"f"))}catch(r){throw ir(this,MG,!1,"f"),Me(this,Bk,"f").promise.catch(()=>{}),Me(this,Bk,"f").reject(r),ir(this,Bk,Fyr(),"f"),r}}setMessagesParams(e){typeof e=="function"?Me(this,R_,"f").params=e(Me(this,R_,"f").params):Me(this,R_,"f").params=e,ir(this,NH,!0,"f"),ir(this,ij,void 0,"f")}async generateToolResponse(){let e=await Me(this,NA,"f")??this.params.messages.at(-1);return e?Me(this,TTe,"m",Cit).call(this,e):null}done(){return Me(this,Bk,"f").promise}async runUntilDone(){if(!Me(this,MG,"f"))for await(let e of this);return this.done()}get params(){return Me(this,R_,"f").params}pushMessages(...e){this.setMessagesParams(r=>({...r,messages:[...r.messages,...e]}))}then(e,r){return this.runUntilDone().then(e,r)}};Cit=async function(e){return Me(this,ij,"f")!==void 0?Me(this,ij,"f"):(ir(this,ij,Tso(Me(this,R_,"f").params,e),"f"),Me(this,ij,"f"))}});var kyr,Uk,Oit=v(()=>{AA();hit();hit();IA();Lyr();Sit();xit();xit();kyr={"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"},Uk=class extends Cd{constructor(){super(...arguments),this.batches=new TG(this._client)}create(e,r){let{betas:n,...o}=e;o.model in kyr&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${kyr[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=OTe[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:Zi([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}stream(e,r){return xTe.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:Zi([{"anthropic-beta":[...n??[],"token-counting-2024-11-01"].toString()},r?.headers])})}toolRunner(e,r){return new RG(this._client,e,r)}};Uk.Batches=TG;Uk.BetaToolRunner=RG});var jA,Tit=v(()=>{AA();fit();fit();pit();pit();Oit();Oit();jA=class extends Cd{constructor(){super(...arguments),this.models=new xG(this._client),this.messages=new Uk(this._client),this.files=new CG(this._client)}};jA.Models=xG;jA.Messages=Uk;jA.Files=CG});var jH,Eit=v(()=>{AA();IA();jH=class extends Cd{create(e,r){let{betas:n,...o}=e;return this._client.post("/v1/complete",{body:o,timeout:this._client._options.timeout??6e5,...r,headers:Zi([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}}});function zyr(t){return t.type==="tool_use"||t.type==="server_tool_use"}var LS,zk,Wie,ETe,Gie,Zie,PTe,Xie,aj,Yie,MTe,RTe,AG,ATe,ITe,Pit,qyr,Mit,Rit,Ait,Iit,Byr,Uyr,NTe,Hyr=v(()=>{ej();dG();qie();git();yit();Uyr="__json_buf";NTe=class t{constructor(){LS.add(this),this.messages=[],this.receivedMessages=[],zk.set(this,void 0),this.controller=new AbortController,Wie.set(this,void 0),ETe.set(this,()=>{}),Gie.set(this,()=>{}),Zie.set(this,void 0),PTe.set(this,()=>{}),Xie.set(this,()=>{}),aj.set(this,{}),Yie.set(this,!1),MTe.set(this,!1),RTe.set(this,!1),AG.set(this,!1),ATe.set(this,void 0),ITe.set(this,void 0),Mit.set(this,e=>{if(ir(this,MTe,!0,"f"),tj(e)&&(e=new Sg),e instanceof Sg)return ir(this,RTe,!0,"f"),this._emit("abort",e);if(e instanceof tn)return this._emit("error",e);if(e instanceof Error){let r=new tn(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new tn(String(e)))}),ir(this,Wie,new Promise((e,r)=>{ir(this,ETe,e,"f"),ir(this,Gie,r,"f")}),"f"),ir(this,Zie,new Promise((e,r)=>{ir(this,PTe,e,"f"),ir(this,Xie,r,"f")}),"f"),Me(this,Wie,"f").catch(()=>{}),Me(this,Zie,"f").catch(()=>{})}get response(){return Me(this,ATe,"f")}get request_id(){return Me(this,ITe,"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,Mit,"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,LS,"m",Rit).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,LS,"m",Ait).call(this,u);if(s.controller.signal?.aborted)throw new Sg;Me(this,LS,"m",Iit).call(this)}finally{o&&i&&o.removeEventListener("abort",i)}}_connected(e){this.ended||(ir(this,ATe,e,"f"),ir(this,ITe,e?.headers.get("request-id"),"f"),Me(this,ETe,"f").call(this,e),this._emit("connect"))}get ended(){return Me(this,Yie,"f")}get errored(){return Me(this,MTe,"f")}get aborted(){return Me(this,RTe,"f")}abort(){this.controller.abort()}on(e,r){return(Me(this,aj,"f")[e]||(Me(this,aj,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=Me(this,aj,"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,aj,"f")[e]||(Me(this,aj,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ir(this,AG,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ir(this,AG,!0,"f"),await Me(this,Zie,"f")}get currentMessage(){return Me(this,zk,"f")}async finalMessage(){return await this.done(),Me(this,LS,"m",Pit).call(this)}async finalText(){return await this.done(),Me(this,LS,"m",qyr).call(this)}_emit(e,...r){if(Me(this,Yie,"f"))return;e==="end"&&(ir(this,Yie,!0,"f"),Me(this,PTe,"f").call(this));let n=Me(this,aj,"f")[e];if(n&&(Me(this,aj,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!Me(this,AG,"f")&&!n?.length&&Promise.reject(o),Me(this,Gie,"f").call(this,o),Me(this,Xie,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!Me(this,AG,"f")&&!n?.length&&Promise.reject(o),Me(this,Gie,"f").call(this,o),Me(this,Xie,"f").call(this,o),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",Me(this,LS,"m",Pit).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,LS,"m",Rit).call(this),this._connected(null);let i=RA.fromReadableStream(e,this.controller);for await(let a of i)Me(this,LS,"m",Ait).call(this,a);if(i.controller.signal?.aborted)throw new Sg;Me(this,LS,"m",Iit).call(this)}finally{n&&o&&n.removeEventListener("abort",o)}}[(zk=new WeakMap,Wie=new WeakMap,ETe=new WeakMap,Gie=new WeakMap,Zie=new WeakMap,PTe=new WeakMap,Xie=new WeakMap,aj=new WeakMap,Yie=new WeakMap,MTe=new WeakMap,RTe=new WeakMap,AG=new WeakMap,ATe=new WeakMap,ITe=new WeakMap,Mit=new WeakMap,LS=new WeakSet,Pit=function(){if(this.receivedMessages.length===0)throw new tn("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},qyr=function(){if(this.receivedMessages.length===0)throw new tn("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 tn("stream ended without producing a content block with type=text");return r.join(" ")},Rit=function(){this.ended||ir(this,zk,void 0,"f")},Ait=function(r){if(this.ended)return;let n=Me(this,LS,"m",Byr).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":{zyr(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":{ir(this,zk,n,"f");break}case"content_block_start":case"message_delta":break}},Iit=function(){if(this.ended)throw new tn("stream has ended, this shouldn't happen");let r=Me(this,zk,"f");if(!r)throw new tn("request ended without sending any chunks");return ir(this,zk,void 0,"f"),r},Byr=function(r){let n=Me(this,zk,"f");if(r.type==="message_start"){if(n)throw new tn(`Unexpected event order, got ${r.type} before receiving "message_stop"`);return r.message}if(!n)throw new tn(`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&&zyr(o)){let i=o[Uyr]||"";i+=r.delta.partial_json;let a={...o};Object.defineProperty(a,Uyr,{value:i,enumerable:!1,writable:!0}),i&&(a.input=gTe(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 RA(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var IG,Nit=v(()=>{AA();kk();IA();mit();qie();SG();IG=class extends Cd{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(xy`/v1/messages/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/v1/messages/batches",DS,{query:e,...r})}delete(e,r){return this._client.delete(xy`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(xy`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let n=await this.retrieve(e);if(!n.results_url)throw new tn(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);return this._client.get(n.results_url,{...r,headers:Zi([{Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((o,i)=>OG.fromResponse(i.response,i.controller))}}});var Hk,Vyr,jit=v(()=>{AA();Hyr();Nit();Nit();Sit();Hk=class extends Cd{constructor(){super(...arguments),this.batches=new IG(this._client)}create(e,r){e.model in Vyr&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${Vyr[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=OTe[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 NTe.createMessage(this,e,r)}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},Vyr={"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"};Hk.Batches=IG});var DH,Dit=v(()=>{AA();kk();IA();SG();DH=class extends Cd{retrieve(e,r={},n){let{betas:o}=r??{};return this._client.get(xy`/v1/models/${e}`,{...n,headers:Zi([{...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",DS,{query:o,...r,headers:Zi([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},r?.headers])})}}});var Jyr=v(()=>{Myr();Tit();Eit();jit();Dit()});var Qie,Kyr=v(()=>{Qie=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 $it,Lit,jTe,Wyr,Gyr,Zyr,pc,DA,Fit=v(()=>{ej();oyr();RH();cyr();dG();Zot();wG();_yr();Got();KC();kk();dit();Jyr();fTe();Eit();Dit();Tit();jit();Zot();IA();Kyr();cTe();RH();Gyr="\\n\\nHuman:",Zyr="\\n\\nAssistant:",pc=class{constructor({baseURL:e=Qie("ANTHROPIC_BASE_URL"),apiKey:r=Qie("ANTHROPIC_API_KEY")??null,authToken:n=Qie("ANTHROPIC_AUTH_TOKEN")??null,...o}={}){$it.add(this),jTe.set(this,void 0);let i={apiKey:r,authToken:n,...o,baseURL:e||"https://api.anthropic.com"};if(!i.dangerouslyAllowBrowser&&myr())throw new tn(`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??Lit.DEFAULT_TIMEOUT,this.logger=i.logger??console;let a="warn";this.logLevel=a,this.logLevel=tit(i.logLevel,"ClientOptions.logLevel",this)??tit(Qie("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??a,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??gyr(),ir(this,jTe,byr,"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 Zi([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return Zi([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return Zi([{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 tn(`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 ${Fk}`}defaultIdempotencyKey(){return`stainless-node-retry-${Vot()}`}makeStatusError(e,r,n,o){return _h.generate(e,r,n,o)}buildURL(e,r,n){let o=!Me(this,$it,"m",Wyr).call(this)&&n||this.baseURL,i=iyr(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return ayr(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 tn("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 AH(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`,nj({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new Sg;let f=new AbortController,p=await this.fetchWithTimeout(s,a,u,f).catch(Iie),m=Date.now();if(p instanceof globalThis.Error){let y=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new Sg;let b=tj(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"} - ${y}`),vh(this).debug(`[${l}] connection ${b?"timed out":"failed"} (${y})`,nj({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)`,nj({retryOfRequestLogID:n,url:s,durationMs:m-d,message:p.message})),b?new fG:new Lk({cause:p})}let h=[...p.headers.entries()].filter(([y])=>y==="request-id").map(([y,b])=>", "+y+": "+JSON.stringify(b)).join(""),g=`[${l}${c}${h}] ${a.method} ${s} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${m-d}ms`;if(!p.ok){let y=await this.shouldRetry(p);if(r&&y){let E=`retrying, ${r} attempts remaining`;return await yyr(p.body),vh(this).info(`${g} - ${E}`),vh(this).debug(`[${l}] response error (${E})`,nj({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:m-d})),this.retryRequest(o,r,n??l,p.headers)}let b=y?"error; no more retries left":"error; not retryable";vh(this).info(`${g} - ${b}`);let _=await p.text().catch(E=>Iie(E).message),w=aTe(_),x=w?void 0:_;throw vh(this).debug(`[${l}] response error (${b})`,nj({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:x,durationMs:Date.now()-d})),this.makeStatusError(p.status,w,x,p.headers)}return vh(this).info(g),vh(this).debug(`[${l}] response start`,nj({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 Fie(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 lyr(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 tn("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&&uyr("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=Zi([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))}:{},...hyr(),...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=Zi([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:sTe(e)}:Me(this,jTe,"f").call(this,{body:e,headers:n})}};Lit=pc,jTe=new WeakMap,$it=new WeakSet,Wyr=function(){return this.baseURL!=="https://api.anthropic.com"};pc.Anthropic=Lit;pc.HUMAN_PROMPT=Gyr;pc.AI_PROMPT=Zyr;pc.DEFAULT_TIMEOUT=6e5;pc.AnthropicError=tn;pc.APIError=_h;pc.APIConnectionError=Lk;pc.APIConnectionTimeoutError=fG;pc.APIUserAbortError=Sg;pc.NotFoundError=gG;pc.ConflictError=yG;pc.RateLimitError=_G;pc.BadRequestError=pG;pc.AuthenticationError=mG;pc.InternalServerError=vG;pc.PermissionDeniedError=hG;pc.UnprocessableEntityError=bG;pc.toFile=hTe;DA=class extends pc{constructor(){super(...arguments),this.completions=new jH(this),this.messages=new Hk(this),this.models=new DH(this),this.beta=new jA(this)}};DA.Completions=jH;DA.Messages=Hk;DA.Models=DH;DA.Beta=jA});var Xyr=v(()=>{Fit();dit();fTe();Fit();kk();KC()});function Aso(t){return t?Object.entries(Rso).find(([r])=>t.startsWith(r))?.[1]??Yyr:Yyr}function Iso(t){return!!(t.tools&&t.tools.length>0)}function Nso(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 jso(t){return!!(t.thinking&&t.thinking.type==="enabled")}function Dso(t){return"input_schema"in t}function $so(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 Lso(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 Rso,Yyr,Qyr,kit,ebr=v(()=>{kot();qgr();zot();ryr();nyr();Xyr();$s();ym();nl();D1();Wv();o_();xv();Gv();j1();Rso={"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},Yyr=2048;Qyr=class extends hh{constructor(e){super(e??{});M(this,"lc_serializable",!0);M(this,"anthropicApiKey");M(this,"apiKey");M(this,"apiUrl");M(this,"temperature");M(this,"topK");M(this,"topP");M(this,"maxTokens");M(this,"modelName","claude-3-5-sonnet-latest");M(this,"model","claude-3-5-sonnet-latest");M(this,"invocationKwargs");M(this,"stopSequences");M(this,"streaming",!1);M(this,"clientOptions");M(this,"thinking",{type:"disabled"});M(this,"contextManagement");M(this,"batchClient");M(this,"streamingClient");M(this,"streamUsage",!0);M(this,"createClient");if(this.anthropicApiKey=e?.apiKey??e?.anthropicApiKey??gn("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??Aso(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 DA(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($so(r)||Dso(r))return r;if(Kv(r))return{name:r.function.name,description:r.function.description,input_schema:r.function.parameters};if(mg(r))return{name:r.name,description:r.description,input_schema:Ga(r.schema)?Vi(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=kgr(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=oTe(e),a={...o,...i,stream:!0},s=!Iso(a)&&!Nso(a)&&!jso(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=eyr(l,{streamUsage:c,coerceContentToString:s});if(!d)continue;let{chunk:f}=d,p=Lso(f),m=new Hi({message:new Ur({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,...oTe(e)},n),{content:i,...a}=o,s=tyr(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 Hot(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 Hot(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(Ga(n)){let m=Vi(n);l=[{name:s,description:m.description??"A function available to call.",input_schema:m}],u=new Lot({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 Lot({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:Vi(n)}});let h=g=>{if(!g.tool_calls||g.tool_calls.length===0)throw new Error(m);return g};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:Vi(n)}});if(!a)return c.pipe(u).withConfig({runName:"ChatAnthropicStructuredOutput"});let d=xu.assign({parsed:(m,h)=>u.invoke(m.raw,h)}),f=xu.assign({parsed:()=>null}),p=d.withFallbacks({fallbacks:[f]});return El.from([{raw:c},p]).withConfig({runName:"StructuredOutputRunnable"})}},kit=class extends Qyr{}});var tbr=v(()=>{zot()});var rbr=v(()=>{ebr();tbr()});var qit,nbr=v(()=>{nl();cH();qit=class extends Ck{constructor(e){let r=e?.apiKey||gn("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}});M(this,"lc_serializable",!0);M(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 obr=v(()=>{nbr()});var $H,ibr=v(()=>{$H="0.19.0"});function sbr(t,e={auto:!1}){if(abr)throw new Error(`you must \`import 'groq-sdk/shims/${t.kind}'\` before importing anything else from groq-sdk`);if(LH)throw new Error(`can't \`import 'groq-sdk/shims/${t.kind}'\` after \`import 'groq-sdk/shims/${LH}'\``);abr=e.auto,LH=t.kind,Bit=t.fetch,Fso=t.Request,kso=t.Response,qso=t.Headers,Uit=t.FormData,Bso=t.Blob,DTe=t.File,zit=t.ReadableStream,Hit=t.getMultipartRequestOptions,Vit=t.getDefaultAgent,$Te=t.fileFromPath,Jit=t.isFsReadStream}var abr,LH,Bit,Fso,kso,qso,Uit,Bso,DTe,zit,Hit,Vit,$Te,Jit,Kit=v(()=>{abr=!1});var LTe,ubr=v(()=>{LTe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function lbr({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 LTe(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 cbr=v(()=>{ubr()});var dbr=v(()=>{cbr()});var Wit,eae=v(()=>{Kit();dbr();Kit();Wit=()=>{LH||sbr(lbr(),{auto:!0})};Wit()});var Cg,wh,FH,Vk,NG,tae,rae,nae,oae,iae,aae,sae,uae,lae=v(()=>{jG();Cg=class extends Error{},wh=class t extends Cg{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 Vk({message:n,cause:FTe(r)});let i=r;return e===400?new tae(e,i,n,o):e===401?new rae(e,i,n,o):e===403?new nae(e,i,n,o):e===404?new oae(e,i,n,o):e===409?new iae(e,i,n,o):e===422?new aae(e,i,n,o):e===429?new sae(e,i,n,o):e>=500?new uae(e,i,n,o):new t(e,i,n,o)}},FH=class extends wh{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Vk=class extends wh{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},NG=class extends Vk{constructor({message:e}={}){super({message:e??"Request timed out."})}},tae=class extends wh{},rae=class extends wh{},nae=class extends wh{},oae=class extends wh{},iae=class extends wh{},aae=class extends wh{},sae=class extends wh{},uae=class extends wh{}});function Vso(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}function fbr(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 kTe,Git,DG,pbr=v(()=>{eae();lae();lae();kTe=class t{constructor(e,r){this.iterator=e,this.controller=r}static fromSSEResponse(e,r){let n=!1,o=new Git;async function*i(){if(!e.body)throw r.abort(),new Cg("Attempted to iterate over a response with no body");let s=new DG,u=fbr(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 DG,s=fbr(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 zit({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?.()}})}},Git=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]=Vso(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}},DG=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 Cg(`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 Cg(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Cg("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}};DG.NEWLINE_CHARS=new Set([`
|
||
`,"\r","\v","\f","","","","\x85","\u2028","\u2029"]);DG.NEWLINE_REGEXP=/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g});async function Yit(t,e,r){if(t=await t,hbr(t))return t;if(mbr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=cae(o)?[await o.arrayBuffer()]:[o];return new DTe(i,e,r)}let n=await Kso(t);if(e||(e=Gso(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new DTe(n,e,r)}async function Kso(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(cae(t))e.push(await t.arrayBuffer());else if(Zso(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${Wso(t)}`);return e}function Wso(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function Gso(t){return Zit(t.name)||Zit(t.filename)||Zit(t.path)?.split(/[\\/]/).pop()}var mbr,hbr,cae,Jso,Zit,Zso,Qit,kH,gbr,Xit,qTe=v(()=>{eae();eae();mbr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",hbr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&cae(t),cae=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",Jso=t=>hbr(t)||mbr(t)||Jit(t);Zit=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},Zso=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Qit=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",kH=async t=>{let e=await gbr(t.body);return Hit(e,t)},gbr=async t=>{let e=new Uit;return await Promise.all(Object.entries(t||{}).map(([r,n])=>Xit(e,r,n))),e},Xit=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(Jso(r)){let n=await Yit(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>Xit(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>Xit(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 Sbr(t){let{response:e}=t;if(t.options.stream)return $G("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):kTe.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 $G("response",e.status,e.url,e.headers,a),a}let i=await e.text();return $G("response",e.status,e.url,e.headers,i),i}function ruo(){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 uuo(t){if(!t)return!0;for(let e in t)return!1;return!0}function luo(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function wbr(t,e){for(let r in e){if(!luo(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 $G(t,...e){typeof process<"u"&&process?.env?.DEBUG==="true"&&console.log(`Groq:DEBUG:${t}`,...e)}var Yso,Qso,BTe,zTe,HTe,ybr,tat,euo,tuo,bbr,_br,vbr,nuo,ouo,iuo,auo,suo,eat,FTe,rat,cuo,Cbr,duo,UTe,jG=v(()=>{ibr();pbr();lae();eae();qTe();qTe();Yso=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},Qso=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)};Wit();zTe=class t extends Promise{constructor(e,r=Sbr){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)}},HTe=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??Bit}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...nuo(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${cuo()}`}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&&cae(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:Qit(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??Vit(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 wbr(i,a),wbr(i,r),Qit(e.body)&&LH!=="node"&&delete i["content-type"],UTe(a,"x-stainless-retry-count")===void 0&&UTe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),UTe(a,"x-stainless-timeout")===void 0&&UTe(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 zTe(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}),$G("request",a,n,i.headers),n.signal?.aborted)throw new FH;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(FTe);if(l instanceof Error){if(n.signal?.aborted)throw new FH;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new NG:new Vk({cause:l})}let c=euo(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let g=`retrying, ${r} attempts remaining`;return $G(`response (error; ${g})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(g=>FTe(g).message),f=ouo(d),p=f?void 0:d;throw $G(`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 tat(this,n,e)}buildURL(e,r){let n=auo(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return uuo(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 Cg(`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 suo(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 ${$H}`}},ybr=class{constructor(e,r,n,o){BTe.set(this,void 0),Yso(this,BTe,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 Cg("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 Qso(this,BTe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(BTe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},tat=class extends zTe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await Sbr(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},euo=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),tuo=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$H,"X-Stainless-OS":_br(Deno.build.os),"X-Stainless-Arch":bbr(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":$H,"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":$H,"X-Stainless-OS":_br(process.platform),"X-Stainless-Arch":bbr(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=ruo();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":$H,"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":$H,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};bbr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",_br=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"),nuo=()=>vbr??(vbr=tuo()),ouo=t=>{try{return JSON.parse(t)}catch{return}},iuo=/^[a-z][a-z0-9+.-]*:/i,auo=t=>iuo.test(t),suo=t=>new Promise(e=>setTimeout(e,t)),eat=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Cg(`${t} must be an integer`);if(e<0)throw new Cg(`${t} must be a positive integer`);return e},FTe=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)},rat=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};cuo=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),Cbr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",duo=t=>typeof t?.get=="function",UTe=(t,e)=>{let r=e.toLowerCase();if(duo(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 xbr=v(()=>{});var ql,FS=v(()=>{ql=class{constructor(e){this._client=e}}});var LG,nat=v(()=>{FS();LG=class extends ql{create(e,r){return this._client.post("/openai/v1/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var FG,oat=v(()=>{FS();jG();FG=class extends ql{create(e,r){return this._client.post("/openai/v1/audio/transcriptions",kH({body:e,...r}))}}});var kG,iat=v(()=>{FS();jG();kG=class extends ql{create(e,r){return this._client.post("/openai/v1/audio/translations",kH({body:e,...r}))}}});var $A,aat=v(()=>{FS();nat();nat();oat();oat();iat();iat();$A=class extends ql{constructor(){super(...arguments),this.speech=new LG(this._client),this.transcriptions=new FG(this._client),this.translations=new kG(this._client)}};$A.Speech=LG;$A.Transcriptions=FG;$A.Translations=kG});var qH,sat=v(()=>{FS();qH=class extends ql{create(e,r){return this._client.post("/openai/v1/batches",{body:e,...r})}retrieve(e,r){return this._client.get(`/openai/v1/batches/${e}`,r)}list(e){return this._client.get("/openai/v1/batches",e)}cancel(e,r){return this._client.post(`/openai/v1/batches/${e}/cancel`,r)}}});var qG,uat=v(()=>{FS();qG=class extends ql{create(e,r){return this._client.post("/openai/v1/chat/completions",{body:e,...r,stream:e.stream??!1})}}});var Jk,lat=v(()=>{FS();uat();uat();Jk=class extends ql{constructor(){super(...arguments),this.completions=new qG(this._client)}};Jk.Completions=qG});var BH,cat=v(()=>{FS();BH=class extends ql{}});var UH,dat=v(()=>{FS();UH=class extends ql{create(e,r){return this._client.post("/openai/v1/embeddings",{body:e,...r})}}});var zH,fat=v(()=>{FS();jG();zH=class extends ql{create(e,r){return this._client.post("/openai/v1/files",kH({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 HH,pat=v(()=>{FS();HH=class extends ql{retrieve(e,r){return this._client.get(`/openai/v1/models/${e}`,r)}list(e){return this._client.get("/openai/v1/models",e)}delete(e,r){return this._client.delete(`/openai/v1/models/${e}`,r)}}});var Obr=v(()=>{xbr();aat();sat();lat();cat();dat();fat();pat()});var Tbr,du,Ebr,Pbr=v(()=>{jG();lae();qTe();Obr();sat();cat();dat();fat();pat();aat();lat();du=class extends HTe{constructor({baseURL:e=rat("GROQ_BASE_URL"),apiKey:r=rat("GROQ_API_KEY"),...n}={}){if(r===void 0)throw new Cg("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&&Cbr())throw new Cg(`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 BH(this),this.chat=new Jk(this),this.embeddings=new UH(this),this.audio=new $A(this),this.models=new HH(this),this.batches=new qH(this),this.files=new zH(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}`}}};Tbr=du;du.Groq=Tbr;du.DEFAULT_TIMEOUT=6e4;du.GroqError=Cg;du.APIError=wh;du.APIConnectionError=Vk;du.APIConnectionTimeoutError=NG;du.APIUserAbortError=FH;du.NotFoundError=oae;du.ConflictError=iae;du.RateLimitError=sae;du.BadRequestError=tae;du.AuthenticationError=rae;du.InternalServerError=uae;du.PermissionDeniedError=nae;du.UnprocessableEntityError=aae;du.toFile=Yit;du.fileFromPath=$Te;du.Completions=BH;du.Chat=Jk;du.Embeddings=UH;du.Audio=$A;du.Models=HH;du.Batches=qH;du.Files=zH;Ebr=du});function vuo(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 Rbr(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(!cd.isInstance(t))throw new Error("Invalid generic chat message");return vuo(t);default:throw new Error(`Unknown message type: ${t.type}`)}}function Mbr(t){return t.map(e=>{let r={role:Rbr(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 Us(e)&&e.tool_calls?.length?r.tool_calls=e.tool_calls.map(Sk):(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 wuo(t,e,r){let n=t.tool_calls;switch(t.role){case"assistant":{let o=[],i=[];for(let a of n??[])try{o.push(LC(a,{returnId:!0}))}catch(s){i.push(FC(a,s.message))}return new li({content:t.content||"",additional_kwargs:{tool_calls:n},tool_calls:o,invalid_tool_calls:i,usage_metadata:e,response_metadata:r})}default:return new cd(t.content||"",t.role??"unknown")}}function Suo(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 _v({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 Ur({content:i,tool_call_chunks:f,additional_kwargs:a,id:u,response_metadata:d})}else return o==="system"?new Ky({content:i,response_metadata:d}):o==="developer"?new Ky({content:i,response_metadata:d,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new bv({content:i,additional_kwargs:a,name:t.name,response_metadata:d}):o==="tool"?new Aw({content:i,additional_kwargs:a,tool_call_id:t.tool_call_id,response_metadata:d}):new yv({content:i,role:o,response_metadata:d})}function Cuo(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 yuo,buo,_uo,mat,Abr=v(()=>{o_();D1();$s();ym();nl();Gv();Pbr();xv();_O();sH();j1();yuo=["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"],buo=["headers","promptIndex","stream_options","tools"],_uo=[...yuo,...buo];mat=class extends hh{constructor(e){super(e);M(this,"lc_namespace",["langchain","chat_models","groq"]);M(this,"client");M(this,"model");M(this,"temperature",.7);M(this,"stop");M(this,"stopSequences");M(this,"maxTokens");M(this,"streaming",!1);M(this,"apiKey");M(this,"streamUsage",!0);M(this,"topP");M(this,"frequencyPenalty");M(this,"presencePenalty");M(this,"logprobs");M(this,"n");M(this,"logitBias");M(this,"user");M(this,"reasoningFormat");M(this,"serviceTier");M(this,"topLogprobs");M(this,"lc_serializable",!0);let r=e.apiKey||gn("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 Ebr({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,..._uo]}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:Cuo(e?.tool_choice),tools:e?.tools?.length?e.tools.map(a=>N1(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=>N1(n)),...r})}async*_streamResponseChunks(e,r,n){let o=this.invocationParams(r,{streaming:!0}),i=Mbr(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=Suo(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 Hi({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 Hi({message:new Ur({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=Mbr(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:wuo(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;Ga(n)?(u=Jw.fromZodSchema(n),p=Vi(n)):u=new Ov,l=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"jsonMode"},schema:p}})}else if(Ga(n)){let p=Vi(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 kC({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 kC({returnSingle:!0,keyName:s})}if(!a)return l.pipe(u).withConfig({runName:"ChatGroqStructuredOutput"});let c=xu.assign({parsed:(p,m)=>u.invoke(p.raw,m)}),d=xu.assign({parsed:()=>null}),f=c.withFallbacks({fallbacks:[d]});return El.from([{raw:l},f]).withConfig({runName:"ChatGroqStructuredOutput"})}}});var Ibr=v(()=>{Abr()});function Ouo(t){return xuo.test(t)}function Tuo(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 Euo(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 dae(t){if(Ouo(t))return t;{let e=Euo(t),r=Tuo(e);return r.length>=9?r.slice(0,9):r.padStart(9,"0")}}function hat(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 xuo,Nbr=v(()=>{xuo=/^[a-zA-Z0-9]{9}$/});function jbr(t,e=0){return(xg[t[e+0]]+xg[t[e+1]]+xg[t[e+2]]+xg[t[e+3]]+"-"+xg[t[e+4]]+xg[t[e+5]]+"-"+xg[t[e+6]]+xg[t[e+7]]+"-"+xg[t[e+8]]+xg[t[e+9]]+"-"+xg[t[e+10]]+xg[t[e+11]]+xg[t[e+12]]+xg[t[e+13]]+xg[t[e+14]]+xg[t[e+15]]).toLowerCase()}var xg,JTe,Dbr=v(()=>{xg=[];for(JTe=0;JTe<256;++JTe)xg.push((JTe+256).toString(16).slice(1))});function gat(){if(!KTe&&(KTe=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!KTe))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return KTe(Puo)}var KTe,Puo,$br=v(()=>{Puo=new Uint8Array(16)});var Muo,yat,Lbr=v(()=>{Muo=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),yat={randomUUID:Muo}});function Ruo(t,e,r){if(yat.randomUUID&&!e&&!t)return yat.randomUUID();t=t||{};var n=t.random||(t.rng||gat)();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 jbr(n)}var WTe,Fbr=v(()=>{Lbr();$br();Dbr();WTe=Ruo});var kbr=v(()=>{Fbr()});var or=S(bat=>{"use strict";Object.defineProperty(bat,"__esModule",{value:!0});bat.pathToFunc=Iuo;var Auo=Object.prototype.hasOwnProperty;function Iuo(t,e){let r=/\{([a-zA-Z0-9_]+?)\}/g;return function(o={}){return t.replace(r,function(i,a){if(!Auo.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 GTe=S(kS=>{"use strict";Object.defineProperty(kS,"__esModule",{value:!0});kS.SDK_METADATA=kS.ServerList=kS.ServerEu=void 0;kS.serverURLFromOptions=juo;var Nuo=or();kS.ServerEu="eu";kS.ServerList={[kS.ServerEu]:"https://api.mistral.ai"};function juo(t){let e=t.serverURL,r={};if(!e){let o=t.server??kS.ServerEu;e=kS.ServerList[o]||""}let n=(0,Nuo.pathToFunc)(e)(r);return new URL(n)}kS.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 BG=S(ZTe=>{"use strict";Object.defineProperty(ZTe,"__esModule",{value:!0});ZTe.readableStreamToArrayBuffer=Duo;ZTe.getContentTypeFromFileName=$uo;async function Duo(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 $uo(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 UG=S(LA=>{"use strict";Object.defineProperty(LA,"__esModule",{value:!0});LA.HTTPClient=void 0;LA.matchContentType=Bbr;LA.matchStatusCode=Ubr;LA.matchResponse=kuo;LA.isConnectionError=quo;LA.isTimeoutError=Buo;LA.isAbortError=Uuo;var Luo=(t,e)=>e==null?fetch(t):fetch(t,e),_at=class t{constructor(e={}){this.options=e,this.requestHooks=[],this.requestErrorHooks=[],this.responseHooks=[],this.fetcher=e.fetcher||Luo}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}};LA.HTTPClient=_at;var qbr=/\s*;\s*/g;function Bbr(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(qbr),[o="",...i]=n;if(o.split("/").length!==2)return!1;let a=r.split(qbr),[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 Fuo=new RegExp("^[0-9]xx$","i");function Ubr(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(!Fuo.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 kuo(t,e,r){return Ubr(t,e)&&Bbr(t,r)}function quo(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 Buo(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 Uuo(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 zbr=S(XTe=>{"use strict";Object.defineProperty(XTe,"__esModule",{value:!0});XTe.CustomUserAgentHook=void 0;var zuo=GTe(),vat=class{beforeRequest(e,r){let o=`mistral-client-typescript/${zuo.SDK_METADATA.sdkVersion}`;return r.headers.set("user-agent",o),r.headers.get("user-agent")||r.headers.set("x-mistral-user-agent",o),r}};XTe.CustomUserAgentHook=vat});var Vbr=S(YTe=>{"use strict";Object.defineProperty(YTe,"__esModule",{value:!0});YTe.DeprecationWarningHook=void 0;var Hbr="x-model-deprecation-timestamp",wat=class{afterSuccess(e,r){return r.headers.has(Hbr)&&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(Hbr)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),r}};YTe.DeprecationWarningHook=wat});var Jbr=S(Sat=>{"use strict";Object.defineProperty(Sat,"__esModule",{value:!0});Sat.initHooks=Juo;var Huo=zbr(),Vuo=Vbr();function Juo(t){let e=new Huo.CustomUserAgentHook;t.registerBeforeRequestHook(e);let r=new Vuo.DeprecationWarningHook;t.registerAfterSuccessHook(r)}});var Kbr=S(QTe=>{"use strict";Object.defineProperty(QTe,"__esModule",{value:!0});QTe.SDKHooks=void 0;var Kuo=Jbr(),Cat=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,Kuo.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}}};QTe.SDKHooks=Cat});var Mat=S(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});A_.ConnectionError=A_.RequestTimeoutError=A_.RequestAbortedError=A_.InvalidRequestError=A_.UnexpectedClientError=A_.HTTPClientError=void 0;var Kk=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)}};A_.HTTPClientError=Kk;var xat=class extends Kk{constructor(){super(...arguments),this.name="UnexpectedClientError"}};A_.UnexpectedClientError=xat;var Oat=class extends Kk{constructor(){super(...arguments),this.name="InvalidRequestError"}};A_.InvalidRequestError=Oat;var Tat=class extends Kk{constructor(){super(...arguments),this.name="RequestAbortedError"}};A_.RequestAbortedError=Tat;var Eat=class extends Kk{constructor(){super(...arguments),this.name="RequestTimeoutError"}};A_.RequestTimeoutError=Eat;var Pat=class extends Kk{constructor(){super(...arguments),this.name="ConnectionError"}};A_.ConnectionError=Pat});var xd=S(zG=>{"use strict";Object.defineProperty(zG,"__esModule",{value:!0});zG.OK=Wuo;zG.ERR=Guo;zG.unwrap=Zuo;zG.unwrapAsync=Xuo;function Wuo(t){return{ok:!0,value:t}}function Guo(t){return{ok:!1,error:t}}function Zuo(t){if(!t.ok)throw t.error;return t.value}async function Xuo(t){let e=await t;if(!e.ok)throw e.error;return e.value}});var fae=S(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.getParsedType=Ju.ZodParsedType=Ju.objectUtil=Ju.util=void 0;var Rat;(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})(Rat||(Ju.util=Rat={}));var Wbr;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Wbr||(Ju.objectUtil=Wbr={}));Ju.ZodParsedType=Rat.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Yuo=t=>{switch(typeof t){case"undefined":return Ju.ZodParsedType.undefined;case"string":return Ju.ZodParsedType.string;case"number":return Number.isNaN(t)?Ju.ZodParsedType.nan:Ju.ZodParsedType.number;case"boolean":return Ju.ZodParsedType.boolean;case"function":return Ju.ZodParsedType.function;case"bigint":return Ju.ZodParsedType.bigint;case"symbol":return Ju.ZodParsedType.symbol;case"object":return Array.isArray(t)?Ju.ZodParsedType.array:t===null?Ju.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ju.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?Ju.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?Ju.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?Ju.ZodParsedType.date:Ju.ZodParsedType.object;default:return Ju.ZodParsedType.unknown}};Ju.getParsedType=Yuo});var eEe=S(Wk=>{"use strict";Object.defineProperty(Wk,"__esModule",{value:!0});Wk.ZodError=Wk.quotelessJson=Wk.ZodIssueCode=void 0;var Gbr=fae();Wk.ZodIssueCode=Gbr.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 Quo=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Wk.quotelessJson=Quo;var pae=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,Gbr.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()}};Wk.ZodError=pae;pae.create=t=>new pae(t)});var Iat=S(Aat=>{"use strict";Object.defineProperty(Aat,"__esModule",{value:!0});var Oy=eEe(),VH=fae(),elo=(t,e)=>{let r;switch(t.code){case Oy.ZodIssueCode.invalid_type:t.received===VH.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Oy.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,VH.util.jsonStringifyReplacer)}`;break;case Oy.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${VH.util.joinValues(t.keys,", ")}`;break;case Oy.ZodIssueCode.invalid_union:r="Invalid input";break;case Oy.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${VH.util.joinValues(t.options)}`;break;case Oy.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${VH.util.joinValues(t.options)}, received '${t.received}'`;break;case Oy.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case Oy.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case Oy.ZodIssueCode.invalid_date:r="Invalid date";break;case Oy.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}"`:VH.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Oy.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 Oy.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 Oy.ZodIssueCode.custom:r="Invalid input";break;case Oy.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case Oy.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Oy.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,VH.util.assertNever(t)}return{message:r}};Aat.default=elo});var tEe=S(Gk=>{"use strict";var tlo=Gk&&Gk.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gk,"__esModule",{value:!0});Gk.defaultErrorMap=void 0;Gk.setErrorMap=rlo;Gk.getErrorMap=nlo;var Zbr=tlo(Iat());Gk.defaultErrorMap=Zbr.default;var Xbr=Zbr.default;function rlo(t){Xbr=t}function nlo(){return Xbr}});var jat=S(nu=>{"use strict";var olo=nu&&nu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(nu,"__esModule",{value:!0});nu.isAsync=nu.isValid=nu.isDirty=nu.isAborted=nu.OK=nu.DIRTY=nu.INVALID=nu.ParseStatus=nu.EMPTY_PATH=nu.makeIssue=void 0;nu.addIssueToContext=slo;var ilo=tEe(),Ybr=olo(Iat()),alo=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}};nu.makeIssue=alo;nu.EMPTY_PATH=[];function slo(t,e){let r=(0,ilo.getErrorMap)(),n=(0,nu.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ybr.default?void 0:Ybr.default].filter(o=>!!o)});t.common.issues.push(n)}var Nat=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 nu.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 nu.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}}};nu.ParseStatus=Nat;nu.INVALID=Object.freeze({status:"aborted"});var ulo=t=>({status:"dirty",value:t});nu.DIRTY=ulo;var llo=t=>({status:"valid",value:t});nu.OK=llo;var clo=t=>t.status==="aborted";nu.isAborted=clo;var dlo=t=>t.status==="dirty";nu.isDirty=dlo;var flo=t=>t.status==="valid";nu.isValid=flo;var plo=t=>typeof Promise<"u"&&t instanceof Promise;nu.isAsync=plo});var e_r=S(Qbr=>{"use strict";Object.defineProperty(Qbr,"__esModule",{value:!0})});var r_r=S(rEe=>{"use strict";Object.defineProperty(rEe,"__esModule",{value:!0});rEe.errorUtil=void 0;var t_r;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(t_r||(rEe.errorUtil=t_r={}))});var m_r=S(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.discriminatedUnion=_e.date=_e.boolean=_e.bigint=_e.array=_e.any=_e.coerce=_e.ZodFirstPartyTypeKind=_e.late=_e.ZodSchema=_e.Schema=_e.ZodReadonly=_e.ZodPipeline=_e.ZodBranded=_e.BRAND=_e.ZodNaN=_e.ZodCatch=_e.ZodDefault=_e.ZodNullable=_e.ZodOptional=_e.ZodTransformer=_e.ZodEffects=_e.ZodPromise=_e.ZodNativeEnum=_e.ZodEnum=_e.ZodLiteral=_e.ZodLazy=_e.ZodFunction=_e.ZodSet=_e.ZodMap=_e.ZodRecord=_e.ZodTuple=_e.ZodIntersection=_e.ZodDiscriminatedUnion=_e.ZodUnion=_e.ZodObject=_e.ZodArray=_e.ZodVoid=_e.ZodNever=_e.ZodUnknown=_e.ZodAny=_e.ZodNull=_e.ZodUndefined=_e.ZodSymbol=_e.ZodDate=_e.ZodBoolean=_e.ZodBigInt=_e.ZodNumber=_e.ZodString=_e.ZodType=void 0;_e.NEVER=_e.void=_e.unknown=_e.union=_e.undefined=_e.tuple=_e.transformer=_e.symbol=_e.string=_e.strictObject=_e.set=_e.record=_e.promise=_e.preprocess=_e.pipeline=_e.ostring=_e.optional=_e.onumber=_e.oboolean=_e.object=_e.number=_e.nullable=_e.null=_e.never=_e.nativeEnum=_e.nan=_e.map=_e.literal=_e.lazy=_e.intersection=_e.instanceof=_e.function=_e.enum=_e.effect=void 0;_e.datetimeRegex=s_r;_e.custom=l_r;var yt=eEe(),nEe=tEe(),$r=r_r(),Se=jat(),At=fae(),BS=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}},n_r=(t,e)=>{if((0,Se.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 yt.ZodError(t.common.issues);return this._error=r,this._error}}};function qo(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var Bo=class{get description(){return this._def.description}_getType(e){return(0,At.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,At.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Se.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,At.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,Se.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,At.getParsedType)(e)},o=this._parseSync({data:e,path:n.path,parent:n});return n_r(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,At.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return(0,Se.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,Se.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,At.getParsedType)(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await((0,Se.isAsync)(o)?o:Promise.resolve(o));return n_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:yt.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 rw({schema:this,typeName:Ln.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 qS.create(this,this._def)}nullable(){return kA.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return lj.create(this)}promise(){return Yk.create(this,this._def)}or(e){return YH.create([this,e],this._def)}and(e){return QH.create(this,e,this._def)}transform(e){return new rw({...qo(this._def),schema:this,typeName:Ln.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new oV({...qo(this._def),innerType:this,defaultValue:r,typeName:Ln.ZodDefault})}brand(){return new mae({typeName:Ln.ZodBranded,type:this,...qo(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new iV({...qo(this._def),innerType:this,catchValue:r,typeName:Ln.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return hae.create(this,e)}readonly(){return aV.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};_e.ZodType=Bo;_e.Schema=Bo;_e.ZodSchema=Bo;var mlo=/^c[^\s-]{8,}$/i,hlo=/^[0-9a-z]+$/,glo=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ylo=/^[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,blo=/^[a-z0-9_-]{21}$/i,_lo=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,vlo=/^[-+]?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)?)??$/,wlo=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Slo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Dat,Clo=/^(?:(?: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])$/,xlo=/^(?:(?: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])$/,Olo=/^(([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]))$/,Tlo=/^(([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])$/,Elo=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Plo=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,i_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])))",Mlo=new RegExp(`^${i_r}$`);function a_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 Rlo(t){return new RegExp(`^${a_r(t)}$`)}function s_r(t){let e=`${i_r}T${a_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 Alo(t,e){return!!((e==="v4"||!e)&&Clo.test(t)||(e==="v6"||!e)&&Olo.test(t))}function Ilo(t,e){if(!_lo.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 Nlo(t,e){return!!((e==="v4"||!e)&&xlo.test(t)||(e==="v6"||!e)&&Tlo.test(t))}var Zk=class t extends Bo{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==At.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(i,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.string,received:i.parsedType}),Se.INVALID}let n=new Se.ParseStatus,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{code:yt.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,Se.addIssueToContext)(o,{code:yt.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,Se.addIssueToContext)(o,{code:yt.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&(0,Se.addIssueToContext)(o,{code:yt.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")wlo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"email",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Dat||(Dat=new RegExp(Slo,"u")),Dat.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"emoji",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")ylo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"uuid",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")blo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"nanoid",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")mlo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"cuid",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")hlo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"cuid2",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")glo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"ulid",code:yt.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,Se.addIssueToContext)(o,{validation:"url",code:yt.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,Se.addIssueToContext)(o,{validation:"regex",code:yt.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,Se.addIssueToContext)(o,{code:yt.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,Se.addIssueToContext)(o,{code:yt.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,Se.addIssueToContext)(o,{code:yt.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?s_r(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{code:yt.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Mlo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{code:yt.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Rlo(i).test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{code:yt.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?vlo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"duration",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Alo(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"ip",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Ilo(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"jwt",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Nlo(e.data,i.version)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"cidr",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Elo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"base64",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Plo.test(e.data)||(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{validation:"base64url",code:yt.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):At.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:yt.ZodIssueCode.invalid_string,...$r.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...$r.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...$r.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...$r.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...$r.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...$r.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...$r.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...$r.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...$r.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...$r.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...$r.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...$r.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...$r.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...$r.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,...$r.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,...$r.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...$r.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...$r.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...$r.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...$r.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...$r.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...$r.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...$r.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...$r.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,$r.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}};_e.ZodString=Zk;Zk.create=t=>new Zk({checks:[],typeName:Ln.ZodString,coerce:t?.coerce??!1,...qo(t)});function jlo(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 JH=class t extends Bo{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)!==At.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(i,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.number,received:i.parsedType}),Se.INVALID}let n,o=new Se.ParseStatus;for(let i of this._def.checks)i.kind==="int"?At.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,Se.addIssueToContext)(n,{code:yt.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,Se.addIssueToContext)(n,{code:yt.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,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?jlo(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,Se.addIssueToContext)(n,{code:yt.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,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.not_finite,message:i.message}),o.dirty()):At.util.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,$r.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,$r.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,$r.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,$r.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:$r.errorUtil.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:$r.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:$r.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:$r.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:$r.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:$r.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:$r.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:$r.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:$r.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:$r.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"&&At.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)}};_e.ZodNumber=JH;JH.create=t=>new JH({checks:[],typeName:Ln.ZodNumber,coerce:t?.coerce||!1,...qo(t)});var KH=class t extends Bo{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)!==At.ZodParsedType.bigint)return this._getInvalidInput(e);let n,o=new Se.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,Se.addIssueToContext)(n,{code:yt.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,Se.addIssueToContext)(n,{code:yt.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,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):At.util.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(r,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.bigint,received:r.parsedType}),Se.INVALID}gte(e,r){return this.setLimit("min",e,!0,$r.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,$r.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,$r.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,$r.errorUtil.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:$r.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:$r.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:$r.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:$r.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:$r.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:$r.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}};_e.ZodBigInt=KH;KH.create=t=>new KH({checks:[],typeName:Ln.ZodBigInt,coerce:t?.coerce??!1,...qo(t)});var WH=class extends Bo{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==At.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.boolean,received:n.parsedType}),Se.INVALID}return(0,Se.OK)(e.data)}};_e.ZodBoolean=WH;WH.create=t=>new WH({typeName:Ln.ZodBoolean,coerce:t?.coerce||!1,...qo(t)});var GH=class t extends Bo{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==At.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(i,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.date,received:i.parsedType}),Se.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(i,{code:yt.ZodIssueCode.invalid_date}),Se.INVALID}let n=new Se.ParseStatus,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),(0,Se.addIssueToContext)(o,{code:yt.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,Se.addIssueToContext)(o,{code:yt.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):At.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:$r.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:$r.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}};_e.ZodDate=GH;GH.create=t=>new GH({checks:[],coerce:t?.coerce||!1,typeName:Ln.ZodDate,...qo(t)});var VG=class extends Bo{_parse(e){if(this._getType(e)!==At.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.symbol,received:n.parsedType}),Se.INVALID}return(0,Se.OK)(e.data)}};_e.ZodSymbol=VG;VG.create=t=>new VG({typeName:Ln.ZodSymbol,...qo(t)});var ZH=class extends Bo{_parse(e){if(this._getType(e)!==At.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.undefined,received:n.parsedType}),Se.INVALID}return(0,Se.OK)(e.data)}};_e.ZodUndefined=ZH;ZH.create=t=>new ZH({typeName:Ln.ZodUndefined,...qo(t)});var XH=class extends Bo{_parse(e){if(this._getType(e)!==At.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.null,received:n.parsedType}),Se.INVALID}return(0,Se.OK)(e.data)}};_e.ZodNull=XH;XH.create=t=>new XH({typeName:Ln.ZodNull,...qo(t)});var Xk=class extends Bo{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,Se.OK)(e.data)}};_e.ZodAny=Xk;Xk.create=t=>new Xk({typeName:Ln.ZodAny,...qo(t)});var uj=class extends Bo{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,Se.OK)(e.data)}};_e.ZodUnknown=uj;uj.create=t=>new uj({typeName:Ln.ZodUnknown,...qo(t)});var WC=class extends Bo{_parse(e){let r=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(r,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.never,received:r.parsedType}),Se.INVALID}};_e.ZodNever=WC;WC.create=t=>new WC({typeName:Ln.ZodNever,...qo(t)});var JG=class extends Bo{_parse(e){if(this._getType(e)!==At.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.void,received:n.parsedType}),Se.INVALID}return(0,Se.OK)(e.data)}};_e.ZodVoid=JG;JG.create=t=>new JG({typeName:Ln.ZodVoid,...qo(t)});var lj=class t extends Bo{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==At.ZodParsedType.array)return(0,Se.addIssueToContext)(r,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.array,received:r.parsedType}),Se.INVALID;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&((0,Se.addIssueToContext)(r,{code:a?yt.ZodIssueCode.too_big:yt.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,Se.addIssueToContext)(r,{code:yt.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,Se.addIssueToContext)(r,{code:yt.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 BS(r,a,r.path,s)))).then(a=>Se.ParseStatus.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new BS(r,a,r.path,s)));return Se.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:$r.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:$r.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:$r.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};_e.ZodArray=lj;lj.create=(t,e)=>new lj({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ln.ZodArray,...qo(e)});function HG(t){if(t instanceof I_){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=qS.create(HG(n))}return new I_({...t._def,shape:()=>e})}else return t instanceof lj?new lj({...t._def,type:HG(t.element)}):t instanceof qS?qS.create(HG(t.unwrap())):t instanceof kA?kA.create(HG(t.unwrap())):t instanceof FA?FA.create(t.items.map(e=>HG(e))):t}var I_=class t extends Bo{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=At.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==At.ZodParsedType.object){let l=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(l,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.object,received:l.parsedType}),Se.INVALID}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof WC&&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 BS(o,d,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof WC){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,Se.addIssueToContext)(o,{code:yt.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 BS(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=>Se.ParseStatus.mergeObjectSync(n,l)):Se.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return $r.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:$r.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:Ln.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 At.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 At.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return HG(this)}partial(e){let r={};for(let n of At.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 At.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof qS;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return u_r(At.util.objectKeys(this.shape))}};_e.ZodObject=I_;I_.create=(t,e)=>new I_({shape:()=>t,unknownKeys:"strip",catchall:WC.create(),typeName:Ln.ZodObject,...qo(e)});I_.strictCreate=(t,e)=>new I_({shape:()=>t,unknownKeys:"strict",catchall:WC.create(),typeName:Ln.ZodObject,...qo(e)});I_.lazycreate=(t,e)=>new I_({shape:t,unknownKeys:"strip",catchall:WC.create(),typeName:Ln.ZodObject,...qo(e)});var YH=class extends Bo{_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 yt.ZodError(s.ctx.common.issues));return(0,Se.addIssueToContext)(r,{code:yt.ZodIssueCode.invalid_union,unionErrors:a}),Se.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 yt.ZodError(u));return(0,Se.addIssueToContext)(r,{code:yt.ZodIssueCode.invalid_union,unionErrors:s}),Se.INVALID}}get options(){return this._def.options}};_e.ZodUnion=YH;YH.create=(t,e)=>new YH({options:t,typeName:Ln.ZodUnion,...qo(e)});var sj=t=>t instanceof eV?sj(t.schema):t instanceof rw?sj(t.innerType()):t instanceof tV?[t.value]:t instanceof rV?t.options:t instanceof nV?At.util.objectValues(t.enum):t instanceof oV?sj(t._def.innerType):t instanceof ZH?[void 0]:t instanceof XH?[null]:t instanceof qS?[void 0,...sj(t.unwrap())]:t instanceof kA?[null,...sj(t.unwrap())]:t instanceof mae||t instanceof aV?sj(t.unwrap()):t instanceof iV?sj(t._def.innerType):[],oEe=class t extends Bo{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==At.ZodParsedType.object)return(0,Se.addIssueToContext)(r,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.object,received:r.parsedType}),Se.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,Se.addIssueToContext)(r,{code:yt.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Se.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=sj(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:Ln.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...qo(n)})}};_e.ZodDiscriminatedUnion=oEe;function $at(t,e){let r=(0,At.getParsedType)(t),n=(0,At.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===At.ZodParsedType.object&&n===At.ZodParsedType.object){let o=At.util.objectKeys(e),i=At.util.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=$at(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===At.ZodParsedType.array&&n===At.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=$at(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===At.ZodParsedType.date&&n===At.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var QH=class extends Bo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if((0,Se.isAborted)(i)||(0,Se.isAborted)(a))return Se.INVALID;let s=$at(i.value,a.value);return s.valid?(((0,Se.isDirty)(i)||(0,Se.isDirty)(a))&&r.dirty(),{status:r.value,value:s.data}):((0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.invalid_intersection_types}),Se.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}))}};_e.ZodIntersection=QH;QH.create=(t,e,r)=>new QH({left:t,right:e,typeName:Ln.ZodIntersection,...qo(r)});var FA=class t extends Bo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==At.ZodParsedType.array)return(0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.array,received:n.parsedType}),Se.INVALID;if(n.data.length<this._def.items.length)return(0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Se.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,Se.addIssueToContext)(n,{code:yt.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 BS(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Se.ParseStatus.mergeArray(r,a)):Se.ParseStatus.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};_e.ZodTuple=FA;FA.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new FA({items:t,typeName:Ln.ZodTuple,rest:null,...qo(e)})};var iEe=class t extends Bo{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!==At.ZodParsedType.object)return(0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.object,received:n.parsedType}),Se.INVALID;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new BS(n,s,n.path,s)),value:a._parse(new BS(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Se.ParseStatus.mergeObjectAsync(r,o):Se.ParseStatus.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Bo?new t({keyType:e,valueType:r,typeName:Ln.ZodRecord,...qo(n)}):new t({keyType:Zk.create(),valueType:e,typeName:Ln.ZodRecord,...qo(r)})}};_e.ZodRecord=iEe;var KG=class extends Bo{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!==At.ZodParsedType.map)return(0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.map,received:n.parsedType}),Se.INVALID;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new BS(n,s,n.path,[l,"key"])),value:i._parse(new BS(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 Se.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 Se.INVALID;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(l.value,c.value)}return{status:r.value,value:s}}}};_e.ZodMap=KG;KG.create=(t,e,r)=>new KG({valueType:e,keyType:t,typeName:Ln.ZodMap,...qo(r)});var WG=class t extends Bo{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==At.ZodParsedType.set)return(0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.set,received:n.parsedType}),Se.INVALID;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&((0,Se.addIssueToContext)(n,{code:yt.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,Se.addIssueToContext)(n,{code:yt.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 Se.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 BS(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:$r.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:$r.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};_e.ZodSet=WG;WG.create=(t,e)=>new WG({valueType:t,minSize:null,maxSize:null,typeName:Ln.ZodSet,...qo(e)});var aEe=class t extends Bo{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==At.ZodParsedType.function)return(0,Se.addIssueToContext)(r,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.function,received:r.parsedType}),Se.INVALID;function n(s,u){return(0,Se.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,nEe.getErrorMap)(),nEe.defaultErrorMap].filter(l=>!!l),issueData:{code:yt.ZodIssueCode.invalid_arguments,argumentsError:u}})}function o(s,u){return(0,Se.makeIssue)({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,nEe.getErrorMap)(),nEe.defaultErrorMap].filter(l=>!!l),issueData:{code:yt.ZodIssueCode.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Yk){let s=this;return(0,Se.OK)(async function(...u){let l=new yt.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,Se.OK)(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new yt.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 yt.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:FA.create(e).rest(uj.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||FA.create([]).rest(uj.create()),returns:r||uj.create(),typeName:Ln.ZodFunction,...qo(n)})}};_e.ZodFunction=aEe;var eV=class extends Bo{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})}};_e.ZodLazy=eV;eV.create=(t,e)=>new eV({getter:t,typeName:Ln.ZodLazy,...qo(e)});var tV=class extends Bo{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(r,{received:r.data,code:yt.ZodIssueCode.invalid_literal,expected:this._def.value}),Se.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};_e.ZodLiteral=tV;tV.create=(t,e)=>new tV({value:t,typeName:Ln.ZodLiteral,...qo(e)});function u_r(t,e){return new rV({values:t,typeName:Ln.ZodEnum,...qo(e)})}var rV=class t extends Bo{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,Se.addIssueToContext)(r,{expected:At.util.joinValues(n),received:r.parsedType,code:yt.ZodIssueCode.invalid_type}),Se.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,Se.addIssueToContext)(r,{received:r.data,code:yt.ZodIssueCode.invalid_enum_value,options:n}),Se.INVALID}return(0,Se.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})}};_e.ZodEnum=rV;rV.create=u_r;var nV=class extends Bo{_parse(e){let r=At.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==At.ZodParsedType.string&&n.parsedType!==At.ZodParsedType.number){let o=At.util.objectValues(r);return(0,Se.addIssueToContext)(n,{expected:At.util.joinValues(o),received:n.parsedType,code:yt.ZodIssueCode.invalid_type}),Se.INVALID}if(this._cache||(this._cache=new Set(At.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=At.util.objectValues(r);return(0,Se.addIssueToContext)(n,{received:n.data,code:yt.ZodIssueCode.invalid_enum_value,options:o}),Se.INVALID}return(0,Se.OK)(e.data)}get enum(){return this._def.values}};_e.ZodNativeEnum=nV;nV.create=(t,e)=>new nV({values:t,typeName:Ln.ZodNativeEnum,...qo(e)});var Yk=class extends Bo{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==At.ZodParsedType.promise&&r.common.async===!1)return(0,Se.addIssueToContext)(r,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.promise,received:r.parsedType}),Se.INVALID;let n=r.parsedType===At.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,Se.OK)(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};_e.ZodPromise=Yk;Yk.create=(t,e)=>new Yk({type:t,typeName:Ln.ZodPromise,...qo(e)});var rw=class extends Bo{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ln.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,Se.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 Se.INVALID;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?Se.INVALID:u.status==="dirty"||r.value==="dirty"?(0,Se.DIRTY)(u.value):u});{if(r.value==="aborted")return Se.INVALID;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Se.INVALID:s.status==="dirty"||r.value==="dirty"?(0,Se.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"?Se.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"?Se.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,Se.isValid)(a))return Se.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,Se.isValid)(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):Se.INVALID);At.util.assertNever(o)}};_e.ZodEffects=rw;_e.ZodTransformer=rw;rw.create=(t,e,r)=>new rw({schema:t,typeName:Ln.ZodEffects,effect:e,...qo(r)});rw.createWithPreprocess=(t,e,r)=>new rw({schema:e,effect:{type:"preprocess",transform:t},typeName:Ln.ZodEffects,...qo(r)});var qS=class extends Bo{_parse(e){return this._getType(e)===At.ZodParsedType.undefined?(0,Se.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_e.ZodOptional=qS;qS.create=(t,e)=>new qS({innerType:t,typeName:Ln.ZodOptional,...qo(e)});var kA=class extends Bo{_parse(e){return this._getType(e)===At.ZodParsedType.null?(0,Se.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_e.ZodNullable=kA;kA.create=(t,e)=>new kA({innerType:t,typeName:Ln.ZodNullable,...qo(e)});var oV=class extends Bo{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===At.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};_e.ZodDefault=oV;oV.create=(t,e)=>new oV({innerType:t,typeName:Ln.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...qo(e)});var iV=class extends Bo{_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,Se.isAsync)(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new yt.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new yt.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};_e.ZodCatch=iV;iV.create=(t,e)=>new iV({innerType:t,typeName:Ln.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...qo(e)});var GG=class extends Bo{_parse(e){if(this._getType(e)!==At.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,Se.addIssueToContext)(n,{code:yt.ZodIssueCode.invalid_type,expected:At.ZodParsedType.nan,received:n.parsedType}),Se.INVALID}return{status:"valid",value:e.data}}};_e.ZodNaN=GG;GG.create=t=>new GG({typeName:Ln.ZodNaN,...qo(t)});_e.BRAND=Symbol("zod_brand");var mae=class extends Bo{_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}};_e.ZodBranded=mae;var hae=class t extends Bo{_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"?Se.INVALID:i.status==="dirty"?(r.dirty(),(0,Se.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"?Se.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:Ln.ZodPipeline})}};_e.ZodPipeline=hae;var aV=class extends Bo{_parse(e){let r=this._def.innerType._parse(e),n=o=>((0,Se.isValid)(o)&&(o.value=Object.freeze(o.value)),o);return(0,Se.isAsync)(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};_e.ZodReadonly=aV;aV.create=(t,e)=>new aV({innerType:t,typeName:Ln.ZodReadonly,...qo(e)});function o_r(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function l_r(t,e={},r){return t?Xk.create().superRefine((n,o)=>{let i=t(n);if(i instanceof Promise)return i.then(a=>{if(!a){let s=o_r(e,n),u=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:u})}});if(!i){let a=o_r(e,n),s=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:s})}}):Xk.create()}_e.late={object:I_.lazycreate};var Ln;(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"})(Ln||(_e.ZodFirstPartyTypeKind=Ln={}));var Dlo=(t,e={message:`Input not instance of ${t.name}`})=>l_r(r=>r instanceof t,e);_e.instanceof=Dlo;var c_r=Zk.create;_e.string=c_r;var d_r=JH.create;_e.number=d_r;var $lo=GG.create;_e.nan=$lo;var Llo=KH.create;_e.bigint=Llo;var f_r=WH.create;_e.boolean=f_r;var Flo=GH.create;_e.date=Flo;var klo=VG.create;_e.symbol=klo;var qlo=ZH.create;_e.undefined=qlo;var Blo=XH.create;_e.null=Blo;var Ulo=Xk.create;_e.any=Ulo;var zlo=uj.create;_e.unknown=zlo;var Hlo=WC.create;_e.never=Hlo;var Vlo=JG.create;_e.void=Vlo;var Jlo=lj.create;_e.array=Jlo;var Klo=I_.create;_e.object=Klo;var Wlo=I_.strictCreate;_e.strictObject=Wlo;var Glo=YH.create;_e.union=Glo;var Zlo=oEe.create;_e.discriminatedUnion=Zlo;var Xlo=QH.create;_e.intersection=Xlo;var Ylo=FA.create;_e.tuple=Ylo;var Qlo=iEe.create;_e.record=Qlo;var eco=KG.create;_e.map=eco;var tco=WG.create;_e.set=tco;var rco=aEe.create;_e.function=rco;var nco=eV.create;_e.lazy=nco;var oco=tV.create;_e.literal=oco;var ico=rV.create;_e.enum=ico;var aco=nV.create;_e.nativeEnum=aco;var sco=Yk.create;_e.promise=sco;var p_r=rw.create;_e.effect=p_r;_e.transformer=p_r;var uco=qS.create;_e.optional=uco;var lco=kA.create;_e.nullable=lco;var cco=rw.createWithPreprocess;_e.preprocess=cco;var dco=hae.create;_e.pipeline=dco;var fco=()=>c_r().optional();_e.ostring=fco;var pco=()=>d_r().optional();_e.onumber=pco;var mco=()=>f_r().optional();_e.oboolean=mco;_e.coerce={string:t=>Zk.create({...t,coerce:!0}),number:t=>JH.create({...t,coerce:!0}),boolean:t=>WH.create({...t,coerce:!0}),bigint:t=>KH.create({...t,coerce:!0}),date:t=>GH.create({...t,coerce:!0})};_e.NEVER=Se.INVALID});var Lat=S(US=>{"use strict";var hco=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]}),ZG=US&&US.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hco(e,t,r)};Object.defineProperty(US,"__esModule",{value:!0});ZG(tEe(),US);ZG(jat(),US);ZG(e_r(),US);ZG(fae(),US);ZG(m_r(),US);ZG(eEe(),US)});var te=S(N_=>{"use strict";var h_r=N_&&N_.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gco=N_&&N_.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yco=N_&&N_.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&h_r(e,t,r);return gco(e,t),e},bco=N_&&N_.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&h_r(e,t,r)};Object.defineProperty(N_,"__esModule",{value:!0});N_.z=void 0;var g_r=yco(Lat());N_.z=g_r;bco(Lat(),N_);N_.default=g_r});var qat=S(Sh=>{"use strict";var _co=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]}),vco=Sh&&Sh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wco=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"&&_co(r,e,n[o]);return vco(r,e),r}}();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.zodInbound=Sh.zodOutbound=void 0;Sh.bytesToBase64=y_r;Sh.bytesFromBase64=Fat;Sh.stringToBytes=kat;Sh.stringFromBytes=b_r;Sh.stringToBase64=Sco;Sh.stringFromBase64=Cco;var sEe=wco(te());function y_r(t){return btoa(String.fromCodePoint(...t))}function Fat(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function kat(t){return new TextEncoder().encode(t)}function b_r(t){return new TextDecoder().decode(t)}function Sco(t){return y_r(kat(t))}function Cco(t){return b_r(Fat(t))}Sh.zodOutbound=sEe.instanceof(Uint8Array).or(sEe.string().transform(kat));Sh.zodInbound=sEe.instanceof(Uint8Array).or(sEe.string().transform(Fat))});var Uat=S(Bat=>{"use strict";Object.defineProperty(Bat,"__esModule",{value:!0});Bat.isPlainObject=xco;function xco(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 fr=S(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.encodeDeepObjectQuery=Xi.encodePipeDelimitedQuery=Xi.encodeSpaceDelimitedQuery=Xi.encodeFormQuery=Xi.encodeJSONQuery=Xi.encodeSimple=Xi.encodePipeDelimited=Xi.encodeSpaceDelimited=Xi.encodeForm=Xi.EncodingError=void 0;Xi.encodeMatrix=Oco;Xi.encodeLabel=Tco;Xi.encodeBodyForm=Eco;Xi.encodeDeepObject=v_r;Xi.encodeDeepObjectObject=Hat;Xi.encodeJSON=w_r;Xi.queryJoin=S_r;Xi.queryEncoder=YG;Xi.appendForm=Mco;var __r=qat(),GC=Uat(),gae=class extends Error{constructor(e){super(e),this.name="EncodingError"}};Xi.EncodingError=gae;function Oco(t,e,r){let n="",o=r?.explode?yae(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(XG(s));return o.forEach(([s,u])=>{let l="",c=null;if(u==null||(Array.isArray(u)?c=bae(u,f=>`${a(f)}`)?.join(","):(0,GC.isPlainObject)(u)?c=lEe(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 Tco(t,e,r){let n="",o=r?.explode?yae(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(XG(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=bae(u,c=>`${a(c)}`)?.join("."):(0,GC.isPlainObject)(u)?l=lEe(Object.entries(u),([d,f])=>`.${i(d)}.${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,GC.isPlainObject)(e)?`${i(s)}=`:""}${a(u)}`,n+=l==null?"":`.${l}`)}),n}function zat(t){return(e,r,n)=>{let o="",i=n?.explode?yae(e,r):[[e,r]];if(i.every(([l,c])=>c==null))return;let a=l=>n?.charEncoding==="percent"?encodeURIComponent(l):l,s=l=>a(XG(l)),u=a(t);return i.forEach(([l,c])=>{let d="",f=null;c!=null&&(Array.isArray(c)?f=bae(c,p=>`${s(p)}`)?.join(u):(0,GC.isPlainObject)(c)?f=lEe(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)}}Xi.encodeForm=zat(",");Xi.encodeSpaceDelimited=zat(" ");Xi.encodePipeDelimited=zat("|");function Eco(t,e,r){let n="",o=r?.explode?yae(t,e):[[t,e]],i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(XG(s));return o.forEach(([s,u])=>{let l="",c="";u!=null&&(Array.isArray(u)||(0,GC.isPlainObject)(u)?c=JSON.stringify(u,uEe):c=`${a(u)}`,l=`${i(s)}=${c}`,!(!l||l==="=")&&(n+=`&${l}`))}),n.slice(1)}function v_r(t,e,r){if(e!=null){if(!(0,GC.isPlainObject)(e))throw new gae(`Value of parameter '${t}' which uses deepObject encoding must be an object or null`);return Hat(t,e,r)}}function Hat(t,e,r){if(e==null)return;let n="",o=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i;if(!(0,GC.isPlainObject)(e))throw new gae(`Expected parameter '${t}' to be an object.`);return Object.entries(e).forEach(([i,a])=>{if(a==null)return;let s=`${t}[${i}]`;if((0,GC.isPlainObject)(a)){let c=Hat(s,a,r);n+=c==null?"":`&${c}`;return}let u=Array.isArray(a)?a:[a],l=bae(u,c=>`${o(s)}=${o(XG(c))}`)?.join("&");n+=l==null?"":`&${l}`}),n.slice(1)}function w_r(t,e,r){if(typeof e>"u")return;let n=i=>r?.charEncoding==="percent"?encodeURIComponent(i):i,o=n(JSON.stringify(e,uEe));return r?.explode?o:`${n(t)}=${o}`}var Pco=(t,e,r)=>{let n="",o=r?.explode?yae(t,e):[[t,e]];if(o.every(([s,u])=>u==null))return;let i=s=>r?.charEncoding==="percent"?encodeURIComponent(s):s,a=s=>i(XG(s));return o.forEach(([s,u])=>{let l="";u!=null&&(Array.isArray(u)?l=bae(u,c=>`${a(c)}`)?.join(","):(0,GC.isPlainObject)(u)?l=lEe(Object.entries(u),([d,f])=>`,${i(d)},${a(f)}`)?.join("").slice(1):l=`${r?.explode&&(0,GC.isPlainObject)(e)?`${s}=`:""}${a(u)}`,n+=l?`,${l}`:"")}),n.slice(1)};Xi.encodeSimple=Pco;function yae(t,e){return Array.isArray(e)?e.map(r=>[t,r]):(0,GC.isPlainObject)(e)?Object.entries(e??{}).map(([n,o])=>[n,o]):[[t,e]]}function XG(t){return t==null?"":t instanceof Date?t.toISOString():t instanceof Uint8Array?(0,__r.bytesToBase64)(t):typeof t=="object"?JSON.stringify(t,uEe):`${t}`}function uEe(t,e){return e instanceof Uint8Array?(0,__r.bytesToBase64)(e):e}function bae(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 lEe(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 S_r(...t){return t.filter(Boolean).join("&")}function YG(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 S_r(...i)}}Xi.encodeJSONQuery=YG(w_r);Xi.encodeFormQuery=YG(Xi.encodeForm);Xi.encodeSpaceDelimitedQuery=YG(Xi.encodeSpaceDelimited);Xi.encodePipeDelimitedQuery=YG(Xi.encodePipeDelimited);Xi.encodeDeepObjectQuery=YG(v_r);function Mco(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 C_r=S(Vat=>{"use strict";Object.defineProperty(Vat,"__esModule",{value:!0});Vat.dlv=Rco;function Rco(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 Kat=S(nw=>{"use strict";var Aco=nw&&nw.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ico=nw&&nw.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nco=nw&&nw.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Aco(r,e,n[o]);return Ico(r,e),r}}();Object.defineProperty(nw,"__esModule",{value:!0});nw.envSchema=void 0;nw.env=jco;nw.resetEnv=Dco;var x_r=C_r(),Jat=Nco(te());nw.envSchema=Jat.object({MISTRAL_API_KEY:Jat.string().optional(),MISTRAL_DEBUG:Jat.coerce.boolean().optional()});var _ae;function jco(){return _ae||(_ae=nw.envSchema.parse((0,x_r.dlv)(globalThis,"process.env")??(0,x_r.dlv)(globalThis,"Deno.env")??{}),_ae)}function Dco(){_ae=void 0}});var T_r=S(uV=>{"use strict";Object.defineProperty(uV,"__esModule",{value:!0});uV.TemporaryError=uV.PermanentError=void 0;uV.retry=Lco;var O_r=UG(),$co={initialInterval:500,maxInterval:6e4,exponent:1.5,maxElapsedTime:36e5},vae=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)}};uV.PermanentError=vae;var sV=class t extends Error{constructor(e,r){super(e),this.response=r,this.name="TemporaryError",Object.setPrototypeOf(this,t.prototype)}};uV.TemporaryError=sV;async function Lco(t,e){switch(e.config.strategy){case"backoff":return Bco(Fco(t,{statusCodes:e.statusCodes,retryConnectionErrors:!!e.config.retryConnectionErrors}),e.config.backoff??$co);default:return await t()}}function Fco(t,e){return async()=>{try{let r=await t();if(qco(r,e.statusCodes))throw new sV("Response failed with retryable status code",r);return r}catch(r){throw r instanceof sV||e.retryConnectionErrors&&((0,O_r.isTimeoutError)(r)||(0,O_r.isConnectionError)(r))?r:new vae("Permanent error",{cause:r})}}}var kco=new RegExp("^[0-9]xx$","i");function qco(t,e){let r=`${t.status}`;return e.some(n=>{if(!kco.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 Bco(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 vae)throw u.cause;if(Date.now()-a>r){if(u instanceof sV)return u.response;throw u}let c=0;u instanceof sV&&(c=Uco(u.response)),c<=0&&(c=n*Math.pow(s,o)+Math.random()*1e3);let d=Math.min(c,i);await zco(d),s++}}function Uco(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 zco(t){return new Promise(e=>setTimeout(e,t))}});var jc=S(eq=>{"use strict";var wae=eq&&eq.__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},zS=eq&&eq.__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)},dEe,qA,cj;Object.defineProperty(eq,"__esModule",{value:!0});eq.ClientSDK=void 0;var E_r=Kbr(),QG=Mat(),Qk=xd(),Hco=qat(),P_r=GTe(),Vco=fr(),Jco=Kat(),BA=UG(),Kco=T_r(),cEe=typeof globalThis>"u"?null:globalThis,Wco=typeof cEe=="object"&&cEe!=null&&"importScripts"in cEe&&typeof cEe.importScripts=="function",Gco=Wco||typeof navigator<"u"&&"serviceWorker"in navigator||typeof window=="object"&&typeof window.document<"u",Wat=class{constructor(e={}){dEe.set(this,void 0),qA.set(this,void 0),cj.set(this,void 0);let r=e;typeof r=="object"&&r!=null&&"hooks"in r&&r.hooks instanceof E_r.SDKHooks?wae(this,qA,r.hooks,"f"):wae(this,qA,new E_r.SDKHooks,"f");let n=(0,P_r.serverURLFromOptions)(e);n&&(n.pathname=n.pathname.replace(/\/+$/,"")+"/");let{baseURL:o,client:i}=zS(this,qA,"f").sdkInit({baseURL:n,client:e.httpClient||new BA.HTTPClient});this._baseURL=o,wae(this,dEe,i,"f"),this._options={...e,hooks:zS(this,qA,"f")},wae(this,cj,this._options.debugLogger,"f"),!zS(this,cj,"f")&&(0,Jco.env)().MISTRAL_DEBUG&&wae(this,cj,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 QG.InvalidRequestError("No base URL provided for operation"));let c=new URL(l),d=new URL(i,c);i&&(c.pathname+=c.pathname.endsWith("/")?"":"/",c.pathname+=d.pathname.replace(/^\/+/,""));let f=a||"",p=[];for(let[O,E]of Object.entries(u?.queryParams||{})){let T=(0,Vco.encodeForm)(O,E,{charEncoding:"percent"});typeof T<"u"&&p.push(T)}if(p.length&&(f+=`&${p.join("&")}`),f){let O=f.startsWith("&")?f.slice(1):f;c.search=`?${O}`}let m=new Headers(s),h=u?.basic.username,g=u?.basic.password;if(h!=null||g!=null){let O=(0,Hco.stringToBase64)([h||"",g||""].join(":"));m.set("Authorization",`Basic ${O}`)}let y=new Headers(u?.headers||{});for(let[O,E]of y)m.set(O,E);let b=m.get("cookie")||"";for(let[O,E]of Object.entries(u?.cookies||{}))b+=`; ${O}=${E}`;b=b.startsWith("; ")?b.slice(2):b,m.set("cookie",b);let _=new Headers(n?.headers??n?.fetchOptions?.headers);for(let[O,E]of _)m.set(O,E);Gco||m.set(r.uaHeader??"user-agent",r.userAgent??P_r.SDK_METADATA.userAgent);let w={...n?.fetchOptions,...n};if(!w?.signal&&r.timeoutMs&&r.timeoutMs>0){let O=AbortSignal.timeout(r.timeoutMs);w.signal=O}r.body instanceof ReadableStream&&Object.assign(w,{duplex:"half"});let x;try{x=zS(this,qA,"f").beforeCreateRequest(e,{url:c,options:{...w,body:r.body??null,headers:m,method:o}})}catch(O){return(0,Qk.ERR)(new QG.UnexpectedClientError("Create request hook failed to execute",{cause:O}))}return(0,Qk.OK)(new Request(x.url,x.options))}async _do(e,r){let{context:n,errorCodes:o}=r;return(0,Kco.retry)(async()=>{let i=await zS(this,qA,"f").beforeRequest(n,e.clone());await Zco(zS(this,cj,"f"),i).catch(s=>zS(this,cj,"f")?.log("Failed to log request:",s));let a=await zS(this,dEe,"f").request(i);try{if((0,BA.matchStatusCode)(a,o)){let s=await zS(this,qA,"f").afterError(n,a,null);if(s.error)throw s.error;a=s.response||a}else a=await zS(this,qA,"f").afterSuccess(n,a)}finally{await Xco(zS(this,cj,"f"),a,i).catch(s=>zS(this,cj,"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,BA.isAbortError)(i):return(0,Qk.ERR)(new QG.RequestAbortedError("Request aborted by client",{cause:i}));case(0,BA.isTimeoutError)(i):return(0,Qk.ERR)(new QG.RequestTimeoutError("Request timed out",{cause:i}));case(0,BA.isConnectionError)(i):return(0,Qk.ERR)(new QG.ConnectionError("Unable to make request",{cause:i}));default:return(0,Qk.ERR)(new QG.UnexpectedClientError("Unexpected HTTP client error",{cause:i}))}})}};eq.ClientSDK=Wat;dEe=new WeakMap,qA=new WeakMap,cj=new WeakMap;var R_r=/(application|text)\/.*?\+*json.*/,M_r=/(application|text)\/(.*?\+*\bjsonl\b.*|.*?\+*\bx-ndjson\b.*)/;async function Zco(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 R_r.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 Xco(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,BA.matchContentType)(e,"application/json")||R_r.test(o)&&!M_r.test(o)):t.log(await e.clone().json());break;case((0,BA.matchContentType)(e,"application/jsonl")||M_r.test(o)):t.log(await e.clone().text());break;case(0,BA.matchContentType)(e,"text/event-stream"):t.log(`<${n}>`);break;case(0,BA.matchContentType)(e,"text/*"):t.log(await e.clone().text());break;case(0,BA.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 pEe=S(fEe=>{"use strict";Object.defineProperty(fEe,"__esModule",{value:!0});fEe.MistralError=void 0;var Gat=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"}};fEe.MistralError=Gat});var mEe=S(ZC=>{"use strict";var Yco=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]}),Qco=ZC&&ZC.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),edo=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"&&Yco(r,e,n[o]);return Qco(r,e),r}}();Object.defineProperty(ZC,"__esModule",{value:!0});ZC.SDKValidationError=void 0;ZC.formatZodError=Xat;var tdo=edo(te()),Zat=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 tdo.ZodError?`${this.rawMessage}
|
||
${Xat(this.cause)}`:this.toString()}};ZC.SDKValidationError=Zat;function Xat(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(`${Xat(c,e+1)}`)})}}}return t.issues.length&&o("\u2514\u2500*"),n.slice(1)}});var Qat=S(UA=>{"use strict";var rdo=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]}),ndo=UA&&UA.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),odo=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"&&rdo(r,e,n[o]);return ndo(r,e),r}}();Object.defineProperty(UA,"__esModule",{value:!0});UA.ResponseValidationError=void 0;var ido=odo(te()),ado=pEe(),sdo=mEe(),Yat=class extends ado.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 ido.ZodError?`${this.rawMessage}
|
||
${(0,sdo.formatZodError)(this.cause)}`:this.toString()}};UA.ResponseValidationError=Yat});var tst=S(hEe=>{"use strict";Object.defineProperty(hEe,"__esModule",{value:!0});hEe.SDKError=void 0;var udo=pEe(),est=class extends udo.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"}};hEe.SDKError=est});var ar=S(Lm=>{"use strict";Object.defineProperty(Lm,"__esModule",{value:!0});Lm.jsonErr=ddo;Lm.json=fdo;Lm.jsonl=pdo;Lm.jsonlErr=mdo;Lm.textErr=hdo;Lm.text=gdo;Lm.bytesErr=ydo;Lm.bytes=bdo;Lm.streamErr=_do;Lm.stream=vdo;Lm.sseErr=wdo;Lm.sse=Sdo;Lm.nilErr=Cdo;Lm.nil=xdo;Lm.fail=Odo;Lm.match=Tdo;Lm.unpackHeaders=gEe;var ldo=Qat(),A_r=tst(),I_r=xd(),N_r=UG(),j_r=Uat(),cdo={jsonl:"application/jsonl",json:"application/json",text:"text/plain",bytes:"application/octet-stream",stream:"application/octet-stream",sse:"text/event-stream",nil:"*",fail:"*"};function ddo(t,e,r){return{...r,err:!0,enc:"json",codes:t,schema:e}}function fdo(t,e,r){return{...r,enc:"json",codes:t,schema:e}}function pdo(t,e,r){return{...r,enc:"jsonl",codes:t,schema:e}}function mdo(t,e,r){return{...r,err:!0,enc:"jsonl",codes:t,schema:e}}function hdo(t,e,r){return{...r,err:!0,enc:"text",codes:t,schema:e}}function gdo(t,e,r){return{...r,enc:"text",codes:t,schema:e}}function ydo(t,e,r){return{...r,err:!0,enc:"bytes",codes:t,schema:e}}function bdo(t,e,r){return{...r,enc:"bytes",codes:t,schema:e}}function _do(t,e,r){return{...r,err:!0,enc:"stream",codes:t,schema:e}}function vdo(t,e,r){return{...r,enc:"stream",codes:t,schema:e}}function wdo(t,e,r){return{...r,err:!0,enc:"sse",codes:t,schema:e}}function Sdo(t,e,r){return{...r,enc:"sse",codes:t,schema:e}}function Cdo(t,e,r){return{...r,err:!0,enc:"nil",codes:t,schema:e}}function xdo(t,e,r){return{...r,enc:"nil",codes:t,schema:e}}function Odo(t){return{enc:"fail",codes:t}}function Tdo(...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:cdo[d.enc];if(p&&(0,N_r.matchResponse)(r,f,p)){a=d;break}else if(!p&&(0,N_r.matchStatusCode)(r,f)){a=d;break}}if(!a)return[{ok:!1,error:new A_r.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 A_r.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:gEe(r.headers)}:null,...(0,j_r.isPlainObject)(i)?i:null,request$:n,response$:r,body$:u}:l?c={...o?.extraFields,...a.hdrs?{Headers:gEe(r.headers)}:null,[l]:i}:a.hdrs?c={...o?.extraFields,...a.hdrs?{Headers:gEe(r.headers)}:null,...(0,j_r.isPlainObject)(i)?i:null}:c=i,"err"in a){let d=D_r(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[D_r(c,d=>a.schema.parse(d),"Response validation failed",{request:n,response:r,body:u}),i]}}var Edo=/, */;function gEe(t){let e={};for(let[r,n]of t.entries())e[r]=n.split(Edo);return e}function D_r(t,e,r,n){try{return(0,I_r.OK)(e(t))}catch(o){return(0,I_r.ERR)(new ldo.ResponseValidationError(r,{cause:o,rawValue:t,rawMessage:r,...n}))}}});var ae=S(tq=>{"use strict";Object.defineProperty(tq,"__esModule",{value:!0});tq.invariant=Pdo;tq.remap=Mdo;tq.combineSignals=Rdo;tq.abortSignalAny=$_r;tq.compactMap=Ado;tq.allRequired=Ido;var rst=class extends Error{constructor(e){super(e),this.name="InvariantError"}};function Pdo(t,e){if(!t)throw new rst(e)}function Mdo(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 Rdo(...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):$_r(e)}}function $_r(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 Ado(t){let e={};for(let[r,n]of Object.entries(t))typeof n<"u"&&(e[r]=n);return e}function Ido(t){if(!Object.values(t).every(e=>e==null))return t}});var ee=S(Sae=>{"use strict";Object.defineProperty(Sae,"__esModule",{value:!0});Sae.parse=jdo;Sae.safeParse=Ddo;Sae.collectExtraKeys=$do;var Ndo=te(),F_r=mEe(),L_r=xd();function jdo(t,e,r){try{return e(t)}catch(n){throw n instanceof Ndo.ZodError?new F_r.SDKValidationError(r,n,t):n}}function Ddo(t,e,r){try{return(0,L_r.OK)(e(t))}catch(n){return(0,L_r.ERR)(new F_r.SDKValidationError(r,n,t))}}function $do(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 sr=S(dj=>{"use strict";Object.defineProperty(dj,"__esModule",{value:!0});dj.SecurityError=dj.SecurityErrorCode=void 0;dj.resolveSecurity=k_r;dj.resolveGlobalSecurity=kdo;dj.extractSecurity=qdo;var Ldo=Kat(),bEe;(function(t){t.Incomplete="incomplete",t.UnrecognisedSecurityType="unrecognized_security_type"})(bEe||(dj.SecurityErrorCode=bEe={}));var _Ee=class t extends Error{constructor(e,r){super(r),this.code=e,this.name="SecurityError"}static incomplete(){return new t(bEe.Incomplete,"Security requirements not met in order to perform the operation")}static unrecognizedType(e){return new t(bEe.UnrecognisedSecurityType,`Unrecognised security type: ${e}`)}};dj.SecurityError=_Ee;function k_r(...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":Fdo(e,n);break;case"http:custom":break;case"http:bearer":yEe(e,n);break;case"oauth2":yEe(e,n);break;case"oauth2:password":yEe(e,n);break;case"oauth2:client_credentials":break;case"openIdConnect":yEe(e,n);break;default:throw _Ee.unrecognizedType(o)}}),e)}function Fdo(t,e){e.value!=null&&(t.basic=e.value)}function yEe(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 kdo(t){return k_r([{fieldName:"Authorization",type:"http:bearer",value:t?.apiKey??(0,Ldo.env)().MISTRAL_API_KEY}])}async function qdo(t){if(t!=null)return typeof t=="function"?t():t}});var rq=S(Yi=>{"use strict";var Bdo=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]}),Udo=Yi&&Yi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zdo=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"&&Bdo(r,e,n[o]);return Udo(r,e),r}}();Object.defineProperty(Yi,"__esModule",{value:!0});Yi.CodeInterpreterTool$=Yi.CodeInterpreterTool$outboundSchema=Yi.CodeInterpreterTool$inboundSchema=Yi.CodeInterpreterToolType$=Yi.CodeInterpreterToolType$outboundSchema=Yi.CodeInterpreterToolType$inboundSchema=Yi.CodeInterpreterToolType=void 0;Yi.codeInterpreterToolToJSON=Vdo;Yi.codeInterpreterToolFromJSON=Jdo;var nst=zdo(te()),Hdo=ee();Yi.CodeInterpreterToolType={CodeInterpreter:"code_interpreter"};Yi.CodeInterpreterToolType$inboundSchema=nst.nativeEnum(Yi.CodeInterpreterToolType);Yi.CodeInterpreterToolType$outboundSchema=Yi.CodeInterpreterToolType$inboundSchema;var q_r;(function(t){t.inboundSchema=Yi.CodeInterpreterToolType$inboundSchema,t.outboundSchema=Yi.CodeInterpreterToolType$outboundSchema})(q_r||(Yi.CodeInterpreterToolType$=q_r={}));Yi.CodeInterpreterTool$inboundSchema=nst.object({type:Yi.CodeInterpreterToolType$inboundSchema.default("code_interpreter")});Yi.CodeInterpreterTool$outboundSchema=nst.object({type:Yi.CodeInterpreterToolType$outboundSchema.default("code_interpreter")});var B_r;(function(t){t.inboundSchema=Yi.CodeInterpreterTool$inboundSchema,t.outboundSchema=Yi.CodeInterpreterTool$outboundSchema})(B_r||(Yi.CodeInterpreterTool$=B_r={}));function Vdo(t){return JSON.stringify(Yi.CodeInterpreterTool$outboundSchema.parse(t))}function Jdo(t){return(0,Hdo.safeParse)(t,e=>Yi.CodeInterpreterTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CodeInterpreterTool' from JSON")}});var ost=S(Od=>{"use strict";var Kdo=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]}),Wdo=Od&&Od.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gdo=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"&&Kdo(r,e,n[o]);return Wdo(r,e),r}}();Object.defineProperty(Od,"__esModule",{value:!0});Od.CompletionArgsStop$=Od.CompletionArgsStop$outboundSchema=Od.CompletionArgsStop$inboundSchema=void 0;Od.completionArgsStopToJSON=Xdo;Od.completionArgsStopFromJSON=Ydo;var nq=Gdo(te()),Zdo=ee();Od.CompletionArgsStop$inboundSchema=nq.union([nq.string(),nq.array(nq.string())]);Od.CompletionArgsStop$outboundSchema=nq.union([nq.string(),nq.array(nq.string())]);var U_r;(function(t){t.inboundSchema=Od.CompletionArgsStop$inboundSchema,t.outboundSchema=Od.CompletionArgsStop$outboundSchema})(U_r||(Od.CompletionArgsStop$=U_r={}));function Xdo(t){return JSON.stringify(Od.CompletionArgsStop$outboundSchema.parse(t))}function Ydo(t){return(0,Zdo.safeParse)(t,e=>Od.CompletionArgsStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionArgsStop' from JSON")}});var lV=S(Td=>{"use strict";var Qdo=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]}),efo=Td&&Td.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tfo=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"&&Qdo(r,e,n[o]);return efo(r,e),r}}();Object.defineProperty(Td,"__esModule",{value:!0});Td.Prediction$=Td.Prediction$outboundSchema=Td.Prediction$inboundSchema=void 0;Td.predictionToJSON=nfo;Td.predictionFromJSON=ofo;var e9=tfo(te()),rfo=ee();Td.Prediction$inboundSchema=e9.object({type:e9.literal("content").default("content"),content:e9.string().default("")});Td.Prediction$outboundSchema=e9.object({type:e9.literal("content").default("content"),content:e9.string().default("")});var z_r;(function(t){t.inboundSchema=Td.Prediction$inboundSchema,t.outboundSchema=Td.Prediction$outboundSchema})(z_r||(Td.Prediction$=z_r={}));function nfo(t){return JSON.stringify(Td.Prediction$outboundSchema.parse(t))}function ofo(t){return(0,rfo.safeParse)(t,e=>Td.Prediction$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Prediction' from JSON")}});var ist=S(Ed=>{"use strict";var ifo=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]}),afo=Ed&&Ed.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sfo=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"&&ifo(r,e,n[o]);return afo(r,e),r}}();Object.defineProperty(Ed,"__esModule",{value:!0});Ed.JsonSchema$=Ed.JsonSchema$outboundSchema=Ed.JsonSchema$inboundSchema=void 0;Ed.jsonSchemaToJSON=lfo;Ed.jsonSchemaFromJSON=cfo;var j_=sfo(te()),V_r=ae(),ufo=ee();Ed.JsonSchema$inboundSchema=j_.object({name:j_.string(),description:j_.nullable(j_.string()).optional(),schema:j_.record(j_.any()),strict:j_.boolean().optional()}).transform(t=>(0,V_r.remap)(t,{schema:"schemaDefinition"}));Ed.JsonSchema$outboundSchema=j_.object({name:j_.string(),description:j_.nullable(j_.string()).optional(),schemaDefinition:j_.record(j_.any()),strict:j_.boolean().optional()}).transform(t=>(0,V_r.remap)(t,{schemaDefinition:"schema"}));var H_r;(function(t){t.inboundSchema=Ed.JsonSchema$inboundSchema,t.outboundSchema=Ed.JsonSchema$outboundSchema})(H_r||(Ed.JsonSchema$=H_r={}));function lfo(t){return JSON.stringify(Ed.JsonSchema$outboundSchema.parse(t))}function cfo(t){return(0,ufo.safeParse)(t,e=>Ed.JsonSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JsonSchema' from JSON")}});var ast=S(Pd=>{"use strict";var dfo=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]}),ffo=Pd&&Pd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pfo=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"&&dfo(r,e,n[o]);return ffo(r,e),r}}();Object.defineProperty(Pd,"__esModule",{value:!0});Pd.ResponseFormats$=Pd.ResponseFormats$outboundSchema=Pd.ResponseFormats$inboundSchema=Pd.ResponseFormats=void 0;var mfo=pfo(te());Pd.ResponseFormats={Text:"text",JsonObject:"json_object",JsonSchema:"json_schema"};Pd.ResponseFormats$inboundSchema=mfo.nativeEnum(Pd.ResponseFormats);Pd.ResponseFormats$outboundSchema=Pd.ResponseFormats$inboundSchema;var J_r;(function(t){t.inboundSchema=Pd.ResponseFormats$inboundSchema,t.outboundSchema=Pd.ResponseFormats$outboundSchema})(J_r||(Pd.ResponseFormats$=J_r={}))});var oq=S(Md=>{"use strict";var hfo=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]}),gfo=Md&&Md.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yfo=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"&&hfo(r,e,n[o]);return gfo(r,e),r}}();Object.defineProperty(Md,"__esModule",{value:!0});Md.ResponseFormat$=Md.ResponseFormat$outboundSchema=Md.ResponseFormat$inboundSchema=void 0;Md.responseFormatToJSON=_fo;Md.responseFormatFromJSON=vfo;var vEe=yfo(te()),W_r=ae(),bfo=ee(),G_r=ist(),Z_r=ast();Md.ResponseFormat$inboundSchema=vEe.object({type:Z_r.ResponseFormats$inboundSchema.optional(),json_schema:vEe.nullable(G_r.JsonSchema$inboundSchema).optional()}).transform(t=>(0,W_r.remap)(t,{json_schema:"jsonSchema"}));Md.ResponseFormat$outboundSchema=vEe.object({type:Z_r.ResponseFormats$outboundSchema.optional(),jsonSchema:vEe.nullable(G_r.JsonSchema$outboundSchema).optional()}).transform(t=>(0,W_r.remap)(t,{jsonSchema:"json_schema"}));var K_r;(function(t){t.inboundSchema=Md.ResponseFormat$inboundSchema,t.outboundSchema=Md.ResponseFormat$outboundSchema})(K_r||(Md.ResponseFormat$=K_r={}));function _fo(t){return JSON.stringify(Md.ResponseFormat$outboundSchema.parse(t))}function vfo(t){return(0,bfo.safeParse)(t,e=>Md.ResponseFormat$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseFormat' from JSON")}});var cV=S(Rd=>{"use strict";var wfo=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]}),Sfo=Rd&&Rd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cfo=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"&&wfo(r,e,n[o]);return Sfo(r,e),r}}();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.ToolChoiceEnum$=Rd.ToolChoiceEnum$outboundSchema=Rd.ToolChoiceEnum$inboundSchema=Rd.ToolChoiceEnum=void 0;var xfo=Cfo(te());Rd.ToolChoiceEnum={Auto:"auto",None:"none",Any:"any",Required:"required"};Rd.ToolChoiceEnum$inboundSchema=xfo.nativeEnum(Rd.ToolChoiceEnum);Rd.ToolChoiceEnum$outboundSchema=Rd.ToolChoiceEnum$inboundSchema;var X_r;(function(t){t.inboundSchema=Rd.ToolChoiceEnum$inboundSchema,t.outboundSchema=Rd.ToolChoiceEnum$outboundSchema})(X_r||(Rd.ToolChoiceEnum$=X_r={}))});var HS=S(Ad=>{"use strict";var Ofo=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]}),Tfo=Ad&&Ad.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Efo=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"&&Ofo(r,e,n[o]);return Tfo(r,e),r}}();Object.defineProperty(Ad,"__esModule",{value:!0});Ad.CompletionArgs$=Ad.CompletionArgs$outboundSchema=Ad.CompletionArgs$inboundSchema=void 0;Ad.completionArgsToJSON=Mfo;Ad.completionArgsFromJSON=Rfo;var is=Efo(te()),Q_r=ae(),Pfo=ee(),evr=ost(),tvr=lV(),rvr=oq(),nvr=cV();Ad.CompletionArgs$inboundSchema=is.object({stop:is.nullable(evr.CompletionArgsStop$inboundSchema).optional(),presence_penalty:is.nullable(is.number()).optional(),frequency_penalty:is.nullable(is.number()).optional(),temperature:is.nullable(is.number()).optional(),top_p:is.nullable(is.number()).optional(),max_tokens:is.nullable(is.number().int()).optional(),random_seed:is.nullable(is.number().int()).optional(),prediction:is.nullable(tvr.Prediction$inboundSchema).optional(),response_format:is.nullable(rvr.ResponseFormat$inboundSchema).optional(),tool_choice:nvr.ToolChoiceEnum$inboundSchema.optional()}).transform(t=>(0,Q_r.remap)(t,{presence_penalty:"presencePenalty",frequency_penalty:"frequencyPenalty",top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",response_format:"responseFormat",tool_choice:"toolChoice"}));Ad.CompletionArgs$outboundSchema=is.object({stop:is.nullable(evr.CompletionArgsStop$outboundSchema).optional(),presencePenalty:is.nullable(is.number()).optional(),frequencyPenalty:is.nullable(is.number()).optional(),temperature:is.nullable(is.number()).optional(),topP:is.nullable(is.number()).optional(),maxTokens:is.nullable(is.number().int()).optional(),randomSeed:is.nullable(is.number().int()).optional(),prediction:is.nullable(tvr.Prediction$outboundSchema).optional(),responseFormat:is.nullable(rvr.ResponseFormat$outboundSchema).optional(),toolChoice:nvr.ToolChoiceEnum$outboundSchema.optional()}).transform(t=>(0,Q_r.remap)(t,{presencePenalty:"presence_penalty",frequencyPenalty:"frequency_penalty",topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",responseFormat:"response_format",toolChoice:"tool_choice"}));var Y_r;(function(t){t.inboundSchema=Ad.CompletionArgs$inboundSchema,t.outboundSchema=Ad.CompletionArgs$outboundSchema})(Y_r||(Ad.CompletionArgs$=Y_r={}));function Mfo(t){return JSON.stringify(Ad.CompletionArgs$outboundSchema.parse(t))}function Rfo(t){return(0,Pfo.safeParse)(t,e=>Ad.CompletionArgs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionArgs' from JSON")}});var iq=S(Qi=>{"use strict";var Afo=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]}),Ifo=Qi&&Qi.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nfo=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"&&Afo(r,e,n[o]);return Ifo(r,e),r}}();Object.defineProperty(Qi,"__esModule",{value:!0});Qi.DocumentLibraryTool$=Qi.DocumentLibraryTool$outboundSchema=Qi.DocumentLibraryTool$inboundSchema=Qi.DocumentLibraryToolType$=Qi.DocumentLibraryToolType$outboundSchema=Qi.DocumentLibraryToolType$inboundSchema=Qi.DocumentLibraryToolType=void 0;Qi.documentLibraryToolToJSON=Dfo;Qi.documentLibraryToolFromJSON=$fo;var dV=Nfo(te()),avr=ae(),jfo=ee();Qi.DocumentLibraryToolType={DocumentLibrary:"document_library"};Qi.DocumentLibraryToolType$inboundSchema=dV.nativeEnum(Qi.DocumentLibraryToolType);Qi.DocumentLibraryToolType$outboundSchema=Qi.DocumentLibraryToolType$inboundSchema;var ovr;(function(t){t.inboundSchema=Qi.DocumentLibraryToolType$inboundSchema,t.outboundSchema=Qi.DocumentLibraryToolType$outboundSchema})(ovr||(Qi.DocumentLibraryToolType$=ovr={}));Qi.DocumentLibraryTool$inboundSchema=dV.object({type:Qi.DocumentLibraryToolType$inboundSchema.default("document_library"),library_ids:dV.array(dV.string())}).transform(t=>(0,avr.remap)(t,{library_ids:"libraryIds"}));Qi.DocumentLibraryTool$outboundSchema=dV.object({type:Qi.DocumentLibraryToolType$outboundSchema.default("document_library"),libraryIds:dV.array(dV.string())}).transform(t=>(0,avr.remap)(t,{libraryIds:"library_ids"}));var ivr;(function(t){t.inboundSchema=Qi.DocumentLibraryTool$inboundSchema,t.outboundSchema=Qi.DocumentLibraryTool$outboundSchema})(ivr||(Qi.DocumentLibraryTool$=ivr={}));function Dfo(t){return JSON.stringify(Qi.DocumentLibraryTool$outboundSchema.parse(t))}function $fo(t){return(0,jfo.safeParse)(t,e=>Qi.DocumentLibraryTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentLibraryTool' from JSON")}});var wEe=S(Id=>{"use strict";var Lfo=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]}),Ffo=Id&&Id.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kfo=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"&&Lfo(r,e,n[o]);return Ffo(r,e),r}}();Object.defineProperty(Id,"__esModule",{value:!0});Id.FunctionT$=Id.FunctionT$outboundSchema=Id.FunctionT$inboundSchema=void 0;Id.functionToJSON=Bfo;Id.functionFromJSON=Ufo;var VS=kfo(te()),qfo=ee();Id.FunctionT$inboundSchema=VS.object({name:VS.string(),description:VS.string().optional(),strict:VS.boolean().optional(),parameters:VS.record(VS.any())});Id.FunctionT$outboundSchema=VS.object({name:VS.string(),description:VS.string().optional(),strict:VS.boolean().optional(),parameters:VS.record(VS.any())});var svr;(function(t){t.inboundSchema=Id.FunctionT$inboundSchema,t.outboundSchema=Id.FunctionT$outboundSchema})(svr||(Id.FunctionT$=svr={}));function Bfo(t){return JSON.stringify(Id.FunctionT$outboundSchema.parse(t))}function Ufo(t){return(0,qfo.safeParse)(t,e=>Id.FunctionT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionT' from JSON")}});var aq=S(ea=>{"use strict";var zfo=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]}),Hfo=ea&&ea.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vfo=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"&&zfo(r,e,n[o]);return Hfo(r,e),r}}();Object.defineProperty(ea,"__esModule",{value:!0});ea.FunctionTool$=ea.FunctionTool$outboundSchema=ea.FunctionTool$inboundSchema=ea.FunctionToolType$=ea.FunctionToolType$outboundSchema=ea.FunctionToolType$inboundSchema=ea.FunctionToolType=void 0;ea.functionToolToJSON=Kfo;ea.functionToolFromJSON=Wfo;var sst=Vfo(te()),Jfo=ee(),cvr=wEe();ea.FunctionToolType={Function:"function"};ea.FunctionToolType$inboundSchema=sst.nativeEnum(ea.FunctionToolType);ea.FunctionToolType$outboundSchema=ea.FunctionToolType$inboundSchema;var uvr;(function(t){t.inboundSchema=ea.FunctionToolType$inboundSchema,t.outboundSchema=ea.FunctionToolType$outboundSchema})(uvr||(ea.FunctionToolType$=uvr={}));ea.FunctionTool$inboundSchema=sst.object({type:ea.FunctionToolType$inboundSchema.default("function"),function:cvr.FunctionT$inboundSchema});ea.FunctionTool$outboundSchema=sst.object({type:ea.FunctionToolType$outboundSchema.default("function"),function:cvr.FunctionT$outboundSchema});var lvr;(function(t){t.inboundSchema=ea.FunctionTool$inboundSchema,t.outboundSchema=ea.FunctionTool$outboundSchema})(lvr||(ea.FunctionTool$=lvr={}));function Kfo(t){return JSON.stringify(ea.FunctionTool$outboundSchema.parse(t))}function Wfo(t){return(0,Jfo.safeParse)(t,e=>ea.FunctionTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionTool' from JSON")}});var sq=S(ta=>{"use strict";var Gfo=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]}),Zfo=ta&&ta.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xfo=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"&&Gfo(r,e,n[o]);return Zfo(r,e),r}}();Object.defineProperty(ta,"__esModule",{value:!0});ta.ImageGenerationTool$=ta.ImageGenerationTool$outboundSchema=ta.ImageGenerationTool$inboundSchema=ta.ImageGenerationToolType$=ta.ImageGenerationToolType$outboundSchema=ta.ImageGenerationToolType$inboundSchema=ta.ImageGenerationToolType=void 0;ta.imageGenerationToolToJSON=Qfo;ta.imageGenerationToolFromJSON=epo;var ust=Xfo(te()),Yfo=ee();ta.ImageGenerationToolType={ImageGeneration:"image_generation"};ta.ImageGenerationToolType$inboundSchema=ust.nativeEnum(ta.ImageGenerationToolType);ta.ImageGenerationToolType$outboundSchema=ta.ImageGenerationToolType$inboundSchema;var dvr;(function(t){t.inboundSchema=ta.ImageGenerationToolType$inboundSchema,t.outboundSchema=ta.ImageGenerationToolType$outboundSchema})(dvr||(ta.ImageGenerationToolType$=dvr={}));ta.ImageGenerationTool$inboundSchema=ust.object({type:ta.ImageGenerationToolType$inboundSchema.default("image_generation")});ta.ImageGenerationTool$outboundSchema=ust.object({type:ta.ImageGenerationToolType$outboundSchema.default("image_generation")});var fvr;(function(t){t.inboundSchema=ta.ImageGenerationTool$inboundSchema,t.outboundSchema=ta.ImageGenerationTool$outboundSchema})(fvr||(ta.ImageGenerationTool$=fvr={}));function Qfo(t){return JSON.stringify(ta.ImageGenerationTool$outboundSchema.parse(t))}function epo(t){return(0,Yfo.safeParse)(t,e=>ta.ImageGenerationTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageGenerationTool' from JSON")}});var uq=S(ra=>{"use strict";var tpo=ra&&ra.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rpo=ra&&ra.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),npo=ra&&ra.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tpo(r,e,n[o]);return rpo(r,e),r}}();Object.defineProperty(ra,"__esModule",{value:!0});ra.WebSearchPremiumTool$=ra.WebSearchPremiumTool$outboundSchema=ra.WebSearchPremiumTool$inboundSchema=ra.WebSearchPremiumToolType$=ra.WebSearchPremiumToolType$outboundSchema=ra.WebSearchPremiumToolType$inboundSchema=ra.WebSearchPremiumToolType=void 0;ra.webSearchPremiumToolToJSON=ipo;ra.webSearchPremiumToolFromJSON=apo;var lst=npo(te()),opo=ee();ra.WebSearchPremiumToolType={WebSearchPremium:"web_search_premium"};ra.WebSearchPremiumToolType$inboundSchema=lst.nativeEnum(ra.WebSearchPremiumToolType);ra.WebSearchPremiumToolType$outboundSchema=ra.WebSearchPremiumToolType$inboundSchema;var pvr;(function(t){t.inboundSchema=ra.WebSearchPremiumToolType$inboundSchema,t.outboundSchema=ra.WebSearchPremiumToolType$outboundSchema})(pvr||(ra.WebSearchPremiumToolType$=pvr={}));ra.WebSearchPremiumTool$inboundSchema=lst.object({type:ra.WebSearchPremiumToolType$inboundSchema.default("web_search_premium")});ra.WebSearchPremiumTool$outboundSchema=lst.object({type:ra.WebSearchPremiumToolType$outboundSchema.default("web_search_premium")});var mvr;(function(t){t.inboundSchema=ra.WebSearchPremiumTool$inboundSchema,t.outboundSchema=ra.WebSearchPremiumTool$outboundSchema})(mvr||(ra.WebSearchPremiumTool$=mvr={}));function ipo(t){return JSON.stringify(ra.WebSearchPremiumTool$outboundSchema.parse(t))}function apo(t){return(0,opo.safeParse)(t,e=>ra.WebSearchPremiumTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WebSearchPremiumTool' from JSON")}});var lq=S(na=>{"use strict";var spo=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]}),upo=na&&na.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lpo=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"&&spo(r,e,n[o]);return upo(r,e),r}}();Object.defineProperty(na,"__esModule",{value:!0});na.WebSearchTool$=na.WebSearchTool$outboundSchema=na.WebSearchTool$inboundSchema=na.WebSearchToolType$=na.WebSearchToolType$outboundSchema=na.WebSearchToolType$inboundSchema=na.WebSearchToolType=void 0;na.webSearchToolToJSON=dpo;na.webSearchToolFromJSON=fpo;var cst=lpo(te()),cpo=ee();na.WebSearchToolType={WebSearch:"web_search"};na.WebSearchToolType$inboundSchema=cst.nativeEnum(na.WebSearchToolType);na.WebSearchToolType$outboundSchema=na.WebSearchToolType$inboundSchema;var hvr;(function(t){t.inboundSchema=na.WebSearchToolType$inboundSchema,t.outboundSchema=na.WebSearchToolType$outboundSchema})(hvr||(na.WebSearchToolType$=hvr={}));na.WebSearchTool$inboundSchema=cst.object({type:na.WebSearchToolType$inboundSchema.default("web_search")});na.WebSearchTool$outboundSchema=cst.object({type:na.WebSearchToolType$outboundSchema.default("web_search")});var gvr;(function(t){t.inboundSchema=na.WebSearchTool$inboundSchema,t.outboundSchema=na.WebSearchTool$outboundSchema})(gvr||(na.WebSearchTool$=gvr={}));function dpo(t){return JSON.stringify(na.WebSearchTool$outboundSchema.parse(t))}function fpo(t){return(0,cpo.safeParse)(t,e=>na.WebSearchTool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WebSearchTool' from JSON")}});var Cvr=S(to=>{"use strict";var ppo=to&&to.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),mpo=to&&to.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hpo=to&&to.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&ppo(r,e,n[o]);return mpo(r,e),r}}();Object.defineProperty(to,"__esModule",{value:!0});to.Agent$=to.Agent$outboundSchema=to.Agent$inboundSchema=to.AgentObject$=to.AgentObject$outboundSchema=to.AgentObject$inboundSchema=to.AgentTools$=to.AgentTools$outboundSchema=to.AgentTools$inboundSchema=to.AgentObject=void 0;to.agentToolsToJSON=gpo;to.agentToolsFromJSON=ypo;to.agentToJSON=bpo;to.agentFromJSON=_po;var Tt=hpo(te()),vvr=ae(),wvr=ee(),SEe=rq(),Svr=HS(),CEe=iq(),xEe=aq(),OEe=sq(),TEe=uq(),EEe=lq();to.AgentObject={Agent:"agent"};to.AgentTools$inboundSchema=Tt.union([CEe.DocumentLibraryTool$inboundSchema.and(Tt.object({type:Tt.literal("document_library")}).transform(t=>({type:t.type}))),xEe.FunctionTool$inboundSchema.and(Tt.object({type:Tt.literal("function")}).transform(t=>({type:t.type}))),SEe.CodeInterpreterTool$inboundSchema.and(Tt.object({type:Tt.literal("code_interpreter")}).transform(t=>({type:t.type}))),OEe.ImageGenerationTool$inboundSchema.and(Tt.object({type:Tt.literal("image_generation")}).transform(t=>({type:t.type}))),EEe.WebSearchTool$inboundSchema.and(Tt.object({type:Tt.literal("web_search")}).transform(t=>({type:t.type}))),TEe.WebSearchPremiumTool$inboundSchema.and(Tt.object({type:Tt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);to.AgentTools$outboundSchema=Tt.union([CEe.DocumentLibraryTool$outboundSchema.and(Tt.object({type:Tt.literal("document_library")}).transform(t=>({type:t.type}))),xEe.FunctionTool$outboundSchema.and(Tt.object({type:Tt.literal("function")}).transform(t=>({type:t.type}))),SEe.CodeInterpreterTool$outboundSchema.and(Tt.object({type:Tt.literal("code_interpreter")}).transform(t=>({type:t.type}))),OEe.ImageGenerationTool$outboundSchema.and(Tt.object({type:Tt.literal("image_generation")}).transform(t=>({type:t.type}))),EEe.WebSearchTool$outboundSchema.and(Tt.object({type:Tt.literal("web_search")}).transform(t=>({type:t.type}))),TEe.WebSearchPremiumTool$outboundSchema.and(Tt.object({type:Tt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var yvr;(function(t){t.inboundSchema=to.AgentTools$inboundSchema,t.outboundSchema=to.AgentTools$outboundSchema})(yvr||(to.AgentTools$=yvr={}));function gpo(t){return JSON.stringify(to.AgentTools$outboundSchema.parse(t))}function ypo(t){return(0,wvr.safeParse)(t,e=>to.AgentTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentTools' from JSON")}to.AgentObject$inboundSchema=Tt.nativeEnum(to.AgentObject);to.AgentObject$outboundSchema=to.AgentObject$inboundSchema;var bvr;(function(t){t.inboundSchema=to.AgentObject$inboundSchema,t.outboundSchema=to.AgentObject$outboundSchema})(bvr||(to.AgentObject$=bvr={}));to.Agent$inboundSchema=Tt.object({instructions:Tt.nullable(Tt.string()).optional(),tools:Tt.array(Tt.union([CEe.DocumentLibraryTool$inboundSchema.and(Tt.object({type:Tt.literal("document_library")}).transform(t=>({type:t.type}))),xEe.FunctionTool$inboundSchema.and(Tt.object({type:Tt.literal("function")}).transform(t=>({type:t.type}))),SEe.CodeInterpreterTool$inboundSchema.and(Tt.object({type:Tt.literal("code_interpreter")}).transform(t=>({type:t.type}))),OEe.ImageGenerationTool$inboundSchema.and(Tt.object({type:Tt.literal("image_generation")}).transform(t=>({type:t.type}))),EEe.WebSearchTool$inboundSchema.and(Tt.object({type:Tt.literal("web_search")}).transform(t=>({type:t.type}))),TEe.WebSearchPremiumTool$inboundSchema.and(Tt.object({type:Tt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:Svr.CompletionArgs$inboundSchema.optional(),model:Tt.string(),name:Tt.string(),description:Tt.nullable(Tt.string()).optional(),handoffs:Tt.nullable(Tt.array(Tt.string())).optional(),object:to.AgentObject$inboundSchema.default("agent"),id:Tt.string(),version:Tt.number().int(),created_at:Tt.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:Tt.string().datetime({offset:!0}).transform(t=>new Date(t))}).transform(t=>(0,vvr.remap)(t,{completion_args:"completionArgs",created_at:"createdAt",updated_at:"updatedAt"}));to.Agent$outboundSchema=Tt.object({instructions:Tt.nullable(Tt.string()).optional(),tools:Tt.array(Tt.union([CEe.DocumentLibraryTool$outboundSchema.and(Tt.object({type:Tt.literal("document_library")}).transform(t=>({type:t.type}))),xEe.FunctionTool$outboundSchema.and(Tt.object({type:Tt.literal("function")}).transform(t=>({type:t.type}))),SEe.CodeInterpreterTool$outboundSchema.and(Tt.object({type:Tt.literal("code_interpreter")}).transform(t=>({type:t.type}))),OEe.ImageGenerationTool$outboundSchema.and(Tt.object({type:Tt.literal("image_generation")}).transform(t=>({type:t.type}))),EEe.WebSearchTool$outboundSchema.and(Tt.object({type:Tt.literal("web_search")}).transform(t=>({type:t.type}))),TEe.WebSearchPremiumTool$outboundSchema.and(Tt.object({type:Tt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:Svr.CompletionArgs$outboundSchema.optional(),model:Tt.string(),name:Tt.string(),description:Tt.nullable(Tt.string()).optional(),handoffs:Tt.nullable(Tt.array(Tt.string())).optional(),object:to.AgentObject$outboundSchema.default("agent"),id:Tt.string(),version:Tt.number().int(),createdAt:Tt.date().transform(t=>t.toISOString()),updatedAt:Tt.date().transform(t=>t.toISOString())}).transform(t=>(0,vvr.remap)(t,{completionArgs:"completion_args",createdAt:"created_at",updatedAt:"updated_at"}));var _vr;(function(t){t.inboundSchema=to.Agent$inboundSchema,t.outboundSchema=to.Agent$outboundSchema})(_vr||(to.Agent$=_vr={}));function bpo(t){return JSON.stringify(to.Agent$outboundSchema.parse(t))}function _po(t){return(0,wvr.safeParse)(t,e=>to.Agent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Agent' from JSON")}});var Evr=S(oa=>{"use strict";var vpo=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]}),wpo=oa&&oa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Spo=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"&&vpo(r,e,n[o]);return wpo(r,e),r}}();Object.defineProperty(oa,"__esModule",{value:!0});oa.AgentConversation$=oa.AgentConversation$outboundSchema=oa.AgentConversation$inboundSchema=oa.AgentConversationObject$=oa.AgentConversationObject$outboundSchema=oa.AgentConversationObject$inboundSchema=oa.AgentConversationObject=void 0;oa.agentConversationToJSON=xpo;oa.agentConversationFromJSON=Opo;var Fm=Spo(te()),Tvr=ae(),Cpo=ee();oa.AgentConversationObject={Conversation:"conversation"};oa.AgentConversationObject$inboundSchema=Fm.nativeEnum(oa.AgentConversationObject);oa.AgentConversationObject$outboundSchema=oa.AgentConversationObject$inboundSchema;var xvr;(function(t){t.inboundSchema=oa.AgentConversationObject$inboundSchema,t.outboundSchema=oa.AgentConversationObject$outboundSchema})(xvr||(oa.AgentConversationObject$=xvr={}));oa.AgentConversation$inboundSchema=Fm.object({name:Fm.nullable(Fm.string()).optional(),description:Fm.nullable(Fm.string()).optional(),object:oa.AgentConversationObject$inboundSchema.default("conversation"),id:Fm.string(),created_at:Fm.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:Fm.string().datetime({offset:!0}).transform(t=>new Date(t)),agent_id:Fm.string()}).transform(t=>(0,Tvr.remap)(t,{created_at:"createdAt",updated_at:"updatedAt",agent_id:"agentId"}));oa.AgentConversation$outboundSchema=Fm.object({name:Fm.nullable(Fm.string()).optional(),description:Fm.nullable(Fm.string()).optional(),object:oa.AgentConversationObject$outboundSchema.default("conversation"),id:Fm.string(),createdAt:Fm.date().transform(t=>t.toISOString()),updatedAt:Fm.date().transform(t=>t.toISOString()),agentId:Fm.string()}).transform(t=>(0,Tvr.remap)(t,{createdAt:"created_at",updatedAt:"updated_at",agentId:"agent_id"}));var Ovr;(function(t){t.inboundSchema=oa.AgentConversation$inboundSchema,t.outboundSchema=oa.AgentConversation$outboundSchema})(Ovr||(oa.AgentConversation$=Ovr={}));function xpo(t){return JSON.stringify(oa.AgentConversation$outboundSchema.parse(t))}function Opo(t){return(0,Cpo.safeParse)(t,e=>oa.AgentConversation$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentConversation' from JSON")}});var Nvr=S(as=>{"use strict";var Tpo=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]}),Epo=as&&as.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ppo=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"&&Tpo(r,e,n[o]);return Epo(r,e),r}}();Object.defineProperty(as,"__esModule",{value:!0});as.AgentCreationRequest$=as.AgentCreationRequest$outboundSchema=as.AgentCreationRequest$inboundSchema=as.AgentCreationRequestTools$=as.AgentCreationRequestTools$outboundSchema=as.AgentCreationRequestTools$inboundSchema=void 0;as.agentCreationRequestToolsToJSON=Mpo;as.agentCreationRequestToolsFromJSON=Rpo;as.agentCreationRequestToJSON=Apo;as.agentCreationRequestFromJSON=Ipo;var Jt=Ppo(te()),Rvr=ae(),Avr=ee(),PEe=rq(),Ivr=HS(),MEe=iq(),REe=aq(),AEe=sq(),IEe=uq(),NEe=lq();as.AgentCreationRequestTools$inboundSchema=Jt.union([MEe.DocumentLibraryTool$inboundSchema.and(Jt.object({type:Jt.literal("document_library")}).transform(t=>({type:t.type}))),REe.FunctionTool$inboundSchema.and(Jt.object({type:Jt.literal("function")}).transform(t=>({type:t.type}))),PEe.CodeInterpreterTool$inboundSchema.and(Jt.object({type:Jt.literal("code_interpreter")}).transform(t=>({type:t.type}))),AEe.ImageGenerationTool$inboundSchema.and(Jt.object({type:Jt.literal("image_generation")}).transform(t=>({type:t.type}))),NEe.WebSearchTool$inboundSchema.and(Jt.object({type:Jt.literal("web_search")}).transform(t=>({type:t.type}))),IEe.WebSearchPremiumTool$inboundSchema.and(Jt.object({type:Jt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);as.AgentCreationRequestTools$outboundSchema=Jt.union([MEe.DocumentLibraryTool$outboundSchema.and(Jt.object({type:Jt.literal("document_library")}).transform(t=>({type:t.type}))),REe.FunctionTool$outboundSchema.and(Jt.object({type:Jt.literal("function")}).transform(t=>({type:t.type}))),PEe.CodeInterpreterTool$outboundSchema.and(Jt.object({type:Jt.literal("code_interpreter")}).transform(t=>({type:t.type}))),AEe.ImageGenerationTool$outboundSchema.and(Jt.object({type:Jt.literal("image_generation")}).transform(t=>({type:t.type}))),NEe.WebSearchTool$outboundSchema.and(Jt.object({type:Jt.literal("web_search")}).transform(t=>({type:t.type}))),IEe.WebSearchPremiumTool$outboundSchema.and(Jt.object({type:Jt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var Pvr;(function(t){t.inboundSchema=as.AgentCreationRequestTools$inboundSchema,t.outboundSchema=as.AgentCreationRequestTools$outboundSchema})(Pvr||(as.AgentCreationRequestTools$=Pvr={}));function Mpo(t){return JSON.stringify(as.AgentCreationRequestTools$outboundSchema.parse(t))}function Rpo(t){return(0,Avr.safeParse)(t,e=>as.AgentCreationRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentCreationRequestTools' from JSON")}as.AgentCreationRequest$inboundSchema=Jt.object({instructions:Jt.nullable(Jt.string()).optional(),tools:Jt.array(Jt.union([MEe.DocumentLibraryTool$inboundSchema.and(Jt.object({type:Jt.literal("document_library")}).transform(t=>({type:t.type}))),REe.FunctionTool$inboundSchema.and(Jt.object({type:Jt.literal("function")}).transform(t=>({type:t.type}))),PEe.CodeInterpreterTool$inboundSchema.and(Jt.object({type:Jt.literal("code_interpreter")}).transform(t=>({type:t.type}))),AEe.ImageGenerationTool$inboundSchema.and(Jt.object({type:Jt.literal("image_generation")}).transform(t=>({type:t.type}))),NEe.WebSearchTool$inboundSchema.and(Jt.object({type:Jt.literal("web_search")}).transform(t=>({type:t.type}))),IEe.WebSearchPremiumTool$inboundSchema.and(Jt.object({type:Jt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:Ivr.CompletionArgs$inboundSchema.optional(),model:Jt.string(),name:Jt.string(),description:Jt.nullable(Jt.string()).optional(),handoffs:Jt.nullable(Jt.array(Jt.string())).optional()}).transform(t=>(0,Rvr.remap)(t,{completion_args:"completionArgs"}));as.AgentCreationRequest$outboundSchema=Jt.object({instructions:Jt.nullable(Jt.string()).optional(),tools:Jt.array(Jt.union([MEe.DocumentLibraryTool$outboundSchema.and(Jt.object({type:Jt.literal("document_library")}).transform(t=>({type:t.type}))),REe.FunctionTool$outboundSchema.and(Jt.object({type:Jt.literal("function")}).transform(t=>({type:t.type}))),PEe.CodeInterpreterTool$outboundSchema.and(Jt.object({type:Jt.literal("code_interpreter")}).transform(t=>({type:t.type}))),AEe.ImageGenerationTool$outboundSchema.and(Jt.object({type:Jt.literal("image_generation")}).transform(t=>({type:t.type}))),NEe.WebSearchTool$outboundSchema.and(Jt.object({type:Jt.literal("web_search")}).transform(t=>({type:t.type}))),IEe.WebSearchPremiumTool$outboundSchema.and(Jt.object({type:Jt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:Ivr.CompletionArgs$outboundSchema.optional(),model:Jt.string(),name:Jt.string(),description:Jt.nullable(Jt.string()).optional(),handoffs:Jt.nullable(Jt.array(Jt.string())).optional()}).transform(t=>(0,Rvr.remap)(t,{completionArgs:"completion_args"}));var Mvr;(function(t){t.inboundSchema=as.AgentCreationRequest$inboundSchema,t.outboundSchema=as.AgentCreationRequest$outboundSchema})(Mvr||(as.AgentCreationRequest$=Mvr={}));function Apo(t){return JSON.stringify(as.AgentCreationRequest$outboundSchema.parse(t))}function Ipo(t){return(0,Avr.safeParse)(t,e=>as.AgentCreationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentCreationRequest' from JSON")}});var dst=S(ia=>{"use strict";var Npo=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]}),jpo=ia&&ia.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dpo=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"&&Npo(r,e,n[o]);return jpo(r,e),r}}();Object.defineProperty(ia,"__esModule",{value:!0});ia.AgentHandoffDoneEvent$=ia.AgentHandoffDoneEvent$outboundSchema=ia.AgentHandoffDoneEvent$inboundSchema=ia.AgentHandoffDoneEventType$=ia.AgentHandoffDoneEventType$outboundSchema=ia.AgentHandoffDoneEventType$inboundSchema=ia.AgentHandoffDoneEventType=void 0;ia.agentHandoffDoneEventToJSON=Lpo;ia.agentHandoffDoneEventFromJSON=Fpo;var ow=Dpo(te()),$vr=ae(),$po=ee();ia.AgentHandoffDoneEventType={AgentHandoffDone:"agent.handoff.done"};ia.AgentHandoffDoneEventType$inboundSchema=ow.nativeEnum(ia.AgentHandoffDoneEventType);ia.AgentHandoffDoneEventType$outboundSchema=ia.AgentHandoffDoneEventType$inboundSchema;var jvr;(function(t){t.inboundSchema=ia.AgentHandoffDoneEventType$inboundSchema,t.outboundSchema=ia.AgentHandoffDoneEventType$outboundSchema})(jvr||(ia.AgentHandoffDoneEventType$=jvr={}));ia.AgentHandoffDoneEvent$inboundSchema=ow.object({type:ia.AgentHandoffDoneEventType$inboundSchema.default("agent.handoff.done"),created_at:ow.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:ow.number().int().default(0),id:ow.string(),next_agent_id:ow.string(),next_agent_name:ow.string()}).transform(t=>(0,$vr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",next_agent_id:"nextAgentId",next_agent_name:"nextAgentName"}));ia.AgentHandoffDoneEvent$outboundSchema=ow.object({type:ia.AgentHandoffDoneEventType$outboundSchema.default("agent.handoff.done"),createdAt:ow.date().transform(t=>t.toISOString()).optional(),outputIndex:ow.number().int().default(0),id:ow.string(),nextAgentId:ow.string(),nextAgentName:ow.string()}).transform(t=>(0,$vr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",nextAgentId:"next_agent_id",nextAgentName:"next_agent_name"}));var Dvr;(function(t){t.inboundSchema=ia.AgentHandoffDoneEvent$inboundSchema,t.outboundSchema=ia.AgentHandoffDoneEvent$outboundSchema})(Dvr||(ia.AgentHandoffDoneEvent$=Dvr={}));function Lpo(t){return JSON.stringify(ia.AgentHandoffDoneEvent$outboundSchema.parse(t))}function Fpo(t){return(0,$po.safeParse)(t,e=>ia.AgentHandoffDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffDoneEvent' from JSON")}});var Cae=S(Fn=>{"use strict";var kpo=Fn&&Fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qpo=Fn&&Fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bpo=Fn&&Fn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 qpo(r,e),r}}();Object.defineProperty(Fn,"__esModule",{value:!0});Fn.AgentHandoffEntry$=Fn.AgentHandoffEntry$outboundSchema=Fn.AgentHandoffEntry$inboundSchema=Fn.AgentHandoffEntryType$=Fn.AgentHandoffEntryType$outboundSchema=Fn.AgentHandoffEntryType$inboundSchema=Fn.AgentHandoffEntryObject$=Fn.AgentHandoffEntryObject$outboundSchema=Fn.AgentHandoffEntryObject$inboundSchema=Fn.AgentHandoffEntryType=Fn.AgentHandoffEntryObject=void 0;Fn.agentHandoffEntryToJSON=zpo;Fn.agentHandoffEntryFromJSON=Hpo;var Nd=Bpo(te()),qvr=ae(),Upo=ee();Fn.AgentHandoffEntryObject={Entry:"entry"};Fn.AgentHandoffEntryType={AgentHandoff:"agent.handoff"};Fn.AgentHandoffEntryObject$inboundSchema=Nd.nativeEnum(Fn.AgentHandoffEntryObject);Fn.AgentHandoffEntryObject$outboundSchema=Fn.AgentHandoffEntryObject$inboundSchema;var Lvr;(function(t){t.inboundSchema=Fn.AgentHandoffEntryObject$inboundSchema,t.outboundSchema=Fn.AgentHandoffEntryObject$outboundSchema})(Lvr||(Fn.AgentHandoffEntryObject$=Lvr={}));Fn.AgentHandoffEntryType$inboundSchema=Nd.nativeEnum(Fn.AgentHandoffEntryType);Fn.AgentHandoffEntryType$outboundSchema=Fn.AgentHandoffEntryType$inboundSchema;var Fvr;(function(t){t.inboundSchema=Fn.AgentHandoffEntryType$inboundSchema,t.outboundSchema=Fn.AgentHandoffEntryType$outboundSchema})(Fvr||(Fn.AgentHandoffEntryType$=Fvr={}));Fn.AgentHandoffEntry$inboundSchema=Nd.object({object:Fn.AgentHandoffEntryObject$inboundSchema.default("entry"),type:Fn.AgentHandoffEntryType$inboundSchema.default("agent.handoff"),created_at:Nd.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Nd.nullable(Nd.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Nd.string().optional(),previous_agent_id:Nd.string(),previous_agent_name:Nd.string(),next_agent_id:Nd.string(),next_agent_name:Nd.string()}).transform(t=>(0,qvr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",previous_agent_id:"previousAgentId",previous_agent_name:"previousAgentName",next_agent_id:"nextAgentId",next_agent_name:"nextAgentName"}));Fn.AgentHandoffEntry$outboundSchema=Nd.object({object:Fn.AgentHandoffEntryObject$outboundSchema.default("entry"),type:Fn.AgentHandoffEntryType$outboundSchema.default("agent.handoff"),createdAt:Nd.date().transform(t=>t.toISOString()).optional(),completedAt:Nd.nullable(Nd.date().transform(t=>t.toISOString())).optional(),id:Nd.string().optional(),previousAgentId:Nd.string(),previousAgentName:Nd.string(),nextAgentId:Nd.string(),nextAgentName:Nd.string()}).transform(t=>(0,qvr.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 kvr;(function(t){t.inboundSchema=Fn.AgentHandoffEntry$inboundSchema,t.outboundSchema=Fn.AgentHandoffEntry$outboundSchema})(kvr||(Fn.AgentHandoffEntry$=kvr={}));function zpo(t){return JSON.stringify(Fn.AgentHandoffEntry$outboundSchema.parse(t))}function Hpo(t){return(0,Upo.safeParse)(t,e=>Fn.AgentHandoffEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffEntry' from JSON")}});var fst=S(aa=>{"use strict";var Vpo=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]}),Jpo=aa&&aa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Kpo=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"&&Vpo(r,e,n[o]);return Jpo(r,e),r}}();Object.defineProperty(aa,"__esModule",{value:!0});aa.AgentHandoffStartedEvent$=aa.AgentHandoffStartedEvent$outboundSchema=aa.AgentHandoffStartedEvent$inboundSchema=aa.AgentHandoffStartedEventType$=aa.AgentHandoffStartedEventType$outboundSchema=aa.AgentHandoffStartedEventType$inboundSchema=aa.AgentHandoffStartedEventType=void 0;aa.agentHandoffStartedEventToJSON=Gpo;aa.agentHandoffStartedEventFromJSON=Zpo;var iw=Kpo(te()),zvr=ae(),Wpo=ee();aa.AgentHandoffStartedEventType={AgentHandoffStarted:"agent.handoff.started"};aa.AgentHandoffStartedEventType$inboundSchema=iw.nativeEnum(aa.AgentHandoffStartedEventType);aa.AgentHandoffStartedEventType$outboundSchema=aa.AgentHandoffStartedEventType$inboundSchema;var Bvr;(function(t){t.inboundSchema=aa.AgentHandoffStartedEventType$inboundSchema,t.outboundSchema=aa.AgentHandoffStartedEventType$outboundSchema})(Bvr||(aa.AgentHandoffStartedEventType$=Bvr={}));aa.AgentHandoffStartedEvent$inboundSchema=iw.object({type:aa.AgentHandoffStartedEventType$inboundSchema.default("agent.handoff.started"),created_at:iw.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:iw.number().int().default(0),id:iw.string(),previous_agent_id:iw.string(),previous_agent_name:iw.string()}).transform(t=>(0,zvr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",previous_agent_id:"previousAgentId",previous_agent_name:"previousAgentName"}));aa.AgentHandoffStartedEvent$outboundSchema=iw.object({type:aa.AgentHandoffStartedEventType$outboundSchema.default("agent.handoff.started"),createdAt:iw.date().transform(t=>t.toISOString()).optional(),outputIndex:iw.number().int().default(0),id:iw.string(),previousAgentId:iw.string(),previousAgentName:iw.string()}).transform(t=>(0,zvr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",previousAgentId:"previous_agent_id",previousAgentName:"previous_agent_name"}));var Uvr;(function(t){t.inboundSchema=aa.AgentHandoffStartedEvent$inboundSchema,t.outboundSchema=aa.AgentHandoffStartedEvent$outboundSchema})(Uvr||(aa.AgentHandoffStartedEvent$=Uvr={}));function Gpo(t){return JSON.stringify(aa.AgentHandoffStartedEvent$outboundSchema.parse(t))}function Zpo(t){return(0,Wpo.safeParse)(t,e=>aa.AgentHandoffStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentHandoffStartedEvent' from JSON")}});var pst=S(sa=>{"use strict";var Xpo=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]}),Ypo=sa&&sa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qpo=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"&&Xpo(r,e,n[o]);return Ypo(r,e),r}}();Object.defineProperty(sa,"__esModule",{value:!0});sa.AudioChunk$=sa.AudioChunk$outboundSchema=sa.AudioChunk$inboundSchema=sa.AudioChunkType$=sa.AudioChunkType$outboundSchema=sa.AudioChunkType$inboundSchema=sa.AudioChunkType=void 0;sa.audioChunkToJSON=tmo;sa.audioChunkFromJSON=rmo;var xae=Qpo(te()),Jvr=ae(),emo=ee();sa.AudioChunkType={InputAudio:"input_audio"};sa.AudioChunkType$inboundSchema=xae.nativeEnum(sa.AudioChunkType);sa.AudioChunkType$outboundSchema=sa.AudioChunkType$inboundSchema;var Hvr;(function(t){t.inboundSchema=sa.AudioChunkType$inboundSchema,t.outboundSchema=sa.AudioChunkType$outboundSchema})(Hvr||(sa.AudioChunkType$=Hvr={}));sa.AudioChunk$inboundSchema=xae.object({input_audio:xae.string(),type:sa.AudioChunkType$inboundSchema.default("input_audio")}).transform(t=>(0,Jvr.remap)(t,{input_audio:"inputAudio"}));sa.AudioChunk$outboundSchema=xae.object({inputAudio:xae.string(),type:sa.AudioChunkType$outboundSchema.default("input_audio")}).transform(t=>(0,Jvr.remap)(t,{inputAudio:"input_audio"}));var Vvr;(function(t){t.inboundSchema=sa.AudioChunk$inboundSchema,t.outboundSchema=sa.AudioChunk$outboundSchema})(Vvr||(sa.AudioChunk$=Vvr={}));function tmo(t){return JSON.stringify(sa.AudioChunk$outboundSchema.parse(t))}function rmo(t){return(0,emo.safeParse)(t,e=>sa.AudioChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioChunk' from JSON")}});var fV=S(ua=>{"use strict";var nmo=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]}),omo=ua&&ua.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),imo=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"&&nmo(r,e,n[o]);return omo(r,e),r}}();Object.defineProperty(ua,"__esModule",{value:!0});ua.DocumentURLChunk$=ua.DocumentURLChunk$outboundSchema=ua.DocumentURLChunk$inboundSchema=ua.DocumentURLChunkType$=ua.DocumentURLChunkType$outboundSchema=ua.DocumentURLChunkType$inboundSchema=ua.DocumentURLChunkType=void 0;ua.documentURLChunkToJSON=smo;ua.documentURLChunkFromJSON=umo;var fj=imo(te()),Gvr=ae(),amo=ee();ua.DocumentURLChunkType={DocumentUrl:"document_url"};ua.DocumentURLChunkType$inboundSchema=fj.nativeEnum(ua.DocumentURLChunkType);ua.DocumentURLChunkType$outboundSchema=ua.DocumentURLChunkType$inboundSchema;var Kvr;(function(t){t.inboundSchema=ua.DocumentURLChunkType$inboundSchema,t.outboundSchema=ua.DocumentURLChunkType$outboundSchema})(Kvr||(ua.DocumentURLChunkType$=Kvr={}));ua.DocumentURLChunk$inboundSchema=fj.object({document_url:fj.string(),document_name:fj.nullable(fj.string()).optional(),type:ua.DocumentURLChunkType$inboundSchema.default("document_url")}).transform(t=>(0,Gvr.remap)(t,{document_url:"documentUrl",document_name:"documentName"}));ua.DocumentURLChunk$outboundSchema=fj.object({documentUrl:fj.string(),documentName:fj.nullable(fj.string()).optional(),type:ua.DocumentURLChunkType$outboundSchema.default("document_url")}).transform(t=>(0,Gvr.remap)(t,{documentUrl:"document_url",documentName:"document_name"}));var Wvr;(function(t){t.inboundSchema=ua.DocumentURLChunk$inboundSchema,t.outboundSchema=ua.DocumentURLChunk$outboundSchema})(Wvr||(ua.DocumentURLChunk$=Wvr={}));function smo(t){return JSON.stringify(ua.DocumentURLChunk$outboundSchema.parse(t))}function umo(t){return(0,amo.safeParse)(t,e=>ua.DocumentURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentURLChunk' from JSON")}});var jEe=S(jd=>{"use strict";var lmo=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]}),cmo=jd&&jd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dmo=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"&&lmo(r,e,n[o]);return cmo(r,e),r}}();Object.defineProperty(jd,"__esModule",{value:!0});jd.FileChunk$=jd.FileChunk$outboundSchema=jd.FileChunk$inboundSchema=void 0;jd.fileChunkToJSON=pmo;jd.fileChunkFromJSON=mmo;var t9=dmo(te()),Xvr=ae(),fmo=ee();jd.FileChunk$inboundSchema=t9.object({type:t9.literal("file").default("file"),file_id:t9.string()}).transform(t=>(0,Xvr.remap)(t,{file_id:"fileId"}));jd.FileChunk$outboundSchema=t9.object({type:t9.literal("file").default("file"),fileId:t9.string()}).transform(t=>(0,Xvr.remap)(t,{fileId:"file_id"}));var Zvr;(function(t){t.inboundSchema=jd.FileChunk$inboundSchema,t.outboundSchema=jd.FileChunk$outboundSchema})(Zvr||(jd.FileChunk$=Zvr={}));function pmo(t){return JSON.stringify(jd.FileChunk$outboundSchema.parse(t))}function mmo(t){return(0,fmo.safeParse)(t,e=>jd.FileChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileChunk' from JSON")}});var mst=S(Dd=>{"use strict";var hmo=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]}),gmo=Dd&&Dd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ymo=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"&&hmo(r,e,n[o]);return gmo(r,e),r}}();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.ImageURL$=Dd.ImageURL$outboundSchema=Dd.ImageURL$inboundSchema=void 0;Dd.imageURLToJSON=_mo;Dd.imageURLFromJSON=vmo;var cq=ymo(te()),bmo=ee();Dd.ImageURL$inboundSchema=cq.object({url:cq.string(),detail:cq.nullable(cq.string()).optional()});Dd.ImageURL$outboundSchema=cq.object({url:cq.string(),detail:cq.nullable(cq.string()).optional()});var Yvr;(function(t){t.inboundSchema=Dd.ImageURL$inboundSchema,t.outboundSchema=Dd.ImageURL$outboundSchema})(Yvr||(Dd.ImageURL$=Yvr={}));function _mo(t){return JSON.stringify(Dd.ImageURL$outboundSchema.parse(t))}function vmo(t){return(0,bmo.safeParse)(t,e=>Dd.ImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURL' from JSON")}});var pV=S(ro=>{"use strict";var wmo=ro&&ro.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Smo=ro&&ro.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cmo=ro&&ro.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&wmo(r,e,n[o]);return Smo(r,e),r}}();Object.defineProperty(ro,"__esModule",{value:!0});ro.ImageURLChunk$=ro.ImageURLChunk$outboundSchema=ro.ImageURLChunk$inboundSchema=ro.ImageURLChunkType$=ro.ImageURLChunkType$outboundSchema=ro.ImageURLChunkType$inboundSchema=ro.ImageURLChunkImageURL$=ro.ImageURLChunkImageURL$outboundSchema=ro.ImageURLChunkImageURL$inboundSchema=ro.ImageURLChunkType=void 0;ro.imageURLChunkImageURLToJSON=xmo;ro.imageURLChunkImageURLFromJSON=Omo;ro.imageURLChunkToJSON=Tmo;ro.imageURLChunkFromJSON=Emo;var XC=Cmo(te()),rwr=ae(),nwr=ee(),DEe=mst();ro.ImageURLChunkType={ImageUrl:"image_url"};ro.ImageURLChunkImageURL$inboundSchema=XC.union([DEe.ImageURL$inboundSchema,XC.string()]);ro.ImageURLChunkImageURL$outboundSchema=XC.union([DEe.ImageURL$outboundSchema,XC.string()]);var Qvr;(function(t){t.inboundSchema=ro.ImageURLChunkImageURL$inboundSchema,t.outboundSchema=ro.ImageURLChunkImageURL$outboundSchema})(Qvr||(ro.ImageURLChunkImageURL$=Qvr={}));function xmo(t){return JSON.stringify(ro.ImageURLChunkImageURL$outboundSchema.parse(t))}function Omo(t){return(0,nwr.safeParse)(t,e=>ro.ImageURLChunkImageURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunkImageURL' from JSON")}ro.ImageURLChunkType$inboundSchema=XC.nativeEnum(ro.ImageURLChunkType);ro.ImageURLChunkType$outboundSchema=ro.ImageURLChunkType$inboundSchema;var ewr;(function(t){t.inboundSchema=ro.ImageURLChunkType$inboundSchema,t.outboundSchema=ro.ImageURLChunkType$outboundSchema})(ewr||(ro.ImageURLChunkType$=ewr={}));ro.ImageURLChunk$inboundSchema=XC.object({image_url:XC.union([DEe.ImageURL$inboundSchema,XC.string()]),type:ro.ImageURLChunkType$inboundSchema.default("image_url")}).transform(t=>(0,rwr.remap)(t,{image_url:"imageUrl"}));ro.ImageURLChunk$outboundSchema=XC.object({imageUrl:XC.union([DEe.ImageURL$outboundSchema,XC.string()]),type:ro.ImageURLChunkType$outboundSchema.default("image_url")}).transform(t=>(0,rwr.remap)(t,{imageUrl:"image_url"}));var twr;(function(t){t.inboundSchema=ro.ImageURLChunk$inboundSchema,t.outboundSchema=ro.ImageURLChunk$outboundSchema})(twr||(ro.ImageURLChunk$=twr={}));function Tmo(t){return JSON.stringify(ro.ImageURLChunk$outboundSchema.parse(t))}function Emo(t){return(0,nwr.safeParse)(t,e=>ro.ImageURLChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ImageURLChunk' from JSON")}});var $Ee=S(la=>{"use strict";var Pmo=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]}),Mmo=la&&la.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rmo=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"&&Pmo(r,e,n[o]);return Mmo(r,e),r}}();Object.defineProperty(la,"__esModule",{value:!0});la.ReferenceChunk$=la.ReferenceChunk$outboundSchema=la.ReferenceChunk$inboundSchema=la.ReferenceChunkType$=la.ReferenceChunkType$outboundSchema=la.ReferenceChunkType$inboundSchema=la.ReferenceChunkType=void 0;la.referenceChunkToJSON=Imo;la.referenceChunkFromJSON=Nmo;var mV=Rmo(te()),awr=ae(),Amo=ee();la.ReferenceChunkType={Reference:"reference"};la.ReferenceChunkType$inboundSchema=mV.nativeEnum(la.ReferenceChunkType);la.ReferenceChunkType$outboundSchema=la.ReferenceChunkType$inboundSchema;var owr;(function(t){t.inboundSchema=la.ReferenceChunkType$inboundSchema,t.outboundSchema=la.ReferenceChunkType$outboundSchema})(owr||(la.ReferenceChunkType$=owr={}));la.ReferenceChunk$inboundSchema=mV.object({reference_ids:mV.array(mV.number().int()),type:la.ReferenceChunkType$inboundSchema.default("reference")}).transform(t=>(0,awr.remap)(t,{reference_ids:"referenceIds"}));la.ReferenceChunk$outboundSchema=mV.object({referenceIds:mV.array(mV.number().int()),type:la.ReferenceChunkType$outboundSchema.default("reference")}).transform(t=>(0,awr.remap)(t,{referenceIds:"reference_ids"}));var iwr;(function(t){t.inboundSchema=la.ReferenceChunk$inboundSchema,t.outboundSchema=la.ReferenceChunk$outboundSchema})(iwr||(la.ReferenceChunk$=iwr={}));function Imo(t){return JSON.stringify(la.ReferenceChunk$outboundSchema.parse(t))}function Nmo(t){return(0,Amo.safeParse)(t,e=>la.ReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ReferenceChunk' from JSON")}});var dq=S(ca=>{"use strict";var jmo=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]}),Dmo=ca&&ca.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$mo=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"&&jmo(r,e,n[o]);return Dmo(r,e),r}}();Object.defineProperty(ca,"__esModule",{value:!0});ca.TextChunk$=ca.TextChunk$outboundSchema=ca.TextChunk$inboundSchema=ca.TextChunkType$=ca.TextChunkType$outboundSchema=ca.TextChunkType$inboundSchema=ca.TextChunkType=void 0;ca.textChunkToJSON=Fmo;ca.textChunkFromJSON=kmo;var Oae=$mo(te()),Lmo=ee();ca.TextChunkType={Text:"text"};ca.TextChunkType$inboundSchema=Oae.nativeEnum(ca.TextChunkType);ca.TextChunkType$outboundSchema=ca.TextChunkType$inboundSchema;var swr;(function(t){t.inboundSchema=ca.TextChunkType$inboundSchema,t.outboundSchema=ca.TextChunkType$outboundSchema})(swr||(ca.TextChunkType$=swr={}));ca.TextChunk$inboundSchema=Oae.object({text:Oae.string(),type:ca.TextChunkType$inboundSchema.default("text")});ca.TextChunk$outboundSchema=Oae.object({text:Oae.string(),type:ca.TextChunkType$outboundSchema.default("text")});var uwr;(function(t){t.inboundSchema=ca.TextChunk$inboundSchema,t.outboundSchema=ca.TextChunk$outboundSchema})(uwr||(ca.TextChunk$=uwr={}));function Fmo(t){return JSON.stringify(ca.TextChunk$outboundSchema.parse(t))}function kmo(t){return(0,Lmo.safeParse)(t,e=>ca.TextChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TextChunk' from JSON")}});var hV=S(no=>{"use strict";var qmo=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]}),Bmo=no&&no.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Umo=no&&no.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&qmo(r,e,n[o]);return Bmo(r,e),r}}();Object.defineProperty(no,"__esModule",{value:!0});no.ThinkChunk$=no.ThinkChunk$outboundSchema=no.ThinkChunk$inboundSchema=no.ThinkChunkType$=no.ThinkChunkType$outboundSchema=no.ThinkChunkType$inboundSchema=no.Thinking$=no.Thinking$outboundSchema=no.Thinking$inboundSchema=no.ThinkChunkType=void 0;no.thinkingToJSON=zmo;no.thinkingFromJSON=Hmo;no.thinkChunkToJSON=Vmo;no.thinkChunkFromJSON=Jmo;var YC=Umo(te()),fwr=ee(),LEe=$Ee(),FEe=dq();no.ThinkChunkType={Thinking:"thinking"};no.Thinking$inboundSchema=YC.union([LEe.ReferenceChunk$inboundSchema,FEe.TextChunk$inboundSchema]);no.Thinking$outboundSchema=YC.union([LEe.ReferenceChunk$outboundSchema,FEe.TextChunk$outboundSchema]);var lwr;(function(t){t.inboundSchema=no.Thinking$inboundSchema,t.outboundSchema=no.Thinking$outboundSchema})(lwr||(no.Thinking$=lwr={}));function zmo(t){return JSON.stringify(no.Thinking$outboundSchema.parse(t))}function Hmo(t){return(0,fwr.safeParse)(t,e=>no.Thinking$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Thinking' from JSON")}no.ThinkChunkType$inboundSchema=YC.nativeEnum(no.ThinkChunkType);no.ThinkChunkType$outboundSchema=no.ThinkChunkType$inboundSchema;var cwr;(function(t){t.inboundSchema=no.ThinkChunkType$inboundSchema,t.outboundSchema=no.ThinkChunkType$outboundSchema})(cwr||(no.ThinkChunkType$=cwr={}));no.ThinkChunk$inboundSchema=YC.object({thinking:YC.array(YC.union([LEe.ReferenceChunk$inboundSchema,FEe.TextChunk$inboundSchema])),closed:YC.boolean().optional(),type:no.ThinkChunkType$inboundSchema.default("thinking")});no.ThinkChunk$outboundSchema=YC.object({thinking:YC.array(YC.union([LEe.ReferenceChunk$outboundSchema,FEe.TextChunk$outboundSchema])),closed:YC.boolean().optional(),type:no.ThinkChunkType$outboundSchema.default("thinking")});var dwr;(function(t){t.inboundSchema=no.ThinkChunk$inboundSchema,t.outboundSchema=no.ThinkChunk$outboundSchema})(dwr||(no.ThinkChunk$=dwr={}));function Vmo(t){return JSON.stringify(no.ThinkChunk$outboundSchema.parse(t))}function Jmo(t){return(0,fwr.safeParse)(t,e=>no.ThinkChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ThinkChunk' from JSON")}});var r9=S($d=>{"use strict";var Kmo=$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]}),Wmo=$d&&$d.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gmo=$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"&&Kmo(r,e,n[o]);return Wmo(r,e),r}}();Object.defineProperty($d,"__esModule",{value:!0});$d.ContentChunk$=$d.ContentChunk$outboundSchema=$d.ContentChunk$inboundSchema=void 0;$d.contentChunkToJSON=Xmo;$d.contentChunkFromJSON=Ymo;var Hs=Gmo(te()),Zmo=ee(),mwr=pst(),hwr=fV(),gwr=jEe(),ywr=pV(),bwr=$Ee(),_wr=dq(),vwr=hV();$d.ContentChunk$inboundSchema=Hs.union([ywr.ImageURLChunk$inboundSchema.and(Hs.object({type:Hs.literal("image_url")}).transform(t=>({type:t.type}))),hwr.DocumentURLChunk$inboundSchema.and(Hs.object({type:Hs.literal("document_url")}).transform(t=>({type:t.type}))),_wr.TextChunk$inboundSchema.and(Hs.object({type:Hs.literal("text")}).transform(t=>({type:t.type}))),bwr.ReferenceChunk$inboundSchema.and(Hs.object({type:Hs.literal("reference")}).transform(t=>({type:t.type}))),gwr.FileChunk$inboundSchema.and(Hs.object({type:Hs.literal("file")}).transform(t=>({type:t.type}))),vwr.ThinkChunk$inboundSchema.and(Hs.object({type:Hs.literal("thinking")}).transform(t=>({type:t.type}))),mwr.AudioChunk$inboundSchema.and(Hs.object({type:Hs.literal("input_audio")}).transform(t=>({type:t.type})))]);$d.ContentChunk$outboundSchema=Hs.union([ywr.ImageURLChunk$outboundSchema.and(Hs.object({type:Hs.literal("image_url")}).transform(t=>({type:t.type}))),hwr.DocumentURLChunk$outboundSchema.and(Hs.object({type:Hs.literal("document_url")}).transform(t=>({type:t.type}))),_wr.TextChunk$outboundSchema.and(Hs.object({type:Hs.literal("text")}).transform(t=>({type:t.type}))),bwr.ReferenceChunk$outboundSchema.and(Hs.object({type:Hs.literal("reference")}).transform(t=>({type:t.type}))),gwr.FileChunk$outboundSchema.and(Hs.object({type:Hs.literal("file")}).transform(t=>({type:t.type}))),vwr.ThinkChunk$outboundSchema.and(Hs.object({type:Hs.literal("thinking")}).transform(t=>({type:t.type}))),mwr.AudioChunk$outboundSchema.and(Hs.object({type:Hs.literal("input_audio")}).transform(t=>({type:t.type})))]);var pwr;(function(t){t.inboundSchema=$d.ContentChunk$inboundSchema,t.outboundSchema=$d.ContentChunk$outboundSchema})(pwr||($d.ContentChunk$=pwr={}));function Xmo(t){return JSON.stringify($d.ContentChunk$outboundSchema.parse(t))}function Ymo(t){return(0,Zmo.safeParse)(t,e=>$d.ContentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ContentChunk' from JSON")}});var hst=S(ss=>{"use strict";var Qmo=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]}),eho=ss&&ss.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tho=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"&&Qmo(r,e,n[o]);return eho(r,e),r}}();Object.defineProperty(ss,"__esModule",{value:!0});ss.FunctionCall$=ss.FunctionCall$outboundSchema=ss.FunctionCall$inboundSchema=ss.Arguments$=ss.Arguments$outboundSchema=ss.Arguments$inboundSchema=void 0;ss.argumentsToJSON=rho;ss.argumentsFromJSON=nho;ss.functionCallToJSON=oho;ss.functionCallFromJSON=iho;var Ld=tho(te()),Cwr=ee();ss.Arguments$inboundSchema=Ld.union([Ld.record(Ld.any()),Ld.string()]);ss.Arguments$outboundSchema=Ld.union([Ld.record(Ld.any()),Ld.string()]);var wwr;(function(t){t.inboundSchema=ss.Arguments$inboundSchema,t.outboundSchema=ss.Arguments$outboundSchema})(wwr||(ss.Arguments$=wwr={}));function rho(t){return JSON.stringify(ss.Arguments$outboundSchema.parse(t))}function nho(t){return(0,Cwr.safeParse)(t,e=>ss.Arguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Arguments' from JSON")}ss.FunctionCall$inboundSchema=Ld.object({name:Ld.string(),arguments:Ld.union([Ld.record(Ld.any()),Ld.string()])});ss.FunctionCall$outboundSchema=Ld.object({name:Ld.string(),arguments:Ld.union([Ld.record(Ld.any()),Ld.string()])});var Swr;(function(t){t.inboundSchema=ss.FunctionCall$inboundSchema,t.outboundSchema=ss.FunctionCall$outboundSchema})(Swr||(ss.FunctionCall$=Swr={}));function oho(t){return JSON.stringify(ss.FunctionCall$outboundSchema.parse(t))}function iho(t){return(0,Cwr.safeParse)(t,e=>ss.FunctionCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCall' from JSON")}});var QC=S(gst=>{"use strict";Object.defineProperty(gst,"__esModule",{value:!0});gst.catchUnrecognizedEnum=aho;function aho(t){return t}});var Tae=S(Fd=>{"use strict";var sho=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]}),uho=Fd&&Fd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lho=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"&&sho(r,e,n[o]);return uho(r,e),r}}();Object.defineProperty(Fd,"__esModule",{value:!0});Fd.ToolTypes$=Fd.ToolTypes$outboundSchema=Fd.ToolTypes$inboundSchema=Fd.ToolTypes=void 0;var gV=lho(te()),cho=QC();Fd.ToolTypes={Function:"function"};Fd.ToolTypes$inboundSchema=gV.union([gV.nativeEnum(Fd.ToolTypes),gV.string().transform(cho.catchUnrecognizedEnum)]);Fd.ToolTypes$outboundSchema=gV.union([gV.nativeEnum(Fd.ToolTypes),gV.string().and(gV.custom())]);var xwr;(function(t){t.inboundSchema=Fd.ToolTypes$inboundSchema,t.outboundSchema=Fd.ToolTypes$outboundSchema})(xwr||(Fd.ToolTypes$=xwr={}))});var kEe=S(kd=>{"use strict";var dho=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]}),fho=kd&&kd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pho=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"&&dho(r,e,n[o]);return fho(r,e),r}}();Object.defineProperty(kd,"__esModule",{value:!0});kd.ToolCall$=kd.ToolCall$outboundSchema=kd.ToolCall$inboundSchema=void 0;kd.toolCallToJSON=hho;kd.toolCallFromJSON=gho;var n9=pho(te()),mho=ee(),Twr=hst(),Ewr=Tae();kd.ToolCall$inboundSchema=n9.object({id:n9.string().default("null"),type:Ewr.ToolTypes$inboundSchema.optional(),function:Twr.FunctionCall$inboundSchema,index:n9.number().int().default(0)});kd.ToolCall$outboundSchema=n9.object({id:n9.string().default("null"),type:Ewr.ToolTypes$outboundSchema.optional(),function:Twr.FunctionCall$outboundSchema,index:n9.number().int().default(0)});var Owr;(function(t){t.inboundSchema=kd.ToolCall$inboundSchema,t.outboundSchema=kd.ToolCall$outboundSchema})(Owr||(kd.ToolCall$=Owr={}));function hho(t){return JSON.stringify(kd.ToolCall$outboundSchema.parse(t))}function gho(t){return(0,mho.safeParse)(t,e=>kd.ToolCall$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolCall' from JSON")}});var zA=S(oo=>{"use strict";var yho=oo&&oo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bho=oo&&oo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_ho=oo&&oo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yho(r,e,n[o]);return bho(r,e),r}}();Object.defineProperty(oo,"__esModule",{value:!0});oo.AssistantMessage$=oo.AssistantMessage$outboundSchema=oo.AssistantMessage$inboundSchema=oo.AssistantMessageRole$=oo.AssistantMessageRole$outboundSchema=oo.AssistantMessageRole$inboundSchema=oo.AssistantMessageContent$=oo.AssistantMessageContent$outboundSchema=oo.AssistantMessageContent$inboundSchema=oo.AssistantMessageRole=void 0;oo.assistantMessageContentToJSON=vho;oo.assistantMessageContentFromJSON=who;oo.assistantMessageToJSON=Sho;oo.assistantMessageFromJSON=Cho;var mc=_ho(te()),Awr=ae(),Iwr=ee(),qEe=r9(),Nwr=kEe();oo.AssistantMessageRole={Assistant:"assistant"};oo.AssistantMessageContent$inboundSchema=mc.union([mc.string(),mc.array(qEe.ContentChunk$inboundSchema)]);oo.AssistantMessageContent$outboundSchema=mc.union([mc.string(),mc.array(qEe.ContentChunk$outboundSchema)]);var Pwr;(function(t){t.inboundSchema=oo.AssistantMessageContent$inboundSchema,t.outboundSchema=oo.AssistantMessageContent$outboundSchema})(Pwr||(oo.AssistantMessageContent$=Pwr={}));function vho(t){return JSON.stringify(oo.AssistantMessageContent$outboundSchema.parse(t))}function who(t){return(0,Iwr.safeParse)(t,e=>oo.AssistantMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessageContent' from JSON")}oo.AssistantMessageRole$inboundSchema=mc.nativeEnum(oo.AssistantMessageRole);oo.AssistantMessageRole$outboundSchema=oo.AssistantMessageRole$inboundSchema;var Mwr;(function(t){t.inboundSchema=oo.AssistantMessageRole$inboundSchema,t.outboundSchema=oo.AssistantMessageRole$outboundSchema})(Mwr||(oo.AssistantMessageRole$=Mwr={}));oo.AssistantMessage$inboundSchema=mc.object({content:mc.nullable(mc.union([mc.string(),mc.array(qEe.ContentChunk$inboundSchema)])).optional(),tool_calls:mc.nullable(mc.array(Nwr.ToolCall$inboundSchema)).optional(),prefix:mc.boolean().default(!1),role:oo.AssistantMessageRole$inboundSchema.default("assistant")}).transform(t=>(0,Awr.remap)(t,{tool_calls:"toolCalls"}));oo.AssistantMessage$outboundSchema=mc.object({content:mc.nullable(mc.union([mc.string(),mc.array(qEe.ContentChunk$outboundSchema)])).optional(),toolCalls:mc.nullable(mc.array(Nwr.ToolCall$outboundSchema)).optional(),prefix:mc.boolean().default(!1),role:oo.AssistantMessageRole$outboundSchema.default("assistant")}).transform(t=>(0,Awr.remap)(t,{toolCalls:"tool_calls"}));var Rwr;(function(t){t.inboundSchema=oo.AssistantMessage$inboundSchema,t.outboundSchema=oo.AssistantMessage$outboundSchema})(Rwr||(oo.AssistantMessage$=Rwr={}));function Sho(t){return JSON.stringify(oo.AssistantMessage$outboundSchema.parse(t))}function Cho(t){return(0,Iwr.safeParse)(t,e=>oo.AssistantMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AssistantMessage' from JSON")}});var o9=S(qd=>{"use strict";var xho=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]}),Oho=qd&&qd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tho=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"&&xho(r,e,n[o]);return Oho(r,e),r}}();Object.defineProperty(qd,"__esModule",{value:!0});qd.MistralPromptMode$=qd.MistralPromptMode$outboundSchema=qd.MistralPromptMode$inboundSchema=qd.MistralPromptMode=void 0;var yV=Tho(te()),Eho=QC();qd.MistralPromptMode={Reasoning:"reasoning"};qd.MistralPromptMode$inboundSchema=yV.union([yV.nativeEnum(qd.MistralPromptMode),yV.string().transform(Eho.catchUnrecognizedEnum)]);qd.MistralPromptMode$outboundSchema=yV.union([yV.nativeEnum(qd.MistralPromptMode),yV.string().and(yV.custom())]);var jwr;(function(t){t.inboundSchema=qd.MistralPromptMode$inboundSchema,t.outboundSchema=qd.MistralPromptMode$outboundSchema})(jwr||(qd.MistralPromptMode$=jwr={}))});var yst=S(Bd=>{"use strict";var Pho=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]}),Mho=Bd&&Bd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rho=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"&&Pho(r,e,n[o]);return Mho(r,e),r}}();Object.defineProperty(Bd,"__esModule",{value:!0});Bd.SystemMessageContentChunks$=Bd.SystemMessageContentChunks$outboundSchema=Bd.SystemMessageContentChunks$inboundSchema=void 0;Bd.systemMessageContentChunksToJSON=Iho;Bd.systemMessageContentChunksFromJSON=Nho;var HA=Rho(te()),Aho=ee(),$wr=dq(),Lwr=hV();Bd.SystemMessageContentChunks$inboundSchema=HA.union([$wr.TextChunk$inboundSchema.and(HA.object({type:HA.literal("text")}).transform(t=>({type:t.type}))),Lwr.ThinkChunk$inboundSchema.and(HA.object({type:HA.literal("thinking")}).transform(t=>({type:t.type})))]);Bd.SystemMessageContentChunks$outboundSchema=HA.union([$wr.TextChunk$outboundSchema.and(HA.object({type:HA.literal("text")}).transform(t=>({type:t.type}))),Lwr.ThinkChunk$outboundSchema.and(HA.object({type:HA.literal("thinking")}).transform(t=>({type:t.type})))]);var Dwr;(function(t){t.inboundSchema=Bd.SystemMessageContentChunks$inboundSchema,t.outboundSchema=Bd.SystemMessageContentChunks$outboundSchema})(Dwr||(Bd.SystemMessageContentChunks$=Dwr={}));function Iho(t){return JSON.stringify(Bd.SystemMessageContentChunks$outboundSchema.parse(t))}function Nho(t){return(0,Aho.safeParse)(t,e=>Bd.SystemMessageContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContentChunks' from JSON")}});var pj=S(io=>{"use strict";var jho=io&&io.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Dho=io&&io.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$ho=io&&io.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&jho(r,e,n[o]);return Dho(r,e),r}}();Object.defineProperty(io,"__esModule",{value:!0});io.SystemMessage$=io.SystemMessage$outboundSchema=io.SystemMessage$inboundSchema=io.Role$=io.Role$outboundSchema=io.Role$inboundSchema=io.SystemMessageContent$=io.SystemMessageContent$outboundSchema=io.SystemMessageContent$inboundSchema=io.Role=void 0;io.systemMessageContentToJSON=Lho;io.systemMessageContentFromJSON=Fho;io.systemMessageToJSON=kho;io.systemMessageFromJSON=qho;var wb=$ho(te()),Bwr=ee(),BEe=yst();io.Role={System:"system"};io.SystemMessageContent$inboundSchema=wb.union([wb.string(),wb.array(BEe.SystemMessageContentChunks$inboundSchema)]);io.SystemMessageContent$outboundSchema=wb.union([wb.string(),wb.array(BEe.SystemMessageContentChunks$outboundSchema)]);var Fwr;(function(t){t.inboundSchema=io.SystemMessageContent$inboundSchema,t.outboundSchema=io.SystemMessageContent$outboundSchema})(Fwr||(io.SystemMessageContent$=Fwr={}));function Lho(t){return JSON.stringify(io.SystemMessageContent$outboundSchema.parse(t))}function Fho(t){return(0,Bwr.safeParse)(t,e=>io.SystemMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessageContent' from JSON")}io.Role$inboundSchema=wb.nativeEnum(io.Role);io.Role$outboundSchema=io.Role$inboundSchema;var kwr;(function(t){t.inboundSchema=io.Role$inboundSchema,t.outboundSchema=io.Role$outboundSchema})(kwr||(io.Role$=kwr={}));io.SystemMessage$inboundSchema=wb.object({content:wb.union([wb.string(),wb.array(BEe.SystemMessageContentChunks$inboundSchema)]),role:io.Role$inboundSchema.default("system")});io.SystemMessage$outboundSchema=wb.object({content:wb.union([wb.string(),wb.array(BEe.SystemMessageContentChunks$outboundSchema)]),role:io.Role$outboundSchema.default("system")});var qwr;(function(t){t.inboundSchema=io.SystemMessage$inboundSchema,t.outboundSchema=io.SystemMessage$outboundSchema})(qwr||(io.SystemMessage$=qwr={}));function kho(t){return JSON.stringify(io.SystemMessage$outboundSchema.parse(t))}function qho(t){return(0,Bwr.safeParse)(t,e=>io.SystemMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SystemMessage' from JSON")}});var i9=S(Ud=>{"use strict";var Bho=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]}),Uho=Ud&&Ud.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zho=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"&&Bho(r,e,n[o]);return Uho(r,e),r}}();Object.defineProperty(Ud,"__esModule",{value:!0});Ud.Tool$=Ud.Tool$outboundSchema=Ud.Tool$inboundSchema=void 0;Ud.toolToJSON=Vho;Ud.toolFromJSON=Jho;var zwr=zho(te()),Hho=ee(),Hwr=wEe(),Vwr=Tae();Ud.Tool$inboundSchema=zwr.object({type:Vwr.ToolTypes$inboundSchema.optional(),function:Hwr.FunctionT$inboundSchema});Ud.Tool$outboundSchema=zwr.object({type:Vwr.ToolTypes$outboundSchema.optional(),function:Hwr.FunctionT$outboundSchema});var Uwr;(function(t){t.inboundSchema=Ud.Tool$inboundSchema,t.outboundSchema=Ud.Tool$outboundSchema})(Uwr||(Ud.Tool$=Uwr={}));function Vho(t){return JSON.stringify(Ud.Tool$outboundSchema.parse(t))}function Jho(t){return(0,Hho.safeParse)(t,e=>Ud.Tool$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tool' from JSON")}});var bst=S(zd=>{"use strict";var Kho=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]}),Who=zd&&zd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gho=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"&&Kho(r,e,n[o]);return Who(r,e),r}}();Object.defineProperty(zd,"__esModule",{value:!0});zd.FunctionName$=zd.FunctionName$outboundSchema=zd.FunctionName$inboundSchema=void 0;zd.functionNameToJSON=Xho;zd.functionNameFromJSON=Yho;var UEe=Gho(te()),Zho=ee();zd.FunctionName$inboundSchema=UEe.object({name:UEe.string()});zd.FunctionName$outboundSchema=UEe.object({name:UEe.string()});var Jwr;(function(t){t.inboundSchema=zd.FunctionName$inboundSchema,t.outboundSchema=zd.FunctionName$outboundSchema})(Jwr||(zd.FunctionName$=Jwr={}));function Xho(t){return JSON.stringify(zd.FunctionName$outboundSchema.parse(t))}function Yho(t){return(0,Zho.safeParse)(t,e=>zd.FunctionName$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionName' from JSON")}});var a9=S(Hd=>{"use strict";var Qho=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]}),ego=Hd&&Hd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tgo=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"&&Qho(r,e,n[o]);return ego(r,e),r}}();Object.defineProperty(Hd,"__esModule",{value:!0});Hd.ToolChoice$=Hd.ToolChoice$outboundSchema=Hd.ToolChoice$inboundSchema=void 0;Hd.toolChoiceToJSON=ngo;Hd.toolChoiceFromJSON=ogo;var Wwr=tgo(te()),rgo=ee(),Gwr=bst(),Zwr=Tae();Hd.ToolChoice$inboundSchema=Wwr.object({type:Zwr.ToolTypes$inboundSchema.optional(),function:Gwr.FunctionName$inboundSchema});Hd.ToolChoice$outboundSchema=Wwr.object({type:Zwr.ToolTypes$outboundSchema.optional(),function:Gwr.FunctionName$outboundSchema});var Kwr;(function(t){t.inboundSchema=Hd.ToolChoice$inboundSchema,t.outboundSchema=Hd.ToolChoice$outboundSchema})(Kwr||(Hd.ToolChoice$=Kwr={}));function ngo(t){return JSON.stringify(Hd.ToolChoice$outboundSchema.parse(t))}function ogo(t){return(0,rgo.safeParse)(t,e=>Hd.ToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolChoice' from JSON")}});var mj=S(ao=>{"use strict";var igo=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]}),ago=ao&&ao.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sgo=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"&&igo(r,e,n[o]);return ago(r,e),r}}();Object.defineProperty(ao,"__esModule",{value:!0});ao.ToolMessage$=ao.ToolMessage$outboundSchema=ao.ToolMessage$inboundSchema=ao.ToolMessageRole$=ao.ToolMessageRole$outboundSchema=ao.ToolMessageRole$inboundSchema=ao.ToolMessageContent$=ao.ToolMessageContent$outboundSchema=ao.ToolMessageContent$inboundSchema=ao.ToolMessageRole=void 0;ao.toolMessageContentToJSON=ugo;ao.toolMessageContentFromJSON=lgo;ao.toolMessageToJSON=cgo;ao.toolMessageFromJSON=dgo;var hl=sgo(te()),eSr=ae(),tSr=ee(),zEe=r9();ao.ToolMessageRole={Tool:"tool"};ao.ToolMessageContent$inboundSchema=hl.union([hl.string(),hl.array(zEe.ContentChunk$inboundSchema)]);ao.ToolMessageContent$outboundSchema=hl.union([hl.string(),hl.array(zEe.ContentChunk$outboundSchema)]);var Xwr;(function(t){t.inboundSchema=ao.ToolMessageContent$inboundSchema,t.outboundSchema=ao.ToolMessageContent$outboundSchema})(Xwr||(ao.ToolMessageContent$=Xwr={}));function ugo(t){return JSON.stringify(ao.ToolMessageContent$outboundSchema.parse(t))}function lgo(t){return(0,tSr.safeParse)(t,e=>ao.ToolMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessageContent' from JSON")}ao.ToolMessageRole$inboundSchema=hl.nativeEnum(ao.ToolMessageRole);ao.ToolMessageRole$outboundSchema=ao.ToolMessageRole$inboundSchema;var Ywr;(function(t){t.inboundSchema=ao.ToolMessageRole$inboundSchema,t.outboundSchema=ao.ToolMessageRole$outboundSchema})(Ywr||(ao.ToolMessageRole$=Ywr={}));ao.ToolMessage$inboundSchema=hl.object({content:hl.nullable(hl.union([hl.string(),hl.array(zEe.ContentChunk$inboundSchema)])),tool_call_id:hl.nullable(hl.string()).optional(),name:hl.nullable(hl.string()).optional(),role:ao.ToolMessageRole$inboundSchema.default("tool")}).transform(t=>(0,eSr.remap)(t,{tool_call_id:"toolCallId"}));ao.ToolMessage$outboundSchema=hl.object({content:hl.nullable(hl.union([hl.string(),hl.array(zEe.ContentChunk$outboundSchema)])),toolCallId:hl.nullable(hl.string()).optional(),name:hl.nullable(hl.string()).optional(),role:ao.ToolMessageRole$outboundSchema.default("tool")}).transform(t=>(0,eSr.remap)(t,{toolCallId:"tool_call_id"}));var Qwr;(function(t){t.inboundSchema=ao.ToolMessage$inboundSchema,t.outboundSchema=ao.ToolMessage$outboundSchema})(Qwr||(ao.ToolMessage$=Qwr={}));function cgo(t){return JSON.stringify(ao.ToolMessage$outboundSchema.parse(t))}function dgo(t){return(0,tSr.safeParse)(t,e=>ao.ToolMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolMessage' from JSON")}});var hj=S(so=>{"use strict";var fgo=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]}),pgo=so&&so.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mgo=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"&&fgo(r,e,n[o]);return pgo(r,e),r}}();Object.defineProperty(so,"__esModule",{value:!0});so.UserMessage$=so.UserMessage$outboundSchema=so.UserMessage$inboundSchema=so.UserMessageRole$=so.UserMessageRole$outboundSchema=so.UserMessageRole$inboundSchema=so.UserMessageContent$=so.UserMessageContent$outboundSchema=so.UserMessageContent$inboundSchema=so.UserMessageRole=void 0;so.userMessageContentToJSON=hgo;so.userMessageContentFromJSON=ggo;so.userMessageToJSON=ygo;so.userMessageFromJSON=bgo;var Og=mgo(te()),iSr=ee(),HEe=r9();so.UserMessageRole={User:"user"};so.UserMessageContent$inboundSchema=Og.union([Og.string(),Og.array(HEe.ContentChunk$inboundSchema)]);so.UserMessageContent$outboundSchema=Og.union([Og.string(),Og.array(HEe.ContentChunk$outboundSchema)]);var rSr;(function(t){t.inboundSchema=so.UserMessageContent$inboundSchema,t.outboundSchema=so.UserMessageContent$outboundSchema})(rSr||(so.UserMessageContent$=rSr={}));function hgo(t){return JSON.stringify(so.UserMessageContent$outboundSchema.parse(t))}function ggo(t){return(0,iSr.safeParse)(t,e=>so.UserMessageContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessageContent' from JSON")}so.UserMessageRole$inboundSchema=Og.nativeEnum(so.UserMessageRole);so.UserMessageRole$outboundSchema=so.UserMessageRole$inboundSchema;var nSr;(function(t){t.inboundSchema=so.UserMessageRole$inboundSchema,t.outboundSchema=so.UserMessageRole$outboundSchema})(nSr||(so.UserMessageRole$=nSr={}));so.UserMessage$inboundSchema=Og.object({content:Og.nullable(Og.union([Og.string(),Og.array(HEe.ContentChunk$inboundSchema)])),role:so.UserMessageRole$inboundSchema.default("user")});so.UserMessage$outboundSchema=Og.object({content:Og.nullable(Og.union([Og.string(),Og.array(HEe.ContentChunk$outboundSchema)])),role:so.UserMessageRole$outboundSchema.default("user")});var oSr;(function(t){t.inboundSchema=so.UserMessage$inboundSchema,t.outboundSchema=so.UserMessage$outboundSchema})(oSr||(so.UserMessage$=oSr={}));function ygo(t){return JSON.stringify(so.UserMessage$outboundSchema.parse(t))}function bgo(t){return(0,iSr.safeParse)(t,e=>so.UserMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UserMessage' from JSON")}});var hSr=S(Hr=>{"use strict";var _go=Hr&&Hr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),vgo=Hr&&Hr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wgo=Hr&&Hr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&_go(r,e,n[o]);return vgo(r,e),r}}();Object.defineProperty(Hr,"__esModule",{value:!0});Hr.AgentsCompletionRequest$=Hr.AgentsCompletionRequest$outboundSchema=Hr.AgentsCompletionRequest$inboundSchema=Hr.AgentsCompletionRequestToolChoice$=Hr.AgentsCompletionRequestToolChoice$outboundSchema=Hr.AgentsCompletionRequestToolChoice$inboundSchema=Hr.AgentsCompletionRequestMessages$=Hr.AgentsCompletionRequestMessages$outboundSchema=Hr.AgentsCompletionRequestMessages$inboundSchema=Hr.AgentsCompletionRequestStop$=Hr.AgentsCompletionRequestStop$outboundSchema=Hr.AgentsCompletionRequestStop$inboundSchema=void 0;Hr.agentsCompletionRequestStopToJSON=Sgo;Hr.agentsCompletionRequestStopFromJSON=Cgo;Hr.agentsCompletionRequestMessagesToJSON=xgo;Hr.agentsCompletionRequestMessagesFromJSON=Ogo;Hr.agentsCompletionRequestToolChoiceToJSON=Tgo;Hr.agentsCompletionRequestToolChoiceFromJSON=Ego;Hr.agentsCompletionRequestToJSON=Pgo;Hr.agentsCompletionRequestFromJSON=Mgo;var ft=wgo(te()),cSr=ae(),VEe=ee(),JEe=zA(),dSr=o9(),fSr=lV(),pSr=oq(),KEe=pj(),mSr=i9(),WEe=a9(),GEe=cV(),ZEe=mj(),XEe=hj();Hr.AgentsCompletionRequestStop$inboundSchema=ft.union([ft.string(),ft.array(ft.string())]);Hr.AgentsCompletionRequestStop$outboundSchema=ft.union([ft.string(),ft.array(ft.string())]);var aSr;(function(t){t.inboundSchema=Hr.AgentsCompletionRequestStop$inboundSchema,t.outboundSchema=Hr.AgentsCompletionRequestStop$outboundSchema})(aSr||(Hr.AgentsCompletionRequestStop$=aSr={}));function Sgo(t){return JSON.stringify(Hr.AgentsCompletionRequestStop$outboundSchema.parse(t))}function Cgo(t){return(0,VEe.safeParse)(t,e=>Hr.AgentsCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestStop' from JSON")}Hr.AgentsCompletionRequestMessages$inboundSchema=ft.union([KEe.SystemMessage$inboundSchema.and(ft.object({role:ft.literal("system")}).transform(t=>({role:t.role}))),ZEe.ToolMessage$inboundSchema.and(ft.object({role:ft.literal("tool")}).transform(t=>({role:t.role}))),XEe.UserMessage$inboundSchema.and(ft.object({role:ft.literal("user")}).transform(t=>({role:t.role}))),JEe.AssistantMessage$inboundSchema.and(ft.object({role:ft.literal("assistant")}).transform(t=>({role:t.role})))]);Hr.AgentsCompletionRequestMessages$outboundSchema=ft.union([KEe.SystemMessage$outboundSchema.and(ft.object({role:ft.literal("system")}).transform(t=>({role:t.role}))),ZEe.ToolMessage$outboundSchema.and(ft.object({role:ft.literal("tool")}).transform(t=>({role:t.role}))),XEe.UserMessage$outboundSchema.and(ft.object({role:ft.literal("user")}).transform(t=>({role:t.role}))),JEe.AssistantMessage$outboundSchema.and(ft.object({role:ft.literal("assistant")}).transform(t=>({role:t.role})))]);var sSr;(function(t){t.inboundSchema=Hr.AgentsCompletionRequestMessages$inboundSchema,t.outboundSchema=Hr.AgentsCompletionRequestMessages$outboundSchema})(sSr||(Hr.AgentsCompletionRequestMessages$=sSr={}));function xgo(t){return JSON.stringify(Hr.AgentsCompletionRequestMessages$outboundSchema.parse(t))}function Ogo(t){return(0,VEe.safeParse)(t,e=>Hr.AgentsCompletionRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestMessages' from JSON")}Hr.AgentsCompletionRequestToolChoice$inboundSchema=ft.union([WEe.ToolChoice$inboundSchema,GEe.ToolChoiceEnum$inboundSchema]);Hr.AgentsCompletionRequestToolChoice$outboundSchema=ft.union([WEe.ToolChoice$outboundSchema,GEe.ToolChoiceEnum$outboundSchema]);var uSr;(function(t){t.inboundSchema=Hr.AgentsCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Hr.AgentsCompletionRequestToolChoice$outboundSchema})(uSr||(Hr.AgentsCompletionRequestToolChoice$=uSr={}));function Tgo(t){return JSON.stringify(Hr.AgentsCompletionRequestToolChoice$outboundSchema.parse(t))}function Ego(t){return(0,VEe.safeParse)(t,e=>Hr.AgentsCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequestToolChoice' from JSON")}Hr.AgentsCompletionRequest$inboundSchema=ft.object({max_tokens:ft.nullable(ft.number().int()).optional(),stream:ft.boolean().default(!1),stop:ft.union([ft.string(),ft.array(ft.string())]).optional(),random_seed:ft.nullable(ft.number().int()).optional(),messages:ft.array(ft.union([KEe.SystemMessage$inboundSchema.and(ft.object({role:ft.literal("system")}).transform(t=>({role:t.role}))),ZEe.ToolMessage$inboundSchema.and(ft.object({role:ft.literal("tool")}).transform(t=>({role:t.role}))),XEe.UserMessage$inboundSchema.and(ft.object({role:ft.literal("user")}).transform(t=>({role:t.role}))),JEe.AssistantMessage$inboundSchema.and(ft.object({role:ft.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:pSr.ResponseFormat$inboundSchema.optional(),tools:ft.nullable(ft.array(mSr.Tool$inboundSchema)).optional(),tool_choice:ft.union([WEe.ToolChoice$inboundSchema,GEe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:ft.number().optional(),frequency_penalty:ft.number().optional(),n:ft.nullable(ft.number().int()).optional(),prediction:fSr.Prediction$inboundSchema.optional(),parallel_tool_calls:ft.boolean().optional(),prompt_mode:ft.nullable(dSr.MistralPromptMode$inboundSchema).optional(),agent_id:ft.string()}).transform(t=>(0,cSr.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"}));Hr.AgentsCompletionRequest$outboundSchema=ft.object({maxTokens:ft.nullable(ft.number().int()).optional(),stream:ft.boolean().default(!1),stop:ft.union([ft.string(),ft.array(ft.string())]).optional(),randomSeed:ft.nullable(ft.number().int()).optional(),messages:ft.array(ft.union([KEe.SystemMessage$outboundSchema.and(ft.object({role:ft.literal("system")}).transform(t=>({role:t.role}))),ZEe.ToolMessage$outboundSchema.and(ft.object({role:ft.literal("tool")}).transform(t=>({role:t.role}))),XEe.UserMessage$outboundSchema.and(ft.object({role:ft.literal("user")}).transform(t=>({role:t.role}))),JEe.AssistantMessage$outboundSchema.and(ft.object({role:ft.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:pSr.ResponseFormat$outboundSchema.optional(),tools:ft.nullable(ft.array(mSr.Tool$outboundSchema)).optional(),toolChoice:ft.union([WEe.ToolChoice$outboundSchema,GEe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:ft.number().optional(),frequencyPenalty:ft.number().optional(),n:ft.nullable(ft.number().int()).optional(),prediction:fSr.Prediction$outboundSchema.optional(),parallelToolCalls:ft.boolean().optional(),promptMode:ft.nullable(dSr.MistralPromptMode$outboundSchema).optional(),agentId:ft.string()}).transform(t=>(0,cSr.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 lSr;(function(t){t.inboundSchema=Hr.AgentsCompletionRequest$inboundSchema,t.outboundSchema=Hr.AgentsCompletionRequest$outboundSchema})(lSr||(Hr.AgentsCompletionRequest$=lSr={}));function Pgo(t){return JSON.stringify(Hr.AgentsCompletionRequest$outboundSchema.parse(t))}function Mgo(t){return(0,VEe.safeParse)(t,e=>Hr.AgentsCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionRequest' from JSON")}});var OSr=S(Vr=>{"use strict";var Rgo=Vr&&Vr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ago=Vr&&Vr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Igo=Vr&&Vr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Rgo(r,e,n[o]);return Ago(r,e),r}}();Object.defineProperty(Vr,"__esModule",{value:!0});Vr.AgentsCompletionStreamRequest$=Vr.AgentsCompletionStreamRequest$outboundSchema=Vr.AgentsCompletionStreamRequest$inboundSchema=Vr.AgentsCompletionStreamRequestToolChoice$=Vr.AgentsCompletionStreamRequestToolChoice$outboundSchema=Vr.AgentsCompletionStreamRequestToolChoice$inboundSchema=Vr.AgentsCompletionStreamRequestMessages$=Vr.AgentsCompletionStreamRequestMessages$outboundSchema=Vr.AgentsCompletionStreamRequestMessages$inboundSchema=Vr.AgentsCompletionStreamRequestStop$=Vr.AgentsCompletionStreamRequestStop$outboundSchema=Vr.AgentsCompletionStreamRequestStop$inboundSchema=void 0;Vr.agentsCompletionStreamRequestStopToJSON=Ngo;Vr.agentsCompletionStreamRequestStopFromJSON=jgo;Vr.agentsCompletionStreamRequestMessagesToJSON=Dgo;Vr.agentsCompletionStreamRequestMessagesFromJSON=$go;Vr.agentsCompletionStreamRequestToolChoiceToJSON=Lgo;Vr.agentsCompletionStreamRequestToolChoiceFromJSON=Fgo;Vr.agentsCompletionStreamRequestToJSON=kgo;Vr.agentsCompletionStreamRequestFromJSON=qgo;var pt=Igo(te()),vSr=ae(),YEe=ee(),QEe=zA(),wSr=o9(),SSr=lV(),CSr=oq(),ePe=pj(),xSr=i9(),tPe=a9(),rPe=cV(),nPe=mj(),oPe=hj();Vr.AgentsCompletionStreamRequestStop$inboundSchema=pt.union([pt.string(),pt.array(pt.string())]);Vr.AgentsCompletionStreamRequestStop$outboundSchema=pt.union([pt.string(),pt.array(pt.string())]);var gSr;(function(t){t.inboundSchema=Vr.AgentsCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Vr.AgentsCompletionStreamRequestStop$outboundSchema})(gSr||(Vr.AgentsCompletionStreamRequestStop$=gSr={}));function Ngo(t){return JSON.stringify(Vr.AgentsCompletionStreamRequestStop$outboundSchema.parse(t))}function jgo(t){return(0,YEe.safeParse)(t,e=>Vr.AgentsCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestStop' from JSON")}Vr.AgentsCompletionStreamRequestMessages$inboundSchema=pt.union([ePe.SystemMessage$inboundSchema.and(pt.object({role:pt.literal("system")}).transform(t=>({role:t.role}))),nPe.ToolMessage$inboundSchema.and(pt.object({role:pt.literal("tool")}).transform(t=>({role:t.role}))),oPe.UserMessage$inboundSchema.and(pt.object({role:pt.literal("user")}).transform(t=>({role:t.role}))),QEe.AssistantMessage$inboundSchema.and(pt.object({role:pt.literal("assistant")}).transform(t=>({role:t.role})))]);Vr.AgentsCompletionStreamRequestMessages$outboundSchema=pt.union([ePe.SystemMessage$outboundSchema.and(pt.object({role:pt.literal("system")}).transform(t=>({role:t.role}))),nPe.ToolMessage$outboundSchema.and(pt.object({role:pt.literal("tool")}).transform(t=>({role:t.role}))),oPe.UserMessage$outboundSchema.and(pt.object({role:pt.literal("user")}).transform(t=>({role:t.role}))),QEe.AssistantMessage$outboundSchema.and(pt.object({role:pt.literal("assistant")}).transform(t=>({role:t.role})))]);var ySr;(function(t){t.inboundSchema=Vr.AgentsCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Vr.AgentsCompletionStreamRequestMessages$outboundSchema})(ySr||(Vr.AgentsCompletionStreamRequestMessages$=ySr={}));function Dgo(t){return JSON.stringify(Vr.AgentsCompletionStreamRequestMessages$outboundSchema.parse(t))}function $go(t){return(0,YEe.safeParse)(t,e=>Vr.AgentsCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestMessages' from JSON")}Vr.AgentsCompletionStreamRequestToolChoice$inboundSchema=pt.union([tPe.ToolChoice$inboundSchema,rPe.ToolChoiceEnum$inboundSchema]);Vr.AgentsCompletionStreamRequestToolChoice$outboundSchema=pt.union([tPe.ToolChoice$outboundSchema,rPe.ToolChoiceEnum$outboundSchema]);var bSr;(function(t){t.inboundSchema=Vr.AgentsCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Vr.AgentsCompletionStreamRequestToolChoice$outboundSchema})(bSr||(Vr.AgentsCompletionStreamRequestToolChoice$=bSr={}));function Lgo(t){return JSON.stringify(Vr.AgentsCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function Fgo(t){return(0,YEe.safeParse)(t,e=>Vr.AgentsCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequestToolChoice' from JSON")}Vr.AgentsCompletionStreamRequest$inboundSchema=pt.object({max_tokens:pt.nullable(pt.number().int()).optional(),stream:pt.boolean().default(!0),stop:pt.union([pt.string(),pt.array(pt.string())]).optional(),random_seed:pt.nullable(pt.number().int()).optional(),messages:pt.array(pt.union([ePe.SystemMessage$inboundSchema.and(pt.object({role:pt.literal("system")}).transform(t=>({role:t.role}))),nPe.ToolMessage$inboundSchema.and(pt.object({role:pt.literal("tool")}).transform(t=>({role:t.role}))),oPe.UserMessage$inboundSchema.and(pt.object({role:pt.literal("user")}).transform(t=>({role:t.role}))),QEe.AssistantMessage$inboundSchema.and(pt.object({role:pt.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:CSr.ResponseFormat$inboundSchema.optional(),tools:pt.nullable(pt.array(xSr.Tool$inboundSchema)).optional(),tool_choice:pt.union([tPe.ToolChoice$inboundSchema,rPe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:pt.number().optional(),frequency_penalty:pt.number().optional(),n:pt.nullable(pt.number().int()).optional(),prediction:SSr.Prediction$inboundSchema.optional(),parallel_tool_calls:pt.boolean().optional(),prompt_mode:pt.nullable(wSr.MistralPromptMode$inboundSchema).optional(),agent_id:pt.string()}).transform(t=>(0,vSr.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"}));Vr.AgentsCompletionStreamRequest$outboundSchema=pt.object({maxTokens:pt.nullable(pt.number().int()).optional(),stream:pt.boolean().default(!0),stop:pt.union([pt.string(),pt.array(pt.string())]).optional(),randomSeed:pt.nullable(pt.number().int()).optional(),messages:pt.array(pt.union([ePe.SystemMessage$outboundSchema.and(pt.object({role:pt.literal("system")}).transform(t=>({role:t.role}))),nPe.ToolMessage$outboundSchema.and(pt.object({role:pt.literal("tool")}).transform(t=>({role:t.role}))),oPe.UserMessage$outboundSchema.and(pt.object({role:pt.literal("user")}).transform(t=>({role:t.role}))),QEe.AssistantMessage$outboundSchema.and(pt.object({role:pt.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:CSr.ResponseFormat$outboundSchema.optional(),tools:pt.nullable(pt.array(xSr.Tool$outboundSchema)).optional(),toolChoice:pt.union([tPe.ToolChoice$outboundSchema,rPe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:pt.number().optional(),frequencyPenalty:pt.number().optional(),n:pt.nullable(pt.number().int()).optional(),prediction:SSr.Prediction$outboundSchema.optional(),parallelToolCalls:pt.boolean().optional(),promptMode:pt.nullable(wSr.MistralPromptMode$outboundSchema).optional(),agentId:pt.string()}).transform(t=>(0,vSr.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 _Sr;(function(t){t.inboundSchema=Vr.AgentsCompletionStreamRequest$inboundSchema,t.outboundSchema=Vr.AgentsCompletionStreamRequest$outboundSchema})(_Sr||(Vr.AgentsCompletionStreamRequest$=_Sr={}));function kgo(t){return JSON.stringify(Vr.AgentsCompletionStreamRequest$outboundSchema.parse(t))}function qgo(t){return(0,YEe.safeParse)(t,e=>Vr.AgentsCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsCompletionStreamRequest' from JSON")}});var ASr=S(us=>{"use strict";var Bgo=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]}),Ugo=us&&us.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zgo=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"&&Bgo(r,e,n[o]);return Ugo(r,e),r}}();Object.defineProperty(us,"__esModule",{value:!0});us.AgentUpdateRequest$=us.AgentUpdateRequest$outboundSchema=us.AgentUpdateRequest$inboundSchema=us.AgentUpdateRequestTools$=us.AgentUpdateRequestTools$outboundSchema=us.AgentUpdateRequestTools$inboundSchema=void 0;us.agentUpdateRequestToolsToJSON=Hgo;us.agentUpdateRequestToolsFromJSON=Vgo;us.agentUpdateRequestToJSON=Jgo;us.agentUpdateRequestFromJSON=Kgo;var Ft=zgo(te()),PSr=ae(),MSr=ee(),iPe=rq(),RSr=HS(),aPe=iq(),sPe=aq(),uPe=sq(),lPe=uq(),cPe=lq();us.AgentUpdateRequestTools$inboundSchema=Ft.union([aPe.DocumentLibraryTool$inboundSchema.and(Ft.object({type:Ft.literal("document_library")}).transform(t=>({type:t.type}))),sPe.FunctionTool$inboundSchema.and(Ft.object({type:Ft.literal("function")}).transform(t=>({type:t.type}))),iPe.CodeInterpreterTool$inboundSchema.and(Ft.object({type:Ft.literal("code_interpreter")}).transform(t=>({type:t.type}))),uPe.ImageGenerationTool$inboundSchema.and(Ft.object({type:Ft.literal("image_generation")}).transform(t=>({type:t.type}))),cPe.WebSearchTool$inboundSchema.and(Ft.object({type:Ft.literal("web_search")}).transform(t=>({type:t.type}))),lPe.WebSearchPremiumTool$inboundSchema.and(Ft.object({type:Ft.literal("web_search_premium")}).transform(t=>({type:t.type})))]);us.AgentUpdateRequestTools$outboundSchema=Ft.union([aPe.DocumentLibraryTool$outboundSchema.and(Ft.object({type:Ft.literal("document_library")}).transform(t=>({type:t.type}))),sPe.FunctionTool$outboundSchema.and(Ft.object({type:Ft.literal("function")}).transform(t=>({type:t.type}))),iPe.CodeInterpreterTool$outboundSchema.and(Ft.object({type:Ft.literal("code_interpreter")}).transform(t=>({type:t.type}))),uPe.ImageGenerationTool$outboundSchema.and(Ft.object({type:Ft.literal("image_generation")}).transform(t=>({type:t.type}))),cPe.WebSearchTool$outboundSchema.and(Ft.object({type:Ft.literal("web_search")}).transform(t=>({type:t.type}))),lPe.WebSearchPremiumTool$outboundSchema.and(Ft.object({type:Ft.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var TSr;(function(t){t.inboundSchema=us.AgentUpdateRequestTools$inboundSchema,t.outboundSchema=us.AgentUpdateRequestTools$outboundSchema})(TSr||(us.AgentUpdateRequestTools$=TSr={}));function Hgo(t){return JSON.stringify(us.AgentUpdateRequestTools$outboundSchema.parse(t))}function Vgo(t){return(0,MSr.safeParse)(t,e=>us.AgentUpdateRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentUpdateRequestTools' from JSON")}us.AgentUpdateRequest$inboundSchema=Ft.object({instructions:Ft.nullable(Ft.string()).optional(),tools:Ft.array(Ft.union([aPe.DocumentLibraryTool$inboundSchema.and(Ft.object({type:Ft.literal("document_library")}).transform(t=>({type:t.type}))),sPe.FunctionTool$inboundSchema.and(Ft.object({type:Ft.literal("function")}).transform(t=>({type:t.type}))),iPe.CodeInterpreterTool$inboundSchema.and(Ft.object({type:Ft.literal("code_interpreter")}).transform(t=>({type:t.type}))),uPe.ImageGenerationTool$inboundSchema.and(Ft.object({type:Ft.literal("image_generation")}).transform(t=>({type:t.type}))),cPe.WebSearchTool$inboundSchema.and(Ft.object({type:Ft.literal("web_search")}).transform(t=>({type:t.type}))),lPe.WebSearchPremiumTool$inboundSchema.and(Ft.object({type:Ft.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:RSr.CompletionArgs$inboundSchema.optional(),model:Ft.nullable(Ft.string()).optional(),name:Ft.nullable(Ft.string()).optional(),description:Ft.nullable(Ft.string()).optional(),handoffs:Ft.nullable(Ft.array(Ft.string())).optional()}).transform(t=>(0,PSr.remap)(t,{completion_args:"completionArgs"}));us.AgentUpdateRequest$outboundSchema=Ft.object({instructions:Ft.nullable(Ft.string()).optional(),tools:Ft.array(Ft.union([aPe.DocumentLibraryTool$outboundSchema.and(Ft.object({type:Ft.literal("document_library")}).transform(t=>({type:t.type}))),sPe.FunctionTool$outboundSchema.and(Ft.object({type:Ft.literal("function")}).transform(t=>({type:t.type}))),iPe.CodeInterpreterTool$outboundSchema.and(Ft.object({type:Ft.literal("code_interpreter")}).transform(t=>({type:t.type}))),uPe.ImageGenerationTool$outboundSchema.and(Ft.object({type:Ft.literal("image_generation")}).transform(t=>({type:t.type}))),cPe.WebSearchTool$outboundSchema.and(Ft.object({type:Ft.literal("web_search")}).transform(t=>({type:t.type}))),lPe.WebSearchPremiumTool$outboundSchema.and(Ft.object({type:Ft.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:RSr.CompletionArgs$outboundSchema.optional(),model:Ft.nullable(Ft.string()).optional(),name:Ft.nullable(Ft.string()).optional(),description:Ft.nullable(Ft.string()).optional(),handoffs:Ft.nullable(Ft.array(Ft.string())).optional()}).transform(t=>(0,PSr.remap)(t,{completionArgs:"completion_args"}));var ESr;(function(t){t.inboundSchema=us.AgentUpdateRequest$inboundSchema,t.outboundSchema=us.AgentUpdateRequest$outboundSchema})(ESr||(us.AgentUpdateRequest$=ESr={}));function Jgo(t){return JSON.stringify(us.AgentUpdateRequest$outboundSchema.parse(t))}function Kgo(t){return(0,MSr.safeParse)(t,e=>us.AgentUpdateRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentUpdateRequest' from JSON")}});var _st=S(Vd=>{"use strict";var Wgo=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]}),Ggo=Vd&&Vd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zgo=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"&&Wgo(r,e,n[o]);return Ggo(r,e),r}}();Object.defineProperty(Vd,"__esModule",{value:!0});Vd.ApiEndpoint$=Vd.ApiEndpoint$outboundSchema=Vd.ApiEndpoint$inboundSchema=Vd.ApiEndpoint=void 0;var bV=Zgo(te()),Xgo=QC();Vd.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"};Vd.ApiEndpoint$inboundSchema=bV.union([bV.nativeEnum(Vd.ApiEndpoint),bV.string().transform(Xgo.catchUnrecognizedEnum)]);Vd.ApiEndpoint$outboundSchema=bV.union([bV.nativeEnum(Vd.ApiEndpoint),bV.string().and(bV.custom())]);var ISr;(function(t){t.inboundSchema=Vd.ApiEndpoint$inboundSchema,t.outboundSchema=Vd.ApiEndpoint$outboundSchema})(ISr||(Vd.ApiEndpoint$=ISr={}))});var DSr=S(da=>{"use strict";var Ygo=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]}),Qgo=da&&da.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eyo=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"&&Ygo(r,e,n[o]);return Qgo(r,e),r}}();Object.defineProperty(da,"__esModule",{value:!0});da.ArchiveFTModelOut$=da.ArchiveFTModelOut$outboundSchema=da.ArchiveFTModelOut$inboundSchema=da.ArchiveFTModelOutObject$=da.ArchiveFTModelOutObject$outboundSchema=da.ArchiveFTModelOutObject$inboundSchema=da.ArchiveFTModelOutObject=void 0;da.archiveFTModelOutToJSON=ryo;da.archiveFTModelOutFromJSON=nyo;var _V=eyo(te()),tyo=ee();da.ArchiveFTModelOutObject={Model:"model"};da.ArchiveFTModelOutObject$inboundSchema=_V.nativeEnum(da.ArchiveFTModelOutObject);da.ArchiveFTModelOutObject$outboundSchema=da.ArchiveFTModelOutObject$inboundSchema;var NSr;(function(t){t.inboundSchema=da.ArchiveFTModelOutObject$inboundSchema,t.outboundSchema=da.ArchiveFTModelOutObject$outboundSchema})(NSr||(da.ArchiveFTModelOutObject$=NSr={}));da.ArchiveFTModelOut$inboundSchema=_V.object({id:_V.string(),object:da.ArchiveFTModelOutObject$inboundSchema.default("model"),archived:_V.boolean().default(!0)});da.ArchiveFTModelOut$outboundSchema=_V.object({id:_V.string(),object:da.ArchiveFTModelOutObject$outboundSchema.default("model"),archived:_V.boolean().default(!0)});var jSr;(function(t){t.inboundSchema=da.ArchiveFTModelOut$inboundSchema,t.outboundSchema=da.ArchiveFTModelOut$outboundSchema})(jSr||(da.ArchiveFTModelOut$=jSr={}));function ryo(t){return JSON.stringify(da.ArchiveFTModelOut$outboundSchema.parse(t))}function nyo(t){return(0,tyo.safeParse)(t,e=>da.ArchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ArchiveFTModelOut' from JSON")}});var gj=S(ex=>{"use strict";var oyo=ex&&ex.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iyo=ex&&ex.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ayo=ex&&ex.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&oyo(r,e,n[o]);return iyo(r,e),r}}();Object.defineProperty(ex,"__esModule",{value:!0});ex.blobLikeSchema=void 0;ex.isBlobLike=$Sr;var syo=ayo(te());ex.blobLikeSchema=syo.custom($Sr,{message:"expected a Blob, File or Blob-like object",fatal:!0});function $Sr(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 dPe=S(Jd=>{"use strict";var uyo=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]}),lyo=Jd&&Jd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cyo=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"&&uyo(r,e,n[o]);return lyo(r,e),r}}();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.FileT$=Jd.FileT$outboundSchema=Jd.FileT$inboundSchema=void 0;Jd.fileToJSON=fyo;Jd.fileFromJSON=pyo;var D_=cyo(te()),dyo=ee();Jd.FileT$inboundSchema=D_.object({fileName:D_.string(),content:D_.union([D_.instanceof(ReadableStream),D_.instanceof(Blob),D_.instanceof(ArrayBuffer),D_.instanceof(Uint8Array)])});Jd.FileT$outboundSchema=D_.object({fileName:D_.string(),content:D_.union([D_.instanceof(ReadableStream),D_.instanceof(Blob),D_.instanceof(ArrayBuffer),D_.instanceof(Uint8Array)])});var LSr;(function(t){t.inboundSchema=Jd.FileT$inboundSchema,t.outboundSchema=Jd.FileT$outboundSchema})(LSr||(Jd.FileT$=LSr={}));function fyo(t){return JSON.stringify(Jd.FileT$outboundSchema.parse(t))}function pyo(t){return(0,dyo.safeParse)(t,e=>Jd.FileT$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileT' from JSON")}});var fPe=S(Kd=>{"use strict";var myo=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]}),hyo=Kd&&Kd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gyo=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"&&myo(r,e,n[o]);return hyo(r,e),r}}();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.TimestampGranularity$=Kd.TimestampGranularity$outboundSchema=Kd.TimestampGranularity$inboundSchema=Kd.TimestampGranularity=void 0;var yyo=gyo(te());Kd.TimestampGranularity={Segment:"segment"};Kd.TimestampGranularity$inboundSchema=yyo.nativeEnum(Kd.TimestampGranularity);Kd.TimestampGranularity$outboundSchema=Kd.TimestampGranularity$inboundSchema;var FSr;(function(t){t.inboundSchema=Kd.TimestampGranularity$inboundSchema,t.outboundSchema=Kd.TimestampGranularity$outboundSchema})(FSr||(Kd.TimestampGranularity$=FSr={}))});var zSr=S(Wd=>{"use strict";var byo=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]}),_yo=Wd&&Wd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vyo=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"&&byo(r,e,n[o]);return _yo(r,e),r}}();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.AudioTranscriptionRequest$=Wd.AudioTranscriptionRequest$outboundSchema=Wd.AudioTranscriptionRequest$inboundSchema=void 0;Wd.audioTranscriptionRequestToJSON=Cyo;Wd.audioTranscriptionRequestFromJSON=xyo;var Bl=vyo(te()),qSr=ae(),wyo=ee(),Syo=gj(),BSr=dPe(),USr=fPe();Wd.AudioTranscriptionRequest$inboundSchema=Bl.object({model:Bl.string(),file:BSr.FileT$inboundSchema.optional(),file_url:Bl.nullable(Bl.string()).optional(),file_id:Bl.nullable(Bl.string()).optional(),language:Bl.nullable(Bl.string()).optional(),temperature:Bl.nullable(Bl.number()).optional(),stream:Bl.literal(!1).default(!1),timestamp_granularities:Bl.array(USr.TimestampGranularity$inboundSchema).optional()}).transform(t=>(0,qSr.remap)(t,{file_url:"fileUrl",file_id:"fileId",timestamp_granularities:"timestampGranularities"}));Wd.AudioTranscriptionRequest$outboundSchema=Bl.object({model:Bl.string(),file:BSr.FileT$outboundSchema.or(Syo.blobLikeSchema).optional(),fileUrl:Bl.nullable(Bl.string()).optional(),fileId:Bl.nullable(Bl.string()).optional(),language:Bl.nullable(Bl.string()).optional(),temperature:Bl.nullable(Bl.number()).optional(),stream:Bl.literal(!1).default(!1),timestampGranularities:Bl.array(USr.TimestampGranularity$outboundSchema).optional()}).transform(t=>(0,qSr.remap)(t,{fileUrl:"file_url",fileId:"file_id",timestampGranularities:"timestamp_granularities"}));var kSr;(function(t){t.inboundSchema=Wd.AudioTranscriptionRequest$inboundSchema,t.outboundSchema=Wd.AudioTranscriptionRequest$outboundSchema})(kSr||(Wd.AudioTranscriptionRequest$=kSr={}));function Cyo(t){return JSON.stringify(Wd.AudioTranscriptionRequest$outboundSchema.parse(t))}function xyo(t){return(0,wyo.safeParse)(t,e=>Wd.AudioTranscriptionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioTranscriptionRequest' from JSON")}});var WSr=S(Gd=>{"use strict";var Oyo=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]}),Tyo=Gd&&Gd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Eyo=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"&&Oyo(r,e,n[o]);return Tyo(r,e),r}}();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.AudioTranscriptionRequestStream$=Gd.AudioTranscriptionRequestStream$outboundSchema=Gd.AudioTranscriptionRequestStream$inboundSchema=void 0;Gd.audioTranscriptionRequestStreamToJSON=Ryo;Gd.audioTranscriptionRequestStreamFromJSON=Ayo;var Ul=Eyo(te()),VSr=ae(),Pyo=ee(),Myo=gj(),JSr=dPe(),KSr=fPe();Gd.AudioTranscriptionRequestStream$inboundSchema=Ul.object({model:Ul.string(),file:JSr.FileT$inboundSchema.optional(),file_url:Ul.nullable(Ul.string()).optional(),file_id:Ul.nullable(Ul.string()).optional(),language:Ul.nullable(Ul.string()).optional(),temperature:Ul.nullable(Ul.number()).optional(),stream:Ul.literal(!0).default(!0),timestamp_granularities:Ul.array(KSr.TimestampGranularity$inboundSchema).optional()}).transform(t=>(0,VSr.remap)(t,{file_url:"fileUrl",file_id:"fileId",timestamp_granularities:"timestampGranularities"}));Gd.AudioTranscriptionRequestStream$outboundSchema=Ul.object({model:Ul.string(),file:JSr.FileT$outboundSchema.or(Myo.blobLikeSchema).optional(),fileUrl:Ul.nullable(Ul.string()).optional(),fileId:Ul.nullable(Ul.string()).optional(),language:Ul.nullable(Ul.string()).optional(),temperature:Ul.nullable(Ul.number()).optional(),stream:Ul.literal(!0).default(!0),timestampGranularities:Ul.array(KSr.TimestampGranularity$outboundSchema).optional()}).transform(t=>(0,VSr.remap)(t,{fileUrl:"file_url",fileId:"file_id",timestampGranularities:"timestamp_granularities"}));var HSr;(function(t){t.inboundSchema=Gd.AudioTranscriptionRequestStream$inboundSchema,t.outboundSchema=Gd.AudioTranscriptionRequestStream$outboundSchema})(HSr||(Gd.AudioTranscriptionRequestStream$=HSr={}));function Ryo(t){return JSON.stringify(Gd.AudioTranscriptionRequestStream$outboundSchema.parse(t))}function Ayo(t){return(0,Pyo.safeParse)(t,e=>Gd.AudioTranscriptionRequestStream$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AudioTranscriptionRequestStream' from JSON")}});var pPe=S(Zd=>{"use strict";var Iyo=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]}),Nyo=Zd&&Zd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jyo=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"&&Iyo(r,e,n[o]);return Nyo(r,e),r}}();Object.defineProperty(Zd,"__esModule",{value:!0});Zd.ModelCapabilities$=Zd.ModelCapabilities$outboundSchema=Zd.ModelCapabilities$inboundSchema=void 0;Zd.modelCapabilitiesToJSON=$yo;Zd.modelCapabilitiesFromJSON=Lyo;var $_=jyo(te()),ZSr=ae(),Dyo=ee();Zd.ModelCapabilities$inboundSchema=$_.object({completion_chat:$_.boolean().default(!0),completion_fim:$_.boolean().default(!1),function_calling:$_.boolean().default(!0),fine_tuning:$_.boolean().default(!1),vision:$_.boolean().default(!1),classification:$_.boolean().default(!1)}).transform(t=>(0,ZSr.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));Zd.ModelCapabilities$outboundSchema=$_.object({completionChat:$_.boolean().default(!0),completionFim:$_.boolean().default(!1),functionCalling:$_.boolean().default(!0),fineTuning:$_.boolean().default(!1),vision:$_.boolean().default(!1),classification:$_.boolean().default(!1)}).transform(t=>(0,ZSr.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var GSr;(function(t){t.inboundSchema=Zd.ModelCapabilities$inboundSchema,t.outboundSchema=Zd.ModelCapabilities$outboundSchema})(GSr||(Zd.ModelCapabilities$=GSr={}));function $yo(t){return JSON.stringify(Zd.ModelCapabilities$outboundSchema.parse(t))}function Lyo(t){return(0,Dyo.safeParse)(t,e=>Zd.ModelCapabilities$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelCapabilities' from JSON")}});var vst=S(ls=>{"use strict";var Fyo=ls&&ls.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kyo=ls&&ls.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qyo=ls&&ls.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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(ls,"__esModule",{value:!0});ls.BaseModelCard$=ls.BaseModelCard$outboundSchema=ls.BaseModelCard$inboundSchema=ls.BaseModelCardType$=ls.BaseModelCardType$outboundSchema=ls.BaseModelCardType$inboundSchema=ls.BaseModelCardType=void 0;ls.baseModelCardToJSON=Uyo;ls.baseModelCardFromJSON=zyo;var di=qyo(te()),QSr=ae(),Byo=ee(),e0r=pPe();ls.BaseModelCardType={Base:"base"};ls.BaseModelCardType$inboundSchema=di.nativeEnum(ls.BaseModelCardType);ls.BaseModelCardType$outboundSchema=ls.BaseModelCardType$inboundSchema;var XSr;(function(t){t.inboundSchema=ls.BaseModelCardType$inboundSchema,t.outboundSchema=ls.BaseModelCardType$outboundSchema})(XSr||(ls.BaseModelCardType$=XSr={}));ls.BaseModelCard$inboundSchema=di.object({id:di.string(),object:di.string().default("model"),created:di.number().int().optional(),owned_by:di.string().default("mistralai"),capabilities:e0r.ModelCapabilities$inboundSchema,name:di.nullable(di.string()).optional(),description:di.nullable(di.string()).optional(),max_context_length:di.number().int().default(32768),aliases:di.array(di.string()).optional(),deprecation:di.nullable(di.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),deprecation_replacement_model:di.nullable(di.string()).optional(),default_model_temperature:di.nullable(di.number()).optional(),type:di.literal("base").default("base")}).transform(t=>(0,QSr.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",deprecation_replacement_model:"deprecationReplacementModel",default_model_temperature:"defaultModelTemperature"}));ls.BaseModelCard$outboundSchema=di.object({id:di.string(),object:di.string().default("model"),created:di.number().int().optional(),ownedBy:di.string().default("mistralai"),capabilities:e0r.ModelCapabilities$outboundSchema,name:di.nullable(di.string()).optional(),description:di.nullable(di.string()).optional(),maxContextLength:di.number().int().default(32768),aliases:di.array(di.string()).optional(),deprecation:di.nullable(di.date().transform(t=>t.toISOString())).optional(),deprecationReplacementModel:di.nullable(di.string()).optional(),defaultModelTemperature:di.nullable(di.number()).optional(),type:di.literal("base").default("base")}).transform(t=>(0,QSr.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",deprecationReplacementModel:"deprecation_replacement_model",defaultModelTemperature:"default_model_temperature"}));var YSr;(function(t){t.inboundSchema=ls.BaseModelCard$inboundSchema,t.outboundSchema=ls.BaseModelCard$outboundSchema})(YSr||(ls.BaseModelCard$=YSr={}));function Uyo(t){return JSON.stringify(ls.BaseModelCard$outboundSchema.parse(t))}function zyo(t){return(0,Byo.safeParse)(t,e=>ls.BaseModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BaseModelCard' from JSON")}});var wst=S(Xd=>{"use strict";var Hyo=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]}),Vyo=Xd&&Xd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jyo=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"&&Hyo(r,e,n[o]);return Vyo(r,e),r}}();Object.defineProperty(Xd,"__esModule",{value:!0});Xd.BatchError$=Xd.BatchError$outboundSchema=Xd.BatchError$inboundSchema=void 0;Xd.batchErrorToJSON=Wyo;Xd.batchErrorFromJSON=Gyo;var s9=Jyo(te()),Kyo=ee();Xd.BatchError$inboundSchema=s9.object({message:s9.string(),count:s9.number().int().default(1)});Xd.BatchError$outboundSchema=s9.object({message:s9.string(),count:s9.number().int().default(1)});var t0r;(function(t){t.inboundSchema=Xd.BatchError$inboundSchema,t.outboundSchema=Xd.BatchError$outboundSchema})(t0r||(Xd.BatchError$=t0r={}));function Wyo(t){return JSON.stringify(Xd.BatchError$outboundSchema.parse(t))}function Gyo(t){return(0,Kyo.safeParse)(t,e=>Xd.BatchError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchError' from JSON")}});var i0r=S(Yd=>{"use strict";var Zyo=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]}),Xyo=Yd&&Yd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yyo=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"&&Zyo(r,e,n[o]);return Xyo(r,e),r}}();Object.defineProperty(Yd,"__esModule",{value:!0});Yd.BatchJobIn$=Yd.BatchJobIn$outboundSchema=Yd.BatchJobIn$inboundSchema=void 0;Yd.batchJobInToJSON=ebo;Yd.batchJobInFromJSON=tbo;var Dc=Yyo(te()),n0r=ae(),Qyo=ee(),o0r=_st();Yd.BatchJobIn$inboundSchema=Dc.object({input_files:Dc.array(Dc.string()),endpoint:o0r.ApiEndpoint$inboundSchema,model:Dc.nullable(Dc.string()).optional(),agent_id:Dc.nullable(Dc.string()).optional(),metadata:Dc.nullable(Dc.record(Dc.string())).optional(),timeout_hours:Dc.number().int().default(24)}).transform(t=>(0,n0r.remap)(t,{input_files:"inputFiles",agent_id:"agentId",timeout_hours:"timeoutHours"}));Yd.BatchJobIn$outboundSchema=Dc.object({inputFiles:Dc.array(Dc.string()),endpoint:o0r.ApiEndpoint$outboundSchema,model:Dc.nullable(Dc.string()).optional(),agentId:Dc.nullable(Dc.string()).optional(),metadata:Dc.nullable(Dc.record(Dc.string())).optional(),timeoutHours:Dc.number().int().default(24)}).transform(t=>(0,n0r.remap)(t,{inputFiles:"input_files",agentId:"agent_id",timeoutHours:"timeout_hours"}));var r0r;(function(t){t.inboundSchema=Yd.BatchJobIn$inboundSchema,t.outboundSchema=Yd.BatchJobIn$outboundSchema})(r0r||(Yd.BatchJobIn$=r0r={}));function ebo(t){return JSON.stringify(Yd.BatchJobIn$outboundSchema.parse(t))}function tbo(t){return(0,Qyo.safeParse)(t,e=>Yd.BatchJobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobIn' from JSON")}});var Sst=S(Qd=>{"use strict";var rbo=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]}),nbo=Qd&&Qd.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),obo=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"&&rbo(r,e,n[o]);return nbo(r,e),r}}();Object.defineProperty(Qd,"__esModule",{value:!0});Qd.BatchJobStatus$=Qd.BatchJobStatus$outboundSchema=Qd.BatchJobStatus$inboundSchema=Qd.BatchJobStatus=void 0;var ibo=obo(te());Qd.BatchJobStatus={Queued:"QUEUED",Running:"RUNNING",Success:"SUCCESS",Failed:"FAILED",TimeoutExceeded:"TIMEOUT_EXCEEDED",CancellationRequested:"CANCELLATION_REQUESTED",Cancelled:"CANCELLED"};Qd.BatchJobStatus$inboundSchema=ibo.nativeEnum(Qd.BatchJobStatus);Qd.BatchJobStatus$outboundSchema=Qd.BatchJobStatus$inboundSchema;var a0r;(function(t){t.inboundSchema=Qd.BatchJobStatus$inboundSchema,t.outboundSchema=Qd.BatchJobStatus$outboundSchema})(a0r||(Qd.BatchJobStatus$=a0r={}))});var Cst=S(fa=>{"use strict";var abo=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]}),sbo=fa&&fa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ubo=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"&&abo(r,e,n[o]);return sbo(r,e),r}}();Object.defineProperty(fa,"__esModule",{value:!0});fa.BatchJobOut$=fa.BatchJobOut$outboundSchema=fa.BatchJobOut$inboundSchema=fa.BatchJobOutObject$=fa.BatchJobOutObject$outboundSchema=fa.BatchJobOutObject$inboundSchema=fa.BatchJobOutObject=void 0;fa.batchJobOutToJSON=cbo;fa.batchJobOutFromJSON=dbo;var sn=ubo(te()),l0r=ae(),lbo=ee(),c0r=wst(),d0r=Sst();fa.BatchJobOutObject={Batch:"batch"};fa.BatchJobOutObject$inboundSchema=sn.nativeEnum(fa.BatchJobOutObject);fa.BatchJobOutObject$outboundSchema=fa.BatchJobOutObject$inboundSchema;var s0r;(function(t){t.inboundSchema=fa.BatchJobOutObject$inboundSchema,t.outboundSchema=fa.BatchJobOutObject$outboundSchema})(s0r||(fa.BatchJobOutObject$=s0r={}));fa.BatchJobOut$inboundSchema=sn.object({id:sn.string(),object:fa.BatchJobOutObject$inboundSchema.default("batch"),input_files:sn.array(sn.string()),metadata:sn.nullable(sn.record(sn.any())).optional(),endpoint:sn.string(),model:sn.nullable(sn.string()).optional(),agent_id:sn.nullable(sn.string()).optional(),output_file:sn.nullable(sn.string()).optional(),error_file:sn.nullable(sn.string()).optional(),errors:sn.array(c0r.BatchError$inboundSchema),status:d0r.BatchJobStatus$inboundSchema,created_at:sn.number().int(),total_requests:sn.number().int(),completed_requests:sn.number().int(),succeeded_requests:sn.number().int(),failed_requests:sn.number().int(),started_at:sn.nullable(sn.number().int()).optional(),completed_at:sn.nullable(sn.number().int()).optional()}).transform(t=>(0,l0r.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"}));fa.BatchJobOut$outboundSchema=sn.object({id:sn.string(),object:fa.BatchJobOutObject$outboundSchema.default("batch"),inputFiles:sn.array(sn.string()),metadata:sn.nullable(sn.record(sn.any())).optional(),endpoint:sn.string(),model:sn.nullable(sn.string()).optional(),agentId:sn.nullable(sn.string()).optional(),outputFile:sn.nullable(sn.string()).optional(),errorFile:sn.nullable(sn.string()).optional(),errors:sn.array(c0r.BatchError$outboundSchema),status:d0r.BatchJobStatus$outboundSchema,createdAt:sn.number().int(),totalRequests:sn.number().int(),completedRequests:sn.number().int(),succeededRequests:sn.number().int(),failedRequests:sn.number().int(),startedAt:sn.nullable(sn.number().int()).optional(),completedAt:sn.nullable(sn.number().int()).optional()}).transform(t=>(0,l0r.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 u0r;(function(t){t.inboundSchema=fa.BatchJobOut$inboundSchema,t.outboundSchema=fa.BatchJobOut$outboundSchema})(u0r||(fa.BatchJobOut$=u0r={}));function cbo(t){return JSON.stringify(fa.BatchJobOut$outboundSchema.parse(t))}function dbo(t){return(0,lbo.safeParse)(t,e=>fa.BatchJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobOut' from JSON")}});var h0r=S(pa=>{"use strict";var fbo=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]}),pbo=pa&&pa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mbo=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"&&fbo(r,e,n[o]);return pbo(r,e),r}}();Object.defineProperty(pa,"__esModule",{value:!0});pa.BatchJobsOut$=pa.BatchJobsOut$outboundSchema=pa.BatchJobsOut$inboundSchema=pa.BatchJobsOutObject$=pa.BatchJobsOutObject$outboundSchema=pa.BatchJobsOutObject$inboundSchema=pa.BatchJobsOutObject=void 0;pa.batchJobsOutToJSON=gbo;pa.batchJobsOutFromJSON=ybo;var vV=mbo(te()),hbo=ee(),m0r=Cst();pa.BatchJobsOutObject={List:"list"};pa.BatchJobsOutObject$inboundSchema=vV.nativeEnum(pa.BatchJobsOutObject);pa.BatchJobsOutObject$outboundSchema=pa.BatchJobsOutObject$inboundSchema;var f0r;(function(t){t.inboundSchema=pa.BatchJobsOutObject$inboundSchema,t.outboundSchema=pa.BatchJobsOutObject$outboundSchema})(f0r||(pa.BatchJobsOutObject$=f0r={}));pa.BatchJobsOut$inboundSchema=vV.object({data:vV.array(m0r.BatchJobOut$inboundSchema).optional(),object:pa.BatchJobsOutObject$inboundSchema.default("list"),total:vV.number().int()});pa.BatchJobsOut$outboundSchema=vV.object({data:vV.array(m0r.BatchJobOut$outboundSchema).optional(),object:pa.BatchJobsOutObject$outboundSchema.default("list"),total:vV.number().int()});var p0r;(function(t){t.inboundSchema=pa.BatchJobsOut$inboundSchema,t.outboundSchema=pa.BatchJobsOut$outboundSchema})(p0r||(pa.BatchJobsOut$=p0r={}));function gbo(t){return JSON.stringify(pa.BatchJobsOut$outboundSchema.parse(t))}function ybo(t){return(0,hbo.safeParse)(t,e=>pa.BatchJobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'BatchJobsOut' from JSON")}});var fq=S(ef=>{"use strict";var bbo=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]}),_bo=ef&&ef.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vbo=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"&&bbo(r,e,n[o]);return _bo(r,e),r}}();Object.defineProperty(ef,"__esModule",{value:!0});ef.BuiltInConnectors$=ef.BuiltInConnectors$outboundSchema=ef.BuiltInConnectors$inboundSchema=ef.BuiltInConnectors=void 0;var wbo=vbo(te());ef.BuiltInConnectors={WebSearch:"web_search",WebSearchPremium:"web_search_premium",CodeInterpreter:"code_interpreter",ImageGeneration:"image_generation",DocumentLibrary:"document_library"};ef.BuiltInConnectors$inboundSchema=wbo.nativeEnum(ef.BuiltInConnectors);ef.BuiltInConnectors$outboundSchema=ef.BuiltInConnectors$inboundSchema;var g0r;(function(t){t.inboundSchema=ef.BuiltInConnectors$inboundSchema,t.outboundSchema=ef.BuiltInConnectors$outboundSchema})(g0r||(ef.BuiltInConnectors$=g0r={}))});var xst=S(cs=>{"use strict";var Sbo=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]}),Cbo=cs&&cs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xbo=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"&&Sbo(r,e,n[o]);return Cbo(r,e),r}}();Object.defineProperty(cs,"__esModule",{value:!0});cs.InstructRequest$=cs.InstructRequest$outboundSchema=cs.InstructRequest$inboundSchema=cs.InstructRequestMessages$=cs.InstructRequestMessages$outboundSchema=cs.InstructRequestMessages$inboundSchema=void 0;cs.instructRequestMessagesToJSON=Obo;cs.instructRequestMessagesFromJSON=Tbo;cs.instructRequestToJSON=Ebo;cs.instructRequestFromJSON=Pbo;var oi=xbo(te()),_0r=ee(),mPe=zA(),hPe=pj(),gPe=mj(),yPe=hj();cs.InstructRequestMessages$inboundSchema=oi.union([hPe.SystemMessage$inboundSchema.and(oi.object({role:oi.literal("system")}).transform(t=>({role:t.role}))),gPe.ToolMessage$inboundSchema.and(oi.object({role:oi.literal("tool")}).transform(t=>({role:t.role}))),yPe.UserMessage$inboundSchema.and(oi.object({role:oi.literal("user")}).transform(t=>({role:t.role}))),mPe.AssistantMessage$inboundSchema.and(oi.object({role:oi.literal("assistant")}).transform(t=>({role:t.role})))]);cs.InstructRequestMessages$outboundSchema=oi.union([hPe.SystemMessage$outboundSchema.and(oi.object({role:oi.literal("system")}).transform(t=>({role:t.role}))),gPe.ToolMessage$outboundSchema.and(oi.object({role:oi.literal("tool")}).transform(t=>({role:t.role}))),yPe.UserMessage$outboundSchema.and(oi.object({role:oi.literal("user")}).transform(t=>({role:t.role}))),mPe.AssistantMessage$outboundSchema.and(oi.object({role:oi.literal("assistant")}).transform(t=>({role:t.role})))]);var y0r;(function(t){t.inboundSchema=cs.InstructRequestMessages$inboundSchema,t.outboundSchema=cs.InstructRequestMessages$outboundSchema})(y0r||(cs.InstructRequestMessages$=y0r={}));function Obo(t){return JSON.stringify(cs.InstructRequestMessages$outboundSchema.parse(t))}function Tbo(t){return(0,_0r.safeParse)(t,e=>cs.InstructRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestMessages' from JSON")}cs.InstructRequest$inboundSchema=oi.object({messages:oi.array(oi.union([hPe.SystemMessage$inboundSchema.and(oi.object({role:oi.literal("system")}).transform(t=>({role:t.role}))),gPe.ToolMessage$inboundSchema.and(oi.object({role:oi.literal("tool")}).transform(t=>({role:t.role}))),yPe.UserMessage$inboundSchema.and(oi.object({role:oi.literal("user")}).transform(t=>({role:t.role}))),mPe.AssistantMessage$inboundSchema.and(oi.object({role:oi.literal("assistant")}).transform(t=>({role:t.role})))]))});cs.InstructRequest$outboundSchema=oi.object({messages:oi.array(oi.union([hPe.SystemMessage$outboundSchema.and(oi.object({role:oi.literal("system")}).transform(t=>({role:t.role}))),gPe.ToolMessage$outboundSchema.and(oi.object({role:oi.literal("tool")}).transform(t=>({role:t.role}))),yPe.UserMessage$outboundSchema.and(oi.object({role:oi.literal("user")}).transform(t=>({role:t.role}))),mPe.AssistantMessage$outboundSchema.and(oi.object({role:oi.literal("assistant")}).transform(t=>({role:t.role})))]))});var b0r;(function(t){t.inboundSchema=cs.InstructRequest$inboundSchema,t.outboundSchema=cs.InstructRequest$outboundSchema})(b0r||(cs.InstructRequest$=b0r={}));function Ebo(t){return JSON.stringify(cs.InstructRequest$outboundSchema.parse(t))}function Pbo(t){return(0,_0r.safeParse)(t,e=>cs.InstructRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequest' from JSON")}});var Tst=S(lo=>{"use strict";var Mbo=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]}),Rbo=lo&&lo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Abo=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"&&Mbo(r,e,n[o]);return Rbo(r,e),r}}();Object.defineProperty(lo,"__esModule",{value:!0});lo.Inputs$=lo.Inputs$outboundSchema=lo.Inputs$inboundSchema=lo.InstructRequestInputs$=lo.InstructRequestInputs$outboundSchema=lo.InstructRequestInputs$inboundSchema=lo.InstructRequestInputsMessages$=lo.InstructRequestInputsMessages$outboundSchema=lo.InstructRequestInputsMessages$inboundSchema=void 0;lo.instructRequestInputsMessagesToJSON=Ibo;lo.instructRequestInputsMessagesFromJSON=Nbo;lo.instructRequestInputsToJSON=jbo;lo.instructRequestInputsFromJSON=Dbo;lo.inputsToJSON=$bo;lo.inputsFromJSON=Lbo;var uo=Abo(te()),Ost=ee(),bPe=zA(),C0r=xst(),_Pe=pj(),vPe=mj(),wPe=hj();lo.InstructRequestInputsMessages$inboundSchema=uo.union([_Pe.SystemMessage$inboundSchema.and(uo.object({role:uo.literal("system")}).transform(t=>({role:t.role}))),vPe.ToolMessage$inboundSchema.and(uo.object({role:uo.literal("tool")}).transform(t=>({role:t.role}))),wPe.UserMessage$inboundSchema.and(uo.object({role:uo.literal("user")}).transform(t=>({role:t.role}))),bPe.AssistantMessage$inboundSchema.and(uo.object({role:uo.literal("assistant")}).transform(t=>({role:t.role})))]);lo.InstructRequestInputsMessages$outboundSchema=uo.union([_Pe.SystemMessage$outboundSchema.and(uo.object({role:uo.literal("system")}).transform(t=>({role:t.role}))),vPe.ToolMessage$outboundSchema.and(uo.object({role:uo.literal("tool")}).transform(t=>({role:t.role}))),wPe.UserMessage$outboundSchema.and(uo.object({role:uo.literal("user")}).transform(t=>({role:t.role}))),bPe.AssistantMessage$outboundSchema.and(uo.object({role:uo.literal("assistant")}).transform(t=>({role:t.role})))]);var v0r;(function(t){t.inboundSchema=lo.InstructRequestInputsMessages$inboundSchema,t.outboundSchema=lo.InstructRequestInputsMessages$outboundSchema})(v0r||(lo.InstructRequestInputsMessages$=v0r={}));function Ibo(t){return JSON.stringify(lo.InstructRequestInputsMessages$outboundSchema.parse(t))}function Nbo(t){return(0,Ost.safeParse)(t,e=>lo.InstructRequestInputsMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestInputsMessages' from JSON")}lo.InstructRequestInputs$inboundSchema=uo.object({messages:uo.array(uo.union([_Pe.SystemMessage$inboundSchema.and(uo.object({role:uo.literal("system")}).transform(t=>({role:t.role}))),vPe.ToolMessage$inboundSchema.and(uo.object({role:uo.literal("tool")}).transform(t=>({role:t.role}))),wPe.UserMessage$inboundSchema.and(uo.object({role:uo.literal("user")}).transform(t=>({role:t.role}))),bPe.AssistantMessage$inboundSchema.and(uo.object({role:uo.literal("assistant")}).transform(t=>({role:t.role})))]))});lo.InstructRequestInputs$outboundSchema=uo.object({messages:uo.array(uo.union([_Pe.SystemMessage$outboundSchema.and(uo.object({role:uo.literal("system")}).transform(t=>({role:t.role}))),vPe.ToolMessage$outboundSchema.and(uo.object({role:uo.literal("tool")}).transform(t=>({role:t.role}))),wPe.UserMessage$outboundSchema.and(uo.object({role:uo.literal("user")}).transform(t=>({role:t.role}))),bPe.AssistantMessage$outboundSchema.and(uo.object({role:uo.literal("assistant")}).transform(t=>({role:t.role})))]))});var w0r;(function(t){t.inboundSchema=lo.InstructRequestInputs$inboundSchema,t.outboundSchema=lo.InstructRequestInputs$outboundSchema})(w0r||(lo.InstructRequestInputs$=w0r={}));function jbo(t){return JSON.stringify(lo.InstructRequestInputs$outboundSchema.parse(t))}function Dbo(t){return(0,Ost.safeParse)(t,e=>lo.InstructRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InstructRequestInputs' from JSON")}lo.Inputs$inboundSchema=uo.union([uo.lazy(()=>lo.InstructRequestInputs$inboundSchema),uo.array(C0r.InstructRequest$inboundSchema)]);lo.Inputs$outboundSchema=uo.union([uo.lazy(()=>lo.InstructRequestInputs$outboundSchema),uo.array(C0r.InstructRequest$outboundSchema)]);var S0r;(function(t){t.inboundSchema=lo.Inputs$inboundSchema,t.outboundSchema=lo.Inputs$outboundSchema})(S0r||(lo.Inputs$=S0r={}));function $bo(t){return JSON.stringify(lo.Inputs$outboundSchema.parse(t))}function Lbo(t){return(0,Ost.safeParse)(t,e=>lo.Inputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Inputs' from JSON")}});var E0r=S(tf=>{"use strict";var Fbo=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]}),kbo=tf&&tf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qbo=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"&&Fbo(r,e,n[o]);return kbo(r,e),r}}();Object.defineProperty(tf,"__esModule",{value:!0});tf.ChatClassificationRequest$=tf.ChatClassificationRequest$outboundSchema=tf.ChatClassificationRequest$inboundSchema=void 0;tf.chatClassificationRequestToJSON=Ubo;tf.chatClassificationRequestFromJSON=zbo;var SPe=qbo(te()),O0r=ae(),Bbo=ee(),T0r=Tst();tf.ChatClassificationRequest$inboundSchema=SPe.object({model:SPe.string(),input:T0r.Inputs$inboundSchema}).transform(t=>(0,O0r.remap)(t,{input:"inputs"}));tf.ChatClassificationRequest$outboundSchema=SPe.object({model:SPe.string(),inputs:T0r.Inputs$outboundSchema}).transform(t=>(0,O0r.remap)(t,{inputs:"input"}));var x0r;(function(t){t.inboundSchema=tf.ChatClassificationRequest$inboundSchema,t.outboundSchema=tf.ChatClassificationRequest$outboundSchema})(x0r||(tf.ChatClassificationRequest$=x0r={}));function Ubo(t){return JSON.stringify(tf.ChatClassificationRequest$outboundSchema.parse(t))}function zbo(t){return(0,Bbo.safeParse)(t,e=>tf.ChatClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatClassificationRequest' from JSON")}});var CPe=S(ma=>{"use strict";var Hbo=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]}),Vbo=ma&&ma.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jbo=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"&&Hbo(r,e,n[o]);return Vbo(r,e),r}}();Object.defineProperty(ma,"__esModule",{value:!0});ma.ChatCompletionChoice$=ma.ChatCompletionChoice$outboundSchema=ma.ChatCompletionChoice$inboundSchema=ma.FinishReason$=ma.FinishReason$outboundSchema=ma.FinishReason$inboundSchema=ma.FinishReason=void 0;ma.chatCompletionChoiceToJSON=Gbo;ma.chatCompletionChoiceFromJSON=Zbo;var tx=Jbo(te()),R0r=ae(),Kbo=ee(),Wbo=QC(),A0r=zA();ma.FinishReason={Stop:"stop",Length:"length",ModelLength:"model_length",Error:"error",ToolCalls:"tool_calls"};ma.FinishReason$inboundSchema=tx.union([tx.nativeEnum(ma.FinishReason),tx.string().transform(Wbo.catchUnrecognizedEnum)]);ma.FinishReason$outboundSchema=tx.union([tx.nativeEnum(ma.FinishReason),tx.string().and(tx.custom())]);var P0r;(function(t){t.inboundSchema=ma.FinishReason$inboundSchema,t.outboundSchema=ma.FinishReason$outboundSchema})(P0r||(ma.FinishReason$=P0r={}));ma.ChatCompletionChoice$inboundSchema=tx.object({index:tx.number().int(),message:A0r.AssistantMessage$inboundSchema,finish_reason:ma.FinishReason$inboundSchema}).transform(t=>(0,R0r.remap)(t,{finish_reason:"finishReason"}));ma.ChatCompletionChoice$outboundSchema=tx.object({index:tx.number().int(),message:A0r.AssistantMessage$outboundSchema,finishReason:ma.FinishReason$outboundSchema}).transform(t=>(0,R0r.remap)(t,{finishReason:"finish_reason"}));var M0r;(function(t){t.inboundSchema=ma.ChatCompletionChoice$inboundSchema,t.outboundSchema=ma.ChatCompletionChoice$outboundSchema})(M0r||(ma.ChatCompletionChoice$=M0r={}));function Gbo(t){return JSON.stringify(ma.ChatCompletionChoice$outboundSchema.parse(t))}function Zbo(t){return(0,Kbo.safeParse)(t,e=>ma.ChatCompletionChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionChoice' from JSON")}});var B0r=S(Jr=>{"use strict";var Xbo=Jr&&Jr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ybo=Jr&&Jr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qbo=Jr&&Jr.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&Xbo(r,e,n[o]);return Ybo(r,e),r}}();Object.defineProperty(Jr,"__esModule",{value:!0});Jr.ChatCompletionRequest$=Jr.ChatCompletionRequest$outboundSchema=Jr.ChatCompletionRequest$inboundSchema=Jr.ChatCompletionRequestToolChoice$=Jr.ChatCompletionRequestToolChoice$outboundSchema=Jr.ChatCompletionRequestToolChoice$inboundSchema=Jr.Messages$=Jr.Messages$outboundSchema=Jr.Messages$inboundSchema=Jr.Stop$=Jr.Stop$outboundSchema=Jr.Stop$inboundSchema=void 0;Jr.stopToJSON=e_o;Jr.stopFromJSON=t_o;Jr.messagesToJSON=r_o;Jr.messagesFromJSON=n_o;Jr.chatCompletionRequestToolChoiceToJSON=o_o;Jr.chatCompletionRequestToolChoiceFromJSON=i_o;Jr.chatCompletionRequestToJSON=a_o;Jr.chatCompletionRequestFromJSON=s_o;var Ye=Qbo(te()),$0r=ae(),xPe=ee(),OPe=zA(),L0r=o9(),F0r=lV(),k0r=oq(),TPe=pj(),q0r=i9(),EPe=a9(),PPe=cV(),MPe=mj(),RPe=hj();Jr.Stop$inboundSchema=Ye.union([Ye.string(),Ye.array(Ye.string())]);Jr.Stop$outboundSchema=Ye.union([Ye.string(),Ye.array(Ye.string())]);var I0r;(function(t){t.inboundSchema=Jr.Stop$inboundSchema,t.outboundSchema=Jr.Stop$outboundSchema})(I0r||(Jr.Stop$=I0r={}));function e_o(t){return JSON.stringify(Jr.Stop$outboundSchema.parse(t))}function t_o(t){return(0,xPe.safeParse)(t,e=>Jr.Stop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Stop' from JSON")}Jr.Messages$inboundSchema=Ye.union([TPe.SystemMessage$inboundSchema.and(Ye.object({role:Ye.literal("system")}).transform(t=>({role:t.role}))),MPe.ToolMessage$inboundSchema.and(Ye.object({role:Ye.literal("tool")}).transform(t=>({role:t.role}))),RPe.UserMessage$inboundSchema.and(Ye.object({role:Ye.literal("user")}).transform(t=>({role:t.role}))),OPe.AssistantMessage$inboundSchema.and(Ye.object({role:Ye.literal("assistant")}).transform(t=>({role:t.role})))]);Jr.Messages$outboundSchema=Ye.union([TPe.SystemMessage$outboundSchema.and(Ye.object({role:Ye.literal("system")}).transform(t=>({role:t.role}))),MPe.ToolMessage$outboundSchema.and(Ye.object({role:Ye.literal("tool")}).transform(t=>({role:t.role}))),RPe.UserMessage$outboundSchema.and(Ye.object({role:Ye.literal("user")}).transform(t=>({role:t.role}))),OPe.AssistantMessage$outboundSchema.and(Ye.object({role:Ye.literal("assistant")}).transform(t=>({role:t.role})))]);var N0r;(function(t){t.inboundSchema=Jr.Messages$inboundSchema,t.outboundSchema=Jr.Messages$outboundSchema})(N0r||(Jr.Messages$=N0r={}));function r_o(t){return JSON.stringify(Jr.Messages$outboundSchema.parse(t))}function n_o(t){return(0,xPe.safeParse)(t,e=>Jr.Messages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Messages' from JSON")}Jr.ChatCompletionRequestToolChoice$inboundSchema=Ye.union([EPe.ToolChoice$inboundSchema,PPe.ToolChoiceEnum$inboundSchema]);Jr.ChatCompletionRequestToolChoice$outboundSchema=Ye.union([EPe.ToolChoice$outboundSchema,PPe.ToolChoiceEnum$outboundSchema]);var j0r;(function(t){t.inboundSchema=Jr.ChatCompletionRequestToolChoice$inboundSchema,t.outboundSchema=Jr.ChatCompletionRequestToolChoice$outboundSchema})(j0r||(Jr.ChatCompletionRequestToolChoice$=j0r={}));function o_o(t){return JSON.stringify(Jr.ChatCompletionRequestToolChoice$outboundSchema.parse(t))}function i_o(t){return(0,xPe.safeParse)(t,e=>Jr.ChatCompletionRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequestToolChoice' from JSON")}Jr.ChatCompletionRequest$inboundSchema=Ye.object({model:Ye.string(),temperature:Ye.nullable(Ye.number()).optional(),top_p:Ye.number().optional(),max_tokens:Ye.nullable(Ye.number().int()).optional(),stream:Ye.boolean().default(!1),stop:Ye.union([Ye.string(),Ye.array(Ye.string())]).optional(),random_seed:Ye.nullable(Ye.number().int()).optional(),messages:Ye.array(Ye.union([TPe.SystemMessage$inboundSchema.and(Ye.object({role:Ye.literal("system")}).transform(t=>({role:t.role}))),MPe.ToolMessage$inboundSchema.and(Ye.object({role:Ye.literal("tool")}).transform(t=>({role:t.role}))),RPe.UserMessage$inboundSchema.and(Ye.object({role:Ye.literal("user")}).transform(t=>({role:t.role}))),OPe.AssistantMessage$inboundSchema.and(Ye.object({role:Ye.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:k0r.ResponseFormat$inboundSchema.optional(),tools:Ye.nullable(Ye.array(q0r.Tool$inboundSchema)).optional(),tool_choice:Ye.union([EPe.ToolChoice$inboundSchema,PPe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Ye.number().optional(),frequency_penalty:Ye.number().optional(),n:Ye.nullable(Ye.number().int()).optional(),prediction:F0r.Prediction$inboundSchema.optional(),parallel_tool_calls:Ye.boolean().optional(),prompt_mode:Ye.nullable(L0r.MistralPromptMode$inboundSchema).optional(),safe_prompt:Ye.boolean().optional()}).transform(t=>(0,$0r.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"}));Jr.ChatCompletionRequest$outboundSchema=Ye.object({model:Ye.string(),temperature:Ye.nullable(Ye.number()).optional(),topP:Ye.number().optional(),maxTokens:Ye.nullable(Ye.number().int()).optional(),stream:Ye.boolean().default(!1),stop:Ye.union([Ye.string(),Ye.array(Ye.string())]).optional(),randomSeed:Ye.nullable(Ye.number().int()).optional(),messages:Ye.array(Ye.union([TPe.SystemMessage$outboundSchema.and(Ye.object({role:Ye.literal("system")}).transform(t=>({role:t.role}))),MPe.ToolMessage$outboundSchema.and(Ye.object({role:Ye.literal("tool")}).transform(t=>({role:t.role}))),RPe.UserMessage$outboundSchema.and(Ye.object({role:Ye.literal("user")}).transform(t=>({role:t.role}))),OPe.AssistantMessage$outboundSchema.and(Ye.object({role:Ye.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:k0r.ResponseFormat$outboundSchema.optional(),tools:Ye.nullable(Ye.array(q0r.Tool$outboundSchema)).optional(),toolChoice:Ye.union([EPe.ToolChoice$outboundSchema,PPe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Ye.number().optional(),frequencyPenalty:Ye.number().optional(),n:Ye.nullable(Ye.number().int()).optional(),prediction:F0r.Prediction$outboundSchema.optional(),parallelToolCalls:Ye.boolean().optional(),promptMode:Ye.nullable(L0r.MistralPromptMode$outboundSchema).optional(),safePrompt:Ye.boolean().optional()}).transform(t=>(0,$0r.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 D0r;(function(t){t.inboundSchema=Jr.ChatCompletionRequest$inboundSchema,t.outboundSchema=Jr.ChatCompletionRequest$outboundSchema})(D0r||(Jr.ChatCompletionRequest$=D0r={}));function a_o(t){return JSON.stringify(Jr.ChatCompletionRequest$outboundSchema.parse(t))}function s_o(t){return(0,xPe.safeParse)(t,e=>Jr.ChatCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionRequest' from JSON")}});var pq=S(rf=>{"use strict";var u_o=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]}),l_o=rf&&rf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c_o=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"&&u_o(r,e,n[o]);return l_o(r,e),r}}();Object.defineProperty(rf,"__esModule",{value:!0});rf.UsageInfo$=rf.UsageInfo$outboundSchema=rf.UsageInfo$inboundSchema=void 0;rf.usageInfoToJSON=d_o;rf.usageInfoFromJSON=f_o;var Sb=c_o(te()),z0r=ae(),H0r=ee();rf.UsageInfo$inboundSchema=(0,H0r.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,z0r.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",prompt_audio_seconds:"promptAudioSeconds"}));rf.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,z0r.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",promptAudioSeconds:"prompt_audio_seconds",additionalProperties:null})}));var U0r;(function(t){t.inboundSchema=rf.UsageInfo$inboundSchema,t.outboundSchema=rf.UsageInfo$outboundSchema})(U0r||(rf.UsageInfo$=U0r={}));function d_o(t){return JSON.stringify(rf.UsageInfo$outboundSchema.parse(t))}function f_o(t){return(0,H0r.safeParse)(t,e=>rf.UsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UsageInfo' from JSON")}});var W0r=S(nf=>{"use strict";var p_o=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]}),m_o=nf&&nf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),h_o=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"&&p_o(r,e,n[o]);return m_o(r,e),r}}();Object.defineProperty(nf,"__esModule",{value:!0});nf.ChatCompletionResponse$=nf.ChatCompletionResponse$outboundSchema=nf.ChatCompletionResponse$inboundSchema=void 0;nf.chatCompletionResponseToJSON=y_o;nf.chatCompletionResponseFromJSON=b_o;var JS=h_o(te()),g_o=ee(),J0r=CPe(),K0r=pq();nf.ChatCompletionResponse$inboundSchema=JS.object({id:JS.string(),object:JS.string(),model:JS.string(),usage:K0r.UsageInfo$inboundSchema,created:JS.number().int(),choices:JS.array(J0r.ChatCompletionChoice$inboundSchema)});nf.ChatCompletionResponse$outboundSchema=JS.object({id:JS.string(),object:JS.string(),model:JS.string(),usage:K0r.UsageInfo$outboundSchema,created:JS.number().int(),choices:JS.array(J0r.ChatCompletionChoice$outboundSchema)});var V0r;(function(t){t.inboundSchema=nf.ChatCompletionResponse$inboundSchema,t.outboundSchema=nf.ChatCompletionResponse$outboundSchema})(V0r||(nf.ChatCompletionResponse$=V0r={}));function y_o(t){return JSON.stringify(nf.ChatCompletionResponse$outboundSchema.parse(t))}function b_o(t){return(0,g_o.safeParse)(t,e=>nf.ChatCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionResponse' from JSON")}});var oCr=S(Kr=>{"use strict";var __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]}),v_o=Kr&&Kr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),w_o=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"&&__o(r,e,n[o]);return v_o(r,e),r}}();Object.defineProperty(Kr,"__esModule",{value:!0});Kr.ChatCompletionStreamRequest$=Kr.ChatCompletionStreamRequest$outboundSchema=Kr.ChatCompletionStreamRequest$inboundSchema=Kr.ChatCompletionStreamRequestToolChoice$=Kr.ChatCompletionStreamRequestToolChoice$outboundSchema=Kr.ChatCompletionStreamRequestToolChoice$inboundSchema=Kr.ChatCompletionStreamRequestMessages$=Kr.ChatCompletionStreamRequestMessages$outboundSchema=Kr.ChatCompletionStreamRequestMessages$inboundSchema=Kr.ChatCompletionStreamRequestStop$=Kr.ChatCompletionStreamRequestStop$outboundSchema=Kr.ChatCompletionStreamRequestStop$inboundSchema=void 0;Kr.chatCompletionStreamRequestStopToJSON=S_o;Kr.chatCompletionStreamRequestStopFromJSON=C_o;Kr.chatCompletionStreamRequestMessagesToJSON=x_o;Kr.chatCompletionStreamRequestMessagesFromJSON=O_o;Kr.chatCompletionStreamRequestToolChoiceToJSON=T_o;Kr.chatCompletionStreamRequestToolChoiceFromJSON=E_o;Kr.chatCompletionStreamRequestToJSON=P_o;Kr.chatCompletionStreamRequestFromJSON=M_o;var Qe=w_o(te()),Q0r=ae(),APe=ee(),IPe=zA(),eCr=o9(),tCr=lV(),rCr=oq(),NPe=pj(),nCr=i9(),jPe=a9(),DPe=cV(),$Pe=mj(),LPe=hj();Kr.ChatCompletionStreamRequestStop$inboundSchema=Qe.union([Qe.string(),Qe.array(Qe.string())]);Kr.ChatCompletionStreamRequestStop$outboundSchema=Qe.union([Qe.string(),Qe.array(Qe.string())]);var G0r;(function(t){t.inboundSchema=Kr.ChatCompletionStreamRequestStop$inboundSchema,t.outboundSchema=Kr.ChatCompletionStreamRequestStop$outboundSchema})(G0r||(Kr.ChatCompletionStreamRequestStop$=G0r={}));function S_o(t){return JSON.stringify(Kr.ChatCompletionStreamRequestStop$outboundSchema.parse(t))}function C_o(t){return(0,APe.safeParse)(t,e=>Kr.ChatCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestStop' from JSON")}Kr.ChatCompletionStreamRequestMessages$inboundSchema=Qe.union([NPe.SystemMessage$inboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),$Pe.ToolMessage$inboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role}))),LPe.UserMessage$inboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),IPe.AssistantMessage$inboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role})))]);Kr.ChatCompletionStreamRequestMessages$outboundSchema=Qe.union([NPe.SystemMessage$outboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),$Pe.ToolMessage$outboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role}))),LPe.UserMessage$outboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),IPe.AssistantMessage$outboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role})))]);var Z0r;(function(t){t.inboundSchema=Kr.ChatCompletionStreamRequestMessages$inboundSchema,t.outboundSchema=Kr.ChatCompletionStreamRequestMessages$outboundSchema})(Z0r||(Kr.ChatCompletionStreamRequestMessages$=Z0r={}));function x_o(t){return JSON.stringify(Kr.ChatCompletionStreamRequestMessages$outboundSchema.parse(t))}function O_o(t){return(0,APe.safeParse)(t,e=>Kr.ChatCompletionStreamRequestMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestMessages' from JSON")}Kr.ChatCompletionStreamRequestToolChoice$inboundSchema=Qe.union([jPe.ToolChoice$inboundSchema,DPe.ToolChoiceEnum$inboundSchema]);Kr.ChatCompletionStreamRequestToolChoice$outboundSchema=Qe.union([jPe.ToolChoice$outboundSchema,DPe.ToolChoiceEnum$outboundSchema]);var X0r;(function(t){t.inboundSchema=Kr.ChatCompletionStreamRequestToolChoice$inboundSchema,t.outboundSchema=Kr.ChatCompletionStreamRequestToolChoice$outboundSchema})(X0r||(Kr.ChatCompletionStreamRequestToolChoice$=X0r={}));function T_o(t){return JSON.stringify(Kr.ChatCompletionStreamRequestToolChoice$outboundSchema.parse(t))}function E_o(t){return(0,APe.safeParse)(t,e=>Kr.ChatCompletionStreamRequestToolChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequestToolChoice' from JSON")}Kr.ChatCompletionStreamRequest$inboundSchema=Qe.object({model:Qe.string(),temperature:Qe.nullable(Qe.number()).optional(),top_p:Qe.number().optional(),max_tokens:Qe.nullable(Qe.number().int()).optional(),stream:Qe.boolean().default(!0),stop:Qe.union([Qe.string(),Qe.array(Qe.string())]).optional(),random_seed:Qe.nullable(Qe.number().int()).optional(),messages:Qe.array(Qe.union([NPe.SystemMessage$inboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),$Pe.ToolMessage$inboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role}))),LPe.UserMessage$inboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),IPe.AssistantMessage$inboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role})))])),response_format:rCr.ResponseFormat$inboundSchema.optional(),tools:Qe.nullable(Qe.array(nCr.Tool$inboundSchema)).optional(),tool_choice:Qe.union([jPe.ToolChoice$inboundSchema,DPe.ToolChoiceEnum$inboundSchema]).optional(),presence_penalty:Qe.number().optional(),frequency_penalty:Qe.number().optional(),n:Qe.nullable(Qe.number().int()).optional(),prediction:tCr.Prediction$inboundSchema.optional(),parallel_tool_calls:Qe.boolean().optional(),prompt_mode:Qe.nullable(eCr.MistralPromptMode$inboundSchema).optional(),safe_prompt:Qe.boolean().optional()}).transform(t=>(0,Q0r.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"}));Kr.ChatCompletionStreamRequest$outboundSchema=Qe.object({model:Qe.string(),temperature:Qe.nullable(Qe.number()).optional(),topP:Qe.number().optional(),maxTokens:Qe.nullable(Qe.number().int()).optional(),stream:Qe.boolean().default(!0),stop:Qe.union([Qe.string(),Qe.array(Qe.string())]).optional(),randomSeed:Qe.nullable(Qe.number().int()).optional(),messages:Qe.array(Qe.union([NPe.SystemMessage$outboundSchema.and(Qe.object({role:Qe.literal("system")}).transform(t=>({role:t.role}))),$Pe.ToolMessage$outboundSchema.and(Qe.object({role:Qe.literal("tool")}).transform(t=>({role:t.role}))),LPe.UserMessage$outboundSchema.and(Qe.object({role:Qe.literal("user")}).transform(t=>({role:t.role}))),IPe.AssistantMessage$outboundSchema.and(Qe.object({role:Qe.literal("assistant")}).transform(t=>({role:t.role})))])),responseFormat:rCr.ResponseFormat$outboundSchema.optional(),tools:Qe.nullable(Qe.array(nCr.Tool$outboundSchema)).optional(),toolChoice:Qe.union([jPe.ToolChoice$outboundSchema,DPe.ToolChoiceEnum$outboundSchema]).optional(),presencePenalty:Qe.number().optional(),frequencyPenalty:Qe.number().optional(),n:Qe.nullable(Qe.number().int()).optional(),prediction:tCr.Prediction$outboundSchema.optional(),parallelToolCalls:Qe.boolean().optional(),promptMode:Qe.nullable(eCr.MistralPromptMode$outboundSchema).optional(),safePrompt:Qe.boolean().optional()}).transform(t=>(0,Q0r.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 Y0r;(function(t){t.inboundSchema=Kr.ChatCompletionStreamRequest$inboundSchema,t.outboundSchema=Kr.ChatCompletionStreamRequest$outboundSchema})(Y0r||(Kr.ChatCompletionStreamRequest$=Y0r={}));function P_o(t){return JSON.stringify(Kr.ChatCompletionStreamRequest$outboundSchema.parse(t))}function M_o(t){return(0,APe.safeParse)(t,e=>Kr.ChatCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatCompletionStreamRequest' from JSON")}});var cCr=S(Wr=>{"use strict";var R_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]}),A_o=Wr&&Wr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I_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"&&R_o(r,e,n[o]);return A_o(r,e),r}}();Object.defineProperty(Wr,"__esModule",{value:!0});Wr.ChatModerationRequest$=Wr.ChatModerationRequest$outboundSchema=Wr.ChatModerationRequest$inboundSchema=Wr.ChatModerationRequestInputs$=Wr.ChatModerationRequestInputs$outboundSchema=Wr.ChatModerationRequestInputs$inboundSchema=Wr.One$=Wr.One$outboundSchema=Wr.One$inboundSchema=Wr.Two$=Wr.Two$outboundSchema=Wr.Two$inboundSchema=void 0;Wr.twoToJSON=N_o;Wr.twoFromJSON=j_o;Wr.oneToJSON=D_o;Wr.oneFromJSON=$_o;Wr.chatModerationRequestInputsToJSON=L_o;Wr.chatModerationRequestInputsFromJSON=F_o;Wr.chatModerationRequestToJSON=k_o;Wr.chatModerationRequestFromJSON=q_o;var Le=I_o(te()),lCr=ae(),FPe=ee(),KS=zA(),WS=pj(),GS=mj(),ZS=hj();Wr.Two$inboundSchema=Le.union([WS.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))]);Wr.Two$outboundSchema=Le.union([WS.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))]);var iCr;(function(t){t.inboundSchema=Wr.Two$inboundSchema,t.outboundSchema=Wr.Two$outboundSchema})(iCr||(Wr.Two$=iCr={}));function N_o(t){return JSON.stringify(Wr.Two$outboundSchema.parse(t))}function j_o(t){return(0,FPe.safeParse)(t,e=>Wr.Two$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Two' from JSON")}Wr.One$inboundSchema=Le.union([WS.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))]);Wr.One$outboundSchema=Le.union([WS.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))]);var aCr;(function(t){t.inboundSchema=Wr.One$inboundSchema,t.outboundSchema=Wr.One$outboundSchema})(aCr||(Wr.One$=aCr={}));function D_o(t){return JSON.stringify(Wr.One$outboundSchema.parse(t))}function $_o(t){return(0,FPe.safeParse)(t,e=>Wr.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}Wr.ChatModerationRequestInputs$inboundSchema=Le.union([Le.array(Le.union([WS.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))])),Le.array(Le.array(Le.union([WS.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))])))]);Wr.ChatModerationRequestInputs$outboundSchema=Le.union([Le.array(Le.union([WS.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))])),Le.array(Le.array(Le.union([WS.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))])))]);var sCr;(function(t){t.inboundSchema=Wr.ChatModerationRequestInputs$inboundSchema,t.outboundSchema=Wr.ChatModerationRequestInputs$outboundSchema})(sCr||(Wr.ChatModerationRequestInputs$=sCr={}));function L_o(t){return JSON.stringify(Wr.ChatModerationRequestInputs$outboundSchema.parse(t))}function F_o(t){return(0,FPe.safeParse)(t,e=>Wr.ChatModerationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatModerationRequestInputs' from JSON")}Wr.ChatModerationRequest$inboundSchema=Le.object({input:Le.union([Le.array(Le.union([WS.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))])),Le.array(Le.array(Le.union([WS.SystemMessage$inboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$inboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$inboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$inboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))])))]),model:Le.string()}).transform(t=>(0,lCr.remap)(t,{input:"inputs"}));Wr.ChatModerationRequest$outboundSchema=Le.object({inputs:Le.union([Le.array(Le.union([WS.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))])),Le.array(Le.array(Le.union([WS.SystemMessage$outboundSchema.and(Le.object({role:Le.literal("system")}).transform(t=>({role:t.role}))),GS.ToolMessage$outboundSchema.and(Le.object({role:Le.literal("tool")}).transform(t=>({role:t.role}))),ZS.UserMessage$outboundSchema.and(Le.object({role:Le.literal("user")}).transform(t=>({role:t.role}))),KS.AssistantMessage$outboundSchema.and(Le.object({role:Le.literal("assistant")}).transform(t=>({role:t.role})))])))]),model:Le.string()}).transform(t=>(0,lCr.remap)(t,{inputs:"input"}));var uCr;(function(t){t.inboundSchema=Wr.ChatModerationRequest$inboundSchema,t.outboundSchema=Wr.ChatModerationRequest$outboundSchema})(uCr||(Wr.ChatModerationRequest$=uCr={}));function k_o(t){return JSON.stringify(Wr.ChatModerationRequest$outboundSchema.parse(t))}function q_o(t){return(0,FPe.safeParse)(t,e=>Wr.ChatModerationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ChatModerationRequest' from JSON")}});var Est=S(of=>{"use strict";var B_o=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]}),U_o=of&&of.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),z_o=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"&&B_o(r,e,n[o]);return U_o(r,e),r}}();Object.defineProperty(of,"__esModule",{value:!0});of.MetricOut$=of.MetricOut$outboundSchema=of.MetricOut$inboundSchema=void 0;of.metricOutToJSON=V_o;of.metricOutFromJSON=J_o;var L_=z_o(te()),fCr=ae(),H_o=ee();of.MetricOut$inboundSchema=L_.object({train_loss:L_.nullable(L_.number()).optional(),valid_loss:L_.nullable(L_.number()).optional(),valid_mean_token_accuracy:L_.nullable(L_.number()).optional()}).transform(t=>(0,fCr.remap)(t,{train_loss:"trainLoss",valid_loss:"validLoss",valid_mean_token_accuracy:"validMeanTokenAccuracy"}));of.MetricOut$outboundSchema=L_.object({trainLoss:L_.nullable(L_.number()).optional(),validLoss:L_.nullable(L_.number()).optional(),validMeanTokenAccuracy:L_.nullable(L_.number()).optional()}).transform(t=>(0,fCr.remap)(t,{trainLoss:"train_loss",validLoss:"valid_loss",validMeanTokenAccuracy:"valid_mean_token_accuracy"}));var dCr;(function(t){t.inboundSchema=of.MetricOut$inboundSchema,t.outboundSchema=of.MetricOut$outboundSchema})(dCr||(of.MetricOut$=dCr={}));function V_o(t){return JSON.stringify(of.MetricOut$outboundSchema.parse(t))}function J_o(t){return(0,H_o.safeParse)(t,e=>of.MetricOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MetricOut' from JSON")}});var kPe=S(af=>{"use strict";var K_o=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]}),W_o=af&&af.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G_o=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"&&K_o(r,e,n[o]);return W_o(r,e),r}}();Object.defineProperty(af,"__esModule",{value:!0});af.CheckpointOut$=af.CheckpointOut$outboundSchema=af.CheckpointOut$inboundSchema=void 0;af.checkpointOutToJSON=X_o;af.checkpointOutFromJSON=Y_o;var u9=G_o(te()),mCr=ae(),Z_o=ee(),hCr=Est();af.CheckpointOut$inboundSchema=u9.object({metrics:hCr.MetricOut$inboundSchema,step_number:u9.number().int(),created_at:u9.number().int()}).transform(t=>(0,mCr.remap)(t,{step_number:"stepNumber",created_at:"createdAt"}));af.CheckpointOut$outboundSchema=u9.object({metrics:hCr.MetricOut$outboundSchema,stepNumber:u9.number().int(),createdAt:u9.number().int()}).transform(t=>(0,mCr.remap)(t,{stepNumber:"step_number",createdAt:"created_at"}));var pCr;(function(t){t.inboundSchema=af.CheckpointOut$inboundSchema,t.outboundSchema=af.CheckpointOut$outboundSchema})(pCr||(af.CheckpointOut$=pCr={}));function X_o(t){return JSON.stringify(af.CheckpointOut$outboundSchema.parse(t))}function Y_o(t){return(0,Z_o.safeParse)(t,e=>af.CheckpointOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CheckpointOut' from JSON")}});var vCr=S(ds=>{"use strict";var Q_o=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]}),evo=ds&&ds.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tvo=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"&&Q_o(r,e,n[o]);return evo(r,e),r}}();Object.defineProperty(ds,"__esModule",{value:!0});ds.ClassificationRequest$=ds.ClassificationRequest$outboundSchema=ds.ClassificationRequest$inboundSchema=ds.ClassificationRequestInputs$=ds.ClassificationRequestInputs$outboundSchema=ds.ClassificationRequestInputs$inboundSchema=void 0;ds.classificationRequestInputsToJSON=rvo;ds.classificationRequestInputsFromJSON=nvo;ds.classificationRequestToJSON=ovo;ds.classificationRequestFromJSON=ivo;var sf=tvo(te()),bCr=ae(),_Cr=ee();ds.ClassificationRequestInputs$inboundSchema=sf.union([sf.string(),sf.array(sf.string())]);ds.ClassificationRequestInputs$outboundSchema=sf.union([sf.string(),sf.array(sf.string())]);var gCr;(function(t){t.inboundSchema=ds.ClassificationRequestInputs$inboundSchema,t.outboundSchema=ds.ClassificationRequestInputs$outboundSchema})(gCr||(ds.ClassificationRequestInputs$=gCr={}));function rvo(t){return JSON.stringify(ds.ClassificationRequestInputs$outboundSchema.parse(t))}function nvo(t){return(0,_Cr.safeParse)(t,e=>ds.ClassificationRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequestInputs' from JSON")}ds.ClassificationRequest$inboundSchema=sf.object({model:sf.string(),input:sf.union([sf.string(),sf.array(sf.string())])}).transform(t=>(0,bCr.remap)(t,{input:"inputs"}));ds.ClassificationRequest$outboundSchema=sf.object({model:sf.string(),inputs:sf.union([sf.string(),sf.array(sf.string())])}).transform(t=>(0,bCr.remap)(t,{inputs:"input"}));var yCr;(function(t){t.inboundSchema=ds.ClassificationRequest$inboundSchema,t.outboundSchema=ds.ClassificationRequest$outboundSchema})(yCr||(ds.ClassificationRequest$=yCr={}));function ovo(t){return JSON.stringify(ds.ClassificationRequest$outboundSchema.parse(t))}function ivo(t){return(0,_Cr.safeParse)(t,e=>ds.ClassificationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationRequest' from JSON")}});var Pst=S(uf=>{"use strict";var avo=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]}),svo=uf&&uf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uvo=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"&&avo(r,e,n[o]);return svo(r,e),r}}();Object.defineProperty(uf,"__esModule",{value:!0});uf.ClassificationTargetResult$=uf.ClassificationTargetResult$outboundSchema=uf.ClassificationTargetResult$inboundSchema=void 0;uf.classificationTargetResultToJSON=cvo;uf.classificationTargetResultFromJSON=dvo;var l9=uvo(te()),lvo=ee();uf.ClassificationTargetResult$inboundSchema=l9.object({scores:l9.record(l9.number())});uf.ClassificationTargetResult$outboundSchema=l9.object({scores:l9.record(l9.number())});var wCr;(function(t){t.inboundSchema=uf.ClassificationTargetResult$inboundSchema,t.outboundSchema=uf.ClassificationTargetResult$outboundSchema})(wCr||(uf.ClassificationTargetResult$=wCr={}));function cvo(t){return JSON.stringify(uf.ClassificationTargetResult$outboundSchema.parse(t))}function dvo(t){return(0,lvo.safeParse)(t,e=>uf.ClassificationTargetResult$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationTargetResult' from JSON")}});var xCr=S(lf=>{"use strict";var fvo=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]}),pvo=lf&&lf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mvo=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"&&fvo(r,e,n[o]);return pvo(r,e),r}}();Object.defineProperty(lf,"__esModule",{value:!0});lf.ClassificationResponse$=lf.ClassificationResponse$outboundSchema=lf.ClassificationResponse$inboundSchema=void 0;lf.classificationResponseToJSON=gvo;lf.classificationResponseFromJSON=yvo;var VA=mvo(te()),hvo=ee(),CCr=Pst();lf.ClassificationResponse$inboundSchema=VA.object({id:VA.string(),model:VA.string(),results:VA.array(VA.record(CCr.ClassificationTargetResult$inboundSchema))});lf.ClassificationResponse$outboundSchema=VA.object({id:VA.string(),model:VA.string(),results:VA.array(VA.record(CCr.ClassificationTargetResult$outboundSchema))});var SCr;(function(t){t.inboundSchema=lf.ClassificationResponse$inboundSchema,t.outboundSchema=lf.ClassificationResponse$outboundSchema})(SCr||(lf.ClassificationResponse$=SCr={}));function gvo(t){return JSON.stringify(lf.ClassificationResponse$outboundSchema.parse(t))}function yvo(t){return(0,hvo.safeParse)(t,e=>lf.ClassificationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassificationResponse' from JSON")}});var qPe=S(cf=>{"use strict";var bvo=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]}),_vo=cf&&cf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vvo=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"&&bvo(r,e,n[o]);return _vo(r,e),r}}();Object.defineProperty(cf,"__esModule",{value:!0});cf.FTClassifierLossFunction$=cf.FTClassifierLossFunction$outboundSchema=cf.FTClassifierLossFunction$inboundSchema=cf.FTClassifierLossFunction=void 0;var wvo=vvo(te());cf.FTClassifierLossFunction={SingleClass:"single_class",MultiClass:"multi_class"};cf.FTClassifierLossFunction$inboundSchema=wvo.nativeEnum(cf.FTClassifierLossFunction);cf.FTClassifierLossFunction$outboundSchema=cf.FTClassifierLossFunction$inboundSchema;var OCr;(function(t){t.inboundSchema=cf.FTClassifierLossFunction$inboundSchema,t.outboundSchema=cf.FTClassifierLossFunction$outboundSchema})(OCr||(cf.FTClassifierLossFunction$=OCr={}))});var BPe=S(df=>{"use strict";var Svo=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]}),Cvo=df&&df.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xvo=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"&&Svo(r,e,n[o]);return Cvo(r,e),r}}();Object.defineProperty(df,"__esModule",{value:!0});df.ClassifierTargetOut$=df.ClassifierTargetOut$outboundSchema=df.ClassifierTargetOut$inboundSchema=void 0;df.classifierTargetOutToJSON=Tvo;df.classifierTargetOutFromJSON=Evo;var JA=xvo(te()),ECr=ae(),Ovo=ee(),PCr=qPe();df.ClassifierTargetOut$inboundSchema=JA.object({name:JA.string(),labels:JA.array(JA.string()),weight:JA.number(),loss_function:PCr.FTClassifierLossFunction$inboundSchema}).transform(t=>(0,ECr.remap)(t,{loss_function:"lossFunction"}));df.ClassifierTargetOut$outboundSchema=JA.object({name:JA.string(),labels:JA.array(JA.string()),weight:JA.number(),lossFunction:PCr.FTClassifierLossFunction$outboundSchema}).transform(t=>(0,ECr.remap)(t,{lossFunction:"loss_function"}));var TCr;(function(t){t.inboundSchema=df.ClassifierTargetOut$inboundSchema,t.outboundSchema=df.ClassifierTargetOut$outboundSchema})(TCr||(df.ClassifierTargetOut$=TCr={}));function Tvo(t){return JSON.stringify(df.ClassifierTargetOut$outboundSchema.parse(t))}function Evo(t){return(0,Ovo.safeParse)(t,e=>df.ClassifierTargetOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTargetOut' from JSON")}});var UPe=S(ff=>{"use strict";var Pvo=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]}),Mvo=ff&&ff.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rvo=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"&&Pvo(r,e,n[o]);return Mvo(r,e),r}}();Object.defineProperty(ff,"__esModule",{value:!0});ff.ClassifierTrainingParameters$=ff.ClassifierTrainingParameters$outboundSchema=ff.ClassifierTrainingParameters$inboundSchema=void 0;ff.classifierTrainingParametersToJSON=Ivo;ff.classifierTrainingParametersFromJSON=Nvo;var zl=Rvo(te()),RCr=ae(),Avo=ee();ff.ClassifierTrainingParameters$inboundSchema=zl.object({training_steps:zl.nullable(zl.number().int()).optional(),learning_rate:zl.number().default(1e-4),weight_decay:zl.nullable(zl.number()).optional(),warmup_fraction:zl.nullable(zl.number()).optional(),epochs:zl.nullable(zl.number()).optional(),seq_len:zl.nullable(zl.number().int()).optional()}).transform(t=>(0,RCr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen"}));ff.ClassifierTrainingParameters$outboundSchema=zl.object({trainingSteps:zl.nullable(zl.number().int()).optional(),learningRate:zl.number().default(1e-4),weightDecay:zl.nullable(zl.number()).optional(),warmupFraction:zl.nullable(zl.number()).optional(),epochs:zl.nullable(zl.number()).optional(),seqLen:zl.nullable(zl.number().int()).optional()}).transform(t=>(0,RCr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len"}));var MCr;(function(t){t.inboundSchema=ff.ClassifierTrainingParameters$inboundSchema,t.outboundSchema=ff.ClassifierTrainingParameters$outboundSchema})(MCr||(ff.ClassifierTrainingParameters$=MCr={}));function Ivo(t){return JSON.stringify(ff.ClassifierTrainingParameters$outboundSchema.parse(t))}function Nvo(t){return(0,Avo.safeParse)(t,e=>ff.ClassifierTrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTrainingParameters' from JSON")}});var zPe=S(pf=>{"use strict";var jvo=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]}),Dvo=pf&&pf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$vo=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"&&jvo(r,e,n[o]);return Dvo(r,e),r}}();Object.defineProperty(pf,"__esModule",{value:!0});pf.EventOut$=pf.EventOut$outboundSchema=pf.EventOut$inboundSchema=void 0;pf.eventOutToJSON=Fvo;pf.eventOutFromJSON=kvo;var XS=$vo(te()),ICr=ae(),Lvo=ee();pf.EventOut$inboundSchema=XS.object({name:XS.string(),data:XS.nullable(XS.record(XS.any())).optional(),created_at:XS.number().int()}).transform(t=>(0,ICr.remap)(t,{created_at:"createdAt"}));pf.EventOut$outboundSchema=XS.object({name:XS.string(),data:XS.nullable(XS.record(XS.any())).optional(),createdAt:XS.number().int()}).transform(t=>(0,ICr.remap)(t,{createdAt:"created_at"}));var ACr;(function(t){t.inboundSchema=pf.EventOut$inboundSchema,t.outboundSchema=pf.EventOut$outboundSchema})(ACr||(pf.EventOut$=ACr={}));function Fvo(t){return JSON.stringify(pf.EventOut$outboundSchema.parse(t))}function kvo(t){return(0,Lvo.safeParse)(t,e=>pf.EventOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EventOut' from JSON")}});var c9=S(mf=>{"use strict";var qvo=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]}),Bvo=mf&&mf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uvo=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"&&qvo(r,e,n[o]);return Bvo(r,e),r}}();Object.defineProperty(mf,"__esModule",{value:!0});mf.JobMetadataOut$=mf.JobMetadataOut$outboundSchema=mf.JobMetadataOut$inboundSchema=void 0;mf.jobMetadataOutToJSON=Hvo;mf.jobMetadataOutFromJSON=Vvo;var Vs=Uvo(te()),jCr=ae(),zvo=ee();mf.JobMetadataOut$inboundSchema=Vs.object({expected_duration_seconds:Vs.nullable(Vs.number().int()).optional(),cost:Vs.nullable(Vs.number()).optional(),cost_currency:Vs.nullable(Vs.string()).optional(),train_tokens_per_step:Vs.nullable(Vs.number().int()).optional(),train_tokens:Vs.nullable(Vs.number().int()).optional(),data_tokens:Vs.nullable(Vs.number().int()).optional(),estimated_start_time:Vs.nullable(Vs.number().int()).optional()}).transform(t=>(0,jCr.remap)(t,{expected_duration_seconds:"expectedDurationSeconds",cost_currency:"costCurrency",train_tokens_per_step:"trainTokensPerStep",train_tokens:"trainTokens",data_tokens:"dataTokens",estimated_start_time:"estimatedStartTime"}));mf.JobMetadataOut$outboundSchema=Vs.object({expectedDurationSeconds:Vs.nullable(Vs.number().int()).optional(),cost:Vs.nullable(Vs.number()).optional(),costCurrency:Vs.nullable(Vs.string()).optional(),trainTokensPerStep:Vs.nullable(Vs.number().int()).optional(),trainTokens:Vs.nullable(Vs.number().int()).optional(),dataTokens:Vs.nullable(Vs.number().int()).optional(),estimatedStartTime:Vs.nullable(Vs.number().int()).optional()}).transform(t=>(0,jCr.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 NCr;(function(t){t.inboundSchema=mf.JobMetadataOut$inboundSchema,t.outboundSchema=mf.JobMetadataOut$outboundSchema})(NCr||(mf.JobMetadataOut$=NCr={}));function Hvo(t){return JSON.stringify(mf.JobMetadataOut$outboundSchema.parse(t))}function Vvo(t){return(0,zvo.safeParse)(t,e=>mf.JobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobMetadataOut' from JSON")}});var d9=S(ha=>{"use strict";var Jvo=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]}),Kvo=ha&&ha.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wvo=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"&&Jvo(r,e,n[o]);return Kvo(r,e),r}}();Object.defineProperty(ha,"__esModule",{value:!0});ha.WandbIntegrationOut$=ha.WandbIntegrationOut$outboundSchema=ha.WandbIntegrationOut$inboundSchema=ha.WandbIntegrationOutType$=ha.WandbIntegrationOutType$outboundSchema=ha.WandbIntegrationOutType$inboundSchema=ha.WandbIntegrationOutType=void 0;ha.wandbIntegrationOutToJSON=Zvo;ha.wandbIntegrationOutFromJSON=Xvo;var Tg=Wvo(te()),LCr=ae(),Gvo=ee();ha.WandbIntegrationOutType={Wandb:"wandb"};ha.WandbIntegrationOutType$inboundSchema=Tg.nativeEnum(ha.WandbIntegrationOutType);ha.WandbIntegrationOutType$outboundSchema=ha.WandbIntegrationOutType$inboundSchema;var DCr;(function(t){t.inboundSchema=ha.WandbIntegrationOutType$inboundSchema,t.outboundSchema=ha.WandbIntegrationOutType$outboundSchema})(DCr||(ha.WandbIntegrationOutType$=DCr={}));ha.WandbIntegrationOut$inboundSchema=Tg.object({type:ha.WandbIntegrationOutType$inboundSchema.default("wandb"),project:Tg.string(),name:Tg.nullable(Tg.string()).optional(),run_name:Tg.nullable(Tg.string()).optional(),url:Tg.nullable(Tg.string()).optional()}).transform(t=>(0,LCr.remap)(t,{run_name:"runName"}));ha.WandbIntegrationOut$outboundSchema=Tg.object({type:ha.WandbIntegrationOutType$outboundSchema.default("wandb"),project:Tg.string(),name:Tg.nullable(Tg.string()).optional(),runName:Tg.nullable(Tg.string()).optional(),url:Tg.nullable(Tg.string()).optional()}).transform(t=>(0,LCr.remap)(t,{runName:"run_name"}));var $Cr;(function(t){t.inboundSchema=ha.WandbIntegrationOut$inboundSchema,t.outboundSchema=ha.WandbIntegrationOut$outboundSchema})($Cr||(ha.WandbIntegrationOut$=$Cr={}));function Zvo(t){return JSON.stringify(ha.WandbIntegrationOut$outboundSchema.parse(t))}function Xvo(t){return(0,Gvo.safeParse)(t,e=>ha.WandbIntegrationOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegrationOut' from JSON")}});var ZCr=S(Kt=>{"use strict";var Yvo=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]}),Qvo=Kt&&Kt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ewo=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"&&Yvo(r,e,n[o]);return Qvo(r,e),r}}();Object.defineProperty(Kt,"__esModule",{value:!0});Kt.ClassifierDetailedJobOut$=Kt.ClassifierDetailedJobOut$outboundSchema=Kt.ClassifierDetailedJobOut$inboundSchema=Kt.ClassifierDetailedJobOutJobType$=Kt.ClassifierDetailedJobOutJobType$outboundSchema=Kt.ClassifierDetailedJobOutJobType$inboundSchema=Kt.ClassifierDetailedJobOutIntegrations$=Kt.ClassifierDetailedJobOutIntegrations$outboundSchema=Kt.ClassifierDetailedJobOutIntegrations$inboundSchema=Kt.ClassifierDetailedJobOutObject$=Kt.ClassifierDetailedJobOutObject$outboundSchema=Kt.ClassifierDetailedJobOutObject$inboundSchema=Kt.ClassifierDetailedJobOutStatus$=Kt.ClassifierDetailedJobOutStatus$outboundSchema=Kt.ClassifierDetailedJobOutStatus$inboundSchema=Kt.ClassifierDetailedJobOutJobType=Kt.ClassifierDetailedJobOutObject=Kt.ClassifierDetailedJobOutStatus=void 0;Kt.classifierDetailedJobOutIntegrationsToJSON=two;Kt.classifierDetailedJobOutIntegrationsFromJSON=rwo;Kt.classifierDetailedJobOutToJSON=nwo;Kt.classifierDetailedJobOutFromJSON=owo;var En=ewo(te()),zCr=ae(),HCr=ee(),VCr=kPe(),JCr=BPe(),KCr=UPe(),WCr=zPe(),GCr=c9(),HPe=d9();Kt.ClassifierDetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Kt.ClassifierDetailedJobOutObject={Job:"job"};Kt.ClassifierDetailedJobOutJobType={Classifier:"classifier"};Kt.ClassifierDetailedJobOutStatus$inboundSchema=En.nativeEnum(Kt.ClassifierDetailedJobOutStatus);Kt.ClassifierDetailedJobOutStatus$outboundSchema=Kt.ClassifierDetailedJobOutStatus$inboundSchema;var FCr;(function(t){t.inboundSchema=Kt.ClassifierDetailedJobOutStatus$inboundSchema,t.outboundSchema=Kt.ClassifierDetailedJobOutStatus$outboundSchema})(FCr||(Kt.ClassifierDetailedJobOutStatus$=FCr={}));Kt.ClassifierDetailedJobOutObject$inboundSchema=En.nativeEnum(Kt.ClassifierDetailedJobOutObject);Kt.ClassifierDetailedJobOutObject$outboundSchema=Kt.ClassifierDetailedJobOutObject$inboundSchema;var kCr;(function(t){t.inboundSchema=Kt.ClassifierDetailedJobOutObject$inboundSchema,t.outboundSchema=Kt.ClassifierDetailedJobOutObject$outboundSchema})(kCr||(Kt.ClassifierDetailedJobOutObject$=kCr={}));Kt.ClassifierDetailedJobOutIntegrations$inboundSchema=HPe.WandbIntegrationOut$inboundSchema;Kt.ClassifierDetailedJobOutIntegrations$outboundSchema=HPe.WandbIntegrationOut$outboundSchema;var qCr;(function(t){t.inboundSchema=Kt.ClassifierDetailedJobOutIntegrations$inboundSchema,t.outboundSchema=Kt.ClassifierDetailedJobOutIntegrations$outboundSchema})(qCr||(Kt.ClassifierDetailedJobOutIntegrations$=qCr={}));function two(t){return JSON.stringify(Kt.ClassifierDetailedJobOutIntegrations$outboundSchema.parse(t))}function rwo(t){return(0,HCr.safeParse)(t,e=>Kt.ClassifierDetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierDetailedJobOutIntegrations' from JSON")}Kt.ClassifierDetailedJobOutJobType$inboundSchema=En.nativeEnum(Kt.ClassifierDetailedJobOutJobType);Kt.ClassifierDetailedJobOutJobType$outboundSchema=Kt.ClassifierDetailedJobOutJobType$inboundSchema;var BCr;(function(t){t.inboundSchema=Kt.ClassifierDetailedJobOutJobType$inboundSchema,t.outboundSchema=Kt.ClassifierDetailedJobOutJobType$outboundSchema})(BCr||(Kt.ClassifierDetailedJobOutJobType$=BCr={}));Kt.ClassifierDetailedJobOut$inboundSchema=En.object({id:En.string(),auto_start:En.boolean(),model:En.string(),status:Kt.ClassifierDetailedJobOutStatus$inboundSchema,created_at:En.number().int(),modified_at:En.number().int(),training_files:En.array(En.string()),validation_files:En.nullable(En.array(En.string())).optional(),object:Kt.ClassifierDetailedJobOutObject$inboundSchema.default("job"),fine_tuned_model:En.nullable(En.string()).optional(),suffix:En.nullable(En.string()).optional(),integrations:En.nullable(En.array(HPe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:En.nullable(En.number().int()).optional(),metadata:En.nullable(GCr.JobMetadataOut$inboundSchema).optional(),job_type:Kt.ClassifierDetailedJobOutJobType$inboundSchema.default("classifier"),hyperparameters:KCr.ClassifierTrainingParameters$inboundSchema,events:En.array(WCr.EventOut$inboundSchema).optional(),checkpoints:En.array(VCr.CheckpointOut$inboundSchema).optional(),classifier_targets:En.array(JCr.ClassifierTargetOut$inboundSchema)}).transform(t=>(0,zCr.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"}));Kt.ClassifierDetailedJobOut$outboundSchema=En.object({id:En.string(),autoStart:En.boolean(),model:En.string(),status:Kt.ClassifierDetailedJobOutStatus$outboundSchema,createdAt:En.number().int(),modifiedAt:En.number().int(),trainingFiles:En.array(En.string()),validationFiles:En.nullable(En.array(En.string())).optional(),object:Kt.ClassifierDetailedJobOutObject$outboundSchema.default("job"),fineTunedModel:En.nullable(En.string()).optional(),suffix:En.nullable(En.string()).optional(),integrations:En.nullable(En.array(HPe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:En.nullable(En.number().int()).optional(),metadata:En.nullable(GCr.JobMetadataOut$outboundSchema).optional(),jobType:Kt.ClassifierDetailedJobOutJobType$outboundSchema.default("classifier"),hyperparameters:KCr.ClassifierTrainingParameters$outboundSchema,events:En.array(WCr.EventOut$outboundSchema).optional(),checkpoints:En.array(VCr.CheckpointOut$outboundSchema).optional(),classifierTargets:En.array(JCr.ClassifierTargetOut$outboundSchema)}).transform(t=>(0,zCr.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 UCr;(function(t){t.inboundSchema=Kt.ClassifierDetailedJobOut$inboundSchema,t.outboundSchema=Kt.ClassifierDetailedJobOut$outboundSchema})(UCr||(Kt.ClassifierDetailedJobOut$=UCr={}));function nwo(t){return JSON.stringify(Kt.ClassifierDetailedJobOut$outboundSchema.parse(t))}function owo(t){return(0,HCr.safeParse)(t,e=>Kt.ClassifierDetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierDetailedJobOut' from JSON")}});var VPe=S(hf=>{"use strict";var iwo=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]}),awo=hf&&hf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),swo=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"&&iwo(r,e,n[o]);return awo(r,e),r}}();Object.defineProperty(hf,"__esModule",{value:!0});hf.FTModelCapabilitiesOut$=hf.FTModelCapabilitiesOut$outboundSchema=hf.FTModelCapabilitiesOut$inboundSchema=void 0;hf.ftModelCapabilitiesOutToJSON=lwo;hf.ftModelCapabilitiesOutFromJSON=cwo;var YS=swo(te()),YCr=ae(),uwo=ee();hf.FTModelCapabilitiesOut$inboundSchema=YS.object({completion_chat:YS.boolean().default(!0),completion_fim:YS.boolean().default(!1),function_calling:YS.boolean().default(!1),fine_tuning:YS.boolean().default(!1),classification:YS.boolean().default(!1)}).transform(t=>(0,YCr.remap)(t,{completion_chat:"completionChat",completion_fim:"completionFim",function_calling:"functionCalling",fine_tuning:"fineTuning"}));hf.FTModelCapabilitiesOut$outboundSchema=YS.object({completionChat:YS.boolean().default(!0),completionFim:YS.boolean().default(!1),functionCalling:YS.boolean().default(!1),fineTuning:YS.boolean().default(!1),classification:YS.boolean().default(!1)}).transform(t=>(0,YCr.remap)(t,{completionChat:"completion_chat",completionFim:"completion_fim",functionCalling:"function_calling",fineTuning:"fine_tuning"}));var XCr;(function(t){t.inboundSchema=hf.FTModelCapabilitiesOut$inboundSchema,t.outboundSchema=hf.FTModelCapabilitiesOut$outboundSchema})(XCr||(hf.FTModelCapabilitiesOut$=XCr={}));function lwo(t){return JSON.stringify(hf.FTModelCapabilitiesOut$outboundSchema.parse(t))}function cwo(t){return(0,uwo.safeParse)(t,e=>hf.FTModelCapabilitiesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCapabilitiesOut' from JSON")}});var ixr=S(kn=>{"use strict";var dwo=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]}),fwo=kn&&kn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pwo=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"&&dwo(r,e,n[o]);return fwo(r,e),r}}();Object.defineProperty(kn,"__esModule",{value:!0});kn.ClassifierFTModelOut$=kn.ClassifierFTModelOut$outboundSchema=kn.ClassifierFTModelOut$inboundSchema=kn.ClassifierFTModelOutModelType$=kn.ClassifierFTModelOutModelType$outboundSchema=kn.ClassifierFTModelOutModelType$inboundSchema=kn.ClassifierFTModelOutObject$=kn.ClassifierFTModelOutObject$outboundSchema=kn.ClassifierFTModelOutObject$inboundSchema=kn.ClassifierFTModelOutModelType=kn.ClassifierFTModelOutObject=void 0;kn.classifierFTModelOutToJSON=hwo;kn.classifierFTModelOutFromJSON=gwo;var Mi=pwo(te()),rxr=ae(),mwo=ee(),nxr=BPe(),oxr=VPe();kn.ClassifierFTModelOutObject={Model:"model"};kn.ClassifierFTModelOutModelType={Classifier:"classifier"};kn.ClassifierFTModelOutObject$inboundSchema=Mi.nativeEnum(kn.ClassifierFTModelOutObject);kn.ClassifierFTModelOutObject$outboundSchema=kn.ClassifierFTModelOutObject$inboundSchema;var QCr;(function(t){t.inboundSchema=kn.ClassifierFTModelOutObject$inboundSchema,t.outboundSchema=kn.ClassifierFTModelOutObject$outboundSchema})(QCr||(kn.ClassifierFTModelOutObject$=QCr={}));kn.ClassifierFTModelOutModelType$inboundSchema=Mi.nativeEnum(kn.ClassifierFTModelOutModelType);kn.ClassifierFTModelOutModelType$outboundSchema=kn.ClassifierFTModelOutModelType$inboundSchema;var exr;(function(t){t.inboundSchema=kn.ClassifierFTModelOutModelType$inboundSchema,t.outboundSchema=kn.ClassifierFTModelOutModelType$outboundSchema})(exr||(kn.ClassifierFTModelOutModelType$=exr={}));kn.ClassifierFTModelOut$inboundSchema=Mi.object({id:Mi.string(),object:kn.ClassifierFTModelOutObject$inboundSchema.default("model"),created:Mi.number().int(),owned_by:Mi.string(),workspace_id:Mi.string(),root:Mi.string(),root_version:Mi.string(),archived:Mi.boolean(),name:Mi.nullable(Mi.string()).optional(),description:Mi.nullable(Mi.string()).optional(),capabilities:oxr.FTModelCapabilitiesOut$inboundSchema,max_context_length:Mi.number().int().default(32768),aliases:Mi.array(Mi.string()).optional(),job:Mi.string(),classifier_targets:Mi.array(nxr.ClassifierTargetOut$inboundSchema),model_type:kn.ClassifierFTModelOutModelType$inboundSchema.default("classifier")}).transform(t=>(0,rxr.remap)(t,{owned_by:"ownedBy",workspace_id:"workspaceId",root_version:"rootVersion",max_context_length:"maxContextLength",classifier_targets:"classifierTargets",model_type:"modelType"}));kn.ClassifierFTModelOut$outboundSchema=Mi.object({id:Mi.string(),object:kn.ClassifierFTModelOutObject$outboundSchema.default("model"),created:Mi.number().int(),ownedBy:Mi.string(),workspaceId:Mi.string(),root:Mi.string(),rootVersion:Mi.string(),archived:Mi.boolean(),name:Mi.nullable(Mi.string()).optional(),description:Mi.nullable(Mi.string()).optional(),capabilities:oxr.FTModelCapabilitiesOut$outboundSchema,maxContextLength:Mi.number().int().default(32768),aliases:Mi.array(Mi.string()).optional(),job:Mi.string(),classifierTargets:Mi.array(nxr.ClassifierTargetOut$outboundSchema),modelType:kn.ClassifierFTModelOutModelType$outboundSchema.default("classifier")}).transform(t=>(0,rxr.remap)(t,{ownedBy:"owned_by",workspaceId:"workspace_id",rootVersion:"root_version",maxContextLength:"max_context_length",classifierTargets:"classifier_targets",modelType:"model_type"}));var txr;(function(t){t.inboundSchema=kn.ClassifierFTModelOut$inboundSchema,t.outboundSchema=kn.ClassifierFTModelOut$outboundSchema})(txr||(kn.ClassifierFTModelOut$=txr={}));function hwo(t){return JSON.stringify(kn.ClassifierFTModelOut$outboundSchema.parse(t))}function gwo(t){return(0,mwo.safeParse)(t,e=>kn.ClassifierFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierFTModelOut' from JSON")}});var Mst=S(Wt=>{"use strict";var ywo=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]}),bwo=Wt&&Wt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_wo=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"&&ywo(r,e,n[o]);return bwo(r,e),r}}();Object.defineProperty(Wt,"__esModule",{value:!0});Wt.ClassifierJobOut$=Wt.ClassifierJobOut$outboundSchema=Wt.ClassifierJobOut$inboundSchema=Wt.ClassifierJobOutJobType$=Wt.ClassifierJobOutJobType$outboundSchema=Wt.ClassifierJobOutJobType$inboundSchema=Wt.ClassifierJobOutIntegrations$=Wt.ClassifierJobOutIntegrations$outboundSchema=Wt.ClassifierJobOutIntegrations$inboundSchema=Wt.ClassifierJobOutObject$=Wt.ClassifierJobOutObject$outboundSchema=Wt.ClassifierJobOutObject$inboundSchema=Wt.ClassifierJobOutStatus$=Wt.ClassifierJobOutStatus$outboundSchema=Wt.ClassifierJobOutStatus$inboundSchema=Wt.ClassifierJobOutJobType=Wt.ClassifierJobOutObject=Wt.ClassifierJobOutStatus=void 0;Wt.classifierJobOutIntegrationsToJSON=vwo;Wt.classifierJobOutIntegrationsFromJSON=wwo;Wt.classifierJobOutToJSON=Swo;Wt.classifierJobOutFromJSON=Cwo;var Ao=_wo(te()),dxr=ae(),fxr=ee(),pxr=UPe(),mxr=c9(),JPe=d9();Wt.ClassifierJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};Wt.ClassifierJobOutObject={Job:"job"};Wt.ClassifierJobOutJobType={Classifier:"classifier"};Wt.ClassifierJobOutStatus$inboundSchema=Ao.nativeEnum(Wt.ClassifierJobOutStatus);Wt.ClassifierJobOutStatus$outboundSchema=Wt.ClassifierJobOutStatus$inboundSchema;var axr;(function(t){t.inboundSchema=Wt.ClassifierJobOutStatus$inboundSchema,t.outboundSchema=Wt.ClassifierJobOutStatus$outboundSchema})(axr||(Wt.ClassifierJobOutStatus$=axr={}));Wt.ClassifierJobOutObject$inboundSchema=Ao.nativeEnum(Wt.ClassifierJobOutObject);Wt.ClassifierJobOutObject$outboundSchema=Wt.ClassifierJobOutObject$inboundSchema;var sxr;(function(t){t.inboundSchema=Wt.ClassifierJobOutObject$inboundSchema,t.outboundSchema=Wt.ClassifierJobOutObject$outboundSchema})(sxr||(Wt.ClassifierJobOutObject$=sxr={}));Wt.ClassifierJobOutIntegrations$inboundSchema=JPe.WandbIntegrationOut$inboundSchema;Wt.ClassifierJobOutIntegrations$outboundSchema=JPe.WandbIntegrationOut$outboundSchema;var uxr;(function(t){t.inboundSchema=Wt.ClassifierJobOutIntegrations$inboundSchema,t.outboundSchema=Wt.ClassifierJobOutIntegrations$outboundSchema})(uxr||(Wt.ClassifierJobOutIntegrations$=uxr={}));function vwo(t){return JSON.stringify(Wt.ClassifierJobOutIntegrations$outboundSchema.parse(t))}function wwo(t){return(0,fxr.safeParse)(t,e=>Wt.ClassifierJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierJobOutIntegrations' from JSON")}Wt.ClassifierJobOutJobType$inboundSchema=Ao.nativeEnum(Wt.ClassifierJobOutJobType);Wt.ClassifierJobOutJobType$outboundSchema=Wt.ClassifierJobOutJobType$inboundSchema;var lxr;(function(t){t.inboundSchema=Wt.ClassifierJobOutJobType$inboundSchema,t.outboundSchema=Wt.ClassifierJobOutJobType$outboundSchema})(lxr||(Wt.ClassifierJobOutJobType$=lxr={}));Wt.ClassifierJobOut$inboundSchema=Ao.object({id:Ao.string(),auto_start:Ao.boolean(),model:Ao.string(),status:Wt.ClassifierJobOutStatus$inboundSchema,created_at:Ao.number().int(),modified_at:Ao.number().int(),training_files:Ao.array(Ao.string()),validation_files:Ao.nullable(Ao.array(Ao.string())).optional(),object:Wt.ClassifierJobOutObject$inboundSchema.default("job"),fine_tuned_model:Ao.nullable(Ao.string()).optional(),suffix:Ao.nullable(Ao.string()).optional(),integrations:Ao.nullable(Ao.array(JPe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Ao.nullable(Ao.number().int()).optional(),metadata:Ao.nullable(mxr.JobMetadataOut$inboundSchema).optional(),job_type:Wt.ClassifierJobOutJobType$inboundSchema.default("classifier"),hyperparameters:pxr.ClassifierTrainingParameters$inboundSchema}).transform(t=>(0,dxr.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"}));Wt.ClassifierJobOut$outboundSchema=Ao.object({id:Ao.string(),autoStart:Ao.boolean(),model:Ao.string(),status:Wt.ClassifierJobOutStatus$outboundSchema,createdAt:Ao.number().int(),modifiedAt:Ao.number().int(),trainingFiles:Ao.array(Ao.string()),validationFiles:Ao.nullable(Ao.array(Ao.string())).optional(),object:Wt.ClassifierJobOutObject$outboundSchema.default("job"),fineTunedModel:Ao.nullable(Ao.string()).optional(),suffix:Ao.nullable(Ao.string()).optional(),integrations:Ao.nullable(Ao.array(JPe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Ao.nullable(Ao.number().int()).optional(),metadata:Ao.nullable(mxr.JobMetadataOut$outboundSchema).optional(),jobType:Wt.ClassifierJobOutJobType$outboundSchema.default("classifier"),hyperparameters:pxr.ClassifierTrainingParameters$outboundSchema}).transform(t=>(0,dxr.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 cxr;(function(t){t.inboundSchema=Wt.ClassifierJobOut$inboundSchema,t.outboundSchema=Wt.ClassifierJobOut$outboundSchema})(cxr||(Wt.ClassifierJobOut$=cxr={}));function Swo(t){return JSON.stringify(Wt.ClassifierJobOut$outboundSchema.parse(t))}function Cwo(t){return(0,fxr.safeParse)(t,e=>Wt.ClassifierJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierJobOut' from JSON")}});var Rst=S(gf=>{"use strict";var xwo=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]}),Owo=gf&&gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Two=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"&&xwo(r,e,n[o]);return Owo(r,e),r}}();Object.defineProperty(gf,"__esModule",{value:!0});gf.ClassifierTargetIn$=gf.ClassifierTargetIn$outboundSchema=gf.ClassifierTargetIn$inboundSchema=void 0;gf.classifierTargetInToJSON=Pwo;gf.classifierTargetInFromJSON=Mwo;var QS=Two(te()),gxr=ae(),Ewo=ee(),yxr=qPe();gf.ClassifierTargetIn$inboundSchema=QS.object({name:QS.string(),labels:QS.array(QS.string()),weight:QS.number().default(1),loss_function:QS.nullable(yxr.FTClassifierLossFunction$inboundSchema).optional()}).transform(t=>(0,gxr.remap)(t,{loss_function:"lossFunction"}));gf.ClassifierTargetIn$outboundSchema=QS.object({name:QS.string(),labels:QS.array(QS.string()),weight:QS.number().default(1),lossFunction:QS.nullable(yxr.FTClassifierLossFunction$outboundSchema).optional()}).transform(t=>(0,gxr.remap)(t,{lossFunction:"loss_function"}));var hxr;(function(t){t.inboundSchema=gf.ClassifierTargetIn$inboundSchema,t.outboundSchema=gf.ClassifierTargetIn$outboundSchema})(hxr||(gf.ClassifierTargetIn$=hxr={}));function Pwo(t){return JSON.stringify(gf.ClassifierTargetIn$outboundSchema.parse(t))}function Mwo(t){return(0,Ewo.safeParse)(t,e=>gf.ClassifierTargetIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTargetIn' from JSON")}});var Ast=S(yf=>{"use strict";var Rwo=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]}),Awo=yf&&yf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Iwo=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"&&Rwo(r,e,n[o]);return Awo(r,e),r}}();Object.defineProperty(yf,"__esModule",{value:!0});yf.ClassifierTrainingParametersIn$=yf.ClassifierTrainingParametersIn$outboundSchema=yf.ClassifierTrainingParametersIn$inboundSchema=void 0;yf.classifierTrainingParametersInToJSON=jwo;yf.classifierTrainingParametersInFromJSON=Dwo;var Hl=Iwo(te()),_xr=ae(),Nwo=ee();yf.ClassifierTrainingParametersIn$inboundSchema=Hl.object({training_steps:Hl.nullable(Hl.number().int()).optional(),learning_rate:Hl.number().default(1e-4),weight_decay:Hl.nullable(Hl.number()).optional(),warmup_fraction:Hl.nullable(Hl.number()).optional(),epochs:Hl.nullable(Hl.number()).optional(),seq_len:Hl.nullable(Hl.number().int()).optional()}).transform(t=>(0,_xr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen"}));yf.ClassifierTrainingParametersIn$outboundSchema=Hl.object({trainingSteps:Hl.nullable(Hl.number().int()).optional(),learningRate:Hl.number().default(1e-4),weightDecay:Hl.nullable(Hl.number()).optional(),warmupFraction:Hl.nullable(Hl.number()).optional(),epochs:Hl.nullable(Hl.number()).optional(),seqLen:Hl.nullable(Hl.number().int()).optional()}).transform(t=>(0,_xr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len"}));var bxr;(function(t){t.inboundSchema=yf.ClassifierTrainingParametersIn$inboundSchema,t.outboundSchema=yf.ClassifierTrainingParametersIn$outboundSchema})(bxr||(yf.ClassifierTrainingParametersIn$=bxr={}));function jwo(t){return JSON.stringify(yf.ClassifierTrainingParametersIn$outboundSchema.parse(t))}function Dwo(t){return(0,Nwo.safeParse)(t,e=>yf.ClassifierTrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ClassifierTrainingParametersIn' from JSON")}});var Ist=S(fs=>{"use strict";var $wo=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]}),Lwo=fs&&fs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fwo=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"&&$wo(r,e,n[o]);return Lwo(r,e),r}}();Object.defineProperty(fs,"__esModule",{value:!0});fs.DeltaMessage$=fs.DeltaMessage$outboundSchema=fs.DeltaMessage$inboundSchema=fs.Content$=fs.Content$outboundSchema=fs.Content$inboundSchema=void 0;fs.contentToJSON=kwo;fs.contentFromJSON=qwo;fs.deltaMessageToJSON=Bwo;fs.deltaMessageFromJSON=Uwo;var Vl=Fwo(te()),Sxr=ae(),Cxr=ee(),KPe=r9(),xxr=kEe();fs.Content$inboundSchema=Vl.union([Vl.string(),Vl.array(KPe.ContentChunk$inboundSchema)]);fs.Content$outboundSchema=Vl.union([Vl.string(),Vl.array(KPe.ContentChunk$outboundSchema)]);var vxr;(function(t){t.inboundSchema=fs.Content$inboundSchema,t.outboundSchema=fs.Content$outboundSchema})(vxr||(fs.Content$=vxr={}));function kwo(t){return JSON.stringify(fs.Content$outboundSchema.parse(t))}function qwo(t){return(0,Cxr.safeParse)(t,e=>fs.Content$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Content' from JSON")}fs.DeltaMessage$inboundSchema=Vl.object({role:Vl.nullable(Vl.string()).optional(),content:Vl.nullable(Vl.union([Vl.string(),Vl.array(KPe.ContentChunk$inboundSchema)])).optional(),tool_calls:Vl.nullable(Vl.array(xxr.ToolCall$inboundSchema)).optional()}).transform(t=>(0,Sxr.remap)(t,{tool_calls:"toolCalls"}));fs.DeltaMessage$outboundSchema=Vl.object({role:Vl.nullable(Vl.string()).optional(),content:Vl.nullable(Vl.union([Vl.string(),Vl.array(KPe.ContentChunk$outboundSchema)])).optional(),toolCalls:Vl.nullable(Vl.array(xxr.ToolCall$outboundSchema)).optional()}).transform(t=>(0,Sxr.remap)(t,{toolCalls:"tool_calls"}));var wxr;(function(t){t.inboundSchema=fs.DeltaMessage$inboundSchema,t.outboundSchema=fs.DeltaMessage$outboundSchema})(wxr||(fs.DeltaMessage$=wxr={}));function Bwo(t){return JSON.stringify(fs.DeltaMessage$outboundSchema.parse(t))}function Uwo(t){return(0,Cxr.safeParse)(t,e=>fs.DeltaMessage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeltaMessage' from JSON")}});var Nst=S(ga=>{"use strict";var zwo=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]}),Hwo=ga&&ga.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vwo=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"&&zwo(r,e,n[o]);return Hwo(r,e),r}}();Object.defineProperty(ga,"__esModule",{value:!0});ga.CompletionResponseStreamChoice$=ga.CompletionResponseStreamChoice$outboundSchema=ga.CompletionResponseStreamChoice$inboundSchema=ga.CompletionResponseStreamChoiceFinishReason$=ga.CompletionResponseStreamChoiceFinishReason$outboundSchema=ga.CompletionResponseStreamChoiceFinishReason$inboundSchema=ga.CompletionResponseStreamChoiceFinishReason=void 0;ga.completionResponseStreamChoiceToJSON=Wwo;ga.completionResponseStreamChoiceFromJSON=Gwo;var aw=Vwo(te()),Exr=ae(),Jwo=ee(),Kwo=QC(),Pxr=Ist();ga.CompletionResponseStreamChoiceFinishReason={Stop:"stop",Length:"length",Error:"error",ToolCalls:"tool_calls"};ga.CompletionResponseStreamChoiceFinishReason$inboundSchema=aw.union([aw.nativeEnum(ga.CompletionResponseStreamChoiceFinishReason),aw.string().transform(Kwo.catchUnrecognizedEnum)]);ga.CompletionResponseStreamChoiceFinishReason$outboundSchema=aw.union([aw.nativeEnum(ga.CompletionResponseStreamChoiceFinishReason),aw.string().and(aw.custom())]);var Oxr;(function(t){t.inboundSchema=ga.CompletionResponseStreamChoiceFinishReason$inboundSchema,t.outboundSchema=ga.CompletionResponseStreamChoiceFinishReason$outboundSchema})(Oxr||(ga.CompletionResponseStreamChoiceFinishReason$=Oxr={}));ga.CompletionResponseStreamChoice$inboundSchema=aw.object({index:aw.number().int(),delta:Pxr.DeltaMessage$inboundSchema,finish_reason:aw.nullable(ga.CompletionResponseStreamChoiceFinishReason$inboundSchema)}).transform(t=>(0,Exr.remap)(t,{finish_reason:"finishReason"}));ga.CompletionResponseStreamChoice$outboundSchema=aw.object({index:aw.number().int(),delta:Pxr.DeltaMessage$outboundSchema,finishReason:aw.nullable(ga.CompletionResponseStreamChoiceFinishReason$outboundSchema)}).transform(t=>(0,Exr.remap)(t,{finishReason:"finish_reason"}));var Txr;(function(t){t.inboundSchema=ga.CompletionResponseStreamChoice$inboundSchema,t.outboundSchema=ga.CompletionResponseStreamChoice$outboundSchema})(Txr||(ga.CompletionResponseStreamChoice$=Txr={}));function Wwo(t){return JSON.stringify(ga.CompletionResponseStreamChoice$outboundSchema.parse(t))}function Gwo(t){return(0,Jwo.safeParse)(t,e=>ga.CompletionResponseStreamChoice$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionResponseStreamChoice' from JSON")}});var jst=S(bf=>{"use strict";var Zwo=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]}),Xwo=bf&&bf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ywo=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"&&Zwo(r,e,n[o]);return Xwo(r,e),r}}();Object.defineProperty(bf,"__esModule",{value:!0});bf.CompletionChunk$=bf.CompletionChunk$outboundSchema=bf.CompletionChunk$inboundSchema=void 0;bf.completionChunkToJSON=eSo;bf.completionChunkFromJSON=tSo;var e0=Ywo(te()),Qwo=ee(),Rxr=Nst(),Axr=pq();bf.CompletionChunk$inboundSchema=e0.object({id:e0.string(),object:e0.string().optional(),created:e0.number().int().optional(),model:e0.string(),usage:Axr.UsageInfo$inboundSchema.optional(),choices:e0.array(Rxr.CompletionResponseStreamChoice$inboundSchema)});bf.CompletionChunk$outboundSchema=e0.object({id:e0.string(),object:e0.string().optional(),created:e0.number().int().optional(),model:e0.string(),usage:Axr.UsageInfo$outboundSchema.optional(),choices:e0.array(Rxr.CompletionResponseStreamChoice$outboundSchema)});var Mxr;(function(t){t.inboundSchema=bf.CompletionChunk$inboundSchema,t.outboundSchema=bf.CompletionChunk$outboundSchema})(Mxr||(bf.CompletionChunk$=Mxr={}));function eSo(t){return JSON.stringify(bf.CompletionChunk$outboundSchema.parse(t))}function tSo(t){return(0,Qwo.safeParse)(t,e=>bf.CompletionChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionChunk' from JSON")}});var WPe=S(_f=>{"use strict";var rSo=_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]}),nSo=_f&&_f.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oSo=_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"&&rSo(r,e,n[o]);return nSo(r,e),r}}();Object.defineProperty(_f,"__esModule",{value:!0});_f.CompletionTrainingParameters$=_f.CompletionTrainingParameters$outboundSchema=_f.CompletionTrainingParameters$inboundSchema=void 0;_f.completionTrainingParametersToJSON=aSo;_f.completionTrainingParametersFromJSON=sSo;var fu=oSo(te()),Nxr=ae(),iSo=ee();_f.CompletionTrainingParameters$inboundSchema=fu.object({training_steps:fu.nullable(fu.number().int()).optional(),learning_rate:fu.number().default(1e-4),weight_decay:fu.nullable(fu.number()).optional(),warmup_fraction:fu.nullable(fu.number()).optional(),epochs:fu.nullable(fu.number()).optional(),seq_len:fu.nullable(fu.number().int()).optional(),fim_ratio:fu.nullable(fu.number()).optional()}).transform(t=>(0,Nxr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen",fim_ratio:"fimRatio"}));_f.CompletionTrainingParameters$outboundSchema=fu.object({trainingSteps:fu.nullable(fu.number().int()).optional(),learningRate:fu.number().default(1e-4),weightDecay:fu.nullable(fu.number()).optional(),warmupFraction:fu.nullable(fu.number()).optional(),epochs:fu.nullable(fu.number()).optional(),seqLen:fu.nullable(fu.number().int()).optional(),fimRatio:fu.nullable(fu.number()).optional()}).transform(t=>(0,Nxr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len",fimRatio:"fim_ratio"}));var Ixr;(function(t){t.inboundSchema=_f.CompletionTrainingParameters$inboundSchema,t.outboundSchema=_f.CompletionTrainingParameters$outboundSchema})(Ixr||(_f.CompletionTrainingParameters$=Ixr={}));function aSo(t){return JSON.stringify(_f.CompletionTrainingParameters$outboundSchema.parse(t))}function sSo(t){return(0,iSo.safeParse)(t,e=>_f.CompletionTrainingParameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionTrainingParameters' from JSON")}});var GPe=S(ya=>{"use strict";var uSo=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]}),lSo=ya&&ya.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cSo=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"&&uSo(r,e,n[o]);return lSo(r,e),r}}();Object.defineProperty(ya,"__esModule",{value:!0});ya.GithubRepositoryOut$=ya.GithubRepositoryOut$outboundSchema=ya.GithubRepositoryOut$inboundSchema=ya.GithubRepositoryOutType$=ya.GithubRepositoryOutType$outboundSchema=ya.GithubRepositoryOutType$inboundSchema=ya.GithubRepositoryOutType=void 0;ya.githubRepositoryOutToJSON=fSo;ya.githubRepositoryOutFromJSON=pSo;var Cb=cSo(te()),$xr=ae(),dSo=ee();ya.GithubRepositoryOutType={Github:"github"};ya.GithubRepositoryOutType$inboundSchema=Cb.nativeEnum(ya.GithubRepositoryOutType);ya.GithubRepositoryOutType$outboundSchema=ya.GithubRepositoryOutType$inboundSchema;var jxr;(function(t){t.inboundSchema=ya.GithubRepositoryOutType$inboundSchema,t.outboundSchema=ya.GithubRepositoryOutType$outboundSchema})(jxr||(ya.GithubRepositoryOutType$=jxr={}));ya.GithubRepositoryOut$inboundSchema=Cb.object({type:ya.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,$xr.remap)(t,{commit_id:"commitId"}));ya.GithubRepositoryOut$outboundSchema=Cb.object({type:ya.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,$xr.remap)(t,{commitId:"commit_id"}));var Dxr;(function(t){t.inboundSchema=ya.GithubRepositoryOut$inboundSchema,t.outboundSchema=ya.GithubRepositoryOut$outboundSchema})(Dxr||(ya.GithubRepositoryOut$=Dxr={}));function fSo(t){return JSON.stringify(ya.GithubRepositoryOut$outboundSchema.parse(t))}function pSo(t){return(0,dSo.safeParse)(t,e=>ya.GithubRepositoryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryOut' from JSON")}});var Wxr=S(bt=>{"use strict";var mSo=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]}),hSo=bt&&bt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gSo=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"&&mSo(r,e,n[o]);return hSo(r,e),r}}();Object.defineProperty(bt,"__esModule",{value:!0});bt.CompletionDetailedJobOut$=bt.CompletionDetailedJobOut$outboundSchema=bt.CompletionDetailedJobOut$inboundSchema=bt.CompletionDetailedJobOutRepositories$=bt.CompletionDetailedJobOutRepositories$outboundSchema=bt.CompletionDetailedJobOutRepositories$inboundSchema=bt.CompletionDetailedJobOutJobType$=bt.CompletionDetailedJobOutJobType$outboundSchema=bt.CompletionDetailedJobOutJobType$inboundSchema=bt.CompletionDetailedJobOutIntegrations$=bt.CompletionDetailedJobOutIntegrations$outboundSchema=bt.CompletionDetailedJobOutIntegrations$inboundSchema=bt.CompletionDetailedJobOutObject$=bt.CompletionDetailedJobOutObject$outboundSchema=bt.CompletionDetailedJobOutObject$inboundSchema=bt.CompletionDetailedJobOutStatus$=bt.CompletionDetailedJobOutStatus$outboundSchema=bt.CompletionDetailedJobOutStatus$inboundSchema=bt.CompletionDetailedJobOutJobType=bt.CompletionDetailedJobOutObject=bt.CompletionDetailedJobOutStatus=void 0;bt.completionDetailedJobOutIntegrationsToJSON=ySo;bt.completionDetailedJobOutIntegrationsFromJSON=bSo;bt.completionDetailedJobOutRepositoriesToJSON=_So;bt.completionDetailedJobOutRepositoriesFromJSON=vSo;bt.completionDetailedJobOutToJSON=wSo;bt.completionDetailedJobOutFromJSON=SSo;var Pn=gSo(te()),zxr=ae(),Dst=ee(),Hxr=kPe(),Vxr=WPe(),Jxr=zPe(),ZPe=GPe(),Kxr=c9(),XPe=d9();bt.CompletionDetailedJobOutStatus={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};bt.CompletionDetailedJobOutObject={Job:"job"};bt.CompletionDetailedJobOutJobType={Completion:"completion"};bt.CompletionDetailedJobOutStatus$inboundSchema=Pn.nativeEnum(bt.CompletionDetailedJobOutStatus);bt.CompletionDetailedJobOutStatus$outboundSchema=bt.CompletionDetailedJobOutStatus$inboundSchema;var Lxr;(function(t){t.inboundSchema=bt.CompletionDetailedJobOutStatus$inboundSchema,t.outboundSchema=bt.CompletionDetailedJobOutStatus$outboundSchema})(Lxr||(bt.CompletionDetailedJobOutStatus$=Lxr={}));bt.CompletionDetailedJobOutObject$inboundSchema=Pn.nativeEnum(bt.CompletionDetailedJobOutObject);bt.CompletionDetailedJobOutObject$outboundSchema=bt.CompletionDetailedJobOutObject$inboundSchema;var Fxr;(function(t){t.inboundSchema=bt.CompletionDetailedJobOutObject$inboundSchema,t.outboundSchema=bt.CompletionDetailedJobOutObject$outboundSchema})(Fxr||(bt.CompletionDetailedJobOutObject$=Fxr={}));bt.CompletionDetailedJobOutIntegrations$inboundSchema=XPe.WandbIntegrationOut$inboundSchema;bt.CompletionDetailedJobOutIntegrations$outboundSchema=XPe.WandbIntegrationOut$outboundSchema;var kxr;(function(t){t.inboundSchema=bt.CompletionDetailedJobOutIntegrations$inboundSchema,t.outboundSchema=bt.CompletionDetailedJobOutIntegrations$outboundSchema})(kxr||(bt.CompletionDetailedJobOutIntegrations$=kxr={}));function ySo(t){return JSON.stringify(bt.CompletionDetailedJobOutIntegrations$outboundSchema.parse(t))}function bSo(t){return(0,Dst.safeParse)(t,e=>bt.CompletionDetailedJobOutIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOutIntegrations' from JSON")}bt.CompletionDetailedJobOutJobType$inboundSchema=Pn.nativeEnum(bt.CompletionDetailedJobOutJobType);bt.CompletionDetailedJobOutJobType$outboundSchema=bt.CompletionDetailedJobOutJobType$inboundSchema;var qxr;(function(t){t.inboundSchema=bt.CompletionDetailedJobOutJobType$inboundSchema,t.outboundSchema=bt.CompletionDetailedJobOutJobType$outboundSchema})(qxr||(bt.CompletionDetailedJobOutJobType$=qxr={}));bt.CompletionDetailedJobOutRepositories$inboundSchema=ZPe.GithubRepositoryOut$inboundSchema;bt.CompletionDetailedJobOutRepositories$outboundSchema=ZPe.GithubRepositoryOut$outboundSchema;var Bxr;(function(t){t.inboundSchema=bt.CompletionDetailedJobOutRepositories$inboundSchema,t.outboundSchema=bt.CompletionDetailedJobOutRepositories$outboundSchema})(Bxr||(bt.CompletionDetailedJobOutRepositories$=Bxr={}));function _So(t){return JSON.stringify(bt.CompletionDetailedJobOutRepositories$outboundSchema.parse(t))}function vSo(t){return(0,Dst.safeParse)(t,e=>bt.CompletionDetailedJobOutRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOutRepositories' from JSON")}bt.CompletionDetailedJobOut$inboundSchema=Pn.object({id:Pn.string(),auto_start:Pn.boolean(),model:Pn.string(),status:bt.CompletionDetailedJobOutStatus$inboundSchema,created_at:Pn.number().int(),modified_at:Pn.number().int(),training_files:Pn.array(Pn.string()),validation_files:Pn.nullable(Pn.array(Pn.string())).optional(),object:bt.CompletionDetailedJobOutObject$inboundSchema.default("job"),fine_tuned_model:Pn.nullable(Pn.string()).optional(),suffix:Pn.nullable(Pn.string()).optional(),integrations:Pn.nullable(Pn.array(XPe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:Pn.nullable(Pn.number().int()).optional(),metadata:Pn.nullable(Kxr.JobMetadataOut$inboundSchema).optional(),job_type:bt.CompletionDetailedJobOutJobType$inboundSchema.default("completion"),hyperparameters:Vxr.CompletionTrainingParameters$inboundSchema,repositories:Pn.array(ZPe.GithubRepositoryOut$inboundSchema).optional(),events:Pn.array(Jxr.EventOut$inboundSchema).optional(),checkpoints:Pn.array(Hxr.CheckpointOut$inboundSchema).optional()}).transform(t=>(0,zxr.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"}));bt.CompletionDetailedJobOut$outboundSchema=Pn.object({id:Pn.string(),autoStart:Pn.boolean(),model:Pn.string(),status:bt.CompletionDetailedJobOutStatus$outboundSchema,createdAt:Pn.number().int(),modifiedAt:Pn.number().int(),trainingFiles:Pn.array(Pn.string()),validationFiles:Pn.nullable(Pn.array(Pn.string())).optional(),object:bt.CompletionDetailedJobOutObject$outboundSchema.default("job"),fineTunedModel:Pn.nullable(Pn.string()).optional(),suffix:Pn.nullable(Pn.string()).optional(),integrations:Pn.nullable(Pn.array(XPe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:Pn.nullable(Pn.number().int()).optional(),metadata:Pn.nullable(Kxr.JobMetadataOut$outboundSchema).optional(),jobType:bt.CompletionDetailedJobOutJobType$outboundSchema.default("completion"),hyperparameters:Vxr.CompletionTrainingParameters$outboundSchema,repositories:Pn.array(ZPe.GithubRepositoryOut$outboundSchema).optional(),events:Pn.array(Jxr.EventOut$outboundSchema).optional(),checkpoints:Pn.array(Hxr.CheckpointOut$outboundSchema).optional()}).transform(t=>(0,zxr.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 Uxr;(function(t){t.inboundSchema=bt.CompletionDetailedJobOut$inboundSchema,t.outboundSchema=bt.CompletionDetailedJobOut$outboundSchema})(Uxr||(bt.CompletionDetailedJobOut$=Uxr={}));function wSo(t){return JSON.stringify(bt.CompletionDetailedJobOut$outboundSchema.parse(t))}function SSo(t){return(0,Dst.safeParse)(t,e=>bt.CompletionDetailedJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionDetailedJobOut' from JSON")}});var Xxr=S(vf=>{"use strict";var CSo=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]}),xSo=vf&&vf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OSo=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"&&CSo(r,e,n[o]);return xSo(r,e),r}}();Object.defineProperty(vf,"__esModule",{value:!0});vf.CompletionEvent$=vf.CompletionEvent$outboundSchema=vf.CompletionEvent$inboundSchema=void 0;vf.completionEventToJSON=ESo;vf.completionEventFromJSON=PSo;var Eae=OSo(te()),TSo=ee(),Zxr=jst();vf.CompletionEvent$inboundSchema=Eae.object({data:Eae.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:Eae.ZodIssueCode.custom,message:`malformed json: ${r}`}),Eae.NEVER}}).pipe(Zxr.CompletionChunk$inboundSchema)});vf.CompletionEvent$outboundSchema=Eae.object({data:Zxr.CompletionChunk$outboundSchema});var Gxr;(function(t){t.inboundSchema=vf.CompletionEvent$inboundSchema,t.outboundSchema=vf.CompletionEvent$outboundSchema})(Gxr||(vf.CompletionEvent$=Gxr={}));function ESo(t){return JSON.stringify(vf.CompletionEvent$outboundSchema.parse(t))}function PSo(t){return(0,TSo.safeParse)(t,e=>vf.CompletionEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionEvent' from JSON")}});var nOr=S(qn=>{"use strict";var MSo=qn&&qn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),RSo=qn&&qn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ASo=qn&&qn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&MSo(r,e,n[o]);return RSo(r,e),r}}();Object.defineProperty(qn,"__esModule",{value:!0});qn.CompletionFTModelOut$=qn.CompletionFTModelOut$outboundSchema=qn.CompletionFTModelOut$inboundSchema=qn.ModelType$=qn.ModelType$outboundSchema=qn.ModelType$inboundSchema=qn.CompletionFTModelOutObject$=qn.CompletionFTModelOutObject$outboundSchema=qn.CompletionFTModelOutObject$inboundSchema=qn.ModelType=qn.CompletionFTModelOutObject=void 0;qn.completionFTModelOutToJSON=NSo;qn.completionFTModelOutFromJSON=jSo;var ba=ASo(te()),tOr=ae(),ISo=ee(),rOr=VPe();qn.CompletionFTModelOutObject={Model:"model"};qn.ModelType={Completion:"completion"};qn.CompletionFTModelOutObject$inboundSchema=ba.nativeEnum(qn.CompletionFTModelOutObject);qn.CompletionFTModelOutObject$outboundSchema=qn.CompletionFTModelOutObject$inboundSchema;var Yxr;(function(t){t.inboundSchema=qn.CompletionFTModelOutObject$inboundSchema,t.outboundSchema=qn.CompletionFTModelOutObject$outboundSchema})(Yxr||(qn.CompletionFTModelOutObject$=Yxr={}));qn.ModelType$inboundSchema=ba.nativeEnum(qn.ModelType);qn.ModelType$outboundSchema=qn.ModelType$inboundSchema;var Qxr;(function(t){t.inboundSchema=qn.ModelType$inboundSchema,t.outboundSchema=qn.ModelType$outboundSchema})(Qxr||(qn.ModelType$=Qxr={}));qn.CompletionFTModelOut$inboundSchema=ba.object({id:ba.string(),object:qn.CompletionFTModelOutObject$inboundSchema.default("model"),created:ba.number().int(),owned_by:ba.string(),workspace_id:ba.string(),root:ba.string(),root_version:ba.string(),archived:ba.boolean(),name:ba.nullable(ba.string()).optional(),description:ba.nullable(ba.string()).optional(),capabilities:rOr.FTModelCapabilitiesOut$inboundSchema,max_context_length:ba.number().int().default(32768),aliases:ba.array(ba.string()).optional(),job:ba.string(),model_type:qn.ModelType$inboundSchema.default("completion")}).transform(t=>(0,tOr.remap)(t,{owned_by:"ownedBy",workspace_id:"workspaceId",root_version:"rootVersion",max_context_length:"maxContextLength",model_type:"modelType"}));qn.CompletionFTModelOut$outboundSchema=ba.object({id:ba.string(),object:qn.CompletionFTModelOutObject$outboundSchema.default("model"),created:ba.number().int(),ownedBy:ba.string(),workspaceId:ba.string(),root:ba.string(),rootVersion:ba.string(),archived:ba.boolean(),name:ba.nullable(ba.string()).optional(),description:ba.nullable(ba.string()).optional(),capabilities:rOr.FTModelCapabilitiesOut$outboundSchema,maxContextLength:ba.number().int().default(32768),aliases:ba.array(ba.string()).optional(),job:ba.string(),modelType:qn.ModelType$outboundSchema.default("completion")}).transform(t=>(0,tOr.remap)(t,{ownedBy:"owned_by",workspaceId:"workspace_id",rootVersion:"root_version",maxContextLength:"max_context_length",modelType:"model_type"}));var eOr;(function(t){t.inboundSchema=qn.CompletionFTModelOut$inboundSchema,t.outboundSchema=qn.CompletionFTModelOut$outboundSchema})(eOr||(qn.CompletionFTModelOut$=eOr={}));function NSo(t){return JSON.stringify(qn.CompletionFTModelOut$outboundSchema.parse(t))}function jSo(t){return(0,ISo.safeParse)(t,e=>qn.CompletionFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionFTModelOut' from JSON")}});var Lst=S(_t=>{"use strict";var DSo=_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]}),$So=_t&&_t.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LSo=_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"&&DSo(r,e,n[o]);return $So(r,e),r}}();Object.defineProperty(_t,"__esModule",{value:!0});_t.CompletionJobOut$=_t.CompletionJobOut$outboundSchema=_t.CompletionJobOut$inboundSchema=_t.Repositories$=_t.Repositories$outboundSchema=_t.Repositories$inboundSchema=_t.JobType$=_t.JobType$outboundSchema=_t.JobType$inboundSchema=_t.Integrations$=_t.Integrations$outboundSchema=_t.Integrations$inboundSchema=_t.CompletionJobOutObject$=_t.CompletionJobOutObject$outboundSchema=_t.CompletionJobOutObject$inboundSchema=_t.Status$=_t.Status$outboundSchema=_t.Status$inboundSchema=_t.JobType=_t.CompletionJobOutObject=_t.Status=void 0;_t.integrationsToJSON=FSo;_t.integrationsFromJSON=kSo;_t.repositoriesToJSON=qSo;_t.repositoriesFromJSON=BSo;_t.completionJobOutToJSON=USo;_t.completionJobOutFromJSON=zSo;var xo=LSo(te()),cOr=ae(),$st=ee(),dOr=WPe(),YPe=GPe(),fOr=c9(),QPe=d9();_t.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};_t.CompletionJobOutObject={Job:"job"};_t.JobType={Completion:"completion"};_t.Status$inboundSchema=xo.nativeEnum(_t.Status);_t.Status$outboundSchema=_t.Status$inboundSchema;var oOr;(function(t){t.inboundSchema=_t.Status$inboundSchema,t.outboundSchema=_t.Status$outboundSchema})(oOr||(_t.Status$=oOr={}));_t.CompletionJobOutObject$inboundSchema=xo.nativeEnum(_t.CompletionJobOutObject);_t.CompletionJobOutObject$outboundSchema=_t.CompletionJobOutObject$inboundSchema;var iOr;(function(t){t.inboundSchema=_t.CompletionJobOutObject$inboundSchema,t.outboundSchema=_t.CompletionJobOutObject$outboundSchema})(iOr||(_t.CompletionJobOutObject$=iOr={}));_t.Integrations$inboundSchema=QPe.WandbIntegrationOut$inboundSchema;_t.Integrations$outboundSchema=QPe.WandbIntegrationOut$outboundSchema;var aOr;(function(t){t.inboundSchema=_t.Integrations$inboundSchema,t.outboundSchema=_t.Integrations$outboundSchema})(aOr||(_t.Integrations$=aOr={}));function FSo(t){return JSON.stringify(_t.Integrations$outboundSchema.parse(t))}function kSo(t){return(0,$st.safeParse)(t,e=>_t.Integrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Integrations' from JSON")}_t.JobType$inboundSchema=xo.nativeEnum(_t.JobType);_t.JobType$outboundSchema=_t.JobType$inboundSchema;var sOr;(function(t){t.inboundSchema=_t.JobType$inboundSchema,t.outboundSchema=_t.JobType$outboundSchema})(sOr||(_t.JobType$=sOr={}));_t.Repositories$inboundSchema=YPe.GithubRepositoryOut$inboundSchema;_t.Repositories$outboundSchema=YPe.GithubRepositoryOut$outboundSchema;var uOr;(function(t){t.inboundSchema=_t.Repositories$inboundSchema,t.outboundSchema=_t.Repositories$outboundSchema})(uOr||(_t.Repositories$=uOr={}));function qSo(t){return JSON.stringify(_t.Repositories$outboundSchema.parse(t))}function BSo(t){return(0,$st.safeParse)(t,e=>_t.Repositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Repositories' from JSON")}_t.CompletionJobOut$inboundSchema=xo.object({id:xo.string(),auto_start:xo.boolean(),model:xo.string(),status:_t.Status$inboundSchema,created_at:xo.number().int(),modified_at:xo.number().int(),training_files:xo.array(xo.string()),validation_files:xo.nullable(xo.array(xo.string())).optional(),object:_t.CompletionJobOutObject$inboundSchema.default("job"),fine_tuned_model:xo.nullable(xo.string()).optional(),suffix:xo.nullable(xo.string()).optional(),integrations:xo.nullable(xo.array(QPe.WandbIntegrationOut$inboundSchema)).optional(),trained_tokens:xo.nullable(xo.number().int()).optional(),metadata:xo.nullable(fOr.JobMetadataOut$inboundSchema).optional(),job_type:_t.JobType$inboundSchema.default("completion"),hyperparameters:dOr.CompletionTrainingParameters$inboundSchema,repositories:xo.array(YPe.GithubRepositoryOut$inboundSchema).optional()}).transform(t=>(0,cOr.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"}));_t.CompletionJobOut$outboundSchema=xo.object({id:xo.string(),autoStart:xo.boolean(),model:xo.string(),status:_t.Status$outboundSchema,createdAt:xo.number().int(),modifiedAt:xo.number().int(),trainingFiles:xo.array(xo.string()),validationFiles:xo.nullable(xo.array(xo.string())).optional(),object:_t.CompletionJobOutObject$outboundSchema.default("job"),fineTunedModel:xo.nullable(xo.string()).optional(),suffix:xo.nullable(xo.string()).optional(),integrations:xo.nullable(xo.array(QPe.WandbIntegrationOut$outboundSchema)).optional(),trainedTokens:xo.nullable(xo.number().int()).optional(),metadata:xo.nullable(fOr.JobMetadataOut$outboundSchema).optional(),jobType:_t.JobType$outboundSchema.default("completion"),hyperparameters:dOr.CompletionTrainingParameters$outboundSchema,repositories:xo.array(YPe.GithubRepositoryOut$outboundSchema).optional()}).transform(t=>(0,cOr.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 lOr;(function(t){t.inboundSchema=_t.CompletionJobOut$inboundSchema,t.outboundSchema=_t.CompletionJobOut$outboundSchema})(lOr||(_t.CompletionJobOut$=lOr={}));function USo(t){return JSON.stringify(_t.CompletionJobOut$outboundSchema.parse(t))}function zSo(t){return(0,$st.safeParse)(t,e=>_t.CompletionJobOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionJobOut' from JSON")}});var Fst=S(wf=>{"use strict";var HSo=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]}),VSo=wf&&wf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JSo=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"&&HSo(r,e,n[o]);return VSo(r,e),r}}();Object.defineProperty(wf,"__esModule",{value:!0});wf.CompletionTrainingParametersIn$=wf.CompletionTrainingParametersIn$outboundSchema=wf.CompletionTrainingParametersIn$inboundSchema=void 0;wf.completionTrainingParametersInToJSON=WSo;wf.completionTrainingParametersInFromJSON=GSo;var pu=JSo(te()),mOr=ae(),KSo=ee();wf.CompletionTrainingParametersIn$inboundSchema=pu.object({training_steps:pu.nullable(pu.number().int()).optional(),learning_rate:pu.number().default(1e-4),weight_decay:pu.nullable(pu.number()).optional(),warmup_fraction:pu.nullable(pu.number()).optional(),epochs:pu.nullable(pu.number()).optional(),seq_len:pu.nullable(pu.number().int()).optional(),fim_ratio:pu.nullable(pu.number()).optional()}).transform(t=>(0,mOr.remap)(t,{training_steps:"trainingSteps",learning_rate:"learningRate",weight_decay:"weightDecay",warmup_fraction:"warmupFraction",seq_len:"seqLen",fim_ratio:"fimRatio"}));wf.CompletionTrainingParametersIn$outboundSchema=pu.object({trainingSteps:pu.nullable(pu.number().int()).optional(),learningRate:pu.number().default(1e-4),weightDecay:pu.nullable(pu.number()).optional(),warmupFraction:pu.nullable(pu.number()).optional(),epochs:pu.nullable(pu.number()).optional(),seqLen:pu.nullable(pu.number().int()).optional(),fimRatio:pu.nullable(pu.number()).optional()}).transform(t=>(0,mOr.remap)(t,{trainingSteps:"training_steps",learningRate:"learning_rate",weightDecay:"weight_decay",warmupFraction:"warmup_fraction",seqLen:"seq_len",fimRatio:"fim_ratio"}));var pOr;(function(t){t.inboundSchema=wf.CompletionTrainingParametersIn$inboundSchema,t.outboundSchema=wf.CompletionTrainingParametersIn$outboundSchema})(pOr||(wf.CompletionTrainingParametersIn$=pOr={}));function WSo(t){return JSON.stringify(wf.CompletionTrainingParametersIn$outboundSchema.parse(t))}function GSo(t){return(0,KSo.safeParse)(t,e=>wf.CompletionTrainingParametersIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'CompletionTrainingParametersIn' from JSON")}});var kst=S(Sf=>{"use strict";var ZSo=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]}),XSo=Sf&&Sf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YSo=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"&&ZSo(r,e,n[o]);return XSo(r,e),r}}();Object.defineProperty(Sf,"__esModule",{value:!0});Sf.FunctionCallEntryArguments$=Sf.FunctionCallEntryArguments$outboundSchema=Sf.FunctionCallEntryArguments$inboundSchema=void 0;Sf.functionCallEntryArgumentsToJSON=e0o;Sf.functionCallEntryArgumentsFromJSON=t0o;var mq=YSo(te()),QSo=ee();Sf.FunctionCallEntryArguments$inboundSchema=mq.union([mq.record(mq.any()),mq.string()]);Sf.FunctionCallEntryArguments$outboundSchema=mq.union([mq.record(mq.any()),mq.string()]);var hOr;(function(t){t.inboundSchema=Sf.FunctionCallEntryArguments$inboundSchema,t.outboundSchema=Sf.FunctionCallEntryArguments$outboundSchema})(hOr||(Sf.FunctionCallEntryArguments$=hOr={}));function e0o(t){return JSON.stringify(Sf.FunctionCallEntryArguments$outboundSchema.parse(t))}function t0o(t){return(0,QSo.safeParse)(t,e=>Sf.FunctionCallEntryArguments$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEntryArguments' from JSON")}});var Pae=S(Bn=>{"use strict";var r0o=Bn&&Bn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n0o=Bn&&Bn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o0o=Bn&&Bn.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&r0o(r,e,n[o]);return n0o(r,e),r}}();Object.defineProperty(Bn,"__esModule",{value:!0});Bn.FunctionCallEntry$=Bn.FunctionCallEntry$outboundSchema=Bn.FunctionCallEntry$inboundSchema=Bn.FunctionCallEntryType$=Bn.FunctionCallEntryType$outboundSchema=Bn.FunctionCallEntryType$inboundSchema=Bn.FunctionCallEntryObject$=Bn.FunctionCallEntryObject$outboundSchema=Bn.FunctionCallEntryObject$inboundSchema=Bn.FunctionCallEntryType=Bn.FunctionCallEntryObject=void 0;Bn.functionCallEntryToJSON=a0o;Bn.functionCallEntryFromJSON=s0o;var Ty=o0o(te()),_Or=ae(),i0o=ee(),vOr=kst();Bn.FunctionCallEntryObject={Entry:"entry"};Bn.FunctionCallEntryType={FunctionCall:"function.call"};Bn.FunctionCallEntryObject$inboundSchema=Ty.nativeEnum(Bn.FunctionCallEntryObject);Bn.FunctionCallEntryObject$outboundSchema=Bn.FunctionCallEntryObject$inboundSchema;var gOr;(function(t){t.inboundSchema=Bn.FunctionCallEntryObject$inboundSchema,t.outboundSchema=Bn.FunctionCallEntryObject$outboundSchema})(gOr||(Bn.FunctionCallEntryObject$=gOr={}));Bn.FunctionCallEntryType$inboundSchema=Ty.nativeEnum(Bn.FunctionCallEntryType);Bn.FunctionCallEntryType$outboundSchema=Bn.FunctionCallEntryType$inboundSchema;var yOr;(function(t){t.inboundSchema=Bn.FunctionCallEntryType$inboundSchema,t.outboundSchema=Bn.FunctionCallEntryType$outboundSchema})(yOr||(Bn.FunctionCallEntryType$=yOr={}));Bn.FunctionCallEntry$inboundSchema=Ty.object({object:Bn.FunctionCallEntryObject$inboundSchema.default("entry"),type:Bn.FunctionCallEntryType$inboundSchema.default("function.call"),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(),name:Ty.string(),arguments:vOr.FunctionCallEntryArguments$inboundSchema}).transform(t=>(0,_Or.remap)(t,{created_at:"createdAt",completed_at:"completedAt",tool_call_id:"toolCallId"}));Bn.FunctionCallEntry$outboundSchema=Ty.object({object:Bn.FunctionCallEntryObject$outboundSchema.default("entry"),type:Bn.FunctionCallEntryType$outboundSchema.default("function.call"),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(),name:Ty.string(),arguments:vOr.FunctionCallEntryArguments$outboundSchema}).transform(t=>(0,_Or.remap)(t,{createdAt:"created_at",completedAt:"completed_at",toolCallId:"tool_call_id"}));var bOr;(function(t){t.inboundSchema=Bn.FunctionCallEntry$inboundSchema,t.outboundSchema=Bn.FunctionCallEntry$outboundSchema})(bOr||(Bn.FunctionCallEntry$=bOr={}));function a0o(t){return JSON.stringify(Bn.FunctionCallEntry$outboundSchema.parse(t))}function s0o(t){return(0,i0o.safeParse)(t,e=>Bn.FunctionCallEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEntry' from JSON")}});var eMe=S(Un=>{"use strict";var u0o=Un&&Un.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),l0o=Un&&Un.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),c0o=Un&&Un.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(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 l0o(r,e),r}}();Object.defineProperty(Un,"__esModule",{value:!0});Un.FunctionResultEntry$=Un.FunctionResultEntry$outboundSchema=Un.FunctionResultEntry$inboundSchema=Un.FunctionResultEntryType$=Un.FunctionResultEntryType$outboundSchema=Un.FunctionResultEntryType$inboundSchema=Un.FunctionResultEntryObject$=Un.FunctionResultEntryObject$outboundSchema=Un.FunctionResultEntryObject$inboundSchema=Un.FunctionResultEntryType=Un.FunctionResultEntryObject=void 0;Un.functionResultEntryToJSON=f0o;Un.functionResultEntryFromJSON=p0o;var Ey=c0o(te()),xOr=ae(),d0o=ee();Un.FunctionResultEntryObject={Entry:"entry"};Un.FunctionResultEntryType={FunctionResult:"function.result"};Un.FunctionResultEntryObject$inboundSchema=Ey.nativeEnum(Un.FunctionResultEntryObject);Un.FunctionResultEntryObject$outboundSchema=Un.FunctionResultEntryObject$inboundSchema;var wOr;(function(t){t.inboundSchema=Un.FunctionResultEntryObject$inboundSchema,t.outboundSchema=Un.FunctionResultEntryObject$outboundSchema})(wOr||(Un.FunctionResultEntryObject$=wOr={}));Un.FunctionResultEntryType$inboundSchema=Ey.nativeEnum(Un.FunctionResultEntryType);Un.FunctionResultEntryType$outboundSchema=Un.FunctionResultEntryType$inboundSchema;var SOr;(function(t){t.inboundSchema=Un.FunctionResultEntryType$inboundSchema,t.outboundSchema=Un.FunctionResultEntryType$outboundSchema})(SOr||(Un.FunctionResultEntryType$=SOr={}));Un.FunctionResultEntry$inboundSchema=Ey.object({object:Un.FunctionResultEntryObject$inboundSchema.default("entry"),type:Un.FunctionResultEntryType$inboundSchema.default("function.result"),created_at:Ey.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Ey.nullable(Ey.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Ey.string().optional(),tool_call_id:Ey.string(),result:Ey.string()}).transform(t=>(0,xOr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",tool_call_id:"toolCallId"}));Un.FunctionResultEntry$outboundSchema=Ey.object({object:Un.FunctionResultEntryObject$outboundSchema.default("entry"),type:Un.FunctionResultEntryType$outboundSchema.default("function.result"),createdAt:Ey.date().transform(t=>t.toISOString()).optional(),completedAt:Ey.nullable(Ey.date().transform(t=>t.toISOString())).optional(),id:Ey.string().optional(),toolCallId:Ey.string(),result:Ey.string()}).transform(t=>(0,xOr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",toolCallId:"tool_call_id"}));var COr;(function(t){t.inboundSchema=Un.FunctionResultEntry$inboundSchema,t.outboundSchema=Un.FunctionResultEntry$outboundSchema})(COr||(Un.FunctionResultEntry$=COr={}));function f0o(t){return JSON.stringify(Un.FunctionResultEntry$outboundSchema.parse(t))}function p0o(t){return(0,d0o.safeParse)(t,e=>Un.FunctionResultEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionResultEntry' from JSON")}});var Mae=S(_a=>{"use strict";var m0o=_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]}),h0o=_a&&_a.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),g0o=_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"&&m0o(r,e,n[o]);return h0o(r,e),r}}();Object.defineProperty(_a,"__esModule",{value:!0});_a.ToolFileChunk$=_a.ToolFileChunk$outboundSchema=_a.ToolFileChunk$inboundSchema=_a.ToolFileChunkType$=_a.ToolFileChunkType$outboundSchema=_a.ToolFileChunkType$inboundSchema=_a.ToolFileChunkType=void 0;_a.toolFileChunkToJSON=b0o;_a.toolFileChunkFromJSON=_0o;var sw=g0o(te()),EOr=ae(),y0o=ee(),POr=fq();_a.ToolFileChunkType={ToolFile:"tool_file"};_a.ToolFileChunkType$inboundSchema=sw.nativeEnum(_a.ToolFileChunkType);_a.ToolFileChunkType$outboundSchema=_a.ToolFileChunkType$inboundSchema;var OOr;(function(t){t.inboundSchema=_a.ToolFileChunkType$inboundSchema,t.outboundSchema=_a.ToolFileChunkType$outboundSchema})(OOr||(_a.ToolFileChunkType$=OOr={}));_a.ToolFileChunk$inboundSchema=sw.object({type:_a.ToolFileChunkType$inboundSchema.default("tool_file"),tool:POr.BuiltInConnectors$inboundSchema,file_id:sw.string(),file_name:sw.nullable(sw.string()).optional(),file_type:sw.nullable(sw.string()).optional()}).transform(t=>(0,EOr.remap)(t,{file_id:"fileId",file_name:"fileName",file_type:"fileType"}));_a.ToolFileChunk$outboundSchema=sw.object({type:_a.ToolFileChunkType$outboundSchema.default("tool_file"),tool:POr.BuiltInConnectors$outboundSchema,fileId:sw.string(),fileName:sw.nullable(sw.string()).optional(),fileType:sw.nullable(sw.string()).optional()}).transform(t=>(0,EOr.remap)(t,{fileId:"file_id",fileName:"file_name",fileType:"file_type"}));var TOr;(function(t){t.inboundSchema=_a.ToolFileChunk$inboundSchema,t.outboundSchema=_a.ToolFileChunk$outboundSchema})(TOr||(_a.ToolFileChunk$=TOr={}));function b0o(t){return JSON.stringify(_a.ToolFileChunk$outboundSchema.parse(t))}function _0o(t){return(0,y0o.safeParse)(t,e=>_a.ToolFileChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolFileChunk' from JSON")}});var qst=S(Cf=>{"use strict";var v0o=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]}),w0o=Cf&&Cf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),S0o=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"&&v0o(r,e,n[o]);return w0o(r,e),r}}();Object.defineProperty(Cf,"__esModule",{value:!0});Cf.MessageInputContentChunks$=Cf.MessageInputContentChunks$outboundSchema=Cf.MessageInputContentChunks$inboundSchema=void 0;Cf.messageInputContentChunksToJSON=x0o;Cf.messageInputContentChunksFromJSON=O0o;var ROr=S0o(te()),C0o=ee(),AOr=fV(),IOr=pV(),NOr=dq(),jOr=hV(),DOr=Mae();Cf.MessageInputContentChunks$inboundSchema=ROr.union([DOr.ToolFileChunk$inboundSchema,NOr.TextChunk$inboundSchema,IOr.ImageURLChunk$inboundSchema,AOr.DocumentURLChunk$inboundSchema,jOr.ThinkChunk$inboundSchema]);Cf.MessageInputContentChunks$outboundSchema=ROr.union([DOr.ToolFileChunk$outboundSchema,NOr.TextChunk$outboundSchema,IOr.ImageURLChunk$outboundSchema,AOr.DocumentURLChunk$outboundSchema,jOr.ThinkChunk$outboundSchema]);var MOr;(function(t){t.inboundSchema=Cf.MessageInputContentChunks$inboundSchema,t.outboundSchema=Cf.MessageInputContentChunks$outboundSchema})(MOr||(Cf.MessageInputContentChunks$=MOr={}));function x0o(t){return JSON.stringify(Cf.MessageInputContentChunks$outboundSchema.parse(t))}function O0o(t){return(0,C0o.safeParse)(t,e=>Cf.MessageInputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputContentChunks' from JSON")}});var Rae=S(Gt=>{"use strict";var T0o=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]}),E0o=Gt&&Gt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P0o=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"&&T0o(r,e,n[o]);return E0o(r,e),r}}();Object.defineProperty(Gt,"__esModule",{value:!0});Gt.MessageInputEntry$=Gt.MessageInputEntry$outboundSchema=Gt.MessageInputEntry$inboundSchema=Gt.MessageInputEntryContent$=Gt.MessageInputEntryContent$outboundSchema=Gt.MessageInputEntryContent$inboundSchema=Gt.MessageInputEntryRole$=Gt.MessageInputEntryRole$outboundSchema=Gt.MessageInputEntryRole$inboundSchema=Gt.MessageInputEntryType$=Gt.MessageInputEntryType$outboundSchema=Gt.MessageInputEntryType$inboundSchema=Gt.ObjectT$=Gt.ObjectT$outboundSchema=Gt.ObjectT$inboundSchema=Gt.MessageInputEntryRole=Gt.MessageInputEntryType=Gt.ObjectT=void 0;Gt.messageInputEntryContentToJSON=M0o;Gt.messageInputEntryContentFromJSON=R0o;Gt.messageInputEntryToJSON=A0o;Gt.messageInputEntryFromJSON=I0o;var Nu=P0o(te()),BOr=ae(),UOr=ee(),tMe=qst();Gt.ObjectT={Entry:"entry"};Gt.MessageInputEntryType={MessageInput:"message.input"};Gt.MessageInputEntryRole={Assistant:"assistant",User:"user"};Gt.ObjectT$inboundSchema=Nu.nativeEnum(Gt.ObjectT);Gt.ObjectT$outboundSchema=Gt.ObjectT$inboundSchema;var $Or;(function(t){t.inboundSchema=Gt.ObjectT$inboundSchema,t.outboundSchema=Gt.ObjectT$outboundSchema})($Or||(Gt.ObjectT$=$Or={}));Gt.MessageInputEntryType$inboundSchema=Nu.nativeEnum(Gt.MessageInputEntryType);Gt.MessageInputEntryType$outboundSchema=Gt.MessageInputEntryType$inboundSchema;var LOr;(function(t){t.inboundSchema=Gt.MessageInputEntryType$inboundSchema,t.outboundSchema=Gt.MessageInputEntryType$outboundSchema})(LOr||(Gt.MessageInputEntryType$=LOr={}));Gt.MessageInputEntryRole$inboundSchema=Nu.nativeEnum(Gt.MessageInputEntryRole);Gt.MessageInputEntryRole$outboundSchema=Gt.MessageInputEntryRole$inboundSchema;var FOr;(function(t){t.inboundSchema=Gt.MessageInputEntryRole$inboundSchema,t.outboundSchema=Gt.MessageInputEntryRole$outboundSchema})(FOr||(Gt.MessageInputEntryRole$=FOr={}));Gt.MessageInputEntryContent$inboundSchema=Nu.union([Nu.string(),Nu.array(tMe.MessageInputContentChunks$inboundSchema)]);Gt.MessageInputEntryContent$outboundSchema=Nu.union([Nu.string(),Nu.array(tMe.MessageInputContentChunks$outboundSchema)]);var kOr;(function(t){t.inboundSchema=Gt.MessageInputEntryContent$inboundSchema,t.outboundSchema=Gt.MessageInputEntryContent$outboundSchema})(kOr||(Gt.MessageInputEntryContent$=kOr={}));function M0o(t){return JSON.stringify(Gt.MessageInputEntryContent$outboundSchema.parse(t))}function R0o(t){return(0,UOr.safeParse)(t,e=>Gt.MessageInputEntryContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputEntryContent' from JSON")}Gt.MessageInputEntry$inboundSchema=Nu.object({object:Gt.ObjectT$inboundSchema.default("entry"),type:Gt.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:Gt.MessageInputEntryRole$inboundSchema,content:Nu.union([Nu.string(),Nu.array(tMe.MessageInputContentChunks$inboundSchema)]),prefix:Nu.boolean().default(!1)}).transform(t=>(0,BOr.remap)(t,{created_at:"createdAt",completed_at:"completedAt"}));Gt.MessageInputEntry$outboundSchema=Nu.object({object:Gt.ObjectT$outboundSchema.default("entry"),type:Gt.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:Gt.MessageInputEntryRole$outboundSchema,content:Nu.union([Nu.string(),Nu.array(tMe.MessageInputContentChunks$outboundSchema)]),prefix:Nu.boolean().default(!1)}).transform(t=>(0,BOr.remap)(t,{createdAt:"created_at",completedAt:"completed_at"}));var qOr;(function(t){t.inboundSchema=Gt.MessageInputEntry$inboundSchema,t.outboundSchema=Gt.MessageInputEntry$outboundSchema})(qOr||(Gt.MessageInputEntry$=qOr={}));function A0o(t){return JSON.stringify(Gt.MessageInputEntry$outboundSchema.parse(t))}function I0o(t){return(0,UOr.safeParse)(t,e=>Gt.MessageInputEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageInputEntry' from JSON")}});var rMe=S(va=>{"use strict";var N0o=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]}),j0o=va&&va.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D0o=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"&&N0o(r,e,n[o]);return j0o(r,e),r}}();Object.defineProperty(va,"__esModule",{value:!0});va.ToolReferenceChunk$=va.ToolReferenceChunk$outboundSchema=va.ToolReferenceChunk$inboundSchema=va.ToolReferenceChunkType$=va.ToolReferenceChunkType$outboundSchema=va.ToolReferenceChunkType$inboundSchema=va.ToolReferenceChunkType=void 0;va.toolReferenceChunkToJSON=L0o;va.toolReferenceChunkFromJSON=F0o;var Eg=D0o(te()),$0o=ee(),VOr=fq();va.ToolReferenceChunkType={ToolReference:"tool_reference"};va.ToolReferenceChunkType$inboundSchema=Eg.nativeEnum(va.ToolReferenceChunkType);va.ToolReferenceChunkType$outboundSchema=va.ToolReferenceChunkType$inboundSchema;var zOr;(function(t){t.inboundSchema=va.ToolReferenceChunkType$inboundSchema,t.outboundSchema=va.ToolReferenceChunkType$outboundSchema})(zOr||(va.ToolReferenceChunkType$=zOr={}));va.ToolReferenceChunk$inboundSchema=Eg.object({type:va.ToolReferenceChunkType$inboundSchema.default("tool_reference"),tool:VOr.BuiltInConnectors$inboundSchema,title:Eg.string(),url:Eg.nullable(Eg.string()).optional(),favicon:Eg.nullable(Eg.string()).optional(),description:Eg.nullable(Eg.string()).optional()});va.ToolReferenceChunk$outboundSchema=Eg.object({type:va.ToolReferenceChunkType$outboundSchema.default("tool_reference"),tool:VOr.BuiltInConnectors$outboundSchema,title:Eg.string(),url:Eg.nullable(Eg.string()).optional(),favicon:Eg.nullable(Eg.string()).optional(),description:Eg.nullable(Eg.string()).optional()});var HOr;(function(t){t.inboundSchema=va.ToolReferenceChunk$inboundSchema,t.outboundSchema=va.ToolReferenceChunk$outboundSchema})(HOr||(va.ToolReferenceChunk$=HOr={}));function L0o(t){return JSON.stringify(va.ToolReferenceChunk$outboundSchema.parse(t))}function F0o(t){return(0,$0o.safeParse)(t,e=>va.ToolReferenceChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolReferenceChunk' from JSON")}});var Bst=S(xf=>{"use strict";var k0o=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]}),q0o=xf&&xf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B0o=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"&&k0o(r,e,n[o]);return q0o(r,e),r}}();Object.defineProperty(xf,"__esModule",{value:!0});xf.MessageOutputContentChunks$=xf.MessageOutputContentChunks$outboundSchema=xf.MessageOutputContentChunks$inboundSchema=void 0;xf.messageOutputContentChunksToJSON=z0o;xf.messageOutputContentChunksFromJSON=H0o;var KOr=B0o(te()),U0o=ee(),WOr=fV(),GOr=pV(),ZOr=dq(),XOr=hV(),YOr=Mae(),QOr=rMe();xf.MessageOutputContentChunks$inboundSchema=KOr.union([YOr.ToolFileChunk$inboundSchema,QOr.ToolReferenceChunk$inboundSchema,ZOr.TextChunk$inboundSchema,GOr.ImageURLChunk$inboundSchema,WOr.DocumentURLChunk$inboundSchema,XOr.ThinkChunk$inboundSchema]);xf.MessageOutputContentChunks$outboundSchema=KOr.union([YOr.ToolFileChunk$outboundSchema,QOr.ToolReferenceChunk$outboundSchema,ZOr.TextChunk$outboundSchema,GOr.ImageURLChunk$outboundSchema,WOr.DocumentURLChunk$outboundSchema,XOr.ThinkChunk$outboundSchema]);var JOr;(function(t){t.inboundSchema=xf.MessageOutputContentChunks$inboundSchema,t.outboundSchema=xf.MessageOutputContentChunks$outboundSchema})(JOr||(xf.MessageOutputContentChunks$=JOr={}));function z0o(t){return JSON.stringify(xf.MessageOutputContentChunks$outboundSchema.parse(t))}function H0o(t){return(0,U0o.safeParse)(t,e=>xf.MessageOutputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputContentChunks' from JSON")}});var f9=S(Zt=>{"use strict";var V0o=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]}),J0o=Zt&&Zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K0o=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"&&V0o(r,e,n[o]);return J0o(r,e),r}}();Object.defineProperty(Zt,"__esModule",{value:!0});Zt.MessageOutputEntry$=Zt.MessageOutputEntry$outboundSchema=Zt.MessageOutputEntry$inboundSchema=Zt.MessageOutputEntryContent$=Zt.MessageOutputEntryContent$outboundSchema=Zt.MessageOutputEntryContent$inboundSchema=Zt.MessageOutputEntryRole$=Zt.MessageOutputEntryRole$outboundSchema=Zt.MessageOutputEntryRole$inboundSchema=Zt.MessageOutputEntryType$=Zt.MessageOutputEntryType$outboundSchema=Zt.MessageOutputEntryType$inboundSchema=Zt.MessageOutputEntryObject$=Zt.MessageOutputEntryObject$outboundSchema=Zt.MessageOutputEntryObject$inboundSchema=Zt.MessageOutputEntryRole=Zt.MessageOutputEntryType=Zt.MessageOutputEntryObject=void 0;Zt.messageOutputEntryContentToJSON=W0o;Zt.messageOutputEntryContentFromJSON=G0o;Zt.messageOutputEntryToJSON=Z0o;Zt.messageOutputEntryFromJSON=X0o;var Qa=K0o(te()),iTr=ae(),aTr=ee(),nMe=Bst();Zt.MessageOutputEntryObject={Entry:"entry"};Zt.MessageOutputEntryType={MessageOutput:"message.output"};Zt.MessageOutputEntryRole={Assistant:"assistant"};Zt.MessageOutputEntryObject$inboundSchema=Qa.nativeEnum(Zt.MessageOutputEntryObject);Zt.MessageOutputEntryObject$outboundSchema=Zt.MessageOutputEntryObject$inboundSchema;var eTr;(function(t){t.inboundSchema=Zt.MessageOutputEntryObject$inboundSchema,t.outboundSchema=Zt.MessageOutputEntryObject$outboundSchema})(eTr||(Zt.MessageOutputEntryObject$=eTr={}));Zt.MessageOutputEntryType$inboundSchema=Qa.nativeEnum(Zt.MessageOutputEntryType);Zt.MessageOutputEntryType$outboundSchema=Zt.MessageOutputEntryType$inboundSchema;var tTr;(function(t){t.inboundSchema=Zt.MessageOutputEntryType$inboundSchema,t.outboundSchema=Zt.MessageOutputEntryType$outboundSchema})(tTr||(Zt.MessageOutputEntryType$=tTr={}));Zt.MessageOutputEntryRole$inboundSchema=Qa.nativeEnum(Zt.MessageOutputEntryRole);Zt.MessageOutputEntryRole$outboundSchema=Zt.MessageOutputEntryRole$inboundSchema;var rTr;(function(t){t.inboundSchema=Zt.MessageOutputEntryRole$inboundSchema,t.outboundSchema=Zt.MessageOutputEntryRole$outboundSchema})(rTr||(Zt.MessageOutputEntryRole$=rTr={}));Zt.MessageOutputEntryContent$inboundSchema=Qa.union([Qa.string(),Qa.array(nMe.MessageOutputContentChunks$inboundSchema)]);Zt.MessageOutputEntryContent$outboundSchema=Qa.union([Qa.string(),Qa.array(nMe.MessageOutputContentChunks$outboundSchema)]);var nTr;(function(t){t.inboundSchema=Zt.MessageOutputEntryContent$inboundSchema,t.outboundSchema=Zt.MessageOutputEntryContent$outboundSchema})(nTr||(Zt.MessageOutputEntryContent$=nTr={}));function W0o(t){return JSON.stringify(Zt.MessageOutputEntryContent$outboundSchema.parse(t))}function G0o(t){return(0,aTr.safeParse)(t,e=>Zt.MessageOutputEntryContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEntryContent' from JSON")}Zt.MessageOutputEntry$inboundSchema=Qa.object({object:Zt.MessageOutputEntryObject$inboundSchema.default("entry"),type:Zt.MessageOutputEntryType$inboundSchema.default("message.output"),created_at:Qa.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),completed_at:Qa.nullable(Qa.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),id:Qa.string().optional(),agent_id:Qa.nullable(Qa.string()).optional(),model:Qa.nullable(Qa.string()).optional(),role:Zt.MessageOutputEntryRole$inboundSchema.default("assistant"),content:Qa.union([Qa.string(),Qa.array(nMe.MessageOutputContentChunks$inboundSchema)])}).transform(t=>(0,iTr.remap)(t,{created_at:"createdAt",completed_at:"completedAt",agent_id:"agentId"}));Zt.MessageOutputEntry$outboundSchema=Qa.object({object:Zt.MessageOutputEntryObject$outboundSchema.default("entry"),type:Zt.MessageOutputEntryType$outboundSchema.default("message.output"),createdAt:Qa.date().transform(t=>t.toISOString()).optional(),completedAt:Qa.nullable(Qa.date().transform(t=>t.toISOString())).optional(),id:Qa.string().optional(),agentId:Qa.nullable(Qa.string()).optional(),model:Qa.nullable(Qa.string()).optional(),role:Zt.MessageOutputEntryRole$outboundSchema.default("assistant"),content:Qa.union([Qa.string(),Qa.array(nMe.MessageOutputContentChunks$outboundSchema)])}).transform(t=>(0,iTr.remap)(t,{createdAt:"created_at",completedAt:"completed_at",agentId:"agent_id"}));var oTr;(function(t){t.inboundSchema=Zt.MessageOutputEntry$inboundSchema,t.outboundSchema=Zt.MessageOutputEntry$outboundSchema})(oTr||(Zt.MessageOutputEntry$=oTr={}));function Z0o(t){return JSON.stringify(Zt.MessageOutputEntry$outboundSchema.parse(t))}function X0o(t){return(0,aTr.safeParse)(t,e=>Zt.MessageOutputEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEntry' from JSON")}});var Aae=S(zn=>{"use strict";var Y0o=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]}),Q0o=zn&&zn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eCo=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"&&Y0o(r,e,n[o]);return Q0o(r,e),r}}();Object.defineProperty(zn,"__esModule",{value:!0});zn.ToolExecutionEntry$=zn.ToolExecutionEntry$outboundSchema=zn.ToolExecutionEntry$inboundSchema=zn.ToolExecutionEntryType$=zn.ToolExecutionEntryType$outboundSchema=zn.ToolExecutionEntryType$inboundSchema=zn.ToolExecutionEntryObject$=zn.ToolExecutionEntryObject$outboundSchema=zn.ToolExecutionEntryObject$inboundSchema=zn.ToolExecutionEntryType=zn.ToolExecutionEntryObject=void 0;zn.toolExecutionEntryToJSON=rCo;zn.toolExecutionEntryFromJSON=nCo;var Ch=eCo(te()),cTr=ae(),tCo=ee(),dTr=fq();zn.ToolExecutionEntryObject={Entry:"entry"};zn.ToolExecutionEntryType={ToolExecution:"tool.execution"};zn.ToolExecutionEntryObject$inboundSchema=Ch.nativeEnum(zn.ToolExecutionEntryObject);zn.ToolExecutionEntryObject$outboundSchema=zn.ToolExecutionEntryObject$inboundSchema;var sTr;(function(t){t.inboundSchema=zn.ToolExecutionEntryObject$inboundSchema,t.outboundSchema=zn.ToolExecutionEntryObject$outboundSchema})(sTr||(zn.ToolExecutionEntryObject$=sTr={}));zn.ToolExecutionEntryType$inboundSchema=Ch.nativeEnum(zn.ToolExecutionEntryType);zn.ToolExecutionEntryType$outboundSchema=zn.ToolExecutionEntryType$inboundSchema;var uTr;(function(t){t.inboundSchema=zn.ToolExecutionEntryType$inboundSchema,t.outboundSchema=zn.ToolExecutionEntryType$outboundSchema})(uTr||(zn.ToolExecutionEntryType$=uTr={}));zn.ToolExecutionEntry$inboundSchema=Ch.object({object:zn.ToolExecutionEntryObject$inboundSchema.default("entry"),type:zn.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:dTr.BuiltInConnectors$inboundSchema,arguments:Ch.string(),info:Ch.record(Ch.any()).optional()}).transform(t=>(0,cTr.remap)(t,{created_at:"createdAt",completed_at:"completedAt"}));zn.ToolExecutionEntry$outboundSchema=Ch.object({object:zn.ToolExecutionEntryObject$outboundSchema.default("entry"),type:zn.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:dTr.BuiltInConnectors$outboundSchema,arguments:Ch.string(),info:Ch.record(Ch.any()).optional()}).transform(t=>(0,cTr.remap)(t,{createdAt:"created_at",completedAt:"completed_at"}));var lTr;(function(t){t.inboundSchema=zn.ToolExecutionEntry$inboundSchema,t.outboundSchema=zn.ToolExecutionEntry$outboundSchema})(lTr||(zn.ToolExecutionEntry$=lTr={}));function rCo(t){return JSON.stringify(zn.ToolExecutionEntry$outboundSchema.parse(t))}function nCo(t){return(0,tCo.safeParse)(t,e=>zn.ToolExecutionEntry$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionEntry' from JSON")}});var Ust=S(Of=>{"use strict";var oCo=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]}),iCo=Of&&Of.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aCo=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"&&oCo(r,e,n[o]);return iCo(r,e),r}}();Object.defineProperty(Of,"__esModule",{value:!0});Of.InputEntries$=Of.InputEntries$outboundSchema=Of.InputEntries$inboundSchema=void 0;Of.inputEntriesToJSON=uCo;Of.inputEntriesFromJSON=lCo;var pTr=aCo(te()),sCo=ee(),mTr=Cae(),hTr=Pae(),gTr=eMe(),yTr=Rae(),bTr=f9(),_Tr=Aae();Of.InputEntries$inboundSchema=pTr.union([mTr.AgentHandoffEntry$inboundSchema,hTr.FunctionCallEntry$inboundSchema,yTr.MessageInputEntry$inboundSchema,gTr.FunctionResultEntry$inboundSchema,_Tr.ToolExecutionEntry$inboundSchema,bTr.MessageOutputEntry$inboundSchema]);Of.InputEntries$outboundSchema=pTr.union([mTr.AgentHandoffEntry$outboundSchema,hTr.FunctionCallEntry$outboundSchema,yTr.MessageInputEntry$outboundSchema,gTr.FunctionResultEntry$outboundSchema,_Tr.ToolExecutionEntry$outboundSchema,bTr.MessageOutputEntry$outboundSchema]);var fTr;(function(t){t.inboundSchema=Of.InputEntries$inboundSchema,t.outboundSchema=Of.InputEntries$outboundSchema})(fTr||(Of.InputEntries$=fTr={}));function uCo(t){return JSON.stringify(Of.InputEntries$outboundSchema.parse(t))}function lCo(t){return(0,sCo.safeParse)(t,e=>Of.InputEntries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'InputEntries' from JSON")}});var hq=S(Tf=>{"use strict";var cCo=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]}),dCo=Tf&&Tf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fCo=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"&&cCo(r,e,n[o]);return dCo(r,e),r}}();Object.defineProperty(Tf,"__esModule",{value:!0});Tf.ConversationInputs$=Tf.ConversationInputs$outboundSchema=Tf.ConversationInputs$inboundSchema=void 0;Tf.conversationInputsToJSON=mCo;Tf.conversationInputsFromJSON=hCo;var p9=fCo(te()),pCo=ee(),wTr=Ust();Tf.ConversationInputs$inboundSchema=p9.union([p9.string(),p9.array(wTr.InputEntries$inboundSchema)]);Tf.ConversationInputs$outboundSchema=p9.union([p9.string(),p9.array(wTr.InputEntries$outboundSchema)]);var vTr;(function(t){t.inboundSchema=Tf.ConversationInputs$inboundSchema,t.outboundSchema=Tf.ConversationInputs$outboundSchema})(vTr||(Tf.ConversationInputs$=vTr={}));function mCo(t){return JSON.stringify(Tf.ConversationInputs$outboundSchema.parse(t))}function hCo(t){return(0,pCo.safeParse)(t,e=>Tf.ConversationInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationInputs' from JSON")}});var ETr=S(wa=>{"use strict";var gCo=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]}),yCo=wa&&wa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bCo=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"&&gCo(r,e,n[o]);return yCo(r,e),r}}();Object.defineProperty(wa,"__esModule",{value:!0});wa.ConversationAppendRequest$=wa.ConversationAppendRequest$outboundSchema=wa.ConversationAppendRequest$inboundSchema=wa.ConversationAppendRequestHandoffExecution$=wa.ConversationAppendRequestHandoffExecution$outboundSchema=wa.ConversationAppendRequestHandoffExecution$inboundSchema=wa.ConversationAppendRequestHandoffExecution=void 0;wa.conversationAppendRequestToJSON=vCo;wa.conversationAppendRequestFromJSON=wCo;var wV=bCo(te()),xTr=ae(),_Co=ee(),OTr=HS(),TTr=hq();wa.ConversationAppendRequestHandoffExecution={Client:"client",Server:"server"};wa.ConversationAppendRequestHandoffExecution$inboundSchema=wV.nativeEnum(wa.ConversationAppendRequestHandoffExecution);wa.ConversationAppendRequestHandoffExecution$outboundSchema=wa.ConversationAppendRequestHandoffExecution$inboundSchema;var STr;(function(t){t.inboundSchema=wa.ConversationAppendRequestHandoffExecution$inboundSchema,t.outboundSchema=wa.ConversationAppendRequestHandoffExecution$outboundSchema})(STr||(wa.ConversationAppendRequestHandoffExecution$=STr={}));wa.ConversationAppendRequest$inboundSchema=wV.object({inputs:TTr.ConversationInputs$inboundSchema,stream:wV.boolean().default(!1),store:wV.boolean().default(!0),handoff_execution:wa.ConversationAppendRequestHandoffExecution$inboundSchema.default("server"),completion_args:OTr.CompletionArgs$inboundSchema.optional()}).transform(t=>(0,xTr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs"}));wa.ConversationAppendRequest$outboundSchema=wV.object({inputs:TTr.ConversationInputs$outboundSchema,stream:wV.boolean().default(!1),store:wV.boolean().default(!0),handoffExecution:wa.ConversationAppendRequestHandoffExecution$outboundSchema.default("server"),completionArgs:OTr.CompletionArgs$outboundSchema.optional()}).transform(t=>(0,xTr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args"}));var CTr;(function(t){t.inboundSchema=wa.ConversationAppendRequest$inboundSchema,t.outboundSchema=wa.ConversationAppendRequest$outboundSchema})(CTr||(wa.ConversationAppendRequest$=CTr={}));function vCo(t){return JSON.stringify(wa.ConversationAppendRequest$outboundSchema.parse(t))}function wCo(t){return(0,_Co.safeParse)(t,e=>wa.ConversationAppendRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationAppendRequest' from JSON")}});var NTr=S(Sa=>{"use strict";var SCo=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]}),CCo=Sa&&Sa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xCo=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"&&SCo(r,e,n[o]);return CCo(r,e),r}}();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.ConversationAppendStreamRequest$=Sa.ConversationAppendStreamRequest$outboundSchema=Sa.ConversationAppendStreamRequest$inboundSchema=Sa.ConversationAppendStreamRequestHandoffExecution$=Sa.ConversationAppendStreamRequestHandoffExecution$outboundSchema=Sa.ConversationAppendStreamRequestHandoffExecution$inboundSchema=Sa.ConversationAppendStreamRequestHandoffExecution=void 0;Sa.conversationAppendStreamRequestToJSON=TCo;Sa.conversationAppendStreamRequestFromJSON=ECo;var SV=xCo(te()),RTr=ae(),OCo=ee(),ATr=HS(),ITr=hq();Sa.ConversationAppendStreamRequestHandoffExecution={Client:"client",Server:"server"};Sa.ConversationAppendStreamRequestHandoffExecution$inboundSchema=SV.nativeEnum(Sa.ConversationAppendStreamRequestHandoffExecution);Sa.ConversationAppendStreamRequestHandoffExecution$outboundSchema=Sa.ConversationAppendStreamRequestHandoffExecution$inboundSchema;var PTr;(function(t){t.inboundSchema=Sa.ConversationAppendStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=Sa.ConversationAppendStreamRequestHandoffExecution$outboundSchema})(PTr||(Sa.ConversationAppendStreamRequestHandoffExecution$=PTr={}));Sa.ConversationAppendStreamRequest$inboundSchema=SV.object({inputs:ITr.ConversationInputs$inboundSchema,stream:SV.boolean().default(!0),store:SV.boolean().default(!0),handoff_execution:Sa.ConversationAppendStreamRequestHandoffExecution$inboundSchema.default("server"),completion_args:ATr.CompletionArgs$inboundSchema.optional()}).transform(t=>(0,RTr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs"}));Sa.ConversationAppendStreamRequest$outboundSchema=SV.object({inputs:ITr.ConversationInputs$outboundSchema,stream:SV.boolean().default(!0),store:SV.boolean().default(!0),handoffExecution:Sa.ConversationAppendStreamRequestHandoffExecution$outboundSchema.default("server"),completionArgs:ATr.CompletionArgs$outboundSchema.optional()}).transform(t=>(0,RTr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args"}));var MTr;(function(t){t.inboundSchema=Sa.ConversationAppendStreamRequest$inboundSchema,t.outboundSchema=Sa.ConversationAppendStreamRequest$outboundSchema})(MTr||(Sa.ConversationAppendStreamRequest$=MTr={}));function TCo(t){return JSON.stringify(Sa.ConversationAppendStreamRequest$outboundSchema.parse(t))}function ECo(t){return(0,OCo.safeParse)(t,e=>Sa.ConversationAppendStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationAppendStreamRequest' from JSON")}});var zst=S(Ca=>{"use strict";var PCo=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]}),MCo=Ca&&Ca.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RCo=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"&&PCo(r,e,n[o]);return MCo(r,e),r}}();Object.defineProperty(Ca,"__esModule",{value:!0});Ca.FunctionCallEvent$=Ca.FunctionCallEvent$outboundSchema=Ca.FunctionCallEvent$inboundSchema=Ca.FunctionCallEventType$=Ca.FunctionCallEventType$outboundSchema=Ca.FunctionCallEventType$inboundSchema=Ca.FunctionCallEventType=void 0;Ca.functionCallEventToJSON=ICo;Ca.functionCallEventFromJSON=NCo;var xb=RCo(te()),$Tr=ae(),ACo=ee();Ca.FunctionCallEventType={FunctionCallDelta:"function.call.delta"};Ca.FunctionCallEventType$inboundSchema=xb.nativeEnum(Ca.FunctionCallEventType);Ca.FunctionCallEventType$outboundSchema=Ca.FunctionCallEventType$inboundSchema;var jTr;(function(t){t.inboundSchema=Ca.FunctionCallEventType$inboundSchema,t.outboundSchema=Ca.FunctionCallEventType$outboundSchema})(jTr||(Ca.FunctionCallEventType$=jTr={}));Ca.FunctionCallEvent$inboundSchema=xb.object({type:Ca.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,$Tr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",tool_call_id:"toolCallId"}));Ca.FunctionCallEvent$outboundSchema=xb.object({type:Ca.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,$Tr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",toolCallId:"tool_call_id"}));var DTr;(function(t){t.inboundSchema=Ca.FunctionCallEvent$inboundSchema,t.outboundSchema=Ca.FunctionCallEvent$outboundSchema})(DTr||(Ca.FunctionCallEvent$=DTr={}));function ICo(t){return JSON.stringify(Ca.FunctionCallEvent$outboundSchema.parse(t))}function NCo(t){return(0,ACo.safeParse)(t,e=>Ca.FunctionCallEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FunctionCallEvent' from JSON")}});var Hst=S(Ef=>{"use strict";var jCo=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]}),DCo=Ef&&Ef.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Co=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"&&jCo(r,e,n[o]);return DCo(r,e),r}}();Object.defineProperty(Ef,"__esModule",{value:!0});Ef.OutputContentChunks$=Ef.OutputContentChunks$outboundSchema=Ef.OutputContentChunks$inboundSchema=void 0;Ef.outputContentChunksToJSON=FCo;Ef.outputContentChunksFromJSON=kCo;var FTr=$Co(te()),LCo=ee(),kTr=fV(),qTr=pV(),BTr=dq(),UTr=hV(),zTr=Mae(),HTr=rMe();Ef.OutputContentChunks$inboundSchema=FTr.union([zTr.ToolFileChunk$inboundSchema,HTr.ToolReferenceChunk$inboundSchema,BTr.TextChunk$inboundSchema,qTr.ImageURLChunk$inboundSchema,kTr.DocumentURLChunk$inboundSchema,UTr.ThinkChunk$inboundSchema]);Ef.OutputContentChunks$outboundSchema=FTr.union([zTr.ToolFileChunk$outboundSchema,HTr.ToolReferenceChunk$outboundSchema,BTr.TextChunk$outboundSchema,qTr.ImageURLChunk$outboundSchema,kTr.DocumentURLChunk$outboundSchema,UTr.ThinkChunk$outboundSchema]);var LTr;(function(t){t.inboundSchema=Ef.OutputContentChunks$inboundSchema,t.outboundSchema=Ef.OutputContentChunks$outboundSchema})(LTr||(Ef.OutputContentChunks$=LTr={}));function FCo(t){return JSON.stringify(Ef.OutputContentChunks$outboundSchema.parse(t))}function kCo(t){return(0,LCo.safeParse)(t,e=>Ef.OutputContentChunks$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OutputContentChunks' from JSON")}});var Vst=S(Nr=>{"use strict";var qCo=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]}),BCo=Nr&&Nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UCo=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"&&qCo(r,e,n[o]);return BCo(r,e),r}}();Object.defineProperty(Nr,"__esModule",{value:!0});Nr.MessageOutputEvent$=Nr.MessageOutputEvent$outboundSchema=Nr.MessageOutputEvent$inboundSchema=Nr.MessageOutputEventContent$=Nr.MessageOutputEventContent$outboundSchema=Nr.MessageOutputEventContent$inboundSchema=Nr.MessageOutputEventRole$=Nr.MessageOutputEventRole$outboundSchema=Nr.MessageOutputEventRole$inboundSchema=Nr.MessageOutputEventType$=Nr.MessageOutputEventType$outboundSchema=Nr.MessageOutputEventType$inboundSchema=Nr.MessageOutputEventRole=Nr.MessageOutputEventType=void 0;Nr.messageOutputEventContentToJSON=zCo;Nr.messageOutputEventContentFromJSON=HCo;Nr.messageOutputEventToJSON=VCo;Nr.messageOutputEventFromJSON=JCo;var mu=UCo(te()),GTr=ae(),ZTr=ee(),oMe=Hst();Nr.MessageOutputEventType={MessageOutputDelta:"message.output.delta"};Nr.MessageOutputEventRole={Assistant:"assistant"};Nr.MessageOutputEventType$inboundSchema=mu.nativeEnum(Nr.MessageOutputEventType);Nr.MessageOutputEventType$outboundSchema=Nr.MessageOutputEventType$inboundSchema;var VTr;(function(t){t.inboundSchema=Nr.MessageOutputEventType$inboundSchema,t.outboundSchema=Nr.MessageOutputEventType$outboundSchema})(VTr||(Nr.MessageOutputEventType$=VTr={}));Nr.MessageOutputEventRole$inboundSchema=mu.nativeEnum(Nr.MessageOutputEventRole);Nr.MessageOutputEventRole$outboundSchema=Nr.MessageOutputEventRole$inboundSchema;var JTr;(function(t){t.inboundSchema=Nr.MessageOutputEventRole$inboundSchema,t.outboundSchema=Nr.MessageOutputEventRole$outboundSchema})(JTr||(Nr.MessageOutputEventRole$=JTr={}));Nr.MessageOutputEventContent$inboundSchema=mu.union([mu.string(),oMe.OutputContentChunks$inboundSchema]);Nr.MessageOutputEventContent$outboundSchema=mu.union([mu.string(),oMe.OutputContentChunks$outboundSchema]);var KTr;(function(t){t.inboundSchema=Nr.MessageOutputEventContent$inboundSchema,t.outboundSchema=Nr.MessageOutputEventContent$outboundSchema})(KTr||(Nr.MessageOutputEventContent$=KTr={}));function zCo(t){return JSON.stringify(Nr.MessageOutputEventContent$outboundSchema.parse(t))}function HCo(t){return(0,ZTr.safeParse)(t,e=>Nr.MessageOutputEventContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEventContent' from JSON")}Nr.MessageOutputEvent$inboundSchema=mu.object({type:Nr.MessageOutputEventType$inboundSchema.default("message.output.delta"),created_at:mu.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:mu.number().int().default(0),id:mu.string(),content_index:mu.number().int().default(0),model:mu.nullable(mu.string()).optional(),agent_id:mu.nullable(mu.string()).optional(),role:Nr.MessageOutputEventRole$inboundSchema.default("assistant"),content:mu.union([mu.string(),oMe.OutputContentChunks$inboundSchema])}).transform(t=>(0,GTr.remap)(t,{created_at:"createdAt",output_index:"outputIndex",content_index:"contentIndex",agent_id:"agentId"}));Nr.MessageOutputEvent$outboundSchema=mu.object({type:Nr.MessageOutputEventType$outboundSchema.default("message.output.delta"),createdAt:mu.date().transform(t=>t.toISOString()).optional(),outputIndex:mu.number().int().default(0),id:mu.string(),contentIndex:mu.number().int().default(0),model:mu.nullable(mu.string()).optional(),agentId:mu.nullable(mu.string()).optional(),role:Nr.MessageOutputEventRole$outboundSchema.default("assistant"),content:mu.union([mu.string(),oMe.OutputContentChunks$outboundSchema])}).transform(t=>(0,GTr.remap)(t,{createdAt:"created_at",outputIndex:"output_index",contentIndex:"content_index",agentId:"agent_id"}));var WTr;(function(t){t.inboundSchema=Nr.MessageOutputEvent$inboundSchema,t.outboundSchema=Nr.MessageOutputEvent$outboundSchema})(WTr||(Nr.MessageOutputEvent$=WTr={}));function VCo(t){return JSON.stringify(Nr.MessageOutputEvent$outboundSchema.parse(t))}function JCo(t){return(0,ZTr.safeParse)(t,e=>Nr.MessageOutputEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageOutputEvent' from JSON")}});var iMe=S(Pf=>{"use strict";var KCo=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]}),WCo=Pf&&Pf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GCo=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"&&KCo(r,e,n[o]);return WCo(r,e),r}}();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.ConversationUsageInfo$=Pf.ConversationUsageInfo$outboundSchema=Pf.ConversationUsageInfo$inboundSchema=void 0;Pf.conversationUsageInfoToJSON=XCo;Pf.conversationUsageInfoFromJSON=YCo;var xh=GCo(te()),YTr=ae(),ZCo=ee();Pf.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,YTr.remap)(t,{prompt_tokens:"promptTokens",completion_tokens:"completionTokens",total_tokens:"totalTokens",connector_tokens:"connectorTokens"}));Pf.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,YTr.remap)(t,{promptTokens:"prompt_tokens",completionTokens:"completion_tokens",totalTokens:"total_tokens",connectorTokens:"connector_tokens"}));var XTr;(function(t){t.inboundSchema=Pf.ConversationUsageInfo$inboundSchema,t.outboundSchema=Pf.ConversationUsageInfo$outboundSchema})(XTr||(Pf.ConversationUsageInfo$=XTr={}));function XCo(t){return JSON.stringify(Pf.ConversationUsageInfo$outboundSchema.parse(t))}function YCo(t){return(0,ZCo.safeParse)(t,e=>Pf.ConversationUsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationUsageInfo' from JSON")}});var Jst=S(xa=>{"use strict";var QCo=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]}),exo=xa&&xa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),txo=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"&&QCo(r,e,n[o]);return exo(r,e),r}}();Object.defineProperty(xa,"__esModule",{value:!0});xa.ResponseDoneEvent$=xa.ResponseDoneEvent$outboundSchema=xa.ResponseDoneEvent$inboundSchema=xa.ResponseDoneEventType$=xa.ResponseDoneEventType$outboundSchema=xa.ResponseDoneEventType$inboundSchema=xa.ResponseDoneEventType=void 0;xa.responseDoneEventToJSON=nxo;xa.responseDoneEventFromJSON=oxo;var Iae=txo(te()),tEr=ae(),rxo=ee(),rEr=iMe();xa.ResponseDoneEventType={ConversationResponseDone:"conversation.response.done"};xa.ResponseDoneEventType$inboundSchema=Iae.nativeEnum(xa.ResponseDoneEventType);xa.ResponseDoneEventType$outboundSchema=xa.ResponseDoneEventType$inboundSchema;var QTr;(function(t){t.inboundSchema=xa.ResponseDoneEventType$inboundSchema,t.outboundSchema=xa.ResponseDoneEventType$outboundSchema})(QTr||(xa.ResponseDoneEventType$=QTr={}));xa.ResponseDoneEvent$inboundSchema=Iae.object({type:xa.ResponseDoneEventType$inboundSchema.default("conversation.response.done"),created_at:Iae.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),usage:rEr.ConversationUsageInfo$inboundSchema}).transform(t=>(0,tEr.remap)(t,{created_at:"createdAt"}));xa.ResponseDoneEvent$outboundSchema=Iae.object({type:xa.ResponseDoneEventType$outboundSchema.default("conversation.response.done"),createdAt:Iae.date().transform(t=>t.toISOString()).optional(),usage:rEr.ConversationUsageInfo$outboundSchema}).transform(t=>(0,tEr.remap)(t,{createdAt:"created_at"}));var eEr;(function(t){t.inboundSchema=xa.ResponseDoneEvent$inboundSchema,t.outboundSchema=xa.ResponseDoneEvent$outboundSchema})(eEr||(xa.ResponseDoneEvent$=eEr={}));function nxo(t){return JSON.stringify(xa.ResponseDoneEvent$outboundSchema.parse(t))}function oxo(t){return(0,rxo.safeParse)(t,e=>xa.ResponseDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseDoneEvent' from JSON")}});var Kst=S(Oa=>{"use strict";var ixo=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]}),axo=Oa&&Oa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sxo=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"&&ixo(r,e,n[o]);return axo(r,e),r}}();Object.defineProperty(Oa,"__esModule",{value:!0});Oa.ResponseErrorEvent$=Oa.ResponseErrorEvent$outboundSchema=Oa.ResponseErrorEvent$inboundSchema=Oa.ResponseErrorEventType$=Oa.ResponseErrorEventType$outboundSchema=Oa.ResponseErrorEventType$inboundSchema=Oa.ResponseErrorEventType=void 0;Oa.responseErrorEventToJSON=lxo;Oa.responseErrorEventFromJSON=cxo;var yj=sxo(te()),iEr=ae(),uxo=ee();Oa.ResponseErrorEventType={ConversationResponseError:"conversation.response.error"};Oa.ResponseErrorEventType$inboundSchema=yj.nativeEnum(Oa.ResponseErrorEventType);Oa.ResponseErrorEventType$outboundSchema=Oa.ResponseErrorEventType$inboundSchema;var nEr;(function(t){t.inboundSchema=Oa.ResponseErrorEventType$inboundSchema,t.outboundSchema=Oa.ResponseErrorEventType$outboundSchema})(nEr||(Oa.ResponseErrorEventType$=nEr={}));Oa.ResponseErrorEvent$inboundSchema=yj.object({type:Oa.ResponseErrorEventType$inboundSchema.default("conversation.response.error"),created_at:yj.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),message:yj.string(),code:yj.number().int()}).transform(t=>(0,iEr.remap)(t,{created_at:"createdAt"}));Oa.ResponseErrorEvent$outboundSchema=yj.object({type:Oa.ResponseErrorEventType$outboundSchema.default("conversation.response.error"),createdAt:yj.date().transform(t=>t.toISOString()).optional(),message:yj.string(),code:yj.number().int()}).transform(t=>(0,iEr.remap)(t,{createdAt:"created_at"}));var oEr;(function(t){t.inboundSchema=Oa.ResponseErrorEvent$inboundSchema,t.outboundSchema=Oa.ResponseErrorEvent$outboundSchema})(oEr||(Oa.ResponseErrorEvent$=oEr={}));function lxo(t){return JSON.stringify(Oa.ResponseErrorEvent$outboundSchema.parse(t))}function cxo(t){return(0,uxo.safeParse)(t,e=>Oa.ResponseErrorEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseErrorEvent' from JSON")}});var Wst=S(Ta=>{"use strict";var dxo=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]}),fxo=Ta&&Ta.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pxo=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"&&dxo(r,e,n[o]);return fxo(r,e),r}}();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.ResponseStartedEvent$=Ta.ResponseStartedEvent$outboundSchema=Ta.ResponseStartedEvent$inboundSchema=Ta.ResponseStartedEventType$=Ta.ResponseStartedEventType$outboundSchema=Ta.ResponseStartedEventType$inboundSchema=Ta.ResponseStartedEventType=void 0;Ta.responseStartedEventToJSON=hxo;Ta.responseStartedEventFromJSON=gxo;var CV=pxo(te()),uEr=ae(),mxo=ee();Ta.ResponseStartedEventType={ConversationResponseStarted:"conversation.response.started"};Ta.ResponseStartedEventType$inboundSchema=CV.nativeEnum(Ta.ResponseStartedEventType);Ta.ResponseStartedEventType$outboundSchema=Ta.ResponseStartedEventType$inboundSchema;var aEr;(function(t){t.inboundSchema=Ta.ResponseStartedEventType$inboundSchema,t.outboundSchema=Ta.ResponseStartedEventType$outboundSchema})(aEr||(Ta.ResponseStartedEventType$=aEr={}));Ta.ResponseStartedEvent$inboundSchema=CV.object({type:Ta.ResponseStartedEventType$inboundSchema.default("conversation.response.started"),created_at:CV.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),conversation_id:CV.string()}).transform(t=>(0,uEr.remap)(t,{created_at:"createdAt",conversation_id:"conversationId"}));Ta.ResponseStartedEvent$outboundSchema=CV.object({type:Ta.ResponseStartedEventType$outboundSchema.default("conversation.response.started"),createdAt:CV.date().transform(t=>t.toISOString()).optional(),conversationId:CV.string()}).transform(t=>(0,uEr.remap)(t,{createdAt:"created_at",conversationId:"conversation_id"}));var sEr;(function(t){t.inboundSchema=Ta.ResponseStartedEvent$inboundSchema,t.outboundSchema=Ta.ResponseStartedEvent$outboundSchema})(sEr||(Ta.ResponseStartedEvent$=sEr={}));function hxo(t){return JSON.stringify(Ta.ResponseStartedEvent$outboundSchema.parse(t))}function gxo(t){return(0,mxo.safeParse)(t,e=>Ta.ResponseStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseStartedEvent' from JSON")}});var Gst=S(Mf=>{"use strict";var yxo=Mf&&Mf.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bxo=Mf&&Mf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_xo=Mf&&Mf.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&yxo(r,e,n[o]);return bxo(r,e),r}}();Object.defineProperty(Mf,"__esModule",{value:!0});Mf.SSETypes$=Mf.SSETypes$outboundSchema=Mf.SSETypes$inboundSchema=Mf.SSETypes=void 0;var vxo=_xo(te());Mf.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"};Mf.SSETypes$inboundSchema=vxo.nativeEnum(Mf.SSETypes);Mf.SSETypes$outboundSchema=Mf.SSETypes$inboundSchema;var lEr;(function(t){t.inboundSchema=Mf.SSETypes$inboundSchema,t.outboundSchema=Mf.SSETypes$outboundSchema})(lEr||(Mf.SSETypes$=lEr={}))});var Zst=S(Ea=>{"use strict";var wxo=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]}),Sxo=Ea&&Ea.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Cxo=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"&&wxo(r,e,n[o]);return Sxo(r,e),r}}();Object.defineProperty(Ea,"__esModule",{value:!0});Ea.ToolExecutionDeltaEvent$=Ea.ToolExecutionDeltaEvent$outboundSchema=Ea.ToolExecutionDeltaEvent$inboundSchema=Ea.ToolExecutionDeltaEventType$=Ea.ToolExecutionDeltaEventType$outboundSchema=Ea.ToolExecutionDeltaEventType$inboundSchema=Ea.ToolExecutionDeltaEventType=void 0;Ea.toolExecutionDeltaEventToJSON=Oxo;Ea.toolExecutionDeltaEventFromJSON=Txo;var rx=Cxo(te()),fEr=ae(),xxo=ee(),pEr=fq();Ea.ToolExecutionDeltaEventType={ToolExecutionDelta:"tool.execution.delta"};Ea.ToolExecutionDeltaEventType$inboundSchema=rx.nativeEnum(Ea.ToolExecutionDeltaEventType);Ea.ToolExecutionDeltaEventType$outboundSchema=Ea.ToolExecutionDeltaEventType$inboundSchema;var cEr;(function(t){t.inboundSchema=Ea.ToolExecutionDeltaEventType$inboundSchema,t.outboundSchema=Ea.ToolExecutionDeltaEventType$outboundSchema})(cEr||(Ea.ToolExecutionDeltaEventType$=cEr={}));Ea.ToolExecutionDeltaEvent$inboundSchema=rx.object({type:Ea.ToolExecutionDeltaEventType$inboundSchema.default("tool.execution.delta"),created_at:rx.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:rx.number().int().default(0),id:rx.string(),name:pEr.BuiltInConnectors$inboundSchema,arguments:rx.string()}).transform(t=>(0,fEr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));Ea.ToolExecutionDeltaEvent$outboundSchema=rx.object({type:Ea.ToolExecutionDeltaEventType$outboundSchema.default("tool.execution.delta"),createdAt:rx.date().transform(t=>t.toISOString()).optional(),outputIndex:rx.number().int().default(0),id:rx.string(),name:pEr.BuiltInConnectors$outboundSchema,arguments:rx.string()}).transform(t=>(0,fEr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var dEr;(function(t){t.inboundSchema=Ea.ToolExecutionDeltaEvent$inboundSchema,t.outboundSchema=Ea.ToolExecutionDeltaEvent$outboundSchema})(dEr||(Ea.ToolExecutionDeltaEvent$=dEr={}));function Oxo(t){return JSON.stringify(Ea.ToolExecutionDeltaEvent$outboundSchema.parse(t))}function Txo(t){return(0,xxo.safeParse)(t,e=>Ea.ToolExecutionDeltaEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionDeltaEvent' from JSON")}});var Xst=S(Pa=>{"use strict";var Exo=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]}),Pxo=Pa&&Pa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Mxo=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"&&Exo(r,e,n[o]);return Pxo(r,e),r}}();Object.defineProperty(Pa,"__esModule",{value:!0});Pa.ToolExecutionDoneEvent$=Pa.ToolExecutionDoneEvent$outboundSchema=Pa.ToolExecutionDoneEvent$inboundSchema=Pa.ToolExecutionDoneEventType$=Pa.ToolExecutionDoneEventType$outboundSchema=Pa.ToolExecutionDoneEventType$inboundSchema=Pa.ToolExecutionDoneEventType=void 0;Pa.toolExecutionDoneEventToJSON=Axo;Pa.toolExecutionDoneEventFromJSON=Ixo;var uw=Mxo(te()),gEr=ae(),Rxo=ee(),yEr=fq();Pa.ToolExecutionDoneEventType={ToolExecutionDone:"tool.execution.done"};Pa.ToolExecutionDoneEventType$inboundSchema=uw.nativeEnum(Pa.ToolExecutionDoneEventType);Pa.ToolExecutionDoneEventType$outboundSchema=Pa.ToolExecutionDoneEventType$inboundSchema;var mEr;(function(t){t.inboundSchema=Pa.ToolExecutionDoneEventType$inboundSchema,t.outboundSchema=Pa.ToolExecutionDoneEventType$outboundSchema})(mEr||(Pa.ToolExecutionDoneEventType$=mEr={}));Pa.ToolExecutionDoneEvent$inboundSchema=uw.object({type:Pa.ToolExecutionDoneEventType$inboundSchema.default("tool.execution.done"),created_at:uw.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:uw.number().int().default(0),id:uw.string(),name:yEr.BuiltInConnectors$inboundSchema,info:uw.record(uw.any()).optional()}).transform(t=>(0,gEr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));Pa.ToolExecutionDoneEvent$outboundSchema=uw.object({type:Pa.ToolExecutionDoneEventType$outboundSchema.default("tool.execution.done"),createdAt:uw.date().transform(t=>t.toISOString()).optional(),outputIndex:uw.number().int().default(0),id:uw.string(),name:yEr.BuiltInConnectors$outboundSchema,info:uw.record(uw.any()).optional()}).transform(t=>(0,gEr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var hEr;(function(t){t.inboundSchema=Pa.ToolExecutionDoneEvent$inboundSchema,t.outboundSchema=Pa.ToolExecutionDoneEvent$outboundSchema})(hEr||(Pa.ToolExecutionDoneEvent$=hEr={}));function Axo(t){return JSON.stringify(Pa.ToolExecutionDoneEvent$outboundSchema.parse(t))}function Ixo(t){return(0,Rxo.safeParse)(t,e=>Pa.ToolExecutionDoneEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionDoneEvent' from JSON")}});var Yst=S(Ma=>{"use strict";var Nxo=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]}),jxo=Ma&&Ma.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dxo=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"&&Nxo(r,e,n[o]);return jxo(r,e),r}}();Object.defineProperty(Ma,"__esModule",{value:!0});Ma.ToolExecutionStartedEvent$=Ma.ToolExecutionStartedEvent$outboundSchema=Ma.ToolExecutionStartedEvent$inboundSchema=Ma.ToolExecutionStartedEventType$=Ma.ToolExecutionStartedEventType$outboundSchema=Ma.ToolExecutionStartedEventType$inboundSchema=Ma.ToolExecutionStartedEventType=void 0;Ma.toolExecutionStartedEventToJSON=Lxo;Ma.toolExecutionStartedEventFromJSON=Fxo;var nx=Dxo(te()),vEr=ae(),$xo=ee(),wEr=fq();Ma.ToolExecutionStartedEventType={ToolExecutionStarted:"tool.execution.started"};Ma.ToolExecutionStartedEventType$inboundSchema=nx.nativeEnum(Ma.ToolExecutionStartedEventType);Ma.ToolExecutionStartedEventType$outboundSchema=Ma.ToolExecutionStartedEventType$inboundSchema;var bEr;(function(t){t.inboundSchema=Ma.ToolExecutionStartedEventType$inboundSchema,t.outboundSchema=Ma.ToolExecutionStartedEventType$outboundSchema})(bEr||(Ma.ToolExecutionStartedEventType$=bEr={}));Ma.ToolExecutionStartedEvent$inboundSchema=nx.object({type:Ma.ToolExecutionStartedEventType$inboundSchema.default("tool.execution.started"),created_at:nx.string().datetime({offset:!0}).transform(t=>new Date(t)).optional(),output_index:nx.number().int().default(0),id:nx.string(),name:wEr.BuiltInConnectors$inboundSchema,arguments:nx.string()}).transform(t=>(0,vEr.remap)(t,{created_at:"createdAt",output_index:"outputIndex"}));Ma.ToolExecutionStartedEvent$outboundSchema=nx.object({type:Ma.ToolExecutionStartedEventType$outboundSchema.default("tool.execution.started"),createdAt:nx.date().transform(t=>t.toISOString()).optional(),outputIndex:nx.number().int().default(0),id:nx.string(),name:wEr.BuiltInConnectors$outboundSchema,arguments:nx.string()}).transform(t=>(0,vEr.remap)(t,{createdAt:"created_at",outputIndex:"output_index"}));var _Er;(function(t){t.inboundSchema=Ma.ToolExecutionStartedEvent$inboundSchema,t.outboundSchema=Ma.ToolExecutionStartedEvent$outboundSchema})(_Er||(Ma.ToolExecutionStartedEvent$=_Er={}));function Lxo(t){return JSON.stringify(Ma.ToolExecutionStartedEvent$outboundSchema.parse(t))}function Fxo(t){return(0,$xo.safeParse)(t,e=>Ma.ToolExecutionStartedEvent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ToolExecutionStartedEvent' from JSON")}});var TEr=S(ps=>{"use strict";var kxo=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]}),qxo=ps&&ps.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Bxo=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"&&kxo(r,e,n[o]);return qxo(r,e),r}}();Object.defineProperty(ps,"__esModule",{value:!0});ps.ConversationEvents$=ps.ConversationEvents$outboundSchema=ps.ConversationEvents$inboundSchema=ps.ConversationEventsData$=ps.ConversationEventsData$outboundSchema=ps.ConversationEventsData$inboundSchema=void 0;ps.conversationEventsDataToJSON=Uxo;ps.conversationEventsDataFromJSON=zxo;ps.conversationEventsToJSON=Hxo;ps.conversationEventsFromJSON=Vxo;var st=Bxo(te()),xEr=ee(),aMe=dst(),sMe=fst(),uMe=zst(),lMe=Vst(),cMe=Jst(),dMe=Kst(),fMe=Wst(),OEr=Gst(),pMe=Zst(),mMe=Xst(),hMe=Yst();ps.ConversationEventsData$inboundSchema=st.union([uMe.FunctionCallEvent$inboundSchema.and(st.object({type:st.literal("function.call.delta")}).transform(t=>({type:t.type}))),aMe.AgentHandoffDoneEvent$inboundSchema.and(st.object({type:st.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),sMe.AgentHandoffStartedEvent$inboundSchema.and(st.object({type:st.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),pMe.ToolExecutionDeltaEvent$inboundSchema.and(st.object({type:st.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),hMe.ToolExecutionStartedEvent$inboundSchema.and(st.object({type:st.literal("tool.execution.started")}).transform(t=>({type:t.type}))),dMe.ResponseErrorEvent$inboundSchema.and(st.object({type:st.literal("conversation.response.error")}).transform(t=>({type:t.type}))),lMe.MessageOutputEvent$inboundSchema.and(st.object({type:st.literal("message.output.delta")}).transform(t=>({type:t.type}))),mMe.ToolExecutionDoneEvent$inboundSchema.and(st.object({type:st.literal("tool.execution.done")}).transform(t=>({type:t.type}))),cMe.ResponseDoneEvent$inboundSchema.and(st.object({type:st.literal("conversation.response.done")}).transform(t=>({type:t.type}))),fMe.ResponseStartedEvent$inboundSchema.and(st.object({type:st.literal("conversation.response.started")}).transform(t=>({type:t.type})))]);ps.ConversationEventsData$outboundSchema=st.union([uMe.FunctionCallEvent$outboundSchema.and(st.object({type:st.literal("function.call.delta")}).transform(t=>({type:t.type}))),aMe.AgentHandoffDoneEvent$outboundSchema.and(st.object({type:st.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),sMe.AgentHandoffStartedEvent$outboundSchema.and(st.object({type:st.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),pMe.ToolExecutionDeltaEvent$outboundSchema.and(st.object({type:st.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),hMe.ToolExecutionStartedEvent$outboundSchema.and(st.object({type:st.literal("tool.execution.started")}).transform(t=>({type:t.type}))),dMe.ResponseErrorEvent$outboundSchema.and(st.object({type:st.literal("conversation.response.error")}).transform(t=>({type:t.type}))),lMe.MessageOutputEvent$outboundSchema.and(st.object({type:st.literal("message.output.delta")}).transform(t=>({type:t.type}))),mMe.ToolExecutionDoneEvent$outboundSchema.and(st.object({type:st.literal("tool.execution.done")}).transform(t=>({type:t.type}))),cMe.ResponseDoneEvent$outboundSchema.and(st.object({type:st.literal("conversation.response.done")}).transform(t=>({type:t.type}))),fMe.ResponseStartedEvent$outboundSchema.and(st.object({type:st.literal("conversation.response.started")}).transform(t=>({type:t.type})))]);var SEr;(function(t){t.inboundSchema=ps.ConversationEventsData$inboundSchema,t.outboundSchema=ps.ConversationEventsData$outboundSchema})(SEr||(ps.ConversationEventsData$=SEr={}));function Uxo(t){return JSON.stringify(ps.ConversationEventsData$outboundSchema.parse(t))}function zxo(t){return(0,xEr.safeParse)(t,e=>ps.ConversationEventsData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationEventsData' from JSON")}ps.ConversationEvents$inboundSchema=st.object({event:OEr.SSETypes$inboundSchema,data:st.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:st.ZodIssueCode.custom,message:`malformed json: ${r}`}),st.NEVER}}).pipe(st.union([uMe.FunctionCallEvent$inboundSchema.and(st.object({type:st.literal("function.call.delta")}).transform(t=>({type:t.type}))),aMe.AgentHandoffDoneEvent$inboundSchema.and(st.object({type:st.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),sMe.AgentHandoffStartedEvent$inboundSchema.and(st.object({type:st.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),pMe.ToolExecutionDeltaEvent$inboundSchema.and(st.object({type:st.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),hMe.ToolExecutionStartedEvent$inboundSchema.and(st.object({type:st.literal("tool.execution.started")}).transform(t=>({type:t.type}))),dMe.ResponseErrorEvent$inboundSchema.and(st.object({type:st.literal("conversation.response.error")}).transform(t=>({type:t.type}))),lMe.MessageOutputEvent$inboundSchema.and(st.object({type:st.literal("message.output.delta")}).transform(t=>({type:t.type}))),mMe.ToolExecutionDoneEvent$inboundSchema.and(st.object({type:st.literal("tool.execution.done")}).transform(t=>({type:t.type}))),cMe.ResponseDoneEvent$inboundSchema.and(st.object({type:st.literal("conversation.response.done")}).transform(t=>({type:t.type}))),fMe.ResponseStartedEvent$inboundSchema.and(st.object({type:st.literal("conversation.response.started")}).transform(t=>({type:t.type})))]))});ps.ConversationEvents$outboundSchema=st.object({event:OEr.SSETypes$outboundSchema,data:st.union([uMe.FunctionCallEvent$outboundSchema.and(st.object({type:st.literal("function.call.delta")}).transform(t=>({type:t.type}))),aMe.AgentHandoffDoneEvent$outboundSchema.and(st.object({type:st.literal("agent.handoff.done")}).transform(t=>({type:t.type}))),sMe.AgentHandoffStartedEvent$outboundSchema.and(st.object({type:st.literal("agent.handoff.started")}).transform(t=>({type:t.type}))),pMe.ToolExecutionDeltaEvent$outboundSchema.and(st.object({type:st.literal("tool.execution.delta")}).transform(t=>({type:t.type}))),hMe.ToolExecutionStartedEvent$outboundSchema.and(st.object({type:st.literal("tool.execution.started")}).transform(t=>({type:t.type}))),dMe.ResponseErrorEvent$outboundSchema.and(st.object({type:st.literal("conversation.response.error")}).transform(t=>({type:t.type}))),lMe.MessageOutputEvent$outboundSchema.and(st.object({type:st.literal("message.output.delta")}).transform(t=>({type:t.type}))),mMe.ToolExecutionDoneEvent$outboundSchema.and(st.object({type:st.literal("tool.execution.done")}).transform(t=>({type:t.type}))),cMe.ResponseDoneEvent$outboundSchema.and(st.object({type:st.literal("conversation.response.done")}).transform(t=>({type:t.type}))),fMe.ResponseStartedEvent$outboundSchema.and(st.object({type:st.literal("conversation.response.started")}).transform(t=>({type:t.type})))])});var CEr;(function(t){t.inboundSchema=ps.ConversationEvents$inboundSchema,t.outboundSchema=ps.ConversationEvents$outboundSchema})(CEr||(ps.ConversationEvents$=CEr={}));function Hxo(t){return JSON.stringify(ps.ConversationEvents$outboundSchema.parse(t))}function Vxo(t){return(0,xEr.safeParse)(t,e=>ps.ConversationEvents$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationEvents' from JSON")}});var IEr=S(co=>{"use strict";var Jxo=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]}),Kxo=co&&co.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wxo=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"&&Jxo(r,e,n[o]);return Kxo(r,e),r}}();Object.defineProperty(co,"__esModule",{value:!0});co.ConversationHistory$=co.ConversationHistory$outboundSchema=co.ConversationHistory$inboundSchema=co.Entries$=co.Entries$outboundSchema=co.Entries$inboundSchema=co.ConversationHistoryObject$=co.ConversationHistoryObject$outboundSchema=co.ConversationHistoryObject$inboundSchema=co.ConversationHistoryObject=void 0;co.entriesToJSON=Gxo;co.entriesFromJSON=Zxo;co.conversationHistoryToJSON=Xxo;co.conversationHistoryFromJSON=Yxo;var ox=Wxo(te()),REr=ae(),AEr=ee(),gMe=Cae(),yMe=Pae(),bMe=eMe(),_Me=Rae(),vMe=f9(),wMe=Aae();co.ConversationHistoryObject={ConversationHistory:"conversation.history"};co.ConversationHistoryObject$inboundSchema=ox.nativeEnum(co.ConversationHistoryObject);co.ConversationHistoryObject$outboundSchema=co.ConversationHistoryObject$inboundSchema;var EEr;(function(t){t.inboundSchema=co.ConversationHistoryObject$inboundSchema,t.outboundSchema=co.ConversationHistoryObject$outboundSchema})(EEr||(co.ConversationHistoryObject$=EEr={}));co.Entries$inboundSchema=ox.union([gMe.AgentHandoffEntry$inboundSchema,yMe.FunctionCallEntry$inboundSchema,_Me.MessageInputEntry$inboundSchema,bMe.FunctionResultEntry$inboundSchema,wMe.ToolExecutionEntry$inboundSchema,vMe.MessageOutputEntry$inboundSchema]);co.Entries$outboundSchema=ox.union([gMe.AgentHandoffEntry$outboundSchema,yMe.FunctionCallEntry$outboundSchema,_Me.MessageInputEntry$outboundSchema,bMe.FunctionResultEntry$outboundSchema,wMe.ToolExecutionEntry$outboundSchema,vMe.MessageOutputEntry$outboundSchema]);var PEr;(function(t){t.inboundSchema=co.Entries$inboundSchema,t.outboundSchema=co.Entries$outboundSchema})(PEr||(co.Entries$=PEr={}));function Gxo(t){return JSON.stringify(co.Entries$outboundSchema.parse(t))}function Zxo(t){return(0,AEr.safeParse)(t,e=>co.Entries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Entries' from JSON")}co.ConversationHistory$inboundSchema=ox.object({object:co.ConversationHistoryObject$inboundSchema.default("conversation.history"),conversation_id:ox.string(),entries:ox.array(ox.union([gMe.AgentHandoffEntry$inboundSchema,yMe.FunctionCallEntry$inboundSchema,_Me.MessageInputEntry$inboundSchema,bMe.FunctionResultEntry$inboundSchema,wMe.ToolExecutionEntry$inboundSchema,vMe.MessageOutputEntry$inboundSchema]))}).transform(t=>(0,REr.remap)(t,{conversation_id:"conversationId"}));co.ConversationHistory$outboundSchema=ox.object({object:co.ConversationHistoryObject$outboundSchema.default("conversation.history"),conversationId:ox.string(),entries:ox.array(ox.union([gMe.AgentHandoffEntry$outboundSchema,yMe.FunctionCallEntry$outboundSchema,_Me.MessageInputEntry$outboundSchema,bMe.FunctionResultEntry$outboundSchema,wMe.ToolExecutionEntry$outboundSchema,vMe.MessageOutputEntry$outboundSchema]))}).transform(t=>(0,REr.remap)(t,{conversationId:"conversation_id"}));var MEr;(function(t){t.inboundSchema=co.ConversationHistory$inboundSchema,t.outboundSchema=co.ConversationHistory$outboundSchema})(MEr||(co.ConversationHistory$=MEr={}));function Xxo(t){return JSON.stringify(co.ConversationHistory$outboundSchema.parse(t))}function Yxo(t){return(0,AEr.safeParse)(t,e=>co.ConversationHistory$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationHistory' from JSON")}});var Qst=S(Rf=>{"use strict";var Qxo=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]}),eOo=Rf&&Rf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tOo=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"&&Qxo(r,e,n[o]);return eOo(r,e),r}}();Object.defineProperty(Rf,"__esModule",{value:!0});Rf.MessageEntries$=Rf.MessageEntries$outboundSchema=Rf.MessageEntries$inboundSchema=void 0;Rf.messageEntriesToJSON=nOo;Rf.messageEntriesFromJSON=oOo;var jEr=tOo(te()),rOo=ee(),DEr=Rae(),$Er=f9();Rf.MessageEntries$inboundSchema=jEr.union([DEr.MessageInputEntry$inboundSchema,$Er.MessageOutputEntry$inboundSchema]);Rf.MessageEntries$outboundSchema=jEr.union([DEr.MessageInputEntry$outboundSchema,$Er.MessageOutputEntry$outboundSchema]);var NEr;(function(t){t.inboundSchema=Rf.MessageEntries$inboundSchema,t.outboundSchema=Rf.MessageEntries$outboundSchema})(NEr||(Rf.MessageEntries$=NEr={}));function nOo(t){return JSON.stringify(Rf.MessageEntries$outboundSchema.parse(t))}function oOo(t){return(0,rOo.safeParse)(t,e=>Rf.MessageEntries$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'MessageEntries' from JSON")}});var BEr=S(Ra=>{"use strict";var iOo=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]}),aOo=Ra&&Ra.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sOo=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"&&iOo(r,e,n[o]);return aOo(r,e),r}}();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.ConversationMessages$=Ra.ConversationMessages$outboundSchema=Ra.ConversationMessages$inboundSchema=Ra.ConversationMessagesObject$=Ra.ConversationMessagesObject$outboundSchema=Ra.ConversationMessagesObject$inboundSchema=Ra.ConversationMessagesObject=void 0;Ra.conversationMessagesToJSON=lOo;Ra.conversationMessagesFromJSON=cOo;var xV=sOo(te()),kEr=ae(),uOo=ee(),qEr=Qst();Ra.ConversationMessagesObject={ConversationMessages:"conversation.messages"};Ra.ConversationMessagesObject$inboundSchema=xV.nativeEnum(Ra.ConversationMessagesObject);Ra.ConversationMessagesObject$outboundSchema=Ra.ConversationMessagesObject$inboundSchema;var LEr;(function(t){t.inboundSchema=Ra.ConversationMessagesObject$inboundSchema,t.outboundSchema=Ra.ConversationMessagesObject$outboundSchema})(LEr||(Ra.ConversationMessagesObject$=LEr={}));Ra.ConversationMessages$inboundSchema=xV.object({object:Ra.ConversationMessagesObject$inboundSchema.default("conversation.messages"),conversation_id:xV.string(),messages:xV.array(qEr.MessageEntries$inboundSchema)}).transform(t=>(0,kEr.remap)(t,{conversation_id:"conversationId"}));Ra.ConversationMessages$outboundSchema=xV.object({object:Ra.ConversationMessagesObject$outboundSchema.default("conversation.messages"),conversationId:xV.string(),messages:xV.array(qEr.MessageEntries$outboundSchema)}).transform(t=>(0,kEr.remap)(t,{conversationId:"conversation_id"}));var FEr;(function(t){t.inboundSchema=Ra.ConversationMessages$inboundSchema,t.outboundSchema=Ra.ConversationMessages$outboundSchema})(FEr||(Ra.ConversationMessages$=FEr={}));function lOo(t){return JSON.stringify(Ra.ConversationMessages$outboundSchema.parse(t))}function cOo(t){return(0,uOo.safeParse)(t,e=>Ra.ConversationMessages$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationMessages' from JSON")}});var GEr=S(fo=>{"use strict";var dOo=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]}),fOo=fo&&fo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pOo=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"&&dOo(r,e,n[o]);return fOo(r,e),r}}();Object.defineProperty(fo,"__esModule",{value:!0});fo.ConversationRequest$=fo.ConversationRequest$outboundSchema=fo.ConversationRequest$inboundSchema=fo.Tools$=fo.Tools$outboundSchema=fo.Tools$inboundSchema=fo.HandoffExecution$=fo.HandoffExecution$outboundSchema=fo.HandoffExecution$inboundSchema=fo.HandoffExecution=void 0;fo.toolsToJSON=mOo;fo.toolsFromJSON=hOo;fo.conversationRequestToJSON=gOo;fo.conversationRequestFromJSON=yOo;var ut=pOo(te()),VEr=ae(),JEr=ee(),SMe=rq(),KEr=HS(),WEr=hq(),CMe=iq(),xMe=aq(),OMe=sq(),TMe=uq(),EMe=lq();fo.HandoffExecution={Client:"client",Server:"server"};fo.HandoffExecution$inboundSchema=ut.nativeEnum(fo.HandoffExecution);fo.HandoffExecution$outboundSchema=fo.HandoffExecution$inboundSchema;var UEr;(function(t){t.inboundSchema=fo.HandoffExecution$inboundSchema,t.outboundSchema=fo.HandoffExecution$outboundSchema})(UEr||(fo.HandoffExecution$=UEr={}));fo.Tools$inboundSchema=ut.union([CMe.DocumentLibraryTool$inboundSchema.and(ut.object({type:ut.literal("document_library")}).transform(t=>({type:t.type}))),xMe.FunctionTool$inboundSchema.and(ut.object({type:ut.literal("function")}).transform(t=>({type:t.type}))),SMe.CodeInterpreterTool$inboundSchema.and(ut.object({type:ut.literal("code_interpreter")}).transform(t=>({type:t.type}))),OMe.ImageGenerationTool$inboundSchema.and(ut.object({type:ut.literal("image_generation")}).transform(t=>({type:t.type}))),EMe.WebSearchTool$inboundSchema.and(ut.object({type:ut.literal("web_search")}).transform(t=>({type:t.type}))),TMe.WebSearchPremiumTool$inboundSchema.and(ut.object({type:ut.literal("web_search_premium")}).transform(t=>({type:t.type})))]);fo.Tools$outboundSchema=ut.union([CMe.DocumentLibraryTool$outboundSchema.and(ut.object({type:ut.literal("document_library")}).transform(t=>({type:t.type}))),xMe.FunctionTool$outboundSchema.and(ut.object({type:ut.literal("function")}).transform(t=>({type:t.type}))),SMe.CodeInterpreterTool$outboundSchema.and(ut.object({type:ut.literal("code_interpreter")}).transform(t=>({type:t.type}))),OMe.ImageGenerationTool$outboundSchema.and(ut.object({type:ut.literal("image_generation")}).transform(t=>({type:t.type}))),EMe.WebSearchTool$outboundSchema.and(ut.object({type:ut.literal("web_search")}).transform(t=>({type:t.type}))),TMe.WebSearchPremiumTool$outboundSchema.and(ut.object({type:ut.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var zEr;(function(t){t.inboundSchema=fo.Tools$inboundSchema,t.outboundSchema=fo.Tools$outboundSchema})(zEr||(fo.Tools$=zEr={}));function mOo(t){return JSON.stringify(fo.Tools$outboundSchema.parse(t))}function hOo(t){return(0,JEr.safeParse)(t,e=>fo.Tools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Tools' from JSON")}fo.ConversationRequest$inboundSchema=ut.object({inputs:WEr.ConversationInputs$inboundSchema,stream:ut.boolean().default(!1),store:ut.nullable(ut.boolean()).optional(),handoff_execution:ut.nullable(fo.HandoffExecution$inboundSchema).optional(),instructions:ut.nullable(ut.string()).optional(),tools:ut.nullable(ut.array(ut.union([CMe.DocumentLibraryTool$inboundSchema.and(ut.object({type:ut.literal("document_library")}).transform(t=>({type:t.type}))),xMe.FunctionTool$inboundSchema.and(ut.object({type:ut.literal("function")}).transform(t=>({type:t.type}))),SMe.CodeInterpreterTool$inboundSchema.and(ut.object({type:ut.literal("code_interpreter")}).transform(t=>({type:t.type}))),OMe.ImageGenerationTool$inboundSchema.and(ut.object({type:ut.literal("image_generation")}).transform(t=>({type:t.type}))),EMe.WebSearchTool$inboundSchema.and(ut.object({type:ut.literal("web_search")}).transform(t=>({type:t.type}))),TMe.WebSearchPremiumTool$inboundSchema.and(ut.object({type:ut.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completion_args:ut.nullable(KEr.CompletionArgs$inboundSchema).optional(),name:ut.nullable(ut.string()).optional(),description:ut.nullable(ut.string()).optional(),agent_id:ut.nullable(ut.string()).optional(),model:ut.nullable(ut.string()).optional()}).transform(t=>(0,VEr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",agent_id:"agentId"}));fo.ConversationRequest$outboundSchema=ut.object({inputs:WEr.ConversationInputs$outboundSchema,stream:ut.boolean().default(!1),store:ut.nullable(ut.boolean()).optional(),handoffExecution:ut.nullable(fo.HandoffExecution$outboundSchema).optional(),instructions:ut.nullable(ut.string()).optional(),tools:ut.nullable(ut.array(ut.union([CMe.DocumentLibraryTool$outboundSchema.and(ut.object({type:ut.literal("document_library")}).transform(t=>({type:t.type}))),xMe.FunctionTool$outboundSchema.and(ut.object({type:ut.literal("function")}).transform(t=>({type:t.type}))),SMe.CodeInterpreterTool$outboundSchema.and(ut.object({type:ut.literal("code_interpreter")}).transform(t=>({type:t.type}))),OMe.ImageGenerationTool$outboundSchema.and(ut.object({type:ut.literal("image_generation")}).transform(t=>({type:t.type}))),EMe.WebSearchTool$outboundSchema.and(ut.object({type:ut.literal("web_search")}).transform(t=>({type:t.type}))),TMe.WebSearchPremiumTool$outboundSchema.and(ut.object({type:ut.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completionArgs:ut.nullable(KEr.CompletionArgs$outboundSchema).optional(),name:ut.nullable(ut.string()).optional(),description:ut.nullable(ut.string()).optional(),agentId:ut.nullable(ut.string()).optional(),model:ut.nullable(ut.string()).optional()}).transform(t=>(0,VEr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",agentId:"agent_id"}));var HEr;(function(t){t.inboundSchema=fo.ConversationRequest$inboundSchema,t.outboundSchema=fo.ConversationRequest$outboundSchema})(HEr||(fo.ConversationRequest$=HEr={}));function gOo(t){return JSON.stringify(fo.ConversationRequest$outboundSchema.parse(t))}function yOo(t){return(0,JEr.safeParse)(t,e=>fo.ConversationRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRequest' from JSON")}});var rPr=S(po=>{"use strict";var bOo=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]}),_Oo=po&&po.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vOo=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"&&bOo(r,e,n[o]);return _Oo(r,e),r}}();Object.defineProperty(po,"__esModule",{value:!0});po.ConversationResponse$=po.ConversationResponse$outboundSchema=po.ConversationResponse$inboundSchema=po.Outputs$=po.Outputs$outboundSchema=po.Outputs$inboundSchema=po.ConversationResponseObject$=po.ConversationResponseObject$outboundSchema=po.ConversationResponseObject$inboundSchema=po.ConversationResponseObject=void 0;po.outputsToJSON=wOo;po.outputsFromJSON=SOo;po.conversationResponseToJSON=COo;po.conversationResponseFromJSON=xOo;var ix=vOo(te()),QEr=ae(),ePr=ee(),PMe=Cae(),tPr=iMe(),MMe=Pae(),RMe=f9(),AMe=Aae();po.ConversationResponseObject={ConversationResponse:"conversation.response"};po.ConversationResponseObject$inboundSchema=ix.nativeEnum(po.ConversationResponseObject);po.ConversationResponseObject$outboundSchema=po.ConversationResponseObject$inboundSchema;var ZEr;(function(t){t.inboundSchema=po.ConversationResponseObject$inboundSchema,t.outboundSchema=po.ConversationResponseObject$outboundSchema})(ZEr||(po.ConversationResponseObject$=ZEr={}));po.Outputs$inboundSchema=ix.union([PMe.AgentHandoffEntry$inboundSchema,MMe.FunctionCallEntry$inboundSchema,AMe.ToolExecutionEntry$inboundSchema,RMe.MessageOutputEntry$inboundSchema]);po.Outputs$outboundSchema=ix.union([PMe.AgentHandoffEntry$outboundSchema,MMe.FunctionCallEntry$outboundSchema,AMe.ToolExecutionEntry$outboundSchema,RMe.MessageOutputEntry$outboundSchema]);var XEr;(function(t){t.inboundSchema=po.Outputs$inboundSchema,t.outboundSchema=po.Outputs$outboundSchema})(XEr||(po.Outputs$=XEr={}));function wOo(t){return JSON.stringify(po.Outputs$outboundSchema.parse(t))}function SOo(t){return(0,ePr.safeParse)(t,e=>po.Outputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Outputs' from JSON")}po.ConversationResponse$inboundSchema=ix.object({object:po.ConversationResponseObject$inboundSchema.default("conversation.response"),conversation_id:ix.string(),outputs:ix.array(ix.union([PMe.AgentHandoffEntry$inboundSchema,MMe.FunctionCallEntry$inboundSchema,AMe.ToolExecutionEntry$inboundSchema,RMe.MessageOutputEntry$inboundSchema])),usage:tPr.ConversationUsageInfo$inboundSchema}).transform(t=>(0,QEr.remap)(t,{conversation_id:"conversationId"}));po.ConversationResponse$outboundSchema=ix.object({object:po.ConversationResponseObject$outboundSchema.default("conversation.response"),conversationId:ix.string(),outputs:ix.array(ix.union([PMe.AgentHandoffEntry$outboundSchema,MMe.FunctionCallEntry$outboundSchema,AMe.ToolExecutionEntry$outboundSchema,RMe.MessageOutputEntry$outboundSchema])),usage:tPr.ConversationUsageInfo$outboundSchema}).transform(t=>(0,QEr.remap)(t,{conversationId:"conversation_id"}));var YEr;(function(t){t.inboundSchema=po.ConversationResponse$inboundSchema,t.outboundSchema=po.ConversationResponse$outboundSchema})(YEr||(po.ConversationResponse$=YEr={}));function COo(t){return JSON.stringify(po.ConversationResponse$outboundSchema.parse(t))}function xOo(t){return(0,ePr.safeParse)(t,e=>po.ConversationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationResponse' from JSON")}});var uPr=S(Aa=>{"use strict";var OOo=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]}),TOo=Aa&&Aa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EOo=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"&&OOo(r,e,n[o]);return TOo(r,e),r}}();Object.defineProperty(Aa,"__esModule",{value:!0});Aa.ConversationRestartRequest$=Aa.ConversationRestartRequest$outboundSchema=Aa.ConversationRestartRequest$inboundSchema=Aa.ConversationRestartRequestHandoffExecution$=Aa.ConversationRestartRequestHandoffExecution$outboundSchema=Aa.ConversationRestartRequestHandoffExecution$inboundSchema=Aa.ConversationRestartRequestHandoffExecution=void 0;Aa.conversationRestartRequestToJSON=MOo;Aa.conversationRestartRequestFromJSON=ROo;var bj=EOo(te()),iPr=ae(),POo=ee(),aPr=HS(),sPr=hq();Aa.ConversationRestartRequestHandoffExecution={Client:"client",Server:"server"};Aa.ConversationRestartRequestHandoffExecution$inboundSchema=bj.nativeEnum(Aa.ConversationRestartRequestHandoffExecution);Aa.ConversationRestartRequestHandoffExecution$outboundSchema=Aa.ConversationRestartRequestHandoffExecution$inboundSchema;var nPr;(function(t){t.inboundSchema=Aa.ConversationRestartRequestHandoffExecution$inboundSchema,t.outboundSchema=Aa.ConversationRestartRequestHandoffExecution$outboundSchema})(nPr||(Aa.ConversationRestartRequestHandoffExecution$=nPr={}));Aa.ConversationRestartRequest$inboundSchema=bj.object({inputs:sPr.ConversationInputs$inboundSchema,stream:bj.boolean().default(!1),store:bj.boolean().default(!0),handoff_execution:Aa.ConversationRestartRequestHandoffExecution$inboundSchema.default("server"),completion_args:aPr.CompletionArgs$inboundSchema.optional(),from_entry_id:bj.string()}).transform(t=>(0,iPr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",from_entry_id:"fromEntryId"}));Aa.ConversationRestartRequest$outboundSchema=bj.object({inputs:sPr.ConversationInputs$outboundSchema,stream:bj.boolean().default(!1),store:bj.boolean().default(!0),handoffExecution:Aa.ConversationRestartRequestHandoffExecution$outboundSchema.default("server"),completionArgs:aPr.CompletionArgs$outboundSchema.optional(),fromEntryId:bj.string()}).transform(t=>(0,iPr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",fromEntryId:"from_entry_id"}));var oPr;(function(t){t.inboundSchema=Aa.ConversationRestartRequest$inboundSchema,t.outboundSchema=Aa.ConversationRestartRequest$outboundSchema})(oPr||(Aa.ConversationRestartRequest$=oPr={}));function MOo(t){return JSON.stringify(Aa.ConversationRestartRequest$outboundSchema.parse(t))}function ROo(t){return(0,POo.safeParse)(t,e=>Aa.ConversationRestartRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRestartRequest' from JSON")}});var mPr=S(Ia=>{"use strict";var AOo=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]}),IOo=Ia&&Ia.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NOo=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"&&AOo(r,e,n[o]);return IOo(r,e),r}}();Object.defineProperty(Ia,"__esModule",{value:!0});Ia.ConversationRestartStreamRequest$=Ia.ConversationRestartStreamRequest$outboundSchema=Ia.ConversationRestartStreamRequest$inboundSchema=Ia.ConversationRestartStreamRequestHandoffExecution$=Ia.ConversationRestartStreamRequestHandoffExecution$outboundSchema=Ia.ConversationRestartStreamRequestHandoffExecution$inboundSchema=Ia.ConversationRestartStreamRequestHandoffExecution=void 0;Ia.conversationRestartStreamRequestToJSON=DOo;Ia.conversationRestartStreamRequestFromJSON=$Oo;var _j=NOo(te()),dPr=ae(),jOo=ee(),fPr=HS(),pPr=hq();Ia.ConversationRestartStreamRequestHandoffExecution={Client:"client",Server:"server"};Ia.ConversationRestartStreamRequestHandoffExecution$inboundSchema=_j.nativeEnum(Ia.ConversationRestartStreamRequestHandoffExecution);Ia.ConversationRestartStreamRequestHandoffExecution$outboundSchema=Ia.ConversationRestartStreamRequestHandoffExecution$inboundSchema;var lPr;(function(t){t.inboundSchema=Ia.ConversationRestartStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=Ia.ConversationRestartStreamRequestHandoffExecution$outboundSchema})(lPr||(Ia.ConversationRestartStreamRequestHandoffExecution$=lPr={}));Ia.ConversationRestartStreamRequest$inboundSchema=_j.object({inputs:pPr.ConversationInputs$inboundSchema,stream:_j.boolean().default(!0),store:_j.boolean().default(!0),handoff_execution:Ia.ConversationRestartStreamRequestHandoffExecution$inboundSchema.default("server"),completion_args:fPr.CompletionArgs$inboundSchema.optional(),from_entry_id:_j.string()}).transform(t=>(0,dPr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",from_entry_id:"fromEntryId"}));Ia.ConversationRestartStreamRequest$outboundSchema=_j.object({inputs:pPr.ConversationInputs$outboundSchema,stream:_j.boolean().default(!0),store:_j.boolean().default(!0),handoffExecution:Ia.ConversationRestartStreamRequestHandoffExecution$outboundSchema.default("server"),completionArgs:fPr.CompletionArgs$outboundSchema.optional(),fromEntryId:_j.string()}).transform(t=>(0,dPr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",fromEntryId:"from_entry_id"}));var cPr;(function(t){t.inboundSchema=Ia.ConversationRestartStreamRequest$inboundSchema,t.outboundSchema=Ia.ConversationRestartStreamRequest$outboundSchema})(cPr||(Ia.ConversationRestartStreamRequest$=cPr={}));function DOo(t){return JSON.stringify(Ia.ConversationRestartStreamRequest$outboundSchema.parse(t))}function $Oo(t){return(0,jOo.safeParse)(t,e=>Ia.ConversationRestartStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationRestartStreamRequest' from JSON")}});var SPr=S(mo=>{"use strict";var LOo=mo&&mo.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),FOo=mo&&mo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kOo=mo&&mo.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&LOo(r,e,n[o]);return FOo(r,e),r}}();Object.defineProperty(mo,"__esModule",{value:!0});mo.ConversationStreamRequest$=mo.ConversationStreamRequest$outboundSchema=mo.ConversationStreamRequest$inboundSchema=mo.ConversationStreamRequestTools$=mo.ConversationStreamRequestTools$outboundSchema=mo.ConversationStreamRequestTools$inboundSchema=mo.ConversationStreamRequestHandoffExecution$=mo.ConversationStreamRequestHandoffExecution$outboundSchema=mo.ConversationStreamRequestHandoffExecution$inboundSchema=mo.ConversationStreamRequestHandoffExecution=void 0;mo.conversationStreamRequestToolsToJSON=qOo;mo.conversationStreamRequestToolsFromJSON=BOo;mo.conversationStreamRequestToJSON=UOo;mo.conversationStreamRequestFromJSON=zOo;var lt=kOo(te()),bPr=ae(),_Pr=ee(),IMe=rq(),vPr=HS(),wPr=hq(),NMe=iq(),jMe=aq(),DMe=sq(),$Me=uq(),LMe=lq();mo.ConversationStreamRequestHandoffExecution={Client:"client",Server:"server"};mo.ConversationStreamRequestHandoffExecution$inboundSchema=lt.nativeEnum(mo.ConversationStreamRequestHandoffExecution);mo.ConversationStreamRequestHandoffExecution$outboundSchema=mo.ConversationStreamRequestHandoffExecution$inboundSchema;var hPr;(function(t){t.inboundSchema=mo.ConversationStreamRequestHandoffExecution$inboundSchema,t.outboundSchema=mo.ConversationStreamRequestHandoffExecution$outboundSchema})(hPr||(mo.ConversationStreamRequestHandoffExecution$=hPr={}));mo.ConversationStreamRequestTools$inboundSchema=lt.union([NMe.DocumentLibraryTool$inboundSchema.and(lt.object({type:lt.literal("document_library")}).transform(t=>({type:t.type}))),jMe.FunctionTool$inboundSchema.and(lt.object({type:lt.literal("function")}).transform(t=>({type:t.type}))),IMe.CodeInterpreterTool$inboundSchema.and(lt.object({type:lt.literal("code_interpreter")}).transform(t=>({type:t.type}))),DMe.ImageGenerationTool$inboundSchema.and(lt.object({type:lt.literal("image_generation")}).transform(t=>({type:t.type}))),LMe.WebSearchTool$inboundSchema.and(lt.object({type:lt.literal("web_search")}).transform(t=>({type:t.type}))),$Me.WebSearchPremiumTool$inboundSchema.and(lt.object({type:lt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);mo.ConversationStreamRequestTools$outboundSchema=lt.union([NMe.DocumentLibraryTool$outboundSchema.and(lt.object({type:lt.literal("document_library")}).transform(t=>({type:t.type}))),jMe.FunctionTool$outboundSchema.and(lt.object({type:lt.literal("function")}).transform(t=>({type:t.type}))),IMe.CodeInterpreterTool$outboundSchema.and(lt.object({type:lt.literal("code_interpreter")}).transform(t=>({type:t.type}))),DMe.ImageGenerationTool$outboundSchema.and(lt.object({type:lt.literal("image_generation")}).transform(t=>({type:t.type}))),LMe.WebSearchTool$outboundSchema.and(lt.object({type:lt.literal("web_search")}).transform(t=>({type:t.type}))),$Me.WebSearchPremiumTool$outboundSchema.and(lt.object({type:lt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var gPr;(function(t){t.inboundSchema=mo.ConversationStreamRequestTools$inboundSchema,t.outboundSchema=mo.ConversationStreamRequestTools$outboundSchema})(gPr||(mo.ConversationStreamRequestTools$=gPr={}));function qOo(t){return JSON.stringify(mo.ConversationStreamRequestTools$outboundSchema.parse(t))}function BOo(t){return(0,_Pr.safeParse)(t,e=>mo.ConversationStreamRequestTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationStreamRequestTools' from JSON")}mo.ConversationStreamRequest$inboundSchema=lt.object({inputs:wPr.ConversationInputs$inboundSchema,stream:lt.boolean().default(!0),store:lt.nullable(lt.boolean()).optional(),handoff_execution:lt.nullable(mo.ConversationStreamRequestHandoffExecution$inboundSchema).optional(),instructions:lt.nullable(lt.string()).optional(),tools:lt.nullable(lt.array(lt.union([NMe.DocumentLibraryTool$inboundSchema.and(lt.object({type:lt.literal("document_library")}).transform(t=>({type:t.type}))),jMe.FunctionTool$inboundSchema.and(lt.object({type:lt.literal("function")}).transform(t=>({type:t.type}))),IMe.CodeInterpreterTool$inboundSchema.and(lt.object({type:lt.literal("code_interpreter")}).transform(t=>({type:t.type}))),DMe.ImageGenerationTool$inboundSchema.and(lt.object({type:lt.literal("image_generation")}).transform(t=>({type:t.type}))),LMe.WebSearchTool$inboundSchema.and(lt.object({type:lt.literal("web_search")}).transform(t=>({type:t.type}))),$Me.WebSearchPremiumTool$inboundSchema.and(lt.object({type:lt.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completion_args:lt.nullable(vPr.CompletionArgs$inboundSchema).optional(),name:lt.nullable(lt.string()).optional(),description:lt.nullable(lt.string()).optional(),agent_id:lt.nullable(lt.string()).optional(),model:lt.nullable(lt.string()).optional()}).transform(t=>(0,bPr.remap)(t,{handoff_execution:"handoffExecution",completion_args:"completionArgs",agent_id:"agentId"}));mo.ConversationStreamRequest$outboundSchema=lt.object({inputs:wPr.ConversationInputs$outboundSchema,stream:lt.boolean().default(!0),store:lt.nullable(lt.boolean()).optional(),handoffExecution:lt.nullable(mo.ConversationStreamRequestHandoffExecution$outboundSchema).optional(),instructions:lt.nullable(lt.string()).optional(),tools:lt.nullable(lt.array(lt.union([NMe.DocumentLibraryTool$outboundSchema.and(lt.object({type:lt.literal("document_library")}).transform(t=>({type:t.type}))),jMe.FunctionTool$outboundSchema.and(lt.object({type:lt.literal("function")}).transform(t=>({type:t.type}))),IMe.CodeInterpreterTool$outboundSchema.and(lt.object({type:lt.literal("code_interpreter")}).transform(t=>({type:t.type}))),DMe.ImageGenerationTool$outboundSchema.and(lt.object({type:lt.literal("image_generation")}).transform(t=>({type:t.type}))),LMe.WebSearchTool$outboundSchema.and(lt.object({type:lt.literal("web_search")}).transform(t=>({type:t.type}))),$Me.WebSearchPremiumTool$outboundSchema.and(lt.object({type:lt.literal("web_search_premium")}).transform(t=>({type:t.type})))]))).optional(),completionArgs:lt.nullable(vPr.CompletionArgs$outboundSchema).optional(),name:lt.nullable(lt.string()).optional(),description:lt.nullable(lt.string()).optional(),agentId:lt.nullable(lt.string()).optional(),model:lt.nullable(lt.string()).optional()}).transform(t=>(0,bPr.remap)(t,{handoffExecution:"handoff_execution",completionArgs:"completion_args",agentId:"agent_id"}));var yPr;(function(t){t.inboundSchema=mo.ConversationStreamRequest$inboundSchema,t.outboundSchema=mo.ConversationStreamRequest$outboundSchema})(yPr||(mo.ConversationStreamRequest$=yPr={}));function UOo(t){return JSON.stringify(mo.ConversationStreamRequest$outboundSchema.parse(t))}function zOo(t){return(0,_Pr.safeParse)(t,e=>mo.ConversationStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ConversationStreamRequest' from JSON")}});var xPr=S(Af=>{"use strict";var HOo=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]}),VOo=Af&&Af.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),JOo=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"&&HOo(r,e,n[o]);return VOo(r,e),r}}();Object.defineProperty(Af,"__esModule",{value:!0});Af.DeleteFileOut$=Af.DeleteFileOut$outboundSchema=Af.DeleteFileOut$inboundSchema=void 0;Af.deleteFileOutToJSON=WOo;Af.deleteFileOutFromJSON=GOo;var gq=JOo(te()),KOo=ee();Af.DeleteFileOut$inboundSchema=gq.object({id:gq.string(),object:gq.string(),deleted:gq.boolean()});Af.DeleteFileOut$outboundSchema=gq.object({id:gq.string(),object:gq.string(),deleted:gq.boolean()});var CPr;(function(t){t.inboundSchema=Af.DeleteFileOut$inboundSchema,t.outboundSchema=Af.DeleteFileOut$outboundSchema})(CPr||(Af.DeleteFileOut$=CPr={}));function WOo(t){return JSON.stringify(Af.DeleteFileOut$outboundSchema.parse(t))}function GOo(t){return(0,KOo.safeParse)(t,e=>Af.DeleteFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteFileOut' from JSON")}});var TPr=S(If=>{"use strict";var ZOo=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]}),XOo=If&&If.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YOo=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"&&ZOo(r,e,n[o]);return XOo(r,e),r}}();Object.defineProperty(If,"__esModule",{value:!0});If.DeleteModelOut$=If.DeleteModelOut$outboundSchema=If.DeleteModelOut$inboundSchema=void 0;If.deleteModelOutToJSON=eTo;If.deleteModelOutFromJSON=tTo;var yq=YOo(te()),QOo=ee();If.DeleteModelOut$inboundSchema=yq.object({id:yq.string(),object:yq.string().default("model"),deleted:yq.boolean().default(!0)});If.DeleteModelOut$outboundSchema=yq.object({id:yq.string(),object:yq.string().default("model"),deleted:yq.boolean().default(!0)});var OPr;(function(t){t.inboundSchema=If.DeleteModelOut$inboundSchema,t.outboundSchema=If.DeleteModelOut$outboundSchema})(OPr||(If.DeleteModelOut$=OPr={}));function eTo(t){return JSON.stringify(If.DeleteModelOut$outboundSchema.parse(t))}function tTo(t){return(0,QOo.safeParse)(t,e=>If.DeleteModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelOut' from JSON")}});var eut=S(Nf=>{"use strict";var rTo=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]}),nTo=Nf&&Nf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oTo=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"&&rTo(r,e,n[o]);return nTo(r,e),r}}();Object.defineProperty(Nf,"__esModule",{value:!0});Nf.DocumentOut$=Nf.DocumentOut$outboundSchema=Nf.DocumentOut$inboundSchema=void 0;Nf.documentOutToJSON=aTo;Nf.documentOutFromJSON=sTo;var ho=oTo(te()),PPr=ae(),iTo=ee();Nf.DocumentOut$inboundSchema=ho.object({id:ho.string(),library_id:ho.string(),hash:ho.string(),mime_type:ho.string(),extension:ho.string(),size:ho.number().int(),name:ho.string(),summary:ho.nullable(ho.string()).optional(),created_at:ho.string().datetime({offset:!0}).transform(t=>new Date(t)),last_processed_at:ho.nullable(ho.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),number_of_pages:ho.nullable(ho.number().int()).optional(),processing_status:ho.string(),uploaded_by_id:ho.string(),uploaded_by_type:ho.string(),tokens_processing_main_content:ho.nullable(ho.number().int()).optional(),tokens_processing_summary:ho.nullable(ho.number().int()).optional(),tokens_processing_total:ho.number().int()}).transform(t=>(0,PPr.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"}));Nf.DocumentOut$outboundSchema=ho.object({id:ho.string(),libraryId:ho.string(),hash:ho.string(),mimeType:ho.string(),extension:ho.string(),size:ho.number().int(),name:ho.string(),summary:ho.nullable(ho.string()).optional(),createdAt:ho.date().transform(t=>t.toISOString()),lastProcessedAt:ho.nullable(ho.date().transform(t=>t.toISOString())).optional(),numberOfPages:ho.nullable(ho.number().int()).optional(),processingStatus:ho.string(),uploadedById:ho.string(),uploadedByType:ho.string(),tokensProcessingMainContent:ho.nullable(ho.number().int()).optional(),tokensProcessingSummary:ho.nullable(ho.number().int()).optional(),tokensProcessingTotal:ho.number().int()}).transform(t=>(0,PPr.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 EPr;(function(t){t.inboundSchema=Nf.DocumentOut$inboundSchema,t.outboundSchema=Nf.DocumentOut$outboundSchema})(EPr||(Nf.DocumentOut$=EPr={}));function aTo(t){return JSON.stringify(Nf.DocumentOut$outboundSchema.parse(t))}function sTo(t){return(0,iTo.safeParse)(t,e=>Nf.DocumentOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentOut' from JSON")}});var RPr=S(jf=>{"use strict";var uTo=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]}),lTo=jf&&jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cTo=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"&&uTo(r,e,n[o]);return lTo(r,e),r}}();Object.defineProperty(jf,"__esModule",{value:!0});jf.DocumentTextContent$=jf.DocumentTextContent$outboundSchema=jf.DocumentTextContent$inboundSchema=void 0;jf.documentTextContentToJSON=fTo;jf.documentTextContentFromJSON=pTo;var FMe=cTo(te()),dTo=ee();jf.DocumentTextContent$inboundSchema=FMe.object({text:FMe.string()});jf.DocumentTextContent$outboundSchema=FMe.object({text:FMe.string()});var MPr;(function(t){t.inboundSchema=jf.DocumentTextContent$inboundSchema,t.outboundSchema=jf.DocumentTextContent$outboundSchema})(MPr||(jf.DocumentTextContent$=MPr={}));function fTo(t){return JSON.stringify(jf.DocumentTextContent$outboundSchema.parse(t))}function pTo(t){return(0,dTo.safeParse)(t,e=>jf.DocumentTextContent$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentTextContent' from JSON")}});var IPr=S(Df=>{"use strict";var mTo=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]}),hTo=Df&&Df.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gTo=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"&&mTo(r,e,n[o]);return hTo(r,e),r}}();Object.defineProperty(Df,"__esModule",{value:!0});Df.DocumentUpdateIn$=Df.DocumentUpdateIn$outboundSchema=Df.DocumentUpdateIn$inboundSchema=void 0;Df.documentUpdateInToJSON=bTo;Df.documentUpdateInFromJSON=_To;var m9=gTo(te()),yTo=ee();Df.DocumentUpdateIn$inboundSchema=m9.object({name:m9.nullable(m9.string()).optional()});Df.DocumentUpdateIn$outboundSchema=m9.object({name:m9.nullable(m9.string()).optional()});var APr;(function(t){t.inboundSchema=Df.DocumentUpdateIn$inboundSchema,t.outboundSchema=Df.DocumentUpdateIn$outboundSchema})(APr||(Df.DocumentUpdateIn$=APr={}));function bTo(t){return JSON.stringify(Df.DocumentUpdateIn$outboundSchema.parse(t))}function _To(t){return(0,yTo.safeParse)(t,e=>Df.DocumentUpdateIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DocumentUpdateIn' from JSON")}});var tut=S($f=>{"use strict";var vTo=$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]}),wTo=$f&&$f.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),STo=$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"&&vTo(r,e,n[o]);return wTo(r,e),r}}();Object.defineProperty($f,"__esModule",{value:!0});$f.EmbeddingDtype$=$f.EmbeddingDtype$outboundSchema=$f.EmbeddingDtype$inboundSchema=$f.EmbeddingDtype=void 0;var CTo=STo(te());$f.EmbeddingDtype={Float:"float",Int8:"int8",Uint8:"uint8",Binary:"binary",Ubinary:"ubinary"};$f.EmbeddingDtype$inboundSchema=CTo.nativeEnum($f.EmbeddingDtype);$f.EmbeddingDtype$outboundSchema=$f.EmbeddingDtype$inboundSchema;var NPr;(function(t){t.inboundSchema=$f.EmbeddingDtype$inboundSchema,t.outboundSchema=$f.EmbeddingDtype$outboundSchema})(NPr||($f.EmbeddingDtype$=NPr={}))});var rut=S(Lf=>{"use strict";var xTo=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]}),OTo=Lf&&Lf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TTo=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"&&xTo(r,e,n[o]);return OTo(r,e),r}}();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.EncodingFormat$=Lf.EncodingFormat$outboundSchema=Lf.EncodingFormat$inboundSchema=Lf.EncodingFormat=void 0;var ETo=TTo(te());Lf.EncodingFormat={Float:"float",Base64:"base64"};Lf.EncodingFormat$inboundSchema=ETo.nativeEnum(Lf.EncodingFormat);Lf.EncodingFormat$outboundSchema=Lf.EncodingFormat$inboundSchema;var jPr;(function(t){t.inboundSchema=Lf.EncodingFormat$inboundSchema,t.outboundSchema=Lf.EncodingFormat$outboundSchema})(jPr||(Lf.EncodingFormat$=jPr={}))});var BPr=S(ms=>{"use strict";var PTo=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]}),MTo=ms&&ms.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RTo=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"&&PTo(r,e,n[o]);return MTo(r,e),r}}();Object.defineProperty(ms,"__esModule",{value:!0});ms.EmbeddingRequest$=ms.EmbeddingRequest$outboundSchema=ms.EmbeddingRequest$inboundSchema=ms.EmbeddingRequestInputs$=ms.EmbeddingRequestInputs$outboundSchema=ms.EmbeddingRequestInputs$inboundSchema=void 0;ms.embeddingRequestInputsToJSON=ATo;ms.embeddingRequestInputsFromJSON=ITo;ms.embeddingRequestToJSON=NTo;ms.embeddingRequestFromJSON=jTo;var Jl=RTo(te()),LPr=ae(),FPr=ee(),kPr=tut(),qPr=rut();ms.EmbeddingRequestInputs$inboundSchema=Jl.union([Jl.string(),Jl.array(Jl.string())]);ms.EmbeddingRequestInputs$outboundSchema=Jl.union([Jl.string(),Jl.array(Jl.string())]);var DPr;(function(t){t.inboundSchema=ms.EmbeddingRequestInputs$inboundSchema,t.outboundSchema=ms.EmbeddingRequestInputs$outboundSchema})(DPr||(ms.EmbeddingRequestInputs$=DPr={}));function ATo(t){return JSON.stringify(ms.EmbeddingRequestInputs$outboundSchema.parse(t))}function ITo(t){return(0,FPr.safeParse)(t,e=>ms.EmbeddingRequestInputs$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequestInputs' from JSON")}ms.EmbeddingRequest$inboundSchema=Jl.object({model:Jl.string(),input:Jl.union([Jl.string(),Jl.array(Jl.string())]),output_dimension:Jl.nullable(Jl.number().int()).optional(),output_dtype:kPr.EmbeddingDtype$inboundSchema.optional(),encoding_format:qPr.EncodingFormat$inboundSchema.optional()}).transform(t=>(0,LPr.remap)(t,{input:"inputs",output_dimension:"outputDimension",output_dtype:"outputDtype",encoding_format:"encodingFormat"}));ms.EmbeddingRequest$outboundSchema=Jl.object({model:Jl.string(),inputs:Jl.union([Jl.string(),Jl.array(Jl.string())]),outputDimension:Jl.nullable(Jl.number().int()).optional(),outputDtype:kPr.EmbeddingDtype$outboundSchema.optional(),encodingFormat:qPr.EncodingFormat$outboundSchema.optional()}).transform(t=>(0,LPr.remap)(t,{inputs:"input",outputDimension:"output_dimension",outputDtype:"output_dtype",encodingFormat:"encoding_format"}));var $Pr;(function(t){t.inboundSchema=ms.EmbeddingRequest$inboundSchema,t.outboundSchema=ms.EmbeddingRequest$outboundSchema})($Pr||(ms.EmbeddingRequest$=$Pr={}));function NTo(t){return JSON.stringify(ms.EmbeddingRequest$outboundSchema.parse(t))}function jTo(t){return(0,FPr.safeParse)(t,e=>ms.EmbeddingRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingRequest' from JSON")}});var nut=S(Ff=>{"use strict";var DTo=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]}),$To=Ff&&Ff.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LTo=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"&&DTo(r,e,n[o]);return $To(r,e),r}}();Object.defineProperty(Ff,"__esModule",{value:!0});Ff.EmbeddingResponseData$=Ff.EmbeddingResponseData$outboundSchema=Ff.EmbeddingResponseData$inboundSchema=void 0;Ff.embeddingResponseDataToJSON=kTo;Ff.embeddingResponseDataFromJSON=qTo;var KA=LTo(te()),FTo=ee();Ff.EmbeddingResponseData$inboundSchema=KA.object({object:KA.string().optional(),embedding:KA.array(KA.number()).optional(),index:KA.number().int().optional()});Ff.EmbeddingResponseData$outboundSchema=KA.object({object:KA.string().optional(),embedding:KA.array(KA.number()).optional(),index:KA.number().int().optional()});var UPr;(function(t){t.inboundSchema=Ff.EmbeddingResponseData$inboundSchema,t.outboundSchema=Ff.EmbeddingResponseData$outboundSchema})(UPr||(Ff.EmbeddingResponseData$=UPr={}));function kTo(t){return JSON.stringify(Ff.EmbeddingResponseData$outboundSchema.parse(t))}function qTo(t){return(0,FTo.safeParse)(t,e=>Ff.EmbeddingResponseData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponseData' from JSON")}});var JPr=S(kf=>{"use strict";var BTo=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]}),UTo=kf&&kf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zTo=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"&&BTo(r,e,n[o]);return UTo(r,e),r}}();Object.defineProperty(kf,"__esModule",{value:!0});kf.EmbeddingResponse$=kf.EmbeddingResponse$outboundSchema=kf.EmbeddingResponse$inboundSchema=void 0;kf.embeddingResponseToJSON=VTo;kf.embeddingResponseFromJSON=JTo;var WA=zTo(te()),HTo=ee(),HPr=nut(),VPr=pq();kf.EmbeddingResponse$inboundSchema=WA.object({id:WA.string(),object:WA.string(),model:WA.string(),usage:VPr.UsageInfo$inboundSchema,data:WA.array(HPr.EmbeddingResponseData$inboundSchema)});kf.EmbeddingResponse$outboundSchema=WA.object({id:WA.string(),object:WA.string(),model:WA.string(),usage:VPr.UsageInfo$outboundSchema,data:WA.array(HPr.EmbeddingResponseData$outboundSchema)});var zPr;(function(t){t.inboundSchema=kf.EmbeddingResponse$inboundSchema,t.outboundSchema=kf.EmbeddingResponse$outboundSchema})(zPr||(kf.EmbeddingResponse$=zPr={}));function VTo(t){return JSON.stringify(kf.EmbeddingResponse$outboundSchema.parse(t))}function JTo(t){return(0,HTo.safeParse)(t,e=>kf.EmbeddingResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'EmbeddingResponse' from JSON")}});var kMe=S(qf=>{"use strict";var KTo=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]}),WTo=qf&&qf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GTo=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"&&KTo(r,e,n[o]);return WTo(r,e),r}}();Object.defineProperty(qf,"__esModule",{value:!0});qf.EntityType$=qf.EntityType$outboundSchema=qf.EntityType$inboundSchema=qf.EntityType=void 0;var OV=GTo(te()),ZTo=QC();qf.EntityType={User:"User",Workspace:"Workspace",Org:"Org"};qf.EntityType$inboundSchema=OV.union([OV.nativeEnum(qf.EntityType),OV.string().transform(ZTo.catchUnrecognizedEnum)]);qf.EntityType$outboundSchema=OV.union([OV.nativeEnum(qf.EntityType),OV.string().and(OV.custom())]);var KPr;(function(t){t.inboundSchema=qf.EntityType$inboundSchema,t.outboundSchema=qf.EntityType$outboundSchema})(KPr||(qf.EntityType$=KPr={}))});var Nae=S(Bf=>{"use strict";var XTo=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]}),YTo=Bf&&Bf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QTo=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"&&XTo(r,e,n[o]);return YTo(r,e),r}}();Object.defineProperty(Bf,"__esModule",{value:!0});Bf.FilePurpose$=Bf.FilePurpose$outboundSchema=Bf.FilePurpose$inboundSchema=Bf.FilePurpose=void 0;var TV=QTo(te()),eEo=QC();Bf.FilePurpose={FineTune:"fine-tune",Batch:"batch",Ocr:"ocr"};Bf.FilePurpose$inboundSchema=TV.union([TV.nativeEnum(Bf.FilePurpose),TV.string().transform(eEo.catchUnrecognizedEnum)]);Bf.FilePurpose$outboundSchema=TV.union([TV.nativeEnum(Bf.FilePurpose),TV.string().and(TV.custom())]);var WPr;(function(t){t.inboundSchema=Bf.FilePurpose$inboundSchema,t.outboundSchema=Bf.FilePurpose$outboundSchema})(WPr||(Bf.FilePurpose$=WPr={}))});var jae=S(Uf=>{"use strict";var tEo=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]}),rEo=Uf&&Uf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nEo=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"&&tEo(r,e,n[o]);return rEo(r,e),r}}();Object.defineProperty(Uf,"__esModule",{value:!0});Uf.SampleType$=Uf.SampleType$outboundSchema=Uf.SampleType$inboundSchema=Uf.SampleType=void 0;var EV=nEo(te()),oEo=QC();Uf.SampleType={Pretrain:"pretrain",Instruct:"instruct",BatchRequest:"batch_request",BatchResult:"batch_result",BatchError:"batch_error"};Uf.SampleType$inboundSchema=EV.union([EV.nativeEnum(Uf.SampleType),EV.string().transform(oEo.catchUnrecognizedEnum)]);Uf.SampleType$outboundSchema=EV.union([EV.nativeEnum(Uf.SampleType),EV.string().and(EV.custom())]);var GPr;(function(t){t.inboundSchema=Uf.SampleType$inboundSchema,t.outboundSchema=Uf.SampleType$outboundSchema})(GPr||(Uf.SampleType$=GPr={}))});var Dae=S(zf=>{"use strict";var iEo=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]}),aEo=zf&&zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sEo=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"&&iEo(r,e,n[o]);return aEo(r,e),r}}();Object.defineProperty(zf,"__esModule",{value:!0});zf.Source$=zf.Source$outboundSchema=zf.Source$inboundSchema=zf.Source=void 0;var PV=sEo(te()),uEo=QC();zf.Source={Upload:"upload",Repository:"repository",Mistral:"mistral"};zf.Source$inboundSchema=PV.union([PV.nativeEnum(zf.Source),PV.string().transform(uEo.catchUnrecognizedEnum)]);zf.Source$outboundSchema=PV.union([PV.nativeEnum(zf.Source),PV.string().and(PV.custom())]);var ZPr;(function(t){t.inboundSchema=zf.Source$inboundSchema,t.outboundSchema=zf.Source$outboundSchema})(ZPr||(zf.Source$=ZPr={}))});var out=S(Hf=>{"use strict";var lEo=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]}),cEo=Hf&&Hf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dEo=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"&&lEo(r,e,n[o]);return cEo(r,e),r}}();Object.defineProperty(Hf,"__esModule",{value:!0});Hf.FileSchema$=Hf.FileSchema$outboundSchema=Hf.FileSchema$inboundSchema=void 0;Hf.fileSchemaToJSON=pEo;Hf.fileSchemaFromJSON=mEo;var Kl=dEo(te()),YPr=ae(),fEo=ee(),QPr=Nae(),eMr=jae(),tMr=Dae();Hf.FileSchema$inboundSchema=Kl.object({id:Kl.string(),object:Kl.string(),bytes:Kl.number().int(),created_at:Kl.number().int(),filename:Kl.string(),purpose:QPr.FilePurpose$inboundSchema,sample_type:eMr.SampleType$inboundSchema,num_lines:Kl.nullable(Kl.number().int()).optional(),mimetype:Kl.nullable(Kl.string()).optional(),source:tMr.Source$inboundSchema,signature:Kl.nullable(Kl.string()).optional()}).transform(t=>(0,YPr.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));Hf.FileSchema$outboundSchema=Kl.object({id:Kl.string(),object:Kl.string(),sizeBytes:Kl.number().int(),createdAt:Kl.number().int(),filename:Kl.string(),purpose:QPr.FilePurpose$outboundSchema,sampleType:eMr.SampleType$outboundSchema,numLines:Kl.nullable(Kl.number().int()).optional(),mimetype:Kl.nullable(Kl.string()).optional(),source:tMr.Source$outboundSchema,signature:Kl.nullable(Kl.string()).optional()}).transform(t=>(0,YPr.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var XPr;(function(t){t.inboundSchema=Hf.FileSchema$inboundSchema,t.outboundSchema=Hf.FileSchema$outboundSchema})(XPr||(Hf.FileSchema$=XPr={}));function pEo(t){return JSON.stringify(Hf.FileSchema$outboundSchema.parse(t))}function mEo(t){return(0,fEo.safeParse)(t,e=>Hf.FileSchema$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSchema' from JSON")}});var nMr=S(Vf=>{"use strict";var hEo=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]}),gEo=Vf&&Vf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yEo=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"&&hEo(r,e,n[o]);return gEo(r,e),r}}();Object.defineProperty(Vf,"__esModule",{value:!0});Vf.FileSignedURL$=Vf.FileSignedURL$outboundSchema=Vf.FileSignedURL$inboundSchema=void 0;Vf.fileSignedURLToJSON=_Eo;Vf.fileSignedURLFromJSON=vEo;var qMe=yEo(te()),bEo=ee();Vf.FileSignedURL$inboundSchema=qMe.object({url:qMe.string()});Vf.FileSignedURL$outboundSchema=qMe.object({url:qMe.string()});var rMr;(function(t){t.inboundSchema=Vf.FileSignedURL$inboundSchema,t.outboundSchema=Vf.FileSignedURL$outboundSchema})(rMr||(Vf.FileSignedURL$=rMr={}));function _Eo(t){return JSON.stringify(Vf.FileSignedURL$outboundSchema.parse(t))}function vEo(t){return(0,bEo.safeParse)(t,e=>Vf.FileSignedURL$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FileSignedURL' from JSON")}});var uMr=S(hs=>{"use strict";var wEo=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]}),SEo=hs&&hs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CEo=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"&&wEo(r,e,n[o]);return SEo(r,e),r}}();Object.defineProperty(hs,"__esModule",{value:!0});hs.FIMCompletionRequest$=hs.FIMCompletionRequest$outboundSchema=hs.FIMCompletionRequest$inboundSchema=hs.FIMCompletionRequestStop$=hs.FIMCompletionRequestStop$outboundSchema=hs.FIMCompletionRequestStop$inboundSchema=void 0;hs.fimCompletionRequestStopToJSON=xEo;hs.fimCompletionRequestStopFromJSON=OEo;hs.fimCompletionRequestToJSON=TEo;hs.fimCompletionRequestFromJSON=EEo;var go=CEo(te()),aMr=ae(),sMr=ee();hs.FIMCompletionRequestStop$inboundSchema=go.union([go.string(),go.array(go.string())]);hs.FIMCompletionRequestStop$outboundSchema=go.union([go.string(),go.array(go.string())]);var oMr;(function(t){t.inboundSchema=hs.FIMCompletionRequestStop$inboundSchema,t.outboundSchema=hs.FIMCompletionRequestStop$outboundSchema})(oMr||(hs.FIMCompletionRequestStop$=oMr={}));function xEo(t){return JSON.stringify(hs.FIMCompletionRequestStop$outboundSchema.parse(t))}function OEo(t){return(0,sMr.safeParse)(t,e=>hs.FIMCompletionRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequestStop' from JSON")}hs.FIMCompletionRequest$inboundSchema=go.object({model:go.string(),temperature:go.nullable(go.number()).optional(),top_p:go.number().default(1),max_tokens:go.nullable(go.number().int()).optional(),stream:go.boolean().default(!1),stop:go.union([go.string(),go.array(go.string())]).optional(),random_seed:go.nullable(go.number().int()).optional(),prompt:go.string(),suffix:go.nullable(go.string()).optional(),min_tokens:go.nullable(go.number().int()).optional()}).transform(t=>(0,aMr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));hs.FIMCompletionRequest$outboundSchema=go.object({model:go.string(),temperature:go.nullable(go.number()).optional(),topP:go.number().default(1),maxTokens:go.nullable(go.number().int()).optional(),stream:go.boolean().default(!1),stop:go.union([go.string(),go.array(go.string())]).optional(),randomSeed:go.nullable(go.number().int()).optional(),prompt:go.string(),suffix:go.nullable(go.string()).optional(),minTokens:go.nullable(go.number().int()).optional()}).transform(t=>(0,aMr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var iMr;(function(t){t.inboundSchema=hs.FIMCompletionRequest$inboundSchema,t.outboundSchema=hs.FIMCompletionRequest$outboundSchema})(iMr||(hs.FIMCompletionRequest$=iMr={}));function TEo(t){return JSON.stringify(hs.FIMCompletionRequest$outboundSchema.parse(t))}function EEo(t){return(0,sMr.safeParse)(t,e=>hs.FIMCompletionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionRequest' from JSON")}});var fMr=S(Jf=>{"use strict";var PEo=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]}),MEo=Jf&&Jf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),REo=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"&&PEo(r,e,n[o]);return MEo(r,e),r}}();Object.defineProperty(Jf,"__esModule",{value:!0});Jf.FIMCompletionResponse$=Jf.FIMCompletionResponse$outboundSchema=Jf.FIMCompletionResponse$inboundSchema=void 0;Jf.fimCompletionResponseToJSON=IEo;Jf.fimCompletionResponseFromJSON=NEo;var t0=REo(te()),AEo=ee(),cMr=CPe(),dMr=pq();Jf.FIMCompletionResponse$inboundSchema=t0.object({id:t0.string(),object:t0.string(),model:t0.string(),usage:dMr.UsageInfo$inboundSchema,created:t0.number().int(),choices:t0.array(cMr.ChatCompletionChoice$inboundSchema)});Jf.FIMCompletionResponse$outboundSchema=t0.object({id:t0.string(),object:t0.string(),model:t0.string(),usage:dMr.UsageInfo$outboundSchema,created:t0.number().int(),choices:t0.array(cMr.ChatCompletionChoice$outboundSchema)});var lMr;(function(t){t.inboundSchema=Jf.FIMCompletionResponse$inboundSchema,t.outboundSchema=Jf.FIMCompletionResponse$outboundSchema})(lMr||(Jf.FIMCompletionResponse$=lMr={}));function IEo(t){return JSON.stringify(Jf.FIMCompletionResponse$outboundSchema.parse(t))}function NEo(t){return(0,AEo.safeParse)(t,e=>Jf.FIMCompletionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionResponse' from JSON")}});var yMr=S(gs=>{"use strict";var jEo=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]}),DEo=gs&&gs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Eo=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"&&jEo(r,e,n[o]);return DEo(r,e),r}}();Object.defineProperty(gs,"__esModule",{value:!0});gs.FIMCompletionStreamRequest$=gs.FIMCompletionStreamRequest$outboundSchema=gs.FIMCompletionStreamRequest$inboundSchema=gs.FIMCompletionStreamRequestStop$=gs.FIMCompletionStreamRequestStop$outboundSchema=gs.FIMCompletionStreamRequestStop$inboundSchema=void 0;gs.fimCompletionStreamRequestStopToJSON=LEo;gs.fimCompletionStreamRequestStopFromJSON=FEo;gs.fimCompletionStreamRequestToJSON=kEo;gs.fimCompletionStreamRequestFromJSON=qEo;var yo=$Eo(te()),hMr=ae(),gMr=ee();gs.FIMCompletionStreamRequestStop$inboundSchema=yo.union([yo.string(),yo.array(yo.string())]);gs.FIMCompletionStreamRequestStop$outboundSchema=yo.union([yo.string(),yo.array(yo.string())]);var pMr;(function(t){t.inboundSchema=gs.FIMCompletionStreamRequestStop$inboundSchema,t.outboundSchema=gs.FIMCompletionStreamRequestStop$outboundSchema})(pMr||(gs.FIMCompletionStreamRequestStop$=pMr={}));function LEo(t){return JSON.stringify(gs.FIMCompletionStreamRequestStop$outboundSchema.parse(t))}function FEo(t){return(0,gMr.safeParse)(t,e=>gs.FIMCompletionStreamRequestStop$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequestStop' from JSON")}gs.FIMCompletionStreamRequest$inboundSchema=yo.object({model:yo.string(),temperature:yo.nullable(yo.number()).optional(),top_p:yo.number().default(1),max_tokens:yo.nullable(yo.number().int()).optional(),stream:yo.boolean().default(!0),stop:yo.union([yo.string(),yo.array(yo.string())]).optional(),random_seed:yo.nullable(yo.number().int()).optional(),prompt:yo.string(),suffix:yo.nullable(yo.string()).optional(),min_tokens:yo.nullable(yo.number().int()).optional()}).transform(t=>(0,hMr.remap)(t,{top_p:"topP",max_tokens:"maxTokens",random_seed:"randomSeed",min_tokens:"minTokens"}));gs.FIMCompletionStreamRequest$outboundSchema=yo.object({model:yo.string(),temperature:yo.nullable(yo.number()).optional(),topP:yo.number().default(1),maxTokens:yo.nullable(yo.number().int()).optional(),stream:yo.boolean().default(!0),stop:yo.union([yo.string(),yo.array(yo.string())]).optional(),randomSeed:yo.nullable(yo.number().int()).optional(),prompt:yo.string(),suffix:yo.nullable(yo.string()).optional(),minTokens:yo.nullable(yo.number().int()).optional()}).transform(t=>(0,hMr.remap)(t,{topP:"top_p",maxTokens:"max_tokens",randomSeed:"random_seed",minTokens:"min_tokens"}));var mMr;(function(t){t.inboundSchema=gs.FIMCompletionStreamRequest$inboundSchema,t.outboundSchema=gs.FIMCompletionStreamRequest$outboundSchema})(mMr||(gs.FIMCompletionStreamRequest$=mMr={}));function kEo(t){return JSON.stringify(gs.FIMCompletionStreamRequest$outboundSchema.parse(t))}function qEo(t){return(0,gMr.safeParse)(t,e=>gs.FIMCompletionStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FIMCompletionStreamRequest' from JSON")}});var iut=S(Kf=>{"use strict";var BEo=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]}),UEo=Kf&&Kf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zEo=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"&&BEo(r,e,n[o]);return UEo(r,e),r}}();Object.defineProperty(Kf,"__esModule",{value:!0});Kf.FineTuneableModelType$=Kf.FineTuneableModelType$outboundSchema=Kf.FineTuneableModelType$inboundSchema=Kf.FineTuneableModelType=void 0;var HEo=zEo(te());Kf.FineTuneableModelType={Completion:"completion",Classifier:"classifier"};Kf.FineTuneableModelType$inboundSchema=HEo.nativeEnum(Kf.FineTuneableModelType);Kf.FineTuneableModelType$outboundSchema=Kf.FineTuneableModelType$inboundSchema;var bMr;(function(t){t.inboundSchema=Kf.FineTuneableModelType$inboundSchema,t.outboundSchema=Kf.FineTuneableModelType$outboundSchema})(bMr||(Kf.FineTuneableModelType$=bMr={}))});var aut=S(ys=>{"use strict";var VEo=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]}),JEo=ys&&ys.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KEo=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"&&VEo(r,e,n[o]);return JEo(r,e),r}}();Object.defineProperty(ys,"__esModule",{value:!0});ys.FTModelCard$=ys.FTModelCard$outboundSchema=ys.FTModelCard$inboundSchema=ys.FTModelCardType$=ys.FTModelCardType$outboundSchema=ys.FTModelCardType$inboundSchema=ys.FTModelCardType=void 0;ys.ftModelCardToJSON=GEo;ys.ftModelCardFromJSON=ZEo;var Oo=KEo(te()),wMr=ae(),WEo=ee(),SMr=pPe();ys.FTModelCardType={FineTuned:"fine-tuned"};ys.FTModelCardType$inboundSchema=Oo.nativeEnum(ys.FTModelCardType);ys.FTModelCardType$outboundSchema=ys.FTModelCardType$inboundSchema;var _Mr;(function(t){t.inboundSchema=ys.FTModelCardType$inboundSchema,t.outboundSchema=ys.FTModelCardType$outboundSchema})(_Mr||(ys.FTModelCardType$=_Mr={}));ys.FTModelCard$inboundSchema=Oo.object({id:Oo.string(),object:Oo.string().default("model"),created:Oo.number().int().optional(),owned_by:Oo.string().default("mistralai"),capabilities:SMr.ModelCapabilities$inboundSchema,name:Oo.nullable(Oo.string()).optional(),description:Oo.nullable(Oo.string()).optional(),max_context_length:Oo.number().int().default(32768),aliases:Oo.array(Oo.string()).optional(),deprecation:Oo.nullable(Oo.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),deprecation_replacement_model:Oo.nullable(Oo.string()).optional(),default_model_temperature:Oo.nullable(Oo.number()).optional(),type:Oo.literal("fine-tuned").default("fine-tuned"),job:Oo.string(),root:Oo.string(),archived:Oo.boolean().default(!1)}).transform(t=>(0,wMr.remap)(t,{owned_by:"ownedBy",max_context_length:"maxContextLength",deprecation_replacement_model:"deprecationReplacementModel",default_model_temperature:"defaultModelTemperature"}));ys.FTModelCard$outboundSchema=Oo.object({id:Oo.string(),object:Oo.string().default("model"),created:Oo.number().int().optional(),ownedBy:Oo.string().default("mistralai"),capabilities:SMr.ModelCapabilities$outboundSchema,name:Oo.nullable(Oo.string()).optional(),description:Oo.nullable(Oo.string()).optional(),maxContextLength:Oo.number().int().default(32768),aliases:Oo.array(Oo.string()).optional(),deprecation:Oo.nullable(Oo.date().transform(t=>t.toISOString())).optional(),deprecationReplacementModel:Oo.nullable(Oo.string()).optional(),defaultModelTemperature:Oo.nullable(Oo.number()).optional(),type:Oo.literal("fine-tuned").default("fine-tuned"),job:Oo.string(),root:Oo.string(),archived:Oo.boolean().default(!1)}).transform(t=>(0,wMr.remap)(t,{ownedBy:"owned_by",maxContextLength:"max_context_length",deprecationReplacementModel:"deprecation_replacement_model",defaultModelTemperature:"default_model_temperature"}));var vMr;(function(t){t.inboundSchema=ys.FTModelCard$inboundSchema,t.outboundSchema=ys.FTModelCard$outboundSchema})(vMr||(ys.FTModelCard$=vMr={}));function GEo(t){return JSON.stringify(ys.FTModelCard$outboundSchema.parse(t))}function ZEo(t){return(0,WEo.safeParse)(t,e=>ys.FTModelCard$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FTModelCard' from JSON")}});var sut=S(Na=>{"use strict";var XEo=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]}),YEo=Na&&Na.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QEo=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"&&XEo(r,e,n[o]);return YEo(r,e),r}}();Object.defineProperty(Na,"__esModule",{value:!0});Na.GithubRepositoryIn$=Na.GithubRepositoryIn$outboundSchema=Na.GithubRepositoryIn$inboundSchema=Na.GithubRepositoryInType$=Na.GithubRepositoryInType$outboundSchema=Na.GithubRepositoryInType$inboundSchema=Na.GithubRepositoryInType=void 0;Na.githubRepositoryInToJSON=tPo;Na.githubRepositoryInFromJSON=rPo;var Ob=QEo(te()),ePo=ee();Na.GithubRepositoryInType={Github:"github"};Na.GithubRepositoryInType$inboundSchema=Ob.nativeEnum(Na.GithubRepositoryInType);Na.GithubRepositoryInType$outboundSchema=Na.GithubRepositoryInType$inboundSchema;var CMr;(function(t){t.inboundSchema=Na.GithubRepositoryInType$inboundSchema,t.outboundSchema=Na.GithubRepositoryInType$outboundSchema})(CMr||(Na.GithubRepositoryInType$=CMr={}));Na.GithubRepositoryIn$inboundSchema=Ob.object({type:Na.GithubRepositoryInType$inboundSchema.default("github"),name:Ob.string(),owner:Ob.string(),ref:Ob.nullable(Ob.string()).optional(),weight:Ob.number().default(1),token:Ob.string()});Na.GithubRepositoryIn$outboundSchema=Ob.object({type:Na.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 xMr;(function(t){t.inboundSchema=Na.GithubRepositoryIn$inboundSchema,t.outboundSchema=Na.GithubRepositoryIn$outboundSchema})(xMr||(Na.GithubRepositoryIn$=xMr={}));function tPo(t){return JSON.stringify(Na.GithubRepositoryIn$outboundSchema.parse(t))}function rPo(t){return(0,ePo.safeParse)(t,e=>Na.GithubRepositoryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'GithubRepositoryIn' from JSON")}});var uut=S(Wf=>{"use strict";var nPo=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]}),oPo=Wf&&Wf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iPo=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"&&nPo(r,e,n[o]);return oPo(r,e),r}}();Object.defineProperty(Wf,"__esModule",{value:!0});Wf.TrainingFile$=Wf.TrainingFile$outboundSchema=Wf.TrainingFile$inboundSchema=void 0;Wf.trainingFileToJSON=sPo;Wf.trainingFileFromJSON=uPo;var h9=iPo(te()),TMr=ae(),aPo=ee();Wf.TrainingFile$inboundSchema=h9.object({file_id:h9.string(),weight:h9.number().default(1)}).transform(t=>(0,TMr.remap)(t,{file_id:"fileId"}));Wf.TrainingFile$outboundSchema=h9.object({fileId:h9.string(),weight:h9.number().default(1)}).transform(t=>(0,TMr.remap)(t,{fileId:"file_id"}));var OMr;(function(t){t.inboundSchema=Wf.TrainingFile$inboundSchema,t.outboundSchema=Wf.TrainingFile$outboundSchema})(OMr||(Wf.TrainingFile$=OMr={}));function sPo(t){return JSON.stringify(Wf.TrainingFile$outboundSchema.parse(t))}function uPo(t){return(0,aPo.safeParse)(t,e=>Wf.TrainingFile$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TrainingFile' from JSON")}});var lut=S(ja=>{"use strict";var lPo=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]}),cPo=ja&&ja.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dPo=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"&&lPo(r,e,n[o]);return cPo(r,e),r}}();Object.defineProperty(ja,"__esModule",{value:!0});ja.WandbIntegration$=ja.WandbIntegration$outboundSchema=ja.WandbIntegration$inboundSchema=ja.WandbIntegrationType$=ja.WandbIntegrationType$outboundSchema=ja.WandbIntegrationType$inboundSchema=ja.WandbIntegrationType=void 0;ja.wandbIntegrationToJSON=pPo;ja.wandbIntegrationFromJSON=mPo;var Tb=dPo(te()),MMr=ae(),fPo=ee();ja.WandbIntegrationType={Wandb:"wandb"};ja.WandbIntegrationType$inboundSchema=Tb.nativeEnum(ja.WandbIntegrationType);ja.WandbIntegrationType$outboundSchema=ja.WandbIntegrationType$inboundSchema;var EMr;(function(t){t.inboundSchema=ja.WandbIntegrationType$inboundSchema,t.outboundSchema=ja.WandbIntegrationType$outboundSchema})(EMr||(ja.WandbIntegrationType$=EMr={}));ja.WandbIntegration$inboundSchema=Tb.object({type:ja.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,MMr.remap)(t,{api_key:"apiKey",run_name:"runName"}));ja.WandbIntegration$outboundSchema=Tb.object({type:ja.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,MMr.remap)(t,{apiKey:"api_key",runName:"run_name"}));var PMr;(function(t){t.inboundSchema=ja.WandbIntegration$inboundSchema,t.outboundSchema=ja.WandbIntegration$outboundSchema})(PMr||(ja.WandbIntegration$=PMr={}));function pPo(t){return JSON.stringify(ja.WandbIntegration$outboundSchema.parse(t))}function mPo(t){return(0,fPo.safeParse)(t,e=>ja.WandbIntegration$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'WandbIntegration' from JSON")}});var FMr=S(Gr=>{"use strict";var hPo=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]}),gPo=Gr&&Gr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yPo=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"&&hPo(r,e,n[o]);return gPo(r,e),r}}();Object.defineProperty(Gr,"__esModule",{value:!0});Gr.JobIn$=Gr.JobIn$outboundSchema=Gr.JobIn$inboundSchema=Gr.JobInRepositories$=Gr.JobInRepositories$outboundSchema=Gr.JobInRepositories$inboundSchema=Gr.Hyperparameters$=Gr.Hyperparameters$outboundSchema=Gr.Hyperparameters$inboundSchema=Gr.JobInIntegrations$=Gr.JobInIntegrations$outboundSchema=Gr.JobInIntegrations$inboundSchema=void 0;Gr.jobInIntegrationsToJSON=bPo;Gr.jobInIntegrationsFromJSON=_Po;Gr.hyperparametersToJSON=vPo;Gr.hyperparametersFromJSON=wPo;Gr.jobInRepositoriesToJSON=SPo;Gr.jobInRepositoriesFromJSON=CPo;Gr.jobInToJSON=xPo;Gr.jobInFromJSON=OPo;var gi=yPo(te()),jMr=ae(),BMe=ee(),DMr=Rst(),UMe=Ast(),zMe=Fst(),$Mr=iut(),HMe=sut(),LMr=uut(),VMe=lut();Gr.JobInIntegrations$inboundSchema=VMe.WandbIntegration$inboundSchema;Gr.JobInIntegrations$outboundSchema=VMe.WandbIntegration$outboundSchema;var RMr;(function(t){t.inboundSchema=Gr.JobInIntegrations$inboundSchema,t.outboundSchema=Gr.JobInIntegrations$outboundSchema})(RMr||(Gr.JobInIntegrations$=RMr={}));function bPo(t){return JSON.stringify(Gr.JobInIntegrations$outboundSchema.parse(t))}function _Po(t){return(0,BMe.safeParse)(t,e=>Gr.JobInIntegrations$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInIntegrations' from JSON")}Gr.Hyperparameters$inboundSchema=gi.union([zMe.CompletionTrainingParametersIn$inboundSchema,UMe.ClassifierTrainingParametersIn$inboundSchema]);Gr.Hyperparameters$outboundSchema=gi.union([zMe.CompletionTrainingParametersIn$outboundSchema,UMe.ClassifierTrainingParametersIn$outboundSchema]);var AMr;(function(t){t.inboundSchema=Gr.Hyperparameters$inboundSchema,t.outboundSchema=Gr.Hyperparameters$outboundSchema})(AMr||(Gr.Hyperparameters$=AMr={}));function vPo(t){return JSON.stringify(Gr.Hyperparameters$outboundSchema.parse(t))}function wPo(t){return(0,BMe.safeParse)(t,e=>Gr.Hyperparameters$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Hyperparameters' from JSON")}Gr.JobInRepositories$inboundSchema=HMe.GithubRepositoryIn$inboundSchema;Gr.JobInRepositories$outboundSchema=HMe.GithubRepositoryIn$outboundSchema;var IMr;(function(t){t.inboundSchema=Gr.JobInRepositories$inboundSchema,t.outboundSchema=Gr.JobInRepositories$outboundSchema})(IMr||(Gr.JobInRepositories$=IMr={}));function SPo(t){return JSON.stringify(Gr.JobInRepositories$outboundSchema.parse(t))}function CPo(t){return(0,BMe.safeParse)(t,e=>Gr.JobInRepositories$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobInRepositories' from JSON")}Gr.JobIn$inboundSchema=gi.object({model:gi.string(),training_files:gi.array(LMr.TrainingFile$inboundSchema).optional(),validation_files:gi.nullable(gi.array(gi.string())).optional(),suffix:gi.nullable(gi.string()).optional(),integrations:gi.nullable(gi.array(VMe.WandbIntegration$inboundSchema)).optional(),auto_start:gi.boolean().optional(),invalid_sample_skip_percentage:gi.number().default(0),job_type:gi.nullable($Mr.FineTuneableModelType$inboundSchema).optional(),hyperparameters:gi.union([zMe.CompletionTrainingParametersIn$inboundSchema,UMe.ClassifierTrainingParametersIn$inboundSchema]),repositories:gi.nullable(gi.array(HMe.GithubRepositoryIn$inboundSchema)).optional(),classifier_targets:gi.nullable(gi.array(DMr.ClassifierTargetIn$inboundSchema)).optional()}).transform(t=>(0,jMr.remap)(t,{training_files:"trainingFiles",validation_files:"validationFiles",auto_start:"autoStart",invalid_sample_skip_percentage:"invalidSampleSkipPercentage",job_type:"jobType",classifier_targets:"classifierTargets"}));Gr.JobIn$outboundSchema=gi.object({model:gi.string(),trainingFiles:gi.array(LMr.TrainingFile$outboundSchema).optional(),validationFiles:gi.nullable(gi.array(gi.string())).optional(),suffix:gi.nullable(gi.string()).optional(),integrations:gi.nullable(gi.array(VMe.WandbIntegration$outboundSchema)).optional(),autoStart:gi.boolean().optional(),invalidSampleSkipPercentage:gi.number().default(0),jobType:gi.nullable($Mr.FineTuneableModelType$outboundSchema).optional(),hyperparameters:gi.union([zMe.CompletionTrainingParametersIn$outboundSchema,UMe.ClassifierTrainingParametersIn$outboundSchema]),repositories:gi.nullable(gi.array(HMe.GithubRepositoryIn$outboundSchema)).optional(),classifierTargets:gi.nullable(gi.array(DMr.ClassifierTargetIn$outboundSchema)).optional()}).transform(t=>(0,jMr.remap)(t,{trainingFiles:"training_files",validationFiles:"validation_files",autoStart:"auto_start",invalidSampleSkipPercentage:"invalid_sample_skip_percentage",jobType:"job_type",classifierTargets:"classifier_targets"}));var NMr;(function(t){t.inboundSchema=Gr.JobIn$inboundSchema,t.outboundSchema=Gr.JobIn$outboundSchema})(NMr||(Gr.JobIn$=NMr={}));function xPo(t){return JSON.stringify(Gr.JobIn$outboundSchema.parse(t))}function OPo(t){return(0,BMe.safeParse)(t,e=>Gr.JobIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobIn' from JSON")}});var zMr=S(bo=>{"use strict";var TPo=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]}),EPo=bo&&bo.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PPo=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"&&TPo(r,e,n[o]);return EPo(r,e),r}}();Object.defineProperty(bo,"__esModule",{value:!0});bo.JobsOut$=bo.JobsOut$outboundSchema=bo.JobsOut$inboundSchema=bo.JobsOutObject$=bo.JobsOutObject$outboundSchema=bo.JobsOutObject$inboundSchema=bo.JobsOutData$=bo.JobsOutData$outboundSchema=bo.JobsOutData$inboundSchema=bo.JobsOutObject=void 0;bo.jobsOutDataToJSON=MPo;bo.jobsOutDataFromJSON=RPo;bo.jobsOutToJSON=APo;bo.jobsOutFromJSON=IPo;var ju=PPo(te()),UMr=ee(),JMe=Mst(),KMe=Lst();bo.JobsOutObject={List:"list"};bo.JobsOutData$inboundSchema=ju.union([JMe.ClassifierJobOut$inboundSchema.and(ju.object({job_type:ju.literal("classifier")}).transform(t=>({jobType:t.job_type}))),KMe.CompletionJobOut$inboundSchema.and(ju.object({job_type:ju.literal("completion")}).transform(t=>({jobType:t.job_type})))]);bo.JobsOutData$outboundSchema=ju.union([JMe.ClassifierJobOut$outboundSchema.and(ju.object({jobType:ju.literal("classifier")}).transform(t=>({job_type:t.jobType}))),KMe.CompletionJobOut$outboundSchema.and(ju.object({jobType:ju.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var kMr;(function(t){t.inboundSchema=bo.JobsOutData$inboundSchema,t.outboundSchema=bo.JobsOutData$outboundSchema})(kMr||(bo.JobsOutData$=kMr={}));function MPo(t){return JSON.stringify(bo.JobsOutData$outboundSchema.parse(t))}function RPo(t){return(0,UMr.safeParse)(t,e=>bo.JobsOutData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOutData' from JSON")}bo.JobsOutObject$inboundSchema=ju.nativeEnum(bo.JobsOutObject);bo.JobsOutObject$outboundSchema=bo.JobsOutObject$inboundSchema;var qMr;(function(t){t.inboundSchema=bo.JobsOutObject$inboundSchema,t.outboundSchema=bo.JobsOutObject$outboundSchema})(qMr||(bo.JobsOutObject$=qMr={}));bo.JobsOut$inboundSchema=ju.object({data:ju.array(ju.union([JMe.ClassifierJobOut$inboundSchema.and(ju.object({job_type:ju.literal("classifier")}).transform(t=>({jobType:t.job_type}))),KMe.CompletionJobOut$inboundSchema.and(ju.object({job_type:ju.literal("completion")}).transform(t=>({jobType:t.job_type})))])).optional(),object:bo.JobsOutObject$inboundSchema.default("list"),total:ju.number().int()});bo.JobsOut$outboundSchema=ju.object({data:ju.array(ju.union([JMe.ClassifierJobOut$outboundSchema.and(ju.object({jobType:ju.literal("classifier")}).transform(t=>({job_type:t.jobType}))),KMe.CompletionJobOut$outboundSchema.and(ju.object({jobType:ju.literal("completion")}).transform(t=>({job_type:t.jobType})))])).optional(),object:bo.JobsOutObject$outboundSchema.default("list"),total:ju.number().int()});var BMr;(function(t){t.inboundSchema=bo.JobsOut$inboundSchema,t.outboundSchema=bo.JobsOut$outboundSchema})(BMr||(bo.JobsOut$=BMr={}));function APo(t){return JSON.stringify(bo.JobsOut$outboundSchema.parse(t))}function IPo(t){return(0,UMr.safeParse)(t,e=>bo.JobsOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsOut' from JSON")}});var KMr=S(Da=>{"use strict";var NPo=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]}),jPo=Da&&Da.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DPo=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"&&NPo(r,e,n[o]);return jPo(r,e),r}}();Object.defineProperty(Da,"__esModule",{value:!0});Da.LegacyJobMetadataOut$=Da.LegacyJobMetadataOut$outboundSchema=Da.LegacyJobMetadataOut$inboundSchema=Da.LegacyJobMetadataOutObject$=Da.LegacyJobMetadataOutObject$outboundSchema=Da.LegacyJobMetadataOutObject$inboundSchema=Da.LegacyJobMetadataOutObject=void 0;Da.legacyJobMetadataOutToJSON=LPo;Da.legacyJobMetadataOutFromJSON=FPo;var Io=DPo(te()),JMr=ae(),$Po=ee();Da.LegacyJobMetadataOutObject={JobMetadata:"job.metadata"};Da.LegacyJobMetadataOutObject$inboundSchema=Io.nativeEnum(Da.LegacyJobMetadataOutObject);Da.LegacyJobMetadataOutObject$outboundSchema=Da.LegacyJobMetadataOutObject$inboundSchema;var HMr;(function(t){t.inboundSchema=Da.LegacyJobMetadataOutObject$inboundSchema,t.outboundSchema=Da.LegacyJobMetadataOutObject$outboundSchema})(HMr||(Da.LegacyJobMetadataOutObject$=HMr={}));Da.LegacyJobMetadataOut$inboundSchema=Io.object({expected_duration_seconds:Io.nullable(Io.number().int()).optional(),cost:Io.nullable(Io.number()).optional(),cost_currency:Io.nullable(Io.string()).optional(),train_tokens_per_step:Io.nullable(Io.number().int()).optional(),train_tokens:Io.nullable(Io.number().int()).optional(),data_tokens:Io.nullable(Io.number().int()).optional(),estimated_start_time:Io.nullable(Io.number().int()).optional(),deprecated:Io.boolean().default(!0),details:Io.string(),epochs:Io.nullable(Io.number()).optional(),training_steps:Io.nullable(Io.number().int()).optional(),object:Da.LegacyJobMetadataOutObject$inboundSchema.default("job.metadata")}).transform(t=>(0,JMr.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"}));Da.LegacyJobMetadataOut$outboundSchema=Io.object({expectedDurationSeconds:Io.nullable(Io.number().int()).optional(),cost:Io.nullable(Io.number()).optional(),costCurrency:Io.nullable(Io.string()).optional(),trainTokensPerStep:Io.nullable(Io.number().int()).optional(),trainTokens:Io.nullable(Io.number().int()).optional(),dataTokens:Io.nullable(Io.number().int()).optional(),estimatedStartTime:Io.nullable(Io.number().int()).optional(),deprecated:Io.boolean().default(!0),details:Io.string(),epochs:Io.nullable(Io.number()).optional(),trainingSteps:Io.nullable(Io.number().int()).optional(),object:Da.LegacyJobMetadataOutObject$outboundSchema.default("job.metadata")}).transform(t=>(0,JMr.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 VMr;(function(t){t.inboundSchema=Da.LegacyJobMetadataOut$inboundSchema,t.outboundSchema=Da.LegacyJobMetadataOut$outboundSchema})(VMr||(Da.LegacyJobMetadataOut$=VMr={}));function LPo(t){return JSON.stringify(Da.LegacyJobMetadataOut$outboundSchema.parse(t))}function FPo(t){return(0,$Po.safeParse)(t,e=>Da.LegacyJobMetadataOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LegacyJobMetadataOut' from JSON")}});var ZMr=S(Gf=>{"use strict";var kPo=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]}),qPo=Gf&&Gf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BPo=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"&&kPo(r,e,n[o]);return qPo(r,e),r}}();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.LibraryIn$=Gf.LibraryIn$outboundSchema=Gf.LibraryIn$inboundSchema=void 0;Gf.libraryInToJSON=zPo;Gf.libraryInFromJSON=HPo;var r0=BPo(te()),GMr=ae(),UPo=ee();Gf.LibraryIn$inboundSchema=r0.object({name:r0.string(),description:r0.nullable(r0.string()).optional(),chunk_size:r0.nullable(r0.number().int()).optional()}).transform(t=>(0,GMr.remap)(t,{chunk_size:"chunkSize"}));Gf.LibraryIn$outboundSchema=r0.object({name:r0.string(),description:r0.nullable(r0.string()).optional(),chunkSize:r0.nullable(r0.number().int()).optional()}).transform(t=>(0,GMr.remap)(t,{chunkSize:"chunk_size"}));var WMr;(function(t){t.inboundSchema=Gf.LibraryIn$inboundSchema,t.outboundSchema=Gf.LibraryIn$outboundSchema})(WMr||(Gf.LibraryIn$=WMr={}));function zPo(t){return JSON.stringify(Gf.LibraryIn$outboundSchema.parse(t))}function HPo(t){return(0,UPo.safeParse)(t,e=>Gf.LibraryIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryIn' from JSON")}});var YMr=S(Zf=>{"use strict";var VPo=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]}),JPo=Zf&&Zf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KPo=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"&&VPo(r,e,n[o]);return JPo(r,e),r}}();Object.defineProperty(Zf,"__esModule",{value:!0});Zf.LibraryInUpdate$=Zf.LibraryInUpdate$outboundSchema=Zf.LibraryInUpdate$inboundSchema=void 0;Zf.libraryInUpdateToJSON=GPo;Zf.libraryInUpdateFromJSON=ZPo;var GA=KPo(te()),WPo=ee();Zf.LibraryInUpdate$inboundSchema=GA.object({name:GA.nullable(GA.string()).optional(),description:GA.nullable(GA.string()).optional()});Zf.LibraryInUpdate$outboundSchema=GA.object({name:GA.nullable(GA.string()).optional(),description:GA.nullable(GA.string()).optional()});var XMr;(function(t){t.inboundSchema=Zf.LibraryInUpdate$inboundSchema,t.outboundSchema=Zf.LibraryInUpdate$outboundSchema})(XMr||(Zf.LibraryInUpdate$=XMr={}));function GPo(t){return JSON.stringify(Zf.LibraryInUpdate$outboundSchema.parse(t))}function ZPo(t){return(0,WPo.safeParse)(t,e=>Zf.LibraryInUpdate$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryInUpdate' from JSON")}});var cut=S(Xf=>{"use strict";var XPo=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]}),YPo=Xf&&Xf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QPo=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"&&XPo(r,e,n[o]);return YPo(r,e),r}}();Object.defineProperty(Xf,"__esModule",{value:!0});Xf.LibraryOut$=Xf.LibraryOut$outboundSchema=Xf.LibraryOut$inboundSchema=void 0;Xf.libraryOutToJSON=tMo;Xf.libraryOutFromJSON=rMo;var wn=QPo(te()),eRr=ae(),eMo=ee();Xf.LibraryOut$inboundSchema=wn.object({id:wn.string(),name:wn.string(),created_at:wn.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:wn.string().datetime({offset:!0}).transform(t=>new Date(t)),owner_id:wn.string(),owner_type:wn.string(),total_size:wn.number().int(),nb_documents:wn.number().int(),chunk_size:wn.nullable(wn.number().int()),emoji:wn.nullable(wn.string()).optional(),description:wn.nullable(wn.string()).optional(),generated_name:wn.nullable(wn.string()).optional(),generated_description:wn.nullable(wn.string()).optional(),explicit_user_members_count:wn.nullable(wn.number().int()).optional(),explicit_workspace_members_count:wn.nullable(wn.number().int()).optional(),org_sharing_role:wn.nullable(wn.string()).optional()}).transform(t=>(0,eRr.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"}));Xf.LibraryOut$outboundSchema=wn.object({id:wn.string(),name:wn.string(),createdAt:wn.date().transform(t=>t.toISOString()),updatedAt:wn.date().transform(t=>t.toISOString()),ownerId:wn.string(),ownerType:wn.string(),totalSize:wn.number().int(),nbDocuments:wn.number().int(),chunkSize:wn.nullable(wn.number().int()),emoji:wn.nullable(wn.string()).optional(),description:wn.nullable(wn.string()).optional(),generatedName:wn.nullable(wn.string()).optional(),generatedDescription:wn.nullable(wn.string()).optional(),explicitUserMembersCount:wn.nullable(wn.number().int()).optional(),explicitWorkspaceMembersCount:wn.nullable(wn.number().int()).optional(),orgSharingRole:wn.nullable(wn.string()).optional()}).transform(t=>(0,eRr.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 QMr;(function(t){t.inboundSchema=Xf.LibraryOut$inboundSchema,t.outboundSchema=Xf.LibraryOut$outboundSchema})(QMr||(Xf.LibraryOut$=QMr={}));function tMo(t){return JSON.stringify(Xf.LibraryOut$outboundSchema.parse(t))}function rMo(t){return(0,eMo.safeParse)(t,e=>Xf.LibraryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibraryOut' from JSON")}});var dut=S(Yf=>{"use strict";var nMo=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]}),oMo=Yf&&Yf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iMo=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"&&nMo(r,e,n[o]);return oMo(r,e),r}}();Object.defineProperty(Yf,"__esModule",{value:!0});Yf.PaginationInfo$=Yf.PaginationInfo$outboundSchema=Yf.PaginationInfo$inboundSchema=void 0;Yf.paginationInfoToJSON=sMo;Yf.paginationInfoFromJSON=uMo;var n0=iMo(te()),rRr=ae(),aMo=ee();Yf.PaginationInfo$inboundSchema=n0.object({total_items:n0.number().int(),total_pages:n0.number().int(),current_page:n0.number().int(),page_size:n0.number().int(),has_more:n0.boolean()}).transform(t=>(0,rRr.remap)(t,{total_items:"totalItems",total_pages:"totalPages",current_page:"currentPage",page_size:"pageSize",has_more:"hasMore"}));Yf.PaginationInfo$outboundSchema=n0.object({totalItems:n0.number().int(),totalPages:n0.number().int(),currentPage:n0.number().int(),pageSize:n0.number().int(),hasMore:n0.boolean()}).transform(t=>(0,rRr.remap)(t,{totalItems:"total_items",totalPages:"total_pages",currentPage:"current_page",pageSize:"page_size",hasMore:"has_more"}));var tRr;(function(t){t.inboundSchema=Yf.PaginationInfo$inboundSchema,t.outboundSchema=Yf.PaginationInfo$outboundSchema})(tRr||(Yf.PaginationInfo$=tRr={}));function sMo(t){return JSON.stringify(Yf.PaginationInfo$outboundSchema.parse(t))}function uMo(t){return(0,aMo.safeParse)(t,e=>Yf.PaginationInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'PaginationInfo' from JSON")}});var aRr=S(Qf=>{"use strict";var lMo=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]}),cMo=Qf&&Qf.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dMo=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"&&lMo(r,e,n[o]);return cMo(r,e),r}}();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.ListDocumentOut$=Qf.ListDocumentOut$outboundSchema=Qf.ListDocumentOut$inboundSchema=void 0;Qf.listDocumentOutToJSON=pMo;Qf.listDocumentOutFromJSON=mMo;var WMe=dMo(te()),fMo=ee(),oRr=eut(),iRr=dut();Qf.ListDocumentOut$inboundSchema=WMe.object({pagination:iRr.PaginationInfo$inboundSchema,data:WMe.array(oRr.DocumentOut$inboundSchema)});Qf.ListDocumentOut$outboundSchema=WMe.object({pagination:iRr.PaginationInfo$outboundSchema,data:WMe.array(oRr.DocumentOut$outboundSchema)});var nRr;(function(t){t.inboundSchema=Qf.ListDocumentOut$inboundSchema,t.outboundSchema=Qf.ListDocumentOut$outboundSchema})(nRr||(Qf.ListDocumentOut$=nRr={}));function pMo(t){return JSON.stringify(Qf.ListDocumentOut$outboundSchema.parse(t))}function mMo(t){return(0,fMo.safeParse)(t,e=>Qf.ListDocumentOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListDocumentOut' from JSON")}});var lRr=S(ep=>{"use strict";var hMo=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]}),gMo=ep&&ep.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yMo=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"&&hMo(r,e,n[o]);return gMo(r,e),r}}();Object.defineProperty(ep,"__esModule",{value:!0});ep.ListFilesOut$=ep.ListFilesOut$outboundSchema=ep.ListFilesOut$inboundSchema=void 0;ep.listFilesOutToJSON=_Mo;ep.listFilesOutFromJSON=vMo;var bq=yMo(te()),bMo=ee(),uRr=out();ep.ListFilesOut$inboundSchema=bq.object({data:bq.array(uRr.FileSchema$inboundSchema),object:bq.string(),total:bq.number().int()});ep.ListFilesOut$outboundSchema=bq.object({data:bq.array(uRr.FileSchema$outboundSchema),object:bq.string(),total:bq.number().int()});var sRr;(function(t){t.inboundSchema=ep.ListFilesOut$inboundSchema,t.outboundSchema=ep.ListFilesOut$outboundSchema})(sRr||(ep.ListFilesOut$=sRr={}));function _Mo(t){return JSON.stringify(ep.ListFilesOut$outboundSchema.parse(t))}function vMo(t){return(0,bMo.safeParse)(t,e=>ep.ListFilesOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListFilesOut' from JSON")}});var fRr=S(tp=>{"use strict";var wMo=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]}),SMo=tp&&tp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CMo=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"&&wMo(r,e,n[o]);return SMo(r,e),r}}();Object.defineProperty(tp,"__esModule",{value:!0});tp.ListLibraryOut$=tp.ListLibraryOut$outboundSchema=tp.ListLibraryOut$inboundSchema=void 0;tp.listLibraryOutToJSON=OMo;tp.listLibraryOutFromJSON=TMo;var GMe=CMo(te()),xMo=ee(),dRr=cut();tp.ListLibraryOut$inboundSchema=GMe.object({data:GMe.array(dRr.LibraryOut$inboundSchema)});tp.ListLibraryOut$outboundSchema=GMe.object({data:GMe.array(dRr.LibraryOut$outboundSchema)});var cRr;(function(t){t.inboundSchema=tp.ListLibraryOut$inboundSchema,t.outboundSchema=tp.ListLibraryOut$outboundSchema})(cRr||(tp.ListLibraryOut$=cRr={}));function OMo(t){return JSON.stringify(tp.ListLibraryOut$outboundSchema.parse(t))}function TMo(t){return(0,xMo.safeParse)(t,e=>tp.ListLibraryOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListLibraryOut' from JSON")}});var fut=S(rp=>{"use strict";var EMo=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]}),PMo=rp&&rp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MMo=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"&&EMo(r,e,n[o]);return PMo(r,e),r}}();Object.defineProperty(rp,"__esModule",{value:!0});rp.SharingOut$=rp.SharingOut$outboundSchema=rp.SharingOut$inboundSchema=void 0;rp.sharingOutToJSON=AMo;rp.sharingOutFromJSON=IMo;var Py=MMo(te()),mRr=ae(),RMo=ee();rp.SharingOut$inboundSchema=Py.object({library_id:Py.string(),user_id:Py.nullable(Py.string()).optional(),org_id:Py.string(),role:Py.string(),share_with_type:Py.string(),share_with_uuid:Py.string()}).transform(t=>(0,mRr.remap)(t,{library_id:"libraryId",user_id:"userId",org_id:"orgId",share_with_type:"shareWithType",share_with_uuid:"shareWithUuid"}));rp.SharingOut$outboundSchema=Py.object({libraryId:Py.string(),userId:Py.nullable(Py.string()).optional(),orgId:Py.string(),role:Py.string(),shareWithType:Py.string(),shareWithUuid:Py.string()}).transform(t=>(0,mRr.remap)(t,{libraryId:"library_id",userId:"user_id",orgId:"org_id",shareWithType:"share_with_type",shareWithUuid:"share_with_uuid"}));var pRr;(function(t){t.inboundSchema=rp.SharingOut$inboundSchema,t.outboundSchema=rp.SharingOut$outboundSchema})(pRr||(rp.SharingOut$=pRr={}));function AMo(t){return JSON.stringify(rp.SharingOut$outboundSchema.parse(t))}function IMo(t){return(0,RMo.safeParse)(t,e=>rp.SharingOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingOut' from JSON")}});var yRr=S(np=>{"use strict";var NMo=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]}),jMo=np&&np.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DMo=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"&&NMo(r,e,n[o]);return jMo(r,e),r}}();Object.defineProperty(np,"__esModule",{value:!0});np.ListSharingOut$=np.ListSharingOut$outboundSchema=np.ListSharingOut$inboundSchema=void 0;np.listSharingOutToJSON=LMo;np.listSharingOutFromJSON=FMo;var ZMe=DMo(te()),$Mo=ee(),gRr=fut();np.ListSharingOut$inboundSchema=ZMe.object({data:ZMe.array(gRr.SharingOut$inboundSchema)});np.ListSharingOut$outboundSchema=ZMe.object({data:ZMe.array(gRr.SharingOut$outboundSchema)});var hRr;(function(t){t.inboundSchema=np.ListSharingOut$inboundSchema,t.outboundSchema=np.ListSharingOut$outboundSchema})(hRr||(np.ListSharingOut$=hRr={}));function LMo(t){return JSON.stringify(np.ListSharingOut$outboundSchema.parse(t))}function FMo(t){return(0,$Mo.safeParse)(t,e=>np.ListSharingOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ListSharingOut' from JSON")}});var xRr=S(_o=>{"use strict";var kMo=_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]}),qMo=_o&&_o.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BMo=_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"&&kMo(r,e,n[o]);return qMo(r,e),r}}();Object.defineProperty(_o,"__esModule",{value:!0});_o.ModelConversation$=_o.ModelConversation$outboundSchema=_o.ModelConversation$inboundSchema=_o.ModelConversationObject$=_o.ModelConversationObject$outboundSchema=_o.ModelConversationObject$inboundSchema=_o.ModelConversationTools$=_o.ModelConversationTools$outboundSchema=_o.ModelConversationTools$inboundSchema=_o.ModelConversationObject=void 0;_o.modelConversationToolsToJSON=UMo;_o.modelConversationToolsFromJSON=zMo;_o.modelConversationToJSON=HMo;_o.modelConversationFromJSON=VMo;var qt=BMo(te()),wRr=ae(),SRr=ee(),XMe=rq(),CRr=HS(),YMe=iq(),QMe=aq(),eRe=sq(),tRe=uq(),rRe=lq();_o.ModelConversationObject={Conversation:"conversation"};_o.ModelConversationTools$inboundSchema=qt.union([YMe.DocumentLibraryTool$inboundSchema.and(qt.object({type:qt.literal("document_library")}).transform(t=>({type:t.type}))),QMe.FunctionTool$inboundSchema.and(qt.object({type:qt.literal("function")}).transform(t=>({type:t.type}))),XMe.CodeInterpreterTool$inboundSchema.and(qt.object({type:qt.literal("code_interpreter")}).transform(t=>({type:t.type}))),eRe.ImageGenerationTool$inboundSchema.and(qt.object({type:qt.literal("image_generation")}).transform(t=>({type:t.type}))),rRe.WebSearchTool$inboundSchema.and(qt.object({type:qt.literal("web_search")}).transform(t=>({type:t.type}))),tRe.WebSearchPremiumTool$inboundSchema.and(qt.object({type:qt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);_o.ModelConversationTools$outboundSchema=qt.union([YMe.DocumentLibraryTool$outboundSchema.and(qt.object({type:qt.literal("document_library")}).transform(t=>({type:t.type}))),QMe.FunctionTool$outboundSchema.and(qt.object({type:qt.literal("function")}).transform(t=>({type:t.type}))),XMe.CodeInterpreterTool$outboundSchema.and(qt.object({type:qt.literal("code_interpreter")}).transform(t=>({type:t.type}))),eRe.ImageGenerationTool$outboundSchema.and(qt.object({type:qt.literal("image_generation")}).transform(t=>({type:t.type}))),rRe.WebSearchTool$outboundSchema.and(qt.object({type:qt.literal("web_search")}).transform(t=>({type:t.type}))),tRe.WebSearchPremiumTool$outboundSchema.and(qt.object({type:qt.literal("web_search_premium")}).transform(t=>({type:t.type})))]);var bRr;(function(t){t.inboundSchema=_o.ModelConversationTools$inboundSchema,t.outboundSchema=_o.ModelConversationTools$outboundSchema})(bRr||(_o.ModelConversationTools$=bRr={}));function UMo(t){return JSON.stringify(_o.ModelConversationTools$outboundSchema.parse(t))}function zMo(t){return(0,SRr.safeParse)(t,e=>_o.ModelConversationTools$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelConversationTools' from JSON")}_o.ModelConversationObject$inboundSchema=qt.nativeEnum(_o.ModelConversationObject);_o.ModelConversationObject$outboundSchema=_o.ModelConversationObject$inboundSchema;var _Rr;(function(t){t.inboundSchema=_o.ModelConversationObject$inboundSchema,t.outboundSchema=_o.ModelConversationObject$outboundSchema})(_Rr||(_o.ModelConversationObject$=_Rr={}));_o.ModelConversation$inboundSchema=qt.object({instructions:qt.nullable(qt.string()).optional(),tools:qt.array(qt.union([YMe.DocumentLibraryTool$inboundSchema.and(qt.object({type:qt.literal("document_library")}).transform(t=>({type:t.type}))),QMe.FunctionTool$inboundSchema.and(qt.object({type:qt.literal("function")}).transform(t=>({type:t.type}))),XMe.CodeInterpreterTool$inboundSchema.and(qt.object({type:qt.literal("code_interpreter")}).transform(t=>({type:t.type}))),eRe.ImageGenerationTool$inboundSchema.and(qt.object({type:qt.literal("image_generation")}).transform(t=>({type:t.type}))),rRe.WebSearchTool$inboundSchema.and(qt.object({type:qt.literal("web_search")}).transform(t=>({type:t.type}))),tRe.WebSearchPremiumTool$inboundSchema.and(qt.object({type:qt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completion_args:CRr.CompletionArgs$inboundSchema.optional(),name:qt.nullable(qt.string()).optional(),description:qt.nullable(qt.string()).optional(),object:_o.ModelConversationObject$inboundSchema.default("conversation"),id:qt.string(),created_at:qt.string().datetime({offset:!0}).transform(t=>new Date(t)),updated_at:qt.string().datetime({offset:!0}).transform(t=>new Date(t)),model:qt.string()}).transform(t=>(0,wRr.remap)(t,{completion_args:"completionArgs",created_at:"createdAt",updated_at:"updatedAt"}));_o.ModelConversation$outboundSchema=qt.object({instructions:qt.nullable(qt.string()).optional(),tools:qt.array(qt.union([YMe.DocumentLibraryTool$outboundSchema.and(qt.object({type:qt.literal("document_library")}).transform(t=>({type:t.type}))),QMe.FunctionTool$outboundSchema.and(qt.object({type:qt.literal("function")}).transform(t=>({type:t.type}))),XMe.CodeInterpreterTool$outboundSchema.and(qt.object({type:qt.literal("code_interpreter")}).transform(t=>({type:t.type}))),eRe.ImageGenerationTool$outboundSchema.and(qt.object({type:qt.literal("image_generation")}).transform(t=>({type:t.type}))),rRe.WebSearchTool$outboundSchema.and(qt.object({type:qt.literal("web_search")}).transform(t=>({type:t.type}))),tRe.WebSearchPremiumTool$outboundSchema.and(qt.object({type:qt.literal("web_search_premium")}).transform(t=>({type:t.type})))])).optional(),completionArgs:CRr.CompletionArgs$outboundSchema.optional(),name:qt.nullable(qt.string()).optional(),description:qt.nullable(qt.string()).optional(),object:_o.ModelConversationObject$outboundSchema.default("conversation"),id:qt.string(),createdAt:qt.date().transform(t=>t.toISOString()),updatedAt:qt.date().transform(t=>t.toISOString()),model:qt.string()}).transform(t=>(0,wRr.remap)(t,{completionArgs:"completion_args",createdAt:"created_at",updatedAt:"updated_at"}));var vRr;(function(t){t.inboundSchema=_o.ModelConversation$inboundSchema,t.outboundSchema=_o.ModelConversation$outboundSchema})(vRr||(_o.ModelConversation$=vRr={}));function HMo(t){return JSON.stringify(_o.ModelConversation$outboundSchema.parse(t))}function VMo(t){return(0,SRr.safeParse)(t,e=>_o.ModelConversation$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelConversation' from JSON")}});var PRr=S(bs=>{"use strict";var JMo=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]}),KMo=bs&&bs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WMo=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"&&JMo(r,e,n[o]);return KMo(r,e),r}}();Object.defineProperty(bs,"__esModule",{value:!0});bs.ModelList$=bs.ModelList$outboundSchema=bs.ModelList$inboundSchema=bs.Data$=bs.Data$outboundSchema=bs.Data$inboundSchema=void 0;bs.dataToJSON=GMo;bs.dataFromJSON=ZMo;bs.modelListToJSON=XMo;bs.modelListFromJSON=YMo;var Ku=WMo(te()),ERr=ee(),nRe=vst(),oRe=aut();bs.Data$inboundSchema=Ku.union([oRe.FTModelCard$inboundSchema.and(Ku.object({type:Ku.literal("fine-tuned")}).transform(t=>({type:t.type}))),nRe.BaseModelCard$inboundSchema.and(Ku.object({type:Ku.literal("base")}).transform(t=>({type:t.type})))]);bs.Data$outboundSchema=Ku.union([oRe.FTModelCard$outboundSchema.and(Ku.object({type:Ku.literal("fine-tuned")}).transform(t=>({type:t.type}))),nRe.BaseModelCard$outboundSchema.and(Ku.object({type:Ku.literal("base")}).transform(t=>({type:t.type})))]);var ORr;(function(t){t.inboundSchema=bs.Data$inboundSchema,t.outboundSchema=bs.Data$outboundSchema})(ORr||(bs.Data$=ORr={}));function GMo(t){return JSON.stringify(bs.Data$outboundSchema.parse(t))}function ZMo(t){return(0,ERr.safeParse)(t,e=>bs.Data$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Data' from JSON")}bs.ModelList$inboundSchema=Ku.object({object:Ku.string().default("list"),data:Ku.array(Ku.union([oRe.FTModelCard$inboundSchema.and(Ku.object({type:Ku.literal("fine-tuned")}).transform(t=>({type:t.type}))),nRe.BaseModelCard$inboundSchema.and(Ku.object({type:Ku.literal("base")}).transform(t=>({type:t.type})))])).optional()});bs.ModelList$outboundSchema=Ku.object({object:Ku.string().default("list"),data:Ku.array(Ku.union([oRe.FTModelCard$outboundSchema.and(Ku.object({type:Ku.literal("fine-tuned")}).transform(t=>({type:t.type}))),nRe.BaseModelCard$outboundSchema.and(Ku.object({type:Ku.literal("base")}).transform(t=>({type:t.type})))])).optional()});var TRr;(function(t){t.inboundSchema=bs.ModelList$inboundSchema,t.outboundSchema=bs.ModelList$outboundSchema})(TRr||(bs.ModelList$=TRr={}));function XMo(t){return JSON.stringify(bs.ModelList$outboundSchema.parse(t))}function YMo(t){return(0,ERr.safeParse)(t,e=>bs.ModelList$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModelList' from JSON")}});var put=S(op=>{"use strict";var QMo=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]}),eRo=op&&op.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tRo=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"&&QMo(r,e,n[o]);return eRo(r,e),r}}();Object.defineProperty(op,"__esModule",{value:!0});op.ModerationObject$=op.ModerationObject$outboundSchema=op.ModerationObject$inboundSchema=void 0;op.moderationObjectToJSON=nRo;op.moderationObjectFromJSON=oRo;var ZA=tRo(te()),RRr=ae(),rRo=ee();op.ModerationObject$inboundSchema=ZA.object({categories:ZA.record(ZA.boolean()).optional(),category_scores:ZA.record(ZA.number()).optional()}).transform(t=>(0,RRr.remap)(t,{category_scores:"categoryScores"}));op.ModerationObject$outboundSchema=ZA.object({categories:ZA.record(ZA.boolean()).optional(),categoryScores:ZA.record(ZA.number()).optional()}).transform(t=>(0,RRr.remap)(t,{categoryScores:"category_scores"}));var MRr;(function(t){t.inboundSchema=op.ModerationObject$inboundSchema,t.outboundSchema=op.ModerationObject$outboundSchema})(MRr||(op.ModerationObject$=MRr={}));function nRo(t){return JSON.stringify(op.ModerationObject$outboundSchema.parse(t))}function oRo(t){return(0,rRo.safeParse)(t,e=>op.ModerationObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModerationObject' from JSON")}});var NRr=S(ip=>{"use strict";var iRo=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]}),aRo=ip&&ip.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sRo=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"&&iRo(r,e,n[o]);return aRo(r,e),r}}();Object.defineProperty(ip,"__esModule",{value:!0});ip.ModerationResponse$=ip.ModerationResponse$outboundSchema=ip.ModerationResponse$inboundSchema=void 0;ip.moderationResponseToJSON=lRo;ip.moderationResponseFromJSON=cRo;var _q=sRo(te()),uRo=ee(),IRr=put();ip.ModerationResponse$inboundSchema=_q.object({id:_q.string(),model:_q.string(),results:_q.array(IRr.ModerationObject$inboundSchema)});ip.ModerationResponse$outboundSchema=_q.object({id:_q.string(),model:_q.string(),results:_q.array(IRr.ModerationObject$outboundSchema)});var ARr;(function(t){t.inboundSchema=ip.ModerationResponse$inboundSchema,t.outboundSchema=ip.ModerationResponse$outboundSchema})(ARr||(ip.ModerationResponse$=ARr={}));function lRo(t){return JSON.stringify(ip.ModerationResponse$outboundSchema.parse(t))}function cRo(t){return(0,uRo.safeParse)(t,e=>ip.ModerationResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ModerationResponse' from JSON")}});var mut=S(ap=>{"use strict";var dRo=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]}),fRo=ap&&ap.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pRo=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"&&dRo(r,e,n[o]);return fRo(r,e),r}}();Object.defineProperty(ap,"__esModule",{value:!0});ap.OCRImageObject$=ap.OCRImageObject$outboundSchema=ap.OCRImageObject$inboundSchema=void 0;ap.ocrImageObjectToJSON=hRo;ap.ocrImageObjectFromJSON=gRo;var hu=pRo(te()),DRr=ae(),mRo=ee();ap.OCRImageObject$inboundSchema=hu.object({id:hu.string(),top_left_x:hu.nullable(hu.number().int()),top_left_y:hu.nullable(hu.number().int()),bottom_right_x:hu.nullable(hu.number().int()),bottom_right_y:hu.nullable(hu.number().int()),image_base64:hu.nullable(hu.string()).optional(),image_annotation:hu.nullable(hu.string()).optional()}).transform(t=>(0,DRr.remap)(t,{top_left_x:"topLeftX",top_left_y:"topLeftY",bottom_right_x:"bottomRightX",bottom_right_y:"bottomRightY",image_base64:"imageBase64",image_annotation:"imageAnnotation"}));ap.OCRImageObject$outboundSchema=hu.object({id:hu.string(),topLeftX:hu.nullable(hu.number().int()),topLeftY:hu.nullable(hu.number().int()),bottomRightX:hu.nullable(hu.number().int()),bottomRightY:hu.nullable(hu.number().int()),imageBase64:hu.nullable(hu.string()).optional(),imageAnnotation:hu.nullable(hu.string()).optional()}).transform(t=>(0,DRr.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 jRr;(function(t){t.inboundSchema=ap.OCRImageObject$inboundSchema,t.outboundSchema=ap.OCRImageObject$outboundSchema})(jRr||(ap.OCRImageObject$=jRr={}));function hRo(t){return JSON.stringify(ap.OCRImageObject$outboundSchema.parse(t))}function gRo(t){return(0,mRo.safeParse)(t,e=>ap.OCRImageObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRImageObject' from JSON")}});var hut=S(sp=>{"use strict";var yRo=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]}),bRo=sp&&sp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_Ro=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"&&yRo(r,e,n[o]);return bRo(r,e),r}}();Object.defineProperty(sp,"__esModule",{value:!0});sp.OCRPageDimensions$=sp.OCRPageDimensions$outboundSchema=sp.OCRPageDimensions$inboundSchema=void 0;sp.ocrPageDimensionsToJSON=wRo;sp.ocrPageDimensionsFromJSON=SRo;var vq=_Ro(te()),vRo=ee();sp.OCRPageDimensions$inboundSchema=vq.object({dpi:vq.number().int(),height:vq.number().int(),width:vq.number().int()});sp.OCRPageDimensions$outboundSchema=vq.object({dpi:vq.number().int(),height:vq.number().int(),width:vq.number().int()});var $Rr;(function(t){t.inboundSchema=sp.OCRPageDimensions$inboundSchema,t.outboundSchema=sp.OCRPageDimensions$outboundSchema})($Rr||(sp.OCRPageDimensions$=$Rr={}));function wRo(t){return JSON.stringify(sp.OCRPageDimensions$outboundSchema.parse(t))}function SRo(t){return(0,vRo.safeParse)(t,e=>sp.OCRPageDimensions$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRPageDimensions' from JSON")}});var gut=S(up=>{"use strict";var CRo=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]}),xRo=up&&up.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ORo=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"&&CRo(r,e,n[o]);return xRo(r,e),r}}();Object.defineProperty(up,"__esModule",{value:!0});up.OCRPageObject$=up.OCRPageObject$outboundSchema=up.OCRPageObject$inboundSchema=void 0;up.ocrPageObjectToJSON=ERo;up.ocrPageObjectFromJSON=PRo;var XA=ORo(te()),TRo=ee(),FRr=mut(),kRr=hut();up.OCRPageObject$inboundSchema=XA.object({index:XA.number().int(),markdown:XA.string(),images:XA.array(FRr.OCRImageObject$inboundSchema),dimensions:XA.nullable(kRr.OCRPageDimensions$inboundSchema)});up.OCRPageObject$outboundSchema=XA.object({index:XA.number().int(),markdown:XA.string(),images:XA.array(FRr.OCRImageObject$outboundSchema),dimensions:XA.nullable(kRr.OCRPageDimensions$outboundSchema)});var LRr;(function(t){t.inboundSchema=up.OCRPageObject$inboundSchema,t.outboundSchema=up.OCRPageObject$outboundSchema})(LRr||(up.OCRPageObject$=LRr={}));function ERo(t){return JSON.stringify(up.OCRPageObject$outboundSchema.parse(t))}function PRo(t){return(0,TRo.safeParse)(t,e=>up.OCRPageObject$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRPageObject' from JSON")}});var HRr=S(_s=>{"use strict";var MRo=_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]}),RRo=_s&&_s.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ARo=_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"&&MRo(r,e,n[o]);return RRo(r,e),r}}();Object.defineProperty(_s,"__esModule",{value:!0});_s.OCRRequest$=_s.OCRRequest$outboundSchema=_s.OCRRequest$inboundSchema=_s.Document$=_s.Document$outboundSchema=_s.Document$inboundSchema=void 0;_s.documentToJSON=IRo;_s.documentFromJSON=NRo;_s.ocrRequestToJSON=jRo;_s.ocrRequestFromJSON=DRo;var $a=ARo(te()),URr=ae(),zRr=ee(),aRe=fV(),sRe=jEe(),uRe=pV(),iRe=oq();_s.Document$inboundSchema=$a.union([sRe.FileChunk$inboundSchema,aRe.DocumentURLChunk$inboundSchema,uRe.ImageURLChunk$inboundSchema]);_s.Document$outboundSchema=$a.union([sRe.FileChunk$outboundSchema,aRe.DocumentURLChunk$outboundSchema,uRe.ImageURLChunk$outboundSchema]);var qRr;(function(t){t.inboundSchema=_s.Document$inboundSchema,t.outboundSchema=_s.Document$outboundSchema})(qRr||(_s.Document$=qRr={}));function IRo(t){return JSON.stringify(_s.Document$outboundSchema.parse(t))}function NRo(t){return(0,zRr.safeParse)(t,e=>_s.Document$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Document' from JSON")}_s.OCRRequest$inboundSchema=$a.object({model:$a.nullable($a.string()),id:$a.string().optional(),document:$a.union([sRe.FileChunk$inboundSchema,aRe.DocumentURLChunk$inboundSchema,uRe.ImageURLChunk$inboundSchema]),pages:$a.nullable($a.array($a.number().int())).optional(),include_image_base64:$a.nullable($a.boolean()).optional(),image_limit:$a.nullable($a.number().int()).optional(),image_min_size:$a.nullable($a.number().int()).optional(),bbox_annotation_format:$a.nullable(iRe.ResponseFormat$inboundSchema).optional(),document_annotation_format:$a.nullable(iRe.ResponseFormat$inboundSchema).optional()}).transform(t=>(0,URr.remap)(t,{include_image_base64:"includeImageBase64",image_limit:"imageLimit",image_min_size:"imageMinSize",bbox_annotation_format:"bboxAnnotationFormat",document_annotation_format:"documentAnnotationFormat"}));_s.OCRRequest$outboundSchema=$a.object({model:$a.nullable($a.string()),id:$a.string().optional(),document:$a.union([sRe.FileChunk$outboundSchema,aRe.DocumentURLChunk$outboundSchema,uRe.ImageURLChunk$outboundSchema]),pages:$a.nullable($a.array($a.number().int())).optional(),includeImageBase64:$a.nullable($a.boolean()).optional(),imageLimit:$a.nullable($a.number().int()).optional(),imageMinSize:$a.nullable($a.number().int()).optional(),bboxAnnotationFormat:$a.nullable(iRe.ResponseFormat$outboundSchema).optional(),documentAnnotationFormat:$a.nullable(iRe.ResponseFormat$outboundSchema).optional()}).transform(t=>(0,URr.remap)(t,{includeImageBase64:"include_image_base64",imageLimit:"image_limit",imageMinSize:"image_min_size",bboxAnnotationFormat:"bbox_annotation_format",documentAnnotationFormat:"document_annotation_format"}));var BRr;(function(t){t.inboundSchema=_s.OCRRequest$inboundSchema,t.outboundSchema=_s.OCRRequest$outboundSchema})(BRr||(_s.OCRRequest$=BRr={}));function jRo(t){return JSON.stringify(_s.OCRRequest$outboundSchema.parse(t))}function DRo(t){return(0,zRr.safeParse)(t,e=>_s.OCRRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRRequest' from JSON")}});var yut=S(lp=>{"use strict";var $Ro=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]}),LRo=lp&&lp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FRo=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"&&$Ro(r,e,n[o]);return LRo(r,e),r}}();Object.defineProperty(lp,"__esModule",{value:!0});lp.OCRUsageInfo$=lp.OCRUsageInfo$outboundSchema=lp.OCRUsageInfo$inboundSchema=void 0;lp.ocrUsageInfoToJSON=qRo;lp.ocrUsageInfoFromJSON=BRo;var wq=FRo(te()),JRr=ae(),kRo=ee();lp.OCRUsageInfo$inboundSchema=wq.object({pages_processed:wq.number().int(),doc_size_bytes:wq.nullable(wq.number().int()).optional()}).transform(t=>(0,JRr.remap)(t,{pages_processed:"pagesProcessed",doc_size_bytes:"docSizeBytes"}));lp.OCRUsageInfo$outboundSchema=wq.object({pagesProcessed:wq.number().int(),docSizeBytes:wq.nullable(wq.number().int()).optional()}).transform(t=>(0,JRr.remap)(t,{pagesProcessed:"pages_processed",docSizeBytes:"doc_size_bytes"}));var VRr;(function(t){t.inboundSchema=lp.OCRUsageInfo$inboundSchema,t.outboundSchema=lp.OCRUsageInfo$outboundSchema})(VRr||(lp.OCRUsageInfo$=VRr={}));function qRo(t){return JSON.stringify(lp.OCRUsageInfo$outboundSchema.parse(t))}function BRo(t){return(0,kRo.safeParse)(t,e=>lp.OCRUsageInfo$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRUsageInfo' from JSON")}});var XRr=S(cp=>{"use strict";var URo=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]}),zRo=cp&&cp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HRo=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"&&URo(r,e,n[o]);return zRo(r,e),r}}();Object.defineProperty(cp,"__esModule",{value:!0});cp.OCRResponse$=cp.OCRResponse$outboundSchema=cp.OCRResponse$inboundSchema=void 0;cp.ocrResponseToJSON=JRo;cp.ocrResponseFromJSON=KRo;var YA=HRo(te()),WRr=ae(),VRo=ee(),GRr=gut(),ZRr=yut();cp.OCRResponse$inboundSchema=YA.object({pages:YA.array(GRr.OCRPageObject$inboundSchema),model:YA.string(),document_annotation:YA.nullable(YA.string()).optional(),usage_info:ZRr.OCRUsageInfo$inboundSchema}).transform(t=>(0,WRr.remap)(t,{document_annotation:"documentAnnotation",usage_info:"usageInfo"}));cp.OCRResponse$outboundSchema=YA.object({pages:YA.array(GRr.OCRPageObject$outboundSchema),model:YA.string(),documentAnnotation:YA.nullable(YA.string()).optional(),usageInfo:ZRr.OCRUsageInfo$outboundSchema}).transform(t=>(0,WRr.remap)(t,{documentAnnotation:"document_annotation",usageInfo:"usage_info"}));var KRr;(function(t){t.inboundSchema=cp.OCRResponse$inboundSchema,t.outboundSchema=cp.OCRResponse$outboundSchema})(KRr||(cp.OCRResponse$=KRr={}));function JRo(t){return JSON.stringify(cp.OCRResponse$outboundSchema.parse(t))}function KRo(t){return(0,VRo.safeParse)(t,e=>cp.OCRResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'OCRResponse' from JSON")}});var eAr=S(dp=>{"use strict";var WRo=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]}),GRo=dp&&dp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZRo=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"&&WRo(r,e,n[o]);return GRo(r,e),r}}();Object.defineProperty(dp,"__esModule",{value:!0});dp.ProcessingStatusOut$=dp.ProcessingStatusOut$outboundSchema=dp.ProcessingStatusOut$inboundSchema=void 0;dp.processingStatusOutToJSON=YRo;dp.processingStatusOutFromJSON=QRo;var g9=ZRo(te()),QRr=ae(),XRo=ee();dp.ProcessingStatusOut$inboundSchema=g9.object({document_id:g9.string(),processing_status:g9.string()}).transform(t=>(0,QRr.remap)(t,{document_id:"documentId",processing_status:"processingStatus"}));dp.ProcessingStatusOut$outboundSchema=g9.object({documentId:g9.string(),processingStatus:g9.string()}).transform(t=>(0,QRr.remap)(t,{documentId:"document_id",processingStatus:"processing_status"}));var YRr;(function(t){t.inboundSchema=dp.ProcessingStatusOut$inboundSchema,t.outboundSchema=dp.ProcessingStatusOut$outboundSchema})(YRr||(dp.ProcessingStatusOut$=YRr={}));function YRo(t){return JSON.stringify(dp.ProcessingStatusOut$outboundSchema.parse(t))}function QRo(t){return(0,XRo.safeParse)(t,e=>dp.ProcessingStatusOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ProcessingStatusOut' from JSON")}});var aAr=S(fp=>{"use strict";var eAo=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]}),tAo=fp&&fp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rAo=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"&&eAo(r,e,n[o]);return tAo(r,e),r}}();Object.defineProperty(fp,"__esModule",{value:!0});fp.RetrieveFileOut$=fp.RetrieveFileOut$outboundSchema=fp.RetrieveFileOut$inboundSchema=void 0;fp.retrieveFileOutToJSON=oAo;fp.retrieveFileOutFromJSON=iAo;var Wu=rAo(te()),rAr=ae(),nAo=ee(),nAr=Nae(),oAr=jae(),iAr=Dae();fp.RetrieveFileOut$inboundSchema=Wu.object({id:Wu.string(),object:Wu.string(),bytes:Wu.number().int(),created_at:Wu.number().int(),filename:Wu.string(),purpose:nAr.FilePurpose$inboundSchema,sample_type:oAr.SampleType$inboundSchema,num_lines:Wu.nullable(Wu.number().int()).optional(),mimetype:Wu.nullable(Wu.string()).optional(),source:iAr.Source$inboundSchema,signature:Wu.nullable(Wu.string()).optional(),deleted:Wu.boolean()}).transform(t=>(0,rAr.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));fp.RetrieveFileOut$outboundSchema=Wu.object({id:Wu.string(),object:Wu.string(),sizeBytes:Wu.number().int(),createdAt:Wu.number().int(),filename:Wu.string(),purpose:nAr.FilePurpose$outboundSchema,sampleType:oAr.SampleType$outboundSchema,numLines:Wu.nullable(Wu.number().int()).optional(),mimetype:Wu.nullable(Wu.string()).optional(),source:iAr.Source$outboundSchema,signature:Wu.nullable(Wu.string()).optional(),deleted:Wu.boolean()}).transform(t=>(0,rAr.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var tAr;(function(t){t.inboundSchema=fp.RetrieveFileOut$inboundSchema,t.outboundSchema=fp.RetrieveFileOut$outboundSchema})(tAr||(fp.RetrieveFileOut$=tAr={}));function oAo(t){return JSON.stringify(fp.RetrieveFileOut$outboundSchema.parse(t))}function iAo(t){return(0,nAo.safeParse)(t,e=>fp.RetrieveFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveFileOut' from JSON")}});var lAr=S(pp=>{"use strict";var aAo=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]}),sAo=pp&&pp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uAo=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"&&aAo(r,e,n[o]);return sAo(r,e),r}}();Object.defineProperty(pp,"__esModule",{value:!0});pp.Security$=pp.Security$outboundSchema=pp.Security$inboundSchema=void 0;pp.securityToJSON=cAo;pp.securityFromJSON=dAo;var lRe=uAo(te()),uAr=ae(),lAo=ee();pp.Security$inboundSchema=lRe.object({ApiKey:lRe.string().optional()}).transform(t=>(0,uAr.remap)(t,{ApiKey:"apiKey"}));pp.Security$outboundSchema=lRe.object({apiKey:lRe.string().optional()}).transform(t=>(0,uAr.remap)(t,{apiKey:"ApiKey"}));var sAr;(function(t){t.inboundSchema=pp.Security$inboundSchema,t.outboundSchema=pp.Security$outboundSchema})(sAr||(pp.Security$=sAr={}));function cAo(t){return JSON.stringify(pp.Security$outboundSchema.parse(t))}function dAo(t){return(0,lAo.safeParse)(t,e=>pp.Security$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Security' from JSON")}});var but=S(mp=>{"use strict";var fAo=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]}),pAo=mp&&mp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mAo=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"&&fAo(r,e,n[o]);return pAo(r,e),r}}();Object.defineProperty(mp,"__esModule",{value:!0});mp.ShareEnum$=mp.ShareEnum$outboundSchema=mp.ShareEnum$inboundSchema=mp.ShareEnum=void 0;var MV=mAo(te()),hAo=QC();mp.ShareEnum={Viewer:"Viewer",Editor:"Editor"};mp.ShareEnum$inboundSchema=MV.union([MV.nativeEnum(mp.ShareEnum),MV.string().transform(hAo.catchUnrecognizedEnum)]);mp.ShareEnum$outboundSchema=MV.union([MV.nativeEnum(mp.ShareEnum),MV.string().and(MV.custom())]);var cAr;(function(t){t.inboundSchema=mp.ShareEnum$inboundSchema,t.outboundSchema=mp.ShareEnum$outboundSchema})(cAr||(mp.ShareEnum$=cAr={}))});var mAr=S(hp=>{"use strict";var gAo=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]}),yAo=hp&&hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bAo=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"&&gAo(r,e,n[o]);return yAo(r,e),r}}();Object.defineProperty(hp,"__esModule",{value:!0});hp.SharingDelete$=hp.SharingDelete$outboundSchema=hp.SharingDelete$inboundSchema=void 0;hp.sharingDeleteToJSON=vAo;hp.sharingDeleteFromJSON=wAo;var y9=bAo(te()),fAr=ae(),_Ao=ee(),pAr=kMe();hp.SharingDelete$inboundSchema=y9.object({org_id:y9.string(),share_with_uuid:y9.string(),share_with_type:pAr.EntityType$inboundSchema}).transform(t=>(0,fAr.remap)(t,{org_id:"orgId",share_with_uuid:"shareWithUuid",share_with_type:"shareWithType"}));hp.SharingDelete$outboundSchema=y9.object({orgId:y9.string(),shareWithUuid:y9.string(),shareWithType:pAr.EntityType$outboundSchema}).transform(t=>(0,fAr.remap)(t,{orgId:"org_id",shareWithUuid:"share_with_uuid",shareWithType:"share_with_type"}));var dAr;(function(t){t.inboundSchema=hp.SharingDelete$inboundSchema,t.outboundSchema=hp.SharingDelete$outboundSchema})(dAr||(hp.SharingDelete$=dAr={}));function vAo(t){return JSON.stringify(hp.SharingDelete$outboundSchema.parse(t))}function wAo(t){return(0,_Ao.safeParse)(t,e=>hp.SharingDelete$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingDelete' from JSON")}});var _Ar=S(gp=>{"use strict";var SAo=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]}),CAo=gp&&gp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xAo=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"&&SAo(r,e,n[o]);return CAo(r,e),r}}();Object.defineProperty(gp,"__esModule",{value:!0});gp.SharingIn$=gp.SharingIn$outboundSchema=gp.SharingIn$inboundSchema=void 0;gp.sharingInToJSON=TAo;gp.sharingInFromJSON=EAo;var b9=xAo(te()),gAr=ae(),OAo=ee(),yAr=kMe(),bAr=but();gp.SharingIn$inboundSchema=b9.object({org_id:b9.string(),level:bAr.ShareEnum$inboundSchema,share_with_uuid:b9.string(),share_with_type:yAr.EntityType$inboundSchema}).transform(t=>(0,gAr.remap)(t,{org_id:"orgId",share_with_uuid:"shareWithUuid",share_with_type:"shareWithType"}));gp.SharingIn$outboundSchema=b9.object({orgId:b9.string(),level:bAr.ShareEnum$outboundSchema,shareWithUuid:b9.string(),shareWithType:yAr.EntityType$outboundSchema}).transform(t=>(0,gAr.remap)(t,{orgId:"org_id",shareWithUuid:"share_with_uuid",shareWithType:"share_with_type"}));var hAr;(function(t){t.inboundSchema=gp.SharingIn$inboundSchema,t.outboundSchema=gp.SharingIn$outboundSchema})(hAr||(gp.SharingIn$=hAr={}));function TAo(t){return JSON.stringify(gp.SharingIn$outboundSchema.parse(t))}function EAo(t){return(0,OAo.safeParse)(t,e=>gp.SharingIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'SharingIn' from JSON")}});var cRe=S(La=>{"use strict";var PAo=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]}),MAo=La&&La.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),RAo=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"&&PAo(r,e,n[o]);return MAo(r,e),r}}();Object.defineProperty(La,"__esModule",{value:!0});La.TranscriptionSegmentChunk$=La.TranscriptionSegmentChunk$outboundSchema=La.TranscriptionSegmentChunk$inboundSchema=La.Type$=La.Type$outboundSchema=La.Type$inboundSchema=La.Type=void 0;La.transcriptionSegmentChunkToJSON=IAo;La.transcriptionSegmentChunkFromJSON=NAo;var o0=RAo(te()),AAo=ae(),SAr=ee();La.Type={TranscriptionSegment:"transcription_segment"};La.Type$inboundSchema=o0.nativeEnum(La.Type);La.Type$outboundSchema=La.Type$inboundSchema;var vAr;(function(t){t.inboundSchema=La.Type$inboundSchema,t.outboundSchema=La.Type$outboundSchema})(vAr||(La.Type$=vAr={}));La.TranscriptionSegmentChunk$inboundSchema=(0,SAr.collectExtraKeys)(o0.object({text:o0.string(),start:o0.number(),end:o0.number(),type:La.Type$inboundSchema.default("transcription_segment")}).catchall(o0.any()),"additionalProperties",!0);La.TranscriptionSegmentChunk$outboundSchema=o0.object({text:o0.string(),start:o0.number(),end:o0.number(),type:La.Type$outboundSchema.default("transcription_segment"),additionalProperties:o0.record(o0.any())}).transform(t=>({...t.additionalProperties,...(0,AAo.remap)(t,{additionalProperties:null})}));var wAr;(function(t){t.inboundSchema=La.TranscriptionSegmentChunk$inboundSchema,t.outboundSchema=La.TranscriptionSegmentChunk$outboundSchema})(wAr||(La.TranscriptionSegmentChunk$=wAr={}));function IAo(t){return JSON.stringify(La.TranscriptionSegmentChunk$outboundSchema.parse(t))}function NAo(t){return(0,SAr.safeParse)(t,e=>La.TranscriptionSegmentChunk$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionSegmentChunk' from JSON")}});var EAr=S(yp=>{"use strict";var jAo=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]}),DAo=yp&&yp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$Ao=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"&&jAo(r,e,n[o]);return DAo(r,e),r}}();Object.defineProperty(yp,"__esModule",{value:!0});yp.TranscriptionResponse$=yp.TranscriptionResponse$outboundSchema=yp.TranscriptionResponse$inboundSchema=void 0;yp.transcriptionResponseToJSON=FAo;yp.transcriptionResponseFromJSON=kAo;var Eb=$Ao(te()),LAo=ae(),xAr=ee(),OAr=cRe(),TAr=pq();yp.TranscriptionResponse$inboundSchema=(0,xAr.collectExtraKeys)(Eb.object({model:Eb.string(),text:Eb.string(),segments:Eb.array(OAr.TranscriptionSegmentChunk$inboundSchema).optional(),usage:TAr.UsageInfo$inboundSchema,language:Eb.nullable(Eb.string())}).catchall(Eb.any()),"additionalProperties",!0);yp.TranscriptionResponse$outboundSchema=Eb.object({model:Eb.string(),text:Eb.string(),segments:Eb.array(OAr.TranscriptionSegmentChunk$outboundSchema).optional(),usage:TAr.UsageInfo$outboundSchema,language:Eb.nullable(Eb.string()),additionalProperties:Eb.record(Eb.any())}).transform(t=>({...t.additionalProperties,...(0,LAo.remap)(t,{additionalProperties:null})}));var CAr;(function(t){t.inboundSchema=yp.TranscriptionResponse$inboundSchema,t.outboundSchema=yp.TranscriptionResponse$outboundSchema})(CAr||(yp.TranscriptionResponse$=CAr={}));function FAo(t){return JSON.stringify(yp.TranscriptionResponse$outboundSchema.parse(t))}function kAo(t){return(0,xAr.safeParse)(t,e=>yp.TranscriptionResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionResponse' from JSON")}});var _ut=S(Fa=>{"use strict";var qAo=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]}),BAo=Fa&&Fa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),UAo=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"&&qAo(r,e,n[o]);return BAo(r,e),r}}();Object.defineProperty(Fa,"__esModule",{value:!0});Fa.TranscriptionStreamDone$=Fa.TranscriptionStreamDone$outboundSchema=Fa.TranscriptionStreamDone$inboundSchema=Fa.TranscriptionStreamDoneType$=Fa.TranscriptionStreamDoneType$outboundSchema=Fa.TranscriptionStreamDoneType$inboundSchema=Fa.TranscriptionStreamDoneType=void 0;Fa.transcriptionStreamDoneToJSON=HAo;Fa.transcriptionStreamDoneFromJSON=VAo;var My=UAo(te()),zAo=ae(),RAr=ee(),AAr=cRe(),IAr=pq();Fa.TranscriptionStreamDoneType={TranscriptionDone:"transcription.done"};Fa.TranscriptionStreamDoneType$inboundSchema=My.nativeEnum(Fa.TranscriptionStreamDoneType);Fa.TranscriptionStreamDoneType$outboundSchema=Fa.TranscriptionStreamDoneType$inboundSchema;var PAr;(function(t){t.inboundSchema=Fa.TranscriptionStreamDoneType$inboundSchema,t.outboundSchema=Fa.TranscriptionStreamDoneType$outboundSchema})(PAr||(Fa.TranscriptionStreamDoneType$=PAr={}));Fa.TranscriptionStreamDone$inboundSchema=(0,RAr.collectExtraKeys)(My.object({model:My.string(),text:My.string(),segments:My.array(AAr.TranscriptionSegmentChunk$inboundSchema).optional(),usage:IAr.UsageInfo$inboundSchema,type:Fa.TranscriptionStreamDoneType$inboundSchema.default("transcription.done"),language:My.nullable(My.string())}).catchall(My.any()),"additionalProperties",!0);Fa.TranscriptionStreamDone$outboundSchema=My.object({model:My.string(),text:My.string(),segments:My.array(AAr.TranscriptionSegmentChunk$outboundSchema).optional(),usage:IAr.UsageInfo$outboundSchema,type:Fa.TranscriptionStreamDoneType$outboundSchema.default("transcription.done"),language:My.nullable(My.string()),additionalProperties:My.record(My.any())}).transform(t=>({...t.additionalProperties,...(0,zAo.remap)(t,{additionalProperties:null})}));var MAr;(function(t){t.inboundSchema=Fa.TranscriptionStreamDone$inboundSchema,t.outboundSchema=Fa.TranscriptionStreamDone$outboundSchema})(MAr||(Fa.TranscriptionStreamDone$=MAr={}));function HAo(t){return JSON.stringify(Fa.TranscriptionStreamDone$outboundSchema.parse(t))}function VAo(t){return(0,RAr.safeParse)(t,e=>Fa.TranscriptionStreamDone$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamDone' from JSON")}});var vut=S(bp=>{"use strict";var JAo=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]}),KAo=bp&&bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WAo=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"&&JAo(r,e,n[o]);return KAo(r,e),r}}();Object.defineProperty(bp,"__esModule",{value:!0});bp.TranscriptionStreamEventTypes$=bp.TranscriptionStreamEventTypes$outboundSchema=bp.TranscriptionStreamEventTypes$inboundSchema=bp.TranscriptionStreamEventTypes=void 0;var GAo=WAo(te());bp.TranscriptionStreamEventTypes={TranscriptionLanguage:"transcription.language",TranscriptionSegment:"transcription.segment",TranscriptionTextDelta:"transcription.text.delta",TranscriptionDone:"transcription.done"};bp.TranscriptionStreamEventTypes$inboundSchema=GAo.nativeEnum(bp.TranscriptionStreamEventTypes);bp.TranscriptionStreamEventTypes$outboundSchema=bp.TranscriptionStreamEventTypes$inboundSchema;var NAr;(function(t){t.inboundSchema=bp.TranscriptionStreamEventTypes$inboundSchema,t.outboundSchema=bp.TranscriptionStreamEventTypes$outboundSchema})(NAr||(bp.TranscriptionStreamEventTypes$=NAr={}))});var wut=S(ka=>{"use strict";var ZAo=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]}),XAo=ka&&ka.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YAo=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"&&ZAo(r,e,n[o]);return XAo(r,e),r}}();Object.defineProperty(ka,"__esModule",{value:!0});ka.TranscriptionStreamLanguage$=ka.TranscriptionStreamLanguage$outboundSchema=ka.TranscriptionStreamLanguage$inboundSchema=ka.TranscriptionStreamLanguageType$=ka.TranscriptionStreamLanguageType$outboundSchema=ka.TranscriptionStreamLanguageType$inboundSchema=ka.TranscriptionStreamLanguageType=void 0;ka.transcriptionStreamLanguageToJSON=QAo;ka.transcriptionStreamLanguageFromJSON=eIo;var Sq=YAo(te()),$Ar=ae(),LAr=ee();ka.TranscriptionStreamLanguageType={TranscriptionLanguage:"transcription.language"};ka.TranscriptionStreamLanguageType$inboundSchema=Sq.nativeEnum(ka.TranscriptionStreamLanguageType);ka.TranscriptionStreamLanguageType$outboundSchema=ka.TranscriptionStreamLanguageType$inboundSchema;var jAr;(function(t){t.inboundSchema=ka.TranscriptionStreamLanguageType$inboundSchema,t.outboundSchema=ka.TranscriptionStreamLanguageType$outboundSchema})(jAr||(ka.TranscriptionStreamLanguageType$=jAr={}));ka.TranscriptionStreamLanguage$inboundSchema=(0,LAr.collectExtraKeys)(Sq.object({type:ka.TranscriptionStreamLanguageType$inboundSchema.default("transcription.language"),audio_language:Sq.string()}).catchall(Sq.any()),"additionalProperties",!0).transform(t=>(0,$Ar.remap)(t,{audio_language:"audioLanguage"}));ka.TranscriptionStreamLanguage$outboundSchema=Sq.object({type:ka.TranscriptionStreamLanguageType$outboundSchema.default("transcription.language"),audioLanguage:Sq.string(),additionalProperties:Sq.record(Sq.any())}).transform(t=>({...t.additionalProperties,...(0,$Ar.remap)(t,{audioLanguage:"audio_language",additionalProperties:null})}));var DAr;(function(t){t.inboundSchema=ka.TranscriptionStreamLanguage$inboundSchema,t.outboundSchema=ka.TranscriptionStreamLanguage$outboundSchema})(DAr||(ka.TranscriptionStreamLanguage$=DAr={}));function QAo(t){return JSON.stringify(ka.TranscriptionStreamLanguage$outboundSchema.parse(t))}function eIo(t){return(0,LAr.safeParse)(t,e=>ka.TranscriptionStreamLanguage$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamLanguage' from JSON")}});var Sut=S(qa=>{"use strict";var tIo=qa&&qa.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rIo=qa&&qa.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nIo=qa&&qa.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&tIo(r,e,n[o]);return rIo(r,e),r}}();Object.defineProperty(qa,"__esModule",{value:!0});qa.TranscriptionStreamSegmentDelta$=qa.TranscriptionStreamSegmentDelta$outboundSchema=qa.TranscriptionStreamSegmentDelta$inboundSchema=qa.TranscriptionStreamSegmentDeltaType$=qa.TranscriptionStreamSegmentDeltaType$outboundSchema=qa.TranscriptionStreamSegmentDeltaType$inboundSchema=qa.TranscriptionStreamSegmentDeltaType=void 0;qa.transcriptionStreamSegmentDeltaToJSON=iIo;qa.transcriptionStreamSegmentDeltaFromJSON=aIo;var i0=nIo(te()),oIo=ae(),qAr=ee();qa.TranscriptionStreamSegmentDeltaType={TranscriptionSegment:"transcription.segment"};qa.TranscriptionStreamSegmentDeltaType$inboundSchema=i0.nativeEnum(qa.TranscriptionStreamSegmentDeltaType);qa.TranscriptionStreamSegmentDeltaType$outboundSchema=qa.TranscriptionStreamSegmentDeltaType$inboundSchema;var FAr;(function(t){t.inboundSchema=qa.TranscriptionStreamSegmentDeltaType$inboundSchema,t.outboundSchema=qa.TranscriptionStreamSegmentDeltaType$outboundSchema})(FAr||(qa.TranscriptionStreamSegmentDeltaType$=FAr={}));qa.TranscriptionStreamSegmentDelta$inboundSchema=(0,qAr.collectExtraKeys)(i0.object({text:i0.string(),start:i0.number(),end:i0.number(),type:qa.TranscriptionStreamSegmentDeltaType$inboundSchema.default("transcription.segment")}).catchall(i0.any()),"additionalProperties",!0);qa.TranscriptionStreamSegmentDelta$outboundSchema=i0.object({text:i0.string(),start:i0.number(),end:i0.number(),type:qa.TranscriptionStreamSegmentDeltaType$outboundSchema.default("transcription.segment"),additionalProperties:i0.record(i0.any())}).transform(t=>({...t.additionalProperties,...(0,oIo.remap)(t,{additionalProperties:null})}));var kAr;(function(t){t.inboundSchema=qa.TranscriptionStreamSegmentDelta$inboundSchema,t.outboundSchema=qa.TranscriptionStreamSegmentDelta$outboundSchema})(kAr||(qa.TranscriptionStreamSegmentDelta$=kAr={}));function iIo(t){return JSON.stringify(qa.TranscriptionStreamSegmentDelta$outboundSchema.parse(t))}function aIo(t){return(0,qAr.safeParse)(t,e=>qa.TranscriptionStreamSegmentDelta$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamSegmentDelta' from JSON")}});var Cut=S(Ba=>{"use strict";var sIo=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]}),uIo=Ba&&Ba.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lIo=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"&&sIo(r,e,n[o]);return uIo(r,e),r}}();Object.defineProperty(Ba,"__esModule",{value:!0});Ba.TranscriptionStreamTextDelta$=Ba.TranscriptionStreamTextDelta$outboundSchema=Ba.TranscriptionStreamTextDelta$inboundSchema=Ba.TranscriptionStreamTextDeltaType$=Ba.TranscriptionStreamTextDeltaType$outboundSchema=Ba.TranscriptionStreamTextDeltaType$inboundSchema=Ba.TranscriptionStreamTextDeltaType=void 0;Ba.transcriptionStreamTextDeltaToJSON=dIo;Ba.transcriptionStreamTextDeltaFromJSON=fIo;var Cq=lIo(te()),cIo=ae(),zAr=ee();Ba.TranscriptionStreamTextDeltaType={TranscriptionTextDelta:"transcription.text.delta"};Ba.TranscriptionStreamTextDeltaType$inboundSchema=Cq.nativeEnum(Ba.TranscriptionStreamTextDeltaType);Ba.TranscriptionStreamTextDeltaType$outboundSchema=Ba.TranscriptionStreamTextDeltaType$inboundSchema;var BAr;(function(t){t.inboundSchema=Ba.TranscriptionStreamTextDeltaType$inboundSchema,t.outboundSchema=Ba.TranscriptionStreamTextDeltaType$outboundSchema})(BAr||(Ba.TranscriptionStreamTextDeltaType$=BAr={}));Ba.TranscriptionStreamTextDelta$inboundSchema=(0,zAr.collectExtraKeys)(Cq.object({text:Cq.string(),type:Ba.TranscriptionStreamTextDeltaType$inboundSchema.default("transcription.text.delta")}).catchall(Cq.any()),"additionalProperties",!0);Ba.TranscriptionStreamTextDelta$outboundSchema=Cq.object({text:Cq.string(),type:Ba.TranscriptionStreamTextDeltaType$outboundSchema.default("transcription.text.delta"),additionalProperties:Cq.record(Cq.any())}).transform(t=>({...t.additionalProperties,...(0,cIo.remap)(t,{additionalProperties:null})}));var UAr;(function(t){t.inboundSchema=Ba.TranscriptionStreamTextDelta$inboundSchema,t.outboundSchema=Ba.TranscriptionStreamTextDelta$outboundSchema})(UAr||(Ba.TranscriptionStreamTextDelta$=UAr={}));function dIo(t){return JSON.stringify(Ba.TranscriptionStreamTextDelta$outboundSchema.parse(t))}function fIo(t){return(0,zAr.safeParse)(t,e=>Ba.TranscriptionStreamTextDelta$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamTextDelta' from JSON")}});var WAr=S(vs=>{"use strict";var pIo=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]}),mIo=vs&&vs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hIo=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"&&pIo(r,e,n[o]);return mIo(r,e),r}}();Object.defineProperty(vs,"__esModule",{value:!0});vs.TranscriptionStreamEvents$=vs.TranscriptionStreamEvents$outboundSchema=vs.TranscriptionStreamEvents$inboundSchema=vs.TranscriptionStreamEventsData$=vs.TranscriptionStreamEventsData$outboundSchema=vs.TranscriptionStreamEventsData$inboundSchema=void 0;vs.transcriptionStreamEventsDataToJSON=gIo;vs.transcriptionStreamEventsDataFromJSON=yIo;vs.transcriptionStreamEventsToJSON=bIo;vs.transcriptionStreamEventsFromJSON=_Io;var Zo=hIo(te()),JAr=ee(),dRe=_ut(),KAr=vut(),fRe=wut(),pRe=Sut(),mRe=Cut();vs.TranscriptionStreamEventsData$inboundSchema=Zo.union([dRe.TranscriptionStreamDone$inboundSchema.and(Zo.object({type:Zo.literal("transcription.done")}).transform(t=>({type:t.type}))),pRe.TranscriptionStreamSegmentDelta$inboundSchema.and(Zo.object({type:Zo.literal("transcription.segment")}).transform(t=>({type:t.type}))),fRe.TranscriptionStreamLanguage$inboundSchema.and(Zo.object({type:Zo.literal("transcription.language")}).transform(t=>({type:t.type}))),mRe.TranscriptionStreamTextDelta$inboundSchema.and(Zo.object({type:Zo.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]);vs.TranscriptionStreamEventsData$outboundSchema=Zo.union([dRe.TranscriptionStreamDone$outboundSchema.and(Zo.object({type:Zo.literal("transcription.done")}).transform(t=>({type:t.type}))),pRe.TranscriptionStreamSegmentDelta$outboundSchema.and(Zo.object({type:Zo.literal("transcription.segment")}).transform(t=>({type:t.type}))),fRe.TranscriptionStreamLanguage$outboundSchema.and(Zo.object({type:Zo.literal("transcription.language")}).transform(t=>({type:t.type}))),mRe.TranscriptionStreamTextDelta$outboundSchema.and(Zo.object({type:Zo.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]);var HAr;(function(t){t.inboundSchema=vs.TranscriptionStreamEventsData$inboundSchema,t.outboundSchema=vs.TranscriptionStreamEventsData$outboundSchema})(HAr||(vs.TranscriptionStreamEventsData$=HAr={}));function gIo(t){return JSON.stringify(vs.TranscriptionStreamEventsData$outboundSchema.parse(t))}function yIo(t){return(0,JAr.safeParse)(t,e=>vs.TranscriptionStreamEventsData$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamEventsData' from JSON")}vs.TranscriptionStreamEvents$inboundSchema=Zo.object({event:KAr.TranscriptionStreamEventTypes$inboundSchema,data:Zo.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:Zo.ZodIssueCode.custom,message:`malformed json: ${r}`}),Zo.NEVER}}).pipe(Zo.union([dRe.TranscriptionStreamDone$inboundSchema.and(Zo.object({type:Zo.literal("transcription.done")}).transform(t=>({type:t.type}))),pRe.TranscriptionStreamSegmentDelta$inboundSchema.and(Zo.object({type:Zo.literal("transcription.segment")}).transform(t=>({type:t.type}))),fRe.TranscriptionStreamLanguage$inboundSchema.and(Zo.object({type:Zo.literal("transcription.language")}).transform(t=>({type:t.type}))),mRe.TranscriptionStreamTextDelta$inboundSchema.and(Zo.object({type:Zo.literal("transcription.text.delta")}).transform(t=>({type:t.type})))]))});vs.TranscriptionStreamEvents$outboundSchema=Zo.object({event:KAr.TranscriptionStreamEventTypes$outboundSchema,data:Zo.union([dRe.TranscriptionStreamDone$outboundSchema.and(Zo.object({type:Zo.literal("transcription.done")}).transform(t=>({type:t.type}))),pRe.TranscriptionStreamSegmentDelta$outboundSchema.and(Zo.object({type:Zo.literal("transcription.segment")}).transform(t=>({type:t.type}))),fRe.TranscriptionStreamLanguage$outboundSchema.and(Zo.object({type:Zo.literal("transcription.language")}).transform(t=>({type:t.type}))),mRe.TranscriptionStreamTextDelta$outboundSchema.and(Zo.object({type:Zo.literal("transcription.text.delta")}).transform(t=>({type:t.type})))])});var VAr;(function(t){t.inboundSchema=vs.TranscriptionStreamEvents$inboundSchema,t.outboundSchema=vs.TranscriptionStreamEvents$outboundSchema})(VAr||(vs.TranscriptionStreamEvents$=VAr={}));function bIo(t){return JSON.stringify(vs.TranscriptionStreamEvents$outboundSchema.parse(t))}function _Io(t){return(0,JAr.safeParse)(t,e=>vs.TranscriptionStreamEvents$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'TranscriptionStreamEvents' from JSON")}});var XAr=S(Ua=>{"use strict";var vIo=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]}),wIo=Ua&&Ua.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SIo=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"&&vIo(r,e,n[o]);return wIo(r,e),r}}();Object.defineProperty(Ua,"__esModule",{value:!0});Ua.UnarchiveFTModelOut$=Ua.UnarchiveFTModelOut$outboundSchema=Ua.UnarchiveFTModelOut$inboundSchema=Ua.UnarchiveFTModelOutObject$=Ua.UnarchiveFTModelOutObject$outboundSchema=Ua.UnarchiveFTModelOutObject$inboundSchema=Ua.UnarchiveFTModelOutObject=void 0;Ua.unarchiveFTModelOutToJSON=xIo;Ua.unarchiveFTModelOutFromJSON=OIo;var RV=SIo(te()),CIo=ee();Ua.UnarchiveFTModelOutObject={Model:"model"};Ua.UnarchiveFTModelOutObject$inboundSchema=RV.nativeEnum(Ua.UnarchiveFTModelOutObject);Ua.UnarchiveFTModelOutObject$outboundSchema=Ua.UnarchiveFTModelOutObject$inboundSchema;var GAr;(function(t){t.inboundSchema=Ua.UnarchiveFTModelOutObject$inboundSchema,t.outboundSchema=Ua.UnarchiveFTModelOutObject$outboundSchema})(GAr||(Ua.UnarchiveFTModelOutObject$=GAr={}));Ua.UnarchiveFTModelOut$inboundSchema=RV.object({id:RV.string(),object:Ua.UnarchiveFTModelOutObject$inboundSchema.default("model"),archived:RV.boolean().default(!1)});Ua.UnarchiveFTModelOut$outboundSchema=RV.object({id:RV.string(),object:Ua.UnarchiveFTModelOutObject$outboundSchema.default("model"),archived:RV.boolean().default(!1)});var ZAr;(function(t){t.inboundSchema=Ua.UnarchiveFTModelOut$inboundSchema,t.outboundSchema=Ua.UnarchiveFTModelOut$outboundSchema})(ZAr||(Ua.UnarchiveFTModelOut$=ZAr={}));function xIo(t){return JSON.stringify(Ua.UnarchiveFTModelOut$outboundSchema.parse(t))}function OIo(t){return(0,CIo.safeParse)(t,e=>Ua.UnarchiveFTModelOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UnarchiveFTModelOut' from JSON")}});var QAr=S(_p=>{"use strict";var TIo=_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]}),EIo=_p&&_p.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PIo=_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"&&TIo(r,e,n[o]);return EIo(r,e),r}}();Object.defineProperty(_p,"__esModule",{value:!0});_p.UpdateFTModelIn$=_p.UpdateFTModelIn$outboundSchema=_p.UpdateFTModelIn$inboundSchema=void 0;_p.updateFTModelInToJSON=RIo;_p.updateFTModelInFromJSON=AIo;var QA=PIo(te()),MIo=ee();_p.UpdateFTModelIn$inboundSchema=QA.object({name:QA.nullable(QA.string()).optional(),description:QA.nullable(QA.string()).optional()});_p.UpdateFTModelIn$outboundSchema=QA.object({name:QA.nullable(QA.string()).optional(),description:QA.nullable(QA.string()).optional()});var YAr;(function(t){t.inboundSchema=_p.UpdateFTModelIn$inboundSchema,t.outboundSchema=_p.UpdateFTModelIn$outboundSchema})(YAr||(_p.UpdateFTModelIn$=YAr={}));function RIo(t){return JSON.stringify(_p.UpdateFTModelIn$outboundSchema.parse(t))}function AIo(t){return(0,MIo.safeParse)(t,e=>_p.UpdateFTModelIn$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UpdateFTModelIn' from JSON")}});var iIr=S(vp=>{"use strict";var IIo=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]}),NIo=vp&&vp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jIo=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"&&IIo(r,e,n[o]);return NIo(r,e),r}}();Object.defineProperty(vp,"__esModule",{value:!0});vp.UploadFileOut$=vp.UploadFileOut$outboundSchema=vp.UploadFileOut$inboundSchema=void 0;vp.uploadFileOutToJSON=$Io;vp.uploadFileOutFromJSON=LIo;var Wl=jIo(te()),tIr=ae(),DIo=ee(),rIr=Nae(),nIr=jae(),oIr=Dae();vp.UploadFileOut$inboundSchema=Wl.object({id:Wl.string(),object:Wl.string(),bytes:Wl.number().int(),created_at:Wl.number().int(),filename:Wl.string(),purpose:rIr.FilePurpose$inboundSchema,sample_type:nIr.SampleType$inboundSchema,num_lines:Wl.nullable(Wl.number().int()).optional(),mimetype:Wl.nullable(Wl.string()).optional(),source:oIr.Source$inboundSchema,signature:Wl.nullable(Wl.string()).optional()}).transform(t=>(0,tIr.remap)(t,{bytes:"sizeBytes",created_at:"createdAt",sample_type:"sampleType",num_lines:"numLines"}));vp.UploadFileOut$outboundSchema=Wl.object({id:Wl.string(),object:Wl.string(),sizeBytes:Wl.number().int(),createdAt:Wl.number().int(),filename:Wl.string(),purpose:rIr.FilePurpose$outboundSchema,sampleType:nIr.SampleType$outboundSchema,numLines:Wl.nullable(Wl.number().int()).optional(),mimetype:Wl.nullable(Wl.string()).optional(),source:oIr.Source$outboundSchema,signature:Wl.nullable(Wl.string()).optional()}).transform(t=>(0,tIr.remap)(t,{sizeBytes:"bytes",createdAt:"created_at",sampleType:"sample_type",numLines:"num_lines"}));var eIr;(function(t){t.inboundSchema=vp.UploadFileOut$inboundSchema,t.outboundSchema=vp.UploadFileOut$outboundSchema})(eIr||(vp.UploadFileOut$=eIr={}));function $Io(t){return JSON.stringify(vp.UploadFileOut$outboundSchema.parse(t))}function LIo(t){return(0,DIo.safeParse)(t,e=>vp.UploadFileOut$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'UploadFileOut' from JSON")}});var lIr=S(ws=>{"use strict";var FIo=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]}),kIo=ws&&ws.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qIo=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"&&FIo(r,e,n[o]);return kIo(r,e),r}}();Object.defineProperty(ws,"__esModule",{value:!0});ws.ValidationError$=ws.ValidationError$outboundSchema=ws.ValidationError$inboundSchema=ws.Loc$=ws.Loc$outboundSchema=ws.Loc$inboundSchema=void 0;ws.locToJSON=BIo;ws.locFromJSON=UIo;ws.validationErrorToJSON=zIo;ws.validationErrorFromJSON=HIo;var wp=qIo(te()),uIr=ee();ws.Loc$inboundSchema=wp.union([wp.string(),wp.number().int()]);ws.Loc$outboundSchema=wp.union([wp.string(),wp.number().int()]);var aIr;(function(t){t.inboundSchema=ws.Loc$inboundSchema,t.outboundSchema=ws.Loc$outboundSchema})(aIr||(ws.Loc$=aIr={}));function BIo(t){return JSON.stringify(ws.Loc$outboundSchema.parse(t))}function UIo(t){return(0,uIr.safeParse)(t,e=>ws.Loc$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'Loc' from JSON")}ws.ValidationError$inboundSchema=wp.object({loc:wp.array(wp.union([wp.string(),wp.number().int()])),msg:wp.string(),type:wp.string()});ws.ValidationError$outboundSchema=wp.object({loc:wp.array(wp.union([wp.string(),wp.number().int()])),msg:wp.string(),type:wp.string()});var sIr;(function(t){t.inboundSchema=ws.ValidationError$inboundSchema,t.outboundSchema=ws.ValidationError$outboundSchema})(sIr||(ws.ValidationError$=sIr={}));function zIo(t){return JSON.stringify(ws.ValidationError$outboundSchema.parse(t))}function HIo(t){return(0,uIr.safeParse)(t,e=>ws.ValidationError$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ValidationError' from JSON")}});var $t=S(pe=>{"use strict";var VIo=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]}),ye=pe&&pe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&VIo(e,t,r)};Object.defineProperty(pe,"__esModule",{value:!0});ye(Cvr(),pe);ye(Evr(),pe);ye(Nvr(),pe);ye(dst(),pe);ye(Cae(),pe);ye(fst(),pe);ye(hSr(),pe);ye(OSr(),pe);ye(ASr(),pe);ye(_st(),pe);ye(DSr(),pe);ye(zA(),pe);ye(pst(),pe);ye(zSr(),pe);ye(WSr(),pe);ye(vst(),pe);ye(wst(),pe);ye(i0r(),pe);ye(Cst(),pe);ye(h0r(),pe);ye(Sst(),pe);ye(fq(),pe);ye(E0r(),pe);ye(CPe(),pe);ye(B0r(),pe);ye(W0r(),pe);ye(oCr(),pe);ye(cCr(),pe);ye(kPe(),pe);ye(vCr(),pe);ye(xCr(),pe);ye(Pst(),pe);ye(ZCr(),pe);ye(ixr(),pe);ye(Mst(),pe);ye(Rst(),pe);ye(BPe(),pe);ye(UPe(),pe);ye(Ast(),pe);ye(rq(),pe);ye(HS(),pe);ye(ost(),pe);ye(jst(),pe);ye(Wxr(),pe);ye(Xxr(),pe);ye(nOr(),pe);ye(Lst(),pe);ye(Nst(),pe);ye(WPe(),pe);ye(Fst(),pe);ye(r9(),pe);ye(ETr(),pe);ye(NTr(),pe);ye(TEr(),pe);ye(IEr(),pe);ye(hq(),pe);ye(BEr(),pe);ye(GEr(),pe);ye(rPr(),pe);ye(uPr(),pe);ye(mPr(),pe);ye(SPr(),pe);ye(iMe(),pe);ye(xPr(),pe);ye(TPr(),pe);ye(Ist(),pe);ye(iq(),pe);ye(eut(),pe);ye(RPr(),pe);ye(IPr(),pe);ye(fV(),pe);ye(tut(),pe);ye(BPr(),pe);ye(JPr(),pe);ye(nut(),pe);ye(rut(),pe);ye(kMe(),pe);ye(zPe(),pe);ye(dPe(),pe);ye(jEe(),pe);ye(Nae(),pe);ye(out(),pe);ye(nMr(),pe);ye(uMr(),pe);ye(fMr(),pe);ye(yMr(),pe);ye(iut(),pe);ye(qPe(),pe);ye(VPe(),pe);ye(aut(),pe);ye(wEe(),pe);ye(hst(),pe);ye(Pae(),pe);ye(kst(),pe);ye(zst(),pe);ye(bst(),pe);ye(eMe(),pe);ye(aq(),pe);ye(sut(),pe);ye(GPe(),pe);ye(sq(),pe);ye(mst(),pe);ye(pV(),pe);ye(Ust(),pe);ye(Tst(),pe);ye(xst(),pe);ye(FMr(),pe);ye(c9(),pe);ye(zMr(),pe);ye(ist(),pe);ye(KMr(),pe);ye(ZMr(),pe);ye(YMr(),pe);ye(cut(),pe);ye(aRr(),pe);ye(lRr(),pe);ye(fRr(),pe);ye(yRr(),pe);ye(Qst(),pe);ye(qst(),pe);ye(Rae(),pe);ye(Bst(),pe);ye(f9(),pe);ye(Vst(),pe);ye(Est(),pe);ye(o9(),pe);ye(pPe(),pe);ye(xRr(),pe);ye(PRr(),pe);ye(put(),pe);ye(NRr(),pe);ye(mut(),pe);ye(hut(),pe);ye(gut(),pe);ye(HRr(),pe);ye(XRr(),pe);ye(yut(),pe);ye(Hst(),pe);ye(dut(),pe);ye(lV(),pe);ye(eAr(),pe);ye($Ee(),pe);ye(Jst(),pe);ye(Kst(),pe);ye(oq(),pe);ye(ast(),pe);ye(Wst(),pe);ye(aAr(),pe);ye(jae(),pe);ye(lAr(),pe);ye(but(),pe);ye(mAr(),pe);ye(_Ar(),pe);ye(fut(),pe);ye(Dae(),pe);ye(Gst(),pe);ye(pj(),pe);ye(yst(),pe);ye(dq(),pe);ye(hV(),pe);ye(fPe(),pe);ye(i9(),pe);ye(kEe(),pe);ye(a9(),pe);ye(cV(),pe);ye(Zst(),pe);ye(Xst(),pe);ye(Aae(),pe);ye(Yst(),pe);ye(Mae(),pe);ye(mj(),pe);ye(rMe(),pe);ye(Tae(),pe);ye(uut(),pe);ye(EAr(),pe);ye(cRe(),pe);ye(_ut(),pe);ye(WAr(),pe);ye(vut(),pe);ye(wut(),pe);ye(Sut(),pe);ye(Cut(),pe);ye(XAr(),pe);ye(QAr(),pe);ye(iIr(),pe);ye(pq(),pe);ye(hj(),pe);ye(lIr(),pe);ye(lut(),pe);ye(d9(),pe);ye(uq(),pe);ye(lq(),pe)});var pIr=S(Oh=>{"use strict";var JIo=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]}),KIo=Oh&&Oh.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dIr=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"&&JIo(r,e,n[o]);return KIo(r,e),r}}();Object.defineProperty(Oh,"__esModule",{value:!0});Oh.HTTPValidationError$=Oh.HTTPValidationError$outboundSchema=Oh.HTTPValidationError$inboundSchema=Oh.HTTPValidationError=void 0;var xq=dIr(te()),fIr=dIr($t()),WIo=pEe(),$ae=class extends WIo.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=$ae;Oh.HTTPValidationError$inboundSchema=xq.object({detail:xq.array(fIr.ValidationError$inboundSchema).optional(),request$:xq.instanceof(Request),response$:xq.instanceof(Response),body$:xq.string()}).transform(t=>new $ae(t,{request:t.request$,response:t.response$,body:t.body$}));Oh.HTTPValidationError$outboundSchema=xq.instanceof($ae).transform(t=>t.data$).pipe(xq.object({detail:xq.array(fIr.ValidationError$outboundSchema).optional()}));var cIr;(function(t){t.inboundSchema=Oh.HTTPValidationError$inboundSchema,t.outboundSchema=Oh.HTTPValidationError$outboundSchema})(cIr||(Oh.HTTPValidationError$=cIr={}))});var Hn=S(ax=>{"use strict";var GIo=ax&&ax.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lae=ax&&ax.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&GIo(e,t,r)};Object.defineProperty(ax,"__esModule",{value:!0});Lae(Mat(),ax);Lae(pIr(),ax);Lae(Qat(),ax);Lae(tst(),ax);Lae(mEe(),ax)});var ur=S(Oq=>{"use strict";var mIr=Oq&&Oq.__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},Fae=Oq&&Oq.__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)},_9,kae,hIr;Object.defineProperty(Oq,"__esModule",{value:!0});Oq.APIPromise=void 0;var xut=class{constructor(e){_9.set(this,void 0),kae.set(this,void 0),this[hIr]="APIPromise",mIr(this,_9,e instanceof Promise?e:Promise.resolve(e),"f"),mIr(this,kae,e instanceof Promise?Fae(this,_9,"f").then(([r])=>r):Promise.resolve(e[0]),"f")}then(e,r){return Fae(this,_9,"f").then(e?([n])=>e(n):void 0,r)}catch(e){return Fae(this,kae,"f").catch(e)}finally(e){return Fae(this,kae,"f").finally(e)}$inspect(){return Fae(this,_9,"f")}};Oq.APIPromise=xut;_9=new WeakMap,kae=new WeakMap,hIr=Symbol.toStringTag});var bIr=S(vj=>{"use strict";var ZIo=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]}),XIo=vj&&vj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Out=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"&&ZIo(r,e,n[o]);return XIo(r,e),r}}();Object.defineProperty(vj,"__esModule",{value:!0});vj.agentsComplete=oNo;var YIo=fr(),qae=Out(ar()),QIo=ae(),eNo=ee(),gIr=sr(),tNo=or(),yIr=Out($t()),rNo=Out(Hn()),nNo=ur();function oNo(t,e,r){return new nNo.APIPromise(iNo(t,e,r))}async function iNo(t,e,r){let n=(0,eNo.safeParse)(e,b=>yIr.AgentsCompletionRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,YIo.encodeJSON)("body",o,{explode:!0}),a=(0,tNo.pathToFunc)("/v1/agents/completions")(),s=new Headers((0,QIo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,gIr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,gIr.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,g={HttpMeta:{Response:h,Request:p}},[y]=await qae.match(qae.json(200,yIr.ChatCompletionResponse$inboundSchema),qae.jsonErr(422,rNo.HTTPValidationError$inboundSchema),qae.fail("4XX"),qae.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var Tq=S(hRe=>{"use strict";Object.defineProperty(hRe,"__esModule",{value:!0});hRe.EventStream=void 0;var Tut=class extends ReadableStream{constructor(e,r){let n=e.getReader(),o=new Uint8Array;super({async pull(i){try{for(;;){let a=sNo(o);if(!a){let l=await n.read();if(l.done)return i.close();o=aNo(o,l.value);continue}let s=o.slice(0,a.index);o=o.slice(a.index+a.length);let u=uNo(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}}}};hRe.EventStream=Tut;function aNo(t,e){let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r}function sNo(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 uNo(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 wIr=S(wj=>{"use strict";var lNo=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]}),cNo=wj&&wj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gRe=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"&&lNo(r,e,n[o]);return cNo(r,e),r}}();Object.defineProperty(wj,"__esModule",{value:!0});wj.agentsStream=_No;var dNo=gRe(te()),fNo=fr(),pNo=Tq(),Bae=gRe(ar()),mNo=ae(),hNo=ee(),_Ir=sr(),gNo=or(),vIr=gRe($t()),yNo=gRe(Hn()),bNo=ur();function _No(t,e,r){return new bNo.APIPromise(vNo(t,e,r))}async function vNo(t,e,r){let n=(0,hNo.safeParse)(e,b=>vIr.AgentsCompletionStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,fNo.encodeJSON)("body",o,{explode:!0}),a=(0,gNo.pathToFunc)("/v1/agents/completions#stream")(),s=new Headers((0,mNo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,_Ir.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,_Ir.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,g={HttpMeta:{Response:h,Request:p}},[y]=await Bae.match(Bae.sse(200,dNo.instanceof(ReadableStream).transform(b=>new pNo.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:vIr.CompletionEvent$inboundSchema.parse(_)}))),Bae.jsonErr(422,yNo.HTTPValidationError$inboundSchema),Bae.fail("4XX"),Bae.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var CIr=S(yRe=>{"use strict";Object.defineProperty(yRe,"__esModule",{value:!0});yRe.Agents=void 0;var wNo=bIr(),SNo=wIr(),CNo=jc(),SIr=xd(),Eut=class extends CNo.ClientSDK{async complete(e,r){return(0,SIr.unwrapAsync)((0,wNo.agentsComplete)(this,e,r))}async stream(e,r){return(0,SIr.unwrapAsync)((0,SNo.agentsStream)(this,e,r))}};yRe.Agents=Eut});var Uae=S(Put=>{"use strict";Object.defineProperty(Put,"__esModule",{value:!0});Put.isReadableStream=xNo;function xNo(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 EIr=S(Sj=>{"use strict";var ONo=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]}),TNo=Sj&&Sj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TIr=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"&&ONo(r,e,n[o]);return TNo(r,e),r}}();Object.defineProperty(Sj,"__esModule",{value:!0});Sj.audioTranscriptionsComplete=NNo;var eI=fr(),Mut=BG(),bRe=TIr(ar()),ENo=ae(),PNo=ee(),xIr=sr(),MNo=or(),OIr=TIr($t()),RNo=ur(),ANo=gj(),INo=Uae();function NNo(t,e,r){return new RNo.APIPromise(jNo(t,e,r))}async function jNo(t,e,r){let n=(0,PNo.safeParse)(e,y=>OIr.AudioTranscriptionRequest$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,eI.appendForm)(i,"model",o.model),o.file!==void 0)if((0,ANo.isBlobLike)(o.file))(0,eI.appendForm)(i,"file",o.file);else if((0,INo.isReadableStream)(o.file.content)){let y=await(0,Mut.readableStreamToArrayBuffer)(o.file.content),b=(0,Mut.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([y],{type:b});(0,eI.appendForm)(i,"file",_,o.file.fileName)}else{let y=(0,Mut.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,eI.appendForm)(i,"file",new Blob([o.file.content],{type:y}),o.file.fileName)}o.file_id!==void 0&&(0,eI.appendForm)(i,"file_id",o.file_id),o.file_url!==void 0&&(0,eI.appendForm)(i,"file_url",o.file_url),o.language!==void 0&&(0,eI.appendForm)(i,"language",o.language),o.stream!==void 0&&(0,eI.appendForm)(i,"stream",o.stream),o.temperature!==void 0&&(0,eI.appendForm)(i,"temperature",o.temperature),o.timestamp_granularities!==void 0&&(0,eI.appendForm)(i,"timestamp_granularities",o.timestamp_granularities);let a=(0,MNo.pathToFunc)("/v1/audio/transcriptions")(),s=new Headers((0,ENo.compactMap)({Accept:"application/json"})),u=await(0,xIr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,xIr.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,[g]=await bRe.match(bRe.json(200,OIr.TranscriptionResponse$inboundSchema),bRe.fail("4XX"),bRe.fail("5XX"))(h,p);return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var RIr=S(Cj=>{"use strict";var DNo=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]}),$No=Cj&&Cj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Aut=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"&&DNo(r,e,n[o]);return $No(r,e),r}}();Object.defineProperty(Cj,"__esModule",{value:!0});Cj.audioTranscriptionsStream=VNo;var LNo=Aut(te()),tI=fr(),FNo=Tq(),Rut=BG(),_Re=Aut(ar()),kNo=ae(),qNo=ee(),PIr=sr(),BNo=or(),MIr=Aut($t()),UNo=ur(),zNo=gj(),HNo=Uae();function VNo(t,e,r){return new UNo.APIPromise(JNo(t,e,r))}async function JNo(t,e,r){let n=(0,qNo.safeParse)(e,y=>MIr.AudioTranscriptionRequestStream$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,tI.appendForm)(i,"model",o.model),o.file!==void 0)if((0,zNo.isBlobLike)(o.file))(0,tI.appendForm)(i,"file",o.file);else if((0,HNo.isReadableStream)(o.file.content)){let y=await(0,Rut.readableStreamToArrayBuffer)(o.file.content),b=(0,Rut.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([y],{type:b});(0,tI.appendForm)(i,"file",_,o.file.fileName)}else{let y=(0,Rut.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,tI.appendForm)(i,"file",new Blob([o.file.content],{type:y}),o.file.fileName)}o.file_id!==void 0&&(0,tI.appendForm)(i,"file_id",o.file_id),o.file_url!==void 0&&(0,tI.appendForm)(i,"file_url",o.file_url),o.language!==void 0&&(0,tI.appendForm)(i,"language",o.language),o.stream!==void 0&&(0,tI.appendForm)(i,"stream",o.stream),o.temperature!==void 0&&(0,tI.appendForm)(i,"temperature",o.temperature),o.timestamp_granularities!==void 0&&(0,tI.appendForm)(i,"timestamp_granularities",o.timestamp_granularities);let a=(0,BNo.pathToFunc)("/v1/audio/transcriptions#stream")(),s=new Headers((0,kNo.compactMap)({Accept:"text/event-stream"})),u=await(0,PIr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,PIr.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,[g]=await _Re.match(_Re.sse(200,LNo.instanceof(ReadableStream).transform(y=>new FNo.EventStream(y,b=>({value:MIr.TranscriptionStreamEvents$inboundSchema.parse(b)})))),_Re.fail("4XX"),_Re.fail("5XX"))(h,p);return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var IIr=S(vRe=>{"use strict";Object.defineProperty(vRe,"__esModule",{value:!0});vRe.Transcriptions=void 0;var KNo=EIr(),WNo=RIr(),GNo=jc(),AIr=xd(),Iut=class extends GNo.ClientSDK{async complete(e,r){return(0,AIr.unwrapAsync)((0,KNo.audioTranscriptionsComplete)(this,e,r))}async stream(e,r){return(0,AIr.unwrapAsync)((0,WNo.audioTranscriptionsStream)(this,e,r))}};vRe.Transcriptions=Iut});var NIr=S(wRe=>{"use strict";Object.defineProperty(wRe,"__esModule",{value:!0});wRe.Audio=void 0;var ZNo=jc(),XNo=IIr(),Nut=class extends ZNo.ClientSDK{get transcriptions(){return this._transcriptions??(this._transcriptions=new XNo.Transcriptions(this._options))}};wRe.Audio=Nut});var $Ir=S(Sp=>{"use strict";var YNo=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]}),QNo=Sp&&Sp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),e1o=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"&&YNo(r,e,n[o]);return QNo(r,e),r}}();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.AgentsApiV1AgentsGetRequest$=Sp.AgentsApiV1AgentsGetRequest$outboundSchema=Sp.AgentsApiV1AgentsGetRequest$inboundSchema=void 0;Sp.agentsApiV1AgentsGetRequestToJSON=r1o;Sp.agentsApiV1AgentsGetRequestFromJSON=n1o;var SRe=e1o(te()),DIr=ae(),t1o=ee();Sp.AgentsApiV1AgentsGetRequest$inboundSchema=SRe.object({agent_id:SRe.string()}).transform(t=>(0,DIr.remap)(t,{agent_id:"agentId"}));Sp.AgentsApiV1AgentsGetRequest$outboundSchema=SRe.object({agentId:SRe.string()}).transform(t=>(0,DIr.remap)(t,{agentId:"agent_id"}));var jIr;(function(t){t.inboundSchema=Sp.AgentsApiV1AgentsGetRequest$inboundSchema,t.outboundSchema=Sp.AgentsApiV1AgentsGetRequest$outboundSchema})(jIr||(Sp.AgentsApiV1AgentsGetRequest$=jIr={}));function r1o(t){return JSON.stringify(Sp.AgentsApiV1AgentsGetRequest$outboundSchema.parse(t))}function n1o(t){return(0,t1o.safeParse)(t,e=>Sp.AgentsApiV1AgentsGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsGetRequest' from JSON")}});var kIr=S(Cp=>{"use strict";var o1o=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]}),i1o=Cp&&Cp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a1o=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"&&o1o(r,e,n[o]);return i1o(r,e),r}}();Object.defineProperty(Cp,"__esModule",{value:!0});Cp.AgentsApiV1AgentsListRequest$=Cp.AgentsApiV1AgentsListRequest$outboundSchema=Cp.AgentsApiV1AgentsListRequest$inboundSchema=void 0;Cp.agentsApiV1AgentsListRequestToJSON=u1o;Cp.agentsApiV1AgentsListRequestFromJSON=l1o;var v9=a1o(te()),FIr=ae(),s1o=ee();Cp.AgentsApiV1AgentsListRequest$inboundSchema=v9.object({page:v9.number().int().default(0),page_size:v9.number().int().default(20)}).transform(t=>(0,FIr.remap)(t,{page_size:"pageSize"}));Cp.AgentsApiV1AgentsListRequest$outboundSchema=v9.object({page:v9.number().int().default(0),pageSize:v9.number().int().default(20)}).transform(t=>(0,FIr.remap)(t,{pageSize:"page_size"}));var LIr;(function(t){t.inboundSchema=Cp.AgentsApiV1AgentsListRequest$inboundSchema,t.outboundSchema=Cp.AgentsApiV1AgentsListRequest$outboundSchema})(LIr||(Cp.AgentsApiV1AgentsListRequest$=LIr={}));function u1o(t){return JSON.stringify(Cp.AgentsApiV1AgentsListRequest$outboundSchema.parse(t))}function l1o(t){return(0,s1o.safeParse)(t,e=>Cp.AgentsApiV1AgentsListRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsListRequest' from JSON")}});var HIr=S(xp=>{"use strict";var c1o=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]}),d1o=xp&&xp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BIr=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"&&c1o(r,e,n[o]);return d1o(r,e),r}}();Object.defineProperty(xp,"__esModule",{value:!0});xp.AgentsApiV1AgentsUpdateRequest$=xp.AgentsApiV1AgentsUpdateRequest$outboundSchema=xp.AgentsApiV1AgentsUpdateRequest$inboundSchema=void 0;xp.agentsApiV1AgentsUpdateRequestToJSON=p1o;xp.agentsApiV1AgentsUpdateRequestFromJSON=m1o;var CRe=BIr(te()),UIr=ae(),f1o=ee(),zIr=BIr($t());xp.AgentsApiV1AgentsUpdateRequest$inboundSchema=CRe.object({agent_id:CRe.string(),AgentUpdateRequest:zIr.AgentUpdateRequest$inboundSchema}).transform(t=>(0,UIr.remap)(t,{agent_id:"agentId",AgentUpdateRequest:"agentUpdateRequest"}));xp.AgentsApiV1AgentsUpdateRequest$outboundSchema=CRe.object({agentId:CRe.string(),agentUpdateRequest:zIr.AgentUpdateRequest$outboundSchema}).transform(t=>(0,UIr.remap)(t,{agentId:"agent_id",agentUpdateRequest:"AgentUpdateRequest"}));var qIr;(function(t){t.inboundSchema=xp.AgentsApiV1AgentsUpdateRequest$inboundSchema,t.outboundSchema=xp.AgentsApiV1AgentsUpdateRequest$outboundSchema})(qIr||(xp.AgentsApiV1AgentsUpdateRequest$=qIr={}));function p1o(t){return JSON.stringify(xp.AgentsApiV1AgentsUpdateRequest$outboundSchema.parse(t))}function m1o(t){return(0,f1o.safeParse)(t,e=>xp.AgentsApiV1AgentsUpdateRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsUpdateRequest' from JSON")}});var KIr=S(Op=>{"use strict";var h1o=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]}),g1o=Op&&Op.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y1o=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"&&h1o(r,e,n[o]);return g1o(r,e),r}}();Object.defineProperty(Op,"__esModule",{value:!0});Op.AgentsApiV1AgentsUpdateVersionRequest$=Op.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema=Op.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema=void 0;Op.agentsApiV1AgentsUpdateVersionRequestToJSON=_1o;Op.agentsApiV1AgentsUpdateVersionRequestFromJSON=v1o;var w9=y1o(te()),JIr=ae(),b1o=ee();Op.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema=w9.object({agent_id:w9.string(),version:w9.number().int()}).transform(t=>(0,JIr.remap)(t,{agent_id:"agentId"}));Op.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema=w9.object({agentId:w9.string(),version:w9.number().int()}).transform(t=>(0,JIr.remap)(t,{agentId:"agent_id"}));var VIr;(function(t){t.inboundSchema=Op.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema,t.outboundSchema=Op.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema})(VIr||(Op.AgentsApiV1AgentsUpdateVersionRequest$=VIr={}));function _1o(t){return JSON.stringify(Op.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema.parse(t))}function v1o(t){return(0,b1o.safeParse)(t,e=>Op.AgentsApiV1AgentsUpdateVersionRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1AgentsUpdateVersionRequest' from JSON")}});var YIr=S(Tp=>{"use strict";var w1o=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]}),S1o=Tp&&Tp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GIr=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"&&w1o(r,e,n[o]);return S1o(r,e),r}}();Object.defineProperty(Tp,"__esModule",{value:!0});Tp.AgentsApiV1ConversationsAppendRequest$=Tp.AgentsApiV1ConversationsAppendRequest$outboundSchema=Tp.AgentsApiV1ConversationsAppendRequest$inboundSchema=void 0;Tp.agentsApiV1ConversationsAppendRequestToJSON=x1o;Tp.agentsApiV1ConversationsAppendRequestFromJSON=O1o;var xRe=GIr(te()),ZIr=ae(),C1o=ee(),XIr=GIr($t());Tp.AgentsApiV1ConversationsAppendRequest$inboundSchema=xRe.object({conversation_id:xRe.string(),ConversationAppendRequest:XIr.ConversationAppendRequest$inboundSchema}).transform(t=>(0,ZIr.remap)(t,{conversation_id:"conversationId",ConversationAppendRequest:"conversationAppendRequest"}));Tp.AgentsApiV1ConversationsAppendRequest$outboundSchema=xRe.object({conversationId:xRe.string(),conversationAppendRequest:XIr.ConversationAppendRequest$outboundSchema}).transform(t=>(0,ZIr.remap)(t,{conversationId:"conversation_id",conversationAppendRequest:"ConversationAppendRequest"}));var WIr;(function(t){t.inboundSchema=Tp.AgentsApiV1ConversationsAppendRequest$inboundSchema,t.outboundSchema=Tp.AgentsApiV1ConversationsAppendRequest$outboundSchema})(WIr||(Tp.AgentsApiV1ConversationsAppendRequest$=WIr={}));function x1o(t){return JSON.stringify(Tp.AgentsApiV1ConversationsAppendRequest$outboundSchema.parse(t))}function O1o(t){return(0,C1o.safeParse)(t,e=>Tp.AgentsApiV1ConversationsAppendRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsAppendRequest' from JSON")}});var nNr=S(Ep=>{"use strict";var T1o=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]}),E1o=Ep&&Ep.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eNr=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"&&T1o(r,e,n[o]);return E1o(r,e),r}}();Object.defineProperty(Ep,"__esModule",{value:!0});Ep.AgentsApiV1ConversationsAppendStreamRequest$=Ep.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema=Ep.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema=void 0;Ep.agentsApiV1ConversationsAppendStreamRequestToJSON=M1o;Ep.agentsApiV1ConversationsAppendStreamRequestFromJSON=R1o;var ORe=eNr(te()),tNr=ae(),P1o=ee(),rNr=eNr($t());Ep.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema=ORe.object({conversation_id:ORe.string(),ConversationAppendStreamRequest:rNr.ConversationAppendStreamRequest$inboundSchema}).transform(t=>(0,tNr.remap)(t,{conversation_id:"conversationId",ConversationAppendStreamRequest:"conversationAppendStreamRequest"}));Ep.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema=ORe.object({conversationId:ORe.string(),conversationAppendStreamRequest:rNr.ConversationAppendStreamRequest$outboundSchema}).transform(t=>(0,tNr.remap)(t,{conversationId:"conversation_id",conversationAppendStreamRequest:"ConversationAppendStreamRequest"}));var QIr;(function(t){t.inboundSchema=Ep.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema,t.outboundSchema=Ep.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema})(QIr||(Ep.AgentsApiV1ConversationsAppendStreamRequest$=QIr={}));function M1o(t){return JSON.stringify(Ep.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema.parse(t))}function R1o(t){return(0,P1o.safeParse)(t,e=>Ep.AgentsApiV1ConversationsAppendStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsAppendStreamRequest' from JSON")}});var lNr=S(Ss=>{"use strict";var A1o=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]}),I1o=Ss&&Ss.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aNr=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"&&A1o(r,e,n[o]);return I1o(r,e),r}}();Object.defineProperty(Ss,"__esModule",{value:!0});Ss.AgentsApiV1ConversationsGetResponseV1ConversationsGet$=Ss.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema=Ss.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema=Ss.AgentsApiV1ConversationsGetRequest$=Ss.AgentsApiV1ConversationsGetRequest$outboundSchema=Ss.AgentsApiV1ConversationsGetRequest$inboundSchema=void 0;Ss.agentsApiV1ConversationsGetRequestToJSON=N1o;Ss.agentsApiV1ConversationsGetRequestFromJSON=j1o;Ss.agentsApiV1ConversationsGetResponseV1ConversationsGetToJSON=D1o;Ss.agentsApiV1ConversationsGetResponseV1ConversationsGetFromJSON=$1o;var S9=aNr(te()),sNr=ae(),uNr=ee(),TRe=aNr($t());Ss.AgentsApiV1ConversationsGetRequest$inboundSchema=S9.object({conversation_id:S9.string()}).transform(t=>(0,sNr.remap)(t,{conversation_id:"conversationId"}));Ss.AgentsApiV1ConversationsGetRequest$outboundSchema=S9.object({conversationId:S9.string()}).transform(t=>(0,sNr.remap)(t,{conversationId:"conversation_id"}));var oNr;(function(t){t.inboundSchema=Ss.AgentsApiV1ConversationsGetRequest$inboundSchema,t.outboundSchema=Ss.AgentsApiV1ConversationsGetRequest$outboundSchema})(oNr||(Ss.AgentsApiV1ConversationsGetRequest$=oNr={}));function N1o(t){return JSON.stringify(Ss.AgentsApiV1ConversationsGetRequest$outboundSchema.parse(t))}function j1o(t){return(0,uNr.safeParse)(t,e=>Ss.AgentsApiV1ConversationsGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsGetRequest' from JSON")}Ss.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema=S9.union([TRe.ModelConversation$inboundSchema,TRe.AgentConversation$inboundSchema]);Ss.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema=S9.union([TRe.ModelConversation$outboundSchema,TRe.AgentConversation$outboundSchema]);var iNr;(function(t){t.inboundSchema=Ss.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema,t.outboundSchema=Ss.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema})(iNr||(Ss.AgentsApiV1ConversationsGetResponseV1ConversationsGet$=iNr={}));function D1o(t){return JSON.stringify(Ss.AgentsApiV1ConversationsGetResponseV1ConversationsGet$outboundSchema.parse(t))}function $1o(t){return(0,uNr.safeParse)(t,e=>Ss.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsGetResponseV1ConversationsGet' from JSON")}});var fNr=S(Pp=>{"use strict";var L1o=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]}),F1o=Pp&&Pp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),k1o=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"&&L1o(r,e,n[o]);return F1o(r,e),r}}();Object.defineProperty(Pp,"__esModule",{value:!0});Pp.AgentsApiV1ConversationsHistoryRequest$=Pp.AgentsApiV1ConversationsHistoryRequest$outboundSchema=Pp.AgentsApiV1ConversationsHistoryRequest$inboundSchema=void 0;Pp.agentsApiV1ConversationsHistoryRequestToJSON=B1o;Pp.agentsApiV1ConversationsHistoryRequestFromJSON=U1o;var ERe=k1o(te()),dNr=ae(),q1o=ee();Pp.AgentsApiV1ConversationsHistoryRequest$inboundSchema=ERe.object({conversation_id:ERe.string()}).transform(t=>(0,dNr.remap)(t,{conversation_id:"conversationId"}));Pp.AgentsApiV1ConversationsHistoryRequest$outboundSchema=ERe.object({conversationId:ERe.string()}).transform(t=>(0,dNr.remap)(t,{conversationId:"conversation_id"}));var cNr;(function(t){t.inboundSchema=Pp.AgentsApiV1ConversationsHistoryRequest$inboundSchema,t.outboundSchema=Pp.AgentsApiV1ConversationsHistoryRequest$outboundSchema})(cNr||(Pp.AgentsApiV1ConversationsHistoryRequest$=cNr={}));function B1o(t){return JSON.stringify(Pp.AgentsApiV1ConversationsHistoryRequest$outboundSchema.parse(t))}function U1o(t){return(0,q1o.safeParse)(t,e=>Pp.AgentsApiV1ConversationsHistoryRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsHistoryRequest' from JSON")}});var bNr=S(Cs=>{"use strict";var z1o=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]}),H1o=Cs&&Cs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hNr=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"&&z1o(r,e,n[o]);return H1o(r,e),r}}();Object.defineProperty(Cs,"__esModule",{value:!0});Cs.ResponseBody$=Cs.ResponseBody$outboundSchema=Cs.ResponseBody$inboundSchema=Cs.AgentsApiV1ConversationsListRequest$=Cs.AgentsApiV1ConversationsListRequest$outboundSchema=Cs.AgentsApiV1ConversationsListRequest$inboundSchema=void 0;Cs.agentsApiV1ConversationsListRequestToJSON=V1o;Cs.agentsApiV1ConversationsListRequestFromJSON=J1o;Cs.responseBodyToJSON=K1o;Cs.responseBodyFromJSON=W1o;var Eq=hNr(te()),gNr=ae(),yNr=ee(),PRe=hNr($t());Cs.AgentsApiV1ConversationsListRequest$inboundSchema=Eq.object({page:Eq.number().int().default(0),page_size:Eq.number().int().default(100)}).transform(t=>(0,gNr.remap)(t,{page_size:"pageSize"}));Cs.AgentsApiV1ConversationsListRequest$outboundSchema=Eq.object({page:Eq.number().int().default(0),pageSize:Eq.number().int().default(100)}).transform(t=>(0,gNr.remap)(t,{pageSize:"page_size"}));var pNr;(function(t){t.inboundSchema=Cs.AgentsApiV1ConversationsListRequest$inboundSchema,t.outboundSchema=Cs.AgentsApiV1ConversationsListRequest$outboundSchema})(pNr||(Cs.AgentsApiV1ConversationsListRequest$=pNr={}));function V1o(t){return JSON.stringify(Cs.AgentsApiV1ConversationsListRequest$outboundSchema.parse(t))}function J1o(t){return(0,yNr.safeParse)(t,e=>Cs.AgentsApiV1ConversationsListRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsListRequest' from JSON")}Cs.ResponseBody$inboundSchema=Eq.union([PRe.ModelConversation$inboundSchema,PRe.AgentConversation$inboundSchema]);Cs.ResponseBody$outboundSchema=Eq.union([PRe.ModelConversation$outboundSchema,PRe.AgentConversation$outboundSchema]);var mNr;(function(t){t.inboundSchema=Cs.ResponseBody$inboundSchema,t.outboundSchema=Cs.ResponseBody$outboundSchema})(mNr||(Cs.ResponseBody$=mNr={}));function K1o(t){return JSON.stringify(Cs.ResponseBody$outboundSchema.parse(t))}function W1o(t){return(0,yNr.safeParse)(t,e=>Cs.ResponseBody$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'ResponseBody' from JSON")}});var wNr=S(Mp=>{"use strict";var G1o=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]}),Z1o=Mp&&Mp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),X1o=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"&&G1o(r,e,n[o]);return Z1o(r,e),r}}();Object.defineProperty(Mp,"__esModule",{value:!0});Mp.AgentsApiV1ConversationsMessagesRequest$=Mp.AgentsApiV1ConversationsMessagesRequest$outboundSchema=Mp.AgentsApiV1ConversationsMessagesRequest$inboundSchema=void 0;Mp.agentsApiV1ConversationsMessagesRequestToJSON=Q1o;Mp.agentsApiV1ConversationsMessagesRequestFromJSON=ejo;var MRe=X1o(te()),vNr=ae(),Y1o=ee();Mp.AgentsApiV1ConversationsMessagesRequest$inboundSchema=MRe.object({conversation_id:MRe.string()}).transform(t=>(0,vNr.remap)(t,{conversation_id:"conversationId"}));Mp.AgentsApiV1ConversationsMessagesRequest$outboundSchema=MRe.object({conversationId:MRe.string()}).transform(t=>(0,vNr.remap)(t,{conversationId:"conversation_id"}));var _Nr;(function(t){t.inboundSchema=Mp.AgentsApiV1ConversationsMessagesRequest$inboundSchema,t.outboundSchema=Mp.AgentsApiV1ConversationsMessagesRequest$outboundSchema})(_Nr||(Mp.AgentsApiV1ConversationsMessagesRequest$=_Nr={}));function Q1o(t){return JSON.stringify(Mp.AgentsApiV1ConversationsMessagesRequest$outboundSchema.parse(t))}function ejo(t){return(0,Y1o.safeParse)(t,e=>Mp.AgentsApiV1ConversationsMessagesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsMessagesRequest' from JSON")}});var TNr=S(Rp=>{"use strict";var tjo=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]}),rjo=Rp&&Rp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CNr=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"&&tjo(r,e,n[o]);return rjo(r,e),r}}();Object.defineProperty(Rp,"__esModule",{value:!0});Rp.AgentsApiV1ConversationsRestartRequest$=Rp.AgentsApiV1ConversationsRestartRequest$outboundSchema=Rp.AgentsApiV1ConversationsRestartRequest$inboundSchema=void 0;Rp.agentsApiV1ConversationsRestartRequestToJSON=ojo;Rp.agentsApiV1ConversationsRestartRequestFromJSON=ijo;var RRe=CNr(te()),xNr=ae(),njo=ee(),ONr=CNr($t());Rp.AgentsApiV1ConversationsRestartRequest$inboundSchema=RRe.object({conversation_id:RRe.string(),ConversationRestartRequest:ONr.ConversationRestartRequest$inboundSchema}).transform(t=>(0,xNr.remap)(t,{conversation_id:"conversationId",ConversationRestartRequest:"conversationRestartRequest"}));Rp.AgentsApiV1ConversationsRestartRequest$outboundSchema=RRe.object({conversationId:RRe.string(),conversationRestartRequest:ONr.ConversationRestartRequest$outboundSchema}).transform(t=>(0,xNr.remap)(t,{conversationId:"conversation_id",conversationRestartRequest:"ConversationRestartRequest"}));var SNr;(function(t){t.inboundSchema=Rp.AgentsApiV1ConversationsRestartRequest$inboundSchema,t.outboundSchema=Rp.AgentsApiV1ConversationsRestartRequest$outboundSchema})(SNr||(Rp.AgentsApiV1ConversationsRestartRequest$=SNr={}));function ojo(t){return JSON.stringify(Rp.AgentsApiV1ConversationsRestartRequest$outboundSchema.parse(t))}function ijo(t){return(0,njo.safeParse)(t,e=>Rp.AgentsApiV1ConversationsRestartRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsRestartRequest' from JSON")}});var ANr=S(Ap=>{"use strict";var ajo=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]}),sjo=Ap&&Ap.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PNr=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"&&ajo(r,e,n[o]);return sjo(r,e),r}}();Object.defineProperty(Ap,"__esModule",{value:!0});Ap.AgentsApiV1ConversationsRestartStreamRequest$=Ap.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema=Ap.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema=void 0;Ap.agentsApiV1ConversationsRestartStreamRequestToJSON=ljo;Ap.agentsApiV1ConversationsRestartStreamRequestFromJSON=cjo;var ARe=PNr(te()),MNr=ae(),ujo=ee(),RNr=PNr($t());Ap.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema=ARe.object({conversation_id:ARe.string(),ConversationRestartStreamRequest:RNr.ConversationRestartStreamRequest$inboundSchema}).transform(t=>(0,MNr.remap)(t,{conversation_id:"conversationId",ConversationRestartStreamRequest:"conversationRestartStreamRequest"}));Ap.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema=ARe.object({conversationId:ARe.string(),conversationRestartStreamRequest:RNr.ConversationRestartStreamRequest$outboundSchema}).transform(t=>(0,MNr.remap)(t,{conversationId:"conversation_id",conversationRestartStreamRequest:"ConversationRestartStreamRequest"}));var ENr;(function(t){t.inboundSchema=Ap.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema,t.outboundSchema=Ap.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema})(ENr||(Ap.AgentsApiV1ConversationsRestartStreamRequest$=ENr={}));function ljo(t){return JSON.stringify(Ap.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema.parse(t))}function cjo(t){return(0,ujo.safeParse)(t,e=>Ap.AgentsApiV1ConversationsRestartStreamRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'AgentsApiV1ConversationsRestartStreamRequest' from JSON")}});var jNr=S(Ip=>{"use strict";var djo=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]}),fjo=Ip&&Ip.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pjo=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"&&djo(r,e,n[o]);return fjo(r,e),r}}();Object.defineProperty(Ip,"__esModule",{value:!0});Ip.DeleteModelV1ModelsModelIdDeleteRequest$=Ip.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=Ip.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=void 0;Ip.deleteModelV1ModelsModelIdDeleteRequestToJSON=hjo;Ip.deleteModelV1ModelsModelIdDeleteRequestFromJSON=gjo;var IRe=pjo(te()),NNr=ae(),mjo=ee();Ip.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema=IRe.object({model_id:IRe.string()}).transform(t=>(0,NNr.remap)(t,{model_id:"modelId"}));Ip.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema=IRe.object({modelId:IRe.string()}).transform(t=>(0,NNr.remap)(t,{modelId:"model_id"}));var INr;(function(t){t.inboundSchema=Ip.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema,t.outboundSchema=Ip.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema})(INr||(Ip.DeleteModelV1ModelsModelIdDeleteRequest$=INr={}));function hjo(t){return JSON.stringify(Ip.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(t))}function gjo(t){return(0,mjo.safeParse)(t,e=>Ip.DeleteModelV1ModelsModelIdDeleteRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'DeleteModelV1ModelsModelIdDeleteRequest' from JSON")}});var LNr=S(Np=>{"use strict";var yjo=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]}),bjo=Np&&Np.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),_jo=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"&&yjo(r,e,n[o]);return bjo(r,e),r}}();Object.defineProperty(Np,"__esModule",{value:!0});Np.FilesApiRoutesDeleteFileRequest$=Np.FilesApiRoutesDeleteFileRequest$outboundSchema=Np.FilesApiRoutesDeleteFileRequest$inboundSchema=void 0;Np.filesApiRoutesDeleteFileRequestToJSON=wjo;Np.filesApiRoutesDeleteFileRequestFromJSON=Sjo;var NRe=_jo(te()),$Nr=ae(),vjo=ee();Np.FilesApiRoutesDeleteFileRequest$inboundSchema=NRe.object({file_id:NRe.string()}).transform(t=>(0,$Nr.remap)(t,{file_id:"fileId"}));Np.FilesApiRoutesDeleteFileRequest$outboundSchema=NRe.object({fileId:NRe.string()}).transform(t=>(0,$Nr.remap)(t,{fileId:"file_id"}));var DNr;(function(t){t.inboundSchema=Np.FilesApiRoutesDeleteFileRequest$inboundSchema,t.outboundSchema=Np.FilesApiRoutesDeleteFileRequest$outboundSchema})(DNr||(Np.FilesApiRoutesDeleteFileRequest$=DNr={}));function wjo(t){return JSON.stringify(Np.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(t))}function Sjo(t){return(0,vjo.safeParse)(t,e=>Np.FilesApiRoutesDeleteFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDeleteFileRequest' from JSON")}});var qNr=S(jp=>{"use strict";var Cjo=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]}),xjo=jp&&jp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ojo=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"&&Cjo(r,e,n[o]);return xjo(r,e),r}}();Object.defineProperty(jp,"__esModule",{value:!0});jp.FilesApiRoutesDownloadFileRequest$=jp.FilesApiRoutesDownloadFileRequest$outboundSchema=jp.FilesApiRoutesDownloadFileRequest$inboundSchema=void 0;jp.filesApiRoutesDownloadFileRequestToJSON=Ejo;jp.filesApiRoutesDownloadFileRequestFromJSON=Pjo;var jRe=Ojo(te()),kNr=ae(),Tjo=ee();jp.FilesApiRoutesDownloadFileRequest$inboundSchema=jRe.object({file_id:jRe.string()}).transform(t=>(0,kNr.remap)(t,{file_id:"fileId"}));jp.FilesApiRoutesDownloadFileRequest$outboundSchema=jRe.object({fileId:jRe.string()}).transform(t=>(0,kNr.remap)(t,{fileId:"file_id"}));var FNr;(function(t){t.inboundSchema=jp.FilesApiRoutesDownloadFileRequest$inboundSchema,t.outboundSchema=jp.FilesApiRoutesDownloadFileRequest$outboundSchema})(FNr||(jp.FilesApiRoutesDownloadFileRequest$=FNr={}));function Ejo(t){return JSON.stringify(jp.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(t))}function Pjo(t){return(0,Tjo.safeParse)(t,e=>jp.FilesApiRoutesDownloadFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesDownloadFileRequest' from JSON")}});var zNr=S(Dp=>{"use strict";var Mjo=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]}),Rjo=Dp&&Dp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ajo=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"&&Mjo(r,e,n[o]);return Rjo(r,e),r}}();Object.defineProperty(Dp,"__esModule",{value:!0});Dp.FilesApiRoutesGetSignedUrlRequest$=Dp.FilesApiRoutesGetSignedUrlRequest$outboundSchema=Dp.FilesApiRoutesGetSignedUrlRequest$inboundSchema=void 0;Dp.filesApiRoutesGetSignedUrlRequestToJSON=Njo;Dp.filesApiRoutesGetSignedUrlRequestFromJSON=jjo;var C9=Ajo(te()),UNr=ae(),Ijo=ee();Dp.FilesApiRoutesGetSignedUrlRequest$inboundSchema=C9.object({file_id:C9.string(),expiry:C9.number().int().default(24)}).transform(t=>(0,UNr.remap)(t,{file_id:"fileId"}));Dp.FilesApiRoutesGetSignedUrlRequest$outboundSchema=C9.object({fileId:C9.string(),expiry:C9.number().int().default(24)}).transform(t=>(0,UNr.remap)(t,{fileId:"file_id"}));var BNr;(function(t){t.inboundSchema=Dp.FilesApiRoutesGetSignedUrlRequest$inboundSchema,t.outboundSchema=Dp.FilesApiRoutesGetSignedUrlRequest$outboundSchema})(BNr||(Dp.FilesApiRoutesGetSignedUrlRequest$=BNr={}));function Njo(t){return JSON.stringify(Dp.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(t))}function jjo(t){return(0,Ijo.safeParse)(t,e=>Dp.FilesApiRoutesGetSignedUrlRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesGetSignedUrlRequest' from JSON")}});var KNr=S(Lp=>{"use strict";var Djo=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]}),$jo=Lp&&Lp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VNr=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"&&Djo(r,e,n[o]);return $jo(r,e),r}}();Object.defineProperty(Lp,"__esModule",{value:!0});Lp.FilesApiRoutesListFilesRequest$=Lp.FilesApiRoutesListFilesRequest$outboundSchema=Lp.FilesApiRoutesListFilesRequest$inboundSchema=void 0;Lp.filesApiRoutesListFilesRequestToJSON=Fjo;Lp.filesApiRoutesListFilesRequestFromJSON=kjo;var $p=VNr(te()),JNr=ae(),Ljo=ee(),x9=VNr($t());Lp.FilesApiRoutesListFilesRequest$inboundSchema=$p.object({page:$p.number().int().default(0),page_size:$p.number().int().default(100),sample_type:$p.nullable($p.array(x9.SampleType$inboundSchema)).optional(),source:$p.nullable($p.array(x9.Source$inboundSchema)).optional(),search:$p.nullable($p.string()).optional(),purpose:$p.nullable(x9.FilePurpose$inboundSchema).optional()}).transform(t=>(0,JNr.remap)(t,{page_size:"pageSize",sample_type:"sampleType"}));Lp.FilesApiRoutesListFilesRequest$outboundSchema=$p.object({page:$p.number().int().default(0),pageSize:$p.number().int().default(100),sampleType:$p.nullable($p.array(x9.SampleType$outboundSchema)).optional(),source:$p.nullable($p.array(x9.Source$outboundSchema)).optional(),search:$p.nullable($p.string()).optional(),purpose:$p.nullable(x9.FilePurpose$outboundSchema).optional()}).transform(t=>(0,JNr.remap)(t,{pageSize:"page_size",sampleType:"sample_type"}));var HNr;(function(t){t.inboundSchema=Lp.FilesApiRoutesListFilesRequest$inboundSchema,t.outboundSchema=Lp.FilesApiRoutesListFilesRequest$outboundSchema})(HNr||(Lp.FilesApiRoutesListFilesRequest$=HNr={}));function Fjo(t){return JSON.stringify(Lp.FilesApiRoutesListFilesRequest$outboundSchema.parse(t))}function kjo(t){return(0,Ljo.safeParse)(t,e=>Lp.FilesApiRoutesListFilesRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesListFilesRequest' from JSON")}});var ZNr=S(Fp=>{"use strict";var qjo=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]}),Bjo=Fp&&Fp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ujo=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"&&qjo(r,e,n[o]);return Bjo(r,e),r}}();Object.defineProperty(Fp,"__esModule",{value:!0});Fp.FilesApiRoutesRetrieveFileRequest$=Fp.FilesApiRoutesRetrieveFileRequest$outboundSchema=Fp.FilesApiRoutesRetrieveFileRequest$inboundSchema=void 0;Fp.filesApiRoutesRetrieveFileRequestToJSON=Hjo;Fp.filesApiRoutesRetrieveFileRequestFromJSON=Vjo;var DRe=Ujo(te()),GNr=ae(),zjo=ee();Fp.FilesApiRoutesRetrieveFileRequest$inboundSchema=DRe.object({file_id:DRe.string()}).transform(t=>(0,GNr.remap)(t,{file_id:"fileId"}));Fp.FilesApiRoutesRetrieveFileRequest$outboundSchema=DRe.object({fileId:DRe.string()}).transform(t=>(0,GNr.remap)(t,{fileId:"file_id"}));var WNr;(function(t){t.inboundSchema=Fp.FilesApiRoutesRetrieveFileRequest$inboundSchema,t.outboundSchema=Fp.FilesApiRoutesRetrieveFileRequest$outboundSchema})(WNr||(Fp.FilesApiRoutesRetrieveFileRequest$=WNr={}));function Hjo(t){return JSON.stringify(Fp.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(t))}function Vjo(t){return(0,zjo.safeParse)(t,e=>Fp.FilesApiRoutesRetrieveFileRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesRetrieveFileRequest' from JSON")}});var e1r=S(kp=>{"use strict";var Jjo=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]}),Kjo=kp&&kp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YNr=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"&&Jjo(r,e,n[o]);return Kjo(r,e),r}}();Object.defineProperty(kp,"__esModule",{value:!0});kp.FilesApiRoutesUploadFileMultiPartBodyParams$=kp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=kp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=void 0;kp.filesApiRoutesUploadFileMultiPartBodyParamsToJSON=Zjo;kp.filesApiRoutesUploadFileMultiPartBodyParamsFromJSON=Xjo;var QNr=YNr(te()),Wjo=ee(),Gjo=gj(),$Re=YNr($t());kp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema=QNr.object({purpose:$Re.FilePurpose$inboundSchema.optional(),file:$Re.FileT$inboundSchema});kp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema=QNr.object({purpose:$Re.FilePurpose$outboundSchema.optional(),file:$Re.FileT$outboundSchema.or(Gjo.blobLikeSchema)});var XNr;(function(t){t.inboundSchema=kp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema,t.outboundSchema=kp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema})(XNr||(kp.FilesApiRoutesUploadFileMultiPartBodyParams$=XNr={}));function Zjo(t){return JSON.stringify(kp.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(t))}function Xjo(t){return(0,Wjo.safeParse)(t,e=>kp.FilesApiRoutesUploadFileMultiPartBodyParams$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'FilesApiRoutesUploadFileMultiPartBodyParams' from JSON")}});var n1r=S(qp=>{"use strict";var Yjo=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]}),Qjo=qp&&qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eDo=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"&&Yjo(r,e,n[o]);return Qjo(r,e),r}}();Object.defineProperty(qp,"__esModule",{value:!0});qp.JobsApiRoutesBatchCancelBatchJobRequest$=qp.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=qp.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=void 0;qp.jobsApiRoutesBatchCancelBatchJobRequestToJSON=rDo;qp.jobsApiRoutesBatchCancelBatchJobRequestFromJSON=nDo;var LRe=eDo(te()),r1r=ae(),tDo=ee();qp.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema=LRe.object({job_id:LRe.string()}).transform(t=>(0,r1r.remap)(t,{job_id:"jobId"}));qp.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema=LRe.object({jobId:LRe.string()}).transform(t=>(0,r1r.remap)(t,{jobId:"job_id"}));var t1r;(function(t){t.inboundSchema=qp.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema,t.outboundSchema=qp.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema})(t1r||(qp.JobsApiRoutesBatchCancelBatchJobRequest$=t1r={}));function rDo(t){return JSON.stringify(qp.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(t))}function nDo(t){return(0,tDo.safeParse)(t,e=>qp.JobsApiRoutesBatchCancelBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchCancelBatchJobRequest' from JSON")}});var a1r=S(Bp=>{"use strict";var oDo=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]}),iDo=Bp&&Bp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aDo=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"&&oDo(r,e,n[o]);return iDo(r,e),r}}();Object.defineProperty(Bp,"__esModule",{value:!0});Bp.JobsApiRoutesBatchGetBatchJobRequest$=Bp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=Bp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=void 0;Bp.jobsApiRoutesBatchGetBatchJobRequestToJSON=uDo;Bp.jobsApiRoutesBatchGetBatchJobRequestFromJSON=lDo;var FRe=aDo(te()),i1r=ae(),sDo=ee();Bp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema=FRe.object({job_id:FRe.string()}).transform(t=>(0,i1r.remap)(t,{job_id:"jobId"}));Bp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema=FRe.object({jobId:FRe.string()}).transform(t=>(0,i1r.remap)(t,{jobId:"job_id"}));var o1r;(function(t){t.inboundSchema=Bp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema,t.outboundSchema=Bp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema})(o1r||(Bp.JobsApiRoutesBatchGetBatchJobRequest$=o1r={}));function uDo(t){return JSON.stringify(Bp.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(t))}function lDo(t){return(0,sDo.safeParse)(t,e=>Bp.JobsApiRoutesBatchGetBatchJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobRequest' from JSON")}});var d1r=S(Up=>{"use strict";var cDo=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]}),dDo=Up&&Up.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),u1r=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"&&cDo(r,e,n[o]);return dDo(r,e),r}}();Object.defineProperty(Up,"__esModule",{value:!0});Up.JobsApiRoutesBatchGetBatchJobsRequest$=Up.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Up.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=void 0;Up.jobsApiRoutesBatchGetBatchJobsRequestToJSON=pDo;Up.jobsApiRoutesBatchGetBatchJobsRequestFromJSON=mDo;var Js=u1r(te()),l1r=ae(),fDo=ee(),c1r=u1r($t());Up.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema=Js.object({page:Js.number().int().default(0),page_size:Js.number().int().default(100),model:Js.nullable(Js.string()).optional(),agent_id:Js.nullable(Js.string()).optional(),metadata:Js.nullable(Js.record(Js.any())).optional(),created_after:Js.nullable(Js.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:Js.boolean().default(!1),status:Js.nullable(Js.array(c1r.BatchJobStatus$inboundSchema)).optional()}).transform(t=>(0,l1r.remap)(t,{page_size:"pageSize",agent_id:"agentId",created_after:"createdAfter",created_by_me:"createdByMe"}));Up.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema=Js.object({page:Js.number().int().default(0),pageSize:Js.number().int().default(100),model:Js.nullable(Js.string()).optional(),agentId:Js.nullable(Js.string()).optional(),metadata:Js.nullable(Js.record(Js.any())).optional(),createdAfter:Js.nullable(Js.date().transform(t=>t.toISOString())).optional(),createdByMe:Js.boolean().default(!1),status:Js.nullable(Js.array(c1r.BatchJobStatus$outboundSchema)).optional()}).transform(t=>(0,l1r.remap)(t,{pageSize:"page_size",agentId:"agent_id",createdAfter:"created_after",createdByMe:"created_by_me"}));var s1r;(function(t){t.inboundSchema=Up.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema,t.outboundSchema=Up.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema})(s1r||(Up.JobsApiRoutesBatchGetBatchJobsRequest$=s1r={}));function pDo(t){return JSON.stringify(Up.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.parse(t))}function mDo(t){return(0,fDo.safeParse)(t,e=>Up.JobsApiRoutesBatchGetBatchJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesBatchGetBatchJobsRequest' from JSON")}});var m1r=S(zp=>{"use strict";var hDo=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]}),gDo=zp&&zp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yDo=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"&&hDo(r,e,n[o]);return gDo(r,e),r}}();Object.defineProperty(zp,"__esModule",{value:!0});zp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=zp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=zp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=void 0;zp.jobsApiRoutesFineTuningArchiveFineTunedModelRequestToJSON=_Do;zp.jobsApiRoutesFineTuningArchiveFineTunedModelRequestFromJSON=vDo;var kRe=yDo(te()),p1r=ae(),bDo=ee();zp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema=kRe.object({model_id:kRe.string()}).transform(t=>(0,p1r.remap)(t,{model_id:"modelId"}));zp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema=kRe.object({modelId:kRe.string()}).transform(t=>(0,p1r.remap)(t,{modelId:"model_id"}));var f1r;(function(t){t.inboundSchema=zp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=zp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema})(f1r||(zp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$=f1r={}));function _Do(t){return JSON.stringify(zp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(t))}function vDo(t){return(0,bDo.safeParse)(t,e=>zp.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningArchiveFineTunedModelRequest' from JSON")}});var v1r=S(xs=>{"use strict";var wDo=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]}),SDo=xs&&xs.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y1r=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"&&wDo(r,e,n[o]);return SDo(r,e),r}}();Object.defineProperty(xs,"__esModule",{value:!0});xs.JobsApiRoutesFineTuningCancelFineTuningJobResponse$=xs.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema=xs.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema=xs.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=xs.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=xs.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=void 0;xs.jobsApiRoutesFineTuningCancelFineTuningJobRequestToJSON=CDo;xs.jobsApiRoutesFineTuningCancelFineTuningJobRequestFromJSON=xDo;xs.jobsApiRoutesFineTuningCancelFineTuningJobResponseToJSON=ODo;xs.jobsApiRoutesFineTuningCancelFineTuningJobResponseFromJSON=TDo;var F_=y1r(te()),b1r=ae(),_1r=ee(),qRe=y1r($t());xs.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema=F_.object({job_id:F_.string()}).transform(t=>(0,b1r.remap)(t,{job_id:"jobId"}));xs.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema=F_.object({jobId:F_.string()}).transform(t=>(0,b1r.remap)(t,{jobId:"job_id"}));var h1r;(function(t){t.inboundSchema=xs.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema,t.outboundSchema=xs.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema})(h1r||(xs.JobsApiRoutesFineTuningCancelFineTuningJobRequest$=h1r={}));function CDo(t){return JSON.stringify(xs.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(t))}function xDo(t){return(0,_1r.safeParse)(t,e=>xs.JobsApiRoutesFineTuningCancelFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobRequest' from JSON")}xs.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema=F_.union([qRe.ClassifierDetailedJobOut$inboundSchema.and(F_.object({job_type:F_.literal("classifier")}).transform(t=>({jobType:t.job_type}))),qRe.CompletionDetailedJobOut$inboundSchema.and(F_.object({job_type:F_.literal("completion")}).transform(t=>({jobType:t.job_type})))]);xs.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema=F_.union([qRe.ClassifierDetailedJobOut$outboundSchema.and(F_.object({jobType:F_.literal("classifier")}).transform(t=>({job_type:t.jobType}))),qRe.CompletionDetailedJobOut$outboundSchema.and(F_.object({jobType:F_.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var g1r;(function(t){t.inboundSchema=xs.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema,t.outboundSchema=xs.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema})(g1r||(xs.JobsApiRoutesFineTuningCancelFineTuningJobResponse$=g1r={}));function ODo(t){return JSON.stringify(xs.JobsApiRoutesFineTuningCancelFineTuningJobResponse$outboundSchema.parse(t))}function TDo(t){return(0,_1r.safeParse)(t,e=>xs.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCancelFineTuningJobResponse' from JSON")}});var O1r=S(Os=>{"use strict";var EDo=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]}),PDo=Os&&Os.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C1r=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"&&EDo(r,e,n[o]);return PDo(r,e),r}}();Object.defineProperty(Os,"__esModule",{value:!0});Os.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=Os.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=Os.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=Os.One$=Os.One$outboundSchema=Os.One$inboundSchema=void 0;Os.oneToJSON=MDo;Os.oneFromJSON=RDo;Os.jobsApiRoutesFineTuningCreateFineTuningJobResponseToJSON=ADo;Os.jobsApiRoutesFineTuningCreateFineTuningJobResponseFromJSON=IDo;var $c=C1r(te()),x1r=ee(),rI=C1r($t());Os.One$inboundSchema=$c.union([rI.ClassifierJobOut$inboundSchema.and($c.object({job_type:$c.literal("classifier")}).transform(t=>({jobType:t.job_type}))),rI.CompletionJobOut$inboundSchema.and($c.object({job_type:$c.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Os.One$outboundSchema=$c.union([rI.ClassifierJobOut$outboundSchema.and($c.object({jobType:$c.literal("classifier")}).transform(t=>({job_type:t.jobType}))),rI.CompletionJobOut$outboundSchema.and($c.object({jobType:$c.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var w1r;(function(t){t.inboundSchema=Os.One$inboundSchema,t.outboundSchema=Os.One$outboundSchema})(w1r||(Os.One$=w1r={}));function MDo(t){return JSON.stringify(Os.One$outboundSchema.parse(t))}function RDo(t){return(0,x1r.safeParse)(t,e=>Os.One$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'One' from JSON")}Os.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema=$c.union([rI.LegacyJobMetadataOut$inboundSchema,$c.union([rI.ClassifierJobOut$inboundSchema.and($c.object({job_type:$c.literal("classifier")}).transform(t=>({jobType:t.job_type}))),rI.CompletionJobOut$inboundSchema.and($c.object({job_type:$c.literal("completion")}).transform(t=>({jobType:t.job_type})))])]);Os.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema=$c.union([rI.LegacyJobMetadataOut$outboundSchema,$c.union([rI.ClassifierJobOut$outboundSchema.and($c.object({jobType:$c.literal("classifier")}).transform(t=>({job_type:t.jobType}))),rI.CompletionJobOut$outboundSchema.and($c.object({jobType:$c.literal("completion")}).transform(t=>({job_type:t.jobType})))])]);var S1r;(function(t){t.inboundSchema=Os.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema,t.outboundSchema=Os.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema})(S1r||(Os.JobsApiRoutesFineTuningCreateFineTuningJobResponse$=S1r={}));function ADo(t){return JSON.stringify(Os.JobsApiRoutesFineTuningCreateFineTuningJobResponse$outboundSchema.parse(t))}function IDo(t){return(0,x1r.safeParse)(t,e=>Os.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningCreateFineTuningJobResponse' from JSON")}});var A1r=S(Ts=>{"use strict";var NDo=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]}),jDo=Ts&&Ts.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),P1r=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"&&NDo(r,e,n[o]);return jDo(r,e),r}}();Object.defineProperty(Ts,"__esModule",{value:!0});Ts.JobsApiRoutesFineTuningGetFineTuningJobResponse$=Ts.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema=Ts.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema=Ts.JobsApiRoutesFineTuningGetFineTuningJobRequest$=Ts.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=Ts.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=void 0;Ts.jobsApiRoutesFineTuningGetFineTuningJobRequestToJSON=DDo;Ts.jobsApiRoutesFineTuningGetFineTuningJobRequestFromJSON=$Do;Ts.jobsApiRoutesFineTuningGetFineTuningJobResponseToJSON=LDo;Ts.jobsApiRoutesFineTuningGetFineTuningJobResponseFromJSON=FDo;var k_=P1r(te()),M1r=ae(),R1r=ee(),BRe=P1r($t());Ts.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema=k_.object({job_id:k_.string()}).transform(t=>(0,M1r.remap)(t,{job_id:"jobId"}));Ts.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema=k_.object({jobId:k_.string()}).transform(t=>(0,M1r.remap)(t,{jobId:"job_id"}));var T1r;(function(t){t.inboundSchema=Ts.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema,t.outboundSchema=Ts.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema})(T1r||(Ts.JobsApiRoutesFineTuningGetFineTuningJobRequest$=T1r={}));function DDo(t){return JSON.stringify(Ts.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(t))}function $Do(t){return(0,R1r.safeParse)(t,e=>Ts.JobsApiRoutesFineTuningGetFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobRequest' from JSON")}Ts.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema=k_.union([BRe.ClassifierDetailedJobOut$inboundSchema.and(k_.object({job_type:k_.literal("classifier")}).transform(t=>({jobType:t.job_type}))),BRe.CompletionDetailedJobOut$inboundSchema.and(k_.object({job_type:k_.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Ts.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema=k_.union([BRe.ClassifierDetailedJobOut$outboundSchema.and(k_.object({jobType:k_.literal("classifier")}).transform(t=>({job_type:t.jobType}))),BRe.CompletionDetailedJobOut$outboundSchema.and(k_.object({jobType:k_.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var E1r;(function(t){t.inboundSchema=Ts.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema,t.outboundSchema=Ts.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema})(E1r||(Ts.JobsApiRoutesFineTuningGetFineTuningJobResponse$=E1r={}));function LDo(t){return JSON.stringify(Ts.JobsApiRoutesFineTuningGetFineTuningJobResponse$outboundSchema.parse(t))}function FDo(t){return(0,R1r.safeParse)(t,e=>Ts.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobResponse' from JSON")}});var D1r=S(za=>{"use strict";var kDo=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]}),qDo=za&&za.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),BDo=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"&&kDo(r,e,n[o]);return qDo(r,e),r}}();Object.defineProperty(za,"__esModule",{value:!0});za.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=za.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=za.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=za.Status$=za.Status$outboundSchema=za.Status$inboundSchema=za.Status=void 0;za.jobsApiRoutesFineTuningGetFineTuningJobsRequestToJSON=zDo;za.jobsApiRoutesFineTuningGetFineTuningJobsRequestFromJSON=HDo;var ki=BDo(te()),j1r=ae(),UDo=ee();za.Status={Queued:"QUEUED",Started:"STARTED",Validating:"VALIDATING",Validated:"VALIDATED",Running:"RUNNING",FailedValidation:"FAILED_VALIDATION",Failed:"FAILED",Success:"SUCCESS",Cancelled:"CANCELLED",CancellationRequested:"CANCELLATION_REQUESTED"};za.Status$inboundSchema=ki.nativeEnum(za.Status);za.Status$outboundSchema=za.Status$inboundSchema;var I1r;(function(t){t.inboundSchema=za.Status$inboundSchema,t.outboundSchema=za.Status$outboundSchema})(I1r||(za.Status$=I1r={}));za.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema=ki.object({page:ki.number().int().default(0),page_size:ki.number().int().default(100),model:ki.nullable(ki.string()).optional(),created_after:ki.nullable(ki.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_before:ki.nullable(ki.string().datetime({offset:!0}).transform(t=>new Date(t))).optional(),created_by_me:ki.boolean().default(!1),status:ki.nullable(za.Status$inboundSchema).optional(),wandb_project:ki.nullable(ki.string()).optional(),wandb_name:ki.nullable(ki.string()).optional(),suffix:ki.nullable(ki.string()).optional()}).transform(t=>(0,j1r.remap)(t,{page_size:"pageSize",created_after:"createdAfter",created_before:"createdBefore",created_by_me:"createdByMe",wandb_project:"wandbProject",wandb_name:"wandbName"}));za.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema=ki.object({page:ki.number().int().default(0),pageSize:ki.number().int().default(100),model:ki.nullable(ki.string()).optional(),createdAfter:ki.nullable(ki.date().transform(t=>t.toISOString())).optional(),createdBefore:ki.nullable(ki.date().transform(t=>t.toISOString())).optional(),createdByMe:ki.boolean().default(!1),status:ki.nullable(za.Status$outboundSchema).optional(),wandbProject:ki.nullable(ki.string()).optional(),wandbName:ki.nullable(ki.string()).optional(),suffix:ki.nullable(ki.string()).optional()}).transform(t=>(0,j1r.remap)(t,{pageSize:"page_size",createdAfter:"created_after",createdBefore:"created_before",createdByMe:"created_by_me",wandbProject:"wandb_project",wandbName:"wandb_name"}));var N1r;(function(t){t.inboundSchema=za.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema,t.outboundSchema=za.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema})(N1r||(za.JobsApiRoutesFineTuningGetFineTuningJobsRequest$=N1r={}));function zDo(t){return JSON.stringify(za.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.parse(t))}function HDo(t){return(0,UDo.safeParse)(t,e=>za.JobsApiRoutesFineTuningGetFineTuningJobsRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningGetFineTuningJobsRequest' from JSON")}});var B1r=S(Es=>{"use strict";var VDo=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]}),JDo=Es&&Es.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),F1r=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"&&VDo(r,e,n[o]);return JDo(r,e),r}}();Object.defineProperty(Es,"__esModule",{value:!0});Es.JobsApiRoutesFineTuningStartFineTuningJobResponse$=Es.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema=Es.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema=Es.JobsApiRoutesFineTuningStartFineTuningJobRequest$=Es.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=Es.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=void 0;Es.jobsApiRoutesFineTuningStartFineTuningJobRequestToJSON=KDo;Es.jobsApiRoutesFineTuningStartFineTuningJobRequestFromJSON=WDo;Es.jobsApiRoutesFineTuningStartFineTuningJobResponseToJSON=GDo;Es.jobsApiRoutesFineTuningStartFineTuningJobResponseFromJSON=ZDo;var q_=F1r(te()),k1r=ae(),q1r=ee(),URe=F1r($t());Es.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema=q_.object({job_id:q_.string()}).transform(t=>(0,k1r.remap)(t,{job_id:"jobId"}));Es.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema=q_.object({jobId:q_.string()}).transform(t=>(0,k1r.remap)(t,{jobId:"job_id"}));var $1r;(function(t){t.inboundSchema=Es.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema,t.outboundSchema=Es.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema})($1r||(Es.JobsApiRoutesFineTuningStartFineTuningJobRequest$=$1r={}));function KDo(t){return JSON.stringify(Es.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(t))}function WDo(t){return(0,q1r.safeParse)(t,e=>Es.JobsApiRoutesFineTuningStartFineTuningJobRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobRequest' from JSON")}Es.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema=q_.union([URe.ClassifierDetailedJobOut$inboundSchema.and(q_.object({job_type:q_.literal("classifier")}).transform(t=>({jobType:t.job_type}))),URe.CompletionDetailedJobOut$inboundSchema.and(q_.object({job_type:q_.literal("completion")}).transform(t=>({jobType:t.job_type})))]);Es.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema=q_.union([URe.ClassifierDetailedJobOut$outboundSchema.and(q_.object({jobType:q_.literal("classifier")}).transform(t=>({job_type:t.jobType}))),URe.CompletionDetailedJobOut$outboundSchema.and(q_.object({jobType:q_.literal("completion")}).transform(t=>({job_type:t.jobType})))]);var L1r;(function(t){t.inboundSchema=Es.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema,t.outboundSchema=Es.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema})(L1r||(Es.JobsApiRoutesFineTuningStartFineTuningJobResponse$=L1r={}));function GDo(t){return JSON.stringify(Es.JobsApiRoutesFineTuningStartFineTuningJobResponse$outboundSchema.parse(t))}function ZDo(t){return(0,q1r.safeParse)(t,e=>Es.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningStartFineTuningJobResponse' from JSON")}});var H1r=S(Hp=>{"use strict";var XDo=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]}),YDo=Hp&&Hp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QDo=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"&&XDo(r,e,n[o]);return YDo(r,e),r}}();Object.defineProperty(Hp,"__esModule",{value:!0});Hp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=Hp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=Hp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=void 0;Hp.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestToJSON=t$o;Hp.jobsApiRoutesFineTuningUnarchiveFineTunedModelRequestFromJSON=r$o;var zRe=QDo(te()),z1r=ae(),e$o=ee();Hp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema=zRe.object({model_id:zRe.string()}).transform(t=>(0,z1r.remap)(t,{model_id:"modelId"}));Hp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema=zRe.object({modelId:zRe.string()}).transform(t=>(0,z1r.remap)(t,{modelId:"model_id"}));var U1r;(function(t){t.inboundSchema=Hp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema,t.outboundSchema=Hp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema})(U1r||(Hp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$=U1r={}));function t$o(t){return JSON.stringify(Hp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(t))}function r$o(t){return(0,e$o.safeParse)(t,e=>Hp.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest' from JSON")}});var Z1r=S(Ps=>{"use strict";var n$o=Ps&&Ps.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),o$o=Ps&&Ps.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K1r=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"&&n$o(r,e,n[o]);return o$o(r,e),r}}();Object.defineProperty(Ps,"__esModule",{value:!0});Ps.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$=Ps.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema=Ps.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema=Ps.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=Ps.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=Ps.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=void 0;Ps.jobsApiRoutesFineTuningUpdateFineTunedModelRequestToJSON=i$o;Ps.jobsApiRoutesFineTuningUpdateFineTunedModelRequestFromJSON=a$o;Ps.jobsApiRoutesFineTuningUpdateFineTunedModelResponseToJSON=s$o;Ps.jobsApiRoutesFineTuningUpdateFineTunedModelResponseFromJSON=u$o;var B_=K1r(te()),W1r=ae(),G1r=ee(),O9=K1r($t());Ps.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema=B_.object({model_id:B_.string(),UpdateFTModelIn:O9.UpdateFTModelIn$inboundSchema}).transform(t=>(0,W1r.remap)(t,{model_id:"modelId",UpdateFTModelIn:"updateFTModelIn"}));Ps.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema=B_.object({modelId:B_.string(),updateFTModelIn:O9.UpdateFTModelIn$outboundSchema}).transform(t=>(0,W1r.remap)(t,{modelId:"model_id",updateFTModelIn:"UpdateFTModelIn"}));var V1r;(function(t){t.inboundSchema=Ps.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema,t.outboundSchema=Ps.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema})(V1r||(Ps.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$=V1r={}));function i$o(t){return JSON.stringify(Ps.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(t))}function a$o(t){return(0,G1r.safeParse)(t,e=>Ps.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelRequest' from JSON")}Ps.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema=B_.union([O9.ClassifierFTModelOut$inboundSchema.and(B_.object({model_type:B_.literal("classifier")}).transform(t=>({modelType:t.model_type}))),O9.CompletionFTModelOut$inboundSchema.and(B_.object({model_type:B_.literal("completion")}).transform(t=>({modelType:t.model_type})))]);Ps.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema=B_.union([O9.ClassifierFTModelOut$outboundSchema.and(B_.object({modelType:B_.literal("classifier")}).transform(t=>({model_type:t.modelType}))),O9.CompletionFTModelOut$outboundSchema.and(B_.object({modelType:B_.literal("completion")}).transform(t=>({model_type:t.modelType})))]);var J1r;(function(t){t.inboundSchema=Ps.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema,t.outboundSchema=Ps.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema})(J1r||(Ps.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$=J1r={}));function s$o(t){return JSON.stringify(Ps.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$outboundSchema.parse(t))}function u$o(t){return(0,G1r.safeParse)(t,e=>Ps.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'JobsApiRoutesFineTuningUpdateFineTunedModelResponse' from JSON")}});var Q1r=S(Vp=>{"use strict";var l$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]}),c$o=Vp&&Vp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),d$o=Vp&&Vp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&l$o(r,e,n[o]);return c$o(r,e),r}}();Object.defineProperty(Vp,"__esModule",{value:!0});Vp.LibrariesDeleteV1Request$=Vp.LibrariesDeleteV1Request$outboundSchema=Vp.LibrariesDeleteV1Request$inboundSchema=void 0;Vp.librariesDeleteV1RequestToJSON=p$o;Vp.librariesDeleteV1RequestFromJSON=m$o;var HRe=d$o(te()),Y1r=ae(),f$o=ee();Vp.LibrariesDeleteV1Request$inboundSchema=HRe.object({library_id:HRe.string()}).transform(t=>(0,Y1r.remap)(t,{library_id:"libraryId"}));Vp.LibrariesDeleteV1Request$outboundSchema=HRe.object({libraryId:HRe.string()}).transform(t=>(0,Y1r.remap)(t,{libraryId:"library_id"}));var X1r;(function(t){t.inboundSchema=Vp.LibrariesDeleteV1Request$inboundSchema,t.outboundSchema=Vp.LibrariesDeleteV1Request$outboundSchema})(X1r||(Vp.LibrariesDeleteV1Request$=X1r={}));function p$o(t){return JSON.stringify(Vp.LibrariesDeleteV1Request$outboundSchema.parse(t))}function m$o(t){return(0,f$o.safeParse)(t,e=>Vp.LibrariesDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDeleteV1Request' from JSON")}});var rjr=S(Jp=>{"use strict";var h$o=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]}),g$o=Jp&&Jp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y$o=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"&&h$o(r,e,n[o]);return g$o(r,e),r}}();Object.defineProperty(Jp,"__esModule",{value:!0});Jp.LibrariesDocumentsDeleteV1Request$=Jp.LibrariesDocumentsDeleteV1Request$outboundSchema=Jp.LibrariesDocumentsDeleteV1Request$inboundSchema=void 0;Jp.librariesDocumentsDeleteV1RequestToJSON=_$o;Jp.librariesDocumentsDeleteV1RequestFromJSON=v$o;var T9=y$o(te()),tjr=ae(),b$o=ee();Jp.LibrariesDocumentsDeleteV1Request$inboundSchema=T9.object({library_id:T9.string(),document_id:T9.string()}).transform(t=>(0,tjr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Jp.LibrariesDocumentsDeleteV1Request$outboundSchema=T9.object({libraryId:T9.string(),documentId:T9.string()}).transform(t=>(0,tjr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var ejr;(function(t){t.inboundSchema=Jp.LibrariesDocumentsDeleteV1Request$inboundSchema,t.outboundSchema=Jp.LibrariesDocumentsDeleteV1Request$outboundSchema})(ejr||(Jp.LibrariesDocumentsDeleteV1Request$=ejr={}));function _$o(t){return JSON.stringify(Jp.LibrariesDocumentsDeleteV1Request$outboundSchema.parse(t))}function v$o(t){return(0,b$o.safeParse)(t,e=>Jp.LibrariesDocumentsDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsDeleteV1Request' from JSON")}});var ijr=S(Kp=>{"use strict";var w$o=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]}),S$o=Kp&&Kp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),C$o=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"&&w$o(r,e,n[o]);return S$o(r,e),r}}();Object.defineProperty(Kp,"__esModule",{value:!0});Kp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$=Kp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema=Kp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema=void 0;Kp.librariesDocumentsGetExtractedTextSignedUrlV1RequestToJSON=O$o;Kp.librariesDocumentsGetExtractedTextSignedUrlV1RequestFromJSON=T$o;var E9=C$o(te()),ojr=ae(),x$o=ee();Kp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema=E9.object({library_id:E9.string(),document_id:E9.string()}).transform(t=>(0,ojr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Kp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema=E9.object({libraryId:E9.string(),documentId:E9.string()}).transform(t=>(0,ojr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var njr;(function(t){t.inboundSchema=Kp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema,t.outboundSchema=Kp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema})(njr||(Kp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$=njr={}));function O$o(t){return JSON.stringify(Kp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema.parse(t))}function T$o(t){return(0,x$o.safeParse)(t,e=>Kp.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetExtractedTextSignedUrlV1Request' from JSON")}});var ujr=S(Wp=>{"use strict";var E$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]}),P$o=Wp&&Wp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),M$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"&&E$o(r,e,n[o]);return P$o(r,e),r}}();Object.defineProperty(Wp,"__esModule",{value:!0});Wp.LibrariesDocumentsGetSignedUrlV1Request$=Wp.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema=Wp.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema=void 0;Wp.librariesDocumentsGetSignedUrlV1RequestToJSON=A$o;Wp.librariesDocumentsGetSignedUrlV1RequestFromJSON=I$o;var P9=M$o(te()),sjr=ae(),R$o=ee();Wp.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema=P9.object({library_id:P9.string(),document_id:P9.string()}).transform(t=>(0,sjr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Wp.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema=P9.object({libraryId:P9.string(),documentId:P9.string()}).transform(t=>(0,sjr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var ajr;(function(t){t.inboundSchema=Wp.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema,t.outboundSchema=Wp.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema})(ajr||(Wp.LibrariesDocumentsGetSignedUrlV1Request$=ajr={}));function A$o(t){return JSON.stringify(Wp.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema.parse(t))}function I$o(t){return(0,R$o.safeParse)(t,e=>Wp.LibrariesDocumentsGetSignedUrlV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetSignedUrlV1Request' from JSON")}});var djr=S(Gp=>{"use strict";var N$o=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]}),j$o=Gp&&Gp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),D$o=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"&&N$o(r,e,n[o]);return j$o(r,e),r}}();Object.defineProperty(Gp,"__esModule",{value:!0});Gp.LibrariesDocumentsGetStatusV1Request$=Gp.LibrariesDocumentsGetStatusV1Request$outboundSchema=Gp.LibrariesDocumentsGetStatusV1Request$inboundSchema=void 0;Gp.librariesDocumentsGetStatusV1RequestToJSON=L$o;Gp.librariesDocumentsGetStatusV1RequestFromJSON=F$o;var M9=D$o(te()),cjr=ae(),$$o=ee();Gp.LibrariesDocumentsGetStatusV1Request$inboundSchema=M9.object({library_id:M9.string(),document_id:M9.string()}).transform(t=>(0,cjr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Gp.LibrariesDocumentsGetStatusV1Request$outboundSchema=M9.object({libraryId:M9.string(),documentId:M9.string()}).transform(t=>(0,cjr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var ljr;(function(t){t.inboundSchema=Gp.LibrariesDocumentsGetStatusV1Request$inboundSchema,t.outboundSchema=Gp.LibrariesDocumentsGetStatusV1Request$outboundSchema})(ljr||(Gp.LibrariesDocumentsGetStatusV1Request$=ljr={}));function L$o(t){return JSON.stringify(Gp.LibrariesDocumentsGetStatusV1Request$outboundSchema.parse(t))}function F$o(t){return(0,$$o.safeParse)(t,e=>Gp.LibrariesDocumentsGetStatusV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetStatusV1Request' from JSON")}});var mjr=S(Zp=>{"use strict";var k$o=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]}),q$o=Zp&&Zp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),B$o=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"&&k$o(r,e,n[o]);return q$o(r,e),r}}();Object.defineProperty(Zp,"__esModule",{value:!0});Zp.LibrariesDocumentsGetTextContentV1Request$=Zp.LibrariesDocumentsGetTextContentV1Request$outboundSchema=Zp.LibrariesDocumentsGetTextContentV1Request$inboundSchema=void 0;Zp.librariesDocumentsGetTextContentV1RequestToJSON=z$o;Zp.librariesDocumentsGetTextContentV1RequestFromJSON=H$o;var R9=B$o(te()),pjr=ae(),U$o=ee();Zp.LibrariesDocumentsGetTextContentV1Request$inboundSchema=R9.object({library_id:R9.string(),document_id:R9.string()}).transform(t=>(0,pjr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Zp.LibrariesDocumentsGetTextContentV1Request$outboundSchema=R9.object({libraryId:R9.string(),documentId:R9.string()}).transform(t=>(0,pjr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var fjr;(function(t){t.inboundSchema=Zp.LibrariesDocumentsGetTextContentV1Request$inboundSchema,t.outboundSchema=Zp.LibrariesDocumentsGetTextContentV1Request$outboundSchema})(fjr||(Zp.LibrariesDocumentsGetTextContentV1Request$=fjr={}));function z$o(t){return JSON.stringify(Zp.LibrariesDocumentsGetTextContentV1Request$outboundSchema.parse(t))}function H$o(t){return(0,U$o.safeParse)(t,e=>Zp.LibrariesDocumentsGetTextContentV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetTextContentV1Request' from JSON")}});var yjr=S(Xp=>{"use strict";var V$o=Xp&&Xp.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),J$o=Xp&&Xp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),K$o=Xp&&Xp.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&V$o(r,e,n[o]);return J$o(r,e),r}}();Object.defineProperty(Xp,"__esModule",{value:!0});Xp.LibrariesDocumentsGetV1Request$=Xp.LibrariesDocumentsGetV1Request$outboundSchema=Xp.LibrariesDocumentsGetV1Request$inboundSchema=void 0;Xp.librariesDocumentsGetV1RequestToJSON=G$o;Xp.librariesDocumentsGetV1RequestFromJSON=Z$o;var A9=K$o(te()),gjr=ae(),W$o=ee();Xp.LibrariesDocumentsGetV1Request$inboundSchema=A9.object({library_id:A9.string(),document_id:A9.string()}).transform(t=>(0,gjr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Xp.LibrariesDocumentsGetV1Request$outboundSchema=A9.object({libraryId:A9.string(),documentId:A9.string()}).transform(t=>(0,gjr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var hjr;(function(t){t.inboundSchema=Xp.LibrariesDocumentsGetV1Request$inboundSchema,t.outboundSchema=Xp.LibrariesDocumentsGetV1Request$outboundSchema})(hjr||(Xp.LibrariesDocumentsGetV1Request$=hjr={}));function G$o(t){return JSON.stringify(Xp.LibrariesDocumentsGetV1Request$outboundSchema.parse(t))}function Z$o(t){return(0,W$o.safeParse)(t,e=>Xp.LibrariesDocumentsGetV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsGetV1Request' from JSON")}});var vjr=S(Yp=>{"use strict";var X$o=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]}),Y$o=Yp&&Yp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Q$o=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"&&X$o(r,e,n[o]);return Y$o(r,e),r}}();Object.defineProperty(Yp,"__esModule",{value:!0});Yp.LibrariesDocumentsListV1Request$=Yp.LibrariesDocumentsListV1Request$outboundSchema=Yp.LibrariesDocumentsListV1Request$inboundSchema=void 0;Yp.librariesDocumentsListV1RequestToJSON=tLo;Yp.librariesDocumentsListV1RequestFromJSON=rLo;var Ry=Q$o(te()),_jr=ae(),eLo=ee();Yp.LibrariesDocumentsListV1Request$inboundSchema=Ry.object({library_id:Ry.string(),search:Ry.nullable(Ry.string()).optional(),page_size:Ry.number().int().default(100),page:Ry.number().int().default(0),sort_by:Ry.string().default("created_at"),sort_order:Ry.string().default("desc")}).transform(t=>(0,_jr.remap)(t,{library_id:"libraryId",page_size:"pageSize",sort_by:"sortBy",sort_order:"sortOrder"}));Yp.LibrariesDocumentsListV1Request$outboundSchema=Ry.object({libraryId:Ry.string(),search:Ry.nullable(Ry.string()).optional(),pageSize:Ry.number().int().default(100),page:Ry.number().int().default(0),sortBy:Ry.string().default("created_at"),sortOrder:Ry.string().default("desc")}).transform(t=>(0,_jr.remap)(t,{libraryId:"library_id",pageSize:"page_size",sortBy:"sort_by",sortOrder:"sort_order"}));var bjr;(function(t){t.inboundSchema=Yp.LibrariesDocumentsListV1Request$inboundSchema,t.outboundSchema=Yp.LibrariesDocumentsListV1Request$outboundSchema})(bjr||(Yp.LibrariesDocumentsListV1Request$=bjr={}));function tLo(t){return JSON.stringify(Yp.LibrariesDocumentsListV1Request$outboundSchema.parse(t))}function rLo(t){return(0,eLo.safeParse)(t,e=>Yp.LibrariesDocumentsListV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsListV1Request' from JSON")}});var Cjr=S(Qp=>{"use strict";var nLo=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]}),oLo=Qp&&Qp.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iLo=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"&&nLo(r,e,n[o]);return oLo(r,e),r}}();Object.defineProperty(Qp,"__esModule",{value:!0});Qp.LibrariesDocumentsReprocessV1Request$=Qp.LibrariesDocumentsReprocessV1Request$outboundSchema=Qp.LibrariesDocumentsReprocessV1Request$inboundSchema=void 0;Qp.librariesDocumentsReprocessV1RequestToJSON=sLo;Qp.librariesDocumentsReprocessV1RequestFromJSON=uLo;var I9=iLo(te()),Sjr=ae(),aLo=ee();Qp.LibrariesDocumentsReprocessV1Request$inboundSchema=I9.object({library_id:I9.string(),document_id:I9.string()}).transform(t=>(0,Sjr.remap)(t,{library_id:"libraryId",document_id:"documentId"}));Qp.LibrariesDocumentsReprocessV1Request$outboundSchema=I9.object({libraryId:I9.string(),documentId:I9.string()}).transform(t=>(0,Sjr.remap)(t,{libraryId:"library_id",documentId:"document_id"}));var wjr;(function(t){t.inboundSchema=Qp.LibrariesDocumentsReprocessV1Request$inboundSchema,t.outboundSchema=Qp.LibrariesDocumentsReprocessV1Request$outboundSchema})(wjr||(Qp.LibrariesDocumentsReprocessV1Request$=wjr={}));function sLo(t){return JSON.stringify(Qp.LibrariesDocumentsReprocessV1Request$outboundSchema.parse(t))}function uLo(t){return(0,aLo.safeParse)(t,e=>Qp.LibrariesDocumentsReprocessV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsReprocessV1Request' from JSON")}});var Pjr=S(em=>{"use strict";var lLo=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]}),cLo=em&&em.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ojr=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"&&lLo(r,e,n[o]);return cLo(r,e),r}}();Object.defineProperty(em,"__esModule",{value:!0});em.LibrariesDocumentsUpdateV1Request$=em.LibrariesDocumentsUpdateV1Request$outboundSchema=em.LibrariesDocumentsUpdateV1Request$inboundSchema=void 0;em.librariesDocumentsUpdateV1RequestToJSON=fLo;em.librariesDocumentsUpdateV1RequestFromJSON=pLo;var N9=Ojr(te()),Tjr=ae(),dLo=ee(),Ejr=Ojr($t());em.LibrariesDocumentsUpdateV1Request$inboundSchema=N9.object({library_id:N9.string(),document_id:N9.string(),DocumentUpdateIn:Ejr.DocumentUpdateIn$inboundSchema}).transform(t=>(0,Tjr.remap)(t,{library_id:"libraryId",document_id:"documentId",DocumentUpdateIn:"documentUpdateIn"}));em.LibrariesDocumentsUpdateV1Request$outboundSchema=N9.object({libraryId:N9.string(),documentId:N9.string(),documentUpdateIn:Ejr.DocumentUpdateIn$outboundSchema}).transform(t=>(0,Tjr.remap)(t,{libraryId:"library_id",documentId:"document_id",documentUpdateIn:"DocumentUpdateIn"}));var xjr;(function(t){t.inboundSchema=em.LibrariesDocumentsUpdateV1Request$inboundSchema,t.outboundSchema=em.LibrariesDocumentsUpdateV1Request$outboundSchema})(xjr||(em.LibrariesDocumentsUpdateV1Request$=xjr={}));function fLo(t){return JSON.stringify(em.LibrariesDocumentsUpdateV1Request$outboundSchema.parse(t))}function pLo(t){return(0,dLo.safeParse)(t,e=>em.LibrariesDocumentsUpdateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUpdateV1Request' from JSON")}});var Djr=S(Ha=>{"use strict";var mLo=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]}),hLo=Ha&&Ha.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ajr=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"&&mLo(r,e,n[o]);return hLo(r,e),r}}();Object.defineProperty(Ha,"__esModule",{value:!0});Ha.LibrariesDocumentsUploadV1Request$=Ha.LibrariesDocumentsUploadV1Request$outboundSchema=Ha.LibrariesDocumentsUploadV1Request$inboundSchema=Ha.LibrariesDocumentsUploadV1DocumentUpload$=Ha.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema=Ha.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema=void 0;Ha.librariesDocumentsUploadV1DocumentUploadToJSON=yLo;Ha.librariesDocumentsUploadV1DocumentUploadFromJSON=bLo;Ha.librariesDocumentsUploadV1RequestToJSON=_Lo;Ha.librariesDocumentsUploadV1RequestFromJSON=vLo;var Pq=Ajr(te()),Ijr=ae(),Njr=ee(),gLo=gj(),jjr=Ajr($t());Ha.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema=Pq.object({file:jjr.FileT$inboundSchema});Ha.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema=Pq.object({file:jjr.FileT$outboundSchema.or(gLo.blobLikeSchema)});var Mjr;(function(t){t.inboundSchema=Ha.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema,t.outboundSchema=Ha.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema})(Mjr||(Ha.LibrariesDocumentsUploadV1DocumentUpload$=Mjr={}));function yLo(t){return JSON.stringify(Ha.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema.parse(t))}function bLo(t){return(0,Njr.safeParse)(t,e=>Ha.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUploadV1DocumentUpload' from JSON")}Ha.LibrariesDocumentsUploadV1Request$inboundSchema=Pq.object({library_id:Pq.string(),RequestBody:Pq.lazy(()=>Ha.LibrariesDocumentsUploadV1DocumentUpload$inboundSchema)}).transform(t=>(0,Ijr.remap)(t,{library_id:"libraryId",RequestBody:"requestBody"}));Ha.LibrariesDocumentsUploadV1Request$outboundSchema=Pq.object({libraryId:Pq.string(),requestBody:Pq.lazy(()=>Ha.LibrariesDocumentsUploadV1DocumentUpload$outboundSchema)}).transform(t=>(0,Ijr.remap)(t,{libraryId:"library_id",requestBody:"RequestBody"}));var Rjr;(function(t){t.inboundSchema=Ha.LibrariesDocumentsUploadV1Request$inboundSchema,t.outboundSchema=Ha.LibrariesDocumentsUploadV1Request$outboundSchema})(Rjr||(Ha.LibrariesDocumentsUploadV1Request$=Rjr={}));function _Lo(t){return JSON.stringify(Ha.LibrariesDocumentsUploadV1Request$outboundSchema.parse(t))}function vLo(t){return(0,Njr.safeParse)(t,e=>Ha.LibrariesDocumentsUploadV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesDocumentsUploadV1Request' from JSON")}});var Fjr=S(tm=>{"use strict";var wLo=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]}),SLo=tm&&tm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CLo=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"&&wLo(r,e,n[o]);return SLo(r,e),r}}();Object.defineProperty(tm,"__esModule",{value:!0});tm.LibrariesGetV1Request$=tm.LibrariesGetV1Request$outboundSchema=tm.LibrariesGetV1Request$inboundSchema=void 0;tm.librariesGetV1RequestToJSON=OLo;tm.librariesGetV1RequestFromJSON=TLo;var VRe=CLo(te()),Ljr=ae(),xLo=ee();tm.LibrariesGetV1Request$inboundSchema=VRe.object({library_id:VRe.string()}).transform(t=>(0,Ljr.remap)(t,{library_id:"libraryId"}));tm.LibrariesGetV1Request$outboundSchema=VRe.object({libraryId:VRe.string()}).transform(t=>(0,Ljr.remap)(t,{libraryId:"library_id"}));var $jr;(function(t){t.inboundSchema=tm.LibrariesGetV1Request$inboundSchema,t.outboundSchema=tm.LibrariesGetV1Request$outboundSchema})($jr||(tm.LibrariesGetV1Request$=$jr={}));function OLo(t){return JSON.stringify(tm.LibrariesGetV1Request$outboundSchema.parse(t))}function TLo(t){return(0,xLo.safeParse)(t,e=>tm.LibrariesGetV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesGetV1Request' from JSON")}});var zjr=S(rm=>{"use strict";var ELo=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]}),PLo=rm&&rm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qjr=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"&&ELo(r,e,n[o]);return PLo(r,e),r}}();Object.defineProperty(rm,"__esModule",{value:!0});rm.LibrariesShareCreateV1Request$=rm.LibrariesShareCreateV1Request$outboundSchema=rm.LibrariesShareCreateV1Request$inboundSchema=void 0;rm.librariesShareCreateV1RequestToJSON=RLo;rm.librariesShareCreateV1RequestFromJSON=ALo;var JRe=qjr(te()),Bjr=ae(),MLo=ee(),Ujr=qjr($t());rm.LibrariesShareCreateV1Request$inboundSchema=JRe.object({library_id:JRe.string(),SharingIn:Ujr.SharingIn$inboundSchema}).transform(t=>(0,Bjr.remap)(t,{library_id:"libraryId",SharingIn:"sharingIn"}));rm.LibrariesShareCreateV1Request$outboundSchema=JRe.object({libraryId:JRe.string(),sharingIn:Ujr.SharingIn$outboundSchema}).transform(t=>(0,Bjr.remap)(t,{libraryId:"library_id",sharingIn:"SharingIn"}));var kjr;(function(t){t.inboundSchema=rm.LibrariesShareCreateV1Request$inboundSchema,t.outboundSchema=rm.LibrariesShareCreateV1Request$outboundSchema})(kjr||(rm.LibrariesShareCreateV1Request$=kjr={}));function RLo(t){return JSON.stringify(rm.LibrariesShareCreateV1Request$outboundSchema.parse(t))}function ALo(t){return(0,MLo.safeParse)(t,e=>rm.LibrariesShareCreateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareCreateV1Request' from JSON")}});var Wjr=S(nm=>{"use strict";var ILo=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]}),NLo=nm&&nm.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vjr=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"&&ILo(r,e,n[o]);return NLo(r,e),r}}();Object.defineProperty(nm,"__esModule",{value:!0});nm.LibrariesShareDeleteV1Request$=nm.LibrariesShareDeleteV1Request$outboundSchema=nm.LibrariesShareDeleteV1Request$inboundSchema=void 0;nm.librariesShareDeleteV1RequestToJSON=DLo;nm.librariesShareDeleteV1RequestFromJSON=$Lo;var KRe=Vjr(te()),Jjr=ae(),jLo=ee(),Kjr=Vjr($t());nm.LibrariesShareDeleteV1Request$inboundSchema=KRe.object({library_id:KRe.string(),SharingDelete:Kjr.SharingDelete$inboundSchema}).transform(t=>(0,Jjr.remap)(t,{library_id:"libraryId",SharingDelete:"sharingDelete"}));nm.LibrariesShareDeleteV1Request$outboundSchema=KRe.object({libraryId:KRe.string(),sharingDelete:Kjr.SharingDelete$outboundSchema}).transform(t=>(0,Jjr.remap)(t,{libraryId:"library_id",sharingDelete:"SharingDelete"}));var Hjr;(function(t){t.inboundSchema=nm.LibrariesShareDeleteV1Request$inboundSchema,t.outboundSchema=nm.LibrariesShareDeleteV1Request$outboundSchema})(Hjr||(nm.LibrariesShareDeleteV1Request$=Hjr={}));function DLo(t){return JSON.stringify(nm.LibrariesShareDeleteV1Request$outboundSchema.parse(t))}function $Lo(t){return(0,jLo.safeParse)(t,e=>nm.LibrariesShareDeleteV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareDeleteV1Request' from JSON")}});var Xjr=S(om=>{"use strict";var LLo=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]}),FLo=om&&om.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kLo=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"&&LLo(r,e,n[o]);return FLo(r,e),r}}();Object.defineProperty(om,"__esModule",{value:!0});om.LibrariesShareListV1Request$=om.LibrariesShareListV1Request$outboundSchema=om.LibrariesShareListV1Request$inboundSchema=void 0;om.librariesShareListV1RequestToJSON=BLo;om.librariesShareListV1RequestFromJSON=ULo;var WRe=kLo(te()),Zjr=ae(),qLo=ee();om.LibrariesShareListV1Request$inboundSchema=WRe.object({library_id:WRe.string()}).transform(t=>(0,Zjr.remap)(t,{library_id:"libraryId"}));om.LibrariesShareListV1Request$outboundSchema=WRe.object({libraryId:WRe.string()}).transform(t=>(0,Zjr.remap)(t,{libraryId:"library_id"}));var Gjr;(function(t){t.inboundSchema=om.LibrariesShareListV1Request$inboundSchema,t.outboundSchema=om.LibrariesShareListV1Request$outboundSchema})(Gjr||(om.LibrariesShareListV1Request$=Gjr={}));function BLo(t){return JSON.stringify(om.LibrariesShareListV1Request$outboundSchema.parse(t))}function ULo(t){return(0,qLo.safeParse)(t,e=>om.LibrariesShareListV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesShareListV1Request' from JSON")}});var rDr=S(im=>{"use strict";var zLo=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]}),HLo=im&&im.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Qjr=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"&&zLo(r,e,n[o]);return HLo(r,e),r}}();Object.defineProperty(im,"__esModule",{value:!0});im.LibrariesUpdateV1Request$=im.LibrariesUpdateV1Request$outboundSchema=im.LibrariesUpdateV1Request$inboundSchema=void 0;im.librariesUpdateV1RequestToJSON=JLo;im.librariesUpdateV1RequestFromJSON=KLo;var GRe=Qjr(te()),eDr=ae(),VLo=ee(),tDr=Qjr($t());im.LibrariesUpdateV1Request$inboundSchema=GRe.object({library_id:GRe.string(),LibraryInUpdate:tDr.LibraryInUpdate$inboundSchema}).transform(t=>(0,eDr.remap)(t,{library_id:"libraryId",LibraryInUpdate:"libraryInUpdate"}));im.LibrariesUpdateV1Request$outboundSchema=GRe.object({libraryId:GRe.string(),libraryInUpdate:tDr.LibraryInUpdate$outboundSchema}).transform(t=>(0,eDr.remap)(t,{libraryId:"library_id",libraryInUpdate:"LibraryInUpdate"}));var Yjr;(function(t){t.inboundSchema=im.LibrariesUpdateV1Request$inboundSchema,t.outboundSchema=im.LibrariesUpdateV1Request$outboundSchema})(Yjr||(im.LibrariesUpdateV1Request$=Yjr={}));function JLo(t){return JSON.stringify(im.LibrariesUpdateV1Request$outboundSchema.parse(t))}function KLo(t){return(0,VLo.safeParse)(t,e=>im.LibrariesUpdateV1Request$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'LibrariesUpdateV1Request' from JSON")}});var uDr=S(Ms=>{"use strict";var WLo=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]}),GLo=Ms&&Ms.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iDr=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"&&WLo(r,e,n[o]);return GLo(r,e),r}}();Object.defineProperty(Ms,"__esModule",{value:!0});Ms.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=Ms.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=Ms.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=Ms.RetrieveModelV1ModelsModelIdGetRequest$=Ms.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=Ms.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=void 0;Ms.retrieveModelV1ModelsModelIdGetRequestToJSON=ZLo;Ms.retrieveModelV1ModelsModelIdGetRequestFromJSON=XLo;Ms.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetToJSON=YLo;Ms.retrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGetFromJSON=QLo;var U_=iDr(te()),aDr=ae(),sDr=ee(),ZRe=iDr($t());Ms.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema=U_.object({model_id:U_.string()}).transform(t=>(0,aDr.remap)(t,{model_id:"modelId"}));Ms.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema=U_.object({modelId:U_.string()}).transform(t=>(0,aDr.remap)(t,{modelId:"model_id"}));var nDr;(function(t){t.inboundSchema=Ms.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema,t.outboundSchema=Ms.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema})(nDr||(Ms.RetrieveModelV1ModelsModelIdGetRequest$=nDr={}));function ZLo(t){return JSON.stringify(Ms.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(t))}function XLo(t){return(0,sDr.safeParse)(t,e=>Ms.RetrieveModelV1ModelsModelIdGetRequest$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetRequest' from JSON")}Ms.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema=U_.union([ZRe.FTModelCard$inboundSchema.and(U_.object({type:U_.literal("fine-tuned")}).transform(t=>({type:t.type}))),ZRe.BaseModelCard$inboundSchema.and(U_.object({type:U_.literal("base")}).transform(t=>({type:t.type})))]);Ms.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema=U_.union([ZRe.FTModelCard$outboundSchema.and(U_.object({type:U_.literal("fine-tuned")}).transform(t=>({type:t.type}))),ZRe.BaseModelCard$outboundSchema.and(U_.object({type:U_.literal("base")}).transform(t=>({type:t.type})))]);var oDr;(function(t){t.inboundSchema=Ms.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema,t.outboundSchema=Ms.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema})(oDr||(Ms.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$=oDr={}));function YLo(t){return JSON.stringify(Ms.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$outboundSchema.parse(t))}function QLo(t){return(0,sDr.safeParse)(t,e=>Ms.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema.parse(JSON.parse(e)),"Failed to parse 'RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet' from JSON")}});var Vn=S(un=>{"use strict";var eFo=un&&un.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,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=un&&un.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eFo(e,t,r)};Object.defineProperty(un,"__esModule",{value:!0});Zn($Ir(),un);Zn(kIr(),un);Zn(HIr(),un);Zn(KIr(),un);Zn(YIr(),un);Zn(nNr(),un);Zn(lNr(),un);Zn(fNr(),un);Zn(bNr(),un);Zn(wNr(),un);Zn(TNr(),un);Zn(ANr(),un);Zn(jNr(),un);Zn(LNr(),un);Zn(qNr(),un);Zn(zNr(),un);Zn(KNr(),un);Zn(ZNr(),un);Zn(e1r(),un);Zn(n1r(),un);Zn(a1r(),un);Zn(d1r(),un);Zn(m1r(),un);Zn(v1r(),un);Zn(O1r(),un);Zn(A1r(),un);Zn(D1r(),un);Zn(B1r(),un);Zn(H1r(),un);Zn(Z1r(),un);Zn(Q1r(),un);Zn(rjr(),un);Zn(ijr(),un);Zn(ujr(),un);Zn(djr(),un);Zn(mjr(),un);Zn(yjr(),un);Zn(vjr(),un);Zn(Cjr(),un);Zn(Pjr(),un);Zn(Djr(),un);Zn(Fjr(),un);Zn(zjr(),un);Zn(Wjr(),un);Zn(Xjr(),un);Zn(rDr(),un);Zn(uDr(),un)});var cDr=S(xj=>{"use strict";var tFo=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]}),rFo=xj&&xj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jut=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"&&tFo(r,e,n[o]);return rFo(r,e),r}}();Object.defineProperty(xj,"__esModule",{value:!0});xj.batchJobsCancel=cFo;var nFo=fr(),XRe=jut(ar()),oFo=ae(),iFo=ee(),lDr=sr(),aFo=or(),sFo=jut($t()),uFo=jut(Vn()),lFo=ur();function cFo(t,e,r){return new lFo.APIPromise(dFo(t,e,r))}async function dFo(t,e,r){let n=(0,iFo.safeParse)(e,b=>uFo.JobsApiRoutesBatchCancelBatchJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,nFo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,aFo.pathToFunc)("/v1/batch/jobs/{job_id}/cancel")(a),u=new Headers((0,oFo.compactMap)({Accept:"application/json"})),l=await(0,lDr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,lDr.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 g=h.value,[y]=await XRe.match(XRe.json(200,sFo.BatchJobOut$inboundSchema),XRe.fail("4XX"),XRe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var mDr=S(Oj=>{"use strict";var fFo=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]}),pFo=Oj&&Oj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),pDr=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"&&fFo(r,e,n[o]);return pFo(r,e),r}}();Object.defineProperty(Oj,"__esModule",{value:!0});Oj.batchJobsCreate=_Fo;var mFo=fr(),YRe=pDr(ar()),hFo=ae(),gFo=ee(),dDr=sr(),yFo=or(),fDr=pDr($t()),bFo=ur();function _Fo(t,e,r){return new bFo.APIPromise(vFo(t,e,r))}async function vFo(t,e,r){let n=(0,gFo.safeParse)(e,y=>fDr.BatchJobIn$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,mFo.encodeJSON)("body",o,{explode:!0}),a=(0,yFo.pathToFunc)("/v1/batch/jobs")(),s=new Headers((0,hFo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,dDr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,dDr.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,[g]=await YRe.match(YRe.json(200,fDr.BatchJobOut$inboundSchema),YRe.fail("4XX"),YRe.fail("5XX"))(h,p);return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var gDr=S(Tj=>{"use strict";var wFo=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]}),SFo=Tj&&Tj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dut=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"&&wFo(r,e,n[o]);return SFo(r,e),r}}();Object.defineProperty(Tj,"__esModule",{value:!0});Tj.batchJobsGet=RFo;var CFo=fr(),QRe=Dut(ar()),xFo=ae(),OFo=ee(),hDr=sr(),TFo=or(),EFo=Dut($t()),PFo=Dut(Vn()),MFo=ur();function RFo(t,e,r){return new MFo.APIPromise(AFo(t,e,r))}async function AFo(t,e,r){let n=(0,OFo.safeParse)(e,b=>PFo.JobsApiRoutesBatchGetBatchJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,CFo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,TFo.pathToFunc)("/v1/batch/jobs/{job_id}")(a),u=new Headers((0,xFo.compactMap)({Accept:"application/json"})),l=await(0,hDr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,hDr.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 g=h.value,[y]=await QRe.match(QRe.json(200,EFo.BatchJobOut$inboundSchema),QRe.fail("4XX"),QRe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var bDr=S(Ej=>{"use strict";var IFo=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]}),NFo=Ej&&Ej.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$ut=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"&&IFo(r,e,n[o]);return NFo(r,e),r}}();Object.defineProperty(Ej,"__esModule",{value:!0});Ej.batchJobsList=BFo;var jFo=fr(),eAe=$ut(ar()),DFo=ae(),$Fo=ee(),yDr=sr(),LFo=or(),FFo=$ut($t()),kFo=$ut(Vn()),qFo=ur();function BFo(t,e,r){return new qFo.APIPromise(UFo(t,e,r))}async function UFo(t,e,r){let n=(0,$Fo.safeParse)(e,b=>kFo.JobsApiRoutesBatchGetBatchJobsRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,LFo.pathToFunc)("/v1/batch/jobs")(),s=(0,jFo.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,DFo.compactMap)({Accept:"application/json"})),l=await(0,yDr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,yDr.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 g=h.value,[y]=await eAe.match(eAe.json(200,FFo.BatchJobsOut$inboundSchema),eAe.fail("4XX"),eAe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var _Dr=S(rAe=>{"use strict";Object.defineProperty(rAe,"__esModule",{value:!0});rAe.MistralJobs=void 0;var zFo=cDr(),HFo=mDr(),VFo=gDr(),JFo=bDr(),KFo=jc(),tAe=xd(),Lut=class extends KFo.ClientSDK{async list(e,r){return(0,tAe.unwrapAsync)((0,JFo.batchJobsList)(this,e,r))}async create(e,r){return(0,tAe.unwrapAsync)((0,HFo.batchJobsCreate)(this,e,r))}async get(e,r){return(0,tAe.unwrapAsync)((0,VFo.batchJobsGet)(this,e,r))}async cancel(e,r){return(0,tAe.unwrapAsync)((0,zFo.batchJobsCancel)(this,e,r))}};rAe.MistralJobs=Lut});var vDr=S(nAe=>{"use strict";Object.defineProperty(nAe,"__esModule",{value:!0});nAe.Batch=void 0;var WFo=jc(),GFo=_Dr(),Fut=class extends WFo.ClientSDK{get jobs(){return this._jobs??(this._jobs=new GFo.MistralJobs(this._options))}};nAe.Batch=Fut});var CDr=S(Pj=>{"use strict";var ZFo=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]}),XFo=Pj&&Pj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),oAe=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"&&ZFo(r,e,n[o]);return XFo(r,e),r}}();Object.defineProperty(Pj,"__esModule",{value:!0});Pj.betaConversationsAppend=iko;var wDr=fr(),zae=oAe(ar()),YFo=ae(),QFo=ee(),SDr=sr(),eko=or(),tko=oAe($t()),rko=oAe(Hn()),nko=oAe(Vn()),oko=ur();function iko(t,e,r){return new oko.APIPromise(ako(t,e,r))}async function ako(t,e,r){let n=(0,QFo.safeParse)(e,_=>nko.AgentsApiV1ConversationsAppendRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,wDr.encodeJSON)("body",o.ConversationAppendRequest,{explode:!0}),a={conversation_id:(0,wDr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,eko.pathToFunc)("/v1/conversations/{conversation_id}")(a),u=new Headers((0,YFo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,SDr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,SDr.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await zae.match(zae.json(200,tko.ConversationResponse$inboundSchema),zae.jsonErr(422,rko.HTTPValidationError$inboundSchema),zae.fail("4XX"),zae.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var TDr=S(Mj=>{"use strict";var sko=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]}),uko=Mj&&Mj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Vae=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"&&sko(r,e,n[o]);return uko(r,e),r}}();Object.defineProperty(Mj,"__esModule",{value:!0});Mj.betaConversationsAppendStream=bko;var lko=Vae(te()),xDr=fr(),cko=Tq(),Hae=Vae(ar()),dko=ae(),fko=ee(),ODr=sr(),pko=or(),mko=Vae($t()),hko=Vae(Hn()),gko=Vae(Vn()),yko=ur();function bko(t,e,r){return new yko.APIPromise(_ko(t,e,r))}async function _ko(t,e,r){let n=(0,fko.safeParse)(e,_=>gko.AgentsApiV1ConversationsAppendStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,xDr.encodeJSON)("body",o.ConversationAppendStreamRequest,{explode:!0}),a={conversation_id:(0,xDr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,pko.pathToFunc)("/v1/conversations/{conversation_id}#stream")(a),u=new Headers((0,dko.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),l=await(0,ODr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,ODr.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await Hae.match(Hae.sse(200,lko.instanceof(ReadableStream).transform(_=>new cko.EventStream(_,w=>({value:mko.ConversationEvents$inboundSchema.parse(w)})))),Hae.jsonErr(422,hko.HTTPValidationError$inboundSchema),Hae.fail("4XX"),Hae.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var MDr=S(Rj=>{"use strict";var vko=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]}),wko=Rj&&Rj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),kut=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"&&vko(r,e,n[o]);return wko(r,e),r}}();Object.defineProperty(Rj,"__esModule",{value:!0});Rj.betaConversationsGet=Pko;var Sko=fr(),Jae=kut(ar()),Cko=ae(),xko=ee(),EDr=sr(),Oko=or(),Tko=kut(Hn()),PDr=kut(Vn()),Eko=ur();function Pko(t,e,r){return new Eko.APIPromise(Mko(t,e,r))}async function Mko(t,e,r){let n=(0,xko.safeParse)(e,_=>PDr.AgentsApiV1ConversationsGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,Sko.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,Oko.pathToFunc)("/v1/conversations/{conversation_id}")(a),u=new Headers((0,Cko.compactMap)({Accept:"application/json"})),l=await(0,EDr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,EDr.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await Jae.match(Jae.json(200,PDr.AgentsApiV1ConversationsGetResponseV1ConversationsGet$inboundSchema),Jae.jsonErr(422,Tko.HTTPValidationError$inboundSchema),Jae.fail("4XX"),Jae.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var ADr=S(Aj=>{"use strict";var Rko=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]}),Ako=Aj&&Aj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),iAe=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"&&Rko(r,e,n[o]);return Ako(r,e),r}}();Object.defineProperty(Aj,"__esModule",{value:!0});Aj.betaConversationsGetHistory=qko;var Iko=fr(),Kae=iAe(ar()),Nko=ae(),jko=ee(),RDr=sr(),Dko=or(),$ko=iAe($t()),Lko=iAe(Hn()),Fko=iAe(Vn()),kko=ur();function qko(t,e,r){return new kko.APIPromise(Bko(t,e,r))}async function Bko(t,e,r){let n=(0,jko.safeParse)(e,_=>Fko.AgentsApiV1ConversationsHistoryRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,Iko.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,Dko.pathToFunc)("/v1/conversations/{conversation_id}/history")(a),u=new Headers((0,Nko.compactMap)({Accept:"application/json"})),l=await(0,RDr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,RDr.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await Kae.match(Kae.json(200,$ko.ConversationHistory$inboundSchema),Kae.jsonErr(422,Lko.HTTPValidationError$inboundSchema),Kae.fail("4XX"),Kae.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var NDr=S(Ij=>{"use strict";var Uko=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]}),zko=Ij&&Ij.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aAe=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"&&Uko(r,e,n[o]);return zko(r,e),r}}();Object.defineProperty(Ij,"__esModule",{value:!0});Ij.betaConversationsGetMessages=Yko;var Hko=fr(),Wae=aAe(ar()),Vko=ae(),Jko=ee(),IDr=sr(),Kko=or(),Wko=aAe($t()),Gko=aAe(Hn()),Zko=aAe(Vn()),Xko=ur();function Yko(t,e,r){return new Xko.APIPromise(Qko(t,e,r))}async function Qko(t,e,r){let n=(0,Jko.safeParse)(e,_=>Zko.AgentsApiV1ConversationsMessagesRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={conversation_id:(0,Hko.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,Kko.pathToFunc)("/v1/conversations/{conversation_id}/messages")(a),u=new Headers((0,Vko.compactMap)({Accept:"application/json"})),l=await(0,IDr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,IDr.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await Wae.match(Wae.json(200,Wko.ConversationMessages$inboundSchema),Wae.jsonErr(422,Gko.HTTPValidationError$inboundSchema),Wae.fail("4XX"),Wae.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var $Dr=S(Nj=>{"use strict";var eqo=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]}),tqo=Nj&&Nj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sAe=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"&&eqo(r,e,n[o]);return tqo(r,e),r}}();Object.defineProperty(Nj,"__esModule",{value:!0});Nj.betaConversationsList=lqo;var rqo=sAe(te()),nqo=fr(),Gae=sAe(ar()),oqo=ae(),iqo=ee(),jDr=sr(),aqo=or(),sqo=sAe(Hn()),DDr=sAe(Vn()),uqo=ur();function lqo(t,e,r){return new uqo.APIPromise(cqo(t,e,r))}async function cqo(t,e,r){let n=(0,iqo.safeParse)(e,_=>DDr.AgentsApiV1ConversationsListRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,aqo.pathToFunc)("/v1/conversations")(),s=(0,nqo.encodeFormQuery)({page:o?.page,page_size:o?.page_size}),u=new Headers((0,oqo.compactMap)({Accept:"application/json"})),l=await(0,jDr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,jDr.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await Gae.match(Gae.json(200,rqo.array(DDr.ResponseBody$inboundSchema)),Gae.jsonErr(422,sqo.HTTPValidationError$inboundSchema),Gae.fail("4XX"),Gae.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var kDr=S(jj=>{"use strict";var dqo=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]}),fqo=jj&&jj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uAe=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"&&dqo(r,e,n[o]);return fqo(r,e),r}}();Object.defineProperty(jj,"__esModule",{value:!0});jj.betaConversationsRestart=vqo;var LDr=fr(),Zae=uAe(ar()),pqo=ae(),mqo=ee(),FDr=sr(),hqo=or(),gqo=uAe($t()),yqo=uAe(Hn()),bqo=uAe(Vn()),_qo=ur();function vqo(t,e,r){return new _qo.APIPromise(wqo(t,e,r))}async function wqo(t,e,r){let n=(0,mqo.safeParse)(e,_=>bqo.AgentsApiV1ConversationsRestartRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,LDr.encodeJSON)("body",o.ConversationRestartRequest,{explode:!0}),a={conversation_id:(0,LDr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,hqo.pathToFunc)("/v1/conversations/{conversation_id}/restart")(a),u=new Headers((0,pqo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,FDr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,FDr.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await Zae.match(Zae.json(200,gqo.ConversationResponse$inboundSchema),Zae.jsonErr(422,yqo.HTTPValidationError$inboundSchema),Zae.fail("4XX"),Zae.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var UDr=S(Dj=>{"use strict";var Sqo=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]}),Cqo=Dj&&Dj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yae=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"&&Sqo(r,e,n[o]);return Cqo(r,e),r}}();Object.defineProperty(Dj,"__esModule",{value:!0});Dj.betaConversationsRestartStream=Nqo;var xqo=Yae(te()),qDr=fr(),Oqo=Tq(),Xae=Yae(ar()),Tqo=ae(),Eqo=ee(),BDr=sr(),Pqo=or(),Mqo=Yae($t()),Rqo=Yae(Hn()),Aqo=Yae(Vn()),Iqo=ur();function Nqo(t,e,r){return new Iqo.APIPromise(jqo(t,e,r))}async function jqo(t,e,r){let n=(0,Eqo.safeParse)(e,_=>Aqo.AgentsApiV1ConversationsRestartStreamRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,qDr.encodeJSON)("body",o.ConversationRestartStreamRequest,{explode:!0}),a={conversation_id:(0,qDr.encodeSimple)("conversation_id",o.conversation_id,{explode:!1,charEncoding:"percent"})},s=(0,Pqo.pathToFunc)("/v1/conversations/{conversation_id}/restart#stream")(a),u=new Headers((0,Tqo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),l=await(0,BDr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,BDr.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await Xae.match(Xae.sse(200,xqo.instanceof(ReadableStream).transform(_=>new Oqo.EventStream(_,w=>({value:Mqo.ConversationEvents$inboundSchema.parse(w)})))),Xae.jsonErr(422,Rqo.HTTPValidationError$inboundSchema),Xae.fail("4XX"),Xae.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var VDr=S($j=>{"use strict";var Dqo=$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]}),$qo=$j&&$j.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qut=$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"&&Dqo(r,e,n[o]);return $qo(r,e),r}}();Object.defineProperty($j,"__esModule",{value:!0});$j.betaConversationsStart=zqo;var Lqo=fr(),Qae=qut(ar()),Fqo=ae(),kqo=ee(),zDr=sr(),qqo=or(),HDr=qut($t()),Bqo=qut(Hn()),Uqo=ur();function zqo(t,e,r){return new Uqo.APIPromise(Hqo(t,e,r))}async function Hqo(t,e,r){let n=(0,kqo.safeParse)(e,b=>HDr.ConversationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,Lqo.encodeJSON)("body",o,{explode:!0}),a=(0,qqo.pathToFunc)("/v1/conversations")(),s=new Headers((0,Fqo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,zDr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,zDr.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,g={HttpMeta:{Response:h,Request:p}},[y]=await Qae.match(Qae.json(200,HDr.ConversationResponse$inboundSchema),Qae.jsonErr(422,Bqo.HTTPValidationError$inboundSchema),Qae.fail("4XX"),Qae.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var WDr=S(Lj=>{"use strict";var Vqo=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]}),Jqo=Lj&&Lj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lAe=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"&&Vqo(r,e,n[o]);return Jqo(r,e),r}}();Object.defineProperty(Lj,"__esModule",{value:!0});Lj.betaConversationsStartStream=tBo;var Kqo=lAe(te()),Wqo=fr(),Gqo=Tq(),ese=lAe(ar()),Zqo=ae(),Xqo=ee(),JDr=sr(),Yqo=or(),KDr=lAe($t()),Qqo=lAe(Hn()),eBo=ur();function tBo(t,e,r){return new eBo.APIPromise(rBo(t,e,r))}async function rBo(t,e,r){let n=(0,Xqo.safeParse)(e,b=>KDr.ConversationStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,Wqo.encodeJSON)("body",o,{explode:!0}),a=(0,Yqo.pathToFunc)("/v1/conversations#stream")(),s=new Headers((0,Zqo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,JDr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,JDr.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,g={HttpMeta:{Response:h,Request:p}},[y]=await ese.match(ese.sse(200,Kqo.instanceof(ReadableStream).transform(b=>new Gqo.EventStream(b,_=>({value:KDr.ConversationEvents$inboundSchema.parse(_)})))),ese.jsonErr(422,Qqo.HTTPValidationError$inboundSchema),ese.fail("4XX"),ese.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var GDr=S(cAe=>{"use strict";Object.defineProperty(cAe,"__esModule",{value:!0});cAe.Conversations=void 0;var nBo=CDr(),oBo=TDr(),iBo=MDr(),aBo=ADr(),sBo=NDr(),uBo=$Dr(),lBo=kDr(),cBo=UDr(),dBo=VDr(),fBo=WDr(),pBo=jc(),nI=xd(),But=class extends pBo.ClientSDK{async start(e,r){return(0,nI.unwrapAsync)((0,dBo.betaConversationsStart)(this,e,r))}async list(e,r){return(0,nI.unwrapAsync)((0,uBo.betaConversationsList)(this,e,r))}async get(e,r){return(0,nI.unwrapAsync)((0,iBo.betaConversationsGet)(this,e,r))}async append(e,r){return(0,nI.unwrapAsync)((0,nBo.betaConversationsAppend)(this,e,r))}async getHistory(e,r){return(0,nI.unwrapAsync)((0,aBo.betaConversationsGetHistory)(this,e,r))}async getMessages(e,r){return(0,nI.unwrapAsync)((0,sBo.betaConversationsGetMessages)(this,e,r))}async restart(e,r){return(0,nI.unwrapAsync)((0,lBo.betaConversationsRestart)(this,e,r))}async startStream(e,r){return(0,nI.unwrapAsync)((0,fBo.betaConversationsStartStream)(this,e,r))}async appendStream(e,r){return(0,nI.unwrapAsync)((0,oBo.betaConversationsAppendStream)(this,e,r))}async restartStream(e,r){return(0,nI.unwrapAsync)((0,cBo.betaConversationsRestartStream)(this,e,r))}};cAe.Conversations=But});var YDr=S(Fj=>{"use strict";var mBo=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]}),hBo=Fj&&Fj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Uut=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"&&mBo(r,e,n[o]);return hBo(r,e),r}}();Object.defineProperty(Fj,"__esModule",{value:!0});Fj.betaLibrariesCreate=SBo;var gBo=fr(),tse=Uut(ar()),yBo=ae(),bBo=ee(),ZDr=sr(),_Bo=or(),XDr=Uut($t()),vBo=Uut(Hn()),wBo=ur();function SBo(t,e,r){return new wBo.APIPromise(CBo(t,e,r))}async function CBo(t,e,r){let n=(0,bBo.safeParse)(e,b=>XDr.LibraryIn$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,gBo.encodeJSON)("body",o,{explode:!0}),a=(0,_Bo.pathToFunc)("/v1/libraries")(),s=new Headers((0,yBo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,ZDr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,ZDr.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,g={HttpMeta:{Response:h,Request:p}},[y]=await tse.match(tse.json(201,XDr.LibraryOut$inboundSchema),tse.jsonErr(422,vBo.HTTPValidationError$inboundSchema),tse.fail("4XX"),tse.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var e$r=S(kj=>{"use strict";var xBo=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]}),OBo=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"&&xBo(r,e,n[o]);return OBo(r,e),r}}();Object.defineProperty(kj,"__esModule",{value:!0});kj.betaLibrariesDelete=jBo;var TBo=fr(),rse=dAe(ar()),EBo=ae(),PBo=ee(),QDr=sr(),MBo=or(),RBo=dAe($t()),ABo=dAe(Hn()),IBo=dAe(Vn()),NBo=ur();function jBo(t,e,r){return new NBo.APIPromise(DBo(t,e,r))}async function DBo(t,e,r){let n=(0,PBo.safeParse)(e,_=>IBo.LibrariesDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,TBo.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,MBo.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,EBo.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:"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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await rse.match(rse.json(200,RBo.LibraryOut$inboundSchema),rse.jsonErr(422,ABo.HTTPValidationError$inboundSchema),rse.fail("4XX"),rse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var r$r=S(qj=>{"use strict";var $Bo=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]}),LBo=qj&&qj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fAe=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"&&$Bo(r,e,n[o]);return LBo(r,e),r}}();Object.defineProperty(qj,"__esModule",{value:!0});qj.betaLibrariesGet=JBo;var FBo=fr(),nse=fAe(ar()),kBo=ae(),qBo=ee(),t$r=sr(),BBo=or(),UBo=fAe($t()),zBo=fAe(Hn()),HBo=fAe(Vn()),VBo=ur();function JBo(t,e,r){return new VBo.APIPromise(KBo(t,e,r))}async function KBo(t,e,r){let n=(0,qBo.safeParse)(e,_=>HBo.LibrariesGetV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,FBo.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,BBo.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,kBo.compactMap)({Accept:"application/json"})),l=await(0,t$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,t$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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await nse.match(nse.json(200,UBo.LibraryOut$inboundSchema),nse.jsonErr(422,zBo.HTTPValidationError$inboundSchema),nse.fail("4XX"),nse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var i$r=S(Bj=>{"use strict";var WBo=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]}),GBo=Bj&&Bj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o$r=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"&&WBo(r,e,n[o]);return GBo(r,e),r}}();Object.defineProperty(Bj,"__esModule",{value:!0});Bj.betaLibrariesList=eUo;var pAe=o$r(ar()),ZBo=ae(),n$r=sr(),XBo=or(),YBo=o$r($t()),QBo=ur();function eUo(t,e){return new QBo.APIPromise(tUo(t,e))}async function tUo(t,e){let r=(0,XBo.pathToFunc)("/v1/libraries")(),n=new Headers((0,ZBo.compactMap)({Accept:"application/json"})),o=await(0,n$r.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,n$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 pAe.match(pAe.json(200,YBo.ListLibraryOut$inboundSchema),pAe.fail("4XX"),pAe.fail("5XX"))(d,l);return f.ok?[f,{status:"complete",request:l,response:d}]:[f,{status:"complete",request:l,response:d}]}});var u$r=S(Uj=>{"use strict";var rUo=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]}),nUo=Uj&&Uj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mAe=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"&&rUo(r,e,n[o]);return nUo(r,e),r}}();Object.defineProperty(Uj,"__esModule",{value:!0});Uj.betaLibrariesUpdate=dUo;var a$r=fr(),ose=mAe(ar()),oUo=ae(),iUo=ee(),s$r=sr(),aUo=or(),sUo=mAe($t()),uUo=mAe(Hn()),lUo=mAe(Vn()),cUo=ur();function dUo(t,e,r){return new cUo.APIPromise(fUo(t,e,r))}async function fUo(t,e,r){let n=(0,iUo.safeParse)(e,_=>lUo.LibrariesUpdateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,a$r.encodeJSON)("body",o.LibraryInUpdate,{explode:!0}),a={library_id:(0,a$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,aUo.pathToFunc)("/v1/libraries/{library_id}")(a),u=new Headers((0,oUo.compactMap)({"Content-Type":"application/json",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:"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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await ose.match(ose.json(200,sUo.LibraryOut$inboundSchema),ose.jsonErr(422,uUo.HTTPValidationError$inboundSchema),ose.fail("4XX"),ose.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var d$r=S(zj=>{"use strict";var pUo=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]}),mUo=zj&&zj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hAe=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"&&pUo(r,e,n[o]);return mUo(r,e),r}}();Object.defineProperty(zj,"__esModule",{value:!0});zj.betaLibrariesAccessesDelete=SUo;var l$r=fr(),ise=hAe(ar()),hUo=ae(),gUo=ee(),c$r=sr(),yUo=or(),bUo=hAe($t()),_Uo=hAe(Hn()),vUo=hAe(Vn()),wUo=ur();function SUo(t,e,r){return new wUo.APIPromise(CUo(t,e,r))}async function CUo(t,e,r){let n=(0,gUo.safeParse)(e,_=>vUo.LibrariesShareDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,l$r.encodeJSON)("body",o.SharingDelete,{explode:!0}),a={library_id:(0,l$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,yUo.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,hUo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,c$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,c$r.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await ise.match(ise.json(200,bUo.SharingOut$inboundSchema),ise.jsonErr(422,_Uo.HTTPValidationError$inboundSchema),ise.fail("4XX"),ise.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var p$r=S(Hj=>{"use strict";var xUo=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]}),OUo=Hj&&Hj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gAe=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"&&xUo(r,e,n[o]);return OUo(r,e),r}}();Object.defineProperty(Hj,"__esModule",{value:!0});Hj.betaLibrariesAccessesList=jUo;var TUo=fr(),ase=gAe(ar()),EUo=ae(),PUo=ee(),f$r=sr(),MUo=or(),RUo=gAe($t()),AUo=gAe(Hn()),IUo=gAe(Vn()),NUo=ur();function jUo(t,e,r){return new NUo.APIPromise(DUo(t,e,r))}async function DUo(t,e,r){let n=(0,PUo.safeParse)(e,_=>IUo.LibrariesShareListV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,TUo.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,MUo.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,EUo.compactMap)({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:"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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await ase.match(ase.json(200,RUo.ListSharingOut$inboundSchema),ase.jsonErr(422,AUo.HTTPValidationError$inboundSchema),ase.fail("4XX"),ase.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var g$r=S(Vj=>{"use strict";var $Uo=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]}),LUo=Vj&&Vj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),yAe=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"&&$Uo(r,e,n[o]);return LUo(r,e),r}}();Object.defineProperty(Vj,"__esModule",{value:!0});Vj.betaLibrariesAccessesUpdateOrCreate=VUo;var m$r=fr(),sse=yAe(ar()),FUo=ae(),kUo=ee(),h$r=sr(),qUo=or(),BUo=yAe($t()),UUo=yAe(Hn()),zUo=yAe(Vn()),HUo=ur();function VUo(t,e,r){return new HUo.APIPromise(JUo(t,e,r))}async function JUo(t,e,r){let n=(0,kUo.safeParse)(e,_=>zUo.LibrariesShareCreateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,m$r.encodeJSON)("body",o.SharingIn,{explode:!0}),a={library_id:(0,m$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,qUo.pathToFunc)("/v1/libraries/{library_id}/share")(a),u=new Headers((0,FUo.compactMap)({"Content-Type":"application/json",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_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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await sse.match(sse.json(200,BUo.SharingOut$inboundSchema),sse.jsonErr(422,UUo.HTTPValidationError$inboundSchema),sse.fail("4XX"),sse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var y$r=S(bAe=>{"use strict";Object.defineProperty(bAe,"__esModule",{value:!0});bAe.Accesses=void 0;var KUo=d$r(),WUo=p$r(),GUo=g$r(),ZUo=jc(),zut=xd(),Hut=class extends ZUo.ClientSDK{async list(e,r){return(0,zut.unwrapAsync)((0,WUo.betaLibrariesAccessesList)(this,e,r))}async updateOrCreate(e,r){return(0,zut.unwrapAsync)((0,GUo.betaLibrariesAccessesUpdateOrCreate)(this,e,r))}async delete(e,r){return(0,zut.unwrapAsync)((0,KUo.betaLibrariesAccessesDelete)(this,e,r))}};bAe.Accesses=Hut});var v$r=S(Jj=>{"use strict";var XUo=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]}),YUo=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"&&XUo(r,e,n[o]);return YUo(r,e),r}}();Object.defineProperty(Jj,"__esModule",{value:!0});Jj.betaLibrariesDocumentsDelete=azo;var QUo=_Ae(te()),b$r=fr(),use=_Ae(ar()),ezo=ae(),tzo=ee(),_$r=sr(),rzo=or(),nzo=_Ae(Hn()),ozo=_Ae(Vn()),izo=ur();function azo(t,e,r){return new izo.APIPromise(szo(t,e,r))}async function szo(t,e,r){let n=(0,tzo.safeParse)(e,_=>ozo.LibrariesDocumentsDeleteV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,b$r.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,b$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,rzo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,ezo.compactMap)({Accept:"application/json"})),l=await(0,_$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,_$r.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await use.match(use.nil(204,QUo.void()),use.jsonErr(422,nzo.HTTPValidationError$inboundSchema),use.fail("4XX"),use.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var C$r=S(Kj=>{"use strict";var uzo=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]}),lzo=Kj&&Kj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vAe=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"&&uzo(r,e,n[o]);return lzo(r,e),r}}();Object.defineProperty(Kj,"__esModule",{value:!0});Kj.betaLibrariesDocumentsExtractedTextSignedUrl=yzo;var czo=vAe(te()),w$r=fr(),lse=vAe(ar()),dzo=ae(),fzo=ee(),S$r=sr(),pzo=or(),mzo=vAe(Hn()),hzo=vAe(Vn()),gzo=ur();function yzo(t,e,r){return new gzo.APIPromise(bzo(t,e,r))}async function bzo(t,e,r){let n=(0,fzo.safeParse)(e,_=>hzo.LibrariesDocumentsGetExtractedTextSignedUrlV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,w$r.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,w$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,pzo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/extracted-text-signed-url")(a),u=new Headers((0,dzo.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:"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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await lse.match(lse.json(200,czo.string()),lse.jsonErr(422,mzo.HTTPValidationError$inboundSchema),lse.fail("4XX"),lse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var T$r=S(Wj=>{"use strict";var _zo=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]}),vzo=Wj&&Wj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wAe=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"&&_zo(r,e,n[o]);return vzo(r,e),r}}();Object.defineProperty(Wj,"__esModule",{value:!0});Wj.betaLibrariesDocumentsGet=Pzo;var x$r=fr(),cse=wAe(ar()),wzo=ae(),Szo=ee(),O$r=sr(),Czo=or(),xzo=wAe($t()),Ozo=wAe(Hn()),Tzo=wAe(Vn()),Ezo=ur();function Pzo(t,e,r){return new Ezo.APIPromise(Mzo(t,e,r))}async function Mzo(t,e,r){let n=(0,Szo.safeParse)(e,_=>Tzo.LibrariesDocumentsGetV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,x$r.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,x$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,Czo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,wzo.compactMap)({Accept:"application/json"})),l=await(0,O$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,O$r.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await cse.match(cse.json(200,xzo.DocumentOut$inboundSchema),cse.jsonErr(422,Ozo.HTTPValidationError$inboundSchema),cse.fail("4XX"),cse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var M$r=S(Gj=>{"use strict";var Rzo=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]}),Azo=Gj&&Gj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SAe=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"&&Rzo(r,e,n[o]);return Azo(r,e),r}}();Object.defineProperty(Gj,"__esModule",{value:!0});Gj.betaLibrariesDocumentsGetSignedUrl=kzo;var Izo=SAe(te()),E$r=fr(),dse=SAe(ar()),Nzo=ae(),jzo=ee(),P$r=sr(),Dzo=or(),$zo=SAe(Hn()),Lzo=SAe(Vn()),Fzo=ur();function kzo(t,e,r){return new Fzo.APIPromise(qzo(t,e,r))}async function qzo(t,e,r){let n=(0,jzo.safeParse)(e,_=>Lzo.LibrariesDocumentsGetSignedUrlV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,E$r.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,E$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,Dzo.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/signed-url")(a),u=new Headers((0,Nzo.compactMap)({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:"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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await dse.match(dse.json(200,Izo.string()),dse.jsonErr(422,$zo.HTTPValidationError$inboundSchema),dse.fail("4XX"),dse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var I$r=S(Zj=>{"use strict";var Bzo=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]}),Uzo=Zj&&Zj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),CAe=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"&&Bzo(r,e,n[o]);return Uzo(r,e),r}}();Object.defineProperty(Zj,"__esModule",{value:!0});Zj.betaLibrariesDocumentsList=Zzo;var R$r=fr(),fse=CAe(ar()),zzo=ae(),Hzo=ee(),A$r=sr(),Vzo=or(),Jzo=CAe($t()),Kzo=CAe(Hn()),Wzo=CAe(Vn()),Gzo=ur();function Zzo(t,e,r){return new Gzo.APIPromise(Xzo(t,e,r))}async function Xzo(t,e,r){let n=(0,Hzo.safeParse)(e,w=>Wzo.LibrariesDocumentsListV1Request$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={library_id:(0,R$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,Vzo.pathToFunc)("/v1/libraries/{library_id}/documents")(a),u=(0,R$r.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,zzo.compactMap)({Accept:"application/json"})),c=await(0,A$r.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,A$r.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,g=await t._do(h,{context:p,errorCodes:["422","4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!g.ok)return[g,{status:"request-error",request:h}];let y=g.value,b={HttpMeta:{Response:y,Request:h}},[_]=await fse.match(fse.json(200,Jzo.ListDocumentOut$inboundSchema),fse.jsonErr(422,Kzo.HTTPValidationError$inboundSchema),fse.fail("4XX"),fse.fail("5XX"))(y,h,{extraFields:b});return _.ok?[_,{status:"complete",request:h,response:y}]:[_,{status:"complete",request:h,response:y}]}});var D$r=S(Xj=>{"use strict";var Yzo=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]}),Qzo=Xj&&Xj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xAe=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"&&Yzo(r,e,n[o]);return Qzo(r,e),r}}();Object.defineProperty(Xj,"__esModule",{value:!0});Xj.betaLibrariesDocumentsReprocess=s4o;var e4o=xAe(te()),N$r=fr(),pse=xAe(ar()),t4o=ae(),r4o=ee(),j$r=sr(),n4o=or(),o4o=xAe(Hn()),i4o=xAe(Vn()),a4o=ur();function s4o(t,e,r){return new a4o.APIPromise(u4o(t,e,r))}async function u4o(t,e,r){let n=(0,r4o.safeParse)(e,_=>i4o.LibrariesDocumentsReprocessV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,N$r.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,N$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,n4o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/reprocess")(a),u=new Headers((0,t4o.compactMap)({Accept:"application/json"})),l=await(0,j$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,j$r.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await pse.match(pse.nil(204,e4o.void()),pse.jsonErr(422,o4o.HTTPValidationError$inboundSchema),pse.fail("4XX"),pse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var F$r=S(Yj=>{"use strict";var l4o=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]}),c4o=Yj&&Yj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),OAe=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"&&l4o(r,e,n[o]);return c4o(r,e),r}}();Object.defineProperty(Yj,"__esModule",{value:!0});Yj.betaLibrariesDocumentsStatus=b4o;var $$r=fr(),mse=OAe(ar()),d4o=ae(),f4o=ee(),L$r=sr(),p4o=or(),m4o=OAe($t()),h4o=OAe(Hn()),g4o=OAe(Vn()),y4o=ur();function b4o(t,e,r){return new y4o.APIPromise(_4o(t,e,r))}async function _4o(t,e,r){let n=(0,f4o.safeParse)(e,_=>g4o.LibrariesDocumentsGetStatusV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,$$r.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,$$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,p4o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/status")(a),u=new Headers((0,d4o.compactMap)({Accept:"application/json"})),l=await(0,L$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,L$r.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await mse.match(mse.json(200,m4o.ProcessingStatusOut$inboundSchema),mse.jsonErr(422,h4o.HTTPValidationError$inboundSchema),mse.fail("4XX"),mse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var B$r=S(Qj=>{"use strict";var v4o=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]}),w4o=Qj&&Qj.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),TAe=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"&&v4o(r,e,n[o]);return w4o(r,e),r}}();Object.defineProperty(Qj,"__esModule",{value:!0});Qj.betaLibrariesDocumentsTextContent=M4o;var k$r=fr(),hse=TAe(ar()),S4o=ae(),C4o=ee(),q$r=sr(),x4o=or(),O4o=TAe($t()),T4o=TAe(Hn()),E4o=TAe(Vn()),P4o=ur();function M4o(t,e,r){return new P4o.APIPromise(R4o(t,e,r))}async function R4o(t,e,r){let n=(0,C4o.safeParse)(e,_=>E4o.LibrariesDocumentsGetTextContentV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={document_id:(0,k$r.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,k$r.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,x4o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}/text_content")(a),u=new Headers((0,S4o.compactMap)({Accept:"application/json"})),l=await(0,q$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,q$r.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await hse.match(hse.json(200,O4o.DocumentTextContent$inboundSchema),hse.jsonErr(422,T4o.HTTPValidationError$inboundSchema),hse.fail("4XX"),hse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var z$r=S(eD=>{"use strict";var A4o=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]}),I4o=eD&&eD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),EAe=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"&&A4o(r,e,n[o]);return I4o(r,e),r}}();Object.defineProperty(eD,"__esModule",{value:!0});eD.betaLibrariesDocumentsUpdate=q4o;var Vut=fr(),gse=EAe(ar()),N4o=ae(),j4o=ee(),U$r=sr(),D4o=or(),$4o=EAe($t()),L4o=EAe(Hn()),F4o=EAe(Vn()),k4o=ur();function q4o(t,e,r){return new k4o.APIPromise(B4o(t,e,r))}async function B4o(t,e,r){let n=(0,j4o.safeParse)(e,_=>F4o.LibrariesDocumentsUpdateV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,Vut.encodeJSON)("body",o.DocumentUpdateIn,{explode:!0}),a={document_id:(0,Vut.encodeSimple)("document_id",o.document_id,{explode:!1,charEncoding:"percent"}),library_id:(0,Vut.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,D4o.pathToFunc)("/v1/libraries/{library_id}/documents/{document_id}")(a),u=new Headers((0,N4o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),l=await(0,U$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,U$r.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await gse.match(gse.json(200,$4o.DocumentOut$inboundSchema),gse.jsonErr(422,L4o.HTTPValidationError$inboundSchema),gse.fail("4XX"),gse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var V$r=S(tD=>{"use strict";var U4o=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]}),z4o=tD&&tD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),MAe=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"&&U4o(r,e,n[o]);return z4o(r,e),r}}();Object.defineProperty(tD,"__esModule",{value:!0});tD.betaLibrariesDocumentsUpload=Q4o;var PAe=fr(),Jut=BG(),yse=MAe(ar()),H4o=ae(),V4o=ee(),H$r=sr(),J4o=or(),K4o=MAe($t()),W4o=MAe(Hn()),G4o=MAe(Vn()),Z4o=ur(),X4o=gj(),Y4o=Uae();function Q4o(t,e,r){return new Z4o.APIPromise(e2o(t,e,r))}async function e2o(t,e,r){let n=(0,V4o.safeParse)(e,_=>G4o.LibrariesDocumentsUploadV1Request$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,X4o.isBlobLike)(o.RequestBody.file))(0,PAe.appendForm)(i,"file",o.RequestBody.file);else if((0,Y4o.isReadableStream)(o.RequestBody.file.content)){let _=await(0,Jut.readableStreamToArrayBuffer)(o.RequestBody.file.content),w=(0,Jut.getContentTypeFromFileName)(o.RequestBody.file.fileName)||"application/octet-stream",x=new Blob([_],{type:w});(0,PAe.appendForm)(i,"file",x,o.RequestBody.file.fileName)}else{let _=(0,Jut.getContentTypeFromFileName)(o.RequestBody.file.fileName)||"application/octet-stream";(0,PAe.appendForm)(i,"file",new Blob([o.RequestBody.file.content],{type:_}),o.RequestBody.file.fileName)}let a={library_id:(0,PAe.encodeSimple)("library_id",o.library_id,{explode:!1,charEncoding:"percent"})},s=(0,J4o.pathToFunc)("/v1/libraries/{library_id}/documents")(a),u=new Headers((0,H4o.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_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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await yse.match(yse.json([200,201],K4o.DocumentOut$inboundSchema),yse.jsonErr(422,W4o.HTTPValidationError$inboundSchema),yse.fail("4XX"),yse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var J$r=S(RAe=>{"use strict";Object.defineProperty(RAe,"__esModule",{value:!0});RAe.Documents=void 0;var t2o=v$r(),r2o=C$r(),n2o=T$r(),o2o=M$r(),i2o=I$r(),a2o=D$r(),s2o=F$r(),u2o=B$r(),l2o=z$r(),c2o=V$r(),d2o=jc(),oI=xd(),Kut=class extends d2o.ClientSDK{async list(e,r){return(0,oI.unwrapAsync)((0,i2o.betaLibrariesDocumentsList)(this,e,r))}async upload(e,r){return(0,oI.unwrapAsync)((0,c2o.betaLibrariesDocumentsUpload)(this,e,r))}async get(e,r){return(0,oI.unwrapAsync)((0,n2o.betaLibrariesDocumentsGet)(this,e,r))}async update(e,r){return(0,oI.unwrapAsync)((0,l2o.betaLibrariesDocumentsUpdate)(this,e,r))}async delete(e,r){return(0,oI.unwrapAsync)((0,t2o.betaLibrariesDocumentsDelete)(this,e,r))}async textContent(e,r){return(0,oI.unwrapAsync)((0,u2o.betaLibrariesDocumentsTextContent)(this,e,r))}async status(e,r){return(0,oI.unwrapAsync)((0,s2o.betaLibrariesDocumentsStatus)(this,e,r))}async getSignedUrl(e,r){return(0,oI.unwrapAsync)((0,o2o.betaLibrariesDocumentsGetSignedUrl)(this,e,r))}async extractedTextSignedUrl(e,r){return(0,oI.unwrapAsync)((0,r2o.betaLibrariesDocumentsExtractedTextSignedUrl)(this,e,r))}async reprocess(e,r){return(0,oI.unwrapAsync)((0,a2o.betaLibrariesDocumentsReprocess)(this,e,r))}};RAe.Documents=Kut});var K$r=S(AAe=>{"use strict";Object.defineProperty(AAe,"__esModule",{value:!0});AAe.Libraries=void 0;var f2o=YDr(),p2o=e$r(),m2o=r$r(),h2o=i$r(),g2o=u$r(),y2o=jc(),bse=xd(),b2o=y$r(),_2o=J$r(),Wut=class extends y2o.ClientSDK{get documents(){return this._documents??(this._documents=new _2o.Documents(this._options))}get accesses(){return this._accesses??(this._accesses=new b2o.Accesses(this._options))}async list(e){return(0,bse.unwrapAsync)((0,h2o.betaLibrariesList)(this,e))}async create(e,r){return(0,bse.unwrapAsync)((0,f2o.betaLibrariesCreate)(this,e,r))}async get(e,r){return(0,bse.unwrapAsync)((0,m2o.betaLibrariesGet)(this,e,r))}async delete(e,r){return(0,bse.unwrapAsync)((0,p2o.betaLibrariesDelete)(this,e,r))}async update(e,r){return(0,bse.unwrapAsync)((0,g2o.betaLibrariesUpdate)(this,e,r))}};AAe.Libraries=Wut});var Z$r=S(rD=>{"use strict";var v2o=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]}),w2o=rD&&rD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gut=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"&&v2o(r,e,n[o]);return w2o(r,e),r}}();Object.defineProperty(rD,"__esModule",{value:!0});rD.betaAgentsCreate=P2o;var S2o=fr(),_se=Gut(ar()),C2o=ae(),x2o=ee(),W$r=sr(),O2o=or(),G$r=Gut($t()),T2o=Gut(Hn()),E2o=ur();function P2o(t,e,r){return new E2o.APIPromise(M2o(t,e,r))}async function M2o(t,e,r){let n=(0,x2o.safeParse)(e,b=>G$r.AgentCreationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,S2o.encodeJSON)("body",o,{explode:!0}),a=(0,O2o.pathToFunc)("/v1/agents")(),s=new Headers((0,C2o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,W$r.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,W$r.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,g={HttpMeta:{Response:h,Request:p}},[y]=await _se.match(_se.json(200,G$r.Agent$inboundSchema),_se.jsonErr(422,T2o.HTTPValidationError$inboundSchema),_se.fail("4XX"),_se.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var Y$r=S(nD=>{"use strict";var R2o=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]}),A2o=nD&&nD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),IAe=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"&&R2o(r,e,n[o]);return A2o(r,e),r}}();Object.defineProperty(nD,"__esModule",{value:!0});nD.betaAgentsGet=q2o;var I2o=fr(),vse=IAe(ar()),N2o=ae(),j2o=ee(),X$r=sr(),D2o=or(),$2o=IAe($t()),L2o=IAe(Hn()),F2o=IAe(Vn()),k2o=ur();function q2o(t,e,r){return new k2o.APIPromise(B2o(t,e,r))}async function B2o(t,e,r){let n=(0,j2o.safeParse)(e,_=>F2o.AgentsApiV1AgentsGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={agent_id:(0,I2o.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,D2o.pathToFunc)("/v1/agents/{agent_id}")(a),u=new Headers((0,N2o.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_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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await vse.match(vse.json(200,$2o.Agent$inboundSchema),vse.jsonErr(422,L2o.HTTPValidationError$inboundSchema),vse.fail("4XX"),vse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var eLr=S(oD=>{"use strict";var U2o=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]}),z2o=oD&&oD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Sse=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"&&U2o(r,e,n[o]);return z2o(r,e),r}}();Object.defineProperty(oD,"__esModule",{value:!0});oD.betaAgentsList=Q2o;var H2o=Sse(te()),V2o=fr(),wse=Sse(ar()),J2o=ae(),K2o=ee(),Q$r=sr(),W2o=or(),G2o=Sse($t()),Z2o=Sse(Hn()),X2o=Sse(Vn()),Y2o=ur();function Q2o(t,e,r){return new Y2o.APIPromise(eHo(t,e,r))}async function eHo(t,e,r){let n=(0,K2o.safeParse)(e,_=>X2o.AgentsApiV1AgentsListRequest$outboundSchema.optional().parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,W2o.pathToFunc)("/v1/agents")(),s=(0,V2o.encodeFormQuery)({page:o?.page,page_size:o?.page_size}),u=new Headers((0,J2o.compactMap)({Accept:"application/json"})),l=await(0,Q$r.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,Q$r.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await wse.match(wse.json(200,H2o.array(G2o.Agent$inboundSchema)),wse.jsonErr(422,Z2o.HTTPValidationError$inboundSchema),wse.fail("4XX"),wse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var nLr=S(iD=>{"use strict";var tHo=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]}),rHo=iD&&iD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),NAe=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"&&tHo(r,e,n[o]);return rHo(r,e),r}}();Object.defineProperty(iD,"__esModule",{value:!0});iD.betaAgentsUpdate=cHo;var tLr=fr(),Cse=NAe(ar()),nHo=ae(),oHo=ee(),rLr=sr(),iHo=or(),aHo=NAe($t()),sHo=NAe(Hn()),uHo=NAe(Vn()),lHo=ur();function cHo(t,e,r){return new lHo.APIPromise(dHo(t,e,r))}async function dHo(t,e,r){let n=(0,oHo.safeParse)(e,_=>uHo.AgentsApiV1AgentsUpdateRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,tLr.encodeJSON)("body",o.AgentUpdateRequest,{explode:!0}),a={agent_id:(0,tLr.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,iHo.pathToFunc)("/v1/agents/{agent_id}")(a),u=new Headers((0,nHo.compactMap)({"Content-Type":"application/json",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:"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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await Cse.match(Cse.json(200,aHo.Agent$inboundSchema),Cse.jsonErr(422,sHo.HTTPValidationError$inboundSchema),Cse.fail("4XX"),Cse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var aLr=S(aD=>{"use strict";var fHo=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]}),pHo=aD&&aD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jAe=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"&&fHo(r,e,n[o]);return pHo(r,e),r}}();Object.defineProperty(aD,"__esModule",{value:!0});aD.betaAgentsUpdateVersion=wHo;var oLr=fr(),xse=jAe(ar()),mHo=ae(),hHo=ee(),iLr=sr(),gHo=or(),yHo=jAe($t()),bHo=jAe(Hn()),_Ho=jAe(Vn()),vHo=ur();function wHo(t,e,r){return new vHo.APIPromise(SHo(t,e,r))}async function SHo(t,e,r){let n=(0,hHo.safeParse)(e,w=>_Ho.AgentsApiV1AgentsUpdateVersionRequest$outboundSchema.parse(w),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={agent_id:(0,oLr.encodeSimple)("agent_id",o.agent_id,{explode:!1,charEncoding:"percent"})},s=(0,gHo.pathToFunc)("/v1/agents/{agent_id}/version")(a),u=(0,oLr.encodeFormQuery)({version:o.version}),l=new Headers((0,mHo.compactMap)({Accept:"application/json"})),c=await(0,iLr.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,iLr.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,g=await t._do(h,{context:p,errorCodes:["422","4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!g.ok)return[g,{status:"request-error",request:h}];let y=g.value,b={HttpMeta:{Response:y,Request:h}},[_]=await xse.match(xse.json(200,yHo.Agent$inboundSchema),xse.jsonErr(422,bHo.HTTPValidationError$inboundSchema),xse.fail("4XX"),xse.fail("5XX"))(y,h,{extraFields:b});return _.ok?[_,{status:"complete",request:h,response:y}]:[_,{status:"complete",request:h,response:y}]}});var sLr=S(DAe=>{"use strict";Object.defineProperty(DAe,"__esModule",{value:!0});DAe.MistralAgents=void 0;var CHo=Z$r(),xHo=Y$r(),OHo=eLr(),THo=nLr(),EHo=aLr(),PHo=jc(),Ose=xd(),Zut=class extends PHo.ClientSDK{async create(e,r){return(0,Ose.unwrapAsync)((0,CHo.betaAgentsCreate)(this,e,r))}async list(e,r){return(0,Ose.unwrapAsync)((0,OHo.betaAgentsList)(this,e,r))}async get(e,r){return(0,Ose.unwrapAsync)((0,xHo.betaAgentsGet)(this,e,r))}async update(e,r){return(0,Ose.unwrapAsync)((0,THo.betaAgentsUpdate)(this,e,r))}async updateVersion(e,r){return(0,Ose.unwrapAsync)((0,EHo.betaAgentsUpdateVersion)(this,e,r))}};DAe.MistralAgents=Zut});var uLr=S($Ae=>{"use strict";Object.defineProperty($Ae,"__esModule",{value:!0});$Ae.Beta=void 0;var MHo=jc(),RHo=GDr(),AHo=K$r(),IHo=sLr(),Xut=class extends MHo.ClientSDK{get conversations(){return this._conversations??(this._conversations=new RHo.Conversations(this._options))}get agents(){return this._agents??(this._agents=new IHo.MistralAgents(this._options))}get libraries(){return this._libraries??(this._libraries=new AHo.Libraries(this._options))}};$Ae.Beta=Xut});var dLr=S(sD=>{"use strict";var NHo=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]}),jHo=sD&&sD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Yut=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"&&NHo(r,e,n[o]);return jHo(r,e),r}}();Object.defineProperty(sD,"__esModule",{value:!0});sD.chatComplete=BHo;var DHo=fr(),Tse=Yut(ar()),$Ho=ae(),LHo=ee(),lLr=sr(),FHo=or(),cLr=Yut($t()),kHo=Yut(Hn()),qHo=ur();function BHo(t,e,r){return new qHo.APIPromise(UHo(t,e,r))}async function UHo(t,e,r){let n=(0,LHo.safeParse)(e,b=>cLr.ChatCompletionRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,DHo.encodeJSON)("body",o,{explode:!0}),a=(0,FHo.pathToFunc)("/v1/chat/completions")(),s=new Headers((0,$Ho.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,lLr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,lLr.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,g={HttpMeta:{Response:h,Request:p}},[y]=await Tse.match(Tse.json(200,cLr.ChatCompletionResponse$inboundSchema),Tse.jsonErr(422,kHo.HTTPValidationError$inboundSchema),Tse.fail("4XX"),Tse.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var mLr=S(uD=>{"use strict";var zHo=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]}),HHo=uD&&uD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LAe=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"&&zHo(r,e,n[o]);return HHo(r,e),r}}();Object.defineProperty(uD,"__esModule",{value:!0});uD.chatStream=QHo;var VHo=LAe(te()),JHo=fr(),KHo=Tq(),Ese=LAe(ar()),WHo=ae(),GHo=ee(),fLr=sr(),ZHo=or(),pLr=LAe($t()),XHo=LAe(Hn()),YHo=ur();function QHo(t,e,r){return new YHo.APIPromise(eVo(t,e,r))}async function eVo(t,e,r){let n=(0,GHo.safeParse)(e,b=>pLr.ChatCompletionStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,JHo.encodeJSON)("body",o,{explode:!0}),a=(0,ZHo.pathToFunc)("/v1/chat/completions#stream")(),s=new Headers((0,WHo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),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:"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,g={HttpMeta:{Response:h,Request:p}},[y]=await Ese.match(Ese.sse(200,VHo.instanceof(ReadableStream).transform(b=>new KHo.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:pLr.CompletionEvent$inboundSchema.parse(_)}))),Ese.jsonErr(422,XHo.HTTPValidationError$inboundSchema),Ese.fail("4XX"),Ese.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var FAe=S(iI=>{"use strict";Object.defineProperty(iI,"__esModule",{value:!0});iI.getDefaultOptions=iI.defaultOptions=iI.ignoreOverride=void 0;iI.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");iI.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 tVo=t=>typeof t=="string"?{...iI.defaultOptions,name:t}:{...iI.defaultOptions,...t};iI.getDefaultOptions=tVo});var Qut=S(kAe=>{"use strict";Object.defineProperty(kAe,"__esModule",{value:!0});kAe.getRefs=void 0;var rVo=FAe(),nVo=t=>{let e=(0,rVo.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}]))}};kAe.getRefs=nVo});var Mq=S(j9=>{"use strict";Object.defineProperty(j9,"__esModule",{value:!0});j9.setResponseValueAndErrors=j9.addErrorMessage=void 0;function hLr(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}j9.addErrorMessage=hLr;function oVo(t,e,r,n,o){t[e]=r,hLr(t,e,n,o)}j9.setResponseValueAndErrors=oVo});var elt=S(qAe=>{"use strict";Object.defineProperty(qAe,"__esModule",{value:!0});qAe.parseAnyDef=void 0;function iVo(){return{}}qAe.parseAnyDef=iVo});var tlt=S(UAe=>{"use strict";Object.defineProperty(UAe,"__esModule",{value:!0});UAe.parseArrayDef=void 0;var aVo=te(),BAe=Mq(),sVo=am();function uVo(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==aVo.ZodFirstPartyTypeKind.ZodAny&&(r.items=(0,sVo.parseDef)(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(0,BAe.setResponseValueAndErrors)(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&(0,BAe.setResponseValueAndErrors)(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&((0,BAe.setResponseValueAndErrors)(r,"minItems",t.exactLength.value,t.exactLength.message,e),(0,BAe.setResponseValueAndErrors)(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}UAe.parseArrayDef=uVo});var rlt=S(zAe=>{"use strict";Object.defineProperty(zAe,"__esModule",{value:!0});zAe.parseBigintDef=void 0;var AV=Mq();function lVo(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,AV.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,AV.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,AV.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,AV.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,AV.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,AV.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,AV.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}zAe.parseBigintDef=lVo});var nlt=S(HAe=>{"use strict";Object.defineProperty(HAe,"__esModule",{value:!0});HAe.parseBooleanDef=void 0;function cVo(){return{type:"boolean"}}HAe.parseBooleanDef=cVo});var JAe=S(VAe=>{"use strict";Object.defineProperty(VAe,"__esModule",{value:!0});VAe.parseBrandedDef=void 0;var dVo=am();function fVo(t,e){return(0,dVo.parseDef)(t.type._def,e)}VAe.parseBrandedDef=fVo});var olt=S(KAe=>{"use strict";Object.defineProperty(KAe,"__esModule",{value:!0});KAe.parseCatchDef=void 0;var pVo=am(),mVo=(t,e)=>(0,pVo.parseDef)(t.innerType._def,e);KAe.parseCatchDef=mVo});var ilt=S(WAe=>{"use strict";Object.defineProperty(WAe,"__esModule",{value:!0});WAe.parseDateDef=void 0;var gLr=Mq();function yLr(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>yLr(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 hVo(t,e)}}WAe.parseDateDef=yLr;var hVo=(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,gLr.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e);break;case"max":(0,gLr.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e);break}return r}});var alt=S(GAe=>{"use strict";Object.defineProperty(GAe,"__esModule",{value:!0});GAe.parseDefaultDef=void 0;var gVo=am();function yVo(t,e){return{...(0,gVo.parseDef)(t.innerType._def,e),default:t.defaultValue()}}GAe.parseDefaultDef=yVo});var slt=S(ZAe=>{"use strict";Object.defineProperty(ZAe,"__esModule",{value:!0});ZAe.parseEffectsDef=void 0;var bVo=am();function _Vo(t,e){return e.effectStrategy==="input"?(0,bVo.parseDef)(t.schema._def,e):{}}ZAe.parseEffectsDef=_Vo});var ult=S(XAe=>{"use strict";Object.defineProperty(XAe,"__esModule",{value:!0});XAe.parseEnumDef=void 0;function vVo(t){return{type:"string",enum:Array.from(t.values)}}XAe.parseEnumDef=vVo});var llt=S(YAe=>{"use strict";Object.defineProperty(YAe,"__esModule",{value:!0});YAe.parseIntersectionDef=void 0;var bLr=am(),wVo=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function SVo(t,e){let r=[(0,bLr.parseDef)(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0,bLr.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(wVo(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}YAe.parseIntersectionDef=SVo});var clt=S(QAe=>{"use strict";Object.defineProperty(QAe,"__esModule",{value:!0});QAe.parseLiteralDef=void 0;function CVo(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}}QAe.parseLiteralDef=CVo});var eIe=S(Pg=>{"use strict";Object.defineProperty(Pg,"__esModule",{value:!0});Pg.parseStringDef=Pg.zodPatterns=void 0;var IV=Mq(),dlt;Pg.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:()=>(dlt===void 0&&(dlt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),dlt),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 xVo(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":(0,IV.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":(0,IV.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":sx(r,"email",n.message,e);break;case"format:idn-email":sx(r,"idn-email",n.message,e);break;case"pattern:zod":Pb(r,Pg.zodPatterns.email,n.message,e);break}break;case"url":sx(r,"uri",n.message,e);break;case"uuid":sx(r,"uuid",n.message,e);break;case"regex":Pb(r,n.regex,n.message,e);break;case"cuid":Pb(r,Pg.zodPatterns.cuid,n.message,e);break;case"cuid2":Pb(r,Pg.zodPatterns.cuid2,n.message,e);break;case"startsWith":Pb(r,RegExp(`^${flt(n.value,e)}`),n.message,e);break;case"endsWith":Pb(r,RegExp(`${flt(n.value,e)}$`),n.message,e);break;case"datetime":sx(r,"date-time",n.message,e);break;case"date":sx(r,"date",n.message,e);break;case"time":sx(r,"time",n.message,e);break;case"duration":sx(r,"duration",n.message,e);break;case"length":(0,IV.setResponseValueAndErrors)(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),(0,IV.setResponseValueAndErrors)(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Pb(r,RegExp(flt(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&sx(r,"ipv4",n.message,e),n.version!=="v4"&&sx(r,"ipv6",n.message,e);break}case"base64url":Pb(r,Pg.zodPatterns.base64url,n.message,e);break;case"jwt":Pb(r,Pg.zodPatterns.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Pb(r,Pg.zodPatterns.ipv4Cidr,n.message,e),n.version!=="v4"&&Pb(r,Pg.zodPatterns.ipv6Cidr,n.message,e);break}case"emoji":Pb(r,Pg.zodPatterns.emoji(),n.message,e);break;case"ulid":{Pb(r,Pg.zodPatterns.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{sx(r,"binary",n.message,e);break}case"contentEncoding:base64":{(0,IV.setResponseValueAndErrors)(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Pb(r,Pg.zodPatterns.base64,n.message,e);break}}break}case"nanoid":Pb(r,Pg.zodPatterns.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}Pg.parseStringDef=xVo;function flt(t,e){return e.patternStrategy==="escape"?TVo(t):t}var OVo=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function TVo(t){let e="";for(let r=0;r<t.length;r++)OVo.has(t[r])||(e+="\\"),e+=t[r];return e}function sx(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,IV.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:_Lr(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):(0,IV.setResponseValueAndErrors)(t,"pattern",_Lr(e,n),r,n)}function _Lr(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 rIe=S(tIe=>{"use strict";Object.defineProperty(tIe,"__esModule",{value:!0});tIe.parseRecordDef=void 0;var Pse=te(),vLr=am(),EVo=eIe(),PVo=JAe();function MVo(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===Pse.ZodFirstPartyTypeKind.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:(0,vLr.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:(0,vLr.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===Pse.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=(0,EVo.parseStringDef)(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===Pse.ZodFirstPartyTypeKind.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===Pse.ZodFirstPartyTypeKind.ZodBranded&&t.keyType._def.type._def.typeName===Pse.ZodFirstPartyTypeKind.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=(0,PVo.parseBrandedDef)(t.keyType._def,e);return{...r,propertyNames:o}}}return r}tIe.parseRecordDef=MVo});var plt=S(nIe=>{"use strict";Object.defineProperty(nIe,"__esModule",{value:!0});nIe.parseMapDef=void 0;var wLr=am(),RVo=rIe();function AVo(t,e){if(e.mapStrategy==="record")return(0,RVo.parseRecordDef)(t,e);let r=(0,wLr.parseDef)(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0,wLr.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}}}nIe.parseMapDef=AVo});var mlt=S(oIe=>{"use strict";Object.defineProperty(oIe,"__esModule",{value:!0});oIe.parseNativeEnumDef=void 0;function IVo(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}}oIe.parseNativeEnumDef=IVo});var hlt=S(iIe=>{"use strict";Object.defineProperty(iIe,"__esModule",{value:!0});iIe.parseNeverDef=void 0;function NVo(){return{not:{}}}iIe.parseNeverDef=NVo});var glt=S(aIe=>{"use strict";Object.defineProperty(aIe,"__esModule",{value:!0});aIe.parseNullDef=void 0;function jVo(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}aIe.parseNullDef=jVo});var sIe=S(Rq=>{"use strict";Object.defineProperty(Rq,"__esModule",{value:!0});Rq.parseUnionDef=Rq.primitiveMappings=void 0;var DVo=am();Rq.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function $Vo(t,e){if(e.target==="openApi3")return SLr(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Rq.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let a=Rq.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 SLr(t,e)}Rq.parseUnionDef=$Vo;var SLr=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>(0,DVo.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 ylt=S(uIe=>{"use strict";Object.defineProperty(uIe,"__esModule",{value:!0});uIe.parseNullableDef=void 0;var CLr=am(),xLr=sIe();function LVo(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:xLr.primitiveMappings[t.innerType._def.typeName],nullable:!0}:{type:[xLr.primitiveMappings[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0,CLr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=(0,CLr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}uIe.parseNullableDef=LVo});var blt=S(lIe=>{"use strict";Object.defineProperty(lIe,"__esModule",{value:!0});lIe.parseNumberDef=void 0;var Aq=Mq();function FVo(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,Aq.addErrorMessage)(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0,Aq.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e):(0,Aq.setResponseValueAndErrors)(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),(0,Aq.setResponseValueAndErrors)(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0,Aq.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e):(0,Aq.setResponseValueAndErrors)(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),(0,Aq.setResponseValueAndErrors)(r,"maximum",n.value,n.message,e));break;case"multipleOf":(0,Aq.setResponseValueAndErrors)(r,"multipleOf",n.value,n.message,e);break}return r}lIe.parseNumberDef=FVo});var vlt=S(cIe=>{"use strict";Object.defineProperty(cIe,"__esModule",{value:!0});cIe.parseObjectDef=void 0;var kVo=te(),_lt=am();function qVo(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":(0,_lt.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":(0,_lt.parseDef)(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function BVo(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 kVo.ZodOptional&&(a=a._def.innerType),a.isNullable()||(a=a.nullable()),s=!1);let u=(0,_lt.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:qVo(t,e)};return n.required.length||delete n.required,n}cIe.parseObjectDef=BVo});var wlt=S(dIe=>{"use strict";Object.defineProperty(dIe,"__esModule",{value:!0});dIe.parseOptionalDef=void 0;var OLr=am(),UVo=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return(0,OLr.parseDef)(t.innerType._def,e);let r=(0,OLr.parseDef)(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};dIe.parseOptionalDef=UVo});var Slt=S(pIe=>{"use strict";Object.defineProperty(pIe,"__esModule",{value:!0});pIe.parsePipelineDef=void 0;var fIe=am(),zVo=(t,e)=>{if(e.pipeStrategy==="input")return(0,fIe.parseDef)(t.in._def,e);if(e.pipeStrategy==="output")return(0,fIe.parseDef)(t.out._def,e);let r=(0,fIe.parseDef)(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0,fIe.parseDef)(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};pIe.parsePipelineDef=zVo});var Clt=S(mIe=>{"use strict";Object.defineProperty(mIe,"__esModule",{value:!0});mIe.parsePromiseDef=void 0;var HVo=am();function VVo(t,e){return(0,HVo.parseDef)(t.type._def,e)}mIe.parsePromiseDef=VVo});var xlt=S(hIe=>{"use strict";Object.defineProperty(hIe,"__esModule",{value:!0});hIe.parseSetDef=void 0;var TLr=Mq(),JVo=am();function KVo(t,e){let n={type:"array",uniqueItems:!0,items:(0,JVo.parseDef)(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(0,TLr.setResponseValueAndErrors)(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&(0,TLr.setResponseValueAndErrors)(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}hIe.parseSetDef=KVo});var Tlt=S(gIe=>{"use strict";Object.defineProperty(gIe,"__esModule",{value:!0});gIe.parseTupleDef=void 0;var Olt=am();function WVo(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>(0,Olt.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:(0,Olt.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,Olt.parseDef)(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}gIe.parseTupleDef=WVo});var Elt=S(yIe=>{"use strict";Object.defineProperty(yIe,"__esModule",{value:!0});yIe.parseUndefinedDef=void 0;function GVo(){return{not:{}}}yIe.parseUndefinedDef=GVo});var Plt=S(bIe=>{"use strict";Object.defineProperty(bIe,"__esModule",{value:!0});bIe.parseUnknownDef=void 0;function ZVo(){return{}}bIe.parseUnknownDef=ZVo});var Mlt=S(_Ie=>{"use strict";Object.defineProperty(_Ie,"__esModule",{value:!0});_Ie.parseReadonlyDef=void 0;var XVo=am(),YVo=(t,e)=>(0,XVo.parseDef)(t.innerType._def,e);_Ie.parseReadonlyDef=YVo});var am=S(vIe=>{"use strict";Object.defineProperty(vIe,"__esModule",{value:!0});vIe.parseDef=void 0;var Ri=te(),QVo=elt(),eJo=tlt(),tJo=rlt(),rJo=nlt(),nJo=JAe(),oJo=olt(),iJo=ilt(),aJo=alt(),sJo=slt(),uJo=ult(),lJo=llt(),cJo=clt(),dJo=plt(),fJo=mlt(),pJo=hlt(),mJo=glt(),hJo=ylt(),gJo=blt(),yJo=vlt(),bJo=wlt(),_Jo=Slt(),vJo=Clt(),wJo=rIe(),SJo=xlt(),CJo=eIe(),xJo=Tlt(),OJo=Elt(),TJo=sIe(),EJo=Plt(),PJo=Mlt(),MJo=FAe();function ELr(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==MJo.ignoreOverride)return a}if(n&&!r){let a=RJo(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=IJo(t,t.typeName,e);return i&&NJo(t,e,i),o.jsonSchema=i,i}vIe.parseDef=ELr;var RJo=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:AJo(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}},AJo=(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("/")},IJo=(t,e,r)=>{switch(e){case Ri.ZodFirstPartyTypeKind.ZodString:return(0,CJo.parseStringDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodNumber:return(0,gJo.parseNumberDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodObject:return(0,yJo.parseObjectDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodBigInt:return(0,tJo.parseBigintDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodBoolean:return(0,rJo.parseBooleanDef)();case Ri.ZodFirstPartyTypeKind.ZodDate:return(0,iJo.parseDateDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodUndefined:return(0,OJo.parseUndefinedDef)();case Ri.ZodFirstPartyTypeKind.ZodNull:return(0,mJo.parseNullDef)(r);case Ri.ZodFirstPartyTypeKind.ZodArray:return(0,eJo.parseArrayDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodUnion:case Ri.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return(0,TJo.parseUnionDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodIntersection:return(0,lJo.parseIntersectionDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodTuple:return(0,xJo.parseTupleDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodRecord:return(0,wJo.parseRecordDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodLiteral:return(0,cJo.parseLiteralDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodEnum:return(0,uJo.parseEnumDef)(t);case Ri.ZodFirstPartyTypeKind.ZodNativeEnum:return(0,fJo.parseNativeEnumDef)(t);case Ri.ZodFirstPartyTypeKind.ZodNullable:return(0,hJo.parseNullableDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodOptional:return(0,bJo.parseOptionalDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodMap:return(0,dJo.parseMapDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodSet:return(0,SJo.parseSetDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodLazy:return ELr(t.getter()._def,r);case Ri.ZodFirstPartyTypeKind.ZodPromise:return(0,vJo.parsePromiseDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodNaN:case Ri.ZodFirstPartyTypeKind.ZodNever:return(0,pJo.parseNeverDef)();case Ri.ZodFirstPartyTypeKind.ZodEffects:return(0,sJo.parseEffectsDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodAny:return(0,QVo.parseAnyDef)();case Ri.ZodFirstPartyTypeKind.ZodUnknown:return(0,EJo.parseUnknownDef)();case Ri.ZodFirstPartyTypeKind.ZodDefault:return(0,aJo.parseDefaultDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodBranded:return(0,nJo.parseBrandedDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodReadonly:return(0,PJo.parseReadonlyDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodCatch:return(0,oJo.parseCatchDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodPipeline:return(0,_Jo.parsePipelineDef)(t,r);case Ri.ZodFirstPartyTypeKind.ZodFunction:case Ri.ZodFirstPartyTypeKind.ZodVoid:case Ri.ZodFirstPartyTypeKind.ZodSymbol:return;default:return(n=>{})(e)}},NJo=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var Rlt=S(wIe=>{"use strict";Object.defineProperty(wIe,"__esModule",{value:!0});wIe.zodToJsonSchema=void 0;var PLr=am(),jJo=Qut(),DJo=(t,e)=>{let r=(0,jJo.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:(0,PLr.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,PLr.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};wIe.zodToJsonSchema=DJo});var MLr=S(Uo=>{"use strict";var $Jo=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]}),qi=Uo&&Uo.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$Jo(e,t,r)};Object.defineProperty(Uo,"__esModule",{value:!0});qi(FAe(),Uo);qi(Qut(),Uo);qi(Mq(),Uo);qi(am(),Uo);qi(elt(),Uo);qi(tlt(),Uo);qi(rlt(),Uo);qi(nlt(),Uo);qi(JAe(),Uo);qi(olt(),Uo);qi(ilt(),Uo);qi(alt(),Uo);qi(slt(),Uo);qi(ult(),Uo);qi(llt(),Uo);qi(clt(),Uo);qi(plt(),Uo);qi(mlt(),Uo);qi(hlt(),Uo);qi(glt(),Uo);qi(ylt(),Uo);qi(blt(),Uo);qi(vlt(),Uo);qi(wlt(),Uo);qi(Slt(),Uo);qi(Clt(),Uo);qi(Mlt(),Uo);qi(rIe(),Uo);qi(xlt(),Uo);qi(eIe(),Uo);qi(Tlt(),Uo);qi(Elt(),Uo);qi(sIe(),Uo);qi(Plt(),Uo);qi(Rlt(),Uo);var LJo=Rlt();Uo.default=LJo.zodToJsonSchema});var ALr=S(Mse=>{"use strict";Object.defineProperty(Mse,"__esModule",{value:!0});Mse.transformToChatCompletionRequest=kJo;Mse.convertToParsedChatCompletionResponse=qJo;Mse.responseFormatFromZodObject=RLr;var FJo=MLr();function kJo(t){let{responseFormat:e,...r}=t,n=RLr(e);return{...r,responseFormat:n}}function qJo(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 RLr(t){return{type:"json_schema",jsonSchema:{name:"placeholderName",schemaDefinition:(0,FJo.zodToJsonSchema)(t),strict:!0}}}});var jLr=S(CIe=>{"use strict";Object.defineProperty(CIe,"__esModule",{value:!0});CIe.Chat=void 0;var ILr=dLr(),NLr=mLr(),BJo=jc(),SIe=xd(),Alt=ALr(),Ilt=class extends BJo.ClientSDK{async parse(e,r){let n=(0,Alt.transformToChatCompletionRequest)(e),o=await(0,SIe.unwrapAsync)((0,ILr.chatComplete)(this,n,r));return(0,Alt.convertToParsedChatCompletionResponse)(o,e.responseFormat)}async parseStream(e,r){let n=(0,Alt.transformToChatCompletionRequest)(e);return(0,SIe.unwrapAsync)((0,NLr.chatStream)(this,n,r))}async complete(e,r){return(0,SIe.unwrapAsync)((0,ILr.chatComplete)(this,e,r))}async stream(e,r){return(0,SIe.unwrapAsync)((0,NLr.chatStream)(this,e,r))}};CIe.Chat=Ilt});var LLr=S(lD=>{"use strict";var UJo=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]}),zJo=lD&&lD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Nlt=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"&&UJo(r,e,n[o]);return zJo(r,e),r}}();Object.defineProperty(lD,"__esModule",{value:!0});lD.classifiersClassify=ZJo;var HJo=fr(),Rse=Nlt(ar()),VJo=ae(),JJo=ee(),DLr=sr(),KJo=or(),$Lr=Nlt($t()),WJo=Nlt(Hn()),GJo=ur();function ZJo(t,e,r){return new GJo.APIPromise(XJo(t,e,r))}async function XJo(t,e,r){let n=(0,JJo.safeParse)(e,b=>$Lr.ClassificationRequest$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/classifications")(),s=new Headers((0,VJo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,DLr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,DLr.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,g={HttpMeta:{Response:h,Request:p}},[y]=await Rse.match(Rse.json(200,$Lr.ClassificationResponse$inboundSchema),Rse.jsonErr(422,WJo.HTTPValidationError$inboundSchema),Rse.fail("4XX"),Rse.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var qLr=S(cD=>{"use strict";var YJo=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]}),QJo=cD&&cD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jlt=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"&&YJo(r,e,n[o]);return QJo(r,e),r}}();Object.defineProperty(cD,"__esModule",{value:!0});cD.classifiersClassifyChat=a3o;var e3o=fr(),Ase=jlt(ar()),t3o=ae(),r3o=ee(),FLr=sr(),n3o=or(),kLr=jlt($t()),o3o=jlt(Hn()),i3o=ur();function a3o(t,e,r){return new i3o.APIPromise(s3o(t,e,r))}async function s3o(t,e,r){let n=(0,r3o.safeParse)(e,b=>kLr.ChatClassificationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,e3o.encodeJSON)("body",o,{explode:!0}),a=(0,n3o.pathToFunc)("/v1/chat/classifications")(),s=new Headers((0,t3o.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:"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,g={HttpMeta:{Response:h,Request:p}},[y]=await Ase.match(Ase.json(200,kLr.ClassificationResponse$inboundSchema),Ase.jsonErr(422,o3o.HTTPValidationError$inboundSchema),Ase.fail("4XX"),Ase.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var zLr=S(dD=>{"use strict";var u3o=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]}),l3o=dD&&dD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dlt=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"&&u3o(r,e,n[o]);return l3o(r,e),r}}();Object.defineProperty(dD,"__esModule",{value:!0});dD.classifiersModerate=g3o;var c3o=fr(),Ise=Dlt(ar()),d3o=ae(),f3o=ee(),BLr=sr(),p3o=or(),ULr=Dlt($t()),m3o=Dlt(Hn()),h3o=ur();function g3o(t,e,r){return new h3o.APIPromise(y3o(t,e,r))}async function y3o(t,e,r){let n=(0,f3o.safeParse)(e,b=>ULr.ClassificationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,c3o.encodeJSON)("body",o,{explode:!0}),a=(0,p3o.pathToFunc)("/v1/moderations")(),s=new Headers((0,d3o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,BLr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,BLr.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,g={HttpMeta:{Response:h,Request:p}},[y]=await Ise.match(Ise.json(200,ULr.ModerationResponse$inboundSchema),Ise.jsonErr(422,m3o.HTTPValidationError$inboundSchema),Ise.fail("4XX"),Ise.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var JLr=S(fD=>{"use strict";var b3o=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]}),_3o=fD&&fD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$lt=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"&&b3o(r,e,n[o]);return _3o(r,e),r}}();Object.defineProperty(fD,"__esModule",{value:!0});fD.classifiersModerateChat=T3o;var v3o=fr(),Nse=$lt(ar()),w3o=ae(),S3o=ee(),HLr=sr(),C3o=or(),VLr=$lt($t()),x3o=$lt(Hn()),O3o=ur();function T3o(t,e,r){return new O3o.APIPromise(E3o(t,e,r))}async function E3o(t,e,r){let n=(0,S3o.safeParse)(e,b=>VLr.ChatModerationRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,v3o.encodeJSON)("body",o,{explode:!0}),a=(0,C3o.pathToFunc)("/v1/chat/moderations")(),s=new Headers((0,w3o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,HLr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,HLr.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,g={HttpMeta:{Response:h,Request:p}},[y]=await Nse.match(Nse.json(200,VLr.ModerationResponse$inboundSchema),Nse.jsonErr(422,x3o.HTTPValidationError$inboundSchema),Nse.fail("4XX"),Nse.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var KLr=S(OIe=>{"use strict";Object.defineProperty(OIe,"__esModule",{value:!0});OIe.Classifiers=void 0;var P3o=LLr(),M3o=qLr(),R3o=zLr(),A3o=JLr(),I3o=jc(),xIe=xd(),Llt=class extends I3o.ClientSDK{async moderate(e,r){return(0,xIe.unwrapAsync)((0,R3o.classifiersModerate)(this,e,r))}async moderateChat(e,r){return(0,xIe.unwrapAsync)((0,A3o.classifiersModerateChat)(this,e,r))}async classify(e,r){return(0,xIe.unwrapAsync)((0,P3o.classifiersClassify)(this,e,r))}async classifyChat(e,r){return(0,xIe.unwrapAsync)((0,M3o.classifiersClassifyChat)(this,e,r))}};OIe.Classifiers=Llt});var ZLr=S(pD=>{"use strict";var N3o=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]}),j3o=pD&&pD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Flt=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"&&N3o(r,e,n[o]);return j3o(r,e),r}}();Object.defineProperty(pD,"__esModule",{value:!0});pD.embeddingsCreate=B3o;var D3o=fr(),jse=Flt(ar()),$3o=ae(),L3o=ee(),WLr=sr(),F3o=or(),GLr=Flt($t()),k3o=Flt(Hn()),q3o=ur();function B3o(t,e,r){return new q3o.APIPromise(U3o(t,e,r))}async function U3o(t,e,r){let n=(0,L3o.safeParse)(e,b=>GLr.EmbeddingRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,D3o.encodeJSON)("body",o,{explode:!0}),a=(0,F3o.pathToFunc)("/v1/embeddings")(),s=new Headers((0,$3o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,WLr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,WLr.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,g={HttpMeta:{Response:h,Request:p}},[y]=await jse.match(jse.json(200,GLr.EmbeddingResponse$inboundSchema),jse.jsonErr(422,k3o.HTTPValidationError$inboundSchema),jse.fail("4XX"),jse.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var XLr=S(TIe=>{"use strict";Object.defineProperty(TIe,"__esModule",{value:!0});TIe.Embeddings=void 0;var z3o=ZLr(),H3o=jc(),V3o=xd(),klt=class extends H3o.ClientSDK{async create(e,r){return(0,V3o.unwrapAsync)((0,z3o.embeddingsCreate)(this,e,r))}};TIe.Embeddings=klt});var QLr=S(mD=>{"use strict";var J3o=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]}),K3o=mD&&mD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qlt=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"&&J3o(r,e,n[o]);return K3o(r,e),r}}();Object.defineProperty(mD,"__esModule",{value:!0});mD.filesDelete=t6o;var W3o=fr(),EIe=qlt(ar()),G3o=ae(),Z3o=ee(),YLr=sr(),X3o=or(),Y3o=qlt($t()),Q3o=qlt(Vn()),e6o=ur();function t6o(t,e,r){return new e6o.APIPromise(r6o(t,e,r))}async function r6o(t,e,r){let n=(0,Z3o.safeParse)(e,b=>Q3o.FilesApiRoutesDeleteFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,W3o.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,X3o.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,G3o.compactMap)({Accept:"application/json"})),l=await(0,YLr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,YLr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"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 g=h.value,[y]=await EIe.match(EIe.json(200,Y3o.DeleteFileOut$inboundSchema),EIe.fail("4XX"),EIe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var tFr=S(hD=>{"use strict";var n6o=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]}),o6o=hD&&hD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Blt=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"&&n6o(r,e,n[o]);return o6o(r,e),r}}();Object.defineProperty(hD,"__esModule",{value:!0});hD.filesDownload=f6o;var i6o=Blt(te()),a6o=fr(),PIe=Blt(ar()),s6o=ae(),u6o=ee(),eFr=sr(),l6o=or(),c6o=Blt(Vn()),d6o=ur();function f6o(t,e,r){return new d6o.APIPromise(p6o(t,e,r))}async function p6o(t,e,r){let n=(0,u6o.safeParse)(e,b=>c6o.FilesApiRoutesDownloadFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,a6o.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,l6o.pathToFunc)("/v1/files/{file_id}/content")(a),u=new Headers((0,s6o.compactMap)({Accept:"application/octet-stream"})),l=await(0,eFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,eFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"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 g=h.value,[y]=await PIe.match(PIe.stream(200,i6o.instanceof(ReadableStream)),PIe.fail("4XX"),PIe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var oFr=S(gD=>{"use strict";var m6o=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]}),h6o=gD&&gD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ult=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"&&m6o(r,e,n[o]);return h6o(r,e),r}}();Object.defineProperty(gD,"__esModule",{value:!0});gD.filesGetSignedUrl=S6o;var rFr=fr(),MIe=Ult(ar()),g6o=ae(),y6o=ee(),nFr=sr(),b6o=or(),_6o=Ult($t()),v6o=Ult(Vn()),w6o=ur();function S6o(t,e,r){return new w6o.APIPromise(C6o(t,e,r))}async function C6o(t,e,r){let n=(0,y6o.safeParse)(e,_=>v6o.FilesApiRoutesGetSignedUrlRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,rFr.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,b6o.pathToFunc)("/v1/files/{file_id}/url")(a),u=(0,rFr.encodeFormQuery)({expiry:o.expiry}),l=new Headers((0,g6o.compactMap)({Accept:"application/json"})),c=await(0,nFr.extractSecurity)(t._options.apiKey),d=c==null?{}:{apiKey:c},f=(0,nFr.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,g=await t._do(h,{context:p,errorCodes:["4XX","5XX"],retryConfig:p.retryConfig,retryCodes:p.retryCodes});if(!g.ok)return[g,{status:"request-error",request:h}];let y=g.value,[b]=await MIe.match(MIe.json(200,_6o.FileSignedURL$inboundSchema),MIe.fail("4XX"),MIe.fail("5XX"))(y,h);return b.ok?[b,{status:"complete",request:h,response:y}]:[b,{status:"complete",request:h,response:y}]}});var aFr=S(yD=>{"use strict";var x6o=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]}),O6o=yD&&yD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zlt=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"&&x6o(r,e,n[o]);return O6o(r,e),r}}();Object.defineProperty(yD,"__esModule",{value:!0});yD.filesList=N6o;var T6o=fr(),RIe=zlt(ar()),E6o=ae(),P6o=ee(),iFr=sr(),M6o=or(),R6o=zlt($t()),A6o=zlt(Vn()),I6o=ur();function N6o(t,e,r){return new I6o.APIPromise(j6o(t,e,r))}async function j6o(t,e,r){let n=(0,P6o.safeParse)(e,b=>A6o.FilesApiRoutesListFilesRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,M6o.pathToFunc)("/v1/files")(),s=(0,T6o.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,E6o.compactMap)({Accept:"application/json"})),l=await(0,iFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,iFr.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 g=h.value,[y]=await RIe.match(RIe.json(200,R6o.ListFilesOut$inboundSchema),RIe.fail("4XX"),RIe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var uFr=S(bD=>{"use strict";var D6o=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]}),$6o=bD&&bD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hlt=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"&&D6o(r,e,n[o]);return $6o(r,e),r}}();Object.defineProperty(bD,"__esModule",{value:!0});bD.filesRetrieve=H6o;var L6o=fr(),AIe=Hlt(ar()),F6o=ae(),k6o=ee(),sFr=sr(),q6o=or(),B6o=Hlt($t()),U6o=Hlt(Vn()),z6o=ur();function H6o(t,e,r){return new z6o.APIPromise(V6o(t,e,r))}async function V6o(t,e,r){let n=(0,k6o.safeParse)(e,b=>U6o.FilesApiRoutesRetrieveFileRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={file_id:(0,L6o.encodeSimple)("file_id",o.file_id,{explode:!1,charEncoding:"percent"})},s=(0,q6o.pathToFunc)("/v1/files/{file_id}")(a),u=new Headers((0,F6o.compactMap)({Accept:"application/json"})),l=await(0,sFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,sFr.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 g=h.value,[y]=await AIe.match(AIe.json(200,B6o.RetrieveFileOut$inboundSchema),AIe.fail("4XX"),AIe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var cFr=S(_D=>{"use strict";var J6o=_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]}),K6o=_D&&_D.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Jlt=_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"&&J6o(r,e,n[o]);return K6o(r,e),r}}();Object.defineProperty(_D,"__esModule",{value:!0});_D.filesUpload=rKo;var IIe=fr(),Vlt=BG(),NIe=Jlt(ar()),W6o=ae(),G6o=ee(),lFr=sr(),Z6o=or(),X6o=Jlt($t()),Y6o=Jlt(Vn()),Q6o=ur(),eKo=gj(),tKo=Uae();function rKo(t,e,r){return new Q6o.APIPromise(nKo(t,e,r))}async function nKo(t,e,r){let n=(0,G6o.safeParse)(e,y=>Y6o.FilesApiRoutesUploadFileMultiPartBodyParams$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=new FormData;if((0,eKo.isBlobLike)(o.file))(0,IIe.appendForm)(i,"file",o.file);else if((0,tKo.isReadableStream)(o.file.content)){let y=await(0,Vlt.readableStreamToArrayBuffer)(o.file.content),b=(0,Vlt.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream",_=new Blob([y],{type:b});(0,IIe.appendForm)(i,"file",_,o.file.fileName)}else{let y=(0,Vlt.getContentTypeFromFileName)(o.file.fileName)||"application/octet-stream";(0,IIe.appendForm)(i,"file",new Blob([o.file.content],{type:y}),o.file.fileName)}o.purpose!==void 0&&(0,IIe.appendForm)(i,"purpose",o.purpose);let a=(0,Z6o.pathToFunc)("/v1/files")(),s=new Headers((0,W6o.compactMap)({Accept:"application/json"})),u=await(0,lFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,lFr.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,[g]=await NIe.match(NIe.json(200,X6o.UploadFileOut$inboundSchema),NIe.fail("4XX"),NIe.fail("5XX"))(h,p);return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var dFr=S(jIe=>{"use strict";Object.defineProperty(jIe,"__esModule",{value:!0});jIe.Files=void 0;var oKo=QLr(),iKo=tFr(),aKo=oFr(),sKo=aFr(),uKo=uFr(),lKo=cFr(),cKo=jc(),D9=xd(),Klt=class extends cKo.ClientSDK{async upload(e,r){return(0,D9.unwrapAsync)((0,lKo.filesUpload)(this,e,r))}async list(e,r){return(0,D9.unwrapAsync)((0,sKo.filesList)(this,e,r))}async retrieve(e,r){return(0,D9.unwrapAsync)((0,uKo.filesRetrieve)(this,e,r))}async delete(e,r){return(0,D9.unwrapAsync)((0,oKo.filesDelete)(this,e,r))}async download(e,r){return(0,D9.unwrapAsync)((0,iKo.filesDownload)(this,e,r))}async getSignedUrl(e,r){return(0,D9.unwrapAsync)((0,aKo.filesGetSignedUrl)(this,e,r))}};jIe.Files=Klt});var mFr=S(vD=>{"use strict";var dKo=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]}),fKo=vD&&vD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wlt=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"&&dKo(r,e,n[o]);return fKo(r,e),r}}();Object.defineProperty(vD,"__esModule",{value:!0});vD.fimComplete=_Ko;var pKo=fr(),Dse=Wlt(ar()),mKo=ae(),hKo=ee(),fFr=sr(),gKo=or(),pFr=Wlt($t()),yKo=Wlt(Hn()),bKo=ur();function _Ko(t,e,r){return new bKo.APIPromise(vKo(t,e,r))}async function vKo(t,e,r){let n=(0,hKo.safeParse)(e,b=>pFr.FIMCompletionRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,pKo.encodeJSON)("body",o,{explode:!0}),a=(0,gKo.pathToFunc)("/v1/fim/completions")(),s=new Headers((0,mKo.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:"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,g={HttpMeta:{Response:h,Request:p}},[y]=await Dse.match(Dse.json(200,pFr.FIMCompletionResponse$inboundSchema),Dse.jsonErr(422,yKo.HTTPValidationError$inboundSchema),Dse.fail("4XX"),Dse.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var yFr=S(wD=>{"use strict";var wKo=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]}),SKo=wD&&wD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),DIe=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"&&wKo(r,e,n[o]);return SKo(r,e),r}}();Object.defineProperty(wD,"__esModule",{value:!0});wD.fimStream=AKo;var CKo=DIe(te()),xKo=fr(),OKo=Tq(),$se=DIe(ar()),TKo=ae(),EKo=ee(),hFr=sr(),PKo=or(),gFr=DIe($t()),MKo=DIe(Hn()),RKo=ur();function AKo(t,e,r){return new RKo.APIPromise(IKo(t,e,r))}async function IKo(t,e,r){let n=(0,EKo.safeParse)(e,b=>gFr.FIMCompletionStreamRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,xKo.encodeJSON)("body",o,{explode:!0}),a=(0,PKo.pathToFunc)("/v1/fim/completions#stream")(),s=new Headers((0,TKo.compactMap)({"Content-Type":"application/json",Accept:"text/event-stream"})),u=await(0,hFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,hFr.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,g={HttpMeta:{Response:h,Request:p}},[y]=await $se.match($se.sse(200,CKo.instanceof(ReadableStream).transform(b=>new OKo.EventStream(b,_=>_.data==="[DONE]"?{done:!0}:{value:gFr.CompletionEvent$inboundSchema.parse(_)}))),$se.jsonErr(422,MKo.HTTPValidationError$inboundSchema),$se.fail("4XX"),$se.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var _Fr=S($Ie=>{"use strict";Object.defineProperty($Ie,"__esModule",{value:!0});$Ie.Fim=void 0;var NKo=mFr(),jKo=yFr(),DKo=jc(),bFr=xd(),Glt=class extends DKo.ClientSDK{async complete(e,r){return(0,bFr.unwrapAsync)((0,NKo.fimComplete)(this,e,r))}async stream(e,r){return(0,bFr.unwrapAsync)((0,jKo.fimStream)(this,e,r))}};$Ie.Fim=Glt});var CFr=S(SD=>{"use strict";var $Ko=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]}),LKo=SD&&SD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SFr=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"&&$Ko(r,e,n[o]);return LKo(r,e),r}}();Object.defineProperty(SD,"__esModule",{value:!0});SD.fineTuningJobsCancel=zKo;var FKo=fr(),LIe=SFr(ar()),kKo=ae(),qKo=ee(),vFr=sr(),BKo=or(),wFr=SFr(Vn()),UKo=ur();function zKo(t,e,r){return new UKo.APIPromise(HKo(t,e,r))}async function HKo(t,e,r){let n=(0,qKo.safeParse)(e,b=>wFr.JobsApiRoutesFineTuningCancelFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,FKo.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,BKo.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/cancel")(a),u=new Headers((0,kKo.compactMap)({Accept:"application/json"})),l=await(0,vFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,vFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"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 g=h.value,[y]=await LIe.match(LIe.json(200,wFr.JobsApiRoutesFineTuningCancelFineTuningJobResponse$inboundSchema),LIe.fail("4XX"),LIe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var OFr=S(CD=>{"use strict";var VKo=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]}),JKo=CD&&CD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Zlt=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"&&VKo(r,e,n[o]);return JKo(r,e),r}}();Object.defineProperty(CD,"__esModule",{value:!0});CD.fineTuningJobsCreate=e5o;var KKo=fr(),FIe=Zlt(ar()),WKo=ae(),GKo=ee(),xFr=sr(),ZKo=or(),XKo=Zlt($t()),YKo=Zlt(Vn()),QKo=ur();function e5o(t,e,r){return new QKo.APIPromise(t5o(t,e,r))}async function t5o(t,e,r){let n=(0,GKo.safeParse)(e,y=>XKo.JobIn$outboundSchema.parse(y),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,KKo.encodeJSON)("body",o,{explode:!0}),a=(0,ZKo.pathToFunc)("/v1/fine_tuning/jobs")(),s=new Headers((0,WKo.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,xFr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,xFr.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,[g]=await FIe.match(FIe.json(200,YKo.JobsApiRoutesFineTuningCreateFineTuningJobResponse$inboundSchema),FIe.fail("4XX"),FIe.fail("5XX"))(h,p);return g.ok?[g,{status:"complete",request:p,response:h}]:[g,{status:"complete",request:p,response:h}]}});var MFr=S(xD=>{"use strict";var r5o=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]}),n5o=xD&&xD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),PFr=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"&&r5o(r,e,n[o]);return n5o(r,e),r}}();Object.defineProperty(xD,"__esModule",{value:!0});xD.fineTuningJobsGet=l5o;var o5o=fr(),kIe=PFr(ar()),i5o=ae(),a5o=ee(),TFr=sr(),s5o=or(),EFr=PFr(Vn()),u5o=ur();function l5o(t,e,r){return new u5o.APIPromise(c5o(t,e,r))}async function c5o(t,e,r){let n=(0,a5o.safeParse)(e,b=>EFr.JobsApiRoutesFineTuningGetFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,o5o.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,s5o.pathToFunc)("/v1/fine_tuning/jobs/{job_id}")(a),u=new Headers((0,i5o.compactMap)({Accept:"application/json"})),l=await(0,TFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,TFr.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 g=h.value,[y]=await kIe.match(kIe.json(200,EFr.JobsApiRoutesFineTuningGetFineTuningJobResponse$inboundSchema),kIe.fail("4XX"),kIe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var AFr=S(OD=>{"use strict";var d5o=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]}),f5o=OD&&OD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Xlt=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"&&d5o(r,e,n[o]);return f5o(r,e),r}}();Object.defineProperty(OD,"__esModule",{value:!0});OD.fineTuningJobsList=v5o;var p5o=fr(),qIe=Xlt(ar()),m5o=ae(),h5o=ee(),RFr=sr(),g5o=or(),y5o=Xlt($t()),b5o=Xlt(Vn()),_5o=ur();function v5o(t,e,r){return new _5o.APIPromise(w5o(t,e,r))}async function w5o(t,e,r){let n=(0,h5o.safeParse)(e,b=>b5o.JobsApiRoutesFineTuningGetFineTuningJobsRequest$outboundSchema.optional().parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a=(0,g5o.pathToFunc)("/v1/fine_tuning/jobs")(),s=(0,p5o.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,m5o.compactMap)({Accept:"application/json"})),l=await(0,RFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,RFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"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 g=h.value,[y]=await qIe.match(qIe.json(200,y5o.JobsOut$inboundSchema),qIe.fail("4XX"),qIe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var DFr=S(TD=>{"use strict";var S5o=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]}),C5o=TD&&TD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jFr=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"&&S5o(r,e,n[o]);return C5o(r,e),r}}();Object.defineProperty(TD,"__esModule",{value:!0});TD.fineTuningJobsStart=M5o;var x5o=fr(),BIe=jFr(ar()),O5o=ae(),T5o=ee(),IFr=sr(),E5o=or(),NFr=jFr(Vn()),P5o=ur();function M5o(t,e,r){return new P5o.APIPromise(R5o(t,e,r))}async function R5o(t,e,r){let n=(0,T5o.safeParse)(e,b=>NFr.JobsApiRoutesFineTuningStartFineTuningJobRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={job_id:(0,x5o.encodeSimple)("job_id",o.job_id,{explode:!1,charEncoding:"percent"})},s=(0,E5o.pathToFunc)("/v1/fine_tuning/jobs/{job_id}/start")(a),u=new Headers((0,O5o.compactMap)({Accept:"application/json"})),l=await(0,IFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,IFr.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 g=h.value,[y]=await BIe.match(BIe.json(200,NFr.JobsApiRoutesFineTuningStartFineTuningJobResponse$inboundSchema),BIe.fail("4XX"),BIe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var $Fr=S(UIe=>{"use strict";Object.defineProperty(UIe,"__esModule",{value:!0});UIe.Jobs=void 0;var A5o=CFr(),I5o=OFr(),N5o=MFr(),j5o=AFr(),D5o=DFr(),$5o=jc(),Lse=xd(),Ylt=class extends $5o.ClientSDK{async list(e,r){return(0,Lse.unwrapAsync)((0,j5o.fineTuningJobsList)(this,e,r))}async create(e,r){return(0,Lse.unwrapAsync)((0,I5o.fineTuningJobsCreate)(this,e,r))}async get(e,r){return(0,Lse.unwrapAsync)((0,N5o.fineTuningJobsGet)(this,e,r))}async cancel(e,r){return(0,Lse.unwrapAsync)((0,A5o.fineTuningJobsCancel)(this,e,r))}async start(e,r){return(0,Lse.unwrapAsync)((0,D5o.fineTuningJobsStart)(this,e,r))}};UIe.Jobs=Ylt});var LFr=S(zIe=>{"use strict";Object.defineProperty(zIe,"__esModule",{value:!0});zIe.FineTuning=void 0;var L5o=jc(),F5o=$Fr(),Qlt=class extends L5o.ClientSDK{get jobs(){return this._jobs??(this._jobs=new F5o.Jobs(this._options))}};zIe.FineTuning=Qlt});var kFr=S(ED=>{"use strict";var k5o=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]}),q5o=ED&&ED.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ect=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"&&k5o(r,e,n[o]);return q5o(r,e),r}}();Object.defineProperty(ED,"__esModule",{value:!0});ED.modelsArchive=W5o;var B5o=fr(),HIe=ect(ar()),U5o=ae(),z5o=ee(),FFr=sr(),H5o=or(),V5o=ect($t()),J5o=ect(Vn()),K5o=ur();function W5o(t,e,r){return new K5o.APIPromise(G5o(t,e,r))}async function G5o(t,e,r){let n=(0,z5o.safeParse)(e,b=>J5o.JobsApiRoutesFineTuningArchiveFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,B5o.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,H5o.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,U5o.compactMap)({Accept:"application/json"})),l=await(0,FFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,FFr.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 g=h.value,[y]=await HIe.match(HIe.json(200,V5o.ArchiveFTModelOut$inboundSchema),HIe.fail("4XX"),HIe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var BFr=S(PD=>{"use strict";var Z5o=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]}),X5o=PD&&PD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VIe=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"&&Z5o(r,e,n[o]);return X5o(r,e),r}}();Object.defineProperty(PD,"__esModule",{value:!0});PD.modelsDelete=aWo;var Y5o=fr(),Fse=VIe(ar()),Q5o=ae(),eWo=ee(),qFr=sr(),tWo=or(),rWo=VIe($t()),nWo=VIe(Hn()),oWo=VIe(Vn()),iWo=ur();function aWo(t,e,r){return new iWo.APIPromise(sWo(t,e,r))}async function sWo(t,e,r){let n=(0,eWo.safeParse)(e,_=>oWo.DeleteModelV1ModelsModelIdDeleteRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,Y5o.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,tWo.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,Q5o.compactMap)({Accept:"application/json"})),l=await(0,qFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,qFr.resolveGlobalSecurity)(c),f={options:t._options,baseURL:r?.serverURL??t._baseURL??"",operationID:"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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await Fse.match(Fse.json(200,rWo.DeleteModelOut$inboundSchema),Fse.jsonErr(422,nWo.HTTPValidationError$inboundSchema),Fse.fail("4XX"),Fse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var zFr=S(MD=>{"use strict";var uWo=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]}),lWo=MD&&MD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tct=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"&&uWo(r,e,n[o]);return lWo(r,e),r}}();Object.defineProperty(MD,"__esModule",{value:!0});MD.modelsList=hWo;var kse=tct(ar()),cWo=ae(),UFr=sr(),dWo=or(),fWo=tct($t()),pWo=tct(Hn()),mWo=ur();function hWo(t,e){return new mWo.APIPromise(gWo(t,e))}async function gWo(t,e){let r=(0,dWo.pathToFunc)("/v1/models")(),n=new Headers((0,cWo.compactMap)({Accept:"application/json"})),o=await(0,UFr.extractSecurity)(t._options.apiKey),i=o==null?{}:{apiKey:o},a=(0,UFr.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 kse.match(kse.json(200,fWo.ModelList$inboundSchema),kse.jsonErr(422,pWo.HTTPValidationError$inboundSchema),kse.fail("4XX"),kse.fail("5XX"))(d,l,{extraFields:f});return p.ok?[p,{status:"complete",request:l,response:d}]:[p,{status:"complete",request:l,response:d}]}});var JFr=S(RD=>{"use strict";var yWo=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]}),bWo=RD&&RD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),rct=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"&&yWo(r,e,n[o]);return bWo(r,e),r}}();Object.defineProperty(RD,"__esModule",{value:!0});RD.modelsRetrieve=OWo;var _Wo=fr(),qse=rct(ar()),vWo=ae(),wWo=ee(),HFr=sr(),SWo=or(),CWo=rct(Hn()),VFr=rct(Vn()),xWo=ur();function OWo(t,e,r){return new xWo.APIPromise(TWo(t,e,r))}async function TWo(t,e,r){let n=(0,wWo.safeParse)(e,_=>VFr.RetrieveModelV1ModelsModelIdGetRequest$outboundSchema.parse(_),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,_Wo.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,SWo.pathToFunc)("/v1/models/{model_id}")(a),u=new Headers((0,vWo.compactMap)({Accept:"application/json"})),l=await(0,HFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,HFr.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 g=h.value,y={HttpMeta:{Response:g,Request:m}},[b]=await qse.match(qse.json(200,VFr.RetrieveModelV1ModelsModelIdGetResponseRetrieveModelV1ModelsModelIdGet$inboundSchema),qse.jsonErr(422,CWo.HTTPValidationError$inboundSchema),qse.fail("4XX"),qse.fail("5XX"))(g,m,{extraFields:y});return b.ok?[b,{status:"complete",request:m,response:g}]:[b,{status:"complete",request:m,response:g}]}});var WFr=S(AD=>{"use strict";var EWo=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]}),PWo=AD&&AD.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),nct=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"&&EWo(r,e,n[o]);return PWo(r,e),r}}();Object.defineProperty(AD,"__esModule",{value:!0});AD.modelsUnarchive=$Wo;var MWo=fr(),JIe=nct(ar()),RWo=ae(),AWo=ee(),KFr=sr(),IWo=or(),NWo=nct($t()),jWo=nct(Vn()),DWo=ur();function $Wo(t,e,r){return new DWo.APIPromise(LWo(t,e,r))}async function LWo(t,e,r){let n=(0,AWo.safeParse)(e,b=>jWo.JobsApiRoutesFineTuningUnarchiveFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=null,a={model_id:(0,MWo.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,IWo.pathToFunc)("/v1/fine_tuning/models/{model_id}/archive")(a),u=new Headers((0,RWo.compactMap)({Accept:"application/json"})),l=await(0,KFr.extractSecurity)(t._options.apiKey),c=l==null?{}:{apiKey:l},d=(0,KFr.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 g=h.value,[y]=await JIe.match(JIe.json(200,NWo.UnarchiveFTModelOut$inboundSchema),JIe.fail("4XX"),JIe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var QFr=S(ID=>{"use strict";var FWo=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]}),kWo=ID&&ID.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),YFr=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"&&FWo(r,e,n[o]);return kWo(r,e),r}}();Object.defineProperty(ID,"__esModule",{value:!0});ID.modelsUpdate=HWo;var GFr=fr(),KIe=YFr(ar()),qWo=ae(),BWo=ee(),ZFr=sr(),UWo=or(),XFr=YFr(Vn()),zWo=ur();function HWo(t,e,r){return new zWo.APIPromise(VWo(t,e,r))}async function VWo(t,e,r){let n=(0,BWo.safeParse)(e,b=>XFr.JobsApiRoutesFineTuningUpdateFineTunedModelRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,GFr.encodeJSON)("body",o.UpdateFTModelIn,{explode:!0}),a={model_id:(0,GFr.encodeSimple)("model_id",o.model_id,{explode:!1,charEncoding:"percent"})},s=(0,UWo.pathToFunc)("/v1/fine_tuning/models/{model_id}")(a),u=new Headers((0,qWo.compactMap)({"Content-Type":"application/json",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:"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 g=h.value,[y]=await KIe.match(KIe.json(200,XFr.JobsApiRoutesFineTuningUpdateFineTunedModelResponse$inboundSchema),KIe.fail("4XX"),KIe.fail("5XX"))(g,m);return y.ok?[y,{status:"complete",request:m,response:g}]:[y,{status:"complete",request:m,response:g}]}});var ekr=S(WIe=>{"use strict";Object.defineProperty(WIe,"__esModule",{value:!0});WIe.Models=void 0;var JWo=kFr(),KWo=BFr(),WWo=zFr(),GWo=JFr(),ZWo=WFr(),XWo=QFr(),YWo=jc(),$9=xd(),oct=class extends YWo.ClientSDK{async list(e){return(0,$9.unwrapAsync)((0,WWo.modelsList)(this,e))}async retrieve(e,r){return(0,$9.unwrapAsync)((0,GWo.modelsRetrieve)(this,e,r))}async delete(e,r){return(0,$9.unwrapAsync)((0,KWo.modelsDelete)(this,e,r))}async update(e,r){return(0,$9.unwrapAsync)((0,XWo.modelsUpdate)(this,e,r))}async archive(e,r){return(0,$9.unwrapAsync)((0,JWo.modelsArchive)(this,e,r))}async unarchive(e,r){return(0,$9.unwrapAsync)((0,ZWo.modelsUnarchive)(this,e,r))}};WIe.Models=oct});var nkr=S(ND=>{"use strict";var QWo=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]}),e8o=ND&&ND.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ict=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"&&QWo(r,e,n[o]);return e8o(r,e),r}}();Object.defineProperty(ND,"__esModule",{value:!0});ND.ocrProcess=s8o;var t8o=fr(),Bse=ict(ar()),r8o=ae(),n8o=ee(),tkr=sr(),o8o=or(),rkr=ict($t()),i8o=ict(Hn()),a8o=ur();function s8o(t,e,r){return new a8o.APIPromise(u8o(t,e,r))}async function u8o(t,e,r){let n=(0,n8o.safeParse)(e,b=>rkr.OCRRequest$outboundSchema.parse(b),"Input validation failed");if(!n.ok)return[n,{status:"invalid"}];let o=n.value,i=(0,t8o.encodeJSON)("body",o,{explode:!0}),a=(0,o8o.pathToFunc)("/v1/ocr")(),s=new Headers((0,r8o.compactMap)({"Content-Type":"application/json",Accept:"application/json"})),u=await(0,tkr.extractSecurity)(t._options.apiKey),l=u==null?{}:{apiKey:u},c=(0,tkr.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,g={HttpMeta:{Response:h,Request:p}},[y]=await Bse.match(Bse.json(200,rkr.OCRResponse$inboundSchema),Bse.jsonErr(422,i8o.HTTPValidationError$inboundSchema),Bse.fail("4XX"),Bse.fail("5XX"))(h,p,{extraFields:g});return y.ok?[y,{status:"complete",request:p,response:h}]:[y,{status:"complete",request:p,response:h}]}});var okr=S(GIe=>{"use strict";Object.defineProperty(GIe,"__esModule",{value:!0});GIe.Ocr=void 0;var l8o=nkr(),c8o=jc(),d8o=xd(),act=class extends c8o.ClientSDK{async process(e,r){return(0,d8o.unwrapAsync)((0,l8o.ocrProcess)(this,e,r))}};GIe.Ocr=act});var ikr=S(ZIe=>{"use strict";Object.defineProperty(ZIe,"__esModule",{value:!0});ZIe.Mistral=void 0;var f8o=jc(),p8o=CIr(),m8o=NIr(),h8o=vDr(),g8o=uLr(),y8o=jLr(),b8o=KLr(),_8o=XLr(),v8o=dFr(),w8o=_Fr(),S8o=LFr(),C8o=ekr(),x8o=okr(),sct=class extends f8o.ClientSDK{get models(){return this._models??(this._models=new C8o.Models(this._options))}get beta(){return this._beta??(this._beta=new g8o.Beta(this._options))}get files(){return this._files??(this._files=new v8o.Files(this._options))}get fineTuning(){return this._fineTuning??(this._fineTuning=new S8o.FineTuning(this._options))}get batch(){return this._batch??(this._batch=new h8o.Batch(this._options))}get chat(){return this._chat??(this._chat=new y8o.Chat(this._options))}get fim(){return this._fim??(this._fim=new w8o.Fim(this._options))}get agents(){return this._agents??(this._agents=new p8o.Agents(this._options))}get embeddings(){return this._embeddings??(this._embeddings=new _8o.Embeddings(this._options))}get classifiers(){return this._classifiers??(this._classifiers=new b8o.Classifiers(this._options))}get ocr(){return this._ocr??(this._ocr=new x8o.Ocr(this._options))}get audio(){return this._audio??(this._audio=new m8o.Audio(this._options))}};ZIe.Mistral=sct});var ukr=S(Ay=>{"use strict";var akr=Ay&&Ay.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),O8o=Ay&&Ay.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),skr=Ay&&Ay.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&akr(e,t,r)},T8o=Ay&&Ay.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n=t(e),o=0;o<n.length;o++)n[o]!=="default"&&akr(r,e,n[o]);return O8o(r,e),r}}();Object.defineProperty(Ay,"__esModule",{value:!0});Ay.HTTPClient=Ay.files=void 0;skr(GTe(),Ay);Ay.files=T8o(BG());var E8o=UG();Object.defineProperty(Ay,"HTTPClient",{enumerable:!0,get:function(){return E8o.HTTPClient}});skr(ikr(),Ay)});function uct(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(Us(i)&&i.tool_calls?.length)return i.tool_calls.map(a=>({...a,id:dae(a.id??"")})).map(Sk)},o=new Set;for(let i of t)"tool_call_id"in i&&typeof i.tool_call_id=="string"&&o.add(dae(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:dae(i.tool_call_id)}];if(Us(i)){if(a===void 0)return[{role:e(i.getType()),content:s}];{let u=a.filter(l=>o.has(dae(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 P8o(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=hat(r.content);switch(r.role){case"assistant":{let i=[],a=[];for(let s of n)try{let u=LC(s,{returnId:!0});i.push({...u,id:u.id??WTe().replace(/-/g,"")})}catch(u){a.push(FC(s,u.message))}return new li({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 su({content:o})}}function M8o(t,e){if(!t.content&&!t.toolCalls)return e?new Ur({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??WTe().replace(/-/g,""),type:"function"})):void 0,n="assistant";t.role&&(n=t.role);let o=hat(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 _v({content:o}):n==="assistant"?new Ur({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 Aw({content:o,additional_kwargs:i,tool_call_id:r?.[0].id??""}):n==="function"?new bv({content:o,additional_kwargs:i}):new yv({content:o,role:n})}function lkr(t){if(!(!t||!t.length))return t.map(e=>{if("function"in e)return{type:e.type??"function",function:e.function};if(mg(e)){let r=e.description??`Tool: ${e.name}`;return{type:"function",function:{name:e.name,description:r,parameters:Ga(e.schema)?Vi(e.schema):e.schema}}}throw new Error(`Unknown tool type passed to ChatMistral: ${JSON.stringify(e,null,2)}`)})}var ckr,dkr,lct,fkr=v(()=>{Nbr();kbr();ckr=L(ukr(),1),dkr=L(UG(),1);$s();D1();ym();iz();nl();_O();sH();xv();o_();j1();Gv();lct=class extends hh{constructor(e){super(e??{});M(this,"lc_namespace",["langchain","chat_models","mistralai"]);M(this,"model","mistral-small-latest");M(this,"apiKey");M(this,"endpoint");M(this,"serverURL");M(this,"temperature",.7);M(this,"streaming",!1);M(this,"topP",1);M(this,"maxTokens");M(this,"safeMode",!1);M(this,"safePrompt",!1);M(this,"randomSeed");M(this,"seed");M(this,"maxRetries");M(this,"lc_serializable",!0);M(this,"streamUsage",!0);M(this,"beforeRequestHooks");M(this,"requestErrorHooks");M(this,"responseHooks");M(this,"httpClient");M(this,"presencePenalty");M(this,"frequencyPenalty");M(this,"numCompletions");let r=e?.apiKey??gn("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?lkr(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=lkr(e);return new Vw({bound:this,kwargs:{...r??{},tools:n},config:{}})}async completionWithRetry(e,r){let n=new Fw({maxRetries:this.maxRetries}),o=new ckr.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=uct(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 y of m){let b=y.generationInfo?.completion??0;h[b]===void 0?h[b]=y:h[b]=h[b].concat(y)}return{generations:Object.entries(h).sort(([y],[b])=>parseInt(y,10)-parseInt(b,10)).map(([y,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 g={text:h,message:P8o(m,l?.usage)};m.finishReason&&(g.generationInfo={finishReason:m.finishReason}),p.push(g)}return{generations:p,llmOutput:{tokenUsage:o}}}async*_streamResponseChunks(e,r,n){let o=uct(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=M8o(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 Hi({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 dkr.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;Ga(n)?(u=Jw.fromZodSchema(n),f=Vi(n)):u=new Ov,s=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"jsonMode"},schema:f}})}else{let f=o??"extract";if(Ga(n)){let p=Vi(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 kC({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 kC({returnSingle:!0,keyName:f})}}if(!a)return s.pipe(u);let l=xu.assign({parsed:(f,p)=>u.invoke(f.raw,p)}),c=xu.assign({parsed:()=>null}),d=l.withFallbacks({fallbacks:[c]});return El.from([{raw:s},d])}}});var pkr=v(()=>{nl();M2();tk()});var mkr=v(()=>{ym();iz();nl();tk();loe()});var hkr=v(()=>{fkr();pkr();mkr()});var cct,gkr=v(()=>{nl();cH();cct=class extends Ck{constructor(e){let r=e?.apiKey||gn("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"}});M(this,"lc_serializable",!0);M(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 ykr=v(()=>{gkr()});var XIe,YIe,bkr,dct=v(()=>{XIe="RFC3986",YIe={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:t=>String(t)},bkr="RFC1738"});function vkr(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function pct(t,e){if(R8o(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var R8o,aI,fct,_kr,wkr=v(()=>{dct();R8o=Array.isArray,aI=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})(),fct=1024,_kr=(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+=fct){let u=i.length>=fct?i.slice(s,s+fct):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===bkr&&(d===40||d===41)){l[l.length]=u.charAt(c);continue}if(d<128){l[l.length]=aI[d];continue}if(d<2048){l[l.length]=aI[192|d>>6]+aI[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=aI[224|d>>12]+aI[128|d>>6&63]+aI[128|d&63];continue}c+=1,d=65536+((d&1023)<<10|u.charCodeAt(c)&1023),l[l.length]=aI[240|d>>18]+aI[128|d>>12&63]+aI[128|d>>6&63]+aI[128|d&63]}a+=l.join("")}return a}});function j8o(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}function xkr(t,e,r,n,o,i,a,s,u,l,c,d,f,p,m,h,g,y){let b=t,_=y,w=0,x=!1;for(;(_=_.get(mct))!==void 0&&!x;){let N=_.get(t);if(w+=1,typeof N<"u"){if(N===w)throw new RangeError("Cyclic object value");x=!0}typeof _.get(mct)>"u"&&(w=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&sI(b)&&(b=pct(b,function(N){return N instanceof Date?f?.(N):N})),b===null){if(i)return u&&!h?u(e,km.encoder,g,"key",p):e;b=""}if(j8o(b)||vkr(b)){if(u){let N=h?e:u(e,km.encoder,g,"key",p);return[m?.(N)+"="+m?.(u(b,km.encoder,g,"value",p))]}return[m?.(e)+"="+m?.(String(b))]}let O=[];if(typeof b>"u")return O;let E;if(r==="comma"&&sI(b))h&&u&&(b=pct(b,u)),E=[{value:b.length>0?b.join(",")||null:void 0}];else if(sI(l))E=l;else{let N=Object.keys(b);E=c?N.sort(c):N}let T=s?String(e).replace(/\./g,"%2E"):String(e),R=n&&sI(b)&&b.length===1?T+"[]":T;if(o&&sI(b)&&b.length===0)return R+"[]";for(let N=0;N<E.length;++N){let D=E[N],F=typeof D=="object"&&typeof D.value<"u"?D.value:b[D];if(a&&F===null)continue;let B=d&&s?D.replace(/\./g,"%2E"):D,U=sI(b)?typeof r=="function"?r(R,B):R:R+(d?"."+B:"["+B+"]");y.set(t,w);let H=new WeakMap;H.set(mct,y),Ckr(O,xkr(F,U,r,n,o,i,a,s,r==="comma"&&h&&sI(b)?null:u,l,c,d,f,p,m,h,g,H))}return O}function D8o(t=km){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||km.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=XIe;if(typeof t.format<"u"){if(!A8o.call(YIe,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=YIe[r],o=km.filter;(typeof t.filter=="function"||sI(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in Skr?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=km.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:km.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:km.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:km.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:km.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?km.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:km.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:km.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:km.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:km.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:km.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:km.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:km.strictNullHandling}}function hct(t,e={}){let r=t,n=D8o(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):sI(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=Skr[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||Ckr(a,xkr(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 A8o,Skr,sI,I8o,Ckr,N8o,km,mct,Okr=v(()=>{wkr();dct();A8o=Object.prototype.hasOwnProperty,Skr={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},sI=Array.isArray,I8o=Array.prototype.push,Ckr=function(t,e){I8o.apply(t,sI(e)?e:[e])},N8o=Date.prototype.toISOString,km={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:_kr,encodeValuesOnly:!1,format:XIe,formatter:YIe[XIe],indices:!1,serializeDate(t){return N8o.call(t)},skipNulls:!1,strictNullHandling:!1};mct={}});var Tkr=v(()=>{Okr()});var NV,Ekr=v(()=>{NV="4.95.1"});function Mkr(t,e={auto:!1}){if(Pkr)throw new Error(`you must \`import 'openai/shims/${t.kind}'\` before importing anything else from openai`);if(jV)throw new Error(`can't \`import 'openai/shims/${t.kind}'\` after \`import 'openai/shims/${jV}'\``);Pkr=e.auto,jV=t.kind,gct=t.fetch,L8o=t.Request,F8o=t.Response,k8o=t.Headers,yct=t.FormData,q8o=t.Blob,QIe=t.File,bct=t.ReadableStream,_ct=t.getMultipartRequestOptions,vct=t.getDefaultAgent,eNe=t.fileFromPath,wct=t.isFsReadStream}var Pkr,jV,gct,L8o,F8o,k8o,yct,q8o,QIe,bct,_ct,vct,eNe,wct,Sct=v(()=>{Pkr=!1});var tNe,Rkr=v(()=>{tNe=class{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}});function Akr({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 tNe(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 Ikr=v(()=>{Rkr()});var Nkr=v(()=>{Ikr()});var Cct,Use=v(()=>{Sct();Nkr();Sct();Cct=()=>{jV||Mkr(Akr(),{auto:!0})};Cct()});var Ar,qm,sm,Iq,Nq,zse,Hse,Vse,Jse,Kse,Wse,Gse,Zse,L9,F9,lw=v(()=>{Bi();Ar=class extends Error{},qm=class t extends Ar{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 Iq({message:n,cause:rNe(r)});let i=r?.error;return e===400?new zse(e,i,n,o):e===401?new Hse(e,i,n,o):e===403?new Vse(e,i,n,o):e===404?new Jse(e,i,n,o):e===409?new Kse(e,i,n,o):e===422?new Wse(e,i,n,o):e===429?new Gse(e,i,n,o):e>=500?new Zse(e,i,n,o):new t(e,i,n,o)}},sm=class extends qm{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Iq=class extends qm{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Nq=class extends Iq{constructor({message:e}={}){super({message:e??"Request timed out."})}},zse=class extends qm{},Hse=class extends qm{},Vse=class extends qm{},Jse=class extends qm{},Kse=class extends qm{},Wse=class extends qm{},Gse=class extends qm{},Zse=class extends qm{},L9=class extends Ar{constructor(){super("Could not parse response content as the length limit was reached")}},F9=class extends Ar{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}});function H8o(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 jkr(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 nNe,DV,cw,$V,Dkr=v(()=>{lw();nNe=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},DV=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)},$V=class{constructor(){cw.set(this,void 0),this.buffer=new Uint8Array,nNe(this,cw,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=H8o(this.buffer,DV(this,cw,"f")))!=null;){if(i.carriage&&DV(this,cw,"f")==null){nNe(this,cw,i.index,"f");continue}if(DV(this,cw,"f")!=null&&(i.index!==DV(this,cw,"f")+1||i.carriage)){o.push(this.decodeText(this.buffer.slice(0,DV(this,cw,"f")-1))),this.buffer=this.buffer.slice(DV(this,cw,"f")),nNe(this,cw,null,"f");continue}let a=DV(this,cw,"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),nNe(this,cw,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 Ar(`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 Ar(`Unexpected: received non-Uint8Array/ArrayBuffer (${e.constructor.name}) in a web platform. Please report this error.`)}throw new Ar("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
|
||
`):[]}};cw=new WeakMap;$V.NEWLINE_CHARS=new Set([`
|
||
`,"\r"]);$V.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function xct(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 $kr=v(()=>{});async function*V8o(t,e){if(!t.body)throw e.abort(),new Ar("Attempted to iterate over a response with no body");let r=new Oct,n=new $V,o=xct(t.body);for await(let i of J8o(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*J8o(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=jkr(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}function K8o(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}var uI,Oct,oNe=v(()=>{Use();lw();Dkr();$kr();Bi();lw();uI=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 V8o(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 qm(void 0,s.error,void 0,Tct(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 qm(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 $V,s=xct(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 bct({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?.()}})}};Oct=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]=K8o(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}}});async function Mct(t,e,r){if(t=await t,Fkr(t))return t;if(Lkr(t)){let o=await t.blob();e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()??"unknown_file");let i=Xse(o)?[await o.arrayBuffer()]:[o];return new QIe(i,e,r)}let n=await G8o(t);if(e||(e=X8o(t)??"unknown_file"),!r?.type){let o=n[0]?.type;typeof o=="string"&&(r={...r,type:o})}return new QIe(n,e,r)}async function G8o(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Xse(t))e.push(await t.arrayBuffer());else if(Y8o(t))for await(let r of t)e.push(r);else throw new Error(`Unexpected data type: ${typeof t}; constructor: ${t?.constructor?.name}; props: ${Z8o(t)}`);return e}function Z8o(t){return`[${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}function X8o(t){return Ect(t.name)||Ect(t.filename)||Ect(t.path)?.split(/[\\/]/).pop()}var Lkr,Fkr,Xse,W8o,Ect,Y8o,Rct,a0,kkr,Pct,iNe=v(()=>{Use();Use();Lkr=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function",Fkr=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Xse(t),Xse=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",W8o=t=>Fkr(t)||Lkr(t)||wct(t);Ect=t=>{if(typeof t=="string")return t;if(typeof Buffer<"u"&&t instanceof Buffer)return String(t)},Y8o=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Rct=t=>t&&typeof t=="object"&&t.body&&t[Symbol.toStringTag]==="MultipartBody",a0=async t=>{let e=await kkr(t.body);return _ct(e,t)},kkr=async t=>{let e=new yct;return await Promise.all(Object.entries(t||{}).map(([r,n])=>Pct(e,r,n))),e},Pct=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(W8o(r)){let n=await Mct(r);t.append(e,n)}else if(Array.isArray(r))await Promise.all(r.map(n=>Pct(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>Pct(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 Vkr(t){let{response:e}=t;if(t.options.stream)return jD("response",e.status,e.url,e.headers,e.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(e,t.controller):uI.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 jD("response",e.status,e.url,e.headers,a),Jkr(a,e)}let i=await e.text();return jD("response",e.status,e.url,e.headers,i),i}function Jkr(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 oGo(){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 Kkr(t){if(!t)return!0;for(let e in t)return!1;return!0}function Wkr(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function zkr(t,e){for(let r in e){if(!Wkr(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 jD(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)Hkr.has(a.toLowerCase())&&(i.headers[a]="REDACTED");return i}let o=null;for(let i in n)Hkr.has(i.toLowerCase())&&(o??(o={...n}),o[i]="REDACTED");return o??n});console.log(`OpenAI:DEBUG:${t}`,...r)}}function eue(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var eGo,tGo,aNe,uNe,lNe,Yse,Ict,Tct,rGo,zo,nGo,qkr,Bkr,Ukr,iGo,aGo,sGo,uGo,DD,Act,rNe,Qse,Hkr,lGo,Gkr,cGo,sNe,Zkr,Bi=v(()=>{Ekr();oNe();lw();Use();iNe();iNe();eGo=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},tGo=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)};Cct();uNe=class t extends Promise{constructor(e,r=Vkr){super(n=>{n(null)}),this.responsePromise=e,this.parseResponse=r}_thenUnwrap(e){return new t(this.responsePromise,async r=>Jkr(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)}},lNe=class{constructor({baseURL:e,maxRetries:r=2,timeout:n=6e5,httpAgent:o,fetch:i}){this.baseURL=e,this.maxRetries=Act("maxRetries",r),this.timeout=Act("timeout",n),this.httpAgent=o,this.fetch=i??gct}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...iGo(),...this.authHeaders(e)}}validateHeaders(e,r){}defaultIdempotencyKey(){return`stainless-node-retry-${lGo()}`}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&&Xse(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:Rct(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&&Act("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let d=n.httpAgent??this.httpAgent??vct(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 zkr(i,a),zkr(i,r),Rct(e.body)&&jV!=="node"&&delete i["content-type"],sNe(a,"x-stainless-retry-count")===void 0&&sNe(r,"x-stainless-retry-count")===void 0&&(i["x-stainless-retry-count"]=String(o)),sNe(a,"x-stainless-timeout")===void 0&&sNe(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 qm.generate(e,r,n,o)}request(e,r=null){return new uNe(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}),jD("request",a,n,i.headers),n.signal?.aborted)throw new sm;let u=new AbortController,l=await this.fetchWithTimeout(a,i,s,u).catch(rNe);if(l instanceof Error){if(n.signal?.aborted)throw new sm;if(r)return this.retryRequest(n,r);throw l.name==="AbortError"?new Nq:new Iq({cause:l})}let c=Tct(l.headers);if(!l.ok){if(r&&this.shouldRetry(l)){let g=`retrying, ${r} attempts remaining`;return jD(`response (error; ${g})`,l.status,a,c),this.retryRequest(n,r,c)}let d=await l.text().catch(g=>rNe(g).message),f=aGo(d),p=f?void 0:d;throw jD(`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 Ict(this,n,e)}buildURL(e,r){let n=uGo(e)?new URL(e):new URL(this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery();return Kkr(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 Ar(`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 DD(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 ${NV}`}},Yse=class{constructor(e,r,n,o){aNe.set(this,void 0),eGo(this,aNe,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 Ar("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 tGo(this,aNe,"f").requestAPIList(this.constructor,r)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(aNe=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},Ict=class extends uNe{constructor(e,r,n){super(r,async o=>new n(e,o.response,await Vkr(o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},Tct=t=>new Proxy(Object.fromEntries(t.entries()),{get(e,r){let n=r.toString();return e[n.toLowerCase()]||e[n]}}),rGo={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},zo=t=>typeof t=="object"&&t!==null&&!Kkr(t)&&Object.keys(t).every(e=>Wkr(rGo,e)),nGo=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":NV,"X-Stainless-OS":Bkr(Deno.build.os),"X-Stainless-Arch":qkr(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":NV,"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":NV,"X-Stainless-OS":Bkr(process.platform),"X-Stainless-Arch":qkr(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let t=oGo();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":NV,"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":NV,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};qkr=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Bkr=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"),iGo=()=>Ukr??(Ukr=nGo()),aGo=t=>{try{return JSON.parse(t)}catch{return}},sGo=/^[a-z][a-z0-9+.-]*:/i,uGo=t=>sGo.test(t),DD=t=>new Promise(e=>setTimeout(e,t)),Act=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Ar(`${t} must be an integer`);if(e<0)throw new Ar(`${t} must be a positive integer`);return e},rNe=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)},Qse=t=>{if(typeof process<"u")return process.env?.[t]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.(t)?.trim()};Hkr=new Set(["authorization","api-key"]);lGo=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),Gkr=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u",cGo=t=>typeof t?.get=="function",sNe=(t,e)=>{let r=e.toLowerCase();if(cGo(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},Zkr=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 lI,Va,Th=v(()=>{Bi();lI=class extends Yse{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageParams(){return null}nextPageInfo(){return null}},Va=class extends Yse{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 Mt,Xo=v(()=>{Mt=class{constructor(e){this._client=e}}});var k9,Nct=v(()=>{Xo();Bi();tue();k9=class extends Mt{list(e,r={},n){return zo(r)?this.list(e,{},r):this._client.getAPIList(`/chat/completions/${e}/messages`,cNe,{query:r,...n})}}});var Dq,$q,cNe,tue=v(()=>{Xo();Bi();Nct();Nct();Th();Dq=class extends Mt{constructor(){super(...arguments),this.messages=new k9(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 zo(e)?this.list({},e):this._client.getAPIList("/chat/completions",$q,{query:e,...r})}del(e,r){return this._client.delete(`/chat/completions/${e}`,r)}},$q=class extends Va{},cNe=class extends Va{};Dq.ChatCompletionsPage=$q;Dq.Messages=k9});var $D,jct=v(()=>{Xo();tue();tue();$D=class extends Mt{constructor(){super(...arguments),this.completions=new Dq(this._client)}};$D.Completions=Dq;$D.ChatCompletionsPage=$q});var Xkr=v(()=>{jct()});var Ykr=v(()=>{});var q9,Dct=v(()=>{Xo();q9=class extends Mt{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:{Accept:"application/octet-stream",...r?.headers},__binaryResponse:!0})}}});var B9,$ct=v(()=>{Xo();Bi();B9=class extends Mt{create(e,r){return this._client.post("/audio/transcriptions",a0({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model}}))}}});var U9,Lct=v(()=>{Xo();Bi();U9=class extends Mt{create(e,r){return this._client.post("/audio/translations",a0({body:e,...r,__metadata:{model:e.model}}))}}});var cI,Fct=v(()=>{Xo();Dct();Dct();$ct();$ct();Lct();Lct();cI=class extends Mt{constructor(){super(...arguments),this.transcriptions=new B9(this._client),this.translations=new U9(this._client),this.speech=new q9(this._client)}};cI.Transcriptions=B9;cI.Translations=U9;cI.Speech=q9});var Lq,LV,kct=v(()=>{Xo();Bi();Th();Lq=class extends Mt{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 zo(e)?this.list({},e):this._client.getAPIList("/batches",LV,{query:e,...r})}cancel(e,r){return this._client.post(`/batches/${e}/cancel`,r)}},LV=class extends Va{};Lq.BatchesPage=LV});var FV,z9,qct=v(()=>{Xo();Bi();Th();FV=class extends Mt{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 zo(e)?this.list({},e):this._client.getAPIList("/assistants",z9,{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}})}},z9=class extends Va{};FV.AssistantsPage=z9});function Bct(t){return typeof t.parse=="function"}var Qkr=v(()=>{});var Fq,Uct,zct,Hct=v(()=>{Fq=t=>t?.role==="assistant",Uct=t=>t?.role==="function",zct=t=>t?.role==="tool"});var ux,hc,Vct,dNe,fNe,rue,nue,pNe,oue,LD,iue,mNe,hNe,H9,eqr,kq,gNe=v(()=>{lw();ux=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},hc=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)},kq=class{constructor(){Vct.add(this),this.controller=new AbortController,dNe.set(this,void 0),fNe.set(this,()=>{}),rue.set(this,()=>{}),nue.set(this,void 0),pNe.set(this,()=>{}),oue.set(this,()=>{}),LD.set(this,{}),iue.set(this,!1),mNe.set(this,!1),hNe.set(this,!1),H9.set(this,!1),ux(this,dNe,new Promise((e,r)=>{ux(this,fNe,e,"f"),ux(this,rue,r,"f")}),"f"),ux(this,nue,new Promise((e,r)=>{ux(this,pNe,e,"f"),ux(this,oue,r,"f")}),"f"),hc(this,dNe,"f").catch(()=>{}),hc(this,nue,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},hc(this,Vct,"m",eqr).bind(this))},0)}_connected(){this.ended||(hc(this,fNe,"f").call(this),this._emit("connect"))}get ended(){return hc(this,iue,"f")}get errored(){return hc(this,mNe,"f")}get aborted(){return hc(this,hNe,"f")}abort(){this.controller.abort()}on(e,r){return(hc(this,LD,"f")[e]||(hc(this,LD,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=hc(this,LD,"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(hc(this,LD,"f")[e]||(hc(this,LD,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{ux(this,H9,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){ux(this,H9,!0,"f"),await hc(this,nue,"f")}_emit(e,...r){if(hc(this,iue,"f"))return;e==="end"&&(ux(this,iue,!0,"f"),hc(this,pNe,"f").call(this));let n=hc(this,LD,"f")[e];if(n&&(hc(this,LD,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!hc(this,H9,"f")&&!n?.length&&Promise.reject(o),hc(this,rue,"f").call(this,o),hc(this,oue,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!hc(this,H9,"f")&&!n?.length&&Promise.reject(o),hc(this,rue,"f").call(this,o),hc(this,oue,"f").call(this,o),this._emit("end")}}_emitFinal(){}};dNe=new WeakMap,fNe=new WeakMap,rue=new WeakMap,nue=new WeakMap,pNe=new WeakMap,oue=new WeakMap,LD=new WeakMap,iue=new WeakMap,mNe=new WeakMap,hNe=new WeakMap,H9=new WeakMap,Vct=new WeakSet,eqr=function(e){if(ux(this,mNe,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new sm),e instanceof sm)return ux(this,hNe,!0,"f"),this._emit("abort",e);if(e instanceof Ar)return this._emit("error",e);if(e instanceof Error){let r=new Ar(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new Ar(String(e)))}});function aue(t){return t?.$brand==="auto-parseable-response-format"}function kV(t){return t?.$brand==="auto-parseable-tool"}function tqr(t,e){return!e||!Jct(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}}))}:sue(t,e)}function sue(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new L9;if(n.finish_reason==="content_filter")throw new F9;return{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>bGo(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?yGo(e,n.message.content):null}}});return{...t,choices:r}}function yGo(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 bGo(t,e){let r=t.tools?.find(n=>n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:kV(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function rqr(t,e){if(!t)return!1;let r=t.tools?.find(n=>n.function?.name===e.function.name);return kV(r)||r?.function.strict||!1}function Jct(t){return aue(t.response_format)?!0:t.tools?.some(e=>kV(e)||e.type==="function"&&e.function.strict===!0)??!1}function nqr(t){for(let e of t??[]){if(e.type!=="function")throw new Ar(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new Ar(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var uue=v(()=>{lw()});var z_,Iy,Kct,yNe,Wct,Gct,Zct,iqr,Xct,oqr,V9,Yct=v(()=>{lw();Qkr();Hct();gNe();uue();z_=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)},oqr=10,V9=class extends kq{constructor(){super(...arguments),Iy.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),(Uct(e)||zct(e))&&e.content)this._emit("functionCallResult",e.content);else if(Fq(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(Fq(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 Ar("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),z_(this,Iy,"m",Kct).call(this)}async finalMessage(){return await this.done(),z_(this,Iy,"m",yNe).call(this)}async finalFunctionCall(){return await this.done(),z_(this,Iy,"m",Wct).call(this)}async finalFunctionCallResult(){return await this.done(),z_(this,Iy,"m",Gct).call(this)}async totalUsage(){return await this.done(),z_(this,Iy,"m",Zct).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=z_(this,Iy,"m",yNe).call(this);r&&this._emit("finalMessage",r);let n=z_(this,Iy,"m",Kct).call(this);n&&this._emit("finalContent",n);let o=z_(this,Iy,"m",Wct).call(this);o&&this._emit("finalFunctionCall",o);let i=z_(this,Iy,"m",Gct).call(this);i!=null&&this._emit("finalFunctionCallResult",i),this._chatCompletions.some(a=>a.usage)&&this._emit("totalUsage",z_(this,Iy,"m",Zct).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),z_(this,Iy,"m",iqr).call(this,r);let i=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(sue(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=oqr}=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 Ar("missing message in ChatCompletion response");if(!m.function_call)return;let{name:h,arguments:g}=m.function_call,y=c[h];if(y){if(u&&u!==h){let x=`Invalid function_call: ${JSON.stringify(h)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,name:h,content:x});continue}}else{let x=`Invalid function_call: ${JSON.stringify(h)}. Available options are: ${d.map(O=>JSON.stringify(O.name)).join(", ")}. Please try again`;this._addMessage({role:o,name:h,content:x});continue}let b;try{b=Bct(y)?await y.parse(g):g}catch(x){this._addMessage({role:o,name:h,content:x instanceof Error?x.message:String(x)});continue}let _=await y.function(b,this),w=z_(this,Iy,"m",Xct).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=oqr}=n||{},c=r.tools.map(p=>{if(kV(p)){if(!p.$callback)throw new Ar("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 Ar("missing message in ChatCompletion response");if(!h.tool_calls?.length)return;for(let g of h.tool_calls){if(g.type!=="function")continue;let y=g.id,{name:b,arguments:_}=g.function,w=d[b];if(w){if(u&&u!==b){let T=`Invalid tool_call: ${JSON.stringify(b)}. ${JSON.stringify(u)} requested. Please try again`;this._addMessage({role:o,tool_call_id:y,content:T});continue}}else{let T=`Invalid tool_call: ${JSON.stringify(b)}. Available options are: ${Object.keys(d).map(R=>JSON.stringify(R)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:y,content:T});continue}let x;try{x=Bct(w)?await w.parse(_):_}catch(T){let R=T instanceof Error?T.message:String(T);this._addMessage({role:o,tool_call_id:y,content:R});continue}let O=await w.function(x,this),E=z_(this,Iy,"m",Xct).call(this,O);if(this._addMessage({role:o,tool_call_id:y,content:E}),u)return}}}};Iy=new WeakSet,Kct=function(){return z_(this,Iy,"m",yNe).call(this).content??null},yNe=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(Fq(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 Ar("stream ended without producing a ChatCompletionMessage with role=assistant")},Wct=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Fq(r)&&r?.function_call)return r.function_call;if(Fq(r)&&r?.tool_calls?.length)return r.tool_calls.at(-1)?.function}},Gct=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Uct(r)&&r.content!=null||zct(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}},Zct=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},iqr=function(e){if(e.n!=null&&e.n>1)throw new Ar("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},Xct=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)}});var lue,aqr=v(()=>{Yct();Hct();lue=class t extends V9{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),Fq(e)&&e.content&&this._emit("content",e.content)}}});function _Go(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 vGo(t.trim(),e)}var Eh,Qct,edt,vGo,tdt,sqr=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},Qct=class extends Error{},edt=class extends Error{};vGo=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Qct(`${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()},tdt=t=>_Go(t,Eh.ALL^Eh.NUM)});function wGo(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 Ar(`missing finish_reason for choice ${d}`);let{content:m=null,function_call:h,tool_calls:g,...y}=l,b=l.role;if(!b)throw new Ar(`missing role for choice ${d}`);if(h){let{arguments:_,name:w}=h;if(_==null)throw new Ar(`missing function_call.arguments for choice ${d}`);if(!w)throw new Ar(`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 g?{...p,index:d,finish_reason:c,logprobs:f,message:{...y,role:b,content:m,refusal:l.refusal??null,tool_calls:g.map((_,w)=>{let{function:x,type:O,id:E,...T}=_,{arguments:R,name:N,...D}=x||{};if(E==null)throw new Ar(`missing choices[${d}].tool_calls[${w}].id
|
||
${vNe(t)}`);if(O==null)throw new Ar(`missing choices[${d}].tool_calls[${w}].type
|
||
${vNe(t)}`);if(N==null)throw new Ar(`missing choices[${d}].tool_calls[${w}].function.name
|
||
${vNe(t)}`);if(R==null)throw new Ar(`missing choices[${d}].tool_calls[${w}].function.arguments
|
||
${vNe(t)}`);return{...T,id:E,type:O,function:{...D,name:N,arguments:R}}})}}:{...p,message:{...y,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 tqr(u,e)}function vNe(t){return JSON.stringify(t)}var J9,gu,Bm,FD,K9,qq,rdt,bNe,ndt,odt,idt,_Ne,adt,uqr,W9,sdt=v(()=>{lw();Yct();oNe();uue();sqr();J9=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},gu=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)},W9=class t extends V9{constructor(e){super(),Bm.add(this),FD.set(this,void 0),K9.set(this,void 0),qq.set(this,void 0),J9(this,FD,e,"f"),J9(this,K9,[],"f")}get currentChatCompletionSnapshot(){return gu(this,qq,"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())),gu(this,Bm,"m",rdt).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)gu(this,Bm,"m",ndt).call(this,a);if(i.controller.signal?.aborted)throw new sm;return this._addChatCompletion(gu(this,Bm,"m",_Ne).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),gu(this,Bm,"m",rdt).call(this),this._connected();let o=uI.fromReadableStream(e,this.controller),i;for await(let a of o)i&&i!==a.id&&this._addChatCompletion(gu(this,Bm,"m",_Ne).call(this)),gu(this,Bm,"m",ndt).call(this,a),i=a.id;if(o.controller.signal?.aborted)throw new sm;return this._addChatCompletion(gu(this,Bm,"m",_Ne).call(this))}[(FD=new WeakMap,K9=new WeakMap,qq=new WeakMap,Bm=new WeakSet,rdt=function(){this.ended||J9(this,qq,void 0,"f")},bNe=function(r){let n=gu(this,K9,"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},gu(this,K9,"f")[r.index]=n,n)},ndt=function(r){if(this.ended)return;let n=gu(this,Bm,"m",uqr).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=gu(this,Bm,"m",bNe).call(this,i);i.finish_reason&&(gu(this,Bm,"m",idt).call(this,i),a.current_tool_call_index!=null&&gu(this,Bm,"m",odt).call(this,i,a.current_tool_call_index));for(let s of o.delta.tool_calls??[])a.current_tool_call_index!==s.index&&(gu(this,Bm,"m",idt).call(this,i),a.current_tool_call_index!=null&&gu(this,Bm,"m",odt).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))}}},odt=function(r,n){if(gu(this,Bm,"m",bNe).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=gu(this,FD,"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:kV(a)?a.$parseRaw(i.function.arguments):a?.function.strict?JSON.parse(i.function.arguments):null})}else i.type},idt=function(r){let n=gu(this,Bm,"m",bNe).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=gu(this,Bm,"m",adt).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}))},_Ne=function(){if(this.ended)throw new Ar("stream has ended, this shouldn't happen");let r=gu(this,qq,"f");if(!r)throw new Ar("request ended without sending any chunks");return J9(this,qq,void 0,"f"),J9(this,K9,[],"f"),wGo(r,gu(this,FD,"f"))},adt=function(){let r=gu(this,FD,"f")?.response_format;return aue(r)?r:null},uqr=function(r){var n,o,i,a;let s=gu(this,qq,"f"),{choices:u,...l}=r;s?Object.assign(s,l):s=J9(this,qq,{...l,choices:[]},"f");for(let{delta:c,finish_reason:d,index:f,logprobs:p=null,...m}of r.choices){let h=s.choices[f];if(h||(h=s.choices[f]={finish_reason:d,index:f,message:{},logprobs:p,...m}),p)if(!h.logprobs)h.logprobs=Object.assign({},p);else{let{content:O,refusal:E,...T}=p;Object.assign(h.logprobs,T),O&&((n=h.logprobs).content??(n.content=[]),h.logprobs.content.push(...O)),E&&((o=h.logprobs).refusal??(o.refusal=[]),h.logprobs.refusal.push(...E))}if(d&&(h.finish_reason=d,gu(this,FD,"f")&&Jct(gu(this,FD,"f")))){if(d==="length")throw new L9;if(d==="content_filter")throw new F9}if(Object.assign(h,m),!c)continue;let{content:g,refusal:y,function_call:b,role:_,tool_calls:w,...x}=c;if(Object.assign(h.message,x),y&&(h.message.refusal=(h.message.refusal||"")+y),_&&(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),g&&(h.message.content=(h.message.content||"")+g,!h.message.refusal&&gu(this,Bm,"m",adt).call(this)&&(h.message.parsed=tdt(h.message.content))),w){h.message.tool_calls||(h.message.tool_calls=[]);for(let{index:O,id:E,type:T,function:R,...N}of w){let D=(a=h.message.tool_calls)[O]??(a[O]={});Object.assign(D,N),E&&(D.id=E),T&&(D.type=T),R&&(D.function??(D.function={name:R.name??"",arguments:""})),R?.name&&(D.function.name=R.name),R?.arguments&&(D.function.arguments+=R.arguments,rqr(gu(this,FD,"f"),D)&&(D.function.parsed_arguments=tdt(D.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 uI(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var cue,lqr=v(()=>{sdt();cue=class t extends W9{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 due,cqr=v(()=>{Xo();aqr();lqr();sdt();uue();due=class extends Mt{parse(e,r){return nqr(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(n=>sue(n,e))}runFunctions(e,r){return e.stream?cue.runFunctions(this._client,e,r):lue.runFunctions(this._client,e,r)}runTools(e,r){return e.stream?cue.runTools(this._client,e,r):lue.runTools(this._client,e,r)}stream(e,r){return W9.createChatCompletion(this._client,e,r)}}});var G9,dqr=v(()=>{Xo();cqr();G9=class extends Mt{constructor(){super(...arguments),this.completions=new due(this._client)}};(function(t){t.Completions=due})(G9||(G9={}))});var Z9,udt=v(()=>{Xo();Z9=class extends Mt{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var X9,ldt=v(()=>{Xo();X9=class extends Mt{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}});var Bq,cdt=v(()=>{Xo();udt();udt();ldt();ldt();Bq=class extends Mt{constructor(){super(...arguments),this.sessions=new Z9(this._client),this.transcriptionSessions=new X9(this._client)}};Bq.Sessions=Z9;Bq.TranscriptionSessions=X9});var Zr,dw,Mg,ddt,dI,wNe,lx,BV,Y9,qV,xNe,fw,SNe,CNe,mue,fue,pue,fqr,pqr,mqr,hqr,gqr,yqr,bqr,fI,fdt=v(()=>{Bi();oNe();lw();gNe();Zr=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)},dw=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},fI=class t extends kq{constructor(){super(...arguments),Mg.add(this),ddt.set(this,[]),dI.set(this,{}),wNe.set(this,{}),lx.set(this,void 0),BV.set(this,void 0),Y9.set(this,void 0),qV.set(this,void 0),xNe.set(this,void 0),fw.set(this,void 0),SNe.set(this,void 0),CNe.set(this,void 0),mue.set(this,void 0)}[(ddt=new WeakMap,dI=new WeakMap,wNe=new WeakMap,lx=new WeakMap,BV=new WeakMap,Y9=new WeakMap,qV=new WeakMap,xNe=new WeakMap,fw=new WeakMap,SNe=new WeakMap,CNe=new WeakMap,mue=new WeakMap,Mg=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=uI.fromReadableStream(e,this.controller);for await(let i of o)Zr(this,Mg,"m",fue).call(this,i);if(o.controller.signal?.aborted)throw new sm;return this._addRun(Zr(this,Mg,"m",pue).call(this))}toReadableStream(){return new uI(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)Zr(this,Mg,"m",fue).call(this,l);if(u.controller.signal?.aborted)throw new sm;return this._addRun(Zr(this,Mg,"m",pue).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 Zr(this,SNe,"f")}currentRun(){return Zr(this,CNe,"f")}currentMessageSnapshot(){return Zr(this,lx,"f")}currentRunStepSnapshot(){return Zr(this,mue,"f")}async finalRunSteps(){return await this.done(),Object.values(Zr(this,dI,"f"))}async finalMessages(){return await this.done(),Object.values(Zr(this,wNe,"f"))}async finalRun(){if(await this.done(),!Zr(this,BV,"f"))throw Error("Final run was not received.");return Zr(this,BV,"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)Zr(this,Mg,"m",fue).call(this,s);if(a.controller.signal?.aborted)throw new sm;return this._addRun(Zr(this,Mg,"m",pue).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)Zr(this,Mg,"m",fue).call(this,u);if(s.controller.signal?.aborted)throw new sm;return this._addRun(Zr(this,Mg,"m",pue).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(eue(i)&&eue(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(!eue(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)}};fue=function(e){if(!this.ended)switch(dw(this,SNe,e,"f"),Zr(this,Mg,"m",mqr).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":Zr(this,Mg,"m",bqr).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":Zr(this,Mg,"m",pqr).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":Zr(this,Mg,"m",fqr).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},pue=function(){if(this.ended)throw new Ar("stream has ended, this shouldn't happen");if(!Zr(this,BV,"f"))throw Error("Final run has not been received");return Zr(this,BV,"f")},fqr=function(e){let[r,n]=Zr(this,Mg,"m",gqr).call(this,e,Zr(this,lx,"f"));dw(this,lx,r,"f"),Zr(this,wNe,"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!=Zr(this,Y9,"f")){if(Zr(this,qV,"f"))switch(Zr(this,qV,"f").type){case"text":this._emit("textDone",Zr(this,qV,"f").text,Zr(this,lx,"f"));break;case"image_file":this._emit("imageFileDone",Zr(this,qV,"f").image_file,Zr(this,lx,"f"));break}dw(this,Y9,o.index,"f")}dw(this,qV,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(Zr(this,Y9,"f")!==void 0){let o=e.data.content[Zr(this,Y9,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,Zr(this,lx,"f"));break;case"text":this._emit("textDone",o.text,Zr(this,lx,"f"));break}}Zr(this,lx,"f")&&this._emit("messageDone",e.data),dw(this,lx,void 0,"f")}},pqr=function(e){let r=Zr(this,Mg,"m",hqr).call(this,e);switch(dw(this,mue,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==Zr(this,xNe,"f")?this._emit("toolCallDelta",i,r.step_details.tool_calls[i.index]):(Zr(this,fw,"f")&&this._emit("toolCallDone",Zr(this,fw,"f")),dw(this,xNe,i.index,"f"),dw(this,fw,r.step_details.tool_calls[i.index],"f"),Zr(this,fw,"f")&&this._emit("toolCallCreated",Zr(this,fw,"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":dw(this,mue,void 0,"f"),e.data.step_details.type=="tool_calls"&&Zr(this,fw,"f")&&(this._emit("toolCallDone",Zr(this,fw,"f")),dw(this,fw,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},mqr=function(e){Zr(this,ddt,"f").push(e),this._emit("event",e)},hqr=function(e){switch(e.event){case"thread.run.step.created":return Zr(this,dI,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=Zr(this,dI,"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=fI.accumulateDelta(r,n.delta);Zr(this,dI,"f")[e.data.id]=o}return Zr(this,dI,"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":Zr(this,dI,"f")[e.data.id]=e.data;break}if(Zr(this,dI,"f")[e.data.id])return Zr(this,dI,"f")[e.data.id];throw new Error("No snapshot available")},gqr=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]=Zr(this,Mg,"m",yqr).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")},yqr=function(e,r){return fI.accumulateDelta(r,e)},bqr=function(e){switch(dw(this,CNe,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":dw(this,BV,e.data,"f"),Zr(this,fw,"f")&&(this._emit("toolCallDone",Zr(this,fw,"f")),dw(this,fw,void 0,"f"));break;case"thread.run.cancelling":break}}});var UV,Q9,pdt=v(()=>{Xo();Bi();Th();UV=class extends Mt{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 zo(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/messages`,Q9,{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}})}},Q9=class extends Va{};UV.MessagesPage=Q9});var zV,e7,mdt=v(()=>{Xo();Bi();Th();zV=class extends Mt{retrieve(e,r,n,o={},i){return zo(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 zo(n)?this.list(e,r,{},n):this._client.getAPIList(`/threads/${e}/runs/${r}/steps`,e7,{query:n,...o,headers:{"OpenAI-Beta":"assistants=v2",...o?.headers}})}},e7=class extends Va{};zV.RunStepsPage=e7});var kD,t7,hdt=v(()=>{Xo();Bi();fdt();Bi();mdt();mdt();Th();kD=class extends Mt{constructor(){super(...arguments),this.steps=new zV(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 zo(r)?this.list(e,{},r):this._client.getAPIList(`/threads/${e}/runs`,t7,{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 fI.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 DD(s);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return i}}}stream(e,r,n){return fI.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 fI.createToolAssistantStream(e,r,this._client.beta.threads.runs,n,o)}},t7=class extends Va{};kD.RunsPage=t7;kD.Steps=zV;kD.RunStepsPage=e7});var pI,gdt=v(()=>{Xo();Bi();fdt();pdt();pdt();hdt();hdt();pI=class extends Mt{constructor(){super(...arguments),this.runs=new kD(this._client),this.messages=new UV(this._client)}create(e={},r){return zo(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 fI.createThreadAssistantStream(e,this._client.beta.threads,r)}};pI.Runs=kD;pI.RunsPage=t7;pI.Messages=UV;pI.MessagesPage=Q9});var cx,ydt=v(()=>{Xo();qct();dqr();qct();cdt();cdt();gdt();gdt();cx=class extends Mt{constructor(){super(...arguments),this.realtime=new Bq(this._client),this.chat=new G9(this._client),this.assistants=new FV(this._client),this.threads=new pI(this._client)}};cx.Realtime=Bq;cx.Assistants=FV;cx.AssistantsPage=z9;cx.Threads=pI});var HV,bdt=v(()=>{Xo();HV=class extends Mt{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1})}}});var VV,_dt=v(()=>{Xo();Bi();VV=class extends Mt{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&jD("Request","User defined encoding_format:",e.encoding_format);let i=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r});return n?i:(jD("response","Decoding base64 embeddings to float32 array"),i._thenUnwrap(a=>(a&&a.data&&a.data.forEach(s=>{let u=s.embedding;s.embedding=Zkr(u)}),a)))}}});var JV,r7,vdt=v(()=>{Xo();Bi();Th();JV=class extends Mt{retrieve(e,r,n,o){return this._client.get(`/evals/${e}/runs/${r}/output_items/${n}`,o)}list(e,r,n={},o){return zo(n)?this.list(e,r,{},n):this._client.getAPIList(`/evals/${e}/runs/${r}/output_items`,r7,{query:n,...o})}},r7=class extends Va{};JV.OutputItemListResponsesPage=r7});var qD,n7,wdt=v(()=>{Xo();Bi();vdt();vdt();Th();qD=class extends Mt{constructor(){super(...arguments),this.outputItems=new JV(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 zo(r)?this.list(e,{},r):this._client.getAPIList(`/evals/${e}/runs`,n7,{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)}},n7=class extends Va{};qD.RunListResponsesPage=n7;qD.OutputItems=JV;qD.OutputItemListResponsesPage=r7});var mI,KV,Sdt=v(()=>{Xo();Bi();wdt();wdt();Th();mI=class extends Mt{constructor(){super(...arguments),this.runs=new qD(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 zo(e)?this.list({},e):this._client.getAPIList("/evals",KV,{query:e,...r})}del(e,r){return this._client.delete(`/evals/${e}`,r)}},KV=class extends Va{};mI.EvalListResponsesPage=KV;mI.Runs=qD;mI.RunListResponsesPage=n7});var Uq,WV,Cdt=v(()=>{Xo();Bi();Bi();lw();Bi();Th();Uq=class extends Mt{create(e,r){return this._client.post("/files",a0({body:e,...r}))}retrieve(e,r){return this._client.get(`/files/${e}`,r)}list(e={},r){return zo(e)?this.list({},e):this._client.getAPIList("/files",WV,{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 DD(r),a=await this.retrieve(e),Date.now()-i>n)throw new Nq({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},WV=class extends Va{};Uq.FileObjectsPage=WV});var GV,o7,xdt=v(()=>{Xo();Bi();Th();GV=class extends Mt{create(e,r,n){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,o7,{body:r,method:"post",...n})}retrieve(e,r={},n){return zo(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)}},o7=class extends lI{};GV.PermissionCreateResponsesPage=o7});var zq,Odt=v(()=>{Xo();xdt();xdt();zq=class extends Mt{constructor(){super(...arguments),this.permissions=new GV(this._client)}};zq.Permissions=GV;zq.PermissionCreateResponsesPage=o7});var ZV,i7,Tdt=v(()=>{Xo();Bi();Th();ZV=class extends Mt{list(e,r={},n){return zo(r)?this.list(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,i7,{query:r,...n})}},i7=class extends Va{};ZV.FineTuningJobCheckpointsPage=i7});var hI,a7,s7,Edt=v(()=>{Xo();Bi();Tdt();Tdt();Th();hI=class extends Mt{constructor(){super(...arguments),this.checkpoints=new ZV(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 zo(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",a7,{query:e,...r})}cancel(e,r){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,r)}listEvents(e,r={},n){return zo(r)?this.listEvents(e,{},r):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,s7,{query:r,...n})}},a7=class extends Va{},s7=class extends Va{};hI.FineTuningJobsPage=a7;hI.FineTuningJobEventsPage=s7;hI.Checkpoints=ZV;hI.FineTuningJobCheckpointsPage=i7});var dx,Pdt=v(()=>{Xo();Odt();Odt();Edt();Edt();dx=class extends Mt{constructor(){super(...arguments),this.jobs=new hI(this._client),this.checkpoints=new zq(this._client)}};dx.Jobs=hI;dx.FineTuningJobsPage=a7;dx.FineTuningJobEventsPage=s7;dx.Checkpoints=zq});var XV,Mdt=v(()=>{Xo();Bi();XV=class extends Mt{createVariation(e,r){return this._client.post("/images/variations",a0({body:e,...r}))}edit(e,r){return this._client.post("/images/edits",a0({body:e,...r}))}generate(e,r){return this._client.post("/images/generations",{body:e,...r})}}});var Hq,YV,Rdt=v(()=>{Xo();Th();Hq=class extends Mt{retrieve(e,r){return this._client.get(`/models/${e}`,r)}list(e){return this._client.getAPIList("/models",YV,e)}del(e,r){return this._client.delete(`/models/${e}`,r)}},YV=class extends lI{};Hq.ModelsPage=YV});var QV,Adt=v(()=>{Xo();QV=class extends Mt{create(e,r){return this._client.post("/moderations",{body:e,...r})}}});function _qr(t,e){return!e||!FGo(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)}:Idt(t,e)}function Idt(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:BGo(e,o)};if(o.type==="message"){let i=o.content.map(a=>a.type==="output_text"?{...a,parsed:LGo(e,a.text)}:a);return{...o,content:i}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||Ndt(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 LGo(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function FGo(t){return!!aue(t.text?.format)}function kGo(t){return t?.$brand==="auto-parseable-tool"}function qGo(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function BGo(t,e){let r=qGo(t.tools??[],e.name);return{...e,...e,parsed_arguments:kGo(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function Ndt(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 jdt=v(()=>{uue()});var u7,Ddt=v(()=>{Xo();Bi();TNe();u7=class extends Mt{list(e,r={},n){return zo(r)?this.list(e,{},r):this._client.getAPIList(`/responses/${e}/input_items`,ONe,{query:r,...n})}}});function zGo(t,e){return _qr(t,e)}var l7,Vq,c7,ENe,Jq,PNe,vqr,wqr,Sqr,Cqr,MNe,xqr=v(()=>{lw();gNe();jdt();l7=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},Vq=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)},MNe=class t extends kq{constructor(e){super(),c7.add(this),ENe.set(this,void 0),Jq.set(this,void 0),PNe.set(this,void 0),l7(this,ENe,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())),Vq(this,c7,"m",vqr).call(this);let i=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let a of i)Vq(this,c7,"m",wqr).call(this,a);if(i.controller.signal?.aborted)throw new sm;return Vq(this,c7,"m",Sqr).call(this)}[(ENe=new WeakMap,Jq=new WeakMap,PNe=new WeakMap,c7=new WeakSet,vqr=function(){this.ended||l7(this,Jq,void 0,"f")},wqr=function(r){if(this.ended)return;let n=Vq(this,c7,"m",Cqr).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 Ar(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new Ar(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new Ar(`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 Ar(`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}},Sqr=function(){if(this.ended)throw new Ar("stream has ended, this shouldn't happen");let r=Vq(this,Jq,"f");if(!r)throw new Ar("request ended without sending any events");l7(this,Jq,void 0,"f");let n=zGo(r,Vq(this,ENe,"f"));return l7(this,PNe,n,"f"),n},Cqr=function(r){let n=Vq(this,Jq,"f");if(!n){if(r.type!=="response.created")throw new Ar(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=l7(this,Jq,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 Ar(`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 Ar(`missing output at index ${r.output_index}`);if(o.type==="message"){let i=o.content[r.content_index];if(!i)throw new Ar(`missing content at index ${r.content_index}`);if(i.type!=="output_text")throw new Ar(`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 Ar(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.completed":{l7(this,Jq,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=Vq(this,PNe,"f");if(!e)throw new Ar("stream ended without producing a ChatCompletion");return e}}});var Kq,ONe,TNe=v(()=>{jdt();Bi();Xo();Ddt();Ddt();xqr();Th();Kq=class extends Mt{constructor(){super(...arguments),this.inputItems=new u7(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"&&Ndt(n),n))}retrieve(e,r={},n){return zo(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=>Idt(n,e))}stream(e,r){return MNe.createResponse(this._client,e,r)}},ONe=class extends Va{};Kq.InputItems=u7});var d7,$dt=v(()=>{Xo();Bi();d7=class extends Mt{create(e,r,n){return this._client.post(`/uploads/${e}/parts`,a0({body:r,...n}))}}});var Wq,Ldt=v(()=>{Xo();$dt();$dt();Wq=class extends Mt{constructor(){super(...arguments),this.parts=new d7(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})}};Wq.Parts=d7});var Oqr,Tqr=v(()=>{Oqr=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 Gq,Zq,f7,RNe=v(()=>{Xo();Bi();Th();Gq=class extends Mt{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 zo(r)?this.list(e,{},r):this._client.getAPIList(`/vector_stores/${e}/files`,Zq,{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 DD(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`,f7,{...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},Zq=class extends Va{},f7=class extends lI{};Gq.VectorStoreFilesPage=Zq;Gq.FileContentResponsesPage=f7});var p7,Fdt=v(()=>{Xo();Bi();Bi();Tqr();RNe();p7=class extends Mt{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 zo(n)?this.listFiles(e,r,{},n):this._client.getAPIList(`/vector_stores/${e}/file_batches/${r}/files`,Zq,{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 DD(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 Oqr(d),await this.createAndPoll(e,{file_ids:l})}}});var pw,eJ,tJ,kdt=v(()=>{Xo();Bi();Fdt();Fdt();RNe();RNe();Th();pw=class extends Mt{constructor(){super(...arguments),this.files=new Gq(this._client),this.fileBatches=new p7(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 zo(e)?this.list({},e):this._client.getAPIList("/vector_stores",eJ,{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`,tJ,{body:r,method:"post",...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}},eJ=class extends Va{},tJ=class extends lI{};pw.VectorStoresPage=eJ;pw.VectorStoreSearchResponsesPage=tJ;pw.Files=Gq;pw.VectorStoreFilesPage=Zq;pw.FileContentResponsesPage=f7;pw.FileBatches=p7});var Eqr=v(()=>{Xkr();Ykr();Fct();kct();ydt();bdt();_dt();Sdt();Cdt();Pdt();Mdt();Rdt();Adt();TNe();Ldt();kdt()});var Pqr,No,Mqr,Rqr=v(()=>{Tkr();Bi();lw();iNe();Eqr();kct();bdt();_dt();Cdt();Mdt();Rdt();Adt();Fct();ydt();jct();Sdt();Pdt();TNe();Ldt();kdt();tue();No=class extends lNe{constructor({baseURL:e=Qse("OPENAI_BASE_URL"),apiKey:r=Qse("OPENAI_API_KEY"),organization:n=Qse("OPENAI_ORG_ID")??null,project:o=Qse("OPENAI_PROJECT_ID")??null,...i}={}){if(r===void 0)throw new Ar("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&&Gkr())throw new Ar(`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 HV(this),this.chat=new $D(this),this.embeddings=new VV(this),this.files=new Uq(this),this.images=new XV(this),this.audio=new cI(this),this.moderations=new QV(this),this.models=new Hq(this),this.fineTuning=new dx(this),this.vectorStores=new pw(this),this.beta=new cx(this),this.batches=new Lq(this),this.uploads=new Wq(this),this.responses=new Kq(this),this.evals=new mI(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 hct(e,{arrayFormat:"brackets"})}};Pqr=No;No.OpenAI=Pqr;No.DEFAULT_TIMEOUT=6e5;No.OpenAIError=Ar;No.APIError=qm;No.APIConnectionError=Iq;No.APIConnectionTimeoutError=Nq;No.APIUserAbortError=sm;No.NotFoundError=Jse;No.ConflictError=Kse;No.RateLimitError=Gse;No.BadRequestError=zse;No.AuthenticationError=Hse;No.InternalServerError=Zse;No.PermissionDeniedError=Vse;No.UnprocessableEntityError=Wse;No.toFile=Mct;No.fileFromPath=eNe;No.Completions=HV;No.Chat=$D;No.ChatCompletionsPage=$q;No.Embeddings=VV;No.Files=Uq;No.FileObjectsPage=WV;No.Images=XV;No.Audio=cI;No.Moderations=QV;No.Models=Hq;No.ModelsPage=YV;No.FineTuning=dx;No.VectorStores=pw;No.VectorStoresPage=eJ;No.VectorStoreSearchResponsesPage=tJ;No.Beta=cx;No.Batches=Lq;No.BatchesPage=LV;No.Uploads=Wq;No.Responses=Kq;No.Evals=mI;No.EvalListResponsesPage=KV;Mqr=No});var ANe,Aqr=v(()=>{$s();ym();cH();Rqr();Dt();ANe=class extends OA{constructor(e){let{enableReasoning:r=!1,reasoningEffort:n,...o}=e;super(o),this.enableReasoning=r,this.reasoningEffort=n,this.openaiClient=new Mqr({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 J(`OpenRouter reasoning enabled with effort: ${n}`),{...r,reasoning:{effort:n}}}else return J("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 Hi({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 Ur({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 Ur({content:"",response_metadata:{usage:{...e}},usage_metadata:a});return new Hi({message:s,text:""})}}});var INe,Iqr=v(()=>{D1();Dt();$s();ym();INe=class extends hh{constructor(e){let{modelId:r,apiKey:n,endpoint:o,streamEndpoint:i,defaultMaxTokens:a,defaultTemperature:s,defaultTopP:u,anthropicVersion:l,fetchImplementation:c,...d}=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(d);let f=typeof fetch<"u"?fetch.bind(globalThis):void 0;if(this.fetchImpl=c??f,!this.fetchImpl)throw new Error("No fetch implementation available for Amazon Bedrock requests.");d.streaming&&!i&&Ot("Amazon Bedrock streaming requested without a streaming endpoint; falling back to non-streaming mode."),this.apiKey=n,this.endpoint=o,this.streamEndpoint=i,this.defaultMaxTokens=a,this.defaultTemperature=s,this.defaultTopP=u,this.anthropicVersion=l}_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 li({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 Ur({content:m,response_metadata:p.llmOutput??{}});yield new Hi({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)}`;J(`[${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:g,remainingBytes:y}=this.parseEventStreamBuffer(u);u=new Uint8Array(y);for(let b of g){let _=this.safeJsonParse(b);if(!_){Ot(`[${i}] Failed to parse event JSON: ${b.slice(0,100)}...`);continue}let w=_;typeof _.bytes=="string"&&!_.type&&(w={type:"chunk",chunk:{bytes:_.bytes}});let x=await this.processStreamEvent(w,n,c,l);if(c=x.usage??c,l=x.stopReason??l,x.hasText||f.push(this.describeEvent(_)),x.deltaChunks.length>0)for(let O of x.deltaChunks)d=d||!!O.text,yield O;x.debugSummaries.length>0&&f.push(...x.debugSummaries)}}}catch(p){throw ue(`[${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){Ot(`[${i}] Stream complete but no text yielded. Usage: ${JSON.stringify(c)}, stopReason: ${l}`),f.length>0&&J(`[${i}] Amazon Bedrock streaming produced no delta text. Sample events: ${f.slice(0,5).join(" | ")}`),Ot(`[${i}] Amazon Bedrock streaming returned no content. Falling back to non-streaming response.`);let p=await this._generate(e,r,n),m=p.generations[0]?.text??"";m&&(yield new Hi({message:new Ur({content:m,response_metadata:p.llmOutput??{}}),text:m,generationInfo:p.llmOutput??{}}))}}safeJsonParse(e){try{return JSON.parse(e)}catch{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.extractStreamText(f);if(m){let y=new Ur({content:m,response_metadata:p}),b=new Hi({message:y,text:m,generationInfo:p});i.push(b),u=!0,r&&await r.handleLLMNewToken(m)}else if(f.type==="content_block_delta"){let y=`No text in content_block_delta event: ${this.describeEvent(f)}`;l.push(y),Ot(`processStreamEvent: ${y}`)}let h=this.extractUsage(f);h&&(a=h);let g=this.extractStopReason(f);g&&(s=g)}}else{let c=this.buildChunkMetadata(e),d=this.extractStreamText(e);if(d){let m=new Ur({content:d,response_metadata:c}),h=new Hi({message:m,text:d,generationInfo:c});i.push(h),u=!0,r&&await r.handleLLMNewToken(d)}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 Ot("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;Ot("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){Ot(`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){Ot(`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.text,e.outputText,e.completion,e.resultText,e.delta];for(let o of r)if(typeof o=="string"&&o.length>0)return o;let n=[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 o of n){let i=this.extractTextFromCandidate(o);if(i)return i}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 Ur({content:"",response_metadata:o,usage_metadata:n});return new Hi({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}}buildRequestBody(e,r){let n=[],o=[];e.forEach(l=>{let c=this.normaliseMessageContent(l);if(!c)return;let d=l._getType();if(d==="system"){o.push(c);return}n.push({role:d==="ai"?"assistant":"user",content:[{type:"text",text:c}]})});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),a!==void 0&&(u.temperature=a),s!==void 0&&(u.top_p=s),this.anthropicVersion&&(u.anthropic_version=this.anthropicVersion),u}normaliseMessageContent(e){let{content:r}=e;return typeof r=="string"?r:Array.isArray(r)?r.map(n=>{if(typeof n=="string")return n;if(typeof n=="object"&&n!==null){if("text"in n&&typeof n.text=="string")return n.text;if("content"in n&&typeof n.content=="string")return n.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:""}}});var Nqr={};Xn(Nqr,{default:()=>gI});var NNe,WGo,Ph,gI,hue=v(()=>{Tu();zr();zz();Dt();Pt();wr();Fgr();rbr();zYe();obr();rQe();Ibr();hkr();yQe();cH();ykr();NNe=require("obsidian");Aqr();Iqr();WGo={openai:OA,"azure openai":OA,anthropic:kit,cohereai:qYe,google:eQe,xai:cct,openrouterai:ANe,ollama:hQe,"lm-studio":OA,groq:mat,"3rd party (openai-format)":OA,"copilot-plus":OA,mistralai:lct,deepseek:qit,"amazon-bedrock":INe},Ph=class Ph{constructor(){this.providerApiKeyMap={openai:()=>ce().openAIApiKey,google:()=>ce().googleApiKey,"azure openai":()=>ce().azureOpenAIApiKey,anthropic:()=>ce().anthropicApiKey,cohereai:()=>ce().cohereApiKey,openrouterai:()=>ce().openRouterAiApiKey,groq:()=>ce().groqApiKey,xai:()=>ce().xaiApiKey,ollama:()=>"default-key","lm-studio":()=>"default-key","3rd party (openai-format)":()=>"default-key","copilot-plus":()=>ce().plusLicenseKey,mistralai:()=>ce().mistralApiKey,deepseek:()=>ce().deepseekApiKey,"amazon-bedrock":()=>ce().amazonBedrockApiKey};this.buildModelMap(),Ou(()=>{this.buildModelMap(),this.validateCurrentModel()})}static getInstance(){return Ph.instance||(Ph.instance=new Ph),Ph.instance}getTemperatureForModel(e,r,n){if(!e.isThinkingEnabled)return e.isOSeries||e.isGPT5?Ph.REASONING_MODEL_TEMPERATURE:r.temperature??n.temperature}async getModelConfig(e){let r=ce(),n=e.name,o=z6(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 $i(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Wc:void 0,organization:await $i(e.openAIOrgId||r.openAIOrgId)},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},anthropic:{anthropicApiKey:await $i(e.apiKey||r.anthropicApiKey),model:n,anthropicApiUrl:e.baseUrl,clientOptions:{defaultHeaders:{"anthropic-dangerous-direct-browser-access":"true"},fetch:e.enableCors?Wc:void 0},...i&&{thinking:{type:"enabled",budget_tokens:2048}}},"azure openai":{modelName:e.azureOpenAIApiDeploymentName||r.azureOpenAIApiDeploymentName,apiKey:await $i(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 $i(e.apiKey||r.azureOpenAIApiKey)},fetch:e.enableCors?Wc:void 0},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},cohereai:{apiKey:await $i(e.apiKey||r.cohereApiKey),model:n},google:{apiKey:await $i(e.apiKey||r.googleApiKey),model:n,safetySettings:[{category:PH.HARM_CATEGORY_SEXUALLY_EXPLICIT,threshold:MH.BLOCK_NONE},{category:PH.HARM_CATEGORY_HATE_SPEECH,threshold:MH.BLOCK_NONE},{category:PH.HARM_CATEGORY_DANGEROUS_CONTENT,threshold:MH.BLOCK_NONE},{category:PH.HARM_CATEGORY_HARASSMENT,threshold:MH.BLOCK_NONE}],baseUrl:e.baseUrl},xai:{apiKey:await $i(e.apiKey||r.xaiApiKey),model:n},openrouterai:{modelName:n,apiKey:await $i(e.apiKey||r.openRouterAiApiKey),configuration:{baseURL:e.baseUrl||"https://openrouter.ai/api/v1",fetch:e.enableCors?Wc: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 $i(e.apiKey||r.groqApiKey),model:n},ollama:{model:n,baseUrl:e.baseUrl||"http://localhost:11434",headers:new Headers({Authorization:`Bearer ${await $i(e.apiKey||"default-key")}`})},"lm-studio":{modelName:n,apiKey:e.apiKey||"default-key",configuration:{baseURL:e.baseUrl||"http://localhost:1234/v1",fetch:e.enableCors?Wc:void 0}},"3rd party (openai-format)":{modelName:n,apiKey:await $i(e.apiKey||r.openAIApiKey),configuration:{baseURL:e.baseUrl,fetch:e.enableCors?Wc:void 0,defaultHeaders:{"dangerously-allow-browser":"true"}},...this.getOpenAISpecialConfig(n,e.maxTokens??r.maxTokens,e.temperature??r.temperature,e)},"copilot-plus":{modelName:n,apiKey:await $i(r.plusLicenseKey),configuration:{baseURL:Fz,fetch:e.enableCors?Wc:void 0}},mistralai:{model:n,apiKey:await $i(e.apiKey||r.mistralApiKey),serverURL:e.baseUrl},deepseek:{modelName:n,apiKey:await $i(e.apiKey||r.deepseekApiKey),configuration:{baseURL:e.baseUrl||J6.deepseek.host,fetch:e.enableCors?Wc:void 0}},"amazon-bedrock":{}}[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=ce(),a=z6(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 $i(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`,g=`${p}/model/${m}/invoke-with-response-stream`,y=e.enableCors?Wc:void 0,b=r.startsWith("anthropic.")?"bedrock-2023-05-31":void 0;return{modelName:r,modelId:r,apiKey:s,endpoint:h,streamEndpoint:g,defaultMaxTokens:o,defaultTemperature:i,defaultTopP:e.topP,anthropicVersion:b,fetchImplementation:y,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"].includes(e)&&(n.topP=r.topP),r.frequencyPenalty!==void 0&&["openai","azure openai","openrouterai","ollama","lm-studio","3rd party (openai-format)","mistralai","deepseek"].includes(e)&&(n.frequencyPenalty=r.frequencyPenalty),n}buildModelMap(){let e=ce().activeModels;Ph.modelMap={};let r=Ph.modelMap;(e??SO).forEach(o=>{if(o.enabled){if(!Object.values(OO).contains(o.provider)){console.warn(`Unknown provider: ${o.provider} for model: ${o.name}`);return}let i=this.getProviderConstructor(o),a=this.hasProviderCredentials(o),s=Qn(o);r[s]={hasApiKey:a,AIConstructor:i,vendor:o.provider}}})}hasProviderCredentials(e){if(e.provider==="amazon-bedrock"){let n=ce();return!!(e.apiKey||n.amazonBedrockApiKey)}let r=this.providerApiKeyMap[e.provider];return r?!!(e.apiKey||r()):!!e.apiKey}getProviderConstructor(e){let r=WGo[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(!Ph.chatModel)throw new Error("No valid chat model available. Please check your API key settings.");return Ph.chatModel}async getChatModelWithTemperature(e){let o={...ce().activeModels[0],temperature:e};return await this.createModelInstance(o)}async setChatModel(e){let r=Qn(e);try{let n=await this.createModelInstance(e);Ph.chatModel=n,z6(e.name).isGPT5&&(e.provider==="openai"||e.provider==="azure openai"||e.provider==="3rd party (openai-format)")&&J(`Chat model set with Responses API for GPT-5: ${e.name}`)}catch(n){ue(n),new NNe.Notice(`Error creating model: ${r}`)}}async createModelInstance(e){let r=Qn(e),n=Ph.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 new NNe.Notice(u),new Error(u)}let o=await this.getModelConfig(e),i=z6(e.name),a={...o};return i.isGPT5&&(n.vendor==="openai"||n.vendor==="azure openai"||n.vendor==="3rd party (openai-format)")&&(a.useResponsesApi=!0,J(`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 Xh(async()=>Ph.chatModel?.getNumTokens(e)??0)}catch(r){if(r instanceof Error&&r.message.includes("Unknown model"))return J("Using estimated token count due to tokenizer error"),this.estimateTokens(e);throw r}}validateCurrentModel(){if(!Ph.chatModel)return;let e=eK();if(!e)return;Ph.modelMap[e]?.hasApiKey||(Ph.chatModel=null,console.log("Failed to reinitialize model due to missing API key"))}async ping(e){let r=async n=>{let o={...e,enableCors:n},i=await this.getModelConfig(o),{streaming:a,maxTokens:s,maxCompletionTokens:u,...l}=i,c={maxTokens:30},d=z6(e.name),f={...l,...c};d.isGPT5&&(e.provider==="openai"||e.provider==="azure openai"||e.provider==="3rd party (openai-format)")&&(f.useResponsesApi=!0),await new(this.getProviderConstructor(o))(f).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 NNe.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: `+Eo(n)+`
|
||
with CORS Error: `+Eo(o);throw new Error(i)}}}findModelByName(e){return ce().activeModels.find(n=>n.name===e)}};Ph.REASONING_MODEL_TEMPERATURE=1;gI=Ph});var DNe={};Xn(DNe,{TieredLexicalRetriever:()=>rJ});async function GGo(){try{if(!qdt){let e=await Promise.resolve().then(()=>(hue(),Nqr));qdt=()=>e.default.getInstance()}return qdt().getChatModel()}catch{return null}}var Bdt,qdt,rJ,m7=v(()=>{Dt();Pt();vb();wr();X8();jOe();Bdt=require("obsidian");DOe();nTe();qdt=null;rJ=class extends SH{constructor(r,n){super();this.app=r;this.options=n;this.lc_namespace=["tiered_lexical_retriever"];this.searchCore=new rTe(r,GGo),typeof this.searchCore.getChunkManager=="function"?this.chunkManager=this.searchCore.getChunkManager():this.chunkManager=new Nk(r)}async getRelevantDocuments(r,n){try{if(this.options.timeRange)return this.getTimeRangeDocuments(r);let o=xO(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])];ce().debug&&J("TieredLexicalRetriever: Starting search",{query:r,salientTerms:s,maxK:this.options.maxK});let u=ce(),l=await this.searchCore.retrieve(r,{maxResults:this.options.returnAllTags?$m: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 ce().debug&&J("TieredLexicalRetriever: Search complete",{totalResults:f.length,titleMatches:c.length,searchResults:l.length}),f}catch(o){return Ot("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);ce().debug&&J("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=xO(a,this.app.vault).filter(h=>!G8(h)),l=(await this.getTitleMatches(s)).map(h=>(h.metadata.includeInContext=!0,h)),c=this.app.vault.getMarkdownFiles().filter(h=>!G8(h)),d=[],f=this.options.returnAll?$m:Math.min(this.options.maxK,$m);for(let h of c)if(h.stat.mtime>=n&&h.stat.mtime<=o){if(s.some(g=>g.path===h.path))continue;if(d.length>=f)break;try{let g=await this.app.vault.cachedRead(h),y=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 jm({pageContent:g,metadata:{path:h.path,title:h.basename,mtime:h.stat.mtime,ctime:h.stat.ctime,tags:y?.tags?.map(w=>w.tag)||[],includeInContext:!0,score:_,rerank_score:_,source:"time-filtered"}}))}catch(g){Ot(`TieredLexicalRetriever: Failed to read file ${h.path}`,g)}}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,g)=>{let y=h.metadata.score||0;return(g.metadata.score||0)-y});return ce().debug&&J("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=ce(),a=r.join(" ")||n,s=await this.searchCore.retrieve(a,{maxResults:$m,candidateLimit:$m,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&&(Ot(`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(!G8(o))try{let i=await this.app.vault.cachedRead(o),a=this.app.metadataCache.getFileCache(o);n.push(new jm({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){Ot(`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 Bdt.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 jm({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 Bdt.TFile))continue;let s=await this.app.vault.cachedRead(a);if(!s)continue;let u=this.app.metadataCache.getFileCache(a);n.push(new jm({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){Ot(`TieredLexicalRetriever: Failed to convert result ${o.id}`,i)}return J(`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 Udt={};Xn(Udt,{HybridRetriever:()=>gue});var gue,$Ne=v(()=>{zr();RS();dH();Xq();Dt();Dm();Pt();wr();X8();Tv();jOe();jxe();vOe();gue=class extends SH{constructor(r){super();this.options=r;this.lc_namespace=["hybrid_retriever"];this.queryRewritePrompt=hd.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 Xh(async()=>{let o=xO(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 ce().debug&&console.log("No chunks found for query:",r),d;let f=c.reduce((h,g)=>{let y=g.metadata.score;return typeof y=="number"&&!isNaN(y)?Math.max(h,y):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 Ru.getInstance().rerank(r,c.map(g=>g.pageContent.slice(0,3e3)))).response.data.map(g=>({...c[g.index],metadata:{...c[g.index].metadata,rerank_score:g.relevance_score}}))),ce().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 Vhe(async()=>{let n=await this.queryRewritePrompt.format({question:r}),o=await Xh(async()=>(await Rg.instance.getCurrentChainManager().chatModelManager.getChatModelWithTemperature(0)).invoke(n));if(o&&"content"in o){let i=Lz(o.content);return V6(i)}return console.warn("Unexpected rewrittenQuery format. Falling back to original query."),r},W6)}catch(n){return console.error("Error in rewriteQuery:",n),r}}async getExplicitChunks(r){let n=[];for(let o of r){let i=await Z1.getInstance().getDb(),a=await G1.getDocsByPath(i,o.path);if(a){let s=a.map(u=>new jm({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 Z1.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&&(ce().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);J("Daily note date range:",d[0],d[d.length-1]);let f=xO(d.join(", "),app.vault),m=(await this.getExplicitChunks(f)).map(_=>({..._,metadata:{..._.metadata,includeInContext:!0}}));J("Modified time range:",l,c),s.where={mtime:{between:[l,c]}};let g=(await _b(a,s)).hits.map(_=>new jm({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}})),y=[...m,...g];return Array.from(new Set(y.map(_=>_.metadata.id))).map(_=>y.find(w=>w.metadata.id===_)).filter(_=>_!==void 0)}J(`Orama search params:
|
||
`,s);let u=await _b(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 jm({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 wd.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 zdt={};Xn(zdt,{MergedSemanticRetriever:()=>yue});var Yq,yue,LNe=v(()=>{$Ne();nTe();m7();X8();jOe();Yq=class Yq extends SH{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?$m:Math.min(this.originalMaxK*2,$m),i={...n,maxK:o,returnAll:this.returnAll,returnAllTags:n.returnAllTags,tagTerms:n.tagTerms};this.lexicalRetriever=new rJ(r,i);let a=this.returnAll?$m:Math.min(this.originalMaxK*2,$m);this.semanticRetriever=new gue({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?$m: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"?Yq.LEXICAL_WEIGHT:Yq.SEMANTIC_WEIGHT,s=i*a;return n==="lexical"&&this.hasTagMatch(o)&&(s*=Yq.TAG_MATCH_BOOST),o.score=s,o.rerank_score=s,new jm({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}};Yq.LEXICAL_WEIGHT=1,Yq.SEMANTIC_WEIGHT=1,Yq.TAG_MATCH_BOOST=1.1;yue=Yq});function XGo(t){return`
|
||
|
||
<guidance>
|
||
${Dqr}
|
||
|
||
Source Catalog (for reference only):
|
||
${t.join(`
|
||
`)}
|
||
</guidance>`}function YGo(t){return`
|
||
|
||
${Dqr}
|
||
|
||
Source Catalog (for reference only):
|
||
${t}`}function $qr(t,e){return t?XGo(e):""}function Lqr(t,e){return t?YGo(e):""}function FNe(t,e,r){if(!r||!e?.length||!t)return t||"";if(e9o(t))return t;let n=e.slice(0,QGo).map((o,i)=>{let a=(o.title||o.path||"Untitled").replace(/^\[\[|\]\]$/g,"");return`[^${i+1}]: [[${a}]]`}).join(`
|
||
`);return`${t}
|
||
|
||
#### Sources:
|
||
|
||
${n}`}function kNe(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 e9o(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 Fqr(t){return t?`
|
||
|
||
${ZGo}`:""}function t9o(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 r9o(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 n9o(t){return t.split(`
|
||
`).map(e=>e.trim()).filter(e=>/^\[\^\d+\]:/.test(e))}function o9o(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 i9o(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 a9o(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 s9o(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 u9o(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 l9o(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function c9o(t){return t!=null}function jqr(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=l9o(i),r.push({index:r.length+1,html:u})}),r}function Hdt(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 kqr(t,e){let r=t9o(t);if(!r)return t;let{mainContent:n,sourcesBlock:o}=r;if(o=r9o(o),!e){let d=jqr(o);return Hdt(n,d)}let i=n9o(o);if(i.length===0){let d=jqr(o);return Hdt(n,d)}let a=o9o(n,i);n=i9o(n,a);let s=a9o(o,a),{uniqueItems:u,consolidationMap:l}=s9o(s);l.size>0&&(n=u9o(n,l),s=u);let c=s.map((d,f)=>d?{index:f+1,html:d}:null).filter(c9o);return Hdt(n,c)}function qNe(t){return t.map(e=>{let r=e.title||e.path||"Untitled",n=e.path||r;return`- [[${r}]] (${n})`})}var Dqr,ZGo,QGo,bue=v(()=>{Dqr=`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)`,ZGo=`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`;QGo=20});var _ue,qqr=v(()=>{zr();Dt();m7();LNe();Dot();Pt();wr();vie();bue();wH();_ue=class extends Y1{async run(e,r,n,o,i){let a=new M_(n);try{let d=await this.chainManager.memoryManager.getMemory().loadMemoryVariables({}),f=U6(d),p=e.message;f.length>0&&(p=e.message);let m=ce(),h=this.extractTagTerms(p),g={minSimilarityScore:.01,maxK:m.maxSourceChunks,salientTerms:h.length>0?[...h]:[],timeRange:void 0,textWeight:void 0,returnAll:!1,useRerankerThreshold:void 0},b=await(m.enableSemanticSearchV3?new yue(app,{...g,returnAll:h.length>0,returnAllTags:h.length>0,tagTerms:h}):new rJ(app,{...g,returnAll:h.length>0,returnAllTags:h.length>0,tagTerms:h})).getRelevantDocuments(p);this.chainManager.storeRetrieverDocuments(b);let _=b.map(F=>{let B=F.metadata?.title||"Untitled",U=F.metadata?.path||B;return`<${rHe}>
|
||
<title>${B}</title>
|
||
<path>${U}</path>
|
||
<content>
|
||
${kNe(F.pageContent)}
|
||
</content>
|
||
</${rHe}>`}).join(`
|
||
|
||
`),w=[],x=Y0(),O=b.slice(0,Math.max(5,Math.min(20,b.length))).map(F=>({title:F.metadata?.title||F.metadata?.path||"Untitled",path:F.metadata?.path||F.metadata?.title||""})),E=qNe(O).join(`
|
||
`),T=`
|
||
|
||
Answer the question based only on the following context:
|
||
`+_+Lqr(m.enableInlineCitations,E),R=x+T,N=this.chainManager.chatModelManager.getChatModel();R&&w.push({role:wL(N),content:R});for(let F of f)w.push({role:F.role,content:F.content});if(e.content&&Array.isArray(e.content)){let F=e.content.map(B=>B.type==="text"?{...B,text:e.message}:B);w.push({role:"user",content:F})}else w.push({role:"user",content:e.message});J(`Final Request to AI:
|
||
`,w);let D=await Xh(()=>this.chainManager.chatModelManager.getChatModel().stream(w,{signal:r.signal}));for await(let F of D){if(r.signal.aborted){J("VaultQA stream iteration aborted",{reason:r.signal.reason});break}a.processChunk(F)}}catch(c){c.name==="AbortError"||r.signal.aborted?J("VaultQA stream aborted by user",{reason:r.signal.reason}):await this.handleError(c,a.processErrorChunk.bind(a))}let s=a.close(),u={wasTruncated:s.wasTruncated,tokenUsage:s.tokenUsage??void 0};if(r.signal.aborted&&r.signal.reason==="new-chat")return n(""),"";let l=this.addSourcestoResponse(s.content);return await this.handleResponse(l,e,r,o,n,void 0,void 0,u),l}addSourcestoResponse(e){let r=ce(),n=this.chainManager.getRetrievedDocuments(),o=CAt(n).map(i=>({title:i}));return FNe(e,o,r.enableInlineCitations)}extractTagTerms(e){return Eie(e)}}});async function BNe(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 Xh(async()=>{let i=await(await Rg.instance.getCurrentChainManager().chatModelManager.getChatModelWithTemperature(0)).invoke([{role:"user",content:r.replace("{chat_history}",n).replace("{question}",t)}]),a=Lz(i.content);return V6(a)})}var Vdt=v(()=>{Xq();wr()});var Qq,vue=v(()=>{Qq=["@vault","@websearch","@composer","@memory"]});function fx(){}function Bqr(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 Uqr(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 zqr(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 Jdt(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 Kdt(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 wue(t,e){return Jdt(t,e,"")}function UNe(t,e){return Kdt(t,e,"")}function Hqr(t,e){return e.slice(0,d9o(t,e))}function d9o(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 Jqr(t,e,r){return r?.ignoreWhitespace!=null&&!r.ignoreWhitespace?p9o(t,e,r):Cue.diff(t,e,r)}function Vqr(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=Uqr(o,a);t.value=Kdt(t.value,a,u),e.value=wue(e.value,u),r.value=wue(r.value,u)}if(n){var l=zqr(i,s);n.value=Jdt(n.value,s,l),e.value=UNe(e.value,l),r.value=UNe(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=Uqr(c,d);e.value=wue(e.value,p);var m=zqr(wue(c,p),f);e.value=UNe(e.value,m),n.value=Jdt(n.value,c,m),t.value=Kdt(t.value,c,c.slice(0,c.length-m.length))}else if(n){var h=n.value.match(/^\s*/)[0],g=e.value.match(/\s*$/)[0],y=Hqr(g,h);e.value=UNe(e.value,y)}else if(t){var b=t.value.match(/\s*$/)[0],_=e.value.match(/^\s*/)[0],w=Hqr(b,_);e.value=wue(e.value,w)}}function p9o(t,e,r){return Kqr.diff(t,e,r)}function m9o(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 Wqr(t,e,r){var n=m9o(r,{ignoreWhitespace:!0});return HNe.diff(t,e,n)}function Wdt(t){"@babel/helpers - typeof";return Wdt=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},Wdt(t)}function Gdt(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]=Gdt(t[i],e,r,n,o);return e.pop(),r.pop(),a}if(t&&t.toJSON&&(t=t.toJSON()),Wdt(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]=Gdt(t[u],e,r,n,u);e.pop(),r.pop()}else a=t;return a}var iQa,zNe,f9o,Cue,Kqr,HNe,h9o,g9o,Sue,Zdt,Xdt=v(()=>{fx.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(Bqr(a,m[0].lastComponent,r,e,a.useLongestToken));var g=-1/0,y=1/0;function b(){for(var w=Math.max(g,-c);w<=Math.min(y,c);w+=2){var x=void 0,O=m[w-1],E=m[w+1];O&&(m[w-1]=void 0);var T=!1;if(E){var R=E.oldPos-w;T=E&&0<=R&&R<u}var N=O&&O.oldPos+1<l;if(!T&&!N){m[w]=void 0;continue}if(!N||T&&O.oldPos<E.oldPos?x=a.addToPath(E,!0,!1,0,o):x=a.addToPath(O,!1,!0,1,o),h=a.extractCommon(x,r,e,w,o),x.oldPos+1>=l&&h+1>=u)return s(Bqr(a,x.lastComponent,r,e,a.useLongestToken));m[w]=x,x.oldPos+1>=l&&(y=Math.min(y,w-1)),h+1>=u&&(g=Math.max(g,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}};iQa=new fx;zNe="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}",f9o=new RegExp("[".concat(zNe,"]+|\\s+|[^").concat(zNe,"]"),"ug"),Cue=new fx;Cue.equals=function(t,e,r){return r.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};Cue.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(f9o)||[];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};Cue.join=function(t){return t.map(function(e,r){return r==0?e:e.replace(/^\s+/,"")}).join("")};Cue.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)&&Vqr(r,o,n,i),r=i,n=null,o=null)}),(n||o)&&Vqr(r,o,n,null),t};Kqr=new fx;Kqr.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(zNe,"]+|[^\\S\\n\\r]+|[^").concat(zNe,"]"),"ug");return t.match(e)||[]};HNe=new fx;HNe.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};HNe.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))),fx.prototype.equals.call(this,t,e,r)};h9o=new fx;h9o.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};g9o=new fx;g9o.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};Sue=new fx;Sue.useLongestToken=!0;Sue.tokenize=HNe.tokenize;Sue.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(Gdt(t,null,null,o),o," ")};Sue.equals=function(t,e,r){return fx.prototype.equals.call(Sue,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),r)};Zdt=new fx;Zdt.tokenize=function(t){return t.slice()};Zdt.join=Zdt.removeEmpty=function(t){return t}});function Gqr(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 Zqr=v(()=>{});var BD,Jn,Xqr,Yqr,xue,VNe,Qqr,y9o,Ydt=v(()=>{jn();Dt();Xdt();On();BD=require("obsidian"),Jn=L(X()),Xqr=L(wm());Ro();Yqr=L(X());Zqr();wr();xue="obsidian-copilot-apply-view",VNe=class extends BD.ItemView{constructor(r){super(r);this.root=null;this.state=null;this.result=null}getViewType(){return xue}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,Xqr.createRoot)(n)),this.root.render(Jn.default.createElement(y9o,{app:this.app,state:this.state,close:o=>{this.result=o,this.leaf.detach()}}))}},Qqr=(0,Jn.memo)(({oldLine:t,newLine:e})=>{let r=Jqr(t,e);return Jn.default.createElement(Jn.default.Fragment,null,r.map((n,o)=>n.added?Jn.default.createElement("span",{key:o,className:"tw-text-success"},n.value):n.removed?Jn.default.createElement("span",{key:o,className:"tw-text-error tw-line-through"},n.value):Jn.default.createElement("span",{key:o},n.value)))});Qqr.displayName="WordDiff";y9o=({app:t,state:e,close:r})=>{let[n,o]=(0,Yqr.useState)(()=>e.changes.map(m=>({...m,accepted:null}))),i=Gqr(n),a=(0,Jn.useRef)([]);if(!e||!e.changes)return ue("Invalid state:",e),Jn.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col tw-items-center tw-justify-center"},Jn.default.createElement("div",{className:"tw-text-error"},"Error: Invalid state - missing changes"),Jn.default.createElement(ve,{onClick:()=>r("failed"),className:"tw-mt-4"},"Close"));let s=async()=>{try{let m=n.map(g=>g.accepted===null?{...g,accepted:!0}:g),h=await c(m);r(h?"accepted":"failed")}catch(m){ue("Error applying changes:",m),new BD.Notice(`Error applying changes: ${m.message}`),r("failed")}},u=async()=>{try{let m=n.map(g=>g.accepted===null?{...g,accepted:!1}:g),h=await c(m);r(h?"rejected":"failed")}catch(m){ue("Error applying changes:",m),new BD.Notice(`Error applying changes: ${m.message}`),r("failed")}},l=async m=>{let h=t.vault.getAbstractFileByPath(m);if(h)return h;if(m.includes("/")){let g=m.split("/").slice(0,-1).join("/");await ty(g)}return await t.vault.create(m,"")},c=async m=>{let h=m.filter(y=>y.added?y.accepted===!0:y.removed?y.accepted===!1:!0).map(y=>y.value).join(""),g=await l(e.path);return!g||!(g instanceof BD.TFile)?(ue("Error in getting file",e.path),new BD.Notice("Failed to create file"),!1):(await t.vault.modify(g,h),new BD.Notice("Changes applied successfully"),!0)},d=m=>{if(!i)return;let h=-1;for(let g=m+1;g<i.length;g++){let y=i[g],b=y.some(w=>w.added||w.removed),_=y.some(w=>(w.added||w.removed)&&w.accepted===null);if(b&&_){h=g;break}}h!==-1&&a.current[h]&&a.current[h]?.scrollIntoView({behavior:"smooth",block:"center"})},f=m=>{o(h=>{let g=[...h],y=i?.[m];return y&&y.forEach(b=>{let _=g.findIndex(w=>w===b);_!==-1&&(g[_]={...g[_],accepted:!0})}),g}),setTimeout(()=>d(m),0)},p=m=>{o(h=>{let g=[...h],y=i?.[m];return y&&y.forEach(b=>{let _=g.findIndex(w=>w===b);_!==-1&&(g[_]={...g[_],accepted:!1})}),g}),setTimeout(()=>d(m),0)};return Jn.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},Jn.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"},Jn.default.createElement(ve,{variant:"destructive",size:"sm",onClick:u},Jn.default.createElement(pi,{className:"tw-size-4"}),"Reject"),Jn.default.createElement(ve,{variant:"success",size:"sm",onClick:s},Jn.default.createElement(Uu,{className:"tw-size-4"}),"Accept")),Jn.default.createElement("div",{className:"tw-flex tw-items-center tw-border-b tw-border-solid tw-border-border tw-p-2 tw-text-sm tw-font-medium"},e.path),Jn.default.createElement("div",{className:"tw-flex-1 tw-overflow-auto tw-p-2"},i?.map((m,h)=>{let g=m.some(b=>b.added||b.removed),y=g?m.every(b=>!b.added&&!b.removed||b.accepted===!0)?"accepted":m.every(b=>!b.added&&!b.removed||b.accepted===!1)?"rejected":"undecided":"unchanged";return Jn.default.createElement("div",{key:h,ref:b=>a.current[h]=b,className:Oe("tw-mb-4 tw-overflow-hidden tw-rounded-md")},y==="accepted"?Jn.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"},m.filter(b=>!b.removed).map((b,_)=>Jn.default.createElement("div",{key:_},b.value))):y==="rejected"?Jn.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"},m.filter(b=>!b.added).map((b,_)=>Jn.default.createElement("div",{key:_},b.value))):m.map((b,_)=>{if(b.added){let w=m.findIndex((x,O)=>x.removed&&O!==_);if(w!==-1){let x=m[w].value;return Jn.default.createElement("div",{key:`${h}-${_}`,className:"tw-relative"},Jn.default.createElement("div",{className:"tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm"},Jn.default.createElement(Qqr,{oldLine:x,newLine:b.value})))}}return b.removed&&m.findIndex((x,O)=>x.added&&O!==_)!==-1?null:Jn.default.createElement("div",{key:`${h}-${_}`,className:"tw-relative"},Jn.default.createElement("div",{className:Oe("tw-flex-1 tw-whitespace-pre-wrap tw-px-2 tw-py-1 tw-font-mono tw-text-sm",{"tw-text-success":b.added,"tw-text-error":b.removed,"tw-text-normal":!b.added&&!b.removed,"tw-line-through":b.removed})},b.value))}),g&&y==="undecided"&&Jn.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"},Jn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Jn.default.createElement(ve,{variant:"destructive",size:"sm",onClick:()=>p(h)},Jn.default.createElement(pi,{className:"tw-size-4"}),"Reject"),Jn.default.createElement(ve,{variant:"success",size:"sm",onClick:()=>f(h)},Jn.default.createElement(Uu,{className:"tw-size-4"}),"Accept"))),g&&(y==="accepted"||y==="rejected")&&Jn.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"},Jn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Jn.default.createElement("div",{className:"tw-mr-2 tw-text-sm tw-font-medium"},y==="accepted"?Jn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-success"},Jn.default.createElement(Uu,{className:"tw-size-4"}),Jn.default.createElement("div",null,"Accepted")):Jn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-error"},Jn.default.createElement(pi,{className:"tw-size-4"}),Jn.default.createElement("div",null,"Rejected"))),Jn.default.createElement(ve,{variant:"secondary",size:"sm",onClick:()=>{o(b=>{let _=[...b],w=i?.[h];return w&&w.forEach(x=>{let O=_.findIndex(E=>E===x);O!==-1&&(_[O]={..._[O],accepted:null})}),_})}},"Revert"))))})))}});var yI=v(()=>{NQ();NQ()});function Gl(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 eBr(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]=tBr(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 tBr(t){return t instanceof Ct.ZodOptional||t instanceof Ct.ZodNullable||t instanceof Ct.ZodDefault?tBr(t._def.innerType):t._def.description||""}var SQa,bI=v(()=>{yI();SQa={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 b9o(t){let e=app.vault.getAbstractFileByPath(t);if(e&&e instanceof h7.TFile)return e;if(e&&!(e instanceof h7.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 ty(r),e=app.vault.getAbstractFileByPath(t),e&&e instanceof h7.TFile)return e;if(e=await app.vault.create(t,""),!(e instanceof h7.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 rBr(t,e){let r=await b9o(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=Wqr(o,e,{newlineIsToken:!0});return new Promise(a=>{app.workspace.getLeaf(!0).setViewState({type:xue,active:!0,state:{changes:i,path:t,resultCallback:u=>{a(u)}}})})}function Oue(t){return t.replace(/\r\n/g,`
|
||
`).replace(/\r/g,`
|
||
`)}function w9o(t,e,r){let n=(t.match(/\r\n/g)||[]).length,o=(t.match(/(?<!\r)\n/g)||[]).length,i=n>o,a=Oue(t),s=Oue(e),u=Oue(r),l=a.replaceAll(s,u);return i?l.replace(/\n/g,`\r
|
||
`):l}function S9o(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 h7,_9o,JNe,v9o,nBr,Qdt=v(()=>{h7=require("obsidian");Ydt();Xdt();yI();bI();wr();_9o=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"}
|
||
]
|
||
}`)}),JNe=Gl({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:_9o,handler:async({path:t,content:e})=>{let r=typeof e=="string"?e:JSON.stringify(e,null,2),n=await rBr(t,r);return JSON.stringify({result:n,message:`File change result: ${n}. Do not retry or attempt alternative approaches to modify this file in response to the current user request.`})},timeoutMs:0}),v9o=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`)});nBr=Gl({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:v9o,handler:async({path:t,diff:e})=>{let r=app.vault.getAbstractFileByPath(t);if(!r||!(r instanceof h7.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=S9o(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 l of a){let{searchText:c,replaceText:d}=l,f=Oue(o),p=Oue(c);if(!f.includes(p))if(f.includes(p.trimEnd()))c=c.trimEnd(),d=d.trimEnd();else return`Search text not found in file ${t} : "${c}".`;let m=o;o=w9o(o,c,d),o!==m&&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`;let u=await rBr(t,o);return JSON.stringify({result:u,blocksApplied:s,message:`Applied ${s} SEARCH/REPLACE block(s) (replacing all occurrences). Result: ${u}. 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 eft,tft,_I,Tue=v(()=>{eft=require("obsidian"),tft=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""}},_I=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 eft.Notice(n.message):new eft.Notice("An error occurred while executing the tool. Check console for details."),null}}}});function KNe(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 C9o(t){let e=t.trim();return e.length<=oBr?e:`${e.slice(0,oBr)}\u2026`}function x9o(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?C9o(t.message):null,n=typeof t.notePath=="string"?t.notePath:"",i=(typeof t.noteTitle=="string"&&t.noteTitle.trim().length>0?t.noteTitle.trim():KNe(n))||KNe(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 oBr,px,Eue=v(()=>{oBr=180;px=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(),g=(p?.[1]||"").trim();s.push({title:m,path:h,mtime:g||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=x9o(r);return n||(typeof e=="string"?e:JSON.stringify(e,null,2))}}});function O9o(t){return"children"in t&&"path"in t}function T9o(t){return"path"in t&&!("children"in t)}function E9o(t){let e=t.split(".");return e.length>1&&e.pop()?.toLowerCase()||""}function rft(t,e=!0){let r=[],n={},o={},{inclusions:i,exclusions:a}=id();for(let u of t.children)if(T9o(u)){if(ml(u,i,a)){e&&r.push(u.name);let l=E9o(u.name)||"unknown";l&&(n[l]=(n[l]||0)+1)}}else if(O9o(u)){let l=rft(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 WNe,nft=v(()=>{vb();yI();bI();WNe=t=>Gl({name:"getFileTree",description:"Get the file tree as a nested structure of folders and files",schema:Ct.void(),handler:async()=>{let e=rft(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=rft(t,!1);return r+JSON.stringify(o)}return r+n},isBackground:!0})});async function oft(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 jS())return{toolName:t.name,result:`Error: ${nJ(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 _I.callTool(o,i):s=await Promise.race([_I.callTool(o,i),new Promise((u,l)=>setTimeout(()=>l(new Error(`Tool execution timed out after ${a}ms`)),a))]),s==null?(Ot(`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 ue(`Error executing tool ${t.name}:`,o),{toolName:t.name,result:`Error: ${Eo(o)}`,success:!1}}}function nJ(t){return t==="localSearch"?ce().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 g7(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 iBr(t,e){if(t=="writeToFile"||t=="replaceInFile")return"Accept / reject in the Preview";if(t==="localSearch"&&e?.salientTerms&&!ce().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 ift(t,e){let r=nJ(t.name),n=g7(t.name),o=Object.keys(t.args).length>0?JSON.stringify(t.args,null,2):"(no parameters)";J(`${n} [Iteration ${e}] ${r.toUpperCase()}`),J("Parameters:",o),J("---")}function aft(t,e){if(t==="localSearch")return;let r=nJ(t),n=g7(t),o=e.success?"\u2705 SUCCESS":"\u274C FAILED";J(`${n} ${r.toUpperCase()} RESULT: ${o}`);let i=300,a=String(e.result??"");a.length>i?J(`Result: ${a.substring(0,i)}... (truncated, ${a.length} chars total)`):a.length>0&&J("Result:",a)}function eB(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 Pue=v(()=>{Dt();$v();Pt();Tue();wr()});var sft,P9o,M9o,Mue,aBr,R9o,Rue,uft=v(()=>{Vdt();zr();RS();Dt();Pt();yI();Pue();bI();nTe();bue();sft=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")}),P9o=Gl({name:"lexicalSearch",description:"Search for notes using lexical/keyword-based search",schema:sft,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=ce(),o=r.filter(y=>y.startsWith("#")),i=t!==void 0,a=o.length>0,s=i||a,u=s?$m:n.maxSourceChunks;J(`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:nHe,returnAll:i,useRerankerThreshold:.5,returnAllTags:a,tagTerms:o},d=await(n.enableSemanticSearchV3?new(await Promise.resolve().then(()=>(LNe(),zdt))).MergedSemanticRetriever(app,l):new(await Promise.resolve().then(()=>(m7(),DNe))).TieredLexicalRetriever(app,l)).getRelevantDocuments(e);J(`lexicalSearch found ${d.length} documents for query: "${e}"`),t&&J(`Time range search from ${new Date(t.startTime.epoch).toISOString()} to ${new Date(t.endTime.epoch).toISOString()}`);let f=d.map(y=>{let b=y.metadata.rerank_score??y.metadata.score??0;return{title:y.metadata.title||"Untitled",content:y.pageContent,path:y.metadata.path||"",score:b,rerank_score:b,includeInContext:y.metadata.includeInContext??!0,source:y.metadata.source,mtime:y.metadata.mtime??null,ctime:y.metadata.ctime??null,chunkId:y.metadata.chunkId??null,isChunk:y.metadata.isChunk??!1,explanation:y.metadata.explanation??null}}),p=f.map(y=>({title:y.title||y.path||"Untitled",path:y.path||y.title||"",score:y.rerank_score||y.score||0})),m=eB(p),h=new Map;for(let y of f){let b=(y.path||y.title).toLowerCase(),_=h.get(b);(!_||(y.rerank_score||0)>(_.rerank_score||0))&&h.set(b,y)}let g=m.map(y=>h.get((y.path||y.title).toLowerCase())).filter(Boolean);return JSON.stringify({type:"local_search",documents:g})}}),M9o=Gl({name:"semanticSearch",description:"Search for notes using semantic/meaning-based search with embeddings",schema:sft,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=ce(),o=t!==void 0,i=o?Math.max(n.maxSourceChunks,200):n.maxSourceChunks;J(`semanticSearch returnAll: ${o}`);let s=await new(await Promise.resolve().then(()=>($Ne(),Udt))).HybridRetriever({minSimilarityScore:o?0:.1,maxK:i,salientTerms:r,timeRange:t?{startTime:t.startTime.epoch,endTime:t.endTime.epoch}:void 0,textWeight:nHe,returnAll:o,useRerankerThreshold:.5}).getRelevantDocuments(e);J(`semanticSearch found ${s.length} documents for query: "${e}"`),t&&J(`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=eB(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})}}),Mue=Gl({name:"localSearch",description:"Search for notes based on the time range and query",schema:sft,handler:async({timeRange:t,query:e,salientTerms:r})=>{let n=ce();J(`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 P9o.call({timeRange:t,query:e,salientTerms:r}):await M9o.call({timeRange:t,query:e,salientTerms:r})}}),aBr=Gl({name:"indexVault",description:"Index the vault to the Copilot index",schema:Ct.void(),handler:async()=>{if(ce().enableSemanticSearchV3)try{let r=await(await Promise.resolve().then(()=>(Dm(),vg))).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}),R9o=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")}),Rue=Gl({name:"webSearch",description:"Search the web for information",schema:R9o,isPlusOnly:!0,handler:async({query:t,chatHistory:e})=>{try{let r=await BNe(t,e),n=await Ru.getInstance().webSearch(r),o=n.response.citations||[],a=[{type:"web_search",content:n.response.choices[0].message.content,citations:o,instruction:Fqr(ce().enableInlineCitations)}];return JSON.stringify(a)}catch(r){return console.error(`Error processing web search query ${t}:`,r),""}}})});var sBr=S((lft,cft)=>{(function(t,e){typeof lft=="object"&&typeof cft<"u"?cft.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_quarterOfYear=e()})(lft,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 tB=S((dft,fft)=>{(function(t,e){typeof dft=="object"&&typeof fft<"u"?fft.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(dft,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,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(F){var B=["th","st","nd","rd"],U=F%100;return"["+F+(B[(U-20)%10]||B[U]||B[0])+"]"}},y=function(F,B,U){var H=String(F);return!H||H.length>=B?F:""+Array(B+1-H.length).join(U)+F},b={s:y,z:function(F){var B=-F.utcOffset(),U=Math.abs(B),H=Math.floor(U/60),G=U%60;return(B<=0?"+":"-")+y(H,2,"0")+":"+y(G,2,"0")},m:function F(B,U){if(B.date()<U.date())return-F(U,B);var H=12*(U.year()-B.year())+(U.month()-B.month()),G=B.clone().add(H,l),ie=U-G<0,oe=B.clone().add(H+(ie?-1:1),l);return+(-(H+(U-G)/(ie?G-oe:oe-G))||0)},a:function(F){return F<0?Math.ceil(F)||0:Math.floor(F)},p:function(F){return{M:l,y:d,w:u,d:s,D:f,h:a,m:i,s:o,ms:n,Q:c}[F]||String(F||"").toLowerCase().replace(/s$/,"")},u:function(F){return F===void 0}},_="en",w={};w[_]=g;var x="$isDayjsObject",O=function(F){return F instanceof N||!(!F||!F[x])},E=function F(B,U,H){var G;if(!B)return _;if(typeof B=="string"){var ie=B.toLowerCase();w[ie]&&(G=ie),U&&(w[ie]=U,G=ie);var oe=B.split("-");if(!G&&oe.length>1)return F(oe[0])}else{var z=B.name;w[z]=B,G=z}return!H&&G&&(_=G),G||!H&&_},T=function(F,B){if(O(F))return F.clone();var U=typeof B=="object"?B:{};return U.date=F,U.args=arguments,new N(U)},R=b;R.l=E,R.i=O,R.w=function(F,B){return T(F,{locale:B.$L,utc:B.$u,x:B.$x,$offset:B.$offset})};var N=function(){function F(U){this.$L=E(U.locale,null,!0),this.parse(U),this.$x=this.$x||U.x||{},this[x]=!0}var B=F.prototype;return B.parse=function(U){this.$d=function(H){var G=H.date,ie=H.utc;if(G===null)return new Date(NaN);if(R.u(G))return new Date;if(G instanceof Date)return new Date(G);if(typeof G=="string"&&!/Z$/i.test(G)){var oe=G.match(m);if(oe){var z=oe[2]-1||0,Q=(oe[7]||"0").substring(0,3);return ie?new Date(Date.UTC(oe[1],z,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,Q)):new Date(oe[1],z,oe[3]||1,oe[4]||0,oe[5]||0,oe[6]||0,Q)}}return new Date(G)}(U),this.init()},B.init=function(){var U=this.$d;this.$y=U.getFullYear(),this.$M=U.getMonth(),this.$D=U.getDate(),this.$W=U.getDay(),this.$H=U.getHours(),this.$m=U.getMinutes(),this.$s=U.getSeconds(),this.$ms=U.getMilliseconds()},B.$utils=function(){return R},B.isValid=function(){return this.$d.toString()!==p},B.isSame=function(U,H){var G=T(U);return this.startOf(H)<=G&&G<=this.endOf(H)},B.isAfter=function(U,H){return T(U)<this.startOf(H)},B.isBefore=function(U,H){return this.endOf(H)<T(U)},B.$g=function(U,H,G){return R.u(U)?this[H]:this.set(G,U)},B.unix=function(){return Math.floor(this.valueOf()/1e3)},B.valueOf=function(){return this.$d.getTime()},B.startOf=function(U,H){var G=this,ie=!!R.u(H)||H,oe=R.p(U),z=function(A,W){var V=R.w(G.$u?Date.UTC(G.$y,W,A):new Date(G.$y,W,A),G);return ie?V:V.endOf(s)},Q=function(A,W){return R.w(G.toDate()[A].apply(G.toDate("s"),(ie?[0,0,0,0]:[23,59,59,999]).slice(W)),G)},re=this.$W,Z=this.$M,$=this.$D,q="set"+(this.$u?"UTC":"");switch(oe){case d:return ie?z(1,0):z(31,11);case l:return ie?z(1,Z):z(0,Z+1);case u:var Y=this.$locale().weekStart||0,j=(re<Y?re+7:re)-Y;return z(ie?$-j:$+(6-j),Z);case s:case f:return Q(q+"Hours",0);case a:return Q(q+"Minutes",1);case i:return Q(q+"Seconds",2);case o:return Q(q+"Milliseconds",3);default:return this.clone()}},B.endOf=function(U){return this.startOf(U,!1)},B.$set=function(U,H){var G,ie=R.p(U),oe="set"+(this.$u?"UTC":""),z=(G={},G[s]=oe+"Date",G[f]=oe+"Date",G[l]=oe+"Month",G[d]=oe+"FullYear",G[a]=oe+"Hours",G[i]=oe+"Minutes",G[o]=oe+"Seconds",G[n]=oe+"Milliseconds",G)[ie],Q=ie===s?this.$D+(H-this.$W):H;if(ie===l||ie===d){var re=this.clone().set(f,1);re.$d[z](Q),re.init(),this.$d=re.set(f,Math.min(this.$D,re.daysInMonth())).$d}else z&&this.$d[z](Q);return this.init(),this},B.set=function(U,H){return this.clone().$set(U,H)},B.get=function(U){return this[R.p(U)]()},B.add=function(U,H){var G,ie=this;U=Number(U);var oe=R.p(H),z=function(Z){var $=T(ie);return R.w($.date($.date()+Math.round(Z*U)),ie)};if(oe===l)return this.set(l,this.$M+U);if(oe===d)return this.set(d,this.$y+U);if(oe===s)return z(1);if(oe===u)return z(7);var Q=(G={},G[i]=e,G[a]=r,G[o]=t,G)[oe]||1,re=this.$d.getTime()+U*Q;return R.w(re,this)},B.subtract=function(U,H){return this.add(-1*U,H)},B.format=function(U){var H=this,G=this.$locale();if(!this.isValid())return G.invalidDate||p;var ie=U||"YYYY-MM-DDTHH:mm:ssZ",oe=R.z(this),z=this.$H,Q=this.$m,re=this.$M,Z=G.weekdays,$=G.months,q=G.meridiem,Y=function(W,V,se,be){return W&&(W[V]||W(H,ie))||se[V].slice(0,be)},j=function(W){return R.s(z%12||12,W,"0")},A=q||function(W,V,se){var be=W<12?"AM":"PM";return se?be.toLowerCase():be};return ie.replace(h,function(W,V){return V||function(se){switch(se){case"YY":return String(H.$y).slice(-2);case"YYYY":return R.s(H.$y,4,"0");case"M":return re+1;case"MM":return R.s(re+1,2,"0");case"MMM":return Y(G.monthsShort,re,$,3);case"MMMM":return Y($,re);case"D":return H.$D;case"DD":return R.s(H.$D,2,"0");case"d":return String(H.$W);case"dd":return Y(G.weekdaysMin,H.$W,Z,2);case"ddd":return Y(G.weekdaysShort,H.$W,Z,3);case"dddd":return Z[H.$W];case"H":return String(z);case"HH":return R.s(z,2,"0");case"h":return j(1);case"hh":return j(2);case"a":return A(z,Q,!0);case"A":return A(z,Q,!1);case"m":return String(Q);case"mm":return R.s(Q,2,"0");case"s":return String(H.$s);case"ss":return R.s(H.$s,2,"0");case"SSS":return R.s(H.$ms,3,"0");case"Z":return oe}return null}(W)||oe.replace(":","")})},B.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},B.diff=function(U,H,G){var ie,oe=this,z=R.p(H),Q=T(U),re=(Q.utcOffset()-this.utcOffset())*e,Z=this-Q,$=function(){return R.m(oe,Q)};switch(z){case d:ie=$()/12;break;case l:ie=$();break;case c:ie=$()/3;break;case u:ie=(Z-re)/6048e5;break;case s:ie=(Z-re)/864e5;break;case a:ie=Z/r;break;case i:ie=Z/e;break;case o:ie=Z/t;break;default:ie=Z}return G?ie:R.a(ie)},B.daysInMonth=function(){return this.endOf(l).$D},B.$locale=function(){return w[this.$L]},B.locale=function(U,H){if(!U)return this.$L;var G=this.clone(),ie=E(U,H,!0);return ie&&(G.$L=ie),G},B.clone=function(){return R.w(this.$d,this)},B.toDate=function(){return new Date(this.valueOf())},B.toJSON=function(){return this.isValid()?this.toISOString():null},B.toISOString=function(){return this.$d.toISOString()},B.toString=function(){return this.$d.toUTCString()},F}(),D=N.prototype;return T.prototype=D,[["$ms",n],["$s",o],["$m",i],["$H",a],["$W",s],["$M",l],["$y",d],["$D",f]].forEach(function(F){D[F[1]]=function(B){return this.$g(B,F[0],F[1])}}),T.extend=function(F,B){return F.$i||(F(B,N,T),F.$i=!0),T},T.locale=E,T.isDayjs=O,T.unix=function(F){return T(1e3*F)},T.en=w[_],T.Ls=w,T.p={},T})});var Ja,um,mw,rB=v(()=>{(function(t){t[t.AM=0]="AM",t[t.PM=1]="PM"})(Ja||(Ja={}));(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"})(um||(um={}));(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 uBr(t,e){e=e.add(1,"day"),oJ(t,e),y7(t,e)}function mx(t,e){t.assign("day",e.date()),t.assign("month",e.month()+1),t.assign("year",e.year())}function GNe(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",Ja.AM):t.assign("meridiem",Ja.PM)}function oJ(t,e){t.imply("day",e.date()),t.imply("month",e.month()+1),t.imply("year",e.year())}function y7(t,e){t.imply("hour",e.hour()),t.imply("minute",e.minute()),t.imply("second",e.second()),t.imply("millisecond",e.millisecond())}var b7=v(()=>{rB()});function nB(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 lBr(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 ZNe(t,e,r={}){if(t==null)return null;if(typeof t=="number")return t;let n=r[t]??A9o[t];return n==null?null:typeof n=="number"?n:e==null?null:(0,pft.default)(e).isAfter(n.dstStart(e.getFullYear()))&&!(0,pft.default)(e).isAfter(n.dstEnd(e.getFullYear()))?n.timezoneOffsetDuringDst:n.timezoneOffsetNonDst}var pft,A9o,mft=v(()=>{pft=L(tB(),1);rB();A9o={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=>lBr(t,mw.MARCH,um.SUNDAY,2),dstEnd:t=>lBr(t,mw.OCTOBER,um.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=>nB(t,mw.MARCH,um.SUNDAY,2,2),dstEnd:t=>nB(t,mw.NOVEMBER,um.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=>nB(t,mw.MARCH,um.SUNDAY,2,2),dstEnd:t=>nB(t,mw.NOVEMBER,um.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=>nB(t,mw.MARCH,um.SUNDAY,2,2),dstEnd:t=>nB(t,mw.NOVEMBER,um.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=>nB(t,mw.MARCH,um.SUNDAY,2,2),dstEnd:t=>nB(t,mw.NOVEMBER,um.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 cBr,Aue,oB,Ka,UD,hx=v(()=>{cBr=L(sBr(),1),Aue=L(tB(),1);b7();mft();Aue.default.extend(cBr.default);oB=class{constructor(e){e=e??new Date,e instanceof Date?this.instant=e:(this.instant=e.instant??new Date,this.timezoneOffset=ZNe(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}},Ka=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,Aue.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,Aue.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,Aue.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?(GNe(o,n),mx(o,n),e.timezoneOffset!==null&&o.assign("timezoneOffset",-e.instant.getTimezoneOffset())):(y7(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}},UD=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 Ka(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 hft(t,e,r="\\s{0,5},?\\s{0,5}"){let n=e.replace(/\((?!\?)/g,"(?:");return`${t}${n}(?:${r}${n}){0,10}`}function I9o(t){let e;return t instanceof Array?e=[...t]:t instanceof Map?e=Array.from(t.keys()):e=Object.keys(t),e}function Ag(t){return`(?:${I9o(t).sort((r,n)=>n.length-r.length).join("|").replace(/\./g,"\\.")})`}var iB=v(()=>{});function XNe(t){return t<100&&(t>50?t=t+1900:t=t+2e3),t}function aB(t,e,r){let n=(0,dBr.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 dBr,_7=v(()=>{dBr=L(tB(),1)});function N9o(t){let e=t.toLowerCase();return gft[e]!==void 0?gft[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 w7(t){let e=t.toLowerCase();return yft[e]!==void 0?yft[e]:(e=e.replace(/(?:st|nd|rd|th)$/i,""),parseInt(e))}function uB(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 XNe(e)}function u0(t){let e={},r=t,n=fBr.exec(r);for(;n;)D9o(e,n),r=r.substring(n[0].length).trim(),n=fBr.exec(r);return Object.keys(e).length==0?null:e}function D9o(t,e){if(e[0].match(/^[a-zA-Z]+$/))return;let r=N9o(e[1]),n=Iue[e[2].toLowerCase()];t[n]=r}var bft,_ft,s0,gft,yft,pBr,Iue,mBr,v7,sB,hBr,fBr,j9o,gBr,zD,lB,Um=v(()=>{iB();_7();bft={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},_ft={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},s0={..._ft,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},gft={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},yft={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},pBr={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"},Iue={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",...pBr},mBr=`(?:${Ag(gft)}|[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)?)`;v7=`(?:${Ag(yft)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;sB="(?:[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])";hBr=`(${mBr})\\s{0,3}(${Ag(Iue)})`,fBr=new RegExp(hBr,"i"),j9o=`(${mBr})\\s{0,3}(${Ag(pBr)})`,gBr="\\s{0,5},?(?:\\s*and)?\\s{0,5}",zD=hft("(?:(?:about|around)\\s{0,3})?",hBr,gBr),lB=hft("(?:(?:about|around)\\s{0,3})?",j9o,gBr)});var Ks,Mb=v(()=>{Ks=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 $9o,L9o,F9o,Nue,yBr=v(()=>{Um();hx();Mb();$9o=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${zD})(?=\\W|$)`,"i"),L9o=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${zD})(?=\\W|$)`,"i"),F9o=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${lB})(?=\\W|$)`,"i"),Nue=class extends Ks{constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?F9o:e.option.forwardDate?$9o:L9o}innerExtract(e,r){if(r[0].match(/^for\s*the\s*\w+/))return null;let n=u0(r[1]);return n?Ka.createRelativeFromReference(e.reference,n):null}}});var k9o,bBr,_Br,q9o,vBr,jue,wBr=v(()=>{_7();Um();Um();Um();iB();Mb();k9o=new RegExp(`(?:on\\s{0,3})?(${v7})(?:\\s{0,3}(?:to|\\-|\\\u2013|until|through|till)?\\s{0,3}(${v7}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${Ag(s0)})(?:(?:-|/|,?\\s{0,3})(${sB}(?!\\w)))?(?=\\W|$)`,"i"),bBr=1,_Br=2,q9o=3,vBr=4,jue=class extends Ks{innerPattern(){return k9o}innerExtract(e,r){let n=e.createParsingResult(r.index,r[0]),o=s0[r[q9o].toLowerCase()],i=w7(r[bBr]);if(i>31)return r.index=r.index+r[bBr].length,null;if(n.start.assign("month",o),n.start.assign("day",i),r[vBr]){let a=uB(r[vBr]);n.start.assign("year",a)}else{let a=aB(e.refDate,i,o);n.start.imply("year",a)}if(r[_Br]){let a=w7(r[_Br]);n.end=n.start.clone(),n.end.assign("day",a)}return n}}});var B9o,U9o,SBr,vft,wft,Due,CBr=v(()=>{_7();Um();Um();Um();iB();Mb();B9o=new RegExp(`(${Ag(s0)})(?:-|/|\\s*,?\\s*)(${v7})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${v7})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${sB}))?(?=\\W|$)(?!\\:\\d)`,"i"),U9o=1,SBr=2,vft=3,wft=4,Due=class extends Ks{constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return B9o}innerExtract(e,r){let n=s0[r[U9o].toLowerCase()],o=w7(r[SBr]);if(o>31||this.shouldSkipYearLikeDate&&!r[vft]&&!r[wft]&&r[SBr].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:o,month:n}).addTag("parser/ENMonthNameMiddleEndianParser");if(r[wft]){let u=uB(r[wft]);i.assign("year",u)}else{let u=aB(e.refDate,o,n);i.imply("year",u)}if(!r[vft])return i;let a=w7(r[vft]),s=e.createParsingResult(r.index,r[0]);return s.start=i,s.end=i.clone(),s.end.assign("day",a),s}}});var z9o,H9o,V9o,xBr,$ue,OBr=v(()=>{Um();_7();iB();Um();Mb();z9o=new RegExp(`((?:in)\\s*)?(${Ag(s0)})\\s*(?:[,-]?\\s*(${sB})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),H9o=1,V9o=2,xBr=3,$ue=class extends Ks{innerPattern(){return z9o}innerExtract(e,r){let n=r[V9o].toLowerCase();if(r[0].length<=3&&!_ft[n])return null;let o=e.createParsingResult(r.index+(r[H9o]||"").length,r.index+r[0].length);o.start.imply("day",1),o.start.addTag("parser/ENMonthNameParser");let i=s0[n];if(o.start.assign("month",i),r[xBr]){let a=uB(r[xBr]);o.start.assign("year",a)}else{let a=aB(e.refDate,1,i);o.start.imply("year",a)}return o}}});var J9o,K9o,W9o,TBr,G9o,Lue,EBr=v(()=>{Um();iB();Mb();J9o=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${Ag(s0)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),K9o=1,W9o=2,TBr=3,G9o=4,Lue=class extends Ks{constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return J9o}innerExtract(e,r){let n=parseInt(r[K9o]),o=parseInt(r[G9o]),i=r[TBr]?parseInt(r[TBr]):s0[r[W9o].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 Z9o,X9o,Y9o,Fue,PBr=v(()=>{Mb();Z9o=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),X9o=1,Y9o=2,Fue=class extends Ks{innerPattern(){return Z9o}innerExtract(e,r){let n=parseInt(r[Y9o]),o=parseInt(r[X9o]);return e.createParsingComponents().imply("day",1).assign("month",o).assign("year",n)}}});function Q9o(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 e7o(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 MBr,S7,YNe,QNe,kue,e1e,RBr=v(()=>{rB();MBr=2,S7=3,YNe=4,QNe=5,kue=6,e1e=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[MBr]);if(s>100){if(this.strictMode||r[S7]!=null)return null;i=s%100,s=Math.floor(s/100)}if(s>24)return null;if(r[S7]!=null){if(r[S7].length==1&&!r[kue])return null;i=parseInt(r[S7])}if(i>=60)return null;if(s>12&&(a=Ja.PM),r[kue]!=null){if(s>12)return null;let u=r[kue][0].toLowerCase();u=="a"&&(a=Ja.AM,s==12&&(s=0)),u=="p"&&(a=Ja.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",Ja.AM):o.imply("meridiem",Ja.PM),r[QNe]!=null){let u=parseInt(r[QNe].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[YNe]!=null){let u=parseInt(r[YNe]);if(u>=60)return null;o.assign("second",u)}return o}extractFollowingTimeComponents(e,r,n){let o=e.createParsingComponents();if(r[QNe]!=null){let u=parseInt(r[QNe].substring(0,3));if(u>=1e3)return null;o.assign("millisecond",u)}if(r[YNe]!=null){let u=parseInt(r[YNe]);if(u>=60)return null;o.assign("second",u)}let i=parseInt(r[MBr]),a=0,s=-1;if(r[S7]!=null?a=parseInt(r[S7]):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(s=Ja.PM),r[kue]!=null){if(i>12)return null;let u=r[kue][0].toLowerCase();u=="a"&&(s=Ja.AM,i==12&&(i=0,o.isCertain("day")||o.imply("day",o.get("day")+1))),u=="p"&&(s=Ja.PM,i!=12&&(i+=12)),n.start.isCertain("meridiem")||(s==Ja.AM?(n.start.imply("meridiem",Ja.AM),n.start.get("hour")==12&&n.start.assign("hour",0)):(n.start.imply("meridiem",Ja.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",Ja.AM):i<=12&&(o.assign("hour",i+12),o.assign("meridiem",Ja.PM)):i>12?o.imply("meridiem",Ja.PM):i<=12&&o.imply("meridiem",Ja.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=Q9o(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=e7o(e,r),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=r,this.cachedFollowingTimePatten)}}});var que,ABr=v(()=>{rB();RBr();que=class extends e1e{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",Ja.PM)):o<6&&n.assign("meridiem",Ja.AM)}if(r[0].endsWith("afternoon")){n.assign("meridiem",Ja.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",Ja.AM),n.get("hour")<12&&n.assign("hour",n.get("hour"))),n.addTag("parser/ENTimeExpressionParser")}}});function cB(t){let e={};for(let r in t)e[r]=-t[r];return e}function IBr(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 C7=v(()=>{});var t7o,r7o,Bue,NBr=v(()=>{Um();hx();Mb();C7();t7o=new RegExp(`(${zD})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),r7o=new RegExp(`(${lB})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),Bue=class extends Ks{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?r7o:t7o}innerExtract(e,r){let n=u0(r[1]);if(!n)return null;let o=cB(n);return Ka.createRelativeFromReference(e.reference,o)}}});var n7o,o7o,i7o,Uue,jBr=v(()=>{Um();hx();Mb();n7o=new RegExp(`(${zD})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),o7o=new RegExp(`(${lB})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),i7o=1,Uue=class extends Ks{constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?o7o:n7o}innerExtract(e,r){let n=u0(r[i7o]);return n?Ka.createRelativeFromReference(e.reference,n):null}}});var t1e,l0,iJ=v(()=>{t1e=class{refine(e,r){return r.filter(n=>this.isValid(e,n))}},l0=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 zue,DBr=v(()=>{iJ();zue=class extends l0{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 Hue,$Br=v(()=>{DBr();Hue=class extends zue{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}}});function Sft(t,e){let r=t.clone(),n=t.start,o=e.start;if(r.start=LBr(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=LBr(i,a);if(t.end==null&&s.date().getTime()<r.start.date().getTime()){let u=s.dayjs().add(1,"day");s.isCertain("day")?mx(s,u):oJ(s,u)}r.end=s}return r}function LBr(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")==Ja.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 FBr=v(()=>{rB();b7()});var Vue,kBr=v(()=>{iJ();FBr();Vue=class extends l0{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()?Sft(r,n):Sft(n,r);return o.index=r.index,o.text=r.text+e+n.text,o}}});var x7,qBr=v(()=>{kBr();x7=class extends Vue{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|\u2219|:)?\\s*$")}}});var a7o,Jue,BBr=v(()=>{mft();a7o=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i"),Jue=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=a7o.exec(i);if(!a)return;let s=a[1].toUpperCase(),u=o.start.date()??o.refDate??new Date,l={...this.timezoneOverrides,...n},c=ZNe(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 s7o,u7o,l7o,c7o,Kue,UBr=v(()=>{s7o=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),u7o=1,l7o=2,c7o=3,Kue=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=s7o.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting timezone: '${i[0]}' into : ${n}`)});let a=parseInt(i[l7o]),s=parseInt(i[c7o]||"0"),u=a*60+s;u>14*60||(i[u7o]==="-"&&(u=-u),n.end!=null&&n.end.assign("timezoneOffset",u),n.start.assign("timezoneOffset",u),n.text+=i[0])}),r}}});var dB,Cft=v(()=>{dB=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 zBr,Wue,HBr=v(()=>{zBr=L(tB(),1);b7();Wue=class{refine(e,r){return e.option.forwardDate&&r.forEach(n=>{let o=(0,zBr.default)(e.refDate);if(n.start.isOnlyTime()&&o.isAfter(n.start.dayjs())&&(o=o.add(1,"day"),oJ(n.start,o),n.end&&n.end.isOnlyTime()&&(oJ(n.end,o),n.start.dayjs().isAfter(n.end.dayjs())&&(o=o.add(1,"day"),oJ(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 Gue,VBr=v(()=>{iJ();Gue=class extends t1e{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 d7o,f7o,p7o,m7o,JBr,h7o,KBr,WBr,g7o,GBr,ZBr,Zue,XBr=v(()=>{Mb();d7o=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"),f7o=1,p7o=2,m7o=3,JBr=4,h7o=5,KBr=6,WBr=7,g7o=8,GBr=9,ZBr=10,Zue=class extends Ks{innerPattern(){return d7o}innerExtract(e,r){let n=e.createParsingComponents({year:parseInt(r[f7o]),month:parseInt(r[p7o]),day:parseInt(r[m7o])});if(r[JBr]!=null&&(n.assign("hour",parseInt(r[JBr])),n.assign("minute",parseInt(r[h7o])),r[KBr]!=null&&n.assign("second",parseInt(r[KBr])),r[WBr]!=null&&n.assign("millisecond",parseInt(r[WBr])),r[g7o]!=null)){let o=0;if(r[GBr]){let i=parseInt(r[GBr]),a=0;r[ZBr]!=null&&(a=parseInt(r[ZBr])),o=i*60,o<0?o-=a:o+=a}n.assign("timezoneOffset",o)}return n.addTag("parser/ISOFormatParser")}}});var Xue,YBr=v(()=>{iJ();Xue=class extends l0{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 QBr(t,e=!1){return t.parsers.unshift(new Zue),t.refiners.unshift(new Xue),t.refiners.unshift(new Kue),t.refiners.unshift(new dB),t.refiners.push(new Jue),t.refiners.push(new dB),t.refiners.push(new Wue),t.refiners.push(new Gue(e)),t}var eUr=v(()=>{BBr();UBr();Cft();HBr();VBr();XBr();YBr()});function tUr(t){let e=(0,O7.default)(t.instant),r=new Ka(t,{});return mx(r,e),GNe(r,e),t.timezoneOffset!==null&&r.assign("timezoneOffset",e.utcOffset()),r.addTag("casualReference/now"),r}function rUr(t){let e=(0,O7.default)(t.instant),r=new Ka(t,{});return mx(r,e),y7(r,e),r.addTag("casualReference/today"),r}function nUr(t){return y7o(t,1).addTag("casualReference/yesterday")}function y7o(t,e){return iUr(t,-e)}function oUr(t){return iUr(t,1).addTag("casualReference/tomorrow")}function iUr(t,e){let r=(0,O7.default)(t.instant),n=new Ka(t,{});return r=r.add(e,"day"),mx(n,r),y7(n,r),n}function aUr(t,e=22){let r=(0,O7.default)(t.instant),n=new Ka(t,{});return mx(n,r),n.imply("hour",e),n.imply("meridiem",Ja.PM),n.addTag("casualReference/tonight"),n}function sUr(t,e=20){let r=new Ka(t,{});return r.imply("meridiem",Ja.PM),r.imply("hour",e),r.addTag("casualReference/evening"),r}function uUr(t){let e=new Ka(t,{}),r=(0,O7.default)(t.instant);return r.hour()>2&&uBr(e,r),e.assign("hour",0),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/midnight"),e}function lUr(t,e=6){let r=new Ka(t,{});return r.imply("meridiem",Ja.AM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/morning"),r}function cUr(t,e=15){let r=new Ka(t,{});return r.imply("meridiem",Ja.PM),r.imply("hour",e),r.imply("minute",0),r.imply("second",0),r.imply("millisecond",0),r.addTag("casualReference/afternoon"),r}function dUr(t){let e=new Ka(t,{});return e.imply("meridiem",Ja.AM),e.imply("hour",12),e.imply("minute",0),e.imply("second",0),e.imply("millisecond",0),e.addTag("casualReference/noon"),e}var O7,xft=v(()=>{hx();O7=L(tB(),1);b7();rB()});var pUr,b7o,Yue,mUr=v(()=>{pUr=L(tB(),1);Mb();b7();xft();b7o=/(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,Yue=class extends Ks{innerPattern(e){return b7o}innerExtract(e,r){let n=(0,pUr.default)(e.refDate),o=r[0].toLowerCase(),i=e.createParsingComponents();switch(o){case"now":i=tUr(e.reference);break;case"today":i=rUr(e.reference);break;case"yesterday":i=nUr(e.reference);break;case"tomorrow":case"tmr":case"tmrw":i=oUr(e.reference);break;case"tonight":i=aUr(e.reference);break;default:o.match(/last\s*night/)&&(n.hour()>6&&(n=n.add(-1,"day")),mx(i,n),i.imply("hour",0));break}return i.addTag("parser/ENCasualDateParser"),i}}});var _7o,Que,hUr=v(()=>{Mb();xft();_7o=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,Que=class extends Ks{innerPattern(){return _7o}innerExtract(e,r){let n=null;switch(r[1].toLowerCase()){case"afternoon":n=cUr(e.reference);break;case"evening":case"night":n=sUr(e.reference);break;case"midnight":n=uUr(e.reference);break;case"morning":n=lUr(e.reference);break;case"noon":case"midday":n=dUr(e.reference);break}return n&&n.addTag("parser/ENCasualTimeParser"),n}}});function gUr(t,e,r){let n=t.getDateWithAdjustedTimezone(),o=v7o(n,e,r),i=new Ka(t);return i=IBr(i,{day:o}),i.assign("weekday",e),i}function v7o(t,e,r){let n=t.getDay();switch(r){case"this":return r1e(t,e);case"last":return yUr(t,e);case"next":return n==um.SUNDAY?e==um.SUNDAY?7:e:n==um.SATURDAY?e==um.SATURDAY?7:e==um.SUNDAY?8:1+e:e<n&&e!=um.SUNDAY?r1e(t,e):r1e(t,e)+7}return w7o(t,e)}function w7o(t,e){let r=yUr(t,e),n=r1e(t,e);return n<-r?n:r}function r1e(t,e){let r=t.getDay(),n=e-r;return n<0&&(n+=7),n}function yUr(t,e){let r=t.getDay(),n=e-r;return n>=0&&(n-=7),n}var bUr=v(()=>{rB();hx();C7()});var S7o,C7o,x7o,O7o,ele,_Ur=v(()=>{Um();iB();Mb();bUr();S7o=new RegExp(`(?:(?:\\,|\\(|\\\uFF08)\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${Ag(bft)})(?:\\s*(?:\\,|\\)|\\\uFF09))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),C7o=1,x7o=2,O7o=3,ele=class extends Ks{innerPattern(){return S7o}innerExtract(e,r){let n=r[x7o].toLowerCase(),o=bft[n],i=r[C7o],a=r[O7o],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"),gUr(e.reference,o,u)}}});var vUr,T7o,E7o,P7o,tle,wUr=v(()=>{Um();hx();vUr=L(tB(),1);Mb();iB();T7o=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${Ag(Iue)})(?=\\s*)(?=\\W|$)`,"i"),E7o=1,P7o=2,tle=class extends Ks{innerPattern(){return T7o}innerExtract(e,r){let n=r[E7o].toLowerCase(),o=r[P7o].toLowerCase(),i=Iue[o];if(n=="next"||n.startsWith("after")){let u={};return u[i]=1,Ka.createRelativeFromReference(e.reference,u)}if(n=="last"||n=="past"){let u={};return u[i]=-1,Ka.createRelativeFromReference(e.reference,u)}let a=e.createParsingComponents(),s=(0,vUr.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 M7o,R7o,A7o,SUr,CUr,Oft,rle,xUr=v(()=>{_7();M7o=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"),R7o=1,A7o=5,SUr=2,CUr=3,Oft=4,rle=class{constructor(e){this.groupNumberMonth=e?CUr:SUr,this.groupNumberDay=e?SUr:CUr}pattern(){return M7o}extract(e,r){let n=r.index+r[R7o].length,o=r.index+r[0].length-r[A7o].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[Oft]&&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[Oft]){let l=parseInt(r[Oft]),c=XNe(l);a.start.assign("year",c)}else{let l=aB(e.refDate,u,s);a.start.imply("year",l)}return a}}});var I7o,N7o,nle,OUr=v(()=>{Um();hx();Mb();C7();I7o=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${zD})(?=\\W|$)`,"i"),N7o=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${lB})(?=\\W|$)`,"i"),nle=class extends Ks{constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?I7o:N7o}innerExtract(e,r){let n=r[1].toLowerCase(),o=u0(r[2]);if(!o)return null;switch(n){case"last":case"past":case"-":o=cB(o);break}return Ka.createRelativeFromReference(e.reference,o)}}});function j7o(t){return t.text.match(/^[+-]/i)!=null}function TUr(t){return t.text.match(/^-/i)!=null}var ole,EUr=v(()=>{iJ();hx();Um();C7();ole=class extends l0{shouldMergeResults(e,r,n){return e.match(/^\s*$/i)?j7o(n)||TUr(n):!1}mergeResults(e,r,n,o){let i=u0(n.text);TUr(n)&&(i=cB(i));let a=Ka.createRelativeFromReference(new oB(r.start.date()),i);return new UD(r.reference,r.index,`${r.text}${e}${n.text}`,a)}}});function PUr(t){return t.text.match(/\s+(before|from)$/i)!=null}function D7o(t){return t.text.match(/\s+(after|since)$/i)!=null}var ile,MUr=v(()=>{iJ();hx();Um();C7();ile=class extends l0{patternBetween(){return/^\s*$/i}shouldMergeResults(e,r,n){return!e.match(this.patternBetween())||!PUr(r)&&!D7o(r)?!1:!!n.start.get("day")&&!!n.start.get("month")&&!!n.start.get("year")}mergeResults(e,r,n){let o=u0(r.text);PUr(r)&&(o=cB(o));let i=Ka.createRelativeFromReference(new oB(n.start.date()),o);return new UD(n.reference,r.index,`${r.text}${e}${n.text}`,i)}}});var $7o,L7o,ale,RUr=v(()=>{Um();$7o=new RegExp(`^\\s*(${sB})`,"i"),L7o=1,ale=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=$7o.exec(o);if(!i)return;e.debug(()=>{console.log(`Extracting year: '${i[0]}' into : ${n}`)});let a=uB(i[L7o]);n.end!=null&&n.end.assign("year",a),n.start.assign("year",a),n.text+=i[0]}),r}}});var aJ,Tft=v(()=>{yBr();wBr();CBr();OBr();EBr();PBr();ABr();NBr();jBr();$Br();qBr();eUr();mUr();hUr();_Ur();wUr();xUr();OUr();EUr();MUr();Cft();RUr();aJ=class{createCasualConfiguration(e=!1){let r=this.createConfiguration(!1,e);return r.parsers.push(new Yue),r.parsers.push(new Que),r.parsers.push(new $ue),r.parsers.push(new tle),r.parsers.push(new nle),r}createConfiguration(e=!0,r=!1){let n=QBr({parsers:[new rle(r),new Nue(e),new jue,new Due(r),new ele,new Fue,new que(e),new Bue(e),new Uue(e)],refiners:[new x7]},e);return n.parsers.unshift(new Lue(e)),n.refiners.unshift(new ile),n.refiners.unshift(new ole),n.refiners.unshift(new dB),n.refiners.push(new x7),n.refiners.push(new ale),n.refiners.push(new Hue),n}}});var T7,Eft,AUr=v(()=>{hx();Tft();T7=class t{constructor(e){this.defaultConfig=new aJ,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 Eft(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 UD?c=l:l instanceof Ka?(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}},Eft=class{constructor(e,r,n){this.text=e,this.reference=new oB(r),this.option=n??{},this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof Ka?e:new Ka(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 UD(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 Pft,IUr,F7o,Qrs,NUr=v(()=>{AUr();Tft();Pft=new aJ,IUr=new T7(Pft.createCasualConfiguration(!1)),F7o=new T7(Pft.createConfiguration(!0,!1)),Qrs=new T7(Pft.createCasualConfiguration(!0))});function Mft(t,e,r){return jUr.parse(t,e,r)}function DUr(t,e,r){return jUr.parseDate(t,e,r)}var jUr,$Ur=v(()=>{NUr();jUr=IUr});var HD,n1e,o1e,i1e,gx,E7,Lc,yx,fB=v(()=>{HD=class extends Error{},n1e=class extends HD{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},o1e=class extends HD{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},i1e=class extends HD{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},gx=class extends HD{},E7=class extends HD{constructor(e){super(`Invalid unit ${e}`)}},Lc=class extends HD{},yx=class extends HD{constructor(){super("Zone is an abstract class")}}});var Ut,bx,hw,pB,sle,Rft,ule,lle,cle,dle,fle,ple,mle,hle,gle,yle,ble,_le,vle,wle,Aft,Sle,Cle,xle,Ole,Tle=v(()=>{Ut="numeric",bx="short",hw="long",pB={year:Ut,month:Ut,day:Ut},sle={year:Ut,month:bx,day:Ut},Rft={year:Ut,month:bx,day:Ut,weekday:bx},ule={year:Ut,month:hw,day:Ut},lle={year:Ut,month:hw,day:Ut,weekday:hw},cle={hour:Ut,minute:Ut},dle={hour:Ut,minute:Ut,second:Ut},fle={hour:Ut,minute:Ut,second:Ut,timeZoneName:bx},ple={hour:Ut,minute:Ut,second:Ut,timeZoneName:hw},mle={hour:Ut,minute:Ut,hourCycle:"h23"},hle={hour:Ut,minute:Ut,second:Ut,hourCycle:"h23"},gle={hour:Ut,minute:Ut,second:Ut,hourCycle:"h23",timeZoneName:bx},yle={hour:Ut,minute:Ut,second:Ut,hourCycle:"h23",timeZoneName:hw},ble={year:Ut,month:Ut,day:Ut,hour:Ut,minute:Ut},_le={year:Ut,month:Ut,day:Ut,hour:Ut,minute:Ut,second:Ut},vle={year:Ut,month:bx,day:Ut,hour:Ut,minute:Ut},wle={year:Ut,month:bx,day:Ut,hour:Ut,minute:Ut,second:Ut},Aft={year:Ut,month:bx,day:Ut,weekday:bx,hour:Ut,minute:Ut},Sle={year:Ut,month:hw,day:Ut,hour:Ut,minute:Ut,timeZoneName:bx},Cle={year:Ut,month:hw,day:Ut,hour:Ut,minute:Ut,second:Ut,timeZoneName:bx},xle={year:Ut,month:hw,day:Ut,weekday:hw,hour:Ut,minute:Ut,timeZoneName:hw},Ole={year:Ut,month:hw,day:Ut,weekday:hw,hour:Ut,minute:Ut,second:Ut,timeZoneName:hw}});var H_,sJ=v(()=>{fB();H_=class{get type(){throw new yx}get name(){throw new yx}get ianaName(){return this.name}get isUniversal(){throw new yx}offsetName(e,r){throw new yx}formatOffset(e,r){throw new yx}offset(e){throw new yx}equals(e){throw new yx}get isValid(){throw new yx}}});var Ift,mB,s1e=v(()=>{Rb();sJ();Ift=null,mB=class t extends H_{static get instance(){return Ift===null&&(Ift=new t),Ift}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return u1e(e,r,n)}formatOffset(e,r){return hB(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}});function B7o(t){return c1e[t]||(c1e[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"})),c1e[t]}function z7o(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 H7o(t,e){let r=t.formatToParts(e),n=[];for(let o=0;o<r.length;o++){let{type:i,value:a}=r[o],s=U7o[i];i==="era"?n[s]=a:ln(s)||(n[s]=parseInt(a,10))}return n}var c1e,U7o,l1e,Ny,gB=v(()=>{Rb();sJ();c1e={};U7o={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};l1e={},Ny=class t extends H_{static create(e){return l1e[e]||(l1e[e]=new t(e)),l1e[e]}static resetCache(){l1e={},c1e={}}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 u1e(e,r,n,this.name)}formatOffset(e,r){return hB(this.offset(e),r)}offset(e){let r=new Date(e);if(isNaN(r))return NaN;let n=B7o(this.name),[o,i,a,s,u,l,c]=n.formatToParts?H7o(n,r):z7o(n,r);s==="BC"&&(o=-Math.abs(o)+1);let f=P7({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 V7o(t,e={}){let r=JSON.stringify([t,e]),n=LUr[r];return n||(n=new Intl.ListFormat(t,e),LUr[r]=n),n}function jft(t,e={}){let r=JSON.stringify([t,e]),n=Nft[r];return n||(n=new Intl.DateTimeFormat(t,e),Nft[r]=n),n}function J7o(t,e={}){let r=JSON.stringify([t,e]),n=Dft[r];return n||(n=new Intl.NumberFormat(t,e),Dft[r]=n),n}function K7o(t,e={}){let{base:r,...n}=e,o=JSON.stringify([t,n]),i=$ft[o];return i||(i=new Intl.RelativeTimeFormat(t,e),$ft[o]=i),i}function W7o(){return Ele||(Ele=new Intl.DateTimeFormat().resolvedOptions().locale,Ele)}function G7o(t){let e=FUr[t];if(!e){let r=new Intl.Locale(t);e="getWeekInfo"in r?r.getWeekInfo():r.weekInfo,FUr[t]=e}return e}function Z7o(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=jft(t).resolvedOptions(),o=t}catch{let u=t.substring(0,r);n=jft(u).resolvedOptions(),o=u}let{numberingSystem:i,calendar:a}=n;return[o,i,a]}}function X7o(t,e,r){return(r||e)&&(t.includes("-u-")||(t+="-u"),r&&(t+=`-ca-${r}`),e&&(t+=`-nu-${e}`)),t}function Y7o(t){let e=[];for(let r=1;r<=12;r++){let n=Sn.utc(2009,r,1);e.push(t(n))}return e}function Q7o(t){let e=[];for(let r=1;r<=7;r++){let n=Sn.utc(2016,11,13+r);e.push(t(n))}return e}function d1e(t,e,r,n){let o=t.listingMode();return o==="error"?null:o==="en"?r(e):n(e)}function eZo(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 LUr,Nft,Dft,$ft,Ele,FUr,Lft,Fft,kft,tZo,As,Mle=v(()=>{Rb();m1e();yB();bB();gB();LUr={};Nft={};Dft={};$ft={};Ele=null;FUr={};Lft=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=J7o(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):M7(e,3);return gc(r,this.padTo)}}},Fft=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&&Ny.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=jft(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()}},kft=class{constructor(e,r,n){this.opts={style:"long",...n},!r&&f1e()&&(this.rtf=K7o(e,n))}format(e,r){return this.rtf?this.rtf.format(e,r):kUr(r,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,r){return this.rtf?this.rtf.formatToParts(e,r):[]}},tZo={firstDay:1,minimalDays:4,weekend:[6,7]},As=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||Rs.defaultLocale,s=a||(i?"en-US":W7o()),u=r||Rs.defaultNumberingSystem,l=n||Rs.defaultOutputCalendar,c=Ple(o)||Rs.defaultWeekSettings;return new t(s,u,l,c,a)}static resetCache(){Ele=null,Nft={},Dft={},$ft={}}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]=Z7o(e);this.locale=a,this.numberingSystem=r||s||null,this.outputCalendar=n||u||null,this.weekSettings=o,this.intl=X7o(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=eZo(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,Ple(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 d1e(this,e,qft,()=>{let n=r?{month:e,day:"numeric"}:{month:e},o=r?"format":"standalone";return this.monthsCache[o][e]||(this.monthsCache[o][e]=Y7o(i=>this.extract(i,n,"month"))),this.monthsCache[o][e]})}weekdays(e,r=!1){return d1e(this,e,Bft,()=>{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]=Q7o(i=>this.extract(i,n,"weekday"))),this.weekdaysCache[o][e]})}meridiems(){return d1e(this,void 0,()=>Uft,()=>{if(!this.meridiemCache){let e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[Sn.utc(2016,11,13,9),Sn.utc(2016,11,13,19)].map(r=>this.extract(r,e,"dayperiod"))}return this.meridiemCache})}eras(e){return d1e(this,e,zft,()=>{let r={era:e};return this.eraCache[e]||(this.eraCache[e]=[Sn.utc(-40,1,1),Sn.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 Lft(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,r={}){return new Fft(e,this.intl,r)}relFormatter(e={}){return new kft(this.intl,this.isEnglish(),e)}listFormatter(e={}){return V7o(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:p1e()?G7o(this.locale):tZo}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 Vft,Mh,R7=v(()=>{Rb();sJ();Vft=null,Mh=class t extends H_{static get utcInstance(){return Vft===null&&(Vft=new t(0)),Vft}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(uJ(r[1],r[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${hB(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${hB(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,r){return hB(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 A7,Jft=v(()=>{sJ();A7=class extends H_{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 _x(t,e){let r;if(ln(t)||t===null)return e;if(t instanceof H_)return t;if(qUr(t)){let n=t.toLowerCase();return n==="default"?e:n==="local"||n==="system"?mB.instance:n==="utc"||n==="gmt"?Mh.utcInstance:Mh.parseSpecifier(n)||Ny.create(t)}else return vx(t)?Mh.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new A7(t)}var h1e=v(()=>{sJ();gB();R7();Jft();Rb();s1e()});function UUr(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(Kft.hanidec)!==-1)e+=rZo.indexOf(t[r]);else for(let o in BUr){let[i,a]=BUr[o];n>=i&&n<=a&&(e+=n-i)}}return parseInt(e,10)}else return e}function zUr(){I7={}}function c0({numberingSystem:t},e=""){let r=t||"latn";return I7[r]||(I7[r]={}),I7[r][e]||(I7[r][e]=new RegExp(`${Kft[r]}${e}`)),I7[r][e]}var Kft,BUr,rZo,I7,Wft=v(()=>{Kft={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"},BUr={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]},rZo=Kft.hanidec.replace(/[\[|\]]/g,"").split("");I7={}});var HUr,VUr,JUr,KUr,WUr,GUr,ZUr,XUr,Rs,yB=v(()=>{s1e();gB();Mle();bB();h1e();Rb();Wft();HUr=()=>Date.now(),VUr="system",JUr=null,KUr=null,WUr=null,GUr=60,XUr=null,Rs=class{static get now(){return HUr}static set now(e){HUr=e}static set defaultZone(e){VUr=e}static get defaultZone(){return _x(VUr,mB.instance)}static get defaultLocale(){return JUr}static set defaultLocale(e){JUr=e}static get defaultNumberingSystem(){return KUr}static set defaultNumberingSystem(e){KUr=e}static get defaultOutputCalendar(){return WUr}static set defaultOutputCalendar(e){WUr=e}static get defaultWeekSettings(){return XUr}static set defaultWeekSettings(e){XUr=Ple(e)}static get twoDigitCutoffYear(){return GUr}static set twoDigitCutoffYear(e){GUr=e%100}static get throwOnInvalid(){return ZUr}static set throwOnInvalid(e){ZUr=e}static resetCaches(){As.resetCache(),Ny.resetCache(),Sn.resetCache(),zUr()}}});var Rh,Rle=v(()=>{Rh=class{constructor(e,r){this.reason=e,this.explanation=r}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}});function d0(t,e){return new Rh("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function g1e(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 ezr(t,e,r){return r+(cJ(t)?QUr:YUr)[e-1]}function tzr(t,e){let r=cJ(t)?QUr:YUr,n=r.findIndex(i=>i<e),o=e-r[n];return{month:n+1,day:o}}function y1e(t,e){return(t-e+7)%7+1}function Ale(t,e=4,r=1){let{year:n,month:o,day:i}=t,a=ezr(n,o,i),s=y1e(g1e(n,o,i),r),u=Math.floor((a-s+14-e)/7),l;return u<1?(l=n-1,u=lJ(l,e,r)):u>lJ(n,e,r)?(l=n+1,u=1):l=n,{weekYear:l,weekNumber:u,weekday:s,...Nle(t)}}function Gft(t,e=4,r=1){let{weekYear:n,weekNumber:o,weekday:i}=t,a=y1e(g1e(n,1,e),r),s=_B(n),u=o*7+i-a-7+e,l;u<1?(l=n-1,u+=_B(l)):u>s?(l=n+1,u-=_B(n)):l=n;let{month:c,day:d}=tzr(l,u);return{year:l,month:c,day:d,...Nle(t)}}function b1e(t){let{year:e,month:r,day:n}=t,o=ezr(e,r,n);return{year:e,ordinal:o,...Nle(t)}}function Zft(t){let{year:e,ordinal:r}=t,{month:n,day:o}=tzr(e,r);return{year:e,month:n,day:o,...Nle(t)}}function Xft(t,e){if(!ln(t.localWeekday)||!ln(t.localWeekNumber)||!ln(t.localWeekYear)){if(!ln(t.weekday)||!ln(t.weekNumber)||!ln(t.weekYear))throw new gx("Cannot mix locale-based week fields with ISO-based week fields");return ln(t.localWeekday)||(t.weekday=t.localWeekday),ln(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),ln(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 rzr(t,e=4,r=1){let n=Ile(t.weekYear),o=gw(t.weekNumber,1,lJ(t.weekYear,e,r)),i=gw(t.weekday,1,7);return n?o?i?!1:d0("weekday",t.weekday):d0("week",t.weekNumber):d0("weekYear",t.weekYear)}function nzr(t){let e=Ile(t.year),r=gw(t.ordinal,1,_B(t.year));return e?r?!1:d0("ordinal",t.ordinal):d0("year",t.year)}function Yft(t){let e=Ile(t.year),r=gw(t.month,1,12),n=gw(t.day,1,N7(t.year,t.month));return e?r?n?!1:d0("day",t.day):d0("month",t.month):d0("year",t.year)}function Qft(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:d0("millisecond",o):d0("second",n):d0("minute",r):d0("hour",e)}var YUr,QUr,ept=v(()=>{Rb();Rle();fB();YUr=[0,31,59,90,120,151,181,212,243,273,304,334],QUr=[0,31,60,91,121,152,182,213,244,274,305,335]});function ln(t){return typeof t>"u"}function vx(t){return typeof t=="number"}function Ile(t){return typeof t=="number"&&t%1===0}function qUr(t){return typeof t=="string"}function izr(t){return Object.prototype.toString.call(t)==="[object Date]"}function f1e(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function p1e(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function azr(t){return Array.isArray(t)?t:[t]}function tpt(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 szr(t,e){return e.reduce((r,n)=>(r[n]=t[n],r),{})}function vB(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Ple(t){if(t==null)return null;if(typeof t!="object")throw new Lc("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 Lc("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function gw(t,e,r){return Ile(t)&&t>=e&&t<=r}function nZo(t,e){return t-e*Math.floor(t/e)}function gc(t,e=2){let r=t<0,n;return r?n="-"+(""+-t).padStart(e,"0"):n=(""+t).padStart(e,"0"),n}function VD(t){if(!(ln(t)||t===null||t===""))return parseInt(t,10)}function wB(t){if(!(ln(t)||t===null||t===""))return parseFloat(t)}function jle(t){if(!(ln(t)||t===null||t==="")){let e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function M7(t,e,r=!1){let n=10**e;return(r?Math.trunc:Math.round)(t*n)/n}function cJ(t){return t%4===0&&(t%100!==0||t%400===0)}function _B(t){return cJ(t)?366:365}function N7(t,e){let r=nZo(e-1,12)+1,n=t+(e-r)/12;return r===2?cJ(n)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][r-1]}function P7(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 ozr(t,e,r){return-y1e(g1e(t,1,e),r)+e-1}function lJ(t,e=4,r=1){let n=ozr(t,e,r),o=ozr(t+1,e,r);return(_B(t)-n+o)/7}function Dle(t){return t>99?t:t>Rs.twoDigitCutoffYear?1900+t:2e3+t}function u1e(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 uJ(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 rpt(t){let e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Lc(`Invalid unit value ${t}`);return e}function j7(t,e){let r={};for(let n in t)if(vB(t,n)){let o=t[n];if(o==null)continue;r[e(n)]=rpt(o)}return r}function hB(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}${gc(r,2)}:${gc(n,2)}`;case"narrow":return`${o}${r}${n>0?`:${n}`:""}`;case"techie":return`${o}${gc(r,2)}${gc(n,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Nle(t){return szr(t,["hour","minute","second","millisecond"])}var Rb=v(()=>{fB();yB();ept()});function qft(t){switch(t){case"narrow":return[...iZo];case"short":return[...npt];case"long":return[...oZo];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 Bft(t){switch(t){case"narrow":return[...aZo];case"short":return[...ipt];case"long":return[...opt];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}function zft(t){switch(t){case"narrow":return[...lZo];case"short":return[...uZo];case"long":return[...sZo];default:return null}}function uzr(t){return Uft[t.hour<12?0:1]}function lzr(t,e){return Bft(e)[t.weekday-1]}function czr(t,e){return qft(e)[t.month-1]}function dzr(t,e){return zft(e)[t.year<0?0:1]}function kUr(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 oZo,npt,iZo,opt,ipt,aZo,Uft,sZo,uZo,lZo,m1e=v(()=>{Tle();Rb();oZo=["January","February","March","April","May","June","July","August","September","October","November","December"],npt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],iZo=["J","F","M","A","M","J","J","A","S","O","N","D"];opt=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ipt=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],aZo=["M","T","W","T","F","S","S"];Uft=["AM","PM"],sZo=["Before Christ","Anno Domini"],uZo=["BC","AD"],lZo=["B","A"]});function fzr(t,e){let r="";for(let n of t)n.literal?r+=n.val:r+=e(n.val);return r}var cZo,Ah,$le=v(()=>{m1e();Tle();Rb();cZo={D:pB,DD:sle,DDD:ule,DDDD:lle,t:cle,tt:dle,ttt:fle,tttt:ple,T:mle,TT:hle,TTT:gle,TTTT:yle,f:ble,ff:vle,fff:Sle,ffff:xle,F:_le,FF:wle,FFF:Cle,FFFF:Ole},Ah=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 cZo[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 gc(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?uzr(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),u=(p,m)=>n?czr(e,p):i(m?{month:p}:{month:p,day:"numeric"},"month"),l=(p,m)=>n?lzr(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?dzr(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 fzr(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 fzr(i,o(s))}}});function $7(...t){let e=t.reduce((r,n)=>r+n.source,"");return RegExp(`^${e}$`)}function L7(...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 F7(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 hzr(...t){return(e,r)=>{let n={},o;for(o=0;o<t.length;o++)n[t[o]]=VD(e[r+o]);return[n,null,r+o]}}function D7(t,e,r){let n=t[e];return ln(n)?r:VD(n)}function _Zo(t,e){return[{year:D7(t,e),month:D7(t,e+1,1),day:D7(t,e+2,1)},null,e+3]}function k7(t,e){return[{hours:D7(t,e,0),minutes:D7(t,e+1,0),seconds:D7(t,e+2,0),milliseconds:jle(t[e+3])},null,e+4]}function Lle(t,e){let r=!t[e]&&!t[e+1],n=uJ(t[e+1],t[e+2]),o=r?null:Mh.instance(n);return[{},o,e+3]}function Fle(t,e){let r=t[e]?Ny.create(t[e]):null;return[{},r,e+1]}function SZo(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(wB(r)),months:f(wB(n)),weeks:f(wB(o)),days:f(wB(i)),hours:f(wB(a)),minutes:f(wB(s)),seconds:f(wB(u),u==="-0"),milliseconds:f(jle(l),d)}]}function upt(t,e,r,n,o,i,a){let s={year:e.length===2?Dle(VD(e)):VD(e),month:npt.indexOf(r)+1,day:VD(n),hour:VD(o),minute:VD(i)};return a&&(s.second=VD(a)),t&&(s.weekday=t.length>3?opt.indexOf(t)+1:ipt.indexOf(t)+1),s}function OZo(t){let[,e,r,n,o,i,a,s,u,l,c,d]=t,f=upt(e,o,n,r,i,a,s),p;return u?p=CZo[u]:l?p=0:p=uJ(c,d),[f,new Mh(p)]}function TZo(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}function pzr(t){let[,e,r,n,o,i,a,s]=t;return[upt(e,o,n,r,i,a,s),Mh.utcInstance]}function RZo(t){let[,e,r,n,o,i,a,s]=t;return[upt(e,s,r,n,o,i,a),Mh.utcInstance]}function vzr(t){return F7(t,[AZo,_zr],[IZo,DZo],[NZo,$Zo],[jZo,LZo])}function wzr(t){return F7(TZo(t),[xZo,OZo])}function Szr(t){return F7(t,[EZo,pzr],[PZo,pzr],[MZo,RZo])}function Czr(t){return F7(t,[wZo,SZo])}function xzr(t){return F7(t,[vZo,FZo])}function Ozr(t){return F7(t,[kZo,_zr],[qZo,BZo])}var mzr,gzr,dZo,apt,yzr,spt,fZo,pZo,mZo,hZo,gZo,yZo,bzr,bZo,vZo,wZo,CZo,xZo,EZo,PZo,MZo,AZo,IZo,NZo,jZo,_zr,DZo,$Zo,LZo,FZo,kZo,qZo,BZo,lpt=v(()=>{Rb();m1e();R7();gB();mzr=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;gzr=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,dZo=`(?:${gzr.source}?(?:\\[(${mzr.source})\\])?)?`,apt=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,yzr=RegExp(`${apt.source}${dZo}`),spt=RegExp(`(?:T${yzr.source})?`),fZo=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,pZo=/(\d{4})-?W(\d\d)(?:-?(\d))?/,mZo=/(\d{4})-?(\d{3})/,hZo=hzr("weekYear","weekNumber","weekDay"),gZo=hzr("year","ordinal"),yZo=/(\d{4})-(\d\d)-(\d\d)/,bzr=RegExp(`${apt.source} ?(?:${gzr.source}|(${mzr.source}))?`),bZo=RegExp(`(?: ${bzr.source})?`);vZo=RegExp(`^T?${apt.source}$`),wZo=/^-?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)?)?)$/;CZo={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};xZo=/^(?:(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)))$/;EZo=/^(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$/,PZo=/^(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$/,MZo=/^(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})$/;AZo=$7(fZo,spt),IZo=$7(pZo,spt),NZo=$7(mZo,spt),jZo=$7(yzr),_zr=L7(_Zo,k7,Lle,Fle),DZo=L7(hZo,k7,Lle,Fle),$Zo=L7(gZo,k7,Lle,Fle),LZo=L7(k7,Lle,Fle);FZo=L7(k7);kZo=$7(yZo,bZo),qZo=$7(bzr),BZo=L7(k7,Lle,Fle)});function SB(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 yc(n)}function Mzr(t,e){let r=e.milliseconds??0;for(let n of HZo.slice(1))e[n]&&(r+=e[n]*t[n].milliseconds);return r}function Ezr(t,e){let r=Mzr(t,e)<0?-1:1;dJ.reduceRight((n,o)=>{if(ln(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),dJ.reduce((n,o)=>{if(ln(e[o]))return n;if(n){let i=e[n]%1;e[n]-=i,e[o]+=i*t[n][o]}return o},null)}function VZo(t){let e={};for(let[r,n]of Object.entries(t))n!==0&&(e[r]=n);return e}var Tzr,Pzr,UZo,f0,q7,zZo,dJ,HZo,yc,kle=v(()=>{fB();$le();Rle();Mle();lpt();Rb();yB();bB();Tzr="Invalid Duration",Pzr={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}},UZo={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},...Pzr},f0=146097/400,q7=146097/4800,zZo={years:{quarters:4,months:12,weeks:f0/7,days:f0,hours:f0*24,minutes:f0*24*60,seconds:f0*24*60*60,milliseconds:f0*24*60*60*1e3},quarters:{months:3,weeks:f0/28,days:f0/4,hours:f0*24/4,minutes:f0*24*60/4,seconds:f0*24*60*60/4,milliseconds:f0*24*60*60*1e3/4},months:{weeks:q7/7,days:q7,hours:q7*24,minutes:q7*24*60,seconds:q7*24*60*60,milliseconds:q7*24*60*60*1e3},...Pzr},dJ=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],HZo=dJ.slice(0).reverse();yc=class t{constructor(e){let r=e.conversionAccuracy==="longterm"||!1,n=r?zZo:UZo;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||As.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 Lc(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new t({values:j7(e,t.normalizeUnit),loc:As.fromObject(r),conversionAccuracy:r.conversionAccuracy,matrix:r.matrix})}static fromDurationLike(e){if(vx(e))return t.fromMillis(e);if(t.isDuration(e))return e;if(typeof e=="object")return t.fromObject(e);throw new Lc(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,r){let[n]=Czr(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]=xzr(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 Lc("need to specify a reason the Duration is invalid");let n=e instanceof Rh?e:new Rh(e,r);if(Rs.throwOnInvalid)throw new i1e(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 E7(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?Ah.create(this.loc,n).formatDurationFromString(this,e):Tzr}toHuman(e={}){if(!this.isValid)return Tzr;let r=dJ.map(n=>{let o=this.values[n];return ln(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+=M7(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},Sn.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?Mzr(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 dJ)(vB(r.values,o)||vB(this.values,o))&&(n[o]=r.get(o)+this.get(o));return SB(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]=rpt(e(this.values[n],n));return SB(this,{values:r},!0)}get(e){return this[t.normalizeUnit(e)]}set(e){if(!this.isValid)return this;let r={...this.values,...j7(e,t.normalizeUnit)};return SB(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 SB(this,a)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return Ezr(this.matrix,e),SB(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=VZo(this.normalize().shiftToAll().toObject());return SB(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 dJ)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;vx(o[a])&&(s+=o[a]);let u=Math.trunc(s);r[a]=u,n[a]=(s*1e3-u*1e3)/1e3}else vx(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 Ezr(this.matrix,r),SB(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 SB(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 dJ)if(!r(this.values[n],e.values[n]))return!1;return!0}}});function JZo(t,e){return!t||!t.isValid?JD.invalid("missing or invalid start"):!e||!e.isValid?JD.invalid("missing or invalid end"):e<t?JD.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 B7,JD,cpt=v(()=>{bB();kle();yB();fB();Rle();$le();Tle();B7="Invalid Interval";JD=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 Lc("need to specify a reason the Interval is invalid");let n=e instanceof Rh?e:new Rh(e,r);if(Rs.throwOnInvalid)throw new o1e(n);return new t({invalid:n})}static fromDateTimes(e,r){let n=U7(e),o=U7(r),i=JZo(n,o);return i??new t({start:n,end:o})}static after(e,r){let n=yc.fromDurationLike(r),o=U7(e);return t.fromDateTimes(o,o.plus(n))}static before(e,r){let n=yc.fromDurationLike(r),o=U7(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=Sn.fromISO(n,r),a=i.isValid}catch{a=!1}let s,u;try{s=Sn.fromISO(o,r),u=s.isValid}catch{u=!1}if(a&&u)return t.fromDateTimes(i,s);if(a){let l=yc.fromISO(o,r);if(l.isValid)return t.after(i,l)}else if(u){let l=yc.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(U7).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=yc.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()})`:B7}[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=pB,r={}){return this.isValid?Ah.create(this.s.loc.clone(r),e).formatInterval(this):B7}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:B7}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:B7}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:B7}toFormat(e,{separator:r=" \u2013 "}={}){return this.isValid?`${this.s.toFormat(e)}${r}${this.e.toFormat(e)}`:B7}toDuration(e,r){return this.isValid?this.e.diff(this.s,e,r):yc.invalid(this.invalidReason)}mapEndpoints(e){return t.fromDateTimes(e(this.s),e(this.e))}}});var KD,dpt=v(()=>{bB();yB();Mle();gB();h1e();Rb();KD=class{static hasDST(e=Rs.defaultZone){let r=Sn.now().setZone(e).set({month:12});return!e.isUniversal&&r.offset!==r.set({month:6}).offset}static isValidIANAZone(e){return Ny.isValidZone(e)}static normalizeZone(e){return _x(e,Rs.defaultZone)}static getStartOfWeek({locale:e=null,locObj:r=null}={}){return(r||As.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:r=null}={}){return(r||As.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:r=null}={}){return(r||As.create(e)).getWeekendDays().slice()}static months(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||As.create(r,n,i)).months(e)}static monthsFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null,outputCalendar:i="gregory"}={}){return(o||As.create(r,n,i)).months(e,!0)}static weekdays(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||As.create(r,n,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:r=null,numberingSystem:n=null,locObj:o=null}={}){return(o||As.create(r,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return As.create(e).meridiems()}static eras(e="short",{locale:r=null}={}){return As.create(r,null,"gregory").eras(e)}static features(){return{relative:f1e(),localeWeek:p1e()}}}});function Rzr(t,e){let r=o=>o.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),n=r(e)-r(t);return Math.floor(yc.fromMillis(n).as("days"))}function KZo(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=Rzr(u,l);return(c-c%7)/7}],["days",Rzr]],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 Azr(t,e,r,n){let[o,i,a,s]=KZo(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=yc.fromObject(i,n);return l.length>0?yc.fromMillis(u,n).shiftTo(...l).plus(c):c}var Izr=v(()=>{kle()});function ks(t,e=r=>r){return{regex:t,deser:([r])=>e(UUr(r))}}function ZZo(t){return t.replace(/\./g,"\\.?").replace($zr,Dzr)}function Nzr(t){return t.replace(/\./g,"").replace($zr," ").toLowerCase()}function wx(t,e){return t===null?null:{regex:RegExp(t.map(ZZo).join("|")),deser:([r])=>t.findIndex(n=>Nzr(r)===Nzr(n))+e}}function jzr(t,e){return{regex:t,deser:([,r,n])=>uJ(r,n),groups:e}}function _1e(t){return{regex:t,deser:([e])=>e}}function XZo(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function YZo(t,e){let r=c0(e),n=c0(e,"{2}"),o=c0(e,"{3}"),i=c0(e,"{4}"),a=c0(e,"{6}"),s=c0(e,"{1,2}"),u=c0(e,"{1,3}"),l=c0(e,"{1,6}"),c=c0(e,"{1,9}"),d=c0(e,"{2,4}"),f=c0(e,"{4,6}"),p=g=>({regex:RegExp(XZo(g.val)),deser:([y])=>y,literal:!0}),h=(g=>{if(t.literal)return p(g);switch(g.val){case"G":return wx(e.eras("short"),0);case"GG":return wx(e.eras("long"),0);case"y":return ks(l);case"yy":return ks(d,Dle);case"yyyy":return ks(i);case"yyyyy":return ks(f);case"yyyyyy":return ks(a);case"M":return ks(s);case"MM":return ks(n);case"MMM":return wx(e.months("short",!0),1);case"MMMM":return wx(e.months("long",!0),1);case"L":return ks(s);case"LL":return ks(n);case"LLL":return wx(e.months("short",!1),1);case"LLLL":return wx(e.months("long",!1),1);case"d":return ks(s);case"dd":return ks(n);case"o":return ks(u);case"ooo":return ks(o);case"HH":return ks(n);case"H":return ks(s);case"hh":return ks(n);case"h":return ks(s);case"mm":return ks(n);case"m":return ks(s);case"q":return ks(s);case"qq":return ks(n);case"s":return ks(s);case"ss":return ks(n);case"S":return ks(u);case"SSS":return ks(o);case"u":return _1e(c);case"uu":return _1e(s);case"uuu":return ks(r);case"a":return wx(e.meridiems(),0);case"kkkk":return ks(i);case"kk":return ks(d,Dle);case"W":return ks(s);case"WW":return ks(n);case"E":case"c":return ks(r);case"EEE":return wx(e.weekdays("short",!1),1);case"EEEE":return wx(e.weekdays("long",!1),1);case"ccc":return wx(e.weekdays("short",!0),1);case"cccc":return wx(e.weekdays("long",!0),1);case"Z":case"ZZ":return jzr(new RegExp(`([+-]${s.source})(?::(${n.source}))?`),2);case"ZZZ":return jzr(new RegExp(`([+-]${s.source})(${n.source})?`),2);case"z":return _1e(/[a-z_+-/]{1,256}?/i);case" ":return _1e(/[^\S\n\r]/);default:return p(g)}})(t)||{invalidReason:WZo};return h.token=t,h}function eXo(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=QZo[a];if(typeof s=="object"&&(s=s[i]),s)return{literal:!1,val:s}}function tXo(t){return[`^${t.map(r=>r.regex).reduce((r,n)=>`${r}(${n.source})`,"")}$`,t]}function rXo(t,e,r){let n=t.match(e);if(n){let o={},i=1;for(let a in r)if(vB(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 nXo(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 ln(t.z)||(r=Ny.create(t.z)),ln(t.Z)||(r||(r=new Mh(t.Z)),n=t.Z),ln(t.q)||(t.M=(t.q-1)*3+1),ln(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),ln(t.u)||(t.S=jle(t.u)),[Object.keys(t).reduce((i,a)=>{let s=e(a);return s&&(i[s]=t[a]),i},{}),r,n]}function oXo(){return fpt||(fpt=Sn.fromMillis(1555555555555)),fpt}function iXo(t,e){if(t.literal)return t;let r=Ah.macroTokenToFormatOpts(t.val),n=hpt(r,e);return n==null||n.includes(void 0)?t:n}function ppt(t,e){return Array.prototype.concat(...t.map(r=>iXo(r,e)))}function mpt(t,e,r){return new qle(t,r).explainFromTokens(e)}function Lzr(t,e,r){let{result:n,zone:o,specificOffset:i,invalidReason:a}=mpt(t,e,r);return[n,o,i,a]}function hpt(t,e){if(!t)return null;let n=Ah.create(e,t).dtFormatter(oXo()),o=n.formatToParts(),i=n.resolvedOptions();return o.map(a=>eXo(a,t,i))}var WZo,GZo,Dzr,$zr,QZo,fpt,qle,Fzr=v(()=>{Rb();$le();R7();gB();bB();Wft();fB();WZo="missing Intl.DateTimeFormat.formatToParts support";GZo="\xA0",Dzr=`[ ${GZo}]`,$zr=new RegExp(Dzr,"g");QZo={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"}};fpt=null;qle=class{constructor(e,r){if(this.locale=e,this.format=r,this.tokens=ppt(Ah.parseFormat(r),e),this.units=this.tokens.map(n=>YZo(n,e)),this.disqualifyingUnit=this.units.find(n=>n.invalidReason),!this.disqualifyingUnit){let[n,o]=tXo(this.units);this.regex=RegExp(n,"i"),this.handlers=o}}explainFromTokens(e){if(this.isValid){let[r,n]=rXo(e,this.regex,this.handlers),[o,i,a]=n?nXo(n):[null,null,void 0];if(vB(n,"a")&&vB(n,"H"))throw new gx("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 Ble(t){return new Rh("unsupported zone",`the zone "${t.name}" is not supported`)}function ypt(t){return t.weekData===null&&(t.weekData=Ale(t.c)),t.weekData}function bpt(t){return t.localWeekData===null&&(t.localWeekData=Ale(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function fJ(t,e){let r={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new Sn({...r,...e,old:r})}function Jzr(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 v1e(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 S1e(t,e,r){return Jzr(P7(t),e,r)}function qzr(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,N7(n,o))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},a=yc.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=P7(i),[u,l]=Jzr(s,r,t.zone);return a!==0&&(u+=a,l=t.zone.offset(u)),{ts:u,o:l}}function z7(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=Sn.fromObject(t,{...r,zone:u,specificOffset:i});return a?l:l.setZone(s)}else return Sn.invalid(new Rh("unparsable",`the input "${o}" can't be parsed as ${n}`))}function w1e(t,e,r=!0){return t.isValid?Ah.create(As.create("en-US"),{allowZ:r,forceSimple:!0}).formatDateTimeFromString(t,e):null}function _pt(t,e){let r=t.c.year>9999||t.c.year<0,n="";return r&&t.c.year>=0&&(n+="+"),n+=gc(t.c.year,r?6:4),e?(n+="-",n+=gc(t.c.month),n+="-",n+=gc(t.c.day)):(n+=gc(t.c.month),n+=gc(t.c.day)),n}function Bzr(t,e,r,n,o,i){let a=gc(t.c.hour);return e?(a+=":",a+=gc(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=":")):a+=gc(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!r)&&(a+=gc(t.c.second),(t.c.millisecond!==0||!n)&&(a+=".",a+=gc(t.c.millisecond,3))),o&&(t.isOffsetFixed&&t.offset===0&&!i?a+="Z":t.o<0?(a+="-",a+=gc(Math.trunc(-t.o/60)),a+=":",a+=gc(Math.trunc(-t.o%60))):(a+="+",a+=gc(Math.trunc(t.o/60)),a+=":",a+=gc(Math.trunc(t.o%60)))),i&&(a+="["+t.zone.ianaName+"]"),a}function cXo(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 E7(t);return e}function Uzr(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return cXo(t)}}function dXo(t){return x1e[t]||(C1e===void 0&&(C1e=Rs.now()),x1e[t]=t.offset(C1e)),x1e[t]}function zzr(t,e){let r=_x(e.zone,Rs.defaultZone);if(!r.isValid)return Sn.invalid(Ble(r));let n=As.fromObject(e),o,i;if(ln(t.year))o=Rs.now();else{for(let u of Wzr)ln(t[u])&&(t[u]=Kzr[u]);let a=Yft(t)||Qft(t);if(a)return Sn.invalid(a);let s=dXo(r);[o,i]=S1e(t,s,r)}return new Sn({ts:o,zone:r,loc:n,o:i})}function Hzr(t,e,r){let n=ln(r.round)?!0:r.round,o=(a,s)=>(a=M7(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 Vzr(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 U7(t){if(Sn.isDateTime(t))return t;if(t&&t.valueOf&&vx(t.valueOf()))return Sn.fromJSDate(t);if(t&&typeof t=="object")return Sn.fromObject(t);throw new Lc(`Unknown datetime argument: ${t}, of type ${typeof t}`)}var gpt,kzr,Kzr,aXo,sXo,Wzr,uXo,lXo,C1e,x1e,Sn,bB=v(()=>{kle();cpt();yB();dpt();$le();R7();Mle();Rb();h1e();Izr();lpt();Fzr();ept();Tle();fB();Rle();gpt="Invalid DateTime",kzr=864e13;Kzr={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},aXo={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},sXo={ordinal:1,hour:0,minute:0,second:0,millisecond:0},Wzr=["year","month","day","hour","minute","second","millisecond"],uXo=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],lXo=["year","ordinal","hour","minute","second","millisecond"];x1e={},Sn=class t{constructor(e){let r=e.zone||Rs.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new Rh("invalid input"):null)||(r.isValid?null:Ble(r));this.ts=ln(e.ts)?Rs.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=vx(e.o)&&!e.old?e.o:r.offset(this.ts);o=v1e(this.ts,s),n=Number.isNaN(o.year)?new Rh("invalid input"):null,o=n?null:o,i=n?null:s}this._zone=r,this.loc=e.loc||As.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]=Vzr(arguments),[n,o,i,a,s,u,l]=r;return zzr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static utc(){let[e,r]=Vzr(arguments),[n,o,i,a,s,u,l]=r;return e.zone=Mh.utcInstance,zzr({year:n,month:o,day:i,hour:a,minute:s,second:u,millisecond:l},e)}static fromJSDate(e,r={}){let n=izr(e)?e.valueOf():NaN;if(Number.isNaN(n))return t.invalid("invalid input");let o=_x(r.zone,Rs.defaultZone);return o.isValid?new t({ts:n,zone:o,loc:As.fromObject(r)}):t.invalid(Ble(o))}static fromMillis(e,r={}){if(vx(e))return e<-kzr||e>kzr?t.invalid("Timestamp out of range"):new t({ts:e,zone:_x(r.zone,Rs.defaultZone),loc:As.fromObject(r)});throw new Lc(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,r={}){if(vx(e))return new t({ts:e*1e3,zone:_x(r.zone,Rs.defaultZone),loc:As.fromObject(r)});throw new Lc("fromSeconds requires a numerical input")}static fromObject(e,r={}){e=e||{};let n=_x(r.zone,Rs.defaultZone);if(!n.isValid)return t.invalid(Ble(n));let o=As.fromObject(r),i=j7(e,Uzr),{minDaysInFirstWeek:a,startOfWeek:s}=Xft(i,o),u=Rs.now(),l=ln(r.specificOffset)?n.offset(u):r.specificOffset,c=!ln(i.ordinal),d=!ln(i.year),f=!ln(i.month)||!ln(i.day),p=d||f,m=i.weekYear||i.weekNumber;if((p||c)&&m)throw new gx("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(f&&c)throw new gx("Can't mix ordinal dates with month/day");let h=m||i.weekday&&!p,g,y,b=v1e(u,l);h?(g=uXo,y=aXo,b=Ale(b,a,s)):c?(g=lXo,y=sXo,b=b1e(b)):(g=Wzr,y=Kzr);let _=!1;for(let N of g){let D=i[N];ln(D)?_?i[N]=y[N]:i[N]=b[N]:_=!0}let w=h?rzr(i,a,s):c?nzr(i):Yft(i),x=w||Qft(i);if(x)return t.invalid(x);let O=h?Gft(i,a,s):c?Zft(i):i,[E,T]=S1e(O,l,n),R=new t({ts:E,zone:n,o:T,loc:o});return i.weekday&&p&&e.weekday!==R.weekday?t.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${R.toISO()}`):R.isValid?R:t.invalid(R.invalid)}static fromISO(e,r={}){let[n,o]=vzr(e);return z7(n,o,r,"ISO 8601",e)}static fromRFC2822(e,r={}){let[n,o]=wzr(e);return z7(n,o,r,"RFC 2822",e)}static fromHTTP(e,r={}){let[n,o]=Szr(e);return z7(n,o,r,"HTTP",r)}static fromFormat(e,r,n={}){if(ln(e)||ln(r))throw new Lc("fromFormat requires an input string and a format");let{locale:o=null,numberingSystem:i=null}=n,a=As.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0}),[s,u,l,c]=Lzr(a,e,r);return c?t.invalid(c):z7(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]=Ozr(e);return z7(n,o,r,"SQL",e)}static invalid(e,r=null){if(!e)throw new Lc("need to specify a reason the DateTime is invalid");let n=e instanceof Rh?e:new Rh(e,r);if(Rs.throwOnInvalid)throw new n1e(n);return new t({invalid:n})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,r={}){let n=hpt(e,As.fromObject(r));return n?n.map(o=>o?o.val:null).join(""):null}static expandFormat(e,r={}){return ppt(Ah.parseFormat(e),As.fromObject(r)).map(o=>o.val).join("")}static resetCache(){C1e=void 0,x1e={}}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?ypt(this).weekYear:NaN}get weekNumber(){return this.isValid?ypt(this).weekNumber:NaN}get weekday(){return this.isValid?ypt(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?bpt(this).weekday:NaN}get localWeekNumber(){return this.isValid?bpt(this).weekNumber:NaN}get localWeekYear(){return this.isValid?bpt(this).weekYear:NaN}get ordinal(){return this.isValid?b1e(this.c).ordinal:NaN}get monthShort(){return this.isValid?KD.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?KD.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?KD.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?KD.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=P7(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=v1e(u,a),d=v1e(l,s);return c.hour===d.hour&&c.minute===d.minute&&c.second===d.second&&c.millisecond===d.millisecond?[fJ(this,{ts:u}),fJ(this,{ts:l})]:[this]}get isInLeapYear(){return cJ(this.year)}get daysInMonth(){return N7(this.year,this.month)}get daysInYear(){return this.isValid?_B(this.year):NaN}get weeksInWeekYear(){return this.isValid?lJ(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?lJ(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:r,numberingSystem:n,calendar:o}=Ah.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:r,numberingSystem:n,outputCalendar:o}}toUTC(e=0,r={}){return this.setZone(Mh.instance(e),r)}toLocal(){return this.setZone(Rs.defaultZone)}setZone(e,{keepLocalTime:r=!1,keepCalendarTime:n=!1}={}){if(e=_x(e,Rs.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]=S1e(a,i,e)}return fJ(this,{ts:o,zone:e})}else return t.invalid(Ble(e))}reconfigure({locale:e,numberingSystem:r,outputCalendar:n}={}){let o=this.loc.clone({locale:e,numberingSystem:r,outputCalendar:n});return fJ(this,{loc:o})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let r=j7(e,Uzr),{minDaysInFirstWeek:n,startOfWeek:o}=Xft(r,this.loc),i=!ln(r.weekYear)||!ln(r.weekNumber)||!ln(r.weekday),a=!ln(r.ordinal),s=!ln(r.year),u=!ln(r.month)||!ln(r.day),l=s||u,c=r.weekYear||r.weekNumber;if((l||a)&&c)throw new gx("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&a)throw new gx("Can't mix ordinal dates with month/day");let d;i?d=Gft({...Ale(this.c,n,o),...r},n,o):ln(r.ordinal)?(d={...this.toObject(),...r},ln(r.day)&&(d.day=Math.min(N7(d.year,d.month),d.day))):d=Zft({...b1e(this.c),...r});let[f,p]=S1e(d,this.o,this.zone);return fJ(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let r=yc.fromDurationLike(e);return fJ(this,qzr(this,r))}minus(e){if(!this.isValid)return this;let r=yc.fromDurationLike(e).negate();return fJ(this,qzr(this,r))}startOf(e,{useLocaleWeeks:r=!1}={}){if(!this.isValid)return this;let n={},o=yc.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?Ah.create(this.loc.redefaultToEN(r)).formatDateTimeFromString(this,e):gpt}toLocaleString(e=pB,r={}){return this.isValid?Ah.create(this.loc.clone(r),e).formatDateTime(this):gpt}toLocaleParts(e={}){return this.isValid?Ah.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=_pt(this,a);return s+="T",s+=Bzr(this,a,r,n,o,i),s}toISODate({format:e="extended"}={}){return this.isValid?_pt(this,e==="extended"):null}toISOWeekDate(){return w1e(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":"")+Bzr(this,a==="extended",r,e,n,i):null}toRFC2822(){return w1e(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return w1e(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?_pt(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")),w1e(this,o,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():gpt}[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 yc.invalid("created by diffing an invalid DateTime");let o={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=azr(r).map(yc.normalizeUnit),a=e.valueOf()>this.valueOf(),s=a?this:e,u=a?e:this,l=Azr(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?JD.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),Hzr(r,this.plus(n),{...e,numeric:"always",units:o,unit:i})}toRelativeCalendar(e={}){return this.isValid?Hzr(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 Lc("min requires all arguments be DateTimes");return tpt(e,r=>r.valueOf(),Math.min)}static max(...e){if(!e.every(t.isDateTime))throw new Lc("max requires all arguments be DateTimes");return tpt(e,r=>r.valueOf(),Math.max)}static fromFormatExplain(e,r,n={}){let{locale:o=null,numberingSystem:i=null}=n,a=As.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});return mpt(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=As.fromOpts({locale:n,numberingSystem:o,defaultToEN:!0});return new qle(i,e)}static fromFormatParser(e,r,n={}){if(ln(e)||ln(r))throw new Lc("fromFormatParser requires an input string and a format parser");let{locale:o=null,numberingSystem:i=null}=n,a=As.fromOpts({locale:o,numberingSystem:i,defaultToEN:!0});if(!a.equals(r.locale))throw new Lc(`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):z7(s,u,n,`format ${r.format}`,e,l)}static get DATE_SHORT(){return pB}static get DATE_MED(){return sle}static get DATE_MED_WITH_WEEKDAY(){return Rft}static get DATE_FULL(){return ule}static get DATE_HUGE(){return lle}static get TIME_SIMPLE(){return cle}static get TIME_WITH_SECONDS(){return dle}static get TIME_WITH_SHORT_OFFSET(){return fle}static get TIME_WITH_LONG_OFFSET(){return ple}static get TIME_24_SIMPLE(){return mle}static get TIME_24_WITH_SECONDS(){return hle}static get TIME_24_WITH_SHORT_OFFSET(){return gle}static get TIME_24_WITH_LONG_OFFSET(){return yle}static get DATETIME_SHORT(){return ble}static get DATETIME_SHORT_WITH_SECONDS(){return _le}static get DATETIME_MED(){return vle}static get DATETIME_MED_WITH_SECONDS(){return wle}static get DATETIME_MED_WITH_WEEKDAY(){return Aft}static get DATETIME_FULL(){return Sle}static get DATETIME_FULL_WITH_SECONDS(){return Cle}static get DATETIME_HUGE(){return xle}static get DATETIME_HUGE_WITH_SECONDS(){return Ole}}});var Gzr=v(()=>{bB();kle();cpt();dpt();sJ();R7();gB();Jft();s1e();yB()});function vpt(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 fXo(t){let e=Sn.now();if(t)try{let i=vpt(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(Sn.DATETIME_FULL),localDateString:e.toISODate()||"",timezoneOffset:n,timezone:o}}function pXo(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 mXo(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 hXo(t,e){let r=t.match(/(?:the\s+)?week\s+of\s+(.+)/i);if(!r)return;let n=r[1],o=Mft(n,e.toJSDate(),{forwardDate:!1});if(o.length===0)return;let i=Sn.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 gXo(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=Zzr[r[1]],o=e.year;n>e.month&&o--;let i=Sn.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 yXo(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=Sn.fromObject({year:n,month:1,day:1}),i=Sn.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 bXo(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=Sn.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 _Xo(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=Zzr[r[1].toLowerCase()],o=parseInt(r[2]),i=Sn.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 vXo(t){let e=Sn.now(),r=t.toLowerCase().replace("@vault","").trim(),n=pXo(r,e)||mXo(r,e)||hXo(r,e)||gXo(r,e)||_Xo(r,e)||bXo(r,e)||yXo(r,e);if(n)return{startTime:Ule(n.start),endTime:Ule(n.end)};let o=Mft(t,e.toJSDate(),{forwardDate:!1});if(o.length>0){let i=Sn.fromJSDate(o[0].start.date()).startOf("day"),a=o[0].end?Sn.fromJSDate(o[0].end.date()).endOf("day"):i.endOf("day");return i>e&&(i.minus({years:1}),a.minus({years:1})),{startTime:Ule(i),endTime:Ule(a)}}console.warn(`Unable to parse time expression: ${t}`)}function Ule(t){let e=t.toJSDate(),r=t.offset,n=t.offsetNameShort||"Unknown";return{epoch:Math.floor(e.getTime()),isoString:e.toISOString(),userLocaleString:t.toLocaleString(Sn.DATETIME_FULL),localDateString:t.toISODate()||"",timezoneOffset:r,timezone:n}}function wXo(t){let e=t.toString().length===10?t*1e3:t,r=Sn.fromMillis(e);return Ule(r)}async function SXo(t,e,r){let n=vpt(e),o=vpt(r);try{let i=Sn.now().setZone(n),a=DUr(t,i.toJSDate());if(!a)throw new Error(`Could not parse time: ${t}`);let s=Sn.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(Sn.DATETIME_FULL),localDateString:u.toISODate()||"",timezoneOffset:c,timezone:u.offsetNameShort||o,originalTime:s.toLocaleString(Sn.TIME_SIMPLE)+" "+s.offsetNameShort,convertedTime:u.toLocaleString(Sn.TIME_SIMPLE)+" "+u.offsetNameShort}}catch(i){throw new Error(`Failed to convert time: ${i.message}`)}}var O1e,Zzr,T1e,E1e,P1e,wpt=v(()=>{$Ur();Gzr();yI();bI();O1e=Gl({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})=>fXo(t),isBackground:!0}),Zzr={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};T1e=Gl({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})=>vXo(t),isBackground:!0});E1e=Gl({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})=>wXo(t),isBackground:!0});P1e=Gl({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})=>SXo(t,e,r),isBackground:!0})});var H7,CB,M1e=v(()=>{H7=require("obsidian");Dt();Pt();wr();$s();CB=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 H7.TFile?this.recentConversationsContent=await this.app.vault.read(e):(this.recentConversationsContent="",J("[UserMemoryManager] Recent Conversations file not found, skipping memory load"));let r=this.app.vault.getAbstractFileByPath(this.getSavedMemoriesFilePath());r instanceof H7.TFile?this.savedMemoriesContent=await this.app.vault.read(r):(this.savedMemoriesContent="",J("[UserMemoryManager] Saved Memories file not found, skipping saved memory load"))}catch(e){ue("[UserMemoryManager] Error reading memory files:",e),this.recentConversationsContent="",this.savedMemoriesContent=""}}addRecentConversation(e,r){if(!ce().enableRecentConversations){Ot("[UserMemoryManager] Recent history referencing is disabled, skipping analysis");return}if(e.length===0){Ot("[UserMemoryManager] No messages to analyze for user memory");return}this.updateMemory(e,r).catch(o=>{ue("[UserMemoryManager] Background user memory operation failed:",o)})}async updateSavedMemory(e,r){if(!ce().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=ce(),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 ue("[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){J("[UserMemoryManager] Memory update already in progress, skipping.");return}this.isUpdatingMemory=!0;try{if(await this.ensureMemoryFolderExists(),!r){ue("[UserMemoryManager] No chat model available, skipping memory update");return}if(e.length===0){J("[UserMemoryManager] No messages available, skipping memory update");return}let n=await this.createConversationSection(e,r);await this.addToRecentConversationsFile(this.getRecentConversationFilePath(),n)}catch(n){ue("[UserMemoryManager] Error analyzing chat messages for user memory:",n)}finally{this.isUpdatingMemory=!1}}async ensureMemoryFolderExists(){let r=ce().memoryFolderName;await ty(r)}getRecentConversationFilePath(){return`${ce().memoryFolderName}/Recent Conversations.md`}getSavedMemoriesFilePath(){return`${ce().memoryFolderName}/Saved Memories.md`}async updateSavedMemoryFile(e,r,n){let o=this.app.vault.getAbstractFileByPath(e),i=o instanceof H7.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 Ym(a),new su(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 H7.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 H7.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=ce().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 Ym(o),new su(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 ue("[UserMemoryManager] Failed to parse LLM response as JSON:",c),{title:"Untitled Conversation",summary:"Summary generation failed"}}}catch(s){return ue("[UserMemoryManager] Failed to extract title and summary:",s),{title:"Untitled Conversation",summary:"Summary generation failed"}}}}});var CXo,R1e,Spt=v(()=>{yI();bI();M1e();Dt();hue();CXo=Ct.object({statement:Ct.string().min(1).describe("The user statement for explicitly updating saved memories")}),R1e=Gl({name:"updateMemory",description:"Update the user memory when the user explicitly asks to update the memory",schema:CXo,handler:async({statement:t})=>{try{let e=new CB(app),r=gI.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 ue("[updateMemoryTool] Error updating memory:",e),{success:!1,message:`Failed to save memory: ${e.message}`}}}})});var pJ,Cpt=v(()=>{Xq();Tu();nft();uft();wpt();Tue();wr();RS();Spt();vue();pJ=class{static initTools(e){this.tools.length===0&&(this.tools=[O1e,P1e,E1e,T1e,Mue,aBr,Rue,WNe(e.getRoot())])}static async analyzeIntent(e){try{let r=await Ru.getInstance().broca(e,Jz());if(!r?.response)throw new Error(r?.detail||"Broca API call failed");let n=r.response.tool_calls,o=r.response.salience_terms,i=[],a;for(let s of n){let u=this.tools.find(l=>l.name===s.tool);if(u){let l=s.args||{};if(u.name==="getTimeRangeMs"&&(a=await _I.callTool(u,l)),u.name=="getFileTree"&&Jz())continue;i.push({tool:u,args:l})}}return await this.processAtCommands(e,i,{timeRange:a,salientTerms:o}),i}catch(r){throw console.error("Error in intent analysis:",r),r}}static async processAtCommands(e,r,n){let o=e.toLowerCase(),{timeRange:i,salientTerms:a}=n;if(o.includes("@vault")){let s=this.removeAtCommands(e);r.push({tool:Mue,args:{timeRange:i||void 0,query:s,salientTerms:a}})}if(o.includes("@websearch")||o.includes("@web")){let s=this.removeAtCommands(e),l=await Rg.instance.getCurrentChainManager().memoryManager.getMemory().loadMemoryVariables({}),c=U6(l);r.push({tool:Rue,args:{query:s,chatHistory:c}})}if(o.includes("@memory")){let s=this.removeAtCommands(e);r.push({tool:R1e,args:{statement:s}})}}static removeAtCommands(e){return e.split(" ").filter(r=>!Qq.includes(r.toLowerCase())).join(" ").trim()}};pJ.tools=[]});var A1e,Xzr=v(()=>{Eue();A1e=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=px.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 zle(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=xXo(r);n&&e.push({role:n,content:r.content})}}return e}function xXo(t){return t.role==="human"||t.role==="user"||t.sender==="user"?"user":t.role==="ai"||t.role==="assistant"||t.sender==="AI"?"assistant":null}function I1e(t,e){let r=zle(t);for(let n of r)e.push({role:n.role,content:n.content})}function N1e(t){return t.map(e=>{let r;return typeof e.content=="string"?r=e.content:Array.isArray(e.content)?r=e.content.filter(o=>o.type==="text").map(o=>o.text||"").join(" ")||"[Image content]":r=String(e.content||""),{role:e.role,content:r}})}var j1e=v(()=>{});function xpt(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 Yzr(t){try{let e=JSON.parse(t);return Array.isArray(e)?xpt(e):"Invalid search results format."}catch(e){return Ot("Failed to format localSearch result string:",e),"Error processing search results."}}function Qzr(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 OXo(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 TXo(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 e4r(t){if(!Array.isArray(t)||t.length===0){J("Search Results: (none)");return}let e=0,r=t.map((u,l)=>{let c=OXo(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=TXo(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;J(`Search Results (debug table): ${n} rows; in-context ${e}/${n}`),mAt(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)} |`);Lhe(["",`Results: ${n} rows; in-context ${e}/${n}`,"",i,a,...s,""])}var t4r=v(()=>{Dt()});function r4r(t,e){return[t,e].map(n=>n?.trim()).filter(n=>!!n).join(`
|
||
|
||
`)}function n4r(t,e){let r=t?`
|
||
${t}
|
||
`:"";return`<localSearch${e?` timeRange="${e}"`:""}>${r}</localSearch>`}function o4r(t,e){if(!e)return t;let r="Have inline citations according to the guidance.",n=t.trimEnd();return n?n.toLowerCase().includes(r.toLowerCase())?n:`${n}
|
||
|
||
${r}`:r}function Opt(t,e,r){let n=t.trim();if(!n)return e;let o=r?`Question: ${e}`:e;return`${n}
|
||
|
||
${o}`}function i4r(t,e){let r=e.trim();return!r||t.includes(r)?t:Opt(t,r,!0)}var Tpt=v(()=>{});var vI,D1e=v(()=>{Vdt();vue();zr();uot();Dt();$v();Pt();Qdt();Tue();Eue();wr();Cpt();vie();Xzr();j1e();bue();t4r();Tpt();wH();Pue();vI=class extends Y1{constructor(){super(...arguments);this.lastCitationSources=null}async processImageUrls(r){let n=[],o=await vH.processUrlBatch(r,n,this.chainManager.app.vault);return vH.showFailedImagesNotice(n),o}async processChatInputImages(r){let n=[],o=await vH.processChatImageBatch(r,n,this.chainManager.app.vault);return vH.showFailedImagesNotice(n),o}extractNoteContent(r){let n=/<note_context>([\s\S]*?)<\/note_context>/g,o=/<active_note>([\s\S]*?)<\/active_note>/g,i=/<content>([\s\S]*?)<\/content>/g,a="",s;for(;(s=n.exec(r))!==null;){let u=s[1],l;for(;(l=i.exec(u))!==null;)a+=l[1]+`
|
||
|
||
`}for(;(s=o.exec(r))!==null;){let u=s[1],l;for(;(l=i.exec(u))!==null;)a+=l[1]+`
|
||
|
||
`}return a.trim()}async extractEmbeddedImages(r,n){let o=/!\[\[(.*?\.(png|jpg|jpeg|gif|webp|bmp|svg))\]\]/g,i=/!\[.*?\]\(([^)]+)\)/g,a=[],s=[...r.matchAll(o)];for(let l of s){let c=l[1];if(n){let d=app.metadataCache.getFirstLinkpathDest(c,n);d?a.push(d.path):(Ot(`Could not resolve embedded image: ${c} from source: ${n}`),a.push(c))}else a.push(c)}let u=[...r.matchAll(i)];for(let l of u){let c=l[1].trim();if(!c)continue;if(c.match(/^https?:\/\//)){a.push(c);continue}let d=c.replace(/^\.\//,"").replace(/^\//,"");if(n){let f=app.metadataCache.getFirstLinkpathDest(d,n);f?a.push(f.path):a.push(d)}else a.push(d)}return a}async buildMessageContent(r,n){let o=[],i=[],a=ce(),s=[];if(a.passMarkdownImages){let d;if(n.context?.notes&&n.context.notes.length>0)d=n.context.notes[0].path;else{let p=this.chainManager.app?.workspace.getActiveFile();p&&(d=p.path)}let f=this.extractNoteContent(r);if(f){let p=await this.extractEmbeddedImages(f,d);p.length>0&&s.push({urls:p,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>
|
||
${RAt}
|
||
</OUTPUT_FORMAT>`;return`${r}
|
||
|
||
${o}`}async streamMultimodalResponse(r,n,o,i){let u=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],l=[],c=await this.getSystemPrompt();u.length>0&&(c+=`
|
||
|
||
The following is the relevant conversation history. Use this context to maintain consistency in your responses:`);let d=this.chainManager.chatModelManager.getChatModel();c&&l.push({role:wL(d),content:`${c}
|
||
IMPORTANT: Maintain consistency with previous responses in the conversation. If you've provided information about a person or topic before, use that same information in follow-up questions.`}),I1e(u,l);let f=this.chainManager.chatModelManager.getChatModel(),m=this.isMultimodalModel(f)?await this.buildMessageContent(r,n):r;l.push({role:"user",content:m});let h=m instanceof Array?m[0].text:m;J("Enhanced user message: ",h),J("Final request to AI",{messages:l.length});let g=new A1e(_I,JNe),y=await Xh(()=>this.chainManager.chatModelManager.getChatModel().stream(l,{signal:o.signal}));for await(let b of y){if(o.signal.aborted){J("CopilotPlus multimodal stream iteration aborted",{reason:o.signal.reason});break}for await(let _ of g.processChunk(b))i.processChunk(_)}}async run(r,n,o,i,a){let{updateLoadingMessage:s}=a,u=new M_(o),l=[];if(!await jS({isCopilotPlus:!0})){await this.handleError(new Error("Invalid license key"),u.processErrorChunk.bind(u));let g=u.close().content;return this.handleResponse(g,r,n,i,o,void 0)}try{J("==== Step 1: Analyzing intent ====");let g,y=r.originalMessage||r.message;try{g=await pJ.analyzeIntent(y)}catch(H){return this.handleResponse(_At(H),r,n,i,o)}let b=r.message.split(" ").filter(H=>!Qq.includes(H.toLowerCase())).join(" ").trim(),{toolOutputs:_,sources:w}=await this.executeToolCalls(g,s);l=w;let O=_.find(H=>H.tool==="localSearch"&&H.output!=null)&&l.length>0,R=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],N=zle(R),D=N1e(N),F=b;D.length>0&&(J("Condensing question"),F=await BNe(b,D),J("Condensed standalone question: ",F));let B=this.prepareEnhancedUserMessage(F,_),U=_.some(H=>H.tool!=="localSearch"&&H.output!=null);O&&!U&&(B=`Answer the question with as detailed as possible based only on the following context:
|
||
${B}`),B=this.appendComposerInstructionsIfNeeded(B,r),J("Invoking LLM with all tool results"),await this.streamMultimodalResponse(B,r,n,u)}catch(g){s?.(EO.DEFAULT),g.name==="AbortError"||n.signal.aborted?J("CopilotPlus stream aborted by user",{reason:n.signal.reason}):await this.handleError(g,u.processErrorChunk.bind(u))}if(n.signal.aborted&&n.signal.reason==="new-chat")return o(""),"";let d=u.close(),f=d.content,p={wasTruncated:d.wasTruncated,tokenUsage:d.tokenUsage??void 0},m=ce(),h=this.lastCitationSources&&this.lastCitationSources.length>0?this.lastCitationSources:(l||[]).map(g=>({title:g.title,path:g.path}));return f=FNe(f,h,m.enableInlineCitations),await this.handleResponse(f,r,n,i,o,l,void 0,p),f}getSources(r){return!r||!Array.isArray(r)?(Ot("No valid documents provided to getSources"),[]):this.sortUniqueDocsByScore(r)}sortUniqueDocsByScore(r){let n=new Map;for(let o of r){if(!o.title||!o?.score&&!o?.rerank_score){Ot("Invalid document structure:",o);continue}let i=o.path||o.title,a=n.get(i),s=o&&"rerank_score"in o,u=s?o.rerank_score:o.score;(!a||u>(a.score??0))&&n.set(i,{title:o.title,path:o.path||o.title,score:u,isReranked:s,explanation:o.explanation||null})}return Array.from(n.values()).sort((o,i)=>(i.score??0)-(o.score??0))}async executeToolCalls(r,n){let o=[],i=[];for(let a of r){J(`Step 2: Calling tool: ${a.tool.name}`),a.tool.name==="localSearch"?n?.(EO.READING_FILES):a.tool.name==="webSearch"?n?.(EO.SEARCHING_WEB):a.tool.name==="getFileTree"&&n?.(EO.READING_FILE_TREE);let s=await _I.callTool(a.tool,a.args);if(a.tool.name==="localSearch"){let l={result:typeof s=="string"?s:JSON.stringify(s),success:s!=null},c=this.getTimeExpression(r),d=this.processLocalSearchResult(l,c);i.push(...d.sources),o.push({tool:a.tool.name,output:d.formattedForLLM})}else o.push({tool:a.tool.name,output:s})}return{toolOutputs:o,sources:eB(i)}}prepareEnhancedUserMessage(r,n){let o="",i=!1,a=n.find(l=>l.tool==="localSearch"&&l.output!=null);a&&typeof a.output=="string"&&/<document>/.test(a.output)&&(i=!0);let s=n.filter(l=>l.output!=null);if(s.length>0&&(o=((i&&s.length===1?"":`
|
||
|
||
# Additional context:
|
||
|
||
`)+s.map(d=>{let f=d.output;return typeof f!="string"&&(f=JSON.stringify(f)),d.tool==="localSearch"?f:`<${d.tool}>
|
||
${f}
|
||
</${d.tool}>`}).join(`
|
||
|
||
`)).trim()),!o)return r;let u=i&&s.length===1;return Opt(o,r,u)}getTimeExpression(r){let n=r.find(o=>o.tool.name==="getTimeRangeMs");return n?n.args.timeExpression:""}prepareLocalSearchResult(r,n){let o=r.filter(m=>m.includeInContext),i=o.reduce((m,h)=>m+(h.content?.length||0),0),a=o;if(i>oHe){let m=oHe/i;J("Truncating document contents to fit context length. Truncation ratio:",m),a=o.map(h=>({...h,content:h.content?.slice(0,Math.floor((h.content?.length||0)*m))||""}))}let s=a.map((m,h)=>({...m,__sourceId:h+1,content:kNe(m.content||"")})),u=xpt(s),l=s.slice(0,Math.min(20,s.length)).map(m=>({title:m.title||m.path||"Untitled",path:m.path||m.title||""})),c=qNe(l);this.lastCitationSources=s.slice(0,Math.min(20,s.length)).map((m,h)=>({title:m.title||m.path||"Untitled",path:m.path||void 0}));let d=ce(),f=$qr(d.enableInlineCitations,c),p=r4r(f,u);return n4r(p,n)}processLocalSearchResult(r,n){let o=[],i,a;if(!r.success)return i=`<localSearch>
|
||
Search failed.
|
||
</localSearch>`,a=`Search failed: ${r.result}`,{formattedForLLM:i,formattedForDisplay:a,sources:o};try{let s=JSON.parse(r.result),u=s&&typeof s=="object"&&s.type==="local_search"&&Array.isArray(s.documents)?s.documents:null;if(!Array.isArray(u))return i=`<localSearch>
|
||
Invalid search results format.
|
||
</localSearch>`,a="Search results were in an unexpected format.",{formattedForLLM:i,formattedForDisplay:a,sources:o};e4r(u),o=Qzr(u),i=this.prepareLocalSearchResult(u,n||""),a=px.format("localSearch",i)}catch(s){Ot("Failed to parse localSearch results:",s);let u=Yzr(r.result);i=n?`<localSearch timeRange="${n}">
|
||
${u}
|
||
</localSearch>`:`<localSearch>
|
||
${u}
|
||
</localSearch>`,a=px.format("localSearch",i)}return{formattedForLLM:i,formattedForDisplay:a,sources:o}}async getSystemPrompt(){return PN(this.chainManager.userMemoryManager)}}});var Hle,a4r=v(()=>{Tu();Pt();Xq();D1e();Hle=class extends vI{async getSystemPrompt(){let e=Y0(),r=tc();if(!r)return e;let n=await Rg.instance.getProjectContext(r.id);return e=`${e}
|
||
|
||
<project_system_prompt>
|
||
${r.systemPrompt}
|
||
</project_system_prompt>`,n&&(e=`${e}
|
||
|
||
<project_context>
|
||
${n}
|
||
</project_context>`),e}}});function MXo(){return typeof app>"u"||!app?.metadataCache?null:app.metadataCache}function u4r(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 RXo(t,e,r){let n=t,o=u4r(n.getFrontmatterTags?.()),i=e?u4r(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 AXo(t){let e=t,r=JSON.stringify(e);if(r.length<=Ept)return e;let n=e.tags.length;for(;r.length>Ept&&n>s4r;)n=Math.max(s4r,Math.floor(n/2)),e={...e,tags:t.tags.slice(0,n),returnedTagCount:n,truncated:!0},r=JSON.stringify(e);return r.length>Ept?{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 l4r(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 Ept,EXo,s4r,PXo,c4r,d4r=v(()=>{yI();bI();Ept=5e5,EXo=500,s4r=50,PXo=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.");c4r=()=>Gl({name:"getTagList",description:"Get the list of tags in the vault with occurrence statistics.",schema:PXo,handler:async t=>{let e=MXo(),r=t?.includeInline??!0,n=t?.maxEntries??EXo;if(!e)return l4r({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=RXo(e,r,n),i=AXo(o);return l4r(i)},isBackground:!0})});function $1e(t){return t.replace(/\\/g,"/").toLowerCase()}function IXo(t){return t.replace(/\.[^/.]+$/,"")}function NXo(t,e){if(e.length===0)return!1;let n=$1e(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=IXo(s);if(!s.includes(a)&&!u.includes(a))return!1}else if(!s.includes(a))return!1}return!0}function Mpt(t){return/\.[^/]+$/.test(t)}async function jXo(t){let e=b=>{let _=app.vault.getAbstractFileByPath(b);return _ instanceof Vle.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(!Mpt(b))for(let w of[".md",".canvas"]){let x=e(`${b}${w}`);if(x)return{type:"resolved",file:x}}}let c=app.metadataCache,d=u.trim();if(c&&d){let b=new Set([d]);if(!Mpt(d))for(let _ of[".md",".canvas"])b.add(`${d}${_}`);for(let _ of b){let w=c.getFirstLinkpathDest?.(_,"");if(w instanceof Vle.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=$1e(d),m=new Set([p]);if(!Mpt(d))for(let b of[".md",".canvas"])m.add($1e(`${d}${b}`));for(let b of f){let _=$1e(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 g=p.split("/").filter(Boolean);if(g.length===0)return{type:"not_found"};let y=f.filter(b=>NXo(b.path,g));return y.length===1?{type:"resolved",file:y[0]}:y.length>1?{type:"not_unique",matches:y}:{type:"not_found"}}async function DXo(t){try{return await app.vault.cachedRead(t)}catch(e){return Ot(`readNote: failed to read ${t.path}`,e),""}}function $Xo(){let t=new Map,e=app.vault.getMarkdownFiles?.()??[];for(let r of e)if(r instanceof Vle.TFile){let n=t.get(r.basename)??[];n.push(r),t.set(r.basename,n)}return t}function LXo(t,e,r){let n=t.trim();if(!n)return[];let o=new Map,i=app.metadataCache.getFirstLinkpathDest?.(n,e);if(i instanceof Vle.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 FXo(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=$Xo());let p=LXo(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 kXo(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/Ppt),i=[];for(let a=0;a<o;a++){let s=a*Ppt,u=Math.min((a+1)*Ppt,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 Vle,Ppt,qXo,f4r,p4r=v(()=>{Vle=require("obsidian");yI();Dt();bI();Ppt=200;qXo=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.")}),f4r=Gl({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:qXo,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 jXo(r);if(n.type==="not_found")return Ot(`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 Ot(`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 DXo(o),s=kXo(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];J(`readNote: returning chunk ${l.chunkIndex} of ${u} for ${i}`);let c=l.chunkIndex<u-1,d=FXo(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}}})});var V_,Jle=v(()=>{V_=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()}}});var m4r,h4r,g4r=v(()=>{RS();wr();yI();bI();m4r=5e4,h4r=Gl({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>m4r)return JSON.stringify({success:!1,message:`Input too long: Maximum allowed length is ${m4r} characters`});let r=TAt(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 Ru.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 UXo(t){V_.getInstance().register({tool:WNe(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
|
||
- Use this tool when the user asks for the vault structure, or a specific file or folder but you are unsure about the exact path.
|
||
- Use this tool too look up folders when user asks to create new notes under a folder.
|
||
- Use this tool to look up files under certain folders.
|
||
- 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>`}})}function zXo(){V_.getInstance().register({tool:c4r(),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 HXo(){V_.getInstance().register({tool:R1e,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 L1e(t){let e=V_.getInstance(),r=ce(),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(BXo),t&&(UXo(t),zXo()),r.enableSavedMemory&&HXo())}var BXo,Rpt=v(()=>{Pt();Qdt();nft();d4r();Spt();p4r();uft();wpt();Jle();g4r();BXo=[{tool:Mue,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:Rue,metadata:{id:"webSearch",displayName:"Web Search",description:"Search the internet for information",category:"search",copilotCommands:["@websearch","@web"],customPromptInstructions:`For webSearch:
|
||
- Only use when the user explicitly requests web/internet search
|
||
- Always provide an empty chatHistory array
|
||
|
||
Example usage:
|
||
<use_tool>
|
||
<name>webSearch</name>
|
||
<query>piano learning techniques</query>
|
||
<chatHistory>[]</chatHistory>
|
||
</use_tool>`}},{tool:O1e,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):
|
||
|
||
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:E1e,metadata:{id:"getTimeInfoByEpoch",displayName:"Get Time Info",description:"Convert epoch timestamp to human-readable format",category:"time",isAlwaysEnabled:!0}},{tool:T1e,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:P1e,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:f4r,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.
|
||
|
||
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:JNe,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
|
||
|
||
Example usage:
|
||
<use_tool>
|
||
<name>writeToFile</name>
|
||
<path>path/to/note.md</path>
|
||
<content>FULL CONTENT OF THE NOTE</content>
|
||
</use_tool>`}},{tool:nBr,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:h4r,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>`}}]});function Dpt(t){return t.map(e=>e.content).filter(e=>e&&e.trim().length>0).join(`
|
||
|
||
`)}function F1e(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 jpt,mJ,Apt,Ipt,Npt,V7,k1e=v(()=>{Dt();jpt=50;mJ=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 Dpt(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/settings/model.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
|
||
When creating a new file in given folder, you must use the getFileTree tool to confirm folder first unless user explicitly ask to create new folders
|
||
|
||
Example for "create a new note in the projects folder":
|
||
1. Call getFileTree to get the exact folder path
|
||
2. Use writeToFile with the folder path
|
||
|
||
Example for "create a new note about topic X":
|
||
1. Use writeToFile with the path "topicX.md" for creating the note in the root folder
|
||
`}),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
|
||
- Only use web search if: the query explicitly asks for web search, OR the query explicitly requires current/web information
|
||
- 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}},Apt=class extends mJ{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}},Ipt=class extends mJ{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>jpt}},Npt=class extends mJ{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
|
||
|
||
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}},V7=class{static createAdapter(e){let r=(e.modelName||e.model||"").toLowerCase();if(J(`Creating model adapter for: ${r}`),r.includes("gpt")){let n=new Apt(r);return n.isGPT5Model()?J("Using GPTModelAdapter with GPT-5 specific enhancements"):J("Using GPTModelAdapter"),n}return r.includes("claude")?(J("Using ClaudeModelAdapter"),new Ipt(r)):r.includes("gemini")||r.includes("google/gemini")?(J("Using GeminiModelAdapter"),new Npt(r)):r.includes("copilot-plus")?(J("Using BaseModelAdapter for Copilot Plus"),new mJ(r)):(J("Using BaseModelAdapter (default)"),new mJ(r))}}});function VXo(t){let{systemSections:e,rawHistory:r,adapterName:n,originalUserMessage:o,enhancedUserMessage:i}=t,a=[...e];if(r&&r.length>0){let u=zle(r);if(u.length>0){let c=N1e(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 JXo(t){return t.map(e=>`${`[Section: ${e.label} | Source: ${e.source}]`}
|
||
${e.content}`).join(`
|
||
|
||
`)}function y4r(t){let e=VXo(t),r=JXo(e),n=Dpt(t.systemSections);return{sections:e,annotatedPrompt:r,systemPrompt:n}}var b4r=v(()=>{k1e();j1e()});async function KXo(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=F1e(s.message),m=r.enhanceUserMessage(s.message,p);return y4r({systemSections:u,rawHistory:d,adapterName:r.constructor?.name||"ModelAdapter",originalUserMessage:f,enhancedUserMessage:m})}async function WXo(t){return PN(t.userMemoryManager)}async function _4r(t){let{chainManager:e,adapter:r,availableTools:n,toolDescriptions:o,userMessage:i}=t,a=V_.getInstance(),s=n.map(c=>c.name),u=n.map(c=>a.getToolMetadata(c.name)).filter(c=>c!==void 0),l=await WXo(e);return KXo({chainManager:e,adapter:r,basePrompt:l,toolDescriptions:o,toolNames:s,toolMetadata:u,userMessage:i})}var v4r=v(()=>{Pt();Jle();k1e();b4r()});function GXo(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 w4r(t){let{messages:e,modelName:r}=t;try{J7={timestamp:new Date().toISOString(),modelName:r,serializedMessages:GXo(e)}}catch{J7={timestamp:new Date().toISOString(),modelName:r,serializedMessages:String(e)}}}function K7(){J7=null}async function q1e(){if(!J7)return;let{timestamp:t,modelName:e,serializedMessages:r}=J7,n=[`### Agent Prompt Payload \u2014 ${t}${e?` (model: ${e})`:""}`];Lhe([...n,"```json",r,"```",""]),J7=null}var J7,W7=v(()=>{Dt();J7=null});function B1e(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){Ot("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]=$pt(p,f))}a||Ot(`Detected partial tool call block for tool "${s}" - treating as best effort parse`),e.push({name:s,args:u})}}}catch(r){return ue("Error parsing XML tool calls:",r),[]}return e}function $pt(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 $pt(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,$pt(u)])}return i.length>0?Object.fromEntries(i):t}function S4r(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 Kle(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 Lpt=v(()=>{Dt()});var Wle,C4r=v(()=>{Dt();$v();Pt();Rpt();bI();Jle();Eue();wr();NOe();$s();D1e();j1e();k1e();wH();bie();Pue();Tpt();v4r();W7();Lpt();Wle=class t extends vI{constructor(){super(...arguments);this.llmFormattedMessages=[];this.lastDisplayedContent=""}getAvailableTools(){let r=ce(),n=V_.getInstance();n.getAllTools().length===0&&L1e(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=eBr(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 PN(o),a=t.generateToolDescriptions(r),s=r.map(c=>c.name),u=V_.getInstance(),l=r.map(c=>u.getToolMetadata(c.name)).filter(c=>c!==void 0);return n.enhanceSystemPrompt(i,a,s,l)}async generateSystemPrompt(){let r=this.getAvailableTools(),n=this.chainManager.chatModelManager.getChatModel(),o=V7.createAdapter(n);return t.generateSystemPrompt(r,o,this.chainManager.userMemoryManager)}async buildToolPromptDebugReport(r){let n=this.getAvailableTools(),o=V7.createAdapter(this.chainManager.chatModelManager.getChatModel()),i=t.generateToolDescriptions(n);return _4r({chainManager:this.chainManager,adapter:o,availableTools:n,toolDescriptions:i,userMessage:r})}applyCiCOrderingToLocalSearchResult(r,n){let o=ce(),i=o4r(n,!!o?.enableInlineCitations);return i4r(r,i)}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 jS({isAutonomousAgent:!0}),c=this.chainManager.chatModelManager.getChatModel(),d=V7.createAdapter(c),f=new M_(o,d);if(!l){await this.handleError(new Error("Invalid license key"),f.processErrorChunk.bind(f));let h=f.close().content;return this.handleResponse(h,r,n,i,o,void 0)}let p=c?.modelName,m=await this.prepareAgentConversation(r,d,c);try{let h=await this.executeAgentLoop({...m,adapter:d,abortController:n,updateCurrentAiMessage:o});s=h.fullAIResponse,u=h.responseMetadata,m.iterationHistory=h.iterationHistory,m.collectedSources=h.collectedSources,this.llmFormattedMessages=h.llmMessages}catch(h){if(h.name==="AbortError"||n.signal.aborted)J("Autonomous agent stream aborted by user",{reason:n.signal.reason});else{ue("Autonomous agent failed, falling back to regular Plus mode:",h);try{return await new vI(this.chainManager).run(r,n,o,i,a)}catch(g){ue("Fallback to regular Plus mode also failed:",g),this.lastDisplayedContent&&f.processChunk({content:this.lastDisplayedContent});let y=Eo(h),b=`
|
||
|
||
Fallback to regular Plus mode also failed: `+Eo(g);return await this.handleError(new Error(y+b),f.processErrorChunk.bind(f)),s=f.close().content,this.handleResponse(s,r,n,i,o,void 0,s)}}}return await this.finalizeAgentRun({...m,userMessage:r,abortController:n,addMessage:i,updateCurrentAiMessage:o,modelNameForLog:p,responseMetadata:u,fullAIResponse:s})}async prepareAgentConversation(r,n,o){let i=[],a=[],s=[],l={availableTools:this.getAvailableTools(),getTemporaryToolCallId:this.getTemporaryToolCallId.bind(this),processLocalSearchResult:this.processLocalSearchResult.bind(this),applyCiCOrderingToLocalSearchResult:this.applyCiCOrderingToLocalSearchResult.bind(this)},f=(await this.chainManager.memoryManager.getMemory().loadMemoryVariables({})).history||[],p=await this.generateSystemPrompt();p&&i.push({role:wL(o),content:p}),I1e(f,i);let m=this.isMultimodalModel(o),h=F1e(r.message),g=n.enhanceUserMessage(r.message,h),y=m?await this.buildMessageContent(g,r):g;return i.push({role:"user",content:y}),{conversationMessages:i,iterationHistory:a,collectedSources:s,originalUserPrompt:r.originalMessage||r.message,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=ce().autonomousAgentMaxIterations,g=0,y="",b;for(;g<h&&!this.isAbortRequested(l);){g+=1,J(`=== Autonomous Agent Iteration ${g} ===`);let _=[],w=await this.streamResponse(n,l,H=>this.updateStreamingDisplay(H,d,_,c,s),u);b={wasTruncated:w.wasTruncated,tokenUsage:w.tokenUsage??void 0};let x=w.content;if(!x)break;let O=B1e(x),E=u.detectPrematureResponse?.(x);if(E?.hasPremature&&g===1&&(E.type==="before"?(Ot("\u26A0\uFE0F Model provided premature response BEFORE tool calls!"),Ot("Sanitizing response to keep only tool calls for first iteration")):E.type==="after"&&(Ot("\u26A0\uFE0F Model provided hallucinated response AFTER tool calls!"),Ot("Truncating response at last tool call for first iteration"))),O.length===0){let H=Kle(x),G=[...d];H.trim()&&G.push(H),y=G.join(`
|
||
|
||
`);let ie=AOe(x);n.push({role:"assistant",content:ie}),p.push(x);break}let T=x;u.sanitizeResponse&&E?.hasPremature&&(T=u.sanitizeResponse(x,g));let R=Kle(T);R.trim()&&d.push(R);let N=[],D=new Map;_.splice(O.length);for(let H=0;H<O.length;H+=1){let G=O[H];if(this.isAbortRequested(l))break;ift(G,g);let oe=m.find(re=>re.name===G.name)?.isBackground||!1,z;if(!oe){let re=g7(G.name),Z=nJ(G.name);if(G.name==="readNote"){let j=typeof G.args?.notePath=="string"?G.args.notePath:null;j&&j.trim().length>0&&(Z=KNe(j))}let $=iBr(G.name);z=`${G.name}-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,D.set(H,z);let q=IOe(z,G.name,Z,re,$||"",!0,"",""),Y=_.findIndex(j=>j.includes(s.getTemporaryToolCallId(G.name,H)));Y!==-1?_[Y]=q:(_.push(q),Ot("Created tool call marker for tool call that was not created during streaming",G.name)),c([...d,..._].join(`
|
||
|
||
`))}let Q=await oft(G,m,a);if(Q.success||(Q.displayResult=rG(Q.result,"Tool execution failed")),G.name==="localSearch"){if(Q.success){let re=s.processLocalSearchResult(Q);f.push(...re.sources),Q.result=s.applyCiCOrderingToLocalSearchResult(re.formattedForLLM,a||""),Q.displayResult=re.formattedForDisplay}}else G.name==="readNote"&&Q.success&&(Q.displayResult=px.format("readNote",Q.result));if(N.push(Q),z&&!oe){let re=_.findIndex(Z=>Z.includes(z));re!==-1&&(_[re]=got(_[re],z,Q.displayResult??Q.result)),c([...d,..._].join(`
|
||
|
||
`))}aft(G.name,Q)}_.length>0&&d.push(_.join(`
|
||
`));let F=T;if(p.push(F),N.length>0){let H=bot(N,!0);H&&p.push(H)}let B=AOe(T);n.push({role:"assistant",content:B});let U=bot(N,!1);n.push({role:"user",content:U}),J("Tool results added to conversation")}if(g>=h&&!y){Ot(`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.`;y=d.join(`
|
||
|
||
`)+_,n.push({role:"assistant",content:y})}return{fullAIResponse:y,responseMetadata:b,iterationHistory:d,collectedSources:f,llmMessages:p}}updateStreamingDisplay(r,n,o,i,a){let s=Kle(r),u=[...n];s.trim()&&u.push(s);let l=B1e(r),c=new Set(a.availableTools.filter(h=>h.isBackground).map(h=>h.name)),d=[];l.forEach(h=>{c.has(h.name)||d.push(h.name)});let f=S4r(r);if(f){let h=r.lastIndexOf(f);r.length-h>jpt&&d.push(f)}Array.from(new Set(d)).forEach((h,g)=>{let y=a.getTemporaryToolCallId(h,g);if(o.findIndex(w=>w.includes(y))!==-1)return;let _=IOe(y,h,nJ(h),g7(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=eB(i);!p&&o.length>0&&(Ot("fullAIResponse was empty, using iteration history"),p=o.join(`
|
||
|
||
`)),n.length>0&&w4r({messages:[...n],modelName:c}),await Promise.resolve().then(()=>(bie(),yot));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=new M_(o,i),s=2,u=0;for(;u<=s;)try{let c=r.map(p=>p.role==="user"?new su(p.content):new li(p.content)),d=await Xh(()=>this.chainManager.chatModelManager.getChatModel().stream(c,{signal:n.signal}));for await(let p of d){if(n.signal.aborted)break;a.processChunk(p)}let f=a.close();return{content:f.content,wasTruncated:f.wasTruncated,tokenUsage:f.tokenUsage}}catch(c){if(c.name==="AbortError"||n.signal.aborted){let f=a.close();return{content:f.content,wasTruncated:f.wasTruncated,tokenUsage:f.tokenUsage}}if((c?.message?.includes("overloaded")||c?.message?.includes("Overloaded")||c?.error?.type==="overloaded_error")&&u<s){u++,J(`Retrying autonomous agent request (attempt ${u}/${s+1}) due to overloaded error`),await new Promise(f=>setTimeout(f,1e3*u));continue}throw c}let l=a.close();return{content:l.content,wasTruncated:l.wasTruncated,tokenUsage:l.tokenUsage}}}});var x4r=v(()=>{vie();Xhr();qqr();D1e();a4r();C4r();wH();Lpt();Pue()});var ZXo,O4r,XXo,T4r,YXo,E4r,QXo,P4r,U1e=v(()=>{Tv();ZXo=`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:`,O4r=new uu({inputVariables:["summary","new_lines"],template:ZXo}),XXo=`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:`,T4r=new uu({inputVariables:["entities","history","input"],template:XXo}),YXo=`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:`,E4r=new uu({inputVariables:["history","input"],template:YXo}),QXo=`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):`,P4r=new uu({inputVariables:["entity","summary","history","input"],template:QXo})});var eYo,tYo,M4r,Gle,Fpt=v(()=>{Do();V$();V0();G$();$s();eYo={};Et(eYo,{BaseChatMessageHistory:()=>tYo,BaseListChatMessageHistory:()=>M4r,InMemoryChatMessageHistory:()=>Gle});tYo=class extends Vh{async addMessages(t){for(let e of t)await this.addMessage(e)}},M4r=class extends Vh{addUserMessage(t){return this.addMessage(new su(t))}addAIMessage(t){return this.addMessage(new li(t))}async addMessages(t){for(let e of t)await this.addMessage(e)}clear(){throw new Error("Not implemented.")}},Gle=class extends M4r{constructor(e){super(...arguments);M(this,"lc_namespace",["langchain","stores","message","in_memory"]);M(this,"messages",[]);this.messages=e??[]}async getMessages(){return this.messages}async addMessage(e){this.messages.push(e)}async clear(){this.messages=[]}}});function z1e(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 rYo,hJ,R4r,gJ,Zle,Xle=v(()=>{Do();rYo={};Et(rYo,{BaseMemory:()=>hJ,getInputValue:()=>gJ,getOutputValue:()=>Zle,getPromptInputKey:()=>z1e});hJ=class{},R4r=(t,e)=>{if(e!==void 0)return t[e];let r=Object.keys(t);if(r.length===1)return t[r[0]]},gJ=(t,e)=>{let r=R4r(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},Zle=(t,e)=>{let r=R4r(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 nYo,Ab,xB=v(()=>{Rhe();Fpt();Xle();nYo={};I6(nYo,{BaseChatMemory:()=>Ab});Ab=class extends hJ{constructor(e){super();M(this,"chatHistory");M(this,"returnMessages",!1);M(this,"inputKey");M(this,"outputKey");this.chatHistory=e?.chatHistory??new Gle,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(gJ(e,this.inputKey)),await this.chatHistory.addAIMessage(Zle(r,this.outputKey))}async clear(){await this.chatHistory.clear()}}});function kpt(t,e){let r=new Set;for(let n of e)t.has(n)&&r.add(n);return r}function A4r(t,e){let r=new Set(t);for(let n of e)r.add(n);return r}function Yle(t,e){let r=new Set(t);for(let n of e)r.delete(n);return r}var I4r=v(()=>{});var qpt={};Xn(qpt,{SequentialChain:()=>oYo,SimpleSequentialChain:()=>iYo});function Qle(t){return Array.from(t).map(e=>`"${e}"`).join(", ")}var oYo,iYo,Bpt=v(()=>{G7();I4r();oYo=class N4r extends jy{constructor(r){super(r);M(this,"chains");M(this,"inputVariables");M(this,"outputVariables");M(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=kpt(n,o);if(i.size>0)throw new Error(`The following keys: ${Qle(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=A4r(n,o);for(let s of this.chains){let u=Yle(new Set(s.inputKeys),a);if(s.memory&&(u=Yle(u,new Set(s.memory.memoryKeys))),u.size>0)throw new Error(`Missing variables for chain "${s._chainType()}": ${Qle(u)}. Only got the following variables: ${Qle(a)}.`);let l=new Set(s.outputKeys),c=kpt(a,l);if(c.size>0)throw new Error(`The following output variables for chain "${s._chainType()}" are overlapping: ${Qle(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=Yle(a,n);this.outputVariables=Array.from(s)}else this.outputVariables=this.chains[this.chains.length-1].outputKeys;else{let s=Yle(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: ${Qle(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 jy.deserialize(s);n.push(u)}return new N4r({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}}},iYo=class j4r extends jy{constructor(r){super(r);M(this,"chains");M(this,"inputKey","input");M(this,"outputKey","output");M(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 jy.deserialize(i);n.push(a)}return new j4r({chains:n})}serialize(){let r=[];for(let n of this.chains)r.push(n.serialize());return{_type:this._chainType(),chains:r}}}});var V1e={};Xn(V1e,{MapReduceDocumentsChain:()=>$4r,RefineDocumentsChain:()=>F4r,StuffDocumentsChain:()=>H1e});var H1e,$4r,F4r,ece=v(()=>{G7();yJ();Tv();H1e=class D4r extends jy{constructor(r){super(r);M(this,"llmChain");M(this,"inputKey","input_documents");M(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 D4r({llmChain:await Ih.deserialize(r.llm_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize()}}},$4r=class L4r extends jy{constructor(r){super(r);M(this,"llmChain");M(this,"inputKey","input_documents");M(this,"documentVariableName","context");M(this,"returnIntermediateSteps",!1);M(this,"maxTokens",3e3);M(this,"maxIterations",10);M(this,"ensureMapStep",!1);M(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,g)=>n.getChild(`map_${g+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 L4r({llmChain:await Ih.deserialize(r.llm_chain),combineDocumentChain:await H1e.deserialize(r.combine_document_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),combine_document_chain:this.combineDocumentChain.serialize()}}},F4r=class k4r extends jy{constructor(r){super(r);M(this,"llmChain");M(this,"inputKey","input_documents");M(this,"outputKey","output_text");M(this,"documentVariableName","context");M(this,"initialResponseName","existing_answer");M(this,"refineLLMChain");M(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 uu({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 k4r({llmChain:await Ih.deserialize(n),refineLLMChain:await Ih.deserialize(o)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),refine_llm_chain:this.refineLLMChain.serialize()}}}});var Z7,J1e=v(()=>{V$();Z7=class extends Vh{constructor(){super(...arguments);M(this,"lc_namespace",["langchain_core","example_selectors","base"])}}});function q4r(t){return t._modelType()==="base_llm"}function Y7(t){return t._modelType()==="base_chat_model"}var Upt,X7,B4r=v(()=>{Upt=class{async getPromptAsync(t,e){return this.getPrompt(t).partial(e?.partialVariables??{})}},X7=class extends Upt{constructor(e,r=[]){super();M(this,"defaultPrompt");M(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 U4r(t){return t.split(/\n| /).length}var z4r,V4r=v(()=>{J1e();z4r=class H4r extends Z7{constructor(r){super(r);M(this,"examples",[]);M(this,"examplePrompt");M(this,"getTextLength",U4r);M(this,"maxLength",2048);M(this,"exampleTextLengths",[]);this.examplePrompt=r.examplePrompt,this.maxLength=r.maxLength??2048,this.getTextLength=r.getTextLength??U4r}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 H4r(n);return await Promise.all(r.map(i=>o.addExample(i))),o}}});function zpt(t){return Object.keys(t).sort().map(e=>t[e])}var J4r,W4r=v(()=>{Xnt();J1e();J4r=class K4r extends Z7{constructor(r){super(r);M(this,"vectorStoreRetriever");M(this,"exampleKeys");M(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=zpt(n.reduce((i,a)=>({...i,[a]:r[a]}),{})).join(" ");await this.vectorStoreRetriever.addDocuments([new jm({pageContent:o,metadata:r})])}async selectExamples(r){let n=this.inputKeys??Object.keys(r),o=zpt(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=>zpt(a?a.reduce((c,d)=>({...c,[d]:l[d]}),{}):l).join(" ")),u=await o.fromTexts(s,r,n,i);return new K4r({vectorStore:u,k:i.k??4,exampleKeys:i.exampleKeys,inputKeys:i.inputKeys})}}});var aYo,K1e=v(()=>{Do();J1e();B4r();V4r();W4r();aYo={};Et(aYo,{BaseExampleSelector:()=>Z7,BasePromptSelector:()=>Upt,ConditionalPromptSelector:()=>X7,LengthBasedExampleSelector:()=>z4r,SemanticSimilarityExampleSelector:()=>J4r,isChatModel:()=>Y7,isLLM:()=>q4r})});var sYo,uYo,lYo,cYo,G4r,Z4r=v(()=>{Tv();K1e();sYo=new uu({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"]}),uYo=`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}`,lYo=[Gw.fromTemplate(uYo),a_.fromTemplate("{question}")],cYo=hd.fromMessages(lYo),G4r=new X7(sYo,[[Y7,cYo]])});var X4r=v(()=>{Tv();K1e()});var Y4r=v(()=>{Tv();K1e()});function Q4r(t,e={}){let{prompt:r=G4r.getPrompt(t),verbose:n}=e,o=new Ih({prompt:r,llm:t,verbose:n});return new H1e({llmChain:o,verbose:n})}var e2r=v(()=>{yJ();ece();Z4r();X4r();Y4r()});var r2r={};Xn(r2r,{VectorDBQAChain:()=>dYo});var dYo,n2r=v(()=>{G7();e2r();dYo=class t2r extends jy{constructor(r){super(r);M(this,"k",4);M(this,"inputKey","query");M(this,"vectorstore");M(this,"combineDocumentsChain");M(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 t2r({combineDocumentsChain:await jy.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=Q4r(r);return new this({vectorstore:n,combineDocumentsChain:i,...o})}}});var o2r,i2r,fYo,a2r,s2r=v(()=>{Tv();o2r=`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:`,i2r=new uu({inputVariables:["api_docs","question"],template:o2r}),fYo=`${o2r} {api_url}
|
||
|
||
Here is the response from the API:
|
||
|
||
{api_response}
|
||
|
||
Summarize this response to answer the original question.
|
||
|
||
Summary:`,a2r=new uu({inputVariables:["api_docs","question","api_url","api_response"],template:fYo})});var l2r={};Xn(l2r,{APIChain:()=>pYo});var pYo,c2r=v(()=>{G7();yJ();s2r();pYo=class u2r extends jy{constructor(r){super(r);M(this,"apiAnswerChain");M(this,"apiRequestChain");M(this,"apiDocs");M(this,"headers",{});M(this,"inputKey","question");M(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 u2r({apiAnswerChain:await Ih.deserialize(o),apiRequestChain:await Ih.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=i2r,apiResponsePrompt:a=a2r}=o,s=new Ih({prompt:i,llm:r}),u=new Ih({prompt:a,llm:r});return new this({apiAnswerChain:u,apiRequestChain:s,apiDocs:n,...o})}}});var jy,G7=v(()=>{xv();Wv();ym();X$();jy=class extends jW{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=Jo(e),n=await this._formatValues(t),i=await(await Yl.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{a=await(n.signal?Promise.race([this._call(n,i,r),new Promise((s,u)=>{n.signal?.addEventListener("abort",()=>{u(new Error("AbortError"))})})]):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,dN,{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,...lN(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(()=>(yJ(),d2r));return r.deserialize(t)}case"sequential_chain":{let{SequentialChain:r}=await Promise.resolve().then(()=>(Bpt(),qpt));return r.deserialize(t)}case"simple_sequential_chain":{let{SimpleSequentialChain:r}=await Promise.resolve().then(()=>(Bpt(),qpt));return r.deserialize(t)}case"stuff_documents_chain":{let{StuffDocumentsChain:r}=await Promise.resolve().then(()=>(ece(),V1e));return r.deserialize(t)}case"map_reduce_documents_chain":{let{MapReduceDocumentsChain:r}=await Promise.resolve().then(()=>(ece(),V1e));return r.deserialize(t)}case"refine_documents_chain":{let{RefineDocumentsChain:r}=await Promise.resolve().then(()=>(ece(),V1e));return r.deserialize(t)}case"vector_db_qa":{let{VectorDBQAChain:r}=await Promise.resolve().then(()=>(n2r(),r2r));return r.deserialize(t,e)}case"api_chain":{let{APIChain:r}=await Promise.resolve().then(()=>(c2r(),l2r));return r.deserialize(t)}default:throw new Error(`Invalid prompt type in config: ${t._type}`)}}}});var f2r,p2r=v(()=>{_O();f2r=class extends SN{constructor(){super(...arguments);M(this,"lc_namespace",["langchain","output_parsers","default"]);M(this,"lc_serializable",!0)}static lc_name(){return"NoOpOutputParser"}parse(e){return Promise.resolve(e)}getFormatInstructions(){return""}}});var d2r={};Xn(d2r,{LLMChain:()=>Ih});function mYo(t){return typeof t._llmType=="function"}function W1e(t){if(mYo(t))return t;if("bound"in t&&Lo.isRunnable(t.bound))return W1e(t.bound);if("runnable"in t&&"fallbacks"in t&&Lo.isRunnable(t.runnable))return W1e(t.runnable);if("default"in t&&Lo.isRunnable(t.default))return W1e(t.default);throw new Error("Unable to extract BaseLanguageModel from llmLike object.")}var Ih,yJ=v(()=>{G7();p2r();Tv();xv();Wv();Ih=class m2r extends jy{constructor(r){super(r);M(this,"lc_serializable",!0);M(this,"prompt");M(this,"llm");M(this,"llmKwargs");M(this,"outputKey","text");M(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 f2r,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 m2r({llm:await E2.deserialize(n),prompt:await Kw.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 W1e(this.llm).getNumTokens(r)}}});var tce,h2r,Hpt=v(()=>{yJ();U1e();xB();$s();tce=class extends Ab{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});M(this,"memoryKey","history");M(this,"humanPrefix","Human");M(this,"aiPrefix","AI");M(this,"llm");M(this,"prompt",O4r);M(this,"summaryChatMessageClass",Ym);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=rl(e,this.humanPrefix,this.aiPrefix);return await new Ih({llm:this.llm,prompt:this.prompt}).predict({summary:r,new_lines:n})}},h2r=class extends tce{constructor(e){super(e);M(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 g2r,y2r=v(()=>{Hpt();$s();g2r=class extends tce{constructor(e){super(e);M(this,"movingSummaryBuffer","");M(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=rl(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(rl(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(rl(e,this.humanPrefix,this.aiPrefix)))}this.movingSummaryBuffer=await this.predictNewSummary(n,this.movingSummaryBuffer)}}async clear(){await super.clear(),this.movingSummaryBuffer=""}}});var G1e,b2r=v(()=>{xB();$s();G1e=class extends Ab{constructor(e){super({chatHistory:e?.chatHistory,returnMessages:e?.returnMessages??!1,inputKey:e?.inputKey,outputKey:e?.outputKey});M(this,"humanPrefix","Human");M(this,"aiPrefix","AI");M(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]:rl(r,this.humanPrefix,this.aiPrefix)}}}});var Z1e,_2r=v(()=>{xB();$s();Z1e=class extends Ab{constructor(e){super({returnMessages:e?.returnMessages??!1,chatHistory:e?.chatHistory,inputKey:e?.inputKey,outputKey:e?.outputKey});M(this,"humanPrefix","Human");M(this,"aiPrefix","AI");M(this,"memoryKey","history");M(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]:rl(r.slice(-this.k*2),this.humanPrefix,this.aiPrefix)}}}});var v2r,w2r=v(()=>{E2e();X8();Xle();v2r=class extends hJ{constructor(e){super();M(this,"vectorStoreRetriever");M(this,"inputKey");M(this,"memoryKey");M(this,"returnDocs");M(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=gJ(e,this.inputKey),n=await this.vectorStoreRetriever.invoke(r);return{[this.memoryKey]:this.returnDocs?n:GQ(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 jm({pageContent:o,metadata:n})])}}});var S2r,C2r=v(()=>{V$();S2r=class extends Vh{}});var x2r,O2r=v(()=>{C2r();x2r=class extends S2r{constructor(){super();M(this,"lc_namespace",["langchain","stores","entity","in_memory"]);M(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 T2r,E2r=v(()=>{yJ();U1e();xB();O2r();$s();Xle();T2r=class extends Ab{constructor(e){super({chatHistory:e.chatHistory,returnMessages:e.returnMessages??!1,inputKey:e.inputKey,outputKey:e.outputKey});M(this,"entityExtractionChain");M(this,"entitySummarizationChain");M(this,"entityStore");M(this,"entityCache",[]);M(this,"k",3);M(this,"chatHistoryKey","history");M(this,"llm");M(this,"entitiesKey","entities");M(this,"humanPrefix");M(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 Ih({llm:this.llm,prompt:e.entityExtractionPrompt??E4r}),this.entitySummarizationChain=new Ih({llm:this.llm,prompt:e.entitySummarizationPrompt??P4r}),this.entityStore=e.entityStore??new x2r,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??z1e(e,this.memoryVariables),n=await this.chatHistory.getMessages(),o=rl(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??z1e(e,this.memoryVariables),o=await this.chatHistory.getMessages(),i=rl(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 P2r,M2r=v(()=>{xB();P2r=class extends Ab{constructor(e){super({chatHistory:e?.chatHistory,returnMessages:e?.returnMessages??!1,inputKey:e?.inputKey,outputKey:e?.outputKey});M(this,"humanPrefix","Human");M(this,"aiPrefix","AI");M(this,"memoryKey","history");M(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 R2r,A2r=v(()=>{xB();$s();R2r=class extends Ab{constructor(e){super(e);M(this,"humanPrefix","Human");M(this,"aiPrefix","AI");M(this,"memoryKey","history");M(this,"maxTokenLimit",2e3);M(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]:rl(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(rl(n,this.humanPrefix,this.aiPrefix));if(o>this.maxTokenLimit){let i=[];for(;o>this.maxTokenLimit;)i.push(n.shift()),o=await this.llm.getNumTokens(rl(n,this.humanPrefix,this.aiPrefix))}}}});var hYo,Vpt=v(()=>{Rhe();U1e();xB();Hpt();y2r();b2r();_2r();w2r();E2r();M2r();A2r();$s();Fpt();Xle();hYo={};I6(hYo,{BaseChatMemory:()=>Ab,BaseConversationSummaryMemory:()=>tce,BaseMemory:()=>hJ,BufferMemory:()=>G1e,BufferWindowMemory:()=>Z1e,ChatMessageHistory:()=>Gle,CombinedMemory:()=>P2r,ConversationSummaryBufferMemory:()=>g2r,ConversationSummaryMemory:()=>h2r,ConversationTokenBufferMemory:()=>R2r,ENTITY_MEMORY_CONVERSATION_TEMPLATE:()=>T4r,EntityMemory:()=>T2r,VectorStoreRetrieverMemory:()=>v2r,getBufferString:()=>rl,getInputValue:()=>gJ,getOutputValue:()=>Zle})});var rce,I2r=v(()=>{Pt();Vpt();rce=class t{constructor(){this.initMemory(),Ou(()=>{let e=this.memory?.chatHistory;this.initMemory(e)})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initMemory(e){let r=ce().contextTurns;this.memory=new Z1e({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 nce,N2r=v(()=>{Pt();Tv();Tu();nce=class t{constructor(){this.initChatPrompt(),this.initQAPrompt(),Ou(()=>{this.initChatPrompt(),this.initQAPrompt()}),tK(()=>{this.initChatPrompt(),this.initQAPrompt()})}static getInstance(){return t.instance||(t.instance=new t),t.instance}initChatPrompt(){let e=Y0(),r=tc();r&&Jz()&&(e=r.systemPrompt);let n=this.escapeTemplateString(e);this.chatPrompt=hd.fromMessages([Gw.fromTemplate(n),new vO("history"),a_.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=hd.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 X1e,oce,j2r=v(()=>{Tu();gd();zr();x4r();Dt();Pt();wr();Tv();X1e=require("obsidian");hue();I2r();N2r();M1e();oce=class{constructor(e){this.retrievedDocuments=[];this.app=e,this.memoryManager=rce.getInstance(),this.chatModelManager=gI.getInstance(),this.promptManager=nce.getInstance(),this.userMemoryManager=new CB(e),this.initialize(),Ou(async()=>{await this.createChainWithNewModel()})}getRetrievedDocuments(){return this.retrievedDocuments}async initialize(){await this.createChainWithNewModel()}getChain(){return this.chain}getRetrievalChain(){return this.retrievalChain}validateChainType(e){if(e==null)throw new Error("No chain type set")}validateChatModel(){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){let e="Chat model is not initialized properly, check your API key in Copilot setting and make sure you have API access.";throw new X1e.Notice(e),new Error(e)}}validateChainInitialization(){(!this.chain||!vAt(this.chain))&&(J("Reinitializing chat chain after detecting missing or unsupported instance."),this.createChainWithNewModel({},!1))}storeRetrieverDocuments(e){this.retrievedDocuments=e}async createChainWithNewModel(e={},r=!0){let n=jN(),o=tc();if(n==="project"&&!o)return;let i=n==="project"?o?.projectModelKey:eK();if(!i)throw new X1e.Notice("No model key found"),new Error("No model key found");try{if(r){let a=qhe(i,ce().activeModels);if(a||(console.error("Resetting default model. No model configuration found for: ",i),a=SO[0],i=a.name+"|"+a.provider),n==="project"&&!a.projectEnabled){let u=ce().activeModels.find(l=>l.enabled&&l.projectEnabled);if(u)a=u,i=u.name+"|"+u.provider,new X1e.Notice(`Model ${a.name} is not available in project mode. Switching to ${u.name}.`);else throw new Error("No project-enabled models available. Please enable a model for project mode in settings.")}let s={...a,...o?.modelConfigs};await this.chatModelManager.setChatModel(s)}this.setChain(n,e),J(`Setting model to ${i}`)}catch(a){ue(`createChainWithNewModel failed: ${a}`),J(`modelKey: ${i}`)}}async setChain(e,r={}){if(!this.chatModelManager.validateChatModel(this.chatModelManager.getChatModel())){console.error("setChain failed: No chat model set.");return}this.validateChainType(e);let n=this.chatModelManager.getChatModel(),o=this.memoryManager.getMemory(),i=this.promptManager.getChatPrompt();switch(e){case"llm_chain":{this.chain=oee.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Hz("llm_chain");break}case"vault_qa":{await this.initializeQAChain(r);let a=ce(),s=a.enableSemanticSearchV3?new(await Promise.resolve().then(()=>($Ne(),Udt))).HybridRetriever({minSimilarityScore:.01,maxK:a.maxSourceChunks,salientTerms:[]}):new(await Promise.resolve().then(()=>(m7(),DNe))).TieredLexicalRetriever(app,{minSimilarityScore:.01,maxK:a.maxSourceChunks,salientTerms:[],timeRange:void 0,textWeight:void 0,returnAll:!1,useRerankerThreshold:void 0});this.retrievalChain=oee.createConversationalRetrievalChain({llm:n,retriever:s,systemMessage:Y0()},this.storeRetrieverDocuments.bind(this),ce().debug),Hz("vault_qa"),ce().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=oee.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Hz("copilot_plus");break}case"project":{await this.initializeQAChain(r),this.chain=oee.createNewLLMChain({llm:n,memory:o,prompt:r.prompt||i,abortController:r.abortController}),Hz("project");break}default:this.validateChainType(e);break}}getChainRunner(){let e=jN(),r=ce();switch(e){case"llm_chain":return new wie(this);case"vault_qa":return new _ue(this);case"copilot_plus":return r.enableAutonomousAgent?new Wle(this):new vI(this);case"project":return new Hle(this);default:throw new Error(`Unsupported chain type: ${e}`)}}async initializeQAChain(e){e.refreshIndex&&ce().enableSemanticSearchV3&&await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().indexVaultToVectorStore(!1)}async runChain(e,r,n,o,i={}){let{ignoreSystemMessage:a=!1}=i;J(`Step 0: Initial user message:
|
||
`,e),this.validateChatModel(),this.validateChainInitialization();let s=this.chatModelManager.getChatModel();if(a||ree(s)){let l=hd.fromMessages([new vO("history"),a_.fromTemplate("{input}")]);ree(s)&&(l=hd.fromMessages([[Xs,Y0()||""],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===Xs&&await this.memoryManager.getMemory().saveContext({input:n.message},{output:o.message})}}}});var Y1e,D2r=v(()=>{Tu();Dt();Pt();wr();gie();Y1e=class t{constructor(e){this.app=e}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}clearAllLoadStates(){dIt({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=X1(o)?"Rate limit exceeded. (Rate limit: 50 files or 100MB per 3 hours, whichever is reached first)":Eo(o);throw this.setFileOrUrlProcessFailed(e,r,i),o}}setFileOrUrlStartProcess(e){ei.set(fee,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){AO("processingFiles",r=>r.filter(n=>n!==e)),AO("success",r=>r.includes(e)?r:[...r,e])}setFileOrUrlProcessFailed(e,r,n){AO("processingFiles",o=>o.filter(i=>i!==e)),AO("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){J(`[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])];AO("total",s=>a),J(`[preComputeAllItems] Project ${e.name}: Added ${n.length} items to tracking (${a.length} total unique items)`)}}markAllCachedItemsAsSuccess(e,r,n){J(`[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&&J(`[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&&J(`[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&&J(`[markAllCachedItemsAsSuccess] Project ${e.name}: Marked ${s.length} cached files that match current project patterns as successful.`)}}markCachedItemAsSuccess(e){AO("total",r=>r.includes(e)?r:[...r,e]),AO("success",r=>r.includes(e)?r:[...r,e])}makeItemFailed(e,r,n){AO("total",o=>o.includes(e)?o:[...o,e]),AO("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 bJ,Rg,Xq=v(()=>{Tu();hie();gd();zr();Dt();lot();vb();Pt();ROe();wr();gie();bJ=require("obsidian");RS();j2r();D2r();Rg=class t{constructor(e,r){this.app=e,this.plugin=r,this.currentProjectId=null,this.chainMangerInstance=new oce(e),this.projectContextCache=UC.getInstance(),this.fileParserManager=new Ik(Ru.getInstance(),this.app.vault,!0,null),this.loadTracker=Y1e.getInstance(this.app),iIt(async()=>{await this.getCurrentChainManager().createChainWithNewModel()}),aIt(async()=>{if(Jz())return;let n=ce(),o=n.enableSemanticSearchV3&&n.indexVaultToVectorStore==="ON MODE SWITCH"&&(jN()==="vault_qa"||jN()==="copilot_plus");await this.getCurrentChainManager().createChainWithNewModel({refreshIndex:o})}),tK(async n=>{await this.switchProject(n)}),this.setupProjectListChangeMonitor()}setupProjectListChangeMonitor(){Ou(async(e,r)=>{if(!e||!r)return;let n=e.projectList||[],o=r.projectList||[];for(let i of o){let a=n.find(s=>s.id===i.id);a&&JSON.stringify(a)!==JSON.stringify(i)&&(await this.compareAndUpdateCache(a,i),this.currentProjectId===i.id&&await Promise.all([this.loadProjectContext(i,!0),this.getCurrentChainManager().createChainWithNewModel()]))}})}static getInstance(e,r){return t.instance||(t.instance=new t(e,r)),t.instance}getCurrentChainManager(){return this.chainMangerInstance}getCurrentProjectId(){return this.currentProjectId}async switchProject(e){try{if(this.loadTracker.clearAllLoadStates(),RO(!0),J("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 Ik(Ru.getInstance(),this.app.vault,!0,e),await this.loadProjectContext(e),this.refreshChatView(),J(`Switched to project: ${e.name}`)}catch(r){throw ue(`Failed to switch project: ${r}`),r}finally{RO(!1)}}async saveCurrentProjectMessage(){await this.plugin.autosaveCurrentChat()}async loadNextProjectMessage(){await this.plugin.chatUIState.handleProjectSwitch()}async loadProjectContext(e,r=!1){r&&(this.loadTracker.clearAllLoadStates(),RO(!0));try{if(!e.contextSource)return Ot(`[loadProjectContext] Project ${e.name}: No contextSource. Aborting.`),null;J(`[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),J(`[loadProjectContext] Completed for project: ${e.name}.`),i}catch(n){throw ue(`[loadProjectContext] Failed for project ${e.name}:`,n),n}finally{r&&RO(!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),J(`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){ue(`Error comparing project configurations: ${n}`)}}refreshChatView(){let e=this.app.workspace.getLeavesOfType(Tc)[0]?.view;e&&e.updateView()}async getProjectContext(e){let r=ce().projectList.find(o=>o.id===e);if(!r)return Ot(`[getProjectContext] Project not found for ID: ${e}`),null;J(`[getProjectContext] Getting context for project: ${r.name} (ID: ${e})`);let n=this.projectContextCache.getSync(r);if(!n||n.markdownNeedsReload){n?J(`[getProjectContext] Project ${r.name}: Markdown needs reload. Triggering full load.`):J(`[getProjectContext] Project ${r.name}: Memory cache miss. Triggering full load.`);let o=await this.loadProjectContext(r,!0);if(!o)return ue(`[getProjectContext] Project ${r.name}: loadProjectContext returned null.`),null;n=o}else J(`[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(J(`[processMarkdownFiles] Starting for project: ${e.name}`),r.markdownNeedsReload||!r.markdownContext||!r.markdownContext.trim()){J(`[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,J(`[processMarkdownFiles] Project ${e.name}: Markdown content updated.`)}else J(`[processMarkdownFiles] Project ${e.name}: Markdown content already up-to-date.`);return J(`[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");J(`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,J(`Completed processing markdown file: ${o.path}`)}catch(s){ue(`Error processing file ${o.path}: ${s}`),i=`[Error: ${Eo(s)}]`}return`${a}
|
||
|
||
${i}`}));return J("All markdown files processed for project context"),n.join(`
|
||
|
||
`)}async processWebUrls(e,r){J(`[processWebUrls] Starting for project: ${e.name}`);let n=e.contextSource?.webUrls?.trim()||"";if(!n)return Object.keys(r.webContexts).length>0&&(J(`[processWebUrls] Project ${e.name}: Clearing all Web contexts as none are configured.`),r.webContexts={}),r;let o=n.split(`
|
||
`).filter(c=>c.trim());J(`[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&&J(`[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){J(`[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&&J(`[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&&Ot(`[processWebUrls] Project ${e.name}: Fetched empty content for Web URL: ${c.url}`)}),J(`[processWebUrls] Completed for project: ${e.name}. Total Web contexts: ${Object.keys(r.webContexts).length}`),r}async processYoutubeUrls(e,r){J(`[processYoutubeUrls] Starting for project: ${e.name}`);let n=e.contextSource?.youtubeUrls?.trim()||"";if(!n)return Object.keys(r.youtubeContexts).length>0&&(J(`[processYoutubeUrls] Project ${e.name}: Clearing all YouTube contexts as none are configured.`),r.youtubeContexts={}),r;let o=n.split(`
|
||
`).filter(c=>c.trim());J(`[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&&J(`[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){J(`[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&&J(`[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&&Ot(`[processYoutubeUrls] Project ${e.name}: Fetched empty transcript for YouTube URL: ${c.url}`)}),J(`[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=eG.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 ue(`Failed to process web URL: ${r}`),""}}async processYoutubeUrlContext(e){if(!e?.trim())return"";try{let r=await this.loadTracker.executeWithProcessTracking(e,"youtube",async()=>Ru.getInstance().youtube4llm(e));return r.response.transcript?`
|
||
|
||
YouTube transcript from ${e}:
|
||
${r.response.transcript}`:""}catch(r){return ue(`Failed to process YouTube URL ${e}: ${r}`),new bJ.Notice(`Failed to process YouTube URL ${e}: ${Eo(r)}`),""}}async processNonMarkdownFiles(e,r){let n=r.filter(i=>i.extension!=="md");if(J(`[loadProjectContext] Project ${e.name}: Checking for non-markdown processing: ${n.length} files .`),n.length<=0)return;this.fileParserManager=new Ik(Ru.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)||(J(`[loadProjectContext] Project ${e.name}: Parsing/caching new/updated file: ${a}`),await this.fileParserManager.parseFile(i,this.app.vault)),o++})}catch(s){if(ue(`[loadProjectContext] Project ${e.name}: Error parsing file ${a}:`,s),X1(s))throw s}}o>0&&J(`[loadProjectContext] Project ${e.name}: Processed and cached ${o} non-markdown files.`)}async retryFailedItem(e){try{if(!this.currentProjectId){Ot("[retryFailedItem] No current project, aborting retry");return}let r=ce().projectList.find(n=>n.id===this.currentProjectId);if(!r){ue(`[retryFailedItem] Current project not found: ${this.currentProjectId}`);return}switch(J(`[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:Ot(`[retryFailedItem] Unknown item type: ${e.type}`);return}J(`[retryFailedItem] Successfully retried ${e.type} item: ${e.path}`),new bJ.Notice(`Retry successful: ${e.path}`)}catch(r){ue(`[retryFailedItem] Failed to retry ${e.type} item ${e.path}:`,r),new bJ.Notice(`Retry failed: ${Eo(r)}`)}}async retryWebUrl(e,r){let n=await this.processWebUrlContext(r);if(!n){Ot(`[retryWebUrl] Project ${e.name}: Fetched empty content for Web URL: ${r}`);return}J(`[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){Ot(`[retryYoutubeUrl] Project ${e.name}: Fetched empty transcript for YouTube URL: ${r}`);return}J(`[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 bJ.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()=>{}),J(`[retryMarkdownFile] Successfully reprocessed markdown file: ${r}`),await this.projectContextCache.invalidateMarkdownContext(e)}catch(o){throw ue(`[retryMarkdownFile] Error processing file ${r}: ${o}`),o}}async retryNonMarkdownFile(e,r){let n=this.app.vault.getAbstractFileByPath(r);if(!(n instanceof bJ.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)),J(`[retryNonMarkdownFile] Successfully reprocessed non-markdown file: ${r}`)}catch(o){throw ue(`[retryNonMarkdownFile] Error processing file ${r}: ${o}`),o}}getProjectAllFiles(e){let{inclusions:r,exclusions:n}=id({inclusions:e.contextSource.inclusions,exclusions:e.contextSource.exclusions,isProject:!0});return this.app.vault.getFiles().filter(o=>ml(o,r,n,!0))}onunload(){this.projectContextCache.cleanup()}}});var $2r={};Xn($2r,{AutocompleteCache:()=>ice});var ice,Jpt=v(()=>{Dt();ice=class t{constructor(){this.cache=new Map,this.maxSize=200,this.ttlMs=10*60*1e3}static getInstance(){return t.instance||(t.instance=new t),t.instance}get(e){let r=this.cache.get(e);if(r){if(Date.now()-r.timestamp>this.ttlMs){this.cache.delete(e);return}return r.response}}set(e,r){if(this.cache.size>=this.maxSize){let n=this.cache.keys().next().value;this.cache.delete(n)}this.cache.set(e,{response:r,timestamp:Date.now()}),J(`[AutocompleteCache] Cached response for key: ${e.slice(0,50)}...`)}clear(){this.cache.clear(),J("[AutocompleteCache] Cleared autocomplete cache")}generateSentenceKey(e,r,n){let o={prefix:e.slice(-100),noteContext:r.slice(-200),relevantNotes:n.slice(0,100)};return`sentence:${JSON.stringify(o)}`}generateWordKey(e,r,n){let o={contextPrefix:e.slice(-50),contextSuffix:r.slice(0,50),words:n.slice(0,5)};return`word:${JSON.stringify(o)}`}getStats(){return{size:this.cache.size,maxSize:this.maxSize,ttlMs:this.ttlMs}}}});var Y5r=S((f0s,X5r)=>{"use strict";var tii="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";X5r.exports=tii});var rWr=S((p0s,tWr)=>{"use strict";var rii=Y5r();function Q5r(){}function eWr(){}eWr.resetWarningCache=Q5r;tWr.exports=function(){function t(n,o,i,a,s,u){if(u!==rii){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}t.isRequired=t;function e(){return t}var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:eWr,resetWarningCache:Q5r};return r.PropTypes=r,r}});var oWr=S((g0s,nWr)=>{nWr.exports=rWr()();var m0s,h0s});var cWr=S(hgt=>{"use strict";hgt.__esModule=!0;hgt.default=function(t,e){if(t&&e){var r=Array.isArray(e)?e:e.split(",");if(r.length===0)return!0;var n=t.name||"",o=(t.type||"").toLowerCase(),i=o.replace(/\/.*$/,"");return r.some(function(a){var s=a.trim().toLowerCase();return s.charAt(0)==="."?n.toLowerCase().endsWith(s):s.endsWith("/*")?i===s.replace(/\/.*$/,""):o===s})}return!0}});var vde=S((h7r,B$e)=>{((t,e)=>{typeof define=="function"&&define.amd?define([],e):typeof B$e=="object"&&B$e.exports?B$e.exports=e():t.fuzzysort=e()})(h7r,t=>{"use strict";var e=($,q)=>{if(!$||!q)return z;var Y=p($);H(q)||(q=f(q));var j=Y.bitflags;return(j&q._bitflags)!==j?z:h(Y,q)},r=($,q,Y)=>{if(!$)return Y?.all?m(q,Y):oe;var j=p($),A=j.bitflags,W=j.containsSpace,V=c(Y?.threshold||0),se=Y?.limit||G,be=0,Ee=0,Ae=q.length;function ht(_n){be<se?(Z.add(_n),++be):(++Ee,_n._score>Z.peek()._score&&Z.replaceTop(_n))}if(Y?.key)for(var Rt=Y.key,Ze=0;Ze<Ae;++Ze){var Dr=q[Ze],Vt=U(Dr,Rt);if(Vt&&(H(Vt)||(Vt=f(Vt)),(A&Vt._bitflags)===A)){var jt=h(j,Vt);jt!==z&&(jt._score<V||(jt.obj=Dr,ht(jt)))}}else if(Y?.keys){var Fe=Y.keys,hn=Fe.length;e:for(var Ze=0;Ze<Ae;++Ze){var Dr=q[Ze];{for(var gt=0,qe=0;qe<hn;++qe){var Rt=Fe[qe],Vt=U(Dr,Rt);if(!Vt){F[qe]=Q;continue}H(Vt)||(Vt=f(Vt)),F[qe]=Vt,gt|=Vt._bitflags}if((A>)!==A)continue}if(W)for(let wt=0;wt<j.spaceSearches.length;wt++)N[wt]=ie;for(var qe=0;qe<hn;++qe){if(Vt=F[qe],Vt===Q){B[qe]=Q;continue}if(B[qe]=h(j,Vt,!1,W),B[qe]===z){B[qe]=Q;continue}if(W)for(let _r=0;_r<j.spaceSearches.length;_r++){if(D[_r]>-1e3&&N[_r]>ie){var Te=(N[_r]+D[_r])/4;Te>N[_r]&&(N[_r]=Te)}D[_r]>N[_r]&&(N[_r]=D[_r])}}if(W){for(let wt=0;wt<j.spaceSearches.length;wt++)if(N[wt]===ie)continue e}else{var Ce=!1;for(let wt=0;wt<hn;wt++)if(B[wt]._score!==ie){Ce=!0;break}if(!Ce)continue}var De=new s(hn);for(let wt=0;wt<hn;wt++)De[wt]=B[wt];if(W){var Re=0;for(let wt=0;wt<j.spaceSearches.length;wt++)Re+=N[wt]}else{var Re=ie;for(let _r=0;_r<hn;_r++){var jt=De[_r];if(jt._score>-1e3&&Re>ie){var Te=(Re+jt._score)/4;Te>Re&&(Re=Te)}jt._score>Re&&(Re=jt._score)}}if(De.obj=Dr,De._score=Re,Y?.scoreFn){if(Re=Y.scoreFn(De),!Re)continue;Re=c(Re),De._score=Re}Re<V||ht(De)}}else for(var Ze=0;Ze<Ae;++Ze){var Vt=q[Ze];if(Vt&&(H(Vt)||(Vt=f(Vt)),(A&Vt._bitflags)===A)){var jt=h(j,Vt);jt!==z&&(jt._score<V||ht(jt))}}if(be===0)return oe;for(var nt=new Array(be),Ze=be-1;Ze>=0;--Ze)nt[Ze]=Z.poll();return nt.total=be+Ee,nt},n=($,q="<b>",Y="</b>")=>{for(var j=typeof q=="function"?q:void 0,A=$.target,W=A.length,V=$.indexes,se="",be=0,Ee=0,Ae=!1,ht=[],Rt=0;Rt<W;++Rt){var Ze=A[Rt];if(V[Ee]===Rt){if(++Ee,Ae||(Ae=!0,j?(ht.push(se),se=""):se+=q),Ee===V.length){j?(se+=Ze,ht.push(j(se,be++)),se="",ht.push(A.substr(Rt+1))):se+=Ze+Y+A.substr(Rt+1);break}}else Ae&&(Ae=!1,j?(ht.push(j(se,be++)),se=""):se+=Y);se+=Ze}return j?ht:se},o=$=>{typeof $=="number"?$=""+$:typeof $!="string"&&($="");var q=b($);return u($,{_targetLower:q._lower,_targetLowerCodes:q.lowerCodes,_bitflags:q.bitflags})},i=()=>{x.clear(),O.clear()};class a{get indexes(){return this._indexes.slice(0,this._indexes.len).sort((q,Y)=>q-Y)}set indexes(q){return this._indexes=q}highlight(q,Y){return n(this,q,Y)}get score(){return l(this._score)}set score(q){this._score=c(q)}}class s extends Array{get score(){return l(this._score)}set score(q){this._score=c(q)}}var u=($,q)=>{let Y=new a;return Y.target=$,Y.obj=q.obj??z,Y._score=q._score??ie,Y._indexes=q._indexes??[],Y._targetLower=q._targetLower??"",Y._targetLowerCodes=q._targetLowerCodes??z,Y._nextBeginningIndexes=q._nextBeginningIndexes??z,Y._bitflags=q._bitflags??0,Y},l=$=>$===ie?0:$>1?$:Math.E**(((-$+1)**.04307-1)*-2),c=$=>$===0?ie:$>1?$:1-Math.pow(Math.log($)/-2+1,1/.04307),d=$=>{typeof $=="number"?$=""+$:typeof $!="string"&&($=""),$=$.trim();var q=b($),Y=[];if(q.containsSpace){var j=$.split(/\s+/);j=[...new Set(j)];for(var A=0;A<j.length;A++)if(j[A]!==""){var W=b(j[A]);Y.push({lowerCodes:W.lowerCodes,_lower:j[A].toLowerCase(),containsSpace:!1})}}return{lowerCodes:q.lowerCodes,_lower:q._lower,containsSpace:q.containsSpace,bitflags:q.bitflags,spaceSearches:Y}},f=$=>{if($.length>999)return o($);var q=x.get($);return q!==void 0||(q=o($),x.set($,q)),q},p=$=>{if($.length>999)return d($);var q=O.get($);return q!==void 0||(q=d($),O.set($,q)),q},m=($,q)=>{var Y=[];Y.total=$.length;var j=q?.limit||G;if(q?.key)for(var A=0;A<$.length;A++){var W=$[A],V=U(W,q.key);if(V!=z){H(V)||(V=f(V));var se=u(V.target,{_score:V._score,obj:W});if(Y.push(se),Y.length>=j)return Y}}else if(q?.keys)for(var A=0;A<$.length;A++){for(var W=$[A],be=new s(q.keys.length),Ee=q.keys.length-1;Ee>=0;--Ee){var V=U(W,q.keys[Ee]);if(!V){be[Ee]=Q;continue}H(V)||(V=f(V)),V._score=ie,V._indexes.len=0,be[Ee]=V}if(be.obj=W,be._score=ie,Y.push(be),Y.length>=j)return Y}else for(var A=0;A<$.length;A++){var V=$[A];if(V!=z&&(H(V)||(V=f(V)),V._score=ie,V._indexes.len=0,Y.push(V),Y.length>=j))return Y}return Y},h=($,q,Y=!1,j=!1)=>{if(Y===!1&&$.containsSpace)return g($,q,j);for(var A=$._lower,W=$.lowerCodes,V=W[0],se=q._targetLowerCodes,be=W.length,Ee=se.length,Ze=0,Ae=0,ht=0;;){var Rt=V===se[Ae];if(Rt){if(E[ht++]=Ae,++Ze,Ze===be)break;V=W[Ze]}if(++Ae,Ae>=Ee)return z}var Ze=0,Dr=!1,Vt=0,jt=q._nextBeginningIndexes;jt===z&&(jt=q._nextBeginningIndexes=w(q.target)),Ae=E[0]===0?0:jt[E[0]-1];var Fe=0;if(Ae!==Ee)for(;;)if(Ae>=Ee){if(Ze<=0||(++Fe,Fe>200))break;--Ze;var hn=T[--Vt];Ae=jt[hn]}else{var Rt=W[Ze]===se[Ae];if(Rt){if(T[Vt++]=Ae,++Ze,Ze===be){Dr=!0;break}++Ae}else Ae=jt[Ae]}var gt=be<=1?-1:q._targetLower.indexOf(A,E[0]),qe=!!~gt,Te=qe?gt===0||q._nextBeginningIndexes[gt-1]===gt:!1;if(qe&&!Te){for(var Ce=0;Ce<jt.length;Ce=jt[Ce])if(!(Ce<=gt)){for(var De=0;De<be&&W[De]===q._targetLowerCodes[Ce+De];De++);if(De===be){gt=Ce,Te=!0;break}}}var Re=wt=>{for(var _r=0,Sl=0,Vo=1;Vo<be;++Vo)wt[Vo]-wt[Vo-1]!==1&&(_r-=wt[Vo],++Sl);var Su=wt[be-1]-wt[0]-(be-1);if(_r-=(12+Su)*Sl,wt[0]!==0&&(_r-=wt[0]*wt[0]*.2),!Dr)_r*=1e3;else{for(var Wa=1,Vo=jt[0];Vo<Ee;Vo=jt[Vo])++Wa;Wa>24&&(_r*=(Wa-24)*10)}return _r-=(Ee-be)/2,qe&&(_r/=1+be*be*1),Te&&(_r/=1+be*be*1),_r-=(Ee-be)/2,_r};if(Dr)if(Te){for(var Ce=0;Ce<be;++Ce)E[Ce]=gt+Ce;var nt=E,_n=Re(E)}else var nt=T,_n=Re(T);else{if(qe)for(var Ce=0;Ce<be;++Ce)E[Ce]=gt+Ce;var nt=E,_n=Re(nt)}q._score=_n;for(var Ce=0;Ce<be;++Ce)q._indexes[Ce]=nt[Ce];q._indexes.len=be;let He=new a;return He.target=q.target,He._score=q._score,He._indexes=q._indexes,He},g=($,q,Y)=>{for(var j=new Set,A=0,W=z,V=0,se=$.spaceSearches,be=se.length,Ee=0,Ae=()=>{for(let Te=Ee-1;Te>=0;Te--)q._nextBeginningIndexes[R[Te*2+0]]=R[Te*2+1]},ht=!1,qe=0;qe<be;++qe){D[qe]=ie;var Rt=se[qe];if(W=h(Rt,q),Y){if(W===z)continue;ht=!0}else if(W===z)return Ae(),z;var Ze=qe===be-1;if(!Ze){var Dr=W._indexes,Vt=!0;for(let Ce=0;Ce<Dr.len-1;Ce++)if(Dr[Ce+1]-Dr[Ce]!==1){Vt=!1;break}if(Vt){var jt=Dr[Dr.len-1]+1,Fe=q._nextBeginningIndexes[jt-1];for(let Ce=jt-1;Ce>=0&&Fe===q._nextBeginningIndexes[Ce];Ce--)q._nextBeginningIndexes[Ce]=jt,R[Ee*2+0]=Ce,R[Ee*2+1]=Fe,Ee++}}A+=W._score/be,D[qe]=W._score/be,W._indexes[0]<V&&(A-=(V-W._indexes[0])*2),V=W._indexes[0];for(var hn=0;hn<W._indexes.len;++hn)j.add(W._indexes[hn])}if(Y&&!ht)return z;Ae();var gt=h($,q,!0);if(gt!==z&>._score>A){if(Y)for(var qe=0;qe<be;++qe)D[qe]=gt._score/be;return gt}Y&&(W=q),W._score=A;var qe=0;for(let Te of j)W._indexes[qe++]=Te;return W._indexes.len=qe,W},y=$=>$.replace(/\p{Script=Latin}+/gu,q=>q.normalize("NFD")).replace(/[\u0300-\u036f]/g,""),b=$=>{$=y($);for(var q=$.length,Y=$.toLowerCase(),j=[],A=0,W=!1,V=0;V<q;++V){var se=j[V]=Y.charCodeAt(V);if(se===32){W=!0;continue}var be=se>=97&&se<=122?se-97:se>=48&&se<=57?26:se<=127?30:31;A|=1<<be}return{lowerCodes:j,bitflags:A,containsSpace:W,_lower:Y}},_=$=>{for(var q=$.length,Y=[],j=0,A=!1,W=!1,V=0;V<q;++V){var se=$.charCodeAt(V),be=se>=65&&se<=90,Ee=be||se>=97&&se<=122||se>=48&&se<=57,Ae=be&&!A||!W||!Ee;A=be,W=Ee,Ae&&(Y[j++]=V)}return Y},w=$=>{$=y($);for(var q=$.length,Y=_($),j=[],A=Y[0],W=0,V=0;V<q;++V)A>V?j[V]=A:(A=Y[++W],j[V]=A===void 0?q:A);return j},x=new Map,O=new Map,E=[],T=[],R=[],N=[],D=[],F=[],B=[],U=($,q)=>{var Y=$[q];if(Y!==void 0)return Y;if(typeof q=="function")return q($);var j=q;Array.isArray(q)||(j=q.split("."));for(var A=j.length,W=-1;$&&++W<A;)$=$[j[W]];return $},H=$=>typeof $=="object"&&typeof $._bitflags=="number",G=1/0,ie=-G,oe=[];oe.total=0;var z=null,Q=o(""),re=$=>{var q=[],Y=0,j={},A=W=>{for(var V=0,se=q[V],be=1;be<Y;){var Ee=be+1;V=be,Ee<Y&&q[Ee]._score<q[be]._score&&(V=Ee),q[V-1>>1]=q[V],be=1+(V<<1)}for(var Ae=V-1>>1;V>0&&se._score<q[Ae]._score;Ae=(V=Ae)-1>>1)q[V]=q[Ae];q[V]=se};return j.add=W=>{var V=Y;q[Y++]=W;for(var se=V-1>>1;V>0&&W._score<q[se]._score;se=(V=se)-1>>1)q[V]=q[se];q[V]=W},j.poll=W=>{if(Y!==0){var V=q[0];return q[0]=q[--Y],A(),V}},j.peek=W=>{if(Y!==0)return q[0]},j.replaceTop=W=>{q[0]=W,A()},j},Z=re();return{single:e,go:r,prepare:o,cleanup:i}})});var egi={};Xn(egi,{default:()=>kFe});module.exports=Nfe(egi);RS();Xq();Tu();zr();Dt();Pt();Jpt();zr();RS();Dt();Pt();var p0=require("@codemirror/view"),WD=require("@codemirror/state");function L2r(t,e,r=void 0){let n={force:()=>{}},o=null;async function*i(...a){o&&clearTimeout(o);let s=null;try{await new Promise(u=>{s=o=setTimeout(()=>u(),e),n.force=()=>{o&&clearTimeout(o),u()}})}catch{if(r!==void 0)throw r}for await(let u of t(...a)){if(s!==o)break;yield u}}return{debounced:i,force:()=>n.force()}}var yYo=Object.defineProperty,bYo=(t,e,r)=>e in t?yYo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Q7=(t,e,r)=>(bYo(t,typeof e!="symbol"?e+"":e,r),r),Q1e=WD.StateField.define({create(){return{suggestion:null}},update(t,e){let r=e.effects.find(n=>n.is(Xpt));return e.state.doc&&r&&(r.value.doc==null||e.state.doc==r.value.doc)?{suggestion:r.value.suggestion}:{suggestion:null}}}),Xpt=WD.StateEffect.define();function _Yo(t,e){let r=t.state.selection.main.head,n=[],o=p0.Decoration.widget({widget:new Kpt(e),side:1});return n.push(o.range(r)),p0.Decoration.set(n)}var Kpt=class extends p0.WidgetType{constructor(e){super(),Q7(this,"suggestion"),this.suggestion=e}toDOM(){let e=document.createElement("span");return e.style.opacity="0.4",e.className="cm-inline-suggestion",e.textContent=this.suggestion,e}},Wpt=t=>{let e=0;return p0.ViewPlugin.fromClass(class{async update(r){let n=r.state.doc;if(!r.docChanged)return;let o=++e;for await(let i of t(r.state)){if(o!=e)return;r.view.dispatch({effects:Xpt.of({suggestion:i,doc:n})})}}})},Gpt=class{constructor(){Q7(this,"decorations"),this.decorations=p0.Decoration.none}update(e){var r;let n=(r=e.state.field(Q1e))==null?void 0:r.suggestion;if(!n){this.decorations=p0.Decoration.none;return}this.decorations=_Yo(e.view,n.display_suggestion)}},F2r=p0.ViewPlugin.fromClass(Gpt,{decorations:t=>t.decorations}),Zpt=class{constructor(e,r){Q7(this,"suggestFn"),Q7(this,"keymap"),Q7(this,"completionId"),Q7(this,"run",n=>{var o,i;let a=(o=n.state.field(Q1e))==null?void 0:o.suggestion;return a?(n.dispatch({...vYo(n.state,a.complete_suggestion,n.state.selection.main.head,n.state.selection.main.head)}),(i=a.accept_hook)==null||i.call(a),(async()=>{if(this.suggestFn==null)return;let s=++this.completionId;for await(let u of this.suggestFn(n.state)){if(s!=this.completionId)return;n.dispatch({effects:Xpt.of({suggestion:{complete_suggestion:u.complete_suggestion,display_suggestion:u.display_suggestion,accept_hook:u.accept_hook},doc:null})})}})(),!0):!1}),this.suggestFn=e,this.keymap=WD.Prec.highest(p0.keymap.of([{key:r,run:n=>this.run(n)}])),this.completionId=0}};function vYo(t,e,r,n){return{...t.changeByRange(o=>{if(o==t.selection.main)return{changes:{from:r,to:n,insert:e},range:WD.EditorSelection.cursor(r+e.length)};let i=n-r;return!o.empty||i&&t.sliceDoc(o.from-i,o.from)!=t.sliceDoc(r,n)?{range:o}:{changes:{from:o.from-i,to:o.from,insert:e},range:WD.EditorSelection.cursor(o.from-i+e.length)}}),userEvent:"input.complete"}}function k2r(t){return typeof t=="string"?{complete_suggestion:t,display_suggestion:t}:t}function wYo(t){return async function*(e){let r=await t(e);if(typeof r=="string"||"complete_suggestion"in r){yield k2r(r);return}for await(let n of r)yield k2r(n)}}function eje(t){let{delay:e=500,accept_shortcut:r="Tab"}=t,n=wYo(t.fetchFn),{debounced:o,force:i}=L2r(n,e);return{extension:r?[Q1e,Wpt(o),F2r,new Zpt(t.continue_suggesting?n:null,r).keymap]:[Q1e,Wpt(o),F2r],force_fetch:i}}var rmt=require("obsidian");var Ypt=class{process(e){let{prefix:r,suffix:n}=e,{completion:o}=e;return o=this.removeWordOverlapPrefix(r,o),o=this.removeWordOverlapSuffix(o,n),o=this.removeCharacterOverlapPrefix(r,o),o=this.removeCharacterOverlapSuffix(o,n),o.startsWith(" ")&&this.endsWithMarker(r)&&(o=o.trimStart()),o}removeWordOverlapPrefix(e,r){let n=r.trimStart(),o=this.getPotentialPrefixSegments(e);for(let i of o)if(n.startsWith(i))return n.substring(i.length);return r}removeWordOverlapSuffix(e,r){let n=r.trimStart(),o=this.getPotentialCompletionSegments(e);for(let i of o)if(n.startsWith(i)&&e.endsWith(i))return e.substring(0,e.length-i.length);return e}removeCharacterOverlapPrefix(e,r){let n=e.length-1,o=0,i=0;for(;o<r.length&&n>=0&&r[o]===e[n]&&this.isWhiteSpaceOrCommonMarker(r[o]);)i++,n--,o++;return i>0?r.substring(i):r}removeCharacterOverlapSuffix(e,r){let n=0,o=e.length-1,i=0;for(;n<r.length&&o>=0&&e[o]===r[n]&&this.isWhiteSpaceOrCommonMarker(e[o]);)i++,n++,o--;return i>0?e.substring(0,e.length-i):e}getPotentialPrefixSegments(e){let r=[],n=this.startLocationOfEachWordOrMarker(e);for(let o=n.length-1;o>=0;o--)r.push(e.substring(n[o]));return e.length>0&&(r.length===0||r[r.length-1]!==e)&&r.push(e),e.length>1&&(r.length===0||r[r.length-1]!==e.slice(-1))&&r.push(e.slice(-1)),e.length>2&&(r.length===0||r[r.length-1]!==e.slice(-2))&&r.push(e.slice(-2)),[...new Set(r)].sort((o,i)=>i.length-o.length)}getPotentialCompletionSegments(e){let r=[],n=this.startLocationOfEachWordOrMarker(e);for(let o=0;o<n.length;o++)for(let i=o;i<n.length;i++){let a=i+1<n.length?n[i+1]:e.length;r.push(e.substring(n[o],a))}return e.length>0&&(r.length===0||r[r.length-1]!==e)&&r.push(e),[...new Set(r)].sort((o,i)=>i.length-o.length)}startLocationOfEachWordOrMarker(e){let r=[];if(e.length===0)return r;this.isWhiteSpaceChar(e[0])||r.push(0);for(let n=1;n<e.length;n++){let o=this.isWhiteSpaceChar(e[n-1]),i=this.isWhiteSpaceChar(e[n]),a=this.isCommonMarker(e[n-1]),s=this.isCommonMarker(e[n]);o&&!i||a&&!s&&!i?r.push(n):(!a&&s||o&&s)&&(r.includes(n)||r.push(n))}return r}isWhiteSpaceChar(e){return e!==void 0&&/\s/.test(e)}isCommonMarker(e){return e!==void 0&&/[-*>#$]/.test(e)}isWhiteSpaceOrCommonMarker(e){return this.isWhiteSpaceChar(e)||this.isCommonMarker(e)}endsWithMarker(e){if(e.length===0)return!1;if(this.isCommonMarker(e[e.length-1]))return!0;let r=e.length>=2?e.slice(-2):"",n=e.length>=3?e.slice(-3):"";return!!(r==="##"||r.match(/^#{1,6} $/)||r==="--"||n==="-->"||e.includes("## Heading"))}},Qpt=class{process(e){let{prefix:r,suffix:n,completion:o,context:i}=e,a=o;return r.endsWith(" ")&&a.startsWith(" ")&&(a=a.trimStart()),n.startsWith(" ")&&a.endsWith(" ")&&(a=a.trimEnd()),(i==="UnorderedList"||i==="NumberedList"||i==="TaskList")&&r.endsWith(`
|
||
`)&&a.startsWith(`
|
||
`)&&(a=a.substring(1)),a}},emt=class{process(e){let{completion:r,context:n}=e;if(n==="CodeBlock"){let o=r;return o=o.replace(/```[a-zA-Z]*[ \t]*\n?/g,""),o=o.replace(/\n?```[ \t]*\n?/g,""),o.endsWith(`
|
||
`)&&(o=o.slice(0,-1)),o}return r}},tje=class{constructor(){this.processors=[];this.processors.push(new emt),this.processors.push(new Ypt),this.processors.push(new Qpt)}process(e,r,n,o){let a={prefix:e,suffix:r,completion:n,context:o};for(let s of this.processors)a.completion=s.process(a);return a.completion}};iee();var q2r=require("obsidian");function B2r(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 U2r(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 q2r.TFile&&(r.push(i),r.length>=e))break}return r}vOe();Pt();var tmt=require("obsidian"),SYo=.4,CYo=20,z2r=.7,rje=.3;async function xYo(t,e){let r=ce().debug,n=await G1.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 OYo(t){if(t.length===0)return[];let e=t[0].length,r=Array(e).fill(0);for(let n of t)for(let o=0;o<e;o++)r[o]+=n[o];for(let n=0;n<e;n++)r[n]/=t.length;return r}function TYo(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 EYo({db:t,filePath:e}){let r=ce().debug,n=await xYo(e,t),o=OYo(n);if(o.length===0)return r&&console.log("No embeddings found for note:",e),new Map;let i=await G1.getDocsByEmbedding(t,o,{limit:CYo,similarity:SYo});return TYo(i,e)}function PYo(t){let e=new Map,n=B2r(t).map(a=>a.path);for(let a of n)e.set(a,{links:!0,backlinks:!1});let i=U2r(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 MYo(t,e){let r=new Map,n=z2r+rje;for(let[o,i]of t)r.set(o,i*z2r/n);for(let[o,i]of e){let a=0;i.links&&i.backlinks?a=rje:(i.links||i.backlinks)&&(a=rje*.8),r.set(o,(r.get(o)??0)+a)}return r}async function oje({db:t,filePath:e}){let r=app.vault.getAbstractFileByPath(e);if(!(r instanceof tmt.TFile))return[];let n=await EYo({db:t,filePath:e}),o=PYo(r),i=MYo(n,o);return Array.from(i.entries()).sort((s,u)=>{let l=s[0],c=u[0],d=nje(n.get(l)??0),f=nje(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 tmt.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 nje(t){return t>.7?3:t>.55?2:1}var V2r=require("obsidian"),RYo={cjk:[[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983]],japanese:[[12352,12447],[12448,12543]],korean:[[44032,55215],[4352,4607]],other:[[3584,3711],[1536,1791],[2304,2431],[2432,2559],[2688,2815],[2944,3071]]};function AYo(t,e){let r=t.codePointAt(0);return r?e.some(([n,o])=>r>=n&&r<=o):!1}function J2r(t){let e=t.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"");if(!e)return!1;for(let r of e)if(Object.values(RYo).some(n=>AYo(r,n)))return!0;return!1}function K2r(t,e){let r="",n="",o=Math.max(0,e.line-5);for(let u=o;u<e.line;u++)r+=t.getLine(u)+`
|
||
`;let i=t.getLine(e.line);r+=i.slice(0,e.ch),(e.ch===0||e.ch===i.length&&i.trim()==="")&&(r+=`
|
||
`);let a=Math.max(0,e.line-50);for(let u=a;u<e.line;u++)n+=t.getLine(u)+`
|
||
`;n+=i.slice(0,e.ch)+"{{CURSOR}}"+i.slice(e.ch)+`
|
||
`;let s=Math.min(t.lineCount()-1,e.line+50);for(let u=e.line+1;u<=s;u++)n+=t.getLine(u)+`
|
||
`;return{prefix:r,noteContext:n}}var OB=class OB{constructor(){this.currentNotePath=null;this.cachedNotes=null;this.cachedNoteTitles=[]}static getInstance(){return OB.instance||(OB.instance=new OB),OB.instance}getRelevantNoteTitles(){return this.cachedNoteTitles}async getRelevantNotes(e){if(!e)return this.currentNotePath=null,this.cachedNotes=null,this.cachedNoteTitles=[],"";if(this.currentNotePath===e.path&&this.cachedNotes!==null)return this.cachedNotes;let r=[];try{let a=await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().getDb();a&&(r=await oje({db:a,filePath:e.path}))}catch(i){console.warn("Failed to fetch relevant notes for autocomplete:",i)}let n=r.slice(0,OB.MAX_RELEVANT_NOTES);this.cachedNoteTitles=n.map(i=>i.document.title);let o=await Promise.all(n.map(async i=>{let a=app.vault.getAbstractFileByPath(i.document.path);if(!(a instanceof V2r.TFile))return"";let s=await app.vault.cachedRead(a);if(!s)return"";let u=s.length>3e3?s.slice(0,3e3)+"...":s;return`[[${i.document.title}]]:
|
||
|
||
${u}`}));return this.currentNotePath=e.path,this.cachedNotes=o.join(`
|
||
|
||
`),this.cachedNotes}clearCache(){this.currentNotePath=null,this.cachedNotes=null,this.cachedNoteTitles=[]}};OB.MAX_RELEVANT_NOTES=3;var H2r=OB;var _J=class{constructor(){this.MIN_WORD_LENGTH=4;this.STOP_WORDS=new Set(["a","ain","all","am","an","and","any","are","as","at","be","but","by","can","d","did","do","don","few","for","had","has","he","her","him","his","how","i","if","in","is","isn","it","its","ll","m","ma","me","my","no","nor","not","now","o","of","off","on","or","our","out","own","re","s","she","so","t","the","to","too","up","ve","was","we","who","why","won","y","you"])}extractWords(e){return(this.preprocessText(e).match(/\b[a-zA-Z]+(?:'[a-zA-Z]+)?\b/g)||[]).filter(o=>this.isValidWord(o))}isWordCharacter(e){return/[a-zA-Z']/.test(e)}isValidWord(e){return!(e.length<this.MIN_WORD_LENGTH||!/^[a-zA-Z]+(?:'[a-zA-Z]+)?$/.test(e)||this.STOP_WORDS.has(e.toLowerCase())||e===e.toUpperCase()&&e.length>4)}getLanguage(){return"en"}preprocessText(e){return e.replace(/```[\s\S]*?```/g," ").replace(/`[^`]+`/g," ").replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/<[^>]+>/g," ").replace(/^#+\s+/gm,"").replace(/[*_]{1,2}([^*_]+)[*_]{1,2}/g,"$1").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/\s+/g," ").trim()}};var ace=class{constructor(e=5e4){this.wordCount=0;this.root=this.createNode(),this.maxSize=e}createNode(){return{children:new Map,isEndOfWord:!1,wordEntry:void 0}}addWord(e,r){if(!e||e.length<4||this.wordCount>=this.maxSize&&!this.hasWord(e))return;let n=this.root;for(let o of e)n.children.has(o)||n.children.set(o,this.createNode()),n=n.children.get(o);n.isEndOfWord?n.wordEntry&&(n.wordEntry.frequency++,n.wordEntry.lastSeen=Date.now(),r&&!n.wordEntry.contexts.includes(r)&&(n.wordEntry.contexts.push(r),n.wordEntry.contexts.length>10&&(n.wordEntry.contexts=n.wordEntry.contexts.slice(-10)))):(n.isEndOfWord=!0,n.wordEntry={word:e,frequency:1,contexts:r?[r]:[],lastSeen:Date.now()},this.wordCount++)}hasWord(e){let r=this.findNode(e);return r!==null&&r.isEndOfWord}getWordEntry(e){let r=this.findNode(e);return r&&r.isEndOfWord&&r.wordEntry?r.wordEntry:null}findNode(e){let r=this.root;for(let n of e){if(!r.children.has(n))return null;r=r.children.get(n)}return r}getSuggestions(e,r=10){if(!e)return[];let n=[],o=this.generatePrefixVariants(e);for(let a of o){let s=this.findNode(a);if(s&&(this.collectWords(s,a,n,r,e),n.length>=r))break}let i=this.deduplicateSuggestions(n);return i.sort((a,s)=>s.score-a.score),i.slice(0,r)}generatePrefixVariants(e){let r=new Set;return r.add(e),r.add(e.toLowerCase()),e.length>0&&r.add(e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()),r.add(e.toUpperCase()),Array.from(r)}deduplicateSuggestions(e){let r=new Map;for(let n of e){let o=n.word,i=r.get(o);(!i||n.score>i.score)&&r.set(o,n)}return Array.from(r.values())}collectWords(e,r,n,o,i){if(!(n.length>=o)){if(e.isEndOfWord&&e.wordEntry){let a=this.calculateScore(e.wordEntry)+this.getCaseMatchBonus(r,i);n.push({word:r,score:a,source:"vault"})}for(let[a,s]of e.children)this.collectWords(s,r+a,n,o,i)}}getCaseMatchBonus(e,r){if(e.length<r.length)return 0;let n=e.substring(0,r.length);return n===r?2:this.hasSameCasePattern(n,r)?1.5:1}hasSameCasePattern(e,r){if(e.length<r.length)return!1;for(let n=0;n<r.length;n++){let o=e[n],i=r[n],a=o===o.toUpperCase(),s=i===i.toUpperCase();if(a!==s)return!1}return!0}calculateScore(e){let r=Math.log(e.frequency+1)*10,n=Math.max(0,(Date.now()-e.lastSeen)/(1e3*60*60*24)),o=Math.max(0,10-n);return r+o}getStats(){let e=0,r=0,n=(o,i=0)=>{e++,r=Math.max(r,i);for(let a of o.children.values())n(a,i+1)};return n(this.root),{wordCount:this.wordCount,nodeCount:e,maxDepth:r}}clear(){this.root=this.createNode(),this.wordCount=0}getAllWords(){let e=[],r=n=>{n.isEndOfWord&&n.wordEntry&&e.push(n.wordEntry);for(let o of n.children.values())r(o)};return r(this.root),e}addWords(e,r){for(let n of e)this.addWord(n,r)}pruneByFrequency(e=2){let r=0,n=o=>{let i=[];for(let[a,s]of o.children)n(s)&&i.push(a);for(let a of i)o.children.delete(a);return o.isEndOfWord&&o.wordEntry&&o.wordEntry.frequency<e&&(o.isEndOfWord=!1,o.wordEntry=void 0,this.wordCount--,r++),o.children.size===0&&!o.isEndOfWord};return n(this.root),r}};Dt();var W2r=require("obsidian");var sce=class{constructor(e,r,n,o){this.isScanning=!1;this.vault=e,this.settings=r,this.performance=n,this.tokenizer=o||new _J}async scanVault(e){let r=Date.now(),n=[],o=new Map;try{let i=this.vault.getMarkdownFiles(),a=0;for(let l of i)try{e&&e({currentFile:l.path,processedFiles:a,totalFiles:i.length,foundWords:o.size});try{let d=await this.vault.adapter.stat(l.path);if(d&&d.size>this.performance.maxFileSize){n.push(`Skipped large file: ${l.path}`);continue}}catch{}let c=await this.vault.read(l);await this.processFile(l.path,c,o),a++,a%this.performance.batchSize===0&&await new Promise(d=>setTimeout(d,1))}catch(c){let d=`Error processing file ${l.path}: ${c}`;ue(d),n.push(d)}(this.settings.includeFileNames||this.settings.includeFolderNames)&&this.processFileAndFolderNames(o);let s=Date.now()-r;return{wordCount:o.size,fileCount:a,errors:n,scanTimeMs:s,wordMap:o}}catch(i){throw ue("[Word Completion] Vault scan failed:",i),i}}async scanFile(e){if(e.stat.size>this.performance.maxFileSize)return[];if(e.extension!=="md")return[];try{let r=await this.vault.read(e);return this.extractWordsFromText(r)}catch(r){return ue(`[Word Completion] Error reading file ${e.path}:`,r),[]}}extractWordsFromText(e){return!e||e.trim().length===0?[]:this.tokenizer.extractWords(e).filter(n=>{if(n.length<this.settings.minWordLength)return!1;for(let o of this.settings.excludePatterns)try{if(new RegExp(o,"i").test(n))return!1}catch(i){ue(`[Word Completion] Invalid exclude pattern: ${o}`,i)}return!0})}extractPathWords(){let e=new Set,r=n=>{let o=n.split("/").filter(Boolean);for(let i of o)i.replace(/\.[^.]+$/,"").split(/[^a-zA-Z]+/).filter(u=>u.length>=this.settings.minWordLength).filter(u=>this.tokenizer.isValidWord(u)).forEach(u=>e.add(u.toLowerCase()))};if(this.settings.includeFileNames&&this.vault.getMarkdownFiles().forEach(n=>{r(n.path)}),this.settings.includeFolderNames){let n=o=>{r(o.path),o.children.forEach(i=>{i instanceof W2r.TFolder&&n(i)})};n(this.vault.getRoot())}return Array.from(e)}getFilesToScan(){return this.vault.getMarkdownFiles().filter(e=>!(e.stat.size>this.performance.maxFileSize))}isScanningScanVault(){return this.isScanning}getEstimatedScanTime(){let r=this.getFilesToScan().reduce((o,i)=>o+i.stat.size,0);return Math.max(1,r/(1024*1024))*1e3}setTokenizer(e){this.tokenizer=e}updateSettings(e){this.settings=e}updatePerformance(e){this.performance=e}async processFile(e,r,n){let o=this.extractWordsFromText(r);for(let i of o){n.has(i)||n.set(i,{frequency:0,contexts:new Set});let a=n.get(i);a.frequency++,a.contexts.add(e)}}processFileAndFolderNames(e){let r=this.extractPathWords();for(let n of r)e.has(n)||e.set(n,{frequency:0,contexts:new Set}),e.get(n).frequency++,e.get(n).contexts.add("filename")}};Dt();var Sx=class Sx{constructor(e){this.isInitialized=!1;this.lastScanTime=0;this.vault=e,this.settings={...Sx.DEFAULT_SETTINGS},this.performance={...Sx.DEFAULT_PERFORMANCE},this.tokenizer=new _J,this.trie=new ace(this.performance.maxTrieSize),this.scanner=new sce(this.vault,this.settings,this.performance,this.tokenizer)}static getInstance(e){return Sx.instance||(Sx.instance=new Sx(e)),Sx.instance}async initialize(e){if(this.isInitialized)return{wordCount:this.trie.getStats().wordCount,fileCount:0,errors:[],scanTimeMs:0};try{await new Promise(o=>setTimeout(o,100)),this.vault.getAllLoadedFiles().length===0&&await new Promise(o=>setTimeout(o,500));let n=await this.scanner.scanVault(e);return await this.populateTrieFromScanResult(n),this.isInitialized=!0,this.lastScanTime=Date.now(),n}catch(r){throw ue("[Word Completion] Initialization failed:",r),r}}getSuggestions(e){if(!this.isInitialized||!this.settings.enabled)return[];if(!e||e.length<this.settings.minPrefixLength)return[];if(!this.tokenizer.isWordCharacter(e[e.length-1]))return[];try{let r=this.settings.caseSensitive?e:e.toLowerCase();return this.trie.getSuggestions(r,this.settings.maxSuggestions).filter(i=>i.word.toLowerCase()!==e.toLowerCase())}catch(r){return ue("[Word Completion] Error getting suggestions:",r),[]}}shouldTriggerCompletion(e,r){if(!this.isInitialized||!this.settings.enabled)return!1;let n=e.substring(0,r),o=this.getCurrentWord(n);if(!o||o.length<this.settings.minPrefixLength)return!1;if(r>0){let s=e[r-1];if(/\s/.test(s))return!1}return this.getSuggestions(o).length>0}getCurrentWord(e){let r=e.length;for(let n=e.length-1;n>=0;n--){let o=e[n];if(!this.tokenizer.isWordCharacter(o)){r=n+1;break}n===0&&(r=0)}return e.substring(r).trim()}addWord(e,r){if(!(!this.isInitialized||!e||e.length<this.settings.minWordLength)&&this.tokenizer.isValidWord(e)){let n=this.settings.caseSensitive?e:e.toLowerCase();this.trie.addWord(n,r)}}getStats(){return{isInitialized:this.isInitialized,trieStats:this.trie.getStats(),lastScanTime:this.lastScanTime,settings:{...this.settings}}}updateSettings(e){this.settings={...this.settings,...e},this.scanner.updateSettings(this.settings)}updatePerformance(e){this.performance={...this.performance,...e},this.scanner.updatePerformance(this.performance)}reset(){this.trie.clear(),this.isInitialized=!1,this.lastScanTime=0}async rescan(e){return this.reset(),await this.initialize(e)}needsRescan(){return!1}getTokenizer(){return this.tokenizer}setTokenizer(e){this.tokenizer=e,this.scanner.setTokenizer(e)}async populateTrieFromScanResult(e){let r=e.wordMap;if(r)for(let[n,o]of r){let i=this.settings.caseSensitive?n:n.toLowerCase();for(let a=0;a<o.frequency;a++)this.trie.addWord(i,Array.from(o.contexts)[0]||"vault")}}destroy(){this.reset(),Sx.instance=null}};Sx.DEFAULT_SETTINGS={enabled:!0,minPrefixLength:2,maxSuggestions:20,includeVaultWords:!0,includeFileNames:!0,includeFolderNames:!0,caseSensitive:!1,minWordLength:4,excludePatterns:[]},Sx.DEFAULT_PERFORMANCE={maxTrieSize:5e4,maxFileSize:1024*1024,batchSize:100};var vJ=Sx;Dt();var IYo=require("obsidian");var ije=class t{constructor(e){this.options=e;this.isActive=!1;this.activeRequests=new Map;this.lastRequestTime=0;this.minRequestInterval=100;this.lastCursorPosition=null;this.cacheEnabled=!0;this.handleSettingsChange=(e,r)=>{if(e.autocompleteAcceptKey!==r.autocompleteAcceptKey){let n=this.validateAcceptKey(r.autocompleteAcceptKey);this.acceptKey=n,this.setupGlobalKeyHandler()}e.enableWordCompletion!==r.enableWordCompletion&&(r.enableWordCompletion&&this.initializeWordCompletion(),this.recreateExtension())};this.cache=ice.getInstance(),this.client=Ru.getInstance(),this.postProcessor=new tje,this.wordCompletionManager=vJ.getInstance(app.vault);let r=ce().autocompleteAcceptKey||Xw.KEYBIND;this.acceptKey=this.validateAcceptKey(r),this.recreateExtension(),this.setupGlobalKeyHandler(),this.unsubscribeFromSettings=Ou(this.handleSettingsChange),this.initializeWordCompletion()}validateAcceptKey(e){return["Tab","Space","ArrowRight"].includes(e)?e:"Tab"}async initializeWordCompletion(){if(ce().enableWordCompletion)try{await this.wordCompletionManager.initialize()}catch(r){ue("[Copilot Autocomplete] Failed to initialize word completion:",r)}}recreateExtension(){let{extension:e,force_fetch:r}=eje({fetchFn:()=>this.handleUnifiedCompletion(),delay:this.options.delay,continue_suggesting:!1,accept_shortcut:null});this.extension=e,this.forceFetch=r,this.updateActiveEditors()}setupGlobalKeyHandler(){this.globalKeyListener&&document.removeEventListener("keydown",this.globalKeyListener,!0),this.globalKeyListener=e=>{if(!this.isActive)return;let r={Tab:["Tab"],Space:[" ","Space"],ArrowRight:["ArrowRight","Right"]},n=app.workspace.getActiveViewOfType(rmt.MarkdownView);if(!n?.editor)return;let o=n.editor.cm;if(!o)return;let i=this.hasActiveCompletion(o),a;for(let[s,u]of Object.entries(r))if(u.includes(e.key)){a=s;break}if(a===this.acceptKey&&i){let u=o.dom.querySelector(".cm-inline-suggestion")?.textContent||"";if(u){e.preventDefault(),e.stopPropagation();let l=o.state.selection.main.head,c=a==="Space"?" ":"";o.dispatch({changes:[{from:l,to:l,insert:u+c}],selection:{anchor:l+u.length+c.length}}),this.forceFetch();return}}if(e.key==="Tab"&&this.acceptKey!=="Tab"&&i){e.preventDefault(),e.stopPropagation();let s=o.state.selection.main.head;o.dispatch({changes:[{from:s,to:s,insert:" "}],selection:{anchor:s+1}})}},document.addEventListener("keydown",this.globalKeyListener,!0)}updateActiveEditors(){let e=app.workspace.getLeavesOfType("markdown");for(let r of e){let n=r.view;if(!n?.editor)continue;let o=n.editor.cm;if(o)try{o.dispatch({})}catch(i){ue(`[Copilot Autocomplete] Error updating editor: ${i}`)}}}hasActiveCompletion(e){let r=[".cm-inline-suggestion",".cm-ghost-text"];for(let n of r)if(Array.from(e.dom.querySelectorAll(n)).length>0)return!0;return!1}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}setActive(e){this.isActive=e}getExtension(){return this.extension}destroy(){this.globalKeyListener&&document.removeEventListener("keydown",this.globalKeyListener,!0),this.unsubscribeFromSettings&&this.unsubscribeFromSettings(),this.wordCompletionManager&&this.wordCompletionManager.destroy(),this.activeRequests.clear(),this.cache.clear()}shouldContinueSuggesting(e,r){if(e.endsWith("[[")||/\[\[[^\]]*$/.test(e)||r&&!r.startsWith(`
|
||
`))return!1;let o=e.split(`
|
||
`),i=o[o.length-1];if(/^#{1,6}(\s*)$/.test(i))return!1;let a=e.trim().split(/\s+/).filter(u=>u.replace(/[\p{Emoji}\p{Symbol}\p{Punctuation}]/gu,"").length>0),s=a[a.length-1]||"";return J2r(s)?!0:e.endsWith(" ")}async*handleUnifiedCompletion(){if(!this.isActive)return;let e=app.workspace.getActiveViewOfType(rmt.MarkdownView);if(!e)return;await new Promise(c=>setTimeout(c,10));let r=e.editor,n=r.getCursor(),{prefix:o,noteContext:i}=K2r(r,n),a=r.getLine(n.line).substring(n.ch)||"";if(this.lastCursorPosition){let c=Math.abs(n.line-this.lastCursorPosition.line),d=Math.abs(n.ch-this.lastCursorPosition.ch);(c>0||d>5)&&this.clearActiveRequests()}this.lastCursorPosition={line:n.line,ch:n.ch};let s=Date.now();if(s-this.lastRequestTime<this.minRequestInterval)return;let u=ce();if(this.shouldUseWordCompletion(o,u)){let c=this.getCurrentWordFromPrefix(o);if(!c||c.length<2)return;let d=`word:${c}:${o.slice(-50)}`;if(this.activeRequests.has(d))return;let f=this.wordCompletionManager.getSuggestions(c);if(f.length===0)return;let p=f.some(b=>b.word===c),m=f.some(b=>b.word.length-c.length>=2);if(p&&!m)return;let h=p?f.filter(b=>b.word!==c):f;if(h.length===0)return;this.lastRequestTime=s;let g=h[0],y=this.generateCaseMatchedCompletion(g.word,c);y&&(yield{display_suggestion:y,complete_suggestion:y})}else{if(!u.enableAutocomplete||!this.shouldContinueSuggesting(o,a))return;let c=o.slice(-this.options.maxContextLength);if(c.length<this.options.minTriggerLength)return;let d=`sentence:${c.slice(-100)}`;if(this.activeRequests.has(d))return;this.lastRequestTime=s;return}}shouldUseWordCompletion(e,r){if(!r.enableWordCompletion||e.endsWith("[[")||/\[\[[^\]]*$/.test(e))return!1;let o=e.trim(),i=o[o.length-1];if(i&&/[a-zA-Z']/.test(i)){let a=this.getCurrentWordFromPrefix(e);if(a&&a.length>=2){let s=this.wordCompletionManager.getSuggestions(a);if(s.length===0)return!1;let u=s.some(c=>c.word===a),l=s.some(c=>c.word.length-a.length>=2);return!(u&&!l)}}return!1}getCurrentWordFromPrefix(e){let r=e.length;for(let o=e.length-1;o>=0;o--){let i=e[o];if(!/[a-zA-Z']/.test(i)){r=o+1;break}o===0&&(r=0)}let n=e.substring(r);return n.length>=2?n:null}generateCaseMatchedCompletion(e,r){if(e.length<=r.length)return"";let n=e.substring(r.length),o=r===r.toUpperCase(),i=r===r.toLowerCase(),a=r.length>0&&r[0]===r[0].toUpperCase()&&r.slice(1)===r.slice(1).toLowerCase();return o?n.toUpperCase():i||a?n.toLowerCase():n}detectContext(e){let r=e.split(`
|
||
`).pop()||"";if(/^\s*[-*+]\s/.test(r))return"UnorderedList";if(/^\s*\d+\.\s/.test(r))return"NumberedList";if(/^\s*[-*+]\s\[[ x]\]\s/.test(r))return"TaskList";if(e.includes("```")&&(e.split("```").length-1)%2===1)return"CodeBlock"}triggerCompletion(){this.isActive&&(this.clearActiveRequests(),this.forceFetch())}clearActiveRequests(){this.activeRequests.size>0&&this.activeRequests.clear()}getWordCompletionManager(){return this.wordCompletionManager}setCacheEnabled(e){this.cacheEnabled=e,e||this.cache.clear()}getCacheEnabled(){return this.cacheEnabled}};var aje=class t{constructor(e){this.plugin=e;let r=ce();this.cmIntegration=ije.getInstance({delay:Xw.DELAY_MS,minTriggerLength:Xw.MIN_TRIGGER_LENGTH,maxContextLength:Xw.MAX_CONTEXT_LENGTH}),this.unsubscribeSettings=Ou((o,i)=>{let a=(o.enableAutocomplete||o.enableWordCompletion)&&o.isPlusUser===!0,s=(i.enableAutocomplete||i.enableWordCompletion)&&i.isPlusUser===!0;a!==s&&this.cmIntegration.setActive(s)});let n=(r.enableAutocomplete||r.enableWordCompletion)&&r.isPlusUser===!0;this.cmIntegration.setActive(n),this.registerExtension()}static getInstance(e){return t.instance||(t.instance=new t(e)),t.instance}registerExtension(){try{this.plugin.registerEditorExtension([this.cmIntegration.getExtension()])}catch(e){ue("[Copilot Autocomplete] Failed to register CodeMirror extension:",e)}}destroy(){this.unsubscribeSettings(),this.cmIntegration.setActive(!1),this.cmIntegration.destroy()}};Tu();L6();iot();hie();Dt();W7();var xHr=require("obsidian");Ro();var sje=L(X());jn();var yi=sje.forwardRef(({className:t,type:e,...r},n)=>sje.createElement("input",{type:e,className:Oe("!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}));yi.displayName="Input";var uje=L(X());var eHr=L(X(),1);var Z2r=L(X(),1),X2r=L(Bu(),1);var Ig=L(X(),1);var G2r=L(X(),1);function NYo(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function wJ(...t){return e=>t.forEach(r=>NYo(r,e))}function Fc(...t){return G2r.useCallback(wJ(...t),t)}var eZ=L(mt(),1),omt=Ig.forwardRef((t,e)=>{let{children:r,...n}=t,o=Ig.Children.toArray(r),i=o.find(DYo);if(i){let a=i.props.children,s=o.map(u=>u===i?Ig.Children.count(a)>1?Ig.Children.only(null):Ig.isValidElement(a)?a.props.children:null:u);return(0,eZ.jsx)(nmt,{...n,ref:e,children:Ig.isValidElement(a)?Ig.cloneElement(a,void 0,s):null})}return(0,eZ.jsx)(nmt,{...n,ref:e,children:r})});omt.displayName="Slot";var nmt=Ig.forwardRef((t,e)=>{let{children:r,...n}=t;if(Ig.isValidElement(r)){let o=LYo(r);return Ig.cloneElement(r,{...$Yo(n,r.props),ref:e?wJ(e,o):o})}return Ig.Children.count(r)>1?Ig.Children.only(null):null});nmt.displayName="SlotClone";var jYo=({children:t})=>(0,eZ.jsx)(eZ.Fragment,{children:t});function DYo(t){return Ig.isValidElement(t)&&t.type===jYo}function $Yo(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 LYo(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 Y2r=L(mt(),1),FYo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ou=FYo.reduce((t,e)=>{let r=Z2r.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?omt:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Y2r.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Q2r(t,e){t&&X2r.flushSync(()=>t.dispatchEvent(e))}var tHr=L(mt(),1),kYo="Label",rHr=eHr.forwardRef((t,e)=>(0,tHr.jsx)(ou.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=kYo;var imt=rHr;Oye();jn();var BYo=IK("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),Ib=uje.forwardRef(({className:t,...e},r)=>uje.createElement(imt,{ref:r,className:Oe(BYo(),t),...e}));Ib.displayName=imt.displayName;var nZ=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 amt(...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(amt(...t),t)}var m0=L(X(),1),smt=L(mt(),1);function aHr(t,e){let r=m0.createContext(e),n=i=>{let{children:a,...s}=i,u=m0.useMemo(()=>s,Object.values(s));return(0,smt.jsx)(r.Provider,{value:u,children:a})};n.displayName=t+"Provider";function o(i){let a=m0.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 TB(t,e=[]){let r=[];function n(i,a){let s=m0.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,g=m0.useMemo(()=>m,Object.values(m));return(0,smt.jsx)(h.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=m0.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=>m0.createContext(a));return function(s){let u=s?.[t]||i;return m0.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,UYo(o,...e)]}function UYo(...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 m0.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}function umt(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var EB=L(X(),1);var tZ=L(X(),1);function ad(t){let e=tZ.useRef(t);return tZ.useEffect(()=>{e.current=t}),tZ.useMemo(()=>(...r)=>e.current?.(...r),[])}function GD({prop:t,defaultProp:e,onChange:r=()=>{}}){let[n,o]=zYo({defaultProp:e,onChange:r}),i=t!==void 0,a=i?t:n,s=ad(r),u=EB.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 zYo({defaultProp:t,onChange:e}){let r=EB.useState(t),[n]=r,o=EB.useRef(n),i=ad(e);return EB.useEffect(()=>{o.current!==n&&(i(n),o.current=n)},[n,o,i]),r}var lje=L(X(),1);function cje(t){let e=lje.useRef({value:t,previous:t});return lje.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var uHr=L(X(),1);var sHr=L(X(),1),gl=globalThis?.document?sHr.useLayoutEffect:()=>{};function dje(t){let[e,r]=uHr.useState(void 0);return gl(()=>{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 J_=L(X(),1);var cHr=L(X(),1);function lHr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function HYo(...t){return e=>{let r=!1,n=t.map(o=>{let i=lHr(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():lHr(t[o],null)}}}}function dHr(...t){return cHr.useCallback(HYo(...t),t)}var fHr=L(X(),1);function VYo(t,e){return fHr.useReducer((r,n)=>e[r][n]??r,t)}var ZD=t=>{let{present:e,children:r}=t,n=JYo(e),o=typeof r=="function"?r({present:n.isPresent}):J_.Children.only(r),i=dHr(n.ref,KYo(o));return typeof r=="function"||n.isPresent?J_.cloneElement(o,{ref:i}):null};ZD.displayName="Presence";function JYo(t){let[e,r]=J_.useState(),n=J_.useRef({}),o=J_.useRef(t),i=J_.useRef("none"),a=t?"mounted":"unmounted",[s,u]=VYo(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return J_.useEffect(()=>{let l=fje(n.current);i.current=s==="mounted"?l:"none"},[s]),gl(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=fje(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),gl(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=fje(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=p=>{p.target===e&&(i.current=fje(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=>{l&&(n.current=getComputedStyle(l)),r(l)},[])}}function fje(t){return t?.animationName||"none"}function KYo(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 pHr=L(X(),1),YYo=L(Bu(),1);var Ng=L(X(),1);var rZ=L(mt(),1),cmt=Ng.forwardRef((t,e)=>{let{children:r,...n}=t,o=Ng.Children.toArray(r),i=o.find(GYo);if(i){let a=i.props.children,s=o.map(u=>u===i?Ng.Children.count(a)>1?Ng.Children.only(null):Ng.isValidElement(a)?a.props.children:null:u);return(0,rZ.jsx)(lmt,{...n,ref:e,children:Ng.isValidElement(a)?Ng.cloneElement(a,void 0,s):null})}return(0,rZ.jsx)(lmt,{...n,ref:e,children:r})});cmt.displayName="Slot";var lmt=Ng.forwardRef((t,e)=>{let{children:r,...n}=t;if(Ng.isValidElement(r)){let o=XYo(r);return Ng.cloneElement(r,{...ZYo(n,r.props),ref:e?amt(e,o):o})}return Ng.Children.count(r)>1?Ng.Children.only(null):null});lmt.displayName="SlotClone";var WYo=({children:t})=>(0,rZ.jsx)(rZ.Fragment,{children:t});function GYo(t){return Ng.isValidElement(t)&&t.type===WYo}function ZYo(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 XYo(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 mHr=L(mt(),1),QYo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],dmt=QYo.reduce((t,e)=>{let r=pHr.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?cmt:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,mHr.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var MB=L(mt(),1),fmt="Checkbox",[eQo,Cps]=TB(fmt),[tQo,rQo]=eQo(fmt),hHr=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),g=f?c||!!f.closest("form"):!0,[y=!1,b]=GD({prop:o,defaultProp:i,onChange:l}),_=yw.useRef(y);return yw.useEffect(()=>{let w=f?.form;if(w){let x=()=>b(_.current);return w.addEventListener("reset",x),()=>w.removeEventListener("reset",x)}},[f,b]),(0,MB.jsxs)(tQo,{scope:r,state:y,disabled:s,children:[(0,MB.jsx)(dmt.button,{type:"button",role:"checkbox","aria-checked":PB(y)?"mixed":y,"aria-required":a,"data-state":bHr(y),"data-disabled":s?"":void 0,disabled:s,value:u,...d,ref:m,onKeyDown:umt(t.onKeyDown,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:umt(t.onClick,w=>{b(x=>PB(x)?!0:!x),g&&(h.current=w.isPropagationStopped(),h.current||w.stopPropagation())})}),g&&(0,MB.jsx)(nQo,{control:f,bubbles:!h.current,name:n,value:u,checked:y,required:a,disabled:s,form:c,style:{transform:"translateX(-100%)"},defaultChecked:PB(i)?!1:i})]})});hHr.displayName=fmt;var gHr="CheckboxIndicator",yHr=yw.forwardRef((t,e)=>{let{__scopeCheckbox:r,forceMount:n,...o}=t,i=rQo(gHr,r);return(0,MB.jsx)(ZD,{present:n||PB(i.state)||i.state===!0,children:(0,MB.jsx)(dmt.span,{"data-state":bHr(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});yHr.displayName=gHr;var nQo=t=>{let{control:e,checked:r,bubbles:n=!0,defaultChecked:o,...i}=t,a=yw.useRef(null),s=cje(r),u=dje(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=PB(r),p.call(c,PB(r)?!1:r),c.dispatchEvent(m)}},[s,r,n]);let l=yw.useRef(PB(r)?!1:r);return(0,MB.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 PB(t){return t==="indeterminate"}function bHr(t){return PB(t)?"indeterminate":t?"checked":"unchecked"}var pmt=hHr,_Hr=yHr;On();jn();var sd=nZ.forwardRef(({className:t,...e},r)=>nZ.createElement(pmt,{ref:r,className:Oe("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},nZ.createElement(_Hr,{className:Oe("tw-flex tw-items-center tw-justify-center tw-text-current")},nZ.createElement(Uu,{className:"tw-size-4"}))));sd.displayName=pmt.displayName;var h0=L(X());jn();var Cx=h0.forwardRef(({className:t,value:e,...r},n)=>{let o=h0.useRef(null),i=h0.useCallback(()=>{let s=o.current;if(s){s.style.height="auto";let u=Math.min(s.scrollHeight,300);s.style.height=`${u}px`}},[]);h0.useLayoutEffect(()=>{i()},[e,i]),h0.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 h0.createElement("textarea",{className:Oe("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})});Cx.displayName="Textarea";var Is=L(X()),OHr=L(wm());Pt();var wI=L(X());wr();On();zr();var mmt=({capabilities:t=[],iconSize:e=16})=>wI.default.createElement(wI.default.Fragment,null,t.sort((r,n)=>r.localeCompare(n)).map((r,n)=>{switch(r){case"reasoning":return wI.default.createElement(ZN,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});case"vision":return wI.default.createElement(WN,{key:n,className:"tw-text-model-capabilities-green",style:{width:e,height:e}});case"websearch":return wI.default.createElement(lC,{key:n,className:"tw-text-model-capabilities-blue",style:{width:e,height:e}});default:return null}})),hmt=({model:t,iconSize:e=14})=>{let r=t.displayName||t.name;return wI.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-1"},wI.default.createElement("span",{className:"tw-truncate tw-text-sm hover:tw-text-normal"},r),t.capabilities&&t.capabilities.length>0&&wI.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-0.5"},wI.default.createElement(mmt,{capabilities:t.capabilities,iconSize:e})))},pje=t=>{let e=t.displayName||t.name,r=`(${ib(t.provider)})`;return`${e} ${r}`},oZ=t=>{let e=t.displayName||t.name,r=`(${ib(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}`};jn();On();Dt();var SI=L(X());function vHr(){return SI.default.createElement("ul",{className:"tw-m-0 tw-px-4 tw-text-sm"},SI.default.createElement("li",null,SI.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{}")," represents the selected text."),SI.default.createElement("li",null,SI.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{[[Note Title]]}")," represents a note."),SI.default.createElement("li",null,SI.default.createElement("span",{className:"tw-font-medium tw-text-accent"},"{activeNote}")," represents the active note."),SI.default.createElement("li",null,SI.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 gmt="{copilot-selection}";var iZ="copilotquickcommand",CI={title:"",content:"",showInContextMenu:!0,showInSlashMenu:!0,order:0,modelKey:"",lastUsedMs:0},XD="copilot-command-context-menu-enabled",YD="copilot-command-slash-enabled",xI="copilot-command-context-menu-order",QD="copilot-command-model-key",e$="copilot-command-last-used",wHr=[{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}];var aZ=require("obsidian");Pt();TN();TN();var SJ=j6(),CJ=th([]),ymt=new Set;function xJ(t){ymt.add(t)}function OJ(t){ymt.delete(t)}function uce(t){return ymt.has(t)}function lce(t){let e=SJ.get(CJ);SJ.set(CJ,e.filter(r=>r.title!==t))}function TJ(t,e){let r=SJ.get(CJ),n;(e?r.findIndex(i=>i.title===e):-1)!==-1?n=r.map(i=>i.title===e?t:i):n=[...r,t],SJ.set(CJ,n)}function mje(t){SJ.set(CJ,t)}function hje(){return Zw(CJ,{store:SJ})}function K_(){return SJ.get(CJ)}iee();wr();zr();function gje(t,e,r){let n=t.trim();return r&&n===r?null:n?/[#<>:"/\\|?*[\]^\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 sZ(t){return encodeURIComponent(t.toLowerCase())}function RB(){return(0,aZ.normalizePath)(ce().customPromptsFolder)}function uZ(t){return`${RB()}/${t}.md`}function lZ(t){if(!(t instanceof aZ.TFile)||t.extension!=="md")return!1;let e=RB();return!(!t.path.startsWith(e+"/")||t.path.slice(e.length+1).includes("/"))}function iQo(t){if(t.startsWith("---")){let e=t.indexOf("---",3);if(e!==-1)return t.slice(e+3).trimStart()}return t}function SHr(t){return app.metadataCache.getFileCache(t)?.frontmatter?.[xI]!=null}async function cce(t){let e=await app.vault.read(t),r=iQo(e),n=app.metadataCache.getFileCache(t),o=n?.frontmatter?.[XD]??CI.showInContextMenu,i=n?.frontmatter?.[YD]??CI.showInSlashMenu,a=n?.frontmatter?.[e$]??CI.lastUsedMs,s=n?.frontmatter?.[xI]??CI.order,u=n?.frontmatter?.[QD]??CI.modelKey;return{title:t.basename,modelKey:u,content:r,showInContextMenu:o,showInSlashMenu:i,order:s,lastUsedMs:a}}async function yje(){let t=app.vault.getFiles().filter(r=>lZ(r)),e=await Promise.all(t.map(cce));return mje(e),e}function dce(t){return[...t].sort((e,r)=>e.order===r.order?e.title.localeCompare(r.title):e.order-r.order)}function aQo(t){return[...t].sort((e,r)=>e.lastUsedMs===r.lastUsedMs?e.title.localeCompare(r.title):r.lastUsedMs-e.lastUsedMs)}function sQo(t){return[...t].sort((e,r)=>e.title.localeCompare(r.title))}function bje(t){switch(ce().promptSortStrategy){case"timestamp":return aQo(t);case"alphabetical":return sQo(t);case"manual":return dce(t);default:return t}}async function bmt(t,e,r=!1){let o=(await _mt(t,e,app.vault,app.workspace.getActiveFile())).processedPrompt;if(o.includes(`{${u_}}`)||r)return o;let i=o.indexOf(gmt);return i===-1&&e.trim()?o+`
|
||
|
||
<`+u_+">"+e+"</"+u_+">":o.slice(0,i)+e+o.slice(i+gmt.length)}var uQo=/\{(?!copilot-selection\})([^}]+)\}/g;async function lQo(t,e,r){let n=new Map,o=new Set,i;for(;(i=uQo.exec(t))!==null;){let a=i[1].trim(),s={content:"",files:[]};if(a.toLowerCase()==="activenote")if(r){let u=await q6(r,e);u&&(s.content=`<${kz}>
|
||
## ${khe(r)}
|
||
|
||
${u}
|
||
</${kz}>`,s.files.push(r))}else new aZ.Notice("No active note found.");else if(a.startsWith("#")){let u=a.slice(1).split(",").map(d=>d.trim()),l=await Fhe(e,u),c=[];for(let d of l){let f=await q6(d,e);f&&(c.push(`<${kz}>
|
||
## ${khe(d)}
|
||
|
||
${f}
|
||
</${kz}>`),s.files.push(d))}s.content=c.join(`
|
||
|
||
`)}else{let u=SAt(a),l=await eee(e,u),c=[];for(let d of l){let f=await q6(d,e);f&&(c.push(`<${kz}>
|
||
## ${khe(d)}
|
||
|
||
${f}
|
||
</${kz}>`),s.files.push(d))}s.content=c.join(`
|
||
|
||
`)}s.content?(n.set(a,s.content),s.files.forEach(u=>o.add(u))):a.toLowerCase()!=="activenote"&&(a.startsWith('"')||console.warn(`No notes found for variable: ${a}`))}return{variablesMap:n,includedFiles:o}}async function _mt(t,e,r,n){let o=ce(),i=new Set;if(!o.enableCustomPromptTemplating)return t.includes("{}")&&!e&&n&&i.add(n),{processedPrompt:t+`
|
||
|
||
`,includedFiles:Array.from(i)};let{variablesMap:a,includedFiles:s}=await lQo(t,r,n);s.forEach(f=>i.add(f));let u=t,l="",c=null;u.includes("{}")&&(u=u.replace(/\{\}/g,`{${u_}}`),e?l+=`<${u_}>
|
||
${e}
|
||
</${u_}>`:n?(c=await q6(n,r),l+=`<${u_} type="active_note">
|
||
${c||""}
|
||
</${u_}>`,i.add(n)):l+=`<${u_}>
|
||
(No selected text or active note available)
|
||
</${u_}>`);for(let[f,p]of a.entries())f.toLowerCase()==="activenote"&&c!==null||(l?l+=`
|
||
|
||
<${see} name="${f}">
|
||
${p}
|
||
</${see}>`:l+=`<${see} name="${f}">
|
||
${p}
|
||
</${see}>`);let d=xO(u,r);for(let f of d)if(!i.has(f)){let p=await q6(f,r);if(p){let m=await r.adapter.stat(f.path),h=m?new Date(m.ctime).toISOString():"Unknown",g=m?new Date(m.mtime).toISOString():"Unknown",y=`<${aee}>
|
||
<title>${f.basename}</title>
|
||
<path>${f.path}</path>
|
||
<ctime>${h}</ctime>
|
||
<mtime>${g}</mtime>
|
||
<content>
|
||
${p}
|
||
</content>
|
||
</${aee}>`;l&&(l+=`
|
||
|
||
`),l+=`${y}`,i.add(f)}}return{processedPrompt:l?`${u}
|
||
|
||
${l}`:`${u}
|
||
|
||
`,includedFiles:Array.from(i)}}function CHr(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 _je(){let e=K_().reduce((r,n)=>r>n.order?r:n.order,0);return e===Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+10}async function vmt(t,e){try{xJ(t.path),await app.fileManager.processFrontMatter(t,r=>{r[XD]==null&&(r[XD]=e.showInContextMenu),r[YD]==null&&(r[YD]=e.showInSlashMenu),r[xI]==null&&(r[xI]=e.order),r[QD]==null&&(r[QD]=e.modelKey),r[e$]==null&&(r[e$]=e.lastUsedMs)})}finally{OJ(t.path)}}function vje(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()===`\`\`\`${iZ}`){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 cQo({commands:t,command:e,onConfirm:r,onCancel:n}){let i=So().activeModels.filter(f=>f.enabled).map(f=>({label:pje(f),value:Qn(f)})),[a,s]=(0,Is.useState)(e),[u,l]=(0,Is.useState)({}),c=(f,p)=>{s(m=>({...m,[f]:p})),l(m=>({...m,[f]:void 0}))},d=()=>{let f={},p=gje(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 Is.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4 tw-p-4"},Is.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Is.default.createElement(Ib,{htmlFor:"title"},"Name"),Is.default.createElement(yi,{id:"title",value:a.title,onChange:f=>c("title",f.target.value),placeholder:"Enter command name"}),u.title&&Is.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.title)),Is.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Is.default.createElement(Ib,{htmlFor:"content"},"Prompt"),Is.default.createElement(vHr,null),Is.default.createElement(Cx,{id:"content",value:a.content,onChange:f=>c("content",f.target.value),placeholder:"Enter command prompt",className:"tw-min-h-[200px]"}),u.content&&Is.default.createElement("div",{className:"tw-text-sm tw-text-error"},u.content)),Is.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},Is.default.createElement(Ib,{htmlFor:"modelKey"},"Model (Optional)"),Is.default.createElement("div",{className:"tw-group tw-relative tw-w-full"},Is.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)){ue(`Model ${p} not found`),c("modelKey","");return}c("modelKey",f.target.value)},className:Oe("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")},Is.default.createElement("option",{value:""},"Inherit from chat model"),i.map(f=>Is.default.createElement("option",{key:f.value,value:f.value.toString()},f.label))),Is.default.createElement("div",{className:Oe("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")},Is.default.createElement(Qs,{className:"tw-size-4"})))),Is.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Is.default.createElement(sd,{id:"showInContextMenu",checked:a.showInContextMenu,onCheckedChange:f=>c("showInContextMenu",f)}),Is.default.createElement(Ib,{htmlFor:"showInContextMenu"},"Show in context menu")),Is.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Is.default.createElement(sd,{id:"showInSlashMenu",checked:a.showInSlashMenu,onCheckedChange:f=>c("showInSlashMenu",f)}),Is.default.createElement(Ib,{htmlFor:"showInSlashMenu"},"Show in slash menu")),Is.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},Is.default.createElement(ve,{variant:"secondary",onClick:n},"Cancel"),Is.default.createElement(ve,{variant:"default",onClick:d},"Save")))}var AB=class extends xHr.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,OHr.createRoot)(r);let n=o=>{this.onUpdate(o),this.close()};this.root.render(Is.default.createElement(cQo,{commands:this.commands,command:this.command,onConfirm:n,onCancel:()=>this.close()}))}onClose(){this.root.unmount()}};var fce=require("obsidian");MN();wr();var jg=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=uZ(e.title);try{xJ(o);let i=e.order;n.autoOrder&&(i=_je()),e={...e,order:i};let a=RB();await ty(a);let s=app.vault.getAbstractFileByPath(o);!s||!(s instanceof fce.TFile)?s=await app.vault.create(o,e.content):await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[XD]=e.showInContextMenu,u[YD]=e.showInSlashMenu,u[xI]=e.order,u[QD]=e.modelKey,u[e$]=e.lastUsedMs}),n.skipStoreUpdate||TJ(e,e.title)}finally{OJ(o)}}async recordUsage(e){this.updateCommand({...e,lastUsedMs:Date.now()},e.title)}async updateCommand(e,r,n=!1){let o=uZ(e.title),i=uZ(r),a=e.title!==r;try{xJ(o),a&&xJ(i),n||TJ(e,r);let s=app.vault.getAbstractFileByPath(o);if(a){if(app.vault.getAbstractFileByPath(o))throw new Po("Error saving custom prompt. Please check if the title already exists.");let l=app.vault.getAbstractFileByPath(i);l instanceof fce.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(uZ(e.title))),s instanceof fce.TFile&&(await app.vault.modify(s,e.content),await app.fileManager.processFrontMatter(s,u=>{u[XD]=e.showInContextMenu,u[YD]=e.showInSlashMenu,u[xI]=e.order,u[QD]=e.modelKey,u[e$]=e.lastUsedMs}))}finally{OJ(o),a&&OJ(i)}}async updateCommands(e){mje(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=uZ(e.title);try{xJ(r),lce(e.title);let n=app.vault.getAbstractFileByPath(r);n instanceof fce.TFile&&await app.vault.delete(n)}finally{OJ(r)}}};var Sje=require("obsidian");Tu();Ro();hue();wH();Dt();wr();Tv();xv();Vpt();On();var xx=require("obsidian"),mr=L(X()),THr=L(wm());Pt();function dQo(t,e){let[r]=(0,mr.useState)(new G1e({returnMessages:!0,memoryKey:"history"})),[n,o]=(0,mr.useState)(null);return(0,mr.useEffect)(()=>{async function i(){let a=await gI.getInstance().createModelInstance(t),u=hd.fromMessages([Gw.fromTemplate(e||"You are a helpful assistant. You'll help the user with their content editing needs."),new vO("history"),a_.fromTemplate("{input}")]),l=El.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 fQo({originalText:t,command:e,onInsert:r,onReplace:n,systemPrompt:o}){let[i,a]=(0,mr.useState)(null),[s,u]=(0,mr.useState)(null),[l,c]=(0,mr.useState)(""),d=(0,mr.useRef)(null),f=(0,mr.useRef)(null),[p,m]=(0,mr.useState)(!0),[h]=xL(),g=So(),y=(0,mr.useMemo)(()=>qhe(e.modelKey||h,g.activeModels),[e.modelKey,h,g.activeModels]),{chatChain:b,chatMemory:_}=dQo(y,o),w=e.title,x=(0,mr.useMemo)(()=>s||(!p||!i||i.trim()===""?"loading...":i),[s,p,i]),O=(0,mr.useCallback)(async(F,B)=>{if(!b)return console.error("Chat chain not initialized"),new xx.Notice("Chat engine not ready. Please try again."),m(!1),null;try{a(null),u(null),m(!0);let H=await b.withConfig({signal:B.signal}).stream({input:F}),G=new M_(oe=>{a(oe)},void 0,!0);for await(let oe of H){if(B.signal.aborted)break;G.processChunk(oe)}let ie=G.close();if(!B.signal.aborted){let oe=ie.content.trim();return u(oe),m(!1),await _.saveContext({input:F},{output:oe}),oe}return null}catch(U){return ue("Error generating response:",U),m(!1),null}},[b,_]);(0,mr.useEffect)(()=>{let F=new AbortController;E.current=F;async function B(){if(b)try{let U=await bmt(e.content,t);await O(U,F)}catch(U){ue("Error in initial response:",U),m(!1)}}return B(),()=>{F.abort()}},[e.content,t,b,O]);let E=(0,mr.useRef)(null),T=async()=>{if(!l.trim()||!b){b||new xx.Notice("Chat engine not ready. Please try again.");return}let F=new AbortController;E.current=F;let B=await bmt(l,t,!0);try{await O(B,F)&&c("")}finally{F.signal.aborted&&(m(!1),u(i??"")),E.current=null}},R=()=>{E.current&&(E.current.abort(),E.current=null,m(!1))},N=F=>{F.nativeEvent.isComposing||(!p&&s&&!D&&(F.key==="Enter"&&(xx.Platform.isMacOS?F.metaKey:F.ctrlKey)&&!F.shiftKey&&(F.preventDefault(),n(s)),F.key==="Enter"&&(xx.Platform.isMacOS?F.metaKey:F.ctrlKey)&&F.shiftKey&&(F.preventDefault(),r(s))),D&&F.key==="Enter"&&!F.shiftKey&&!F.metaKey&&!F.ctrlKey&&(F.preventDefault(),T()))};(0,mr.useEffect)(()=>{if(d.current&&i&&p){let F=d.current;F.scrollTop=F.scrollHeight}},[i,p]);let D=!p&&l.trim().length>0;return mr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4",onKeyDown:N},mr.default.createElement("div",{className:"tw-max-h-60 tw-overflow-y-auto tw-whitespace-pre-wrap tw-text-muted"},t),mr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},w&&mr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-font-bold tw-text-normal"},mr.default.createElement(uS,{className:"tw-size-4"}),w)),mr.default.createElement("div",{className:"tw-group tw-relative"},mr.default.createElement("textarea",{ref:d,className:"tw-peer tw-h-60 tw-w-full tw-text-text",value:x,disabled:s==null,onChange:F=>u(F.target.value)}),s&&mr.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 xx.Notice("Copied to clipboard")}},mr.default.createElement(h_,{className:"tw-size-4 hover:tw-text-accent"}))),!p&&s&&mr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},mr.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:F=>c(F.target.value)})),mr.default.createElement("div",{className:"tw-flex tw-justify-between tw-gap-2"},mr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-text-xs tw-font-bold tw-text-faint"},mr.default.createElement(cte,{className:"tw-size-4"}),pje(y)),mr.default.createElement("div",{className:"tw-flex tw-gap-2"},p?mr.default.createElement(ve,{size:"sm",variant:"secondary",onClick:R},"Stop"):D?mr.default.createElement(ve,{size:"sm",onClick:T,className:"tw-flex tw-items-center tw-gap-1"},mr.default.createElement("span",null,"Submit"),mr.default.createElement(uC,{className:"tw-size-3"})):mr.default.createElement(mr.default.Fragment,null,mr.default.createElement(ve,{size:"sm",onClick:()=>r(s??""),className:"tw-flex tw-items-center tw-gap-1"},mr.default.createElement("span",null,"Insert"),mr.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs"},xx.Platform.isMacOS?mr.default.createElement(mr.default.Fragment,null,mr.default.createElement(YL,{className:"tw-size-3"}),mr.default.createElement(DK,{className:"tw-size-3"}),mr.default.createElement(uC,{className:"tw-size-3"})):mr.default.createElement(mr.default.Fragment,null,mr.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),mr.default.createElement(DK,{className:"tw-size-3"}),mr.default.createElement(uC,{className:"tw-size-3"})))),mr.default.createElement(ve,{size:"sm",onClick:()=>n(s??""),className:"tw-flex tw-items-center tw-gap-1"},mr.default.createElement("span",null,"Replace"),mr.default.createElement("div",{className:"tw-flex tw-items-center tw-text-xs"},xx.Platform.isMacOS?mr.default.createElement(mr.default.Fragment,null,mr.default.createElement(YL,{className:"tw-size-3"}),mr.default.createElement(uC,{className:"tw-size-3"})):mr.default.createElement(mr.default.Fragment,null,mr.default.createElement("span",{className:"tw-text-xs"},"Ctrl"),mr.default.createElement(uC,{className:"tw-size-3"}))))))))}var IB=class extends xx.Modal{constructor(r,n){super(r);this.configs=n}onOpen(){let{contentEl:r}=this;this.root=(0,THr.createRoot)(r);let{selectedText:n,command:o,systemPrompt:i}=this.configs,a=u=>{$z(u),this.close()},s=u=>{$z(u,!0),this.close()};this.root.render(mr.default.createElement(fQo,{originalText:n,command:o,onInsert:a,onReplace:s,systemPrompt:i}))}onClose(){this.root.unmount()}};var wje=class extends Sje.FuzzySuggestModal{constructor(e){super(e),this.setPlaceholder("Select a custom command to apply...");let r=K_();this.commands=bje(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(Sje.MarkdownView);if(!n||!n.editor){this.openCommandModal(e,"");return}let o=n.editor.getSelection();this.openCommandModal(e,o)}openCommandModal(e,r){jg.getInstance().recordUsage(e),new IB(this.app,{selectedText:r,command:e}).open()}};RS();Ro();Dt();wr();var cZ=require("obsidian"),Du=L(X()),EHr=L(wm());function pQo({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,x=!0)=>{if(!w.trim())return x&&(u(""),c(!1)),{isValid:!1};let O=Z2e(w);return O.isValid?(x&&(u(""),c(!0)),{isValid:!0,videoId:O.videoId}):(x&&(u(O.error||"Invalid URL"),c(!1)),{isValid:!1})},m=w=>{o(w),p(w,!0)},h=async()=>{if(i)return;let w=p(n);if(w.isValid){a(!0),u("");try{let x=await Ru.getInstance().youtube4llm(n);if(!x.response.transcript)throw new Error("Transcript not available. Only English videos with auto transcript enabled are supported.");let O={videoId:w.videoId,transcript:x.response.transcript,url:xAt(w.videoId)};f(O),r("display")}catch(x){ue("Error downloading YouTube transcript:",x);let O=x instanceof Error?x.message:"An error occurred while downloading the transcript";u(O)}finally{a(!1)}}},g=async()=>{if(d)try{let w=`# YouTube Video Transcript
|
||
|
||
Source: ${d.url}
|
||
|
||
${d.transcript}`;await navigator.clipboard.writeText(w),new cZ.Notice("Transcript copied to clipboard!")}catch(w){ue("Failed to copy to clipboard:",w),new cZ.Notice("Failed to copy to clipboard")}},y=async()=>{if(d)try{let w=`# YouTube Video Transcript
|
||
|
||
Source: ${d.url}
|
||
|
||
${d.transcript}`;await $z(w,!1),t()}catch(w){ue("Failed to insert to note:",w),new cZ.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(ve,{variant:"ghost",onClick:b},"Download Another"),Du.createElement(ve,{variant:"default",onClick:g},"Copy to Clipboard"),Du.createElement(ve,{variant:"default",onClick:y},"Insert at Cursor"),Du.createElement(ve,{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(yi,{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(ve,{variant:"secondary",onClick:t,disabled:i},"Cancel"),Du.createElement(ve,{variant:"default",onClick:h,disabled:i||!l},i?"Downloading...":"Download Transcript")))}var Cje=class extends cZ.Modal{constructor(e){super(e),this.setTitle("Download YouTube Script (plus)")}onOpen(){let{contentEl:e}=this;this.root=(0,EHr.createRoot)(e);let r=()=>{this.close()};this.root.render(Du.createElement(pQo,{onClose:r}))}onClose(){this.root.unmount()}};$v();vb();Pt();wr();var qs=require("obsidian");J3();zr();function Dg(t,e,r){t.addCommand({id:e,name:Jhe[e],callback:r})}function PHr(t,e,r){t.addCommand({id:e,name:Jhe[e],editorCallback:r})}function mQo(t,e,r){t.addCommand({id:e,name:Jhe[e],checkCallback:r})}function wmt(t,e,r){PHr(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 qs.Notice(`Selected text contains ${i} words and ${a} tokens.`)}),Dg(t,Nn.COUNT_TOTAL_VAULT_TOKENS,async()=>{try{let n=await Gnt(t.app),o=await t.projectManager.getCurrentChainManager().chatModelManager.countTokens(n);new qs.Notice(`Total tokens in your vault: ${o}`)}catch(n){ue("Error counting tokens: ",n),new qs.Notice("An error occurred while counting tokens.")}}),Dg(t,Nn.TOGGLE_COPILOT_CHAT_WINDOW,()=>{t.toggleView()}),Dg(t,Nn.OPEN_COPILOT_CHAT_WINDOW,()=>{t.activateView()}),Dg(t,Nn.NEW_CHAT,()=>{K7(),t.newChat()}),mQo(t,Nn.TRIGGER_QUICK_COMMAND,n=>{let o=t.app.workspace.getActiveViewOfType(qs.MarkdownView);if(n)return!!(!Y2e()&&o&&o.editor);if(Y2e())return new qs.Notice("Quick command is not available in source mode."),!1;if(!o||!o.editor)return new qs.Notice("No active editor found."),!1;let i=o.editor;if(!i.getSelection().trim())return new qs.Notice("Please select some text first. Selected text is required for quick commands."),!1;vje(i);let u=i.getCursor("from").line,l=`\`\`\`${iZ}
|
||
\`\`\`
|
||
`;return i.replaceRange(l,{line:u,ch:0}),!0}),Dg(t,Nn.CLEAR_LOCAL_COPILOT_INDEX,async()=>{try{await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().clearIndex(),new qs.Notice("Cleared local Copilot semantic index.")}catch(n){ue("Error clearing semantic index:",n),new qs.Notice("Failed to clear semantic index.")}}),Dg(t,Nn.GARBAGE_COLLECT_COPILOT_INDEX,async()=>{try{let o=await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().garbageCollectVectorStore();new qs.Notice(`Garbage collection completed. Removed ${o} stale documents.`)}catch(n){ue("Error during garbage collection:",n),new qs.Notice("Failed to garbage collect semantic index.")}}),Dg(t,Nn.INDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(Pt(),YQ));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().indexVaultToVectorStore(!1);new qs.Notice(`Semantic search index refreshed with ${a} documents.`)}else new qs.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ue("Error building index:",n),new qs.Notice("An error occurred while building the index.")}}),Dg(t,Nn.FORCE_REINDEX_VAULT_TO_COPILOT_INDEX,async()=>{try{let{getSettings:n}=await Promise.resolve().then(()=>(Pt(),YQ));if(n().enableSemanticSearchV3){let a=await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().indexVaultToVectorStore(!0);new qs.Notice(`Semantic search index rebuilt with ${a} documents.`)}else new qs.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(n){ue("Error rebuilding index:",n),new qs.Notice("An error occurred while rebuilding the index.")}}),Dg(t,Nn.LOAD_COPILOT_CHAT_CONVERSATION,()=>{t.loadCopilotChatHistory()}),Dg(t,Nn.LIST_INDEXED_FILES,async()=>{try{let o=await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().getIndexedFiles(),{getMatchingPatterns:i,shouldIndexFile:a}=await Promise.resolve().then(()=>(vb(),whr)),{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 x=await t.app.vault.cachedRead(w);!x||x.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`,g="copilot",y=`${g}/${h}`;await ty(g);let b=t.app.vault.getAbstractFileByPath(y);b?await t.app.vault.modify(b,m):await t.app.vault.create(y,m);let _=t.app.vault.getAbstractFileByPath(y);_&&(await t.app.workspace.getLeaf().openFile(_),new qs.Notice(`Listed ${p.size} indexed files`))}catch(n){ue("Error listing indexed files:",n),new qs.Notice("Failed to list indexed files.")}}),Dg(t,Nn.CLEAR_COPILOT_CACHE,async()=>{try{await t.fileParserManager.clearPDFCache(),await UC.getInstance().clearAllCache(),await Q8.getInstance().clear();let{AutocompleteCache:o}=await Promise.resolve().then(()=>(Jpt(),$2r));o.getInstance().clear(),new qs.Notice("All Copilot caches cleared successfully")}catch(n){ue("Error clearing Copilot caches:",n),new qs.Notice("Failed to clear Copilot caches")}}),Dg(t,Nn.OPEN_LOG_FILE,async()=>{try{await q1e(),await ey.openLogFile()}catch(n){ue("Error creating Copilot log file:",n),new qs.Notice("Failed to create Copilot log file.")}}),Dg(t,Nn.CLEAR_LOG_FILE,async()=>{try{await ey.clear(),new qs.Notice("Copilot log cleared.")}catch(n){ue("Error clearing Copilot log file:",n),new qs.Notice("Failed to clear Copilot log file.")}}),Dg(t,Nn.TOGGLE_AUTOCOMPLETE,()=>{let o=!ce().enableAutocomplete;et("enableAutocomplete",o),new qs.Notice(`Copilot autocomplete ${o?"enabled":"disabled"}`)}),PHr(t,Nn.ADD_SELECTION_TO_CHAT_CONTEXT,async n=>{let o=n.getSelection();if(!o){new qs.Notice("No text selected");return}let i=t.app.workspace.getActiveFile();if(!i){new qs.Notice("No active file");return}let a=n.listSelections()[0];if(!a){new qs.Notice("Could not determine selection range");return}let s=a.anchor.line+1,u=a.head.line+1,l={id:H0(),content:o,noteTitle:i.basename,notePath:i.path,startLine:Math.min(s,u),endLine:Math.max(s,u)};sIt(l),t.activateView()}),Dg(t,Nn.ADD_CUSTOM_COMMAND,async()=>{let n=K_(),o={...CI};new AB(t.app,n,o,async a=>{await jg.getInstance().createCommand(a)}).open()}),Dg(t,Nn.APPLY_CUSTOM_COMMAND,()=>{new wje(t.app).open()}),Dg(t,Nn.DOWNLOAD_YOUTUBE_SCRIPT,async()=>{if(!await jS()){new qs.Notice("Download YouTube Script (plus) is a Copilot Plus feature");return}new Cje(t.app).open()})}Tu();gd();gd();Tu();function xje(){let[t]=Ev(),[e]=rge(),[r]=nge();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"})()}Dt();Tu();hie();gd();Ro();var MHr=require("obsidian"),EJ=L(X()),RHr=L(wm());function hQo({content:t,onConfirm:e,onCancel:r,confirmButtonText:n,cancelButtonText:o}){return EJ.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-5"},EJ.default.createElement("div",{className:"tw-whitespace-pre-wrap"},t),EJ.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},o&&EJ.default.createElement(ve,{variant:"secondary",onClick:r},o),n&&EJ.default.createElement(ve,{variant:"default",onClick:e},n)))}var lm=class extends MHr.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,RHr.createRoot)(r);let n=()=>{this.onConfirm(),this.close()},o=()=>{this.close()};this.root.render(EJ.default.createElement(hQo,{content:this.content,onConfirm:n,onCancel:o,confirmButtonText:this.confirmButtonText,cancelButtonText:this.cancelButtonText}))}onClose(){this.root.unmount()}};Ro();var $u=L(X());var Hm=L(X(),1);var xhs=!!(typeof window<"u"&&window.document&&window.document.createElement);function pce(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var gQo=L(X(),1);function AHr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function IHr(...t){return e=>{let r=!1,n=t.map(o=>{let i=AHr(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():AHr(t[o],null)}}}}var t$=L(X(),1),NHr=L(mt(),1);function jHr(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,g=t$.useMemo(()=>m,Object.values(m));return(0,NHr.jsx)(h.Provider,{value:g,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,yQo(o,...e)]}function yQo(...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 g0=L(X(),1);var DHr=L(X(),1),Oje=globalThis?.document?DHr.useLayoutEffect:()=>{};var Tje=L(X(),1);var bQo=g0[" useInsertionEffect ".trim().toString()]||Oje;function $Hr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=_Qo({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=g0.useRef(t!==void 0);g0.useEffect(()=>{let d=c.current;d!==s&&console.warn(`${n} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=s},[s,n])}let l=g0.useCallback(c=>{if(s){let d=vQo(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function _Qo({defaultProp:t,onChange:e}){let[r,n]=g0.useState(t),o=g0.useRef(r),i=g0.useRef(e);return bQo(()=>{i.current=e},[e]),g0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function vQo(t){return typeof t=="function"}var Rhs=Symbol("RADIX:SYNC_STATE");var LHr=L(X(),1),wQo=L(Bu(),1);ah();var FHr=L(mt(),1),SQo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],kHr=SQo.reduce((t,e)=>{let r=Ji(`Primitive.${e}`),n=LHr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,FHr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var Lr=L(X(),1);var jhs=!!(typeof window<"u"&&window.document&&window.document.createElement);function Gu(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var NB=L(X(),1);var r$=L(X(),1),qHr=L(mt(),1);function dZ(t,e=[]){let r=[];function n(i,a){let s=r$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,g=r$.useMemo(()=>m,Object.values(m));return(0,qHr.jsx)(h.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=r$.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>r$.createContext(a));return function(s){let u=s?.[t]||i;return r$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,CQo(o,...e)]}function CQo(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return r$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var UHr=L(X(),1);function BHr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Smt(...t){return e=>{let r=!1,n=t.map(o=>{let i=BHr(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():BHr(t[o],null)}}}}function zm(...t){return UHr.useCallback(Smt(...t),t)}ah();var Eje=L(mt(),1),xQo=L(X(),1);var OQo=L(mt(),1);function VHr(t){let e=t+"CollectionProvider",[r,n]=dZ(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=h=>{let{scope:g,children:y}=h,b=NB.default.useRef(null),_=NB.default.useRef(new Map).current;return(0,Eje.jsx)(o,{scope:g,itemMap:_,collectionRef:b,children:y})};a.displayName=e;let s=t+"CollectionSlot",u=Ji(s),l=NB.default.forwardRef((h,g)=>{let{scope:y,children:b}=h,_=i(s,y),w=zm(g,_.collectionRef);return(0,Eje.jsx)(u,{ref:w,children:b})});l.displayName=s;let c=t+"CollectionItemSlot",d="data-radix-collection-item",f=Ji(c),p=NB.default.forwardRef((h,g)=>{let{scope:y,children:b,..._}=h,w=NB.default.useRef(null),x=zm(g,w),O=i(c,y);return NB.default.useEffect(()=>(O.itemMap.set(w,{ref:w,..._}),()=>void O.itemMap.delete(w))),(0,Eje.jsx)(f,{[d]:"",ref:x,children:b})});p.displayName=c;function m(h){let g=i(t+"CollectionConsumer",h);return NB.default.useCallback(()=>{let b=g.collectionRef.current;if(!b)return[];let _=Array.from(b.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((O,E)=>_.indexOf(O.ref.current)-_.indexOf(E.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},m,n]}var Pje=L(X(),1),TQo=L(mt(),1),EQo=Pje.createContext(void 0);function JHr(t){let e=Pje.useContext(EQo);return t||e||"ltr"}var bc=L(X(),1);var KHr=L(X(),1),WHr=L(Bu(),1);ah();var GHr=L(mt(),1),PQo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Nh=PQo.reduce((t,e)=>{let r=Ji(`Primitive.${e}`),n=KHr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,GHr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function Mje(t,e){t&&WHr.flushSync(()=>t.dispatchEvent(e))}var fZ=L(X(),1);function W_(t){let e=fZ.useRef(t);return fZ.useEffect(()=>{e.current=t}),fZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var ZHr=L(X(),1);function XHr(t,e=globalThis?.document){let r=W_(t);ZHr.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 xmt=L(mt(),1),MQo="DismissableLayer",Cmt="dismissableLayer.update",RQo="dismissableLayer.pointerDownOutside",AQo="dismissableLayer.focusOutside",YHr,eVr=bc.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Omt=bc.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=bc.useContext(eVr),[c,d]=bc.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=bc.useState({}),m=zm(e,E=>d(E)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=h.indexOf(g),b=c?h.indexOf(c):-1,_=l.layersWithOutsidePointerEventsDisabled.size>0,w=b>=y,x=jQo(E=>{let T=E.target,R=[...l.branches].some(N=>N.contains(T));!w||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),O=DQo(E=>{let T=E.target;[...l.branches].some(N=>N.contains(T))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return XHr(E=>{b===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),bc.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(YHr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),QHr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=YHr)}},[c,f,r,l]),bc.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),QHr())},[c,l]),bc.useEffect(()=>{let E=()=>p({});return document.addEventListener(Cmt,E),()=>document.removeEventListener(Cmt,E)},[]),(0,xmt.jsx)(Nh.div,{...u,ref:m,style:{pointerEvents:_?w?"auto":"none":void 0,...t.style},onFocusCapture:Gu(t.onFocusCapture,O.onFocusCapture),onBlurCapture:Gu(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:Gu(t.onPointerDownCapture,x.onPointerDownCapture)})});Omt.displayName=MQo;var IQo="DismissableLayerBranch",NQo=bc.forwardRef((t,e)=>{let r=bc.useContext(eVr),n=bc.useRef(null),o=zm(e,n);return bc.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,xmt.jsx)(Nh.div,{...t,ref:o})});NQo.displayName=IQo;function jQo(t,e=globalThis?.document){let r=W_(t),n=bc.useRef(!1),o=bc.useRef(()=>{});return bc.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){tVr(RQo,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 DQo(t,e=globalThis?.document){let r=W_(t),n=bc.useRef(!1);return bc.useEffect(()=>{let o=i=>{i.target&&!n.current&&tVr(AQo,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 QHr(){let t=new CustomEvent(Cmt);document.dispatchEvent(t)}function tVr(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?Mje(o,i):o.dispatchEvent(i)}var nVr=L(X(),1),Tmt=0;function oVr(){nVr.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??rVr()),document.body.insertAdjacentElement("beforeend",t[1]??rVr()),Tmt++,()=>{Tmt===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Tmt--}},[])}function rVr(){let t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var y0=L(X(),1);var lVr=L(mt(),1),Emt="focusScope.autoFocusOnMount",Pmt="focusScope.autoFocusOnUnmount",iVr={bubbles:!1,cancelable:!0},$Qo="FocusScope",Mmt=y0.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=y0.useState(null),l=W_(o),c=W_(i),d=y0.useRef(null),f=zm(e,h=>u(h)),p=y0.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y0.useEffect(()=>{if(n){let b=function(O){if(p.paused||!s)return;let E=O.target;s.contains(E)?d.current=E:jB(d.current,{select:!0})},_=function(O){if(p.paused||!s)return;let E=O.relatedTarget;E!==null&&(s.contains(E)||jB(d.current,{select:!0}))},w=function(O){if(document.activeElement===document.body)for(let T of O)T.removedNodes.length>0&&jB(s)};var h=b,g=_,y=w;document.addEventListener("focusin",b),document.addEventListener("focusout",_);let x=new MutationObserver(w);return s&&x.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",_),x.disconnect()}}},[n,s,p.paused]),y0.useEffect(()=>{if(s){sVr.add(p);let h=document.activeElement;if(!s.contains(h)){let y=new CustomEvent(Emt,iVr);s.addEventListener(Emt,l),s.dispatchEvent(y),y.defaultPrevented||(LQo(UQo(cVr(s)),{select:!0}),document.activeElement===h&&jB(s))}return()=>{s.removeEventListener(Emt,l),setTimeout(()=>{let y=new CustomEvent(Pmt,iVr);s.addEventListener(Pmt,c),s.dispatchEvent(y),y.defaultPrevented||jB(h??document.body,{select:!0}),s.removeEventListener(Pmt,c),sVr.remove(p)},0)}}},[s,l,c,p]);let m=y0.useCallback(h=>{if(!r&&!n||p.paused)return;let g=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,y=document.activeElement;if(g&&y){let b=h.currentTarget,[_,w]=FQo(b);_&&w?!h.shiftKey&&y===w?(h.preventDefault(),r&&jB(_,{select:!0})):h.shiftKey&&y===_&&(h.preventDefault(),r&&jB(w,{select:!0})):y===b&&h.preventDefault()}},[r,n,p.paused]);return(0,lVr.jsx)(Nh.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});Mmt.displayName=$Qo;function LQo(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(jB(n,{select:e}),document.activeElement!==r)return}function FQo(t){let e=cVr(t),r=aVr(e,t),n=aVr(e.reverse(),t);return[r,n]}function cVr(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 aVr(t,e){for(let r of t)if(!kQo(r,{upTo:e}))return r}function kQo(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 qQo(t){return t instanceof HTMLInputElement&&"select"in t}function jB(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&qQo(t)&&e&&t.select()}}var sVr=BQo();function BQo(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=uVr(t,e),t.unshift(e)},remove(e){t=uVr(t,e),t[0]?.resume()}}}function uVr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function UQo(t){return t.filter(e=>e.tagName!=="A")}var Rmt=L(X(),1);var dVr=L(X(),1),b0=globalThis?.document?dVr.useLayoutEffect:()=>{};var zQo=Rmt[" useId ".trim().toString()]||(()=>{}),HQo=0;function Amt(t){let[e,r]=Rmt.useState(zQo());return b0(()=>{t||r(n=>n??String(HQo++))},[t]),t||(e?`radix-${e}`:"")}var Z_=L(X(),1);var mVr=["top","right","bottom","left"];var OI=Math.min,Nb=Math.max,hce=Math.round,gce=Math.floor,Ox=t=>({x:t,y:t}),VQo={left:"right",right:"left",bottom:"top",top:"bottom"},JQo={start:"end",end:"start"};function Aje(t,e,r){return Nb(t,OI(e,r))}function TI(t,e){return typeof t=="function"?t(e):t}function EI(t){return t.split("-")[0]}function PJ(t){return t.split("-")[1]}function Ije(t){return t==="x"?"y":"x"}function Nje(t){return t==="y"?"height":"width"}var KQo=new Set(["top","bottom"]);function Tx(t){return KQo.has(EI(t))?"y":"x"}function jje(t){return Ije(Tx(t))}function hVr(t,e,r){r===void 0&&(r=!1);let n=PJ(t),o=jje(t),i=Nje(o),a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=mce(a)),[a,mce(a)]}function gVr(t){let e=mce(t);return[Rje(t),e,Rje(e)]}function Rje(t){return t.replace(/start|end/g,e=>JQo[e])}var fVr=["left","right"],pVr=["right","left"],WQo=["top","bottom"],GQo=["bottom","top"];function ZQo(t,e,r){switch(t){case"top":case"bottom":return r?e?pVr:fVr:e?fVr:pVr;case"left":case"right":return e?WQo:GQo;default:return[]}}function yVr(t,e,r,n){let o=PJ(t),i=ZQo(EI(t),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),e&&(i=i.concat(i.map(Rje)))),i}function mce(t){return t.replace(/left|right|bottom|top/g,e=>VQo[e])}function XQo(t){return{top:0,right:0,bottom:0,left:0,...t}}function Imt(t){return typeof t!="number"?XQo(t):{top:t,right:t,bottom:t,left:t}}function MJ(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 bVr(t,e,r){let{reference:n,floating:o}=t,i=Tx(e),a=jje(e),s=Nje(a),u=EI(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(PJ(e)){case"start":p[a]-=f*(r&&l?-1:1);break;case"end":p[a]+=f*(r&&l?-1:1);break}return p}var wVr=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}=bVr(l,n,u),f=n,p={},m=0;for(let h=0;h<s.length;h++){let{name:g,fn:y}=s[h],{x:b,y:_,data:w,reset:x}=await y({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,[g]:{...p[g],...w}},x&&m<=50&&(m++,typeof x=="object"&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:o}):x.rects),{x:c,y:d}=bVr(l,f,u)),h=-1)}return{x:c,y:d,placement:f,strategy:o,middlewareData:p}};async function pZ(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}=TI(e,t),m=Imt(p),g=s[f?d==="floating"?"reference":"floating":d],y=MJ(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(g)))==null||r?g:g.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},x=MJ(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:_,strategy:u}):b);return{top:(y.top-x.top+m.top)/w.y,bottom:(x.bottom-y.bottom+m.bottom)/w.y,left:(y.left-x.left+m.left)/w.x,right:(x.right-y.right+m.right)/w.x}}var SVr=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}=TI(t,e)||{};if(l==null)return{};let d=Imt(c),f={x:r,y:n},p=jje(o),m=Nje(p),h=await a.getDimensions(l),g=p==="y",y=g?"top":"left",b=g?"bottom":"right",_=g?"clientHeight":"clientWidth",w=i.reference[m]+i.reference[p]-f[p]-i.floating[m],x=f[p]-i.reference[p],O=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l)),E=O?O[_]:0;(!E||!await(a.isElement==null?void 0:a.isElement(O)))&&(E=s.floating[_]||i.floating[m]);let T=w/2-x/2,R=E/2-h[m]/2-1,N=OI(d[y],R),D=OI(d[b],R),F=N,B=E-h[m]-D,U=E/2-h[m]/2+T,H=Aje(F,U,B),G=!u.arrow&&PJ(o)!=null&&U!==H&&i.reference[m]/2-(U<F?N:D)-h[m]/2<0,ie=G?U<F?U-F:U-B:0;return{[p]:f[p]+ie,data:{[p]:H,centerOffset:U-H-ie,...G&&{alignmentOffset:ie}},reset:G}}});var CVr=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,...g}=TI(t,e);if((r=i.arrow)!=null&&r.alignmentOffset)return{};let y=EI(o),b=Tx(s),_=EI(s)===s,w=await(u.isRTL==null?void 0:u.isRTL(l.floating)),x=f||(_||!h?[mce(s)]:gVr(s)),O=m!=="none";!f&&O&&x.push(...yVr(s,h,m,w));let E=[s,...x],T=await pZ(e,g),R=[],N=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&R.push(T[y]),d){let U=hVr(o,a,w);R.push(T[U[0]],T[U[1]])}if(N=[...N,{placement:o,overflows:R}],!R.every(U=>U<=0)){var D,F;let U=(((D=i.flip)==null?void 0:D.index)||0)+1,H=E[U];if(H&&(!(d==="alignment"?b!==Tx(H):!1)||N.every(oe=>Tx(oe.placement)===b?oe.overflows[0]>0:!0)))return{data:{index:U,overflows:N},reset:{placement:H}};let G=(F=N.filter(ie=>ie.overflows[0]<=0).sort((ie,oe)=>ie.overflows[1]-oe.overflows[1])[0])==null?void 0:F.placement;if(!G)switch(p){case"bestFit":{var B;let ie=(B=N.filter(oe=>{if(O){let z=Tx(oe.placement);return z===b||z==="y"}return!0}).map(oe=>[oe.placement,oe.overflows.filter(z=>z>0).reduce((z,Q)=>z+Q,0)]).sort((oe,z)=>oe[1]-z[1])[0])==null?void 0:B[0];ie&&(G=ie);break}case"initialPlacement":G=s;break}if(o!==G)return{reset:{placement:G}}}return{}}}};function _Vr(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function vVr(t){return mVr.some(e=>t[e]>=0)}var xVr=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:r}=e,{strategy:n="referenceHidden",...o}=TI(t,e);switch(n){case"referenceHidden":{let i=await pZ(e,{...o,elementContext:"reference"}),a=_Vr(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:vVr(a)}}}case"escaped":{let i=await pZ(e,{...o,altBoundary:!0}),a=_Vr(i,r.floating);return{data:{escapedOffsets:a,escaped:vVr(a)}}}default:return{}}}}};var OVr=new Set(["left","top"]);async function YQo(t,e){let{placement:r,platform:n,elements:o}=t,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=EI(r),s=PJ(r),u=Tx(r)==="y",l=OVr.has(a)?-1:1,c=i&&u?-1:1,d=TI(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 TVr=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 YQo(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}}}}},EVr=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:g=>{let{x:y,y:b}=g;return{x:y,y:b}}},...u}=TI(t,e),l={x:r,y:n},c=await pZ(e,u),d=Tx(EI(o)),f=Ije(d),p=l[f],m=l[d];if(i){let g=f==="y"?"top":"left",y=f==="y"?"bottom":"right",b=p+c[g],_=p-c[y];p=Aje(b,p,_)}if(a){let g=d==="y"?"top":"left",y=d==="y"?"bottom":"right",b=m+c[g],_=m-c[y];m=Aje(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}}}}}},PVr=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}=TI(t,e),c={x:r,y:n},d=Tx(o),f=Ije(d),p=c[f],m=c[d],h=TI(s,e),g=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[_]+g.mainAxis,x=i.reference[f]+i.reference[_]-g.mainAxis;p<w?p=w:p>x&&(p=x)}if(l){var y,b;let _=f==="y"?"width":"height",w=OVr.has(EI(o)),x=i.reference[d]-i.floating[_]+(w&&((y=a.offset)==null?void 0:y[d])||0)+(w?0:g.crossAxis),O=i.reference[d]+i.reference[_]+(w?0:((b=a.offset)==null?void 0:b[d])||0)-(w?g.crossAxis:0);m<x?m=x:m>O&&(m=O)}return{[f]:p,[d]:m}}}},MVr=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}=TI(t,e),c=await pZ(e,l),d=EI(o),f=PJ(o),p=Tx(o)==="y",{width:m,height:h}=i.floating,g,y;d==="top"||d==="bottom"?(g=d,y=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(y=d,g=f==="end"?"top":"bottom");let b=h-c.top-c.bottom,_=m-c.left-c.right,w=OI(h-c[g],b),x=OI(m-c[y],_),O=!e.middlewareData.shift,E=w,T=x;if((r=e.middlewareData.shift)!=null&&r.enabled.x&&(T=_),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(E=b),O&&!f){let N=Nb(c.left,0),D=Nb(c.right,0),F=Nb(c.top,0),B=Nb(c.bottom,0);p?T=m-2*(N!==0||D!==0?N+D:Nb(c.left,c.right)):E=h-2*(F!==0||B!==0?F+B:Nb(c.top,c.bottom))}await u({...e,availableWidth:T,availableHeight:E});let R=await a.getDimensions(s.floating);return m!==R.width||h!==R.height?{reset:{rects:!0}}:{}}}};function Dje(){return typeof window<"u"}function AJ(t){return AVr(t)?(t.nodeName||"").toLowerCase():"#document"}function G_(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ex(t){var e;return(e=(AVr(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function AVr(t){return Dje()?t instanceof Node||t instanceof G_(t).Node:!1}function _0(t){return Dje()?t instanceof Element||t instanceof G_(t).Element:!1}function Px(t){return Dje()?t instanceof HTMLElement||t instanceof G_(t).HTMLElement:!1}function RVr(t){return!Dje()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof G_(t).ShadowRoot}var QQo=new Set(["inline","contents"]);function mZ(t){let{overflow:e,overflowX:r,overflowY:n,display:o}=v0(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+r)&&!QQo.has(o)}var eei=new Set(["table","td","th"]);function IVr(t){return eei.has(AJ(t))}var tei=[":popover-open",":modal"];function yce(t){return tei.some(e=>{try{return t.matches(e)}catch{return!1}})}var rei=["transform","translate","scale","rotate","perspective"],nei=["transform","translate","scale","rotate","perspective","filter"],oei=["paint","layout","strict","content"];function $je(t){let e=Lje(),r=_0(t)?v0(t):t;return rei.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)||nei.some(n=>(r.willChange||"").includes(n))||oei.some(n=>(r.contain||"").includes(n))}function NVr(t){let e=n$(t);for(;Px(e)&&!IJ(e);){if($je(e))return e;if(yce(e))return null;e=n$(e)}return null}function Lje(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var iei=new Set(["html","body","#document"]);function IJ(t){return iei.has(AJ(t))}function v0(t){return G_(t).getComputedStyle(t)}function bce(t){return _0(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function n$(t){if(AJ(t)==="html")return t;let e=t.assignedSlot||t.parentNode||RVr(t)&&t.host||Ex(t);return RVr(e)?e.host:e}function jVr(t){let e=n$(t);return IJ(e)?t.ownerDocument?t.ownerDocument.body:t.body:Px(e)&&mZ(e)?e:jVr(e)}function RJ(t,e,r){var n;e===void 0&&(e=[]),r===void 0&&(r=!0);let o=jVr(t),i=o===((n=t.ownerDocument)==null?void 0:n.body),a=G_(o);if(i){let s=Fje(a);return e.concat(a,a.visualViewport||[],mZ(o)?o:[],s&&r?RJ(s):[])}return e.concat(o,RJ(o,[],r))}function Fje(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function FVr(t){let e=v0(t),r=parseFloat(e.width)||0,n=parseFloat(e.height)||0,o=Px(t),i=o?t.offsetWidth:r,a=o?t.offsetHeight:n,s=hce(r)!==i||hce(n)!==a;return s&&(r=i,n=a),{width:r,height:n,$:s}}function jmt(t){return _0(t)?t:t.contextElement}function hZ(t){let e=jmt(t);if(!Px(e))return Ox(1);let r=e.getBoundingClientRect(),{width:n,height:o,$:i}=FVr(e),a=(i?hce(r.width):r.width)/n,s=(i?hce(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}var aei=Ox(0);function kVr(t){let e=G_(t);return!Lje()||!e.visualViewport?aei:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function sei(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==G_(t)?!1:e}function NJ(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r=!1);let o=t.getBoundingClientRect(),i=jmt(t),a=Ox(1);e&&(n?_0(n)&&(a=hZ(n)):a=hZ(t));let s=sei(i,r,n)?kVr(i):Ox(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=G_(i),p=n&&_0(n)?G_(n):n,m=f,h=Fje(m);for(;h&&n&&p!==m;){let g=hZ(h),y=h.getBoundingClientRect(),b=v0(h),_=y.left+(h.clientLeft+parseFloat(b.paddingLeft))*g.x,w=y.top+(h.clientTop+parseFloat(b.paddingTop))*g.y;u*=g.x,l*=g.y,c*=g.x,d*=g.y,u+=_,l+=w,m=G_(h),h=Fje(m)}}return MJ({width:c,height:d,x:u,y:l})}function kje(t,e){let r=bce(t).scrollLeft;return e?e.left+r:NJ(Ex(t)).left+r}function qVr(t,e){let r=t.getBoundingClientRect(),n=r.left+e.scrollLeft-kje(t,r),o=r.top+e.scrollTop;return{x:n,y:o}}function uei(t){let{elements:e,rect:r,offsetParent:n,strategy:o}=t,i=o==="fixed",a=Ex(n),s=e?yce(e.floating):!1;if(n===a||s&&i)return r;let u={scrollLeft:0,scrollTop:0},l=Ox(1),c=Ox(0),d=Px(n);if((d||!d&&!i)&&((AJ(n)!=="body"||mZ(a))&&(u=bce(n)),Px(n))){let p=NJ(n);l=hZ(n),c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}let f=a&&!d&&!i?qVr(a,u):Ox(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 lei(t){return Array.from(t.getClientRects())}function cei(t){let e=Ex(t),r=bce(t),n=t.ownerDocument.body,o=Nb(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Nb(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+kje(t),s=-r.scrollTop;return v0(n).direction==="rtl"&&(a+=Nb(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:s}}var DVr=25;function dei(t,e){let r=G_(t),n=Ex(t),o=r.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,u=0;if(o){i=o.width,a=o.height;let c=Lje();(!c||c&&e==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}let l=kje(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<=DVr&&(i-=m)}else l<=DVr&&(i+=l);return{width:i,height:a,x:s,y:u}}var fei=new Set(["absolute","fixed"]);function pei(t,e){let r=NJ(t,!0,e==="fixed"),n=r.top+t.clientTop,o=r.left+t.clientLeft,i=Px(t)?hZ(t):Ox(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 $Vr(t,e,r){let n;if(e==="viewport")n=dei(t,r);else if(e==="document")n=cei(Ex(t));else if(_0(e))n=pei(e,r);else{let o=kVr(t);n={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return MJ(n)}function BVr(t,e){let r=n$(t);return r===e||!_0(r)||IJ(r)?!1:v0(r).position==="fixed"||BVr(r,e)}function mei(t,e){let r=e.get(t);if(r)return r;let n=RJ(t,[],!1).filter(s=>_0(s)&&AJ(s)!=="body"),o=null,i=v0(t).position==="fixed",a=i?n$(t):t;for(;_0(a)&&!IJ(a);){let s=v0(a),u=$je(a);!u&&s.position==="fixed"&&(o=null),(i?!u&&!o:!u&&s.position==="static"&&!!o&&fei.has(o.position)||mZ(a)&&!u&&BVr(t,a))?n=n.filter(c=>c!==a):o=s,a=n$(a)}return e.set(t,n),n}function hei(t){let{element:e,boundary:r,rootBoundary:n,strategy:o}=t,a=[...r==="clippingAncestors"?yce(e)?[]:mei(e,this._c):[].concat(r),n],s=a[0],u=a.reduce((l,c)=>{let d=$Vr(e,c,o);return l.top=Nb(d.top,l.top),l.right=OI(d.right,l.right),l.bottom=OI(d.bottom,l.bottom),l.left=Nb(d.left,l.left),l},$Vr(e,s,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function gei(t){let{width:e,height:r}=FVr(t);return{width:e,height:r}}function yei(t,e,r){let n=Px(e),o=Ex(e),i=r==="fixed",a=NJ(t,!0,i,e),s={scrollLeft:0,scrollTop:0},u=Ox(0);function l(){u.x=kje(o)}if(n||!n&&!i)if((AJ(e)!=="body"||mZ(o))&&(s=bce(e)),n){let p=NJ(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?qVr(o,s):Ox(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 Nmt(t){return v0(t).position==="static"}function LVr(t,e){if(!Px(t)||v0(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return Ex(t)===r&&(r=r.ownerDocument.body),r}function UVr(t,e){let r=G_(t);if(yce(t))return r;if(!Px(t)){let o=n$(t);for(;o&&!IJ(o);){if(_0(o)&&!Nmt(o))return o;o=n$(o)}return r}let n=LVr(t,e);for(;n&&IVr(n)&&Nmt(n);)n=LVr(n,e);return n&&IJ(n)&&Nmt(n)&&!$je(n)?r:n||NVr(t)||r}var bei=async function(t){let e=this.getOffsetParent||UVr,r=this.getDimensions,n=await r(t.floating);return{reference:yei(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function _ei(t){return v0(t).direction==="rtl"}var zVr={convertOffsetParentRelativeRectToViewportRelativeRect:uei,getDocumentElement:Ex,getClippingRect:hei,getOffsetParent:UVr,getElementRects:bei,getClientRects:lei,getDimensions:gei,getScale:hZ,isElement:_0,isRTL:_ei};function HVr(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function vei(t,e){let r=null,n,o=Ex(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=gce(d),h=gce(o.clientWidth-(c+f)),g=gce(o.clientHeight-(d+p)),y=gce(c),_={rootMargin:-m+"px "+-h+"px "+-g+"px "+-y+"px",threshold:Nb(0,OI(1,u))||1},w=!0;function x(O){let E=O[0].intersectionRatio;if(E!==u){if(!w)return a();E?a(!1,E):n=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!HVr(l,t.getBoundingClientRect())&&a(),w=!1}try{r=new IntersectionObserver(x,{..._,root:o.ownerDocument})}catch{r=new IntersectionObserver(x,_)}r.observe(t)}return a(!0),i}function o$(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=jmt(t),c=o||i?[...l?RJ(l):[],...RJ(e)]:[];c.forEach(y=>{o&&y.addEventListener("scroll",r,{passive:!0}),i&&y.addEventListener("resize",r)});let d=l&&s?vei(l,r):null,f=-1,p=null;a&&(p=new ResizeObserver(y=>{let[b]=y;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?NJ(t):null;u&&g();function g(){let y=NJ(t);h&&!HVr(h,y)&&r(),h=y,m=requestAnimationFrame(g)}return r(),()=>{var y;c.forEach(b=>{o&&b.removeEventListener("scroll",r),i&&b.removeEventListener("resize",r)}),d?.(),(y=p)==null||y.disconnect(),p=null,u&&cancelAnimationFrame(m)}}var VVr=TVr;var JVr=EVr,KVr=CVr,WVr=MVr,GVr=xVr,Dmt=SVr;var ZVr=PVr,$mt=(t,e,r)=>{let n=new Map,o={platform:zVr,...r},i={...o.platform,_c:n};return wVr(t,e,{...o,platform:i})};var cm=L(X(),1),YVr=L(X(),1),QVr=L(Bu(),1),wei=typeof document<"u",Sei=function(){},qje=wei?YVr.useLayoutEffect:Sei;function Bje(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(!Bje(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)&&!Bje(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function eJr(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function XVr(t,e){let r=eJr(t);return Math.round(e*r)/r}function Lmt(t){let e=cm.useRef(t);return qje(()=>{e.current=t}),e}function DB(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]=cm.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[f,p]=cm.useState(n);Bje(f,n)||p(n);let[m,h]=cm.useState(null),[g,y]=cm.useState(null),b=cm.useCallback(oe=>{oe!==O.current&&(O.current=oe,h(oe))},[]),_=cm.useCallback(oe=>{oe!==E.current&&(E.current=oe,y(oe))},[]),w=i||m,x=a||g,O=cm.useRef(null),E=cm.useRef(null),T=cm.useRef(c),R=u!=null,N=Lmt(u),D=Lmt(o),F=Lmt(l),B=cm.useCallback(()=>{if(!O.current||!E.current)return;let oe={placement:e,strategy:r,middleware:f};D.current&&(oe.platform=D.current),$mt(O.current,E.current,oe).then(z=>{let Q={...z,isPositioned:F.current!==!1};U.current&&!Bje(T.current,Q)&&(T.current=Q,QVr.flushSync(()=>{d(Q)}))})},[f,e,r,D,F]);qje(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(oe=>({...oe,isPositioned:!1})))},[l]);let U=cm.useRef(!1);qje(()=>(U.current=!0,()=>{U.current=!1}),[]),qje(()=>{if(w&&(O.current=w),x&&(E.current=x),w&&x){if(N.current)return N.current(w,x,B);B()}},[w,x,B,N,R]);let H=cm.useMemo(()=>({reference:O,floating:E,setReference:b,setFloating:_}),[b,_]),G=cm.useMemo(()=>({reference:w,floating:x}),[w,x]),ie=cm.useMemo(()=>{let oe={position:r,left:0,top:0};if(!G.floating)return oe;let z=XVr(G.floating,c.x),Q=XVr(G.floating,c.y);return s?{...oe,transform:"translate("+z+"px, "+Q+"px)",...eJr(G.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:z,top:Q}},[r,s,G.floating,c.x,c.y]);return cm.useMemo(()=>({...c,update:B,refs:H,elements:G,floatingStyles:ie}),[c,B,H,G,ie])}var Cei=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?Dmt({element:n.current,padding:o}).fn(r):{}:n?Dmt({element:n,padding:o}).fn(r):{}}}},$B=(t,e)=>({...VVr(t),options:[t,e]}),LB=(t,e)=>({...JVr(t),options:[t,e]}),FB=(t,e)=>({...ZVr(t),options:[t,e]}),kB=(t,e)=>({...KVr(t),options:[t,e]}),qB=(t,e)=>({...WVr(t),options:[t,e]});var BB=(t,e)=>({...GVr(t),options:[t,e]});var UB=(t,e)=>({...Cei(t),options:[t,e]});var tJr=L(X(),1);var Fmt=L(mt(),1),xei="Arrow",rJr=tJr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,Fmt.jsx)(Nh.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,Fmt.jsx)("polygon",{points:"0,0 30,0 15,10"})})});rJr.displayName=xei;var nJr=rJr;var oJr=L(X(),1);function iJr(t){let[e,r]=oJr.useState(void 0);return b0(()=>{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 zB=L(mt(),1);var kmt="Popper",[aJr,qmt]=dZ(kmt),[Tei,sJr]=aJr(kmt),uJr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Z_.useState(null);return(0,zB.jsx)(Tei,{scope:e,anchor:n,onAnchorChange:o,children:r})};uJr.displayName=kmt;var lJr="PopperAnchor",cJr=Z_.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=sJr(lJr,r),a=Z_.useRef(null),s=zm(e,a),u=Z_.useRef(null);return Z_.useEffect(()=>{let l=u.current;u.current=n?.current||a.current,l!==u.current&&i.onAnchorChange(u.current)}),n?null:(0,zB.jsx)(Nh.div,{...o,ref:s})});cJr.displayName=lJr;var Bmt="PopperContent",[Eei,Pei]=aJr(Bmt),dJr=Z_.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,g=sJr(Bmt,r),[y,b]=Z_.useState(null),_=zm(e,A=>b(A)),[w,x]=Z_.useState(null),O=iJr(w),E=O?.width??0,T=O?.height??0,R=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},D=Array.isArray(l)?l:[l],F=D.length>0,B={padding:N,boundary:D.filter(Rei),altBoundary:F},{refs:U,floatingStyles:H,placement:G,isPositioned:ie,middlewareData:oe}=DB({strategy:"fixed",placement:R,whileElementsMounted:(...A)=>o$(...A,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[$B({mainAxis:o+T,alignmentAxis:a}),u&&LB({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?FB():void 0,...B}),u&&kB({...B}),qB({...B,apply:({elements:A,rects:W,availableWidth:V,availableHeight:se})=>{let{width:be,height:Ee}=W.reference,Ae=A.floating.style;Ae.setProperty("--radix-popper-available-width",`${V}px`),Ae.setProperty("--radix-popper-available-height",`${se}px`),Ae.setProperty("--radix-popper-anchor-width",`${be}px`),Ae.setProperty("--radix-popper-anchor-height",`${Ee}px`)}}),w&&UB({element:w,padding:s}),Aei({arrowWidth:E,arrowHeight:T}),f&&BB({strategy:"referenceHidden",...B})]}),[z,Q]=mJr(G),re=W_(m);b0(()=>{ie&&re?.()},[ie,re]);let Z=oe.arrow?.x,$=oe.arrow?.y,q=oe.arrow?.centerOffset!==0,[Y,j]=Z_.useState();return b0(()=>{y&&j(window.getComputedStyle(y).zIndex)},[y]),(0,zB.jsx)("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:ie?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(" "),...oe.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,zB.jsx)(Eei,{scope:r,placedSide:z,onArrowChange:x,arrowX:Z,arrowY:$,shouldHideArrow:q,children:(0,zB.jsx)(Nh.div,{"data-side":z,"data-align":Q,...h,ref:_,style:{...h.style,animation:ie?void 0:"none"}})})})});dJr.displayName=Bmt;var fJr="PopperArrow",Mei={top:"bottom",right:"left",bottom:"top",left:"right"},pJr=Z_.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Pei(fJr,n),a=Mei[i.placedSide];return(0,zB.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,zB.jsx)(nJr,{...o,ref:r,style:{...o.style,display:"block"}})})});pJr.displayName=fJr;function Rei(t){return t!==null}var Aei=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]=mJr(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 mJr(t){let[e,r="center"]=t.split("-");return[e,r]}var Umt=uJr,hJr=cJr,gJr=dJr,yJr=pJr;var Uje=L(X(),1),bJr=L(Bu(),1);var _Jr=L(mt(),1),Nei="Portal",zmt=Uje.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=Uje.useState(!1);b0(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?bJr.default.createPortal((0,_Jr.jsx)(Nh.div,{...n,ref:e}),a):null});zmt.displayName=Nei;var X_=L(X(),1);var vJr=L(X(),1);function jei(t,e){return vJr.useReducer((r,n)=>e[r][n]??r,t)}var gZ=t=>{let{present:e,children:r}=t,n=Dei(e),o=typeof r=="function"?r({present:n.isPresent}):X_.Children.only(r),i=zm(n.ref,$ei(o));return typeof r=="function"||n.isPresent?X_.cloneElement(o,{ref:i}):null};gZ.displayName="Presence";function Dei(t){let[e,r]=X_.useState(),n=X_.useRef(null),o=X_.useRef(t),i=X_.useRef("none"),a=t?"mounted":"unmounted",[s,u]=jei(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return X_.useEffect(()=>{let l=zje(n.current);i.current=s==="mounted"?l:"none"},[s]),b0(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=zje(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),b0(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=zje(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=p=>{p.target===e&&(i.current=zje(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 zje(t){return t?.animationName||"none"}function $ei(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 jh=L(X(),1);var zgs=!!(typeof window<"u"&&window.document&&window.document.createElement);function jJ(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var HB=L(X(),1);var i$=L(X(),1),wJr=L(mt(),1);function Hje(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,g=i$.useMemo(()=>m,Object.values(m));return(0,wJr.jsx)(h.Provider,{value:g,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,Lei(o,...e)]}function Lei(...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 CJr=L(X(),1);function SJr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Fei(...t){return e=>{let r=!1,n=t.map(o=>{let i=SJr(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():SJr(t[o],null)}}}}function _ce(...t){return CJr.useCallback(Fei(...t),t)}ah();var Vje=L(mt(),1),kei=L(X(),1);var qei=L(mt(),1);function xJr(t){let e=t+"CollectionProvider",[r,n]=Hje(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=h=>{let{scope:g,children:y}=h,b=HB.default.useRef(null),_=HB.default.useRef(new Map).current;return(0,Vje.jsx)(o,{scope:g,itemMap:_,collectionRef:b,children:y})};a.displayName=e;let s=t+"CollectionSlot",u=Ji(s),l=HB.default.forwardRef((h,g)=>{let{scope:y,children:b}=h,_=i(s,y),w=_ce(g,_.collectionRef);return(0,Vje.jsx)(u,{ref:w,children:b})});l.displayName=s;let c=t+"CollectionItemSlot",d="data-radix-collection-item",f=Ji(c),p=HB.default.forwardRef((h,g)=>{let{scope:y,children:b,..._}=h,w=HB.default.useRef(null),x=_ce(g,w),O=i(c,y);return HB.default.useEffect(()=>(O.itemMap.set(w,{ref:w,..._}),()=>void O.itemMap.delete(w))),(0,Vje.jsx)(f,{[d]:"",ref:x,children:b})});p.displayName=c;function m(h){let g=i(t+"CollectionConsumer",h);return HB.default.useCallback(()=>{let b=g.collectionRef.current;if(!b)return[];let _=Array.from(b.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((O,E)=>_.indexOf(O.ref.current)-_.indexOf(E.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},m,n]}var Hmt=L(X(),1);var OJr=L(X(),1),Jje=globalThis?.document?OJr.useLayoutEffect:()=>{};var Bei=Hmt[" useId ".trim().toString()]||(()=>{}),Uei=0;function TJr(t){let[e,r]=Hmt.useState(Bei());return Jje(()=>{t||r(n=>n??String(Uei++))},[t]),t||(e?`radix-${e}`:"")}var EJr=L(X(),1),zei=L(Bu(),1);ah();var PJr=L(mt(),1),Hei=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vmt=Hei.reduce((t,e)=>{let r=Ji(`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 yZ=L(X(),1);function MJr(t){let e=yZ.useRef(t);return yZ.useEffect(()=>{e.current=t}),yZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var w0=L(X(),1);var Kje=L(X(),1);var Vei=w0[" useInsertionEffect ".trim().toString()]||Jje;function RJr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=Jei({defaultProp:e,onChange:r}),s=t!==void 0,u=s?t:o;{let c=w0.useRef(t!==void 0);w0.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=w0.useCallback(c=>{if(s){let d=Kei(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function Jei({defaultProp:t,onChange:e}){let[r,n]=w0.useState(t),o=w0.useRef(r),i=w0.useRef(e);return Vei(()=>{i.current=e},[e]),w0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function Kei(t){return typeof t=="function"}var iys=Symbol("RADIX:SYNC_STATE");var Wje=L(X(),1),Wei=L(mt(),1),Gei=Wje.createContext(void 0);function AJr(t){let e=Wje.useContext(Gei);return t||e||"ltr"}var VB=L(mt(),1),Jmt="rovingFocusGroup.onEntryFocus",Zei={bubbles:!1,cancelable:!0},vce="RovingFocusGroup",[Kmt,IJr,Xei]=xJr(vce),[Yei,Wmt]=Hje(vce,[Xei]),[Qei,eti]=Yei(vce),NJr=jh.forwardRef((t,e)=>(0,VB.jsx)(Kmt.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,VB.jsx)(Kmt.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,VB.jsx)(tti,{...t,ref:e})})}));NJr.displayName=vce;var tti=jh.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=jh.useRef(null),p=_ce(e,f),m=AJr(i),[h,g]=RJr({prop:a,defaultProp:s??null,onChange:u,caller:vce}),[y,b]=jh.useState(!1),_=MJr(l),w=IJr(r),x=jh.useRef(!1),[O,E]=jh.useState(0);return jh.useEffect(()=>{let T=f.current;if(T)return T.addEventListener(Jmt,_),()=>T.removeEventListener(Jmt,_)},[_]),(0,VB.jsx)(Qei,{scope:r,orientation:n,dir:m,loop:o,currentTabStopId:h,onItemFocus:jh.useCallback(T=>g(T),[g]),onItemShiftTab:jh.useCallback(()=>b(!0),[]),onFocusableItemAdd:jh.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:jh.useCallback(()=>E(T=>T-1),[]),children:(0,VB.jsx)(Vmt.div,{tabIndex:y||O===0?-1:0,"data-orientation":n,...d,ref:p,style:{outline:"none",...t.style},onMouseDown:jJ(t.onMouseDown,()=>{x.current=!0}),onFocus:jJ(t.onFocus,T=>{let R=!x.current;if(T.target===T.currentTarget&&R&&!y){let N=new CustomEvent(Jmt,Zei);if(T.currentTarget.dispatchEvent(N),!N.defaultPrevented){let D=w().filter(G=>G.focusable),F=D.find(G=>G.active),B=D.find(G=>G.id===h),H=[F,B,...D].filter(Boolean).map(G=>G.ref.current);$Jr(H,c)}}x.current=!1}),onBlur:jJ(t.onBlur,()=>b(!1))})})}),jJr="RovingFocusGroupItem",DJr=jh.forwardRef((t,e)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:o=!1,tabStopId:i,children:a,...s}=t,u=TJr(),l=i||u,c=eti(jJr,r),d=c.currentTabStopId===l,f=IJr(r),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=c;return jh.useEffect(()=>{if(n)return p(),()=>m()},[n,p,m]),(0,VB.jsx)(Kmt.ItemSlot,{scope:r,id:l,focusable:n,active:o,children:(0,VB.jsx)(Vmt.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...s,ref:e,onMouseDown:jJ(t.onMouseDown,g=>{n?c.onItemFocus(l):g.preventDefault()}),onFocus:jJ(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:jJ(t.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){c.onItemShiftTab();return}if(g.target!==g.currentTarget)return;let y=oti(g,c.orientation,c.dir);if(y!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let _=f().filter(w=>w.focusable).map(w=>w.ref.current);if(y==="last")_.reverse();else if(y==="prev"||y==="next"){y==="prev"&&_.reverse();let w=_.indexOf(g.currentTarget);_=c.loop?iti(_,w+1):_.slice(w+1)}setTimeout(()=>$Jr(_))}}),children:typeof a=="function"?a({isCurrentTabStop:d,hasTabStop:h!=null}):a})})});DJr.displayName=jJr;var rti={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function nti(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function oti(t,e,r){let n=nti(t.key,r);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return rti[n]}function $Jr(t,e=!1){let r=document.activeElement;for(let n of t)if(n===r||(n.focus({preventScroll:e}),document.activeElement!==r))return}function iti(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var LJr=NJr,FJr=DJr;ah();var sti=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},bZ=new WeakMap,Gje=new WeakMap,Zje={},Gmt=0,kJr=function(t){return t&&(t.host||kJr(t.parentNode))},uti=function(t,e){return e.map(function(r){if(t.contains(r))return r;var n=kJr(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})},lti=function(t,e,r,n){var o=uti(e,Array.isArray(t)?t:[t]);Zje[r]||(Zje[r]=new WeakMap);var i=Zje[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=(bZ.get(f)||0)+1,g=(i.get(f)||0)+1;bZ.set(f,h),i.set(f,g),a.push(f),h===1&&m&&Gje.set(f,!0),g===1&&f.setAttribute(r,"true"),m||f.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",f,y)}})};return c(e),s.clear(),Gmt++,function(){a.forEach(function(d){var f=bZ.get(d)-1,p=i.get(d)-1;bZ.set(d,f),i.set(d,p),f||(Gje.has(d)||d.removeAttribute(n),Gje.delete(d)),p||d.removeAttribute(r)}),Gmt--,Gmt||(bZ=new WeakMap,bZ=new WeakMap,Gje=new WeakMap,Zje={})}},JB=function(t,e,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),o=e||sti(t);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live]"))),lti(n,o,r,"aria-hidden")):function(){return null}};var Ws=function(){return Ws=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},Ws.apply(this,arguments)};function KB(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 _Z(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 tDe=L(X());var Dy=L(X());var Mx="right-scroll-bar-position",Rx="width-before-scroll-bar",Zmt="with-scroll-bars-hidden",Xmt="--removed-body-scroll-bar-size";function Xje(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}var qJr=L(X());function BJr(t,e){var r=(0,qJr.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 Yje=L(X());var cti=typeof window<"u"?Yje.useLayoutEffect:Yje.useEffect,UJr=new WeakMap;function DJ(t,e){var r=BJr(e||null,function(n){return t.forEach(function(o){return Xje(o,n)})});return cti(function(){var n=UJr.get(r);if(n){var o=new Set(n),i=new Set(t),a=r.current;o.forEach(function(s){i.has(s)||Xje(s,null)}),i.forEach(function(s){o.has(s)||Xje(s,a)})}UJr.set(r,t)},[t]),r}function dti(t){return t}function fti(t,e){e===void 0&&(e=dti);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 $J(t){t===void 0&&(t={});var e=fti(null);return e.options=Ws({async:!0,ssr:!1},t),e}var zJr=L(X()),HJr=function(t){var e=t.sideCar,r=KB(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 zJr.createElement(n,Ws({},r))};HJr.isSideCarExport=!0;function LJ(t,e){return t.useMedium(e),HJr}var Qje=$J();var Ymt=function(){},wce=Dy.forwardRef(function(t,e){var r=Dy.useRef(null),n=Dy.useState({onScrollCapture:Ymt,onWheelCapture:Ymt,onTouchMoveCapture:Ymt}),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,g=t.allowPinchZoom,y=t.as,b=y===void 0?"div":y,_=t.gapMode,w=KB(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=DJ([r,e]),E=Ws(Ws({},w),o);return Dy.createElement(Dy.Fragment,null,c&&Dy.createElement(x,{sideCar:Qje,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:i,allowPinchZoom:!!g,lockRef:r,gapMode:_}),a?Dy.cloneElement(Dy.Children.only(s),Ws(Ws({},E),{ref:O})):Dy.createElement(b,Ws({},E,{className:u,ref:O}),s))});wce.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};wce.classNames={fullWidth:Rx,zeroRight:Mx};var yl=L(X());var wZ=L(X());var KJr=L(X());var VJr;var JJr=function(){if(VJr)return VJr;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function pti(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=JJr();return e&&t.setAttribute("nonce",e),t}function mti(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function hti(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Qmt=function(){var t=0,e=null;return{add:function(r){t==0&&(e=pti())&&(mti(e,r),hti(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}};var eht=function(){var t=Qmt();return function(e,r){KJr.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&r])}};var a$=function(){var t=eht(),e=function(r){var n=r.styles,o=r.dynamic;return t(n,o),null};return e};var gti={left:0,top:0,right:0,gap:0},tht=function(t){return parseInt(t||"",10)||0},yti=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[tht(r),tht(n),tht(o)]},rht=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return gti;var e=yti(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 bti=a$(),vZ="data-scroll-locked",_ti=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(Zmt,` {
|
||
overflow: hidden `).concat(n,`;
|
||
padding-right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
body[`).concat(vZ,`] {
|
||
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(Mx,` {
|
||
right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
|
||
.`).concat(Rx,` {
|
||
margin-right: `).concat(s,"px ").concat(n,`;
|
||
}
|
||
|
||
.`).concat(Mx," .").concat(Mx,` {
|
||
right: 0 `).concat(n,`;
|
||
}
|
||
|
||
.`).concat(Rx," .").concat(Rx,` {
|
||
margin-right: 0 `).concat(n,`;
|
||
}
|
||
|
||
body[`).concat(vZ,`] {
|
||
`).concat(Xmt,": ").concat(s,`px;
|
||
}
|
||
`)},WJr=function(){var t=parseInt(document.body.getAttribute(vZ)||"0",10);return isFinite(t)?t:0},vti=function(){wZ.useEffect(function(){return document.body.setAttribute(vZ,(WJr()+1).toString()),function(){var t=WJr()-1;t<=0?document.body.removeAttribute(vZ):document.body.setAttribute(vZ,t.toString())}},[])},FJ=function(t){var e=t.noRelative,r=t.noImportant,n=t.gapMode,o=n===void 0?"margin":n;vti();var i=wZ.useMemo(function(){return rht(o)},[o]);return wZ.createElement(bti,{styles:_ti(i,!e,o,r?"":"!important")})};var nht=!1;if(typeof window<"u")try{Sce=Object.defineProperty({},"passive",{get:function(){return nht=!0,!0}}),window.addEventListener("test",Sce,Sce),window.removeEventListener("test",Sce,Sce)}catch{nht=!1}var Sce,kJ=nht?{passive:!1}:!1;var wti=function(t){return t.tagName==="TEXTAREA"},GJr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!wti(t)&&r[e]==="visible")},Sti=function(t){return GJr(t,"overflowY")},Cti=function(t){return GJr(t,"overflowX")},oht=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=ZJr(t,n);if(o){var i=XJr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},xti=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Oti=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},ZJr=function(t,e){return t==="v"?Sti(e):Cti(e)},XJr=function(t,e){return t==="v"?xti(e):Oti(e)},Tti=function(t,e){return t==="h"&&e==="rtl"?-1:1},YJr=function(t,e,r,n,o){var i=Tti(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=XJr(t,s),m=p[0],h=p[1],g=p[2],y=h-g-i*m;(m||y)&&ZJr(t,s)&&(d+=y,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 eDe=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},QJr=function(t){return[t.deltaX,t.deltaY]},e3r=function(t){return t&&"current"in t?t.current:t},Eti=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Pti=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},Mti=0,SZ=[];function t3r(t){var e=yl.useRef([]),r=yl.useRef([0,0]),n=yl.useRef(),o=yl.useState(Mti++)[0],i=yl.useState(a$)[0],a=yl.useRef(t);yl.useEffect(function(){a.current=t},[t]),yl.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=_Z([t.lockRef.current],(t.shards||[]).map(e3r),!0).filter(Boolean);return h.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=yl.useCallback(function(h,g){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var y=eDe(h),b=r.current,_="deltaX"in h?h.deltaX:b[0]-y[0],w="deltaY"in h?h.deltaY:b[1]-y[1],x,O=h.target,E=Math.abs(_)>Math.abs(w)?"h":"v";if("touches"in h&&E==="h"&&O.type==="range")return!1;var T=oht(E,O);if(!T)return!0;if(T?x=E:(x=E==="v"?"h":"v",T=oht(E,O)),!T)return!1;if(!n.current&&"changedTouches"in h&&(_||w)&&(n.current=x),!x)return!0;var R=n.current||x;return YJr(R,g,h,R==="h"?_:w,!0)},[]),u=yl.useCallback(function(h){var g=h;if(!(!SZ.length||SZ[SZ.length-1]!==i)){var y="deltaY"in g?QJr(g):eDe(g),b=e.current.filter(function(x){return x.name===g.type&&(x.target===g.target||g.target===x.shadowParent)&&Eti(x.delta,y)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var _=(a.current.shards||[]).map(e3r).filter(Boolean).filter(function(x){return x.contains(g.target)}),w=_.length>0?s(g,_[0]):!a.current.noIsolation;w&&g.cancelable&&g.preventDefault()}}},[]),l=yl.useCallback(function(h,g,y,b){var _={name:h,delta:g,target:y,should:b,shadowParent:Rti(y)};e.current.push(_),setTimeout(function(){e.current=e.current.filter(function(w){return w!==_})},1)},[]),c=yl.useCallback(function(h){r.current=eDe(h),n.current=void 0},[]),d=yl.useCallback(function(h){l(h.type,QJr(h),h.target,s(h,t.lockRef.current))},[]),f=yl.useCallback(function(h){l(h.type,eDe(h),h.target,s(h,t.lockRef.current))},[]);yl.useEffect(function(){return SZ.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,kJ),document.addEventListener("touchmove",u,kJ),document.addEventListener("touchstart",c,kJ),function(){SZ=SZ.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,kJ),document.removeEventListener("touchmove",u,kJ),document.removeEventListener("touchstart",c,kJ)}},[]);var p=t.removeScrollBar,m=t.inert;return yl.createElement(yl.Fragment,null,m?yl.createElement(i,{styles:Pti(o)}):null,p?yl.createElement(FJ,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Rti(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var r3r=LJ(Qje,t3r);var n3r=tDe.forwardRef(function(t,e){return tDe.createElement(wce,Ws({},t,{ref:e,sideCar:r3r}))});n3r.classNames=wce.classNames;var iht=n3r;var vo=L(mt(),1),aht=["Enter"," "],Ati=["ArrowDown","PageUp","Home"],i3r=["ArrowUp","PageDown","End"],Iti=[...Ati,...i3r],Nti={ltr:[...aht,"ArrowRight"],rtl:[...aht,"ArrowLeft"]},jti={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Tce="Menu",[xce,Dti,$ti]=VHr(Tce),[qJ,sht]=dZ(Tce,[$ti,qmt,Wmt]),Ece=qmt(),a3r=Wmt(),[s3r,WB]=qJ(Tce),[Lti,Pce]=qJ(Tce),u3r=t=>{let{__scopeMenu:e,open:r=!1,children:n,dir:o,onOpenChange:i,modal:a=!0}=t,s=Ece(e),[u,l]=Lr.useState(null),c=Lr.useRef(!1),d=W_(i),f=JHr(o);return Lr.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,vo.jsx)(Umt,{...s,children:(0,vo.jsx)(s3r,{scope:e,open:r,onOpenChange:d,content:u,onContentChange:l,children:(0,vo.jsx)(Lti,{scope:e,onClose:Lr.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:c,dir:f,modal:a,children:n})})})};u3r.displayName=Tce;var Fti="MenuAnchor",uht=Lr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=Ece(r);return(0,vo.jsx)(hJr,{...o,...n,ref:e})});uht.displayName=Fti;var lht="MenuPortal",[kti,l3r]=qJ(lht,{forceMount:void 0}),c3r=t=>{let{__scopeMenu:e,forceMount:r,children:n,container:o}=t,i=WB(lht,e);return(0,vo.jsx)(kti,{scope:e,forceMount:r,children:(0,vo.jsx)(gZ,{present:r||i.open,children:(0,vo.jsx)(zmt,{asChild:!0,container:o,children:n})})})};c3r.displayName=lht;var S0="MenuContent",[qti,cht]=qJ(S0),d3r=Lr.forwardRef((t,e)=>{let r=l3r(S0,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=WB(S0,t.__scopeMenu),a=Pce(S0,t.__scopeMenu);return(0,vo.jsx)(xce.Provider,{scope:t.__scopeMenu,children:(0,vo.jsx)(gZ,{present:n||i.open,children:(0,vo.jsx)(xce.Slot,{scope:t.__scopeMenu,children:a.modal?(0,vo.jsx)(Bti,{...o,ref:e}):(0,vo.jsx)(Uti,{...o,ref:e})})})})}),Bti=Lr.forwardRef((t,e)=>{let r=WB(S0,t.__scopeMenu),n=Lr.useRef(null),o=zm(e,n);return Lr.useEffect(()=>{let i=n.current;if(i)return JB(i)},[]),(0,vo.jsx)(dht,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Gu(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),Uti=Lr.forwardRef((t,e)=>{let r=WB(S0,t.__scopeMenu);return(0,vo.jsx)(dht,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),zti=Ji("MenuContent.ScrollLock"),dht=Lr.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,g=WB(S0,r),y=Pce(S0,r),b=Ece(r),_=a3r(r),w=Dti(r),[x,O]=Lr.useState(null),E=Lr.useRef(null),T=zm(e,E,g.onContentChange),R=Lr.useRef(0),N=Lr.useRef(""),D=Lr.useRef(0),F=Lr.useRef(null),B=Lr.useRef("right"),U=Lr.useRef(0),H=m?iht:Lr.Fragment,G=m?{as:zti,allowPinchZoom:!0}:void 0,ie=z=>{let Q=N.current+z,re=w().filter(A=>!A.disabled),Z=document.activeElement,$=re.find(A=>A.ref.current===Z)?.textValue,q=re.map(A=>A.textValue),Y=rri(q,Q,$),j=re.find(A=>A.textValue===Y)?.ref.current;(function A(W){N.current=W,window.clearTimeout(R.current),W!==""&&(R.current=window.setTimeout(()=>A(""),1e3))})(Q),j&&setTimeout(()=>j.focus())};Lr.useEffect(()=>()=>window.clearTimeout(R.current),[]),oVr();let oe=Lr.useCallback(z=>B.current===F.current?.side&&ori(z,F.current?.area),[]);return(0,vo.jsx)(qti,{scope:r,searchRef:N,onItemEnter:Lr.useCallback(z=>{oe(z)&&z.preventDefault()},[oe]),onItemLeave:Lr.useCallback(z=>{oe(z)||(E.current?.focus(),O(null))},[oe]),onTriggerLeave:Lr.useCallback(z=>{oe(z)&&z.preventDefault()},[oe]),pointerGraceTimerRef:D,onPointerGraceIntentChange:Lr.useCallback(z=>{F.current=z},[]),children:(0,vo.jsx)(H,{...G,children:(0,vo.jsx)(Mmt,{asChild:!0,trapped:o,onMountAutoFocus:Gu(i,z=>{z.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,vo.jsx)(Omt,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,vo.jsx)(LJr,{asChild:!0,..._,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:x,onCurrentTabStopIdChange:O,onEntryFocus:Gu(u,z=>{y.isUsingKeyboardRef.current||z.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,vo.jsx)(gJr,{role:"menu","aria-orientation":"vertical","data-state":E3r(g.open),"data-radix-menu-content":"",dir:y.dir,...b,...h,ref:T,style:{outline:"none",...h.style},onKeyDown:Gu(h.onKeyDown,z=>{let re=z.target.closest("[data-radix-menu-content]")===z.currentTarget,Z=z.ctrlKey||z.altKey||z.metaKey,$=z.key.length===1;re&&(z.key==="Tab"&&z.preventDefault(),!Z&&$&&ie(z.key));let q=E.current;if(z.target!==q||!Iti.includes(z.key))return;z.preventDefault();let j=w().filter(A=>!A.disabled).map(A=>A.ref.current);i3r.includes(z.key)&&j.reverse(),eri(j)}),onBlur:Gu(t.onBlur,z=>{z.currentTarget.contains(z.target)||(window.clearTimeout(R.current),N.current="")}),onPointerMove:Gu(t.onPointerMove,Oce(z=>{let Q=z.target,re=U.current!==z.clientX;if(z.currentTarget.contains(Q)&&re){let Z=z.clientX>U.current?"right":"left";B.current=Z,U.current=z.clientX}}))})})})})})})});d3r.displayName=S0;var Hti="MenuGroup",fht=Lr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,vo.jsx)(Nh.div,{role:"group",...n,ref:e})});fht.displayName=Hti;var Vti="MenuLabel",f3r=Lr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,vo.jsx)(Nh.div,{...n,ref:e})});f3r.displayName=Vti;var rDe="MenuItem",o3r="menu.itemSelect",oDe=Lr.forwardRef((t,e)=>{let{disabled:r=!1,onSelect:n,...o}=t,i=Lr.useRef(null),a=Pce(rDe,t.__scopeMenu),s=cht(rDe,t.__scopeMenu),u=zm(e,i),l=Lr.useRef(!1),c=()=>{let d=i.current;if(!r&&d){let f=new CustomEvent(o3r,{bubbles:!0,cancelable:!0});d.addEventListener(o3r,p=>n?.(p),{once:!0}),Mje(d,f),f.defaultPrevented?l.current=!1:a.onClose()}};return(0,vo.jsx)(p3r,{...o,ref:u,disabled:r,onClick:Gu(t.onClick,c),onPointerDown:d=>{t.onPointerDown?.(d),l.current=!0},onPointerUp:Gu(t.onPointerUp,d=>{l.current||d.currentTarget?.click()}),onKeyDown:Gu(t.onKeyDown,d=>{let f=s.searchRef.current!=="";r||f&&d.key===" "||aht.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});oDe.displayName=rDe;var p3r=Lr.forwardRef((t,e)=>{let{__scopeMenu:r,disabled:n=!1,textValue:o,...i}=t,a=cht(rDe,r),s=a3r(r),u=Lr.useRef(null),l=zm(e,u),[c,d]=Lr.useState(!1),[f,p]=Lr.useState("");return Lr.useEffect(()=>{let m=u.current;m&&p((m.textContent??"").trim())},[i.children]),(0,vo.jsx)(xce.ItemSlot,{scope:r,disabled:n,textValue:o??f,children:(0,vo.jsx)(FJr,{asChild:!0,...s,focusable:!n,children:(0,vo.jsx)(Nh.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:l,onPointerMove:Gu(t.onPointerMove,Oce(m=>{n?a.onItemLeave(m):(a.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Gu(t.onPointerLeave,Oce(m=>a.onItemLeave(m))),onFocus:Gu(t.onFocus,()=>d(!0)),onBlur:Gu(t.onBlur,()=>d(!1))})})})}),Jti="MenuCheckboxItem",m3r=Lr.forwardRef((t,e)=>{let{checked:r=!1,onCheckedChange:n,...o}=t;return(0,vo.jsx)(_3r,{scope:t.__scopeMenu,checked:r,children:(0,vo.jsx)(oDe,{role:"menuitemcheckbox","aria-checked":nDe(r)?"mixed":r,...o,ref:e,"data-state":hht(r),onSelect:Gu(o.onSelect,()=>n?.(nDe(r)?!0:!r),{checkForDefaultPrevented:!1})})})});m3r.displayName=Jti;var h3r="MenuRadioGroup",[Kti,Wti]=qJ(h3r,{value:void 0,onValueChange:()=>{}}),g3r=Lr.forwardRef((t,e)=>{let{value:r,onValueChange:n,...o}=t,i=W_(n);return(0,vo.jsx)(Kti,{scope:t.__scopeMenu,value:r,onValueChange:i,children:(0,vo.jsx)(fht,{...o,ref:e})})});g3r.displayName=h3r;var y3r="MenuRadioItem",b3r=Lr.forwardRef((t,e)=>{let{value:r,...n}=t,o=Wti(y3r,t.__scopeMenu),i=r===o.value;return(0,vo.jsx)(_3r,{scope:t.__scopeMenu,checked:i,children:(0,vo.jsx)(oDe,{role:"menuitemradio","aria-checked":i,...n,ref:e,"data-state":hht(i),onSelect:Gu(n.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});b3r.displayName=y3r;var pht="MenuItemIndicator",[_3r,Gti]=qJ(pht,{checked:!1}),v3r=Lr.forwardRef((t,e)=>{let{__scopeMenu:r,forceMount:n,...o}=t,i=Gti(pht,r);return(0,vo.jsx)(gZ,{present:n||nDe(i.checked)||i.checked===!0,children:(0,vo.jsx)(Nh.span,{...o,ref:e,"data-state":hht(i.checked)})})});v3r.displayName=pht;var Zti="MenuSeparator",w3r=Lr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t;return(0,vo.jsx)(Nh.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});w3r.displayName=Zti;var Xti="MenuArrow",S3r=Lr.forwardRef((t,e)=>{let{__scopeMenu:r,...n}=t,o=Ece(r);return(0,vo.jsx)(yJr,{...o,...n,ref:e})});S3r.displayName=Xti;var mht="MenuSub",[Yti,C3r]=qJ(mht),Qti=t=>{let{__scopeMenu:e,children:r,open:n=!1,onOpenChange:o}=t,i=WB(mht,e),a=Ece(e),[s,u]=Lr.useState(null),[l,c]=Lr.useState(null),d=W_(o);return Lr.useEffect(()=>(i.open===!1&&d(!1),()=>d(!1)),[i.open,d]),(0,vo.jsx)(Umt,{...a,children:(0,vo.jsx)(s3r,{scope:e,open:n,onOpenChange:d,content:l,onContentChange:c,children:(0,vo.jsx)(Yti,{scope:e,contentId:Amt(),triggerId:Amt(),trigger:s,onTriggerChange:u,children:r})})})};Qti.displayName=mht;var Cce="MenuSubTrigger",x3r=Lr.forwardRef((t,e)=>{let r=WB(Cce,t.__scopeMenu),n=Pce(Cce,t.__scopeMenu),o=C3r(Cce,t.__scopeMenu),i=cht(Cce,t.__scopeMenu),a=Lr.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:u}=i,l={__scopeMenu:t.__scopeMenu},c=Lr.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return Lr.useEffect(()=>c,[c]),Lr.useEffect(()=>{let d=s.current;return()=>{window.clearTimeout(d),u(null)}},[s,u]),(0,vo.jsx)(uht,{asChild:!0,...l,children:(0,vo.jsx)(p3r,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":o.contentId,"data-state":E3r(r.open),...t,ref:Smt(e,o.onTriggerChange),onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Gu(t.onPointerMove,Oce(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:Gu(t.onPointerLeave,Oce(d=>{c();let f=r.content?.getBoundingClientRect();if(f){let p=r.content?.dataset.side,m=p==="right",h=m?-5:5,g=f[m?"left":"right"],y=f[m?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+h,y:d.clientY},{x:g,y:f.top},{x:y,y:f.top},{x:y,y:f.bottom},{x:g,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:Gu(t.onKeyDown,d=>{let f=i.searchRef.current!=="";t.disabled||f&&d.key===" "||Nti[n.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})});x3r.displayName=Cce;var O3r="MenuSubContent",T3r=Lr.forwardRef((t,e)=>{let r=l3r(S0,t.__scopeMenu),{forceMount:n=r.forceMount,...o}=t,i=WB(S0,t.__scopeMenu),a=Pce(S0,t.__scopeMenu),s=C3r(O3r,t.__scopeMenu),u=Lr.useRef(null),l=zm(e,u);return(0,vo.jsx)(xce.Provider,{scope:t.__scopeMenu,children:(0,vo.jsx)(gZ,{present:n||i.open,children:(0,vo.jsx)(xce.Slot,{scope:t.__scopeMenu,children:(0,vo.jsx)(dht,{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:Gu(t.onFocusOutside,c=>{c.target!==s.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Gu(t.onEscapeKeyDown,c=>{a.onClose(),c.preventDefault()}),onKeyDown:Gu(t.onKeyDown,c=>{let d=c.currentTarget.contains(c.target),f=jti[a.dir].includes(c.key);d&&f&&(i.onOpenChange(!1),s.trigger?.focus(),c.preventDefault())})})})})})});T3r.displayName=O3r;function E3r(t){return t?"open":"closed"}function nDe(t){return t==="indeterminate"}function hht(t){return nDe(t)?"indeterminate":t?"checked":"unchecked"}function eri(t){let e=document.activeElement;for(let r of t)if(r===e||(r.focus(),document.activeElement!==e))return}function tri(t,e){return t.map((r,n)=>t[(e+n)%t.length])}function rri(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=tri(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 nri(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 ori(t,e){if(!e)return!1;let r={x:t.clientX,y:t.clientY};return nri(r,e)}function Oce(t){return e=>e.pointerType==="mouse"?t(e):void 0}var P3r=u3r,M3r=uht,R3r=c3r,A3r=d3r,I3r=fht,N3r=f3r,j3r=oDe,D3r=m3r,$3r=g3r,L3r=b3r,F3r=v3r,k3r=w3r,q3r=S3r;var B3r=x3r,U3r=T3r;var ght=L(X(),1);var ari=ght[" useId ".trim().toString()]||(()=>{}),sri=0;function yht(t){let[e,r]=ght.useState(ari());return Oje(()=>{t||r(n=>n??String(sri++))},[t]),t||(e?`radix-${e}`:"")}var Dh=L(mt(),1),iDe="DropdownMenu",[uri,e_s]=jHr(iDe,[sht]),jb=sht(),[lri,z3r]=uri(iDe),Mce=t=>{let{__scopeDropdownMenu:e,children:r,dir:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=t,u=jb(e),l=Hm.useRef(null),[c,d]=$Hr({prop:o,defaultProp:i??!1,onChange:a,caller:iDe});return(0,Dh.jsx)(lri,{scope:e,triggerId:yht(),triggerRef:l,contentId:yht(),open:c,onOpenChange:d,onOpenToggle:Hm.useCallback(()=>d(f=>!f),[d]),modal:s,children:(0,Dh.jsx)(P3r,{...u,open:c,onOpenChange:d,dir:n,modal:s,children:r})})};Mce.displayName=iDe;var H3r="DropdownMenuTrigger",Rce=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...o}=t,i=z3r(H3r,r),a=jb(r);return(0,Dh.jsx)(M3r,{asChild:!0,...a,children:(0,Dh.jsx)(kHr.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:IHr(e,i.triggerRef),onPointerDown:pce(t.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(i.onOpenToggle(),i.open||s.preventDefault())}),onKeyDown:pce(t.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&i.onOpenToggle(),s.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});Rce.displayName=H3r;var cri="DropdownMenuPortal",V3r=t=>{let{__scopeDropdownMenu:e,...r}=t,n=jb(e);return(0,Dh.jsx)(R3r,{...n,...r})};V3r.displayName=cri;var J3r="DropdownMenuContent",K3r=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=z3r(J3r,r),i=jb(r),a=Hm.useRef(!1);return(0,Dh.jsx)(A3r,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...n,ref:e,onCloseAutoFocus:pce(t.onCloseAutoFocus,s=>{a.current||o.triggerRef.current?.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:pce(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)"}})});K3r.displayName=J3r;var dri="DropdownMenuGroup",fri=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=jb(r);return(0,Dh.jsx)(I3r,{...o,...n,ref:e})});fri.displayName=dri;var pri="DropdownMenuLabel",W3r=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=jb(r);return(0,Dh.jsx)(N3r,{...o,...n,ref:e})});W3r.displayName=pri;var mri="DropdownMenuItem",G3r=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=jb(r);return(0,Dh.jsx)(j3r,{...o,...n,ref:e})});G3r.displayName=mri;var hri="DropdownMenuCheckboxItem",Z3r=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=jb(r);return(0,Dh.jsx)(D3r,{...o,...n,ref:e})});Z3r.displayName=hri;var gri="DropdownMenuRadioGroup",yri=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=jb(r);return(0,Dh.jsx)($3r,{...o,...n,ref:e})});yri.displayName=gri;var bri="DropdownMenuRadioItem",X3r=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=jb(r);return(0,Dh.jsx)(L3r,{...o,...n,ref:e})});X3r.displayName=bri;var _ri="DropdownMenuItemIndicator",Y3r=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=jb(r);return(0,Dh.jsx)(F3r,{...o,...n,ref:e})});Y3r.displayName=_ri;var vri="DropdownMenuSeparator",Q3r=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=jb(r);return(0,Dh.jsx)(k3r,{...o,...n,ref:e})});Q3r.displayName=vri;var wri="DropdownMenuArrow",Sri=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=jb(r);return(0,Dh.jsx)(q3r,{...o,...n,ref:e})});Sri.displayName=wri;var Cri="DropdownMenuSubTrigger",e6r=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=jb(r);return(0,Dh.jsx)(B3r,{...o,...n,ref:e})});e6r.displayName=Cri;var xri="DropdownMenuSubContent",t6r=Hm.forwardRef((t,e)=>{let{__scopeDropdownMenu:r,...n}=t,o=jb(r);return(0,Dh.jsx)(U3r,{...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)"}})});t6r.displayName=xri;var r6r=Mce,n6r=Rce,o6r=V3r,bht=K3r;var _ht=W3r,vht=G3r,wht=Z3r;var Sht=X3r,Cht=Y3r,xht=Q3r;var Oht=e6r,Tht=t6r;On();jn();var PI=r6r,MI=n6r;var Tri=$u.forwardRef(({className:t,inset:e,children:r,...n},o)=>$u.createElement(Oht,{ref:o,className:Oe("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(tg,{className:"tw-ml-auto"})));Tri.displayName=Oht.displayName;var Eri=$u.forwardRef(({className:t,...e},r)=>$u.createElement(Tht,{ref:r,className:Oe("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}));Eri.displayName=Tht.displayName;var Y_=$u.forwardRef(({className:t,sideOffset:e=4,container:r,...n},o)=>$u.createElement(o6r,{container:r??activeDocument.body},$u.createElement(bht,{ref:o,sideOffset:e,className:Oe("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})));Y_.displayName=bht.displayName;var Ai=$u.forwardRef(({className:t,inset:e,...r},n)=>$u.createElement(vht,{ref:n,className:Oe("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-gap-2 tw-rounded-sm tw-px-2 tw-py-1.5 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-modifier-hover focus:tw-text-normal data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50 [&>svg]:tw-size-4 [&>svg]:tw-shrink-0",e&&"tw-pl-8",t),...r}));Ai.displayName=vht.displayName;var Pri=$u.forwardRef(({className:t,children:e,checked:r,...n},o)=>$u.createElement(wht,{ref:o,className:Oe("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(Cht,null,$u.createElement(Uu,{className:"tw-size-4"}))),e));Pri.displayName=wht.displayName;var Mri=$u.forwardRef(({className:t,children:e,...r},n)=>$u.createElement(Sht,{ref:n,className:Oe("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(Cht,null,$u.createElement(fte,{className:"tw-size-2 tw-fill-current"}))),e));Mri.displayName=Sht.displayName;var Rri=$u.forwardRef(({className:t,inset:e,...r},n)=>$u.createElement(_ht,{ref:n,className:Oe("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",e&&"tw-pl-8",t),...r}));Rri.displayName=_ht.displayName;var Ari=$u.forwardRef(({className:t,...e},r)=>$u.createElement(xht,{ref:r,className:Oe("-tw-mx-1 tw-my-1 tw-h-px",t),...e}));Ari.displayName=xht.displayName;var Iri=({className:t,...e})=>$u.createElement("span",{className:Oe("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",t),...e});Iri.displayName="DropdownMenuShortcut";var Ace=L(X());jn();var CZ=Ace.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 Ace.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:Oe("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},Ace.createElement("div",{className:Oe("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")}))});CZ.displayName="SettingSwitch";var jce=L(X());var Ho=L(X(),1);function Ax(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var a6r=L(X(),1);function i6r(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Nri(...t){return e=>{let r=!1,n=t.map(o=>{let i=i6r(o,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let o=0;o<n.length;o++){let i=n[o];typeof i=="function"?i():i6r(t[o],null)}}}}function Ix(...t){return a6r.useCallback(Nri(...t),t)}var s$=L(X(),1),s6r=L(mt(),1);function aDe(t,e=[]){let r=[];function n(i,a){let s=s$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,g=s$.useMemo(()=>m,Object.values(m));return(0,s6r.jsx)(h.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=s$.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=>s$.createContext(a));return function(s){let u=s?.[t]||i;return s$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,jri(o,...e)]}function jri(...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 s$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var _c=L(X(),1);var u6r=L(X(),1),l6r=L(Bu(),1);ah();var c6r=L(mt(),1),Dri=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],C0=Dri.reduce((t,e)=>{let r=Ji(`Primitive.${e}`),n=u6r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,c6r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function d6r(t,e){t&&l6r.flushSync(()=>t.dispatchEvent(e))}var xZ=L(X(),1);function BJ(t){let e=xZ.useRef(t);return xZ.useEffect(()=>{e.current=t}),xZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var f6r=L(X(),1);function p6r(t,e=globalThis?.document){let r=BJ(t);f6r.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 Pht=L(mt(),1),$ri="DismissableLayer",Eht="dismissableLayer.update",Lri="dismissableLayer.pointerDownOutside",Fri="dismissableLayer.focusOutside",m6r,g6r=_c.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Mht=_c.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=_c.useContext(g6r),[c,d]=_c.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=_c.useState({}),m=Ix(e,E=>d(E)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=h.indexOf(g),b=c?h.indexOf(c):-1,_=l.layersWithOutsidePointerEventsDisabled.size>0,w=b>=y,x=Bri(E=>{let T=E.target,R=[...l.branches].some(N=>N.contains(T));!w||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),O=Uri(E=>{let T=E.target;[...l.branches].some(N=>N.contains(T))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return p6r(E=>{b===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),_c.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(m6r=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),h6r(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=m6r)}},[c,f,r,l]),_c.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),h6r())},[c,l]),_c.useEffect(()=>{let E=()=>p({});return document.addEventListener(Eht,E),()=>document.removeEventListener(Eht,E)},[]),(0,Pht.jsx)(C0.div,{...u,ref:m,style:{pointerEvents:_?w?"auto":"none":void 0,...t.style},onFocusCapture:Ax(t.onFocusCapture,O.onFocusCapture),onBlurCapture:Ax(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:Ax(t.onPointerDownCapture,x.onPointerDownCapture)})});Mht.displayName=$ri;var kri="DismissableLayerBranch",qri=_c.forwardRef((t,e)=>{let r=_c.useContext(g6r),n=_c.useRef(null),o=Ix(e,n);return _c.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,Pht.jsx)(C0.div,{...t,ref:o})});qri.displayName=kri;function Bri(t,e=globalThis?.document){let r=BJ(t),n=_c.useRef(!1),o=_c.useRef(()=>{});return _c.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){y6r(Lri,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 Uri(t,e=globalThis?.document){let r=BJ(t),n=_c.useRef(!1);return _c.useEffect(()=>{let o=i=>{i.target&&!n.current&&y6r(Fri,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 h6r(){let t=new CustomEvent(Eht);document.dispatchEvent(t)}function y6r(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?d6r(o,i):o.dispatchEvent(i)}var Rht=L(X(),1);var b6r=L(X(),1),Q_=globalThis?.document?b6r.useLayoutEffect:()=>{};var zri=Rht[" useId ".trim().toString()]||(()=>{}),Hri=0;function _6r(t){let[e,r]=Rht.useState(zri());return Q_(()=>{t||r(n=>n??String(Hri++))},[t]),t||(e?`radix-${e}`:"")}var bw=L(X(),1);var v6r=L(X(),1);var Aht=L(mt(),1),Vri="Arrow",w6r=v6r.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,Aht.jsx)(C0.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,Aht.jsx)("polygon",{points:"0,0 30,0 15,10"})})});w6r.displayName=Vri;var S6r=w6r;var C6r=L(X(),1);function x6r(t){let[e,r]=C6r.useState(void 0);return Q_(()=>{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 GB=L(mt(),1);var Iht="Popper",[O6r,Nht]=aDe(Iht),[Kri,T6r]=O6r(Iht),E6r=t=>{let{__scopePopper:e,children:r}=t,[n,o]=bw.useState(null);return(0,GB.jsx)(Kri,{scope:e,anchor:n,onAnchorChange:o,children:r})};E6r.displayName=Iht;var P6r="PopperAnchor",M6r=bw.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=T6r(P6r,r),a=bw.useRef(null),s=Ix(e,a);return bw.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,GB.jsx)(C0.div,{...o,ref:s})});M6r.displayName=P6r;var jht="PopperContent",[Wri,Gri]=O6r(jht),R6r=bw.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,g=T6r(jht,r),[y,b]=bw.useState(null),_=Ix(e,A=>b(A)),[w,x]=bw.useState(null),O=x6r(w),E=O?.width??0,T=O?.height??0,R=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},D=Array.isArray(l)?l:[l],F=D.length>0,B={padding:N,boundary:D.filter(Xri),altBoundary:F},{refs:U,floatingStyles:H,placement:G,isPositioned:ie,middlewareData:oe}=DB({strategy:"fixed",placement:R,whileElementsMounted:(...A)=>o$(...A,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[$B({mainAxis:o+T,alignmentAxis:a}),u&&LB({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?FB():void 0,...B}),u&&kB({...B}),qB({...B,apply:({elements:A,rects:W,availableWidth:V,availableHeight:se})=>{let{width:be,height:Ee}=W.reference,Ae=A.floating.style;Ae.setProperty("--radix-popper-available-width",`${V}px`),Ae.setProperty("--radix-popper-available-height",`${se}px`),Ae.setProperty("--radix-popper-anchor-width",`${be}px`),Ae.setProperty("--radix-popper-anchor-height",`${Ee}px`)}}),w&&UB({element:w,padding:s}),Yri({arrowWidth:E,arrowHeight:T}),f&&BB({strategy:"referenceHidden",...B})]}),[z,Q]=N6r(G),re=BJ(m);Q_(()=>{ie&&re?.()},[ie,re]);let Z=oe.arrow?.x,$=oe.arrow?.y,q=oe.arrow?.centerOffset!==0,[Y,j]=bw.useState();return Q_(()=>{y&&j(window.getComputedStyle(y).zIndex)},[y]),(0,GB.jsx)("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:ie?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(" "),...oe.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,GB.jsx)(Wri,{scope:r,placedSide:z,onArrowChange:x,arrowX:Z,arrowY:$,shouldHideArrow:q,children:(0,GB.jsx)(C0.div,{"data-side":z,"data-align":Q,...h,ref:_,style:{...h.style,animation:ie?void 0:"none"}})})})});R6r.displayName=jht;var A6r="PopperArrow",Zri={top:"bottom",right:"left",bottom:"top",left:"right"},I6r=bw.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Gri(A6r,n),a=Zri[i.placedSide];return(0,GB.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,GB.jsx)(S6r,{...o,ref:r,style:{...o.style,display:"block"}})})});I6r.displayName=A6r;function Xri(t){return t!==null}var Yri=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]=N6r(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 N6r(t){let[e,r="center"]=t.split("-");return[e,r]}var j6r=E6r,D6r=M6r,$6r=R6r,L6r=I6r;var sDe=L(X(),1),F6r=L(Bu(),1);var k6r=L(mt(),1),eni="Portal",Dht=sDe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=sDe.useState(!1);Q_(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?F6r.default.createPortal((0,k6r.jsx)(C0.div,{...n,ref:e}),a):null});Dht.displayName=eni;var ev=L(X(),1);var q6r=L(X(),1);function tni(t,e){return q6r.useReducer((r,n)=>e[r][n]??r,t)}var lDe=t=>{let{present:e,children:r}=t,n=rni(e),o=typeof r=="function"?r({present:n.isPresent}):ev.Children.only(r),i=Ix(n.ref,nni(o));return typeof r=="function"||n.isPresent?ev.cloneElement(o,{ref:i}):null};lDe.displayName="Presence";function rni(t){let[e,r]=ev.useState(),n=ev.useRef(null),o=ev.useRef(t),i=ev.useRef("none"),a=t?"mounted":"unmounted",[s,u]=tni(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ev.useEffect(()=>{let l=uDe(n.current);i.current=s==="mounted"?l:"none"},[s]),Q_(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=uDe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),Q_(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=uDe(n.current).includes(p.animationName);if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=p=>{p.target===e&&(i.current=uDe(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:ev.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function uDe(t){return t?.animationName||"none"}function nni(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)}ah();var x0=L(X(),1);var cDe=L(X(),1);var oni=x0[" useInsertionEffect ".trim().toString()]||Q_;function B6r({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=ini({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=ani(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function ini({defaultProp:t,onChange:e}){let[r,n]=x0.useState(t),o=x0.useRef(r),i=x0.useRef(e);return oni(()=>{i.current=e},[e]),x0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function ani(t){return typeof t=="function"}var z_s=Symbol("RADIX:SYNC_STATE");var V6r=L(X(),1);var U6r=L(X(),1),sni=L(Bu(),1);ah();var z6r=L(mt(),1),uni=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],H6r=uni.reduce((t,e)=>{let r=Ji(`Primitive.${e}`),n=U6r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,z6r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var J6r=L(mt(),1),lni=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"}),cni="VisuallyHidden",K6r=V6r.forwardRef((t,e)=>(0,J6r.jsx)(H6r.span,{...t,ref:e,style:{...lni,...t.style}}));K6r.displayName=cni;var W6r=K6r;var dm=L(mt(),1),[dDe,ivs]=aDe("Tooltip",[Nht]),fDe=Nht(),G6r="TooltipProvider",fni=700,$ht="tooltip.open",[pni,Fht]=dDe(G6r),Z6r=t=>{let{__scopeTooltip:e,delayDuration:r=fni,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:i}=t,a=Ho.useRef(!0),s=Ho.useRef(!1),u=Ho.useRef(0);return Ho.useEffect(()=>{let l=u.current;return()=>window.clearTimeout(l)},[]),(0,dm.jsx)(pni,{scope:e,isOpenDelayedRef:a,delayDuration:r,onOpen:Ho.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:Ho.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:Ho.useCallback(l=>{s.current=l},[]),disableHoverableContent:o,children:i})};Z6r.displayName=G6r;var Ice="Tooltip",[mni,Nce]=dDe(Ice),X6r=t=>{let{__scopeTooltip:e,children:r,open:n,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=t,u=Fht(Ice,t.__scopeTooltip),l=fDe(e),[c,d]=Ho.useState(null),f=_6r(),p=Ho.useRef(0),m=a??u.disableHoverableContent,h=s??u.delayDuration,g=Ho.useRef(!1),[y,b]=B6r({prop:n,defaultProp:o??!1,onChange:E=>{E?(u.onOpen(),document.dispatchEvent(new CustomEvent($ht))):u.onClose(),i?.(E)},caller:Ice}),_=Ho.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),w=Ho.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,b(!0)},[b]),x=Ho.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b(!1)},[b]),O=Ho.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,b(!0),p.current=0},h)},[h,b]);return Ho.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),(0,dm.jsx)(j6r,{...l,children:(0,dm.jsx)(mni,{scope:e,contentId:f,open:y,stateAttribute:_,trigger:c,onTriggerChange:d,onTriggerEnter:Ho.useCallback(()=>{u.isOpenDelayedRef.current?O():w()},[u.isOpenDelayedRef,O,w]),onTriggerLeave:Ho.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:w,onClose:x,disableHoverableContent:m,children:r})})};X6r.displayName=Ice;var Lht="TooltipTrigger",Y6r=Ho.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=Nce(Lht,r),i=Fht(Lht,r),a=fDe(r),s=Ho.useRef(null),u=Ix(e,s,o.onTriggerChange),l=Ho.useRef(!1),c=Ho.useRef(!1),d=Ho.useCallback(()=>l.current=!1,[]);return Ho.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,dm.jsx)(D6r,{asChild:!0,...a,children:(0,dm.jsx)(C0.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:Ax(t.onPointerMove,f=>{f.pointerType!=="touch"&&!c.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),c.current=!0)}),onPointerLeave:Ax(t.onPointerLeave,()=>{o.onTriggerLeave(),c.current=!1}),onPointerDown:Ax(t.onPointerDown,()=>{o.open&&o.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Ax(t.onFocus,()=>{l.current||o.onOpen()}),onBlur:Ax(t.onBlur,o.onClose),onClick:Ax(t.onClick,o.onClose)})})});Y6r.displayName=Lht;var kht="TooltipPortal",[hni,gni]=dDe(kht,{forceMount:void 0}),Q6r=t=>{let{__scopeTooltip:e,forceMount:r,children:n,container:o}=t,i=Nce(kht,e);return(0,dm.jsx)(hni,{scope:e,forceMount:r,children:(0,dm.jsx)(lDe,{present:r||i.open,children:(0,dm.jsx)(Dht,{asChild:!0,container:o,children:n})})})};Q6r.displayName=kht;var OZ="TooltipContent",eKr=Ho.forwardRef((t,e)=>{let r=gni(OZ,t.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...i}=t,a=Nce(OZ,t.__scopeTooltip);return(0,dm.jsx)(lDe,{present:n||a.open,children:a.disableHoverableContent?(0,dm.jsx)(tKr,{side:o,...i,ref:e}):(0,dm.jsx)(yni,{side:o,...i,ref:e})})}),yni=Ho.forwardRef((t,e)=>{let r=Nce(OZ,t.__scopeTooltip),n=Fht(OZ,t.__scopeTooltip),o=Ho.useRef(null),i=Ix(e,o),[a,s]=Ho.useState(null),{trigger:u,onClose:l}=r,c=o.current,{onPointerInTransitChange:d}=n,f=Ho.useCallback(()=>{s(null),d(!1)},[d]),p=Ho.useCallback((m,h)=>{let g=m.currentTarget,y={x:m.clientX,y:m.clientY},b=Sni(y,g.getBoundingClientRect()),_=Cni(y,b),w=xni(h.getBoundingClientRect()),x=Tni([..._,...w]);s(x),d(!0)},[d]);return Ho.useEffect(()=>()=>f(),[f]),Ho.useEffect(()=>{if(u&&c){let m=g=>p(g,c),h=g=>p(g,u);return u.addEventListener("pointerleave",m),c.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",m),c.removeEventListener("pointerleave",h)}}},[u,c,p,f]),Ho.useEffect(()=>{if(a){let m=h=>{let g=h.target,y={x:h.clientX,y:h.clientY},b=u?.contains(g)||c?.contains(g),_=!Oni(y,a);b?f():_&&(f(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[u,c,a,l,f]),(0,dm.jsx)(tKr,{...t,ref:i})}),[bni,_ni]=dDe(Ice,{isInside:!1}),vni=Bjt("TooltipContent"),tKr=Ho.forwardRef((t,e)=>{let{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=t,u=Nce(OZ,r),l=fDe(r),{onClose:c}=u;return Ho.useEffect(()=>(document.addEventListener($ht,c),()=>document.removeEventListener($ht,c)),[c]),Ho.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,dm.jsx)(Mht,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:c,children:(0,dm.jsxs)($6r,{"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,dm.jsx)(vni,{children:n}),(0,dm.jsx)(bni,{scope:r,isInside:!0,children:(0,dm.jsx)(W6r,{id:u.contentId,role:"tooltip",children:o||n})})]})})});eKr.displayName=OZ;var rKr="TooltipArrow",wni=Ho.forwardRef((t,e)=>{let{__scopeTooltip:r,...n}=t,o=fDe(r);return _ni(rKr,r).isInside?null:(0,dm.jsx)(L6r,{...o,...n,ref:e})});wni.displayName=rKr;function Sni(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 Cni(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 xni(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 Oni(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 Tni(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),Eni(e)}function Eni(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 pDe=Z6r,nKr=X6r,oKr=Y6r,iKr=Q6r,qht=eKr;jn();var tv=pDe,Kn=nKr,Wn=oKr,Mn=jce.forwardRef(({className:t,sideOffset:e=4,...r},n)=>jce.createElement(iKr,{container:activeDocument.body},jce.createElement(qht,{ref:n,sideOffset:e,className:Oe("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})));Mn.displayName=qht.displayName;zr();Dt();$v();Pt();ROe();gie();On();var $b=require("obsidian"),vr=L(X());var Rn=L(X());On();Ro();var TZ=L(X());Ro();On();var EZ=({value:t,onChange:e,placeholder:r="Search..."})=>TZ.default.createElement("div",{className:"tw-relative"},TZ.default.createElement(yi,{type:"text",placeholder:r,value:t,onChange:n=>e(n.target.value),className:"tw-pr-10"}),t&&TZ.default.createElement(ve,{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"},TZ.default.createElement(XL,{className:"tw-size-4 tw-text-muted/60 hover:tw-text-accent-hover"})),TZ.default.createElement(c4,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-size-4 -tw-translate-y-1/2 tw-transform tw-text-muted"}));var Fce=L(X());var Zl=L(X(),1);var fvs=!!(typeof window<"u"&&window.document&&window.document.createElement);function RI(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var uKr=L(X(),1);function sKr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Pni(...t){return e=>{let r=!1,n=t.map(o=>{let i=sKr(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():sKr(t[o],null)}}}}function _w(...t){return uKr.useCallback(Pni(...t),t)}var u$=L(X(),1),lKr=L(mt(),1);function mDe(t,e=[]){let r=[];function n(i,a){let s=u$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,g=u$.useMemo(()=>m,Object.values(m));return(0,lKr.jsx)(h.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=u$.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=>u$.createContext(a));return function(s){let u=s?.[t]||i;return u$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,Mni(o,...e)]}function Mni(...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 u$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var vc=L(X(),1);var cKr=L(X(),1),dKr=L(Bu(),1);ah();var fKr=L(mt(),1),Rni=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Db=Rni.reduce((t,e)=>{let r=Ji(`Primitive.${e}`),n=cKr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,fKr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function pKr(t,e){t&&dKr.flushSync(()=>t.dispatchEvent(e))}var PZ=L(X(),1);function AI(t){let e=PZ.useRef(t);return PZ.useEffect(()=>{e.current=t}),PZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var mKr=L(X(),1);function hKr(t,e=globalThis?.document){let r=AI(t);mKr.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 Uht=L(mt(),1),Ani="DismissableLayer",Bht="dismissableLayer.update",Ini="dismissableLayer.pointerDownOutside",Nni="dismissableLayer.focusOutside",gKr,bKr=vc.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zht=vc.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=vc.useContext(bKr),[c,d]=vc.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=vc.useState({}),m=_w(e,E=>d(E)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=h.indexOf(g),b=c?h.indexOf(c):-1,_=l.layersWithOutsidePointerEventsDisabled.size>0,w=b>=y,x=$ni(E=>{let T=E.target,R=[...l.branches].some(N=>N.contains(T));!w||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),O=Lni(E=>{let T=E.target;[...l.branches].some(N=>N.contains(T))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return hKr(E=>{b===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),vc.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(gKr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),yKr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=gKr)}},[c,f,r,l]),vc.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),yKr())},[c,l]),vc.useEffect(()=>{let E=()=>p({});return document.addEventListener(Bht,E),()=>document.removeEventListener(Bht,E)},[]),(0,Uht.jsx)(Db.div,{...u,ref:m,style:{pointerEvents:_?w?"auto":"none":void 0,...t.style},onFocusCapture:RI(t.onFocusCapture,O.onFocusCapture),onBlurCapture:RI(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:RI(t.onPointerDownCapture,x.onPointerDownCapture)})});zht.displayName=Ani;var jni="DismissableLayerBranch",Dni=vc.forwardRef((t,e)=>{let r=vc.useContext(bKr),n=vc.useRef(null),o=_w(e,n);return vc.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,Uht.jsx)(Db.div,{...t,ref:o})});Dni.displayName=jni;function $ni(t,e=globalThis?.document){let r=AI(t),n=vc.useRef(!1),o=vc.useRef(()=>{});return vc.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){_Kr(Ini,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 Lni(t,e=globalThis?.document){let r=AI(t),n=vc.useRef(!1);return vc.useEffect(()=>{let o=i=>{i.target&&!n.current&&_Kr(Nni,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 yKr(){let t=new CustomEvent(Bht);document.dispatchEvent(t)}function _Kr(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?pKr(o,i):o.dispatchEvent(i)}var wKr=L(X(),1),Hht=0;function SKr(){wKr.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??vKr()),document.body.insertAdjacentElement("beforeend",t[1]??vKr()),Hht++,()=>{Hht===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Hht--}},[])}function vKr(){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 O0=L(X(),1);var EKr=L(mt(),1),Vht="focusScope.autoFocusOnMount",Jht="focusScope.autoFocusOnUnmount",CKr={bubbles:!1,cancelable:!0},Fni="FocusScope",Kht=O0.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=O0.useState(null),l=AI(o),c=AI(i),d=O0.useRef(null),f=_w(e,h=>u(h)),p=O0.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;O0.useEffect(()=>{if(n){let b=function(O){if(p.paused||!s)return;let E=O.target;s.contains(E)?d.current=E:ZB(d.current,{select:!0})},_=function(O){if(p.paused||!s)return;let E=O.relatedTarget;E!==null&&(s.contains(E)||ZB(d.current,{select:!0}))},w=function(O){if(document.activeElement===document.body)for(let T of O)T.removedNodes.length>0&&ZB(s)};var h=b,g=_,y=w;document.addEventListener("focusin",b),document.addEventListener("focusout",_);let x=new MutationObserver(w);return s&&x.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",_),x.disconnect()}}},[n,s,p.paused]),O0.useEffect(()=>{if(s){OKr.add(p);let h=document.activeElement;if(!s.contains(h)){let y=new CustomEvent(Vht,CKr);s.addEventListener(Vht,l),s.dispatchEvent(y),y.defaultPrevented||(kni(Hni(PKr(s)),{select:!0}),document.activeElement===h&&ZB(s))}return()=>{s.removeEventListener(Vht,l),setTimeout(()=>{let y=new CustomEvent(Jht,CKr);s.addEventListener(Jht,c),s.dispatchEvent(y),y.defaultPrevented||ZB(h??document.body,{select:!0}),s.removeEventListener(Jht,c),OKr.remove(p)},0)}}},[s,l,c,p]);let m=O0.useCallback(h=>{if(!r&&!n||p.paused)return;let g=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,y=document.activeElement;if(g&&y){let b=h.currentTarget,[_,w]=qni(b);_&&w?!h.shiftKey&&y===w?(h.preventDefault(),r&&ZB(_,{select:!0})):h.shiftKey&&y===_&&(h.preventDefault(),r&&ZB(w,{select:!0})):y===b&&h.preventDefault()}},[r,n,p.paused]);return(0,EKr.jsx)(Db.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});Kht.displayName=Fni;function kni(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(ZB(n,{select:e}),document.activeElement!==r)return}function qni(t){let e=PKr(t),r=xKr(e,t),n=xKr(e.reverse(),t);return[r,n]}function PKr(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 xKr(t,e){for(let r of t)if(!Bni(r,{upTo:e}))return r}function Bni(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 Uni(t){return t instanceof HTMLInputElement&&"select"in t}function ZB(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&Uni(t)&&e&&t.select()}}var OKr=zni();function zni(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=TKr(t,e),t.unshift(e)},remove(e){t=TKr(t,e),t[0]?.resume()}}}function TKr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function Hni(t){return t.filter(e=>e.tagName!=="A")}var Wht=L(X(),1);var MKr=L(X(),1),rv=globalThis?.document?MKr.useLayoutEffect:()=>{};var Vni=Wht[" useId ".trim().toString()]||(()=>{}),Jni=0;function RKr(t){let[e,r]=Wht.useState(Vni());return rv(()=>{t||r(n=>n??String(Jni++))},[t]),t||(e?`radix-${e}`:"")}var nv=L(X(),1);var AKr=L(X(),1);var Ght=L(mt(),1),Kni="Arrow",IKr=AKr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,Ght.jsx)(Db.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"})})});IKr.displayName=Kni;var NKr=IKr;var jKr=L(X(),1);function DKr(t){let[e,r]=jKr.useState(void 0);return rv(()=>{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 XB=L(mt(),1);var Zht="Popper",[$Kr,Xht]=mDe(Zht),[Gni,LKr]=$Kr(Zht),FKr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=nv.useState(null);return(0,XB.jsx)(Gni,{scope:e,anchor:n,onAnchorChange:o,children:r})};FKr.displayName=Zht;var kKr="PopperAnchor",qKr=nv.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=LKr(kKr,r),a=nv.useRef(null),s=_w(e,a),u=nv.useRef(null);return nv.useEffect(()=>{let l=u.current;u.current=n?.current||a.current,l!==u.current&&i.onAnchorChange(u.current)}),n?null:(0,XB.jsx)(Db.div,{...o,ref:s})});qKr.displayName=kKr;var Yht="PopperContent",[Zni,Xni]=$Kr(Yht),BKr=nv.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,g=LKr(Yht,r),[y,b]=nv.useState(null),_=_w(e,A=>b(A)),[w,x]=nv.useState(null),O=DKr(w),E=O?.width??0,T=O?.height??0,R=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},D=Array.isArray(l)?l:[l],F=D.length>0,B={padding:N,boundary:D.filter(Qni),altBoundary:F},{refs:U,floatingStyles:H,placement:G,isPositioned:ie,middlewareData:oe}=DB({strategy:"fixed",placement:R,whileElementsMounted:(...A)=>o$(...A,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[$B({mainAxis:o+T,alignmentAxis:a}),u&&LB({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?FB():void 0,...B}),u&&kB({...B}),qB({...B,apply:({elements:A,rects:W,availableWidth:V,availableHeight:se})=>{let{width:be,height:Ee}=W.reference,Ae=A.floating.style;Ae.setProperty("--radix-popper-available-width",`${V}px`),Ae.setProperty("--radix-popper-available-height",`${se}px`),Ae.setProperty("--radix-popper-anchor-width",`${be}px`),Ae.setProperty("--radix-popper-anchor-height",`${Ee}px`)}}),w&&UB({element:w,padding:s}),eoi({arrowWidth:E,arrowHeight:T}),f&&BB({strategy:"referenceHidden",...B})]}),[z,Q]=HKr(G),re=AI(m);rv(()=>{ie&&re?.()},[ie,re]);let Z=oe.arrow?.x,$=oe.arrow?.y,q=oe.arrow?.centerOffset!==0,[Y,j]=nv.useState();return rv(()=>{y&&j(window.getComputedStyle(y).zIndex)},[y]),(0,XB.jsx)("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:ie?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(" "),...oe.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,XB.jsx)(Zni,{scope:r,placedSide:z,onArrowChange:x,arrowX:Z,arrowY:$,shouldHideArrow:q,children:(0,XB.jsx)(Db.div,{"data-side":z,"data-align":Q,...h,ref:_,style:{...h.style,animation:ie?void 0:"none"}})})})});BKr.displayName=Yht;var UKr="PopperArrow",Yni={top:"bottom",right:"left",bottom:"top",left:"right"},zKr=nv.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=Xni(UKr,n),a=Yni[i.placedSide];return(0,XB.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,XB.jsx)(NKr,{...o,ref:r,style:{...o.style,display:"block"}})})});zKr.displayName=UKr;function Qni(t){return t!==null}var eoi=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]=HKr(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 HKr(t){let[e,r="center"]=t.split("-");return[e,r]}var VKr=FKr,Qht=qKr,JKr=BKr,KKr=zKr;var hDe=L(X(),1),WKr=L(Bu(),1);var GKr=L(mt(),1),roi="Portal",egt=hDe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=hDe.useState(!1);rv(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?WKr.default.createPortal((0,GKr.jsx)(Db.div,{...n,ref:e}),a):null});egt.displayName=roi;var ov=L(X(),1);var ZKr=L(X(),1);function noi(t,e){return ZKr.useReducer((r,n)=>e[r][n]??r,t)}var yDe=t=>{let{present:e,children:r}=t,n=ooi(e),o=typeof r=="function"?r({present:n.isPresent}):ov.Children.only(r),i=_w(n.ref,ioi(o));return typeof r=="function"||n.isPresent?ov.cloneElement(o,{ref:i}):null};yDe.displayName="Presence";function ooi(t){let[e,r]=ov.useState(),n=ov.useRef(null),o=ov.useRef(t),i=ov.useRef("none"),a=t?"mounted":"unmounted",[s,u]=noi(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ov.useEffect(()=>{let l=gDe(n.current);i.current=s==="mounted"?l:"none"},[s]),rv(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=gDe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),rv(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=gDe(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=p=>{p.target===e&&(i.current=gDe(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:ov.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function gDe(t){return t?.animationName||"none"}function ioi(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)}ah();var T0=L(X(),1);var bDe=L(X(),1);var aoi=T0[" useInsertionEffect ".trim().toString()]||rv;function XKr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=soi({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=uoi(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function soi({defaultProp:t,onChange:e}){let[r,n]=T0.useState(t),o=T0.useRef(r),i=T0.useRef(e);return aoi(()=>{i.current=e},[e]),T0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function uoi(t){return typeof t=="function"}var Yvs=Symbol("RADIX:SYNC_STATE");var wDe=L(X());var $y=L(X());var _De=$J();var tgt=function(){},Dce=$y.forwardRef(function(t,e){var r=$y.useRef(null),n=$y.useState({onScrollCapture:tgt,onWheelCapture:tgt,onTouchMoveCapture:tgt}),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,g=t.allowPinchZoom,y=t.as,b=y===void 0?"div":y,_=t.gapMode,w=KB(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=f,O=DJ([r,e]),E=Ws(Ws({},w),o);return $y.createElement($y.Fragment,null,c&&$y.createElement(x,{sideCar:_De,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:i,allowPinchZoom:!!g,lockRef:r,gapMode:_}),a?$y.cloneElement($y.Children.only(s),Ws(Ws({},E),{ref:O})):$y.createElement(b,Ws({},E,{className:u,ref:O}),s))});Dce.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Dce.classNames={fullWidth:Rx,zeroRight:Mx};var bl=L(X());var rgt=!1;if(typeof window<"u")try{$ce=Object.defineProperty({},"passive",{get:function(){return rgt=!0,!0}}),window.addEventListener("test",$ce,$ce),window.removeEventListener("test",$ce,$ce)}catch{rgt=!1}var $ce,UJ=rgt?{passive:!1}:!1;var loi=function(t){return t.tagName==="TEXTAREA"},YKr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!loi(t)&&r[e]==="visible")},coi=function(t){return YKr(t,"overflowY")},doi=function(t){return YKr(t,"overflowX")},ngt=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=QKr(t,n);if(o){var i=e5r(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},foi=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},poi=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},QKr=function(t,e){return t==="v"?coi(e):doi(e)},e5r=function(t,e){return t==="v"?foi(e):poi(e)},moi=function(t,e){return t==="h"&&e==="rtl"?-1:1},t5r=function(t,e,r,n,o){var i=moi(t,window.getComputedStyle(e).direction),a=i*n,s=r.target,u=e.contains(s),l=!1,c=a>0,d=0,f=0;do{if(!s)break;var p=e5r(t,s),m=p[0],h=p[1],g=p[2],y=h-g-i*m;(m||y)&&QKr(t,s)&&(d+=y,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 vDe=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},r5r=function(t){return[t.deltaX,t.deltaY]},n5r=function(t){return t&&"current"in t?t.current:t},hoi=function(t,e){return t[0]===e[0]&&t[1]===e[1]},goi=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},yoi=0,MZ=[];function o5r(t){var e=bl.useRef([]),r=bl.useRef([0,0]),n=bl.useRef(),o=bl.useState(yoi++)[0],i=bl.useState(a$)[0],a=bl.useRef(t);bl.useEffect(function(){a.current=t},[t]),bl.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=_Z([t.lockRef.current],(t.shards||[]).map(n5r),!0).filter(Boolean);return h.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=bl.useCallback(function(h,g){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var y=vDe(h),b=r.current,_="deltaX"in h?h.deltaX:b[0]-y[0],w="deltaY"in h?h.deltaY:b[1]-y[1],x,O=h.target,E=Math.abs(_)>Math.abs(w)?"h":"v";if("touches"in h&&E==="h"&&O.type==="range")return!1;var T=ngt(E,O);if(!T)return!0;if(T?x=E:(x=E==="v"?"h":"v",T=ngt(E,O)),!T)return!1;if(!n.current&&"changedTouches"in h&&(_||w)&&(n.current=x),!x)return!0;var R=n.current||x;return t5r(R,g,h,R==="h"?_:w,!0)},[]),u=bl.useCallback(function(h){var g=h;if(!(!MZ.length||MZ[MZ.length-1]!==i)){var y="deltaY"in g?r5r(g):vDe(g),b=e.current.filter(function(x){return x.name===g.type&&(x.target===g.target||g.target===x.shadowParent)&&hoi(x.delta,y)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var _=(a.current.shards||[]).map(n5r).filter(Boolean).filter(function(x){return x.contains(g.target)}),w=_.length>0?s(g,_[0]):!a.current.noIsolation;w&&g.cancelable&&g.preventDefault()}}},[]),l=bl.useCallback(function(h,g,y,b){var _={name:h,delta:g,target:y,should:b,shadowParent:boi(y)};e.current.push(_),setTimeout(function(){e.current=e.current.filter(function(w){return w!==_})},1)},[]),c=bl.useCallback(function(h){r.current=vDe(h),n.current=void 0},[]),d=bl.useCallback(function(h){l(h.type,r5r(h),h.target,s(h,t.lockRef.current))},[]),f=bl.useCallback(function(h){l(h.type,vDe(h),h.target,s(h,t.lockRef.current))},[]);bl.useEffect(function(){return MZ.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,UJ),document.addEventListener("touchmove",u,UJ),document.addEventListener("touchstart",c,UJ),function(){MZ=MZ.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,UJ),document.removeEventListener("touchmove",u,UJ),document.removeEventListener("touchstart",c,UJ)}},[]);var p=t.removeScrollBar,m=t.inert;return bl.createElement(bl.Fragment,null,m?bl.createElement(i,{styles:goi(o)}):null,p?bl.createElement(FJ,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function boi(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var i5r=LJ(_De,o5r);var a5r=wDe.forwardRef(function(t,e){return wDe.createElement(Dce,Ws({},t,{ref:e,sideCar:i5r}))});a5r.classNames=Dce.classNames;var ogt=a5r;var fm=L(mt(),1),SDe="Popover",[s5r,qws]=mDe(SDe,[Xht]),Lce=Xht(),[_oi,YB]=s5r(SDe),u5r=t=>{let{__scopePopover:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!1}=t,s=Lce(e),u=Zl.useRef(null),[l,c]=Zl.useState(!1),[d,f]=XKr({prop:n,defaultProp:o??!1,onChange:i,caller:SDe});return(0,fm.jsx)(VKr,{...s,children:(0,fm.jsx)(_oi,{scope:e,contentId:RKr(),triggerRef:u,open:d,onOpenChange:f,onOpenToggle:Zl.useCallback(()=>f(p=>!p),[f]),hasCustomAnchor:l,onCustomAnchorAdd:Zl.useCallback(()=>c(!0),[]),onCustomAnchorRemove:Zl.useCallback(()=>c(!1),[]),modal:a,children:r})})};u5r.displayName=SDe;var l5r="PopoverAnchor",voi=Zl.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=YB(l5r,r),i=Lce(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=o;return Zl.useEffect(()=>(a(),()=>s()),[a,s]),(0,fm.jsx)(Qht,{...i,...n,ref:e})});voi.displayName=l5r;var c5r="PopoverTrigger",d5r=Zl.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=YB(c5r,r),i=Lce(r),a=_w(e,o.triggerRef),s=(0,fm.jsx)(Db.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":g5r(o.open),...n,ref:a,onClick:RI(t.onClick,o.onOpenToggle)});return o.hasCustomAnchor?s:(0,fm.jsx)(Qht,{asChild:!0,...i,children:s})});d5r.displayName=c5r;var igt="PopoverPortal",[woi,Soi]=s5r(igt,{forceMount:void 0}),f5r=t=>{let{__scopePopover:e,forceMount:r,children:n,container:o}=t,i=YB(igt,e);return(0,fm.jsx)(woi,{scope:e,forceMount:r,children:(0,fm.jsx)(yDe,{present:r||i.open,children:(0,fm.jsx)(egt,{asChild:!0,container:o,children:n})})})};f5r.displayName=igt;var RZ="PopoverContent",p5r=Zl.forwardRef((t,e)=>{let r=Soi(RZ,t.__scopePopover),{forceMount:n=r.forceMount,...o}=t,i=YB(RZ,t.__scopePopover);return(0,fm.jsx)(yDe,{present:n||i.open,children:i.modal?(0,fm.jsx)(xoi,{...o,ref:e}):(0,fm.jsx)(Ooi,{...o,ref:e})})});p5r.displayName=RZ;var Coi=Ji("PopoverContent.RemoveScroll"),xoi=Zl.forwardRef((t,e)=>{let r=YB(RZ,t.__scopePopover),n=Zl.useRef(null),o=_w(e,n),i=Zl.useRef(!1);return Zl.useEffect(()=>{let a=n.current;if(a)return JB(a)},[]),(0,fm.jsx)(ogt,{as:Coi,allowPinchZoom:!0,children:(0,fm.jsx)(m5r,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:RI(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:RI(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:RI(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ooi=Zl.forwardRef((t,e)=>{let r=YB(RZ,t.__scopePopover),n=Zl.useRef(!1),o=Zl.useRef(!1);return(0,fm.jsx)(m5r,{...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()}})}),m5r=Zl.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=YB(RZ,r),p=Lce(r);return SKr(),(0,fm.jsx)(Kht,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,fm.jsx)(zht,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:c,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,fm.jsx)(JKr,{"data-state":g5r(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)"}})})})}),h5r="PopoverClose",Toi=Zl.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=YB(h5r,r);return(0,fm.jsx)(Db.button,{type:"button",...n,ref:e,onClick:RI(t.onClick,()=>o.onOpenChange(!1))})});Toi.displayName=h5r;var Eoi="PopoverArrow",Poi=Zl.forwardRef((t,e)=>{let{__scopePopover:r,...n}=t,o=Lce(r);return(0,fm.jsx)(KKr,{...o,...n,ref:e})});Poi.displayName=Eoi;function g5r(t){return t?"open":"closed"}var y5r=u5r;var b5r=d5r,_5r=f5r,agt=p5r;jn();var AZ=y5r,IZ=b5r;var zJ=Fce.forwardRef(({className:t,align:e="center",sideOffset:r=4,container:n,...o},i)=>Fce.createElement(_5r,{container:n??activeDocument.body},Fce.createElement(agt,{ref:i,align:e,sideOffset:r,className:Oe("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})));zJ.displayName=agt.displayName;var NI=L(X());var Xr=L(X(),1);var v5r=L(X(),1),Roi=L(Bu(),1);ah();var w5r=L(mt(),1),Aoi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],NZ=Aoi.reduce((t,e)=>{let r=Ji(`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,w5r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var iv=L(X(),1);var C5r=L(X(),1);function S5r(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=S5r(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():S5r(t[o],null)}}}}function l$(...t){return C5r.useCallback(Ioi(...t),t)}var x5r=L(X(),1),kce=globalThis?.document?x5r.useLayoutEffect:()=>{};var O5r=L(X(),1);function Noi(t,e){return O5r.useReducer((r,n)=>e[r][n]??r,t)}var jZ=t=>{let{present:e,children:r}=t,n=joi(e),o=typeof r=="function"?r({present:n.isPresent}):iv.Children.only(r),i=l$(n.ref,Doi(o));return typeof r=="function"||n.isPresent?iv.cloneElement(o,{ref:i}):null};jZ.displayName="Presence";function joi(t){let[e,r]=iv.useState(),n=iv.useRef(null),o=iv.useRef(t),i=iv.useRef("none"),a=t?"mounted":"unmounted",[s,u]=Noi(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return iv.useEffect(()=>{let l=CDe(n.current);i.current=s==="mounted"?l:"none"},[s]),kce(()=>{let l=n.current,c=o.current;if(c!==t){let f=i.current,p=CDe(l);t?u("MOUNT"):p==="none"||l?.display==="none"?u("UNMOUNT"):u(c&&f!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,u]),kce(()=>{if(e){let l,c=e.ownerDocument.defaultView??window,d=p=>{let h=CDe(n.current).includes(CSS.escape(p.animationName));if(p.target===e&&h&&(u("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},f=p=>{p.target===e&&(i.current=CDe(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(l),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:iv.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function CDe(t){return t?.animationName||"none"}function Doi(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 c$=L(X(),1),T5r=L(mt(),1);function E5r(t,e=[]){let r=[];function n(i,a){let s=c$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,g=c$.useMemo(()=>m,Object.values(m));return(0,T5r.jsx)(h.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=c$.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,c]}let o=()=>{let i=r.map(a=>c$.createContext(a));return function(s){let u=s?.[t]||i;return c$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,$oi(o,...e)]}function $oi(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return c$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var DZ=L(X(),1);function QB(t){let e=DZ.useRef(t);return DZ.useEffect(()=>{e.current=t}),DZ.useMemo(()=>(...r)=>e.current?.(...r),[])}var xDe=L(X(),1),Loi=L(mt(),1),Foi=xDe.createContext(void 0);function P5r(t){let e=xDe.useContext(Foi);return t||e||"ltr"}function M5r(t,[e,r]){return Math.min(r,Math.max(e,t))}var rSs=!!(typeof window<"u"&&window.document&&window.document.createElement);function eU(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var A5r=L(X(),1),Bs=L(mt(),1);function koi(t,e){return A5r.useReducer((r,n)=>e[r][n]??r,t)}var sgt="ScrollArea",[I5r,pSs]=E5r(sgt),[qoi,E0]=I5r(sgt),N5r=Xr.forwardRef((t,e)=>{let{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=t,[s,u]=Xr.useState(null),[l,c]=Xr.useState(null),[d,f]=Xr.useState(null),[p,m]=Xr.useState(null),[h,g]=Xr.useState(null),[y,b]=Xr.useState(0),[_,w]=Xr.useState(0),[x,O]=Xr.useState(!1),[E,T]=Xr.useState(!1),R=l$(e,D=>u(D)),N=P5r(o);return(0,Bs.jsx)(qoi,{scope:r,type:n,dir:N,scrollHideDelay:i,scrollArea:s,viewport:l,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:x,onScrollbarXEnabledChange:O,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:E,onScrollbarYEnabledChange:T,onCornerWidthChange:b,onCornerHeightChange:w,children:(0,Bs.jsx)(NZ.div,{dir:N,...a,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":_+"px",...t.style}})})});N5r.displayName=sgt;var j5r="ScrollAreaViewport",D5r=Xr.forwardRef((t,e)=>{let{__scopeScrollArea:r,children:n,nonce:o,...i}=t,a=E0(j5r,r),s=Xr.useRef(null),u=l$(e,s,a.onViewportChange);return(0,Bs.jsxs)(Bs.Fragment,{children:[(0,Bs.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,Bs.jsx)(NZ.div,{"data-radix-scroll-area-viewport":"",...i,ref:u,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,Bs.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});D5r.displayName=j5r;var II="ScrollAreaScrollbar",EDe=Xr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=E0(II,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,s=t.orientation==="horizontal";return Xr.useEffect(()=>(s?i(!0):a(!0),()=>{s?i(!1):a(!1)}),[s,i,a]),o.type==="hover"?(0,Bs.jsx)(Boi,{...n,ref:e,forceMount:r}):o.type==="scroll"?(0,Bs.jsx)(Uoi,{...n,ref:e,forceMount:r}):o.type==="auto"?(0,Bs.jsx)($5r,{...n,ref:e,forceMount:r}):o.type==="always"?(0,Bs.jsx)(ugt,{...n,ref:e}):null});EDe.displayName=II;var Boi=Xr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=E0(II,t.__scopeScrollArea),[i,a]=Xr.useState(!1);return Xr.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,Bs.jsx)(jZ,{present:r||i,children:(0,Bs.jsx)($5r,{"data-state":i?"visible":"hidden",...n,ref:e})})}),Uoi=Xr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=E0(II,t.__scopeScrollArea),i=t.orientation==="horizontal",a=MDe(()=>u("SCROLL_END"),100),[s,u]=koi("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 Xr.useEffect(()=>{if(s==="idle"){let l=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(l)}},[s,o.scrollHideDelay,u]),Xr.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,Bs.jsx)(jZ,{present:r||s!=="hidden",children:(0,Bs.jsx)(ugt,{"data-state":s==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:eU(t.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:eU(t.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),$5r=Xr.forwardRef((t,e)=>{let r=E0(II,t.__scopeScrollArea),{forceMount:n,...o}=t,[i,a]=Xr.useState(!1),s=t.orientation==="horizontal",u=MDe(()=>{if(r.viewport){let l=r.viewport.offsetWidth<r.viewport.scrollWidth,c=r.viewport.offsetHeight<r.viewport.scrollHeight;a(s?l:c)}},10);return $Z(r.viewport,u),$Z(r.content,u),(0,Bs.jsx)(jZ,{present:n||i,children:(0,Bs.jsx)(ugt,{"data-state":i?"visible":"hidden",...o,ref:e})})}),ugt=Xr.forwardRef((t,e)=>{let{orientation:r="vertical",...n}=t,o=E0(II,t.__scopeScrollArea),i=Xr.useRef(null),a=Xr.useRef(0),[s,u]=Xr.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=q5r(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 Woi(f,a.current,s,p)}return r==="horizontal"?(0,Bs.jsx)(zoi,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollLeft,p=R5r(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,Bs.jsx)(Hoi,{...c,ref:e,onThumbPositionChange:()=>{if(o.viewport&&i.current){let f=o.viewport.scrollTop,p=R5r(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}),zoi=Xr.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=E0(II,t.__scopeScrollArea),[a,s]=Xr.useState(),u=Xr.useRef(null),l=l$(e,u,i.onScrollbarXChange);return Xr.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Bs.jsx)(F5r,{"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":PDe(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),U5r(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:TDe(a.paddingLeft),paddingEnd:TDe(a.paddingRight)}})}})}),Hoi=Xr.forwardRef((t,e)=>{let{sizes:r,onSizesChange:n,...o}=t,i=E0(II,t.__scopeScrollArea),[a,s]=Xr.useState(),u=Xr.useRef(null),l=l$(e,u,i.onScrollbarYChange);return Xr.useEffect(()=>{u.current&&s(getComputedStyle(u.current))},[u]),(0,Bs.jsx)(F5r,{"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":PDe(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),U5r(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:TDe(a.paddingTop),paddingEnd:TDe(a.paddingBottom)}})}})}),[Voi,L5r]=I5r(II),F5r=Xr.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=E0(II,r),[m,h]=Xr.useState(null),g=l$(e,R=>h(R)),y=Xr.useRef(null),b=Xr.useRef(""),_=p.viewport,w=n.content-n.viewport,x=QB(c),O=QB(u),E=MDe(d,10);function T(R){if(y.current){let N=R.clientX-y.current.left,D=R.clientY-y.current.top;l({x:N,y:D})}}return Xr.useEffect(()=>{let R=N=>{let D=N.target;m?.contains(D)&&x(N,w)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[_,m,w,x]),Xr.useEffect(O,[n,O]),$Z(m,E),$Z(p.content,E),(0,Bs.jsx)(Voi,{scope:r,scrollbar:m,hasThumb:o,onThumbChange:QB(i),onThumbPointerUp:QB(a),onThumbPositionChange:O,onThumbPointerDown:QB(s),children:(0,Bs.jsx)(NZ.div,{...f,ref:g,style:{position:"absolute",...f.style},onPointerDown:eU(t.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),y.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),T(R))}),onPointerMove:eU(t.onPointerMove,T),onPointerUp:eU(t.onPointerUp,R=>{let N=R.target;N.hasPointerCapture(R.pointerId)&&N.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),y.current=null})})})}),ODe="ScrollAreaThumb",lgt=Xr.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=L5r(ODe,t.__scopeScrollArea);return(0,Bs.jsx)(jZ,{present:r||o.hasThumb,children:(0,Bs.jsx)(Joi,{ref:e,...n})})}),Joi=Xr.forwardRef((t,e)=>{let{__scopeScrollArea:r,style:n,...o}=t,i=E0(ODe,r),a=L5r(ODe,r),{onThumbPositionChange:s}=a,u=l$(e,d=>a.onThumbChange(d)),l=Xr.useRef(void 0),c=MDe(()=>{l.current&&(l.current(),l.current=void 0)},100);return Xr.useEffect(()=>{let d=i.viewport;if(d){let f=()=>{if(c(),!l.current){let p=Goi(d,s);l.current=p,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[i.viewport,c,s]),(0,Bs.jsx)(NZ.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:eU(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:eU(t.onPointerUp,a.onThumbPointerUp)})});lgt.displayName=ODe;var cgt="ScrollAreaCorner",k5r=Xr.forwardRef((t,e)=>{let r=E0(cgt,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?(0,Bs.jsx)(Koi,{...t,ref:e}):null});k5r.displayName=cgt;var Koi=Xr.forwardRef((t,e)=>{let{__scopeScrollArea:r,...n}=t,o=E0(cgt,r),[i,a]=Xr.useState(0),[s,u]=Xr.useState(0),l=!!(i&&s);return $Z(o.scrollbarX,()=>{let c=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(c),u(c)}),$Z(o.scrollbarY,()=>{let c=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(c),a(c)}),l?(0,Bs.jsx)(NZ.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 TDe(t){return t?parseInt(t,10):0}function q5r(t,e){let r=t/e;return isNaN(r)?0:r}function PDe(t){let e=q5r(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function Woi(t,e,r,n="ltr"){let o=PDe(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 B5r([u,l],d)(t)}function R5r(t,e,r="ltr"){let n=PDe(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=M5r(t,u);return B5r([0,a],[0,s])(l)}function B5r(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 U5r(t,e){return t>0&&t<e}var Goi=(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 MDe(t,e){let r=QB(t),n=Xr.useRef(0);return Xr.useEffect(()=>()=>window.clearTimeout(n.current),[]),Xr.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function $Z(t,e){let r=QB(e);kce(()=>{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 dgt=N5r,z5r=D5r;var H5r=k5r;jn();var LZ=NI.forwardRef(({className:t,children:e,...r},n)=>NI.createElement(dgt,{ref:n,className:Oe("tw-relative tw-overflow-hidden",t),...r},NI.createElement(z5r,{className:"tw-size-full tw-rounded-[inherit] [&>div:first-child]:!tw-block"},e),NI.createElement(V5r,null),NI.createElement(H5r,null)));LZ.displayName=dgt.displayName;var V5r=NI.forwardRef(({className:t,orientation:e="vertical",...r},n)=>NI.createElement(EDe,{ref:n,orientation:e,className:Oe("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},NI.createElement(lgt,{className:"tw-relative tw-flex-1 tw-rounded-full tw-bg-[var(--background-modifier-border)]"})));V5r.displayName=EDe.displayName;jn();Dt();var J5r=require("obsidian");function K5r({children:t,chatHistory:e,onUpdateTitle:r,onDeleteChat:n,onLoadChat:o,onOpenSourceFile:i}){let[a,s]=(0,Rn.useState)(""),[u,l]=(0,Rn.useState)(null),[c,d]=(0,Rn.useState)(""),[f,p]=(0,Rn.useState)(!1),[m,h]=(0,Rn.useState)(null),g=J5r.Platform.isMobile,y=(0,Rn.useMemo)(()=>a.trim()?e.filter(R=>R.title.toLowerCase().includes(a.toLowerCase())):e,[e,a]),b=(0,Rn.useMemo)(()=>{let R=[],N=new Map,D=new Date;return y.forEach(F=>{let B=D.getTime()-F.createdAt.getTime(),U=Math.floor(B/(1e3*60*60*24)),H,G;if(U===0)H="Today",G=0;else if(U===1)H="Yesterday",G=1;else if(U<7)H=`${U}d ago`,G=2+U;else if(U<30){let ie=Math.floor(U/7);H=ie===1?"1w ago":`${ie}w ago`,G=10+ie}else{let ie=Math.floor(U/30);H=ie===1?"1m ago":`${ie}m ago`,G=50+ie}N.has(H)||(N.set(H,[]),R.push({key:H,label:H,chats:N.get(H),priority:G})),N.get(H).push(F)}),R.sort((F,B)=>F.priority-B.priority)},[y]),_=(R,N)=>{l(R),d(N)},w=async()=>{if(u&&c.trim())try{await r(u,c.trim()),l(null),d("")}catch(R){ue("Error updating title:",R);return}else l(null),d("")},x=()=>{l(null),d("")},O=async R=>{if(m===R)try{await n(R),h(null)}catch(N){ue("Error deleting chat:",N),h(null)}else h(R),setTimeout(()=>{h(null)},3e3)},E=()=>{h(null)},T=async R=>{o&&await o(R),p(!1)};return Rn.default.createElement(AZ,{open:f,onOpenChange:p},Rn.default.createElement(IZ,{asChild:!0},t),Rn.default.createElement(zJ,{className:"tw-w-80 tw-p-0",align:"end",side:"top"},Rn.default.createElement("div",{className:"tw-flex tw-max-h-[400px] tw-flex-col"},Rn.default.createElement("div",{className:"tw-shrink-0 tw-border-b tw-p-1"},Rn.default.createElement(EZ,{value:a,onChange:s})),Rn.default.createElement(LZ,{className:"tw-min-h-[150px] tw-flex-1 tw-overflow-y-auto"},Rn.default.createElement("div",{className:"tw-p-2"},b.length===0?Rn.default.createElement("div",{className:"tw-py-8 tw-text-center tw-text-muted"},a?"No matching chat history found.":"No chat history"):b.map(R=>Rn.default.createElement("div",{key:R.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"}},Rn.default.createElement("div",{className:"tw-mb-2 tw-px-2 tw-text-xs tw-font-medium tw-tracking-wider tw-text-muted"},R.label),Rn.default.createElement("div",{className:"tw-space-y-1"},R.chats.map(N=>Rn.default.createElement(Xoi,{key:N.id,chat:N,isEditing:u===N.id,editingTitle:c,onEditingTitleChange:d,onStartEdit:_,onSaveEdit:w,onCancelEdit:x,onDelete:O,onCancelDelete:E,onLoadChat:T,onOpenSourceFile:i,isMobile:g,confirmDeleteId:m}))))))))))}function Xoi({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?Rn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2"},Rn.default.createElement(LK,{className:"tw-size-3 tw-shrink-0 tw-text-muted"}),Rn.default.createElement(yi,{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()}}),Rn.default.createElement(ve,{size:"sm",variant:"ghost",onClick:i,className:"tw-size-5 tw-p-0"},Rn.default.createElement(Uu,{className:"tw-size-3"})),Rn.default.createElement(ve,{size:"sm",variant:"ghost",onClick:a,className:"tw-size-5 tw-p-0"},Rn.default.createElement(pi,{className:"tw-size-3"}))):Rn.default.createElement("div",{className:Oe("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)},Rn.default.createElement(LK,{className:"tw-size-3 tw-shrink-0 tw-text-muted"}),Rn.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},Rn.default.createElement("span",{className:"tw-block tw-truncate tw-text-sm tw-font-medium tw-text-normal"},t.title)),Rn.default.createElement("div",{className:Oe("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?Rn.default.createElement(Rn.default.Fragment,null,Rn.default.createElement(ve,{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"},Rn.default.createElement(Uu,{className:"tw-size-3"})),Rn.default.createElement(ve,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),u()},className:"tw-size-5 tw-p-0",title:"Cancel deletion"},Rn.default.createElement(pi,{className:"tw-size-3"}))):Rn.default.createElement(Rn.default.Fragment,null,Rn.default.createElement(ve,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),c&&c(t.id)},className:"tw-size-5 tw-p-0",title:"Open the source file"},Rn.default.createElement(lte,{className:"tw-size-4"})),Rn.default.createElement(ve,{size:"sm",variant:"ghost",onClick:p=>{p.stopPropagation(),o(t.id,t.title)},className:"tw-size-5 tw-p-0"},Rn.default.createElement(lb,{className:"tw-size-3"})),Rn.default.createElement(ve,{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"},Rn.default.createElement(cy,{className:"tw-size-3"})))))}On();var HJ=L(X()),W5r=({tokenCount:t})=>t==null?null:HJ.default.createElement(Kn,null,HJ.default.createElement(Wn,{asChild:!0},HJ.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-faint"},HJ.default.createElement(mte,{className:"tw-size-3"}),HJ.default.createElement("span",null,(r=>r<1e3?"<1k":`${Math.floor(r/1e3)}k`)(t)))),HJ.default.createElement(Mn,null,"Context used: ",t.toLocaleString()));async function Yoi(){try{let{getSettings:t}=await Promise.resolve().then(()=>(Pt(),YQ));if(t().enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().indexVaultToVectorStore(!1);new $b.Notice(`Semantic search index refreshed with ${n} documents.`)}else new $b.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error refreshing vault index:",t),new $b.Notice("Failed to refresh vault index. Check console for details.")}}async function Qoi(){try{let{getSettings:t}=await Promise.resolve().then(()=>(Pt(),YQ));if(t().enableSemanticSearchV3){let n=await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().indexVaultToVectorStore(!0);new $b.Notice(`Semantic search index rebuilt with ${n} documents.`)}else new $b.Notice("Lexical search builds indexes on demand. No manual indexing required.")}catch(t){console.error("Error force reindexing vault:",t),new $b.Notice("Failed to force reindex vault. Check console for details.")}}async function RDe(){let t=tc();if(!t){new $b.Notice("No project is currently selected to reload.");return}try{RO(!0),await UC.getInstance().invalidateMarkdownContext(t,!0);let e=app.plugins.getPlugin("copilot");if(e&&e.projectManager)await e.projectManager.getProjectContext(t.id),new $b.Notice(`Project context for "${t.name}" reloaded successfully.`);else throw new Error("Copilot plugin or ProjectManager not available.")}catch(e){ue("Error reloading project context:",e),X1(e)||new $b.Notice("Failed to reload project context. Check console for details.")}finally{RO(!1)}}async function eii(){let t=tc();if(!t){new $b.Notice("No project is currently selected to rebuild.");return}new lm(app,async()=>{try{RO(!0),new $b.Notice(`Force rebuilding context for project: ${t.name}... This will take some time and re-fetch all data.`,1e4),yie.resetRateLimitNoticeTimer(),await UC.getInstance().clearForProject(t),new $b.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 $b.Notice(`Project context for "${t.name}" rebuilt successfully from scratch.`);else throw new Error("Copilot plugin or ProjectManager not available for rebuild.")}catch(r){ue("Error force rebuilding project context:",r),X1(r)||new $b.Notice("Failed to force rebuild project context. Check console for details.")}finally{RO(!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 G5r({onNewChat:t,onSaveAsNote:e,onLoadHistory:r,onModeChange:n,onCloseProject:o,chatHistory:i,onUpdateChatTitle:a,onDeleteChat:s,onLoadChat:u,onOpenSourceFile:l,latestTokenCount:c}){let d=So(),[f,p]=Ev(),m=Y8(),h=g=>{p(g),n(g),g!=="project"&&(Vz(null),o?.())};return vr.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between tw-p-1"},vr.default.createElement("div",{className:"tw-flex-1"},vr.default.createElement(Mce,null,vr.default.createElement(Rce,{asChild:!0},vr.default.createElement(ve,{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"&&vr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},vr.default.createElement(ly,{className:"tw-size-4"}),"copilot plus"),f==="project"&&"projects (alpha)",vr.default.createElement(Qs,{className:"tw-mt-0.5 tw-size-5"}))),vr.default.createElement(Y_,{align:"start"},vr.default.createElement(Ai,{onSelect:()=>{h("llm_chain")}},"chat (free)"),vr.default.createElement(Ai,{onSelect:()=>{h("vault_qa")}},"vault QA (free)"),m?vr.default.createElement(Ai,{onSelect:()=>{h("copilot_plus")}},vr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},vr.default.createElement(ly,{className:"tw-size-4"}),"copilot plus")):vr.default.createElement(Ai,{onSelect:()=>{d4(IN.CHAT_MODE_SELECT),o?.()}},"copilot plus",vr.default.createElement(XN,{className:"tw-size-3"})),m?vr.default.createElement(Ai,{className:"tw-flex tw-items-center tw-gap-1",onSelect:()=>{h("project")}},vr.default.createElement(l4,{className:"tw-size-4"}),"projects (alpha)"):vr.default.createElement(Ai,{onSelect:()=>{d4(IN.CHAT_MODE_SELECT),o?.()}},"copilot plus",vr.default.createElement(XN,{className:"tw-size-3"}))))),vr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},vr.default.createElement("div",{className:"tw-mr-2"},vr.default.createElement(W5r,{tokenCount:c??null})),vr.default.createElement(Kn,null,vr.default.createElement(Wn,{asChild:!0},vr.default.createElement(ve,{variant:"ghost2",size:"icon",title:"New Chat",onClick:t},vr.default.createElement(Pte,{className:"tw-size-4"}))),vr.default.createElement(Mn,null,"New Chat")),!d.autosaveChat&&vr.default.createElement(Kn,null,vr.default.createElement(Wn,{asChild:!0},vr.default.createElement(ve,{variant:"ghost2",size:"icon",title:"Save Chat as Note",onClick:e},vr.default.createElement(gte,{className:"tw-size-4"}))),vr.default.createElement(Mn,null,"Save Chat as Note")),vr.default.createElement(Kn,null,vr.default.createElement(K5r,{chatHistory:i,onUpdateTitle:a,onDeleteChat:s,onLoadChat:u,onOpenSourceFile:l},vr.default.createElement(Wn,{asChild:!0},vr.default.createElement(ve,{variant:"ghost2",size:"icon",title:"Chat History",onClick:r},vr.default.createElement(Ote,{className:"tw-size-4"})))),vr.default.createElement(Mn,null,"Chat History")),vr.default.createElement(Mce,null,vr.default.createElement(Rce,{asChild:!0},vr.default.createElement(ve,{variant:"ghost2",size:"icon",title:"Advanced Settings"},vr.default.createElement(QL,{className:"tw-size-4"}))),vr.default.createElement(Y_,{align:"end",className:"tw-w-64"},vr.default.createElement(Ai,{className:"tw-flex tw-justify-between",onSelect:g=>{g.preventDefault(),et("showSuggestedPrompts",!d.showSuggestedPrompts)}},vr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vr.default.createElement(ly,{className:"tw-size-4"}),"Suggested Prompt"),vr.default.createElement(CZ,{checked:d.showSuggestedPrompts})),vr.default.createElement(Ai,{className:"tw-flex tw-justify-between",onSelect:g=>{g.preventDefault(),et("showRelevantNotes",!d.showRelevantNotes)}},vr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},vr.default.createElement(ic,{className:"tw-size-4"}),"Relevant Note"),vr.default.createElement(CZ,{checked:d.showRelevantNotes})),f==="project"?vr.default.createElement(vr.default.Fragment,null,vr.default.createElement(Ai,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>RDe()},vr.default.createElement(qO,{className:"tw-size-4"}),"Reload Current Project"),vr.default.createElement(Ai,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>eii()},vr.default.createElement(rg,{className:"tw-size-4"}),"Force Rebuild Context")):vr.default.createElement(vr.default.Fragment,null,vr.default.createElement(Ai,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>Yoi()},vr.default.createElement(qO,{className:"tw-size-4"}),"Refresh Vault Index"),vr.default.createElement(Ai,{className:"tw-flex tw-items-center tw-gap-2",onSelect:()=>{new lm(app,()=>Qoi(),"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()}},vr.default.createElement(rg,{className:"tw-size-4"}),"Force Reindex Vault"))))))}Tu();gd();var ADe=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()}};Ro();var av=L(X()),fgt=require("obsidian");Ro();Pt();wr();On();jn();function IDe({disabled:t=!1,size:e="fit",variant:r="ghost2",className:n,value:o,onChange:i}){let[a,s]=(0,av.useState)(null),u=So(),l=u.activeModels.find(c=>c.enabled&&Qn(c)===o);return av.default.createElement(PI,null,av.default.createElement(MI,{asChild:!0},av.default.createElement(ve,{variant:r,size:e,disabled:t,className:Oe("tw-min-w-0 tw-justify-start tw-text-muted",n)},av.default.createElement("div",{className:"tw-min-w-0 tw-flex-1 tw-truncate"},a?av.default.createElement("span",{className:"tw-truncate tw-text-error"},"Model Load Failed"):l?av.default.createElement(hmt,{model:l,iconSize:8}):av.default.createElement("span",{className:"tw-truncate"},"Select Model")),!t&&av.default.createElement(Qs,{className:"tw-mt-0.5 tw-size-5 tw-shrink-0"}))),av.default.createElement(Y_,{align:"start"},u.activeModels.filter(c=>c.enabled).map(c=>{let{hasApiKey:d,errorNotice:f}=H6(c,u);return av.default.createElement(Ai,{key:Qn(c),onSelect:async p=>{if(!d&&f){p.preventDefault(),new fgt.Notice(f);return}try{s(null),i(Qn(c))}catch(m){let h="Model switch failed: "+Eo(m);s(h),new fgt.Notice(h);let g=u.activeModels.find(y=>y.enabled&&Qn(y)===o);g&&i(Qn(g))}},className:d?"":"tw-cursor-not-allowed tw-opacity-50"},av.default.createElement(hmt,{model:c,iconSize:12}))})))}var Qt=L(X());On();Ro();gd();jn();Pt();wr();var Z5r=({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=s_(d),p=f&&d!=="project",m=()=>{let b=!a;s(b),et("enableAutonomousAgent",b)},h=()=>{let b=!t;e(b),!b&&u&&u()},g=()=>{let b=!r;n(b),!b&&l&&l()},y=()=>{let b=!o;i(b),!b&&c&&c()};return f?Qt.default.createElement(tv,{delayDuration:0},Qt.default.createElement("div",{className:"tw-hidden tw-items-center tw-gap-1.5 @[420px]/chat-input:tw-flex"},p&&Qt.default.createElement(Kn,null,Qt.default.createElement(Wn,{asChild:!0},Qt.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:m,className:Oe("tw-text-muted hover:tw-text-accent",a&&"tw-text-accent tw-bg-accent/10")},Qt.default.createElement($K,{className:"tw-size-4"}))),Qt.default.createElement(Mn,{className:"tw-px-1 tw-py-0.5"},"Toggle autonomous agent mode")),!a&&Qt.default.createElement(Qt.default.Fragment,null,Qt.default.createElement(Kn,null,Qt.default.createElement(Wn,{asChild:!0},Qt.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:h,className:Oe("tw-text-muted hover:tw-text-accent",t&&"tw-text-accent tw-bg-accent/10")},Qt.default.createElement(JN,{className:"tw-size-4"}))),Qt.default.createElement(Mn,{className:"tw-px-1 tw-py-0.5"},"Toggle vault search")),Qt.default.createElement(Kn,null,Qt.default.createElement(Wn,{asChild:!0},Qt.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:g,className:Oe("tw-text-muted hover:tw-text-accent",r&&"tw-text-accent tw-bg-accent/10")},Qt.default.createElement(lC,{className:"tw-size-4"}))),Qt.default.createElement(Mn,{className:"tw-px-1 tw-py-0.5"},"Toggle web search")),Qt.default.createElement(Kn,null,Qt.default.createElement(Wn,{asChild:!0},Qt.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:y,className:Oe("tw-text-muted hover:tw-text-accent",o&&"tw-text-accent tw-bg-accent/10")},Qt.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},Qt.default.createElement(ly,{className:"tw-size-2"}),Qt.default.createElement(lb,{className:"tw-size-3"})))),Qt.default.createElement(Mn,{className:"tw-px-1 tw-py-0.5"},"Toggle composer (note editing)")))),Qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5 @[420px]/chat-input:tw-hidden"},Qt.default.createElement(PI,null,Qt.default.createElement(MI,{asChild:!0},Qt.default.createElement(ve,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent"},Qt.default.createElement(Dv,{className:"tw-size-4"}))),Qt.default.createElement(Y_,{align:"end",className:"tw-w-56"},p&&Qt.default.createElement(Ai,{onClick:m,className:"tw-flex tw-items-center tw-justify-between"},Qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qt.default.createElement($K,{className:"tw-size-4"}),Qt.default.createElement("span",null,"Autonomous Agent")),a&&Qt.default.createElement(Uu,{className:"tw-size-4"})),!a&&Qt.default.createElement(Qt.default.Fragment,null,Qt.default.createElement(Ai,{onClick:h,className:"tw-flex tw-items-center tw-justify-between"},Qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qt.default.createElement(JN,{className:"tw-size-4"}),Qt.default.createElement("span",null,"Vault Search")),t&&Qt.default.createElement(Uu,{className:"tw-size-4"})),Qt.default.createElement(Ai,{onClick:g,className:"tw-flex tw-items-center tw-justify-between"},Qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qt.default.createElement(lC,{className:"tw-size-4"}),Qt.default.createElement("span",null,"Web Search")),r&&Qt.default.createElement(Uu,{className:"tw-size-4"})),Qt.default.createElement(Ai,{onClick:y,className:"tw-flex tw-items-center tw-justify-between"},Qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qt.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},Qt.default.createElement(ly,{className:"tw-size-2"}),Qt.default.createElement(lb,{className:"tw-size-3"})),Qt.default.createElement("span",null,"Composer")),o&&Qt.default.createElement(Uu,{className:"tw-size-4"}))),a&&Qt.default.createElement(Qt.default.Fragment,null,Qt.default.createElement(Ai,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},Qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qt.default.createElement(JN,{className:"tw-size-4"}),Qt.default.createElement("span",null,"Vault Search"))),Qt.default.createElement(Ai,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},Qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qt.default.createElement(lC,{className:"tw-size-4"}),Qt.default.createElement("span",null,"Web Search"))),Qt.default.createElement(Ai,{disabled:!0,className:"tw-flex tw-items-center tw-justify-between tw-opacity-50"},Qt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Qt.default.createElement("span",{className:"tw-flex tw-items-center tw-gap-0.5"},Qt.default.createElement(ly,{className:"tw-size-2"}),Qt.default.createElement(lb,{className:"tw-size-3"})),Qt.default.createElement("span",null,"Composer")))))))):null};wr();Pt();wr();On();var Ade=require("obsidian"),zt=L(X());var fi=L(X()),yu=L(oWr());function tU(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(c){try{l(n.next(c))}catch(d){a(d)}}function u(c){try{l(n.throw(c))}catch(d){a(d)}}function l(c){c.done?i(c.value):o(c.value).then(s,u)}l((n=n.apply(t,e||[])).next())})}var nii=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function VJ(t,e,r){let n=oii(t),{webkitRelativePath:o}=t,i=typeof e=="string"?e:typeof o=="string"&&o.length>0?o:`./${t.name}`;return typeof n.path!="string"&&iWr(n,"path",i),r!==void 0&&Object.defineProperty(n,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),iWr(n,"relativePath",i),n}function oii(t){let{name:e}=t;if(e&&e.lastIndexOf(".")!==-1&&!t.type){let n=e.split(".").pop().toLowerCase(),o=nii.get(n);o&&Object.defineProperty(t,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return t}function iWr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!1,configurable:!1,enumerable:!0})}var iii=[".DS_Store","Thumbs.db"];function mgt(t){return tU(this,void 0,void 0,function*(){return NDe(t)&&aii(t.dataTransfer)?cii(t.dataTransfer,t.type):sii(t)?uii(t):Array.isArray(t)&&t.every(e=>"getFile"in e&&typeof e.getFile=="function")?lii(t):[]})}function aii(t){return NDe(t)}function sii(t){return NDe(t)&&NDe(t.target)}function NDe(t){return typeof t=="object"&&t!==null}function uii(t){return pgt(t.target.files).map(e=>VJ(e))}function lii(t){return tU(this,void 0,void 0,function*(){return(yield Promise.all(t.map(r=>r.getFile()))).map(r=>VJ(r))})}function cii(t,e){return tU(this,void 0,void 0,function*(){if(t.items){let r=pgt(t.items).filter(o=>o.kind==="file");if(e!=="drop")return r;let n=yield Promise.all(r.map(dii));return aWr(uWr(n))}return aWr(pgt(t.files).map(r=>VJ(r)))})}function aWr(t){return t.filter(e=>iii.indexOf(e.name)===-1)}function pgt(t){if(t===null)return[];let e=[];for(let r=0;r<t.length;r++){let n=t[r];e.push(n)}return e}function dii(t){if(typeof t.webkitGetAsEntry!="function")return sWr(t);let e=t.webkitGetAsEntry();return e&&e.isDirectory?lWr(e):sWr(t,e)}function uWr(t){return t.reduce((e,r)=>[...e,...Array.isArray(r)?uWr(r):[r]],[])}function sWr(t,e){return tU(this,void 0,void 0,function*(){var r;if(globalThis.isSecureContext&&typeof t.getAsFileSystemHandle=="function"){let i=yield t.getAsFileSystemHandle();if(i===null)throw new Error(`${t} is not a File`);if(i!==void 0){let a=yield i.getFile();return a.handle=i,VJ(a)}}let n=t.getAsFile();if(!n)throw new Error(`${t} is not a File`);return VJ(n,(r=e?.fullPath)!==null&&r!==void 0?r:void 0)})}function fii(t){return tU(this,void 0,void 0,function*(){return t.isDirectory?lWr(t):pii(t)})}function lWr(t){let e=t.createReader();return new Promise((r,n)=>{let o=[];function i(){e.readEntries(a=>tU(this,void 0,void 0,function*(){if(a.length){let s=Promise.all(a.map(fii));o.push(s),i()}else try{let s=yield Promise.all(o);r(s)}catch(s){n(s)}}),a=>{n(a)})}i()})}function pii(t){return tU(this,void 0,void 0,function*(){return new Promise((e,r)=>{t.file(n=>{let o=VJ(n,t.fullPath);e(o)},n=>{r(n)})})})}var jDe=L(cWr());function dWr(t){return gii(t)||hii(t)||yWr(t)||mii()}function mii(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hii(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function gii(t){if(Array.isArray(t))return ggt(t)}function fWr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function pWr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?fWr(Object(r),!0).forEach(function(n){gWr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fWr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function gWr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qce(t,e){return _ii(t)||bii(t,e)||yWr(t,e)||yii()}function yii(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yWr(t,e){if(t){if(typeof t=="string")return ggt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ggt(t,e)}}function ggt(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function bii(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,s;try{for(r=r.call(t);!(o=(a=r.next()).done)&&(n.push(a.value),!(e&&n.length===e));o=!0);}catch(u){i=!0,s=u}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function _ii(t){if(Array.isArray(t))return t}var vii=typeof jDe.default=="function"?jDe.default:jDe.default.default,wii="file-invalid-type",Sii="file-too-large",Cii="file-too-small",xii="too-many-files";var Oii=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",r=e.split(","),n=r.length>1?"one of ".concat(r.join(", ")):r[0];return{code:wii,message:"File type must be ".concat(n)}},mWr=function(e){return{code:Sii,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},hWr=function(e){return{code:Cii,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},bWr={code:xii,message:"Too many files"};function ygt(t,e){var r=t.type==="application/x-moz-file"||vii(t,e);return[r,r?null:Oii(e)]}function bgt(t,e,r){if(JJ(t.size))if(JJ(e)&&JJ(r)){if(t.size>r)return[!1,mWr(r)];if(t.size<e)return[!1,hWr(e)]}else{if(JJ(e)&&t.size<e)return[!1,hWr(e)];if(JJ(r)&&t.size>r)return[!1,mWr(r)]}return[!0,null]}function JJ(t){return t!=null}function _Wr(t){var e=t.files,r=t.accept,n=t.minSize,o=t.maxSize,i=t.multiple,a=t.maxFiles,s=t.validator;return!i&&e.length>1||i&&a>=1&&e.length>a?!1:e.every(function(u){var l=ygt(u,r),c=qce(l,1),d=c[0],f=bgt(u,n,o),p=qce(f,1),m=p[0],h=s?s(u):null;return d&&m&&!h})}function Bce(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function Uce(t){return t.dataTransfer?Array.prototype.some.call(t.dataTransfer.types,function(e){return e==="Files"||e==="application/x-moz-file"}):!!t.target&&!!t.target.files}function _gt(t){t.preventDefault()}function Tii(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function Eii(t){return t.indexOf("Edge/")!==-1}function vWr(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Tii(t)||Eii(t)}function Nx(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(n){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return e.some(function(s){return!Bce(n)&&s&&s.apply(void 0,[n].concat(i)),Bce(n)})}}function wWr(){return"showOpenFilePicker"in window}function SWr(t){if(JJ(t)){var e=Object.entries(t).filter(function(r){var n=qce(r,2),o=n[0],i=n[1],a=!0;return TWr(o)||(console.warn('Skipped "'.concat(o,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),a=!1),(!Array.isArray(i)||!i.every(EWr))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),a=!1),a}).reduce(function(r,n){var o=qce(n,2),i=o[0],a=o[1];return pWr(pWr({},r),{},gWr({},i,a))},{});return[{description:"Files",accept:e}]}return t}function CWr(t){if(JJ(t))return Object.entries(t).reduce(function(e,r){var n=qce(r,2),o=n[0],i=n[1];return[].concat(dWr(e),[o],dWr(i))},[]).filter(function(e){return TWr(e)||EWr(e)}).join(",")}function xWr(t){return t instanceof DOMException&&(t.name==="AbortError"||t.code===t.ABORT_ERR)}function OWr(t){return t instanceof DOMException&&(t.name==="SecurityError"||t.code===t.SECURITY_ERR)}function TWr(t){return t==="audio/*"||t==="video/*"||t==="image/*"||t==="text/*"||t==="application/*"||/\w+\/[-+.\w]+/g.test(t)}function EWr(t){return/^.*\.[\w]+$/.test(t)}var Pii=["children"],Mii=["open"],Rii=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],Aii=["refKey","onChange","onClick"];function Iii(t){return Dii(t)||jii(t)||RWr(t)||Nii()}function Nii(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jii(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Dii(t){if(Array.isArray(t))return wgt(t)}function vgt(t,e){return Fii(t)||Lii(t,e)||RWr(t,e)||$ii()}function $ii(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RWr(t,e){if(t){if(typeof t=="string")return wgt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wgt(t,e)}}function wgt(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Lii(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,s;try{for(r=r.call(t);!(o=(a=r.next()).done)&&(n.push(a.value),!(e&&n.length===e));o=!0);}catch(u){i=!0,s=u}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw s}}return n}}function Fii(t){if(Array.isArray(t))return t}function PWr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function wc(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?PWr(Object(r),!0).forEach(function(n){Sgt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):PWr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Sgt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function DDe(t,e){if(t==null)return{};var r=kii(t,e),n,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)n=i[o],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function kii(t,e){if(t==null)return{};var r={},n=Object.keys(t),o,i;for(i=0;i<n.length;i++)o=n[i],!(e.indexOf(o)>=0)&&(r[o]=t[o]);return r}var xgt=(0,fi.forwardRef)(function(t,e){var r=t.children,n=DDe(t,Pii),o=Ogt(n),i=o.open,a=DDe(o,Mii);return(0,fi.useImperativeHandle)(e,function(){return{open:i}},[i]),fi.default.createElement(fi.Fragment,null,r(wc(wc({},a),{},{open:i})))});xgt.displayName="Dropzone";var AWr={disabled:!1,getFilesFromEvent:mgt,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};xgt.defaultProps=AWr;xgt.propTypes={children:yu.default.func,accept:yu.default.objectOf(yu.default.arrayOf(yu.default.string)),multiple:yu.default.bool,preventDropOnDocument:yu.default.bool,noClick:yu.default.bool,noKeyboard:yu.default.bool,noDrag:yu.default.bool,noDragEventsBubbling:yu.default.bool,minSize:yu.default.number,maxSize:yu.default.number,maxFiles:yu.default.number,disabled:yu.default.bool,getFilesFromEvent:yu.default.func,onFileDialogCancel:yu.default.func,onFileDialogOpen:yu.default.func,useFsAccessApi:yu.default.bool,autoFocus:yu.default.bool,onDragEnter:yu.default.func,onDragLeave:yu.default.func,onDragOver:yu.default.func,onDrop:yu.default.func,onDropAccepted:yu.default.func,onDropRejected:yu.default.func,onError:yu.default.func,validator:yu.default.func};var Cgt={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Ogt(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=wc(wc({},AWr),t),r=e.accept,n=e.disabled,o=e.getFilesFromEvent,i=e.maxSize,a=e.minSize,s=e.multiple,u=e.maxFiles,l=e.onDragEnter,c=e.onDragLeave,d=e.onDragOver,f=e.onDrop,p=e.onDropAccepted,m=e.onDropRejected,h=e.onFileDialogCancel,g=e.onFileDialogOpen,y=e.useFsAccessApi,b=e.autoFocus,_=e.preventDropOnDocument,w=e.noClick,x=e.noKeyboard,O=e.noDrag,E=e.noDragEventsBubbling,T=e.onError,R=e.validator,N=(0,fi.useMemo)(function(){return CWr(r)},[r]),D=(0,fi.useMemo)(function(){return SWr(r)},[r]),F=(0,fi.useMemo)(function(){return typeof g=="function"?g:MWr},[g]),B=(0,fi.useMemo)(function(){return typeof h=="function"?h:MWr},[h]),U=(0,fi.useRef)(null),H=(0,fi.useRef)(null),G=(0,fi.useReducer)(qii,Cgt),ie=vgt(G,2),oe=ie[0],z=ie[1],Q=oe.isFocused,re=oe.isFileDialogActive,Z=(0,fi.useRef)(typeof window<"u"&&window.isSecureContext&&y&&wWr()),$=function(){!Z.current&&re&&setTimeout(function(){if(H.current){var Ce=H.current.files;Ce.length||(z({type:"closeDialog"}),B())}},300)};(0,fi.useEffect)(function(){return window.addEventListener("focus",$,!1),function(){window.removeEventListener("focus",$,!1)}},[H,re,B,Z]);var q=(0,fi.useRef)([]),Y=function(Ce){U.current&&U.current.contains(Ce.target)||(Ce.preventDefault(),q.current=[])};(0,fi.useEffect)(function(){return _&&(document.addEventListener("dragover",_gt,!1),document.addEventListener("drop",Y,!1)),function(){_&&(document.removeEventListener("dragover",_gt),document.removeEventListener("drop",Y))}},[U,_]),(0,fi.useEffect)(function(){return!n&&b&&U.current&&U.current.focus(),function(){}},[U,b,n]);var j=(0,fi.useCallback)(function(Te){T?T(Te):console.error(Te)},[T]),A=(0,fi.useCallback)(function(Te){Te.preventDefault(),Te.persist(),Fe(Te),q.current=[].concat(Iii(q.current),[Te.target]),Uce(Te)&&Promise.resolve(o(Te)).then(function(Ce){if(!(Bce(Te)&&!E)){var De=Ce.length,Re=De>0&&_Wr({files:Ce,accept:N,minSize:a,maxSize:i,multiple:s,maxFiles:u,validator:R}),nt=De>0&&!Re;z({isDragAccept:Re,isDragReject:nt,isDragActive:!0,type:"setDraggedFiles"}),l&&l(Te)}}).catch(function(Ce){return j(Ce)})},[o,l,j,E,N,a,i,s,u,R]),W=(0,fi.useCallback)(function(Te){Te.preventDefault(),Te.persist(),Fe(Te);var Ce=Uce(Te);if(Ce&&Te.dataTransfer)try{Te.dataTransfer.dropEffect="copy"}catch{}return Ce&&d&&d(Te),!1},[d,E]),V=(0,fi.useCallback)(function(Te){Te.preventDefault(),Te.persist(),Fe(Te);var Ce=q.current.filter(function(Re){return U.current&&U.current.contains(Re)}),De=Ce.indexOf(Te.target);De!==-1&&Ce.splice(De,1),q.current=Ce,!(Ce.length>0)&&(z({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Uce(Te)&&c&&c(Te))},[U,c,E]),se=(0,fi.useCallback)(function(Te,Ce){var De=[],Re=[];Te.forEach(function(nt){var _n=ygt(nt,N),He=vgt(_n,2),wt=He[0],_r=He[1],Sl=bgt(nt,a,i),Vo=vgt(Sl,2),Su=Vo[0],Wa=Vo[1],zy=R?R(nt):null;if(wt&&Su&&!zy)De.push(nt);else{var ui=[_r,Wa];zy&&(ui=ui.concat(zy)),Re.push({file:nt,errors:ui.filter(function(mv){return mv})})}}),(!s&&De.length>1||s&&u>=1&&De.length>u)&&(De.forEach(function(nt){Re.push({file:nt,errors:[bWr]})}),De.splice(0)),z({acceptedFiles:De,fileRejections:Re,isDragReject:Re.length>0,type:"setFiles"}),f&&f(De,Re,Ce),Re.length>0&&m&&m(Re,Ce),De.length>0&&p&&p(De,Ce)},[z,s,N,a,i,u,f,p,m,R]),be=(0,fi.useCallback)(function(Te){Te.preventDefault(),Te.persist(),Fe(Te),q.current=[],Uce(Te)&&Promise.resolve(o(Te)).then(function(Ce){Bce(Te)&&!E||se(Ce,Te)}).catch(function(Ce){return j(Ce)}),z({type:"reset"})},[o,se,j,E]),Ee=(0,fi.useCallback)(function(){if(Z.current){z({type:"openDialog"}),F();var Te={multiple:s,types:D};window.showOpenFilePicker(Te).then(function(Ce){return o(Ce)}).then(function(Ce){se(Ce,null),z({type:"closeDialog"})}).catch(function(Ce){xWr(Ce)?(B(Ce),z({type:"closeDialog"})):OWr(Ce)?(Z.current=!1,H.current?(H.current.value=null,H.current.click()):j(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):j(Ce)});return}H.current&&(z({type:"openDialog"}),F(),H.current.value=null,H.current.click())},[z,F,B,y,se,j,D,s]),Ae=(0,fi.useCallback)(function(Te){!U.current||!U.current.isEqualNode(Te.target)||(Te.key===" "||Te.key==="Enter"||Te.keyCode===32||Te.keyCode===13)&&(Te.preventDefault(),Ee())},[U,Ee]),ht=(0,fi.useCallback)(function(){z({type:"focus"})},[]),Rt=(0,fi.useCallback)(function(){z({type:"blur"})},[]),Ze=(0,fi.useCallback)(function(){w||(vWr()?setTimeout(Ee,0):Ee())},[w,Ee]),Dr=function(Ce){return n?null:Ce},Vt=function(Ce){return x?null:Dr(Ce)},jt=function(Ce){return O?null:Dr(Ce)},Fe=function(Ce){E&&Ce.stopPropagation()},hn=(0,fi.useMemo)(function(){return function(){var Te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ce=Te.refKey,De=Ce===void 0?"ref":Ce,Re=Te.role,nt=Te.onKeyDown,_n=Te.onFocus,He=Te.onBlur,wt=Te.onClick,_r=Te.onDragEnter,Sl=Te.onDragOver,Vo=Te.onDragLeave,Su=Te.onDrop,Wa=DDe(Te,Rii);return wc(wc(Sgt({onKeyDown:Vt(Nx(nt,Ae)),onFocus:Vt(Nx(_n,ht)),onBlur:Vt(Nx(He,Rt)),onClick:Dr(Nx(wt,Ze)),onDragEnter:jt(Nx(_r,A)),onDragOver:jt(Nx(Sl,W)),onDragLeave:jt(Nx(Vo,V)),onDrop:jt(Nx(Su,be)),role:typeof Re=="string"&&Re!==""?Re:"presentation"},De,U),!n&&!x?{tabIndex:0}:{}),Wa)}},[U,Ae,ht,Rt,Ze,A,W,V,be,x,O,n]),gt=(0,fi.useCallback)(function(Te){Te.stopPropagation()},[]),qe=(0,fi.useMemo)(function(){return function(){var Te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},Ce=Te.refKey,De=Ce===void 0?"ref":Ce,Re=Te.onChange,nt=Te.onClick,_n=DDe(Te,Aii),He=Sgt({accept:N,multiple:s,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:Dr(Nx(Re,be)),onClick:Dr(Nx(nt,gt)),tabIndex:-1},De,H);return wc(wc({},He),_n)}},[H,r,s,be,n]);return wc(wc({},oe),{},{isFocused:Q&&!n,getRootProps:hn,getInputProps:qe,rootRef:U,inputRef:H,open:Dr(Ee)})}function qii(t,e){switch(e.type){case"focus":return wc(wc({},t),{},{isFocused:!0});case"blur":return wc(wc({},t),{},{isFocused:!1});case"openDialog":return wc(wc({},Cgt),{},{isFileDialogActive:!0});case"closeDialog":return wc(wc({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return wc(wc({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return wc(wc({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return wc({},Cgt);default:return t}}function MWr(){}var Xyt={};Xn(Xyt,{$addUpdateTag:()=>UGr,$applyNodeReplacement:()=>fde,$caretFromPoint:()=>dU,$caretRangeFromSelection:()=>dyt,$cloneWithProperties:()=>GGr,$comparePointCaretNext:()=>Wyt,$copyNode:()=>Uyt,$create:()=>ysi,$createLineBreakNode:()=>JZ,$createNodeSelection:()=>Pyt,$createParagraphNode:()=>b$,$createPoint:()=>Fx,$createRangeSelection:()=>_Gr,$createRangeSelectionFromDom:()=>Bai,$createTabNode:()=>p$e,$createTextNode:()=>$h,$extendCaretToRange:()=>Jyt,$getAdjacentChildCaret:()=>tX,$getAdjacentNode:()=>qGr,$getAdjacentSiblingOrParentSiblingCaret:()=>Osi,$getCaretInDirection:()=>fU,$getCaretRange:()=>cU,$getCaretRangeInDirection:()=>Zyt,$getCharacterOffsets:()=>nyt,$getChildCaret:()=>w$,$getChildCaretAtIndex:()=>n9r,$getChildCaretOrSelf:()=>YGr,$getCollapsedCaretRange:()=>QGr,$getCommonAncestor:()=>Zce,$getCommonAncestorResultBranchOrder:()=>Gyt,$getEditor:()=>zyt,$getNearestNodeFromDOMNode:()=>_$e,$getNearestRootOrShadowRoot:()=>HGr,$getNodeByKey:()=>Jm,$getNodeByKeyOrThrow:()=>VGr,$getPreviousSelection:()=>n3,$getRoot:()=>lv,$getSelection:()=>Ns,$getSiblingCaret:()=>Bh,$getState:()=>WDe,$getStateChange:()=>hai,$getTextContent:()=>Hai,$getTextNodeOffset:()=>Lx,$getTextPointCaret:()=>lU,$getTextPointCaretSlice:()=>lyt,$getWritableNodeState:()=>_yt,$hasAncestor:()=>u$e,$hasUpdateTag:()=>dsi,$insertNodes:()=>zai,$isBlockElementNode:()=>qai,$isChildCaret:()=>$x,$isDecoratorNode:()=>Lu,$isElementNode:()=>Je,$isExtendableTextPointCaret:()=>r9r,$isInlineElementOrDecoratorNode:()=>fsi,$isLeafNode:()=>usi,$isLineBreakNode:()=>GJ,$isNodeCaret:()=>vsi,$isNodeSelection:()=>m$e,$isParagraphNode:()=>Qai,$isRangeSelection:()=>nn,$isRootNode:()=>sv,$isRootOrShadowRoot:()=>kx,$isSiblingCaret:()=>r3,$isTabNode:()=>Eyt,$isTextNode:()=>xr,$isTextPointCaret:()=>_$,$isTextPointCaretSlice:()=>xsi,$isTokenOrSegmented:()=>m$,$isTokenOrTab:()=>oU,$nodesOfType:()=>csi,$normalizeCaret:()=>jx,$normalizeSelection__EXPERIMENTAL:()=>GDe,$onUpdate:()=>zGr,$parseSerializedNode:()=>Kai,$removeTextFromCaretRange:()=>t9r,$rewindSiblingCaret:()=>iX,$selectAll:()=>lsi,$setCompositionKey:()=>Fh,$setPointFromCaret:()=>rX,$setSelection:()=>cv,$setSelectionFromCaretRange:()=>e9r,$setState:()=>gai,$splitAtPointCaretNext:()=>Psi,$splitNode:()=>psi,$updateRangeSelectionFromCaretRange:()=>Xce,ArtificialNode__DO_NOT_USE:()=>i$e,BLUR_COMMAND:()=>oGr,CAN_REDO_COMMAND:()=>Pai,CAN_UNDO_COMMAND:()=>Mai,CLEAR_EDITOR_COMMAND:()=>Tai,CLEAR_HISTORY_COMMAND:()=>Eai,CLICK_COMMAND:()=>q8r,COLLABORATION_TAG:()=>TGr,COMMAND_PRIORITY_CRITICAL:()=>osi,COMMAND_PRIORITY_EDITOR:()=>esi,COMMAND_PRIORITY_HIGH:()=>nsi,COMMAND_PRIORITY_LOW:()=>tsi,COMMAND_PRIORITY_NORMAL:()=>rsi,CONTROLLED_TEXT_INSERTION_COMMAND:()=>qZ,COPY_COMMAND:()=>xyt,CUT_COMMAND:()=>Oyt,DELETE_CHARACTER_COMMAND:()=>ode,DELETE_LINE_COMMAND:()=>ade,DELETE_WORD_COMMAND:()=>ide,DRAGEND_COMMAND:()=>rGr,DRAGOVER_COMMAND:()=>tGr,DRAGSTART_COMMAND:()=>eGr,DROP_COMMAND:()=>Q8r,DecoratorNode:()=>sde,ElementNode:()=>uU,FOCUS_COMMAND:()=>nGr,FORMAT_ELEMENT_COMMAND:()=>Oai,FORMAT_TEXT_COMMAND:()=>rU,HISTORIC_TAG:()=>Wai,HISTORY_MERGE_TAG:()=>HDe,HISTORY_PUSH_TAG:()=>Gai,INDENT_CONTENT_COMMAND:()=>Cai,INSERT_LINE_BREAK_COMMAND:()=>Jce,INSERT_PARAGRAPH_COMMAND:()=>Wgt,INSERT_TAB_COMMAND:()=>Sai,INTERNAL_$isBlock:()=>y$,IS_ALL_FORMATTING:()=>O8r,IS_BOLD:()=>Zii,IS_CODE:()=>Yii,IS_HIGHLIGHT:()=>c$e,IS_ITALIC:()=>Xii,IS_STRIKETHROUGH:()=>Qce,IS_SUBSCRIPT:()=>Qii,IS_SUPERSCRIPT:()=>eai,IS_UNDERLINE:()=>ede,KEY_ARROW_DOWN_COMMAND:()=>K8r,KEY_ARROW_LEFT_COMMAND:()=>H8r,KEY_ARROW_RIGHT_COMMAND:()=>U8r,KEY_ARROW_UP_COMMAND:()=>J8r,KEY_BACKSPACE_COMMAND:()=>G8r,KEY_DELETE_COMMAND:()=>X8r,KEY_DOWN_COMMAND:()=>B8r,KEY_ENTER_COMMAND:()=>QDe,KEY_ESCAPE_COMMAND:()=>Z8r,KEY_MODIFIER_COMMAND:()=>iGr,KEY_SPACE_COMMAND:()=>W8r,KEY_TAB_COMMAND:()=>Y8r,LineBreakNode:()=>VZ,MOVE_TO_END:()=>z8r,MOVE_TO_START:()=>V8r,NODE_STATE_KEY:()=>uai,OUTDENT_CONTENT_COMMAND:()=>xai,PASTE_COMMAND:()=>wyt,PASTE_TAG:()=>Zai,ParagraphNode:()=>GZ,REDO_COMMAND:()=>Cyt,REMOVE_TEXT_COMMAND:()=>Ggt,RootNode:()=>WZ,SELECTION_CHANGE_COMMAND:()=>vyt,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:()=>wai,SELECT_ALL_COMMAND:()=>Zgt,SKIP_COLLAB_TAG:()=>Xai,SKIP_DOM_SELECTION_TAG:()=>PGr,SKIP_SCROLL_INTO_VIEW_TAG:()=>EGr,TEXT_TYPE_TO_FORMAT:()=>Ly,TabNode:()=>KZ,TextNode:()=>QJ,UNDO_COMMAND:()=>Syt,buildImportMap:()=>Iai,createCommand:()=>wo,createEditor:()=>isi,createSharedNodeState:()=>I8r,createState:()=>mai,flipDirection:()=>pU,getDOMOwnerDocument:()=>qyt,getDOMSelection:()=>LI,getDOMSelectionFromTarget:()=>JGr,getDOMTextNode:()=>t3,getEditorPropertyFromDOMNode:()=>cde,getNearestEditorFromDOMNode:()=>Dyt,getRegisteredNode:()=>Nyt,getRegisteredNodeOrThrow:()=>Iyt,isBlockDomNode:()=>syt,isCurrentlyReadOnlyMode:()=>nX,isDOMDocumentNode:()=>AGr,isDOMNode:()=>oX,isDOMTextNode:()=>FI,isDOMUnmanaged:()=>XGr,isDocumentFragment:()=>KGr,isExactShortcutMatch:()=>Gs,isHTMLAnchorElement:()=>msi,isHTMLElement:()=>kb,isInlineDomNode:()=>WGr,isLexicalEditor:()=>y$e,isModifierMatch:()=>kGr,isSelectionCapturedInDecoratorInput:()=>jyt,isSelectionWithinEditor:()=>lde,makeStepwiseIterator:()=>Kyt,removeFromParent:()=>iU,resetRandomKey:()=>asi,setDOMUnmanaged:()=>gsi,setNodeIndentFromDOM:()=>ZGr});function We(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,Bii=qx&&"documentMode"in document?document.documentMode:null,$I=qx&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ZJ=qx&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),VDe=!(!qx||!("InputEvent"in window)||Bii)&&"getTargetRanges"in new window.InputEvent("input"),Yce=qx&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),zZ=qx&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Uii=qx&&/Android/.test(navigator.userAgent),C8r=qx&&/^(?=.*Chrome).*/i.test(navigator.userAgent),IWr=qx&&Uii&&C8r,JDe=qx&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!C8r;function KDe(...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 zii=1,Hii=3,Vii=9,Jii=11,XJ=0,x8r=1,HZ=2,Kii=0,Wii=1,Gii=2,Zii=1,Xii=2,Qce=4,ede=8,Yii=16,Qii=32,eai=64,c$e=128,O8r=1792|(112|(3|Qce|ede)|c$e),fyt=1,pyt=2,myt=3,hyt=4,gyt=5,yyt=6,d$e=Yce||zZ||JDe?"\xA0":"\u200B",v$=`
|
||
|
||
`,tai=ZJ?"\xA0":d$e,T8r="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",E8r="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",rai=new RegExp("^[^"+E8r+"]*["+T8r+"]"),nai=new RegExp("^[^"+T8r+"]*["+E8r+"]"),Ly={bold:1,capitalize:1024,code:16,highlight:c$e,italic:2,lowercase:256,strikethrough:Qce,subscript:32,superscript:64,underline:ede,uppercase:512},oai={directionless:1,unmergeable:2},NWr={center:pyt,end:yyt,justify:hyt,left:fyt,right:myt,start:gyt},iai={[pyt]:"center",[yyt]:"end",[hyt]:"justify",[fyt]:"left",[myt]:"right",[gyt]:"start"},aai={normal:0,segmented:2,token:1},sai={[Kii]:"normal",[Gii]:"segmented",[Wii]:"token"},uai="$",jWr="$config";function P8r(t,e,r,n,o,i){let a=t.getFirstChild();for(;a!==null;){let s=a.__key;a.__parent===e&&(Je(a)&&P8r(a,s,r,n,o,i),r.has(s)||i.delete(s),o.push(s)),a=a.getNextSibling()}}var lai=100,kgt=!1,byt=0;function cai(t){byt=t.timeStamp}function Tgt(t,e,r){let n=t.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(t===o||n&&t.previousSibling===o)||n&&b$e(t,r)!==void 0}function dai(t,e,r){let n=LI(P0(r)),o=null,i=null;n!==null&&n.anchorNode===t&&(o=n.anchorOffset,i=n.focusOffset);let a=t.nodeValue;a!==null&&Fyt(e,a,o,i,!1)}function fai(t,e,r){if(nn(t)){let n=t.anchor.getNode();if(n.is(r)&&t.format!==n.getFormat())return!1}return FI(e)&&r.isAttached()}function pai(t,e,r,n){for(let o=t;o&&!XGr(o);o=dde(o)){let i=b$e(o,e);if(i!==void 0){let a=Jm(i,r);if(a)return Lu(a)||!kb(o)?void 0:[o,a]}else if(o===n)return[n,DGr(r)]}}function M8r(t,e,r){kgt=!0;let n=performance.now()-byt>lai;try{vw(t,()=>{let o=Ns()||function(f){return f.getEditorState().read(()=>{let p=Ns();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,g=pai(h,t,s,a);if(!g)continue;let[y,b]=g;if(m==="characterData")n&&xr(b)&&FI(h)&&fai(o,h,b)&&dai(h,b,t);else if(m==="childList"){l=!0;let _=p.addedNodes;for(let O=0;O<_.length;O++){let E=_[O],T=NGr(E),R=E.parentNode;if(R!=null&&E!==u&&T===null&&!Tgt(E,R,t)){if(ZJ){let N=(kb(E)?E.innerText:null)||E.nodeValue;N&&(c+=N)}R.removeChild(E)}}let w=p.removedNodes,x=w.length;if(x>0){let O=0;for(let E=0;E<x;E++){let T=w[E];(Tgt(T,h,t)||u===T)&&(h.appendChild(T),O++)}x!==O&&i.set(y,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 g=0;g<m.length;g++){let y=m[g],b=y.parentNode;b==null||y.nodeName!=="BR"||Tgt(y,h,t)||b.removeChild(y)}}r.takeRecords()}o!==null&&(l&&cv(o),ZJ&&BGr(t)&&o.insertRawText(c))})}finally{kgt=!1}}function R8r(t){let e=t._observer;e!==null&&M8r(t,e.takeRecords(),e)}function A8r(t){(function(e){byt===0&&P0(e).addEventListener("textInput",cai,!0)})(t),t._observer=new MutationObserver((e,r)=>{M8r(t,e,r)})}var qgt=class{constructor(e,r){this.key=e,this.parse=r.parse.bind(r),this.unparse=(r.unparse||yai).bind(r),this.isEqual=(r.isEqual||Object.is).bind(r),this.defaultValue=this.parse(void 0)}};function mai(t,e){return new qgt(t,e)}function WDe(t,e,r="latest"){let n=(r==="latest"?t.getLatest():t).__state;return n?n.getValue(e):e.defaultValue}function hai(t,e,r){let n=WDe(t,r,"direct"),o=WDe(e,r,"direct");return r.isEqual(n,o)?null:[n,o]}function gai(t,e,r){let n;if(Lh(),typeof r=="function"){let i=t.getLatest(),a=WDe(i,e);if(n=r(a),e.isEqual(a,n))return i}else n=r;let o=t.getWritable();return _yt(o).updateFromKnown(e,n),o}function I8r(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}=Hyt(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 Bgt=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 DWr(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=DWr(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 _yt(t){let e=t.getWritable(),r=e.__state?e.__state.getWritable(e):new Bgt(e,N8r(e));return e.__state=r,r}function N8r(t){return t.__state?t.__state.sharedNodeState:Iyt(zyt(),t.getType()).sharedNodeState}function DWr(t){if(t)for(let e in t)return t}function yai(t){return t}function $Wr(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 LWr(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 FWr(t,e){let r=t.__state;return r&&r.node===t?r.getWritable(e):r}function kWr(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&&$Wr(f,c,d)||d&&$Wr(f,d,c)||c&&LWr(f,c,d)||d&&LWr(f,d,c))}(u,l))}function qWr(t,e){let r=t.mergeWithSibling(e),n=Xl()._normalizedNodes;return n.add(t.__key),n.add(e.__key),r}function BWr(t){let e,r,n=t;if(n.__text!==""||!n.isSimpleText()||n.isUnmergeable()){for(;(e=n.getPreviousSibling())!==null&&xr(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(kWr(e,n)){n=qWr(e,n);break}break}e.remove()}for(;(r=n.getNextSibling())!==null&&xr(r)&&r.isSimpleText()&&!r.isUnmergeable();){if(r.__text!==""){if(kWr(n,r)){n=qWr(n,r);break}break}r.remove()}}else n.remove()}function GDe(t){return UWr(t.anchor),UWr(t.focus),t}function UWr(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),xr(n)){t.set(n.__key,o?n.getTextContentSize():0,"text",!0);break}if(!Je(n))break;t.set(n.__key,o?n.getChildrenSize():0,"element",!0)}}var aU,Fb,tde,f$e,Ugt,zgt,YJ,Dx,Hgt,rde,Vm="",Lb="",jI=null,DI="",h$="",j8r=!1,nde=!1,BDe=null;function ZDe(t,e){let r=YJ.get(t);if(e!==null){let n=Kgt(t);n.parentNode===e&&e.removeChild(n)}if(Dx.has(t)||Fb._keyToDOMMap.delete(t),Je(r)){let n=YDe(r,YJ);Vgt(n,0,n.length-1,null)}r!==void 0&&kyt(rde,tde,f$e,r,"destroyed")}function Vgt(t,e,r,n){let o=e;for(;o<=r;++o){let i=t[o];i!==void 0&&ZDe(i,n)}}function KJ(t,e){t.setProperty("text-align",e)}var bai="40px";function D8r(t,e){let r=aU.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")||bai;t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function $8r(t,e){let r=t.style;e===0?KJ(r,""):e===fyt?KJ(r,"left"):e===pyt?KJ(r,"center"):e===myt?KJ(r,"right"):e===hyt?KJ(r,"justify"):e===gyt?KJ(r,"start"):e===yyt&&KJ(r,"end")}function XDe(t,e){let r=Dx.get(t);r===void 0&&We(60);let n=r.createDOM(aU,Fb);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,Fb),xr(r)?n.setAttribute("data-lexical-text","true"):Lu(r)&&n.setAttribute("data-lexical-decorator","true"),Je(r)){let o=r.__indent,i=r.__size;if(o!==0&&D8r(n,o),i!==0){let s=i-1;(function(u,l,c,d){let f=Lb;Lb="",Jgt(u,c,0,l,c.getDOMSlot(d)),F8r(c,d),Lb=f})(YDe(r,Dx),s,r,n)}let a=r.__format;a!==0&&$8r(n,a),r.isInline()||L8r(null,r,n),v$e(r)&&(Vm+=v$,h$+=v$)}else{let o=r.getTextContent();if(Lu(r)){let i=r.decorate(Fb,aU);i!==null&&k8r(t,i),n.contentEditable="false"}else xr(r)&&(r.isDirectionless()||(Lb+=o));Vm+=o,h$+=o}return e!==null&&e.insertChild(n),kyt(rde,tde,f$e,r,"created"),n}function Jgt(t,e,r,n,o){let i=Vm;Vm="";let a=r;for(;a<=n;++a){XDe(t[a],o);let s=Dx.get(t[a]);s!==null&&xr(s)&&(jI===null&&(jI=s.getFormat()),DI===""&&(DI=s.getStyle()))}v$e(e)&&(Vm+=v$),o.element.__lexicalTextContent=Vm,Vm=i+Vm}function zWr(t,e){if(t){let r=t.__last;if(r){let n=e.get(r);if(n)return GJ(n)?"line-break":Lu(n)&&n.isInline()?"decorator":null}return"empty"}return null}function L8r(t,e,r){let n=zWr(t,YJ),o=zWr(e,Dx);n!==o&&e.getDOMSlot(r).setManagedLineBreak(o)}function F8r(t,e){let r=e.__lexicalDirTextContent||"",n=e.__lexicalDir||"";if(r!==Lb||n!==BDe){let o=Lb==="",i=o?BDe:function(a){return rai.test(a)?"rtl":nai.test(a)?"ltr":null}(Lb);if(i!==n){let a=e.classList,s=aU.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=KDe(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=KDe(l);l=s[i]=c}l!==void 0&&a.add(...l)}e.dir=i}nde||(t.getWritable().__dir=i)}BDe=i,e.__lexicalDirTextContent=Lb,e.__lexicalDir=i}}function _ai(t,e,r){let n=Lb;var o;Lb="",jI=null,DI="",function(i,a,s){let u=Vm,l=i.__size,c=a.__size;Vm="";let d=s.element;if(l===1&&c===1){let f=i.__first,p=a.__first;if(f===p)Vce(f,d);else{let h=Kgt(f),g=XDe(p,null);try{d.replaceChild(g,h)}catch(y){if(typeof y=="object"&&y!=null){let b=`${y.toString()} Parent: ${d.tagName}, new child: {tag: ${g.tagName} key: ${p}}, old child: {tag: ${h.tagName}, key: ${f}}.`;throw new Error(b)}throw y}ZDe(f,null)}let m=Dx.get(p);xr(m)&&(jI===null&&(jI=m.getFormat()),DI===""&&(DI=m.getStyle()))}else{let f=YDe(i,YJ),p=YDe(a,Dx);if(f.length!==l&&We(227),p.length!==c&&We(228),l===0)c!==0&&Jgt(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;Vgt(f,0,l-1,m?null:d),m&&(d.textContent="")}}else(function(m,h,g,y,b,_){let w=y-1,x=b-1,O,E,T=_.getFirstChild(),R=0,N=0;for(;R<=w&&N<=x;){let B=h[R],U=g[N];if(B===U)T=Egt(Vce(U,_.element)),R++,N++;else{O===void 0&&(O=new Set(h)),E===void 0&&(E=new Set(g));let G=E.has(B),ie=O.has(U);if(G)if(ie){let oe=XZ(Fb,U);oe===T?T=Egt(Vce(U,_.element)):(_.withBefore(T).insertChild(oe),Vce(U,_.element)),R++,N++}else XDe(U,_.withBefore(T)),N++;else T=Egt(Kgt(B)),ZDe(B,_.element),R++}let H=Dx.get(U);H!==null&&xr(H)&&(jI===null&&(jI=H.getFormat()),DI===""&&(DI=H.getStyle()))}let D=R>w,F=N>x;if(D&&!F){let B=g[x+1],U=B===void 0?null:Fb.getElementByKey(B);Jgt(g,m,N,x,_.withBefore(U))}else F&&!D&&Vgt(h,R,w,_.element)})(a,f,p,l,c,s)}v$e(a)&&(Vm+=v$),d.__lexicalTextContent=Vm,Vm=u+Vm}(t,e,e.getDOMSlot(r)),F8r(e,r),o=e,jI==null||jI===o.__textFormat||nde||o.setTextFormat(jI),function(i){DI===""||DI===i.__textStyle||nde||i.setTextStyle(DI)}(e),Lb=n}function YDe(t,e){let r=[],n=t.__first;for(;n!==null;){let o=e.get(n);o===void 0&&We(101),r.push(n),n=o.__next}return r}function Vce(t,e){let r=YJ.get(t),n=Dx.get(t);r!==void 0&&n!==void 0||We(61);let o=j8r||zgt.has(t)||Ugt.has(t),i=XZ(Fb,t);if(r===n&&!o){if(Je(r)){let a=i.__lexicalTextContent;a!==void 0&&(Vm+=a,h$+=a);let s=i.__lexicalDirTextContent;s!==void 0&&(Lb+=s)}else{let a=r.getTextContent();xr(r)&&!r.isDirectionless()&&(Lb+=a),h$+=a,Vm+=a}return i}if(r!==n&&o&&kyt(rde,tde,f$e,n,"updated"),n.updateDOM(r,i,aU)){let a=XDe(t,null);return e===null&&We(62),e.replaceChild(a,i),ZDe(t,null),a}if(Je(r)&&Je(n)){let a=n.__indent;a!==r.__indent&&D8r(i,a);let s=n.__format;s!==r.__format&&$8r(i,s),o&&(_ai(r,n,i),sv(n)||n.isInline()||L8r(r,n,i)),v$e(n)&&(Vm+=v$,h$+=v$)}else{let a=n.getTextContent();if(Lu(n)){let s=n.decorate(Fb,aU);s!==null&&k8r(t,s)}else xr(n)&&!n.isDirectionless()&&(Lb+=a);Vm+=a,h$+=a}if(!nde&&sv(n)&&n.__cachedText!==h$){let a=n.getWritable();a.__cachedText=h$,n=a}return i}function k8r(t,e){let r=Fb._pendingDecorators,n=Fb._decorators;if(r===null){if(n[t]===e)return;r=jGr(Fb)}r[t]=e}function Egt(t){let e=t.nextSibling;return e!==null&&e===Fb._blockCursorElement&&(e=e.nextSibling),e}function vai(t,e,r,n,o,i){Vm="",h$="",Lb="",j8r=n===HZ,BDe=null,Fb=r,aU=r._config,tde=r._nodes,f$e=Fb._listeners.mutation,Ugt=o,zgt=i,YJ=t._nodeMap,Dx=e._nodeMap,nde=e._readOnly,Hgt=new Map(r._keyToDOMMap);let a=new Map;return rde=a,Vce("root",null),Fb=void 0,tde=void 0,Ugt=void 0,zgt=void 0,YJ=void 0,Dx=void 0,aU=void 0,Hgt=void 0,rde=void 0,a}function Kgt(t){let e=Hgt.get(t);return e===void 0&&We(75,t),e}function wo(t){return{type:t}}var vyt=wo("SELECTION_CHANGE_COMMAND"),wai=wo("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),q8r=wo("CLICK_COMMAND"),ode=wo("DELETE_CHARACTER_COMMAND"),Jce=wo("INSERT_LINE_BREAK_COMMAND"),Wgt=wo("INSERT_PARAGRAPH_COMMAND"),qZ=wo("CONTROLLED_TEXT_INSERTION_COMMAND"),wyt=wo("PASTE_COMMAND"),Ggt=wo("REMOVE_TEXT_COMMAND"),ide=wo("DELETE_WORD_COMMAND"),ade=wo("DELETE_LINE_COMMAND"),rU=wo("FORMAT_TEXT_COMMAND"),Syt=wo("UNDO_COMMAND"),Cyt=wo("REDO_COMMAND"),B8r=wo("KEYDOWN_COMMAND"),U8r=wo("KEY_ARROW_RIGHT_COMMAND"),z8r=wo("MOVE_TO_END"),H8r=wo("KEY_ARROW_LEFT_COMMAND"),V8r=wo("MOVE_TO_START"),J8r=wo("KEY_ARROW_UP_COMMAND"),K8r=wo("KEY_ARROW_DOWN_COMMAND"),QDe=wo("KEY_ENTER_COMMAND"),W8r=wo("KEY_SPACE_COMMAND"),G8r=wo("KEY_BACKSPACE_COMMAND"),Z8r=wo("KEY_ESCAPE_COMMAND"),X8r=wo("KEY_DELETE_COMMAND"),Y8r=wo("KEY_TAB_COMMAND"),Sai=wo("INSERT_TAB_COMMAND"),Cai=wo("INDENT_CONTENT_COMMAND"),xai=wo("OUTDENT_CONTENT_COMMAND"),Q8r=wo("DROP_COMMAND"),Oai=wo("FORMAT_ELEMENT_COMMAND"),eGr=wo("DRAGSTART_COMMAND"),tGr=wo("DRAGOVER_COMMAND"),rGr=wo("DRAGEND_COMMAND"),xyt=wo("COPY_COMMAND"),Oyt=wo("CUT_COMMAND"),Zgt=wo("SELECT_ALL_COMMAND"),Tai=wo("CLEAR_EDITOR_COMMAND"),Eai=wo("CLEAR_HISTORY_COMMAND"),Pai=wo("CAN_REDO_COMMAND"),Mai=wo("CAN_UNDO_COMMAND"),nGr=wo("FOCUS_COMMAND"),oGr=wo("BLUR_COMMAND"),iGr=wo("KEY_MODIFIER_COMMAND"),d$=Object.freeze({}),Xgt=30,Ygt=[["keydown",function(t,e){if(Kce=t.timeStamp,aGr=t.key,!e.isComposing()&&!lr(e,B8r,t)&&t.key!=null){if(Pgt&&y8r(t))return vw(e,()=>{$De(e,Mgt)}),Pgt=!1,void(Mgt="");if(function(r){return Gs(r,"ArrowRight",{shiftKey:"any"})}(t))lr(e,U8r,t);else if(function(r){return Gs(r,"ArrowRight",p$)}(t))lr(e,z8r,t);else if(function(r){return Gs(r,"ArrowLeft",{shiftKey:"any"})}(t))lr(e,H8r,t);else if(function(r){return Gs(r,"ArrowLeft",p$)}(t))lr(e,V8r,t);else if(function(r){return Gs(r,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))lr(e,J8r,t);else if(function(r){return Gs(r,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))lr(e,K8r,t);else if(function(r){return Gs(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(t))Wce=!0,lr(e,QDe,t);else if(function(r){return r.key===" "}(t))lr(e,W8r,t);else if(function(r){return $I&&Gs(r,"o",{ctrlKey:!0})}(t))t.preventDefault(),Wce=!0,lr(e,Jce,!0);else if(function(r){return Gs(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))Wce=!1,lr(e,QDe,t);else if(function(r){return Gs(r,"Backspace",{shiftKey:"any"})||$I&&Gs(r,"h",{ctrlKey:!0})}(t))y8r(t)?lr(e,G8r,t):(t.preventDefault(),lr(e,ode,!0));else if(function(r){return r.key==="Escape"}(t))lr(e,Z8r,t);else if(function(r){return Gs(r,"Delete",{})||$I&&Gs(r,"d",{ctrlKey:!0})}(t))(function(r){return r.key==="Delete"})(t)?lr(e,X8r,t):(t.preventDefault(),lr(e,ode,!1));else if(function(r){return Gs(r,"Backspace",g8r)}(t))t.preventDefault(),lr(e,ide,!0);else if(function(r){return Gs(r,"Delete",g8r)}(t))t.preventDefault(),lr(e,ide,!1);else if(function(r){return $I&&Gs(r,"Backspace",{metaKey:!0})}(t))t.preventDefault(),lr(e,ade,!0);else if(function(r){return $I&&(Gs(r,"Delete",{metaKey:!0})||Gs(r,"k",{ctrlKey:!0}))}(t))t.preventDefault(),lr(e,ade,!1);else if(function(r){return Gs(r,"b",p$)}(t))t.preventDefault(),lr(e,rU,"bold");else if(function(r){return Gs(r,"u",p$)}(t))t.preventDefault(),lr(e,rU,"underline");else if(function(r){return Gs(r,"i",p$)}(t))t.preventDefault(),lr(e,rU,"italic");else if(function(r){return Gs(r,"Tab",{shiftKey:"any"})}(t))lr(e,Y8r,t);else if(function(r){return Gs(r,"z",p$)}(t))t.preventDefault(),lr(e,Syt,void 0);else if(function(r){return $I?Gs(r,"z",{metaKey:!0,shiftKey:!0}):Gs(r,"y",{ctrlKey:!0})||Gs(r,"z",{ctrlKey:!0,shiftKey:!0})}(t))t.preventDefault(),lr(e,Cyt,void 0);else{let r=e._editorState._selection;r===null||nn(r)?b8r(t)&&(t.preventDefault(),lr(e,Zgt,t)):function(n){return Gs(n,"c",p$)}(t)?(t.preventDefault(),lr(e,xyt,t)):function(n){return Gs(n,"x",p$)}(t)?(t.preventDefault(),lr(e,Oyt,t)):b8r(t)&&(t.preventDefault(),lr(e,Zgt,t))}(function(r){return r.ctrlKey||r.shiftKey||r.altKey||r.metaKey})(t)&&lr(e,iGr,t)}}],["pointerdown",function(t,e){let r=t.target,n=t.pointerType;oX(r)&&n!=="touch"&&n!=="pen"&&t.button===0&&vw(e,()=>{p8r(r)||(eyt=!0)})}],["compositionstart",function(t,e){vw(e,()=>{let r=Ns();if(nn(r)&&!e.isComposing()){let n=r.anchor,o=r.anchor.getNode();Fh(n.key),(t.timeStamp<Kce+Xgt||n.type==="element"||!r.isCollapsed()||o.getFormat()!==r.format||xr(o)&&o.getStyle()!==r.style)&&lr(e,qZ,tai)}})}],["compositionend",function(t,e){ZJ?zce=!0:zZ||!Yce&&!JDe?vw(e,()=>{$De(e,t.data)}):(Pgt=!0,Mgt=t.data)}],["input",function(t,e){t.stopPropagation(),vw(e,()=>{if(kb(t.target)&&p8r(t.target))return;let r=Ns(),n=t.data,o=dGr(t);if(n!=null&&nn(r)&&lGr(r,o,n,t.timeStamp,!1)){zce&&($De(e,n),zce=!1);let i=r.anchor.getNode(),a=LI(P0(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;VDe&&!r.isCollapsed()&&xr(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,u)+n+i.getTextContent().slice(u+l)===FGr(a.anchorNode)||lr(e,qZ,n);let c=n.length;ZJ&&c>1&&t.inputType==="insertCompositionText"&&!e.isComposing()&&(r.anchor.offset-=c),Yce||zZ||JDe||!e.isComposing()||(Kce=0,Fh(null))}else Lyt(!1,e,n!==null?n:void 0),zce&&($De(e,n||void 0),zce=!1);(function(){Lh();let i=Xl();R8r(i)})()},{event:t}),FZ=null}],["click",function(t,e){vw(e,()=>{let r=Ns(),n=LI(P0(e)),o=n3();if(n){if(nn(r)){let i=r.anchor,a=i.getNode();if(i.type==="element"&&i.offset===0&&r.isCollapsed()&&!sv(a)&&lv().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!==lv()&&c!=null;){if(l(c))return c;c=c.getParent()}return null}(a,u=>Je(u)&&!u.isInline());Je(s)&&s.select(0)}}else if(t.pointerType==="touch"||t.pointerType==="pen"){let i=n.anchorNode;(kb(i)||FI(i))&&cv(h$e(o,n,e,t))}}lr(e,q8r,t)})}],["cut",d$],["copy",d$],["dragstart",d$],["dragover",d$],["dragend",d$],["paste",d$],["focus",d$],["blur",d$],["drop",d$]];VDe&&Ygt.push(["beforeinput",(t,e)=>function(r,n){let o=r.inputType,i=dGr(r);o==="deleteCompositionText"||ZJ&&BGr(n)||o!=="insertCompositionText"&&vw(n,()=>{let a=Ns();if(o==="deleteContentBackward"){if(a===null){let p=n3();if(!nn(p))return;cv(p.clone())}if(nn(a)){let p=a.anchor.key===a.focus.key;if(s=r.timeStamp,aGr==="MediaLast"&&s<Kce+Xgt&&n.isComposing()&&p){if(Fh(null),Kce=0,setTimeout(()=>{vw(n,()=>{Fh(null)})},Xgt),nn(a)){let m=a.anchor.getNode();m.markDirty(),xr(m)||We(142),cGr(a,m)}}else{Fh(null),r.preventDefault();let m=a.anchor.getNode(),h=m.getTextContent(),g=m.canInsertTextAfter(),y=a.anchor.offset===0&&a.focus.offset===h.length,b=IWr&&p&&!y&&g;if(b&&a.isCollapsed()&&(b=!Lu(qGr(a.anchor,!0))),!b){lr(n,ode,!0);let _=Ns();IWr&&nn(_)&&_.isCollapsed()&&(WJ=_,setTimeout(()=>WJ=null))}}return}}var s;if(!nn(a))return;let u=r.data;FZ!==null&&Lyt(!1,n,FZ),a.dirty&&FZ===null||!a.isCollapsed()||sv(a.anchor.getNode())||i===null||a.applyDOMRange(i),FZ=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":lr(n,qZ,r);break;case"insertFromComposition":Fh(null),lr(n,qZ,r);break;case"insertLineBreak":Fh(null),lr(n,Jce,!1);break;case"insertParagraph":Fh(null),Wce&&!zZ?(Wce=!1,lr(n,Jce,!1)):lr(n,Wgt,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":lr(n,wyt,r);break;case"deleteByComposition":(function(p,m){return p!==m||Je(p)||Je(m)||!oU(p)||!oU(m)})(d,f)&&lr(n,Ggt,r);break;case"deleteByDrag":case"deleteByCut":lr(n,Ggt,r);break;case"deleteContent":lr(n,ode,!1);break;case"deleteWordBackward":lr(n,ide,!0);break;case"deleteWordForward":lr(n,ide,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":lr(n,ade,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":lr(n,ade,!1);break;case"formatStrikeThrough":lr(n,rU,"strikethrough");break;case"formatBold":lr(n,rU,"bold");break;case"formatItalic":lr(n,rU,"italic");break;case"formatUnderline":lr(n,rU,"underline");break;case"historyUndo":lr(n,Syt,void 0);break;case"historyRedo":lr(n,Cyt,void 0)}else{if(u===`
|
||
`)r.preventDefault(),lr(n,Jce,!1);else if(u===v$)r.preventDefault(),lr(n,Wgt,void 0);else if(u==null&&r.dataTransfer){let p=r.dataTransfer.getData("text/plain");r.preventDefault(),a.insertRawText(p)}else u!=null&&lGr(a,i,u,r.timeStamp,!0)?(r.preventDefault(),lr(n,qZ,u)):FZ=u;sGr=r.timeStamp}})}(t,e)]);var Kce=0,aGr=null,sGr=0,FZ=null,e$e=new WeakMap,Qgt=!1,eyt=!1,Wce=!1,zce=!1,Pgt=!1,Mgt="",WJ=null,uGr=[0,"",0,"root",0];function lGr(t,e,r,n,o){let i=t.anchor,a=t.focus,s=i.getNode(),u=Xl(),l=LI(P0(u)),c=l!==null?l.anchorNode:null,d=i.key,f=u.getElementByKey(d),p=r.length;return d!==a.key||!xr(s)||(!o&&(!VDe||sGr<n+50)||s.isDirty()&&p<2||$Gr(r))&&i.offset!==a.offset&&!s.isComposing()||m$(s)||s.isDirty()&&p>1||(o||!VDe)&&f!==null&&!s.isComposing()&&c!==t3(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 g=m.anchor.offset,y=h.getParentOrThrow(),b=oU(h);return g===0?!h.canInsertTextBefore()||!y.canInsertTextBefore()&&!h.isComposing()||b||function(_){let w=_.getPreviousSibling();return(xr(w)||Je(w)&&w.isInline())&&!w.canInsertTextAfter()}(h):g===h.getTextContentSize()&&(!h.canInsertTextAfter()||!y.canInsertTextAfter()&&!h.isComposing()||b)}(t,s)}function HWr(t,e){return FI(t)&&t.nodeValue!==null&&e!==0&&e!==t.nodeValue.length}function VWr(t,e,r){let{anchorNode:n,anchorOffset:o,focusNode:i,focusOffset:a}=t;Qgt&&(Qgt=!1,HWr(n,o)&&HWr(i,a)&&!WJ)||vw(e,()=>{if(!r)return void cv(null);if(!lde(e,n,i))return;let s=Ns();if(WJ&&nn(s)&&s.isCollapsed()){let u=s.anchor,l=WJ.anchor;(u.key===l.key&&u.offset===l.offset+1||u.offset===1&&l.getNode().is(u.getNode().getPreviousSibling()))&&(s=WJ.clone(),cv(s))}if(WJ=null,nn(s)){let u=s.anchor,l=u.getNode();if(s.isCollapsed()){t.type==="Range"&&t.anchorNode===t.focusNode&&(s.dirty=!0);let c=P0(e).event,d=c?c.timeStamp:performance.now(),[f,p,m,h,g]=uGr,y=lv(),b=e.isComposing()===!1&&y.getTextContent()==="";if(d<g+200&&u.offset===m&&u.key===h)UDe(s,f,p);else if(u.type==="text")xr(l)||We(141),cGr(s,l);else if(u.type==="element"&&!b){Je(l)||We(259);let _=u.getNode();_.isEmpty()?function(w,x){let O=x.getTextFormat(),E=x.getTextStyle();UDe(w,O,E)}(s,_):UDe(s,0,"")}}else{let c=u.key,d=s.focus.key,f=s.getNodes(),p=f.length,m=s.isBackward(),h=m?a:o,g=m?o:a,y=m?d:c,b=m?c:d,_=O8r,w=!1;for(let x=0;x<p;x++){let O=f[x],E=O.getTextContentSize();if(xr(O)&&E!==0&&!(x===0&&O.__key===y&&h===E||x===p-1&&O.__key===b&&g===0)&&(w=!0,_&=O.getFormat(),_===0))break}s.format=w?_:0}}lr(e,vyt,void 0)})}function UDe(t,e,r){t.format===e&&t.style===r||(t.format=e,t.style=r,t.dirty=!0)}function cGr(t,e){UDe(t,e.getFormat(),e.getStyle())}function dGr(t){if(!t.getTargetRanges)return null;let e=t.getTargetRanges();return e.length===0?null:e[0]}function $De(t,e){let r=t._compositionKey;if(Fh(null),r!==null&&e!=null){if(e===""){let n=Jm(r),o=t3(t.getElementByKey(r));return void(o!==null&&o.nodeValue!==null&&xr(n)&&Fyt(n,o.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
||
`){let n=Ns();if(nn(n)){let o=n.focus;return n.anchor.set(o.key,o.offset,o.type),void lr(t,QDe,null)}}}Lyt(!0,t,e)}function fGr(t){let e=t.__lexicalEventHandles;return e===void 0&&(e=[],t.__lexicalEventHandles=e),e}var BZ=new Map;function pGr(t){let e=JGr(t.target);if(e===null)return;let r=Dyt(e.anchorNode);if(r===null)return;eyt&&(eyt=!1,vw(r,()=>{let u=n3(),l=e.anchorNode;(kb(l)||FI(l))&&cv(h$e(u,e,r,t))}));let n=$yt(r),o=n[n.length-1],i=o._key,a=BZ.get(i),s=a||o;s!==r&&VWr(e,s,!1),VWr(e,r,!0),r!==o?BZ.set(i,r):a&&BZ.delete(i)}function JWr(t){t._lexicalHandled=!0}function KWr(t){return t._lexicalHandled===!0}var Rai=()=>{};function Aai(t){let e=t.ownerDocument,r=e$e.get(e);if(r===void 0)return void Rai();let n=r-1;n>=0||We(164),e$e.set(e,n),n===0&&e.removeEventListener("selectionchange",pGr);let o=cde(t);y$e(o)?(function(a){if(a._parentEditor!==null){let s=$yt(a),u=s[s.length-1]._key;BZ.get(u)===a&&BZ.delete(u)}else BZ.delete(a._key)}(o),t.__lexicalEditor=null):o&&We(198);let i=fGr(t);for(let a=0;a<i.length;a++)i[a]();t.__lexicalEventHandles=[]}function tyt(t,e,r){Lh();let n=t.__key,o=t.getParent();if(o===null)return;let i=function(s){let u=Ns();if(!nn(u)||!Je(s))return u;let{anchor:l,focus:c}=u,d=l.getNode(),f=c.getNode();return u$e(d,s)&&l.set(s.__key,0,"element"),u$e(f,s)&&c.set(s.__key,0,"element"),u}(t),a=!1;if(nn(i)&&e){let s=i.anchor,u=i.focus;s.key===n&&(n$e(s,t,o,t.getPreviousSibling(),t.getNextSibling()),a=!0),u.key===n&&(n$e(u,t,o,t.getPreviousSibling(),t.getNextSibling()),a=!0)}else m$e(i)&&e&&t.isSelected()&&t.selectPrevious();if(nn(i)&&e&&!a){let s=t.getIndexWithinParent();iU(t),r$e(i,o,s,-1)}else iU(t);r||kx(o)||o.canBeEmpty()||!o.isEmpty()||tyt(o,e),e&&i&&sv(o)&&o.isEmpty()&&o.selectEnd()}function Iai(t){return t}var sU=class{static getType(){let{ownNodeType:e}=Hyt(this);return e===void 0&&We(64,this.name),e}static clone(e){We(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}),IGr(this,e)}getType(){return this.__type}isInline(){We(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||Ns();if(r==null)return!1;let n=r.getNodes().some(o=>o.__key===this.__key);if(xr(this))return n;if(nn(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&&We(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let r=e.getParent();if(kx(r))return Je(e)||e===this&&Lu(e)||We(194),e;e=r}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&We(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=Je(this)?this:this.getParent(),n=Je(e)?e:e.getParent(),o=r&&n?Zce(r,n):null;return o?o.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let r=Zce(this,e);return r!==null&&(r.type==="descendant"||(r.type==="branch"?Gyt(r)===-1:(r.type!=="same"&&r.type!=="ancestor"&&We(279),!1)))}isParentOf(e){let r=Zce(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=Je(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&&We(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=Xl()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){let e=Jm(this.__key);return e===null&&We(113),e}getWritable(){Lh();let e=S$(),r=Xl(),n=e._nodeMap,o=this.__key,i=this.getLatest(),a=r._cloneNotNeeded,s=Ns();if(s!==null&&s.setCachedNodes(null),a.has(o))return s$e(i),i;let u=GGr(i);return a.add(o),s$e(u),n.set(o,u),u}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,r){We(70)}updateDOM(e,r,n){We(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){We(18,this.name)}updateFromJSON(e){return function(r,n){let o=r.getWritable(),i=n.$,a=i;for(let s of N8r(o).flatKeys)s in n&&(a!==void 0&&a!==i||(a={...i}),a[s]=n[s]);return(o.__state||a)&&_yt(r).updateFromJSON(a),o}(this,e)}static transform(){return null}remove(e){tyt(this,!0,e)}replace(e,r){Lh();let n=Ns();n!==null&&(n=n.clone()),Dgt(this,e);let o=this.getLatest(),i=this.__key,a=e.__key,s=e.getWritable(),u=this.getParentOrThrow().getWritable(),l=u.__size;iU(s);let c=o.getPreviousSibling(),d=o.getNextSibling(),f=o.__prev,p=o.__next,m=o.__parent;if(tyt(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&&(Je(this)&&Je(s)||We(139),this.getChildren().forEach(h=>{s.append(h)})),nn(n)){cv(n);let h=n.anchor,g=n.focus;h.key===i&&XWr(h,s),g.key===i&&XWr(g,s)}return nU()===i&&Fh(a),s}insertAfter(e,r=!0){Lh(),Dgt(this,e);let n=this.getWritable(),o=e.getWritable(),i=o.getParent(),a=Ns(),s=!1,u=!1;if(i!==null){let p=e.getIndexWithinParent();if(iU(o),nn(a)){let m=i.__key,h=a.anchor,g=a.focus;s=h.type==="element"&&h.key===m&&h.offset===p+1,u=g.type==="element"&&g.key===m&&g.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&&nn(a)){let p=this.getIndexWithinParent();r$e(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(),Dgt(this,e);let n=this.getWritable(),o=e.getWritable(),i=o.__key;iU(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=Ns();return r&&nn(c)&&r$e(c,this.getParentOrThrow(),l),e}isParentRequired(){return!1}createParentElementNode(){return b$()}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(Je(n))return n.select();if(!xr(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(Je(n))return n.select(0,0);if(!xr(n)){let i=n.getIndexWithinParent();return o.select(i,i)}return n.select(e,r)}markDirty(){this.getWritable()}reconcileObservedMutation(e,r){this.markDirty()}},VZ=class t extends sU{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&&syt(n)){let o=n.firstChild;if(o===r||o.nextSibling===r&&LDe(o)){let i=n.lastChild;if(i===r||i.previousSibling===r&&LDe(i))return!0}}return!1}(e)||function(r){let n=r.parentElement;if(n!==null&&syt(n)){let o=n.firstChild;if(o===r||o.nextSibling===r&&LDe(o))return!1;let i=n.lastChild;if(i===r||i.previousSibling===r&&LDe(i))return!0}return!1}(e)?null:{conversion:Nai,priority:0}}}static importJSON(e){return JZ().updateFromJSON(e)}};function Nai(t){return{node:JZ()}}function JZ(){return fde(new VZ)}function GJ(t){return t instanceof VZ}function LDe(t){return FI(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function Rgt(t,e){return 16&e?"code":e&c$e?"mark":32&e?"sub":64&e?"sup":null}function Agt(t,e){return 1&e?"strong":2&e?"em":"span"}function mGr(t,e,r,n,o){let i=n.classList,a=UZ(o,"base");a!==void 0&&i.add(...a),a=UZ(o,"underlineStrikethrough");let s=!1,u=e&ede&&e&Qce;a!==void 0&&(r&ede&&r&Qce?(s=!0,u||i.add(...a)):u&&i.remove(...a));for(let l in Ly){let c=Ly[l];if(a=UZ(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 hGr(t,e,r){let n=e.firstChild,o=r.isComposing(),i=t+(o?d$e:"");if(n==null)e.textContent=i;else{let a=n.nodeValue;if(a!==i)if(o||ZJ){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 WWr(t,e,r,n,o,i){hGr(o,t,e);let a=i.theme.text;a!==void 0&&mGr(0,0,n,t,a)}function FDe(t,e){let r=document.createElement(e);return r.appendChild(t),r}var QJ=class t extends sU{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 sai[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===nU()}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 a$e(this.getLatest().__format,e,r)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,r){let n=this.__format,o=Rgt(0,n),i=Agt(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)),WWr(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=Rgt(0,i),u=Rgt(0,a),l=Agt(0,i),c=Agt(0,a);if((s===null?l:s)!==(u===null?c:u))return!0;if(s===u&&l!==c){let h=r.firstChild;h==null&&We(48);let g=document.createElement(c);return WWr(g,this,0,a,o,n),r.replaceChild(g,h),!1}let d=r;u!==null&&s!==null&&(d=r.firstChild,d==null&&We(49)),hGr(o,d,this);let f=n.theme.text;f!==void 0&&i!==a&&mGr(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:Lai,priority:0}),b:()=>({conversion:Dai,priority:0}),code:()=>({conversion:f$,priority:0}),em:()=>({conversion:f$,priority:0}),i:()=>({conversion:f$,priority:0}),mark:()=>({conversion:f$,priority:0}),s:()=>({conversion:f$,priority:0}),span:()=>({conversion:jai,priority:0}),strong:()=>({conversion:f$,priority:0}),sub:()=>({conversion:f$,priority:0}),sup:()=>({conversion:f$,priority:0}),u:()=>({conversion:f$,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 kb(r)||We(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=FDe(r,"b")),this.hasFormat("italic")&&(r=FDe(r,"i")),this.hasFormat("strikethrough")&&(r=FDe(r,"s")),this.hasFormat("underline")&&(r=FDe(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"?oai[e]:e,r}setStyle(e){let r=this.getWritable();return r.__style=e,r}toggleFormat(e){let r=a$e(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=aai[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=Ns(),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(!nn(i))return bGr(s,n,s,o,"text","text");{let u=nU();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=Ns();if(o&&nn(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=nU(),a=n.length;e.sort((T,R)=>T-R),e.push(a);let s=[],u=e.length;for(let T=0,R=0;T<a&&R<=u;R++){let N=e[R];N>T&&(s.push(n.slice(T,N)),T=N)}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,g=!1,y=null,b=null,_=Ns();if(nn(_)){let[T,R]=_.isBackward()?[_.focus,_.anchor]:[_.anchor,_.focus];T.type==="text"&&T.key===o&&(y=T),R.type==="text"&&R.key===o&&(b=R)}r.isSegmented()?(f=$h(c),f.__format=p,f.__style=m,f.__detail=h,f.__state=FWr(r,f),g=!0):f=r.setTextContent(c);let w=[f];for(let T=1;T<l;T++){let R=$h(s[T]);R.__format=p,R.__style=m,R.__detail=h,R.__state=FWr(r,R);let N=R.__key;i===o&&Fh(N),w.push(R)}let x=y?y.offset:null,O=b?b.offset:null,E=0;for(let T of w){if(!y&&!b)break;let R=E+T.getTextContentSize();if(y!==null&&x!==null&&x<=R&&x>=E&&(y.set(T.getKey(),x-E,"text"),x<R&&(y=null)),b!==null&&O!==null&&O<=R&&O>=E){b.set(T.getKey(),O-E,"text");break}E=R}if(d!==null){(function(N){let D=N.getPreviousSibling(),F=N.getNextSibling();D!==null&&s$e(D),F!==null&&s$e(F)})(this);let T=d.getWritable(),R=this.getIndexWithinParent();g?(T.splice(R,0,w),this.remove()):T.splice(R,1,w),nn(_)&&r$e(_,d,R,l-1)}return w}mergeWithSibling(e){let r=e===this.getPreviousSibling();r||e===this.getNextSibling()||We(50);let n=this.__key,o=e.__key,i=this.__text,a=i.length;nU()===o&&Fh(n);let s=Ns();if(nn(s)){let d=s.anchor,f=s.focus;d!==null&&d.key===o&&o8r(d,r,n,e,a),f!==null&&f.key===o&&o8r(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 jai(t){return{forChild:Tyt(t.style),node:null}}function Dai(t){let e=t,r=e.style.fontWeight==="normal";return{forChild:Tyt(e.style,r?void 0:"bold"),node:null}}var GWr=new WeakMap;function $ai(t){if(!kb(t))return!1;if(t.nodeName==="PRE")return!0;let e=t.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function Lai(t){let e=t;t.parentElement===null&&We(129);let r=e.textContent||"";if(function(n){let o,i=n.parentNode,a=[n];for(;i!==null&&(o=GWr.get(i))===void 0&&!$ai(i);)a.push(i),i=i.parentNode;let s=o===void 0?i:o;for(let u=0;u<a.length;u++)GWr.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(JZ()):s===" "?o.push(p$e()):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=ZWr(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=ZWr(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 ZWr(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,kb(r)){let i=r.style.display;if(i===""&&!WGr(r)||i!==""&&!i.startsWith("inline"))return null}let o=r;for(;(o=e?r.firstChild:r.lastChild)!==null;)r=o;if(FI(r))return r;if(r.nodeName==="BR")return null}}var Fai={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function f$(t){let e=Fai[t.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Tyt(t.style,e),node:null}}function $h(t=""){return fde(new QJ(t))}function xr(t){return t instanceof QJ}function Tyt(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=>(xr(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 KZ=class t extends QJ{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=UZ(e.theme,"tab");return n!==void 0&&r.classList.add(...n),r}static importJSON(e){return p$e().updateFromJSON(e)}setTextContent(e){return e!==" "&&e!==""&&We(126),super.setTextContent(" ")}spliceText(e,r,n,o){return n===""&&r===0||n===" "&&r===1||We(286),this}setDetail(e){return e!==2&&We(127),this}setMode(e){return e!=="normal"&&We(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function p$e(){return fde(new KZ)}function Eyt(t){return t instanceof KZ}var ryt=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:Wyt(jx(dU(this,"next")),jx(dU(e,"next")))<0}getNode(){let e=Jm(this.key);return e===null&&We(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,nX()||(nU()===a&&Fh(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function Fx(t,e,r){return new ryt(t,e,r)}function Igt(t,e){let r=e.__key,n=t.offset,o="element";if(xr(e)){o="text";let i=e.getTextContentSize();n>i&&(n=i)}else if(!Je(e)){let i=e.getNextSibling();if(xr(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 XWr(t,e){if(Je(e)){let r=e.getLastDescendant();Je(r)||xr(r)?Igt(t,r):Igt(t,e)}else Igt(t,e)}var t$e=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(!m$e(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(xr(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 nX()||(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((Ns()||n3())===this&&e[0]){let r=Bh(e[0],"next");e9r(cU(r,r))}for(let r of e)r.remove()}};function nn(t){return t instanceof e3}var e3=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!!nn(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($x(l)){let{origin:c}=l;o.length===0?s.add(c):(u.add(c),o.push(c))}else{let{origin:c}=l;Je(c)&&u.has(c)||o.push(c)}if(a&&o.push(a.caret.origin),r3(n.focus)&&Je(n.focus.origin)&&n.focus.getNodeAtCaret()===null)for(let l=w$(n.focus.origin,"previous");$x(l)&&s.has(l.origin)&&!l.origin.isEmpty()&&l.origin.is(o[o.length-1]);l=tX(l))s.delete(l.origin),o.pop();for(;o.length>1;){let l=o[o.length-1];if(!Je(l)||u.has(l)||l.isEmpty()||s.has(l))break;o.pop()}if(o.length===0&&n.isCollapsed()){let l=jx(n.anchor),c=jx(n.anchor.getFlipped()),d=p=>_$(p)?p.origin:p.getNodeAtCaret(),f=d(l)||d(c)||(n.anchor.getNodeAtCaret()?l.origin:c.origin);o.push(f)}return o}(Zyt(dyt(this),"next"));return nX()||(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]=nyt(this),l="",c=!0;for(let d=0;d<e.length;d++){let f=e[d];if(Je(f)&&!f.isInline())c||(l+=`
|
||
`),c=!f.isEmpty();else if(c=!1,xr(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)&&!GJ(f)||f===n&&this.isCollapsed()||(l+=f.getTextContent())}return l}applyDOMRange(e){let r=Xl(),n=r.getEditorState()._selection,o=yGr(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),GDe(this)}clone(){let e=this.anchor,r=this.focus;return new t(Fx(e.key,e.offset,e.type),Fx(r.key,r.offset,r.type),this.format,this.style)}toggleFormat(e){this.format=a$e(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(JZ()):a===" "?n.push(p$e()):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(g,y,b,_){let w=g.getNode(),x=w.getChildAtIndex(g.offset),O=$h(),E=sv(w)?b$().append(O):O;O.setFormat(b),O.setStyle(_),x===null?w.append(E):x.insertBefore(E),g.is(y)&&y.set(O.__key,0,"text"),g.set(O.__key,0,"text")}(a,s,o,i),s.type==="element"&&rX(s,jx(dU(s,"next")));let u=a.offset,l=s.offset,c=this.getNodes(),d=c.length,f=c[0];xr(f)||We(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&&(m$(f)||!f.canInsertTextAfter()||!m.canInsertTextAfter()&&f.getNextSibling()===null)){let g=f.getNextSibling();if(xr(g)&&g.canInsertTextBefore()&&!m$(g)||(g=$h(),g.setFormat(o),g.setStyle(i),m.canInsertTextAfter()?f.insertAfter(g):m.insertAfter(g)),g.select(0,0),f=g,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&u===0&&(m$(f)||!f.canInsertTextBefore()||!m.canInsertTextBefore()&&f.getPreviousSibling()===null)){let g=f.getPreviousSibling();if(xr(g)&&!m$(g)||(g=$h(),g.setFormat(o),m.canInsertTextBefore()?f.insertBefore(g):m.insertBefore(g)),g.select(),f=g,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&u!==p){let g=$h(f.getTextContent());g.setFormat(o),f.replace(g),f=g}else if(!this.isCollapsed()&&e!==""){let g=h.getParent();if(!m.canInsertTextBefore()||!m.canInsertTextAfter()||Je(g)&&(!g.canInsertTextBefore()||!g.canInsertTextAfter()))return this.insertText(""),gGr(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(oU(f)){let _=$h(e);return _.select(),void f.replace(_)}let g=f.getFormat(),y=f.getStyle();if(u!==l||g===o&&y===i){if(Eyt(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=g,this.style=y))}else{let g=new Set([...f.getParentKeys(),...h.getParentKeys()]),y=Je(f)?f:f.getParentOrThrow(),b=Je(h)?h:h.getParentOrThrow(),_=h;if(!y.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(xr(h)&&!oU(h)&&l!==h.getTextContentSize()){if(h.isSegmented()){let T=$h(h.getTextContent());h.replace(T),h=T}sv(s.getNode())||s.type!=="text"||(h=h.spliceText(0,l,"")),g.add(h.__key)}else{let T=h.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?h.remove():T.remove()}else g.add(h.__key);let w=b.getChildren(),x=new Set(c),O=y.is(b),E=y.isInline()&&f.getNextSibling()===null?y:f;for(let T=w.length-1;T>=0;T--){let R=w[T];if(R.is(f)||Je(R)&&R.isParentOf(f))break;R.isAttached()&&(!x.has(R)||R.is(_)?O||E.insertAfter(R,!1):R.remove())}if(!O){let T=b,R=null;for(;T!==null;){let N=T.getChildren(),D=N.length;(D===0||N[D-1].is(R))&&(g.delete(T.__key),R=T),T=T.getParent()}}if(oU(f))if(u===p)f.select();else{let T=$h(e);T.select(),f.replace(T)}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 T=1;T<d;T++){let R=c[T],N=R.__key;g.has(N)||R.remove()}}}removeText(){let e=Ns()===this;Xce(this,t9r(dyt(this))),e&&Ns()!==this&&cv(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)xr(w)&&o.push(w);let i=w=>{n.forEach(x=>{if(Je(x)){let O=x.getFormatFlags(e,w);x.setTextFormat(O)}})},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 g=a-1,y=o[g],b=d.type==="text"?d.offset:y.getTextContentSize();if(p.is(y)){if(m===b)return;if(m$(p)||m===0&&b===p.getTextContentSize())p.setFormat(h);else{let w=p.splitText(m,b),x=m===0?w[0]:w[1];x.setFormat(h),c.type==="text"&&c.set(x.__key,0,"text"),d.type==="text"&&d.set(x.__key,b-m,"text")}return void(this.format=h)}m===0||m$(p)||([,p]=p.splitText(m),m=0),p.setFormat(h);let _=y.getFormatFlags(e,h);b>0&&(b===y.getTextContentSize()||m$(y)||([y]=y.splitText(b)),y.setFormat(_));for(let w=f+1;w<g;w++){let x=o[w],O=x.getFormatFlags(e,_);x.setFormat(O)}c.type==="text"&&c.set(p.__key,m,"text"),d.type==="text"&&d.set(y.__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=Ns();return nn(m)||We(134),m.insertNodes(e)}let r=(this.isBackward()?this.focus:this.anchor).getNode(),n=Lgt(r,y$),o=e[e.length-1];if(Je(n)&&"__language"in n){if("__language"in e[0])this.insertText(e[0].getTextContent());else{let m=Ngt(this);n.splice(m,0,e),o.selectEnd()}return}if(!e.some(m=>(Je(m)||Lu(m))&&!m.isInline())){Je(n)||We(211,r.constructor.name,r.getType());let m=Ngt(this);return n.splice(m,0,e),void o.selectEnd()}let i=function(m){let h=b$(),g=null;for(let y=0;y<m.length;y++){let b=m[y],_=GJ(b);if(_||Lu(b)&&b.isInline()||Je(b)&&b.isInline()||xr(b)||b.isParentRequired()){if(g===null&&(g=b.createParentElementNode(),h.append(g),_))continue;g!==null&&g.append(b)}else h.append(b),g=null}return h}(e),a=i.getLastDescendant(),s=i.getChildren(),u=!Je(n)||!n.isEmpty()?this.insertParagraph():null,l=s[s.length-1],c=s[0];var d;Je(d=c)&&y$(d)&&!d.isEmpty()&&Je(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(Je(n)||We(211,r.constructor.name,r.getType()),n.append(...c.getChildren()),c=s[1]),c&&(n===null&&We(212,r.constructor.name,r.getType()),function(m,h,g){let y=h.getParentOrThrow().getLastChild(),b=h,_=[h];for(;b!==y;)b.getNextSibling()||We(140),b=b.getNextSibling(),_.push(b);let w=m;for(let x of _)w=w.insertAfter(x)}(n,c));let f=Lgt(a,y$);u&&Je(f)&&(u.canMergeWhenEmpty()||y$(l))&&(f.append(...u.getChildren()),u.remove()),Je(n)&&n.isEmpty()&&n.remove(),a.selectEnd();let p=Je(n)?n.getLastChild():null;GJ(p)&&f!==n&&p.remove()}insertParagraph(){if(this.anchor.key==="root"){let a=b$();return lv().splice(this.anchor.offset,0,[a]),a.select(),a}let e=Ngt(this),r=Lgt(this.anchor.getNode(),y$);Je(r)||We(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=JZ();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]=nyt(this);if(r===0)return[];if(r===1){if(xr(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(xr(a)){let d=c?u:l;d===a.getTextContentSize()?e.shift():d!==0&&([,a]=a.splitText(d),e[0]=a)}if(xr(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(i8r(this,e,r,n))return;let o=e==="move",i=Xl(),a=LI(P0(i));if(!a)return;let s=i._blockCursorElement,u=i._rootElement,l=this.focus.getNode();if(u===null||s===null||!Je(l)||l.isInline()||l.canBeEmpty()||ayt(s,i,u),this.dirty){let c=XZ(i,this.anchor.key),d=XZ(i,this.focus.key);this.anchor.type==="text"&&(c=t3(c)),this.focus.type==="text"&&(d=t3(d)),c&&d&&vGr(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=sv(d)?d:HGr(d);if(this.applyDOMRange(c),this.dirty=!0,!o){let p=this.getNodes(),m=[],h=!1;for(let g=0;g<p.length;g++){let y=p[g];u$e(y,f)?m.push(y):h=!0}if(h&&m.length>0)if(r){let g=m[0];Je(g)?g.selectStart():g.getParentOrThrow().selectStart()}else{let g=m[m.length-1];Je(g)?g.selectEnd():g.getParentOrThrow().selectEnd()}a.anchorNode===c.startContainer&&a.anchorOffset===c.startOffset||function(g){let y=g.focus,b=g.anchor,_=b.key,w=b.offset,x=b.type;b.set(y.key,y.offset,y.type,!0),y.set(_,w,x,!0)}(this)}}n==="lineboundary"&&i8r(this,e,r,n,"decorators")}forwardDeletion(e,r,n){if(!n&&(e.type==="element"&&Je(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(Je(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=Jyt(dU(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($x(u)){if(!u.origin.isInline()){if(u.origin.isShadowRoot()){if(s.type==="merge-block")break;if(Je(i.anchor.origin)&&i.anchor.origin.isEmpty()){let l=jx(u);Xce(this,cU(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(r3(u)){if(Je(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())&&Je(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();let l=Pyt();l.add(u.origin.getKey()),cv(l)}else u.origin.remove();return}break}}if(s.type==="merge-block"){let{caret:u,block:l}=s;return Xce(this,cU(!u.origin.isEmpty()&&l.isEmpty()?iX(Bh(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&&QWr(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 e8r(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 e8r(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,g=m<h,y=g?m:h,b=g?h:m,_=b-1;y!==_&&function(w){return!($Gr(w)||kai(w))}(f.getTextContent().slice(y,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()&&sv(n.getParent())&&n.getPreviousSibling()===null&&QWr(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 m$e(t){return t instanceof t$e}function YWr(t){let e=t.offset;if(t.type==="text")return e;let r=t.getNode();return e===r.getChildrenSize()?r.getTextContent().length:0}function nyt(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]:[YWr(r),YWr(n)]}function QWr(t,e){for(let r=e;r;r=r.getParent()){if(Je(r)){if(r.collapseAtStart(t))return!0;if(kx(r))break}if(r.getPreviousSibling())break}return!1}var kai=(()=>{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 e8r(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 t8r(t,e,r,n){let o,i=e;if(kb(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=kZ(c),xr(o))i=Lx(o,a?"next":"previous");else{let f=kZ(t);if(f===null)return null;if(Je(f)){let p=n.getElementByKey(f.getKey());p===null&&We(214),[f,i]=f.getDOMSlot(p).resolveChildIndex(f,p,t,e),Je(f)||We(215),a&&i>=f.getChildrenSize()&&(i=Math.max(0,f.getChildrenSize()-1));let h=f.getChildAtIndex(i);if(Je(h)&&function(g,y,b){let _=g.getParent();return b===null||_===null||!_.canBeEmpty()||_!==b.getNode()}(h,0,r)){let g=a?h.getLastDescendant():h.getFirstDescendant();g===null?f=h:(h=g,f=Je(h)?h:h.getParentOrThrow()),i=0}xr(h)?(o=h,f=null,i=Lx(h,a?"next":"previous")):h!==f&&a&&!d&&(Je(f)||We(216),i=Math.min(f.getChildrenSize(),i+1))}else{let p=f.getIndexWithinParent();i=e===0&&Lu(f)&&kZ(t)===f?p:p+1,f=f.getParentOrThrow()}if(Je(f))return Fx(f.__key,i,"element")}}else o=kZ(t);return xr(o)?Fx(o.__key,Lx(o,i,"clamp"),"text"):null}function r8r(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&&Je(a)&&a.isInline()){let s=a.getPreviousSibling();xr(s)&&t.set(s.__key,s.getTextContent().length,"text")}}else Je(i)&&!r&&i.isInline()?t.set(i.__key,i.getChildrenSize(),"element"):xr(i)&&t.set(i.__key,i.getTextContent().length,"text")}else if(n===o.getTextContent().length){let i=o.getNextSibling(),a=o.getParent();if(e&&Je(i)&&i.isInline())t.set(i.__key,0,"element");else if((r||e)&&i===null&&Je(a)&&a.isInline()&&!a.canInsertTextAfter()){let s=a.getNextSibling();xr(s)&&t.set(s.__key,0,"text")}}}function gGr(t,e,r){if(t.type==="text"&&e.type==="text"){let n=t.isBefore(e),o=t.is(e);r8r(t,n,o),r8r(e,!n,o),o&&e.set(t.key,t.offset,t.type);let i=Xl();if(i.isComposing()&&i._compositionKey!==t.key&&nn(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 yGr(t,e,r,n,o,i){if(t===null||r===null||!lde(o,t,r))return null;let a=t8r(t,e,nn(i)?i.anchor:null,o);if(a===null)return null;let s=t8r(r,n,nn(i)?i.focus:null,o);if(s===null)return null;if(a.type==="element"&&s.type==="element"){let u=kZ(t),l=kZ(r);if(Lu(u)&&Lu(l))return null}return gGr(a,s,i),[a,s]}function qai(t){return Je(t)&&!t.isInline()}function bGr(t,e,r,n,o,i){let a=S$(),s=new e3(Fx(t,e,o),Fx(r,n,i),0,"");return s.dirty=!0,a._selection=s,s}function _Gr(){let t=Fx("root",0,"element"),e=Fx("root",0,"element");return new e3(t,e,0,"")}function Pyt(){return new t$e(new Set)}function Bai(t,e){return h$e(null,t,e,null)}function h$e(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=!kgt&&(s||a==="beforeinput"||a==="compositionstart"||a==="compositionend"||a==="click"&&i&&i.detail===3||a==="drop"||a===void 0),l,c,d,f;if(nn(t)&&!u)return t.clone();if(e===null)return null;if(l=e.anchorNode,c=e.focusNode,d=e.anchorOffset,f=e.focusOffset,s&&nn(t)&&!lde(r,l,c))return t.clone();let p=yGr(l,d,c,f,r,t);if(p===null)return null;let[m,h]=p;return new e3(m,h,nn(t)?t.format:0,nn(t)?t.style:"")}function Ns(){return S$()._selection}function n3(){return Xl()._editorState._selection}function r$e(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"),n8r(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")}}n8r(t)}function n8r(t){let e=t.anchor,r=e.offset,n=t.focus,o=n.offset,i=e.getNode(),a=n.getNode();if(t.isCollapsed()){if(!Je(i))return;let s=i.getChildrenSize(),u=r>=s,l=u?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(xr(l)){let c=0;u&&(c=l.getTextContentSize()),e.set(l.__key,c,"text"),n.set(l.__key,c,"text")}}else{if(Je(i)){let s=i.getChildrenSize(),u=r>=s,l=u?i.getChildAtIndex(s-1):i.getChildAtIndex(r);if(xr(l)){let c=0;u&&(c=l.getTextContentSize()),e.set(l.__key,c,"text")}}if(Je(a)){let s=a.getChildrenSize(),u=o>=s,l=u?a.getChildAtIndex(s-1):a.getChildAtIndex(o);if(xr(l)){let c=0;u&&(c=l.getTextContentSize()),n.set(l.__key,c,"text")}}}}function n$e(t,e,r,n,o){let i=null,a=0,s=null;n!==null?(i=n.__key,xr(n)?(a=n.getTextContentSize(),s="text"):Je(n)&&(a=n.getChildrenSize(),s="element")):o!==null&&(i=o.__key,xr(o)?s="text":Je(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 o8r(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 vGr(t,e,r,n,o){try{t.setBaseAndExtent(e,r,n,o)}catch{}}function Uai(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(TGr)&&d!==i||d!==null&&jyt(d))return;if(!nn(e))return void(t!==null&&lde(r,s,u)&&n.removeAllRanges());let f=e.anchor,p=e.focus,m=f.key,h=p.key,g=XZ(r,m),y=XZ(r,h),b=f.offset,_=p.offset,w=e.format,x=e.style,O=e.isCollapsed(),E=g,T=y,R=!1;if(f.type==="text"){E=t3(g);let H=f.getNode();R=H.getFormat()!==w||H.getStyle()!==x}else nn(t)&&t.anchor.type==="text"&&(R=!0);var N,D,F,B,U;if(p.type==="text"&&(T=t3(y)),E!==null&&T!==null&&(O&&(t===null||R||nn(t)&&(t.format!==w||t.style!==x))&&(N=w,D=x,F=b,B=m,U=performance.now(),uGr=[N,D,F,B,U]),l!==b||c!==_||s!==E||u!==T||n.type==="Range"&&O||(d!==null&&i.contains(d)||i.focus({preventScroll:!0}),f.type==="element"))){if(vGr(n,E,b,T,_),!o.has(EGr)&&e.isCollapsed()&&i!==null&&i===document.activeElement){let H=nn(e)&&e.anchor.type==="element"?E.childNodes[b]||null:n.rangeCount>0?n.getRangeAt(0):null;if(H!==null){let G;if(H instanceof Text){let ie=document.createRange();ie.selectNode(H),G=ie.getBoundingClientRect()}else G=H.getBoundingClientRect();(function(ie,oe,z){let Q=qyt(z),re=Byt(Q);if(Q===null||re===null)return;let{top:Z,bottom:$}=oe,q=0,Y=0,j=z;for(;j!==null;){let A=j===Q.body;if(A)q=0,Y=P0(ie).innerHeight;else{let V=j.getBoundingClientRect();q=V.top,Y=V.bottom}let W=0;if(Z<q?W=-(q-Z):$>Y&&(W=$-Y),W!==0)if(A)re.scrollBy(0,W);else{let V=j.scrollTop;j.scrollTop+=W;let se=j.scrollTop-V;Z-=se,$-=se}if(A)break;j=dde(j)}})(r,G,i)}}Qgt=!0}}function zai(t){let e=Ns()||n3();e===null&&(e=lv().selectEnd()),e.insertNodes(t)}function Hai(){let t=Ns();return t===null?"":t.getTextContent()}function Ngt(t){let e=t;t.isCollapsed()||e.removeText();let r=Ns();nn(r)&&(e=r),nn(e)||We(161);let n=e.anchor,o=n.getNode(),i=n.offset;for(;!y$(o);){let a=o;if([o,i]=Vai(o,i),a.is(o))break}return i}function Vai(t,e){let r=t.getParent();if(!r){let o=b$();return lv().append(o),o.select(),[lv(),0]}if(xr(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(!Je(t)||e===0)return[r,t.getIndexWithinParent()];let n=t.getChildAtIndex(e);if(n){let o=new e3(Fx(t.__key,e,"element"),Fx(t.__key,e,"element"),0,""),i=t.insertNewAfter(o);i&&i.append(n,...n.getNextSiblings())}return[r,t.getIndexWithinParent()+1]}function i8r(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=dU(t.focus,r?"previous":"next"),a=n==="lineboundary",s=e==="move",u=i,l=o==="decorators-and-blocks";if(!r9r(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 Jyt(i).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if($x(c))c.origin.isInline()||(u=c);else{if(Je(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=Pyt();return c.add(u.origin.getKey()),cv(c),!0}return u=jx(u),s&&rX(t.anchor,u),rX(t.focus,u),l||!a}var kh=null,qh=null,uv=!1,jgt=!1,zDe=0,a8r={characterData:!0,childList:!0,subtree:!0};function nX(){return uv||kh!==null&&kh._readOnly}function Lh(){uv&&We(13)}function wGr(){zDe>99&&We(14)}function S$(){return kh===null&&We(195,SGr()),kh}function Xl(){return qh===null&&We(196,SGr()),qh}function SGr(){let t=0,e=new Set,r=ZZ.version;if(typeof window<"u")for(let o of document.querySelectorAll("[contenteditable]")){let i=cde(o);if(y$e(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 Jai(){return qh}function s8r(t,e,r){let n=e.__type,o=Iyt(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 u8r(t,e){return t!==void 0&&t.__key!==e&&t.isAttached()}function CGr(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 Kai(t){return Myt(t,Xl()._nodes)}function Myt(t,e){let r=t.type,n=e.get(r);n===void 0&&We(17,r);let o=n.klass;t.type!==o.getType()&&We(18,o.name);let i=o.importJSON(t),a=t.children;if(Je(i)&&Array.isArray(a))for(let s=0;s<a.length;s++){let u=Myt(a[s],e);i.append(u)}return i}function l8r(t,e,r){let n=kh,o=uv,i=qh;kh=e,uv=!0,qh=t;try{return r()}finally{kh=n,uv=o,qh=i}}function g$(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!==XJ,l=kh,c=uv,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,uv=!1,t._updating=!0;try{let O=t._dirtyType,E=t._dirtyElements,T=t._dirtyLeaves;p.disconnect(),m=vai(i,r,t,O,E,T)}catch(O){if(O instanceof Error&&t._onError(O),jgt)throw O;return MGr(t,null,n,r),A8r(t),t._dirtyType=HZ,jgt=!0,g$(t,i),void(jgt=!1)}finally{p.observe(n,a8r),t._updating=f,kh=l,uv=c,qh=d}}r._readOnly||(r._readOnly=!0);let h=t._dirtyLeaves,g=t._dirtyElements,y=t._normalizedNodes,b=t._updateTags,_=t._deferred;u&&(t._dirtyType=XJ,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),function(O,E){let T=O._decorators,R=O._pendingDecorators||T,N=E._nodeMap,D;for(D in R)N.has(D)||(R===T&&(R=jGr(O)),delete R[D])}(t,r);let w=o?null:LI(P0(t));if(t._editable&&w!==null&&(u||s===null||s.dirty)&&n!==null&&!b.has(PGr)){qh=t,kh=r;try{if(p!==null&&p.disconnect(),u||s===null||s.dirty){let O=t._blockCursorElement;O!==null&&ayt(O,t,n),Uai(a,s,t,w,b,n)}(function(O,E,T){let R=O._blockCursorElement;if(nn(T)&&T.isCollapsed()&&T.anchor.type==="element"&&E.contains(document.activeElement)){let N=T.anchor,D=N.getNode(),F=N.offset,B=!1,U=null;if(F===D.getChildrenSize())$gt(D.getChildAtIndex(F-1))&&(B=!0);else{let H=D.getChildAtIndex(F);if(H!==null&&$gt(H)){let G=H.getPreviousSibling();(G===null||$gt(G))&&(B=!0,U=O.getElementByKey(H.__key))}}if(B){let H=O.getElementByKey(D.__key);return R===null&&(O._blockCursorElement=R=function(G){let ie=G.theme,oe=document.createElement("div");oe.contentEditable="false",oe.setAttribute("data-lexical-cursor","true");let z=ie.blockCursor;if(z!==void 0){if(typeof z=="string"){let Q=KDe(z);z=ie.blockCursor=Q}z!==void 0&&oe.classList.add(...z)}return oe}(O._config)),E.style.caretColor="transparent",void(U===null?H.appendChild(R):H.insertBefore(R,U))}}R!==null&&ayt(R,O,E)})(t,n,s)}finally{p!==null&&p.observe(n,a8r),qh=d,kh=l}}m!==null&&function(O,E,T,R,N){let D=Array.from(O._listeners.mutation),F=D.length;for(let B=0;B<F;B++){let[U,H]=D[B];for(let G of H){let ie=E.get(G);ie!==void 0&&U(ie,{dirtyLeaves:R,prevEditorState:N,updateTags:T})}}}(t,m,b,h,i),nn(s)||s===null||a!==null&&a.is(s)||t.dispatchCommand(vyt,void 0);let x=t._pendingDecorators;x!==null&&(t._decorators=x,t._pendingDecorators=null,Gce("decorator",t,!0,x)),function(O,E,T){let R=m8r(E),N=m8r(T);R!==N&&Gce("textcontent",O,!0,N)}(t,e||i,r),Gce("update",t,!0,{dirtyElements:g,dirtyLeaves:h,editorState:r,mutatedNodes:m,normalizedNodes:y,prevEditorState:e||i,tags:b}),function(O,E){if(O._deferred=[],E.length!==0){let T=O._updating;O._updating=!0;try{for(let R=0;R<E.length;R++)E[R]()}finally{O._updating=T}}}(t,_),function(O){let E=O._updates;if(E.length!==0){let T=E.shift();if(T){let[R,N]=T;g$e(O,R,N)}}}(t)}function Gce(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 c8r(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&&We(191),s._flushSync=!0),u&&t._deferred.push(u),CGr(t,a.tag)),s==null?g$e(t,i,a):i()}}return n}function g$e(t,e,r){let n=t._updateTags,o,i=!1,a=!1;r!==void 0&&(o=r.onUpdate,CGr(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=xGr(u||s),l=!0),u._flushSync=a;let c=kh,d=uv,f=qh,p=t._updating;kh=u,uv=!1,t._updating=!0,qh=t;let m=t._headless||t.getRootElement()===null;Ayt(null);try{l&&(m?s._selection!==null&&(u._selection=s._selection.clone()):u._selection=function(b,_){let w=b.getEditorState()._selection,x=LI(P0(b));return nn(w)||w==null?h$e(w,x,b,_):w.clone()}(t,r&&r.event||null));let g=t._compositionKey;e(),i=c8r(t,i),function(b,_){let w=_.getEditorState()._selection,x=b._selection;if(nn(x)){let O=x.anchor,E=x.focus,T;if(O.type==="text"&&(T=O.getNode(),T.selectionTransform(w,x)),E.type==="text"){let R=E.getNode();T!==R&&R.selectionTransform(w,x)}}}(u,t),t._dirtyType!==XJ&&(i?function(b,_){let w=_._dirtyLeaves,x=b._nodeMap;for(let O of w){let E=x.get(O);xr(E)&&E.isAttached()&&E.isSimpleText()&&!E.isUnmergeable()&&BWr(E)}}(u,t):function(b,_){let w=_._dirtyLeaves,x=_._dirtyElements,O=b._nodeMap,E=nU(),T=new Map,R=w,N=R.size,D=x,F=D.size;for(;N>0||F>0;){if(N>0){_._dirtyLeaves=new Set;for(let B of R){let U=O.get(B);xr(U)&&U.isAttached()&&U.isSimpleText()&&!U.isUnmergeable()&&BWr(U),U!==void 0&&u8r(U,E)&&s8r(_,U,T),w.add(B)}if(R=_._dirtyLeaves,N=R.size,N>0){zDe++;continue}}_._dirtyLeaves=new Set,_._dirtyElements=new Map,D.delete("root")&&D.set("root",!0);for(let B of D){let U=B[0],H=B[1];if(x.set(U,H),!H)continue;let G=O.get(U);G!==void 0&&u8r(G,E)&&s8r(_,G,T)}R=_._dirtyLeaves,N=R.size,D=_._dirtyElements,F=D.size,zDe++}_._dirtyLeaves=w,_._dirtyElements=x}(u,t),c8r(t),function(b,_,w,x){let O=b._nodeMap,E=_._nodeMap,T=[];for(let[R]of x){let N=E.get(R);N!==void 0&&(N.isAttached()||(Je(N)&&P8r(N,R,O,E,T,x),O.has(R)||x.delete(R),T.push(R)))}for(let R of T)E.delete(R);for(let R of w){let N=E.get(R);N===void 0||N.isAttached()||(O.has(R)||w.delete(R),E.delete(R))}}(s,u,t._dirtyLeaves,t._dirtyElements)),g!==t._compositionKey&&(u._flushSync=!0);let y=u._selection;if(nn(y)){let b=u._nodeMap,_=y.anchor.key,w=y.focus.key;b.get(_)!==void 0&&b.get(w)!==void 0||We(19)}else m$e(y)&&y._nodes.size===0&&(u._selection=null)}catch(g){return g instanceof Error&&t._onError(g),t._pendingEditorState=s,t._dirtyType=HZ,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),void g$(t)}finally{kh=c,uv=d,qh=f,t._updating=p,zDe=0}t._dirtyType!==XJ||t._deferred.length>0||function(g,y){let b=y.getEditorState()._selection,_=g._selection;if(_!==null){if(_.dirty||!_.is(b))return!0}else if(b!==null)return!0;return!1}(u,t)?u._flushSync?(u._flushSync=!1,g$(t)):l&&ssi(()=>{g$(t)}):(u._flushSync=!1,l&&(n.clear(),t._deferred=[],t._pendingEditorState=null))}function vw(t,e,r){qh===t&&r===void 0?e():g$e(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&&We(222),this.element.insertBefore(e,r),this}removeChild(e){return e.parentElement!==this.element&&We(223),this.element.removeChild(e),this}replaceChild(e,r){return r.parentElement!==this.element&&We(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"&&(zZ||Yce);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=d8r(r,n);i.push(o);let a=d8r(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 d8r(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&&We(225),r.reverse()}var uU=class extends sU{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 iai[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=Xl()._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(xr(r)&&e.push(r),Je(r)){let n=r.getAllTextNodes();e.push(...n)}r=r.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Je(e);){let r=e.getFirstChild();if(r===null)break;e=r}return e}getLastDescendant(){let e=this.getLastChild();for(;Je(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 Je(i)&&i.getLastDescendant()||i||null}let o=r[e];return Je(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&&We(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:Jm(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&We(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(),Je(i)&&o!==n-1&&!i.isInline()&&(e+=v$)}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(),Je(i)&&o!==n-1&&!i.isInline()&&(e+=v$.length)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){let r=NWr[e];return!!(this.getFormat()&r)}return!1}hasTextFormat(e){let r=Ly[e];return!!(this.getTextFormat()&r)}getFormatFlags(e,r){return a$e(this.getLatest().__textFormat,e,r)}getTextStyle(){return this.getLatest().__textStyle}select(e,r){Lh();let n=Ns(),o=e,i=r,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&r===0){let u=this.getFirstChild();if(xr(u)||Je(u))return u.select(0,0)}else if(!(e!==void 0&&e!==a||r!==void 0&&r!==a)){let u=this.getLastChild();if(xr(u)||Je(u))return u.select()}}o===void 0&&(o=a),i===void 0&&(i=a);let s=this.__key;return nn(n)?(n.anchor.set(s,o,"element"),n.focus.set(s,i,"element"),n.dirty=!0,n):bGr(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!==""?NWr[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||We(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&&We(100);let g=m.getNextSibling(),y=m.__key;iU(m.getWritable()),l.push(y),m=g}}let p=d;for(let m=0;m<o;m++){let h=n[m];p!==null&&h.is(p)&&(d=p=p.getPreviousSibling());let g=h.getWritable();g.__parent===s&&f--,iU(g);let y=h.__key;if(p===null)a.__first=y,g.__prev=null;else{let b=p.getWritable();b.__next=y,g.__prev=b.__key}h.__key===s&&We(76),g.__parent=s,u.push(y),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=Ns();if(nn(m)){let h=new Set(l),g=new Set(u),{anchor:y,focus:b}=m;f8r(y,h,g)&&n$e(y,y.getNode(),this,d,c),f8r(b,h,g)&&n$e(b,b.getNode(),this,d,c),f!==0||this.canBeEmpty()||kx(this)||this.remove()}}return a}getDOMSlot(e){return new oyt(e)}exportDOM(e){let{element:r}=super.exportDOM(e);if(kb(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 Je(t){return t instanceof uU}function f8r(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 sde=class extends sU{decorate(e,r){We(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Lu(t){return t instanceof sde}var WZ=class t extends uU{static getType(){return"root"}static clone(){return new t}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){We(51)}getTextContent(){let e=this.__cachedText;return!nX()&&Xl()._dirtyType!==XJ||e===null?super.getTextContent():e}remove(){We(52)}replace(e){We(53)}insertBefore(e){We(54)}insertAfter(e){We(55)}updateDOM(e,r){return!1}splice(e,r,n){for(let o of n)Je(o)||Lu(o)||We(282);return super.splice(e,r,n)}static importJSON(e){return lv().updateFromJSON(e)}collapseAtStart(){return!0}};function sv(t){return t instanceof WZ}function xGr(t){return new o$e(new Map(t._nodeMap))}function Ryt(){return new o$e(new Map([["root",new WZ]]))}function OGr(t){let e=t.exportJSON(),r=t.constructor;if(e.type!==r.getType()&&We(130,r.name),Je(t)){let n=e.children;Array.isArray(n)||We(59,r.name);let o=t.getChildren();for(let i=0;i<o.length;i++){let a=OGr(o[i]);n.push(a)}}return e}var o$e=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 l8r(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 l8r(null,this,()=>({root:OGr(lv())}))}},Wai="historic",Gai="history-push",HDe="history-merge",Zai="paste",TGr="collaboration",Xai="skip-collab",EGr="skip-scroll-into-view",PGr="skip-dom-selection",i$e=class extends uU{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}},GZ=class t extends uU{static getType(){return"paragraph"}static clone(e){return new t(e.__key)}createDOM(e){let r=document.createElement("p"),n=UZ(e.theme,"paragraph");return n!==void 0&&r.classList.add(...n),r}updateDOM(e,r,n){return!1}static importDOM(){return{p:e=>({conversion:Yai,priority:0})}}exportDOM(e){let{element:r}=super.exportDOM(e);if(kb(r)){this.isEmpty()&&r.append(document.createElement("br"));let n=this.getFormatType();n&&(r.style.textAlign=n)}return{element:r}}static importJSON(e){return b$().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,r){let n=b$();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||xr(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 Yai(t){let e=b$();return t.style&&(e.setFormat(t.style.textAlign),ZGr(t,e)),{node:e}}function b$(){return fde(new GZ)}function Qai(t){return t instanceof GZ}var esi=0,tsi=1,rsi=2,nsi=3,osi=4;function MGr(t,e,r,n){let o=t._keyToDOMMap;o.clear(),t._editorState=Ryt(),t._pendingEditorState=n,t._compositionKey=null,t._dirtyType=XJ,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 isi(t){let e=t||{},r=Jai(),n=e.theme||{},o=t===void 0?r:e.parentEditor||null,i=e.disableEvents||!1,a=Ryt(),s=e.namespace||(o!==null?o._config.namespace:LGr()),u=e.editorState,l=[WZ,QJ,VZ,KZ,GZ,i$e,...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 g=l[h],y=null,b=null;if(typeof g!="function"){let E=g;g=E.replace,y=E.with,b=E.withKlass||null}let{ownNodeConfig:_}=Hyt(g),w=g.getType(),x=g.transform(),O=new Set;_&&_.$transform&&O.add(_.$transform),x!==null&&O.add(x),p.set(w,{exportDOM:d&&d.export?d.export.get(g):void 0,klass:g,replace:y,replaceWithKlass:b,sharedNodeState:I8r(l[h]),transforms:O})}}let m=new ZZ(a,o,p,{disableEvents:i,namespace:s,theme:n},c||console.error,function(h,g){let y=new Map,b=new Set,_=w=>{Object.keys(w).forEach(x=>{let O=y.get(x);O===void 0&&(O=[],y.set(x,O)),O.push(w[x])})};return h.forEach(w=>{let x=w.klass.importDOM;if(x==null||b.has(x))return;b.add(x);let O=x.call(w.klass);O!==null&&_(O)}),g&&_(g),y}(p,d?d.import:void 0),f,t);return u!==void 0&&(m._pendingEditorState=u,m._dirtyType=HZ),m}var ZZ=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=XJ,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=LGr(),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&&We(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&&We(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&&We(37,e.name),r}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,r){let n=this._editorState,o=uyt(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=uyt(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:HDe}: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 lr(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=UZ(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,MGr(this,r,e,o),r!==null&&(this._config.disableEvents||Aai(r),n!=null&&r.classList.remove(...n)),e!==null){let i=Byt(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=HZ,A8r(this),this._updateTags.add(HDe),g$(this),this._config.disableEvents||function(s,u){let l=s.ownerDocument,c=e$e.get(l);(c===void 0||c<1)&&l.addEventListener("selectionchange",pGr),e$e.set(l,(c||0)+1),s.__lexicalEditor=u;let d=fGr(s);for(let f=0;f<Ygt.length;f++){let[p,m]=Ygt[f],h=typeof m=="function"?g=>{KWr(g)||(JWr(g),(u.isEditable()||p==="click")&&m(g,u))}:g=>{if(KWr(g))return;JWr(g);let y=u.isEditable();switch(p){case"cut":return y&&lr(u,Oyt,g);case"copy":return lr(u,xyt,g);case"paste":return y&&lr(u,wyt,g);case"dragstart":return y&&lr(u,eGr,g);case"dragover":return y&&lr(u,tGr,g);case"dragend":return y&&lr(u,rGr,g);case"focus":return y&&lr(u,nGr,g);case"blur":return y&&lr(u,oGr,g);case"drop":return y&&lr(u,Q8r,g)}};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(HDe),g$(this);Gce("root",this,!1,e,r)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,r){e.isEmpty()&&We(38);let n=e;n._readOnly&&(n=xGr(e),n._selection=e._selection?e._selection.clone():null),R8r(this);let o=this._pendingEditorState,i=this._updateTags,a=r!==void 0?r.tag:null;o===null||o.isEmpty()||(a!=null&&i.add(a),g$(this)),this._pendingEditorState=n,this._dirtyType=HZ,this._dirtyElements.set("root",!1),this._compositionKey=null,a!=null&&i.add(a),this._updating||g$(this)}parseEditorState(e,r){return function(n,o,i){let a=Ryt(),s=kh,u=uv,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,uv=!1,qh=o,Ayt(null);try{let m=o._nodes;Myt(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,uv=u,qh=l}return a}(typeof e=="string"?JSON.parse(e):e,this,r)}read(e){return g$(this),this.getEditorState().read(e,{editor:this})}update(e,r){(function(n,o,i){n._updating?n._updates.push([o,i]):g$e(n,o,i)})(this,e,r)}focus(e,r={}){let n=this._rootElement;n!==null&&(n.setAttribute("autocapitalize","off"),vw(this,()=>{let o=Ns(),i=lv();o!==null?o.dirty||cv(o.clone()):i.getChildrenSize()!==0&&(r.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),UGr("focus"),zGr(()=>{n.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute("autocapitalize"))}blur(){let e=this._rootElement;e!==null&&e.blur();let r=LI(this._window);r!==null&&r.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Gce("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};ZZ.version="0.34.0+prod.esm";var iyt=null;function Ayt(t){iyt=t}var RGr=1;function asi(){RGr=1}function Iyt(t,e){let r=Nyt(t,e);return r===void 0&&We(30,e),r}function Nyt(t,e){return t._nodes.get(e)}var ssi=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function p8r(t){return Lu(_$e(t))}function jyt(t){let e=document.activeElement;if(!kb(e))return!1;let r=e.nodeName;return Lu(_$e(t))&&(r==="INPUT"||r==="TEXTAREA"||e.contentEditable==="true"&&cde(e)==null)}function lde(t,e,r){let n=t.getRootElement();try{return n!==null&&n.contains(e)&&n.contains(r)&&e!==null&&!jyt(e)&&Dyt(e)===t}catch{return!1}}function y$e(t){return t instanceof ZZ}function Dyt(t){let e=t;for(;e!=null;){let r=cde(e);if(y$e(r))return r;e=dde(e)}return null}function cde(t){return t?t.__lexicalEditor:null}function oU(t){return Eyt(t)||t.isToken()}function m$(t){return oU(t)||t.isSegmented()}function FI(t){return oX(t)&&t.nodeType===Hii}function AGr(t){return oX(t)&&t.nodeType===Vii}function t3(t){let e=t;for(;e!=null;){if(FI(e))return e;e=e.firstChild}return null}function a$e(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 usi(t){return xr(t)||GJ(t)||Lu(t)}function IGr(t,e){let r=function(){let a=iyt;return iyt=null,a}();if((e=e||r&&r.__key)!=null)return void(t.__key=e);Lh(),wGr();let n=Xl(),o=S$(),i=""+RGr++;o._nodeMap.set(i,t),Je(t)?n._dirtyElements.set(i,!0):n._dirtyLeaves.add(i),n._cloneNotNeeded.add(i),n._dirtyType=x8r,t.__key=i}function iU(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 s$e(t){wGr();let e=t.getLatest(),r=e.__parent,n=S$(),o=Xl(),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=x8r,Je(t)?a.set(s,!0):o._dirtyLeaves.add(s)}function Fh(t){Lh();let e=Xl(),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 nU(){return nX()?null:Xl()._compositionKey}function Jm(t,e){let r=(e||S$())._nodeMap.get(t);return r===void 0?null:r}function NGr(t,e){let r=b$e(t,Xl());return r!==void 0?Jm(r,e):null}function b$e(t,e){return t[`__lexicalKey_${e._key}`]}function _$e(t,e){let r=t;for(;r!=null;){let n=NGr(r,e);if(n!==null)return n;r=dde(r)}return null}function jGr(t){let e=t._decorators,r=Object.assign({},e);return t._pendingDecorators=r,r}function m8r(t){return t.read(()=>lv().getTextContent())}function lv(){return DGr(S$())}function DGr(t){return t._nodeMap.get("root")}function cv(t){Lh();let e=S$();t!==null&&(t.dirty=!0,t.setCachedNodes(null)),e._selection=t}function kZ(t){let e=Xl(),r=function(n,o){let i=n;for(;i!=null;){let a=b$e(i,o);if(a!==void 0)return a;i=dde(i)}return null}(t,e);return r===null?t===e.getRootElement()?Jm("root"):null:Jm(r)}function $Gr(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function $yt(t){let e=[],r=t;for(;r!==null;)e.push(r),r=r._parentEditor;return e}function LGr(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function FGr(t){return FI(t)?t.nodeValue:null}function Lyt(t,e,r){let n=LI(P0(e));if(n===null)return;let o=n.anchorNode,{anchorOffset:i,focusOffset:a}=n;if(o!==null){let s=FGr(o),u=_$e(o);if(s!==null&&xr(u)){if(s===d$e&&r){let l=r.length;s=r,i=l,a=l}s!==null&&Fyt(u,s,i,a,t)}}}function Fyt(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]===d$e&&(s=e.slice(0,-1));let u=i.getTextContent();if(o||s!==u){if(s===""){if(Fh(null),Yce||zZ||JDe)i.remove();else{let h=Xl();setTimeout(()=>{h.update(()=>{i.isAttached()&&i.remove()})},20)}return}let l=i.getParent(),c=n3(),d=i.getTextContentSize(),f=nU(),p=i.getKey();if(i.isToken()||f!==null&&p===f&&!a||nn(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=Ns();if(!nn(m)||r===null||n===null)return void h8r(i,s,m);if(m.setTextNodeRange(i,r,i,n),i.isSegmented()){let h=$h(i.getTextContent());i.replace(h),i=h}h8r(i,s,m)}}}function h8r(t,e,r){if(t.setTextContent(e),nn(r)){let n=t.getKey();for(let o of["anchor","focus"]){let i=r[o];i.type==="text"&&i.key===n&&(i.offset=Lx(t,i.offset,"clamp"))}}}function kDe(t,e,r){let n=e[r]||!1;return n==="any"||n===t[r]}function kGr(t,e){return kDe(t,e,"altKey")&&kDe(t,e,"ctrlKey")&&kDe(t,e,"shiftKey")&&kDe(t,e,"metaKey")}function Gs(t,e,r){return kGr(t,r)&&t.key.toLowerCase()===e.toLowerCase()}var p$={ctrlKey:!$I,metaKey:$I},g8r={altKey:$I,ctrlKey:!$I};function y8r(t){return t.key==="Backspace"}function b8r(t){return Gs(t,"a",p$)}function lsi(t){let e=lv();if(nn(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"),GDe(t),t}{let r=e.select(0,e.getChildrenSize());return cv(GDe(r)),r}}function UZ(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=KDe(o);return r[e]=i,i}return o}function kyt(t,e,r,n,o){if(r.size===0)return;let i=n.__type,a=n.__key,s=e.get(i);s===void 0&&We(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 csi(t){let e=t.getType(),r=S$();if(r._readOnly){let i=uyt(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 _8r(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 qGr(t,e){let r=t.offset;if(t.type==="element")return _8r(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?_8r(n.getParentOrThrow(),e,n.getIndexWithinParent()+(e?0:1)):o}}return null}function BGr(t){let e=P0(t).event,r=e&&e.inputType;return r==="insertFromPaste"||r==="insertFromPasteAsQuotation"}function lr(t,e,r){return function(n,o,i){let a=$yt(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(vw(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 v$e(t){return!sv(t)&&!t.isLastChild()&&!t.isInline()}function XZ(t,e){let r=t._keyToDOMMap.get(e);return r===void 0&&We(75,e),r}function dde(t){let e=t.assignedSlot||t.parentElement;return KGr(e)?e.host:e}function qyt(t){return AGr(t)?t:kb(t)?t.ownerDocument:null}function dsi(t){return Xl()._updateTags.has(t)}function UGr(t){Lh(),Xl()._updateTags.add(t)}function zGr(t){Lh(),Xl()._deferred.push(t)}function u$e(t,e){let r=t.getParent();for(;r!==null;){if(r.is(e))return!0;r=r.getParent()}return!1}function Byt(t){let e=qyt(t);return e?e.defaultView:null}function P0(t){let e=t._window;return e===null&&We(78),e}function fsi(t){return Je(t)&&t.isInline()||Lu(t)&&t.isInline()}function HGr(t){let e=t.getParentOrThrow();for(;e!==null;){if(kx(e))return e;e=e.getParentOrThrow()}return e}function kx(t){return sv(t)||Je(t)&&t.isShadowRoot()}function Uyt(t){let e=t.constructor.clone(t);return IGr(e,null),e.afterCloneFrom(t),e}function fde(t){let e=Xl(),r=t.getType(),n=Nyt(e,r);n===void 0&&We(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||We(201,i.name,i.getType(),s.name,s.getType(),t.constructor.name,r):a instanceof t.constructor&&s!==t.constructor||We(202,s.name,s.getType(),t.constructor.name,r),a.__key===t.__key&&We(203,t.constructor.name,r,s.name,s.getType()),a}return t}function Dgt(t,e){!sv(t.getParent())||Je(e)||Lu(e)||We(99)}function VGr(t){let e=Jm(t);return e===null&&We(63,t),e}function $gt(t){return(Lu(t)||Je(t)&&!t.canBeEmpty())&&!t.isInline()}function ayt(t,e,r){r.style.removeProperty("caret-color"),e._blockCursorElement=null;let n=t.parentElement;n!==null&&n.removeChild(t)}function LI(t){return qx?(t||window).getSelection():null}function JGr(t){let e=Byt(t);return e?e.getSelection():null}function psi(t,e){let r=t.getChildAtIndex(e);r==null&&(r=t),kx(t)&&We(102);let n=a=>{let s=a.getParentOrThrow(),u=kx(s),l=a!==r||u?Uyt(a):a;if(u)return Je(a)&&Je(l)||We(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 msi(t){return kb(t)&&t.tagName==="A"}function kb(t){return oX(t)&&t.nodeType===zii}function oX(t){return typeof t=="object"&&t!==null&&"nodeType"in t&&typeof t.nodeType=="number"}function KGr(t){return oX(t)&&t.nodeType===Jii}function WGr(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 syt(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 y$(t){if(Lu(t)&&!t.isInline())return!0;if(!Je(t)||kx(t))return!1;let e=t.getFirstChild(),r=e===null||GJ(e)||xr(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&r}function Lgt(t,e){let r=t;for(;r!==null&&r.getParent()!==null&&!e(r);)r=r.getParentOrThrow();return e(r)?r:null}function zyt(){return Xl()}var v8r=new WeakMap,hsi=new Map;function uyt(t){if(!t._readOnly&&t.isEmpty())return hsi;t._readOnly||We(192);let e=v8r.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),v8r.set(t,e)),e}function GGr(t){let e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function ZGr(t,e){let r=parseInt(t.style.paddingInlineStart,10)||0,n=Math.round(r/40);e.setIndent(n)}function gsi(t){t.__lexicalUnmanaged=!0}function XGr(t){return t.__lexicalUnmanaged===!0}function Hce(t,e){return function(r,n){return Object.prototype.hasOwnProperty.call(r,n)}(t,e)&&t[e]!==sU[e]}function Hyt(t){let e=jWr in t.prototype?t.prototype[jWr]():void 0,r=function(a){return a===sde||a===uU||a===sU}(t),n=!r&&Hce(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&&(Hce(t,"getType")||(t.getType=()=>i),Hce(t,"clone")||(t.clone=a=>(Ayt(a),new t)),Hce(t,"importJSON")||(t.importJSON=o&&o.$importJSON||(a=>new t().updateFromJSON(a))),!Hce(t,"importDOM")&&o)){let{importDOM:a}=o;a&&(t.importDOM=()=>a)}return{ownNodeConfig:o,ownNodeType:i}}function ysi(t){let e=zyt();return Lh(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t))).klass}var bsi={next:"previous",previous:"next"},YZ=class{constructor(e){this.origin=e}[Symbol.iterator](){return Kyt({hasNext:r3,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Bh(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Bh(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&&We(263,Array.from(s).join(" "))}else i.insert(u);i=Bh(u,this.direction)}for(let u of s.values())u.remove();return this}},ude=class t extends YZ{constructor(){super(...arguments);M(this,"type","child")}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:w$(r,this.direction)}getParentCaret(r="root"){return Bh(Vyt(this.getParentAtCaret(),r),this.direction)}getFlipped(){let r=pU(this.direction);return Bh(this.getNodeAtCaret(),r)||w$(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)}},_si={root:sv,shadowRoot:kx};function pU(t){return bsi[t]}function Vyt(t,e="root"){return _si[e](t)?null:t}var QZ=class t extends YZ{constructor(){super(...arguments);M(this,"type","sibling")}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:Bh(r,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Je(this.origin)?w$(this.origin,this.direction):null}getParentCaret(r="root"){return Bh(Vyt(this.getParentAtCaret(),r),this.direction)}getFlipped(){let r=pU(this.direction);return Bh(this.getNodeAtCaret(),r)||w$(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 eX)&&this.direction===r.direction&&this.origin.is(r.origin)}},eX=class t extends YZ{constructor(r,n){super(r);M(this,"type","text");this.offset=n}getLatest(){let r=this.origin.getLatest();return r===this.origin?this:lU(r,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(r="root"){return Bh(Vyt(this.getParentAtCaret(),r),this.direction)}getFlipped(){return lU(this.origin,pU(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 QZ||r instanceof t)&&this.direction===r.direction&&this.origin.is(r.origin)}getSiblingCaret(){return Bh(this.origin,this.direction)}};function _$(t){return t instanceof eX}function vsi(t){return t instanceof YZ}function r3(t){return t instanceof QZ}function $x(t){return t instanceof ude}var wsi={next:class extends eX{constructor(){super(...arguments);M(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends eX{constructor(){super(...arguments);M(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Ssi={next:class extends QZ{constructor(){super(...arguments);M(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends QZ{constructor(){super(...arguments);M(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Csi={next:class extends ude{constructor(){super(...arguments);M(this,"direction","next")}getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends ude{constructor(){super(...arguments);M(this,"direction","previous")}getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Bh(t,e){return t?new Ssi[e](t):null}function lU(t,e,r){return t?new wsi[e](t,Lx(t,r)):null}function Lx(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 lyt(t,e){return new l$e(t,e)}function w$(t,e){return Je(t)?new Csi[e](t):null}function YGr(t){return t&&t.getChildCaret()||t}function tX(t){return t&&YGr(t.getAdjacentCaret())}var cyt=class t{constructor(e,r,n){M(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 _$(i)?function(a,s){let{direction:u,origin:l}=a,c=Lx(l,s==="focus"?pU(u):u);return lyt(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[lyt(o,i.offset-o.offset),null]}return[r,n]}iterNodeCarets(e="root"){let r=_$(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),o=_$(n),i=a=>a.isSameNodeCaret(n)?null:tX(a)||a.getParentCaret(e);return Kyt({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")}},l$e=class{constructor(e,r){M(this,"type","slice");this.caret=e,this.distance=r}getSliceIndices(){let{distance:e,caret:{offset:r}}=this,n=r+e;return n<r?[n,r]:[r,n]}getTextContent(){let[e,r]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,r)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:r}}=this,[n,o]=this.getSliceIndices(),i=e.getTextContent();return lU(e.setTextContent(i.slice(0,n)+i.slice(o)),r,n)}};function xsi(t){return t instanceof l$e}function Jyt(t){return cU(t,Bh(lv(),t.direction))}function QGr(t){return cU(t,t)}function cU(t,e){return t.direction!==e.direction&&We(265),new cyt(t,e,t.direction)}function Kyt(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 Wyt(t,e){let r=Zce(t.origin,e.origin);switch(r===null&&We(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 Gyt(r)}}function Gyt(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 qDe(t,e){return e.is(t)}function w8r(t){return Je(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function Zce(t,e){if(t.is(e))return{commonAncestor:t,type:"same"};let r=new Map;for(let[n,o]=w8r(t);n;o=n,n=n.getParent())r.set(n,o);for(let[n,o]=w8r(e);n;o=n,n=n.getParent()){let i=r.get(n);if(i!==void 0)return i===null?(qDe(t,n)||We(276),{commonAncestor:n,type:"ancestor"}):o===null?(qDe(e,n)||We(277),{commonAncestor:n,type:"descendant"}):((Je(i)||qDe(t,i))&&(Je(o)||qDe(e,o))&&n.is(i.getParent())&&n.is(o.getParent())||We(278),{a:i,b:o,commonAncestor:n,type:"branch"})}return null}function dU(t,e){let{type:r,key:n,offset:o}=t,i=VGr(t.key);return r==="text"?(xr(i)||We(266,i.getType(),n),lU(i,e,o)):(Je(i)||We(267,i.getType(),n),n9r(i,t.offset,e))}function rX(t,e){let{origin:r,direction:n}=e,o=n==="next";_$(e)?t.set(r.getKey(),e.offset,"text"):r3(e)?xr(r)?t.set(r.getKey(),Lx(r,n),"text"):t.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(o?1:0),"element"):($x(e)&&Je(r)||We(268),t.set(r.getKey(),o?0:r.getChildrenSize(),"element"))}function e9r(t){let e=Ns(),r=nn(e)?e:_Gr();return Xce(r,t),cv(r),r}function Xce(t,e){rX(t.anchor,e.anchor),rX(t.focus,e.focus)}function dyt(t){let{anchor:e,focus:r}=t,n=dU(e,"next"),o=dU(r,"next"),i=Wyt(n,o)<=0?"next":"previous";return cU(fU(n,i),fU(o,i))}function iX(t){let{direction:e,origin:r}=t,n=Bh(r,pU(e)).getNodeAtCaret();return n?Bh(n,e):w$(r.getParentOrThrow(),e)}function S8r(t,e="root"){let r=[t];for(let n=$x(t)?t.getParentCaret(e):t.getSiblingCaret();n!==null;n=n.getParentCaret(e))r.push(iX(n));return r}function Fgt(t){return!!t&&t.origin.isAttached()}function t9r(t,e="removeEmptySlices"){if(t.isCollapsed())return t;let r="root",n="next",o=e,i=Zyt(t,n),a=S8r(i.anchor,r),s=S8r(i.focus.getFlipped(),r),u=new Set,l=[];for(let m of i.iterNodeCarets(r))if($x(m))u.add(m.origin.getKey());else if(r3(m)){let{origin:h}=m;Je(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,g=h.getTextContentSize(),y=iX(Bh(h,n)),b=h.getMode();if(Math.abs(m.distance)===g&&o==="removeEmptySlices"||b==="token"&&m.distance!==0)y.remove();else if(m.distance!==0){o="removeEmptySlices";let _=m.removeTextSlice(),w=m.caret.origin;if(b==="segmented"){let x=_.origin,O=$h(x.getTextContent()).setStyle(x.getStyle()).setFormat(x.getFormat());y.replaceOrInsert(O),_=lU(O,n,_.offset)}w.is(a[0].origin)&&(a[0]=_),w.is(s[0].origin)&&(s[0]=_.getFlipped())}}let c,d;for(let m of a)if(Fgt(m)){c=jx(m);break}for(let m of s)if(Fgt(m)){d=jx(m);break}let f=function(m,h,g){if(!m||!h)return null;let y=m.getParentAtCaret(),b=h.getParentAtCaret();if(!y||!b)return null;let _=y.getParents().reverse();_.push(y);let w=b.getParents().reverse();w.push(b);let x=Math.min(_.length,w.length),O;for(O=0;O<x&&_[O]===w[O];O++);let E=(N,D)=>{let F;for(let B=O;B<N.length;B++){let U=N[B];if(kx(U))return;!F&&D(U)&&(F=U)}return F},T=E(_,y$),R=T&&E(w,N=>g.has(N.getKey())&&y$(N));return T&&R?[T,R]:null}(c,d,u);if(f){let[m,h]=f;w$(m,"previous").splice(0,h.getChildren()),h.remove()}let p=[c,d,...a,...s].find(Fgt);if(p)return QGr(fU(jx(p),t.direction));We(269,JSON.stringify(a.map(m=>m.origin.__key)))}function jx(t){let e=function(o){let i=o;for(;$x(i);){let a=tX(i);if(!$x(a))break;i=a}return i}(t.getLatest()),{direction:r}=e;if(xr(e.origin))return _$(e)?e:lU(e.origin,r,r);let n=e.getAdjacentCaret();return r3(n)&&xr(n.origin)?lU(n.origin,r,pU(r)):e}function r9r(t){return _$(t)&&t.offset!==Lx(t.origin,t.direction)}function fU(t,e){return t.direction===e?t:t.getFlipped()}function Zyt(t,e){return t.direction===e?t:cU(fU(t.focus,e),fU(t.anchor,e))}function n9r(t,e,r){let n=w$(t,"next");for(let o=0;o<e;o++){let i=n.getAdjacentCaret();if(i===null)break;n=i}return fU(n,r)}function Osi(t,e="root"){let r=0,n=t,o=tX(n);for(;o===null;){if(r--,o=n.getParentCaret(e),!o)return null;n=o,o=tX(n)}return o&&[o,r]}function Tsi(t){let{origin:e,offset:r,direction:n}=t;if(r===Lx(e,n))return t.getSiblingCaret();if(r===Lx(e,pU(n)))return iX(t.getSiblingCaret());let[o]=e.splitText(r);return xr(o)||We(281),fU(Bh(o,"next"),n)}function Esi(t,e){return!0}function Psi(t,{$copyElementNode:e=Uyt,$splitTextPointCaretNext:r=Tsi,rootMode:n="shadowRoot",$shouldSplit:o=Esi}={}){if(_$(t))return r(t);let i=t.getParentCaret(n);if(i){let{origin:a}=i;if($x(t)&&(!a.canBeEmpty()||!o(a,"first")))return iX(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 me=Xyt,$0s=me.$addUpdateTag,L0s=me.$applyNodeReplacement,aX=me.$caretFromPoint,o9r=me.$caretRangeFromSelection,mU=me.$cloneWithProperties,F0s=me.$comparePointCaretNext,k0s=me.$copyNode,q0s=me.$create,Yyt=me.$createLineBreakNode,B0s=me.$createNodeSelection,C$=me.$createParagraphNode,U0s=me.$createPoint,w$e=me.$createRangeSelection,z0s=me.$createRangeSelectionFromDom,i9r=me.$createTabNode,ww=me.$createTextNode,a9r=me.$extendCaretToRange,pde=me.$getAdjacentChildCaret,H0s=me.$getAdjacentNode,V0s=me.$getAdjacentSiblingOrParentSiblingCaret,Qyt=me.$getCaretInDirection,s9r=me.$getCaretRange,J0s=me.$getCaretRangeInDirection,u9r=me.$getCharacterOffsets,hU=me.$getChildCaret,K0s=me.$getChildCaretAtIndex,ebt=me.$getChildCaretOrSelf,l9r=me.$getCollapsedCaretRange,W0s=me.$getCommonAncestor,G0s=me.$getCommonAncestorResultBranchOrder,S$e=me.$getEditor,Z0s=me.$getNearestNodeFromDOMNode,X0s=me.$getNearestRootOrShadowRoot,c9r=me.$getNodeByKey,Y0s=me.$getNodeByKeyOrThrow,mde=me.$getPreviousSelection,es=me.$getRoot,cn=me.$getSelection,x$=me.$getSiblingCaret,d9r=me.$getState,Q0s=me.$getStateChange,eCs=me.$getTextContent,tCs=me.$getTextNodeOffset,rCs=me.$getTextPointCaret,nCs=me.$getTextPointCaretSlice,oCs=me.$getWritableNodeState,f9r=me.$hasAncestor,iCs=me.$hasUpdateTag,aCs=me.$insertNodes,C$e=me.$isBlockElementNode,hde=me.$isChildCaret,x$e=me.$isDecoratorNode,ii=me.$isElementNode,p9r=me.$isExtendableTextPointCaret,sCs=me.$isInlineElementOrDecoratorNode,m9r=me.$isLeafNode,uCs=me.$isLineBreakNode,lCs=me.$isNodeCaret,cCs=me.$isNodeSelection,h9r=me.$isParagraphNode,Pr=me.$isRangeSelection,sX=me.$isRootNode,o3=me.$isRootOrShadowRoot,g9r=me.$isSiblingCaret,dCs=me.$isTabNode,Ui=me.$isTextNode,O$e=me.$isTextPointCaret,fCs=me.$isTextPointCaretSlice,tbt=me.$isTokenOrSegmented,pCs=me.$isTokenOrTab,mCs=me.$nodesOfType,y9r=me.$normalizeCaret,hCs=me.$normalizeSelection__EXPERIMENTAL,gCs=me.$onUpdate,b9r=me.$parseSerializedNode,yCs=me.$removeTextFromCaretRange,_9r=me.$rewindSiblingCaret,T$e=me.$selectAll,bCs=me.$setCompositionKey,_Cs=me.$setPointFromCaret,i3=me.$setSelection,v9r=me.$setSelectionFromCaretRange,w9r=me.$setState,S9r=me.$splitAtPointCaretNext,C9r=me.$splitNode,vCs=me.$updateRangeSelectionFromCaretRange,rbt=me.ArtificialNode__DO_NOT_USE,x9r=me.BLUR_COMMAND,gde=me.CAN_REDO_COMMAND,yde=me.CAN_UNDO_COMMAND,O9r=me.CLEAR_EDITOR_COMMAND,T9r=me.CLEAR_HISTORY_COMMAND,wCs=me.CLICK_COMMAND,SCs=me.COLLABORATION_TAG,E$e=me.COMMAND_PRIORITY_CRITICAL,Zu=me.COMMAND_PRIORITY_EDITOR,O$=me.COMMAND_PRIORITY_HIGH,E9r=me.COMMAND_PRIORITY_LOW,CCs=me.COMMAND_PRIORITY_NORMAL,P9r=me.CONTROLLED_TEXT_INSERTION_COMMAND,P$e=me.COPY_COMMAND,M9r=me.CUT_COMMAND,uX=me.DELETE_CHARACTER_COMMAND,R9r=me.DELETE_LINE_COMMAND,A9r=me.DELETE_WORD_COMMAND,xCs=me.DRAGEND_COMMAND,OCs=me.DRAGOVER_COMMAND,I9r=me.DRAGSTART_COMMAND,N9r=me.DROP_COMMAND,M$e=me.DecoratorNode,TCs=me.ElementNode,ECs=me.FOCUS_COMMAND,PCs=me.FORMAT_ELEMENT_COMMAND,MCs=me.FORMAT_TEXT_COMMAND,R$e=me.HISTORIC_TAG,lX=me.HISTORY_MERGE_TAG,j9r=me.HISTORY_PUSH_TAG,RCs=me.INDENT_CONTENT_COMMAND,nbt=me.INSERT_LINE_BREAK_COMMAND,D9r=me.INSERT_PARAGRAPH_COMMAND,ACs=me.INSERT_TAB_COMMAND,bde=me.INTERNAL_$isBlock,ICs=me.IS_ALL_FORMATTING,NCs=me.IS_BOLD,jCs=me.IS_CODE,DCs=me.IS_HIGHLIGHT,$Cs=me.IS_ITALIC,LCs=me.IS_STRIKETHROUGH,FCs=me.IS_SUBSCRIPT,kCs=me.IS_SUPERSCRIPT,qCs=me.IS_UNDERLINE,$9r=me.KEY_ARROW_DOWN_COMMAND,L9r=me.KEY_ARROW_LEFT_COMMAND,F9r=me.KEY_ARROW_RIGHT_COMMAND,k9r=me.KEY_ARROW_UP_COMMAND,q9r=me.KEY_BACKSPACE_COMMAND,B9r=me.KEY_DELETE_COMMAND,BCs=me.KEY_DOWN_COMMAND,cX=me.KEY_ENTER_COMMAND,U9r=me.KEY_ESCAPE_COMMAND,UCs=me.KEY_MODIFIER_COMMAND,zCs=me.KEY_SPACE_COMMAND,z9r=me.KEY_TAB_COMMAND,HCs=me.LineBreakNode,VCs=me.MOVE_TO_END,JCs=me.MOVE_TO_START,KCs=me.NODE_STATE_KEY,WCs=me.OUTDENT_CONTENT_COMMAND,A$e=me.PASTE_COMMAND,H9r=me.PASTE_TAG,GCs=me.ParagraphNode,V9r=me.REDO_COMMAND,J9r=me.REMOVE_TEXT_COMMAND,ZCs=me.RootNode,XCs=me.SELECTION_CHANGE_COMMAND,K9r=me.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,W9r=me.SELECT_ALL_COMMAND,YCs=me.SKIP_COLLAB_TAG,QCs=me.SKIP_DOM_SELECTION_TAG,exs=me.SKIP_SCROLL_INTO_VIEW_TAG,txs=me.TEXT_TYPE_TO_FORMAT,rxs=me.TabNode,kI=me.TextNode,G9r=me.UNDO_COMMAND,nxs=me.buildImportMap,Z9r=me.createCommand,X9r=me.createEditor,oxs=me.createSharedNodeState,ixs=me.createState,axs=me.flipDirection,sxs=me.getDOMOwnerDocument,obt=me.getDOMSelection,uxs=me.getDOMSelectionFromTarget,Y9r=me.getDOMTextNode,lxs=me.getEditorPropertyFromDOMNode,cxs=me.getNearestEditorFromDOMNode,Q9r=me.getRegisteredNode,dxs=me.getRegisteredNodeOrThrow,e7r=me.isBlockDomNode,fxs=me.isCurrentlyReadOnlyMode,pxs=me.isDOMDocumentNode,mxs=me.isDOMNode,hxs=me.isDOMTextNode,gxs=me.isDOMUnmanaged,ibt=me.isDocumentFragment,yxs=me.isExactShortcutMatch,t7r=me.isHTMLAnchorElement,I$e=me.isHTMLElement,_de=me.isInlineDomNode,bxs=me.isLexicalEditor,_xs=me.isModifierMatch,vxs=me.isSelectionCapturedInDecoratorInput,r7r=me.isSelectionWithinEditor,abt=me.makeStepwiseIterator,wxs=me.removeFromParent,Sxs=me.resetRandomKey,Cxs=me.setDOMUnmanaged,xxs=me.setNodeIndentFromDOM;var v7r=L(X());On();var wi=L(X());Ro();var N$e=L(X());Oye();jn();var Msi=IK("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"}}),qb=N$e.forwardRef(({className:t,variant:e,...r},n)=>N$e.createElement("div",{ref:n,className:Oe(Msi({variant:e}),t),...r}));qb.displayName="Badge";var Ii=L(X());On();Ro();var dX=L(X());jn();var j$e=L(X()),Rsi=2;function Asi(t,e){return e&&e>1?t.current?t.current.offsetHeight<t.current.scrollHeight:!1:(t.current&&t.current?.offsetWidth+Rsi<t.current?.scrollWidth)??!1}function Isi(t){switch(t){case 2:return"tw-line-clamp-2";case 3:return"tw-line-clamp-3";default:return""}}var pm=({children:t,className:e,lineClamp:r,tooltipContent:n,alwaysShowTooltip:o=!1,...i})=>{let a=(0,j$e.useRef)(null),[s,u]=(0,j$e.useState)(!1);return dX.default.createElement(tv,{delayDuration:0},dX.default.createElement(Kn,{open:s,onOpenChange:c=>{u(c&&(o||Asi(a,r)))}},dX.default.createElement(Wn,{asChild:!0},dX.default.createElement("div",{...i,ref:a,className:Oe("tw-max-w-full tw-text-normal",(!r||r<=1)&&"tw-truncate",r&&Isi(r),e),"data-testid":"truncatedText"},t)),dX.default.createElement(Mn,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},n??t)))};var n7r=L(X());jn();function fX({children:t,className:e,hasRemoveButton:r=!1,...n}){return n7r.default.createElement(qb,{variant:"default",className:Oe("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",e),...n},t)}function o7r({currentActiveFile:t,onRemove:e}){if(!t)return null;let r=Ii.default.createElement("div",{className:"tw-text-left"},t.path),n=t.extension==="pdf";return Ii.default.createElement(fX,{hasRemoveButton:!!e},Ii.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ii.default.createElement(ic,{className:"tw-size-3"}),Ii.default.createElement(pm,{className:"tw-max-w-40",tooltipContent:r,alwaysShowTooltip:!0},t.basename),Ii.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),n&&Ii.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")),e&&Ii.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:e,"aria-label":"Remove from context",className:"tw-text-muted"},Ii.default.createElement(pi,{className:"tw-size-4"})))}function D$e({note:t,onRemove:e}){let r=Ii.default.createElement("div",{className:"tw-text-left"},t.path),n=t.extension==="pdf";return Ii.default.createElement(fX,{hasRemoveButton:!!e},Ii.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ii.default.createElement(ic,{className:"tw-size-3"}),Ii.default.createElement(pm,{className:"tw-max-w-40",tooltipContent:r,alwaysShowTooltip:!0},t.basename),n&&Ii.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")),e&&Ii.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:e,"aria-label":"Remove from context",className:"tw-text-muted"},Ii.default.createElement(pi,{className:"tw-size-4"})))}function $$e({url:t,onRemove:e}){return Ii.default.createElement(fX,{hasRemoveButton:!!e},Ii.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ii.default.createElement(KN,{className:"tw-size-3"}),Ii.default.createElement(pm,{className:"tw-max-w-40",tooltipContent:t},(n=>{try{return new URL(n).hostname.replace(/^www\./,"")}catch{return n}})(t))),e&&Ii.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:e,"aria-label":"Remove from context",className:"tw-text-muted"},Ii.default.createElement(pi,{className:"tw-size-4"})))}function i7r({tag:t,onRemove:e}){let r=t.startsWith("#")?t.slice(1):t;return Ii.default.createElement(fX,{hasRemoveButton:!!e},Ii.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ii.default.createElement(xte,{className:"tw-size-3"}),Ii.default.createElement(pm,{className:"tw-max-w-40",tooltipContent:t},r)),e&&Ii.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:e,"aria-label":"Remove from context",className:"tw-text-muted"},Ii.default.createElement(pi,{className:"tw-size-4"})))}function L$e({folder:t,onRemove:e}){return Ii.default.createElement(fX,{hasRemoveButton:!!e},Ii.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Ii.default.createElement(sh,{className:"tw-size-3"}),Ii.default.createElement(pm,{className:"tw-max-w-40",tooltipContent:t,alwaysShowTooltip:!0},t)),e&&Ii.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:e,"aria-label":"Remove from context",className:"tw-text-muted"},Ii.default.createElement(pi,{className:"tw-size-4"})))}gd();var F$e=L(X());var c7r=L(X(),1);var a7r=L(X(),1),Nsi=L(Bu(),1);ah();var s7r=L(mt(),1),jsi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],u7r=jsi.reduce((t,e)=>{let r=Ji(`Primitive.${e}`),n=a7r.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,s7r.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var d7r=L(mt(),1),Dsi="Separator",l7r="horizontal",$si=["horizontal","vertical"],f7r=c7r.forwardRef((t,e)=>{let{decorative:r,orientation:n=l7r,...o}=t,i=Lsi(n)?n:l7r,s=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return(0,d7r.jsx)(u7r.div,{"data-orientation":i,...s,...o,ref:e})});f7r.displayName=Dsi;function Lsi(t){return $si.includes(t)}var sbt=f7r;jn();var a3=F$e.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},o)=>F$e.createElement(sbt,{ref:o,decorative:r,orientation:e,className:Oe("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}));a3.displayName=sbt.displayName;Tu();wr();var dv=L(X());var p7r=L(X());var bu=L(X());On();jn();var ksi=120,qsi=240;function k$e({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,bu.useRef)(null),m=(0,bu.useRef)(null),[h,g]=bu.default.useState(null);(0,bu.useEffect)(()=>{g(null)},[e]),(0,bu.useEffect)(()=>{p.current&&p.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[e]);let y=w=>{let x=w.target.value;l?.(x)},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 bu.default.createElement("div",{className:Oe("tw-flex tw-flex-col",d)},_&&bu.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:ksi,maxHeight:qsi,...f&&{width:f}}},bu.default.createElement("div",{className:"tw-mb-1 tw-text-xs tw-text-muted"},"Preview"),t[e].subtitle&&bu.default.createElement("div",{className:"tw-mb-2 tw-text-xs tw-text-muted"},t[e].subtitle),bu.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-normal"},t[e].content)),bu.default.createElement("div",{className:"tw-overflow-hidden tw-rounded-lg tw-bg-primary",style:{...f&&{width:f}}},bu.default.createElement("div",{className:"tw-overflow-y-auto",style:{minHeight:Math.min(t.length*44+16,100),maxHeight:240}},bu.default.createElement("div",{className:"tw-p-2 tw-text-normal"},t.map((w,x)=>{let O=x===e,T=O||x===h,R=i==="category"&&!o&&w.icon&&!("data"in w);return bu.default.createElement("div",{key:w.key,ref:O?p:void 0,className:Oe("tw-flex tw-cursor-pointer tw-items-center tw-rounded-md tw-px-3 tw-py-2 tw-text-sm tw-text-normal",T&&"tw-bg-modifier-hover"),onMouseDown:N=>{N.preventDefault(),r(w)},onMouseEnter:()=>{g(x),n(x)},onMouseLeave:()=>g(null)},R?bu.default.createElement("div",{className:"tw-flex tw-w-full tw-items-center tw-justify-between"},bu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},w.icon,bu.default.createElement("span",{className:"tw-font-medium"},w.title)),bu.default.createElement(tg,{className:"tw-size-4 tw-text-muted"})):bu.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-items-center tw-gap-2"},w.icon&&bu.default.createElement("div",{className:"tw-flex tw-h-full tw-shrink-0 tw-items-center"},w.icon),bu.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col tw-gap-0.5"},bu.default.createElement("div",{className:"tw-truncate tw-font-medium tw-text-normal"},w.title),w.subtitle&&bu.default.createElement("div",{className:"tw-truncate tw-text-xs tw-text-muted"},w.subtitle))))}))),s&&bu.default.createElement("div",{className:"tw-border-t tw-border-solid tw-border-border tw-p-0.5"},bu.default.createElement("input",{ref:m,type:"text",value:u,onChange:y,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 m7r({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 p7r.default.createElement(k$e,{options:t,selectedIndex:e,onSelect:r,onHighlight:n,query:o,mode:i,showPreview:a,searchBarMode:s,searchQuery:u,onSearchChange:l,onKeyDown:c})}var pX=L(X());On();var Bsi=[{key:"notes",title:"Notes",subtitle:"Reference notes in your vault",category:"notes",icon:pX.default.createElement(ic,{className:"tw-size-4"})},{key:"tools",title:"Tools",subtitle:"AI tools and commands",category:"tools",icon:pX.default.createElement(Dv,{className:"tw-size-4"})},{key:"folders",title:"Folders",subtitle:"Reference vault folders",category:"folders",icon:pX.default.createElement(sh,{className:"tw-size-4"})}];function q$e(t=!1){return(0,pX.useMemo)(()=>Bsi.filter(e=>e.category==="tools"?t:!0),[t])}var Ux=L(X());On();var fbt=L(vde());Tue();vue();var g7r=L(X());TN();TN();var Bx=require("obsidian"),wde=L(xOe());Pt();wr();Dt();var U$e=250,ubt=th([]),lbt=th([]),cbt=th([]),dbt=th([]),s3=class s3{constructor(){this.initialized=!1;this.handleFileCreate=e=>{e instanceof Bx.TFile?(e.extension==="md"||e.extension==="pdf")&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof Bx.TFolder&&this.debouncedRefreshFolders()};this.handleFileDelete=e=>{e instanceof Bx.TFile?(e.extension==="md"||e.extension==="pdf")&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof Bx.TFolder&&this.debouncedRefreshFolders()};this.handleFileRename=(e,r)=>{e instanceof Bx.TFile?(e.extension==="md"||e.extension==="pdf")&&(this.debouncedRefreshNotes(),this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll()):e instanceof Bx.TFolder&&this.debouncedRefreshFolders()};this.handleFileModify=e=>{e instanceof Bx.TFile&&e.extension==="md"&&this.debouncedRefreshTagsAll()};this.handleMetadataChange=e=>{e.extension==="md"&&(this.debouncedRefreshTagsFrontmatter(),this.debouncedRefreshTagsAll())};this.debouncedRefreshNotes=(0,wde.default)(()=>this.refreshNotes(),U$e,{leading:!0,trailing:!0});this.debouncedRefreshFolders=(0,wde.default)(()=>this.refreshFolders(),U$e,{leading:!0,trailing:!0});this.debouncedRefreshTagsFrontmatter=(0,wde.default)(()=>this.refreshTagsFrontmatter(),U$e,{leading:!0,trailing:!0});this.debouncedRefreshTagsAll=(0,wde.default)(()=>this.refreshTagsAll(),U$e,{leading:!0,trailing:!0});this.refreshNotes=()=>{if(!app?.vault)return;let e=app.vault.getMarkdownFiles(),n=app.vault.getFiles().filter(i=>i instanceof Bx.TFile&&i.extension==="pdf"),o=[...e,...n];ei.set(ubt,o)};this.refreshFolders=()=>{if(!app?.vault)return;let e=app.vault.getAllLoadedFiles().filter(r=>r instanceof Bx.TFolder);ei.set(lbt,e)};this.refreshTagsFrontmatter=()=>{if(!app?.vault||!app?.metadataCache)return;let e=new Set;app.vault.getMarkdownFiles().forEach(n=>{CO(n,!0).forEach(i=>{let a=i.startsWith("#")?i:`#${i}`;e.add(a)})});let r=Array.from(e).sort();ei.set(cbt,r)};this.refreshTagsAll=()=>{if(!app?.vault||!app?.metadataCache)return;let e=new Set;app.vault.getMarkdownFiles().forEach(n=>{CO(n,!1).forEach(i=>{let a=i.startsWith("#")?i:`#${i}`;e.add(a)})});let r=Array.from(e).sort();ei.set(dbt,r)}}static getInstance(){return s3.instance||(s3.instance=new s3),s3.instance}initialize(){if(this.initialized){J("VaultDataManager: Already initialized, skipping");return}if(!app?.vault){J("VaultDataManager: app.vault not available, deferring initialization");return}J("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&&(J("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()}};s3.instance=null;var Sde=s3;Pt();function z$e(t=!1){let e=Zw(ubt,{store:ei});return(0,g7r.useMemo)(()=>{let r;return t?r=[...e]:r=e.filter(n=>n.extension==="md"),r.sort((n,o)=>o.stat.ctime-n.stat.ctime)},[e,t])}TN();Pt();function y7r(){return Zw(lbt,{store:ei})}Pt();var Cde=30;function H$e(t,e,r,n,o,i=null){let a=z$e(n),s=y7r(),u=(0,Ux.useMemo)(()=>a.map((d,f)=>({key:`note-${d.basename}-${f}`,title:d.basename,subtitle:d.path,category:"notes",data:d,content:void 0,icon:Ux.default.createElement(ic,{className:"tw-size-4"}),searchKeyword:d.path})),[a]),l=(0,Ux.useMemo)(()=>n?Qq.map(d=>({key:`tool-${d}`,title:d,subtitle:tft(d),category:"tools",data:d,content:tft(d),icon:Ux.default.createElement(Dv,{className:"tw-size-4"})})):[],[n]),c=(0,Ux.useMemo)(()=>s.map(d=>({key:`folder-${d.path}`,title:d.name,subtitle:d.path,category:"folders",data:d,content:void 0,icon:Ux.default.createElement(sh,{className:"tw-size-4"}),searchKeyword:d.path})),[s]);return(0,Ux.useMemo)(()=>{if(e==="category"){if(!t){let _=o.map(w=>({...w,content:void 0}));return i?[{key:`active-note-${i.path}`,title:"Active Note",subtitle:void 0,category:"activeNote",data:i,content:void 0,icon:Ux.default.createElement(GN,{className:"tw-size-4"})},..._]:_}let d=t.toLowerCase(),f=l.filter(_=>_.title.toLowerCase().includes(d)),h="active note".includes(d)&&i?{key:`active-note-${i.path}`,title:"Active Note",subtitle:void 0,category:"activeNote",data:i,content:void 0,icon:Ux.default.createElement(GN,{className:"tw-size-4"})}:null,g=[...u,...c],b=fbt.default.go(t,g,{keys:["searchKeyword"],limit:Cde,threshold:-1e4}).map(_=>_.obj);return[...f,...h?[h]:[],...b].slice(0,Cde)}else{let d=[];switch(r){case"notes":d=u;break;case"tools":d=l;break;case"folders":d=c;break}if(!t){if(r==="notes"){let p=ce().customPromptsFolder,m=d.filter(g=>!(typeof g.data=="object"&&"path"in g.data&&typeof g.data.path=="string"&&g.data.path.startsWith(p+"/"))),h=d.filter(g=>typeof g.data=="object"&&"path"in g.data&&typeof g.data.path=="string"&&g.data.path.startsWith(p+"/"));return[...m,...h].slice(0,Cde)}return d.slice(0,Cde)}return fbt.default.go(t,d,{keys:["title","subtitle"],limit:Cde,threshold:-1e4}).map(p=>p.obj)}},[e,t,r,u,l,c,o,i])}function Usi(t){return"data"in t}function zsi(t){return"icon"in t&&!("data"in t)}function b7r({isOpen:t,onClose:e,onSelect:r,isCopilotPlus:n=!1,currentActiveFile:o=null}){let[i,a]=(0,dv.useState)(""),[s,u]=(0,dv.useState)(0),[l,c]=(0,dv.useState)({mode:"category"}),d=q$e(n),f=H$e(i,l.mode,l.selectedCategory,n,d,o),p=(0,dv.useCallback)(y=>{if(l.mode==="category"&&zsi(y)&&!i){c(b=>({...b,mode:"search",selectedCategory:y.category})),a(""),u(0);return}Usi(y)&&(r(y.category,y.data),e())},[l.mode,i,r,e]),m=(0,dv.useCallback)(y=>{u(y)},[]),h=(0,dv.useCallback)(y=>{a(y),u(0)},[]),g=(0,dv.useCallback)(y=>{switch(y.key){case"ArrowDown":{y.preventDefault();let b=Math.min(s+1,f.length-1);u(b);break}case"ArrowUp":{y.preventDefault();let b=Math.max(s-1,0);u(b);break}case"Enter":case"Tab":{y.preventDefault(),f[s]&&p(f[s]);break}case"Escape":{y.preventDefault(),e();break}case"Backspace":{l.mode==="search"&&!i&&(y.preventDefault(),c({mode:"category",selectedCategory:void 0}),u(0));break}}},[s,f,p,e,l.mode,i]);return(0,dv.useEffect)(()=>{t||(a(""),u(0),c({mode:"category",selectedCategory:void 0}))},[t]),(0,dv.useEffect)(()=>{u(0)},[f.length]),t?dv.default.createElement(m7r,{options:f,selectedIndex:s,onSelect:p,onHighlight:m,query:i,mode:l.mode,showPreview:!1,searchBarMode:!0,searchQuery:i,onSearchChange:h,onKeyDown:g}):null}function Hsi({selectedText:t,onRemoveContext:e}){let r=t.startLine===t.endLine?`L${t.startLine}`:`L${t.startLine}-${t.endLine}`;return wi.default.createElement(qb,{className:"tw-items-center tw-py-0 tw-pl-2 tw-pr-0.5 tw-text-xs"},wi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},wi.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},t.noteTitle),wi.default.createElement("span",{className:"tw-text-xs tw-text-faint"},r)),wi.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:()=>e("selectedText",t.id),"aria-label":"Remove from context",className:"tw-text-muted"},wi.default.createElement(pi,{className:"tw-size-4"})))}var _7r=({includeActiveNote:t,currentActiveFile:e,contextNotes:r,contextUrls:n,contextFolders:o,selectedTextContexts:i=[],onRemoveContext:a,showProgressCard:s,onTypeaheadSelect:u,lexicalEditorRef:l})=>{let[c]=Ev(),d=xje(),[f,p]=(0,wi.useState)(!1),m=(0,wi.useRef)(null),h=s_(c),g=()=>{p(!1)},y=(O,E)=>{u(O,E),setTimeout(()=>{l?.current&&l.current.focus()},100)},b=wi.default.useMemo(()=>{let O=new Map(r.map(E=>[E.path,E]));return Array.from(O.values())},[r]),_=wi.default.useMemo(()=>Array.from(new Set(n)),[n]),w=b.length>0||_.length>0||i.length>0||o.length>0||t,x=()=>{switch(d){case"success":return wi.default.createElement(WL,{className:"tw-size-4 tw-text-success"});case"loading":return wi.default.createElement(Zc,{className:"tw-size-4 tw-animate-spin tw-text-loading"});case"error":return wi.default.createElement(FO,{className:"tw-size-4 tw-text-error"});case"initial":return wi.default.createElement(dte,{className:"tw-size-4 tw-text-faint"})}};return wi.default.createElement("div",{className:"tw-flex tw-w-full tw-items-start tw-gap-1"},wi.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},wi.default.createElement(AZ,{open:f,onOpenChange:p},wi.default.createElement(IZ,{asChild:!0},wi.default.createElement(ve,{ref:m,variant:"ghost2",size:"fit",className:"tw-ml-1 tw-rounded-sm tw-border tw-border-solid tw-border-border tw-text-muted"},wi.default.createElement("span",{className:"tw-text-base tw-font-medium tw-leading-none"},"@"),!w&&wi.default.createElement("span",{className:"tw-pr-1 tw-text-sm tw-leading-4"},"Add context"))),wi.default.createElement(zJ,{className:"tw-w-[400px] tw-p-0",align:"start",side:"top",sideOffset:4},wi.default.createElement(b7r,{isOpen:f,onClose:g,onSelect:y,isCopilotPlus:h,currentActiveFile:e})))),wi.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-wrap tw-gap-1"},t&&wi.default.createElement(o7r,{currentActiveFile:e,onRemove:()=>a("activeNote","")}),b.map(O=>wi.default.createElement(D$e,{key:O.path,note:O,onRemove:()=>a("notes",O.path)})),_.map(O=>wi.default.createElement($$e,{key:O,url:O,onRemove:()=>a("urls",O)})),o.map(O=>wi.default.createElement(L$e,{key:O,folder:O,onRemove:()=>a("folders",O)})),i.map(O=>wi.default.createElement(Hsi,{key:O.id,selectedText:O,onRemoveContext:a}))),c==="project"&&wi.default.createElement(wi.default.Fragment,null,wi.default.createElement(a3,{orientation:"vertical"}),wi.default.createElement("div",{className:""},wi.default.createElement(ve,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>s()},x()))))};var w7r=({contextNotes:t,includeActiveNote:e,activeNote:r,contextUrls:n,contextFolders:o,selectedTextContexts:i,showProgressCard:a,lexicalEditorRef:s,onAddToContext:u,onRemoveFromContext:l})=>v7r.default.createElement(_7r,{includeActiveNote:e,currentActiveFile:r,contextNotes:t,onRemoveContext:(f,p)=>{l(f,p)},contextUrls:n,contextFolders:o,selectedTextContexts:i,showProgressCard:a,onTypeaheadSelect:(f,p)=>{u(f,p)},lexicalEditorRef:s});var l3=L(X());var C7r=L(X());var S7r=L(X());jn();function zx({children:t,className:e,...r}){return S7r.default.createElement(qb,{variant:"secondary",className:Oe("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 M0=class extends M$e{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 C7r.default.createElement(zx,null,this.__value)}};var Sw=L(X());jn();function u3({content:t,openBracket:e,closeBracket:r,className:n,maxWidth:o="tw-max-w-40",tooltipContent:i}){let a=(0,Sw.useRef)(null),[s,u]=(0,Sw.useState)(!1);return Sw.default.createElement(tv,{delayDuration:300},Sw.default.createElement(Kn,{open:s,onOpenChange:c=>{let d=a.current?a.current.offsetWidth<a.current.scrollWidth:!1;u(c&&d)}},Sw.default.createElement(Wn,{asChild:!0},Sw.default.createElement("span",{className:Oe("tw-inline-flex tw-items-center",o,n)},Sw.default.createElement("span",{className:"tw-shrink-0"},e),Sw.default.createElement("span",{ref:a,className:"tw-min-w-0 tw-truncate"},t),Sw.default.createElement("span",{className:"tw-shrink-0"},r))),Sw.default.createElement(Mn,{className:"tw-max-w-64 tw-text-wrap tw-break-words"},i||`${e}${t}${r}`)))}var mX=class t extends M0{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:Vsi,priority:1}:null}}static importJSON(e){let{noteTitle:r,notePath:n}=e;return xde(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().endsWith(".pdf")?`${this.__noteTitle}.pdf`:this.__noteTitle;return e.textContent=`[[${r}]]`,{element:e}}getTextContent(){return`[[${this.__notePath.toLowerCase().endsWith(".pdf")?`${this.__noteTitle}.pdf`:this.__noteTitle}]]`}getNoteTitle(){return this.__noteTitle}getNotePath(){return this.__notePath}decorate(){return l3.default.createElement(Jsi,{node:this})}};function Vsi(t){let e=t.getAttribute("data-note-title"),r=t.getAttribute("data-note-path");return e&&r?{node:xde(e,r)}:null}function Jsi({node:t}){let e=t.getNoteTitle(),r=t.getNotePath(),n=r.toLowerCase().endsWith(".pdf");return l3.default.createElement(zx,null,l3.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},l3.default.createElement(u3,{content:e,openBracket:"[[",closeBracket:"]]",tooltipContent:l3.default.createElement("div",{className:"tw-text-left"},r)}),n&&l3.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")))}function xde(t,e){return new mX(t,e)}function pbt(t){return t instanceof mX}function x7r(t){let e=es(),r=0;function n(o){if(pbt(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 R0=L(X());var hX=L(X()),O7r=(0,hX.createContext)(void 0);function T7r(){let t=(0,hX.useContext)(O7r);return t===void 0?null:t.currentActiveFile}function E7r({currentActiveFile:t,children:e}){return hX.default.createElement(O7r.Provider,{value:{currentActiveFile:t}},e)}var gX=class t extends M0{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:Ksi,priority:2}:null}}static importJSON(e){return Ode()}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 R0.default.createElement(Wsi,null)}};function Ksi(t){return{node:Ode()}}function Wsi(){let t=T7r();if(!t)return R0.default.createElement(zx,null,R0.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},R0.default.createElement(u3,{content:"activeNote",openBracket:"{",closeBracket:"}",tooltipContent:R0.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 R0.default.createElement(zx,null,R0.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},R0.default.createElement(u3,{content:e,openBracket:"[[",closeBracket:"]]",tooltipContent:R0.default.createElement("div",{className:"tw-text-left"},r)}),R0.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Current"),n&&R0.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"pdf")))}function Ode(){return new gX}function mbt(t){return t instanceof gX}function P7r(){let t=es(),e=0;function r(n){if(mbt(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 Tde=L(X());var c3=class t extends M0{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:Gsi,priority:1}:null}}static importJSON(e){let{url:r,title:n,isActive:o}=e;return V$e(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 Tde.default.createElement(zx,{className:"tw-whitespace-nowrap"},Tde.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Tde.default.createElement("span",{className:"tw-max-w-40 tw-truncate"},e),this.__isActive&&Tde.default.createElement("span",{className:"tw-text-xs tw-text-faint"},"Active")))}};function Gsi(t){let e=t.getAttribute("data-url"),r=t.getAttribute("data-title");return e!==null?{node:V$e(e,r||void 0)}:null}function V$e(t,e,r=!1){return new c3(t,e,r)}function Zsi(){let t=es(),e=[];function r(n){if(n instanceof c3&&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 M7r(t){let e=Zsi();for(let r of e)r.getURL()===t&&r.remove()}function R7r(t){return t instanceof c3}var J$e=L(X());var d3=class t extends M0{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:Xsi,priority:1}:null}}static importJSON(e){let{value:r}=e;return Ede(r)}exportJSON(){return{...super.exportJSON(),type:"folder-pill"}}decorate(){let e=J$e.default.createElement("div",{className:"tw-text-left"},this.getFolderPath());return J$e.default.createElement(zx,null,J$e.default.createElement(u3,{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 Xsi(t){let e=t.getAttribute("data-pill-value");return e!==null?{node:Ede(e)}:null}function Ede(t){return new d3(t)}function A7r(t){return t instanceof d3}function Ysi(){let t=es(),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 I7r(t){let e=Ysi();for(let r of e)r.getValue()===t&&r.remove()}var f3=class t extends M0{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:Qsi,priority:1}:null}}static importJSON(e){let{value:r}=e;return p3(r)}exportJSON(){return{...super.exportJSON(),type:"tool-pill"}}getToolName(){return this.getValue()}};function Qsi(t){let e=t.getAttribute("data-pill-value");return e!==null?{node:p3(e)}:null}function p3(t){return new f3(t)}function N7r(t){return t instanceof f3}function eui(){let t=es(),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 Pde(t){let e=eui();for(let r of e)r.getValue()===t&&r.remove()}var ts=L(X());var hbt={};Xn(hbt,{LexicalComposerContext:()=>j7r,createLexicalComposerContext:()=>tui,useLexicalComposerContext:()=>rui});var K$e=L(X(),1),j7r=(0,K$e.createContext)(null);function tui(t,e){let r=null;return t!=null&&(r=t[1]),{getTheme:function(){return e??(r!=null?r.getTheme():null)}}}function rui(){let t=(0,K$e.useContext)(j7r);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 gbt=hbt,D7r=gbt.LexicalComposerContext,$7r=gbt.createLexicalComposerContext,Si=gbt.useLexicalComposerContext;var ybt={};Xn(ybt,{LexicalComposer:()=>oui});var yX=L(X(),1),L7r=L(mt(),1),F7r=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,nui=F7r?yX.useLayoutEffect:yX.useEffect,W$e={tag:lX};function oui({initialConfig:t,children:e}){let r=(0,yX.useMemo)(()=>{let{theme:n,namespace:o,nodes:i,onError:a,editorState:s,html:u}=t,l=$7r(null,n),c=X9r({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=es();if(p.isEmpty()){let m=C$();p.append(m);let h=F7r?document.activeElement:null;(cn()!==null||h!==null&&h===d.getRootElement())&&m.select()}},W$e);else if(f!==null)switch(typeof f){case"string":{let p=d.parseEditorState(f);d.setEditorState(p,W$e);break}case"object":d.setEditorState(f,W$e);break;case"function":d.update(()=>{es().isEmpty()&&f(d)},W$e)}}}(c,s),[c,l]},[]);return nui(()=>{let n=t.editable,[o]=r;o.setEditable(n===void 0||n)},[]),(0,L7r.jsx)(D7r.Provider,{value:r,children:e})}var iui=ybt,k7r=iui.LexicalComposer;var bbt={};Xn(bbt,{useLexicalEditable:()=>uui});var qI=L(X(),1),aui=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?qI.useLayoutEffect:qI.useEffect;function sui(t){return{initialValueFn:()=>t.isEditable(),subscribe:e=>t.registerEditableListener(e)}}function uui(){return function(t){let[e]=Si(),r=(0,qI.useMemo)(()=>t(e),[e,t]),[n,o]=(0,qI.useState)(()=>r.initialValueFn()),i=(0,qI.useRef)(n);return aui(()=>{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}(sui)}var lui=bbt,q7r=lui.useLexicalEditable;var vbt={};Xn(vbt,{$canShowPlaceholder:()=>U7r,$canShowPlaceholderCurry:()=>dui,$findTextIntersectionFromCharacters:()=>fui,$isRootTextContentEmpty:()=>_bt,$isRootTextContentEmptyCurry:()=>cui,$rootTextContent:()=>B7r,registerLexicalTextEntity:()=>mui});function B7r(){return es().getTextContent()}function _bt(t,e=!0){if(t)return!1;let r=B7r();return e&&(r=r.trim()),r===""}function cui(t,e){return()=>_bt(t,e)}function U7r(t){if(!_bt(t,!1))return!1;let e=es().getChildren(),r=e.length;if(r>1)return!1;for(let n=0;n<r;n++){let o=e[n];if(x$e(o))return!1;if(ii(o)){if(!h9r(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(!Ui(u))return!1}}}return!0}function dui(t){return()=>U7r(t)}function fui(t,e){let r=t.getFirstChild(),n=0;e:for(;r!==null;){if(ii(r)){let a=r.getFirstChild();if(a!==null){r=a;continue}}else if(Ui(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 pui(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 mui(t,e,r,n){let o=a=>a instanceof r,i=a=>{let s=ww(a.getTextContent());s.setFormat(a.getFormat()),a.replace(s)};return[t.registerNodeTransform(kI,a=>{if(!a.isSimpleText())return;let s,u=a.getPreviousSibling(),l=a.getTextContent(),c=a;if(Ui(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 g=l.slice(m);a.setTextContent(g)}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(Ui(h)){p=c.getTextContent()+h.getTextContent();let g=e(p);if(g===null)return void(o(h)?i(h):h.markDirty());if(g.start!==0)return}}if(s===null)return;if(s.start===0&&Ui(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&&pui(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();Ui(l)&&l.isTextEntity()&&(i(l),i(a));let c=a.getNextSibling();Ui(c)&&c.isTextEntity()&&(i(c),o(a)&&i(a))})]}var m3=vbt,cEs=m3.$canShowPlaceholder,G$e=m3.$canShowPlaceholderCurry,dEs=m3.$findTextIntersectionFromCharacters,fEs=m3.$isRootTextContentEmpty,pEs=m3.$isRootTextContentEmptyCurry,mEs=m3.$rootTextContent,hEs=m3.registerLexicalTextEntity;var Tbt={};Xn(Tbt,{$addNodeStyle:()=>_ui,$cloneWithProperties:()=>mU,$copyBlockFormatIndent:()=>X7r,$ensureForwardRangeSelection:()=>Z7r,$forEachSelectedTextNode:()=>G7r,$getSelectionStyleValueForProperty:()=>Eui,$isAtNodeEnd:()=>bui,$isParentElementRTL:()=>Obt,$moveCaretSelection:()=>Q7r,$moveCharacter:()=>Oui,$patchStyleText:()=>vui,$selectAll:()=>T$e,$setBlocksType:()=>wui,$shouldOverrideDefaultCharacterSelection:()=>xui,$sliceSelectedTextNodeContent:()=>yui,$trimTextContentFromAnchor:()=>W7r,$wrapNodes:()=>Cui,createDOMRange:()=>hui,createRectsFromDOMRange:()=>gui,getCSSFromStyleObject:()=>K7r,getStyleObjectFromCSS:()=>X$e,trimTextContentFromAnchor:()=>Pui});function xbt(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 Z$e=new Map;function z7r(t){let e=t;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function H7r(t){let e=t.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(t)]}function hui(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(Ui(e)&&(u=z7r(u)),Ui(n)&&(l=z7r(l)),e===void 0||n===void 0||u===null||l===null)return null;u.nodeName==="BR"&&([u,c]=H7r(u)),l.nodeName==="BR"&&([l,d]=H7r(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 gui(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 J7r(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 X$e(t){let e=Z$e.get(t);return e===void 0&&(e=J7r(t),Z$e.set(t,e)),e}function K7r(t){let e="";for(let r in t)r&&(e+=`${r}: ${t[r]};`);return e}function yui(t,e){let r=t.getStartEndPoints();if(e.isSelected(t)&&!tbt(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]=u9r(t),f=a.is(s),p=e.is(i?s:a),m=e.is(i?a:s),h,g=0;f?(g=c>d?d:c,h=c>d?c:d):p?(g=i?d:c,h=void 0):m&&(g=0,h=i?c:d),e.__text=e.__text.slice(g,h)}}return e}function bui(t){if(t.type==="text")return t.offset===t.getNode().getTextContentSize();let e=t.getNode();return ii(e)||xbt(177),t.offset===e.getChildrenSize()}function W7r(t,e,r){let n=e.getNode(),o=r;if(ii(n)){let i=n.getDescendantByIndex(e.offset);i!==null&&(n=i)}for(;o>0&&n!==null;){if(ii(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===""&&ii(n)&&!n.isInline()&&(s=`
|
||
|
||
`);let u=s.length;if(!Ui(n)||o>=u){let l=n.getParent();n.remove(),l==null||l.getChildrenSize()!==0||sX(l)||l.remove(),o-=u+a,n=i}else{let l=n.getKey(),c=t.getEditorState().read(()=>{let p=c9r(l);return Ui(p)&&p.isSimpleText()?p.getTextContent():null}),d=u-o,f=s.slice(0,d);if(c!==null&&c!==s){let p=mde(),m=n;if(n.isSimpleText())n.setTextContent(c);else{let h=ww(c);n.replace(h),m=h}if(Pr(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,g=p?m:d;if(p&&h===0){let[y]=n.splitText(h,g);y.remove()}else{let[,y]=n.splitText(h,g);y.remove()}}else{let p=ww(f);n.replace(p)}o=0}}}function _ui(t){let e=t.getStyle(),r=J7r(e);Z$e.set(e,r)}function wbt(t,e){(Pr(t)?t.isCollapsed():Ui(t)||ii(t))||xbt(280);let r=X$e(Pr(t)?t.style:Ui(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=K7r(n);Pr(t)||Ui(t)?t.setStyle(o):t.setTextStyle(o),Z$e.set(o,n)}function vui(t,e){if(Pr(t)&&t.isCollapsed()){wbt(t,e);let r=t.anchor.getNode();ii(r)&&r.isEmpty()&&wbt(r,e)}G7r(r=>{wbt(r,e)})}function G7r(t){let e=cn();if(!e)return;let r=new Map;if(Pr(e))for(let i of o9r(e).getTextSlices())i&&r.set(i.caret.origin.getKey(),i.getSliceIndices());let n=e.getNodes();for(let i of n){if(!Ui(i)||!i.canHaveFormat())continue;let[a,s]=(o=i,r.get(o.getKey())||[0,o.getTextContentSize()]);s!==a&&(tbt(i)||a===0&&s===i.getTextContentSize()?t(i):t(i.splitText(a,s)[a===0?0:1]))}var o;Pr(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&Z7r(e)}function Z7r(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 X7r(t,e){let r=t.getFormatType(),n=t.getIndent();r!==e.getFormatType()&&e.setFormat(r),n!==e.getIndent()&&e.setIndent(n)}function wui(t,e,r=X7r){if(t===null)return;let n=t.getStartEndPoints(),o=new Map,i=null;if(n){let[a,s]=n;i=w$e(),i.anchor.set(a.key,a.offset,a.type),i.focus.set(s.key,s.offset,s.type);let u=Cbt(a.getNode(),bde),l=Cbt(s.getNode(),bde);ii(u)&&o.set(u.getKey(),u),ii(l)&&o.set(l.getKey(),l)}for(let a of t.getNodes())if(ii(a)&&bde(a))o.set(a.getKey(),a);else if(n===null){let s=Cbt(a,bde);ii(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(cn())&&i3(i)}function V7r(t){return t.getNode().isAttached()}function Sui(t){let e=t;for(;e!==null&&!o3(e);){let r=e.getLatest(),n=e.getParent();r.getChildrenSize()===0&&e.remove(!0),e=n}}function Cui(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];o3(c)?(Sbt(t,u,u.length,e,r),u=[],s=c):s===null||s!==null&&f9r(c,s)?u.push(c):(Sbt(t,u,u.length,e,r),u=[c])}Sbt(t,u,u.length,e,r)}function Sbt(t,e,r,n,o=null){if(e.length===0)return;let i=e[0],a=new Map,s=[],u=ii(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(),o3(u))break}let c=new Set;for(let m=0;m<r;m++){let h=e[m];ii(h)&&h.getChildrenSize()===0&&c.add(h.getKey())}let d=new Set;for(let m=0;m<r;m++){let h=e[m],g=h.getParent();if(g!==null&&g.isInline()&&(g=g.getParent()),g!==null&&m9r(h)&&!d.has(h.getKey())){let y=g.getKey();if(a.get(y)===void 0){let b=n();b.setFormat(g.getFormatType()),b.setIndent(g.getIndent()),s.push(b),a.set(y,b),g.getChildren().forEach(_=>{b.append(_),d.add(_.getKey()),ii(_)&&_.getChildrenKeys().forEach(w=>d.add(w))}),Sui(g)}}else if(c.has(h.getKey())){ii(h)||xbt(179);let y=n();y.setFormat(h.getFormatType()),y.setIndent(h.getIndent()),s.push(y),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(o3(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(ii(m)&&(u=m),m===null)if(o)u.append(o);else for(let h=0;h<s.length;h++){let g=s[h];u.append(g),f=g}else if(o!==null)m.insertBefore(o);else for(let h=0;h<s.length;h++){let g=s[h];m.insertBefore(g),f=g}}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=mde();Pr(p)&&V7r(p.anchor)&&V7r(p.focus)?i3(p.clone()):f!==null?f.selectEnd():t.dirty=!0}function Y7r(t){let e=t.anchor.getNode(),r=sX(e)?e:e.getParentOrThrow(),n=S$e().getElementByKey(r.getKey());if(n===null)return!1;let o=n.ownerDocument.defaultView;return o===null?!1:o.getComputedStyle(n).writingMode==="vertical-rl"}function xui(t,e){let r=Y7r(t)?!e:e;Obt(t)&&(r=!r);let n=aX(t.focus,r?"previous":"next");if(p9r(n))return!1;for(let o of a9r(n)){if(hde(o))return!o.origin.isInline();if(!ii(o.origin)){if(x$e(o.origin))return!0;break}}return!1}function Q7r(t,e,r,n){t.modify(e?"extend":"move",r,n)}function Obt(t){let e=t.anchor.getNode();return(sX(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Oui(t,e,r){let n=Obt(t),o;o=Y7r(t)||n?!r:r,Q7r(t,e,o,"character")}function Tui(t,e,r){let n=X$e(t.getStyle());return n!==null&&n[e]||r}function Eui(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(Pr(t)&&t.isCollapsed()&&t.style!==""){let c=X$e(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))&&Ui(d)){let f=Tui(d,e,r);if(n===null)n=f;else if(n!==f){n="";break}}}return n===null?r:n}function Cbt(t,e){let r=t;for(;r!==null&&r.getParent()!==null&&!e(r);)r=r.getParentOrThrow();return e(r)?r:null}var Pui=W7r;var kc=Tbt,eZr=kc.$addNodeStyle,_Es=kc.$cloneWithProperties,vEs=kc.$copyBlockFormatIndent,wEs=kc.$ensureForwardRangeSelection,SEs=kc.$forEachSelectedTextNode,CEs=kc.$getSelectionStyleValueForProperty,xEs=kc.$isAtNodeEnd,OEs=kc.$isParentElementRTL,TEs=kc.$moveCaretSelection,Ebt=kc.$moveCharacter,EEs=kc.$patchStyleText,PEs=kc.$selectAll,MEs=kc.$setBlocksType,Pbt=kc.$shouldOverrideDefaultCharacterSelection,Y$e=kc.$sliceSelectedTextNodeContent,REs=kc.$trimTextContentFromAnchor,AEs=kc.$wrapNodes,IEs=kc.createDOMRange,tZr=kc.createRectsFromDOMRange,NEs=kc.getCSSFromStyleObject,jEs=kc.getStyleObjectFromCSS,DEs=kc.trimTextContentFromAnchor;var Ibt={};Xn(Ibt,{$descendantsMatching:()=>pli,$dfs:()=>Zui,$dfsIterator:()=>dZr,$filter:()=>uli,$findMatchingParent:()=>hZr,$firstToLastIterator:()=>mli,$getAdjacentCaret:()=>Xui,$getAdjacentSiblingOrParentSiblingCaret:()=>Mde,$getDepth:()=>pZr,$getNearestBlockElementAncestorOrThrow:()=>rli,$getNearestNodeOfType:()=>tli,$getNextRightPreorderNode:()=>eli,$getNextSiblingOrParentSibling:()=>Qui,$insertFirst:()=>lli,$insertNodeToNearestRoot:()=>ili,$insertNodeToNearestRootAtCaret:()=>gZr,$isEditorIsNestedEditor:()=>dli,$lastToFirstIterator:()=>Abt,$restoreEditorState:()=>oli,$reverseDfs:()=>Yui,$reverseDfsIterator:()=>mZr,$splitNode:()=>C9r,$unwrapAndFilterDescendants:()=>fli,$unwrapNode:()=>hli,$wrapNodeInElement:()=>ali,CAN_USE_BEFORE_INPUT:()=>kui,CAN_USE_DOM:()=>uZr,IS_ANDROID:()=>qui,IS_ANDROID_CHROME:()=>Bui,IS_APPLE:()=>Uui,IS_APPLE_WEBKIT:()=>zui,IS_CHROME:()=>Hui,IS_FIREFOX:()=>lZr,IS_IOS:()=>Vui,IS_SAFARI:()=>Jui,addClassNamesToElement:()=>Kui,calculateZoomLevel:()=>cli,isBlockDomNode:()=>e7r,isHTMLAnchorElement:()=>t7r,isHTMLElement:()=>I$e,isInlineDomNode:()=>_de,isMimeType:()=>cZr,makeStateWrapper:()=>gli,markSelection:()=>sZr,mediaFileReader:()=>Gui,mergeRegister:()=>iZr,objectKlassEquals:()=>sli,positionNodeOnRange:()=>aZr,registerNestedElementResolver:()=>nli,removeClassNamesFromElement:()=>Wui,selectionAlwaysOnDisplay:()=>Fui});function Q$e(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 Hx=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Mui=Hx&&"documentMode"in document?document.documentMode:null,Rui=Hx&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Aui=Hx&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Iui=!(!Hx||!("InputEvent"in window)||Mui)&&"getTargetRanges"in new window.InputEvent("input"),Nui=Hx&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),jui=Hx&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,nZr=Hx&&/Android/.test(navigator.userAgent),Rbt=Hx&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Dui=Hx&&nZr&&Rbt,$ui=Hx&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Rbt;function oZr(...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 iZr(...t){return()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0}}function BI(t){return`${t}px`}var Lui={attributes:!0,characterData:!0,childList:!0,subtree:!0};function aZr(t,e,r){let n=null,o=null,i=null,a=[],s=document.createElement("div");function u(){n===null&&Q$e(182),o===null&&Q$e(183);let{left:d,top:f}=o.getBoundingClientRect(),p=tZr(t,e);var m,h;s.isConnected||(h=s,(m=o).insertBefore(h,m.firstChild));let g=!1;for(let y=0;y<p.length;y++){let b=p[y],_=a[y]||document.createElement("div"),w=_.style;w.position!=="absolute"&&(w.position="absolute",g=!0);let x=BI(b.left-d);w.left!==x&&(w.left=x,g=!0);let O=BI(b.top-f);w.top!==O&&(_.style.top=O,g=!0);let E=BI(b.width);w.width!==E&&(_.style.width=E,g=!0);let T=BI(b.height);w.height!==T&&(_.style.height=T,g=!0),_.parentNode!==s&&(s.append(_),g=!0),a[y]=_}for(;a.length>p.length;)a.pop();g&&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(!I$e(p))return l();l(),n=f,o=p,i=new MutationObserver(m=>{let h=t.getRootElement(),g=h&&h.parentElement;if(h!==n||g!==o)return d();for(let y of m)if(!s.contains(y.target))return u()}),i.observe(p,Lui),u()});return()=>{c(),l()}}function rZr(t,e,r){if(t.type!=="text"&&ii(e)){let n=e.getDOMSlot(r);return[n.element,n.getFirstChildOffset()+t.offset]}return[Y9r(r)||r,t.offset]}function sZr(t,e){let r=null,n=null,o=null,i=null,a=null,s=null,u=()=>{};function l(c){c.read(()=>{let d=cn();if(!Pr(d))return r=null,o=null,i=null,s=null,u(),void(u=()=>{});let[f,p]=function(T){let R=T.getStartEndPoints();return T.isBackward()?[R[1],R[0]]:R}(d),m=f.getNode(),h=m.getKey(),g=f.offset,y=p.getNode(),b=y.getKey(),_=p.offset,w=t.getElementByKey(h),x=t.getElementByKey(b),O=r===null||w!==n||g!==o||h!==r.getKey(),E=i===null||x!==a||_!==s||b!==i.getKey();if((O||E)&&w!==null&&x!==null){let T=function(R,N,D,F,B,U,H){let G=(R._window?R._window.document:document).createRange();return G.setStart(...rZr(N,D,F)),G.setEnd(...rZr(B,U,H)),G}(t,f,m,w,p,y,x);u(),u=aZr(t,T,R=>{if(e===void 0)for(let N of R){let D=N.style;D.background!=="Highlight"&&(D.background="Highlight"),D.color!=="HighlightText"&&(D.color="HighlightText"),D.marginTop!==BI(-1.5)&&(D.marginTop=BI(-1.5)),D.paddingTop!==BI(4)&&(D.paddingTop=BI(4)),D.paddingBottom!==BI(0)&&(D.paddingBottom=BI(0))}else e(R)})}r=m,n=w,o=g,i=y,a=x,s=_})}return l(t.getEditorState()),iZr(t.registerUpdateListener(({editorState:c})=>l(c)),()=>{u()})}function Fui(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=sZr(t))};return document.addEventListener("selectionchange",r),()=>{e!==null&&e(),document.removeEventListener("selectionchange",r)}}var kui=Iui,uZr=Hx,qui=nZr,Bui=Dui,Uui=Rui,zui=$ui,Hui=Rbt,lZr=Aui,Vui=jui,Jui=Nui;function Kui(t,...e){let r=oZr(...e);r.length>0&&t.classList.add(...r)}function Wui(t,...e){let r=oZr(...e);r.length>0&&t.classList.remove(...r)}function cZr(t,e){for(let r of e)if(t.type.startsWith(r))return!0;return!1}function Gui(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()}),cZr(u,e)?l.readAsDataURL(u):a()};a()})}function Zui(t,e){return Array.from(dZr(t,e))}function Xui(t){return t?t.getAdjacentCaret():null}function Yui(t,e){return Array.from(mZr(t,e))}function dZr(t,e){return fZr("next",t,e)}function fZr(t,e,r){let n=es(),o=e||n,i=ii(o)?hU(o,t):x$(o,t),a=pZr(o),s=r?pde(ebt(x$(r,t))):function(l,c){let d=Mde(x$(l,c));return d&&d[0]}(o,t),u=a;return abt({hasNext:l=>l!==null,initial:i,map:l=>({depth:u,node:l.origin}),step:l=>{if(l.isSameNodeCaret(s))return null;hde(l)&&u++;let c=Mde(l);return!c||c[0].isSameNodeCaret(s)?null:(u+=c[1],c[0])}})}function Qui(t){let e=Mde(x$(t,"next"));return e&&[e[0].origin,e[1]]}function pZr(t){let e=-1;for(let r=t;r!==null;r=r.getParent())e++;return e}function eli(t){let e=Mde(ebt(x$(t,"previous")),"root");return e&&e[0].origin}function mZr(t,e){return fZr("previous",t,e)}function tli(t,e){let r=t;for(;r!=null;){if(r instanceof e)return r;r=r.getParent()}return null}function rli(t){let e=hZr(t,r=>ii(r)&&!r.isInline());return ii(e)||Q$e(4,t.__key),e}var hZr=(t,e)=>{let r=t;for(;r!==es()&&r!=null;){if(e(r))return r;r=r.getParent()}return null};function nli(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 oli(t,e){let r=new Map,n=t._pendingEditorState;for(let[i,a]of e._nodeMap)r.set(i,mU(a));n&&(n._nodeMap=r),t._dirtyType=2;let o=e._selection;i3(o===null?null:o.clone())}function ili(t){let e=cn()||mde(),r;if(Pr(e))r=aX(e.focus,"next");else{if(e!=null){let a=e.getNodes(),s=a[a.length-1];s&&(r=x$(s,"next"))}r=r||hU(es(),"previous").getFlipped().insert(C$())}let n=gZr(t,r),o=pde(n),i=hde(o)?y9r(o):n;return v9r(l9r(i)),t.getLatest()}function gZr(t,e,r){let n=Qyt(e,"next");for(let o=n;o;o=S9r(o,r))n=o;return O$e(n)&&Q$e(283),n.insert(t.isInline()?C$().append(t):t),Qyt(x$(t.getLatest(),"next"),e.direction)}function ali(t,e){let r=e();return t.replace(r),r.append(t),r}function sli(t,e){return t!==null&&Object.getPrototypeOf(t).constructor.name===e.name}function uli(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 lli(t,e){hU(t,"next").insert(e)}var Mbt=!(lZr||!uZr)&&void 0;function cli(t){let e=1;if(function(){if(Mbt===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"),Mbt=r.getBoundingClientRect().width===n.width,document.body.removeChild(r)}return Mbt}())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return e}function dli(t){return t._parentEditor!==null}function fli(t,e){return yZr(t,e,null)}function yZr(t,e,r){let n=!1;for(let o of Abt(t))e(o)?r!==null&&r(o):(n=!0,ii(o)&&yZr(o,e,r||(i=>o.insertAfter(i))),o.remove());return n}function pli(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(ii(o))for(let i of Abt(o))n.push(i);return r}function mli(t){return bZr(hU(t,"next"))}function Abt(t){return bZr(hU(t,"previous"))}function bZr(t){return abt({hasNext:g9r,initial:t.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function hli(t){_9r(x$(t,"next")).splice(1,t.getChildren())}function Mde(t,e="root"){let r=0,n=t,o=pde(n);for(;o===null;){if(r--,o=n.getParentCaret(e),!o)return null;n=o,o=pde(n)}return o&&[o,r]}function gli(t){let e=n=>d9r(n,t),r=(n,o)=>w9r(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 bn=Ibt,qEs=bn.$descendantsMatching,BEs=bn.$dfs,UEs=bn.$dfsIterator,zEs=bn.$filter,HEs=bn.$findMatchingParent,VEs=bn.$firstToLastIterator,JEs=bn.$getAdjacentCaret,KEs=bn.$getAdjacentSiblingOrParentSiblingCaret,WEs=bn.$getDepth,GEs=bn.$getNearestBlockElementAncestorOrThrow,ZEs=bn.$getNearestNodeOfType,XEs=bn.$getNextRightPreorderNode,YEs=bn.$getNextSiblingOrParentSibling,QEs=bn.$insertFirst,ePs=bn.$insertNodeToNearestRoot,tPs=bn.$insertNodeToNearestRootAtCaret,rPs=bn.$isEditorIsNestedEditor,nPs=bn.$lastToFirstIterator,oPs=bn.$restoreEditorState,iPs=bn.$reverseDfs,aPs=bn.$reverseDfsIterator,sPs=bn.$splitNode,uPs=bn.$unwrapAndFilterDescendants,lPs=bn.$unwrapNode,cPs=bn.$wrapNodeInElement,dPs=bn.CAN_USE_BEFORE_INPUT,fPs=bn.CAN_USE_DOM,pPs=bn.IS_ANDROID,mPs=bn.IS_ANDROID_CHROME,hPs=bn.IS_APPLE,gPs=bn.IS_APPLE_WEBKIT,yPs=bn.IS_CHROME,bPs=bn.IS_FIREFOX,_Ps=bn.IS_IOS,vPs=bn.IS_SAFARI,wPs=bn.addClassNamesToElement,SPs=bn.calculateZoomLevel,Nbt=bn.isBlockDomNode,CPs=bn.isHTMLAnchorElement,_Zr=bn.isHTMLElement,xPs=bn.isInlineDomNode,OPs=bn.isMimeType,TPs=bn.makeStateWrapper,EPs=bn.markSelection,PPs=bn.mediaFileReader,T$=bn.mergeRegister,Rde=bn.objectKlassEquals,MPs=bn.positionNodeOnRange,RPs=bn.registerNestedElementResolver,APs=bn.removeClassNamesFromElement,IPs=bn.selectionAlwaysOnDisplay;var jbt={};Xn(jbt,{registerDragonSupport:()=>yli});function yli(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=cn();if(Pr(h)){let g=h.anchor,y=g.getNode(),b=0,_=0;if(Ui(y)&&l>=0&&c>=0&&(b=l,_=l+c,h.setTextNodeRange(y,b,y,_)),b===_&&d===""||(h.insertRawText(d),y=g.getNode()),Ui(y)){b=f,_=f+p;let w=y.getTextContentSize();b=b>w?w:b,_=_>w?w:_,h.setTextNodeRange(y,b,y,_)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",r,!0),()=>{window.removeEventListener("message",r,!0)}}var bli=jbt,vZr=bli.registerDragonSupport;var Dbt={};Xn(Dbt,{$generateHtmlFromNodes:()=>vli,$generateNodesFromDOM:()=>_li});function _li(t,e){let r=e.body?e.body.childNodes:[],n=[],o=[];for(let i=0;i<r.length;i++){let a=r[i];if(!SZr.has(a.nodeName)){let s=CZr(a,t,o,!1);s!==null&&(n=n.concat(s))}}return function(i){for(let a of i)a.getNextSibling()instanceof rbt&&a.insertAfter(Yyt());for(let a of i){let s=a.getChildren();for(let u of s)a.insertBefore(u);a.remove()}}(o),n}function vli(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=es().getChildren();for(let o=0;o<n.length;o++)wZr(t,n[o],r,e);return r.innerHTML}function wZr(t,e,r,n=null){let o=n===null||e.isSelected(n),i=ii(e)&&e.excludeFromCopy("html"),a=e;if(n!==null){let p=mU(e);p=Ui(p)&&n!==null?Y$e(n,p):p,a=p}let s=ii(a)?a.getChildren():[],u=Q9r(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=wZr(t,m,f,n);!o&&ii(e)&&h&&e.extractWithChild(m,n,"html")&&(o=!0)}if(o&&!i){if((_Zr(c)||ibt(c))&&c.append(f),r.append(c),d){let p=d.call(a,c);p&&(ibt(c)?c.replaceChildren(p):c.replaceWith(p))}}else r.append(f);return o}var SZr=new Set(["STYLE","SCRIPT"]);function CZr(t,e,r,n,o=new Map,i){let a=[];if(SZr.has(t.nodeName))return a;let s=null,u=function(m,h){let{nodeName:g}=m,y=h._htmlConversions.get(g.toLowerCase()),b=null;if(y!==void 0)for(let _ of y){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||!o3(s))&&(s!=null&&C$e(s)||n);for(let m=0;m<d.length;m++)f.push(...CZr(d[m],e,r,p,new Map(o),s));return c!=null&&(f=c(f)),Nbt(t)&&(f=wli(t,f,p?()=>{let m=new rbt;return r.push(m),m}:C$)),s==null?f.length>0?a=a.concat(f):Nbt(t)&&function(m){return m.nextSibling==null||m.previousSibling==null?!1:_de(m.nextSibling)&&_de(m.previousSibling)}(t)&&(a=a.concat(Yyt())):ii(s)&&s.append(...f),a}function wli(t,e,r){let n=t.style.textAlign,o=[],i=[];for(let a=0;a<e.length;a++){let s=e[a];if(C$e(s))n&&!s.getFormat()&&s.setFormat(n),o.push(s);else if(i.push(s),a===e.length-1||a<e.length-1&&C$e(e[a+1])){let u=r();u.setFormat(n),u.append(...i),o.push(u),i=[]}}return o}var xZr=Dbt,OZr=xZr.$generateHtmlFromNodes,TZr=xZr.$generateNodesFromDOM;var Lbt={};Xn(Lbt,{$generateJSONFromSelectedNodes:()=>AZr,$generateNodesFromSerializedNodes:()=>IZr,$getClipboardDataFromSelection:()=>NZr,$getHtmlContent:()=>PZr,$getLexicalContent:()=>MZr,$insertDataTransferForPlainText:()=>Sli,$insertDataTransferForRichText:()=>Cli,$insertGeneratedNodes:()=>$bt,copyToClipboard:()=>xli,setLexicalClipboardDataTransfer:()=>jZr});function eLe(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 PZr(t,e=cn()){return e==null&&eLe(166),Pr(e)&&e.isCollapsed()||e.getNodes().length===0?"":OZr(t,e)}function MZr(t,e=cn()){return e==null&&eLe(166),Pr(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(AZr(t,e))}function Sli(t,e){let r=t.getData("text/plain")||t.getData("text/uri-list");r!=null&&e.insertRawText(r)}function Cli(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 $bt(r,IZr(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 $bt(r,TZr(r,s),e)}catch{}let a=i||t.getData("text/uri-list");if(a!=null)if(Pr(e)){let s=a.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let u=0;u<s.length;u++){let l=cn();if(Pr(l)){let c=s[u];c===`
|
||
`||c===`\r
|
||
`?l.insertParagraph():c===" "?l.insertNodes([i9r()]):l.insertText(c)}}}else e.insertRawText(a)}function $bt(t,e,r){t.dispatchCommand(K9r,{nodes:e,selection:r})||(r.insertNodes(e),function(n){if(Pr(n)&&n.isCollapsed()){let o=n.anchor,i=null,a=aX(o,"previous");if(a)if(O$e(a))i=a.origin;else{let s=s9r(a,hU(es(),"next").getFlipped());for(let u of s){if(Ui(u.origin)){i=u.origin;break}if(ii(u.origin)&&!u.origin.isInline())break}}if(i&&Ui(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 RZr(t,e,r,n=[]){let o=e===null||r.isSelected(e),i=ii(r)&&r.excludeFromCopy("html"),a=r;if(e!==null){let l=mU(r);l=Ui(l)&&e!==null?Y$e(e,l):l,a=l}let s=ii(a)?a.getChildren():[],u=function(l){let c=l.exportJSON(),d=l.constructor;if(c.type!==d.getType()&&eLe(58,d.name),ii(l)){let f=c.children;Array.isArray(f)||eLe(59,d.name)}return c}(a);if(Ui(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=RZr(t,e,c,u.children);!o&&ii(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 AZr(t,e){let r=[],n=es().getChildren();for(let o=0;o<n.length;o++)RZr(t,e,n[o],r);return{namespace:t._config.namespace,nodes:r}}function IZr(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r],o=b9r(n);Ui(o)&&eZr(o),e.push(o)}return e}var bX=null;async function xli(t,e,r){if(bX!==null)return!1;if(e!==null)return new Promise((l,c)=>{t.update(()=>{l(EZr(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(P$e,f=>(Rde(f,ClipboardEvent)&&(d(),bX!==null&&(window.clearTimeout(bX),bX=null),l(EZr(t,f,r))),!0),E$e);bX=window.setTimeout(()=>{d(),bX=null,l(!1)},50),i.execCommand("copy"),s.remove()})}function EZr(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&&!r7r(t,i,a))return!1;let s=cn();if(s===null)return!1;r=NZr(s)}e.preventDefault();let n=e.clipboardData;return n!==null&&(jZr(n,r),!0)}var Oli=[["text/html",PZr],["application/x-lexical-editor",MZr]];function NZr(t=cn()){let e={"text/plain":t?t.getTextContent():""};if(t){let r=S$e();for(let[n,o]of Oli){let i=o(r,t);i!==null&&(e[n]=i)}}return e}function jZr(t,e){for(let r in e){let n=e[r];n!==void 0&&t.setData(r,n)}}var UI=Lbt,HPs=UI.$generateJSONFromSelectedNodes,VPs=UI.$generateNodesFromSerializedNodes,JPs=UI.$getClipboardDataFromSelection,DZr=UI.$getHtmlContent,KPs=UI.$getLexicalContent,Fbt=UI.$insertDataTransferForPlainText,WPs=UI.$insertDataTransferForRichText,GPs=UI.$insertGeneratedNodes,ZPs=UI.copyToClipboard,XPs=UI.setLexicalClipboardDataTransfer;var kbt={};Xn(kbt,{registerPlainText:()=>Ali});var _X=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Tli=_X&&"documentMode"in document?document.documentMode:null,Eli=!(!_X||!("InputEvent"in window)||Tli)&&"getTargetRanges"in new window.InputEvent("input"),Pli=_X&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),$Zr=_X&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Mli=_X&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Rli=_X&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Mli;function LZr(t,e){e.update(()=>{if(t!==null){let r=Rde(t,KeyboardEvent)?null:t.clipboardData,n=cn();if(n!==null&&r!=null){t.preventDefault();let o=DZr(e);o!==null&&r.setData("text/html",o),r.setData("text/plain",n.getTextContent())}}})}function Ali(t){return T$(t.registerCommand(uX,e=>{let r=cn();return!!Pr(r)&&(r.deleteCharacter(e),!0)},Zu),t.registerCommand(A9r,e=>{let r=cn();return!!Pr(r)&&(r.deleteWord(e),!0)},Zu),t.registerCommand(R9r,e=>{let r=cn();return!!Pr(r)&&(r.deleteLine(e),!0)},Zu),t.registerCommand(P9r,e=>{let r=cn();if(!Pr(r))return!1;if(typeof e=="string")r.insertText(e);else{let n=e.dataTransfer;if(n!=null)Fbt(n,r);else{let o=e.data;o&&r.insertText(o)}}return!0},Zu),t.registerCommand(J9r,()=>{let e=cn();return!!Pr(e)&&(e.removeText(),!0)},Zu),t.registerCommand(nbt,e=>{let r=cn();return!!Pr(r)&&(r.insertLineBreak(e),!0)},Zu),t.registerCommand(D9r,()=>{let e=cn();return!!Pr(e)&&(e.insertLineBreak(),!0)},Zu),t.registerCommand(L9r,e=>{let r=cn();if(!Pr(r))return!1;let n=e,o=n.shiftKey;return!!Pbt(r,!0)&&(n.preventDefault(),Ebt(r,o,!0),!0)},Zu),t.registerCommand(F9r,e=>{let r=cn();if(!Pr(r))return!1;let n=e,o=n.shiftKey;return!!Pbt(r,!1)&&(n.preventDefault(),Ebt(r,o,!1),!0)},Zu),t.registerCommand(q9r,e=>{let r=cn();return!!Pr(r)&&(!$Zr||navigator.language!=="ko-KR")&&(e.preventDefault(),t.dispatchCommand(uX,!0))},Zu),t.registerCommand(B9r,e=>{let r=cn();return!!Pr(r)&&(e.preventDefault(),t.dispatchCommand(uX,!1))},Zu),t.registerCommand(cX,e=>{let r=cn();if(!Pr(r))return!1;if(e!==null){if(($Zr||Pli||Rli)&&Eli)return!1;e.preventDefault()}return t.dispatchCommand(nbt,!1)},Zu),t.registerCommand(W9r,()=>(T$e(),!0),Zu),t.registerCommand(P$e,e=>{let r=cn();return!!Pr(r)&&(LZr(e,t),!0)},Zu),t.registerCommand(M9r,e=>{let r=cn();return!!Pr(r)&&(function(n,o){LZr(n,o),o.update(()=>{let i=cn();Pr(i)&&i.removeText()})}(e,t),!0)},Zu),t.registerCommand(A$e,e=>{let r=cn();return!!Pr(r)&&(function(n,o){n.preventDefault(),o.update(()=>{let i=cn(),a=Rde(n,ClipboardEvent)?n.clipboardData:null;a!=null&&Pr(i)&&Fbt(a,i)},{tag:H9r})}(e,t),!0)},Zu),t.registerCommand(N9r,e=>{let r=cn();return!!Pr(r)&&(e.preventDefault(),!0)},Zu),t.registerCommand(I9r,e=>{let r=cn();return!!Pr(r)&&(e.preventDefault(),!0)},Zu))}var Ili=kbt,FZr=Ili.registerPlainText;var Bbt={};Xn(Bbt,{PlainTextPlugin:()=>Nli});var A0=L(X(),1),tLe=L(Bu(),1),gU=L(mt(),1);var qbt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?A0.useLayoutEffect:A0.useEffect;function kZr(t){return t.getEditorState().read(G$e(t.isComposing()))}function Nli({contentEditable:t,placeholder:e=null,ErrorBoundary:r}){let[n]=Si(),o=function(i,a){let[s,u]=(0,A0.useState)(()=>i.getDecorators());return qbt(()=>i.registerDecoratorListener(l=>{(0,tLe.flushSync)(()=>{u(l)})}),[i]),(0,A0.useEffect)(()=>{u(i.getDecorators())},[i]),(0,A0.useMemo)(()=>{let l=[],c=Object.keys(s);for(let d=0;d<c.length;d++){let f=c[d],p=(0,gU.jsx)(a,{onError:h=>i._onError(h),children:(0,gU.jsx)(A0.Suspense,{fallback:null,children:s[f]})}),m=i.getElementByKey(f);m!==null&&l.push((0,tLe.createPortal)(p,m,f))}return l},[a,s,i])}(n,r);return function(i){qbt(()=>T$(FZr(i),vZr(i)),[i])}(n),(0,gU.jsxs)(gU.Fragment,{children:[t,(0,gU.jsx)(jli,{content:e}),o]})}function jli({content:t}){let[e]=Si(),r=function(o){let[i,a]=(0,A0.useState)(()=>kZr(o));return qbt(()=>{function s(){let u=kZr(o);a(u)}return s(),T$(o.registerUpdateListener(()=>{s()}),o.registerEditableListener(()=>{s()}))},[o]),i}(e),n=q7r();return r?typeof t=="function"?t(n):t:null}var Dli=Bbt,qZr=Dli.PlainTextPlugin;var Ubt={};Xn(Ubt,{ContentEditable:()=>Lli,ContentEditableElement:()=>zZr});var Fy=L(X(),1),E$=L(mt(),1);var UZr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?Fy.useLayoutEffect:Fy.useEffect;function $li({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:g="textbox",spellCheck:y=!0,style:b,tabIndex:_,"data-testid":w,...x},O){let[E,T]=(0,Fy.useState)(t.isEditable()),R=(0,Fy.useCallback)(D=>{D&&D.ownerDocument&&D.ownerDocument.defaultView?t.setRootElement(D):t.setRootElement(null)},[t]),N=(0,Fy.useMemo)(()=>function(...D){return F=>{D.forEach(B=>{typeof B=="function"?B(F):B!=null&&(B.current=F)})}}(O,R),[R,O]);return UZr(()=>(T(t.isEditable()),t.registerEditableListener(D=>{T(D)})),[t]),(0,E$.jsx)("div",{"aria-activedescendant":E?e:void 0,"aria-autocomplete":E?r:"none","aria-controls":E?n:void 0,"aria-describedby":o,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":E&&g==="combobox"?!!a:void 0,...s!=null?{"aria-invalid":s}:{},"aria-label":u,"aria-labelledby":l,"aria-multiline":c,"aria-owns":E?d:void 0,"aria-readonly":!E||void 0,"aria-required":f,autoCapitalize:p,className:m,contentEditable:E,"data-testid":w,id:h,ref:N,role:g,spellCheck:y,style:b,tabIndex:_,...x})}var zZr=(0,Fy.forwardRef)($li);function BZr(t){return t.getEditorState().read(G$e(t.isComposing()))}var Lli=(0,Fy.forwardRef)(Fli);function Fli(t,e){let{placeholder:r,...n}=t,[o]=Si();return(0,E$.jsxs)(E$.Fragment,{children:[(0,E$.jsx)(zZr,{editor:o,...n,ref:e}),r!=null&&(0,E$.jsx)(kli,{editor:o,content:r})]})}function kli({content:t,editor:e}){let r=function(a){let[s,u]=(0,Fy.useState)(()=>BZr(a));return UZr(()=>{function l(){let c=BZr(a);u(c)}return l(),T$(a.registerUpdateListener(()=>{l()}),a.registerEditableListener(()=>{l()}))},[a]),s}(e),[n,o]=(0,Fy.useState)(e.isEditable());if((0,Fy.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,E$.jsx)("div",{"aria-hidden":!0,children:i})}var HZr=Ubt,VZr=HZr.ContentEditable,mMs=HZr.ContentEditableElement;var Vbt={};Xn(Vbt,{createEmptyHistoryState:()=>Jli,registerHistory:()=>Vli});var rLe=0,zbt=1,Hbt=2,Vx=0,qli=1,JZr=2,Bli=3,Uli=4;function zli(t,e,r,n,o){if(t===null||r.size===0&&n.size===0&&!o)return Vx;let i=e._selection,a=t._selection;if(o)return qli;if(!(Pr(i)&&Pr(a)&&a.isCollapsed()&&i.isCollapsed()))return Vx;let s=function(y,b,_){let w=y._nodeMap,x=[];for(let O of b){let E=w.get(O);E!==void 0&&x.push(E)}for(let[O,E]of _){if(!E)continue;let T=w.get(O);T===void 0||sX(T)||x.push(T)}return x}(e,r,n);if(s.length===0)return Vx;if(s.length>1){let y=e._nodeMap,b=y.get(i.anchor.key),_=y.get(a.anchor.key);return b&&_&&!t._nodeMap.has(b.__key)&&Ui(b)&&b.__text.length===1&&i.anchor.offset===1?JZr:Vx}let u=s[0],l=t._nodeMap.get(u.__key);if(!Ui(l)||!Ui(u)||l.__mode!==u.__mode)return Vx;let c=l.__text,d=u.__text;if(c===d)return Vx;let f=i.anchor,p=a.anchor;if(f.key!==p.key||f.type!=="text")return Vx;let m=f.offset,h=p.offset,g=d.length-c.length;return g===1&&h===m-1?JZr:g===-1&&h===m+1?Bli:g===-1&&h===m?Uli:Vx}function Hli(t,e){let r=Date.now(),n=Vx;return(o,i,a,s,u,l)=>{let c=Date.now();if(l.has(R$e))return n=Vx,r=c,Hbt;let d=zli(o,i,s,u,t.isComposing()),f=(()=>{let p=a===null||a.editor===t,m=l.has(j9r);if(!m&&p&&l.has(lX))return rLe;if(o===null)return zbt;let h=i._selection;return s.size>0||u.size>0?m===!1&&d!==Vx&&d===n&&c<r+e&&p||s.size===1&&function(g,y,b){let _=y._nodeMap.get(g),w=b._nodeMap.get(g),x=y._selection,O=b._selection;return!(Pr(x)&&Pr(O)&&x.anchor.type==="element"&&x.focus.type==="element"&&O.anchor.type==="text"&&O.focus.type==="text"||!Ui(_)||!Ui(w)||_.__parent!==w.__parent)&&JSON.stringify(y.read(()=>_.exportJSON()))===JSON.stringify(b.read(()=>w.exportJSON()))}(Array.from(s)[0],o,i)?rLe:zbt:h!==null?rLe:Hbt})();return r=c,n=d,f}}function KZr(t){t.undoStack=[],t.redoStack=[],t.current=null}function Vli(t,e,r){let n=Hli(t,r);return T$(t.registerCommand(G9r,()=>(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(gde,!0)),u.length===0&&i.dispatchCommand(yde,!1),a.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:R$e})}}(t,e),!0),Zu),t.registerCommand(V9r,()=>(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(yde,!0));let c=s.pop();s.length===0&&i.dispatchCommand(gde,!1),a.current=c||null,c&&c.editor.setEditorState(c.editorState,{tag:R$e})}}(t,e),!0),Zu),t.registerCommand(O9r,()=>(KZr(e),!1),Zu),t.registerCommand(T9r,()=>(KZr(e),t.dispatchCommand(gde,!1),t.dispatchCommand(yde,!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===zbt)d.length!==0&&(e.redoStack=[],t.dispatchCommand(gde,!1)),c!==null&&(f.push({...c}),t.dispatchCommand(yde,!0));else if(m===Hbt)return;e.current={editor:t,editorState:i}}))}function Jli(){return{current:null,redoStack:[],undoStack:[]}}var WZr=Vbt,nLe=WZr.createEmptyHistoryState,GZr=WZr.registerHistory;var Jbt={};Xn(Jbt,{HistoryPlugin:()=>Kli,createEmptyHistoryState:()=>nLe});var oLe=L(X(),1);function Kli({delay:t,externalHistoryState:e}){let[r]=Si();return function(n,o,i=1e3){let a=(0,oLe.useMemo)(()=>o||nLe(),[o]);(0,oLe.useEffect)(()=>GZr(n,a,i),[i,n,a])}(r,e,t),null}var ZZr=Jbt,XZr=ZZr.HistoryPlugin,SMs=ZZr.createEmptyHistoryState;var Kbt={};Xn(Kbt,{OnChangePlugin:()=>Gli});var iLe=L(X(),1),Wli=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?iLe.useLayoutEffect:iLe.useEffect;function Gli({ignoreHistoryMergeTagChange:t=!0,ignoreSelectionChange:e=!1,onChange:r}){let[n]=Si();return Wli(()=>{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(lX)||s.isEmpty()||r(o,n,u)})},[n,t,e,r]),null}var Zli=Kbt,YZr=Zli.OnChangePlugin;var Zbt={};Xn(Zbt,{LexicalErrorBoundary:()=>Yli});var vX=L(X(),1),Wbt=L(mt(),1);function Gbt(t,e){return Gbt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Gbt(t,e)}var QZr={error:null},Xli=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=QZr,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,Gbt(e,r),n.getDerivedStateFromError=function(i){return{error:i}};var o=n.prototype;return o.reset=function(){this.setState(QZr)},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(vX.isValidElement(l))return l;if(typeof s=="function")return s(c);if(u)return vX.createElement(u,c);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},n}(vX.Component);function Yli({children:t,onError:e}){return(0,Wbt.jsx)(Xli,{fallback:(0,Wbt.jsx)("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:t})}var Qli=Zbt,eXr=Qli.LexicalErrorBoundary;var Kx=L(X());var Ybt=L(vde());var Jx=L(X()),rXr=L(Bu());function nXr(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 tXr=400,eci=.9;function yU({options:t,selectedIndex:e,onSelect:r,onHighlight:n,range:o,query:i,showPreview:a=!1,mode:s="search",onKeyDown:u}){let[l,c]=(0,Jx.useState)(null),d=(0,Jx.useCallback)(()=>{let m=Math.floor(window.innerWidth*eci);if(t.length===0)return Math.min(tXr,m);let h=Math.max(...t.map(_=>_.title.length)),g=Math.max(...t.map(_=>_.subtitle?.length||0)),y=Math.max(h*8+32,g*6+32),b=Math.min(Math.max(y,300),tXr);return Math.min(b,m)},[t]),f=(0,Jx.useCallback)(()=>{if(!o)return;let m=o.getBoundingClientRect(),h=d(),g=m.top-4,y=8,b=window.innerWidth-h-8,_=Math.min(Math.max(m.left,y),b);c({top:g,left:_,width:h})},[o,d]);if((0,Jx.useEffect)(()=>{f()},[f]),(0,Jx.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=Jx.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}},Jx.default.createElement(k$e,{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,rXr.createPortal)(p,document.body)}var zI=require("obsidian");Dt();vue();function tci(t){let{type:e,title:r,data:n}=t;switch(e){case"active-note":return Ode();case"notes":if(n instanceof zI.TFile&&r)return xde(r,n.path);break;case"tools":if(typeof n=="string")return p3(n);break;case"folders":if(n instanceof zI.TFolder)return Ede(n.path);break}throw new Error(`Invalid pill data: ${JSON.stringify(t)}`)}function Xbt(t,e,r){return{beforeText:t.slice(0,e),afterText:t.slice(r)}}function rci(t,e,r=!0){if(e.length===1&&e[0].getType()==="text")t.replace(e[0]),r&&oXr(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];oXr(n)}}}function nci(t,e,r,n,o){let i=o?n?" "+n:" ":n;e?(t.setTextContent(e),t.insertAfter(r),i&&r.insertAfter(ww(i))):(t.replace(r),i&&r.insertAfter(ww(i))),r.selectNext()}function oXr(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=w$e(),n=t.getIndexWithinParent();r.anchor.set(e.getKey(),n+1,"element"),r.focus.set(e.getKey(),n+1,"element"),i3(r)}}}var aLe=Z9r("INSERT_TEXT_WITH_PILLS_COMMAND");function oci(t){try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function ici(t){let e=t.startsWith("@")?t:`@${t}`;return Qq.includes(e)?e:null}function aci(t){if(!app?.vault)return null;try{let e=app.vault.getAllLoadedFiles().filter(n=>n instanceof zI.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 J("Error resolving folder reference:",e),null}}function sci(t){if(!app?.vault||!app?.metadataCache)return null;try{let e=app.metadataCache.getFirstLinkpathDest(t,"");if(e&&e instanceof zI.TFile)return e;if(!t.endsWith(".md")){let i=app.metadataCache.getFirstLinkpathDest(t+".md","");if(i&&i instanceof zI.TFile)return i}if(!t.endsWith(".pdf")){let i=app.metadataCache.getFirstLinkpathDest(t+".pdf","");if(i&&i instanceof zI.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 zI.TFile&&i.extension==="pdf");for(let i of o)if(i.basename===t||i.name===t)return i;return null}catch(e){return J("Error resolving note reference:",e),null}}function sLe(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=sci(m);if(h&&h instanceof zI.TFile){let y=app?.workspace.getActiveFile()?.path===h.path;a.push({type:"note-pill",content:h.basename,file:h,isActive:y})}else a.push({type:"text",content:f[0]})}else if(p.type==="urls"){let m=f[p.startIndex].replace(/,+$/,"");oci(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=ici(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=aci(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 uLe(t){let e=[];for(let r of t)r.type==="text"&&r.content?e.push(ww(r.content)):r.type==="active-note-pill"?e.push(Ode()):r.type==="note-pill"&&r.file?e.push(xde(r.content,r.file.path)):r.type==="url-pill"&&r.url?e.push(V$e(r.url)):r.type==="tool-pill"&&r.toolName?e.push(p3(r.toolName)):r.type==="folder-pill"&&r.folder&&e.push(Ede(r.folder.path));return e}function iXr(t,e={}){let{enableURLPills:r=!1,insertAtSelection:n=!0}=e;if(!t)return;let o=cn();if(!Pr(o)){J("No range selection available for text insertion");return}let i=sLe(t,{includeNotes:!0,includeURLs:r}),a=uLe(i);a.length>0&&(n||o.removeText(),o.insertNodes(a))}function aXr(t,e,r,n={}){let{enableURLPills:o=!1,enableToolPills:i=!1,enableCustomTemplatePills:a=!1}=n,s=cn();if(!Pr(s))return;let l=s.anchor.getNode();if(l.getType()!=="text")return;let c=l,d=c.getTextContent(),f=sLe(r,{includeNotes:!0,includeURLs:o,includeTools:i,includeCustomTemplates:a});if(f.length===1&&f[0].type==="text"){let{beforeText:p,afterText:m}=Xbt(d,t,e),h=p+f[0].content+m;c.setTextContent(h);let g=p.length+f[0].content.length;c.select(g,g)}else{let{beforeText:p,afterText:m}=Xbt(d,t,e),h=[];p&&h.push(ww(p)),h.push(...uLe(f)),m&&h.push(ww(m)),rci(c,h)}}function wX(t,e,r=!0){let n=cn();if(!Pr(n))return;let o=n.anchor,i=o.getNode();if(!(i instanceof kI))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}=Xbt(a,u,s),d=tci(e);nci(i,l,d,c,r)}var Cw=L(X());function bU({triggerConfig:t,options:e,onSelect:r,onStateChange:n,onHighlight:o}){let[i]=Si(),[a,s]=(0,Cw.useState)({isOpen:!1,query:"",selectedIndex:0,range:null});(0,Cw.useEffect)(()=>{n?.(a)},[a,n]);let u=(0,Cw.useCallback)(()=>{s({isOpen:!1,query:"",selectedIndex:0,range:null})},[]),l=(0,Cw.useCallback)(f=>{s(p=>({...p,selectedIndex:f})),o&&e[f]&&o(f,e[f])},[o,e]),c=(0,Cw.useCallback)(f=>{if(!f||!a.isOpen)return!1;switch(f.key){case"ArrowDown":{f.preventDefault();let p=Math.min(a.selectedIndex+1,e.length-1);return l(p),!0}case"ArrowUp":{f.preventDefault();let p=Math.max(a.selectedIndex-1,0);return l(p),!0}case"Enter":case"Tab":return e.length===0?(u(),!1):(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,Cw.useEffect)(()=>{let f=i.registerCommand($9r,b=>c(b),O$),p=i.registerCommand(k9r,b=>c(b),O$),m=i.registerCommand(cX,b=>c(b),O$),h=i.registerCommand(z9r,b=>c(b),O$),g=i.registerCommand(U9r,b=>c(b),O$),y=i.registerCommand(x9r,()=>(a.isOpen&&u(),!1),O$);return()=>{f(),p(),m(),h(),g(),y()}},[i,c,a.isOpen,u]);let d=(0,Cw.useCallback)((f,p)=>{let{char:m,multiChar:h=!1,allowWhitespace:g=!1}=t;if(h){let y=m.length,b=-1;for(let _=p-1;_>=y-1;_--)if(f.slice(_-y+1,_+1)===m){if(_-y+1===0||/\s/.test(f[_-y])){b=_-y+1;break}}else if(!g&&/\s/.test(f[_]))break;if(b!==-1){let _=f.slice(b+y,p);return{triggerIndex:b,query:_}}}else{let y=-1;for(let b=p-1;b>=0;b--){let _=f[b];if(_===m){if(b===0||/\s/.test(f[b-1])){y=b;break}}else if(!g&&/\s/.test(_))break}if(y!==-1){let b=f.slice(y+1,p);return{triggerIndex:y,query:b}}}return null},[t]);return(0,Cw.useEffect)(()=>i.registerUpdateListener(({editorState:f})=>{f.read(()=>{let p=cn();if(!Pr(p)||!p.isCollapsed()){a.isOpen&&u();return}let m=p.anchor,h=m.getNode();if(!(h instanceof kI)){a.isOpen&&u();return}let g=h.getTextContent(),y=m.offset,b=d(g,y);if(b){let{triggerIndex:_,query:w}=b,x=i._window??window,O=nXr(_,x);O&&s(E=>({...E,isOpen:!0,query:w,selectedIndex:0,range:O}))}else a.isOpen&&u()})}),[i,a.isOpen,u,d]),(0,Cw.useEffect)(()=>{s(f=>({...f,selectedIndex:0}))},[e.length]),(0,Cw.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 sXr(){let[t]=Si(),e=hje(),[r,n]=(0,Kx.useState)(""),o=(0,Kx.useMemo)(()=>bje(e.filter(c=>c.showInSlashMenu)).map((c,d)=>({key:`${c.title}-${d}`,title:c.title,content:c.content,command:c})),[e]),i=(0,Kx.useMemo)(()=>{if(!r)return o;let l=r,c=Ybt.default.go(l,o,{key:"title",threshold:-1e4});return c.length>0?c.map(f=>f.obj):Ybt.default.go(l,o,{key:"content",threshold:-1e4}).map(f=>f.obj)},[o,r]),a=(0,Kx.useCallback)(l=>{t.update(()=>{let c=cn();if(!Pr(c))return;let d=c.anchor,f=d.getNode();if(f instanceof kI){let m=f.getTextContent().lastIndexOf("/",d.offset);if(m!==-1){let h=l.content||l.title;aXr(m,d.offset,h,{enableURLPills:!0,enableToolPills:!0,enableCustomTemplatePills:!0})}}})},[t]),{state:s,handleHighlight:u}=bU({triggerConfig:{char:"/",allowWhitespace:!0},options:i,onSelect:a,onStateChange:l=>{n(l.query)}});return Kx.default.createElement(Kx.default.Fragment,null,s.isOpen&&Kx.default.createElement(yU,{options:i,selectedIndex:s.selectedIndex,onSelect:a,onHighlight:u,range:s.range,query:s.query,showPreview:!0}))}var xw=L(X());var h3=L(X());On();var uXr=L(vde());Pt();var uci={limit:30,threshold:-1e4};function lXr(t,e=!1,r={},n=null){let o=z$e(e),i=(0,h3.useMemo)(()=>o.map((s,u)=>({key:`${s.basename}-${u}`,title:s.basename,subtitle:s.path,content:"",icon:h3.default.createElement(ic,{className:"tw-size-4"}),file:s})),[o]);return(0,h3.useMemo)(()=>{let s={...uci,...r},u=ce().customPromptsFolder;if(!t.trim()){let y=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:h3.default.createElement(GN,{className:"tw-size-4"}),file:n},x=[...y,...b].slice(0,s.limit-1);return[w,...x]}return[...y,...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:h3.default.createElement(GN,{className:"tw-size-4"}),file:n}:null,m=p?s.limit-1:s.limit,g=uXr.default.go(l,i,{keys:["subtitle"],limit:m,threshold:s.threshold}).map(y=>y.obj);return p?[p,...g]:g},[i,t,r,n])}async function lci(t,e=500){try{if(t.extension==="pdf")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 lLe=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 lci(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 cXr({isCopilotPlus:t=!1,currentActiveFile:e=null}){let[r]=Si(),[n,o]=(0,xw.useState)(""),[i]=(0,xw.useState)(()=>new lLe),[a,s]=(0,xw.useState)(new Map),u=(0,xw.useCallback)(async m=>{try{let h=await i.getOrLoadContent(m,500);return s(g=>{let y=new Map(g);return y.set(m.path,h),y}),h}catch{let h="Failed to load content";return s(g=>{let y=new Map(g);return y.set(m.path,h),y}),h}},[i]),c=lXr(n,t,{},e).map(m=>({...m,content:a.get(m.file.path)||""})),d=(0,xw.useCallback)(m=>{if(m.category==="activeNote")r.update(()=>{wX("[[",{type:"active-note"})});else{let h={type:"notes",title:m.title,data:m.file};r.update(()=>{wX("[[",h)})}},[r]),{state:f,handleHighlight:p}=bU({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,xw.useEffect)(()=>{c.length>0&&!a.has(c[0].file.path)&&u(c[0].file)},[c,a,u]),xw.default.createElement(xw.default.Fragment,null,f.isOpen&&xw.default.createElement(yU,{options:c,selectedIndex:f.selectedIndex,onSelect:d,onHighlight:p,range:f.range,query:f.query,showPreview:!0}))}var _U=L(X());var cLe=L(X()),fXr=L(vde());TN();Pt();function dXr(t=!1){let e=Zw(cbt,{store:ei}),r=Zw(dbt,{store:ei});return t?e:r}var cci={limit:10,threshold:-1e4,frontmatterOnly:!1};function pXr(t,e={}){let r=(0,cLe.useMemo)(()=>({...cci,...e}),[e]),n=dXr(r.frontmatterOnly),o=(0,cLe.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,cLe.useMemo)(()=>{if(!t.trim())return o.slice(0,r.limit);let a=t.trim();return fXr.default.go(a,o,{key:"title",limit:r.limit,threshold:r.threshold}).map(u=>u.obj)},[o,t,r])}function mXr({onTagSelected:t}){let[e]=Si(),[r,n]=(0,_U.useState)(""),o=pXr(r,{limit:10}),i=(0,_U.useCallback)(u=>{e.update(()=>{let l=cn();if(!Pr(l))return;let c=l.anchor,d=c.getNode();if(!(d instanceof kI))return;let f=d.getTextContent(),p=c.offset,m=f.lastIndexOf("#",p);if(m===-1)return;let h=f.slice(0,m),g=f.slice(p),y=`#${u.tag} `;d.setTextContent(h+y+g);let b=h.length+y.length;d.select(b,b)}),t?.()},[e,t]),{state:a,handleHighlight:s}=bU({triggerConfig:{char:"#",multiChar:!1,allowWhitespace:!1},options:o,onSelect:i,onStateChange:u=>{n(u.query)}});return _U.default.createElement(_U.default.Fragment,null,a.isOpen&&_U.default.createElement(yU,{options:o,selectedIndex:a.selectedIndex,onSelect:i,onHighlight:s,range:a.range,query:a.query,showPreview:!1}))}var Uh=L(X());var Qbt=require("obsidian");function hXr({isCopilotPlus:t=!1,currentActiveFile:e=null}){let[r]=Si(),[n,o]=(0,Uh.useState)({mode:"category"}),[i,a]=(0,Uh.useState)(""),s=q$e(t),u=(0,Uh.useCallback)(async _=>{try{if(_.extension==="pdf"){a("");return}let x=(await app.vault.cachedRead(_)).replace(/^---\s*\n[\s\S]*?\n---\s*\n?/,"").trim(),O=x.length>300?x.slice(0,300)+"...":x;a(O)}catch{a("Failed to load content")}},[]),[l,c]=(0,Uh.useState)(""),d=H$e(l,n.mode,n.selectedCategory,t,s,e),f=(0,Uh.useCallback)(_=>"data"in _,[]),p=(0,Uh.useCallback)(_=>"icon"in _&&!("data"in _),[]),m=(0,Uh.useCallback)(_=>{if(n.mode==="category"&&p(_)&&!l){o(w=>({...w,mode:"search",selectedCategory:_.category}));return}if(f(_))if(_.category==="activeNote")r.update(()=>{wX("@",{type:"active-note"})});else{let w={type:_.category,title:_.title,data:_.data};r.update(()=>{wX("@",w)})}},[n.mode,l,p,f,r]),h=(0,Uh.useCallback)(_=>{c(_.query),_.isOpen||o({mode:"category",selectedCategory:void 0})},[]),{state:g,handleHighlight:y}=bU({triggerConfig:{char:"@",allowWhitespace:!0},options:d,onSelect:m,onStateChange:h});(0,Uh.useEffect)(()=>{let _=d[g.selectedIndex];_&&f(_)&&_.category==="notes"&&_.data instanceof Qbt.TFile?u(_.data):a("")},[g.selectedIndex,d,f,u]);let b=(0,Uh.useMemo)(()=>d.map((_,w)=>w===g.selectedIndex&&f(_)&&_.category==="notes"&&_.data instanceof Qbt.TFile?{..._,content:i}:_),[d,g.selectedIndex,i,f]);return Uh.default.createElement(Uh.default.Fragment,null,g.isOpen&&Uh.default.createElement(yU,{options:b,selectedIndex:g.selectedIndex,onSelect:m,onHighlight:y,range:g.range,query:g.query,showPreview:d[g.selectedIndex]&&f(d[g.selectedIndex])&&d[g.selectedIndex].category==="notes",mode:n.mode}))}var gXr=L(X());function e_t(t){return t instanceof M$e?typeof t.isPill=="function"&&t.isPill()===!0:!1}function yXr(){let[t]=Si();return gXr.default.useEffect(()=>{let e=t.registerCommand(uX,r=>{let n=!1;return t.update(()=>{let o=cn();if(!Pr(o)||!o.isCollapsed()){n=!1;return}let i=o.anchor,a=i.getNode();if(e_t(a)){(r&&i.offset===1||!r&&i.offset===0)&&(a.remove(),n=!0);return}if(ii(a)&&r&&i.offset>0){let u=a.getChildren()[i.offset-1];if(e_t(u)){u.remove(),n=!0;return}}if(r&&i.offset===0){let s=a.getPreviousSibling();if(e_t(s)){s.remove(),n=!0;return}}n=!1}),n},E$e);return()=>{e()}},[t]),null}var bXr=L(X());function _Xr({onSubmit:t}){let[e]=Si();return bXr.default.useEffect(()=>e.registerCommand(cX,r=>r.shiftKey?!1:(r.preventDefault(),t(),!0),E9r),[e,t]),null}var vXr=L(X());function wXr({value:t}){let[e]=Si();return vXr.default.useEffect(()=>{e.update(()=>{let r=es();r.getTextContent()!==t&&(r.clear(),t&&r.append(C$().append(ww(t))))})},[e,t]),null}var SXr=L(X());function CXr({onFocus:t,onEditorReady:e}){let[r]=Si();return SXr.default.useEffect(()=>{t(()=>{r.focus()}),e&&e(r)},[r,t,e]),null}var xXr=L(X());var t_t=L(X());function vU({config:t,onChange:e,onRemoved:r}){let[n]=Si(),o=t_t.default.useRef([]),{isPillNode:i,extractData:a,getKey:s=u=>String(u)}=t;return t_t.default.useEffect(()=>{if(!(!e&&!r))return n.registerUpdateListener(({editorState:u})=>{u.read(()=>{let l=[],c=es();function d(_){if(i(_)){let w=a(_);l.push(w)}if(typeof _.getChildren=="function"){let w=_.getChildren();for(let x of w)d(x)}}d(c);let f=new Set,m=l.filter(_=>{let w=s(_);return f.has(w)?!1:(f.add(w),!0)}).sort((_,w)=>s(_).localeCompare(s(w))),h=o.current,g=m.map(s),y=h.map(s);if(g.length!==y.length||g.some((_,w)=>_!==y[w])){if(r){let _=new Set(g),w=h.filter(x=>!_.has(s(x)));w.length>0&&r(w)}o.current=m,e&&e(m)}})})},[n,e,r,i,a,s]),null}var dci={isPillNode:pbt,extractData:t=>({path:t.getNotePath(),basename:t.getNoteTitle()}),getKey:t=>t.path};function OXr({onNotesChange:t,onNotesRemoved:e}){return xXr.default.createElement(vU,{config:dci,onChange:t,onRemoved:e})}var TXr=L(X());var fci={isPillNode:R7r,extractData:t=>t.getURL()};function EXr({onURLsChange:t,onURLsRemoved:e}){return TXr.default.createElement(vU,{config:fci,onChange:t,onRemoved:e})}var PXr=L(X());var pci={isPillNode:N7r,extractData:t=>t.getToolName()};function MXr({onToolsChange:t,onToolsRemoved:e}){return PXr.default.createElement(vU,{config:pci,onChange:t,onRemoved:e})}var RXr=L(X());var mci={isPillNode:A7r,extractData:t=>t.getFolderPath()};function AXr({onFoldersChange:t,onFoldersRemoved:e}){return RXr.default.createElement(vU,{config:mci,onChange:t,onRemoved:e})}var IXr=L(X());function NXr({onActiveNoteAdded:t,onActiveNoteRemoved:e}){let[r]=Si();return(0,IXr.useEffect)(()=>{let n=!1,o=r.registerUpdateListener(({editorState:i})=>{i.read(()=>{let a=es(),s=!1;function u(l){if(mbt(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 jXr=L(X());function DXr({enableURLPills:t=!1,onImagePaste:e}){let[r]=Si();return jXr.default.useEffect(()=>r.registerCommand(A$e,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 g=h.filter(y=>y!==null);g.length>0&&e(g)}),!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=sLe(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=cn();if(!Pr(p))return;let m=uLe(d);m.length>0&&p.insertNodes(m)}),!0):!1},O$),[r,t,e]),null}var $Xr=L(X());function LXr(){let[t]=Si();return $Xr.default.useEffect(()=>t.registerCommand(aLe,e=>{let{text:r,options:n={}}=e;return t.update(()=>{iXr(r,n)}),!0},Zu),[t]),null}var fv=L(X());var FXr=(0,fv.createContext)(void 0);function wU(){let t=(0,fv.useContext)(FXr);if(t===void 0)throw new Error("useChatInput must be used within a ChatInputProvider");return t}function kXr({children:t}){let[e,r]=(0,fv.useState)(null),[n,o]=(0,fv.useState)(null),i=(0,fv.useCallback)(c=>{r(c)},[]),a=(0,fv.useCallback)(c=>{o(()=>c)},[]),s=(0,fv.useCallback)((c,d=!1)=>{e&&e.dispatchCommand(aLe,{text:c,options:{enableURLPills:d,insertAtSelection:!0}})},[e]),u=(0,fv.useCallback)(()=>{n&&n()},[n]),l={insertTextWithPills:s,focusInput:u,registerEditor:i,registerFocusHandler:a};return fv.default.createElement(FXr.Provider,{value:l},t)}jn();gd();var hci=({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,onEditorReady:g,onImagePaste:y,onTagSelected:b,isCopilotPlus:_=!1,currentActiveFile:w=null,currentChain:x})=>{let[O,E]=ts.default.useState(null),[T,R]=ts.default.useState(null),N=wU();(0,ts.useEffect)(()=>{T&&N.registerEditor(T)},[T,N]),(0,ts.useEffect)(()=>{O&&N.registerFocusHandler(O)},[O,N]);let D=ts.default.useMemo(()=>({namespace:"ChatEditor",theme:{root:"tw-outline-none",paragraph:"tw-m-0"},nodes:[mX,gX,f3,d3,...u?[c3]:[]],onError:U=>{console.error("Lexical error:",U)},editable:!o}),[u,o]),F=(0,ts.useCallback)(U=>{U.read(()=>{let G=es().getTextContent();e(G)})},[e]),B=(0,ts.useCallback)(U=>{R(U),g?.(U)},[g]);return ts.default.createElement(k7r,{initialConfig:D},ts.default.createElement(E7r,{currentActiveFile:w},ts.default.createElement("div",{className:Oe("tw-relative",i)},ts.default.createElement(qZr,{contentEditable:ts.default.createElement(VZr,{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:ts.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:eXr}),ts.default.createElement(YZr,{onChange:F}),ts.default.createElement(XZr,null),ts.default.createElement(_Xr,{onSubmit:r}),ts.default.createElement(wXr,{value:t}),ts.default.createElement(CXr,{onFocus:E,onEditorReady:B}),ts.default.createElement(OXr,{onNotesChange:a,onNotesRemoved:s}),u&&ts.default.createElement(EXr,{onURLsChange:u,onURLsRemoved:l}),ts.default.createElement(MXr,{onToolsChange:c,onToolsRemoved:d}),ts.default.createElement(AXr,{onFoldersChange:f,onFoldersRemoved:p}),ts.default.createElement(NXr,{onActiveNoteAdded:m,onActiveNoteRemoved:h}),ts.default.createElement(yXr,null),ts.default.createElement(DXr,{enableURLPills:!!u,onImagePaste:y}),ts.default.createElement(sXr,null),ts.default.createElement(cXr,{isCopilotPlus:_,currentActiveFile:w}),x&&x!=="llm_chain"&&ts.default.createElement(mXr,{onTagSelected:b}),ts.default.createElement(hXr,{isCopilotPlus:_,currentActiveFile:w}),ts.default.createElement(LXr,null))))},qXr=hci;var BXr=({inputMessage:t,setInputMessage:e,handleSendMessage:r,isGenerating:n,onStopGenerating:o,app:i,contextNotes:a,setContextNotes:s,includeActiveNote:u,setIncludeActiveNote:l,selectedImages:c,onAddImage:d,setSelectedImages:f,disableModelSwitch:p,selectedTextContexts:m,onRemoveSelectedText:h,showProgressCard:g,editMode:y=!1,onEditSave:b,onEditCancel:_,initialContext:w})=>{let[x,O]=(0,zt.useState)(w?.urls||[]),[E,T]=(0,zt.useState)(w?.folders||[]),R=(0,zt.useRef)(null),N=(0,zt.useRef)(null),[D,F]=xL(),[B]=Ev(),[U]=rge(),H=So(),[G,ie]=(0,zt.useState)(()=>{let Xt=i.workspace.getActiveFile();return G2e(Xt)?Xt:null}),[oe,z]=(0,zt.useState)(null),[Q,re]=(0,zt.useState)([]),[Z,$]=(0,zt.useState)([]),[q,Y]=(0,zt.useState)([]),[j,A]=(0,zt.useState)([]),W=s_(B),[V,se]=(0,zt.useState)(!1),[be,Ee]=(0,zt.useState)(!1),[Ae,ht]=(0,zt.useState)(!1),[Rt,Ze]=(0,zt.useState)(H.enableAutonomousAgent),[Dr,Vt]=(0,zt.useState)(0),jt=["Loading the project context...","Processing context files...","If you have many files in context, this can take a while..."];(0,zt.useEffect)(()=>{B==="project"?Ze(!1):Ze(H.enableAutonomousAgent)},[H.enableAutonomousAgent,B]),(0,zt.useEffect)(()=>{if(B==="project"){z(tc());let Xt=tK(ct=>{z(ct)});return()=>{Xt()}}else z(null)},[B]),(0,zt.useEffect)(()=>{if(!U)return;let Xt=setInterval(()=>{Vt(ct=>(ct+1)%jt.length)},3e3);return()=>clearInterval(Xt)},[U,jt.length]);let Fe=()=>oe&&B==="project"&&oe.projectModelKey?oe.projectModelKey:D,hn=()=>{if(y&&b){b(t,{notes:a,urls:x,folders:E});return}if(!W){r();return}let Xt=[];if(!Rt){let ct=t.toLowerCase();V&&!ct.includes("@vault")&&Xt.push("@vault"),be&&!ct.includes("@websearch")&&!ct.includes("@web")&&Xt.push("@websearch"),Ae&&!ct.includes("@composer")&&Xt.push("@composer")}r({toolCalls:Xt,contextNotes:a,urls:x,contextFolders:E})},gt=Xt=>{let ct=new Set(Xt.map(pr=>pr.path));s(pr=>pr.filter(Or=>!ct.has(Or.path)))},qe=Xt=>{let ct=new Set(Xt);O(pr=>pr.filter(Or=>!ct.has(Or)))},Te=Xt=>{!W||Rt||Xt.forEach(ct=>{switch(ct){case"@vault":se(!1);break;case"@websearch":case"@web":Ee(!1);break;case"@composer":ht(!1);break}})};(0,zt.useEffect)(()=>{if(!W||Rt)return;let Xt=j.includes("@vault"),ct=j.includes("@websearch")||j.includes("@web"),pr=j.includes("@composer");se(Xt),Ee(ct),ht(pr)},[j,W,Rt]);let Ce=Xt=>{N.current&&N.current.update(()=>{x7r(Xt)}),re(ct=>ct.filter(pr=>pr.path!==Xt))},De=Xt=>{N.current&&N.current.update(()=>{M7r(Xt)}),$(ct=>ct.filter(pr=>pr!==Xt))},Re=Xt=>{N.current&&N.current.update(()=>{I7r(Xt)}),Y(ct=>ct.filter(pr=>pr!==Xt))},nt=(Xt,ct)=>{switch(Xt){case"activeNote":l(!0);break;case"notes":if(ct instanceof Ade.TFile){let pr=i.workspace.getActiveFile();pr&&ct.path===pr.path?(l(!0),s(Or=>Or.filter(js=>js.path!==ct.path))):s(Or=>Or.find(el=>el.path===ct.path)?Or:[...Or,ct])}break;case"tools":typeof ct=="string"&&N.current&&N.current.update(()=>{let pr=cn();if(Pr(pr)){let Or=p3(ct);pr.insertNodes([Or])}});break;case"folders":if(ct&&ct.path){let pr=ct.path;T(Or=>Or.find(el=>el===pr)?Or:[...Or,pr])}break}},_n=(Xt,ct)=>{switch(Xt){case"activeNote":l(!1),N.current&&N.current.update(()=>{P7r()});break;case"notes":typeof ct=="string"&&(G?.path===ct&&u?l(!1):s(pr=>pr.filter(Or=>Or.path!==ct)),Ce(ct));break;case"urls":typeof ct=="string"&&(O(pr=>pr.filter(Or=>Or!==ct)),De(ct));break;case"folders":typeof ct=="string"&&(T(pr=>pr.filter(Or=>Or!==ct)),Re(ct));break;case"selectedText":typeof ct=="string"&&h?.(ct);break}},He=Xt=>{let ct=new Set(Xt);T(pr=>pr.filter(Or=>!ct.has(Or)))};(0,zt.useEffect)(()=>{s(Xt=>{let ct=new Set(Xt.map(js=>js.path)),pr=Q.filter(js=>!ct.has(js.path)),Or=[];return pr.forEach(js=>{let el=i.vault.getAbstractFileByPath(js.path);el instanceof Ade.TFile&&Or.push(el)}),[...Xt,...Or]})},[Q,i.vault,s]),(0,zt.useEffect)(()=>{s_(B)?O(Xt=>{let ct=new Set(Xt),pr=Z.filter(Or=>!ct.has(Or));return pr.length>0?Array.from(new Set([...Xt,...pr])):Xt}):O([])},[Z,B]),(0,zt.useEffect)(()=>{T(Xt=>{let ct=new Set(Xt),pr=q.filter(Or=>!ct.has(Or));return[...Xt,...pr]})},[q]),(0,zt.useEffect)(()=>{let Xt,ct=()=>{clearTimeout(Xt),Xt=setTimeout(()=>{let Or=i.workspace.getActiveFile();ie(G2e(Or)?Or:null)},100)},pr=i.workspace.on("active-leaf-change",ct);return()=>{clearTimeout(Xt),i.workspace.offref(pr)}},[i.workspace]);let{getRootProps:wt,getInputProps:_r,isDragActive:Sl}=Ogt({accept:{"image/*":[".png",".gif",".jpeg",".jpg",".webp"]},onDrop:Xt=>{d(Xt)},noClick:!0,noDragEventsBubbling:!0}),Vo=(0,zt.useCallback)(Xt=>{N.current=Xt},[]);(0,zt.useEffect)(()=>{if(!y||!_)return;let Xt=ct=>{ct.key==="Escape"&&(ct.preventDefault(),_())};return document.addEventListener("keydown",Xt),()=>document.removeEventListener("keydown",Xt)},[y,_]);let Su=(0,zt.useCallback)(()=>{N.current&&W&&N.current.update(()=>{Pde("@vault")})},[W]),Wa=(0,zt.useCallback)(()=>{N.current&&W&&N.current.update(()=>{Pde("@websearch"),Pde("@web")})},[W]),zy=(0,zt.useCallback)(()=>{N.current&&W&&N.current.update(()=>{Pde("@composer")})},[W]),ui=(0,zt.useCallback)(()=>{l(!0)},[l]),mv=(0,zt.useCallback)(()=>{l(!1)},[l]),q0=(0,zt.useCallback)(()=>{W&&!Rt&&!V&&(se(!0),new Ade.Notice("Vault search enabled for tag query"))},[W,Rt,V]);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:R},zt.default.createElement(w7r,{contextNotes:a,includeActiveNote:u,activeNote:G,contextUrls:x,contextFolders:E,selectedTextContexts:m,showProgressCard:g,lexicalEditorRef:N,onAddToContext:nt,onRemoveFromContext:_n}),c.length>0&&zt.default.createElement("div",{className:"selected-images"},c.map((Xt,ct)=>zt.default.createElement("div",{key:ct,className:"image-preview-container"},zt.default.createElement("img",{src:URL.createObjectURL(Xt),alt:Xt.name,className:"selected-image-preview"}),zt.default.createElement("button",{className:"remove-image-button",onClick:()=>f(pr=>pr.filter((Or,js)=>js!==ct)),title:"Remove image"},zt.default.createElement(pi,{className:"tw-size-4"}))))),zt.default.createElement("div",{className:"tw-relative",...wt()},U&&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(Zc,{className:"tw-size-4 tw-animate-spin"}),zt.default.createElement("span",{className:"tw-text-sm"},jt[Dr]))),zt.default.createElement(qXr,{value:t,onChange:Xt=>e(Xt),onSubmit:hn,onNotesChange:re,onNotesRemoved:gt,onActiveNoteAdded:ui,onActiveNoteRemoved:mv,onURLsChange:W?$:void 0,onURLsRemoved:W?qe:void 0,onToolsChange:W?A:void 0,onToolsRemoved:W?Te:void 0,onFoldersChange:Y,onFoldersRemoved:He,onEditorReady:Vo,onImagePaste:d,onTagSelected:q0,placeholder:"Your AI assistant for Obsidian \u2022 @ to add context \u2022 / for custom prompts",disabled:U,isCopilotPlus:W,currentActiveFile:G,currentChain:B}),zt.default.createElement("input",{..._r()}),Sl&&zt.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-flex tw-items-center tw-justify-center tw-rounded-md tw-border tw-border-dashed tw-bg-primary"},zt.default.createElement("span",null,"Drop images here..."))),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(Zc,{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(IDe,{variant:"ghost2",size:"fit",disabled:p,value:Fe(),onChange:Xt=>{B!=="project"&&F(Xt)},className:"tw-max-w-full tw-truncate"})),zt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},n?zt.default.createElement(ve,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>o()},zt.default.createElement(ZL,{className:"tw-size-4"}),"Stop"):zt.default.createElement(zt.default.Fragment,null,zt.default.createElement(Z5r,{vaultToggle:V,setVaultToggle:se,webToggle:be,setWebToggle:Ee,composerToggle:Ae,setComposerToggle:ht,autonomousAgentToggle:Rt,setAutonomousAgentToggle:Ze,currentChain:B,onVaultToggleOff:Su,onWebToggleOff:Wa,onComposerToggleOff:zy}),zt.default.createElement(tv,{delayDuration:0},zt.default.createElement(Kn,null,zt.default.createElement(Wn,{asChild:!0},zt.default.createElement(ve,{variant:"ghost2",size:"fit",className:"tw-text-muted hover:tw-text-accent",onClick:()=>{new ADe(i,d).open()}},zt.default.createElement(Tte,{className:"tw-size-4"}))),zt.default.createElement(Mn,{className:"tw-px-1 tw-py-0.5"},"Add image(s)"))),y&&_&&zt.default.createElement(ve,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:_},zt.default.createElement("span",null,"cancel")),zt.default.createElement(ve,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>hn()},zt.default.createElement(uC,{className:"!tw-size-3"}),zt.default.createElement("span",null,y?"save":"chat"))))))};BXr.displayName="ChatInput";var dLe=BXr;Ro();zr();jn();On();var UXr=require("obsidian"),Gn=L(X()),zXr=({message:t,onCopy:e,isCopied:r,onInsertIntoEditor:n,onRegenerate:o,onEdit:i,onDelete:a,onShowSources:s,hasSources:u})=>Gn.default.createElement("div",{className:Oe("tw-flex tw-gap-1",{"group-hover:opacity-100 opacity-0":!UXr.Platform.isMobile})},t.sender===Xs?Gn.default.createElement(Gn.default.Fragment,null,Gn.default.createElement(Kn,null,Gn.default.createElement(Wn,{asChild:!0},Gn.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Gn.default.createElement(Uu,{className:"tw-size-4"}):Gn.default.createElement(h_,{className:"tw-size-4"}))),Gn.default.createElement(Mn,null,"Copy")),Gn.default.createElement(Kn,null,Gn.default.createElement(Wn,{asChild:!0},Gn.default.createElement(ve,{onClick:i,variant:"ghost2",size:"fit",title:"Edit"},Gn.default.createElement(g_,{className:"tw-size-4"}))),Gn.default.createElement(Mn,null,"Edit")),Gn.default.createElement(Kn,null,Gn.default.createElement(Wn,{asChild:!0},Gn.default.createElement(ve,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Gn.default.createElement(cy,{className:"tw-size-4"}))),Gn.default.createElement(Mn,null,"Delete"))):Gn.default.createElement(Gn.default.Fragment,null,u&&Gn.default.createElement(Kn,null,Gn.default.createElement(Wn,{asChild:!0},Gn.default.createElement(ve,{onClick:s,variant:"ghost2",size:"fit",title:"Show Sources"},Gn.default.createElement(l4,{className:"tw-size-4"}))),Gn.default.createElement(Mn,null,"Show Sources")),Gn.default.createElement(Kn,null,Gn.default.createElement(Wn,{asChild:!0},Gn.default.createElement(ve,{onClick:n,variant:"ghost2",size:"fit",title:"Insert / Replace at cursor"},Gn.default.createElement(Ite,{className:"tw-size-4"}))),Gn.default.createElement(Mn,null,"Insert / Replace at cursor")),Gn.default.createElement(Kn,null,Gn.default.createElement(Wn,{asChild:!0},Gn.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:e,title:"Copy"},r?Gn.default.createElement(Uu,{className:"tw-size-4"}):Gn.default.createElement(h_,{className:"tw-size-4"}))),Gn.default.createElement(Mn,null,"Copy")),Gn.default.createElement(Kn,null,Gn.default.createElement(Wn,{asChild:!0},Gn.default.createElement(ve,{onClick:o,variant:"ghost2",size:"fit",title:"Regenerate"},Gn.default.createElement(Ate,{className:"tw-size-4"}))),Gn.default.createElement(Mn,null,"Regenerate")),Gn.default.createElement(Kn,null,Gn.default.createElement(Wn,{asChild:!0},Gn.default.createElement(ve,{onClick:a,variant:"ghost2",size:"fit",title:"Delete"},Gn.default.createElement(cy,{className:"tw-size-4"}))),Gn.default.createElement(Mn,null,"Delete"))));var HXr=require("obsidian"),fLe=class extends HXr.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 Bb=L(X());var VXr=({initialValue:t,initialContext:e,onSave:r,onCancel:n,app:o})=>{let[i,a]=(0,Bb.useState)(t),[s,u]=(0,Bb.useState)(e?.notes?.map(x=>x)||[]),[l,c]=(0,Bb.useState)(!1),[d,f]=(0,Bb.useState)([]),p=(0,Bb.useCallback)((x,O)=>{let E={notes:O.notes,urls:O.urls,tags:O.tags,folders:O.folders,selectedTextContexts:e?.selectedTextContexts||[]};r(x,E)},[r,e?.selectedTextContexts]),m=(0,Bb.useCallback)(()=>{n()},[n]),h=(0,Bb.useCallback)(()=>{},[]),g=(0,Bb.useCallback)(()=>{},[]),y=(0,Bb.useCallback)(x=>{f(O=>[...O,...x])},[]),b=(0,Bb.useCallback)(x=>{},[]),_=(0,Bb.useCallback)(()=>{},[]),w={notes:s,urls:e?.urls||[],tags:e?.tags||[],folders:e?.folders||[]};return Bb.default.createElement(dLe,{inputMessage:i,setInputMessage:a,handleSendMessage:h,isGenerating:!1,onStopGenerating:g,app:o,contextNotes:s,setContextNotes:u,includeActiveNote:l,setIncludeActiveNote:c,selectedImages:d,onAddImage:y,setSelectedImages:f,disableModelSwitch:!1,selectedTextContexts:e?.selectedTextContexts,onRemoveSelectedText:b,showProgressCard:_,editMode:!0,onEditSave:p,onEditCancel:m,initialContext:w})};Tu();Ro();Pt();Ro();var SX=L(X());var ai=({label:t,required:e=!1,error:r=!1,description:n,errorMessage:o="This field is required",children:i})=>SX.default.createElement("div",{className:"tw-space-y-2"},t&&SX.default.createElement(Ib,{className:r?"tw-text-error":""},t," ",e&&SX.default.createElement("span",{className:"tw-text-error"},"*")),n&&SX.default.createElement("p",{className:"tw-text-sm tw-text-muted"},n),i,r&&SX.default.createElement("p",{className:"tw-text-xs tw-text-error"},o));var Ow=L(X());jn();On();zz();Dt();wr();function HI({value:t,onChange:e,placeholder:r,disabled:n,className:o}){let[i,a]=(0,Ow.useState)(!1),s=(0,Ow.useRef)(null),u=(0,Ow.useRef)(!0);return(0,Ow.useEffect)(()=>{(async()=>{if(u.current&&t&&s.current){try{s.current.value=await $i(t)}catch(c){ue("Failed to decrypt value:"+Eo(c)),s.current.value=t}u.current=!1}else s.current&&(s.current.value=t||"")})()},[t]),Ow.default.createElement("div",{className:Oe("tw-relative",o)},Ow.default.createElement(yi,{ref:s,type:i?"text":"password",onChange:l=>e?.(l.target.value),placeholder:r,disabled:n,className:Oe("tw-w-full !tw-pr-7")}),Ow.default.createElement("div",{onClick:()=>!n&&a(!i),className:Oe("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?Ow.default.createElement(yte,{className:Oe("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")}):Ow.default.createElement(WN,{className:Oe("tw-size-3.5","tw-text-muted/60 hover:tw-text-accent","tw-transition-colors tw-duration-200")})))}Ro();On();var Wx=L(X()),JXr=require("obsidian"),Ci=({content:t,children:e,side:r="bottom",delayDuration:n=0,contentClassName:o,buttonClassName:i})=>{let a=JXr.Platform.isMobile,[s,u]=(0,Wx.useState)(!1),l=Wx.default.useRef(!1),c=()=>{a&&(l.current=!0)},d=()=>{a&&(u(!s),setTimeout(()=>{l.current=!1},100))};return Wx.default.createElement(tv,{delayDuration:n},Wx.default.createElement(Kn,{open:s,onOpenChange:f=>{a&&l.current||u(f)}},Wx.default.createElement(Wn,{asChild:!0},e?Wx.default.createElement("div",{onClick:d,onTouchStart:c,className:"tw-cursor-pointer"},e):Wx.default.createElement(ve,{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||""}`},Wx.default.createElement(GL,{className:"tw-size-4"}))),Wx.default.createElement(Mn,{side:r,className:o},t)))};zr();Pt();wr();var jLe=require("obsidian"),Ke=L(X()),QQr=L(wm());var iu=L(X());var y3=L(X());var _u=L(X(),1);function r_t(t,[e,r]){return Math.min(r,Math.max(e,t))}function g3(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var WXr=L(X(),1);function KXr(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function gci(...t){return e=>{let r=!1,n=t.map(o=>{let i=KXr(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():KXr(t[o],null)}}}}function VI(...t){return WXr.useCallback(gci(...t),t)}var P$=L(X(),1),GXr=L(mt(),1);function pLe(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,g=P$.useMemo(()=>m,Object.values(m));return(0,GXr.jsx)(h.Provider,{value:g,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,yci(o,...e)]}function yci(...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 I0=L(X(),1);var ZXr=L(X(),1),mLe=globalThis?.document?ZXr.useLayoutEffect:()=>{};var hLe=L(X(),1);var bci=I0[" useInsertionEffect ".trim().toString()]||mLe;function XXr({prop:t,defaultProp:e,onChange:r=()=>{},caller:n}){let[o,i,a]=_ci({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=vci(c)?c(t):c;d!==t&&a.current?.(d)}else i(c)},[s,t,i,a]);return[u,l]}function _ci({defaultProp:t,onChange:e}){let[r,n]=I0.useState(t),o=I0.useRef(r),i=I0.useRef(e);return bci(()=>{i.current=e},[e]),I0.useEffect(()=>{o.current!==r&&(i.current?.(r),o.current=r)},[r,o]),[r,n,i]}function vci(t){return typeof t=="function"}var fNs=Symbol("RADIX:SYNC_STATE");var gLe=L(X(),1),wci=L(mt(),1),Sci=gLe.createContext(void 0);function YXr(t){let e=gLe.useContext(Sci);return t||e||"ltr"}var yLe=L(X(),1);function QXr(t){let e=yLe.useRef({value:t,previous:t});return yLe.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var eYr=L(X(),1);function tYr(t){let[e,r]=eYr.useState(void 0);return mLe(()=>{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 rYr=L(X(),1),Cci=L(Bu(),1);ah();var nYr=L(mt(),1),xci=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],CX=xci.reduce((t,e)=>{let r=Ji(`Primitive.${e}`),n=rYr.forwardRef((o,i)=>{let{asChild:a,...s}=o,u=a?r:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,nYr.jsx)(u,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});var SU=L(X(),1);ah();var bLe=L(mt(),1),Oci=L(X(),1);var Tci=L(mt(),1);function oYr(t){let e=t+"CollectionProvider",[r,n]=pLe(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=h=>{let{scope:g,children:y}=h,b=SU.default.useRef(null),_=SU.default.useRef(new Map).current;return(0,bLe.jsx)(o,{scope:g,itemMap:_,collectionRef:b,children:y})};a.displayName=e;let s=t+"CollectionSlot",u=Ji(s),l=SU.default.forwardRef((h,g)=>{let{scope:y,children:b}=h,_=i(s,y),w=VI(g,_.collectionRef);return(0,bLe.jsx)(u,{ref:w,children:b})});l.displayName=s;let c=t+"CollectionItemSlot",d="data-radix-collection-item",f=Ji(c),p=SU.default.forwardRef((h,g)=>{let{scope:y,children:b,..._}=h,w=SU.default.useRef(null),x=VI(g,w),O=i(c,y);return SU.default.useEffect(()=>(O.itemMap.set(w,{ref:w,..._}),()=>void O.itemMap.delete(w))),(0,bLe.jsx)(f,{[d]:"",ref:x,children:b})});p.displayName=c;function m(h){let g=i(t+"CollectionConsumer",h);return SU.default.useCallback(()=>{let b=g.collectionRef.current;if(!b)return[];let _=Array.from(b.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((O,E)=>_.indexOf(O.ref.current)-_.indexOf(E.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:a,Slot:l,ItemSlot:p},m,n]}var Km=L(mt(),1),iYr=["PageUp","PageDown"],aYr=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],sYr={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},xX="Slider",[n_t,Eci,Pci]=oYr(xX),[uYr,DNs]=pLe(xX,[Pci]),[Mci,_Le]=uYr(xX),lYr=_u.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,g=_u.useRef(new Set),y=_u.useRef(0),_=a==="horizontal"?Rci:Aci,[w=[],x]=XXr({prop:c,defaultProp:l,onChange:D=>{[...g.current][y.current]?.focus(),d(D)}}),O=_u.useRef(w);function E(D){let F=$ci(w,D);N(D,F)}function T(D){N(D,y.current)}function R(){let D=O.current[y.current];w[y.current]!==D&&f(w)}function N(D,F,{commit:B}={commit:!1}){let U=qci(i),H=Bci(Math.round((D-n)/i)*i+n,U),G=r_t(H,[n,o]);x((ie=[])=>{let oe=jci(ie,G,F);if(kci(oe,u*i)){y.current=oe.indexOf(G);let z=String(oe)!==String(ie);return z&&B&&f(oe),z?oe:ie}else return ie})}return(0,Km.jsx)(Mci,{scope:t.__scopeSlider,name:r,disabled:s,min:n,max:o,valueIndexToChangeRef:y,thumbs:g.current,values:w,orientation:a,form:m,children:(0,Km.jsx)(n_t.Provider,{scope:t.__scopeSlider,children:(0,Km.jsx)(n_t.Slot,{scope:t.__scopeSlider,children:(0,Km.jsx)(_,{"aria-disabled":s,"data-disabled":s?"":void 0,...h,ref:e,onPointerDown:g3(h.onPointerDown,()=>{s||(O.current=w)}),min:n,max:o,inverted:p,onSlideStart:s?void 0:E,onSlideMove:s?void 0:T,onSlideEnd:s?void 0:R,onHomeKeyDown:()=>!s&&N(n,0,{commit:!0}),onEndKeyDown:()=>!s&&N(o,w.length-1,{commit:!0}),onStepKeyDown:({event:D,direction:F})=>{if(!s){let H=iYr.includes(D.key)||D.shiftKey&&aYr.includes(D.key)?10:1,G=y.current,ie=w[G],oe=i*H*F;N(ie+oe,G,{commit:!0})}}})})})})});lYr.displayName=xX;var[cYr,dYr]=uYr(xX,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Rci=_u.forwardRef((t,e)=>{let{min:r,max:n,dir:o,inverted:i,onSlideStart:a,onSlideMove:s,onSlideEnd:u,onStepKeyDown:l,...c}=t,[d,f]=_u.useState(null),p=VI(e,_=>f(_)),m=_u.useRef(void 0),h=YXr(o),g=h==="ltr",y=g&&!i||!g&&i;function b(_){let w=m.current||d.getBoundingClientRect(),x=[0,w.width],E=a_t(x,y?[r,n]:[n,r]);return m.current=w,E(_-w.left)}return(0,Km.jsx)(cYr,{scope:t.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:(0,Km.jsx)(fYr,{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 x=sYr[y?"from-left":"from-right"].includes(_.key);l?.({event:_,direction:x?-1:1})}})})}),Aci=_u.forwardRef((t,e)=>{let{min:r,max:n,inverted:o,onSlideStart:i,onSlideMove:a,onSlideEnd:s,onStepKeyDown:u,...l}=t,c=_u.useRef(null),d=VI(e,c),f=_u.useRef(void 0),p=!o;function m(h){let g=f.current||c.current.getBoundingClientRect(),y=[0,g.height],_=a_t(y,p?[n,r]:[r,n]);return f.current=g,_(h-g.top)}return(0,Km.jsx)(cYr,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:(0,Km.jsx)(fYr,{"data-orientation":"vertical",...l,ref:d,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:h=>{let g=m(h.clientY);i?.(g)},onSlideMove:h=>{let g=m(h.clientY);a?.(g)},onSlideEnd:()=>{f.current=void 0,s?.()},onStepKeyDown:h=>{let y=sYr[p?"from-bottom":"from-top"].includes(h.key);u?.({event:h,direction:y?-1:1})}})})}),fYr=_u.forwardRef((t,e)=>{let{__scopeSlider:r,onSlideStart:n,onSlideMove:o,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:s,onStepKeyDown:u,...l}=t,c=_Le(xX,r);return(0,Km.jsx)(CX.span,{...l,ref:e,onKeyDown:g3(t.onKeyDown,d=>{d.key==="Home"?(a(d),d.preventDefault()):d.key==="End"?(s(d),d.preventDefault()):iYr.concat(aYr).includes(d.key)&&(u(d),d.preventDefault())}),onPointerDown:g3(t.onPointerDown,d=>{let f=d.target;f.setPointerCapture(d.pointerId),d.preventDefault(),c.thumbs.has(f)?f.focus():n(d)}),onPointerMove:g3(t.onPointerMove,d=>{d.target.hasPointerCapture(d.pointerId)&&o(d)}),onPointerUp:g3(t.onPointerUp,d=>{let f=d.target;f.hasPointerCapture(d.pointerId)&&(f.releasePointerCapture(d.pointerId),i(d))})})}),pYr="SliderTrack",mYr=_u.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=_Le(pYr,r);return(0,Km.jsx)(CX.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...n,ref:e})});mYr.displayName=pYr;var o_t="SliderRange",hYr=_u.forwardRef((t,e)=>{let{__scopeSlider:r,...n}=t,o=_Le(o_t,r),i=dYr(o_t,r),a=_u.useRef(null),s=VI(e,a),u=o.values.length,l=o.values.map(f=>bYr(f,o.min,o.max)),c=u>1?Math.min(...l):0,d=100-Math.max(...l);return(0,Km.jsx)(CX.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...n,ref:s,style:{...t.style,[i.startEdge]:c+"%",[i.endEdge]:d+"%"}})});hYr.displayName=o_t;var i_t="SliderThumb",gYr=_u.forwardRef((t,e)=>{let r=Eci(t.__scopeSlider),[n,o]=_u.useState(null),i=VI(e,s=>o(s)),a=_u.useMemo(()=>n?r().findIndex(s=>s.ref.current===n):-1,[r,n]);return(0,Km.jsx)(Ici,{...t,ref:i,index:a})}),Ici=_u.forwardRef((t,e)=>{let{__scopeSlider:r,index:n,name:o,...i}=t,a=_Le(i_t,r),s=dYr(i_t,r),[u,l]=_u.useState(null),c=VI(e,b=>l(b)),d=u?a.form||!!u.closest("form"):!0,f=tYr(u),p=a.values[n],m=p===void 0?0:bYr(p,a.min,a.max),h=Dci(n,a.values.length),g=f?.[s.size],y=g?Lci(g,m,s.direction):0;return _u.useEffect(()=>{if(u)return a.thumbs.add(u),()=>{a.thumbs.delete(u)}},[u,a.thumbs]),(0,Km.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${m}% + ${y}px)`},children:[(0,Km.jsx)(n_t.ItemSlot,{scope:t.__scopeSlider,children:(0,Km.jsx)(CX.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:g3(t.onFocus,()=>{a.valueIndexToChangeRef.current=n})})}),d&&(0,Km.jsx)(yYr,{name:o??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:p},n)]})});gYr.displayName=i_t;var Nci="RadioBubbleInput",yYr=_u.forwardRef(({__scopeSlider:t,value:e,...r},n)=>{let o=_u.useRef(null),i=VI(o,n),a=QXr(e);return _u.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,Km.jsx)(CX.input,{style:{display:"none"},...r,ref:i,defaultValue:e})});yYr.displayName=Nci;function jci(t=[],e,r){let n=[...t];return n[r]=e,n.sort((o,i)=>o-i)}function bYr(t,e,r){let i=100/(r-e)*(t-e);return r_t(i,[0,100])}function Dci(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function $ci(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 Lci(t,e,r){let n=t/2,i=a_t([0,50],[0,n]);return(n-i(e)*r)*r}function Fci(t){return t.slice(0,-1).map((e,r)=>t[r+1]-e)}function kci(t,e){if(e>0){let r=Fci(t);return Math.min(...r)>=e}return!0}function a_t(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 qci(t){return(String(t).split(".")[1]||"").length}function Bci(t,e){let r=Math.pow(10,e);return Math.round(t*r)/r}var s_t=lYr,_Yr=mYr,vYr=hYr,wYr=gYr;jn();var Ide=y3.forwardRef(({className:t,...e},r)=>y3.createElement(s_t,{ref:r,className:Oe("tw-relative tw-flex tw-w-full tw-touch-none tw-select-none tw-items-center",t),...e},y3.createElement(_Yr,{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"},y3.createElement(vYr,{className:"tw-absolute tw-h-full tw-bg-interactive-accent"})),y3.createElement(wYr,{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"})));Ide.displayName=s_t.displayName;Ro();var vu=L(X());var Ht=L(X(),1),N_t=L(Bu(),1);function u_t(t,[e,r]){return Math.min(r,Math.max(e,t))}function qc(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var CU=L(X(),1);var M$=L(X(),1),SYr=L(mt(),1);function CYr(t,e=[]){let r=[];function n(i,a){let s=M$.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,g=M$.useMemo(()=>m,Object.values(m));return(0,SYr.jsx)(h.Provider,{value:g,children:p})}function c(d,f){let p=f?.[t][u]||s,m=M$.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>M$.createContext(a));return function(s){let u=s?.[t]||i;return M$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,zci(o,...e)]}function zci(...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 M$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var $g=L(X(),1);var OX=L(mt(),1),vLe=$g.forwardRef((t,e)=>{let{children:r,...n}=t,o=$g.Children.toArray(r),i=o.find(Vci);if(i){let a=i.props.children,s=o.map(u=>u===i?$g.Children.count(a)>1?$g.Children.only(null):$g.isValidElement(a)?a.props.children:null:u);return(0,OX.jsx)(l_t,{...n,ref:e,children:$g.isValidElement(a)?$g.cloneElement(a,void 0,s):null})}return(0,OX.jsx)(l_t,{...n,ref:e,children:r})});vLe.displayName="Slot";var l_t=$g.forwardRef((t,e)=>{let{children:r,...n}=t;if($g.isValidElement(r)){let o=Kci(r);return $g.cloneElement(r,{...Jci(n,r.props),ref:e?wJ(e,o):o})}return $g.Children.count(r)>1?$g.Children.only(null):null});l_t.displayName="SlotClone";var Hci=({children:t})=>(0,OX.jsx)(OX.Fragment,{children:t});function Vci(t){return $g.isValidElement(t)&&t.type===Hci}function Jci(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 Kci(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 wLe=L(mt(),1);function xYr(t){let e=t+"CollectionProvider",[r,n]=CYr(e),[o,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),a=p=>{let{scope:m,children:h}=p,g=CU.default.useRef(null),y=CU.default.useRef(new Map).current;return(0,wLe.jsx)(o,{scope:m,itemMap:y,collectionRef:g,children:h})};a.displayName=e;let s=t+"CollectionSlot",u=CU.default.forwardRef((p,m)=>{let{scope:h,children:g}=p,y=i(s,h),b=Fc(m,y.collectionRef);return(0,wLe.jsx)(vLe,{ref:b,children:g})});u.displayName=s;let l=t+"CollectionItemSlot",c="data-radix-collection-item",d=CU.default.forwardRef((p,m)=>{let{scope:h,children:g,...y}=p,b=CU.default.useRef(null),_=Fc(m,b),w=i(l,h);return CU.default.useEffect(()=>(w.itemMap.set(b,{ref:b,...y}),()=>void w.itemMap.delete(b))),(0,wLe.jsx)(vLe,{[c]:"",ref:_,children:g})});d.displayName=l;function f(p){let m=i(t+"CollectionConsumer",p);return CU.default.useCallback(()=>{let g=m.collectionRef.current;if(!g)return[];let y=Array.from(g.querySelectorAll(`[${c}]`));return Array.from(m.itemMap.values()).sort((w,x)=>y.indexOf(w.ref.current)-y.indexOf(x.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:a,Slot:u,ItemSlot:d},f,n]}var SLe=L(X(),1),Wci=L(mt(),1),Gci=SLe.createContext(void 0);function OYr(t){let e=SLe.useContext(Gci);return t||e||"ltr"}var Sc=L(X(),1);var TYr=L(X(),1);function CLe(t,e=globalThis?.document){let r=ad(t);TYr.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 d_t=L(mt(),1),Zci="DismissableLayer",c_t="dismissableLayer.update",Xci="dismissableLayer.pointerDownOutside",Yci="dismissableLayer.focusOutside",EYr,MYr=Sc.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),f_t=Sc.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Sc.useContext(MYr),[c,d]=Sc.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Sc.useState({}),m=Fc(e,E=>d(E)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=h.indexOf(g),b=c?h.indexOf(c):-1,_=l.layersWithOutsidePointerEventsDisabled.size>0,w=b>=y,x=tdi(E=>{let T=E.target,R=[...l.branches].some(N=>N.contains(T));!w||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),O=rdi(E=>{let T=E.target;[...l.branches].some(N=>N.contains(T))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return CLe(E=>{b===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Sc.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(EYr=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),PYr(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=EYr)}},[c,f,r,l]),Sc.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),PYr())},[c,l]),Sc.useEffect(()=>{let E=()=>p({});return document.addEventListener(c_t,E),()=>document.removeEventListener(c_t,E)},[]),(0,d_t.jsx)(ou.div,{...u,ref:m,style:{pointerEvents:_?w?"auto":"none":void 0,...t.style},onFocusCapture:qc(t.onFocusCapture,O.onFocusCapture),onBlurCapture:qc(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:qc(t.onPointerDownCapture,x.onPointerDownCapture)})});f_t.displayName=Zci;var Qci="DismissableLayerBranch",edi=Sc.forwardRef((t,e)=>{let r=Sc.useContext(MYr),n=Sc.useRef(null),o=Fc(e,n);return Sc.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,d_t.jsx)(ou.div,{...t,ref:o})});edi.displayName=Qci;function tdi(t,e=globalThis?.document){let r=ad(t),n=Sc.useRef(!1),o=Sc.useRef(()=>{});return Sc.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){RYr(Xci,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 rdi(t,e=globalThis?.document){let r=ad(t),n=Sc.useRef(!1);return Sc.useEffect(()=>{let o=i=>{i.target&&!n.current&&RYr(Yci,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 PYr(){let t=new CustomEvent(c_t);document.dispatchEvent(t)}function RYr(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?Q2r(o,i):o.dispatchEvent(i)}var IYr=L(X(),1),p_t=0;function xLe(){IYr.useEffect(()=>{let t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??AYr()),document.body.insertAdjacentElement("beforeend",t[1]??AYr()),p_t++,()=>{p_t===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),p_t--}},[])}function AYr(){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 N0=L(X(),1);var LYr=L(mt(),1),m_t="focusScope.autoFocusOnMount",h_t="focusScope.autoFocusOnUnmount",NYr={bubbles:!1,cancelable:!0},ndi="FocusScope",g_t=N0.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=N0.useState(null),l=ad(o),c=ad(i),d=N0.useRef(null),f=Fc(e,h=>u(h)),p=N0.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;N0.useEffect(()=>{if(n){let b=function(O){if(p.paused||!s)return;let E=O.target;s.contains(E)?d.current=E:xU(d.current,{select:!0})},_=function(O){if(p.paused||!s)return;let E=O.relatedTarget;E!==null&&(s.contains(E)||xU(d.current,{select:!0}))},w=function(O){if(document.activeElement===document.body)for(let T of O)T.removedNodes.length>0&&xU(s)};var h=b,g=_,y=w;document.addEventListener("focusin",b),document.addEventListener("focusout",_);let x=new MutationObserver(w);return s&&x.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",_),x.disconnect()}}},[n,s,p.paused]),N0.useEffect(()=>{if(s){DYr.add(p);let h=document.activeElement;if(!s.contains(h)){let y=new CustomEvent(m_t,NYr);s.addEventListener(m_t,l),s.dispatchEvent(y),y.defaultPrevented||(odi(ldi(FYr(s)),{select:!0}),document.activeElement===h&&xU(s))}return()=>{s.removeEventListener(m_t,l),setTimeout(()=>{let y=new CustomEvent(h_t,NYr);s.addEventListener(h_t,c),s.dispatchEvent(y),y.defaultPrevented||xU(h??document.body,{select:!0}),s.removeEventListener(h_t,c),DYr.remove(p)},0)}}},[s,l,c,p]);let m=N0.useCallback(h=>{if(!r&&!n||p.paused)return;let g=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,y=document.activeElement;if(g&&y){let b=h.currentTarget,[_,w]=idi(b);_&&w?!h.shiftKey&&y===w?(h.preventDefault(),r&&xU(_,{select:!0})):h.shiftKey&&y===_&&(h.preventDefault(),r&&xU(w,{select:!0})):y===b&&h.preventDefault()}},[r,n,p.paused]);return(0,LYr.jsx)(ou.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});g_t.displayName=ndi;function odi(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(xU(n,{select:e}),document.activeElement!==r)return}function idi(t){let e=FYr(t),r=jYr(e,t),n=jYr(e.reverse(),t);return[r,n]}function FYr(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 jYr(t,e){for(let r of t)if(!adi(r,{upTo:e}))return r}function adi(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 sdi(t){return t instanceof HTMLInputElement&&"select"in t}function xU(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&sdi(t)&&e&&t.select()}}var DYr=udi();function udi(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=$Yr(t,e),t.unshift(e)},remove(e){t=$Yr(t,e),t[0]?.resume()}}}function $Yr(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function ldi(t){return t.filter(e=>e.tagName!=="A")}var OLe=L(X(),1);var cdi=OLe.useId||(()=>{}),ddi=0;function JI(t){let[e,r]=OLe.useState(cdi());return gl(()=>{t||r(n=>n??String(ddi++))},[t]),t||(e?`radix-${e}`:"")}var Tw=L(X(),1);var kYr=L(X(),1);var y_t=L(mt(),1),fdi="Arrow",qYr=kYr.forwardRef((t,e)=>{let{children:r,width:n=10,height:o=5,...i}=t;return(0,y_t.jsx)(ou.svg,{...i,ref:e,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,y_t.jsx)("polygon",{points:"0,0 30,0 15,10"})})});qYr.displayName=fdi;var BYr=qYr;var R$=L(X(),1),UYr=L(mt(),1);function zYr(t,e=[]){let r=[];function n(i,a){let s=R$.createContext(a),u=r.length;r=[...r,a];function l(d){let{scope:f,children:p,...m}=d,h=f?.[t][u]||s,g=R$.useMemo(()=>m,Object.values(m));return(0,UYr.jsx)(h.Provider,{value:g,children:p})}function c(d,f){let p=f?.[t][u]||s,m=R$.useContext(p);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return l.displayName=i+"Provider",[l,c]}let o=()=>{let i=r.map(a=>R$.createContext(a));return function(s){let u=s?.[t]||i;return R$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,mdi(o,...e)]}function mdi(...t){let e=t[0];if(t.length===1)return e;let r=()=>{let n=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){let a=n.reduce((s,{useScope:u,scopeName:l})=>{let d=u(i)[`__scope${l}`];return{...s,...d}},{});return R$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var OU=L(mt(),1);var b_t="Popper",[HYr,__t]=zYr(b_t),[hdi,VYr]=HYr(b_t),JYr=t=>{let{__scopePopper:e,children:r}=t,[n,o]=Tw.useState(null);return(0,OU.jsx)(hdi,{scope:e,anchor:n,onAnchorChange:o,children:r})};JYr.displayName=b_t;var KYr="PopperAnchor",WYr=Tw.forwardRef((t,e)=>{let{__scopePopper:r,virtualRef:n,...o}=t,i=VYr(KYr,r),a=Tw.useRef(null),s=Fc(e,a);return Tw.useEffect(()=>{i.onAnchorChange(n?.current||a.current)}),n?null:(0,OU.jsx)(ou.div,{...o,ref:s})});WYr.displayName=KYr;var v_t="PopperContent",[gdi,ydi]=HYr(v_t),GYr=Tw.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,g=VYr(v_t,r),[y,b]=Tw.useState(null),_=Fc(e,A=>b(A)),[w,x]=Tw.useState(null),O=dje(w),E=O?.width??0,T=O?.height??0,R=n+(i!=="center"?"-"+i:""),N=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},D=Array.isArray(l)?l:[l],F=D.length>0,B={padding:N,boundary:D.filter(_di),altBoundary:F},{refs:U,floatingStyles:H,placement:G,isPositioned:ie,middlewareData:oe}=DB({strategy:"fixed",placement:R,whileElementsMounted:(...A)=>o$(...A,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[$B({mainAxis:o+T,alignmentAxis:a}),u&&LB({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?FB():void 0,...B}),u&&kB({...B}),qB({...B,apply:({elements:A,rects:W,availableWidth:V,availableHeight:se})=>{let{width:be,height:Ee}=W.reference,Ae=A.floating.style;Ae.setProperty("--radix-popper-available-width",`${V}px`),Ae.setProperty("--radix-popper-available-height",`${se}px`),Ae.setProperty("--radix-popper-anchor-width",`${be}px`),Ae.setProperty("--radix-popper-anchor-height",`${Ee}px`)}}),w&&UB({element:w,padding:s}),vdi({arrowWidth:E,arrowHeight:T}),f&&BB({strategy:"referenceHidden",...B})]}),[z,Q]=YYr(G),re=ad(m);gl(()=>{ie&&re?.()},[ie,re]);let Z=oe.arrow?.x,$=oe.arrow?.y,q=oe.arrow?.centerOffset!==0,[Y,j]=Tw.useState();return gl(()=>{y&&j(window.getComputedStyle(y).zIndex)},[y]),(0,OU.jsx)("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:ie?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[oe.transformOrigin?.x,oe.transformOrigin?.y].join(" "),...oe.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,OU.jsx)(gdi,{scope:r,placedSide:z,onArrowChange:x,arrowX:Z,arrowY:$,shouldHideArrow:q,children:(0,OU.jsx)(ou.div,{"data-side":z,"data-align":Q,...h,ref:_,style:{...h.style,animation:ie?void 0:"none"}})})})});GYr.displayName=v_t;var ZYr="PopperArrow",bdi={top:"bottom",right:"left",bottom:"top",left:"right"},XYr=Tw.forwardRef(function(e,r){let{__scopePopper:n,...o}=e,i=ydi(ZYr,n),a=bdi[i.placedSide];return(0,OU.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,OU.jsx)(BYr,{...o,ref:r,style:{...o.style,display:"block"}})})});XYr.displayName=ZYr;function _di(t){return t!==null}var vdi=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]=YYr(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 YYr(t){let[e,r="center"]=t.split("-");return[e,r]}var QYr=JYr,eQr=WYr,tQr=GYr,rQr=XYr;var TLe=L(X(),1),nQr=L(Bu(),1);var oQr=L(mt(),1),Sdi="Portal",w_t=TLe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=TLe.useState(!1);gl(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?nQr.default.createPortal((0,oQr.jsx)(ou.div,{...n,ref:e}),a):null});w_t.displayName=Sdi;var Lg=L(X(),1);var TX=L(mt(),1),C_t=Lg.forwardRef((t,e)=>{let{children:r,...n}=t,o=Lg.Children.toArray(r),i=o.find(xdi);if(i){let a=i.props.children,s=o.map(u=>u===i?Lg.Children.count(a)>1?Lg.Children.only(null):Lg.isValidElement(a)?a.props.children:null:u);return(0,TX.jsx)(S_t,{...n,ref:e,children:Lg.isValidElement(a)?Lg.cloneElement(a,void 0,s):null})}return(0,TX.jsx)(S_t,{...n,ref:e,children:r})});C_t.displayName="Slot";var S_t=Lg.forwardRef((t,e)=>{let{children:r,...n}=t;if(Lg.isValidElement(r)){let o=Tdi(r);return Lg.cloneElement(r,{...Odi(n,r.props),ref:e?wJ(e,o):o})}return Lg.Children.count(r)>1?Lg.Children.only(null):null});S_t.displayName="SlotClone";var Cdi=({children:t})=>(0,TX.jsx)(TX.Fragment,{children:t});function xdi(t){return Lg.isValidElement(t)&&t.type===Cdi}function Odi(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 Tdi(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 iQr=L(X(),1);var aQr=L(mt(),1),Edi="VisuallyHidden",x_t=iQr.forwardRef((t,e)=>(0,aQr.jsx)(ou.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));x_t.displayName=Edi;var MLe=L(X());var ky=L(X());var ELe=$J();var O_t=function(){},Nde=ky.forwardRef(function(t,e){var r=ky.useRef(null),n=ky.useState({onScrollCapture:O_t,onWheelCapture:O_t,onTouchMoveCapture:O_t}),o=n[0],i=n[1],a=t.forwardProps,s=t.children,u=t.className,l=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,p=t.noIsolation,m=t.inert,h=t.allowPinchZoom,g=t.as,y=g===void 0?"div":g,b=t.gapMode,_=KB(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=f,x=DJ([r,e]),O=Ws(Ws({},_),o);return ky.createElement(ky.Fragment,null,c&&ky.createElement(w,{sideCar:ELe,removeScrollBar:l,shards:d,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!h,lockRef:r,gapMode:b}),a?ky.cloneElement(ky.Children.only(s),Ws(Ws({},O),{ref:x})):ky.createElement(y,Ws({},O,{className:u,ref:x}),s))});Nde.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Nde.classNames={fullWidth:Rx,zeroRight:Mx};var _l=L(X());var T_t=!1;if(typeof window<"u")try{jde=Object.defineProperty({},"passive",{get:function(){return T_t=!0,!0}}),window.addEventListener("test",jde,jde),window.removeEventListener("test",jde,jde)}catch{T_t=!1}var jde,b3=T_t?{passive:!1}:!1;var Pdi=function(t){return t.tagName==="TEXTAREA"},sQr=function(t,e){if(!(t instanceof Element))return!1;var r=window.getComputedStyle(t);return r[e]!=="hidden"&&!(r.overflowY===r.overflowX&&!Pdi(t)&&r[e]==="visible")},Mdi=function(t){return sQr(t,"overflowY")},Rdi=function(t){return sQr(t,"overflowX")},E_t=function(t,e){var r=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=uQr(t,n);if(o){var i=lQr(t,n),a=i[1],s=i[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Adi=function(t){var e=t.scrollTop,r=t.scrollHeight,n=t.clientHeight;return[e,r,n]},Idi=function(t){var e=t.scrollLeft,r=t.scrollWidth,n=t.clientWidth;return[e,r,n]},uQr=function(t,e){return t==="v"?Mdi(e):Rdi(e)},lQr=function(t,e){return t==="v"?Adi(e):Idi(e)},Ndi=function(t,e){return t==="h"&&e==="rtl"?-1:1},cQr=function(t,e,r,n,o){var i=Ndi(t,window.getComputedStyle(e).direction),a=i*n,s=r.target,u=e.contains(s),l=!1,c=a>0,d=0,f=0;do{var p=lQr(t,s),m=p[0],h=p[1],g=p[2],y=h-g-i*m;(m||y)&&uQr(t,s)&&(d+=y,f+=m),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!u&&s!==document.body||u&&(e.contains(s)||e===s));return(c&&(o&&Math.abs(d)<1||!o&&a>d)||!c&&(o&&Math.abs(f)<1||!o&&-a>f))&&(l=!0),l};var PLe=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},dQr=function(t){return[t.deltaX,t.deltaY]},fQr=function(t){return t&&"current"in t?t.current:t},jdi=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Ddi=function(t){return`
|
||
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
||
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
||
`)},$di=0,EX=[];function pQr(t){var e=_l.useRef([]),r=_l.useRef([0,0]),n=_l.useRef(),o=_l.useState($di++)[0],i=_l.useState(a$)[0],a=_l.useRef(t);_l.useEffect(function(){a.current=t},[t]),_l.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var h=_Z([t.lockRef.current],(t.shards||[]).map(fQr),!0).filter(Boolean);return h.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var s=_l.useCallback(function(h,g){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var y=PLe(h),b=r.current,_="deltaX"in h?h.deltaX:b[0]-y[0],w="deltaY"in h?h.deltaY:b[1]-y[1],x,O=h.target,E=Math.abs(_)>Math.abs(w)?"h":"v";if("touches"in h&&E==="h"&&O.type==="range")return!1;var T=E_t(E,O);if(!T)return!0;if(T?x=E:(x=E==="v"?"h":"v",T=E_t(E,O)),!T)return!1;if(!n.current&&"changedTouches"in h&&(_||w)&&(n.current=x),!x)return!0;var R=n.current||x;return cQr(R,g,h,R==="h"?_:w,!0)},[]),u=_l.useCallback(function(h){var g=h;if(!(!EX.length||EX[EX.length-1]!==i)){var y="deltaY"in g?dQr(g):PLe(g),b=e.current.filter(function(x){return x.name===g.type&&(x.target===g.target||g.target===x.shadowParent)&&jdi(x.delta,y)})[0];if(b&&b.should){g.cancelable&&g.preventDefault();return}if(!b){var _=(a.current.shards||[]).map(fQr).filter(Boolean).filter(function(x){return x.contains(g.target)}),w=_.length>0?s(g,_[0]):!a.current.noIsolation;w&&g.cancelable&&g.preventDefault()}}},[]),l=_l.useCallback(function(h,g,y,b){var _={name:h,delta:g,target:y,should:b,shadowParent:Ldi(y)};e.current.push(_),setTimeout(function(){e.current=e.current.filter(function(w){return w!==_})},1)},[]),c=_l.useCallback(function(h){r.current=PLe(h),n.current=void 0},[]),d=_l.useCallback(function(h){l(h.type,dQr(h),h.target,s(h,t.lockRef.current))},[]),f=_l.useCallback(function(h){l(h.type,PLe(h),h.target,s(h,t.lockRef.current))},[]);_l.useEffect(function(){return EX.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",u,b3),document.addEventListener("touchmove",u,b3),document.addEventListener("touchstart",c,b3),function(){EX=EX.filter(function(h){return h!==i}),document.removeEventListener("wheel",u,b3),document.removeEventListener("touchmove",u,b3),document.removeEventListener("touchstart",c,b3)}},[]);var p=t.removeScrollBar,m=t.inert;return _l.createElement(_l.Fragment,null,m?_l.createElement(i,{styles:Ddi(o)}):null,p?_l.createElement(FJ,{gapMode:t.gapMode}):null)}function Ldi(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var mQr=LJ(ELe,pQr);var hQr=MLe.forwardRef(function(t,e){return MLe.createElement(Nde,Ws({},t,{ref:e,sideCar:mQr}))});hQr.classNames=Nde.classNames;var Dde=hQr;var pn=L(mt(),1),Fdi=[" ","Enter","ArrowUp","ArrowDown"],kdi=[" ","Enter"],Lde="Select",[ALe,ILe,qdi]=xYr(Lde),[PX,yjs]=TB(Lde,[qdi,__t]),NLe=__t(),[Bdi,TU]=PX(Lde),[Udi,zdi]=PX(Lde),gQr=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=NLe(e),[g,y]=Ht.useState(null),[b,_]=Ht.useState(null),[w,x]=Ht.useState(!1),O=OYr(l),[E=!1,T]=GD({prop:n,defaultProp:o,onChange:i}),[R,N]=GD({prop:a,defaultProp:s,onChange:u}),D=Ht.useRef(null),F=g?m||!!g.closest("form"):!0,[B,U]=Ht.useState(new Set),H=Array.from(B).map(G=>G.props.value).join(";");return(0,pn.jsx)(QYr,{...h,children:(0,pn.jsxs)(Bdi,{required:p,scope:e,trigger:g,onTriggerChange:y,valueNode:b,onValueNodeChange:_,valueNodeHasChildren:w,onValueNodeHasChildrenChange:x,contentId:JI(),value:R,onValueChange:N,open:E,onOpenChange:T,dir:O,triggerPointerDownPosRef:D,disabled:f,children:[(0,pn.jsx)(ALe.Provider,{scope:e,children:(0,pn.jsx)(Udi,{scope:t.__scopeSelect,onNativeOptionAdd:Ht.useCallback(G=>{U(ie=>new Set(ie).add(G))},[]),onNativeOptionRemove:Ht.useCallback(G=>{U(ie=>{let oe=new Set(ie);return oe.delete(G),oe})},[]),children:r})}),F?(0,pn.jsxs)(BQr,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:R,onChange:G=>N(G.target.value),disabled:f,form:m,children:[R===void 0?(0,pn.jsx)("option",{value:""}):null,Array.from(B)]},H):null]})})};gQr.displayName=Lde;var yQr="SelectTrigger",bQr=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,disabled:n=!1,...o}=t,i=NLe(r),a=TU(yQr,r),s=a.disabled||n,u=Fc(e,a.onTriggerChange),l=ILe(r),c=Ht.useRef("touch"),[d,f,p]=UQr(h=>{let g=l().filter(_=>!_.disabled),y=g.find(_=>_.value===a.value),b=zQr(g,h,y);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,pn.jsx)(eQr,{asChild:!0,...i,children:(0,pn.jsx)(ou.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":qQr(a.value)?"":void 0,...o,ref:u,onClick:qc(o.onClick,h=>{h.currentTarget.focus(),c.current!=="mouse"&&m(h)}),onPointerDown:qc(o.onPointerDown,h=>{c.current=h.pointerType;let g=h.target;g.hasPointerCapture(h.pointerId)&&g.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(m(h),h.preventDefault())}),onKeyDown:qc(o.onKeyDown,h=>{let g=d.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&f(h.key),!(g&&h.key===" ")&&Fdi.includes(h.key)&&(m(),h.preventDefault())})})})});bQr.displayName=yQr;var _Qr="SelectValue",vQr=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,children:i,placeholder:a="",...s}=t,u=TU(_Qr,r),{onValueNodeHasChildrenChange:l}=u,c=i!==void 0,d=Fc(e,u.onValueNodeChange);return gl(()=>{l(c)},[l,c]),(0,pn.jsx)(ou.span,{...s,ref:d,style:{pointerEvents:"none"},children:qQr(u.value)?(0,pn.jsx)(pn.Fragment,{children:a}):i})});vQr.displayName=_Qr;var Hdi="SelectIcon",wQr=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,children:n,...o}=t;return(0,pn.jsx)(ou.span,{"aria-hidden":!0,...o,ref:e,children:n||"\u25BC"})});wQr.displayName=Hdi;var Vdi="SelectPortal",SQr=t=>(0,pn.jsx)(w_t,{asChild:!0,...t});SQr.displayName=Vdi;var _3="SelectContent",CQr=Ht.forwardRef((t,e)=>{let r=TU(_3,t.__scopeSelect),[n,o]=Ht.useState();if(gl(()=>{o(new DocumentFragment)},[]),!r.open){let i=n;return i?N_t.createPortal((0,pn.jsx)(xQr,{scope:t.__scopeSelect,children:(0,pn.jsx)(ALe.Slot,{scope:t.__scopeSelect,children:(0,pn.jsx)("div",{children:t.children})})}),i):null}return(0,pn.jsx)(OQr,{...t,ref:e})});CQr.displayName=_3;var Gx=10,[xQr,EU]=PX(_3),Jdi="SelectContentImpl",OQr=Ht.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:g,...y}=t,b=TU(_3,r),[_,w]=Ht.useState(null),[x,O]=Ht.useState(null),E=Fc(e,A=>w(A)),[T,R]=Ht.useState(null),[N,D]=Ht.useState(null),F=ILe(r),[B,U]=Ht.useState(!1),H=Ht.useRef(!1);Ht.useEffect(()=>{if(_)return JB(_)},[_]),xLe();let G=Ht.useCallback(A=>{let[W,...V]=F().map(Ee=>Ee.ref.current),[se]=V.slice(-1),be=document.activeElement;for(let Ee of A)if(Ee===be||(Ee?.scrollIntoView({block:"nearest"}),Ee===W&&x&&(x.scrollTop=0),Ee===se&&x&&(x.scrollTop=x.scrollHeight),Ee?.focus(),document.activeElement!==be))return},[F,x]),ie=Ht.useCallback(()=>G([T,_]),[G,T,_]);Ht.useEffect(()=>{B&&ie()},[B,ie]);let{onOpenChange:oe,triggerPointerDownPosRef:z}=b;Ht.useEffect(()=>{if(_){let A={x:0,y:0},W=se=>{A={x:Math.abs(Math.round(se.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(se.pageY)-(z.current?.y??0))}},V=se=>{A.x<=10&&A.y<=10?se.preventDefault():_.contains(se.target)||oe(!1),document.removeEventListener("pointermove",W),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",W),document.addEventListener("pointerup",V,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",W),document.removeEventListener("pointerup",V,{capture:!0})}}},[_,oe,z]),Ht.useEffect(()=>{let A=()=>oe(!1);return window.addEventListener("blur",A),window.addEventListener("resize",A),()=>{window.removeEventListener("blur",A),window.removeEventListener("resize",A)}},[oe]);let[Q,re]=UQr(A=>{let W=F().filter(be=>!be.disabled),V=W.find(be=>be.ref.current===document.activeElement),se=zQr(W,A,V);se&&setTimeout(()=>se.ref.current.focus())}),Z=Ht.useCallback((A,W,V)=>{let se=!H.current&&!V;(b.value!==void 0&&b.value===W||se)&&(R(A),se&&(H.current=!0))},[b.value]),$=Ht.useCallback(()=>_?.focus(),[_]),q=Ht.useCallback((A,W,V)=>{let se=!H.current&&!V;(b.value!==void 0&&b.value===W||se)&&D(A)},[b.value]),Y=n==="popper"?P_t:TQr,j=Y===P_t?{side:s,sideOffset:u,align:l,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,pn.jsx)(xQr,{scope:r,content:_,viewport:x,onViewportChange:O,itemRefCallback:Z,selectedItem:T,onItemLeave:$,itemTextRefCallback:q,focusSelectedItem:ie,selectedItemText:N,position:n,isPositioned:B,searchRef:Q,children:(0,pn.jsx)(Dde,{as:C_t,allowPinchZoom:!0,children:(0,pn.jsx)(g_t,{asChild:!0,trapped:b.open,onMountAutoFocus:A=>{A.preventDefault()},onUnmountAutoFocus:qc(o,A=>{b.trigger?.focus({preventScroll:!0}),A.preventDefault()}),children:(0,pn.jsx)(f_t,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:A=>A.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:(0,pn.jsx)(Y,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:A=>A.preventDefault(),...y,...j,onPlaced:()=>U(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:qc(y.onKeyDown,A=>{let W=A.ctrlKey||A.altKey||A.metaKey;if(A.key==="Tab"&&A.preventDefault(),!W&&A.key.length===1&&re(A.key),["ArrowUp","ArrowDown","Home","End"].includes(A.key)){let se=F().filter(be=>!be.disabled).map(be=>be.ref.current);if(["ArrowUp","End"].includes(A.key)&&(se=se.slice().reverse()),["ArrowUp","ArrowDown"].includes(A.key)){let be=A.target,Ee=se.indexOf(be);se=se.slice(Ee+1)}setTimeout(()=>G(se)),A.preventDefault()}})})})})})})});OQr.displayName=Jdi;var Kdi="SelectItemAlignedPosition",TQr=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,onPlaced:n,...o}=t,i=TU(_3,r),a=EU(_3,r),[s,u]=Ht.useState(null),[l,c]=Ht.useState(null),d=Fc(e,E=>c(E)),f=ILe(r),p=Ht.useRef(!1),m=Ht.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:y,focusSelectedItem:b}=a,_=Ht.useCallback(()=>{if(i.trigger&&i.valueNode&&s&&l&&h&&g&&y){let E=i.trigger.getBoundingClientRect(),T=l.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),N=y.getBoundingClientRect();if(i.dir!=="rtl"){let be=N.left-T.left,Ee=R.left-be,Ae=E.left-Ee,ht=E.width+Ae,Rt=Math.max(ht,T.width),Ze=window.innerWidth-Gx,Dr=u_t(Ee,[Gx,Math.max(Gx,Ze-Rt)]);s.style.minWidth=ht+"px",s.style.left=Dr+"px"}else{let be=T.right-N.right,Ee=window.innerWidth-R.right-be,Ae=window.innerWidth-E.right-Ee,ht=E.width+Ae,Rt=Math.max(ht,T.width),Ze=window.innerWidth-Gx,Dr=u_t(Ee,[Gx,Math.max(Gx,Ze-Rt)]);s.style.minWidth=ht+"px",s.style.right=Dr+"px"}let D=f(),F=window.innerHeight-Gx*2,B=h.scrollHeight,U=window.getComputedStyle(l),H=parseInt(U.borderTopWidth,10),G=parseInt(U.paddingTop,10),ie=parseInt(U.borderBottomWidth,10),oe=parseInt(U.paddingBottom,10),z=H+G+B+oe+ie,Q=Math.min(g.offsetHeight*5,z),re=window.getComputedStyle(h),Z=parseInt(re.paddingTop,10),$=parseInt(re.paddingBottom,10),q=E.top+E.height/2-Gx,Y=F-q,j=g.offsetHeight/2,A=g.offsetTop+j,W=H+G+A,V=z-W;if(W<=q){let be=D.length>0&&g===D[D.length-1].ref.current;s.style.bottom="0px";let Ee=l.clientHeight-h.offsetTop-h.offsetHeight,Ae=Math.max(Y,j+(be?$:0)+Ee+ie),ht=W+Ae;s.style.height=ht+"px"}else{let be=D.length>0&&g===D[0].ref.current;s.style.top="0px";let Ae=Math.max(q,H+h.offsetTop+(be?Z:0)+j)+V;s.style.height=Ae+"px",h.scrollTop=W-q+h.offsetTop}s.style.margin=`${Gx}px 0`,s.style.minHeight=Q+"px",s.style.maxHeight=F+"px",n?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,s,l,h,g,y,i.dir,n]);gl(()=>_(),[_]);let[w,x]=Ht.useState();gl(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]);let O=Ht.useCallback(E=>{E&&m.current===!0&&(_(),b?.(),m.current=!1)},[_,b]);return(0,pn.jsx)(Gdi,{scope:r,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:O,children:(0,pn.jsx)("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:(0,pn.jsx)(ou.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});TQr.displayName=Kdi;var Wdi="SelectPopperPosition",P_t=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,align:n="start",collisionPadding:o=Gx,...i}=t,a=NLe(r);return(0,pn.jsx)(tQr,{...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)"}})});P_t.displayName=Wdi;var[Gdi,j_t]=PX(_3,{}),M_t="SelectViewport",EQr=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,nonce:n,...o}=t,i=EU(M_t,r),a=j_t(M_t,r),s=Fc(e,i.onViewportChange),u=Ht.useRef(0);return(0,pn.jsxs)(pn.Fragment,{children:[(0,pn.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,pn.jsx)(ALe.Slot,{scope:r,children:(0,pn.jsx)(ou.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:qc(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-Gx*2,h=parseFloat(d.style.minHeight),g=parseFloat(d.style.height),y=Math.max(h,g);if(y<m){let b=y+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})})})]})});EQr.displayName=M_t;var PQr="SelectGroup",[Zdi,Xdi]=PX(PQr),Ydi=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=JI();return(0,pn.jsx)(Zdi,{scope:r,id:o,children:(0,pn.jsx)(ou.div,{role:"group","aria-labelledby":o,...n,ref:e})})});Ydi.displayName=PQr;var MQr="SelectLabel",RQr=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=Xdi(MQr,r);return(0,pn.jsx)(ou.div,{id:o.id,...n,ref:e})});RQr.displayName=MQr;var RLe="SelectItem",[Qdi,AQr]=PX(RLe),IQr=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,value:n,disabled:o=!1,textValue:i,...a}=t,s=TU(RLe,r),u=EU(RLe,r),l=s.value===n,[c,d]=Ht.useState(i??""),[f,p]=Ht.useState(!1),m=Fc(e,b=>u.itemRefCallback?.(b,n,o)),h=JI(),g=Ht.useRef("touch"),y=()=>{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,pn.jsx)(Qdi,{scope:r,value:n,disabled:o,textId:h,isSelected:l,onItemTextChange:Ht.useCallback(b=>{d(_=>_||(b?.textContent??"").trim())},[]),children:(0,pn.jsx)(ALe.ItemSlot,{scope:r,value:n,disabled:o,textValue:c,children:(0,pn.jsx)(ou.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:qc(a.onFocus,()=>p(!0)),onBlur:qc(a.onBlur,()=>p(!1)),onClick:qc(a.onClick,()=>{g.current!=="mouse"&&y()}),onPointerUp:qc(a.onPointerUp,()=>{g.current==="mouse"&&y()}),onPointerDown:qc(a.onPointerDown,b=>{g.current=b.pointerType}),onPointerMove:qc(a.onPointerMove,b=>{g.current=b.pointerType,o?u.onItemLeave?.():g.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:qc(a.onPointerLeave,b=>{b.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:qc(a.onKeyDown,b=>{u.searchRef?.current!==""&&b.key===" "||(kdi.includes(b.key)&&y(),b.key===" "&&b.preventDefault())})})})})});IQr.displayName=RLe;var $de="SelectItemText",NQr=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,className:n,style:o,...i}=t,a=TU($de,r),s=EU($de,r),u=AQr($de,r),l=zdi($de,r),[c,d]=Ht.useState(null),f=Fc(e,y=>d(y),u.onItemTextChange,y=>s.itemTextRefCallback?.(y,u.value,u.disabled)),p=c?.textContent,m=Ht.useMemo(()=>(0,pn.jsx)("option",{value:u.value,disabled:u.disabled,children:p},u.value),[u.disabled,u.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return gl(()=>(h(m),()=>g(m)),[h,g,m]),(0,pn.jsxs)(pn.Fragment,{children:[(0,pn.jsx)(ou.span,{id:u.textId,...i,ref:f}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren?N_t.createPortal(i.children,a.valueNode):null]})});NQr.displayName=$de;var jQr="SelectItemIndicator",DQr=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return AQr(jQr,r).isSelected?(0,pn.jsx)(ou.span,{"aria-hidden":!0,...n,ref:e}):null});DQr.displayName=jQr;var R_t="SelectScrollUpButton",$Qr=Ht.forwardRef((t,e)=>{let r=EU(R_t,t.__scopeSelect),n=j_t(R_t,t.__scopeSelect),[o,i]=Ht.useState(!1),a=Fc(e,n.onScrollButtonChange);return gl(()=>{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,pn.jsx)(FQr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop-u.offsetHeight)}}):null});$Qr.displayName=R_t;var A_t="SelectScrollDownButton",LQr=Ht.forwardRef((t,e)=>{let r=EU(A_t,t.__scopeSelect),n=j_t(A_t,t.__scopeSelect),[o,i]=Ht.useState(!1),a=Fc(e,n.onScrollButtonChange);return gl(()=>{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,pn.jsx)(FQr,{...t,ref:a,onAutoScroll:()=>{let{viewport:s,selectedItem:u}=r;s&&u&&(s.scrollTop=s.scrollTop+u.offsetHeight)}}):null});LQr.displayName=A_t;var FQr=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,onAutoScroll:n,...o}=t,i=EU("SelectScrollButton",r),a=Ht.useRef(null),s=ILe(r),u=Ht.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return Ht.useEffect(()=>()=>u(),[u]),gl(()=>{s().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[s]),(0,pn.jsx)(ou.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:qc(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:qc(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:qc(o.onPointerLeave,()=>{u()})})}),efi="SelectSeparator",kQr=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t;return(0,pn.jsx)(ou.div,{"aria-hidden":!0,...n,ref:e})});kQr.displayName=efi;var I_t="SelectArrow",tfi=Ht.forwardRef((t,e)=>{let{__scopeSelect:r,...n}=t,o=NLe(r),i=TU(I_t,r),a=EU(I_t,r);return i.open&&a.position==="popper"?(0,pn.jsx)(rQr,{...o,...n,ref:e}):null});tfi.displayName=I_t;function qQr(t){return t===""||t===void 0}var BQr=Ht.forwardRef((t,e)=>{let{value:r,...n}=t,o=Ht.useRef(null),i=Fc(e,o),a=cje(r);return Ht.useEffect(()=>{let s=o.current,u=window.HTMLSelectElement.prototype,c=Object.getOwnPropertyDescriptor(u,"value").set;if(a!==r&&c){let d=new Event("change",{bubbles:!0});c.call(s,r),s.dispatchEvent(d)}},[a,r]),(0,pn.jsx)(x_t,{asChild:!0,children:(0,pn.jsx)("select",{...n,ref:i,defaultValue:r})})});BQr.displayName="BubbleSelect";function UQr(t){let e=ad(t),r=Ht.useRef(""),n=Ht.useRef(0),o=Ht.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=Ht.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return Ht.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,o,i]}function zQr(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=rfi(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 rfi(t,e){return t.map((r,n)=>t[(e+n)%t.length])}var HQr=gQr,D_t=bQr,VQr=vQr,JQr=wQr,KQr=SQr,$_t=CQr,WQr=EQr;var L_t=RQr,F_t=IQr,GQr=NQr,ZQr=DQr,k_t=$Qr,q_t=LQr,B_t=kQr;On();jn();var PU=HQr;var MU=VQr,A$=vu.forwardRef(({className:t,children:e,...r},n)=>vu.createElement(D_t,{ref:n,className:Oe("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,vu.createElement(JQr,{asChild:!0},vu.createElement(Qs,{className:"tw-size-4"}))));A$.displayName=D_t.displayName;var XQr=vu.forwardRef(({className:t,...e},r)=>vu.createElement(k_t,{ref:r,className:Oe("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},vu.createElement(sC,{className:"tw-size-4"})));XQr.displayName=k_t.displayName;var YQr=vu.forwardRef(({className:t,...e},r)=>vu.createElement(q_t,{ref:r,className:Oe("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",t),...e},vu.createElement(Qs,{className:"tw-size-4"})));YQr.displayName=q_t.displayName;var I$=vu.forwardRef(({className:t,children:e,position:r="popper",container:n,...o},i)=>vu.createElement(KQr,{container:n},vu.createElement($_t,{ref:i,className:Oe("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},vu.createElement(XQr,null),vu.createElement(WQr,{className:Oe("tw-p-1",r==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]")},e),vu.createElement(YQr,null))));I$.displayName=$_t.displayName;var ofi=vu.forwardRef(({className:t,...e},r)=>vu.createElement(L_t,{ref:r,className:Oe("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t),...e}));ofi.displayName=L_t.displayName;var N$=vu.forwardRef(({className:t,children:e,...r},n)=>vu.createElement(F_t,{ref:n,className:Oe("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},vu.createElement("span",{className:"tw-absolute tw-right-2 tw-flex tw-size-3.5 tw-items-center tw-justify-center"},vu.createElement(ZQr,null,vu.createElement(Uu,{className:"tw-size-4"}))),vu.createElement(GQr,null,e)));N$.displayName=F_t.displayName;var ifi=vu.forwardRef(({className:t,...e},r)=>vu.createElement(B_t,{ref:r,className:Oe("-tw-mx-1 tw-my-1 tw-h-px tw-bg-primary-alt",t),...e}));ifi.displayName=B_t.displayName;On();function RU(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,iu.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 iu.default.createElement("div",{className:"tw-space-y-3"},iu.default.createElement(tv,{delayDuration:0},iu.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},iu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},iu.default.createElement("span",{className:`tw-font-medium ${s?"tw-text-normal":"tw-text-muted"}`},e),r&&iu.default.createElement(Ci,{buttonClassName:"tw-size-4 tw-text-muted",content:iu.default.createElement("div",{className:"tw-max-w-[300px]"},r)})),iu.default.createElement("div",{className:`tw-flex tw-items-center ${o?"tw-gap-3":"tw-gap-0"}`},iu.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&&iu.default.createElement(Kn,null,iu.default.createElement(Wn,{asChild:!0},iu.default.createElement(ve,{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?iu.default.createElement(jte,{className:"tw-size-4"}):iu.default.createElement(Nte,{className:"tw-size-4"}))),iu.default.createElement(Mn,{side:"bottom"},iu.default.createElement("span",null,s?"Disable parameters":"Enable parameters")))))),iu.default.createElement("div",{className:"tw-relative"},i==="slider"?iu.default.createElement(iu.default.Fragment,null,iu.default.createElement(Ide,{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&&iu.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-cursor-not-allowed tw-rounded"})):iu.default.createElement(PU,{value:s?t.value??t.defaultValue??t.options[0]?.value:void 0,onValueChange:d,disabled:!s},iu.default.createElement(A$,{className:`tw-w-full ${s?"":"tw-opacity-40"}`},iu.default.createElement(MU,{placeholder:"Select an option"})),iu.default.createElement(I$,null,t.options.map(f=>iu.default.createElement(N$,{key:f.value,value:f.value},f.label))))))}var afi=({model:t,onUpdate:e,isEmbeddingModel:r,onCancel:n})=>{let[o,i]=(0,Ke.useState)(t),[a,s]=(0,Ke.useState)(t),[u,l]=(0,Ke.useState)({}),c=ce(),d=o.provider==="amazon-bedrock",f=w=>c[AN[w]]||"";(0,Ke.useEffect)(()=>{i(t),s(t),t.provider&&l(RN(t.provider))},[t]);let p=(0,Ke.useMemo)(()=>Uhe((w,x)=>{e(r,w,x)},500),[r,e]),m=(0,Ke.useCallback)((w,x)=>{i(O=>{let E={...O,[w]:x};return p(a,E),E})},[a,p]),h=(0,Ke.useCallback)(w=>{i(x=>{let O={...x};return delete O[w],p(a,O),O})},[p,a]);if(!o)return null;let g=()=>{if(!o||!o.provider||o.provider!=="azure-openai")return u.host||"https://api.example.com/v1";let w=o.azureOpenAIApiInstanceName||"[instance]",x=o.isEmbeddingModel?o.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":o.azureOpenAIApiDeploymentName||"[deployment]",O=o.azureOpenAIApiVersion||"[api-version]",E=o.isEmbeddingModel?"embeddings":"chat/completions";return`https://${w}.openai.azure.com/openai/deployments/${x}/${E}?api-version=${O}`},y=Object.entries(SL).map(([w,x])=>({id:w,label:w.charAt(0).toUpperCase()+w.slice(1),description:x})),b=o.apiKey||f(o.provider),_=!r&&o.provider!=="copilot-plus-jina";return Ke.default.createElement("div",{className:"tw-space-y-3 tw-p-4"},Ke.default.createElement("div",{className:"tw-space-y-3"},Ke.default.createElement(ai,{label:"Model Name",required:!0},Ke.default.createElement(yi,{type:"text",disabled:o.core,value:o.name,onChange:w=>m("name",w.target.value),placeholder:"Enter model name"})),Ke.default.createElement(ai,{label:Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ke.default.createElement("span",{className:"tw-leading-none"},"Display Name"),Ke.default.createElement(Ci,{content:Ke.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},Ke.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),Ke.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),Ke.default.createElement("div",{className:"tw-text-[12px]"},"Example:",Ke.default.createElement("li",null,"Direct-Paid:Ds-r1"),Ke.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),Ke.default.createElement("li",null,"Perplexity-Paid:lg"))),contentClassName:"tw-max-w-96"}))},Ke.default.createElement(yi,{type:"text",placeholder:"Custom display name (optional)",value:o.displayName||"",onChange:w=>m("displayName",w.target.value)})),Ke.default.createElement(ai,{label:"Provider"},Ke.default.createElement(yi,{type:"text",value:ib(o.provider),disabled:!0})),Ke.default.createElement(ai,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},Ke.default.createElement(yi,{type:"text",placeholder:g(),value:o.baseUrl||"",onChange:w=>m("baseUrl",w.target.value)})),d&&Ke.default.createElement(ai,{label:"Region (optional)",description:"Defaults to us-east-1 when left blank unless this model defines a custom base URL."},Ke.default.createElement(yi,{type:"text",placeholder:"Enter AWS region (e.g. us-east-1)",value:o.bedrockRegion||"",onChange:w=>m("bedrockRegion",w.target.value)})),Ke.default.createElement(ai,{label:"API Key"},Ke.default.createElement(HI,{placeholder:`Enter ${u.label||"Provider"} API Key`,value:b,onChange:w=>m("apiKey",w)}),u.keyManagementURL&&Ke.default.createElement("p",{className:"tw-text-xs tw-text-muted"},Ke.default.createElement("a",{href:u.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",u.label," API Key"))),_&&Ke.default.createElement(Ke.default.Fragment,null,Ke.default.createElement(ai,{label:Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Ke.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),Ke.default.createElement(Ci,{content:Ke.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"}))},Ke.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},y.map(({id:w,label:x,description:O})=>Ke.default.createElement("div",{key:w,className:"tw-flex tw-items-center tw-gap-2"},Ke.default.createElement(sd,{id:w,checked:o.capabilities?.includes(w),onCheckedChange:E=>{let T=o.capabilities||[],R=E?[...T,w]:T.filter(N=>N!==w);m("capabilities",R)}}),Ke.default.createElement(Ci,{content:O},Ke.default.createElement(Ib,{htmlFor:w,className:"tw-text-sm"},x)))))),Ke.default.createElement(ai,null,Ke.default.createElement(RU,{type:"slider",optional:!1,label:"Token limit",value:o.maxTokens??c.maxTokens,onChange:w=>m("maxTokens",w),max:65e3,min:100,step:100,defaultValue:ny.MAX_TOKENS,helpText:Ke.default.createElement(Ke.default.Fragment,null,Ke.default.createElement("p",null,"The maximum number of ",Ke.default.createElement("em",null,"output tokens")," to generate. Default is"," ",ny.MAX_TOKENS,"."),Ke.default.createElement("em",null,"This number plus the length of your prompt (input tokens) must be smaller than the context window of the model."))})),Ke.default.createElement(ai,null,Ke.default.createElement(RU,{type:"slider",optional:!1,label:"Temperature",value:o.temperature??c.temperature,onChange:w=>m("temperature",w),max:2,min:0,step:.05,defaultValue:ny.TEMPERATURE,helpText:`Default is ${ny.TEMPERATURE}. Higher values will result in more creativeness, but also more mistakes. Set to 0 for no randomness.`})),Ke.default.createElement(ai,null,Ke.default.createElement(RU,{type:"slider",label:"Top-P",value:o.topP,onChange:w=>m("topP",w),disableFn:()=>h("topP"),max:1,min:0,step:.05,defaultValue:.9,helpText:"Default value is 0.9, 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"})),Ke.default.createElement(ai,null,Ke.default.createElement(RU,{type:"slider",label:"Frequency Penalty",value:o.frequencyPenalty,onChange:w=>m("frequencyPenalty",w),disableFn:()=>h("frequencyPenalty"),max:2,min:0,step:.05,defaultValue:0,helpText:Ke.default.createElement(Ke.default.Fragment,null,Ke.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."),Ke.default.createElement("em",null,"The higher the value, the more the model is penalized for repeating words."))})),o.provider==="openai"&&(o.name.startsWith("gpt-5")||o.name.startsWith("o1")||o.name.startsWith("o3")||o.name.startsWith("o4"))&&Ke.default.createElement(Ke.default.Fragment,null,Ke.default.createElement(ai,null,Ke.default.createElement(RU,{type:"select",label:"Reasoning Effort",value:o.reasoningEffort,onChange:w=>m("reasoningEffort",w),disableFn:()=>h("reasoningEffort"),defaultValue:c.reasoningEffort??ny.REASONING_EFFORT,options:[...o.name.startsWith("gpt-5")?[{value:"minimal",label:"Minimal"}]:[],{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],helpText:Ke.default.createElement(Ke.default.Fragment,null,Ke.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!"),Ke.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Ke.default.createElement("li",null,"Minimal: Fastest responses, minimal reasoning (GPT-5 only)"),Ke.default.createElement("li",null,"Low: Faster responses, basic reasoning (default)"),Ke.default.createElement("li",null,"Medium: Balanced performance"),Ke.default.createElement("li",null,"High: Thorough reasoning, slower responses")))})),o.name.startsWith("gpt-5")&&Ke.default.createElement(ai,null,Ke.default.createElement(RU,{type:"select",label:"Verbosity",value:o.verbosity,onChange:w=>m("verbosity",w),disableFn:()=>h("verbosity"),defaultValue:c.verbosity??ny.VERBOSITY,options:[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],helpText:Ke.default.createElement(Ke.default.Fragment,null,Ke.default.createElement("p",null,"Controls the length and detail of the model responses."),Ke.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Ke.default.createElement("li",null,"Low: Concise, brief responses"),Ke.default.createElement("li",null,"Medium: Balanced detail"),Ke.default.createElement("li",null,"High: Detailed, comprehensive responses")))}))),o.provider==="openrouterai"&&Ke.default.createElement(ai,null,Ke.default.createElement(RU,{type:"select",label:"Reasoning Effort",value:o.reasoningEffort,onChange:w=>m("reasoningEffort",w),disableFn:()=>h("reasoningEffort"),defaultValue:"low",options:[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],helpText:Ke.default.createElement(Ke.default.Fragment,null,Ke.default.createElement("p",null,"Controls the amount of reasoning effort the model uses. Higher effort provides more thorough reasoning but takes longer."),Ke.default.createElement("ul",{className:"tw-mt-2 tw-space-y-1 tw-text-xs"},Ke.default.createElement("li",null,"Low: Faster responses, basic reasoning (default)"),Ke.default.createElement("li",null,"Medium: Balanced performance"),Ke.default.createElement("li",null,"High: Thorough reasoning, slower responses")),!o.capabilities?.includes("reasoning")&&Ke.default.createElement("p",{className:"tw-mt-2 tw-text-warning"},'Enable the "Reasoning" capability above to use this feature.'))})))),Ke.default.createElement("div",{className:"tw-mt-6 tw-flex tw-justify-end tw-gap-2 tw-border-t tw-border-border tw-pt-4"},Ke.default.createElement(ve,{variant:"secondary",onClick:n},"Close")))},MX=class extends jLe.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;jLe.Platform.isMobile&&(n.style.height="80%"),this.root=(0,QQr.createRoot)(r);let o=(a,s,u)=>{this.onUpdate(a,s,u)},i=()=>{this.close()};this.root.render(Ke.default.createElement(afi,{model:this.model,isEmbeddingModel:this.isEmbeddingModel,onUpdate:o,onCancel:i}))}onClose(){this.root.unmount()}};On();var een=require("obsidian"),j$=L(X()),ten=({message:t,app:e})=>{let r=()=>{let n=ce(),o=eK(),i=n.activeModels.find(u=>Qn(u)===o);if(!i){new een.Notice("Could not find the current model settings");return}let a=(u,l,c)=>{let d=n.activeModels.map(f=>f===l?c:f);et("activeModels",d)};new MX(e,i,!1,a).open()};return j$.default.createElement("div",{className:"tw-mt-3 tw-rounded-md tw-border tw-border-border tw-bg-callout-warning/20 tw-p-4"},j$.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-3"},j$.default.createElement(rg,{className:"tw-size-5 tw-shrink-0 tw-text-warning"}),j$.default.createElement("div",{className:"tw-flex-1"},j$.default.createElement("div",{className:"tw-mb-2 tw-font-semibold tw-text-warning"},"Response Truncated"),j$.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&&j$.default.createElement("div",{className:"tw-mb-3 tw-text-sm tw-text-muted"},"Output tokens used: ",t.responseMetadata.tokenUsage.outputTokens||"N/A"),j$.default.createElement(ve,{variant:"secondary",size:"sm",onClick:r,className:"tw-text-warning hover:tw-bg-callout-warning/10"},"Open Model Settings"))))};var X_t=L(X()),Y_t=L(wm());var DLe=L(X()),ren=({errorContent:t})=>DLe.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"},DLe.default.createElement("div",{className:"tw-mb-2 tw-text-sm tw-font-semibold tw-text-error"},"\u26A0\uFE0F Error occurred"),DLe.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-xs tw-text-error"},t.trim()));var kg=L(X(),1);function nen(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var ien=L(X(),1);function oen(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function U_t(...t){return e=>{let r=!1,n=t.map(o=>{let i=oen(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():oen(t[o],null)}}}}function aen(...t){return ien.useCallback(U_t(...t),t)}var sen=L(X(),1),dfi=L(Bu(),1);var Fg=L(X(),1);var RX=L(mt(),1),H_t=Fg.forwardRef((t,e)=>{let{children:r,...n}=t,o=Fg.Children.toArray(r),i=o.find(ufi);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,RX.jsx)(z_t,{...n,ref:e,children:Fg.isValidElement(a)?Fg.cloneElement(a,void 0,s):null})}return(0,RX.jsx)(z_t,{...n,ref:e,children:r})});H_t.displayName="Slot";var z_t=Fg.forwardRef((t,e)=>{let{children:r,...n}=t;if(Fg.isValidElement(r)){let o=cfi(r);return Fg.cloneElement(r,{...lfi(n,r.props),ref:e?U_t(e,o):o})}return Fg.Children.count(r)>1?Fg.Children.only(null):null});z_t.displayName="SlotClone";var sfi=({children:t})=>(0,RX.jsx)(RX.Fragment,{children:t});function ufi(t){return Fg.isValidElement(t)&&t.type===sfi}function lfi(t,e){let r={...e};for(let n in e){let o=t[n],i=e[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...s)=>{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 cfi(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var uen=L(mt(),1),ffi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],$Le=ffi.reduce((t,e)=>{let r=sen.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?H_t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,uen.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});var v3=L(mt(),1),V_t="Collapsible",[pfi,mDs]=TB(V_t),[mfi,J_t]=pfi(V_t),len=kg.forwardRef((t,e)=>{let{__scopeCollapsible:r,open:n,defaultOpen:o,disabled:i,onOpenChange:a,...s}=t,[u=!1,l]=GD({prop:n,defaultProp:o,onChange:a});return(0,v3.jsx)(mfi,{scope:r,disabled:i,contentId:JI(),open:u,onOpenToggle:kg.useCallback(()=>l(c=>!c),[l]),children:(0,v3.jsx)($Le.div,{"data-state":Z_t(u),"data-disabled":i?"":void 0,...s,ref:e})})});len.displayName=V_t;var cen="CollapsibleTrigger",K_t=kg.forwardRef((t,e)=>{let{__scopeCollapsible:r,...n}=t,o=J_t(cen,r);return(0,v3.jsx)($Le.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Z_t(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...n,ref:e,onClick:nen(t.onClick,o.onOpenToggle)})});K_t.displayName=cen;var W_t="CollapsibleContent",G_t=kg.forwardRef((t,e)=>{let{forceMount:r,...n}=t,o=J_t(W_t,t.__scopeCollapsible);return(0,v3.jsx)(ZD,{present:r||o.open,children:({present:i})=>(0,v3.jsx)(hfi,{...n,ref:e,present:i})})});G_t.displayName=W_t;var hfi=kg.forwardRef((t,e)=>{let{__scopeCollapsible:r,present:n,children:o,...i}=t,a=J_t(W_t,r),[s,u]=kg.useState(n),l=kg.useRef(null),c=aen(e,l),d=kg.useRef(0),f=d.current,p=kg.useRef(0),m=p.current,h=a.open||s,g=kg.useRef(h),y=kg.useRef(void 0);return kg.useEffect(()=>{let b=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(b)},[]),gl(()=>{let b=l.current;if(b){y.current=y.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,g.current||(b.style.transitionDuration=y.current.transitionDuration,b.style.animationName=y.current.animationName),u(n)}},[a.open,n]),(0,v3.jsx)($Le.div,{"data-state":Z_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 Z_t(t){return t?"open":"closed"}var den=len;var Zx=den,D$=K_t,Xx=G_t;jn();Eue();On();var Xu=L(X()),yfi="shimmer 2s ease-in-out infinite",Fde=5e3,bfi=(t,e)=>{if(!e)return null;if(e.length>Fde)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=px.format(t,e);return r.length>Fde?r.slice(0,Fde)+`
|
||
|
||
\u2026 (truncated ${(r.length-Fde).toLocaleString()} characters for display)`:r}catch{return e.length>Fde?`Tool '${t}' returned ${e.length.toLocaleString()} characters. The full output is preserved in chat history but omitted here to keep the UI responsive.`:e}},fen=({toolName:t,displayName:e,emoji:r,isExecuting:n,result:o,confirmationMessage:i,onAccept:a,onReject:s})=>{let[u,l]=(0,Xu.useState)(!1),c=(0,Xu.useMemo)(()=>bfi(t,o),[t,o]),d=!n&&c!==null;return Xu.default.createElement(Zx,{open:d?u:!1,onOpenChange:l,disabled:!d,"aria-disabled":!d,className:"tw-my-3 tw-w-full sm:tw-max-w-sm"},Xu.default.createElement("div",{className:Oe("tw-rounded-md tw-border tw-border-border tw-bg-secondary/50",n&&"tw-relative tw-overflow-hidden")},n&&Xu.default.createElement("div",{className:"tw-absolute tw-inset-0 tw-z-[1] tw-overflow-hidden"},Xu.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:yfi}})),Xu.default.createElement(D$,{className:Oe("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",d&&"hover:tw-bg-secondary/70",!d&&"tw-cursor-default")},Xu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Xu.default.createElement("span",{className:"tw-text-base"},r),Xu.default.createElement("span",{className:"tw-font-medium"},t==="readNote"?`${n?"Reading":"Read"} ${e}`:`${n?"Calling":"Called"} ${e}`,n&&t!=="readNote"&&"..."),n&&i&&Xu.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"\u2022 ",i,"...")),Xu.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},!n&&a&&s&&Xu.default.createElement(Xu.default.Fragment,null,Xu.default.createElement("button",{onClick:f=>{f.stopPropagation(),a()},className:"hover:tw-bg-green-rgb/20 tw-rounded tw-p-1",title:"Accept"},Xu.default.createElement(Uu,{className:"tw-size-4 tw-text-success"})),Xu.default.createElement("button",{onClick:f=>{f.stopPropagation(),s()},className:"hover:tw-bg-red-rgb/20 tw-rounded tw-p-1",title:"Reject"},Xu.default.createElement(pi,{className:"tw-size-4 tw-text-error"}))),d&&Xu.default.createElement(tg,{className:Oe("tw-size-4 tw-text-muted tw-transition-transform",u&&"tw-rotate-90")}))),Xu.default.createElement(Xx,null,Xu.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"},Xu.default.createElement("div",{className:"tw-text-sm tw-text-muted"},Xu.default.createElement("pre",{className:"tw-overflow-x-auto tw-whitespace-pre-wrap tw-font-mono tw-text-xs"},c??"No result available"))))))};Dt();var pen=60*60*1e3,kde=()=>(window.__copilotToolCallRoots||(window.__copilotToolCallRoots=new Map),window.__copilotToolCallRoots),qde=()=>(window.__copilotErrorBlocks||(window.__copilotErrorBlocks=new Map),window.__copilotErrorBlocks),men=(t,e,r)=>{if(e.size>0)return;r.get(t)===e&&r.delete(t)},Q_t=(t,e,r,n,o,i)=>{try{n.root.unmount()}catch(a){Ot(`Error unmounting tool call root during ${o}`,r,a)}n.isUnmounting=!1,e.get(r)===n&&e.delete(r),men(t,e,i)},AX=(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,men(t,e,i);return}Q_t(t,a,r,s,o,i)},0))},hen=(t,e,r,n,o)=>{let i=e.get(r);return i?.isUnmounting&&(Q_t(t,e,r,i,`${o} (finalizing stale root)`,kde()),i=void 0),i||(i={root:(0,Y_t.createRoot)(n),isUnmounting:!1},e.set(r,i)),i},gen=(t,e,r,n,o)=>{let i=e.get(r);return i?.isUnmounting&&(Q_t(t,e,r,i,`${o} (finalizing stale error root)`,qde()),i=void 0),i||(i={root:(0,Y_t.createRoot)(n),isUnmounting:!1},e.set(r,i)),i},yen=(t,e)=>{t.root.render(X_t.default.createElement(fen,{toolName:e.toolName,displayName:e.displayName,emoji:e.emoji,isExecuting:e.isExecuting,result:e.result||null,confirmationMessage:e.confirmationMessage}))},ben=(t,e)=>{t.root.render(X_t.default.createElement(ren,{errorContent:e.errorContent}))},_en=(t,e,r,n)=>{let o=e.get(r);o&&AX(t,e,r,o,n,kde())},ven=(t,e,r,n)=>{let o=e.get(r);o&&AX(t,e,r,o,n,qde())},wen=t=>{let e=kde(),r=e.get(t);return r||(r=new Map,e.set(t,r)),r},Sen=t=>{let e=qde(),r=e.get(t);return r||(r=new Map,e.set(t,r)),r},Cen=(t=Date.now())=>{let e=kde();e.forEach((r,n)=>{let o=Number.parseInt(n,10);Number.isNaN(o)||t-o<pen||r.forEach((i,a)=>{AX(n,r,a,i,"stale message cleanup",e)})})},xen=(t=Date.now())=>{let e=qde();e.forEach((r,n)=>{let o=Number.parseInt(n,10);Number.isNaN(o)||t-o<pen||r.forEach((i,a)=>{AX(n,r,a,i,"stale error block cleanup",e)})})},Oen=(t,e,r)=>{let n=kde();e.forEach((o,i)=>{AX(t,e,i,o,r,n)})},Ten=(t,e,r)=>{let n=qde();e.forEach((o,i)=>{AX(t,e,i,o,r,n)})};zr();jn();bie();bue();Pt();wr();var w3=require("obsidian"),Yr=L(X()),_fi=/^\d+-\d+$/,vfi=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||!_fi.test(n))return;let[o]=n.split("-");o&&o!==n&&(r.textContent=o)})};function wfi({context:t}){return!t||!t.notes?.length&&!t.urls?.length&&!t.tags?.length&&!t.folders?.length?null:Yr.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-gap-2"},t.notes.map((e,r)=>Yr.default.createElement(Kn,{key:`note-${r}-${e.path}`},Yr.default.createElement(Wn,{asChild:!0},Yr.default.createElement("div",null,Yr.default.createElement(D$e,{note:e}))),Yr.default.createElement(Mn,{className:"tw-max-w-sm tw-break-words"},e.path))),t.urls.map((e,r)=>Yr.default.createElement(Kn,{key:`url-${r}-${e}`},Yr.default.createElement(Wn,{asChild:!0},Yr.default.createElement("div",null,Yr.default.createElement($$e,{url:e}))),Yr.default.createElement(Mn,{className:"tw-max-w-sm tw-break-words"},e))),t.tags?.map((e,r)=>Yr.default.createElement(Kn,{key:`tag-${r}-${e}`},Yr.default.createElement(Wn,{asChild:!0},Yr.default.createElement("div",null,Yr.default.createElement(i7r,{tag:e}))),Yr.default.createElement(Mn,{className:"tw-max-w-sm tw-break-words"},e))),t.folders?.map((e,r)=>Yr.default.createElement(Kn,{key:`folder-${r}-${e}`},Yr.default.createElement(Wn,{asChild:!0},Yr.default.createElement("div",null,Yr.default.createElement(L$e,{folder:e}))),Yr.default.createElement(Mn,{className:"tw-max-w-sm tw-break-words"},e))))}var Sfi=({message:t,app:e,isStreaming:r,onRegenerate:n,onEdit:o,onDelete:i})=>{let a=So(),[s,u]=(0,Yr.useState)(!1),[l,c]=(0,Yr.useState)(!1),d=(0,Yr.useRef)(null),f=(0,Yr.useRef)(null),p=(0,Yr.useRef)(!1),m=(0,Yr.useRef)(t.id||(t.timestamp?.epoch?String(t.timestamp.epoch):`temp-${Date.now()}-${Math.random()}`)),h=(0,Yr.useRef)(wen(m.current)),g=(0,Yr.useRef)(Sen(m.current)),y=()=>{if(!navigator.clipboard||!navigator.clipboard.writeText)return;let R=Bhe(t.message);navigator.clipboard.writeText(R).then(()=>{u(!0),setTimeout(()=>{u(!1)},2e3)})},b=(0,Yr.useCallback)(R=>{let N=e.workspace.getActiveFile(),D=N?N.path:"",F=q=>(q=q.replace(/```dataview(\s*(?:\n|$))/g,"```text$1"),q=q.replace(/```dataviewjs(\s*(?:\n|$))/g,"```javascript$1"),q),B=(q,Y,j,A)=>{let W="margin: 0.5rem 0 1.5rem; padding: 0.75rem; border: 1px solid var(--background-modifier-border); border-radius: 4px; background-color: var(--background-secondary)",V="cursor: pointer; color: var(--text-muted); font-size: 0.8em; margin-bottom: 0.5rem; user-select: none",se="margin-top: 0.75rem; padding: 0.75rem; border-radius: 4px; background-color: var(--background-primary)",be=`<${Y}>`;if(r&&q.includes(be)){let Ae=new RegExp(`<${Y}>([\\s\\S]*?)<\\/${Y}>`,"g");q=q.replace(Ae,(Rt,Ze)=>`<details style="${W}">
|
||
<summary style="${V}">${j}</summary>
|
||
<div class="tw-text-muted" style="${se}">${Ze.trim()}</div>
|
||
</details>
|
||
|
||
`);let ht=new RegExp(`<${Y}>([\\s\\S]*)$`);return q=q.replace(ht,(Rt,Ze)=>`<div style="${W}">
|
||
<div style="${V}">${A}</div>
|
||
<div class="tw-text-muted" style="${se}">${Ze.trim()}</div>
|
||
</div>`),q}let Ee=new RegExp(`<${Y}>([\\s\\S]*?)<\\/${Y}>`,"g");return q.replace(Ee,(Ae,ht)=>`<details style="${W}">
|
||
<summary style="${V}">${j}</summary>
|
||
<div class="tw-text-muted" style="${se}">${ht.trim()}</div>
|
||
</details>
|
||
|
||
`)},U=q=>B(q,"think","Thought for a while","Thinking..."),H=q=>{let Y=W=>{let V=/```(?:xml)?\s*([\s\S]*?<writeToFile>[\s\S]*?<\/writeToFile>[\s\S]*?)\s*```/g;return W.replace(V,(se,be)=>be.trim())},j=W=>{if(!r)return W;let V=/```xml\s*([\s\S]*?<writeToFile>[\s\S]*?)$/g;return W.replace(V,(se,be)=>be.trim())},A=Y(q);return A=j(A),B(A,"writeToFile","Generated new content","Generating changes...")},G=(q,Y,j)=>q.split(/(```[\s\S]*?```|`[^`]*`)/g).map((W,V)=>V%2===0?W.replace(Y,(se,be)=>{let Ee=e.metadataCache.getFirstLinkpathDest(be,D);return Ee?j(Ee):se}):W).join(""),oe=F(R).replace(/\\\[\s*/g,"$$").replace(/\s*\\\]/g,"$$").replace(/\\\(\s*/g,"$").replace(/\s*\\\)/g,"$"),z=G(oe,/!\[\[(.*?)]]/g,q=>`})`),Q=U(z),re=H(Q),Z=kqr(re,a.enableInlineCitations);return G(Z,/(?<!!)\[\[([^\]]+)]]/g,q=>`<a href="obsidian://open?file=${encodeURIComponent(q.path)}">${q.basename}</a>`)},[e,r,a.enableInlineCitations]);(0,Yr.useEffect)(()=>{if(p.current=!1,d.current&&t.sender!==Xs){f.current||(f.current=new w3.Component);let R=t.message,N=b(R),D=hot(N,m.current);if(!p.current){let F=new Set,B=new Set;d.current.querySelectorAll('[id^="tool-call-"]').forEach(Q=>{let re=Q.id.replace("tool-call-","");F.add(re)}),d.current.querySelectorAll('[id^="error-block-"]').forEach(Q=>{let re=Q.id.replace("error-block-","");B.add(re)}),d.current.querySelectorAll(".message-segment").forEach(Q=>Q.remove());let ie=0;D.segments.forEach(Q=>{if(Q.type==="text"&&Q.content.trim()){let re=d.current.children[ie],Z=document.createElement("div");Z.className="message-segment",re?d.current.insertBefore(Z,re):d.current.appendChild(Z),w3.MarkdownRenderer.renderMarkdown(Q.content,Z,"",f.current),vfi(Z),ie++}else if(Q.type==="toolCall"&&Q.toolCall){let re=Q.toolCall.id,Z=document.getElementById(`tool-call-${re}`);if(!Z){let q=d.current.children[ie],Y=document.createElement("div");Y.className="tool-call-container",Y.id=`tool-call-${re}`,q?d.current.insertBefore(Y,q):d.current.appendChild(Y),Z=Y}let $=hen(m.current,h.current,re,Z,"render refresh");!p.current&&!$.isUnmounting&¥($,Q.toolCall),ie++}else if(Q.type==="error"&&Q.error){let re=Q.error.id,Z=document.getElementById(`error-block-${re}`);if(!Z){let q=d.current.children[ie],Y=document.createElement("div");Y.className="error-block-container",Y.id=`error-block-${re}`,q?d.current.insertBefore(Y,q):d.current.appendChild(Y),Z=Y}let $=gen(m.current,g.current,re,Z,"error render");!p.current&&!$.isUnmounting&&ben($,Q.error),ie++}});let oe=new Set(D.segments.filter(Q=>Q.type==="toolCall"&&Q.toolCall).map(Q=>Q.toolCall.id));F.forEach(Q=>{if(!oe.has(Q)){let re=document.getElementById(`tool-call-${Q}`);re&&(_en(m.current,h.current,Q,"tool call removal"),re.remove())}});let z=new Set(D.segments.filter(Q=>Q.type==="error"&&Q.error).map(Q=>Q.error.id));B.forEach(Q=>{if(!z.has(Q)){let re=document.getElementById(`error-block-${Q}`);re&&(ven(m.current,g.current,Q,"error block removal"),re.remove())}})}}return()=>{p.current=!0}},[t,e,f,r,b]),(0,Yr.useEffect)(()=>{let R=f,N=m.current,D=h.current,F=g.current;return(()=>{Cen(),xen()})(),()=>{p.current=!0,setTimeout(()=>{R.current&&(R.current.unload(),R.current=null),N.startsWith("temp-")&&(Oen(N,D,"component cleanup"),Ten(N,F,"component cleanup"))},0)}},[]);let _=()=>{c(!0)},w=()=>{c(!1)},x=R=>{c(!1),o&&o(R)},O=()=>{t.sources&&t.sources.length>0&&new fLe(e,t.sources).open()},E=()=>{let R=e.workspace.getMostRecentLeaf();if((!R||!(R.view instanceof w3.MarkdownView))&&(R=e.workspace.getLeaf(!1),!R||!(R.view instanceof w3.MarkdownView)))return;let D=R.view.editor.getSelection().length>0,F=Bhe(t.message);$z(F,D)},T=()=>t.content?Yr.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3"},t.content.map((R,N)=>R.type==="text"?Yr.default.createElement("div",{key:N},t.sender===Xs?Yr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Yr.default.createElement("div",{ref:d,className:t.isErrorMessage?"tw-text-error":""})):R.type==="image_url"?Yr.default.createElement("div",{key:N,className:"message-image-content"},Yr.default.createElement("img",{src:R.image_url.url,alt:"User uploaded image",className:"chat-message-image"})):null)):t.sender===Xs?Yr.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-break-words tw-text-[calc(var(--font-text-size)_-_2px)] tw-font-normal"},t.message):Yr.default.createElement("div",{ref:d,className:t.isErrorMessage?"tw-text-error":""});return l&&t.sender===Xs?Yr.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},Yr.default.createElement(VXr,{initialValue:t.message,initialContext:t.context,onSave:x,onCancel:w,app:e})):Yr.default.createElement("div",{className:"tw-my-1 tw-flex tw-w-full tw-flex-col"},Yr.default.createElement("div",{className:Oe("tw-group tw-mx-2 tw-rounded-md tw-p-2",t.sender===Xs&&"tw-border tw-border-solid tw-border-border"),style:t.sender===Xs?{backgroundColor:"var(--background-modifier-hover)"}:void 0},Yr.default.createElement("div",{className:"tw-flex tw-max-w-full tw-flex-col tw-gap-2 tw-overflow-hidden"},!l&&Yr.default.createElement(wfi,{context:t.context}),Yr.default.createElement("div",{className:"message-content"},T()),t.responseMetadata?.wasTruncated&&t.sender!==Xs&&Yr.default.createElement(ten,{message:t,app:e}),!r&&Yr.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},Yr.default.createElement("div",{className:"tw-text-xs tw-text-faint"},t.timestamp?.display),Yr.default.createElement(zXr,{message:t,onCopy:y,isCopied:s,onInsertIntoEditor:E,onRegenerate:n,onEdit:_,onDelete:i,onShowSources:O,hasSources:!!(t.sources&&t.sources.length>0)})))))},evt=Sfi;Ro();zr();var tvt=L(X()),LLe=tvt.createContext(void 0),IX=tvt.createContext(void 0);var NX=L(X());function rvt(){let[t,e]=(0,NX.useState)(null),r=(0,NX.useContext)(IX);return(0,NX.useEffect)(()=>{let n=()=>{let o=app.workspace.getActiveFile();e(o)};return r?.addEventListener(Yw.ACTIVE_LEAF_CHANGE,n),()=>{r?.removeEventListener(Yw.ACTIVE_LEAF_CHANGE,n)}},[r]),t}jn();On();var Bde=require("obsidian"),It=L(X());function Cfi(t){let[e,r]=(0,It.useState)([]),n=rvt();return(0,It.useEffect)(()=>{async function o(){if(n?.path)try{let a=await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().getDb();if(!a){r([]);return}let s=await oje({db:a,filePath:n.path});r(s)}catch(i){console.warn("Failed to fetch relevant notes:",i),r([])}}o()},[n?.path,t]),e}function xfi(t,e){let[r,n]=(0,It.useState)(!0);return(0,It.useEffect)(()=>{if(!t)return;async function o(){try{let a=await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().hasIndex(t);n(a)}catch{n(!1)}}o()},[t,e]),r}function Ofi({score:t}){let e=nje(t),r="\u{1F534}";return e===2&&(r="\u{1F7E0}"),e===3&&(r="\u{1F7E2}"),It.default.createElement("span",{className:"tw-text-sm"},r)}function Tfi({note:t,onAddToChat:e,onNavigateToNote:r}){let[n,o]=(0,It.useState)(!1),[i,a]=(0,It.useState)(null),s=(0,It.useCallback)(async()=>{if(i)return;let u=app.vault.getAbstractFileByPath(t.document.path);if(u instanceof Bde.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,It.useEffect)(()=>{n&&s()},[n,s]),It.default.createElement(Zx,{open:n,onOpenChange:o,className:"tw-rounded-md tw-border tw-border-solid tw-border-border"},It.default.createElement("div",{className:Oe("tw-flex tw-items-center tw-justify-between tw-gap-2 tw-p-2")},It.default.createElement(ve,{variant:"ghost2",size:"icon",className:"tw-shrink-0",asChild:!0},It.default.createElement(D$,null,It.default.createElement(tg,{className:Oe("tw-size-4 tw-transition-transform tw-duration-200",{"rotate-90":n})}))),It.default.createElement("div",{className:"tw-flex tw-shrink-0 tw-items-center tw-gap-2"},It.default.createElement(Ofi,{score:t.metadata.similarityScore??0})),It.default.createElement("div",{className:"tw-flex-1 tw-overflow-hidden"},It.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)),It.default.createElement(Kn,null,It.default.createElement(Wn,{asChild:!0},It.default.createElement(ve,{variant:"ghost2",size:"icon",onClick:e,className:"tw-shrink-0"},It.default.createElement(jv,{className:"tw-size-4"}))),It.default.createElement(Mn,null,"Add to Chat"))),It.default.createElement(Xx,null,It.default.createElement("div",{className:"tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2"},It.default.createElement("div",{className:"tw-whitespace-pre-wrap tw-text-wrap tw-break-all tw-text-xs tw-text-muted tw-opacity-75"},t.document.path),i&&It.default.createElement("div",{className:"tw-overflow-hidden tw-whitespace-pre-wrap tw-border-t tw-border-border tw-pb-4 tw-pt-2 tw-text-xs tw-text-normal"},i)),It.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4 tw-border-[0px] tw-border-t tw-border-solid tw-border-border tw-px-4 tw-py-2 tw-text-xs tw-text-muted"},t.metadata.similarityScore!=null&&It.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},It.default.createElement("span",null,"Similarity: ",(t.metadata.similarityScore*100).toFixed(1),"%")),t.metadata.hasOutgoingLinks&&It.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},It.default.createElement(wte,{className:"tw-size-4"}),It.default.createElement("span",null,"Outgoing links")),t.metadata.hasBacklinks&&It.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},It.default.createElement(vte,{className:"tw-size-4"}),It.default.createElement("span",null,"Backlinks")))))}function Efi({note:t,onAddToChat:e,onNavigateToNote:r,children:n}){return It.default.createElement(AZ,{key:t.document.path},It.default.createElement(IZ,{asChild:!0},n),It.default.createElement(zJ,{className:"tw-flex tw-w-fit tw-min-w-72 tw-max-w-96 tw-flex-col tw-gap-2 tw-overflow-hidden"},It.default.createElement("span",{className:"tw-text-sm tw-text-normal"},t.document.title),It.default.createElement("span",{className:"tw-text-xs tw-text-muted"},t.document.path),It.default.createElement("div",{className:"tw-flex tw-gap-2"},It.default.createElement("button",{onClick:e,className:"tw-inline-flex tw-items-center tw-gap-2 tw-border tw-border-solid tw-border-border !tw-bg-transparent !tw-shadow-none hover:!tw-bg-interactive-hover"},"Add to Chat ",It.default.createElement(jv,{className:"tw-size-4"})),It.default.createElement("button",{onClick:o=>{let i=o.metaKey||o.ctrlKey;r(i)},className:"tw-inline-flex tw-items-center tw-gap-2 tw-border tw-border-solid tw-border-border !tw-bg-transparent !tw-shadow-none hover:!tw-bg-interactive-hover"},"Navigate to Note ",It.default.createElement(ute,{className:"tw-size-4"})))))}var FLe=(0,It.memo)(({className:t,defaultOpen:e=!1})=>{let[r,n]=(0,It.useState)(0),[o,i]=(0,It.useState)(e),a=Cfi(r),s=rvt(),u=wU(),l=xfi(s?.path??"",r),c=(p,m=!1)=>{let h=app.vault.getAbstractFileByPath(p);h instanceof Bde.TFile&&app.workspace.getLeaf(m).openFile(h)},d=p=>{u.insertTextWithPills(`[[${p}]]`,!0)},f=async()=>{s&&(await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().reindexFile(s),new Bde.Notice(`Refreshed index for ${s.basename}`),n(r+1))};return It.default.createElement("div",{className:Oe("tw-w-full tw-border tw-border-solid tw-border-transparent tw-border-b-border tw-pb-2",t)},It.default.createElement(Zx,{open:o,onOpenChange:i},It.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-pb-2 tw-pl-1"},It.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},It.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Relevant Notes"),It.default.createElement(Ci,{content:"Relevance is a combination of semantic similarity and links.",contentClassName:"tw-w-64",buttonClassName:"tw-size-4 tw-text-muted"}),!l&&It.default.createElement(Ci,{content:"Note has not been indexed",side:"bottom"},It.default.createElement(rg,{className:"tw-size-4 tw-text-warning"}))),It.default.createElement("div",{className:"tw-flex tw-items-center"},It.default.createElement(Kn,null,It.default.createElement(Wn,{asChild:!0},It.default.createElement(ve,{variant:"ghost2",size:"icon",onClick:f},It.default.createElement(Mte,{className:"tw-size-4"}))),It.default.createElement(Mn,{side:"bottom"},"Reindex Current Note")),a.length>0&&It.default.createElement(D$,{asChild:!0},It.default.createElement(ve,{variant:"ghost2",size:"icon"},o?It.default.createElement(sC,{className:"tw-size-5"}):It.default.createElement(Qs,{className:"tw-size-5"}))))),a.length===0&&It.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"},It.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&&It.default.createElement("div",{className:"tw-flex tw-max-h-6 tw-flex-wrap tw-gap-x-2 tw-gap-y-1 tw-overflow-y-hidden tw-px-1"},a.map(p=>It.default.createElement(Efi,{key:p.document.path,note:p,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)},It.default.createElement(qb,{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"},It.default.createElement("span",{className:"tw-truncate"},p.document.title))))),It.default.createElement(Xx,null,It.default.createElement("div",{className:"tw-flex tw-max-h-screen tw-flex-col tw-gap-2 tw-overflow-y-auto tw-px-1 tw-py-2"},a.map(p=>It.default.createElement(Tfi,{note:p,key:p.document.path,onAddToChat:()=>d(p.document.title),onNavigateToNote:m=>c(p.document.path,m)}))))))});FLe.displayName="RelevantNotes";Tu();gd();Ro();var pv=L(X());jn();var S3=pv.forwardRef(({className:t,...e},r)=>pv.createElement("div",{ref:r,className:Oe("tw-rounded-xl tw-border tw-border-border tw-bg-primary tw-text-normal tw-shadow",t),...e}));S3.displayName="Card";var C3=pv.forwardRef(({className:t,...e},r)=>pv.createElement("div",{ref:r,className:Oe("tw-flex tw-flex-col tw-space-y-1.5 tw-p-6",t),...e}));C3.displayName="CardHeader";var Ude=pv.forwardRef(({className:t,...e},r)=>pv.createElement("div",{ref:r,className:Oe("tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));Ude.displayName="CardTitle";var Pfi=pv.forwardRef(({className:t,...e},r)=>pv.createElement("div",{ref:r,className:Oe("tw-text-sm tw-text-muted",t),...e}));Pfi.displayName="CardDescription";var x3=pv.forwardRef(({className:t,...e},r)=>pv.createElement("div",{ref:r,className:Oe("tw-p-6 tw-pt-0",t),...e}));x3.displayName="CardContent";var Mfi=pv.forwardRef(({className:t,...e},r)=>pv.createElement("div",{ref:r,className:Oe("tw-flex tw-items-center tw-p-6 tw-pt-0",t),...e}));Mfi.displayName="CardFooter";zr();Pt();On();var Yu=L(X());var nvt={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>]]"]}},Een={llm_chain:["activeNote","quoteNote","fun"],vault_qa:["qaVault","qaVault","quoteNote"],copilot_plus:["copilotPlus","copilotPlus","copilotPlus"],project:["copilotPlus","copilotPlus","copilotPlus"]};function Rfi(t="llm_chain"){let e=Een[t]||Een.llm_chain,r={};return e.map(n=>(r[n]||(r[n]=[...nvt[n].prompts].sort(()=>Math.random()-.5)),{title:nvt[n].title,text:r[n].pop()||nvt[n].prompts[0]}))}var Pen=({onClick:t})=>{let[e]=Ev(),r=(0,Yu.useMemo)(()=>Rfi(e),[e]),o=So().indexVaultToVectorStore;return Yu.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},Yu.default.createElement(S3,{className:"tw-w-full tw-bg-transparent"},Yu.default.createElement(C3,{className:"tw-px-2"},Yu.default.createElement(Ude,null,"Suggested Prompts")),Yu.default.createElement(x3,{className:"tw-p-2 tw-pt-0"},Yu.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},r.map((i,a)=>Yu.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"},Yu.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-1"},Yu.default.createElement("div",{className:"tw-text-muted"},i.title),Yu.default.createElement("div",null,i.text)),Yu.default.createElement("div",{className:"tw-flex tw-h-full tw-items-start"},Yu.default.createElement(Kn,null,Yu.default.createElement(Wn,{asChild:!0},Yu.default.createElement(ve,{variant:"ghost2",size:"fit",className:"tw-text-muted",onClick:()=>t(i.text)},Yu.default.createElement(jv,{className:"tw-size-4"}))),Yu.default.createElement(Mn,null,"Add to Chat")))))))),e==="vault_qa"&&Yu.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"&&Yu.default.createElement("div",{className:"tw-rounded-md tw-border tw-border-solid tw-border-border tw-p-2 tw-text-sm"},Yu.default.createElement("div",null,Yu.default.createElement(rg,{className:"tw-size-4"})," Your auto-index strategy is set to"," ",Yu.default.createElement("b",null,"NEVER"),". Before proceeding, click the"," ",Yu.default.createElement("span",{className:"tw-text-accent"},"Refresh Index")," button below or run the"," ",Yu.default.createElement("span",{className:"tw-text-accent"},"Copilot command: Index (refresh) vault for QA")," ","to update the index.")))};zr();zr();var Ub=L(X()),Men=({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===Xs).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 g=t[d].message.length,y=Math.ceil(g/80);f=Math.max(60,y*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===Xs&&u()}},[t.length,t,u]),{containerMinHeight:e,scrollContainerCallbackRef:s,getMessageKey:i}};Pt();var qg=L(X()),Ren=(0,qg.memo)(({chatHistory:t,currentAiMessage:e,loading:r,loadingMessage:n,app:o,onRegenerate:i,onEdit:a,onDelete:s,onReplaceChat:u,showHelperComponents:l=!0})=>{let[c,d]=(0,qg.useState)(""),f=So(),{containerMinHeight:p,scrollContainerCallbackRef:m,getMessageKey:h}=Men({chatHistory:t});if((0,qg.useEffect)(()=>{let y;return r?y=setInterval(()=>{d(b=>b.length<6?b+".":"")},200):d(""),()=>clearInterval(y)},[r]),!t.filter(y=>y.isVisible).length&&!e)return qg.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-gap-2 tw-overflow-y-auto"},l&&f.showRelevantNotes&&qg.default.createElement(FLe,{defaultOpen:!0,key:"relevant-notes-before-chat"}),l&&f.showSuggestedPrompts&&qg.default.createElement(Pen,{onClick:u}));let g=()=>n?`${n} ${c}`:c;return qg.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-1 tw-flex-col tw-overflow-hidden"},l&&f.showRelevantNotes&&qg.default.createElement(FLe,{className:"tw-mb-4",defaultOpen:!1,key:"relevant-notes-in-chat"}),qg.default.createElement("div",{ref:m,"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((y,b)=>{let _=t.filter(O=>O.isVisible),x=b===_.length-1&&y.sender!==Xs;return y.isVisible&&qg.default.createElement("div",{key:h(y,b),"data-message-key":h(y,b),className:"tw-w-full",style:{minHeight:x?`${p}px`:"auto"}},qg.default.createElement(evt,{message:y,app:o,isStreaming:!1,onRegenerate:()=>i(b),onEdit:O=>a(b,O),onDelete:()=>s(b)}))}),(e||r)&&qg.default.createElement("div",{className:"tw-w-full",style:{minHeight:`${p}px`}},qg.default.createElement(evt,{key:"ai_message_streaming",message:{sender:"AI",message:e||g(),isVisible:!0,timestamp:null},app:o,isStreaming:!0,onDelete:()=>{}}))))});Ren.displayName="ChatMessages";var Aen=Ren;Ro();wr();var kLe=L(X());function qLe(t){let[e,r]=(0,kLe.useState)(null);(0,kLe.useEffect)(()=>{(async()=>{let i=await EAt();i.version&&r(i.version)})()},[]);let n=e!==null&&zhe(e,t);return{latestVersion:e,hasUpdate:n}}jn();Pt();wr();On();var j0=L(X());function Ien({currentVersion:t}){let{latestVersion:e,hasUpdate:r}=qLe(t),n=So().lastDismissedVersion,[o,i]=(0,j0.useState)(!0),a=r&&e&&zhe(e,t)&&n!==e,s=()=>{e&&(i(!1),setTimeout(()=>{et("lastDismissedVersion",e)},300))};return a?j0.default.createElement("div",{className:Oe("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(ve,{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(ve,{variant:"ghost2",size:"icon",onClick:s},j0.default.createElement(pi,{className:"tw-size-4"}))))):null}Tu();Tu();var Nen=require("obsidian");vb();var jX=class extends Nen.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseFolder=n}getItems(){let r=new Set,n=lie(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 ovt=require("obsidian");var BLe=require("obsidian");wr();gd();var DX=class extends BLe.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 BLe.TFile&&B6(a,this.chainType)&&!e.includes(a.path)&&a.path!==this.activeNote?.path),o=this.app.vault.getFiles().filter(a=>B6(a,this.chainType)).filter(a=>!r.some(s=>s.path===a.path)&&!e.includes(a.path)&&a.path!==this.activeNote?.path);return[...this.activeNote&&B6(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 zde=class extends DX{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 ovt.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 ovt.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}};wr();var jen=require("obsidian"),$X=class extends jen.FuzzySuggestModal{constructor(r,n){super(r);this.onChooseTag=n}getItems(){let r=app.vault.getMarkdownFiles(),n=new Set;for(let o of r)CO(o).forEach(a=>n.add(a));return Array.from(n)}getItemText(r){return r}onChooseItem(r,n){this.onChooseTag(r)}};Ro();var Wde=L(X());On();var zen=L(X(),1),hr=L(X(),1),JLe=(0,hr.createContext)(null);JLe.displayName="PanelGroupContext";var Bc={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"},dvt=10,T3=hr.useLayoutEffect,Den=zen.useId,Afi=typeof Den=="function"?Den:()=>null,Ifi=0;function fvt(t=null){let e=Afi(),r=(0,hr.useRef)(t||e||null);return r.current===null&&(r.current=""+Ifi++),t??r.current}function Hen({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 g=(0,hr.useContext)(JLe);if(g===null)throw Error("Panel components must be rendered within a PanelGroup container");let{collapsePanel:y,expandPanel:b,getPanelSize:_,getPanelStyle:w,groupId:x,isPanelCollapsed:O,reevaluatePanelConstraints:E,registerPanel:T,resizePanel:R,unregisterPanel:N}=g,D=fvt(a),F=(0,hr.useRef)({callbacks:{onCollapse:l,onExpand:c,onResize:d},constraints:{collapsedSize:r,collapsible:n,defaultSize:o,maxSize:s,minSize:u},id:D,idIsFromProps:a!==void 0,order:f});(0,hr.useRef)({didLogMissingDefaultSizeWarning:!1}),T3(()=>{let{callbacks:U,constraints:H}=F.current,G={...H};F.current.id=D,F.current.idIsFromProps=a!==void 0,F.current.order=f,U.onCollapse=l,U.onExpand=c,U.onResize=d,H.collapsedSize=r,H.collapsible=n,H.defaultSize=o,H.maxSize=s,H.minSize=u,(G.collapsedSize!==H.collapsedSize||G.collapsible!==H.collapsible||G.maxSize!==H.maxSize||G.minSize!==H.minSize)&&E(F.current,G)}),T3(()=>{let U=F.current;return T(U),()=>{N(U)}},[f,D,T,N]),(0,hr.useImperativeHandle)(i,()=>({collapse:()=>{y(F.current)},expand:U=>{b(F.current,U)},getId(){return D},getSize(){return _(F.current)},isCollapsed(){return O(F.current)},isExpanded(){return!O(F.current)},resize:U=>{R(F.current,U)}}),[y,b,_,O,D,R]);let B=w(F.current,o);return(0,hr.createElement)(m,{...h,children:t,className:e,id:D,style:{...B,...p},[Bc.groupId]:x,[Bc.panel]:"",[Bc.panelCollapsible]:n||void 0,[Bc.panelId]:D,[Bc.panelSize]:parseFloat(""+B.flexGrow).toFixed(1)})}var pvt=(0,hr.forwardRef)((t,e)=>(0,hr.createElement)(Hen,{...t,forwardedRef:e}));Hen.displayName="Panel";pvt.displayName="forwardRef(Panel)";var Nfi;function jfi(){return Nfi}var cvt=null,Dfi=!0,zLe=-1,$$=null;function $fi(t,e){if(e){let r=(e&Gen)!==0,n=(e&Zen)!==0,o=(e&Xen)!==0,i=(e&Yen)!==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 Lfi(){$$!==null&&(document.head.removeChild($$),cvt=null,$$=null,zLe=-1)}function ivt(t,e){var r,n;if(!Dfi)return;let o=$fi(t,e);if(cvt!==o){if(cvt=o,$$===null){$$=document.createElement("style");let a=jfi();a&&$$.setAttribute("nonce",a),document.head.appendChild($$)}if(zLe>=0){var i;(i=$$.sheet)===null||i===void 0||i.removeRule(zLe)}zLe=(r=(n=$$.sheet)===null||n===void 0?void 0:n.insertRule(`*{cursor: ${o} !important;}`))!==null&&r!==void 0?r:-1}}function Ven(t){return t.type==="keydown"}function Jen(t){return t.type.startsWith("pointer")}function Ken(t){return t.type.startsWith("mouse")}function KLe(t){if(Jen(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(Ken(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function Ffi(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function kfi(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 qfi(t,e){if(t===e)throw new Error("Cannot compare node with itself");let r={a:Fen(t),b:Fen(e)},n;for(;r.a.at(-1)===r.b.at(-1);)t=r.a.pop(),e=r.b.pop(),n=t;si(n,"Stacking order can only be calculated for elements with a common ancestor");let o={a:Len($en(r.a)),b:Len($en(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 Bfi=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Ufi(t){var e;let r=getComputedStyle((e=Wen(t))!==null&&e!==void 0?e:t).display;return r==="flex"||r==="inline-flex"}function zfi(t){let e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||Ufi(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"||Bfi.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function $en(t){let e=t.length;for(;e--;){let r=t[e];if(si(r,"Missing node"),zfi(r))return r}return null}function Len(t){return t&&Number(getComputedStyle(t).zIndex)||0}function Fen(t){let e=[];for(;t;)e.push(t),t=Wen(t);return e}function Wen(t){let{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}var Gen=1,Zen=2,Xen=4,Yen=8,Hfi=Ffi()==="coarse",Yx=[],qX=!1,AU=new Map,WLe=new Map,Jde=new Set;function Vfi(t,e,r,n,o){var i;let{ownerDocument:a}=e,s={direction:r,element:e,hitAreaMargins:n,setResizeHandlerState:o},u=(i=AU.get(a))!==null&&i!==void 0?i:0;return AU.set(a,u+1),Jde.add(s),HLe(),function(){var c;WLe.delete(t),Jde.delete(s);let d=(c=AU.get(a))!==null&&c!==void 0?c:1;if(AU.set(a,d-1),HLe(),d===1&&AU.delete(a),Yx.includes(s)){let f=Yx.indexOf(s);f>=0&&Yx.splice(f,1),hvt(),o("up",!0,null)}}}function Jfi(t){let{target:e}=t,{x:r,y:n}=KLe(t);qX=!0,mvt({target:e,x:r,y:n}),HLe(),Yx.length>0&&(VLe("down",t),t.preventDefault(),Qen(e)||t.stopImmediatePropagation())}function avt(t){let{x:e,y:r}=KLe(t);if(qX&&t.buttons===0&&(qX=!1,VLe("up",t)),!qX){let{target:n}=t;mvt({target:n,x:e,y:r})}VLe("move",t),hvt(),Yx.length>0&&t.preventDefault()}function svt(t){let{target:e}=t,{x:r,y:n}=KLe(t);WLe.clear(),qX=!1,Yx.length>0&&(t.preventDefault(),Qen(e)||t.stopImmediatePropagation()),VLe("up",t),mvt({target:e,x:r,y:n}),hvt(),HLe()}function Qen(t){let e=t;for(;e;){if(e.hasAttribute(Bc.resizeHandle))return!0;e=e.parentElement}return!1}function mvt({target:t,x:e,y:r}){Yx.splice(0);let n=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(n=t),Jde.forEach(o=>{let{element:i,hitAreaMargins:a}=o,s=i.getBoundingClientRect(),{bottom:u,left:l,right:c,top:d}=s,f=Hfi?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)&&qfi(n,i)>0){let m=n,h=!1;for(;m&&!m.contains(i);){if(kfi(m.getBoundingClientRect(),s,!0)){h=!0;break}m=m.parentElement}if(h)return}Yx.push(o)}})}function uvt(t,e){WLe.set(t,e)}function hvt(){let t=!1,e=!1;Yx.forEach(n=>{let{direction:o}=n;o==="horizontal"?t=!0:e=!0});let r=0;WLe.forEach(n=>{r|=n}),t&&e?ivt("intersection",r):t?ivt("horizontal",r):e?ivt("vertical",r):Lfi()}var lvt=new AbortController;function HLe(){lvt.abort(),lvt=new AbortController;let t={capture:!0,signal:lvt.signal};Jde.size&&(qX?(Yx.length>0&&AU.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("contextmenu",svt,t),n.addEventListener("pointerleave",avt,t),n.addEventListener("pointermove",avt,t))}),AU.forEach((e,r)=>{let{body:n}=r;n.addEventListener("pointerup",svt,t),n.addEventListener("pointercancel",svt,t)})):AU.forEach((e,r)=>{let{body:n}=r;e>0&&(n.addEventListener("pointerdown",Jfi,t),n.addEventListener("pointermove",avt,t))}))}function VLe(t,e){Jde.forEach(r=>{let{setResizeHandlerState:n}=r,o=Yx.includes(r);n(t,o,e)})}function Kfi(){let[t,e]=(0,hr.useState)(0);return(0,hr.useCallback)(()=>e(r=>r+1),[])}function si(t,e){if(!t)throw console.error(e),Error(e)}function E3(t,e,r=dvt){return t.toFixed(r)===e.toFixed(r)?0:t>e?1:-1}function L$(t,e,r=dvt){return E3(t,e,r)===0}function Ew(t,e,r){return E3(t,e,r)===0}function Wfi(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 kX({panelConstraints:t,panelIndex:e,size:r}){let n=t[e];si(n!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=n;if(E3(r,s)<0)if(i){let u=(o+s)/2;E3(r,u)<0?r=o:r=s}else r=s;return r=Math.min(a,r),r=parseFloat(r.toFixed(dvt)),r}function Hde({delta:t,initialLayout:e,panelConstraints:r,pivotIndices:n,prevLayout:o,trigger:i}){if(Ew(t,0))return e;let a=[...e],[s,u]=n;si(s!=null,"Invalid first pivot index"),si(u!=null,"Invalid second pivot index");let l=0;if(i==="keyboard"){{let d=t<0?u:s,f=r[d];si(f,`Panel constraints not found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let g=e[d];if(si(g!=null,`Previous layout not found for panel index ${d}`),Ew(g,p)){let y=h-g;E3(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}{let d=t<0?s:u,f=r[d];si(f,`No panel constraints found for index ${d}`);let{collapsedSize:p=0,collapsible:m,minSize:h=0}=f;if(m){let g=e[d];if(si(g!=null,`Previous layout not found for panel index ${d}`),Ew(g,h)){let y=g-p;E3(y,Math.abs(t))>0&&(t=t<0?0-y:y)}}}}{let d=t<0?1:-1,f=t<0?u:s,p=0;for(;;){let h=e[f];si(h!=null,`Previous layout not found for panel index ${f}`);let y=kX({panelConstraints:r,panelIndex:f,size:100})-h;if(p+=y,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];si(m!=null,`Previous layout not found for panel index ${f}`);let h=m-p,g=kX({panelConstraints:r,panelIndex:f,size:h});if(!Ew(m,g)&&(l+=m-g,a[f]=g,l.toPrecision(3).localeCompare(Math.abs(t).toPrecision(3),void 0,{numeric:!0})>=0))break;t<0?f--:f++}}if(Wfi(o,a))return o;{let d=t<0?u:s,f=e[d];si(f!=null,`Previous layout not found for panel index ${d}`);let p=f+l,m=kX({panelConstraints:r,panelIndex:d,size:p});if(a[d]=m,!Ew(m,p)){let h=p-m,y=t<0?u:s;for(;y>=0&&y<r.length;){let b=a[y];si(b!=null,`Previous layout not found for panel index ${y}`);let _=b+h,w=kX({panelConstraints:r,panelIndex:y,size:_});if(Ew(b,w)||(h-=w-b,a[y]=w),Ew(h,0))break;t>0?y--:y++}}}let c=a.reduce((d,f)=>f+d,0);return Ew(c,100)?a:o}function Gfi({layout:t,panelsArray:e,pivotIndices:r}){let n=0,o=100,i=0,a=0,s=r[0];si(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 Kde(t,e=document){return Array.from(e.querySelectorAll(`[${Bc.resizeHandleId}][data-panel-group-id="${t}"]`))}function etn(t,e,r=document){let o=Kde(t,r).findIndex(i=>i.getAttribute(Bc.resizeHandleId)===e);return o??null}function ttn(t,e,r){let n=etn(t,e,r);return n!=null?[n,n+1]:[-1,-1]}function Zfi(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function rtn(t,e=document){if(Zfi(e)&&e.dataset.panelGroupId==t)return e;let r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function GLe(t,e=document){let r=e.querySelector(`[${Bc.resizeHandleId}="${t}"]`);return r||null}function Xfi(t,e,r,n=document){var o,i,a,s;let u=GLe(e,n),l=Kde(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 Yfi({committedValuesRef:t,eagerValuesRef:e,groupId:r,layout:n,panelDataArray:o,panelGroupElement:i,setLayout:a}){(0,hr.useRef)({didWarnAboutMissingResizeHandle:!1}),T3(()=>{if(!i)return;let s=Kde(r,i);for(let u=0;u<o.length-1;u++){let{valueMax:l,valueMin:c,valueNow:d}=Gfi({layout:n,panelsArray:o,pivotIndices:[u,u+1]}),f=s[u];if(f!=null){let p=o[u];si(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,hr.useEffect)(()=>{if(!i)return;let s=e.current;si(s,"Eager values not found");let{panelDataArray:u}=s,l=rtn(r,i);si(l!=null,`No group found for id "${r}"`);let c=Kde(r,i);si(c,`No resize handles found for group id "${r}"`);let d=c.map(f=>{let p=f.getAttribute(Bc.resizeHandleId);si(p,"Resize handle element has no handle id attribute");let[m,h]=Xfi(r,p,u,i);if(m==null||h==null)return()=>{};let g=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();let b=u.findIndex(_=>_.id===m);if(b>=0){let _=u[b];si(_,`No panel data found for index ${b}`);let w=n[b],{collapsedSize:x=0,collapsible:O,minSize:E=0}=_.constraints;if(w!=null&&O){let T=Hde({delta:Ew(w,x)?E-x:x-w,initialLayout:n,panelConstraints:u.map(R=>R.constraints),pivotIndices:ttn(r,p,i),prevLayout:n,trigger:"keyboard"});n!==T&&a(T)}}break}}};return f.addEventListener("keydown",g),()=>{f.removeEventListener("keydown",g)}});return()=>{d.forEach(f=>f())}},[i,t,e,r,n,o,a])}function ken(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 ntn(t,e){let r=t==="horizontal",{x:n,y:o}=KLe(e);return r?n:o}function Qfi(t,e,r,n,o){let i=r==="horizontal",a=GLe(e,o);si(a,`No resize handle element found for id "${e}"`);let s=a.getAttribute(Bc.groupId);si(s,"Resize handle element has no group id attribute");let{initialCursorPosition:u}=n,l=ntn(r,t),c=rtn(s,o);si(c,`No group element found for id "${s}"`);let d=c.getBoundingClientRect(),f=i?d.width:d.height;return(l-u)/f*100}function epi(t,e,r,n,o,i){if(Ven(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:Qfi(t,e,r,n,i)}function tpi({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];si(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];si(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 LX(t,e,r){e.forEach((n,o)=>{let i=t[o];si(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||L$(d,l))&&!L$(n,l)&&p(),f&&(d==null||!L$(d,l))&&L$(n,l)&&f())}})}function ULe(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 rpi({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 npi(t,e=10){let r=null;return(...o)=>{r!==null&&clearTimeout(r),r=setTimeout(()=>{t(...o)},e)}}function qen(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 otn(t){return`react-resizable-panels:${t}`}function itn(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 atn(t,e){try{let r=otn(t),n=e.getItem(r);if(n){let o=JSON.parse(n);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function opi(t,e,r){var n,o;let i=(n=atn(t,r))!==null&&n!==void 0?n:{},a=itn(e);return(o=i[a])!==null&&o!==void 0?o:null}function ipi(t,e,r,n,o){var i;let a=otn(t),s=itn(e),u=(i=atn(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 Ben({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];si(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];si(a!=null,`No layout data found for index ${i}`);let s=kX({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];si(a!=null,`No layout data found for index ${i}`);let s=a+o,u=kX({panelConstraints:e,panelIndex:i,size:s});if(a!==u&&(o-=u-a,r[i]=u,Ew(o,0)))break}return r}var api=100,Vde={getItem:t=>(qen(Vde),Vde.getItem(t)),setItem:(t,e)=>{qen(Vde),Vde.setItem(t,e)}},Uen={};function stn({autoSaveId:t=null,children:e,className:r="",direction:n,forwardedRef:o,id:i=null,onLayout:a=null,keyboardResizeBy:s=null,storage:u=Vde,style:l,tagName:c="div",...d}){let f=fvt(i),p=(0,hr.useRef)(null),[m,h]=(0,hr.useState)(null),[g,y]=(0,hr.useState)([]),b=Kfi(),_=(0,hr.useRef)({}),w=(0,hr.useRef)(new Map),x=(0,hr.useRef)(0),O=(0,hr.useRef)({autoSaveId:t,direction:n,dragState:m,id:f,keyboardResizeBy:s,onLayout:a,storage:u}),E=(0,hr.useRef)({layout:g,panelDataArray:[],panelDataArrayChanged:!1});(0,hr.useRef)({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),(0,hr.useImperativeHandle)(o,()=>({getId:()=>O.current.id,getLayout:()=>{let{layout:$}=E.current;return $},setLayout:$=>{let{onLayout:q}=O.current,{layout:Y,panelDataArray:j}=E.current,A=Ben({layout:$,panelConstraints:j.map(W=>W.constraints)});ken(Y,A)||(y(A),E.current.layout=A,q&&q(A),LX(j,A,_.current))}}),[]),T3(()=>{O.current.autoSaveId=t,O.current.direction=n,O.current.dragState=m,O.current.id=f,O.current.onLayout=a,O.current.storage=u}),Yfi({committedValuesRef:O,eagerValuesRef:E,groupId:f,layout:g,panelDataArray:E.current.panelDataArray,setLayout:y,panelGroupElement:p.current}),(0,hr.useEffect)(()=>{let{panelDataArray:$}=E.current;if(t){if(g.length===0||g.length!==$.length)return;let q=Uen[t];q==null&&(q=npi(ipi,api),Uen[t]=q);let Y=[...$],j=new Map(w.current);q(t,Y,j,g,u)}},[t,g,u]),(0,hr.useEffect)(()=>{});let T=(0,hr.useCallback)($=>{let{onLayout:q}=O.current,{layout:Y,panelDataArray:j}=E.current;if($.constraints.collapsible){let A=j.map(be=>be.constraints),{collapsedSize:W=0,panelSize:V,pivotIndices:se}=O3(j,$,Y);if(si(V!=null,`Panel size not found for panel "${$.id}"`),!L$(V,W)){w.current.set($.id,V);let Ee=FX(j,$)===j.length-1?V-W:W-V,Ae=Hde({delta:Ee,initialLayout:Y,panelConstraints:A,pivotIndices:se,prevLayout:Y,trigger:"imperative-api"});ULe(Y,Ae)||(y(Ae),E.current.layout=Ae,q&&q(Ae),LX(j,Ae,_.current))}}},[]),R=(0,hr.useCallback)(($,q)=>{let{onLayout:Y}=O.current,{layout:j,panelDataArray:A}=E.current;if($.constraints.collapsible){let W=A.map(ht=>ht.constraints),{collapsedSize:V=0,panelSize:se=0,minSize:be=0,pivotIndices:Ee}=O3(A,$,j),Ae=q??be;if(L$(se,V)){let ht=w.current.get($.id),Rt=ht!=null&&ht>=Ae?ht:Ae,Dr=FX(A,$)===A.length-1?se-Rt:Rt-se,Vt=Hde({delta:Dr,initialLayout:j,panelConstraints:W,pivotIndices:Ee,prevLayout:j,trigger:"imperative-api"});ULe(j,Vt)||(y(Vt),E.current.layout=Vt,Y&&Y(Vt),LX(A,Vt,_.current))}}},[]),N=(0,hr.useCallback)($=>{let{layout:q,panelDataArray:Y}=E.current,{panelSize:j}=O3(Y,$,q);return si(j!=null,`Panel size not found for panel "${$.id}"`),j},[]),D=(0,hr.useCallback)(($,q)=>{let{panelDataArray:Y}=E.current,j=FX(Y,$);return rpi({defaultSize:q,dragState:m,layout:g,panelData:Y,panelIndex:j})},[m,g]),F=(0,hr.useCallback)($=>{let{layout:q,panelDataArray:Y}=E.current,{collapsedSize:j=0,collapsible:A,panelSize:W}=O3(Y,$,q);return si(W!=null,`Panel size not found for panel "${$.id}"`),A===!0&&L$(W,j)},[]),B=(0,hr.useCallback)($=>{let{layout:q,panelDataArray:Y}=E.current,{collapsedSize:j=0,collapsible:A,panelSize:W}=O3(Y,$,q);return si(W!=null,`Panel size not found for panel "${$.id}"`),!A||E3(W,j)>0},[]),U=(0,hr.useCallback)($=>{let{panelDataArray:q}=E.current;q.push($),q.sort((Y,j)=>{let A=Y.order,W=j.order;return A==null&&W==null?0:A==null?-1:W==null?1:A-W}),E.current.panelDataArrayChanged=!0,b()},[b]);T3(()=>{if(E.current.panelDataArrayChanged){E.current.panelDataArrayChanged=!1;let{autoSaveId:$,onLayout:q,storage:Y}=O.current,{layout:j,panelDataArray:A}=E.current,W=null;if($){let se=opi($,A,Y);se&&(w.current=new Map(Object.entries(se.expandToSizes)),W=se.layout)}W==null&&(W=tpi({panelDataArray:A}));let V=Ben({layout:W,panelConstraints:A.map(se=>se.constraints)});ken(j,V)||(y(V),E.current.layout=V,q&&q(V),LX(A,V,_.current))}}),T3(()=>{let $=E.current;return()=>{$.layout=[]}},[]);let H=(0,hr.useCallback)($=>{let q=!1,Y=p.current;return Y&&window.getComputedStyle(Y,null).getPropertyValue("direction")==="rtl"&&(q=!0),function(A){A.preventDefault();let W=p.current;if(!W)return()=>null;let{direction:V,dragState:se,id:be,keyboardResizeBy:Ee,onLayout:Ae}=O.current,{layout:ht,panelDataArray:Rt}=E.current,{initialLayout:Ze}=se??{},Dr=ttn(be,$,W),Vt=epi(A,$,V,se,Ee,W),jt=V==="horizontal";jt&&q&&(Vt=-Vt);let Fe=Rt.map(qe=>qe.constraints),hn=Hde({delta:Vt,initialLayout:Ze??ht,panelConstraints:Fe,pivotIndices:Dr,prevLayout:ht,trigger:Ven(A)?"keyboard":"mouse-or-touch"}),gt=!ULe(ht,hn);(Jen(A)||Ken(A))&&x.current!=Vt&&(x.current=Vt,!gt&&Vt!==0?jt?uvt($,Vt<0?Gen:Zen):uvt($,Vt<0?Xen:Yen):uvt($,0)),gt&&(y(hn),E.current.layout=hn,Ae&&Ae(hn),LX(Rt,hn,_.current))}},[]),G=(0,hr.useCallback)(($,q)=>{let{onLayout:Y}=O.current,{layout:j,panelDataArray:A}=E.current,W=A.map(ht=>ht.constraints),{panelSize:V,pivotIndices:se}=O3(A,$,j);si(V!=null,`Panel size not found for panel "${$.id}"`);let Ee=FX(A,$)===A.length-1?V-q:q-V,Ae=Hde({delta:Ee,initialLayout:j,panelConstraints:W,pivotIndices:se,prevLayout:j,trigger:"imperative-api"});ULe(j,Ae)||(y(Ae),E.current.layout=Ae,Y&&Y(Ae),LX(A,Ae,_.current))},[]),ie=(0,hr.useCallback)(($,q)=>{let{layout:Y,panelDataArray:j}=E.current,{collapsedSize:A=0,collapsible:W}=q,{collapsedSize:V=0,collapsible:se,maxSize:be=100,minSize:Ee=0}=$.constraints,{panelSize:Ae}=O3(j,$,Y);Ae!=null&&(W&&se&&L$(Ae,A)?L$(A,V)||G($,V):Ae<Ee?G($,Ee):Ae>be&&G($,be))},[G]),oe=(0,hr.useCallback)(($,q)=>{let{direction:Y}=O.current,{layout:j}=E.current;if(!p.current)return;let A=GLe($,p.current);si(A,`Drag handle element not found for id "${$}"`);let W=ntn(Y,q);h({dragHandleId:$,dragHandleRect:A.getBoundingClientRect(),initialCursorPosition:W,initialLayout:j})},[]),z=(0,hr.useCallback)(()=>{h(null)},[]),Q=(0,hr.useCallback)($=>{let{panelDataArray:q}=E.current,Y=FX(q,$);Y>=0&&(q.splice(Y,1),delete _.current[$.id],E.current.panelDataArrayChanged=!0,b())},[b]),re=(0,hr.useMemo)(()=>({collapsePanel:T,direction:n,dragState:m,expandPanel:R,getPanelSize:N,getPanelStyle:D,groupId:f,isPanelCollapsed:F,isPanelExpanded:B,reevaluatePanelConstraints:ie,registerPanel:U,registerResizeHandle:H,resizePanel:G,startDragging:oe,stopDragging:z,unregisterPanel:Q,panelGroupElement:p.current}),[T,m,n,R,N,D,f,F,B,ie,U,H,G,oe,z,Q]),Z={display:"flex",flexDirection:n==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return(0,hr.createElement)(JLe.Provider,{value:re},(0,hr.createElement)(c,{...d,children:e,className:r,id:i,ref:p,style:{...Z,...l},[Bc.group]:"",[Bc.groupDirection]:n,[Bc.groupId]:f}))}var gvt=(0,hr.forwardRef)((t,e)=>(0,hr.createElement)(stn,{...t,forwardedRef:e}));stn.displayName="PanelGroup";gvt.displayName="forwardRef(PanelGroup)";function FX(t,e){return t.findIndex(r=>r===e||r.id===e.id)}function O3(t,e,r){let n=FX(t,e),i=n===t.length-1?[n-1,n]:[n,n+1],a=r[n];return{...e.constraints,panelSize:a,pivotIndices:i}}function spi({disabled:t,handleId:e,resizeHandler:r,panelGroupElement:n}){(0,hr.useEffect)(()=>{if(t||r==null||n==null)return;let o=GLe(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(Bc.groupId);si(s,`No group element found for id "${s}"`);let u=Kde(s,n),l=etn(s,e,n);si(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 yvt({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,g;let y=(0,hr.useRef)(null),b=(0,hr.useRef)({onClick:a,onDragging:s,onPointerDown:l,onPointerUp:c});(0,hr.useEffect)(()=>{b.current.onClick=a,b.current.onDragging=s,b.current.onPointerDown=l,b.current.onPointerUp=c});let _=(0,hr.useContext)(JLe);if(_===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");let{direction:w,groupId:x,registerResizeHandle:O,startDragging:E,stopDragging:T,panelGroupElement:R}=_,N=fvt(o),[D,F]=(0,hr.useState)("inactive"),[B,U]=(0,hr.useState)(!1),[H,G]=(0,hr.useState)(null),ie=(0,hr.useRef)({state:D});T3(()=>{ie.current.state=D}),(0,hr.useEffect)(()=>{if(r)G(null);else{let re=O(N);G(()=>re)}},[r,N,O]);let oe=(h=n?.coarse)!==null&&h!==void 0?h:15,z=(g=n?.fine)!==null&&g!==void 0?g:5;return(0,hr.useEffect)(()=>{if(r||H==null)return;let re=y.current;si(re,"Element ref not attached");let Z=!1;return Vfi(N,re,w,{coarse:oe,fine:z},(q,Y,j)=>{if(!Y){F("inactive");return}switch(q){case"down":{F("drag"),Z=!1,si(j,'Expected event to be defined for "down" action'),E(N,j);let{onDragging:A,onPointerDown:W}=b.current;A?.(!0),W?.();break}case"move":{let{state:A}=ie.current;Z=!0,A!=="drag"&&F("hover"),si(j,'Expected event to be defined for "move" action'),H(j);break}case"up":{F("hover"),T();let{onClick:A,onDragging:W,onPointerUp:V}=b.current;W?.(!1),V?.(),Z||A?.();break}}})},[oe,w,r,z,O,N,H,E,T]),spi({disabled:r,handleId:N,resizeHandler:H,panelGroupElement:R}),(0,hr.createElement)(p,{...m,children:t,className:e,id:o,onBlur:()=>{U(!1),i?.()},onFocus:()=>{U(!0),u?.()},ref:y,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...d},tabIndex:f,[Bc.groupDirection]:w,[Bc.groupId]:x,[Bc.resizeHandle]:"",[Bc.resizeHandleActive]:D==="drag"?"pointer":B?"keyboard":void 0,[Bc.resizeHandleEnabled]:!r,[Bc.resizeHandleId]:N,[Bc.resizeHandleState]:D})}yvt.displayName="PanelResizeHandle";jn();var utn=({className:t,...e})=>Wde.createElement(gvt,{className:Oe("tw-flex tw-size-full data-[panel-group-direction=vertical]:tw-flex-col",t),...e}),bvt=pvt,ltn=({withHandle:t,className:e,...r})=>Wde.createElement(yvt,{className:Oe("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&&Wde.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"},Wde.createElement(cC,{className:"tw-size-2.5"})));jn();vb();wr();On();var UX=require("obsidian"),Ve=L(X()),ftn=L(wm());function lpi({extension:t,size:e="tw-size-4"}){let r=t.toLowerCase().replace("*.","");return["jpg","jpeg","png","gif","svg"].includes(r)?Ve.default.createElement(_te,{className:`tw-text-context-manager-blue ${e}`}):["mp3","wav","ogg"].includes(r)?Ve.default.createElement(bte,{className:`tw-text-context-manager-purple ${e}`}):["mp4","mov","avi"].includes(r)?Ve.default.createElement(Ste,{className:`tw-text-context-manager-orange ${e}`}):["md","txt","mdx","markdown"].includes(r)?Ve.default.createElement(ic,{className:`${e}`}):Ve.default.createElement(ic,{className:`tw-text-faint ${e}`})}var _vt=({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(Ci,{buttonClassName:"tw-ml-2 tw-size-4 tw-text-muted",content:Ve.default.createElement("div",{className:"tw-max-w-80"},o)})),Ve.default.createElement(ve,{variant:"ghost",size:"fit",className:"tw-text-muted hover:tw-bg-secondary",title:`Add new ${e.toLowerCase()}`,onClick:n},Ve.default.createElement(jv,{className:`tw-size-4 ${r}`}))),ctn=({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(_vt,{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:Oe("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(pm,{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(pi,{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 cpi({item:t,viewMode:e,onDelete:r}){let n=t.id.split(".").pop()||"",o=t.isIgnored?dC:pi;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(lpi,{extension:n,size:"tw-size-8"})),Ve.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col"},Ve.default.createElement(pm,{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(pm,{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"},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:i=>r(i,t)})))}function dpi({item:t,onClick:e}){let r,n;switch(t.type){case"tag":r=eF,n="tw-text-context-manager-orange";break;case"folder":r=sh,n="tw-text-context-manager-yellow";break;case"files":r=ic,n="tw-text-context-manager-blue";break;case"ignoreFiles":r=pi,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(pm,{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(pm,{className:"tw-flex-1 tw-text-xs tw-text-faint"},t.count," ",t.count===1?"item":"items")))}function dtn(t){return"type"in t}function fpi({initialProject:t,onSave:e,onCancel:r,app:n}){let o=UX.Platform.isMobile,{inclusions:i,exclusions:a}=(0,Ve.useMemo)(()=>id({inclusions:t?.contextSource.inclusions,exclusions:t?.contextSource.exclusions,isProject:!0}),[t.contextSource]),s=(0,Ve.useMemo)(()=>n.vault.getFiles(),[n.vault]),u=(0,Ve.useCallback)((Z,$,q)=>{let Y=Z.filter(be=>ml(be,$,q,!0)),j=(be,Ee,Ae,ht)=>{Ee&&Ee.forEach(Rt=>{let Ze={[Ae]:[Rt]};ml(be,Ze,null,!0)&&!ht[Rt].some(Dr=>Dr.id===be.path)&&ht[Rt].push({id:be.path,name:be.basename})})},A={},W={},V={},se=[];return($?.tagPatterns??[]).forEach(be=>{A[be]=[]}),($?.folderPatterns??[]).forEach(be=>{W[be]=[]}),($?.extensionPatterns??[]).forEach(be=>{V[be]=[]}),Y.forEach(be=>{j(be,$?.tagPatterns,"tagPatterns",A),j(be,$?.folderPatterns,"folderPatterns",W),j(be,$?.extensionPatterns,"extensionPatterns",V),$?.notePatterns&&ml(be,{notePatterns:$.notePatterns},null,!0)&&!se.some(Ee=>Ee.id===be.path)&&se.push({id:be.path,name:be.basename})}),{tags:A,folders:W,extensions:V,notes:se}},[]),[l,c]=(0,Ve.useState)(()=>u(s,i,a)),[d,f]=(0,Ve.useState)(()=>{let Z=s.filter($=>a&&ml($,a,null,!0));return{files:new Set(Z)}}),p=(0,Ve.useRef)(l),m=(0,Ve.useRef)(d),[h,g]=(0,Ve.useState)(""),[y,b]=(0,Ve.useState)(null),[_,w]=(0,Ve.useState)(null),x=(0,Ve.useCallback)((Z,$)=>{let q=Object.keys(Z.tags),Y=Object.keys(Z.folders),j=Object.keys(Z.extensions),A=Z.notes.map(W=>{let V=$.find(se=>se.path===W.id);if(V)return W8(V)}).filter(Boolean);return K8({tagPatterns:q,folderPatterns:Y,extensionPatterns:j,notePatterns:A})},[]),O=(0,Ve.useCallback)(Z=>{let $=new Array(...Z.files).map(q=>W8(q));return K8({notePatterns:$})||""},[]);(0,Ve.useEffect)(()=>{p.current=l,m.current=d},[l,d]);let E=(0,Ve.useMemo)(()=>{let Z=[],$=(Y,j)=>{j.forEach(A=>{Y.some(W=>W.id===A.id)||Y.push({id:A.id,name:A.name})})};return[l.tags,l.folders,l.extensions,{notes:l.notes}].forEach(Y=>{Object.values(Y).forEach(j=>{$(Z,j)})}),Z},[l]),T=(0,Ve.useCallback)(Z=>{let $=[],q=[],Y=[];return Z.split(",").map(A=>A.trim()).filter(A=>A).forEach(A=>{A.startsWith("#")?$.push(A.substring(1)):A.startsWith(".")||A.startsWith("*.")?Y.push(A.replace("*","")):q.push(A)}),{tags:$,titles:q,extensions:Y}},[]),R=(0,Ve.useCallback)(Z=>[...Z].sort(($,q)=>$.name.toLowerCase().localeCompare(q.name.toLowerCase())),[]),N=(0,Ve.useMemo)(()=>{if(h){let Z=T(h);return E.filter($=>{let q=s.find(se=>se.path===$.id);if(!q)return!1;let Y=q.extension==="md",j=Z.tags.length>0&&Y&&Z.tags.some(se=>CO(q).some(Ee=>(Ee.startsWith("#")?Ee.substring(1):Ee).toLowerCase().includes(se.toLowerCase()))),A=Z.titles.length>0&&Z.titles.some(se=>q.basename.toLowerCase().includes(se.toLowerCase())),W=Z.extensions.length>0&&Z.extensions.some(se=>`.${q.extension}`.toLowerCase()===se.toLowerCase());return Z.tags.length>0||Z.titles.length>0||Z.extensions.length>0?j||A||W:!1}).map($=>({id:$.id,name:$.name}))}if(y==="tags"&&_){let Z=l.tags[_];return Z||[]}if(y==="folders"&&_){let Z=l.folders[_];return Z||[]}if(y==="files")return l.notes;if(y==="extensions"&&_){let Z=l.extensions[_];return Z||[]}if(y==="ignoreFiles")return Array.from(d.files).map(Z=>({id:Z.path,name:Z.basename}));if(!y){let Z=R(Object.entries(l.tags).map(([j,A])=>({id:`tag:${j}`,name:j.slice(1),type:"tag",originalId:j,count:A.length}))),$=R(Object.entries(l.folders).map(([j,A])=>({id:`folder:${j}`,name:j,type:"folder",originalId:j,count:A.length}))),q=l.notes.length>0?[{id:"files:all",name:"Files",type:"files",count:l.notes.length}]:[],Y=d.files.size>0?[{id:"ignoreFiles:all",name:"Ignore Files",type:"ignoreFiles",count:d.files.size}]:[];return[...Z,...$,...q,...Y]}return[]},[h,y,_,T,E,s,l.tags,l.folders,l.notes,l.extensions,d.files,R]),D=(0,Ve.useCallback)((Z,$)=>Object.entries(Z).sort(([q],[Y])=>q.localeCompare(Y)).map(([q,Y])=>({id:q,name:$?$(q):q,count:Y.length})),[]),F=(0,Ve.useCallback)((Z,$,q)=>{let Y=W=>s.filter(V=>ml(V,W,null,!0)).map(V=>({id:V.path,name:V.basename})),j=[...m.current.files],A=Y(q).map(W=>({...W,isIgnored:j.some(V=>V.path===W.id)}));c(W=>({...W,[Z]:{...W[Z],[$]:A}}))},[s]),B=(0,Ve.useCallback)((Z,$)=>{let q={tags:{...Z.tags},folders:{...Z.folders},extensions:{...Z.extensions},notes:[...Z.notes]},Y=j=>{Object.keys(j).forEach(A=>{j[A]=j[A].filter(W=>W.id!==$)})};return Y(q.tags),Y(q.folders),Y(q.extensions),q.notes=q.notes.filter(j=>j.id!==$),q},[]),U=(0,Ve.useCallback)((Z,$=null,q=!0)=>{b(Z),w($),q&&g("")},[]),H=(0,Ve.useMemo)(()=>{let Z=$=>(q,Y)=>{q.stopPropagation(),c(j=>{let A={...j[$]};return delete A[Y.id],{...j,[$]:A}})};return{delete:{tag:Z("tags"),folder:Z("folders"),extension:Z("extensions")},add:{tag:()=>{new $X(n,$=>{let q=cie($);F("tags",q,{tagPatterns:[q]})}).open()},folder:()=>{new jX(n,$=>{F("folders",$,{folderPatterns:[$]})}).open()},file:()=>{new zde({app:n,onFileSelect:$=>{l.notes.find(Y=>Y.id===$.path)||(f(Y=>{let j=new Set(Y.files);return j.delete($),{...Y,files:j}}),c(Y=>({...Y,notes:[...Y.notes,{id:$.path,name:$.basename}]})))},excludeFilePaths:[],titleOnly:!1}).open()},extension:()=>{new UX.Notice("Adding extension is temporarily not supported.")},ignoreFile:()=>{new zde({app:n,onFileSelect:$=>{d.files.has($)||(f(Y=>{let j=new Set(Y.files);return j.add($),{...Y,files:j}}),c(Y=>B(Y,$.path)))},excludeFilePaths:[],titleOnly:!1}).open()}},click:{tag:$=>{U("tags",$)},folder:$=>{U("folders",$)},extension:$=>{U("extensions",$)},files:()=>{U("files")},ignoreFiles:()=>{U("ignoreFiles")}}}},[n,l.notes,d.files,F,B,U]),G=(0,Ve.useCallback)(Z=>{Z.type==="tag"&&Z.originalId?H.click.tag(Z.originalId):Z.type==="folder"&&Z.originalId?H.click.folder(Z.originalId):Z.type==="files"?H.click.files():Z.type==="ignoreFiles"&&H.click.ignoreFiles()},[H]),ie=()=>h?`Search Results for: "${h}"`:y==="tags"&&_?`Tag: ${_}`:y==="folders"&&_?`Folder: ${_}`:y==="files"?"Files":y==="extensions"&&_?`Extension: ${_}`:y==="ignoreFiles"?"Ignore Files":"All Categories",oe=(Z,$)=>{Z.stopPropagation();let q=s.find(Y=>Y.path===$.id);q&&(f(Y=>{let j=new Set(Y.files);return j.add(q),{...Y,files:j}}),c(Y=>B(Y,$.id)))},z=(0,Ve.useCallback)(()=>{let Z=x(p.current,s),$=O(m.current),{inclusions:q,exclusions:Y}=id({inclusions:Z,exclusions:$,isProject:!0}),j=u(s,q,Y);c(j)},[s,O,x,u]),Q=(Z,$)=>{Z.stopPropagation();let q=s.find(Y=>Y.path===$.id);q&&(f(Y=>{let j=new Set(Y.files);return j.delete(q),{...Y,files:j}}),z())},re=()=>{let Z=x(l,s),$=O(d);e({...t,contextSource:{...t.contextSource,inclusions:Z,exclusions:$}})};return Ve.default.createElement("div",{className:"tw-flex tw-h-full tw-flex-col"},Ve.default.createElement(utn,{direction:"horizontal",className:"tw-flex-1"},Ve.default.createElement(bvt,{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(LZ,{className:"tw-max-h-[500px] tw-flex-1"},Ve.default.createElement("div",{className:"tw-space-y-6 tw-p-4"},Ve.default.createElement(ctn,{title:"Tags",IconComponent:eF,iconColorClassName:"tw-text-context-manager-orange",items:D(l.tags,Z=>Z.slice(1)),activeItem:_,activeSection:y,sectionType:"tags",renderIcon:Z=>Ve.default.createElement("span",{className:"tw-mr-2 tw-text-faint"},"#"),onItemClick:H.click.tag,onAddClick:H.add.tag,onDeleteItem:(Z,$)=>H.delete.tag(Z,$),tooltip:"must be in note property"}),Ve.default.createElement(a3,null),Ve.default.createElement(ctn,{title:"Folders",IconComponent:sh,iconColorClassName:"tw-text-context-manager-yellow",items:D(l.folders),activeItem:_,activeSection:y,sectionType:"folders",onItemClick:H.click.folder,onAddClick:H.add.folder,onDeleteItem:(Z,$)=>H.delete.folder(Z,$)}),Ve.default.createElement(a3,null),Ve.default.createElement("div",null,Ve.default.createElement(_vt,{IconComponent:ic,title:"Files",iconColorClassName:"tw-text-context-manager-blue",onAddClick:H.add.file}),Ve.default.createElement("div",{className:Oe("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",y==="files"&&"tw-bg-secondary tw-text-normal"),onClick:H.click.files},"Files (",l.notes.length,")")),Ve.default.createElement(a3,null),Ve.default.createElement("div",null,Ve.default.createElement(_vt,{IconComponent:pi,title:"Ignore Files",iconColorClassName:"tw-text-context-manager-red",onAddClick:H.add.ignoreFile}),Ve.default.createElement("div",{className:Oe("tw-cursor-pointer tw-rounded-md tw-p-2 tw-text-sm hover:tw-bg-secondary/50",y==="ignoreFiles"&&"tw-bg-secondary tw-text-normal"),onClick:H.click.ignoreFiles},"Files (",d.files.size,")")))))),Ve.default.createElement(ltn,{withHandle:!0}),Ve.default.createElement(bvt,{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(EZ,{placeholder:"Custom search: title, #tag1, .jpg",value:h,onChange:Z=>{g(Z),Z&&U("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"},ie())),Ve.default.createElement(LZ,{className:"tw-max-h-[400px] tw-flex-1 tw-p-4 tw-pt-0"},N.length===0?Ve.default.createElement("div",{className:"tw-mt-10 tw-text-center tw-text-muted"},y?"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"}},y||h?R(N).map(Z=>dtn(Z)?null:Ve.default.createElement(cpi,{key:Z.id,item:Z,viewMode:"list",onDelete:y==="ignoreFiles"||Z.isIgnored?Q:oe})).filter(Boolean):N.map(Z=>dtn(Z)?Ve.default.createElement(dpi,{key:Z.id,item:Z,onClick:G}):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(ve,{variant:"ghost",onClick:r},"Cancel"),Ve.default.createElement(ve,{onClick:re},"Save")))}var BX=class extends UX.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r,modalEl:n}=this;this.root=(0,ftn.createRoot)(r),n.style.minWidth="50vw";let o=a=>{this.onSave(a),this.close()},i=()=>{this.close()};this.root.render(Ve.default.createElement(fpi,{initialProject:this.initialProject,onSave:o,onCancel:i,app:this.app}))}onClose(){this.root&&this.root.unmount()}};Ro();var P3=L(X());jn();On();function ZLe({options:t,placeholder:e,containerClassName:r,className:n,...o}){return P3.default.createElement("div",{className:Oe("tw-group tw-relative tw-w-full",r)},P3.default.createElement("select",{className:Oe("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&&P3.default.createElement("option",{value:"",disabled:!0},e),t.map(i=>P3.default.createElement("option",{key:i.value,value:i.value},i.label))),P3.default.createElement("div",{className:Oe("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")},P3.default.createElement(Qs,{className:"tw-size-4"})))}var IU=L(X());jn();function Gde({value:t,onChange:e,min:r,max:n,step:o,disabled:i,className:a,suffix:s}){let[u,l]=(0,IU.useState)(t);return(0,IU.useEffect)(()=>{l(t)},[t]),IU.default.createElement("div",{className:Oe("tw-flex tw-items-center tw-gap-4",a)},IU.default.createElement(Ide,{value:[u],onValueChange:([c])=>l(c),onValueCommit:([c])=>e?.(c),min:r,max:n,step:o,disabled:i,className:"tw-flex-1"}),IU.default.createElement("div",{className:"tw-min-w-[40px] tw-text-right tw-text-sm"},u,s))}zr();vb();Pt();wr();var zX=require("obsidian"),dn=L(X()),ptn=L(wm());function ppi({initialProject:t,onSave:e,onCancel:r}){let n=So(),[o,i]=(0,dn.useState)(!1),[a,s]=(0,dn.useState)({name:!1,systemPrompt:!1,projectModelKey:!1,inclusions:!1}),[u,l]=(0,dn.useState)(t||{id:PAt(),name:"",description:"",systemPrompt:"",projectModelKey:"",modelConfigs:{temperature:ny.TEMPERATURE,maxTokens:ny.MAX_TOKENS},contextSource:{inclusions:"",exclusions:"",webUrls:"",youtubeUrls:""},created:Date.now(),UsageTimestamps:Date.now()}),c=P_(u.contextSource.inclusions||u.contextSource.exclusions||"nothing").reverse().join(","),d=h=>{let g=h;if(t?.id){let b=tc();b?.id===h.id&&(g=b)}new BX(app,async b=>{l(b)},g).open()},f=()=>u.name&&u.projectModelKey,p=(h,g)=>{l(y=>{if(typeof g=="string"&&h==="projectModelKey"&&(g=g.trim()),Array.isArray(g)&&g.every(b=>typeof b=="string")&&(g=g.map(b=>b.trim()).filter(Boolean)),h.includes(".")){let[b,_]=h.split("."),x=y[b];if(typeof x=="object"&&x!==null)return{...y,[b]:{...x,[_]:g}}}return{...y,[h]:g}})},m=async()=>{u.name&&(u.name=u.name.trim());let g=["name","projectModelKey"].filter(y=>!u[y]);if(g.length>0){s(y=>({...y,...Object.fromEntries(g.map(b=>[b,!0]))})),new zX.Notice("Please fill in all required fields");return}try{i(!0),await e(u)}catch(y){new zX.Notice(Eo(y)),s(b=>({...b,name:!0}))}finally{i(!1)}};return dn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-p-4"},dn.default.createElement("div",{className:"tw-mb-2 tw-text-xl tw-font-bold tw-text-normal"},t?"Edit Project":"New Project"),dn.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},dn.default.createElement(ai,{label:"Project Name",required:!0,error:a.name&&!u.name,errorMessage:"Project name is required"},dn.default.createElement(yi,{type:"text",value:u.name,onChange:h=>p("name",h.target.value),onBlur:()=>s(h=>({...h,name:!0})),className:"tw-w-full"})),dn.default.createElement(ai,{label:"Description",description:"Briefly describe the purpose and goals of the project"},dn.default.createElement(yi,{type:"text",value:u.description,onChange:h=>p("description",h.target.value),className:"tw-w-full"})),dn.default.createElement(ai,{label:"Project System Prompt",description:"Custom instructions for how the AI should behave in this project context"},dn.default.createElement(Cx,{value:u.systemPrompt,onChange:h=>p("systemPrompt",h.target.value),onBlur:()=>s(h=>({...h,systemPrompt:!0})),className:"tw-min-h-32"})),dn.default.createElement(ai,{label:"Default Model",required:!0,error:a.projectModelKey&&!u.projectModelKey,errorMessage:"Default model is required"},dn.default.createElement(ZLe,{value:u.projectModelKey,onChange:h=>{let g=h.target.value,y=n.activeModels.find(w=>w.enabled&&Qn(w)===g);if(!y)return;let{hasApiKey:b,errorNotice:_}=H6(y,n);if(!b&&_){new zX.Notice(_);return}p("projectModelKey",g)},onBlur:()=>s(h=>({...h,projectModelKey:!0})),placeholder:"Select a model",options:n.activeModels.filter(h=>h.enabled&&h.projectEnabled).map(h=>({label:oZ(h),value:Qn(h)}))})),dn.default.createElement("div",{className:"tw-space-y-4"},dn.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Model Configuration"),dn.default.createElement("div",{className:"tw-grid tw-grid-cols-1 tw-gap-4"},dn.default.createElement(ai,{label:"Temperature"},dn.default.createElement(Gde,{value:u.modelConfigs?.temperature??ny.TEMPERATURE,onChange:h=>p("modelConfigs.temperature",h),min:0,max:2,step:.01,className:"tw-w-full"})),dn.default.createElement(ai,{label:"Token Limit"},dn.default.createElement(Gde,{value:u.modelConfigs?.maxTokens??ny.MAX_TOKENS,onChange:h=>p("modelConfigs.maxTokens",h),min:1,max:65e3,step:1,className:"tw-w-full"})))),dn.default.createElement("div",{className:"tw-space-y-4"},dn.default.createElement("div",{className:"tw-text-base tw-font-medium"},"Context Sources"),dn.default.createElement(ai,{label:dn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},dn.default.createElement("span",null,"File Context"),dn.default.createElement(Ci,{buttonClassName:"tw-size-4 tw-text-muted",content:dn.default.createElement("div",{className:"tw-max-w-80"},dn.default.createElement("strong",null,"Supported File Types:"),dn.default.createElement("br",null),dn.default.createElement("strong",null,"\u2022 Documents:")," pdf, doc, docx, ppt, pptx, epub, txt, rtf and many more",dn.default.createElement("br",null),dn.default.createElement("strong",null,"\u2022 Images:")," jpg, png, svg, gif, bmp, webp, tiff",dn.default.createElement("br",null),dn.default.createElement("strong",null,"\u2022 Spreadsheets:")," xlsx, xls, csv, numbers",dn.default.createElement("br",null),dn.default.createElement("br",null),"Non-markdown files are converted to markdown in the background.",dn.default.createElement("br",null),dn.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."},dn.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},dn.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-row"},dn.default.createElement(pm,{className:"tw-max-w-[100px] tw-text-sm tw-text-accent"},c)),dn.default.createElement(ve,{variant:"secondary",onClick:()=>{d(u)}},"Manage Context"))),dn.default.createElement(ai,{label:"Web URLs"},dn.default.createElement(Cx,{value:u.contextSource?.webUrls,onChange:h=>{let y=h.target.value.split(`
|
||
`).map(b=>{if(!b.trim())return b;try{return new URL(b.trim()),b}catch{return b}});p("contextSource.webUrls",y.join(`
|
||
`))},placeholder:"Enter web URLs, one per line",className:"tw-min-h-20 tw-w-full"})),dn.default.createElement(ai,{label:"YouTube URLs"},dn.default.createElement(Cx,{value:u.contextSource?.youtubeUrls,onChange:h=>{let y=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",y.join(`
|
||
`))},placeholder:"Enter YouTube URLs, one per line",className:"tw-min-h-20 tw-w-full"})))),dn.default.createElement("div",{className:"tw-mt-4 tw-flex tw-items-center tw-justify-end tw-gap-2"},dn.default.createElement(ve,{variant:"ghost",onClick:r,disabled:o},"Cancel"),dn.default.createElement(ve,{onClick:m,disabled:o||!f()},o?"Saving...":"Save")))}var Zde=class extends zX.Modal{constructor(r,n,o){super(r);this.onSave=n;this.initialProject=o}onOpen(){let{contentEl:r}=this;this.root=(0,ptn.createRoot)(r);let n=async i=>{await this.onSave(i),this.close()},o=()=>{this.close()};this.root.render(dn.default.createElement(ppi,{initialProject:this.initialProject,onSave:n,onCancel:o}))}onClose(){this.root.unmount()}};Ro();jn();Dt();Pt();On();var htn=require("obsidian"),Ge=L(X());function mpi(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 mtn(t,e,r={}){return!t||t.length===0?[]:e.trim()?t.filter(n=>mpi(n,e,r)):t}function hpi({project:t,loadContext:e,onEdit:r,onDelete:n}){return Ge.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)},Ge.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2 tw-overflow-hidden"},Ge.default.createElement("div",{className:"tw-text-accent"},Ge.default.createElement(sh,{className:"tw-size-4"})),Ge.default.createElement("div",{className:"tw-flex tw-flex-1 tw-flex-col tw-gap-1.5 tw-overflow-hidden"},Ge.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[13px] tw-font-medium tw-text-normal"},t.name),t.description&&Ge.default.createElement("span",{className:"tw-w-full tw-truncate tw-text-[12px] tw-text-muted/80"},t.description))),Ge.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-1 tw-opacity-100 tw-transition-opacity tw-duration-200"},Ge.default.createElement(Kn,null,Ge.default.createElement(Wn,{asChild:!0},Ge.default.createElement(ve,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),r(t)}},Ge.default.createElement(lb,{className:"tw-size-4"}))),Ge.default.createElement(Mn,{side:"bottom"},"Edit Project")),Ge.default.createElement(Kn,null,Ge.default.createElement(Wn,{asChild:!0},Ge.default.createElement(ve,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),e(t)}},Ge.default.createElement(FK,{className:"tw-size-4"}))),Ge.default.createElement(Mn,{side:"bottom"},"Start Chat")),Ge.default.createElement(Kn,null,Ge.default.createElement(Wn,{asChild:!0},Ge.default.createElement(ve,{variant:"ghost2",size:"icon",onClick:o=>{o.stopPropagation(),new lm(app,()=>n(t),`Are you sure you want to delete project "${t.name}"?`,"Delete Project").open()}},Ge.default.createElement(cy,{className:"tw-size-4"}))),Ge.default.createElement(Mn,{side:"bottom"},"Delete Project"))))}var vvt=(0,Ge.memo)(({className:t,projects:e,defaultOpen:r=!1,app:n,onProjectAdded:o,onEditProject:i,hasMessages:a=!1,showChatUI:s,onClose:u,onProjectClose:l})=>{let[c,d]=(0,Ge.useState)(r),[f,p]=(0,Ge.useState)(!1),[m,h]=(0,Ge.useState)(null),[g,y]=(0,Ge.useState)(""),b=wU();(0,Ge.useEffect)(()=>{a&&d(!1)},[a]);let _=(0,Ge.useMemo)(()=>mtn(e,g),[e,g]),w=()=>{new Zde(n,async N=>{o(N)}).open()},x=R=>{new Zde(n,async D=>{i(R,D),m&&m.name===R.name&&h(D)},R).open()},O=R=>{let D=(e||[]).filter(F=>F.name!==R.name);m?.name===R.name&&E(!1),et("projectList",D),new htn.Notice(`Project "${R.name}" deleted successfully`)},E=(R,N)=>{if(R){if(!N){ue("Must be exist one project.");return}h(N),p(!0),d(!1)}else{h(null),p(!1),d(!0),s(!1),Vz(null);return}},T=R=>{h(R),p(!0),d(!1),s(!0),Vz(R),setTimeout(()=>{b.focusInput()},0)};return Ge.default.createElement("div",{className:Oe("tw-flex tw-flex-col",t)},Ge.default.createElement("div",{className:"tw-overflow-y-auto"},Ge.default.createElement("div",{className:"tw-flex tw-flex-col"},f&&m?Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-py-3"},Ge.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},Ge.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Ge.default.createElement(PU,{value:m.name,onValueChange:R=>{let N=e.find(D=>D.name===R);N&&T(N)}},Ge.default.createElement(A$,{className:"tw-truncate"},Ge.default.createElement(MU,null,Ge.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},Ge.default.createElement(sh,{className:"tw-size-4 tw-shrink-0 tw-text-accent/70"}),Ge.default.createElement("span",{className:"tw-flex-1 tw-truncate"},m.name)))),Ge.default.createElement(I$,{className:"tw-truncate"},e.map(R=>Ge.default.createElement(N$,{key:R.name,value:R.name,className:"tw-flex tw-items-center tw-gap-2"},Ge.default.createElement("div",{className:"tw-flex tw-min-w-0 tw-items-center tw-gap-2"},Ge.default.createElement(sh,{className:"tw-size-4 tw-shrink-0"}),Ge.default.createElement("span",{className:"tw-truncate"},R.name))))))),Ge.default.createElement("div",{className:"tw-ml-1 tw-flex tw-items-center tw-gap-2"},Ge.default.createElement(ve,{variant:"secondary",onClick:()=>x(m),className:"hover:tw-text-on-accent hover:tw-bg-accent/50"},Ge.default.createElement(lb,{className:"tw-mr-1 tw-size-4"}),"Edit"),Ge.default.createElement(Kn,null,Ge.default.createElement(Wn,{asChild:!0},Ge.default.createElement(ve,{variant:"ghost2",size:"icon",onClick:()=>{E(!1),l()},"aria-label":"Close Current Project"},Ge.default.createElement(pi,{className:"tw-size-4"}))),Ge.default.createElement(Mn,{side:"bottom"},"Close Current Project")))):Ge.default.createElement(Zx,{open:c,onOpenChange:d,className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-4 tw-py-3"},Ge.default.createElement("div",{className:"tw-flex tw-flex-1 tw-items-center tw-gap-2"},Ge.default.createElement("span",{className:"tw-font-semibold tw-text-normal"},"Projects"),Ge.default.createElement(Ci,{content:"Manage your projects with different contexts and configurations.",contentClassName:"tw-w-64",buttonClassName:"tw-size-4 tw-text-muted"})),Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ge.default.createElement(ve,{className:"tw-px-2",variant:"secondary",onClick:w},"Create",Ge.default.createElement(dC,{className:"tw-size-3"})),e.length>0&&Ge.default.createElement(D$,{asChild:!0},Ge.default.createElement(ve,{variant:"ghost2",size:"icon"},c?Ge.default.createElement(sC,{className:"tw-size-5"}):Ge.default.createElement(Qs,{className:"tw-size-5"}))),Ge.default.createElement(Kn,null,Ge.default.createElement(Wn,{asChild:!0},Ge.default.createElement(ve,{variant:"ghost2",size:"icon",onClick:()=>u(),"aria-label":"close project mode"},Ge.default.createElement(pi,{className:"tw-size-4"}))),Ge.default.createElement(Mn,{side:"bottom"},"Close Project Mode")))),e.length===0&&Ge.default.createElement("div",{className:"tw-px-4 tw-py-2 tw-text-xs tw-text-muted tw-bg-secondary/30"},"No projects available"),Ge.default.createElement(Xx,{className:"tw-transition-all tw-duration-200 tw-ease-in-out"},Ge.default.createElement("div",{className:"tw-relative tw-bg-secondary/30"},e.length>0&&Ge.default.createElement("div",{className:"tw-px-4 tw-pb-2 tw-pt-3"},Ge.default.createElement("div",{className:"tw-relative"},Ge.default.createElement(EZ,{value:g,onChange:y,placeholder:"Search projects..."}))),Ge.default.createElement("div",{className:"tw-max-h-[calc(3*5.7rem)] tw-overflow-y-auto tw-px-4 tw-pb-6 tw-pt-3"},Ge.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 @2xl:tw-grid @2xl:tw-grid-cols-2 @4xl:tw-grid-cols-3"},_.map(R=>Ge.default.createElement(hpi,{key:R.name,project:R,loadContext:T,onEdit:x,onDelete:O}))),g.trim()&&_.length===0&&Ge.default.createElement("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-8 tw-text-muted"},Ge.default.createElement(c4,{className:"tw-mb-3 tw-size-12 tw-text-muted/50"}),Ge.default.createElement("p",{className:"tw-text-base tw-font-medium"},"No matching projects found"),Ge.default.createElement("p",{className:"tw-mt-1 tw-text-sm"},"Try searching with different keywords"))),e.length>0&&Ge.default.createElement("div",{className:"tw-pointer-events-none tw-absolute tw-inset-x-0 tw-bottom-0 tw-h-8 tw-bg-[linear-gradient(to_top,var(--background-primary)_0%,var(--background-primary)_30%,transparent_100%)]"}))))),!f&&Ge.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"},Ge.default.createElement("div",{className:"tw-max-w-[600px] tw-space-y-4"},Ge.default.createElement("p",{className:"tw-text-center tw-text-base"},"Create your project-based AI assistants with custom instructions, context, and model configurations."),Ge.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-3 tw-text-sm"},Ge.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Ge.default.createElement(FK,{className:"tw-size-4"}),Ge.default.createElement("span",null,"Click a project card to start chatting")))))))});vvt.displayName="ProjectList";var mn=L(X()),Evt=L(X());var Xde=L(X());var Svt=L(X(),1);var F$=L(X(),1),gtn=L(mt(),1);function ytn(t,e=[]){let r=[];function n(i,a){let s=F$.createContext(a),u=r.length;r=[...r,a];let l=d=>{let{scope:f,children:p,...m}=d,h=f?.[t]?.[u]||s,g=F$.useMemo(()=>m,Object.values(m));return(0,gtn.jsx)(h.Provider,{value:g,children:p})};l.displayName=i+"Provider";function c(d,f){let p=f?.[t]?.[u]||s,m=F$.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=>F$.createContext(a));return function(s){let u=s?.[t]||i;return F$.useMemo(()=>({[`__scope${t}`]:{...s,[t]:u}}),[s,u])}};return o.scopeName=t,[n,gpi(o,...e)]}function gpi(...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 F$.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return r.scopeName=e.scopeName,r}var btn=L(X(),1),ypi=L(Bu(),1);ah();var _tn=L(mt(),1),bpi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wvt=bpi.reduce((t,e)=>{let r=Ji(`Primitive.${e}`),n=btn.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 XLe=L(mt(),1),Cvt="Progress",xvt=100,[_pi,dFs]=ytn(Cvt),[vpi,wpi]=_pi(Cvt),Stn=Svt.forwardRef((t,e)=>{let{__scopeProgress:r,value:n=null,max:o,getValueLabel:i=Spi,...a}=t;(o||o===0)&&!vtn(o)&&console.error(Cpi(`${o}`,"Progress"));let s=vtn(o)?o:xvt;n!==null&&!wtn(n,s)&&console.error(xpi(`${n}`,"Progress"));let u=wtn(n,s)?n:null,l=YLe(u)?i(u,s):void 0;return(0,XLe.jsx)(vpi,{scope:r,value:u,max:s,children:(0,XLe.jsx)(wvt.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":YLe(u)?u:void 0,"aria-valuetext":l,role:"progressbar","data-state":Otn(u,s),"data-value":u??void 0,"data-max":s,...a,ref:e})})});Stn.displayName=Cvt;var Ctn="ProgressIndicator",xtn=Svt.forwardRef((t,e)=>{let{__scopeProgress:r,...n}=t,o=wpi(Ctn,r);return(0,XLe.jsx)(wvt.div,{"data-state":Otn(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...n,ref:e})});xtn.displayName=Ctn;function Spi(t,e){return`${Math.round(t/e*100)}%`}function Otn(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function YLe(t){return typeof t=="number"}function vtn(t){return YLe(t)&&!isNaN(t)&&t>0}function wtn(t,e){return YLe(t)&&!isNaN(t)&&t<=e&&t>=0}function Cpi(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${xvt}\`.`}function xpi(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 ${xvt} if no \`max\` prop is set)
|
||
- \`null\` or \`undefined\` if the progress is indeterminate.
|
||
|
||
Defaulting to \`null\`.`}var Ovt=Stn,Ttn=xtn;jn();var Tvt=Xde.forwardRef(({className:t,value:e,...r},n)=>Xde.createElement(Ovt,{ref:n,className:Oe("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},Xde.createElement(Ttn,{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)}%)`}})));Tvt.displayName=Ovt.displayName;On();Tu();Ro();Dt();function Pvt({plugin:t,setHiddenCard:e,onEditContext:r}){let[n]=nge(),o=n.total,i=n.success,a=n.failed,s=n.processingFiles,[u,l]=(0,Evt.useState)(!1),[c,d]=(0,Evt.useState)(!1),f=i.length+a.length,p=o.length>0?Math.round(f/o.length*100):0,m=g=>g.path,h=async g=>{if(!t?.projectManager){ue("ProjectManager not available");return}try{await t.projectManager.retryFailedItem(g)}catch(y){ue(`Error retrying failed item: ${y}`)}};return mn.createElement(S3,{className:"tw-w-full tw-border tw-border-solid tw-border-border tw-bg-transparent tw-shadow-none"},mn.createElement(C3,null,mn.createElement(Ude,{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},mn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},mn.createElement(ic,{className:"tw-size-5"}),"Context Loading",mn.createElement(ve,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Edit Context",onClick:()=>r?.()},mn.createElement(tg,{className:"tw-size-4"}),mn.createElement("span",{className:"tw-sr-only"},"Edit Context"))),mn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2 tw-rounded tw-p-1"},mn.createElement(ve,{size:"sm",variant:"ghost2",className:"tw-size-6 tw-p-0 tw-text-muted",title:"Close Progress Bar",onClick:()=>e(!0)},mn.createElement(pi,{className:"tw-size-4"}))))),mn.createElement(x3,{className:"tw-space-y-6"},mn.createElement("div",{className:"tw-space-y-2"},mn.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-text-sm"},mn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},mn.createElement("span",{className:"tw-text-muted"},"Total progress"),mn.createElement("span",{className:"tw-text-xs tw-text-muted"},"(Success:"," ",mn.createElement("span",{className:"tw-font-medium tw-text-success"},i.length),", Failed: ",mn.createElement("span",{className:"tw-font-medium tw-text-error"},a.length),")")),mn.createElement("span",{className:"tw-font-medium"},f,"/",o.length," (",p,"%)")),mn.createElement(Tvt,{value:p,className:"tw-h-2"})),s.length>0&&mn.createElement("div",{className:"tw-space-y-3"},mn.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)},mn.createElement(Zc,{className:"tw-size-4 tw-animate-spin tw-text-accent"}),mn.createElement("span",{className:"tw-text-sm tw-font-medium"},"Processing"),u?mn.createElement(Qs,{className:"tw-ml-auto tw-size-4"}):mn.createElement(tg,{className:"tw-ml-auto tw-size-4"})),u&&mn.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},s.map((g,y)=>mn.createElement("div",{key:y,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},mn.createElement("div",{className:"tw-size-2 tw-animate-pulse tw-rounded-full tw-bg-interactive-accent"}),mn.createElement(pm,{className:"tw-flex-1",title:g},g))))),a.length>0&&mn.createElement("div",{className:"tw-space-y-3"},mn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},mn.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)},mn.createElement(FO,{className:"tw-size-4 tw-text-error"}),mn.createElement("span",{className:"tw-text-sm tw-font-medium"},"Failed"),mn.createElement(qb,{variant:"destructive",className:"tw-text-xs"},a.length," files"),c?mn.createElement(Qs,{className:"tw-ml-auto tw-size-4"}):mn.createElement(tg,{className:"tw-ml-auto tw-size-4"}))),c&&mn.createElement("div",{className:"tw-max-h-32 tw-space-y-2 tw-overflow-y-auto"},a.map((g,y)=>mn.createElement("div",{key:y,className:"tw-flex tw-items-center tw-gap-2 tw-rounded-md tw-p-2 tw-text-sm tw-bg-faint/10"},mn.createElement("div",{className:"tw-flex tw-min-w-0 tw-flex-1 tw-flex-col tw-gap-1"},mn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},mn.createElement("div",{className:"tw-size-2 tw-rounded-full tw-bg-error/80"}),mn.createElement(pm,{className:"tw-flex-1 tw-font-bold",title:g.path},m(g))),mn.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},mn.createElement("div",{className:"tw-size-2 tw-rounded-full"}),g.error&&mn.createElement(pm,{className:"tw-flex-1 tw-text-xs tw-text-error/80",title:g.error},mn.createElement("span",{className:"tw-text-sm tw-text-error"},"Loading Error: "),g.error))),mn.createElement(ve,{size:"sm",variant:"ghost",className:"tw-size-5 tw-p-0",title:`Retry ${g.type} item`,onClick:async b=>{b.stopPropagation(),await h(g)}},mn.createElement(Rte,{className:"tw-size-3"}))))))))}zr();var qy=L(X());function Etn(t){let[e,r]=(0,qy.useState)([]);(0,qy.useEffect)(()=>(r([...t.getMessages()]),t.subscribe(()=>{r([...t.getMessages()])})),[t]);let n=(0,qy.useCallback)(async(m,h,g,y=!1)=>await t.sendMessage(m,h,g,y),[t]),o=(0,qy.useCallback)(async(m,h,g,y=!1)=>await t.editMessage(m,h,g,y),[t]),i=(0,qy.useCallback)(async(m,h,g)=>await t.regenerateMessage(m,h,g),[t]),a=(0,qy.useCallback)(async m=>await t.deleteMessage(m),[t]),s=(0,qy.useCallback)(()=>{t.clearMessages()},[t]),u=(0,qy.useCallback)(async m=>{await t.truncateAfterMessageId(m)},[t]),l=(0,qy.useCallback)(m=>{t.addMessage(m)},[t]),c=(0,qy.useCallback)(m=>{t.loadMessages(m)},[t]),d=(0,qy.useCallback)(m=>t.getMessage(m),[t]),f=(0,qy.useCallback)(()=>t.getLLMMessages(),[t]),p=(0,qy.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}}zr();wr();Dt();J3();NOe();var Mvt=async(t,e,r,n,o,i={})=>{let a=new AbortController;o(a);try{await e.runChain(t,a,n,r,i)}catch(s){ue("Model request failed:",s);let u=rG("Model request failed: "+Eo(s));r({id:H0(),sender:TO,isErrorMessage:!0,message:u,isVisible:!0,timestamp:Zh(new Date)})}};W7();$v();Pt();wr();COe();var vl=require("obsidian");var br=L(X()),Tpi=({chainManager:t,onSaveChat:e,updateUserMessageHistory:r,fileParserManager:n,plugin:o,chatUIState:i,chatInput:a})=>{let s=So(),u=(0,br.useContext)(IX),{messages:l,addMessage:c}=Etn(i),[d]=xL(),[f]=Ev(),[p,m]=(0,br.useState)(""),[h,g]=(0,br.useState)(""),[y,b]=(0,br.useState)(null),_=(0,br.useRef)(null),w=(0,br.useCallback)(He=>{c(He),He.sender===TO&&He.responseMetadata?.tokenUsage?.totalTokens&&b(He.responseMetadata.tokenUsage.totalTokens)},[c]),x=(0,br.useCallback)(He=>{_.current=He},[]),[O,E]=(0,br.useState)(!1),[T,R]=(0,br.useState)(EO.DEFAULT),[N,D]=(0,br.useState)([]),[F,B]=(0,br.useState)(!1),[U,H]=(0,br.useState)([]),[G,ie]=(0,br.useState)(!1),[oe,z]=(0,br.useState)([]),[Q,re]=(0,br.useState)(null),Z=(0,br.useRef)(!1),$=(0,br.useMemo)(()=>({setCurrentAiMessage:He=>Z.current&&m(He),setLoadingMessage:He=>Z.current&&R(He),setLoading:He=>Z.current&&E(He)}),[]),[q]=cIt(),Y=xje(),j=()=>V!=="project"?!1:Q!==null?Q:Y==="loading"||Y==="error";(0,br.useEffect)(()=>{re(null)},[Y]),(0,br.useEffect)(()=>{l.length===0&&b(null)},[l]);let[A,W]=(0,br.useState)(null),[V,se]=Ev(),be=Y8(),Ee=(0,br.useContext)(LLe),Ae=o.app||Ee,ht=async({toolCalls:He,urls:wt,contextNotes:_r,contextTags:Sl,contextFolders:Vo}={})=>{if(!h&&U.length===0)return;wt&&wt.length>0&&!s_(f)&&new vl.Notice(G6.URL_PROCESSING_RESTRICTED);try{let Wa=[];h&&Wa.push({type:"text",text:h});for(let pr of U){let Or=await pr.arrayBuffer(),js=Rk(Or);Wa.push({type:"image_url",image_url:{url:`data:${pr.type};base64,${js}`}})}let ui=[..._r||[],...N].filter((pr,Or,js)=>js.findIndex(el=>el.path===pr.path)===Or),mv=h;He&&(mv+=" "+He.join(`
|
||
`));let q0={notes:ui,urls:s_(f)?wt||[]:[],tags:Sl||[],folders:Vo||[],selectedTextContexts:q};g(""),H([]),$.setLoading(!0),$.setLoadingMessage(EO.DEFAULT);let Xt=await i.sendMessage(mv,q0,f,F,Wa.length>0?Wa:void 0);h&&r(h),s.autosaveChat&&Rt();let ct=i.getLLMMessage(Xt);ct&&await Mvt(ct,t,w,$.setCurrentAiMessage,x,{debug:s.debug,updateLoadingMessage:$.setLoadingMessage}),s.autosaveChat&&Rt()}catch(Wa){ue("Error sending message:",Wa),new vl.Notice("Failed to send message. Please try again.")}finally{$.setLoading(!1),$.setLoadingMessage(EO.DEFAULT)}},Rt=(0,br.useCallback)(async()=>{if(!Ae){ue("App instance is not available.");return}try{await i.saveChat(d)}catch(He){ue("Error saving chat as note:",Eo(He)),new vl.Notice("Failed to save chat as note. Check console for details.")}},[Ae,i,d]),Ze=(0,br.useCallback)(He=>{_.current&&(J(`stopping generation..., reason: ${He}`),_.current.abort(He),$.setLoading(!1),$.setLoadingMessage(EO.DEFAULT))},[$]);(0,br.useEffect)(()=>(Z.current=!0,()=>{Z.current=!1,_.current&&_.current.abort("component-unmount")}),[]);let Dr=(0,br.useCallback)(async He=>{if(He<=0){new vl.Notice("Cannot regenerate the first message.");return}let wt=l[He];if(!wt){new vl.Notice("Message not found.");return}$.setCurrentAiMessage(""),$.setLoading(!0);try{await i.regenerateMessage(wt.id,$.setCurrentAiMessage,w)?s.debug&&console.log("Message regenerated successfully"):new vl.Notice("Failed to regenerate message. Please try again."),s.autosaveChat&&Rt()}catch(_r){ue("Error regenerating message:",_r),new vl.Notice("Failed to regenerate message. Please try again.")}finally{$.setLoading(!1)}},[l,i,s.debug,s.autosaveChat,Rt,w,$]),Vt=(0,br.useCallback)(async(He,wt)=>{let _r=l[He];if(!(!_r||_r.message===wt))try{if(!await i.editMessage(_r.id,wt,f,F)){new vl.Notice("Failed to edit message. Please try again.");return}if(_r.sender===Xs){let Vo=He<l.length-1;if(await i.truncateAfterMessageId(_r.id),Vo){$.setLoading(!0);try{let Su=i.getLLMMessage(_r.id);Su&&await Mvt(Su,t,w,$.setCurrentAiMessage,x,{debug:s.debug,updateLoadingMessage:$.setLoadingMessage})}catch(Su){ue("Error regenerating AI response:",Su),new vl.Notice("Failed to regenerate AI response. Please try again.")}finally{$.setLoading(!1)}}}s.autosaveChat&&Rt()}catch(Sl){ue("Error editing message:",Sl),new vl.Notice("Failed to edit message. Please try again.")}},[l,i,f,F,w,t,s.debug,s.autosaveChat,Rt,$,x]);(0,br.useEffect)(()=>{e&&e(Rt)},[e,Rt]);let jt=(0,br.useCallback)(He=>{let wt=s.projectList||[];if(wt.findIndex(Su=>Su.name===He.name)>=0)throw new Error(`Project "${He.name}" already exists, please use a different name`);let Sl=[...wt,He];return et("projectList",Sl),tc()?.id===He.id?RDe().then(()=>{new vl.Notice(`${He.name} added and context loaded`)}).catch(Su=>{ue("Error loading project context:",Su),new vl.Notice(`${He.name} added but context loading failed`)}):new vl.Notice(`${He.name} added successfully`),!0},[s.projectList]),Fe=(0,br.useCallback)((He,wt)=>{let _r=s.projectList||[];if(!_r.find(Wa=>Wa.name===He.name))throw new Error(`Project "${He.name}" does not exist`);let Vo=_r.map(Wa=>Wa.name===He.name?wt:Wa);return et("projectList",Vo),tc()?.id===He.id?(Vz(wt),RDe().then(()=>{new vl.Notice(`${He.name} updated and context reloaded`)}).catch(Wa=>{ue("Error reloading project context:",Wa),new vl.Notice(`${He.name} updated but context reload failed`)})):new vl.Notice(`${He.name} updated successfully`),!0},[s.projectList]),hn=(0,br.useCallback)(He=>{uIt(He)},[]);(0,br.useEffect)(()=>{let He=()=>{a.focusInput()};return u?.addEventListener(Yw.CHAT_IS_VISIBLE,He),()=>{u?.removeEventListener(Yw.CHAT_IS_VISIBLE,He)}},[u,a]);let gt=(0,br.useCallback)(async He=>{let wt=l[He];if(!wt){new vl.Notice("Message not found.");return}try{await i.deleteMessage(wt.id)||new vl.Notice("Failed to delete message. Please try again.")}catch(_r){ue("Error deleting message:",_r),new vl.Notice("Failed to delete message. Please try again.")}},[l,i]),qe=(0,br.useCallback)(async()=>{if(K7(),Ze("new-chat"),s.enableRecentConversations)try{let He=t.chatModelManager.getChatModel();o.userMemoryManager.addRecentConversation(i.getMessages(),He)}catch(He){J("Failed to analyze chat messages for memory:",He)}s.autosaveChat&&await Rt(),i.clearMessages(),$.setCurrentAiMessage(""),D([]),b(null),lIt(),V==="project"?B(!1):B(s.includeActiveNoteAsContext)},[Ze,t.chatModelManager,i,s.autosaveChat,s.enableRecentConversations,s.includeActiveNoteAsContext,V,Rt,$,o.userMemoryManager]),Te=(0,br.useCallback)(async()=>{try{let He=await o.getChatHistoryItems();z(He)}catch(He){ue("Error loading chat history:",He),new vl.Notice("Failed to load chat history.")}},[o]),Ce=(0,br.useCallback)(async(He,wt)=>{try{await o.updateChatTitle(He,wt),await Te()}catch(_r){throw ue("Error updating chat title:",_r),new vl.Notice("Failed to update chat title."),_r}},[o,Te]),De=(0,br.useCallback)(async He=>{try{await o.deleteChatHistory(He),await Te()}catch(wt){throw ue("Error deleting chat:",wt),new vl.Notice("Failed to delete chat."),wt}},[o,Te]),Re=(0,br.useCallback)(async He=>{try{await o.loadChatById(He)}catch(wt){ue("Error loading chat:",wt),new vl.Notice("Failed to load chat.")}},[o]),nt=(0,br.useCallback)(async He=>{try{await o.openChatSourceFile(He)}catch(wt){ue("Error opening source file:",wt),new vl.Notice("Failed to open source file.")}},[o]);(0,br.useEffect)(()=>{let He=wt=>{let _r=wt.detail?.reason||"new-chat";Ze(_r)};return u?.addEventListener(Yw.ABORT_STREAM,He),()=>{u?.removeEventListener(Yw.ABORT_STREAM,He)}},[u,Ze]),(0,br.useEffect)(()=>{s.includeActiveNoteAsContext!==void 0&&(V==="project"?B(!1):B(s.includeActiveNoteAsContext))},[s.includeActiveNoteAsContext,V]);let _n=()=>br.default.createElement(br.default.Fragment,null,br.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},br.default.createElement(Ien,{currentVersion:o.manifest.version}),br.default.createElement(Aen,{chatHistory:l,currentAiMessage:p,loading:O,loadingMessage:T,app:Ae,onRegenerate:Dr,onEdit:Vt,onDelete:gt,onReplaceChat:g,showHelperComponents:V!=="project"}),j()?br.default.createElement("div",{className:"tw-inset-0 tw-z-modal tw-flex tw-items-center tw-justify-center tw-rounded-xl"},br.default.createElement(Pvt,{plugin:o,setHiddenCard:()=>{re(!1)},onEditContext:()=>{let He=tc();He&&new BX(Ae,wt=>{Fe(He,wt)},He).open()}})):br.default.createElement(br.default.Fragment,null,br.default.createElement(G5r,{onNewChat:qe,onSaveAsNote:()=>Rt(),onLoadHistory:Te,onModeChange:He=>{W(V),He==="project"&&ie(!1)},chatHistory:oe,onUpdateChatTitle:Ce,onDeleteChat:De,onLoadChat:Re,onOpenSourceFile:nt,latestTokenCount:y}),br.default.createElement(dLe,{inputMessage:h,setInputMessage:g,handleSendMessage:ht,isGenerating:O,onStopGenerating:()=>Ze("user-stopped"),app:Ae,contextNotes:N,setContextNotes:D,includeActiveNote:F,setIncludeActiveNote:B,selectedImages:U,onAddImage:He=>H(wt=>[...wt,...He]),setSelectedImages:H,disableModelSwitch:V==="project",selectedTextContexts:q,onRemoveSelectedText:hn,showProgressCard:()=>{re(!0)}}))));return br.default.createElement("div",{className:"tw-flex tw-size-full tw-flex-col tw-overflow-hidden"},br.default.createElement("div",{className:"tw-h-full"},br.default.createElement("div",{className:"tw-relative tw-flex tw-h-full tw-flex-col"},V==="project"&&br.default.createElement("div",{className:`${V==="project"?"tw-z-modal":""}`},br.default.createElement(vvt,{projects:s.projectList||[],defaultOpen:!0,app:Ae,hasMessages:!1,onProjectAdded:jt,onEditProject:Fe,onClose:()=>{A?(se(A),W(null)):se(be?"copilot_plus":"llm_chain")},showChatUI:He=>ie(He),onProjectClose:()=>{re(null)}})),(V!=="project"||V==="project"&&G)&&_n())))},Epi=t=>br.default.createElement(kXr,null,br.default.createElement(Ppi,{...t})),Ppi=t=>{let e=wU();return br.default.createElement(Tpi,{...t,chatInput:e})},Ptn=Epi;zr();var Mtn=require("obsidian"),Yde=L(X()),Rtn=L(wm()),NU=class extends Mtn.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 Tc}getIcon(){return"message-square"}getTitle(){return"Copilot Chat"}getDisplayText(){return"Copilot"}async onOpen(){this.root=(0,Rtn.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(Yde.createElement(LLe.Provider,{value:this.app},Yde.createElement(IX.Provider,{value:this.eventTarget},Yde.createElement(pDe,{delayDuration:0},Yde.createElement(Ptn,{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)}};Ydt();wr();function Rvt(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 Avt(t){let e=app.metadataCache.getFileCache(t)?.frontmatter;return e&&e.epoch?new Date(e.epoch):new Date(t.stat.ctime)}function Atn(t){let e=Rvt(t),r=Avt(t),n=Zh(r);return`${e} - ${n.display}`}var Itn=require("obsidian"),QLe=class extends Itn.FuzzySuggestModal{constructor(r,n,o){super(r);this.chatFiles=n;this.onChooseFile=o}getItems(){return this.chatFiles.sort((r,n)=>{let o=s=>{let u=this.app.metadataCache.getFileCache(s)?.frontmatter;return u&&u.epoch?u.epoch:s.stat.ctime},i=o(r);return o(n)-i})}getItemText(r){return Atn(r)}onChooseItem(r,n){this.onChooseFile(r)}};zr();function Ntn(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=K_().filter(i=>i.showInContextMenu);o.length>0&&r.addSeparator(),dce(o).forEach(i=>{r.addItem(a=>{a.setTitle(i.title).onClick(()=>{app.commands.executeCommandById(`copilot:${sZ(i.title)}`)})})})})}var jtn=L(xOe());Dt();var eFe=class{constructor(e,r){this.handleFileModify=(0,jtn.default)(async e=>{if(!lZ(e)||uce(e.path))return;let r=await cce(e);this.registerCommand(r),TJ(r,r.title)},1e3,{leading:!1,trailing:!0});this.handleFileCreation=async e=>{if(!(!lZ(e)||uce(e.path)))try{let r=await cce(e);if(!SHr(e)){let n=_je();r={...r,order:n}}await vmt(e,r),TJ(r,r.title),this.registerCommand(r)}catch(r){ue(`Error processing custom command creation: ${e.path}`,r)}};this.handleFileDeletion=async e=>{if(!lZ(e)||uce(e.path))return;let r=sZ(e.basename);this.plugin.removeCommand(r),lce(e.basename)};this.handleFileRename=async(e,r)=>{if(uce(e.path))return;let n=r.split("/").pop()?.replace(/\.md$/,"");if(n){let o=sZ(n);this.plugin.removeCommand(o),lce(n)}if(lZ(e)){let o=await cce(e);this.registerCommand(o),TJ(o,o.title),await vmt(e,o)}};this.plugin=e,this.vault=r,this.initializeEventListeners()}async initialize(){await yje(),this.registerCommands()}async registerCommands(){K_().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=sZ(e.title);this.plugin.removeCommand(r),this.plugin.addCommand({id:r,name:e.title,editorCallback:n=>{new IB(this.plugin.app,{selectedText:n.getSelection(),command:e}).open(),jg.getInstance().recordUsage(e)}})}};Pt();wr();async function Mpi(t){let r=`${RB()}/unsupported`;return await ty(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[XD]=n.showInContextMenu,a[YD]=n.showInSlashMenu,a[xI]=n.order,a[QD]=n.modelKey,a[e$]=0})}))}async function Dtn(){let t=ce().inlineEditCommands;if(!t||t.length===0)return;let e=[],r=[],n=K_(),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=gje(a.title,n);s?r.push({...a,title:encodeURIComponent(a.title),content:`> ${s}
|
||
|
||
Original name: ${a.title}
|
||
|
||
${a.content}`}):e.push(a)}await jg.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 ${RB()}.`;r.length>0&&(await Mpi(r),i+=`
|
||
|
||
We found ${r.length} unsupported commands. They are saved in ${RB()}/unsupported. To fix them, please resolve the errors and move the note file out of the unsupported folder.`),et("inlineEditCommands",[]),new lm(app,()=>{},i,"\u{1F680} New Copilot Custom Commands","OK","").open()}async function Ivt(){let t=K_(),e=wHr.filter(n=>!t.some(o=>o.title===n.title)),r=[...t,...e];jg.getInstance().updateCommands(r)}async function $tn(){if(ce().suggestedDefaultCommands)return;K_().length===0&&(new lm(app,()=>{Ivt()},"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(),et("suggestedDefaultCommands",!0))}var Uc=L(X()),Qde=require("obsidian"),Ltn=L(wm());Ro();Tu();Pt();function Rpi({plugin:t,onRemove:e}){let[r,n]=(0,Uc.useState)(""),o=So(),[i,a]=(0,Uc.useState)(""),[s]=xL(),u=(0,Uc.useRef)(null),l=o.quickCommandModelKey??s,c=o.quickCommandIncludeNoteContext;(0,Uc.useEffect)(()=>{let g=t.app.workspace.getActiveViewOfType(Qde.MarkdownView);if(g&&g.editor){let y=g.editor.getSelection();a(y)}},[t.app]),(0,Uc.useEffect)(()=>{u.current&&u.current.focus()},[]);let d=async()=>{if(!r.trim()){new Qde.Notice("Please enter a prompt");return}let g=`
|
||
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).
|
||
`,y=r;if(c){let w=y.includes("{}"),x=/\{activenote\}/i.test(y),O=[];w||O.push("{}"),x||O.push("{activeNote}"),O.length>0&&(y+=`
|
||
|
||
${O.join(`
|
||
|
||
`)}`)}let b={title:"Quick Command",content:y,showInContextMenu:!1,showInSlashMenu:!1,order:0,modelKey:l,lastUsedMs:Date.now()};new IB(t.app,{selectedText:i,command:b,systemPrompt:g}).open(),e()},f=()=>{e()},p=g=>{g.key==="Escape"?(g.preventDefault(),f()):g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),d())},m=g=>{et("quickCommandModelKey",g)},h=g=>{et("quickCommandIncludeNoteContext",g)};return Uc.default.createElement("div",{className:"tw-rounded-lg tw-border tw-border-solid tw-border-border tw-bg-primary tw-p-4",onKeyDown:p},Uc.default.createElement("div",{className:"tw-space-y-4"},Uc.default.createElement(Cx,{ref:u,value:r,onChange:g=>n(g.target.value),placeholder:"Ask me anything...",className:"tw-min-h-24 tw-resize-none",rows:3}),Uc.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-4"},Uc.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},Uc.default.createElement(IDe,{size:"sm",variant:"ghost",value:l,onChange:m}),Uc.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Uc.default.createElement(sd,{id:"includeActiveNote",checked:c,onCheckedChange:g=>h(!!g)}),Uc.default.createElement("label",{htmlFor:"includeActiveNote",className:"tw-cursor-pointer tw-text-sm tw-text-muted"},"Include note context"))),Uc.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Uc.default.createElement(ve,{variant:"secondary",onClick:f,size:"sm"},"Cancel"),Uc.default.createElement(ve,{onClick:d,size:"sm"},"Submit")))))}function Ftn({plugin:t,element:e}){let r=document.createElement("div");e.appendChild(r);let n=(0,Ltn.createRoot)(r),o=()=>{let i=t.app.workspace.getActiveViewOfType(Qde.MarkdownView);i&&i.editor&&vje(i.editor),n.unmount(),r.remove()};return n.render(Uc.default.createElement(Rpi,{plugin:t,onRemove:o})),{root:n,container:r}}zr();Pt();Dt();zr();async function ktn(t,e){await e.clearChatMemory();for(let r=0;r<t.length-1;r++){let n=t[r];if(n.sender===Xs){let o=t[r+1];o?.sender===TO&&await e.getMemory().saveContext({input:n.message},{output:o.message})}}}Tu();gd();Tu();zr();wr();var rFe=require("obsidian");zr();var tFe=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 rFe.TFile)try{let l=await n.parseFile(u,r);e=e.replace(a[0],`
|
||
|
||
<${uee}>
|
||
<name>${s}</name>
|
||
<content>
|
||
${l}
|
||
</content>
|
||
</${uee}>
|
||
|
||
`)}catch(l){console.error(`Error processing embedded PDF ${s}:`,l),e=e.replace(a[0],`
|
||
|
||
<${uee}>
|
||
<name>${s}</name>
|
||
<error>Could not process PDF</error>
|
||
</${uee}>
|
||
|
||
`)}}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,g)=>setTimeout(()=>g(new Error("Query timeout")),5e3))]),m=`
|
||
|
||
<${lee}>
|
||
<query_type>${l}</query_type>
|
||
<original_query>
|
||
${c}
|
||
</original_query>
|
||
<executed_result>
|
||
${p}
|
||
</executed_result>
|
||
</${lee}>
|
||
|
||
`;e=e.slice(0,d)+m+e.slice(f)}catch(p){console.error("Error executing Dataview query:",p);let m=`
|
||
|
||
<${lee}>
|
||
<query_type>${l}</query_type>
|
||
<original_query>
|
||
${c}
|
||
</original_query>
|
||
<error>${p instanceof Error?p.message:"Query execution failed"}</error>
|
||
</${lee}>
|
||
|
||
`;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 processContextNotes(e,r,n,o,i,a,s){let u="",l=async(d,f=aee)=>{try{if(e.has(d.path)){console.log(`Skipping note ${d.path} as it was included via custom prompt.`);return}if(console.log(`Processing note: ${d.path}, extension: ${d.extension}, chain: ${s}`),!r.supportsExtension(d.extension)){console.warn(`Unsupported file type: ${d.extension}`);return}if(!s_(s)&&d.extension!=="md"&&d.extension!=="canvas"){console.warn(`File type ${d.extension} requires Copilot Plus mode for context processing.`),new rFe.Notice(G6.NON_MARKDOWN_FILES_RESTRICTED);return}let p=await r.parseFile(d,n);d.extension==="md"&&(s_(s)&&(p=await this.processEmbeddedPDFs(p,n,r)),p=await this.processDataviewBlocks(p,d.path));let m=await n.adapter.stat(d.path),h=m?new Date(m.ctime).toISOString():"Unknown",g=m?new Date(m.mtime).toISOString():"Unknown";u+=`
|
||
|
||
<${f}>
|
||
<title>${d.basename}</title>
|
||
<path>${d.path}</path>
|
||
<ctime>${h}</ctime>
|
||
<mtime>${g}</mtime>
|
||
<content>
|
||
${p}
|
||
</content>
|
||
</${f}>`}catch(p){console.error(`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=Kz();if(!e||e.length===0)return"";let r="";for(let n of e)r+=`
|
||
|
||
<${u_}>
|
||
<title>${n.noteTitle}</title>
|
||
<path>${n.notePath}</path>
|
||
<start_line>${n.startLine.toString()}</start_line>
|
||
<end_line>${n.endLine.toString()}</end_line>
|
||
<content>
|
||
${n.content}
|
||
</content>
|
||
</${u_}>`;return r}};Dt();lot();wr();var nFe=class t{constructor(){this.contextProcessor=tFe.getInstance(),this.mention=eG.getInstance()}static getInstance(){return t.instance||(t.instance=new t),t.instance}async processMessageContext(e,r,n,o,i,a){try{J(`[ContextManager] Processing context for message ${e.id}`);let s=e.originalMessage||e.message,{processedPrompt:u,includedFiles:l}=await _mt(s,"",n,a),c=e.context?.urls||[],d=o==="copilot_plus"?await this.mention.processUrlList(c):{urlContext:"",imageUrls:[]},f=new Set(l.map(O=>O.path)),m=[...e.context?.notes||[]];i&&o!=="project"&&a&&!f.has(a.path)&&!m.some(O=>O.path===a.path)&&m.push(a);let h=await this.contextProcessor.processContextNotes(f,r,n,m,i,a,o);m.forEach(O=>f.add(O.path));let g=e.context?.tags||[],y="";if(g.length>0){let E=Fhe(n,g).filter(T=>!f.has(T.path));E.length>0&&(y=await this.contextProcessor.processContextNotes(new Set,r,n,E,!1,null,o),E.forEach(T=>f.add(T.path)))}let b=e.context?.folders||[],_="";if(b.length>0){let E=b.flatMap(T=>eee(n,T)).filter(T=>!f.has(T.path));E.length>0&&(_=await this.contextProcessor.processContextNotes(new Set,r,n,E,!1,null,o),E.forEach(T=>f.add(T.path)))}let w=this.contextProcessor.processSelectedTextContexts(),x=u+h+y+_+d.urlContext+w;return J(`[ContextManager] Successfully processed context for message ${e.id}`),x}catch(s){return J(`[ContextManager] Error processing context for message ${e.id}:`,s),e.originalMessage||e.message}}async reprocessMessageContext(e,r,n,o,i,a,s){let u=r.getMessage(e);if(!u||u.sender!=="user"||!u.id)return;J(`[ContextManager] Reprocessing context for message ${e}`);let l=await this.processMessageContext(u,n,o,i,a,s);r.updateProcessedText(u.id,l),J(`[ContextManager] Completed context reprocessing for message ${e}`)}createMessageContext(e,r,n=Kz()){return{notes:e,urls:r,selectedTextContexts:n}}async extractContextNotes(e,r,n=[]){return[...await xO(e,r),...n].filter((s,u,l)=>l.findIndex(c=>c.path===s.path)===u)}needsContextReprocessing(e){return e.needsContextReprocessing===!0}getSelectedTextContexts(){return Kz()}};wr();Dt();var HX=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||Zh(new Date),p={id:d,displayText:c.message,processedText:c.originalMessage||c.message,sender:c.sender,timestamp:f,context:c.context,isVisible:c.isVisible!==!1,isErrorMessage:c.isErrorMessage,sources:c.sources,content:c.content,responseMetadata:c.responseMetadata};return this.messages.push(p),J(`[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=Zh(new Date),l={id:s,displayText:a,processedText:r,sender:n,timestamp:u,context:o,isVisible:!0,isErrorMessage:!1,content:i};return this.messages.push(l),J(`[MessageRepository] Added message with ID: ${s}`),s}editMessage(e,r){let n=this.messages.find(o=>o.id===e);return n?n.displayText===r?(J(`[MessageRepository] No changes needed for message: ${e}`),!0):(n.displayText=r,n.sender==="user"||n.sender==="USER"?J(`[MessageRepository] Edited user message ${e}, needs context reprocessing`):(n.processedText=r,J(`[MessageRepository] Edited AI message ${e}`)),!0):(J(`[MessageRepository] Message not found for edit: ${e}`),!1)}updateProcessedText(e,r){let n=this.messages.find(o=>o.id===e);return n?(n.processedText=r,J(`[MessageRepository] Updated processed text for message ${e}`),!0):(J(`[MessageRepository] Message not found for processed text update: ${e}`),!1)}deleteMessage(e){let r=this.messages.findIndex(n=>n.id===e);return r===-1?(J(`[MessageRepository] Message not found for deletion: ${e}`),!1):(this.messages.splice(r,1),J(`[MessageRepository] Deleted message ${e}`),!0)}clear(){this.messages=[],J("[MessageRepository] Cleared all messages")}truncateAfter(e){this.messages=this.messages.slice(0,e+1),J(`[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),J(`[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,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,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content,responseMetadata:r.responseMetadata}}getLLMMessages(){return this.messages.map(e=>({id:e.id,message:e.processedText,originalMessage:e.displayText,sender:e.sender,timestamp:e.timestamp,isVisible:!1,context:e.context,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,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||Zh(new Date),context:r.context,isVisible:r.isVisible!==!1,isErrorMessage:r.isErrorMessage,sources:r.sources,content:r.content})}),J(`[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}}};Tu();zr();Dt();Pt();wr();var KI=require("obsidian"),efe=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 KI.Notice("No messages to save.");return}let n=ce(),o=this.formatChatContent(r),i=r[0].timestamp?.epoch||Date.now();await ty(n.defaultSaveFolder);let a=await this.findFileByEpoch(i),s=a?this.app.metadataCache.getFileCache(a)?.frontmatter?.topic:void 0,u=a?a.path:this.generateFileName(r,i,void 0),l=this.generateNoteContent(o,i,e,s),c=a;if(a)await this.app.vault.modify(a,l),J(`[ChatPersistenceManager] Updated existing chat file: ${a.path}`);else try{c=await this.app.vault.create(u,l),new KI.Notice(`Chat saved as note: ${u}`),J(`[ChatPersistenceManager] Created new chat file: ${u}`)}catch(d){if(this.isFileAlreadyExistsError(d)){let f=this.app.vault.getAbstractFileByPath(u);if(f&&f instanceof KI.TFile)s=this.app.metadataCache.getFileCache(f)?.frontmatter?.topic??s,await this.app.vault.modify(f,l),c=f,new KI.Notice("Existing chat note found - updating it now."),J(`[ChatPersistenceManager] Resolved save conflict by updating existing chat file: ${f.path}`);else throw d}else throw d}this.generateTopicAsyncIfNeeded(r,c,s)}catch(r){ue("[ChatPersistenceManager] Error saving chat:",r),new KI.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 J(`[ChatPersistenceManager] Loaded ${n.length} messages from ${e.path}`),n}catch(r){return ue("[ChatPersistenceManager] Error loading chat:",r),new KI.Notice("Failed to load chat history. Check console for details."),[]}}async getChatHistoryFiles(){let e=ce(),r=this.app.vault.getAbstractFileByPath(e.defaultSaveFolder);if(!(r instanceof KI.TFolder))return[];let o=this.app.vault.getMarkdownFiles().filter(a=>a.path.startsWith(r.path)),i=tc();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.basename).join(", ")}`),r.context.urls?.length&&i.push(`URLs: ${r.context.urls.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"?Xs:TO,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 g=h[1];f=this.parseContextString(g),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:[]},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=>({basename:s.trim(),path:s.trim()})))}else if(i.startsWith("URLs: ")){let a=i.substring(6);a&&(r.urls=a.split(", ").map(s=>s.trim()))}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)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 Hhe(u).trim().replace(/^["']|["']$/g,"").replace(/[\\/:*?"<>|]/g,"").slice(0,50)||void 0}catch(r){ue("[ChatPersistenceManager] Error generating AI topic:",r);return}}generateFileName(e,r,n){let o=ce(),a=Zh(new Date(r)).fileName,s;if(n)s=n;else{let x=e.find(O=>O.sender===Xs);s=x&&x.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=200,c=tc(),d=c?`${c.id}__`:"",f=nee(".md"),p=nee(d),m=u.replace("{$topic}","").replace("{$date}",a.split("_")[0]).replace("{$time}",a.split("_")[1]),h=nee(m),g=Math.max(20,l-f-p-h),y=s.replace(/\s+/g,"_"),b=Q2e(y,g);u=u.replace("{$topic}",b).replace("{$date}",a.split("_")[0]).replace("{$time}",a.split("_")[1]);let _=u.replace(/\[\[([^\]]+)\]\]/g,"$1").replace(/[{}[\]]/g,"_").replace(/[\\/:*?"<>|\x00-\x1F]/g,"_"),w=`${d}${_}.md`;if(nee(w)>l){let x=l-f-p,O=Q2e(_,x);return`${o.defaultSaveFolder}/${d}${O}.md`}return`${o.defaultSaveFolder}/${w}`}generateNoteContent(e,r,n,o){let i=ce(),a=tc();return`---
|
||
epoch: ${r}
|
||
modelKey: ${n}
|
||
${o?`topic: "${o}"`:""}
|
||
${a?`projectId: ${a.id}`:""}
|
||
${a?`projectName: ${a.name}`:""}
|
||
tags:
|
||
- ${i.defaultConversationTag}
|
||
---
|
||
|
||
${e}`}generateTopicAsyncIfNeeded(e,r,n){!ce().generateAIChatTitleOnSave||!r||n||(async()=>{try{let i=await this.generateAITopic(e);if(!i)return;await this.applyTopicToFrontmatter(r,i)}catch(i){ue("[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)}),J(`[ChatPersistenceManager] Applied AI topic to chat file: ${e.path}`)}catch(n){ue("[ChatPersistenceManager] Error applying AI topic to file:",n)}}isFileAlreadyExistsError(e){return e?(e instanceof Error?e.message:String(e)).toLowerCase().includes("already exists"):!1}};zr();var oFe=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=nFe.getInstance(),this.projectMessageRepos.set(this.defaultProjectKey,e),this.persistenceManager=new efe(o.app,e,r)}getCurrentMessageRepo(){let e=this.plugin.projectManager.getCurrentProjectId(),r=e??this.defaultProjectKey;if(this.lastKnownProjectId!==e&&(J(`[ChatManager] Project changed from ${this.lastKnownProjectId} to ${e}`),this.lastKnownProjectId=e),!this.projectMessageRepos.has(r)){J(`[ChatManager] Creating new message repository for project: ${r}`);let o=new HX;this.projectMessageRepos.set(r,o)}let n=this.projectMessageRepos.get(r);return this.persistenceManager=new efe(this.plugin.app,n,this.chainManager),n}setOnMessageCreatedCallback(e){this.onMessageCreatedCallback=e}async sendMessage(e,r,n,o=!1,i){try{J(`[ChatManager] Sending message: "${e}"`);let a=this.plugin.app.workspace.getActiveFile(),s={...r};if(o&&a){let f=r.notes||[],p=f.some(m=>m.path===a.path);s.notes=p?f:[...f,a]}let u=this.getCurrentMessageRepo(),l=u.addMessage(e,e,Xs,s,i);this.onMessageCreatedCallback&&this.onMessageCreatedCallback(l);let c=u.getMessage(l);if(!c)throw new Error(`Failed to retrieve message ${l}`);let d=await this.contextManager.processMessageContext(c,this.fileParserManager,this.plugin.app.vault,n,o,a);return u.updateProcessedText(l,d),J(`[ChatManager] Successfully sent message ${l}`),l}catch(a){throw J("[ChatManager] Error sending message:",a),a}}async editMessage(e,r,n,o=!1){try{J(`[ChatManager] Editing message ${e}: "${r}"`);let i=this.getCurrentMessageRepo();if(!i.editMessage(e,r))return!1;let s=this.plugin.app.workspace.getActiveFile();return await this.contextManager.reprocessMessageContext(e,i,this.fileParserManager,this.plugin.app.vault,n,o,s),await this.updateChainMemory(),J(`[ChatManager] Successfully edited message ${e}`),!0}catch(i){return J(`[ChatManager] Error editing message ${e}:`,i),!1}}async regenerateMessage(e,r,n,o){try{J(`[ChatManager] Regenerating message ${e}`);let i=this.getCurrentMessageRepo();if(!i.getMessage(e))return J(`[ChatManager] Message not found: ${e}`),!1;let s=i.getDisplayMessages(),u=s.findIndex(f=>f.id===e);if(u<=0)return J("[ChatManager] Cannot regenerate first message or no user message found"),!1;let l=s[u-1];if(l.sender!==Xs)return J("[ChatManager] Previous message is not from user"),!1;if(i.truncateAfter(u-1),o&&o(),await this.updateChainMemory(),!l.id)return J("[ChatManager] User message has no ID for regeneration"),!1;let c=i.getLLMMessage(l.id);if(!c)return J("[ChatManager] LLM message not found for regeneration"),!1;let d=new AbortController;return await this.chainManager.runChain(c,d,r,n,{debug:ce().debug}),J(`[ChatManager] Successfully regenerated message ${e}`),!0}catch(i){return J(`[ChatManager] Error regenerating message ${e}:`,i),!1}}async deleteMessage(e){try{return J(`[ChatManager] Deleting message ${e}`),this.getCurrentMessageRepo().deleteMessage(e)?(await this.updateChainMemory(),J(`[ChatManager] Successfully deleted message ${e}`),!0):!1}catch(r){return J(`[ChatManager] Error deleting message ${e}:`,r),!1}}addMessage(e){return this.getCurrentMessageRepo().addMessage(e)}clearMessages(){this.getCurrentMessageRepo().clear(),this.chainManager.memoryManager.clearChatMemory(),J("[ChatManager] Cleared all messages")}async truncateAfterMessageId(e){this.getCurrentMessageRepo().truncateAfterMessageId(e),await this.updateChainMemory(),J(`[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 ktn(r,this.chainManager.memoryManager),J(`[ChatManager] Updated chain memory with ${r.length} messages`)}catch(e){J("[ChatManager] Error updating chain memory:",e)}}async loadMessages(e){let r=this.getCurrentMessageRepo();r.clear(),e.forEach(n=>{r.addMessage(n)}),await this.updateChainMemory(),J(`[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();J(`[ChatManager] Handling project switch to: ${e}`),this.lastKnownProjectId=null;let r=this.getCurrentMessageRepo();await this.updateChainMemory(),J(`[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(),J(`[ChatManager] Loaded ${r.length} messages from chat history`)}};zz();Dt();L6();M1e();W7();$v();Dm();zr();Pt();Dt();var vfe=require("obsidian"),cwt=L(X()),znn=L(wm());var iFe=class extends lm{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")}};Ro();var tfe=L(X());jn();var qtn=({tab:t,isSelected:e,onClick:r,isFirst:n,isLast:o})=>tfe.default.createElement("div",{role:"tab",id:`tab-${t.id}`,"aria-controls":`tabpanel-${t.id}`,"aria-selected":e,onClick:r,className:Oe("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")},tfe.default.createElement("div",{className:Oe("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),tfe.default.createElement("span",{className:Oe("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)),Btn=({id:t,children:e,isSelected:r})=>r?tfe.default.createElement("div",{role:"tabpanel",id:`tabpanel-${t}`,"aria-labelledby":`tab-${t}`,className:Oe("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()),Utn=(0,Pw.createContext)(void 0),ztn=({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(Utn.Provider,{value:{selectedTab:e,setSelectedTab:r,modalContainer:n}},t)},VX=()=>{let t=(0,Pw.useContext)(Utn);if(t===void 0)throw new Error("useTab must be used within a TabProvider");return t};Pt();var vt=L(X());Ro();var Zs=L(X());Ro();jn();var ld=L(X());var ze=L(X()),D3=L(Bu());var ud=L(X());function Vtn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,ud.useMemo)(()=>n=>{e.forEach(o=>o(n))},e)}var rfe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function M3(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function aFe(t){return"nodeType"in t}function zb(t){var e,r;return t?M3(t)?t:aFe(t)&&(e=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?e:window:window}function sFe(t){let{Document:e}=zb(t);return t instanceof e}function JX(t){return M3(t)?!1:t instanceof zb(t).HTMLElement}function jvt(t){return t instanceof zb(t).SVGElement}function R3(t){return t?M3(t)?t.document:aFe(t)?sFe(t)?t:JX(t)||jvt(t)?t.ownerDocument:document:document:document}var $0=rfe?ud.useLayoutEffect:ud.useEffect;function uFe(t){let e=(0,ud.useRef)(t);return $0(()=>{e.current=t}),(0,ud.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 Jtn(){let t=(0,ud.useRef)(null),e=(0,ud.useCallback)((n,o)=>{t.current=setInterval(n,o)},[]),r=(0,ud.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,r]}function KX(t,e){e===void 0&&(e=[t]);let r=(0,ud.useRef)(t);return $0(()=>{r.current!==t&&(r.current=t)},e),r}function WX(t,e){let r=(0,ud.useRef)();return(0,ud.useMemo)(()=>{let n=t(r.current);return r.current=n,n},[...e])}function nfe(t){let e=uFe(t),r=(0,ud.useRef)(null),n=(0,ud.useCallback)(o=>{o!==r.current&&e?.(o,r.current),r.current=o},[]);return[r,n]}function lFe(t){let e=(0,ud.useRef)();return(0,ud.useEffect)(()=>{e.current=t},[t]),e.current}var Nvt={};function A3(t,e){return(0,ud.useMemo)(()=>{if(e)return e;let r=Nvt[t]==null?0:Nvt[t]+1;return Nvt[t]=r,t+"-"+r},[t,e])}function Ktn(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=Ktn(1),N3=Ktn(-1);function Api(t){return"clientX"in t&&"clientY"in t}function ofe(t){if(!t)return!1;let{KeyboardEvent:e}=zb(t.target);return e&&t instanceof e}function Ipi(t){if(!t)return!1;let{TouchEvent:e}=zb(t.target);return e&&t instanceof e}function cFe(t){if(Ipi(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 Api(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}}}),Htn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Wtn(t){return t.matches(Htn)?t:t.querySelector(Htn)}var j3=L(X()),Npi={display:"none"};function Gtn(t){let{id:e,value:r}=t;return j3.default.createElement("div",{id:e,style:Npi},r)}function Ztn(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 j3.default.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function Xtn(){let[t,e]=(0,j3.useState)("");return{announce:(0,j3.useCallback)(n=>{n!=null&&e(n)},[]),announcement:t}}var crn=(0,ze.createContext)(null);function jpi(t){let e=(0,ze.useContext)(crn);(0,ze.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function Dpi(){let[t]=(0,ze.useState)(()=>new Set),e=(0,ze.useCallback)(n=>(t.add(n),()=>t.delete(n)),[t]);return[(0,ze.useCallback)(n=>{let{type:o,event:i}=n;t.forEach(a=>{var s;return(s=a[o])==null?void 0:s.call(a,i)})},[t]),e]}var $pi={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.
|
||
`},Lpi={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 Fpi(t){let{announcements:e=Lpi,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=$pi}=t,{announce:i,announcement:a}=Xtn(),s=A3("DndLiveRegion"),[u,l]=(0,ze.useState)(!1);if((0,ze.useEffect)(()=>{l(!0)},[]),jpi((0,ze.useMemo)(()=>({onDragStart(d){let{active:f}=d;i(e.onDragStart({active:f}))},onDragMove(d){let{active:f,over:p}=d;e.onDragMove&&i(e.onDragMove({active:f,over:p}))},onDragOver(d){let{active:f,over:p}=d;i(e.onDragOver({active:f,over:p}))},onDragEnd(d){let{active:f,over:p}=d;i(e.onDragEnd({active:f,over:p}))},onDragCancel(d){let{active:f,over:p}=d;i(e.onDragCancel({active:f,over:p}))}}),[i,e])),!u)return null;let c=ze.default.createElement(ze.default.Fragment,null,ze.default.createElement(Gtn,{id:n,value:o.draggable}),ze.default.createElement(Ztn,{id:s,announcement:a}));return r?(0,D3.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 fFe(){}function GX(t,e){return(0,ze.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function mFe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return(0,ze.useMemo)(()=>[...e].filter(n=>n!=null),[...e])}var Qx=Object.freeze({x:0,y:0});function drn(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function frn(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return r-n}function kpi(t,e){let{data:{value:r}}=t,{data:{value:n}}=e;return n-r}function Ytn(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 zvt(t,e){if(!t||t.length===0)return null;let[r]=t;return e?r[e]:r}function Qtn(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 ZX=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=Qtn(e,e.left,e.top),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=drn(Qtn(u),o);i.push({id:s,data:{droppableContainer:a,value:l}})}}return i.sort(frn)},prn=t=>{let{collisionRect:e,droppableRects:r,droppableContainers:n}=t,o=Ytn(e),i=[];for(let a of n){let{id:s}=a,u=r.get(s);if(u){let l=Ytn(u),c=o.reduce((f,p,m)=>f+drn(l[m],p),0),d=Number((c/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(frn)};function qpi(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 Bpi=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=qpi(s,e);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(kpi)};function Upi(t,e,r){return{...t,scaleX:e&&r?e.width/r.width:1,scaleY:e&&r?e.height/r.height:1}}function mrn(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Qx}function zpi(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 Hpi=zpi(1);function Vpi(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 Jpi(t,e,r){let n=Vpi(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 Kpi={ignoreTransform:!1};function F3(t,e){e===void 0&&(e=Kpi);let r=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:l,transformOrigin:c}=zb(t).getComputedStyle(t);l&&(r=Jpi(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 ern(t){return F3(t,{ignoreTransform:!0})}function Wpi(t){let e=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:e,bottom:r,width:e,height:r}}function Gpi(t,e){return e===void 0&&(e=zb(t).getComputedStyle(t)),e.position==="fixed"}function Zpi(t,e){e===void 0&&(e=zb(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 lfe(t,e){let r=[];function n(o){if(e!=null&&r.length>=e||!o)return r;if(sFe(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!JX(o)||jvt(o)||r.includes(o))return r;let i=zb(t).getComputedStyle(o);return o!==t&&Zpi(o,i)&&r.push(o),Gpi(o,i)?r:n(o.parentNode)}return t?n(t):r}function hrn(t){let[e]=lfe(t,1);return e??null}function Dvt(t){return!rfe||!t?null:M3(t)?t:aFe(t)?sFe(t)||t===R3(t).scrollingElement?window:JX(t)?t:null:null}function grn(t){return M3(t)?t.scrollX:t.scrollLeft}function yrn(t){return M3(t)?t.scrollY:t.scrollTop}function Fvt(t){return{x:grn(t),y:yrn(t)}}var zh;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(zh||(zh={}));function brn(t){return!rfe||!t?!1:t===document.scrollingElement}function _rn(t){let e={x:0,y:0},r=brn(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 Xpi={x:.2,y:.2};function Ypi(t,e,r,n,o){let{top:i,left:a,right:s,bottom:u}=r;n===void 0&&(n=10),o===void 0&&(o=Xpi);let{isTop:l,isBottom:c,isLeft:d,isRight:f}=_rn(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=zh.Backward,m.y=n*Math.abs((e.top+h.height-i)/h.height)):!c&&u>=e.bottom-h.height&&(p.y=zh.Forward,m.y=n*Math.abs((e.bottom-h.height-u)/h.height)),!f&&s>=e.right-h.width?(p.x=zh.Forward,m.x=n*Math.abs((e.right-h.width-s)/h.width)):!d&&a<=e.left+h.width&&(p.x=zh.Backward,m.x=n*Math.abs((e.left+h.width-a)/h.width)),{direction:p,speed:m}}function Qpi(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 vrn(t){return t.reduce((e,r)=>I3(e,Fvt(r)),Qx)}function emi(t){return t.reduce((e,r)=>e+grn(r),0)}function tmi(t){return t.reduce((e,r)=>e+yrn(r),0)}function rmi(t,e){if(e===void 0&&(e=F3),!t)return;let{top:r,left:n,bottom:o,right:i}=e(t);hrn(t)&&(o<=0||i<=0||r>=window.innerHeight||n>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}var nmi=[["x",["left","right"],emi],["y",["top","bottom"],tmi]],afe=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=lfe(r),o=vrn(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[i,a,s]of nmi)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})}},$3=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 omi(t){let{EventTarget:e}=zb(t);return t instanceof e?t:R3(t)}function $vt(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 trn(t){t.preventDefault()}function imi(t){t.stopPropagation()}var Ni;(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"})(Ni||(Ni={}));var wrn={start:[Ni.Space,Ni.Enter],cancel:[Ni.Esc],end:[Ni.Space,Ni.Enter,Ni.Tab]},ami=(t,e)=>{let{currentCoordinates:r}=e;switch(t.code){case Ni.Right:return{...r,x:r.x+25};case Ni.Left:return{...r,x:r.x-25};case Ni.Down:return{...r,y:r.y+25};case Ni.Up:return{...r,y:r.y-25}}},DU=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 $3(R3(r)),this.windowListeners=new $3(zb(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&&rmi(n),r(Qx)}handleKeyDown(e){if(ofe(e)){let{active:r,context:n,options:o}=this.props,{keyboardCodes:i=wrn,coordinateGetter:a=ami,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}:Qx;this.referenceCoordinates||(this.referenceCoordinates=c);let d=a(e,{active:r,context:n.current,currentCoordinates:c});if(d){let f=N3(d,c),p={x:0,y:0},{scrollableAncestors:m}=n.current;for(let h of m){let g=e.code,{isTop:y,isRight:b,isLeft:_,isBottom:w,maxScroll:x,minScroll:O}=_rn(h),E=Qpi(h),T={x:Math.min(g===Ni.Right?E.right-E.width/2:E.right,Math.max(g===Ni.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(g===Ni.Down?E.bottom-E.height/2:E.bottom,Math.max(g===Ni.Down?E.top:E.top+E.height/2,d.y))},R=g===Ni.Right&&!b||g===Ni.Left&&!_,N=g===Ni.Down&&!w||g===Ni.Up&&!y;if(R&&T.x!==d.x){let D=h.scrollLeft+f.x,F=g===Ni.Right&&D<=x.x||g===Ni.Left&&D>=O.x;if(F&&!f.y){h.scrollTo({left:D,behavior:s});return}F?p.x=h.scrollLeft-D:p.x=g===Ni.Right?h.scrollLeft-x.x:h.scrollLeft-O.x,p.x&&h.scrollBy({left:-p.x,behavior:s});break}else if(N&&T.y!==d.y){let D=h.scrollTop+f.y,F=g===Ni.Down&&D<=x.y||g===Ni.Up&&D>=O.y;if(F&&!f.x){h.scrollTo({top:D,behavior:s});return}F?p.y=h.scrollTop-D:p.y=g===Ni.Down?h.scrollTop-x.y:h.scrollTop-O.y,p.y&&h.scrollBy({top:-p.y,behavior:s});break}}this.handleMove(e,I3(N3(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()}};DU.activators=[{eventName:"onKeyDown",handler:(t,e,r)=>{let{keyboardCodes:n=wrn,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 rrn(t){return!!(t&&"distance"in t)}function nrn(t){return!!(t&&"delay"in t)}var sfe=class{constructor(e,r,n){var o;n===void 0&&(n=omi(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=R3(a),this.documentListeners=new $3(this.document),this.listeners=new $3(n),this.windowListeners=new $3(zb(a)),this.initialCoordinates=(o=cFe(i))!=null?o:Qx,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,trn),this.windowListeners.add(L0.VisibilityChange,this.handleCancel),this.windowListeners.add(L0.ContextMenu,trn),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(nrn(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(rrn(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,imi,{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=cFe(e))!=null?r:Qx,l=N3(o,u);if(!n&&s){if(rrn(s)){if(s.tolerance!=null&&$vt(l,s.tolerance))return this.handleCancel();if($vt(l,s.distance))return this.handleStart()}if(nrn(s)&&$vt(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===Ni.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},smi={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},$U=class extends sfe{constructor(e){let{event:r}=e,n=R3(r.target);super(e,smi,n)}};$U.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 umi={move:{name:"mousemove"},end:{name:"mouseup"}},kvt;(function(t){t[t.RightClick=2]="RightClick"})(kvt||(kvt={}));var qvt=class extends sfe{constructor(e){super(e,umi,R3(e.event.target))}};qvt.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:r}=t,{onActivation:n}=e;return r.button===kvt.RightClick?!1:(n?.({event:r}),!0)}}];var Lvt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Bvt=class extends sfe{constructor(e){super(e,Lvt)}static setup(){return window.addEventListener(Lvt.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Lvt.move.name,e)};function e(){}}};Bvt.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 ife;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(ife||(ife={}));var pFe;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(pFe||(pFe={}));function lmi(t){let{acceleration:e,activator:r=ife.Pointer,canScroll:n,draggingRect:o,enabled:i,interval:a=5,order:s=pFe.TreeOrder,pointerCoordinates:u,scrollableAncestors:l,scrollableAncestorRects:c,delta:d,threshold:f}=t,p=dmi({delta:d,disabled:!i}),[m,h]=Jtn(),g=(0,ze.useRef)({x:0,y:0}),y=(0,ze.useRef)({x:0,y:0}),b=(0,ze.useMemo)(()=>{switch(r){case ife.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case ife.DraggableRect:return o}},[r,o,u]),_=(0,ze.useRef)(null),w=(0,ze.useCallback)(()=>{let O=_.current;if(!O)return;let E=g.current.x*y.current.x,T=g.current.y*y.current.y;O.scrollBy(E,T)},[]),x=(0,ze.useMemo)(()=>s===pFe.TreeOrder?[...l].reverse():l,[s,l]);(0,ze.useEffect)(()=>{if(!i||!l.length||!b){h();return}for(let O of x){if(n?.(O)===!1)continue;let E=l.indexOf(O),T=c[E];if(!T)continue;let{direction:R,speed:N}=Ypi(O,T,b,e,f);for(let D of["x","y"])p[D][R[D]]||(N[D]=0,R[D]=0);if(N.x>0||N.y>0){h(),_.current=O,m(w,a),g.current=N,y.current=R;return}}g.current={x:0,y:0},y.current={x:0,y:0},h()},[e,w,n,h,i,a,JSON.stringify(b),JSON.stringify(p),m,l,x,c,JSON.stringify(f)])}var cmi={x:{[zh.Backward]:!1,[zh.Forward]:!1},y:{[zh.Backward]:!1,[zh.Forward]:!1}};function dmi(t){let{delta:e,disabled:r}=t,n=lFe(e);return WX(o=>{if(r||!n||!o)return cmi;let i={x:Math.sign(e.x-n.x),y:Math.sign(e.y-n.y)};return{x:{[zh.Backward]:o.x[zh.Backward]||i.x===-1,[zh.Forward]:o.x[zh.Forward]||i.x===1},y:{[zh.Backward]:o.y[zh.Backward]||i.y===-1,[zh.Forward]:o.y[zh.Forward]||i.y===1}}},[r,e,n])}function fmi(t,e){let r=e!=null?t.get(e):void 0,n=r?r.node.current:null;return WX(o=>{var i;return e==null?null:(i=n??o)!=null?i:null},[n,e])}function pmi(t,e){return(0,ze.useMemo)(()=>t.reduce((r,n)=>{let{sensor:o}=n,i=o.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,n)}));return[...r,...i]},[]),[t,e])}var ufe;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ufe||(ufe={}));var Uvt;(function(t){t.Optimized="optimized"})(Uvt||(Uvt={}));var orn=new Map;function mmi(t,e){let{dragging:r,dependencies:n,config:o}=e,[i,a]=(0,ze.useState)(null),{frequency:s,measure:u,strategy:l}=o,c=(0,ze.useRef)(t),d=g(),f=KX(d),p=(0,ze.useCallback)(function(y){y===void 0&&(y=[]),!f.current&&a(b=>b===null?y:b.concat(y.filter(_=>!b.includes(_))))},[f]),m=(0,ze.useRef)(null),h=WX(y=>{if(d&&!r)return orn;if(!y||y===orn||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,x=w?new afe(u(w),w):null;_.rect.current=x,x&&b.set(_.id,x)}return b}return y},[t,i,r,d,u]);return(0,ze.useEffect)(()=>{c.current=t},[t]),(0,ze.useEffect)(()=>{d||p()},[r,d]),(0,ze.useEffect)(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),(0,ze.useEffect)(()=>{d||typeof s!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...n]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:i!=null};function g(){switch(l){case ufe.Always:return!1;case ufe.BeforeDragging:return r;default:return!r}}}function Srn(t,e){return WX(r=>t?r||(typeof e=="function"?e(t):t):null,[e,t])}function hmi(t,e){return Srn(t,e)}function gmi(t){let{callback:e,disabled:r}=t,n=uFe(e),o=(0,ze.useMemo)(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:i}=window;return new i(n)},[n,r]);return(0,ze.useEffect)(()=>()=>o?.disconnect(),[o]),o}function hFe(t){let{callback:e,disabled:r}=t,n=uFe(e),o=(0,ze.useMemo)(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:i}=window;return new i(n)},[r]);return(0,ze.useEffect)(()=>()=>o?.disconnect(),[o]),o}function ymi(t){return new afe(F3(t),t)}function irn(t,e,r){e===void 0&&(e=ymi);let[n,o]=(0,ze.useState)(null);function i(){o(u=>{if(!t)return null;if(t.isConnected===!1){var l;return(l=u??r)!=null?l:null}let c=e(t);return JSON.stringify(u)===JSON.stringify(c)?u:c})}let a=gmi({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=hFe({callback:i});return $0(()=>{i(),t?(s?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[t]),n}function bmi(t){let e=Srn(t);return mrn(t,e)}var arn=[];function _mi(t){let e=(0,ze.useRef)(t),r=WX(n=>t?n&&n!==arn&&t&&e.current&&t.parentNode===e.current.parentNode?n:lfe(t):arn,[t]);return(0,ze.useEffect)(()=>{e.current=t},[t]),r}function vmi(t){let[e,r]=(0,ze.useState)(null),n=(0,ze.useRef)(t),o=(0,ze.useCallback)(i=>{let a=Dvt(i.target);a&&r(s=>s?(s.set(a,Fvt(a)),new Map(s)):null)},[]);return(0,ze.useEffect)(()=>{let i=n.current;if(t!==i){a(i);let s=t.map(u=>{let l=Dvt(u);return l?(l.addEventListener("scroll",o,{passive:!0}),[l,Fvt(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=Dvt(u);l?.removeEventListener("scroll",o)})}},[o,t]),(0,ze.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>I3(i,a),Qx):vrn(t):Qx,[t,e])}function srn(t,e){e===void 0&&(e=[]);let r=(0,ze.useRef)(null);return(0,ze.useEffect)(()=>{r.current=null},e),(0,ze.useEffect)(()=>{let n=t!==Qx;n&&!r.current&&(r.current=t),!n&&r.current&&(r.current=null)},[t]),r.current?N3(t,r.current):Qx}function wmi(t){(0,ze.useEffect)(()=>{if(!rfe)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 Smi(t,e){return(0,ze.useMemo)(()=>t.reduce((r,n)=>{let{eventName:o,handler:i}=n;return r[o]=a=>{i(a,e)},r},{}),[t,e])}function Crn(t){return(0,ze.useMemo)(()=>t?Wpi(t):null,[t])}var urn=[];function Cmi(t,e){e===void 0&&(e=F3);let[r]=t,n=Crn(r?zb(r):null),[o,i]=(0,ze.useState)(urn);function a(){i(()=>t.length?t.map(u=>brn(u)?n:new afe(e(u),u)):urn)}let s=hFe({callback:a});return $0(()=>{s?.disconnect(),a(),t.forEach(u=>s?.observe(u))},[t]),o}function xmi(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return JX(e)?e:t}function Omi(t){let{measure:e}=t,[r,n]=(0,ze.useState)(null),o=(0,ze.useCallback)(l=>{for(let{target:c}of l)if(JX(c)){n(d=>{let f=e(c);return d?{...d,width:f.width,height:f.height}:f});break}},[e]),i=hFe({callback:o}),a=(0,ze.useCallback)(l=>{let c=xmi(l);i?.disconnect(),c&&i?.observe(c),n(c?e(c):null)},[e,i]),[s,u]=nfe(a);return(0,ze.useMemo)(()=>({nodeRef:s,rect:r,setRef:u}),[r,s,u])}var Tmi=[{sensor:$U,options:{}},{sensor:DU,options:{}}],Emi={current:{}},dFe={draggable:{measure:ern},droppable:{measure:ern,strategy:ufe.WhileDragging,frequency:Uvt.Optimized},dragOverlay:{measure:F3}},L3=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}},Pmi={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new L3,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:fFe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:dFe,measureDroppableContainers:fFe,windowRect:null,measuringScheduled:!1},Mmi={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:fFe,draggableNodes:new Map,over:null,measureDroppableContainers:fFe},gFe=(0,ze.createContext)(Mmi),xrn=(0,ze.createContext)(Pmi);function Rmi(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new L3}}}function Ami(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 L3(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 L3(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 L3(t.droppable.containers);return i.delete(r),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function Imi(t){let{disabled:e}=t,{active:r,activatorEvent:n,draggableNodes:o}=(0,ze.useContext)(gFe),i=lFe(n),a=lFe(r?.id);return(0,ze.useEffect)(()=>{if(!e&&!n&&i&&a!=null){if(!ofe(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=Wtn(c);if(d){d.focus();break}}})}},[n,e,o,a,i]),null}function Nmi(t,e){let{transform:r,...n}=e;return t!=null&&t.length?t.reduce((o,i)=>i({transform:o,...n}),r):r}function jmi(t){return(0,ze.useMemo)(()=>({draggable:{...dFe.draggable,...t?.draggable},droppable:{...dFe.droppable,...t?.droppable},dragOverlay:{...dFe.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function Dmi(t){let{activeNode:e,measure:r,initialRect:n,config:o=!0}=t,i=(0,ze.useRef)(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;$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=mrn(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=hrn(l);f&&f.scrollBy({top:d.y,left:d.x})}},[e,a,s,n,r])}var Orn=(0,ze.createContext)({...Qx,scaleX:1,scaleY:1}),jU;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(jU||(jU={}));var XX=(0,ze.memo)(function(e){var r,n,o,i;let{id:a,accessibility:s,autoScroll:u=!0,children:l,sensors:c=Tmi,collisionDetection:d=Bpi,measuring:f,modifiers:p,...m}=e,h=(0,ze.useReducer)(Ami,void 0,Rmi),[g,y]=h,[b,_]=Dpi(),[w,x]=(0,ze.useState)(jU.Uninitialized),O=w===jU.Initialized,{draggable:{active:E,nodes:T,translate:R},droppable:{containers:N}}=g,D=E!=null?T.get(E):null,F=(0,ze.useRef)({initial:null,translated:null}),B=(0,ze.useMemo)(()=>{var ct;return E!=null?{id:E,data:(ct=D?.data)!=null?ct:Emi,rect:F}:null},[E,D]),U=(0,ze.useRef)(null),[H,G]=(0,ze.useState)(null),[ie,oe]=(0,ze.useState)(null),z=KX(m,Object.values(m)),Q=A3("DndDescribedBy",a),re=(0,ze.useMemo)(()=>N.getEnabled(),[N]),Z=jmi(f),{droppableRects:$,measureDroppableContainers:q,measuringScheduled:Y}=mmi(re,{dragging:O,dependencies:[R.x,R.y],config:Z.droppable}),j=fmi(T,E),A=(0,ze.useMemo)(()=>ie?cFe(ie):null,[ie]),W=Xt(),V=hmi(j,Z.draggable.measure);Dmi({activeNode:E!=null?T.get(E):null,config:W.layoutShiftCompensation,initialRect:V,measure:Z.draggable.measure});let se=irn(j,Z.draggable.measure,V),be=irn(j?j.parentElement:null),Ee=(0,ze.useRef)({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:$,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ae=N.getNodeFor((r=Ee.current.over)==null?void 0:r.id),ht=Omi({measure:Z.dragOverlay.measure}),Rt=(n=ht.nodeRef.current)!=null?n:j,Ze=O?(o=ht.rect)!=null?o:se:null,Dr=!!(ht.nodeRef.current&&ht.rect),Vt=bmi(Dr?null:se),jt=Crn(Rt?zb(Rt):null),Fe=_mi(O?Ae??j:null),hn=Cmi(Fe),gt=Nmi(p,{transform:{x:R.x-Vt.x,y:R.y-Vt.y,scaleX:1,scaleY:1},activatorEvent:ie,active:B,activeNodeRect:se,containerNodeRect:be,draggingNodeRect:Ze,over:Ee.current.over,overlayNodeRect:ht.rect,scrollableAncestors:Fe,scrollableAncestorRects:hn,windowRect:jt}),qe=A?I3(A,R):null,Te=vmi(Fe),Ce=srn(Te),De=srn(Te,[se]),Re=I3(gt,Ce),nt=Ze?Hpi(Ze,gt):null,_n=B&&nt?d({active:B,collisionRect:nt,droppableRects:$,droppableContainers:re,pointerCoordinates:qe}):null,He=zvt(_n,"id"),[wt,_r]=(0,ze.useState)(null),Sl=Dr?gt:I3(gt,De),Vo=Upi(Sl,(i=wt?.rect)!=null?i:null,se),Su=(0,ze.useRef)(null),Wa=(0,ze.useCallback)((ct,pr)=>{let{sensor:Or,options:js}=pr;if(U.current==null)return;let el=T.get(U.current);if(!el)return;let Hc=ct.nativeEvent,Vb=new Or({active:U.current,activeNode:el,event:Hc,options:js,context:Ee,onAbort(xi){if(!T.get(xi))return;let{onDragAbort:Vy}=z.current,hv={id:xi};Vy?.(hv),b({type:"onDragAbort",event:hv})},onPending(xi,St,Vy,hv){if(!T.get(xi))return;let{onDragPending:ZI}=z.current,_i={id:xi,constraint:St,initialCoordinates:Vy,offset:hv};ZI?.(_i),b({type:"onDragPending",event:_i})},onStart(xi){let St=U.current;if(St==null)return;let Vy=T.get(St);if(!Vy)return;let{onDragStart:hv}=z.current,hm={activatorEvent:Hc,active:{id:St,data:Vy.data,rect:F}};(0,D3.unstable_batchedUpdates)(()=>{hv?.(hm),x(jU.Initializing),y({type:Wm.DragStart,initialCoordinates:xi,active:St}),b({type:"onDragStart",event:hm}),G(Su.current),oe(Hc)})},onMove(xi){y({type:Wm.DragMove,coordinates:xi})},onEnd:Hy(Wm.DragEnd),onCancel:Hy(Wm.DragCancel)});Su.current=Vb;function Hy(xi){return async function(){let{active:Vy,collisions:hv,over:hm,scrollAdjustedTranslate:ZI}=Ee.current,_i=null;if(Vy&&ZI){let{cancelDrop:B0}=z.current;_i={activatorEvent:Hc,active:Vy,collisions:hv,delta:ZI,over:hm},xi===Wm.DragEnd&&typeof B0=="function"&&await Promise.resolve(B0(_i))&&(xi=Wm.DragCancel)}U.current=null,(0,D3.unstable_batchedUpdates)(()=>{y({type:xi}),x(jU.Uninitialized),_r(null),G(null),oe(null),Su.current=null;let B0=xi===Wm.DragEnd?"onDragEnd":"onDragCancel";if(_i){let nY=z.current[B0];nY?.(_i),b({type:B0,event:_i})}})}}},[T]),zy=(0,ze.useCallback)((ct,pr)=>(Or,js)=>{let el=Or.nativeEvent,Hc=T.get(js);if(U.current!==null||!Hc||el.dndKit||el.defaultPrevented)return;let Vb={active:Hc};ct(Or,pr.options,Vb)===!0&&(el.dndKit={capturedBy:pr.sensor},U.current=js,Wa(Or,pr))},[T,Wa]),ui=pmi(c,zy);wmi(c),$0(()=>{se&&w===jU.Initializing&&x(jU.Initialized)},[se,w]),(0,ze.useEffect)(()=>{let{onDragMove:ct}=z.current,{active:pr,activatorEvent:Or,collisions:js,over:el}=Ee.current;if(!pr||!Or)return;let Hc={active:pr,activatorEvent:Or,collisions:js,delta:{x:Re.x,y:Re.y},over:el};(0,D3.unstable_batchedUpdates)(()=>{ct?.(Hc),b({type:"onDragMove",event:Hc})})},[Re.x,Re.y]),(0,ze.useEffect)(()=>{let{active:ct,activatorEvent:pr,collisions:Or,droppableContainers:js,scrollAdjustedTranslate:el}=Ee.current;if(!ct||U.current==null||!pr||!el)return;let{onDragOver:Hc}=z.current,Vb=js.get(He),Hy=Vb&&Vb.rect.current?{id:Vb.id,rect:Vb.rect.current,data:Vb.data,disabled:Vb.disabled}:null,xi={active:ct,activatorEvent:pr,collisions:Or,delta:{x:el.x,y:el.y},over:Hy};(0,D3.unstable_batchedUpdates)(()=>{_r(Hy),Hc?.(xi),b({type:"onDragOver",event:xi})})},[He]),$0(()=>{Ee.current={activatorEvent:ie,active:B,activeNode:j,collisionRect:nt,collisions:_n,droppableRects:$,draggableNodes:T,draggingNode:Rt,draggingNodeRect:Ze,droppableContainers:N,over:wt,scrollableAncestors:Fe,scrollAdjustedTranslate:Re},F.current={initial:Ze,translated:nt}},[B,j,_n,nt,T,Rt,Ze,$,N,wt,Fe,Re]),lmi({...W,delta:R,draggingRect:nt,pointerCoordinates:qe,scrollableAncestors:Fe,scrollableAncestorRects:hn});let mv=(0,ze.useMemo)(()=>({active:B,activeNode:j,activeNodeRect:se,activatorEvent:ie,collisions:_n,containerNodeRect:be,dragOverlay:ht,draggableNodes:T,droppableContainers:N,droppableRects:$,over:wt,measureDroppableContainers:q,scrollableAncestors:Fe,scrollableAncestorRects:hn,measuringConfiguration:Z,measuringScheduled:Y,windowRect:jt}),[B,j,se,ie,_n,be,ht,T,N,$,wt,q,Fe,hn,Z,Y,jt]),q0=(0,ze.useMemo)(()=>({activatorEvent:ie,activators:ui,active:B,activeNodeRect:se,ariaDescribedById:{draggable:Q},dispatch:y,draggableNodes:T,over:wt,measureDroppableContainers:q}),[ie,ui,B,se,y,Q,T,wt,q]);return ze.default.createElement(crn.Provider,{value:_},ze.default.createElement(gFe.Provider,{value:q0},ze.default.createElement(xrn.Provider,{value:mv},ze.default.createElement(Orn.Provider,{value:Vo},l)),ze.default.createElement(Imi,{disabled:s?.restoreFocus===!1})),ze.default.createElement(Fpi,{...s,hiddenTextDescribedById:Q}));function Xt(){let ct=H?.autoScrollEnabled===!1,pr=typeof u=="object"?u.enabled===!1:u===!1,Or=O&&!ct&&!pr;return typeof u=="object"?{...u,enabled:Or}:{enabled:Or}}}),$mi=(0,ze.createContext)(null),lrn="button",Lmi="Draggable";function Trn(t){let{id:e,data:r,disabled:n=!1,attributes:o}=t,i=A3(Lmi),{activators:a,activatorEvent:s,active:u,activeNodeRect:l,ariaDescribedById:c,draggableNodes:d,over:f}=(0,ze.useContext)(gFe),{role:p=lrn,roleDescription:m="draggable",tabIndex:h=0}=o??{},g=u?.id===e,y=(0,ze.useContext)(g?Orn:$mi),[b,_]=nfe(),[w,x]=nfe(),O=Smi(a,e),E=KX(r);$0(()=>(d.set(e,{id:e,key:i,node:b,activatorNode:w,data:E}),()=>{let R=d.get(e);R&&R.key===i&&d.delete(e)}),[d,e]);let T=(0,ze.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":n,"aria-pressed":g&&p===lrn?!0:void 0,"aria-roledescription":m,"aria-describedby":c.draggable}),[n,p,h,g,m,c.draggable]);return{active:u,activatorEvent:s,activeNodeRect:l,attributes:T,isDragging:g,listeners:n?void 0:O,node:b,over:f,setNodeRef:_,setActivatorNodeRef:x,transform:y}}function Ern(){return(0,ze.useContext)(xrn)}var Fmi="Droppable",kmi={timeout:25};function Prn(t){let{data:e,disabled:r=!1,id:n,resizeObserverConfig:o}=t,i=A3(Fmi),{active:a,dispatch:s,over:u,measureDroppableContainers:l}=(0,ze.useContext)(gFe),c=(0,ze.useRef)({disabled:r}),d=(0,ze.useRef)(!1),f=(0,ze.useRef)(null),p=(0,ze.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...kmi,...o},y=KX(h??n),b=(0,ze.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(y.current)?y.current:[y.current]),p.current=null},g)},[g]),_=hFe({callback:b,disabled:m||!a}),w=(0,ze.useCallback)((T,R)=>{_&&(R&&(_.unobserve(R),d.current=!1),T&&_.observe(T))},[_]),[x,O]=nfe(w),E=KX(e);return(0,ze.useEffect)(()=>{!_||!x.current||(_.disconnect(),d.current=!1,_.observe(x.current))},[x,_]),(0,ze.useEffect)(()=>(s({type:Wm.RegisterDroppable,element:{id:n,key:i,disabled:r,node:x,rect:f,data:E}}),()=>s({type:Wm.UnregisterDroppable,key:i,id:n})),[n]),(0,ze.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:x,over:u,setNodeRef:O}}function vFe(t,e,r){let n=t.slice();return n.splice(r<0?n.length+r:r,0,n.splice(e,1)[0]),n}function qmi(t,e){return t.reduce((r,n,o)=>{let i=e.get(n);return i&&(r[o]=i),r},Array(t.length))}function yFe(t){return t!==null&&t>=0}function Bmi(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 Umi(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}var Mrn=t=>{let{rects:e,activeIndex:r,overIndex:n,index:o}=t,i=vFe(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 bFe={scaleX:1,scaleY:1},YX=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,...bFe}:null}let u=zmi(i,o,r);return o>r&&o<=a?{x:0,y:-s.height-u,...bFe}:o<r&&o>=a?{x:0,y:s.height+u,...bFe}:{x:0,y:0,...bFe}};function zmi(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 Rrn="Sortable",Arn=ld.default.createContext({activeIndex:-1,containerId:Rrn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Mrn,disabled:{draggable:!1,droppable:!1}});function QX(t){let{children:e,id:r,items:n,strategy:o=Mrn,disabled:i=!1}=t,{active:a,dragOverlay:s,droppableRects:u,over:l,measureDroppableContainers:c}=Ern(),d=A3(Rrn,r),f=s.rect!==null,p=(0,ld.useMemo)(()=>n.map(O=>typeof O=="object"&&"id"in O?O.id:O),[n]),m=a!=null,h=a?p.indexOf(a.id):-1,g=l?p.indexOf(l.id):-1,y=(0,ld.useRef)(p),b=!Bmi(p,y.current),_=g!==-1&&h===-1||b,w=Umi(i);$0(()=>{b&&m&&c(p)},[b,p,m,c]),(0,ld.useEffect)(()=>{y.current=p},[p]);let x=(0,ld.useMemo)(()=>({activeIndex:h,containerId:d,disabled:w,disableTransforms:_,items:p,overIndex:g,useDragOverlay:f,sortedRects:qmi(p,u),strategy:o}),[h,d,w.draggable,w.droppable,_,p,g,u,f,o]);return ld.default.createElement(Arn.Provider,{value:x},e)}var Hmi=t=>{let{id:e,items:r,activeIndex:n,overIndex:o}=t;return vFe(r,n,o).indexOf(e)},Vmi=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},Jmi={duration:200,easing:"ease"},Irn="transform",Kmi=D0.Transition.toString({property:Irn,duration:0,easing:"linear"}),Wmi={roleDescription:"sortable"};function Gmi(t){let{disabled:e,index:r,node:n,rect:o}=t,[i,a]=(0,ld.useState)(null),s=(0,ld.useRef)(r);return $0(()=>{if(!e&&r!==s.current&&n.current){let u=o.current;if(u){let l=F3(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,ld.useEffect)(()=>{i&&a(null)},[i]),i}function eY(t){let{animateLayoutChanges:e=Vmi,attributes:r,disabled:n,data:o,getNewIndex:i=Hmi,id:a,strategy:s,resizeObserverConfig:u,transition:l=Jmi}=t,{items:c,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:y,strategy:b}=(0,ld.useContext)(Arn),_=Zmi(n,p),w=c.indexOf(a),x=(0,ld.useMemo)(()=>({sortable:{containerId:d,index:w,items:c},...o}),[d,o,w,c]),O=(0,ld.useMemo)(()=>c.slice(c.indexOf(a)),[c,a]),{rect:E,node:T,isOver:R,setNodeRef:N}=Prn({id:a,data:x,disabled:_.droppable,resizeObserverConfig:{updateMeasurementsFor:O,...u}}),{active:D,activatorEvent:F,activeNodeRect:B,attributes:U,setNodeRef:H,listeners:G,isDragging:ie,over:oe,setActivatorNodeRef:z,transform:Q}=Trn({id:a,data:x,attributes:{...Wmi,...r},disabled:_.draggable}),re=Vtn(N,H),Z=!!D,$=Z&&!m&&yFe(f)&&yFe(g),q=!y&&ie,Y=q&&$?Q:null,A=$?Y??(s??b)({rects:h,activeNodeRect:B,activeIndex:f,overIndex:g,index:w}):null,W=yFe(f)&&yFe(g)?i({id:a,items:c,activeIndex:f,overIndex:g}):w,V=D?.id,se=(0,ld.useRef)({activeId:V,items:c,newIndex:W,containerId:d}),be=c!==se.current.items,Ee=e({active:D,containerId:d,isDragging:ie,isSorting:Z,id:a,index:w,items:c,newIndex:se.current.newIndex,previousItems:se.current.items,previousContainerId:se.current.containerId,transition:l,wasDragging:se.current.activeId!=null}),Ae=Gmi({disabled:!Ee,index:w,node:T,rect:E});return(0,ld.useEffect)(()=>{Z&&se.current.newIndex!==W&&(se.current.newIndex=W),d!==se.current.containerId&&(se.current.containerId=d),c!==se.current.items&&(se.current.items=c)},[Z,W,d,c]),(0,ld.useEffect)(()=>{if(V===se.current.activeId)return;if(V!=null&&se.current.activeId==null){se.current.activeId=V;return}let Rt=setTimeout(()=>{se.current.activeId=V},50);return()=>clearTimeout(Rt)},[V]),{active:D,activeIndex:f,attributes:U,data:x,rect:E,index:w,newIndex:W,items:c,isOver:R,isSorting:Z,isDragging:ie,listeners:G,node:T,overIndex:g,over:oe,setNodeRef:re,setActivatorNodeRef:z,setDroppableNodeRef:N,setDraggableNodeRef:H,transform:Ae??A,transition:ht()};function ht(){if(Ae||be&&se.current.newIndex===w)return Kmi;if(!(q&&!ofe(F)||!l)&&(Z||Ee))return D0.Transition.toString({...l,property:Irn})}}function Zmi(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 _Fe(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 Xmi=[Ni.Down,Ni.Right,Ni.Up,Ni.Left],wFe=(t,e)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=e;if(Xmi.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 Ni.Down:n.top<f.top&&u.push(d);break;case Ni.Up:n.top>f.top&&u.push(d);break;case Ni.Left:n.left>f.left&&u.push(d);break;case Ni.Right:n.left<f.left&&u.push(d);break}});let l=prn({active:r,collisionRect:n,droppableRects:o,droppableContainers:u,pointerCoordinates:null}),c=zvt(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 g=lfe(m).some((O,E)=>s[E]!==O),y=Nrn(d,f),b=Ymi(d,f),_=g||!y?{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:N3(w,_)}}}};function Nrn(t,e){return!_Fe(t)||!_Fe(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Ymi(t,e){return!_Fe(t)||!_Fe(e)||!Nrn(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}On();function SFe({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,g]=(0,Zs.useState)(u),{attributes:y,listeners:b,setNodeRef:_,transform:w,transition:x,isDragging:O}=eY({id:t,disabled:!a}),E={transform:D0.Transform.toString(w),transition:x},T=()=>{if(s){let N=!h;g(N),m?.(N)}},R=d.length>0;return Zs.default.createElement(S3,{ref:_,style:E,className:Oe("tw-mb-2",O&&["tw-opacity-90","tw-shadow-lg","tw-border-accent/50","tw-relative","tw-z-[9999]","tw-bg-primary","tw-rounded-lg","tw-transform-gpu"],a&&"tw-touch-manipulation",p)},Zs.default.createElement(C3,{className:"tw-p-3"},Zs.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},a&&Zs.default.createElement("div",{className:"tw-mr-2 tw-cursor-grab tw-touch-none active:tw-cursor-grabbing",...y,...b},Zs.default.createElement(cC,{className:"tw-size-4"})),Zs.default.createElement("div",{className:"tw-flex-1 tw-touch-auto",onClick:s?T:void 0,style:{cursor:s?"pointer":"default"}},Zs.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},s&&Zs.default.createElement("div",{className:"tw-flex tw-size-3 tw-items-center tw-justify-center"},h?Zs.default.createElement(Qs,{className:"tw-size-3 tw-stroke-[7]"}):Zs.default.createElement(tg,{className:"tw-size-3 tw-stroke-[7]"})),i&&Zs.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},i),Zs.default.createElement("div",{className:"tw-min-w-0 tw-flex-1"},Zs.default.createElement("div",{className:"tw-break-words tw-font-medium tw-leading-relaxed"},r,o&&Zs.default.createElement("span",{className:"tw-ml-1 tw-inline-flex tw-items-center"},o)),n&&Zs.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Zs.default.createElement("span",{className:"tw-bg-secondary tw-text-sm tw-text-muted"},n))))),Zs.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},c&&Zs.default.createElement(ve,{variant:"ghost",size:"icon",onClick:N=>{N.stopPropagation(),c.onClick(e)},title:c.tooltip},c.icon),R&&Zs.default.createElement(PI,null,Zs.default.createElement(MI,{asChild:!0},Zs.default.createElement(ve,{variant:"ghost",size:"icon"},Zs.default.createElement(kO,{className:"tw-size-4"}))),Zs.default.createElement(Y_,{align:"end",container:f?.current},d.map((N,D)=>Zs.default.createElement(Ai,{key:D,onClick:F=>{F.stopPropagation(),N.onClick(e)},className:Oe(N.variant==="destructive"&&"tw-text-error")},Zs.default.createElement("span",{className:"tw-mr-2 tw-flex tw-size-4 tw-items-center tw-justify-center"},N.icon),N.label))))))),s&&Zs.default.createElement("div",{className:Oe("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")},Zs.default.createElement(x3,{className:"tw-p-3 tw-pt-0"},l)))}On();var Gm=L(X());jn();var cfe=Gm.forwardRef(({className:t,...e},r)=>Gm.createElement("div",{className:"tw-relative tw-w-full tw-overflow-auto"},Gm.createElement("table",{ref:r,className:Oe("tw-w-full tw-caption-bottom tw-border-collapse tw-text-sm",t),...e})));cfe.displayName="Table";var dfe=Gm.forwardRef(({className:t,...e},r)=>Gm.createElement("thead",{ref:r,className:Oe("[&_tr]:tw-border-b",t),...e}));dfe.displayName="TableHeader";var ffe=Gm.forwardRef(({className:t,...e},r)=>Gm.createElement("tbody",{ref:r,className:t,...e}));ffe.displayName="TableBody";var Qmi=Gm.forwardRef(({className:t,...e},r)=>Gm.createElement("tfoot",{ref:r,className:Oe("tw-border-t tw-font-medium tw-bg-primary-alt/50",t),...e}));Qmi.displayName="TableFooter";var LU=Gm.forwardRef(({className:t,...e},r)=>Gm.createElement("tr",{ref:r,className:Oe("tw-border-b tw-transition-colors hover:tw-bg-primary-alt/50 data-[state=selected]:tw-bg-primary-alt",t),...e}));LU.displayName="TableRow";var Hb=Gm.forwardRef(({className:t,...e},r)=>Gm.createElement("th",{ref:r,className:Oe("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}));Hb.displayName="TableHead";var By=Gm.forwardRef(({className:t,...e},r)=>Gm.createElement("td",{ref:r,className:Oe("tw-p-2 tw-align-middle [&:has([role=checkbox])]:tw-pr-0 [&>[role=checkbox]]:tw-translate-y-[2px]",t),...e}));By.displayName="TableCell";var ehi=Gm.forwardRef(({className:t,...e},r)=>Gm.createElement("caption",{ref:r,className:Oe("tw-mt-4 tw-text-sm tw-text-muted",t),...e}));ehi.displayName="TableCaption";jn();Dt();Pt();iee();var wl=L(X());jn();On();var Ug=L(X());var Qu=L(X(),1);function WI(t,e,{checkForDefaultPrevented:r=!0}={}){return function(o){if(t?.(o),r===!1||!o.defaultPrevented)return e?.(o)}}var Drn=L(X(),1);function jrn(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Hvt(...t){return e=>{let r=!1,n=t.map(o=>{let i=jrn(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():jrn(t[o],null)}}}}function k$(...t){return Drn.useCallback(Hvt(...t),t)}var Cc=L(X(),1);var $rn=L(X(),1),Lrn=L(Bu(),1);var Bg=L(X(),1);var tY=L(mt(),1),pfe=Bg.forwardRef((t,e)=>{let{children:r,...n}=t,o=Bg.Children.toArray(r),i=o.find(rhi);if(i){let a=i.props.children,s=o.map(u=>u===i?Bg.Children.count(a)>1?Bg.Children.only(null):Bg.isValidElement(a)?a.props.children:null:u);return(0,tY.jsx)(Vvt,{...n,ref:e,children:Bg.isValidElement(a)?Bg.cloneElement(a,void 0,s):null})}return(0,tY.jsx)(Vvt,{...n,ref:e,children:r})});pfe.displayName="Slot";var Vvt=Bg.forwardRef((t,e)=>{let{children:r,...n}=t;if(Bg.isValidElement(r)){let o=ohi(r);return Bg.cloneElement(r,{...nhi(n,r.props),ref:e?Hvt(e,o):o})}return Bg.Children.count(r)>1?Bg.Children.only(null):null});Vvt.displayName="SlotClone";var thi=({children:t})=>(0,tY.jsx)(tY.Fragment,{children:t});function rhi(t){return Bg.isValidElement(t)&&t.type===thi}function nhi(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 ohi(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 Frn=L(mt(),1),ihi=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Mw=ihi.reduce((t,e)=>{let r=$rn.forwardRef((n,o)=>{let{asChild:i,...a}=n,s=i?pfe:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Frn.jsx)(s,{...a,ref:o})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function krn(t,e){t&&Lrn.flushSync(()=>t.dispatchEvent(e))}var Kvt=L(mt(),1),ahi="DismissableLayer",Jvt="dismissableLayer.update",shi="dismissableLayer.pointerDownOutside",uhi="dismissableLayer.focusOutside",qrn,Urn=Cc.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wvt=Cc.forwardRef((t,e)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...u}=t,l=Cc.useContext(Urn),[c,d]=Cc.useState(null),f=c?.ownerDocument??globalThis?.document,[,p]=Cc.useState({}),m=k$(e,E=>d(E)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=h.indexOf(g),b=c?h.indexOf(c):-1,_=l.layersWithOutsidePointerEventsDisabled.size>0,w=b>=y,x=dhi(E=>{let T=E.target,R=[...l.branches].some(N=>N.contains(T));!w||R||(o?.(E),a?.(E),E.defaultPrevented||s?.())},f),O=fhi(E=>{let T=E.target;[...l.branches].some(N=>N.contains(T))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return CLe(E=>{b===l.layers.size-1&&(n?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},f),Cc.useEffect(()=>{if(c)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(qrn=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(c)),l.layers.add(c),Brn(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=qrn)}},[c,f,r,l]),Cc.useEffect(()=>()=>{c&&(l.layers.delete(c),l.layersWithOutsidePointerEventsDisabled.delete(c),Brn())},[c,l]),Cc.useEffect(()=>{let E=()=>p({});return document.addEventListener(Jvt,E),()=>document.removeEventListener(Jvt,E)},[]),(0,Kvt.jsx)(Mw.div,{...u,ref:m,style:{pointerEvents:_?w?"auto":"none":void 0,...t.style},onFocusCapture:WI(t.onFocusCapture,O.onFocusCapture),onBlurCapture:WI(t.onBlurCapture,O.onBlurCapture),onPointerDownCapture:WI(t.onPointerDownCapture,x.onPointerDownCapture)})});Wvt.displayName=ahi;var lhi="DismissableLayerBranch",chi=Cc.forwardRef((t,e)=>{let r=Cc.useContext(Urn),n=Cc.useRef(null),o=k$(e,n);return Cc.useEffect(()=>{let i=n.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),(0,Kvt.jsx)(Mw.div,{...t,ref:o})});chi.displayName=lhi;function dhi(t,e=globalThis?.document){let r=ad(t),n=Cc.useRef(!1),o=Cc.useRef(()=>{});return Cc.useEffect(()=>{let i=s=>{if(s.target&&!n.current){let l=function(){zrn(shi,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 fhi(t,e=globalThis?.document){let r=ad(t),n=Cc.useRef(!1);return Cc.useEffect(()=>{let o=i=>{i.target&&!n.current&&zrn(uhi,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 Brn(){let t=new CustomEvent(Jvt);document.dispatchEvent(t)}function zrn(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?krn(o,i):o.dispatchEvent(i)}var F0=L(X(),1);var Wrn=L(mt(),1),Gvt="focusScope.autoFocusOnMount",Zvt="focusScope.autoFocusOnUnmount",Hrn={bubbles:!1,cancelable:!0},phi="FocusScope",Xvt=F0.forwardRef((t,e)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=t,[s,u]=F0.useState(null),l=ad(o),c=ad(i),d=F0.useRef(null),f=k$(e,h=>u(h)),p=F0.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;F0.useEffect(()=>{if(n){let b=function(O){if(p.paused||!s)return;let E=O.target;s.contains(E)?d.current=E:FU(d.current,{select:!0})},_=function(O){if(p.paused||!s)return;let E=O.relatedTarget;E!==null&&(s.contains(E)||FU(d.current,{select:!0}))},w=function(O){if(document.activeElement===document.body)for(let T of O)T.removedNodes.length>0&&FU(s)};var h=b,g=_,y=w;document.addEventListener("focusin",b),document.addEventListener("focusout",_);let x=new MutationObserver(w);return s&&x.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",_),x.disconnect()}}},[n,s,p.paused]),F0.useEffect(()=>{if(s){Jrn.add(p);let h=document.activeElement;if(!s.contains(h)){let y=new CustomEvent(Gvt,Hrn);s.addEventListener(Gvt,l),s.dispatchEvent(y),y.defaultPrevented||(mhi(_hi(Grn(s)),{select:!0}),document.activeElement===h&&FU(s))}return()=>{s.removeEventListener(Gvt,l),setTimeout(()=>{let y=new CustomEvent(Zvt,Hrn);s.addEventListener(Zvt,c),s.dispatchEvent(y),y.defaultPrevented||FU(h??document.body,{select:!0}),s.removeEventListener(Zvt,c),Jrn.remove(p)},0)}}},[s,l,c,p]);let m=F0.useCallback(h=>{if(!r&&!n||p.paused)return;let g=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,y=document.activeElement;if(g&&y){let b=h.currentTarget,[_,w]=hhi(b);_&&w?!h.shiftKey&&y===w?(h.preventDefault(),r&&FU(_,{select:!0})):h.shiftKey&&y===_&&(h.preventDefault(),r&&FU(w,{select:!0})):y===b&&h.preventDefault()}},[r,n,p.paused]);return(0,Wrn.jsx)(Mw.div,{tabIndex:-1,...a,ref:f,onKeyDown:m})});Xvt.displayName=phi;function mhi(t,{select:e=!1}={}){let r=document.activeElement;for(let n of t)if(FU(n,{select:e}),document.activeElement!==r)return}function hhi(t){let e=Grn(t),r=Vrn(e,t),n=Vrn(e.reverse(),t);return[r,n]}function Grn(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 Vrn(t,e){for(let r of t)if(!ghi(r,{upTo:e}))return r}function ghi(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 yhi(t){return t instanceof HTMLInputElement&&"select"in t}function FU(t,{select:e=!1}={}){if(t&&t.focus){let r=document.activeElement;t.focus({preventScroll:!0}),t!==r&&yhi(t)&&e&&t.select()}}var Jrn=bhi();function bhi(){let t=[];return{add(e){let r=t[0];e!==r&&r?.pause(),t=Krn(t,e),t.unshift(e)},remove(e){t=Krn(t,e),t[0]?.resume()}}}function Krn(t,e){let r=[...t],n=r.indexOf(e);return n!==-1&&r.splice(n,1),r}function _hi(t){return t.filter(e=>e.tagName!=="A")}var CFe=L(X(),1),Zrn=L(Bu(),1);var Xrn=L(mt(),1),vhi="Portal",Yvt=CFe.forwardRef((t,e)=>{let{container:r,...n}=t,[o,i]=CFe.useState(!1);gl(()=>i(!0),[]);let a=r||o&&globalThis?.document?.body;return a?Zrn.default.createPortal((0,Xrn.jsx)(Mw.div,{...n,ref:e}),a):null});Yvt.displayName=vhi;var wu=L(mt(),1),Qvt="Dialog",[Yrn,CBs]=TB(Qvt),[whi,eO]=Yrn(Qvt),Qrn=t=>{let{__scopeDialog:e,children:r,open:n,defaultOpen:o,onOpenChange:i,modal:a=!0}=t,s=Qu.useRef(null),u=Qu.useRef(null),[l=!1,c]=GD({prop:n,defaultProp:o,onChange:i});return(0,wu.jsx)(whi,{scope:e,triggerRef:s,contentRef:u,contentId:JI(),titleId:JI(),descriptionId:JI(),open:l,onOpenChange:c,onOpenToggle:Qu.useCallback(()=>c(d=>!d),[c]),modal:a,children:r})};Qrn.displayName=Qvt;var enn="DialogTrigger",tnn=Qu.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=eO(enn,r),i=k$(e,o.triggerRef);return(0,wu.jsx)(Mw.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":rwt(o.open),...n,ref:i,onClick:WI(t.onClick,o.onOpenToggle)})});tnn.displayName=enn;var ewt="DialogPortal",[Shi,rnn]=Yrn(ewt,{forceMount:void 0}),nnn=t=>{let{__scopeDialog:e,forceMount:r,children:n,container:o}=t,i=eO(ewt,e);return(0,wu.jsx)(Shi,{scope:e,forceMount:r,children:Qu.Children.map(n,a=>(0,wu.jsx)(ZD,{present:r||i.open,children:(0,wu.jsx)(Yvt,{asChild:!0,container:o,children:a})}))})};nnn.displayName=ewt;var xFe="DialogOverlay",onn=Qu.forwardRef((t,e)=>{let r=rnn(xFe,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=eO(xFe,t.__scopeDialog);return i.modal?(0,wu.jsx)(ZD,{present:n||i.open,children:(0,wu.jsx)(Chi,{...o,ref:e})}):null});onn.displayName=xFe;var Chi=Qu.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=eO(xFe,r);return(0,wu.jsx)(Dde,{as:pfe,allowPinchZoom:!0,shards:[o.contentRef],children:(0,wu.jsx)(Mw.div,{"data-state":rwt(o.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),k3="DialogContent",inn=Qu.forwardRef((t,e)=>{let r=rnn(k3,t.__scopeDialog),{forceMount:n=r.forceMount,...o}=t,i=eO(k3,t.__scopeDialog);return(0,wu.jsx)(ZD,{present:n||i.open,children:i.modal?(0,wu.jsx)(xhi,{...o,ref:e}):(0,wu.jsx)(Ohi,{...o,ref:e})})});inn.displayName=k3;var xhi=Qu.forwardRef((t,e)=>{let r=eO(k3,t.__scopeDialog),n=Qu.useRef(null),o=k$(e,r.contentRef,n);return Qu.useEffect(()=>{let i=n.current;if(i)return JB(i)},[]),(0,wu.jsx)(ann,{...t,ref:o,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:WI(t.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:WI(t.onPointerDownOutside,i=>{let a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:WI(t.onFocusOutside,i=>i.preventDefault())})}),Ohi=Qu.forwardRef((t,e)=>{let r=eO(k3,t.__scopeDialog),n=Qu.useRef(!1),o=Qu.useRef(!1);return(0,wu.jsx)(ann,{...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()}})}),ann=Qu.forwardRef((t,e)=>{let{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=t,s=eO(k3,r),u=Qu.useRef(null),l=k$(e,u);return xLe(),(0,wu.jsxs)(wu.Fragment,{children:[(0,wu.jsx)(Xvt,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:o,onUnmountAutoFocus:i,children:(0,wu.jsx)(Wvt,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":rwt(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,wu.jsxs)(wu.Fragment,{children:[(0,wu.jsx)(Thi,{titleId:s.titleId}),(0,wu.jsx)(Phi,{contentRef:u,descriptionId:s.descriptionId})]})]})}),twt="DialogTitle",snn=Qu.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=eO(twt,r);return(0,wu.jsx)(Mw.h2,{id:o.titleId,...n,ref:e})});snn.displayName=twt;var unn="DialogDescription",lnn=Qu.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=eO(unn,r);return(0,wu.jsx)(Mw.p,{id:o.descriptionId,...n,ref:e})});lnn.displayName=unn;var cnn="DialogClose",dnn=Qu.forwardRef((t,e)=>{let{__scopeDialog:r,...n}=t,o=eO(cnn,r);return(0,wu.jsx)(Mw.button,{type:"button",...n,ref:e,onClick:WI(t.onClick,()=>o.onOpenChange(!1))})});dnn.displayName=cnn;function rwt(t){return t?"open":"closed"}var fnn="DialogTitleWarning",[xBs,pnn]=aHr(fnn,{contentName:k3,titleName:twt,docsSlug:"dialog"}),Thi=({titleId:t})=>{let e=pnn(fnn),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 Qu.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},Ehi="DialogDescriptionWarning",Phi=({contentRef:t,descriptionId:e})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pnn(Ehi).contentName}}.`;return Qu.useEffect(()=>{let o=t.current?.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},mnn=Qrn,hnn=tnn,gnn=nnn,nwt=onn,owt=inn,iwt=snn,awt=lnn,ynn=dnn;On();jn();var OFe=mnn,bnn=hnn,Rhi=gnn;var _nn=Ug.forwardRef(({className:t,...e},r)=>Ug.createElement(nwt,{ref:r,className:Oe("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}));_nn.displayName=nwt.displayName;var mfe=Ug.forwardRef(({className:t,children:e,container:r,...n},o)=>Ug.createElement(Rhi,{container:r},Ug.createElement(_nn,null),Ug.createElement(owt,{ref:o,className:Oe("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(ynn,{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(pi,{className:"tw-size-4"}),Ug.createElement("span",{className:"tw-sr-only"},"Close")))));mfe.displayName=owt.displayName;var hfe=({className:t,...e})=>Ug.createElement("div",{className:Oe("tw-flex tw-flex-col tw-space-y-0.5 tw-text-center sm:tw-text-left",t),...e});hfe.displayName="DialogHeader";var Ahi=({className:t,...e})=>Ug.createElement("div",{className:Oe("tw-flex tw-flex-col-reverse sm:tw-flex-row sm:tw-justify-end sm:tw-space-x-2",t),...e});Ahi.displayName="DialogFooter";var gfe=Ug.forwardRef(({className:t,...e},r)=>Ug.createElement(iwt,{ref:r,className:Oe("tw-mt-0 tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",t),...e}));gfe.displayName=iwt.displayName;var yfe=Ug.forwardRef(({className:t,...e},r)=>Ug.createElement(awt,{ref:r,className:Oe("tw-text-sm tw-text-muted",t),...e}));yfe.displayName=awt.displayName;wr();function on(t){let{title:e,description:r,className:n,disabled:o}=t,{modalContainer:i}=VX(),a="onChange"in t?t.onChange:void 0,s=(0,wl.useMemo)(()=>{if(a)return Uhe(l=>{a(l)},1e3)},[a]),u=()=>{switch(t.type){case"text":case"number":return wl.default.createElement(yi,{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 wl.default.createElement(HI,{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 wl.default.createElement(Cx,{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 wl.default.createElement(CZ,{checked:t.checked,onCheckedChange:t.onCheckedChange,disabled:o});case"select":return wl.default.createElement("div",{className:"tw-group tw-relative tw-w-full sm:tw-w-[200px]"},wl.default.createElement("select",{value:t.value?.toString(),onChange:l=>t.onChange?.(l.target.value),disabled:o,className:Oe("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&&wl.default.createElement("option",{value:"",disabled:!0},t.placeholder),t.options.map(l=>wl.default.createElement("option",{key:l.value,value:l.value.toString()},l.label))),wl.default.createElement("div",{className:Oe("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")},wl.default.createElement(Qs,{className:"tw-size-4"})));case"slider":return wl.default.createElement(Gde,{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 wl.default.createElement(OFe,null,wl.default.createElement(bnn,{asChild:!0},t.trigger),wl.default.createElement(mfe,{container:i},(t.dialogTitle||t.dialogDescription)&&wl.default.createElement(hfe,null,t.dialogTitle&&wl.default.createElement(gfe,null,t.dialogTitle),t.dialogDescription&&wl.default.createElement(yfe,null,t.dialogDescription)),t.children));case"custom":return t.children}};return wl.default.createElement("div",{className:Oe("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)},wl.default.createElement("div",{className:"tw-w-full tw-space-y-1.5 sm:tw-w-[300px]"},wl.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-leading-none"},e),r&&wl.default.createElement("div",{className:"tw-text-xs tw-text-muted"},r)),wl.default.createElement("div",{className:"tw-w-full tw-flex-1 sm:tw-flex sm:tw-justify-end"},u()))}var TFe=require("obsidian"),Ihi=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o,containerRef:i})=>{let a=l=>{new AB(app,e,l,async d=>{await r(d,l.title)}).open()},s=[{icon:vt.default.createElement(uS,{className:"tw-size-4"}),label:"Edit",onClick:a},{icon:vt.default.createElement(h_,{className:"tw-size-4"}),label:"Copy",onClick:o},{icon:vt.default.createElement(cy,{className:"tw-size-4"}),label:"Delete",onClick:l=>{new lm(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=vt.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-justify-around"},vt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},vt.default.createElement("span",{className:"tw-text-sm tw-font-medium"},"In Menu"),vt.default.createElement(Ci,{content:vt.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.")})),vt.default.createElement(sd,{checked:t.showInContextMenu,onCheckedChange:l=>{r({...t,showInContextMenu:l===!0},t.title)}})),vt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2"},vt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},vt.default.createElement("span",{className:"tw-text-sm tw-font-medium"},"In Slash"),vt.default.createElement(Ci,{content:vt.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.")})),vt.default.createElement(sd,{checked:t.showInSlashMenu,onCheckedChange:l=>r({...t,showInSlashMenu:l===!0},t.title)})));return vt.default.createElement(SFe,{id:t.title,item:t,title:t.title,isDraggable:!0,isExpandable:!0,expandedContent:u,primaryAction:{icon:vt.default.createElement(uS,{className:"tw-size-4"}),onClick:a,tooltip:"Edit Command"},dropdownActions:s,containerRef:i})},Nhi=({command:t,commands:e,onUpdate:r,onRemove:n,onCopy:o})=>{let{attributes:i,listeners:a,setNodeRef:s,transform:u,transition:l,isDragging:c}=eY({id:t.title}),d={transform:D0.Transform.toString(u),transition:l},f=()=>{n(t)};return vt.default.createElement(LU,{ref:s,style:d,className:Oe("tw-transition-colors",c&&"tw-relative tw-z-[100] tw-cursor-grabbing tw-shadow-lg tw-backdrop-blur-sm tw-border-accent/50")},vt.default.createElement(By,{className:"tw-w-10"},vt.default.createElement("div",{...i,...a,className:"tw-flex tw-cursor-grab tw-items-center tw-justify-center"},vt.default.createElement(cC,{className:"tw-size-4"}))),vt.default.createElement(By,null,t.title),vt.default.createElement(By,{className:"tw-text-center"},vt.default.createElement(sd,{checked:t.showInContextMenu,onCheckedChange:p=>{r({...t,showInContextMenu:p===!0},t.title)},className:"tw-mx-auto"})),vt.default.createElement(By,{className:"tw-text-center"},vt.default.createElement(sd,{checked:t.showInSlashMenu,onCheckedChange:p=>r({...t,showInSlashMenu:p===!0},t.title),className:"tw-mx-auto"})),vt.default.createElement(By,{className:"tw-text-center"},vt.default.createElement("div",{className:"tw-flex tw-justify-center tw-space-x-1"},vt.default.createElement(ve,{variant:"ghost",size:"icon",onClick:()=>{new AB(app,e,t,async m=>{await r(m,t.title)}).open()}},vt.default.createElement(uS,{className:"tw-size-4"})),vt.default.createElement(ve,{variant:"ghost",size:"icon",onClick:()=>o(t),title:"Copy command"},vt.default.createElement(h_,{className:"tw-size-4"})),vt.default.createElement(ve,{variant:"ghost",size:"icon",onClick:()=>{new lm(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()}},vt.default.createElement(cy,{className:"tw-size-4"})))))},vnn=()=>{let t=hje(),e=(0,vt.useMemo)(()=>dce([...t]),[t]),r=So(),n=(0,vt.useRef)(null),o=mFe(GX($U,{activationConstraint:{distance:8}}),GX(DU,{coordinateGetter:wFe})),i=async(d,f)=>{await jg.getInstance().updateCommand(d,f)},a=async d=>{await jg.getInstance().createCommand(d)},s=async d=>{try{await jg.getInstance().deleteCommand(d),new TFe.Notice(`Command "${d.title}" deleted successfully!`)}catch(f){throw ue("Failed to delete command:",f),new TFe.Notice("Failed to delete command. Please try again."),f}},u=async d=>{try{let f=CHr(d.title,e),p={...d,title:f};await jg.getInstance().createCommand(p,{autoOrder:!1})}catch(f){ue("Failed to copy command:",f),new TFe.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 g=[...e],[y]=g.splice(m,1);g.splice(h,0,y),await jg.getInstance().reorderCommands(g)},c=()=>vt.default.createElement("div",{className:"tw-relative md:tw-hidden"},vt.default.createElement(XX,{sensors:o,collisionDetection:ZX,onDragEnd:l},vt.default.createElement(QX,{items:e.map(d=>d.title),strategy:YX},vt.default.createElement("div",{className:"tw-space-y-2"},e.length===0?vt.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=>vt.default.createElement(Ihi,{key:d.title,command:d,commands:e,onUpdate:i,onRemove:s,onCopy:u,containerRef:n}))))));return vt.default.createElement("div",{className:"tw-space-y-4",ref:n},vt.default.createElement("section",null,vt.default.createElement("div",{className:"tw-mb-4 tw-flex tw-flex-col tw-gap-2"},vt.default.createElement("div",{className:"tw-text-xl tw-font-bold"},"Custom Commands"),vt.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 ",vt.default.createElement("code",null,"/")," command in the chat to load them into your chat input.")),vt.default.createElement(on,{type:"text",title:"Custom Prompts Folder Name",description:"Folder where custom prompts are stored",value:r.customPromptsFolder,onChange:d=>{et("customPromptsFolder",d),yje()},placeholder:"copilot/copilot-custom-prompts"}),vt.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=>{et("enableCustomPromptTemplating",d)}}),vt.default.createElement(on,{type:"select",title:"Custom Prompts Sort Strategy",description:"Sort order for slash command menu prompts",value:r.promptSortStrategy,onChange:d=>et("promptSortStrategy",d),options:[{label:"Recency",value:"timestamp"},{label:"Alphabetical",value:"alphabetical"},{label:"Manual",value:"manual"}]}),vt.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"},vt.default.createElement(ZN,{className:"tw-size-5"})," ",vt.default.createElement("div",null,"Commands are automatically loaded from .md files in your custom prompts folder"," ",vt.default.createElement("strong",null,r.customPromptsFolder),". Modifying the files will also update the command settings.")),vt.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},vt.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-between tw-gap-2 md:tw-justify-end"},vt.default.createElement("div",null,vt.default.createElement(ve,{variant:"secondary",onClick:()=>new lm(app,Ivt,"This will add default commands to your custom prompts folder. Do you want to continue?","Generate Default Commands").open()},"Generate Default")),vt.default.createElement(ve,{variant:"default",className:"tw-gap-2",onClick:()=>{let d={...CI};new AB(app,e,d,async p=>{await a(p)}).open()}},vt.default.createElement(dC,{className:"tw-size-2 md:tw-size-4"}),"Add Cmd")),vt.default.createElement("div",{className:"tw-hidden md:tw-block"},vt.default.createElement(XX,{sensors:o,collisionDetection:ZX,onDragEnd:l},vt.default.createElement(cfe,null,vt.default.createElement(dfe,null,vt.default.createElement(LU,null,vt.default.createElement(Hb,{className:"tw-w-10"}),vt.default.createElement(Hb,null,"Name"),vt.default.createElement(Hb,{className:"tw-w-24 tw-text-center"},vt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"In Menu",vt.default.createElement(Ci,{content:vt.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.")}))),vt.default.createElement(Hb,{className:"tw-w-28 tw-text-center"},vt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center tw-gap-1"},"Slash Cmd",vt.default.createElement(Ci,{content:vt.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.")}))),vt.default.createElement(Hb,{className:"tw-w-32 tw-text-center"},"Actions"))),vt.default.createElement(QX,{items:e.map(d=>d.title),strategy:YX},vt.default.createElement(ffe,null,e.length===0?vt.default.createElement(LU,null,vt.default.createElement(By,{colSpan:5,className:"tw-py-8 tw-text-center tw-text-muted"},"No custom prompt files found.")):e.map(d=>vt.default.createElement(Nhi,{key:d.title,command:d,commands:e,onUpdate:i,onRemove:s,onCopy:u}))))))),c())))};On();var ji=L(X());Ro();L6();W7();Pt();var q$=L(X()),wnn=()=>{let t=So();return q$.default.createElement("div",{className:"tw-space-y-4"},q$.default.createElement("section",null,q$.default.createElement(on,{type:"textarea",title:"User System Prompt",description:"Customize the system prompt for all messages, may result in unexpected behavior!",value:t.userSystemPrompt,onChange:e=>et("userSystemPrompt",e),placeholder:"Enter your system prompt here..."}),q$.default.createElement("div",{className:"tw-space-y-4"},q$.default.createElement(on,{type:"switch",title:"Enable Encryption",description:"Enable encryption for the API keys.",checked:t.enableEncryption,onCheckedChange:e=>{et("enableEncryption",e)}}),q$.default.createElement(on,{type:"switch",title:"Debug Mode",description:"Debug mode will log some debug message to the console.",checked:t.debug,onCheckedChange:e=>{et("debug",e)}}),q$.default.createElement(on,{type:"custom",title:"Create Log File",description:`Open the Copilot log file (${ey.getLogPath()}) for easy sharing when reporting issues.`},q$.default.createElement(ve,{variant:"secondary",size:"sm",onClick:async()=>{await q1e(),await ey.flush(),await ey.openLogFile()}},"Create Log File")))))};gd();Ro();zr();jn();$v();Pt();var mm=L(X()),Snn=require("obsidian"),Cnn=L(wm());Ro();$v();Pt();On();function jhi({onConfirm:t,onCancel:e}){let r=ce();return mm.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},mm.default.createElement("div",null,mm.default.createElement("p",null,"Thanks for purchasing ",mm.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!"),mm.default.createElement("p",null,"Would you like to apply the Copilot Plus settings now? You can always change this later in Settings."),mm.default.createElement("ul",{className:"tw-pl-4"},mm.default.createElement("li",null,"Default mode: ",mm.default.createElement("b",{className:"tw-text-accent"},"Copilot Plus")),mm.default.createElement("li",null,"Chat model: ",mm.default.createElement("b",{className:"tw-text-accent"},eot)),mm.default.createElement("li",null,mm.default.createElement("div",null,"Embedding model:"," ",mm.default.createElement("b",{className:"tw-text-accent"},tot)),r.embeddingModelKey!==rot&&mm.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1 tw-text-sm tw-text-warning"},mm.default.createElement(rg,{className:"tw-size-4"})," It will rebuild your embeddings for the entire vault")))),mm.default.createElement("div",{className:"tw-flex tw-w-full tw-justify-end tw-gap-2"},mm.default.createElement(ve,{variant:"ghost",onClick:e},"Apply Later"),mm.default.createElement(ve,{variant:"default",onClick:t},"Apply Now")))}var EFe=class extends Snn.Modal{constructor(e){super(e),this.setTitle("Welcome to Copilot Plus \u{1F680}")}onOpen(){let{contentEl:e}=this;this.root=(0,Cnn.createRoot)(e);let r=()=>{Ihr(),this.close()},n=()=>{this.close()};this.root.render(mm.default.createElement(jhi,{onConfirm:r,onCancel:n}))}onClose(){this.root.unmount()}};Ro();zr();$v();Pt();On();var zc=L(X());function xnn(){let t=So(),[e,r]=(0,zc.useState)(null),[n,o]=(0,zc.useState)(!1),i=Y8(),[a,s]=(0,zc.useState)(t.plusLicenseKey);return(0,zc.useEffect)(()=>{s(t.plusLicenseKey)},[t.plusLicenseKey]),zc.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4 tw-rounded-lg tw-bg-secondary tw-p-4"},zc.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-text-xl tw-font-bold"},zc.default.createElement("span",null,"Copilot Plus"),i&&zc.default.createElement(qb,{variant:"outline",className:"tw-text-success"},"Active")),zc.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2 tw-text-sm tw-text-muted"},zc.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:"," ",zc.default.createElement("strong",null," ","including chat context, PDF and image support, web search integration, exclusive chat and embedding models, and much more.")),zc.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!")),zc.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},zc.default.createElement(HI,{className:"tw-w-full",placeholder:"Enter your license key",value:a,onChange:u=>{s(u)}}),zc.default.createElement(ve,{disabled:n,onClick:async()=>{et("plusLicenseKey",a),o(!0);let u=await jS();o(!1),u?(r(null),new EFe(app).open()):r("Invalid license key")},className:"tw-min-w-10 tw-text-xs md:tw-text-sm"},n?zc.default.createElement(Zc,{className:"tw-size-2 tw-animate-spin md:tw-size-4"}):"Apply"),zc.default.createElement(ve,{className:"tw-text-xs md:tw-text-sm",variant:"secondary",onClick:()=>d4(IN.SETTINGS)},"Join Now ",zc.default.createElement(KN,{className:"tw-size-2 md:tw-size-4"}))),zc.default.createElement("div",{className:"tw-text-error"},e))}wr();On();var rY=require("obsidian"),rr=L(X());Ro();zr();zz();Xq();Dt();Pt();zr();Dt();var Dhi={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"}))||[]},$hi=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})):[],Lhi=t=>Dhi[t]||$hi(t),Onn=(t,e)=>{let r=Lhi(t);try{return r(e)}catch(n){return ue(`Error parsing ${t} model data:`,n),[]}};wr();On();var GI=require("obsidian"),An=L(X()),Tnn=L(wm());function Fhi({onClose:t}){let e=So(),[r,n]=(0,An.useState)(null),[o,i]=(0,An.useState)({}),[a,s]=(0,An.useState)(null),[u,l]=(0,An.useState)(null),[c,d]=(0,An.useState)(null),[f,p]=(0,An.useState)(!1);(0,An.useEffect)(()=>{n(null),d(null)},[]);let m=_=>{let w=AN[_];return e[w]??""},h=X2e().filter(_=>_!=="amazon-bedrock").map(_=>{let w=_,x=m(w);return{provider:w,apiKey:x}}),g=(_,w)=>{m(_)!==w&&(et(AN[_],w),i(O=>({...O,[_]:void 0})),l(O=>O===_?null:O))},y=async(_,w)=>{s(_),l(null);try{w=await $i(w);let x=RN(_).listModelURL,O={Authorization:`Bearer ${w}`};_==="google"?(x+=`?key=${w}`,O={}):_==="anthropic"&&(O={"x-api-key":w,"anthropic-version":"2023-06-01"});let E=async D=>{let F=new AbortController,B=setTimeout(()=>F.abort(),3e3);try{let U=await(D?Wc:fetch)(x,{headers:O,signal:F.signal,method:"GET"});if(!U.ok){let H=Eo(await U.json());throw ue(H),new Error(`Failed to fetch models: ${U.statusText}
|
||
detail: `+H)}return U}finally{clearTimeout(B)}},T;try{T=await E(!1)}catch(D){console.log("First fetch attempt failed, trying with safeFetch...");try{T=await E(!0)}catch(F){let B=`
|
||
without CORS Error: `+Eo(D)+`
|
||
with CORS Error: `+Eo(F);throw new Error(B)}}let R=await T.json(),N=Onn(_,R);i(D=>({...D,[_]:N})),s(null)}catch(x){ue(`Error fetching models for ${_}:`,x),l(_),s(null),new GI.Notice(`Failed to load models for ${ib(_)}: ${Eo(x)}`,5e3)}},b=async()=>{if(!c){new GI.Notice("Please select a model first");return}p(!0);let _=!1,w="";try{let x=m(c.provider),O={name:c.name,provider:c.provider,apiKey:x,enabled:!0};try{await Rg.instance.getCurrentChainManager().chatModelManager.ping(O)}catch(T){_=!0,w=Eo(T),ue("Model verification failed:",T)}if(e.activeModels.find(T=>T.name===c.name&&T.provider===c.provider))_?new GI.Notice(`Model ${c.name} already exists in your models list (verification failed: ${w})`,1e4):new GI.Notice(`Model ${c.name} verified successfully! It already exists in your models list.`);else{let T=[...e.activeModels,{...O,apiKey:void 0}];et("activeModels",T),_?new GI.Notice(`Model ${c.name} added to your models list (verification failed: ${w})`,1e4):new GI.Notice(`Model ${c.name} verified successfully and added to your models list!`)}}catch(x){ue("Error adding model:",x),new GI.Notice(`Failed to add model: ${Eo(x)}`,1e4)}finally{p(!1)}};return An.default.createElement("div",{className:"tw-max-h-[600px] tw-overflow-y-auto tw-p-4 sm:tw-max-w-[500px]"},An.default.createElement("div",{className:"tw-mb-4"},An.default.createElement("h2",{className:"tw-text-xl tw-font-bold"},"AI Provider Settings"),An.default.createElement("p",{className:"tw-text-sm tw-text-muted"},"Configure your AI providers by adding their API keys.")),An.default.createElement("div",{className:"tw-space-y-6 tw-py-4"},An.default.createElement("div",{className:"tw-space-y-4"},h.map(_=>An.default.createElement(An.default.Fragment,{key:_.provider},An.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},An.default.createElement("div",{className:"tw-flex tw-items-end tw-gap-2 tw-font-medium"},An.default.createElement("div",{className:"tw-truncate"},ib(_.provider))),An.default.createElement("div",{className:"tw-flex tw-flex-row tw-items-center tw-gap-2"},An.default.createElement("div",{className:"tw-flex-1"},An.default.createElement(HI,{className:"tw-max-w-full",value:_.apiKey,onChange:w=>g(_.provider,w)})),An.default.createElement("div",{className:""},An.default.createElement(ve,{onClick:()=>{let w=r===_.provider?null:_.provider;n(w),w&&_.apiKey&&o[_.provider]===void 0&&a!==_.provider&&u!==_.provider&&y(_.provider,_.apiKey)},disabled:!_.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",r===_.provider?An.default.createElement(sC,{className:"tw-ml-1 tw-size-4"}):An.default.createElement(Qs,{className:"tw-ml-1 tw-size-4"})))),An.default.createElement("div",null,RN(_.provider).keyManagementURL&&An.default.createElement("a",{href:RN(_.provider).keyManagementURL,target:"_blank",rel:"noopener noreferrer",className:"tw-text-[10px] tw-text-accent hover:tw-text-accent-hover sm:tw-text-xs"},"Get ",ib(_.provider)," Key"))),An.default.createElement(Zx,{open:r===_.provider,className:"tw-mt-2"},An.default.createElement(Xx,{className:"tw-rounded-md tw-p-3"},An.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},An.default.createElement(ai,{label:"Model",description:"Add the currently selected model to model List. After adding, please check the Model Tab."},An.default.createElement("div",null,An.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},An.default.createElement("div",{className:"tw-flex-1"},An.default.createElement(ZLe,{options:o[_.provider]?.sort((w,x)=>w.name.localeCompare(x.name)).map(w=>({label:w.name,value:w.id}))||[],onChange:w=>{let x=w.target.value,O=o[_.provider]?.find(E=>E.id===x);O&&d({id:O.id,name:O.name,provider:_.provider})},onClick:()=>{_.apiKey&&o[_.provider]===void 0&&a!==_.provider&&u!==_.provider&&y(_.provider,_.apiKey)},value:c?.provider===_.provider?c.id:"",placeholder:"Select Model",disabled:!_.apiKey||a===_.provider||u===_.provider&&o[_.provider]!==null})),An.default.createElement("div",{className:"tw-w-[72px]"},An.default.createElement(ve,{onClick:b,disabled:!c||c.provider!==_.provider||f,variant:"secondary",size:"sm",className:"tw-w-full tw-whitespace-nowrap"},f?An.default.createElement(Zc,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}):"Add"))),An.default.createElement("div",{className:"tw-mt-1 tw-text-xs"},a===_.provider&&An.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Loading models..."),u===_.provider&&An.default.createElement("div",{className:"tw-p-1 tw-text-error"},"Failed to load models.",o[_.provider]===null&&" Check API Key or network."),o[_.provider]&&o[_.provider].length===0&&An.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"No models available for this provider."),o[_.provider]===void 0&&u!==_.provider&&a!==_.provider&&An.default.createElement("div",{className:"tw-p-1 tw-text-muted"},"Click to load models or expand to try again if API key was changed."))))))))))),An.default.createElement("div",{className:"tw-mt-4 tw-flex tw-justify-end"},An.default.createElement(ve,{onClick:t},"Close")))}var PFe=class extends GI.Modal{constructor(e){super(e)}onOpen(){let{contentEl:e}=this;this.root=(0,Tnn.createRoot)(e),this.root.render(An.default.createElement(Fhi,{onClose:()=>this.close()}))}onClose(){this.root.unmount()}};var qhi={llm_chain:"Chat",vault_qa:"Vault QA (Basic)",copilot_plus:"Copilot Plus",project:"Projects (alpha)"},Enn=()=>{let t=So(),[e,r]=(0,rr.useState)(!1),[n,o]=(0,rr.useState)(t.defaultConversationNoteName||"{$date}_{$time}__{$topic}"),i=()=>{r(!0);try{let u=n||"{$date}_{$time}__{$topic}",c=["{$date}","{$time}","{$topic}"].filter(g=>!u.includes(g));if(c.length>0){new rY.Notice(`Error: Missing required variables: ${c.join(", ")}`,4e3);return}let d=/[\\/:*?"<>|]/,f=u.replace(/\{\$date}/g,"").replace(/\{\$time}/g,"").replace(/\{\$topic}/g,"");if(d.test(f)){new rY.Notice('Error: Format contains illegal characters (\\/:*?"<>|)',4e3);return}let{fileName:p}=Zh(new Date),h=u.replace("{$topic}","test topic name".slice(0,100).replace(/\s+/g,"_")).replace("{$date}",p.split("_")[0]).replace("{$time}",p.split("_")[1]);et("defaultConversationNoteName",u),o(u),new rY.Notice(`Format applied successfully! Example: ${h}`,4e3)}catch(u){new rY.Notice(`Error applying format: ${u.message}`,4e3)}finally{r(!1)}},a=!!t.activeModels.find(u=>u.enabled&&Qn(u)===t.defaultModelKey),s=t.activeModels.filter(u=>u.enabled).map(u=>({label:oZ(u),value:Qn(u)}));return rr.default.createElement("div",{className:"tw-space-y-4"},rr.default.createElement(xnn,null),rr.default.createElement("section",null,rr.default.createElement("div",{className:"tw-mb-3 tw-text-xl tw-font-bold"},"General"),rr.default.createElement("div",{className:"tw-space-y-4"},rr.default.createElement("div",{className:"tw-space-y-4"},rr.default.createElement(on,{type:"custom",title:"API Keys",description:rr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},rr.default.createElement("span",{className:"tw-leading-none"},"Configure API keys for different AI providers"),rr.default.createElement(Ci,{content:rr.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},rr.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"API key required for chat and QA features"),rr.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."))}))},rr.default.createElement(ve,{onClick:()=>{new PFe(app).open()},variant:"secondary",className:"tw-flex tw-w-full tw-items-center tw-justify-center tw-gap-2 sm:tw-w-auto sm:tw-justify-start"},"Set Keys",rr.default.createElement(Ete,{className:"tw-size-4"})))),rr.default.createElement(on,{type:"select",title:"Default Chat Model",description:rr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},rr.default.createElement("span",{className:"tw-leading-none"},"Select the Chat model to use"),rr.default.createElement(Ci,{content:rr.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},rr.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Default model is OpenRouter Gemini 2.5 Flash"),rr.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:a?t.defaultModelKey:"Select Model",onChange:u=>{let l=t.activeModels.find(f=>f.enabled&&Qn(f)===u);if(!l)return;let{hasApiKey:c,errorNotice:d}=H6(l,t);if(!c&&d){new rY.Notice(d);return}et("defaultModelKey",u)},options:a?s:[{label:"Select Model",value:"Select Model"},...s],placeholder:"Model"}),rr.default.createElement(on,{type:"select",title:"Default Mode",description:rr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},rr.default.createElement("span",{className:"tw-leading-none"},"Select the default chat mode"),rr.default.createElement(Ci,{content:rr.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},rr.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},rr.default.createElement("li",null,rr.default.createElement("strong",null,"Chat:")," Regular chat mode for general conversations and tasks. ",rr.default.createElement("i",null,"Free to use with your own API key.")),rr.default.createElement("li",null,rr.default.createElement("strong",null,"Vault QA (Basic):")," Ask questions about your vault content with semantic search. ",rr.default.createElement("i",null,"Free to use with your own API key.")),rr.default.createElement("li",null,rr.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"," ",rr.default.createElement("a",{href:not(IN.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:u=>et("defaultChainType",u),options:Object.entries(qhi).map(([u,l])=>({label:l,value:u}))}),rr.default.createElement(on,{type:"select",title:"Open Plugin In",description:"Choose where to open the plugin",value:t.defaultOpenArea,onChange:u=>et("defaultOpenArea",u),options:[{label:"Sidebar View",value:"view"},{label:"Editor",value:"editor"}]}),rr.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:u=>et("defaultSaveFolder",u),placeholder:"copilot/copilot-conversations"}),rr.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:u=>et("defaultConversationTag",u),placeholder:"ai-conversations"}),rr.default.createElement(on,{type:"custom",title:"Conversation Filename Template",description:rr.default.createElement("div",{className:"tw-flex tw-items-start tw-gap-1.5 "},rr.default.createElement("span",{className:"tw-leading-none"},"Customize the format of saved conversation note names."),rr.default.createElement(Ci,{content:rr.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2 tw-py-4"},rr.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-accent"},"Note: All the following variables must be included in the template."),rr.default.createElement("div",null,rr.default.createElement("div",{className:"tw-text-sm tw-font-medium tw-text-muted"},"Available variables:"),rr.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},rr.default.createElement("li",null,rr.default.createElement("strong",null,"{$date}"),": Date in YYYYMMDD format"),rr.default.createElement("li",null,rr.default.createElement("strong",null,"{$time}"),": Time in HHMMSS format"),rr.default.createElement("li",null,rr.default.createElement("strong",null,"{$topic}"),": Chat conversation topic")),rr.default.createElement("i",{className:"tw-mt-2 tw-text-sm tw-text-muted"},"Example: ","{$date}_{$time}__{$topic}"," \u2192 20250114_153232__polish_this_article_[[Readme]]")))}))},rr.default.createElement("div",{className:"tw-flex tw-w-[320px] tw-items-center tw-gap-1.5"},rr.default.createElement(yi,{type:"text",className:Oe("tw-min-w-[80px] tw-grow tw-transition-all tw-duration-200",e?"tw-w-[80px]":"tw-w-[120px]"),placeholder:"{$date}_{$time}__{$topic}",value:n,onChange:u=>o(u.target.value),disabled:e}),rr.default.createElement(ve,{onClick:()=>i(),disabled:e,variant:"secondary"},e?rr.default.createElement(rr.default.Fragment,null,rr.default.createElement(Zc,{className:"tw-mr-2 tw-size-4 tw-animate-spin"}),"Apply"):"Apply"))),rr.default.createElement(on,{type:"switch",title:"Autosave Chat",description:"Automatically saves the chat after every user message and AI response.",checked:t.autosaveChat,onCheckedChange:u=>et("autosaveChat",u)}),rr.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:u=>et("generateAIChatTitleOnSave",u)}),rr.default.createElement(on,{type:"switch",title:"Include Current Note in Context Menu",description:"Automatically include the current note in the chat context menu by default when sending messages to the AI.",checked:t.includeActiveNoteAsContext,onCheckedChange:u=>{et("includeActiveNoteAsContext",u)}}),rr.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:u=>{et("passMarkdownImages",u)}}),rr.default.createElement(on,{type:"switch",title:"Suggested Prompts",description:"Show suggested prompts in the chat view",checked:t.showSuggestedPrompts,onCheckedChange:u=>et("showSuggestedPrompts",u)}),rr.default.createElement(on,{type:"switch",title:"Relevant Notes",description:"Show relevant notes in the chat view",checked:t.showRelevantNotes,onCheckedChange:u=>et("showRelevantNotes",u)}))))};Ro();zr();jn();Dt();Pt();On();var q3=require("obsidian"),jo=L(X());var tO=L(X());Jle();Pt();var Pnn=()=>{let t=So(),e=V_.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),et("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:tO.default.createElement(tO.default.Fragment,{key:u},c.map(({metadata:d})=>tO.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 tO.default.createElement(tO.default.Fragment,null,tO.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=>{et("autonomousAgentMaxIterations",s)},min:4,max:8,step:1}),tO.default.createElement("div",{className:"tw-mt-4 tw-rounded-lg tw-bg-secondary tw-p-4"},tO.default.createElement("div",{className:"tw-mb-2 tw-text-sm tw-font-medium"},"Agent Accessible Tools"),tO.default.createElement("div",{className:"tw-mb-4 tw-text-xs tw-text-muted"},"Toggle which tools the autonomous agent can use"),tO.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},a())))};var Mnn=()=>{let t=So(),e=t.autocompleteAcceptKey||Xw.KEYBIND,[r,n]=(0,jo.useState)(!1),o=!0,i=[{value:"Tab",label:"Tab"},{value:"Space",label:"Space"},{value:"ArrowRight",label:"Right Arrow"}],a=l=>{o||(et("autocompleteAcceptKey",l),new q3.Notice(`Autocomplete accept key set to: ${l}`))},s=()=>{o||(et("autocompleteAcceptKey",Xw.KEYBIND),new q3.Notice(`Autocomplete accept key reset to: ${Xw.KEYBIND}`))},u=async()=>{if(!(r||o)){n(!0),new q3.Notice("Rebuilding word index...");try{let c=await vJ.getInstance(app.vault).rescan(d=>{d.processedFiles===d.totalFiles&&new q3.Notice(`Word index complete! Found ${d.foundWords} words from ${d.processedFiles} files.`)});new q3.Notice(`Word index rebuilt successfully! ${c.wordCount} unique words indexed.`)}catch(l){ue("Failed to refresh word index:",l),new q3.Notice("Failed to refresh word index. Check console for details.")}finally{n(!1)}}};return jo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},jo.default.createElement("section",{className:"tw-flex tw-flex-col tw-gap-4"},jo.default.createElement("div",{className:"tw-flex tw-items-center tw-py-4"},jo.default.createElement(qb,{variant:"secondary",className:"tw-text-accent"},"Plus Required")),jo.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},jo.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autonomous Agent"),jo.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:l=>{et("enableAutonomousAgent",l)}}),t.enableAutonomousAgent&&jo.default.createElement(jo.default.Fragment,null,jo.default.createElement(Pnn,null)),jo.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Memory (experimental)"),jo.default.createElement(on,{type:"text",title:"Memory Folder Name",description:"Specify the folder where memory data is stored.",value:t.memoryFolderName,onChange:l=>{et("memoryFolderName",l)},placeholder:"copilot/memory"}),jo.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:l=>{et("enableRecentConversations",l)}}),t.enableRecentConversations&&jo.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:l=>et("maxRecentConversations",l)}),jo.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:l=>{et("enableSavedMemory",l)}}),jo.default.createElement("div",{className:"tw-pt-4 tw-text-xl tw-font-semibold"},"Autocomplete",jo.default.createElement("span",{className:"tw-ml-2 tw-text-sm tw-font-normal tw-text-muted"},"(service temporarily unavailable, will be back soon)")),o?null:jo.default.createElement(jo.default.Fragment,null,jo.default.createElement(on,{type:"switch",title:"Sentence Autocomplete",description:jo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},jo.default.createElement("span",{className:"tw-leading-none"},"Enable AI-powered sentence autocomplete suggestions while typing")),checked:t.enableAutocomplete,onCheckedChange:l=>{o||et("enableAutocomplete",l)},disabled:o}),jo.default.createElement(on,{type:"switch",title:"Word Completion",description:"Suggest completions for partially typed words based on your vault's content. Requires at least 3 characters to trigger.",checked:t.enableWordCompletion,onCheckedChange:l=>{o||et("enableWordCompletion",l)},disabled:o}),jo.default.createElement(on,{type:"custom",title:"Word Index Management",description:"Rebuild the word index to include new words from your vault. The index is automatically built when the plugin loads.",disabled:o},jo.default.createElement(ve,{onClick:u,disabled:r||o,className:"tw-flex tw-items-center tw-gap-2"},jo.default.createElement(qO,{className:Oe("tw-size-4",r&&"tw-animate-spin")}),r?"Rebuilding...":"Refresh Word Index")),jo.default.createElement(on,{type:"custom",title:"Autocomplete Accept Suggestion Key",description:jo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},jo.default.createElement("span",{className:"tw-leading-none"},"The key used to accept autocomplete suggestions"),jo.default.createElement(Ci,{content:jo.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},jo.default.createElement("div",{className:"tw-text-sm tw-text-muted"},'Select the key you want to use for accepting suggestions. Default is "Tab".'))})),disabled:o},jo.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},jo.default.createElement(PU,{value:e,onValueChange:a,disabled:o},jo.default.createElement(A$,{className:"tw-w-[180px]",disabled:o},jo.default.createElement(MU,{placeholder:"Select key"})),jo.default.createElement(I$,null,i.map(l=>jo.default.createElement(N$,{key:l.value,value:l.value},l.label)))),e&&e!==Xw.KEYBIND&&jo.default.createElement(ve,{variant:"ghost",onClick:s,className:"tw-h-8 tw-text-xs",disabled:o},"Reset to Default"))),jo.default.createElement(on,{type:"switch",title:"Allow Additional Context",description:"Allow the AI to access relevant notes to provide more relevant suggestions. When off, the AI can only see the current note context.",checked:t.allowAdditionalContext,onCheckedChange:l=>{o||et("allowAdditionalContext",l)},disabled:o})))))};zr();dH();Xq();Dt();Pt();Ro();zr();Dt();Pt();wr();On();var bfe=require("obsidian"),it=L(X()),swt=({open:t,onOpenChange:e,onAdd:r,ping:n,isEmbeddingModel:o=!1})=>{let{modalContainer:i}=VX(),a=ce(),s=o?"openai":"openai",[u,l]=(0,it.useState)(null),[c,d]=(0,it.useState)(!1),[f,p]=(0,it.useState)(!1),[m,h]=(0,it.useState)({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1,bedrockRegion:!1}),g=(z,Q)=>{h(re=>({...re,[z]:Q}))},y=()=>{h({name:!1,instanceName:!1,deploymentName:!1,embeddingDeploymentName:!1,apiVersion:!1,displayName:!1,bedrockRegion:!1})},b=()=>{let z=!0,Q={...m};return Q.name=!x.name,x.name||(z=!1),x.provider==="azure openai"&&(Q.instanceName=!x.azureOpenAIApiInstanceName,Q.apiVersion=!x.azureOpenAIApiVersion,o?(Q.embeddingDeploymentName=!x.azureOpenAIApiEmbeddingDeploymentName,x.azureOpenAIApiEmbeddingDeploymentName||(z=!1)):(Q.deploymentName=!x.azureOpenAIApiDeploymentName,x.azureOpenAIApiDeploymentName||(z=!1)),(!x.azureOpenAIApiInstanceName||!x.azureOpenAIApiVersion)&&(z=!1)),x.provider,"amazon-bedrock",Q.bedrockRegion=!1,h(Q),z},_=z=>a[AN[z]]||"",w=(z=s)=>{let Q={name:"",provider:z,enabled:!0,isBuiltIn:!1,baseUrl:"",apiKey:z==="amazon-bedrock"?"":_(z),isEmbeddingModel:o,capabilities:[]};if(!o){let re={...Q,stream:!0};return z==="amazon-bedrock"?{...re,bedrockRegion:a.amazonBedrockRegion}:re}return Q},[x,O]=(0,it.useState)(w()),E=z=>({...z,name:z.name?.trim(),baseUrl:z.baseUrl?.trim(),apiKey:z.apiKey?.trim(),openAIOrgId:z.openAIOrgId?.trim(),azureOpenAIApiInstanceName:z.azureOpenAIApiInstanceName?.trim(),azureOpenAIApiDeploymentName:z.azureOpenAIApiDeploymentName?.trim(),azureOpenAIApiEmbeddingDeploymentName:z.azureOpenAIApiEmbeddingDeploymentName?.trim(),azureOpenAIApiVersion:z.azureOpenAIApiVersion?.trim(),bedrockRegion:z.bedrockRegion?.trim()}),[T,R]=(0,it.useState)(RN(s)),N=()=>!!(x.name&&x.provider),D=()=>f||!N(),F=()=>{if(!b()){new bfe.Notice("Please fill in all required fields");return}let z=E(x);r(z),e(!1),O(w()),y()},B=z=>{R(RN(z)),O({...x,provider:z,apiKey:z==="amazon-bedrock"?"":_(z),...z==="openai"?{openAIOrgId:a.openAIOrgId}:{},...z==="azure openai"?{azureOpenAIApiInstanceName:a.azureOpenAIApiInstanceName,azureOpenAIApiDeploymentName:a.azureOpenAIApiDeploymentName,azureOpenAIApiVersion:a.azureOpenAIApiVersion,azureOpenAIApiEmbeddingDeploymentName:a.azureOpenAIApiEmbeddingDeploymentName}:{},...z==="amazon-bedrock"?{bedrockRegion:a.amazonBedrockRegion}:{bedrockRegion:void 0}})},U=z=>{z||(O(w()),y(),d(!1)),e(z)},H=async()=>{if(!b()){new bfe.Notice("Please fill in all required fields");return}p(!0);try{let z=E(x);await n(z),new bfe.Notice("Model verification successful!")}catch(z){ue(z);let Q=Eo(z);new bfe.Notice("Model verification failed: "+Q)}finally{p(!1)}},G=()=>{let Q=(()=>{switch(x.provider){case"openai":return it.default.createElement(ai,{label:"OpenAI Organization ID",description:"Enter OpenAI Organization ID if applicable"},it.default.createElement(yi,{type:"text",placeholder:"Enter OpenAI Organization ID if applicable",value:x.openAIOrgId||"",onChange:re=>O({...x,openAIOrgId:re.target.value})}));case"azure openai":return it.default.createElement(it.default.Fragment,null,it.default.createElement(ai,{label:"Instance Name",required:!0,error:m.instanceName,errorMessage:"Instance name is required"},it.default.createElement(yi,{type:"text",placeholder:"Enter Azure OpenAI API Instance Name",value:x.azureOpenAIApiInstanceName||"",onChange:re=>{O({...x,azureOpenAIApiInstanceName:re.target.value}),g("instanceName",!1)}})),o?it.default.createElement(ai,{label:"Embedding Deployment Name",required:!0,error:m.embeddingDeploymentName,errorMessage:"Embedding deployment name is required"},it.default.createElement(yi,{type:"text",placeholder:"Enter Azure OpenAI API Embedding Deployment Name",value:x.azureOpenAIApiEmbeddingDeploymentName||"",onChange:re=>{O({...x,azureOpenAIApiEmbeddingDeploymentName:re.target.value}),g("embeddingDeploymentName",!1)}})):it.default.createElement(ai,{label:"Deployment Name",required:!0,error:m.deploymentName,errorMessage:"Deployment name is required",description:"This is your actual model, no need to pass a model name separately."},it.default.createElement(yi,{type:"text",placeholder:"Enter Azure OpenAI API Deployment Name",value:x.azureOpenAIApiDeploymentName||"",onChange:re=>{O({...x,azureOpenAIApiDeploymentName:re.target.value}),g("deploymentName",!1)}})),it.default.createElement(ai,{label:"API Version",required:!0,error:m.apiVersion,errorMessage:"API version is required"},it.default.createElement(yi,{type:"text",placeholder:"Enter Azure OpenAI API Version",value:x.azureOpenAIApiVersion||"",onChange:re=>{O({...x,azureOpenAIApiVersion:re.target.value}),g("apiVersion",!1)}})));case"amazon-bedrock":return it.default.createElement(ai,{label:"Region (optional)",description:"Defaults to us-east-1 when left blank unless a custom base URL is provided."},it.default.createElement(yi,{type:"text",placeholder:"Enter AWS region (e.g. us-east-1)",value:x.bedrockRegion||"",onChange:re=>{O({...x,bedrockRegion:re.target.value}),g("bedrockRegion",!1)}}));default:return null}})();return Q?it.default.createElement(Zx,{open:c,onOpenChange:d,className:"tw-space-y-2 tw-rounded-lg tw-border tw-pt-4"},it.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between"},it.default.createElement(Ib,null,"Additional ",ib(x.provider)," Settings"),it.default.createElement(D$,{asChild:!0},it.default.createElement(ve,{variant:"ghost",size:"sm",className:"tw-w-9 tw-p-0"},it.default.createElement(Qs,{className:"tw-size-4"}),it.default.createElement("span",{className:"tw-sr-only"},"Toggle")))),it.default.createElement(Xx,{className:"tw-max-h-[200px] tw-space-y-4 tw-overflow-y-auto tw-pb-0.5 tw-pl-0.5 tw-pr-2"},Q)):null},ie=()=>{if(x.provider!=="azure openai")return T.host;let z=x.azureOpenAIApiInstanceName||"[instance]",Q=o?x.azureOpenAIApiEmbeddingDeploymentName||"[deployment]":x.azureOpenAIApiDeploymentName||"[deployment]",re=x.azureOpenAIApiVersion||"[api-version]";return`https://${z}.openai.azure.com/openai/deployments/${Q}/${o?"embeddings":"chat/completions"}?api-version=${re}`},oe=Object.entries(SL).map(([z,Q])=>({id:z,label:z.charAt(0).toUpperCase()+z.slice(1),description:Q}));return it.default.createElement(OFe,{open:t,onOpenChange:U},it.default.createElement(mfe,{className:"sm:tw-max-w-[425px]",container:i,ref:z=>l(z)},it.default.createElement(hfe,null,it.default.createElement(gfe,null,"Add Custom ",o?"Embedding":"Chat"," Model"),it.default.createElement(yfe,null,"Add a new model to your collection.")),it.default.createElement("div",{className:"tw-space-y-3"},it.default.createElement(ai,{label:"Model Name",required:!0,error:m.name,errorMessage:"Model name is required"},it.default.createElement(yi,{type:"text",placeholder:`Enter model name (e.g. ${o?"text-embedding-3-small":"gpt-4"})`,value:x.name,onChange:z=>{O({...x,name:z.target.value}),g("name",!1)}})),it.default.createElement(ai,{label:it.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},it.default.createElement("span",{className:"tw-leading-none"},"Display Name"),it.default.createElement(Ci,{content:it.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-0.5 tw-text-sm tw-text-muted"},it.default.createElement("div",{className:"tw-text-[12px] tw-font-bold"},"Suggested format:"),it.default.createElement("div",{className:"tw-text-accent"},"[Source]-[Payment]:[Pretty Model Name]"),it.default.createElement("div",{className:"tw-text-[12px]"},"Example:",it.default.createElement("li",null,"Direct-Paid:Ds-r1"),it.default.createElement("li",null,"OpenRouter-Paid:Ds-r1"),it.default.createElement("li",null,"Perplexity-Paid:lg"))),contentClassName:"tw-max-w-96"}))},it.default.createElement(yi,{type:"text",placeholder:"Custom display name (optional)",value:x.displayName||"",onChange:z=>{O({...x,displayName:z.target.value})}})),it.default.createElement(ai,{label:"Provider"},it.default.createElement(PU,{value:x.provider,onValueChange:B},it.default.createElement(A$,null,it.default.createElement(MU,{placeholder:"Select provider"})),it.default.createElement(I$,{container:u},Object.values(o?tee(vL,["COPILOT_PLUS","COPILOT_PLUS_JINA"]):tee(OO,["COPILOT_PLUS"])).map(z=>it.default.createElement(N$,{key:z,value:z},ib(z)))))),it.default.createElement(ai,{label:"Base URL",description:"Leave it blank, unless you are using a proxy."},it.default.createElement(yi,{type:"text",placeholder:ie()||"https://api.example.com/v1",value:x.baseUrl||"",onChange:z=>O({...x,baseUrl:z.target.value})})),it.default.createElement(ai,{label:"API Key"},it.default.createElement(HI,{placeholder:`Enter ${T.label} API Key`,value:x.apiKey||"",onChange:z=>O({...x,apiKey:z})}),T.keyManagementURL&&it.default.createElement("p",{className:"tw-text-xs tw-text-muted"},it.default.createElement("a",{href:T.keyManagementURL,target:"_blank",rel:"noopener noreferrer"},"Get ",T.label," API Key"))),it.default.createElement(ai,{label:it.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},it.default.createElement("span",{className:"tw-leading-none"},"Model Capabilities"),it.default.createElement(Ci,{content:it.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"}))},it.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-4"},oe.map(({id:z,label:Q,description:re})=>it.default.createElement("div",{key:z,className:"tw-flex tw-items-center tw-gap-2"},it.default.createElement(sd,{id:z,checked:x.capabilities?.includes(z),onCheckedChange:Z=>{let $=x.capabilities||[];O({...x,capabilities:Z?[...$,z]:$.filter(q=>q!==z)})}}),it.default.createElement(Ci,{content:re},it.default.createElement(Ib,{htmlFor:z,className:"tw-text-sm"},Q)))))),G()),it.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-4"},it.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},it.default.createElement(sd,{id:"enable-cors",checked:x.enableCors||!1,onCheckedChange:z=>O({...x,enableCors:z})}),it.default.createElement(Ib,{htmlFor:"enable-cors"},it.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-0.5"},it.default.createElement("span",{className:"tw-text-xs md:tw-text-sm"},"CORS"),it.default.createElement(Ci,{content:it.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"})))),it.default.createElement(tv,null,it.default.createElement("div",{className:"tw-flex tw-gap-2 tw-text-xs md:tw-text-sm"},it.default.createElement(Kn,null,it.default.createElement(Wn,{asChild:!0},it.default.createElement(ve,{variant:"ghost",onClick:H,disabled:D()},f?it.default.createElement(it.default.Fragment,null,it.default.createElement(Zc,{className:"tw-mr-2 tw-size-2 tw-animate-spin md:tw-size-4 "}),"Test"):"Test")),it.default.createElement(Mn,null,it.default.createElement("p",null,"Optional: test API call"))),it.default.createElement(ve,{variant:"default",onClick:F,disabled:D()},"Add Model"))))))};Ro();zr();jn();Pt();wr();On();var Lt=L(X());var Bhi={reasoning:{icon:ZN,color:"tw-text-model-capabilities-blue",tooltip:SL.reasoning},vision:{icon:WN,color:"tw-text-model-capabilities-green",tooltip:SL.vision},websearch:{icon:lC,color:"tw-text-model-capabilities-blue",tooltip:SL.websearch}},Uhi=["reasoning","vision","websearch"],zhi=({title:t,onRefresh:e,onAdd:r})=>Lt.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"},Lt.default.createElement("h3",{className:"tw-text-xl tw-font-bold"},t),Lt.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&&Lt.default.createElement(ve,{onClick:e,variant:"secondary",className:"tw-flex tw-items-center tw-gap-2"},Lt.default.createElement(qO,{className:"tw-size-2 md:tw-size-4"}),"Refresh Built-ins"),Lt.default.createElement(ve,{onClick:r,variant:"default",className:"tw-flex tw-items-center tw-gap-2"},Lt.default.createElement(dC,{className:"tw-size-2 md:tw-size-4"}),"Add Model"))),Hhi=t=>Lt.default.createElement("div",{className:"tw-mx-auto tw-grid tw-w-16 tw-grid-cols-3 tw-gap-1"},Uhi.map(e=>{let r=Bhi[e];if(!r)return Lt.default.createElement("div",{key:e,className:"tw-w-4"});let n=r.icon;return t.capabilities?.includes(e)?Lt.default.createElement(Ci,{key:e,content:r.tooltip,side:"bottom"},Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-justify-center"},Lt.default.createElement(n,{className:Oe("tw-size-4",r.color)}))):Lt.default.createElement("div",{key:e,className:"tw-flex tw-items-center tw-justify-center"},Lt.default.createElement("div",{className:"tw-size-4"}))})),Vhi=({model:t,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:o,id:i,containerRef:a})=>{let s=[];e&&s.push({icon:Lt.default.createElement(kK,{className:"tw-size-4"}),label:"Edit",onClick:e}),r&&!t.core&&s.push({icon:Lt.default.createElement(h_,{className:"tw-size-4"}),label:"Copy",onClick:r}),t.core||s.push({icon:Lt.default.createElement(cy,{className:"tw-size-4"}),label:"Delete",onClick:()=>n(Qn(t)),variant:"destructive"});let u=Lt.default.createElement("div",{className:"tw-flex tw-justify-around"},!t.isEmbeddingModel&&Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Lt.default.createElement("span",{className:"tw-text-sm"},"Enabled"),Lt.default.createElement(sd,{checked:t.enabled,onCheckedChange:l=>o({...t,enabled:l})})),Lt.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},Lt.default.createElement("span",{className:"tw-text-sm"},"CORS"),Lt.default.createElement(sd,{checked:t.enableCors,onCheckedChange:l=>o({...t,enableCors:l})})));return Lt.default.createElement(SFe,{id:i,item:t,title:t.displayName||t.name,subtitle:ib(t.provider,t),badge:t.capabilities&&t.capabilities.length>0?Lt.default.createElement(mmt,{capabilities:t.capabilities,iconSize:14}):void 0,isDraggable:!t.core,isExpandable:!0,expandedContent:u,primaryAction:e?{icon:Lt.default.createElement(qK,{className:"tw-size-4"}),onClick:e,tooltip:"Edit Model"}:void 0,dropdownActions:s,containerRef:a})},Jhi=({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}=eY({id:Qn(t),disabled:t.core}),p={transform:D0.Transform.toString(c),transition:d},m=e||!t.core||r&&!t.core;return Lt.default.createElement(LU,{ref:l,style:p,className:Oe("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")},Lt.default.createElement(By,{className:"tw-w-6 tw-px-2"},!t.core&&Lt.default.createElement(ve,{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},Lt.default.createElement(cC,{className:"tw-size-4 tw-transition-colors"}))),Lt.default.createElement(By,{className:"tw-pl-0"},t.displayName||t.name),Lt.default.createElement(By,null,ib(t.provider,t)),Lt.default.createElement(By,null,Hhi(t)),!i&&Lt.default.createElement(By,{className:"tw-text-center"},Lt.default.createElement(sd,{id:`${Qn(t)}-enabled`,checked:t.enabled,onCheckedChange:h=>o({...t,enabled:h}),className:"tw-mx-auto"})),Lt.default.createElement(By,{className:"tw-text-center"},Lt.default.createElement(sd,{id:`${Qn(t)}-enableCors`,checked:t.enableCors,onCheckedChange:h=>o({...t,enableCors:h}),className:"tw-mx-auto"})),Lt.default.createElement(By,{className:"tw-text-center"},Lt.default.createElement("div",{className:"tw-flex tw-justify-center tw-gap-2"},e&&Lt.default.createElement(ve,{variant:"ghost",size:"icon",onClick:()=>e(t),className:"tw-shadow-sm tw-transition-shadow hover:tw-shadow-md"},Lt.default.createElement(qK,{className:"tw-size-4"})),m&&Lt.default.createElement(PI,null,Lt.default.createElement(MI,{asChild:!0},Lt.default.createElement(ve,{variant:"ghost",size:"icon"},Lt.default.createElement(kO,{className:"tw-size-4"}))),Lt.default.createElement(Y_,{align:"end",container:a.current},e&&Lt.default.createElement(Ai,{onClick:()=>e(t)},Lt.default.createElement(kK,{className:"tw-mr-2 tw-size-4"}),"Edit"),r&&!t.core&&Lt.default.createElement(Ai,{onClick:()=>r(t)},Lt.default.createElement(h_,{className:"tw-mr-2 tw-size-4"}),"Copy"),!t.core&&Lt.default.createElement(Ai,{onClick:()=>n(Qn(t)),className:"tw-text-error"},Lt.default.createElement(cy,{className:"tw-mr-2 tw-size-4"}),"Delete"))))))},uwt=({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=mFe(GX($U),GX(DU,{coordinateGetter:wFe})),d=(0,Lt.useRef)(null),f=t.findIndex(g=>!g.core),p=g=>y=>{let{transform:b,active:_,activeNodeRect:w,over:x}=y;if(!_||!w)return b;let O=t.findIndex(D=>Qn(D)===_.id),E=t.filter(D=>!D.core).length,T=w.height,R=(f-O)*T,N=(f+E-1-O)*T;if(g&&x){let D=t.findIndex(B=>Qn(B)===x.id);if(t[D].core||D<f)return{...b,x:0,y:0}}return{...b,x:0,y:Math.min(Math.max(R,b.y),N)}},m=g=>{let{active:y,over:b}=g;if(b&&y.id!==b.id){let _=t.findIndex(E=>Qn(E)===y.id),w=t.findIndex(E=>Qn(E)===b.id),x=t[w];if(w<f||x.core)return;let O=vFe(t,_,w);a?.(O)}},h=()=>Lt.default.createElement("div",{className:"tw-relative md:tw-hidden"},Lt.default.createElement(XX,{sensors:c,collisionDetection:ZX,onDragEnd:m,modifiers:[p(!0)],autoScroll:{enabled:!0,acceleration:10,threshold:{x:0,y:.2}}},Lt.default.createElement(QX,{items:t.map(g=>Qn(g)),strategy:YX},Lt.default.createElement("div",{className:"tw-relative tw-touch-auto tw-space-y-2 tw-overflow-auto tw-pb-2"},t.map(g=>Lt.default.createElement(Vhi,{key:Qn(g),id:Qn(g),containerRef:d,model:g,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i}))))));return Lt.default.createElement("div",{ref:d,className:"tw-mb-4"},Lt.default.createElement(zhi,{title:u,onRefresh:s,onAdd:o}),Lt.default.createElement("div",{className:"tw-hidden md:tw-block"},Lt.default.createElement(XX,{sensors:c,collisionDetection:ZX,onDragEnd:m,modifiers:[p(!1)]},Lt.default.createElement("div",{className:"tw-relative tw-overflow-hidden"},Lt.default.createElement(cfe,null,Lt.default.createElement(dfe,null,Lt.default.createElement(LU,null,Lt.default.createElement(Hb,{className:"tw-w-6 tw-px-2"}),Lt.default.createElement(Hb,{className:"tw-pl-0"},"Model"),Lt.default.createElement(Hb,null,"Provider"),Lt.default.createElement(Hb,{className:"tw-text-center"},"Capabilities"),!l&&Lt.default.createElement(Hb,{className:"tw-text-center"},"Enable"),Lt.default.createElement(Hb,{className:"tw-text-center"},"CORS"),Lt.default.createElement(Hb,{className:"tw-w-[100px] tw-text-center"},"Actions"))),Lt.default.createElement(ffe,{className:"tw-relative"},Lt.default.createElement(QX,{items:t.map(g=>Qn(g)),strategy:YX},t.map(g=>Lt.default.createElement(Jhi,{key:Qn(g),containerRef:d,model:g,onEdit:e,onCopy:r,onDelete:n,onUpdateModel:i,isEmbeddingModel:l})))))))),h())};wr();var MFe=require("obsidian"),Rw=L(X()),Rnn=()=>{let t=So(),[e,r]=(0,Rw.useState)(!1),[n,o]=(0,Rw.useState)(!1),i=(h,g=!1)=>{let y={...tee(h,["isBuiltIn","core","projectEnabled","plusExclusive","believerExclusive","capabilities","displayName","dimensions"]),name:`${h.name} (copy)`},b=g?"activeEmbeddingModels":"activeModels";et(b,[...t[b],y])},a=(h,g=!1)=>{et(g?"activeEmbeddingModels":"activeModels",h)},s=h=>{let[g,y]=h.split("|"),b=t.activeModels.filter(w=>!(w.name===g&&w.provider===y)),_=t.defaultModelKey;if(h===t.defaultModelKey){let w=b.find(x=>x.enabled);_=w?`${w.name}|${w.provider}`:""}EN({activeModels:b,defaultModelKey:_})},u=(h,g,y)=>{let b=h?"activeEmbeddingModels":"activeModels",_=t[b].findIndex(w=>w.name===g.name&&w.provider===g.provider);if(_!==-1){let w=[...t[b]];w[_]=y,et(b,w)}else new MFe.Notice("Could not find model to update"),ue("Could not find model to update:",g)},l=h=>{let g=t.activeModels.map(y=>y.name===h.name&&y.provider===h.provider?h:y);et("activeModels",g)},c=h=>{let[g,y]=h.split("|"),b=t.activeEmbeddingModels.filter(_=>!(_.name===g&&_.provider===y));et("activeEmbeddingModels",b)},d=h=>{let g=t.activeEmbeddingModels.map(y=>y.name===h.name&&y.provider===h.provider?h:y);et("activeEmbeddingModels",g)},f=()=>{let h=t.activeModels.filter(y=>!y.isBuiltIn),g=[...SO,...h];et("activeModels",g),new MFe.Notice("Chat models refreshed successfully")},p=()=>{let h=t.activeEmbeddingModels.filter(y=>!y.isBuiltIn),g=[...Dz,...h];et("activeEmbeddingModels",g),new MFe.Notice("Embedding models refreshed successfully")},m=(h,g=!1)=>{new MX(app,h,g,u).open()};return Rw.default.createElement("div",{className:"tw-space-y-4"},Rw.default.createElement("section",null,Rw.default.createElement(uwt,{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"}),Rw.default.createElement(swt,{open:e,onOpenChange:r,onAdd:h=>{let g=[...t.activeModels,h];et("activeModels",g)},ping:h=>Rg.instance.getCurrentChainManager().chatModelManager.ping(h)}),Rw.default.createElement("div",{className:"tw-space-y-4"},Rw.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=>et("contextTurns",h),min:1,max:50,step:1}))),Rw.default.createElement("section",null,Rw.default.createElement(uwt,{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"}),Rw.default.createElement(swt,{open:n,onOpenChange:o,onAdd:h=>{let g=[...t.activeEmbeddingModels,h];et("activeEmbeddingModels",g)},isEmbeddingModel:!0,ping:h=>wd.getInstance().ping(h)})))};var Dnn=require("obsidian");Ro();var bi=L(X()),$nn=L(wm());vb();On();var AFe=require("obsidian");gd();wr();zr();var RFe=class extends DX{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(!B6(e,this.chainType)){new AFe.Notice(G6.NON_MARKDOWN_FILES_RESTRICTED);return}this.onNoteSelect(e)}renderSuggestion(e,r){let n=r.createDiv({cls:"pointer-events-none"});if(e.item instanceof AFe.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 Ann=require("obsidian"),k0=L(X()),Inn=L(wm());Ro();function Khi({onConfirm:t,onCancel:e}){let[r,n]=(0,k0.useState)(""),[o,i]=(0,k0.useState)(null),a=u=>{if(u.includes(" ")){i("Extension cannot contain spaces");return}i(null),t(u)};return k0.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},k0.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},k0.default.createElement(yi,{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&&k0.default.createElement("p",{className:"tw-text-sm tw-text-error"},o)),k0.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},k0.default.createElement(ve,{variant:"secondary",onClick:e},"Cancel"),k0.default.createElement(ve,{variant:"default",onClick:()=>a(r)},"Confirm")))}var IFe=class extends Ann.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Extension")}onOpen(){let{contentEl:r}=this;this.root=(0,Inn.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(k0.default.createElement(Khi,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};var Nnn=require("obsidian"),rO=L(X()),jnn=L(wm());Ro();function Whi({onConfirm:t,onCancel:e}){let[r,n]=(0,rO.useState)("");return rO.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},rO.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-4"},rO.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"),rO.default.createElement(yi,{placeholder:"Enter the pattern",value:r,onChange:i=>n(i.target.value),onKeyDown:i=>{i.key==="Enter"&&t(r)}})),rO.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},rO.default.createElement(ve,{variant:"secondary",onClick:e},"Cancel"),rO.default.createElement(ve,{variant:"default",onClick:()=>t(r)},"Confirm")))}var NFe=class extends Nnn.Modal{constructor(r,n){super(r);this.onConfirm=n;this.setTitle("Add Custom Pattern")}onOpen(){let{contentEl:r}=this;this.root=(0,jnn.createRoot)(r);let n=i=>{this.onConfirm(i),this.close()},o=()=>{this.close()};this.root.render(rO.default.createElement(Whi,{onConfirm:n,onCancel:o}))}onClose(){this.root.unmount()}};function jFe({title:t,patterns:e,onRemove:r}){return bi.default.createElement("div",{className:"tw-grid tw-grid-cols-4 tw-gap-2"},bi.default.createElement("div",{className:"tw-font-bold"},t),bi.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=>bi.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"},bi.default.createElement(pm,{className:"tw-flex-1"},n),bi.default.createElement(ve,{variant:"ghost2",size:"fit",onClick:()=>r(n)},bi.default.createElement(pi,{className:"tw-size-4"}))))))}function Ghi({value:t,onUpdate:e,container:r}){let[n,o]=(0,bi.useState)(t),i=P_(n),{tagPatterns:a,extensionPatterns:s,folderPatterns:u,notePatterns:l}=J8(i),c=f=>{let p=K8({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 bi.default.createElement("div",{className:"tw-mt-2 tw-flex tw-flex-col tw-gap-4"},bi.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&&bi.default.createElement("div",{className:"tw-text-center tw-text-sm"},"No patterns specified"),a.length>0&&bi.default.createElement(jFe,{title:"Tags",patterns:a,onRemove:f=>{let p=a.filter(m=>m!==f);c({tagPatterns:p})}}),s.length>0&&bi.default.createElement(jFe,{title:"Extensions",patterns:s,onRemove:f=>{let p=s.filter(m=>m!==f);c({extensionPatterns:p})}}),u.length>0&&bi.default.createElement(jFe,{title:"Folders",patterns:u,onRemove:f=>{let p=u.filter(m=>m!==f);c({folderPatterns:p})}}),l.length>0&&bi.default.createElement(jFe,{title:"Notes",patterns:l,onRemove:f=>{let p=l.filter(m=>m!==f);c({notePatterns:p})}})),bi.default.createElement("div",{className:"tw-flex tw-justify-end tw-gap-2"},bi.default.createElement(PI,null,bi.default.createElement(MI,{asChild:!0},bi.default.createElement(ve,{variant:"secondary"},"Add...")),bi.default.createElement(Y_,{align:"start",container:r},bi.default.createElement(Ai,{onSelect:()=>{new $X(app,f=>{let p=cie(f);a.includes(p)||c({tagPatterns:[...a,p]})}).open()}},bi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},bi.default.createElement(eF,{className:"tw-size-4"}),"Tag")),bi.default.createElement(Ai,{onSelect:()=>{new jX(app,f=>{u.includes(f)||c({folderPatterns:[...u,f]})}).open()}},bi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},bi.default.createElement(sh,{className:"tw-size-4"}),"Folder")),bi.default.createElement(Ai,{onSelect:()=>{new RFe({app,onNoteSelect:f=>{let p=W8(f);l.includes(p)||c({notePatterns:[...l,p]})},excludeNotePaths:[],titleOnly:!0}).open()}},bi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},bi.default.createElement(ic,{className:"tw-size-4"}),"Note")),bi.default.createElement(Ai,{onSelect:()=>{new IFe(app,f=>{let p=Znt(f);s.includes(p)||c({extensionPatterns:[...s,p]})}).open()}},bi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},bi.default.createElement(Cte,{className:"tw-size-4"}),"Extension")),bi.default.createElement(Ai,{onSelect:()=>{new NFe(app,f=>{let p=P_(f),{tagPatterns:m,extensionPatterns:h,folderPatterns:g,notePatterns:y}=J8(p);c({tagPatterns:[...a,...m],extensionPatterns:[...s,...h],folderPatterns:[...u,...g],notePatterns:[...l,...y]})}).open()}},bi.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},bi.default.createElement(Dv,{className:"tw-size-4"}),"Custom"))))))}var _fe=class extends Dnn.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,$nn.createRoot)(r);let n=o=>{this.onUpdate(o)};this.root.render(bi.default.createElement(Ghi,{value:this.value,onUpdate:n,container:this.contentEl}))}onClose(){this.root.unmount()}};var DFe=class extends lm{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 $Fe=class extends lm{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")}};Ro();zr();Pt();var Lnn=require("obsidian"),Qr=L(X()),Fnn=()=>{let t=So(),e=async r=>{if(r!==t.embeddingModelKey){if(t.enableSemanticSearchV3){new DFe(app,async()=>{et("embeddingModelKey",r),await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().indexVaultToVectorStore(!1)}).open();return}et("embeddingModelKey",r),new Lnn.Notice("Embedding model saved. Enable Semantic Search to build the index.")}};return Qr.default.createElement("div",{className:"tw-space-y-4"},Qr.default.createElement("section",null,Qr.default.createElement("div",{className:"tw-space-y-4"},Qr.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=>et("enableInlineCitations",r)}),Qr.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 $Fe(app,async()=>{et("enableSemanticSearchV3",r),r&&await(await Promise.resolve().then(()=>(Dm(),vg))).default.getInstance().indexVaultToVectorStore(!1)},r).open()}}),Qr.default.createElement(on,{type:"select",title:"Embedding Model",description:Qr.default.createElement("div",{className:"tw-space-y-2"},Qr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Qr.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."),Qr.default.createElement(Ci,{content:Qr.default.createElement("div",{className:"tw-flex tw-max-w-96 tw-flex-col tw-gap-2"},Qr.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:"),Qr.default.createElement("ul",{className:"tw-pl-4 tw-text-sm tw-text-muted"},Qr.default.createElement("li",null,"Require rebuilding your vault's vector index"),Qr.default.createElement("li",null,"Affect semantic search quality"),Qr.default.createElement("li",null,"Impact Question Answering feature performance")))}))),value:t.embeddingModelKey,onChange:e,options:t.activeEmbeddingModels.map(r=>({label:oZ(r),value:Qn(r)})),placeholder:"Model"}),Qr.default.createElement(on,{type:"select",title:"Auto-Index Strategy",description:Qr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1.5"},Qr.default.createElement("span",{className:"tw-leading-none"},"Decide when you want the vault to be indexed."),Qr.default.createElement(Ci,{content:Qr.default.createElement("div",{className:"tw-space-y-2 tw-py-2"},Qr.default.createElement("div",{className:"tw-space-y-1"},Qr.default.createElement("div",{className:"tw-text-sm tw-text-muted"},"Choose when to index your vault:"),Qr.default.createElement("ul",{className:"tw-list-disc tw-space-y-1 tw-pl-2 tw-text-sm"},Qr.default.createElement("li",null,Qr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Qr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"NEVER:"),Qr.default.createElement("span",null,"Manual indexing via command or refresh only"))),Qr.default.createElement("li",null,Qr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Qr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON STARTUP:"),Qr.default.createElement("span",null,"Index updates when plugin loads or reloads"))),Qr.default.createElement("li",null,Qr.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},Qr.default.createElement("strong",{className:"tw-inline-block tw-whitespace-nowrap"},"ON MODE SWITCH:"),Qr.default.createElement("span",null,"Updates when entering QA mode (Recommended)"))))),Qr.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=>{et("indexVaultToVectorStore",r)},options:AAt.map(r=>({label:r,value:r})),placeholder:"Strategy"}),Qr.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=>et("maxSourceChunks",r)}),t.enableSemanticSearchV3&&Qr.default.createElement(Qr.default.Fragment,null,Qr.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=>et("embeddingRequestsPerMin",r)}),Qr.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=>et("embeddingBatchSize",r)}),Qr.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=>et("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"})),Qr.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=>et("lexicalSearchRamLimit",r),suffix:" MB"}),Qr.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=>et("enableLexicalBoosts",r)}),Qr.default.createElement(on,{type:"custom",title:"Exclusions",description:Qr.default.createElement(Qr.default.Fragment,null,Qr.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."))},Qr.default.createElement(ve,{variant:"secondary",onClick:()=>new _fe(app,r=>et("qaExclusions",r),t.qaExclusions,"Manage Exclusions").open()},"Manage")),Qr.default.createElement(on,{type:"custom",title:"Inclusions",description:Qr.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.")},Qr.default.createElement(ve,{variant:"secondary",onClick:()=>new _fe(app,r=>et("qaInclusions",r),t.qaInclusions,"Manage Inclusions").open()},"Manage")),Qr.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=>et("enableIndexSync",r)}),Qr.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=>et("disableIndexOnMobile",r)}))))};var qnn=["basic","model","QA","command","plus","advanced"],Zhi={basic:ji.default.createElement(pte,{className:"tw-size-5"}),model:ji.default.createElement(hte,{className:"tw-size-5"}),QA:ji.default.createElement(JN,{className:"tw-size-5"}),command:ji.default.createElement(YL,{className:"tw-size-5"}),plus:ji.default.createElement(ly,{className:"tw-size-5"}),advanced:ji.default.createElement(Dv,{className:"tw-size-5"})},Xhi={basic:()=>ji.default.createElement(Enn,null),model:()=>ji.default.createElement(Rnn,null),QA:()=>ji.default.createElement(Fnn,null),command:()=>ji.default.createElement(vnn,null),plus:()=>ji.default.createElement(Mnn,null),advanced:()=>ji.default.createElement(wnn,null)},knn=qnn.map(t=>({id:t,icon:Zhi[t],label:t.charAt(0).toUpperCase()+t.slice(1)})),Yhi=()=>{let{selectedTab:t,setSelectedTab:e}=VX();return ji.default.createElement("div",{className:"tw-flex tw-flex-col"},ji.default.createElement("div",{className:"tw-flex tw-flex-wrap tw-rounded-lg"},knn.map((r,n)=>ji.default.createElement(qtn,{key:r.id,tab:r,isSelected:t===r.id,onClick:()=>e(r.id),isFirst:n===0,isLast:n===knn.length-1}))),ji.default.createElement("div",{className:"tw-w-full tw-border tw-border-solid"}),ji.default.createElement("div",null,qnn.map(r=>{let n=Xhi[r];return ji.default.createElement(Btn,{key:r,id:r,isSelected:t===r},ji.default.createElement(n,null))})))},Qhi=({plugin:t})=>{let[e,r]=ji.default.useState(0),{latestVersion:n,hasUpdate:o}=qLe(t.manifest.version),i=async()=>{new iFe(app,async()=>{B2e(),r(s=>s+1)}).open()};return ji.default.createElement(ztn,null,ji.default.createElement("div",null,ji.default.createElement("div",{className:"tw-flex tw-flex-col tw-gap-2"},ji.default.createElement("h1",{className:"tw-flex tw-flex-col tw-gap-2 sm:tw-flex-row sm:tw-items-center sm:tw-justify-between"},ji.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-2"},ji.default.createElement("span",null,"Copilot Settings"),ji.default.createElement("div",{className:"tw-flex tw-items-center tw-gap-1"},ji.default.createElement("span",{className:"tw-text-xs tw-text-muted"},"v",t.manifest.version),n&&ji.default.createElement(ji.default.Fragment,null,o?ji.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,")"):ji.default.createElement("span",{className:"tw-text-xs tw-text-normal"}," (up to date)")))),ji.default.createElement("div",{className:"tw-self-end sm:tw-self-auto"},ji.default.createElement(ve,{variant:"secondary",size:"sm",onClick:i},"Reset Settings")))),ji.default.createElement(Yhi,{key:e})))},Bnn=Qhi;var lwt=L(X()),Unn=(0,lwt.createContext)(null);var LFe=class extends vfe.PluginSettingTab{constructor(e,r){super(e,r),this.plugin=r}async reloadPlugin(){try{let e=this.app.workspace.getLeavesOfType(Tc)[0]?.view;if(e&&ce().enableRecentConversations)try{let o=this.plugin.projectManager.getCurrentChainManager().chatModelManager.getChatModel();this.plugin.userMemoryManager.addRecentConversation(this.plugin.chatUIState.getMessages(),o)}catch(n){J("Failed to analyze chat messages for memory:",n)}e&&ce().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 vfe.Notice("Plugin reloaded successfully.")}catch(e){new vfe.Notice("Failed to reload the plugin. Please reload manually."),ue("Error reloading plugin:",e)}}display(){let{containerEl:e}=this;e.empty(),e.style.userSelect="text";let r=e.createDiv("div");(0,znn.createRoot)(r).render(cwt.default.createElement(Unn.Provider,{value:e},cwt.default.createElement(Bnn,{plugin:this.plugin})))}};Pt();Dt();var FFe=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){J("[ChatUIState] Error in listener:",r)}})}async sendMessage(e,r,n,o=!1,i){let a=await this.chatManager.sendMessage(e,r,n,o,i);return this.notifyListeners(),a}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()}};ROe();Rpt();var Uy=require("obsidian");Cpt();var kFe=class extends Uy.Plugin{constructor(){super(...arguments);this.userMessageHistory=[]}async onload(){await this.loadSettings(),this.settingsUnsubscriber=Ou(async(a,s)=>{s.enableEncryption?await this.saveData(await QAt(s)):await this.saveData(s),wmt(this,a,s)}),this.addSettingTab(new LFe(this.app,this)),L1e(this.app.vault),this.brevilabsClient=Ru.getInstance(),this.brevilabsClient.setPluginVersion(this.manifest.version),jS(),this.projectManager=Rg.getInstance(this.app,this),this.vectorStoreManager=Z1.getInstance(),Sde.getInstance().initialize(),this.fileParserManager=new Ik(this.brevilabsClient,this.app.vault);let n=new HX,o=this.projectManager.getCurrentChainManager(),i=new oFe(n,o,this.fileParserManager,this);this.chatUIState=new FFe(i),this.userMemoryManager=new CB(this.app),this.registerView(Tc,a=>new NU(a,this)),this.registerView(xue,a=>new VNe(a)),this.initActiveLeafChangeHandler(),this.addRibbonIcon("message-square","Open Copilot Chat",a=>{this.activateView()}),wmt(this,void 0,ce()),this.registerMarkdownCodeBlockProcessor(iZ,(a,s)=>{Ftn({plugin:this,element:s}),s.parentElement&&(s.parentElement.className="")}),pJ.initTools(this.app.vault),this.registerEvent(this.app.workspace.on("editor-menu",a=>Ntn(a))),this.registerEvent(this.app.workspace.on("active-leaf-change",a=>{if(a&&a.view instanceof Uy.MarkdownView&&a.view.file){let u=this.app.workspace.getLeavesOfType(Tc).find(l=>l.view instanceof NU)?.view;if(u){let l=new CustomEvent(Yw.ACTIVE_LEAF_CHANGE);u.eventTarget.dispatchEvent(l)}}})),this.autocompleteService=aje.getInstance(this),this.customCommandRegister=new eFe(this,this.app.vault),this.app.workspace.onLayoutReady(()=>{this.customCommandRegister.initialize().then(Dtn).then($tn)})}async onunload(){this.projectManager&&this.projectManager.onunload(),Sde.getInstance().cleanup(),this.customCommandRegister.cleanup(),this.settingsUnsubscriber?.(),this.autocompleteService?.destroy(),await ey.flush(),J("Copilot plugin unloaded")}updateUserMessageHistory(r){this.userMessageHistory=[...this.userMessageHistory,r]}async autosaveCurrentChat(){if(ce().autosaveChat){let r=this.app.workspace.getLeavesOfType(Tc)[0]?.view;r&&await r.saveChat()}}async processText(r,n,o,i=!0){let a=await r.getSelection();this.app.workspace.getLeavesOfType(Tc).length>0||await this.activateView(),setTimeout(()=>{let u=this.app.workspace.getLeavesOfType(Tc).find(l=>l.view instanceof NU)?.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(Tc).find(n=>n.view instanceof NU)?.view;if(r){let n=new CustomEvent(Yw.CHAT_IS_VISIBLE);r.eventTarget.dispatchEvent(n)}}initActiveLeafChangeHandler(){this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{r&&r.getViewState().type===Tc&&this.emitChatIsVisible()}))}getCurrentEditorOrDummy(){let r=this.app.workspace.getActiveViewOfType(Uy.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(Tc).length>0?this.deactivateView():this.activateView()}async activateView(){let r=this.app.workspace.getLeavesOfType(Tc);r.length===0?ce().defaultOpenArea==="view"?await this.app.workspace.getRightLeaf(!1).setViewState({type:Tc,active:!0}):await this.app.workspace.getLeaf(!0).setViewState({type:Tc,active:!0}):this.app.workspace.revealLeaf(r[0]),this.emitChatIsVisible()}async deactivateView(){this.app.workspace.detachLeavesOfType(Tc)}async loadSettings(){let r=await this.loadData(),n=U2e(r);EN(n)}mergeActiveModels(r,n){let o=new Map;return r.forEach(i=>{let a=Qn(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 Uy.Notice("No chat history found.");return}new QLe(this.app,r,this.loadChatHistory.bind(this)).open()}async getChatHistoryFiles(){let r=this.app.vault.getAbstractFileByPath(ce().defaultSaveFolder);if(!(r instanceof Uy.TFolder))return[];let o=this.app.vault.getMarkdownFiles().filter(s=>s.path.startsWith(r.path)),a=tc()?.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=>({id:n.path,title:Rvt(n),createdAt:Avt(n)}))}async loadChatHistory(r){await this.autosaveCurrentChat();let n=this.app.workspace.getLeavesOfType(Tc)[0];n||this.activateView(),await this.chatUIState.loadChatHistory(r);let o=(n||this.app.workspace.getLeavesOfType(Tc)[0])?.view;o&&o.updateView()}async loadChatById(r){let n=this.app.vault.getAbstractFileByPath(r);if(n instanceof Uy.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 Uy.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 Uy.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 Uy.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 Uy.TFile)await this.app.vault.delete(n),new Uy.Notice("Chat deleted.");else throw new Error("Chat file not found.")}async handleNewChat(){if(K7(),ce().enableRecentConversations)try{let o=this.projectManager.getCurrentChainManager().chatModelManager.getChatModel();this.userMemoryManager.addRecentConversation(this.chatUIState.getMessages(),o)}catch(n){J("Failed to analyze chat messages for memory:",n)}await this.autosaveCurrentChat();let r=this.app.workspace.getLeavesOfType(Tc)[0];if(r){let n=r.view,o=new CustomEvent(Yw.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(ce().enableSemanticSearchV3?new(await Promise.resolve().then(()=>(LNe(),zdt))).MergedSemanticRetriever(this.app,{minSimilarityScore:.3,maxK:20,salientTerms:n,textWeight:o,returnAll:!1}):new(await Promise.resolve().then(()=>(m7(),DNe))).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-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/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/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 */ |