@zibby/core 0.1.33 → 0.1.36

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 (94) hide show
  1. package/dist/agents/base.js +286 -14
  2. package/dist/backend-client.js +1 -1
  3. package/dist/constants/tool-names.js +1 -1
  4. package/dist/constants/zibby-scratch.js +1 -1
  5. package/dist/constants.js +1 -1
  6. package/dist/enrichment/base.js +1 -1
  7. package/dist/enrichment/enrichers/accessibility-enricher.js +1 -1
  8. package/dist/enrichment/enrichers/dom-enricher.js +1 -1
  9. package/dist/enrichment/enrichers/page-state-enricher.js +1 -1
  10. package/dist/enrichment/enrichers/position-enricher.js +1 -1
  11. package/dist/enrichment/index.js +4 -1
  12. package/dist/enrichment/mcp-integration.js +4 -1
  13. package/dist/enrichment/mcp-ref-enricher.js +1 -1
  14. package/dist/enrichment/pipeline.js +2 -2
  15. package/dist/enrichment/trace-text-enricher.js +2 -1
  16. package/dist/framework/agents/assistant-strategy.js +69 -5
  17. package/dist/framework/agents/base.js +1 -1
  18. package/dist/framework/agents/claude-strategy.js +106 -4
  19. package/dist/framework/agents/codex-strategy.js +23 -4
  20. package/dist/framework/agents/cursor-strategy.js +106 -20
  21. package/dist/framework/agents/gemini-strategy.js +34 -7
  22. package/dist/framework/agents/index.js +252 -6
  23. package/dist/framework/agents/middleware/assistant-round-pipeline.js +2 -2
  24. package/dist/framework/agents/providers/base.js +1 -1
  25. package/dist/framework/agents/providers/index.js +4 -1
  26. package/dist/framework/agents/providers/openai-transport.js +4 -2
  27. package/dist/framework/agents/providers/openai.js +1 -1
  28. package/dist/framework/agents/providers/transport-base.js +1 -1
  29. package/dist/framework/agents/utils/auth-resolver.js +1 -1
  30. package/dist/framework/agents/utils/cursor-output-formatter.js +25 -1
  31. package/dist/framework/agents/utils/openai-proxy-formatter.js +43 -5
  32. package/dist/framework/agents/utils/payload-budget.js +2 -2
  33. package/dist/framework/agents/utils/structured-output-formatter.js +8 -4
  34. package/dist/framework/code-generator.js +276 -10
  35. package/dist/framework/constants.js +1 -1
  36. package/dist/framework/context-loader.js +2 -2
  37. package/dist/framework/function-bridge.js +60 -1
  38. package/dist/framework/function-skill-registry.js +1 -1
  39. package/dist/framework/graph-compiler.js +281 -1
  40. package/dist/framework/graph.js +272 -4
  41. package/dist/framework/index.js +298 -1
  42. package/dist/framework/mcp-client.js +56 -2
  43. package/dist/framework/node-registry.js +262 -4
  44. package/dist/framework/node.js +264 -4
  45. package/dist/framework/output-parser.js +2 -2
  46. package/dist/framework/skill-registry.js +1 -1
  47. package/dist/framework/state-utils.js +5 -1
  48. package/dist/framework/state.js +1 -1
  49. package/dist/framework/tool-resolver.js +1 -1
  50. package/dist/index.js +479 -5
  51. package/dist/package.json +1 -1
  52. package/dist/runtime/generation/base.js +1 -1
  53. package/dist/runtime/generation/index.js +58 -3
  54. package/dist/runtime/generation/mcp-ref-strategy.js +17 -17
  55. package/dist/runtime/generation/stable-id-strategy.js +14 -14
  56. package/dist/runtime/stable-id-runtime.js +1 -1
  57. package/dist/runtime/verification/base.js +1 -1
  58. package/dist/runtime/verification/index.js +3 -3
  59. package/dist/runtime/verification/playwright-json-strategy.js +1 -1
  60. package/dist/runtime/zibby-runtime.js +1 -1
  61. package/dist/sync/index.js +1 -1
  62. package/dist/sync/uploader.js +1 -1
  63. package/dist/tools/run-playwright-test.js +3 -3
  64. package/dist/utils/adf-converter.js +1 -1
  65. package/dist/utils/ast-utils.js +9 -1
  66. package/dist/utils/ci-setup.js +4 -4
  67. package/dist/utils/cursor-mcp-isolated-home.js +1 -1
  68. package/dist/utils/cursor-utils.js +1 -1
  69. package/dist/utils/live-frame-discovery.js +1 -1
  70. package/dist/utils/logger.js +1 -1
  71. package/dist/utils/mcp-config-writer.js +4 -4
  72. package/dist/utils/mission-control-from-run-states.js +1 -1
  73. package/dist/utils/node-schema-parser.js +9 -1
  74. package/dist/utils/parallel-config.js +1 -1
  75. package/dist/utils/post-process-events.js +2 -1
  76. package/dist/utils/repo-clone.js +1 -0
  77. package/dist/utils/result-handler.js +1 -1
  78. package/dist/utils/ripple-effect.js +1 -1
  79. package/dist/utils/run-capacity-coordinator.js +3 -1
  80. package/dist/utils/run-capacity-queue.js +2 -2
  81. package/dist/utils/run-index-merge.js +1 -1
  82. package/dist/utils/run-index-post-cli.js +4 -1
  83. package/dist/utils/run-registry.js +3 -3
  84. package/dist/utils/run-state-session.js +2 -2
  85. package/dist/utils/selector-generator.js +4 -4
  86. package/dist/utils/session-state-constants.js +1 -1
  87. package/dist/utils/session-state-live-runs.js +1 -1
  88. package/dist/utils/streaming-parser.js +3 -3
  89. package/dist/utils/test-post-processor.js +14 -11
  90. package/dist/utils/timeline.js +6 -6
  91. package/dist/utils/trace-parser.js +2 -2
  92. package/dist/utils/video-organizer.js +3 -3
  93. package/package.json +1 -1
  94. package/templates/browser-test-automation/result-handler.mjs +4 -39
