@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.
Files changed (71) hide show
  1. package/ARCHITECTURE.md +2 -2
  2. package/CHANGELOG.md +10 -0
  3. package/README.md +5 -5
  4. package/dist/code-lab-sql.esm.js +2 -2
  5. package/dist/code-lab-sql.umd.js +3 -3
  6. package/dist/code-lab.css +1 -1
  7. package/dist/code-lab.d.ts +47 -38
  8. package/dist/code-lab.esm.js +918 -884
  9. package/dist/code-lab.js +917 -881
  10. package/dist/extensions/cpp.esm.js +33 -33
  11. package/dist/extensions/cpp.js +33 -33
  12. package/dist/extensions/python.esm.js +79 -49
  13. package/dist/extensions/python.js +79 -49
  14. package/dist/index.d.ts +1 -1
  15. package/dist/logger.d.ts +4 -20
  16. package/dist/modular-kernel.d.ts +0 -1
  17. package/dist/packages/core/src/errors.d.ts +5 -1
  18. package/dist/packages/fs/src/backends.d.ts +0 -27
  19. package/dist/packages/fs/src/index.d.ts +1 -1
  20. package/dist/packages/ui/src/html.d.ts +1 -0
  21. package/dist/packages/ui/src/index.d.ts +1 -0
  22. package/dist/{apps/web/src/index.d.ts → packages/ui/src/kernel.d.ts} +3 -2
  23. package/dist/packages/ui/src/observability.d.ts +1 -1
  24. package/dist/packages/ui/src/settings-dialog.d.ts +0 -1
  25. package/dist/preview-sw.js +1 -1
  26. package/dist/runtime.d.ts +3 -0
  27. package/dist/runtime.esm.js +2 -2
  28. package/dist/runtime.js +2 -2
  29. package/dist/schemas.d.ts +1 -1
  30. package/dist/shell.esm.js +277 -285
  31. package/dist/shell.js +277 -285
  32. package/dist/terminal.esm.js +2 -2
  33. package/dist/terminal.js +2 -2
  34. package/dist/workbench/editor.d.ts +0 -4
  35. package/dist/workbench/index.d.ts +0 -2
  36. package/dist/workbench/intellisense.d.ts +0 -1
  37. package/dist/workbench/xterm-adapter.d.ts +0 -1
  38. package/package.json +2 -4
  39. package/src/code-lab.css +0 -8086
  40. package/src/csp.ts +0 -590
  41. package/src/diagnostics.ts +0 -287
  42. package/src/extensions/cpp.ts +0 -2371
  43. package/src/extensions/guided-lab.ts +0 -68
  44. package/src/extensions/javascript.ts +0 -54
  45. package/src/extensions/python.ts +0 -1743
  46. package/src/extensions/typescript.ts +0 -85
  47. package/src/extensions/umbrella.ts +0 -5
  48. package/src/html.ts +0 -88
  49. package/src/index.ts +0 -129
  50. package/src/logger.ts +0 -139
  51. package/src/modular-kernel.ts +0 -7
  52. package/src/preview-sw.js +0 -296
  53. package/src/runtime/test-harness.ts +0 -57
  54. package/src/runtime.ts +0 -10565
  55. package/src/sample.html +0 -304
  56. package/src/schemas.ts +0 -366
  57. package/src/scm.ts +0 -2453
  58. package/src/search.ts +0 -433
  59. package/src/shell.ts +0 -10990
  60. package/src/storage.ts +0 -773
  61. package/src/terminal.ts +0 -1402
  62. package/src/workbench/command-palette.ts +0 -101
  63. package/src/workbench/diff-editor.ts +0 -472
  64. package/src/workbench/editor.ts +0 -49
  65. package/src/workbench/icons.ts +0 -255
  66. package/src/workbench/index.ts +0 -29
  67. package/src/workbench/intellisense.ts +0 -1884
  68. package/src/workbench/share.ts +0 -128
  69. package/src/workbench/xterm-adapter.ts +0 -1571
  70. package/src/workbench.ts +0 -21825
  71. package/src/zip.ts +0 -348
