@innovatorved/code-lab 0.7.1 → 0.7.2
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/ARCHITECTURE.md +2 -2
- package/CHANGELOG.md +10 -0
- package/README.md +5 -5
- package/dist/code-lab-sql.esm.js +2 -2
- package/dist/code-lab-sql.umd.js +3 -3
- package/dist/code-lab.css +1 -1
- package/dist/code-lab.d.ts +47 -38
- package/dist/code-lab.esm.js +918 -884
- package/dist/code-lab.js +917 -881
- package/dist/extensions/cpp.esm.js +33 -33
- package/dist/extensions/cpp.js +33 -33
- package/dist/extensions/python.esm.js +79 -49
- package/dist/extensions/python.js +79 -49
- package/dist/index.d.ts +1 -1
- package/dist/logger.d.ts +4 -20
- package/dist/modular-kernel.d.ts +0 -1
- package/dist/packages/core/src/errors.d.ts +5 -1
- package/dist/packages/fs/src/backends.d.ts +0 -27
- package/dist/packages/fs/src/index.d.ts +1 -1
- package/dist/packages/ui/src/html.d.ts +1 -0
- package/dist/packages/ui/src/index.d.ts +1 -0
- package/dist/{apps/web/src/index.d.ts → packages/ui/src/kernel.d.ts} +3 -2
- package/dist/packages/ui/src/observability.d.ts +1 -1
- package/dist/packages/ui/src/settings-dialog.d.ts +0 -1
- package/dist/preview-sw.js +1 -1
- package/dist/runtime.d.ts +3 -0
- package/dist/runtime.esm.js +2 -2
- package/dist/runtime.js +2 -2
- package/dist/schemas.d.ts +1 -1
- package/dist/shell.esm.js +277 -285
- package/dist/shell.js +277 -285
- package/dist/terminal.esm.js +2 -2
- package/dist/terminal.js +2 -2
- package/dist/workbench/editor.d.ts +0 -4
- package/dist/workbench/index.d.ts +0 -2
- package/dist/workbench/intellisense.d.ts +0 -1
- package/dist/workbench/xterm-adapter.d.ts +0 -1
- package/package.json +2 -4
- package/src/code-lab.css +0 -8086
- package/src/csp.ts +0 -590
- package/src/diagnostics.ts +0 -287
- package/src/extensions/cpp.ts +0 -2371
- package/src/extensions/guided-lab.ts +0 -68
- package/src/extensions/javascript.ts +0 -54
- package/src/extensions/python.ts +0 -1743
- package/src/extensions/typescript.ts +0 -85
- package/src/extensions/umbrella.ts +0 -5
- package/src/html.ts +0 -88
- package/src/index.ts +0 -129
- package/src/logger.ts +0 -139
- package/src/modular-kernel.ts +0 -7
- package/src/preview-sw.js +0 -296
- package/src/runtime/test-harness.ts +0 -57
- package/src/runtime.ts +0 -10565
- package/src/sample.html +0 -304
- package/src/schemas.ts +0 -366
- package/src/scm.ts +0 -2453
- package/src/search.ts +0 -433
- package/src/shell.ts +0 -10990
- package/src/storage.ts +0 -773
- package/src/terminal.ts +0 -1402
- package/src/workbench/command-palette.ts +0 -101
- package/src/workbench/diff-editor.ts +0 -472
- package/src/workbench/editor.ts +0 -49
- package/src/workbench/icons.ts +0 -255
- package/src/workbench/index.ts +0 -29
- package/src/workbench/intellisense.ts +0 -1884
- package/src/workbench/share.ts +0 -128
- package/src/workbench/xterm-adapter.ts +0 -1571
- package/src/workbench.ts +0 -21825
- package/src/zip.ts +0 -348
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
var CodeLabPython=(()=>{var kt=Object.defineProperty;var wc=Object.getOwnPropertyDescriptor;var kc=Object.getOwnPropertyNames;var Pc=Object.prototype.hasOwnProperty;var Fr=(e,t)=>{for(var r in t)kt(e,r,{get:t[r],enumerable:!0})},Zc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of kc(t))!Pc.call(e,o)&&o!==r&&kt(e,o,{get:()=>t[o],enumerable:!(n=wc(t,o))||n.enumerable});return e};var Oc=e=>Zc(kt({},"__esModule",{value:!0}),e);var fl={};Fr(fl,{BUILTIN_PYTHON_MODULES:()=>St,CODELAB_PYTHON_LIBS:()=>al,DEFAULT_PYTHON_CDN_BASE_URL:()=>zc,PYTHON_COMPLETIONS_AND_HOVERS:()=>de,PYTHON_TOOLCHAIN_PRESETS:()=>cl,PythonToolchainManager:()=>Ke,analyzePythonSource:()=>bc,applyPythonTracebackDiagnostics:()=>ul,createPythonExtension:()=>pl,default:()=>dl,formatPythonSource:()=>ll,pythonExtension:()=>Dr,registerMonacoPythonLanguageService:()=>Nr,registerPythonCompilerOnRuntime:()=>Rr,seedPythonModulesIntoVfs:()=>vc});var $={};Fr($,{BIGINT_FORMAT_RANGES:()=>Xe,CONSTANT_CATCH:()=>Xr,Class:()=>Ot,NUMBER_FORMAT_RANGES:()=>Ze,aborted:()=>K,allowsEval:()=>It,assert:()=>Nc,assertEqual:()=>Ec,assertIs:()=>Cc,assertNever:()=>Ic,assertNotEqual:()=>Tc,assignProp:()=>X,attachSchema:()=>Oe,base64ToUint8Array:()=>Gr,base64urlToUint8Array:()=>ea,cached:()=>we,captureStackTrace:()=>Ge,cleanEnum:()=>Qc,cleanRegex:()=>ke,clone:()=>q,cloneDef:()=>Lc,codePointLength:()=>Ee,constantCatch:()=>qr,createTransparentProxy:()=>Jc,defineLazy:()=>Mr,defineLazyInternal:()=>O,derived:()=>oa,esc:()=>At,escapeRegex:()=>le,explicitlyAborted:()=>Dt,extend:()=>Vc,finalizeIssue:()=>Q,floatSafeRemainder:()=>Tt,getElementAtPath:()=>Fc,getEnumValues:()=>ge,getLengthableOrigin:()=>Te,getParsedType:()=>Bc,getSizableOrigin:()=>Vr,hexToUint8Array:()=>ra,hide:()=>Qe,installLazyProp:()=>aa,isObject:()=>he,isPlainObject:()=>se,issue:()=>ye,joinValues:()=>Ve,jsonStringifyReplacer:()=>_e,members:()=>Ft,merge:()=>Hc,mergeDefs:()=>re,normalizeParams:()=>v,nullish:()=>Et,numKeys:()=>Uc,objectClone:()=>Rc,omit:()=>Kc,optionalKeys:()=>Rt,own:()=>ie,parsedType:()=>Lt,partial:()=>Xc,pick:()=>Wc,prefixIssues:()=>Y,primitiveTypes:()=>Wr,promiseAllObject:()=>jc,propertyKeyTypes:()=>Nt,randomString:()=>Mc,rawShape:()=>Pe,required:()=>qc,safeExtend:()=>Gc,shallowClone:()=>Jr,sizeCaps:()=>Ye,slugify:()=>Ct,stringifyPrimitive:()=>He,toZod:()=>Ac,uint8ArrayToBase64:()=>Hr,uint8ArrayToBase64url:()=>ta,uint8ArrayToHex:()=>na,unwrapMessage:()=>me});function Ec(e){return e}function Tc(e){return e}function Ac(){return e=>e}function Cc(e){}function Ic(e){throw new Error("Unexpected value in exhaustive check")}function Nc(e){}function ge(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Ve(e,t="|"){return e.map(r=>He(r)).join(t)}function _e(e,t){return typeof t=="bigint"?t.toString():t}var Zt=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function we(e){return new Zt(e)}function Et(e){return e==null}function ke(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Tt(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var jr=Symbol("evaluating");function Mr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==jr)return n===void 0&&(n=jr,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Rc(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function X(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Pe(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function te(e){return Pe(e._zod.def)??e._zod.def.shape}function Ur(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return X(this,t,n),n},enumerable:!0,configurable:!0})}function Br(e,t,r){t in e?X(e,t,r):e[t]=r}function ue(e,t,r,n){let o=te(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Ur(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Br(e,i,n?n(s.value,i):s.value))}}function Dc(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Ur(e,r,()=>t[r]):Br(e,r,n.value))}}function re(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Lc(e){return re(e._zod.def)}function Fc(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function jc(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function Mc(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function At(e){return JSON.stringify(e)}function Ct(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ge="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function he(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var It=we(()=>{if(U.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function se(e){if(he(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(he(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Jr(e){return se(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Uc(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Bc=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Nt=new Set(["string","number","symbol"]),Wr=new Set(["string","number","bigint","boolean","symbol","undefined"]);function le(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function q(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function v(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Jc(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function He(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Rt(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ze={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Xe={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Wc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return ue(i,e,qe(e,t)),q(e,re(r,{shape:i,checks:[]}))}function qe(e,t){let r=te(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Kc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(qe(e,t)),s={};return ue(s,e,Reflect.ownKeys(te(e)).filter(c=>!i.has(c))),q(e,re(r,{shape:s,checks:[]}))}function Vc(e,t){if(!se(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=te(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return q(e,re(e._zod.def,{shape:Kr(e,t)}))}function Kr(e,t){let r={};return ue(r,e,Reflect.ownKeys(te(e))),Dc(r,t),r}function Gc(e,t){if(!se(t))throw new Error("Invalid input to safeExtend: expected a plain object");return q(e,re(e._zod.def,{shape:Kr(e,t)}))}function Hc(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};ue(r,e,Reflect.ownKeys(te(e))),ue(r,t,Reflect.ownKeys(te(t)));let n=re(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return q(e,n)}function Xc(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(qe(t,r)):void 0,u={};return ue(u,t,Reflect.ownKeys(te(t)),e&&((a,l)=>c&&!c.has(l)?a:new e({type:"optional",innerType:a}))),q(t,re(t._zod.def,{shape:u,checks:[]}))}function qc(e,t,r){let n=r?new Set(qe(t,r)):void 0,o={};return ue(o,t,Reflect.ownKeys(te(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),q(t,re(t._zod.def,{shape:o}))}function K(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Dt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Y(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function me(e){return typeof e=="string"?e:e?.message}function Ye(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;o>=0&&t.push([o,r])}return t}function Oe(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Q(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:me(e.inst?._zod.def?.error?.(e))??me(i?.(e))??me(t?.error?.(e))??me(r.customError?.(e))??me(r.localeError?.(e))??"Invalid input",c={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(c[u]=e[u]);return c.path??(c.path=[]),c.message=s,t?.reportInput&&(c.input=e.input),c}function Vr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Yc=/[\uD800-\uDBFF]/;function Ee(e){let t=e.length;if(!Yc.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Te(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Lt(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ye(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Qc(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Gr(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Hr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function ea(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Gr(t+r)}function ta(e){return Hr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ra(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function na(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ot=class{constructor(...t){}};function Ft(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):ia(e,r,n.value)}}function ie(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Qe(e,t,r){return ie(e,t,r,!1)}function oa(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return ie(this,r,n(this))},set(o){ie(this,r,o)}})}return t}function ia(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:ie(this,t,r.bind(this))},set(n){ie(this,t,n)}})}function sa(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Pt,oe=!1,ca={configurable:!0,get(){oe=!0}};function O(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Pt!==e._zod){Pt=void 0;return}Pt=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,ca);let o=oe;oe=!1;try{let i=r(this);return oe?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),oe=oe||o,i}catch(i){throw delete this[t],oe=oe||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function aa(e,t,r,n){let o=sa(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Xr="~constantCatch";function qr(e){let t=()=>e;return t[Xr]=!0,t}var Yr;var jt={value:void 0,enumerable:!1},Qr="captureStackTrace"in Error?Error:null;function ua(e){let t=Qr;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Qr=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function m(e,t,r,n){let o={};function i(h){this.def=h,this.constr=d,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function u(h,f){if(h._zod){if(h._zod.traits.has(e))return}else{jt.value=new i(f);try{Object.defineProperty(h,"_zod",jt)}finally{jt.value=void 0}}if(h._zod.traits.add(e),t(h,f),c){let _=Object.getPrototypeOf(h),y=h._zod.constr.prototype,z=_;for(;z&&z!==y;)z=Object.getPrototypeOf(z);let w=z??_;c.has(w)||(c.add(w),Ft(w,s))}let g=d.prototype;for(let _ in g)Object.prototype.hasOwnProperty.call(g,_)&&(_ in h||(h[_]=g[_].bind(h)))}let a=n?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function d(h){let f=n?.Parent?ua(l):this;u(f,h);let g=f._zod.deferred;if(g){for(let y of g)y();f._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(f),f}return Object.defineProperty(d,"init",{value:u}),Object.defineProperty(d,Symbol.hasInstance,{value:h=>n?.Parent&&h instanceof n.Parent?!0:h?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var ee=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},xe=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Yr=globalThis).__zod_globalConfig??(Yr.__zod_globalConfig={});var U=globalThis.__zod_globalConfig;function V(e){return e&&Object.assign(U,e),U}function la(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,_e,2)),e.message}function pa(e){this._zod.message=e}var da={get:la,set:pa,enumerable:!0,configurable:!0},Ut={value:void 0,enumerable:!1},en=new WeakSet([Object.prototype,Error.prototype]),tn=(e,t)=>{e.name="$ZodError",Ut.value=t,Object.defineProperty(e,"issues",Ut),Ut.value=void 0,Object.defineProperty(e,"message",da);let r=Object.getPrototypeOf(e);en.has(r)||(en.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},rn=m("$ZodError",tn),Bt=m("$ZodError",tn,void 0,{Parent:Error});function fa(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function nn(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?fa(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function on(e,t=r=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let u=r,a=0;for(;a<c.length;){let l=c[a],d=a===c.length-1;if(l==="_errors"){d&&u._errors.push(t(s)),a++;continue}Object.prototype.hasOwnProperty.call(u,l)||Object.defineProperty(u,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let h=u[l];d&&h._errors.push(t(s)),u=h,a++}}}};return n(e),r}function et(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ae=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new ee;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map(a=>Q(a,s,V())));throw Ge(u,i?.callee??t),u}return c.value};return t},Jt=Ae(Bt),Ce=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){let u=new(i?.Err??e)(c.issues.map(a=>Q(a,s,V())));throw Ge(u,i?.callee??t),u}return c.value};return t},Wt=Ce(Bt),tt=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ee;return i.issues.length?sn(e,i.issues,o):{success:!0,data:i.value}};function sn(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>Q(o,r,V()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var rt=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?sn(e,i.issues,o):{success:!0,data:i.value}};var ha=Symbol.for("zod.compile.invalid"),ga=Symbol.for("zod.compile.fallback"),Kt=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==ha)return!0;if(n.definite===!0&&r===void 0)return!1}return _a(e,t,r)});function _a(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[ga]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new ee;return i.issues.length===0}var Vt=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},cn=e=>{let t=Ae(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,et(r,s))};return r};var an=e=>{let t=Ae(e),r=(n,o,i,s)=>t(n,o,i,et(r,s));return r};var un=e=>{let t=Ce(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,et(r,s))};return r};var ln=e=>{let t=Ce(e),r=async(n,o,i,s)=>await t(n,o,i,et(r,s));return r};var pn=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return tt(e)(t,r,o)};var dn=e=>(t,r,n)=>tt(e)(t,r,n);var fn=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return rt(e)(t,r,o)};var mn=e=>async(t,r,n)=>rt(e)(t,r,n);var hn=/^[cC][0-9a-z]{6,}$/,gn=/^[0-9a-z]+$/,_n=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,yn=/^[0-9a-vA-V]{20}$/,xn=/^[A-Za-z0-9]{27}$/,zn=/^[a-zA-Z0-9_-]{21}$/;function bn(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var vn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var $n=/^([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})$/,Ht=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var Sn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var ya="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function wn(){return new RegExp(ya,"u")}var kn=/^(?:(?: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])$/,Pn=/^(([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 Zn=/^((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])$/,On=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,En=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Tn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var An=/^https?$/,Cn=/^\+[1-9]\d{6,14}$/;var In="(?:(?:\\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])))";function xa(e){return new RegExp(`^${e}$`)}var Nn=xa(In);function Gt(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Rn(e){return new RegExp(`^${Gt(e)}$`)}function Dn(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Gt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Gt({precision:e.precision})}`:r;return new RegExp(`^${In}T(?:${n})$`)}var Ln=/^[\s\S]{0,}$/;var Xt=/^-?\d+$/,Ie=/^-?\d+(?:\.\d+)?$/,Fn=/^(?:true|false)$/i,jn=/^null$/i;var Mn=/^[^A-Z]*$/,Un=/^[^a-z]*$/;var j=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var qt=e=>{let t=e.value;return!Et(t)&&t.length!==void 0},nt={number:"number",bigint:"bigint",object:"date"},Yt=m("$ZodCheckLessThan",(e,t)=>{j.init(e,t);let r=nt[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:nt[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Qt=m("$ZodCheckGreaterThan",(e,t)=>{j.init(e,t);let r=nt[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:nt[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bn=m("$ZodCheckMultipleOf",(e,t)=>{j.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Tt(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Jn=m("$ZodCheckNumberFormat",(e,t)=>{j.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ze[t.format];e._zod.check=s=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<o&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Wn=m("$ZodCheckMaxLength",(e,t)=>{var r;j.init(e,t),(r=e._zod.def).when??(r.when=qt),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Ee(o):i)<=t.maximum)return;let c=Te(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Kn=m("$ZodCheckMinLength",(e,t)=>{var r;j.init(e,t),(r=e._zod.def).when??(r.when=qt),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Ee(o):i)>=t.minimum)return;let c=Te(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Vn=m("$ZodCheckLengthEquals",(e,t)=>{var r;j.init(e,t),(r=e._zod.def).when??(r.when=qt),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Ee(o):i;if(s===t.length)return;let c=Te(o),u=s>t.length;n.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Re=m("$ZodCheckStringFormat",(e,t)=>{var r,n;j.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Gn=m("$ZodCheckRegex",(e,t)=>{Re.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Hn=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Mn),Re.init(e,t)}),Xn=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Un),Re.init(e,t)}),qn=m("$ZodCheckIncludes",(e,t)=>{j.init(e,t);let r=le(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Yn=m("$ZodCheckStartsWith",(e,t)=>{j.init(e,t);let r=new RegExp(`^${le(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Qn=m("$ZodCheckEndsWith",(e,t)=>{j.init(e,t);let r=new RegExp(`.*${le(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var eo=m("$ZodCheckOverwrite",(e,t)=>{j.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var ot=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
1
|
+
var CodeLabPython=(()=>{var Zt=Object.defineProperty;var wc=Object.getOwnPropertyDescriptor;var kc=Object.getOwnPropertyNames;var Pc=Object.prototype.hasOwnProperty;var jr=(e,t)=>{for(var r in t)Zt(e,r,{get:t[r],enumerable:!0})},Zc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of kc(t))!Pc.call(e,o)&&o!==r&&Zt(e,o,{get:()=>t[o],enumerable:!(n=wc(t,o))||n.enumerable});return e};var Ec=e=>Zc(Zt({},"__esModule",{value:!0}),e);var fl={};jr(fl,{BUILTIN_PYTHON_MODULES:()=>Pt,CODELAB_PYTHON_LIBS:()=>al,DEFAULT_PYTHON_CDN_BASE_URL:()=>bc,PYTHON_COMPLETIONS_AND_HOVERS:()=>me,PYTHON_TOOLCHAIN_PRESETS:()=>cl,PythonToolchainManager:()=>Ge,analyzePythonSource:()=>vc,applyPythonTracebackDiagnostics:()=>ul,createPythonExtension:()=>pl,default:()=>dl,formatPythonSource:()=>ll,pythonExtension:()=>Fr,registerMonacoPythonLanguageService:()=>Lr,registerPythonCompilerOnRuntime:()=>Dr,seedPythonModulesIntoVfs:()=>$c});var w={};jr(w,{BIGINT_FORMAT_RANGES:()=>Qe,CONSTANT_CATCH:()=>qr,Class:()=>Tt,NUMBER_FORMAT_RANGES:()=>Oe,aborted:()=>V,allowsEval:()=>Rt,assert:()=>Nc,assertEqual:()=>Oc,assertIs:()=>Cc,assertNever:()=>Ic,assertNotEqual:()=>Tc,assignProp:()=>q,attachSchema:()=>Te,base64ToUint8Array:()=>Hr,base64urlToUint8Array:()=>ea,cached:()=>Pe,captureStackTrace:()=>qe,cleanEnum:()=>Qc,cleanRegex:()=>Ze,clone:()=>Y,cloneDef:()=>Dc,codePointLength:()=>Ae,constantCatch:()=>Yr,createTransparentProxy:()=>Jc,defineLazy:()=>Ur,defineLazyInternal:()=>O,derived:()=>oa,esc:()=>It,escapeRegex:()=>de,explicitlyAborted:()=>Ft,extend:()=>Vc,finalizeIssue:()=>ee,floatSafeRemainder:()=>Ct,getElementAtPath:()=>Fc,getEnumValues:()=>ye,getLengthableOrigin:()=>Ce,getParsedType:()=>Bc,getSizableOrigin:()=>Gr,hexToUint8Array:()=>ra,hide:()=>rt,installLazyProp:()=>aa,isObject:()=>_e,isPlainObject:()=>ce,issue:()=>ze,joinValues:()=>Xe,jsonStringifyReplacer:()=>xe,members:()=>Mt,merge:()=>Hc,mergeDefs:()=>ne,normalizeParams:()=>$,nullish:()=>At,numKeys:()=>Uc,objectClone:()=>Rc,omit:()=>Kc,optionalKeys:()=>Dt,own:()=>se,parsedType:()=>jt,partial:()=>Xc,pick:()=>Wc,prefixIssues:()=>Q,primitiveTypes:()=>Kr,promiseAllObject:()=>jc,propertyKeyTypes:()=>Lt,randomString:()=>Mc,rawShape:()=>Ee,required:()=>qc,safeExtend:()=>Gc,shallowClone:()=>Wr,sizeCaps:()=>tt,slugify:()=>Nt,stringifyPrimitive:()=>Ye,toZod:()=>Ac,uint8ArrayToBase64:()=>Xr,uint8ArrayToBase64url:()=>ta,uint8ArrayToHex:()=>na,unwrapMessage:()=>ge});function Oc(e){return e}function Tc(e){return e}function Ac(){return e=>e}function Cc(e){}function Ic(e){throw new Error("Unexpected value in exhaustive check")}function Nc(e){}function ye(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Xe(e,t="|"){return e.map(r=>Ye(r)).join(t)}function xe(e,t){return typeof t=="bigint"?t.toString():t}var Ot=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Pe(e){return new Ot(e)}function At(e){return e==null}function Ze(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ct(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var Mr=Symbol("evaluating");function Ur(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Mr)return n===void 0&&(n=Mr,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Rc(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function q(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ee(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function re(e){return Ee(e._zod.def)??e._zod.def.shape}function Br(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return q(this,t,n),n},enumerable:!0,configurable:!0})}function Jr(e,t,r){t in e?q(e,t,r):e[t]=r}function pe(e,t,r,n){let o=re(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Br(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Jr(e,i,n?n(s.value,i):s.value))}}function Lc(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Br(e,r,()=>t[r]):Jr(e,r,n.value))}}function ne(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Dc(e){return ne(e._zod.def)}function Fc(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function jc(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function Mc(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function It(e){return JSON.stringify(e)}function Nt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var qe="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function _e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Rt=Pe(()=>{if(B.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ce(e){if(_e(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(_e(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Wr(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Uc(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Bc=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Lt=new Set(["string","number","symbol"]),Kr=new Set(["string","number","bigint","boolean","symbol","undefined"]);function de(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function $(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Jc(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function Ye(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Dt(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Oe={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Qe={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Wc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return pe(i,e,et(e,t)),Y(e,ne(r,{shape:i,checks:[]}))}function et(e,t){let r=re(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Kc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(et(e,t)),s={};return pe(s,e,Reflect.ownKeys(re(e)).filter(c=>!i.has(c))),Y(e,ne(r,{shape:s,checks:[]}))}function Vc(e,t){if(!ce(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=re(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Y(e,ne(e._zod.def,{shape:Vr(e,t)}))}function Vr(e,t){let r={};return pe(r,e,Reflect.ownKeys(re(e))),Lc(r,t),r}function Gc(e,t){if(!ce(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Y(e,ne(e._zod.def,{shape:Vr(e,t)}))}function Hc(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};pe(r,e,Reflect.ownKeys(re(e))),pe(r,t,Reflect.ownKeys(re(t)));let n=ne(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Y(e,n)}function Xc(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(et(t,r)):void 0,a={};return pe(a,t,Reflect.ownKeys(re(t)),e&&((u,l)=>c&&!c.has(l)?u:new e({type:"optional",innerType:u}))),Y(t,ne(t._zod.def,{shape:a,checks:[]}))}function qc(e,t,r){let n=r?new Set(et(t,r)):void 0,o={};return pe(o,t,Reflect.ownKeys(re(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),Y(t,ne(t._zod.def,{shape:o}))}function V(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ft(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Q(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ge(e){return typeof e=="string"?e:e?.message}function tt(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;o>=0&&t.push([o,r])}return t}function Te(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function ee(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:ge(e.inst?._zod.def?.error?.(e))??ge(i?.(e))??ge(t?.error?.(e))??ge(r.customError?.(e))??ge(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=s,t?.reportInput&&(c.input=e.input),c}function Gr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Yc=/[\uD800-\uDBFF]/;function Ae(e){let t=e.length;if(!Yc.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Ce(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function jt(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ze(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Qc(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Hr(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Xr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function ea(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Hr(t+r)}function ta(e){return Xr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ra(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function na(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Tt=class{constructor(...t){}};function Mt(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):ia(e,r,n.value)}}function se(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function rt(e,t,r){return se(e,t,r,!1)}function oa(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return se(this,r,n(this))},set(o){se(this,r,o)}})}return t}function ia(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:se(this,t,r.bind(this))},set(n){se(this,t,n)}})}function sa(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Et,ie=!1,ca={configurable:!0,get(){ie=!0}};function O(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Et!==e._zod){Et=void 0;return}Et=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,ca);let o=ie;ie=!1;try{let i=r(this);return ie?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),ie=ie||o,i}catch(i){throw delete this[t],ie=ie||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function aa(e,t,r,n){let o=sa(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var qr="~constantCatch";function Yr(e){let t=()=>e;return t[qr]=!0,t}var Qr;var Ut={value:void 0,enumerable:!1},en="captureStackTrace"in Error?Error:null;function ua(e){let t=en;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return en=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function m(e,t,r,n){let o={};function i(h){this.def=h,this.constr=p,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function a(h,f){if(h._zod){if(h._zod.traits.has(e))return}else{Ut.value=new i(f);try{Object.defineProperty(h,"_zod",Ut)}finally{Ut.value=void 0}}if(h._zod.traits.add(e),t(h,f),c){let _=Object.getPrototypeOf(h),z=h._zod.constr.prototype,y=_;for(;y&&y!==z;)y=Object.getPrototypeOf(y);let S=y??_;c.has(S)||(c.add(S),Mt(S,s))}let g=p.prototype;for(let _ in g)Object.prototype.hasOwnProperty.call(g,_)&&(_ in h||(h[_]=g[_].bind(h)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function p(h){let f=n?.Parent?ua(l):this;a(f,h);let g=f._zod.deferred;if(g){for(let z of g)z();f._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(f),f}return Object.defineProperty(p,"init",{value:a}),Object.defineProperty(p,Symbol.hasInstance,{value:h=>n?.Parent&&h instanceof n.Parent?!0:h?._zod?.traits?.has(e)}),Object.defineProperty(p,"name",{value:e}),p}var te=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},be=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Qr=globalThis).__zod_globalConfig??(Qr.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function G(e){return e&&Object.assign(B,e),B}function la(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,xe,2)),e.message}function pa(e){this._zod.message=e}var da={get:la,set:pa,enumerable:!0,configurable:!0},Jt={value:void 0,enumerable:!1},tn=new WeakSet([Object.prototype,Error.prototype]),rn=(e,t)=>{e.name="$ZodError",Jt.value=t,Object.defineProperty(e,"issues",Jt),Jt.value=void 0,Object.defineProperty(e,"message",da);let r=Object.getPrototypeOf(e);tn.has(r)||(tn.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},nn=m("$ZodError",rn),Wt=m("$ZodError",rn,void 0,{Parent:Error});function fa(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function on(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?fa(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function sn(e,t=r=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,u=0;for(;u<c.length;){let l=c[u],p=u===c.length-1;if(l==="_errors"){p&&a._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(a,l)||Object.defineProperty(a,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let h=a[l];p&&h._errors.push(t(s)),a=h,u++}}}};return n(e),r}function nt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ie=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new te;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map(u=>ee(u,s,G())));throw qe(a,i?.callee??t),a}return c.value};return t},Kt=Ie(Wt),Ne=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(i?.Err??e)(c.issues.map(u=>ee(u,s,G())));throw qe(a,i?.callee??t),a}return c.value};return t},Vt=Ne(Wt),ot=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new te;return i.issues.length?cn(e,i.issues,o):{success:!0,data:i.value}};function cn(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>ee(o,r,G()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var it=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?cn(e,i.issues,o):{success:!0,data:i.value}};var ha=Symbol.for("zod.compile.invalid"),ga=Symbol.for("zod.compile.fallback"),Gt=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==ha)return!0;if(n.definite===!0&&r===void 0)return!1}return _a(e,t,r)});function _a(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[ga]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new te;return i.issues.length===0}var Ht=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},an=e=>{let t=Ie(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,nt(r,s))};return r};var un=e=>{let t=Ie(e),r=(n,o,i,s)=>t(n,o,i,nt(r,s));return r};var ln=e=>{let t=Ne(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,nt(r,s))};return r};var pn=e=>{let t=Ne(e),r=async(n,o,i,s)=>await t(n,o,i,nt(r,s));return r};var dn=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ot(e)(t,r,o)};var fn=e=>(t,r,n)=>ot(e)(t,r,n);var mn=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return it(e)(t,r,o)};var hn=e=>async(t,r,n)=>it(e)(t,r,n);var gn=/^[cC][0-9a-z]{6,}$/,_n=/^[0-9a-z]+$/,yn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,xn=/^[0-9a-vA-V]{20}$/,zn=/^[A-Za-z0-9]{27}$/,bn=/^[a-zA-Z0-9_-]{21}$/;function vn(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var $n=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Sn=/^([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})$/,qt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var wn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var ya="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function kn(){return new RegExp(ya,"u")}var Pn=/^(?:(?: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])$/,Zn=/^(([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 En=/^((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])$/,On=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Tn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,An=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Cn=/^https?$/,In=/^\+[1-9]\d{6,14}$/;var Nn="(?:(?:\\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])))";function xa(e){return new RegExp(`^${e}$`)}var Rn=xa(Nn);function Xt(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ln(e){return new RegExp(`^${Xt(e)}$`)}function Dn(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Xt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Xt({precision:e.precision})}`:r;return new RegExp(`^${Nn}T(?:${n})$`)}var Fn=/^[\s\S]{0,}$/;var Yt=/^-?\d+$/,Re=/^-?\d+(?:\.\d+)?$/,jn=/^(?:true|false)$/i,Mn=/^null$/i;var Un=/^[^A-Z]*$/,Bn=/^[^a-z]*$/;var M=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Qt=e=>{let t=e.value;return!At(t)&&t.length!==void 0},st={number:"number",bigint:"bigint",object:"date"},er=m("$ZodCheckLessThan",(e,t)=>{M.init(e,t);let r=st[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:st[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tr=m("$ZodCheckGreaterThan",(e,t)=>{M.init(e,t);let r=st[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:st[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jn=m("$ZodCheckMultipleOf",(e,t)=>{M.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Ct(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Wn=m("$ZodCheckNumberFormat",(e,t)=>{M.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Oe[t.format];e._zod.check=s=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<o&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Kn=m("$ZodCheckMaxLength",(e,t)=>{var r;M.init(e,t),(r=e._zod.def).when??(r.when=Qt),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Ae(o):i)<=t.maximum)return;let c=Ce(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Vn=m("$ZodCheckMinLength",(e,t)=>{var r;M.init(e,t),(r=e._zod.def).when??(r.when=Qt),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Ae(o):i)>=t.minimum)return;let c=Ce(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Gn=m("$ZodCheckLengthEquals",(e,t)=>{var r;M.init(e,t),(r=e._zod.def).when??(r.when=Qt),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Ae(o):i;if(s===t.length)return;let c=Ce(o),a=s>t.length;n.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),De=m("$ZodCheckStringFormat",(e,t)=>{var r,n;M.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Hn=m("$ZodCheckRegex",(e,t)=>{De.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xn=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Un),De.init(e,t)}),qn=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Bn),De.init(e,t)}),Yn=m("$ZodCheckIncludes",(e,t)=>{M.init(e,t);let r=de(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Qn=m("$ZodCheckStartsWith",(e,t)=>{M.init(e,t);let r=new RegExp(`^${de(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),eo=m("$ZodCheckEndsWith",(e,t)=>{M.init(e,t);let r=new RegExp(`.*${de(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var to=m("$ZodCheckOverwrite",(e,t)=>{M.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var ct=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
2
2
|
`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
3
3
|
${r.join(`
|
|
4
4
|
`)}
|
|
5
|
-
};`)(...Object.values(this.closed))}};var ro={major:4,minor:6,patch:7};var E=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ro;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,u,a)=>{if(c.memo)return c;let l=K(c),d;for(let h of u){if(h._zod.def.when){if(Dt(c)||!h._zod.def.when(c))continue}else if(l)continue;let f=c.issues.length,g=h._zod.check(c);if(g instanceof Promise&&a?.async===!1)throw new ee;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await g,c.issues.length!==f&&(Oe(c.issues,f,e),l||(l=K(c,f)))});else{if(c.issues.length===f)continue;Oe(c.issues,f,e),l||(l=K(c,f))}}return d?d.then(()=>c):c},s=(c,u,a)=>{if(K(c))return c.aborted=!0,c;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new ee;return l.then(d=>e._zod.parse(d,a))}return e._zod.parse(l,a)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(d=>s(d,c,u)):s(l,c,u)}let a=e._zod.parse(c,u);if(a instanceof Promise){if(u.async===!1)throw new ee;return a.then(l=>i(l,o,u))}return i(a,o,u)}}},{get"~standard"(){return Qe(this,"~standard",tr(this))},set"~standard"(e){ie(this,"~standard",e)}}),_o=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Q(r,t,V()))}:{value:e.value};async function za(e,t){let r={async:!0};return _o(await e._zod.run({value:t,issues:[]},r),r)}function tr(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return _o(n,r)}catch{}return za(e,t)},vendor:"zod",version:1}}var at=m("$ZodString",(e,t)=>{E.init(e,t),e._zod.pattern=t.pattern??Ln,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),A=m("$ZodStringFormat",(e,t)=>{Re.init(e,t),at.init(e,t)}),yo=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=$n),A.init(e,t)}),xo=m("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ht(n))}else t.pattern??(t.pattern=Ht());A.init(e,t)}),zo=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Sn),A.init(e,t)}),bo=1,st=2;function vo(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ba(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?vo(e)||st:va(e,t)}function va(e,t){if(!t.normalize&&t.protocol?.source===An.source&&!/^https?:\/\//i.test(e))return bo;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??st}return new URL(e)}catch{return st}}var $a=/[\t\n\r]/g;function no(e){return e.replace($a,"")}function Sa(e,t){return t.lastIndex=0,t.test(e.hostname)}function wa(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var $o=m("$ZodURL",(e,t)=>{A.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=ba(n,t);if(o===bo){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===st){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=no(n);return}t.hostname&&!Sa(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!wa(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:no(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),So=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=wn()),A.init(e,t)}),wo=m("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?zn:bn(t.length)),A.init(e,t)}),ko=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hn),A.init(e,t)}),Po=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gn),A.init(e,t)}),Zo=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_n),A.init(e,t)}),Oo=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yn),A.init(e,t)}),Eo=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=xn),A.init(e,t)}),To=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Dn(t)),A.init(e,t)}),Ao=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Nn),A.init(e,t)}),Co=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Rn(t)),A.init(e,t)}),Io=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vn),A.init(e,t)}),No=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=kn),A.init(e,t)}),ka=/^[0-9a-fA-F:.]+$/;function Ro(e){return ka.test(e)?vo(`http://[${e}]`):!1}var Do=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Pn),A.init(e,t),e._zod.check=r=>{Ro(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Lo=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Zn),A.init(e,t)});function Pa(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Ro(r)}var Fo=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=On),A.init(e,t),e._zod.check=r=>{Pa(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function jo(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var rr=/^[0-9a-zA-Z+/]*={0,2}$/,Mo=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=rr),A.init(e,t),e._zod.check=r=>{jo(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),ut=/^[A-Za-z0-9_-]*$/;function Za(e){if(!ut.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return jo(r)}var Uo=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ut),A.init(e,t),e._zod.check=r=>{Za(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Bo=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Cn),A.init(e,t)});function Oa(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Jo=m("$ZodJWT",(e,t)=>{A.init(e,t),e._zod.check=r=>{Oa(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var nr=m("$ZodNumber",(e,t)=>{E.init(e,t),e._zod.pattern=Ie,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Wo=m("$ZodNumberFormat",(e,t)=>{Jn.init(e,t),nr.init(e,t)}),Ko=m("$ZodBoolean",(e,t)=>{E.init(e,t),e._zod.pattern=Fn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Vo=m("$ZodNull",(e,t)=>{E.init(e,t),e._zod.pattern=jn,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Go=m("$ZodAny",(e,t)=>{E.init(e,t),e._zod.parse=r=>r}),Ho=m("$ZodUnknown",(e,t)=>{E.init(e,t),e._zod.parse=r=>r}),Xo=m("$ZodNever",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),qo=m("$ZodVoid",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}});function Ea(e,t){let r=Ye(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[u,a]of Ye(e._zod.def.checks))if(c>u&&a._zod.def.when(i)){let l=i.issues.length;return a._zod.check(i),i.issues[l].continue=!1,Oe(i.issues,l,e),i}}return o(i,s)}}var Ta=e=>Array.isArray(e)?e.length:-1;function oo(e,t,r){e.issues.length&&t.issues.push(...Y(r,e.issues)),t.value[r]=e.value}var Yo=m("$ZodArray",(e,t)=>{E.init(e,t);let r=U.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)s.push(l.then(d=>oo(d,n,u)));else if(oo(l,n,u),c&&l.issues.length!==0&&K(l))break}return s.length?Promise.all(s).then(()=>n):n},Ea(e,Ta)});function ct(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!(!s&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...Y(r,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||o==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}var Aa=[];function Qo(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Aa,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Rt(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function ei(e,t,r,n,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,d=a.optin,h=a.optout,f=0;for(let g in t){if(s&&r.issues.length!==f){if(K(r,f))break;f=r.issues.length}if(u.has(g))continue;if(g==="__proto__"){l==="never"&&c.push(g);continue}if(l==="never"){c.push(g);continue}let _=a.run({value:t[g],issues:[]},n);_ instanceof Promise?e.push(_.then(y=>ct(y,r,g,t,d,h))):ct(_,r,g,t,d,h)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Ca=m("$ZodObject",(e,t)=>{E.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let a=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),a.raw=l,l};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=we(()=>Qo(t));O(e,"propValues",a=>{let l=a.def.shape,d={};for(let h in l){let f=l[h]._zod;if(f.values){Object.prototype.hasOwnProperty.call(d,h)||X(d,h,new Set);for(let g of f.values)d[h].add(g);f.optin!==void 0&&d[h].add(void 0)}}return d});let i=he,s=t.catchall,c,u=U.memoizer;u?.attach(e),e._zod.parse=(a,l)=>{c??(c=o.value);let d=a.value;if(!i(d))return a.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),a;a.value=u?u.alloc(e,a,{},l):{};let h=[],f=c.shape,g=l?.abortEarly,_=a.issues.length;for(let y of c.allKeys){if(g&&a.issues.length!==_){if(K(a,_))break;_=a.issues.length}if(y==="__proto__")continue;let z=f[y],w=z._zod.optin,Z=z._zod.optout,x=z._zod.run({value:d[y],issues:[]},l);x instanceof Promise?h.push(x.then(b=>ct(b,a,y,d,w,Z))):ct(x,a,y,d,w,Z)}return s?ei(h,d,a,l,o.value,e,g===!0):h.length?Promise.all(h).then(()=>a):a}}),ti=m("$ZodObjectJIT",(e,t)=>{Ca.init(e,t);let r=e._zod.parse,n=we(()=>Qo(t)),o=U.memoizer,i=f=>{let g=n.value,_=g.symbolKeys,y=new ot(["payload","ctx"],{shape:f,inst:e,memo:o,syms:_}),z=b=>`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`,w=(b,k)=>`
|
|
5
|
+
};`)(...Object.values(this.closed))}};var no={major:4,minor:6,patch:7};var T=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=no;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,u)=>{if(c.memo)return c;let l=V(c),p;for(let h of a){if(h._zod.def.when){if(Ft(c)||!h._zod.def.when(c))continue}else if(l)continue;let f=c.issues.length,g=h._zod.check(c);if(g instanceof Promise&&u?.async===!1)throw new te;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,c.issues.length!==f&&(Te(c.issues,f,e),l||(l=V(c,f)))});else{if(c.issues.length===f)continue;Te(c.issues,f,e),l||(l=V(c,f))}}return p?p.then(()=>c):c},s=(c,a,u)=>{if(V(c))return c.aborted=!0,c;let l=i(a,o,u);if(l instanceof Promise){if(u.async===!1)throw new te;return l.then(p=>e._zod.parse(p,u))}return e._zod.parse(l,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(p=>s(p,c,a)):s(l,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new te;return u.then(l=>i(l,o,a))}return i(u,o,a)}}},{get"~standard"(){return rt(this,"~standard",nr(this))},set"~standard"(e){se(this,"~standard",e)}}),yo=(e,t)=>e.issues.length?{issues:e.issues.map(r=>ee(r,t,G()))}:{value:e.value};async function za(e,t){let r={async:!0};return yo(await e._zod.run({value:t,issues:[]},r),r)}function nr(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return yo(n,r)}catch{}return za(e,t)},vendor:"zod",version:1}}var pt=m("$ZodString",(e,t)=>{T.init(e,t),e._zod.pattern=t.pattern??Fn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),C=m("$ZodStringFormat",(e,t)=>{De.init(e,t),pt.init(e,t)}),xo=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Sn),C.init(e,t)}),zo=m("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=qt(n))}else t.pattern??(t.pattern=qt());C.init(e,t)}),bo=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=wn),C.init(e,t)}),vo=1,ut=2;function $o(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ba(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?$o(e)||ut:va(e,t)}function va(e,t){if(!t.normalize&&t.protocol?.source===Cn.source&&!/^https?:\/\//i.test(e))return vo;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??ut}return new URL(e)}catch{return ut}}var $a=/[\t\n\r]/g;function oo(e){return e.replace($a,"")}function Sa(e,t){return t.lastIndex=0,t.test(e.hostname)}function wa(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var So=m("$ZodURL",(e,t)=>{C.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=ba(n,t);if(o===vo){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===ut){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=oo(n);return}t.hostname&&!Sa(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!wa(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:oo(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),wo=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=kn()),C.init(e,t)}),ko=m("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?bn:vn(t.length)),C.init(e,t)}),Po=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=gn),C.init(e,t)}),Zo=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=_n),C.init(e,t)}),Eo=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=yn),C.init(e,t)}),Oo=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=xn),C.init(e,t)}),To=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=zn),C.init(e,t)}),Ao=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Dn(t)),C.init(e,t)}),Co=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Rn),C.init(e,t)}),Io=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ln(t)),C.init(e,t)}),No=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=$n),C.init(e,t)}),Ro=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Pn),C.init(e,t)}),ka=/^[0-9a-fA-F:.]+$/;function Lo(e){return ka.test(e)?$o(`http://[${e}]`):!1}var Do=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Zn),C.init(e,t),e._zod.check=r=>{Lo(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Fo=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=En),C.init(e,t)});function Pa(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Lo(r)}var jo=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=On),C.init(e,t),e._zod.check=r=>{Pa(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Mo(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var or=/^[0-9a-zA-Z+/]*={0,2}$/,Uo=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=or),C.init(e,t),e._zod.check=r=>{Mo(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),dt=/^[A-Za-z0-9_-]*$/;function Za(e){if(!dt.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Mo(r)}var Bo=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=dt),C.init(e,t),e._zod.check=r=>{Za(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Jo=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=In),C.init(e,t)});function Ea(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Wo=m("$ZodJWT",(e,t)=>{C.init(e,t),e._zod.check=r=>{Ea(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var ir=m("$ZodNumber",(e,t)=>{T.init(e,t),e._zod.pattern=Re,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Ko=m("$ZodNumberFormat",(e,t)=>{Wn.init(e,t),ir.init(e,t)}),Vo=m("$ZodBoolean",(e,t)=>{T.init(e,t),e._zod.pattern=jn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Go=m("$ZodNull",(e,t)=>{T.init(e,t),e._zod.pattern=Mn,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Ho=m("$ZodAny",(e,t)=>{T.init(e,t),e._zod.parse=r=>r}),Xo=m("$ZodUnknown",(e,t)=>{T.init(e,t),e._zod.parse=r=>r}),qo=m("$ZodNever",(e,t)=>{T.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Yo=m("$ZodVoid",(e,t)=>{T.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}});function Oa(e,t){let r=tt(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[a,u]of tt(e._zod.def.checks))if(c>a&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Te(i.issues,l,e),i}}return o(i,s)}}var Ta=e=>Array.isArray(e)?e.length:-1;function io(e,t,r){e.issues.length&&t.issues.push(...Q(r,e.issues)),t.value[r]=e.value}var Qo=m("$ZodArray",(e,t)=>{T.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let a=0;a<i.length;a++){let u=i[a],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(p=>io(p,n,a)));else if(io(l,n,a),c&&l.issues.length!==0&&V(l))break}return s.length?Promise.all(s).then(()=>n):n},Oa(e,Ta)});function lt(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!(!s&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...Q(r,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||o==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}var Aa=[];function ei(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Aa,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Dt(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function ti(e,t,r,n,o,i,s){let c=[],a=o.keySet,u=o.catchall._zod,l=u.def.type,p=u.optin,h=u.optout,f=0;for(let g in t){if(s&&r.issues.length!==f){if(V(r,f))break;f=r.issues.length}if(a.has(g))continue;if(g==="__proto__"){l==="never"&&c.push(g);continue}if(l==="never"){c.push(g);continue}let _=u.run({value:t[g],issues:[]},n);_ instanceof Promise?e.push(_.then(z=>lt(z,r,g,t,p,h))):lt(_,r,g,t,p,h)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Ca=m("$ZodObject",(e,t)=>{T.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=Pe(()=>ei(t));O(e,"propValues",u=>{let l=u.def.shape,p={};for(let h in l){let f=l[h]._zod;if(f.values){Object.prototype.hasOwnProperty.call(p,h)||q(p,h,new Set);for(let g of f.values)p[h].add(g);f.optin!==void 0&&p[h].add(void 0)}}return p});let i=_e,s=t.catchall,c,a=B.memoizer;a?.attach(e),e._zod.parse=(u,l)=>{c??(c=o.value);let p=u.value;if(!i(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=a?a.alloc(e,u,{},l):{};let h=[],f=c.shape,g=l?.abortEarly,_=u.issues.length;for(let z of c.allKeys){if(g&&u.issues.length!==_){if(V(u,_))break;_=u.issues.length}if(z==="__proto__")continue;let y=f[z],S=y._zod.optin,E=y._zod.optout,x=y._zod.run({value:p[z],issues:[]},l);x instanceof Promise?h.push(x.then(b=>lt(b,u,z,p,S,E))):lt(x,u,z,p,S,E)}return s?ti(h,p,u,l,o.value,e,g===!0):h.length?Promise.all(h).then(()=>u):u}}),ri=m("$ZodObjectJIT",(e,t)=>{Ca.init(e,t);let r=e._zod.parse,n=Pe(()=>ei(t)),o=B.memoizer,i=f=>{let g=n.value,_=g.symbolKeys,z=new ct(["payload","ctx"],{shape:f,inst:e,memo:o,syms:_}),y=b=>`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`,S=(b,v)=>`
|
|
6
6
|
let ${b}_ab = false;
|
|
7
7
|
for (let i = 0; i < ${b}.issues.length; i++) {
|
|
8
8
|
const iss = ${b}.issues[i];
|
|
9
|
-
iss.path = iss.path ? [${
|
|
9
|
+
iss.path = iss.path ? [${v}, ...iss.path] : [${v}];
|
|
10
10
|
payload.issues.push(iss);
|
|
11
11
|
if (iss.continue !== true) ${b}_ab = true;
|
|
12
12
|
}
|
|
13
13
|
if (${b}_ab && ctx && ctx.abortEarly) {
|
|
14
14
|
payload.value = newResult;
|
|
15
15
|
return payload;
|
|
16
|
-
}`;
|
|
17
|
-
const ${
|
|
18
|
-
if (!${
|
|
19
|
-
if (${
|
|
16
|
+
}`;z.write("const input = payload.value;");let E=Object.create(null),x=0;for(let b of g.allKeys)E[b]=`key_${x++}`;z.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let b of g.allKeys){if(b==="__proto__")continue;let v=E[b],P=typeof b=="symbol"?`syms[${_.indexOf(b)}]`:It(b),F=`${P} in input`,he=f[b],le=he?._zod?.optin,He=le!==void 0,ke=he?._zod?.optout==="optional";if(z.write(`const ${v} = ${y(P)};`),He&&ke){let Sc=le==="optional"?`${v}_present`:`${v}.value !== undefined || ${v}_present`;z.write(`
|
|
17
|
+
const ${v}_present = ${F};
|
|
18
|
+
if (!${v}.issues.length || ${v}_present) {
|
|
19
|
+
if (${v}.issues.length) {${S(v,P)}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
if (${Sc}) {
|
|
23
|
-
newResult[${
|
|
23
|
+
newResult[${P}] = ${v}.value;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
`)}else
|
|
28
|
-
if (${
|
|
27
|
+
`)}else He?(z.write(`
|
|
28
|
+
if (${v}.issues.length) {${S(v,P)}
|
|
29
29
|
}
|
|
30
|
-
`),
|
|
31
|
-
if (${
|
|
32
|
-
newResult[${
|
|
30
|
+
`),le==="defaulted"?z.write(`newResult[${P}] = ${v}.value;`):z.write(`
|
|
31
|
+
if (${v}.value !== undefined || ${F}) {
|
|
32
|
+
newResult[${P}] = ${v}.value;
|
|
33
33
|
}
|
|
34
|
-
`)):
|
|
35
|
-
const ${
|
|
36
|
-
if (${
|
|
34
|
+
`)):z.write(`
|
|
35
|
+
const ${v}_present = ${F};
|
|
36
|
+
if (${v}.issues.length) {${S(v,P)}
|
|
37
37
|
}
|
|
38
|
-
if (!${
|
|
38
|
+
if (!${v}_present && !${v}.issues.length) {
|
|
39
39
|
payload.issues.push({
|
|
40
40
|
code: "invalid_type",
|
|
41
41
|
expected: "nonoptional",
|
|
42
42
|
input: undefined,
|
|
43
|
-
path: [${
|
|
43
|
+
path: [${P}]
|
|
44
44
|
});
|
|
45
45
|
if (ctx && ctx.abortEarly) {
|
|
46
46
|
payload.value = newResult;
|
|
@@ -48,13 +48,13 @@ ${r.join(`
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
if (${
|
|
52
|
-
newResult[${
|
|
51
|
+
if (${v}_present) {
|
|
52
|
+
newResult[${P}] = ${v}.value;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,c=he,u=!U.jitless,l=u&&It.value,d=t.catchall,h;e._zod.parse=(f,g)=>{h??(h=n.value);let _=f.value;return c(_)?u&&l&&g?.async===!1&&g.jitless!==!0?(s||(s=i(t.shape)),f=s(f,g),d?ei([],_,f,g,h,e,g?.abortEarly===!0):f):r(f,g):(f.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),f)}});function io(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!K(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Q(s,n,V())))}),t)}var ri=m("$ZodUnion",(e,t)=>{E.init(e,t),O(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),O(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),O(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),O(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>ke(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}return i?Promise.all(s).then(c=>io(c,n,e,o)):io(s,n,e,o)}});var ni=m("$ZodIntersection",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([u,a])=>so(r,u,a)):so(r,i,s)}});function er(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(se(e)&&se(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=er(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=er(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function so(e,t,r){let n=new Map,o,i=new Map,s=(a,l)=>{let d;if(a.code==="unrecognized_keys"&&!a.path?.length)o??(o=a),d=a.keys;else if(a.code==="invalid_key"&&a.origin==="record"&&a.path?.length===1){let h=String(a.path[0]);i.has(h)||i.set(h,a),d=[h]}else return!1;for(let h of d)n.has(h)||n.set(h,{}),n.get(h)[l]=!0;return!0};for(let a of t.issues)s(a,"l")||e.issues.push(a);for(let a of r.issues)s(a,"r")||e.issues.push(a);let c=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(c.length){let a=o?c.filter(l=>o.keys.includes(l)):[];a.length&&e.issues.push({...o,keys:a});for(let l of c)!a.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let u=er(t.value,r.value);if(!u.valid){if(K(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var or=m("$ZodTuple",(e,t)=>{E.init(e,t);let r=t.items,n=U.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],u=co(r,"optin"),a=co(r,"optout");if(!t.rest){if(s.length<u)return o.issues.push({code:"too_small",minimum:u,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(r.length),d=t.rest?i?.abortEarly:void 0,h=!1;for(let f=0;f<r.length;f++){let g=r[f]._zod.run({value:s[f],issues:[]},i);g instanceof Promise?c.push(g.then(_=>{l[f]=_})):(l[f]=g,d&&!h&&g.issues.length&&(h=K(g)))}if(t.rest&&!h){let f=r.length-1,g=s.slice(r.length),_=o.issues.length;for(let y of g){if(d&&o.issues.length!==_){if(K(o,_))break;_=o.issues.length}f++;let z=t.rest._zod.run({value:y,issues:[]},i);z instanceof Promise?c.push(z.then(w=>ao(w,o,f))):ao(z,o,f)}}return c.length?Promise.all(c).then(()=>uo(l,o,r,s,a)):uo(l,o,r,s,a)}});function co(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function ao(e,t,r){e.issues.length&&t.issues.push(...Y(r,e.issues)),t.value[r]=e.value}function uo(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...Y(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var oi=m("$ZodRecord",(e,t)=>{E.init(e,t);let r=U.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!se(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let u=new Set;for(let l of c)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(u.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(g=>Q(g,o,V())),input:l,path:[l],inst:e});continue}let h=d.value;if(h==="__proto__")continue;let f=t.valueType._zod.run({value:i[l],issues:[]},o);f instanceof Promise?s.push(f.then(g=>{g.issues.length&&n.issues.push(...Y(l,g.issues)),n.value[h]=g.value})):(f.issues.length&&n.issues.push(...Y(l,f.issues)),n.value[h]=f.value)}let a;for(let l in i)if(!u.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else a=a??[],a.push(l);a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let u;for(let a of Reflect.ownKeys(i)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Ie.test(a)&&l.issues.length){let g=t.keyType._zod.run({value:Number(a),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?n.value[a]=i[a]:c?(u=u??[],u.push(a)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>Q(g,o,V())),input:a,path:[a],inst:e});continue}let h=l.value;if(h==="__proto__")continue;let f=t.valueType._zod.run({value:i[a],issues:[]},o);f instanceof Promise?s.push(f.then(g=>{g.issues.length&&n.issues.push(...Y(a,g.issues)),n.value[h]=g.value})):(f.issues.length&&n.issues.push(...Y(a,f.issues)),n.value[h]=f.value)}u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}});var ii=m("$ZodEnum",(e,t)=>{E.init(e,t);let r=ge(t.entries),n=new Set(r);e._zod.values=n,O(e,"pattern",o=>{let i=ge(o.def.entries).filter(s=>Nt.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>le(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}});var si=m("$ZodTransform",(e,t)=>{E.init(e,t),e._zod.optin="optional",U.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xe(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new ee;return r.value=o,r}});function lo(e,t){return e.value=t.issues.length?void 0:t.value,e}var ir=m("$ZodOptional",(e,t)=>{E.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",O(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),O(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${ke(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>lo(r,i)):lo(r,o)}return t.innerType._zod.run(r,n)}}),ci=m("$ZodExactOptional",(e,t)=>{ir.init(e,t),O(e,"values",r=>r.def.innerType._zod.values),O(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ai=m("$ZodNullable",(e,t)=>{E.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin),O(e,"optout",r=>r.def.innerType._zod.optout),O(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${ke(n.source)}|null)$`):void 0}),O(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ui=m("$ZodDefault",(e,t)=>{E.init(e,t),e._zod.optin="defaulted",O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>po(i,t)):po(o,t)}});function po(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var li=m("$ZodPrefault",(e,t)=>{E.init(e,t),e._zod.optin="defaulted",O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),pi=m("$ZodNonOptional",(e,t)=>{E.init(e,t),O(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>fo(i,e)):fo(o,e)}});function fo(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function mo(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Q(o,n,V()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var di=m("$ZodCatch",(e,t)=>{E.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),O(e,"optout",r=>r.def.innerType._zod.optout),O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>mo(r,i,t,n)):mo(r,o,t,n)}});var fi=m("$ZodPipe",(e,t)=>{E.init(e,t),O(e,"values",r=>r.def.in._zod.values),O(e,"optin",r=>r.def.in._zod.optin),O(e,"optout",r=>r.def.out._zod.optout),O(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>it(s,t.in,n)):it(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>it(i,t.out,n)):it(o,t.out,n)}});function it(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var mi=m("$ZodReadonly",(e,t)=>{E.init(e,t),O(e,"propValues",r=>r.def.innerType._zod.propValues),O(e,"values",r=>r.def.innerType._zod.values),O(e,"optin",r=>r.def.innerType?._zod?.optin),O(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(ho):ho(o)}});function ho(e){return e.memo||(e.value=Object.freeze(e.value)),e}var hi=m("$ZodFunction",(e,t)=>(E.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?Jt(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Jt(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await Wt(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Wt(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new or({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e));var gi=m("$ZodCustom",(e,t)=>{j.init(e,t),E.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>go(i,r,n,e));go(o,r,n,e)}});function go(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(ye(o))}}var cr=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},ar="~memo",_i=[];function yi(e){return e!==null&&typeof e=="object"}function sr(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var xi=new WeakMap,De=0,dt=1,Le=2;function ft(e,t,r){let n=xi.get(e);if(n!==void 0)return n?Le:De;if(t.has(e))return Le;t.add(e);let o=De,i=l=>{if(o!==Le&&l?._zod){let d=ft(l,t,r);d>o&&(o=d)}},s=(l,d)=>{let h=De;for(let f of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,f);if(d&&!g.enumerable)continue;let _=g.get?dt:g.value?._zod?ft(g.value,t,r):De;_>h&&(h=_)}return h},c=l=>{l>o&&(o=l)},u=e._zod.def,a=u.type;switch(a){case"object":{let l=Pe(u);c(l?s(l,!0):dt),i(u.catchall);break}case"array":i(u.element);break;case"tuple":for(let l of u.items)i(l);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let l of u.options)i(l);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let l=u._cachedInner??(r?e._zod.innerType:void 0);c(l?ft(l,t,!1):dt);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in u){let d=Object.getOwnPropertyDescriptor(u,l);if(!d||d.get)continue;let h=d.value;if(!(!h||typeof h!="object")){if(h._zod)i(h);else if(Array.isArray(h))for(let f of h)i(f)}}}return t.delete(e),Ia(e,o)}function Ia(e,t){return t!==dt&&xi.set(e,t===Le),t}function Na(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var lt,pt=[],Ra={alloc(e,t,r){let n=lt;if(!n)return r;lt=void 0;let o={value:r,issues:null};return n.set(t.value,o),pt.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&Da(i,o.value))throw new cr;return r(o,i)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(u,a)=>{if(r===void 0){let z=ft(e,new Set,!1);if(z===De)return e._zod.parse=s,e._zod.run===c&&(e._zod.run=s),s(u,a);z===Le||n?r=!0:n=!0}let l=u.value;if(!yi(l))return s(u,a);let d=a[ar];d||(d={buckets:new WeakMap,backEdges:void 0},a[ar]=d);let h;o===a?h=i:(h=Na(d,e),o=a,i=h);let f=h.get(l);if(f)return u.value=f.value,f.issues?f.issues.length&&u.issues.push(...sr(f.issues)):(u.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value)),u;lt=h;let g=pt.length,_=s(u,a);lt=void 0;let y=pt.length>g?pt.pop():void 0;return _ instanceof Promise?_.then(z=>(y&&(y.issues=z.issues.length?sr(z.issues):_i),z)):(y&&(y.issues=_.issues.length?sr(_.issues):_i),_)};e._zod.parse=c,e._zod.run===s&&(e._zod.run=c)})}};function zi(){return Ra}function Da(e,t){let r=e[ar]?.backEdges;return r!==void 0&&yi(t)&&r.has(t)}var La=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):n[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=Lt(i.input),u=o(c,i.input);return`Invalid input: expected ${s}, received ${u}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${He(i.values[0])}`:`Invalid option: expected one of ${Ve(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Ve(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(c=>`'${c}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function bi(){return{localeError:La()}}var vi;var ur=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Fa(){return new ur}(vi=globalThis).__zod_globalRegistry??(vi.__zod_globalRegistry=Fa());var pe=globalThis.__zod_globalRegistry;function $i(e){return e.checks&&(e.checks=[...e.checks]),e}function Si(e,t){return new e($i({type:"string",...v(t)}))}function wi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...v(t)})}function ki(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...v(t)})}function Pi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...v(t)})}function Zi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...v(t)})}function Oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...v(t)})}function Ei(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...v(t)})}function Ti(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...v(t)})}function Ai(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...v(t)})}function Ci(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...v(t)})}function Ii(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...v(t)})}function Ni(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...v(t)})}function Ri(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...v(t)})}function Di(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...v(t)})}function Li(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...v(t)})}function Fi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...v(t)})}function ji(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...v(t)})}function Mi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...v(t)})}function Ui(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...v(t)})}function Bi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...v(t)})}function Ji(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...v(t)})}function Wi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...v(t)})}function Ki(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...v(t)})}function Vi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...v(t)})}function Gi(e,t){return new e({type:"string",format:"date",check:"string_format",...v(t)})}function Hi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...v(t)})}function Xi(e,t){return new e({type:"string",format:"duration",check:"string_format",...v(t)})}function qi(e,t){return new e($i({type:"number",checks:[],...v(t)}))}function Yi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...v(t)})}function Qi(e,t){return new e({type:"boolean",...v(t)})}function es(e,t){return new e({type:"null",...v(t)})}function ts(e){return new e({type:"any"})}function rs(e){return new e({type:"unknown"})}function ns(e,t){return new e({type:"never",...v(t)})}function os(e,t){return new e({type:"void",...v(t)})}function mt(e,t){return new Yt({check:"less_than",...v(t),value:e,inclusive:!1})}function Fe(e,t){return new Yt({check:"less_than",...v(t),value:e,inclusive:!0})}function ht(e,t){return new Qt({check:"greater_than",...v(t),value:e,inclusive:!1})}function je(e,t){return new Qt({check:"greater_than",...v(t),value:e,inclusive:!0})}function gt(e,t){return new Bn({check:"multiple_of",...v(t),value:e})}function _t(e,t){return new Wn({check:"max_length",...v(t),maximum:e})}function ze(e,t){return new Kn({check:"min_length",...v(t),minimum:e})}function yt(e,t){return new Vn({check:"length_equals",...v(t),length:e})}function lr(e,t){return new Gn({check:"string_format",format:"regex",...v(t),pattern:e})}function pr(e){return new Hn({check:"string_format",format:"lowercase",...v(e)})}function dr(e){return new Xn({check:"string_format",format:"uppercase",...v(e)})}function fr(e,t){return new qn({check:"string_format",format:"includes",...v(t),includes:e})}function mr(e,t){return new Yn({check:"string_format",format:"starts_with",...v(t),prefix:e})}function hr(e,t){return new Qn({check:"string_format",format:"ends_with",...v(t),suffix:e})}function ce(e){return new eo({check:"overwrite",tx:e})}function gr(e){return ce(t=>t.normalize(e))}function _r(){return ce(e=>e.trim())}function yr(){return ce(e=>e.toLowerCase())}function xr(){return ce(e=>e.toUpperCase())}function zr(){return ce(e=>Ct(e))}function is(e,t,r){return new e({type:"array",element:t,...v(r)})}function ss(e,t,r){return new e({type:"custom",check:"custom",fn:t,...v(r)})}function cs(e,t){let r=ja(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(ye(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ye(i))}},e(n.value,n)),t);return r}function ja(e,t){let r=new j({check:"custom",...v(t)});return r._zod.check=e,r}function Me(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&X(e,n,r[n]);return e}function vr(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??pe,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function ne(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}function N(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let h=s.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,h,l)}let d=e._zod.parent;d&&(s.ref||(s.ref=d),N(d,t,l),t.seen.get(d).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&Me(s.schema,u),t.io==="input"&&B(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function as(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function $r(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let u=n.get(c);if(u&&u!==s[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=s=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,h=e.external.uri??(g=>g);if(d)return{ref:h(d)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${h("__shared")}#/${c}/${as(f)}`}}let u="#",a=`${u}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:u};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:a+as(l)}},i=s=>{if(s[1].schema.$ref)return;let c=s[1],{ref:u,defId:a}=o(s);c.def={...c.schema},a&&(c.defId=a);let l=c.schema;for(let d in l)delete l[d];l.$ref=u};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
55
|
+
`)}return z.write("payload.value = newResult;"),z.write("return payload;"),z.compile()},s,c=_e,a=!B.jitless,l=a&&Rt.value,p=t.catchall,h;e._zod.parse=(f,g)=>{h??(h=n.value);let _=f.value;return c(_)?a&&l&&g?.async===!1&&g.jitless!==!0?(s||(s=i(t.shape)),f=s(f,g),p?ti([],_,f,g,h,e,g?.abortEarly===!0):f):r(f,g):(f.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),f)}});function so(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!V(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>ee(s,n,G())))}),t)}var ni=m("$ZodUnion",(e,t)=>{T.init(e,t),O(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),O(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),O(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),O(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Ze(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}return i?Promise.all(s).then(c=>so(c,n,e,o)):so(s,n,e,o)}});var oi=m("$ZodIntersection",(e,t)=>{T.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([a,u])=>co(r,a,u)):co(r,i,s)}});function rr(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ce(e)&&ce(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=rr(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=rr(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function co(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let h=String(u.path[0]);i.has(h)||i.set(h,u),p=[h]}else return!1;for(let h of p)n.has(h)||n.set(h,{}),n.get(h)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of r.issues)s(u,"r")||e.issues.push(u);let c=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=o?c.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of c)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let a=rr(t.value,r.value);if(!a.valid){if(V(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var sr=m("$ZodTuple",(e,t)=>{T.init(e,t);let r=t.items,n=B.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],a=ao(r,"optin"),u=ao(r,"optout");if(!t.rest){if(s.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(r.length),p=t.rest?i?.abortEarly:void 0,h=!1;for(let f=0;f<r.length;f++){let g=r[f]._zod.run({value:s[f],issues:[]},i);g instanceof Promise?c.push(g.then(_=>{l[f]=_})):(l[f]=g,p&&!h&&g.issues.length&&(h=V(g)))}if(t.rest&&!h){let f=r.length-1,g=s.slice(r.length),_=o.issues.length;for(let z of g){if(p&&o.issues.length!==_){if(V(o,_))break;_=o.issues.length}f++;let y=t.rest._zod.run({value:z,issues:[]},i);y instanceof Promise?c.push(y.then(S=>uo(S,o,f))):uo(y,o,f)}}return c.length?Promise.all(c).then(()=>lo(l,o,r,s,u)):lo(l,o,r,s,u)}});function ao(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function uo(e,t,r){e.issues.length&&t.issues.push(...Q(r,e.issues)),t.value[r]=e.value}function lo(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...Q(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var ii=m("$ZodRecord",(e,t)=>{T.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!ce(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let l of c)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(a.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let p=t.keyType._zod.run({value:l,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(g=>ee(g,o,G())),input:l,path:[l],inst:e});continue}let h=p.value;if(h==="__proto__")continue;let f=t.valueType._zod.run({value:i[l],issues:[]},o);f instanceof Promise?s.push(f.then(g=>{g.issues.length&&n.issues.push(...Q(l,g.issues)),n.value[h]=g.value})):(f.issues.length&&n.issues.push(...Q(l,f.issues)),n.value[h]=f.value)}let u;for(let l in i)if(!a.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let a;for(let u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Re.test(u)&&l.issues.length){let g=t.keyType._zod.run({value:Number(u),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?n.value[u]=i[u]:c?(a=a??[],a.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>ee(g,o,G())),input:u,path:[u],inst:e});continue}let h=l.value;if(h==="__proto__")continue;let f=t.valueType._zod.run({value:i[u],issues:[]},o);f instanceof Promise?s.push(f.then(g=>{g.issues.length&&n.issues.push(...Q(u,g.issues)),n.value[h]=g.value})):(f.issues.length&&n.issues.push(...Q(u,f.issues)),n.value[h]=f.value)}a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}});var si=m("$ZodEnum",(e,t)=>{T.init(e,t);let r=ye(t.entries),n=new Set(r);e._zod.values=n,O(e,"pattern",o=>{let i=ye(o.def.entries).filter(s=>Lt.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>de(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}});var ci=m("$ZodTransform",(e,t)=>{T.init(e,t),e._zod.optin="optional",B.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new be(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new te;return r.value=o,r}});function po(e,t){return e.value=t.issues.length?void 0:t.value,e}var cr=m("$ZodOptional",(e,t)=>{T.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",O(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),O(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ze(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>po(r,i)):po(r,o)}return t.innerType._zod.run(r,n)}}),ai=m("$ZodExactOptional",(e,t)=>{cr.init(e,t),O(e,"values",r=>r.def.innerType._zod.values),O(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ui=m("$ZodNullable",(e,t)=>{T.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin),O(e,"optout",r=>r.def.innerType._zod.optout),O(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ze(n.source)}|null)$`):void 0}),O(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),li=m("$ZodDefault",(e,t)=>{T.init(e,t),e._zod.optin="defaulted",O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>fo(i,t)):fo(o,t)}});function fo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var pi=m("$ZodPrefault",(e,t)=>{T.init(e,t),e._zod.optin="defaulted",O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),di=m("$ZodNonOptional",(e,t)=>{T.init(e,t),O(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>mo(i,e)):mo(o,e)}});function mo(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function ho(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>ee(o,n,G()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var fi=m("$ZodCatch",(e,t)=>{T.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),O(e,"optout",r=>r.def.innerType._zod.optout),O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>ho(r,i,t,n)):ho(r,o,t,n)}});var mi=m("$ZodPipe",(e,t)=>{T.init(e,t),O(e,"values",r=>r.def.in._zod.values),O(e,"optin",r=>r.def.in._zod.optin),O(e,"optout",r=>r.def.out._zod.optout),O(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>at(s,t.in,n)):at(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>at(i,t.out,n)):at(o,t.out,n)}});function at(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var hi=m("$ZodReadonly",(e,t)=>{T.init(e,t),O(e,"propValues",r=>r.def.innerType._zod.propValues),O(e,"values",r=>r.def.innerType._zod.values),O(e,"optin",r=>r.def.innerType?._zod?.optin),O(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(go):go(o)}});function go(e){return e.memo||(e.value=Object.freeze(e.value)),e}var gi=m("$ZodFunction",(e,t)=>(T.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?Kt(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Kt(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await Vt(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Vt(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new sr({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e));var _i=m("$ZodCustom",(e,t)=>{M.init(e,t),T.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>_o(i,r,n,e));_o(o,r,n,e)}});function _o(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(ze(o))}}var ur=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},lr="~memo",yi=[];function xi(e){return e!==null&&typeof e=="object"}function ar(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var zi=new WeakMap,Fe=0,ht=1,je=2;function gt(e,t,r){let n=zi.get(e);if(n!==void 0)return n?je:Fe;if(t.has(e))return je;t.add(e);let o=Fe,i=l=>{if(o!==je&&l?._zod){let p=gt(l,t,r);p>o&&(o=p)}},s=(l,p)=>{let h=Fe;for(let f of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,f);if(p&&!g.enumerable)continue;let _=g.get?ht:g.value?._zod?gt(g.value,t,r):Fe;_>h&&(h=_)}return h},c=l=>{l>o&&(o=l)},a=e._zod.def,u=a.type;switch(u){case"object":{let l=Ee(a);c(l?s(l,!0):ht),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let l of a.items)i(l);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let l of a.options)i(l);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let l=a._cachedInner??(r?e._zod.innerType:void 0);c(l?gt(l,t,!1):ht);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in a){let p=Object.getOwnPropertyDescriptor(a,l);if(!p||p.get)continue;let h=p.value;if(!(!h||typeof h!="object")){if(h._zod)i(h);else if(Array.isArray(h))for(let f of h)i(f)}}}return t.delete(e),Ia(e,o)}function Ia(e,t){return t!==ht&&zi.set(e,t===je),t}function Na(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var ft,mt=[],Ra={alloc(e,t,r){let n=ft;if(!n)return r;ft=void 0;let o={value:r,issues:null};return n.set(t.value,o),mt.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&La(i,o.value))throw new ur;return r(o,i)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(a,u)=>{if(r===void 0){let y=gt(e,new Set,!1);if(y===Fe)return e._zod.parse=s,e._zod.run===c&&(e._zod.run=s),s(a,u);y===je||n?r=!0:n=!0}let l=a.value;if(!xi(l))return s(a,u);let p=u[lr];p||(p={buckets:new WeakMap,backEdges:void 0},u[lr]=p);let h;o===u?h=i:(h=Na(p,e),o=u,i=h);let f=h.get(l);if(f)return a.value=f.value,f.issues?f.issues.length&&a.issues.push(...ar(f.issues)):(a.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(f.value)),a;ft=h;let g=mt.length,_=s(a,u);ft=void 0;let z=mt.length>g?mt.pop():void 0;return _ instanceof Promise?_.then(y=>(z&&(z.issues=y.issues.length?ar(y.issues):yi),y)):(z&&(z.issues=_.issues.length?ar(_.issues):yi),_)};e._zod.parse=c,e._zod.run===s&&(e._zod.run=c)})}};function bi(){return Ra}function La(e,t){let r=e[lr]?.backEdges;return r!==void 0&&xi(t)&&r.has(t)}var Da=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):n[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=jt(i.input),a=o(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Ye(i.values[0])}`:`Invalid option: expected one of ${Xe(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Xe(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(c=>`'${c}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function vi(){return{localeError:Da()}}var $i;var pr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Fa(){return new pr}($i=globalThis).__zod_globalRegistry??($i.__zod_globalRegistry=Fa());var fe=globalThis.__zod_globalRegistry;function Si(e){return e.checks&&(e.checks=[...e.checks]),e}function wi(e,t){return new e(Si({type:"string",...$(t)}))}function ki(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}function Pi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function Zi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}function Ei(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}function Oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}function Ti(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}function Ai(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}function Ci(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}function Ii(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}function Ni(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}function Ri(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}function Li(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}function Di(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}function Fi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}function ji(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}function Mi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}function Ui(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}function Bi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}function Ji(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}function Wi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}function Ki(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}function Vi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}function Gi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}function Hi(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}function Xi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}function qi(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}function Yi(e,t){return new e(Si({type:"number",checks:[],...$(t)}))}function Qi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}function es(e,t){return new e({type:"boolean",...$(t)})}function ts(e,t){return new e({type:"null",...$(t)})}function rs(e){return new e({type:"any"})}function ns(e){return new e({type:"unknown"})}function os(e,t){return new e({type:"never",...$(t)})}function is(e,t){return new e({type:"void",...$(t)})}function _t(e,t){return new er({check:"less_than",...$(t),value:e,inclusive:!1})}function Me(e,t){return new er({check:"less_than",...$(t),value:e,inclusive:!0})}function yt(e,t){return new tr({check:"greater_than",...$(t),value:e,inclusive:!1})}function Ue(e,t){return new tr({check:"greater_than",...$(t),value:e,inclusive:!0})}function xt(e,t){return new Jn({check:"multiple_of",...$(t),value:e})}function zt(e,t){return new Kn({check:"max_length",...$(t),maximum:e})}function ve(e,t){return new Vn({check:"min_length",...$(t),minimum:e})}function bt(e,t){return new Gn({check:"length_equals",...$(t),length:e})}function dr(e,t){return new Hn({check:"string_format",format:"regex",...$(t),pattern:e})}function fr(e){return new Xn({check:"string_format",format:"lowercase",...$(e)})}function mr(e){return new qn({check:"string_format",format:"uppercase",...$(e)})}function hr(e,t){return new Yn({check:"string_format",format:"includes",...$(t),includes:e})}function gr(e,t){return new Qn({check:"string_format",format:"starts_with",...$(t),prefix:e})}function _r(e,t){return new eo({check:"string_format",format:"ends_with",...$(t),suffix:e})}function ae(e){return new to({check:"overwrite",tx:e})}function yr(e){return ae(t=>t.normalize(e))}function xr(){return ae(e=>e.trim())}function zr(){return ae(e=>e.toLowerCase())}function br(){return ae(e=>e.toUpperCase())}function vr(){return ae(e=>Nt(e))}function ss(e,t,r){return new e({type:"array",element:t,...$(r)})}function cs(e,t,r){return new e({type:"custom",check:"custom",fn:t,...$(r)})}function as(e,t){let r=ja(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(ze(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ze(i))}},e(n.value,n)),t);return r}function ja(e,t){let r=new M({check:"custom",...$(t)});return r._zod.check=e,r}function Be(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&q(e,n,r[n]);return e}function Sr(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??fe,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function oe(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}function N(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let h=s.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,h,l)}let p=e._zod.parent;p&&(s.ref||(s.ref=p),N(p,t,l),t.seen.get(p).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Be(s.schema,a),t.io==="input"&&J(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function us(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function wr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=n.get(c);if(a&&a!==s[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=s=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(s[0])?.id,h=e.external.uri??(g=>g);if(p)return{ref:h(p)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${h("__shared")}#/${c}/${us(f)}`}}let a="#",u=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+us(l)}},i=s=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:u}=o(s);c.def={...c.schema},u&&(c.defId=u);let l=c.schema;for(let p in l)delete l[p];l.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
56
56
|
|
|
57
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let a=e.external.registry.get(s[0])?.id;if(t!==s[0]&&a){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}c.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function ps(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;ps(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var ds=new Set(["type","properties","required","additionalProperties"]),us=["oneOf","anyOf"];function ls(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function br(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!ds.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let a of t){let l=a.properties?.[s]??ls(a);l!=null&&(c.some(d=>JSON.stringify(d)===JSON.stringify(l))||c.push(l))}let u=c.length===1?c[0]:br(c)??{allOf:c};X(r,s,u)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=ls(s);c&&!i.some(u=>JSON.stringify(u)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function Ma(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of ds)if(o in e)return;let r=t.filter(o=>us.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=br(t);else{let o=r[0],i=us.find(u=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let s=t.filter(u=>u!==o),c=o[i].map(u=>br([...s,u]));if(c.some(u=>!u))return;n={[i]:c}}n&&(delete e.allOf,Me(e,n))}function Sr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=c=>{let u=e.seen.get(c);if(u.ref===null)return;let a=u.def??u.schema,l={...a},d=u.ref;if(u.ref=null,d){n(d);let f=e.seen.get(d),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(a.allOf=a.allOf??[],a.allOf.push(g)):Me(a,g),Me(a,l),c._zod.parent===d)for(let y in a)y==="$ref"||y==="allOf"||y in l||delete a[y];if(g.$ref&&f.def)for(let y in a)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(a[y])===JSON.stringify(f.def[y])&&delete a[y]}let h=c._zod.parent;if(h&&h!==d){n(h);let f=e.seen.get(h);if(f?.schema.$ref&&(a.$ref=f.schema.$ref,f.def))for(let g in a)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(a[g])===JSON.stringify(f.def[g])&&delete a[g]}e.override({zodSchema:c,jsonSchema:a,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())ps(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let u of e.seen.values())for(let a of[u.schema,u.def]){let l=a?.allOf;if(!Array.isArray(l))continue;let d=c.get(l);d?d.push(a):c.set(l,[a])}for(let u of e.intersections)for(let a of c.get(u)??[])Ma(a)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Me(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let u=c[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,X(s,u.defId,u.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ue(t,"input",e.processors),output:Ue(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function B(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return B(n.element,r);if(n.type==="set")return B(n.valueType,r);if(n.type==="lazy")return B(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return B(n.innerType,r);if(n.type==="intersection")return B(n.left,r)||B(n.right,r);if(n.type==="record"||n.type==="map")return B(n.keyType,r)||B(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:B(n.in,r)||B(n.out,r);if(n.type==="object"){for(let o in n.shape)if(B(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(B(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(B(o,r))return!0;return!!(n.rest&&B(n.rest,r))}return!1}var fs=(e,t={})=>r=>{let n=vr({...r,processors:t});return N(e,n),$r(n,e),Sr(n,e)},Ue=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=vr({...o??{},target:i,io:t,processors:r});return N(e,s),$r(s,e),Sr(s,e)};var be=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},ve=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},ms=(e,t)=>{be(e,"minimum",t),ve(e,"maximum",t)},ys=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},xs=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},zs=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},bs=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},hs=(e,t)=>be(e,"minimum",t.minimum),gs=(e,t)=>ve(e,"maximum",t.maximum),_s=e=>(t,r)=>{bs(t,r.format);let[n,o]=e[r.format];be(t,"minimum",n),ve(t,"maximum",o)},Ua={greater_than:(e,t)=>be(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ve(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>ys(e,t.value),number_format:_s(Ze),bigint_format:_s(Xe),min_length:hs,max_length:gs,length_equals:(e,t)=>ms(e,t.length),min_size:hs,max_size:gs,size_equals:(e,t)=>ms(e,t.size),string_format:(e,t)=>{bs(e,t.format),t.pattern&&xs(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>zs(e,t.mime)};function G(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)Ua[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&be(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&be(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&ve(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&ve(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&ys(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&zs(t,o.mime);for(let i of o.patterns??[])xs(t,i);return t}var Ba={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ja=new Map([[rr,En],[ut,Tn]]),vs=e=>Ja.get(e)??e,$s=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:l}=G(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),c&&(o.format=Ba[c]??c,o.format===""&&delete o.format,(c==="time"||l)&&delete o.format),a&&(o.contentEncoding=a),u&&u.size>0){let d=[...u].map(vs);d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},Ss=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:a,isInt:l}=G(e);o.type=l?"integer":"number";let d=typeof a=="number"&&a>=(i??Number.NEGATIVE_INFINITY),h=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(d?f?(o.minimum=a,o.exclusiveMinimum=!0):o.exclusiveMinimum=a:typeof i=="number"&&(o.minimum=i),h?f?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof s=="number"&&(o.maximum=s),c){let g=new Set;for(let z of c)Number.isFinite(z)&&z!==0?g.add(Math.abs(z)):ne(e,t,o,n,`A multipleOf divisor of ${z} cannot be represented in JSON Schema`);let[_,...y]=g;_!==void 0&&(o.multipleOf=_),y.length&&(o.allOf=[...o.allOf??[],...y.map(z=>({multipleOf:z}))])}},ws=(e,t,r,n)=>{r.type="boolean"};var ks=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var Ps=(e,t,r,n)=>{ne(e,t,r,n,"Void cannot be represented in JSON Schema")},Zs=(e,t,r,n)=>{r.not={}},Os=(e,t,r,n)=>{},Es=(e,t,r,n)=>{};var Ts=(e,t,r,n)=>{let o=e._zod.def,i=ge(o.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i};var As=(e,t,r,n)=>{ne(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Cs=(e,t,r,n)=>{ne(e,t,r,n,"Function types cannot be represented in JSON Schema")},Is=(e,t,r,n)=>{ne(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Ns=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=G(e);typeof s=="number"&&(o.minItems=s),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=N(i.element,t,{...n,path:[...n.path,"items"]})};function Be(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Be(t.out):t.type==="catch"?Be(t.innerType):e._zod.optin}var Rs=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&ne(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let a in s)X(o.properties,a,N(s[a],t,{...n,path:[...n.path,"properties",a]}));let u=[];for(let a of Object.keys(s)){let l=i.shape[a];(t.io==="input"?Be(l)===void 0:l._zod.optout===void 0)&&u.push(a)}u.length>0&&(o.required=u),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=N(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Ds=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>N(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));i?r.oneOf=s:r.anyOf=s},Ls=(e,t,r,n)=>{let o=e._zod.def,i=N(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=N(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=a=>"allOf"in a&&Object.keys(a).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=u,t.intersections.push(u)},Fs=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map((_,y)=>N(_,t,{...n,path:[...n.path,s,y]})),a=i.rest?N(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let _=i.items[l-1];if(!(t.io==="input"?Be(_)!==void 0:_._zod.optout==="optional"))break;l--}let d=i.items.length,h=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=u,h?o.items=!1:a&&(o.items=a),l>0&&(o.minItems=l),h&&(o.maxItems=d)):t.target==="openapi-3.0"?(o.items={anyOf:u},a&&o.items.anyOf.push(a),l>0&&(o.minItems=l),h&&(o.maxItems=d)):(o.items=u,h?o.additionalItems=!1:a&&(o.additionalItems=a),l>0&&(o.minItems=l),h&&(o.maxItems=d));let{minimum:f,maximum:g}=G(e);typeof f=="number"&&(o.minItems=f),typeof g=="number"&&(o.maxItems=g)};function wr(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let _=wr(e,g,r);return _===g?t:_}for(let g of["anyOf","oneOf"]){let _=t[g];if(!Array.isArray(_))continue;let y=_.map(z=>wr(e,z,r));y.some((z,w)=>z!==_[w])&&(t={...t,[g]:y})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:u,exclusiveMaximum:a,multipleOf:l,format:d,id:h,...f}=t;return f.enum?f.enum=f.enum.map(g=>typeof g=="number"?String(g):g):typeof f.const=="number"&&(f.const=String(f.const)),o&&(f.type="string",i||(f.pattern=(n.includes("number")?Ie:Xt).source)),f}var kr=new WeakMap;function Wa(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of kr.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=wr(t,i,new Set);s!==i&&r.set(i,s)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}var js=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=G(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=N(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)X(o.patternProperties,vs(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=N(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=kr.get(t);l||(l=[],kr.set(t,l),t.deferred.push(()=>Wa(t))),l.push(e)}o.additionalProperties=N(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=s._zod.values,a=t.io==="input"&&Be(i.valueType)!==void 0;if(u&&!i.partial&&!a){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l.map(String))}},Ms=(e,t,r,n)=>{let o=e._zod.def,i=N(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Us=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Pr=Symbol();function Bs(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,u)=>typeof u!="bigint"?u:(i=!0,null));return i?(ne(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Pr):JSON.parse(s)}var Js=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Bs(o.defaultValue,e,t,r,n);s!==Pr&&(r.default=s)},Ws=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Bs(o.defaultValue,e,t,r,n);s!==Pr&&(r._prefault=s)},Ks=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{ne(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Vs=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;N(s,t,n);let c=t.seen.get(e);c.ref=s},Gs=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var Zr=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var Hs=new WeakSet([Object.prototype,Error.prototype]);function xt(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Qa=(e,t)=>{rn.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Hs.has(r)||(Hs.add(r),xt(r,"format",n=>o=>on(n,o)),xt(r,"flatten",n=>o=>nn(n,o)),xt(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,_e,2)}),xt(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,_e,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var H=m("ZodError",Qa,void 0,{Parent:Error});var Xs=Ae(H),qs=Ce(H),Ys=tt(H),Qs=rt(H),ec=cn(H),tc=an(H),rc=un(H),nc=ln(H),oc=pn(H),ic=dn(H),sc=fn(H),cc=mn(H);function tu(){U.localeError||V(bi())}function Je(){U.memoizer||V({memoizer:zi()})}var T=m("ZodType",(e,t)=>(tu(),E.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone($.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return q(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(rl(e,t))},superRefine(e,t){return this.check(nl(e,t))},overwrite(e){return this.check(ce(e))},optional(){return lc(this)},exactOptional(){return Uu(this)},nullable(){return pc(this)},nullish(){return lc(pc(this))},nonoptional(e){return Gu(this,e)},array(){return I(this)},or(e){return ae([this,e])},and(e){return Du(this,e)},transform(e){return dc(this,Mu(e))},default(e){return Wu(this,e)},prefault(e){return Vu(this,e)},catch(e){return Xu(this,e)},pipe(e){return dc(this,e)},readonly(){return Qu(this)},describe(e){let t=this.clone();return pe.add(t,{description:e}),t},meta(...e){if(e.length===0)return pe.get(this);let t=this.clone();return pe.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return $.hide(this,"~standard",{...tr(this),jsonSchema:{input:Ue(this,"input"),output:Ue(this,"output")}})},set"~standard"(e){$.own(this,"~standard",e)},parse:function e(t,r){return Xs(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await qs(this,t,r,{callee:e})},safeParse(e,t){return Ys(this,e,t)},async safeParseAsync(e,t){return Qs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){$.own(this,"spa",e)},validate(e,t){return Kt(this,e,t)},validateAsync(e,t){return Vt(this,e,t)},encode:function e(t,r){return ec(this,t,r,{callee:e})},decode:function e(t,r){return tc(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await rc(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await nc(this,t,r,{callee:e})},safeEncode(e,t){return oc(this,e,t)},safeDecode(e,t){return ic(this,e,t)},async safeEncodeAsync(e,t){return sc(this,e,t)},async safeDecodeAsync(e,t){return cc(this,e,t)},toJSONSchema(e){return fs(this,{})(e)},get description(){return pe.get(this)?.description},get _def(){return this._zod.def}}),fc=m("_ZodString",(e,t)=>{at.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$s(e,r,n,o)},$.derived({format:e=>G(e).format??null,minLength:e=>G(e).minimum??null,maxLength:e=>G(e).maximum??null},{regex(...e){return this.check(lr(...e))},includes(...e){return this.check(fr(...e))},startsWith(...e){return this.check(mr(...e))},endsWith(...e){return this.check(hr(...e))},min(...e){return this.check(ze(...e))},max(...e){return this.check(_t(...e))},length(...e){return this.check(yt(...e))},nonempty(...e){return this.check(ze(1,...e))},lowercase(e){return this.check(pr(e))},uppercase(e){return this.check(dr(e))},trim(){return this.check(_r())},normalize(...e){return this.check(gr(...e))},toLowerCase(){return this.check(yr())},toUpperCase(){return this.check(xr())},slugify(){return this.check(zr())}})),ru=m("ZodString",(e,t)=>{at.init(e,t),fc.init(e,t)},{email(e){return this.check(wi(cu,e))},url(e){return this.check(Ti(uu,e))},jwt(e){return this.check(Ki(Su,e))},emoji(e){return this.check(Ai(lu,e))},guid(e){return this.check(ki(au,e))},uuid(e){return this.check(Pi(zt,e))},uuidv4(e){return this.check(Zi(zt,e))},uuidv6(e){return this.check(Oi(zt,e))},uuidv7(e){return this.check(Ei(zt,e))},nanoid(e){return this.check(Ci(pu,e))},cuid(e){return this.check(Ii(du,e))},cuid2(e){return this.check(Ni(fu,e))},ulid(e){return this.check(Ri(mu,e))},base64(e){return this.check(Bi(bu,e))},base64url(e){return this.check(Ji(vu,e))},xid(e){return this.check(Di(hu,e))},ksuid(e){return this.check(Li(gu,e))},ipv4(e){return this.check(Fi(_u,e))},ipv6(e){return this.check(ji(yu,e))},cidrv4(e){return this.check(Mi(xu,e))},cidrv6(e){return this.check(Ui(zu,e))},e164(e){return this.check(Wi($u,e))},datetime(e){return this.check(Vi(nu,e))},date(e){return this.check(Gi(ou,e))},time(e){return this.check(Hi(iu,e))},duration(e){return this.check(Xi(su,e))}});function p(e){return Si(ru,e)}var R=m("ZodStringFormat",(e,t)=>{A.init(e,t),fc.init(e,t)}),nu=m("ZodISODateTime",(e,t)=>{To.init(e,t),R.init(e,t)}),ou=m("ZodISODate",(e,t)=>{Ao.init(e,t),R.init(e,t)}),iu=m("ZodISOTime",(e,t)=>{Co.init(e,t),R.init(e,t)}),su=m("ZodISODuration",(e,t)=>{Io.init(e,t),R.init(e,t)}),cu=m("ZodEmail",(e,t)=>{zo.init(e,t),R.init(e,t)});var au=m("ZodGUID",(e,t)=>{yo.init(e,t),R.init(e,t)});var zt=m("ZodUUID",(e,t)=>{xo.init(e,t),R.init(e,t)});var uu=m("ZodURL",(e,t)=>{$o.init(e,t),R.init(e,t)});var lu=m("ZodEmoji",(e,t)=>{So.init(e,t),R.init(e,t)});var pu=m("ZodNanoID",(e,t)=>{wo.init(e,t),R.init(e,t)});var du=m("ZodCUID",(e,t)=>{ko.init(e,t),R.init(e,t)});var fu=m("ZodCUID2",(e,t)=>{Po.init(e,t),R.init(e,t)});var mu=m("ZodULID",(e,t)=>{Zo.init(e,t),R.init(e,t)});var hu=m("ZodXID",(e,t)=>{Oo.init(e,t),R.init(e,t)});var gu=m("ZodKSUID",(e,t)=>{Eo.init(e,t),R.init(e,t)});var _u=m("ZodIPv4",(e,t)=>{No.init(e,t),R.init(e,t)});var yu=m("ZodIPv6",(e,t)=>{Do.init(e,t),R.init(e,t)});var xu=m("ZodCIDRv4",(e,t)=>{Lo.init(e,t),R.init(e,t)});var zu=m("ZodCIDRv6",(e,t)=>{Fo.init(e,t),R.init(e,t)});var bu=m("ZodBase64",(e,t)=>{Mo.init(e,t),R.init(e,t)});var vu=m("ZodBase64URL",(e,t)=>{Uo.init(e,t),R.init(e,t)});var $u=m("ZodE164",(e,t)=>{Bo.init(e,t),R.init(e,t)});var Su=m("ZodJWT",(e,t)=>{Jo.init(e,t),R.init(e,t)});var mc=m("ZodNumber",(e,t)=>{nr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ss(e,r,n,o),e.isFinite=!0},$.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=G(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=G(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=G(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>G(e).format??null},{gt(e,t){return this.check(ht(e,t))},gte(e,t){return this.check(je(e,t))},min(e,t){return this.check(je(e,t))},lt(e,t){return this.check(mt(e,t))},lte(e,t){return this.check(Fe(e,t))},max(e,t){return this.check(Fe(e,t))},int(e){return this.check(ac(e))},safe(e){return this.check(ac(e))},positive(e){return this.check(ht(0,e))},nonnegative(e){return this.check(je(0,e))},negative(e){return this.check(mt(0,e))},nonpositive(e){return this.check(Fe(0,e))},multipleOf(e,t){return this.check(gt(e,t))},step(e,t){return this.check(gt(e,t))},finite(){return this}}));function P(e){return qi(mc,e)}var wu=m("ZodNumberFormat",(e,t)=>{Wo.init(e,t),mc.init(e,t)});function ac(e){return Yi(wu,e)}var ku=m("ZodBoolean",(e,t)=>{Ko.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ws(e,r,n,o)});function D(e){return Qi(ku,e)}var Pu=m("ZodNull",(e,t)=>{Vo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ks(e,r,n,o)});function Tr(e){return es(Pu,e)}var Zu=m("ZodAny",(e,t)=>{Go.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Os(e,r,n,o)});function L(){return ts(Zu)}var Ou=m("ZodUnknown",(e,t)=>{Ho.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Es(e,r,n,o)});function bt(){return rs(Ou)}var Eu=m("ZodNever",(e,t)=>{Xo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zs(e,r,n,o)});function Tu(e){return ns(Eu,e)}var Au=m("ZodVoid",(e,t)=>{qo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ps(e,r,n,o)});function J(e){return os(Au,e)}var Cu=m("ZodArray",(e,t)=>{Je(),Yo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ns(e,r,n,o),e.element=t.element},{min(e,t){return this.check(ze(e,t))},nonempty(e){return this.check(ze(1,e))},max(e,t){return this.check(_t(e,t))},length(e,t){return this.check(yt(e,t))},unwrap(){return this.element}});function I(e,t){return is(Cu,e,t)}var Iu=m("ZodObject",(e,t)=>{Je(),ti.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rs(e,r,n,o),$.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return M(Object.keys(this._zod.def.shape))},catchall(e){return this.clone($.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone($.mergeDefs(this._zod.def,{catchall:bt()}))},loose(){return this.clone($.mergeDefs(this._zod.def,{catchall:bt()}))},strict(){return this.clone($.mergeDefs(this._zod.def,{catchall:Tu()}))},strip(){return this.clone($.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return $.extend(this,e)},safeExtend(e){return $.safeExtend(this,e)},merge(e){return $.merge(this,e)},pick(e){return $.pick(this,e)},omit(e){return $.omit(this,e)},partial(...e){return $.partial(Ar,this,e[0])},exactPartial(...e){return $.partial(hc,this,e[0],"exactPartial")},required(...e){return $.required(gc,this,e[0])}});function F(e,t){let r={type:"object",shape:e??{},...$.normalizeParams(t)};return new Iu(r)}var Nu=m("ZodUnion",(e,t)=>{ri.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ds(e,r,n,o),e.options=t.options});function ae(e,t){return new Nu({type:"union",options:e,...$.normalizeParams(t)})}var Ru=m("ZodIntersection",(e,t)=>{ni.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ls(e,r,n,o)});function Du(e,t){return new Ru({type:"intersection",left:e,right:t})}var Lu=m("ZodTuple",(e,t)=>{Je(),or.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fs(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Ar({type:"optional",innerType:t}))})}});function Fu(e,t,r){let n=t instanceof E,o=n?r:t,i=n?t:null;return new Lu({type:"tuple",items:e,rest:i,...$.normalizeParams(o)})}var uc=m("ZodRecord",(e,t)=>{Je(),oi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>js(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function S(e,t,r){return!t||!t._zod?new uc({type:"record",keyType:p(),valueType:e,...$.normalizeParams(t)}):new uc({type:"record",keyType:e,valueType:t,...$.normalizeParams(r)})}var Er=m("ZodEnum",(e,t)=>{ii.init(e,t),T.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ts(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Er({...t,checks:[],...$.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Er({...t,checks:[],...$.normalizeParams(o),entries:i})}});function M(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Er({type:"enum",entries:r,...$.normalizeParams(t)})}var ju=m("ZodTransform",(e,t)=>{Je(),si.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Is(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new xe(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push($.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push($.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Mu(e){return new ju({type:"transform",transform:e})}var Ar=m("ZodOptional",(e,t)=>{ir.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function lc(e){return new Ar({type:"optional",innerType:e})}var hc=m("ZodExactOptional",(e,t)=>{ci.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Uu(e){return new hc({type:"optional",innerType:e})}var Bu=m("ZodNullable",(e,t)=>{ai.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ms(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new Bu({type:"nullable",innerType:e})}var Ju=m("ZodDefault",(e,t)=>{ui.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Js(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Wu(e,t){return new Ju({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var Ku=m("ZodPrefault",(e,t)=>{li.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ws(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Vu(e,t){return new Ku({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var gc=m("ZodNonOptional",(e,t)=>{pi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Us(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Gu(e,t){return new gc({type:"nonoptional",innerType:e,...$.normalizeParams(t)})}var Hu=m("ZodCatch",(e,t)=>{di.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ks(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Xu(e,t){return new Hu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:$.constantCatch(t)})}var qu=m("ZodPipe",(e,t)=>{fi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vs(e,r,n,o),e.in=t.in,e.out=t.out});function dc(e,t){return new qu({type:"pipe",in:e,out:t})}var Yu=m("ZodReadonly",(e,t)=>{mi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Qu(e){return new Yu({type:"readonly",innerType:e})}var el=m("ZodFunction",(e,t)=>{hi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cs(e,r,n,o)});function W(e){return new el({type:"function",input:Array.isArray(e?.input)?Fu(e?.input):e?.input??I(bt()),output:e?.output??bt()})}var tl=m("ZodCustom",(e,t)=>{gi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>As(e,r,n,o)});function rl(e,t={}){return ss(tl,e,t)}function nl(e,t){return cs(e,t)}var Cr=F({id:p().min(1),title:p().min(1),concept:p().optional(),targetFile:p().optional(),targetSymbol:p().optional(),symbol:p().optional(),instructions:ae([p(),I(p())]),hint:p().optional(),testNames:I(p()).optional()}),$e=M(["js","ts","cpp","py","sql"]);var wd=F({language:$e.default("js"),files:S(p(),p()).default({}),starterFiles:S(p(),p()).optional(),solutionFiles:S(p(),p()).optional(),entry:p().optional(),testEntry:p().optional()}),kd=F({steps:I(Cr).default([]),stepIndex:P().int().nonnegative().default(0),mode:M(["guided","sandbox"]).default("guided"),language:$e.optional(),lang:$e.optional(),starterFiles:S(p(),p()).optional(),solutionFiles:S(p(),p()).optional(),tsStarterFiles:S(p(),p()).optional(),tsSolutionFiles:S(p(),p()).optional(),tsFiles:S(p(),p()).optional(),cppStarterFiles:S(p(),p()).optional(),cppSolutionFiles:S(p(),p()).optional(),cppFiles:S(p(),p()).optional(),pyStarterFiles:S(p(),p()).optional(),pySolutionFiles:S(p(),p()).optional(),pyFiles:S(p(),p()).optional(),pyEntry:p().optional(),pyTestEntry:p().optional(),pyTestCode:p().optional(),summary:p().optional(),onStepComplete:W({input:[Cr,P()],output:J()}).optional(),onLabComplete:W({input:[p()],output:J()}).optional()}),Pd=F({stage:M(["downloading","caching","extracting","compiling","linking","ready","error"]),loadedBytes:P().optional(),totalBytes:P().optional(),percent:P().optional(),message:p().optional()}),Zd=F({toolchainUrl:p().optional(),clangWasmUrl:p().optional(),clangUrl:p().optional(),lldWasmUrl:p().optional(),lldUrl:p().optional(),sysrootTarUrl:p().optional(),sysrootUrl:p().optional(),cacheInIndexedDB:D().default(!0),preload:D().default(!1),std:M(["c++17","c++20","c++23"]).default("c++20"),optLevel:M(["-O0","-O1","-O2","-O3"]).default("-O2"),flags:I(p()).default(["-O2","-Wall","-Wextra"]),headers:S(p(),p()).optional(),extraHeaders:S(p(),p()).optional(),files:S(p(),p()).optional(),starterFiles:S(p(),p()).optional(),solutionFiles:S(p(),p()).optional(),onProgress:W({input:[L()],output:J()}).optional()}),Od=F({stage:M(["downloading","caching","extracting","initializing","ready","error"]),loadedBytes:P().optional(),totalBytes:P().optional(),percent:P().optional(),message:p().optional()}),_c=F({cdnBaseUrl:p().optional(),indexUrl:p().optional(),pyodideIndexUrl:p().optional(),cacheInIndexedDB:D().default(!0),preload:D().default(!1),activate:D().optional(),entry:p().default("main.py"),testEntry:p().default("test.py"),packages:I(p()).optional(),preloadPackages:I(p()).optional(),compilerMemoryLimitMb:P().optional(),files:S(p(),p()).optional(),starterFiles:S(p(),p()).optional(),solutionFiles:S(p(),p()).optional(),onProgress:W({input:[L()],output:J()}).optional()}),ol=M(["connecting","metadata","downloading","mounting","ready","error"]),Ed=F({phase:ol,message:p(),loaded:P().optional(),total:P().optional()}),Td=F({intoRoot:D().default(!0),targetDir:p().default("/workspace"),branch:p().optional(),depth:P().int().positive().optional(),maxFiles:P().int().positive().default(2e3),maxFileSize:P().int().positive().default(5*1024*1024),concurrency:P().int().positive().default(8),clearExisting:D().default(!1),onProgress:W({input:[L()],output:J()}).optional(),fetchImpl:L().optional()}),Ad=F({files:S(p(),p()).optional(),entry:p().optional(),mode:M(["run","test","repl"]).default("run"),replCode:p().optional(),printReplResult:D().optional(),testFilter:ae([p(),I(p()),Tr()]).optional(),timeoutMs:P().positive().default(3e4),maxOutputBytes:P().positive().default(256*1024),maxConsoleCalls:P().positive().default(5e3),instanceId:p().optional(),concurrent:D().optional(),argv:ae([I(p()),Tr()]).optional(),pid:P().int().optional(),isBackground:D().optional(),vfs:L().optional(),activePortTable:L().optional(),packages:S(p(),L()).optional(),npmModules:S(p(),L()).optional(),onStdout:W({input:[p()],output:J()}).optional(),onStderr:W({input:[p()],output:J()}).optional(),onTestResult:W({input:[L()],output:J()}).optional()}),Cd=F({version:P().default(1),timestamp:P().optional(),files:S(p(),p()),openTabs:I(p()).default([]),activeFile:p().nullable().optional(),mode:M(["guided","sandbox"]).optional(),lang:$e.optional(),labId:p().optional()}),Id=F({id:p().optional(),labId:p().optional(),buildId:p().optional(),title:p().default("code-lab"),summary:p().optional(),theme:M(["dark","light","high-contrast","auto"]).default("auto"),persistState:D().default(!0),repo:p().optional(),githubRepo:p().optional(),branch:p().optional(),files:S(p(),p()).default({}),entry:p().default("demo.js"),testEntry:p().default("test.js"),testFile:p().optional(),backLabel:p().default("Back"),monacoUrl:p().optional(),previewOrigin:p().optional(),logger:L().optional(),debug:D().optional(),onClose:W({input:[],output:J()}).optional(),onRun:W({input:[L()],output:J()}).optional(),onTestResult:W({input:[L()],output:J()}).optional(),onCodeChange:W({input:[p(),p()],output:J()}).optional(),plugins:I(L()).optional(),extensions:I(L()).optional(),steps:I(Cr).optional(),starterFiles:S(p(),p()).optional(),solutionFiles:S(p(),p()).optional(),tsFiles:S(p(),p()).optional(),tsStarterFiles:S(p(),p()).optional(),tsSolutionFiles:S(p(),p()).optional(),cppFiles:S(p(),p()).optional(),cppStarterFiles:S(p(),p()).optional(),cppSolutionFiles:S(p(),p()).optional(),pyFiles:S(p(),p()).optional(),pyStarterFiles:S(p(),p()).optional(),pySolutionFiles:S(p(),p()).optional(),pyEntry:p().optional().default("main.py"),pyTestEntry:p().optional().default("test.py"),pyTestCode:p().optional(),showWebPreview:D().optional(),stdin:p().optional(),guided:L().optional(),mode:M(["guided","sandbox"]).optional(),language:$e.optional(),lang:$e.optional(),showLanguageSelector:D().optional(),sqlDialect:M(["postgres","sqlite"]).optional(),sqlFiles:S(p(),p()).optional(),settings:S(p(),L()).optional(),userSettings:S(p(),L()).optional(),defaultSettings:S(p(),L()).optional(),config:S(p(),L()).optional(),overrides:S(p(),L()).optional(),lockSettings:D().optional(),stepIndex:P().int().optional(),onStepComplete:W({input:[L(),P()],output:J()}).optional(),onLabComplete:W({input:[p()],output:J()}).optional()}),Nd=F({query:p().default(""),caseSensitive:D().optional().default(!1),wholeWord:D().optional().default(!1),regex:D().optional().default(!1),isRegex:D().optional().default(!1),include:p().optional(),includeGlob:p().optional(),includePattern:ae([p(),I(p())]).optional(),exclude:p().optional(),excludeGlob:p().optional(),excludePattern:ae([p(),I(p())]).optional(),maxMatches:P().int().positive().optional(),maxMatchesPerFile:P().int().positive().optional()}),il=M(["error","warning","info","hint"]),Rd=F({id:p(),file:p(),line:P().int(),col:P().int().optional(),column:P().int().optional(),endLine:P().int().optional(),endCol:P().int().optional(),endColumn:P().int().optional(),message:p(),severity:il,source:p().optional(),code:ae([p(),P()]).optional(),tags:I(p()).optional()}),Dd=F({id:p(),name:p(),files:S(p(),p()),updatedAt:P(),createdAt:P().optional(),entry:p().optional(),testEntry:p().optional(),version:P().optional()}),sl=M(["modified","added","deleted","untracked"]),We=F({path:p(),status:sl,staged:D(),oldContent:p().optional(),newContent:p().optional()}),Ld=F({branch:p().default("main"),headCommit:p().optional(),branches:I(p()).default(["main"]),staged:I(We).default([]),unstaged:I(We).default([]),untracked:I(We).default([]),modified:I(We).optional(),deleted:I(We).optional(),hasChanges:D().default(!1),isClean:D().default(!0),ahead:P().int().default(0),behind:P().int().default(0)});var vt=class{count=0;onResult;constructor(t){this.onResult=t||null}parseLine(t){let r=String(t||"").trim(),n="__CODELAB_TEST__:",o=r.indexOf(n);if(o===-1)return null;let i=r.slice(o+n.length).trim();try{let s=JSON.parse(i);this.count++;let c={index:typeof s.index=="number"?s.index:this.count,name:String(s.name||`Test #${this.count}`),status:s.passed?"pass":"fail",passed:!!s.passed,durationMs:typeof s.durationMs=="number"?s.durationMs:0,error:s.error||null};return this.onResult&&this.onResult(c),c}catch(s){return null}}};var zc="https://cdn.jsdelivr.net/pyodide/v0.27.2/full/",cl={latest:"https://cdn.jsdelivr.net/pyodide/v0.27.2/full/",v0_26:"https://cdn.jsdelivr.net/pyodide/v0.26.4/full/"},St={"/usr/lib/python/codelab_dsa.py":`# CodeLab <codelab_dsa.py> - Data Structures & Algorithms Utilities
|
|
57
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}c.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function ds(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;ds(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var fs=new Set(["type","properties","required","additionalProperties"]),ls=["oneOf","anyOf"];function ps(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function $r(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!fs.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let u of t){let l=u.properties?.[s]??ps(u);l!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(l))||c.push(l))}let a=c.length===1?c[0]:$r(c)??{allOf:c};q(r,s,a)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=ps(s);c&&!i.some(a=>JSON.stringify(a)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function Ma(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of fs)if(o in e)return;let r=t.filter(o=>ls.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=$r(t);else{let o=r[0],i=ls.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let s=t.filter(a=>a!==o),c=o[i].map(a=>$r([...s,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Be(e,n))}function kr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=c=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,l={...u},p=a.ref;if(a.ref=null,p){n(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Be(u,g),Be(u,l),c._zod.parent===p)for(let z in u)z==="$ref"||z==="allOf"||z in l||delete u[z];if(g.$ref&&f.def)for(let z in u)z==="$ref"||z==="allOf"||z in f.def&&JSON.stringify(u[z])===JSON.stringify(f.def[z])&&delete u[z]}let h=c._zod.parent;if(h&&h!==p){n(h);let f=e.seen.get(h);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let g in u)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g])&&delete u[g]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())ds(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let p=c.get(l);p?p.push(u):c.set(l,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])Ma(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Be(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,q(s,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Je(t,"input",e.processors),output:Je(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function J(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return J(n.element,r);if(n.type==="set")return J(n.valueType,r);if(n.type==="lazy")return J(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return J(n.innerType,r);if(n.type==="intersection")return J(n.left,r)||J(n.right,r);if(n.type==="record"||n.type==="map")return J(n.keyType,r)||J(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:J(n.in,r)||J(n.out,r);if(n.type==="object"){for(let o in n.shape)if(J(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(J(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(J(o,r))return!0;return!!(n.rest&&J(n.rest,r))}return!1}var ms=(e,t={})=>r=>{let n=Sr({...r,processors:t});return N(e,n),wr(n,e),kr(n,e)},Je=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=Sr({...o??{},target:i,io:t,processors:r});return N(e,s),wr(s,e),kr(s,e)};var $e=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Se=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},hs=(e,t)=>{$e(e,"minimum",t),Se(e,"maximum",t)},xs=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},zs=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},bs=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},vs=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},gs=(e,t)=>$e(e,"minimum",t.minimum),_s=(e,t)=>Se(e,"maximum",t.maximum),ys=e=>(t,r)=>{vs(t,r.format);let[n,o]=e[r.format];$e(t,"minimum",n),Se(t,"maximum",o)},Ua={greater_than:(e,t)=>$e(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Se(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>xs(e,t.value),number_format:ys(Oe),bigint_format:ys(Qe),min_length:gs,max_length:_s,length_equals:(e,t)=>hs(e,t.length),min_size:gs,max_size:_s,size_equals:(e,t)=>hs(e,t.size),string_format:(e,t)=>{vs(e,t.format),t.pattern&&zs(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>bs(e,t.mime)};function H(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)Ua[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&$e(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&$e(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Se(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Se(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&xs(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&bs(t,o.mime);for(let i of o.patterns??[])zs(t,i);return t}var Ba={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ja=new Map([[or,Tn],[dt,An]]),$s=e=>Ja.get(e)??e,Ss=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:u,laxFormat:l}=H(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),c&&(o.format=Ba[c]??c,o.format===""&&delete o.format,(c==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),a&&a.size>0){let p=[...a].map($s);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},ws=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:l}=H(e);o.type=l?"integer":"number";let p=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),h=typeof a=="number"&&a<=(s??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(p?f?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),h?f?(o.maximum=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof s=="number"&&(o.maximum=s),c){let g=new Set;for(let y of c)Number.isFinite(y)&&y!==0?g.add(Math.abs(y)):oe(e,t,o,n,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[_,...z]=g;_!==void 0&&(o.multipleOf=_),z.length&&(o.allOf=[...o.allOf??[],...z.map(y=>({multipleOf:y}))])}},ks=(e,t,r,n)=>{r.type="boolean"};var Ps=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var Zs=(e,t,r,n)=>{oe(e,t,r,n,"Void cannot be represented in JSON Schema")},Es=(e,t,r,n)=>{r.not={}},Os=(e,t,r,n)=>{},Ts=(e,t,r,n)=>{};var As=(e,t,r,n)=>{let o=e._zod.def,i=ye(o.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i};var Cs=(e,t,r,n)=>{oe(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Is=(e,t,r,n)=>{oe(e,t,r,n,"Function types cannot be represented in JSON Schema")},Ns=(e,t,r,n)=>{oe(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Rs=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=H(e);typeof s=="number"&&(o.minItems=s),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=N(i.element,t,{...n,path:[...n.path,"items"]})};function We(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?We(t.out):t.type==="catch"?We(t.innerType):e._zod.optin}var Ls=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&oe(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)q(o.properties,u,N(s[u],t,{...n,path:[...n.path,"properties",u]}));let a=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?We(l)===void 0:l._zod.optout===void 0)&&a.push(u)}a.length>0&&(o.required=a),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=N(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Ds=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,a)=>N(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=s:r.anyOf=s},Fs=(e,t,r,n)=>{let o=e._zod.def,i=N(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=N(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)},js=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((_,z)=>N(_,t,{...n,path:[...n.path,s,z]})),u=i.rest?N(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let _=i.items[l-1];if(!(t.io==="input"?We(_)!==void 0:_._zod.optout==="optional"))break;l--}let p=i.items.length,h=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=a,h?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),h&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:a},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),h&&(o.maxItems=p)):(o.items=a,h?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),h&&(o.maxItems=p));let{minimum:f,maximum:g}=H(e);typeof f=="number"&&(o.minItems=f),typeof g=="number"&&(o.maxItems=g)};function Pr(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let _=Pr(e,g,r);return _===g?t:_}for(let g of["anyOf","oneOf"]){let _=t[g];if(!Array.isArray(_))continue;let z=_.map(y=>Pr(e,y,r));z.some((y,S)=>y!==_[S])&&(t={...t,[g]:z})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:l,format:p,id:h,...f}=t;return f.enum?f.enum=f.enum.map(g=>typeof g=="number"?String(g):g):typeof f.const=="number"&&(f.const=String(f.const)),o&&(f.type="string",i||(f.pattern=(n.includes("number")?Re:Yt).source)),f}var Zr=new WeakMap;function Wa(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Zr.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=Pr(t,i,new Set);s!==i&&r.set(i,s)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}var Ms=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=H(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=N(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)q(o.patternProperties,$s(p).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=N(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Zr.get(t);l||(l=[],Zr.set(t,l),t.deferred.push(()=>Wa(t))),l.push(e)}o.additionalProperties=N(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=s._zod.values,u=t.io==="input"&&We(i.valueType)!==void 0;if(a&&!i.partial&&!u){let l=[...a].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(o.required=l.map(String))}},Us=(e,t,r,n)=>{let o=e._zod.def,i=N(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Bs=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Er=Symbol();function Js(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(oe(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Er):JSON.parse(s)}var Ws=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Js(o.defaultValue,e,t,r,n);s!==Er&&(r.default=s)},Ks=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Js(o.defaultValue,e,t,r,n);s!==Er&&(r._prefault=s)},Vs=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{oe(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Gs=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;N(s,t,n);let c=t.seen.get(e);c.ref=s},Hs=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var Or=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var Xs=new WeakSet([Object.prototype,Error.prototype]);function vt(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Qa=(e,t)=>{nn.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Xs.has(r)||(Xs.add(r),vt(r,"format",n=>o=>sn(n,o)),vt(r,"flatten",n=>o=>on(n,o)),vt(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,xe,2)}),vt(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,xe,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var X=m("ZodError",Qa,void 0,{Parent:Error});var qs=Ie(X),Ys=Ne(X),Qs=ot(X),ec=it(X),tc=an(X),rc=un(X),nc=ln(X),oc=pn(X),ic=dn(X),sc=fn(X),cc=mn(X),ac=hn(X);function tu(){B.localeError||G(vi())}function Ke(){B.memoizer||G({memoizer:bi()})}var A=m("ZodType",(e,t)=>(tu(),T.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(w.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Y(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(rl(e,t))},superRefine(e,t){return this.check(nl(e,t))},overwrite(e){return this.check(ae(e))},optional(){return pc(this)},exactOptional(){return Uu(this)},nullable(){return dc(this)},nullish(){return pc(dc(this))},nonoptional(e){return Gu(this,e)},array(){return I(this)},or(e){return ue([this,e])},and(e){return Lu(this,e)},transform(e){return fc(this,Mu(e))},default(e){return Wu(this,e)},prefault(e){return Vu(this,e)},catch(e){return Xu(this,e)},pipe(e){return fc(this,e)},readonly(){return Qu(this)},describe(e){let t=this.clone();return fe.add(t,{description:e}),t},meta(...e){if(e.length===0)return fe.get(this);let t=this.clone();return fe.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return w.hide(this,"~standard",{...nr(this),jsonSchema:{input:Je(this,"input"),output:Je(this,"output")}})},set"~standard"(e){w.own(this,"~standard",e)},parse:function e(t,r){return qs(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Ys(this,t,r,{callee:e})},safeParse(e,t){return Qs(this,e,t)},async safeParseAsync(e,t){return ec(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){w.own(this,"spa",e)},validate(e,t){return Gt(this,e,t)},validateAsync(e,t){return Ht(this,e,t)},encode:function e(t,r){return tc(this,t,r,{callee:e})},decode:function e(t,r){return rc(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await nc(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await oc(this,t,r,{callee:e})},safeEncode(e,t){return ic(this,e,t)},safeDecode(e,t){return sc(this,e,t)},async safeEncodeAsync(e,t){return cc(this,e,t)},async safeDecodeAsync(e,t){return ac(this,e,t)},toJSONSchema(e){return ms(this,{})(e)},get description(){return fe.get(this)?.description},get _def(){return this._zod.def}}),mc=m("_ZodString",(e,t)=>{pt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ss(e,r,n,o)},w.derived({format:e=>H(e).format??null,minLength:e=>H(e).minimum??null,maxLength:e=>H(e).maximum??null},{regex(...e){return this.check(dr(...e))},includes(...e){return this.check(hr(...e))},startsWith(...e){return this.check(gr(...e))},endsWith(...e){return this.check(_r(...e))},min(...e){return this.check(ve(...e))},max(...e){return this.check(zt(...e))},length(...e){return this.check(bt(...e))},nonempty(...e){return this.check(ve(1,...e))},lowercase(e){return this.check(fr(e))},uppercase(e){return this.check(mr(e))},trim(){return this.check(xr())},normalize(...e){return this.check(yr(...e))},toLowerCase(){return this.check(zr())},toUpperCase(){return this.check(br())},slugify(){return this.check(vr())}})),ru=m("ZodString",(e,t)=>{pt.init(e,t),mc.init(e,t)},{email(e){return this.check(ki(cu,e))},url(e){return this.check(Ai(uu,e))},jwt(e){return this.check(Vi(Su,e))},emoji(e){return this.check(Ci(lu,e))},guid(e){return this.check(Pi(au,e))},uuid(e){return this.check(Zi($t,e))},uuidv4(e){return this.check(Ei($t,e))},uuidv6(e){return this.check(Oi($t,e))},uuidv7(e){return this.check(Ti($t,e))},nanoid(e){return this.check(Ii(pu,e))},cuid(e){return this.check(Ni(du,e))},cuid2(e){return this.check(Ri(fu,e))},ulid(e){return this.check(Li(mu,e))},base64(e){return this.check(Ji(bu,e))},base64url(e){return this.check(Wi(vu,e))},xid(e){return this.check(Di(hu,e))},ksuid(e){return this.check(Fi(gu,e))},ipv4(e){return this.check(ji(_u,e))},ipv6(e){return this.check(Mi(yu,e))},cidrv4(e){return this.check(Ui(xu,e))},cidrv6(e){return this.check(Bi(zu,e))},e164(e){return this.check(Ki($u,e))},datetime(e){return this.check(Gi(nu,e))},date(e){return this.check(Hi(ou,e))},time(e){return this.check(Xi(iu,e))},duration(e){return this.check(qi(su,e))}});function d(e){return wi(ru,e)}var R=m("ZodStringFormat",(e,t)=>{C.init(e,t),mc.init(e,t)}),nu=m("ZodISODateTime",(e,t)=>{Ao.init(e,t),R.init(e,t)}),ou=m("ZodISODate",(e,t)=>{Co.init(e,t),R.init(e,t)}),iu=m("ZodISOTime",(e,t)=>{Io.init(e,t),R.init(e,t)}),su=m("ZodISODuration",(e,t)=>{No.init(e,t),R.init(e,t)}),cu=m("ZodEmail",(e,t)=>{bo.init(e,t),R.init(e,t)});var au=m("ZodGUID",(e,t)=>{xo.init(e,t),R.init(e,t)});var $t=m("ZodUUID",(e,t)=>{zo.init(e,t),R.init(e,t)});var uu=m("ZodURL",(e,t)=>{So.init(e,t),R.init(e,t)});var lu=m("ZodEmoji",(e,t)=>{wo.init(e,t),R.init(e,t)});var pu=m("ZodNanoID",(e,t)=>{ko.init(e,t),R.init(e,t)});var du=m("ZodCUID",(e,t)=>{Po.init(e,t),R.init(e,t)});var fu=m("ZodCUID2",(e,t)=>{Zo.init(e,t),R.init(e,t)});var mu=m("ZodULID",(e,t)=>{Eo.init(e,t),R.init(e,t)});var hu=m("ZodXID",(e,t)=>{Oo.init(e,t),R.init(e,t)});var gu=m("ZodKSUID",(e,t)=>{To.init(e,t),R.init(e,t)});var _u=m("ZodIPv4",(e,t)=>{Ro.init(e,t),R.init(e,t)});var yu=m("ZodIPv6",(e,t)=>{Do.init(e,t),R.init(e,t)});var xu=m("ZodCIDRv4",(e,t)=>{Fo.init(e,t),R.init(e,t)});var zu=m("ZodCIDRv6",(e,t)=>{jo.init(e,t),R.init(e,t)});var bu=m("ZodBase64",(e,t)=>{Uo.init(e,t),R.init(e,t)});var vu=m("ZodBase64URL",(e,t)=>{Bo.init(e,t),R.init(e,t)});var $u=m("ZodE164",(e,t)=>{Jo.init(e,t),R.init(e,t)});var Su=m("ZodJWT",(e,t)=>{Wo.init(e,t),R.init(e,t)});var hc=m("ZodNumber",(e,t)=>{ir.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ws(e,r,n,o),e.isFinite=!0},w.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=H(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=H(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=H(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>H(e).format??null},{gt(e,t){return this.check(yt(e,t))},gte(e,t){return this.check(Ue(e,t))},min(e,t){return this.check(Ue(e,t))},lt(e,t){return this.check(_t(e,t))},lte(e,t){return this.check(Me(e,t))},max(e,t){return this.check(Me(e,t))},int(e){return this.check(uc(e))},safe(e){return this.check(uc(e))},positive(e){return this.check(yt(0,e))},nonnegative(e){return this.check(Ue(0,e))},negative(e){return this.check(_t(0,e))},nonpositive(e){return this.check(Me(0,e))},multipleOf(e,t){return this.check(xt(e,t))},step(e,t){return this.check(xt(e,t))},finite(){return this}}));function Z(e){return Yi(hc,e)}var wu=m("ZodNumberFormat",(e,t)=>{Ko.init(e,t),hc.init(e,t)});function uc(e){return Qi(wu,e)}var ku=m("ZodBoolean",(e,t)=>{Vo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ks(e,r,n,o)});function L(e){return es(ku,e)}var Pu=m("ZodNull",(e,t)=>{Go.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ps(e,r,n,o)});function Cr(e){return ts(Pu,e)}var Zu=m("ZodAny",(e,t)=>{Ho.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Os(e,r,n,o)});function D(){return rs(Zu)}var Eu=m("ZodUnknown",(e,t)=>{Xo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ts(e,r,n,o)});function St(){return ns(Eu)}var Ou=m("ZodNever",(e,t)=>{qo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Es(e,r,n,o)});function Tu(e){return os(Ou,e)}var Au=m("ZodVoid",(e,t)=>{Yo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zs(e,r,n,o)});function W(e){return is(Au,e)}var Cu=m("ZodArray",(e,t)=>{Ke(),Qo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rs(e,r,n,o),e.element=t.element},{min(e,t){return this.check(ve(e,t))},nonempty(e){return this.check(ve(1,e))},max(e,t){return this.check(zt(e,t))},length(e,t){return this.check(bt(e,t))},unwrap(){return this.element}});function I(e,t){return ss(Cu,e,t)}var Iu=m("ZodObject",(e,t)=>{Ke(),ri.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ls(e,r,n,o),w.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return U(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(w.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(w.mergeDefs(this._zod.def,{catchall:St()}))},loose(){return this.clone(w.mergeDefs(this._zod.def,{catchall:St()}))},strict(){return this.clone(w.mergeDefs(this._zod.def,{catchall:Tu()}))},strip(){return this.clone(w.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return w.extend(this,e)},safeExtend(e){return w.safeExtend(this,e)},merge(e){return w.merge(this,e)},pick(e){return w.pick(this,e)},omit(e){return w.omit(this,e)},partial(...e){return w.partial(Ir,this,e[0])},exactPartial(...e){return w.partial(gc,this,e[0],"exactPartial")},required(...e){return w.required(_c,this,e[0])}});function j(e,t){let r={type:"object",shape:e??{},...w.normalizeParams(t)};return new Iu(r)}var Nu=m("ZodUnion",(e,t)=>{ni.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ds(e,r,n,o),e.options=t.options});function ue(e,t){return new Nu({type:"union",options:e,...w.normalizeParams(t)})}var Ru=m("ZodIntersection",(e,t)=>{oi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fs(e,r,n,o)});function Lu(e,t){return new Ru({type:"intersection",left:e,right:t})}var Du=m("ZodTuple",(e,t)=>{Ke(),sr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>js(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Ir({type:"optional",innerType:t}))})}});function Fu(e,t,r){let n=t instanceof T,o=n?r:t,i=n?t:null;return new Du({type:"tuple",items:e,rest:i,...w.normalizeParams(o)})}var lc=m("ZodRecord",(e,t)=>{Ke(),ii.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ms(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function k(e,t,r){return!t||!t._zod?new lc({type:"record",keyType:d(),valueType:e,...w.normalizeParams(t)}):new lc({type:"record",keyType:e,valueType:t,...w.normalizeParams(r)})}var Ar=m("ZodEnum",(e,t)=>{si.init(e,t),A.init(e,t),e._zod.processJSONSchema=(n,o,i)=>As(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Ar({...t,checks:[],...w.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Ar({...t,checks:[],...w.normalizeParams(o),entries:i})}});function U(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ar({type:"enum",entries:r,...w.normalizeParams(t)})}var ju=m("ZodTransform",(e,t)=>{Ke(),ci.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ns(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new be(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(w.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push(w.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Mu(e){return new ju({type:"transform",transform:e})}var Ir=m("ZodOptional",(e,t)=>{cr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Or(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new Ir({type:"optional",innerType:e})}var gc=m("ZodExactOptional",(e,t)=>{ai.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Or(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Uu(e){return new gc({type:"optional",innerType:e})}var Bu=m("ZodNullable",(e,t)=>{ui.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Us(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new Bu({type:"nullable",innerType:e})}var Ju=m("ZodDefault",(e,t)=>{li.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ws(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Wu(e,t){return new Ju({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var Ku=m("ZodPrefault",(e,t)=>{pi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ks(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Vu(e,t){return new Ku({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var _c=m("ZodNonOptional",(e,t)=>{di.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Gu(e,t){return new _c({type:"nonoptional",innerType:e,...w.normalizeParams(t)})}var Hu=m("ZodCatch",(e,t)=>{fi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Xu(e,t){return new Hu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:w.constantCatch(t)})}var qu=m("ZodPipe",(e,t)=>{mi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gs(e,r,n,o),e.in=t.in,e.out=t.out});function fc(e,t){return new qu({type:"pipe",in:e,out:t})}var Yu=m("ZodReadonly",(e,t)=>{hi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Qu(e){return new Yu({type:"readonly",innerType:e})}var el=m("ZodFunction",(e,t)=>{gi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Is(e,r,n,o)});function K(e){return new el({type:"function",input:Array.isArray(e?.input)?Fu(e?.input):e?.input??I(St()),output:e?.output??St()})}var tl=m("ZodCustom",(e,t)=>{_i.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cs(e,r,n,o)});function rl(e,t={}){return cs(tl,e,t)}function nl(e,t){return as(e,t)}var Nr=j({id:d().min(1),title:d().min(1),concept:d().optional(),targetFile:d().optional(),targetSymbol:d().optional(),symbol:d().optional(),instructions:ue([d(),I(d())]),hint:d().optional(),testNames:I(d()).optional()}),we=U(["js","ts","cpp","py","sql"]);var wd=j({language:we.default("js"),files:k(d(),d()).default({}),starterFiles:k(d(),d()).optional(),solutionFiles:k(d(),d()).optional(),entry:d().optional(),testEntry:d().optional()}),kd=j({steps:I(Nr).default([]),stepIndex:Z().int().nonnegative().default(0),mode:U(["guided","sandbox"]).default("guided"),language:we.optional(),lang:we.optional(),starterFiles:k(d(),d()).optional(),solutionFiles:k(d(),d()).optional(),tsStarterFiles:k(d(),d()).optional(),tsSolutionFiles:k(d(),d()).optional(),tsFiles:k(d(),d()).optional(),cppStarterFiles:k(d(),d()).optional(),cppSolutionFiles:k(d(),d()).optional(),cppFiles:k(d(),d()).optional(),pyStarterFiles:k(d(),d()).optional(),pySolutionFiles:k(d(),d()).optional(),pyFiles:k(d(),d()).optional(),pyEntry:d().optional(),pyTestEntry:d().optional(),pyTestCode:d().optional(),summary:d().optional(),onStepComplete:K({input:[Nr,Z()],output:W()}).optional(),onLabComplete:K({input:[d()],output:W()}).optional()}),Pd=j({stage:U(["downloading","caching","extracting","compiling","linking","ready","error"]),loadedBytes:Z().optional(),totalBytes:Z().optional(),percent:Z().optional(),message:d().optional()}),Zd=j({toolchainUrl:d().optional(),clangWasmUrl:d().optional(),clangUrl:d().optional(),lldWasmUrl:d().optional(),lldUrl:d().optional(),sysrootTarUrl:d().optional(),sysrootUrl:d().optional(),cacheInIndexedDB:L().default(!0),preload:L().default(!1),std:U(["c++17","c++20","c++23"]).default("c++20"),optLevel:U(["-O0","-O1","-O2","-O3"]).default("-O2"),flags:I(d()).default(["-O2","-Wall","-Wextra"]),headers:k(d(),d()).optional(),extraHeaders:k(d(),d()).optional(),files:k(d(),d()).optional(),starterFiles:k(d(),d()).optional(),solutionFiles:k(d(),d()).optional(),onProgress:K({input:[D()],output:W()}).optional()}),Ed=j({stage:U(["downloading","caching","extracting","initializing","ready","error"]),loadedBytes:Z().optional(),totalBytes:Z().optional(),percent:Z().optional(),message:d().optional()}),yc=j({cdnBaseUrl:d().optional(),indexUrl:d().optional(),pyodideIndexUrl:d().optional(),cacheInIndexedDB:L().default(!0),preload:L().default(!1),activate:L().optional(),entry:d().default("main.py"),testEntry:d().default("test.py"),packages:I(d()).optional(),preloadPackages:I(d()).optional(),compilerMemoryLimitMb:Z().optional(),files:k(d(),d()).optional(),starterFiles:k(d(),d()).optional(),solutionFiles:k(d(),d()).optional(),onProgress:K({input:[D()],output:W()}).optional()}),ol=U(["connecting","metadata","downloading","mounting","ready","error"]),Od=j({phase:ol,message:d(),loaded:Z().optional(),total:Z().optional()}),Td=j({intoRoot:L().default(!0),targetDir:d().default("/workspace"),branch:d().optional(),depth:Z().int().positive().optional(),maxFiles:Z().int().positive().default(2e3),maxFileSize:Z().int().positive().default(5*1024*1024),concurrency:Z().int().positive().default(8),clearExisting:L().default(!1),onProgress:K({input:[D()],output:W()}).optional(),fetchImpl:D().optional()}),Ad=j({files:k(d(),d()).optional(),entry:d().optional(),mode:U(["run","test","repl"]).default("run"),replCode:d().optional(),printReplResult:L().optional(),testFilter:ue([d(),I(d()),Cr()]).optional(),timeoutMs:Z().positive().default(3e4),maxOutputBytes:Z().positive().default(256*1024),maxConsoleCalls:Z().positive().default(5e3),instanceId:d().optional(),concurrent:L().optional(),argv:ue([I(d()),Cr()]).optional(),pid:Z().int().optional(),isBackground:L().optional(),vfs:D().optional(),activePortTable:D().optional(),packages:k(d(),D()).optional(),npmModules:k(d(),D()).optional(),onStdout:K({input:[d()],output:W()}).optional(),onStderr:K({input:[d()],output:W()}).optional(),onTestResult:K({input:[D()],output:W()}).optional()}),Cd=j({version:Z().default(1),timestamp:Z().optional(),files:k(d(),d()),openTabs:I(d()).default([]),activeFile:d().nullable().optional(),mode:U(["guided","sandbox"]).optional(),lang:we.optional(),labId:d().optional()}),Id=j({id:d().optional(),labId:d().optional(),buildId:d().optional(),title:d().default("code-lab"),summary:d().optional(),theme:U(["dark","light","high-contrast","auto"]).default("auto"),persistState:L().default(!0),repo:d().optional(),githubRepo:d().optional(),branch:d().optional(),files:k(d(),d()).default({}),entry:d().default("demo.js"),testEntry:d().default("test.js"),testFile:d().optional(),backLabel:d().default("Back"),monacoUrl:d().optional(),previewOrigin:d().optional(),logger:D().optional(),debug:L().optional(),onClose:K({input:[],output:W()}).optional(),onRun:K({input:[D()],output:W()}).optional(),onTestResult:K({input:[D()],output:W()}).optional(),onCodeChange:K({input:[d(),d()],output:W()}).optional(),plugins:I(D()).optional(),extensions:I(D()).optional(),steps:I(Nr).optional(),starterFiles:k(d(),d()).optional(),solutionFiles:k(d(),d()).optional(),tsFiles:k(d(),d()).optional(),tsStarterFiles:k(d(),d()).optional(),tsSolutionFiles:k(d(),d()).optional(),cppFiles:k(d(),d()).optional(),cppStarterFiles:k(d(),d()).optional(),cppSolutionFiles:k(d(),d()).optional(),pyFiles:k(d(),d()).optional(),pyStarterFiles:k(d(),d()).optional(),pySolutionFiles:k(d(),d()).optional(),pyEntry:d().optional().default("main.py"),pyTestEntry:d().optional().default("test.py"),pyTestCode:d().optional(),showWebPreview:L().optional(),stdin:d().optional(),guided:D().optional(),mode:U(["guided","sandbox"]).optional(),language:we.optional(),lang:we.optional(),showLanguageSelector:L().optional(),sqlDialect:U(["postgres","sqlite"]).optional(),sqlFiles:k(d(),d()).optional(),settings:k(d(),D()).optional(),userSettings:k(d(),D()).optional(),defaultSettings:k(d(),D()).optional(),config:k(d(),D()).optional(),overrides:k(d(),D()).optional(),lockSettings:L().optional(),stepIndex:Z().int().optional(),onStepComplete:K({input:[D(),Z()],output:W()}).optional(),onLabComplete:K({input:[d()],output:W()}).optional()}),Nd=j({query:d().default(""),caseSensitive:L().optional().default(!1),wholeWord:L().optional().default(!1),regex:L().optional().default(!1),isRegex:L().optional().default(!1),include:d().optional(),includeGlob:d().optional(),includePattern:ue([d(),I(d())]).optional(),exclude:d().optional(),excludeGlob:d().optional(),excludePattern:ue([d(),I(d())]).optional(),maxMatches:Z().int().positive().optional(),maxMatchesPerFile:Z().int().positive().optional()}),il=U(["error","warning","info","hint"]),Rd=j({id:d(),file:d(),line:Z().int(),col:Z().int().optional(),column:Z().int().optional(),endLine:Z().int().optional(),endCol:Z().int().optional(),endColumn:Z().int().optional(),message:d(),severity:il,source:d().optional(),code:ue([d(),Z()]).optional(),tags:I(d()).optional()}),Ld=j({id:d(),name:d(),files:k(d(),d()),updatedAt:Z(),createdAt:Z().optional(),entry:d().optional(),testEntry:d().optional(),version:Z().optional()}),sl=U(["modified","added","deleted","untracked"]),Ve=j({path:d(),status:sl,staged:L(),oldContent:d().optional(),newContent:d().optional()}),Dd=j({branch:d().default("main"),headCommit:d().optional(),branches:I(d()).default(["main"]),staged:I(Ve).default([]),unstaged:I(Ve).default([]),untracked:I(Ve).default([]),modified:I(Ve).optional(),deleted:I(Ve).optional(),hasChanges:L().default(!1),isClean:L().default(!0),ahead:Z().int().default(0),behind:Z().int().default(0)});var wt=class{count=0;onResult;constructor(t){this.onResult=t||null}parseLine(t){let r=String(t||"").trim(),n="__CODELAB_TEST__:",o=r.indexOf(n);if(o===-1)return null;let i=r.slice(o+n.length).trim();try{let s=JSON.parse(i);this.count++;let c={index:typeof s.index=="number"?s.index:this.count,name:String(s.name||`Test #${this.count}`),status:s.passed?"pass":"fail",passed:!!s.passed,durationMs:typeof s.durationMs=="number"?s.durationMs:0,error:s.error||null};return this.onResult&&this.onResult(c),c}catch(s){return null}}};var bc="https://cdn.jsdelivr.net/pyodide/v0.27.2/full/",cl={latest:"https://cdn.jsdelivr.net/pyodide/v0.27.2/full/",v0_26:"https://cdn.jsdelivr.net/pyodide/v0.26.4/full/"},Pt={"/usr/lib/python/codelab_dsa.py":`# CodeLab <codelab_dsa.py> - Data Structures & Algorithms Utilities
|
|
58
58
|
from typing import Optional, List, Any
|
|
59
59
|
|
|
60
60
|
class ListNode:
|
|
@@ -180,6 +180,27 @@ _SUITE_NAME = "Default Test Suite"
|
|
|
180
180
|
_PASSED_COUNT = 0
|
|
181
181
|
_FAILED_COUNT = 0
|
|
182
182
|
_TOTAL_COUNT = 0
|
|
183
|
+
_TEST_FILTER = None
|
|
184
|
+
|
|
185
|
+
def _set_test_filter(flt) -> None:
|
|
186
|
+
global _TEST_FILTER
|
|
187
|
+
if flt is None:
|
|
188
|
+
_TEST_FILTER = None
|
|
189
|
+
elif isinstance(flt, str):
|
|
190
|
+
tokens = [flt.strip().lower()] if flt.strip() else []
|
|
191
|
+
_TEST_FILTER = tokens or None
|
|
192
|
+
elif isinstance(flt, (list, tuple, set)):
|
|
193
|
+
tokens = [str(x).strip().lower() for x in flt if str(x).strip()]
|
|
194
|
+
_TEST_FILTER = tokens or None
|
|
195
|
+
else:
|
|
196
|
+
_TEST_FILTER = None
|
|
197
|
+
|
|
198
|
+
def _matches_test_filter(name: str) -> bool:
|
|
199
|
+
if not _TEST_FILTER:
|
|
200
|
+
return True
|
|
201
|
+
candidate = f"{_SUITE_NAME} > {name}".lower() if _SUITE_NAME else str(name).lower()
|
|
202
|
+
low_name = str(name).lower()
|
|
203
|
+
return any(tok in low_name or tok in candidate for tok in _TEST_FILTER)
|
|
183
204
|
|
|
184
205
|
def DESCRIBE(name: str):
|
|
185
206
|
global _SUITE_NAME
|
|
@@ -187,6 +208,8 @@ def DESCRIBE(name: str):
|
|
|
187
208
|
|
|
188
209
|
def TEST(name: str, fn: Callable[[], Any]):
|
|
189
210
|
global _PASSED_COUNT, _FAILED_COUNT, _TOTAL_COUNT
|
|
211
|
+
if not _matches_test_filter(name):
|
|
212
|
+
return
|
|
190
213
|
_TOTAL_COUNT += 1
|
|
191
214
|
start = time.perf_counter()
|
|
192
215
|
err_obj = None
|
|
@@ -234,11 +257,12 @@ def CODELAB_TEST_EXIT_CODE() -> int:
|
|
|
234
257
|
return 0 if _FAILED_COUNT == 0 else 1
|
|
235
258
|
|
|
236
259
|
def _reset_codelab_test() -> None:
|
|
237
|
-
global _SUITE_NAME, _PASSED_COUNT, _FAILED_COUNT, _TOTAL_COUNT
|
|
260
|
+
global _SUITE_NAME, _PASSED_COUNT, _FAILED_COUNT, _TOTAL_COUNT, _TEST_FILTER
|
|
238
261
|
_SUITE_NAME = "Default Test Suite"
|
|
239
262
|
_PASSED_COUNT = 0
|
|
240
263
|
_FAILED_COUNT = 0
|
|
241
264
|
_TOTAL_COUNT = 0
|
|
265
|
+
_TEST_FILTER = None
|
|
242
266
|
|
|
243
267
|
from contextlib import contextmanager
|
|
244
268
|
|
|
@@ -273,7 +297,7 @@ test = it
|
|
|
273
297
|
assert_equal = ASSERT_EQ
|
|
274
298
|
assert_true = ASSERT_TRUE
|
|
275
299
|
assert_false = ASSERT_FALSE
|
|
276
|
-
`},al=
|
|
300
|
+
`},al=Pt,me={"collections.deque":{label:"collections.deque",detail:"class collections.deque([iterable[, maxlen]])",documentation:`Double-ended queue with $O(1)$ appends and pops from either end.
|
|
277
301
|
|
|
278
302
|
- Module: \`collections\`
|
|
279
303
|
- append/pop/appendleft/popleft: $O(1)$`,insertText:"from collections import deque\n${1:dq} = deque()",module:"collections",complexity:"O(1) end operations"},"collections.defaultdict":{label:"collections.defaultdict",detail:"class collections.defaultdict(default_factory=None, /[, ...])",documentation:"Dict subclass that calls a factory function to supply missing values.\n\n- Module: `collections`",insertText:"from collections import defaultdict\n${1:d} = defaultdict(${2:list})",module:"collections",complexity:"O(1) average lookup"},"collections.Counter":{label:"collections.Counter",detail:"class collections.Counter([iterable-or-mapping])",documentation:"Dict subclass for counting hashable items.\n\n- Module: `collections`",insertText:"from collections import Counter\n${1:counts} = Counter(${2:items})",module:"collections",complexity:"O(N) initialization"},"heapq.heappush":{label:"heapq.heappush",detail:"heapq.heappush(heap, item)",documentation:`Pushes item onto heap, maintaining the min-heap invariant.
|
|
@@ -294,44 +318,50 @@ assert_false = ASSERT_FALSE
|
|
|
294
318
|
- Complexity: $O(N)$`,insertText:"linked_list_to_list(${1:head})",module:"codelab_dsa",complexity:"O(N)"},"codelab_dsa.build_binary_tree":{label:"build_binary_tree",detail:"build_binary_tree(vals: list[Optional[int]]) -> Optional[TreeNode]",documentation:`Constructs a binary tree level-by-level from a list containing None for null nodes.
|
|
295
319
|
|
|
296
320
|
- Module: \`codelab_dsa\`
|
|
297
|
-
- Complexity: $O(N)$`,insertText:"build_binary_tree([${1:1, 2, 3}])",module:"codelab_dsa",complexity:"O(N)"},"codelab_test.DESCRIBE":{label:"DESCRIBE",detail:"DESCRIBE(name: str)",documentation:"Defines the active test suite description in CodeLab test harness.\n\n- Module: `codelab_test`",insertText:'DESCRIBE("${1:Suite Name}")\n',module:"codelab_test",complexity:"Test Suite Header"},"codelab_test.TEST":{label:"TEST",detail:"TEST(name: str, fn: Callable)",documentation:"Runs a single test case; emits structured __CODELAB_TEST__ telemetry.\n\n- Module: `codelab_test`",insertText:'def test_${1:case}():\n ASSERT_EQ(${2:actual}, ${3:expected})\n\nTEST("${4:description}", test_${1:case})',module:"codelab_test",complexity:"Test Case Runner"},"codelab_test.ASSERT_EQ":{label:"ASSERT_EQ",detail:"ASSERT_EQ(actual, expected, msg=None)",documentation:"Asserts that actual == expected; logs failure message if not.\n\n- Module: `codelab_test`",insertText:"ASSERT_EQ(${1:actual}, ${2:expected})",module:"codelab_test",complexity:"Assertion"},"codelab_test.ASSERT_TRUE":{label:"ASSERT_TRUE",detail:"ASSERT_TRUE(condition, msg=None)",documentation:"Asserts condition is True.\n\n- Module: `codelab_test`",insertText:"ASSERT_TRUE(${1:condition})",module:"codelab_test",complexity:"Assertion"},"codelab_test.ASSERT_FALSE":{label:"ASSERT_FALSE",detail:"ASSERT_FALSE(condition, msg=None)",documentation:"Asserts condition is False.\n\n- Module: `codelab_test`",insertText:"ASSERT_FALSE(${1:condition})",module:"codelab_test",complexity:"Assertion"},"codelab_test.CODELAB_TEST_EXIT_CODE":{label:"CODELAB_TEST_EXIT_CODE",detail:"CODELAB_TEST_EXIT_CODE() -> int",documentation:"Returns 0 if all tests passed, 1 if any failed.\n\n- Module: `codelab_test`",insertText:"sys.exit(CODELAB_TEST_EXIT_CODE())",module:"codelab_test",complexity:"Exit Code"}},
|
|
298
|
-
`);for(let
|
|
299
|
-
${
|
|
300
|
-
\`\`\``},{value:
|
|
301
|
-
`),o=[],i={")":"(","]":"[","}":"{"},s=0,c=0,
|
|
302
|
-
`),l=
|
|
303
|
-
`),r=[],n=0,o=0;for(let i=0;i<t.length;i++){let c=t[i].trim();if(!c){o++,o<=1&&r.length>0&&r.push("");continue}if(o=0,c.startsWith("#")){r.push(" ".repeat(n)+c);continue}/^(?:elif\b|else:|except\b|finally
|
|
321
|
+
- Complexity: $O(N)$`,insertText:"build_binary_tree([${1:1, 2, 3}])",module:"codelab_dsa",complexity:"O(N)"},"codelab_test.DESCRIBE":{label:"DESCRIBE",detail:"DESCRIBE(name: str)",documentation:"Defines the active test suite description in CodeLab test harness.\n\n- Module: `codelab_test`",insertText:'DESCRIBE("${1:Suite Name}")\n',module:"codelab_test",complexity:"Test Suite Header"},"codelab_test.TEST":{label:"TEST",detail:"TEST(name: str, fn: Callable)",documentation:"Runs a single test case; emits structured __CODELAB_TEST__ telemetry.\n\n- Module: `codelab_test`",insertText:'def test_${1:case}():\n ASSERT_EQ(${2:actual}, ${3:expected})\n\nTEST("${4:description}", test_${1:case})',module:"codelab_test",complexity:"Test Case Runner"},"codelab_test.ASSERT_EQ":{label:"ASSERT_EQ",detail:"ASSERT_EQ(actual, expected, msg=None)",documentation:"Asserts that actual == expected; logs failure message if not.\n\n- Module: `codelab_test`",insertText:"ASSERT_EQ(${1:actual}, ${2:expected})",module:"codelab_test",complexity:"Assertion"},"codelab_test.ASSERT_TRUE":{label:"ASSERT_TRUE",detail:"ASSERT_TRUE(condition, msg=None)",documentation:"Asserts condition is True.\n\n- Module: `codelab_test`",insertText:"ASSERT_TRUE(${1:condition})",module:"codelab_test",complexity:"Assertion"},"codelab_test.ASSERT_FALSE":{label:"ASSERT_FALSE",detail:"ASSERT_FALSE(condition, msg=None)",documentation:"Asserts condition is False.\n\n- Module: `codelab_test`",insertText:"ASSERT_FALSE(${1:condition})",module:"codelab_test",complexity:"Assertion"},"codelab_test.CODELAB_TEST_EXIT_CODE":{label:"CODELAB_TEST_EXIT_CODE",detail:"CODELAB_TEST_EXIT_CODE() -> int",documentation:"Returns 0 if all tests passed, 1 if any failed.\n\n- Module: `codelab_test`",insertText:"sys.exit(CODELAB_TEST_EXIT_CODE())",module:"codelab_test",complexity:"Exit Code"}},Rr=null,xc=new WeakSet;function kt(e,t="main.py"){let r=Rr?{...Rr()||{}}:{},n=String(t||"main.py").replace(/^file:\/\/\/workspace\//,"").replace(/^\/workspace\//,"").replace(/^\/+/,"")||"main.py";e&&(r[n]=e);let o=[];for(let[i,s]of Object.entries(r)){if(!/\.py$/i.test(i))continue;let c=i.replace(/\.py$/i,"").replace(/\//g,".");o.push({name:c.split(".").pop()||c,kind:"module",detail:`module ${c}`,doc:`Workspace Python module \`${i}\``,params:[],file:i,line:1,col:1});let a=String(s||"").split(`
|
|
322
|
+
`);for(let u=0;u<a.length;u++){let l=a[u],p=l.match(/^(\s*)(?:async\s+)?def\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(([^)]*)\)(?:\s*->\s*([^:]+))?\s*:/);if(p){let f=p[1].length,g=p[2],_=p[3].trim(),z=p[4]?` -> ${p[4].trim()}`:"",y=_?_.split(",").map(x=>x.trim()).filter(x=>x&&x!=="self"&&x!=="cls"):[],E=(a[u+1]||"").trim().match(/^(?:"""|''')([\s\S]*?)(?:"""|''')?$/);o.push({name:g,kind:f>0?"method":"function",detail:`def ${g}(${_})${z}`,doc:E&&E[1]?E[1].trim():`Defined in \`${i}:${u+1}\``,params:y,file:i,line:u+1,col:l.indexOf(g)+1});continue}let h=l.match(/^\s*class\s+([A-Za-z_][A-Za-z0-9_]*)(?:\(([^)]*)\))?\s*:/);if(h){let f=h[1],g=h[2]?`(${h[2].trim()})`:"";o.push({name:f,kind:"class",detail:`class ${f}${g}`,doc:`Class defined in \`${i}:${u+1}\``,params:[],file:i,line:u+1,col:l.indexOf(f)+1})}}}return o}function Lr(e,t){if(typeof t=="function"&&(Rr=t),!e||!e.languages)return!1;if(xc.has(e))return!0;xc.add(e);try{let r=e.languages.CompletionItemKind||{},n=e.languages.CompletionItemInsertTextRule||{};return e.languages.registerCompletionItemProvider("python",{triggerCharacters:["."," "],provideCompletionItems(o,i){let s=o.getWordUntilPosition(i),c={startLineNumber:i.lineNumber,endLineNumber:i.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},a=typeof o.getValue=="function"?o.getValue():"",u=typeof o.getLineContent=="function"?String(o.getLineContent(i.lineNumber)||"").slice(0,i.column-1):"";if(/self\.[A-Za-z0-9_]*$/.test(u)){let f=new Map,g=/\bself\.([A-Za-z_][A-Za-z0-9_]*)\s*=/g,_;for(;(_=g.exec(a))!==null;)f.set(_[1],{kind:r.Field??4,detail:"instance attribute"});let z=/^\s+def\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(\s*self\b([^)]*)\)/gm;for(;(_=z.exec(a))!==null;)_[1].startsWith("__")||f.set(_[1],{kind:r.Method??0,detail:`method(${_[2].replace(/^\s*,\s*/,"").trim()})`});return{suggestions:Array.from(f.entries()).map(([y,S])=>({label:y,kind:S.kind,detail:S.detail,insertText:S.kind===(r.Method??0)?`${y}($0)`:y,insertTextRules:n.InsertAsSnippet,range:c}))}}let l=new Set,p=Object.keys(me).map(f=>{let g=me[f];return l.add(g.label),{label:g.label,kind:r.Function??1,detail:g.detail,documentation:{value:g.documentation},insertText:g.insertText||g.label,insertTextRules:n.InsertAsSnippet,range:c}}),h=kt(a,o.uri?.path||"main.py");for(let f of h)l.has(f.name)||(l.add(f.name),p.push({label:f.name,kind:f.kind==="class"?r.Class??5:f.kind==="module"?r.Module??8:r.Function??1,detail:f.detail,documentation:{value:f.doc},insertText:f.kind==="function"?`${f.name}(${f.params.length?"$1":""})`:f.name,insertTextRules:n.InsertAsSnippet,range:c}));return{suggestions:p}}}),e.languages.registerHoverProvider("python",{provideHover(o,i){let s=o.getWordAtPosition(i);if(!s)return null;let c=null;for(let l of Object.keys(me))if(l===s.word||l.endsWith("."+s.word)){c=me[l];break}if(c)return{range:{startLineNumber:i.lineNumber,endLineNumber:i.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},contents:[{value:`**${c.label}** \u2014 \`${c.detail}\``},{value:c.documentation}]};let u=kt(o.getValue?.()||"",o.uri?.path||"main.py").find(l=>l.name===s.word&&l.kind!=="module");return u?{range:{startLineNumber:i.lineNumber,endLineNumber:i.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},contents:[{value:`\`\`\`python
|
|
323
|
+
${u.detail}
|
|
324
|
+
\`\`\``},{value:u.doc}]}:null}}),typeof e.languages.registerSignatureHelpProvider=="function"&&e.languages.registerSignatureHelpProvider("python",{signatureHelpTriggerCharacters:["(",","],provideSignatureHelp(o,i){let c=String(o.getLineContent?.(i.lineNumber)||"").slice(0,i.column-1).match(/([A-Za-z_][A-Za-z0-9_]*)\s*\(([^()]*)$/);if(!c)return null;let a=c[1],u=(c[2].match(/,/g)||[]).length,l=Object.keys(me).find(f=>f===a||f.endsWith("."+a));if(l){let f=me[l],g=f.detail.match(/\(([^)]*)\)/)?.[1]||"",_=g?g.split(",").map(z=>({label:z.trim()})):[];return{value:{signatures:[{label:f.detail,documentation:f.documentation,parameters:_}],activeSignature:0,activeParameter:Math.min(u,Math.max(0,_.length-1))},dispose(){}}}let h=kt(o.getValue?.()||"",o.uri?.path||"main.py").find(f=>f.name===a&&(f.kind==="function"||f.kind==="method"));if(h){let f=h.params.map(g=>({label:g}));return{value:{signatures:[{label:h.detail,documentation:h.doc,parameters:f}],activeSignature:0,activeParameter:Math.min(u,Math.max(0,f.length-1))},dispose(){}}}return null}}),typeof e.languages.registerDefinitionProvider=="function"&&e.Uri&&e.languages.registerDefinitionProvider("python",{provideDefinition(o,i){let s=o.getWordAtPosition(i);if(!s)return null;let a=kt(o.getValue?.()||"",o.uri?.path||"main.py").find(l=>l.name===s.word&&l.kind!=="module");return a?{uri:typeof e.Uri.file=="function"?e.Uri.file("/workspace/"+a.file.replace(/^\/+/,"")):o.uri,range:{startLineNumber:a.line,startColumn:a.col,endLineNumber:a.line,endColumn:a.col+a.name.length}}:null}}),!0}catch(r){return typeof console<"u"&&console.warn&&console.warn("[Python Monaco Intelligence Error]:",r),!1}}function vc(e,t="main.py"){let r=[];if(!e||typeof e!="string")return r;let n=e.split(`
|
|
325
|
+
`),o=[],i={")":"(","]":"[","}":"{"},s=0,c=0,a=null;for(let u=0;u<n.length;u++){let l=n[u],p=u+1,h=!1,f="";if(a){let x=l.indexOf(a);if(x===-1)continue;a=null;let b=l.slice(x+3).trim();if(!b||b.startsWith("#"))continue}let g=l.match(/^([ \t]+)/),_=g?g[1].length:0;if(g){let x=g[1];x.includes(" ")&&x.includes(" ")&&r.push({id:`py-tab-space-mix-${p}`,file:t,line:p,startLineNumber:p,col:1,startColumn:1,severity:"warning",message:"Inconsistent use of tabs and spaces in indentation.",source:"python-linter"})}let z=l.trim();s>0&&z&&!z.startsWith("#")&&(_<=c&&r.push({id:`py-indent-error-${p}`,file:t,line:p,startLineNumber:p,col:1,startColumn:1,severity:"error",message:`IndentationError: expected an indented block after statement on line ${s}.`,source:"python-linter"}),s=0);let y=o.length,S=-1;for(let x=0;x<l.length;x++){let b=l[x];if(!h&&b==="#"){S=x;break}if(!h&&(l.slice(x,x+3)==='"""'||l.slice(x,x+3)==="'''")){let v=l.slice(x,x+3),P=l.indexOf(v,x+3);if(P!==-1){x=P+2;continue}a=v;break}if(b==='"'||b==="'"){h?f===b&&(x===0||l[x-1]!=="\\")&&(h=!1):(h=!0,f=b);continue}if(!h){if(b==="("||b==="["||b==="{")o.push({char:b,line:p,col:x+1});else if(b===")"||b==="]"||b==="}"){let v=i[b],P=o.pop();P?P.char!==v&&r.push({id:`py-bracket-mismatch-${p}-${x+1}`,file:t,line:p,startLineNumber:p,col:x+1,startColumn:x+1,severity:"error",message:`Mismatched bracket: expected closing for '${P.char}' from line ${P.line}, found '${b}'.`,source:"python-linter"}):r.push({id:`py-bracket-unmatched-${p}-${x+1}`,file:t,line:p,startLineNumber:p,col:x+1,startColumn:x+1,severity:"error",message:`Unmatched closing bracket '${b}'.`,source:"python-linter"})}}}h&&!a&&!l.endsWith("\\")&&r.push({id:`py-eol-string-${p}`,file:t,line:p,startLineNumber:p,col:l.length,startColumn:l.length,severity:"error",message:"SyntaxError: EOL while scanning string literal.",source:"python-linter"});let E=(S>=0?l.slice(0,S):l).trim();if(!a&&o.length===0&&y===0&&!E.endsWith("\\")&&/^(?:(?:async\s+)?def\b|class\b|if\b|elif\b|else\b|for\b|while\b|try\b|finally\b|except\b|(?:async\s+)?with\b)/.test(E))E.endsWith(":")?(s=p,c=_):/:/.test(E)||r.push({id:`py-missing-colon-${p}`,file:t,line:p,startLineNumber:p,col:l.length,startColumn:l.length,severity:"error",message:"SyntaxError: expected ':' at end of line.",source:"python-linter"});else if(!a&&o.length===0&&y>0&&E.endsWith(":")){let x=u-1;for(;x>0&&!n[x].trim();)x--;let b=(n[x]?.match(/^([ \t]+)/)?.[1]||"").length;s=p,c=Math.min(_,b)}}for(let u of o)r.push({id:`py-unclosed-bracket-${u.line}-${u.col}`,file:t,line:u.line,startLineNumber:u.line,col:u.col,startColumn:u.col,severity:"error",message:`SyntaxError: closing parenthesis does not match or unclosed bracket '${u.char}' opened on line ${u.line}.`,source:"python-linter"});return r}function ul(e,t,r,n){let o=[];if(!e||typeof e!="string")return o;t&&typeof t.clear=="function"&&t.clear("python");let i=/File\s+["'](?:(?:\/workspace\/)?([^"']+))["'],\s+line\s+(\d+)(?:,\s+in\s+([A-Za-z0-9_<>]+))?/g,s="main.py",c=1,a;for(;(a=i.exec(e))!==null;)s=a[1].replace(/^\/workspace\//,""),c=parseInt(a[2],10)||1;let u=e.trim().split(`
|
|
326
|
+
`),l=u[u.length-1]||"Python Execution Error";if(l.includes("Error:")||l.includes("Exception:")||l.includes("Error")){let p={id:`python-error-${s}-${c}`,file:s,line:c,startLineNumber:c,col:1,startColumn:1,severity:"error",message:`[Python] ${l.trim()}`,source:"python"};o.push(p),t&&typeof t.add=="function"&&t.add(p)}if(r&&n&&typeof r.editor?.setModelMarkers=="function"){let p=o.map(h=>({startLineNumber:h.line,startColumn:h.col||1,endLineNumber:h.line,endColumn:100,message:h.message,severity:r.MarkerSeverity.Error}));r.editor.setModelMarkers(n,"python",p)}return o}function ll(e){if(!e||typeof e!="string")return e;let t=e.split(`
|
|
327
|
+
`),r=[],n=0,o=0;for(let i=0;i<t.length;i++){let c=t[i].trim();if(!c){o++,o<=1&&r.length>0&&r.push("");continue}if(o=0,c.startsWith("#")){r.push(" ".repeat(n)+c);continue}/^(?:elif\b|else:|except\b|finally:)/.test(c)&&n>0&&n--,r.push(" ".repeat(n)+c),c.endsWith(":")&&n++}for(;r.length>0&&r[r.length-1]==="";)r.pop();return r.join(`
|
|
304
328
|
`)+`
|
|
305
|
-
`}var
|
|
306
|
-
`);for(let
|
|
307
|
-
`),{ok:!1,exitCode:1,stdout:n,stderr:o,peakMemoryBytes:0,durationMs:performance.now()-r}}
|
|
308
|
-
`)}),
|
|
309
|
-
`)});let
|
|
329
|
+
`}var Ge=class e{options;pyodide=null;_loadingPromise=null;constructor(t={}){let r=yc.parse(t);this.options=t.headlessMock!==void 0?{...r,headlessMock:t.headlessMock}:r}isLoaded(){return this.pyodide!==null}async preload(){return this.ensureLoaded()}_emitProgress(t){if(typeof this.options.onProgress=="function")try{this.options.onProgress(t)}catch(r){typeof console<"u"&&console.warn&&console.warn("[Python progress callback warning]:",r)}}static _scriptPromises=new Map;async ensureLoaded(){return this.pyodide?this.pyodide:this._loadingPromise?this._loadingPromise:(this._loadingPromise=(async()=>{try{if(this._emitProgress({stage:"downloading",percent:10,message:"Initializing CPython 3.12 WebAssembly (Pyodide)..."}),typeof window<"u"&&typeof document<"u"&&!this.options.headlessMock){let t=this.options.cdnBaseUrl||this.options.indexUrl||this.options.pyodideIndexUrl||bc,r=`${t.replace(/\/+$/,"")}/pyodide.js`;if(!window.loadPyodide){let o=e._scriptPromises.get(r);o||(o=new Promise((i,s)=>{if((typeof document.querySelector=="function"?document.querySelector(`script[data-codelab-pyodide="${r}"]`):null)&&window.loadPyodide){i();return}let a=document.createElement("script");a.src=r,a.setAttribute("data-codelab-pyodide",r),a.onload=()=>i(),a.onerror=()=>{e._scriptPromises.delete(r),s(new Error(`Failed to load pyodide.js from ${r}`))},document.head.appendChild(a)}),e._scriptPromises.set(r,o)),await o}this._emitProgress({stage:"extracting",percent:50,message:"Bootstrapping Python runtime environment..."});let n=window.loadPyodide;this.pyodide=await n({indexURL:t})}else{let t=new Set(["/","/workspace","/usr","/usr/lib","/usr/lib/python"]),r=new Map,n=new TextEncoder,o=new TextDecoder("utf-8",{fatal:!1}),i=s=>{let c=s.split("/").filter(Boolean),a="";for(let u of c)a+="/"+u,t.add(a)};this.pyodide={FS:{files:r,dirs:t,mkdirTree(s){i(s)},writeFile(s,c){let a=s.lastIndexOf("/");a>0&&i(s.slice(0,a)),c instanceof Uint8Array?r.set(s,c.slice()):ArrayBuffer.isView(c)?r.set(s,new Uint8Array(c.buffer,c.byteOffset,c.byteLength).slice()):r.set(s,n.encode(typeof c=="string"?c:String(c??"")))},readFile(s,c){let a=r.get(s);return a?c&&c.encoding==="utf8"?o.decode(a):a.slice():c&&c.encoding==="utf8"?"":new Uint8Array(0)},unlink(s){r.delete(s)},readdir(s){let c=s==="/"?"/":s.replace(/\/+$/,"")+"/",a=new Set([".",".."]);for(let u of t)if(u.startsWith(c)){let l=u.slice(c.length);l&&!l.includes("/")&&a.add(l)}for(let u of r.keys())if(u.startsWith(c)){let l=u.slice(c.length);l&&!l.includes("/")&&a.add(l)}return Array.from(a)},stat(s){if(t.has(s))return{mode:16877};if(r.has(s))return{mode:33188};throw new Error(`ENOENT: ${s}`)},isDir(s){return(s&61440)===16384}},runPythonAsync:async s=>`Execution mock: ${s.slice(0,30)}`}}if(this.options.preloadPackages&&Array.isArray(this.options.preloadPackages))for(let t of this.options.preloadPackages)try{typeof this.pyodide.loadPackage=="function"&&await this.pyodide.loadPackage(t)}catch(r){}return this._emitProgress({stage:"ready",percent:100,message:"Python 3.12 WebAssembly Toolchain Ready"}),this.pyodide}catch(t){throw this._loadingPromise=null,t}})(),this._loadingPromise)}async installPackages(t){let r=await this.ensureLoaded(),n=[];for(let o of t)if(!(!o||o.startsWith("-")))try{typeof r.loadPackage=="function"?(await r.loadPackage(o),n.push(o)):r.FS&&n.push(o)}catch(i){return{ok:!1,installed:n,error:i?.message||String(i)}}return{ok:!0,installed:n}}async execute(t){let r=performance.now(),n="",o="",i=(Array.isArray(t.testFilter)?t.testFilter:typeof t.testFilter=="string"?[t.testFilter]:[]).map(y=>String(y||"").trim().toLowerCase()).filter(Boolean),s=y=>{if(i.length===0)return!0;let S=String(y||"").toLowerCase();return i.some(E=>S.includes(E))},c=[],a=new wt(y=>{s(y.name)&&c.push(y)}),u=y=>{n+=y;let S=y.split(`
|
|
330
|
+
`);for(let E of S)a.parseLine(E);t.onStdout&&t.onStdout(y)},l=y=>{o+=y,t.onStderr&&t.onStderr(y)},p=await this.ensureLoaded(),h=new Set;if(t.vfs&&p.FS){let y=S=>{try{typeof p.FS.mkdirTree=="function"&&p.FS.mkdirTree(S);let E=t.vfs.readdirSync(S);for(let x of E){if(!x||x==="."||x==="..")continue;let b=`${S==="/"?"":S}/${x}`;try{let v=t.vfs.statSync(b);if(v&&typeof v.isDirectory=="function"&&v.isDirectory())y(b);else{let P=b.slice(0,b.lastIndexOf("/"))||"/workspace";typeof p.FS.mkdirTree=="function"&&p.FS.mkdirTree(P);let F=t.vfs.readFileSync(b);p.FS.writeFile(b,F),h.add(b)}}catch(v){}}}catch(E){}};if(y("/workspace"),typeof p.FS.readdir=="function"&&typeof p.FS.unlink=="function"){let S=E=>{try{let x=p.FS.readdir(E);for(let b of x){if(!b||b==="."||b==="..")continue;let v=`${E}/${b}`,P=!1;if(typeof p.FS.stat=="function"&&typeof p.FS.isDir=="function")try{P=!!p.FS.isDir(p.FS.stat(v).mode)}catch(F){}if(P)S(v);else if(!h.has(v))try{p.FS.unlink(v)}catch(F){}}}catch(x){}};S("/workspace")}}if(p.FS)try{p.FS.mkdirTree("/usr/lib/python");for(let[y,S]of Object.entries(Pt))p.FS.writeFile(y,S)}catch(y){}let f=t.source;if(!f&&t.entry&&t.vfs)try{f=t.vfs.readFileSync(t.entry.startsWith("/")?t.entry:`/workspace/${t.entry}`,"utf8")}catch{return l(`FileNotFoundError: [Errno 2] No such file or directory: '${t.entry}'
|
|
331
|
+
`),{ok:!1,exitCode:1,stdout:n,stderr:o,peakMemoryBytes:0,durationMs:performance.now()-r}}f=f||"";let g=1024*1024,_=0;try{if(typeof window<"u"&&p.setStdout){p.setStdout({batched:P=>u(P+`
|
|
332
|
+
`)}),p.setStderr({batched:P=>l(P+`
|
|
333
|
+
`)});let y=t.stdin||"",S=!1;if(!y&&typeof t.onRequestStdin=="function"&&/\binput\s*\(/.test(f)){let P=Array.from(f.matchAll(/\binput\s*\(\s*(?:(['"])((?:\\.|(?!\1).)*)\1)?\s*\)/g)),F=[],he=Math.min(8,Math.max(1,P.length));for(let le=0;le<he;le++){let He=P[le]?.[2]||"",ke=await t.onRequestStdin(He);if(ke==null)break;F.push(String(ke))}F.length>0&&(y=F.join(`
|
|
310
334
|
`)+`
|
|
311
|
-
`,
|
|
335
|
+
`,S=!0)}if(y&&p.setStdin){let P=0;p.setStdin({stdin:()=>P<y.length?y.charCodeAt(P++):null})}let E=JSON.stringify(t.entry||"<exec>"),x=JSON.stringify(f),v=`
|
|
312
336
|
import sys, builtins, tracemalloc
|
|
313
337
|
if '/usr/lib/python' not in sys.path:
|
|
314
338
|
sys.path.insert(0, '/usr/lib/python')
|
|
315
339
|
if '/workspace' not in sys.path:
|
|
316
340
|
sys.path.insert(0, '/workspace')
|
|
317
|
-
|
|
318
|
-
|
|
341
|
+
try:
|
|
342
|
+
import codelab_test as _cl_test_mod
|
|
343
|
+
if hasattr(_cl_test_mod, '_reset_codelab_test'):
|
|
344
|
+
_cl_test_mod._reset_codelab_test()
|
|
345
|
+
if hasattr(_cl_test_mod, '_set_test_filter'):
|
|
346
|
+
_cl_test_mod._set_test_filter(${JSON.stringify(i.length>0?i:null)})
|
|
347
|
+
except Exception:
|
|
348
|
+
pass
|
|
319
349
|
|
|
320
350
|
_cl_orig_input = builtins.input
|
|
321
|
-
${
|
|
322
|
-
_cl_user_code = ${
|
|
323
|
-
_cl_ns = {'__name__': '__main__', '__file__': ${
|
|
351
|
+
${S?"builtins.input = lambda _prompt='': sys.stdin.readline().rstrip('\\r\\n')":""}
|
|
352
|
+
_cl_user_code = ${x}
|
|
353
|
+
_cl_ns = {'__name__': '__main__', '__file__': ${E}, '__builtins__': __builtins__}
|
|
324
354
|
tracemalloc.start()
|
|
325
355
|
try:
|
|
326
|
-
exec(compile(_cl_user_code, ${
|
|
356
|
+
exec(compile(_cl_user_code, ${E}, 'exec'), _cl_ns)
|
|
327
357
|
finally:
|
|
328
358
|
builtins.input = _cl_orig_input
|
|
329
359
|
_, _peak = tracemalloc.get_traced_memory()
|
|
330
360
|
tracemalloc.stop()
|
|
331
|
-
`;if(await
|
|
332
|
-
`)}else
|
|
333
|
-
`)}catch(
|
|
334
|
-
`)}else
|
|
335
|
-
`)}if(t.vfs&&
|
|
336
|
-
`)}),t.activate&&typeof e.setLanguage=="function"?e.setLanguage("py"):typeof e._refreshToolbarAndTabs=="function"?e._refreshToolbarAndTabs():typeof e._renderShell=="function"&&e.container&&(e._renderShell(),typeof e._bindEvents=="function"&&e._bindEvents(),typeof e._renderFileLists=="function"&&e._renderFileLists()),
|
|
361
|
+
`;if(await p.runPythonAsync(v),p.globals&&typeof p.globals.get=="function")try{let P=p.globals.get("_peak");typeof P=="number"&&P>0&&(g=P)}catch(P){}}else if(t.source&&/sys\.exit\(\s*(\d+)?\s*\)/.test(t.source)){let y=t.source.match(/sys\.exit\(\s*(\d+)?\s*\)/);_=y&&y[1]!==void 0?parseInt(y[1],10):0,_!==0&&l(`SystemExit: ${_}
|
|
362
|
+
`)}else u(`[Python 3.12 Wasm]: Executed ${t.entry||"snippet"}
|
|
363
|
+
`)}catch(y){let S=y&&y.message?y.message:String(y);if(/SystemExit(?::\s*([0-9]+|None)?)?/.test(S)){let x=S.match(/SystemExit(?::\s*([0-9]+))?/);_=x&&x[1]!==void 0?parseInt(x[1],10):0,_!==0&&l(S+`
|
|
364
|
+
`)}else _=1,l(S+`
|
|
365
|
+
`)}if(t.vfs&&p.FS&&typeof p.FS.readdir=="function"){let y=new Set,S=E=>{try{let x=p.FS.readdir(E);for(let b of x){if(!b||b==="."||b==="..")continue;let v=`${E}/${b}`;try{let P=!1;if(typeof p.FS.stat=="function"&&typeof p.FS.isDir=="function"){let F=p.FS.stat(v);P=!!p.FS.isDir(F.mode)}if(P)typeof t.vfs.mkdirSync=="function"&&!t.vfs.existsSync(v)&&t.vfs.mkdirSync(v,{recursive:!0}),S(v);else{let F=v.slice(0,v.lastIndexOf("/"))||"/workspace";typeof t.vfs.mkdirSync=="function"&&!t.vfs.existsSync(F)&&t.vfs.mkdirSync(F,{recursive:!0});let he=p.FS.readFile(v);t.vfs.writeFileSync(v,he),y.add(v)}}catch(P){}}}catch(x){}};if(S("/workspace"),typeof t.vfs.unlinkSync=="function"){for(let E of h)if(!y.has(E))try{t.vfs.unlinkSync(E)}catch(x){}}}let z=performance.now()-r;return{ok:_===0,exitCode:_,stdout:n,stderr:o,peakMemoryBytes:g,durationMs:z,testResults:c}}};function $c(e){if(e)for(let[t,r]of Object.entries(Pt)){let n=t.replace(/^\//,"");if(typeof e.writeFileSync=="function"){try{typeof e.mkdirSync=="function"&&e.mkdirSync("/usr/lib/python",{recursive:!0})}catch(o){}try{e.writeFileSync(t,r)}catch(o){}}e.files instanceof Map?(e.files.set(t,r),e.files.set(n,r)):e.files&&typeof e.files=="object"&&(e.files[t]=r,e.files[n]=r),typeof e=="object"&&typeof e.writeFileSync!="function"&&(e[t]=r,e[n]=r)}}function Dr(e){let t=async r=>e.execute(r);return typeof globalThis<"u"&&(globalThis.__codelabPythonCompiler=t,globalThis.__codelabPythonToolchain=e),typeof window<"u"&&(window.__codelabPythonCompiler=t,window.__codelabPythonToolchain=e),t}function zc(e,t={}){let r=new Ge(t),n=Dr(r);if(!e)return r;e.pythonToolchain=r,e.pythonCompiler=n,e.pythonOptions=r.options,e.shell&&e.shell.options&&(e.shell.options.pythonCompiler=n,e.shell.options.pythonToolchain=r);let o=()=>e&&e.files?e.files:{};return typeof window<"u"&&window.monaco&&Lr(window.monaco,o),Array.isArray(e._monacoReadyHooks)||(e._monacoReadyHooks=[]),e._monacoReadyHooks.push(i=>{Lr(i,o)}),!e.enabledLanguages||!(e.enabledLanguages instanceof Set)?e.enabledLanguages=new Set(["js","py"]):e.enabledLanguages.add("py"),t.files&&typeof t.files=="object"&&(e.pyFiles={...e.pyFiles||{},...t.files},e.guidedConfig&&(e.guidedConfig.pyFiles={...e.guidedConfig.pyFiles||{},...t.files})),t.starterFiles&&typeof t.starterFiles=="object"&&(e.guidedConfig||(e.guidedConfig={}),e.guidedConfig.pyStarterFiles={...e.guidedConfig.pyStarterFiles||{},...t.starterFiles}),t.solutionFiles&&typeof t.solutionFiles=="object"&&(e.guidedConfig||(e.guidedConfig={}),e.guidedConfig.pySolutionFiles={...e.guidedConfig.pySolutionFiles||{},...t.solutionFiles}),e.vfs&&$c(e.vfs),e.hasMultipleLanguages=e.enabledLanguages.size>1,e._pyLintHandler=(i,s)=>{if(!i||!/\.py$/i.test(i))return;let c=vc(String(s??""),i),a=e?e._diagnosticsStore:null;if(a&&typeof a.setFileDiagnostics=="function")a.setFileDiagnostics(i,"python-linter",c);else if(a&&typeof a.clear=="function"&&typeof a.add=="function"){a.clear("python-linter");for(let u of c)a.add(u)}if(typeof window<"u"&&window.monaco){let u=e.models&&typeof e.models.get=="function"&&e.models.get(i)||(e.activeFile===i&&e.editor?e.editor.getModel():null);if(u){let l=c.map(p=>({startLineNumber:p.line,startColumn:p.col||1,endLineNumber:p.endLine||p.line,endColumn:p.endCol||(p.col||1)+20,message:p.message,severity:p.severity==="error"?window.monaco.MarkerSeverity.Error:window.monaco.MarkerSeverity.Warning}));window.monaco.editor.setModelMarkers(u,"python-linter",l)}}},t.preload&&r.ensureLoaded().catch(i=>{typeof e._appendTerminalOutput=="function"&&e._appendTerminalOutput("stderr",`[Python Toolchain preload warning]: ${i.message||i}
|
|
366
|
+
`)}),t.activate&&typeof e.setLanguage=="function"?e.setLanguage("py"):typeof e._refreshToolbarAndTabs=="function"?e._refreshToolbarAndTabs():typeof e._renderShell=="function"&&e.container&&(e._renderShell(),typeof e._bindEvents=="function"&&e._bindEvents(),typeof e._renderFileLists=="function"&&e._renderFileLists()),e}function Fr(e,t){if(e===null){let r=new Ge(t||{});return Dr(r),r}if(e===void 0||typeof e=="object"&&!("enabledLanguages"in e)&&!("container"in e)&&!("_renderShell"in e)){let r=e||{},n=(o,i={})=>zc(o,{...r,...i||{}});return n.extensionName="python",n.languageId="py",n.install=n,n}return zc(e,t)}function pl(e={}){return Fr(e)}var dl=Fr;return Ec(fl);})();
|
|
337
367
|
if(typeof module!=="undefined"&&module.exports)module.exports=CodeLabPython;if(typeof globalThis!=="undefined")globalThis.CodeLabPython=CodeLabPython;
|