@anyproto/anytype-mcp 1.2.2 → 1.2.3

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/bin/cli.mjs CHANGED
@@ -72,7 +72,7 @@ Add this to your MCP settings file as:`),console.log(`
72
72
  }
73
73
  }
74
74
  }
75
- `)}async startAuthentication(){try{let t=await Ji.post(`${this.basePath}/v1/auth/display_code`,null,{params:{app_name:this.appName}});if(!t.data?.challenge_id)throw new Error("Failed to get challenge ID");return t.data.challenge_id}catch(t){throw console.error("Authentication error:",t instanceof Error?t.message:t),new Error("Failed to start authentication")}}async completeAuthentication(t,r){try{let n=await Ji.post(`${this.basePath}/v1/auth/token`,null,{params:{challenge_id:t,code:r}});if(!n.data?.app_key)throw new Error("Authentication failed: No app key received");return{appKey:n.data.app_key,anytypeVersion:n.headers["anytype-version"]}}catch(n){throw console.error("Authentication error:",n instanceof Error?n.message:n),new Error("Failed to complete authentication")}}async generateAppKey(){try{console.log("Starting authentication to get app key...");let t=await this.startAuthentication();console.log("Please check Anytype Desktop for the 4-digit code");let r=await this.prompt("Enter the 4-digit code shown in Anytype Desktop: "),{appKey:n,anytypeVersion:i}=await this.completeAuthentication(t,r);console.log("Authenticated successfully!"),this.displaySuccessMessage(n,i)}catch(t){console.error("Error:",t instanceof Error?t.message:t),process.exit(1)}finally{this.rl.close()}}};import dR from"node:process";var rT=Object.freeze({status:"aborted"});function k(e,t,r){function n(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let l=a.prototype,p=Object.keys(l);for(let f=0;f<p.length;f++){let m=p[f];m in s||(s[m]=l[m].bind(s))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function a(s){var u;let l=r?.Parent?new o:this;n(l,s),(u=l._zod).deferred??(u.deferred=[]);for(let p of l._zod.deferred)p();return l}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var rn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ki=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},ql={};function xt(e){return e&&Object.assign(ql,e),ql}var D={};qo(D,{BIGINT_FORMAT_RANGES:()=>Dh,Class:()=>Rh,NUMBER_FORMAT_RANGES:()=>Nh,aborted:()=>ci,allowsEval:()=>Ih,assert:()=>pq,assertEqual:()=>sq,assertIs:()=>uq,assertNever:()=>lq,assertNotEqual:()=>cq,assignProp:()=>ai,base64ToUint8Array:()=>lT,base64urlToUint8Array:()=>wq,cached:()=>ra,captureStackTrace:()=>Fl,cleanEnum:()=>_q,cleanRegex:()=>Cs,clone:()=>Zt,cloneDef:()=>fq,createTransparentProxy:()=>bq,defineLazy:()=>ge,esc:()=>Ll,escapeRegex:()=>Er,extend:()=>aT,finalizeIssue:()=>ir,floatSafeRemainder:()=>zh,getElementAtPath:()=>mq,getEnumValues:()=>js,getLengthableOrigin:()=>Us,getParsedType:()=>yq,getSizableOrigin:()=>Ds,hexToUint8Array:()=>$q,isObject:()=>Gi,isPlainObject:()=>si,issue:()=>na,joinValues:()=>ne,jsonStringifyReplacer:()=>ta,merge:()=>xq,mergeDefs:()=>Sn,normalizeParams:()=>L,nullish:()=>oi,numKeys:()=>vq,objectClone:()=>dq,omit:()=>oT,optionalKeys:()=>Ch,parsedType:()=>oe,partial:()=>cT,pick:()=>iT,prefixIssues:()=>gr,primitiveTypes:()=>jh,promiseAllObject:()=>hq,propertyKeyTypes:()=>Ns,randomString:()=>gq,required:()=>uT,safeExtend:()=>sT,shallowClone:()=>Ah,slugify:()=>Oh,stringifyPrimitive:()=>ie,uint8ArrayToBase64:()=>pT,uint8ArrayToBase64url:()=>Sq,uint8ArrayToHex:()=>kq,unwrapMessage:()=>As});function sq(e){return e}function cq(e){return e}function uq(e){}function lq(e){throw new Error("Unexpected value in exhaustive check")}function pq(e){}function js(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function ne(e,t="|"){return e.map(r=>ie(r)).join(t)}function ta(e,t){return typeof t=="bigint"?t.toString():t}function ra(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function oi(e){return e==null}function Cs(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function zh(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let u=n.match(/\d?e-(\d?)/);u?.[1]&&(i=Number.parseInt(u[1]))}let o=r>i?r:i,a=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return a%s/10**o}var nT=Symbol("evaluating");function ge(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==nT)return n===void 0&&(n=nT,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function dq(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ai(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Sn(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function fq(e){return Sn(e._zod.def)}function mq(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function hq(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=n[o];return i})}function gq(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Ll(e){return JSON.stringify(e)}function Oh(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Fl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Gi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ih=ra(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function si(e){if(Gi(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Gi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ah(e){return si(e)?{...e}:Array.isArray(e)?[...e]:e}function vq(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var yq=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":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Ns=new Set(["string","number","symbol"]),jh=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Er(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zt(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function L(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 new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function bq(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,o){return t??(t=e()),Reflect.set(t,n,i,o)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function ie(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ch(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Nh={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Dh={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function iT(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Sn(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return ai(this,"shape",a),a},checks:[]});return Zt(e,o)}function oT(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Sn(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return ai(this,"shape",a),a},checks:[]});return Zt(e,o)}function aT(e,t){if(!si(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=Sn(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return ai(this,"shape",o),o}});return Zt(e,i)}function sT(e,t){if(!si(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Sn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ai(this,"shape",n),n}});return Zt(e,r)}function xq(e,t){let r=Sn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ai(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Zt(e,r)}function cT(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Sn(t._zod.def,{get shape(){let s=t._zod.def.shape,u={...s};if(r)for(let l in r){if(!(l in s))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(u[l]=e?new e({type:"optional",innerType:s[l]}):s[l])}else for(let l in s)u[l]=e?new e({type:"optional",innerType:s[l]}):s[l];return ai(this,"shape",u),u},checks:[]});return Zt(t,a)}function uT(e,t,r){let n=Sn(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(o[a]=new e({type:"nonoptional",innerType:i[a]}))}else for(let a in i)o[a]=new e({type:"nonoptional",innerType:i[a]});return ai(this,"shape",o),o}});return Zt(t,n)}function ci(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function gr(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function As(e){return typeof e=="string"?e:e?.message}function ir(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=As(e.inst?._zod.def?.error?.(e))??As(t?.error?.(e))??As(r.customError?.(e))??As(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Ds(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Us(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function oe(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function na(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function _q(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function lT(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function pT(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function wq(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return lT(t+r)}function Sq(e){return pT(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function $q(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function kq(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Rh=class{constructor(...t){}};var dT=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ta,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ml=k("$ZodError",dT),qs=k("$ZodError",dT,{Parent:Error});function Zl(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function Bl(e,t=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let a=r,s=0;for(;s<o.path.length;){let u=o.path[s];s===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(o))):a[u]=a[u]||{_errors:[]},a=a[u],s++}}};return n(e),r}var Ls=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new rn;if(a.issues.length){let s=new(i?.Err??e)(a.issues.map(u=>ir(u,o,xt())));throw Fl(s,i?.callee),s}return a.value},Fs=Ls(qs),Ms=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(i?.Err??e)(a.issues.map(u=>ir(u,o,xt())));throw Fl(s,i?.callee),s}return a.value},Zs=Ms(qs),Bs=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new rn;return o.issues.length?{success:!1,error:new(e??Ml)(o.issues.map(a=>ir(a,i,xt())))}:{success:!0,data:o.value}},ia=Bs(qs),Vs=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>ir(a,i,xt())))}:{success:!0,data:o.value}},Ws=Vs(qs),fT=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ls(e)(t,r,i)};var mT=e=>(t,r,n)=>Ls(e)(t,r,n);var hT=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ms(e)(t,r,i)};var gT=e=>async(t,r,n)=>Ms(e)(t,r,n);var vT=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Bs(e)(t,r,i)};var yT=e=>(t,r,n)=>Bs(e)(t,r,n);var bT=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Vs(e)(t,r,i)};var xT=e=>async(t,r,n)=>Vs(e)(t,r,n);var Pr={};qo(Pr,{base64:()=>Qh,base64url:()=>Vl,bigint:()=>og,boolean:()=>sg,browserEmail:()=>jq,cidrv4:()=>Yh,cidrv6:()=>Xh,cuid:()=>Uh,cuid2:()=>qh,date:()=>tg,datetime:()=>ng,domain:()=>Dq,duration:()=>Bh,e164:()=>eg,email:()=>Wh,emoji:()=>Hh,extendedDuration:()=>Eq,guid:()=>Vh,hex:()=>Uq,hostname:()=>Nq,html5Email:()=>Oq,idnEmail:()=>Aq,integer:()=>ag,ipv4:()=>Jh,ipv6:()=>Kh,ksuid:()=>Mh,lowercase:()=>lg,mac:()=>Gh,md5_base64:()=>Lq,md5_base64url:()=>Fq,md5_hex:()=>qq,nanoid:()=>Zh,null:()=>cg,number:()=>Wl,rfc5322Email:()=>Iq,sha1_base64:()=>Zq,sha1_base64url:()=>Bq,sha1_hex:()=>Mq,sha256_base64:()=>Wq,sha256_base64url:()=>Hq,sha256_hex:()=>Vq,sha384_base64:()=>Kq,sha384_base64url:()=>Gq,sha384_hex:()=>Jq,sha512_base64:()=>Xq,sha512_base64url:()=>Qq,sha512_hex:()=>Yq,string:()=>ig,time:()=>rg,ulid:()=>Lh,undefined:()=>ug,unicodeEmail:()=>_T,uppercase:()=>pg,uuid:()=>Yi,uuid4:()=>Pq,uuid6:()=>Rq,uuid7:()=>zq,xid:()=>Fh});var Uh=/^[cC][^\s-]{8,}$/,qh=/^[0-9a-z]+$/,Lh=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Fh=/^[0-9a-vA-V]{20}$/,Mh=/^[A-Za-z0-9]{27}$/,Zh=/^[a-zA-Z0-9_-]{21}$/,Bh=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Eq=/^[-+]?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)?)??$/,Vh=/^([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})$/,Yi=e=>e?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})$`):/^([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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Pq=Yi(4),Rq=Yi(6),zq=Yi(7),Wh=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Oq=/^[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])?)*$/,Iq=/^(([^<>()\[\]\\.,;:\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,}))$/,_T=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Aq=_T,jq=/^[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])?)*$/,Cq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Hh(){return new RegExp(Cq,"u")}var Jh=/^(?:(?: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])$/,Kh=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Gh=e=>{let t=Er(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Yh=/^((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])$/,Xh=/^(([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])$/,Qh=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vl=/^[A-Za-z0-9_-]*$/,Nq=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Dq=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,eg=/^\+[1-9]\d{6,14}$/,wT="(?:(?:\\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])))",tg=new RegExp(`^${wT}$`);function ST(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function rg(e){return new RegExp(`^${ST(e)}$`)}function ng(e){let t=ST({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${wT}T(?:${n})$`)}var ig=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},og=/^-?\d+n?$/,ag=/^-?\d+$/,Wl=/^-?\d+(?:\.\d+)?$/,sg=/^(?:true|false)$/i,cg=/^null$/i;var ug=/^undefined$/i;var lg=/^[^A-Z]*$/,pg=/^[^a-z]*$/,Uq=/^[0-9a-fA-F]*$/;function Hs(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Js(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var qq=/^[0-9a-fA-F]{32}$/,Lq=Hs(22,"=="),Fq=Js(22),Mq=/^[0-9a-fA-F]{40}$/,Zq=Hs(27,"="),Bq=Js(27),Vq=/^[0-9a-fA-F]{64}$/,Wq=Hs(43,"="),Hq=Js(43),Jq=/^[0-9a-fA-F]{96}$/,Kq=Hs(64,""),Gq=Js(64),Yq=/^[0-9a-fA-F]{128}$/,Xq=Hs(86,"=="),Qq=Js(86);var Ye=k("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),kT={number:"number",bigint:"bigint",object:"date"},dg=k("$ZodCheckLessThan",(e,t)=>{Ye.init(e,t);let r=kT[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fg=k("$ZodCheckGreaterThan",(e,t)=>{Ye.init(e,t);let r=kT[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),TT=k("$ZodCheckMultipleOf",(e,t)=>{Ye.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):zh(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ET=k("$ZodCheckNumberFormat",(e,t)=>{Ye.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Nh[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=i,s.maximum=o,r&&(s.pattern=ag)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),PT=k("$ZodCheckBigIntFormat",(e,t)=>{Ye.init(e,t);let[r,n]=Dh[t.format];e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,o.minimum=r,o.maximum=n}),e._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),RT=k("$ZodCheckMaxSize",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:Ds(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),zT=k("$ZodCheckMinSize",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:Ds(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),OT=k("$ZodCheckSizeEquals",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,o=i.size;if(o===t.size)return;let a=o>t.size;n.issues.push({origin:Ds(i),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),IT=k("$ZodCheckMaxLength",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let a=Us(i);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),AT=k("$ZodCheckMinLength",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let a=Us(i);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),jT=k("$ZodCheckLengthEquals",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,o=i.length;if(o===t.length)return;let a=Us(i),s=o>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ks=k("$ZodCheckStringFormat",(e,t)=>{var r,n;Ye.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;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=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),CT=k("$ZodCheckRegex",(e,t)=>{Ks.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),NT=k("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lg),Ks.init(e,t)}),DT=k("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=pg),Ks.init(e,t)}),UT=k("$ZodCheckIncludes",(e,t)=>{Ye.init(e,t);let r=Er(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),qT=k("$ZodCheckStartsWith",(e,t)=>{Ye.init(e,t);let r=new RegExp(`^${Er(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),LT=k("$ZodCheckEndsWith",(e,t)=>{Ye.init(e,t);let r=new RegExp(`.*${Er(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function $T(e,t,r){e.issues.length&&t.issues.push(...gr(r,e.issues))}var FT=k("$ZodCheckProperty",(e,t)=>{Ye.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>$T(i,r,t.property));$T(n,r,t.property)}}),MT=k("$ZodCheckMimeType",(e,t)=>{Ye.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),ZT=k("$ZodCheckOverwrite",(e,t)=>{Ye.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Hl=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
75
+ `)}async startAuthentication(){try{let t=await Ji.post(`${this.basePath}/v1/auth/challenges`,{app_name:this.appName});if(!t.data?.challenge_id)throw new Error("Failed to get challenge ID");return t.data.challenge_id}catch(t){throw console.error("Authentication error:",t instanceof Error?t.message:t),new Error("Failed to start authentication")}}async completeAuthentication(t,r){try{let n=await Ji.post(`${this.basePath}/v1/auth/api_keys`,{challenge_id:t,code:r});if(!n.data?.api_key)throw new Error("Authentication failed: No api key received");return{appKey:n.data.api_key,anytypeVersion:n.headers["anytype-version"]}}catch(n){throw console.error("Authentication error:",n instanceof Error?n.message:n),new Error("Failed to complete authentication")}}async generateAppKey(){try{console.log("Starting authentication to get app key...");let t=await this.startAuthentication();console.log("Please check Anytype Desktop for the 4-digit code");let r=await this.prompt("Enter the 4-digit code shown in Anytype Desktop: "),{appKey:n,anytypeVersion:i}=await this.completeAuthentication(t,r);console.log("Authenticated successfully!"),this.displaySuccessMessage(n,i)}catch(t){console.error("Error:",t instanceof Error?t.message:t),process.exit(1)}finally{this.rl.close()}}};import dR from"node:process";var rT=Object.freeze({status:"aborted"});function k(e,t,r){function n(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let l=a.prototype,p=Object.keys(l);for(let f=0;f<p.length;f++){let m=p[f];m in s||(s[m]=l[m].bind(s))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function a(s){var u;let l=r?.Parent?new o:this;n(l,s),(u=l._zod).deferred??(u.deferred=[]);for(let p of l._zod.deferred)p();return l}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var rn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ki=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},ql={};function xt(e){return e&&Object.assign(ql,e),ql}var D={};qo(D,{BIGINT_FORMAT_RANGES:()=>Dh,Class:()=>Rh,NUMBER_FORMAT_RANGES:()=>Nh,aborted:()=>ci,allowsEval:()=>Ih,assert:()=>pq,assertEqual:()=>sq,assertIs:()=>uq,assertNever:()=>lq,assertNotEqual:()=>cq,assignProp:()=>ai,base64ToUint8Array:()=>lT,base64urlToUint8Array:()=>wq,cached:()=>ra,captureStackTrace:()=>Fl,cleanEnum:()=>_q,cleanRegex:()=>Cs,clone:()=>Zt,cloneDef:()=>fq,createTransparentProxy:()=>bq,defineLazy:()=>ge,esc:()=>Ll,escapeRegex:()=>Er,extend:()=>aT,finalizeIssue:()=>ir,floatSafeRemainder:()=>zh,getElementAtPath:()=>mq,getEnumValues:()=>js,getLengthableOrigin:()=>Us,getParsedType:()=>yq,getSizableOrigin:()=>Ds,hexToUint8Array:()=>$q,isObject:()=>Gi,isPlainObject:()=>si,issue:()=>na,joinValues:()=>ne,jsonStringifyReplacer:()=>ta,merge:()=>xq,mergeDefs:()=>Sn,normalizeParams:()=>L,nullish:()=>oi,numKeys:()=>vq,objectClone:()=>dq,omit:()=>oT,optionalKeys:()=>Ch,parsedType:()=>oe,partial:()=>cT,pick:()=>iT,prefixIssues:()=>gr,primitiveTypes:()=>jh,promiseAllObject:()=>hq,propertyKeyTypes:()=>Ns,randomString:()=>gq,required:()=>uT,safeExtend:()=>sT,shallowClone:()=>Ah,slugify:()=>Oh,stringifyPrimitive:()=>ie,uint8ArrayToBase64:()=>pT,uint8ArrayToBase64url:()=>Sq,uint8ArrayToHex:()=>kq,unwrapMessage:()=>As});function sq(e){return e}function cq(e){return e}function uq(e){}function lq(e){throw new Error("Unexpected value in exhaustive check")}function pq(e){}function js(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function ne(e,t="|"){return e.map(r=>ie(r)).join(t)}function ta(e,t){return typeof t=="bigint"?t.toString():t}function ra(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function oi(e){return e==null}function Cs(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function zh(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let u=n.match(/\d?e-(\d?)/);u?.[1]&&(i=Number.parseInt(u[1]))}let o=r>i?r:i,a=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return a%s/10**o}var nT=Symbol("evaluating");function ge(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==nT)return n===void 0&&(n=nT,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function dq(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ai(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Sn(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function fq(e){return Sn(e._zod.def)}function mq(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function hq(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=n[o];return i})}function gq(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Ll(e){return JSON.stringify(e)}function Oh(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Fl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Gi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ih=ra(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function si(e){if(Gi(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Gi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ah(e){return si(e)?{...e}:Array.isArray(e)?[...e]:e}function vq(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var yq=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":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Ns=new Set(["string","number","symbol"]),jh=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Er(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Zt(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function L(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 new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function bq(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,o){return t??(t=e()),Reflect.set(t,n,i,o)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function ie(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ch(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Nh={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Dh={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function iT(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Sn(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return ai(this,"shape",a),a},checks:[]});return Zt(e,o)}function oT(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Sn(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return ai(this,"shape",a),a},checks:[]});return Zt(e,o)}function aT(e,t){if(!si(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=Sn(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return ai(this,"shape",o),o}});return Zt(e,i)}function sT(e,t){if(!si(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Sn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ai(this,"shape",n),n}});return Zt(e,r)}function xq(e,t){let r=Sn(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ai(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Zt(e,r)}function cT(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Sn(t._zod.def,{get shape(){let s=t._zod.def.shape,u={...s};if(r)for(let l in r){if(!(l in s))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(u[l]=e?new e({type:"optional",innerType:s[l]}):s[l])}else for(let l in s)u[l]=e?new e({type:"optional",innerType:s[l]}):s[l];return ai(this,"shape",u),u},checks:[]});return Zt(t,a)}function uT(e,t,r){let n=Sn(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(o[a]=new e({type:"nonoptional",innerType:i[a]}))}else for(let a in i)o[a]=new e({type:"nonoptional",innerType:i[a]});return ai(this,"shape",o),o}});return Zt(t,n)}function ci(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function gr(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function As(e){return typeof e=="string"?e:e?.message}function ir(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=As(e.inst?._zod.def?.error?.(e))??As(t?.error?.(e))??As(r.customError?.(e))??As(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Ds(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Us(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function oe(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function na(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function _q(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function lT(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function pT(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function wq(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return lT(t+r)}function Sq(e){return pT(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function $q(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function kq(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Rh=class{constructor(...t){}};var dT=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ta,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ml=k("$ZodError",dT),qs=k("$ZodError",dT,{Parent:Error});function Zl(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function Bl(e,t=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let a=r,s=0;for(;s<o.path.length;){let u=o.path[s];s===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(o))):a[u]=a[u]||{_errors:[]},a=a[u],s++}}};return n(e),r}var Ls=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new rn;if(a.issues.length){let s=new(i?.Err??e)(a.issues.map(u=>ir(u,o,xt())));throw Fl(s,i?.callee),s}return a.value},Fs=Ls(qs),Ms=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(i?.Err??e)(a.issues.map(u=>ir(u,o,xt())));throw Fl(s,i?.callee),s}return a.value},Zs=Ms(qs),Bs=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new rn;return o.issues.length?{success:!1,error:new(e??Ml)(o.issues.map(a=>ir(a,i,xt())))}:{success:!0,data:o.value}},ia=Bs(qs),Vs=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>ir(a,i,xt())))}:{success:!0,data:o.value}},Ws=Vs(qs),fT=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ls(e)(t,r,i)};var mT=e=>(t,r,n)=>Ls(e)(t,r,n);var hT=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ms(e)(t,r,i)};var gT=e=>async(t,r,n)=>Ms(e)(t,r,n);var vT=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Bs(e)(t,r,i)};var yT=e=>(t,r,n)=>Bs(e)(t,r,n);var bT=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Vs(e)(t,r,i)};var xT=e=>async(t,r,n)=>Vs(e)(t,r,n);var Pr={};qo(Pr,{base64:()=>Qh,base64url:()=>Vl,bigint:()=>og,boolean:()=>sg,browserEmail:()=>jq,cidrv4:()=>Yh,cidrv6:()=>Xh,cuid:()=>Uh,cuid2:()=>qh,date:()=>tg,datetime:()=>ng,domain:()=>Dq,duration:()=>Bh,e164:()=>eg,email:()=>Wh,emoji:()=>Hh,extendedDuration:()=>Eq,guid:()=>Vh,hex:()=>Uq,hostname:()=>Nq,html5Email:()=>Oq,idnEmail:()=>Aq,integer:()=>ag,ipv4:()=>Jh,ipv6:()=>Kh,ksuid:()=>Mh,lowercase:()=>lg,mac:()=>Gh,md5_base64:()=>Lq,md5_base64url:()=>Fq,md5_hex:()=>qq,nanoid:()=>Zh,null:()=>cg,number:()=>Wl,rfc5322Email:()=>Iq,sha1_base64:()=>Zq,sha1_base64url:()=>Bq,sha1_hex:()=>Mq,sha256_base64:()=>Wq,sha256_base64url:()=>Hq,sha256_hex:()=>Vq,sha384_base64:()=>Kq,sha384_base64url:()=>Gq,sha384_hex:()=>Jq,sha512_base64:()=>Xq,sha512_base64url:()=>Qq,sha512_hex:()=>Yq,string:()=>ig,time:()=>rg,ulid:()=>Lh,undefined:()=>ug,unicodeEmail:()=>_T,uppercase:()=>pg,uuid:()=>Yi,uuid4:()=>Pq,uuid6:()=>Rq,uuid7:()=>zq,xid:()=>Fh});var Uh=/^[cC][^\s-]{8,}$/,qh=/^[0-9a-z]+$/,Lh=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Fh=/^[0-9a-vA-V]{20}$/,Mh=/^[A-Za-z0-9]{27}$/,Zh=/^[a-zA-Z0-9_-]{21}$/,Bh=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Eq=/^[-+]?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)?)??$/,Vh=/^([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})$/,Yi=e=>e?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})$`):/^([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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Pq=Yi(4),Rq=Yi(6),zq=Yi(7),Wh=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Oq=/^[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])?)*$/,Iq=/^(([^<>()\[\]\\.,;:\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,}))$/,_T=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Aq=_T,jq=/^[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])?)*$/,Cq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Hh(){return new RegExp(Cq,"u")}var Jh=/^(?:(?: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])$/,Kh=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Gh=e=>{let t=Er(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Yh=/^((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])$/,Xh=/^(([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])$/,Qh=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vl=/^[A-Za-z0-9_-]*$/,Nq=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Dq=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,eg=/^\+[1-9]\d{6,14}$/,wT="(?:(?:\\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])))",tg=new RegExp(`^${wT}$`);function ST(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function rg(e){return new RegExp(`^${ST(e)}$`)}function ng(e){let t=ST({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${wT}T(?:${n})$`)}var ig=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},og=/^-?\d+n?$/,ag=/^-?\d+$/,Wl=/^-?\d+(?:\.\d+)?$/,sg=/^(?:true|false)$/i,cg=/^null$/i;var ug=/^undefined$/i;var lg=/^[^A-Z]*$/,pg=/^[^a-z]*$/,Uq=/^[0-9a-fA-F]*$/;function Hs(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Js(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var qq=/^[0-9a-fA-F]{32}$/,Lq=Hs(22,"=="),Fq=Js(22),Mq=/^[0-9a-fA-F]{40}$/,Zq=Hs(27,"="),Bq=Js(27),Vq=/^[0-9a-fA-F]{64}$/,Wq=Hs(43,"="),Hq=Js(43),Jq=/^[0-9a-fA-F]{96}$/,Kq=Hs(64,""),Gq=Js(64),Yq=/^[0-9a-fA-F]{128}$/,Xq=Hs(86,"=="),Qq=Js(86);var Ye=k("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),kT={number:"number",bigint:"bigint",object:"date"},dg=k("$ZodCheckLessThan",(e,t)=>{Ye.init(e,t);let r=kT[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fg=k("$ZodCheckGreaterThan",(e,t)=>{Ye.init(e,t);let r=kT[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),TT=k("$ZodCheckMultipleOf",(e,t)=>{Ye.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):zh(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ET=k("$ZodCheckNumberFormat",(e,t)=>{Ye.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Nh[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=i,s.maximum=o,r&&(s.pattern=ag)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),PT=k("$ZodCheckBigIntFormat",(e,t)=>{Ye.init(e,t);let[r,n]=Dh[t.format];e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,o.minimum=r,o.maximum=n}),e._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),RT=k("$ZodCheckMaxSize",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:Ds(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),zT=k("$ZodCheckMinSize",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:Ds(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),OT=k("$ZodCheckSizeEquals",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,o=i.size;if(o===t.size)return;let a=o>t.size;n.issues.push({origin:Ds(i),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),IT=k("$ZodCheckMaxLength",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let a=Us(i);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),AT=k("$ZodCheckMinLength",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let a=Us(i);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),jT=k("$ZodCheckLengthEquals",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!oi(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,o=i.length;if(o===t.length)return;let a=Us(i),s=o>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ks=k("$ZodCheckStringFormat",(e,t)=>{var r,n;Ye.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;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=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),CT=k("$ZodCheckRegex",(e,t)=>{Ks.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),NT=k("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lg),Ks.init(e,t)}),DT=k("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=pg),Ks.init(e,t)}),UT=k("$ZodCheckIncludes",(e,t)=>{Ye.init(e,t);let r=Er(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),qT=k("$ZodCheckStartsWith",(e,t)=>{Ye.init(e,t);let r=new RegExp(`^${Er(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),LT=k("$ZodCheckEndsWith",(e,t)=>{Ye.init(e,t);let r=new RegExp(`.*${Er(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function $T(e,t,r){e.issues.length&&t.issues.push(...gr(r,e.issues))}var FT=k("$ZodCheckProperty",(e,t)=>{Ye.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>$T(i,r,t.property));$T(n,r,t.property)}}),MT=k("$ZodCheckMimeType",(e,t)=>{Ye.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),ZT=k("$ZodCheckOverwrite",(e,t)=>{Ye.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Hl=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
76
76
  `).filter(a=>a),i=Math.min(...n.map(a=>a.length-a.trimStart().length)),o=n.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let t=Function,r=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...r,i.join(`
77
77
  `))}};var VT={major:4,minor:3,patch:6};var ue=k("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=VT;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,s,u)=>{let l=ci(a),p;for(let f of s){if(f._zod.def.when){if(!f._zod.def.when(a))continue}else if(l)continue;let m=a.issues.length,v=f._zod.check(a);if(v instanceof Promise&&u?.async===!1)throw new rn;if(p||v instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await v,a.issues.length!==m&&(l||(l=ci(a,m)))});else{if(a.issues.length===m)continue;l||(l=ci(a,m))}}return p?p.then(()=>a):a},o=(a,s,u)=>{if(ci(a))return a.aborted=!0,a;let l=i(s,n,u);if(l instanceof Promise){if(u.async===!1)throw new rn;return l.then(p=>e._zod.parse(p,u))}return e._zod.parse(l,u)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return l instanceof Promise?l.then(p=>o(p,a,s)):o(l,a,s)}let u=e._zod.parse(a,s);if(u instanceof Promise){if(s.async===!1)throw new rn;return u.then(l=>i(l,n,s))}return i(u,n,s)}}ge(e,"~standard",()=>({validate:i=>{try{let o=ia(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Ws(e,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Xi=k("$ZodString",(e,t)=>{ue.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ig(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),He=k("$ZodStringFormat",(e,t)=>{Ks.init(e,t),Xi.init(e,t)}),hg=k("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Vh),He.init(e,t)}),gg=k("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Yi(n))}else t.pattern??(t.pattern=Yi());He.init(e,t)}),vg=k("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Wh),He.init(e,t)}),yg=k("$ZodURL",(e,t)=>{He.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),bg=k("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Hh()),He.init(e,t)}),xg=k("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Zh),He.init(e,t)}),_g=k("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Uh),He.init(e,t)}),wg=k("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=qh),He.init(e,t)}),Sg=k("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Lh),He.init(e,t)}),$g=k("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Fh),He.init(e,t)}),kg=k("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Mh),He.init(e,t)}),Tg=k("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ng(t)),He.init(e,t)}),Eg=k("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=tg),He.init(e,t)}),Pg=k("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=rg(t)),He.init(e,t)}),Rg=k("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Bh),He.init(e,t)}),zg=k("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Jh),He.init(e,t),e._zod.bag.format="ipv4"}),Og=k("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Kh),He.init(e,t),e._zod.bag.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})}}}),Ig=k("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Gh(t.delimiter)),He.init(e,t),e._zod.bag.format="mac"}),Ag=k("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Yh),He.init(e,t)}),jg=k("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Xh),He.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function nE(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Cg=k("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Qh),He.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{nE(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function eL(e){if(!Vl.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return nE(r)}var Ng=k("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Vl),He.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{eL(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Dg=k("$ZodE164",(e,t)=>{t.pattern??(t.pattern=eg),He.init(e,t)});function tL(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var Ug=k("$ZodJWT",(e,t)=>{He.init(e,t),e._zod.check=r=>{tL(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),qg=k("$ZodCustomStringFormat",(e,t)=>{He.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Ql=k("$ZodNumber",(e,t)=>{ue.init(e,t),e._zod.pattern=e._zod.bag.pattern??Wl,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),Lg=k("$ZodNumberFormat",(e,t)=>{ET.init(e,t),Ql.init(e,t)}),Gs=k("$ZodBoolean",(e,t)=>{ue.init(e,t),e._zod.pattern=sg,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),ep=k("$ZodBigInt",(e,t)=>{ue.init(e,t),e._zod.pattern=og,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Fg=k("$ZodBigIntFormat",(e,t)=>{PT.init(e,t),ep.init(e,t)}),Mg=k("$ZodSymbol",(e,t)=>{ue.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:e}),r}}),Zg=k("$ZodUndefined",(e,t)=>{ue.init(e,t),e._zod.pattern=ug,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),r}}),Bg=k("$ZodNull",(e,t)=>{ue.init(e,t),e._zod.pattern=cg,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),Vg=k("$ZodAny",(e,t)=>{ue.init(e,t),e._zod.parse=r=>r}),Wg=k("$ZodUnknown",(e,t)=>{ue.init(e,t),e._zod.parse=r=>r}),Hg=k("$ZodNever",(e,t)=>{ue.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Jg=k("$ZodVoid",(e,t)=>{ue.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),Kg=k("$ZodDate",(e,t)=>{ue.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),r}});function WT(e,t,r){e.issues.length&&t.issues.push(...gr(r,e.issues)),t.value[r]=e.value}var Gg=k("$ZodArray",(e,t)=>{ue.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let a=0;a<i.length;a++){let s=i[a],u=t.element._zod.run({value:s,issues:[]},n);u instanceof Promise?o.push(u.then(l=>WT(l,r,a))):WT(u,r,a)}return o.length?Promise.all(o).then(()=>r):r}});function Xl(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...gr(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function iE(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Ch(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function oE(e,t,r,n,i,o){let a=[],s=i.keySet,u=i.catchall._zod,l=u.def.type,p=u.optout==="optional";for(let f in t){if(s.has(f))continue;if(l==="never"){a.push(f);continue}let m=u.run({value:t[f],issues:[]},n);m instanceof Promise?e.push(m.then(v=>Xl(v,r,f,t,p))):Xl(m,r,f,t,p)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var aE=k("$ZodObject",(e,t)=>{if(ue.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=ra(()=>iE(t));ge(e._zod,"propValues",()=>{let s=t.shape,u={};for(let l in s){let p=s[l]._zod;if(p.values){u[l]??(u[l]=new Set);for(let f of p.values)u[l].add(f)}}return u});let i=Gi,o=t.catchall,a;e._zod.parse=(s,u)=>{a??(a=n.value);let l=s.value;if(!i(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),s;s.value={};let p=[],f=a.shape;for(let m of a.keys){let v=f[m],g=v._zod.optout==="optional",y=v._zod.run({value:l[m],issues:[]},u);y instanceof Promise?p.push(y.then(b=>Xl(b,s,m,l,g))):Xl(y,s,m,l,g)}return o?oE(p,l,s,u,n.value,e):p.length?Promise.all(p).then(()=>s):s}}),sE=k("$ZodObjectJIT",(e,t)=>{aE.init(e,t);let r=e._zod.parse,n=ra(()=>iE(t)),i=m=>{let v=new Hl(["shape","payload","ctx"]),g=n.value,y=P=>{let A=Ll(P);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};v.write("const input = payload.value;");let b=Object.create(null),S=0;for(let P of g.keys)b[P]=`key_${S++}`;v.write("const newResult = {};");for(let P of g.keys){let A=b[P],j=Ll(P),M=m[P]?._zod?.optout==="optional";v.write(`const ${A} = ${y(P)};`),M?v.write(`
78
78
  if (${A}.issues.length) {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "mcp",
8
8
  "server"
9
9
  ],
10
- "version": "1.2.2",
10
+ "version": "1.2.3",
11
11
  "license": "MIT",
12
12
  "type": "module",
13
13
  "scripts": {
@@ -2,7 +2,7 @@ import axios from "axios";
2
2
  import * as readline from "readline";
3
3
 
4
4
  interface AuthToken {
5
- app_key: string;
5
+ api_key: string;
6
6
  }
7
7
 
8
8
  export class AppKeyGenerator {
@@ -51,9 +51,7 @@ export class AppKeyGenerator {
51
51
  */
52
52
  private async startAuthentication(): Promise<string> {
53
53
  try {
54
- const response = await axios.post(`${this.basePath}/v1/auth/display_code`, null, {
55
- params: { app_name: this.appName },
56
- });
54
+ const response = await axios.post(`${this.basePath}/v1/auth/challenges`, { app_name: this.appName });
57
55
 
58
56
  if (!response.data?.challenge_id) {
59
57
  throw new Error("Failed to get challenge ID");
@@ -77,15 +75,16 @@ export class AppKeyGenerator {
77
75
  code: string,
78
76
  ): Promise<{ appKey: string; anytypeVersion: string }> {
79
77
  try {
80
- const response = await axios.post<AuthToken>(`${this.basePath}/v1/auth/token`, null, {
81
- params: { challenge_id: challengeId, code: code },
78
+ const response = await axios.post<AuthToken>(`${this.basePath}/v1/auth/api_keys`, {
79
+ challenge_id: challengeId,
80
+ code: code,
82
81
  });
83
82
 
84
- if (!response.data?.app_key) {
85
- throw new Error("Authentication failed: No app key received");
83
+ if (!response.data?.api_key) {
84
+ throw new Error("Authentication failed: No api key received");
86
85
  }
87
86
 
88
- return { appKey: response.data.app_key, anytypeVersion: response.headers["anytype-version"] };
87
+ return { appKey: response.data.api_key, anytypeVersion: response.headers["anytype-version"] };
89
88
  } catch (error) {
90
89
  console.error("Authentication error:", error instanceof Error ? error.message : error);
91
90
  throw new Error("Failed to complete authentication");