@@ -1,46 +1,46 @@
1
- var zc=Object.defineProperty;var bc=(e,t)=>{for(var r in t)zc(e,r,{get:t[r],enumerable:!0})};var $={};bc($,{BIGINT_FORMAT_RANGES:()=>He,CONSTANT_CATCH:()=>Wr,Class:()=>Pt,NUMBER_FORMAT_RANGES:()=>Ze,aborted:()=>K,allowsEval:()=>At,assert:()=>Pc,assertEqual:()=>vc,assertIs:()=>wc,assertNever:()=>kc,assertNotEqual:()=>$c,assignProp:()=>X,attachSchema:()=>Oe,base64ToUint8Array:()=>Br,base64urlToUint8Array:()=>Kc,cached:()=>we,captureStackTrace:()=>Ve,cleanEnum:()=>Wc,cleanRegex:()=>ke,clone:()=>q,cloneDef:()=>Ec,codePointLength:()=>Ee,constantCatch:()=>Kr,createTransparentProxy:()=>Rc,defineLazy:()=>Rr,defineLazyInternal:()=>O,derived:()=>Xc,esc:()=>Et,escapeRegex:()=>le,explicitlyAborted:()=>Nt,extend:()=>Fc,finalizeIssue:()=>Q,floatSafeRemainder:()=>Ot,getElementAtPath:()=>Tc,getEnumValues:()=>he,getLengthableOrigin:()=>Te,getParsedType:()=>Nc,getSizableOrigin:()=>Ur,hexToUint8Array:()=>Gc,hide:()=>Ye,installLazyProp:()=>ea,isObject:()=>me,isPlainObject:()=>se,issue:()=>_e,joinValues:()=>Ke,jsonStringifyReplacer:()=>ge,members:()=>Dt,merge:()=>Mc,mergeDefs:()=>re,normalizeParams:()=>v,nullish:()=>Zt,numKeys:()=>Ic,objectClone:()=>Zc,omit:()=>Lc,optionalKeys:()=>It,own:()=>ie,parsedType:()=>Rt,partial:()=>Uc,pick:()=>Dc,prefixIssues:()=>Y,primitiveTypes:()=>jr,promiseAllObject:()=>Ac,propertyKeyTypes:()=>Ct,randomString:()=>Cc,rawShape:()=>Pe,required:()=>Bc,safeExtend:()=>jc,shallowClone:()=>Fr,sizeCaps:()=>qe,slugify:()=>Tt,stringifyPrimitive:()=>Ge,toZod:()=>Sc,uint8ArrayToBase64:()=>Jr,uint8ArrayToBase64url:()=>Vc,uint8ArrayToHex:()=>Hc,unwrapMessage:()=>fe});function vc(e){return e}function $c(e){return e}function Sc(){return e=>e}function wc(e){}function kc(e){throw new Error("Unexpected value in exhaustive check")}function Pc(e){}function he(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 Ke(e,t="|"){return e.map(r=>Ge(r)).join(t)}function ge(e,t){return typeof t=="bigint"?t.toString():t}var kt=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 kt(e)}function Zt(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 Ot(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 Nr=Symbol("evaluating");function Rr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Nr)return n===void 0&&(n=Nr,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Zc(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 Dr(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return X(this,t,n),n},enumerable:!0,configurable:!0})}function Lr(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?Dr(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Lr(e,i,n?n(s.value,i):s.value))}}function Oc(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Dr(e,r,()=>t[r]):Lr(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 Ec(e){return re(e._zod.def)}function Tc(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Ac(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 Cc(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Et(e){return JSON.stringify(e)}function Tt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ve="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function me(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var At=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(me(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(me(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Fr(e){return se(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Ic(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Nc=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}`)}},Ct=new Set(["string","number","symbol"]),jr=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 Rc(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 Ge(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function It(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]},He={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Dc(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,Xe(e,t)),q(e,re(r,{shape:i,checks:[]}))}function Xe(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 Lc(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(Xe(e,t)),s={};return ue(s,e,Reflect.ownKeys(te(e)).filter(c=>!i.has(c))),q(e,re(r,{shape:s,checks:[]}))}function Fc(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:Mr(e,t)}))}function Mr(e,t){let r={};return ue(r,e,Reflect.ownKeys(te(e))),Oc(r,t),r}function jc(e,t){if(!se(t))throw new Error("Invalid input to safeExtend: expected a plain object");return q(e,re(e._zod.def,{shape:Mr(e,t)}))}function Mc(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 Uc(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(Xe(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 Bc(e,t,r){let n=r?new Set(Xe(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 Nt(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 fe(e){return typeof e=="string"?e:e?.message}function qe(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:fe(e.inst?._zod.def?.error?.(e))??fe(i?.(e))??fe(t?.error?.(e))??fe(r.customError?.(e))??fe(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 Ur(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Jc=/[\uD800-\uDBFF]/;function Ee(e){let t=e.length;if(!Jc.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 Rt(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 _e(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Wc(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Br(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 Jr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Kc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Br(t+r)}function Vc(e){return Jr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Gc(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 Hc(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Pt=class{constructor(...t){}};function Dt(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):qc(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 Ye(e,t,r){return ie(e,t,r,!1)}function Xc(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 qc(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 Yc(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var wt,oe=!1,Qc={configurable:!0,get(){oe=!0}};function O(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&wt!==e._zod){wt=void 0;return}wt=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Qc);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 ea(e,t,r,n){let o=Yc(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 Wr="~constantCatch";function Kr(e){let t=()=>e;return t[Wr]=!0,t}var Vr;var Lt={value:void 0,enumerable:!1},Gr="captureStackTrace"in Error?Error:null;function ta(e){let t=Gr;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Gr=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{Lt.value=new i(f);try{Object.defineProperty(h,"_zod",Lt)}finally{Lt.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),Dt(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?ta(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.")}},ye=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Vr=globalThis).__zod_globalConfig??(Vr.__zod_globalConfig={});var U=globalThis.__zod_globalConfig;function V(e){return e&&Object.assign(U,e),U}function ra(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ge,2)),e.message}function na(e){this._zod.message=e}var oa={get:ra,set:na,enumerable:!0,configurable:!0},jt={value:void 0,enumerable:!1},Hr=new WeakSet([Object.prototype,Error.prototype]),Xr=(e,t)=>{e.name="$ZodError",jt.value=t,Object.defineProperty(e,"issues",jt),jt.value=void 0,Object.defineProperty(e,"message",oa);let r=Object.getPrototypeOf(e);Hr.has(r)||(Hr.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})}}))},qr=m("$ZodError",Xr),Mt=m("$ZodError",Xr,void 0,{Parent:Error});function ia(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 Yr(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?ia(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Qr(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 Qe(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 Ve(u,i?.callee??t),u}return c.value};return t},Ut=Ae(Mt),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 Ve(u,i?.callee??t),u}return c.value};return t},Bt=Ce(Mt),et=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?en(e,i.issues,o):{success:!0,data:i.value}};function en(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 tt=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?en(e,i.issues,o):{success:!0,data:i.value}};var ca=Symbol.for("zod.compile.invalid"),aa=Symbol.for("zod.compile.fallback"),Jt=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==ca)return!0;if(n.definite===!0&&r===void 0)return!1}return ua(e,t,r)});function ua(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[aa]=!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 Wt=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},tn=e=>{let t=Ae(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,Qe(r,s))};return r};var rn=e=>{let t=Ae(e),r=(n,o,i,s)=>t(n,o,i,Qe(r,s));return r};var nn=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,Qe(r,s))};return r};var on=e=>{let t=Ce(e),r=async(n,o,i,s)=>await t(n,o,i,Qe(r,s));return r};var sn=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return et(e)(t,r,o)};var cn=e=>(t,r,n)=>et(e)(t,r,n);var an=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return tt(e)(t,r,o)};var un=e=>async(t,r,n)=>tt(e)(t,r,n);var ln=/^[cC][0-9a-z]{6,}$/,pn=/^[0-9a-z]+$/,dn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,fn=/^[0-9a-vA-V]{20}$/,mn=/^[A-Za-z0-9]{27}$/,hn=/^[a-zA-Z0-9_-]{21}$/;function gn(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 yn=/^([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})$/,Vt=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 xn=/^(?:[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 la="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function zn(){return new RegExp(la,"u")}var bn=/^(?:(?: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])$/,vn=/^(([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 $n=/^((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])$/,Sn=/^(([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])$/,wn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,kn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Pn=/^https?$/,Zn=/^\+[1-9]\d{6,14}$/;var On="(?:(?:\\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 pa(e){return new RegExp(`^${e}$`)}var En=pa(On);function Kt(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 Tn(e){return new RegExp(`^${Kt(e)}$`)}function An(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Kt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Kt({precision:e.precision})}`:r;return new RegExp(`^${On}T(?:${n})$`)}var Cn=/^[\s\S]{0,}$/;var Gt=/^-?\d+$/,Ie=/^-?\d+(?:\.\d+)?$/,In=/^(?:true|false)$/i,Nn=/^null$/i;var Rn=/^[^A-Z]*$/,Dn=/^[^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 Ht=e=>{let t=e.value;return!Zt(t)&&t.length!==void 0},rt={number:"number",bigint:"bigint",object:"date"},Xt=m("$ZodCheckLessThan",(e,t)=>{j.init(e,t);let r=rt[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:rt[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=rt[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:rt[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})}}),Ln=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):Ot(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})}}),Fn=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 jn=m("$ZodCheckMaxLength",(e,t)=>{var r;j.init(e,t),(r=e._zod.def).when??(r.when=Ht),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})}}),Mn=m("$ZodCheckMinLength",(e,t)=>{var r;j.init(e,t),(r=e._zod.def).when??(r.when=Ht),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})}}),Un=m("$ZodCheckLengthEquals",(e,t)=>{var r;j.init(e,t),(r=e._zod.def).when??(r.when=Ht),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=()=>{})}),Bn=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})}}),Jn=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Rn),Re.init(e,t)}),Wn=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Dn),Re.init(e,t)}),Kn=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})}}),Vn=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})}}),Gn=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 Hn=m("$ZodCheckOverwrite",(e,t)=>{j.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var nt=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 zc=Object.defineProperty;var bc=(e,t)=>{for(var r in t)zc(e,r,{get:t[r],enumerable:!0})};var w={};bc(w,{BIGINT_FORMAT_RANGES:()=>Ye,CONSTANT_CATCH:()=>Kr,Class:()=>Et,NUMBER_FORMAT_RANGES:()=>Oe,aborted:()=>V,allowsEval:()=>It,assert:()=>Pc,assertEqual:()=>vc,assertIs:()=>wc,assertNever:()=>kc,assertNotEqual:()=>$c,assignProp:()=>q,attachSchema:()=>Te,base64ToUint8Array:()=>Jr,base64urlToUint8Array:()=>Kc,cached:()=>Pe,captureStackTrace:()=>Xe,cleanEnum:()=>Wc,cleanRegex:()=>Ze,clone:()=>Y,cloneDef:()=>Oc,codePointLength:()=>Ae,constantCatch:()=>Vr,createTransparentProxy:()=>Rc,defineLazy:()=>Lr,defineLazyInternal:()=>O,derived:()=>Xc,esc:()=>At,escapeRegex:()=>de,explicitlyAborted:()=>Lt,extend:()=>Fc,finalizeIssue:()=>ee,floatSafeRemainder:()=>Tt,getElementAtPath:()=>Tc,getEnumValues:()=>_e,getLengthableOrigin:()=>Ce,getParsedType:()=>Nc,getSizableOrigin:()=>Br,hexToUint8Array:()=>Gc,hide:()=>tt,installLazyProp:()=>ea,isObject:()=>ge,isPlainObject:()=>ce,issue:()=>xe,joinValues:()=>He,jsonStringifyReplacer:()=>ye,members:()=>Ft,merge:()=>Mc,mergeDefs:()=>ne,normalizeParams:()=>$,nullish:()=>Ot,numKeys:()=>Ic,objectClone:()=>Zc,omit:()=>Dc,optionalKeys:()=>Rt,own:()=>se,parsedType:()=>Dt,partial:()=>Uc,pick:()=>Lc,prefixIssues:()=>Q,primitiveTypes:()=>Mr,promiseAllObject:()=>Ac,propertyKeyTypes:()=>Nt,randomString:()=>Cc,rawShape:()=>Ee,required:()=>Bc,safeExtend:()=>jc,shallowClone:()=>jr,sizeCaps:()=>et,slugify:()=>Ct,stringifyPrimitive:()=>qe,toZod:()=>Sc,uint8ArrayToBase64:()=>Wr,uint8ArrayToBase64url:()=>Vc,uint8ArrayToHex:()=>Hc,unwrapMessage:()=>he});function vc(e){return e}function $c(e){return e}function Sc(){return e=>e}function wc(e){}function kc(e){throw new Error("Unexpected value in exhaustive check")}function Pc(e){}function _e(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 He(e,t="|"){return e.map(r=>qe(r)).join(t)}function ye(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 Pe(e){return new Zt(e)}function Ot(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 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 Rr=Symbol("evaluating");function Lr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Rr)return n===void 0&&(n=Rr,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Zc(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 Dr(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return q(this,t,n),n},enumerable:!0,configurable:!0})}function Fr(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?Dr(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Fr(e,i,n?n(s.value,i):s.value))}}function Ec(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Dr(e,r,()=>t[r]):Fr(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 Oc(e){return ne(e._zod.def)}function Tc(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Ac(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 Cc(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 Xe="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ge(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var It=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(ge(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ge(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function jr(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Ic(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Nc=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"]),Mr=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 Rc(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 qe(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 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]},Ye={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Lc(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,Qe(e,t)),Y(e,ne(r,{shape:i,checks:[]}))}function Qe(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 Dc(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 pe(s,e,Reflect.ownKeys(re(e)).filter(c=>!i.has(c))),Y(e,ne(r,{shape:s,checks:[]}))}function Fc(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:Ur(e,t)}))}function Ur(e,t){let r={};return pe(r,e,Reflect.ownKeys(re(e))),Ec(r,t),r}function jc(e,t){if(!ce(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Y(e,ne(e._zod.def,{shape:Ur(e,t)}))}function Mc(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 Uc(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,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 Bc(e,t,r){let n=r?new Set(Qe(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 Lt(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 he(e){return typeof e=="string"?e:e?.message}function et(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:he(e.inst?._zod.def?.error?.(e))??he(i?.(e))??he(t?.error?.(e))??he(r.customError?.(e))??he(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 Br(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Jc=/[\uD800-\uDBFF]/;function Ae(e){let t=e.length;if(!Jc.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 Dt(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 xe(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Wc(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Jr(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 Wr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Kc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Jr(t+r)}function Vc(e){return Wr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Gc(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 Hc(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Et=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}):qc(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 tt(e,t,r){return se(e,t,r,!1)}function Xc(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 qc(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 Yc(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Pt,ie=!1,Qc={configurable:!0,get(){ie=!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,Qc);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 ea(e,t,r,n){let o=Yc(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 Kr="~constantCatch";function Vr(e){let t=()=>e;return t[Kr]=!0,t}var Gr;var jt={value:void 0,enumerable:!1},Hr="captureStackTrace"in Error?Error:null;function ta(e){let t=Hr;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Hr=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{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),z=h._zod.constr.prototype,y=_;for(;y&&y!==z;)y=Object.getPrototypeOf(y);let S=y??_;c.has(S)||(c.add(S),Ft(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?ta(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.")}},ze=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Gr=globalThis).__zod_globalConfig??(Gr.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function G(e){return e&&Object.assign(B,e),B}function ra(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ye,2)),e.message}function na(e){this._zod.message=e}var oa={get:ra,set:na,enumerable:!0,configurable:!0},Ut={value:void 0,enumerable:!1},Xr=new WeakSet([Object.prototype,Error.prototype]),qr=(e,t)=>{e.name="$ZodError",Ut.value=t,Object.defineProperty(e,"issues",Ut),Ut.value=void 0,Object.defineProperty(e,"message",oa);let r=Object.getPrototypeOf(e);Xr.has(r)||(Xr.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})}}))},Yr=m("$ZodError",qr),Bt=m("$ZodError",qr,void 0,{Parent:Error});function ia(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 Qr(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?ia(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function en(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 rt(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 Xe(a,i?.callee??t),a}return c.value};return t},Jt=Ie(Bt),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 Xe(a,i?.callee??t),a}return c.value};return t},Wt=Ne(Bt),nt=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?tn(e,i.issues,o):{success:!0,data:i.value}};function tn(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 ot=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?tn(e,i.issues,o):{success:!0,data:i.value}};var ca=Symbol.for("zod.compile.invalid"),aa=Symbol.for("zod.compile.fallback"),Kt=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==ca)return!0;if(n.definite===!0&&r===void 0)return!1}return ua(e,t,r)});function ua(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[aa]=!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 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},rn=e=>{let t=Ie(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,rt(r,s))};return r};var nn=e=>{let t=Ie(e),r=(n,o,i,s)=>t(n,o,i,rt(r,s));return r};var on=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,rt(r,s))};return r};var sn=e=>{let t=Ne(e),r=async(n,o,i,s)=>await t(n,o,i,rt(r,s));return r};var cn=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return nt(e)(t,r,o)};var an=e=>(t,r,n)=>nt(e)(t,r,n);var un=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ot(e)(t,r,o)};var ln=e=>async(t,r,n)=>ot(e)(t,r,n);var pn=/^[cC][0-9a-z]{6,}$/,dn=/^[0-9a-z]+$/,fn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,mn=/^[0-9a-vA-V]{20}$/,hn=/^[A-Za-z0-9]{27}$/,gn=/^[a-zA-Z0-9_-]{21}$/;function _n(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var yn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var xn=/^([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 zn=/^(?:[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 la="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function bn(){return new RegExp(la,"u")}var vn=/^(?:(?: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])$/,$n=/^(([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 Sn=/^((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])$/,wn=/^(([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])$/,kn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Pn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Zn=/^https?$/,En=/^\+[1-9]\d{6,14}$/;var On="(?:(?:\\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 pa(e){return new RegExp(`^${e}$`)}var Tn=pa(On);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 An(e){return new RegExp(`^${Gt(e)}$`)}function Cn(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(`^${On}T(?:${n})$`)}var In=/^[\s\S]{0,}$/;var Xt=/^-?\d+$/,Re=/^-?\d+(?:\.\d+)?$/,Nn=/^(?:true|false)$/i,Rn=/^null$/i;var Ln=/^[^A-Z]*$/,Dn=/^[^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!Ot(t)&&t.length!==void 0},it={number:"number",bigint:"bigint",object:"date"},Yt=m("$ZodCheckLessThan",(e,t)=>{M.init(e,t);let r=it[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:it[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)=>{M.init(e,t);let r=it[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:it[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})}}),Fn=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):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)=>{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 Mn=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})}}),Un=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})}}),Bn=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=()=>{})}),Jn=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})}}),Wn=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ln),De.init(e,t)}),Kn=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Dn),De.init(e,t)}),Vn=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})}}),Gn=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})}}),Hn=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 Xn=m("$ZodCheckOverwrite",(e,t)=>{M.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var st=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 qn={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=qn;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(Nt(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 Ye(this,"~standard",Qt(this))},set"~standard"(e){ie(this,"~standard",e)}}),po=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Q(r,t,V()))}:{value:e.value};async function da(e,t){let r={async:!0};return po(await e._zod.run({value:t,issues:[]},r),r)}function Qt(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return po(n,r)}catch{}return da(e,t)},vendor:"zod",version:1}}var ct=m("$ZodString",(e,t)=>{E.init(e,t),e._zod.pattern=t.pattern??Cn,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),ct.init(e,t)}),fo=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=yn),A.init(e,t)}),mo=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=Vt(n))}else t.pattern??(t.pattern=Vt());A.init(e,t)}),ho=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xn),A.init(e,t)}),go=1,it=2;function _o(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function fa(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?_o(e)||it:ma(e,t)}function ma(e,t){if(!t.normalize&&t.protocol?.source===Pn.source&&!/^https?:\/\//i.test(e))return go;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??it}return new URL(e)}catch{return it}}var ha=/[\t\n\r]/g;function Yn(e){return e.replace(ha,"")}function ga(e,t){return t.lastIndex=0,t.test(e.hostname)}function _a(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var yo=m("$ZodURL",(e,t)=>{A.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=fa(n,t);if(o===go){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===it){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Yn(n);return}t.hostname&&!ga(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&&!_a(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:Yn(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),xo=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zn()),A.init(e,t)}),zo=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?hn:gn(t.length)),A.init(e,t)}),bo=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ln),A.init(e,t)}),vo=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=pn),A.init(e,t)}),$o=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=dn),A.init(e,t)}),So=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=fn),A.init(e,t)}),wo=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=mn),A.init(e,t)}),ko=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=An(t)),A.init(e,t)}),Po=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=En),A.init(e,t)}),Zo=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Tn(t)),A.init(e,t)}),Oo=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=_n),A.init(e,t)}),Eo=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=bn),A.init(e,t)}),ya=/^[0-9a-fA-F:.]+$/;function To(e){return ya.test(e)?_o(`http://[${e}]`):!1}var Ao=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=vn),A.init(e,t),e._zod.check=r=>{To(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Co=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=$n),A.init(e,t)});function xa(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:To(r)}var Io=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Sn),A.init(e,t),e._zod.check=r=>{xa(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function No(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var er=/^[0-9a-zA-Z+/]*={0,2}$/,Ro=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=er),A.init(e,t),e._zod.check=r=>{No(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),at=/^[A-Za-z0-9_-]*$/;function za(e){if(!at.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return No(r)}var Do=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=at),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})}}),Lo=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Zn),A.init(e,t)});function ba(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 Fo=m("$ZodJWT",(e,t)=>{A.init(e,t),e._zod.check=r=>{ba(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var tr=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}}),jo=m("$ZodNumberFormat",(e,t)=>{Fn.init(e,t),tr.init(e,t)}),Mo=m("$ZodBoolean",(e,t)=>{E.init(e,t),e._zod.pattern=In,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 Uo=m("$ZodNull",(e,t)=>{E.init(e,t),e._zod.pattern=Nn,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}}),Bo=m("$ZodAny",(e,t)=>{E.init(e,t),e._zod.parse=r=>r}),Jo=m("$ZodUnknown",(e,t)=>{E.init(e,t),e._zod.parse=r=>r}),Wo=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)}),Ko=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 va(e,t){let r=qe(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 qe(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 $a=e=>Array.isArray(e)?e.length:-1;function Qn(e,t,r){e.issues.length&&t.issues.push(...Y(r,e.issues)),t.value[r]=e.value}var Vo=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=>Qn(d,n,u)));else if(Qn(l,n,u),c&&l.issues.length!==0&&K(l))break}return s.length?Promise.all(s).then(()=>n):n},va(e,$a)});function st(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 Sa=[];function Go(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Sa,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=It(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Ho(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=>st(y,r,g,t,d,h))):st(_,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 wa=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(()=>Go(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=me,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=>st(b,a,y,d,w,Z))):st(x,a,y,d,w,Z)}return s?Ho(h,d,a,l,o.value,e,g===!0):h.length?Promise.all(h).then(()=>a):a}}),Xo=m("$ZodObjectJIT",(e,t)=>{wa.init(e,t);let r=e._zod.parse,n=we(()=>Go(t)),o=U.memoizer,i=f=>{let g=n.value,_=g.symbolKeys,y=new nt(["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 Yn={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=Yn;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(Lt(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 tt(this,"~standard",tr(this))},set"~standard"(e){se(this,"~standard",e)}}),fo=(e,t)=>e.issues.length?{issues:e.issues.map(r=>ee(r,t,G()))}:{value:e.value};async function da(e,t){let r={async:!0};return fo(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 fo(n,r)}catch{}return da(e,t)},vendor:"zod",version:1}}var lt=m("$ZodString",(e,t)=>{T.init(e,t),e._zod.pattern=t.pattern??In,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),lt.init(e,t)}),mo=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=xn),C.init(e,t)}),ho=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());C.init(e,t)}),go=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zn),C.init(e,t)}),_o=1,at=2;function yo(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function fa(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?yo(e)||at:ma(e,t)}function ma(e,t){if(!t.normalize&&t.protocol?.source===Zn.source&&!/^https?:\/\//i.test(e))return _o;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??at}return new URL(e)}catch{return at}}var ha=/[\t\n\r]/g;function Qn(e){return e.replace(ha,"")}function ga(e,t){return t.lastIndex=0,t.test(e.hostname)}function _a(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var xo=m("$ZodURL",(e,t)=>{C.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=fa(n,t);if(o===_o){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===at){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Qn(n);return}t.hostname&&!ga(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&&!_a(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:Qn(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),zo=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=bn()),C.init(e,t)}),bo=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?gn:_n(t.length)),C.init(e,t)}),vo=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=pn),C.init(e,t)}),$o=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=dn),C.init(e,t)}),So=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fn),C.init(e,t)}),wo=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=mn),C.init(e,t)}),ko=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hn),C.init(e,t)}),Po=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Cn(t)),C.init(e,t)}),Zo=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Tn),C.init(e,t)}),Eo=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=An(t)),C.init(e,t)}),Oo=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=yn),C.init(e,t)}),To=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=vn),C.init(e,t)}),ya=/^[0-9a-fA-F:.]+$/;function Ao(e){return ya.test(e)?yo(`http://[${e}]`):!1}var Co=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=$n),C.init(e,t),e._zod.check=r=>{Ao(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Io=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Sn),C.init(e,t)});function xa(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:Ao(r)}var No=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=wn),C.init(e,t),e._zod.check=r=>{xa(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Ro(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}$/,Lo=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=rr),C.init(e,t),e._zod.check=r=>{Ro(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),pt=/^[A-Za-z0-9_-]*$/;function za(e){if(!pt.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ro(r)}var Do=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=pt),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})}}),Fo=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=En),C.init(e,t)});function ba(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)=>{C.init(e,t),e._zod.check=r=>{ba(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)=>{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}}),Mo=m("$ZodNumberFormat",(e,t)=>{jn.init(e,t),nr.init(e,t)}),Uo=m("$ZodBoolean",(e,t)=>{T.init(e,t),e._zod.pattern=Nn,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 Bo=m("$ZodNull",(e,t)=>{T.init(e,t),e._zod.pattern=Rn,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}}),Jo=m("$ZodAny",(e,t)=>{T.init(e,t),e._zod.parse=r=>r}),Wo=m("$ZodUnknown",(e,t)=>{T.init(e,t),e._zod.parse=r=>r}),Ko=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)}),Vo=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 va(e,t){let r=et(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 et(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 $a=e=>Array.isArray(e)?e.length:-1;function eo(e,t,r){e.issues.length&&t.issues.push(...Q(r,e.issues)),t.value[r]=e.value}var Go=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=>eo(p,n,a)));else if(eo(l,n,a),c&&l.issues.length!==0&&V(l))break}return s.length?Promise.all(s).then(()=>n):n},va(e,$a)});function ut(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 Sa=[];function Ho(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Sa,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 Xo(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=>ut(z,r,g,t,p,h))):ut(_,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 wa=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(()=>Ho(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=ge,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=>ut(b,u,z,p,S,E))):ut(x,u,z,p,S,E)}return s?Xo(h,p,u,l,o.value,e,g===!0):h.length?Promise.all(h).then(()=>u):u}}),qo=m("$ZodObjectJIT",(e,t)=>{wa.init(e,t);let r=e._zod.parse,n=Pe(()=>Ho(t)),o=B.memoizer,i=f=>{let g=n.value,_=g.symbolKeys,z=new st(["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 ? [${k}, ...iss.path] : [${k}];
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
- }`;y.write("const input = payload.value;");let Z=Object.create(null),x=0;for(let b of g.allKeys)Z[b]=`key_${x++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let b of g.allKeys){if(b==="__proto__")continue;let k=Z[b],C=typeof b=="symbol"?`syms[${_.indexOf(b)}]`:Et(b),Se=`${C} in input`,de=f[b],St=de?._zod?.optin,Ir=St!==void 0,yc=de?._zod?.optout==="optional";if(y.write(`const ${k} = ${z(C)};`),Ir&&yc){let xc=St==="optional"?`${k}_present`:`${k}.value !== undefined || ${k}_present`;y.write(`
17
- const ${k}_present = ${Se};
18
- if (!${k}.issues.length || ${k}_present) {
19
- if (${k}.issues.length) {${w(k,C)}
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)}]`:At(b),F=`${P} in input`,me=f[b],le=me?._zod?.optin,Ge=le!==void 0,ke=me?._zod?.optout==="optional";if(z.write(`const ${v} = ${y(P)};`),Ge&&ke){let xc=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 (${xc}) {
23
- newResult[${C}] = ${k}.value;
23
+ newResult[${P}] = ${v}.value;
24
24
  }
25
25
  }
26
26
 
27
- `)}else Ir?(y.write(`
28
- if (${k}.issues.length) {${w(k,C)}
27
+ `)}else Ge?(z.write(`
28
+ if (${v}.issues.length) {${S(v,P)}
29
29
  }
30
- `),St==="defaulted"?y.write(`newResult[${C}] = ${k}.value;`):y.write(`
31
- if (${k}.value !== undefined || ${Se}) {
32
- newResult[${C}] = ${k}.value;
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
- `)):y.write(`
35
- const ${k}_present = ${Se};
36
- if (${k}.issues.length) {${w(k,C)}
34
+ `)):z.write(`
35
+ const ${v}_present = ${F};
36
+ if (${v}.issues.length) {${S(v,P)}
37
37
  }
38
- if (!${k}_present && !${k}.issues.length) {
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: [${C}]
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 (${k}_present) {
52
- newResult[${C}] = ${k}.value;
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=me,u=!U.jitless,l=u&&At.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?Ho([],_,f,g,h,e,g?.abortEarly===!0):f):r(f,g):(f.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),f)}});function eo(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 qo=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=>eo(c,n,e,o)):eo(s,n,e,o)}});var Yo=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])=>to(r,u,a)):to(r,i,s)}});function Yt(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=Yt(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=Yt(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 to(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=Yt(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 rr=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=ro(r,"optin"),a=ro(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=>no(w,o,f))):no(z,o,f)}}return c.length?Promise.all(c).then(()=>oo(l,o,r,s,a)):oo(l,o,r,s,a)}});function ro(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 no(e,t,r){e.issues.length&&t.issues.push(...Y(r,e.issues)),t.value[r]=e.value}function oo(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 Qo=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 ei=m("$ZodEnum",(e,t)=>{E.init(e,t);let r=he(t.entries),n=new Set(r);e._zod.values=n,O(e,"pattern",o=>{let i=he(o.def.entries).filter(s=>Ct.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 ti=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 ye(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 io(e,t){return e.value=t.issues.length?void 0:t.value,e}var nr=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=>io(r,i)):io(r,o)}return t.innerType._zod.run(r,n)}}),ri=m("$ZodExactOptional",(e,t)=>{nr.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)}),ni=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)}),oi=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=>so(i,t)):so(o,t)}});function so(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ii=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))}),si=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=>co(i,e)):co(o,e)}});function co(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 ao(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 ci=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=>ao(r,i,t,n)):ao(r,o,t,n)}});var ai=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=>ot(s,t.in,n)):ot(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ot(i,t.out,n)):ot(o,t.out,n)}});function ot(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 ui=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(uo):uo(o)}});function uo(e){return e.memo||(e.value=Object.freeze(e.value)),e}var li=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?Ut(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Ut(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 Bt(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Bt(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 rr({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 pi=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=>lo(i,r,n,e));lo(o,r,n,e)}});function lo(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(_e(o))}}var ir=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},sr="~memo",di=[];function fi(e){return e!==null&&typeof e=="object"}function or(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var mi=new WeakMap,De=0,pt=1,Le=2;function dt(e,t,r){let n=mi.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=dt(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?pt:g.value?._zod?dt(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):pt),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?dt(l,t,!1):pt);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),ka(e,o)}function ka(e,t){return t!==pt&&mi.set(e,t===Le),t}function Pa(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var ut,lt=[],Za={alloc(e,t,r){let n=ut;if(!n)return r;ut=void 0;let o={value:r,issues:null};return n.set(t.value,o),lt.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"&&Oa(i,o.value))throw new ir;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=dt(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(!fi(l))return s(u,a);let d=a[sr];d||(d={buckets:new WeakMap,backEdges:void 0},a[sr]=d);let h;o===a?h=i:(h=Pa(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(...or(f.issues)):(u.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value)),u;ut=h;let g=lt.length,_=s(u,a);ut=void 0;let y=lt.length>g?lt.pop():void 0;return _ instanceof Promise?_.then(z=>(y&&(y.issues=z.issues.length?or(z.issues):di),z)):(y&&(y.issues=_.issues.length?or(_.issues):di),_)};e._zod.parse=c,e._zod.run===s&&(e._zod.run=c)})}};function hi(){return Za}function Oa(e,t){let r=e[sr]?.backEdges;return r!==void 0&&fi(t)&&r.has(t)}var Ea=()=>{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=Rt(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 ${Ge(i.values[0])}`:`Invalid option: expected one of ${Ke(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":""}: ${Ke(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 gi(){return{localeError:Ea()}}var _i;var cr=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 Ta(){return new cr}(_i=globalThis).__zod_globalRegistry??(_i.__zod_globalRegistry=Ta());var pe=globalThis.__zod_globalRegistry;function yi(e){return e.checks&&(e.checks=[...e.checks]),e}function xi(e,t){return new e(yi({type:"string",...v(t)}))}function zi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...v(t)})}function bi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...v(t)})}function vi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...v(t)})}function $i(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...v(t)})}function Si(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...v(t)})}function wi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...v(t)})}function ki(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...v(t)})}function Pi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...v(t)})}function Zi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...v(t)})}function Oi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...v(t)})}function Ei(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...v(t)})}function Ti(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...v(t)})}function Ai(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...v(t)})}function Ci(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...v(t)})}function Ii(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...v(t)})}function Ni(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...v(t)})}function Ri(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...v(t)})}function Di(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...v(t)})}function Li(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...v(t)})}function Fi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...v(t)})}function ji(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...v(t)})}function Mi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...v(t)})}function Ui(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...v(t)})}function Bi(e,t){return new e({type:"string",format:"date",check:"string_format",...v(t)})}function Ji(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...v(t)})}function Wi(e,t){return new e({type:"string",format:"duration",check:"string_format",...v(t)})}function Ki(e,t){return new e(yi({type:"number",checks:[],...v(t)}))}function Vi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...v(t)})}function Gi(e,t){return new e({type:"boolean",...v(t)})}function Hi(e,t){return new e({type:"null",...v(t)})}function Xi(e){return new e({type:"any"})}function qi(e){return new e({type:"unknown"})}function Yi(e,t){return new e({type:"never",...v(t)})}function Qi(e,t){return new e({type:"void",...v(t)})}function ft(e,t){return new Xt({check:"less_than",...v(t),value:e,inclusive:!1})}function Fe(e,t){return new Xt({check:"less_than",...v(t),value:e,inclusive:!0})}function mt(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 ht(e,t){return new Ln({check:"multiple_of",...v(t),value:e})}function gt(e,t){return new jn({check:"max_length",...v(t),maximum:e})}function xe(e,t){return new Mn({check:"min_length",...v(t),minimum:e})}function _t(e,t){return new Un({check:"length_equals",...v(t),length:e})}function ar(e,t){return new Bn({check:"string_format",format:"regex",...v(t),pattern:e})}function ur(e){return new Jn({check:"string_format",format:"lowercase",...v(e)})}function lr(e){return new Wn({check:"string_format",format:"uppercase",...v(e)})}function pr(e,t){return new Kn({check:"string_format",format:"includes",...v(t),includes:e})}function dr(e,t){return new Vn({check:"string_format",format:"starts_with",...v(t),prefix:e})}function fr(e,t){return new Gn({check:"string_format",format:"ends_with",...v(t),suffix:e})}function ce(e){return new Hn({check:"overwrite",tx:e})}function mr(e){return ce(t=>t.normalize(e))}function hr(){return ce(e=>e.trim())}function gr(){return ce(e=>e.toLowerCase())}function _r(){return ce(e=>e.toUpperCase())}function yr(){return ce(e=>Tt(e))}function es(e,t,r){return new e({type:"array",element:t,...v(r)})}function ts(e,t,r){return new e({type:"custom",check:"custom",fn:t,...v(r)})}function rs(e,t){let r=Aa(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(_e(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(_e(i))}},e(n.value,n)),t);return r}function Aa(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 zr(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 ns(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function br(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}/${ns(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+ns(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=ge,a=!B.jitless,l=a&&It.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?Xo([],_,f,g,h,e,g?.abortEarly===!0):f):r(f,g):(f.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),f)}});function to(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 Yo=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=>to(c,n,e,o)):to(s,n,e,o)}});var Qo=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])=>ro(r,a,u)):ro(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(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=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 ro(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=er(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 or=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=no(r,"optin"),u=no(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=>oo(S,o,f))):oo(y,o,f)}}return c.length?Promise.all(c).then(()=>io(l,o,r,s,u)):io(l,o,r,s,u)}});function no(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 oo(e,t,r){e.issues.length&&t.issues.push(...Q(r,e.issues)),t.value[r]=e.value}function io(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 ei=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 ti=m("$ZodEnum",(e,t)=>{T.init(e,t);let r=_e(t.entries),n=new Set(r);e._zod.values=n,O(e,"pattern",o=>{let i=_e(o.def.entries).filter(s=>Nt.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 ri=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 ze(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 so(e,t){return e.value=t.issues.length?void 0:t.value,e}var ir=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=>so(r,i)):so(r,o)}return t.innerType._zod.run(r,n)}}),ni=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)}),oi=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)}),ii=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=>co(i,t)):co(o,t)}});function co(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var si=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))}),ci=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=>ao(i,e)):ao(o,e)}});function ao(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 uo(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 ai=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=>uo(r,i,t,n)):uo(r,o,t,n)}});var ui=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=>ct(s,t.in,n)):ct(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ct(i,t.out,n)):ct(o,t.out,n)}});function ct(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 li=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(lo):lo(o)}});function lo(e){return e.memo||(e.value=Object.freeze(e.value)),e}var pi=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?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 di=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=>po(i,r,n,e));po(o,r,n,e)}});function po(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(xe(o))}}var cr=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},ar="~memo",fi=[];function mi(e){return e!==null&&typeof e=="object"}function sr(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var hi=new WeakMap,Fe=0,mt=1,je=2;function ht(e,t,r){let n=hi.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=ht(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?mt:g.value?._zod?ht(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):mt),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?ht(l,t,!1):mt);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),ka(e,o)}function ka(e,t){return t!==mt&&hi.set(e,t===je),t}function Pa(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var dt,ft=[],Za={alloc(e,t,r){let n=dt;if(!n)return r;dt=void 0;let o={value:r,issues:null};return n.set(t.value,o),ft.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"&&Ea(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=(a,u)=>{if(r===void 0){let y=ht(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(!mi(l))return s(a,u);let p=u[ar];p||(p={buckets:new WeakMap,backEdges:void 0},u[ar]=p);let h;o===u?h=i:(h=Pa(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(...sr(f.issues)):(a.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(f.value)),a;dt=h;let g=ft.length,_=s(a,u);dt=void 0;let z=ft.length>g?ft.pop():void 0;return _ instanceof Promise?_.then(y=>(z&&(z.issues=y.issues.length?sr(y.issues):fi),y)):(z&&(z.issues=_.issues.length?sr(_.issues):fi),_)};e._zod.parse=c,e._zod.run===s&&(e._zod.run=c)})}};function gi(){return Za}function Ea(e,t){let r=e[ar]?.backEdges;return r!==void 0&&mi(t)&&r.has(t)}var Oa=()=>{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=Dt(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 ${qe(i.values[0])}`:`Invalid option: expected one of ${He(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":""}: ${He(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 _i(){return{localeError:Oa()}}var yi;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 Ta(){return new ur}(yi=globalThis).__zod_globalRegistry??(yi.__zod_globalRegistry=Ta());var fe=globalThis.__zod_globalRegistry;function xi(e){return e.checks&&(e.checks=[...e.checks]),e}function zi(e,t){return new e(xi({type:"string",...$(t)}))}function bi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}function vi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function $i(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}function Si(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}function wi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}function ki(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}function Pi(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}function Zi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}function Ei(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}function Oi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}function Ti(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}function Ai(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}function Ci(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}function Ii(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}function Ni(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}function Ri(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}function Li(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}function Di(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}function Fi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}function ji(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}function Mi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}function Ui(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}function Bi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}function Ji(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}function Wi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}function Ki(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}function Vi(e,t){return new e(xi({type:"number",checks:[],...$(t)}))}function Gi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}function Hi(e,t){return new e({type:"boolean",...$(t)})}function Xi(e,t){return new e({type:"null",...$(t)})}function qi(e){return new e({type:"any"})}function Yi(e){return new e({type:"unknown"})}function Qi(e,t){return new e({type:"never",...$(t)})}function es(e,t){return new e({type:"void",...$(t)})}function gt(e,t){return new Yt({check:"less_than",...$(t),value:e,inclusive:!1})}function Me(e,t){return new Yt({check:"less_than",...$(t),value:e,inclusive:!0})}function _t(e,t){return new Qt({check:"greater_than",...$(t),value:e,inclusive:!1})}function Ue(e,t){return new Qt({check:"greater_than",...$(t),value:e,inclusive:!0})}function yt(e,t){return new Fn({check:"multiple_of",...$(t),value:e})}function xt(e,t){return new Mn({check:"max_length",...$(t),maximum:e})}function be(e,t){return new Un({check:"min_length",...$(t),minimum:e})}function zt(e,t){return new Bn({check:"length_equals",...$(t),length:e})}function lr(e,t){return new Jn({check:"string_format",format:"regex",...$(t),pattern:e})}function pr(e){return new Wn({check:"string_format",format:"lowercase",...$(e)})}function dr(e){return new Kn({check:"string_format",format:"uppercase",...$(e)})}function fr(e,t){return new Vn({check:"string_format",format:"includes",...$(t),includes:e})}function mr(e,t){return new Gn({check:"string_format",format:"starts_with",...$(t),prefix:e})}function hr(e,t){return new Hn({check:"string_format",format:"ends_with",...$(t),suffix:e})}function ae(e){return new Xn({check:"overwrite",tx:e})}function gr(e){return ae(t=>t.normalize(e))}function _r(){return ae(e=>e.trim())}function yr(){return ae(e=>e.toLowerCase())}function xr(){return ae(e=>e.toUpperCase())}function zr(){return ae(e=>Ct(e))}function ts(e,t,r){return new e({type:"array",element:t,...$(r)})}function rs(e,t,r){return new e({type:"custom",check:"custom",fn:t,...$(r)})}function ns(e,t){let r=Aa(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(xe(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(xe(i))}},e(n.value,n)),t);return r}function Aa(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 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??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 os(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 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}/${os(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+os(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 ss(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;ss(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 cs=new Set(["type","properties","required","additionalProperties"]),os=["oneOf","anyOf"];function is(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function xr(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!cs.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]??is(a);l!=null&&(c.some(d=>JSON.stringify(d)===JSON.stringify(l))||c.push(l))}let u=c.length===1?c[0]:xr(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=is(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 Ca(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of cs)if(o in e)return;let r=t.filter(o=>os.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=xr(t);else{let o=r[0],i=os.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=>xr([...s,u]));if(c.some(u=>!u))return;n={[i]:c}}n&&(delete e.allOf,Me(e,n))}function vr(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())ss(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)??[])Ca(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 as=(e,t={})=>r=>{let n=zr({...r,processors:t});return N(e,n),br(n,e),vr(n,e)},Ue=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=zr({...o??{},target:i,io:t,processors:r});return N(e,s),br(s,e),vr(s,e)};var ze=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},be=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},us=(e,t)=>{ze(e,"minimum",t),be(e,"maximum",t)},fs=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},ms=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},hs=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},gs=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},ls=(e,t)=>ze(e,"minimum",t.minimum),ps=(e,t)=>be(e,"maximum",t.maximum),ds=e=>(t,r)=>{gs(t,r.format);let[n,o]=e[r.format];ze(t,"minimum",n),be(t,"maximum",o)},Ia={greater_than:(e,t)=>ze(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>be(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>fs(e,t.value),number_format:ds(Ze),bigint_format:ds(He),min_length:ls,max_length:ps,length_equals:(e,t)=>us(e,t.length),min_size:ls,max_size:ps,size_equals:(e,t)=>us(e,t.size),string_format:(e,t)=>{gs(e,t.format),t.pattern&&ms(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)=>hs(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)Ia[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&ze(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&ze(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&be(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&be(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&fs(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&hs(t,o.mime);for(let i of o.patterns??[])ms(t,i);return t}var Na={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ra=new Map([[er,wn],[at,kn]]),_s=e=>Ra.get(e)??e,ys=(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=Na[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(_s);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}))])}},xs=(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}))])}},zs=(e,t,r,n)=>{r.type="boolean"};var bs=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var vs=(e,t,r,n)=>{ne(e,t,r,n,"Void cannot be represented in JSON Schema")},$s=(e,t,r,n)=>{r.not={}},Ss=(e,t,r,n)=>{},ws=(e,t,r,n)=>{};var ks=(e,t,r,n)=>{let o=e._zod.def,i=he(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 Ps=(e,t,r,n)=>{ne(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Zs=(e,t,r,n)=>{ne(e,t,r,n,"Function types cannot be represented in JSON Schema")},Os=(e,t,r,n)=>{ne(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Es=(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 Ts=(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)},As=(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},Cs=(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)},Is=(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 $r(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 _=$r(e,g,r);return _===g?t:_}for(let g of["anyOf","oneOf"]){let _=t[g];if(!Array.isArray(_))continue;let y=_.map(z=>$r(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:Gt).source)),f}var Sr=new WeakMap;function Da(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 Sr.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=$r(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 Ns=(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,_s(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=Sr.get(t);l||(l=[],Sr.set(t,l),t.deferred.push(()=>Da(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))}},Rs=(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"}]},Ds=(e,t,r,n)=>{let o=e._zod.def;N(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},wr=Symbol();function Ls(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"),wr):JSON.parse(s)}var Fs=(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=Ls(o.defaultValue,e,t,r,n);s!==wr&&(r.default=s)},js=(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=Ls(o.defaultValue,e,t,r,n);s!==wr&&(r._prefault=s)},Ms=(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},Us=(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},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,r.readOnly=!0};var kr=(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 Js=new WeakSet([Object.prototype,Error.prototype]);function yt(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 Wa=(e,t)=>{qr.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Js.has(r)||(Js.add(r),yt(r,"format",n=>o=>Qr(n,o)),yt(r,"flatten",n=>o=>Yr(n,o)),yt(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ge,2)}),yt(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ge,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var H=m("ZodError",Wa,void 0,{Parent:Error});var Ws=Ae(H),Ks=Ce(H),Vs=et(H),Gs=tt(H),Hs=tn(H),Xs=rn(H),qs=nn(H),Ys=on(H),Qs=sn(H),ec=cn(H),tc=an(H),rc=un(H);function Va(){U.localeError||V(gi())}function Je(){U.memoizer||V({memoizer:hi()})}var T=m("ZodType",(e,t)=>(Va(),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(Gu(e,t))},superRefine(e,t){return this.check(Hu(e,t))},overwrite(e){return this.check(ce(e))},optional(){return ic(this)},exactOptional(){return Iu(this)},nullable(){return sc(this)},nullish(){return ic(sc(this))},nonoptional(e){return ju(this,e)},array(){return I(this)},or(e){return ae([this,e])},and(e){return Ou(this,e)},transform(e){return cc(this,Cu(e))},default(e){return Du(this,e)},prefault(e){return Fu(this,e)},catch(e){return Uu(this,e)},pipe(e){return cc(this,e)},readonly(){return Wu(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",{...Qt(this),jsonSchema:{input:Ue(this,"input"),output:Ue(this,"output")}})},set"~standard"(e){$.own(this,"~standard",e)},parse:function e(t,r){return Ws(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Ks(this,t,r,{callee:e})},safeParse(e,t){return Vs(this,e,t)},async safeParseAsync(e,t){return Gs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){$.own(this,"spa",e)},validate(e,t){return Jt(this,e,t)},validateAsync(e,t){return Wt(this,e,t)},encode:function e(t,r){return Hs(this,t,r,{callee:e})},decode:function e(t,r){return Xs(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await qs(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Ys(this,t,r,{callee:e})},safeEncode(e,t){return Qs(this,e,t)},safeDecode(e,t){return ec(this,e,t)},async safeEncodeAsync(e,t){return tc(this,e,t)},async safeDecodeAsync(e,t){return rc(this,e,t)},toJSONSchema(e){return as(this,{})(e)},get description(){return pe.get(this)?.description},get _def(){return this._zod.def}}),ac=m("_ZodString",(e,t)=>{ct.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ys(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(ar(...e))},includes(...e){return this.check(pr(...e))},startsWith(...e){return this.check(dr(...e))},endsWith(...e){return this.check(fr(...e))},min(...e){return this.check(xe(...e))},max(...e){return this.check(gt(...e))},length(...e){return this.check(_t(...e))},nonempty(...e){return this.check(xe(1,...e))},lowercase(e){return this.check(ur(e))},uppercase(e){return this.check(lr(e))},trim(){return this.check(hr())},normalize(...e){return this.check(mr(...e))},toLowerCase(){return this.check(gr())},toUpperCase(){return this.check(_r())},slugify(){return this.check(yr())}})),Ga=m("ZodString",(e,t)=>{ct.init(e,t),ac.init(e,t)},{email(e){return this.check(zi(Qa,e))},url(e){return this.check(ki(tu,e))},jwt(e){return this.check(Mi(gu,e))},emoji(e){return this.check(Pi(ru,e))},guid(e){return this.check(bi(eu,e))},uuid(e){return this.check(vi(xt,e))},uuidv4(e){return this.check($i(xt,e))},uuidv6(e){return this.check(Si(xt,e))},uuidv7(e){return this.check(wi(xt,e))},nanoid(e){return this.check(Zi(nu,e))},cuid(e){return this.check(Oi(ou,e))},cuid2(e){return this.check(Ei(iu,e))},ulid(e){return this.check(Ti(su,e))},base64(e){return this.check(Li(fu,e))},base64url(e){return this.check(Fi(mu,e))},xid(e){return this.check(Ai(cu,e))},ksuid(e){return this.check(Ci(au,e))},ipv4(e){return this.check(Ii(uu,e))},ipv6(e){return this.check(Ni(lu,e))},cidrv4(e){return this.check(Ri(pu,e))},cidrv6(e){return this.check(Di(du,e))},e164(e){return this.check(ji(hu,e))},datetime(e){return this.check(Ui(Ha,e))},date(e){return this.check(Bi(Xa,e))},time(e){return this.check(Ji(qa,e))},duration(e){return this.check(Wi(Ya,e))}});function p(e){return xi(Ga,e)}var R=m("ZodStringFormat",(e,t)=>{A.init(e,t),ac.init(e,t)}),Ha=m("ZodISODateTime",(e,t)=>{ko.init(e,t),R.init(e,t)}),Xa=m("ZodISODate",(e,t)=>{Po.init(e,t),R.init(e,t)}),qa=m("ZodISOTime",(e,t)=>{Zo.init(e,t),R.init(e,t)}),Ya=m("ZodISODuration",(e,t)=>{Oo.init(e,t),R.init(e,t)}),Qa=m("ZodEmail",(e,t)=>{ho.init(e,t),R.init(e,t)});var eu=m("ZodGUID",(e,t)=>{fo.init(e,t),R.init(e,t)});var xt=m("ZodUUID",(e,t)=>{mo.init(e,t),R.init(e,t)});var tu=m("ZodURL",(e,t)=>{yo.init(e,t),R.init(e,t)});var ru=m("ZodEmoji",(e,t)=>{xo.init(e,t),R.init(e,t)});var nu=m("ZodNanoID",(e,t)=>{zo.init(e,t),R.init(e,t)});var ou=m("ZodCUID",(e,t)=>{bo.init(e,t),R.init(e,t)});var iu=m("ZodCUID2",(e,t)=>{vo.init(e,t),R.init(e,t)});var su=m("ZodULID",(e,t)=>{$o.init(e,t),R.init(e,t)});var cu=m("ZodXID",(e,t)=>{So.init(e,t),R.init(e,t)});var au=m("ZodKSUID",(e,t)=>{wo.init(e,t),R.init(e,t)});var uu=m("ZodIPv4",(e,t)=>{Eo.init(e,t),R.init(e,t)});var lu=m("ZodIPv6",(e,t)=>{Ao.init(e,t),R.init(e,t)});var pu=m("ZodCIDRv4",(e,t)=>{Co.init(e,t),R.init(e,t)});var du=m("ZodCIDRv6",(e,t)=>{Io.init(e,t),R.init(e,t)});var fu=m("ZodBase64",(e,t)=>{Ro.init(e,t),R.init(e,t)});var mu=m("ZodBase64URL",(e,t)=>{Do.init(e,t),R.init(e,t)});var hu=m("ZodE164",(e,t)=>{Lo.init(e,t),R.init(e,t)});var gu=m("ZodJWT",(e,t)=>{Fo.init(e,t),R.init(e,t)});var uc=m("ZodNumber",(e,t)=>{tr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xs(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(mt(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(ft(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(nc(e))},safe(e){return this.check(nc(e))},positive(e){return this.check(mt(0,e))},nonnegative(e){return this.check(je(0,e))},negative(e){return this.check(ft(0,e))},nonpositive(e){return this.check(Fe(0,e))},multipleOf(e,t){return this.check(ht(e,t))},step(e,t){return this.check(ht(e,t))},finite(){return this}}));function P(e){return Ki(uc,e)}var _u=m("ZodNumberFormat",(e,t)=>{jo.init(e,t),uc.init(e,t)});function nc(e){return Vi(_u,e)}var yu=m("ZodBoolean",(e,t)=>{Mo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zs(e,r,n,o)});function D(e){return Gi(yu,e)}var xu=m("ZodNull",(e,t)=>{Uo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bs(e,r,n,o)});function Or(e){return Hi(xu,e)}var zu=m("ZodAny",(e,t)=>{Bo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ss(e,r,n,o)});function L(){return Xi(zu)}var bu=m("ZodUnknown",(e,t)=>{Jo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ws(e,r,n,o)});function zt(){return qi(bu)}var vu=m("ZodNever",(e,t)=>{Wo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$s(e,r,n,o)});function $u(e){return Yi(vu,e)}var Su=m("ZodVoid",(e,t)=>{Ko.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vs(e,r,n,o)});function J(e){return Qi(Su,e)}var wu=m("ZodArray",(e,t)=>{Je(),Vo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Es(e,r,n,o),e.element=t.element},{min(e,t){return this.check(xe(e,t))},nonempty(e){return this.check(xe(1,e))},max(e,t){return this.check(gt(e,t))},length(e,t){return this.check(_t(e,t))},unwrap(){return this.element}});function I(e,t){return es(wu,e,t)}var ku=m("ZodObject",(e,t)=>{Je(),Xo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ts(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:zt()}))},loose(){return this.clone($.mergeDefs(this._zod.def,{catchall:zt()}))},strict(){return this.clone($.mergeDefs(this._zod.def,{catchall:$u()}))},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(Er,this,e[0])},exactPartial(...e){return $.partial(lc,this,e[0],"exactPartial")},required(...e){return $.required(pc,this,e[0])}});function F(e,t){let r={type:"object",shape:e??{},...$.normalizeParams(t)};return new ku(r)}var Pu=m("ZodUnion",(e,t)=>{qo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>As(e,r,n,o),e.options=t.options});function ae(e,t){return new Pu({type:"union",options:e,...$.normalizeParams(t)})}var Zu=m("ZodIntersection",(e,t)=>{Yo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cs(e,r,n,o)});function Ou(e,t){return new Zu({type:"intersection",left:e,right:t})}var Eu=m("ZodTuple",(e,t)=>{Je(),rr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Is(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 Er({type:"optional",innerType:t}))})}});function Tu(e,t,r){let n=t instanceof E,o=n?r:t,i=n?t:null;return new Eu({type:"tuple",items:e,rest:i,...$.normalizeParams(o)})}var oc=m("ZodRecord",(e,t)=>{Je(),Qo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ns(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function S(e,t,r){return!t||!t._zod?new oc({type:"record",keyType:p(),valueType:e,...$.normalizeParams(t)}):new oc({type:"record",keyType:e,valueType:t,...$.normalizeParams(r)})}var Zr=m("ZodEnum",(e,t)=>{ei.init(e,t),T.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ks(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 Zr({...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 Zr({...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 Zr({type:"enum",entries:r,...$.normalizeParams(t)})}var Au=m("ZodTransform",(e,t)=>{Je(),ti.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Os(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ye(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 Cu(e){return new Au({type:"transform",transform:e})}var Er=m("ZodOptional",(e,t)=>{nr.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ic(e){return new Er({type:"optional",innerType:e})}var lc=m("ZodExactOptional",(e,t)=>{ri.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Iu(e){return new lc({type:"optional",innerType:e})}var Nu=m("ZodNullable",(e,t)=>{ni.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function sc(e){return new Nu({type:"nullable",innerType:e})}var Ru=m("ZodDefault",(e,t)=>{oi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Du(e,t){return new Ru({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var Lu=m("ZodPrefault",(e,t)=>{ii.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>js(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Fu(e,t){return new Lu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var pc=m("ZodNonOptional",(e,t)=>{si.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ds(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ju(e,t){return new pc({type:"nonoptional",innerType:e,...$.normalizeParams(t)})}var Mu=m("ZodCatch",(e,t)=>{ci.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ms(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Uu(e,t){return new Mu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:$.constantCatch(t)})}var Bu=m("ZodPipe",(e,t)=>{ai.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Us(e,r,n,o),e.in=t.in,e.out=t.out});function cc(e,t){return new Bu({type:"pipe",in:e,out:t})}var Ju=m("ZodReadonly",(e,t)=>{ui.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Wu(e){return new Ju({type:"readonly",innerType:e})}var Ku=m("ZodFunction",(e,t)=>{li.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zs(e,r,n,o)});function W(e){return new Ku({type:"function",input:Array.isArray(e?.input)?Tu(e?.input):e?.input??I(zt()),output:e?.output??zt()})}var Vu=m("ZodCustom",(e,t)=>{pi.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ps(e,r,n,o)});function Gu(e,t={}){return ts(Vu,e,t)}function Hu(e,t){return rs(e,t)}var Tr=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()}),ve=M(["js","ts","cpp","py","sql"]);var fd=F({language:ve.default("js"),files:S(p(),p()).default({}),starterFiles:S(p(),p()).optional(),solutionFiles:S(p(),p()).optional(),entry:p().optional(),testEntry:p().optional()}),md=F({steps:I(Tr).default([]),stepIndex:P().int().nonnegative().default(0),mode:M(["guided","sandbox"]).default("guided"),language:ve.optional(),lang:ve.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:[Tr,P()],output:J()}).optional(),onLabComplete:W({input:[p()],output:J()}).optional()}),hd=F({stage:M(["downloading","caching","extracting","compiling","linking","ready","error"]),loadedBytes:P().optional(),totalBytes:P().optional(),percent:P().optional(),message:p().optional()}),gd=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()}),_d=F({stage:M(["downloading","caching","extracting","initializing","ready","error"]),loadedBytes:P().optional(),totalBytes:P().optional(),percent:P().optional(),message:p().optional()}),dc=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()}),Xu=M(["connecting","metadata","downloading","mounting","ready","error"]),yd=F({phase:Xu,message:p(),loaded:P().optional(),total:P().optional()}),xd=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()}),zd=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()),Or()]).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()),Or()]).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()}),bd=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:ve.optional(),labId:p().optional()}),vd=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(Tr).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:ve.optional(),lang:ve.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()}),$d=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()}),qu=M(["error","warning","info","hint"]),Sd=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:qu,source:p().optional(),code:ae([p(),P()]).optional(),tags:I(p()).optional()}),wd=F({id:p(),name:p(),files:S(p(),p()),updatedAt:P(),createdAt:P().optional(),entry:p().optional(),testEntry:p().optional(),version:P().optional()}),Yu=M(["modified","added","deleted","untracked"]),We=F({path:p(),status:Yu,staged:D(),oldContent:p().optional(),newContent:p().optional()}),kd=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 bt=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 Qu="https://cdn.jsdelivr.net/pyodide/v0.27.2/full/",Cd={latest:"https://cdn.jsdelivr.net/pyodide/v0.27.2/full/",v0_26:"https://cdn.jsdelivr.net/pyodide/v0.26.4/full/"},Cr={"/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 cs(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;cs(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 as=new Set(["type","properties","required","additionalProperties"]),is=["oneOf","anyOf"];function ss(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(!as.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]??ss(u);l!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(l))||c.push(l))}let a=c.length===1?c[0]:br(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=ss(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 Ca(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of as)if(o in e)return;let r=t.filter(o=>is.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=br(t);else{let o=r[0],i=is.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=>br([...s,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Be(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 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())cs(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)??[])Ca(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 us=(e,t={})=>r=>{let n=vr({...r,processors:t});return N(e,n),$r(n,e),Sr(n,e)},Je=(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 ve=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},$e=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},ls=(e,t)=>{ve(e,"minimum",t),$e(e,"maximum",t)},ms=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},hs=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},gs=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},_s=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},ps=(e,t)=>ve(e,"minimum",t.minimum),ds=(e,t)=>$e(e,"maximum",t.maximum),fs=e=>(t,r)=>{_s(t,r.format);let[n,o]=e[r.format];ve(t,"minimum",n),$e(t,"maximum",o)},Ia={greater_than:(e,t)=>ve(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>$e(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>ms(e,t.value),number_format:fs(Oe),bigint_format:fs(Ye),min_length:ps,max_length:ds,length_equals:(e,t)=>ls(e,t.length),min_size:ps,max_size:ds,size_equals:(e,t)=>ls(e,t.size),string_format:(e,t)=>{_s(e,t.format),t.pattern&&hs(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)=>gs(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)Ia[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&ve(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&ve(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&$e(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&$e(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&ms(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&gs(t,o.mime);for(let i of o.patterns??[])hs(t,i);return t}var Na={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ra=new Map([[rr,kn],[pt,Pn]]),ys=e=>Ra.get(e)??e,xs=(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=Na[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(ys);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}))])}},zs=(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}))])}},bs=(e,t,r,n)=>{r.type="boolean"};var vs=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var $s=(e,t,r,n)=>{oe(e,t,r,n,"Void cannot be represented in JSON Schema")},Ss=(e,t,r,n)=>{r.not={}},ws=(e,t,r,n)=>{},ks=(e,t,r,n)=>{};var Ps=(e,t,r,n)=>{let o=e._zod.def,i=_e(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 Zs=(e,t,r,n)=>{oe(e,t,r,n,"Custom types cannot be represented in JSON Schema")},Es=(e,t,r,n)=>{oe(e,t,r,n,"Function types cannot be represented in JSON Schema")},Os=(e,t,r,n)=>{oe(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Ts=(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 As=(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)},Cs=(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},Is=(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)},Ns=(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 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 z=_.map(y=>wr(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:Xt).source)),f}var kr=new WeakMap;function La(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 Rs=(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,ys(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=kr.get(t);l||(l=[],kr.set(t,l),t.deferred.push(()=>La(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))}},Ls=(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"}]},Ds=(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 Fs(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"),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=Fs(o.defaultValue,e,t,r,n);s!==Pr&&(r.default=s)},Ms=(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=Fs(o.defaultValue,e,t,r,n);s!==Pr&&(r._prefault=s)},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;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},Bs=(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},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,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 Ws=new WeakSet([Object.prototype,Error.prototype]);function bt(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 Wa=(e,t)=>{Yr.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Ws.has(r)||(Ws.add(r),bt(r,"format",n=>o=>en(n,o)),bt(r,"flatten",n=>o=>Qr(n,o)),bt(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ye,2)}),bt(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ye,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var X=m("ZodError",Wa,void 0,{Parent:Error});var Ks=Ie(X),Vs=Ne(X),Gs=nt(X),Hs=ot(X),Xs=rn(X),qs=nn(X),Ys=on(X),Qs=sn(X),ec=cn(X),tc=an(X),rc=un(X),nc=ln(X);function Va(){B.localeError||G(_i())}function Ke(){B.memoizer||G({memoizer:gi()})}var A=m("ZodType",(e,t)=>(Va(),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(Gu(e,t))},superRefine(e,t){return this.check(Hu(e,t))},overwrite(e){return this.check(ae(e))},optional(){return sc(this)},exactOptional(){return Iu(this)},nullable(){return cc(this)},nullish(){return sc(cc(this))},nonoptional(e){return ju(this,e)},array(){return I(this)},or(e){return ue([this,e])},and(e){return Eu(this,e)},transform(e){return ac(this,Cu(e))},default(e){return Lu(this,e)},prefault(e){return Fu(this,e)},catch(e){return Uu(this,e)},pipe(e){return ac(this,e)},readonly(){return Wu(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",{...tr(this),jsonSchema:{input:Je(this,"input"),output:Je(this,"output")}})},set"~standard"(e){w.own(this,"~standard",e)},parse:function e(t,r){return Ks(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Vs(this,t,r,{callee:e})},safeParse(e,t){return Gs(this,e,t)},async safeParseAsync(e,t){return Hs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){w.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 Xs(this,t,r,{callee:e})},decode:function e(t,r){return qs(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Ys(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Qs(this,t,r,{callee:e})},safeEncode(e,t){return ec(this,e,t)},safeDecode(e,t){return tc(this,e,t)},async safeEncodeAsync(e,t){return rc(this,e,t)},async safeDecodeAsync(e,t){return nc(this,e,t)},toJSONSchema(e){return us(this,{})(e)},get description(){return fe.get(this)?.description},get _def(){return this._zod.def}}),uc=m("_ZodString",(e,t)=>{lt.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xs(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(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(be(...e))},max(...e){return this.check(xt(...e))},length(...e){return this.check(zt(...e))},nonempty(...e){return this.check(be(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())}})),Ga=m("ZodString",(e,t)=>{lt.init(e,t),uc.init(e,t)},{email(e){return this.check(bi(Qa,e))},url(e){return this.check(Pi(tu,e))},jwt(e){return this.check(Ui(gu,e))},emoji(e){return this.check(Zi(ru,e))},guid(e){return this.check(vi(eu,e))},uuid(e){return this.check($i(vt,e))},uuidv4(e){return this.check(Si(vt,e))},uuidv6(e){return this.check(wi(vt,e))},uuidv7(e){return this.check(ki(vt,e))},nanoid(e){return this.check(Ei(nu,e))},cuid(e){return this.check(Oi(ou,e))},cuid2(e){return this.check(Ti(iu,e))},ulid(e){return this.check(Ai(su,e))},base64(e){return this.check(Fi(fu,e))},base64url(e){return this.check(ji(mu,e))},xid(e){return this.check(Ci(cu,e))},ksuid(e){return this.check(Ii(au,e))},ipv4(e){return this.check(Ni(uu,e))},ipv6(e){return this.check(Ri(lu,e))},cidrv4(e){return this.check(Li(pu,e))},cidrv6(e){return this.check(Di(du,e))},e164(e){return this.check(Mi(hu,e))},datetime(e){return this.check(Bi(Ha,e))},date(e){return this.check(Ji(Xa,e))},time(e){return this.check(Wi(qa,e))},duration(e){return this.check(Ki(Ya,e))}});function d(e){return zi(Ga,e)}var R=m("ZodStringFormat",(e,t)=>{C.init(e,t),uc.init(e,t)}),Ha=m("ZodISODateTime",(e,t)=>{Po.init(e,t),R.init(e,t)}),Xa=m("ZodISODate",(e,t)=>{Zo.init(e,t),R.init(e,t)}),qa=m("ZodISOTime",(e,t)=>{Eo.init(e,t),R.init(e,t)}),Ya=m("ZodISODuration",(e,t)=>{Oo.init(e,t),R.init(e,t)}),Qa=m("ZodEmail",(e,t)=>{go.init(e,t),R.init(e,t)});var eu=m("ZodGUID",(e,t)=>{mo.init(e,t),R.init(e,t)});var vt=m("ZodUUID",(e,t)=>{ho.init(e,t),R.init(e,t)});var tu=m("ZodURL",(e,t)=>{xo.init(e,t),R.init(e,t)});var ru=m("ZodEmoji",(e,t)=>{zo.init(e,t),R.init(e,t)});var nu=m("ZodNanoID",(e,t)=>{bo.init(e,t),R.init(e,t)});var ou=m("ZodCUID",(e,t)=>{vo.init(e,t),R.init(e,t)});var iu=m("ZodCUID2",(e,t)=>{$o.init(e,t),R.init(e,t)});var su=m("ZodULID",(e,t)=>{So.init(e,t),R.init(e,t)});var cu=m("ZodXID",(e,t)=>{wo.init(e,t),R.init(e,t)});var au=m("ZodKSUID",(e,t)=>{ko.init(e,t),R.init(e,t)});var uu=m("ZodIPv4",(e,t)=>{To.init(e,t),R.init(e,t)});var lu=m("ZodIPv6",(e,t)=>{Co.init(e,t),R.init(e,t)});var pu=m("ZodCIDRv4",(e,t)=>{Io.init(e,t),R.init(e,t)});var du=m("ZodCIDRv6",(e,t)=>{No.init(e,t),R.init(e,t)});var fu=m("ZodBase64",(e,t)=>{Lo.init(e,t),R.init(e,t)});var mu=m("ZodBase64URL",(e,t)=>{Do.init(e,t),R.init(e,t)});var hu=m("ZodE164",(e,t)=>{Fo.init(e,t),R.init(e,t)});var gu=m("ZodJWT",(e,t)=>{jo.init(e,t),R.init(e,t)});var lc=m("ZodNumber",(e,t)=>{nr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zs(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(_t(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(gt(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(oc(e))},safe(e){return this.check(oc(e))},positive(e){return this.check(_t(0,e))},nonnegative(e){return this.check(Ue(0,e))},negative(e){return this.check(gt(0,e))},nonpositive(e){return this.check(Me(0,e))},multipleOf(e,t){return this.check(yt(e,t))},step(e,t){return this.check(yt(e,t))},finite(){return this}}));function Z(e){return Vi(lc,e)}var _u=m("ZodNumberFormat",(e,t)=>{Mo.init(e,t),lc.init(e,t)});function oc(e){return Gi(_u,e)}var yu=m("ZodBoolean",(e,t)=>{Uo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bs(e,r,n,o)});function L(e){return Hi(yu,e)}var xu=m("ZodNull",(e,t)=>{Bo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vs(e,r,n,o)});function Tr(e){return Xi(xu,e)}var zu=m("ZodAny",(e,t)=>{Jo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ws(e,r,n,o)});function D(){return qi(zu)}var bu=m("ZodUnknown",(e,t)=>{Wo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ks(e,r,n,o)});function $t(){return Yi(bu)}var vu=m("ZodNever",(e,t)=>{Ko.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ss(e,r,n,o)});function $u(e){return Qi(vu,e)}var Su=m("ZodVoid",(e,t)=>{Vo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$s(e,r,n,o)});function W(e){return es(Su,e)}var wu=m("ZodArray",(e,t)=>{Ke(),Go.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ts(e,r,n,o),e.element=t.element},{min(e,t){return this.check(be(e,t))},nonempty(e){return this.check(be(1,e))},max(e,t){return this.check(xt(e,t))},length(e,t){return this.check(zt(e,t))},unwrap(){return this.element}});function I(e,t){return ts(wu,e,t)}var ku=m("ZodObject",(e,t)=>{Ke(),qo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>As(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:$t()}))},loose(){return this.clone(w.mergeDefs(this._zod.def,{catchall:$t()}))},strict(){return this.clone(w.mergeDefs(this._zod.def,{catchall:$u()}))},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(Ar,this,e[0])},exactPartial(...e){return w.partial(pc,this,e[0],"exactPartial")},required(...e){return w.required(dc,this,e[0])}});function j(e,t){let r={type:"object",shape:e??{},...w.normalizeParams(t)};return new ku(r)}var Pu=m("ZodUnion",(e,t)=>{Yo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cs(e,r,n,o),e.options=t.options});function ue(e,t){return new Pu({type:"union",options:e,...w.normalizeParams(t)})}var Zu=m("ZodIntersection",(e,t)=>{Qo.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Is(e,r,n,o)});function Eu(e,t){return new Zu({type:"intersection",left:e,right:t})}var Ou=m("ZodTuple",(e,t)=>{Ke(),or.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ns(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 Tu(e,t,r){let n=t instanceof T,o=n?r:t,i=n?t:null;return new Ou({type:"tuple",items:e,rest:i,...w.normalizeParams(o)})}var ic=m("ZodRecord",(e,t)=>{Ke(),ei.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rs(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function k(e,t,r){return!t||!t._zod?new ic({type:"record",keyType:d(),valueType:e,...w.normalizeParams(t)}):new ic({type:"record",keyType:e,valueType:t,...w.normalizeParams(r)})}var Or=m("ZodEnum",(e,t)=>{ti.init(e,t),A.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ps(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 Or({...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 Or({...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 Or({type:"enum",entries:r,...w.normalizeParams(t)})}var Au=m("ZodTransform",(e,t)=>{Ke(),ri.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Os(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ze(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 Cu(e){return new Au({type:"transform",transform:e})}var Ar=m("ZodOptional",(e,t)=>{ir.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function sc(e){return new Ar({type:"optional",innerType:e})}var pc=m("ZodExactOptional",(e,t)=>{ni.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Iu(e){return new pc({type:"optional",innerType:e})}var Nu=m("ZodNullable",(e,t)=>{oi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ls(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cc(e){return new Nu({type:"nullable",innerType:e})}var Ru=m("ZodDefault",(e,t)=>{ii.init(e,t),A.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 Lu(e,t){return new Ru({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var Du=m("ZodPrefault",(e,t)=>{si.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ms(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Fu(e,t){return new Du({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var dc=m("ZodNonOptional",(e,t)=>{ci.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ds(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ju(e,t){return new dc({type:"nonoptional",innerType:e,...w.normalizeParams(t)})}var Mu=m("ZodCatch",(e,t)=>{ai.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Us(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Uu(e,t){return new Mu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:w.constantCatch(t)})}var Bu=m("ZodPipe",(e,t)=>{ui.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bs(e,r,n,o),e.in=t.in,e.out=t.out});function ac(e,t){return new Bu({type:"pipe",in:e,out:t})}var Ju=m("ZodReadonly",(e,t)=>{li.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Js(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Wu(e){return new Ju({type:"readonly",innerType:e})}var Ku=m("ZodFunction",(e,t)=>{pi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Es(e,r,n,o)});function K(e){return new Ku({type:"function",input:Array.isArray(e?.input)?Tu(e?.input):e?.input??I($t()),output:e?.output??$t()})}var Vu=m("ZodCustom",(e,t)=>{di.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zs(e,r,n,o)});function Gu(e,t={}){return rs(Vu,e,t)}function Hu(e,t){return ns(e,t)}var Cr=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()}),Se=U(["js","ts","cpp","py","sql"]);var fd=j({language:Se.default("js"),files:k(d(),d()).default({}),starterFiles:k(d(),d()).optional(),solutionFiles:k(d(),d()).optional(),entry:d().optional(),testEntry:d().optional()}),md=j({steps:I(Cr).default([]),stepIndex:Z().int().nonnegative().default(0),mode:U(["guided","sandbox"]).default("guided"),language:Se.optional(),lang:Se.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:[Cr,Z()],output:W()}).optional(),onLabComplete:K({input:[d()],output:W()}).optional()}),hd=j({stage:U(["downloading","caching","extracting","compiling","linking","ready","error"]),loadedBytes:Z().optional(),totalBytes:Z().optional(),percent:Z().optional(),message:d().optional()}),gd=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()}),_d=j({stage:U(["downloading","caching","extracting","initializing","ready","error"]),loadedBytes:Z().optional(),totalBytes:Z().optional(),percent:Z().optional(),message:d().optional()}),fc=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()}),Xu=U(["connecting","metadata","downloading","mounting","ready","error"]),yd=j({phase:Xu,message:d(),loaded:Z().optional(),total:Z().optional()}),xd=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()}),zd=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()),Tr()]).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()),Tr()]).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()}),bd=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:Se.optional(),labId:d().optional()}),vd=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(Cr).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:Se.optional(),lang:Se.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()}),$d=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()}),qu=U(["error","warning","info","hint"]),Sd=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:qu,source:d().optional(),code:ue([d(),Z()]).optional(),tags:I(d()).optional()}),wd=j({id:d(),name:d(),files:k(d(),d()),updatedAt:Z(),createdAt:Z().optional(),entry:d().optional(),testEntry:d().optional(),version:Z().optional()}),Yu=U(["modified","added","deleted","untracked"]),Ve=j({path:d(),status:Yu,staged:L(),oldContent:d().optional(),newContent:d().optional()}),kd=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 St=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 Qu="https://cdn.jsdelivr.net/pyodide/v0.27.2/full/",Cd={latest:"https://cdn.jsdelivr.net/pyodide/v0.27.2/full/",v0_26:"https://cdn.jsdelivr.net/pyodide/v0.26.4/full/"},Nr={"/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
- `},Id=Cr,$e={"collections.deque":{label:"collections.deque",detail:"class collections.deque([iterable[, maxlen]])",documentation:`Double-ended queue with $O(1)$ appends and pops from either end.
300
+ `},Id=Nr,we={"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,43 +318,49 @@ 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"}},Ar=null,fc=new WeakSet;function vt(e,t="main.py"){let r=Ar?{...Ar()||{}}:{},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 u=String(s||"").split(`
298
- `);for(let a=0;a<u.length;a++){let l=u[a],d=l.match(/^(\s*)(?:async\s+)?def\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(([^)]*)\)(?:\s*->\s*([^:]+))?\s*:/);if(d){let f=d[1].length,g=d[2],_=d[3].trim(),y=d[4]?` -> ${d[4].trim()}`:"",z=_?_.split(",").map(x=>x.trim()).filter(x=>x&&x!=="self"&&x!=="cls"):[],Z=(u[a+1]||"").trim().match(/^(?:"""|''')([\s\S]*?)(?:"""|''')?$/);o.push({name:g,kind:f>0?"method":"function",detail:`def ${g}(${_})${y}`,doc:Z&&Z[1]?Z[1].trim():`Defined in \`${i}:${a+1}\``,params:z,file:i,line:a+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}:${a+1}\``,params:[],file:i,line:a+1,col:l.indexOf(f)+1})}}}return o}function mc(e,t){if(typeof t=="function"&&(Ar=t),!e||!e.languages)return!1;if(fc.has(e))return!0;fc.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},u=typeof o.getValue=="function"?o.getValue():"",a=typeof o.getLineContent=="function"?String(o.getLineContent(i.lineNumber)||"").slice(0,i.column-1):"";if(/self\.[A-Za-z0-9_]*$/.test(a)){let f=new Map,g=/\bself\.([A-Za-z_][A-Za-z0-9_]*)\s*=/g,_;for(;(_=g.exec(u))!==null;)f.set(_[1],{kind:r.Field??4,detail:"instance attribute"});let y=/^\s+def\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(\s*self\b([^)]*)\)/gm;for(;(_=y.exec(u))!==null;)_[1].startsWith("__")||f.set(_[1],{kind:r.Method??0,detail:`method(${_[2].replace(/^\s*,\s*/,"").trim()})`});return{suggestions:Array.from(f.entries()).map(([z,w])=>({label:z,kind:w.kind,detail:w.detail,insertText:w.kind===(r.Method??0)?`${z}($0)`:z,insertTextRules:n.InsertAsSnippet,range:c}))}}let l=new Set,d=Object.keys($e).map(f=>{let g=$e[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=vt(u,o.uri?.path||"main.py");for(let f of h)l.has(f.name)||(l.add(f.name),d.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:d}}}),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($e))if(l===s.word||l.endsWith("."+s.word)){c=$e[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 a=vt(o.getValue?.()||"",o.uri?.path||"main.py").find(l=>l.name===s.word&&l.kind!=="module");return a?{range:{startLineNumber:i.lineNumber,endLineNumber:i.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},contents:[{value:`\`\`\`python
299
- ${a.detail}
300
- \`\`\``},{value:a.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 u=c[1],a=(c[2].match(/,/g)||[]).length,l=Object.keys($e).find(f=>f===u||f.endsWith("."+u));if(l){let f=$e[l],g=f.detail.match(/\(([^)]*)\)/)?.[1]||"",_=g?g.split(",").map(y=>({label:y.trim()})):[];return{value:{signatures:[{label:f.detail,documentation:f.documentation,parameters:_}],activeSignature:0,activeParameter:Math.min(a,Math.max(0,_.length-1))},dispose(){}}}let h=vt(o.getValue?.()||"",o.uri?.path||"main.py").find(f=>f.name===u&&(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(a,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 u=vt(o.getValue?.()||"",o.uri?.path||"main.py").find(l=>l.name===s.word&&l.kind!=="module");return u?{uri:typeof e.Uri.file=="function"?e.Uri.file("/workspace/"+u.file.replace(/^\/+/,"")):o.uri,range:{startLineNumber:u.line,startColumn:u.col,endLineNumber:u.line,endColumn:u.col+u.name.length}}:null}}),!0}catch(r){return typeof console<"u"&&console.warn&&console.warn("[Python Monaco Intelligence Error]:",r),!1}}function el(e,t="main.py"){let r=[];if(!e||typeof e!="string")return r;let n=e.split(`
301
- `),o=[],i={")":"(","]":"[","}":"{"},s=0,c=0,u=null;for(let a=0;a<n.length;a++){let l=n[a],d=a+1,h=!1,f="";if(u){let x=l.indexOf(u);if(x===-1)continue;u=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-${d}`,file:t,line:d,startLineNumber:d,col:1,startColumn:1,severity:"warning",message:"Inconsistent use of tabs and spaces in indentation.",source:"python-linter"})}let y=l.trim();s>0&&y&&!y.startsWith("#")&&(_<=c&&r.push({id:`py-indent-error-${d}`,file:t,line:d,startLineNumber:d,col:1,startColumn:1,severity:"error",message:`IndentationError: expected an indented block after statement on line ${s}.`,source:"python-linter"}),s=0);let z=o.length,w=-1;for(let x=0;x<l.length;x++){let b=l[x];if(!h&&b==="#"){w=x;break}if(!h&&(l.slice(x,x+3)==='"""'||l.slice(x,x+3)==="'''")){let k=l.slice(x,x+3),C=l.indexOf(k,x+3);if(C!==-1){x=C+2;continue}u=k;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:d,col:x+1});else if(b===")"||b==="]"||b==="}"){let k=i[b],C=o.pop();C?C.char!==k&&r.push({id:`py-bracket-mismatch-${d}-${x+1}`,file:t,line:d,startLineNumber:d,col:x+1,startColumn:x+1,severity:"error",message:`Mismatched bracket: expected closing for '${C.char}' from line ${C.line}, found '${b}'.`,source:"python-linter"}):r.push({id:`py-bracket-unmatched-${d}-${x+1}`,file:t,line:d,startLineNumber:d,col:x+1,startColumn:x+1,severity:"error",message:`Unmatched closing bracket '${b}'.`,source:"python-linter"})}}}h&&!u&&!l.endsWith("\\")&&r.push({id:`py-eol-string-${d}`,file:t,line:d,startLineNumber:d,col:l.length,startColumn:l.length,severity:"error",message:"SyntaxError: EOL while scanning string literal.",source:"python-linter"});let Z=(w>=0?l.slice(0,w):l).trim();if(!u&&o.length===0&&z===0&&!Z.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(Z))Z.endsWith(":")?(s=d,c=_):/:/.test(Z)||r.push({id:`py-missing-colon-${d}`,file:t,line:d,startLineNumber:d,col:l.length,startColumn:l.length,severity:"error",message:"SyntaxError: expected ':' at end of line.",source:"python-linter"});else if(!u&&o.length===0&&z>0&&Z.endsWith(":")){let x=a-1;for(;x>0&&!n[x].trim();)x--;let b=(n[x]?.match(/^([ \t]+)/)?.[1]||"").length;s=d,c=Math.min(_,b)}}for(let a of o)r.push({id:`py-unclosed-bracket-${a.line}-${a.col}`,file:t,line:a.line,startLineNumber:a.line,col:a.col,startColumn:a.col,severity:"error",message:`SyntaxError: closing parenthesis does not match or unclosed bracket '${a.char}' opened on line ${a.line}.`,source:"python-linter"});return r}function Nd(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,u;for(;(u=i.exec(e))!==null;)s=u[1].replace(/^\/workspace\//,""),c=parseInt(u[2],10)||1;let a=e.trim().split(`
302
- `),l=a[a.length-1]||"Python Execution Error";if(l.includes("Error:")||l.includes("Exception:")||l.includes("Error")){let d={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(d),t&&typeof t.add=="function"&&t.add(d)}if(r&&n&&typeof r.editor?.setModelMarkers=="function"){let d=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",d)}return o}function Rd(e){if(!e||typeof e!="string")return e;let t=e.split(`
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:|return\b|pass\b|raise\b)/.test(c)&&/^(?: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(`
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"}},Ir=null,mc=new WeakSet;function wt(e,t="main.py"){let r=Ir?{...Ir()||{}}:{},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 hc(e,t){if(typeof t=="function"&&(Ir=t),!e||!e.languages)return!1;if(mc.has(e))return!0;mc.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(we).map(f=>{let g=we[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=wt(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(we))if(l===s.word||l.endsWith("."+s.word)){c=we[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=wt(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(we).find(f=>f===a||f.endsWith("."+a));if(l){let f=we[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=wt(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=wt(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 el(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 Nd(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 Rd(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 $t=class e{options;pyodide=null;_loadingPromise=null;constructor(t={}){let r=dc.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||Qu,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 u=document.createElement("script");u.src=r,u.setAttribute("data-codelab-pyodide",r),u.onload=()=>i(),u.onerror=()=>{e._scriptPromises.delete(r),s(new Error(`Failed to load pyodide.js from ${r}`))},document.head.appendChild(u)}),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),u="";for(let a of c)u+="/"+a,t.add(u)};this.pyodide={FS:{files:r,dirs:t,mkdirTree(s){i(s)},writeFile(s,c){let u=s.lastIndexOf("/");u>0&&i(s.slice(0,u)),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 u=r.get(s);return u?c&&c.encoding==="utf8"?o.decode(u):u.slice():c&&c.encoding==="utf8"?"":new Uint8Array(0)},unlink(s){r.delete(s)},readdir(s){let c=s==="/"?"/":s.replace(/\/+$/,"")+"/",u=new Set([".",".."]);for(let a of t)if(a.startsWith(c)){let l=a.slice(c.length);l&&!l.includes("/")&&u.add(l)}for(let a of r.keys())if(a.startsWith(c)){let l=a.slice(c.length);l&&!l.includes("/")&&u.add(l)}return Array.from(u)},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=[],s=new bt(_=>{i.push(_)}),c=_=>{n+=_;let y=_.split(`
306
- `);for(let z of y)s.parseLine(z);t.onStdout&&t.onStdout(_)},u=_=>{o+=_,t.onStderr&&t.onStderr(_)},a=await this.ensureLoaded(),l=new Set;if(t.vfs&&a.FS){let _=y=>{try{typeof a.FS.mkdirTree=="function"&&a.FS.mkdirTree(y);let z=t.vfs.readdirSync(y);for(let w of z){if(!w||w==="."||w==="..")continue;let Z=`${y==="/"?"":y}/${w}`;try{let x=t.vfs.statSync(Z);if(x&&typeof x.isDirectory=="function"&&x.isDirectory())_(Z);else{let b=Z.slice(0,Z.lastIndexOf("/"))||"/workspace";typeof a.FS.mkdirTree=="function"&&a.FS.mkdirTree(b);let k=t.vfs.readFileSync(Z);a.FS.writeFile(Z,k),l.add(Z)}}catch(x){}}}catch(z){}};if(_("/workspace"),typeof a.FS.readdir=="function"&&typeof a.FS.unlink=="function"){let y=z=>{try{let w=a.FS.readdir(z);for(let Z of w){if(!Z||Z==="."||Z==="..")continue;let x=`${z}/${Z}`,b=!1;if(typeof a.FS.stat=="function"&&typeof a.FS.isDir=="function")try{b=!!a.FS.isDir(a.FS.stat(x).mode)}catch(k){}if(b)y(x);else if(!l.has(x))try{a.FS.unlink(x)}catch(k){}}}catch(w){}};y("/workspace")}}if(a.FS)try{a.FS.mkdirTree("/usr/lib/python");for(let[_,y]of Object.entries(Cr))a.FS.writeFile(_,y)}catch(_){}let d=t.source;if(!d&&t.entry&&t.vfs)try{d=t.vfs.readFileSync(t.entry.startsWith("/")?t.entry:`/workspace/${t.entry}`,"utf8")}catch{return u(`FileNotFoundError: [Errno 2] No such file or directory: '${t.entry}'
307
- `),{ok:!1,exitCode:1,stdout:n,stderr:o,peakMemoryBytes:0,durationMs:performance.now()-r}}d=d||"";let h=1024*1024,f=0;try{if(typeof window<"u"&&a.setStdout){a.setStdout({batched:x=>c(x+`
308
- `)}),a.setStderr({batched:x=>u(x+`
309
- `)});let _=t.stdin||"",y=!1;if(!_&&typeof t.onRequestStdin=="function"&&/\binput\s*\(/.test(d)){let x=Array.from(d.matchAll(/\binput\s*\(\s*(?:(['"])((?:\\.|(?!\1).)*)\1)?\s*\)/g)),b=[],k=Math.min(8,Math.max(1,x.length));for(let C=0;C<k;C++){let Se=x[C]?.[2]||"",de=await t.onRequestStdin(Se);if(de==null)break;b.push(String(de))}b.length>0&&(_=b.join(`
329
+ `}var kt=class e{options;pyodide=null;_loadingPromise=null;constructor(t={}){let r=fc.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||Qu,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 St(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(Nr))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=[],me=Math.min(8,Math.max(1,P.length));for(let le=0;le<me;le++){let Ge=P[le]?.[2]||"",ke=await t.onRequestStdin(Ge);if(ke==null)break;F.push(String(ke))}F.length>0&&(y=F.join(`
310
334
  `)+`
311
- `,y=!0)}if(_&&a.setStdin){let x=0;a.setStdin({stdin:()=>x<_.length?_.charCodeAt(x++):null})}let z=JSON.stringify(t.entry||"<exec>"),w=JSON.stringify(d),Z=`
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
- if 'codelab_test' in sys.modules and hasattr(sys.modules['codelab_test'], '_reset_codelab_test'):
318
- sys.modules['codelab_test']._reset_codelab_test()
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
- ${y?"builtins.input = lambda _prompt='': sys.stdin.readline().rstrip('\\r\\n')":""}
322
- _cl_user_code = ${w}
323
- _cl_ns = {'__name__': '__main__', '__file__': ${z}, '__builtins__': __builtins__}
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, ${z}, 'exec'), _cl_ns)
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 a.runPythonAsync(Z),a.globals&&typeof a.globals.get=="function")try{let x=a.globals.get("_peak");typeof x=="number"&&x>0&&(h=x)}catch(x){}}else if(t.source&&/sys\.exit\(\s*(\d+)?\s*\)/.test(t.source)){let _=t.source.match(/sys\.exit\(\s*(\d+)?\s*\)/);f=_&&_[1]!==void 0?parseInt(_[1],10):0,f!==0&&u(`SystemExit: ${f}
332
- `)}else c(`[Python 3.12 Wasm]: Executed ${t.entry||"snippet"}
333
- `)}catch(_){let y=_&&_.message?_.message:String(_);if(/SystemExit(?::\s*([0-9]+|None)?)?/.test(y)){let w=y.match(/SystemExit(?::\s*([0-9]+))?/);f=w&&w[1]!==void 0?parseInt(w[1],10):0,f!==0&&u(y+`
334
- `)}else f=1,u(y+`
335
- `)}if(t.vfs&&a.FS&&typeof a.FS.readdir=="function"){let _=new Set,y=z=>{try{let w=a.FS.readdir(z);for(let Z of w){if(!Z||Z==="."||Z==="..")continue;let x=`${z}/${Z}`;try{let b=!1;if(typeof a.FS.stat=="function"&&typeof a.FS.isDir=="function"){let k=a.FS.stat(x);b=!!a.FS.isDir(k.mode)}if(b)typeof t.vfs.mkdirSync=="function"&&!t.vfs.existsSync(x)&&t.vfs.mkdirSync(x,{recursive:!0}),y(x);else{let k=x.slice(0,x.lastIndexOf("/"))||"/workspace";typeof t.vfs.mkdirSync=="function"&&!t.vfs.existsSync(k)&&t.vfs.mkdirSync(k,{recursive:!0});let C=a.FS.readFile(x);t.vfs.writeFileSync(x,C),_.add(x)}}catch(b){}}}catch(w){}};if(y("/workspace"),typeof t.vfs.unlinkSync=="function"){for(let z of l)if(!_.has(z))try{t.vfs.unlinkSync(z)}catch(w){}}}let g=performance.now()-r;return{ok:f===0,exitCode:f,stdout:n,stderr:o,peakMemoryBytes:h,durationMs:g,testResults:i}}};function tl(e){if(e)for(let[t,r]of Object.entries(Cr)){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 gc(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 hc(e,t={}){let r=new $t(t),n=gc(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&&mc(window.monaco,o),Array.isArray(e._monacoReadyHooks)||(e._monacoReadyHooks=[]),e._monacoReadyHooks.push(i=>{mc(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&&tl(e.vfs),e.hasMultipleLanguages=e.enabledLanguages.size>1,e._pyLintHandler=(i,s)=>{if(!i||!/\.py$/i.test(i))return;let c=el(String(s??""),i),u=e?e._diagnosticsStore:null;if(u&&typeof u.setFileDiagnostics=="function")u.setFileDiagnostics(i,"python-linter",c);else if(u&&typeof u.clear=="function"&&typeof u.add=="function"){u.clear("python-linter");for(let a of c)u.add(a)}if(typeof window<"u"&&window.monaco){let a=e.models&&typeof e.models.get=="function"&&e.models.get(i)||(e.activeFile===i&&e.editor?e.editor.getModel():null);if(a){let l=c.map(d=>({startLineNumber:d.line,startColumn:d.col||1,endLineNumber:d.endLine||d.line,endColumn:d.endCol||(d.col||1)+20,message:d.message,severity:d.severity==="error"?window.monaco.MarkerSeverity.Error:window.monaco.MarkerSeverity.Warning}));window.monaco.editor.setModelMarkers(a,"python-linter",l)}}},t.preload&&r.ensureLoaded().catch(i=>{typeof e._appendTerminalOutput=="function"&&e._appendTerminalOutput("stderr",`[Python Toolchain preload warning]: ${i.message||i}
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()),r}function _c(e,t){if(e===null){let r=new $t(t||{});return gc(r),r}if(e===void 0||typeof e=="object"&&!("enabledLanguages"in e)&&!("container"in e)&&!("_renderShell"in e)){let r=e||{},n=(o,i={})=>hc(o,{...r,...i||{}});return n.extensionName="python",n.languageId="py",n.install=n,n}return hc(e,t)}function Dd(e={}){return _c(e)}var Ld=_c;export{Cr as BUILTIN_PYTHON_MODULES,Id as CODELAB_PYTHON_LIBS,Qu as DEFAULT_PYTHON_CDN_BASE_URL,$e as PYTHON_COMPLETIONS_AND_HOVERS,Cd as PYTHON_TOOLCHAIN_PRESETS,$t as PythonToolchainManager,el as analyzePythonSource,Nd as applyPythonTracebackDiagnostics,Dd as createPythonExtension,Ld as default,Rd as formatPythonSource,_c as pythonExtension,mc as registerMonacoPythonLanguageService,gc as registerPythonCompilerOnRuntime,tl as seedPythonModulesIntoVfs};
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 me=p.FS.readFile(v);t.vfs.writeFileSync(v,me),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 tl(e){if(e)for(let[t,r]of Object.entries(Nr)){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 _c(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 gc(e,t={}){let r=new kt(t),n=_c(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&&hc(window.monaco,o),Array.isArray(e._monacoReadyHooks)||(e._monacoReadyHooks=[]),e._monacoReadyHooks.push(i=>{hc(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&&tl(e.vfs),e.hasMultipleLanguages=e.enabledLanguages.size>1,e._pyLintHandler=(i,s)=>{if(!i||!/\.py$/i.test(i))return;let c=el(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 yc(e,t){if(e===null){let r=new kt(t||{});return _c(r),r}if(e===void 0||typeof e=="object"&&!("enabledLanguages"in e)&&!("container"in e)&&!("_renderShell"in e)){let r=e||{},n=(o,i={})=>gc(o,{...r,...i||{}});return n.extensionName="python",n.languageId="py",n.install=n,n}return gc(e,t)}function Ld(e={}){return yc(e)}var Dd=yc;export{Nr as BUILTIN_PYTHON_MODULES,Id as CODELAB_PYTHON_LIBS,Qu as DEFAULT_PYTHON_CDN_BASE_URL,we as PYTHON_COMPLETIONS_AND_HOVERS,Cd as PYTHON_TOOLCHAIN_PRESETS,kt as PythonToolchainManager,el as analyzePythonSource,Nd as applyPythonTracebackDiagnostics,Ld as createPythonExtension,Dd as default,Rd as formatPythonSource,yc as pythonExtension,hc as registerMonacoPythonLanguageService,_c as registerPythonCompilerOnRuntime,tl as seedPythonModulesIntoVfs};