broods 0.51.1 → 0.52.1

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/dist/account.js CHANGED
@@ -1 +1 @@
1
- import{m,qe,Z,C}from"./chunk-njxsdp91.js";export{m as BroodsAccountApiError,C as BroodsAccountClient,qe as envPlaceholder,Z as resolveEnvCredential};
1
+ import{p,ge,q,w}from"./chunk-a8zhzzj7.js";export{p as BroodsAccountApiError,w as BroodsAccountClient,ge as envPlaceholder,q as resolveEnvCredential};
@@ -0,0 +1,65 @@
1
+ var at,le=Object.freeze({status:"aborted"});function b(p,f,m){function h(z,v){if(!z._zod)Object.defineProperty(z,"_zod",{value:{def:v,constr:x,traits:new Set},enumerable:!1});if(z._zod.traits.has(p))return;z._zod.traits.add(p),f(z,v);let y=x.prototype,w=Object.keys(y);for(let Z=0;Z<w.length;Z++){let E=w[Z];if(!(E in z))z[E]=y[E].bind(z)}}let _=m?.Parent??Object;class g extends _{}Object.defineProperty(g,"name",{value:p});function x(z){var v;let y=m?.Parent?new g:this;h(y,z),(v=y._zod).deferred??(v.deferred=[]);for(let w of y._zod.deferred)w();return y}return Object.defineProperty(x,"init",{value:h}),Object.defineProperty(x,Symbol.hasInstance,{value:(z)=>{if(m?.Parent&&z instanceof m.Parent)return!0;return z?._zod?.traits?.has(p)}}),Object.defineProperty(x,"name",{value:p}),x}var yc=Symbol("zod_brand");class te extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ze extends Error{constructor(p){super(`Encountered unidirectional transform during encode: ${p}`);this.name="ZodEncodeError"}}(at=globalThis).__zod_globalConfig??(at.__zod_globalConfig={});var $e=globalThis.__zod_globalConfig;function S(p){if(p)Object.assign($e,p);return $e}function Fe(p){let f=Object.values(p).filter((h)=>typeof h==="number");return Object.entries(p).filter(([h,_])=>f.indexOf(+h)===-1).map(([h,_])=>_)}function ne(p,f="|"){return p.map((m)=>re(m)).join(f)}function Pe(p,f){if(typeof f==="bigint")return f.toString();return f}function Se(p){return{get value(){{let m=p();return Object.defineProperty(this,"value",{value:m}),m}throw Error("cached value already set")}}}function Ue(p){return p===null||p===void 0}function Me(p){let f=p.startsWith("^")?1:0,m=p.endsWith("$")?p.length-1:p.length;return p.slice(f,m)}function lt(p,f){let m=p/f,h=Math.round(m),_=Number.EPSILON*Math.max(Math.abs(m),1);if(Math.abs(m-h)<_)return 0;return m-h}var pt=Symbol("evaluating");function T(p,f,m){let h=void 0;Object.defineProperty(p,f,{get(){if(h===pt)return;if(h===void 0)h=pt,h=m();return h},set(_){Object.defineProperty(p,f,{value:_})},configurable:!0})}function _e(p,f,m){Object.defineProperty(p,f,{value:m,writable:!0,enumerable:!0,configurable:!0})}function ie(...p){let f={};for(let m of p){let h=Object.getOwnPropertyDescriptors(m);Object.assign(f,h)}return Object.defineProperties({},f)}function cr(p){return JSON.stringify(p)}function ft(p){return p.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ur="captureStackTrace"in Error?Error.captureStackTrace:(...p)=>{};function be(p){return typeof p==="object"&&p!==null&&!Array.isArray(p)}var dt=Se(()=>{if($e.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(p){return!1}});function ge(p){if(be(p)===!1)return!1;let f=p.constructor;if(f===void 0)return!0;if(typeof f!=="function")return!0;let m=f.prototype;if(be(m)===!1)return!1;if(Object.prototype.hasOwnProperty.call(m,"isPrototypeOf")===!1)return!1;return!0}function ar(p){if(ge(p))return{...p};if(Array.isArray(p))return[...p];if(p instanceof Map)return new Map(p);if(p instanceof Set)return new Set(p);return p}var mt=new Set(["string","number","symbol"]);function ce(p){return p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ee(p,f,m){let h=new p._zod.constr(f??p._zod.def);if(!f||m?.parent)h._zod.parent=p;return h}function k(p){let f=p;if(!f)return{};if(typeof f==="string")return{error:()=>f};if(f?.message!==void 0){if(f?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");f.error=f.message}if(delete f.message,typeof f.error==="string")return{...f,error:()=>f.error};return f}function re(p){if(typeof p==="bigint")return p.toString()+"n";if(typeof p==="string")return`"${p}"`;return`${p}`}function ht(p){return Object.keys(p).filter((f)=>p[f]._zod.optin==="optional"&&p[f]._zod.optout==="optional")}var _t={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]};function ei(p,f){let m=p._zod.def,h=m.checks;if(h&&h.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let g=ie(p._zod.def,{get shape(){let x={};for(let z in f){if(!(z in m.shape))throw Error(`Unrecognized key: "${z}"`);if(!f[z])continue;x[z]=m.shape[z]}return _e(this,"shape",x),x},checks:[]});return ee(p,g)}function ri(p,f){let m=p._zod.def,h=m.checks;if(h&&h.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let g=ie(p._zod.def,{get shape(){let x={...p._zod.def.shape};for(let z in f){if(!(z in m.shape))throw Error(`Unrecognized key: "${z}"`);if(!f[z])continue;delete x[z]}return _e(this,"shape",x),x},checks:[]});return ee(p,g)}function ti(p,f){if(!ge(f))throw Error("Invalid input to extend: expected a plain object");let m=p._zod.def.checks;if(m&&m.length>0){let g=p._zod.def.shape;for(let x in f)if(Object.getOwnPropertyDescriptor(g,x)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let _=ie(p._zod.def,{get shape(){let g={...p._zod.def.shape,...f};return _e(this,"shape",g),g}});return ee(p,_)}function oi(p,f){if(!ge(f))throw Error("Invalid input to safeExtend: expected a plain object");let m=ie(p._zod.def,{get shape(){let h={...p._zod.def.shape,...f};return _e(this,"shape",h),h}});return ee(p,m)}function ni(p,f){if(p._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let m=ie(p._zod.def,{get shape(){let h={...p._zod.def.shape,...f._zod.def.shape};return _e(this,"shape",h),h},get catchall(){return f._zod.def.catchall},checks:f._zod.def.checks??[]});return ee(p,m)}function si(p,f,m){let _=f._zod.def.checks;if(_&&_.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let x=ie(f._zod.def,{get shape(){let z=f._zod.def.shape,v={...z};if(m)for(let y in m){if(!(y in z))throw Error(`Unrecognized key: "${y}"`);if(!m[y])continue;v[y]=p?new p({type:"optional",innerType:z[y]}):z[y]}else for(let y in z)v[y]=p?new p({type:"optional",innerType:z[y]}):z[y];return _e(this,"shape",v),v},checks:[]});return ee(f,x)}function ii(p,f,m){let h=ie(f._zod.def,{get shape(){let _=f._zod.def.shape,g={..._};if(m)for(let x in m){if(!(x in g))throw Error(`Unrecognized key: "${x}"`);if(!m[x])continue;g[x]=new p({type:"nonoptional",innerType:_[x]})}else for(let x in _)g[x]=new p({type:"nonoptional",innerType:_[x]});return _e(this,"shape",g),g}});return ee(f,h)}function xe(p,f=0){if(p.aborted===!0)return!0;for(let m=f;m<p.issues.length;m++)if(p.issues[m]?.continue!==!0)return!0;return!1}function gt(p,f=0){if(p.aborted===!0)return!0;for(let m=f;m<p.issues.length;m++)if(p.issues[m]?.continue===!1)return!0;return!1}function ae(p,f){return f.map((m)=>{var h;return(h=m).path??(h.path=[]),m.path.unshift(p),m})}function Le(p){return typeof p==="string"?p:p?.message}function H(p,f,m){let h=p.message?p.message:Le(p.inst?._zod.def?.error?.(p))??Le(f?.error?.(p))??Le(m.customError?.(p))??Le(m.localeError?.(p))??"Invalid input",{inst:_,continue:g,input:x,...z}=p;if(z.path??(z.path=[]),z.message=h,f?.reportInput)z.input=x;return z}function Je(p){if(Array.isArray(p))return"array";if(typeof p==="string")return"string";return"unknown"}function ue(p){let f=typeof p;switch(f){case"number":return Number.isNaN(p)?"nan":"number";case"object":{if(p===null)return"null";if(Array.isArray(p))return"array";let m=p;if(m&&Object.getPrototypeOf(m)!==Object.prototype&&"constructor"in m&&m.constructor)return m.constructor.name}}return f}function ze(...p){let[f,m,h]=p;if(typeof f==="string")return{message:f,code:"custom",input:m,inst:h};return{...f}}var xt=(p,f)=>{p.name="$ZodError",Object.defineProperty(p,"_zod",{value:p._zod,enumerable:!1}),Object.defineProperty(p,"issues",{value:f,enumerable:!1}),p.message=JSON.stringify(f,Pe,2),Object.defineProperty(p,"toString",{value:()=>p.message,enumerable:!1})},Be=b("$ZodError",xt),pr=b("$ZodError",xt,{Parent:Error});function zt(p,f=(m)=>m.message){let m={},h=[];for(let _ of p.issues)if(_.path.length>0)m[_.path[0]]=m[_.path[0]]||[],m[_.path[0]].push(f(_));else h.push(f(_));return{formErrors:h,fieldErrors:m}}function vt(p,f=(m)=>m.message){let m={_errors:[]},h=(_,g=[])=>{for(let x of _.issues)if(x.code==="invalid_union"&&x.errors.length)x.errors.map((z)=>h({issues:z},[...g,...x.path]));else if(x.code==="invalid_key")h({issues:x.issues},[...g,...x.path]);else if(x.code==="invalid_element")h({issues:x.issues},[...g,...x.path]);else{let z=[...g,...x.path];if(z.length===0)m._errors.push(f(x));else{let v=m,y=0;while(y<z.length){let w=z[y];if(y!==z.length-1)v[w]=v[w]||{_errors:[]};else v[w]=v[w]||{_errors:[]},v[w]._errors.push(f(x));v=v[w],y++}}}};return h(p),m}function ci(p){let f=[],m=p.map((h)=>typeof h==="object"?h.key:h);for(let h of m)if(typeof h==="number")f.push(`[${h}]`);else if(typeof h==="symbol")f.push(`[${JSON.stringify(String(h))}]`);else if(/[^\w$]/.test(h))f.push(`[${JSON.stringify(h)}]`);else{if(f.length)f.push(".");f.push(h)}return f.join("")}function ye(p){let f=[],m=[...p.issues].sort((h,_)=>(h.path??[]).length-(_.path??[]).length);for(let h of m)if(f.push(`✖ ${h.message}`),h.path?.length)f.push(` → at ${ci(h.path)}`);return f.join(`
2
+ `)}var Ve=(p)=>(f,m,h,_)=>{let g=h?{...h,async:!1}:{async:!1},x=f._zod.run({value:m,issues:[]},g);if(x instanceof Promise)throw new te;if(x.issues.length){let z=new(_?.Err??p)(x.issues.map((v)=>H(v,g,S())));throw ur(z,_?.callee),z}return x.value};var We=(p)=>async(f,m,h,_)=>{let g=h?{...h,async:!0}:{async:!0},x=f._zod.run({value:m,issues:[]},g);if(x instanceof Promise)x=await x;if(x.issues.length){let z=new(_?.Err??p)(x.issues.map((v)=>H(v,g,S())));throw ur(z,_?.callee),z}return x.value};var Oe=(p)=>(f,m,h)=>{let _=h?{...h,async:!1}:{async:!1},g=f._zod.run({value:m,issues:[]},_);if(g instanceof Promise)throw new te;return g.issues.length?{success:!1,error:new(p??Be)(g.issues.map((x)=>H(x,_,S())))}:{success:!0,data:g.value}},yt=Oe(pr),Ee=(p)=>async(f,m,h)=>{let _=h?{...h,async:!0}:{async:!0},g=f._zod.run({value:m,issues:[]},_);if(g instanceof Promise)g=await g;return g.issues.length?{success:!1,error:new p(g.issues.map((x)=>H(x,_,S())))}:{success:!0,data:g.value}},$t=Ee(pr),bt=(p)=>(f,m,h)=>{let _=h?{...h,direction:"backward"}:{direction:"backward"};return Ve(p)(f,m,_)};var wt=(p)=>(f,m,h)=>Ve(p)(f,m,h);var kt=(p)=>async(f,m,h)=>{let _=h?{...h,direction:"backward"}:{direction:"backward"};return We(p)(f,m,_)};var Zt=(p)=>async(f,m,h)=>We(p)(f,m,h);var Pt=(p)=>(f,m,h)=>{let _=h?{...h,direction:"backward"}:{direction:"backward"};return Oe(p)(f,m,_)};var St=(p)=>(f,m,h)=>Oe(p)(f,m,h);var Ot=(p)=>async(f,m,h)=>{let _=h?{...h,direction:"backward"}:{direction:"backward"};return Ee(p)(f,m,_)};var Et=(p)=>async(f,m,h)=>Ee(p)(f,m,h);var It=/^[cC][0-9a-z]{6,}$/,Tt=/^[0-9a-z]+$/,Nt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,At=/^[0-9a-vA-V]{20}$/,jt=/^[A-Za-z0-9]{27}$/,Ct=/^[a-zA-Z0-9_-]{21}$/,Rt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Dt=/^([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})$/,lr=(p)=>{if(!p)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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${p}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Lt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var ai="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ft(){return new RegExp(ai,"u")}var Ut=/^(?:(?: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])$/,Mt=/^(([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}|:))$/;var Jt=/^((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])$/,Bt=/^(([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])$/,Vt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fr=/^[A-Za-z0-9_-]*$/;var Wt=/^https?$/,Kt=/^\+[1-9]\d{6,14}$/,Gt="(?:(?:\\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])))",qt=new RegExp(`^${Gt}$`);function Yt(p){return typeof p.precision==="number"?p.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":p.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{${p.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Xt(p){return new RegExp(`^${Yt(p)}$`)}function Ht(p){let f=Yt({precision:p.precision}),m=["Z"];if(p.local)m.push("");if(p.offset)m.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let h=`${f}(?:${m.join("|")})`;return new RegExp(`^${Gt}T(?:${h})$`)}var Qt=(p)=>{let f=p?`[\\s\\S]{${p?.minimum??0},${p?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${f}$`)};var eo=/^-?\d+$/,dr=/^-?\d+(?:\.\d+)?$/,ro=/^(?:true|false)$/i,to=/^null$/i;var oo=/^[^A-Z]*$/,no=/^[^a-z]*$/;var K=b("$ZodCheck",(p,f)=>{var m;p._zod??(p._zod={}),p._zod.def=f,(m=p._zod).onattach??(m.onattach=[])}),so={number:"number",bigint:"bigint",object:"date"},mr=b("$ZodCheckLessThan",(p,f)=>{K.init(p,f);let m=so[typeof f.value];p._zod.onattach.push((h)=>{let _=h._zod.bag,g=(f.inclusive?_.maximum:_.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(f.value<g)if(f.inclusive)_.maximum=f.value;else _.exclusiveMaximum=f.value}),p._zod.check=(h)=>{if(f.inclusive?h.value<=f.value:h.value<f.value)return;h.issues.push({origin:m,code:"too_big",maximum:typeof f.value==="object"?f.value.getTime():f.value,input:h.value,inclusive:f.inclusive,inst:p,continue:!f.abort})}}),hr=b("$ZodCheckGreaterThan",(p,f)=>{K.init(p,f);let m=so[typeof f.value];p._zod.onattach.push((h)=>{let _=h._zod.bag,g=(f.inclusive?_.minimum:_.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(f.value>g)if(f.inclusive)_.minimum=f.value;else _.exclusiveMinimum=f.value}),p._zod.check=(h)=>{if(f.inclusive?h.value>=f.value:h.value>f.value)return;h.issues.push({origin:m,code:"too_small",minimum:typeof f.value==="object"?f.value.getTime():f.value,input:h.value,inclusive:f.inclusive,inst:p,continue:!f.abort})}}),io=b("$ZodCheckMultipleOf",(p,f)=>{K.init(p,f),p._zod.onattach.push((m)=>{var h;(h=m._zod.bag).multipleOf??(h.multipleOf=f.value)}),p._zod.check=(m)=>{if(typeof m.value!==typeof f.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof m.value==="bigint"?m.value%f.value===BigInt(0):lt(m.value,f.value)===0)return;m.issues.push({origin:typeof m.value,code:"not_multiple_of",divisor:f.value,input:m.value,inst:p,continue:!f.abort})}}),co=b("$ZodCheckNumberFormat",(p,f)=>{K.init(p,f),f.format=f.format||"float64";let m=f.format?.includes("int"),h=m?"int":"number",[_,g]=_t[f.format];p._zod.onattach.push((x)=>{let z=x._zod.bag;if(z.format=f.format,z.minimum=_,z.maximum=g,m)z.pattern=eo}),p._zod.check=(x)=>{let z=x.value;if(m){if(!Number.isInteger(z)){x.issues.push({expected:h,format:f.format,code:"invalid_type",continue:!1,input:z,inst:p});return}if(!Number.isSafeInteger(z)){if(z>0)x.issues.push({input:z,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:p,origin:h,inclusive:!0,continue:!f.abort});else x.issues.push({input:z,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:p,origin:h,inclusive:!0,continue:!f.abort});return}}if(z<_)x.issues.push({origin:"number",input:z,code:"too_small",minimum:_,inclusive:!0,inst:p,continue:!f.abort});if(z>g)x.issues.push({origin:"number",input:z,code:"too_big",maximum:g,inclusive:!0,inst:p,continue:!f.abort})}});var uo=b("$ZodCheckMaxLength",(p,f)=>{var m;K.init(p,f),(m=p._zod.def).when??(m.when=(h)=>{let _=h.value;return!Ue(_)&&_.length!==void 0}),p._zod.onattach.push((h)=>{let _=h._zod.bag.maximum??Number.POSITIVE_INFINITY;if(f.maximum<_)h._zod.bag.maximum=f.maximum}),p._zod.check=(h)=>{let _=h.value;if(_.length<=f.maximum)return;let x=Je(_);h.issues.push({origin:x,code:"too_big",maximum:f.maximum,inclusive:!0,input:_,inst:p,continue:!f.abort})}}),ao=b("$ZodCheckMinLength",(p,f)=>{var m;K.init(p,f),(m=p._zod.def).when??(m.when=(h)=>{let _=h.value;return!Ue(_)&&_.length!==void 0}),p._zod.onattach.push((h)=>{let _=h._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(f.minimum>_)h._zod.bag.minimum=f.minimum}),p._zod.check=(h)=>{let _=h.value;if(_.length>=f.minimum)return;let x=Je(_);h.issues.push({origin:x,code:"too_small",minimum:f.minimum,inclusive:!0,input:_,inst:p,continue:!f.abort})}}),po=b("$ZodCheckLengthEquals",(p,f)=>{var m;K.init(p,f),(m=p._zod.def).when??(m.when=(h)=>{let _=h.value;return!Ue(_)&&_.length!==void 0}),p._zod.onattach.push((h)=>{let _=h._zod.bag;_.minimum=f.length,_.maximum=f.length,_.length=f.length}),p._zod.check=(h)=>{let _=h.value,g=_.length;if(g===f.length)return;let x=Je(_),z=g>f.length;h.issues.push({origin:x,...z?{code:"too_big",maximum:f.length}:{code:"too_small",minimum:f.length},inclusive:!0,exact:!0,input:h.value,inst:p,continue:!f.abort})}}),Ie=b("$ZodCheckStringFormat",(p,f)=>{var m,h;if(K.init(p,f),p._zod.onattach.push((_)=>{let g=_._zod.bag;if(g.format=f.format,f.pattern)g.patterns??(g.patterns=new Set),g.patterns.add(f.pattern)}),f.pattern)(m=p._zod).check??(m.check=(_)=>{if(f.pattern.lastIndex=0,f.pattern.test(_.value))return;_.issues.push({origin:"string",code:"invalid_format",format:f.format,input:_.value,...f.pattern?{pattern:f.pattern.toString()}:{},inst:p,continue:!f.abort})});else(h=p._zod).check??(h.check=()=>{})}),lo=b("$ZodCheckRegex",(p,f)=>{Ie.init(p,f),p._zod.check=(m)=>{if(f.pattern.lastIndex=0,f.pattern.test(m.value))return;m.issues.push({origin:"string",code:"invalid_format",format:"regex",input:m.value,pattern:f.pattern.toString(),inst:p,continue:!f.abort})}}),fo=b("$ZodCheckLowerCase",(p,f)=>{f.pattern??(f.pattern=oo),Ie.init(p,f)}),mo=b("$ZodCheckUpperCase",(p,f)=>{f.pattern??(f.pattern=no),Ie.init(p,f)}),ho=b("$ZodCheckIncludes",(p,f)=>{K.init(p,f);let m=ce(f.includes),h=new RegExp(typeof f.position==="number"?`^.{${f.position}}${m}`:m);f.pattern=h,p._zod.onattach.push((_)=>{let g=_._zod.bag;g.patterns??(g.patterns=new Set),g.patterns.add(h)}),p._zod.check=(_)=>{if(_.value.includes(f.includes,f.position))return;_.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:f.includes,input:_.value,inst:p,continue:!f.abort})}}),_o=b("$ZodCheckStartsWith",(p,f)=>{K.init(p,f);let m=new RegExp(`^${ce(f.prefix)}.*`);f.pattern??(f.pattern=m),p._zod.onattach.push((h)=>{let _=h._zod.bag;_.patterns??(_.patterns=new Set),_.patterns.add(m)}),p._zod.check=(h)=>{if(h.value.startsWith(f.prefix))return;h.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:f.prefix,input:h.value,inst:p,continue:!f.abort})}}),go=b("$ZodCheckEndsWith",(p,f)=>{K.init(p,f);let m=new RegExp(`.*${ce(f.suffix)}$`);f.pattern??(f.pattern=m),p._zod.onattach.push((h)=>{let _=h._zod.bag;_.patterns??(_.patterns=new Set),_.patterns.add(m)}),p._zod.check=(h)=>{if(h.value.endsWith(f.suffix))return;h.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:f.suffix,input:h.value,inst:p,continue:!f.abort})}});var xo=b("$ZodCheckOverwrite",(p,f)=>{K.init(p,f),p._zod.check=(m)=>{m.value=f.tx(m.value)}});class _r{constructor(p=[]){if(this.content=[],this.indent=0,this)this.args=p}indented(p){this.indent+=1,p(this),this.indent-=1}write(p){if(typeof p==="function"){p(this,{execution:"sync"}),p(this,{execution:"async"});return}let m=p.split(`
3
+ `).filter((g)=>g),h=Math.min(...m.map((g)=>g.length-g.trimStart().length)),_=m.map((g)=>g.slice(h)).map((g)=>" ".repeat(this.indent*2)+g);for(let g of _)this.content.push(g)}compile(){let p=Function,f=this?.args,h=[...(this?.content??[""]).map((_)=>` ${_}`)];return new p(...f,h.join(`
4
+ `))}}var vo={major:4,minor:4,patch:3};var j=b("$ZodType",(p,f)=>{var m;p??(p={}),p._zod.def=f,p._zod.bag=p._zod.bag||{},p._zod.version=vo;let h=[...p._zod.def.checks??[]];if(p._zod.traits.has("$ZodCheck"))h.unshift(p);for(let _ of h)for(let g of _._zod.onattach)g(p);if(h.length===0)(m=p._zod).deferred??(m.deferred=[]),p._zod.deferred?.push(()=>{p._zod.run=p._zod.parse});else{let _=(x,z,v)=>{let y=xe(x),w;for(let Z of z){if(Z._zod.def.when){if(gt(x))continue;if(!Z._zod.def.when(x))continue}else if(y)continue;let E=x.issues.length,O=Z._zod.check(x);if(O instanceof Promise&&v?.async===!1)throw new te;if(w||O instanceof Promise)w=(w??Promise.resolve()).then(async()=>{if(await O,x.issues.length===E)return;if(!y)y=xe(x,E)});else{if(x.issues.length===E)continue;if(!y)y=xe(x,E)}}if(w)return w.then(()=>x);return x},g=(x,z,v)=>{if(xe(x))return x.aborted=!0,x;let y=_(z,h,v);if(y instanceof Promise){if(v.async===!1)throw new te;return y.then((w)=>p._zod.parse(w,v))}return p._zod.parse(y,v)};p._zod.run=(x,z)=>{if(z.skipChecks)return p._zod.parse(x,z);if(z.direction==="backward"){let y=p._zod.parse({value:x.value,issues:[]},{...z,skipChecks:!0});if(y instanceof Promise)return y.then((w)=>g(w,x,z));return g(y,x,z)}let v=p._zod.parse(x,z);if(v instanceof Promise){if(z.async===!1)throw new te;return v.then((y)=>_(y,h,z))}return _(v,h,z)}}T(p,"~standard",()=>({validate:(_)=>{try{let g=yt(p,_);return g.success?{value:g.data}:{issues:g.error?.issues}}catch(g){return $t(p,_).then((x)=>x.success?{value:x.data}:{issues:x.error?.issues})}},vendor:"zod",version:1}))}),Ye=b("$ZodString",(p,f)=>{j.init(p,f),p._zod.pattern=[...p?._zod.bag?.patterns??[]].pop()??Qt(p._zod.bag),p._zod.parse=(m,h)=>{if(f.coerce)try{m.value=String(m.value)}catch(_){}if(typeof m.value==="string")return m;return m.issues.push({expected:"string",code:"invalid_type",input:m.value,inst:p}),m}}),U=b("$ZodStringFormat",(p,f)=>{Ie.init(p,f),Ye.init(p,f)}),Oo=b("$ZodGUID",(p,f)=>{f.pattern??(f.pattern=Dt),U.init(p,f)}),Eo=b("$ZodUUID",(p,f)=>{if(f.version){let h={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[f.version];if(h===void 0)throw Error(`Invalid UUID version: "${f.version}"`);f.pattern??(f.pattern=lr(h))}else f.pattern??(f.pattern=lr());U.init(p,f)}),Io=b("$ZodEmail",(p,f)=>{f.pattern??(f.pattern=Lt),U.init(p,f)}),To=b("$ZodURL",(p,f)=>{U.init(p,f),p._zod.check=(m)=>{try{let h=m.value.trim();if(!f.normalize&&f.protocol?.source===Wt.source){if(!/^https?:\/\//i.test(h)){m.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:m.value,inst:p,continue:!f.abort});return}}let _=new URL(h);if(f.hostname){if(f.hostname.lastIndex=0,!f.hostname.test(_.hostname))m.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:f.hostname.source,input:m.value,inst:p,continue:!f.abort})}if(f.protocol){if(f.protocol.lastIndex=0,!f.protocol.test(_.protocol.endsWith(":")?_.protocol.slice(0,-1):_.protocol))m.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:f.protocol.source,input:m.value,inst:p,continue:!f.abort})}if(f.normalize)m.value=_.href;else m.value=h;return}catch(h){m.issues.push({code:"invalid_format",format:"url",input:m.value,inst:p,continue:!f.abort})}}}),No=b("$ZodEmoji",(p,f)=>{f.pattern??(f.pattern=Ft()),U.init(p,f)}),Ao=b("$ZodNanoID",(p,f)=>{f.pattern??(f.pattern=Ct),U.init(p,f)}),jo=b("$ZodCUID",(p,f)=>{f.pattern??(f.pattern=It),U.init(p,f)}),Co=b("$ZodCUID2",(p,f)=>{f.pattern??(f.pattern=Tt),U.init(p,f)}),Ro=b("$ZodULID",(p,f)=>{f.pattern??(f.pattern=Nt),U.init(p,f)}),Do=b("$ZodXID",(p,f)=>{f.pattern??(f.pattern=At),U.init(p,f)}),Lo=b("$ZodKSUID",(p,f)=>{f.pattern??(f.pattern=jt),U.init(p,f)}),Fo=b("$ZodISODateTime",(p,f)=>{f.pattern??(f.pattern=Ht(f)),U.init(p,f)}),Uo=b("$ZodISODate",(p,f)=>{f.pattern??(f.pattern=qt),U.init(p,f)}),Mo=b("$ZodISOTime",(p,f)=>{f.pattern??(f.pattern=Xt(f)),U.init(p,f)}),Jo=b("$ZodISODuration",(p,f)=>{f.pattern??(f.pattern=Rt),U.init(p,f)}),Bo=b("$ZodIPv4",(p,f)=>{f.pattern??(f.pattern=Ut),U.init(p,f),p._zod.bag.format="ipv4"}),Vo=b("$ZodIPv6",(p,f)=>{f.pattern??(f.pattern=Mt),U.init(p,f),p._zod.bag.format="ipv6",p._zod.check=(m)=>{try{new URL(`http://[${m.value}]`)}catch{m.issues.push({code:"invalid_format",format:"ipv6",input:m.value,inst:p,continue:!f.abort})}}});var Wo=b("$ZodCIDRv4",(p,f)=>{f.pattern??(f.pattern=Jt),U.init(p,f)}),Ko=b("$ZodCIDRv6",(p,f)=>{f.pattern??(f.pattern=Bt),U.init(p,f),p._zod.check=(m)=>{let h=m.value.split("/");try{if(h.length!==2)throw Error();let[_,g]=h;if(!g)throw Error();let x=Number(g);if(`${x}`!==g)throw Error();if(x<0||x>128)throw Error();new URL(`http://[${_}]`)}catch{m.issues.push({code:"invalid_format",format:"cidrv6",input:m.value,inst:p,continue:!f.abort})}}});function Go(p){if(p==="")return!0;if(/\s/.test(p))return!1;if(p.length%4!==0)return!1;try{return atob(p),!0}catch{return!1}}var qo=b("$ZodBase64",(p,f)=>{f.pattern??(f.pattern=Vt),U.init(p,f),p._zod.bag.contentEncoding="base64",p._zod.check=(m)=>{if(Go(m.value))return;m.issues.push({code:"invalid_format",format:"base64",input:m.value,inst:p,continue:!f.abort})}});function pi(p){if(!fr.test(p))return!1;let f=p.replace(/[-_]/g,(h)=>h==="-"?"+":"/"),m=f.padEnd(Math.ceil(f.length/4)*4,"=");return Go(m)}var Yo=b("$ZodBase64URL",(p,f)=>{f.pattern??(f.pattern=fr),U.init(p,f),p._zod.bag.contentEncoding="base64url",p._zod.check=(m)=>{if(pi(m.value))return;m.issues.push({code:"invalid_format",format:"base64url",input:m.value,inst:p,continue:!f.abort})}}),Xo=b("$ZodE164",(p,f)=>{f.pattern??(f.pattern=Kt),U.init(p,f)});function li(p,f=null){try{let m=p.split(".");if(m.length!==3)return!1;let[h]=m;if(!h)return!1;let _=JSON.parse(atob(h));if("typ"in _&&_?.typ!=="JWT")return!1;if(!_.alg)return!1;if(f&&(!("alg"in _)||_.alg!==f))return!1;return!0}catch{return!1}}var Ho=b("$ZodJWT",(p,f)=>{U.init(p,f),p._zod.check=(m)=>{if(li(m.value,f.alg))return;m.issues.push({code:"invalid_format",format:"jwt",input:m.value,inst:p,continue:!f.abort})}});var xr=b("$ZodNumber",(p,f)=>{j.init(p,f),p._zod.pattern=p._zod.bag.pattern??dr,p._zod.parse=(m,h)=>{if(f.coerce)try{m.value=Number(m.value)}catch(x){}let _=m.value;if(typeof _==="number"&&!Number.isNaN(_)&&Number.isFinite(_))return m;let g=typeof _==="number"?Number.isNaN(_)?"NaN":!Number.isFinite(_)?"Infinity":void 0:void 0;return m.issues.push({expected:"number",code:"invalid_type",input:_,inst:p,...g?{received:g}:{}}),m}}),Qo=b("$ZodNumberFormat",(p,f)=>{co.init(p,f),xr.init(p,f)}),en=b("$ZodBoolean",(p,f)=>{j.init(p,f),p._zod.pattern=ro,p._zod.parse=(m,h)=>{if(f.coerce)try{m.value=Boolean(m.value)}catch(g){}let _=m.value;if(typeof _==="boolean")return m;return m.issues.push({expected:"boolean",code:"invalid_type",input:_,inst:p}),m}});var rn=b("$ZodNull",(p,f)=>{j.init(p,f),p._zod.pattern=to,p._zod.values=new Set([null]),p._zod.parse=(m,h)=>{let _=m.value;if(_===null)return m;return m.issues.push({expected:"null",code:"invalid_type",input:_,inst:p}),m}}),tn=b("$ZodAny",(p,f)=>{j.init(p,f),p._zod.parse=(m)=>m}),on=b("$ZodUnknown",(p,f)=>{j.init(p,f),p._zod.parse=(m)=>m}),nn=b("$ZodNever",(p,f)=>{j.init(p,f),p._zod.parse=(m,h)=>(m.issues.push({expected:"never",code:"invalid_type",input:m.value,inst:p}),m)});function yo(p,f,m){if(p.issues.length)f.issues.push(...ae(m,p.issues));f.value[m]=p.value}var sn=b("$ZodArray",(p,f)=>{j.init(p,f),p._zod.parse=(m,h)=>{let _=m.value;if(!Array.isArray(_))return m.issues.push({expected:"array",code:"invalid_type",input:_,inst:p}),m;m.value=Array(_.length);let g=[];for(let x=0;x<_.length;x++){let z=_[x],v=f.element._zod.run({value:z,issues:[]},h);if(v instanceof Promise)g.push(v.then((y)=>yo(y,m,x)));else yo(v,m,x)}if(g.length)return Promise.all(g).then(()=>m);return m}});function qe(p,f,m,h,_,g){let x=m in h;if(p.issues.length){if(_&&g&&!x)return;f.issues.push(...ae(m,p.issues))}if(!x&&!_){if(!p.issues.length)f.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[m]});return}if(p.value===void 0){if(x)f.value[m]=void 0}else f.value[m]=p.value}function cn(p){let f=Object.keys(p.shape);for(let h of f)if(!p.shape?.[h]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${h}": expected a Zod schema`);let m=ht(p.shape);return{...p,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(m)}}function un(p,f,m,h,_,g){let x=[],z=_.keySet,v=_.catchall._zod,y=v.def.type,w=v.optin==="optional",Z=v.optout==="optional";for(let E in f){if(E==="__proto__")continue;if(z.has(E))continue;if(y==="never"){x.push(E);continue}let O=v.run({value:f[E],issues:[]},h);if(O instanceof Promise)p.push(O.then((N)=>qe(N,m,E,f,w,Z)));else qe(O,m,E,f,w,Z)}if(x.length)m.issues.push({code:"unrecognized_keys",keys:x,input:f,inst:g});if(!p.length)return m;return Promise.all(p).then(()=>m)}var fi=b("$ZodObject",(p,f)=>{if(j.init(p,f),!Object.getOwnPropertyDescriptor(f,"shape")?.get){let z=f.shape;Object.defineProperty(f,"shape",{get:()=>{let v={...z};return Object.defineProperty(f,"shape",{value:v}),v}})}let h=Se(()=>cn(f));T(p._zod,"propValues",()=>{let z=f.shape,v={};for(let y in z){let w=z[y]._zod;if(w.values){v[y]??(v[y]=new Set);for(let Z of w.values)v[y].add(Z)}}return v});let _=be,g=f.catchall,x;p._zod.parse=(z,v)=>{x??(x=h.value);let y=z.value;if(!_(y))return z.issues.push({expected:"object",code:"invalid_type",input:y,inst:p}),z;z.value={};let w=[],Z=x.shape;for(let E of x.keys){let O=Z[E],N=O._zod.optin==="optional",ke=O._zod.optout==="optional",V=O._zod.run({value:y[E],issues:[]},v);if(V instanceof Promise)w.push(V.then((sr)=>qe(sr,z,E,y,N,ke)));else qe(V,z,E,y,N,ke)}if(!g)return w.length?Promise.all(w).then(()=>z):z;return un(w,y,z,v,h.value,p)}}),an=b("$ZodObjectJIT",(p,f)=>{fi.init(p,f);let m=p._zod.parse,h=Se(()=>cn(f)),_=(E)=>{let O=new _r(["shape","payload","ctx"]),N=h.value,ke=(Q)=>{let B=cr(Q);return`shape[${B}]._zod.run({ value: input[${B}], issues: [] }, ctx)`};O.write("const input = payload.value;");let V=Object.create(null),sr=0;for(let Q of N.keys)V[Q]=`key_${sr++}`;O.write("const newResult = {};");for(let Q of N.keys){let B=V[Q],W=cr(Q),ct=E[Q],ut=ct?._zod?.optin==="optional",Qs=ct?._zod?.optout==="optional";if(O.write(`const ${B} = ${ke(Q)};`),ut&&Qs)O.write(`
5
+ if (${B}.issues.length) {
6
+ if (${W} in input) {
7
+ payload.issues = payload.issues.concat(${B}.issues.map(iss => ({
8
+ ...iss,
9
+ path: iss.path ? [${W}, ...iss.path] : [${W}]
10
+ })));
11
+ }
12
+ }
13
+
14
+ if (${B}.value === undefined) {
15
+ if (${W} in input) {
16
+ newResult[${W}] = undefined;
17
+ }
18
+ } else {
19
+ newResult[${W}] = ${B}.value;
20
+ }
21
+
22
+ `);else if(!ut)O.write(`
23
+ const ${B}_present = ${W} in input;
24
+ if (${B}.issues.length) {
25
+ payload.issues = payload.issues.concat(${B}.issues.map(iss => ({
26
+ ...iss,
27
+ path: iss.path ? [${W}, ...iss.path] : [${W}]
28
+ })));
29
+ }
30
+ if (!${B}_present && !${B}.issues.length) {
31
+ payload.issues.push({
32
+ code: "invalid_type",
33
+ expected: "nonoptional",
34
+ input: undefined,
35
+ path: [${W}]
36
+ });
37
+ }
38
+
39
+ if (${B}_present) {
40
+ if (${B}.value === undefined) {
41
+ newResult[${W}] = undefined;
42
+ } else {
43
+ newResult[${W}] = ${B}.value;
44
+ }
45
+ }
46
+
47
+ `);else O.write(`
48
+ if (${B}.issues.length) {
49
+ payload.issues = payload.issues.concat(${B}.issues.map(iss => ({
50
+ ...iss,
51
+ path: iss.path ? [${W}, ...iss.path] : [${W}]
52
+ })));
53
+ }
54
+
55
+ if (${B}.value === undefined) {
56
+ if (${W} in input) {
57
+ newResult[${W}] = undefined;
58
+ }
59
+ } else {
60
+ newResult[${W}] = ${B}.value;
61
+ }
62
+
63
+ `)}O.write("payload.value = newResult;"),O.write("return payload;");let Hs=O.compile();return(Q,B)=>Hs(E,Q,B)},g,x=be,z=!$e.jitless,y=z&&dt.value,w=f.catchall,Z;p._zod.parse=(E,O)=>{Z??(Z=h.value);let N=E.value;if(!x(N))return E.issues.push({expected:"object",code:"invalid_type",input:N,inst:p}),E;if(z&&y&&O?.async===!1&&O.jitless!==!0){if(!g)g=_(f.shape);if(E=g(E,O),!w)return E;return un([],N,E,O,Z,p)}return m(E,O)}});function $o(p,f,m,h){for(let g of p)if(g.issues.length===0)return f.value=g.value,f;let _=p.filter((g)=>!xe(g));if(_.length===1)return f.value=_[0].value,_[0];return f.issues.push({code:"invalid_union",input:f.value,inst:m,errors:p.map((g)=>g.issues.map((x)=>H(x,h,S())))}),f}var zr=b("$ZodUnion",(p,f)=>{j.init(p,f),T(p._zod,"optin",()=>f.options.some((h)=>h._zod.optin==="optional")?"optional":void 0),T(p._zod,"optout",()=>f.options.some((h)=>h._zod.optout==="optional")?"optional":void 0),T(p._zod,"values",()=>{if(f.options.every((h)=>h._zod.values))return new Set(f.options.flatMap((h)=>Array.from(h._zod.values)));return}),T(p._zod,"pattern",()=>{if(f.options.every((h)=>h._zod.pattern)){let h=f.options.map((_)=>_._zod.pattern);return new RegExp(`^(${h.map((_)=>Me(_.source)).join("|")})$`)}return});let m=f.options.length===1?f.options[0]._zod.run:null;p._zod.parse=(h,_)=>{if(m)return m(h,_);let g=!1,x=[];for(let z of f.options){let v=z._zod.run({value:h.value,issues:[]},_);if(v instanceof Promise)x.push(v),g=!0;else{if(v.issues.length===0)return v;x.push(v)}}if(!g)return $o(x,h,p,_);return Promise.all(x).then((z)=>$o(z,h,p,_))}});var pn=b("$ZodDiscriminatedUnion",(p,f)=>{f.inclusive=!1,zr.init(p,f);let m=p._zod.parse;T(p._zod,"propValues",()=>{let _={};for(let g of f.options){let x=g._zod.propValues;if(!x||Object.keys(x).length===0)throw Error(`Invalid discriminated union option at index "${f.options.indexOf(g)}"`);for(let[z,v]of Object.entries(x)){if(!_[z])_[z]=new Set;for(let y of v)_[z].add(y)}}return _});let h=Se(()=>{let _=f.options,g=new Map;for(let x of _){let z=x._zod.propValues?.[f.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${f.options.indexOf(x)}"`);for(let v of z){if(g.has(v))throw Error(`Duplicate discriminator value "${String(v)}"`);g.set(v,x)}}return g});p._zod.parse=(_,g)=>{let x=_.value;if(!be(x))return _.issues.push({code:"invalid_type",expected:"object",input:x,inst:p}),_;let z=h.value.get(x?.[f.discriminator]);if(z)return z._zod.run(_,g);if(f.unionFallback||g.direction==="backward")return m(_,g);return _.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:f.discriminator,options:Array.from(h.value.keys()),input:x,path:[f.discriminator],inst:p}),_}}),ln=b("$ZodIntersection",(p,f)=>{j.init(p,f),p._zod.parse=(m,h)=>{let _=m.value,g=f.left._zod.run({value:_,issues:[]},h),x=f.right._zod.run({value:_,issues:[]},h);if(g instanceof Promise||x instanceof Promise)return Promise.all([g,x]).then(([v,y])=>bo(m,v,y));return bo(m,g,x)}});function gr(p,f){if(p===f)return{valid:!0,data:p};if(p instanceof Date&&f instanceof Date&&+p===+f)return{valid:!0,data:p};if(ge(p)&&ge(f)){let m=Object.keys(f),h=Object.keys(p).filter((g)=>m.indexOf(g)!==-1),_={...p,...f};for(let g of h){let x=gr(p[g],f[g]);if(!x.valid)return{valid:!1,mergeErrorPath:[g,...x.mergeErrorPath]};_[g]=x.data}return{valid:!0,data:_}}if(Array.isArray(p)&&Array.isArray(f)){if(p.length!==f.length)return{valid:!1,mergeErrorPath:[]};let m=[];for(let h=0;h<p.length;h++){let _=p[h],g=f[h],x=gr(_,g);if(!x.valid)return{valid:!1,mergeErrorPath:[h,...x.mergeErrorPath]};m.push(x.data)}return{valid:!0,data:m}}return{valid:!1,mergeErrorPath:[]}}function bo(p,f,m){let h=new Map,_;for(let z of f.issues)if(z.code==="unrecognized_keys"){_??(_=z);for(let v of z.keys){if(!h.has(v))h.set(v,{});h.get(v).l=!0}}else p.issues.push(z);for(let z of m.issues)if(z.code==="unrecognized_keys")for(let v of z.keys){if(!h.has(v))h.set(v,{});h.get(v).r=!0}else p.issues.push(z);let g=[...h].filter(([,z])=>z.l&&z.r).map(([z])=>z);if(g.length&&_)p.issues.push({..._,keys:g});if(xe(p))return p;let x=gr(f.value,m.value);if(!x.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(x.mergeErrorPath)}`);return p.value=x.data,p}var fn=b("$ZodRecord",(p,f)=>{j.init(p,f),p._zod.parse=(m,h)=>{let _=m.value;if(!ge(_))return m.issues.push({expected:"record",code:"invalid_type",input:_,inst:p}),m;let g=[],x=f.keyType._zod.values;if(x){m.value={};let z=new Set;for(let y of x)if(typeof y==="string"||typeof y==="number"||typeof y==="symbol"){z.add(typeof y==="number"?y.toString():y);let w=f.keyType._zod.run({value:y,issues:[]},h);if(w instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(w.issues.length){m.issues.push({code:"invalid_key",origin:"record",issues:w.issues.map((O)=>H(O,h,S())),input:y,path:[y],inst:p});continue}let Z=w.value,E=f.valueType._zod.run({value:_[y],issues:[]},h);if(E instanceof Promise)g.push(E.then((O)=>{if(O.issues.length)m.issues.push(...ae(y,O.issues));m.value[Z]=O.value}));else{if(E.issues.length)m.issues.push(...ae(y,E.issues));m.value[Z]=E.value}}let v;for(let y in _)if(!z.has(y))v=v??[],v.push(y);if(v&&v.length>0)m.issues.push({code:"unrecognized_keys",input:_,inst:p,keys:v})}else{m.value={};for(let z of Reflect.ownKeys(_)){if(z==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(_,z))continue;let v=f.keyType._zod.run({value:z,issues:[]},h);if(v instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof z==="string"&&dr.test(z)&&v.issues.length){let Z=f.keyType._zod.run({value:Number(z),issues:[]},h);if(Z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(Z.issues.length===0)v=Z}if(v.issues.length){if(f.mode==="loose")m.value[z]=_[z];else m.issues.push({code:"invalid_key",origin:"record",issues:v.issues.map((Z)=>H(Z,h,S())),input:z,path:[z],inst:p});continue}let w=f.valueType._zod.run({value:_[z],issues:[]},h);if(w instanceof Promise)g.push(w.then((Z)=>{if(Z.issues.length)m.issues.push(...ae(z,Z.issues));m.value[v.value]=Z.value}));else{if(w.issues.length)m.issues.push(...ae(z,w.issues));m.value[v.value]=w.value}}}if(g.length)return Promise.all(g).then(()=>m);return m}});var dn=b("$ZodEnum",(p,f)=>{j.init(p,f);let m=Fe(f.entries),h=new Set(m);p._zod.values=h,p._zod.pattern=new RegExp(`^(${m.filter((_)=>mt.has(typeof _)).map((_)=>typeof _==="string"?ce(_):_.toString()).join("|")})$`),p._zod.parse=(_,g)=>{let x=_.value;if(h.has(x))return _;return _.issues.push({code:"invalid_value",values:m,input:x,inst:p}),_}}),mn=b("$ZodLiteral",(p,f)=>{if(j.init(p,f),f.values.length===0)throw Error("Cannot create literal schema with no valid values");let m=new Set(f.values);p._zod.values=m,p._zod.pattern=new RegExp(`^(${f.values.map((h)=>typeof h==="string"?ce(h):h?ce(h.toString()):String(h)).join("|")})$`),p._zod.parse=(h,_)=>{let g=h.value;if(m.has(g))return h;return h.issues.push({code:"invalid_value",values:f.values,input:g,inst:p}),h}});var hn=b("$ZodTransform",(p,f)=>{j.init(p,f),p._zod.optin="optional",p._zod.parse=(m,h)=>{if(h.direction==="backward")throw new Ze(p.constructor.name);let _=f.transform(m.value,m);if(h.async)return(_ instanceof Promise?_:Promise.resolve(_)).then((x)=>(m.value=x,m.fallback=!0,m));if(_ instanceof Promise)throw new te;return m.value=_,m.fallback=!0,m}});function wo(p,f){if(f===void 0&&(p.issues.length||p.fallback))return{issues:[],value:void 0};return p}var vr=b("$ZodOptional",(p,f)=>{j.init(p,f),p._zod.optin="optional",p._zod.optout="optional",T(p._zod,"values",()=>f.innerType._zod.values?new Set([...f.innerType._zod.values,void 0]):void 0),T(p._zod,"pattern",()=>{let m=f.innerType._zod.pattern;return m?new RegExp(`^(${Me(m.source)})?$`):void 0}),p._zod.parse=(m,h)=>{if(f.innerType._zod.optin==="optional"){let _=m.value,g=f.innerType._zod.run(m,h);if(g instanceof Promise)return g.then((x)=>wo(x,_));return wo(g,_)}if(m.value===void 0)return m;return f.innerType._zod.run(m,h)}}),_n=b("$ZodExactOptional",(p,f)=>{vr.init(p,f),T(p._zod,"values",()=>f.innerType._zod.values),T(p._zod,"pattern",()=>f.innerType._zod.pattern),p._zod.parse=(m,h)=>f.innerType._zod.run(m,h)}),gn=b("$ZodNullable",(p,f)=>{j.init(p,f),T(p._zod,"optin",()=>f.innerType._zod.optin),T(p._zod,"optout",()=>f.innerType._zod.optout),T(p._zod,"pattern",()=>{let m=f.innerType._zod.pattern;return m?new RegExp(`^(${Me(m.source)}|null)$`):void 0}),T(p._zod,"values",()=>f.innerType._zod.values?new Set([...f.innerType._zod.values,null]):void 0),p._zod.parse=(m,h)=>{if(m.value===null)return m;return f.innerType._zod.run(m,h)}}),xn=b("$ZodDefault",(p,f)=>{j.init(p,f),p._zod.optin="optional",T(p._zod,"values",()=>f.innerType._zod.values),p._zod.parse=(m,h)=>{if(h.direction==="backward")return f.innerType._zod.run(m,h);if(m.value===void 0)return m.value=f.defaultValue,m;let _=f.innerType._zod.run(m,h);if(_ instanceof Promise)return _.then((g)=>ko(g,f));return ko(_,f)}});function ko(p,f){if(p.value===void 0)p.value=f.defaultValue;return p}var zn=b("$ZodPrefault",(p,f)=>{j.init(p,f),p._zod.optin="optional",T(p._zod,"values",()=>f.innerType._zod.values),p._zod.parse=(m,h)=>{if(h.direction==="backward")return f.innerType._zod.run(m,h);if(m.value===void 0)m.value=f.defaultValue;return f.innerType._zod.run(m,h)}}),vn=b("$ZodNonOptional",(p,f)=>{j.init(p,f),T(p._zod,"values",()=>{let m=f.innerType._zod.values;return m?new Set([...m].filter((h)=>h!==void 0)):void 0}),p._zod.parse=(m,h)=>{let _=f.innerType._zod.run(m,h);if(_ instanceof Promise)return _.then((g)=>Zo(g,p));return Zo(_,p)}});function Zo(p,f){if(!p.issues.length&&p.value===void 0)p.issues.push({code:"invalid_type",expected:"nonoptional",input:p.value,inst:f});return p}var yn=b("$ZodCatch",(p,f)=>{j.init(p,f),p._zod.optin="optional",T(p._zod,"optout",()=>f.innerType._zod.optout),T(p._zod,"values",()=>f.innerType._zod.values),p._zod.parse=(m,h)=>{if(h.direction==="backward")return f.innerType._zod.run(m,h);let _=f.innerType._zod.run(m,h);if(_ instanceof Promise)return _.then((g)=>{if(m.value=g.value,g.issues.length)m.value=f.catchValue({...m,error:{issues:g.issues.map((x)=>H(x,h,S()))},input:m.value}),m.issues=[],m.fallback=!0;return m});if(m.value=_.value,_.issues.length)m.value=f.catchValue({...m,error:{issues:_.issues.map((g)=>H(g,h,S()))},input:m.value}),m.issues=[],m.fallback=!0;return m}});var yr=b("$ZodPipe",(p,f)=>{j.init(p,f),T(p._zod,"values",()=>f.in._zod.values),T(p._zod,"optin",()=>f.in._zod.optin),T(p._zod,"optout",()=>f.out._zod.optout),T(p._zod,"propValues",()=>f.in._zod.propValues),p._zod.parse=(m,h)=>{if(h.direction==="backward"){let g=f.out._zod.run(m,h);if(g instanceof Promise)return g.then((x)=>Ge(x,f.in,h));return Ge(g,f.in,h)}let _=f.in._zod.run(m,h);if(_ instanceof Promise)return _.then((g)=>Ge(g,f.out,h));return Ge(_,f.out,h)}});function Ge(p,f,m){if(p.issues.length)return p.aborted=!0,p;return f._zod.run({value:p.value,issues:p.issues,fallback:p.fallback},m)}var $n=b("$ZodPreprocess",(p,f)=>{yr.init(p,f)}),bn=b("$ZodReadonly",(p,f)=>{j.init(p,f),T(p._zod,"propValues",()=>f.innerType._zod.propValues),T(p._zod,"values",()=>f.innerType._zod.values),T(p._zod,"optin",()=>f.innerType?._zod?.optin),T(p._zod,"optout",()=>f.innerType?._zod?.optout),p._zod.parse=(m,h)=>{if(h.direction==="backward")return f.innerType._zod.run(m,h);let _=f.innerType._zod.run(m,h);if(_ instanceof Promise)return _.then(Po);return Po(_)}});function Po(p){return p.value=Object.freeze(p.value),p}var wn=b("$ZodLazy",(p,f)=>{j.init(p,f),T(p._zod,"innerType",()=>{let m=f;if(!m._cachedInner)m._cachedInner=f.getter();return m._cachedInner}),T(p._zod,"pattern",()=>p._zod.innerType?._zod?.pattern),T(p._zod,"propValues",()=>p._zod.innerType?._zod?.propValues),T(p._zod,"optin",()=>p._zod.innerType?._zod?.optin??void 0),T(p._zod,"optout",()=>p._zod.innerType?._zod?.optout??void 0),p._zod.parse=(m,h)=>p._zod.innerType._zod.run(m,h)}),kn=b("$ZodCustom",(p,f)=>{K.init(p,f),j.init(p,f),p._zod.parse=(m,h)=>m,p._zod.check=(m)=>{let h=m.value,_=f.fn(h);if(_ instanceof Promise)return _.then((g)=>So(g,m,h,p));So(_,m,h,p);return}});function So(p,f,m,h){if(!p){let _={code:"custom",input:m,inst:h,path:[...h._zod.def.path??[]],continue:!h._zod.def.abort};if(h._zod.def.params)_.params=h._zod.def.params;f.issues.push(ze(_))}}var Zn,Uc=Symbol("ZodOutput"),Mc=Symbol("ZodInput");class Pn{constructor(){this._map=new WeakMap,this._idmap=new Map}add(p,...f){let m=f[0];if(this._map.set(p,m),m&&typeof m==="object"&&"id"in m)this._idmap.set(m.id,p);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(p){let f=this._map.get(p);if(f&&typeof f==="object"&&"id"in f)this._idmap.delete(f.id);return this._map.delete(p),this}get(p){let f=p._zod.parent;if(f){let m={...this.get(f)??{}};delete m.id;let h={...m,...this._map.get(p)};return Object.keys(h).length?h:void 0}return this._map.get(p)}has(p){return this._map.has(p)}}function di(){return new Pn}(Zn=globalThis).__zod_globalRegistry??(Zn.__zod_globalRegistry=di());var ve=globalThis.__zod_globalRegistry;function Sn(p,f){return new p({type:"string",...k(f)})}function $r(p,f){return new p({type:"string",format:"email",check:"string_format",abort:!1,...k(f)})}function br(p,f){return new p({type:"string",format:"guid",check:"string_format",abort:!1,...k(f)})}function On(p,f){return new p({type:"string",format:"uuid",check:"string_format",abort:!1,...k(f)})}function En(p,f){return new p({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...k(f)})}function In(p,f){return new p({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...k(f)})}function Tn(p,f){return new p({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...k(f)})}function wr(p,f){return new p({type:"string",format:"url",check:"string_format",abort:!1,...k(f)})}function Nn(p,f){return new p({type:"string",format:"emoji",check:"string_format",abort:!1,...k(f)})}function An(p,f){return new p({type:"string",format:"nanoid",check:"string_format",abort:!1,...k(f)})}function jn(p,f){return new p({type:"string",format:"cuid",check:"string_format",abort:!1,...k(f)})}function Cn(p,f){return new p({type:"string",format:"cuid2",check:"string_format",abort:!1,...k(f)})}function Rn(p,f){return new p({type:"string",format:"ulid",check:"string_format",abort:!1,...k(f)})}function Dn(p,f){return new p({type:"string",format:"xid",check:"string_format",abort:!1,...k(f)})}function Ln(p,f){return new p({type:"string",format:"ksuid",check:"string_format",abort:!1,...k(f)})}function Fn(p,f){return new p({type:"string",format:"ipv4",check:"string_format",abort:!1,...k(f)})}function Un(p,f){return new p({type:"string",format:"ipv6",check:"string_format",abort:!1,...k(f)})}function Mn(p,f){return new p({type:"string",format:"cidrv4",check:"string_format",abort:!1,...k(f)})}function Jn(p,f){return new p({type:"string",format:"cidrv6",check:"string_format",abort:!1,...k(f)})}function Bn(p,f){return new p({type:"string",format:"base64",check:"string_format",abort:!1,...k(f)})}function Vn(p,f){return new p({type:"string",format:"base64url",check:"string_format",abort:!1,...k(f)})}function Wn(p,f){return new p({type:"string",format:"e164",check:"string_format",abort:!1,...k(f)})}function Kn(p,f){return new p({type:"string",format:"jwt",check:"string_format",abort:!1,...k(f)})}function Gn(p,f){return new p({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...k(f)})}function qn(p,f){return new p({type:"string",format:"date",check:"string_format",...k(f)})}function Yn(p,f){return new p({type:"string",format:"time",check:"string_format",precision:null,...k(f)})}function Xn(p,f){return new p({type:"string",format:"duration",check:"string_format",...k(f)})}function Hn(p,f){return new p({type:"number",checks:[],...k(f)})}function de(p,f){return new p({type:"number",coerce:!0,checks:[],...k(f)})}function Qn(p,f){return new p({type:"number",check:"number_format",abort:!1,format:"safeint",...k(f)})}function es(p,f){return new p({type:"boolean",...k(f)})}function rs(p,f){return new p({type:"null",...k(f)})}function ts(p){return new p({type:"any"})}function os(p){return new p({type:"unknown"})}function ns(p,f){return new p({type:"never",...k(f)})}function Xe(p,f){return new mr({check:"less_than",...k(f),value:p,inclusive:!1})}function Te(p,f){return new mr({check:"less_than",...k(f),value:p,inclusive:!0})}function He(p,f){return new hr({check:"greater_than",...k(f),value:p,inclusive:!1})}function Ne(p,f){return new hr({check:"greater_than",...k(f),value:p,inclusive:!0})}function Qe(p,f){return new io({check:"multiple_of",...k(f),value:p})}function er(p,f){return new uo({check:"max_length",...k(f),maximum:p})}function we(p,f){return new ao({check:"min_length",...k(f),minimum:p})}function rr(p,f){return new po({check:"length_equals",...k(f),length:p})}function kr(p,f){return new lo({check:"string_format",format:"regex",...k(f),pattern:p})}function Zr(p){return new fo({check:"string_format",format:"lowercase",...k(p)})}function Pr(p){return new mo({check:"string_format",format:"uppercase",...k(p)})}function Sr(p,f){return new ho({check:"string_format",format:"includes",...k(f),includes:p})}function Or(p,f){return new _o({check:"string_format",format:"starts_with",...k(f),prefix:p})}function Er(p,f){return new go({check:"string_format",format:"ends_with",...k(f),suffix:p})}function he(p){return new xo({check:"overwrite",tx:p})}function Ir(p){return he((f)=>f.normalize(p))}function Tr(){return he((p)=>p.trim())}function Nr(){return he((p)=>p.toLowerCase())}function Ar(){return he((p)=>p.toUpperCase())}function jr(){return he((p)=>ft(p))}function ss(p,f,m){return new p({type:"array",element:f,...k(m)})}function is(p,f,m){return new p({type:"custom",check:"custom",fn:f,...k(m)})}function cs(p,f){let m=mi((h)=>(h.addIssue=(_)=>{if(typeof _==="string")h.issues.push(ze(_,h.value,m._zod.def));else{let g=_;if(g.fatal)g.continue=!1;g.code??(g.code="custom"),g.input??(g.input=h.value),g.inst??(g.inst=m),g.continue??(g.continue=!m._zod.def.abort),h.issues.push(ze(g))}},p(h.value,h)),f);return m}function mi(p,f){let m=new K({check:"custom",...k(f)});return m._zod.check=p,m}function je(p){let f=p?.target??"draft-2020-12";if(f==="draft-4")f="draft-04";if(f==="draft-7")f="draft-07";return{processors:p.processors??{},metadataRegistry:p?.metadata??ve,target:f,unrepresentable:p?.unrepresentable??"throw",override:p?.override??(()=>{}),io:p?.io??"output",counter:0,seen:new Map,cycles:p?.cycles??"ref",reused:p?.reused??"inline",external:p?.external??void 0}}function L(p,f,m={path:[],schemaPath:[]}){var h;let _=p._zod.def,g=f.seen.get(p);if(g){if(g.count++,m.schemaPath.includes(p))g.cycle=m.path;return g.schema}let x={schema:{},count:1,cycle:void 0,path:m.path};f.seen.set(p,x);let z=p._zod.toJSONSchema?.();if(z)x.schema=z;else{let w={...m,schemaPath:[...m.schemaPath,p],path:m.path};if(p._zod.processJSONSchema)p._zod.processJSONSchema(f,x.schema,w);else{let E=x.schema,O=f.processors[_.type];if(!O)throw Error(`[toJSONSchema]: Non-representable type encountered: ${_.type}`);O(p,f,E,w)}let Z=p._zod.parent;if(Z){if(!x.ref)x.ref=Z;L(Z,f,w),f.seen.get(Z).isParent=!0}}let v=f.metadataRegistry.get(p);if(v)Object.assign(x.schema,v);if(f.io==="input"&&G(p))delete x.schema.examples,delete x.schema.default;if(f.io==="input"&&"_prefault"in x.schema)(h=x.schema).default??(h.default=x.schema._prefault);return delete x.schema._prefault,f.seen.get(p).schema}function Ce(p,f){let m=p.seen.get(f);if(!m)throw Error("Unprocessed schema. This is a bug in Zod.");let h=new Map;for(let x of p.seen.entries()){let z=p.metadataRegistry.get(x[0])?.id;if(z){let v=h.get(z);if(v&&v!==x[0])throw Error(`Duplicate schema id "${z}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);h.set(z,x[0])}}let _=(x)=>{let z=p.target==="draft-2020-12"?"$defs":"definitions";if(p.external){let Z=p.external.registry.get(x[0])?.id,E=p.external.uri??((N)=>N);if(Z)return{ref:E(Z)};let O=x[1].defId??x[1].schema.id??`schema${p.counter++}`;return x[1].defId=O,{defId:O,ref:`${E("__shared")}#/${z}/${O}`}}if(x[1]===m)return{ref:"#"};let y=`${"#"}/${z}/`,w=x[1].schema.id??`__schema${p.counter++}`;return{defId:w,ref:y+w}},g=(x)=>{if(x[1].schema.$ref)return;let z=x[1],{ref:v,defId:y}=_(x);if(z.def={...z.schema},y)z.defId=y;let w=z.schema;for(let Z in w)delete w[Z];w.$ref=v};if(p.cycles==="throw")for(let x of p.seen.entries()){let z=x[1];if(z.cycle)throw Error(`Cycle detected: #/${z.cycle?.join("/")}/<root>
64
+
65
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let x of p.seen.entries()){let z=x[1];if(f===x[0]){g(x);continue}if(p.external){let y=p.external.registry.get(x[0])?.id;if(f!==x[0]&&y){g(x);continue}}if(p.metadataRegistry.get(x[0])?.id){g(x);continue}if(z.cycle){g(x);continue}if(z.count>1){if(p.reused==="ref"){g(x);continue}}}}function Re(p,f){let m=p.seen.get(f);if(!m)throw Error("Unprocessed schema. This is a bug in Zod.");let h=(z)=>{let v=p.seen.get(z);if(v.ref===null)return;let y=v.def??v.schema,w={...y},Z=v.ref;if(v.ref=null,Z){h(Z);let O=p.seen.get(Z),N=O.schema;if(N.$ref&&(p.target==="draft-07"||p.target==="draft-04"||p.target==="openapi-3.0"))y.allOf=y.allOf??[],y.allOf.push(N);else Object.assign(y,N);if(Object.assign(y,w),z._zod.parent===Z)for(let V in y){if(V==="$ref"||V==="allOf")continue;if(!(V in w))delete y[V]}if(N.$ref&&O.def)for(let V in y){if(V==="$ref"||V==="allOf")continue;if(V in O.def&&JSON.stringify(y[V])===JSON.stringify(O.def[V]))delete y[V]}}let E=z._zod.parent;if(E&&E!==Z){h(E);let O=p.seen.get(E);if(O?.schema.$ref){if(y.$ref=O.schema.$ref,O.def)for(let N in y){if(N==="$ref"||N==="allOf")continue;if(N in O.def&&JSON.stringify(y[N])===JSON.stringify(O.def[N]))delete y[N]}}}p.override({zodSchema:z,jsonSchema:y,path:v.path??[]})};for(let z of[...p.seen.entries()].reverse())h(z[0]);let _={};if(p.target==="draft-2020-12")_.$schema="https://json-schema.org/draft/2020-12/schema";else if(p.target==="draft-07")_.$schema="http://json-schema.org/draft-07/schema#";else if(p.target==="draft-04")_.$schema="http://json-schema.org/draft-04/schema#";else if(p.target==="openapi-3.0");if(p.external?.uri){let z=p.external.registry.get(f)?.id;if(!z)throw Error("Schema is missing an `id` property");_.$id=p.external.uri(z)}Object.assign(_,m.def??m.schema);let g=p.metadataRegistry.get(f)?.id;if(g!==void 0&&_.id===g)delete _.id;let x=p.external?.defs??{};for(let z of p.seen.entries()){let v=z[1];if(v.def&&v.defId){if(v.def.id===v.defId)delete v.def.id;x[v.defId]=v.def}}if(p.external);else if(Object.keys(x).length>0)if(p.target==="draft-2020-12")_.$defs=x;else _.definitions=x;try{let z=JSON.parse(JSON.stringify(_));return Object.defineProperty(z,"~standard",{value:{...f["~standard"],jsonSchema:{input:Ae(f,"input",p.processors),output:Ae(f,"output",p.processors)}},enumerable:!1,writable:!1}),z}catch(z){throw Error("Error converting schema to JSON.")}}function G(p,f){let m=f??{seen:new Set};if(m.seen.has(p))return!1;m.seen.add(p);let h=p._zod.def;if(h.type==="transform")return!0;if(h.type==="array")return G(h.element,m);if(h.type==="set")return G(h.valueType,m);if(h.type==="lazy")return G(h.getter(),m);if(h.type==="promise"||h.type==="optional"||h.type==="nonoptional"||h.type==="nullable"||h.type==="readonly"||h.type==="default"||h.type==="prefault")return G(h.innerType,m);if(h.type==="intersection")return G(h.left,m)||G(h.right,m);if(h.type==="record"||h.type==="map")return G(h.keyType,m)||G(h.valueType,m);if(h.type==="pipe"){if(p._zod.traits.has("$ZodCodec"))return!0;return G(h.in,m)||G(h.out,m)}if(h.type==="object"){for(let _ in h.shape)if(G(h.shape[_],m))return!0;return!1}if(h.type==="union"){for(let _ of h.options)if(G(_,m))return!0;return!1}if(h.type==="tuple"){for(let _ of h.items)if(G(_,m))return!0;if(h.rest&&G(h.rest,m))return!0;return!1}return!1}var us=(p,f={})=>(m)=>{let h=je({...m,processors:f});return L(p,h),Ce(h,p),Re(h,p)},Ae=(p,f,m={})=>(h)=>{let{libraryOptions:_,target:g}=h??{},x=je({..._??{},target:g,io:f,processors:m});return L(p,x),Ce(x,p),Re(x,p)};var hi={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Cr=(p,f,m,h)=>{let _=m;_.type="string";let{minimum:g,maximum:x,format:z,patterns:v,contentEncoding:y}=p._zod.bag;if(typeof g==="number")_.minLength=g;if(typeof x==="number")_.maxLength=x;if(z){if(_.format=hi[z]??z,_.format==="")delete _.format;if(z==="time")delete _.format}if(y)_.contentEncoding=y;if(v&&v.size>0){let w=[...v];if(w.length===1)_.pattern=w[0].source;else if(w.length>1)_.allOf=[...w.map((Z)=>({...f.target==="draft-07"||f.target==="draft-04"||f.target==="openapi-3.0"?{type:"string"}:{},pattern:Z.source}))]}},Rr=(p,f,m,h)=>{let _=m,{minimum:g,maximum:x,format:z,multipleOf:v,exclusiveMaximum:y,exclusiveMinimum:w}=p._zod.bag;if(typeof z==="string"&&z.includes("int"))_.type="integer";else _.type="number";let Z=typeof w==="number"&&w>=(g??Number.NEGATIVE_INFINITY),E=typeof y==="number"&&y<=(x??Number.POSITIVE_INFINITY),O=f.target==="draft-04"||f.target==="openapi-3.0";if(Z)if(O)_.minimum=w,_.exclusiveMinimum=!0;else _.exclusiveMinimum=w;else if(typeof g==="number")_.minimum=g;if(E)if(O)_.maximum=y,_.exclusiveMaximum=!0;else _.exclusiveMaximum=y;else if(typeof x==="number")_.maximum=x;if(typeof v==="number")_.multipleOf=v},Dr=(p,f,m,h)=>{m.type="boolean"},ps=(p,f,m,h)=>{if(f.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},ls=(p,f,m,h)=>{if(f.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Lr=(p,f,m,h)=>{if(f.target==="openapi-3.0")m.type="string",m.nullable=!0,m.enum=[null];else m.type="null"},fs=(p,f,m,h)=>{if(f.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},ds=(p,f,m,h)=>{if(f.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Fr=(p,f,m,h)=>{m.not={}},Ur=(p,f,m,h)=>{},Mr=(p,f,m,h)=>{},ms=(p,f,m,h)=>{if(f.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Jr=(p,f,m,h)=>{let _=p._zod.def,g=Fe(_.entries);if(g.every((x)=>typeof x==="number"))m.type="number";if(g.every((x)=>typeof x==="string"))m.type="string";m.enum=g},Br=(p,f,m,h)=>{let _=p._zod.def,g=[];for(let x of _.values)if(x===void 0){if(f.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof x==="bigint")if(f.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else g.push(Number(x));else g.push(x);if(g.length===0);else if(g.length===1){let x=g[0];if(m.type=x===null?"null":typeof x,f.target==="draft-04"||f.target==="openapi-3.0")m.enum=[x];else m.const=x}else{if(g.every((x)=>typeof x==="number"))m.type="number";if(g.every((x)=>typeof x==="string"))m.type="string";if(g.every((x)=>typeof x==="boolean"))m.type="boolean";if(g.every((x)=>x===null))m.type="null";m.enum=g}},hs=(p,f,m,h)=>{if(f.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},_s=(p,f,m,h)=>{let _=m,g=p._zod.pattern;if(!g)throw Error("Pattern not found in template literal");_.type="string",_.pattern=g.source},gs=(p,f,m,h)=>{let _=m,g={type:"string",format:"binary",contentEncoding:"binary"},{minimum:x,maximum:z,mime:v}=p._zod.bag;if(x!==void 0)g.minLength=x;if(z!==void 0)g.maxLength=z;if(v)if(v.length===1)g.contentMediaType=v[0],Object.assign(_,g);else Object.assign(_,g),_.anyOf=v.map((y)=>({contentMediaType:y}));else Object.assign(_,g)},xs=(p,f,m,h)=>{m.type="boolean"},Vr=(p,f,m,h)=>{if(f.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},zs=(p,f,m,h)=>{if(f.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Wr=(p,f,m,h)=>{if(f.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},vs=(p,f,m,h)=>{if(f.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},ys=(p,f,m,h)=>{if(f.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Kr=(p,f,m,h)=>{let _=m,g=p._zod.def,{minimum:x,maximum:z}=p._zod.bag;if(typeof x==="number")_.minItems=x;if(typeof z==="number")_.maxItems=z;_.type="array",_.items=L(g.element,f,{...h,path:[...h.path,"items"]})},Gr=(p,f,m,h)=>{let _=m,g=p._zod.def;_.type="object",_.properties={};let x=g.shape;for(let y in x)_.properties[y]=L(x[y],f,{...h,path:[...h.path,"properties",y]});let z=new Set(Object.keys(x)),v=new Set([...z].filter((y)=>{let w=g.shape[y]._zod;if(f.io==="input")return w.optin===void 0;else return w.optout===void 0}));if(v.size>0)_.required=Array.from(v);if(g.catchall?._zod.def.type==="never")_.additionalProperties=!1;else if(!g.catchall){if(f.io==="output")_.additionalProperties=!1}else if(g.catchall)_.additionalProperties=L(g.catchall,f,{...h,path:[...h.path,"additionalProperties"]})},qr=(p,f,m,h)=>{let _=p._zod.def,g=_.inclusive===!1,x=_.options.map((z,v)=>L(z,f,{...h,path:[...h.path,g?"oneOf":"anyOf",v]}));if(g)m.oneOf=x;else m.anyOf=x},Yr=(p,f,m,h)=>{let _=p._zod.def,g=L(_.left,f,{...h,path:[...h.path,"allOf",0]}),x=L(_.right,f,{...h,path:[...h.path,"allOf",1]}),z=(y)=>("allOf"in y)&&Object.keys(y).length===1,v=[...z(g)?g.allOf:[g],...z(x)?x.allOf:[x]];m.allOf=v},$s=(p,f,m,h)=>{let _=m,g=p._zod.def;_.type="array";let x=f.target==="draft-2020-12"?"prefixItems":"items",z=f.target==="draft-2020-12"?"items":f.target==="openapi-3.0"?"items":"additionalItems",v=g.items.map((E,O)=>L(E,f,{...h,path:[...h.path,x,O]})),y=g.rest?L(g.rest,f,{...h,path:[...h.path,z,...f.target==="openapi-3.0"?[g.items.length]:[]]}):null;if(f.target==="draft-2020-12"){if(_.prefixItems=v,y)_.items=y}else if(f.target==="openapi-3.0"){if(_.items={anyOf:v},y)_.items.anyOf.push(y);if(_.minItems=v.length,!y)_.maxItems=v.length}else if(_.items=v,y)_.additionalItems=y;let{minimum:w,maximum:Z}=p._zod.bag;if(typeof w==="number")_.minItems=w;if(typeof Z==="number")_.maxItems=Z},Xr=(p,f,m,h)=>{let _=m,g=p._zod.def;_.type="object";let x=g.keyType,v=x._zod.bag?.patterns;if(g.mode==="loose"&&v&&v.size>0){let w=L(g.valueType,f,{...h,path:[...h.path,"patternProperties","*"]});_.patternProperties={};for(let Z of v)_.patternProperties[Z.source]=w}else{if(f.target==="draft-07"||f.target==="draft-2020-12")_.propertyNames=L(g.keyType,f,{...h,path:[...h.path,"propertyNames"]});_.additionalProperties=L(g.valueType,f,{...h,path:[...h.path,"additionalProperties"]})}let y=x._zod.values;if(y){let w=[...y].filter((Z)=>typeof Z==="string"||typeof Z==="number");if(w.length>0)_.required=w}},Hr=(p,f,m,h)=>{let _=p._zod.def,g=L(_.innerType,f,h),x=f.seen.get(p);if(f.target==="openapi-3.0")x.ref=_.innerType,m.nullable=!0;else m.anyOf=[g,{type:"null"}]},Qr=(p,f,m,h)=>{let _=p._zod.def;L(_.innerType,f,h);let g=f.seen.get(p);g.ref=_.innerType},et=(p,f,m,h)=>{let _=p._zod.def;L(_.innerType,f,h);let g=f.seen.get(p);g.ref=_.innerType,m.default=JSON.parse(JSON.stringify(_.defaultValue))},rt=(p,f,m,h)=>{let _=p._zod.def;L(_.innerType,f,h);let g=f.seen.get(p);if(g.ref=_.innerType,f.io==="input")m._prefault=JSON.parse(JSON.stringify(_.defaultValue))},tt=(p,f,m,h)=>{let _=p._zod.def;L(_.innerType,f,h);let g=f.seen.get(p);g.ref=_.innerType;let x;try{x=_.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}m.default=x},ot=(p,f,m,h)=>{let _=p._zod.def,g=_.in._zod.traits.has("$ZodTransform"),x=f.io==="input"?g?_.out:_.in:_.out;L(x,f,h);let z=f.seen.get(p);z.ref=x},nt=(p,f,m,h)=>{let _=p._zod.def;L(_.innerType,f,h);let g=f.seen.get(p);g.ref=_.innerType,m.readOnly=!0},bs=(p,f,m,h)=>{let _=p._zod.def;L(_.innerType,f,h);let g=f.seen.get(p);g.ref=_.innerType},tr=(p,f,m,h)=>{let _=p._zod.def;L(_.innerType,f,h);let g=f.seen.get(p);g.ref=_.innerType},st=(p,f,m,h)=>{let _=p._zod.innerType;L(_,f,h);let g=f.seen.get(p);g.ref=_},as={string:Cr,number:Rr,boolean:Dr,bigint:ps,symbol:ls,null:Lr,undefined:fs,void:ds,never:Fr,any:Ur,unknown:Mr,date:ms,enum:Jr,literal:Br,nan:hs,template_literal:_s,file:gs,success:xs,custom:Vr,function:zs,transform:Wr,map:vs,set:ys,array:Kr,object:Gr,union:qr,intersection:Yr,tuple:$s,record:Xr,nullable:Hr,nonoptional:Qr,default:et,prefault:rt,catch:tt,pipe:ot,readonly:nt,promise:bs,optional:tr,lazy:st};function oe(p,f){if("_idmap"in p){let h=p,_=je({...f,processors:as}),g={};for(let v of h._idmap.entries()){let[y,w]=v;L(w,_)}let x={},z={registry:h,uri:f?.uri,defs:g};_.external=z;for(let v of h._idmap.entries()){let[y,w]=v;Ce(_,w),x[y]=Re(_,w)}if(Object.keys(g).length>0){let v=_.target==="draft-2020-12"?"$defs":"definitions";x.__shared={[v]:g}}return{schemas:x}}let m=je({...f,processors:as});return L(p,m),Ce(m,p),Re(m,p)}var $i=b("ZodISODateTime",(p,f)=>{Fo.init(p,f),M.init(p,f)});function A(p){return Gn($i,p)}var bi=b("ZodISODate",(p,f)=>{Uo.init(p,f),M.init(p,f)});function se(p){return qn(bi,p)}var wi=b("ZodISOTime",(p,f)=>{Mo.init(p,f),M.init(p,f)});function ws(p){return Yn(wi,p)}var ki=b("ZodISODuration",(p,f)=>{Jo.init(p,f),M.init(p,f)});function ks(p){return Xn(ki,p)}var Si=(p,f)=>{Be.init(p,f),p.name="ZodError",Object.defineProperties(p,{format:{value:(m)=>vt(p,m)},flatten:{value:(m)=>zt(p,m)},addIssue:{value:(m)=>{p.issues.push(m),p.message=JSON.stringify(p.issues,Pe,2)}},addIssues:{value:(m)=>{p.issues.push(...m),p.message=JSON.stringify(p.issues,Pe,2)}},isEmpty:{get(){return p.issues.length===0}}})};var q=b("ZodError",Si,{Parent:Error});var Zs=Ve(q),Ps=We(q),J=Oe(q),Ss=Ee(q),Os=bt(q),Es=wt(q),Is=kt(q),Ts=Zt(q),Ns=Pt(q),As=St(q),js=Ot(q),Cs=Et(q);var Rs=new WeakMap;function De(p,f,m){let h=Object.getPrototypeOf(p),_=Rs.get(h);if(!_)_=new Set,Rs.set(h,_);if(_.has(f))return;_.add(f);for(let g in m){let x=m[g];Object.defineProperty(h,g,{configurable:!0,enumerable:!1,get(){let z=x.bind(this);return Object.defineProperty(this,g,{configurable:!0,writable:!0,enumerable:!0,value:z}),z},set(z){Object.defineProperty(this,g,{configurable:!0,writable:!0,enumerable:!0,value:z})}})}}var F=b("ZodType",(p,f)=>(j.init(p,f),Object.assign(p["~standard"],{jsonSchema:{input:Ae(p,"input"),output:Ae(p,"output")}}),p.toJSONSchema=us(p,{}),p.def=f,p.type=f.type,Object.defineProperty(p,"_def",{value:f}),p.parse=(m,h)=>Zs(p,m,h,{callee:p.parse}),p.safeParse=(m,h)=>J(p,m,h),p.parseAsync=async(m,h)=>Ps(p,m,h,{callee:p.parseAsync}),p.safeParseAsync=async(m,h)=>Ss(p,m,h),p.spa=p.safeParseAsync,p.encode=(m,h)=>Os(p,m,h),p.decode=(m,h)=>Es(p,m,h),p.encodeAsync=async(m,h)=>Is(p,m,h),p.decodeAsync=async(m,h)=>Ts(p,m,h),p.safeEncode=(m,h)=>Ns(p,m,h),p.safeDecode=(m,h)=>As(p,m,h),p.safeEncodeAsync=async(m,h)=>js(p,m,h),p.safeDecodeAsync=async(m,h)=>Cs(p,m,h),De(p,"ZodType",{check(...m){let h=this.def;return this.clone(ie(h,{checks:[...h.checks??[],...m.map((_)=>typeof _==="function"?{_zod:{check:_,def:{check:"custom"},onattach:[]}}:_)]}),{parent:!0})},with(...m){return this.check(...m)},clone(m,h){return ee(this,m,h)},brand(){return this},register(m,h){return m.add(this,h),this},refine(m,h){return this.check(zc(m,h))},superRefine(m,h){return this.check(vc(m,h))},overwrite(m){return this.check(he(m))},optional(){return l(this)},exactOptional(){return sc(this)},nullable(){return Us(this)},nullish(){return l(Us(this))},nonoptional(m){return lc(this,m)},array(){return n(this)},or(m){return a([this,m])},and(m){return C(this,m)},transform(m){return Ms(this,Gs(m))},default(m){return uc(this,m)},prefault(m){return pc(this,m)},catch(m){return dc(this,m)},pipe(m){return Ms(this,m)},readonly(){return _c(this)},describe(m){let h=this.clone();return ve.add(h,{description:m}),h},meta(...m){if(m.length===0)return ve.get(this);let h=this.clone();return ve.add(h,m[0]),h},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(m){return m(this)}}),Object.defineProperty(p,"description",{get(){return ve.get(p)?.description},configurable:!0}),p)),Js=b("_ZodString",(p,f)=>{Ye.init(p,f),F.init(p,f),p._zod.processJSONSchema=(h,_,g)=>Cr(p,h,_,g);let m=p._zod.bag;p.format=m.format??null,p.minLength=m.minimum??null,p.maxLength=m.maximum??null,De(p,"_ZodString",{regex(...h){return this.check(kr(...h))},includes(...h){return this.check(Sr(...h))},startsWith(...h){return this.check(Or(...h))},endsWith(...h){return this.check(Er(...h))},min(...h){return this.check(we(...h))},max(...h){return this.check(er(...h))},length(...h){return this.check(rr(...h))},nonempty(...h){return this.check(we(1,...h))},lowercase(h){return this.check(Zr(h))},uppercase(h){return this.check(Pr(h))},trim(){return this.check(Tr())},normalize(...h){return this.check(Ir(...h))},toLowerCase(){return this.check(Nr())},toUpperCase(){return this.check(Ar())},slugify(){return this.check(jr())}})}),Ei=b("ZodString",(p,f)=>{Ye.init(p,f),Js.init(p,f),p.email=(m)=>p.check($r(Bs,m)),p.url=(m)=>p.check(wr(Vs,m)),p.jwt=(m)=>p.check(Kn(Vi,m)),p.emoji=(m)=>p.check(Nn(Ii,m)),p.guid=(m)=>p.check(br(Ds,m)),p.uuid=(m)=>p.check(On(nr,m)),p.uuidv4=(m)=>p.check(En(nr,m)),p.uuidv6=(m)=>p.check(In(nr,m)),p.uuidv7=(m)=>p.check(Tn(nr,m)),p.nanoid=(m)=>p.check(An(Ti,m)),p.guid=(m)=>p.check(br(Ds,m)),p.cuid=(m)=>p.check(jn(Ni,m)),p.cuid2=(m)=>p.check(Cn(Ai,m)),p.ulid=(m)=>p.check(Rn(ji,m)),p.base64=(m)=>p.check(Bn(Mi,m)),p.base64url=(m)=>p.check(Vn(Ji,m)),p.xid=(m)=>p.check(Dn(Ci,m)),p.ksuid=(m)=>p.check(Ln(Ri,m)),p.ipv4=(m)=>p.check(Fn(Di,m)),p.ipv6=(m)=>p.check(Un(Li,m)),p.cidrv4=(m)=>p.check(Mn(Fi,m)),p.cidrv6=(m)=>p.check(Jn(Ui,m)),p.e164=(m)=>p.check(Wn(Bi,m)),p.datetime=(m)=>p.check(A(m)),p.date=(m)=>p.check(se(m)),p.time=(m)=>p.check(ws(m)),p.duration=(m)=>p.check(ks(m))});function e(p){return Sn(Ei,p)}var M=b("ZodStringFormat",(p,f)=>{U.init(p,f),Js.init(p,f)}),Bs=b("ZodEmail",(p,f)=>{Io.init(p,f),M.init(p,f)});function pe(p){return $r(Bs,p)}var Ds=b("ZodGUID",(p,f)=>{Oo.init(p,f),M.init(p,f)});var nr=b("ZodUUID",(p,f)=>{Eo.init(p,f),M.init(p,f)});var Vs=b("ZodURL",(p,f)=>{To.init(p,f),M.init(p,f)});function Y(p){return wr(Vs,p)}var Ii=b("ZodEmoji",(p,f)=>{No.init(p,f),M.init(p,f)});var Ti=b("ZodNanoID",(p,f)=>{Ao.init(p,f),M.init(p,f)});var Ni=b("ZodCUID",(p,f)=>{jo.init(p,f),M.init(p,f)});var Ai=b("ZodCUID2",(p,f)=>{Co.init(p,f),M.init(p,f)});var ji=b("ZodULID",(p,f)=>{Ro.init(p,f),M.init(p,f)});var Ci=b("ZodXID",(p,f)=>{Do.init(p,f),M.init(p,f)});var Ri=b("ZodKSUID",(p,f)=>{Lo.init(p,f),M.init(p,f)});var Di=b("ZodIPv4",(p,f)=>{Bo.init(p,f),M.init(p,f)});var Li=b("ZodIPv6",(p,f)=>{Vo.init(p,f),M.init(p,f)});var Fi=b("ZodCIDRv4",(p,f)=>{Wo.init(p,f),M.init(p,f)});var Ui=b("ZodCIDRv6",(p,f)=>{Ko.init(p,f),M.init(p,f)});var Mi=b("ZodBase64",(p,f)=>{qo.init(p,f),M.init(p,f)});var Ji=b("ZodBase64URL",(p,f)=>{Yo.init(p,f),M.init(p,f)});var Bi=b("ZodE164",(p,f)=>{Xo.init(p,f),M.init(p,f)});var Vi=b("ZodJWT",(p,f)=>{Ho.init(p,f),M.init(p,f)});var X=b("ZodNumber",(p,f)=>{xr.init(p,f),F.init(p,f),p._zod.processJSONSchema=(h,_,g)=>Rr(p,h,_,g),De(p,"ZodNumber",{gt(h,_){return this.check(He(h,_))},gte(h,_){return this.check(Ne(h,_))},min(h,_){return this.check(Ne(h,_))},lt(h,_){return this.check(Xe(h,_))},lte(h,_){return this.check(Te(h,_))},max(h,_){return this.check(Te(h,_))},int(h){return this.check(Ls(h))},safe(h){return this.check(Ls(h))},positive(h){return this.check(He(0,h))},nonnegative(h){return this.check(Ne(0,h))},negative(h){return this.check(Xe(0,h))},nonpositive(h){return this.check(Te(0,h))},multipleOf(h,_){return this.check(Qe(h,_))},step(h,_){return this.check(Qe(h,_))},finite(){return this}});let m=p._zod.bag;p.minValue=Math.max(m.minimum??Number.NEGATIVE_INFINITY,m.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,p.maxValue=Math.min(m.maximum??Number.POSITIVE_INFINITY,m.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,p.isInt=(m.format??"").includes("int")||Number.isSafeInteger(m.multipleOf??0.5),p.isFinite=!0,p.format=m.format??null});function o(p){return Hn(X,p)}var Wi=b("ZodNumberFormat",(p,f)=>{Qo.init(p,f),X.init(p,f)});function Ls(p){return Qn(Wi,p)}var Ki=b("ZodBoolean",(p,f)=>{en.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Dr(p,m,h,_)});function i(p){return es(Ki,p)}var Gi=b("ZodNull",(p,f)=>{rn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Lr(p,m,h,_)});function P(p){return rs(Gi,p)}var qi=b("ZodAny",(p,f)=>{tn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Ur(p,m,h,_)});function me(){return ts(qi)}var Yi=b("ZodUnknown",(p,f)=>{on.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Mr(p,m,h,_)});function c(){return os(Yi)}var Xi=b("ZodNever",(p,f)=>{nn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Fr(p,m,h,_)});function Hi(p){return ns(Xi,p)}var Qi=b("ZodArray",(p,f)=>{sn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Kr(p,m,h,_),p.element=f.element,De(p,"ZodArray",{min(m,h){return this.check(we(m,h))},nonempty(m){return this.check(we(1,m))},max(m,h){return this.check(er(m,h))},length(m,h){return this.check(rr(m,h))},unwrap(){return this.element}})});function n(p,f){return ss(Qi,p,f)}var Ws=b("ZodObject",(p,f)=>{an.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Gr(p,m,h,_),T(p,"shape",()=>f.shape),De(p,"ZodObject",{keyof(){return d(Object.keys(this._zod.def.shape))},catchall(m){return this.clone({...this._zod.def,catchall:m})},passthrough(){return this.clone({...this._zod.def,catchall:c()})},loose(){return this.clone({...this._zod.def,catchall:c()})},strict(){return this.clone({...this._zod.def,catchall:Hi()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(m){return ti(this,m)},safeExtend(m){return oi(this,m)},merge(m){return ni(this,m)},pick(m){return ei(this,m)},omit(m){return ri(this,m)},partial(...m){return si(qs,this,m[0])},required(...m){return ii(Ys,this,m[0])}})});function t(p,f){let m={type:"object",shape:p??{},...k(f)};return new Ws(m)}function u(p,f){return new Ws({type:"object",shape:p,catchall:c(),...k(f)})}var Ks=b("ZodUnion",(p,f)=>{zr.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>qr(p,m,h,_),p.options=f.options});function a(p,f){return new Ks({type:"union",options:p,...k(f)})}var ec=b("ZodDiscriminatedUnion",(p,f)=>{Ks.init(p,f),pn.init(p,f)});function R(p,f,m){return new ec({type:"union",options:f,discriminator:p,...k(m)})}var rc=b("ZodIntersection",(p,f)=>{ln.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Yr(p,m,h,_)});function C(p,f){return new rc({type:"intersection",left:p,right:f})}var Fs=b("ZodRecord",(p,f)=>{fn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Xr(p,m,h,_),p.keyType=f.keyType,p.valueType=f.valueType});function s(p,f,m){if(!f||!f._zod)return new Fs({type:"record",keyType:e(),valueType:p,...k(f)});return new Fs({type:"record",keyType:p,valueType:f,...k(m)})}var it=b("ZodEnum",(p,f)=>{dn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(h,_,g)=>Jr(p,h,_,g),p.enum=f.entries,p.options=Object.values(f.entries);let m=new Set(Object.keys(f.entries));p.extract=(h,_)=>{let g={};for(let x of h)if(m.has(x))g[x]=f.entries[x];else throw Error(`Key ${x} not found in enum`);return new it({...f,checks:[],...k(_),entries:g})},p.exclude=(h,_)=>{let g={...f.entries};for(let x of h)if(m.has(x))delete g[x];else throw Error(`Key ${x} not found in enum`);return new it({...f,checks:[],...k(_),entries:g})}});function d(p,f){let m=Array.isArray(p)?Object.fromEntries(p.map((h)=>[h,h])):p;return new it({type:"enum",entries:m,...k(f)})}var tc=b("ZodLiteral",(p,f)=>{mn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Br(p,m,h,_),p.values=new Set(f.values),Object.defineProperty(p,"value",{get(){if(f.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return f.values[0]}})});function r(p,f){return new tc({type:"literal",values:Array.isArray(p)?p:[p],...k(f)})}var oc=b("ZodTransform",(p,f)=>{hn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Wr(p,m,h,_),p._zod.parse=(m,h)=>{if(h.direction==="backward")throw new Ze(p.constructor.name);m.addIssue=(g)=>{if(typeof g==="string")m.issues.push(ze(g,m.value,f));else{let x=g;if(x.fatal)x.continue=!1;x.code??(x.code="custom"),x.input??(x.input=m.value),x.inst??(x.inst=p),m.issues.push(ze(x))}};let _=f.transform(m.value,m);if(_ instanceof Promise)return _.then((g)=>(m.value=g,m.fallback=!0,m));return m.value=_,m.fallback=!0,m}});function Gs(p){return new oc({type:"transform",transform:p})}var qs=b("ZodOptional",(p,f)=>{vr.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>tr(p,m,h,_),p.unwrap=()=>p._zod.def.innerType});function l(p){return new qs({type:"optional",innerType:p})}var nc=b("ZodExactOptional",(p,f)=>{_n.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>tr(p,m,h,_),p.unwrap=()=>p._zod.def.innerType});function sc(p){return new nc({type:"optional",innerType:p})}var ic=b("ZodNullable",(p,f)=>{gn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Hr(p,m,h,_),p.unwrap=()=>p._zod.def.innerType});function Us(p){return new ic({type:"nullable",innerType:p})}var cc=b("ZodDefault",(p,f)=>{xn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>et(p,m,h,_),p.unwrap=()=>p._zod.def.innerType,p.removeDefault=p.unwrap});function uc(p,f){return new cc({type:"default",innerType:p,get defaultValue(){return typeof f==="function"?f():ar(f)}})}var ac=b("ZodPrefault",(p,f)=>{zn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>rt(p,m,h,_),p.unwrap=()=>p._zod.def.innerType});function pc(p,f){return new ac({type:"prefault",innerType:p,get defaultValue(){return typeof f==="function"?f():ar(f)}})}var Ys=b("ZodNonOptional",(p,f)=>{vn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Qr(p,m,h,_),p.unwrap=()=>p._zod.def.innerType});function lc(p,f){return new Ys({type:"nonoptional",innerType:p,...k(f)})}var fc=b("ZodCatch",(p,f)=>{yn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>tt(p,m,h,_),p.unwrap=()=>p._zod.def.innerType,p.removeCatch=p.unwrap});function dc(p,f){return new fc({type:"catch",innerType:p,catchValue:typeof f==="function"?f:()=>f})}var Xs=b("ZodPipe",(p,f)=>{yr.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>ot(p,m,h,_),p.in=f.in,p.out=f.out});function Ms(p,f){return new Xs({type:"pipe",in:p,out:f})}var mc=b("ZodPreprocess",(p,f)=>{Xs.init(p,f),$n.init(p,f)}),hc=b("ZodReadonly",(p,f)=>{bn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>nt(p,m,h,_),p.unwrap=()=>p._zod.def.innerType});function _c(p){return new hc({type:"readonly",innerType:p})}var gc=b("ZodLazy",(p,f)=>{wn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>st(p,m,h,_),p.unwrap=()=>p._zod.def.getter()});function D(p){return new gc({type:"lazy",getter:p})}var xc=b("ZodCustom",(p,f)=>{kn.init(p,f),F.init(p,f),p._zod.processJSONSchema=(m,h,_)=>Vr(p,m,h,_)});function zc(p,f={}){return is(xc,p,f)}function vc(p,f){return cs(p,f)}function I(p,f){return new mc({type:"pipe",in:Gs(p),out:f})}export{le,S,ne,re,ue,ye,de,oe,A,se,J,e,pe,Y,X,o,i,P,me,c,n,t,u,a,R,C,s,d,r,l,D,I};
@@ -1,2 +1,2 @@
1
- var d=/^[A-Z][A-Z0-9_]*$/;class m extends Error{status;body;constructor(e,t,n,s){super(`${e} ${t} failed with ${n}: ${s}`);this.name="BroodsAccountApiError",this.status=n,this.body=s}}function qe(e){if(!d.test(e)||e.length>64)throw Error("envPlaceholder name must match /^[A-Z][A-Z0-9_]*$/ and be at most 64 characters.");return`\${${e}}`}function Z(){return o("BROODS_SESSION_TOKEN")??o("BROODS_ACCOUNT_SECRET")}class C{baseUrl;bearerToken;fetchImpl;constructor(e={}){let t=e.baseUrl??o("BROODS_BASE_URL")??"https://gateway.broods.app",n=e.sessionToken??e.accountSecret??Z();if(!n)throw Error("BroodsAccountClient requires an accountSecret or sessionToken (or BROODS_ACCOUNT_SECRET / BROODS_SESSION_TOKEN).");let s=t.length;while(s>0&&t.charCodeAt(s-1)===47)s-=1;this.baseUrl=t.slice(0,s),this.bearerToken=n,this.fetchImpl=e.fetch??fetch}async getAccount(){let e=await this.request("GET","/v1/account");if(!e)throw new m("GET","/v1/account",404,"Account not found");return e.account}async getStorageTrust(){let e=await this.request("GET","/v1/account/storage-trust");if(!e)throw new m("GET","/v1/account/storage-trust",404,"Account not found");return e.storageTrust}async updateAccount(e){return(await this.request("PATCH","/v1/account",e))?.account??null}async assumeRole(e,t={}){let n=await this.request("POST","/v1/account/assume-role",{roleId:e,...t.ttlSeconds!==void 0?{ttlSeconds:t.ttlSeconds}:{}});if(!n)throw new m("POST","/v1/account/assume-role",404,"Role not found");return n}async rotateSecret(){let e=await this.request("POST","/v1/account/rotate-secret");if(!e)throw new m("POST","/v1/account/rotate-secret",404,"Account not found");return e}async deleteAccount(){return await this.request("DELETE","/v1/account")??{deleted:!1}}webhookUrl(e,t){let n=[e,t].map(encodeURIComponent);return`${this.baseUrl}/v1/webhooks/${n.join("/")}`}async listAgents(){return(await this.request("GET","/v1/agents"))?.agents??[]}async createAgent(e){let t=await this.request("POST","/v1/agents",e);if(!t)throw new m("POST","/v1/agents",404,"Not found");return t}async getAgent(e){return await this.request("GET",`/v1/agents/${encodeURIComponent(e)}`)}async updateAgent(e,t){return await this.request("PATCH",`/v1/agents/${encodeURIComponent(e)}`,t)}async deleteAgent(e){return(await this.request("DELETE",`/v1/agents/${encodeURIComponent(e)}`))?.deleted??!1}async listEnvVars(){return(await this.request("GET","/v1/env"))?.env??[]}async setEnvVar(e,t){await this.request("PUT",`/v1/env/${encodeURIComponent(e)}`,{value:t})}async deleteEnvVar(e){return(await this.request("DELETE",`/v1/env/${encodeURIComponent(e)}`))?.deleted??!1}async listConnections(){return(await this.request("GET","/v1/account/connections"))?.connections??[]}async getConnection(e){return await this.request("GET",`/v1/account/connections/${e}`)}async startConnection(e,t){let n=await this.request("POST",`/v1/account/connections/${e}/start`,t);if(!n)throw new m("POST",`/v1/account/connections/${e}/start`,404,"This deployment has no /v1/account/connections yet");return n}async connect(e,t){let n=await this.request("PUT",`/v1/account/connections/${e}`,t);if(!n)throw new m("PUT",`/v1/account/connections/${e}`,404,"This deployment has no /v1/account/connections yet");return n}async disconnect(e){return(await this.request("DELETE",`/v1/account/connections/${e}`))?.deleted??!1}async listCrons(){return(await this.request("GET","/v1/crons"))?.crons??[]}async createCron(e){let t=await this.request("POST","/v1/crons",e);if(!t)throw new m("POST","/v1/crons",404,"Not found");return t}async getCron(e){return await this.request("GET",`/v1/crons/${encodeURIComponent(e)}`)}async updateCron(e,t){return await this.request("PATCH",`/v1/crons/${encodeURIComponent(e)}`,t)}async deleteCron(e){return(await this.request("DELETE",`/v1/crons/${encodeURIComponent(e)}`))?.deleted??!1}async listCronRuns(e,t={}){let n=t.limit!==void 0?`?limit=${t.limit}`:"";return(await this.request("GET",`/v1/crons/${encodeURIComponent(e)}/runs${n}`))?.runs??[]}async listWorkspaces(){return(await this.request("GET","/v1/workspaces"))?.workspaces??[]}async createWorkspace(e){let t=await this.request("POST","/v1/workspaces",e);if(!t)throw new m("POST","/v1/workspaces",404,"Not found");return t}async getWorkspace(e){return await this.request("GET",`/v1/workspaces/${encodeURIComponent(e)}`)}async updateWorkspace(e,t){return await this.request("PATCH",`/v1/workspaces/${encodeURIComponent(e)}`,t)}async deleteWorkspace(e){return(await this.request("DELETE",`/v1/workspaces/${encodeURIComponent(e)}`))?.deleted??!1}async listWorkspaceFiles(e){return(await this.request("GET",`/v1/workspaces/${encodeURIComponent(e)}/files`))?.files??[]}async getWorkspaceFileUrl(e,t){let n=`?path=${encodeURIComponent(t)}`;return(await this.request("GET",`/v1/workspaces/${encodeURIComponent(e)}/files${n}`))?.url??null}async uploadWorkspaceFile(e,t){let n=`/v1/workspaces/${encodeURIComponent(e)}/files`,s=await this.request("POST",n,t);if(!s)throw new m("POST",n,404,"Workspace not found");return s.file}async renameWorkspaceFile(e,t,n){let s=`/v1/workspaces/${encodeURIComponent(e)}/files`,r=await this.request("PATCH",s,{path:t,newPath:n});if(!r)throw new m("PATCH",s,404,"Workspace not found");return r.renamed}async deleteWorkspaceFile(e,t){return(await this.request("DELETE",`/v1/workspaces/${encodeURIComponent(e)}/files`,{path:t}))?.deleted??0}async listSandboxes(){return(await this.request("GET","/v1/sandboxes"))?.sandboxes??[]}async createSandbox(e){let t=await this.request("POST","/v1/sandboxes",e);if(!t)throw new m("POST","/v1/sandboxes",404,"Not found");return t}async getSandbox(e){return await this.request("GET",`/v1/sandboxes/${encodeURIComponent(e)}`)}async updateSandbox(e,t){return await this.request("PATCH",`/v1/sandboxes/${encodeURIComponent(e)}`,t)}async deleteSandbox(e){return(await this.request("DELETE",`/v1/sandboxes/${encodeURIComponent(e)}`))?.deleted??!1}async suspendSandbox(e,t){return await this.sandboxAction(e,"suspend",{reservationKey:t})}async resumeSandbox(e,t){return await this.sandboxAction(e,"resume",{reservationKey:t})}async terminateSandbox(e,t){return await this.sandboxAction(e,"terminate",{reservationKey:t})}async snapshotSandbox(e,t,n){return await this.sandboxAction(e,"snapshot",{reservationKey:t,name:n})}async openSandboxTerminal(e,t){return await this.sandboxAction(e,"terminal",{reservationKey:t})}async listMcp(e){let t=`/v1/mcp${a(e)}`,n=await this.request("GET",t);if(!n)throw new m("GET",t,404,"Not found");return n.servers??[]}async createMcp(e,t){let n=`/v1/mcp${a(e)}`,s=await this.request("POST",n,t);if(!s)throw new m("POST",n,404,"Not found");return s}async uploadMcpBundle(e){let n=await this.request("POST","/v1/mcp/uploads");if(!n?.uploadUrl)throw new m("POST","/v1/mcp/uploads",502,"response omitted uploadUrl");let s=await this.fetchImpl(n.uploadUrl,{method:"POST",headers:{"Content-Type":"application/javascript"},body:e});if(!s.ok)throw new m("POST","/v1/mcp/uploads",s.status,await s.text());let{storageId:r}=await s.json();if(!r)throw new m("POST","/v1/mcp/uploads",502,"upload response omitted storageId");let c=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e)),u=Array.from(new Uint8Array(c)).map((l)=>l.toString(16).padStart(2,"0")).join("");return{bundleStorageId:r,sha256:u}}async getMcp(e){return await this.request("GET",`/v1/mcp/${encodeURIComponent(e)}`)}async updateMcp(e,t){return await this.request("PATCH",`/v1/mcp/${encodeURIComponent(e)}`,t)}async deleteMcp(e){return(await this.request("DELETE",`/v1/mcp/${encodeURIComponent(e)}`))?.deleted??!1}async listPolicies(){return(await this.request("GET","/v1/policies"))?.policies??[]}async createPolicy(e){let t=await this.request("POST","/v1/policies",e);if(!t)throw new m("POST","/v1/policies",404,"Not found");return t}async getPolicy(e){return await this.request("GET",`/v1/policies/${encodeURIComponent(e)}`)}async updatePolicy(e,t){return await this.request("PATCH",`/v1/policies/${encodeURIComponent(e)}`,t)}async deletePolicy(e){return(await this.request("DELETE",`/v1/policies/${encodeURIComponent(e)}`))?.deleted??!1}async listRoles(){return(await this.request("GET","/v1/roles"))?.roles??[]}async createRole(e){let t=await this.request("POST","/v1/roles",e);if(!t)throw new m("POST","/v1/roles",404,"Not found");return t}async getRole(e){return await this.request("GET",`/v1/roles/${encodeURIComponent(e)}`)}async updateRole(e,t){return await this.request("PATCH",`/v1/roles/${encodeURIComponent(e)}`,t)}async deleteRole(e){return(await this.request("DELETE",`/v1/roles/${encodeURIComponent(e)}`))?.deleted??!1}audit={list:async(e={})=>{let t=await this.request("GET",`/v1/audit${i(e)}`);if(!t)throw new m("GET","/v1/audit",404,"Not found");return t},verify:async(e={})=>{let t=await this.request("GET",`/v1/audit/verify${i(e)}`);if(!t)throw new m("GET","/v1/audit/verify",404,"Not found");return t},getSink:async()=>await this.request("GET","/v1/audit/sink"),setSink:async(e)=>{let t=await this.request("PUT","/v1/audit/sink",e);if(!t)throw new m("PUT","/v1/audit/sink",404,"Not found");return t},deleteSink:async()=>(await this.request("DELETE","/v1/audit/sink"))?.deleted??!1};async listChannels(){return(await this.request("GET","/v1/channels"))?.channels??[]}async createChannel(e){let t=await this.request("POST","/v1/channels",e);if(!t)throw new m("POST","/v1/channels",404,"Not found");return t}async getChannel(e){return await this.request("GET",`/v1/channels/${encodeURIComponent(e)}`)}async updateChannel(e,t){return await this.request("PATCH",`/v1/channels/${encodeURIComponent(e)}`,t)}async deleteChannel(e){return(await this.request("DELETE",`/v1/channels/${encodeURIComponent(e)}`))?.deleted??!1}async listSkills(){return(await this.request("GET","/v1/skills"))?.skills??[]}async createSkill(e){let t=await this.request("POST","/v1/skills",e);if(!t)throw new m("POST","/v1/skills",404,"Not found");return t}async getSkill(e){return await this.request("GET",`/v1/skills/${encodeURIComponent(e)}`)}async uploadSkill(e,t){let n=`/v1/skills/${encodeURIComponent(e)}`,s=await this.request("PUT",n,t);if(!s)throw new m("PUT",n,404,"Skill not found");return s}async deleteSkill(e){return(await this.request("DELETE",`/v1/skills/${encodeURIComponent(e)}`))?.deleted??!1}async sandboxAction(e,t,n){let s=`/v1/sandboxes/${encodeURIComponent(e)}/${t}`,r=await this.request("POST",s,n);if(!r)throw new m("POST",s,404,"Sandbox not found");return r}async request(e,t,n){let s=await this.fetchImpl(`${this.baseUrl}${t}`,{method:e,headers:{Authorization:`Bearer ${this.bearerToken}`,...n!==void 0?{"Content-Type":"application/json"}:{}},...n!==void 0?{body:JSON.stringify(n)}:{}});if(s.status===404)return null;if(!s.ok)throw new m(e,t,s.status,await s.text());return await s.json()}}function o(e){return typeof process<"u"?process?.env?.[e]:void 0}function i(e){let t=new URLSearchParams;for(let[n,s]of Object.entries(e))if(s!==void 0)t.set(n,String(s));return t.size>0?`?${t.toString()}`:""}function a(e){return`?${new URLSearchParams({project:e.project,stage:e.stage}).toString()}`}
2
- export{m,qe,Z,C};
1
+ var d=/^[A-Z][A-Z0-9_]*$/;class p extends Error{status;body;constructor(e,t,n,s){super(`${e} ${t} failed with ${n}: ${s}`);this.name="BroodsAccountApiError",this.status=n,this.body=s}}function ge(e){if(!d.test(e)||e.length>64)throw Error("envPlaceholder name must match /^[A-Z][A-Z0-9_]*$/ and be at most 64 characters.");return`\${${e}}`}function q(){return o("BROODS_SESSION_TOKEN")??o("BROODS_ACCOUNT_SECRET")}class w{baseUrl;bearerToken;fetchImpl;constructor(e={}){let t=e.baseUrl??o("BROODS_BASE_URL")??"https://gateway.broods.app",n=e.sessionToken??e.accountSecret??q();if(!n)throw Error("BroodsAccountClient requires an accountSecret or sessionToken (or BROODS_ACCOUNT_SECRET / BROODS_SESSION_TOKEN).");let s=t.length;while(s>0&&t.charCodeAt(s-1)===47)s-=1;this.baseUrl=t.slice(0,s),this.bearerToken=n,this.fetchImpl=e.fetch??fetch}async getAccount(){let e=await this.request("GET","/v1/account");if(!e)throw new p("GET","/v1/account",404,"Account not found");return e.account}async getStorageTrust(){let e=await this.request("GET","/v1/account/storage-trust");if(!e)throw new p("GET","/v1/account/storage-trust",404,"Account not found");return e.storageTrust}async updateAccount(e){return(await this.request("PATCH","/v1/account",e))?.account??null}async assumeRole(e,t={}){let n=await this.request("POST","/v1/account/assume-role",{roleId:e,...t.ttlSeconds!==void 0?{ttlSeconds:t.ttlSeconds}:{}});if(!n)throw new p("POST","/v1/account/assume-role",404,"Role not found");return n}async rotateSecret(){let e=await this.request("POST","/v1/account/rotate-secret");if(!e)throw new p("POST","/v1/account/rotate-secret",404,"Account not found");return e}async deleteAccount(){return await this.request("DELETE","/v1/account")??{deleted:!1}}webhookUrl(e,t){let n=[e,t].map(encodeURIComponent);return`${this.baseUrl}/v1/webhooks/${n.join("/")}`}async listAgents(){return(await this.request("GET","/v1/agents"))?.agents??[]}async createAgent(e){let t=await this.request("POST","/v1/agents",e);if(!t)throw new p("POST","/v1/agents",404,"Not found");return t}async getAgent(e){return await this.request("GET",`/v1/agents/${encodeURIComponent(e)}`)}async updateAgent(e,t){return await this.request("PATCH",`/v1/agents/${encodeURIComponent(e)}`,t)}async deleteAgent(e){return(await this.request("DELETE",`/v1/agents/${encodeURIComponent(e)}`))?.deleted??!1}async listEnvVars(){return(await this.request("GET","/v1/env"))?.env??[]}async setEnvVar(e,t){await this.request("PUT",`/v1/env/${encodeURIComponent(e)}`,{value:t})}async deleteEnvVar(e){return(await this.request("DELETE",`/v1/env/${encodeURIComponent(e)}`))?.deleted??!1}async listConnections(){return(await this.request("GET","/v1/account/connections"))?.connections??[]}async getConnection(e){return await this.request("GET",`/v1/account/connections/${e}`)}async startConnection(e,t){let n=await this.request("POST",`/v1/account/connections/${e}/start`,t);if(!n)throw new p("POST",`/v1/account/connections/${e}/start`,404,"This deployment has no /v1/account/connections yet");return n}async connect(e,t){let n=await this.request("PUT",`/v1/account/connections/${e}`,t);if(!n)throw new p("PUT",`/v1/account/connections/${e}`,404,"This deployment has no /v1/account/connections yet");return n}async disconnect(e){return(await this.request("DELETE",`/v1/account/connections/${e}`))?.deleted??!1}async listCrons(){return(await this.request("GET","/v1/crons"))?.crons??[]}async createCron(e){let t=await this.request("POST","/v1/crons",e);if(!t)throw new p("POST","/v1/crons",404,"Not found");return t}async getCron(e){return await this.request("GET",`/v1/crons/${encodeURIComponent(e)}`)}async updateCron(e,t){return await this.request("PATCH",`/v1/crons/${encodeURIComponent(e)}`,t)}async deleteCron(e){return(await this.request("DELETE",`/v1/crons/${encodeURIComponent(e)}`))?.deleted??!1}async listCronRuns(e,t={}){let n=t.limit!==void 0?`?limit=${t.limit}`:"";return(await this.request("GET",`/v1/crons/${encodeURIComponent(e)}/runs${n}`))?.runs??[]}async listWorkspaces(){return(await this.request("GET","/v1/workspaces"))?.workspaces??[]}async createWorkspace(e){let t=await this.request("POST","/v1/workspaces",e);if(!t)throw new p("POST","/v1/workspaces",404,"Not found");return t}async getWorkspace(e){return await this.request("GET",`/v1/workspaces/${encodeURIComponent(e)}`)}async updateWorkspace(e,t){return await this.request("PATCH",`/v1/workspaces/${encodeURIComponent(e)}`,t)}async deleteWorkspace(e){return(await this.request("DELETE",`/v1/workspaces/${encodeURIComponent(e)}`))?.deleted??!1}async listWorkspaceFiles(e){return(await this.request("GET",`/v1/workspaces/${encodeURIComponent(e)}/files`))?.files??[]}async getWorkspaceFileUrl(e,t){let n=`?path=${encodeURIComponent(t)}`;return(await this.request("GET",`/v1/workspaces/${encodeURIComponent(e)}/files${n}`))?.url??null}async uploadWorkspaceFile(e,t){let n=`/v1/workspaces/${encodeURIComponent(e)}/files`,s=await this.request("POST",n,t);if(!s)throw new p("POST",n,404,"Workspace not found");return s.file}async renameWorkspaceFile(e,t,n){let s=`/v1/workspaces/${encodeURIComponent(e)}/files`,r=await this.request("PATCH",s,{path:t,newPath:n});if(!r)throw new p("PATCH",s,404,"Workspace not found");return r.renamed}async deleteWorkspaceFile(e,t){return(await this.request("DELETE",`/v1/workspaces/${encodeURIComponent(e)}/files`,{path:t}))?.deleted??0}async listSandboxes(){return(await this.request("GET","/v1/sandboxes"))?.sandboxes??[]}async createSandbox(e){let t=await this.request("POST","/v1/sandboxes",e);if(!t)throw new p("POST","/v1/sandboxes",404,"Not found");return t}async getSandbox(e){return await this.request("GET",`/v1/sandboxes/${encodeURIComponent(e)}`)}async updateSandbox(e,t){return await this.request("PATCH",`/v1/sandboxes/${encodeURIComponent(e)}`,t)}async deleteSandbox(e){return(await this.request("DELETE",`/v1/sandboxes/${encodeURIComponent(e)}`))?.deleted??!1}async suspendSandbox(e,t){return await this.sandboxAction(e,"suspend",{reservationKey:t})}async resumeSandbox(e,t){return await this.sandboxAction(e,"resume",{reservationKey:t})}async terminateSandbox(e,t){return await this.sandboxAction(e,"terminate",{reservationKey:t})}async snapshotSandbox(e,t,n){return await this.sandboxAction(e,"snapshot",{reservationKey:t,name:n})}async openSandboxTerminal(e,t){return await this.sandboxAction(e,"terminal",{reservationKey:t})}async listMcp(e){let t=`/v1/mcp${a(e)}`,n=await this.request("GET",t);if(!n)throw new p("GET",t,404,"Not found");return n.servers??[]}async createMcp(e,t){let n=`/v1/mcp${a(e)}`,s=await this.request("POST",n,t);if(!s)throw new p("POST",n,404,"Not found");return s}async uploadMcpBundle(e){let n=await this.request("POST","/v1/mcp/uploads");if(!n?.uploadUrl)throw new p("POST","/v1/mcp/uploads",502,"response omitted uploadUrl");let s=await this.fetchImpl(n.uploadUrl,{method:"POST",headers:{"Content-Type":"application/javascript"},body:e});if(!s.ok)throw new p("POST","/v1/mcp/uploads",s.status,await s.text());let{storageId:r}=await s.json();if(!r)throw new p("POST","/v1/mcp/uploads",502,"upload response omitted storageId");let c=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e)),u=Array.from(new Uint8Array(c)).map((l)=>l.toString(16).padStart(2,"0")).join("");return{bundleStorageId:r,sha256:u}}async getMcp(e){return await this.request("GET",`/v1/mcp/${encodeURIComponent(e)}`)}async updateMcp(e,t){return await this.request("PATCH",`/v1/mcp/${encodeURIComponent(e)}`,t)}async deleteMcp(e){return(await this.request("DELETE",`/v1/mcp/${encodeURIComponent(e)}`))?.deleted??!1}async listPolicies(){return(await this.request("GET","/v1/policies"))?.policies??[]}async createPolicy(e){let t=await this.request("POST","/v1/policies",e);if(!t)throw new p("POST","/v1/policies",404,"Not found");return t}async getPolicy(e){return await this.request("GET",`/v1/policies/${encodeURIComponent(e)}`)}async updatePolicy(e,t){return await this.request("PATCH",`/v1/policies/${encodeURIComponent(e)}`,t)}async deletePolicy(e){return(await this.request("DELETE",`/v1/policies/${encodeURIComponent(e)}`))?.deleted??!1}async listRoles(){return(await this.request("GET","/v1/roles"))?.roles??[]}async createRole(e){let t=await this.request("POST","/v1/roles",e);if(!t)throw new p("POST","/v1/roles",404,"Not found");return t}async getRole(e){return await this.request("GET",`/v1/roles/${encodeURIComponent(e)}`)}async updateRole(e,t){return await this.request("PATCH",`/v1/roles/${encodeURIComponent(e)}`,t)}async deleteRole(e){return(await this.request("DELETE",`/v1/roles/${encodeURIComponent(e)}`))?.deleted??!1}audit={list:async(e={})=>{let t=await this.request("GET",`/v1/audit${i(e)}`);if(!t)throw new p("GET","/v1/audit",404,"Not found");return t},verify:async(e={})=>{let t=await this.request("GET",`/v1/audit/verify${i(e)}`);if(!t)throw new p("GET","/v1/audit/verify",404,"Not found");return t},getSink:async()=>await this.request("GET","/v1/audit/sink"),setSink:async(e)=>{let t=await this.request("PUT","/v1/audit/sink",e);if(!t)throw new p("PUT","/v1/audit/sink",404,"Not found");return t},deleteSink:async()=>(await this.request("DELETE","/v1/audit/sink"))?.deleted??!1};async listChannels(){return(await this.request("GET","/v1/channels"))?.channels??[]}async createChannel(e){let t=await this.request("POST","/v1/channels",e);if(!t)throw new p("POST","/v1/channels",404,"Not found");return t}async getChannel(e){return await this.request("GET",`/v1/channels/${encodeURIComponent(e)}`)}async updateChannel(e,t){return await this.request("PATCH",`/v1/channels/${encodeURIComponent(e)}`,t)}async deleteChannel(e){return(await this.request("DELETE",`/v1/channels/${encodeURIComponent(e)}`))?.deleted??!1}async listSkills(){return(await this.request("GET","/v1/skills"))?.skills??[]}async createSkill(e){let t=await this.request("POST","/v1/skills",e);if(!t)throw new p("POST","/v1/skills",404,"Not found");return t}async getSkill(e){return await this.request("GET",`/v1/skills/${encodeURIComponent(e)}`)}async uploadSkill(e,t){let n=`/v1/skills/${encodeURIComponent(e)}`,s=await this.request("PUT",n,t);if(!s)throw new p("PUT",n,404,"Skill not found");return s}async deleteSkill(e){return(await this.request("DELETE",`/v1/skills/${encodeURIComponent(e)}`))?.deleted??!1}async sandboxAction(e,t,n){let s=`/v1/sandboxes/${encodeURIComponent(e)}/${t}`,r=await this.request("POST",s,n);if(!r)throw new p("POST",s,404,"Sandbox not found");return r}async request(e,t,n){let s=await this.fetchImpl(`${this.baseUrl}${t}`,{method:e,headers:{Authorization:`Bearer ${this.bearerToken}`,...n!==void 0?{"Content-Type":"application/json"}:{}},...n!==void 0?{body:JSON.stringify(n)}:{}});if(s.status===404)return null;if(!s.ok)throw new p(e,t,s.status,await s.text());return await s.json()}}function o(e){return typeof process<"u"?process?.env?.[e]:void 0}function i(e){let t=new URLSearchParams;for(let[n,s]of Object.entries(e))if(s!==void 0)t.set(n,String(s));return t.size>0?`?${t.toString()}`:""}function a(e){return`?${new URLSearchParams({project:e.project,stage:e.stage}).toString()}`}
2
+ export{p,ge,q,w};