@@ -1,9 +1,47 @@
1
- import g from"axios";import{homedir as m}from"os";import{join as I}from"path";import{existsSync as _,readFileSync as P}from"fs";import{toJSONSchema as b}from"zod";import{logger as t}from"../../../utils/logger.js";import{DEFAULT_MODELS as d,TIMEOUTS as A}from"../../../constants.js";function S(){if(process.env.OPENAI_PROXY_TOKEN)return t.debug("[Auth] Using OPENAI_PROXY_TOKEN (ECS execution)"),process.env.OPENAI_PROXY_TOKEN;if(process.env.ZIBBY_USER_TOKEN)return t.debug("[Auth] Using ZIBBY_USER_TOKEN (CI/CD PAT)"),process.env.ZIBBY_USER_TOKEN;try{const e=I(m(),".zibby","config.json");if(_(e)){const n=JSON.parse(P(e,"utf-8"));if(n.sessionToken)return t.debug("[Auth] Using session token from zibby login"),n.sessionToken}}catch(e){t.debug(`[Auth] Could not read zibby login session: ${e.message}`)}return null}function N(){return process.env.OPENAI_PROXY_URL?process.env.OPENAI_PROXY_URL.replace(/\/v1\/?$/,""):"https://api-prod.zibby.app/openai-proxy"}function a(e){if(!(typeof e!="object"||e===null)){if(Object.keys(e).length===0){e.type="object",e.additionalProperties=!0;return}if(e.type||(e.properties?e.type="object":e.items&&(e.type="array")),e.type==="object")if(e.properties){for(const[n,o]of Object.entries(e.properties))o.type==="object"&&o.additionalProperties&&o.additionalProperties!==!1&&(!o.properties||Object.keys(o.properties).length===0)&&(e.properties[n]={type:["object","null"]});e.additionalProperties=!1,e.required=Object.keys(e.properties),Object.values(e.properties).forEach(a)}else"additionalProperties"in e||(e.additionalProperties=!0);e.type==="array"&&e.items&&a(e.items),e.anyOf&&e.anyOf.forEach(a),e.oneOf&&e.oneOf.forEach(a),e.allOf&&e.allOf.forEach(a)}}async function v(e,n){t.info("\u{1F527} [OpenAI Proxy] Formatting structured output...");const o=S();if(!o)throw new Error("Authentication required for structured output processing.\n Local development: Run `zibby login`\n CI/CD: Set ZIBBY_USER_TOKEN environment variable (Personal Access Token from UI settings)");const u=N();t.info(`\u{1F517} Using OpenAI proxy: ${u}`);const i=b(n);let s=i;if(i.$ref&&i.definitions){const r=i.$ref.split("/").pop();s=i.definitions[r]||i,t.debug(`Extracted schema from $ref: ${r}`)}delete s.$schema,a(s);const c=4e5;let l=e;e.length>c&&(t.warn(`\u26A0\uFE0F [OpenAI Proxy] Raw text (${e.length} chars) exceeds limit, keeping last ${c} chars`),l=`... [truncated early content] ...
2
- ${e.slice(-c)}`);const O=`Extract and format the following information into structured JSON matching the schema.
1
+ var Ou=Object.defineProperty;var _e=(e,t)=>{for(var r in t)Ou(e,r,{get:t[r],enumerable:!0})};import od from"axios";import{homedir as ad}from"node:os";import{join as cd}from"node:path";import{existsSync as ud,readFileSync as ld}from"node:fs";var Uu=Object.freeze({status:"aborted"});function u(e,t,r){function n(c,l){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,l);let s=a.prototype,d=Object.keys(s);for(let p=0;p<d.length;p++){let g=d[p];g in c||(c[g]=s[g].bind(c))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function a(c){var l;let s=r?.Parent?new o:this;n(s,c),(l=s._zod).deferred??(l.deferred=[]);for(let d of s._zod.deferred)d();return s}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var V=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},re=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Ke={};function P(e){return e&&Object.assign(Ke,e),Ke}var m={};_e(m,{BIGINT_FORMAT_RANGES:()=>Bt,Class:()=>Rt,NUMBER_FORMAT_RANGES:()=>Kt,aborted:()=>H,allowsEval:()=>Jt,assert:()=>Eu,assertEqual:()=>Zu,assertIs:()=>Tu,assertNever:()=>Nu,assertNotEqual:()=>Du,assignProp:()=>q,base64ToUint8Array:()=>Si,base64urlToUint8Array:()=>Qu,cached:()=>ue,captureStackTrace:()=>Ge,cleanEnum:()=>Hu,cleanRegex:()=>be,clone:()=>N,cloneDef:()=>Lu,createTransparentProxy:()=>Mu,defineLazy:()=>b,esc:()=>Be,escapeRegex:()=>R,extend:()=>Gu,finalizeIssue:()=>D,floatSafeRemainder:()=>Ct,getElementAtPath:()=>Ru,getEnumValues:()=>xe,getLengthableOrigin:()=>Ie,getParsedType:()=>Vu,getSizableOrigin:()=>ze,hexToUint8Array:()=>tl,isObject:()=>ne,isPlainObject:()=>Y,issue:()=>le,joinValues:()=>$,jsonStringifyReplacer:()=>ce,merge:()=>Xu,mergeDefs:()=>B,normalizeParams:()=>f,nullish:()=>X,numKeys:()=>Ju,objectClone:()=>Au,omit:()=>Bu,optionalKeys:()=>Mt,parsedType:()=>_,partial:()=>qu,pick:()=>Ku,prefixIssues:()=>E,primitiveTypes:()=>Vt,promiseAllObject:()=>Cu,propertyKeyTypes:()=>ke,randomString:()=>Fu,required:()=>Yu,safeExtend:()=>Wu,shallowClone:()=>Ii,slugify:()=>Ft,stringifyPrimitive:()=>h,uint8ArrayToBase64:()=>wi,uint8ArrayToBase64url:()=>el,uint8ArrayToHex:()=>rl,unwrapMessage:()=>ye});function Zu(e){return e}function Du(e){return e}function Tu(e){}function Nu(e){throw new Error("Unexpected value in exhaustive check")}function Eu(e){}function xe(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function $(e,t="|"){return e.map(r=>h(r)).join(t)}function ce(e,t){return typeof t=="bigint"?t.toString():t}function ue(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function X(e){return e==null}function be(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ct(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(i=Number.parseInt(l[1]))}let o=r>i?r:i,a=Number.parseInt(e.toFixed(o).replace(".","")),c=Number.parseInt(t.toFixed(o).replace(".",""));return a%c/10**o}var zi=Symbol("evaluating");function b(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==zi)return n===void 0&&(n=zi,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Au(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function q(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function B(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Lu(e){return B(e._zod.def)}function Ru(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Cu(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=n[o];return i})}function Fu(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Be(e){return JSON.stringify(e)}function Ft(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ge="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Jt=ue(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Y(e){if(ne(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ne(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ii(e){return Y(e)?{...e}:Array.isArray(e)?[...e]:e}function Ju(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Vu=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}`)}},ke=new Set(["string","number","symbol"]),Vt=new Set(["string","number","bigint","boolean","symbol","undefined"]);function R(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function N(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function f(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 Mu(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,o){return t??(t=e()),Reflect.set(t,n,i,o)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function h(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Mt(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Kt={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]},Bt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ku(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=B(e._zod.def,{get shape(){let a={};for(let c in t){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(a[c]=r.shape[c])}return q(this,"shape",a),a},checks:[]});return N(e,o)}function Bu(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=B(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let c in t){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete a[c]}return q(this,"shape",a),a},checks:[]});return N(e,o)}function Gu(e,t){if(!Y(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=B(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return q(this,"shape",o),o}});return N(e,i)}function Wu(e,t){if(!Y(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=B(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return q(this,"shape",n),n}});return N(e,r)}function Xu(e,t){let r=B(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return q(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return N(e,r)}function qu(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=B(t._zod.def,{get shape(){let c=t._zod.def.shape,l={...c};if(r)for(let s in r){if(!(s in c))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(l[s]=e?new e({type:"optional",innerType:c[s]}):c[s])}else for(let s in c)l[s]=e?new e({type:"optional",innerType:c[s]}):c[s];return q(this,"shape",l),l},checks:[]});return N(t,a)}function Yu(e,t,r){let n=B(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(o[a]=new e({type:"nonoptional",innerType:i[a]}))}else for(let a in i)o[a]=new e({type:"nonoptional",innerType:i[a]});return q(this,"shape",o),o}});return N(t,n)}function H(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function E(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ye(e){return typeof e=="string"?e:e?.message}function D(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=ye(e.inst?._zod.def?.error?.(e))??ye(t?.error?.(e))??ye(r.customError?.(e))??ye(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function ze(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ie(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function _(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function le(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Hu(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Si(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function wi(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Qu(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Si(t+r)}function el(e){return wi(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function tl(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function rl(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Rt=class{constructor(...t){}};var ji=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ce,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},We=u("$ZodError",ji),Se=u("$ZodError",ji,{Parent:Error});function Gt(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function Wt(e,t=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let a=r,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return n(e),r}var we=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new V;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(l=>D(l,o,P())));throw Ge(c,i?.callee),c}return a.value},Xt=we(Se),je=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(l=>D(l,o,P())));throw Ge(c,i?.callee),c}return a.value},qt=je(Se),Pe=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new V;return o.issues.length?{success:!1,error:new(e??We)(o.issues.map(a=>D(a,i,P())))}:{success:!0,data:o.value}},Pi=Pe(Se),Oe=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>D(a,i,P())))}:{success:!0,data:o.value}},Oi=Oe(Se),Ui=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return we(e)(t,r,i)};var Zi=e=>(t,r,n)=>we(e)(t,r,n);var Di=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return je(e)(t,r,i)};var Ti=e=>async(t,r,n)=>je(e)(t,r,n);var Ni=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Pe(e)(t,r,i)};var Ei=e=>(t,r,n)=>Pe(e)(t,r,n);var Ai=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Oe(e)(t,r,i)};var Li=e=>async(t,r,n)=>Oe(e)(t,r,n);var M={};_e(M,{base64:()=>mr,base64url:()=>Xe,bigint:()=>hr,boolean:()=>yr,browserEmail:()=>dl,cidrv4:()=>sr,cidrv6:()=>dr,cuid:()=>Yt,cuid2:()=>Ht,date:()=>fr,datetime:()=>vr,domain:()=>fl,duration:()=>nr,e164:()=>pr,email:()=>or,emoji:()=>ar,extendedDuration:()=>il,guid:()=>ir,hex:()=>gl,hostname:()=>pl,html5Email:()=>ul,idnEmail:()=>sl,integer:()=>_r,ipv4:()=>cr,ipv6:()=>ur,ksuid:()=>tr,lowercase:()=>kr,mac:()=>lr,md5_base64:()=>$l,md5_base64url:()=>hl,md5_hex:()=>vl,nanoid:()=>rr,null:()=>xr,number:()=>qe,rfc5322Email:()=>ll,sha1_base64:()=>yl,sha1_base64url:()=>xl,sha1_hex:()=>_l,sha256_base64:()=>kl,sha256_base64url:()=>zl,sha256_hex:()=>bl,sha384_base64:()=>Sl,sha384_base64url:()=>wl,sha384_hex:()=>Il,sha512_base64:()=>Pl,sha512_base64url:()=>Ol,sha512_hex:()=>jl,string:()=>$r,time:()=>gr,ulid:()=>Qt,undefined:()=>br,unicodeEmail:()=>Ri,uppercase:()=>zr,uuid:()=>ie,uuid4:()=>ol,uuid6:()=>al,uuid7:()=>cl,xid:()=>er});var Yt=/^[cC][^\s-]{8,}$/,Ht=/^[0-9a-z]+$/,Qt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,er=/^[0-9a-vA-V]{20}$/,tr=/^[A-Za-z0-9]{27}$/,rr=/^[a-zA-Z0-9_-]{21}$/,nr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,il=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ir=/^([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})$/,ie=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)$/,ol=ie(4),al=ie(6),cl=ie(7),or=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ul=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ll=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Ri=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,sl=Ri,dl=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ml="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ar(){return new RegExp(ml,"u")}var cr=/^(?:(?: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])$/,ur=/^(([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}|:))$/,lr=e=>{let t=R(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},sr=/^((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])$/,dr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xe=/^[A-Za-z0-9_-]*$/,pl=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,fl=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,pr=/^\+[1-9]\d{6,14}$/,Ci="(?:(?:\\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])))",fr=new RegExp(`^${Ci}$`);function Fi(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gr(e){return new RegExp(`^${Fi(e)}$`)}function vr(e){let t=Fi({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Ci}T(?:${n})$`)}var $r=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},hr=/^-?\d+n?$/,_r=/^-?\d+$/,qe=/^-?\d+(?:\.\d+)?$/,yr=/^(?:true|false)$/i,xr=/^null$/i;var br=/^undefined$/i;var kr=/^[^A-Z]*$/,zr=/^[^a-z]*$/,gl=/^[0-9a-fA-F]*$/;function Ue(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Ze(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var vl=/^[0-9a-fA-F]{32}$/,$l=Ue(22,"=="),hl=Ze(22),_l=/^[0-9a-fA-F]{40}$/,yl=Ue(27,"="),xl=Ze(27),bl=/^[0-9a-fA-F]{64}$/,kl=Ue(43,"="),zl=Ze(43),Il=/^[0-9a-fA-F]{96}$/,Sl=Ue(64,""),wl=Ze(64),jl=/^[0-9a-fA-F]{128}$/,Pl=Ue(86,"=="),Ol=Ze(86);var S=u("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Vi={number:"number",bigint:"bigint",object:"date"},Ir=u("$ZodCheckLessThan",(e,t)=>{S.init(e,t);let r=Vi[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sr=u("$ZodCheckGreaterThan",(e,t)=>{S.init(e,t);let r=Vi[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Mi=u("$ZodCheckMultipleOf",(e,t)=>{S.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Ct(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ki=u("$ZodCheckNumberFormat",(e,t)=>{S.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Kt[t.format];e._zod.onattach.push(a=>{let c=a._zod.bag;c.format=t.format,c.minimum=i,c.maximum=o,r&&(c.pattern=_r)}),e._zod.check=a=>{let c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<i&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),c>o&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Bi=u("$ZodCheckBigIntFormat",(e,t)=>{S.init(e,t);let[r,n]=Bt[t.format];e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,o.minimum=r,o.maximum=n}),e._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Gi=u("$ZodCheckMaxSize",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:ze(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Wi=u("$ZodCheckMinSize",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:ze(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Xi=u("$ZodCheckSizeEquals",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,o=i.size;if(o===t.size)return;let a=o>t.size;n.issues.push({origin:ze(i),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),qi=u("$ZodCheckMaxLength",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let a=Ie(i);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Yi=u("$ZodCheckMinLength",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let a=Ie(i);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Hi=u("$ZodCheckLengthEquals",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,o=i.length;if(o===t.length)return;let a=Ie(i),c=o>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),De=u("$ZodCheckStringFormat",(e,t)=>{var r,n;S.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Qi=u("$ZodCheckRegex",(e,t)=>{De.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),eo=u("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=kr),De.init(e,t)}),to=u("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zr),De.init(e,t)}),ro=u("$ZodCheckIncludes",(e,t)=>{S.init(e,t);let r=R(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),no=u("$ZodCheckStartsWith",(e,t)=>{S.init(e,t);let r=new RegExp(`^${R(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),io=u("$ZodCheckEndsWith",(e,t)=>{S.init(e,t);let r=new RegExp(`.*${R(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function Ji(e,t,r){e.issues.length&&t.issues.push(...E(r,e.issues))}var oo=u("$ZodCheckProperty",(e,t)=>{S.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>Ji(i,r,t.property));Ji(n,r,t.property)}}),ao=u("$ZodCheckMimeType",(e,t)=>{S.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),co=u("$ZodCheckOverwrite",(e,t)=>{S.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ye=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
2
+ `).filter(a=>a),i=Math.min(...n.map(a=>a.length-a.trimStart().length)),o=n.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let t=Function,r=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...r,i.join(`
3
+ `))}};var lo={major:4,minor:3,patch:6};var y=u("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=lo;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{let s=H(a),d;for(let p of c){if(p._zod.def.when){if(!p._zod.def.when(a))continue}else if(s)continue;let g=a.issues.length,v=p._zod.check(a);if(v instanceof Promise&&l?.async===!1)throw new V;if(d||v instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await v,a.issues.length!==g&&(s||(s=H(a,g)))});else{if(a.issues.length===g)continue;s||(s=H(a,g))}}return d?d.then(()=>a):a},o=(a,c,l)=>{if(H(a))return a.aborted=!0,a;let s=i(c,n,l);if(s instanceof Promise){if(l.async===!1)throw new V;return s.then(d=>e._zod.parse(d,l))}return e._zod.parse(s,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let s=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return s instanceof Promise?s.then(d=>o(d,a,c)):o(s,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new V;return l.then(s=>i(s,n,c))}return i(l,n,c)}}b(e,"~standard",()=>({validate:i=>{try{let o=Pi(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Oi(e,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),se=u("$ZodString",(e,t)=>{y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$r(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),z=u("$ZodStringFormat",(e,t)=>{De.init(e,t),se.init(e,t)}),bo=u("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ir),z.init(e,t)}),ko=u("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ie(n))}else t.pattern??(t.pattern=ie());z.init(e,t)}),zo=u("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=or),z.init(e,t)}),Io=u("$ZodURL",(e,t)=>{z.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),So=u("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ar()),z.init(e,t)}),wo=u("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=rr),z.init(e,t)}),jo=u("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Yt),z.init(e,t)}),Po=u("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ht),z.init(e,t)}),Oo=u("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Qt),z.init(e,t)}),Uo=u("$ZodXID",(e,t)=>{t.pattern??(t.pattern=er),z.init(e,t)}),Zo=u("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=tr),z.init(e,t)}),Do=u("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=vr(t)),z.init(e,t)}),To=u("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=fr),z.init(e,t)}),No=u("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=gr(t)),z.init(e,t)}),Eo=u("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=nr),z.init(e,t)}),Ao=u("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=cr),z.init(e,t),e._zod.bag.format="ipv4"}),Lo=u("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ur),z.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Ro=u("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=lr(t.delimiter)),z.init(e,t),e._zod.bag.format="mac"}),Co=u("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=sr),z.init(e,t)}),Fo=u("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=dr),z.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Jo(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Vo=u("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mr),z.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Jo(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Ul(e){if(!Xe.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Jo(r)}var Mo=u("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Xe),z.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Ul(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ko=u("$ZodE164",(e,t)=>{t.pattern??(t.pattern=pr),z.init(e,t)});function Zl(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var Bo=u("$ZodJWT",(e,t)=>{z.init(e,t),e._zod.check=r=>{Zl(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Go=u("$ZodCustomStringFormat",(e,t)=>{z.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),jr=u("$ZodNumber",(e,t)=>{y.init(e,t),e._zod.pattern=e._zod.bag.pattern??qe,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),Wo=u("$ZodNumberFormat",(e,t)=>{Ki.init(e,t),jr.init(e,t)}),nt=u("$ZodBoolean",(e,t)=>{y.init(e,t),e._zod.pattern=yr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Pr=u("$ZodBigInt",(e,t)=>{y.init(e,t),e._zod.pattern=hr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Xo=u("$ZodBigIntFormat",(e,t)=>{Bi.init(e,t),Pr.init(e,t)}),qo=u("$ZodSymbol",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:e}),r}}),Yo=u("$ZodUndefined",(e,t)=>{y.init(e,t),e._zod.pattern=br,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),r}}),Ho=u("$ZodNull",(e,t)=>{y.init(e,t),e._zod.pattern=xr,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),Qo=u("$ZodAny",(e,t)=>{y.init(e,t),e._zod.parse=r=>r}),ea=u("$ZodUnknown",(e,t)=>{y.init(e,t),e._zod.parse=r=>r}),ta=u("$ZodNever",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),ra=u("$ZodVoid",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),na=u("$ZodDate",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),r}});function so(e,t,r){e.issues.length&&t.issues.push(...E(r,e.issues)),t.value[r]=e.value}var ia=u("$ZodArray",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let a=0;a<i.length;a++){let c=i[a],l=t.element._zod.run({value:c,issues:[]},n);l instanceof Promise?o.push(l.then(s=>so(s,r,a))):so(l,r,a)}return o.length?Promise.all(o).then(()=>r):r}});function rt(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...E(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function oa(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Mt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function aa(e,t,r,n,i,o){let a=[],c=i.keySet,l=i.catchall._zod,s=l.def.type,d=l.optout==="optional";for(let p in t){if(c.has(p))continue;if(s==="never"){a.push(p);continue}let g=l.run({value:t[p],issues:[]},n);g instanceof Promise?e.push(g.then(v=>rt(v,r,p,t,d))):rt(g,r,p,t,d)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var Dl=u("$ZodObject",(e,t)=>{if(y.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...c};return Object.defineProperty(t,"shape",{value:l}),l}})}let n=ue(()=>oa(t));b(e._zod,"propValues",()=>{let c=t.shape,l={};for(let s in c){let d=c[s]._zod;if(d.values){l[s]??(l[s]=new Set);for(let p of d.values)l[s].add(p)}}return l});let i=ne,o=t.catchall,a;e._zod.parse=(c,l)=>{a??(a=n.value);let s=c.value;if(!i(s))return c.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),c;c.value={};let d=[],p=a.shape;for(let g of a.keys){let v=p[g],j=v._zod.optout==="optional",w=v._zod.run({value:s[g],issues:[]},l);w instanceof Promise?d.push(w.then(Me=>rt(Me,c,g,s,j))):rt(w,c,g,s,j)}return o?aa(d,s,c,l,n.value,e):d.length?Promise.all(d).then(()=>c):c}}),ca=u("$ZodObjectJIT",(e,t)=>{Dl.init(e,t);let r=e._zod.parse,n=ue(()=>oa(t)),i=g=>{let v=new Ye(["shape","payload","ctx"]),j=n.value,w=J=>{let Z=Be(J);return`shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`};v.write("const input = payload.value;");let Me=Object.create(null),wu=0;for(let J of j.keys)Me[J]=`key_${wu++}`;v.write("const newResult = {};");for(let J of j.keys){let Z=Me[J],C=Be(J),Pu=g[J]?._zod?.optout==="optional";v.write(`const ${Z} = ${w(J)};`),Pu?v.write(`
4
+ if (${Z}.issues.length) {
5
+ if (${C} in input) {
6
+ payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
7
+ ...iss,
8
+ path: iss.path ? [${C}, ...iss.path] : [${C}]
9
+ })));
10
+ }
11
+ }
12
+
13
+ if (${Z}.value === undefined) {
14
+ if (${C} in input) {
15
+ newResult[${C}] = undefined;
16
+ }
17
+ } else {
18
+ newResult[${C}] = ${Z}.value;
19
+ }
20
+
21
+ `):v.write(`
22
+ if (${Z}.issues.length) {
23
+ payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
24
+ ...iss,
25
+ path: iss.path ? [${C}, ...iss.path] : [${C}]
26
+ })));
27
+ }
28
+
29
+ if (${Z}.value === undefined) {
30
+ if (${C} in input) {
31
+ newResult[${C}] = undefined;
32
+ }
33
+ } else {
34
+ newResult[${C}] = ${Z}.value;
35
+ }
36
+
37
+ `)}v.write("payload.value = newResult;"),v.write("return payload;");let ju=v.compile();return(J,Z)=>ju(g,J,Z)},o,a=ne,c=!Ke.jitless,s=c&&Jt.value,d=t.catchall,p;e._zod.parse=(g,v)=>{p??(p=n.value);let j=g.value;return a(j)?c&&s&&v?.async===!1&&v.jitless!==!0?(o||(o=i(t.shape)),g=o(g,v),d?aa([],j,g,v,p,e):g):r(g,v):(g.issues.push({expected:"object",code:"invalid_type",input:j,inst:e}),g)}});function mo(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter(o=>!H(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>D(a,n,P())))}),t)}var it=u("$ZodUnion",(e,t)=>{y.init(e,t),b(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),b(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),b(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),b(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>be(o.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,c=[];for(let l of t.options){let s=l._zod.run({value:i.value,issues:[]},o);if(s instanceof Promise)c.push(s),a=!0;else{if(s.issues.length===0)return s;c.push(s)}}return a?Promise.all(c).then(l=>mo(l,i,e,o)):mo(c,i,e,o)}});function po(e,t,r,n){let i=e.filter(o=>o.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>D(a,n,P())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var ua=u("$ZodXor",(e,t)=>{it.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,c=[];for(let l of t.options){let s=l._zod.run({value:i.value,issues:[]},o);s instanceof Promise?(c.push(s),a=!0):c.push(s)}return a?Promise.all(c).then(l=>po(l,i,e,o)):po(c,i,e,o)}}),la=u("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,it.init(e,t);let r=e._zod.parse;b(e._zod,"propValues",()=>{let i={};for(let o of t.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[c,l]of Object.entries(a)){i[c]||(i[c]=new Set);for(let s of l)i[c].add(s)}}return i});let n=ue(()=>{let i=t.options,o=new Map;for(let a of i){let c=a._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let l of c){if(o.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);o.set(l,a)}}return o});e._zod.parse=(i,o)=>{let a=i.value;if(!ne(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let c=n.value.get(a?.[t.discriminator]);return c?c._zod.run(i,o):t.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),i)}}),sa=u("$ZodIntersection",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value,o=t.left._zod.run({value:i,issues:[]},n),a=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([l,s])=>fo(r,l,s)):fo(r,o,a)}});function wr(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(Y(e)&&Y(t)){let r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),i={...e,...t};for(let o of n){let a=wr(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],o=t[n],a=wr(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function fo(e,t,r){let n=new Map,i;for(let c of t.issues)if(c.code==="unrecognized_keys"){i??(i=c);for(let l of c.keys)n.has(l)||n.set(l,{}),n.get(l).l=!0}else e.issues.push(c);for(let c of r.issues)if(c.code==="unrecognized_keys")for(let l of c.keys)n.has(l)||n.set(l,{}),n.get(l).r=!0;else e.issues.push(c);let o=[...n].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(o.length&&i&&e.issues.push({...i,keys:o}),H(e))return e;let a=wr(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Or=u("$ZodTuple",(e,t)=>{y.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],c=[...r].reverse().findIndex(d=>d._zod.optin!=="optional"),l=c===-1?0:r.length-c;if(!t.rest){let d=o.length>r.length,p=o.length<l-1;if(d||p)return n.issues.push({...d?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:o,inst:e,origin:"array"}),n}let s=-1;for(let d of r){if(s++,s>=o.length&&s>=l)continue;let p=d._zod.run({value:o[s],issues:[]},i);p instanceof Promise?a.push(p.then(g=>He(g,n,s))):He(p,n,s)}if(t.rest){let d=o.slice(r.length);for(let p of d){s++;let g=t.rest._zod.run({value:p,issues:[]},i);g instanceof Promise?a.push(g.then(v=>He(v,n,s))):He(g,n,s)}}return a.length?Promise.all(a).then(()=>n):n}});function He(e,t,r){e.issues.length&&t.issues.push(...E(r,e.issues)),t.value[r]=e.value}var da=u("$ZodRecord",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Y(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let o=[],a=t.keyType._zod.values;if(a){r.value={};let c=new Set;for(let s of a)if(typeof s=="string"||typeof s=="number"||typeof s=="symbol"){c.add(typeof s=="number"?s.toString():s);let d=t.valueType._zod.run({value:i[s],issues:[]},n);d instanceof Promise?o.push(d.then(p=>{p.issues.length&&r.issues.push(...E(s,p.issues)),r.value[s]=p.value})):(d.issues.length&&r.issues.push(...E(s,d.issues)),r.value[s]=d.value)}let l;for(let s in i)c.has(s)||(l=l??[],l.push(s));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l})}else{r.value={};for(let c of Reflect.ownKeys(i)){if(c==="__proto__")continue;let l=t.keyType._zod.run({value:c,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&qe.test(c)&&l.issues.length){let p=t.keyType._zod.run({value:Number(c),issues:[]},n);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(l=p)}if(l.issues.length){t.mode==="loose"?r.value[c]=i[c]:r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(p=>D(p,n,P())),input:c,path:[c],inst:e});continue}let d=t.valueType._zod.run({value:i[c],issues:[]},n);d instanceof Promise?o.push(d.then(p=>{p.issues.length&&r.issues.push(...E(c,p.issues)),r.value[l.value]=p.value})):(d.issues.length&&r.issues.push(...E(c,d.issues)),r.value[l.value]=d.value)}}return o.length?Promise.all(o).then(()=>r):r}}),ma=u("$ZodMap",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let o=[];r.value=new Map;for(let[a,c]of i){let l=t.keyType._zod.run({value:a,issues:[]},n),s=t.valueType._zod.run({value:c,issues:[]},n);l instanceof Promise||s instanceof Promise?o.push(Promise.all([l,s]).then(([d,p])=>{go(d,p,r,a,i,e,n)})):go(l,s,r,a,i,e,n)}return o.length?Promise.all(o).then(()=>r):r}});function go(e,t,r,n,i,o,a){e.issues.length&&(ke.has(typeof n)?r.issues.push(...E(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:e.issues.map(c=>D(c,a,P()))})),t.issues.length&&(ke.has(typeof n)?r.issues.push(...E(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:n,issues:t.issues.map(c=>D(c,a,P()))})),r.value.set(e.value,t.value)}var pa=u("$ZodSet",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let o=[];r.value=new Set;for(let a of i){let c=t.valueType._zod.run({value:a,issues:[]},n);c instanceof Promise?o.push(c.then(l=>vo(l,r))):vo(c,r)}return o.length?Promise.all(o).then(()=>r):r}});function vo(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var fa=u("$ZodEnum",(e,t)=>{y.init(e,t);let r=xe(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>ke.has(typeof i)).map(i=>typeof i=="string"?R(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{let a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:r,input:a,inst:e}),i}}),ga=u("$ZodLiteral",(e,t)=>{if(y.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?R(n):n?R(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),va=u("$ZodFile",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return i instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:i,inst:e}),r}}),$a=u("$ZodTransform",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new re(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(r.value=a,r));if(i instanceof Promise)throw new V;return r.value=i,r}});function $o(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Ur=u("$ZodOptional",(e,t)=>{y.init(e,t),e._zod.optin="optional",e._zod.optout="optional",b(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),b(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${be(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>$o(o,r.value)):$o(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),ha=u("$ZodExactOptional",(e,t)=>{Ur.init(e,t),b(e._zod,"values",()=>t.innerType._zod.values),b(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),_a=u("$ZodNullable",(e,t)=>{y.init(e,t),b(e._zod,"optin",()=>t.innerType._zod.optin),b(e._zod,"optout",()=>t.innerType._zod.optout),b(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${be(r.source)}|null)$`):void 0}),b(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ya=u("$ZodDefault",(e,t)=>{y.init(e,t),e._zod.optin="optional",b(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>ho(o,t)):ho(i,t)}});function ho(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var xa=u("$ZodPrefault",(e,t)=>{y.init(e,t),e._zod.optin="optional",b(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),ba=u("$ZodNonOptional",(e,t)=>{y.init(e,t),b(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>_o(o,e)):_o(i,e)}});function _o(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var ka=u("$ZodSuccess",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new re("ZodSuccess");let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.issues.length===0,r)):(r.value=i.issues.length===0,r)}}),za=u("$ZodCatch",(e,t)=>{y.init(e,t),b(e._zod,"optin",()=>t.innerType._zod.optin),b(e._zod,"optout",()=>t.innerType._zod.optout),b(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(a=>D(a,n,P()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(o=>D(o,n,P()))},input:r.value}),r.issues=[]),r)}}),Ia=u("$ZodNaN",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Sa=u("$ZodPipe",(e,t)=>{y.init(e,t),b(e._zod,"values",()=>t.in._zod.values),b(e._zod,"optin",()=>t.in._zod.optin),b(e._zod,"optout",()=>t.out._zod.optout),b(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>Qe(a,t.in,n)):Qe(o,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(o=>Qe(o,t.out,n)):Qe(i,t.out,n)}});function Qe(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var ot=u("$ZodCodec",(e,t)=>{y.init(e,t),b(e._zod,"values",()=>t.in._zod.values),b(e._zod,"optin",()=>t.in._zod.optin),b(e._zod,"optout",()=>t.out._zod.optout),b(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(a=>et(a,t,n)):et(o,t,n)}else{let o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>et(a,t,n)):et(o,t,n)}}});function et(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let i=t.transform(e.value,e);return i instanceof Promise?i.then(o=>tt(e,o,t.out,r)):tt(e,i,t.out,r)}else{let i=t.reverseTransform(e.value,e);return i instanceof Promise?i.then(o=>tt(e,o,t.in,r)):tt(e,i,t.in,r)}}function tt(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var wa=u("$ZodReadonly",(e,t)=>{y.init(e,t),b(e._zod,"propValues",()=>t.innerType._zod.propValues),b(e._zod,"values",()=>t.innerType._zod.values),b(e._zod,"optin",()=>t.innerType?._zod?.optin),b(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(yo):yo(i)}});function yo(e){return e.value=Object.freeze(e.value),e}var ja=u("$ZodTemplateLiteral",(e,t)=>{y.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let i=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let o=i.startsWith("^")?1:0,a=i.endsWith("$")?i.length-1:i.length;r.push(i.slice(o,a))}else if(n===null||Vt.has(typeof n))r.push(R(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,i)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Pa=u("$ZodFunction",(e,t)=>(y.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let i=e._def.input?Xt(e._def.input,n):n,o=Reflect.apply(r,this,i);return e._def.output?Xt(e._def.output,o):o}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let i=e._def.input?await qt(e._def.input,n):n,o=await Reflect.apply(r,this,i);return e._def.output?await qt(e._def.output,o):o}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Or({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Oa=u("$ZodPromise",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(i=>t.innerType._zod.run({value:i,issues:[]},n))}),Ua=u("$ZodLazy",(e,t)=>{y.init(e,t),b(e._zod,"innerType",()=>t.getter()),b(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),b(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),b(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),b(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Za=u("$ZodCustom",(e,t)=>{S.init(e,t),y.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(o=>xo(o,r,n,e));xo(i,r,n,e)}});function xo(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(le(i))}}var Nl=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=_(i.input),c=n[a]??a;return`Invalid input: expected ${o}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${h(i.values[0])}`:`Invalid option: expected one of ${$(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${o}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${o}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.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":""}: ${$(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Zr(){return{localeError:Nl()}}var Ta;var Dr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Na(){return new Dr}(Ta=globalThis).__zod_globalRegistry??(Ta.__zod_globalRegistry=Na());var T=globalThis.__zod_globalRegistry;function Ea(e,t){return new e({type:"string",...f(t)})}function Tr(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...f(t)})}function at(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...f(t)})}function Nr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...f(t)})}function Er(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f(t)})}function Ar(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f(t)})}function Lr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f(t)})}function ct(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...f(t)})}function Rr(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...f(t)})}function Cr(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...f(t)})}function Fr(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...f(t)})}function Jr(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...f(t)})}function Vr(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...f(t)})}function Mr(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...f(t)})}function Kr(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...f(t)})}function Br(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...f(t)})}function Gr(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...f(t)})}function Aa(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...f(t)})}function Wr(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f(t)})}function Xr(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f(t)})}function qr(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...f(t)})}function Yr(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...f(t)})}function Hr(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...f(t)})}function Qr(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...f(t)})}function La(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(t)})}function Ra(e,t){return new e({type:"string",format:"date",check:"string_format",...f(t)})}function Ca(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...f(t)})}function Fa(e,t){return new e({type:"string",format:"duration",check:"string_format",...f(t)})}function Ja(e,t){return new e({type:"number",checks:[],...f(t)})}function Va(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...f(t)})}function Ma(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...f(t)})}function Ka(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...f(t)})}function Ba(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...f(t)})}function Ga(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...f(t)})}function Wa(e,t){return new e({type:"boolean",...f(t)})}function Xa(e,t){return new e({type:"bigint",...f(t)})}function qa(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...f(t)})}function Ya(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...f(t)})}function Ha(e,t){return new e({type:"symbol",...f(t)})}function Qa(e,t){return new e({type:"undefined",...f(t)})}function ec(e,t){return new e({type:"null",...f(t)})}function tc(e){return new e({type:"any"})}function rc(e){return new e({type:"unknown"})}function nc(e,t){return new e({type:"never",...f(t)})}function ic(e,t){return new e({type:"void",...f(t)})}function oc(e,t){return new e({type:"date",...f(t)})}function ac(e,t){return new e({type:"nan",...f(t)})}function Q(e,t){return new Ir({check:"less_than",...f(t),value:e,inclusive:!1})}function F(e,t){return new Ir({check:"less_than",...f(t),value:e,inclusive:!0})}function ee(e,t){return new Sr({check:"greater_than",...f(t),value:e,inclusive:!1})}function A(e,t){return new Sr({check:"greater_than",...f(t),value:e,inclusive:!0})}function cc(e){return ee(0,e)}function uc(e){return Q(0,e)}function lc(e){return F(0,e)}function sc(e){return A(0,e)}function de(e,t){return new Mi({check:"multiple_of",...f(t),value:e})}function me(e,t){return new Gi({check:"max_size",...f(t),maximum:e})}function te(e,t){return new Wi({check:"min_size",...f(t),minimum:e})}function Te(e,t){return new Xi({check:"size_equals",...f(t),size:e})}function Ne(e,t){return new qi({check:"max_length",...f(t),maximum:e})}function oe(e,t){return new Yi({check:"min_length",...f(t),minimum:e})}function Ee(e,t){return new Hi({check:"length_equals",...f(t),length:e})}function ut(e,t){return new Qi({check:"string_format",format:"regex",...f(t),pattern:e})}function lt(e){return new eo({check:"string_format",format:"lowercase",...f(e)})}function st(e){return new to({check:"string_format",format:"uppercase",...f(e)})}function dt(e,t){return new ro({check:"string_format",format:"includes",...f(t),includes:e})}function mt(e,t){return new no({check:"string_format",format:"starts_with",...f(t),prefix:e})}function pt(e,t){return new io({check:"string_format",format:"ends_with",...f(t),suffix:e})}function dc(e,t,r){return new oo({check:"property",property:e,schema:t,...f(r)})}function ft(e,t){return new ao({check:"mime_type",mime:e,...f(t)})}function G(e){return new co({check:"overwrite",tx:e})}function gt(e){return G(t=>t.normalize(e))}function vt(){return G(e=>e.trim())}function $t(){return G(e=>e.toLowerCase())}function ht(){return G(e=>e.toUpperCase())}function _t(){return G(e=>Ft(e))}function mc(e,t,r){return new e({type:"array",element:t,...f(r)})}function pc(e,t){return new e({type:"file",...f(t)})}function fc(e,t,r){let n=f(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function gc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...f(r)})}function vc(e){let t=Rl(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(le(n,r.value,t._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(le(i))}},e(r.value,r)));return t}function Rl(e,t){let r=new S({check:"custom",...f(t)});return r._zod.check=e,r}function $c(e){let t=new S({check:"describe"});return t._zod.onattach=[r=>{let n=T.get(r)??{};T.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function hc(e){let t=new S({check:"meta"});return t._zod.onattach=[r=>{let n=T.get(r)??{};T.add(r,{...n,...e})}],t._zod.check=()=>{},t}function _c(e,t){let r=f(t),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(v=>typeof v=="string"?v.toLowerCase():v),i=i.map(v=>typeof v=="string"?v.toLowerCase():v));let o=new Set(n),a=new Set(i),c=e.Codec??ot,l=e.Boolean??nt,s=e.String??se,d=new s({type:"string",error:r.error}),p=new l({type:"boolean",error:r.error}),g=new c({type:"pipe",in:d,out:p,transform:((v,j)=>{let w=v;return r.case!=="sensitive"&&(w=w.toLowerCase()),o.has(w)?!0:a.has(w)?!1:(j.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:j.value,inst:g,continue:!1}),{})}),reverseTransform:((v,j)=>v===!0?n[0]||"true":i[0]||"false"),error:r.error});return g}function Ae(e,t,r,n={}){let i=f(n),o={...f(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:c=>r.test(c),...i};return r instanceof RegExp&&(o.pattern=r),new e(o)}function pe(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??T,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function k(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,d);else{let g=a.schema,v=t.processors[i.type];if(!v)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);v(e,t,g,d)}let p=e._zod.parent;p&&(a.ref||(a.ref=p),k(p,t,d),t.seen.get(p).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&U(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function fe(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let c=e.metadataRegistry.get(a[0])?.id;if(c){let l=n.get(c);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,a[0])}}let i=a=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(a[0])?.id,g=e.external.uri??(j=>j);if(p)return{ref:g(p)};let v=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=v,{defId:v,ref:`${g("__shared")}#/${c}/${v}`}}if(a[1]===r)return{ref:"#"};let s=`#/${c}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:s+d}},o=a=>{if(a[1].schema.$ref)return;let c=a[1],{ref:l,defId:s}=i(a);c.def={...c.schema},s&&(c.defId=s);let d=c.schema;for(let p in d)delete d[p];d.$ref=l};if(e.cycles==="throw")for(let a of e.seen.entries()){let c=a[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
38
+
39
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let c=a[1];if(t===a[0]){o(a);continue}if(e.external){let s=e.external.registry.get(a[0])?.id;if(t!==a[0]&&s){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(c.cycle){o(a);continue}if(c.count>1&&e.reused==="ref"){o(a);continue}}}function ge(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,s={...l},d=c.ref;if(c.ref=null,d){n(d);let g=e.seen.get(d),v=g.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(v)):Object.assign(l,v),Object.assign(l,s),a._zod.parent===d)for(let w in l)w==="$ref"||w==="allOf"||w in s||delete l[w];if(v.$ref&&g.def)for(let w in l)w==="$ref"||w==="allOf"||w in g.def&&JSON.stringify(l[w])===JSON.stringify(g.def[w])&&delete l[w]}let p=a._zod.parent;if(p&&p!==d){n(p);let g=e.seen.get(p);if(g?.schema.$ref&&(l.$ref=g.schema.$ref,g.def))for(let v in l)v==="$ref"||v==="allOf"||v in g.def&&JSON.stringify(l[v])===JSON.stringify(g.def[v])&&delete l[v]}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,r.def??r.schema);let o=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(o[c.defId]=c.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Le(t,"input",e.processors),output:Le(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function U(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return U(n.element,r);if(n.type==="set")return U(n.valueType,r);if(n.type==="lazy")return U(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return U(n.innerType,r);if(n.type==="intersection")return U(n.left,r)||U(n.right,r);if(n.type==="record"||n.type==="map")return U(n.keyType,r)||U(n.valueType,r);if(n.type==="pipe")return U(n.in,r)||U(n.out,r);if(n.type==="object"){for(let i in n.shape)if(U(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(U(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(U(i,r))return!0;return!!(n.rest&&U(n.rest,r))}return!1}var yc=(e,t={})=>r=>{let n=pe({...r,processors:t});return k(e,n),fe(n,e),ge(n,e)},Le=(e,t,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},a=pe({...i??{},target:o,io:t,processors:r});return k(e,a),fe(a,e),ge(a,e)};var Cl={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tn=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:a,format:c,patterns:l,contentEncoding:s}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof a=="number"&&(i.maxLength=a),c&&(i.format=Cl[c]??c,i.format===""&&delete i.format,c==="time"&&delete i.format),s&&(i.contentEncoding=s),l&&l.size>0){let d=[...l];d.length===1?i.pattern=d[0].source:d.length>1&&(i.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},rn=(e,t,r,n)=>{let i=r,{minimum:o,maximum:a,format:c,multipleOf:l,exclusiveMaximum:s,exclusiveMinimum:d}=e._zod.bag;typeof c=="string"&&c.includes("int")?i.type="integer":i.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=d,i.exclusiveMinimum=!0):i.exclusiveMinimum=d),typeof o=="number"&&(i.minimum=o,typeof d=="number"&&t.target!=="draft-04"&&(d>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof s=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=s,i.exclusiveMaximum=!0):i.exclusiveMaximum=s),typeof a=="number"&&(i.maximum=a,typeof s=="number"&&t.target!=="draft-04"&&(s<=a?delete i.maximum:delete i.exclusiveMaximum)),typeof l=="number"&&(i.multipleOf=l)},nn=(e,t,r,n)=>{r.type="boolean"},on=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},an=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},cn=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},un=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},ln=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},sn=(e,t,r,n)=>{r.not={}},dn=(e,t,r,n)=>{},mn=(e,t,r,n)=>{},pn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},fn=(e,t,r,n)=>{let i=e._zod.def,o=xe(i.entries);o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),r.enum=o},gn=(e,t,r,n)=>{let i=e._zod.def,o=[];for(let a of i.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){let a=o[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),o.every(a=>typeof a=="boolean")&&(r.type="boolean"),o.every(a=>a===null)&&(r.type="null"),r.enum=o},vn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},$n=(e,t,r,n)=>{let i=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},hn=(e,t,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:c,mime:l}=e._zod.bag;a!==void 0&&(o.minLength=a),c!==void 0&&(o.maxLength=c),l?l.length===1?(o.contentMediaType=l[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=l.map(s=>({contentMediaType:s}))):Object.assign(i,o)},_n=(e,t,r,n)=>{r.type="boolean"},yn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},xn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},bn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},kn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},zn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},In=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;typeof a=="number"&&(i.minItems=a),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=k(o.element,t,{...n,path:[...n.path,"items"]})},Sn=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object",i.properties={};let a=o.shape;for(let s in a)i.properties[s]=k(a[s],t,{...n,path:[...n.path,"properties",s]});let c=new Set(Object.keys(a)),l=new Set([...c].filter(s=>{let d=o.shape[s]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));l.size>0&&(i.required=Array.from(l)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=k(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},yt=(e,t,r,n)=>{let i=e._zod.def,o=i.inclusive===!1,a=i.options.map((c,l)=>k(c,t,{...n,path:[...n.path,o?"oneOf":"anyOf",l]}));o?r.oneOf=a:r.anyOf=a},wn=(e,t,r,n)=>{let i=e._zod.def,o=k(i.left,t,{...n,path:[...n.path,"allOf",0]}),a=k(i.right,t,{...n,path:[...n.path,"allOf",1]}),c=s=>"allOf"in s&&Object.keys(s).length===1,l=[...c(o)?o.allOf:[o],...c(a)?a.allOf:[a]];r.allOf=l},jn=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((g,v)=>k(g,t,{...n,path:[...n.path,a,v]})),s=o.rest?k(o.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=l,s&&(i.items=s)):t.target==="openapi-3.0"?(i.items={anyOf:l},s&&i.items.anyOf.push(s),i.minItems=l.length,s||(i.maxItems=l.length)):(i.items=l,s&&(i.additionalItems=s));let{minimum:d,maximum:p}=e._zod.bag;typeof d=="number"&&(i.minItems=d),typeof p=="number"&&(i.maxItems=p)},Pn=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object";let a=o.keyType,l=a._zod.bag?.patterns;if(o.mode==="loose"&&l&&l.size>0){let d=k(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let p of l)i.patternProperties[p.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=k(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=k(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let s=a._zod.values;if(s){let d=[...s].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(i.required=d)}},On=(e,t,r,n)=>{let i=e._zod.def,o=k(i.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},Un=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Zn=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},Dn=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Tn=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Nn=(e,t,r,n)=>{let i=e._zod.def,o=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;k(o,t,n);let a=t.seen.get(e);a.ref=o},En=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.readOnly=!0},An=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},xt=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Ln=(e,t,r,n)=>{let i=e._zod.innerType;k(i,t,n);let o=t.seen.get(e);o.ref=i},en={string:tn,number:rn,boolean:nn,bigint:on,symbol:an,null:cn,undefined:un,void:ln,never:sn,any:dn,unknown:mn,date:pn,enum:fn,literal:gn,nan:vn,template_literal:$n,file:hn,success:_n,custom:yn,function:xn,transform:bn,map:kn,set:zn,array:In,object:Sn,union:yt,intersection:wn,tuple:jn,record:Pn,nullable:On,nonoptional:Un,default:Zn,prefault:Dn,catch:Tn,pipe:Nn,readonly:En,promise:An,optional:xt,lazy:Ln};function bt(e,t){if("_idmap"in e){let n=e,i=pe({...t,processors:en}),o={};for(let l of n._idmap.entries()){let[s,d]=l;k(d,i)}let a={},c={registry:n,uri:t?.uri,defs:o};i.external=c;for(let l of n._idmap.entries()){let[s,d]=l;fe(i,d),a[s]=ge(i,d)}if(Object.keys(o).length>0){let l=i.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:o}}return{schemas:a}}let r=pe({...t,processors:en});return k(e,r),fe(r,e),ge(r,e)}var Ce={};_e(Ce,{ZodAny:()=>Fc,ZodArray:()=>Kc,ZodBase64:()=>ui,ZodBase64URL:()=>li,ZodBigInt:()=>Zt,ZodBigIntFormat:()=>mi,ZodBoolean:()=>Ut,ZodCIDRv4:()=>ai,ZodCIDRv6:()=>ci,ZodCUID:()=>Qn,ZodCUID2:()=>ei,ZodCatch:()=>pu,ZodCodec:()=>xi,ZodCustom:()=>At,ZodCustomStringFormat:()=>Je,ZodDate:()=>fi,ZodDefault:()=>cu,ZodDiscriminatedUnion:()=>Gc,ZodE164:()=>si,ZodEmail:()=>qn,ZodEmoji:()=>Yn,ZodEnum:()=>Fe,ZodExactOptional:()=>iu,ZodFile:()=>ru,ZodFunction:()=>bu,ZodGUID:()=>zt,ZodIPv4:()=>ii,ZodIPv6:()=>oi,ZodIntersection:()=>Wc,ZodJWT:()=>di,ZodKSUID:()=>ni,ZodLazy:()=>_u,ZodLiteral:()=>tu,ZodMAC:()=>Tc,ZodMap:()=>Qc,ZodNaN:()=>gu,ZodNanoID:()=>Hn,ZodNever:()=>Vc,ZodNonOptional:()=>_i,ZodNull:()=>Rc,ZodNullable:()=>au,ZodNumber:()=>Ot,ZodNumberFormat:()=>$e,ZodObject:()=>Tt,ZodOptional:()=>hi,ZodPipe:()=>yi,ZodPrefault:()=>lu,ZodPromise:()=>xu,ZodReadonly:()=>vu,ZodRecord:()=>Et,ZodSet:()=>eu,ZodString:()=>jt,ZodStringFormat:()=>I,ZodSuccess:()=>mu,ZodSymbol:()=>Ac,ZodTemplateLiteral:()=>hu,ZodTransform:()=>nu,ZodTuple:()=>qc,ZodType:()=>x,ZodULID:()=>ti,ZodURL:()=>Pt,ZodUUID:()=>W,ZodUndefined:()=>Lc,ZodUnion:()=>Nt,ZodUnknown:()=>Jc,ZodVoid:()=>Mc,ZodXID:()=>ri,ZodXor:()=>Bc,_ZodString:()=>Xn,_default:()=>uu,_function:()=>Ws,any:()=>Ss,array:()=>Dt,base64:()=>ls,base64url:()=>ss,bigint:()=>xs,boolean:()=>Ec,catch:()=>fu,check:()=>Xs,cidrv4:()=>cs,cidrv6:()=>us,codec:()=>Ks,cuid:()=>Ql,cuid2:()=>es,custom:()=>qs,date:()=>js,describe:()=>Ys,discriminatedUnion:()=>Ts,e164:()=>ds,email:()=>Vl,emoji:()=>Yl,enum:()=>vi,exactOptional:()=>ou,file:()=>Fs,float32:()=>$s,float64:()=>hs,function:()=>Ws,guid:()=>Ml,hash:()=>vs,hex:()=>gs,hostname:()=>fs,httpUrl:()=>ql,instanceof:()=>Qs,int:()=>Wn,int32:()=>_s,int64:()=>bs,intersection:()=>Xc,ipv4:()=>is,ipv6:()=>as,json:()=>td,jwt:()=>ms,keyof:()=>Ps,ksuid:()=>ns,lazy:()=>yu,literal:()=>Cs,looseObject:()=>Zs,looseRecord:()=>Es,mac:()=>os,map:()=>As,meta:()=>Hs,nan:()=>Ms,nanoid:()=>Hl,nativeEnum:()=>Rs,never:()=>pi,nonoptional:()=>du,null:()=>Cc,nullable:()=>St,nullish:()=>Js,number:()=>Nc,object:()=>Os,optional:()=>It,partialRecord:()=>Ns,pipe:()=>wt,prefault:()=>su,preprocess:()=>rd,promise:()=>Gs,readonly:()=>$u,record:()=>Hc,refine:()=>ku,set:()=>Ls,strictObject:()=>Us,string:()=>Gn,stringFormat:()=>ps,stringbool:()=>ed,success:()=>Vs,superRefine:()=>zu,symbol:()=>zs,templateLiteral:()=>Bs,transform:()=>$i,tuple:()=>Yc,uint32:()=>ys,uint64:()=>ks,ulid:()=>ts,undefined:()=>Is,union:()=>gi,unknown:()=>ve,url:()=>Xl,uuid:()=>Kl,uuidv4:()=>Bl,uuidv6:()=>Gl,uuidv7:()=>Wl,void:()=>ws,xid:()=>rs,xor:()=>Ds});var kt={};_e(kt,{endsWith:()=>pt,gt:()=>ee,gte:()=>A,includes:()=>dt,length:()=>Ee,lowercase:()=>lt,lt:()=>Q,lte:()=>F,maxLength:()=>Ne,maxSize:()=>me,mime:()=>ft,minLength:()=>oe,minSize:()=>te,multipleOf:()=>de,negative:()=>uc,nonnegative:()=>sc,nonpositive:()=>lc,normalize:()=>gt,overwrite:()=>G,positive:()=>cc,property:()=>dc,regex:()=>ut,size:()=>Te,slugify:()=>_t,startsWith:()=>mt,toLowerCase:()=>$t,toUpperCase:()=>ht,trim:()=>vt,uppercase:()=>st});var Re={};_e(Re,{ZodISODate:()=>Fn,ZodISODateTime:()=>Rn,ZodISODuration:()=>Kn,ZodISOTime:()=>Vn,date:()=>Jn,datetime:()=>Cn,duration:()=>Bn,time:()=>Mn});var Rn=u("ZodISODateTime",(e,t)=>{Do.init(e,t),I.init(e,t)});function Cn(e){return La(Rn,e)}var Fn=u("ZodISODate",(e,t)=>{To.init(e,t),I.init(e,t)});function Jn(e){return Ra(Fn,e)}var Vn=u("ZodISOTime",(e,t)=>{No.init(e,t),I.init(e,t)});function Mn(e){return Ca(Vn,e)}var Kn=u("ZodISODuration",(e,t)=>{Eo.init(e,t),I.init(e,t)});function Bn(e){return Fa(Kn,e)}var xc=(e,t)=>{We.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Wt(e,r)},flatten:{value:r=>Gt(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,ce,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,ce,2)}},isEmpty:{get(){return e.issues.length===0}}})},Uf=u("ZodError",xc),L=u("ZodError",xc,{Parent:Error});var bc=we(L),kc=je(L),zc=Pe(L),Ic=Oe(L),Sc=Ui(L),wc=Zi(L),jc=Di(L),Pc=Ti(L),Oc=Ni(L),Uc=Ei(L),Zc=Ai(L),Dc=Li(L);var x=u("ZodType",(e,t)=>(y.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Le(e,"input"),output:Le(e,"output")}}),e.toJSONSchema=yc(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(m.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>N(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>bc(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>zc(e,r,n),e.parseAsync=async(r,n)=>kc(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Ic(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Sc(e,r,n),e.decode=(r,n)=>wc(e,r,n),e.encodeAsync=async(r,n)=>jc(e,r,n),e.decodeAsync=async(r,n)=>Pc(e,r,n),e.safeEncode=(r,n)=>Oc(e,r,n),e.safeDecode=(r,n)=>Uc(e,r,n),e.safeEncodeAsync=async(r,n)=>Zc(e,r,n),e.safeDecodeAsync=async(r,n)=>Dc(e,r,n),e.refine=(r,n)=>e.check(ku(r,n)),e.superRefine=r=>e.check(zu(r)),e.overwrite=r=>e.check(G(r)),e.optional=()=>It(e),e.exactOptional=()=>ou(e),e.nullable=()=>St(e),e.nullish=()=>It(St(e)),e.nonoptional=r=>du(e,r),e.array=()=>Dt(e),e.or=r=>gi([e,r]),e.and=r=>Xc(e,r),e.transform=r=>wt(e,$i(r)),e.default=r=>uu(e,r),e.prefault=r=>su(e,r),e.catch=r=>fu(e,r),e.pipe=r=>wt(e,r),e.readonly=()=>$u(e),e.describe=r=>{let n=e.clone();return T.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return T.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return T.get(e);let n=e.clone();return T.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Xn=u("_ZodString",(e,t)=>{se.init(e,t),x.init(e,t),e._zod.processJSONSchema=(n,i,o)=>tn(e,n,i,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(ut(...n)),e.includes=(...n)=>e.check(dt(...n)),e.startsWith=(...n)=>e.check(mt(...n)),e.endsWith=(...n)=>e.check(pt(...n)),e.min=(...n)=>e.check(oe(...n)),e.max=(...n)=>e.check(Ne(...n)),e.length=(...n)=>e.check(Ee(...n)),e.nonempty=(...n)=>e.check(oe(1,...n)),e.lowercase=n=>e.check(lt(n)),e.uppercase=n=>e.check(st(n)),e.trim=()=>e.check(vt()),e.normalize=(...n)=>e.check(gt(...n)),e.toLowerCase=()=>e.check($t()),e.toUpperCase=()=>e.check(ht()),e.slugify=()=>e.check(_t())}),jt=u("ZodString",(e,t)=>{se.init(e,t),Xn.init(e,t),e.email=r=>e.check(Tr(qn,r)),e.url=r=>e.check(ct(Pt,r)),e.jwt=r=>e.check(Qr(di,r)),e.emoji=r=>e.check(Rr(Yn,r)),e.guid=r=>e.check(at(zt,r)),e.uuid=r=>e.check(Nr(W,r)),e.uuidv4=r=>e.check(Er(W,r)),e.uuidv6=r=>e.check(Ar(W,r)),e.uuidv7=r=>e.check(Lr(W,r)),e.nanoid=r=>e.check(Cr(Hn,r)),e.guid=r=>e.check(at(zt,r)),e.cuid=r=>e.check(Fr(Qn,r)),e.cuid2=r=>e.check(Jr(ei,r)),e.ulid=r=>e.check(Vr(ti,r)),e.base64=r=>e.check(qr(ui,r)),e.base64url=r=>e.check(Yr(li,r)),e.xid=r=>e.check(Mr(ri,r)),e.ksuid=r=>e.check(Kr(ni,r)),e.ipv4=r=>e.check(Br(ii,r)),e.ipv6=r=>e.check(Gr(oi,r)),e.cidrv4=r=>e.check(Wr(ai,r)),e.cidrv6=r=>e.check(Xr(ci,r)),e.e164=r=>e.check(Hr(si,r)),e.datetime=r=>e.check(Cn(r)),e.date=r=>e.check(Jn(r)),e.time=r=>e.check(Mn(r)),e.duration=r=>e.check(Bn(r))});function Gn(e){return Ea(jt,e)}var I=u("ZodStringFormat",(e,t)=>{z.init(e,t),Xn.init(e,t)}),qn=u("ZodEmail",(e,t)=>{zo.init(e,t),I.init(e,t)});function Vl(e){return Tr(qn,e)}var zt=u("ZodGUID",(e,t)=>{bo.init(e,t),I.init(e,t)});function Ml(e){return at(zt,e)}var W=u("ZodUUID",(e,t)=>{ko.init(e,t),I.init(e,t)});function Kl(e){return Nr(W,e)}function Bl(e){return Er(W,e)}function Gl(e){return Ar(W,e)}function Wl(e){return Lr(W,e)}var Pt=u("ZodURL",(e,t)=>{Io.init(e,t),I.init(e,t)});function Xl(e){return ct(Pt,e)}function ql(e){return ct(Pt,{protocol:/^https?$/,hostname:M.domain,...m.normalizeParams(e)})}var Yn=u("ZodEmoji",(e,t)=>{So.init(e,t),I.init(e,t)});function Yl(e){return Rr(Yn,e)}var Hn=u("ZodNanoID",(e,t)=>{wo.init(e,t),I.init(e,t)});function Hl(e){return Cr(Hn,e)}var Qn=u("ZodCUID",(e,t)=>{jo.init(e,t),I.init(e,t)});function Ql(e){return Fr(Qn,e)}var ei=u("ZodCUID2",(e,t)=>{Po.init(e,t),I.init(e,t)});function es(e){return Jr(ei,e)}var ti=u("ZodULID",(e,t)=>{Oo.init(e,t),I.init(e,t)});function ts(e){return Vr(ti,e)}var ri=u("ZodXID",(e,t)=>{Uo.init(e,t),I.init(e,t)});function rs(e){return Mr(ri,e)}var ni=u("ZodKSUID",(e,t)=>{Zo.init(e,t),I.init(e,t)});function ns(e){return Kr(ni,e)}var ii=u("ZodIPv4",(e,t)=>{Ao.init(e,t),I.init(e,t)});function is(e){return Br(ii,e)}var Tc=u("ZodMAC",(e,t)=>{Ro.init(e,t),I.init(e,t)});function os(e){return Aa(Tc,e)}var oi=u("ZodIPv6",(e,t)=>{Lo.init(e,t),I.init(e,t)});function as(e){return Gr(oi,e)}var ai=u("ZodCIDRv4",(e,t)=>{Co.init(e,t),I.init(e,t)});function cs(e){return Wr(ai,e)}var ci=u("ZodCIDRv6",(e,t)=>{Fo.init(e,t),I.init(e,t)});function us(e){return Xr(ci,e)}var ui=u("ZodBase64",(e,t)=>{Vo.init(e,t),I.init(e,t)});function ls(e){return qr(ui,e)}var li=u("ZodBase64URL",(e,t)=>{Mo.init(e,t),I.init(e,t)});function ss(e){return Yr(li,e)}var si=u("ZodE164",(e,t)=>{Ko.init(e,t),I.init(e,t)});function ds(e){return Hr(si,e)}var di=u("ZodJWT",(e,t)=>{Bo.init(e,t),I.init(e,t)});function ms(e){return Qr(di,e)}var Je=u("ZodCustomStringFormat",(e,t)=>{Go.init(e,t),I.init(e,t)});function ps(e,t,r={}){return Ae(Je,e,t,r)}function fs(e){return Ae(Je,"hostname",M.hostname,e)}function gs(e){return Ae(Je,"hex",M.hex,e)}function vs(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=M[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return Ae(Je,n,i,t)}var Ot=u("ZodNumber",(e,t)=>{jr.init(e,t),x.init(e,t),e._zod.processJSONSchema=(n,i,o)=>rn(e,n,i,o),e.gt=(n,i)=>e.check(ee(n,i)),e.gte=(n,i)=>e.check(A(n,i)),e.min=(n,i)=>e.check(A(n,i)),e.lt=(n,i)=>e.check(Q(n,i)),e.lte=(n,i)=>e.check(F(n,i)),e.max=(n,i)=>e.check(F(n,i)),e.int=n=>e.check(Wn(n)),e.safe=n=>e.check(Wn(n)),e.positive=n=>e.check(ee(0,n)),e.nonnegative=n=>e.check(A(0,n)),e.negative=n=>e.check(Q(0,n)),e.nonpositive=n=>e.check(F(0,n)),e.multipleOf=(n,i)=>e.check(de(n,i)),e.step=(n,i)=>e.check(de(n,i)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Nc(e){return Ja(Ot,e)}var $e=u("ZodNumberFormat",(e,t)=>{Wo.init(e,t),Ot.init(e,t)});function Wn(e){return Va($e,e)}function $s(e){return Ma($e,e)}function hs(e){return Ka($e,e)}function _s(e){return Ba($e,e)}function ys(e){return Ga($e,e)}var Ut=u("ZodBoolean",(e,t)=>{nt.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>nn(e,r,n,i)});function Ec(e){return Wa(Ut,e)}var Zt=u("ZodBigInt",(e,t)=>{Pr.init(e,t),x.init(e,t),e._zod.processJSONSchema=(n,i,o)=>on(e,n,i,o),e.gte=(n,i)=>e.check(A(n,i)),e.min=(n,i)=>e.check(A(n,i)),e.gt=(n,i)=>e.check(ee(n,i)),e.gte=(n,i)=>e.check(A(n,i)),e.min=(n,i)=>e.check(A(n,i)),e.lt=(n,i)=>e.check(Q(n,i)),e.lte=(n,i)=>e.check(F(n,i)),e.max=(n,i)=>e.check(F(n,i)),e.positive=n=>e.check(ee(BigInt(0),n)),e.negative=n=>e.check(Q(BigInt(0),n)),e.nonpositive=n=>e.check(F(BigInt(0),n)),e.nonnegative=n=>e.check(A(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(de(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function xs(e){return Xa(Zt,e)}var mi=u("ZodBigIntFormat",(e,t)=>{Xo.init(e,t),Zt.init(e,t)});function bs(e){return qa(mi,e)}function ks(e){return Ya(mi,e)}var Ac=u("ZodSymbol",(e,t)=>{qo.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>an(e,r,n,i)});function zs(e){return Ha(Ac,e)}var Lc=u("ZodUndefined",(e,t)=>{Yo.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>un(e,r,n,i)});function Is(e){return Qa(Lc,e)}var Rc=u("ZodNull",(e,t)=>{Ho.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>cn(e,r,n,i)});function Cc(e){return ec(Rc,e)}var Fc=u("ZodAny",(e,t)=>{Qo.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>dn(e,r,n,i)});function Ss(){return tc(Fc)}var Jc=u("ZodUnknown",(e,t)=>{ea.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>mn(e,r,n,i)});function ve(){return rc(Jc)}var Vc=u("ZodNever",(e,t)=>{ta.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>sn(e,r,n,i)});function pi(e){return nc(Vc,e)}var Mc=u("ZodVoid",(e,t)=>{ra.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ln(e,r,n,i)});function ws(e){return ic(Mc,e)}var fi=u("ZodDate",(e,t)=>{na.init(e,t),x.init(e,t),e._zod.processJSONSchema=(n,i,o)=>pn(e,n,i,o),e.min=(n,i)=>e.check(A(n,i)),e.max=(n,i)=>e.check(F(n,i));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function js(e){return oc(fi,e)}var Kc=u("ZodArray",(e,t)=>{ia.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>In(e,r,n,i),e.element=t.element,e.min=(r,n)=>e.check(oe(r,n)),e.nonempty=r=>e.check(oe(1,r)),e.max=(r,n)=>e.check(Ne(r,n)),e.length=(r,n)=>e.check(Ee(r,n)),e.unwrap=()=>e.element});function Dt(e,t){return mc(Kc,e,t)}function Ps(e){let t=e._zod.def.shape;return vi(Object.keys(t))}var Tt=u("ZodObject",(e,t)=>{ca.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Sn(e,r,n,i),m.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>vi(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ve()}),e.loose=()=>e.clone({...e._zod.def,catchall:ve()}),e.strict=()=>e.clone({...e._zod.def,catchall:pi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>m.extend(e,r),e.safeExtend=r=>m.safeExtend(e,r),e.merge=r=>m.merge(e,r),e.pick=r=>m.pick(e,r),e.omit=r=>m.omit(e,r),e.partial=(...r)=>m.partial(hi,e,r[0]),e.required=(...r)=>m.required(_i,e,r[0])});function Os(e,t){let r={type:"object",shape:e??{},...m.normalizeParams(t)};return new Tt(r)}function Us(e,t){return new Tt({type:"object",shape:e,catchall:pi(),...m.normalizeParams(t)})}function Zs(e,t){return new Tt({type:"object",shape:e,catchall:ve(),...m.normalizeParams(t)})}var Nt=u("ZodUnion",(e,t)=>{it.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>yt(e,r,n,i),e.options=t.options});function gi(e,t){return new Nt({type:"union",options:e,...m.normalizeParams(t)})}var Bc=u("ZodXor",(e,t)=>{Nt.init(e,t),ua.init(e,t),e._zod.processJSONSchema=(r,n,i)=>yt(e,r,n,i),e.options=t.options});function Ds(e,t){return new Bc({type:"union",options:e,inclusive:!1,...m.normalizeParams(t)})}var Gc=u("ZodDiscriminatedUnion",(e,t)=>{Nt.init(e,t),la.init(e,t)});function Ts(e,t,r){return new Gc({type:"union",options:t,discriminator:e,...m.normalizeParams(r)})}var Wc=u("ZodIntersection",(e,t)=>{sa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>wn(e,r,n,i)});function Xc(e,t){return new Wc({type:"intersection",left:e,right:t})}var qc=u("ZodTuple",(e,t)=>{Or.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>jn(e,r,n,i),e.rest=r=>e.clone({...e._zod.def,rest:r})});function Yc(e,t,r){let n=t instanceof y,i=n?r:t,o=n?t:null;return new qc({type:"tuple",items:e,rest:o,...m.normalizeParams(i)})}var Et=u("ZodRecord",(e,t)=>{da.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Pn(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType});function Hc(e,t,r){return new Et({type:"record",keyType:e,valueType:t,...m.normalizeParams(r)})}function Ns(e,t,r){let n=N(e);return n._zod.values=void 0,new Et({type:"record",keyType:n,valueType:t,...m.normalizeParams(r)})}function Es(e,t,r){return new Et({type:"record",keyType:e,valueType:t,mode:"loose",...m.normalizeParams(r)})}var Qc=u("ZodMap",(e,t)=>{ma.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>kn(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(te(...r)),e.nonempty=r=>e.check(te(1,r)),e.max=(...r)=>e.check(me(...r)),e.size=(...r)=>e.check(Te(...r))});function As(e,t,r){return new Qc({type:"map",keyType:e,valueType:t,...m.normalizeParams(r)})}var eu=u("ZodSet",(e,t)=>{pa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>zn(e,r,n,i),e.min=(...r)=>e.check(te(...r)),e.nonempty=r=>e.check(te(1,r)),e.max=(...r)=>e.check(me(...r)),e.size=(...r)=>e.check(Te(...r))});function Ls(e,t){return new eu({type:"set",valueType:e,...m.normalizeParams(t)})}var Fe=u("ZodEnum",(e,t)=>{fa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(n,i,o)=>fn(e,n,i,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let o={};for(let a of n)if(r.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Fe({...t,checks:[],...m.normalizeParams(i),entries:o})},e.exclude=(n,i)=>{let o={...t.entries};for(let a of n)if(r.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new Fe({...t,checks:[],...m.normalizeParams(i),entries:o})}});function vi(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Fe({type:"enum",entries:r,...m.normalizeParams(t)})}function Rs(e,t){return new Fe({type:"enum",entries:e,...m.normalizeParams(t)})}var tu=u("ZodLiteral",(e,t)=>{ga.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>gn(e,r,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Cs(e,t){return new tu({type:"literal",values:Array.isArray(e)?e:[e],...m.normalizeParams(t)})}var ru=u("ZodFile",(e,t)=>{va.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>hn(e,r,n,i),e.min=(r,n)=>e.check(te(r,n)),e.max=(r,n)=>e.check(me(r,n)),e.mime=(r,n)=>e.check(ft(Array.isArray(r)?r:[r],n))});function Fs(e){return pc(ru,e)}var nu=u("ZodTransform",(e,t)=>{$a.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>bn(e,r,n,i),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new re(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(m.issue(o,r.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(m.issue(a))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function $i(e){return new nu({type:"transform",transform:e})}var hi=u("ZodOptional",(e,t)=>{Ur.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xt(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function It(e){return new hi({type:"optional",innerType:e})}var iu=u("ZodExactOptional",(e,t)=>{ha.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xt(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function ou(e){return new iu({type:"optional",innerType:e})}var au=u("ZodNullable",(e,t)=>{_a.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>On(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function St(e){return new au({type:"nullable",innerType:e})}function Js(e){return It(St(e))}var cu=u("ZodDefault",(e,t)=>{ya.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Zn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function uu(e,t){return new cu({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():m.shallowClone(t)}})}var lu=u("ZodPrefault",(e,t)=>{xa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Dn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function su(e,t){return new lu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():m.shallowClone(t)}})}var _i=u("ZodNonOptional",(e,t)=>{ba.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Un(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function du(e,t){return new _i({type:"nonoptional",innerType:e,...m.normalizeParams(t)})}var mu=u("ZodSuccess",(e,t)=>{ka.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>_n(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Vs(e){return new mu({type:"success",innerType:e})}var pu=u("ZodCatch",(e,t)=>{za.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Tn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function fu(e,t){return new pu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var gu=u("ZodNaN",(e,t)=>{Ia.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>vn(e,r,n,i)});function Ms(e){return ac(gu,e)}var yi=u("ZodPipe",(e,t)=>{Sa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Nn(e,r,n,i),e.in=t.in,e.out=t.out});function wt(e,t){return new yi({type:"pipe",in:e,out:t})}var xi=u("ZodCodec",(e,t)=>{yi.init(e,t),ot.init(e,t)});function Ks(e,t,r){return new xi({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var vu=u("ZodReadonly",(e,t)=>{wa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>En(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function $u(e){return new vu({type:"readonly",innerType:e})}var hu=u("ZodTemplateLiteral",(e,t)=>{ja.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>$n(e,r,n,i)});function Bs(e,t){return new hu({type:"template_literal",parts:e,...m.normalizeParams(t)})}var _u=u("ZodLazy",(e,t)=>{Ua.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ln(e,r,n,i),e.unwrap=()=>e._zod.def.getter()});function yu(e){return new _u({type:"lazy",getter:e})}var xu=u("ZodPromise",(e,t)=>{Oa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>An(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Gs(e){return new xu({type:"promise",innerType:e})}var bu=u("ZodFunction",(e,t)=>{Pa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xn(e,r,n,i)});function Ws(e){return new bu({type:"function",input:Array.isArray(e?.input)?Yc(e?.input):e?.input??Dt(ve()),output:e?.output??ve()})}var At=u("ZodCustom",(e,t)=>{Za.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>yn(e,r,n,i)});function Xs(e){let t=new S({check:"custom"});return t._zod.check=e,t}function qs(e,t){return fc(At,e??(()=>!0),t)}function ku(e,t={}){return gc(At,e,t)}function zu(e){return vc(e)}var Ys=$c,Hs=hc;function Qs(e,t={}){let r=new At({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...m.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var ed=(...e)=>_c({Codec:xi,Boolean:Ut,String:jt},...e);function td(e){let t=yu(()=>gi([Gn(e),Nc(),Ec(),Cc(),Dt(t),Hc(Gn(),t)]));return t}function rd(e,t){return wt($i(e),t)}var Iu;Iu||(Iu={});var Rf={...Ce,...kt,iso:Re};P(Zr());import Ve from"chalk";var K={debug:0,info:1,warn:2,error:3,silent:4},bi=class{constructor(){this._level=this._getLogLevel()}_getLogLevel(){if(process.env.ZIBBY_DEBUG==="true")return K.debug;if(process.env.ZIBBY_VERBOSE==="true")return K.info;let t=process.env.LOG_LEVEL?.toLowerCase();return t&&t in K?K[t]:K.info}_shouldLog(t){return K[t]>=this._level}_formatMessage(t,r,n={}){let i=new Date().toISOString(),a=`${this._getPrefix(t)} ${r}`;return Object.keys(n).length>0&&(a+=Ve.dim(` ${JSON.stringify(n)}`)),a}_getPrefix(t){return{debug:Ve.gray("[DEBUG]"),info:Ve.cyan("[INFO]"),warn:Ve.yellow("[WARN]"),error:Ve.red("\u274C [ERROR]")}[t]||""}debug(t,r){this._shouldLog("debug")&&console.log(this._formatMessage("debug",t,r))}info(t,r){this._shouldLog("info")&&console.log(this._formatMessage("info",t,r))}warn(t,r){this._shouldLog("warn")&&console.warn(this._formatMessage("warn",t,r))}error(t,r){this._shouldLog("error")&&console.error(this._formatMessage("error",t,r))}setLevel(t){t in K&&(this._level=K[t])}getLevel(){return Object.keys(K).find(t=>K[t]===this._level)}},O=new bi;var ki={ASSISTANT:"gpt-5.4-nano-2026-03-17",CLAUDE:"claude-sonnet-4-6",CURSOR:"auto",CODEX:"o4-mini",GEMINI:"gemini-2.5-pro",OPENAI_POSTPROCESSING:"gpt-4o-mini"};var Su={CURSOR_AGENT_DEFAULT:1200*1e3,OPENAI_REQUEST:18e4};function sd(){if(process.env.OPENAI_PROXY_TOKEN)return O.debug("[Auth] Using OPENAI_PROXY_TOKEN (ECS execution)"),process.env.OPENAI_PROXY_TOKEN;if(process.env.ZIBBY_USER_TOKEN)return O.debug("[Auth] Using ZIBBY_USER_TOKEN (CI/CD PAT)"),process.env.ZIBBY_USER_TOKEN;try{let e=cd(ad(),".zibby","config.json");if(ud(e)){let t=JSON.parse(ld(e,"utf-8"));if(t.sessionToken)return O.debug("[Auth] Using session token from zibby login"),t.sessionToken}}catch(e){O.debug(`[Auth] Could not read zibby login session: ${e.message}`)}return null}function dd(){return process.env.OPENAI_PROXY_URL?process.env.OPENAI_PROXY_URL.replace(/\/v1\/?$/,""):"https://api-prod.zibby.app/openai-proxy"}function he(e){if(!(typeof e!="object"||e===null)){if(Object.keys(e).length===0){e.type="object",e.additionalProperties=!0;return}if(e.type||(e.properties?e.type="object":e.items&&(e.type="array")),e.type==="object")if(e.properties){for(let[t,r]of Object.entries(e.properties))r.type==="object"&&r.additionalProperties&&r.additionalProperties!==!1&&(!r.properties||Object.keys(r.properties).length===0)&&(e.properties[t]={type:["object","null"]});e.additionalProperties=!1,e.required=Object.keys(e.properties),Object.values(e.properties).forEach(he)}else"additionalProperties"in e||(e.additionalProperties=!0);e.type==="array"&&e.items&&he(e.items),e.anyOf&&e.anyOf.forEach(he),e.oneOf&&e.oneOf.forEach(he),e.allOf&&e.allOf.forEach(he)}}async function yg(e,t){O.info("\u{1F527} [OpenAI Proxy] Formatting structured output...");let r=sd();if(!r)throw new Error("Authentication required for structured output processing.\n Local development: Run `zibby login`\n CI/CD: Set ZIBBY_USER_TOKEN environment variable (Personal Access Token from UI settings)");let n=dd();O.info(`\u{1F517} Using OpenAI proxy: ${n}`);let i=bt(t),o=i;if(i.$ref&&i.definitions){let d=i.$ref.split("/").pop();o=i.definitions[d]||i,O.debug(`Extracted schema from $ref: ${d}`)}delete o.$schema,he(o);let a=4e5,c=e;e.length>a&&(O.warn(`\u26A0\uFE0F [OpenAI Proxy] Raw text (${e.length} chars) exceeds limit, keeping last ${a} chars`),c=`... [truncated early content] ...
40
+ ${e.slice(-a)}`);let l=`Extract and format the following information into structured JSON matching the schema.
3
41
 
4
42
  RAW CONTENT:
5
- ${l}
43
+ ${c}
6
44
 
7
- Extract all relevant information and format it according to the schema. If any required fields are missing, do your best to infer them from the content.`,y={model:d.OPENAI_POSTPROCESSING,messages:[{role:"user",content:O}],response_format:{type:"json_schema",json_schema:{name:"extract",schema:s,strict:!0}}};t.info(`\u{1F4E4} Sending to OpenAI proxy: model=${d.OPENAI_POSTPROCESSING}, schema keys=${Object.keys(s.properties||{}).join(", ")}`),t.debug(` Schema size: ${JSON.stringify(s).length} chars`),t.debug(` Prompt size: ${O.length} chars`);try{const r={"Content-Type":"application/json"};process.env.OPENAI_PROXY_TOKEN?(r["x-proxy-token"]=o,r["x-execution-id"]=process.env.EXECUTION_ID||""):(r.Authorization=`Bearer ${o}`,r["x-api-key"]=process.env.ZIBBY_API_KEY||"",r["x-execution-id"]=process.env.EXECUTION_ID||"");const p=(await g.post(u,y,{headers:r,timeout:A.OPENAI_REQUEST})).data?.choices?.[0]?.message?.content;if(!p)throw new Error("OpenAI proxy returned empty response");const E=JSON.parse(p);return t.info("\u2705 Successfully formatted with OpenAI proxy"),{structured:E,raw:e}}catch(r){if(r.response){const f=r.response.status,p=r.response.data;throw t.error(`\u274C OpenAI proxy request failed: ${f}`),t.error(` Status: ${f}`),t.error(` Response: ${JSON.stringify(p,null,2)}`),f===401||f===403?new Error(`Authentication failed for OpenAI proxy.
45
+ Extract all relevant information and format it according to the schema. If any required fields are missing, do your best to infer them from the content.`,s={model:ki.OPENAI_POSTPROCESSING,messages:[{role:"user",content:l}],response_format:{type:"json_schema",json_schema:{name:"extract",schema:o,strict:!0}}};O.info(`\u{1F4E4} Sending to OpenAI proxy: model=${ki.OPENAI_POSTPROCESSING}, schema keys=${Object.keys(o.properties||{}).join(", ")}`),O.debug(` Schema size: ${JSON.stringify(o).length} chars`),O.debug(` Prompt size: ${l.length} chars`);try{let d={"Content-Type":"application/json"};process.env.OPENAI_PROXY_TOKEN?(d["x-proxy-token"]=r,d["x-execution-id"]=process.env.EXECUTION_ID||""):(d.Authorization=`Bearer ${r}`,d["x-api-key"]=process.env.ZIBBY_API_KEY||"",d["x-execution-id"]=process.env.EXECUTION_ID||"");let g=(await od.post(n,s,{headers:d,timeout:Su.OPENAI_REQUEST})).data?.choices?.[0]?.message?.content;if(!g)throw new Error("OpenAI proxy returned empty response");let v=JSON.parse(g);return O.info("\u2705 Successfully formatted with OpenAI proxy"),{structured:v,raw:e}}catch(d){if(d.response){let p=d.response.status,g=d.response.data;throw O.error(`\u274C OpenAI proxy request failed: ${p}`),O.error(` Status: ${p}`),O.error(` Response: ${JSON.stringify(g,null,2)}`),p===401||p===403?new Error(`Authentication failed for OpenAI proxy.
8
46
  Run \`zibby login\` or set ZIBBY_USER_TOKEN environment variable.
9
- Response: ${JSON.stringify(p)}`,{cause:r}):new Error(`Failed to format Cursor output: ${p?.error?.message||"Unknown error"}`,{cause:r})}throw t.error(`\u274C OpenAI proxy request failed: ${r.message}`),new Error(`Failed to format output: ${r.message}`,{cause:r})}}export{v as formatWithOpenAIProxy};
47
+ Response: ${JSON.stringify(g)}`,{cause:d}):new Error(`Failed to format Cursor output: ${g?.error?.message||"Unknown error"}`,{cause:d})}throw O.error(`\u274C OpenAI proxy request failed: ${d.message}`),new Error(`Failed to format output: ${d.message}`,{cause:d})}}export{yg as formatWithOpenAIProxy};
@@ -1,3 +1,3 @@
1
- const y=49e3,A=12e3;function i(s){return Buffer.byteLength(JSON.stringify(s),"utf8")}function c(s,t){const o=String(s||"");if(o.length<=t)return o;const n=Math.max(0,t-28);return`${o.slice(0,n)}
1
+ function i(s){return Buffer.byteLength(JSON.stringify(s),"utf8")}function c(s,t){let o=String(s||"");if(o.length<=t)return o;let n=Math.max(0,t-28);return`${o.slice(0,n)}
2
2
 
3
- [truncated for size budget]`}function f(s,t=0){if(!s||typeof s!="object"||t>8)return s;if(Array.isArray(s))return s.map(n=>f(n,t+1));const o={};for(const[n,e]of Object.entries(s))n==="description"||n==="title"||n==="examples"||n==="default"||(o[n]=f(e,t+1));return o}function _(s=[]){return s.map(t=>({...t,function:{...t.function,description:c(t.function?.description||"",180),parameters:f(t.function?.parameters||{type:"object",properties:{}})}}))}function g(s){const t=new Set;for(const e of s)if(e.role==="assistant"&&Array.isArray(e.tool_calls))for(const r of e.tool_calls)t.add(r.id);const o=s.filter(e=>e.role==="tool"?t.has(e.tool_call_id):!0),n=new Set;for(const e of o)e.role==="tool"&&n.add(e.tool_call_id);return o.map(e=>{if(e.role!=="assistant"||!Array.isArray(e.tool_calls)||e.tool_calls.every(a=>n.has(a.id)))return e;const{tool_calls:u,...l}=e;return{...l,content:l.content||""}})}function p(s,t={}){const o=t.maxBytes||49e3,n=t.systemMaxChars||12e3,e={...s,messages:Array.isArray(s.messages)?[...s.messages]:[],tools:Array.isArray(s.tools)?_(s.tools):s.tools};e.messages.length>0&&e.messages[0]?.role==="system"&&(e.messages[0]={...e.messages[0],content:c(e.messages[0].content,n)});let r=!1;for(;i(e)>o&&e.messages.length>2;)e.messages.splice(1,1),r=!0;if(r&&(e.messages=g(e.messages)),i(e)>o&&e.messages.length>0&&(e.messages[0]={...e.messages[0],content:c(e.messages[0].content,6e3)},r=!0),i(e)>o){const u=e.messages.find(a=>a.role==="system")||e.messages[0],l=e.messages.slice(-2);e.messages=g([u,...l].filter(Boolean).map((a,m)=>({...a,content:c(a.content,m===0?4e3:8e3)}))),r=!0}return{body:e,meta:{bytes:i(e),trimmed:r,maxBytes:o,messageCount:e.messages.length}}}export{p as applyPayloadBudget};
3
+ [truncated for size budget]`}function f(s,t=0){if(!s||typeof s!="object"||t>8)return s;if(Array.isArray(s))return s.map(n=>f(n,t+1));let o={};for(let[n,e]of Object.entries(s))n==="description"||n==="title"||n==="examples"||n==="default"||(o[n]=f(e,t+1));return o}function _(s=[]){return s.map(t=>({...t,function:{...t.function,description:c(t.function?.description||"",180),parameters:f(t.function?.parameters||{type:"object",properties:{}})}}))}function g(s){let t=new Set;for(let e of s)if(e.role==="assistant"&&Array.isArray(e.tool_calls))for(let r of e.tool_calls)t.add(r.id);let o=s.filter(e=>e.role==="tool"?t.has(e.tool_call_id):!0),n=new Set;for(let e of o)e.role==="tool"&&n.add(e.tool_call_id);return o.map(e=>{if(e.role!=="assistant"||!Array.isArray(e.tool_calls)||e.tool_calls.every(a=>n.has(a.id)))return e;let{tool_calls:u,...l}=e;return{...l,content:l.content||""}})}function y(s,t={}){let o=t.maxBytes||49e3,n=t.systemMaxChars||12e3,e={...s,messages:Array.isArray(s.messages)?[...s.messages]:[],tools:Array.isArray(s.tools)?_(s.tools):s.tools};e.messages.length>0&&e.messages[0]?.role==="system"&&(e.messages[0]={...e.messages[0],content:c(e.messages[0].content,n)});let r=!1;for(;i(e)>o&&e.messages.length>2;)e.messages.splice(1,1),r=!0;if(r&&(e.messages=g(e.messages)),i(e)>o&&e.messages.length>0&&(e.messages[0]={...e.messages[0],content:c(e.messages[0].content,6e3)},r=!0),i(e)>o){let u=e.messages.find(a=>a.role==="system")||e.messages[0],l=e.messages.slice(-2);e.messages=g([u,...l].filter(Boolean).map((a,m)=>({...a,content:c(a.content,m===0?4e3:8e3)}))),r=!0}return{body:e,meta:{bytes:i(e),trimmed:r,maxBytes:o,messageCount:e.messages.length}}}export{y as applyPayloadBudget};