@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,8 +1,8 @@
1
- var kc=Object.defineProperty;var Pc=(e,t)=>{for(var n in t)kc(e,n,{get:t[n],enumerable:!0})};var S={};Pc(S,{BIGINT_FORMAT_RANGES:()=>nt,CONSTANT_CATCH:()=>Yn,Class:()=>At,NUMBER_FORMAT_RANGES:()=>Ae,aborted:()=>G,allowsEval:()=>Dt,assert:()=>Ac,assertEqual:()=>Tc,assertIs:()=>Cc,assertNever:()=>Ec,assertNotEqual:()=>Zc,assignProp:()=>Q,attachSchema:()=>Ie,base64ToUint8Array:()=>qn,base64urlToUint8Array:()=>Yc,cached:()=>Oe,captureStackTrace:()=>et,cleanEnum:()=>Xc,cleanRegex:()=>Ce,clone:()=>ee,cloneDef:()=>Rc,codePointLength:()=>Ne,constantCatch:()=>Qn,createTransparentProxy:()=>Uc,defineLazy:()=>Bn,defineLazyInternal:()=>O,derived:()=>na,esc:()=>Rt,escapeRegex:()=>me,explicitlyAborted:()=>Mt,extend:()=>Jc,finalizeIssue:()=>ne,floatSafeRemainder:()=>Nt,getElementAtPath:()=>Lc,getEnumValues:()=>xe,getLengthableOrigin:()=>Re,getParsedType:()=>Mc,getSizableOrigin:()=>Gn,hexToUint8Array:()=>ea,hide:()=>it,installLazyProp:()=>sa,isObject:()=>_e,isPlainObject:()=>le,issue:()=>ze,joinValues:()=>Qe,jsonStringifyReplacer:()=>be,members:()=>Bt,merge:()=>Kc,mergeDefs:()=>se,normalizeParams:()=>$,nullish:()=>It,numKeys:()=>jc,objectClone:()=>Ic,omit:()=>Wc,optionalKeys:()=>jt,own:()=>ue,parsedType:()=>Ut,partial:()=>Hc,pick:()=>Bc,prefixIssues:()=>te,primitiveTypes:()=>Kn,promiseAllObject:()=>Dc,propertyKeyTypes:()=>Ft,randomString:()=>Fc,rawShape:()=>Ee,required:()=>Gc,safeExtend:()=>Vc,shallowClone:()=>Vn,sizeCaps:()=>ot,slugify:()=>Lt,stringifyPrimitive:()=>tt,toZod:()=>Oc,uint8ArrayToBase64:()=>Xn,uint8ArrayToBase64url:()=>Qc,uint8ArrayToHex:()=>ta,unwrapMessage:()=>ye});function Tc(e){return e}function Zc(e){return e}function Oc(){return e=>e}function Cc(e){}function Ec(e){throw new Error("Unexpected value in exhaustive check")}function Ac(e){}function xe(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Qe(e,t="|"){return e.map(n=>tt(n)).join(t)}function be(e,t){return typeof t=="bigint"?t.toString():t}var Et=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 Oe(e){return new Et(e)}function It(e){return e==null}function Ce(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Nt(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}var Un=Symbol("evaluating");function Bn(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Un)return r===void 0&&(r=Un,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ic(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Q(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ee(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ie(e){return Ee(e._zod.def)??e._zod.def.shape}function Wn(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return Q(this,t,r),r},enumerable:!0,configurable:!0})}function Jn(e,t,n){t in e?Q(e,t,n):e[t]=n}function fe(e,t,n,r){let o=ie(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Wn(e,i,()=>{let c=t._zod.def.shape[i];return r?r(c,i):c}):Jn(e,i,r?r(s.value,i):s.value))}}function Nc(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Wn(e,n,()=>t[n]):Jn(e,n,r.value))}}function se(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Rc(e){return se(e._zod.def)}function Lc(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function Dc(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}function Fc(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function Rt(e){return JSON.stringify(e)}function Lt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var et="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function _e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Dt=Oe(()=>{if(J.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function le(e){if(_e(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(_e(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Vn(e){return le(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function jc(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var Mc=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}`)}},Ft=new Set(["string","number","symbol"]),Kn=new Set(["string","number","bigint","boolean","symbol","undefined"]);function me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ee(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}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 Uc(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function tt(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function jt(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ae={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]},nt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Bc(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return fe(i,e,rt(e,t)),ee(e,se(n,{shape:i,checks:[]}))}function rt(e,t){let n=ie(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}function Wc(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(rt(e,t)),s={};return fe(s,e,Reflect.ownKeys(ie(e)).filter(c=>!i.has(c))),ee(e,se(n,{shape:s,checks:[]}))}function Jc(e,t){if(!le(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=ie(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 ee(e,se(e._zod.def,{shape:Hn(e,t)}))}function Hn(e,t){let n={};return fe(n,e,Reflect.ownKeys(ie(e))),Nc(n,t),n}function Vc(e,t){if(!le(t))throw new Error("Invalid input to safeExtend: expected a plain object");return ee(e,se(e._zod.def,{shape:Hn(e,t)}))}function Kc(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 n={};fe(n,e,Reflect.ownKeys(ie(e))),fe(n,t,Reflect.ownKeys(ie(t)));let r=se(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ee(e,r)}function Hc(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);let c=n?new Set(rt(t,n)):void 0,u={};return fe(u,t,Reflect.ownKeys(ie(t)),e&&((a,l)=>c&&!c.has(l)?a:new e({type:"optional",innerType:a}))),ee(t,se(t._zod.def,{shape:u,checks:[]}))}function Gc(e,t,n){let r=n?new Set(rt(t,n)):void 0,o={};return fe(o,t,Reflect.ownKeys(ie(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),ee(t,se(t._zod.def,{shape:o}))}function G(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Mt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function te(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ye(e){return typeof e=="string"?e:e?.message}function ot(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;o>=0&&t.push([o,n])}return t}function Ie(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function ne(e,t,n){var r;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.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:ye(e.inst?._zod.def?.error?.(e))??ye(i?.(e))??ye(t?.error?.(e))??ye(n.customError?.(e))??ye(n.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 Gn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var qc=/[\uD800-\uDBFF]/;function Ne(e){let t=e.length;if(!qc.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function Re(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ut(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 n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function ze(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function Xc(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function qn(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Xn(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Yc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return qn(t+n)}function Qc(e){return Xn(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ea(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function ta(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var At=class{constructor(...t){}};function Bt(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):ra(e,n,r.value)}}function ue(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function it(e,t,n){return ue(e,t,n,!1)}function na(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return ue(this,n,r(this))},set(o){ue(this,n,o)}})}return t}function ra(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:ue(this,t,n.bind(this))},set(r){ue(this,t,r)}})}function oa(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ct,ae=!1,ia={configurable:!0,get(){ae=!0}};function O(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ct!==e._zod){Ct=void 0;return}Ct=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ia);let o=ae;ae=!1;try{let i=n(this);return ae?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),ae=ae||o,i}catch(i){throw delete this[t],ae=ae||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function sa(e,t,n,r){let o=oa(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var Yn="~constantCatch";function Qn(e){let t=()=>e;return t[Yn]=!0,t}var er;var Wt={value:void 0,enumerable:!1},tr="captureStackTrace"in Error?Error:null;function ca(e){let t=tr;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return tr=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function g(e,t,n,r){let o={};function i(m){this.def=m,this.constr=d,this.traits=new Set}i.prototype=o;let s=n,c=s&&new WeakSet;function u(m,h){if(m._zod){if(m._zod.traits.has(e))return}else{Wt.value=new i(h);try{Object.defineProperty(m,"_zod",Wt)}finally{Wt.value=void 0}}if(m._zod.traits.add(e),t(m,h),c){let y=Object.getPrototypeOf(m),_=m._zod.constr.prototype,v=y;for(;v&&v!==_;)v=Object.getPrototypeOf(v);let b=v??y;c.has(b)||(c.add(b),Bt(b,s))}let f=d.prototype;for(let y in f)Object.prototype.hasOwnProperty.call(f,y)&&(y in m||(m[y]=f[y].bind(m)))}let a=r?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function d(m){let h=r?.Parent?ca(l):this;u(h,m);let f=h._zod.deferred;if(f){for(let _ of f)_();h._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;return y&&y(h),h}return Object.defineProperty(d,"init",{value:u}),Object.defineProperty(d,Symbol.hasInstance,{value:m=>r?.Parent&&m instanceof r.Parent?!0:m?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var re=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ve=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(er=globalThis).__zod_globalConfig??(er.__zod_globalConfig={});var J=globalThis.__zod_globalConfig;function q(e){return e&&Object.assign(J,e),J}function aa(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,be,2)),e.message}function ua(e){this._zod.message=e}var la={get:aa,set:ua,enumerable:!0,configurable:!0},Vt={value:void 0,enumerable:!1},nr=new WeakSet([Object.prototype,Error.prototype]),rr=(e,t)=>{e.name="$ZodError",Vt.value=t,Object.defineProperty(e,"issues",Vt),Vt.value=void 0,Object.defineProperty(e,"message",la);let n=Object.getPrototypeOf(e);nr.has(n)||(nr.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},or=g("$ZodError",rr),Kt=g("$ZodError",rr,void 0,{Parent:Error});function pa(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ir(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?pa(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}function sr(e,t=n=>n.message){let n={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>r({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)n._errors.push(t(s));else{let u=n,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 m=u[l];d&&m._errors.push(t(s)),u=m,a++}}}};return r(e),n}function st(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Le=e=>{let t=(n,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=n._zod.run({value:r,issues:[]},s);if(c instanceof Promise)throw new re;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map(a=>ne(a,s,q())));throw et(u,i?.callee??t),u}return c.value};return t},Ht=Le(Kt),De=e=>{let t=async(n,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=n._zod.run({value:r,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){let u=new(i?.Err??e)(c.issues.map(a=>ne(a,s,q())));throw et(u,i?.callee??t),u}return c.value};return t},Gt=De(Kt),ct=e=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new re;return i.issues.length?cr(e,i.issues,o):{success:!0,data:i.value}};function cr(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>ne(o,n,q()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}var at=e=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?cr(e,i.issues,o):{success:!0,data:i.value}};var fa=Symbol.for("zod.compile.invalid"),ma=Symbol.for("zod.compile.fallback"),qt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==fa)return!0;if(r.definite===!0&&n===void 0)return!1}return ha(e,t,n)});function ha(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(r[ma]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new re;return i.issues.length===0}var Xt=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},ar=e=>{let t=Le(e),n=(r,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,c,st(n,s))};return n};var ur=e=>{let t=Le(e),n=(r,o,i,s)=>t(r,o,i,st(n,s));return n};var lr=e=>{let t=De(e),n=async(r,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,c,st(n,s))};return n};var pr=e=>{let t=De(e),n=async(r,o,i,s)=>await t(r,o,i,st(n,s));return n};var dr=e=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return ct(e)(t,n,o)};var fr=e=>(t,n,r)=>ct(e)(t,n,r);var mr=e=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return at(e)(t,n,o)};var hr=e=>async(t,n,r)=>at(e)(t,n,r);var gr=/^[cC][0-9a-z]{6,}$/,yr=/^[0-9a-z]+$/,_r=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,xr=/^[0-9a-vA-V]{20}$/,br=/^[A-Za-z0-9]{27}$/,zr=/^[a-zA-Z0-9_-]{21}$/;function vr(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var $r=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Sr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Qt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var wr=/^(?:[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 ga="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function kr(){return new RegExp(ga,"u")}var Pr=/^(?:(?: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])$/,Tr=/^(([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 Zr=/^((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])$/,Or=/^(([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])$/,Cr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Er=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Ar=/^https?$/,Ir=/^\+[1-9]\d{6,14}$/;var Nr="(?:(?:\\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 ya(e){return new RegExp(`^${e}$`)}var Rr=ya(Nr);function Yt(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 Lr(e){return new RegExp(`^${Yt(e)}$`)}function Dr(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${Yt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${Yt({precision:e.precision})}`:n;return new RegExp(`^${Nr}T(?:${r})$`)}var Fr=/^[\s\S]{0,}$/;var en=/^-?\d+$/,Fe=/^-?\d+(?:\.\d+)?$/,jr=/^(?:true|false)$/i,Mr=/^null$/i;var Ur=/^[^A-Z]*$/,Br=/^[^a-z]*$/;var B=g("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var tn=e=>{let t=e.value;return!It(t)&&t.length!==void 0},ut={number:"number",bigint:"bigint",object:"date"},nn=g("$ZodCheckLessThan",(e,t)=>{B.init(e,t);let n=ut[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:ut[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rn=g("$ZodCheckGreaterThan",(e,t)=>{B.init(e,t);let n=ut[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:ut[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wr=g("$ZodCheckMultipleOf",(e,t)=>{B.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Nt(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Jr=g("$ZodCheckNumberFormat",(e,t)=>{B.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=Ae[t.format];e._zod.check=s=>{let c=s.value;if(n){if(!Number.isInteger(c)){s.issues.push({expected:r,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:r,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:r,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 Vr=g("$ZodCheckMaxLength",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=tn),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Ne(o):i)<=t.maximum)return;let c=Re(o);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Kr=g("$ZodCheckMinLength",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=tn),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Ne(o):i)>=t.minimum)return;let c=Re(o);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Hr=g("$ZodCheckLengthEquals",(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=tn),e._zod.check=r=>{let o=r.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Ne(o):i;if(s===t.length)return;let c=Re(o),u=s>t.length;r.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Me=g("$ZodCheckStringFormat",(e,t)=>{var n,r;B.init(e,t),t.pattern?(n=e._zod).check??(n.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})}):(r=e._zod).check??(r.check=()=>{})}),Gr=g("$ZodCheckRegex",(e,t)=>{Me.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qr=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ur),Me.init(e,t)}),Xr=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Br),Me.init(e,t)}),Yr=g("$ZodCheckIncludes",(e,t)=>{B.init(e,t);let n=me(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,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})}}),Qr=g("$ZodCheckStartsWith",(e,t)=>{B.init(e,t);let n=new RegExp(`^${me(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),eo=g("$ZodCheckEndsWith",(e,t)=>{B.init(e,t);let n=new RegExp(`.*${me(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var to=g("$ZodCheckOverwrite",(e,t)=>{B.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var lt=class{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}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 r=t.split(`
1
+ var kc=Object.defineProperty;var Pc=(e,t)=>{for(var n in t)kc(e,n,{get:t[n],enumerable:!0})};var w={};Pc(w,{BIGINT_FORMAT_RANGES:()=>et,CONSTANT_CATCH:()=>Xn,Class:()=>Ct,NUMBER_FORMAT_RANGES:()=>Ee,aborted:()=>G,allowsEval:()=>Rt,assert:()=>Ac,assertEqual:()=>Tc,assertIs:()=>Cc,assertNever:()=>Ec,assertNotEqual:()=>Zc,assignProp:()=>ee,attachSchema:()=>Ae,base64ToUint8Array:()=>Gn,base64urlToUint8Array:()=>Yc,cached:()=>Ze,captureStackTrace:()=>Ye,cleanEnum:()=>Xc,cleanRegex:()=>Oe,clone:()=>te,cloneDef:()=>Rc,codePointLength:()=>Ie,constantCatch:()=>Yn,createTransparentProxy:()=>Mc,defineLazy:()=>Mn,defineLazyInternal:()=>Z,derived:()=>na,esc:()=>It,escapeRegex:()=>me,explicitlyAborted:()=>Ft,extend:()=>Jc,finalizeIssue:()=>re,floatSafeRemainder:()=>At,getElementAtPath:()=>Lc,getEnumValues:()=>xe,getLengthableOrigin:()=>Ne,getParsedType:()=>Uc,getSizableOrigin:()=>Hn,hexToUint8Array:()=>ea,hide:()=>rt,installLazyProp:()=>sa,isObject:()=>_e,isPlainObject:()=>le,issue:()=>ze,joinValues:()=>Xe,jsonStringifyReplacer:()=>be,members:()=>Ut,merge:()=>Kc,mergeDefs:()=>se,normalizeParams:()=>$,nullish:()=>Et,numKeys:()=>jc,objectClone:()=>Ic,omit:()=>Wc,optionalKeys:()=>Dt,own:()=>ue,parsedType:()=>jt,partial:()=>Hc,pick:()=>Bc,prefixIssues:()=>ne,primitiveTypes:()=>Vn,promiseAllObject:()=>Dc,propertyKeyTypes:()=>Lt,randomString:()=>Fc,rawShape:()=>Ce,required:()=>Gc,safeExtend:()=>Vc,shallowClone:()=>Jn,sizeCaps:()=>nt,slugify:()=>Nt,stringifyPrimitive:()=>Qe,toZod:()=>Oc,uint8ArrayToBase64:()=>qn,uint8ArrayToBase64url:()=>Qc,uint8ArrayToHex:()=>ta,unwrapMessage:()=>ye});function Tc(e){return e}function Zc(e){return e}function Oc(){return e=>e}function Cc(e){}function Ec(e){throw new Error("Unexpected value in exhaustive check")}function Ac(e){}function xe(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Xe(e,t="|"){return e.map(n=>Qe(n)).join(t)}function be(e,t){return typeof t=="bigint"?t.toString():t}var Ot=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Ze(e){return new Ot(e)}function Et(e){return e==null}function Oe(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function At(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}var Un=Symbol("evaluating");function Mn(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Un)return r===void 0&&(r=Un,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ic(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ee(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ce(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ie(e){return Ce(e._zod.def)??e._zod.def.shape}function Bn(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return ee(this,t,r),r},enumerable:!0,configurable:!0})}function Wn(e,t,n){t in e?ee(e,t,n):e[t]=n}function fe(e,t,n,r){let o=ie(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Bn(e,i,()=>{let c=t._zod.def.shape[i];return r?r(c,i):c}):Wn(e,i,r?r(s.value,i):s.value))}}function Nc(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Bn(e,n,()=>t[n]):Wn(e,n,r.value))}}function se(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Rc(e){return se(e._zod.def)}function Lc(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function Dc(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}function Fc(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function It(e){return JSON.stringify(e)}function Nt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ye="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function _e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Rt=Ze(()=>{if(W.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function le(e){if(_e(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(_e(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Jn(e){return le(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function jc(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var Uc=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Lt=new Set(["string","number","symbol"]),Vn=new Set(["string","number","bigint","boolean","symbol","undefined"]);function me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function te(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}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 Mc(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function Qe(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Dt(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ee={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]},et={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Bc(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return fe(i,e,tt(e,t)),te(e,se(n,{shape:i,checks:[]}))}function tt(e,t){let n=ie(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}function Wc(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(tt(e,t)),s={};return fe(s,e,Reflect.ownKeys(ie(e)).filter(c=>!i.has(c))),te(e,se(n,{shape:s,checks:[]}))}function Jc(e,t){if(!le(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=ie(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 te(e,se(e._zod.def,{shape:Kn(e,t)}))}function Kn(e,t){let n={};return fe(n,e,Reflect.ownKeys(ie(e))),Nc(n,t),n}function Vc(e,t){if(!le(t))throw new Error("Invalid input to safeExtend: expected a plain object");return te(e,se(e._zod.def,{shape:Kn(e,t)}))}function Kc(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 n={};fe(n,e,Reflect.ownKeys(ie(e))),fe(n,t,Reflect.ownKeys(ie(t)));let r=se(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return te(e,r)}function Hc(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);let c=n?new Set(tt(t,n)):void 0,u={};return fe(u,t,Reflect.ownKeys(ie(t)),e&&((a,l)=>c&&!c.has(l)?a:new e({type:"optional",innerType:a}))),te(t,se(t._zod.def,{shape:u,checks:[]}))}function Gc(e,t,n){let r=n?new Set(tt(t,n)):void 0,o={};return fe(o,t,Reflect.ownKeys(ie(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),te(t,se(t._zod.def,{shape:o}))}function G(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ft(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ne(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function ye(e){return typeof e=="string"?e:e?.message}function nt(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;o>=0&&t.push([o,n])}return t}function Ae(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function re(e,t,n){var r;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.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:ye(e.inst?._zod.def?.error?.(e))??ye(i?.(e))??ye(t?.error?.(e))??ye(n.customError?.(e))??ye(n.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 Hn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var qc=/[\uD800-\uDBFF]/;function Ie(e){let t=e.length;if(!qc.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function Ne(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function jt(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function ze(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function Xc(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Gn(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function qn(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Yc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return Gn(t+n)}function Qc(e){return qn(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ea(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function ta(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ct=class{constructor(...t){}};function Ut(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):ra(e,n,r.value)}}function ue(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function rt(e,t,n){return ue(e,t,n,!1)}function na(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return ue(this,n,r(this))},set(o){ue(this,n,o)}})}return t}function ra(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:ue(this,t,n.bind(this))},set(r){ue(this,t,r)}})}function oa(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Zt,ae=!1,ia={configurable:!0,get(){ae=!0}};function Z(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Zt!==e._zod){Zt=void 0;return}Zt=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ia);let o=ae;ae=!1;try{let i=n(this);return ae?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),ae=ae||o,i}catch(i){throw delete this[t],ae=ae||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function sa(e,t,n,r){let o=oa(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var Xn="~constantCatch";function Yn(e){let t=()=>e;return t[Xn]=!0,t}var Qn;var Mt={value:void 0,enumerable:!1},er="captureStackTrace"in Error?Error:null;function ca(e){let t=er;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return er=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function g(e,t,n,r){let o={};function i(h){this.def=h,this.constr=d,this.traits=new Set}i.prototype=o;let s=n,c=s&&new WeakSet;function u(h,m){if(h._zod){if(h._zod.traits.has(e))return}else{Mt.value=new i(m);try{Object.defineProperty(h,"_zod",Mt)}finally{Mt.value=void 0}}if(h._zod.traits.add(e),t(h,m),c){let _=Object.getPrototypeOf(h),y=h._zod.constr.prototype,b=_;for(;b&&b!==y;)b=Object.getPrototypeOf(b);let v=b??_;c.has(v)||(c.add(v),Ut(v,s))}let f=d.prototype;for(let _ in f)Object.prototype.hasOwnProperty.call(f,_)&&(_ in h||(h[_]=f[_].bind(h)))}let a=r?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function d(h){let m=r?.Parent?ca(l):this;u(m,h);let f=m._zod.deferred;if(f){for(let y of f)y();m._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(m),m}return Object.defineProperty(d,"init",{value:u}),Object.defineProperty(d,Symbol.hasInstance,{value:h=>r?.Parent&&h instanceof r.Parent?!0:h?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var oe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ve=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Qn=globalThis).__zod_globalConfig??(Qn.__zod_globalConfig={});var W=globalThis.__zod_globalConfig;function q(e){return e&&Object.assign(W,e),W}function aa(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,be,2)),e.message}function ua(e){this._zod.message=e}var la={get:aa,set:ua,enumerable:!0,configurable:!0},Wt={value:void 0,enumerable:!1},tr=new WeakSet([Object.prototype,Error.prototype]),nr=(e,t)=>{e.name="$ZodError",Wt.value=t,Object.defineProperty(e,"issues",Wt),Wt.value=void 0,Object.defineProperty(e,"message",la);let n=Object.getPrototypeOf(e);tr.has(n)||(tr.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},rr=g("$ZodError",nr),Jt=g("$ZodError",nr,void 0,{Parent:Error});function pa(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function or(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?pa(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}function ir(e,t=n=>n.message){let n={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>r({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)n._errors.push(t(s));else{let u=n,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 r(e),n}function ot(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Re=e=>{let t=(n,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=n._zod.run({value:r,issues:[]},s);if(c instanceof Promise)throw new oe;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map(a=>re(a,s,q())));throw Ye(u,i?.callee??t),u}return c.value};return t},Vt=Re(Jt),Le=e=>{let t=async(n,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=n._zod.run({value:r,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){let u=new(i?.Err??e)(c.issues.map(a=>re(a,s,q())));throw Ye(u,i?.callee??t),u}return c.value};return t},Kt=Le(Jt),it=e=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new oe;return i.issues.length?sr(e,i.issues,o):{success:!0,data:i.value}};function sr(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>re(o,n,q()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}var st=e=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?sr(e,i.issues,o):{success:!0,data:i.value}};var fa=Symbol.for("zod.compile.invalid"),ma=Symbol.for("zod.compile.fallback"),Ht=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==fa)return!0;if(r.definite===!0&&n===void 0)return!1}return ha(e,t,n)});function ha(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(r[ma]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new oe;return i.issues.length===0}var Gt=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},cr=e=>{let t=Re(e),n=(r,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,c,ot(n,s))};return n};var ar=e=>{let t=Re(e),n=(r,o,i,s)=>t(r,o,i,ot(n,s));return n};var ur=e=>{let t=Le(e),n=async(r,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,c,ot(n,s))};return n};var lr=e=>{let t=Le(e),n=async(r,o,i,s)=>await t(r,o,i,ot(n,s));return n};var pr=e=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return it(e)(t,n,o)};var dr=e=>(t,n,r)=>it(e)(t,n,r);var fr=e=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return st(e)(t,n,o)};var mr=e=>async(t,n,r)=>st(e)(t,n,r);var hr=/^[cC][0-9a-z]{6,}$/,gr=/^[0-9a-z]+$/,yr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,_r=/^[0-9a-vA-V]{20}$/,xr=/^[A-Za-z0-9]{27}$/,br=/^[a-zA-Z0-9_-]{21}$/;function zr(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var vr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var $r=/^([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})$/,Xt=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 Sr=/^(?:[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 ga="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function wr(){return new RegExp(ga,"u")}var kr=/^(?:(?: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])$/,Pr=/^(([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 Tr=/^((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])$/,Zr=/^(([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])$/,Or=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Cr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Er=/^https?$/,Ar=/^\+[1-9]\d{6,14}$/;var Ir="(?:(?:\\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 ya(e){return new RegExp(`^${e}$`)}var Nr=ya(Ir);function qt(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 Rr(e){return new RegExp(`^${qt(e)}$`)}function Lr(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${qt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${qt({precision:e.precision})}`:n;return new RegExp(`^${Ir}T(?:${r})$`)}var Dr=/^[\s\S]{0,}$/;var Yt=/^-?\d+$/,De=/^-?\d+(?:\.\d+)?$/,Fr=/^(?:true|false)$/i,jr=/^null$/i;var Ur=/^[^A-Z]*$/,Mr=/^[^a-z]*$/;var M=g("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var Qt=e=>{let t=e.value;return!Et(t)&&t.length!==void 0},ct={number:"number",bigint:"bigint",object:"date"},en=g("$ZodCheckLessThan",(e,t)=>{M.init(e,t);let n=ct[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:ct[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tn=g("$ZodCheckGreaterThan",(e,t)=>{M.init(e,t);let n=ct[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:ct[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Br=g("$ZodCheckMultipleOf",(e,t)=>{M.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):At(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Wr=g("$ZodCheckNumberFormat",(e,t)=>{M.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=Ee[t.format];e._zod.check=s=>{let c=s.value;if(n){if(!Number.isInteger(c)){s.issues.push({expected:r,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:r,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:r,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 Jr=g("$ZodCheckMaxLength",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Qt),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Ie(o):i)<=t.maximum)return;let c=Ne(o);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Vr=g("$ZodCheckMinLength",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Qt),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Ie(o):i)>=t.minimum)return;let c=Ne(o);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Kr=g("$ZodCheckLengthEquals",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Qt),e._zod.check=r=>{let o=r.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Ie(o):i;if(s===t.length)return;let c=Ne(o),u=s>t.length;r.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),je=g("$ZodCheckStringFormat",(e,t)=>{var n,r;M.init(e,t),t.pattern?(n=e._zod).check??(n.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})}):(r=e._zod).check??(r.check=()=>{})}),Hr=g("$ZodCheckRegex",(e,t)=>{je.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Gr=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ur),je.init(e,t)}),qr=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Mr),je.init(e,t)}),Xr=g("$ZodCheckIncludes",(e,t)=>{M.init(e,t);let n=me(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,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})}}),Yr=g("$ZodCheckStartsWith",(e,t)=>{M.init(e,t);let n=new RegExp(`^${me(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Qr=g("$ZodCheckEndsWith",(e,t)=>{M.init(e,t);let n=new RegExp(`.*${me(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var eo=g("$ZodCheckOverwrite",(e,t)=>{M.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var at=class{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}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 r=t.split(`
2
2
  `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.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,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
3
3
  ${n.join(`
4
4
  `)}
5
- };`)(...Object.values(this.closed))}};var ro={major:4,minor:6,patch:7};var C=g("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ro;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,u,a)=>{if(c.memo)return c;let l=G(c),d;for(let m of u){if(m._zod.def.when){if(Mt(c)||!m._zod.def.when(c))continue}else if(l)continue;let h=c.issues.length,f=m._zod.check(c);if(f instanceof Promise&&a?.async===!1)throw new re;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,c.issues.length!==h&&(Ie(c.issues,h,e),l||(l=G(c,h)))});else{if(c.issues.length===h)continue;Ie(c.issues,h,e),l||(l=G(c,h))}}return d?d.then(()=>c):c},s=(c,u,a)=>{if(G(c))return c.aborted=!0,c;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new re;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 re;return a.then(l=>i(l,o,u))}return i(a,o,u)}}},{get"~standard"(){return it(this,"~standard",sn(this))},set"~standard"(e){ue(this,"~standard",e)}}),_o=(e,t)=>e.issues.length?{issues:e.issues.map(n=>ne(n,t,q()))}:{value:e.value};async function _a(e,t){let n={async:!0};return _o(await e._zod.run({value:t,issues:[]},n),n)}function sn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return _o(r,n)}catch{}return _a(e,t)},vendor:"zod",version:1}}var mt=g("$ZodString",(e,t)=>{C.init(e,t),e._zod.pattern=t.pattern??Fr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),A=g("$ZodStringFormat",(e,t)=>{Me.init(e,t),mt.init(e,t)}),xo=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Sr),A.init(e,t)}),bo=g("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Qt(r))}else t.pattern??(t.pattern=Qt());A.init(e,t)}),zo=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=wr),A.init(e,t)}),vo=1,dt=2;function $o(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function xa(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?$o(e)||dt:ba(e,t)}function ba(e,t){if(!t.normalize&&t.protocol?.source===Ar.source&&!/^https?:\/\//i.test(e))return vo;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse=="function")return n.parse(e)??dt}return new URL(e)}catch{return dt}}var za=/[\t\n\r]/g;function oo(e){return e.replace(za,"")}function va(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 So=g("$ZodURL",(e,t)=>{A.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),o=xa(r,t);if(o===vo){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===dt){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=oo(r);return}t.hostname&&!va(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!$a(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:oo(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),wo=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=kr()),A.init(e,t)}),ko=g("$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?zr:vr(t.length)),A.init(e,t)}),Po=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=gr),A.init(e,t)}),To=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=yr),A.init(e,t)}),Zo=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_r),A.init(e,t)}),Oo=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=xr),A.init(e,t)}),Co=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=br),A.init(e,t)}),Eo=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Dr(t)),A.init(e,t)}),Ao=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Rr),A.init(e,t)}),Io=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Lr(t)),A.init(e,t)}),No=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=$r),A.init(e,t)}),Ro=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Pr),A.init(e,t)}),Sa=/^[0-9a-fA-F:.]+$/;function Lo(e){return Sa.test(e)?$o(`http://[${e}]`):!1}var Do=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Tr),A.init(e,t),e._zod.check=n=>{Lo(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var Fo=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Zr),A.init(e,t)});function wa(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);return`${o}`!==r||o<0||o>128?!1:Lo(n)}var jo=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Or),A.init(e,t),e._zod.check=n=>{wa(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Mo(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var cn=/^[0-9a-zA-Z+/]*={0,2}$/,Uo=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=cn),A.init(e,t),e._zod.check=n=>{Mo(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),ht=/^[A-Za-z0-9_-]*$/;function ka(e){if(!ht.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Mo(n)}var Bo=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ht),A.init(e,t),e._zod.check=n=>{ka(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Wo=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ir),A.init(e,t)});function Pa(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Jo=g("$ZodJWT",(e,t)=>{A.init(e,t),e._zod.check=n=>{Pa(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var an=g("$ZodNumber",(e,t)=>{C.init(e,t),e._zod.pattern=Fe,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Vo=g("$ZodNumberFormat",(e,t)=>{Jr.init(e,t),an.init(e,t)}),Ko=g("$ZodBoolean",(e,t)=>{C.init(e,t),e._zod.pattern=jr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}});var Ho=g("$ZodNull",(e,t)=>{C.init(e,t),e._zod.pattern=Mr,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Go=g("$ZodAny",(e,t)=>{C.init(e,t),e._zod.parse=n=>n}),qo=g("$ZodUnknown",(e,t)=>{C.init(e,t),e._zod.parse=n=>n}),Xo=g("$ZodNever",(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Yo=g("$ZodVoid",(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}});function Ta(e,t){let n=ot(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>r&&!s?.skipChecks&&s?.direction!=="backward"){for(let[u,a]of ot(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,Ie(i.issues,l,e),i}}return o(i,s)}}var Za=e=>Array.isArray(e)?e.length:-1;function io(e,t,n){e.issues.length&&t.issues.push(...te(n,e.issues)),t.value[n]=e.value}var Qo=g("$ZodArray",(e,t)=>{C.init(e,t);let n=J.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,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=>io(d,r,u)));else if(io(l,r,u),c&&l.issues.length!==0&&G(l))break}return s.length?Promise.all(s).then(()=>r):r},Ta(e,Za)});function ft(e,t,n,r,o,i){let s=n in r,c=i==="optional";if(!(!s&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...te(n,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(s||o==="defaulted"&&!c)&&(t.value[n]=void 0):t.value[n]=e.value}}var Oa=[];function ei(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Oa,o=r.length?[...t,...r]: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=jt(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function ti(e,t,n,r,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,d=a.optin,m=a.optout,h=0;for(let f in t){if(s&&n.issues.length!==h){if(G(n,h))break;h=n.issues.length}if(u.has(f))continue;if(f==="__proto__"){l==="never"&&c.push(f);continue}if(l==="never"){c.push(f);continue}let y=a.run({value:t[f],issues:[]},r);y instanceof Promise?e.push(y.then(_=>ft(_,n,f,t,d,m))):ft(y,n,f,t,d,m)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Ca=g("$ZodObject",(e,t)=>{C.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let a=()=>{let l={...r};return Object.defineProperty(t,"shape",{value:l}),a.raw=l,l};a.raw=r,Object.defineProperty(t,"shape",{get:a})}let o=Oe(()=>ei(t));O(e,"propValues",a=>{let l=a.def.shape,d={};for(let m in l){let h=l[m]._zod;if(h.values){Object.prototype.hasOwnProperty.call(d,m)||Q(d,m,new Set);for(let f of h.values)d[m].add(f);h.optin!==void 0&&d[m].add(void 0)}}return d});let i=_e,s=t.catchall,c,u=J.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 m=[],h=c.shape,f=l?.abortEarly,y=a.issues.length;for(let _ of c.allKeys){if(f&&a.issues.length!==y){if(G(a,y))break;y=a.issues.length}if(_==="__proto__")continue;let v=h[_],b=v._zod.optin,T=v._zod.optout,Z=v._zod.run({value:d[_],issues:[]},l);Z instanceof Promise?m.push(Z.then(z=>ft(z,a,_,d,b,T))):ft(Z,a,_,d,b,T)}return s?ti(m,d,a,l,o.value,e,f===!0):m.length?Promise.all(m).then(()=>a):a}}),ni=g("$ZodObjectJIT",(e,t)=>{Ca.init(e,t);let n=e._zod.parse,r=Oe(()=>ei(t)),o=J.memoizer,i=h=>{let f=r.value,y=f.symbolKeys,_=new lt(["payload","ctx"],{shape:h,inst:e,memo:o,syms:y}),v=z=>`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`,b=(z,x)=>`
5
+ };`)(...Object.values(this.closed))}};var no={major:4,minor:6,patch:7};var C=g("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=no;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,u,a)=>{if(c.memo)return c;let l=G(c),d;for(let h of u){if(h._zod.def.when){if(Ft(c)||!h._zod.def.when(c))continue}else if(l)continue;let m=c.issues.length,f=h._zod.check(c);if(f instanceof Promise&&a?.async===!1)throw new oe;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,c.issues.length!==m&&(Ae(c.issues,m,e),l||(l=G(c,m)))});else{if(c.issues.length===m)continue;Ae(c.issues,m,e),l||(l=G(c,m))}}return d?d.then(()=>c):c},s=(c,u,a)=>{if(G(c))return c.aborted=!0,c;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new oe;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 oe;return a.then(l=>i(l,o,u))}return i(a,o,u)}}},{get"~standard"(){return rt(this,"~standard",rn(this))},set"~standard"(e){ue(this,"~standard",e)}}),yo=(e,t)=>e.issues.length?{issues:e.issues.map(n=>re(n,t,q()))}:{value:e.value};async function _a(e,t){let n={async:!0};return yo(await e._zod.run({value:t,issues:[]},n),n)}function rn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return yo(r,n)}catch{}return _a(e,t)},vendor:"zod",version:1}}var dt=g("$ZodString",(e,t)=>{C.init(e,t),e._zod.pattern=t.pattern??Dr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),A=g("$ZodStringFormat",(e,t)=>{je.init(e,t),dt.init(e,t)}),_o=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=$r),A.init(e,t)}),xo=g("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Xt(r))}else t.pattern??(t.pattern=Xt());A.init(e,t)}),bo=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Sr),A.init(e,t)}),zo=1,lt=2;function vo(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function xa(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?vo(e)||lt:ba(e,t)}function ba(e,t){if(!t.normalize&&t.protocol?.source===Er.source&&!/^https?:\/\//i.test(e))return zo;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse=="function")return n.parse(e)??lt}return new URL(e)}catch{return lt}}var za=/[\t\n\r]/g;function ro(e){return e.replace(za,"")}function va(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 $o=g("$ZodURL",(e,t)=>{A.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),o=xa(r,t);if(o===zo){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===lt){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=ro(r);return}t.hostname&&!va(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!$a(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:ro(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),So=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=wr()),A.init(e,t)}),wo=g("$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?br:zr(t.length)),A.init(e,t)}),ko=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hr),A.init(e,t)}),Po=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gr),A.init(e,t)}),To=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=yr),A.init(e,t)}),Zo=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=_r),A.init(e,t)}),Oo=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=xr),A.init(e,t)}),Co=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Lr(t)),A.init(e,t)}),Eo=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Nr),A.init(e,t)}),Ao=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Rr(t)),A.init(e,t)}),Io=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vr),A.init(e,t)}),No=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=kr),A.init(e,t)}),Sa=/^[0-9a-fA-F:.]+$/;function Ro(e){return Sa.test(e)?vo(`http://[${e}]`):!1}var Lo=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Pr),A.init(e,t),e._zod.check=n=>{Ro(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}});var Do=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Tr),A.init(e,t)});function wa(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);return`${o}`!==r||o<0||o>128?!1:Ro(n)}var Fo=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Zr),A.init(e,t),e._zod.check=n=>{wa(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function jo(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var on=/^[0-9a-zA-Z+/]*={0,2}$/,Uo=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=on),A.init(e,t),e._zod.check=n=>{jo(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),ft=/^[A-Za-z0-9_-]*$/;function ka(e){if(!ft.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return jo(n)}var Mo=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ft),A.init(e,t),e._zod.check=n=>{ka(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Bo=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ar),A.init(e,t)});function Pa(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Wo=g("$ZodJWT",(e,t)=>{A.init(e,t),e._zod.check=n=>{Pa(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var sn=g("$ZodNumber",(e,t)=>{C.init(e,t),e._zod.pattern=De,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Jo=g("$ZodNumberFormat",(e,t)=>{Wr.init(e,t),sn.init(e,t)}),Vo=g("$ZodBoolean",(e,t)=>{C.init(e,t),e._zod.pattern=Fr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}});var Ko=g("$ZodNull",(e,t)=>{C.init(e,t),e._zod.pattern=jr,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Ho=g("$ZodAny",(e,t)=>{C.init(e,t),e._zod.parse=n=>n}),Go=g("$ZodUnknown",(e,t)=>{C.init(e,t),e._zod.parse=n=>n}),qo=g("$ZodNever",(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Xo=g("$ZodVoid",(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}});function Ta(e,t){let n=nt(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>r&&!s?.skipChecks&&s?.direction!=="backward"){for(let[u,a]of nt(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,Ae(i.issues,l,e),i}}return o(i,s)}}var Za=e=>Array.isArray(e)?e.length:-1;function oo(e,t,n){e.issues.length&&t.issues.push(...ne(n,e.issues)),t.value[n]=e.value}var Yo=g("$ZodArray",(e,t)=>{C.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)s.push(l.then(d=>oo(d,r,u)));else if(oo(l,r,u),c&&l.issues.length!==0&&G(l))break}return s.length?Promise.all(s).then(()=>r):r},Ta(e,Za)});function pt(e,t,n,r,o,i){let s=n in r,c=i==="optional";if(!(!s&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...ne(n,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(s||o==="defaulted"&&!c)&&(t.value[n]=void 0):t.value[n]=e.value}}var Oa=[];function Qo(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Oa,o=r.length?[...t,...r]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Dt(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function ei(e,t,n,r,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,d=a.optin,h=a.optout,m=0;for(let f in t){if(s&&n.issues.length!==m){if(G(n,m))break;m=n.issues.length}if(u.has(f))continue;if(f==="__proto__"){l==="never"&&c.push(f);continue}if(l==="never"){c.push(f);continue}let _=a.run({value:t[f],issues:[]},r);_ instanceof Promise?e.push(_.then(y=>pt(y,n,f,t,d,h))):pt(_,n,f,t,d,h)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Ca=g("$ZodObject",(e,t)=>{C.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let a=()=>{let l={...r};return Object.defineProperty(t,"shape",{value:l}),a.raw=l,l};a.raw=r,Object.defineProperty(t,"shape",{get:a})}let o=Ze(()=>Qo(t));Z(e,"propValues",a=>{let l=a.def.shape,d={};for(let h in l){let m=l[h]._zod;if(m.values){Object.prototype.hasOwnProperty.call(d,h)||ee(d,h,new Set);for(let f of m.values)d[h].add(f);m.optin!==void 0&&d[h].add(void 0)}}return d});let i=_e,s=t.catchall,c,u=W.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=[],m=c.shape,f=l?.abortEarly,_=a.issues.length;for(let y of c.allKeys){if(f&&a.issues.length!==_){if(G(a,_))break;_=a.issues.length}if(y==="__proto__")continue;let b=m[y],v=b._zod.optin,S=b._zod.optout,P=b._zod.run({value:d[y],issues:[]},l);P instanceof Promise?h.push(P.then(z=>pt(z,a,y,d,v,S))):pt(P,a,y,d,v,S)}return s?ei(h,d,a,l,o.value,e,f===!0):h.length?Promise.all(h).then(()=>a):a}}),ti=g("$ZodObjectJIT",(e,t)=>{Ca.init(e,t);let n=e._zod.parse,r=Ze(()=>Qo(t)),o=W.memoizer,i=m=>{let f=r.value,_=f.symbolKeys,y=new at(["payload","ctx"],{shape:m,inst:e,memo:o,syms:_}),b=z=>`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`,v=(z,x)=>`
6
6
  let ${z}_ab = false;
7
7
  for (let i = 0; i < ${z}.issues.length; i++) {
8
8
  const iss = ${z}.issues[i];
@@ -13,34 +13,34 @@ ${n.join(`
13
13
  if (${z}_ab && ctx && ctx.abortEarly) {
14
14
  payload.value = newResult;
15
15
  return payload;
16
- }`;_.write("const input = payload.value;");let T=Object.create(null),Z=0;for(let z of f.allKeys)T[z]=`key_${Z++}`;_.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let z of f.allKeys){if(z==="__proto__")continue;let x=T[z],P=typeof z=="symbol"?`syms[${y.indexOf(z)}]`:Rt(z),I=`${P} in input`,j=h[z],oe=j?._zod?.optin,Ze=oe!==void 0,Ye=j?._zod?.optout==="optional";if(_.write(`const ${x} = ${v(P)};`),Ze&&Ye){let wc=oe==="optional"?`${x}_present`:`${x}.value !== undefined || ${x}_present`;_.write(`
16
+ }`;y.write("const input = payload.value;");let S=Object.create(null),P=0;for(let z of f.allKeys)S[z]=`key_${P++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let z of f.allKeys){if(z==="__proto__")continue;let x=S[z],O=typeof z=="symbol"?`syms[${_.indexOf(z)}]`:It(z),I=`${O} in input`,H=m[z],Q=H?._zod?.optin,jn=Q!==void 0,Sc=H?._zod?.optout==="optional";if(y.write(`const ${x} = ${b(O)};`),jn&&Sc){let wc=Q==="optional"?`${x}_present`:`${x}.value !== undefined || ${x}_present`;y.write(`
17
17
  const ${x}_present = ${I};
18
18
  if (!${x}.issues.length || ${x}_present) {
19
- if (${x}.issues.length) {${b(x,P)}
19
+ if (${x}.issues.length) {${v(x,O)}
20
20
  }
21
21
 
22
22
  if (${wc}) {
23
- newResult[${P}] = ${x}.value;
23
+ newResult[${O}] = ${x}.value;
24
24
  }
25
25
  }
26
26
 
27
- `)}else Ze?(_.write(`
28
- if (${x}.issues.length) {${b(x,P)}
27
+ `)}else jn?(y.write(`
28
+ if (${x}.issues.length) {${v(x,O)}
29
29
  }
30
- `),oe==="defaulted"?_.write(`newResult[${P}] = ${x}.value;`):_.write(`
30
+ `),Q==="defaulted"?y.write(`newResult[${O}] = ${x}.value;`):y.write(`
31
31
  if (${x}.value !== undefined || ${I}) {
32
- newResult[${P}] = ${x}.value;
32
+ newResult[${O}] = ${x}.value;
33
33
  }
34
- `)):_.write(`
34
+ `)):y.write(`
35
35
  const ${x}_present = ${I};
36
- if (${x}.issues.length) {${b(x,P)}
36
+ if (${x}.issues.length) {${v(x,O)}
37
37
  }
38
38
  if (!${x}_present && !${x}.issues.length) {
39
39
  payload.issues.push({
40
40
  code: "invalid_type",
41
41
  expected: "nonoptional",
42
42
  input: undefined,
43
- path: [${P}]
43
+ path: [${O}]
44
44
  });
45
45
  if (ctx && ctx.abortEarly) {
46
46
  payload.value = newResult;
@@ -49,12 +49,12 @@ ${n.join(`
49
49
  }
50
50
 
51
51
  if (${x}_present) {
52
- newResult[${P}] = ${x}.value;
52
+ newResult[${O}] = ${x}.value;
53
53
  }
54
54
 
55
- `)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},s,c=_e,u=!J.jitless,l=u&&Dt.value,d=t.catchall,m;e._zod.parse=(h,f)=>{m??(m=r.value);let y=h.value;return c(y)?u&&l&&f?.async===!1&&f.jitless!==!0?(s||(s=i(t.shape)),h=s(h,f),d?ti([],y,h,f,m,e,f?.abortEarly===!0):h):n(h,f):(h.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),h)}});function so(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!G(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>ne(s,r,q())))}),t)}var ri=g("$ZodUnion",(e,t)=>{C.init(e,t),O(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),O(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),O(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),O(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){let o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Ce(i.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let c of t.options){let u=c._zod.run({value:r.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=>so(c,r,e,o)):so(s,r,e,o)}});var oi=g("$ZodIntersection",(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([u,a])=>co(n,u,a)):co(n,i,s)}});function on(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(le(e)&&le(t)){let n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=on(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 n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],s=on(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function co(e,t,n){let r=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 m=String(a.path[0]);i.has(m)||i.set(m,a),d=[m]}else return!1;for(let m of d)r.has(m)||r.set(m,{}),r.get(m)[l]=!0;return!0};for(let a of t.issues)s(a,"l")||e.issues.push(a);for(let a of n.issues)s(a,"r")||e.issues.push(a);let c=[...r].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=on(t.value,n.value);if(!u.valid){if(G(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var un=g("$ZodTuple",(e,t)=>{C.init(e,t);let n=t.items,r=J.memoizer;r?.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=r?r.alloc(e,o,[],i):[];let c=[],u=ao(n,"optin"),a=ao(n,"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>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(n.length),d=t.rest?i?.abortEarly:void 0,m=!1;for(let h=0;h<n.length;h++){let f=n[h]._zod.run({value:s[h],issues:[]},i);f instanceof Promise?c.push(f.then(y=>{l[h]=y})):(l[h]=f,d&&!m&&f.issues.length&&(m=G(f)))}if(t.rest&&!m){let h=n.length-1,f=s.slice(n.length),y=o.issues.length;for(let _ of f){if(d&&o.issues.length!==y){if(G(o,y))break;y=o.issues.length}h++;let v=t.rest._zod.run({value:_,issues:[]},i);v instanceof Promise?c.push(v.then(b=>uo(b,o,h))):uo(v,o,h)}}return c.length?Promise.all(c).then(()=>lo(l,o,n,s,a)):lo(l,o,n,s,a)}});function ao(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function uo(e,t,n){e.issues.length&&t.issues.push(...te(n,e.issues)),t.value[n]=e.value}function lo(e,t,n,r,o){for(let i=0;i<n.length;i++){let s=e[i],c=i<r.length;if(!c&&i>=o&&n[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(...te(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var ii=g("$ZodRecord",(e,t)=>{C.init(e,t);let n=J.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!le(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){r.value=n?n.alloc(e,r,{},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){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>ne(f,o,q())),input:l,path:[l],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let h=t.valueType._zod.run({value:i[l],issues:[]},o);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&r.issues.push(...te(l,f.issues)),r.value[m]=f.value})):(h.issues.length&&r.issues.push(...te(l,h.issues)),r.value[m]=h.value)}let a;for(let l in i)if(!u.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=i[l]}else a=a??[],a.push(l);a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}else{r.value=n?n.alloc(e,r,{},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"&&Fe.test(a)&&l.issues.length){let f=t.keyType._zod.run({value:Number(a),issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(l=f)}if(l.issues.length){t.mode==="loose"?r.value[a]=i[a]:c?(u=u??[],u.push(a)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>ne(f,o,q())),input:a,path:[a],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let h=t.valueType._zod.run({value:i[a],issues:[]},o);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&r.issues.push(...te(a,f.issues)),r.value[m]=f.value})):(h.issues.length&&r.issues.push(...te(a,h.issues)),r.value[m]=h.value)}u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}return s.length?Promise.all(s).then(()=>r):r}});var si=g("$ZodEnum",(e,t)=>{C.init(e,t);let n=xe(t.entries),r=new Set(n);e._zod.values=r,O(e,"pattern",o=>{let i=xe(o.def.entries).filter(s=>Ft.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>me(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}});var ci=g("$ZodTransform",(e,t)=>{C.init(e,t),e._zod.optin="optional",J.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ve(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new re;return n.value=o,n}});function po(e,t){return e.value=t.issues.length?void 0:t.value,e}var ln=g("$ZodOptional",(e,t)=>{C.init(e,t),O(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",O(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),O(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ce(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>po(n,i)):po(n,o)}return t.innerType._zod.run(n,r)}}),ai=g("$ZodExactOptional",(e,t)=>{ln.init(e,t),O(e,"values",n=>n.def.innerType._zod.values),O(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),ui=g("$ZodNullable",(e,t)=>{C.init(e,t),O(e,"optin",n=>n.def.innerType._zod.optin),O(e,"optout",n=>n.def.innerType._zod.optout),O(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ce(r.source)}|null)$`):void 0}),O(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),li=g("$ZodDefault",(e,t)=>{C.init(e,t),e._zod.optin="defaulted",O(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>fo(i,t)):fo(o,t)}});function fo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var pi=g("$ZodPrefault",(e,t)=>{C.init(e,t),e._zod.optin="defaulted",O(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),di=g("$ZodNonOptional",(e,t)=>{C.init(e,t),O(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>mo(i,e)):mo(o,e)}});function mo(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function ho(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>ne(o,r,q()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var fi=g("$ZodCatch",(e,t)=>{C.init(e,t),O(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),O(e,"optout",n=>n.def.innerType._zod.optout),O(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>ho(n,i,t,r)):ho(n,o,t,r)}});var mi=g("$ZodPipe",(e,t)=>{C.init(e,t),O(e,"values",n=>n.def.in._zod.values),O(e,"optin",n=>n.def.in._zod.optin),O(e,"optout",n=>n.def.out._zod.optout),O(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>pt(s,t.in,r)):pt(i,t.in,r)}let o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>pt(i,t.out,r)):pt(o,t.out,r)}});function pt(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var hi=g("$ZodReadonly",(e,t)=>{C.init(e,t),O(e,"propValues",n=>n.def.innerType._zod.propValues),O(e,"values",n=>n.def.innerType._zod.values),O(e,"optin",n=>n.def.innerType?._zod?.optin),O(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(go):go(o)}});function go(e){return e.memo||(e.value=Object.freeze(e.value)),e}var gi=g("$ZodFunction",(e,t)=>(C.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?Ht(e._def.input,r):r,i=Reflect.apply(n,this,o);return e._def.output?Ht(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await Gt(e._def.input,r):r,i=await Reflect.apply(n,this,o);return e._def.output?await Gt(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new un({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e));var yi=g("$ZodCustom",(e,t)=>{B.init(e,t),C.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>yo(i,n,r,e));yo(o,n,r,e)}});function yo(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(ze(o))}}var dn=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},fn="~memo",_i=[];function xi(e){return e!==null&&typeof e=="object"}function pn(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var bi=new WeakMap,Ue=0,_t=1,Be=2;function xt(e,t,n){let r=bi.get(e);if(r!==void 0)return r?Be:Ue;if(t.has(e))return Be;t.add(e);let o=Ue,i=l=>{if(o!==Be&&l?._zod){let d=xt(l,t,n);d>o&&(o=d)}},s=(l,d)=>{let m=Ue;for(let h of Reflect.ownKeys(l)){let f=Object.getOwnPropertyDescriptor(l,h);if(d&&!f.enumerable)continue;let y=f.get?_t:f.value?._zod?xt(f.value,t,n):Ue;y>m&&(m=y)}return m},c=l=>{l>o&&(o=l)},u=e._zod.def,a=u.type;switch(a){case"object":{let l=Ee(u);c(l?s(l,!0):_t),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??(n?e._zod.innerType:void 0);c(l?xt(l,t,!1):_t);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 m=d.value;if(!(!m||typeof m!="object")){if(m._zod)i(m);else if(Array.isArray(m))for(let h of m)i(h)}}}return t.delete(e),Ea(e,o)}function Ea(e,t){return t!==_t&&bi.set(e,t===Be),t}function Aa(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var gt,yt=[],Ia={alloc(e,t,n){let r=gt;if(!r)return n;gt=void 0;let o={value:n,issues:null};return r.set(t.value,o),yt.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&Na(i,o.value))throw new dn;return n(o,i)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(u,a)=>{if(n===void 0){let v=xt(e,new Set,!1);if(v===Ue)return e._zod.parse=s,e._zod.run===c&&(e._zod.run=s),s(u,a);v===Be||r?n=!0:r=!0}let l=u.value;if(!xi(l))return s(u,a);let d=a[fn];d||(d={buckets:new WeakMap,backEdges:void 0},a[fn]=d);let m;o===a?m=i:(m=Aa(d,e),o=a,i=m);let h=m.get(l);if(h)return u.value=h.value,h.issues?h.issues.length&&u.issues.push(...pn(h.issues)):(u.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(h.value)),u;gt=m;let f=yt.length,y=s(u,a);gt=void 0;let _=yt.length>f?yt.pop():void 0;return y instanceof Promise?y.then(v=>(_&&(_.issues=v.issues.length?pn(v.issues):_i),v)):(_&&(_.issues=y.issues.length?pn(y.issues):_i),y)};e._zod.parse=c,e._zod.run===s&&(e._zod.run=c)})}};function zi(){return Ia}function Na(e,t){let n=e[fn]?.backEdges;return n!==void 0&&xi(t)&&n.has(t)}var Ra=()=>{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 n={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"},r={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):r[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=Ut(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 ${tt(i.values[0])}`:`Invalid option: expected one of ${Qe(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 ${n[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":""}: ${Qe(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(c=>`'${c}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function vi(){return{localeError:Ra()}}var $i;var mn=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let o={...r,...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 La(){return new mn}($i=globalThis).__zod_globalRegistry??($i.__zod_globalRegistry=La());var he=globalThis.__zod_globalRegistry;function Si(e){return e.checks&&(e.checks=[...e.checks]),e}function wi(e,t){return new e(Si({type:"string",...$(t)}))}function ki(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}function Pi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function Ti(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}function Zi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}function Oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}function Ci(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}function Ei(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}function Ai(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}function Ii(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}function Ni(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}function Ri(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}function Li(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}function Di(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}function Fi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}function ji(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}function Mi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}function Ui(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}function Bi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}function Wi(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 Vi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}function Ki(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}function Hi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}function Gi(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}function qi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}function Xi(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}function Yi(e,t){return new e(Si({type:"number",checks:[],...$(t)}))}function Qi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}function es(e,t){return new e({type:"boolean",...$(t)})}function ts(e,t){return new e({type:"null",...$(t)})}function ns(e){return new e({type:"any"})}function rs(e){return new e({type:"unknown"})}function os(e,t){return new e({type:"never",...$(t)})}function is(e,t){return new e({type:"void",...$(t)})}function bt(e,t){return new nn({check:"less_than",...$(t),value:e,inclusive:!1})}function We(e,t){return new nn({check:"less_than",...$(t),value:e,inclusive:!0})}function zt(e,t){return new rn({check:"greater_than",...$(t),value:e,inclusive:!1})}function Je(e,t){return new rn({check:"greater_than",...$(t),value:e,inclusive:!0})}function vt(e,t){return new Wr({check:"multiple_of",...$(t),value:e})}function $t(e,t){return new Vr({check:"max_length",...$(t),maximum:e})}function $e(e,t){return new Kr({check:"min_length",...$(t),minimum:e})}function St(e,t){return new Hr({check:"length_equals",...$(t),length:e})}function hn(e,t){return new Gr({check:"string_format",format:"regex",...$(t),pattern:e})}function gn(e){return new qr({check:"string_format",format:"lowercase",...$(e)})}function yn(e){return new Xr({check:"string_format",format:"uppercase",...$(e)})}function _n(e,t){return new Yr({check:"string_format",format:"includes",...$(t),includes:e})}function xn(e,t){return new Qr({check:"string_format",format:"starts_with",...$(t),prefix:e})}function bn(e,t){return new eo({check:"string_format",format:"ends_with",...$(t),suffix:e})}function pe(e){return new to({check:"overwrite",tx:e})}function zn(e){return pe(t=>t.normalize(e))}function vn(){return pe(e=>e.trim())}function $n(){return pe(e=>e.toLowerCase())}function Sn(){return pe(e=>e.toUpperCase())}function wn(){return pe(e=>Lt(e))}function ss(e,t,n){return new e({type:"array",element:t,...$(n)})}function cs(e,t,n){return new e({type:"custom",check:"custom",fn:t,...$(n)})}function as(e,t){let n=Da(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(ze(o,r.value,n._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(ze(i))}},e(r.value,r)),t);return n}function Da(e,t){let n=new B({check:"custom",...$(t)});return n._zod.check=e,n}function Ve(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&Q(e,r,n[r]);return e}function Pn(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??he,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 ce(e,t,n,r,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(n,i),!0}function R(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:n.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={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let m=s.schema,h=t.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,t,m,l)}let d=e._zod.parent;d&&(s.ref||(s.ref=d),R(d,t,l),t.seen.get(d).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&Ve(s.schema,u),t.io==="input"&&V(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function us(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Tn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let u=r.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.`);r.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,m=e.external.uri??(f=>f);if(d)return{ref:m(d)};let h=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=h,{defId:h,ref:`${m("__shared")}#/${c}/${us(h)}`}}let u="#",a=`${u}/${c}/`;if(s[1]===n&&!s[1].schema.id)return{ref:u};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:a+us(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 y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,c=_e,u=!W.jitless,l=u&&Rt.value,d=t.catchall,h;e._zod.parse=(m,f)=>{h??(h=r.value);let _=m.value;return c(_)?u&&l&&f?.async===!1&&f.jitless!==!0?(s||(s=i(t.shape)),m=s(m,f),d?ei([],_,m,f,h,e,f?.abortEarly===!0):m):n(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),m)}});function io(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!G(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>re(s,r,q())))}),t)}var ni=g("$ZodUnion",(e,t)=>{C.init(e,t),Z(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),Z(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Z(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),Z(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){let o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Oe(i.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let c of t.options){let u=c._zod.run({value:r.value,issues:[]},o);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}return i?Promise.all(s).then(c=>io(c,r,e,o)):io(s,r,e,o)}});var ri=g("$ZodIntersection",(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([u,a])=>so(n,u,a)):so(n,i,s)}});function nn(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(le(e)&&le(t)){let n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=nn(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 n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],s=nn(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function so(e,t,n){let r=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)r.has(h)||r.set(h,{}),r.get(h)[l]=!0;return!0};for(let a of t.issues)s(a,"l")||e.issues.push(a);for(let a of n.issues)s(a,"r")||e.issues.push(a);let c=[...r].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=nn(t.value,n.value);if(!u.valid){if(G(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var cn=g("$ZodTuple",(e,t)=>{C.init(e,t);let n=t.items,r=W.memoizer;r?.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=r?r.alloc(e,o,[],i):[];let c=[],u=co(n,"optin"),a=co(n,"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>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(n.length),d=t.rest?i?.abortEarly:void 0,h=!1;for(let m=0;m<n.length;m++){let f=n[m]._zod.run({value:s[m],issues:[]},i);f instanceof Promise?c.push(f.then(_=>{l[m]=_})):(l[m]=f,d&&!h&&f.issues.length&&(h=G(f)))}if(t.rest&&!h){let m=n.length-1,f=s.slice(n.length),_=o.issues.length;for(let y of f){if(d&&o.issues.length!==_){if(G(o,_))break;_=o.issues.length}m++;let b=t.rest._zod.run({value:y,issues:[]},i);b instanceof Promise?c.push(b.then(v=>ao(v,o,m))):ao(b,o,m)}}return c.length?Promise.all(c).then(()=>uo(l,o,n,s,a)):uo(l,o,n,s,a)}});function co(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function ao(e,t,n){e.issues.length&&t.issues.push(...ne(n,e.issues)),t.value[n]=e.value}function uo(e,t,n,r,o){for(let i=0;i<n.length;i++){let s=e[i],c=i<r.length;if(!c&&i>=o&&n[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(...ne(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var oi=g("$ZodRecord",(e,t)=>{C.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!le(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){r.value=n?n.alloc(e,r,{},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){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>re(f,o,q())),input:l,path:[l],inst:e});continue}let h=d.value;if(h==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},o);m instanceof Promise?s.push(m.then(f=>{f.issues.length&&r.issues.push(...ne(l,f.issues)),r.value[h]=f.value})):(m.issues.length&&r.issues.push(...ne(l,m.issues)),r.value[h]=m.value)}let a;for(let l in i)if(!u.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=i[l]}else a=a??[],a.push(l);a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}else{r.value=n?n.alloc(e,r,{},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"&&De.test(a)&&l.issues.length){let f=t.keyType._zod.run({value:Number(a),issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(l=f)}if(l.issues.length){t.mode==="loose"?r.value[a]=i[a]:c?(u=u??[],u.push(a)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>re(f,o,q())),input:a,path:[a],inst:e});continue}let h=l.value;if(h==="__proto__")continue;let m=t.valueType._zod.run({value:i[a],issues:[]},o);m instanceof Promise?s.push(m.then(f=>{f.issues.length&&r.issues.push(...ne(a,f.issues)),r.value[h]=f.value})):(m.issues.length&&r.issues.push(...ne(a,m.issues)),r.value[h]=m.value)}u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}return s.length?Promise.all(s).then(()=>r):r}});var ii=g("$ZodEnum",(e,t)=>{C.init(e,t);let n=xe(t.entries),r=new Set(n);e._zod.values=r,Z(e,"pattern",o=>{let i=xe(o.def.entries).filter(s=>Lt.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>me(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}});var si=g("$ZodTransform",(e,t)=>{C.init(e,t),e._zod.optin="optional",W.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ve(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new oe;return n.value=o,n}});function lo(e,t){return e.value=t.issues.length?void 0:t.value,e}var an=g("$ZodOptional",(e,t)=>{C.init(e,t),Z(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Z(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),Z(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Oe(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>lo(n,i)):lo(n,o)}return t.innerType._zod.run(n,r)}}),ci=g("$ZodExactOptional",(e,t)=>{an.init(e,t),Z(e,"values",n=>n.def.innerType._zod.values),Z(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),ai=g("$ZodNullable",(e,t)=>{C.init(e,t),Z(e,"optin",n=>n.def.innerType._zod.optin),Z(e,"optout",n=>n.def.innerType._zod.optout),Z(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Oe(r.source)}|null)$`):void 0}),Z(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),ui=g("$ZodDefault",(e,t)=>{C.init(e,t),e._zod.optin="defaulted",Z(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>po(i,t)):po(o,t)}});function po(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var li=g("$ZodPrefault",(e,t)=>{C.init(e,t),e._zod.optin="defaulted",Z(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),pi=g("$ZodNonOptional",(e,t)=>{C.init(e,t),Z(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>fo(i,e)):fo(o,e)}});function fo(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function mo(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>re(o,r,q()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var di=g("$ZodCatch",(e,t)=>{C.init(e,t),Z(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Z(e,"optout",n=>n.def.innerType._zod.optout),Z(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>mo(n,i,t,r)):mo(n,o,t,r)}});var fi=g("$ZodPipe",(e,t)=>{C.init(e,t),Z(e,"values",n=>n.def.in._zod.values),Z(e,"optin",n=>n.def.in._zod.optin),Z(e,"optout",n=>n.def.out._zod.optout),Z(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>ut(s,t.in,r)):ut(i,t.in,r)}let o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>ut(i,t.out,r)):ut(o,t.out,r)}});function ut(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var mi=g("$ZodReadonly",(e,t)=>{C.init(e,t),Z(e,"propValues",n=>n.def.innerType._zod.propValues),Z(e,"values",n=>n.def.innerType._zod.values),Z(e,"optin",n=>n.def.innerType?._zod?.optin),Z(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(ho):ho(o)}});function ho(e){return e.memo||(e.value=Object.freeze(e.value)),e}var hi=g("$ZodFunction",(e,t)=>(C.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?Vt(e._def.input,r):r,i=Reflect.apply(n,this,o);return e._def.output?Vt(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await Kt(e._def.input,r):r,i=await Reflect.apply(n,this,o);return e._def.output?await Kt(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new cn({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e));var gi=g("$ZodCustom",(e,t)=>{M.init(e,t),C.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>go(i,n,r,e));go(o,n,r,e)}});function go(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(ze(o))}}var ln=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},pn="~memo",yi=[];function _i(e){return e!==null&&typeof e=="object"}function un(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var xi=new WeakMap,Ue=0,gt=1,Me=2;function yt(e,t,n){let r=xi.get(e);if(r!==void 0)return r?Me:Ue;if(t.has(e))return Me;t.add(e);let o=Ue,i=l=>{if(o!==Me&&l?._zod){let d=yt(l,t,n);d>o&&(o=d)}},s=(l,d)=>{let h=Ue;for(let m of Reflect.ownKeys(l)){let f=Object.getOwnPropertyDescriptor(l,m);if(d&&!f.enumerable)continue;let _=f.get?gt:f.value?._zod?yt(f.value,t,n):Ue;_>h&&(h=_)}return h},c=l=>{l>o&&(o=l)},u=e._zod.def,a=u.type;switch(a){case"object":{let l=Ce(u);c(l?s(l,!0):gt),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??(n?e._zod.innerType:void 0);c(l?yt(l,t,!1):gt);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 m of h)i(m)}}}return t.delete(e),Ea(e,o)}function Ea(e,t){return t!==gt&&xi.set(e,t===Me),t}function Aa(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var mt,ht=[],Ia={alloc(e,t,n){let r=mt;if(!r)return n;mt=void 0;let o={value:n,issues:null};return r.set(t.value,o),ht.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&Na(i,o.value))throw new ln;return n(o,i)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(u,a)=>{if(n===void 0){let b=yt(e,new Set,!1);if(b===Ue)return e._zod.parse=s,e._zod.run===c&&(e._zod.run=s),s(u,a);b===Me||r?n=!0:r=!0}let l=u.value;if(!_i(l))return s(u,a);let d=a[pn];d||(d={buckets:new WeakMap,backEdges:void 0},a[pn]=d);let h;o===a?h=i:(h=Aa(d,e),o=a,i=h);let m=h.get(l);if(m)return u.value=m.value,m.issues?m.issues.length&&u.issues.push(...un(m.issues)):(u.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(m.value)),u;mt=h;let f=ht.length,_=s(u,a);mt=void 0;let y=ht.length>f?ht.pop():void 0;return _ instanceof Promise?_.then(b=>(y&&(y.issues=b.issues.length?un(b.issues):yi),b)):(y&&(y.issues=_.issues.length?un(_.issues):yi),_)};e._zod.parse=c,e._zod.run===s&&(e._zod.run=c)})}};function bi(){return Ia}function Na(e,t){let n=e[pn]?.backEdges;return n!==void 0&&_i(t)&&n.has(t)}var Ra=()=>{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 n={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"},r={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):r[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=jt(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 ${Qe(i.values[0])}`:`Invalid option: expected one of ${Xe(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Xe(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(c=>`'${c}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function zi(){return{localeError:Ra()}}var vi;var dn=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let o={...r,...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 La(){return new dn}(vi=globalThis).__zod_globalRegistry??(vi.__zod_globalRegistry=La());var he=globalThis.__zod_globalRegistry;function $i(e){return e.checks&&(e.checks=[...e.checks]),e}function Si(e,t){return new e($i({type:"string",...$(t)}))}function wi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}function ki(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function Pi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}function Ti(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}function Zi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}function Oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}function Ci(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}function Ei(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}function Ai(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}function Ii(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}function Ni(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}function Ri(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}function Li(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}function Di(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}function Fi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}function ji(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}function Ui(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}function Mi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}function Bi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}function Wi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}function Ji(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}function Vi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}function Ki(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}function Hi(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}function Gi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}function qi(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}function Xi(e,t){return new e($i({type:"number",checks:[],...$(t)}))}function Yi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}function Qi(e,t){return new e({type:"boolean",...$(t)})}function es(e,t){return new e({type:"null",...$(t)})}function ts(e){return new e({type:"any"})}function ns(e){return new e({type:"unknown"})}function rs(e,t){return new e({type:"never",...$(t)})}function os(e,t){return new e({type:"void",...$(t)})}function _t(e,t){return new en({check:"less_than",...$(t),value:e,inclusive:!1})}function Be(e,t){return new en({check:"less_than",...$(t),value:e,inclusive:!0})}function xt(e,t){return new tn({check:"greater_than",...$(t),value:e,inclusive:!1})}function We(e,t){return new tn({check:"greater_than",...$(t),value:e,inclusive:!0})}function bt(e,t){return new Br({check:"multiple_of",...$(t),value:e})}function zt(e,t){return new Jr({check:"max_length",...$(t),maximum:e})}function $e(e,t){return new Vr({check:"min_length",...$(t),minimum:e})}function vt(e,t){return new Kr({check:"length_equals",...$(t),length:e})}function fn(e,t){return new Hr({check:"string_format",format:"regex",...$(t),pattern:e})}function mn(e){return new Gr({check:"string_format",format:"lowercase",...$(e)})}function hn(e){return new qr({check:"string_format",format:"uppercase",...$(e)})}function gn(e,t){return new Xr({check:"string_format",format:"includes",...$(t),includes:e})}function yn(e,t){return new Yr({check:"string_format",format:"starts_with",...$(t),prefix:e})}function _n(e,t){return new Qr({check:"string_format",format:"ends_with",...$(t),suffix:e})}function pe(e){return new eo({check:"overwrite",tx:e})}function xn(e){return pe(t=>t.normalize(e))}function bn(){return pe(e=>e.trim())}function zn(){return pe(e=>e.toLowerCase())}function vn(){return pe(e=>e.toUpperCase())}function $n(){return pe(e=>Nt(e))}function is(e,t,n){return new e({type:"array",element:t,...$(n)})}function ss(e,t,n){return new e({type:"custom",check:"custom",fn:t,...$(n)})}function cs(e,t){let n=Da(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(ze(o,r.value,n._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(ze(i))}},e(r.value,r)),t);return n}function Da(e,t){let n=new M({check:"custom",...$(t)});return n._zod.check=e,n}function Je(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&ee(e,r,n[r]);return e}function wn(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??he,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 ce(e,t,n,r,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(n,i),!0}function R(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:n.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={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let h=s.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,h,l)}let d=e._zod.parent;d&&(s.ref||(s.ref=d),R(d,t,l),t.seen.get(d).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&Je(s.schema,u),t.io==="input"&&J(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function as(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function kn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let u=r.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.`);r.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??(f=>f);if(d)return{ref:h(d)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${h("__shared")}#/${c}/${as(m)}`}}let u="#",a=`${u}/${c}/`;if(s[1]===n&&!s[1].schema.id)return{ref:u};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:a+as(l)}},i=s=>{if(s[1].schema.$ref)return;let c=s[1],{ref:u,defId:a}=o(s);c.def={...c.schema},a&&(c.defId=a);let l=c.schema;for(let d in l)delete l[d];l.$ref=u};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
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 ds(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!="object")return;ds(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var fs=new Set(["type","properties","required","additionalProperties"]),ls=["oneOf","anyOf"];function ps(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function kn(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!fs.has(s))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let c=[];for(let a of t){let l=a.properties?.[s]??ps(a);l!=null&&(c.some(d=>JSON.stringify(d)===JSON.stringify(l))||c.push(l))}let u=c.length===1?c[0]:kn(c)??{allOf:c};Q(n,s,u)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=ps(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 Fa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of fs)if(o in e)return;let n=t.filter(o=>ls.some(i=>Array.isArray(o[i]))),r=null;if(!n.length)r=kn(t);else{let o=n[0],i=ls.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=>kn([...s,u]));if(c.some(u=>!u))return;r={[i]:c}}r&&(delete e.allOf,Ve(e,r))}function Zn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=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){r(d);let h=e.seen.get(d),f=h.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(a.allOf=a.allOf??[],a.allOf.push(f)):Ve(a,f),Ve(a,l),c._zod.parent===d)for(let _ in a)_==="$ref"||_==="allOf"||_ in l||delete a[_];if(f.$ref&&h.def)for(let _ in a)_==="$ref"||_==="allOf"||_ in h.def&&JSON.stringify(a[_])===JSON.stringify(h.def[_])&&delete a[_]}let m=c._zod.parent;if(m&&m!==d){r(m);let h=e.seen.get(m);if(h?.schema.$ref&&(a.$ref=h.schema.$ref,h.def))for(let f in a)f==="$ref"||f==="allOf"||f in h.def&&JSON.stringify(a[f])===JSON.stringify(h.def[f])&&delete a[f]}e.override({zodSchema:c,jsonSchema:a,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())r(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())ds(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let 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)??[])Fa(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)}Ve(o,n.defId?n.schema:n.def??n.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,Q(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:Ke(t,"input",e.processors),output:Ke(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function V(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return V(r.element,n);if(r.type==="set")return V(r.valueType,n);if(r.type==="lazy")return V(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return V(r.innerType,n);if(r.type==="intersection")return V(r.left,n)||V(r.right,n);if(r.type==="record"||r.type==="map")return V(r.keyType,n)||V(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:V(r.in,n)||V(r.out,n);if(r.type==="object"){for(let o in r.shape)if(V(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(V(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(V(o,n))return!0;return!!(r.rest&&V(r.rest,n))}return!1}var ms=(e,t={})=>n=>{let r=Pn({...n,processors:t});return R(e,r),Tn(r,e),Zn(r,e)},Ke=(e,t,n={})=>r=>{let{libraryOptions:o,target:i}=r??{},s=Pn({...o??{},target:i,io:t,processors:n});return R(e,s),Tn(s,e),Zn(s,e)};var Se=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},we=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},hs=(e,t)=>{Se(e,"minimum",t),we(e,"maximum",t)},xs=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},bs=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},zs=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},vs=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},gs=(e,t)=>Se(e,"minimum",t.minimum),ys=(e,t)=>we(e,"maximum",t.maximum),_s=e=>(t,n)=>{vs(t,n.format);let[r,o]=e[n.format];Se(t,"minimum",r),we(t,"maximum",o)},ja={greater_than:(e,t)=>Se(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>we(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>xs(e,t.value),number_format:_s(Ae),bigint_format:_s(nt),min_length:gs,max_length:ys,length_equals:(e,t)=>hs(e,t.length),min_size:gs,max_size:ys,size_equals:(e,t)=>hs(e,t.size),string_format:(e,t)=>{vs(e,t.format),t.pattern&&bs(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>zs(e,t.mime)};function X(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)ja[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Se(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Se(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&we(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&we(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&xs(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&zs(t,o.mime);for(let i of o.patterns??[])bs(t,i);return t}var Ma={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ua=new Map([[cn,Cr],[ht,Er]]),$s=e=>Ua.get(e)??e,Ss=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:l}=X(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),c&&(o.format=Ma[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(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},ws=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:a,isInt:l}=X(e);o.type=l?"integer":"number";let d=typeof a=="number"&&a>=(i??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(s??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(d?h?(o.minimum=a,o.exclusiveMinimum=!0):o.exclusiveMinimum=a:typeof i=="number"&&(o.minimum=i),m?h?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof s=="number"&&(o.maximum=s),c){let f=new Set;for(let v of c)Number.isFinite(v)&&v!==0?f.add(Math.abs(v)):ce(e,t,o,r,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[y,..._]=f;y!==void 0&&(o.multipleOf=y),_.length&&(o.allOf=[...o.allOf??[],..._.map(v=>({multipleOf:v}))])}},ks=(e,t,n,r)=>{n.type="boolean"};var Ps=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"};var Ts=(e,t,n,r)=>{ce(e,t,n,r,"Void cannot be represented in JSON Schema")},Zs=(e,t,n,r)=>{n.not={}},Os=(e,t,n,r)=>{},Cs=(e,t,n,r)=>{};var Es=(e,t,n,r)=>{let o=e._zod.def,i=xe(o.entries);if(i.length===0){n.not={};return}i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i};var As=(e,t,n,r)=>{ce(e,t,n,r,"Custom types cannot be represented in JSON Schema")},Is=(e,t,n,r)=>{ce(e,t,n,r,"Function types cannot be represented in JSON Schema")},Ns=(e,t,n,r)=>{ce(e,t,n,r,"Transforms cannot be represented in JSON Schema")};var Rs=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:c}=X(e);typeof s=="number"&&(o.minItems=s),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=R(i.element,t,{...r,path:[...r.path,"items"]})};function He(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?He(t.out):t.type==="catch"?He(t.innerType):e._zod.optin}var Ls=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&ce(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let a in s)Q(o.properties,a,R(s[a],t,{...r,path:[...r.path,"properties",a]}));let u=[];for(let a of Object.keys(s)){let l=i.shape[a];(t.io==="input"?He(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=R(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Ds=(e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>R(c,t,{...r,path:[...r.path,i?"oneOf":"anyOf",u]}));i?n.oneOf=s:n.anyOf=s},Fs=(e,t,n,r)=>{let o=e._zod.def,i=R(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=R(o.right,t,{...r,path:[...r.path,"allOf",1]}),c=a=>"allOf"in a&&Object.keys(a).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];n.allOf=u,t.intersections.push(u)},js=(e,t,n,r)=>{let o=n,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,_)=>R(y,t,{...r,path:[...r.path,s,_]})),a=i.rest?R(i.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let y=i.items[l-1];if(!(t.io==="input"?He(y)!==void 0:y._zod.optout==="optional"))break;l--}let d=i.items.length,m=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=u,m?o.items=!1:a&&(o.items=a),l>0&&(o.minItems=l),m&&(o.maxItems=d)):t.target==="openapi-3.0"?(o.items={anyOf:u},a&&o.items.anyOf.push(a),l>0&&(o.minItems=l),m&&(o.maxItems=d)):(o.items=u,m?o.additionalItems=!1:a&&(o.additionalItems=a),l>0&&(o.minItems=l),m&&(o.maxItems=d));let{minimum:h,maximum:f}=X(e);typeof h=="number"&&(o.minItems=h),typeof f=="number"&&(o.maxItems=f)};function On(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let f=e.get(t)?.def;if(!f)return t;let y=On(e,f,n);return y===f?t:y}for(let f of["anyOf","oneOf"]){let y=t[f];if(!Array.isArray(y))continue;let _=y.map(v=>On(e,v,n));_.some((v,b)=>v!==y[b])&&(t={...t,[f]:_})}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some(f=>f==="number"||f==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(f=>typeof f=="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:u,exclusiveMaximum:a,multipleOf:l,format:d,id:m,...h}=t;return h.enum?h.enum=h.enum.map(f=>typeof f=="number"?String(f):f):typeof h.const=="number"&&(h.const=String(h.const)),o&&(h.type="string",i||(h.pattern=(r.includes("number")?Fe:en).source)),h}var Cn=new WeakMap;function Ba(e){let t=new Map;for(let r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);let n=new Map;for(let r of Cn.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=On(t,i,new Set);s!==i&&n.set(i,s)}if(n.size)for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);i&&(o.propertyNames=i)}}var Ms=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,c=X(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=R(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)Q(o.patternProperties,$s(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=R(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=Cn.get(t);l||(l=[],Cn.set(t,l),t.deferred.push(()=>Ba(t))),l.push(e)}o.additionalProperties=R(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let u=s._zod.values,a=t.io==="input"&&He(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))}},Us=(e,t,n,r)=>{let o=e._zod.def,i=R(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Bs=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},En=Symbol();function Ws(e,t,n,r,o){let i=!1,s=JSON.stringify(e,(c,u)=>typeof u!="bigint"?u:(i=!0,null));return i?(ce(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),En):JSON.parse(s)}var Js=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s=Ws(o.defaultValue,e,t,n,r);s!==En&&(n.default=s)},Vs=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Ws(o.defaultValue,e,t,n,r);s!==En&&(n._prefault=s)},Ks=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{ce(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},Hs=(e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;R(s,t,r);let c=t.seen.get(e);c.ref=s},Gs=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0};var An=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType};var qs=new WeakSet([Object.prototype,Error.prototype]);function wt(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var Xa=(e,t)=>{or.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);qs.has(n)||(qs.add(n),wt(n,"format",r=>o=>sr(r,o)),wt(n,"flatten",r=>o=>ir(r,o)),wt(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,be,2)}),wt(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,be,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var Y=g("ZodError",Xa,void 0,{Parent:Error});var Xs=Le(Y),Ys=De(Y),Qs=ct(Y),ec=at(Y),tc=ar(Y),nc=ur(Y),rc=lr(Y),oc=pr(Y),ic=dr(Y),sc=fr(Y),cc=mr(Y),ac=hr(Y);function Qa(){J.localeError||q(vi())}function Ge(){J.memoizer||q({memoizer:zi()})}var E=g("ZodType",(e,t)=>(Qa(),C.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(S.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ee(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(el(e,t))},superRefine(e,t){return this.check(tl(e,t))},overwrite(e){return this.check(pe(e))},optional(){return pc(this)},exactOptional(){return ju(this)},nullable(){return dc(this)},nullish(){return pc(dc(this))},nonoptional(e){return Vu(this,e)},array(){return N(this)},or(e){return de([this,e])},and(e){return Nu(this,e)},transform(e){return fc(this,Fu(e))},default(e){return Bu(this,e)},prefault(e){return Ju(this,e)},catch(e){return Hu(this,e)},pipe(e){return fc(this,e)},readonly(){return Xu(this)},describe(e){let t=this.clone();return he.add(t,{description:e}),t},meta(...e){if(e.length===0)return he.get(this);let t=this.clone();return he.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 S.hide(this,"~standard",{...sn(this),jsonSchema:{input:Ke(this,"input"),output:Ke(this,"output")}})},set"~standard"(e){S.own(this,"~standard",e)},parse:function e(t,n){return Xs(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ys(this,t,n,{callee:e})},safeParse(e,t){return Qs(this,e,t)},async safeParseAsync(e,t){return ec(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){S.own(this,"spa",e)},validate(e,t){return qt(this,e,t)},validateAsync(e,t){return Xt(this,e,t)},encode:function e(t,n){return tc(this,t,n,{callee:e})},decode:function e(t,n){return nc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await rc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await oc(this,t,n,{callee:e})},safeEncode(e,t){return ic(this,e,t)},safeDecode(e,t){return sc(this,e,t)},async safeEncodeAsync(e,t){return cc(this,e,t)},async safeDecodeAsync(e,t){return ac(this,e,t)},toJSONSchema(e){return ms(this,{})(e)},get description(){return he.get(this)?.description},get _def(){return this._zod.def}}),mc=g("_ZodString",(e,t)=>{mt.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ss(e,n,r,o)},S.derived({format:e=>X(e).format??null,minLength:e=>X(e).minimum??null,maxLength:e=>X(e).maximum??null},{regex(...e){return this.check(hn(...e))},includes(...e){return this.check(_n(...e))},startsWith(...e){return this.check(xn(...e))},endsWith(...e){return this.check(bn(...e))},min(...e){return this.check($e(...e))},max(...e){return this.check($t(...e))},length(...e){return this.check(St(...e))},nonempty(...e){return this.check($e(1,...e))},lowercase(e){return this.check(gn(e))},uppercase(e){return this.check(yn(e))},trim(){return this.check(vn())},normalize(...e){return this.check(zn(...e))},toLowerCase(){return this.check($n())},toUpperCase(){return this.check(Sn())},slugify(){return this.check(wn())}})),eu=g("ZodString",(e,t)=>{mt.init(e,t),mc.init(e,t)},{email(e){return this.check(ki(iu,e))},url(e){return this.check(Ei(cu,e))},jwt(e){return this.check(Ki(vu,e))},emoji(e){return this.check(Ai(au,e))},guid(e){return this.check(Pi(su,e))},uuid(e){return this.check(Ti(kt,e))},uuidv4(e){return this.check(Zi(kt,e))},uuidv6(e){return this.check(Oi(kt,e))},uuidv7(e){return this.check(Ci(kt,e))},nanoid(e){return this.check(Ii(uu,e))},cuid(e){return this.check(Ni(lu,e))},cuid2(e){return this.check(Ri(pu,e))},ulid(e){return this.check(Li(du,e))},base64(e){return this.check(Wi(xu,e))},base64url(e){return this.check(Ji(bu,e))},xid(e){return this.check(Di(fu,e))},ksuid(e){return this.check(Fi(mu,e))},ipv4(e){return this.check(ji(hu,e))},ipv6(e){return this.check(Mi(gu,e))},cidrv4(e){return this.check(Ui(yu,e))},cidrv6(e){return this.check(Bi(_u,e))},e164(e){return this.check(Vi(zu,e))},datetime(e){return this.check(Hi(tu,e))},date(e){return this.check(Gi(nu,e))},time(e){return this.check(qi(ru,e))},duration(e){return this.check(Xi(ou,e))}});function p(e){return wi(eu,e)}var L=g("ZodStringFormat",(e,t)=>{A.init(e,t),mc.init(e,t)}),tu=g("ZodISODateTime",(e,t)=>{Eo.init(e,t),L.init(e,t)}),nu=g("ZodISODate",(e,t)=>{Ao.init(e,t),L.init(e,t)}),ru=g("ZodISOTime",(e,t)=>{Io.init(e,t),L.init(e,t)}),ou=g("ZodISODuration",(e,t)=>{No.init(e,t),L.init(e,t)}),iu=g("ZodEmail",(e,t)=>{zo.init(e,t),L.init(e,t)});var su=g("ZodGUID",(e,t)=>{xo.init(e,t),L.init(e,t)});var kt=g("ZodUUID",(e,t)=>{bo.init(e,t),L.init(e,t)});var cu=g("ZodURL",(e,t)=>{So.init(e,t),L.init(e,t)});var au=g("ZodEmoji",(e,t)=>{wo.init(e,t),L.init(e,t)});var uu=g("ZodNanoID",(e,t)=>{ko.init(e,t),L.init(e,t)});var lu=g("ZodCUID",(e,t)=>{Po.init(e,t),L.init(e,t)});var pu=g("ZodCUID2",(e,t)=>{To.init(e,t),L.init(e,t)});var du=g("ZodULID",(e,t)=>{Zo.init(e,t),L.init(e,t)});var fu=g("ZodXID",(e,t)=>{Oo.init(e,t),L.init(e,t)});var mu=g("ZodKSUID",(e,t)=>{Co.init(e,t),L.init(e,t)});var hu=g("ZodIPv4",(e,t)=>{Ro.init(e,t),L.init(e,t)});var gu=g("ZodIPv6",(e,t)=>{Do.init(e,t),L.init(e,t)});var yu=g("ZodCIDRv4",(e,t)=>{Fo.init(e,t),L.init(e,t)});var _u=g("ZodCIDRv6",(e,t)=>{jo.init(e,t),L.init(e,t)});var xu=g("ZodBase64",(e,t)=>{Uo.init(e,t),L.init(e,t)});var bu=g("ZodBase64URL",(e,t)=>{Bo.init(e,t),L.init(e,t)});var zu=g("ZodE164",(e,t)=>{Wo.init(e,t),L.init(e,t)});var vu=g("ZodJWT",(e,t)=>{Jo.init(e,t),L.init(e,t)});var hc=g("ZodNumber",(e,t)=>{an.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ws(e,n,r,o),e.isFinite=!0},S.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=X(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=X(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=X(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>X(e).format??null},{gt(e,t){return this.check(zt(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(bt(e,t))},lte(e,t){return this.check(We(e,t))},max(e,t){return this.check(We(e,t))},int(e){return this.check(uc(e))},safe(e){return this.check(uc(e))},positive(e){return this.check(zt(0,e))},nonnegative(e){return this.check(Je(0,e))},negative(e){return this.check(bt(0,e))},nonpositive(e){return this.check(We(0,e))},multipleOf(e,t){return this.check(vt(e,t))},step(e,t){return this.check(vt(e,t))},finite(){return this}}));function k(e){return Yi(hc,e)}var $u=g("ZodNumberFormat",(e,t)=>{Vo.init(e,t),hc.init(e,t)});function uc(e){return Qi($u,e)}var Su=g("ZodBoolean",(e,t)=>{Ko.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ks(e,n,r,o)});function D(e){return es(Su,e)}var wu=g("ZodNull",(e,t)=>{Ho.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ps(e,n,r,o)});function Rn(e){return ts(wu,e)}var ku=g("ZodAny",(e,t)=>{Go.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Os(e,n,r,o)});function F(){return ns(ku)}var Pu=g("ZodUnknown",(e,t)=>{qo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cs(e,n,r,o)});function Pt(){return rs(Pu)}var Tu=g("ZodNever",(e,t)=>{Xo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zs(e,n,r,o)});function Zu(e){return os(Tu,e)}var Ou=g("ZodVoid",(e,t)=>{Yo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ts(e,n,r,o)});function K(e){return is(Ou,e)}var Cu=g("ZodArray",(e,t)=>{Ge(),Qo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rs(e,n,r,o),e.element=t.element},{min(e,t){return this.check($e(e,t))},nonempty(e){return this.check($e(1,e))},max(e,t){return this.check($t(e,t))},length(e,t){return this.check(St(e,t))},unwrap(){return this.element}});function N(e,t){return ss(Cu,e,t)}var Eu=g("ZodObject",(e,t)=>{Ge(),ni.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ls(e,n,r,o),S.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(S.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(S.mergeDefs(this._zod.def,{catchall:Pt()}))},loose(){return this.clone(S.mergeDefs(this._zod.def,{catchall:Pt()}))},strict(){return this.clone(S.mergeDefs(this._zod.def,{catchall:Zu()}))},strip(){return this.clone(S.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return S.extend(this,e)},safeExtend(e){return S.safeExtend(this,e)},merge(e){return S.merge(this,e)},pick(e){return S.pick(this,e)},omit(e){return S.omit(this,e)},partial(...e){return S.partial(Ln,this,e[0])},exactPartial(...e){return S.partial(gc,this,e[0],"exactPartial")},required(...e){return S.required(yc,this,e[0])}});function M(e,t){let n={type:"object",shape:e??{},...S.normalizeParams(t)};return new Eu(n)}var Au=g("ZodUnion",(e,t)=>{ri.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ds(e,n,r,o),e.options=t.options});function de(e,t){return new Au({type:"union",options:e,...S.normalizeParams(t)})}var Iu=g("ZodIntersection",(e,t)=>{oi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fs(e,n,r,o)});function Nu(e,t){return new Iu({type:"intersection",left:e,right:t})}var Ru=g("ZodTuple",(e,t)=>{Ge(),un.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>js(e,n,r,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 Ln({type:"optional",innerType:t}))})}});function Lu(e,t,n){let r=t instanceof C,o=r?n:t,i=r?t:null;return new Ru({type:"tuple",items:e,rest:i,...S.normalizeParams(o)})}var lc=g("ZodRecord",(e,t)=>{Ge(),ii.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ms(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function w(e,t,n){return!t||!t._zod?new lc({type:"record",keyType:p(),valueType:e,...S.normalizeParams(t)}):new lc({type:"record",keyType:e,valueType:t,...S.normalizeParams(n)})}var Nn=g("ZodEnum",(e,t)=>{si.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Es(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Nn({...t,checks:[],...S.normalizeParams(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Nn({...t,checks:[],...S.normalizeParams(o),entries:i})}});function W(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Nn({type:"enum",entries:n,...S.normalizeParams(t)})}var Du=g("ZodTransform",(e,t)=>{Ge(),ci.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ns(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ve(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(S.issue(i,n.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(S.issue(s))}};let o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Fu(e){return new Du({type:"transform",transform:e})}var Ln=g("ZodOptional",(e,t)=>{ln.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>An(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new Ln({type:"optional",innerType:e})}var gc=g("ZodExactOptional",(e,t)=>{ai.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>An(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ju(e){return new gc({type:"optional",innerType:e})}var Mu=g("ZodNullable",(e,t)=>{ui.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Us(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new Mu({type:"nullable",innerType:e})}var Uu=g("ZodDefault",(e,t)=>{li.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Js(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Bu(e,t){return new Uu({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():S.shallowClone(t)}})}var Wu=g("ZodPrefault",(e,t)=>{pi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ju(e,t){return new Wu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():S.shallowClone(t)}})}var yc=g("ZodNonOptional",(e,t)=>{di.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Vu(e,t){return new yc({type:"nonoptional",innerType:e,...S.normalizeParams(t)})}var Ku=g("ZodCatch",(e,t)=>{fi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ks(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Hu(e,t){return new Ku({type:"catch",innerType:e,catchValue:typeof t=="function"?t:S.constantCatch(t)})}var Gu=g("ZodPipe",(e,t)=>{mi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hs(e,n,r,o),e.in=t.in,e.out=t.out});function fc(e,t){return new Gu({type:"pipe",in:e,out:t})}var qu=g("ZodReadonly",(e,t)=>{hi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Xu(e){return new qu({type:"readonly",innerType:e})}var Yu=g("ZodFunction",(e,t)=>{gi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Is(e,n,r,o)});function H(e){return new Yu({type:"function",input:Array.isArray(e?.input)?Lu(e?.input):e?.input??N(Pt()),output:e?.output??Pt()})}var Qu=g("ZodCustom",(e,t)=>{yi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>As(e,n,r,o)});function el(e,t={}){return cs(Qu,e,t)}function tl(e,t){return as(e,t)}var Dn=M({id:p().min(1),title:p().min(1),concept:p().optional(),targetFile:p().optional(),targetSymbol:p().optional(),symbol:p().optional(),instructions:de([p(),N(p())]),hint:p().optional(),testNames:N(p()).optional()}),ke=W(["js","ts","cpp","py","sql"]);var kd=M({language:ke.default("js"),files:w(p(),p()).default({}),starterFiles:w(p(),p()).optional(),solutionFiles:w(p(),p()).optional(),entry:p().optional(),testEntry:p().optional()}),Pd=M({steps:N(Dn).default([]),stepIndex:k().int().nonnegative().default(0),mode:W(["guided","sandbox"]).default("guided"),language:ke.optional(),lang:ke.optional(),starterFiles:w(p(),p()).optional(),solutionFiles:w(p(),p()).optional(),tsStarterFiles:w(p(),p()).optional(),tsSolutionFiles:w(p(),p()).optional(),tsFiles:w(p(),p()).optional(),cppStarterFiles:w(p(),p()).optional(),cppSolutionFiles:w(p(),p()).optional(),cppFiles:w(p(),p()).optional(),pyStarterFiles:w(p(),p()).optional(),pySolutionFiles:w(p(),p()).optional(),pyFiles:w(p(),p()).optional(),pyEntry:p().optional(),pyTestEntry:p().optional(),pyTestCode:p().optional(),summary:p().optional(),onStepComplete:H({input:[Dn,k()],output:K()}).optional(),onLabComplete:H({input:[p()],output:K()}).optional()}),Td=M({stage:W(["downloading","caching","extracting","compiling","linking","ready","error"]),loadedBytes:k().optional(),totalBytes:k().optional(),percent:k().optional(),message:p().optional()}),_c=M({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:W(["c++17","c++20","c++23"]).default("c++20"),optLevel:W(["-O0","-O1","-O2","-O3"]).default("-O2"),flags:N(p()).default(["-O2","-Wall","-Wextra"]),headers:w(p(),p()).optional(),extraHeaders:w(p(),p()).optional(),files:w(p(),p()).optional(),starterFiles:w(p(),p()).optional(),solutionFiles:w(p(),p()).optional(),onProgress:H({input:[F()],output:K()}).optional()}),Zd=M({stage:W(["downloading","caching","extracting","initializing","ready","error"]),loadedBytes:k().optional(),totalBytes:k().optional(),percent:k().optional(),message:p().optional()}),Od=M({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:N(p()).optional(),preloadPackages:N(p()).optional(),compilerMemoryLimitMb:k().optional(),files:w(p(),p()).optional(),starterFiles:w(p(),p()).optional(),solutionFiles:w(p(),p()).optional(),onProgress:H({input:[F()],output:K()}).optional()}),nl=W(["connecting","metadata","downloading","mounting","ready","error"]),Cd=M({phase:nl,message:p(),loaded:k().optional(),total:k().optional()}),Ed=M({intoRoot:D().default(!0),targetDir:p().default("/workspace"),branch:p().optional(),depth:k().int().positive().optional(),maxFiles:k().int().positive().default(2e3),maxFileSize:k().int().positive().default(5*1024*1024),concurrency:k().int().positive().default(8),clearExisting:D().default(!1),onProgress:H({input:[F()],output:K()}).optional(),fetchImpl:F().optional()}),Ad=M({files:w(p(),p()).optional(),entry:p().optional(),mode:W(["run","test","repl"]).default("run"),replCode:p().optional(),printReplResult:D().optional(),testFilter:de([p(),N(p()),Rn()]).optional(),timeoutMs:k().positive().default(3e4),maxOutputBytes:k().positive().default(256*1024),maxConsoleCalls:k().positive().default(5e3),instanceId:p().optional(),concurrent:D().optional(),argv:de([N(p()),Rn()]).optional(),pid:k().int().optional(),isBackground:D().optional(),vfs:F().optional(),activePortTable:F().optional(),packages:w(p(),F()).optional(),npmModules:w(p(),F()).optional(),onStdout:H({input:[p()],output:K()}).optional(),onStderr:H({input:[p()],output:K()}).optional(),onTestResult:H({input:[F()],output:K()}).optional()}),Id=M({version:k().default(1),timestamp:k().optional(),files:w(p(),p()),openTabs:N(p()).default([]),activeFile:p().nullable().optional(),mode:W(["guided","sandbox"]).optional(),lang:ke.optional(),labId:p().optional()}),Nd=M({id:p().optional(),labId:p().optional(),buildId:p().optional(),title:p().default("code-lab"),summary:p().optional(),theme:W(["dark","light","high-contrast","auto"]).default("auto"),persistState:D().default(!0),repo:p().optional(),githubRepo:p().optional(),branch:p().optional(),files:w(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:F().optional(),debug:D().optional(),onClose:H({input:[],output:K()}).optional(),onRun:H({input:[F()],output:K()}).optional(),onTestResult:H({input:[F()],output:K()}).optional(),onCodeChange:H({input:[p(),p()],output:K()}).optional(),plugins:N(F()).optional(),extensions:N(F()).optional(),steps:N(Dn).optional(),starterFiles:w(p(),p()).optional(),solutionFiles:w(p(),p()).optional(),tsFiles:w(p(),p()).optional(),tsStarterFiles:w(p(),p()).optional(),tsSolutionFiles:w(p(),p()).optional(),cppFiles:w(p(),p()).optional(),cppStarterFiles:w(p(),p()).optional(),cppSolutionFiles:w(p(),p()).optional(),pyFiles:w(p(),p()).optional(),pyStarterFiles:w(p(),p()).optional(),pySolutionFiles:w(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:F().optional(),mode:W(["guided","sandbox"]).optional(),language:ke.optional(),lang:ke.optional(),showLanguageSelector:D().optional(),sqlDialect:W(["postgres","sqlite"]).optional(),sqlFiles:w(p(),p()).optional(),settings:w(p(),F()).optional(),userSettings:w(p(),F()).optional(),defaultSettings:w(p(),F()).optional(),config:w(p(),F()).optional(),overrides:w(p(),F()).optional(),lockSettings:D().optional(),stepIndex:k().int().optional(),onStepComplete:H({input:[F(),k()],output:K()}).optional(),onLabComplete:H({input:[p()],output:K()}).optional()}),Rd=M({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:de([p(),N(p())]).optional(),exclude:p().optional(),excludeGlob:p().optional(),excludePattern:de([p(),N(p())]).optional(),maxMatches:k().int().positive().optional(),maxMatchesPerFile:k().int().positive().optional()}),rl=W(["error","warning","info","hint"]),Ld=M({id:p(),file:p(),line:k().int(),col:k().int().optional(),column:k().int().optional(),endLine:k().int().optional(),endCol:k().int().optional(),endColumn:k().int().optional(),message:p(),severity:rl,source:p().optional(),code:de([p(),k()]).optional(),tags:N(p()).optional()}),Dd=M({id:p(),name:p(),files:w(p(),p()),updatedAt:k(),createdAt:k().optional(),entry:p().optional(),testEntry:p().optional(),version:k().optional()}),ol=W(["modified","added","deleted","untracked"]),qe=M({path:p(),status:ol,staged:D(),oldContent:p().optional(),newContent:p().optional()}),Fd=M({branch:p().default("main"),headCommit:p().optional(),branches:N(p()).default(["main"]),staged:N(qe).default([]),unstaged:N(qe).default([]),untracked:N(qe).default([]),modified:N(qe).optional(),deleted:N(qe).optional(),hasChanges:D().default(!1),isClean:D().default(!0),ahead:k().int().default(0),behind:k().int().default(0)});var il={"/usr/include/bits/stdc++.h":`// CodeLab <bits/stdc++.h> \u2014 Competitive Programming & DSA Umbrella Header
57
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let a=e.external.registry.get(s[0])?.id;if(t!==s[0]&&a){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}c.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function ps(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!="object")return;ps(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var ds=new Set(["type","properties","required","additionalProperties"]),us=["oneOf","anyOf"];function ls(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Sn(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!ds.has(s))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let c=[];for(let a of t){let l=a.properties?.[s]??ls(a);l!=null&&(c.some(d=>JSON.stringify(d)===JSON.stringify(l))||c.push(l))}let u=c.length===1?c[0]:Sn(c)??{allOf:c};ee(n,s,u)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=ls(s);c&&!i.some(u=>JSON.stringify(u)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function Fa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of ds)if(o in e)return;let n=t.filter(o=>us.some(i=>Array.isArray(o[i]))),r=null;if(!n.length)r=Sn(t);else{let o=n[0],i=us.find(u=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let s=t.filter(u=>u!==o),c=o[i].map(u=>Sn([...s,u]));if(c.some(u=>!u))return;r={[i]:c}}r&&(delete e.allOf,Je(e,r))}function Pn(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=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){r(d);let m=e.seen.get(d),f=m.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(a.allOf=a.allOf??[],a.allOf.push(f)):Je(a,f),Je(a,l),c._zod.parent===d)for(let y in a)y==="$ref"||y==="allOf"||y in l||delete a[y];if(f.$ref&&m.def)for(let y in a)y==="$ref"||y==="allOf"||y in m.def&&JSON.stringify(a[y])===JSON.stringify(m.def[y])&&delete a[y]}let h=c._zod.parent;if(h&&h!==d){r(h);let m=e.seen.get(h);if(m?.schema.$ref&&(a.$ref=m.schema.$ref,m.def))for(let f in a)f==="$ref"||f==="allOf"||f in m.def&&JSON.stringify(a[f])===JSON.stringify(m.def[f])&&delete a[f]}e.override({zodSchema:c,jsonSchema:a,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())r(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())ps(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let u of e.seen.values())for(let a of[u.schema,u.def]){let l=a?.allOf;if(!Array.isArray(l))continue;let d=c.get(l);d?d.push(a):c.set(l,[a])}for(let u of e.intersections)for(let a of c.get(u)??[])Fa(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)}Je(o,n.defId?n.schema:n.def??n.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,ee(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:Ve(t,"input",e.processors),output:Ve(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function J(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return J(r.element,n);if(r.type==="set")return J(r.valueType,n);if(r.type==="lazy")return J(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return J(r.innerType,n);if(r.type==="intersection")return J(r.left,n)||J(r.right,n);if(r.type==="record"||r.type==="map")return J(r.keyType,n)||J(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:J(r.in,n)||J(r.out,n);if(r.type==="object"){for(let o in r.shape)if(J(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(J(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(J(o,n))return!0;return!!(r.rest&&J(r.rest,n))}return!1}var fs=(e,t={})=>n=>{let r=wn({...n,processors:t});return R(e,r),kn(r,e),Pn(r,e)},Ve=(e,t,n={})=>r=>{let{libraryOptions:o,target:i}=r??{},s=wn({...o??{},target:i,io:t,processors:n});return R(e,s),kn(s,e),Pn(s,e)};var Se=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},we=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},ms=(e,t)=>{Se(e,"minimum",t),we(e,"maximum",t)},_s=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},xs=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},bs=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},zs=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},hs=(e,t)=>Se(e,"minimum",t.minimum),gs=(e,t)=>we(e,"maximum",t.maximum),ys=e=>(t,n)=>{zs(t,n.format);let[r,o]=e[n.format];Se(t,"minimum",r),we(t,"maximum",o)},ja={greater_than:(e,t)=>Se(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>we(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>_s(e,t.value),number_format:ys(Ee),bigint_format:ys(et),min_length:hs,max_length:gs,length_equals:(e,t)=>ms(e,t.length),min_size:hs,max_size:gs,size_equals:(e,t)=>ms(e,t.size),string_format:(e,t)=>{zs(e,t.format),t.pattern&&xs(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>bs(e,t.mime)};function X(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)ja[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Se(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Se(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&we(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&we(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&_s(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&bs(t,o.mime);for(let i of o.patterns??[])xs(t,i);return t}var Ua={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ma=new Map([[on,Or],[ft,Cr]]),vs=e=>Ma.get(e)??e,$s=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:l}=X(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),c&&(o.format=Ua[c]??c,o.format===""&&delete o.format,(c==="time"||l)&&delete o.format),a&&(o.contentEncoding=a),u&&u.size>0){let d=[...u].map(vs);d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},Ss=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:a,isInt:l}=X(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),m=t.target==="draft-04"||t.target==="openapi-3.0";if(d?m?(o.minimum=a,o.exclusiveMinimum=!0):o.exclusiveMinimum=a:typeof i=="number"&&(o.minimum=i),h?m?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof s=="number"&&(o.maximum=s),c){let f=new Set;for(let b of c)Number.isFinite(b)&&b!==0?f.add(Math.abs(b)):ce(e,t,o,r,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[_,...y]=f;_!==void 0&&(o.multipleOf=_),y.length&&(o.allOf=[...o.allOf??[],...y.map(b=>({multipleOf:b}))])}},ws=(e,t,n,r)=>{n.type="boolean"};var ks=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"};var Ps=(e,t,n,r)=>{ce(e,t,n,r,"Void cannot be represented in JSON Schema")},Ts=(e,t,n,r)=>{n.not={}},Zs=(e,t,n,r)=>{},Os=(e,t,n,r)=>{};var Cs=(e,t,n,r)=>{let o=e._zod.def,i=xe(o.entries);if(i.length===0){n.not={};return}i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i};var Es=(e,t,n,r)=>{ce(e,t,n,r,"Custom types cannot be represented in JSON Schema")},As=(e,t,n,r)=>{ce(e,t,n,r,"Function types cannot be represented in JSON Schema")},Is=(e,t,n,r)=>{ce(e,t,n,r,"Transforms cannot be represented in JSON Schema")};var Ns=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:c}=X(e);typeof s=="number"&&(o.minItems=s),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=R(i.element,t,{...r,path:[...r.path,"items"]})};function Ke(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Ke(t.out):t.type==="catch"?Ke(t.innerType):e._zod.optin}var Rs=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&ce(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let a in s)ee(o.properties,a,R(s[a],t,{...r,path:[...r.path,"properties",a]}));let u=[];for(let a of Object.keys(s)){let l=i.shape[a];(t.io==="input"?Ke(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=R(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Ls=(e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>R(c,t,{...r,path:[...r.path,i?"oneOf":"anyOf",u]}));i?n.oneOf=s:n.anyOf=s},Ds=(e,t,n,r)=>{let o=e._zod.def,i=R(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=R(o.right,t,{...r,path:[...r.path,"allOf",1]}),c=a=>"allOf"in a&&Object.keys(a).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];n.allOf=u,t.intersections.push(u)},Fs=(e,t,n,r)=>{let o=n,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)=>R(_,t,{...r,path:[...r.path,s,y]})),a=i.rest?R(i.rest,t,{...r,path:[...r.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"?Ke(_)!==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:m,maximum:f}=X(e);typeof m=="number"&&(o.minItems=m),typeof f=="number"&&(o.maxItems=f)};function Tn(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let f=e.get(t)?.def;if(!f)return t;let _=Tn(e,f,n);return _===f?t:_}for(let f of["anyOf","oneOf"]){let _=t[f];if(!Array.isArray(_))continue;let y=_.map(b=>Tn(e,b,n));y.some((b,v)=>b!==_[v])&&(t={...t,[f]:y})}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some(f=>f==="number"||f==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(f=>typeof f=="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:u,exclusiveMaximum:a,multipleOf:l,format:d,id:h,...m}=t;return m.enum?m.enum=m.enum.map(f=>typeof f=="number"?String(f):f):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(r.includes("number")?De:Yt).source)),m}var Zn=new WeakMap;function Ba(e){let t=new Map;for(let r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);let n=new Map;for(let r of Zn.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Tn(t,i,new Set);s!==i&&n.set(i,s)}if(n.size)for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);i&&(o.propertyNames=i)}}var js=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,c=X(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=R(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)ee(o.patternProperties,vs(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=R(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=Zn.get(t);l||(l=[],Zn.set(t,l),t.deferred.push(()=>Ba(t))),l.push(e)}o.additionalProperties=R(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let u=s._zod.values,a=t.io==="input"&&Ke(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))}},Us=(e,t,n,r)=>{let o=e._zod.def,i=R(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Ms=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},On=Symbol();function Bs(e,t,n,r,o){let i=!1,s=JSON.stringify(e,(c,u)=>typeof u!="bigint"?u:(i=!0,null));return i?(ce(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),On):JSON.parse(s)}var Ws=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s=Bs(o.defaultValue,e,t,n,r);s!==On&&(n.default=s)},Js=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Bs(o.defaultValue,e,t,n,r);s!==On&&(n._prefault=s)},Vs=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{ce(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},Ks=(e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;R(s,t,r);let c=t.seen.get(e);c.ref=s},Hs=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0};var Cn=(e,t,n,r)=>{let o=e._zod.def;R(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType};var Gs=new WeakSet([Object.prototype,Error.prototype]);function $t(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var Xa=(e,t)=>{rr.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);Gs.has(n)||(Gs.add(n),$t(n,"format",r=>o=>ir(r,o)),$t(n,"flatten",r=>o=>or(r,o)),$t(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,be,2)}),$t(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,be,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var Y=g("ZodError",Xa,void 0,{Parent:Error});var qs=Re(Y),Xs=Le(Y),Ys=it(Y),Qs=st(Y),ec=cr(Y),tc=ar(Y),nc=ur(Y),rc=lr(Y),oc=pr(Y),ic=dr(Y),sc=fr(Y),cc=mr(Y);function Qa(){W.localeError||q(zi())}function He(){W.memoizer||q({memoizer:bi()})}var E=g("ZodType",(e,t)=>(Qa(),C.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(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return te(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(el(e,t))},superRefine(e,t){return this.check(tl(e,t))},overwrite(e){return this.check(pe(e))},optional(){return lc(this)},exactOptional(){return ju(this)},nullable(){return pc(this)},nullish(){return lc(pc(this))},nonoptional(e){return Vu(this,e)},array(){return N(this)},or(e){return de([this,e])},and(e){return Nu(this,e)},transform(e){return dc(this,Fu(e))},default(e){return Bu(this,e)},prefault(e){return Ju(this,e)},catch(e){return Hu(this,e)},pipe(e){return dc(this,e)},readonly(){return Xu(this)},describe(e){let t=this.clone();return he.add(t,{description:e}),t},meta(...e){if(e.length===0)return he.get(this);let t=this.clone();return he.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",{...rn(this),jsonSchema:{input:Ve(this,"input"),output:Ve(this,"output")}})},set"~standard"(e){w.own(this,"~standard",e)},parse:function e(t,n){return qs(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Xs(this,t,n,{callee:e})},safeParse(e,t){return Ys(this,e,t)},async safeParseAsync(e,t){return Qs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){w.own(this,"spa",e)},validate(e,t){return Ht(this,e,t)},validateAsync(e,t){return Gt(this,e,t)},encode:function e(t,n){return ec(this,t,n,{callee:e})},decode:function e(t,n){return tc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await nc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await rc(this,t,n,{callee:e})},safeEncode(e,t){return oc(this,e,t)},safeDecode(e,t){return ic(this,e,t)},async safeEncodeAsync(e,t){return sc(this,e,t)},async safeDecodeAsync(e,t){return cc(this,e,t)},toJSONSchema(e){return fs(this,{})(e)},get description(){return he.get(this)?.description},get _def(){return this._zod.def}}),fc=g("_ZodString",(e,t)=>{dt.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$s(e,n,r,o)},w.derived({format:e=>X(e).format??null,minLength:e=>X(e).minimum??null,maxLength:e=>X(e).maximum??null},{regex(...e){return this.check(fn(...e))},includes(...e){return this.check(gn(...e))},startsWith(...e){return this.check(yn(...e))},endsWith(...e){return this.check(_n(...e))},min(...e){return this.check($e(...e))},max(...e){return this.check(zt(...e))},length(...e){return this.check(vt(...e))},nonempty(...e){return this.check($e(1,...e))},lowercase(e){return this.check(mn(e))},uppercase(e){return this.check(hn(e))},trim(){return this.check(bn())},normalize(...e){return this.check(xn(...e))},toLowerCase(){return this.check(zn())},toUpperCase(){return this.check(vn())},slugify(){return this.check($n())}})),eu=g("ZodString",(e,t)=>{dt.init(e,t),fc.init(e,t)},{email(e){return this.check(wi(iu,e))},url(e){return this.check(Ci(cu,e))},jwt(e){return this.check(Vi(vu,e))},emoji(e){return this.check(Ei(au,e))},guid(e){return this.check(ki(su,e))},uuid(e){return this.check(Pi(St,e))},uuidv4(e){return this.check(Ti(St,e))},uuidv6(e){return this.check(Zi(St,e))},uuidv7(e){return this.check(Oi(St,e))},nanoid(e){return this.check(Ai(uu,e))},cuid(e){return this.check(Ii(lu,e))},cuid2(e){return this.check(Ni(pu,e))},ulid(e){return this.check(Ri(du,e))},base64(e){return this.check(Bi(xu,e))},base64url(e){return this.check(Wi(bu,e))},xid(e){return this.check(Li(fu,e))},ksuid(e){return this.check(Di(mu,e))},ipv4(e){return this.check(Fi(hu,e))},ipv6(e){return this.check(ji(gu,e))},cidrv4(e){return this.check(Ui(yu,e))},cidrv6(e){return this.check(Mi(_u,e))},e164(e){return this.check(Ji(zu,e))},datetime(e){return this.check(Ki(tu,e))},date(e){return this.check(Hi(nu,e))},time(e){return this.check(Gi(ru,e))},duration(e){return this.check(qi(ou,e))}});function p(e){return Si(eu,e)}var L=g("ZodStringFormat",(e,t)=>{A.init(e,t),fc.init(e,t)}),tu=g("ZodISODateTime",(e,t)=>{Co.init(e,t),L.init(e,t)}),nu=g("ZodISODate",(e,t)=>{Eo.init(e,t),L.init(e,t)}),ru=g("ZodISOTime",(e,t)=>{Ao.init(e,t),L.init(e,t)}),ou=g("ZodISODuration",(e,t)=>{Io.init(e,t),L.init(e,t)}),iu=g("ZodEmail",(e,t)=>{bo.init(e,t),L.init(e,t)});var su=g("ZodGUID",(e,t)=>{_o.init(e,t),L.init(e,t)});var St=g("ZodUUID",(e,t)=>{xo.init(e,t),L.init(e,t)});var cu=g("ZodURL",(e,t)=>{$o.init(e,t),L.init(e,t)});var au=g("ZodEmoji",(e,t)=>{So.init(e,t),L.init(e,t)});var uu=g("ZodNanoID",(e,t)=>{wo.init(e,t),L.init(e,t)});var lu=g("ZodCUID",(e,t)=>{ko.init(e,t),L.init(e,t)});var pu=g("ZodCUID2",(e,t)=>{Po.init(e,t),L.init(e,t)});var du=g("ZodULID",(e,t)=>{To.init(e,t),L.init(e,t)});var fu=g("ZodXID",(e,t)=>{Zo.init(e,t),L.init(e,t)});var mu=g("ZodKSUID",(e,t)=>{Oo.init(e,t),L.init(e,t)});var hu=g("ZodIPv4",(e,t)=>{No.init(e,t),L.init(e,t)});var gu=g("ZodIPv6",(e,t)=>{Lo.init(e,t),L.init(e,t)});var yu=g("ZodCIDRv4",(e,t)=>{Do.init(e,t),L.init(e,t)});var _u=g("ZodCIDRv6",(e,t)=>{Fo.init(e,t),L.init(e,t)});var xu=g("ZodBase64",(e,t)=>{Uo.init(e,t),L.init(e,t)});var bu=g("ZodBase64URL",(e,t)=>{Mo.init(e,t),L.init(e,t)});var zu=g("ZodE164",(e,t)=>{Bo.init(e,t),L.init(e,t)});var vu=g("ZodJWT",(e,t)=>{Wo.init(e,t),L.init(e,t)});var mc=g("ZodNumber",(e,t)=>{sn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ss(e,n,r,o),e.isFinite=!0},w.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=X(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=X(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=X(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>X(e).format??null},{gt(e,t){return this.check(xt(e,t))},gte(e,t){return this.check(We(e,t))},min(e,t){return this.check(We(e,t))},lt(e,t){return this.check(_t(e,t))},lte(e,t){return this.check(Be(e,t))},max(e,t){return this.check(Be(e,t))},int(e){return this.check(ac(e))},safe(e){return this.check(ac(e))},positive(e){return this.check(xt(0,e))},nonnegative(e){return this.check(We(0,e))},negative(e){return this.check(_t(0,e))},nonpositive(e){return this.check(Be(0,e))},multipleOf(e,t){return this.check(bt(e,t))},step(e,t){return this.check(bt(e,t))},finite(){return this}}));function T(e){return Xi(mc,e)}var $u=g("ZodNumberFormat",(e,t)=>{Jo.init(e,t),mc.init(e,t)});function ac(e){return Yi($u,e)}var Su=g("ZodBoolean",(e,t)=>{Vo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ws(e,n,r,o)});function D(e){return Qi(Su,e)}var wu=g("ZodNull",(e,t)=>{Ko.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ks(e,n,r,o)});function In(e){return es(wu,e)}var ku=g("ZodAny",(e,t)=>{Ho.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zs(e,n,r,o)});function F(){return ts(ku)}var Pu=g("ZodUnknown",(e,t)=>{Go.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Os(e,n,r,o)});function wt(){return ns(Pu)}var Tu=g("ZodNever",(e,t)=>{qo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ts(e,n,r,o)});function Zu(e){return rs(Tu,e)}var Ou=g("ZodVoid",(e,t)=>{Xo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ps(e,n,r,o)});function V(e){return os(Ou,e)}var Cu=g("ZodArray",(e,t)=>{He(),Yo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ns(e,n,r,o),e.element=t.element},{min(e,t){return this.check($e(e,t))},nonempty(e){return this.check($e(1,e))},max(e,t){return this.check(zt(e,t))},length(e,t){return this.check(vt(e,t))},unwrap(){return this.element}});function N(e,t){return is(Cu,e,t)}var Eu=g("ZodObject",(e,t)=>{He(),ti.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rs(e,n,r,o),w.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return B(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:wt()}))},loose(){return this.clone(w.mergeDefs(this._zod.def,{catchall:wt()}))},strict(){return this.clone(w.mergeDefs(this._zod.def,{catchall:Zu()}))},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(Nn,this,e[0])},exactPartial(...e){return w.partial(hc,this,e[0],"exactPartial")},required(...e){return w.required(gc,this,e[0])}});function j(e,t){let n={type:"object",shape:e??{},...w.normalizeParams(t)};return new Eu(n)}var Au=g("ZodUnion",(e,t)=>{ni.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ls(e,n,r,o),e.options=t.options});function de(e,t){return new Au({type:"union",options:e,...w.normalizeParams(t)})}var Iu=g("ZodIntersection",(e,t)=>{ri.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ds(e,n,r,o)});function Nu(e,t){return new Iu({type:"intersection",left:e,right:t})}var Ru=g("ZodTuple",(e,t)=>{He(),cn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fs(e,n,r,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 Nn({type:"optional",innerType:t}))})}});function Lu(e,t,n){let r=t instanceof C,o=r?n:t,i=r?t:null;return new Ru({type:"tuple",items:e,rest:i,...w.normalizeParams(o)})}var uc=g("ZodRecord",(e,t)=>{He(),oi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>js(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function k(e,t,n){return!t||!t._zod?new uc({type:"record",keyType:p(),valueType:e,...w.normalizeParams(t)}):new uc({type:"record",keyType:e,valueType:t,...w.normalizeParams(n)})}var An=g("ZodEnum",(e,t)=>{ii.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Cs(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new An({...t,checks:[],...w.normalizeParams(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new An({...t,checks:[],...w.normalizeParams(o),entries:i})}});function B(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new An({type:"enum",entries:n,...w.normalizeParams(t)})}var Du=g("ZodTransform",(e,t)=>{He(),si.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Is(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ve(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(w.issue(i,n.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(w.issue(s))}};let o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Fu(e){return new Du({type:"transform",transform:e})}var Nn=g("ZodOptional",(e,t)=>{an.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cn(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lc(e){return new Nn({type:"optional",innerType:e})}var hc=g("ZodExactOptional",(e,t)=>{ci.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cn(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ju(e){return new hc({type:"optional",innerType:e})}var Uu=g("ZodNullable",(e,t)=>{ai.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Us(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new Uu({type:"nullable",innerType:e})}var Mu=g("ZodDefault",(e,t)=>{ui.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ws(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Bu(e,t){return new Mu({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var Wu=g("ZodPrefault",(e,t)=>{li.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Js(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ju(e,t){return new Wu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var gc=g("ZodNonOptional",(e,t)=>{pi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ms(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Vu(e,t){return new gc({type:"nonoptional",innerType:e,...w.normalizeParams(t)})}var Ku=g("ZodCatch",(e,t)=>{di.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Hu(e,t){return new Ku({type:"catch",innerType:e,catchValue:typeof t=="function"?t:w.constantCatch(t)})}var Gu=g("ZodPipe",(e,t)=>{fi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ks(e,n,r,o),e.in=t.in,e.out=t.out});function dc(e,t){return new Gu({type:"pipe",in:e,out:t})}var qu=g("ZodReadonly",(e,t)=>{mi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Xu(e){return new qu({type:"readonly",innerType:e})}var Yu=g("ZodFunction",(e,t)=>{hi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>As(e,n,r,o)});function K(e){return new Yu({type:"function",input:Array.isArray(e?.input)?Lu(e?.input):e?.input??N(wt()),output:e?.output??wt()})}var Qu=g("ZodCustom",(e,t)=>{gi.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Es(e,n,r,o)});function el(e,t={}){return ss(Qu,e,t)}function tl(e,t){return cs(e,t)}var Rn=j({id:p().min(1),title:p().min(1),concept:p().optional(),targetFile:p().optional(),targetSymbol:p().optional(),symbol:p().optional(),instructions:de([p(),N(p())]),hint:p().optional(),testNames:N(p()).optional()}),ke=B(["js","ts","cpp","py","sql"]);var kd=j({language:ke.default("js"),files:k(p(),p()).default({}),starterFiles:k(p(),p()).optional(),solutionFiles:k(p(),p()).optional(),entry:p().optional(),testEntry:p().optional()}),Pd=j({steps:N(Rn).default([]),stepIndex:T().int().nonnegative().default(0),mode:B(["guided","sandbox"]).default("guided"),language:ke.optional(),lang:ke.optional(),starterFiles:k(p(),p()).optional(),solutionFiles:k(p(),p()).optional(),tsStarterFiles:k(p(),p()).optional(),tsSolutionFiles:k(p(),p()).optional(),tsFiles:k(p(),p()).optional(),cppStarterFiles:k(p(),p()).optional(),cppSolutionFiles:k(p(),p()).optional(),cppFiles:k(p(),p()).optional(),pyStarterFiles:k(p(),p()).optional(),pySolutionFiles:k(p(),p()).optional(),pyFiles:k(p(),p()).optional(),pyEntry:p().optional(),pyTestEntry:p().optional(),pyTestCode:p().optional(),summary:p().optional(),onStepComplete:K({input:[Rn,T()],output:V()}).optional(),onLabComplete:K({input:[p()],output:V()}).optional()}),Td=j({stage:B(["downloading","caching","extracting","compiling","linking","ready","error"]),loadedBytes:T().optional(),totalBytes:T().optional(),percent:T().optional(),message:p().optional()}),yc=j({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:B(["c++17","c++20","c++23"]).default("c++20"),optLevel:B(["-O0","-O1","-O2","-O3"]).default("-O2"),flags:N(p()).default(["-O2","-Wall","-Wextra"]),headers:k(p(),p()).optional(),extraHeaders:k(p(),p()).optional(),files:k(p(),p()).optional(),starterFiles:k(p(),p()).optional(),solutionFiles:k(p(),p()).optional(),onProgress:K({input:[F()],output:V()}).optional()}),Zd=j({stage:B(["downloading","caching","extracting","initializing","ready","error"]),loadedBytes:T().optional(),totalBytes:T().optional(),percent:T().optional(),message:p().optional()}),Od=j({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:N(p()).optional(),preloadPackages:N(p()).optional(),compilerMemoryLimitMb:T().optional(),files:k(p(),p()).optional(),starterFiles:k(p(),p()).optional(),solutionFiles:k(p(),p()).optional(),onProgress:K({input:[F()],output:V()}).optional()}),nl=B(["connecting","metadata","downloading","mounting","ready","error"]),Cd=j({phase:nl,message:p(),loaded:T().optional(),total:T().optional()}),Ed=j({intoRoot:D().default(!0),targetDir:p().default("/workspace"),branch:p().optional(),depth:T().int().positive().optional(),maxFiles:T().int().positive().default(2e3),maxFileSize:T().int().positive().default(5*1024*1024),concurrency:T().int().positive().default(8),clearExisting:D().default(!1),onProgress:K({input:[F()],output:V()}).optional(),fetchImpl:F().optional()}),Ad=j({files:k(p(),p()).optional(),entry:p().optional(),mode:B(["run","test","repl"]).default("run"),replCode:p().optional(),printReplResult:D().optional(),testFilter:de([p(),N(p()),In()]).optional(),timeoutMs:T().positive().default(3e4),maxOutputBytes:T().positive().default(256*1024),maxConsoleCalls:T().positive().default(5e3),instanceId:p().optional(),concurrent:D().optional(),argv:de([N(p()),In()]).optional(),pid:T().int().optional(),isBackground:D().optional(),vfs:F().optional(),activePortTable:F().optional(),packages:k(p(),F()).optional(),npmModules:k(p(),F()).optional(),onStdout:K({input:[p()],output:V()}).optional(),onStderr:K({input:[p()],output:V()}).optional(),onTestResult:K({input:[F()],output:V()}).optional()}),Id=j({version:T().default(1),timestamp:T().optional(),files:k(p(),p()),openTabs:N(p()).default([]),activeFile:p().nullable().optional(),mode:B(["guided","sandbox"]).optional(),lang:ke.optional(),labId:p().optional()}),Nd=j({id:p().optional(),labId:p().optional(),buildId:p().optional(),title:p().default("code-lab"),summary:p().optional(),theme:B(["dark","light","high-contrast","auto"]).default("auto"),persistState:D().default(!0),repo:p().optional(),githubRepo:p().optional(),branch:p().optional(),files:k(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:F().optional(),debug:D().optional(),onClose:K({input:[],output:V()}).optional(),onRun:K({input:[F()],output:V()}).optional(),onTestResult:K({input:[F()],output:V()}).optional(),onCodeChange:K({input:[p(),p()],output:V()}).optional(),plugins:N(F()).optional(),extensions:N(F()).optional(),steps:N(Rn).optional(),starterFiles:k(p(),p()).optional(),solutionFiles:k(p(),p()).optional(),tsFiles:k(p(),p()).optional(),tsStarterFiles:k(p(),p()).optional(),tsSolutionFiles:k(p(),p()).optional(),cppFiles:k(p(),p()).optional(),cppStarterFiles:k(p(),p()).optional(),cppSolutionFiles:k(p(),p()).optional(),pyFiles:k(p(),p()).optional(),pyStarterFiles:k(p(),p()).optional(),pySolutionFiles:k(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:F().optional(),mode:B(["guided","sandbox"]).optional(),language:ke.optional(),lang:ke.optional(),showLanguageSelector:D().optional(),sqlDialect:B(["postgres","sqlite"]).optional(),sqlFiles:k(p(),p()).optional(),settings:k(p(),F()).optional(),userSettings:k(p(),F()).optional(),defaultSettings:k(p(),F()).optional(),config:k(p(),F()).optional(),overrides:k(p(),F()).optional(),lockSettings:D().optional(),stepIndex:T().int().optional(),onStepComplete:K({input:[F(),T()],output:V()}).optional(),onLabComplete:K({input:[p()],output:V()}).optional()}),Rd=j({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:de([p(),N(p())]).optional(),exclude:p().optional(),excludeGlob:p().optional(),excludePattern:de([p(),N(p())]).optional(),maxMatches:T().int().positive().optional(),maxMatchesPerFile:T().int().positive().optional()}),rl=B(["error","warning","info","hint"]),Ld=j({id:p(),file:p(),line:T().int(),col:T().int().optional(),column:T().int().optional(),endLine:T().int().optional(),endCol:T().int().optional(),endColumn:T().int().optional(),message:p(),severity:rl,source:p().optional(),code:de([p(),T()]).optional(),tags:N(p()).optional()}),Dd=j({id:p(),name:p(),files:k(p(),p()),updatedAt:T(),createdAt:T().optional(),entry:p().optional(),testEntry:p().optional(),version:T().optional()}),ol=B(["modified","added","deleted","untracked"]),Ge=j({path:p(),status:ol,staged:D(),oldContent:p().optional(),newContent:p().optional()}),Fd=j({branch:p().default("main"),headCommit:p().optional(),branches:N(p()).default(["main"]),staged:N(Ge).default([]),unstaged:N(Ge).default([]),untracked:N(Ge).default([]),modified:N(Ge).optional(),deleted:N(Ge).optional(),hasChanges:D().default(!1),isClean:D().default(!0),ahead:T().int().default(0),behind:T().int().default(0)});var il={"/usr/include/bits/stdc++.h":`// CodeLab <bits/stdc++.h> \u2014 Competitive Programming & DSA Umbrella Header
58
58
  #pragma once
59
59
  #include <iostream>
60
60
  #include <iomanip>
@@ -353,17 +353,17 @@ inline void assertBool(bool cond, bool expected, const char* expr, int line) {
353
353
  #define ASSERT_TRUE(cond) ::codelab::testing::assertBool(static_cast<bool>(cond), true, #cond, __LINE__)
354
354
  #define ASSERT_FALSE(cond) ::codelab::testing::assertBool(static_cast<bool>(cond), false, #cond, __LINE__)
355
355
  #define CODELAB_TEST_EXIT_CODE() (::codelab::testing::failedCount() > 0 ? 1 : 0)
356
- `},sl="codelab_cpp_toolchain_v1",Te="assets",Tt=new Map;function vc(){return typeof indexedDB>"u"?Promise.resolve(null):new Promise(e=>{try{let t=indexedDB.open(sl,1);t.onupgradeneeded=()=>{let n=t.result;n.objectStoreNames.contains(Te)||n.createObjectStore(Te)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch(t){t&&e(null)}})}async function cl(e){let t=Tt.get(e);if(t)return t;let n=await vc();return n?new Promise(r=>{let o=()=>{try{n.close()}catch(i){}};try{let c=n.transaction(Te,"readonly").objectStore(Te).get(e);c.onsuccess=()=>{let u=c.result;if(o(),u instanceof Uint8Array)Tt.set(e,u),r(u);else if(u instanceof ArrayBuffer){let a=new Uint8Array(u);Tt.set(e,a),r(a)}else r(null)},c.onerror=()=>{o(),r(null)}}catch(i){o(),i&&r(null)}}):null}async function al(e,t){Tt.set(e,t);let n=await vc();if(n)return new Promise(r=>{let o=()=>{try{n.close()}catch(i){}};try{let i=n.transaction(Te,"readwrite");i.objectStore(Te).put(t,e),i.oncomplete=()=>{o(),r()},i.onerror=()=>{o(),r()}}catch(i){o(),i&&r()}})}function ul(e,t,n="/"){let r=[],o=new TextDecoder("utf-8"),i=0,s=(c,u)=>{let a=c,l=Math.min(e.length,c+u);for(;a<l&&e[a]!==0;)a++;return o.decode(e.subarray(c,a)).trim()};for(;i+512<=e.length;){let c=s(i,100);if(!c){i+=512;continue}let u=s(i+124,12),a=Math.max(0,parseInt(u||"0",8)||0),l=e[i+156],d=s(i+345,155),m=d?`${d}/${c}`:c,f=m.replace(/^\.?\/+/,"").split("/").filter(Boolean),y=f.some(x=>x===".."),_=y?"":f.filter(x=>x!==".").join("/"),b=`${n==="/"?"":n.replace(/\/+$/,"")}/${_}`,T=i+512,Z=Math.min(e.length,T+a);if(_&&!y){if(l===53||m.endsWith("/"))t.existsSync(b)||t.mkdirSync(b,{recursive:!0});else if(l===0||l===48){let x=b.slice(0,b.lastIndexOf("/"))||"/";t.existsSync(x)||t.mkdirSync(x,{recursive:!0});let P=e.slice(T,Z);t.writeFileSync(b,P),r.push(b)}}let z=Math.ceil(a/512);i=T+z*512}return r}function Wd(e){let t=new TextEncoder,n=[];for(let[s,c]of Object.entries(e)){let u=s.replace(/^\/+/,""),a=typeof c=="string"?t.encode(c):c,l=new Uint8Array(512),d=(f,y,_)=>{let v=t.encode(f);l.set(v.subarray(0,Math.min(v.length,_)),y)};d(u,0,100),d("0000644\0",100,8),d("0000000\0",108,8),d("0000000\0",116,8),d(a.byteLength.toString(8).padStart(11,"0")+"\0",124,12),d(Math.floor(Date.now()/1e3).toString(8).padStart(11,"0")+"\0",136,12);for(let f=148;f<156;f++)l[f]=32;l[156]=48,d("ustar\0",257,6),d("00",263,2);let m=0;for(let f=0;f<512;f++)m+=l[f];d(m.toString(8).padStart(6,"0")+"\0 ",148,8),n.push(l),n.push(a);let h=a.byteLength%512;h!==0&&n.push(new Uint8Array(512-h))}n.push(new Uint8Array(1024));let r=n.reduce((s,c)=>s+c.byteLength,0),o=new Uint8Array(r),i=0;for(let s of n)o.set(s,i),i+=s.byteLength;return o}function jn(e,t){if(!e)return;let n={...il,...t||{}};for(let[r,o]of Object.entries(n)){let i=r.startsWith("/")?r:`/usr/include/${r}`,s=i.slice(0,i.lastIndexOf("/"))||"/";e.existsSync(s)||e.mkdirSync(s,{recursive:!0}),e.writeFileSync(i,o)}e.existsSync("/tmp")||e.mkdirSync("/tmp",{recursive:!0}),e.existsSync("/usr/lib/wasm32-wasi")||e.mkdirSync("/usr/lib/wasm32-wasi",{recursive:!0})}var Jd="https://cdn.jsdelivr.net/npm/@yowasp/clang";function Zt(e){let t=[],n=e>>>0;do{let r=n&127;n>>>=7,n!==0&&(r|=128),t.push(r)}while(n!==0);return t}function U(e){let t=[],n=e|0,r=!0;for(;r;){let o=n&127;n>>=7,n===0&&(o&64)===0||n===-1&&(o&64)!==0?r=!1:o|=128,t.push(o)}return t}function Pe(e){let t=Array.from(new TextEncoder().encode(e));return[...Zt(t.length),...t]}function ge(e,t){return[e,...Zt(t.length),...t]}function ll(e,t=0,n=""){let r=Array.from(new TextEncoder().encode(e)),o=Array.from(new TextEncoder().encode(n)),i=ge(1,[3,96,4,127,127,127,127,1,127,96,1,127,0,96,0,0]),s=ge(2,[2,...Pe("wasi_snapshot_preview1"),...Pe("fd_write"),0,0,...Pe("wasi_snapshot_preview1"),...Pe("proc_exit"),0,1]),c=ge(3,[1,2]),u=ge(5,[1,0,1]),a=ge(7,[2,...Pe("memory"),2,0,...Pe("_start"),0,2]),l=[0,65,...U(0),65,...U(64),54,2,0,65,...U(4),65,...U(r.length),54,2,0,65,...U(1),65,...U(0),65,...U(1),65,...U(16),16,0,26];o.length>0&&l.push(65,...U(8),65,...U(64+r.length),54,2,0,65,...U(12),65,...U(o.length),54,2,0,65,...U(2),65,...U(8),65,...U(1),65,...U(16),16,0,26),t!==0&&l.push(65,...U(t),16,1),l.push(11);let d=ge(10,[1,...Zt(l.length),...l]),m=[...r,...o],h=ge(11,[1,0,65,...U(64),11,...Zt(m.length),...m]);return new Uint8Array([0,97,115,109,1,0,0,0,...i,...s,...c,...u,...a,...d,...h])}var Ot=class{options;clangWasm=null;lldWasm=null;sysrootTar=null;nativeToolchainUnavailable=!1;loadError=null;_loadingPromise=null;constructor(t={}){let n=_c.parse(t);this.options={...n,...t},t.clangWasm&&(this.clangWasm=t.clangWasm),t.lldWasm&&(this.lldWasm=t.lldWasm),t.sysrootTar&&(this.sysrootTar=t.sysrootTar)}_emitProgress(t){typeof this.options.onProgress=="function"&&this.options.onProgress(t)}async _fetchAssetWithProgress(t,n,r){if(this.options.cacheInIndexedDB!==!1){let c=await cl(n);if(c)return this._emitProgress({stage:"caching",loadedBytes:c.byteLength,totalBytes:c.byteLength,percent:100,message:`Loaded ${r} from IndexedDB cache`}),c}if(typeof fetch!="function")throw new Error(`Cannot download ${r}: global fetch is unavailable.`);let o=await fetch(t);if(!o.ok)throw new Error(`Failed to download ${r} from ${t} (HTTP ${o.status})`);let i=Number(o.headers.get("content-length")||0)||12*1024*1024,s;if(o.body&&typeof o.body.getReader=="function"){let c=o.body.getReader(),u=[],a=0;for(;;){let{done:d,value:m}=await c.read();if(d)break;if(m){u.push(m),a+=m.byteLength;let h=Math.min(99,Math.round(a/Math.max(i,a)*100));this._emitProgress({stage:"downloading",loadedBytes:a,totalBytes:Math.max(i,a),percent:h,message:`Downloading ${r} (${(a/(1024*1024)).toFixed(1)} MB)...`})}}s=new Uint8Array(a);let l=0;for(let d of u)s.set(d,l),l+=d.byteLength}else{let c=await o.arrayBuffer();s=new Uint8Array(c)}return this.options.cacheInIndexedDB!==!1&&await al(n,s),s}async ensureLoaded(){if(!(this.clangWasm&&this.lldWasm&&this.sysrootTar))return this._loadingPromise?this._loadingPromise:(this._loadingPromise=(async()=>{try{let t=(this.options.toolchainUrl||"https://cdn.jsdelivr.net/npm/@yowasp/clang").replace(/\/+$/,""),n=this.options.clangUrl||`${t}/clang.wasm`,r=this.options.lldUrl||`${t}/lld.wasm`,o=this.options.sysrootUrl||`${t}/sysroot.tar`;this.sysrootTar||(this.sysrootTar=await this._fetchAssetWithProgress(o,`sysroot:${o}`,"WASI C++20 Sysroot (libc + libc++)")),this.clangWasm||(this.clangWasm=await this._fetchAssetWithProgress(n,`clang:${n}`,"Clang C++20 WebAssembly Compiler (clang.wasm)")),this.lldWasm||(this.lldWasm=await this._fetchAssetWithProgress(r,`lld:${r}`,"LLD WebAssembly Linker (lld.wasm)")),this.nativeToolchainUnavailable=!1,this.loadError=null,this._emitProgress({stage:"ready",loadedBytes:(this.clangWasm?.byteLength||0)+(this.lldWasm?.byteLength||0)+(this.sysrootTar?.byteLength||0),totalBytes:(this.clangWasm?.byteLength||0)+(this.lldWasm?.byteLength||0)+(this.sysrootTar?.byteLength||0),percent:100,message:"C++20 WebAssembly Toolchain Ready"})}catch(t){this.nativeToolchainUnavailable=!0,this.loadError=t,this._emitProgress({stage:"error",loadedBytes:0,totalBytes:0,percent:0,message:`Remote C++20 WASI assets unavailable (${t.message}). Using virtual C++ executor.`})}finally{this._loadingPromise=null}})(),this._loadingPromise)}prepareVfs(t){t&&(this.sysrootTar&&!t.existsSync("/usr/include/.sysroot_extracted")&&(ul(this.sysrootTar,t,"/"),t.existsSync("/usr/include")||t.mkdirSync("/usr/include",{recursive:!0}),t.writeFileSync("/usr/include/.sysroot_extracted","1")),jn(t,this.options.extraHeaders))}async compile(t){let n=t.vfs,r=t.outputPath||"/workspace/a.out",o=t.std||this.options.std||"c++20",i=t.optLevel||this.options.optLevel||"-O2",c=(t.sourceFiles&&t.sourceFiles.length>0?t.sourceFiles:t.entry?[t.entry]:["/workspace/src/main.cpp"]).map(x=>x.startsWith("/")?x:`/workspace/${x.replace(/^\/+/,"")}`);for(let x of c)if(!n.existsSync(x)){let P=`clang++: error: no such file or directory: '${x}'
357
- `;return t.onStderr&&t.onStderr(P),{ok:!1,exitCode:1,wasmBinary:null,outputPath:r,stdout:"",stderr:P}}if(jn(n,this.options.extraHeaders),typeof this.options.compilerHook=="function")return this.options.compilerHook({...t,sourceFiles:c,outputPath:r,std:o,optLevel:i});if(await this.ensureLoaded(),this.nativeToolchainUnavailable||!this.clangWasm||!this.lldWasm)return this._compileVirtualFallback(t,c,r,o,i);this.prepareVfs(n);let u=typeof globalThis<"u"&&globalThis.CodeLabRuntime||typeof window<"u"&&window.CodeLabRuntime;if(!u||typeof u.executeWasiModule!="function")throw new Error("CodeLabRuntime.executeWasiModule is unavailable.");let a="",l="",d=x=>{a+=x,t.onStdout&&t.onStdout(x)},m=x=>{l+=x,t.onStderr&&t.onStderr(x)};this._emitProgress({stage:"compiling",loadedBytes:100,totalBytes:100,percent:100,message:`Compiling ${c.map(x=>x.split("/").pop()).join(", ")} with Clang (${o}, ${i})...`});let h=`/tmp/build_${Date.now()}_${Math.random().toString(36).slice(2,6)}`;n.existsSync(h)||n.mkdirSync(h,{recursive:!0});let f=()=>{try{typeof n.rmSync=="function"&&n.rmSync(h,{recursive:!0,force:!0})}catch(x){}},y=[];for(let x=0;x<c.length;x++){let P=c[x],I=`${h}/obj_${x}.o`;y.push(I);let j=["clang++","-cc1","-triple","wasm32-unknown-wasi","-emit-obj",`-std=${o}`,i,"-isysroot","/usr","-internal-isystem","/usr/include/c++/v1","-internal-isystem","/usr/include","-I","/usr/include","-I","/workspace","-I","/workspace/src",...t.extraFlags||[],"-o",I,P],oe=await u.executeWasiModule(this.clangWasm,{vfs:n,args:j,env:{PATH:"/usr/bin:/bin",TMPDIR:"/tmp"},onStdout:d,onStderr:m});if(oe.exitCode!==0)return f(),{ok:!1,exitCode:oe.exitCode,wasmBinary:null,outputPath:r,stdout:a,stderr:l}}this._emitProgress({stage:"linking",loadedBytes:100,totalBytes:100,percent:100,message:`Linking ${r.split("/").pop()} with wasm-ld...`});let _="/usr/lib/wasm32-wasi/crt1.o",b=["wasm-ld","--no-threads","--export-dynamic","-L/usr/lib/wasm32-wasi",...n.existsSync(_)?[_]:[],...y,"-lc++","-lc++abi","-lc","-o",r],T=await u.executeWasiModule(this.lldWasm,{vfs:n,args:b,env:{PATH:"/usr/bin:/bin",TMPDIR:"/tmp"},onStdout:d,onStderr:m});if(f(),T.exitCode!==0||!n.existsSync(r))return{ok:!1,exitCode:T.exitCode||1,wasmBinary:null,outputPath:r,stdout:a,stderr:l||`wasm-ld: error: failed to produce output binary
358
- `};let Z=n.readFileSync(r),z=Z instanceof Uint8Array?new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength):new Uint8Array(Z);return this._emitProgress({stage:"ready",loadedBytes:100,totalBytes:100,percent:100,message:"C++20 WebAssembly Toolchain Ready"}),{ok:!0,exitCode:0,wasmBinary:z,outputPath:r,stdout:a,stderr:l}}async _compileVirtualFallback(t,n,r,o,i){let s=t.vfs,c="",u="",a=b=>{c+=b,t.onStdout&&t.onStdout(b)},l=b=>{u+=b,t.onStderr&&t.onStderr(b)},d=this.loadError&&this.loadError.message?this.loadError.message:"WASI Clang/LLD binaries not loaded";l(`clang++: warning: native WASI toolchain unavailable (${d}); using limited offline C++ fallback.
359
- `);let m=b=>{let T=0,Z=0,z=0,x=b.length;for(;z<x;){let P=b[z],I=b[z+1];if(P==="/"&&I==="/"){for(z+=2;z<x&&b[z]!==`
360
- `;)z++;continue}if(P==="/"&&I==="*"){for(z+=2;z<x&&!(b[z]==="*"&&b[z+1]==="/");)z++;z+=2;continue}if(P==="R"&&I==='"'){let j=b.indexOf("(",z+2);if(j!==-1){let Ze=`)${b.slice(z+2,j)}"`,Ye=b.indexOf(Ze,j+1);z=Ye!==-1?Ye+Ze.length:x;continue}}if(P==='"'||P==="'"){let j=P;for(z++;z<x&&b[z]!==j;)b[z]==="\\"?z+=2:z++;z++;continue}P==="{"?T++:P==="}"?T--:P==="("?Z++:P===")"&&Z--,z++}return{braceCount:T,parenCount:Z}},h=!0;for(let b of n){let T=s.readFileSync(b,"utf8"),{braceCount:Z,parenCount:z}=m(T);if(Z!==0||z!==0){let x=`clang++: error: syntax error in '${b}': unmatched ${Z!==0?"curly braces":"parentheses"}
361
- `;l(x),h=!1}}if(!h)return{ok:!1,exitCode:1,wasmBinary:null,outputPath:r,stdout:c,stderr:u};let f=s.readFileSync(n[0],"utf8"),y="",_=f.match(/std::cout\s*<<\s*("[^"]*")/g);if(_&&_.length>0){let b=_.map(T=>{let Z=T.match(/"([^"]*)"/);return Z?Z[1].replace(/\\n/g,`
362
- `).replace(/\\t/g," "):""}).join("");y=b?b.endsWith(`
363
- `)?b:b+`
356
+ `},sl="codelab_cpp_toolchain_v1",Te="assets",kt=new Map;function zc(){return typeof indexedDB>"u"?Promise.resolve(null):new Promise(e=>{try{let t=indexedDB.open(sl,1);t.onupgradeneeded=()=>{let n=t.result;n.objectStoreNames.contains(Te)||n.createObjectStore(Te)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch(t){t&&e(null)}})}async function cl(e){let t=kt.get(e);if(t)return t;let n=await zc();return n?new Promise(r=>{let o=()=>{try{n.close()}catch(i){}};try{let c=n.transaction(Te,"readonly").objectStore(Te).get(e);c.onsuccess=()=>{let u=c.result;if(o(),u instanceof Uint8Array)kt.set(e,u),r(u);else if(u instanceof ArrayBuffer){let a=new Uint8Array(u);kt.set(e,a),r(a)}else r(null)},c.onerror=()=>{o(),r(null)}}catch(i){o(),i&&r(null)}}):null}async function al(e,t){kt.set(e,t);let n=await zc();if(n)return new Promise(r=>{let o=()=>{try{n.close()}catch(i){}};try{let i=n.transaction(Te,"readwrite");i.objectStore(Te).put(t,e),i.oncomplete=()=>{o(),r()},i.onerror=()=>{o(),r()}}catch(i){o(),i&&r()}})}function ul(e,t,n="/"){let r=[],o=new TextDecoder("utf-8"),i=0,s=(c,u)=>{let a=c,l=Math.min(e.length,c+u);for(;a<l&&e[a]!==0;)a++;return o.decode(e.subarray(c,a)).trim()};for(;i+512<=e.length;){let c=s(i,100);if(!c){i+=512;continue}let u=s(i+124,12),a=Math.max(0,parseInt(u||"0",8)||0),l=e[i+156],d=s(i+345,155),h=d?`${d}/${c}`:c,f=h.replace(/^\.?\/+/,"").split("/").filter(Boolean),_=f.some(x=>x===".."),y=_?"":f.filter(x=>x!==".").join("/"),v=`${n==="/"?"":n.replace(/\/+$/,"")}/${y}`,S=i+512,P=Math.min(e.length,S+a);if(y&&!_){if(l===53||h.endsWith("/"))t.existsSync(v)||t.mkdirSync(v,{recursive:!0});else if(l===0||l===48){let x=v.slice(0,v.lastIndexOf("/"))||"/";t.existsSync(x)||t.mkdirSync(x,{recursive:!0});let O=e.slice(S,P);t.writeFileSync(v,O),r.push(v)}}let z=Math.ceil(a/512);i=S+z*512}return r}function Wd(e){let t=new TextEncoder,n=[];for(let[s,c]of Object.entries(e)){let u=s.replace(/^\/+/,""),a=typeof c=="string"?t.encode(c):c,l=new Uint8Array(512),d=(f,_,y)=>{let b=t.encode(f);l.set(b.subarray(0,Math.min(b.length,y)),_)};d(u,0,100),d("0000644\0",100,8),d("0000000\0",108,8),d("0000000\0",116,8),d(a.byteLength.toString(8).padStart(11,"0")+"\0",124,12),d(Math.floor(Date.now()/1e3).toString(8).padStart(11,"0")+"\0",136,12);for(let f=148;f<156;f++)l[f]=32;l[156]=48,d("ustar\0",257,6),d("00",263,2);let h=0;for(let f=0;f<512;f++)h+=l[f];d(h.toString(8).padStart(6,"0")+"\0 ",148,8),n.push(l),n.push(a);let m=a.byteLength%512;m!==0&&n.push(new Uint8Array(512-m))}n.push(new Uint8Array(1024));let r=n.reduce((s,c)=>s+c.byteLength,0),o=new Uint8Array(r),i=0;for(let s of n)o.set(s,i),i+=s.byteLength;return o}function Dn(e,t){if(!e)return;let n={...il,...t||{}};for(let[r,o]of Object.entries(n)){let i=r.startsWith("/")?r:`/usr/include/${r}`,s=i.slice(0,i.lastIndexOf("/"))||"/";e.existsSync(s)||e.mkdirSync(s,{recursive:!0}),e.writeFileSync(i,o)}e.existsSync("/tmp")||e.mkdirSync("/tmp",{recursive:!0}),e.existsSync("/usr/lib/wasm32-wasi")||e.mkdirSync("/usr/lib/wasm32-wasi",{recursive:!0})}var Jd="https://cdn.jsdelivr.net/npm/@yowasp/clang";function Pt(e){let t=[],n=e>>>0;do{let r=n&127;n>>>=7,n!==0&&(r|=128),t.push(r)}while(n!==0);return t}function U(e){let t=[],n=e|0,r=!0;for(;r;){let o=n&127;n>>=7,n===0&&(o&64)===0||n===-1&&(o&64)!==0?r=!1:o|=128,t.push(o)}return t}function Pe(e){let t=Array.from(new TextEncoder().encode(e));return[...Pt(t.length),...t]}function ge(e,t){return[e,...Pt(t.length),...t]}function ll(e,t=0,n=""){let r=Array.from(new TextEncoder().encode(e)),o=Array.from(new TextEncoder().encode(n)),i=ge(1,[3,96,4,127,127,127,127,1,127,96,1,127,0,96,0,0]),s=ge(2,[2,...Pe("wasi_snapshot_preview1"),...Pe("fd_write"),0,0,...Pe("wasi_snapshot_preview1"),...Pe("proc_exit"),0,1]),c=ge(3,[1,2]),u=ge(5,[1,0,1]),a=ge(7,[2,...Pe("memory"),2,0,...Pe("_start"),0,2]),l=[0,65,...U(0),65,...U(64),54,2,0,65,...U(4),65,...U(r.length),54,2,0,65,...U(1),65,...U(0),65,...U(1),65,...U(16),16,0,26];o.length>0&&l.push(65,...U(8),65,...U(64+r.length),54,2,0,65,...U(12),65,...U(o.length),54,2,0,65,...U(2),65,...U(8),65,...U(1),65,...U(16),16,0,26),t!==0&&l.push(65,...U(t),16,1),l.push(11);let d=ge(10,[1,...Pt(l.length),...l]),h=[...r,...o],m=ge(11,[1,0,65,...U(64),11,...Pt(h.length),...h]);return new Uint8Array([0,97,115,109,1,0,0,0,...i,...s,...c,...u,...a,...d,...m])}var Tt=class{options;clangWasm=null;lldWasm=null;sysrootTar=null;nativeToolchainUnavailable=!1;loadError=null;_loadingPromise=null;constructor(t={}){let n=yc.parse(t);this.options={...n,...t},t.clangWasm&&(this.clangWasm=t.clangWasm),t.lldWasm&&(this.lldWasm=t.lldWasm),t.sysrootTar&&(this.sysrootTar=t.sysrootTar)}_emitProgress(t){typeof this.options.onProgress=="function"&&this.options.onProgress(t)}async _fetchAssetWithProgress(t,n,r){if(this.options.cacheInIndexedDB!==!1){let c=await cl(n);if(c)return this._emitProgress({stage:"caching",loadedBytes:c.byteLength,totalBytes:c.byteLength,percent:100,message:`Loaded ${r} from IndexedDB cache`}),c}if(typeof fetch!="function")throw new Error(`Cannot download ${r}: global fetch is unavailable.`);let o=await fetch(t);if(!o.ok)throw new Error(`Failed to download ${r} from ${t} (HTTP ${o.status})`);let i=Number(o.headers.get("content-length")||0)||12*1024*1024,s;if(o.body&&typeof o.body.getReader=="function"){let c=o.body.getReader(),u=[],a=0;for(;;){let{done:d,value:h}=await c.read();if(d)break;if(h){u.push(h),a+=h.byteLength;let m=Math.min(99,Math.round(a/Math.max(i,a)*100));this._emitProgress({stage:"downloading",loadedBytes:a,totalBytes:Math.max(i,a),percent:m,message:`Downloading ${r} (${(a/(1024*1024)).toFixed(1)} MB)...`})}}s=new Uint8Array(a);let l=0;for(let d of u)s.set(d,l),l+=d.byteLength}else{let c=await o.arrayBuffer();s=new Uint8Array(c)}return this.options.cacheInIndexedDB!==!1&&await al(n,s),s}async ensureLoaded(){if(!(this.clangWasm&&this.lldWasm&&this.sysrootTar))return this._loadingPromise?this._loadingPromise:(this._loadingPromise=(async()=>{try{let t=(this.options.toolchainUrl||"https://cdn.jsdelivr.net/npm/@yowasp/clang").replace(/\/+$/,""),n=this.options.clangUrl||this.options.clangWasmUrl||`${t}/clang.wasm`,r=this.options.lldUrl||this.options.lldWasmUrl||`${t}/lld.wasm`,o=this.options.sysrootUrl||this.options.sysrootTarUrl||`${t}/sysroot.tar`;this.sysrootTar||(this.sysrootTar=await this._fetchAssetWithProgress(o,`sysroot:${o}`,"WASI C++20 Sysroot (libc + libc++)")),this.clangWasm||(this.clangWasm=await this._fetchAssetWithProgress(n,`clang:${n}`,"Clang C++20 WebAssembly Compiler (clang.wasm)")),this.lldWasm||(this.lldWasm=await this._fetchAssetWithProgress(r,`lld:${r}`,"LLD WebAssembly Linker (lld.wasm)")),this.nativeToolchainUnavailable=!1,this.loadError=null,this._emitProgress({stage:"ready",loadedBytes:(this.clangWasm?.byteLength||0)+(this.lldWasm?.byteLength||0)+(this.sysrootTar?.byteLength||0),totalBytes:(this.clangWasm?.byteLength||0)+(this.lldWasm?.byteLength||0)+(this.sysrootTar?.byteLength||0),percent:100,message:"C++20 WebAssembly Toolchain Ready"})}catch(t){this.nativeToolchainUnavailable=!0,this.loadError=t,this._emitProgress({stage:"error",loadedBytes:0,totalBytes:0,percent:0,message:`Remote C++20 WASI assets unavailable (${t.message}). Using virtual C++ executor.`})}finally{this._loadingPromise=null}})(),this._loadingPromise)}prepareVfs(t){t&&(this.sysrootTar&&!t.existsSync("/usr/include/.sysroot_extracted")&&(ul(this.sysrootTar,t,"/"),t.existsSync("/usr/include")||t.mkdirSync("/usr/include",{recursive:!0}),t.writeFileSync("/usr/include/.sysroot_extracted","1")),Dn(t,this.options.extraHeaders))}async compile(t){let n=t.vfs,r=t.outputPath||"/workspace/a.out",o=t.std||this.options.std||"c++20",i=t.optLevel||this.options.optLevel||"-O2",c=(t.sourceFiles&&t.sourceFiles.length>0?t.sourceFiles:t.entry?[t.entry]:["/workspace/src/main.cpp"]).map(x=>x.startsWith("/")?x:`/workspace/${x.replace(/^\/+/,"")}`);for(let x of c)if(!n.existsSync(x)){let O=`clang++: error: no such file or directory: '${x}'
357
+ `;return t.onStderr&&t.onStderr(O),{ok:!1,exitCode:1,wasmBinary:null,outputPath:r,stdout:"",stderr:O}}if(Dn(n,this.options.extraHeaders),typeof this.options.compilerHook=="function")return this.options.compilerHook({...t,sourceFiles:c,outputPath:r,std:o,optLevel:i});if(await this.ensureLoaded(),this.nativeToolchainUnavailable||!this.clangWasm||!this.lldWasm)return this._compileVirtualFallback(t,c,r);this.prepareVfs(n);let u=typeof globalThis<"u"&&globalThis.CodeLabRuntime||typeof window<"u"&&window.CodeLabRuntime;if(!u||typeof u.executeWasiModule!="function")throw new Error("CodeLabRuntime.executeWasiModule is unavailable.");let a="",l="",d=x=>{a+=x,t.onStdout&&t.onStdout(x)},h=x=>{l+=x,t.onStderr&&t.onStderr(x)};this._emitProgress({stage:"compiling",loadedBytes:100,totalBytes:100,percent:100,message:`Compiling ${c.map(x=>x.split("/").pop()).join(", ")} with Clang (${o}, ${i})...`});let m=`/tmp/build_${Date.now()}_${Math.random().toString(36).slice(2,6)}`;n.existsSync(m)||n.mkdirSync(m,{recursive:!0});let f=()=>{try{typeof n.rmSync=="function"&&n.rmSync(m,{recursive:!0,force:!0})}catch(x){}},_=[];for(let x=0;x<c.length;x++){let O=c[x],I=`${m}/obj_${x}.o`;_.push(I);let H=["clang++","-cc1","-triple","wasm32-unknown-wasi","-emit-obj",`-std=${o}`,i,"-isysroot","/usr","-internal-isystem","/usr/include/c++/v1","-internal-isystem","/usr/include","-I","/usr/include","-I","/workspace","-I","/workspace/src",...t.extraFlags||[],"-o",I,O],Q=await u.executeWasiModule(this.clangWasm,{vfs:n,args:H,env:{PATH:"/usr/bin:/bin",TMPDIR:"/tmp"},onStdout:d,onStderr:h});if(Q.exitCode!==0)return f(),{ok:!1,exitCode:Q.exitCode,wasmBinary:null,outputPath:r,stdout:a,stderr:l}}this._emitProgress({stage:"linking",loadedBytes:100,totalBytes:100,percent:100,message:`Linking ${r.split("/").pop()} with wasm-ld...`});let y="/usr/lib/wasm32-wasi/crt1.o",v=["wasm-ld","--no-threads","--export-dynamic","-L/usr/lib/wasm32-wasi",...n.existsSync(y)?[y]:[],..._,"-lc++","-lc++abi","-lc","-o",r],S=await u.executeWasiModule(this.lldWasm,{vfs:n,args:v,env:{PATH:"/usr/bin:/bin",TMPDIR:"/tmp"},onStdout:d,onStderr:h});if(f(),S.exitCode!==0||!n.existsSync(r))return{ok:!1,exitCode:S.exitCode||1,wasmBinary:null,outputPath:r,stdout:a,stderr:l||`wasm-ld: error: failed to produce output binary
358
+ `};let P=n.readFileSync(r),z=P instanceof Uint8Array?new Uint8Array(P.buffer,P.byteOffset,P.byteLength):new Uint8Array(P);return this._emitProgress({stage:"ready",loadedBytes:100,totalBytes:100,percent:100,message:"C++20 WebAssembly Toolchain Ready"}),{ok:!0,exitCode:0,wasmBinary:z,outputPath:r,stdout:a,stderr:l}}async _compileVirtualFallback(t,n,r){let o=t.vfs,i="",s="",c=y=>{i+=y,t.onStdout&&t.onStdout(y)},u=y=>{s+=y,t.onStderr&&t.onStderr(y)},a=this.loadError&&this.loadError.message?this.loadError.message:"WASI Clang/LLD binaries not loaded";u(`clang++: warning: native WASI toolchain unavailable (${a}); using limited offline C++ fallback.
359
+ `);let l=y=>{let b=0,v=0,S=0,P=y.length;for(;S<P;){let z=y[S],x=y[S+1];if(z==="/"&&x==="/"){for(S+=2;S<P&&y[S]!==`
360
+ `;)S++;continue}if(z==="/"&&x==="*"){for(S+=2;S<P&&!(y[S]==="*"&&y[S+1]==="/");)S++;S+=2;continue}if(z==="R"&&x==='"'){let O=y.indexOf("(",S+2);if(O!==-1){let H=`)${y.slice(S+2,O)}"`,Q=y.indexOf(H,O+1);S=Q!==-1?Q+H.length:P;continue}}if(z==='"'||z==="'"){let O=z;for(S++;S<P&&y[S]!==O;)y[S]==="\\"?S+=2:S++;S++;continue}z==="{"?b++:z==="}"?b--:z==="("?v++:z===")"&&v--,S++}return{braceCount:b,parenCount:v}},d=!0;for(let y of n){let b=o.readFileSync(y,"utf8"),{braceCount:v,parenCount:S}=l(b);if(v!==0||S!==0){let P=`clang++: error: syntax error in '${y}': unmatched ${v!==0?"curly braces":"parentheses"}
361
+ `;u(P),d=!1}}if(!d)return{ok:!1,exitCode:1,wasmBinary:null,outputPath:r,stdout:i,stderr:s};let h=o.readFileSync(n[0],"utf8"),m="",f=h.match(/std::cout\s*<<\s*("[^"]*")/g);if(f&&f.length>0){let y=f.map(b=>{let v=b.match(/"([^"]*)"/);return v?v[1].replace(/\\n/g,`
362
+ `).replace(/\\t/g," "):""}).join("");m=y?y.endsWith(`
363
+ `)?y:y+`
364
364
  `:`C++20 program executed successfully.
365
- `}else y=`Compiled and executed with C++20 (Virtual WASI Runtime)!
366
- `;let v=ll(y,0);if(s.writeFileSync(r,v),typeof s.chmodSync=="function")try{s.chmodSync(r,493)}catch(b){}return{ok:!0,exitCode:0,wasmBinary:v,outputPath:r,stdout:y,stderr:u}}};function Vd(e,t="/workspace"){let n=[],r=[],o=`${t.replace(/\/+$/,"")}/a.out`,i,s,c=!1,u=!1;for(let a=0;a<e.length;a++){let l=e[a];if(l==="--version"||l==="-v")c=!0;else if(l==="--help"||l==="-h")u=!0;else if(l==="-o"&&a+1<e.length){let d=e[++a];o=d.startsWith("/")?d:`${t.replace(/\/+$/,"")}/${d.replace(/^\.\//,"")}`}else if(l.startsWith("-o")&&l.length>2){let d=l.slice(2);o=d.startsWith("/")?d:`${t.replace(/\/+$/,"")}/${d.replace(/^\.\//,"")}`}else if(l.startsWith("-std=")){let d=l.slice(5);d==="c++17"||d==="c++20"||d==="c++23"?i=d:d==="c++2a"||d==="gnu++20"?i="c++20":d==="c++2b"||d==="gnu++23"?i="c++23":d==="gnu++17"&&(i="c++17")}else if(l==="-O0"||l==="-O1"||l==="-O2"||l==="-O3")s=l;else if(l.startsWith("-I")||l.startsWith("-D")||l.startsWith("-W"))r.push(l);else if(!l.startsWith("-")){let d=l.startsWith("/")?l:`${t.replace(/\/+$/,"")}/${l.replace(/^\.\//,"")}`;n.push(d)}}return{sourceFiles:n,outputPath:o,std:i,optLevel:s,extraFlags:r,showVersion:c,showHelp:u}}function $c(e){let t=async n=>{let r=await e.compile({entry:n.entry,sourceFiles:n.sourceFiles,outputPath:n.outputPath||"/workspace/a.out",std:n.std,optLevel:n.optLevel,extraFlags:n.extraFlags,vfs:n.vfs,onStdout:n.onStdout,onStderr:n.onStderr});return{ok:r.ok,exitCode:r.exitCode,wasmBinary:r.wasmBinary,outputPath:r.outputPath}};return typeof globalThis<"u"&&(globalThis.__codelabCppCompiler=t,globalThis.__codelabCppToolchain=e),typeof window<"u"&&(window.__codelabCppCompiler=t,window.__codelabCppToolchain=e),t}var pl=new Set(["concepts","coroutine","any","bitset","chrono","compare","csetjmp","csignal","cstdarg","cstddef","cstdint","cstdio","cstdlib","cstring","ctime","expected","functional","initializer_list","optional","source_location","tuple","type_traits","typeindex","typeinfo","utility","variant","version","memory","memory_resource","new","scoped_allocator","climits","cfloat","cerrno","exception","stdexcept","system_error","stacktrace","cassert","cctype","cwctype","cwchar","cuchar","string","string_view","format","span","array","deque","forward_list","list","vector","map","set","unordered_map","unordered_set","queue","stack","flat_map","flat_set","mdspan","iterator","ranges","algorithm","numeric","cmath","complex","valarray","random","ratio","cfenv","bit","numbers","locale","clocale","codecvt","ios","iosfwd","iostream","istream","ostream","sstream","fstream","syncstream","iomanip","streambuf","strstream","filesystem","regex","atomic","thread","stop_token","mutex","shared_mutex","condition_variable","future","semaphore","latch","barrier","bits/stdc++.h","codelab/dsa.hpp","codelab/test.hpp"]),Xe={"std::vector":{label:"std::vector",detail:"template <typename T, typename Allocator = std::allocator<T>> class vector;",documentation:`Sequence container that encapsulates dynamic size arrays.
365
+ `}else m=`Compiled and executed with C++20 (Virtual WASI Runtime)!
366
+ `;let _=ll(m,0);if(o.writeFileSync(r,_),typeof o.chmodSync=="function")try{o.chmodSync(r,493)}catch(y){}return{ok:!0,exitCode:0,wasmBinary:_,outputPath:r,stdout:m,stderr:s}}};function Vd(e,t="/workspace"){let n=[],r=[],o=`${t.replace(/\/+$/,"")}/a.out`,i,s,c=!1,u=!1;for(let a=0;a<e.length;a++){let l=e[a];if(l==="--version"||l==="-v")c=!0;else if(l==="--help"||l==="-h")u=!0;else if(l==="-o"&&a+1<e.length){let d=e[++a];o=d.startsWith("/")?d:`${t.replace(/\/+$/,"")}/${d.replace(/^\.\//,"")}`}else if(l.startsWith("-o")&&l.length>2){let d=l.slice(2);o=d.startsWith("/")?d:`${t.replace(/\/+$/,"")}/${d.replace(/^\.\//,"")}`}else if(l.startsWith("-std=")){let d=l.slice(5);d==="c++17"||d==="c++20"||d==="c++23"?i=d:d==="c++2a"||d==="gnu++20"?i="c++20":d==="c++2b"||d==="gnu++23"?i="c++23":d==="gnu++17"&&(i="c++17")}else if(l==="-O0"||l==="-O1"||l==="-O2"||l==="-O3")s=l;else if(l.startsWith("-I")||l.startsWith("-D")||l.startsWith("-W"))r.push(l);else if(!l.startsWith("-")){let d=l.startsWith("/")?l:`${t.replace(/\/+$/,"")}/${l.replace(/^\.\//,"")}`;n.push(d)}}return{sourceFiles:n,outputPath:o,std:i,optLevel:s,extraFlags:r,showVersion:c,showHelp:u}}function vc(e){let t=async n=>{let r=await e.compile({entry:n.entry,sourceFiles:n.sourceFiles,outputPath:n.outputPath||"/workspace/a.out",std:n.std,optLevel:n.optLevel,extraFlags:n.extraFlags,vfs:n.vfs,onStdout:n.onStdout,onStderr:n.onStderr});return{ok:r.ok,exitCode:r.exitCode,wasmBinary:r.wasmBinary,outputPath:r.outputPath}};return typeof globalThis<"u"&&(globalThis.__codelabCppCompiler=t,globalThis.__codelabCppToolchain=e),typeof window<"u"&&(window.__codelabCppCompiler=t,window.__codelabCppToolchain=e),t}var pl=new Set(["concepts","coroutine","any","bitset","chrono","compare","csetjmp","csignal","cstdarg","cstddef","cstdint","cstdio","cstdlib","cstring","ctime","expected","functional","initializer_list","optional","source_location","tuple","type_traits","typeindex","typeinfo","utility","variant","version","memory","memory_resource","new","scoped_allocator","climits","cfloat","cerrno","exception","stdexcept","system_error","stacktrace","cassert","cctype","cwctype","cwchar","cuchar","string","string_view","format","span","array","deque","forward_list","list","vector","map","set","unordered_map","unordered_set","queue","stack","flat_map","flat_set","mdspan","iterator","ranges","algorithm","numeric","cmath","complex","valarray","random","ratio","cfenv","bit","numbers","locale","clocale","codecvt","ios","iosfwd","iostream","istream","ostream","sstream","fstream","syncstream","iomanip","streambuf","strstream","filesystem","regex","atomic","thread","stop_token","mutex","shared_mutex","condition_variable","future","semaphore","latch","barrier","bits/stdc++.h","codelab/dsa.hpp","codelab/test.hpp"]),qe={"std::vector":{label:"std::vector",detail:"template <typename T, typename Allocator = std::allocator<T>> class vector;",documentation:`Sequence container that encapsulates dynamic size arrays.
367
367
 
368
368
  - Header: \`<vector>\`
369
369
  - Indexing: $O(1)$
@@ -422,12 +422,12 @@ inline void assertBool(bool cond, bool expected, const char* expr, int line) {
422
422
  - Complexity: $O(N)$`,insertText:"linkedListToVector(${1:head});",header:"<codelab/dsa.hpp>",complexity:"O(N)"},buildBinaryTree:{label:"buildBinaryTree",detail:"TreeNode* buildBinaryTree(const std::vector<int>& values, int nullSentinel = INT_MIN);",documentation:`Constructs a binary tree in level-order from a vector with INT_MIN sentinels for null nodes.
423
423
 
424
424
  - Header: \`<codelab/dsa.hpp>\`
425
- - Complexity: $O(N)$`,insertText:"buildBinaryTree({${1:1, 2, 3}});",header:"<codelab/dsa.hpp>",complexity:"O(N)"},DESCRIBE:{label:"DESCRIBE",detail:"DESCRIBE(suite_name)",documentation:"Defines a named test suite in the CodeLab test harness.\n\n- Header: `<codelab/test.hpp>`",insertText:'DESCRIBE("${1:Suite Name}");\n',header:"<codelab/test.hpp>",complexity:"CodeLab Test Suite"},TEST:{label:"TEST",detail:"TEST(test_name, block)",documentation:"Defines and runs a single test case within the active suite.\n\n- Header: `<codelab/test.hpp>`",insertText:'TEST("${1:should pass}", {\n ASSERT_EQ(${2:actual}, ${3:expected});\n});',header:"<codelab/test.hpp>",complexity:"CodeLab Test Runner"},ASSERT_EQ:{label:"ASSERT_EQ",detail:"ASSERT_EQ(actual, expected)",documentation:"Asserts that actual == expected; logs failure message and stack if not.\n\n- Header: `<codelab/test.hpp>`",insertText:"ASSERT_EQ(${1:actual}, ${2:expected});",header:"<codelab/test.hpp>",complexity:"Assertion"},ASSERT_TRUE:{label:"ASSERT_TRUE",detail:"ASSERT_TRUE(condition)",documentation:"Asserts that condition evaluates to true.\n\n- Header: `<codelab/test.hpp>`",insertText:"ASSERT_TRUE(${1:condition});",header:"<codelab/test.hpp>",complexity:"Assertion"},ASSERT_FALSE:{label:"ASSERT_FALSE",detail:"ASSERT_FALSE(condition)",documentation:"Asserts that condition evaluates to false.\n\n- Header: `<codelab/test.hpp>`",insertText:"ASSERT_FALSE(${1:condition});",header:"<codelab/test.hpp>",complexity:"Assertion"},ASSERT_NE:{label:"ASSERT_NE",detail:"ASSERT_NE(actual, expected)",documentation:"Asserts that actual != expected.\n\n- Header: `<codelab/test.hpp>`",insertText:"ASSERT_NE(${1:actual}, ${2:expected});",header:"<codelab/test.hpp>",complexity:"Assertion"},CODELAB_TEST_EXIT_CODE:{label:"CODELAB_TEST_EXIT_CODE",detail:"CODELAB_TEST_EXIT_CODE()",documentation:"Returns 0 if all tests passed, 1 if any failed.\n\n- Header: `<codelab/test.hpp>`",insertText:"return CODELAB_TEST_EXIT_CODE();",header:"<codelab/test.hpp>",complexity:"Exit Code"}},Mn=null,xc=new WeakSet,dl={vector:[{name:"push_back",detail:"void push_back(const T& val)",insert:"push_back(${1:val})",doc:"Appends an element to the end ($O(1)$ amortized)."},{name:"emplace_back",detail:"T& emplace_back(Args&&... args)",insert:"emplace_back(${1:args})",doc:"Constructs an element in-place at the end."},{name:"pop_back",detail:"void pop_back()",insert:"pop_back()",doc:"Removes the last element ($O(1)$)."},{name:"size",detail:"size_t size() const noexcept",insert:"size()",doc:"Returns the number of elements."},{name:"empty",detail:"bool empty() const noexcept",insert:"empty()",doc:"Checks whether the container is empty."},{name:"clear",detail:"void clear() noexcept",insert:"clear()",doc:"Clears the contents."},{name:"begin",detail:"iterator begin() noexcept",insert:"begin()",doc:"Returns an iterator to the beginning."},{name:"end",detail:"iterator end() noexcept",insert:"end()",doc:"Returns an iterator to the end."},{name:"front",detail:"T& front()",insert:"front()",doc:"Accesses the first element."},{name:"back",detail:"T& back()",insert:"back()",doc:"Accesses the last element."},{name:"resize",detail:"void resize(size_t count)",insert:"resize(${1:n})",doc:"Resizes the container to contain count elements."},{name:"reserve",detail:"void reserve(size_t new_cap)",insert:"reserve(${1:cap})",doc:"Reserves storage capacity."}],string:[{name:"size",detail:"size_t size() const noexcept",insert:"size()",doc:"Returns character count."},{name:"length",detail:"size_t length() const noexcept",insert:"length()",doc:"Returns character count."},{name:"empty",detail:"bool empty() const noexcept",insert:"empty()",doc:"Returns true if string is empty."},{name:"substr",detail:"string substr(size_t pos = 0, size_t count = npos) const",insert:"substr(${1:pos}, ${2:len})",doc:"Returns a substring."},{name:"find",detail:"size_t find(const string& str, size_t pos = 0) const",insert:"find(${1:str})",doc:"Finds first occurrence of substring or `string::npos`."},{name:"push_back",detail:"void push_back(char ch)",insert:"push_back(${1:ch})",doc:"Appends a character."},{name:"c_str",detail:"const char* c_str() const noexcept",insert:"c_str()",doc:"Returns null-terminated character array."},{name:"begin",detail:"iterator begin() noexcept",insert:"begin()",doc:"Iterator to start."},{name:"end",detail:"iterator end() noexcept",insert:"end()",doc:"Iterator past end."}],map:[{name:"insert",detail:"pair<iterator, bool> insert(const value_type& value)",insert:"insert({${1:key}, ${2:val}})",doc:"Inserts key-value pair."},{name:"emplace",detail:"pair<iterator, bool> emplace(Args&&... args)",insert:"emplace(${1:key}, ${2:val})",doc:"Constructs element in-place."},{name:"find",detail:"iterator find(const Key& key)",insert:"find(${1:key})",doc:"Finds element with specific key."},{name:"count",detail:"size_t count(const Key& key) const",insert:"count(${1:key})",doc:"Returns 1 if key exists, 0 otherwise."},{name:"contains",detail:"bool contains(const Key& key) const (C++20)",insert:"contains(${1:key})",doc:"Checks if there is an element with key (C++20)."},{name:"erase",detail:"size_t erase(const Key& key)",insert:"erase(${1:key})",doc:"Removes element by key or iterator."},{name:"size",detail:"size_t size() const noexcept",insert:"size()",doc:"Returns number of entries."},{name:"empty",detail:"bool empty() const noexcept",insert:"empty()",doc:"Checks if container is empty."},{name:"begin",detail:"iterator begin() noexcept",insert:"begin()",doc:"Iterator to first entry."},{name:"end",detail:"iterator end() noexcept",insert:"end()",doc:"Iterator past last entry."}],set:[{name:"insert",detail:"pair<iterator, bool> insert(const Key& value)",insert:"insert(${1:val})",doc:"Inserts element into set."},{name:"find",detail:"iterator find(const Key& key)",insert:"find(${1:val})",doc:"Finds element matching key."},{name:"count",detail:"size_t count(const Key& key) const",insert:"count(${1:val})",doc:"Returns number of matching elements."},{name:"contains",detail:"bool contains(const Key& key) const (C++20)",insert:"contains(${1:val})",doc:"Checks if element exists (C++20)."},{name:"erase",detail:"size_t erase(const Key& key)",insert:"erase(${1:val})",doc:"Erases element."},{name:"size",detail:"size_t size() const noexcept",insert:"size()",doc:"Returns size."},{name:"empty",detail:"bool empty() const noexcept",insert:"empty()",doc:"Checks if empty."}],queue:[{name:"push",detail:"void push(const T& value)",insert:"push(${1:val})",doc:"Inserts element at back of queue."},{name:"pop",detail:"void pop()",insert:"pop()",doc:"Removes front/top element."},{name:"front",detail:"T& front()",insert:"front()",doc:"Accesses first element (queue)."},{name:"top",detail:"const T& top() const",insert:"top()",doc:"Accesses top element (priority_queue / stack)."},{name:"empty",detail:"bool empty() const",insert:"empty()",doc:"Checks whether underlying container is empty."},{name:"size",detail:"size_t size() const",insert:"size()",doc:"Returns number of elements."}],ListNode:[{name:"val",detail:"int val",insert:"val",doc:"Node integer value."},{name:"next",detail:"ListNode* next",insert:"next",doc:"Pointer to next node in singly-linked list."}],TreeNode:[{name:"val",detail:"int val",insert:"val",doc:"Node integer value."},{name:"left",detail:"TreeNode* left",insert:"left",doc:"Left child pointer."},{name:"right",detail:"TreeNode* right",insert:"right",doc:"Right child pointer."}]};function fl(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(?:std::)?(unordered_map|map|unordered_set|set|vector|string|priority_queue|queue|stack|ListNode|TreeNode)\\s*(?:<[^;{}=]*>)?\\s*[*&]?\\s*\\b${n}\\b`),o=e.match(r);if(!o)return null;let i=o[1];return i==="unordered_map"||i==="map"?"map":i==="unordered_set"||i==="set"?"set":i==="priority_queue"||i==="queue"||i==="stack"?"queue":i}function Fn(e,t="main.cpp"){let n=Mn?{...Mn()||{}}:{},r=String(t||"main.cpp").replace(/^file:\/\/\/workspace\//,"").replace(/^\/workspace\//,"").replace(/^\/+/,"")||"main.cpp";e&&(n[r]=e);let o=[];for(let[i,s]of Object.entries(n)){if(!/\.(?:cpp|cc|cxx|c|h|hpp|hxx)$/i.test(i))continue;let c=String(s||"").split(`
426
- `);for(let u=0;u<c.length;u++){let a=c[u],l=a.trim();if(!l||l.startsWith("//")||l.startsWith("#"))continue;let d=a.match(/^\s*(struct|class)\s+([A-Za-z_][A-Za-z0-9_]*)/);if(d){o.push({name:d[2],kind:d[1],detail:`${d[1]} ${d[2]}`,file:i,line:u+1,col:a.indexOf(d[2])+1,params:[]});continue}let m=a.match(/^\s*(?:template\s*<[^>]+>\s*)?(?:inline\s+|static\s+|constexpr\s+)*([A-Za-z_][A-Za-z0-9_:<>,&\s*]*?)\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(([^;{}]*)\)\s*(?:const\s*)?(?:noexcept\s*)?[{;]/);if(m&&!/^(?:if|for|while|switch|catch|return)$/.test(m[2])){let h=m[1].trim(),f=m[2],y=m[3].trim();o.push({name:f,kind:"function",detail:`${h} ${f}(${y})`,file:i,line:u+1,col:a.indexOf(f)+1,params:y?y.split(",").map(_=>_.trim()).filter(Boolean):[]})}}}return o}function bc(e,t){if(typeof t=="function"&&(Mn=t),!e||!e.languages)return!1;if(xc.has(e))return!0;xc.add(e);try{let n=e.languages.CompletionItemKind||{},r=e.languages.CompletionItemInsertTextRule||{};return e.languages.registerCompletionItemProvider("cpp",{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():"",l=(typeof o.getLineContent=="function"?String(o.getLineContent(i.lineNumber)||"").slice(0,i.column-1):"").match(/([A-Za-z_][A-Za-z0-9_]*)\s*(?:\.|->)\s*[A-Za-z0-9_]*$/);if(l){let f=fl(u,l[1]),y=f?dl[f]:null;if(y)return{suggestions:y.map(_=>({label:_.name,kind:_.insert?.includes("(")?n.Method??0:n.Field??4,detail:_.detail,documentation:{value:_.doc},insertText:_.insert||_.name,insertTextRules:r.InsertAsSnippet,range:c}))}}let d=new Set,m=Object.keys(Xe).map(f=>{let y=Xe[f];return d.add(y.label),{label:y.label,kind:n.Function??1,detail:y.detail,documentation:{value:y.documentation},insertText:y.insertText||y.label,insertTextRules:r.InsertAsSnippet,range:c}}),h=Fn(u,o.uri?.path||"main.cpp");for(let f of h)d.has(f.name)||(d.add(f.name),m.push({label:f.name,kind:f.kind==="function"?n.Function??1:n.Struct??6,detail:f.detail,documentation:{value:`Defined in \`${f.file}:${f.line}\``},insertText:f.kind==="function"?`${f.name}(${f.params.length?"$1":""})`:f.name,insertTextRules:r.InsertAsSnippet,range:c}));return{suggestions:m}}}),e.languages.registerHoverProvider("cpp",{provideHover(o,i){let s=o.getWordAtPosition(i);if(!s)return null;let c=Xe[s.word]?s.word:Xe["std::"+s.word]?"std::"+s.word:null;if(c){let l=Xe[c];return{range:{startLineNumber:i.lineNumber,endLineNumber:i.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},contents:[{value:`**${l.label}** \u2014 \`${l.detail}\``},{value:l.documentation}]}}let a=Fn(o.getValue?.()||"",o.uri?.path||"main.cpp").find(l=>l.name===s.word);return a?{range:{startLineNumber:i.lineNumber,endLineNumber:i.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},contents:[{value:`\`\`\`cpp
425
+ - Complexity: $O(N)$`,insertText:"buildBinaryTree({${1:1, 2, 3}});",header:"<codelab/dsa.hpp>",complexity:"O(N)"},DESCRIBE:{label:"DESCRIBE",detail:"DESCRIBE(suite_name)",documentation:"Defines a named test suite in the CodeLab test harness.\n\n- Header: `<codelab/test.hpp>`",insertText:'DESCRIBE("${1:Suite Name}");\n',header:"<codelab/test.hpp>",complexity:"CodeLab Test Suite"},TEST:{label:"TEST",detail:"TEST(test_name, block)",documentation:"Defines and runs a single test case within the active suite.\n\n- Header: `<codelab/test.hpp>`",insertText:'TEST("${1:should pass}", {\n ASSERT_EQ(${2:actual}, ${3:expected});\n});',header:"<codelab/test.hpp>",complexity:"CodeLab Test Runner"},ASSERT_EQ:{label:"ASSERT_EQ",detail:"ASSERT_EQ(actual, expected)",documentation:"Asserts that actual == expected; logs failure message and stack if not.\n\n- Header: `<codelab/test.hpp>`",insertText:"ASSERT_EQ(${1:actual}, ${2:expected});",header:"<codelab/test.hpp>",complexity:"Assertion"},ASSERT_TRUE:{label:"ASSERT_TRUE",detail:"ASSERT_TRUE(condition)",documentation:"Asserts that condition evaluates to true.\n\n- Header: `<codelab/test.hpp>`",insertText:"ASSERT_TRUE(${1:condition});",header:"<codelab/test.hpp>",complexity:"Assertion"},ASSERT_FALSE:{label:"ASSERT_FALSE",detail:"ASSERT_FALSE(condition)",documentation:"Asserts that condition evaluates to false.\n\n- Header: `<codelab/test.hpp>`",insertText:"ASSERT_FALSE(${1:condition});",header:"<codelab/test.hpp>",complexity:"Assertion"},ASSERT_NE:{label:"ASSERT_NE",detail:"ASSERT_NE(actual, expected)",documentation:"Asserts that actual != expected.\n\n- Header: `<codelab/test.hpp>`",insertText:"ASSERT_NE(${1:actual}, ${2:expected});",header:"<codelab/test.hpp>",complexity:"Assertion"},CODELAB_TEST_EXIT_CODE:{label:"CODELAB_TEST_EXIT_CODE",detail:"CODELAB_TEST_EXIT_CODE()",documentation:"Returns 0 if all tests passed, 1 if any failed.\n\n- Header: `<codelab/test.hpp>`",insertText:"return CODELAB_TEST_EXIT_CODE();",header:"<codelab/test.hpp>",complexity:"Exit Code"}},Fn=null,_c=new WeakSet,dl={vector:[{name:"push_back",detail:"void push_back(const T& val)",insert:"push_back(${1:val})",doc:"Appends an element to the end ($O(1)$ amortized)."},{name:"emplace_back",detail:"T& emplace_back(Args&&... args)",insert:"emplace_back(${1:args})",doc:"Constructs an element in-place at the end."},{name:"pop_back",detail:"void pop_back()",insert:"pop_back()",doc:"Removes the last element ($O(1)$)."},{name:"size",detail:"size_t size() const noexcept",insert:"size()",doc:"Returns the number of elements."},{name:"empty",detail:"bool empty() const noexcept",insert:"empty()",doc:"Checks whether the container is empty."},{name:"clear",detail:"void clear() noexcept",insert:"clear()",doc:"Clears the contents."},{name:"begin",detail:"iterator begin() noexcept",insert:"begin()",doc:"Returns an iterator to the beginning."},{name:"end",detail:"iterator end() noexcept",insert:"end()",doc:"Returns an iterator to the end."},{name:"front",detail:"T& front()",insert:"front()",doc:"Accesses the first element."},{name:"back",detail:"T& back()",insert:"back()",doc:"Accesses the last element."},{name:"resize",detail:"void resize(size_t count)",insert:"resize(${1:n})",doc:"Resizes the container to contain count elements."},{name:"reserve",detail:"void reserve(size_t new_cap)",insert:"reserve(${1:cap})",doc:"Reserves storage capacity."}],string:[{name:"size",detail:"size_t size() const noexcept",insert:"size()",doc:"Returns character count."},{name:"length",detail:"size_t length() const noexcept",insert:"length()",doc:"Returns character count."},{name:"empty",detail:"bool empty() const noexcept",insert:"empty()",doc:"Returns true if string is empty."},{name:"substr",detail:"string substr(size_t pos = 0, size_t count = npos) const",insert:"substr(${1:pos}, ${2:len})",doc:"Returns a substring."},{name:"find",detail:"size_t find(const string& str, size_t pos = 0) const",insert:"find(${1:str})",doc:"Finds first occurrence of substring or `string::npos`."},{name:"push_back",detail:"void push_back(char ch)",insert:"push_back(${1:ch})",doc:"Appends a character."},{name:"c_str",detail:"const char* c_str() const noexcept",insert:"c_str()",doc:"Returns null-terminated character array."},{name:"begin",detail:"iterator begin() noexcept",insert:"begin()",doc:"Iterator to start."},{name:"end",detail:"iterator end() noexcept",insert:"end()",doc:"Iterator past end."}],map:[{name:"insert",detail:"pair<iterator, bool> insert(const value_type& value)",insert:"insert({${1:key}, ${2:val}})",doc:"Inserts key-value pair."},{name:"emplace",detail:"pair<iterator, bool> emplace(Args&&... args)",insert:"emplace(${1:key}, ${2:val})",doc:"Constructs element in-place."},{name:"find",detail:"iterator find(const Key& key)",insert:"find(${1:key})",doc:"Finds element with specific key."},{name:"count",detail:"size_t count(const Key& key) const",insert:"count(${1:key})",doc:"Returns 1 if key exists, 0 otherwise."},{name:"contains",detail:"bool contains(const Key& key) const (C++20)",insert:"contains(${1:key})",doc:"Checks if there is an element with key (C++20)."},{name:"erase",detail:"size_t erase(const Key& key)",insert:"erase(${1:key})",doc:"Removes element by key or iterator."},{name:"size",detail:"size_t size() const noexcept",insert:"size()",doc:"Returns number of entries."},{name:"empty",detail:"bool empty() const noexcept",insert:"empty()",doc:"Checks if container is empty."},{name:"begin",detail:"iterator begin() noexcept",insert:"begin()",doc:"Iterator to first entry."},{name:"end",detail:"iterator end() noexcept",insert:"end()",doc:"Iterator past last entry."}],set:[{name:"insert",detail:"pair<iterator, bool> insert(const Key& value)",insert:"insert(${1:val})",doc:"Inserts element into set."},{name:"find",detail:"iterator find(const Key& key)",insert:"find(${1:val})",doc:"Finds element matching key."},{name:"count",detail:"size_t count(const Key& key) const",insert:"count(${1:val})",doc:"Returns number of matching elements."},{name:"contains",detail:"bool contains(const Key& key) const (C++20)",insert:"contains(${1:val})",doc:"Checks if element exists (C++20)."},{name:"erase",detail:"size_t erase(const Key& key)",insert:"erase(${1:val})",doc:"Erases element."},{name:"size",detail:"size_t size() const noexcept",insert:"size()",doc:"Returns size."},{name:"empty",detail:"bool empty() const noexcept",insert:"empty()",doc:"Checks if empty."}],queue:[{name:"push",detail:"void push(const T& value)",insert:"push(${1:val})",doc:"Inserts element at back of queue."},{name:"pop",detail:"void pop()",insert:"pop()",doc:"Removes front/top element."},{name:"front",detail:"T& front()",insert:"front()",doc:"Accesses first element (queue)."},{name:"top",detail:"const T& top() const",insert:"top()",doc:"Accesses top element (priority_queue / stack)."},{name:"empty",detail:"bool empty() const",insert:"empty()",doc:"Checks whether underlying container is empty."},{name:"size",detail:"size_t size() const",insert:"size()",doc:"Returns number of elements."}],ListNode:[{name:"val",detail:"int val",insert:"val",doc:"Node integer value."},{name:"next",detail:"ListNode* next",insert:"next",doc:"Pointer to next node in singly-linked list."}],TreeNode:[{name:"val",detail:"int val",insert:"val",doc:"Node integer value."},{name:"left",detail:"TreeNode* left",insert:"left",doc:"Left child pointer."},{name:"right",detail:"TreeNode* right",insert:"right",doc:"Right child pointer."}]};function fl(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(?:std::)?(unordered_map|map|unordered_set|set|vector|string|priority_queue|queue|stack|ListNode|TreeNode)\\s*(?:<[^;{}=]*>)?\\s*[*&]?\\s*\\b${n}\\b`),o=e.match(r);if(!o)return null;let i=o[1];return i==="unordered_map"||i==="map"?"map":i==="unordered_set"||i==="set"?"set":i==="priority_queue"||i==="queue"||i==="stack"?"queue":i}function Ln(e,t="main.cpp"){let n=Fn?{...Fn()||{}}:{},r=String(t||"main.cpp").replace(/^file:\/\/\/workspace\//,"").replace(/^\/workspace\//,"").replace(/^\/+/,"")||"main.cpp";e&&(n[r]=e);let o=[];for(let[i,s]of Object.entries(n)){if(!/\.(?:cpp|cc|cxx|c|h|hpp|hxx)$/i.test(i))continue;let c=String(s||"").split(`
426
+ `);for(let u=0;u<c.length;u++){let a=c[u],l=a.trim();if(!l||l.startsWith("//")||l.startsWith("#"))continue;let d=a.match(/^\s*(struct|class)\s+([A-Za-z_][A-Za-z0-9_]*)/);if(d){o.push({name:d[2],kind:d[1],detail:`${d[1]} ${d[2]}`,file:i,line:u+1,col:a.indexOf(d[2])+1,params:[]});continue}let h=a.match(/^\s*(?:template\s*<[^>]+>\s*)?(?:inline\s+|static\s+|constexpr\s+)*([A-Za-z_][A-Za-z0-9_:<>,&\s*]*?)\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(([^;{}]*)\)\s*(?:const\s*)?(?:noexcept\s*)?[{;]/);if(h&&!/^(?:if|for|while|switch|catch|return)$/.test(h[2])){let m=h[1].trim(),f=h[2],_=h[3].trim();o.push({name:f,kind:"function",detail:`${m} ${f}(${_})`,file:i,line:u+1,col:a.indexOf(f)+1,params:_?_.split(",").map(y=>y.trim()).filter(Boolean):[]})}}}return o}function xc(e,t){if(typeof t=="function"&&(Fn=t),!e||!e.languages)return!1;if(_c.has(e))return!0;_c.add(e);try{let n=e.languages.CompletionItemKind||{},r=e.languages.CompletionItemInsertTextRule||{};return e.languages.registerCompletionItemProvider("cpp",{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():"",l=(typeof o.getLineContent=="function"?String(o.getLineContent(i.lineNumber)||"").slice(0,i.column-1):"").match(/([A-Za-z_][A-Za-z0-9_]*)\s*(?:\.|->)\s*[A-Za-z0-9_]*$/);if(l){let f=fl(u,l[1]),_=f?dl[f]:null;if(_)return{suggestions:_.map(y=>({label:y.name,kind:y.insert?.includes("(")?n.Method??0:n.Field??4,detail:y.detail,documentation:{value:y.doc},insertText:y.insert||y.name,insertTextRules:r.InsertAsSnippet,range:c}))}}let d=new Set,h=Object.keys(qe).map(f=>{let _=qe[f];return d.add(_.label),{label:_.label,kind:n.Function??1,detail:_.detail,documentation:{value:_.documentation},insertText:_.insertText||_.label,insertTextRules:r.InsertAsSnippet,range:c}}),m=Ln(u,o.uri?.path||"main.cpp");for(let f of m)d.has(f.name)||(d.add(f.name),h.push({label:f.name,kind:f.kind==="function"?n.Function??1:n.Struct??6,detail:f.detail,documentation:{value:`Defined in \`${f.file}:${f.line}\``},insertText:f.kind==="function"?`${f.name}(${f.params.length?"$1":""})`:f.name,insertTextRules:r.InsertAsSnippet,range:c}));return{suggestions:h}}}),e.languages.registerHoverProvider("cpp",{provideHover(o,i){let s=o.getWordAtPosition(i);if(!s)return null;let c=qe[s.word]?s.word:qe["std::"+s.word]?"std::"+s.word:null;if(c){let l=qe[c];return{range:{startLineNumber:i.lineNumber,endLineNumber:i.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},contents:[{value:`**${l.label}** \u2014 \`${l.detail}\``},{value:l.documentation}]}}let a=Ln(o.getValue?.()||"",o.uri?.path||"main.cpp").find(l=>l.name===s.word);return a?{range:{startLineNumber:i.lineNumber,endLineNumber:i.lineNumber,startColumn:s.startColumn,endColumn:s.endColumn},contents:[{value:`\`\`\`cpp
427
427
  ${a.detail}
428
- \`\`\``},{value:`Defined in \`${a.file}:${a.line}\``}]}:null}}),typeof e.languages.registerDefinitionProvider=="function"&&e.Uri&&e.languages.registerDefinitionProvider("cpp",{provideDefinition(o,i){let s=o.getWordAtPosition(i);if(!s)return null;let u=Fn(o.getValue?.()||"",o.uri?.path||"main.cpp").find(l=>l.name===s.word);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(n){return typeof console<"u"&&console.warn&&console.warn("[C++ Monaco Intelligence Error]:",n),!1}}function ml(e,t="main.cpp",n){let r=[];if(!e||typeof e!="string")return r;let o=e.split(`
429
- `),i=[],s={"}":"{",")":"(","]":"["},c=!1;for(let y=0;y<o.length;y++){let _=o[y],v=y+1,b=!1,T=!1,Z="";for(let z=0;z<_.length;z++){let x=_[z],P=_[z+1]||"";if(c){x==="*"&&P==="/"&&(c=!1,z++);continue}if(!b&&!T){if(x==="/"&&P==="*"){c=!0,z++;continue}if(x==="/"&&P==="/")break}if(!T&&(x==='"'||x==="R"&&P==='"')){x==="R"&&z++,(z===0||_[z-1]!=="\\")&&(b=!b,Z=b?'"':"");continue}if(!b&&x==="'"){(z===0||_[z-1]!=="\\")&&(T=!T);continue}if(!(b||T)){if(x==="{"||x==="("||x==="[")i.push({char:x,line:v,col:z+1});else if(x==="}"||x===")"||x==="]"){let I=s[x],j=i.pop();j?j.char!==I&&r.push({id:`cpp-bracket-mismatch-${v}-${z+1}`,file:t,line:v,col:z+1,severity:"error",message:`Mismatched bracket: found '${x}' but expected closing for '${j.char}' from line ${j.line}.`,source:"cpp-linter"}):r.push({id:`cpp-bracket-unmatched-${v}-${z+1}`,file:t,line:v,col:z+1,severity:"error",message:`Unmatched closing bracket '${x}' with no opening counterpart.`,source:"cpp-linter"})}}}b&&!c&&r.push({id:`cpp-string-unterminated-${v}`,file:t,line:v,col:_.length,severity:"error",message:"Unterminated string literal on line.",source:"cpp-linter"})}for(let y of i)r.push({id:`cpp-bracket-unclosed-${y.line}-${y.col}`,file:t,line:y.line,col:y.col,severity:"error",message:`Unclosed bracket '${y.char}' opened on line ${y.line}.`,source:"cpp-linter"});let u=/#include\s*([<"])([^>"]+)[>"]/g,a,l=new Set;for(;(a=u.exec(e))!==null;){let y=a[1]==="<",_=a[2].trim();l.add(_);let v=e.slice(0,a.index).split(`
430
- `).length;y&&(pl.has(_)||_.startsWith("bits/")||_.startsWith("codelab/")||n&&(n.existsSync(`/usr/include/${_}`)||n.existsSync(`/workspace/${_}`))||r.push({id:`cpp-unknown-include-${v}`,file:t,line:v,col:1,severity:"warning",message:`Unknown or unresolvable C++ header <${_}>.`,source:"cpp-linter"}))}let d=l.has("codelab/dsa.hpp")||l.has("bits/stdc++.h"),m=["ListNode","TreeNode","buildLinkedList","linkedListToVector","buildBinaryTree"];for(let y of m)if(new RegExp(`\\b${y}\\b`).test(e)&&!d){r.push({id:`cpp-missing-dsa-include-${y}`,file:t,line:1,col:1,severity:"warning",message:`Symbol '${y}' used without #include <codelab/dsa.hpp>.`,source:"cpp-linter"});break}let h=l.has("codelab/test.hpp"),f=["DESCRIBE","TEST","ASSERT_EQ","ASSERT_NE","ASSERT_TRUE","ASSERT_FALSE","CODELAB_TEST_EXIT_CODE"];for(let y of f)if(new RegExp(`\\b${y}\\b`).test(e)&&!h){r.push({id:`cpp-missing-test-include-${y}`,file:t,line:1,col:1,severity:"warning",message:`Test macro '${y}' used without #include <codelab/test.hpp>.`,source:"cpp-linter"});break}for(let y=0;y<o.length;y++){let _=o[y],v=/\bif\s*\(([^;)]*[^=!<>]=[^=][^;)]*)\)/.exec(_);v&&r.push({id:`cpp-suspicious-assign-${y+1}`,file:t,line:y+1,col:v.index+1,severity:"warning",message:"Suspicious assignment '=' inside 'if' condition; did you mean '=='?",source:"cpp-linter"})}if(i.length===0){let y=/\b(?:struct|class)\s+([A-Za-z_][A-Za-z0-9_]*)\s*(?::[^{;]*)?\{/g,_;for(;(_=y.exec(e))!==null;){let v=_[1],b=_.index+_[0].length,T=1,Z=!1,z=!1,x=!1,P=!1;for(;b<e.length&&T>0;){let I=e[b],j=e[b+1]||"";if(P){I===`
431
- `&&(P=!1),b++;continue}if(x){if(I==="*"&&j==="/"){x=!1,b+=2;continue}b++;continue}if(!Z&&!z){if(I==="/"&&j==="/"){P=!0,b+=2;continue}if(I==="/"&&j==="*"){x=!0,b+=2;continue}}if(!z&&I==='"'&&e[b-1]!=="\\"){Z=!Z,b++;continue}if(!Z&&I==="'"&&e[b-1]!=="\\"){z=!z,b++;continue}!Z&&!z&&(I==="{"?T++:I==="}"&&T--),b++}if(T===0){let I=e.slice(b).replace(/^(?:\s|\/\/[^\n]*\n|\/\*[\s\S]*?\*\/)+/,""),j=/^;|^[A-Za-z_*&][A-Za-z0-9_,\s*&[\]=()]*;/.test(I);if(I.length>0&&!j){let oe=e.slice(0,b).split(`
432
- `).length;r.push({id:`cpp-missing-semicolon-${oe}`,file:t,line:oe,col:1,severity:"error",message:`Missing semicolon ';' after '${v}' class/struct definition.`,source:"cpp-linter"})}}}}return r}function Kd(e,t,n,r){let o=[];if(!e||typeof e!="string")return o;t&&typeof t.clear=="function"&&t.clear("clang");let i=/(?:(?:^|\n)(?:\/workspace\/)?([^\s:\n]+)):(\d+):(\d+):\s*(fatal error|error|warning|note):\s*([^\n]+)/g,s,c=0;for(;(s=i.exec(e))!==null;){let u=s[1].trim(),a=parseInt(s[2],10)||1,l=parseInt(s[3],10)||1,d=s[4].toLowerCase(),m=s[5].trim(),h="error";d==="warning"?h="warning":d==="note"&&(h="info");let f={id:`clang-${u}-${a}-${l}-${c++}`,file:u,line:a,col:l,severity:h,message:`[Clang] ${m}`,source:"clang"};o.push(f),t&&typeof t.add=="function"&&t.add(f)}if(n&&r&&typeof n.editor?.setModelMarkers=="function"){let u=o.map(a=>({startLineNumber:a.line,startColumn:a.col||1,endLineNumber:a.line,endColumn:(a.col||1)+20,message:a.message,severity:a.severity==="error"?n.MarkerSeverity.Error:a.severity==="warning"?n.MarkerSeverity.Warning:n.MarkerSeverity.Info}));n.editor.setModelMarkers(r,"clang",u)}return o}function zc(e,t={}){let n=new Ot(t),r=$c(n);if(!e)return n;e.cppToolchain=n,e.cppCompiler=r,e.cppOptions=n.options;let o=()=>e&&e.files?e.files:{};return typeof window<"u"&&window.monaco&&bc(window.monaco,o),Array.isArray(e._monacoReadyHooks)||(e._monacoReadyHooks=[]),e._monacoReadyHooks.push(i=>{bc(i,o)}),!e.enabledLanguages||!(e.enabledLanguages instanceof Set)?e.enabledLanguages=new Set(["js","cpp"]):e.enabledLanguages.add("cpp"),t.files&&typeof t.files=="object"&&(e.cppFiles={...e.cppFiles||{},...t.files},e.guidedConfig&&(e.guidedConfig.cppFiles={...e.guidedConfig.cppFiles||{},...t.files})),t.starterFiles&&typeof t.starterFiles=="object"&&(e.guidedConfig||(e.guidedConfig={}),e.guidedConfig.cppStarterFiles={...e.guidedConfig.cppStarterFiles||{},...t.starterFiles}),t.solutionFiles&&typeof t.solutionFiles=="object"&&(e.guidedConfig||(e.guidedConfig={}),e.guidedConfig.cppSolutionFiles={...e.guidedConfig.cppSolutionFiles||{},...t.solutionFiles}),e.vfs&&jn(e.vfs,n.options.extraHeaders),e.hasMultipleLanguages=e.enabledLanguages.size>1,e._cppLintHandler=(i,s)=>{if(!i||!/\.(?:cpp|cc|cxx|hpp|h)$/i.test(i))return;let c=ml(String(s??""),i,e?e.vfs:void 0),u=e?e._diagnosticsStore:null;if(u&&typeof u.setFileDiagnostics=="function")u.setFileDiagnostics(i,"cpp-linter",c);else if(u&&typeof u.clear=="function"&&typeof u.add=="function"){u.clear("cpp-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,"cpp-linter",l)}}},t.preload&&n.ensureLoaded().catch(i=>{typeof e._appendTerminalOutput=="function"&&e._appendTerminalOutput("stderr",`[C++ Toolchain preload warning]: ${i.message||i}
433
- `)}),t.activate&&typeof e.setLanguage=="function"?e.setLanguage("cpp"):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 Sc(e,t){if(e===null){let n=new Ot(t||{});return $c(n),n}if(e===void 0||typeof e=="object"&&!("enabledLanguages"in e)&&!("container"in e)&&!("_renderShell"in e)){let n=e||{},r=(o,i={})=>zc(o,{...n,...i||{}});return r.extensionName="cpp",r.languageId="cpp",r.install=r,r}return zc(e,t)}function Hd(e={}){return Sc(e)}var Gd=Sc;export{il as BUILTIN_CPP_HEADERS,Xe as CPP_COMPLETIONS_AND_HOVERS,Ot as CppToolchainManager,Jd as DEFAULT_CPP_CDN_BASE_URL,pl as STANDARD_CPP20_HEADERS,ml as analyzeCppSource,Kd as applyClangStderrDiagnostics,ll as buildWasiPrintWasm,Sc as cppExtension,Hd as createCppExtension,Wd as createTarArchive,Gd as default,ul as extractTarToVfs,zc as installCppExtension,Vd as parseCppCompilerFlags,$c as registerCppCompilerOnRuntime,bc as registerMonacoCppLanguageService,jn as seedCppHeadersIntoVfs};
428
+ \`\`\``},{value:`Defined in \`${a.file}:${a.line}\``}]}:null}}),typeof e.languages.registerDefinitionProvider=="function"&&e.Uri&&e.languages.registerDefinitionProvider("cpp",{provideDefinition(o,i){let s=o.getWordAtPosition(i);if(!s)return null;let u=Ln(o.getValue?.()||"",o.uri?.path||"main.cpp").find(l=>l.name===s.word);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(n){return typeof console<"u"&&console.warn&&console.warn("[C++ Monaco Intelligence Error]:",n),!1}}function ml(e,t="main.cpp",n){let r=[];if(!e||typeof e!="string")return r;let o=e.split(`
429
+ `),i=[],s={"}":"{",")":"(","]":"["},c=!1;for(let _=0;_<o.length;_++){let y=o[_],b=_+1,v=!1,S=!1;for(let P=0;P<y.length;P++){let z=y[P],x=y[P+1]||"";if(c){z==="*"&&x==="/"&&(c=!1,P++);continue}if(!v&&!S){if(z==="/"&&x==="*"){c=!0,P++;continue}if(z==="/"&&x==="/")break}if(!S&&(z==='"'||z==="R"&&x==='"')){z==="R"&&P++,(P===0||y[P-1]!=="\\")&&(v=!v);continue}if(!v&&z==="'"){(P===0||y[P-1]!=="\\")&&(S=!S);continue}if(!(v||S)){if(z==="{"||z==="("||z==="[")i.push({char:z,line:b,col:P+1});else if(z==="}"||z===")"||z==="]"){let O=s[z],I=i.pop();I?I.char!==O&&r.push({id:`cpp-bracket-mismatch-${b}-${P+1}`,file:t,line:b,col:P+1,severity:"error",message:`Mismatched bracket: found '${z}' but expected closing for '${I.char}' from line ${I.line}.`,source:"cpp-linter"}):r.push({id:`cpp-bracket-unmatched-${b}-${P+1}`,file:t,line:b,col:P+1,severity:"error",message:`Unmatched closing bracket '${z}' with no opening counterpart.`,source:"cpp-linter"})}}}v&&!c&&r.push({id:`cpp-string-unterminated-${b}`,file:t,line:b,col:y.length,severity:"error",message:"Unterminated string literal on line.",source:"cpp-linter"})}for(let _ of i)r.push({id:`cpp-bracket-unclosed-${_.line}-${_.col}`,file:t,line:_.line,col:_.col,severity:"error",message:`Unclosed bracket '${_.char}' opened on line ${_.line}.`,source:"cpp-linter"});let u=/#include\s*([<"])([^>"]+)[>"]/g,a,l=new Set;for(;(a=u.exec(e))!==null;){let _=a[1]==="<",y=a[2].trim();l.add(y);let b=e.slice(0,a.index).split(`
430
+ `).length;_&&(pl.has(y)||y.startsWith("bits/")||y.startsWith("codelab/")||n&&(n.existsSync(`/usr/include/${y}`)||n.existsSync(`/workspace/${y}`))||r.push({id:`cpp-unknown-include-${b}`,file:t,line:b,col:1,severity:"warning",message:`Unknown or unresolvable C++ header <${y}>.`,source:"cpp-linter"}))}let d=l.has("codelab/dsa.hpp")||l.has("bits/stdc++.h"),h=["ListNode","TreeNode","buildLinkedList","linkedListToVector","buildBinaryTree"];for(let _ of h)if(new RegExp(`\\b${_}\\b`).test(e)&&!d){r.push({id:`cpp-missing-dsa-include-${_}`,file:t,line:1,col:1,severity:"warning",message:`Symbol '${_}' used without #include <codelab/dsa.hpp>.`,source:"cpp-linter"});break}let m=l.has("codelab/test.hpp"),f=["DESCRIBE","TEST","ASSERT_EQ","ASSERT_NE","ASSERT_TRUE","ASSERT_FALSE","CODELAB_TEST_EXIT_CODE"];for(let _ of f)if(new RegExp(`\\b${_}\\b`).test(e)&&!m){r.push({id:`cpp-missing-test-include-${_}`,file:t,line:1,col:1,severity:"warning",message:`Test macro '${_}' used without #include <codelab/test.hpp>.`,source:"cpp-linter"});break}for(let _=0;_<o.length;_++){let y=o[_],b=/\bif\s*\(([^;)]*[^=!<>]=[^=][^;)]*)\)/.exec(y);b&&r.push({id:`cpp-suspicious-assign-${_+1}`,file:t,line:_+1,col:b.index+1,severity:"warning",message:"Suspicious assignment '=' inside 'if' condition; did you mean '=='?",source:"cpp-linter"})}if(i.length===0){let _=/\b(?:struct|class)\s+([A-Za-z_][A-Za-z0-9_]*)\s*(?::[^{;]*)?\{/g,y;for(;(y=_.exec(e))!==null;){let b=y[1],v=y.index+y[0].length,S=1,P=!1,z=!1,x=!1,O=!1;for(;v<e.length&&S>0;){let I=e[v],H=e[v+1]||"";if(O){I===`
431
+ `&&(O=!1),v++;continue}if(x){if(I==="*"&&H==="/"){x=!1,v+=2;continue}v++;continue}if(!P&&!z){if(I==="/"&&H==="/"){O=!0,v+=2;continue}if(I==="/"&&H==="*"){x=!0,v+=2;continue}}if(!z&&I==='"'&&e[v-1]!=="\\"){P=!P,v++;continue}if(!P&&I==="'"&&e[v-1]!=="\\"){z=!z,v++;continue}!P&&!z&&(I==="{"?S++:I==="}"&&S--),v++}if(S===0){let I=e.slice(v).replace(/^(?:\s|\/\/[^\n]*\n|\/\*[\s\S]*?\*\/)+/,""),H=/^;|^[A-Za-z_*&][A-Za-z0-9_,\s*&[\]=()]*;/.test(I);if(I.length>0&&!H){let Q=e.slice(0,v).split(`
432
+ `).length;r.push({id:`cpp-missing-semicolon-${Q}`,file:t,line:Q,col:1,severity:"error",message:`Missing semicolon ';' after '${b}' class/struct definition.`,source:"cpp-linter"})}}}}return r}function Kd(e,t,n,r){let o=[];if(!e||typeof e!="string")return o;t&&typeof t.clear=="function"&&t.clear("clang");let i=/(?:(?:^|\n)(?:\/workspace\/)?([^\s:\n]+)):(\d+):(\d+):\s*(fatal error|error|warning|note):\s*([^\n]+)/g,s,c=0;for(;(s=i.exec(e))!==null;){let u=s[1].trim(),a=parseInt(s[2],10)||1,l=parseInt(s[3],10)||1,d=s[4].toLowerCase(),h=s[5].trim(),m="error";d==="warning"?m="warning":d==="note"&&(m="info");let f={id:`clang-${u}-${a}-${l}-${c++}`,file:u,line:a,col:l,severity:m,message:`[Clang] ${h}`,source:"clang"};o.push(f),t&&typeof t.add=="function"&&t.add(f)}if(n&&r&&typeof n.editor?.setModelMarkers=="function"){let u=o.map(a=>({startLineNumber:a.line,startColumn:a.col||1,endLineNumber:a.line,endColumn:(a.col||1)+20,message:a.message,severity:a.severity==="error"?n.MarkerSeverity.Error:a.severity==="warning"?n.MarkerSeverity.Warning:n.MarkerSeverity.Info}));n.editor.setModelMarkers(r,"clang",u)}return o}function bc(e,t={}){let n=new Tt(t),r=vc(n);if(!e)return n;e.cppToolchain=n,e.cppCompiler=r,e.cppOptions=n.options;let o=()=>e&&e.files?e.files:{};return typeof window<"u"&&window.monaco&&xc(window.monaco,o),Array.isArray(e._monacoReadyHooks)||(e._monacoReadyHooks=[]),e._monacoReadyHooks.push(i=>{xc(i,o)}),!e.enabledLanguages||!(e.enabledLanguages instanceof Set)?e.enabledLanguages=new Set(["js","cpp"]):e.enabledLanguages.add("cpp"),t.files&&typeof t.files=="object"&&(e.cppFiles={...e.cppFiles||{},...t.files},e.guidedConfig&&(e.guidedConfig.cppFiles={...e.guidedConfig.cppFiles||{},...t.files})),t.starterFiles&&typeof t.starterFiles=="object"&&(e.guidedConfig||(e.guidedConfig={}),e.guidedConfig.cppStarterFiles={...e.guidedConfig.cppStarterFiles||{},...t.starterFiles}),t.solutionFiles&&typeof t.solutionFiles=="object"&&(e.guidedConfig||(e.guidedConfig={}),e.guidedConfig.cppSolutionFiles={...e.guidedConfig.cppSolutionFiles||{},...t.solutionFiles}),e.vfs&&Dn(e.vfs,n.options.extraHeaders),e.hasMultipleLanguages=e.enabledLanguages.size>1,e._cppLintHandler=(i,s)=>{if(!i||!/\.(?:cpp|cc|cxx|hpp|h)$/i.test(i))return;let c=ml(String(s??""),i,e?e.vfs:void 0),u=e?e._diagnosticsStore:null;if(u&&typeof u.setFileDiagnostics=="function")u.setFileDiagnostics(i,"cpp-linter",c);else if(u&&typeof u.clear=="function"&&typeof u.add=="function"){u.clear("cpp-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,"cpp-linter",l)}}},t.preload&&n.ensureLoaded().catch(i=>{typeof e._appendTerminalOutput=="function"&&e._appendTerminalOutput("stderr",`[C++ Toolchain preload warning]: ${i.message||i}
433
+ `)}),t.activate&&typeof e.setLanguage=="function"?e.setLanguage("cpp"):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 $c(e,t){if(e===null){let n=new Tt(t||{});return vc(n),n}if(e===void 0||typeof e=="object"&&!("enabledLanguages"in e)&&!("container"in e)&&!("_renderShell"in e)){let n=e||{},r=(o,i={})=>bc(o,{...n,...i||{}});return r.extensionName="cpp",r.languageId="cpp",r.install=r,r}return bc(e,t)}function Hd(e={}){return $c(e)}var Gd=$c;export{il as BUILTIN_CPP_HEADERS,qe as CPP_COMPLETIONS_AND_HOVERS,Tt as CppToolchainManager,Jd as DEFAULT_CPP_CDN_BASE_URL,pl as STANDARD_CPP20_HEADERS,ml as analyzeCppSource,Kd as applyClangStderrDiagnostics,ll as buildWasiPrintWasm,$c as cppExtension,Hd as createCppExtension,Wd as createTarArchive,Gd as default,ul as extractTarToVfs,bc as installCppExtension,Vd as parseCppCompilerFlags,vc as registerCppCompilerOnRuntime,xc as registerMonacoCppLanguageService,Dn as seedCppHeadersIntoVfs};