@anthropic-ai/claude-agent-sdk 0.3.216 → 0.3.218

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/browser-sdk.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // (c) Anthropic PBC. All rights reserved. Use is subject to the Legal Agreements outlined here: https://code.claude.com/docs/en/legal-and-compliance.
2
2
 
3
- // Version: 0.3.216
3
+ // Version: 0.3.218
4
4
  var l8=Object.create;var{getPrototypeOf:c8,defineProperty:ma,getOwnPropertyNames:N_,getOwnPropertyDescriptor:d8}=Object,z_=Object.prototype.hasOwnProperty;function j_(e){return this[e]}var f8,h8,U_=(e,t,r)=>{var i=e!=null&&typeof e==="object";if(i){var n=t?f8??=new WeakMap:h8??=new WeakMap,o=n.get(e);if(o)return o}r=e!=null?l8(c8(e)):{};let s=t||!e||!e.__esModule?ma(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let h of N_(e))if(!z_.call(s,h))ma(s,h,{get:j_.bind(e,h),enumerable:!0})}if(i)n.set(e,s);return s},kt=(e)=>{var t=(D_??=new WeakMap).get(e),r;if(t)return t;if(t=ma({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var i of N_(e))if(!z_.call(t,i))ma(t,i,{get:j_.bind(e,i),enumerable:!(r=d8(e,i))||r.enumerable})}return D_.set(e,t),t},D_,Xe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var p8=(e)=>e;function m8(e,t){this[e]=p8.bind(null,t)}var wn=(e,t)=>{for(var r in t)ma(e,r,{get:t[r],enumerable:!0,configurable:!0,set:m8.bind(t,r)})};var ga=(e,t)=>()=>(e&&(t=e(e=0)),t);var $i=((e)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),g8=Symbol.dispose||Symbol.for("Symbol.dispose"),y8=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),xr=(e,t,r)=>{if(t!=null){if(typeof t!=="object"&&typeof t!=="function")throw TypeError('Object expected to be assigned to "using" declaration');var i;if(r)i=t[y8];if(i===void 0)i=t[g8];if(typeof i!=="function")throw TypeError("Object not disposable");e.push([r,i,t])}else if(r)e.push([r]);return t},kr=(e,t,r)=>{var i=typeof SuppressedError==="function"?SuppressedError:function(s,h,v,b){return b=Error(v),b.name="SuppressedError",b.error=s,b.suppressed=h,b},n=(s)=>t=r?new i(s,t,"An error was suppressed during disposal"):(r=!0,s),o=(s)=>{while(s=e.pop())try{var h=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(h).then(o,(v)=>(n(v),o()))}catch(v){n(v)}if(r)throw t};return o()};var Ir={};wn(Ir,{transcode:()=>hT,resolveObjectURL:()=>cT,kStringMaxLength:()=>E1,kMaxLength:()=>ba,isUtf8:()=>dT,isAscii:()=>fT,default:()=>pT,constants:()=>jI,btoa:()=>OI,atob:()=>DI,INSPECT_MAX_BYTES:()=>M1,File:()=>NI,Buffer:()=>fe,Blob:()=>zI});function PI(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");if(r===-1)r=t;var i=r===t?0:4-r%4;return[r,i]}function $I(e,t){return(e+t)*3/4-t}function AI(e){var t,r=PI(e),i=r[0],n=r[1],o=new Uint8Array($I(i,n)),s=0,h=n>0?i-4:i,v;for(v=0;v<h;v+=4)t=Sn[e.charCodeAt(v)]<<18|Sn[e.charCodeAt(v+1)]<<12|Sn[e.charCodeAt(v+2)]<<6|Sn[e.charCodeAt(v+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;if(n===2)t=Sn[e.charCodeAt(v)]<<2|Sn[e.charCodeAt(v+1)]>>4,o[s++]=t&255;if(n===1)t=Sn[e.charCodeAt(v)]<<10|Sn[e.charCodeAt(v+1)]<<4|Sn[e.charCodeAt(v+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255;return o}function RI(e){return Gn[e>>18&63]+Gn[e>>12&63]+Gn[e>>6&63]+Gn[e&63]}function CI(e,t,r){var i,n=[];for(var o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),n.push(RI(i));return n.join("")}function b1(e){var t,r=e.length,i=r%3,n=[],o=16383;for(var s=0,h=r-i;s<h;s+=o)n.push(CI(e,s,s+o>h?h:s+o));if(i===1)t=e[r-1],n.push(Gn[t>>2]+Gn[t<<4&63]+"==");else if(i===2)t=(e[r-2]<<8)+e[r-1],n.push(Gn[t>>10]+Gn[t>>4&63]+Gn[t<<2&63]+"=");return n.join("")}function Ac(e,t,r,i,n){var o,s,h=n*8-i-1,v=(1<<h)-1,b=v>>1,_=-7,g=r?n-1:0,S=r?-1:1,x=e[t+g];g+=S,o=x&(1<<-_)-1,x>>=-_,_+=h;for(;_>0;o=o*256+e[t+g],g+=S,_-=8);s=o&(1<<-_)-1,o>>=-_,_+=i;for(;_>0;s=s*256+e[t+g],g+=S,_-=8);if(o===0)o=1-b;else if(o===v)return s?NaN:(x?-1:1)*(1/0);else s=s+Math.pow(2,i),o=o-b;return(x?-1:1)*s*Math.pow(2,o-i)}function k1(e,t,r,i,n,o){var s,h,v,b=o*8-n-1,_=(1<<b)-1,g=_>>1,S=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=i?0:o-1,M=i?1:-1,I=t<0||t===0&&1/t<0?1:0;if(t=Math.abs(t),isNaN(t)||t===1/0)h=isNaN(t)?1:0,s=_;else{if(s=Math.floor(Math.log(t)/Math.LN2),t*(v=Math.pow(2,-s))<1)s--,v*=2;if(s+g>=1)t+=S/v;else t+=S*Math.pow(2,1-g);if(t*v>=2)s++,v/=2;if(s+g>=_)h=0,s=_;else if(s+g>=1)h=(t*v-1)*Math.pow(2,n),s=s+g;else h=t*Math.pow(2,g-1)*Math.pow(2,n),s=0}for(;n>=8;e[r+x]=h&255,x+=M,h/=256,n-=8);s=s<<n|h,b+=n;for(;b>0;e[r+x]=s&255,x+=M,s/=256,b-=8);e[r+x-M]|=I*128}function ii(e){if(e>ba)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,fe.prototype),t}function hm(e,t,r){return class extends r{constructor(){super();Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function fe(e,t,r){if(typeof e==="number"){if(typeof t==="string")throw TypeError('The "string" argument must be of type string. Received type number');return pm(e)}return I1(e,t,r)}function I1(e,t,r){if(typeof e==="string")return qI(e,t);if(ArrayBuffer.isView(e))return BI(e);if(e==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Jn(e,ArrayBuffer)||e&&Jn(e.buffer,ArrayBuffer))return dm(e,t,r);if(typeof SharedArrayBuffer<"u"&&(Jn(e,SharedArrayBuffer)||e&&Jn(e.buffer,SharedArrayBuffer)))return dm(e,t,r);if(typeof e==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return fe.from(i,t,r);let n=HI(e);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==="function")return fe.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function T1(e){if(typeof e!=="number")throw TypeError('"size" argument must be of type number');else if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function FI(e,t,r){if(T1(e),e<=0)return ii(e);if(t!==void 0)return typeof r==="string"?ii(e).fill(t,r):ii(e).fill(t);return ii(e)}function pm(e){return T1(e),ii(e<0?0:mm(e)|0)}function qI(e,t){if(typeof t!=="string"||t==="")t="utf8";if(!fe.isEncoding(t))throw TypeError("Unknown encoding: "+t);let r=P1(e,t)|0,i=ii(r),n=i.write(e,t);if(n!==r)i=i.slice(0,n);return i}function cm(e){let t=e.length<0?0:mm(e.length)|0,r=ii(t);for(let i=0;i<t;i+=1)r[i]=e[i]&255;return r}function BI(e){if(Jn(e,Uint8Array)){let t=new Uint8Array(e);return dm(t.buffer,t.byteOffset,t.byteLength)}return cm(e)}function dm(e,t,r){if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');let i;if(t===void 0&&r===void 0)i=new Uint8Array(e);else if(r===void 0)i=new Uint8Array(e,t);else i=new Uint8Array(e,t,r);return Object.setPrototypeOf(i,fe.prototype),i}function HI(e){if(fe.isBuffer(e)){let t=mm(e.length)|0,r=ii(t);if(r.length===0)return r;return e.copy(r,0,0,t),r}if(e.length!==void 0){if(typeof e.length!=="number"||Number.isNaN(e.length))return ii(0);return cm(e)}if(e.type==="Buffer"&&Array.isArray(e.data))return cm(e.data)}function mm(e){if(e>=ba)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ba.toString(16)+" bytes");return e|0}function P1(e,t){if(fe.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Jn(e,ArrayBuffer))return e.byteLength;if(typeof e!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return fm(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return j1(e).length;default:if(n)return i?-1:fm(e).length;t=(""+t).toLowerCase(),n=!0}}function ZI(e,t,r){let i=!1;if(t===void 0||t<0)t=0;if(t>this.length)return"";if(r===void 0||r>this.length)r=this.length;if(r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";if(!e)e="utf8";while(!0)switch(e){case"hex":return tT(this,t,r);case"utf8":case"utf-8":return A1(this,t,r);case"ascii":return QI(this,t,r);case"latin1":case"binary":return eT(this,t,r);case"base64":return XI(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rT(this,t,r);default:if(i)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function fo(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function $1(e,t,r,i,n){if(e.length===0)return-1;if(typeof r==="string")i=r,r=0;else if(r>2147483647)r=2147483647;else if(r<-2147483648)r=-2147483648;if(r=+r,Number.isNaN(r))r=n?0:e.length-1;if(r<0)r=e.length+r;if(r>=e.length)if(n)return-1;else r=e.length-1;else if(r<0)if(n)r=0;else return-1;if(typeof t==="string")t=fe.from(t,i);if(fe.isBuffer(t)){if(t.length===0)return-1;return w1(e,t,r,i,n)}else if(typeof t==="number"){if(t=t&255,typeof Uint8Array.prototype.indexOf==="function")if(n)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return w1(e,[t],r,i,n)}throw TypeError("val must be string, number or Buffer")}function w1(e,t,r,i,n){let o=1,s=e.length,h=t.length;if(i!==void 0){if(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le"){if(e.length<2||t.length<2)return-1;o=2,s/=2,h/=2,r/=2}}function v(_,g){if(o===1)return _[g];else return _.readUInt16BE(g*o)}let b;if(n){let _=-1;for(b=r;b<s;b++)if(v(e,b)===v(t,_===-1?0:b-_)){if(_===-1)_=b;if(b-_+1===h)return _*o}else{if(_!==-1)b-=b-_;_=-1}}else{if(r+h>s)r=s-h;for(b=r;b>=0;b--){let _=!0;for(let g=0;g<h;g++)if(v(e,b+g)!==v(t,g)){_=!1;break}if(_)return b}}return-1}function KI(e,t,r,i){r=Number(r)||0;let n=e.length-r;if(!i)i=n;else if(i=Number(i),i>n)i=n;let o=t.length;if(i>o/2)i=o/2;let s;for(s=0;s<i;++s){let h=parseInt(t.substr(s*2,2),16);if(Number.isNaN(h))return s;e[r+s]=h}return s}function VI(e,t,r,i){return Rc(fm(t,e.length-r),e,r,i)}function WI(e,t,r,i){return Rc(sT(t),e,r,i)}function GI(e,t,r,i){return Rc(j1(t),e,r,i)}function JI(e,t,r,i){return Rc(aT(t,e.length-r),e,r,i)}function XI(e,t,r){if(t===0&&r===e.length)return b1(e);else return b1(e.slice(t,r))}function A1(e,t,r){r=Math.min(e.length,r);let i=[],n=t;while(n<r){let o=e[n],s=null,h=o>239?4:o>223?3:o>191?2:1;if(n+h<=r){let v,b,_,g;switch(h){case 1:if(o<128)s=o;break;case 2:if(v=e[n+1],(v&192)===128){if(g=(o&31)<<6|v&63,g>127)s=g}break;case 3:if(v=e[n+1],b=e[n+2],(v&192)===128&&(b&192)===128){if(g=(o&15)<<12|(v&63)<<6|b&63,g>2047&&(g<55296||g>57343))s=g}break;case 4:if(v=e[n+1],b=e[n+2],_=e[n+3],(v&192)===128&&(b&192)===128&&(_&192)===128){if(g=(o&15)<<18|(v&63)<<12|(b&63)<<6|_&63,g>65535&&g<1114112)s=g}}}if(s===null)s=65533,h=1;else if(s>65535)s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023;i.push(s),n+=h}return YI(i)}function YI(e){let t=e.length;if(t<=S1)return String.fromCharCode.apply(String,e);let r="",i=0;while(i<t)r+=String.fromCharCode.apply(String,e.slice(i,i+=S1));return r}function QI(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]&127);return i}function eT(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function tT(e,t,r){let i=e.length;if(!t||t<0)t=0;if(!r||r<0||r>i)r=i;let n="";for(let o=t;o<r;++o)n+=uT[e[o]];return n}function rT(e,t,r){let i=e.slice(t,r),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}function Er(e,t,r){if(e%1!==0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function Yr(e,t,r,i,n,o){if(!fe.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw RangeError('"value" argument is out of bounds');if(r+i>e.length)throw RangeError("Index out of range")}function R1(e,t,r,i,n){z1(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}function C1(e,t,r,i,n){z1(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o=o>>8,e[r+6]=o,o=o>>8,e[r+5]=o,o=o>>8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}function O1(e,t,r,i,n,o){if(r+i>e.length)throw RangeError("Index out of range");if(r<0)throw RangeError("Index out of range")}function D1(e,t,r,i,n){if(t=+t,r=r>>>0,!n)O1(e,t,r,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return k1(e,t,r,i,23,4),r+4}function N1(e,t,r,i,n){if(t=+t,r=r>>>0,!n)O1(e,t,r,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return k1(e,t,r,i,52,8),r+8}function x1(e){let t="",r=e.length,i=e[0]==="-"?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function nT(e,t,r){if(ns(t,"offset"),e[t]===void 0||e[t+r]===void 0)_a(t,e.length-(r+1))}function z1(e,t,r,i,n,o){if(e>r||e<t){let s=typeof t==="bigint"?"n":"",h;if(o>3)if(t===0||t===BigInt(0))h=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`;else h=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`;else h=`>= ${t}${s} and <= ${r}${s}`;throw new lm("value",h,e)}nT(i,n,o)}function ns(e,t){if(typeof e!=="number")throw new LI(t,"number",e)}function _a(e,t,r){if(Math.floor(e)!==e)throw ns(e,r),new lm(r||"offset","an integer",e);if(t<0)throw new UI;throw new lm(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}function oT(e){if(e=e.split("=")[0],e=e.trim().replace(iT,""),e.length<2)return"";while(e.length%4!==0)e=e+"=";return e}function fm(e,t){t=t||1/0;let r,i=e.length,n=null,o=[];for(let s=0;s<i;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!n){if(r>56319){if((t-=3)>-1)o.push(239,191,189);continue}else if(s+1===i){if((t-=3)>-1)o.push(239,191,189);continue}n=r;continue}if(r<56320){if((t-=3)>-1)o.push(239,191,189);n=r;continue}r=(n-55296<<10|r-56320)+65536}else if(n){if((t-=3)>-1)o.push(239,191,189)}if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw Error("Invalid code point")}return o}function sT(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function aT(e,t){let r,i,n,o=[];for(let s=0;s<e.length;++s){if((t-=2)<0)break;r=e.charCodeAt(s),i=r>>8,n=r%256,o.push(n),o.push(i)}return o}function j1(e){return AI(oT(e))}function Rc(e,t,r,i){let n;for(n=0;n<i;++n){if(n+r>=t.length||n>=e.length)break;t[n+r]=e[n]}return n}function Jn(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ci(e){return typeof BigInt>"u"?lT:e}function lT(){throw Error("BigInt not supported")}function gm(e){return()=>{throw Error(e+" is not implemented for node:buffer browser polyfill")}}var Gn,Sn,um="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",co,v1,_1,M1=50,ba=2147483647,E1=536870888,OI,DI,NI,zI,jI,UI,LI,lm,S1=4096,iT,uT,cT,dT,fT=(e)=>{for(let t of e)if(t.charCodeAt(0)>127)return!1;return!0},hT,pT;var Tr=ga(()=>{Gn=[],Sn=[];for(co=0,v1=um.length;co<v1;++co)Gn[co]=um[co],Sn[um.charCodeAt(co)]=co;Sn[45]=62;Sn[95]=63;_1=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,OI=globalThis.btoa,DI=globalThis.atob,NI=globalThis.File,zI=globalThis.Blob,jI={MAX_LENGTH:ba,MAX_STRING_LENGTH:E1};UI=hm("ERR_BUFFER_OUT_OF_BOUNDS",function(e){if(e)return`${e} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),LI=hm("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),lm=hm("ERR_OUT_OF_RANGE",function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;if(Number.isInteger(r)&&Math.abs(r)>4294967296)n=x1(String(r));else if(typeof r==="bigint"){if(n=String(r),r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))n=x1(n);n+="n"}return i+=` It must be ${t}. Received ${n}`,i},RangeError);Object.defineProperty(fe.prototype,"parent",{enumerable:!0,get:function(){if(!fe.isBuffer(this))return;return this.buffer}});Object.defineProperty(fe.prototype,"offset",{enumerable:!0,get:function(){if(!fe.isBuffer(this))return;return this.byteOffset}});fe.poolSize=8192;fe.from=function(e,t,r){return I1(e,t,r)};Object.setPrototypeOf(fe.prototype,Uint8Array.prototype);Object.setPrototypeOf(fe,Uint8Array);fe.alloc=function(e,t,r){return FI(e,t,r)};fe.allocUnsafe=function(e){return pm(e)};fe.allocUnsafeSlow=function(e){return pm(e)};fe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==fe.prototype};fe.compare=function(e,t){if(Jn(e,Uint8Array))e=fe.from(e,e.offset,e.byteLength);if(Jn(t,Uint8Array))t=fe.from(t,t.offset,t.byteLength);if(!fe.isBuffer(e)||!fe.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,i=t.length;for(let n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}if(r<i)return-1;if(i<r)return 1;return 0};fe.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}};fe.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return fe.alloc(0);let r;if(t===void 0){t=0;for(r=0;r<e.length;++r)t+=e[r].length}let i=fe.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){let o=e[r];if(Jn(o,Uint8Array))if(n+o.length>i.length){if(!fe.isBuffer(o))o=fe.from(o);o.copy(i,n)}else Uint8Array.prototype.set.call(i,o,n);else if(!fe.isBuffer(o))throw TypeError('"list" argument must be an Array of Buffers');else o.copy(i,n);n+=o.length}return i};fe.byteLength=P1;fe.prototype._isBuffer=!0;fe.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)fo(this,t,t+1);return this};fe.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)fo(this,t,t+3),fo(this,t+1,t+2);return this};fe.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)fo(this,t,t+7),fo(this,t+1,t+6),fo(this,t+2,t+5),fo(this,t+3,t+4);return this};fe.prototype.toString=function(){let e=this.length;if(e===0)return"";if(arguments.length===0)return A1(this,0,e);return ZI.apply(this,arguments)};fe.prototype.toLocaleString=fe.prototype.toString;fe.prototype.equals=function(e){if(!fe.isBuffer(e))throw TypeError("Argument must be a Buffer");if(this===e)return!0;return fe.compare(this,e)===0};fe.prototype.inspect=function(){let e="",t=M1;if(e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t)e+=" ... ";return"<Buffer "+e+">"};if(_1)fe.prototype[_1]=fe.prototype.inspect;fe.prototype.compare=function(e,t,r,i,n){if(Jn(e,Uint8Array))e=fe.from(e,e.offset,e.byteLength);if(!fe.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0)t=0;if(r===void 0)r=e?e.length:0;if(i===void 0)i=0;if(n===void 0)n=this.length;if(t<0||r>e.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,n>>>=0,this===e)return 0;let o=n-i,s=r-t,h=Math.min(o,s),v=this.slice(i,n),b=e.slice(t,r);for(let _=0;_<h;++_)if(v[_]!==b[_]){o=v[_],s=b[_];break}if(o<s)return-1;if(s<o)return 1;return 0};fe.prototype.includes=function(e,t,r){return this.indexOf(e,t,r)!==-1};fe.prototype.indexOf=function(e,t,r){return $1(this,e,t,r,!0)};fe.prototype.lastIndexOf=function(e,t,r){return $1(this,e,t,r,!1)};fe.prototype.write=function(e,t,r,i){if(t===void 0)i="utf8",r=this.length,t=0;else if(r===void 0&&typeof t==="string")i=t,r=this.length,t=0;else if(isFinite(t))if(t=t>>>0,isFinite(r)){if(r=r>>>0,i===void 0)i="utf8"}else i=r,r=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let n=this.length-t;if(r===void 0||r>n)r=n;if(e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!i)i="utf8";let o=!1;for(;;)switch(i){case"hex":return KI(this,e,t,r);case"utf8":case"utf-8":return VI(this,e,t,r);case"ascii":case"latin1":case"binary":return WI(this,e,t,r);case"base64":return GI(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return JI(this,e,t,r);default:if(o)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};fe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};fe.prototype.slice=function(e,t){let r=this.length;if(e=~~e,t=t===void 0?r:~~t,e<0){if(e+=r,e<0)e=0}else if(e>r)e=r;if(t<0){if(t+=r,t<0)t=0}else if(t>r)t=r;if(t<e)t=e;let i=this.subarray(e,t);return Object.setPrototypeOf(i,fe.prototype),i};fe.prototype.readUintLE=fe.prototype.readUIntLE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Er(e,t,this.length);let i=this[e],n=1,o=0;while(++o<t&&(n*=256))i+=this[e+o]*n;return i};fe.prototype.readUintBE=fe.prototype.readUIntBE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Er(e,t,this.length);let i=this[e+--t],n=1;while(t>0&&(n*=256))i+=this[e+--t]*n;return i};fe.prototype.readUint8=fe.prototype.readUInt8=function(e,t){if(e=e>>>0,!t)Er(e,1,this.length);return this[e]};fe.prototype.readUint16LE=fe.prototype.readUInt16LE=function(e,t){if(e=e>>>0,!t)Er(e,2,this.length);return this[e]|this[e+1]<<8};fe.prototype.readUint16BE=fe.prototype.readUInt16BE=function(e,t){if(e=e>>>0,!t)Er(e,2,this.length);return this[e]<<8|this[e+1]};fe.prototype.readUint32LE=fe.prototype.readUInt32LE=function(e,t){if(e=e>>>0,!t)Er(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};fe.prototype.readUint32BE=fe.prototype.readUInt32BE=function(e,t){if(e=e>>>0,!t)Er(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};fe.prototype.readBigUInt64LE=Ci(function(e){e=e>>>0,ns(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)_a(e,this.length-8);let i=t+this[++e]*256+this[++e]*65536+this[++e]*16777216,n=this[++e]+this[++e]*256+this[++e]*65536+r*16777216;return BigInt(i)+(BigInt(n)<<BigInt(32))});fe.prototype.readBigUInt64BE=Ci(function(e){e=e>>>0,ns(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)_a(e,this.length-8);let i=t*16777216+this[++e]*65536+this[++e]*256+this[++e],n=this[++e]*16777216+this[++e]*65536+this[++e]*256+r;return(BigInt(i)<<BigInt(32))+BigInt(n)});fe.prototype.readIntLE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Er(e,t,this.length);let i=this[e],n=1,o=0;while(++o<t&&(n*=256))i+=this[e+o]*n;if(n*=128,i>=n)i-=Math.pow(2,8*t);return i};fe.prototype.readIntBE=function(e,t,r){if(e=e>>>0,t=t>>>0,!r)Er(e,t,this.length);let i=t,n=1,o=this[e+--i];while(i>0&&(n*=256))o+=this[e+--i]*n;if(n*=128,o>=n)o-=Math.pow(2,8*t);return o};fe.prototype.readInt8=function(e,t){if(e=e>>>0,!t)Er(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};fe.prototype.readInt16LE=function(e,t){if(e=e>>>0,!t)Er(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};fe.prototype.readInt16BE=function(e,t){if(e=e>>>0,!t)Er(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};fe.prototype.readInt32LE=function(e,t){if(e=e>>>0,!t)Er(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};fe.prototype.readInt32BE=function(e,t){if(e=e>>>0,!t)Er(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};fe.prototype.readBigInt64LE=Ci(function(e){e=e>>>0,ns(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)_a(e,this.length-8);let i=this[e+4]+this[e+5]*256+this[e+6]*65536+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*65536+this[++e]*16777216)});fe.prototype.readBigInt64BE=Ci(function(e){e=e>>>0,ns(e,"offset");let t=this[e],r=this[e+7];if(t===void 0||r===void 0)_a(e,this.length-8);let i=(t<<24)+this[++e]*65536+this[++e]*256+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*16777216+this[++e]*65536+this[++e]*256+r)});fe.prototype.readFloatLE=function(e,t){if(e=e>>>0,!t)Er(e,4,this.length);return Ac(this,e,!0,23,4)};fe.prototype.readFloatBE=function(e,t){if(e=e>>>0,!t)Er(e,4,this.length);return Ac(this,e,!1,23,4)};fe.prototype.readDoubleLE=function(e,t){if(e=e>>>0,!t)Er(e,8,this.length);return Ac(this,e,!0,52,8)};fe.prototype.readDoubleBE=function(e,t){if(e=e>>>0,!t)Er(e,8,this.length);return Ac(this,e,!1,52,8)};fe.prototype.writeUintLE=fe.prototype.writeUIntLE=function(e,t,r,i){if(e=+e,t=t>>>0,r=r>>>0,!i){let s=Math.pow(2,8*r)-1;Yr(this,e,t,r,s,0)}let n=1,o=0;this[t]=e&255;while(++o<r&&(n*=256))this[t+o]=e/n&255;return t+r};fe.prototype.writeUintBE=fe.prototype.writeUIntBE=function(e,t,r,i){if(e=+e,t=t>>>0,r=r>>>0,!i){let s=Math.pow(2,8*r)-1;Yr(this,e,t,r,s,0)}let n=r-1,o=1;this[t+n]=e&255;while(--n>=0&&(o*=256))this[t+n]=e/o&255;return t+r};fe.prototype.writeUint8=fe.prototype.writeUInt8=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,1,255,0);return this[t]=e&255,t+1};fe.prototype.writeUint16LE=fe.prototype.writeUInt16LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,2,65535,0);return this[t]=e&255,this[t+1]=e>>>8,t+2};fe.prototype.writeUint16BE=fe.prototype.writeUInt16BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,2,65535,0);return this[t]=e>>>8,this[t+1]=e&255,t+2};fe.prototype.writeUint32LE=fe.prototype.writeUInt32LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,4,4294967295,0);return this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};fe.prototype.writeUint32BE=fe.prototype.writeUInt32BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,4,4294967295,0);return this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};fe.prototype.writeBigUInt64LE=Ci(function(e,t=0){return R1(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});fe.prototype.writeBigUInt64BE=Ci(function(e,t=0){return C1(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});fe.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t=t>>>0,!i){let h=Math.pow(2,8*r-1);Yr(this,e,t,r,h-1,-h)}let n=0,o=1,s=0;this[t]=e&255;while(++n<r&&(o*=256)){if(e<0&&s===0&&this[t+n-1]!==0)s=1;this[t+n]=(e/o>>0)-s&255}return t+r};fe.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t=t>>>0,!i){let h=Math.pow(2,8*r-1);Yr(this,e,t,r,h-1,-h)}let n=r-1,o=1,s=0;this[t+n]=e&255;while(--n>=0&&(o*=256)){if(e<0&&s===0&&this[t+n+1]!==0)s=1;this[t+n]=(e/o>>0)-s&255}return t+r};fe.prototype.writeInt8=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,1,127,-128);if(e<0)e=255+e+1;return this[t]=e&255,t+1};fe.prototype.writeInt16LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,2,32767,-32768);return this[t]=e&255,this[t+1]=e>>>8,t+2};fe.prototype.writeInt16BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,2,32767,-32768);return this[t]=e>>>8,this[t+1]=e&255,t+2};fe.prototype.writeInt32LE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,4,2147483647,-2147483648);return this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};fe.prototype.writeInt32BE=function(e,t,r){if(e=+e,t=t>>>0,!r)Yr(this,e,t,4,2147483647,-2147483648);if(e<0)e=4294967295+e+1;return this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};fe.prototype.writeBigInt64LE=Ci(function(e,t=0){return R1(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});fe.prototype.writeBigInt64BE=Ci(function(e,t=0){return C1(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});fe.prototype.writeFloatLE=function(e,t,r){return D1(this,e,t,!0,r)};fe.prototype.writeFloatBE=function(e,t,r){return D1(this,e,t,!1,r)};fe.prototype.writeDoubleLE=function(e,t,r){return N1(this,e,t,!0,r)};fe.prototype.writeDoubleBE=function(e,t,r){return N1(this,e,t,!1,r)};fe.prototype.copy=function(e,t,r,i){if(!fe.isBuffer(e))throw TypeError("argument should be a Buffer");if(!r)r=0;if(!i&&i!==0)i=this.length;if(t>=e.length)t=e.length;if(!t)t=0;if(i>0&&i<r)i=r;if(i===r)return 0;if(e.length===0||this.length===0)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");if(i>this.length)i=this.length;if(e.length-t<i-r)i=e.length-t+r;let n=i-r;if(this===e&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(t,r,i);else Uint8Array.prototype.set.call(e,this.subarray(r,i),t);return n};fe.prototype.fill=function(e,t,r,i){if(typeof e==="string"){if(typeof t==="string")i=t,t=0,r=this.length;else if(typeof r==="string")i=r,r=this.length;if(i!==void 0&&typeof i!=="string")throw TypeError("encoding must be a string");if(typeof i==="string"&&!fe.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);if(i==="utf8"&&o<128||i==="latin1")e=o}}else if(typeof e==="number")e=e&255;else if(typeof e==="boolean")e=Number(e);if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t=t>>>0,r=r===void 0?this.length:r>>>0,!e)e=0;let n;if(typeof e==="number")for(n=t;n<r;++n)this[n]=e;else{let o=fe.isBuffer(e)?e:fe.from(e,i),s=o.length;if(s===0)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=o[n%s]}return this};iT=/[^+/0-9A-Za-z-_]/g;uT=function(){let e=Array(256);for(let t=0;t<16;++t){let r=t*16;for(let i=0;i<16;++i)e[r+i]="0123456789abcdef"[t]+"0123456789abcdef"[i]}return e}();cT=gm("resolveObjectURL"),dT=gm("isUtf8"),hT=gm("transcode"),pT=fe});var W1={};wn(W1,{types:()=>kT,promisify:()=>H1,log:()=>F1,isUndefined:()=>is,isSymbol:()=>ET,isString:()=>jc,isRegExp:()=>Cc,isPrimitive:()=>IT,isObject:()=>os,isNumber:()=>L1,isNullOrUndefined:()=>MT,isNull:()=>zc,isFunction:()=>Dc,isError:()=>Oc,isDate:()=>_m,isBuffer:()=>TT,isBoolean:()=>Sm,isArray:()=>U1,inspect:()=>ho,inherits:()=>q1,format:()=>wm,deprecate:()=>gT,default:()=>AT,debuglog:()=>yT,callbackifyOnRejected:()=>Mm,callbackify:()=>Z1,_extend:()=>km,TextEncoder:()=>K1,TextDecoder:()=>V1});function wm(e,...t){if(!jc(e)){var r=[e];for(var i=0;i<t.length;i++)r.push(ho(t[i]));return r.join(" ")}var i=0,n=t.length,o=String(e).replace(mT,function(h){if(h==="%%")return"%";if(i>=n)return h;switch(h){case"%s":return String(t[i++]);case"%d":return Number(t[i++]);case"%j":try{return JSON.stringify(t[i++])}catch(v){return"[Circular]"}default:return h}});for(var s=t[i];i<n;s=t[++i])if(zc(s)||!os(s))o+=" "+s;else o+=" "+ho(s);return o}function gT(e,t){if(typeof process>"u"||process?.noDeprecation===!0)return e;var r=!1;function i(...n){if(!r){if(process.throwDeprecation)throw Error(t);else if(process.traceDeprecation)console.trace(t);else console.error(t);r=!0}return e.apply(this,...n)}return i}function vT(e,t){var r=ho.styles[t];if(r)return"\x1B["+ho.colors[r][0]+"m"+e+"\x1B["+ho.colors[r][1]+"m";else return e}function bT(e,t){return e}function _T(e){var t={};return e.forEach(function(r,i){t[r]=!0}),t}function Nc(e,t,r){if(e.customInspect&&t&&Dc(t.inspect)&&t.inspect!==ho&&!(t.constructor&&t.constructor.prototype===t)){var i=t.inspect(r,e);if(!jc(i))i=Nc(e,i,r);return i}var n=wT(e,t);if(n)return n;var o=Object.keys(t),s=_T(o);if(e.showHidden)o=Object.getOwnPropertyNames(t);if(Oc(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return ym(t);if(o.length===0){if(Dc(t)){var h=t.name?": "+t.name:"";return e.stylize("[Function"+h+"]","special")}if(Cc(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(_m(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Oc(t))return ym(t)}var v="",b=!1,_=["{","}"];if(U1(t))b=!0,_=["[","]"];if(Dc(t)){var g=t.name?": "+t.name:"";v=" [Function"+g+"]"}if(Cc(t))v=" "+RegExp.prototype.toString.call(t);if(_m(t))v=" "+Date.prototype.toUTCString.call(t);if(Oc(t))v=" "+ym(t);if(o.length===0&&(!b||t.length==0))return _[0]+v+_[1];if(r<0)if(Cc(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");else return e.stylize("[Object]","special");e.seen.push(t);var S;if(b)S=ST(e,t,r,s,o);else S=o.map(function(x){return bm(e,t,r,s,x,b)});return e.seen.pop(),xT(S,v,_)}function wT(e,t){if(is(t))return e.stylize("undefined","undefined");if(jc(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(L1(t))return e.stylize(""+t,"number");if(Sm(t))return e.stylize(""+t,"boolean");if(zc(t))return e.stylize("null","null")}function ym(e){return"["+Error.prototype.toString.call(e)+"]"}function ST(e,t,r,i,n){var o=[];for(var s=0,h=t.length;s<h;++s)if(B1(t,String(s)))o.push(bm(e,t,r,i,String(s),!0));else o.push("");return n.forEach(function(v){if(!v.match(/^\d+$/))o.push(bm(e,t,r,i,v,!0))}),o}function bm(e,t,r,i,n,o){var s,h,v;if(v=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]},v.get)if(v.set)h=e.stylize("[Getter/Setter]","special");else h=e.stylize("[Getter]","special");else if(v.set)h=e.stylize("[Setter]","special");if(!B1(i,n))s="["+n+"]";if(!h)if(e.seen.indexOf(v.value)<0){if(zc(r))h=Nc(e,v.value,null);else h=Nc(e,v.value,r-1);if(h.indexOf(`
5
5
  `)>-1)if(o)h=h.split(`
6
6
  `).map(function(b){return" "+b}).join(`
@@ -20,10 +20,10 @@ https://github.com/browserify/crypto-browserify`)},e.constants={DH_CHECK_P_NOT_S
20
20
  `:""},this._extScope=e,this._scope=new Hn.Scope({parent:e}),this._nodes=[new Ak]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,i){let n=this._scope.toName(t);if(r!==void 0&&i)this._constants[n.str]=r;return this._leafNode(new Mk(e,n,r)),n}const(e,t,r){return this._def(Hn.varKinds.const,e,t,r)}let(e,t,r){return this._def(Hn.varKinds.let,e,t,r)}var(e,t,r){return this._def(Hn.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Ab(e,t,r))}add(e,t){return this._leafNode(new Ek(e,an.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==xt.nil)this._leafNode(new $k(e));return this}object(...e){let t=["{"];for(let[r,i]of e){if(t.length>1)t.push(",");if(t.push(r),r!==i||this.opts.es5)t.push(":"),(0,xt.addCodeArg)(t,i)}return t.push("}"),new xt._Code(t)}if(e,t,r){if(this._blockNode(new Ei(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Ei(e))}else(){return this._elseNode(new sc)}endIf(){return this._endBlockNode(Ei,sc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new Rk(e),t)}forRange(e,t,r,i,n=this.opts.es5?Hn.varKinds.var:Hn.varKinds.let){let o=this._scope.toName(e);return this._for(new Ck(n,o,t,r),()=>i(o))}forOf(e,t,r,i=Hn.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let o=t instanceof xt.Name?t:this.var("_arr",t);return this.forRange("_i",0,xt._`${o}.length`,(s)=>{this.var(n,xt._`${o}[${s}]`),r(n)})}return this._for(new Pb("of",i,n,t),()=>r(n))}forIn(e,t,r,i=this.opts.es5?Hn.varKinds.var:Hn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,xt._`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new Pb("in",i,n,t),()=>r(n))}endFor(){return this._endBlockNode(na)}label(e){return this._leafNode(new Ik(e))}break(e){return this._leafNode(new Tk(e))}return(e){let t=new xp;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(xp)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let i=new Ok;if(this._blockNode(i),this.code(e),t){let n=this.name("e");this._currNode=i.catch=new kp(n),t(n)}if(r)this._currNode=i.finally=new Mp,this.code(r);return this._endBlockNode(kp,Mp)}throw(e){return this._leafNode(new Pk(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=xt.nil,r,i){if(this._blockNode(new Sp(e,t,r)),i)this.code(i).endFunc();return this}endFunc(){return this._endBlockNode(Sp)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof Ei))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}an.CodeGen=Dk;function Zo(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Ep(e,t){return t instanceof xt._CodeOrName?Zo(e,t.names):e}function ia(e,t,r){if(e instanceof xt.Name)return i(e);if(!n(e))return e;return new xt._Code(e._items.reduce((o,s)=>{if(s instanceof xt.Name)s=i(s);if(s instanceof xt._Code)o.push(...s._items);else o.push(s);return o},[]));function i(o){let s=r[o.str];if(s===void 0||t[o.str]!==1)return o;return delete t[o.str],s}function n(o){return o instanceof xt._Code&&o._items.some((s)=>s instanceof xt.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function AN(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Nk(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:xt._`!${$b(e)}`}an.not=Nk;var RN=zk(an.operators.AND);function CN(...e){return e.reduce(RN)}an.and=CN;var ON=zk(an.operators.OR);function DN(...e){return e.reduce(ON)}an.or=DN;function zk(e){return(t,r)=>t===xt.nil?r:r===xt.nil?t:xt._`${$b(t)} ${e} ${$b(r)}`}function $b(e){return e instanceof xt.Name?e:xt._`(${e})`}});var Mt=Xe(function(Kk){Object.defineProperty(Kk,"__esModule",{value:!0});Kk.checkStrictMode=Kk.getErrorPath=Kk.Type=Kk.useFunc=Kk.setEvaluated=Kk.evaluatedPropsToName=Kk.mergeEvaluated=Kk.eachItem=Kk.unescapeJsonPointer=Kk.escapeJsonPointer=Kk.escapeFragment=Kk.unescapeFragment=Kk.schemaRefOrVal=Kk.schemaHasRulesButRef=Kk.schemaHasRules=Kk.checkUnknownRules=Kk.alwaysValidSchema=Kk.toHash=void 0;var jt=mt(),UN=oc();function LN(e){let t={};for(let r of e)t[r]=!0;return t}Kk.toHash=LN;function FN(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return Fk(e,t),!qk(t,e.self.RULES.all)}Kk.alwaysValidSchema=FN;function Fk(e,t=e.schema){let{opts:r,self:i}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let n=i.RULES.keywords;for(let o in t)if(!n[o])Zk(e,`unknown keyword: "${o}"`)}Kk.checkUnknownRules=Fk;function qk(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Kk.schemaHasRules=qk;function qN(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Kk.schemaHasRulesButRef=qN;function BN({topSchemaRef:e,schemaPath:t},r,i,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return jt._`${r}`}return jt._`${e}${t}${(0,jt.getProperty)(i)}`}Kk.schemaRefOrVal=BN;function HN(e){return Bk(decodeURIComponent(e))}Kk.unescapeFragment=HN;function ZN(e){return encodeURIComponent(Cb(e))}Kk.escapeFragment=ZN;function Cb(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}Kk.escapeJsonPointer=Cb;function Bk(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Kk.unescapeJsonPointer=Bk;function KN(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Kk.eachItem=KN;function Uk({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:i}){return(n,o,s,h)=>{let v=s===void 0?o:s instanceof jt.Name?(o instanceof jt.Name?e(n,o,s):t(n,o,s),s):o instanceof jt.Name?(t(n,s,o),o):r(o,s);return h===jt.Name&&!(v instanceof jt.Name)?i(n,v):v}}Kk.mergeEvaluated={props:Uk({mergeNames:(e,t,r)=>e.if(jt._`${r} !== true && ${t} !== undefined`,()=>{e.if(jt._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,jt._`${r} || {}`).code(jt._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(jt._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,jt._`${r} || {}`),Ob(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Hk}),items:Uk({mergeNames:(e,t,r)=>e.if(jt._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,jt._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(jt._`${r} !== true`,()=>e.assign(r,t===!0?!0:jt._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Hk(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",jt._`{}`);if(t!==void 0)Ob(e,r,t);return r}Kk.evaluatedPropsToName=Hk;function Ob(e,t,r){Object.keys(r).forEach((i)=>e.assign(jt._`${t}${(0,jt.getProperty)(i)}`,!0))}Kk.setEvaluated=Ob;var Lk={};function VN(e,t){return e.scopeValue("func",{ref:t,code:Lk[t.code]||(Lk[t.code]=new UN._Code(t.code))})}Kk.useFunc=VN;var Rb;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Rb||(Kk.Type=Rb={}));function WN(e,t,r){if(e instanceof jt.Name){let i=t===Rb.Num;return r?i?jt._`"[" + ${e} + "]"`:jt._`"['" + ${e} + "']"`:i?jt._`"/" + ${e}`:jt._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,jt.getProperty)(e).toString():"/"+Cb(e)}Kk.getErrorPath=WN;function Zk(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}Kk.checkStrictMode=Zk});var Ii=Xe(function(Wk){Object.defineProperty(Wk,"__esModule",{value:!0});var Br=mt(),fz={data:new Br.Name("data"),valCxt:new Br.Name("valCxt"),instancePath:new Br.Name("instancePath"),parentData:new Br.Name("parentData"),parentDataProperty:new Br.Name("parentDataProperty"),rootData:new Br.Name("rootData"),dynamicAnchors:new Br.Name("dynamicAnchors"),vErrors:new Br.Name("vErrors"),errors:new Br.Name("errors"),this:new Br.Name("this"),self:new Br.Name("self"),scope:new Br.Name("scope"),json:new Br.Name("json"),jsonPos:new Br.Name("jsonPos"),jsonLen:new Br.Name("jsonLen"),jsonPart:new Br.Name("jsonPart")};Wk.default=fz});var ac=Xe(function(Yk){Object.defineProperty(Yk,"__esModule",{value:!0});Yk.extendErrors=Yk.resetErrorsCount=Yk.reportExtraError=Yk.reportError=Yk.keyword$DataError=Yk.keywordError=void 0;var Et=mt(),$p=Mt(),Jr=Ii();Yk.keywordError={message:({keyword:e})=>Et.str`must pass "${e}" keyword validation`};Yk.keyword$DataError={message:({keyword:e,schemaType:t})=>t?Et.str`"${e}" keyword must be ${t} ($data)`:Et.str`"${e}" keyword is invalid ($data)`};function pz(e,t=Yk.keywordError,r,i){let{it:n}=e,{gen:o,compositeRule:s,allErrors:h}=n,v=Xk(e,t,r);if(i!==null&&i!==void 0?i:s||h)Gk(o,v);else Jk(n,Et._`[${v}]`)}Yk.reportError=pz;function mz(e,t=Yk.keywordError,r){let{it:i}=e,{gen:n,compositeRule:o,allErrors:s}=i,h=Xk(e,t,r);if(Gk(n,h),!(o||s))Jk(i,Jr.default.vErrors)}Yk.reportExtraError=mz;function gz(e,t){e.assign(Jr.default.errors,t),e.if(Et._`${Jr.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(Et._`${Jr.default.vErrors}.length`,t),()=>e.assign(Jr.default.vErrors,null)))}Yk.resetErrorsCount=gz;function yz({gen:e,keyword:t,schemaValue:r,data:i,errsCount:n,it:o}){if(n===void 0)throw Error("ajv implementation error");let s=e.name("err");e.forRange("i",n,Jr.default.errors,(h)=>{if(e.const(s,Et._`${Jr.default.vErrors}[${h}]`),e.if(Et._`${s}.instancePath === undefined`,()=>e.assign(Et._`${s}.instancePath`,(0,Et.strConcat)(Jr.default.instancePath,o.errorPath))),e.assign(Et._`${s}.schemaPath`,Et.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(Et._`${s}.schema`,r),e.assign(Et._`${s}.data`,i)})}Yk.extendErrors=yz;function Gk(e,t){let r=e.const("err",t);e.if(Et._`${Jr.default.vErrors} === null`,()=>e.assign(Jr.default.vErrors,Et._`[${r}]`),Et._`${Jr.default.vErrors}.push(${r})`),e.code(Et._`${Jr.default.errors}++`)}function Jk(e,t){let{gen:r,validateName:i,schemaEnv:n}=e;if(n.$async)r.throw(Et._`new ${e.ValidationError}(${t})`);else r.assign(Et._`${i}.errors`,t),r.return(!1)}var Ko={keyword:new Et.Name("keyword"),schemaPath:new Et.Name("schemaPath"),params:new Et.Name("params"),propertyName:new Et.Name("propertyName"),message:new Et.Name("message"),schema:new Et.Name("schema"),parentSchema:new Et.Name("parentSchema")};function Xk(e,t,r){let{createErrors:i}=e.it;if(i===!1)return Et._`{}`;return vz(e,t,r)}function vz(e,t,r={}){let{gen:i,it:n}=e,o=[bz(n,r),_z(e,r)];return wz(e,t,o),i.object(...o)}function bz({errorPath:e},{instancePath:t}){let r=t?Et.str`${e}${(0,$p.getErrorPath)(t,$p.Type.Str)}`:e;return[Jr.default.instancePath,(0,Et.strConcat)(Jr.default.instancePath,r)]}function _z({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:i}){let n=i?t:Et.str`${t}/${e}`;if(r)n=Et.str`${n}${(0,$p.getErrorPath)(r,$p.Type.Str)}`;return[Ko.schemaPath,n]}function wz(e,{params:t,message:r},i){let{keyword:n,data:o,schemaValue:s,it:h}=e,{opts:v,propertyName:b,topSchemaRef:_,schemaPath:g}=h;if(i.push([Ko.keyword,n],[Ko.params,typeof t=="function"?t(e):t||Et._`{}`]),v.messages)i.push([Ko.message,typeof r=="function"?r(e):r]);if(v.verbose)i.push([Ko.schema,s],[Ko.parentSchema,Et._`${_}${g}`],[Jr.default.data,o]);if(b)i.push([Ko.propertyName,b])}});var nM=Xe(function(tM){Object.defineProperty(tM,"__esModule",{value:!0});tM.boolOrEmptySchema=tM.topBoolOrEmptySchema=void 0;var Ez=ac(),Iz=mt(),Tz=Ii(),Pz={message:"boolean schema is false"};function $z(e){let{gen:t,schema:r,validateName:i}=e;if(r===!1)eM(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(Tz.default.data);else t.assign(Iz._`${i}.errors`,null),t.return(!0)}tM.topBoolOrEmptySchema=$z;function Az(e,t){let{gen:r,schema:i}=e;if(i===!1)r.var(t,!1),eM(e);else r.var(t,!0)}tM.boolOrEmptySchema=Az;function eM(e,t){let{gen:r,data:i}=e,n={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Ez.reportError)(n,Pz,void 0,t)}});var Nb=Xe(function(iM){Object.defineProperty(iM,"__esModule",{value:!0});iM.getRules=iM.isJSONType=void 0;var Cz=["string","number","integer","boolean","null","object","array"],Oz=new Set(Cz);function Dz(e){return typeof e=="string"&&Oz.has(e)}iM.isJSONType=Dz;function Nz(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}iM.getRules=Nz});var zb=Xe(function(uM){Object.defineProperty(uM,"__esModule",{value:!0});uM.shouldUseRule=uM.shouldUseGroup=uM.schemaHasRulesForType=void 0;function jz({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&sM(e,i)}uM.schemaHasRulesForType=jz;function sM(e,t){return t.rules.some((r)=>aM(e,r))}uM.shouldUseGroup=sM;function aM(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((i)=>e[i]!==void 0))}uM.shouldUseRule=aM});var uc=Xe(function(hM){Object.defineProperty(hM,"__esModule",{value:!0});hM.reportTypeError=hM.checkDataTypes=hM.checkDataType=hM.coerceAndCheckDataType=hM.getJSONTypes=hM.getSchemaTypes=hM.DataType=void 0;var Fz=Nb(),qz=zb(),Bz=ac(),ht=mt(),cM=Mt(),oa;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(oa||(hM.DataType=oa={}));function Hz(e){let t=dM(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}hM.getSchemaTypes=Hz;function dM(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Fz.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}hM.getJSONTypes=dM;function Zz(e,t){let{gen:r,data:i,opts:n}=e,o=Kz(t,n.coerceTypes),s=t.length>0&&!(o.length===0&&t.length===1&&(0,qz.schemaHasRulesForType)(e,t[0]));if(s){let h=Ub(t,i,n.strictNumbers,oa.Wrong);r.if(h,()=>{if(o.length)Vz(e,t,o);else Lb(e)})}return s}hM.coerceAndCheckDataType=Zz;var fM=new Set(["string","number","integer","boolean","null"]);function Kz(e,t){return t?e.filter((r)=>fM.has(r)||t==="array"&&r==="array"):[]}function Vz(e,t,r){let{gen:i,data:n,opts:o}=e,s=i.let("dataType",ht._`typeof ${n}`),h=i.let("coerced",ht._`undefined`);if(o.coerceTypes==="array")i.if(ht._`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,ht._`${n}[0]`).assign(s,ht._`typeof ${n}`).if(Ub(t,n,o.strictNumbers),()=>i.assign(h,n)));i.if(ht._`${h} !== undefined`);for(let b of r)if(fM.has(b)||b==="array"&&o.coerceTypes==="array")v(b);i.else(),Lb(e),i.endIf(),i.if(ht._`${h} !== undefined`,()=>{i.assign(n,h),Wz(e,h)});function v(b){switch(b){case"string":i.elseIf(ht._`${s} == "number" || ${s} == "boolean"`).assign(h,ht._`"" + ${n}`).elseIf(ht._`${n} === null`).assign(h,ht._`""`);return;case"number":i.elseIf(ht._`${s} == "boolean" || ${n} === null
21
21
  || (${s} == "string" && ${n} && ${n} == +${n})`).assign(h,ht._`+${n}`);return;case"integer":i.elseIf(ht._`${s} === "boolean" || ${n} === null
22
22
  || (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(h,ht._`+${n}`);return;case"boolean":i.elseIf(ht._`${n} === "false" || ${n} === 0 || ${n} === null`).assign(h,!1).elseIf(ht._`${n} === "true" || ${n} === 1`).assign(h,!0);return;case"null":i.elseIf(ht._`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(h,null);return;case"array":i.elseIf(ht._`${s} === "string" || ${s} === "number"
23
- || ${s} === "boolean" || ${n} === null`).assign(h,ht._`[${n}]`)}}}function Wz({gen:e,parentData:t,parentDataProperty:r},i){e.if(ht._`${t} !== undefined`,()=>e.assign(ht._`${t}[${r}]`,i))}function jb(e,t,r,i=oa.Correct){let n=i===oa.Correct?ht.operators.EQ:ht.operators.NEQ,o;switch(e){case"null":return ht._`${t} ${n} null`;case"array":o=ht._`Array.isArray(${t})`;break;case"object":o=ht._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s(ht._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return ht._`typeof ${t} ${n} ${e}`}return i===oa.Correct?o:(0,ht.not)(o);function s(h=ht.nil){return(0,ht.and)(ht._`typeof ${t} == "number"`,h,r?ht._`isFinite(${t})`:ht.nil)}}hM.checkDataType=jb;function Ub(e,t,r,i){if(e.length===1)return jb(e[0],t,r,i);let n,o=(0,cM.toHash)(e);if(o.array&&o.object){let s=ht._`typeof ${t} != "object"`;n=o.null?s:ht._`!${t} || ${s}`,delete o.null,delete o.array,delete o.object}else n=ht.nil;if(o.number)delete o.integer;for(let s in o)n=(0,ht.and)(n,jb(s,t,r,i));return n}hM.checkDataTypes=Ub;var Gz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?ht._`{type: ${e}}`:ht._`{type: ${t}}`};function Lb(e){let t=Jz(e);(0,Bz.reportError)(t,Gz)}hM.reportTypeError=Lb;function Jz(e){let{gen:t,data:r,schema:i}=e,n=(0,cM.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:e}}});var vM=Xe(function(gM){Object.defineProperty(gM,"__esModule",{value:!0});gM.assignDefaults=void 0;var sa=mt(),nj=Mt();function ij(e,t){let{properties:r,items:i}=e.schema;if(t==="object"&&r)for(let n in r)mM(e,n,r[n].default);else if(t==="array"&&Array.isArray(i))i.forEach((n,o)=>mM(e,o,n.default))}gM.assignDefaults=ij;function mM(e,t,r){let{gen:i,compositeRule:n,data:o,opts:s}=e;if(r===void 0)return;let h=sa._`${o}${(0,sa.getProperty)(t)}`;if(n){(0,nj.checkStrictMode)(e,`default is ignored for: ${h}`);return}let v=sa._`${h} === undefined`;if(s.useDefaults==="empty")v=sa._`${v} || ${h} === null || ${h} === ""`;i.if(v,sa._`${h} = ${(0,sa.stringify)(r)}`)}});var Rn=Xe(function(wM){Object.defineProperty(wM,"__esModule",{value:!0});wM.validateUnion=wM.validateArray=wM.usePattern=wM.callValidateCode=wM.schemaProperties=wM.allSchemaProperties=wM.noPropertyInData=wM.propertyInData=wM.isOwnProperty=wM.hasPropFunc=wM.reportMissingProp=wM.checkMissingProp=wM.checkReportMissingProp=void 0;var Bt=mt(),Fb=Mt(),oo=Ii(),oj=Mt();function sj(e,t){let{gen:r,data:i,it:n}=e;r.if(Bb(r,i,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:Bt._`${t}`},!0),e.error()})}wM.checkReportMissingProp=sj;function aj({gen:e,data:t,it:{opts:r}},i,n){return(0,Bt.or)(...i.map((o)=>(0,Bt.and)(Bb(e,t,o,r.ownProperties),Bt._`${n} = ${o}`)))}wM.checkMissingProp=aj;function uj(e,t){e.setParams({missingProperty:t},!0),e.error()}wM.reportMissingProp=uj;function bM(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Bt._`Object.prototype.hasOwnProperty`})}wM.hasPropFunc=bM;function qb(e,t,r){return Bt._`${bM(e)}.call(${t}, ${r})`}wM.isOwnProperty=qb;function lj(e,t,r,i){let n=Bt._`${t}${(0,Bt.getProperty)(r)} !== undefined`;return i?Bt._`${n} && ${qb(e,t,r)}`:n}wM.propertyInData=lj;function Bb(e,t,r,i){let n=Bt._`${t}${(0,Bt.getProperty)(r)} === undefined`;return i?(0,Bt.or)(n,(0,Bt.not)(qb(e,t,r))):n}wM.noPropertyInData=Bb;function _M(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}wM.allSchemaProperties=_M;function cj(e,t){return _M(t).filter((r)=>!(0,Fb.alwaysValidSchema)(e,t[r]))}wM.schemaProperties=cj;function dj({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},h,v,b){let _=b?Bt._`${e}, ${t}, ${i}${n}`:t,g=[[oo.default.instancePath,(0,Bt.strConcat)(oo.default.instancePath,o)],[oo.default.parentData,s.parentData],[oo.default.parentDataProperty,s.parentDataProperty],[oo.default.rootData,oo.default.rootData]];if(s.opts.dynamicRef)g.push([oo.default.dynamicAnchors,oo.default.dynamicAnchors]);let S=Bt._`${_}, ${r.object(...g)}`;return v!==Bt.nil?Bt._`${h}.call(${v}, ${S})`:Bt._`${h}(${S})`}wM.callValidateCode=dj;var fj=Bt._`new RegExp`;function hj({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:n}=t.code,o=n(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:Bt._`${n.code==="new RegExp"?fj:(0,oj.useFunc)(e,n)}(${r}, ${i})`})}wM.usePattern=hj;function pj(e){let{gen:t,data:r,keyword:i,it:n}=e,o=t.name("valid");if(n.allErrors){let h=t.let("valid",!0);return s(()=>t.assign(h,!1)),h}return t.var(o,!0),s(()=>t.break()),o;function s(h){let v=t.const("len",Bt._`${r}.length`);t.forRange("i",0,v,(b)=>{e.subschema({keyword:i,dataProp:b,dataPropType:Fb.Type.Num},o),t.if((0,Bt.not)(o),h)})}}wM.validateArray=pj;function mj(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((v)=>(0,Fb.alwaysValidSchema)(n,v))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),h=t.name("_valid");t.block(()=>r.forEach((v,b)=>{let _=e.subschema({keyword:i,schemaProp:b,compositeRule:!0},h);if(t.assign(s,Bt._`${s} || ${h}`),!e.mergeValidEvaluated(_,h))t.if((0,Bt.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}wM.validateUnion=mj});var IM=Xe(function(MM){Object.defineProperty(MM,"__esModule",{value:!0});MM.validateKeywordUsage=MM.validSchemaType=MM.funcKeywordCode=MM.macroKeywordCode=void 0;var Xr=mt(),Vo=Ii(),Tj=Rn(),Pj=ac();function $j(e,t){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=e,h=t.macro.call(s.self,n,o,s),v=kM(r,i,h);if(s.opts.validateSchema!==!1)s.self.validateSchema(h,!0);let b=r.name("valid");e.subschema({schema:h,schemaPath:Xr.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:v,compositeRule:!0},b),e.pass(b,()=>e.error(!0))}MM.macroKeywordCode=$j;function Aj(e,t){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:h,it:v}=e;Cj(v,t);let b=!h&&t.compile?t.compile.call(v.self,o,s,v):t.validate,_=kM(i,n,b),g=i.let("valid");e.block$data(g,S),e.ok((r=t.valid)!==null&&r!==void 0?r:g);function S(){if(t.errors===!1){if(I(),t.modifying)xM(e);T(()=>e.error())}else{let P=t.async?x():M();if(t.modifying)xM(e);T(()=>Rj(e,P))}}function x(){let P=i.let("ruleErrs",null);return i.try(()=>I(Xr._`await `),($)=>i.assign(g,!1).if(Xr._`${$} instanceof ${v.ValidationError}`,()=>i.assign(P,Xr._`${$}.errors`),()=>i.throw($))),P}function M(){let P=Xr._`${_}.errors`;return i.assign(P,null),I(Xr.nil),P}function I(P=t.async?Xr._`await `:Xr.nil){let $=v.opts.passContext?Vo.default.this:Vo.default.self,R=!(("compile"in t)&&!h||t.schema===!1);i.assign(g,Xr._`${P}${(0,Tj.callValidateCode)(e,_,$,R)}`,t.modifying)}function T(P){var $;i.if((0,Xr.not)(($=t.valid)!==null&&$!==void 0?$:g),P)}}MM.funcKeywordCode=Aj;function xM(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,Xr._`${i.parentData}[${i.parentDataProperty}]`))}function Rj(e,t){let{gen:r}=e;r.if(Xr._`Array.isArray(${t})`,()=>{r.assign(Vo.default.vErrors,Xr._`${Vo.default.vErrors} === null ? ${t} : ${Vo.default.vErrors}.concat(${t})`).assign(Vo.default.errors,Xr._`${Vo.default.vErrors}.length`),(0,Pj.extendErrors)(e)},()=>e.error())}function Cj({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function kM(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Xr.stringify)(r)})}function Oj(e,t,r=!1){return!t.length||t.some((i)=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||r&&typeof e>"u")}MM.validSchemaType=Oj;function Dj({schema:e,opts:t,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw Error("ajv implementation error");let s=n.dependencies;if(s===null||s===void 0?void 0:s.some((h)=>!Object.prototype.hasOwnProperty.call(e,h)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[o])){let v=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(v);else throw Error(v)}}}MM.validateKeywordUsage=Dj});var AM=Xe(function(PM){Object.defineProperty(PM,"__esModule",{value:!0});PM.extendSubschemaMode=PM.extendSubschemaData=PM.getSubschema=void 0;var ti=mt(),TM=Mt();function Uj(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(t!==void 0&&i!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let h=e.schema[t];return r===void 0?{schema:h,schemaPath:ti._`${e.schemaPath}${(0,ti.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:h[r],schemaPath:ti._`${e.schemaPath}${(0,ti.getProperty)(t)}${(0,ti.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,TM.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}PM.getSubschema=Uj;function Lj(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:h}=t;if(r!==void 0){let{errorPath:b,dataPathArr:_,opts:g}=t,S=h.let("data",ti._`${t.data}${(0,ti.getProperty)(r)}`,!0);v(S),e.errorPath=ti.str`${b}${(0,TM.getErrorPath)(r,i,g.jsPropertySyntax)}`,e.parentDataProperty=ti._`${r}`,e.dataPathArr=[..._,e.parentDataProperty]}if(n!==void 0){let b=n instanceof ti.Name?n:h.let("data",n,!0);if(v(b),s!==void 0)e.propertyName=s}if(o)e.dataTypes=o;function v(b){e.data=b,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,b]}}PM.extendSubschemaData=Lj;function Fj(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){if(i!==void 0)e.compositeRule=i;if(n!==void 0)e.createErrors=n;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=r}PM.extendSubschemaMode=Fj});var Hb=Xe(function(zbe,RM){RM.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(t)){if(i=t.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var s=o[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var OM=Xe(function(jbe,CM){var so=CM.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Ap(t,i,n,e,"",e)};so.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};so.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};so.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};so.skipKeywords={default:!0,enum:!0,const:!0,required:!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};function Ap(e,t,r,i,n,o,s,h,v,b){if(i&&typeof i=="object"&&!Array.isArray(i)){t(i,n,o,s,h,v,b);for(var _ in i){var g=i[_];if(Array.isArray(g)){if(_ in so.arrayKeywords)for(var S=0;S<g.length;S++)Ap(e,t,r,g[S],n+"/"+_+"/"+S,o,n,_,i,S)}else if(_ in so.propsKeywords){if(g&&typeof g=="object")for(var x in g)Ap(e,t,r,g[x],n+"/"+_+"/"+Hj(x),o,n,_,i,x)}else if(_ in so.keywords||e.allKeys&&!(_ in so.skipKeywords))Ap(e,t,r,g,n+"/"+_,o,n,_,i)}r(i,n,o,s,h,v,b)}}function Hj(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var lc=Xe(function(jM){Object.defineProperty(jM,"__esModule",{value:!0});jM.getSchemaRefs=jM.resolveUrl=jM.normalizeId=jM._getFullPath=jM.getFullPath=jM.inlineRef=void 0;var Zj=Mt(),Kj=Hb(),Vj=OM(),Wj=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Gj(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Zb(e);if(!t)return!1;return DM(e)<=t}jM.inlineRef=Gj;var Jj=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Zb(e){for(let t in e){if(Jj.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Zb))return!0;if(typeof r=="object"&&Zb(r))return!0}return!1}function DM(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,Wj.has(r))continue;if(typeof e[r]=="object")(0,Zj.eachItem)(e[r],(i)=>t+=DM(i));if(t===1/0)return 1/0}return t}function NM(e,t="",r){if(r!==!1)t=aa(t);let i=e.parse(t);return zM(e,i)}jM.getFullPath=NM;function zM(e,t){return e.serialize(t).split("#")[0]+"#"}jM._getFullPath=zM;var Xj=/#\/?$/;function aa(e){return e?e.replace(Xj,""):""}jM.normalizeId=aa;function Yj(e,t,r){return r=aa(r),e.resolve(t,r)}jM.resolveUrl=Yj;var Qj=/^[a-z_][-a-z0-9._]*$/i;function eU(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=aa(e[r]||t),o={"":n},s=NM(i,n,!1),h={},v=new Set;return Vj(e,{allKeys:!0},(g,S,x,M)=>{if(M===void 0)return;let I=s+S,T=o[M];if(typeof g[r]=="string")T=P.call(this,g[r]);$.call(this,g.$anchor),$.call(this,g.$dynamicAnchor),o[S]=T;function P(R){let C=this.opts.uriResolver.resolve;if(R=aa(T?C(T,R):R),v.has(R))throw _(R);v.add(R);let N=this.refs[R];if(typeof N=="string")N=this.refs[N];if(typeof N=="object")b(g,N.schema,R);else if(R!==aa(I))if(R[0]==="#")b(g,h[R],R),h[R]=g;else this.refs[R]=I;return R}function $(R){if(typeof R=="string"){if(!Qj.test(R))throw Error(`invalid anchor "${R}"`);P.call(this,`#${R}`)}}}),h;function b(g,S,x){if(S!==void 0&&!Kj(g,S))throw _(x)}function _(g){return Error(`reference "${g}" resolves to more than one schema`)}}jM.getSchemaRefs=eU});var fc=Xe(function(e4){Object.defineProperty(e4,"__esModule",{value:!0});e4.getData=e4.KeywordCxt=e4.validateFunctionCode=void 0;var HM=nM(),LM=uc(),Vb=zb(),Rp=uc(),sU=vM(),dc=IM(),Kb=AM(),nt=mt(),ct=Ii(),aU=lc(),Ti=Mt(),cc=ac();function uU(e){if(VM(e)){if(WM(e),KM(e)){dU(e);return}}ZM(e,()=>(0,HM.topBoolOrEmptySchema)(e))}e4.validateFunctionCode=uU;function ZM({gen:e,validateName:t,schema:r,schemaEnv:i,opts:n},o){if(n.code.es5)e.func(t,nt._`${ct.default.data}, ${ct.default.valCxt}`,i.$async,()=>{e.code(nt._`"use strict"; ${FM(r,n)}`),cU(e,n),e.code(o)});else e.func(t,nt._`${ct.default.data}, ${lU(n)}`,i.$async,()=>e.code(FM(r,n)).code(o))}function lU(e){return nt._`{${ct.default.instancePath}="", ${ct.default.parentData}, ${ct.default.parentDataProperty}, ${ct.default.rootData}=${ct.default.data}${e.dynamicRef?nt._`, ${ct.default.dynamicAnchors}={}`:nt.nil}}={}`}function cU(e,t){e.if(ct.default.valCxt,()=>{if(e.var(ct.default.instancePath,nt._`${ct.default.valCxt}.${ct.default.instancePath}`),e.var(ct.default.parentData,nt._`${ct.default.valCxt}.${ct.default.parentData}`),e.var(ct.default.parentDataProperty,nt._`${ct.default.valCxt}.${ct.default.parentDataProperty}`),e.var(ct.default.rootData,nt._`${ct.default.valCxt}.${ct.default.rootData}`),t.dynamicRef)e.var(ct.default.dynamicAnchors,nt._`${ct.default.valCxt}.${ct.default.dynamicAnchors}`)},()=>{if(e.var(ct.default.instancePath,nt._`""`),e.var(ct.default.parentData,nt._`undefined`),e.var(ct.default.parentDataProperty,nt._`undefined`),e.var(ct.default.rootData,ct.default.data),t.dynamicRef)e.var(ct.default.dynamicAnchors,nt._`{}`)})}function dU(e){let{schema:t,opts:r,gen:i}=e;ZM(e,()=>{if(r.$comment&&t.$comment)JM(e);if(gU(e),i.let(ct.default.vErrors,null),i.let(ct.default.errors,0),r.unevaluated)fU(e);GM(e),bU(e)});return}function fU(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",nt._`${r}.evaluated`),t.if(nt._`${e.evaluated}.dynamicProps`,()=>t.assign(nt._`${e.evaluated}.props`,nt._`undefined`)),t.if(nt._`${e.evaluated}.dynamicItems`,()=>t.assign(nt._`${e.evaluated}.items`,nt._`undefined`))}function FM(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?nt._`/*# sourceURL=${r} */`:nt.nil}function hU(e,t){if(VM(e)){if(WM(e),KM(e)){pU(e,t);return}}(0,HM.boolOrEmptySchema)(e,t)}function KM({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function VM(e){return typeof e.schema!="boolean"}function pU(e,t){let{schema:r,gen:i,opts:n}=e;if(n.$comment&&r.$comment)JM(e);yU(e),vU(e);let o=i.const("_errs",ct.default.errors);GM(e,o),i.var(t,nt._`${o} === ${ct.default.errors}`)}function WM(e){(0,Ti.checkUnknownRules)(e),mU(e)}function GM(e,t){if(e.opts.jtd)return qM(e,[],!1,t);let r=(0,LM.getSchemaTypes)(e.schema),i=(0,LM.coerceAndCheckDataType)(e,r);qM(e,r,!i,t)}function mU(e){let{schema:t,errSchemaPath:r,opts:i,self:n}=e;if(t.$ref&&i.ignoreKeywordsWithRef&&(0,Ti.schemaHasRulesButRef)(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function gU(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)(0,Ti.checkStrictMode)(e,"default is ignored in the schema root")}function yU(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,aU.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function vU(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function JM({gen:e,schemaEnv:t,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)e.code(nt._`${ct.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=nt.str`${i}/$comment`,h=e.scopeValue("root",{ref:t.root});e.code(nt._`${ct.default.self}.opts.$comment(${o}, ${s}, ${h}.schema)`)}}function bU(e){let{gen:t,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=e;if(r.$async)t.if(nt._`${ct.default.errors} === 0`,()=>t.return(ct.default.data),()=>t.throw(nt._`new ${n}(${ct.default.vErrors})`));else{if(t.assign(nt._`${i}.errors`,ct.default.vErrors),o.unevaluated)_U(e);t.return(nt._`${ct.default.errors} === 0`)}}function _U({gen:e,evaluated:t,props:r,items:i}){if(r instanceof nt.Name)e.assign(nt._`${t}.props`,r);if(i instanceof nt.Name)e.assign(nt._`${t}.items`,i)}function qM(e,t,r,i){let{gen:n,schema:o,data:s,allErrors:h,opts:v,self:b}=e,{RULES:_}=b;if(o.$ref&&(v.ignoreKeywordsWithRef||!(0,Ti.schemaHasRulesButRef)(o,_))){n.block(()=>YM(e,"$ref",_.all.$ref.definition));return}if(!v.jtd)wU(e,t);n.block(()=>{for(let S of _.rules)g(S);g(_.post)});function g(S){if(!(0,Vb.shouldUseGroup)(o,S))return;if(S.type){if(n.if((0,Rp.checkDataType)(S.type,s,v.strictNumbers)),BM(e,S),t.length===1&&t[0]===S.type&&r)n.else(),(0,Rp.reportTypeError)(e);n.endIf()}else BM(e,S);if(!h)n.if(nt._`${ct.default.errors} === ${i||0}`)}}function BM(e,t){let{gen:r,schema:i,opts:{useDefaults:n}}=e;if(n)(0,sU.assignDefaults)(e,t.type);r.block(()=>{for(let o of t.rules)if((0,Vb.shouldUseRule)(i,o))YM(e,o.keyword,o.definition,t.type)})}function wU(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(SU(e,t),!e.opts.allowUnionTypes)xU(e,t);kU(e,e.dataTypes)}function SU(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!XM(e.dataTypes,r))Wb(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),EU(e,t)}function xU(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Wb(e,"use allowUnionTypes to allow union type keyword")}function kU(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,Vb.shouldUseRule)(e.schema,n)){let{type:o}=n.definition;if(o.length&&!o.some((s)=>MU(t,s)))Wb(e,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function MU(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function XM(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function EU(e,t){let r=[];for(let i of e.dataTypes)if(XM(t,i))r.push(i);else if(t.includes("integer")&&i==="number")r.push("integer");e.dataTypes=r}function Wb(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ti.checkStrictMode)(e,t,e.opts.strictTypes)}class Gb{constructor(e,t,r){if((0,dc.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ti.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",QM(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,dc.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",ct.default.errors)}result(e,t,r){this.failResult((0,nt.not)(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult((0,nt.not)(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(nt._`${t} !== undefined && (${(0,nt.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?cc.reportExtraError:cc.reportError)(this,this.def.error,t)}$dataError(){(0,cc.reportError)(this,this.def.$dataError||cc.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,cc.resetErrorsCount)(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=nt.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=nt.nil,t=nt.nil){if(!this.$data)return;let{gen:r,schemaCode:i,schemaType:n,def:o}=this;if(r.if((0,nt.or)(nt._`${i} === undefined`,t)),e!==nt.nil)r.assign(e,!0);if(n.length||o.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==nt.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:i,it:n}=this;return(0,nt.or)(o(),s());function o(){if(r.length){if(!(t instanceof nt.Name))throw Error("ajv implementation error");let h=Array.isArray(r)?r:[r];return nt._`${(0,Rp.checkDataTypes)(h,t,n.opts.strictNumbers,Rp.DataType.Wrong)}`}return nt.nil}function s(){if(i.validateSchema){let h=e.scopeValue("validate$data",{ref:i.validateSchema});return nt._`!${h}(${t})`}return nt.nil}}subschema(e,t){let r=(0,Kb.getSubschema)(this.it,e);(0,Kb.extendSubschemaData)(r,this.it,e),(0,Kb.extendSubschemaMode)(r,e);let i={...this.it,...r,items:void 0,props:void 0};return hU(i,t),i}mergeEvaluated(e,t){let{it:r,gen:i}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=Ti.mergeEvaluated.props(i,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Ti.mergeEvaluated.items(i,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:i}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return i.if(t,()=>this.mergeEvaluated(e,nt.Name)),!0}}e4.KeywordCxt=Gb;function YM(e,t,r,i){let n=new Gb(e,r,t);if("code"in r)r.code(n,i);else if(n.$data&&r.validate)(0,dc.funcKeywordCode)(n,r);else if("macro"in r)(0,dc.macroKeywordCode)(n,r);else if(r.compile||r.validate)(0,dc.funcKeywordCode)(n,r)}var IU=/^\/(?:[^~]|~0|~1)*$/,TU=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function QM(e,{dataLevel:t,dataNames:r,dataPathArr:i}){let n,o;if(e==="")return ct.default.rootData;if(e[0]==="/"){if(!IU.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,o=ct.default.rootData}else{let b=TU.exec(e);if(!b)throw Error(`Invalid JSON-pointer: ${e}`);let _=+b[1];if(n=b[2],n==="#"){if(_>=t)throw Error(v("property/index",_));return i[t-_]}if(_>t)throw Error(v("data",_));if(o=r[t-_],!n)return o}let s=o,h=n.split("/");for(let b of h)if(b)o=nt._`${o}${(0,nt.getProperty)((0,Ti.unescapeJsonPointer)(b))}`,s=nt._`${s} && ${o}`;return s;function v(b,_){return`Cannot access ${b} ${_} levels up, current level is ${t}`}}e4.getData=QM});var Cp=Xe(function(n4){Object.defineProperty(n4,"__esModule",{value:!0});class r4 extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}n4.default=r4});var hc=Xe(function(o4){Object.defineProperty(o4,"__esModule",{value:!0});var Jb=lc();class i4 extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`);this.missingRef=(0,Jb.resolveUrl)(e,t,r),this.missingSchema=(0,Jb.normalizeId)((0,Jb.getFullPath)(e,this.missingRef))}}o4.default=i4});var Dp=Xe(function(u4){Object.defineProperty(u4,"__esModule",{value:!0});u4.resolveSchema=u4.getCompilingSchema=u4.resolveRef=u4.compileSchema=u4.SchemaEnv=void 0;var Zn=mt(),CU=Cp(),Wo=Ii(),Kn=lc(),s4=Mt(),OU=fc();class pc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:(0,Kn.normalizeId)(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}u4.SchemaEnv=pc;function Yb(e){let t=a4.call(this,e);if(t)return t;let r=(0,Kn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new Zn.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),h;if(e.$async)h=s.scopeValue("Error",{ref:CU.default,code:Zn._`require("ajv/dist/runtime/validation_error").default`});let v=s.scopeName("validate");e.validateName=v;let b={gen:s,allErrors:this.opts.allErrors,data:Wo.default.data,parentData:Wo.default.parentData,parentDataProperty:Wo.default.parentDataProperty,dataNames:[Wo.default.data],dataPathArr:[Zn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Zn.stringify)(e.schema)}:{ref:e.schema}),validateName:v,ValidationError:h,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Zn.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:Zn._`""`,opts:this.opts,self:this},_;try{this._compilations.add(e),(0,OU.validateFunctionCode)(b),s.optimize(this.opts.code.optimize);let g=s.toString();if(_=`${s.scopeRefs(Wo.default.scope)}return ${g}`,this.opts.code.process)_=this.opts.code.process(_,e);let x=Function(`${Wo.default.self}`,`${Wo.default.scope}`,_)(this,this.scope.get());if(this.scope.value(v,{ref:x}),x.errors=null,x.schema=e.schema,x.schemaEnv=e,e.$async)x.$async=!0;if(this.opts.code.source===!0)x.source={validateName:v,validateCode:g,scopeValues:s._values};if(this.opts.unevaluated){let{props:M,items:I}=b;if(x.evaluated={props:M instanceof Zn.Name?void 0:M,items:I instanceof Zn.Name?void 0:I,dynamicProps:M instanceof Zn.Name,dynamicItems:I instanceof Zn.Name},x.source)x.source.evaluated=(0,Zn.stringify)(x.evaluated)}return e.validate=x,e}catch(g){if(delete e.validate,delete e.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw g}finally{this._compilations.delete(e)}}u4.compileSchema=Yb;function DU(e,t,r){var i;r=(0,Kn.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=jU.call(this,e,r);if(o===void 0){let s=(i=e.localRefs)===null||i===void 0?void 0:i[r],{schemaId:h}=this.opts;if(s)o=new pc({schema:s,schemaId:h,root:e,baseId:t})}if(o===void 0)return;return e.refs[r]=NU.call(this,o)}u4.resolveRef=DU;function NU(e){if((0,Kn.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Yb.call(this,e)}function a4(e){for(let t of this._compilations)if(zU(t,e))return t}u4.getCompilingSchema=a4;function zU(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function jU(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Op.call(this,e,t)}function Op(e,t){let r=this.opts.uriResolver.parse(t),i=(0,Kn._getFullPath)(this.opts.uriResolver,r),n=(0,Kn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===n)return Xb.call(this,r,e);let o=(0,Kn.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let h=Op.call(this,e,s);if(typeof(h===null||h===void 0?void 0:h.schema)!=="object")return;return Xb.call(this,r,h)}if(typeof(s===null||s===void 0?void 0:s.schema)!=="object")return;if(!s.validate)Yb.call(this,s);if(o===(0,Kn.normalizeId)(t)){let{schema:h}=s,{schemaId:v}=this.opts,b=h[v];if(b)n=(0,Kn.resolveUrl)(this.opts.uriResolver,n,b);return new pc({schema:h,schemaId:v,root:e,baseId:n})}return Xb.call(this,r,s)}u4.resolveSchema=Op;var UU=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Xb(e,{baseId:t,schema:r,root:i}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let h of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let v=r[(0,s4.unescapeFragment)(h)];if(v===void 0)return;r=v;let b=typeof r==="object"&&r[this.opts.schemaId];if(!UU.has(h)&&b)t=(0,Kn.resolveUrl)(this.opts.uriResolver,t,b)}let o;if(typeof r!="boolean"&&r.$ref&&!(0,s4.schemaHasRulesButRef)(r,this.RULES)){let h=(0,Kn.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Op.call(this,i,h)}let{schemaId:s}=this.opts;if(o=o||new pc({schema:r,schemaId:s,root:i,baseId:t}),o.schema!==o.root.schema)return o;return}});var c4=Xe(function(Hbe,HU){HU.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var t_=Xe(function(Zbe,g4){var ZU=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),f4=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Qb=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),h4=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),KU=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function e_(e){let t="",r=0,i=0;for(i=0;i<e.length;i++){if(r=e[i].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i];break}for(i+=1;i<e.length;i++){if(r=e[i].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i]}return t}var VU=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function d4(e){return e.length=0,!0}function WU(e,t,r){if(e.length){let i=e_(e);if(i!=="")t.push(i);else return r.error=!0,!1;e.length=0}return!0}function GU(e){let t=0,r={error:!1,address:"",zone:""},i=[],n=[],o=!1,s=!1,h=WU;for(let v=0;v<e.length;v++){let b=e[v];if(b==="["||b==="]")continue;if(b===":"){if(o===!0)s=!0;if(!h(n,i,r))break;if(++t>7){r.error=!0;break}if(v>0&&e[v-1]===":")o=!0;i.push(":");continue}else if(b==="%"){if(!h(n,i,r))break;h=d4}else{n.push(b);continue}}if(n.length)if(h===d4)r.zone=n.join("");else if(s)i.push(n.join(""));else i.push(e_(n));return r.address=i.join(""),r}function p4(e){if(JU(e,":")<2)return{host:e,isIPV6:!1};let t=GU(e);if(!t.error){let{address:r,address:i}=t;if(t.zone)r+="%"+t.zone,i+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:i}}else return{host:e,isIPV6:!1}}function JU(e,t){let r=0;for(let i=0;i<e.length;i++)if(e[i]===t)r++;return r}function XU(e){let t=e,r=[],i=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((i=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,i)),t=t.slice(i)}return r.join("")}var YU={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},QU=/[@/?#:]/g,eL=/[@/?#]/g;function m4(e,t){let r=t?eL:QU;return r.lastIndex=0,e.replace(r,(i)=>YU[i])}function tL(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let i=0;i<e.length;i++){if(e[i]==="%"&&i+2<e.length){let n=e.slice(i+1,i+3);if(Qb(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));if(t&&h4(s))r+=s;else r+="%"+o;i+=2;continue}}r+=e[i]}return r}function rL(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Qb(i)){let n=i.toUpperCase(),o=String.fromCharCode(parseInt(n,16));if(o!=="."&&h4(o))t+=o;else t+="%"+n;r+=2;continue}}if(KU(e[r]))t+=e[r];else t+=escape(e[r])}return t}function nL(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Qb(i)){t+="%"+i.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function iL(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!f4(r)){let i=p4(r);if(i.isIPV6===!0)r=`[${i.escapedHost}]`;else r=m4(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}g4.exports={nonSimpleDomain:VU,recomposeAuthority:iL,reescapeHostDelimiters:m4,normalizePercentEncoding:tL,normalizePathEncoding:rL,escapePreservingEscapes:nL,removeDotSegments:XU,isIPv4:f4,isUUID:ZU,normalizeIPv6:p4,stringArrayToHexStripped:e_}});var w4=Xe(function(Kbe,_4){var{isUUID:oL}=t_(),sL=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,aL=["http","https","ws","wss","urn","urn:uuid"];function uL(e){return aL.indexOf(e)!==-1}function r_(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function y4(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function v4(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function lL(e){return e.secure=r_(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function cL(e){if(e.port===(r_(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function dL(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(sL);if(r){let i=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${i}:${t.nid||e.nid}`,o=n_(n);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function fL(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",i=e.nid.toLowerCase(),n=`${r}:${t.nid||i}`,o=n_(n);if(o)e=o.serialize(e,t);let s=e,h=e.nss;return s.path=`${i||t.nid}:${h}`,t.skipEscape=!0,s}function hL(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!oL(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function pL(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var b4={scheme:"http",domainHost:!0,parse:y4,serialize:v4},mL={scheme:"https",domainHost:b4.domainHost,parse:y4,serialize:v4},Np={scheme:"ws",domainHost:!0,parse:lL,serialize:cL},gL={scheme:"wss",domainHost:Np.domainHost,parse:Np.parse,serialize:Np.serialize},yL={scheme:"urn",parse:dL,serialize:fL,skipNormalize:!0},vL={scheme:"urn:uuid",parse:hL,serialize:pL,skipNormalize:!0},zp={http:b4,https:mL,ws:Np,wss:gL,urn:yL,"urn:uuid":vL};Object.setPrototypeOf(zp,null);function n_(e){return e&&(zp[e]||zp[e.toLowerCase()])||void 0}_4.exports={wsIsSecure:r_,SCHEMES:zp,isValidSchemeName:uL,getSchemeHandler:n_}});var I4=Xe(function(Vbe,jp){var{normalizeIPv6:bL,removeDotSegments:mc,recomposeAuthority:_L,normalizePercentEncoding:wL,normalizePathEncoding:SL,escapePreservingEscapes:xL,reescapeHostDelimiters:kL,isIPv4:ML,nonSimpleDomain:EL}=t_(),{SCHEMES:IL,getSchemeHandler:x4}=w4();function TL(e,t){if(typeof e==="string")e=CL(e,t);else if(typeof e==="object")e=ua(Go(e,t),t);return e}function PL(e,t,r){let i=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=k4(ua(e,i),ua(t,i),i,!0);return i.skipEscape=!0,Go(n,i)}function k4(e,t,r,i){let n={};if(!i)e=ua(Go(e,r),r),t=ua(Go(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=mc(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=mc(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=mc(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=mc(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function $L(e,t,r){let i=S4(e,r),n=S4(t,r);return i!==void 0&&n!==void 0&&i.toLowerCase()===n.toLowerCase()}function Go(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},i=Object.assign({},t),n=[],o=x4(i.scheme||r.scheme);if(o&&o.serialize)o.serialize(r,i);if(r.path!==void 0)if(!i.skipEscape){if(r.path=xL(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=wL(r.path);if(i.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let s=_L(r);if(s!==void 0){if(i.reference!=="suffix")n.push("//");if(n.push(s),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let h=r.path;if(!i.absolutePath&&(!o||!o.absolutePath))h=mc(h);if(s===void 0&&h[0]==="/"&&h[1]==="/")h="/%2F"+h.slice(2);n.push(h)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var AL=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function RL(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function M4(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,o=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let s=e.match(AL);if(s){if(i.scheme=s[1],i.userinfo=s[3],i.host=s[4],i.port=parseInt(s[5],10),i.path=s[6]||"",i.query=s[7],i.fragment=s[8],isNaN(i.port))i.port=s[5];let h=RL(i,s);if(h!==void 0)i.error=i.error||h,n=!0;if(i.host)if(ML(i.host)===!1){let _=bL(i.host);i.host=_.host.toLowerCase(),o=_.isIPV6}else o=!0;if(i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path)i.reference="same-document";else if(i.scheme===void 0)i.reference="relative";else if(i.fragment===void 0)i.reference="absolute";else i.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==i.reference)i.error=i.error||"URI is not a "+r.reference+" reference.";let v=x4(r.scheme||i.scheme);if(!r.unicodeSupport&&(!v||!v.unicodeSupport)){if(i.host&&(r.domainHost||v&&v.domainHost)&&o===!1&&EL(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(b){i.error=i.error||"Host's domain name can not be converted to ASCII: "+b}}if(!v||v&&!v.skipNormalize){if(e.indexOf("%")!==-1){if(i.scheme!==void 0)i.scheme=unescape(i.scheme);if(i.host!==void 0)i.host=kL(unescape(i.host),o)}if(i.path)i.path=SL(i.path);if(i.fragment)try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||"URI malformed"}}if(v&&v.parse)v.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:n}}function ua(e,t){return M4(e,t).parsed}function CL(e,t){return E4(e,t).normalized}function E4(e,t){let{parsed:r,malformedAuthorityOrPort:i}=M4(e,t);return{normalized:i?e:Go(r,t),malformedAuthorityOrPort:i}}function S4(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:i}=E4(e,t);return i?void 0:r}if(typeof e==="object")return Go(e,t)}var i_={SCHEMES:IL,normalize:TL,resolve:PL,resolveComponent:k4,equal:$L,serialize:Go,parse:ua};jp.exports=i_;jp.exports.default=i_;jp.exports.fastUri=i_});var $4=Xe(function(P4){Object.defineProperty(P4,"__esModule",{value:!0});var T4=I4();T4.code='require("ajv/dist/runtime/uri").default';P4.default=T4});var j4=Xe(function(Pi){Object.defineProperty(Pi,"__esModule",{value:!0});Pi.CodeGen=Pi.Name=Pi.nil=Pi.stringify=Pi.str=Pi._=Pi.KeywordCxt=void 0;var DL=fc();Object.defineProperty(Pi,"KeywordCxt",{enumerable:!0,get:function(){return DL.KeywordCxt}});var la=mt();Object.defineProperty(Pi,"_",{enumerable:!0,get:function(){return la._}});Object.defineProperty(Pi,"str",{enumerable:!0,get:function(){return la.str}});Object.defineProperty(Pi,"stringify",{enumerable:!0,get:function(){return la.stringify}});Object.defineProperty(Pi,"nil",{enumerable:!0,get:function(){return la.nil}});Object.defineProperty(Pi,"Name",{enumerable:!0,get:function(){return la.Name}});Object.defineProperty(Pi,"CodeGen",{enumerable:!0,get:function(){return la.CodeGen}});var NL=Cp(),D4=hc(),zL=Nb(),gc=Dp(),jL=mt(),yc=lc(),Up=uc(),s_=Mt(),A4=c4(),UL=$4(),N4=(e,t)=>new RegExp(e,t);N4.code="new RegExp";var LL=["removeAdditional","useDefaults","coerceTypes"],FL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),qL={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},BL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},R4=200;function HL(e){var t,r,i,n,o,s,h,v,b,_,g,S,x,M,I,T,P,$,R,C,N,B,ie,le,ue;let F=e.strict,ee=(t=e.code)===null||t===void 0?void 0:t.optimize,a=ee===!0||ee===void 0?1:ee||0,c=(i=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:N4,f=(n=e.uriResolver)!==null&&n!==void 0?n:UL.default;return{strictSchema:(s=(o=e.strictSchema)!==null&&o!==void 0?o:F)!==null&&s!==void 0?s:!0,strictNumbers:(v=(h=e.strictNumbers)!==null&&h!==void 0?h:F)!==null&&v!==void 0?v:!0,strictTypes:(_=(b=e.strictTypes)!==null&&b!==void 0?b:F)!==null&&_!==void 0?_:"log",strictTuples:(S=(g=e.strictTuples)!==null&&g!==void 0?g:F)!==null&&S!==void 0?S:"log",strictRequired:(M=(x=e.strictRequired)!==null&&x!==void 0?x:F)!==null&&M!==void 0?M:!1,code:e.code?{...e.code,optimize:a,regExp:c}:{optimize:a,regExp:c},loopRequired:(I=e.loopRequired)!==null&&I!==void 0?I:R4,loopEnum:(T=e.loopEnum)!==null&&T!==void 0?T:R4,meta:(P=e.meta)!==null&&P!==void 0?P:!0,messages:($=e.messages)!==null&&$!==void 0?$:!0,inlineRefs:(R=e.inlineRefs)!==null&&R!==void 0?R:!0,schemaId:(C=e.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(N=e.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:(B=e.validateSchema)!==null&&B!==void 0?B:!0,validateFormats:(ie=e.validateFormats)!==null&&ie!==void 0?ie:!0,unicodeRegExp:(le=e.unicodeRegExp)!==null&&le!==void 0?le:!0,int32range:(ue=e.int32range)!==null&&ue!==void 0?ue:!0,uriResolver:f}}class Lp{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...HL(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new jL.ValueScope({scope:{},prefixes:FL,es5:t,lines:r}),this.logger=JL(e.logger);let i=e.validateFormats;if(e.validateFormats=!1,this.RULES=(0,zL.getRules)(),C4.call(this,qL,e,"NOT SUPPORTED"),C4.call(this,BL,e,"DEPRECATED","warn"),this._metaOpts=WL.call(this),e.formats)KL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)VL.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);ZL.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,i=A4;if(r==="id")i={...A4},i.id=i.$id,delete i.$id;if(t&&e)this.addMetaSchema(i,i[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let i=r(t);if(!("$async"in r))this.errors=r.errors;return i}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return i.call(this,e,t);async function i(b,_){await n.call(this,b.$schema);let g=this._addSchema(b,_);return g.validate||o.call(this,g)}async function n(b){if(b&&!this.getSchema(b))await i.call(this,{$ref:b},!0)}async function o(b){try{return this._compileSchemaEnv(b)}catch(_){if(!(_ instanceof D4.default))throw _;return s.call(this,_),await h.call(this,_.missingSchema),o.call(this,b)}}function s({missingSchema:b,missingRef:_}){if(this.refs[b])throw Error(`AnySchema ${b} is loaded but ${_} cannot be resolved`)}async function h(b){let _=await v.call(this,b);if(!this.refs[b])await n.call(this,_.$schema);if(!this.refs[b])this.addSchema(_,b,t)}async function v(b){let _=this._loading[b];if(_)return _;try{return await(this._loading[b]=r(b))}finally{delete this._loading[b]}}}addSchema(e,t,r,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,r,i);return this}let n;if(typeof e==="object"){let{schemaId:o}=this.opts;if(n=e[o],n!==void 0&&typeof n!="string")throw Error(`schema ${o} must be string`)}return t=(0,yc.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,i,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(r,e);if(!i&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return i}getSchema(e){let t;while(typeof(t=O4.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,i=new gc.SchemaEnv({schema:{},schemaId:r});if(t=gc.resolveSchema.call(this,i,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=O4.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=(0,yc.normalizeId)(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(YL.call(this,r,t),!t)return(0,s_.eachItem)(r,(n)=>o_.call(this,n)),this;eF.call(this,t);let i={...t,type:(0,Up.getJSONTypes)(t.type),schemaType:(0,Up.getJSONTypes)(t.schemaType)};return(0,s_.eachItem)(r,i.type.length===0?(n)=>o_.call(this,n,i):(n)=>i.type.forEach((o)=>o_.call(this,n,i,o))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let i=r.rules.findIndex((n)=>n.keyword===e);if(i>=0)r.rules.splice(i,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((i)=>`${r}${i.instancePath} ${i.message}`).reduce((i,n)=>i+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of t){let n=i.split("/").slice(1),o=e;for(let s of n)o=o[s];for(let s in r){let h=r[s];if(typeof h!="object")continue;let{$data:v}=h.definition,b=o[s];if(v&&b)o[s]=z4(b)}}return e}_removeAllSchemas(e,t){for(let r in e){let i=e[r];if(!t||t.test(r)){if(typeof i=="string")delete e[r];else if(i&&!i.meta)this._cache.delete(i.schema),delete e[r]}}}_addSchema(e,t,r,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let h=this._cache.get(e);if(h!==void 0)return h;r=(0,yc.normalizeId)(o||r);let v=yc.getSchemaRefs.call(this,e,r);if(h=new gc.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:v}),this._cache.set(h.schema,h),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=h}if(i)this.validateSchema(e,!0);return h}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else gc.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{gc.compileSchema.call(this,e)}finally{this.opts=t}}}Lp.ValidationError=NL.default;Lp.MissingRefError=D4.default;Pi.default=Lp;function C4(e,t,r,i="error"){for(let n in e){let o=n;if(o in t)this.logger[i](`${r}: option ${n}. ${e[o]}`)}}function O4(e){return e=(0,yc.normalizeId)(e),this.schemas[e]||this.refs[e]}function ZL(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function KL(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function VL(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function WL(){let e={...this.opts};for(let t of LL)delete e[t];return e}var GL={log(){},warn(){},error(){}};function JL(e){if(e===!1)return GL;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var XL=/^[a-z_$][a-z0-9_$:-]*$/i;function YL(e,t){let{RULES:r}=this;if((0,s_.eachItem)(e,(i)=>{if(r.keywords[i])throw Error(`Keyword ${i} is already defined`);if(!XL.test(i))throw Error(`Keyword ${i} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function o_(e,t,r){var i;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:v})=>v===r);if(!s)s={type:r,rules:[]},o.rules.push(s);if(o.keywords[e]=!0,!t)return;let h={keyword:e,definition:{...t,type:(0,Up.getJSONTypes)(t.type),schemaType:(0,Up.getJSONTypes)(t.schemaType)}};if(t.before)QL.call(this,s,h,t.before);else s.rules.push(h);o.all[e]=h,(i=t.implements)===null||i===void 0||i.forEach((v)=>this.addKeyword(v))}function QL(e,t,r){let i=e.rules.findIndex((n)=>n.keyword===r);if(i>=0)e.rules.splice(i,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function eF(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=z4(t);e.validateSchema=this.compile(t,!0)}var tF={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function z4(e){return{anyOf:[e,tF]}}});var L4=Xe(function(U4){Object.defineProperty(U4,"__esModule",{value:!0});var iF={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};U4.default=iF});var K4=Xe(function(H4){Object.defineProperty(H4,"__esModule",{value:!0});H4.callRef=H4.getValidate=void 0;var sF=hc(),F4=Rn(),un=mt(),ca=Ii(),q4=Dp(),Fp=Mt(),aF={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:i}=e,{baseId:n,schemaEnv:o,validateName:s,opts:h,self:v}=i,{root:b}=o;if((r==="#"||r==="#/")&&n===b.baseId)return g();let _=q4.resolveRef.call(v,b,n,r);if(_===void 0)throw new sF.default(i.opts.uriResolver,n,r);if(_ instanceof q4.SchemaEnv)return S(_);return x(_);function g(){if(o===b)return qp(e,s,o,o.$async);let M=t.scopeValue("root",{ref:b});return qp(e,un._`${M}.validate`,b,b.$async)}function S(M){let I=B4(e,M);qp(e,I,M,M.$async)}function x(M){let I=t.scopeValue("schema",h.code.source===!0?{ref:M,code:(0,un.stringify)(M)}:{ref:M}),T=t.name("valid"),P=e.subschema({schema:M,dataTypes:[],schemaPath:un.nil,topSchemaRef:I,errSchemaPath:r},T);e.mergeEvaluated(P),e.ok(T)}}};function B4(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):un._`${r.scopeValue("wrapper",{ref:t})}.validate`}H4.getValidate=B4;function qp(e,t,r,i){let{gen:n,it:o}=e,{allErrors:s,schemaEnv:h,opts:v}=o,b=v.passContext?ca.default.this:un.nil;if(i)_();else g();function _(){if(!h.$async)throw Error("async schema referenced by sync schema");let M=n.let("valid");n.try(()=>{if(n.code(un._`await ${(0,F4.callValidateCode)(e,t,b)}`),x(t),!s)n.assign(M,!0)},(I)=>{if(n.if(un._`!(${I} instanceof ${o.ValidationError})`,()=>n.throw(I)),S(I),!s)n.assign(M,!1)}),e.ok(M)}function g(){e.result((0,F4.callValidateCode)(e,t,b),()=>x(t),()=>S(t))}function S(M){let I=un._`${M}.errors`;n.assign(ca.default.vErrors,un._`${ca.default.vErrors} === null ? ${I} : ${ca.default.vErrors}.concat(${I})`),n.assign(ca.default.errors,un._`${ca.default.vErrors}.length`)}function x(M){var I;if(!o.opts.unevaluated)return;let T=(I=r===null||r===void 0?void 0:r.validate)===null||I===void 0?void 0:I.evaluated;if(o.props!==!0)if(T&&!T.dynamicProps){if(T.props!==void 0)o.props=Fp.mergeEvaluated.props(n,T.props,o.props)}else{let P=n.var("props",un._`${M}.evaluated.props`);o.props=Fp.mergeEvaluated.props(n,P,o.props,un.Name)}if(o.items!==!0)if(T&&!T.dynamicItems){if(T.items!==void 0)o.items=Fp.mergeEvaluated.items(n,T.items,o.items)}else{let P=n.var("items",un._`${M}.evaluated.items`);o.items=Fp.mergeEvaluated.items(n,P,o.items,un.Name)}}}H4.callRef=qp;H4.default=aF});var W4=Xe(function(V4){Object.defineProperty(V4,"__esModule",{value:!0});var cF=L4(),dF=K4(),fF=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",cF.default,dF.default];V4.default=fF});var J4=Xe(function(G4){Object.defineProperty(G4,"__esModule",{value:!0});var Bp=mt(),ao=Bp.operators,Hp={maximum:{okStr:"<=",ok:ao.LTE,fail:ao.GT},minimum:{okStr:">=",ok:ao.GTE,fail:ao.LT},exclusiveMaximum:{okStr:"<",ok:ao.LT,fail:ao.GTE},exclusiveMinimum:{okStr:">",ok:ao.GT,fail:ao.LTE}},pF={message:({keyword:e,schemaCode:t})=>Bp.str`must be ${Hp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Bp._`{comparison: ${Hp[e].okStr}, limit: ${t}}`},mF={keyword:Object.keys(Hp),type:"number",schemaType:"number",$data:!0,error:pF,code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data(Bp._`${r} ${Hp[t].fail} ${i} || isNaN(${r})`)}};G4.default=mF});var Y4=Xe(function(X4){Object.defineProperty(X4,"__esModule",{value:!0});var vc=mt(),yF={message:({schemaCode:e})=>vc.str`must be multiple of ${e}`,params:({schemaCode:e})=>vc._`{multipleOf: ${e}}`},vF={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:yF,code(e){let{gen:t,data:r,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=t.let("res"),h=o?vc._`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:vc._`${s} !== parseInt(${s})`;e.fail$data(vc._`(${i} === 0 || (${s} = ${r}/${i}, ${h}))`)}};X4.default=vF});var t3=Xe(function(e3){Object.defineProperty(e3,"__esModule",{value:!0});function Q4(e){let t=e.length,r=0,i=0,n;while(i<t)if(r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t){if(n=e.charCodeAt(i),(n&64512)===56320)i++}return r}e3.default=Q4;Q4.code='require("ajv/dist/runtime/ucs2length").default'});var n3=Xe(function(r3){Object.defineProperty(r3,"__esModule",{value:!0});var Jo=mt(),wF=Mt(),SF=t3(),xF={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return Jo.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>Jo._`{limit: ${e}}`},kF={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:xF,code(e){let{keyword:t,data:r,schemaCode:i,it:n}=e,o=t==="maxLength"?Jo.operators.GT:Jo.operators.LT,s=n.opts.unicode===!1?Jo._`${r}.length`:Jo._`${(0,wF.useFunc)(e.gen,SF.default)}(${r})`;e.fail$data(Jo._`${s} ${o} ${i}`)}};r3.default=kF});var o3=Xe(function(i3){Object.defineProperty(i3,"__esModule",{value:!0});var EF=Rn(),IF=Mt(),da=mt(),TF={message:({schemaCode:e})=>da.str`must match pattern "${e}"`,params:({schemaCode:e})=>da._`{pattern: ${e}}`},PF={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:TF,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e,h=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:v}=s.opts.code,b=v.code==="new RegExp"?da._`new RegExp`:(0,IF.useFunc)(t,v),_=t.let("valid");t.try(()=>t.assign(_,da._`${b}(${o}, ${h}).test(${r})`),()=>t.assign(_,!1)),e.fail$data(da._`!${_}`)}else{let v=(0,EF.usePattern)(e,n);e.fail$data(da._`!${v}.test(${r})`)}}};i3.default=PF});var a3=Xe(function(s3){Object.defineProperty(s3,"__esModule",{value:!0});var bc=mt(),AF={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return bc.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>bc._`{limit: ${e}}`},RF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:AF,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxProperties"?bc.operators.GT:bc.operators.LT;e.fail$data(bc._`Object.keys(${r}).length ${n} ${i}`)}};s3.default=RF});var l3=Xe(function(u3){Object.defineProperty(u3,"__esModule",{value:!0});var _c=Rn(),wc=mt(),OF=Mt(),DF={message:({params:{missingProperty:e}})=>wc.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>wc._`{missingProperty: ${e}}`},NF={keyword:"required",type:"object",schemaType:"array",$data:!0,error:DF,code(e){let{gen:t,schema:r,schemaCode:i,data:n,$data:o,it:s}=e,{opts:h}=s;if(!o&&r.length===0)return;let v=r.length>=h.loopRequired;if(s.allErrors)b();else _();if(h.strictRequired){let x=e.parentSchema.properties,{definedProperties:M}=e.it;for(let I of r)if((x===null||x===void 0?void 0:x[I])===void 0&&!M.has(I)){let T=s.schemaEnv.baseId+s.errSchemaPath,P=`required property "${I}" is not defined at "${T}" (strictRequired)`;(0,OF.checkStrictMode)(s,P,s.opts.strictRequired)}}function b(){if(v||o)e.block$data(wc.nil,g);else for(let x of r)(0,_c.checkReportMissingProp)(e,x)}function _(){let x=t.let("missing");if(v||o){let M=t.let("valid",!0);e.block$data(M,()=>S(x,M)),e.ok(M)}else t.if((0,_c.checkMissingProp)(e,r,x)),(0,_c.reportMissingProp)(e,x),t.else()}function g(){t.forOf("prop",i,(x)=>{e.setParams({missingProperty:x}),t.if((0,_c.noPropertyInData)(t,n,x,h.ownProperties),()=>e.error())})}function S(x,M){e.setParams({missingProperty:x}),t.forOf(x,i,()=>{t.assign(M,(0,_c.propertyInData)(t,n,x,h.ownProperties)),t.if((0,wc.not)(M),()=>{e.error(),t.break()})},wc.nil)}}};u3.default=NF});var d3=Xe(function(c3){Object.defineProperty(c3,"__esModule",{value:!0});var Sc=mt(),jF={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return Sc.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>Sc._`{limit: ${e}}`},UF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:jF,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxItems"?Sc.operators.GT:Sc.operators.LT;e.fail$data(Sc._`${r}.length ${n} ${i}`)}};c3.default=UF});var Zp=Xe(function(h3){Object.defineProperty(h3,"__esModule",{value:!0});var f3=Hb();f3.code='require("ajv/dist/runtime/equal").default';h3.default=f3});var m3=Xe(function(p3){Object.defineProperty(p3,"__esModule",{value:!0});var a_=uc(),Nr=mt(),qF=Mt(),BF=Zp(),HF={message:({params:{i:e,j:t}})=>Nr.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Nr._`{i: ${e}, j: ${t}}`},ZF={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:HF,code(e){let{gen:t,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:h}=e;if(!i&&!n)return;let v=t.let("valid"),b=o.items?(0,a_.getSchemaTypes)(o.items):[];e.block$data(v,_,Nr._`${s} === false`),e.ok(v);function _(){let M=t.let("i",Nr._`${r}.length`),I=t.let("j");e.setParams({i:M,j:I}),t.assign(v,!0),t.if(Nr._`${M} > 1`,()=>(g()?S:x)(M,I))}function g(){return b.length>0&&!b.some((M)=>M==="object"||M==="array")}function S(M,I){let T=t.name("item"),P=(0,a_.checkDataTypes)(b,T,h.opts.strictNumbers,a_.DataType.Wrong),$=t.const("indices",Nr._`{}`);t.for(Nr._`;${M}--;`,()=>{if(t.let(T,Nr._`${r}[${M}]`),t.if(P,Nr._`continue`),b.length>1)t.if(Nr._`typeof ${T} == "string"`,Nr._`${T} += "_"`);t.if(Nr._`typeof ${$}[${T}] == "number"`,()=>{t.assign(I,Nr._`${$}[${T}]`),e.error(),t.assign(v,!1).break()}).code(Nr._`${$}[${T}] = ${M}`)})}function x(M,I){let T=(0,qF.useFunc)(t,BF.default),P=t.name("outer");t.label(P).for(Nr._`;${M}--;`,()=>t.for(Nr._`${I} = ${M}; ${I}--;`,()=>t.if(Nr._`${T}(${r}[${M}], ${r}[${I}])`,()=>{e.error(),t.assign(v,!1).break(P)})))}}};p3.default=ZF});var y3=Xe(function(g3){Object.defineProperty(g3,"__esModule",{value:!0});var u_=mt(),VF=Mt(),WF=Zp(),GF={message:"must be equal to constant",params:({schemaCode:e})=>u_._`{allowedValue: ${e}}`},JF={keyword:"const",$data:!0,error:GF,code(e){let{gen:t,data:r,$data:i,schemaCode:n,schema:o}=e;if(i||o&&typeof o=="object")e.fail$data(u_._`!${(0,VF.useFunc)(t,WF.default)}(${r}, ${n})`);else e.fail(u_._`${o} !== ${r}`)}};g3.default=JF});var b3=Xe(function(v3){Object.defineProperty(v3,"__esModule",{value:!0});var xc=mt(),YF=Mt(),QF=Zp(),eq={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>xc._`{allowedValues: ${e}}`},tq={keyword:"enum",schemaType:"array",$data:!0,error:eq,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e;if(!i&&n.length===0)throw Error("enum must have non-empty array");let h=n.length>=s.opts.loopEnum,v,b=()=>v!==null&&v!==void 0?v:v=(0,YF.useFunc)(t,QF.default),_;if(h||i)_=t.let("valid"),e.block$data(_,g);else{if(!Array.isArray(n))throw Error("ajv implementation error");let x=t.const("vSchema",o);_=(0,xc.or)(...n.map((M,I)=>S(x,I)))}e.pass(_);function g(){t.assign(_,!1),t.forOf("v",o,(x)=>t.if(xc._`${b()}(${r}, ${x})`,()=>t.assign(_,!0).break()))}function S(x,M){let I=n[M];return typeof I==="object"&&I!==null?xc._`${b()}(${r}, ${x}[${M}])`:xc._`${r} === ${I}`}}};v3.default=tq});var w3=Xe(function(_3){Object.defineProperty(_3,"__esModule",{value:!0});var nq=J4(),iq=Y4(),oq=n3(),sq=o3(),aq=a3(),uq=l3(),lq=d3(),cq=m3(),dq=y3(),fq=b3(),hq=[nq.default,iq.default,oq.default,sq.default,aq.default,uq.default,lq.default,cq.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},dq.default,fq.default];_3.default=hq});var c_=Xe(function(x3){Object.defineProperty(x3,"__esModule",{value:!0});x3.validateAdditionalItems=void 0;var Xo=mt(),l_=Mt(),mq={message:({params:{len:e}})=>Xo.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Xo._`{limit: ${e}}`},gq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:mq,code(e){let{parentSchema:t,it:r}=e,{items:i}=t;if(!Array.isArray(i)){(0,l_.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}S3(e,i)}};function S3(e,t){let{gen:r,schema:i,data:n,keyword:o,it:s}=e;s.items=!0;let h=r.const("len",Xo._`${n}.length`);if(i===!1)e.setParams({len:t.length}),e.pass(Xo._`${h} <= ${t.length}`);else if(typeof i=="object"&&!(0,l_.alwaysValidSchema)(s,i)){let b=r.var("valid",Xo._`${h} <= ${t.length}`);r.if((0,Xo.not)(b),()=>v(b)),e.ok(b)}function v(b){r.forRange("i",t.length,h,(_)=>{if(e.subschema({keyword:o,dataProp:_,dataPropType:l_.Type.Num},b),!s.allErrors)r.if((0,Xo.not)(b),()=>r.break())})}}x3.validateAdditionalItems=S3;x3.default=gq});var d_=Xe(function(I3){Object.defineProperty(I3,"__esModule",{value:!0});I3.validateTuple=void 0;var M3=mt(),Kp=Mt(),vq=Rn(),bq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return E3(e,"additionalItems",t);if(r.items=!0,(0,Kp.alwaysValidSchema)(r,t))return;e.ok((0,vq.validateArray)(e))}};function E3(e,t,r=e.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:h}=e;if(_(n),h.opts.unevaluated&&r.length&&h.items!==!0)h.items=Kp.mergeEvaluated.items(i,r.length,h.items);let v=i.name("valid"),b=i.const("len",M3._`${o}.length`);r.forEach((g,S)=>{if((0,Kp.alwaysValidSchema)(h,g))return;i.if(M3._`${b} > ${S}`,()=>e.subschema({keyword:s,schemaProp:S,dataProp:S},v)),e.ok(v)});function _(g){let{opts:S,errSchemaPath:x}=h,M=r.length,I=M===g.minItems&&(M===g.maxItems||g[t]===!1);if(S.strictTuples&&!I){let T=`"${s}" is ${M}-tuple, but minItems or maxItems/${t} are not specified or different at path "${x}"`;(0,Kp.checkStrictMode)(h,T,S.strictTuples)}}}I3.validateTuple=E3;I3.default=bq});var $3=Xe(function(P3){Object.defineProperty(P3,"__esModule",{value:!0});var wq=d_(),Sq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>(0,wq.validateTuple)(e,"items")};P3.default=Sq});var C3=Xe(function(R3){Object.defineProperty(R3,"__esModule",{value:!0});var A3=mt(),kq=Mt(),Mq=Rn(),Eq=c_(),Iq={message:({params:{len:e}})=>A3.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>A3._`{limit: ${e}}`},Tq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Iq,code(e){let{schema:t,parentSchema:r,it:i}=e,{prefixItems:n}=r;if(i.items=!0,(0,kq.alwaysValidSchema)(i,t))return;if(n)(0,Eq.validateAdditionalItems)(e,n);else e.ok((0,Mq.validateArray)(e))}};R3.default=Tq});var D3=Xe(function(O3){Object.defineProperty(O3,"__esModule",{value:!0});var Cn=mt(),Vp=Mt(),$q={message:({params:{min:e,max:t}})=>t===void 0?Cn.str`must contain at least ${e} valid item(s)`:Cn.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Cn._`{minContains: ${e}}`:Cn._`{minContains: ${e}, maxContains: ${t}}`},Aq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:$q,code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e,s,h,{minContains:v,maxContains:b}=i;if(o.opts.next)s=v===void 0?1:v,h=b;else s=1;let _=t.const("len",Cn._`${n}.length`);if(e.setParams({min:s,max:h}),h===void 0&&s===0){(0,Vp.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(h!==void 0&&s>h){(0,Vp.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Vp.alwaysValidSchema)(o,r)){let I=Cn._`${_} >= ${s}`;if(h!==void 0)I=Cn._`${I} && ${_} <= ${h}`;e.pass(I);return}o.items=!0;let g=t.name("valid");if(h===void 0&&s===1)x(g,()=>t.if(g,()=>t.break()));else if(s===0){if(t.let(g,!0),h!==void 0)t.if(Cn._`${n}.length > 0`,S)}else t.let(g,!1),S();e.result(g,()=>e.reset());function S(){let I=t.name("_valid"),T=t.let("count",0);x(I,()=>t.if(I,()=>M(T)))}function x(I,T){t.forRange("i",0,_,(P)=>{e.subschema({keyword:"contains",dataProp:P,dataPropType:Vp.Type.Num,compositeRule:!0},I),T()})}function M(I){if(t.code(Cn._`${I}++`),h===void 0)t.if(Cn._`${I} >= ${s}`,()=>t.assign(g,!0).break());else if(t.if(Cn._`${I} > ${h}`,()=>t.assign(g,!1).break()),s===1)t.assign(g,!0);else t.if(Cn._`${I} >= ${s}`,()=>t.assign(g,!0))}}};O3.default=Aq});var F3=Xe(function(j3){Object.defineProperty(j3,"__esModule",{value:!0});j3.validateSchemaDeps=j3.validatePropertyDeps=j3.error=void 0;var f_=mt(),Cq=Mt(),kc=Rn();j3.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let i=t===1?"property":"properties";return f_.str`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>f_._`{property: ${e},
23
+ || ${s} === "boolean" || ${n} === null`).assign(h,ht._`[${n}]`)}}}function Wz({gen:e,parentData:t,parentDataProperty:r},i){e.if(ht._`${t} !== undefined`,()=>e.assign(ht._`${t}[${r}]`,i))}function jb(e,t,r,i=oa.Correct){let n=i===oa.Correct?ht.operators.EQ:ht.operators.NEQ,o;switch(e){case"null":return ht._`${t} ${n} null`;case"array":o=ht._`Array.isArray(${t})`;break;case"object":o=ht._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=s(ht._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=s();break;default:return ht._`typeof ${t} ${n} ${e}`}return i===oa.Correct?o:(0,ht.not)(o);function s(h=ht.nil){return(0,ht.and)(ht._`typeof ${t} == "number"`,h,r?ht._`isFinite(${t})`:ht.nil)}}hM.checkDataType=jb;function Ub(e,t,r,i){if(e.length===1)return jb(e[0],t,r,i);let n,o=(0,cM.toHash)(e);if(o.array&&o.object){let s=ht._`typeof ${t} != "object"`;n=o.null?s:ht._`!${t} || ${s}`,delete o.null,delete o.array,delete o.object}else n=ht.nil;if(o.number)delete o.integer;for(let s in o)n=(0,ht.and)(n,jb(s,t,r,i));return n}hM.checkDataTypes=Ub;var Gz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?ht._`{type: ${e}}`:ht._`{type: ${t}}`};function Lb(e){let t=Jz(e);(0,Bz.reportError)(t,Gz)}hM.reportTypeError=Lb;function Jz(e){let{gen:t,data:r,schema:i}=e,n=(0,cM.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:e}}});var vM=Xe(function(gM){Object.defineProperty(gM,"__esModule",{value:!0});gM.assignDefaults=void 0;var sa=mt(),nj=Mt();function ij(e,t){let{properties:r,items:i}=e.schema;if(t==="object"&&r)for(let n in r)mM(e,n,r[n].default);else if(t==="array"&&Array.isArray(i))i.forEach((n,o)=>mM(e,o,n.default))}gM.assignDefaults=ij;function mM(e,t,r){let{gen:i,compositeRule:n,data:o,opts:s}=e;if(r===void 0)return;let h=sa._`${o}${(0,sa.getProperty)(t)}`;if(n){(0,nj.checkStrictMode)(e,`default is ignored for: ${h}`);return}let v=sa._`${h} === undefined`;if(s.useDefaults==="empty")v=sa._`${v} || ${h} === null || ${h} === ""`;i.if(v,sa._`${h} = ${(0,sa.stringify)(r)}`)}});var Rn=Xe(function(wM){Object.defineProperty(wM,"__esModule",{value:!0});wM.validateUnion=wM.validateArray=wM.usePattern=wM.callValidateCode=wM.schemaProperties=wM.allSchemaProperties=wM.noPropertyInData=wM.propertyInData=wM.isOwnProperty=wM.hasPropFunc=wM.reportMissingProp=wM.checkMissingProp=wM.checkReportMissingProp=void 0;var Bt=mt(),Fb=Mt(),oo=Ii(),oj=Mt();function sj(e,t){let{gen:r,data:i,it:n}=e;r.if(Bb(r,i,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:Bt._`${t}`},!0),e.error()})}wM.checkReportMissingProp=sj;function aj({gen:e,data:t,it:{opts:r}},i,n){return(0,Bt.or)(...i.map((o)=>(0,Bt.and)(Bb(e,t,o,r.ownProperties),Bt._`${n} = ${o}`)))}wM.checkMissingProp=aj;function uj(e,t){e.setParams({missingProperty:t},!0),e.error()}wM.reportMissingProp=uj;function bM(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Bt._`Object.prototype.hasOwnProperty`})}wM.hasPropFunc=bM;function qb(e,t,r){return Bt._`${bM(e)}.call(${t}, ${r})`}wM.isOwnProperty=qb;function lj(e,t,r,i){let n=Bt._`${t}${(0,Bt.getProperty)(r)} !== undefined`;return i?Bt._`${n} && ${qb(e,t,r)}`:n}wM.propertyInData=lj;function Bb(e,t,r,i){let n=Bt._`${t}${(0,Bt.getProperty)(r)} === undefined`;return i?(0,Bt.or)(n,(0,Bt.not)(qb(e,t,r))):n}wM.noPropertyInData=Bb;function _M(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}wM.allSchemaProperties=_M;function cj(e,t){return _M(t).filter((r)=>!(0,Fb.alwaysValidSchema)(e,t[r]))}wM.schemaProperties=cj;function dj({schemaCode:e,data:t,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},h,v,b){let _=b?Bt._`${e}, ${t}, ${i}${n}`:t,g=[[oo.default.instancePath,(0,Bt.strConcat)(oo.default.instancePath,o)],[oo.default.parentData,s.parentData],[oo.default.parentDataProperty,s.parentDataProperty],[oo.default.rootData,oo.default.rootData]];if(s.opts.dynamicRef)g.push([oo.default.dynamicAnchors,oo.default.dynamicAnchors]);let S=Bt._`${_}, ${r.object(...g)}`;return v!==Bt.nil?Bt._`${h}.call(${v}, ${S})`:Bt._`${h}(${S})`}wM.callValidateCode=dj;var fj=Bt._`new RegExp`;function hj({gen:e,it:{opts:t}},r){let i=t.unicodeRegExp?"u":"",{regExp:n}=t.code,o=n(r,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:Bt._`${n.code==="new RegExp"?fj:(0,oj.useFunc)(e,n)}(${r}, ${i})`})}wM.usePattern=hj;function pj(e){let{gen:t,data:r,keyword:i,it:n}=e,o=t.name("valid");if(n.allErrors){let h=t.let("valid",!0);return s(()=>t.assign(h,!1)),h}return t.var(o,!0),s(()=>t.break()),o;function s(h){let v=t.const("len",Bt._`${r}.length`);t.forRange("i",0,v,(b)=>{e.subschema({keyword:i,dataProp:b,dataPropType:Fb.Type.Num},o),t.if((0,Bt.not)(o),h)})}}wM.validateArray=pj;function mj(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((v)=>(0,Fb.alwaysValidSchema)(n,v))&&!n.opts.unevaluated)return;let s=t.let("valid",!1),h=t.name("_valid");t.block(()=>r.forEach((v,b)=>{let _=e.subschema({keyword:i,schemaProp:b,compositeRule:!0},h);if(t.assign(s,Bt._`${s} || ${h}`),!e.mergeValidEvaluated(_,h))t.if((0,Bt.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}wM.validateUnion=mj});var IM=Xe(function(MM){Object.defineProperty(MM,"__esModule",{value:!0});MM.validateKeywordUsage=MM.validSchemaType=MM.funcKeywordCode=MM.macroKeywordCode=void 0;var Xr=mt(),Vo=Ii(),Tj=Rn(),Pj=ac();function $j(e,t){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=e,h=t.macro.call(s.self,n,o,s),v=kM(r,i,h);if(s.opts.validateSchema!==!1)s.self.validateSchema(h,!0);let b=r.name("valid");e.subschema({schema:h,schemaPath:Xr.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:v,compositeRule:!0},b),e.pass(b,()=>e.error(!0))}MM.macroKeywordCode=$j;function Aj(e,t){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:h,it:v}=e;Cj(v,t);let b=!h&&t.compile?t.compile.call(v.self,o,s,v):t.validate,_=kM(i,n,b),g=i.let("valid");e.block$data(g,S),e.ok((r=t.valid)!==null&&r!==void 0?r:g);function S(){if(t.errors===!1){if(I(),t.modifying)xM(e);T(()=>e.error())}else{let P=t.async?x():M();if(t.modifying)xM(e);T(()=>Rj(e,P))}}function x(){let P=i.let("ruleErrs",null);return i.try(()=>I(Xr._`await `),($)=>i.assign(g,!1).if(Xr._`${$} instanceof ${v.ValidationError}`,()=>i.assign(P,Xr._`${$}.errors`),()=>i.throw($))),P}function M(){let P=Xr._`${_}.errors`;return i.assign(P,null),I(Xr.nil),P}function I(P=t.async?Xr._`await `:Xr.nil){let $=v.opts.passContext?Vo.default.this:Vo.default.self,R=!(("compile"in t)&&!h||t.schema===!1);i.assign(g,Xr._`${P}${(0,Tj.callValidateCode)(e,_,$,R)}`,t.modifying)}function T(P){var $;i.if((0,Xr.not)(($=t.valid)!==null&&$!==void 0?$:g),P)}}MM.funcKeywordCode=Aj;function xM(e){let{gen:t,data:r,it:i}=e;t.if(i.parentData,()=>t.assign(r,Xr._`${i.parentData}[${i.parentDataProperty}]`))}function Rj(e,t){let{gen:r}=e;r.if(Xr._`Array.isArray(${t})`,()=>{r.assign(Vo.default.vErrors,Xr._`${Vo.default.vErrors} === null ? ${t} : ${Vo.default.vErrors}.concat(${t})`).assign(Vo.default.errors,Xr._`${Vo.default.vErrors}.length`),(0,Pj.extendErrors)(e)},()=>e.error())}function Cj({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function kM(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Xr.stringify)(r)})}function Oj(e,t,r=!1){return!t.length||t.some((i)=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||r&&typeof e>"u")}MM.validSchemaType=Oj;function Dj({schema:e,opts:t,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw Error("ajv implementation error");let s=n.dependencies;if(s===null||s===void 0?void 0:s.some((h)=>!Object.prototype.hasOwnProperty.call(e,h)))throw Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[o])){let v=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(v);else throw Error(v)}}}MM.validateKeywordUsage=Dj});var AM=Xe(function(PM){Object.defineProperty(PM,"__esModule",{value:!0});PM.extendSubschemaMode=PM.extendSubschemaData=PM.getSubschema=void 0;var ti=mt(),TM=Mt();function Uj(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(t!==void 0&&i!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let h=e.schema[t];return r===void 0?{schema:h,schemaPath:ti._`${e.schemaPath}${(0,ti.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:h[r],schemaPath:ti._`${e.schemaPath}${(0,ti.getProperty)(t)}${(0,ti.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,TM.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}PM.getSubschema=Uj;function Lj(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:h}=t;if(r!==void 0){let{errorPath:b,dataPathArr:_,opts:g}=t,S=h.let("data",ti._`${t.data}${(0,ti.getProperty)(r)}`,!0);v(S),e.errorPath=ti.str`${b}${(0,TM.getErrorPath)(r,i,g.jsPropertySyntax)}`,e.parentDataProperty=ti._`${r}`,e.dataPathArr=[..._,e.parentDataProperty]}if(n!==void 0){let b=n instanceof ti.Name?n:h.let("data",n,!0);if(v(b),s!==void 0)e.propertyName=s}if(o)e.dataTypes=o;function v(b){e.data=b,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,b]}}PM.extendSubschemaData=Lj;function Fj(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){if(i!==void 0)e.compositeRule=i;if(n!==void 0)e.createErrors=n;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=r}PM.extendSubschemaMode=Fj});var Hb=Xe(function(Lbe,RM){RM.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(t)){if(i=t.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var s=o[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var OM=Xe(function(Fbe,CM){var so=CM.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Ap(t,i,n,e,"",e)};so.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};so.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};so.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};so.skipKeywords={default:!0,enum:!0,const:!0,required:!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};function Ap(e,t,r,i,n,o,s,h,v,b){if(i&&typeof i=="object"&&!Array.isArray(i)){t(i,n,o,s,h,v,b);for(var _ in i){var g=i[_];if(Array.isArray(g)){if(_ in so.arrayKeywords)for(var S=0;S<g.length;S++)Ap(e,t,r,g[S],n+"/"+_+"/"+S,o,n,_,i,S)}else if(_ in so.propsKeywords){if(g&&typeof g=="object")for(var x in g)Ap(e,t,r,g[x],n+"/"+_+"/"+Hj(x),o,n,_,i,x)}else if(_ in so.keywords||e.allKeys&&!(_ in so.skipKeywords))Ap(e,t,r,g,n+"/"+_,o,n,_,i)}r(i,n,o,s,h,v,b)}}function Hj(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var lc=Xe(function(jM){Object.defineProperty(jM,"__esModule",{value:!0});jM.getSchemaRefs=jM.resolveUrl=jM.normalizeId=jM._getFullPath=jM.getFullPath=jM.inlineRef=void 0;var Zj=Mt(),Kj=Hb(),Vj=OM(),Wj=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Gj(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Zb(e);if(!t)return!1;return DM(e)<=t}jM.inlineRef=Gj;var Jj=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Zb(e){for(let t in e){if(Jj.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Zb))return!0;if(typeof r=="object"&&Zb(r))return!0}return!1}function DM(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,Wj.has(r))continue;if(typeof e[r]=="object")(0,Zj.eachItem)(e[r],(i)=>t+=DM(i));if(t===1/0)return 1/0}return t}function NM(e,t="",r){if(r!==!1)t=aa(t);let i=e.parse(t);return zM(e,i)}jM.getFullPath=NM;function zM(e,t){return e.serialize(t).split("#")[0]+"#"}jM._getFullPath=zM;var Xj=/#\/?$/;function aa(e){return e?e.replace(Xj,""):""}jM.normalizeId=aa;function Yj(e,t,r){return r=aa(r),e.resolve(t,r)}jM.resolveUrl=Yj;var Qj=/^[a-z_][-a-z0-9._]*$/i;function eU(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=aa(e[r]||t),o={"":n},s=NM(i,n,!1),h={},v=new Set;return Vj(e,{allKeys:!0},(g,S,x,M)=>{if(M===void 0)return;let I=s+S,T=o[M];if(typeof g[r]=="string")T=P.call(this,g[r]);$.call(this,g.$anchor),$.call(this,g.$dynamicAnchor),o[S]=T;function P(R){let C=this.opts.uriResolver.resolve;if(R=aa(T?C(T,R):R),v.has(R))throw _(R);v.add(R);let N=this.refs[R];if(typeof N=="string")N=this.refs[N];if(typeof N=="object")b(g,N.schema,R);else if(R!==aa(I))if(R[0]==="#")b(g,h[R],R),h[R]=g;else this.refs[R]=I;return R}function $(R){if(typeof R=="string"){if(!Qj.test(R))throw Error(`invalid anchor "${R}"`);P.call(this,`#${R}`)}}}),h;function b(g,S,x){if(S!==void 0&&!Kj(g,S))throw _(x)}function _(g){return Error(`reference "${g}" resolves to more than one schema`)}}jM.getSchemaRefs=eU});var fc=Xe(function(e4){Object.defineProperty(e4,"__esModule",{value:!0});e4.getData=e4.KeywordCxt=e4.validateFunctionCode=void 0;var HM=nM(),LM=uc(),Vb=zb(),Rp=uc(),sU=vM(),dc=IM(),Kb=AM(),nt=mt(),ct=Ii(),aU=lc(),Ti=Mt(),cc=ac();function uU(e){if(VM(e)){if(WM(e),KM(e)){dU(e);return}}ZM(e,()=>(0,HM.topBoolOrEmptySchema)(e))}e4.validateFunctionCode=uU;function ZM({gen:e,validateName:t,schema:r,schemaEnv:i,opts:n},o){if(n.code.es5)e.func(t,nt._`${ct.default.data}, ${ct.default.valCxt}`,i.$async,()=>{e.code(nt._`"use strict"; ${FM(r,n)}`),cU(e,n),e.code(o)});else e.func(t,nt._`${ct.default.data}, ${lU(n)}`,i.$async,()=>e.code(FM(r,n)).code(o))}function lU(e){return nt._`{${ct.default.instancePath}="", ${ct.default.parentData}, ${ct.default.parentDataProperty}, ${ct.default.rootData}=${ct.default.data}${e.dynamicRef?nt._`, ${ct.default.dynamicAnchors}={}`:nt.nil}}={}`}function cU(e,t){e.if(ct.default.valCxt,()=>{if(e.var(ct.default.instancePath,nt._`${ct.default.valCxt}.${ct.default.instancePath}`),e.var(ct.default.parentData,nt._`${ct.default.valCxt}.${ct.default.parentData}`),e.var(ct.default.parentDataProperty,nt._`${ct.default.valCxt}.${ct.default.parentDataProperty}`),e.var(ct.default.rootData,nt._`${ct.default.valCxt}.${ct.default.rootData}`),t.dynamicRef)e.var(ct.default.dynamicAnchors,nt._`${ct.default.valCxt}.${ct.default.dynamicAnchors}`)},()=>{if(e.var(ct.default.instancePath,nt._`""`),e.var(ct.default.parentData,nt._`undefined`),e.var(ct.default.parentDataProperty,nt._`undefined`),e.var(ct.default.rootData,ct.default.data),t.dynamicRef)e.var(ct.default.dynamicAnchors,nt._`{}`)})}function dU(e){let{schema:t,opts:r,gen:i}=e;ZM(e,()=>{if(r.$comment&&t.$comment)JM(e);if(gU(e),i.let(ct.default.vErrors,null),i.let(ct.default.errors,0),r.unevaluated)fU(e);GM(e),bU(e)});return}function fU(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",nt._`${r}.evaluated`),t.if(nt._`${e.evaluated}.dynamicProps`,()=>t.assign(nt._`${e.evaluated}.props`,nt._`undefined`)),t.if(nt._`${e.evaluated}.dynamicItems`,()=>t.assign(nt._`${e.evaluated}.items`,nt._`undefined`))}function FM(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?nt._`/*# sourceURL=${r} */`:nt.nil}function hU(e,t){if(VM(e)){if(WM(e),KM(e)){pU(e,t);return}}(0,HM.boolOrEmptySchema)(e,t)}function KM({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function VM(e){return typeof e.schema!="boolean"}function pU(e,t){let{schema:r,gen:i,opts:n}=e;if(n.$comment&&r.$comment)JM(e);yU(e),vU(e);let o=i.const("_errs",ct.default.errors);GM(e,o),i.var(t,nt._`${o} === ${ct.default.errors}`)}function WM(e){(0,Ti.checkUnknownRules)(e),mU(e)}function GM(e,t){if(e.opts.jtd)return qM(e,[],!1,t);let r=(0,LM.getSchemaTypes)(e.schema),i=(0,LM.coerceAndCheckDataType)(e,r);qM(e,r,!i,t)}function mU(e){let{schema:t,errSchemaPath:r,opts:i,self:n}=e;if(t.$ref&&i.ignoreKeywordsWithRef&&(0,Ti.schemaHasRulesButRef)(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function gU(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)(0,Ti.checkStrictMode)(e,"default is ignored in the schema root")}function yU(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,aU.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function vU(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function JM({gen:e,schemaEnv:t,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)e.code(nt._`${ct.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=nt.str`${i}/$comment`,h=e.scopeValue("root",{ref:t.root});e.code(nt._`${ct.default.self}.opts.$comment(${o}, ${s}, ${h}.schema)`)}}function bU(e){let{gen:t,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=e;if(r.$async)t.if(nt._`${ct.default.errors} === 0`,()=>t.return(ct.default.data),()=>t.throw(nt._`new ${n}(${ct.default.vErrors})`));else{if(t.assign(nt._`${i}.errors`,ct.default.vErrors),o.unevaluated)_U(e);t.return(nt._`${ct.default.errors} === 0`)}}function _U({gen:e,evaluated:t,props:r,items:i}){if(r instanceof nt.Name)e.assign(nt._`${t}.props`,r);if(i instanceof nt.Name)e.assign(nt._`${t}.items`,i)}function qM(e,t,r,i){let{gen:n,schema:o,data:s,allErrors:h,opts:v,self:b}=e,{RULES:_}=b;if(o.$ref&&(v.ignoreKeywordsWithRef||!(0,Ti.schemaHasRulesButRef)(o,_))){n.block(()=>YM(e,"$ref",_.all.$ref.definition));return}if(!v.jtd)wU(e,t);n.block(()=>{for(let S of _.rules)g(S);g(_.post)});function g(S){if(!(0,Vb.shouldUseGroup)(o,S))return;if(S.type){if(n.if((0,Rp.checkDataType)(S.type,s,v.strictNumbers)),BM(e,S),t.length===1&&t[0]===S.type&&r)n.else(),(0,Rp.reportTypeError)(e);n.endIf()}else BM(e,S);if(!h)n.if(nt._`${ct.default.errors} === ${i||0}`)}}function BM(e,t){let{gen:r,schema:i,opts:{useDefaults:n}}=e;if(n)(0,sU.assignDefaults)(e,t.type);r.block(()=>{for(let o of t.rules)if((0,Vb.shouldUseRule)(i,o))YM(e,o.keyword,o.definition,t.type)})}function wU(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(SU(e,t),!e.opts.allowUnionTypes)xU(e,t);kU(e,e.dataTypes)}function SU(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!XM(e.dataTypes,r))Wb(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),EU(e,t)}function xU(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Wb(e,"use allowUnionTypes to allow union type keyword")}function kU(e,t){let r=e.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,Vb.shouldUseRule)(e.schema,n)){let{type:o}=n.definition;if(o.length&&!o.some((s)=>MU(t,s)))Wb(e,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function MU(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function XM(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function EU(e,t){let r=[];for(let i of e.dataTypes)if(XM(t,i))r.push(i);else if(t.includes("integer")&&i==="number")r.push("integer");e.dataTypes=r}function Wb(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ti.checkStrictMode)(e,t,e.opts.strictTypes)}class Gb{constructor(e,t,r){if((0,dc.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ti.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",QM(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,dc.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",ct.default.errors)}result(e,t,r){this.failResult((0,nt.not)(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult((0,nt.not)(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(nt._`${t} !== undefined && (${(0,nt.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?cc.reportExtraError:cc.reportError)(this,this.def.error,t)}$dataError(){(0,cc.reportError)(this,this.def.$dataError||cc.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,cc.resetErrorsCount)(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=nt.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=nt.nil,t=nt.nil){if(!this.$data)return;let{gen:r,schemaCode:i,schemaType:n,def:o}=this;if(r.if((0,nt.or)(nt._`${i} === undefined`,t)),e!==nt.nil)r.assign(e,!0);if(n.length||o.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==nt.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:i,it:n}=this;return(0,nt.or)(o(),s());function o(){if(r.length){if(!(t instanceof nt.Name))throw Error("ajv implementation error");let h=Array.isArray(r)?r:[r];return nt._`${(0,Rp.checkDataTypes)(h,t,n.opts.strictNumbers,Rp.DataType.Wrong)}`}return nt.nil}function s(){if(i.validateSchema){let h=e.scopeValue("validate$data",{ref:i.validateSchema});return nt._`!${h}(${t})`}return nt.nil}}subschema(e,t){let r=(0,Kb.getSubschema)(this.it,e);(0,Kb.extendSubschemaData)(r,this.it,e),(0,Kb.extendSubschemaMode)(r,e);let i={...this.it,...r,items:void 0,props:void 0};return hU(i,t),i}mergeEvaluated(e,t){let{it:r,gen:i}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=Ti.mergeEvaluated.props(i,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Ti.mergeEvaluated.items(i,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:i}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return i.if(t,()=>this.mergeEvaluated(e,nt.Name)),!0}}e4.KeywordCxt=Gb;function YM(e,t,r,i){let n=new Gb(e,r,t);if("code"in r)r.code(n,i);else if(n.$data&&r.validate)(0,dc.funcKeywordCode)(n,r);else if("macro"in r)(0,dc.macroKeywordCode)(n,r);else if(r.compile||r.validate)(0,dc.funcKeywordCode)(n,r)}var IU=/^\/(?:[^~]|~0|~1)*$/,TU=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function QM(e,{dataLevel:t,dataNames:r,dataPathArr:i}){let n,o;if(e==="")return ct.default.rootData;if(e[0]==="/"){if(!IU.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,o=ct.default.rootData}else{let b=TU.exec(e);if(!b)throw Error(`Invalid JSON-pointer: ${e}`);let _=+b[1];if(n=b[2],n==="#"){if(_>=t)throw Error(v("property/index",_));return i[t-_]}if(_>t)throw Error(v("data",_));if(o=r[t-_],!n)return o}let s=o,h=n.split("/");for(let b of h)if(b)o=nt._`${o}${(0,nt.getProperty)((0,Ti.unescapeJsonPointer)(b))}`,s=nt._`${s} && ${o}`;return s;function v(b,_){return`Cannot access ${b} ${_} levels up, current level is ${t}`}}e4.getData=QM});var Cp=Xe(function(n4){Object.defineProperty(n4,"__esModule",{value:!0});class r4 extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}n4.default=r4});var hc=Xe(function(o4){Object.defineProperty(o4,"__esModule",{value:!0});var Jb=lc();class i4 extends Error{constructor(e,t,r,i){super(i||`can't resolve reference ${r} from id ${t}`);this.missingRef=(0,Jb.resolveUrl)(e,t,r),this.missingSchema=(0,Jb.normalizeId)((0,Jb.getFullPath)(e,this.missingRef))}}o4.default=i4});var Dp=Xe(function(u4){Object.defineProperty(u4,"__esModule",{value:!0});u4.resolveSchema=u4.getCompilingSchema=u4.resolveRef=u4.compileSchema=u4.SchemaEnv=void 0;var Zn=mt(),CU=Cp(),Wo=Ii(),Kn=lc(),s4=Mt(),OU=fc();class pc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:(0,Kn.normalizeId)(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}u4.SchemaEnv=pc;function Yb(e){let t=a4.call(this,e);if(t)return t;let r=(0,Kn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new Zn.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),h;if(e.$async)h=s.scopeValue("Error",{ref:CU.default,code:Zn._`require("ajv/dist/runtime/validation_error").default`});let v=s.scopeName("validate");e.validateName=v;let b={gen:s,allErrors:this.opts.allErrors,data:Wo.default.data,parentData:Wo.default.parentData,parentDataProperty:Wo.default.parentDataProperty,dataNames:[Wo.default.data],dataPathArr:[Zn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Zn.stringify)(e.schema)}:{ref:e.schema}),validateName:v,ValidationError:h,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Zn.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:Zn._`""`,opts:this.opts,self:this},_;try{this._compilations.add(e),(0,OU.validateFunctionCode)(b),s.optimize(this.opts.code.optimize);let g=s.toString();if(_=`${s.scopeRefs(Wo.default.scope)}return ${g}`,this.opts.code.process)_=this.opts.code.process(_,e);let x=Function(`${Wo.default.self}`,`${Wo.default.scope}`,_)(this,this.scope.get());if(this.scope.value(v,{ref:x}),x.errors=null,x.schema=e.schema,x.schemaEnv=e,e.$async)x.$async=!0;if(this.opts.code.source===!0)x.source={validateName:v,validateCode:g,scopeValues:s._values};if(this.opts.unevaluated){let{props:M,items:I}=b;if(x.evaluated={props:M instanceof Zn.Name?void 0:M,items:I instanceof Zn.Name?void 0:I,dynamicProps:M instanceof Zn.Name,dynamicItems:I instanceof Zn.Name},x.source)x.source.evaluated=(0,Zn.stringify)(x.evaluated)}return e.validate=x,e}catch(g){if(delete e.validate,delete e.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw g}finally{this._compilations.delete(e)}}u4.compileSchema=Yb;function DU(e,t,r){var i;r=(0,Kn.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let o=jU.call(this,e,r);if(o===void 0){let s=(i=e.localRefs)===null||i===void 0?void 0:i[r],{schemaId:h}=this.opts;if(s)o=new pc({schema:s,schemaId:h,root:e,baseId:t})}if(o===void 0)return;return e.refs[r]=NU.call(this,o)}u4.resolveRef=DU;function NU(e){if((0,Kn.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Yb.call(this,e)}function a4(e){for(let t of this._compilations)if(zU(t,e))return t}u4.getCompilingSchema=a4;function zU(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function jU(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Op.call(this,e,t)}function Op(e,t){let r=this.opts.uriResolver.parse(t),i=(0,Kn._getFullPath)(this.opts.uriResolver,r),n=(0,Kn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===n)return Xb.call(this,r,e);let o=(0,Kn.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let h=Op.call(this,e,s);if(typeof(h===null||h===void 0?void 0:h.schema)!=="object")return;return Xb.call(this,r,h)}if(typeof(s===null||s===void 0?void 0:s.schema)!=="object")return;if(!s.validate)Yb.call(this,s);if(o===(0,Kn.normalizeId)(t)){let{schema:h}=s,{schemaId:v}=this.opts,b=h[v];if(b)n=(0,Kn.resolveUrl)(this.opts.uriResolver,n,b);return new pc({schema:h,schemaId:v,root:e,baseId:n})}return Xb.call(this,r,s)}u4.resolveSchema=Op;var UU=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Xb(e,{baseId:t,schema:r,root:i}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let h of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let v=r[(0,s4.unescapeFragment)(h)];if(v===void 0)return;r=v;let b=typeof r==="object"&&r[this.opts.schemaId];if(!UU.has(h)&&b)t=(0,Kn.resolveUrl)(this.opts.uriResolver,t,b)}let o;if(typeof r!="boolean"&&r.$ref&&!(0,s4.schemaHasRulesButRef)(r,this.RULES)){let h=(0,Kn.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Op.call(this,i,h)}let{schemaId:s}=this.opts;if(o=o||new pc({schema:r,schemaId:s,root:i,baseId:t}),o.schema!==o.root.schema)return o;return}});var c4=Xe(function(Vbe,HU){HU.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var t_=Xe(function(Wbe,g4){var ZU=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),f4=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Qb=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),h4=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),KU=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function e_(e){let t="",r=0,i=0;for(i=0;i<e.length;i++){if(r=e[i].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i];break}for(i+=1;i<e.length;i++){if(r=e[i].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[i]}return t}var VU=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function d4(e){return e.length=0,!0}function WU(e,t,r){if(e.length){let i=e_(e);if(i!=="")t.push(i);else return r.error=!0,!1;e.length=0}return!0}function GU(e){let t=0,r={error:!1,address:"",zone:""},i=[],n=[],o=!1,s=!1,h=WU;for(let v=0;v<e.length;v++){let b=e[v];if(b==="["||b==="]")continue;if(b===":"){if(o===!0)s=!0;if(!h(n,i,r))break;if(++t>7){r.error=!0;break}if(v>0&&e[v-1]===":")o=!0;i.push(":");continue}else if(b==="%"){if(!h(n,i,r))break;h=d4}else{n.push(b);continue}}if(n.length)if(h===d4)r.zone=n.join("");else if(s)i.push(n.join(""));else i.push(e_(n));return r.address=i.join(""),r}function p4(e){if(JU(e,":")<2)return{host:e,isIPV6:!1};let t=GU(e);if(!t.error){let{address:r,address:i}=t;if(t.zone)r+="%"+t.zone,i+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:i}}else return{host:e,isIPV6:!1}}function JU(e,t){let r=0;for(let i=0;i<e.length;i++)if(e[i]===t)r++;return r}function XU(e){let t=e,r=[],i=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((i=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,i)),t=t.slice(i)}return r.join("")}var YU={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},QU=/[@/?#:]/g,eL=/[@/?#]/g;function m4(e,t){let r=t?eL:QU;return r.lastIndex=0,e.replace(r,(i)=>YU[i])}function tL(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let i=0;i<e.length;i++){if(e[i]==="%"&&i+2<e.length){let n=e.slice(i+1,i+3);if(Qb(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));if(t&&h4(s))r+=s;else r+="%"+o;i+=2;continue}}r+=e[i]}return r}function rL(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Qb(i)){let n=i.toUpperCase(),o=String.fromCharCode(parseInt(n,16));if(o!=="."&&h4(o))t+=o;else t+="%"+n;r+=2;continue}}if(KU(e[r]))t+=e[r];else t+=escape(e[r])}return t}function nL(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Qb(i)){t+="%"+i.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function iL(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!f4(r)){let i=p4(r);if(i.isIPV6===!0)r=`[${i.escapedHost}]`;else r=m4(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}g4.exports={nonSimpleDomain:VU,recomposeAuthority:iL,reescapeHostDelimiters:m4,normalizePercentEncoding:tL,normalizePathEncoding:rL,escapePreservingEscapes:nL,removeDotSegments:XU,isIPv4:f4,isUUID:ZU,normalizeIPv6:p4,stringArrayToHexStripped:e_}});var w4=Xe(function(Gbe,_4){var{isUUID:oL}=t_(),sL=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,aL=["http","https","ws","wss","urn","urn:uuid"];function uL(e){return aL.indexOf(e)!==-1}function r_(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function y4(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function v4(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function lL(e){return e.secure=r_(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function cL(e){if(e.port===(r_(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function dL(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(sL);if(r){let i=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${i}:${t.nid||e.nid}`,o=n_(n);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function fL(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",i=e.nid.toLowerCase(),n=`${r}:${t.nid||i}`,o=n_(n);if(o)e=o.serialize(e,t);let s=e,h=e.nss;return s.path=`${i||t.nid}:${h}`,t.skipEscape=!0,s}function hL(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!oL(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function pL(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var b4={scheme:"http",domainHost:!0,parse:y4,serialize:v4},mL={scheme:"https",domainHost:b4.domainHost,parse:y4,serialize:v4},Np={scheme:"ws",domainHost:!0,parse:lL,serialize:cL},gL={scheme:"wss",domainHost:Np.domainHost,parse:Np.parse,serialize:Np.serialize},yL={scheme:"urn",parse:dL,serialize:fL,skipNormalize:!0},vL={scheme:"urn:uuid",parse:hL,serialize:pL,skipNormalize:!0},zp={http:b4,https:mL,ws:Np,wss:gL,urn:yL,"urn:uuid":vL};Object.setPrototypeOf(zp,null);function n_(e){return e&&(zp[e]||zp[e.toLowerCase()])||void 0}_4.exports={wsIsSecure:r_,SCHEMES:zp,isValidSchemeName:uL,getSchemeHandler:n_}});var I4=Xe(function(Jbe,jp){var{normalizeIPv6:bL,removeDotSegments:mc,recomposeAuthority:_L,normalizePercentEncoding:wL,normalizePathEncoding:SL,escapePreservingEscapes:xL,reescapeHostDelimiters:kL,isIPv4:ML,nonSimpleDomain:EL}=t_(),{SCHEMES:IL,getSchemeHandler:x4}=w4();function TL(e,t){if(typeof e==="string")e=CL(e,t);else if(typeof e==="object")e=ua(Go(e,t),t);return e}function PL(e,t,r){let i=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=k4(ua(e,i),ua(t,i),i,!0);return i.skipEscape=!0,Go(n,i)}function k4(e,t,r,i){let n={};if(!i)e=ua(Go(e,r),r),t=ua(Go(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=mc(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=mc(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=mc(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=mc(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function $L(e,t,r){let i=S4(e,r),n=S4(t,r);return i!==void 0&&n!==void 0&&i.toLowerCase()===n.toLowerCase()}function Go(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},i=Object.assign({},t),n=[],o=x4(i.scheme||r.scheme);if(o&&o.serialize)o.serialize(r,i);if(r.path!==void 0)if(!i.skipEscape){if(r.path=xL(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=wL(r.path);if(i.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let s=_L(r);if(s!==void 0){if(i.reference!=="suffix")n.push("//");if(n.push(s),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let h=r.path;if(!i.absolutePath&&(!o||!o.absolutePath))h=mc(h);if(s===void 0&&h[0]==="/"&&h[1]==="/")h="/%2F"+h.slice(2);n.push(h)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var AL=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function RL(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function M4(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,o=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let s=e.match(AL);if(s){if(i.scheme=s[1],i.userinfo=s[3],i.host=s[4],i.port=parseInt(s[5],10),i.path=s[6]||"",i.query=s[7],i.fragment=s[8],isNaN(i.port))i.port=s[5];let h=RL(i,s);if(h!==void 0)i.error=i.error||h,n=!0;if(i.host)if(ML(i.host)===!1){let _=bL(i.host);i.host=_.host.toLowerCase(),o=_.isIPV6}else o=!0;if(i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path)i.reference="same-document";else if(i.scheme===void 0)i.reference="relative";else if(i.fragment===void 0)i.reference="absolute";else i.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==i.reference)i.error=i.error||"URI is not a "+r.reference+" reference.";let v=x4(r.scheme||i.scheme);if(!r.unicodeSupport&&(!v||!v.unicodeSupport)){if(i.host&&(r.domainHost||v&&v.domainHost)&&o===!1&&EL(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(b){i.error=i.error||"Host's domain name can not be converted to ASCII: "+b}}if(!v||v&&!v.skipNormalize){if(e.indexOf("%")!==-1){if(i.scheme!==void 0)i.scheme=unescape(i.scheme);if(i.host!==void 0)i.host=kL(unescape(i.host),o)}if(i.path)i.path=SL(i.path);if(i.fragment)try{i.fragment=encodeURI(decodeURIComponent(i.fragment))}catch{i.error=i.error||"URI malformed"}}if(v&&v.parse)v.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:n}}function ua(e,t){return M4(e,t).parsed}function CL(e,t){return E4(e,t).normalized}function E4(e,t){let{parsed:r,malformedAuthorityOrPort:i}=M4(e,t);return{normalized:i?e:Go(r,t),malformedAuthorityOrPort:i}}function S4(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:i}=E4(e,t);return i?void 0:r}if(typeof e==="object")return Go(e,t)}var i_={SCHEMES:IL,normalize:TL,resolve:PL,resolveComponent:k4,equal:$L,serialize:Go,parse:ua};jp.exports=i_;jp.exports.default=i_;jp.exports.fastUri=i_});var $4=Xe(function(P4){Object.defineProperty(P4,"__esModule",{value:!0});var T4=I4();T4.code='require("ajv/dist/runtime/uri").default';P4.default=T4});var j4=Xe(function(Pi){Object.defineProperty(Pi,"__esModule",{value:!0});Pi.CodeGen=Pi.Name=Pi.nil=Pi.stringify=Pi.str=Pi._=Pi.KeywordCxt=void 0;var DL=fc();Object.defineProperty(Pi,"KeywordCxt",{enumerable:!0,get:function(){return DL.KeywordCxt}});var la=mt();Object.defineProperty(Pi,"_",{enumerable:!0,get:function(){return la._}});Object.defineProperty(Pi,"str",{enumerable:!0,get:function(){return la.str}});Object.defineProperty(Pi,"stringify",{enumerable:!0,get:function(){return la.stringify}});Object.defineProperty(Pi,"nil",{enumerable:!0,get:function(){return la.nil}});Object.defineProperty(Pi,"Name",{enumerable:!0,get:function(){return la.Name}});Object.defineProperty(Pi,"CodeGen",{enumerable:!0,get:function(){return la.CodeGen}});var NL=Cp(),D4=hc(),zL=Nb(),gc=Dp(),jL=mt(),yc=lc(),Up=uc(),s_=Mt(),A4=c4(),UL=$4(),N4=(e,t)=>new RegExp(e,t);N4.code="new RegExp";var LL=["removeAdditional","useDefaults","coerceTypes"],FL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),qL={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},BL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},R4=200;function HL(e){var t,r,i,n,o,s,h,v,b,_,g,S,x,M,I,T,P,$,R,C,N,B,ie,le,ue;let F=e.strict,ee=(t=e.code)===null||t===void 0?void 0:t.optimize,a=ee===!0||ee===void 0?1:ee||0,c=(i=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:N4,f=(n=e.uriResolver)!==null&&n!==void 0?n:UL.default;return{strictSchema:(s=(o=e.strictSchema)!==null&&o!==void 0?o:F)!==null&&s!==void 0?s:!0,strictNumbers:(v=(h=e.strictNumbers)!==null&&h!==void 0?h:F)!==null&&v!==void 0?v:!0,strictTypes:(_=(b=e.strictTypes)!==null&&b!==void 0?b:F)!==null&&_!==void 0?_:"log",strictTuples:(S=(g=e.strictTuples)!==null&&g!==void 0?g:F)!==null&&S!==void 0?S:"log",strictRequired:(M=(x=e.strictRequired)!==null&&x!==void 0?x:F)!==null&&M!==void 0?M:!1,code:e.code?{...e.code,optimize:a,regExp:c}:{optimize:a,regExp:c},loopRequired:(I=e.loopRequired)!==null&&I!==void 0?I:R4,loopEnum:(T=e.loopEnum)!==null&&T!==void 0?T:R4,meta:(P=e.meta)!==null&&P!==void 0?P:!0,messages:($=e.messages)!==null&&$!==void 0?$:!0,inlineRefs:(R=e.inlineRefs)!==null&&R!==void 0?R:!0,schemaId:(C=e.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(N=e.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:(B=e.validateSchema)!==null&&B!==void 0?B:!0,validateFormats:(ie=e.validateFormats)!==null&&ie!==void 0?ie:!0,unicodeRegExp:(le=e.unicodeRegExp)!==null&&le!==void 0?le:!0,int32range:(ue=e.int32range)!==null&&ue!==void 0?ue:!0,uriResolver:f}}class Lp{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...HL(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new jL.ValueScope({scope:{},prefixes:FL,es5:t,lines:r}),this.logger=JL(e.logger);let i=e.validateFormats;if(e.validateFormats=!1,this.RULES=(0,zL.getRules)(),C4.call(this,qL,e,"NOT SUPPORTED"),C4.call(this,BL,e,"DEPRECATED","warn"),this._metaOpts=WL.call(this),e.formats)KL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)VL.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);ZL.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,i=A4;if(r==="id")i={...A4},i.id=i.$id,delete i.$id;if(t&&e)this.addMetaSchema(i,i[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let i=r(t);if(!("$async"in r))this.errors=r.errors;return i}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return i.call(this,e,t);async function i(b,_){await n.call(this,b.$schema);let g=this._addSchema(b,_);return g.validate||o.call(this,g)}async function n(b){if(b&&!this.getSchema(b))await i.call(this,{$ref:b},!0)}async function o(b){try{return this._compileSchemaEnv(b)}catch(_){if(!(_ instanceof D4.default))throw _;return s.call(this,_),await h.call(this,_.missingSchema),o.call(this,b)}}function s({missingSchema:b,missingRef:_}){if(this.refs[b])throw Error(`AnySchema ${b} is loaded but ${_} cannot be resolved`)}async function h(b){let _=await v.call(this,b);if(!this.refs[b])await n.call(this,_.$schema);if(!this.refs[b])this.addSchema(_,b,t)}async function v(b){let _=this._loading[b];if(_)return _;try{return await(this._loading[b]=r(b))}finally{delete this._loading[b]}}}addSchema(e,t,r,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,r,i);return this}let n;if(typeof e==="object"){let{schemaId:o}=this.opts;if(n=e[o],n!==void 0&&typeof n!="string")throw Error(`schema ${o} must be string`)}return t=(0,yc.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,i,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(r,e);if(!i&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return i}getSchema(e){let t;while(typeof(t=O4.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,i=new gc.SchemaEnv({schema:{},schemaId:r});if(t=gc.resolveSchema.call(this,i,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=O4.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=(0,yc.normalizeId)(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(YL.call(this,r,t),!t)return(0,s_.eachItem)(r,(n)=>o_.call(this,n)),this;eF.call(this,t);let i={...t,type:(0,Up.getJSONTypes)(t.type),schemaType:(0,Up.getJSONTypes)(t.schemaType)};return(0,s_.eachItem)(r,i.type.length===0?(n)=>o_.call(this,n,i):(n)=>i.type.forEach((o)=>o_.call(this,n,i,o))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let i=r.rules.findIndex((n)=>n.keyword===e);if(i>=0)r.rules.splice(i,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((i)=>`${r}${i.instancePath} ${i.message}`).reduce((i,n)=>i+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of t){let n=i.split("/").slice(1),o=e;for(let s of n)o=o[s];for(let s in r){let h=r[s];if(typeof h!="object")continue;let{$data:v}=h.definition,b=o[s];if(v&&b)o[s]=z4(b)}}return e}_removeAllSchemas(e,t){for(let r in e){let i=e[r];if(!t||t.test(r)){if(typeof i=="string")delete e[r];else if(i&&!i.meta)this._cache.delete(i.schema),delete e[r]}}}_addSchema(e,t,r,i=this.opts.validateSchema,n=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof e=="object")o=e[s];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let h=this._cache.get(e);if(h!==void 0)return h;r=(0,yc.normalizeId)(o||r);let v=yc.getSchemaRefs.call(this,e,r);if(h=new gc.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:r,localRefs:v}),this._cache.set(h.schema,h),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=h}if(i)this.validateSchema(e,!0);return h}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else gc.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{gc.compileSchema.call(this,e)}finally{this.opts=t}}}Lp.ValidationError=NL.default;Lp.MissingRefError=D4.default;Pi.default=Lp;function C4(e,t,r,i="error"){for(let n in e){let o=n;if(o in t)this.logger[i](`${r}: option ${n}. ${e[o]}`)}}function O4(e){return e=(0,yc.normalizeId)(e),this.schemas[e]||this.refs[e]}function ZL(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function KL(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function VL(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function WL(){let e={...this.opts};for(let t of LL)delete e[t];return e}var GL={log(){},warn(){},error(){}};function JL(e){if(e===!1)return GL;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var XL=/^[a-z_$][a-z0-9_$:-]*$/i;function YL(e,t){let{RULES:r}=this;if((0,s_.eachItem)(e,(i)=>{if(r.keywords[i])throw Error(`Keyword ${i} is already defined`);if(!XL.test(i))throw Error(`Keyword ${i} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function o_(e,t,r){var i;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:v})=>v===r);if(!s)s={type:r,rules:[]},o.rules.push(s);if(o.keywords[e]=!0,!t)return;let h={keyword:e,definition:{...t,type:(0,Up.getJSONTypes)(t.type),schemaType:(0,Up.getJSONTypes)(t.schemaType)}};if(t.before)QL.call(this,s,h,t.before);else s.rules.push(h);o.all[e]=h,(i=t.implements)===null||i===void 0||i.forEach((v)=>this.addKeyword(v))}function QL(e,t,r){let i=e.rules.findIndex((n)=>n.keyword===r);if(i>=0)e.rules.splice(i,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function eF(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=z4(t);e.validateSchema=this.compile(t,!0)}var tF={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function z4(e){return{anyOf:[e,tF]}}});var L4=Xe(function(U4){Object.defineProperty(U4,"__esModule",{value:!0});var iF={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};U4.default=iF});var K4=Xe(function(H4){Object.defineProperty(H4,"__esModule",{value:!0});H4.callRef=H4.getValidate=void 0;var sF=hc(),F4=Rn(),un=mt(),ca=Ii(),q4=Dp(),Fp=Mt(),aF={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:i}=e,{baseId:n,schemaEnv:o,validateName:s,opts:h,self:v}=i,{root:b}=o;if((r==="#"||r==="#/")&&n===b.baseId)return g();let _=q4.resolveRef.call(v,b,n,r);if(_===void 0)throw new sF.default(i.opts.uriResolver,n,r);if(_ instanceof q4.SchemaEnv)return S(_);return x(_);function g(){if(o===b)return qp(e,s,o,o.$async);let M=t.scopeValue("root",{ref:b});return qp(e,un._`${M}.validate`,b,b.$async)}function S(M){let I=B4(e,M);qp(e,I,M,M.$async)}function x(M){let I=t.scopeValue("schema",h.code.source===!0?{ref:M,code:(0,un.stringify)(M)}:{ref:M}),T=t.name("valid"),P=e.subschema({schema:M,dataTypes:[],schemaPath:un.nil,topSchemaRef:I,errSchemaPath:r},T);e.mergeEvaluated(P),e.ok(T)}}};function B4(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):un._`${r.scopeValue("wrapper",{ref:t})}.validate`}H4.getValidate=B4;function qp(e,t,r,i){let{gen:n,it:o}=e,{allErrors:s,schemaEnv:h,opts:v}=o,b=v.passContext?ca.default.this:un.nil;if(i)_();else g();function _(){if(!h.$async)throw Error("async schema referenced by sync schema");let M=n.let("valid");n.try(()=>{if(n.code(un._`await ${(0,F4.callValidateCode)(e,t,b)}`),x(t),!s)n.assign(M,!0)},(I)=>{if(n.if(un._`!(${I} instanceof ${o.ValidationError})`,()=>n.throw(I)),S(I),!s)n.assign(M,!1)}),e.ok(M)}function g(){e.result((0,F4.callValidateCode)(e,t,b),()=>x(t),()=>S(t))}function S(M){let I=un._`${M}.errors`;n.assign(ca.default.vErrors,un._`${ca.default.vErrors} === null ? ${I} : ${ca.default.vErrors}.concat(${I})`),n.assign(ca.default.errors,un._`${ca.default.vErrors}.length`)}function x(M){var I;if(!o.opts.unevaluated)return;let T=(I=r===null||r===void 0?void 0:r.validate)===null||I===void 0?void 0:I.evaluated;if(o.props!==!0)if(T&&!T.dynamicProps){if(T.props!==void 0)o.props=Fp.mergeEvaluated.props(n,T.props,o.props)}else{let P=n.var("props",un._`${M}.evaluated.props`);o.props=Fp.mergeEvaluated.props(n,P,o.props,un.Name)}if(o.items!==!0)if(T&&!T.dynamicItems){if(T.items!==void 0)o.items=Fp.mergeEvaluated.items(n,T.items,o.items)}else{let P=n.var("items",un._`${M}.evaluated.items`);o.items=Fp.mergeEvaluated.items(n,P,o.items,un.Name)}}}H4.callRef=qp;H4.default=aF});var W4=Xe(function(V4){Object.defineProperty(V4,"__esModule",{value:!0});var cF=L4(),dF=K4(),fF=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",cF.default,dF.default];V4.default=fF});var J4=Xe(function(G4){Object.defineProperty(G4,"__esModule",{value:!0});var Bp=mt(),ao=Bp.operators,Hp={maximum:{okStr:"<=",ok:ao.LTE,fail:ao.GT},minimum:{okStr:">=",ok:ao.GTE,fail:ao.LT},exclusiveMaximum:{okStr:"<",ok:ao.LT,fail:ao.GTE},exclusiveMinimum:{okStr:">",ok:ao.GT,fail:ao.LTE}},pF={message:({keyword:e,schemaCode:t})=>Bp.str`must be ${Hp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Bp._`{comparison: ${Hp[e].okStr}, limit: ${t}}`},mF={keyword:Object.keys(Hp),type:"number",schemaType:"number",$data:!0,error:pF,code(e){let{keyword:t,data:r,schemaCode:i}=e;e.fail$data(Bp._`${r} ${Hp[t].fail} ${i} || isNaN(${r})`)}};G4.default=mF});var Y4=Xe(function(X4){Object.defineProperty(X4,"__esModule",{value:!0});var vc=mt(),yF={message:({schemaCode:e})=>vc.str`must be multiple of ${e}`,params:({schemaCode:e})=>vc._`{multipleOf: ${e}}`},vF={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:yF,code(e){let{gen:t,data:r,schemaCode:i,it:n}=e,o=n.opts.multipleOfPrecision,s=t.let("res"),h=o?vc._`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:vc._`${s} !== parseInt(${s})`;e.fail$data(vc._`(${i} === 0 || (${s} = ${r}/${i}, ${h}))`)}};X4.default=vF});var t3=Xe(function(e3){Object.defineProperty(e3,"__esModule",{value:!0});function Q4(e){let t=e.length,r=0,i=0,n;while(i<t)if(r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t){if(n=e.charCodeAt(i),(n&64512)===56320)i++}return r}e3.default=Q4;Q4.code='require("ajv/dist/runtime/ucs2length").default'});var n3=Xe(function(r3){Object.defineProperty(r3,"__esModule",{value:!0});var Jo=mt(),wF=Mt(),SF=t3(),xF={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return Jo.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>Jo._`{limit: ${e}}`},kF={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:xF,code(e){let{keyword:t,data:r,schemaCode:i,it:n}=e,o=t==="maxLength"?Jo.operators.GT:Jo.operators.LT,s=n.opts.unicode===!1?Jo._`${r}.length`:Jo._`${(0,wF.useFunc)(e.gen,SF.default)}(${r})`;e.fail$data(Jo._`${s} ${o} ${i}`)}};r3.default=kF});var o3=Xe(function(i3){Object.defineProperty(i3,"__esModule",{value:!0});var EF=Rn(),IF=Mt(),da=mt(),TF={message:({schemaCode:e})=>da.str`must match pattern "${e}"`,params:({schemaCode:e})=>da._`{pattern: ${e}}`},PF={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:TF,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e,h=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:v}=s.opts.code,b=v.code==="new RegExp"?da._`new RegExp`:(0,IF.useFunc)(t,v),_=t.let("valid");t.try(()=>t.assign(_,da._`${b}(${o}, ${h}).test(${r})`),()=>t.assign(_,!1)),e.fail$data(da._`!${_}`)}else{let v=(0,EF.usePattern)(e,n);e.fail$data(da._`!${v}.test(${r})`)}}};i3.default=PF});var a3=Xe(function(s3){Object.defineProperty(s3,"__esModule",{value:!0});var bc=mt(),AF={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return bc.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>bc._`{limit: ${e}}`},RF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:AF,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxProperties"?bc.operators.GT:bc.operators.LT;e.fail$data(bc._`Object.keys(${r}).length ${n} ${i}`)}};s3.default=RF});var l3=Xe(function(u3){Object.defineProperty(u3,"__esModule",{value:!0});var _c=Rn(),wc=mt(),OF=Mt(),DF={message:({params:{missingProperty:e}})=>wc.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>wc._`{missingProperty: ${e}}`},NF={keyword:"required",type:"object",schemaType:"array",$data:!0,error:DF,code(e){let{gen:t,schema:r,schemaCode:i,data:n,$data:o,it:s}=e,{opts:h}=s;if(!o&&r.length===0)return;let v=r.length>=h.loopRequired;if(s.allErrors)b();else _();if(h.strictRequired){let x=e.parentSchema.properties,{definedProperties:M}=e.it;for(let I of r)if((x===null||x===void 0?void 0:x[I])===void 0&&!M.has(I)){let T=s.schemaEnv.baseId+s.errSchemaPath,P=`required property "${I}" is not defined at "${T}" (strictRequired)`;(0,OF.checkStrictMode)(s,P,s.opts.strictRequired)}}function b(){if(v||o)e.block$data(wc.nil,g);else for(let x of r)(0,_c.checkReportMissingProp)(e,x)}function _(){let x=t.let("missing");if(v||o){let M=t.let("valid",!0);e.block$data(M,()=>S(x,M)),e.ok(M)}else t.if((0,_c.checkMissingProp)(e,r,x)),(0,_c.reportMissingProp)(e,x),t.else()}function g(){t.forOf("prop",i,(x)=>{e.setParams({missingProperty:x}),t.if((0,_c.noPropertyInData)(t,n,x,h.ownProperties),()=>e.error())})}function S(x,M){e.setParams({missingProperty:x}),t.forOf(x,i,()=>{t.assign(M,(0,_c.propertyInData)(t,n,x,h.ownProperties)),t.if((0,wc.not)(M),()=>{e.error(),t.break()})},wc.nil)}}};u3.default=NF});var d3=Xe(function(c3){Object.defineProperty(c3,"__esModule",{value:!0});var Sc=mt(),jF={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return Sc.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>Sc._`{limit: ${e}}`},UF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:jF,code(e){let{keyword:t,data:r,schemaCode:i}=e,n=t==="maxItems"?Sc.operators.GT:Sc.operators.LT;e.fail$data(Sc._`${r}.length ${n} ${i}`)}};c3.default=UF});var Zp=Xe(function(h3){Object.defineProperty(h3,"__esModule",{value:!0});var f3=Hb();f3.code='require("ajv/dist/runtime/equal").default';h3.default=f3});var m3=Xe(function(p3){Object.defineProperty(p3,"__esModule",{value:!0});var a_=uc(),Nr=mt(),qF=Mt(),BF=Zp(),HF={message:({params:{i:e,j:t}})=>Nr.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Nr._`{i: ${e}, j: ${t}}`},ZF={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:HF,code(e){let{gen:t,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:h}=e;if(!i&&!n)return;let v=t.let("valid"),b=o.items?(0,a_.getSchemaTypes)(o.items):[];e.block$data(v,_,Nr._`${s} === false`),e.ok(v);function _(){let M=t.let("i",Nr._`${r}.length`),I=t.let("j");e.setParams({i:M,j:I}),t.assign(v,!0),t.if(Nr._`${M} > 1`,()=>(g()?S:x)(M,I))}function g(){return b.length>0&&!b.some((M)=>M==="object"||M==="array")}function S(M,I){let T=t.name("item"),P=(0,a_.checkDataTypes)(b,T,h.opts.strictNumbers,a_.DataType.Wrong),$=t.const("indices",Nr._`{}`);t.for(Nr._`;${M}--;`,()=>{if(t.let(T,Nr._`${r}[${M}]`),t.if(P,Nr._`continue`),b.length>1)t.if(Nr._`typeof ${T} == "string"`,Nr._`${T} += "_"`);t.if(Nr._`typeof ${$}[${T}] == "number"`,()=>{t.assign(I,Nr._`${$}[${T}]`),e.error(),t.assign(v,!1).break()}).code(Nr._`${$}[${T}] = ${M}`)})}function x(M,I){let T=(0,qF.useFunc)(t,BF.default),P=t.name("outer");t.label(P).for(Nr._`;${M}--;`,()=>t.for(Nr._`${I} = ${M}; ${I}--;`,()=>t.if(Nr._`${T}(${r}[${M}], ${r}[${I}])`,()=>{e.error(),t.assign(v,!1).break(P)})))}}};p3.default=ZF});var y3=Xe(function(g3){Object.defineProperty(g3,"__esModule",{value:!0});var u_=mt(),VF=Mt(),WF=Zp(),GF={message:"must be equal to constant",params:({schemaCode:e})=>u_._`{allowedValue: ${e}}`},JF={keyword:"const",$data:!0,error:GF,code(e){let{gen:t,data:r,$data:i,schemaCode:n,schema:o}=e;if(i||o&&typeof o=="object")e.fail$data(u_._`!${(0,VF.useFunc)(t,WF.default)}(${r}, ${n})`);else e.fail(u_._`${o} !== ${r}`)}};g3.default=JF});var b3=Xe(function(v3){Object.defineProperty(v3,"__esModule",{value:!0});var xc=mt(),YF=Mt(),QF=Zp(),eq={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>xc._`{allowedValues: ${e}}`},tq={keyword:"enum",schemaType:"array",$data:!0,error:eq,code(e){let{gen:t,data:r,$data:i,schema:n,schemaCode:o,it:s}=e;if(!i&&n.length===0)throw Error("enum must have non-empty array");let h=n.length>=s.opts.loopEnum,v,b=()=>v!==null&&v!==void 0?v:v=(0,YF.useFunc)(t,QF.default),_;if(h||i)_=t.let("valid"),e.block$data(_,g);else{if(!Array.isArray(n))throw Error("ajv implementation error");let x=t.const("vSchema",o);_=(0,xc.or)(...n.map((M,I)=>S(x,I)))}e.pass(_);function g(){t.assign(_,!1),t.forOf("v",o,(x)=>t.if(xc._`${b()}(${r}, ${x})`,()=>t.assign(_,!0).break()))}function S(x,M){let I=n[M];return typeof I==="object"&&I!==null?xc._`${b()}(${r}, ${x}[${M}])`:xc._`${r} === ${I}`}}};v3.default=tq});var w3=Xe(function(_3){Object.defineProperty(_3,"__esModule",{value:!0});var nq=J4(),iq=Y4(),oq=n3(),sq=o3(),aq=a3(),uq=l3(),lq=d3(),cq=m3(),dq=y3(),fq=b3(),hq=[nq.default,iq.default,oq.default,sq.default,aq.default,uq.default,lq.default,cq.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},dq.default,fq.default];_3.default=hq});var c_=Xe(function(x3){Object.defineProperty(x3,"__esModule",{value:!0});x3.validateAdditionalItems=void 0;var Xo=mt(),l_=Mt(),mq={message:({params:{len:e}})=>Xo.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Xo._`{limit: ${e}}`},gq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:mq,code(e){let{parentSchema:t,it:r}=e,{items:i}=t;if(!Array.isArray(i)){(0,l_.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}S3(e,i)}};function S3(e,t){let{gen:r,schema:i,data:n,keyword:o,it:s}=e;s.items=!0;let h=r.const("len",Xo._`${n}.length`);if(i===!1)e.setParams({len:t.length}),e.pass(Xo._`${h} <= ${t.length}`);else if(typeof i=="object"&&!(0,l_.alwaysValidSchema)(s,i)){let b=r.var("valid",Xo._`${h} <= ${t.length}`);r.if((0,Xo.not)(b),()=>v(b)),e.ok(b)}function v(b){r.forRange("i",t.length,h,(_)=>{if(e.subschema({keyword:o,dataProp:_,dataPropType:l_.Type.Num},b),!s.allErrors)r.if((0,Xo.not)(b),()=>r.break())})}}x3.validateAdditionalItems=S3;x3.default=gq});var d_=Xe(function(I3){Object.defineProperty(I3,"__esModule",{value:!0});I3.validateTuple=void 0;var M3=mt(),Kp=Mt(),vq=Rn(),bq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return E3(e,"additionalItems",t);if(r.items=!0,(0,Kp.alwaysValidSchema)(r,t))return;e.ok((0,vq.validateArray)(e))}};function E3(e,t,r=e.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:h}=e;if(_(n),h.opts.unevaluated&&r.length&&h.items!==!0)h.items=Kp.mergeEvaluated.items(i,r.length,h.items);let v=i.name("valid"),b=i.const("len",M3._`${o}.length`);r.forEach((g,S)=>{if((0,Kp.alwaysValidSchema)(h,g))return;i.if(M3._`${b} > ${S}`,()=>e.subschema({keyword:s,schemaProp:S,dataProp:S},v)),e.ok(v)});function _(g){let{opts:S,errSchemaPath:x}=h,M=r.length,I=M===g.minItems&&(M===g.maxItems||g[t]===!1);if(S.strictTuples&&!I){let T=`"${s}" is ${M}-tuple, but minItems or maxItems/${t} are not specified or different at path "${x}"`;(0,Kp.checkStrictMode)(h,T,S.strictTuples)}}}I3.validateTuple=E3;I3.default=bq});var $3=Xe(function(P3){Object.defineProperty(P3,"__esModule",{value:!0});var wq=d_(),Sq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>(0,wq.validateTuple)(e,"items")};P3.default=Sq});var C3=Xe(function(R3){Object.defineProperty(R3,"__esModule",{value:!0});var A3=mt(),kq=Mt(),Mq=Rn(),Eq=c_(),Iq={message:({params:{len:e}})=>A3.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>A3._`{limit: ${e}}`},Tq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Iq,code(e){let{schema:t,parentSchema:r,it:i}=e,{prefixItems:n}=r;if(i.items=!0,(0,kq.alwaysValidSchema)(i,t))return;if(n)(0,Eq.validateAdditionalItems)(e,n);else e.ok((0,Mq.validateArray)(e))}};R3.default=Tq});var D3=Xe(function(O3){Object.defineProperty(O3,"__esModule",{value:!0});var Cn=mt(),Vp=Mt(),$q={message:({params:{min:e,max:t}})=>t===void 0?Cn.str`must contain at least ${e} valid item(s)`:Cn.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Cn._`{minContains: ${e}}`:Cn._`{minContains: ${e}, maxContains: ${t}}`},Aq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:$q,code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e,s,h,{minContains:v,maxContains:b}=i;if(o.opts.next)s=v===void 0?1:v,h=b;else s=1;let _=t.const("len",Cn._`${n}.length`);if(e.setParams({min:s,max:h}),h===void 0&&s===0){(0,Vp.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(h!==void 0&&s>h){(0,Vp.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Vp.alwaysValidSchema)(o,r)){let I=Cn._`${_} >= ${s}`;if(h!==void 0)I=Cn._`${I} && ${_} <= ${h}`;e.pass(I);return}o.items=!0;let g=t.name("valid");if(h===void 0&&s===1)x(g,()=>t.if(g,()=>t.break()));else if(s===0){if(t.let(g,!0),h!==void 0)t.if(Cn._`${n}.length > 0`,S)}else t.let(g,!1),S();e.result(g,()=>e.reset());function S(){let I=t.name("_valid"),T=t.let("count",0);x(I,()=>t.if(I,()=>M(T)))}function x(I,T){t.forRange("i",0,_,(P)=>{e.subschema({keyword:"contains",dataProp:P,dataPropType:Vp.Type.Num,compositeRule:!0},I),T()})}function M(I){if(t.code(Cn._`${I}++`),h===void 0)t.if(Cn._`${I} >= ${s}`,()=>t.assign(g,!0).break());else if(t.if(Cn._`${I} > ${h}`,()=>t.assign(g,!1).break()),s===1)t.assign(g,!0);else t.if(Cn._`${I} >= ${s}`,()=>t.assign(g,!0))}}};O3.default=Aq});var F3=Xe(function(j3){Object.defineProperty(j3,"__esModule",{value:!0});j3.validateSchemaDeps=j3.validatePropertyDeps=j3.error=void 0;var f_=mt(),Cq=Mt(),kc=Rn();j3.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let i=t===1?"property":"properties";return f_.str`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:i}})=>f_._`{property: ${e},
24
24
  missingProperty: ${i},
25
25
  depsCount: ${t},
26
- deps: ${r}}`};var Oq={keyword:"dependencies",type:"object",schemaType:"object",error:j3.error,code(e){let[t,r]=Dq(e);N3(e,t),z3(e,r)}};function Dq({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function N3(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let h=t[s];if(h.length===0)continue;let v=(0,kc.propertyInData)(r,i,s,n.opts.ownProperties);if(e.setParams({property:s,depsCount:h.length,deps:h.join(", ")}),n.allErrors)r.if(v,()=>{for(let b of h)(0,kc.checkReportMissingProp)(e,b)});else r.if(f_._`${v} && (${(0,kc.checkMissingProp)(e,h,o)})`),(0,kc.reportMissingProp)(e,o),r.else()}}j3.validatePropertyDeps=N3;function z3(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let h in t){if((0,Cq.alwaysValidSchema)(o,t[h]))continue;r.if((0,kc.propertyInData)(r,i,h,o.opts.ownProperties),()=>{let v=e.subschema({keyword:n,schemaProp:h},s);e.mergeValidEvaluated(v,s)},()=>r.var(s,!0)),e.ok(s)}}j3.validateSchemaDeps=z3;j3.default=Oq});var H3=Xe(function(B3){Object.defineProperty(B3,"__esModule",{value:!0});var q3=mt(),jq=Mt(),Uq={message:"property name must be valid",params:({params:e})=>q3._`{propertyName: ${e.propertyName}}`},Lq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Uq,code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,jq.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",i,(s)=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,q3.not)(o),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(o)}};B3.default=Lq});var h_=Xe(function(Z3){Object.defineProperty(Z3,"__esModule",{value:!0});var Wp=Rn(),Vn=mt(),qq=Ii(),Gp=Mt(),Bq={message:"must NOT have additional properties",params:({params:e})=>Vn._`{additionalProperty: ${e.additionalProperty}}`},Hq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Bq,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw Error("ajv implementation error");let{allErrors:h,opts:v}=s;if(s.props=!0,v.removeAdditional!=="all"&&(0,Gp.alwaysValidSchema)(s,r))return;let b=(0,Wp.allSchemaProperties)(i.properties),_=(0,Wp.allSchemaProperties)(i.patternProperties);g(),e.ok(Vn._`${o} === ${qq.default.errors}`);function g(){t.forIn("key",n,(T)=>{if(!b.length&&!_.length)M(T);else t.if(S(T),()=>M(T))})}function S(T){let P;if(b.length>8){let $=(0,Gp.schemaRefOrVal)(s,i.properties,"properties");P=(0,Wp.isOwnProperty)(t,$,T)}else if(b.length)P=(0,Vn.or)(...b.map(($)=>Vn._`${T} === ${$}`));else P=Vn.nil;if(_.length)P=(0,Vn.or)(P,..._.map(($)=>Vn._`${(0,Wp.usePattern)(e,$)}.test(${T})`));return(0,Vn.not)(P)}function x(T){t.code(Vn._`delete ${n}[${T}]`)}function M(T){if(v.removeAdditional==="all"||v.removeAdditional&&r===!1){x(T);return}if(r===!1){if(e.setParams({additionalProperty:T}),e.error(),!h)t.break();return}if(typeof r=="object"&&!(0,Gp.alwaysValidSchema)(s,r)){let P=t.name("valid");if(v.removeAdditional==="failing")I(T,P,!1),t.if((0,Vn.not)(P),()=>{e.reset(),x(T)});else if(I(T,P),!h)t.if((0,Vn.not)(P),()=>t.break())}}function I(T,P,$){let R={keyword:"additionalProperties",dataProp:T,dataPropType:Gp.Type.Str};if($===!1)Object.assign(R,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(R,P)}}};Z3.default=Hq});var G3=Xe(function(W3){Object.defineProperty(W3,"__esModule",{value:!0});var Kq=fc(),K3=Rn(),p_=Mt(),V3=h_(),Vq={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;if(o.opts.removeAdditional==="all"&&i.additionalProperties===void 0)V3.default.code(new Kq.KeywordCxt(o,V3.default,"additionalProperties"));let s=(0,K3.allSchemaProperties)(r);for(let g of s)o.definedProperties.add(g);if(o.opts.unevaluated&&s.length&&o.props!==!0)o.props=p_.mergeEvaluated.props(t,(0,p_.toHash)(s),o.props);let h=s.filter((g)=>!(0,p_.alwaysValidSchema)(o,r[g]));if(h.length===0)return;let v=t.name("valid");for(let g of h){if(b(g))_(g);else{if(t.if((0,K3.propertyInData)(t,n,g,o.opts.ownProperties)),_(g),!o.allErrors)t.else().var(v,!0);t.endIf()}e.it.definedProperties.add(g),e.ok(v)}function b(g){return o.opts.useDefaults&&!o.compositeRule&&r[g].default!==void 0}function _(g){e.subschema({keyword:"properties",schemaProp:g,dataProp:g},v)}}};W3.default=Vq});var eE=Xe(function(Q3){Object.defineProperty(Q3,"__esModule",{value:!0});var J3=Rn(),Jp=mt(),X3=Mt(),Y3=Mt(),Gq={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,h=(0,J3.allSchemaProperties)(r),v=h.filter((I)=>(0,X3.alwaysValidSchema)(o,r[I]));if(h.length===0||v.length===h.length&&(!o.opts.unevaluated||o.props===!0))return;let b=s.strictSchema&&!s.allowMatchingProperties&&n.properties,_=t.name("valid");if(o.props!==!0&&!(o.props instanceof Jp.Name))o.props=(0,Y3.evaluatedPropsToName)(t,o.props);let{props:g}=o;S();function S(){for(let I of h){if(b)x(I);if(o.allErrors)M(I);else t.var(_,!0),M(I),t.if(_)}}function x(I){for(let T in b)if(new RegExp(I).test(T))(0,X3.checkStrictMode)(o,`property ${T} matches pattern ${I} (use allowMatchingProperties)`)}function M(I){t.forIn("key",i,(T)=>{t.if(Jp._`${(0,J3.usePattern)(e,I)}.test(${T})`,()=>{let P=v.includes(I);if(!P)e.subschema({keyword:"patternProperties",schemaProp:I,dataProp:T,dataPropType:Y3.Type.Str},_);if(o.opts.unevaluated&&g!==!0)t.assign(Jp._`${g}[${T}]`,!0);else if(!P&&!o.allErrors)t.if((0,Jp.not)(_),()=>t.break())})})}}};Q3.default=Gq});var rE=Xe(function(tE){Object.defineProperty(tE,"__esModule",{value:!0});var Xq=Mt(),Yq={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,Xq.alwaysValidSchema)(i,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};tE.default=Yq});var iE=Xe(function(nE){Object.defineProperty(nE,"__esModule",{value:!0});var eB=Rn(),tB={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:eB.validateUnion,error:{message:"must match a schema in anyOf"}};nE.default=tB});var sE=Xe(function(oE){Object.defineProperty(oE,"__esModule",{value:!0});var Xp=mt(),nB=Mt(),iB={message:"must match exactly one schema in oneOf",params:({params:e})=>Xp._`{passingSchemas: ${e.passing}}`},oB={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:iB,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),h=t.let("passing",null),v=t.name("_valid");e.setParams({passing:h}),t.block(b),e.result(s,()=>e.reset(),()=>e.error(!0));function b(){o.forEach((_,g)=>{let S;if((0,nB.alwaysValidSchema)(n,_))t.var(v,!0);else S=e.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},v);if(g>0)t.if(Xp._`${v} && ${s}`).assign(s,!1).assign(h,Xp._`[${h}, ${g}]`).else();t.if(v,()=>{if(t.assign(s,!0),t.assign(h,g),S)e.mergeEvaluated(S,Xp.Name)})})}}};oE.default=oB});var uE=Xe(function(aE){Object.defineProperty(aE,"__esModule",{value:!0});var aB=Mt(),uB={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if((0,aB.alwaysValidSchema)(i,o))return;let h=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(h)})}};aE.default=uB});var fE=Xe(function(dE){Object.defineProperty(dE,"__esModule",{value:!0});var Yp=mt(),cE=Mt(),cB={message:({params:e})=>Yp.str`must match "${e.ifClause}" schema`,params:({params:e})=>Yp._`{failingKeyword: ${e.ifClause}}`},dB={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:cB,code(e){let{gen:t,parentSchema:r,it:i}=e;if(r.then===void 0&&r.else===void 0)(0,cE.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=lE(i,"then"),o=lE(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),h=t.name("_valid");if(v(),e.reset(),n&&o){let _=t.let("ifClause");e.setParams({ifClause:_}),t.if(h,b("then",_),b("else",_))}else if(n)t.if(h,b("then"));else t.if((0,Yp.not)(h),b("else"));e.pass(s,()=>e.error(!0));function v(){let _=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);e.mergeEvaluated(_)}function b(_,g){return()=>{let S=e.subschema({keyword:_},h);if(t.assign(s,h),e.mergeValidEvaluated(S,s),g)t.assign(g,Yp._`${_}`);else e.setParams({ifClause:_})}}}};function lE(e,t){let r=e.schema[t];return r!==void 0&&!(0,cE.alwaysValidSchema)(e,r)}dE.default=dB});var pE=Xe(function(hE){Object.defineProperty(hE,"__esModule",{value:!0});var hB=Mt(),pB={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,hB.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};hE.default=pB});var gE=Xe(function(mE){Object.defineProperty(mE,"__esModule",{value:!0});var gB=c_(),yB=$3(),vB=d_(),bB=C3(),_B=D3(),wB=F3(),SB=H3(),xB=h_(),kB=G3(),MB=eE(),EB=rE(),IB=iE(),TB=sE(),PB=uE(),$B=fE(),AB=pE();function RB(e=!1){let t=[EB.default,IB.default,TB.default,PB.default,$B.default,AB.default,SB.default,xB.default,wB.default,kB.default,MB.default];if(e)t.push(yB.default,bB.default);else t.push(gB.default,vB.default);return t.push(_B.default),t}mE.default=RB});var vE=Xe(function(yE){Object.defineProperty(yE,"__esModule",{value:!0});var tr=mt(),OB={message:({schemaCode:e})=>tr.str`must match format "${e}"`,params:({schemaCode:e})=>tr._`{format: ${e}}`},DB={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:OB,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:h}=e,{opts:v,errSchemaPath:b,schemaEnv:_,self:g}=h;if(!v.validateFormats)return;if(n)S();else x();function S(){let M=r.scopeValue("formats",{ref:g.formats,code:v.code.formats}),I=r.const("fDef",tr._`${M}[${s}]`),T=r.let("fType"),P=r.let("format");r.if(tr._`typeof ${I} == "object" && !(${I} instanceof RegExp)`,()=>r.assign(T,tr._`${I}.type || "string"`).assign(P,tr._`${I}.validate`),()=>r.assign(T,tr._`"string"`).assign(P,I)),e.fail$data((0,tr.or)($(),R()));function $(){if(v.strictSchema===!1)return tr.nil;return tr._`${s} && !${P}`}function R(){let C=_.$async?tr._`(${I}.async ? await ${P}(${i}) : ${P}(${i}))`:tr._`${P}(${i})`,N=tr._`(typeof ${P} == "function" ? ${C} : ${P}.test(${i}))`;return tr._`${P} && ${P} !== true && ${T} === ${t} && !${N}`}}function x(){let M=g.formats[o];if(!M){$();return}if(M===!0)return;let[I,T,P]=R(M);if(I===t)e.pass(C());function $(){if(v.strictSchema===!1){g.logger.warn(N());return}throw Error(N());function N(){return`unknown format "${o}" ignored in schema at path "${b}"`}}function R(N){let B=N instanceof RegExp?(0,tr.regexpCode)(N):v.code.formats?tr._`${v.code.formats}${(0,tr.getProperty)(o)}`:void 0,ie=r.scopeValue("formats",{key:o,ref:N,code:B});if(typeof N=="object"&&!(N instanceof RegExp))return[N.type||"string",N.validate,tr._`${ie}.validate`];return["string",N,ie]}function C(){if(typeof M=="object"&&!(M instanceof RegExp)&&M.async){if(!_.$async)throw Error("async format in sync schema");return tr._`await ${P}(${i})`}return typeof T=="function"?tr._`${P}(${i})`:tr._`${P}.test(${i})`}}}};yE.default=DB});var _E=Xe(function(bE){Object.defineProperty(bE,"__esModule",{value:!0});var zB=vE(),jB=[zB.default];bE.default=jB});var xE=Xe(function(wE){Object.defineProperty(wE,"__esModule",{value:!0});wE.contentVocabulary=wE.metadataVocabulary=void 0;wE.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];wE.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var EE=Xe(function(ME){Object.defineProperty(ME,"__esModule",{value:!0});var FB=W4(),qB=w3(),BB=gE(),HB=_E(),kE=xE(),ZB=[FB.default,qB.default,(0,BB.default)(),HB.default,kE.metadataVocabulary,kE.contentVocabulary];ME.default=ZB});var $E=Xe(function(TE){Object.defineProperty(TE,"__esModule",{value:!0});TE.DiscrError=void 0;var IE;(function(e){e.Tag="tag",e.Mapping="mapping"})(IE||(TE.DiscrError=IE={}))});var CE=Xe(function(RE){Object.defineProperty(RE,"__esModule",{value:!0});var fa=mt(),m_=$E(),AE=Dp(),VB=hc(),WB=Mt(),GB={message:({params:{discrError:e,tagName:t}})=>e===m_.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>fa._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},JB={keyword:"discriminator",type:"object",schemaType:"object",error:GB,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let h=i.propertyName;if(typeof h!="string")throw Error("discriminator: requires propertyName");if(i.mapping)throw Error("discriminator: mapping is not supported");if(!s)throw Error("discriminator: requires oneOf keyword");let v=t.let("valid",!1),b=t.const("tag",fa._`${r}${(0,fa.getProperty)(h)}`);t.if(fa._`typeof ${b} == "string"`,()=>_(),()=>e.error(!1,{discrError:m_.DiscrError.Tag,tag:b,tagName:h})),e.ok(v);function _(){let x=S();t.if(!1);for(let M in x)t.elseIf(fa._`${b} === ${M}`),t.assign(v,g(x[M]));t.else(),e.error(!1,{discrError:m_.DiscrError.Mapping,tag:b,tagName:h}),t.endIf()}function g(x){let M=t.name("valid"),I=e.subschema({keyword:"oneOf",schemaProp:x},M);return e.mergeEvaluated(I,fa.Name),M}function S(){var x;let M={},I=P(n),T=!0;for(let C=0;C<s.length;C++){let N=s[C];if((N===null||N===void 0?void 0:N.$ref)&&!(0,WB.schemaHasRulesButRef)(N,o.self.RULES)){let ie=N.$ref;if(N=AE.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,ie),N instanceof AE.SchemaEnv)N=N.schema;if(N===void 0)throw new VB.default(o.opts.uriResolver,o.baseId,ie)}let B=(x=N===null||N===void 0?void 0:N.properties)===null||x===void 0?void 0:x[h];if(typeof B!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);T=T&&(I||P(N)),$(B,C)}if(!T)throw Error(`discriminator: "${h}" must be required`);return M;function P({required:C}){return Array.isArray(C)&&C.includes(h)}function $(C,N){if(C.const)R(C.const,N);else if(C.enum)for(let B of C.enum)R(B,N);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}function R(C,N){if(typeof C!="string"||C in M)throw Error(`discriminator: "${h}" values must be unique strings`);M[C]=N}}}};RE.default=JB});var OE=Xe(function(F_e,YB){YB.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var y_=Xe(function(ln,g_){Object.defineProperty(ln,"__esModule",{value:!0});ln.MissingRefError=ln.ValidationError=ln.CodeGen=ln.Name=ln.nil=ln.stringify=ln.str=ln._=ln.KeywordCxt=ln.Ajv=void 0;var QB=j4(),eH=EE(),tH=CE(),DE=OE(),rH=["/properties"],Qp="http://json-schema.org/draft-07/schema";class Mc extends QB.default{_addVocabularies(){if(super._addVocabularies(),eH.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(tH.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(DE,rH):DE;this.addMetaSchema(e,Qp,!1),this.refs["http://json-schema.org/schema"]=Qp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Qp)?Qp:void 0)}}ln.Ajv=Mc;g_.exports=ln=Mc;g_.exports.Ajv=Mc;Object.defineProperty(ln,"__esModule",{value:!0});ln.default=Mc;var nH=fc();Object.defineProperty(ln,"KeywordCxt",{enumerable:!0,get:function(){return nH.KeywordCxt}});var ha=mt();Object.defineProperty(ln,"_",{enumerable:!0,get:function(){return ha._}});Object.defineProperty(ln,"str",{enumerable:!0,get:function(){return ha.str}});Object.defineProperty(ln,"stringify",{enumerable:!0,get:function(){return ha.stringify}});Object.defineProperty(ln,"nil",{enumerable:!0,get:function(){return ha.nil}});Object.defineProperty(ln,"Name",{enumerable:!0,get:function(){return ha.Name}});Object.defineProperty(ln,"CodeGen",{enumerable:!0,get:function(){return ha.CodeGen}});var iH=Cp();Object.defineProperty(ln,"ValidationError",{enumerable:!0,get:function(){return iH.default}});var oH=hc();Object.defineProperty(ln,"MissingRefError",{enumerable:!0,get:function(){return oH.default}})});var ZE=Xe(function(BE){Object.defineProperty(BE,"__esModule",{value:!0});BE.formatNames=BE.fastFormats=BE.fullFormats=void 0;function ri(e,t){return{validate:e,compare:t}}BE.fullFormats={date:ri(UE,w_),time:ri(b_(!0),S_),"date-time":ri(NE(!0),FE),"iso-time":ri(b_(),LE),"iso-date-time":ri(NE(),qE),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:hH,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|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-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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,regex:_H,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:pH,int32:{type:"number",validate:yH},int64:{type:"number",validate:vH},float:{type:"number",validate:jE},double:{type:"number",validate:jE},password:!0,binary:!0};BE.fastFormats={...BE.fullFormats,date:ri(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,w_),time:ri(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,S_),"date-time":ri(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,FE),"iso-time":ri(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,LE),"iso-date-time":ri(/^\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,qE),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};BE.formatNames=Object.keys(BE.fullFormats);function uH(e){return e%4===0&&(e%100!==0||e%400===0)}var lH=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,cH=[0,31,28,31,30,31,30,31,31,30,31,30,31];function UE(e){let t=lH.exec(e);if(!t)return!1;let r=+t[1],i=+t[2],n=+t[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&uH(r)?29:cH[i])}function w_(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var v_=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function b_(e){return function(r){let i=v_.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],h=i[4],v=i[5]==="-"?-1:1,b=+(i[6]||0),_=+(i[7]||0);if(b>23||_>59||e&&!h)return!1;if(n<=23&&o<=59&&s<60)return!0;let g=o-_*v,S=n-b*v-(g<0?1:0);return(S===23||S===-1)&&(g===59||g===-1)&&s<61}}function S_(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(!(r&&i))return;return r-i}function LE(e,t){if(!(e&&t))return;let r=v_.exec(e),i=v_.exec(t);if(!(r&&i))return;if(e=r[1]+r[2]+r[3],t=i[1]+i[2]+i[3],e>t)return 1;if(e<t)return-1;return 0}var __=/t|\s/i;function NE(e){let t=b_(e);return function(i){let n=i.split(__);return n.length===2&&UE(n[0])&&t(n[1])}}function FE(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),i=new Date(t).valueOf();if(!(r&&i))return;return r-i}function qE(e,t){if(!(e&&t))return;let[r,i]=e.split(__),[n,o]=t.split(__),s=w_(r,n);if(s===void 0)return;return s||S_(i,o)}var dH=/\/|:/,fH=/^(?:[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;function hH(e){return dH.test(e)&&fH.test(e)}var zE=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function pH(e){return zE.lastIndex=0,zE.test(e)}var mH=-2147483648,gH=2147483647;function yH(e){return Number.isInteger(e)&&e<=gH&&e>=mH}function vH(e){return Number.isInteger(e)}function jE(){return!0}var bH=/[^\\]\\Z/;function _H(e){if(bH.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var VE=Xe(function(KE){Object.defineProperty(KE,"__esModule",{value:!0});KE.formatLimitDefinition=void 0;var SH=y_(),Wn=mt(),uo=Wn.operators,em={formatMaximum:{okStr:"<=",ok:uo.LTE,fail:uo.GT},formatMinimum:{okStr:">=",ok:uo.GTE,fail:uo.LT},formatExclusiveMaximum:{okStr:"<",ok:uo.LT,fail:uo.GTE},formatExclusiveMinimum:{okStr:">",ok:uo.GT,fail:uo.LTE}},xH={message:({keyword:e,schemaCode:t})=>Wn.str`should be ${em[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Wn._`{comparison: ${em[e].okStr}, limit: ${t}}`};KE.formatLimitDefinition={keyword:Object.keys(em),type:"string",schemaType:"string",$data:!0,error:xH,code(e){let{gen:t,data:r,schemaCode:i,keyword:n,it:o}=e,{opts:s,self:h}=o;if(!s.validateFormats)return;let v=new SH.KeywordCxt(o,h.RULES.all.format.definition,"format");if(v.$data)b();else _();function b(){let S=t.scopeValue("formats",{ref:h.formats,code:s.code.formats}),x=t.const("fmt",Wn._`${S}[${v.schemaCode}]`);e.fail$data((0,Wn.or)(Wn._`typeof ${x} != "object"`,Wn._`${x} instanceof RegExp`,Wn._`typeof ${x}.compare != "function"`,g(x)))}function _(){let S=v.schema,x=h.formats[S];if(!x||x===!0)return;if(typeof x!="object"||x instanceof RegExp||typeof x.compare!="function")throw Error(`"${n}": format "${S}" does not define "compare" function`);let M=t.scopeValue("formats",{key:S,ref:x,code:s.code.formats?Wn._`${s.code.formats}${(0,Wn.getProperty)(S)}`:void 0});e.fail$data(g(M))}function g(S){return Wn._`${S}.compare(${r}, ${i}) ${em[n].fail} 0`}},dependencies:["format"]};var kH=(e)=>(e.addKeyword(KE.formatLimitDefinition),e);KE.default=kH});var XE=Xe(function(Ec,JE){Object.defineProperty(Ec,"__esModule",{value:!0});var pa=ZE(),EH=VE(),M_=mt(),WE=new M_.Name("fullFormats"),IH=new M_.Name("fastFormats"),E_=(e,t={keywords:!0})=>{if(Array.isArray(t))return GE(e,t,pa.fullFormats,WE),e;let[r,i]=t.mode==="fast"?[pa.fastFormats,IH]:[pa.fullFormats,WE],n=t.formats||pa.formatNames;if(GE(e,n,r,i),t.keywords)(0,EH.default)(e);return e};E_.get=(e,t="full")=>{let i=(t==="fast"?pa.fastFormats:pa.fullFormats)[e];if(!i)throw Error(`Unknown format "${e}"`);return i};function GE(e,t,r,i){var n,o;(n=(o=e.opts.code).formats)!==null&&n!==void 0||(o.formats=M_._`require("ajv-formats/dist/formats").${i}`);for(let s of t)e.addFormat(s,r[s])}JE.exports=Ec=E_;Object.defineProperty(Ec,"__esModule",{value:!0});Ec.default=E_});var LH=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,FH=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;class On extends Error{}function im(e,t,r){return new Promise((i,n)=>{if(t?.aborted){if(r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i();return}let o=setTimeout((h,v,b)=>{h?.removeEventListener("abort",v),b()},e,t,s,i);function s(){if(clearTimeout(o),r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i()}if(t?.addEventListener("abort",s,{once:!0}),r?.unref)o.unref()})}var{writeFileSync:eme}=(()=>({}));var{realpathSync:tS}=(()=>({}));function b8(){this.__data__=[],this.size=0}var L_=b8;function _8(e,t){return e===t||e!==e&&t!==t}var F_=_8;function w8(e,t){var r=e.length;while(r--)if(F_(e[r][0],t))return r;return-1}var Ai=w8;var S8=Array.prototype,x8=S8.splice;function k8(e){var t=this.__data__,r=Ai(t,e);if(r<0)return!1;var i=t.length-1;if(r==i)t.pop();else x8.call(t,r,1);return--this.size,!0}var q_=k8;function M8(e){var t=this.__data__,r=Ai(t,e);return r<0?void 0:t[r][1]}var B_=M8;function E8(e){return Ai(this.__data__,e)>-1}var H_=E8;function I8(e,t){var r=this.__data__,i=Ai(r,e);if(i<0)++this.size,r.push([e,t]);else r[i][1]=t;return this}var Z_=I8;function Yo(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}Yo.prototype.clear=L_;Yo.prototype.delete=q_;Yo.prototype.get=B_;Yo.prototype.has=H_;Yo.prototype.set=Z_;var K_=Yo;var T8=typeof global=="object"&&global&&global.Object===Object&&global,V_=T8;var P8=typeof self=="object"&&self&&self.Object===Object&&self,$8=V_||P8||Function("return this")(),Qo=$8;var A8=Qo.Symbol,es=A8;var W_=Object.prototype,R8=W_.hasOwnProperty,C8=W_.toString,ya=es?es.toStringTag:void 0;function O8(e){var t=R8.call(e,ya),r=e[ya];try{e[ya]=void 0;var i=!0}catch(o){}var n=C8.call(e);if(i)if(t)e[ya]=r;else delete e[ya];return n}var G_=O8;var D8=Object.prototype,N8=D8.toString;function z8(e){return N8.call(e)}var J_=z8;var j8="[object Null]",U8="[object Undefined]",X_=es?es.toStringTag:void 0;function L8(e){if(e==null)return e===void 0?U8:j8;return X_&&X_ in Object(e)?G_(e):J_(e)}var Y_=L8;function F8(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Tc=F8;var q8="[object AsyncFunction]",B8="[object Function]",H8="[object GeneratorFunction]",Z8="[object Proxy]";function K8(e){if(!Tc(e))return!1;var t=Y_(e);return t==B8||t==H8||t==q8||t==Z8}var Q_=K8;var V8=Qo["__core-js_shared__"],Pc=V8;var e1=function(){var e=/[^.]+$/.exec(Pc&&Pc.keys&&Pc.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function W8(e){return!!e1&&e1 in e}var t1=W8;var G8=Function.prototype,J8=G8.toString;function X8(e){if(e!=null){try{return J8.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var r1=X8;var Y8=/[\\^$.*+?()[\]{}|]/g,Q8=/^\[object .+?Constructor\]$/,eI=Function.prototype,tI=Object.prototype,rI=eI.toString,nI=tI.hasOwnProperty,iI=RegExp("^"+rI.call(nI).replace(Y8,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function oI(e){if(!Tc(e)||t1(e))return!1;var t=Q_(e)?iI:Q8;return t.test(r1(e))}var n1=oI;function sI(e,t){return e==null?void 0:e[t]}var i1=sI;function aI(e,t){var r=i1(e,t);return n1(r)?r:void 0}var $c=aI;var uI=$c(Qo,"Map"),o1=uI;var lI=$c(Object,"create"),ni=lI;function cI(){this.__data__=ni?ni(null):{},this.size=0}var s1=cI;function dI(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var a1=dI;var fI="__lodash_hash_undefined__",hI=Object.prototype,pI=hI.hasOwnProperty;function mI(e){var t=this.__data__;if(ni){var r=t[e];return r===fI?void 0:r}return pI.call(t,e)?t[e]:void 0}var u1=mI;var gI=Object.prototype,yI=gI.hasOwnProperty;function vI(e){var t=this.__data__;return ni?t[e]!==void 0:yI.call(t,e)}var l1=vI;var bI="__lodash_hash_undefined__";function _I(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ni&&t===void 0?bI:t,this}var c1=_I;function ts(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}ts.prototype.clear=s1;ts.prototype.delete=a1;ts.prototype.get=u1;ts.prototype.has=l1;ts.prototype.set=c1;var om=ts;function wI(){this.size=0,this.__data__={hash:new om,map:new(o1||K_),string:new om}}var d1=wI;function SI(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var f1=SI;function xI(e,t){var r=e.__data__;return f1(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Ri=xI;function kI(e){var t=Ri(this,e).delete(e);return this.size-=t?1:0,t}var h1=kI;function MI(e){return Ri(this,e).get(e)}var p1=MI;function EI(e){return Ri(this,e).has(e)}var m1=EI;function II(e,t){var r=Ri(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var g1=II;function rs(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}rs.prototype.clear=d1;rs.prototype.delete=h1;rs.prototype.get=p1;rs.prototype.has=m1;rs.prototype.set=g1;var sm=rs;var TI="Expected a function";function am(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(TI);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=e.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(am.Cache||sm),r}am.Cache=sm;var Mr=am;var y1=function(){return"/"};var va=()=>globalThis.crypto.randomUUID();Kr();Kr();var Jw="[\\w-]{1,63}",SA=new RegExp(`^${Jw}$`),eV=new RegExp(`^a(?:${Jw}-)?[0-9a-f]{16}$`);function Xw(e,t){let r=Buffer.from(t.replace(/-/g,""),"hex"),i=Bm("sha1").update(r).update(Buffer.from(e,"utf8")).digest();i[6]=i[6]&15|80,i[8]=i[8]&63|128;let n=i.subarray(0,16).toString("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var xA="3ab19d7e-9f35-45c2-926e-75e271cc60b3";function Yw(){let e=process.env.CLAUDE_CODE_REMOTE_SESSION_ID?.trim();return e?Xw(e,xA):null}var Qw=globalThis.process?.getBuiltinModule?.("async_hooks"),Hm=Qw?(e)=>Qw.AsyncResource.bind(e):(e)=>e;function yo(e){if(!e)return!1;if(typeof e==="boolean")return e;let t=String(e).toLowerCase().trim();return["1","true","yes","on"].includes(t)}function zi(){let e=new Set;return{subscribe(t){let r=Hm(t);return e.add(r),()=>{e.delete(r)}},emit(...t){let r;for(let i of e)try{i(...t)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){e.clear()}}}function eS(){return{sent:new Set,rejected:new Set}}var MA={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};function EA(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof tS==="function"){let r=y1();try{e=rS(tS(r))}catch{e=rS(r)}}return{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),sessionLogicalStartTime:void 0,lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:e,modelUsage:{},mainLoopModelOverride:void 0,refusalFallbackOccurred:!1,refusalFallbackHeaderArmed:!1,refusalFallbackLatchOriginRequestId:void 0,refusalFallbackModelLatch:void 0,sdkDialogHostActive:!1,sdkSupportedDialogKinds:void 0,sdkSupportedDialogKindsSource:void 0,replConfigArgv:[],settingsEffortAtStartup:void 0,initialMainLoopModel:void 0,resolvedOrgDefault:void 0,modelStrings:null,isInteractive:!1,printOutputFormat:null,thinkingDisplayExplicit:!1,permissionPromptToolName:void 0,attacherCaps:null,hasStreamingInput:!1,singleShotPrintSession:!1,modelOverrideOptOutForSession:!1,rendererMode:void 0,strictToolResultPairing:!1,memoryToggledOff:!1,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,searchToolsOptIn:!1,clientType:"cli",sessionStartType:"fresh",questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,oauthTokenFromBgSnapshot:!1,oauthScopesFromFd:void 0,apiKeyFromFd:void 0,gatewayAuth:null,gatewayRefreshInFlight:null,startupPolicySnapshot:void 0,flagSettingsPath:void 0,flagSettingsExpectedContent:void 0,flagSettingsInline:null,parentManagedSettings:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:Yw()??va(),mainAgentId:null,parentSessionId:void 0,loggerProvider:null,eventLogger:null,eventLoggerOwner:null,pendingOTelEvents:[],otelWindowCloseCause:null,hostOtel:{rateTokens:null,rateLastRefillMs:null,featureOkLogged:!1,reportedDropReasons:new Set},meterProvider:null,tracerProvider:null,cachedTelemetryResource:null,cachedOtlpHttpAgentFactory:{direct:null,proxied:null},foundryDeploymentCapabilities:new Map,agentColorMap:new Map,lastAPIRequest:null,lastCancelledAPIMessageId:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],inlinePluginsNoMcp:[],inlinePluginUrls:[],syncedPluginDirs:[],chromeFlagOverride:void 0,teammateAgentId:void 0,onboardingShownThisSession:!1,useCoworkPlugins:!1,disableSlashCommands:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionCronTasks:[],loopChainStartedAt:Object.create(null),loopTickInFlightPrompt:null,loopConsecutiveKeepalives:0,loopEnded:!1,sessionCreatedTeams:new Set,surfacedHookSpawnFailures:new Set,humanAttachmentDigests:new Map,bareMcpServerMatchersWarned:new Set,inheritedTeamName:void 0,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,longContext1mCreditsBlocked:!1,fableCreditsRequired:!1,fableConsentSessionFallback:!1,fableBridgeDialogTimedOut:!1,fableConsentDialogInteracted:!1,sdkOAuthTokenRefreshCallback:null,hostAuthTokenRefreshCallback:null,mainThreadAgentType:void 0,mainThreadAgentHooks:void 0,sessionSkillAllowlist:void 0,caps:MA,replBridgeActive:!1,mainLoopBusy:!1,directConnectServerUrl:void 0,mcpConnectNonBlocking:!1,backgroundAutoModeSetupInFlight:!1,deferredToolStubGateLatch:null,strictMcpConfig:!1,cliSessionConfigCarried:!1,forkRestrictedLaunchConfig:!1,forkReplayLaunchConfig:{},sessionApprovedMcpServers:[],activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,stickyBetas:eS(),thinkingTypeOverrides:new Map,perTurnEffortPins:new Map,effortUnsupportedModels:new Set,midConvCachePromotionRejected:!1,perTurnEffortOkEmitted:!1,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var IA=EA(),TA=()=>{return};function Zm(){return TA()?.sessionId??IA.sessionId}var PA=zi(),zV=PA.subscribe;function rS(e){return process.platform==="darwin"?e.normalize("NFC"):e}var $A=zi(),jV=$A.subscribe;var AA=zi(),UV=AA.subscribe;var RA=zi();var LV=RA.subscribe;var CA=zi();var FV=CA.subscribe;var{appendFile:V2,mkdir:vC,rename:W2,stat:bC,symlink:_C,unlink:Cv}=(()=>({}));Nn();function cS({writeFn:e,flushIntervalMs:t=1000,maxBufferSize:r=100,maxBufferBytes:i=1/0,immediateMode:n=!1}){let o=[],s=0,h=null,v=null;function b(){if(h)clearTimeout(h),h=null}function _(M){try{e(M)}catch{}}function g(){if(v)_(v.join("")),v=null;if(o.length===0)return;_(o.join("")),o=[],s=0,b()}function S(){if(!h)h=setTimeout(g,t)}function x(){if(v){v.push(...o),o=[],s=0,b();return}let M=o;o=[],s=0,b(),v=M,setImmediate(()=>{let I=v;if(v=null,I)_(I.join(""))})}return{write(M){if(n){_(M);return}if(o.push(M),s+=M.length,S(),o.length>=r||s>=i)x()},flush:g,dispose(){g()}}}var{realpathSync:KV}=(()=>({}));var Gc=function(){return"/"};Nn();function Jc(e){return process.platform==="darwin"?e.normalize("NFC"):e}function Gm(e){return/^[\\/]{2}/.test(e)}function fS(e){return/(^|[\\/])\.{1,2}([\\/]|$)/.test(e)}function hS(e){if(!e.startsWith("/"))return null;let t=[];for(let r of e.split("/")){if(r===""||r===".")continue;if(r===".."){t.pop();continue}if(t.push(r),t.length===2&&t[0].toLowerCase()==="net")return"/"+t.join("/")}return null}function Jm(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function NA(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function pS(e){if(/^\\\\\?\\volume\{/i.test(e))return dS(e);let t=NA(e);if(t!==e&&dS(t))return!0;return Gm(t)&&!Jm(t)}function dS(e){return fS(e)||e.includes("/")}function zA(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class Xm{#e=new Set;register(e){let t=zA(e);this.#e.add(t);let r=()=>{this.#e.delete(t)};return Object.assign(r,{[Symbol.dispose]:r})}async drain(){let e=Array.from(this.#e);this.#e.clear(),await Promise.all(e.map(async(t)=>t()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#e.size}}var jA=new Xm;function mS(e){return jA.register(e)}var JV=new Xm;var gS=Mr((e)=>{if(!e||e.trim()==="")return null;let t=e.split(",").map((o)=>o.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some((o)=>o.startsWith("!")),i=t.some((o)=>!o.startsWith("!"));if(r&&i)return null;let n=t.map((o)=>o.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}});function UA(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let o=e.match(/^([^:[]+):/);if(o&&o[1])t.push(o[1].trim().toLowerCase())}let i=e.match(/^\[([^\]]+)]/);if(i&&i[1])t.push(i[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let n=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let o=n[1].trim().toLowerCase();if(o.length<30&&!o.includes(" "))t.push(o)}return Array.from(new Set(t))}function LA(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((r)=>t.exclude.includes(r));else return e.some((r)=>t.include.includes(r))}function yS(e,t){if(!t)return!0;let r=UA(e);return LA(r,t)}Nn();var Fe={};wn(Fe,{xid:()=>L9,void:()=>a5,uuidv7:()=>C9,uuidv6:()=>R9,uuidv4:()=>A9,uuid:()=>$9,url:()=>O9,uppercase:()=>vu,unknown:()=>qt,union:()=>Dt,undefined:()=>o5,ulid:()=>U9,uint64:()=>n5,uint32:()=>e5,tuple:()=>d5,trim:()=>ku,treeifyError:()=>ed,transform:()=>Uy,toUpperCase:()=>Eu,toLowerCase:()=>Mu,toJSONSchema:()=>xs,templateLiteral:()=>_5,symbol:()=>i5,superRefine:()=>Mx,success:()=>v5,stringbool:()=>x5,stringFormat:()=>J9,string:()=>de,strictObject:()=>c5,startsWith:()=>_u,size:()=>mu,setErrorMap:()=>E5,set:()=>p5,safeParseAsync:()=>my,safeParse:()=>py,registry:()=>Va,regexes:()=>Fi,regex:()=>gu,refine:()=>kx,record:()=>Nt,readonly:()=>vx,property:()=>oy,promise:()=>w5,prettifyError:()=>td,preprocess:()=>Xf,prefault:()=>dx,positive:()=>ty,pipe:()=>Hf,partialRecord:()=>f5,parseAsync:()=>hy,parse:()=>fy,overwrite:()=>pi,optional:()=>Lt,object:()=>Qe,number:()=>It,nullish:()=>y5,nullable:()=>Bf,null:()=>Zf,normalize:()=>xu,nonpositive:()=>ny,nonoptional:()=>fx,nonnegative:()=>iy,never:()=>Kf,negative:()=>ry,nativeEnum:()=>m5,nanoid:()=>N9,nan:()=>b5,multipleOf:()=>Eo,minSize:()=>Io,minLength:()=>Hi,mime:()=>Su,maxSize:()=>_s,maxLength:()=>ws,map:()=>h5,lte:()=>kn,lt:()=>fi,lowercase:()=>yu,looseObject:()=>Lr,locales:()=>vs,literal:()=>tt,length:()=>Ss,lazy:()=>wx,ksuid:()=>F9,keyof:()=>l5,jwt:()=>G9,json:()=>k5,iso:()=>ks,ipv6:()=>B9,ipv4:()=>q9,intersection:()=>Cu,int64:()=>r5,int32:()=>Q9,int:()=>gy,instanceof:()=>S5,includes:()=>bu,guid:()=>P9,gte:()=>rn,gt:()=>hi,globalRegistry:()=>tn,getErrorMap:()=>I5,function:()=>Nf,formatError:()=>fs,float64:()=>Y9,float32:()=>X9,flattenError:()=>ds,file:()=>g5,enum:()=>Vr,endsWith:()=>wu,emoji:()=>D9,email:()=>T9,e164:()=>W9,discriminatedUnion:()=>Gf,date:()=>u5,custom:()=>By,cuid2:()=>j9,cuid:()=>z9,core:()=>zn,config:()=>Qt,coerce:()=>Hy,clone:()=>Ur,cidrv6:()=>Z9,cidrv4:()=>H9,check:()=>xx,catch:()=>mx,boolean:()=>rr,bigint:()=>t5,base64url:()=>V9,base64:()=>K9,array:()=>bt,any:()=>s5,_default:()=>lx,_ZodString:()=>yy,ZodXID:()=>My,ZodVoid:()=>YS,ZodUnknown:()=>JS,ZodUnion:()=>Ny,ZodUndefined:()=>VS,ZodUUID:()=>mi,ZodURL:()=>by,ZodULID:()=>ky,ZodType:()=>yt,ZodTuple:()=>rx,ZodTransform:()=>jy,ZodTemplateLiteral:()=>bx,ZodSymbol:()=>KS,ZodSuccess:()=>hx,ZodStringFormat:()=>Ut,ZodString:()=>Pu,ZodSet:()=>ix,ZodRecord:()=>zy,ZodRealError:()=>Ms,ZodReadonly:()=>yx,ZodPromise:()=>Sx,ZodPrefault:()=>cx,ZodPipe:()=>qy,ZodOptional:()=>Ly,ZodObject:()=>Wf,ZodNumberFormat:()=>Es,ZodNumber:()=>$u,ZodNullable:()=>ax,ZodNull:()=>WS,ZodNonOptional:()=>Fy,ZodNever:()=>XS,ZodNanoID:()=>wy,ZodNaN:()=>gx,ZodMap:()=>nx,ZodLiteral:()=>ox,ZodLazy:()=>_x,ZodKSUID:()=>Ey,ZodJWT:()=>Oy,ZodIssueCode:()=>M5,ZodIntersection:()=>tx,ZodISOTime:()=>Lf,ZodISODuration:()=>Ff,ZodISODateTime:()=>jf,ZodISODate:()=>Uf,ZodIPv6:()=>Ty,ZodIPv4:()=>Iy,ZodGUID:()=>qf,ZodFile:()=>sx,ZodError:()=>E9,ZodEnum:()=>Tu,ZodEmoji:()=>_y,ZodEmail:()=>vy,ZodE164:()=>Cy,ZodDiscriminatedUnion:()=>ex,ZodDefault:()=>ux,ZodDate:()=>Vf,ZodCustomStringFormat:()=>ZS,ZodCustom:()=>Jf,ZodCatch:()=>px,ZodCUID2:()=>xy,ZodCUID:()=>Sy,ZodCIDRv6:()=>$y,ZodCIDRv4:()=>Py,ZodBoolean:()=>Au,ZodBigIntFormat:()=>Dy,ZodBigInt:()=>Ru,ZodBase64URL:()=>Ry,ZodBase64:()=>Ay,ZodArray:()=>QS,ZodAny:()=>GS,TimePrecision:()=>ff,NEVER:()=>Xc,$output:()=>lf,$input:()=>cf,$brand:()=>Yc});var zn={};wn(zn,{version:()=>t0,util:()=>Be,treeifyError:()=>ed,toJSONSchema:()=>xs,toDotPath:()=>_S,safeParseAsync:()=>Li,safeParse:()=>Ui,registry:()=>Va,regexes:()=>Fi,prettifyError:()=>td,parseAsync:()=>So,parse:()=>wo,locales:()=>vs,isValidJWT:()=>jS,isValidBase64URL:()=>zS,isValidBase64:()=>a0,globalRegistry:()=>tn,globalConfig:()=>Ra,function:()=>Nf,formatError:()=>fs,flattenError:()=>ds,config:()=>Qt,clone:()=>Ur,_xid:()=>ou,_void:()=>Tf,_uuidv7:()=>Ya,_uuidv6:()=>Xa,_uuidv4:()=>Ja,_uuid:()=>Ga,_url:()=>Qa,_uppercase:()=>vu,_unknown:()=>Mo,_union:()=>i9,_undefined:()=>kf,_ulid:()=>iu,_uint64:()=>Sf,_uint32:()=>vf,_tuple:()=>sy,_trim:()=>ku,_transform:()=>h9,_toUpperCase:()=>Eu,_toLowerCase:()=>Mu,_templateLiteral:()=>S9,_symbol:()=>xf,_success:()=>v9,_stringbool:()=>Of,_stringFormat:()=>Df,_string:()=>df,_startsWith:()=>_u,_size:()=>mu,_set:()=>l9,_safeParseAsync:()=>od,_safeParse:()=>id,_regex:()=>gu,_refine:()=>Cf,_record:()=>a9,_readonly:()=>w9,_property:()=>oy,_promise:()=>k9,_positive:()=>ty,_pipe:()=>_9,_parseAsync:()=>nd,_parse:()=>rd,_overwrite:()=>pi,_optional:()=>p9,_number:()=>hf,_nullable:()=>m9,_null:()=>Mf,_normalize:()=>xu,_nonpositive:()=>ny,_nonoptional:()=>y9,_nonnegative:()=>iy,_never:()=>If,_negative:()=>ry,_nativeEnum:()=>d9,_nanoid:()=>tu,_nan:()=>$f,_multipleOf:()=>Eo,_minSize:()=>Io,_minLength:()=>Hi,_min:()=>rn,_mime:()=>Su,_maxSize:()=>_s,_maxLength:()=>ws,_max:()=>kn,_map:()=>u9,_lte:()=>kn,_lt:()=>fi,_lowercase:()=>yu,_literal:()=>f9,_length:()=>Ss,_lazy:()=>x9,_ksuid:()=>su,_jwt:()=>pu,_isoTime:()=>G0,_isoDuration:()=>J0,_isoDateTime:()=>V0,_isoDate:()=>W0,_ipv6:()=>uu,_ipv4:()=>au,_intersection:()=>s9,_int64:()=>wf,_int32:()=>yf,_int:()=>pf,_includes:()=>bu,_guid:()=>bs,_gte:()=>rn,_gt:()=>hi,_float64:()=>gf,_float32:()=>mf,_file:()=>Af,_enum:()=>c9,_endsWith:()=>wu,_emoji:()=>eu,_email:()=>Wa,_e164:()=>hu,_discriminatedUnion:()=>o9,_default:()=>g9,_date:()=>Pf,_custom:()=>Rf,_cuid2:()=>nu,_cuid:()=>ru,_coercedString:()=>K0,_coercedNumber:()=>X0,_coercedDate:()=>ey,_coercedBoolean:()=>Y0,_coercedBigint:()=>Q0,_cidrv6:()=>cu,_cidrv4:()=>lu,_catch:()=>b9,_boolean:()=>bf,_bigint:()=>_f,_base64url:()=>fu,_base64:()=>du,_array:()=>Iu,_any:()=>Ef,TimePrecision:()=>ff,NEVER:()=>Xc,JSONSchemaGenerator:()=>zf,JSONSchema:()=>qS,Doc:()=>ld,$output:()=>lf,$input:()=>cf,$constructor:()=>ne,$brand:()=>Yc,$ZodXID:()=>wd,$ZodVoid:()=>Ud,$ZodUnknown:()=>ko,$ZodUnion:()=>Ha,$ZodUndefined:()=>Dd,$ZodUUID:()=>hd,$ZodURL:()=>md,$ZodULID:()=>_d,$ZodType:()=>ut,$ZodTuple:()=>Bi,$ZodTransform:()=>gs,$ZodTemplateLiteral:()=>of,$ZodSymbol:()=>Od,$ZodSuccess:()=>ef,$ZodStringFormat:()=>Ot,$ZodString:()=>qi,$ZodSet:()=>Zd,$ZodRegistry:()=>Ka,$ZodRecord:()=>Bd,$ZodRealError:()=>cs,$ZodReadonly:()=>nf,$ZodPromise:()=>sf,$ZodPrefault:()=>Yd,$ZodPipe:()=>ys,$ZodOptional:()=>Gd,$ZodObject:()=>Ba,$ZodNumberFormat:()=>Rd,$ZodNumber:()=>Fa,$ZodNullable:()=>Jd,$ZodNull:()=>Nd,$ZodNonOptional:()=>Qd,$ZodNever:()=>jd,$ZodNanoID:()=>yd,$ZodNaN:()=>rf,$ZodMap:()=>Hd,$ZodLiteral:()=>Vd,$ZodLazy:()=>af,$ZodKSUID:()=>Sd,$ZodJWT:()=>$d,$ZodIntersection:()=>qd,$ZodISOTime:()=>o0,$ZodISODuration:()=>s0,$ZodISODateTime:()=>n0,$ZodISODate:()=>i0,$ZodIPv6:()=>kd,$ZodIPv4:()=>xd,$ZodGUID:()=>fd,$ZodFunction:()=>ay,$ZodFile:()=>Wd,$ZodError:()=>La,$ZodEnum:()=>Kd,$ZodEmoji:()=>gd,$ZodEmail:()=>pd,$ZodE164:()=>Pd,$ZodDiscriminatedUnion:()=>Fd,$ZodDefault:()=>Xd,$ZodDate:()=>Ld,$ZodCustomStringFormat:()=>Ad,$ZodCustom:()=>uf,$ZodCheckUpperCase:()=>Wg,$ZodCheckStringFormat:()=>hs,$ZodCheckStartsWith:()=>Jg,$ZodCheckSizeEquals:()=>qg,$ZodCheckRegex:()=>Kg,$ZodCheckProperty:()=>Yg,$ZodCheckOverwrite:()=>e0,$ZodCheckNumberFormat:()=>jg,$ZodCheckMultipleOf:()=>zg,$ZodCheckMinSize:()=>Fg,$ZodCheckMinLength:()=>Hg,$ZodCheckMimeType:()=>Qg,$ZodCheckMaxSize:()=>Lg,$ZodCheckMaxLength:()=>Bg,$ZodCheckLowerCase:()=>Vg,$ZodCheckLessThan:()=>ad,$ZodCheckLengthEquals:()=>Zg,$ZodCheckIncludes:()=>Gg,$ZodCheckGreaterThan:()=>ud,$ZodCheckEndsWith:()=>Xg,$ZodCheckBigIntFormat:()=>Ug,$ZodCheck:()=>Ht,$ZodCatch:()=>tf,$ZodCUID2:()=>bd,$ZodCUID:()=>vd,$ZodCIDRv6:()=>Ed,$ZodCIDRv4:()=>Md,$ZodBoolean:()=>ps,$ZodBigIntFormat:()=>Cd,$ZodBigInt:()=>qa,$ZodBase64URL:()=>Td,$ZodBase64:()=>Id,$ZodAsyncError:()=>ci,$ZodArray:()=>ms,$ZodAny:()=>zd});var Xc=Object.freeze({status:"aborted"});function ne(e,t,r){function i(h,v){var b;Object.defineProperty(h,"_zod",{value:h._zod??{},enumerable:!1}),(b=h._zod).traits??(b.traits=new Set),h._zod.traits.add(e),t(h,v);for(let _ in s.prototype)if(!(_ in h))Object.defineProperty(h,_,{value:s.prototype[_].bind(h)});h._zod.constr=s,h._zod.def=v}let n=r?.Parent??Object;class o extends n{}Object.defineProperty(o,"name",{value:e});function s(h){var v;let b=r?.Parent?new o:this;i(b,h),(v=b._zod).deferred??(v.deferred=[]);for(let _ of b._zod.deferred)_();return b}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:(h)=>{if(r?.Parent&&h instanceof r.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var Yc=Symbol("zod_brand");class ci extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var Ra={};function Qt(e){if(e)Object.assign(Ra,e);return Ra}var Be={};wn(Be,{unwrapMessage:()=>Ca,stringifyPrimitive:()=>Ve,required:()=>nR,randomString:()=>WA,propertyKeyTypes:()=>za,promiseAllObject:()=>VA,primitiveTypes:()=>ng,prefixIssues:()=>en,pick:()=>YA,partial:()=>rR,optionalKeys:()=>ig,omit:()=>QA,numKeys:()=>GA,nullish:()=>ji,normalizeParams:()=>qe,merge:()=>tR,jsonStringifyReplacer:()=>Qm,joinValues:()=>be,issue:()=>ag,isPlainObject:()=>ls,isObject:()=>us,getSizableOrigin:()=>ja,getParsedType:()=>JA,getLengthableOrigin:()=>Ua,getEnumValues:()=>Oa,getElementAtPath:()=>KA,floatSafeRemainder:()=>eg,finalizeIssue:()=>fn,extend:()=>eR,escapeRegex:()=>di,esc:()=>bo,defineLazy:()=>Tt,createTransparentProxy:()=>XA,clone:()=>Ur,cleanRegex:()=>Na,cleanEnum:()=>iR,captureStackTrace:()=>Qc,cached:()=>Da,assignProp:()=>tg,assertNotEqual:()=>qA,assertNever:()=>HA,assertIs:()=>BA,assertEqual:()=>FA,assert:()=>ZA,allowsEval:()=>rg,aborted:()=>_o,NUMBER_FORMAT_RANGES:()=>og,Class:()=>vS,BIGINT_FORMAT_RANGES:()=>sg});function FA(e){return e}function qA(e){return e}function BA(e){}function HA(e){throw Error()}function ZA(e){}function Oa(e){let t=Object.values(e).filter((i)=>typeof i==="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function be(e,t="|"){return e.map((r)=>Ve(r)).join(t)}function Qm(e,t){if(typeof t==="bigint")return t.toString();return t}function Da(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function ji(e){return e===null||e===void 0}function Na(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function eg(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return o%s/10**n}function Tt(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function tg(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function KA(e,t){if(!t)return e;return t.reduce((r,i)=>r?.[i],e)}function VA(e){let t=Object.keys(e),r=t.map((i)=>e[i]);return Promise.all(r).then((i)=>{let n={};for(let o=0;o<t.length;o++)n[t[o]]=i[o];return n})}function WA(e=10){let r="";for(let i=0;i<e;i++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function bo(e){return JSON.stringify(e)}var Qc=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function us(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var rg=Da(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ls(e){if(us(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;if(us(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function GA(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var JA=(e)=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},za=new Set(["string","number","symbol"]),ng=new Set(["string","number","bigint","boolean","symbol","undefined"]);function di(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ur(e,t,r){let i=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)i._zod.parent=e;return i}function qe(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function XA(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,o){return t??(t=e()),Reflect.set(t,i,n,o)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function Ve(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ig(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var og={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},sg={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function YA(e,t){let r={},i=e._zod.def;for(let n in t){if(!(n in i.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;r[n]=i.shape[n]}return Ur(e,{...e._zod.def,shape:r,checks:[]})}function QA(e,t){let r={...e._zod.def.shape},i=e._zod.def;for(let n in t){if(!(n in i.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;delete r[n]}return Ur(e,{...e._zod.def,shape:r,checks:[]})}function eR(e,t){if(!ls(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let i={...e._zod.def.shape,...t};return tg(this,"shape",i),i},checks:[]};return Ur(e,r)}function tR(e,t){return Ur(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return tg(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function rR(e,t,r){let i=t._zod.def.shape,n={...i};if(r)for(let o in r){if(!(o in i))throw Error(`Unrecognized key: "${o}"`);if(!r[o])continue;n[o]=e?new e({type:"optional",innerType:i[o]}):i[o]}else for(let o in i)n[o]=e?new e({type:"optional",innerType:i[o]}):i[o];return Ur(t,{...t._zod.def,shape:n,checks:[]})}function nR(e,t,r){let i=t._zod.def.shape,n={...i};if(r)for(let o in r){if(!(o in n))throw Error(`Unrecognized key: "${o}"`);if(!r[o])continue;n[o]=new e({type:"nonoptional",innerType:i[o]})}else for(let o in i)n[o]=new e({type:"nonoptional",innerType:i[o]});return Ur(t,{...t._zod.def,shape:n,checks:[]})}function _o(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function en(e,t){return t.map((r)=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Ca(e){return typeof e==="string"?e:e?.message}function fn(e,t,r){let i={...e,path:e.path??[]};if(!e.message){let n=Ca(e.inst?._zod.def?.error?.(e))??Ca(t?.error?.(e))??Ca(r.customError?.(e))??Ca(r.localeError?.(e))??"Invalid input";i.message=n}if(delete i.inst,delete i.continue,!t?.reportInput)delete i.input;return i}function ja(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function Ua(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ag(...e){let[t,r,i]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:i};return{...t}}function iR(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}class vS{constructor(...e){}}var bS=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Qm,2)},enumerable:!0})},La=ne("$ZodError",bS),cs=ne("$ZodError",bS,{Parent:Error});function ds(e,t=(r)=>r.message){let r={},i=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else i.push(t(n));return{formErrors:i,fieldErrors:r}}function fs(e,t){let r=t||function(o){return o.message},i={_errors:[]},n=(o)=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((h)=>n({issues:h}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)i._errors.push(r(s));else{let h=i,v=0;while(v<s.path.length){let b=s.path[v];if(v!==s.path.length-1)h[b]=h[b]||{_errors:[]};else h[b]=h[b]||{_errors:[]},h[b]._errors.push(r(s));h=h[b],v++}}};return n(e),i}function ed(e,t){let r=t||function(o){return o.message},i={errors:[]},n=(o,s=[])=>{var h,v;for(let b of o.issues)if(b.code==="invalid_union"&&b.errors.length)b.errors.map((_)=>n({issues:_},b.path));else if(b.code==="invalid_key")n({issues:b.issues},b.path);else if(b.code==="invalid_element")n({issues:b.issues},b.path);else{let _=[...s,...b.path];if(_.length===0){i.errors.push(r(b));continue}let g=i,S=0;while(S<_.length){let x=_[S],M=S===_.length-1;if(typeof x==="string")g.properties??(g.properties={}),(h=g.properties)[x]??(h[x]={errors:[]}),g=g.properties[x];else g.items??(g.items=[]),(v=g.items)[x]??(v[x]={errors:[]}),g=g.items[x];if(M)g.errors.push(r(b));S++}}};return n(e),i}function _S(e){let t=[];for(let r of e)if(typeof r==="number")t.push(`[${r}]`);else if(typeof r==="symbol")t.push(`[${JSON.stringify(String(r))}]`);else if(/[^\w$]/.test(r))t.push(`[${JSON.stringify(r)}]`);else{if(t.length)t.push(".");t.push(r)}return t.join("")}function td(e){let t=[],r=[...e.issues].sort((i,n)=>i.path.length-n.path.length);for(let i of r)if(t.push(`✖ ${i.message}`),i.path?.length)t.push(` → at ${_S(i.path)}`);return t.join(`
26
+ deps: ${r}}`};var Oq={keyword:"dependencies",type:"object",schemaType:"object",error:j3.error,code(e){let[t,r]=Dq(e);N3(e,t),z3(e,r)}};function Dq({schema:e}){let t={},r={};for(let i in e){if(i==="__proto__")continue;let n=Array.isArray(e[i])?t:r;n[i]=e[i]}return[t,r]}function N3(e,t=e.schema){let{gen:r,data:i,it:n}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let s in t){let h=t[s];if(h.length===0)continue;let v=(0,kc.propertyInData)(r,i,s,n.opts.ownProperties);if(e.setParams({property:s,depsCount:h.length,deps:h.join(", ")}),n.allErrors)r.if(v,()=>{for(let b of h)(0,kc.checkReportMissingProp)(e,b)});else r.if(f_._`${v} && (${(0,kc.checkMissingProp)(e,h,o)})`),(0,kc.reportMissingProp)(e,o),r.else()}}j3.validatePropertyDeps=N3;function z3(e,t=e.schema){let{gen:r,data:i,keyword:n,it:o}=e,s=r.name("valid");for(let h in t){if((0,Cq.alwaysValidSchema)(o,t[h]))continue;r.if((0,kc.propertyInData)(r,i,h,o.opts.ownProperties),()=>{let v=e.subschema({keyword:n,schemaProp:h},s);e.mergeValidEvaluated(v,s)},()=>r.var(s,!0)),e.ok(s)}}j3.validateSchemaDeps=z3;j3.default=Oq});var H3=Xe(function(B3){Object.defineProperty(B3,"__esModule",{value:!0});var q3=mt(),jq=Mt(),Uq={message:"property name must be valid",params:({params:e})=>q3._`{propertyName: ${e.propertyName}}`},Lq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Uq,code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,jq.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",i,(s)=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),t.if((0,q3.not)(o),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(o)}};B3.default=Lq});var h_=Xe(function(Z3){Object.defineProperty(Z3,"__esModule",{value:!0});var Wp=Rn(),Vn=mt(),qq=Ii(),Gp=Mt(),Bq={message:"must NOT have additional properties",params:({params:e})=>Vn._`{additionalProperty: ${e.additionalProperty}}`},Hq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Bq,code(e){let{gen:t,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=e;if(!o)throw Error("ajv implementation error");let{allErrors:h,opts:v}=s;if(s.props=!0,v.removeAdditional!=="all"&&(0,Gp.alwaysValidSchema)(s,r))return;let b=(0,Wp.allSchemaProperties)(i.properties),_=(0,Wp.allSchemaProperties)(i.patternProperties);g(),e.ok(Vn._`${o} === ${qq.default.errors}`);function g(){t.forIn("key",n,(T)=>{if(!b.length&&!_.length)M(T);else t.if(S(T),()=>M(T))})}function S(T){let P;if(b.length>8){let $=(0,Gp.schemaRefOrVal)(s,i.properties,"properties");P=(0,Wp.isOwnProperty)(t,$,T)}else if(b.length)P=(0,Vn.or)(...b.map(($)=>Vn._`${T} === ${$}`));else P=Vn.nil;if(_.length)P=(0,Vn.or)(P,..._.map(($)=>Vn._`${(0,Wp.usePattern)(e,$)}.test(${T})`));return(0,Vn.not)(P)}function x(T){t.code(Vn._`delete ${n}[${T}]`)}function M(T){if(v.removeAdditional==="all"||v.removeAdditional&&r===!1){x(T);return}if(r===!1){if(e.setParams({additionalProperty:T}),e.error(),!h)t.break();return}if(typeof r=="object"&&!(0,Gp.alwaysValidSchema)(s,r)){let P=t.name("valid");if(v.removeAdditional==="failing")I(T,P,!1),t.if((0,Vn.not)(P),()=>{e.reset(),x(T)});else if(I(T,P),!h)t.if((0,Vn.not)(P),()=>t.break())}}function I(T,P,$){let R={keyword:"additionalProperties",dataProp:T,dataPropType:Gp.Type.Str};if($===!1)Object.assign(R,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(R,P)}}};Z3.default=Hq});var G3=Xe(function(W3){Object.defineProperty(W3,"__esModule",{value:!0});var Kq=fc(),K3=Rn(),p_=Mt(),V3=h_(),Vq={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:i,data:n,it:o}=e;if(o.opts.removeAdditional==="all"&&i.additionalProperties===void 0)V3.default.code(new Kq.KeywordCxt(o,V3.default,"additionalProperties"));let s=(0,K3.allSchemaProperties)(r);for(let g of s)o.definedProperties.add(g);if(o.opts.unevaluated&&s.length&&o.props!==!0)o.props=p_.mergeEvaluated.props(t,(0,p_.toHash)(s),o.props);let h=s.filter((g)=>!(0,p_.alwaysValidSchema)(o,r[g]));if(h.length===0)return;let v=t.name("valid");for(let g of h){if(b(g))_(g);else{if(t.if((0,K3.propertyInData)(t,n,g,o.opts.ownProperties)),_(g),!o.allErrors)t.else().var(v,!0);t.endIf()}e.it.definedProperties.add(g),e.ok(v)}function b(g){return o.opts.useDefaults&&!o.compositeRule&&r[g].default!==void 0}function _(g){e.subschema({keyword:"properties",schemaProp:g,dataProp:g},v)}}};W3.default=Vq});var eE=Xe(function(Q3){Object.defineProperty(Q3,"__esModule",{value:!0});var J3=Rn(),Jp=mt(),X3=Mt(),Y3=Mt(),Gq={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:i,parentSchema:n,it:o}=e,{opts:s}=o,h=(0,J3.allSchemaProperties)(r),v=h.filter((I)=>(0,X3.alwaysValidSchema)(o,r[I]));if(h.length===0||v.length===h.length&&(!o.opts.unevaluated||o.props===!0))return;let b=s.strictSchema&&!s.allowMatchingProperties&&n.properties,_=t.name("valid");if(o.props!==!0&&!(o.props instanceof Jp.Name))o.props=(0,Y3.evaluatedPropsToName)(t,o.props);let{props:g}=o;S();function S(){for(let I of h){if(b)x(I);if(o.allErrors)M(I);else t.var(_,!0),M(I),t.if(_)}}function x(I){for(let T in b)if(new RegExp(I).test(T))(0,X3.checkStrictMode)(o,`property ${T} matches pattern ${I} (use allowMatchingProperties)`)}function M(I){t.forIn("key",i,(T)=>{t.if(Jp._`${(0,J3.usePattern)(e,I)}.test(${T})`,()=>{let P=v.includes(I);if(!P)e.subschema({keyword:"patternProperties",schemaProp:I,dataProp:T,dataPropType:Y3.Type.Str},_);if(o.opts.unevaluated&&g!==!0)t.assign(Jp._`${g}[${T}]`,!0);else if(!P&&!o.allErrors)t.if((0,Jp.not)(_),()=>t.break())})})}}};Q3.default=Gq});var rE=Xe(function(tE){Object.defineProperty(tE,"__esModule",{value:!0});var Xq=Mt(),Yq={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:i}=e;if((0,Xq.alwaysValidSchema)(i,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};tE.default=Yq});var iE=Xe(function(nE){Object.defineProperty(nE,"__esModule",{value:!0});var eB=Rn(),tB={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:eB.validateUnion,error:{message:"must match a schema in anyOf"}};nE.default=tB});var sE=Xe(function(oE){Object.defineProperty(oE,"__esModule",{value:!0});var Xp=mt(),nB=Mt(),iB={message:"must match exactly one schema in oneOf",params:({params:e})=>Xp._`{passingSchemas: ${e.passing}}`},oB={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:iB,code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=t.let("valid",!1),h=t.let("passing",null),v=t.name("_valid");e.setParams({passing:h}),t.block(b),e.result(s,()=>e.reset(),()=>e.error(!0));function b(){o.forEach((_,g)=>{let S;if((0,nB.alwaysValidSchema)(n,_))t.var(v,!0);else S=e.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},v);if(g>0)t.if(Xp._`${v} && ${s}`).assign(s,!1).assign(h,Xp._`[${h}, ${g}]`).else();t.if(v,()=>{if(t.assign(s,!0),t.assign(h,g),S)e.mergeEvaluated(S,Xp.Name)})})}}};oE.default=oB});var uE=Xe(function(aE){Object.defineProperty(aE,"__esModule",{value:!0});var aB=Mt(),uB={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:i}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((o,s)=>{if((0,aB.alwaysValidSchema)(i,o))return;let h=e.subschema({keyword:"allOf",schemaProp:s},n);e.ok(n),e.mergeEvaluated(h)})}};aE.default=uB});var fE=Xe(function(dE){Object.defineProperty(dE,"__esModule",{value:!0});var Yp=mt(),cE=Mt(),cB={message:({params:e})=>Yp.str`must match "${e.ifClause}" schema`,params:({params:e})=>Yp._`{failingKeyword: ${e.ifClause}}`},dB={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:cB,code(e){let{gen:t,parentSchema:r,it:i}=e;if(r.then===void 0&&r.else===void 0)(0,cE.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=lE(i,"then"),o=lE(i,"else");if(!n&&!o)return;let s=t.let("valid",!0),h=t.name("_valid");if(v(),e.reset(),n&&o){let _=t.let("ifClause");e.setParams({ifClause:_}),t.if(h,b("then",_),b("else",_))}else if(n)t.if(h,b("then"));else t.if((0,Yp.not)(h),b("else"));e.pass(s,()=>e.error(!0));function v(){let _=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);e.mergeEvaluated(_)}function b(_,g){return()=>{let S=e.subschema({keyword:_},h);if(t.assign(s,h),e.mergeValidEvaluated(S,s),g)t.assign(g,Yp._`${_}`);else e.setParams({ifClause:_})}}}};function lE(e,t){let r=e.schema[t];return r!==void 0&&!(0,cE.alwaysValidSchema)(e,r)}dE.default=dB});var pE=Xe(function(hE){Object.defineProperty(hE,"__esModule",{value:!0});var hB=Mt(),pB={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,hB.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};hE.default=pB});var gE=Xe(function(mE){Object.defineProperty(mE,"__esModule",{value:!0});var gB=c_(),yB=$3(),vB=d_(),bB=C3(),_B=D3(),wB=F3(),SB=H3(),xB=h_(),kB=G3(),MB=eE(),EB=rE(),IB=iE(),TB=sE(),PB=uE(),$B=fE(),AB=pE();function RB(e=!1){let t=[EB.default,IB.default,TB.default,PB.default,$B.default,AB.default,SB.default,xB.default,wB.default,kB.default,MB.default];if(e)t.push(yB.default,bB.default);else t.push(gB.default,vB.default);return t.push(_B.default),t}mE.default=RB});var vE=Xe(function(yE){Object.defineProperty(yE,"__esModule",{value:!0});var tr=mt(),OB={message:({schemaCode:e})=>tr.str`must match format "${e}"`,params:({schemaCode:e})=>tr._`{format: ${e}}`},DB={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:OB,code(e,t){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:h}=e,{opts:v,errSchemaPath:b,schemaEnv:_,self:g}=h;if(!v.validateFormats)return;if(n)S();else x();function S(){let M=r.scopeValue("formats",{ref:g.formats,code:v.code.formats}),I=r.const("fDef",tr._`${M}[${s}]`),T=r.let("fType"),P=r.let("format");r.if(tr._`typeof ${I} == "object" && !(${I} instanceof RegExp)`,()=>r.assign(T,tr._`${I}.type || "string"`).assign(P,tr._`${I}.validate`),()=>r.assign(T,tr._`"string"`).assign(P,I)),e.fail$data((0,tr.or)($(),R()));function $(){if(v.strictSchema===!1)return tr.nil;return tr._`${s} && !${P}`}function R(){let C=_.$async?tr._`(${I}.async ? await ${P}(${i}) : ${P}(${i}))`:tr._`${P}(${i})`,N=tr._`(typeof ${P} == "function" ? ${C} : ${P}.test(${i}))`;return tr._`${P} && ${P} !== true && ${T} === ${t} && !${N}`}}function x(){let M=g.formats[o];if(!M){$();return}if(M===!0)return;let[I,T,P]=R(M);if(I===t)e.pass(C());function $(){if(v.strictSchema===!1){g.logger.warn(N());return}throw Error(N());function N(){return`unknown format "${o}" ignored in schema at path "${b}"`}}function R(N){let B=N instanceof RegExp?(0,tr.regexpCode)(N):v.code.formats?tr._`${v.code.formats}${(0,tr.getProperty)(o)}`:void 0,ie=r.scopeValue("formats",{key:o,ref:N,code:B});if(typeof N=="object"&&!(N instanceof RegExp))return[N.type||"string",N.validate,tr._`${ie}.validate`];return["string",N,ie]}function C(){if(typeof M=="object"&&!(M instanceof RegExp)&&M.async){if(!_.$async)throw Error("async format in sync schema");return tr._`await ${P}(${i})`}return typeof T=="function"?tr._`${P}(${i})`:tr._`${P}.test(${i})`}}}};yE.default=DB});var _E=Xe(function(bE){Object.defineProperty(bE,"__esModule",{value:!0});var zB=vE(),jB=[zB.default];bE.default=jB});var xE=Xe(function(wE){Object.defineProperty(wE,"__esModule",{value:!0});wE.contentVocabulary=wE.metadataVocabulary=void 0;wE.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];wE.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var EE=Xe(function(ME){Object.defineProperty(ME,"__esModule",{value:!0});var FB=W4(),qB=w3(),BB=gE(),HB=_E(),kE=xE(),ZB=[FB.default,qB.default,(0,BB.default)(),HB.default,kE.metadataVocabulary,kE.contentVocabulary];ME.default=ZB});var $E=Xe(function(TE){Object.defineProperty(TE,"__esModule",{value:!0});TE.DiscrError=void 0;var IE;(function(e){e.Tag="tag",e.Mapping="mapping"})(IE||(TE.DiscrError=IE={}))});var CE=Xe(function(RE){Object.defineProperty(RE,"__esModule",{value:!0});var fa=mt(),m_=$E(),AE=Dp(),VB=hc(),WB=Mt(),GB={message:({params:{discrError:e,tagName:t}})=>e===m_.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>fa._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},JB={keyword:"discriminator",type:"object",schemaType:"object",error:GB,code(e){let{gen:t,data:r,schema:i,parentSchema:n,it:o}=e,{oneOf:s}=n;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let h=i.propertyName;if(typeof h!="string")throw Error("discriminator: requires propertyName");if(i.mapping)throw Error("discriminator: mapping is not supported");if(!s)throw Error("discriminator: requires oneOf keyword");let v=t.let("valid",!1),b=t.const("tag",fa._`${r}${(0,fa.getProperty)(h)}`);t.if(fa._`typeof ${b} == "string"`,()=>_(),()=>e.error(!1,{discrError:m_.DiscrError.Tag,tag:b,tagName:h})),e.ok(v);function _(){let x=S();t.if(!1);for(let M in x)t.elseIf(fa._`${b} === ${M}`),t.assign(v,g(x[M]));t.else(),e.error(!1,{discrError:m_.DiscrError.Mapping,tag:b,tagName:h}),t.endIf()}function g(x){let M=t.name("valid"),I=e.subschema({keyword:"oneOf",schemaProp:x},M);return e.mergeEvaluated(I,fa.Name),M}function S(){var x;let M={},I=P(n),T=!0;for(let C=0;C<s.length;C++){let N=s[C];if((N===null||N===void 0?void 0:N.$ref)&&!(0,WB.schemaHasRulesButRef)(N,o.self.RULES)){let ie=N.$ref;if(N=AE.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,ie),N instanceof AE.SchemaEnv)N=N.schema;if(N===void 0)throw new VB.default(o.opts.uriResolver,o.baseId,ie)}let B=(x=N===null||N===void 0?void 0:N.properties)===null||x===void 0?void 0:x[h];if(typeof B!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);T=T&&(I||P(N)),$(B,C)}if(!T)throw Error(`discriminator: "${h}" must be required`);return M;function P({required:C}){return Array.isArray(C)&&C.includes(h)}function $(C,N){if(C.const)R(C.const,N);else if(C.enum)for(let B of C.enum)R(B,N);else throw Error(`discriminator: "properties/${h}" must have "const" or "enum"`)}function R(C,N){if(typeof C!="string"||C in M)throw Error(`discriminator: "${h}" values must be unique strings`);M[C]=N}}}};RE.default=JB});var OE=Xe(function(H_e,YB){YB.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var y_=Xe(function(ln,g_){Object.defineProperty(ln,"__esModule",{value:!0});ln.MissingRefError=ln.ValidationError=ln.CodeGen=ln.Name=ln.nil=ln.stringify=ln.str=ln._=ln.KeywordCxt=ln.Ajv=void 0;var QB=j4(),eH=EE(),tH=CE(),DE=OE(),rH=["/properties"],Qp="http://json-schema.org/draft-07/schema";class Mc extends QB.default{_addVocabularies(){if(super._addVocabularies(),eH.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(tH.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(DE,rH):DE;this.addMetaSchema(e,Qp,!1),this.refs["http://json-schema.org/schema"]=Qp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Qp)?Qp:void 0)}}ln.Ajv=Mc;g_.exports=ln=Mc;g_.exports.Ajv=Mc;Object.defineProperty(ln,"__esModule",{value:!0});ln.default=Mc;var nH=fc();Object.defineProperty(ln,"KeywordCxt",{enumerable:!0,get:function(){return nH.KeywordCxt}});var ha=mt();Object.defineProperty(ln,"_",{enumerable:!0,get:function(){return ha._}});Object.defineProperty(ln,"str",{enumerable:!0,get:function(){return ha.str}});Object.defineProperty(ln,"stringify",{enumerable:!0,get:function(){return ha.stringify}});Object.defineProperty(ln,"nil",{enumerable:!0,get:function(){return ha.nil}});Object.defineProperty(ln,"Name",{enumerable:!0,get:function(){return ha.Name}});Object.defineProperty(ln,"CodeGen",{enumerable:!0,get:function(){return ha.CodeGen}});var iH=Cp();Object.defineProperty(ln,"ValidationError",{enumerable:!0,get:function(){return iH.default}});var oH=hc();Object.defineProperty(ln,"MissingRefError",{enumerable:!0,get:function(){return oH.default}})});var ZE=Xe(function(BE){Object.defineProperty(BE,"__esModule",{value:!0});BE.formatNames=BE.fastFormats=BE.fullFormats=void 0;function ri(e,t){return{validate:e,compare:t}}BE.fullFormats={date:ri(UE,w_),time:ri(b_(!0),S_),"date-time":ri(NE(!0),FE),"iso-time":ri(b_(),LE),"iso-date-time":ri(NE(),qE),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:hH,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|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-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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,regex:_H,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:pH,int32:{type:"number",validate:yH},int64:{type:"number",validate:vH},float:{type:"number",validate:jE},double:{type:"number",validate:jE},password:!0,binary:!0};BE.fastFormats={...BE.fullFormats,date:ri(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,w_),time:ri(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,S_),"date-time":ri(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,FE),"iso-time":ri(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,LE),"iso-date-time":ri(/^\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,qE),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};BE.formatNames=Object.keys(BE.fullFormats);function uH(e){return e%4===0&&(e%100!==0||e%400===0)}var lH=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,cH=[0,31,28,31,30,31,30,31,31,30,31,30,31];function UE(e){let t=lH.exec(e);if(!t)return!1;let r=+t[1],i=+t[2],n=+t[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&uH(r)?29:cH[i])}function w_(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var v_=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function b_(e){return function(r){let i=v_.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],h=i[4],v=i[5]==="-"?-1:1,b=+(i[6]||0),_=+(i[7]||0);if(b>23||_>59||e&&!h)return!1;if(n<=23&&o<=59&&s<60)return!0;let g=o-_*v,S=n-b*v-(g<0?1:0);return(S===23||S===-1)&&(g===59||g===-1)&&s<61}}function S_(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(!(r&&i))return;return r-i}function LE(e,t){if(!(e&&t))return;let r=v_.exec(e),i=v_.exec(t);if(!(r&&i))return;if(e=r[1]+r[2]+r[3],t=i[1]+i[2]+i[3],e>t)return 1;if(e<t)return-1;return 0}var __=/t|\s/i;function NE(e){let t=b_(e);return function(i){let n=i.split(__);return n.length===2&&UE(n[0])&&t(n[1])}}function FE(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),i=new Date(t).valueOf();if(!(r&&i))return;return r-i}function qE(e,t){if(!(e&&t))return;let[r,i]=e.split(__),[n,o]=t.split(__),s=w_(r,n);if(s===void 0)return;return s||S_(i,o)}var dH=/\/|:/,fH=/^(?:[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;function hH(e){return dH.test(e)&&fH.test(e)}var zE=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function pH(e){return zE.lastIndex=0,zE.test(e)}var mH=-2147483648,gH=2147483647;function yH(e){return Number.isInteger(e)&&e<=gH&&e>=mH}function vH(e){return Number.isInteger(e)}function jE(){return!0}var bH=/[^\\]\\Z/;function _H(e){if(bH.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var VE=Xe(function(KE){Object.defineProperty(KE,"__esModule",{value:!0});KE.formatLimitDefinition=void 0;var SH=y_(),Wn=mt(),uo=Wn.operators,em={formatMaximum:{okStr:"<=",ok:uo.LTE,fail:uo.GT},formatMinimum:{okStr:">=",ok:uo.GTE,fail:uo.LT},formatExclusiveMaximum:{okStr:"<",ok:uo.LT,fail:uo.GTE},formatExclusiveMinimum:{okStr:">",ok:uo.GT,fail:uo.LTE}},xH={message:({keyword:e,schemaCode:t})=>Wn.str`should be ${em[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Wn._`{comparison: ${em[e].okStr}, limit: ${t}}`};KE.formatLimitDefinition={keyword:Object.keys(em),type:"string",schemaType:"string",$data:!0,error:xH,code(e){let{gen:t,data:r,schemaCode:i,keyword:n,it:o}=e,{opts:s,self:h}=o;if(!s.validateFormats)return;let v=new SH.KeywordCxt(o,h.RULES.all.format.definition,"format");if(v.$data)b();else _();function b(){let S=t.scopeValue("formats",{ref:h.formats,code:s.code.formats}),x=t.const("fmt",Wn._`${S}[${v.schemaCode}]`);e.fail$data((0,Wn.or)(Wn._`typeof ${x} != "object"`,Wn._`${x} instanceof RegExp`,Wn._`typeof ${x}.compare != "function"`,g(x)))}function _(){let S=v.schema,x=h.formats[S];if(!x||x===!0)return;if(typeof x!="object"||x instanceof RegExp||typeof x.compare!="function")throw Error(`"${n}": format "${S}" does not define "compare" function`);let M=t.scopeValue("formats",{key:S,ref:x,code:s.code.formats?Wn._`${s.code.formats}${(0,Wn.getProperty)(S)}`:void 0});e.fail$data(g(M))}function g(S){return Wn._`${S}.compare(${r}, ${i}) ${em[n].fail} 0`}},dependencies:["format"]};var kH=(e)=>(e.addKeyword(KE.formatLimitDefinition),e);KE.default=kH});var XE=Xe(function(Ec,JE){Object.defineProperty(Ec,"__esModule",{value:!0});var pa=ZE(),EH=VE(),M_=mt(),WE=new M_.Name("fullFormats"),IH=new M_.Name("fastFormats"),E_=(e,t={keywords:!0})=>{if(Array.isArray(t))return GE(e,t,pa.fullFormats,WE),e;let[r,i]=t.mode==="fast"?[pa.fastFormats,IH]:[pa.fullFormats,WE],n=t.formats||pa.formatNames;if(GE(e,n,r,i),t.keywords)(0,EH.default)(e);return e};E_.get=(e,t="full")=>{let i=(t==="fast"?pa.fastFormats:pa.fullFormats)[e];if(!i)throw Error(`Unknown format "${e}"`);return i};function GE(e,t,r,i){var n,o;(n=(o=e.opts.code).formats)!==null&&n!==void 0||(o.formats=M_._`require("ajv-formats/dist/formats").${i}`);for(let s of t)e.addFormat(s,r[s])}JE.exports=Ec=E_;Object.defineProperty(Ec,"__esModule",{value:!0});Ec.default=E_});var LH=typeof String.prototype.isWellFormed==="function"?Function.prototype.call.bind(String.prototype.isWellFormed):void 0,FH=typeof String.prototype.toWellFormed==="function"?Function.prototype.call.bind(String.prototype.toWellFormed):void 0;class On extends Error{}function im(e,t,r){return new Promise((i,n)=>{if(t?.aborted){if(r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i();return}let o=setTimeout((h,v,b)=>{h?.removeEventListener("abort",v),b()},e,t,s,i);function s(){if(clearTimeout(o),r?.throwOnAbort||r?.abortError)n(r.abortError?.()??Error("aborted"));else i()}if(t?.addEventListener("abort",s,{once:!0}),r?.unref)o.unref()})}var{writeFileSync:nme}=(()=>({}));var{realpathSync:tS}=(()=>({}));function b8(){this.__data__=[],this.size=0}var L_=b8;function _8(e,t){return e===t||e!==e&&t!==t}var F_=_8;function w8(e,t){var r=e.length;while(r--)if(F_(e[r][0],t))return r;return-1}var Ai=w8;var S8=Array.prototype,x8=S8.splice;function k8(e){var t=this.__data__,r=Ai(t,e);if(r<0)return!1;var i=t.length-1;if(r==i)t.pop();else x8.call(t,r,1);return--this.size,!0}var q_=k8;function M8(e){var t=this.__data__,r=Ai(t,e);return r<0?void 0:t[r][1]}var B_=M8;function E8(e){return Ai(this.__data__,e)>-1}var H_=E8;function I8(e,t){var r=this.__data__,i=Ai(r,e);if(i<0)++this.size,r.push([e,t]);else r[i][1]=t;return this}var Z_=I8;function Yo(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}Yo.prototype.clear=L_;Yo.prototype.delete=q_;Yo.prototype.get=B_;Yo.prototype.has=H_;Yo.prototype.set=Z_;var K_=Yo;var T8=typeof global=="object"&&global&&global.Object===Object&&global,V_=T8;var P8=typeof self=="object"&&self&&self.Object===Object&&self,$8=V_||P8||Function("return this")(),Qo=$8;var A8=Qo.Symbol,es=A8;var W_=Object.prototype,R8=W_.hasOwnProperty,C8=W_.toString,ya=es?es.toStringTag:void 0;function O8(e){var t=R8.call(e,ya),r=e[ya];try{e[ya]=void 0;var i=!0}catch(o){}var n=C8.call(e);if(i)if(t)e[ya]=r;else delete e[ya];return n}var G_=O8;var D8=Object.prototype,N8=D8.toString;function z8(e){return N8.call(e)}var J_=z8;var j8="[object Null]",U8="[object Undefined]",X_=es?es.toStringTag:void 0;function L8(e){if(e==null)return e===void 0?U8:j8;return X_&&X_ in Object(e)?G_(e):J_(e)}var Y_=L8;function F8(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Tc=F8;var q8="[object AsyncFunction]",B8="[object Function]",H8="[object GeneratorFunction]",Z8="[object Proxy]";function K8(e){if(!Tc(e))return!1;var t=Y_(e);return t==B8||t==H8||t==q8||t==Z8}var Q_=K8;var V8=Qo["__core-js_shared__"],Pc=V8;var e1=function(){var e=/[^.]+$/.exec(Pc&&Pc.keys&&Pc.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function W8(e){return!!e1&&e1 in e}var t1=W8;var G8=Function.prototype,J8=G8.toString;function X8(e){if(e!=null){try{return J8.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var r1=X8;var Y8=/[\\^$.*+?()[\]{}|]/g,Q8=/^\[object .+?Constructor\]$/,eI=Function.prototype,tI=Object.prototype,rI=eI.toString,nI=tI.hasOwnProperty,iI=RegExp("^"+rI.call(nI).replace(Y8,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function oI(e){if(!Tc(e)||t1(e))return!1;var t=Q_(e)?iI:Q8;return t.test(r1(e))}var n1=oI;function sI(e,t){return e==null?void 0:e[t]}var i1=sI;function aI(e,t){var r=i1(e,t);return n1(r)?r:void 0}var $c=aI;var uI=$c(Qo,"Map"),o1=uI;var lI=$c(Object,"create"),ni=lI;function cI(){this.__data__=ni?ni(null):{},this.size=0}var s1=cI;function dI(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var a1=dI;var fI="__lodash_hash_undefined__",hI=Object.prototype,pI=hI.hasOwnProperty;function mI(e){var t=this.__data__;if(ni){var r=t[e];return r===fI?void 0:r}return pI.call(t,e)?t[e]:void 0}var u1=mI;var gI=Object.prototype,yI=gI.hasOwnProperty;function vI(e){var t=this.__data__;return ni?t[e]!==void 0:yI.call(t,e)}var l1=vI;var bI="__lodash_hash_undefined__";function _I(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ni&&t===void 0?bI:t,this}var c1=_I;function ts(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}ts.prototype.clear=s1;ts.prototype.delete=a1;ts.prototype.get=u1;ts.prototype.has=l1;ts.prototype.set=c1;var om=ts;function wI(){this.size=0,this.__data__={hash:new om,map:new(o1||K_),string:new om}}var d1=wI;function SI(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var f1=SI;function xI(e,t){var r=e.__data__;return f1(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Ri=xI;function kI(e){var t=Ri(this,e).delete(e);return this.size-=t?1:0,t}var h1=kI;function MI(e){return Ri(this,e).get(e)}var p1=MI;function EI(e){return Ri(this,e).has(e)}var m1=EI;function II(e,t){var r=Ri(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var g1=II;function rs(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var i=e[t];this.set(i[0],i[1])}}rs.prototype.clear=d1;rs.prototype.delete=h1;rs.prototype.get=p1;rs.prototype.has=m1;rs.prototype.set=g1;var sm=rs;var TI="Expected a function";function am(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw TypeError(TI);var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=e.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(am.Cache||sm),r}am.Cache=sm;var Mr=am;var y1=function(){return"/"};var va=()=>globalThis.crypto.randomUUID();Kr();Kr();var Jw="[\\w-]{1,63}",SA=new RegExp(`^${Jw}$`),eV=new RegExp(`^a(?:${Jw}-)?[0-9a-f]{16}$`);function Xw(e,t){let r=Buffer.from(t.replace(/-/g,""),"hex"),i=Bm("sha1").update(r).update(Buffer.from(e,"utf8")).digest();i[6]=i[6]&15|80,i[8]=i[8]&63|128;let n=i.subarray(0,16).toString("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var xA="3ab19d7e-9f35-45c2-926e-75e271cc60b3";function Yw(){let e=process.env.CLAUDE_CODE_REMOTE_SESSION_ID?.trim();return e?Xw(e,xA):null}var Qw=globalThis.process?.getBuiltinModule?.("async_hooks"),Hm=Qw?(e)=>Qw.AsyncResource.bind(e):(e)=>e;function yo(e){if(!e)return!1;if(typeof e==="boolean")return e;let t=String(e).toLowerCase().trim();return["1","true","yes","on"].includes(t)}function zi(){let e=new Set;return{subscribe(t){let r=Hm(t);return e.add(r),()=>{e.delete(r)}},emit(...t){let r;for(let i of e)try{i(...t)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){e.clear()}}}function eS(){return{sent:new Set,rejected:new Set}}var MA={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};function EA(){let e="";if(typeof process<"u"&&typeof process.cwd==="function"&&typeof tS==="function"){let r=y1();try{e=rS(tS(r))}catch{e=rS(r)}}return{originalCwd:e,projectRoot:e,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),sessionLogicalStartTime:void 0,lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:e,modelUsage:{},mainLoopModelOverride:void 0,refusalFallbackOccurred:!1,refusalFallbackHeaderArmed:!1,refusalFallbackLatchOriginRequestId:void 0,refusalFallbackModelLatch:void 0,sdkDialogHostActive:!1,sdkSupportedDialogKinds:void 0,sdkSupportedDialogKindsSource:void 0,replConfigArgv:[],settingsEffortAtStartup:void 0,initialMainLoopModel:void 0,resolvedOrgDefault:void 0,modelStrings:null,isInteractive:!1,printOutputFormat:null,thinkingDisplayExplicit:!1,permissionPromptToolName:void 0,attacherCaps:null,hasStreamingInput:!1,singleShotPrintSession:!1,modelOverrideOptOutForSession:!1,rendererMode:void 0,strictToolResultPairing:!1,memoryToggledOff:!1,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,searchToolsOptIn:!1,clientType:"cli",sessionStartType:"fresh",questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,oauthTokenFromBgSnapshot:!1,oauthScopesFromFd:void 0,apiKeyFromFd:void 0,gatewayAuth:null,gatewayRefreshInFlight:null,startupPolicySnapshot:void 0,flagSettingsPath:void 0,flagSettingsExpectedContent:void 0,flagSettingsInline:null,parentManagedSettings:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:Yw()??va(),mainAgentId:null,parentSessionId:void 0,loggerProvider:null,eventLogger:null,eventLoggerOwner:null,pendingOTelEvents:[],otelWindowCloseCause:null,hostOtel:{rateTokens:null,rateLastRefillMs:null,featureOkLogged:!1,reportedDropReasons:new Set},meterProvider:null,tracerProvider:null,cachedTelemetryResource:null,cachedOtlpHttpAgentFactory:{direct:null,proxied:null},foundryDeploymentCapabilities:new Map,agentColorMap:new Map,lastAPIRequest:null,lastCancelledAPIMessageId:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],inlinePluginsNoMcp:[],inlinePluginUrls:[],syncedPluginDirs:[],chromeFlagOverride:void 0,teammateAgentId:void 0,onboardingShownThisSession:!1,useCoworkPlugins:!1,disableSlashCommands:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionCronTasks:[],loopChainStartedAt:Object.create(null),loopTickInFlightPrompt:null,loopConsecutiveKeepalives:0,loopEnded:!1,sessionCreatedTeams:new Set,surfacedHookSpawnFailures:new Set,humanAttachmentDigests:new Map,bareMcpServerMatchersWarned:new Set,pendingPrLinks:new Set,inheritedTeamName:void 0,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,longContext1mCreditsBlocked:!1,fableCreditsRequired:!1,fableConsentSessionFallback:!1,fableBridgeDialogTimedOut:!1,fableConsentDialogInteracted:!1,sdkOAuthTokenRefreshCallback:null,hostAuthTokenRefreshCallback:null,mainThreadAgentType:void 0,mainThreadAgentHooks:void 0,sessionSkillAllowlist:void 0,caps:MA,replBridgeActive:!1,mainLoopBusy:!1,directConnectServerUrl:void 0,mcpConnectNonBlocking:!1,backgroundAutoModeSetupInFlight:!1,deferredToolStubGateLatch:null,strictMcpConfig:!1,cliSessionConfigCarried:!1,forkRestrictedLaunchConfig:!1,forkReplayLaunchConfig:{},sessionApprovedMcpServers:[],activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,stickyBetas:eS(),thinkingTypeOverrides:new Map,perTurnEffortPins:new Map,effortUnsupportedModels:new Set,midConvCachePromotionRejected:!1,perTurnEffortOkEmitted:!1,inferenceProfileBackingModels:new Map,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastMainThreadCacheTtlMs:null,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}var IA=EA(),TA=()=>{return};function Zm(){return TA()?.sessionId??IA.sessionId}var PA=zi(),zV=PA.subscribe;function rS(e){return process.platform==="darwin"?e.normalize("NFC"):e}var $A=zi(),jV=$A.subscribe;var AA=zi(),UV=AA.subscribe;var RA=zi();var LV=RA.subscribe;var CA=zi();var FV=CA.subscribe;var{appendFile:V2,mkdir:vC,rename:W2,stat:bC,symlink:_C,unlink:Cv}=(()=>({}));Nn();function cS({writeFn:e,flushIntervalMs:t=1000,maxBufferSize:r=100,maxBufferBytes:i=1/0,immediateMode:n=!1}){let o=[],s=0,h=null,v=null;function b(){if(h)clearTimeout(h),h=null}function _(M){try{e(M)}catch{}}function g(){if(v)_(v.join("")),v=null;if(o.length===0)return;_(o.join("")),o=[],s=0,b()}function S(){if(!h)h=setTimeout(g,t)}function x(){if(v){v.push(...o),o=[],s=0,b();return}let M=o;o=[],s=0,b(),v=M,setImmediate(()=>{let I=v;if(v=null,I)_(I.join(""))})}return{write(M){if(n){_(M);return}if(o.push(M),s+=M.length,S(),o.length>=r||s>=i)x()},flush:g,dispose(){g()}}}var{realpathSync:KV}=(()=>({}));var Gc=function(){return"/"};Nn();function Jc(e){return process.platform==="darwin"?e.normalize("NFC"):e}function Gm(e){return/^[\\/]{2}/.test(e)}function fS(e){return/(^|[\\/])\.{1,2}([\\/]|$)/.test(e)}function hS(e){if(!e.startsWith("/"))return null;let t=[];for(let r of e.split("/")){if(r===""||r===".")continue;if(r===".."){t.pop();continue}if(t.push(r),t.length===2&&t[0].toLowerCase()==="net")return"/"+t.join("/")}return null}function Jm(e){return/^[\\/]{2}wsl(\$|\.localhost)[\\/]/i.test(e)}function NA(e){if(e.startsWith("\\\\?\\UNC\\"))return"\\\\"+e.slice(8);if(e.startsWith("\\\\?\\")&&e.length>=7&&e[5]===":")return e.slice(4);return e}function pS(e){if(/^\\\\\?\\volume\{/i.test(e))return dS(e);let t=NA(e);if(t!==e&&dS(t))return!0;return Gm(t)&&!Jm(t)}function dS(e){return fS(e)||e.includes("/")}function zA(e){if(typeof e==="function")return e;if(Symbol.asyncDispose in e)return()=>e[Symbol.asyncDispose]();return()=>e[Symbol.dispose]()}class Xm{#e=new Set;register(e){let t=zA(e);this.#e.add(t);let r=()=>{this.#e.delete(t)};return Object.assign(r,{[Symbol.dispose]:r})}async drain(){let e=Array.from(this.#e);this.#e.clear(),await Promise.all(e.map(async(t)=>t()))}async[Symbol.asyncDispose](){await this.drain()}get sizeForTesting(){return this.#e.size}}var jA=new Xm;function mS(e){return jA.register(e)}var JV=new Xm;var gS=Mr((e)=>{if(!e||e.trim()==="")return null;let t=e.split(",").map((o)=>o.trim()).filter(Boolean);if(t.length===0)return null;let r=t.some((o)=>o.startsWith("!")),i=t.some((o)=>!o.startsWith("!"));if(r&&i)return null;let n=t.map((o)=>o.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}});function UA(e){let t=[],r=e.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])t.push("mcp"),t.push(r[1].toLowerCase());else{let o=e.match(/^([^:[]+):/);if(o&&o[1])t.push(o[1].trim().toLowerCase())}let i=e.match(/^\[([^\]]+)]/);if(i&&i[1])t.push(i[1].trim().toLowerCase());if(e.toLowerCase().includes("1p event:"))t.push("1p");let n=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let o=n[1].trim().toLowerCase();if(o.length<30&&!o.includes(" "))t.push(o)}return Array.from(new Set(t))}function LA(e,t){if(!t)return!0;if(e.length===0)return!1;if(t.isExclusive)return!e.some((r)=>t.exclude.includes(r));else return e.some((r)=>t.include.includes(r))}function yS(e,t){if(!t)return!0;let r=UA(e);return LA(r,t)}Nn();var Fe={};wn(Fe,{xid:()=>L9,void:()=>a5,uuidv7:()=>C9,uuidv6:()=>R9,uuidv4:()=>A9,uuid:()=>$9,url:()=>O9,uppercase:()=>vu,unknown:()=>qt,union:()=>Dt,undefined:()=>o5,ulid:()=>U9,uint64:()=>n5,uint32:()=>e5,tuple:()=>d5,trim:()=>ku,treeifyError:()=>ed,transform:()=>Uy,toUpperCase:()=>Eu,toLowerCase:()=>Mu,toJSONSchema:()=>xs,templateLiteral:()=>_5,symbol:()=>i5,superRefine:()=>Mx,success:()=>v5,stringbool:()=>x5,stringFormat:()=>J9,string:()=>de,strictObject:()=>c5,startsWith:()=>_u,size:()=>mu,setErrorMap:()=>E5,set:()=>p5,safeParseAsync:()=>my,safeParse:()=>py,registry:()=>Va,regexes:()=>Fi,regex:()=>gu,refine:()=>kx,record:()=>Nt,readonly:()=>vx,property:()=>oy,promise:()=>w5,prettifyError:()=>td,preprocess:()=>Xf,prefault:()=>dx,positive:()=>ty,pipe:()=>Hf,partialRecord:()=>f5,parseAsync:()=>hy,parse:()=>fy,overwrite:()=>pi,optional:()=>Lt,object:()=>Qe,number:()=>It,nullish:()=>y5,nullable:()=>Bf,null:()=>Zf,normalize:()=>xu,nonpositive:()=>ny,nonoptional:()=>fx,nonnegative:()=>iy,never:()=>Kf,negative:()=>ry,nativeEnum:()=>m5,nanoid:()=>N9,nan:()=>b5,multipleOf:()=>Eo,minSize:()=>Io,minLength:()=>Hi,mime:()=>Su,maxSize:()=>_s,maxLength:()=>ws,map:()=>h5,lte:()=>kn,lt:()=>fi,lowercase:()=>yu,looseObject:()=>Lr,locales:()=>vs,literal:()=>tt,length:()=>Ss,lazy:()=>wx,ksuid:()=>F9,keyof:()=>l5,jwt:()=>G9,json:()=>k5,iso:()=>ks,ipv6:()=>B9,ipv4:()=>q9,intersection:()=>Cu,int64:()=>r5,int32:()=>Q9,int:()=>gy,instanceof:()=>S5,includes:()=>bu,guid:()=>P9,gte:()=>rn,gt:()=>hi,globalRegistry:()=>tn,getErrorMap:()=>I5,function:()=>Nf,formatError:()=>fs,float64:()=>Y9,float32:()=>X9,flattenError:()=>ds,file:()=>g5,enum:()=>Vr,endsWith:()=>wu,emoji:()=>D9,email:()=>T9,e164:()=>W9,discriminatedUnion:()=>Gf,date:()=>u5,custom:()=>By,cuid2:()=>j9,cuid:()=>z9,core:()=>zn,config:()=>Qt,coerce:()=>Hy,clone:()=>Ur,cidrv6:()=>Z9,cidrv4:()=>H9,check:()=>xx,catch:()=>mx,boolean:()=>rr,bigint:()=>t5,base64url:()=>V9,base64:()=>K9,array:()=>bt,any:()=>s5,_default:()=>lx,_ZodString:()=>yy,ZodXID:()=>My,ZodVoid:()=>YS,ZodUnknown:()=>JS,ZodUnion:()=>Ny,ZodUndefined:()=>VS,ZodUUID:()=>mi,ZodURL:()=>by,ZodULID:()=>ky,ZodType:()=>yt,ZodTuple:()=>rx,ZodTransform:()=>jy,ZodTemplateLiteral:()=>bx,ZodSymbol:()=>KS,ZodSuccess:()=>hx,ZodStringFormat:()=>Ut,ZodString:()=>Pu,ZodSet:()=>ix,ZodRecord:()=>zy,ZodRealError:()=>Ms,ZodReadonly:()=>yx,ZodPromise:()=>Sx,ZodPrefault:()=>cx,ZodPipe:()=>qy,ZodOptional:()=>Ly,ZodObject:()=>Wf,ZodNumberFormat:()=>Es,ZodNumber:()=>$u,ZodNullable:()=>ax,ZodNull:()=>WS,ZodNonOptional:()=>Fy,ZodNever:()=>XS,ZodNanoID:()=>wy,ZodNaN:()=>gx,ZodMap:()=>nx,ZodLiteral:()=>ox,ZodLazy:()=>_x,ZodKSUID:()=>Ey,ZodJWT:()=>Oy,ZodIssueCode:()=>M5,ZodIntersection:()=>tx,ZodISOTime:()=>Lf,ZodISODuration:()=>Ff,ZodISODateTime:()=>jf,ZodISODate:()=>Uf,ZodIPv6:()=>Ty,ZodIPv4:()=>Iy,ZodGUID:()=>qf,ZodFile:()=>sx,ZodError:()=>E9,ZodEnum:()=>Tu,ZodEmoji:()=>_y,ZodEmail:()=>vy,ZodE164:()=>Cy,ZodDiscriminatedUnion:()=>ex,ZodDefault:()=>ux,ZodDate:()=>Vf,ZodCustomStringFormat:()=>ZS,ZodCustom:()=>Jf,ZodCatch:()=>px,ZodCUID2:()=>xy,ZodCUID:()=>Sy,ZodCIDRv6:()=>$y,ZodCIDRv4:()=>Py,ZodBoolean:()=>Au,ZodBigIntFormat:()=>Dy,ZodBigInt:()=>Ru,ZodBase64URL:()=>Ry,ZodBase64:()=>Ay,ZodArray:()=>QS,ZodAny:()=>GS,TimePrecision:()=>ff,NEVER:()=>Xc,$output:()=>lf,$input:()=>cf,$brand:()=>Yc});var zn={};wn(zn,{version:()=>t0,util:()=>Be,treeifyError:()=>ed,toJSONSchema:()=>xs,toDotPath:()=>_S,safeParseAsync:()=>Li,safeParse:()=>Ui,registry:()=>Va,regexes:()=>Fi,prettifyError:()=>td,parseAsync:()=>So,parse:()=>wo,locales:()=>vs,isValidJWT:()=>jS,isValidBase64URL:()=>zS,isValidBase64:()=>a0,globalRegistry:()=>tn,globalConfig:()=>Ra,function:()=>Nf,formatError:()=>fs,flattenError:()=>ds,config:()=>Qt,clone:()=>Ur,_xid:()=>ou,_void:()=>Tf,_uuidv7:()=>Ya,_uuidv6:()=>Xa,_uuidv4:()=>Ja,_uuid:()=>Ga,_url:()=>Qa,_uppercase:()=>vu,_unknown:()=>Mo,_union:()=>i9,_undefined:()=>kf,_ulid:()=>iu,_uint64:()=>Sf,_uint32:()=>vf,_tuple:()=>sy,_trim:()=>ku,_transform:()=>h9,_toUpperCase:()=>Eu,_toLowerCase:()=>Mu,_templateLiteral:()=>S9,_symbol:()=>xf,_success:()=>v9,_stringbool:()=>Of,_stringFormat:()=>Df,_string:()=>df,_startsWith:()=>_u,_size:()=>mu,_set:()=>l9,_safeParseAsync:()=>od,_safeParse:()=>id,_regex:()=>gu,_refine:()=>Cf,_record:()=>a9,_readonly:()=>w9,_property:()=>oy,_promise:()=>k9,_positive:()=>ty,_pipe:()=>_9,_parseAsync:()=>nd,_parse:()=>rd,_overwrite:()=>pi,_optional:()=>p9,_number:()=>hf,_nullable:()=>m9,_null:()=>Mf,_normalize:()=>xu,_nonpositive:()=>ny,_nonoptional:()=>y9,_nonnegative:()=>iy,_never:()=>If,_negative:()=>ry,_nativeEnum:()=>d9,_nanoid:()=>tu,_nan:()=>$f,_multipleOf:()=>Eo,_minSize:()=>Io,_minLength:()=>Hi,_min:()=>rn,_mime:()=>Su,_maxSize:()=>_s,_maxLength:()=>ws,_max:()=>kn,_map:()=>u9,_lte:()=>kn,_lt:()=>fi,_lowercase:()=>yu,_literal:()=>f9,_length:()=>Ss,_lazy:()=>x9,_ksuid:()=>su,_jwt:()=>pu,_isoTime:()=>G0,_isoDuration:()=>J0,_isoDateTime:()=>V0,_isoDate:()=>W0,_ipv6:()=>uu,_ipv4:()=>au,_intersection:()=>s9,_int64:()=>wf,_int32:()=>yf,_int:()=>pf,_includes:()=>bu,_guid:()=>bs,_gte:()=>rn,_gt:()=>hi,_float64:()=>gf,_float32:()=>mf,_file:()=>Af,_enum:()=>c9,_endsWith:()=>wu,_emoji:()=>eu,_email:()=>Wa,_e164:()=>hu,_discriminatedUnion:()=>o9,_default:()=>g9,_date:()=>Pf,_custom:()=>Rf,_cuid2:()=>nu,_cuid:()=>ru,_coercedString:()=>K0,_coercedNumber:()=>X0,_coercedDate:()=>ey,_coercedBoolean:()=>Y0,_coercedBigint:()=>Q0,_cidrv6:()=>cu,_cidrv4:()=>lu,_catch:()=>b9,_boolean:()=>bf,_bigint:()=>_f,_base64url:()=>fu,_base64:()=>du,_array:()=>Iu,_any:()=>Ef,TimePrecision:()=>ff,NEVER:()=>Xc,JSONSchemaGenerator:()=>zf,JSONSchema:()=>qS,Doc:()=>ld,$output:()=>lf,$input:()=>cf,$constructor:()=>ne,$brand:()=>Yc,$ZodXID:()=>wd,$ZodVoid:()=>Ud,$ZodUnknown:()=>ko,$ZodUnion:()=>Ha,$ZodUndefined:()=>Dd,$ZodUUID:()=>hd,$ZodURL:()=>md,$ZodULID:()=>_d,$ZodType:()=>ut,$ZodTuple:()=>Bi,$ZodTransform:()=>gs,$ZodTemplateLiteral:()=>of,$ZodSymbol:()=>Od,$ZodSuccess:()=>ef,$ZodStringFormat:()=>Ot,$ZodString:()=>qi,$ZodSet:()=>Zd,$ZodRegistry:()=>Ka,$ZodRecord:()=>Bd,$ZodRealError:()=>cs,$ZodReadonly:()=>nf,$ZodPromise:()=>sf,$ZodPrefault:()=>Yd,$ZodPipe:()=>ys,$ZodOptional:()=>Gd,$ZodObject:()=>Ba,$ZodNumberFormat:()=>Rd,$ZodNumber:()=>Fa,$ZodNullable:()=>Jd,$ZodNull:()=>Nd,$ZodNonOptional:()=>Qd,$ZodNever:()=>jd,$ZodNanoID:()=>yd,$ZodNaN:()=>rf,$ZodMap:()=>Hd,$ZodLiteral:()=>Vd,$ZodLazy:()=>af,$ZodKSUID:()=>Sd,$ZodJWT:()=>$d,$ZodIntersection:()=>qd,$ZodISOTime:()=>o0,$ZodISODuration:()=>s0,$ZodISODateTime:()=>n0,$ZodISODate:()=>i0,$ZodIPv6:()=>kd,$ZodIPv4:()=>xd,$ZodGUID:()=>fd,$ZodFunction:()=>ay,$ZodFile:()=>Wd,$ZodError:()=>La,$ZodEnum:()=>Kd,$ZodEmoji:()=>gd,$ZodEmail:()=>pd,$ZodE164:()=>Pd,$ZodDiscriminatedUnion:()=>Fd,$ZodDefault:()=>Xd,$ZodDate:()=>Ld,$ZodCustomStringFormat:()=>Ad,$ZodCustom:()=>uf,$ZodCheckUpperCase:()=>Wg,$ZodCheckStringFormat:()=>hs,$ZodCheckStartsWith:()=>Jg,$ZodCheckSizeEquals:()=>qg,$ZodCheckRegex:()=>Kg,$ZodCheckProperty:()=>Yg,$ZodCheckOverwrite:()=>e0,$ZodCheckNumberFormat:()=>jg,$ZodCheckMultipleOf:()=>zg,$ZodCheckMinSize:()=>Fg,$ZodCheckMinLength:()=>Hg,$ZodCheckMimeType:()=>Qg,$ZodCheckMaxSize:()=>Lg,$ZodCheckMaxLength:()=>Bg,$ZodCheckLowerCase:()=>Vg,$ZodCheckLessThan:()=>ad,$ZodCheckLengthEquals:()=>Zg,$ZodCheckIncludes:()=>Gg,$ZodCheckGreaterThan:()=>ud,$ZodCheckEndsWith:()=>Xg,$ZodCheckBigIntFormat:()=>Ug,$ZodCheck:()=>Ht,$ZodCatch:()=>tf,$ZodCUID2:()=>bd,$ZodCUID:()=>vd,$ZodCIDRv6:()=>Ed,$ZodCIDRv4:()=>Md,$ZodBoolean:()=>ps,$ZodBigIntFormat:()=>Cd,$ZodBigInt:()=>qa,$ZodBase64URL:()=>Td,$ZodBase64:()=>Id,$ZodAsyncError:()=>ci,$ZodArray:()=>ms,$ZodAny:()=>zd});var Xc=Object.freeze({status:"aborted"});function ne(e,t,r){function i(h,v){var b;Object.defineProperty(h,"_zod",{value:h._zod??{},enumerable:!1}),(b=h._zod).traits??(b.traits=new Set),h._zod.traits.add(e),t(h,v);for(let _ in s.prototype)if(!(_ in h))Object.defineProperty(h,_,{value:s.prototype[_].bind(h)});h._zod.constr=s,h._zod.def=v}let n=r?.Parent??Object;class o extends n{}Object.defineProperty(o,"name",{value:e});function s(h){var v;let b=r?.Parent?new o:this;i(b,h),(v=b._zod).deferred??(v.deferred=[]);for(let _ of b._zod.deferred)_();return b}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:(h)=>{if(r?.Parent&&h instanceof r.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}var Yc=Symbol("zod_brand");class ci extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var Ra={};function Qt(e){if(e)Object.assign(Ra,e);return Ra}var Be={};wn(Be,{unwrapMessage:()=>Ca,stringifyPrimitive:()=>Ve,required:()=>nR,randomString:()=>WA,propertyKeyTypes:()=>za,promiseAllObject:()=>VA,primitiveTypes:()=>ng,prefixIssues:()=>en,pick:()=>YA,partial:()=>rR,optionalKeys:()=>ig,omit:()=>QA,numKeys:()=>GA,nullish:()=>ji,normalizeParams:()=>qe,merge:()=>tR,jsonStringifyReplacer:()=>Qm,joinValues:()=>be,issue:()=>ag,isPlainObject:()=>ls,isObject:()=>us,getSizableOrigin:()=>ja,getParsedType:()=>JA,getLengthableOrigin:()=>Ua,getEnumValues:()=>Oa,getElementAtPath:()=>KA,floatSafeRemainder:()=>eg,finalizeIssue:()=>fn,extend:()=>eR,escapeRegex:()=>di,esc:()=>bo,defineLazy:()=>Tt,createTransparentProxy:()=>XA,clone:()=>Ur,cleanRegex:()=>Na,cleanEnum:()=>iR,captureStackTrace:()=>Qc,cached:()=>Da,assignProp:()=>tg,assertNotEqual:()=>qA,assertNever:()=>HA,assertIs:()=>BA,assertEqual:()=>FA,assert:()=>ZA,allowsEval:()=>rg,aborted:()=>_o,NUMBER_FORMAT_RANGES:()=>og,Class:()=>vS,BIGINT_FORMAT_RANGES:()=>sg});function FA(e){return e}function qA(e){return e}function BA(e){}function HA(e){throw Error()}function ZA(e){}function Oa(e){let t=Object.values(e).filter((i)=>typeof i==="number");return Object.entries(e).filter(([i,n])=>t.indexOf(+i)===-1).map(([i,n])=>n)}function be(e,t="|"){return e.map((r)=>Ve(r)).join(t)}function Qm(e,t){if(typeof t==="bigint")return t.toString();return t}function Da(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function ji(e){return e===null||e===void 0}function Na(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function eg(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return o%s/10**n}function Tt(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function tg(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function KA(e,t){if(!t)return e;return t.reduce((r,i)=>r?.[i],e)}function VA(e){let t=Object.keys(e),r=t.map((i)=>e[i]);return Promise.all(r).then((i)=>{let n={};for(let o=0;o<t.length;o++)n[t[o]]=i[o];return n})}function WA(e=10){let r="";for(let i=0;i<e;i++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function bo(e){return JSON.stringify(e)}var Qc=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function us(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var rg=Da(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ls(e){if(us(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;if(us(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function GA(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var JA=(e)=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},za=new Set(["string","number","symbol"]),ng=new Set(["string","number","bigint","boolean","symbol","undefined"]);function di(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ur(e,t,r){let i=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)i._zod.parent=e;return i}function qe(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function XA(e){let t;return new Proxy({},{get(r,i,n){return t??(t=e()),Reflect.get(t,i,n)},set(r,i,n,o){return t??(t=e()),Reflect.set(t,i,n,o)},has(r,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(r,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(r,i,n){return t??(t=e()),Reflect.defineProperty(t,i,n)}})}function Ve(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ig(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var og={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},sg={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function YA(e,t){let r={},i=e._zod.def;for(let n in t){if(!(n in i.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;r[n]=i.shape[n]}return Ur(e,{...e._zod.def,shape:r,checks:[]})}function QA(e,t){let r={...e._zod.def.shape},i=e._zod.def;for(let n in t){if(!(n in i.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;delete r[n]}return Ur(e,{...e._zod.def,shape:r,checks:[]})}function eR(e,t){if(!ls(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let i={...e._zod.def.shape,...t};return tg(this,"shape",i),i},checks:[]};return Ur(e,r)}function tR(e,t){return Ur(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return tg(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function rR(e,t,r){let i=t._zod.def.shape,n={...i};if(r)for(let o in r){if(!(o in i))throw Error(`Unrecognized key: "${o}"`);if(!r[o])continue;n[o]=e?new e({type:"optional",innerType:i[o]}):i[o]}else for(let o in i)n[o]=e?new e({type:"optional",innerType:i[o]}):i[o];return Ur(t,{...t._zod.def,shape:n,checks:[]})}function nR(e,t,r){let i=t._zod.def.shape,n={...i};if(r)for(let o in r){if(!(o in n))throw Error(`Unrecognized key: "${o}"`);if(!r[o])continue;n[o]=new e({type:"nonoptional",innerType:i[o]})}else for(let o in i)n[o]=new e({type:"nonoptional",innerType:i[o]});return Ur(t,{...t._zod.def,shape:n,checks:[]})}function _o(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function en(e,t){return t.map((r)=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Ca(e){return typeof e==="string"?e:e?.message}function fn(e,t,r){let i={...e,path:e.path??[]};if(!e.message){let n=Ca(e.inst?._zod.def?.error?.(e))??Ca(t?.error?.(e))??Ca(r.customError?.(e))??Ca(r.localeError?.(e))??"Invalid input";i.message=n}if(delete i.inst,delete i.continue,!t?.reportInput)delete i.input;return i}function ja(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function Ua(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ag(...e){let[t,r,i]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:i};return{...t}}function iR(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}class vS{constructor(...e){}}var bS=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Qm,2)},enumerable:!0})},La=ne("$ZodError",bS),cs=ne("$ZodError",bS,{Parent:Error});function ds(e,t=(r)=>r.message){let r={},i=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else i.push(t(n));return{formErrors:i,fieldErrors:r}}function fs(e,t){let r=t||function(o){return o.message},i={_errors:[]},n=(o)=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((h)=>n({issues:h}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)i._errors.push(r(s));else{let h=i,v=0;while(v<s.path.length){let b=s.path[v];if(v!==s.path.length-1)h[b]=h[b]||{_errors:[]};else h[b]=h[b]||{_errors:[]},h[b]._errors.push(r(s));h=h[b],v++}}};return n(e),i}function ed(e,t){let r=t||function(o){return o.message},i={errors:[]},n=(o,s=[])=>{var h,v;for(let b of o.issues)if(b.code==="invalid_union"&&b.errors.length)b.errors.map((_)=>n({issues:_},b.path));else if(b.code==="invalid_key")n({issues:b.issues},b.path);else if(b.code==="invalid_element")n({issues:b.issues},b.path);else{let _=[...s,...b.path];if(_.length===0){i.errors.push(r(b));continue}let g=i,S=0;while(S<_.length){let x=_[S],M=S===_.length-1;if(typeof x==="string")g.properties??(g.properties={}),(h=g.properties)[x]??(h[x]={errors:[]}),g=g.properties[x];else g.items??(g.items=[]),(v=g.items)[x]??(v[x]={errors:[]}),g=g.items[x];if(M)g.errors.push(r(b));S++}}};return n(e),i}function _S(e){let t=[];for(let r of e)if(typeof r==="number")t.push(`[${r}]`);else if(typeof r==="symbol")t.push(`[${JSON.stringify(String(r))}]`);else if(/[^\w$]/.test(r))t.push(`[${JSON.stringify(r)}]`);else{if(t.length)t.push(".");t.push(r)}return t.join("")}function td(e){let t=[],r=[...e.issues].sort((i,n)=>i.path.length-n.path.length);for(let i of r)if(t.push(`✖ ${i.message}`),i.path?.length)t.push(` → at ${_S(i.path)}`);return t.join(`
27
27
  `)}var rd=(e)=>(t,r,i,n)=>{let o=i?Object.assign(i,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ci;if(s.issues.length){let h=new(n?.Err??e)(s.issues.map((v)=>fn(v,o,Qt())));throw Qc(h,n?.callee),h}return s.value},wo=rd(cs),nd=(e)=>async(t,r,i,n)=>{let o=i?Object.assign(i,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;if(s.issues.length){let h=new(n?.Err??e)(s.issues.map((v)=>fn(v,o,Qt())));throw Qc(h,n?.callee),h}return s.value},So=nd(cs),id=(e)=>(t,r,i)=>{let n=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new ci;return o.issues.length?{success:!1,error:new(e??La)(o.issues.map((s)=>fn(s,n,Qt())))}:{success:!0,data:o.value}},Ui=id(cs),od=(e)=>async(t,r,i)=>{let n=i?Object.assign(i,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length?{success:!1,error:new e(o.issues.map((s)=>fn(s,n,Qt())))}:{success:!0,data:o.value}},Li=od(cs);var Fi={};wn(Fi,{xid:()=>dg,uuid7:()=>lR,uuid6:()=>uR,uuid4:()=>aR,uuid:()=>xo,uppercase:()=>Ng,unicodeEmail:()=>fR,undefined:()=>Og,ulid:()=>cg,time:()=>Eg,string:()=>Tg,rfc5322Email:()=>dR,number:()=>Ag,null:()=>Cg,nanoid:()=>hg,lowercase:()=>Dg,ksuid:()=>fg,ipv6:()=>bg,ipv4:()=>vg,integer:()=>$g,html5Email:()=>cR,hostname:()=>xg,guid:()=>mg,extendedDuration:()=>sR,emoji:()=>yg,email:()=>gg,e164:()=>kg,duration:()=>pg,domain:()=>mR,datetime:()=>Ig,date:()=>Mg,cuid2:()=>lg,cuid:()=>ug,cidrv6:()=>wg,cidrv4:()=>_g,browserEmail:()=>hR,boolean:()=>Rg,bigint:()=>Pg,base64url:()=>sd,base64:()=>Sg,_emoji:()=>pR});var ug=/^[cC][^\s-]{8,}$/,lg=/^[0-9a-z]+$/,cg=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,dg=/^[0-9a-vA-V]{20}$/,fg=/^[A-Za-z0-9]{27}$/,hg=/^[a-zA-Z0-9_-]{21}$/,pg=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,sR=/^[-+]?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)?)??$/,mg=/^([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})$/,xo=(e)=>{if(!e)return/^([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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},aR=xo(4),uR=xo(6),lR=xo(7),gg=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,cR=/^[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])?)*$/,dR=/^(([^<>()\[\]\\.,;:\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,}))$/,fR=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,hR=/^[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])?)*$/,pR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function yg(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var vg=/^(?:(?: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])$/,bg=/^(([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})$/,_g=/^((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])$/,wg=/^(([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])$/,Sg=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,sd=/^[A-Za-z0-9_-]*$/,xg=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,mR=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,kg=/^\+(?:[0-9]){6,14}[0-9]$/,wS="(?:(?:\\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])))",Mg=new RegExp(`^${wS}$`);function SS(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Eg(e){return new RegExp(`^${SS(e)}$`)}function Ig(e){let t=SS({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-]\\d{2}:\\d{2})");let i=`${t}(?:${r.join("|")})`;return new RegExp(`^${wS}T(?:${i})$`)}var Tg=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Pg=/^\d+n?$/,$g=/^\d+$/,Ag=/^-?\d+(?:\.\d+)?/i,Rg=/true|false/i,Cg=/null/i;var Og=/undefined/i;var Dg=/^[^A-Z]*$/,Ng=/^[^a-z]*$/;var Ht=ne("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),kS={number:"number",bigint:"bigint",object:"date"},ad=ne("$ZodCheckLessThan",(e,t)=>{Ht.init(e,t);let r=kS[typeof t.value];e._zod.onattach.push((i)=>{let n=i._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<o)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(i)=>{if(t.inclusive?i.value<=t.value:i.value<t.value)return;i.issues.push({origin:r,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ud=ne("$ZodCheckGreaterThan",(e,t)=>{Ht.init(e,t);let r=kS[typeof t.value];e._zod.onattach.push((i)=>{let n=i._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>o)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(i)=>{if(t.inclusive?i.value>=t.value:i.value>t.value)return;i.issues.push({origin:r,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),zg=ne("$ZodCheckMultipleOf",(e,t)=>{Ht.init(e,t),e._zod.onattach.push((r)=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):eg(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),jg=ne("$ZodCheckNumberFormat",(e,t)=>{Ht.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),i=r?"int":"number",[n,o]=og[t.format];e._zod.onattach.push((s)=>{let h=s._zod.bag;if(h.format=t.format,h.minimum=n,h.maximum=o,r)h.pattern=$g}),e._zod.check=(s)=>{let h=s.value;if(r){if(!Number.isInteger(h)){s.issues.push({expected:i,format:t.format,code:"invalid_type",input:h,inst:e});return}if(!Number.isSafeInteger(h)){if(h>0)s.issues.push({input:h,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});else s.issues.push({input:h,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});return}}if(h<n)s.issues.push({origin:"number",input:h,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(h>o)s.issues.push({origin:"number",input:h,code:"too_big",maximum:o,inst:e})}}),Ug=ne("$ZodCheckBigIntFormat",(e,t)=>{Ht.init(e,t);let[r,i]=sg[t.format];e._zod.onattach.push((n)=>{let o=n._zod.bag;o.format=t.format,o.minimum=r,o.maximum=i}),e._zod.check=(n)=>{let o=n.value;if(o<r)n.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(o>i)n.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inst:e})}}),Lg=ne("$ZodCheckMaxSize",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.size!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<i)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let i=r.value;if(i.size<=t.maximum)return;r.issues.push({origin:ja(i),code:"too_big",maximum:t.maximum,input:i,inst:e,continue:!t.abort})}}),Fg=ne("$ZodCheckMinSize",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.size!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>i)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let i=r.value;if(i.size>=t.minimum)return;r.issues.push({origin:ja(i),code:"too_small",minimum:t.minimum,input:i,inst:e,continue:!t.abort})}}),qg=ne("$ZodCheckSizeEquals",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.size!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=(r)=>{let i=r.value,n=i.size;if(n===t.size)return;let o=n>t.size;r.issues.push({origin:ja(i),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Bg=ne("$ZodCheckMaxLength",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.length!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<i)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let i=r.value;if(i.length<=t.maximum)return;let o=Ua(i);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Hg=ne("$ZodCheckMinLength",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.length!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>i)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let i=r.value;if(i.length>=t.minimum)return;let o=Ua(i);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Zg=ne("$ZodCheckLengthEquals",(e,t)=>{Ht.init(e,t),e._zod.when=(r)=>{let i=r.value;return!ji(i)&&i.length!==void 0},e._zod.onattach.push((r)=>{let i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=(r)=>{let i=r.value,n=i.length;if(n===t.length)return;let o=Ua(i),s=n>t.length;r.issues.push({origin:o,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),hs=ne("$ZodCheckStringFormat",(e,t)=>{var r,i;if(Ht.init(e,t),e._zod.onattach.push((n)=>{let o=n._zod.bag;if(o.format=t.format,t.pattern)o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(i=e._zod).check??(i.check=()=>{})}),Kg=ne("$ZodCheckRegex",(e,t)=>{hs.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Vg=ne("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Dg),hs.init(e,t)}),Wg=ne("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ng),hs.init(e,t)}),Gg=ne("$ZodCheckIncludes",(e,t)=>{Ht.init(e,t);let r=di(t.includes),i=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=i,e._zod.onattach.push((n)=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Jg=ne("$ZodCheckStartsWith",(e,t)=>{Ht.init(e,t);let r=new RegExp(`^${di(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((i)=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(i)=>{if(i.value.startsWith(t.prefix))return;i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),Xg=ne("$ZodCheckEndsWith",(e,t)=>{Ht.init(e,t);let r=new RegExp(`.*${di(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((i)=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(i)=>{if(i.value.endsWith(t.suffix))return;i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function xS(e,t,r){if(e.issues.length)t.issues.push(...en(r,e.issues))}var Yg=ne("$ZodCheckProperty",(e,t)=>{Ht.init(e,t),e._zod.check=(r)=>{let i=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then((n)=>xS(n,r,t.property));xS(i,r,t.property);return}}),Qg=ne("$ZodCheckMimeType",(e,t)=>{Ht.init(e,t);let r=new Set(t.mime);e._zod.onattach.push((i)=>{i._zod.bag.mime=t.mime}),e._zod.check=(i)=>{if(r.has(i.value.type))return;i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e})}}),e0=ne("$ZodCheckOverwrite",(e,t)=>{Ht.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class ld{constructor(e=[]){if(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 r=e.split(`
28
28
  `).filter((o)=>o),i=Math.min(...r.map((o)=>o.length-o.trimStart().length)),n=r.map((o)=>o.slice(i)).map((o)=>" ".repeat(this.indent*2)+o);for(let o of n)this.content.push(o)}compile(){let e=Function,t=this?.args,i=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,i.join(`
29
29
  `))}}var t0={major:4,minor:0,patch:0};var ut=ne("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=t0;let i=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))i.unshift(e);for(let n of i)for(let o of n._zod.onattach)o(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(o,s,h)=>{let v=_o(o),b;for(let _ of s){if(_._zod.when){if(!_._zod.when(o))continue}else if(v)continue;let g=o.issues.length,S=_._zod.check(o);if(S instanceof Promise&&h?.async===!1)throw new ci;if(b||S instanceof Promise)b=(b??Promise.resolve()).then(async()=>{if(await S,o.issues.length===g)return;if(!v)v=_o(o,g)});else{if(o.issues.length===g)continue;if(!v)v=_o(o,g)}}if(b)return b.then(()=>o);return o};e._zod.run=(o,s)=>{let h=e._zod.parse(o,s);if(h instanceof Promise){if(s.async===!1)throw new ci;return h.then((v)=>n(v,i,s))}return n(h,i,s)}}e["~standard"]={validate:(n)=>{try{let o=Ui(e,n);return o.success?{value:o.data}:{issues:o.error?.issues}}catch(o){return Li(e,n).then((s)=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),qi=ne("$ZodString",(e,t)=>{ut.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Tg(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ot=ne("$ZodStringFormat",(e,t)=>{hs.init(e,t),qi.init(e,t)}),fd=ne("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=mg),Ot.init(e,t)}),hd=ne("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=xo(i))}else t.pattern??(t.pattern=xo());Ot.init(e,t)}),pd=ne("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=gg),Ot.init(e,t)}),md=ne("$ZodURL",(e,t)=>{Ot.init(e,t),e._zod.check=(r)=>{try{let i=r.value,n=new URL(i),o=n.href;if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:xg.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(!i.endsWith("/")&&o.endsWith("/"))r.value=o.slice(0,-1);else r.value=o;return}catch(i){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),gd=ne("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=yg()),Ot.init(e,t)}),yd=ne("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=hg),Ot.init(e,t)}),vd=ne("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ug),Ot.init(e,t)}),bd=ne("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=lg),Ot.init(e,t)}),_d=ne("$ZodULID",(e,t)=>{t.pattern??(t.pattern=cg),Ot.init(e,t)}),wd=ne("$ZodXID",(e,t)=>{t.pattern??(t.pattern=dg),Ot.init(e,t)}),Sd=ne("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=fg),Ot.init(e,t)}),n0=ne("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ig(t)),Ot.init(e,t)}),i0=ne("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Mg),Ot.init(e,t)}),o0=ne("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Eg(t)),Ot.init(e,t)}),s0=ne("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=pg),Ot.init(e,t)}),xd=ne("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=vg),Ot.init(e,t),e._zod.onattach.push((r)=>{let i=r._zod.bag;i.format="ipv4"})}),kd=ne("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=bg),Ot.init(e,t),e._zod.onattach.push((r)=>{let i=r._zod.bag;i.format="ipv6"}),e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Md=ne("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=_g),Ot.init(e,t)}),Ed=ne("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=wg),Ot.init(e,t),e._zod.check=(r)=>{let[i,n]=r.value.split("/");try{if(!n)throw Error();let o=Number(n);if(`${o}`!==n)throw Error();if(o<0||o>128)throw Error();new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function a0(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Id=ne("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Sg),Ot.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=(r)=>{if(a0(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function zS(e){if(!sd.test(e))return!1;let t=e.replace(/[-_]/g,(i)=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return a0(r)}var Td=ne("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=sd),Ot.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=(r)=>{if(zS(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Pd=ne("$ZodE164",(e,t)=>{t.pattern??(t.pattern=kg),Ot.init(e,t)});function jS(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[i]=r;if(!i)return!1;let n=JSON.parse(atob(i));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var $d=ne("$ZodJWT",(e,t)=>{Ot.init(e,t),e._zod.check=(r)=>{if(jS(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Ad=ne("$ZodCustomStringFormat",(e,t)=>{Ot.init(e,t),e._zod.check=(r)=>{if(t.fn(r.value))return;r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Fa=ne("$ZodNumber",(e,t)=>{ut.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ag,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let o=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...o?{received:o}:{}}),r}}),Rd=ne("$ZodNumber",(e,t)=>{jg.init(e,t),Fa.init(e,t)}),ps=ne("$ZodBoolean",(e,t)=>{ut.init(e,t),e._zod.pattern=Rg,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(o){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),qa=ne("$ZodBigInt",(e,t)=>{ut.init(e,t),e._zod.pattern=Pg,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch(n){}if(typeof r.value==="bigint")return r;return r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Cd=ne("$ZodBigInt",(e,t)=>{Ug.init(e,t),qa.init(e,t)}),Od=ne("$ZodSymbol",(e,t)=>{ut.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;if(typeof n==="symbol")return r;return r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Dd=ne("$ZodUndefined",(e,t)=>{ut.init(e,t),e._zod.pattern=Og,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,i)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),Nd=ne("$ZodNull",(e,t)=>{ut.init(e,t),e._zod.pattern=Cg,e._zod.values=new Set([null]),e._zod.parse=(r,i)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),zd=ne("$ZodAny",(e,t)=>{ut.init(e,t),e._zod.parse=(r)=>r}),ko=ne("$ZodUnknown",(e,t)=>{ut.init(e,t),e._zod.parse=(r)=>r}),jd=ne("$ZodNever",(e,t)=>{ut.init(e,t),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Ud=ne("$ZodVoid",(e,t)=>{ut.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),Ld=ne("$ZodDate",(e,t)=>{ut.init(e,t),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(h){}let n=r.value,o=n instanceof Date;if(o&&!Number.isNaN(n.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:n,...o?{received:"Invalid Date"}:{},inst:e}),r}});function ES(e,t,r){if(e.issues.length)t.issues.push(...en(r,e.issues));t.value[r]=e.value}var ms=ne("$ZodArray",(e,t)=>{ut.init(e,t),e._zod.parse=(r,i)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let o=[];for(let s=0;s<n.length;s++){let h=n[s],v=t.element._zod.run({value:h,issues:[]},i);if(v instanceof Promise)o.push(v.then((b)=>ES(b,r,s)));else ES(v,r,s)}if(o.length)return Promise.all(o).then(()=>r);return r}});function cd(e,t,r){if(e.issues.length)t.issues.push(...en(r,e.issues));t.value[r]=e.value}function IS(e,t,r,i){if(e.issues.length)if(i[r]===void 0)if(r in i)t.value[r]=void 0;else t.value[r]=e.value;else t.issues.push(...en(r,e.issues));else if(e.value===void 0){if(r in i)t.value[r]=void 0}else t.value[r]=e.value}var Ba=ne("$ZodObject",(e,t)=>{ut.init(e,t);let r=Da(()=>{let g=Object.keys(t.shape);for(let x of g)if(!(t.shape[x]instanceof ut))throw Error(`Invalid element at key "${x}": expected a Zod schema`);let S=ig(t.shape);return{shape:t.shape,keys:g,keySet:new Set(g),numKeys:g.length,optionalKeys:new Set(S)}});Tt(e._zod,"propValues",()=>{let g=t.shape,S={};for(let x in g){let M=g[x]._zod;if(M.values){S[x]??(S[x]=new Set);for(let I of M.values)S[x].add(I)}}return S});let i=(g)=>{let S=new ld(["shape","payload","ctx"]),x=r.value,M=($)=>{let R=bo($);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};S.write("const input = payload.value;");let I=Object.create(null),T=0;for(let $ of x.keys)I[$]=`key_${T++}`;S.write("const newResult = {}");for(let $ of x.keys)if(x.optionalKeys.has($)){let R=I[$];S.write(`const ${R} = ${M($)};`);let C=bo($);S.write(`
@@ -91,9 +91,9 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
91
91
 
92
92
  new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
93
93
  `);this.baseURL=n.baseURL,this._baseURLIsExplicit=i.__baseURLIsExplicit??!!e,this.timeout=n.timeout??Ev.DEFAULT_TIMEOUT,this.logger=n.logger??console;let o="warn";this.logLevel=o,this.logLevel=ev(n.logLevel,"ClientOptions.logLevel",this)??ev($t("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??o,this.fetchOptions=n.fetchOptions,this.maxRetries=n.maxRetries??2,this.fetch=n.fetch??Lx(),We(this,$h,qx,"f");let s=$t("ANTHROPIC_CUSTOM_HEADERS");if(s){let v={};for(let b of s.split(`
94
- `)){let _=b.indexOf(":");if(_>=0)v[b.substring(0,_).trim()]=b.substring(_+1).trim()}n.defaultHeaders={...v,...n.defaultHeaders}}let h=i.__auth;if(delete n.__auth,delete n.__baseURLIsExplicit,this._options=n,this.apiKey=typeof t==="string"?t:null,this.authToken=r,h){if(this._authState=h,!this._baseURLIsExplicit&&h.baseURL)this.baseURL=h.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let v=n.credentials??null;if(v)this._authState.provider=v,this._authState.tokenCache=this._makeTokenCache(v);else if(n.config!=null){let b=nv(n.config,this._credentialResolverOptions());this._authState.provider=b.provider,this._authState.tokenCache=this._makeTokenCache(b.provider),this._authState.extraHeaders=b.extraHeaders,this._applyCredentialBaseURL(b.baseURL)}else if(n.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(n.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{er(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{er(this).warn(e)}}}_makeTokenCache(e){return new Yy(e,(t)=>{er(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,r="apiKey"in e||"authToken"in e||t,i={...this._options,...this._baseURLIsExplicit?{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,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:r?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(i)}async _resolveDefaultCredentials(e){try{let t=await a2(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new Ye(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(e.get("x-api-key")||e.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&e.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&e.get("authorization"))return;if(t.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags(e){let t=this._requestAuthFlags.get(e);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t);return t}async authHeaders(e){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,_e([{Authorization:`Bearer ${t}`}])}return _e([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return _e([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return _e([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Bx(e)}getUserAgent(){return`${this.constructor.name}/JS ${Mn}`}defaultIdempotencyKey(){return`stainless-node-retry-${Ky()}`}makeStatusError(e,t,r,i){return vr.generate(e,t,r,i)}buildURL(e,t,r){let i=!oe(this,Mv,"m",D2).call(this)&&r||this.baseURL,n=Rx(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery(),s=Object.fromEntries(n.searchParams);if(!Gy(o)||!Gy(s))t={...s,...o,...t};if(typeof t==="object"&&t&&!Array.isArray(t))n.search=this.stringifyQuery(t);return n.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128000>600)throw new Ye("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 600000}async prepareOptions(e){}async prepareRequest(e,{url:t,options:r}){if(this._authState.tokenCache&&this.apiKey==null){let i=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[o,s]of Object.entries(this._authState.extraHeaders))if(!i.has(o))i.set(o,s);if(!i.get("anthropic-beta")?.split(",").map((o)=>o.trim())?.includes(Po))i.append("anthropic-beta",Po);e.headers=i}}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,r){return this.request(Promise.resolve(r).then((i)=>({method:e,path:t,...i})))}request(e,t=null){return new $o(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,r){let i=await e,n=i.maxRetries??this.maxRetries;if(t==null)t=n,this._requestAuthFlags.delete(i);await this.prepareOptions(i);let{req:o,url:s,timeout:h}=await this.buildRequest(i,{retryCount:n-t});await this.prepareRequest(o,{url:s,options:i});let v="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),b=r===void 0?"":`, retryOf: ${r}`,_=Date.now();if(er(this).debug(`[${v}] sending request`,yi({retryOfRequestLogID:r,method:i.method,url:s,options:i,headers:o.headers})),i.signal?.aborted)throw new Ar;let g=new AbortController,S=await this.fetchWithTimeout(s,o,h,g).catch(Ou),x=Date.now();if(S instanceof globalThis.Error){let T=`retrying, ${t} attempts remaining`;if(i.signal?.aborted)throw new Ar;let P=gi(S)||/timed? ?out/i.test(String(S)+("cause"in S?String(S.cause):""));if(t)return er(this).info(`[${v}] connection ${P?"timed out":"failed"} - ${T}`),er(this).debug(`[${v}] connection ${P?"timed out":"failed"} (${T})`,yi({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),this.retryRequest(i,t,r??v);if(er(this).info(`[${v}] connection ${P?"timed out":"failed"} - error; no more retries left`),er(this).debug(`[${v}] connection ${P?"timed out":"failed"} (error; no more retries left)`,yi({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),P)throw new Du;throw new To({cause:S})}let M=[...S.headers.entries()].filter(([T])=>T==="request-id").map(([T,P])=>", "+T+": "+JSON.stringify(P)).join(""),I=`[${v}${b}${M}] ${o.method} ${s} ${S.ok?"succeeded":"failed"} with status ${S.status} in ${x-_}ms`;if(!S.ok){let T=await this.shouldRetry(S,i);if(t&&T){let B=`retrying, ${t} attempts remaining`;return await Fx(S.body),er(this).info(`${I} - ${B}`),er(this).debug(`[${v}] response error (${B})`,yi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),this.retryRequest(i,t,r??v,S.headers)}let P=T?"error; no more retries left":"error; not retryable";er(this).info(`${I} - ${P}`);let $=await S.text().catch((B)=>Ou(B).message),R=Qf($),C=R?void 0:$;throw er(this).debug(`[${v}] response error (${P})`,yi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,message:C,durationMs:Date.now()-_})),this.makeStatusError(S.status,R,C,S.headers)}return er(this).info(I),er(this).debug(`[${v}] response start`,yi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),{response:S,options:i,controller:g,requestLogID:v,retryOfRequestLogID:r,startTime:_}}getAPIList(e,t,r){return this.requestAPIList(t,r&&"then"in r?r.then((i)=>({method:"get",path:e,...i})):{method:"get",path:e,...r})}requestAPIList(e,t){let r=this.makeRequest(t,null,void 0);return new dh(this,r,e)}async fetchWithTimeout(e,t,r,i){let{signal:n,method:o,...s}=t||{},h=this._makeAbort(i);if(n)n.addEventListener("abort",h,{once:!0});let v=setTimeout(h,r),b=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body==="object"&&s.body!==null&&Symbol.asyncIterator in s.body,_={signal:i.signal,...b?{duplex:"half"}:{},method:"GET",...s};if(o)_.method=o.toUpperCase();try{return await this.fetch.call(void 0,e,_)}finally{clearTimeout(v)}}async shouldRetry(e,t){let r=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&r.usedTokenCache&&!r.didRefreshFor401)return r.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let i=e.headers.get("x-should-retry");if(i==="true")return!0;if(i==="false")return!1;if(e.status===408)return!0;if(e.status===409)return!0;if(e.status===429)return!0;if(e.status>=500)return!0;return!1}async retryRequest(e,t,r,i){let n,o=i?.get("retry-after-ms");if(o){let h=parseFloat(o);if(!Number.isNaN(h))n=h}let s=i?.get("retry-after");if(s&&!n){let h=parseFloat(s);if(!Number.isNaN(h))n=h*1000;else n=Date.parse(s)-Date.now()}if(n===void 0){let h=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,h)}return await Dx(n),this.makeRequest(e,t-1,r)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,o=Math.min(0.5*Math.pow(2,n),8),s=1-Math.random()*0.25;return o*s*1000}calculateNonstreamingTimeout(e,t){if(3600000*e/128000>600000||t!=null&&e>t)throw new Ye("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 600000}async buildRequest(e,{retryCount:t=0}={}){let r={...e},{method:i,path:n,query:o,defaultBaseURL:s}=r;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let h=this.buildURL(n,o,s);if("timeout"in r)Ox("timeout",r.timeout);r.timeout=r.timeout??this.timeout;let{bodyHeaders:v,body:b}=this.buildBody({options:r}),_=await this.buildHeaders({options:e,method:i,bodyHeaders:v,retryCount:t});return{req:{method:i,headers:_,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&b instanceof globalThis.ReadableStream&&{duplex:"half"},...b&&{body:b},...this.fetchOptions??{},...r.fetchOptions??{}},url:h,timeout:r.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:i}){let n={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();n[this.idempotencyHeader]=e.idempotencyKey}let o=_e([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...Hu(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(o),o.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let r=_e([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&r.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:e};else if(typeof e==="object"&&((Symbol.asyncIterator in e)||(Symbol.iterator in e)&&("next"in e)&&typeof e.next==="function"))return{bodyHeaders:void 0,body:eh(e)};else if(typeof e==="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return oe(this,$h,"f").call(this,{body:e,headers:r})}}Ev=Jt,$h=new WeakMap,Mv=new WeakSet,D2=function(){return this.baseURL!=="https://api.anthropic.com"};Jt.Anthropic=Ev;Jt.HUMAN_PROMPT=N2;Jt.AI_PROMPT=z2;Jt.DEFAULT_TIMEOUT=600000;Jt.AnthropicError=Ye;Jt.APIError=vr;Jt.APIConnectionError=To;Jt.APIConnectionTimeoutError=Du;Jt.APIUserAbortError=Ar;Jt.NotFoundError=Uu;Jt.ConflictError=Lu;Jt.RateLimitError=qu;Jt.BadRequestError=Nu;Jt.AuthenticationError=zu;Jt.InternalServerError=Bu;Jt.PermissionDeniedError=ju;Jt.UnprocessableEntityError=Fu;Jt.toFile=fh;class jo extends Jt{constructor(){super(...arguments);this.completions=new Us(this),this.messages=new zo(this),this.models=new Fs(this),this.beta=new Fr(this)}}jo.Completions=Us;jo.Messages=zo;jo.Models=Fs;jo.Beta=Fr;function q7(e){return e}function Il(e){return q7(e)}class Iv extends Error{telemetryMessage;errorClass;constructor(e,t,r){super(e);this.name="TelemetrySafeError",this.telemetryMessage=t??e,this.errorClass=r}}function Tv(e){return e instanceof Error?e:Error(String(e))}function Ah(e){return e instanceof Error?e.message:String(e)}function Uo(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function j2(e){return Uo(e)==="ENOENT"}function Pv(e){return Uo(e)==="EISDIR"}var _t=(()=>({}));var{appendFile:B7,chmod:H7,copyFile:Z7,link:K7,lstat:V7,mkdir:W7,open:U2,readdir:G7,readFile:L2,readlink:J7,realpath:X7,rename:Y7,rmdir:Q7,rm:eC,stat:tC,symlink:rC,unlink:nC}=(()=>({}));Nn();var iC="→",mpe=process.platform==="win32"?/[\\/]+/:/\/+/;function $v(e){let t="";for(let i of e.split(/([\\/]+)/)){if(i==="."||i==="..")break;t+=i}let r=t.replace(/(?<=[^\\/])[\\/]+$/,"");return r===""?e:r}function oC(e){let t=Dn(e).replace(/(?<=[^\\/])[\\/]+$/,"");if(Gm(t)&&!Jm(t))return t;return $v(e)}function sC(e){if(e.startsWith("\\\\"))return $v(e);let t=e.replace(/^\/+/,"/"),r=hS(t);if(r!==null)return r;return $v(e)}var gpe=process.platform==="win32"?oC:sC;var aC={cwd(){return process.cwd()},existsSync(e){let r=[];try{const t=xr(r,Rr`fs.existsSync(${e})`,0);return _t.existsSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},async stat(e){return tC(e)},async lstat(e){return V7(e)},async readdir(e){return G7(e,{withFileTypes:!0})},async unlink(e){return nC(e)},async rmdir(e){return Q7(e)},async rm(e,t){return eC(e,t)},async mkdir(e,t){try{await W7(e,{recursive:!0,...t})}catch(r){if(Uo(r)!=="EEXIST")throw r}},async readFile(e,t){return L2(e,{encoding:t.encoding})},async rename(e,t){return Y7(e,t)},async realpath(e){return Jc(await X7(e))},async readlink(e){return J7(e)},async copyFile(e,t){return Z7(e,t)},async appendFile(e,t,r){if(r?.mode!==void 0)try{let i=await U2(e,"ax",r.mode);try{await i.appendFile(t)}finally{await i.close()}return}catch(i){if(Uo(i)!=="EEXIST")throw i}return B7(e,t)},async symlink(e,t,r){return rC(e,t,r)},async link(e,t){return K7(e,t)},async chmod(e,t){return H7(e,t)},statSync(e){let r=[];try{const t=xr(r,Rr`fs.statSync(${e})`,0);return _t.statSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},lstatSync(e){let r=[];try{const t=xr(r,Rr`fs.lstatSync(${e})`,0);return _t.lstatSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},readFileSync(e,t){let i=[];try{const r=xr(i,Rr`fs.readFileSync(${e})`,0);return _t.readFileSync(e,{encoding:t.encoding})}catch(n){var o=n,s=1}finally{kr(i,o,s)}},readFileBytesSync(e){let r=[];try{const t=xr(r,Rr`fs.readFileBytesSync(${e})`,0);return _t.readFileSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},readSync(e,t){let n=[];try{const r=xr(n,Rr`fs.readSync(${e}, ${t.length} bytes)`,0);let i=void 0;try{i=_t.openSync(e,"r");let v=Buffer.alloc(t.length),b=_t.readSync(i,v,0,t.length,0);return{buffer:v,bytesRead:b}}finally{if(i)_t.closeSync(i)}}catch(o){var s=o,h=1}finally{kr(n,s,h)}},appendFileSync(e,t,r){let n=[];try{const i=xr(n,Rr`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(r?.mode!==void 0)try{let v=_t.openSync(e,"ax",r.mode);try{_t.appendFileSync(v,t)}finally{_t.closeSync(v)}return}catch(v){if(Uo(v)!=="EEXIST")throw v}_t.appendFileSync(e,t)}catch(o){var s=o,h=1}finally{kr(n,s,h)}},unlinkSync(e){let r=[];try{const t=xr(r,Rr`fs.unlinkSync(${e})`,0);_t.unlinkSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},renameSync(e,t){let i=[];try{const r=xr(i,Rr`fs.renameSync(${e} ${iC} ${t})`,0);_t.renameSync(e,t)}catch(n){var o=n,s=1}finally{kr(i,o,s)}},readlinkSync(e){let r=[];try{const t=xr(r,Rr`fs.readlinkSync(${e})`,0);return _t.readlinkSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},realpathSync(e){let r=[];try{const t=xr(r,Rr`fs.realpathSync(${e})`,0);return Jc(_t.realpathSync(e))}catch(i){var n=i,o=1}finally{kr(r,n,o)}},mkdirSync(e,t){let n=[];try{const r=xr(n,Rr`fs.mkdirSync(${e})`,0);let i={recursive:!0};if(t?.mode!==void 0)i.mode=t.mode;try{_t.mkdirSync(e,i)}catch(v){if(Uo(v)!=="EEXIST")throw v}}catch(o){var s=o,h=1}finally{kr(n,s,h)}},readdirSync(e){let r=[];try{const t=xr(r,Rr`fs.readdirSync(${e})`,0);return _t.readdirSync(e,{withFileTypes:!0})}catch(i){var n=i,o=1}finally{kr(r,n,o)}},rmSync(e,t){let i=[];try{const r=xr(i,Rr`fs.rmSync(${e})`,0);_t.rmSync(e,t)}catch(n){var o=n,s=1}finally{kr(i,o,s)}},createWriteStream(e){return _t.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return L2(e);let r=await U2(e,"r");try{let{size:i}=await r.stat(),n=Math.min(i,t),o=Buffer.allocUnsafe(n),s=0;while(s<n){let{bytesRead:h}=await r.read(o,s,n-s,s);if(h===0)break;s+=h}return s<n?o.subarray(0,s):o}finally{await r.close()}}},uC=aC;function Rh(){return uC}Nn();var{lstatSync:_pe,readFileSync:wpe,rmSync:Spe,unlinkSync:xpe,writeFileSync:kpe}=(()=>({}));function lC(e,t,r){if(e.destroyed||e.writableEnded)return!1;return e.write(t,r),!0}function F2(e){lC(process.stderr,e)}var cC=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,q2="[^\\s,;&}\\])]+",Z2="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",dC=`[^\\s-]{0,4}${Z2}['"\`]?`,B2=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${q2})|${dC}|${q2}`,fC=["sk","ant","api"].join("-"),hC=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${cC.source})[\\w.-]*["']?\\s*[=:]\\s*(${B2})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${B2})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:"\\b(AIza[\\w-]{35})(?![\\w-])",confidence:"high"},{id:"google-oauth-client-secret",source:"\\bGOCSPX-[\\w-]{28}(?![\\w-])",confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${fC}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:"sk-[A-Za-z0-9_-]{8,200}T3BlbkFJ[A-Za-z0-9_-]{8,200}",confidence:"high"},{id:"openai-legacy-api-key",source:"\\bsk-[a-zA-Z0-9]{48}(?![a-zA-Z0-9])",confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"supabase-secret-key",source:"\\bsb_secret_[A-Za-z0-9_-]{20,}",confidence:"high"},{id:"supabase-access-token",source:"\\bsbp_[a-z0-9]{40,}",confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:"glpat-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"},{id:"private-key",source:Z2,flags:"i",confidence:"high"}];var H2=null;function pC(e){return hC.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function mC(e,t){if(typeof t!=="string")return"[REDACTED]";let r=t.length>=2&&(t[0]==='"'||t[0]==="'")&&t.at(-1)===t[0]?t[0]:"",i=e.lastIndexOf(t);return`${e.slice(0,i)}${r}[REDACTED]${r}${e.slice(i+t.length)}`}var gC=512,yC=512,Tl=new Map;function K2(e){let t=e.length<=gC;if(t){let i=Tl.get(e);if(i!==void 0)return i}H2??=pC(!0);let r=e;for(let i of H2)r=r.replace(i.re,mC);if(t){if(Tl.size>=yC)Tl.delete(Tl.keys().next().value);Tl.set(e,r)}return r}var Ov={verbose:0,debug:1,info:2,warn:3,error:4},wC=Mr(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(e&&Object.hasOwn(Ov,e))return e;return"debug"}),SC=!1;function Ch(){if(typeof process>"u"||!Array.isArray(process.argv))return[];let e=process.argv.indexOf("--");return e===-1?process.argv:process.argv.slice(0,e)}var X2=Mr(()=>{let e=Ch();return SC||yo(process.env.DEBUG)||yo(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||Y2()||e.some((t)=>t.startsWith("--debug="))||Q2()!==null});var xC=Mr(()=>{let e=Ch().find((r)=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return gS(t)}),Y2=Mr(()=>{let e=Ch();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),Q2=Mr(()=>{let e=Ch();for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("--debug-file="))return G2(r.substring(13));if(r==="--debug-file"&&t+1<e.length)return G2(e[t+1])}return null});function G2(e){return pS(e)?null:ui(e)}function kC(e){if(!X2())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=xC();return yS(e,t)}var MC=!1;var EC=10485760,Pl=null,Av=Promise.resolve(),qs=[],Al=null,J2=null;var $l=-1,Rv=!1,Dv=null;async function IC(e,t,r=EC){if($l<0)$l=await bC(e).then((i)=>i.size).catch(()=>0);else $l+=t;if($l<=r||Rv)return;Rv=!0;try{let i=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;try{await W2(e,i)}catch(n){if(!j2(n))await Cv(i).catch(()=>{}),await W2(e,i).catch(()=>Cv(e).catch(()=>{}))}$l=0}finally{Rv=!1}}function e6(e){return Dv=Dn(e,`${Zm()}.txt`),Dv}async function TC(e,t,r,i){if(e)await vC(t,{recursive:!0}).catch(()=>{});let n=r;try{await V2(r,i)}catch(o){if(!Pv(o))throw o;n=e6(r),await V2(n,i)}await IC(n,Buffer.byteLength(i)).catch(t6),AC()}function t6(){}function PC(){qs.shift()}function $C(){if(!Pl){let e=null;if(Pl=cS({writeFn:(t)=>{if(Al){qs.push(t),Al();return}let r=Nv(),i=li(r),n=e!==i;e=i,qs.push(t),Av=Av.then(TC.bind(null,n,i,r,t)).catch(t6).then(PC)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:X2()}),mS(async()=>{Pl?.dispose(),await Av}),!J2)process.on("exit",J2=()=>{Al=()=>{if(qs.length===0)return;let t=qs.join("");qs.length=0;let r=Nv();try{Rh().mkdirSync(li(r))}catch{}try{Rh().appendFileSync(r,t)}catch(i){if(Pv(i))try{Rh().appendFileSync(e6(r),t)}catch{}}},Pl?.flush(),Al()})}return Pl}function Cr(e,{level:t}={level:"debug"}){if(Ov[t]<Ov[wC()])return;if(!kC(e))return;if(MC&&e.includes(`
94
+ `)){let _=b.indexOf(":");if(_>=0)v[b.substring(0,_).trim()]=b.substring(_+1).trim()}n.defaultHeaders={...v,...n.defaultHeaders}}let h=i.__auth;if(delete n.__auth,delete n.__baseURLIsExplicit,this._options=n,this.apiKey=typeof t==="string"?t:null,this.authToken=r,h){if(this._authState=h,!this._baseURLIsExplicit&&h.baseURL)this.baseURL=h.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let v=n.credentials??null;if(v)this._authState.provider=v,this._authState.tokenCache=this._makeTokenCache(v);else if(n.config!=null){let b=nv(n.config,this._credentialResolverOptions());this._authState.provider=b.provider,this._authState.tokenCache=this._makeTokenCache(b.provider),this._authState.extraHeaders=b.extraHeaders,this._applyCredentialBaseURL(b.baseURL)}else if(n.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(n.profile);else this._authState.resolution=this._resolveDefaultCredentials()}}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this.fetch,userAgent:this.getUserAgent(),onCacheWriteError:(e)=>{er(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:(e)=>{er(this).warn(e)}}}_makeTokenCache(e){return new Yy(e,(t)=>{er(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(e){let t="credentials"in e||"config"in e||"profile"in e,r="apiKey"in e||"authToken"in e||t,i={...this._options,...this._baseURLIsExplicit?{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,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...e,__auth:r?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e?!0:this._baseURLIsExplicit};return new this.constructor(i)}async _resolveDefaultCredentials(e){try{let t=await a2(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(e!=null)throw new Ye(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(e.get("x-api-key")||e.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&e.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&e.get("authorization"))return;if(t.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags(e){let t=this._requestAuthFlags.get(e);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t);return t}async authHeaders(e){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,_e([{Authorization:`Bearer ${t}`}])}return _e([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey==null)return;return _e([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken==null)return;return _e([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return Bx(e)}getUserAgent(){return`${this.constructor.name}/JS ${Mn}`}defaultIdempotencyKey(){return`stainless-node-retry-${Ky()}`}makeStatusError(e,t,r,i){return vr.generate(e,t,r,i)}buildURL(e,t,r){let i=!oe(this,Mv,"m",D2).call(this)&&r||this.baseURL,n=Rx(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery(),s=Object.fromEntries(n.searchParams);if(!Gy(o)||!Gy(s))t={...s,...o,...t};if(typeof t==="object"&&t&&!Array.isArray(t))n.search=this.stringifyQuery(t);return n.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128000>600)throw new Ye("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 600000}async prepareOptions(e){}async prepareRequest(e,{url:t,options:r}){if(this._authState.tokenCache&&this.apiKey==null){let i=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[o,s]of Object.entries(this._authState.extraHeaders))if(!i.has(o))i.set(o,s);if(!i.get("anthropic-beta")?.split(",").map((o)=>o.trim())?.includes(Po))i.append("anthropic-beta",Po);e.headers=i}}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,r){return this.request(Promise.resolve(r).then((i)=>({method:e,path:t,...i})))}request(e,t=null){return new $o(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,r){let i=await e,n=i.maxRetries??this.maxRetries;if(t==null)t=n,this._requestAuthFlags.delete(i);await this.prepareOptions(i);let{req:o,url:s,timeout:h}=await this.buildRequest(i,{retryCount:n-t});await this.prepareRequest(o,{url:s,options:i});let v="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),b=r===void 0?"":`, retryOf: ${r}`,_=Date.now();if(er(this).debug(`[${v}] sending request`,yi({retryOfRequestLogID:r,method:i.method,url:s,options:i,headers:o.headers})),i.signal?.aborted)throw new Ar;let g=new AbortController,S=await this.fetchWithTimeout(s,o,h,g).catch(Ou),x=Date.now();if(S instanceof globalThis.Error){let T=`retrying, ${t} attempts remaining`;if(i.signal?.aborted)throw new Ar;let P=gi(S)||/timed? ?out/i.test(String(S)+("cause"in S?String(S.cause):""));if(t)return er(this).info(`[${v}] connection ${P?"timed out":"failed"} - ${T}`),er(this).debug(`[${v}] connection ${P?"timed out":"failed"} (${T})`,yi({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),this.retryRequest(i,t,r??v);if(er(this).info(`[${v}] connection ${P?"timed out":"failed"} - error; no more retries left`),er(this).debug(`[${v}] connection ${P?"timed out":"failed"} (error; no more retries left)`,yi({retryOfRequestLogID:r,url:s,durationMs:x-_,message:S.message})),P)throw new Du;throw new To({cause:S})}let M=[...S.headers.entries()].filter(([T])=>T==="request-id").map(([T,P])=>", "+T+": "+JSON.stringify(P)).join(""),I=`[${v}${b}${M}] ${o.method} ${s} ${S.ok?"succeeded":"failed"} with status ${S.status} in ${x-_}ms`;if(!S.ok){let T=await this.shouldRetry(S,i);if(t&&T){let B=`retrying, ${t} attempts remaining`;return await Fx(S.body),er(this).info(`${I} - ${B}`),er(this).debug(`[${v}] response error (${B})`,yi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),this.retryRequest(i,t,r??v,S.headers)}let P=T?"error; no more retries left":"error; not retryable";er(this).info(`${I} - ${P}`);let $=await S.text().catch((B)=>Ou(B).message),R=Qf($),C=R?void 0:$;throw er(this).debug(`[${v}] response error (${P})`,yi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,message:C,durationMs:Date.now()-_})),this.makeStatusError(S.status,R,C,S.headers)}return er(this).info(I),er(this).debug(`[${v}] response start`,yi({retryOfRequestLogID:r,url:S.url,status:S.status,headers:S.headers,durationMs:x-_})),{response:S,options:i,controller:g,requestLogID:v,retryOfRequestLogID:r,startTime:_}}getAPIList(e,t,r){return this.requestAPIList(t,r&&"then"in r?r.then((i)=>({method:"get",path:e,...i})):{method:"get",path:e,...r})}requestAPIList(e,t){let r=this.makeRequest(t,null,void 0);return new dh(this,r,e)}async fetchWithTimeout(e,t,r,i){let{signal:n,method:o,...s}=t||{},h=this._makeAbort(i);if(n)n.addEventListener("abort",h,{once:!0});let v=setTimeout(h,r),b=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body==="object"&&s.body!==null&&Symbol.asyncIterator in s.body,_={signal:i.signal,...b?{duplex:"half"}:{},method:"GET",...s};if(o)_.method=o.toUpperCase();try{return await this.fetch.call(void 0,e,_)}finally{clearTimeout(v)}}async shouldRetry(e,t){let r=this._authFlags(t);if(e.status===401&&this._authState.tokenCache&&r.usedTokenCache&&!r.didRefreshFor401)return r.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let i=e.headers.get("x-should-retry");if(i==="true")return!0;if(i==="false")return!1;if(e.status===408)return!0;if(e.status===409)return!0;if(e.status===429)return!0;if(e.status>=500)return!0;return!1}async retryRequest(e,t,r,i){let n,o=i?.get("retry-after-ms");if(o){let h=parseFloat(o);if(!Number.isNaN(h))n=h}let s=i?.get("retry-after");if(s&&!n){let h=parseFloat(s);if(!Number.isNaN(h))n=h*1000;else n=Date.parse(s)-Date.now()}if(n===void 0){let h=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,h)}return await Dx(n),this.makeRequest(e,t-1,r)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e,o=Math.min(0.5*Math.pow(2,n),8),s=1-Math.random()*0.25;return o*s*1000}calculateNonstreamingTimeout(e,t){if(3600000*e/128000>600000||t!=null&&e>t)throw new Ye("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 600000}async buildRequest(e,{retryCount:t=0}={}){let r={...e},{method:i,path:n,query:o,defaultBaseURL:s}=r;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let h=this.buildURL(n,o,s);if("timeout"in r)Ox("timeout",r.timeout);r.timeout=r.timeout??this.timeout;let{bodyHeaders:v,body:b}=this.buildBody({options:r}),_=await this.buildHeaders({options:e,method:i,bodyHeaders:v,retryCount:t});return{req:{method:i,headers:_,...r.signal&&{signal:r.signal},...globalThis.ReadableStream&&b instanceof globalThis.ReadableStream&&{duplex:"half"},...b&&{body:b},...this.fetchOptions??{},...r.fetchOptions??{}},url:h,timeout:r.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:r,retryCount:i}){let n={};if(this.idempotencyHeader&&t!=="get"){if(!e.idempotencyKey)e.idempotencyKey=this.defaultIdempotencyKey();n[this.idempotencyHeader]=e.idempotencyKey}let o=_e([n,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1000))}:{},...Hu(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,r,e.headers]);return this.validateHeaders(o),o.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let r=_e([t]);if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==="string"&&r.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:e};else if(typeof e==="object"&&((Symbol.asyncIterator in e)||(Symbol.iterator in e)&&("next"in e)&&typeof e.next==="function"))return{bodyHeaders:void 0,body:eh(e)};else if(typeof e==="object"&&r.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)};else return oe(this,$h,"f").call(this,{body:e,headers:r})}}Ev=Jt,$h=new WeakMap,Mv=new WeakSet,D2=function(){return this.baseURL!=="https://api.anthropic.com"};Jt.Anthropic=Ev;Jt.HUMAN_PROMPT=N2;Jt.AI_PROMPT=z2;Jt.DEFAULT_TIMEOUT=600000;Jt.AnthropicError=Ye;Jt.APIError=vr;Jt.APIConnectionError=To;Jt.APIConnectionTimeoutError=Du;Jt.APIUserAbortError=Ar;Jt.NotFoundError=Uu;Jt.ConflictError=Lu;Jt.RateLimitError=qu;Jt.BadRequestError=Nu;Jt.AuthenticationError=zu;Jt.InternalServerError=Bu;Jt.PermissionDeniedError=ju;Jt.UnprocessableEntityError=Fu;Jt.toFile=fh;class jo extends Jt{constructor(){super(...arguments);this.completions=new Us(this),this.messages=new zo(this),this.models=new Fs(this),this.beta=new Fr(this)}}jo.Completions=Us;jo.Messages=zo;jo.Models=Fs;jo.Beta=Fr;function q7(e){return e}function Il(e){return q7(e)}class Iv extends Error{telemetryMessage;errorClass;constructor(e,t,r){super(e);this.name="TelemetrySafeError",this.telemetryMessage=t??e,this.errorClass=r}}function Tv(e){return e instanceof Error?e:Error(String(e))}function Ah(e){return e instanceof Error?e.message:String(e)}function Uo(e){if(e&&typeof e==="object"&&"code"in e&&typeof e.code==="string")return e.code;return}function j2(e){return Uo(e)==="ENOENT"}function Pv(e){return Uo(e)==="EISDIR"}var _t=(()=>({}));var{appendFile:B7,chmod:H7,copyFile:Z7,link:K7,lstat:V7,mkdir:W7,open:U2,readdir:G7,readFile:L2,readlink:J7,realpath:X7,rename:Y7,rmdir:Q7,rm:eC,stat:tC,symlink:rC,unlink:nC}=(()=>({}));Nn();var iC="→",vpe=process.platform==="win32"?/[\\/]+/:/\/+/;function $v(e){let t="";for(let i of e.split(/([\\/]+)/)){if(i==="."||i==="..")break;t+=i}let r=t.replace(/(?<=[^\\/])[\\/]+$/,"");return r===""?e:r}function oC(e){let t=Dn(e).replace(/(?<=[^\\/])[\\/]+$/,"");if(Gm(t)&&!Jm(t))return t;return $v(e)}function sC(e){if(e.startsWith("\\\\"))return $v(e);let t=e.replace(/^\/+/,"/"),r=hS(t);if(r!==null)return r;return $v(e)}var bpe=process.platform==="win32"?oC:sC;var aC={cwd(){return process.cwd()},existsSync(e){let r=[];try{const t=xr(r,Rr`fs.existsSync(${e})`,0);return _t.existsSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},async stat(e){return tC(e)},async lstat(e){return V7(e)},async readdir(e){return G7(e,{withFileTypes:!0})},async unlink(e){return nC(e)},async rmdir(e){return Q7(e)},async rm(e,t){return eC(e,t)},async mkdir(e,t){try{await W7(e,{recursive:!0,...t})}catch(r){if(Uo(r)!=="EEXIST")throw r}},async readFile(e,t){return L2(e,{encoding:t.encoding})},async rename(e,t){return Y7(e,t)},async realpath(e){return Jc(await X7(e))},async readlink(e){return J7(e)},async copyFile(e,t){return Z7(e,t)},async appendFile(e,t,r){if(r?.mode!==void 0)try{let i=await U2(e,"ax",r.mode);try{await i.appendFile(t)}finally{await i.close()}return}catch(i){if(Uo(i)!=="EEXIST")throw i}return B7(e,t)},async symlink(e,t,r){return rC(e,t,r)},async link(e,t){return K7(e,t)},async chmod(e,t){return H7(e,t)},statSync(e){let r=[];try{const t=xr(r,Rr`fs.statSync(${e})`,0);return _t.statSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},lstatSync(e){let r=[];try{const t=xr(r,Rr`fs.lstatSync(${e})`,0);return _t.lstatSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},readFileSync(e,t){let i=[];try{const r=xr(i,Rr`fs.readFileSync(${e})`,0);return _t.readFileSync(e,{encoding:t.encoding})}catch(n){var o=n,s=1}finally{kr(i,o,s)}},readFileBytesSync(e){let r=[];try{const t=xr(r,Rr`fs.readFileBytesSync(${e})`,0);return _t.readFileSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},readSync(e,t){let n=[];try{const r=xr(n,Rr`fs.readSync(${e}, ${t.length} bytes)`,0);let i=void 0;try{i=_t.openSync(e,"r");let v=Buffer.alloc(t.length),b=_t.readSync(i,v,0,t.length,0);return{buffer:v,bytesRead:b}}finally{if(i)_t.closeSync(i)}}catch(o){var s=o,h=1}finally{kr(n,s,h)}},appendFileSync(e,t,r){let n=[];try{const i=xr(n,Rr`fs.appendFileSync(${e}, ${t.length} chars)`,0);if(r?.mode!==void 0)try{let v=_t.openSync(e,"ax",r.mode);try{_t.appendFileSync(v,t)}finally{_t.closeSync(v)}return}catch(v){if(Uo(v)!=="EEXIST")throw v}_t.appendFileSync(e,t)}catch(o){var s=o,h=1}finally{kr(n,s,h)}},unlinkSync(e){let r=[];try{const t=xr(r,Rr`fs.unlinkSync(${e})`,0);_t.unlinkSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},renameSync(e,t){let i=[];try{const r=xr(i,Rr`fs.renameSync(${e} ${iC} ${t})`,0);_t.renameSync(e,t)}catch(n){var o=n,s=1}finally{kr(i,o,s)}},readlinkSync(e){let r=[];try{const t=xr(r,Rr`fs.readlinkSync(${e})`,0);return _t.readlinkSync(e)}catch(i){var n=i,o=1}finally{kr(r,n,o)}},realpathSync(e){let r=[];try{const t=xr(r,Rr`fs.realpathSync(${e})`,0);return Jc(_t.realpathSync(e))}catch(i){var n=i,o=1}finally{kr(r,n,o)}},mkdirSync(e,t){let n=[];try{const r=xr(n,Rr`fs.mkdirSync(${e})`,0);let i={recursive:!0};if(t?.mode!==void 0)i.mode=t.mode;try{_t.mkdirSync(e,i)}catch(v){if(Uo(v)!=="EEXIST")throw v}}catch(o){var s=o,h=1}finally{kr(n,s,h)}},readdirSync(e){let r=[];try{const t=xr(r,Rr`fs.readdirSync(${e})`,0);return _t.readdirSync(e,{withFileTypes:!0})}catch(i){var n=i,o=1}finally{kr(r,n,o)}},rmSync(e,t){let i=[];try{const r=xr(i,Rr`fs.rmSync(${e})`,0);_t.rmSync(e,t)}catch(n){var o=n,s=1}finally{kr(i,o,s)}},createWriteStream(e){return _t.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return L2(e);let r=await U2(e,"r");try{let{size:i}=await r.stat(),n=Math.min(i,t),o=Buffer.allocUnsafe(n),s=0;while(s<n){let{bytesRead:h}=await r.read(o,s,n-s,s);if(h===0)break;s+=h}return s<n?o.subarray(0,s):o}finally{await r.close()}}},uC=aC;function Rh(){return uC}Nn();var{lstatSync:xpe,readFileSync:kpe,rmSync:Mpe,unlinkSync:Epe,writeFileSync:Ipe}=(()=>({}));function lC(e,t,r){if(e.destroyed||e.writableEnded)return!1;return e.write(t,r),!0}function F2(e){lC(process.stderr,e)}var cC=/api[_-]?key|secret|token|password|passwd|credential|bearer|authorization|auth[_-]?header|cookie|session[_-]?(?:id|key)|connection[_-]?string|(?:private|ssh|encryption|signing|access|deploy|master|license)[_-]?key|client[_-]?secret/i,q2="[^\\s,;&}\\])]+",Z2="-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\\s\\S-]{64,}?-----END[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----",dC=`[^\\s-]{0,4}${Z2}['"\`]?`,B2=`\\[REDACTED\\]|"[^"]*"|'[^']*'|(?:Bearer|Basic)\\s+(?:\\[REDACTED\\]|${q2})|${dC}|${q2}`,fC=["sk","ant","api"].join("-"),hC=[{id:"url-userinfo",source:":\\/\\/([^/@\\s]+)@",confidence:"low"},{id:"gcp-service-account",source:"\\b([a-z0-9-]+@[a-z0-9-]+\\.iam\\.gserviceaccount\\.com)\\b",flags:"i",confidence:"low"},{id:"loose-anthropic-key",source:"\\b(sk-ant-?[\\w-]{10,})",confidence:"low"},{id:"http-auth-scheme",source:"\\b(?:Bearer|Basic)\\s+([A-Za-z0-9+/=._~-]{20,})",flags:"i",confidence:"low"},{id:"loose-jwt",source:"\\b(eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,})",confidence:"low"},{id:"sensitive-assign",source:`(?:${cC.source})[\\w.-]*["']?\\s*[=:]\\s*(${B2})`,flags:"i",confidence:"low"},{id:"cloud-env-var",source:`\\b(?:AWS|GOOGLE|GCP|GCLOUD|AZURE)_\\w+\\s*[=:]\\s*(${B2})`,flags:"i",confidence:"low"},{id:"aws-access-token",source:"\\b((?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})\\b",confidence:"high"},{id:"gcp-api-key",source:"\\b(AIza[\\w-]{35})(?![\\w-])",confidence:"high"},{id:"google-oauth-client-secret",source:"\\bGOCSPX-[\\w-]{28}(?![\\w-])",confidence:"high"},{id:"azure-ad-client-secret",source:`(?:^|[\\\\'"\\x60\\s>=:(,)])([a-zA-Z0-9_~.]{3}\\dQ~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'"\\x60\\s<),])`,confidence:"high"},{id:"digitalocean-pat",source:`\\b(dop_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"digitalocean-access-token",source:`\\b(doo_v1_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-api-key",source:`\\b(${fC}03-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"anthropic-admin-api-key",source:`\\b(sk-ant-admin01-[a-zA-Z0-9_\\-]{93}AA)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"openai-api-key",source:"sk-[A-Za-z0-9_-]{8,200}T3BlbkFJ[A-Za-z0-9_-]{8,200}",confidence:"high"},{id:"openai-legacy-api-key",source:"\\bsk-[a-zA-Z0-9]{48}(?![a-zA-Z0-9])",confidence:"high"},{id:"huggingface-access-token",source:`\\b(hf_[a-zA-Z]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"supabase-secret-key",source:"\\bsb_secret_[A-Za-z0-9_-]{20,}",confidence:"high"},{id:"supabase-access-token",source:"\\bsbp_[a-z0-9]{40,}",confidence:"high"},{id:"github-pat",source:"ghp_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-fine-grained-pat",source:"github_pat_\\w{82}",confidence:"high"},{id:"github-app-token",source:"(?:ghu|ghs)_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-oauth",source:"gho_[0-9a-zA-Z]{36}",confidence:"high"},{id:"github-refresh-token",source:"ghr_[0-9a-zA-Z]{36}",confidence:"high"},{id:"gitlab-pat",source:"glpat-[\\w-]{20}",confidence:"high"},{id:"gitlab-deploy-token",source:"gldt-[0-9a-zA-Z_\\-]{20}",confidence:"high"},{id:"slack-bot-token",source:"xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*",confidence:"high"},{id:"slack-user-token",source:"xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}",confidence:"high"},{id:"slack-app-token",source:"xapp-\\d-[A-Z0-9]+-\\d+-[a-z0-9]+",flags:"i",confidence:"high"},{id:"twilio-api-key",source:"SK[0-9a-fA-F]{32}",confidence:"high"},{id:"sendgrid-api-token",source:`\\b(SG\\.[a-zA-Z0-9=_\\-.]{66})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"npm-access-token",source:`\\b(npm_[a-zA-Z0-9]{36})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"pypi-upload-token",source:"pypi-AgEIcHlwaS5vcmc[\\w-]{50,1000}",confidence:"high"},{id:"databricks-api-token",source:`\\b(dapi[a-f0-9]{32}(?:-\\d)?)(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"hashicorp-tf-api-token",source:"[a-zA-Z0-9]{14}\\.atlasv1\\.[a-zA-Z0-9\\-_=]{60,70}",confidence:"high"},{id:"pulumi-api-token",source:`\\b(pul-[a-f0-9]{40})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"postman-api-token",source:`\\b(PMAK-[a-fA-F0-9]{24}-[a-fA-F0-9]{34})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-api-key",source:`\\b(eyJrIjoi[A-Za-z0-9+/]{70,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-cloud-api-token",source:`\\b(glc_[A-Za-z0-9+/]{32,400}={0,3})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"grafana-service-account-token",source:`\\b(glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-user-token",source:`\\b(sntryu_[a-f0-9]{64})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"sentry-org-token",source:"\\bsntrys_eyJpYXQiO[a-zA-Z0-9+/]{10,200}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10,200}={0,2}_[a-zA-Z0-9+/]{43}",confidence:"high"},{id:"stripe-access-token",source:`\\b((?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})(?:[\\x60'"\\s;]|\\\\[nr]|$)`,confidence:"high"},{id:"shopify-access-token",source:"shpat_[a-fA-F0-9]{32}",confidence:"high"},{id:"shopify-shared-secret",source:"shpss_[a-fA-F0-9]{32}",confidence:"high"},{id:"private-key",source:Z2,flags:"i",confidence:"high"}];var H2=null;function pC(e){return hC.map((t)=>({id:t.id,confidence:t.confidence,re:new RegExp(t.source,e?(t.flags??"").replace("g","")+"g":t.flags??"")}))}function mC(e,t){if(typeof t!=="string")return"[REDACTED]";let r=t.length>=2&&(t[0]==='"'||t[0]==="'")&&t.at(-1)===t[0]?t[0]:"",i=e.lastIndexOf(t);return`${e.slice(0,i)}${r}[REDACTED]${r}${e.slice(i+t.length)}`}var gC=512,yC=512,Tl=new Map;function K2(e){let t=e.length<=gC;if(t){let i=Tl.get(e);if(i!==void 0)return i}H2??=pC(!0);let r=e;for(let i of H2)r=r.replace(i.re,mC);if(t){if(Tl.size>=yC)Tl.delete(Tl.keys().next().value);Tl.set(e,r)}return r}var Ov={verbose:0,debug:1,info:2,warn:3,error:4},wC=Mr(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(e&&Object.hasOwn(Ov,e))return e;return"debug"}),SC=!1;function Ch(){if(typeof process>"u"||!Array.isArray(process.argv))return[];let e=process.argv.indexOf("--");return e===-1?process.argv:process.argv.slice(0,e)}var X2=Mr(()=>{let e=Ch();return SC||yo(process.env.DEBUG)||yo(process.env.DEBUG_SDK)||e.includes("--debug")||e.includes("-d")||Y2()||e.some((t)=>t.startsWith("--debug="))||Q2()!==null});var xC=Mr(()=>{let e=Ch().find((r)=>r.startsWith("--debug="));if(!e)return null;let t=e.substring(8);return gS(t)}),Y2=Mr(()=>{let e=Ch();return e.includes("--debug-to-stderr")||e.includes("-d2e")}),Q2=Mr(()=>{let e=Ch();for(let t=0;t<e.length;t++){let r=e[t];if(r.startsWith("--debug-file="))return G2(r.substring(13));if(r==="--debug-file"&&t+1<e.length)return G2(e[t+1])}return null});function G2(e){return pS(e)?null:ui(e)}function kC(e){if(!X2())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let t=xC();return yS(e,t)}var MC=!1;var EC=10485760,Pl=null,Av=Promise.resolve(),qs=[],Al=null,J2=null;var $l=-1,Rv=!1,Dv=null;async function IC(e,t,r=EC){if($l<0)$l=await bC(e).then((i)=>i.size).catch(()=>0);else $l+=t;if($l<=r||Rv)return;Rv=!0;try{let i=e.endsWith(".txt")?`${e.slice(0,-4)}.1.txt`:`${e}.1`;try{await W2(e,i)}catch(n){if(!j2(n))await Cv(i).catch(()=>{}),await W2(e,i).catch(()=>Cv(e).catch(()=>{}))}$l=0}finally{Rv=!1}}function e6(e){return Dv=Dn(e,`${Zm()}.txt`),Dv}async function TC(e,t,r,i){if(e)await vC(t,{recursive:!0}).catch(()=>{});let n=r;try{await V2(r,i)}catch(o){if(!Pv(o))throw o;n=e6(r),await V2(n,i)}await IC(n,Buffer.byteLength(i)).catch(t6),AC()}function t6(){}function PC(){qs.shift()}function $C(){if(!Pl){let e=null;if(Pl=cS({writeFn:(t)=>{if(Al){qs.push(t),Al();return}let r=Nv(),i=li(r),n=e!==i;e=i,qs.push(t),Av=Av.then(TC.bind(null,n,i,r,t)).catch(t6).then(PC)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:X2()}),mS(async()=>{Pl?.dispose(),await Av}),!J2)process.on("exit",J2=()=>{Al=()=>{if(qs.length===0)return;let t=qs.join("");qs.length=0;let r=Nv();try{Rh().mkdirSync(li(r))}catch{}try{Rh().appendFileSync(r,t)}catch(i){if(Pv(i))try{Rh().appendFileSync(e6(r),t)}catch{}}},Pl?.flush(),Al()})}return Pl}function Cr(e,{level:t}={level:"debug"}){if(Ov[t]<Ov[wC()])return;if(!kC(e))return;if(MC&&e.includes(`
95
95
  `))e=yn(e);let i=`${new Date().toISOString()} [${t.toUpperCase()}] ${K2(e.trim())}
96
- `;if(Y2()){F2(i);return}let n=$C();if(n.write(i),Al)n.flush()}function Nv(){return Q2()??Dv??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??Dn(Ax(),"debug",`${Zm()}.txt`)}var AC=Mr(async()=>{try{let e=Nv(),t=li(e),r=Dn(t,"latest");await Cv(r).catch(()=>{}),await _C(e,r)}catch{}});var nme=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})();var RC={[Symbol.dispose](){}};function CC(){return RC}var Rr=CC;function yn(e,t,r){let n=[];try{const i=xr(n,Rr`JSON.stringify(${e})`,0);return JSON.stringify(e,t,r)}catch(o){var s=o,h=1}finally{kr(n,s,h)}}var Bs=(e,t)=>{let i=[];try{const r=xr(i,Rr`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(n){var o=n,s=1}finally{kr(i,o,s)}};class Lo{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((e,t)=>{this.readResolve=e,this.readReject=t})}enqueue(e){if(this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let t=this.readReject;this.readResolve=void 0,this.readReject=void 0,t(e)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}var OC=1000;function DC(){return{eventQueue:[],sink:null,droppedEventCount:0}}function NC(e,t){if(e.eventQueue.length>=OC)e.eventQueue.shift(),e.droppedEventCount++;e.eventQueue.push(t)}var zC=DC();function Rl(e,t){let r=zC;if(r.sink===null){NC(r,{eventName:e,metadata:t,async:!1});return}r.sink.logEvent(e,t)}function jC(e,t){Rl("tengu_feature_ok",{feature_name:Il(e),...t})}function UC(e,t,r){Rl("tengu_feature_bad",{...r,feature_name:Il(e),error_code:t})}async function vn(e,t,r){try{let i=await t();return jC(e),i}catch(i){throw UC(e,r?.(i)??"error"),i}}class zv{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(e)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}var jv=Symbol("suppressControlResponse");class Oh{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;unmatchedControlResponses=new Map;static UNMATCHED_CONTROL_RESPONSES_MAX=1024;cleanupPerformed=!1;sdkMessages;inputStream=new Lo;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;initHooksPayload;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;latestCommands;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(e){this.isSingleUserTurn=e}setTranscriptMirrorBatcher(e){this.transcriptMirrorBatcher=e}reportMirrorError(e,t){let r={type:"system",subtype:"mirror_error",error:t,key:e,uuid:va(),session_id:e.sessionId};this.inputStream.enqueue(r)}addCleanupCallback(e){if(this.cleanupPerformed)e();else this.cleanupCallbacks.push(e)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.onUserDialog!==void 0||this.getOAuthToken!==void 0||this.getHostAuthToken!==void 0}constructor(e,t,r,i,n,o=new Map,s,h,v,b,_,g){this.transport=e;this.isSingleUserTurn=t;this.canUseTool=r;this.hooks=i;this.abortController=n;this.jsonSchema=s;this.initConfig=h;this.onElicitation=v;this.getOAuthToken=b;this.getHostAuthToken=_;this.onUserDialog=g;for(let[S,x]of o)this.connectSdkMcpServer(S,x);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(e){this.inputStream.error(e)}async stopTask(e){await this.request({subtype:"stop_task",task_id:e})}async backgroundTasks(e){return(await this.request({subtype:"background_tasks",tool_use_id:e})).response.backgrounded??!0}close(){this.cleanup()}cleanup(e){if(this.cleanupPromise)return this.cleanupPromise;return this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(e),this.cleanupPromise}async performCleanup(e){for(let t of this.cleanupCallbacks)try{t()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let r of this.cancelControllers.values())r.abort();this.cancelControllers.clear(),this.transport.close();let t=e??Error("Query closed before response received");for(let{reject:r}of this.pendingControlResponses.values())r(t);this.pendingControlResponses.clear(),this.unmatchedControlResponses.clear();for(let{reject:r}of this.pendingMcpResponses.values())r(t);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let r of this.sdkMcpTransports.values())r.close().catch(()=>{});if(this.sdkMcpTransports.clear(),e)this.inputStream.error(e);else this.inputStream.done()}catch(t){}if(this.transport.waitForExit){let t=new AbortController;try{await Promise.race([this.transport.waitForExit(),im(2000,t.signal)])}catch{}finally{t.abort()}}}next(...[e]){return this.sdkMessages.next(...[e])}async return(e){return await this.cleanup(),this.sdkMessages.return(e)}async throw(e){return await this.cleanup(),this.sdkMessages.throw(e)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let e of this.transport.readMessages()){if(e.type==="control_response"){let t=this.pendingControlResponses.get(e.response.request_id);if(t)t.handler(e.response);else{if(this.unmatchedControlResponses.size>=Oh.UNMATCHED_CONTROL_RESPONSES_MAX){let r=this.unmatchedControlResponses.keys().next().value;if(r!==void 0)this.unmatchedControlResponses.delete(r)}this.unmatchedControlResponses.set(e.response.request_id,e.response)}continue}else if(e.type==="control_request"){this.handleControlRequest(e);continue}else if(e.type==="control_cancel_request"){this.handleControlCancelRequest(e);continue}else if(e.type==="keep_alive")continue;else if(e.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(e.filePath,e.entries);continue}if(e.type==="system"&&e.subtype==="commands_changed"&&Array.isArray(e.commands))this.latestCommands=e.commands;if(e.type==="system"&&(e.subtype==="post_turn_summary"||e.subtype==="task_summary")){this.inputStream.enqueue(e);continue}if(e.type==="active_goal"){this.inputStream.enqueue(e);continue}if(e.type==="result"){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();let t=e.is_error?e.subtype==="success"?e.result:e.errors.map((r)=>r.trim()).filter(Boolean).join("; "):void 0;if(this.lastErrorResultText=t||void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)Cr("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput()}else if(!(e.type==="system"&&e.subtype==="session_state_changed"))this.lastErrorResultText=void 0;this.inputStream.enqueue(e)}if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.done(),this.cleanup()}catch(e){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.lastErrorResultText!==void 0&&!(e instanceof On)&&e?.name!=="SSEHttpError"){let t=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);Cr(`[Query.readMessages] Replacing exit error with result text. Original: ${Ah(e)}`),this.inputStream.error(t),this.cleanup(t);return}this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){if(this.cancelControllers.has(e.request_id)){Cr(`[Query.handleControlRequest] Duplicate delivery of in-flight request ${e.request_id} (${e.request.subtype}) — skipping`);return}let t=new AbortController;this.cancelControllers.set(e.request_id,t);try{let r=await this.processControlRequest(e,t.signal);if(this.cleanupPerformed)return;if(r===jv)return;let i={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:r}};await Promise.resolve(this.transport.write(yn(i)+`
96
+ `;if(Y2()){F2(i);return}let n=$C();if(n.write(i),Al)n.flush()}function Nv(){return Q2()??Dv??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??Dn(Ax(),"debug",`${Zm()}.txt`)}var AC=Mr(async()=>{try{let e=Nv(),t=li(e),r=Dn(t,"latest");await Cv(r).catch(()=>{}),await _C(e,r)}catch{}});var sme=(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})();var RC={[Symbol.dispose](){}};function CC(){return RC}var Rr=CC;function yn(e,t,r){let n=[];try{const i=xr(n,Rr`JSON.stringify(${e})`,0);return JSON.stringify(e,t,r)}catch(o){var s=o,h=1}finally{kr(n,s,h)}}var Bs=(e,t)=>{let i=[];try{const r=xr(i,Rr`JSON.parse(${e})`,0);return typeof t>"u"?JSON.parse(e):JSON.parse(e,t)}catch(n){var o=n,s=1}finally{kr(i,o,s)}};class Lo{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){if(this.queue.length>0)return Promise.resolve({done:!1,value:this.queue.shift()});if(this.isDone)return Promise.resolve({done:!0,value:void 0});if(this.hasError)return Promise.reject(this.hasError);return new Promise((e,t)=>{this.readResolve=e,this.readReject=t})}enqueue(e){if(this.readResolve){let t=this.readResolve;this.readResolve=void 0,this.readReject=void 0,t({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let t=this.readReject;this.readResolve=void 0,this.readReject=void 0,t(e)}}return(){if(this.isDone=!0,this.returned)this.returned();return Promise.resolve({done:!0,value:void 0})}}var OC=1000;function DC(){return{eventQueue:[],sink:null,droppedEventCount:0}}function NC(e,t){if(e.eventQueue.length>=OC)e.eventQueue.shift(),e.droppedEventCount++;e.eventQueue.push(t)}var zC=DC();function Rl(e,t){let r=zC;if(r.sink===null){NC(r,{eventName:e,metadata:t,async:!1});return}r.sink.logEvent(e,t)}function jC(e,t){Rl("tengu_feature_ok",{feature_name:Il(e),...t})}function UC(e,t,r){Rl("tengu_feature_bad",{...r,feature_name:Il(e),error_code:t})}async function vn(e,t,r){try{let i=await t();return jC(e),i}catch(i){throw UC(e,r?.(i)??"error"),i}}class zv{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(e)}async close(){if(this.isClosed)return;this.isClosed=!0,this.onclose?.()}}var jv=Symbol("suppressControlResponse");class Oh{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;getHostAuthToken;onUserDialog;pendingControlResponses=new Map;unmatchedControlResponses=new Map;static UNMATCHED_CONTROL_RESPONSES_MAX=1024;cleanupPerformed=!1;sdkMessages;inputStream=new Lo;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;initHooksPayload;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;latestCommands;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(e){this.isSingleUserTurn=e}setTranscriptMirrorBatcher(e){this.transcriptMirrorBatcher=e}reportMirrorError(e,t){let r={type:"system",subtype:"mirror_error",error:t,key:e,uuid:va(),session_id:e.sessionId};this.inputStream.enqueue(r)}addCleanupCallback(e){if(this.cleanupPerformed)e();else this.cleanupCallbacks.push(e)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.onUserDialog!==void 0||this.getOAuthToken!==void 0||this.getHostAuthToken!==void 0}constructor(e,t,r,i,n,o=new Map,s,h,v,b,_,g){this.transport=e;this.isSingleUserTurn=t;this.canUseTool=r;this.hooks=i;this.abortController=n;this.jsonSchema=s;this.initConfig=h;this.onElicitation=v;this.getOAuthToken=b;this.getHostAuthToken=_;this.onUserDialog=g;for(let[S,x]of o)this.connectSdkMcpServer(S,x);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(e){this.inputStream.error(e)}async stopTask(e){await this.request({subtype:"stop_task",task_id:e})}async backgroundTasks(e){return(await this.request({subtype:"background_tasks",tool_use_id:e})).response.backgrounded??!0}close(){this.cleanup()}cleanup(e){if(this.cleanupPromise)return this.cleanupPromise;return this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(e),this.cleanupPromise}async performCleanup(e){for(let t of this.cleanupCallbacks)try{t()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let r of this.cancelControllers.values())r.abort();this.cancelControllers.clear(),this.transport.close();let t=e??Error("Query closed before response received");for(let{reject:r}of this.pendingControlResponses.values())r(t);this.pendingControlResponses.clear(),this.unmatchedControlResponses.clear();for(let{reject:r}of this.pendingMcpResponses.values())r(t);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let r of this.sdkMcpTransports.values())r.close().catch(()=>{});if(this.sdkMcpTransports.clear(),e)this.inputStream.error(e);else this.inputStream.done()}catch(t){}if(this.transport.waitForExit){let t=new AbortController;try{await Promise.race([this.transport.waitForExit(),im(2000,t.signal)])}catch{}finally{t.abort()}}}next(...[e]){return this.sdkMessages.next(...[e])}async return(e){return await this.cleanup(),this.sdkMessages.return(e)}async throw(e){return await this.cleanup(),this.sdkMessages.throw(e)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let e of this.transport.readMessages()){if(e.type==="control_response"){let t=this.pendingControlResponses.get(e.response.request_id);if(t)t.handler(e.response);else{if(this.unmatchedControlResponses.size>=Oh.UNMATCHED_CONTROL_RESPONSES_MAX){let r=this.unmatchedControlResponses.keys().next().value;if(r!==void 0)this.unmatchedControlResponses.delete(r)}this.unmatchedControlResponses.set(e.response.request_id,e.response)}continue}else if(e.type==="control_request"){this.handleControlRequest(e);continue}else if(e.type==="control_cancel_request"){this.handleControlCancelRequest(e);continue}else if(e.type==="keep_alive")continue;else if(e.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(e.filePath,e.entries);continue}if(e.type==="system"&&e.subtype==="commands_changed"&&Array.isArray(e.commands))this.latestCommands=e.commands;if(e.type==="system"&&(e.subtype==="post_turn_summary"||e.subtype==="task_summary")){this.inputStream.enqueue(e);continue}if(e.type==="active_goal"){this.inputStream.enqueue(e);continue}if(e.type==="result"){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();let t=e.is_error?e.subtype==="success"?e.result:e.errors.map((r)=>r.trim()).filter(Boolean).join("; "):void 0;if(this.lastErrorResultText=t||void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.isSingleUserTurn)Cr("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput()}else if(!(e.type==="system"&&e.subtype==="session_state_changed"))this.lastErrorResultText=void 0;this.inputStream.enqueue(e)}if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();this.inputStream.done(),this.cleanup()}catch(e){if(this.transcriptMirrorBatcher)await this.transcriptMirrorBatcher.flush();if(this.firstResultReceivedResolve)this.firstResultReceivedResolve();if(this.lastErrorResultText!==void 0&&!(e instanceof On)&&e?.name!=="SSEHttpError"){let t=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);Cr(`[Query.readMessages] Replacing exit error with result text. Original: ${Ah(e)}`),this.inputStream.error(t),this.cleanup(t);return}this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){if(this.cancelControllers.has(e.request_id)){Cr(`[Query.handleControlRequest] Duplicate delivery of in-flight request ${e.request_id} (${e.request.subtype}) — skipping`);return}let t=new AbortController;this.cancelControllers.set(e.request_id,t);try{let r=await this.processControlRequest(e,t.signal);if(this.cleanupPerformed)return;if(r===jv)return;let i={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:r}};await Promise.resolve(this.transport.write(yn(i)+`
97
97
  `))}catch(r){if(this.cleanupPerformed)return;let i={type:"control_response",response:{subtype:"error",request_id:e.request_id,error:Ah(r)}};try{await Promise.resolve(this.transport.write(yn(i)+`
98
98
  `))}catch(n){Cr(`[Query.handleControlRequest] Error-response write failed: ${Ah(n)}`,{level:"error"})}}finally{this.cancelControllers.delete(e.request_id)}}handleControlCancelRequest(e){let t=this.cancelControllers.get(e.request_id);if(t)t.abort(),this.cancelControllers.delete(e.request_id)}async processControlRequest(e,t){if(e.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");let r=await this.canUseTool(e.request.tool_name,e.request.input,{signal:t,suggestions:e.request.permission_suggestions,blockedPath:e.request.blocked_path,decisionReason:e.request.decision_reason,title:e.request.title,displayName:e.request.display_name,description:e.request.description,toolUseID:e.request.tool_use_id,agentID:e.request.agent_id,requestId:e.request_id,...e.request.matched_ask_rule&&{matchedAskRule:{source:e.request.matched_ask_rule.source,toolName:e.request.matched_ask_rule.tool_name,...e.request.matched_ask_rule.rule_content!==void 0&&{ruleContent:e.request.matched_ask_rule.rule_content}}}});if(r===null)return jv;return{...r,toolUseID:e.request.tool_use_id}}else if(e.request.subtype==="hook_callback")return await this.handleHookCallbacks(e.request.callback_id,e.request.input,e.request.tool_use_id,t);else if(e.request.subtype==="mcp_message"){let r=e.request,i=this.sdkMcpTransports.get(r.server_name);if(!i)throw Error(`SDK MCP server not found: ${r.server_name}`);if("method"in r.message&&"id"in r.message&&r.message.id!==null)return{mcp_response:await this.handleMcpControlRequest(r.server_name,r,i)};else{if(i.onmessage)i.onmessage(r.message);return{mcp_response:{jsonrpc:"2.0",result:{},id:0}}}}else if(e.request.subtype==="elicitation"){let r=e.request;if(this.onElicitation)return await this.onElicitation({serverName:r.mcp_server_name,message:r.message,mode:r.mode,url:r.url,elicitationId:r.elicitation_id,requestedSchema:r.requested_schema,title:r.title,displayName:r.display_name,description:r.description},{signal:t});return{action:"decline"}}else if(e.request.subtype==="request_user_dialog"){if(this.onUserDialog)return await this.onUserDialog({dialogKind:e.request.dialog_kind,payload:e.request.payload,toolUseID:e.request.tool_use_id},{signal:t});return Cr(`[Query] No onUserDialog handler for request_user_dialog (kind=${e.request.dialog_kind}) — staying silent so a capable client (or the worker's park deadline) settles it`),Rl("tengu_request_user_dialog_response_ignored",{shape:Il("auto_cancel")}),jv}else if(e.request.subtype==="oauth_token_refresh"){if(!this.getOAuthToken)throw Error("getOAuthToken callback is not provided.");return{accessToken:await this.getOAuthToken({signal:t})??null}}else if(e.request.subtype==="host_auth_token_refresh"){if(!this.getHostAuthToken)throw Error("getHostAuthToken callback is not provided.");return{authToken:await this.getHostAuthToken({signal:t})??null}}throw Error("Unsupported control request subtype: "+e.request.subtype)}async*readSdkMessages(){try{for await(let e of this.inputStream)yield e}finally{await this.cleanup()}}async initialize(){if(this.hooks&&!this.initHooksPayload){this.initHooksPayload={};for(let[i,n]of Object.entries(this.hooks))if(n.length>0)this.initHooksPayload[i]=n.map((o)=>{let s=[];for(let h of o.hooks){let v=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(v,h),s.push(v)}return{matcher:o.matcher,hookCallbackIds:s,timeout:o.timeout}})}let e=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,t={subtype:"initialize",hooks:this.initHooksPayload,sdkMcpServers:e,jsonSchema:this.jsonSchema,systemPrompt:typeof this.initConfig?.systemPrompt==="string"?[this.initConfig.systemPrompt]:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,planModeInstructions:this.initConfig?.planModeInstructions,appendSubagentSystemPrompt:this.initConfig?.appendSubagentSystemPrompt,toolAliases:this.initConfig?.toolAliases,excludeDynamicSections:this.initConfig?.excludeDynamicSections,agents:this.initConfig?.agents,title:this.initConfig?.title,skills:Array.isArray(this.initConfig?.skills)?this.initConfig.skills:void 0,webSearchIsolationExemptMcpServers:this.initConfig?.webSearchIsolationExemptMcpServers,promptSuggestions:this.initConfig?.promptSuggestions,agentProgressSummaries:this.initConfig?.agentProgressSummaries,forwardSubagentText:this.initConfig?.forwardSubagentText,supportedDialogKinds:this.initConfig?.supportedDialogKinds};return(await this.request(t)).response}async interrupt(){return vn("sdk_interrupt",async()=>{let t=(await this.request({subtype:"interrupt"})).response?.still_queued;return Array.isArray(t)?{still_queued:t.filter((r)=>typeof r==="string")}:void 0})}async setPermissionMode(e){await this.request({subtype:"set_permission_mode",mode:e})}async setMcpPermissionModeOverride(e,t){return(await this.request({subtype:"set_mcp_permission_mode_override",serverName:e,mode:t})).response??{}}awaitControlResponse(e){return this.transport.expectControlResponse?.(e),new Promise((t,r)=>{let i=(o)=>{if(o.subtype==="success"){let{pending_permission_requests:s,pending_user_dialog_requests:h,...v}=o;t(v)}else r(new Iv(o.error,"awaitControlResponse: CLI error verdict"));if(o.pending_permission_requests||o.pending_user_dialog_requests)Cr("[Query] Ignoring prompt-redelivery fields on awaitControlResponse response")};if(this.cleanupPerformed){r(Error("Query closed before response received"));return}let n=this.unmatchedControlResponses.get(e);if(n){this.unmatchedControlResponses.delete(e),i(n);return}this.pendingControlResponses.set(e,{handler:(o)=>{this.pendingControlResponses.delete(e),i(o)},reject:r})})}async setModel(e){await this.request({subtype:"set_model",model:e})}async setMaxThinkingTokens(e,t){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:e,thinking_display:t})}async applyFlagSettings(e){return vn("sdk_apply_flag_settings",async()=>{await this.request({subtype:"apply_flag_settings",settings:e})})}async getSettings(){return(await this.request({subtype:"get_settings"})).response}async rewindFiles(e,t){return vn("sdk_rewind_files",async()=>(await this.request({subtype:"rewind_files",user_message_id:e,dry_run:t?.dryRun})).response)}async cancelAsyncMessage(e){return(await this.request({subtype:"cancel_async_message",message_uuid:e})).response.cancelled}async seedReadState(e,t){await this.request({subtype:"seed_read_state",path:e,mtime:t})}async setCwd(e,t){return vn("sdk_set_cwd",async()=>(await this.request({subtype:"set_cwd",path:e,...t?.trustAccepted!==void 0&&{trust_accepted:t.trustAccepted},...t?.trustedDirectory!==void 0&&{trusted_directory:t.trustedDirectory}})).response)}async enableRemoteControl(e,t){return(await this.request({subtype:"remote_control",enabled:e,...t!==void 0&&{name:t}})).response}async submitFeedback(e,t){return(await this.request({subtype:"submit_feedback",description:e,surface:t?.surface})).response}async generateSessionTitle(e,t){return vn("sdk_session_title_generate",async()=>(await this.request({subtype:"generate_session_title",description:e,persist:t?.persist})).response.title)}async askSideQuestion(e){return vn("sdk_side_question",async()=>{let r=(await this.request({subtype:"side_question",question:e})).response;return r.response===null?null:{response:r.response,synthetic:r.synthetic??!1}})}async launchUltrareview(e,t){return(await this.request({subtype:"ultrareview_launch",args:e,confirm:t?.confirm??!1})).response}async messageRated(e){await this.request({subtype:"message_rated",messageUuid:e.messageUuid,sentiment:e.sentiment,surface:e.surface,cleared:e.cleared??!1})}processPendingPermissionRequests(e){for(let t of e)if(t.request.subtype==="can_use_tool")this.handleControlRequest(t).catch(()=>{})}processPendingUserDialogRequests(e){for(let t of e)if(t.request.subtype==="request_user_dialog")this.handleControlRequest(t).catch(()=>{})}request(e){let t=Math.random().toString(36).substring(2,15);this.transport.expectControlResponse?.(t);let r={request_id:t,type:"control_request",request:e},i=e.subtype==="initialize";return new Promise((n,o)=>{this.pendingControlResponses.set(t,{handler:(s)=>{if(this.pendingControlResponses.delete(t),s.subtype==="success")n(s);else o(Error(s.error));if(!i&&(s.pending_permission_requests||s.pending_user_dialog_requests))Cr(`[Query] Ignoring prompt-redelivery fields on non-initialize response (subtype=${e.subtype})`);else{if(s.pending_permission_requests)this.processPendingPermissionRequests(s.pending_permission_requests);if(s.pending_user_dialog_requests)this.processPendingUserDialogRequests(s.pending_user_dialog_requests)}},reject:o}),Promise.resolve(this.transport.write(yn(r)+`
99
99
  `)).catch((s)=>{this.pendingControlResponses.delete(t),o(s)})})}initializationResult(){return this.initialization}reinitialize(){return vn("sdk_reinitialize",()=>this.initialize())}async supportedCommands(){let{commands:e}=await this.initialization;return this.latestCommands??e}async supportedModels(){return(await this.initialization).models}async supportedAgents(){return(await this.initialization).agents}async reconnectMcpServer(e){await this.request({subtype:"mcp_reconnect",serverName:e})}async toggleMcpServer(e,t){return vn("sdk_mcp_toggle_server",async()=>{await this.request({subtype:"mcp_toggle",serverName:e,enabled:t})})}async enableChannel(e){return vn("sdk_mcp_enable_channel",async()=>{await this.request({subtype:"channel_enable",serverName:e})})}async mcpAuthenticate(e,t){return(await this.request({subtype:"mcp_authenticate",serverName:e,redirectUri:t})).response}async mcpClearAuth(e){return(await this.request({subtype:"mcp_clear_auth",serverName:e})).response}async mcpSubmitOAuthCallbackUrl(e,t){return(await this.request({subtype:"mcp_oauth_callback_url",serverName:e,callbackUrl:t})).response}async claudeAuthenticate(e){return(await this.request({subtype:"claude_authenticate",loginWithClaudeAi:e})).response}async claudeOAuthCallback(e,t){return(await this.request({subtype:"claude_oauth_callback",authorizationCode:e,state:t})).response}async claudeOAuthWaitForCompletion(){return(await this.request({subtype:"claude_oauth_wait_for_completion"})).response}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async getContextUsage(){return(await this.request({subtype:"get_context_usage"})).response}async usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET(){return(await this.request({subtype:"get_usage"})).response}async readFile(e,t){try{return(await this.request({subtype:"read_file",path:e,max_bytes:t?.maxBytes,encoding:t?.encoding})).response}catch{return null}}async reloadPlugins(){return vn("sdk_reload_plugins",async()=>(await this.request({subtype:"reload_plugins"})).response)}async reloadSkills(){return vn("sdk_reload_skills",async()=>(await this.request({subtype:"reload_skills"})).response)}async setMcpServers(e){return vn("sdk_mcp_set_servers",async()=>{let t={},r={};for(let[h,v]of Object.entries(e))if(v.type==="sdk"&&"instance"in v)t[h]=v.instance;else r[h]=v;let i=new Set(this.sdkMcpServerInstances.keys()),n=new Set(Object.keys(t));for(let h of i)if(!n.has(h))await this.disconnectSdkMcpServer(h);for(let[h,v]of Object.entries(t))if(!i.has(h))this.connectSdkMcpServer(h,v);let o={};for(let h of Object.keys(t))o[h]={type:"sdk",name:h};return(await this.request({subtype:"mcp_set_servers",servers:{...r,...o}})).response})}async accountInfo(){return(await this.initialization).account}async streamInput(e){Cr("[Query.streamInput] Starting to process input stream");try{let t=0;for await(let r of e){if(t++,Cr(`[Query.streamInput] Processing message ${t}: ${r.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(yn(r)+`
@@ -102,8 +102,8 @@ new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
102
102
  `+s:s;break}}return t.data||r?t:null}class Lv{decoder=new TextDecoder;pending=[];pendingLength=0;push(e){let t=typeof e==="string"?e:this.decoder.decode(e,LC);if(!t)return[];return this.drain(t)}flush(){let e=this.decoder.decode();if(e)this.pending.push(e),this.pendingLength+=e.length;let t=this.joinPending();this.pending=[],this.pendingLength=0;let r=n6(t);return r?[r]:[]}buffered(){return this.joinPending()}drain(e){let t=[],r=this.pendingLength,i=Math.min(3,r),n=this.tail(i)+e,o=r-i,s=0,h=-1;for(;;){let v=FC(n,s);if(!v)break;let b=o+v.contentEnd,_;if(h===-1){let S=this.joinPending();_=b<=r?S.slice(0,b):S+e.slice(0,b-r)}else _=e.slice(h-r,b-r);let g=n6(_);if(g)t.push(g);h=o+v.afterDelim,s=v.afterDelim}if(h===-1)this.pending.push(e),this.pendingLength=r+e.length;else{let v=e.slice(h-r);this.pending=v?[v]:[],this.pendingLength=v.length}return t}tail(e){if(e<=0)return"";let t=e,r="";for(let i=this.pending.length-1;i>=0&&t>0;i--){let n=this.pending[i];if(n.length<=t)r=n+r,t-=n.length;else r=n.slice(n.length-t)+r,t=0}return r}joinPending(){return this.pending.length===1?this.pending[0]:this.pending.join("")}}var qC=15000,i6=1000,o6=30000,s6=5,BC=45000,HC=30000,ZC=3,KC=1000,a6=new Set([401,403,404]),VC=new Set(["user","env_manager_log"]);class Bv{options;ready=!1;closed=!1;abortController;streamAbort=null;messages=new Lo;exitError;readyPromise;readyResolve;readyReject;abortHandler;livenessTimer;reconnectTimer;reconnectAttempts=0;lastEventId="";expectedControlResponseIds=new Set;uploader;constructor(e){this.options=e;if(this.abortController=e.abortController||new AbortController,this.readyPromise=new Promise((t,r)=>{this.readyResolve=t,this.readyReject=r}),this.readyPromise.catch(()=>{}),this.uploader=new Uv({maxBatchSize:1,maxQueueSize:KC,baseDelayMs:i6,maxDelayMs:o6,jitterMs:250,maxConsecutiveFailures:ZC,send:(t)=>this.postOnce(t[0])}),this.abortHandler=()=>{this.exitError=new On("SSE connection aborted by user"),this.close()},this.abortController.signal.aborted)this.abortHandler();else this.abortController.signal.addEventListener("abort",this.abortHandler);this.connect()}buildHeaders(e){return{...this.options.headers??{},...e}}async connect(){if(this.closed)return;this.streamAbort=new AbortController;let e=this.streamAbort.signal,t=this.buildHeaders({Accept:"text/event-stream"});if(this.lastEventId)t["Last-Event-ID"]=this.lastEventId;let r=this.options.connectTimeoutMs??qC,i=Date.now()+r,n=setTimeout(()=>{this.streamAbort?.abort(),this.handleStreamEnd(Error("SSE connect timeout"))},r),o;try{o=await fetch(this.options.streamUrl,{method:"GET",headers:t,signal:e})}catch(s){if(clearTimeout(n),this.closed||e.aborted)return;return this.handleStreamEnd(Tv(s))}if(!o.ok||!o.body){clearTimeout(n);let s=o.status,h=setTimeout(()=>{this.streamAbort?.abort()},Math.max(0,i-Date.now())),v=await u6(o);if(clearTimeout(h),this.closed)return;let b=new qv("SSE connect failed",s,v);if(a6.has(s))return this.fail(b);return this.handleStreamEnd(b)}if(clearTimeout(n),this.closed){o.body.cancel().catch(()=>{});return}this.ready=!0,this.reconnectAttempts=0,this.resetLivenessTimer(),this.readyResolve?.(),this.readStream(o.body,e)}async readStream(e,t){let r=e.getReader(),i=new Lv;try{while(!t.aborted){let{done:n,value:o}=await r.read();if(n)break;this.resetLivenessTimer();for(let s of i.push(o)){if(s.id)this.lastEventId=s.id;if(!s.data)continue;if(s.event!=="client_event"&&s.event!=="ephemeral_event")continue;try{let h=Bs(s.data),v=h.payload;if(!v||typeof v.type!=="string")continue;if(s.event==="ephemeral_event"){if(v.type==="stream_event"){this.messages.enqueue(v);continue}if(v.type==="system"&&v.subtype==="thinking_tokens"){let b=v;this.messages.enqueue({type:"system",subtype:"thinking_tokens",estimated_tokens:b.estimated_tokens,estimated_tokens_delta:b.estimated_tokens_delta,uuid:b.uuid,session_id:b.session_id});continue}console.debug(`[BrowserSSETransport] Dropping ${v.type} on ephemeral_event (only stream_event and system:thinking_tokens ride ephemeral)`);continue}if(h.source!=="worker"&&v.type!=="control_response"&&!VC.has(v.type))continue;if(v.type==="control_response"){let b=v.response;if(!b||typeof b!=="object"||typeof b.request_id!=="string"){console.debug(`[BrowserSSETransport] Dropping malformed control_response from source=${h.source}`);continue}let _=b.request_id;if(this.expectedControlResponseIds.has(_)){if(h.source!=="worker")continue;this.expectedControlResponseIds.delete(_)}if(h.source!=="worker"&&(("pending_user_dialog_requests"in b)||("pending_permission_requests"in b))){let{pending_user_dialog_requests:g,pending_permission_requests:S,...x}=b;this.messages.enqueue({...v,response:x});continue}}this.messages.enqueue(v)}catch{}}}}catch(n){if(!this.closed&&!t.aborted)return this.handleStreamEnd(Tv(n));return}finally{r.releaseLock()}if(!this.closed&&!t.aborted)this.handleStreamEnd()}handleStreamEnd(e){if(this.ready=!1,this.clearLivenessTimer(),this.closed)return;if(this.reconnectAttempts>=s6)return this.fail(e??Error(`SSE reconnect budget exhausted (${s6} attempts)`));this.reconnectAttempts++;let t=Math.min(i6*2**(this.reconnectAttempts-1),o6);clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=void 0,this.connect()},t)}fail(e){this.exitError=this.exitError??e,this.close()}resetLivenessTimer(){this.clearLivenessTimer(),this.livenessTimer=setTimeout(()=>{this.streamAbort?.abort(),this.handleStreamEnd(Error("SSE liveness timeout"))},BC)}clearLivenessTimer(){if(this.livenessTimer)clearTimeout(this.livenessTimer),this.livenessTimer=void 0}expectControlResponse(e){if(this.expectedControlResponseIds.add(e),this.expectedControlResponseIds.size>1024){let t=this.expectedControlResponseIds.values().next().value;if(t!==void 0)this.expectedControlResponseIds.delete(t)}}async write(e){if(this.abortController.signal.aborted)throw new On("Operation aborted");if(!this.ready)await this.readyPromise;if(this.closed)throw this.exitError??Error("SSETransport is closed");let t=Bs(e),r=!t||typeof t!=="object"||Array.isArray(t)||typeof t.uuid==="string"&&t.uuid?e:JSON.stringify({...t,uuid:crypto.randomUUID()});await this.uploader.enqueue(r)}async postOnce(e){let t=this.buildHeaders({"Content-Type":"application/json"}),r=JSON.stringify({session_id:this.options.sessionId,events:[{payload:Bs(e)}]}),i=GC([this.abortController.signal,AbortSignal.timeout(HC)]);try{let n=await fetch(this.options.sendUrl,{method:"POST",headers:t,body:r,signal:i.signal});if(n.ok){n.body?.cancel();return}if(a6.has(n.status)){let h=await u6(n);throw this.fail(new qv(`POST ${this.options.sendUrl}`,n.status,h)),Error(`permanent HTTP ${n.status}`)}n.body?.cancel();let o=n.headers.get("Retry-After"),s=o?Number(o):NaN;throw new Dh(`POST ${this.options.sendUrl}: HTTP ${n.status}`,Number.isFinite(s)?s*1000:void 0)}finally{i.detach()}}close(){if(this.closed)return;if(this.closed=!0,!this.ready)this.readyReject?.(this.exitError??new On("SSE transport closed before connect"));if(this.ready=!1,clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0,this.clearLivenessTimer(),this.streamAbort?.abort(),this.uploader.close(),this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;this.messages.done()}[Symbol.dispose](){this.close()}isReady(){return this.ready&&!this.closed}endInput(){}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}var WC=128,Fv=4096;class qv extends Error{code;reason;constructor(e,t,r){super(`${e}: HTTP ${t}`);this.name="SSEHttpError",this.code=t,this.reason=r}}async function u6(e){let t=e.body?.getReader();if(!t)return;try{let r=new Uint8Array(Fv),i=0;for(;;){let{done:h,value:v}=await t.read();if(h||!v)break;let b=Math.min(v.length,Fv-i);if(r.set(v.subarray(0,b),i),i+=b,i>=Fv)break}let n=JSON.parse(new TextDecoder().decode(r.subarray(0,i))),o=n?.error?.resource??n?.error?.type;if(typeof o!=="string")return;return o.replace(/[\p{Cc}\p{Cf}]/gu,"").slice(0,WC)||void 0}catch{return}finally{t.cancel().catch(()=>{})}}function GC(e){let t=AbortSignal;if(typeof t.any==="function")return{signal:t.any(e),detach:()=>{}};let r=new AbortController,i=[];for(let n of e){if(n.aborted){r.abort(n.reason);break}let o=()=>r.abort(n.reason);n.addEventListener("abort",o,{once:!0}),i.push([n,o])}return{signal:r.signal,detach:()=>{for(let[n,o]of i)n.removeEventListener("abort",o)}}}var l6=15000,JC=50000;class Hv{options;ws;ready=!1;abortController;messages=new Lo;exitError;readyPromise;readyResolve;readyReject;abortHandler;keepAliveTimer;partialLine="";constructor(e){this.options=e;this.abortController=e.abortController||new AbortController,this.readyPromise=new Promise((t,r)=>{this.readyResolve=t,this.readyReject=r}),this.readyPromise.catch(()=>{}),this.initialize()}initialize(){try{let{url:e}=this.options,t=new URL(e);if(!t.protocol.startsWith("ws"))throw Error("WebSocket URL must use ws:// or wss:// protocol");this.ws=new globalThis.WebSocket(t.toString());let r=setTimeout(()=>{if(!this.ready){this.ws?.close();let i=Error(`WebSocket connection timeout after ${l6}ms`);if(this.exitError=i,this.readyReject)this.readyReject(i)}},l6);if(this.ws.onopen=()=>{if(clearTimeout(r),this.ready=!0,this.readyResolve)this.readyResolve();if(this.options.authMessage&&this.ws)try{this.ws.send(yn(this.options.authMessage)+`
103
103
  `)}catch{}this.keepAliveTimer=setInterval(()=>{if(this.ws&&this.ws.readyState===globalThis.WebSocket.OPEN)try{this.ws.send(yn({type:"keep_alive"})+`
104
104
  `)}catch{}},JC)},this.ws.onerror=(i)=>{clearTimeout(r),this.ready=!1;let n=Error("WebSocket connection error");if(this.exitError=n,this.readyReject)this.readyReject(n);this.messages.done()},this.ws.onclose=(i)=>{if(this.ready=!1,this.keepAliveTimer)clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0;if(i.code!==1000&&i.code!==1001)this.exitError=Error(`WebSocket closed abnormally with code ${i.code}: ${i.reason}`);this.messages.done()},this.ws.onmessage=(i)=>{if(typeof i.data!=="string")return;let o=(this.partialLine+i.data).split(`
105
- `);this.partialLine=o.pop()??"";for(let s of o){if(!s)continue;try{this.messages.enqueue(Bs(s))}catch(h){}}},this.abortHandler=()=>{this.close(),this.exitError=new On("WebSocket connection aborted by user")},this.abortController.signal.aborted)this.abortHandler();else this.abortController.signal.addEventListener("abort",this.abortHandler)}catch(e){if(this.ready=!1,this.exitError=e,this.readyReject)this.readyReject(e);throw e}}async write(e){if(this.abortController.signal.aborted)throw new On("Operation aborted");if(!this.ready)await this.readyPromise;if(!this.ready||!this.ws||this.ws.readyState!==globalThis.WebSocket.OPEN)throw Error("WebSocketTransport is not ready for writing");this.ws.send(e)}close(){if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;if(this.keepAliveTimer)clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0;if(this.ws&&this.ws.readyState===globalThis.WebSocket.OPEN)this.ws.close(1000,"Normal closure");this.ready=!1,this.messages.done()}[Symbol.dispose](){this.close()}isReady(){return this.ready&&this.ws?.readyState===globalThis.WebSocket.OPEN}endInput(){}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}function c6(e){return new AbortController}var wt;(function(e){e.assertEqual=(n)=>{};function t(n){}e.assertIs=t;function r(n){throw Error()}e.assertNever=r,e.arrayToEnum=(n)=>{let o={};for(let s of n)o[s]=s;return o},e.getValidEnumValues=(n)=>{let o=e.objectKeys(n).filter((h)=>typeof n[n[h]]!=="number"),s={};for(let h of o)s[h]=n[h];return e.objectValues(s)},e.objectValues=(n)=>e.objectKeys(n).map(function(o){return n[o]}),e.objectKeys=typeof Object.keys==="function"?(n)=>Object.keys(n):(n)=>{let o=[];for(let s in n)if(Object.prototype.hasOwnProperty.call(n,s))o.push(s);return o},e.find=(n,o)=>{for(let s of n)if(o(s))return s;return},e.isInteger=typeof Number.isInteger==="function"?(n)=>Number.isInteger(n):(n)=>typeof n==="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,o=" | "){return n.map((s)=>typeof s==="string"?`'${s}'`:s).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(n,o)=>{if(typeof o==="bigint")return o.toString();return o}})(wt||(wt={}));var d6;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(d6||(d6={}));var Ze=wt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wi=(e)=>{switch(typeof e){case"undefined":return Ze.undefined;case"string":return Ze.string;case"number":return Number.isNaN(e)?Ze.nan:Ze.number;case"boolean":return Ze.boolean;case"function":return Ze.function;case"bigint":return Ze.bigint;case"symbol":return Ze.symbol;case"object":if(Array.isArray(e))return Ze.array;if(e===null)return Ze.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return Ze.promise;if(typeof Map<"u"&&e instanceof Map)return Ze.map;if(typeof Set<"u"&&e instanceof Set)return Ze.set;if(typeof Date<"u"&&e instanceof Date)return Ze.date;return Ze.object;default:return Ze.unknown}};var Ue=wt.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"]);class bn extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},r={_errors:[]},i=(n)=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let s=r,h=0;while(h<o.path.length){let v=o.path[h];if(h!==o.path.length-1)s[v]=s[v]||{_errors:[]};else s[v]=s[v]||{_errors:[]},s[v]._errors.push(t(o));s=s[v],h++}}};return i(this),r}static assert(e){if(!(e instanceof bn))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let i of this.issues)if(i.path.length>0){let n=i.path[0];t[n]=t[n]||[],t[n].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}bn.create=(e)=>new bn(e);var XC=(e,t)=>{let r;switch(e.code){case Ue.invalid_type:if(e.received===Ze.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case Ue.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,wt.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:r=`Unrecognized key(s) in object: ${wt.joinValues(e.keys,", ")}`;break;case Ue.invalid_union:r="Invalid input";break;case Ue.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${wt.joinValues(e.options)}`;break;case Ue.invalid_enum_value:r=`Invalid enum value. Expected ${wt.joinValues(e.options)}, received '${e.received}'`;break;case Ue.invalid_arguments:r="Invalid function arguments";break;case Ue.invalid_return_type:r="Invalid function return type";break;case Ue.invalid_date:r="Invalid date";break;case Ue.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else wt.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case Ue.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case Ue.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case Ue.custom:r="Invalid input";break;case Ue.invalid_intersection_types:r="Intersection results could not be merged";break;case Ue.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ue.not_finite:r="Number must be finite";break;default:r=t.defaultError,wt.assertNever(e)}return{message:r}},Ji=XC;var YC=Ji;function Cl(){return YC}var Nh=(e)=>{let{data:t,path:r,errorMaps:i,issueData:n}=e,o=[...r,...n.path||[]],s={...n,path:o};if(n.message!==void 0)return{...n,path:o,message:n.message};let h="",v=i.filter((b)=>!!b).slice().reverse();for(let b of v)h=b(s,{data:t,defaultError:h}).message;return{...n,path:o,message:h}};function Je(e,t){let r=Cl(),i=Nh({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ji?void 0:Ji].filter((n)=>!!n)});e.common.issues.push(i)}class qr{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let i of t){if(i.status==="aborted")return ot;if(i.status==="dirty")e.dirty();r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let i of t){let n=await i.key,o=await i.value;r.push({key:n,value:o})}return qr.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:n,value:o}=i;if(n.status==="aborted")return ot;if(o.status==="aborted")return ot;if(n.status==="dirty")e.dirty();if(o.status==="dirty")e.dirty();if(n.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet))r[n.value]=o.value}return{status:e.value,value:r}}}var ot=Object.freeze({status:"aborted"}),Hs=(e)=>({status:"dirty",value:e}),Wr=(e)=>({status:"valid",value:e}),Zv=(e)=>e.status==="aborted",Kv=(e)=>e.status==="dirty",Fo=(e)=>e.status==="valid",Ol=(e)=>typeof Promise<"u"&&e instanceof Promise;var et;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(et||(et={}));class Ln{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var f6=(e,t)=>{if(Fo(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new bn(e.common.issues);return this._error=r,this._error}}}};function ft(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:n};return{errorMap:(s,h)=>{let{message:v}=e;if(s.code==="invalid_enum_value")return{message:v??h.defaultError};if(typeof h.data>"u")return{message:v??i??h.defaultError};if(s.code!=="invalid_type")return{message:h.defaultError};return{message:v??r??h.defaultError}},description:n}}class vt{get description(){return this._def.description}_getType(e){return wi(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:wi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qr,ctx:{common:e.parent.common,data:e.data,parsedType:wi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ol(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wi(e)},i=this._parseSync({data:e,path:r.path,parent:r});return f6(r,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wi(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Fo(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>Fo(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wi(e)},i=this._parse({data:e,path:r.path,parent:r}),n=await(Ol(i)?i:Promise.resolve(i));return f6(r,n)}refine(e,t){let r=(i)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(i);else return t};return this._refinement((i,n)=>{let o=e(i),s=()=>n.addIssue({code:Ue.custom,...r(i)});if(typeof Promise<"u"&&o instanceof Promise)return o.then((h)=>{if(!h)return s(),!1;else return!0});if(!o)return s(),!1;else return!0})}refinement(e,t){return this._refinement((r,i)=>{if(!e(r))return i.addIssue(typeof t==="function"?t(r,i):t),!1;else return!0})}_refinement(e){return new ei({schema:this,typeName:Le.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:(t)=>this["~validate"](t)}}optional(){return Tn.create(this,this._def)}nullable(){return Xi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qn.create(this)}promise(){return Gs.create(this,this._def)}or(e){return Ul.create([this,e],this._def)}and(e){return Ll.create(this,e,this._def)}transform(e){return new ei({...ft(this._def),schema:this,typeName:Le.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new Hl({...ft(this._def),innerType:this,defaultValue:t,typeName:Le.ZodDefault})}brand(){return new Jv({typeName:Le.ZodBranded,type:this,...ft(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new Zl({...ft(this._def),innerType:this,catchValue:t,typeName:Le.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Hh.create(this,e)}readonly(){return Kl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var QC=/^c[^\s-]{8,}$/i,eO=/^[0-9a-z]+$/,tO=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rO=/^[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,nO=/^[a-z0-9_-]{21}$/i,iO=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,oO=/^[-+]?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)?)??$/,sO=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Vv,uO=/^(?:(?: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])$/,lO=/^(?:(?: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])$/,cO=/^(([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]))$/,dO=/^(([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])$/,fO=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hO=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,h6="((\\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])))",pO=new RegExp(`^${h6}$`);function p6(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function mO(e){return new RegExp(`^${p6(e)}$`)}function gO(e){let t=`${h6}T${p6(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function yO(e,t){if((t==="v4"||!t)&&uO.test(e))return!0;if((t==="v6"||!t)&&cO.test(e))return!0;return!1}function vO(e,t){if(!iO.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));if(typeof n!=="object"||n===null)return!1;if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&n.alg!==t)return!1;return!0}catch{return!1}}function bO(e,t){if((t==="v4"||!t)&&lO.test(e))return!0;if((t==="v6"||!t)&&dO.test(e))return!0;return!1}class xi extends vt{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==Ze.string){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.string,received:n.parsedType}),ot}let r=new qr,i=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.length<n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="max"){if(e.data.length>n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="length"){let o=e.data.length>n.value,s=e.data.length<n.value;if(o||s){if(i=this._getOrReturnCtx(e,i),o)Je(i,{code:Ue.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});else if(s)Je(i,{code:Ue.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});r.dirty()}}else if(n.kind==="email"){if(!sO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"email",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="emoji"){if(!Vv)Vv=new RegExp(aO,"u");if(!Vv.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"emoji",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="uuid"){if(!rO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"uuid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="nanoid"){if(!nO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"nanoid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid"){if(!QC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cuid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid2"){if(!eO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cuid2",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ulid"){if(!tO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"ulid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Je(i,{validation:"url",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="regex"){if(n.regex.lastIndex=0,!n.regex.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"regex",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="trim")e.data=e.data.trim();else if(n.kind==="includes"){if(!e.data.includes(n.value,n.position))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()}else if(n.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(n.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(n.kind==="startsWith"){if(!e.data.startsWith(n.value))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="endsWith"){if(!e.data.endsWith(n.value))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="datetime"){if(!gO(n).test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"datetime",message:n.message}),r.dirty()}else if(n.kind==="date"){if(!pO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"date",message:n.message}),r.dirty()}else if(n.kind==="time"){if(!mO(n).test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"time",message:n.message}),r.dirty()}else if(n.kind==="duration"){if(!oO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"duration",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ip"){if(!yO(e.data,n.version))i=this._getOrReturnCtx(e,i),Je(i,{validation:"ip",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="jwt"){if(!vO(e.data,n.alg))i=this._getOrReturnCtx(e,i),Je(i,{validation:"jwt",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cidr"){if(!bO(e.data,n.version))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cidr",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64"){if(!fO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"base64",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64url"){if(!hO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"base64url",code:Ue.invalid_string,message:n.message}),r.dirty()}else wt.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((i)=>e.test(i),{validation:t,code:Ue.invalid_string,...et.errToObj(r)})}_addCheck(e){return new xi({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...et.errToObj(e)})}url(e){return this._addCheck({kind:"url",...et.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...et.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...et.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...et.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...et.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...et.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...et.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...et.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...et.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...et.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...et.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...et.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...et.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...et.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...et.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...et.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...et.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...et.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...et.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...et.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...et.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...et.errToObj(t)})}nonempty(e){return this.min(1,et.errToObj(e))}trim(){return new xi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new xi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new xi({...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 t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}xi.create=(e)=>new xi({checks:[],typeName:Le.ZodString,coerce:e?.coerce??!1,...ft(e)});function _O(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return o%s/10**n}class Ks extends vt{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);if(this._getType(e)!==Ze.number){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.number,received:n.parsedType}),ot}let r=void 0,i=new qr;for(let n of this._def.checks)if(n.kind==="int"){if(!wt.isInteger(e.data))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()}else if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()}else if(n.kind==="multipleOf"){if(_O(e.data,n.value)!==0)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()}else if(n.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_finite,message:n.message}),i.dirty()}else wt.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,i){return new Ks({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(i)}]})}_addCheck(e){return new Ks({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:et.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:et.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:et.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:et.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&wt.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}Ks.create=(e)=>new Ks({checks:[],typeName:Le.ZodNumber,coerce:e?.coerce||!1,...ft(e)});class Vs extends vt{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)!==Ze.bigint)return this._getInvalidInput(e);let r=void 0,i=new qr;for(let n of this._def.checks)if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()}else if(n.kind==="multipleOf"){if(e.data%n.value!==BigInt(0))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()}else wt.assertNever(n);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Je(t,{code:Ue.invalid_type,expected:Ze.bigint,received:t.parsedType}),ot}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,i){return new Vs({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(i)}]})}_addCheck(e){return new Vs({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}Vs.create=(e)=>new Vs({checks:[],typeName:Le.ZodBigInt,coerce:e?.coerce??!1,...ft(e)});class zh extends vt{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==Ze.boolean){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.boolean,received:r.parsedType}),ot}return Wr(e.data)}}zh.create=(e)=>new zh({typeName:Le.ZodBoolean,coerce:e?.coerce||!1,...ft(e)});class Nl extends vt{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==Ze.date){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.date,received:n.parsedType}),ot}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_date}),ot}let r=new qr,i=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.getTime()<n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()}else if(n.kind==="max"){if(e.data.getTime()>n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()}else wt.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Nl({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:et.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:et.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}Nl.create=(e)=>new Nl({checks:[],coerce:e?.coerce||!1,typeName:Le.ZodDate,...ft(e)});class jh extends vt{_parse(e){if(this._getType(e)!==Ze.symbol){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.symbol,received:r.parsedType}),ot}return Wr(e.data)}}jh.create=(e)=>new jh({typeName:Le.ZodSymbol,...ft(e)});class zl extends vt{_parse(e){if(this._getType(e)!==Ze.undefined){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.undefined,received:r.parsedType}),ot}return Wr(e.data)}}zl.create=(e)=>new zl({typeName:Le.ZodUndefined,...ft(e)});class jl extends vt{_parse(e){if(this._getType(e)!==Ze.null){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.null,received:r.parsedType}),ot}return Wr(e.data)}}jl.create=(e)=>new jl({typeName:Le.ZodNull,...ft(e)});class Uh extends vt{constructor(){super(...arguments);this._any=!0}_parse(e){return Wr(e.data)}}Uh.create=(e)=>new Uh({typeName:Le.ZodAny,...ft(e)});class qo extends vt{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Wr(e.data)}}qo.create=(e)=>new qo({typeName:Le.ZodUnknown,...ft(e)});class ki extends vt{_parse(e){let t=this._getOrReturnCtx(e);return Je(t,{code:Ue.invalid_type,expected:Ze.never,received:t.parsedType}),ot}}ki.create=(e)=>new ki({typeName:Le.ZodNever,...ft(e)});class Lh extends vt{_parse(e){if(this._getType(e)!==Ze.undefined){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.void,received:r.parsedType}),ot}return Wr(e.data)}}Lh.create=(e)=>new Lh({typeName:Le.ZodVoid,...ft(e)});class Qn extends vt{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==Ze.array)return Je(t,{code:Ue.invalid_type,expected:Ze.array,received:t.parsedType}),ot;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,s=t.data.length<i.exactLength.value;if(o||s)Je(t,{code:o?Ue.too_big:Ue.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty()}if(i.minLength!==null){if(t.data.length<i.minLength.value)Je(t,{code:Ue.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()}if(i.maxLength!==null){if(t.data.length>i.maxLength.value)Je(t,{code:Ue.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((o,s)=>i.type._parseAsync(new Ln(t,o,t.path,s)))).then((o)=>qr.mergeArray(r,o));let n=[...t.data].map((o,s)=>i.type._parseSync(new Ln(t,o,t.path,s)));return qr.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new Qn({...this._def,minLength:{value:e,message:et.toString(t)}})}max(e,t){return new Qn({...this._def,maxLength:{value:e,message:et.toString(t)}})}length(e,t){return new Qn({...this._def,exactLength:{value:e,message:et.toString(t)}})}nonempty(e){return this.min(1,e)}}Qn.create=(e,t)=>new Qn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Le.ZodArray,...ft(t)});function Zs(e){if(e instanceof Xt){let t={};for(let r in e.shape){let i=e.shape[r];t[r]=Tn.create(Zs(i))}return new Xt({...e._def,shape:()=>t})}else if(e instanceof Qn)return new Qn({...e._def,type:Zs(e.element)});else if(e instanceof Tn)return Tn.create(Zs(e.unwrap()));else if(e instanceof Xi)return Xi.create(Zs(e.unwrap()));else if(e instanceof Mi)return Mi.create(e.items.map((t)=>Zs(t)));else return e}class Xt extends vt{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(),t=wt.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Ze.object){let v=this._getOrReturnCtx(e);return Je(v,{code:Ue.invalid_type,expected:Ze.object,received:v.parsedType}),ot}let{status:r,ctx:i}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof ki&&this._def.unknownKeys==="strip")){for(let v in i.data)if(!o.includes(v))s.push(v)}let h=[];for(let v of o){let b=n[v],_=i.data[v];h.push({key:{status:"valid",value:v},value:b._parse(new Ln(i,_,i.path,v)),alwaysSet:v in i.data})}if(this._def.catchall instanceof ki){let v=this._def.unknownKeys;if(v==="passthrough")for(let b of s)h.push({key:{status:"valid",value:b},value:{status:"valid",value:i.data[b]}});else if(v==="strict"){if(s.length>0)Je(i,{code:Ue.unrecognized_keys,keys:s}),r.dirty()}else if(v==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let v=this._def.catchall;for(let b of s){let _=i.data[b];h.push({key:{status:"valid",value:b},value:v._parse(new Ln(i,_,i.path,b)),alwaysSet:b in i.data})}}if(i.common.async)return Promise.resolve().then(async()=>{let v=[];for(let b of h){let _=await b.key,g=await b.value;v.push({key:_,value:g,alwaysSet:b.alwaysSet})}return v}).then((v)=>qr.mergeObjectSync(r,v));else return qr.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(e){return et.errToObj,new Xt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let i=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:et.errToObj(e).message??i};return{message:i}}}:{}})}strip(){return new Xt({...this._def,unknownKeys:"strip"})}passthrough(){return new Xt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Xt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Xt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Le.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Xt({...this._def,catchall:e})}pick(e){let t={};for(let r of wt.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new Xt({...this._def,shape:()=>t})}omit(e){let t={};for(let r of wt.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new Xt({...this._def,shape:()=>t})}deepPartial(){return Zs(this)}partial(e){let t={};for(let r of wt.objectKeys(this.shape)){let i=this.shape[r];if(e&&!e[r])t[r]=i;else t[r]=i.optional()}return new Xt({...this._def,shape:()=>t})}required(e){let t={};for(let r of wt.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];while(n instanceof Tn)n=n._def.innerType;t[r]=n}return new Xt({...this._def,shape:()=>t})}keyof(){return m6(wt.objectKeys(this.shape))}}Xt.create=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strip",catchall:ki.create(),typeName:Le.ZodObject,...ft(t)});Xt.strictCreate=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strict",catchall:ki.create(),typeName:Le.ZodObject,...ft(t)});Xt.lazycreate=(e,t)=>new Xt({shape:e,unknownKeys:"strip",catchall:ki.create(),typeName:Le.ZodObject,...ft(t)});class Ul extends vt{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function i(n){for(let s of n)if(s.result.status==="valid")return s.result;for(let s of n)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let o=n.map((s)=>new bn(s.ctx.common.issues));return Je(t,{code:Ue.invalid_union,unionErrors:o}),ot}if(t.common.async)return Promise.all(r.map(async(n)=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);else{let n=void 0,o=[];for(let h of r){let v={...t,common:{...t.common,issues:[]},parent:null},b=h._parseSync({data:t.data,path:t.path,parent:v});if(b.status==="valid")return b;else if(b.status==="dirty"&&!n)n={result:b,ctx:v};if(v.common.issues.length)o.push(v.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let s=o.map((h)=>new bn(h));return Je(t,{code:Ue.invalid_union,unionErrors:s}),ot}}get options(){return this._def.options}}Ul.create=(e,t)=>new Ul({options:e,typeName:Le.ZodUnion,...ft(t)});var Si=(e)=>{if(e instanceof Fl)return Si(e.schema);else if(e instanceof ei)return Si(e.innerType());else if(e instanceof ql)return[e.value];else if(e instanceof Bo)return e.options;else if(e instanceof Bl)return wt.objectValues(e.enum);else if(e instanceof Hl)return Si(e._def.innerType);else if(e instanceof zl)return[void 0];else if(e instanceof jl)return[null];else if(e instanceof Tn)return[void 0,...Si(e.unwrap())];else if(e instanceof Xi)return[null,...Si(e.unwrap())];else if(e instanceof Jv)return Si(e.unwrap());else if(e instanceof Kl)return Si(e.unwrap());else if(e instanceof Zl)return Si(e._def.innerType);else return[]};class Gv extends vt{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.object)return Je(t,{code:Ue.invalid_type,expected:Ze.object,received:t.parsedType}),ot;let r=this.discriminator,i=t.data[r],n=this.optionsMap.get(i);if(!n)return Je(t,{code:Ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ot;if(t.common.async)return n._parseAsync({data:t.data,path:t.path,parent:t});else return n._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let n of t){let o=Si(n.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,n)}}return new Gv({typeName:Le.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ft(r)})}}function Wv(e,t){let r=wi(e),i=wi(t);if(e===t)return{valid:!0,data:e};else if(r===Ze.object&&i===Ze.object){let n=wt.objectKeys(t),o=wt.objectKeys(e).filter((h)=>n.indexOf(h)!==-1),s={...e,...t};for(let h of o){let v=Wv(e[h],t[h]);if(!v.valid)return{valid:!1};s[h]=v.data}return{valid:!0,data:s}}else if(r===Ze.array&&i===Ze.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let o=0;o<e.length;o++){let s=e[o],h=t[o],v=Wv(s,h);if(!v.valid)return{valid:!1};n.push(v.data)}return{valid:!0,data:n}}else if(r===Ze.date&&i===Ze.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class Ll extends vt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(n,o)=>{if(Zv(n)||Zv(o))return ot;let s=Wv(n.value,o.value);if(!s.valid)return Je(r,{code:Ue.invalid_intersection_types}),ot;if(Kv(n)||Kv(o))t.dirty();return{status:t.value,value:s.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,o])=>i(n,o));else return i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ll.create=(e,t,r)=>new Ll({left:e,right:t,typeName:Le.ZodIntersection,...ft(r)});class Mi extends vt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.array)return Je(r,{code:Ue.invalid_type,expected:Ze.array,received:r.parsedType}),ot;if(r.data.length<this._def.items.length)return Je(r,{code:Ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ot;if(!this._def.rest&&r.data.length>this._def.items.length)Je(r,{code:Ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let n=[...r.data].map((o,s)=>{let h=this._def.items[s]||this._def.rest;if(!h)return null;return h._parse(new Ln(r,o,r.path,s))}).filter((o)=>!!o);if(r.common.async)return Promise.all(n).then((o)=>qr.mergeArray(t,o));else return qr.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Mi({...this._def,rest:e})}}Mi.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Mi({items:e,typeName:Le.ZodTuple,rest:null,...ft(t)})};class Fh extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.object)return Je(r,{code:Ue.invalid_type,expected:Ze.object,received:r.parsedType}),ot;let i=[],n=this._def.keyType,o=this._def.valueType;for(let s in r.data)i.push({key:n._parse(new Ln(r,s,r.path,s)),value:o._parse(new Ln(r,r.data[s],r.path,s)),alwaysSet:s in r.data});if(r.common.async)return qr.mergeObjectAsync(t,i);else return qr.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof vt)return new Fh({keyType:e,valueType:t,typeName:Le.ZodRecord,...ft(r)});return new Fh({keyType:xi.create(),valueType:e,typeName:Le.ZodRecord,...ft(t)})}}class qh extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.map)return Je(r,{code:Ue.invalid_type,expected:Ze.map,received:r.parsedType}),ot;let i=this._def.keyType,n=this._def.valueType,o=[...r.data.entries()].map(([s,h],v)=>({key:i._parse(new Ln(r,s,r.path,[v,"key"])),value:n._parse(new Ln(r,h,r.path,[v,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let h of o){let v=await h.key,b=await h.value;if(v.status==="aborted"||b.status==="aborted")return ot;if(v.status==="dirty"||b.status==="dirty")t.dirty();s.set(v.value,b.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let h of o){let{key:v,value:b}=h;if(v.status==="aborted"||b.status==="aborted")return ot;if(v.status==="dirty"||b.status==="dirty")t.dirty();s.set(v.value,b.value)}return{status:t.value,value:s}}}}qh.create=(e,t,r)=>new qh({valueType:t,keyType:e,typeName:Le.ZodMap,...ft(r)});class Ws extends vt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.set)return Je(r,{code:Ue.invalid_type,expected:Ze.set,received:r.parsedType}),ot;let i=this._def;if(i.minSize!==null){if(r.data.size<i.minSize.value)Je(r,{code:Ue.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()}if(i.maxSize!==null){if(r.data.size>i.maxSize.value)Je(r,{code:Ue.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty()}let n=this._def.valueType;function o(h){let v=new Set;for(let b of h){if(b.status==="aborted")return ot;if(b.status==="dirty")t.dirty();v.add(b.value)}return{status:t.value,value:v}}let s=[...r.data.values()].map((h,v)=>n._parse(new Ln(r,h,r.path,v)));if(r.common.async)return Promise.all(s).then((h)=>o(h));else return o(s)}min(e,t){return new Ws({...this._def,minSize:{value:e,message:et.toString(t)}})}max(e,t){return new Ws({...this._def,maxSize:{value:e,message:et.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ws.create=(e,t)=>new Ws({valueType:e,minSize:null,maxSize:null,typeName:Le.ZodSet,...ft(t)});class Dl extends vt{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.function)return Je(t,{code:Ue.invalid_type,expected:Ze.function,received:t.parsedType}),ot;function r(s,h){return Nh({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Cl(),Ji].filter((v)=>!!v),issueData:{code:Ue.invalid_arguments,argumentsError:h}})}function i(s,h){return Nh({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Cl(),Ji].filter((v)=>!!v),issueData:{code:Ue.invalid_return_type,returnTypeError:h}})}let n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Gs){let s=this;return Wr(async function(...h){let v=new bn([]),b=await s._def.args.parseAsync(h,n).catch((S)=>{throw v.addIssue(r(h,S)),v}),_=await Reflect.apply(o,this,b);return await s._def.returns._def.type.parseAsync(_,n).catch((S)=>{throw v.addIssue(i(_,S)),v})})}else{let s=this;return Wr(function(...h){let v=s._def.args.safeParse(h,n);if(!v.success)throw new bn([r(h,v.error)]);let b=Reflect.apply(o,this,v.data),_=s._def.returns.safeParse(b,n);if(!_.success)throw new bn([i(b,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Dl({...this._def,args:Mi.create(e).rest(qo.create())})}returns(e){return new Dl({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Dl({args:e?e:Mi.create([]).rest(qo.create()),returns:t||qo.create(),typeName:Le.ZodFunction,...ft(r)})}}class Fl extends vt{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Fl.create=(e,t)=>new Fl({getter:e,typeName:Le.ZodLazy,...ft(t)});class ql extends vt{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Je(t,{received:t.data,code:Ue.invalid_literal,expected:this._def.value}),ot}return{status:"valid",value:e.data}}get value(){return this._def.value}}ql.create=(e,t)=>new ql({value:e,typeName:Le.ZodLiteral,...ft(t)});function m6(e,t){return new Bo({values:e,typeName:Le.ZodEnum,...ft(t)})}class Bo extends vt{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return Je(t,{expected:wt.joinValues(r),received:t.parsedType,code:Ue.invalid_type}),ot}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return Je(t,{received:t.data,code:Ue.invalid_enum_value,options:r}),ot}return Wr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Bo.create(e,{...this._def,...t})}exclude(e,t=this._def){return Bo.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}Bo.create=m6;class Bl extends vt{_parse(e){let t=wt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ze.string&&r.parsedType!==Ze.number){let i=wt.objectValues(t);return Je(r,{expected:wt.joinValues(i),received:r.parsedType,code:Ue.invalid_type}),ot}if(!this._cache)this._cache=new Set(wt.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let i=wt.objectValues(t);return Je(r,{received:r.data,code:Ue.invalid_enum_value,options:i}),ot}return Wr(e.data)}get enum(){return this._def.values}}Bl.create=(e,t)=>new Bl({values:e,typeName:Le.ZodNativeEnum,...ft(t)});class Gs extends vt{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.promise&&t.common.async===!1)return Je(t,{code:Ue.invalid_type,expected:Ze.promise,received:t.parsedType}),ot;let r=t.parsedType===Ze.promise?t.data:Promise.resolve(t.data);return Wr(r.then((i)=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Gs.create=(e,t)=>new Gs({type:e,typeName:Le.ZodPromise,...ft(t)});class ei extends vt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,n={addIssue:(o)=>{if(Je(r,o),o.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),i.type==="preprocess"){let o=i.transform(r.data,n);if(r.common.async)return Promise.resolve(o).then(async(s)=>{if(t.value==="aborted")return ot;let h=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});if(h.status==="aborted")return ot;if(h.status==="dirty")return Hs(h.value);if(t.value==="dirty")return Hs(h.value);return h});else{if(t.value==="aborted")return ot;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});if(s.status==="aborted")return ot;if(s.status==="dirty")return Hs(s.value);if(t.value==="dirty")return Hs(s.value);return s}}if(i.type==="refinement"){let o=(s)=>{let h=i.refinement(s,n);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return ot;if(s.status==="dirty")t.dirty();return o(s.value),{status:t.value,value:s.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(s.status==="aborted")return ot;if(s.status==="dirty")t.dirty();return o(s.value).then(()=>({status:t.value,value:s.value}))})}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Fo(o))return ot;let s=i.transform(o.value,n);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((o)=>{if(!Fo(o))return ot;return Promise.resolve(i.transform(o.value,n)).then((s)=>({status:t.value,value:s}))});wt.assertNever(i)}}ei.create=(e,t,r)=>new ei({schema:e,typeName:Le.ZodEffects,effect:t,...ft(r)});ei.createWithPreprocess=(e,t,r)=>new ei({schema:t,effect:{type:"preprocess",transform:e},typeName:Le.ZodEffects,...ft(r)});class Tn extends vt{_parse(e){if(this._getType(e)===Ze.undefined)return Wr(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tn.create=(e,t)=>new Tn({innerType:e,typeName:Le.ZodOptional,...ft(t)});class Xi extends vt{_parse(e){if(this._getType(e)===Ze.null)return Wr(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Xi.create=(e,t)=>new Xi({innerType:e,typeName:Le.ZodNullable,...ft(t)});class Hl extends vt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===Ze.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Hl.create=(e,t)=>new Hl({innerType:e,typeName:Le.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...ft(t)});class Zl extends vt{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(Ol(i))return i.then((n)=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new bn(r.common.issues)},input:r.data})}));else return{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Zl.create=(e,t)=>new Zl({innerType:e,typeName:Le.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...ft(t)});class Bh extends vt{_parse(e){if(this._getType(e)!==Ze.nan){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.nan,received:r.parsedType}),ot}return{status:"valid",value:e.data}}}Bh.create=(e)=>new Bh({typeName:Le.ZodNaN,...ft(e)});var nge=Symbol("zod_brand");class Jv extends vt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Hh extends vt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return ot;if(n.status==="dirty")return t.dirty(),Hs(n.value);else return this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();else{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return ot;if(i.status==="dirty")return t.dirty(),{status:"dirty",value:i.value};else return this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new Hh({in:e,out:t,typeName:Le.ZodPipeline})}}class Kl extends vt{_parse(e){let t=this._def.innerType._parse(e),r=(i)=>{if(Fo(i))i.value=Object.freeze(i.value);return i};return Ol(t)?t.then((i)=>r(i)):r(t)}unwrap(){return this._def.innerType}}Kl.create=(e,t)=>new Kl({innerType:e,typeName:Le.ZodReadonly,...ft(t)});var ige={object:Xt.lazycreate},Le;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Le||(Le={}));var oge=xi.create,sge=Ks.create,age=Bh.create,uge=Vs.create,lge=zh.create,cge=Nl.create,dge=jh.create,fge=zl.create,hge=jl.create,pge=Uh.create,mge=qo.create,gge=ki.create,yge=Lh.create,vge=Qn.create,g6=Xt.create,bge=Xt.strictCreate,_ge=Ul.create,wge=Gv.create,Sge=Ll.create,xge=Mi.create,kge=Fh.create,Mge=qh.create,Ege=Ws.create,Ige=Dl.create,Tge=Fl.create,Pge=ql.create,$ge=Bo.create,Age=Bl.create,Rge=Gs.create,Cge=ei.create,Oge=Tn.create,Dge=Xi.create,Nge=ei.createWithPreprocess,zge=Hh.create;var SO=ne("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");ut.init(e,t),e.def=t,e.parse=(r,i)=>wo(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>Ui(e,r,i),e.parseAsync=async(r,i)=>So(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Li(e,r,i),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map((i)=>typeof i==="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(r,i)=>Ur(e,r,i),e.brand=()=>e,e.register=(r,i)=>(r.add(e,i),e)});var xO=ne("ZodMiniObject",(e,t)=>{Ba.init(e,t),SO.init(e,t),Be.defineLazy(e,"shape",()=>t.shape)});function Xv(e,t){let r={type:"object",get shape(){return Be.assignProp(this,"shape",{...e}),this.shape},...Be.normalizeParams(t)};return new xO(r)}function Pn(e){return!!e._zod}function Ho(e){let t=Object.values(e);if(t.length===0)return Xv({});let r=t.every(Pn),i=t.every((n)=>!Pn(n));if(r)return Xv(e);if(i)return g6(e);throw Error("Mixed Zod versions detected in object shape.")}function Yi(e,t){if(Pn(e))return Ui(e,t);return e.safeParse(t)}async function Zh(e,t){if(Pn(e))return await Li(e,t);return await e.safeParseAsync(t)}function Qi(e){if(!e)return;let t;if(Pn(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function Js(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let i=Object.values(e);if(i.length>0&&i.every((n)=>typeof n==="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse==="function")))return Ho(e)}}if(Pn(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function Kh(e){if(e&&typeof e==="object"){if("message"in e&&typeof e.message==="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function y6(e){return e.description}function v6(e){if(Pn(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function Vh(e){if(Pn(e)){let o=e._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let i=e.value;if(i!==void 0)return i;return}var Yv="2025-11-25";var b6=[Yv,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],eo="io.modelcontextprotocol/related-task",Gh="2.0",_r=By((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),_6=Dt([de(),It().int()]),w6=de(),Yge=Lr({ttl:It().optional(),pollInterval:It().optional()}),MO=Qe({ttl:It().optional()}),EO=Qe({taskId:de()}),Qv=Lr({progressToken:_6.optional(),[eo]:EO.optional()}),_n=Qe({_meta:Qv.optional()}),Vl=_n.extend({task:MO.optional()}),S6=(e)=>Vl.safeParse(e).success,Or=Qe({method:de(),params:_n.loose().optional()}),$n=Qe({_meta:Qv.optional()}),An=Qe({method:de(),params:$n.loose().optional()}),Dr=Lr({_meta:Qv.optional()}),Jh=Dt([de(),It().int()]),x6=Qe({jsonrpc:tt(Gh),id:Jh,...Or.shape}).strict(),eb=(e)=>x6.safeParse(e).success,k6=Qe({jsonrpc:tt(Gh),...An.shape}).strict(),M6=(e)=>k6.safeParse(e).success,tb=Qe({jsonrpc:tt(Gh),id:Jh,result:Dr}).strict(),Wl=(e)=>tb.safeParse(e).success;var it;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(it||(it={}));var rb=Qe({jsonrpc:tt(Gh),id:Jh.optional(),error:Qe({code:It().int(),message:de(),data:qt().optional()})}).strict();var E6=(e)=>rb.safeParse(e).success;var Qge=Dt([x6,k6,tb,rb]),e0e=Dt([tb,rb]),Xh=Dr.strict(),IO=$n.extend({requestId:Jh.optional(),reason:de().optional()}),Yh=An.extend({method:tt("notifications/cancelled"),params:IO}),TO=Qe({src:de(),mimeType:de().optional(),sizes:bt(de()).optional(),theme:Vr(["light","dark"]).optional()}),Gl=Qe({icons:bt(TO).optional()}),Xs=Qe({name:de(),title:de().optional()}),I6=Xs.extend({...Xs.shape,...Gl.shape,version:de(),websiteUrl:de().optional(),description:de().optional()}),PO=Cu(Qe({applyDefaults:rr().optional()}),Nt(de(),qt())),$O=Xf((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},Cu(Qe({form:PO.optional(),url:_r.optional()}),Nt(de(),qt()).optional())),AO=Lr({list:_r.optional(),cancel:_r.optional(),requests:Lr({sampling:Lr({createMessage:_r.optional()}).optional(),elicitation:Lr({create:_r.optional()}).optional()}).optional()}),RO=Lr({list:_r.optional(),cancel:_r.optional(),requests:Lr({tools:Lr({call:_r.optional()}).optional()}).optional()}),CO=Qe({experimental:Nt(de(),_r).optional(),sampling:Qe({context:_r.optional(),tools:_r.optional()}).optional(),elicitation:$O.optional(),roots:Qe({listChanged:rr().optional()}).optional(),tasks:AO.optional(),extensions:Nt(de(),_r).optional()}),OO=_n.extend({protocolVersion:de(),capabilities:CO,clientInfo:I6}),nb=Or.extend({method:tt("initialize"),params:OO});var DO=Qe({experimental:Nt(de(),_r).optional(),logging:_r.optional(),completions:_r.optional(),prompts:Qe({listChanged:rr().optional()}).optional(),resources:Qe({subscribe:rr().optional(),listChanged:rr().optional()}).optional(),tools:Qe({listChanged:rr().optional()}).optional(),tasks:RO.optional(),extensions:Nt(de(),_r).optional()}),NO=Dr.extend({protocolVersion:de(),capabilities:DO,serverInfo:I6,instructions:de().optional()}),ib=An.extend({method:tt("notifications/initialized"),params:$n.optional()});var Qh=Or.extend({method:tt("ping"),params:_n.optional()}),zO=Qe({progress:It(),total:Lt(It()),message:Lt(de())}),jO=Qe({...$n.shape,...zO.shape,progressToken:_6}),ep=An.extend({method:tt("notifications/progress"),params:jO}),UO=_n.extend({cursor:w6.optional()}),Jl=Or.extend({params:UO.optional()}),Xl=Dr.extend({nextCursor:w6.optional()}),LO=Vr(["working","input_required","completed","failed","cancelled"]),Yl=Qe({taskId:de(),status:LO,ttl:Dt([It(),Zf()]),createdAt:de(),lastUpdatedAt:de(),pollInterval:Lt(It()),statusMessage:Lt(de())}),Ys=Dr.extend({task:Yl}),FO=$n.merge(Yl),Ql=An.extend({method:tt("notifications/tasks/status"),params:FO}),tp=Or.extend({method:tt("tasks/get"),params:_n.extend({taskId:de()})}),rp=Dr.merge(Yl),np=Or.extend({method:tt("tasks/result"),params:_n.extend({taskId:de()})}),t0e=Dr.loose(),ip=Jl.extend({method:tt("tasks/list")}),op=Xl.extend({tasks:bt(Yl)}),sp=Or.extend({method:tt("tasks/cancel"),params:_n.extend({taskId:de()})}),T6=Dr.merge(Yl),P6=Qe({uri:de(),mimeType:Lt(de()),_meta:Nt(de(),qt()).optional()}),$6=P6.extend({text:de()}),ob=de().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),A6=P6.extend({blob:ob}),ec=Vr(["user","assistant"]),Qs=Qe({audience:bt(ec).optional(),priority:It().min(0).max(1).optional(),lastModified:ks.datetime({offset:!0}).optional()}),R6=Qe({...Xs.shape,...Gl.shape,uri:de(),description:Lt(de()),mimeType:Lt(de()),size:Lt(It()),annotations:Qs.optional(),_meta:Lt(Lr({}))}),qO=Qe({...Xs.shape,...Gl.shape,uriTemplate:de(),description:Lt(de()),mimeType:Lt(de()),annotations:Qs.optional(),_meta:Lt(Lr({}))}),ap=Jl.extend({method:tt("resources/list")}),BO=Xl.extend({resources:bt(R6)}),up=Jl.extend({method:tt("resources/templates/list")}),HO=Xl.extend({resourceTemplates:bt(qO)}),sb=_n.extend({uri:de()}),ZO=sb,lp=Or.extend({method:tt("resources/read"),params:ZO}),KO=Dr.extend({contents:bt(Dt([$6,A6]))}),VO=An.extend({method:tt("notifications/resources/list_changed"),params:$n.optional()}),WO=sb,GO=Or.extend({method:tt("resources/subscribe"),params:WO}),JO=sb,XO=Or.extend({method:tt("resources/unsubscribe"),params:JO}),YO=$n.extend({uri:de()}),QO=An.extend({method:tt("notifications/resources/updated"),params:YO}),eD=Qe({name:de(),description:Lt(de()),required:Lt(rr())}),tD=Qe({...Xs.shape,...Gl.shape,description:Lt(de()),arguments:Lt(bt(eD)),_meta:Lt(Lr({}))}),cp=Jl.extend({method:tt("prompts/list")}),rD=Xl.extend({prompts:bt(tD)}),nD=_n.extend({name:de(),arguments:Nt(de(),de()).optional()}),dp=Or.extend({method:tt("prompts/get"),params:nD}),ab=Qe({type:tt("text"),text:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),ub=Qe({type:tt("image"),data:ob,mimeType:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),lb=Qe({type:tt("audio"),data:ob,mimeType:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),iD=Qe({type:tt("tool_use"),name:de(),id:de(),input:Nt(de(),qt()),_meta:Nt(de(),qt()).optional()}),oD=Qe({type:tt("resource"),resource:Dt([$6,A6]),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),sD=R6.extend({type:tt("resource_link")}),cb=Dt([ab,ub,lb,sD,oD]),aD=Qe({role:ec,content:cb}),uD=Dr.extend({description:de().optional(),messages:bt(aD)}),lD=An.extend({method:tt("notifications/prompts/list_changed"),params:$n.optional()}),cD=Qe({title:de().optional(),readOnlyHint:rr().optional(),destructiveHint:rr().optional(),idempotentHint:rr().optional(),openWorldHint:rr().optional()}),dD=Qe({taskSupport:Vr(["required","optional","forbidden"]).optional()}),C6=Qe({...Xs.shape,...Gl.shape,description:de().optional(),inputSchema:Qe({type:tt("object"),properties:Nt(de(),_r).optional(),required:bt(de()).optional()}).catchall(qt()),outputSchema:Qe({type:tt("object"),properties:Nt(de(),_r).optional(),required:bt(de()).optional()}).catchall(qt()).optional(),annotations:cD.optional(),execution:dD.optional(),_meta:Nt(de(),qt()).optional()}),fp=Jl.extend({method:tt("tools/list")}),fD=Xl.extend({tools:bt(C6)}),hp=Dr.extend({content:bt(cb).default([]),structuredContent:Nt(de(),qt()).optional(),isError:rr().optional()}),r0e=hp.or(Dr.extend({toolResult:qt()})),hD=Vl.extend({name:de(),arguments:Nt(de(),qt()).optional()}),ea=Or.extend({method:tt("tools/call"),params:hD}),pD=An.extend({method:tt("notifications/tools/list_changed"),params:$n.optional()}),n0e=Qe({autoRefresh:rr().default(!0),debounceMs:It().int().nonnegative().default(300)}),tc=Vr(["debug","info","notice","warning","error","critical","alert","emergency"]),mD=_n.extend({level:tc}),db=Or.extend({method:tt("logging/setLevel"),params:mD}),gD=$n.extend({level:tc,logger:de().optional(),data:qt()}),yD=An.extend({method:tt("notifications/message"),params:gD}),vD=Qe({name:de().optional()}),bD=Qe({hints:bt(vD).optional(),costPriority:It().min(0).max(1).optional(),speedPriority:It().min(0).max(1).optional(),intelligencePriority:It().min(0).max(1).optional()}),_D=Qe({mode:Vr(["auto","required","none"]).optional()}),wD=Qe({type:tt("tool_result"),toolUseId:de().describe("The unique identifier for the corresponding tool call."),content:bt(cb).default([]),structuredContent:Qe({}).loose().optional(),isError:rr().optional(),_meta:Nt(de(),qt()).optional()}),SD=Gf("type",[ab,ub,lb]),Wh=Gf("type",[ab,ub,lb,iD,wD]),xD=Qe({role:ec,content:Dt([Wh,bt(Wh)]),_meta:Nt(de(),qt()).optional()}),kD=Vl.extend({messages:bt(xD),modelPreferences:bD.optional(),systemPrompt:de().optional(),includeContext:Vr(["none","thisServer","allServers"]).optional(),temperature:It().optional(),maxTokens:It().int(),stopSequences:bt(de()).optional(),metadata:_r.optional(),tools:bt(C6).optional(),toolChoice:_D.optional()}),MD=Or.extend({method:tt("sampling/createMessage"),params:kD}),rc=Dr.extend({model:de(),stopReason:Lt(Vr(["endTurn","stopSequence","maxTokens"]).or(de())),role:ec,content:SD}),fb=Dr.extend({model:de(),stopReason:Lt(Vr(["endTurn","stopSequence","maxTokens","toolUse"]).or(de())),role:ec,content:Dt([Wh,bt(Wh)])}),ED=Qe({type:tt("boolean"),title:de().optional(),description:de().optional(),default:rr().optional()}),ID=Qe({type:tt("string"),title:de().optional(),description:de().optional(),minLength:It().optional(),maxLength:It().optional(),format:Vr(["email","uri","date","date-time"]).optional(),default:de().optional()}),TD=Qe({type:Vr(["number","integer"]),title:de().optional(),description:de().optional(),minimum:It().optional(),maximum:It().optional(),default:It().optional()}),PD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),enum:bt(de()),default:de().optional()}),$D=Qe({type:tt("string"),title:de().optional(),description:de().optional(),oneOf:bt(Qe({const:de(),title:de()})),default:de().optional()}),AD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),enum:bt(de()),enumNames:bt(de()).optional(),default:de().optional()}),RD=Dt([PD,$D]),CD=Qe({type:tt("array"),title:de().optional(),description:de().optional(),minItems:It().optional(),maxItems:It().optional(),items:Qe({type:tt("string"),enum:bt(de())}),default:bt(de()).optional()}),OD=Qe({type:tt("array"),title:de().optional(),description:de().optional(),minItems:It().optional(),maxItems:It().optional(),items:Qe({anyOf:bt(Qe({const:de(),title:de()}))}),default:bt(de()).optional()}),DD=Dt([CD,OD]),ND=Dt([AD,RD,DD]),zD=Dt([ND,ED,ID,TD]),jD=Vl.extend({mode:tt("form").optional(),message:de(),requestedSchema:Qe({type:tt("object"),properties:Nt(de(),zD),required:bt(de()).optional()})}),UD=Vl.extend({mode:tt("url"),message:de(),elicitationId:de(),url:de().url()}),LD=Dt([jD,UD]),FD=Or.extend({method:tt("elicitation/create"),params:LD}),qD=$n.extend({elicitationId:de()}),BD=An.extend({method:tt("notifications/elicitation/complete"),params:qD}),ta=Dr.extend({action:Vr(["accept","decline","cancel"]),content:Xf((e)=>e===null?void 0:e,Nt(de(),Dt([de(),It(),rr(),bt(de())])).optional())}),HD=Qe({type:tt("ref/resource"),uri:de()});var ZD=Qe({type:tt("ref/prompt"),name:de()}),KD=_n.extend({ref:Dt([ZD,HD]),argument:Qe({name:de(),value:de()}),context:Qe({arguments:Nt(de(),de()).optional()}).optional()}),pp=Or.extend({method:tt("completion/complete"),params:KD});function O6(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function D6(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var VD=Dr.extend({completion:Lr({values:bt(de()).max(100),total:Lt(It().int()),hasMore:Lt(rr())})}),WD=Qe({uri:de().startsWith("file://"),name:de().optional(),_meta:Nt(de(),qt()).optional()}),GD=Or.extend({method:tt("roots/list"),params:_n.optional()}),hb=Dr.extend({roots:bt(WD)}),JD=An.extend({method:tt("notifications/roots/list_changed"),params:$n.optional()}),i0e=Dt([Qh,nb,pp,db,dp,cp,ap,up,lp,GO,XO,ea,fp,tp,np,ip,sp]),o0e=Dt([Yh,ep,ib,JD,Ql]),s0e=Dt([Xh,rc,fb,ta,hb,rp,op,Ys]),a0e=Dt([Qh,MD,FD,GD,tp,np,ip,sp]),u0e=Dt([Yh,ep,yD,QO,VO,pD,lD,Ql,BD]),l0e=Dt([Xh,NO,VD,uD,rD,BO,HO,KO,hp,fD,rp,op,Ys]);class rt extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===it.UrlElicitationRequired&&r){let i=r;if(i.elicitations)return new N6(i.elicitations,t)}return new rt(e,t,r)}}class N6 extends rt{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(it.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function to(e){return e==="completed"||e==="failed"||e==="cancelled"}var j6=Symbol("Let zodToJsonSchema decide on which parser to use");var z6={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"},U6=(e)=>typeof e==="string"?{...z6,name:e}:{...z6,...e};var L6=(e)=>{let t=U6(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([i,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,i],jsonSchema:void 0}]))}};function pb(e,t,r,i){if(!i?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function St(e,t,r,i,n){e[t]=r,pb(e,t,i,n)}var mp=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function Zt(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?mp(t,e.currentPath):t.join("/")}}function F6(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==Le.ZodAny)r.items=st(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)St(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)St(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)St(r,"minItems",e.exactLength.value,e.exactLength.message,t),St(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function q6(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"min":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"minimum",i.value,i.message,t);else St(r,"exclusiveMinimum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMinimum=!0;St(r,"minimum",i.value,i.message,t)}break;case"max":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"maximum",i.value,i.message,t);else St(r,"exclusiveMaximum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMaximum=!0;St(r,"maximum",i.value,i.message,t)}break;case"multipleOf":St(r,"multipleOf",i.value,i.message,t);break}return r}function B6(){return{type:"boolean"}}function gp(e,t){return st(e.type._def,t)}var H6=(e,t)=>st(e.innerType._def,t);function mb(e,t,r){let i=r??t.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,o)=>mb(e,t,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return XD(e,t)}}var XD=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let i of e.checks)switch(i.kind){case"min":St(r,"minimum",i.value,i.message,t);break;case"max":St(r,"maximum",i.value,i.message,t);break}return r};function Z6(e,t){return{...st(e.innerType._def,t),default:e.defaultValue()}}function K6(e,t){return t.effectStrategy==="input"?st(e.schema._def,t):Zt(t)}function V6(e){return{type:"string",enum:Array.from(e.values)}}var YD=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function W6(e,t){let r=[st(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),st(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((o)=>!!o),i=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach((o)=>{if(YD(o)){if(n.push(...o.allOf),o.unevaluatedProperties===void 0)i=void 0}else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:h,...v}=o;s=v}else i=void 0;n.push(s)}}),n.length?{allOf:n,...i}:void 0}function G6(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var gb=void 0,Fn={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:()=>{if(gb===void 0)gb=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return gb},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 yp(e,t){let r={type:"string"};if(e.checks)for(let i of e.checks)switch(i.kind){case"min":St(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,i.value):i.value,i.message,t);break;case"max":St(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"email":switch(t.emailStrategy){case"format:email":qn(r,"email",i.message,t);break;case"format:idn-email":qn(r,"idn-email",i.message,t);break;case"pattern:zod":Gr(r,Fn.email,i.message,t);break}break;case"url":qn(r,"uri",i.message,t);break;case"uuid":qn(r,"uuid",i.message,t);break;case"regex":Gr(r,i.regex,i.message,t);break;case"cuid":Gr(r,Fn.cuid,i.message,t);break;case"cuid2":Gr(r,Fn.cuid2,i.message,t);break;case"startsWith":Gr(r,RegExp(`^${yb(i.value,t)}`),i.message,t);break;case"endsWith":Gr(r,RegExp(`${yb(i.value,t)}$`),i.message,t);break;case"datetime":qn(r,"date-time",i.message,t);break;case"date":qn(r,"date",i.message,t);break;case"time":qn(r,"time",i.message,t);break;case"duration":qn(r,"duration",i.message,t);break;case"length":St(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,i.value):i.value,i.message,t),St(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"includes":{Gr(r,RegExp(yb(i.value,t)),i.message,t);break}case"ip":{if(i.version!=="v6")qn(r,"ipv4",i.message,t);if(i.version!=="v4")qn(r,"ipv6",i.message,t);break}case"base64url":Gr(r,Fn.base64url,i.message,t);break;case"jwt":Gr(r,Fn.jwt,i.message,t);break;case"cidr":{if(i.version!=="v6")Gr(r,Fn.ipv4Cidr,i.message,t);if(i.version!=="v4")Gr(r,Fn.ipv6Cidr,i.message,t);break}case"emoji":Gr(r,Fn.emoji(),i.message,t);break;case"ulid":{Gr(r,Fn.ulid,i.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{qn(r,"binary",i.message,t);break}case"contentEncoding:base64":{St(r,"contentEncoding","base64",i.message,t);break}case"pattern:zod":{Gr(r,Fn.base64,i.message,t);break}}break}case"nanoid":Gr(r,Fn.nanoid,i.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((n)=>{})(i)}return r}function yb(e,t){return t.patternStrategy==="escape"?eN(e):e}var QD=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function eN(e){let t="";for(let r=0;r<e.length;r++){if(!QD.has(e[r]))t+="\\";t+=e[r]}return t}function qn(e,t,r,i){if(e.format||e.anyOf?.some((n)=>n.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&i.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...r&&i.errorMessages&&{errorMessage:{format:r}}})}else St(e,"format",t,r,i)}function Gr(e,t,r,i){if(e.pattern||e.allOf?.some((n)=>n.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&i.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:J6(t,i),...r&&i.errorMessages&&{errorMessage:{pattern:r}}})}else St(e,"pattern",J6(t,i),r,i)}function J6(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=r.i?e.source.toLowerCase():e.source,n="",o=!1,s=!1,h=!1;for(let v=0;v<i.length;v++){if(o){n+=i[v],o=!1;continue}if(r.i){if(s){if(i[v].match(/[a-z]/)){if(h)n+=i[v],n+=`${i[v-2]}-${i[v]}`.toUpperCase(),h=!1;else if(i[v+1]==="-"&&i[v+2]?.match(/[a-z]/))n+=i[v],h=!0;else n+=`${i[v]}${i[v].toUpperCase()}`;continue}}else if(i[v].match(/[a-z]/)){n+=`[${i[v]}${i[v].toUpperCase()}]`;continue}}if(r.m){if(i[v]==="^"){n+=`(^|(?<=[\r
105
+ `);this.partialLine=o.pop()??"";for(let s of o){if(!s)continue;try{this.messages.enqueue(Bs(s))}catch(h){}}},this.abortHandler=()=>{this.close(),this.exitError=new On("WebSocket connection aborted by user")},this.abortController.signal.aborted)this.abortHandler();else this.abortController.signal.addEventListener("abort",this.abortHandler)}catch(e){if(this.ready=!1,this.exitError=e,this.readyReject)this.readyReject(e);throw e}}async write(e){if(this.abortController.signal.aborted)throw new On("Operation aborted");if(!this.ready)await this.readyPromise;if(!this.ready||!this.ws||this.ws.readyState!==globalThis.WebSocket.OPEN)throw Error("WebSocketTransport is not ready for writing");this.ws.send(e)}close(){if(this.abortHandler)this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0;if(this.keepAliveTimer)clearInterval(this.keepAliveTimer),this.keepAliveTimer=void 0;if(this.ws&&this.ws.readyState===globalThis.WebSocket.OPEN)this.ws.close(1000,"Normal closure");this.ready=!1,this.messages.done()}[Symbol.dispose](){this.close()}isReady(){return this.ready&&this.ws?.readyState===globalThis.WebSocket.OPEN}endInput(){}async*readMessages(){if(yield*this.messages,this.exitError)throw this.exitError}}function c6(e){return new AbortController}var wt;(function(e){e.assertEqual=(n)=>{};function t(n){}e.assertIs=t;function r(n){throw Error()}e.assertNever=r,e.arrayToEnum=(n)=>{let o={};for(let s of n)o[s]=s;return o},e.getValidEnumValues=(n)=>{let o=e.objectKeys(n).filter((h)=>typeof n[n[h]]!=="number"),s={};for(let h of o)s[h]=n[h];return e.objectValues(s)},e.objectValues=(n)=>e.objectKeys(n).map(function(o){return n[o]}),e.objectKeys=typeof Object.keys==="function"?(n)=>Object.keys(n):(n)=>{let o=[];for(let s in n)if(Object.prototype.hasOwnProperty.call(n,s))o.push(s);return o},e.find=(n,o)=>{for(let s of n)if(o(s))return s;return},e.isInteger=typeof Number.isInteger==="function"?(n)=>Number.isInteger(n):(n)=>typeof n==="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,o=" | "){return n.map((s)=>typeof s==="string"?`'${s}'`:s).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(n,o)=>{if(typeof o==="bigint")return o.toString();return o}})(wt||(wt={}));var d6;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(d6||(d6={}));var Ze=wt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wi=(e)=>{switch(typeof e){case"undefined":return Ze.undefined;case"string":return Ze.string;case"number":return Number.isNaN(e)?Ze.nan:Ze.number;case"boolean":return Ze.boolean;case"function":return Ze.function;case"bigint":return Ze.bigint;case"symbol":return Ze.symbol;case"object":if(Array.isArray(e))return Ze.array;if(e===null)return Ze.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return Ze.promise;if(typeof Map<"u"&&e instanceof Map)return Ze.map;if(typeof Set<"u"&&e instanceof Set)return Ze.set;if(typeof Date<"u"&&e instanceof Date)return Ze.date;return Ze.object;default:return Ze.unknown}};var Ue=wt.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"]);class bn extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},r={_errors:[]},i=(n)=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let s=r,h=0;while(h<o.path.length){let v=o.path[h];if(h!==o.path.length-1)s[v]=s[v]||{_errors:[]};else s[v]=s[v]||{_errors:[]},s[v]._errors.push(t(o));s=s[v],h++}}};return i(this),r}static assert(e){if(!(e instanceof bn))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let i of this.issues)if(i.path.length>0){let n=i.path[0];t[n]=t[n]||[],t[n].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}bn.create=(e)=>new bn(e);var XC=(e,t)=>{let r;switch(e.code){case Ue.invalid_type:if(e.received===Ze.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case Ue.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,wt.jsonStringifyReplacer)}`;break;case Ue.unrecognized_keys:r=`Unrecognized key(s) in object: ${wt.joinValues(e.keys,", ")}`;break;case Ue.invalid_union:r="Invalid input";break;case Ue.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${wt.joinValues(e.options)}`;break;case Ue.invalid_enum_value:r=`Invalid enum value. Expected ${wt.joinValues(e.options)}, received '${e.received}'`;break;case Ue.invalid_arguments:r="Invalid function arguments";break;case Ue.invalid_return_type:r="Invalid function return type";break;case Ue.invalid_date:r="Invalid date";break;case Ue.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else wt.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case Ue.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case Ue.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case Ue.custom:r="Invalid input";break;case Ue.invalid_intersection_types:r="Intersection results could not be merged";break;case Ue.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ue.not_finite:r="Number must be finite";break;default:r=t.defaultError,wt.assertNever(e)}return{message:r}},Ji=XC;var YC=Ji;function Cl(){return YC}var Nh=(e)=>{let{data:t,path:r,errorMaps:i,issueData:n}=e,o=[...r,...n.path||[]],s={...n,path:o};if(n.message!==void 0)return{...n,path:o,message:n.message};let h="",v=i.filter((b)=>!!b).slice().reverse();for(let b of v)h=b(s,{data:t,defaultError:h}).message;return{...n,path:o,message:h}};function Je(e,t){let r=Cl(),i=Nh({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ji?void 0:Ji].filter((n)=>!!n)});e.common.issues.push(i)}class qr{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let i of t){if(i.status==="aborted")return ot;if(i.status==="dirty")e.dirty();r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let i of t){let n=await i.key,o=await i.value;r.push({key:n,value:o})}return qr.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:n,value:o}=i;if(n.status==="aborted")return ot;if(o.status==="aborted")return ot;if(n.status==="dirty")e.dirty();if(o.status==="dirty")e.dirty();if(n.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet))r[n.value]=o.value}return{status:e.value,value:r}}}var ot=Object.freeze({status:"aborted"}),Hs=(e)=>({status:"dirty",value:e}),Wr=(e)=>({status:"valid",value:e}),Zv=(e)=>e.status==="aborted",Kv=(e)=>e.status==="dirty",Fo=(e)=>e.status==="valid",Ol=(e)=>typeof Promise<"u"&&e instanceof Promise;var et;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(et||(et={}));class Ln{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var f6=(e,t)=>{if(Fo(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new bn(e.common.issues);return this._error=r,this._error}}}};function ft(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:n};return{errorMap:(s,h)=>{let{message:v}=e;if(s.code==="invalid_enum_value")return{message:v??h.defaultError};if(typeof h.data>"u")return{message:v??i??h.defaultError};if(s.code!=="invalid_type")return{message:h.defaultError};return{message:v??r??h.defaultError}},description:n}}class vt{get description(){return this._def.description}_getType(e){return wi(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:wi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qr,ctx:{common:e.parent.common,data:e.data,parsedType:wi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ol(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wi(e)},i=this._parseSync({data:e,path:r.path,parent:r});return f6(r,i)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wi(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Fo(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>Fo(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:wi(e)},i=this._parse({data:e,path:r.path,parent:r}),n=await(Ol(i)?i:Promise.resolve(i));return f6(r,n)}refine(e,t){let r=(i)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(i);else return t};return this._refinement((i,n)=>{let o=e(i),s=()=>n.addIssue({code:Ue.custom,...r(i)});if(typeof Promise<"u"&&o instanceof Promise)return o.then((h)=>{if(!h)return s(),!1;else return!0});if(!o)return s(),!1;else return!0})}refinement(e,t){return this._refinement((r,i)=>{if(!e(r))return i.addIssue(typeof t==="function"?t(r,i):t),!1;else return!0})}_refinement(e){return new ei({schema:this,typeName:Le.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:(t)=>this["~validate"](t)}}optional(){return Tn.create(this,this._def)}nullable(){return Xi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qn.create(this)}promise(){return Gs.create(this,this._def)}or(e){return Ul.create([this,e],this._def)}and(e){return Ll.create(this,e,this._def)}transform(e){return new ei({...ft(this._def),schema:this,typeName:Le.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new Hl({...ft(this._def),innerType:this,defaultValue:t,typeName:Le.ZodDefault})}brand(){return new Jv({typeName:Le.ZodBranded,type:this,...ft(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new Zl({...ft(this._def),innerType:this,catchValue:t,typeName:Le.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Hh.create(this,e)}readonly(){return Kl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var QC=/^c[^\s-]{8,}$/i,eO=/^[0-9a-z]+$/,tO=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rO=/^[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,nO=/^[a-z0-9_-]{21}$/i,iO=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,oO=/^[-+]?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)?)??$/,sO=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Vv,uO=/^(?:(?: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])$/,lO=/^(?:(?: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])$/,cO=/^(([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]))$/,dO=/^(([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])$/,fO=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hO=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,h6="((\\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])))",pO=new RegExp(`^${h6}$`);function p6(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function mO(e){return new RegExp(`^${p6(e)}$`)}function gO(e){let t=`${h6}T${p6(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function yO(e,t){if((t==="v4"||!t)&&uO.test(e))return!0;if((t==="v6"||!t)&&cO.test(e))return!0;return!1}function vO(e,t){if(!iO.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));if(typeof n!=="object"||n===null)return!1;if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&n.alg!==t)return!1;return!0}catch{return!1}}function bO(e,t){if((t==="v4"||!t)&&lO.test(e))return!0;if((t==="v6"||!t)&&dO.test(e))return!0;return!1}class xi extends vt{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==Ze.string){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.string,received:n.parsedType}),ot}let r=new qr,i=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.length<n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="max"){if(e.data.length>n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="length"){let o=e.data.length>n.value,s=e.data.length<n.value;if(o||s){if(i=this._getOrReturnCtx(e,i),o)Je(i,{code:Ue.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});else if(s)Je(i,{code:Ue.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});r.dirty()}}else if(n.kind==="email"){if(!sO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"email",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="emoji"){if(!Vv)Vv=new RegExp(aO,"u");if(!Vv.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"emoji",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="uuid"){if(!rO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"uuid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="nanoid"){if(!nO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"nanoid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid"){if(!QC.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cuid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid2"){if(!eO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cuid2",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ulid"){if(!tO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"ulid",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Je(i,{validation:"url",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="regex"){if(n.regex.lastIndex=0,!n.regex.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"regex",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="trim")e.data=e.data.trim();else if(n.kind==="includes"){if(!e.data.includes(n.value,n.position))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()}else if(n.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(n.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(n.kind==="startsWith"){if(!e.data.startsWith(n.value))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="endsWith"){if(!e.data.endsWith(n.value))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="datetime"){if(!gO(n).test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"datetime",message:n.message}),r.dirty()}else if(n.kind==="date"){if(!pO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"date",message:n.message}),r.dirty()}else if(n.kind==="time"){if(!mO(n).test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.invalid_string,validation:"time",message:n.message}),r.dirty()}else if(n.kind==="duration"){if(!oO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"duration",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ip"){if(!yO(e.data,n.version))i=this._getOrReturnCtx(e,i),Je(i,{validation:"ip",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="jwt"){if(!vO(e.data,n.alg))i=this._getOrReturnCtx(e,i),Je(i,{validation:"jwt",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cidr"){if(!bO(e.data,n.version))i=this._getOrReturnCtx(e,i),Je(i,{validation:"cidr",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64"){if(!fO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"base64",code:Ue.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64url"){if(!hO.test(e.data))i=this._getOrReturnCtx(e,i),Je(i,{validation:"base64url",code:Ue.invalid_string,message:n.message}),r.dirty()}else wt.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((i)=>e.test(i),{validation:t,code:Ue.invalid_string,...et.errToObj(r)})}_addCheck(e){return new xi({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...et.errToObj(e)})}url(e){return this._addCheck({kind:"url",...et.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...et.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...et.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...et.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...et.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...et.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...et.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...et.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...et.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...et.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...et.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...et.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...et.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...et.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...et.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...et.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...et.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...et.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...et.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...et.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...et.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...et.errToObj(t)})}nonempty(e){return this.min(1,et.errToObj(e))}trim(){return new xi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new xi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new xi({...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 t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}xi.create=(e)=>new xi({checks:[],typeName:Le.ZodString,coerce:e?.coerce??!1,...ft(e)});function _O(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(e.toFixed(n).replace(".","")),s=Number.parseInt(t.toFixed(n).replace(".",""));return o%s/10**n}class Ks extends vt{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);if(this._getType(e)!==Ze.number){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.number,received:n.parsedType}),ot}let r=void 0,i=new qr;for(let n of this._def.checks)if(n.kind==="int"){if(!wt.isInteger(e.data))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()}else if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()}else if(n.kind==="multipleOf"){if(_O(e.data,n.value)!==0)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()}else if(n.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_finite,message:n.message}),i.dirty()}else wt.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,i){return new Ks({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(i)}]})}_addCheck(e){return new Ks({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:et.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:et.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:et.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:et.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&wt.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}Ks.create=(e)=>new Ks({checks:[],typeName:Le.ZodNumber,coerce:e?.coerce||!1,...ft(e)});class Vs extends vt{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)!==Ze.bigint)return this._getInvalidInput(e);let r=void 0,i=new qr;for(let n of this._def.checks)if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()}else if(n.kind==="multipleOf"){if(e.data%n.value!==BigInt(0))r=this._getOrReturnCtx(e,r),Je(r,{code:Ue.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()}else wt.assertNever(n);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return Je(t,{code:Ue.invalid_type,expected:Ze.bigint,received:t.parsedType}),ot}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,i){return new Vs({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(i)}]})}_addCheck(e){return new Vs({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}Vs.create=(e)=>new Vs({checks:[],typeName:Le.ZodBigInt,coerce:e?.coerce??!1,...ft(e)});class zh extends vt{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==Ze.boolean){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.boolean,received:r.parsedType}),ot}return Wr(e.data)}}zh.create=(e)=>new zh({typeName:Le.ZodBoolean,coerce:e?.coerce||!1,...ft(e)});class Nl extends vt{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==Ze.date){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_type,expected:Ze.date,received:n.parsedType}),ot}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return Je(n,{code:Ue.invalid_date}),ot}let r=new qr,i=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.getTime()<n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()}else if(n.kind==="max"){if(e.data.getTime()>n.value)i=this._getOrReturnCtx(e,i),Je(i,{code:Ue.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()}else wt.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Nl({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:et.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:et.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}Nl.create=(e)=>new Nl({checks:[],coerce:e?.coerce||!1,typeName:Le.ZodDate,...ft(e)});class jh extends vt{_parse(e){if(this._getType(e)!==Ze.symbol){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.symbol,received:r.parsedType}),ot}return Wr(e.data)}}jh.create=(e)=>new jh({typeName:Le.ZodSymbol,...ft(e)});class zl extends vt{_parse(e){if(this._getType(e)!==Ze.undefined){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.undefined,received:r.parsedType}),ot}return Wr(e.data)}}zl.create=(e)=>new zl({typeName:Le.ZodUndefined,...ft(e)});class jl extends vt{_parse(e){if(this._getType(e)!==Ze.null){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.null,received:r.parsedType}),ot}return Wr(e.data)}}jl.create=(e)=>new jl({typeName:Le.ZodNull,...ft(e)});class Uh extends vt{constructor(){super(...arguments);this._any=!0}_parse(e){return Wr(e.data)}}Uh.create=(e)=>new Uh({typeName:Le.ZodAny,...ft(e)});class qo extends vt{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Wr(e.data)}}qo.create=(e)=>new qo({typeName:Le.ZodUnknown,...ft(e)});class ki extends vt{_parse(e){let t=this._getOrReturnCtx(e);return Je(t,{code:Ue.invalid_type,expected:Ze.never,received:t.parsedType}),ot}}ki.create=(e)=>new ki({typeName:Le.ZodNever,...ft(e)});class Lh extends vt{_parse(e){if(this._getType(e)!==Ze.undefined){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.void,received:r.parsedType}),ot}return Wr(e.data)}}Lh.create=(e)=>new Lh({typeName:Le.ZodVoid,...ft(e)});class Qn extends vt{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==Ze.array)return Je(t,{code:Ue.invalid_type,expected:Ze.array,received:t.parsedType}),ot;if(i.exactLength!==null){let o=t.data.length>i.exactLength.value,s=t.data.length<i.exactLength.value;if(o||s)Je(t,{code:o?Ue.too_big:Ue.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty()}if(i.minLength!==null){if(t.data.length<i.minLength.value)Je(t,{code:Ue.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()}if(i.maxLength!==null){if(t.data.length>i.maxLength.value)Je(t,{code:Ue.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((o,s)=>i.type._parseAsync(new Ln(t,o,t.path,s)))).then((o)=>qr.mergeArray(r,o));let n=[...t.data].map((o,s)=>i.type._parseSync(new Ln(t,o,t.path,s)));return qr.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new Qn({...this._def,minLength:{value:e,message:et.toString(t)}})}max(e,t){return new Qn({...this._def,maxLength:{value:e,message:et.toString(t)}})}length(e,t){return new Qn({...this._def,exactLength:{value:e,message:et.toString(t)}})}nonempty(e){return this.min(1,e)}}Qn.create=(e,t)=>new Qn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Le.ZodArray,...ft(t)});function Zs(e){if(e instanceof Xt){let t={};for(let r in e.shape){let i=e.shape[r];t[r]=Tn.create(Zs(i))}return new Xt({...e._def,shape:()=>t})}else if(e instanceof Qn)return new Qn({...e._def,type:Zs(e.element)});else if(e instanceof Tn)return Tn.create(Zs(e.unwrap()));else if(e instanceof Xi)return Xi.create(Zs(e.unwrap()));else if(e instanceof Mi)return Mi.create(e.items.map((t)=>Zs(t)));else return e}class Xt extends vt{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(),t=wt.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Ze.object){let v=this._getOrReturnCtx(e);return Je(v,{code:Ue.invalid_type,expected:Ze.object,received:v.parsedType}),ot}let{status:r,ctx:i}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof ki&&this._def.unknownKeys==="strip")){for(let v in i.data)if(!o.includes(v))s.push(v)}let h=[];for(let v of o){let b=n[v],_=i.data[v];h.push({key:{status:"valid",value:v},value:b._parse(new Ln(i,_,i.path,v)),alwaysSet:v in i.data})}if(this._def.catchall instanceof ki){let v=this._def.unknownKeys;if(v==="passthrough")for(let b of s)h.push({key:{status:"valid",value:b},value:{status:"valid",value:i.data[b]}});else if(v==="strict"){if(s.length>0)Je(i,{code:Ue.unrecognized_keys,keys:s}),r.dirty()}else if(v==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let v=this._def.catchall;for(let b of s){let _=i.data[b];h.push({key:{status:"valid",value:b},value:v._parse(new Ln(i,_,i.path,b)),alwaysSet:b in i.data})}}if(i.common.async)return Promise.resolve().then(async()=>{let v=[];for(let b of h){let _=await b.key,g=await b.value;v.push({key:_,value:g,alwaysSet:b.alwaysSet})}return v}).then((v)=>qr.mergeObjectSync(r,v));else return qr.mergeObjectSync(r,h)}get shape(){return this._def.shape()}strict(e){return et.errToObj,new Xt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let i=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:et.errToObj(e).message??i};return{message:i}}}:{}})}strip(){return new Xt({...this._def,unknownKeys:"strip"})}passthrough(){return new Xt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Xt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Xt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Le.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Xt({...this._def,catchall:e})}pick(e){let t={};for(let r of wt.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new Xt({...this._def,shape:()=>t})}omit(e){let t={};for(let r of wt.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new Xt({...this._def,shape:()=>t})}deepPartial(){return Zs(this)}partial(e){let t={};for(let r of wt.objectKeys(this.shape)){let i=this.shape[r];if(e&&!e[r])t[r]=i;else t[r]=i.optional()}return new Xt({...this._def,shape:()=>t})}required(e){let t={};for(let r of wt.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];while(n instanceof Tn)n=n._def.innerType;t[r]=n}return new Xt({...this._def,shape:()=>t})}keyof(){return m6(wt.objectKeys(this.shape))}}Xt.create=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strip",catchall:ki.create(),typeName:Le.ZodObject,...ft(t)});Xt.strictCreate=(e,t)=>new Xt({shape:()=>e,unknownKeys:"strict",catchall:ki.create(),typeName:Le.ZodObject,...ft(t)});Xt.lazycreate=(e,t)=>new Xt({shape:e,unknownKeys:"strip",catchall:ki.create(),typeName:Le.ZodObject,...ft(t)});class Ul extends vt{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function i(n){for(let s of n)if(s.result.status==="valid")return s.result;for(let s of n)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let o=n.map((s)=>new bn(s.ctx.common.issues));return Je(t,{code:Ue.invalid_union,unionErrors:o}),ot}if(t.common.async)return Promise.all(r.map(async(n)=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);else{let n=void 0,o=[];for(let h of r){let v={...t,common:{...t.common,issues:[]},parent:null},b=h._parseSync({data:t.data,path:t.path,parent:v});if(b.status==="valid")return b;else if(b.status==="dirty"&&!n)n={result:b,ctx:v};if(v.common.issues.length)o.push(v.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let s=o.map((h)=>new bn(h));return Je(t,{code:Ue.invalid_union,unionErrors:s}),ot}}get options(){return this._def.options}}Ul.create=(e,t)=>new Ul({options:e,typeName:Le.ZodUnion,...ft(t)});var Si=(e)=>{if(e instanceof Fl)return Si(e.schema);else if(e instanceof ei)return Si(e.innerType());else if(e instanceof ql)return[e.value];else if(e instanceof Bo)return e.options;else if(e instanceof Bl)return wt.objectValues(e.enum);else if(e instanceof Hl)return Si(e._def.innerType);else if(e instanceof zl)return[void 0];else if(e instanceof jl)return[null];else if(e instanceof Tn)return[void 0,...Si(e.unwrap())];else if(e instanceof Xi)return[null,...Si(e.unwrap())];else if(e instanceof Jv)return Si(e.unwrap());else if(e instanceof Kl)return Si(e.unwrap());else if(e instanceof Zl)return Si(e._def.innerType);else return[]};class Gv extends vt{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.object)return Je(t,{code:Ue.invalid_type,expected:Ze.object,received:t.parsedType}),ot;let r=this.discriminator,i=t.data[r],n=this.optionsMap.get(i);if(!n)return Je(t,{code:Ue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ot;if(t.common.async)return n._parseAsync({data:t.data,path:t.path,parent:t});else return n._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;for(let n of t){let o=Si(n.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,n)}}return new Gv({typeName:Le.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...ft(r)})}}function Wv(e,t){let r=wi(e),i=wi(t);if(e===t)return{valid:!0,data:e};else if(r===Ze.object&&i===Ze.object){let n=wt.objectKeys(t),o=wt.objectKeys(e).filter((h)=>n.indexOf(h)!==-1),s={...e,...t};for(let h of o){let v=Wv(e[h],t[h]);if(!v.valid)return{valid:!1};s[h]=v.data}return{valid:!0,data:s}}else if(r===Ze.array&&i===Ze.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let o=0;o<e.length;o++){let s=e[o],h=t[o],v=Wv(s,h);if(!v.valid)return{valid:!1};n.push(v.data)}return{valid:!0,data:n}}else if(r===Ze.date&&i===Ze.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class Ll extends vt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(n,o)=>{if(Zv(n)||Zv(o))return ot;let s=Wv(n.value,o.value);if(!s.valid)return Je(r,{code:Ue.invalid_intersection_types}),ot;if(Kv(n)||Kv(o))t.dirty();return{status:t.value,value:s.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,o])=>i(n,o));else return i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Ll.create=(e,t,r)=>new Ll({left:e,right:t,typeName:Le.ZodIntersection,...ft(r)});class Mi extends vt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.array)return Je(r,{code:Ue.invalid_type,expected:Ze.array,received:r.parsedType}),ot;if(r.data.length<this._def.items.length)return Je(r,{code:Ue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ot;if(!this._def.rest&&r.data.length>this._def.items.length)Je(r,{code:Ue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let n=[...r.data].map((o,s)=>{let h=this._def.items[s]||this._def.rest;if(!h)return null;return h._parse(new Ln(r,o,r.path,s))}).filter((o)=>!!o);if(r.common.async)return Promise.all(n).then((o)=>qr.mergeArray(t,o));else return qr.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Mi({...this._def,rest:e})}}Mi.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Mi({items:e,typeName:Le.ZodTuple,rest:null,...ft(t)})};class Fh extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.object)return Je(r,{code:Ue.invalid_type,expected:Ze.object,received:r.parsedType}),ot;let i=[],n=this._def.keyType,o=this._def.valueType;for(let s in r.data)i.push({key:n._parse(new Ln(r,s,r.path,s)),value:o._parse(new Ln(r,r.data[s],r.path,s)),alwaysSet:s in r.data});if(r.common.async)return qr.mergeObjectAsync(t,i);else return qr.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof vt)return new Fh({keyType:e,valueType:t,typeName:Le.ZodRecord,...ft(r)});return new Fh({keyType:xi.create(),valueType:e,typeName:Le.ZodRecord,...ft(t)})}}class qh extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.map)return Je(r,{code:Ue.invalid_type,expected:Ze.map,received:r.parsedType}),ot;let i=this._def.keyType,n=this._def.valueType,o=[...r.data.entries()].map(([s,h],v)=>({key:i._parse(new Ln(r,s,r.path,[v,"key"])),value:n._parse(new Ln(r,h,r.path,[v,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let h of o){let v=await h.key,b=await h.value;if(v.status==="aborted"||b.status==="aborted")return ot;if(v.status==="dirty"||b.status==="dirty")t.dirty();s.set(v.value,b.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let h of o){let{key:v,value:b}=h;if(v.status==="aborted"||b.status==="aborted")return ot;if(v.status==="dirty"||b.status==="dirty")t.dirty();s.set(v.value,b.value)}return{status:t.value,value:s}}}}qh.create=(e,t,r)=>new qh({valueType:t,keyType:e,typeName:Le.ZodMap,...ft(r)});class Ws extends vt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ze.set)return Je(r,{code:Ue.invalid_type,expected:Ze.set,received:r.parsedType}),ot;let i=this._def;if(i.minSize!==null){if(r.data.size<i.minSize.value)Je(r,{code:Ue.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()}if(i.maxSize!==null){if(r.data.size>i.maxSize.value)Je(r,{code:Ue.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty()}let n=this._def.valueType;function o(h){let v=new Set;for(let b of h){if(b.status==="aborted")return ot;if(b.status==="dirty")t.dirty();v.add(b.value)}return{status:t.value,value:v}}let s=[...r.data.values()].map((h,v)=>n._parse(new Ln(r,h,r.path,v)));if(r.common.async)return Promise.all(s).then((h)=>o(h));else return o(s)}min(e,t){return new Ws({...this._def,minSize:{value:e,message:et.toString(t)}})}max(e,t){return new Ws({...this._def,maxSize:{value:e,message:et.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ws.create=(e,t)=>new Ws({valueType:e,minSize:null,maxSize:null,typeName:Le.ZodSet,...ft(t)});class Dl extends vt{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.function)return Je(t,{code:Ue.invalid_type,expected:Ze.function,received:t.parsedType}),ot;function r(s,h){return Nh({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Cl(),Ji].filter((v)=>!!v),issueData:{code:Ue.invalid_arguments,argumentsError:h}})}function i(s,h){return Nh({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Cl(),Ji].filter((v)=>!!v),issueData:{code:Ue.invalid_return_type,returnTypeError:h}})}let n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Gs){let s=this;return Wr(async function(...h){let v=new bn([]),b=await s._def.args.parseAsync(h,n).catch((S)=>{throw v.addIssue(r(h,S)),v}),_=await Reflect.apply(o,this,b);return await s._def.returns._def.type.parseAsync(_,n).catch((S)=>{throw v.addIssue(i(_,S)),v})})}else{let s=this;return Wr(function(...h){let v=s._def.args.safeParse(h,n);if(!v.success)throw new bn([r(h,v.error)]);let b=Reflect.apply(o,this,v.data),_=s._def.returns.safeParse(b,n);if(!_.success)throw new bn([i(b,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Dl({...this._def,args:Mi.create(e).rest(qo.create())})}returns(e){return new Dl({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Dl({args:e?e:Mi.create([]).rest(qo.create()),returns:t||qo.create(),typeName:Le.ZodFunction,...ft(r)})}}class Fl extends vt{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Fl.create=(e,t)=>new Fl({getter:e,typeName:Le.ZodLazy,...ft(t)});class ql extends vt{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return Je(t,{received:t.data,code:Ue.invalid_literal,expected:this._def.value}),ot}return{status:"valid",value:e.data}}get value(){return this._def.value}}ql.create=(e,t)=>new ql({value:e,typeName:Le.ZodLiteral,...ft(t)});function m6(e,t){return new Bo({values:e,typeName:Le.ZodEnum,...ft(t)})}class Bo extends vt{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return Je(t,{expected:wt.joinValues(r),received:t.parsedType,code:Ue.invalid_type}),ot}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return Je(t,{received:t.data,code:Ue.invalid_enum_value,options:r}),ot}return Wr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Bo.create(e,{...this._def,...t})}exclude(e,t=this._def){return Bo.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}Bo.create=m6;class Bl extends vt{_parse(e){let t=wt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ze.string&&r.parsedType!==Ze.number){let i=wt.objectValues(t);return Je(r,{expected:wt.joinValues(i),received:r.parsedType,code:Ue.invalid_type}),ot}if(!this._cache)this._cache=new Set(wt.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let i=wt.objectValues(t);return Je(r,{received:r.data,code:Ue.invalid_enum_value,options:i}),ot}return Wr(e.data)}get enum(){return this._def.values}}Bl.create=(e,t)=>new Bl({values:e,typeName:Le.ZodNativeEnum,...ft(t)});class Gs extends vt{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ze.promise&&t.common.async===!1)return Je(t,{code:Ue.invalid_type,expected:Ze.promise,received:t.parsedType}),ot;let r=t.parsedType===Ze.promise?t.data:Promise.resolve(t.data);return Wr(r.then((i)=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Gs.create=(e,t)=>new Gs({type:e,typeName:Le.ZodPromise,...ft(t)});class ei extends vt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Le.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,n={addIssue:(o)=>{if(Je(r,o),o.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),i.type==="preprocess"){let o=i.transform(r.data,n);if(r.common.async)return Promise.resolve(o).then(async(s)=>{if(t.value==="aborted")return ot;let h=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});if(h.status==="aborted")return ot;if(h.status==="dirty")return Hs(h.value);if(t.value==="dirty")return Hs(h.value);return h});else{if(t.value==="aborted")return ot;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});if(s.status==="aborted")return ot;if(s.status==="dirty")return Hs(s.value);if(t.value==="dirty")return Hs(s.value);return s}}if(i.type==="refinement"){let o=(s)=>{let h=i.refinement(s,n);if(r.common.async)return Promise.resolve(h);if(h instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return ot;if(s.status==="dirty")t.dirty();return o(s.value),{status:t.value,value:s.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(s.status==="aborted")return ot;if(s.status==="dirty")t.dirty();return o(s.value).then(()=>({status:t.value,value:s.value}))})}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Fo(o))return ot;let s=i.transform(o.value,n);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((o)=>{if(!Fo(o))return ot;return Promise.resolve(i.transform(o.value,n)).then((s)=>({status:t.value,value:s}))});wt.assertNever(i)}}ei.create=(e,t,r)=>new ei({schema:e,typeName:Le.ZodEffects,effect:t,...ft(r)});ei.createWithPreprocess=(e,t,r)=>new ei({schema:t,effect:{type:"preprocess",transform:e},typeName:Le.ZodEffects,...ft(r)});class Tn extends vt{_parse(e){if(this._getType(e)===Ze.undefined)return Wr(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tn.create=(e,t)=>new Tn({innerType:e,typeName:Le.ZodOptional,...ft(t)});class Xi extends vt{_parse(e){if(this._getType(e)===Ze.null)return Wr(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Xi.create=(e,t)=>new Xi({innerType:e,typeName:Le.ZodNullable,...ft(t)});class Hl extends vt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===Ze.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Hl.create=(e,t)=>new Hl({innerType:e,typeName:Le.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...ft(t)});class Zl extends vt{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(Ol(i))return i.then((n)=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new bn(r.common.issues)},input:r.data})}));else return{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new bn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Zl.create=(e,t)=>new Zl({innerType:e,typeName:Le.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...ft(t)});class Bh extends vt{_parse(e){if(this._getType(e)!==Ze.nan){let r=this._getOrReturnCtx(e);return Je(r,{code:Ue.invalid_type,expected:Ze.nan,received:r.parsedType}),ot}return{status:"valid",value:e.data}}}Bh.create=(e)=>new Bh({typeName:Le.ZodNaN,...ft(e)});var sge=Symbol("zod_brand");class Jv extends vt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Hh extends vt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return ot;if(n.status==="dirty")return t.dirty(),Hs(n.value);else return this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();else{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return ot;if(i.status==="dirty")return t.dirty(),{status:"dirty",value:i.value};else return this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new Hh({in:e,out:t,typeName:Le.ZodPipeline})}}class Kl extends vt{_parse(e){let t=this._def.innerType._parse(e),r=(i)=>{if(Fo(i))i.value=Object.freeze(i.value);return i};return Ol(t)?t.then((i)=>r(i)):r(t)}unwrap(){return this._def.innerType}}Kl.create=(e,t)=>new Kl({innerType:e,typeName:Le.ZodReadonly,...ft(t)});var age={object:Xt.lazycreate},Le;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Le||(Le={}));var uge=xi.create,lge=Ks.create,cge=Bh.create,dge=Vs.create,fge=zh.create,hge=Nl.create,pge=jh.create,mge=zl.create,gge=jl.create,yge=Uh.create,vge=qo.create,bge=ki.create,_ge=Lh.create,wge=Qn.create,g6=Xt.create,Sge=Xt.strictCreate,xge=Ul.create,kge=Gv.create,Mge=Ll.create,Ege=Mi.create,Ige=Fh.create,Tge=qh.create,Pge=Ws.create,$ge=Dl.create,Age=Fl.create,Rge=ql.create,Cge=Bo.create,Oge=Bl.create,Dge=Gs.create,Nge=ei.create,zge=Tn.create,jge=Xi.create,Uge=ei.createWithPreprocess,Lge=Hh.create;var SO=ne("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");ut.init(e,t),e.def=t,e.parse=(r,i)=>wo(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>Ui(e,r,i),e.parseAsync=async(r,i)=>So(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Li(e,r,i),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map((i)=>typeof i==="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),e.clone=(r,i)=>Ur(e,r,i),e.brand=()=>e,e.register=(r,i)=>(r.add(e,i),e)});var xO=ne("ZodMiniObject",(e,t)=>{Ba.init(e,t),SO.init(e,t),Be.defineLazy(e,"shape",()=>t.shape)});function Xv(e,t){let r={type:"object",get shape(){return Be.assignProp(this,"shape",{...e}),this.shape},...Be.normalizeParams(t)};return new xO(r)}function Pn(e){return!!e._zod}function Ho(e){let t=Object.values(e);if(t.length===0)return Xv({});let r=t.every(Pn),i=t.every((n)=>!Pn(n));if(r)return Xv(e);if(i)return g6(e);throw Error("Mixed Zod versions detected in object shape.")}function Yi(e,t){if(Pn(e))return Ui(e,t);return e.safeParse(t)}async function Zh(e,t){if(Pn(e))return await Li(e,t);return await e.safeParseAsync(t)}function Qi(e){if(!e)return;let t;if(Pn(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function Js(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let i=Object.values(e);if(i.length>0&&i.every((n)=>typeof n==="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse==="function")))return Ho(e)}}if(Pn(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function Kh(e){if(e&&typeof e==="object"){if("message"in e&&typeof e.message==="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function y6(e){return e.description}function v6(e){if(Pn(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function Vh(e){if(Pn(e)){let o=e._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let i=e.value;if(i!==void 0)return i;return}var Yv="2025-11-25";var b6=[Yv,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],eo="io.modelcontextprotocol/related-task",Gh="2.0",_r=By((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),_6=Dt([de(),It().int()]),w6=de(),t0e=Lr({ttl:It().optional(),pollInterval:It().optional()}),MO=Qe({ttl:It().optional()}),EO=Qe({taskId:de()}),Qv=Lr({progressToken:_6.optional(),[eo]:EO.optional()}),_n=Qe({_meta:Qv.optional()}),Vl=_n.extend({task:MO.optional()}),S6=(e)=>Vl.safeParse(e).success,Or=Qe({method:de(),params:_n.loose().optional()}),$n=Qe({_meta:Qv.optional()}),An=Qe({method:de(),params:$n.loose().optional()}),Dr=Lr({_meta:Qv.optional()}),Jh=Dt([de(),It().int()]),x6=Qe({jsonrpc:tt(Gh),id:Jh,...Or.shape}).strict(),eb=(e)=>x6.safeParse(e).success,k6=Qe({jsonrpc:tt(Gh),...An.shape}).strict(),M6=(e)=>k6.safeParse(e).success,tb=Qe({jsonrpc:tt(Gh),id:Jh,result:Dr}).strict(),Wl=(e)=>tb.safeParse(e).success;var it;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(it||(it={}));var rb=Qe({jsonrpc:tt(Gh),id:Jh.optional(),error:Qe({code:It().int(),message:de(),data:qt().optional()})}).strict();var E6=(e)=>rb.safeParse(e).success;var r0e=Dt([x6,k6,tb,rb]),n0e=Dt([tb,rb]),Xh=Dr.strict(),IO=$n.extend({requestId:Jh.optional(),reason:de().optional()}),Yh=An.extend({method:tt("notifications/cancelled"),params:IO}),TO=Qe({src:de(),mimeType:de().optional(),sizes:bt(de()).optional(),theme:Vr(["light","dark"]).optional()}),Gl=Qe({icons:bt(TO).optional()}),Xs=Qe({name:de(),title:de().optional()}),I6=Xs.extend({...Xs.shape,...Gl.shape,version:de(),websiteUrl:de().optional(),description:de().optional()}),PO=Cu(Qe({applyDefaults:rr().optional()}),Nt(de(),qt())),$O=Xf((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},Cu(Qe({form:PO.optional(),url:_r.optional()}),Nt(de(),qt()).optional())),AO=Lr({list:_r.optional(),cancel:_r.optional(),requests:Lr({sampling:Lr({createMessage:_r.optional()}).optional(),elicitation:Lr({create:_r.optional()}).optional()}).optional()}),RO=Lr({list:_r.optional(),cancel:_r.optional(),requests:Lr({tools:Lr({call:_r.optional()}).optional()}).optional()}),CO=Qe({experimental:Nt(de(),_r).optional(),sampling:Qe({context:_r.optional(),tools:_r.optional()}).optional(),elicitation:$O.optional(),roots:Qe({listChanged:rr().optional()}).optional(),tasks:AO.optional(),extensions:Nt(de(),_r).optional()}),OO=_n.extend({protocolVersion:de(),capabilities:CO,clientInfo:I6}),nb=Or.extend({method:tt("initialize"),params:OO});var DO=Qe({experimental:Nt(de(),_r).optional(),logging:_r.optional(),completions:_r.optional(),prompts:Qe({listChanged:rr().optional()}).optional(),resources:Qe({subscribe:rr().optional(),listChanged:rr().optional()}).optional(),tools:Qe({listChanged:rr().optional()}).optional(),tasks:RO.optional(),extensions:Nt(de(),_r).optional()}),NO=Dr.extend({protocolVersion:de(),capabilities:DO,serverInfo:I6,instructions:de().optional()}),ib=An.extend({method:tt("notifications/initialized"),params:$n.optional()});var Qh=Or.extend({method:tt("ping"),params:_n.optional()}),zO=Qe({progress:It(),total:Lt(It()),message:Lt(de())}),jO=Qe({...$n.shape,...zO.shape,progressToken:_6}),ep=An.extend({method:tt("notifications/progress"),params:jO}),UO=_n.extend({cursor:w6.optional()}),Jl=Or.extend({params:UO.optional()}),Xl=Dr.extend({nextCursor:w6.optional()}),LO=Vr(["working","input_required","completed","failed","cancelled"]),Yl=Qe({taskId:de(),status:LO,ttl:Dt([It(),Zf()]),createdAt:de(),lastUpdatedAt:de(),pollInterval:Lt(It()),statusMessage:Lt(de())}),Ys=Dr.extend({task:Yl}),FO=$n.merge(Yl),Ql=An.extend({method:tt("notifications/tasks/status"),params:FO}),tp=Or.extend({method:tt("tasks/get"),params:_n.extend({taskId:de()})}),rp=Dr.merge(Yl),np=Or.extend({method:tt("tasks/result"),params:_n.extend({taskId:de()})}),i0e=Dr.loose(),ip=Jl.extend({method:tt("tasks/list")}),op=Xl.extend({tasks:bt(Yl)}),sp=Or.extend({method:tt("tasks/cancel"),params:_n.extend({taskId:de()})}),T6=Dr.merge(Yl),P6=Qe({uri:de(),mimeType:Lt(de()),_meta:Nt(de(),qt()).optional()}),$6=P6.extend({text:de()}),ob=de().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),A6=P6.extend({blob:ob}),ec=Vr(["user","assistant"]),Qs=Qe({audience:bt(ec).optional(),priority:It().min(0).max(1).optional(),lastModified:ks.datetime({offset:!0}).optional()}),R6=Qe({...Xs.shape,...Gl.shape,uri:de(),description:Lt(de()),mimeType:Lt(de()),size:Lt(It()),annotations:Qs.optional(),_meta:Lt(Lr({}))}),qO=Qe({...Xs.shape,...Gl.shape,uriTemplate:de(),description:Lt(de()),mimeType:Lt(de()),annotations:Qs.optional(),_meta:Lt(Lr({}))}),ap=Jl.extend({method:tt("resources/list")}),BO=Xl.extend({resources:bt(R6)}),up=Jl.extend({method:tt("resources/templates/list")}),HO=Xl.extend({resourceTemplates:bt(qO)}),sb=_n.extend({uri:de()}),ZO=sb,lp=Or.extend({method:tt("resources/read"),params:ZO}),KO=Dr.extend({contents:bt(Dt([$6,A6]))}),VO=An.extend({method:tt("notifications/resources/list_changed"),params:$n.optional()}),WO=sb,GO=Or.extend({method:tt("resources/subscribe"),params:WO}),JO=sb,XO=Or.extend({method:tt("resources/unsubscribe"),params:JO}),YO=$n.extend({uri:de()}),QO=An.extend({method:tt("notifications/resources/updated"),params:YO}),eD=Qe({name:de(),description:Lt(de()),required:Lt(rr())}),tD=Qe({...Xs.shape,...Gl.shape,description:Lt(de()),arguments:Lt(bt(eD)),_meta:Lt(Lr({}))}),cp=Jl.extend({method:tt("prompts/list")}),rD=Xl.extend({prompts:bt(tD)}),nD=_n.extend({name:de(),arguments:Nt(de(),de()).optional()}),dp=Or.extend({method:tt("prompts/get"),params:nD}),ab=Qe({type:tt("text"),text:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),ub=Qe({type:tt("image"),data:ob,mimeType:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),lb=Qe({type:tt("audio"),data:ob,mimeType:de(),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),iD=Qe({type:tt("tool_use"),name:de(),id:de(),input:Nt(de(),qt()),_meta:Nt(de(),qt()).optional()}),oD=Qe({type:tt("resource"),resource:Dt([$6,A6]),annotations:Qs.optional(),_meta:Nt(de(),qt()).optional()}),sD=R6.extend({type:tt("resource_link")}),cb=Dt([ab,ub,lb,sD,oD]),aD=Qe({role:ec,content:cb}),uD=Dr.extend({description:de().optional(),messages:bt(aD)}),lD=An.extend({method:tt("notifications/prompts/list_changed"),params:$n.optional()}),cD=Qe({title:de().optional(),readOnlyHint:rr().optional(),destructiveHint:rr().optional(),idempotentHint:rr().optional(),openWorldHint:rr().optional()}),dD=Qe({taskSupport:Vr(["required","optional","forbidden"]).optional()}),C6=Qe({...Xs.shape,...Gl.shape,description:de().optional(),inputSchema:Qe({type:tt("object"),properties:Nt(de(),_r).optional(),required:bt(de()).optional()}).catchall(qt()),outputSchema:Qe({type:tt("object"),properties:Nt(de(),_r).optional(),required:bt(de()).optional()}).catchall(qt()).optional(),annotations:cD.optional(),execution:dD.optional(),_meta:Nt(de(),qt()).optional()}),fp=Jl.extend({method:tt("tools/list")}),fD=Xl.extend({tools:bt(C6)}),hp=Dr.extend({content:bt(cb).default([]),structuredContent:Nt(de(),qt()).optional(),isError:rr().optional()}),o0e=hp.or(Dr.extend({toolResult:qt()})),hD=Vl.extend({name:de(),arguments:Nt(de(),qt()).optional()}),ea=Or.extend({method:tt("tools/call"),params:hD}),pD=An.extend({method:tt("notifications/tools/list_changed"),params:$n.optional()}),s0e=Qe({autoRefresh:rr().default(!0),debounceMs:It().int().nonnegative().default(300)}),tc=Vr(["debug","info","notice","warning","error","critical","alert","emergency"]),mD=_n.extend({level:tc}),db=Or.extend({method:tt("logging/setLevel"),params:mD}),gD=$n.extend({level:tc,logger:de().optional(),data:qt()}),yD=An.extend({method:tt("notifications/message"),params:gD}),vD=Qe({name:de().optional()}),bD=Qe({hints:bt(vD).optional(),costPriority:It().min(0).max(1).optional(),speedPriority:It().min(0).max(1).optional(),intelligencePriority:It().min(0).max(1).optional()}),_D=Qe({mode:Vr(["auto","required","none"]).optional()}),wD=Qe({type:tt("tool_result"),toolUseId:de().describe("The unique identifier for the corresponding tool call."),content:bt(cb).default([]),structuredContent:Qe({}).loose().optional(),isError:rr().optional(),_meta:Nt(de(),qt()).optional()}),SD=Gf("type",[ab,ub,lb]),Wh=Gf("type",[ab,ub,lb,iD,wD]),xD=Qe({role:ec,content:Dt([Wh,bt(Wh)]),_meta:Nt(de(),qt()).optional()}),kD=Vl.extend({messages:bt(xD),modelPreferences:bD.optional(),systemPrompt:de().optional(),includeContext:Vr(["none","thisServer","allServers"]).optional(),temperature:It().optional(),maxTokens:It().int(),stopSequences:bt(de()).optional(),metadata:_r.optional(),tools:bt(C6).optional(),toolChoice:_D.optional()}),MD=Or.extend({method:tt("sampling/createMessage"),params:kD}),rc=Dr.extend({model:de(),stopReason:Lt(Vr(["endTurn","stopSequence","maxTokens"]).or(de())),role:ec,content:SD}),fb=Dr.extend({model:de(),stopReason:Lt(Vr(["endTurn","stopSequence","maxTokens","toolUse"]).or(de())),role:ec,content:Dt([Wh,bt(Wh)])}),ED=Qe({type:tt("boolean"),title:de().optional(),description:de().optional(),default:rr().optional()}),ID=Qe({type:tt("string"),title:de().optional(),description:de().optional(),minLength:It().optional(),maxLength:It().optional(),format:Vr(["email","uri","date","date-time"]).optional(),default:de().optional()}),TD=Qe({type:Vr(["number","integer"]),title:de().optional(),description:de().optional(),minimum:It().optional(),maximum:It().optional(),default:It().optional()}),PD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),enum:bt(de()),default:de().optional()}),$D=Qe({type:tt("string"),title:de().optional(),description:de().optional(),oneOf:bt(Qe({const:de(),title:de()})),default:de().optional()}),AD=Qe({type:tt("string"),title:de().optional(),description:de().optional(),enum:bt(de()),enumNames:bt(de()).optional(),default:de().optional()}),RD=Dt([PD,$D]),CD=Qe({type:tt("array"),title:de().optional(),description:de().optional(),minItems:It().optional(),maxItems:It().optional(),items:Qe({type:tt("string"),enum:bt(de())}),default:bt(de()).optional()}),OD=Qe({type:tt("array"),title:de().optional(),description:de().optional(),minItems:It().optional(),maxItems:It().optional(),items:Qe({anyOf:bt(Qe({const:de(),title:de()}))}),default:bt(de()).optional()}),DD=Dt([CD,OD]),ND=Dt([AD,RD,DD]),zD=Dt([ND,ED,ID,TD]),jD=Vl.extend({mode:tt("form").optional(),message:de(),requestedSchema:Qe({type:tt("object"),properties:Nt(de(),zD),required:bt(de()).optional()})}),UD=Vl.extend({mode:tt("url"),message:de(),elicitationId:de(),url:de().url()}),LD=Dt([jD,UD]),FD=Or.extend({method:tt("elicitation/create"),params:LD}),qD=$n.extend({elicitationId:de()}),BD=An.extend({method:tt("notifications/elicitation/complete"),params:qD}),ta=Dr.extend({action:Vr(["accept","decline","cancel"]),content:Xf((e)=>e===null?void 0:e,Nt(de(),Dt([de(),It(),rr(),bt(de())])).optional())}),HD=Qe({type:tt("ref/resource"),uri:de()});var ZD=Qe({type:tt("ref/prompt"),name:de()}),KD=_n.extend({ref:Dt([ZD,HD]),argument:Qe({name:de(),value:de()}),context:Qe({arguments:Nt(de(),de()).optional()}).optional()}),pp=Or.extend({method:tt("completion/complete"),params:KD});function O6(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function D6(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var VD=Dr.extend({completion:Lr({values:bt(de()).max(100),total:Lt(It().int()),hasMore:Lt(rr())})}),WD=Qe({uri:de().startsWith("file://"),name:de().optional(),_meta:Nt(de(),qt()).optional()}),GD=Or.extend({method:tt("roots/list"),params:_n.optional()}),hb=Dr.extend({roots:bt(WD)}),JD=An.extend({method:tt("notifications/roots/list_changed"),params:$n.optional()}),a0e=Dt([Qh,nb,pp,db,dp,cp,ap,up,lp,GO,XO,ea,fp,tp,np,ip,sp]),u0e=Dt([Yh,ep,ib,JD,Ql]),l0e=Dt([Xh,rc,fb,ta,hb,rp,op,Ys]),c0e=Dt([Qh,MD,FD,GD,tp,np,ip,sp]),d0e=Dt([Yh,ep,yD,QO,VO,pD,lD,Ql,BD]),f0e=Dt([Xh,NO,VD,uD,rD,BO,HO,KO,hp,fD,rp,op,Ys]);class rt extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===it.UrlElicitationRequired&&r){let i=r;if(i.elicitations)return new N6(i.elicitations,t)}return new rt(e,t,r)}}class N6 extends rt{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(it.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function to(e){return e==="completed"||e==="failed"||e==="cancelled"}var j6=Symbol("Let zodToJsonSchema decide on which parser to use");var z6={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"},U6=(e)=>typeof e==="string"?{...z6,name:e}:{...z6,...e};var L6=(e)=>{let t=U6(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([i,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,i],jsonSchema:void 0}]))}};function pb(e,t,r,i){if(!i?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function St(e,t,r,i,n){e[t]=r,pb(e,t,i,n)}var mp=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function Zt(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?mp(t,e.currentPath):t.join("/")}}function F6(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==Le.ZodAny)r.items=st(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)St(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)St(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)St(r,"minItems",e.exactLength.value,e.exactLength.message,t),St(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function q6(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"min":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"minimum",i.value,i.message,t);else St(r,"exclusiveMinimum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMinimum=!0;St(r,"minimum",i.value,i.message,t)}break;case"max":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"maximum",i.value,i.message,t);else St(r,"exclusiveMaximum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMaximum=!0;St(r,"maximum",i.value,i.message,t)}break;case"multipleOf":St(r,"multipleOf",i.value,i.message,t);break}return r}function B6(){return{type:"boolean"}}function gp(e,t){return st(e.type._def,t)}var H6=(e,t)=>st(e.innerType._def,t);function mb(e,t,r){let i=r??t.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,o)=>mb(e,t,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return XD(e,t)}}var XD=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let i of e.checks)switch(i.kind){case"min":St(r,"minimum",i.value,i.message,t);break;case"max":St(r,"maximum",i.value,i.message,t);break}return r};function Z6(e,t){return{...st(e.innerType._def,t),default:e.defaultValue()}}function K6(e,t){return t.effectStrategy==="input"?st(e.schema._def,t):Zt(t)}function V6(e){return{type:"string",enum:Array.from(e.values)}}var YD=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function W6(e,t){let r=[st(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),st(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((o)=>!!o),i=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach((o)=>{if(YD(o)){if(n.push(...o.allOf),o.unevaluatedProperties===void 0)i=void 0}else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:h,...v}=o;s=v}else i=void 0;n.push(s)}}),n.length?{allOf:n,...i}:void 0}function G6(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var gb=void 0,Fn={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:()=>{if(gb===void 0)gb=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return gb},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 yp(e,t){let r={type:"string"};if(e.checks)for(let i of e.checks)switch(i.kind){case"min":St(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,i.value):i.value,i.message,t);break;case"max":St(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"email":switch(t.emailStrategy){case"format:email":qn(r,"email",i.message,t);break;case"format:idn-email":qn(r,"idn-email",i.message,t);break;case"pattern:zod":Gr(r,Fn.email,i.message,t);break}break;case"url":qn(r,"uri",i.message,t);break;case"uuid":qn(r,"uuid",i.message,t);break;case"regex":Gr(r,i.regex,i.message,t);break;case"cuid":Gr(r,Fn.cuid,i.message,t);break;case"cuid2":Gr(r,Fn.cuid2,i.message,t);break;case"startsWith":Gr(r,RegExp(`^${yb(i.value,t)}`),i.message,t);break;case"endsWith":Gr(r,RegExp(`${yb(i.value,t)}$`),i.message,t);break;case"datetime":qn(r,"date-time",i.message,t);break;case"date":qn(r,"date",i.message,t);break;case"time":qn(r,"time",i.message,t);break;case"duration":qn(r,"duration",i.message,t);break;case"length":St(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,i.value):i.value,i.message,t),St(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,i.value):i.value,i.message,t);break;case"includes":{Gr(r,RegExp(yb(i.value,t)),i.message,t);break}case"ip":{if(i.version!=="v6")qn(r,"ipv4",i.message,t);if(i.version!=="v4")qn(r,"ipv6",i.message,t);break}case"base64url":Gr(r,Fn.base64url,i.message,t);break;case"jwt":Gr(r,Fn.jwt,i.message,t);break;case"cidr":{if(i.version!=="v6")Gr(r,Fn.ipv4Cidr,i.message,t);if(i.version!=="v4")Gr(r,Fn.ipv6Cidr,i.message,t);break}case"emoji":Gr(r,Fn.emoji(),i.message,t);break;case"ulid":{Gr(r,Fn.ulid,i.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{qn(r,"binary",i.message,t);break}case"contentEncoding:base64":{St(r,"contentEncoding","base64",i.message,t);break}case"pattern:zod":{Gr(r,Fn.base64,i.message,t);break}}break}case"nanoid":Gr(r,Fn.nanoid,i.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((n)=>{})(i)}return r}function yb(e,t){return t.patternStrategy==="escape"?eN(e):e}var QD=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function eN(e){let t="";for(let r=0;r<e.length;r++){if(!QD.has(e[r]))t+="\\";t+=e[r]}return t}function qn(e,t,r,i){if(e.format||e.anyOf?.some((n)=>n.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&i.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...r&&i.errorMessages&&{errorMessage:{format:r}}})}else St(e,"format",t,r,i)}function Gr(e,t,r,i){if(e.pattern||e.allOf?.some((n)=>n.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&i.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:J6(t,i),...r&&i.errorMessages&&{errorMessage:{pattern:r}}})}else St(e,"pattern",J6(t,i),r,i)}function J6(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},i=r.i?e.source.toLowerCase():e.source,n="",o=!1,s=!1,h=!1;for(let v=0;v<i.length;v++){if(o){n+=i[v],o=!1;continue}if(r.i){if(s){if(i[v].match(/[a-z]/)){if(h)n+=i[v],n+=`${i[v-2]}-${i[v]}`.toUpperCase(),h=!1;else if(i[v+1]==="-"&&i[v+2]?.match(/[a-z]/))n+=i[v],h=!0;else n+=`${i[v]}${i[v].toUpperCase()}`;continue}}else if(i[v].match(/[a-z]/)){n+=`[${i[v]}${i[v].toUpperCase()}]`;continue}}if(r.m){if(i[v]==="^"){n+=`(^|(?<=[\r
106
106
  ]))`;continue}else if(i[v]==="$"){n+=`($|(?=[\r
107
107
  ]))`;continue}}if(r.s&&i[v]==="."){n+=s?`${i[v]}\r
108
108
  `:`[${i[v]}\r
109
- ]`;continue}if(n+=i[v],i[v]==="\\")o=!0;else if(s&&i[v]==="]")s=!1;else if(!s&&i[v]==="[")s=!0}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return n}function vp(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===Le.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((i,n)=>({...i,[n]:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??Zt(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===Le.ZodString&&e.keyType._def.checks?.length){let{type:i,...n}=yp(e.keyType._def,t);return{...r,propertyNames:n}}else if(e.keyType?._def.typeName===Le.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===Le.ZodBranded&&e.keyType._def.type._def.typeName===Le.ZodString&&e.keyType._def.type._def.checks?.length){let{type:i,...n}=gp(e.keyType._def,t);return{...r,propertyNames:n}}return r}function X6(e,t){if(t.mapStrategy==="record")return vp(e,t);let r=st(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Zt(t),i=st(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Zt(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,i],minItems:2,maxItems:2}}}function Y6(e){let t=e.values,i=Object.keys(e.values).filter((o)=>typeof t[t[o]]!=="number").map((o)=>t[o]),n=Array.from(new Set(i.map((o)=>typeof o)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:i}}function Q6(e){return e.target==="openAi"?void 0:{not:Zt({...e,currentPath:[...e.currentPath,"not"]})}}function ek(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var nc={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function rk(e,t){if(t.target==="openApi3")return tk(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((i)=>(i._def.typeName in nc)&&(!i._def.checks||!i._def.checks.length))){let i=r.reduce((n,o)=>{let s=nc[o._def.typeName];return s&&!n.includes(s)?[...n,s]:n},[]);return{type:i.length>1?i:i[0]}}else if(r.every((i)=>i._def.typeName==="ZodLiteral"&&!i.description)){let i=r.reduce((n,o)=>{let s=typeof o._def.value;switch(s){case"string":case"number":case"boolean":return[...n,s];case"bigint":return[...n,"integer"];case"object":if(o._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(i.length===r.length){let n=i.filter((o,s,h)=>h.indexOf(o)===s);return{type:n.length>1?n:n[0],enum:r.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(r.every((i)=>i._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((i,n)=>[...i,...n._def.values.filter((o)=>!i.includes(o))],[])};return tk(e,t)}var tk=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((i,n)=>st(i._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter((i)=>!!i&&(!t.strictUnions||typeof i==="object"&&Object.keys(i).length>0));return r.length?{anyOf:r}:void 0};function nk(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:nc[e.innerType._def.typeName],nullable:!0};return{type:[nc[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let i=st(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(i&&"$ref"in i)return{allOf:[i],nullable:!0};return i&&{...i,nullable:!0}}let r=st(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function ik(e,t){let r={type:"number"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"int":r.type="integer",pb(r,"type",i.message,t);break;case"min":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"minimum",i.value,i.message,t);else St(r,"exclusiveMinimum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMinimum=!0;St(r,"minimum",i.value,i.message,t)}break;case"max":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"maximum",i.value,i.message,t);else St(r,"exclusiveMaximum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMaximum=!0;St(r,"maximum",i.value,i.message,t)}break;case"multipleOf":St(r,"multipleOf",i.value,i.message,t);break}return r}function ok(e,t){let r=t.target==="openAi",i={type:"object",properties:{}},n=[],o=e.shape();for(let h in o){let v=o[h];if(v===void 0||v._def===void 0)continue;let b=rN(v);if(b&&r){if(v._def.typeName==="ZodOptional")v=v._def.innerType;if(!v.isNullable())v=v.nullable();b=!1}let _=st(v._def,{...t,currentPath:[...t.currentPath,"properties",h],propertyPath:[...t.currentPath,"properties",h]});if(_===void 0)continue;if(i.properties[h]=_,!b)n.push(h)}if(n.length)i.required=n;let s=tN(e,t);if(s!==void 0)i.additionalProperties=s;return i}function tN(e,t){if(e.catchall._def.typeName!=="ZodNever")return st(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function rN(e){try{return e.isOptional()}catch{return!0}}var sk=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return st(e.innerType._def,t);let r=st(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Zt(t)},r]}:Zt(t)};var ak=(e,t)=>{if(t.pipeStrategy==="input")return st(e.in._def,t);else if(t.pipeStrategy==="output")return st(e.out._def,t);let r=st(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),i=st(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,i].filter((n)=>n!==void 0)}};function uk(e,t){return st(e.type._def,t)}function lk(e,t){let i={type:"array",uniqueItems:!0,items:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)St(i,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)St(i,"maxItems",e.maxSize.value,e.maxSize.message,t);return i}function ck(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,i)=>st(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[]),additionalItems:st(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,i)=>st(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[])}}function dk(e){return{not:Zt(e)}}function fk(e){return Zt(e)}var hk=(e,t)=>st(e.innerType._def,t);var pk=(e,t,r)=>{switch(t){case Le.ZodString:return yp(e,r);case Le.ZodNumber:return ik(e,r);case Le.ZodObject:return ok(e,r);case Le.ZodBigInt:return q6(e,r);case Le.ZodBoolean:return B6();case Le.ZodDate:return mb(e,r);case Le.ZodUndefined:return dk(r);case Le.ZodNull:return ek(r);case Le.ZodArray:return F6(e,r);case Le.ZodUnion:case Le.ZodDiscriminatedUnion:return rk(e,r);case Le.ZodIntersection:return W6(e,r);case Le.ZodTuple:return ck(e,r);case Le.ZodRecord:return vp(e,r);case Le.ZodLiteral:return G6(e,r);case Le.ZodEnum:return V6(e);case Le.ZodNativeEnum:return Y6(e);case Le.ZodNullable:return nk(e,r);case Le.ZodOptional:return sk(e,r);case Le.ZodMap:return X6(e,r);case Le.ZodSet:return lk(e,r);case Le.ZodLazy:return()=>e.getter()._def;case Le.ZodPromise:return uk(e,r);case Le.ZodNaN:case Le.ZodNever:return Q6(r);case Le.ZodEffects:return K6(e,r);case Le.ZodAny:return Zt(r);case Le.ZodUnknown:return fk(r);case Le.ZodDefault:return Z6(e,r);case Le.ZodBranded:return gp(e,r);case Le.ZodReadonly:return hk(e,r);case Le.ZodCatch:return H6(e,r);case Le.ZodPipeline:return ak(e,r);case Le.ZodFunction:case Le.ZodVoid:case Le.ZodSymbol:return;default:return((i)=>{return})(t)}};function st(e,t,r=!1){let i=t.seen.get(e);if(t.override){let h=t.override?.(e,t,i,r);if(h!==j6)return h}if(i&&!r){let h=nN(i,t);if(h!==void 0)return h}let n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);let o=pk(e,e.typeName,t),s=typeof o==="function"?st(o(),t):o;if(s)iN(e,t,s);if(t.postProcess){let h=t.postProcess(s,e,t);return n.jsonSchema=s,h}return n.jsonSchema=s,s}var nN=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:mp(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,i)=>t.currentPath[i]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Zt(t);return t.$refStrategy==="seen"?Zt(t):void 0}}},iN=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var vb=(e,t)=>{let r=L6(t),i=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((v,[b,_])=>({...v,[b]:st(_._def,{...r,currentPath:[...r.basePath,r.definitionPath,b]},!0)??Zt(r)}),{}):void 0,n=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=st(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??Zt(r),s=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(s!==void 0)o.title=s;if(r.flags.hasReferencedOpenAiAnyType){if(!i)i={};if(!i[r.openAiAnyTypeName])i[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let h=n===void 0?i?{...o,[r.definitionPath]:i}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...i,[n]:o}};if(r.target==="jsonSchema7")h.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")h.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in h)||("oneOf"in h)||("allOf"in h)||("type"in h)&&Array.isArray(h.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return h};function oN(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function bb(e,t){if(Pn(e))return xs(e,{target:oN(t?.target),io:t?.pipeStrategy??"input"});return vb(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function _b(e){let r=Qi(e)?.method;if(!r)throw Error("Schema is missing a method literal");let i=Vh(r);if(typeof i!=="string")throw Error("Schema method literal must be a string");return i}function wb(e,t){let r=Yi(e,t);if(!r.success)throw r.error;return r.data}var sN=60000;class Sb{constructor(e){if(this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Yh,(t)=>{this._oncancel(t)}),this.setNotificationHandler(ep,(t)=>{this._onprogress(t)}),this.setRequestHandler(Qh,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(tp,async(t,r)=>{let i=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!i)throw new rt(it.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(np,async(t,r)=>{let i=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let s;while(s=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(s.type==="response"||s.type==="error"){let h=s.message,v=h.id,b=this._requestResolvers.get(v);if(b)if(this._requestResolvers.delete(v),s.type==="response")b(h);else{let _=h,g=new rt(_.error.code,_.error.message,_.error.data);b(g)}else{let _=s.type==="response"?"Response":"Error";this._onerror(Error(`${_} handler missing for request ${v}`))}continue}await this._transport?.send(s.message,{relatedRequestId:r.requestId})}}let o=await this._taskStore.getTask(n,r.sessionId);if(!o)throw new rt(it.InvalidParams,`Task not found: ${n}`);if(!to(o.status))return await this._waitForTaskUpdate(n,r.signal),await i();if(to(o.status)){let s=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...s,_meta:{...s._meta,[eo]:{taskId:n}}}}return await i()};return await i()}),this.setRequestHandler(ip,async(t,r)=>{try{let{tasks:i,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:i,nextCursor:n,_meta:{}}}catch(i){throw new rt(it.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(sp,async(t,r)=>{try{let i=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!i)throw new rt(it.InvalidParams,`Task not found: ${t.params.taskId}`);if(to(i.status))throw new rt(it.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new rt(it.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(i){if(i instanceof rt)throw i;throw new rt(it.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,i,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:i})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),rt.fromError(it.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let i=this._transport?.onmessage;this._transport.onmessage=(n,o)=>{if(i?.(n,o),Wl(n)||E6(n))this._onresponse(n);else if(eb(n))this._onrequest(n,o);else if(M6(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=rt.fromError(it.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,n=e.params?._meta?.[eo]?.taskId;if(r===void 0){let b={jsonrpc:"2.0",id:e.id,error:{code:it.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:b,timestamp:Date.now()},i?.sessionId).catch((_)=>this._onerror(Error(`Failed to enqueue error response: ${_}`)));else i?.send(b).catch((_)=>this._onerror(Error(`Failed to send an error response: ${_}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let s=S6(e.params)?e.params.task:void 0,h=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,v={signal:o.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async(b)=>{if(o.signal.aborted)return;let _={relatedRequestId:e.id};if(n)_.relatedTask={taskId:n};await this.notification(b,_)},sendRequest:async(b,_,g)=>{if(o.signal.aborted)throw new rt(it.ConnectionClosed,"Request was cancelled");let S={...g,relatedRequestId:e.id};if(n&&!S.relatedTask)S.relatedTask={taskId:n};let x=S.relatedTask?.taskId??n;if(x&&h)await h.updateTaskStatus(x,"input_required");return await this.request(b,_,S)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:h,taskRequestedTtl:s?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(s)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,v)).then(async(b)=>{if(o.signal.aborted)return;let _={result:b,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:_,timestamp:Date.now()},i?.sessionId);else await i?.send(_)},async(b)=>{if(o.signal.aborted)return;let _={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(b.code)?b.code:it.InternalError,message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:_,timestamp:Date.now()},i?.sessionId);else await i?.send(_)}).catch((b)=>this._onerror(Error(`Failed to send response: ${b}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===o)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,i=Number(t),n=this._progressHandlers.get(i);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(h){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(h);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),Wl(e))r(e);else{let o=new rt(e.error.code,e.error.message,e.error.data);r(o)}return}let i=this._responseHandlers.get(t);if(i===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let n=!1;if(Wl(e)&&e.result&&typeof e.result==="object"){let o=e.result;if(o.task&&typeof o.task==="object"){let s=o.task;if(typeof s.taskId==="string")n=!0,this._taskProgressTokens.set(s.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(Wl(e))i(e);else{let o=rt.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:i}=r??{};if(!i){try{yield{type:"result",result:await this.request(e,t,r)}}catch(o){yield{type:"error",error:o instanceof rt?o:new rt(it.InternalError,String(o))}}return}let n;try{let o=await this.request(e,Ys,r);if(o.task)n=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new rt(it.InternalError,"Task creation did not return a task");while(!0){let s=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:s},to(s.status)){if(s.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(s.status==="failed")yield{type:"error",error:new rt(it.InternalError,`Task ${n} failed`)};else if(s.status==="cancelled")yield{type:"error",error:new rt(it.InternalError,`Task ${n} was cancelled`)};return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let h=s.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((v)=>setTimeout(v,h)),r?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof rt?o:new rt(it.InternalError,String(o))}}}request(e,t,r){let{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o,task:s,relatedTask:h}=r??{};return new Promise((v,b)=>{let _=(P)=>{b(P)};if(!this._transport){_(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),s)this.assertTaskCapability(e.method)}catch(P){_(P);return}r?.signal?.throwIfAborted();let g=this._requestMessageId++,S={...e,jsonrpc:"2.0",id:g};if(r?.onprogress)this._progressHandlers.set(g,r.onprogress),S.params={...e.params,_meta:{...e.params?._meta||{},progressToken:g}};if(s)S.params={...S.params,task:s};if(h)S.params={...S.params,_meta:{...S.params?._meta||{},[eo]:h}};let x=(P)=>{this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(P)}},{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((R)=>this._onerror(Error(`Failed to send cancellation: ${R}`)));let $=P instanceof rt?P:new rt(it.RequestTimeout,String(P));b($)};this._responseHandlers.set(g,(P)=>{if(r?.signal?.aborted)return;if(P instanceof Error)return b(P);try{let $=Yi(t,P.result);if(!$.success)b($.error);else v($.data)}catch($){b($)}}),r?.signal?.addEventListener("abort",()=>{x(r?.signal?.reason)});let M=r?.timeout??sN,I=()=>x(rt.fromError(it.RequestTimeout,"Request timed out",{timeout:M}));this._setupTimeout(g,M,r?.maxTotalTimeout,I,r?.resetTimeoutOnProgress??!1);let T=h?.taskId;if(T){let P=($)=>{let R=this._responseHandlers.get(g);if(R)R($);else this._onerror(Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,P),this._enqueueTaskMessage(T,{type:"request",message:S,timestamp:Date.now()}).catch(($)=>{this._cleanupTimeout(g),b($)})}else this._transport.send(S,{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((P)=>{this._cleanupTimeout(g),b(P)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},rp,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},op,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},T6,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[eo]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[eo]:t.relatedTask}}};this._transport?.send(s,t).catch((h)=>this._onerror(h))});return}let o={...e,jsonrpc:"2.0"};if(t?.relatedTask)o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[eo]:t.relatedTask}}};await this._transport.send(o,t)}setRequestHandler(e,t){let r=_b(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(i,n)=>{let o=wb(e,i);return Promise.resolve(t(o,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=_b(e);this._notificationHandlers.set(r,(i)=>{let n=wb(e,i);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,i)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let i of r)if(i.type==="request"&&eb(i.message)){let n=i.message.id,o=this._requestResolvers.get(n);if(o)o(new rt(it.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let i=await this._taskStore?.getTask(e);if(i?.pollInterval)r=i.pollInterval}catch{}return new Promise((i,n)=>{if(t.aborted){n(new rt(it.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,r);t.addEventListener("abort",()=>{clearTimeout(o),n(new rt(it.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(i)=>{if(!e)throw Error("No request provided");return await r.createTask(i,e.id,{method:e.method,params:e.params},t)},getTask:async(i)=>{let n=await r.getTask(i,t);if(!n)throw new rt(it.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(i,n,o)=>{await r.storeTaskResult(i,n,o,t);let s=await r.getTask(i,t);if(s){let h=Ql.parse({method:"notifications/tasks/status",params:s});if(await this.notification(h),to(s.status))this._cleanupTaskProgressHandler(i)}},getTaskResult:(i)=>r.getTaskResult(i,t),updateTaskStatus:async(i,n,o)=>{let s=await r.getTask(i,t);if(!s)throw new rt(it.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(to(s.status))throw new rt(it.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(i,n,o,t);let h=await r.getTask(i,t);if(h){let v=Ql.parse({method:"notifications/tasks/status",params:h});if(await this.notification(v),to(h.status))this._cleanupTaskProgressHandler(i)}},listTasks:(i)=>r.listTasks(i,t)}}}function mk(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function gk(e,t){let r={...e};for(let i in t){let n=i,o=t[n];if(o===void 0)continue;let s=r[n];if(mk(s)&&mk(o))r[n]={...s,...o};else r[n]=o}return r}var YE=U_(y_(),1),QE=U_(XE(),1);function TH(){let e=new YE.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return QE.default(e),e}class I_{constructor(e){this._ajv=e??TH()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class T_{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages[e.messages.length-1],n=Array.isArray(i.content)?i.content:[i.content],o=n.some((b)=>b.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,h=s?Array.isArray(s.content)?s.content:[s.content]:[],v=h.some((b)=>b.type==="tool_use");if(o){if(n.some((b)=>b.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!v)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(v){let b=new Set(h.filter((g)=>g.type==="tool_use").map((g)=>g.id)),_=new Set(n.filter((g)=>g.type==="tool_result").map((g)=>g.toolUseId));if(b.size!==_.size||![...b].every((g)=>_.has(g)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},rc,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),i=e.mode??"form";switch(i){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=i==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},ta,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function e8(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function t8(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class P_ extends Sb{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(tc.options.map((r,i)=>[r,i])),this.isMessageIgnored=(r,i)=>{let n=this._loggingLevels.get(i);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new I_,this.setRequestHandler(nb,(r)=>this._oninitialize(r)),this.setNotificationHandler(ib,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(db,async(r,i)=>{let n=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=r.params,s=tc.safeParse(o);if(s.success)this._loggingLevels.set(n,s.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new T_(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=gk(this._capabilities,e)}setRequestHandler(e,t){let i=Qi(e)?.method;if(!i)throw Error("Schema is missing a method literal");let n;if(Pn(i)){let s=i;n=s._zod?.def?.value??s.value}else{let s=i;n=s._def?.value??s.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let s=async(h,v)=>{let b=Yi(ea,h);if(!b.success){let x=b.error instanceof Error?b.error.message:String(b.error);throw new rt(it.InvalidParams,`Invalid tools/call request: ${x}`)}let{params:_}=b.data,g=await Promise.resolve(t(h,v));if(_.task){let x=Yi(Ys,g);if(!x.success){let M=x.error instanceof Error?x.error.message:String(x.error);throw new rt(it.InvalidParams,`Invalid task creation result: ${M}`)}return x.data}let S=Yi(hp,g);if(!S.success){let x=S.error instanceof Error?S.error.message:String(S.error);throw new rt(it.InvalidParams,`Invalid tools/call result: ${x}`)}return S.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){t8(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;e8(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:b6.includes(t)?t:Yv,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Xh)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],i=Array.isArray(r.content)?r.content:[r.content],n=i.some((v)=>v.type==="tool_result"),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],h=s.some((v)=>v.type==="tool_use");if(n){if(i.some((v)=>v.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!h)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(h){let v=new Set(s.filter((_)=>_.type==="tool_use").map((_)=>_.id)),b=new Set(i.filter((_)=>_.type==="tool_result").map((_)=>_.toolUseId));if(v.size!==b.size||![...v].every((_)=>b.has(_)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},fb,t);return this.request({method:"sampling/createMessage",params:e},rc,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},ta,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:i},ta,t);if(n.action==="accept"&&n.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(n.content);if(!s.valid)throw new rt(it.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(o){if(o instanceof rt)throw o;throw new rt(it.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return n}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},hb,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var n8=Symbol.for("mcp.completable");function $_(e){return!!e&&typeof e==="object"&&n8 in e}function i8(e){return e[n8]?.complete}var r8;(function(e){e.Completable="McpCompletable"})(r8||(r8={}));var PH=/^[A-Za-z0-9._-]{1,128}$/;function $H(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!PH.test(e)){let r=e.split("").filter((i)=>!/[A-Za-z0-9._-]/.test(i)).filter((i,n,o)=>o.indexOf(i)===n);return t.push(`Tool name contains invalid characters: ${r.map((i)=>`"${i}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function AH(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function A_(e){let t=$H(e);return AH(e,t.warnings),t.isValid}class R_{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let i={taskSupport:"required",...t.execution};if(i.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,i,t._meta,r)}}class O_{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new P_(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new R_(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(fp)),this.server.assertCanSetRequestHandler(lo(ea)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(fp,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let i=Js(t.inputSchema);return i?bb(i,{strictUnions:!0,pipeStrategy:"input"}):RH})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let i=Js(t.outputSchema);if(i)r.outputSchema=bb(i,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(ea,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new rt(it.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Tool ${e.params.name} disabled`);let i=!!e.params.task,n=r.execution?.taskSupport,o="createTask"in r.handler;if((n==="required"||n==="optional")&&!o)throw new rt(it.InternalError,`Tool ${e.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!i)throw new rt(it.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!i&&o)return await this.handleAutomaticTaskPolling(r,e,t);let s=await this.validateToolInput(r,e.params.arguments,e.params.name),h=await this.executeToolHandler(r,s,t);if(i)return h;return await this.validateToolOutput(r,h,e.params.name),h}catch(r){if(r instanceof rt){if(r.code===it.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let n=Js(e.inputSchema)??e.inputSchema,o=await Zh(n,t);if(!o.success){let s="error"in o?o.error:"Unknown error",h=Kh(s);throw new rt(it.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${h}`)}return o.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new rt(it.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let i=Js(e.outputSchema),n=await Zh(i,t.structuredContent);if(!n.success){let o="error"in n?n.error:"Unknown error",s=Kh(o);throw new rt(it.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${s}`)}}async executeToolHandler(e,t,r){let i=e.handler;if("createTask"in i){if(!r.taskStore)throw Error("No task store provided.");let o={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(i.createTask(t,o));else return await Promise.resolve(i.createTask(o))}if(e.inputSchema)return await Promise.resolve(i(t,r));else return await Promise.resolve(i(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(e,t.params.arguments,t.params.name),n=e.handler,o={...r,taskStore:r.taskStore},s=i?await Promise.resolve(n.createTask(i,o)):await Promise.resolve(n.createTask(o)),h=s.task.taskId,v=s.task,b=v.pollInterval??5000;while(v.status!=="completed"&&v.status!=="failed"&&v.status!=="cancelled"){await new Promise((g)=>setTimeout(g,b));let _=await r.taskStore.getTask(h);if(!_)throw new rt(it.InternalError,`Task ${h} not found during polling`);v=_}return await r.taskStore.getTaskResult(h)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(lo(pp)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(pp,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return O6(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return D6(e),this.handleResourceCompletion(e,e.params.ref);default:throw new rt(it.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new rt(it.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Ic;let n=Qi(r.argsSchema)?.[e.params.argument.name];if(!$_(n))return Ic;let o=i8(n);if(!o)return Ic;let s=await o(e.params.argument.value,e.params.context);return s8(s)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((o)=>o.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return Ic;throw new rt(it.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let i=r.resourceTemplate.completeCallback(e.params.argument.name);if(!i)return Ic;let n=await i(e.params.argument.value,e.params.context);return s8(n)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(ap)),this.server.assertCanSetRequestHandler(lo(up)),this.server.assertCanSetRequestHandler(lo(lp)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(ap,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,o])=>o.enabled).map(([n,o])=>({uri:n,name:o.name,...o.metadata})),i=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let o=await n.resourceTemplate.listCallback(t);for(let s of o.resources)i.push({...n.metadata,...s})}return{resources:[...r,...i]}}),this.server.setRequestHandler(up,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(lp,async(e,t)=>{let r=new URL(e.params.uri),i=this._registeredResources[r.toString()];if(i){if(!i.enabled)throw new rt(it.InvalidParams,`Resource ${r} disabled`);return i.readCallback(r,t)}for(let n of Object.values(this._registeredResourceTemplates)){let o=n.resourceTemplate.uriTemplate.match(r.toString());if(o)return n.readCallback(r,o,t)}throw new rt(it.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(cp)),this.server.assertCanSetRequestHandler(lo(dp)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(cp,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?CH(t.argsSchema):void 0}))})),this.server.setRequestHandler(dp,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new rt(it.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let i=Js(r.argsSchema),n=await Zh(i,e.params.arguments);if(!n.success){let h="error"in n?n.error:"Unknown error",v=Kh(h);throw new rt(it.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${v}`)}let o=n.data,s=r.callback;return await Promise.resolve(s(o,t))}else{let i=r.callback;return await Promise.resolve(i(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let i;if(typeof r[0]==="object")i=r.shift();let n=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,void 0,t,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,void 0,t,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(e,t,r,i){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,r.title,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,r.title,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,t,r,i,n){let o={name:e,title:t,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:(s)=>{if(typeof s.uri<"u"&&s.uri!==r){if(delete this._registeredResources[r],s.uri)this._registeredResources[s.uri]=o}if(typeof s.name<"u")o.name=s.name;if(typeof s.title<"u")o.title=s.title;if(typeof s.metadata<"u")o.metadata=s.metadata;if(typeof s.callback<"u")o.readCallback=s.callback;if(typeof s.enabled<"u")o.enabled=s.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=o,o}_createRegisteredResourceTemplate(e,t,r,i,n){let o={resourceTemplate:r,title:t,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:(v)=>{if(typeof v.name<"u"&&v.name!==e){if(delete this._registeredResourceTemplates[e],v.name)this._registeredResourceTemplates[v.name]=o}if(typeof v.title<"u")o.title=v.title;if(typeof v.template<"u")o.resourceTemplate=v.template;if(typeof v.metadata<"u")o.metadata=v.metadata;if(typeof v.callback<"u")o.readCallback=v.callback;if(typeof v.enabled<"u")o.enabled=v.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=o;let s=r.uriTemplate.variableNames;if(Array.isArray(s)&&s.some((v)=>!!r.completeCallback(v)))this.setCompletionRequestHandler();return o}_createRegisteredPrompt(e,t,r,i,n){let o={title:t,description:r,argsSchema:i===void 0?void 0:Ho(i),callback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:(s)=>{if(typeof s.name<"u"&&s.name!==e){if(delete this._registeredPrompts[e],s.name)this._registeredPrompts[s.name]=o}if(typeof s.title<"u")o.title=s.title;if(typeof s.description<"u")o.description=s.description;if(typeof s.argsSchema<"u")o.argsSchema=Ho(s.argsSchema);if(typeof s.callback<"u")o.callback=s.callback;if(typeof s.enabled<"u")o.enabled=s.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=o,i){if(Object.values(i).some((h)=>{let v=h instanceof Tn?h._def?.innerType:h;return $_(v)}))this.setCompletionRequestHandler()}return o}_createRegisteredTool(e,t,r,i,n,o,s,h,v){A_(e);let b={title:t,description:r,inputSchema:o8(i),outputSchema:o8(n),annotations:o,execution:s,_meta:h,handler:v,enabled:!0,disable:()=>b.update({enabled:!1}),enable:()=>b.update({enabled:!0}),remove:()=>b.update({name:null}),update:(_)=>{if(typeof _.name<"u"&&_.name!==e){if(typeof _.name==="string")A_(_.name);if(delete this._registeredTools[e],_.name)this._registeredTools[_.name]=b}if(typeof _.title<"u")b.title=_.title;if(typeof _.description<"u")b.description=_.description;if(typeof _.paramsSchema<"u")b.inputSchema=Ho(_.paramsSchema);if(typeof _.outputSchema<"u")b.outputSchema=Ho(_.outputSchema);if(typeof _.callback<"u")b.handler=_.callback;if(typeof _.annotations<"u")b.annotations=_.annotations;if(typeof _._meta<"u")b._meta=_._meta;if(typeof _.enabled<"u")b.enabled=_.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=b,this.setToolRequestHandlers(),this.sendToolListChanged(),b}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,i,n,o;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let h=t[0];if(C_(h)){if(i=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!C_(t[0]))o=t.shift()}else if(typeof h==="object"&&h!==null){if(Object.values(h).some((v)=>typeof v==="object"&&v!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);o=t.shift()}}let s=t[0];return this._createRegisteredTool(e,void 0,r,i,n,o,{taskSupport:"forbidden"},void 0,s)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:i,description:n,inputSchema:o,outputSchema:s,annotations:h,_meta:v}=t;return this._createRegisteredTool(e,i,n,o,s,h,{taskSupport:"forbidden"},v,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let i;if(t.length>1)i=t.shift();let n=t[0],o=this._createRegisteredPrompt(e,void 0,r,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:i,description:n,argsSchema:o}=t,s=this._createRegisteredPrompt(e,i,n,o,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var RH={type:"object",properties:{}};function a8(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function u8(e){return"_def"in e||"_zod"in e||a8(e)}function C_(e){if(typeof e!=="object"||e===null)return!1;if(u8(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(a8)}function o8(e){if(!e)return;if(C_(e))return Ho(e);if(!u8(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function CH(e){let t=Qi(e);if(!t)return[];return Object.entries(t).map(([r,i])=>{let n=y6(i),o=v6(i);return{name:r,description:n,required:!o}})}function lo(e){let r=Qi(e)?.method;if(!r)throw Error("Schema is missing a method literal");let i=Vh(r);if(typeof i==="string")return i;throw Error("Schema method literal must be a string")}function s8(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Ic={completion:{values:[],hasMore:!1}};function OH(e,t,r,i,n){let o={};if(n?.searchHint)o["anthropic/searchHint"]=n.searchHint;if(n?.alwaysLoad)o["anthropic/alwaysLoad"]=!0;return{name:e,description:t,inputSchema:r,handler:i,annotations:n?.annotations,_meta:Object.keys(o).length>0?o:void 0}}function DH(e){let t=new O_({name:e.name,version:e.version??"1.0.0"},{capabilities:{tools:e.tools?{}:void 0},instructions:e.instructions});if(e.tools)e.tools.forEach((r)=>{for(let i of Object.values(r.inputSchema)){if(!NH(i))continue;let n=i.description;if(n&&!tn.has(i))tn.add(i,{description:n})}t.registerTool(r.name,{description:r.description,inputSchema:r.inputSchema,annotations:r.annotations,_meta:e.alwaysLoad?{"anthropic/alwaysLoad":!0,...r._meta}:r._meta},r.handler)});return{type:"sdk",name:e.name,instance:t}}function NH(e){return typeof e==="object"&&e!==null&&"_zod"in e}function A1e(e){let t=e.abortController||c6(),r=new Map;if(e.mcpServers)for(let[o,s]of Object.entries(e.mcpServers))if(s.type==="sdk"&&s.instance)r.set(o,s.instance);else throw Error("Browser SDK only supports SDK MCP servers for now");let i;if(e.sse)i=new Bv({streamUrl:e.sse.streamUrl,sendUrl:e.sse.sendUrl,sessionId:e.sse.sessionId,headers:e.sse.headers,abortController:t});else i=new Hv({url:e.websocket.url,headers:e.websocket.headers,authMessage:e.websocket.authMessage,abortController:t});let n=new Oh(i,!1,e.canUseTool,e.hooks,t,r,e.jsonSchema,e.promptSuggestions!==void 0?{promptSuggestions:e.promptSuggestions}:void 0,e.onElicitation,void 0,void 0,e.onUserDialog);return n.streamInput(e.prompt).catch((o)=>t.abort(o)),n}export{Fe as z,OH as tool,A1e as query,DH as createSdkMcpServer};
109
+ ]`;continue}if(n+=i[v],i[v]==="\\")o=!0;else if(s&&i[v]==="]")s=!1;else if(!s&&i[v]==="[")s=!0}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return n}function vp(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===Le.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((i,n)=>({...i,[n]:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??Zt(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===Le.ZodString&&e.keyType._def.checks?.length){let{type:i,...n}=yp(e.keyType._def,t);return{...r,propertyNames:n}}else if(e.keyType?._def.typeName===Le.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===Le.ZodBranded&&e.keyType._def.type._def.typeName===Le.ZodString&&e.keyType._def.type._def.checks?.length){let{type:i,...n}=gp(e.keyType._def,t);return{...r,propertyNames:n}}return r}function X6(e,t){if(t.mapStrategy==="record")return vp(e,t);let r=st(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Zt(t),i=st(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Zt(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,i],minItems:2,maxItems:2}}}function Y6(e){let t=e.values,i=Object.keys(e.values).filter((o)=>typeof t[t[o]]!=="number").map((o)=>t[o]),n=Array.from(new Set(i.map((o)=>typeof o)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:i}}function Q6(e){return e.target==="openAi"?void 0:{not:Zt({...e,currentPath:[...e.currentPath,"not"]})}}function ek(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var nc={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function rk(e,t){if(t.target==="openApi3")return tk(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((i)=>(i._def.typeName in nc)&&(!i._def.checks||!i._def.checks.length))){let i=r.reduce((n,o)=>{let s=nc[o._def.typeName];return s&&!n.includes(s)?[...n,s]:n},[]);return{type:i.length>1?i:i[0]}}else if(r.every((i)=>i._def.typeName==="ZodLiteral"&&!i.description)){let i=r.reduce((n,o)=>{let s=typeof o._def.value;switch(s){case"string":case"number":case"boolean":return[...n,s];case"bigint":return[...n,"integer"];case"object":if(o._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(i.length===r.length){let n=i.filter((o,s,h)=>h.indexOf(o)===s);return{type:n.length>1?n:n[0],enum:r.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(r.every((i)=>i._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((i,n)=>[...i,...n._def.values.filter((o)=>!i.includes(o))],[])};return tk(e,t)}var tk=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((i,n)=>st(i._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter((i)=>!!i&&(!t.strictUnions||typeof i==="object"&&Object.keys(i).length>0));return r.length?{anyOf:r}:void 0};function nk(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:nc[e.innerType._def.typeName],nullable:!0};return{type:[nc[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let i=st(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(i&&"$ref"in i)return{allOf:[i],nullable:!0};return i&&{...i,nullable:!0}}let r=st(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function ik(e,t){let r={type:"number"};if(!e.checks)return r;for(let i of e.checks)switch(i.kind){case"int":r.type="integer",pb(r,"type",i.message,t);break;case"min":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"minimum",i.value,i.message,t);else St(r,"exclusiveMinimum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMinimum=!0;St(r,"minimum",i.value,i.message,t)}break;case"max":if(t.target==="jsonSchema7")if(i.inclusive)St(r,"maximum",i.value,i.message,t);else St(r,"exclusiveMaximum",i.value,i.message,t);else{if(!i.inclusive)r.exclusiveMaximum=!0;St(r,"maximum",i.value,i.message,t)}break;case"multipleOf":St(r,"multipleOf",i.value,i.message,t);break}return r}function ok(e,t){let r=t.target==="openAi",i={type:"object",properties:{}},n=[],o=e.shape();for(let h in o){let v=o[h];if(v===void 0||v._def===void 0)continue;let b=rN(v);if(b&&r){if(v._def.typeName==="ZodOptional")v=v._def.innerType;if(!v.isNullable())v=v.nullable();b=!1}let _=st(v._def,{...t,currentPath:[...t.currentPath,"properties",h],propertyPath:[...t.currentPath,"properties",h]});if(_===void 0)continue;if(i.properties[h]=_,!b)n.push(h)}if(n.length)i.required=n;let s=tN(e,t);if(s!==void 0)i.additionalProperties=s;return i}function tN(e,t){if(e.catchall._def.typeName!=="ZodNever")return st(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function rN(e){try{return e.isOptional()}catch{return!0}}var sk=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return st(e.innerType._def,t);let r=st(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Zt(t)},r]}:Zt(t)};var ak=(e,t)=>{if(t.pipeStrategy==="input")return st(e.in._def,t);else if(t.pipeStrategy==="output")return st(e.out._def,t);let r=st(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),i=st(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,i].filter((n)=>n!==void 0)}};function uk(e,t){return st(e.type._def,t)}function lk(e,t){let i={type:"array",uniqueItems:!0,items:st(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)St(i,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)St(i,"maxItems",e.maxSize.value,e.maxSize.message,t);return i}function ck(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,i)=>st(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[]),additionalItems:st(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,i)=>st(r._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[])}}function dk(e){return{not:Zt(e)}}function fk(e){return Zt(e)}var hk=(e,t)=>st(e.innerType._def,t);var pk=(e,t,r)=>{switch(t){case Le.ZodString:return yp(e,r);case Le.ZodNumber:return ik(e,r);case Le.ZodObject:return ok(e,r);case Le.ZodBigInt:return q6(e,r);case Le.ZodBoolean:return B6();case Le.ZodDate:return mb(e,r);case Le.ZodUndefined:return dk(r);case Le.ZodNull:return ek(r);case Le.ZodArray:return F6(e,r);case Le.ZodUnion:case Le.ZodDiscriminatedUnion:return rk(e,r);case Le.ZodIntersection:return W6(e,r);case Le.ZodTuple:return ck(e,r);case Le.ZodRecord:return vp(e,r);case Le.ZodLiteral:return G6(e,r);case Le.ZodEnum:return V6(e);case Le.ZodNativeEnum:return Y6(e);case Le.ZodNullable:return nk(e,r);case Le.ZodOptional:return sk(e,r);case Le.ZodMap:return X6(e,r);case Le.ZodSet:return lk(e,r);case Le.ZodLazy:return()=>e.getter()._def;case Le.ZodPromise:return uk(e,r);case Le.ZodNaN:case Le.ZodNever:return Q6(r);case Le.ZodEffects:return K6(e,r);case Le.ZodAny:return Zt(r);case Le.ZodUnknown:return fk(r);case Le.ZodDefault:return Z6(e,r);case Le.ZodBranded:return gp(e,r);case Le.ZodReadonly:return hk(e,r);case Le.ZodCatch:return H6(e,r);case Le.ZodPipeline:return ak(e,r);case Le.ZodFunction:case Le.ZodVoid:case Le.ZodSymbol:return;default:return((i)=>{return})(t)}};function st(e,t,r=!1){let i=t.seen.get(e);if(t.override){let h=t.override?.(e,t,i,r);if(h!==j6)return h}if(i&&!r){let h=nN(i,t);if(h!==void 0)return h}let n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);let o=pk(e,e.typeName,t),s=typeof o==="function"?st(o(),t):o;if(s)iN(e,t,s);if(t.postProcess){let h=t.postProcess(s,e,t);return n.jsonSchema=s,h}return n.jsonSchema=s,s}var nN=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:mp(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,i)=>t.currentPath[i]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Zt(t);return t.$refStrategy==="seen"?Zt(t):void 0}}},iN=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var vb=(e,t)=>{let r=L6(t),i=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((v,[b,_])=>({...v,[b]:st(_._def,{...r,currentPath:[...r.basePath,r.definitionPath,b]},!0)??Zt(r)}),{}):void 0,n=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=st(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??Zt(r),s=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(s!==void 0)o.title=s;if(r.flags.hasReferencedOpenAiAnyType){if(!i)i={};if(!i[r.openAiAnyTypeName])i[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let h=n===void 0?i?{...o,[r.definitionPath]:i}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...i,[n]:o}};if(r.target==="jsonSchema7")h.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")h.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in h)||("oneOf"in h)||("allOf"in h)||("type"in h)&&Array.isArray(h.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return h};function oN(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function bb(e,t){if(Pn(e))return xs(e,{target:oN(t?.target),io:t?.pipeStrategy??"input"});return vb(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function _b(e){let r=Qi(e)?.method;if(!r)throw Error("Schema is missing a method literal");let i=Vh(r);if(typeof i!=="string")throw Error("Schema method literal must be a string");return i}function wb(e,t){let r=Yi(e,t);if(!r.success)throw r.error;return r.data}var sN=60000;class Sb{constructor(e){if(this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Yh,(t)=>{this._oncancel(t)}),this.setNotificationHandler(ep,(t)=>{this._onprogress(t)}),this.setRequestHandler(Qh,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(tp,async(t,r)=>{let i=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!i)throw new rt(it.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(np,async(t,r)=>{let i=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let s;while(s=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(s.type==="response"||s.type==="error"){let h=s.message,v=h.id,b=this._requestResolvers.get(v);if(b)if(this._requestResolvers.delete(v),s.type==="response")b(h);else{let _=h,g=new rt(_.error.code,_.error.message,_.error.data);b(g)}else{let _=s.type==="response"?"Response":"Error";this._onerror(Error(`${_} handler missing for request ${v}`))}continue}await this._transport?.send(s.message,{relatedRequestId:r.requestId})}}let o=await this._taskStore.getTask(n,r.sessionId);if(!o)throw new rt(it.InvalidParams,`Task not found: ${n}`);if(!to(o.status))return await this._waitForTaskUpdate(n,r.signal),await i();if(to(o.status)){let s=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...s,_meta:{...s._meta,[eo]:{taskId:n}}}}return await i()};return await i()}),this.setRequestHandler(ip,async(t,r)=>{try{let{tasks:i,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:i,nextCursor:n,_meta:{}}}catch(i){throw new rt(it.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(sp,async(t,r)=>{try{let i=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!i)throw new rt(it.InvalidParams,`Task not found: ${t.params.taskId}`);if(to(i.status))throw new rt(it.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new rt(it.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(i){if(i instanceof rt)throw i;throw new rt(it.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,i,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:i})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),rt.fromError(it.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let i=this._transport?.onmessage;this._transport.onmessage=(n,o)=>{if(i?.(n,o),Wl(n)||E6(n))this._onresponse(n);else if(eb(n))this._onrequest(n,o);else if(M6(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=rt.fromError(it.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,n=e.params?._meta?.[eo]?.taskId;if(r===void 0){let b={jsonrpc:"2.0",id:e.id,error:{code:it.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:b,timestamp:Date.now()},i?.sessionId).catch((_)=>this._onerror(Error(`Failed to enqueue error response: ${_}`)));else i?.send(b).catch((_)=>this._onerror(Error(`Failed to send an error response: ${_}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let s=S6(e.params)?e.params.task:void 0,h=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,v={signal:o.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async(b)=>{if(o.signal.aborted)return;let _={relatedRequestId:e.id};if(n)_.relatedTask={taskId:n};await this.notification(b,_)},sendRequest:async(b,_,g)=>{if(o.signal.aborted)throw new rt(it.ConnectionClosed,"Request was cancelled");let S={...g,relatedRequestId:e.id};if(n&&!S.relatedTask)S.relatedTask={taskId:n};let x=S.relatedTask?.taskId??n;if(x&&h)await h.updateTaskStatus(x,"input_required");return await this.request(b,_,S)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:h,taskRequestedTtl:s?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(s)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,v)).then(async(b)=>{if(o.signal.aborted)return;let _={result:b,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:_,timestamp:Date.now()},i?.sessionId);else await i?.send(_)},async(b)=>{if(o.signal.aborted)return;let _={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(b.code)?b.code:it.InternalError,message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:_,timestamp:Date.now()},i?.sessionId);else await i?.send(_)}).catch((b)=>this._onerror(Error(`Failed to send response: ${b}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===o)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,i=Number(t),n=this._progressHandlers.get(i);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(h){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(h);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),Wl(e))r(e);else{let o=new rt(e.error.code,e.error.message,e.error.data);r(o)}return}let i=this._responseHandlers.get(t);if(i===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let n=!1;if(Wl(e)&&e.result&&typeof e.result==="object"){let o=e.result;if(o.task&&typeof o.task==="object"){let s=o.task;if(typeof s.taskId==="string")n=!0,this._taskProgressTokens.set(s.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(Wl(e))i(e);else{let o=rt.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:i}=r??{};if(!i){try{yield{type:"result",result:await this.request(e,t,r)}}catch(o){yield{type:"error",error:o instanceof rt?o:new rt(it.InternalError,String(o))}}return}let n;try{let o=await this.request(e,Ys,r);if(o.task)n=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new rt(it.InternalError,"Task creation did not return a task");while(!0){let s=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:s},to(s.status)){if(s.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(s.status==="failed")yield{type:"error",error:new rt(it.InternalError,`Task ${n} failed`)};else if(s.status==="cancelled")yield{type:"error",error:new rt(it.InternalError,`Task ${n} was cancelled`)};return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let h=s.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((v)=>setTimeout(v,h)),r?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof rt?o:new rt(it.InternalError,String(o))}}}request(e,t,r){let{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o,task:s,relatedTask:h}=r??{};return new Promise((v,b)=>{let _=(P)=>{b(P)};if(!this._transport){_(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),s)this.assertTaskCapability(e.method)}catch(P){_(P);return}r?.signal?.throwIfAborted();let g=this._requestMessageId++,S={...e,jsonrpc:"2.0",id:g};if(r?.onprogress)this._progressHandlers.set(g,r.onprogress),S.params={...e.params,_meta:{...e.params?._meta||{},progressToken:g}};if(s)S.params={...S.params,task:s};if(h)S.params={...S.params,_meta:{...S.params?._meta||{},[eo]:h}};let x=(P)=>{this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(P)}},{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((R)=>this._onerror(Error(`Failed to send cancellation: ${R}`)));let $=P instanceof rt?P:new rt(it.RequestTimeout,String(P));b($)};this._responseHandlers.set(g,(P)=>{if(r?.signal?.aborted)return;if(P instanceof Error)return b(P);try{let $=Yi(t,P.result);if(!$.success)b($.error);else v($.data)}catch($){b($)}}),r?.signal?.addEventListener("abort",()=>{x(r?.signal?.reason)});let M=r?.timeout??sN,I=()=>x(rt.fromError(it.RequestTimeout,"Request timed out",{timeout:M}));this._setupTimeout(g,M,r?.maxTotalTimeout,I,r?.resetTimeoutOnProgress??!1);let T=h?.taskId;if(T){let P=($)=>{let R=this._responseHandlers.get(g);if(R)R($);else this._onerror(Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,P),this._enqueueTaskMessage(T,{type:"request",message:S,timestamp:Date.now()}).catch(($)=>{this._cleanupTimeout(g),b($)})}else this._transport.send(S,{relatedRequestId:i,resumptionToken:n,onresumptiontoken:o}).catch((P)=>{this._cleanupTimeout(g),b(P)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},rp,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},op,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},T6,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[eo]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[eo]:t.relatedTask}}};this._transport?.send(s,t).catch((h)=>this._onerror(h))});return}let o={...e,jsonrpc:"2.0"};if(t?.relatedTask)o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[eo]:t.relatedTask}}};await this._transport.send(o,t)}setRequestHandler(e,t){let r=_b(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(i,n)=>{let o=wb(e,i);return Promise.resolve(t(o,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=_b(e);this._notificationHandlers.set(r,(i)=>{let n=wb(e,i);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,i)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let i of r)if(i.type==="request"&&eb(i.message)){let n=i.message.id,o=this._requestResolvers.get(n);if(o)o(new rt(it.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let i=await this._taskStore?.getTask(e);if(i?.pollInterval)r=i.pollInterval}catch{}return new Promise((i,n)=>{if(t.aborted){n(new rt(it.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,r);t.addEventListener("abort",()=>{clearTimeout(o),n(new rt(it.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(i)=>{if(!e)throw Error("No request provided");return await r.createTask(i,e.id,{method:e.method,params:e.params},t)},getTask:async(i)=>{let n=await r.getTask(i,t);if(!n)throw new rt(it.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(i,n,o)=>{await r.storeTaskResult(i,n,o,t);let s=await r.getTask(i,t);if(s){let h=Ql.parse({method:"notifications/tasks/status",params:s});if(await this.notification(h),to(s.status))this._cleanupTaskProgressHandler(i)}},getTaskResult:(i)=>r.getTaskResult(i,t),updateTaskStatus:async(i,n,o)=>{let s=await r.getTask(i,t);if(!s)throw new rt(it.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(to(s.status))throw new rt(it.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(i,n,o,t);let h=await r.getTask(i,t);if(h){let v=Ql.parse({method:"notifications/tasks/status",params:h});if(await this.notification(v),to(h.status))this._cleanupTaskProgressHandler(i)}},listTasks:(i)=>r.listTasks(i,t)}}}function mk(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function gk(e,t){let r={...e};for(let i in t){let n=i,o=t[n];if(o===void 0)continue;let s=r[n];if(mk(s)&&mk(o))r[n]={...s,...o};else r[n]=o}return r}var YE=U_(y_(),1),QE=U_(XE(),1);function TH(){let e=new YE.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return QE.default(e),e}class I_{constructor(e){this._ajv=e??TH()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class T_{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages[e.messages.length-1],n=Array.isArray(i.content)?i.content:[i.content],o=n.some((b)=>b.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,h=s?Array.isArray(s.content)?s.content:[s.content]:[],v=h.some((b)=>b.type==="tool_use");if(o){if(n.some((b)=>b.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!v)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(v){let b=new Set(h.filter((g)=>g.type==="tool_use").map((g)=>g.id)),_=new Set(n.filter((g)=>g.type==="tool_result").map((g)=>g.toolUseId));if(b.size!==_.size||![...b].every((g)=>_.has(g)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},rc,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),i=e.mode??"form";switch(i){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=i==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},ta,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function e8(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function t8(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class P_ extends Sb{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(tc.options.map((r,i)=>[r,i])),this.isMessageIgnored=(r,i)=>{let n=this._loggingLevels.get(i);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new I_,this.setRequestHandler(nb,(r)=>this._oninitialize(r)),this.setNotificationHandler(ib,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(db,async(r,i)=>{let n=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=r.params,s=tc.safeParse(o);if(s.success)this._loggingLevels.set(n,s.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new T_(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=gk(this._capabilities,e)}setRequestHandler(e,t){let i=Qi(e)?.method;if(!i)throw Error("Schema is missing a method literal");let n;if(Pn(i)){let s=i;n=s._zod?.def?.value??s.value}else{let s=i;n=s._def?.value??s.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let s=async(h,v)=>{let b=Yi(ea,h);if(!b.success){let x=b.error instanceof Error?b.error.message:String(b.error);throw new rt(it.InvalidParams,`Invalid tools/call request: ${x}`)}let{params:_}=b.data,g=await Promise.resolve(t(h,v));if(_.task){let x=Yi(Ys,g);if(!x.success){let M=x.error instanceof Error?x.error.message:String(x.error);throw new rt(it.InvalidParams,`Invalid task creation result: ${M}`)}return x.data}let S=Yi(hp,g);if(!S.success){let x=S.error instanceof Error?S.error.message:String(S.error);throw new rt(it.InvalidParams,`Invalid tools/call result: ${x}`)}return S.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){t8(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;e8(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:b6.includes(t)?t:Yv,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Xh)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],i=Array.isArray(r.content)?r.content:[r.content],n=i.some((v)=>v.type==="tool_result"),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],h=s.some((v)=>v.type==="tool_use");if(n){if(i.some((v)=>v.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!h)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(h){let v=new Set(s.filter((_)=>_.type==="tool_use").map((_)=>_.id)),b=new Set(i.filter((_)=>_.type==="tool_result").map((_)=>_.toolUseId));if(v.size!==b.size||![...v].every((_)=>b.has(_)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},fb,t);return this.request({method:"sampling/createMessage",params:e},rc,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},ta,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:i},ta,t);if(n.action==="accept"&&n.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(n.content);if(!s.valid)throw new rt(it.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(o){if(o instanceof rt)throw o;throw new rt(it.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return n}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},hb,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var n8=Symbol.for("mcp.completable");function $_(e){return!!e&&typeof e==="object"&&n8 in e}function i8(e){return e[n8]?.complete}var r8;(function(e){e.Completable="McpCompletable"})(r8||(r8={}));var PH=/^[A-Za-z0-9._-]{1,128}$/;function $H(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!PH.test(e)){let r=e.split("").filter((i)=>!/[A-Za-z0-9._-]/.test(i)).filter((i,n,o)=>o.indexOf(i)===n);return t.push(`Tool name contains invalid characters: ${r.map((i)=>`"${i}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function AH(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function A_(e){let t=$H(e);return AH(e,t.warnings),t.isValid}class R_{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let i={taskSupport:"required",...t.execution};if(i.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,i,t._meta,r)}}class O_{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new P_(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new R_(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(fp)),this.server.assertCanSetRequestHandler(lo(ea)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(fp,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let i=Js(t.inputSchema);return i?bb(i,{strictUnions:!0,pipeStrategy:"input"}):RH})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let i=Js(t.outputSchema);if(i)r.outputSchema=bb(i,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(ea,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new rt(it.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Tool ${e.params.name} disabled`);let i=!!e.params.task,n=r.execution?.taskSupport,o="createTask"in r.handler;if((n==="required"||n==="optional")&&!o)throw new rt(it.InternalError,`Tool ${e.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!i)throw new rt(it.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!i&&o)return await this.handleAutomaticTaskPolling(r,e,t);let s=await this.validateToolInput(r,e.params.arguments,e.params.name),h=await this.executeToolHandler(r,s,t);if(i)return h;return await this.validateToolOutput(r,h,e.params.name),h}catch(r){if(r instanceof rt){if(r.code===it.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let n=Js(e.inputSchema)??e.inputSchema,o=await Zh(n,t);if(!o.success){let s="error"in o?o.error:"Unknown error",h=Kh(s);throw new rt(it.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${h}`)}return o.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new rt(it.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let i=Js(e.outputSchema),n=await Zh(i,t.structuredContent);if(!n.success){let o="error"in n?n.error:"Unknown error",s=Kh(o);throw new rt(it.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${s}`)}}async executeToolHandler(e,t,r){let i=e.handler;if("createTask"in i){if(!r.taskStore)throw Error("No task store provided.");let o={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(i.createTask(t,o));else return await Promise.resolve(i.createTask(o))}if(e.inputSchema)return await Promise.resolve(i(t,r));else return await Promise.resolve(i(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(e,t.params.arguments,t.params.name),n=e.handler,o={...r,taskStore:r.taskStore},s=i?await Promise.resolve(n.createTask(i,o)):await Promise.resolve(n.createTask(o)),h=s.task.taskId,v=s.task,b=v.pollInterval??5000;while(v.status!=="completed"&&v.status!=="failed"&&v.status!=="cancelled"){await new Promise((g)=>setTimeout(g,b));let _=await r.taskStore.getTask(h);if(!_)throw new rt(it.InternalError,`Task ${h} not found during polling`);v=_}return await r.taskStore.getTaskResult(h)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(lo(pp)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(pp,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return O6(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return D6(e),this.handleResourceCompletion(e,e.params.ref);default:throw new rt(it.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new rt(it.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Ic;let n=Qi(r.argsSchema)?.[e.params.argument.name];if(!$_(n))return Ic;let o=i8(n);if(!o)return Ic;let s=await o(e.params.argument.value,e.params.context);return s8(s)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((o)=>o.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return Ic;throw new rt(it.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let i=r.resourceTemplate.completeCallback(e.params.argument.name);if(!i)return Ic;let n=await i(e.params.argument.value,e.params.context);return s8(n)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(ap)),this.server.assertCanSetRequestHandler(lo(up)),this.server.assertCanSetRequestHandler(lo(lp)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(ap,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,o])=>o.enabled).map(([n,o])=>({uri:n,name:o.name,...o.metadata})),i=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let o=await n.resourceTemplate.listCallback(t);for(let s of o.resources)i.push({...n.metadata,...s})}return{resources:[...r,...i]}}),this.server.setRequestHandler(up,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(lp,async(e,t)=>{let r=new URL(e.params.uri),i=this._registeredResources[r.toString()];if(i){if(!i.enabled)throw new rt(it.InvalidParams,`Resource ${r} disabled`);return i.readCallback(r,t)}for(let n of Object.values(this._registeredResourceTemplates)){let o=n.resourceTemplate.uriTemplate.match(r.toString());if(o)return n.readCallback(r,o,t)}throw new rt(it.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(lo(cp)),this.server.assertCanSetRequestHandler(lo(dp)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(cp,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?CH(t.argsSchema):void 0}))})),this.server.setRequestHandler(dp,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new rt(it.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new rt(it.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let i=Js(r.argsSchema),n=await Zh(i,e.params.arguments);if(!n.success){let h="error"in n?n.error:"Unknown error",v=Kh(h);throw new rt(it.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${v}`)}let o=n.data,s=r.callback;return await Promise.resolve(s(o,t))}else{let i=r.callback;return await Promise.resolve(i(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let i;if(typeof r[0]==="object")i=r.shift();let n=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,void 0,t,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,void 0,t,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}registerResource(e,t,r,i){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,r.title,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,r.title,t,r,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,t,r,i,n){let o={name:e,title:t,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({uri:null}),update:(s)=>{if(typeof s.uri<"u"&&s.uri!==r){if(delete this._registeredResources[r],s.uri)this._registeredResources[s.uri]=o}if(typeof s.name<"u")o.name=s.name;if(typeof s.title<"u")o.title=s.title;if(typeof s.metadata<"u")o.metadata=s.metadata;if(typeof s.callback<"u")o.readCallback=s.callback;if(typeof s.enabled<"u")o.enabled=s.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=o,o}_createRegisteredResourceTemplate(e,t,r,i,n){let o={resourceTemplate:r,title:t,metadata:i,readCallback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:(v)=>{if(typeof v.name<"u"&&v.name!==e){if(delete this._registeredResourceTemplates[e],v.name)this._registeredResourceTemplates[v.name]=o}if(typeof v.title<"u")o.title=v.title;if(typeof v.template<"u")o.resourceTemplate=v.template;if(typeof v.metadata<"u")o.metadata=v.metadata;if(typeof v.callback<"u")o.readCallback=v.callback;if(typeof v.enabled<"u")o.enabled=v.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=o;let s=r.uriTemplate.variableNames;if(Array.isArray(s)&&s.some((v)=>!!r.completeCallback(v)))this.setCompletionRequestHandler();return o}_createRegisteredPrompt(e,t,r,i,n){let o={title:t,description:r,argsSchema:i===void 0?void 0:Ho(i),callback:n,enabled:!0,disable:()=>o.update({enabled:!1}),enable:()=>o.update({enabled:!0}),remove:()=>o.update({name:null}),update:(s)=>{if(typeof s.name<"u"&&s.name!==e){if(delete this._registeredPrompts[e],s.name)this._registeredPrompts[s.name]=o}if(typeof s.title<"u")o.title=s.title;if(typeof s.description<"u")o.description=s.description;if(typeof s.argsSchema<"u")o.argsSchema=Ho(s.argsSchema);if(typeof s.callback<"u")o.callback=s.callback;if(typeof s.enabled<"u")o.enabled=s.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=o,i){if(Object.values(i).some((h)=>{let v=h instanceof Tn?h._def?.innerType:h;return $_(v)}))this.setCompletionRequestHandler()}return o}_createRegisteredTool(e,t,r,i,n,o,s,h,v){A_(e);let b={title:t,description:r,inputSchema:o8(i),outputSchema:o8(n),annotations:o,execution:s,_meta:h,handler:v,enabled:!0,disable:()=>b.update({enabled:!1}),enable:()=>b.update({enabled:!0}),remove:()=>b.update({name:null}),update:(_)=>{if(typeof _.name<"u"&&_.name!==e){if(typeof _.name==="string")A_(_.name);if(delete this._registeredTools[e],_.name)this._registeredTools[_.name]=b}if(typeof _.title<"u")b.title=_.title;if(typeof _.description<"u")b.description=_.description;if(typeof _.paramsSchema<"u")b.inputSchema=Ho(_.paramsSchema);if(typeof _.outputSchema<"u")b.outputSchema=Ho(_.outputSchema);if(typeof _.callback<"u")b.handler=_.callback;if(typeof _.annotations<"u")b.annotations=_.annotations;if(typeof _._meta<"u")b._meta=_._meta;if(typeof _.enabled<"u")b.enabled=_.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=b,this.setToolRequestHandlers(),this.sendToolListChanged(),b}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,i,n,o;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let h=t[0];if(C_(h)){if(i=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!C_(t[0]))o=t.shift()}else if(typeof h==="object"&&h!==null){if(Object.values(h).some((v)=>typeof v==="object"&&v!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);o=t.shift()}}let s=t[0];return this._createRegisteredTool(e,void 0,r,i,n,o,{taskSupport:"forbidden"},void 0,s)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:i,description:n,inputSchema:o,outputSchema:s,annotations:h,_meta:v}=t;return this._createRegisteredTool(e,i,n,o,s,h,{taskSupport:"forbidden"},v,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let i;if(t.length>1)i=t.shift();let n=t[0],o=this._createRegisteredPrompt(e,void 0,r,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),o}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:i,description:n,argsSchema:o}=t,s=this._createRegisteredPrompt(e,i,n,o,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var RH={type:"object",properties:{}};function a8(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function u8(e){return"_def"in e||"_zod"in e||a8(e)}function C_(e){if(typeof e!=="object"||e===null)return!1;if(u8(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(a8)}function o8(e){if(!e)return;if(C_(e))return Ho(e);if(!u8(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function CH(e){let t=Qi(e);if(!t)return[];return Object.entries(t).map(([r,i])=>{let n=y6(i),o=v6(i);return{name:r,description:n,required:!o}})}function lo(e){let r=Qi(e)?.method;if(!r)throw Error("Schema is missing a method literal");let i=Vh(r);if(typeof i==="string")return i;throw Error("Schema method literal must be a string")}function s8(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Ic={completion:{values:[],hasMore:!1}};function OH(e,t,r,i,n){let o={};if(n?.searchHint)o["anthropic/searchHint"]=n.searchHint;if(n?.alwaysLoad)o["anthropic/alwaysLoad"]=!0;return{name:e,description:t,inputSchema:r,handler:i,annotations:n?.annotations,_meta:Object.keys(o).length>0?o:void 0}}function DH(e){let t=new O_({name:e.name,version:e.version??"1.0.0"},{capabilities:{tools:e.tools?{}:void 0},instructions:e.instructions});if(e.tools)e.tools.forEach((r)=>{for(let i of Object.values(r.inputSchema)){if(!NH(i))continue;let n=i.description;if(n&&!tn.has(i))tn.add(i,{description:n})}t.registerTool(r.name,{description:r.description,inputSchema:r.inputSchema,annotations:r.annotations,_meta:e.alwaysLoad?{"anthropic/alwaysLoad":!0,...r._meta}:r._meta},r.handler)});return{type:"sdk",name:e.name,instance:t}}function NH(e){return typeof e==="object"&&e!==null&&"_zod"in e}function O1e(e){let t=e.abortController||c6(),r=new Map;if(e.mcpServers)for(let[o,s]of Object.entries(e.mcpServers))if(s.type==="sdk"&&s.instance)r.set(o,s.instance);else throw Error("Browser SDK only supports SDK MCP servers for now");let i;if(e.sse)i=new Bv({streamUrl:e.sse.streamUrl,sendUrl:e.sse.sendUrl,sessionId:e.sse.sessionId,headers:e.sse.headers,abortController:t});else i=new Hv({url:e.websocket.url,headers:e.websocket.headers,authMessage:e.websocket.authMessage,abortController:t});let n=new Oh(i,!1,e.canUseTool,e.hooks,t,r,e.jsonSchema,e.promptSuggestions!==void 0?{promptSuggestions:e.promptSuggestions}:void 0,e.onElicitation,void 0,void 0,e.onUserDialog);return n.streamInput(e.prompt).catch((o)=>t.abort(o)),n}export{Fe as z,OH as tool,O1e as query,DH as createSdkMcpServer};