@canva/cli 0.0.1-beta.32 → 0.0.1-beta.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/esm/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // Copyright 2024 Canva Inc. All Rights Reserved.
2
- var gt=Object.create;var Fe=Object.defineProperty;var yt=Object.getOwnPropertyDescriptor;var wt=Object.getOwnPropertyNames;var xt=Object.getPrototypeOf,bt=Object.prototype.hasOwnProperty;var be=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Me=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Et=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of wt(e))!bt.call(r,n)&&n!==t&&Fe(r,n,{get:()=>e[n],enumerable:!(s=yt(e,n))||s.enumerable});return r};var kt=(r,e,t)=>(t=r!=null?gt(xt(r)):{},Et(e||!r||!r.__esModule?Fe(t,"default",{value:r,enumerable:!0}):t,r));var nt=Me((ms,Dr)=>{Dr.exports={name:"dotenv",version:"16.4.7",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var ct=Me((vs,$)=>{var Le=be("fs"),$e=be("path"),Vr=be("os"),jr=be("crypto"),Lr=nt(),Ze=Lr.version,$r=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Zr(r){let e={},t=r.toString();t=t.replace(/\r\n?/mg,`
2
+ var gt=Object.create;var Fe=Object.defineProperty;var yt=Object.getOwnPropertyDescriptor;var wt=Object.getOwnPropertyNames;var xt=Object.getPrototypeOf,bt=Object.prototype.hasOwnProperty;var be=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Me=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Et=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of wt(e))!bt.call(r,n)&&n!==t&&Fe(r,n,{get:()=>e[n],enumerable:!(s=yt(e,n))||s.enumerable});return r};var kt=(r,e,t)=>(t=r!=null?gt(xt(r)):{},Et(e||!r||!r.__esModule?Fe(t,"default",{value:r,enumerable:!0}):t,r));var nt=Me((ms,Dr)=>{Dr.exports={name:"dotenv",version:"16.4.7",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var ct=Me((vs,$)=>{var Le=be("fs"),$e=be("path"),jr=be("os"),Vr=be("crypto"),Lr=nt(),Ze=Lr.version,$r=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Zr(r){let e={},t=r.toString();t=t.replace(/\r\n?/mg,`
3
3
  `);let s;for(;(s=$r.exec(t))!=null;){let n=s[1],a=s[2]||"";a=a.trim();let i=a[0];a=a.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),i==='"'&&(a=a.replace(/\\n/g,`
4
- `),a=a.replace(/\\r/g,"\r")),e[n]=a}return e}function Fr(r){let e=ot(r),t=w.configDotenv({path:e});if(!t.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw i.code="MISSING_DATA",i}let s=it(r).split(","),n=s.length,a;for(let i=0;i<n;i++)try{let o=s[i].trim(),d=Gr(t,o);a=w.decrypt(d.ciphertext,d.key);break}catch(o){if(i+1>=n)throw o}return w.parse(a)}function Mr(r){console.log(`[dotenv@${Ze}][INFO] ${r}`)}function Ur(r){console.log(`[dotenv@${Ze}][WARN] ${r}`)}function Ie(r){console.log(`[dotenv@${Ze}][DEBUG] ${r}`)}function it(r){return r&&r.DOTENV_KEY&&r.DOTENV_KEY.length>0?r.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Gr(r,e){let t;try{t=new URL(e)}catch(o){if(o.code==="ERR_INVALID_URL"){let d=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw d.code="INVALID_DOTENV_KEY",d}throw o}let s=t.password;if(!s){let o=new Error("INVALID_DOTENV_KEY: Missing key part");throw o.code="INVALID_DOTENV_KEY",o}let n=t.searchParams.get("environment");if(!n){let o=new Error("INVALID_DOTENV_KEY: Missing environment part");throw o.code="INVALID_DOTENV_KEY",o}let a=`DOTENV_VAULT_${n.toUpperCase()}`,i=r.parsed[a];if(!i){let o=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);throw o.code="NOT_FOUND_DOTENV_ENVIRONMENT",o}return{ciphertext:i,key:s}}function ot(r){let e=null;if(r&&r.path&&r.path.length>0)if(Array.isArray(r.path))for(let t of r.path)Le.existsSync(t)&&(e=t.endsWith(".vault")?t:`${t}.vault`);else e=r.path.endsWith(".vault")?r.path:`${r.path}.vault`;else e=$e.resolve(process.cwd(),".env.vault");return Le.existsSync(e)?e:null}function at(r){return r[0]==="~"?$e.join(Vr.homedir(),r.slice(1)):r}function zr(r){Mr("Loading env from encrypted .env.vault");let e=w._parseVault(r),t=process.env;return r&&r.processEnv!=null&&(t=r.processEnv),w.populate(t,e,r),{parsed:e}}function Br(r){let e=$e.resolve(process.cwd(),".env"),t="utf8",s=!!(r&&r.debug);r&&r.encoding?t=r.encoding:s&&Ie("No encoding is specified. UTF-8 is used by default");let n=[e];if(r&&r.path)if(!Array.isArray(r.path))n=[at(r.path)];else{n=[];for(let d of r.path)n.push(at(d))}let a,i={};for(let d of n)try{let u=w.parse(Le.readFileSync(d,{encoding:t}));w.populate(i,u,r)}catch(u){s&&Ie(`Failed to load ${d} ${u.message}`),a=u}let o=process.env;return r&&r.processEnv!=null&&(o=r.processEnv),w.populate(o,i,r),a?{parsed:i,error:a}:{parsed:i}}function Kr(r){if(it(r).length===0)return w.configDotenv(r);let e=ot(r);return e?w._configVault(r):(Ur(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),w.configDotenv(r))}function Yr(r,e){let t=Buffer.from(e.slice(-64),"hex"),s=Buffer.from(r,"base64"),n=s.subarray(0,12),a=s.subarray(-16);s=s.subarray(12,-16);try{let i=jr.createDecipheriv("aes-256-gcm",t,n);return i.setAuthTag(a),`${i.update(s)}${i.final()}`}catch(i){let o=i instanceof RangeError,d=i.message==="Invalid key length",u=i.message==="Unsupported state or unable to authenticate data";if(o||d){let h=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw h.code="INVALID_DOTENV_KEY",h}else if(u){let h=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw h.code="DECRYPTION_FAILED",h}else throw i}}function Wr(r,e,t={}){let s=!!(t&&t.debug),n=!!(t&&t.override);if(typeof e!="object"){let a=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw a.code="OBJECT_REQUIRED",a}for(let a of Object.keys(e))Object.prototype.hasOwnProperty.call(r,a)?(n===!0&&(r[a]=e[a]),s&&Ie(n===!0?`"${a}" is already defined and WAS overwritten`:`"${a}" is already defined and was NOT overwritten`)):r[a]=e[a]}var w={configDotenv:Br,_configVault:zr,_parseVault:Fr,config:Kr,decrypt:Yr,parse:Zr,populate:Wr};$.exports.configDotenv=w.configDotenv;$.exports._configVault=w._configVault;$.exports._parseVault=w._parseVault;$.exports.config=w.config;$.exports.decrypt=w.decrypt;$.exports.parse=w.parse;$.exports.populate=w.populate;$.exports=w});var y;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(let o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(let i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(y||(y={}));var Pe;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Pe||(Pe={}));var p=y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),V=r=>{switch(typeof r){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(r)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(r)?p.array:r===null?p.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?p.promise:typeof Map<"u"&&r instanceof Map?p.map:typeof Set<"u"&&r instanceof Set?p.set:typeof Date<"u"&&r instanceof Date?p.date:p.object;default:return p.unknown}},c=y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),At=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),T=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,d=0;for(;d<i.path.length;){let u=i.path[d];d===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],d++}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};T.create=r=>new T(r);var oe=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===p.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,y.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${y.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${y.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${y.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:y.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,y.assertNever(r)}return{message:t}},ze=oe;function Tt(r){ze=r}function Ee(){return ze}var ke=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="",d=s.filter(u=>!!u).slice().reverse();for(let u of d)o=u(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},Nt=[];function l(r,e){let t=Ee(),s=ke({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===oe?void 0:oe].filter(n=>!!n)});r.common.issues.push(s)}var b=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return v;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,i=await n.value;s.push({key:a,value:i})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return v;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}},v=Object.freeze({status:"aborted"}),ie=r=>({status:"dirty",value:r}),E=r=>({status:"valid",value:r}),De=r=>r.status==="aborted",Ve=r=>r.status==="dirty",G=r=>r.status==="valid",me=r=>typeof Promise<"u"&&r instanceof Promise;function Ae(r,e,t,s){if(t==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?s:t==="a"?s.call(r):s?s.value:e.get(r)}function Be(r,e,t,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t}var f;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(f||(f={}));var fe,he,R=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ue=(r,e)=>{if(G(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new T(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{var d,u;let{message:h}=r;return i.code==="invalid_enum_value"?{message:h??o.defaultError}:typeof o.data>"u"?{message:(d=h??s)!==null&&d!==void 0?d:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(u=h??t)!==null&&u!==void 0?u:o.defaultError}},description:n}}var g=class{get description(){return this._def.description}_getType(e){return V(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(me(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;let n={common:{issues:[],async:(s=t?.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Ue(n,a)}"~validate"(e){var t,s;let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:n});return G(a)?{value:a.value}:{issues:n.common.issues}}catch(a){!((s=(t=a?.message)===null||t===void 0?void 0:t.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(a=>G(a)?{value:a.value}:{issues:n.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(me(n)?n:Promise.resolve(n));return Ue(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let i=e(n),o=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new N({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return O.create(this,this._def)}nullable(){return S.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return L.create(this)}promise(){return M.create(this,this._def)}or(e){return J.create([this,e],this._def)}and(e){return H.create(this,e,this._def)}transform(e){return new N({..._(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new re({..._(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new ve({typeName:m.ZodBranded,type:this,..._(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new se({..._(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return _e.create(this,e)}readonly(){return ne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ot=/^c[^\s-]{8,}$/i,Rt=/^[0-9a-z]+$/,It=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ct=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,St=/^[a-z0-9_-]{21}$/i,Pt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Dt=/^[-+]?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)?)??$/,Vt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Se,Lt=/^(?:(?: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])$/,$t=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Zt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ft=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ut=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ke="((\\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])))",Gt=new RegExp(`^${Ke}$`);function Ye(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function zt(r){return new RegExp(`^${Ye(r)}$`)}function We(r){let e=`${Ke}T${Ye(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Bt(r,e){return!!((e==="v4"||!e)&&Lt.test(r)||(e==="v6"||!e)&&Zt.test(r))}function Kt(r,e){if(!Pt.test(r))return!1;try{let[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||!n.typ||!n.alg||e&&n.alg!==e)}catch{return!1}}function Yt(r,e){return!!((e==="v4"||!e)&&$t.test(r)||(e==="v6"||!e)&&Ft.test(r))}var Z=class r extends g{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.string,received:a.parsedType}),v}let s=new b,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Vt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Se||(Se=new RegExp(jt,"u")),Se.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Ct.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")St.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")It.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?We(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Gt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?zt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Bt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Kt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Yt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Mt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Ut.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):y.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...f.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...f.errToObj(e)})}url(e){return this._addCheck({kind:"url",...f.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...f.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...f.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...f.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...f.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...f.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...f.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...f.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...f.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...f.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...f.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...f.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(s=e?.local)!==null&&s!==void 0?s:!1,...f.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...f.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...f.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...f.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...f.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...f.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...f.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...f.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...f.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...f.errToObj(t)})}nonempty(e){return this.min(1,f.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Z.create=r=>{var e;return new Z({checks:[],typeName:m.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function Wt(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=parseInt(r.toFixed(n).replace(".","")),i=parseInt(e.toFixed(n).replace(".",""));return a%i/Math.pow(10,n)}var z=class r extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.number,received:a.parsedType}),v}let s,n=new b;for(let a of this._def.checks)a.kind==="int"?y.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Wt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_finite,message:a.message}),n.dirty()):y.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,f.toString(t))}gt(e,t){return this.setLimit("min",e,!1,f.toString(t))}lte(e,t){return this.setLimit("max",e,!0,f.toString(t))}lt(e,t){return this.setLimit("max",e,!1,f.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:f.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:f.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:f.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&y.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};z.create=r=>new z({checks:[],typeName:m.ZodNumber,coerce:r?.coerce||!1,..._(r)});var B=class r extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let s,n=new b;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):y.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:p.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,f.toString(t))}gt(e,t){return this.setLimit("min",e,!1,f.toString(t))}lte(e,t){return this.setLimit("max",e,!0,f.toString(t))}lt(e,t){return this.setLimit("max",e,!1,f.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:f.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};B.create=r=>{var e;return new B({checks:[],typeName:m.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};var K=class extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.boolean,received:s.parsedType}),v}return E(e.data)}};K.create=r=>new K({typeName:m.ZodBoolean,coerce:r?.coerce||!1,..._(r)});var Y=class r extends g{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.date,received:a.parsedType}),v}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),v}let s=new b,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):y.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:f.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:f.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Y.create=r=>new Y({checks:[],coerce:r?.coerce||!1,typeName:m.ZodDate,..._(r)});var ce=class extends g{_parse(e){if(this._getType(e)!==p.symbol){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.symbol,received:s.parsedType}),v}return E(e.data)}};ce.create=r=>new ce({typeName:m.ZodSymbol,..._(r)});var W=class extends g{_parse(e){if(this._getType(e)!==p.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.undefined,received:s.parsedType}),v}return E(e.data)}};W.create=r=>new W({typeName:m.ZodUndefined,..._(r)});var q=class extends g{_parse(e){if(this._getType(e)!==p.null){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.null,received:s.parsedType}),v}return E(e.data)}};q.create=r=>new q({typeName:m.ZodNull,..._(r)});var F=class extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return E(e.data)}};F.create=r=>new F({typeName:m.ZodAny,..._(r)});var j=class extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return E(e.data)}};j.create=r=>new j({typeName:m.ZodUnknown,..._(r)});var I=class extends g{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:p.never,received:t.parsedType}),v}};I.create=r=>new I({typeName:m.ZodNever,..._(r)});var de=class extends g{_parse(e){if(this._getType(e)!==p.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.void,received:s.parsedType}),v}return E(e.data)}};de.create=r=>new de({typeName:m.ZodVoid,..._(r)});var L=class r extends g{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==p.array)return l(t,{code:c.invalid_type,expected:p.array,received:t.parsedType}),v;if(n.exactLength!==null){let i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(l(t,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(l(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(l(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new R(t,i,t.path,o)))).then(i=>b.mergeArray(s,i));let a=[...t.data].map((i,o)=>n.type._parseSync(new R(t,i,t.path,o)));return b.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:f.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:f.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:f.toString(t)}})}nonempty(e){return this.min(1,e)}};L.create=(r,e)=>new L({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,..._(e)});function ae(r){if(r instanceof A){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=O.create(ae(s))}return new A({...r._def,shape:()=>e})}else return r instanceof L?new L({...r._def,type:ae(r.element)}):r instanceof O?O.create(ae(r.unwrap())):r instanceof S?S.create(ae(r.unwrap())):r instanceof C?C.create(r.items.map(e=>ae(e))):r}var A=class r extends g{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=y.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==p.object){let u=this._getOrReturnCtx(e);return l(u,{code:c.invalid_type,expected:p.object,received:u.parsedType}),v}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof I&&this._def.unknownKeys==="strip"))for(let u in n.data)i.includes(u)||o.push(u);let d=[];for(let u of i){let h=a[u],k=n.data[u];d.push({key:{status:"valid",value:u},value:h._parse(new R(n,k,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof I){let u=this._def.unknownKeys;if(u==="passthrough")for(let h of o)d.push({key:{status:"valid",value:h},value:{status:"valid",value:n.data[h]}});else if(u==="strict")o.length>0&&(l(n,{code:c.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let h of o){let k=n.data[h];d.push({key:{status:"valid",value:h},value:u._parse(new R(n,k,n.path,h)),alwaysSet:h in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let h of d){let k=await h.key,xe=await h.value;u.push({key:k,value:xe,alwaysSet:h.alwaysSet})}return u}).then(u=>b.mergeObjectSync(s,u)):b.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return f.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,a,i,o;let d=(i=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=f.errToObj(e).message)!==null&&o!==void 0?o:d}:{message:d}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return y.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return y.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new r({...this._def,shape:()=>t})}deepPartial(){return ae(this)}partial(e){let t={};return y.objectKeys(this.shape).forEach(s=>{let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return y.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof O;)a=a._def.innerType;t[s]=a}}),new r({...this._def,shape:()=>t})}keyof(){return qe(y.objectKeys(this.shape))}};A.create=(r,e)=>new A({shape:()=>r,unknownKeys:"strip",catchall:I.create(),typeName:m.ZodObject,..._(e)});A.strictCreate=(r,e)=>new A({shape:()=>r,unknownKeys:"strict",catchall:I.create(),typeName:m.ZodObject,..._(e)});A.lazycreate=(r,e)=>new A({shape:r,unknownKeys:"strip",catchall:I.create(),typeName:m.ZodObject,..._(e)});var J=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new T(o.ctx.common.issues));return l(t,{code:c.invalid_union,unionErrors:i}),v}if(t.common.async)return Promise.all(s.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let d of s){let u={...t,common:{...t.common,issues:[]},parent:null},h=d._parseSync({data:t.data,path:t.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(d=>new T(d));return l(t,{code:c.invalid_union,unionErrors:o}),v}}get options(){return this._def.options}};J.create=(r,e)=>new J({options:r,typeName:m.ZodUnion,..._(e)});var D=r=>r instanceof Q?D(r.schema):r instanceof N?D(r.innerType()):r instanceof X?[r.value]:r instanceof ee?r.options:r instanceof te?y.objectValues(r.enum):r instanceof re?D(r._def.innerType):r instanceof W?[void 0]:r instanceof q?[null]:r instanceof O?[void 0,...D(r.unwrap())]:r instanceof S?[null,...D(r.unwrap())]:r instanceof ve||r instanceof ne?D(r.unwrap()):r instanceof se?D(r._def.innerType):[],Te=class r extends g{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return l(t,{code:c.invalid_type,expected:p.object,received:t.parsedType}),v;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),v)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let i=D(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new r({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,..._(s)})}};function je(r,e){let t=V(r),s=V(e);if(r===e)return{valid:!0,data:r};if(t===p.object&&s===p.object){let n=y.objectKeys(e),a=y.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};for(let o of a){let d=je(r[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(t===p.array&&s===p.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],d=je(i,o);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return t===p.date&&s===p.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var H=class extends g{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(De(a)||De(i))return v;let o=je(a.value,i.value);return o.valid?((Ve(a)||Ve(i))&&t.dirty(),{status:t.value,value:o.data}):(l(s,{code:c.invalid_intersection_types}),v)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};H.create=(r,e,t)=>new H({left:r,right:e,typeName:m.ZodIntersection,..._(t)});var C=class r extends g{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.array)return l(s,{code:c.invalid_type,expected:p.array,received:s.parsedType}),v;if(s.data.length<this._def.items.length)return l(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&s.data.length>this._def.items.length&&(l(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((i,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new R(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>b.mergeArray(t,i)):b.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};C.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new C({items:r,typeName:m.ZodTuple,rest:null,..._(e)})};var Ne=class r extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.object)return l(s,{code:c.invalid_type,expected:p.object,received:s.parsedType}),v;let n=[],a=this._def.keyType,i=this._def.valueType;for(let o in s.data)n.push({key:a._parse(new R(s,o,s.path,o)),value:i._parse(new R(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?b.mergeObjectAsync(t,n):b.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof g?new r({keyType:e,valueType:t,typeName:m.ZodRecord,..._(s)}):new r({keyType:Z.create(),valueType:e,typeName:m.ZodRecord,..._(t)})}},ue=class extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.map)return l(s,{code:c.invalid_type,expected:p.map,received:s.parsedType}),v;let n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,d],u)=>({key:n._parse(new R(s,o,s.path,[u,"key"])),value:a._parse(new R(s,d,s.path,[u,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of i){let u=await d.key,h=await d.value;if(u.status==="aborted"||h.status==="aborted")return v;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let d of i){let u=d.key,h=d.value;if(u.status==="aborted"||h.status==="aborted")return v;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}}}};ue.create=(r,e,t)=>new ue({valueType:e,keyType:r,typeName:m.ZodMap,..._(t)});var le=class r extends g{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.set)return l(s,{code:c.invalid_type,expected:p.set,received:s.parsedType}),v;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(l(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(l(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function i(d){let u=new Set;for(let h of d){if(h.status==="aborted")return v;h.status==="dirty"&&t.dirty(),u.add(h.value)}return{status:t.value,value:u}}let o=[...s.data.values()].map((d,u)=>a._parse(new R(s,d,s.path,u)));return s.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:f.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:f.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};le.create=(r,e)=>new le({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,..._(e)});var Oe=class r extends g{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return l(t,{code:c.invalid_type,expected:p.function,received:t.parsedType}),v;function s(o,d){return ke({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ee(),oe].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:d}})}function n(o,d){return ke({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ee(),oe].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:d}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof M){let o=this;return E(async function(...d){let u=new T([]),h=await o._def.args.parseAsync(d,a).catch(U=>{throw u.addIssue(s(d,U)),u}),k=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(k,a).catch(U=>{throw u.addIssue(n(k,U)),u})})}else{let o=this;return E(function(...d){let u=o._def.args.safeParse(d,a);if(!u.success)throw new T([s(d,u.error)]);let h=Reflect.apply(i,this,u.data),k=o._def.returns.safeParse(h,a);if(!k.success)throw new T([n(h,k.error)]);return k.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:C.create(e).rest(j.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||C.create([]).rest(j.create()),returns:t||j.create(),typeName:m.ZodFunction,..._(s)})}},Q=class extends g{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Q.create=(r,e)=>new Q({getter:r,typeName:m.ZodLazy,..._(e)});var X=class extends g{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}};X.create=(r,e)=>new X({value:r,typeName:m.ZodLiteral,..._(e)});function qe(r,e){return new ee({values:r,typeName:m.ZodEnum,..._(e)})}var ee=class r extends g{constructor(){super(...arguments),fe.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{expected:y.joinValues(s),received:t.parsedType,code:c.invalid_type}),v}if(Ae(this,fe,"f")||Be(this,fe,new Set(this._def.values),"f"),!Ae(this,fe,"f").has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{received:t.data,code:c.invalid_enum_value,options:s}),v}return E(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};fe=new WeakMap;ee.create=qe;var te=class extends g{constructor(){super(...arguments),he.set(this,void 0)}_parse(e){let t=y.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==p.string&&s.parsedType!==p.number){let n=y.objectValues(t);return l(s,{expected:y.joinValues(n),received:s.parsedType,code:c.invalid_type}),v}if(Ae(this,he,"f")||Be(this,he,new Set(y.getValidEnumValues(this._def.values)),"f"),!Ae(this,he,"f").has(e.data)){let n=y.objectValues(t);return l(s,{received:s.data,code:c.invalid_enum_value,options:n}),v}return E(e.data)}get enum(){return this._def.values}};he=new WeakMap;te.create=(r,e)=>new te({values:r,typeName:m.ZodNativeEnum,..._(e)});var M=class extends g{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return l(t,{code:c.invalid_type,expected:p.promise,received:t.parsedType}),v;let s=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return E(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};M.create=(r,e)=>new M({type:r,typeName:m.ZodPromise,..._(e)});var N=class extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{l(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return v;let d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?v:d.status==="dirty"||t.value==="dirty"?ie(d.value):d});{if(t.value==="aborted")return v;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?v:o.status==="dirty"||t.value==="dirty"?ie(o.value):o}}if(n.type==="refinement"){let i=o=>{let d=n.refinement(o,a);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!G(i))return i;let o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>G(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);y.assertNever(n)}};N.create=(r,e,t)=>new N({schema:r,typeName:m.ZodEffects,effect:e,..._(t)});N.createWithPreprocess=(r,e,t)=>new N({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,..._(t)});var O=class extends g{_parse(e){return this._getType(e)===p.undefined?E(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};O.create=(r,e)=>new O({innerType:r,typeName:m.ZodOptional,..._(e)});var S=class extends g{_parse(e){return this._getType(e)===p.null?E(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};S.create=(r,e)=>new S({innerType:r,typeName:m.ZodNullable,..._(e)});var re=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===p.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};re.create=(r,e)=>new re({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var se=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return me(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new T(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new T(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};se.create=(r,e)=>new se({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var pe=class extends g{_parse(e){if(this._getType(e)!==p.nan){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.nan,received:s.parsedType}),v}return{status:"valid",value:e.data}}};pe.create=r=>new pe({typeName:m.ZodNaN,..._(r)});var qt=Symbol("zod_brand"),ve=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},_e=class r extends g{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?v:a.status==="dirty"?(t.dirty(),ie(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?v:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:m.ZodPipeline})}},ne=class extends g{_parse(e){let t=this._def.innerType._parse(e),s=n=>(G(n)&&(n.value=Object.freeze(n.value)),n);return me(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};ne.create=(r,e)=>new ne({innerType:r,typeName:m.ZodReadonly,..._(e)});function Je(r,e={},t){return r?F.create().superRefine((s,n)=>{var a,i;if(!r(s)){let o=typeof e=="function"?e(s):typeof e=="string"?{message:e}:e,d=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;n.addIssue({code:"custom",...u,fatal:d})}}):F.create()}var Jt={object:A.lazycreate},m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));var Ht=(r,e={message:`Input not instance of ${r.name}`})=>Je(t=>t instanceof r,e),He=Z.create,Qe=z.create,Qt=pe.create,Xt=B.create,Xe=K.create,er=Y.create,tr=ce.create,rr=W.create,sr=q.create,nr=F.create,ar=j.create,ir=I.create,or=de.create,cr=L.create,ge=A.create,dr=A.strictCreate,ur=J.create,lr=Te.create,pr=H.create,fr=C.create,hr=Ne.create,mr=ue.create,vr=le.create,_r=Oe.create,gr=Q.create,yr=X.create,wr=ee.create,xr=te.create,br=M.create,Ge=N.create,Er=O.create,kr=S.create,Ar=N.createWithPreprocess,Tr=_e.create,Nr=()=>He().optional(),Or=()=>Qe().optional(),Rr=()=>Xe().optional(),Ir={string:r=>Z.create({...r,coerce:!0}),number:r=>z.create({...r,coerce:!0}),boolean:r=>K.create({...r,coerce:!0}),bigint:r=>B.create({...r,coerce:!0}),date:r=>Y.create({...r,coerce:!0})},Cr=v,ye=Object.freeze({__proto__:null,defaultErrorMap:oe,setErrorMap:Tt,getErrorMap:Ee,makeIssue:ke,EMPTY_PATH:Nt,addIssueToContext:l,ParseStatus:b,INVALID:v,DIRTY:ie,OK:E,isAborted:De,isDirty:Ve,isValid:G,isAsync:me,get util(){return y},get objectUtil(){return Pe},ZodParsedType:p,getParsedType:V,ZodType:g,datetimeRegex:We,ZodString:Z,ZodNumber:z,ZodBigInt:B,ZodBoolean:K,ZodDate:Y,ZodSymbol:ce,ZodUndefined:W,ZodNull:q,ZodAny:F,ZodUnknown:j,ZodNever:I,ZodVoid:de,ZodArray:L,ZodObject:A,ZodUnion:J,ZodDiscriminatedUnion:Te,ZodIntersection:H,ZodTuple:C,ZodRecord:Ne,ZodMap:ue,ZodSet:le,ZodFunction:Oe,ZodLazy:Q,ZodLiteral:X,ZodEnum:ee,ZodNativeEnum:te,ZodPromise:M,ZodEffects:N,ZodTransformer:N,ZodOptional:O,ZodNullable:S,ZodDefault:re,ZodCatch:se,ZodNaN:pe,BRAND:qt,ZodBranded:ve,ZodPipeline:_e,ZodReadonly:ne,custom:Je,Schema:g,ZodSchema:g,late:Jt,get ZodFirstPartyTypeKind(){return m},coerce:Ir,any:nr,array:cr,bigint:Xt,boolean:Xe,date:er,discriminatedUnion:lr,effect:Ge,enum:wr,function:_r,instanceof:Ht,intersection:pr,lazy:gr,literal:yr,map:mr,nan:Qt,nativeEnum:xr,never:ir,null:sr,nullable:kr,number:Qe,object:ge,oboolean:Rr,onumber:Or,optional:Er,ostring:Nr,pipeline:Tr,preprocess:Ar,promise:br,record:hr,set:vr,strictObject:dr,string:He,symbol:tr,transformer:Ge,tuple:fr,undefined:rr,union:ur,unknown:ar,void:or,NEVER:Cr,ZodIssueCode:c,quotelessJson:At,ZodError:T});function et(r){let e=r.runtimeEnvStrict??r.runtimeEnv??process.env;if(r.emptyStringAsUndefined??!1)for(let[x,P]of Object.entries(e))P===""&&delete e[x];if(!!r.skipValidation)return e;let n=typeof r.client=="object"?r.client:{},a=typeof r.server=="object"?r.server:{},i=typeof r.shared=="object"?r.shared:{},o=ge(n),d=ge(a),u=ge(i),h=r.isServer??(typeof window>"u"||"Deno"in window),k=o.merge(u),xe=d.merge(u).merge(o),U=h?xe.safeParse(e):k.safeParse(e),lt=r.onValidationError??(x=>{throw console.error("\u274C Invalid environment variables:",x.flatten().fieldErrors),new Error("Invalid environment variables")}),pt=r.onInvalidAccess??(x=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(U.success===!1)return lt(U.error);let ft=x=>r.clientPrefix?!x.startsWith(r.clientPrefix)&&!(x in u.shape):!0,ht=x=>h||!ft(x),mt=x=>x==="__esModule"||x==="$$typeof",vt=(r.extends??[]).reduce((x,P)=>Object.assign(x,P),{}),_t=Object.assign(U.data,vt);return new Proxy(_t,{get(x,P){if(typeof P=="string"&&!mt(P))return ht(P)?Reflect.get(x,P):pt(P)}})}var we=(i=>(i.PROD_CN="prod-cn",i.PROD="prod",i.STAGING="staging",i.STAGING_CN="staging-cn",i.DEV="dev",i.LOCAL="local",i))(we||{}),tt=({fallback:r="prod"})=>{let e=process.env.ENV;if(!e)return r;let t=e.toLowerCase().trim();return Object.values(we).includes(t)?t:r},rt=r=>r==="prod-cn"||r==="staging-cn";var Sr=r=>{switch(r){case"local":return{CONNECT_API_BASE_URL:"http://localhost:3000/rest",CANVA_ENV_URL:"http://localhost:3000",CANVA_CLI_CLIENT_ID:"FAKE_CLIENT_ID",FLAVOR:"local"};case"dev":return{CONNECT_API_BASE_URL:"https://api.canva-dev.com/rest",CANVA_ENV_URL:"https://www.canva-dev.com",CANVA_CLI_CLIENT_ID:"OC-AZFEJKOjQYw3",FLAVOR:"dev"};case"staging-cn":return{CONNECT_API_BASE_URL:"https://api.canva-staging.cn/rest",CANVA_ENV_URL:"https://www.canva-staging.cn",CANVA_CLI_CLIENT_ID:"OC-AZNlOhtxI_Zb",FLAVOR:"staging-cn"};case"staging":return{CONNECT_API_BASE_URL:"https://api.canva-staging.com/rest",CANVA_ENV_URL:"https://www.canva-staging.com",CANVA_CLI_CLIENT_ID:"OC-AZH-EOTpT8Ib",FLAVOR:"staging"};case"prod-cn":return{CONNECT_API_BASE_URL:"https://api.canva.cn/rest",CANVA_ENV_URL:"https://www.canva.cn",CANVA_CLI_CLIENT_ID:"OC-AZN2AS1hKtVM",FLAVOR:"prod-cn"};case"prod":default:return{CONNECT_API_BASE_URL:"https://api.canva.com/rest",CANVA_ENV_URL:"https://www.canva.com",CANVA_CLI_CLIENT_ID:"OC-AZICxlGo2biD",FLAVOR:"prod"}}},st=({fallback:r="prod"})=>et({server:{FLAVOR:ye.enum(["prod","prod-cn","staging","staging-cn","dev","local"]).default(r),CONNECT_API_BASE_URL:ye.string().url(),CANVA_ENV_URL:ye.string().url(),CANVA_CLI_CLIENT_ID:ye.enum(["OC-AZICxlGo2biD","OC-AZN2AS1hKtVM","OC-AZH-EOTpT8Ib","OC-AZNlOhtxI_Zb","OC-AZFEJKOjQYw3","FAKE_CLIENT_ID"]).default("OC-AZICxlGo2biD")},runtimeEnv:{...Sr(tt({fallback:r}))},emptyStringAsUndefined:!0});var Re=class{constructor(e,t,s=!1){this.envService=e;this.env=t;this.debug=s}generatePreviewResult=async e=>{let t=e;if(!t){let n=await this.getAppId();if(!n.success)return n;t=n.data}return{success:!0,data:this.constructPreviewUrl(t)}};async getAppId(){try{let e=await this.envService.getAppIdFromEnvFile();if(!e.success)return e;let t=e.data;if(t==="YOUR_APP_ID_HERE"){let s="CANVA_APP_ID is set to the default placeholder value. Please update it in the .env file.";return this.debug&&console.error(s),{success:!1,code:"MISSING_FIELD",message:s}}return{success:!0,data:t}}catch(e){let t=`Unknown Error reading CANVA_APP_ID from .env file: ${e instanceof Error?e.message:String(e)}`;return this.debug&&console.error(t),{success:!1,code:"ENV_READ_ERROR",message:t}}}constructPreviewUrl(e){let t=this.encodeUiState({appId:e}),s=this.env.CANVA_ENV_URL,n=new URL("/login/",s),a=new URL("/design",s);return a.searchParams.append("create",""),a.searchParams.append("width","800"),a.searchParams.append("height","600"),a.searchParams.append("units","px"),a.searchParams.append("ui",t),n.searchParams.append("redirect",a.pathname+a.search),n.toString()}encodeUiState(e){let t={E:{"A?":"N",S:e.appId,g:!0}},s=JSON.stringify(t);return btoa(s).replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/[=]/g,"")}};var dt=kt(ct(),1);import qr from"fs/promises";import Jr from"path";var Ce=class{constructor(e,t=qr,s=Jr,n=!1){this.env=e;this.fileSystem=t;this.pathModule=s;this.debug=n}get isChina(){return rt(this.env.FLAVOR)}handleError(e,t,s){let n=`${t}: ${e instanceof Error?e.message:String(e)}`;return this.debug&&console.error(n),{success:!1,code:s,message:n}}async handleFileOperation(e,t,s){try{return{success:!0,data:await e()}}catch(n){return this.handleError(n,`Failed to ${s} file at ${t}`,"FILE_NOT_FOUND")}}async getAppIdFromEnvFile(){let e=this.pathModule.resolve(process.cwd(),".env"),t=await this.exists(e);if(!t.success||!t.data){let i="No .env file found, ensure you are in your intended app's directory.";return this.debug&&console.error(i),{success:!1,code:"FILE_NOT_FOUND",message:i}}let s=await this.readFile(e);if(!s.success)return s;let a=dt.parse(s.data).CANVA_APP_ID;if(!a){let i="CANVA_APP_ID not found in .env file";return this.debug&&console.error(i),{success:!1,code:"MISSING_FIELD",message:i}}return{success:!0,data:a}}async exists(e){return this.handleFileOperation(()=>this.fileSystem.access(e),e,"access").then(t=>({success:!0,data:t.success}))}async readFile(e){return this.handleFileOperation(()=>this.fileSystem.readFile(e,"utf-8"),e,"read")}async writeFile(e,t){return this.handleFileOperation(async()=>(await this.fileSystem.writeFile(e,t,"utf-8"),!0),e,"write")}async fetchRemoteEnvTemplate(){try{let e=await fetch("https://raw.githubusercontent.com/canva-sdks/canva-apps-sdk-starter-kit/refs/heads/main/.env.template");return e.ok?{success:!0,data:await e.text()}:this.handleError(new Error(e.statusText),"Failed to fetch .env.template","FILE_NOT_FOUND")}catch(e){return this.handleError(e,"Failed to fetch .env.template","FILE_NOT_FOUND")}}async parseEnvFile(e){let t=await this.exists(e);if(!t.success||!t.data)return{success:!0,data:new Set};let s=await this.readFile(e);return s.success?{success:!0,data:new Set(s.data.split(`
4
+ `),a=a.replace(/\\r/g,"\r")),e[n]=a}return e}function Fr(r){let e=ot(r),t=w.configDotenv({path:e});if(!t.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw i.code="MISSING_DATA",i}let s=it(r).split(","),n=s.length,a;for(let i=0;i<n;i++)try{let o=s[i].trim(),d=Gr(t,o);a=w.decrypt(d.ciphertext,d.key);break}catch(o){if(i+1>=n)throw o}return w.parse(a)}function Mr(r){console.log(`[dotenv@${Ze}][INFO] ${r}`)}function Ur(r){console.log(`[dotenv@${Ze}][WARN] ${r}`)}function Ie(r){console.log(`[dotenv@${Ze}][DEBUG] ${r}`)}function it(r){return r&&r.DOTENV_KEY&&r.DOTENV_KEY.length>0?r.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Gr(r,e){let t;try{t=new URL(e)}catch(o){if(o.code==="ERR_INVALID_URL"){let d=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw d.code="INVALID_DOTENV_KEY",d}throw o}let s=t.password;if(!s){let o=new Error("INVALID_DOTENV_KEY: Missing key part");throw o.code="INVALID_DOTENV_KEY",o}let n=t.searchParams.get("environment");if(!n){let o=new Error("INVALID_DOTENV_KEY: Missing environment part");throw o.code="INVALID_DOTENV_KEY",o}let a=`DOTENV_VAULT_${n.toUpperCase()}`,i=r.parsed[a];if(!i){let o=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);throw o.code="NOT_FOUND_DOTENV_ENVIRONMENT",o}return{ciphertext:i,key:s}}function ot(r){let e=null;if(r&&r.path&&r.path.length>0)if(Array.isArray(r.path))for(let t of r.path)Le.existsSync(t)&&(e=t.endsWith(".vault")?t:`${t}.vault`);else e=r.path.endsWith(".vault")?r.path:`${r.path}.vault`;else e=$e.resolve(process.cwd(),".env.vault");return Le.existsSync(e)?e:null}function at(r){return r[0]==="~"?$e.join(jr.homedir(),r.slice(1)):r}function zr(r){Mr("Loading env from encrypted .env.vault");let e=w._parseVault(r),t=process.env;return r&&r.processEnv!=null&&(t=r.processEnv),w.populate(t,e,r),{parsed:e}}function Br(r){let e=$e.resolve(process.cwd(),".env"),t="utf8",s=!!(r&&r.debug);r&&r.encoding?t=r.encoding:s&&Ie("No encoding is specified. UTF-8 is used by default");let n=[e];if(r&&r.path)if(!Array.isArray(r.path))n=[at(r.path)];else{n=[];for(let d of r.path)n.push(at(d))}let a,i={};for(let d of n)try{let u=w.parse(Le.readFileSync(d,{encoding:t}));w.populate(i,u,r)}catch(u){s&&Ie(`Failed to load ${d} ${u.message}`),a=u}let o=process.env;return r&&r.processEnv!=null&&(o=r.processEnv),w.populate(o,i,r),a?{parsed:i,error:a}:{parsed:i}}function Kr(r){if(it(r).length===0)return w.configDotenv(r);let e=ot(r);return e?w._configVault(r):(Ur(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),w.configDotenv(r))}function Yr(r,e){let t=Buffer.from(e.slice(-64),"hex"),s=Buffer.from(r,"base64"),n=s.subarray(0,12),a=s.subarray(-16);s=s.subarray(12,-16);try{let i=Vr.createDecipheriv("aes-256-gcm",t,n);return i.setAuthTag(a),`${i.update(s)}${i.final()}`}catch(i){let o=i instanceof RangeError,d=i.message==="Invalid key length",u=i.message==="Unsupported state or unable to authenticate data";if(o||d){let h=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw h.code="INVALID_DOTENV_KEY",h}else if(u){let h=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw h.code="DECRYPTION_FAILED",h}else throw i}}function Wr(r,e,t={}){let s=!!(t&&t.debug),n=!!(t&&t.override);if(typeof e!="object"){let a=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw a.code="OBJECT_REQUIRED",a}for(let a of Object.keys(e))Object.prototype.hasOwnProperty.call(r,a)?(n===!0&&(r[a]=e[a]),s&&Ie(n===!0?`"${a}" is already defined and WAS overwritten`:`"${a}" is already defined and was NOT overwritten`)):r[a]=e[a]}var w={configDotenv:Br,_configVault:zr,_parseVault:Fr,config:Kr,decrypt:Yr,parse:Zr,populate:Wr};$.exports.configDotenv=w.configDotenv;$.exports._configVault=w._configVault;$.exports._parseVault=w._parseVault;$.exports.config=w.config;$.exports.decrypt=w.decrypt;$.exports.parse=w.parse;$.exports.populate=w.populate;$.exports=w});var y;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(let o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(let i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(y||(y={}));var Pe;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Pe||(Pe={}));var p=y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),j=r=>{switch(typeof r){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(r)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(r)?p.array:r===null?p.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?p.promise:typeof Map<"u"&&r instanceof Map?p.map:typeof Set<"u"&&r instanceof Set?p.set:typeof Date<"u"&&r instanceof Date?p.date:p.object;default:return p.unknown}},c=y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),At=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),N=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,d=0;for(;d<i.path.length;){let u=i.path[d];d===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],d++}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};N.create=r=>new N(r);var oe=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===p.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,y.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${y.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${y.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${y.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:y.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,y.assertNever(r)}return{message:t}},ze=oe;function Nt(r){ze=r}function Ee(){return ze}var ke=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="",d=s.filter(u=>!!u).slice().reverse();for(let u of d)o=u(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},Tt=[];function l(r,e){let t=Ee(),s=ke({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===oe?void 0:oe].filter(n=>!!n)});r.common.issues.push(s)}var b=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return v;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,i=await n.value;s.push({key:a,value:i})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return v;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}},v=Object.freeze({status:"aborted"}),ie=r=>({status:"dirty",value:r}),E=r=>({status:"valid",value:r}),De=r=>r.status==="aborted",je=r=>r.status==="dirty",G=r=>r.status==="valid",me=r=>typeof Promise<"u"&&r instanceof Promise;function Ae(r,e,t,s){if(t==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?s:t==="a"?s.call(r):s?s.value:e.get(r)}function Be(r,e,t,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t}var f;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(f||(f={}));var fe,he,R=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ue=(r,e)=>{if(G(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new N(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{var d,u;let{message:h}=r;return i.code==="invalid_enum_value"?{message:h??o.defaultError}:typeof o.data>"u"?{message:(d=h??s)!==null&&d!==void 0?d:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(u=h??t)!==null&&u!==void 0?u:o.defaultError}},description:n}}var g=class{get description(){return this._def.description}_getType(e){return j(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:j(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:j(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(me(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;let n={common:{issues:[],async:(s=t?.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Ue(n,a)}"~validate"(e){var t,s;let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:n});return G(a)?{value:a.value}:{issues:n.common.issues}}catch(a){!((s=(t=a?.message)===null||t===void 0?void 0:t.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(a=>G(a)?{value:a.value}:{issues:n.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:j(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(me(n)?n:Promise.resolve(n));return Ue(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let i=e(n),o=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new T({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return O.create(this,this._def)}nullable(){return S.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return L.create(this)}promise(){return M.create(this,this._def)}or(e){return J.create([this,e],this._def)}and(e){return H.create(this,e,this._def)}transform(e){return new T({..._(this._def),schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new re({..._(this._def),innerType:this,defaultValue:t,typeName:m.ZodDefault})}brand(){return new ve({typeName:m.ZodBranded,type:this,..._(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new se({..._(this._def),innerType:this,catchValue:t,typeName:m.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return _e.create(this,e)}readonly(){return ne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ot=/^c[^\s-]{8,}$/i,Rt=/^[0-9a-z]+$/,It=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ct=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,St=/^[a-z0-9_-]{21}$/i,Pt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Dt=/^[-+]?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)?)??$/,jt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Vt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Se,Lt=/^(?:(?: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])$/,$t=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Zt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ft=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ut=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ke="((\\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])))",Gt=new RegExp(`^${Ke}$`);function Ye(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function zt(r){return new RegExp(`^${Ye(r)}$`)}function We(r){let e=`${Ke}T${Ye(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Bt(r,e){return!!((e==="v4"||!e)&&Lt.test(r)||(e==="v6"||!e)&&Zt.test(r))}function Kt(r,e){if(!Pt.test(r))return!1;try{let[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||!n.typ||!n.alg||e&&n.alg!==e)}catch{return!1}}function Yt(r,e){return!!((e==="v4"||!e)&&$t.test(r)||(e==="v6"||!e)&&Ft.test(r))}var Z=class r extends g{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.string,received:a.parsedType}),v}let s=new b,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")jt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Se||(Se=new RegExp(Vt,"u")),Se.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Ct.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")St.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")It.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?We(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Gt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?zt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Bt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Kt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Yt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Mt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Ut.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):y.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...f.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...f.errToObj(e)})}url(e){return this._addCheck({kind:"url",...f.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...f.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...f.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...f.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...f.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...f.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...f.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...f.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...f.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...f.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...f.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...f.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(s=e?.local)!==null&&s!==void 0?s:!1,...f.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...f.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...f.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...f.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...f.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...f.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...f.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...f.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...f.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...f.errToObj(t)})}nonempty(e){return this.min(1,f.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Z.create=r=>{var e;return new Z({checks:[],typeName:m.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};function Wt(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=parseInt(r.toFixed(n).replace(".","")),i=parseInt(e.toFixed(n).replace(".",""));return a%i/Math.pow(10,n)}var z=class r extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.number,received:a.parsedType}),v}let s,n=new b;for(let a of this._def.checks)a.kind==="int"?y.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Wt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_finite,message:a.message}),n.dirty()):y.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,f.toString(t))}gt(e,t){return this.setLimit("min",e,!1,f.toString(t))}lte(e,t){return this.setLimit("max",e,!0,f.toString(t))}lt(e,t){return this.setLimit("max",e,!1,f.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:f.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:f.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:f.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&y.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};z.create=r=>new z({checks:[],typeName:m.ZodNumber,coerce:r?.coerce||!1,..._(r)});var B=class r extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let s,n=new b;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):y.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:p.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,f.toString(t))}gt(e,t){return this.setLimit("min",e,!1,f.toString(t))}lte(e,t){return this.setLimit("max",e,!0,f.toString(t))}lt(e,t){return this.setLimit("max",e,!1,f.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:f.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};B.create=r=>{var e;return new B({checks:[],typeName:m.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,..._(r)})};var K=class extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.boolean,received:s.parsedType}),v}return E(e.data)}};K.create=r=>new K({typeName:m.ZodBoolean,coerce:r?.coerce||!1,..._(r)});var Y=class r extends g{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.date,received:a.parsedType}),v}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),v}let s=new b,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):y.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:f.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:f.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Y.create=r=>new Y({checks:[],coerce:r?.coerce||!1,typeName:m.ZodDate,..._(r)});var ce=class extends g{_parse(e){if(this._getType(e)!==p.symbol){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.symbol,received:s.parsedType}),v}return E(e.data)}};ce.create=r=>new ce({typeName:m.ZodSymbol,..._(r)});var W=class extends g{_parse(e){if(this._getType(e)!==p.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.undefined,received:s.parsedType}),v}return E(e.data)}};W.create=r=>new W({typeName:m.ZodUndefined,..._(r)});var q=class extends g{_parse(e){if(this._getType(e)!==p.null){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.null,received:s.parsedType}),v}return E(e.data)}};q.create=r=>new q({typeName:m.ZodNull,..._(r)});var F=class extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return E(e.data)}};F.create=r=>new F({typeName:m.ZodAny,..._(r)});var V=class extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return E(e.data)}};V.create=r=>new V({typeName:m.ZodUnknown,..._(r)});var I=class extends g{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:p.never,received:t.parsedType}),v}};I.create=r=>new I({typeName:m.ZodNever,..._(r)});var de=class extends g{_parse(e){if(this._getType(e)!==p.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.void,received:s.parsedType}),v}return E(e.data)}};de.create=r=>new de({typeName:m.ZodVoid,..._(r)});var L=class r extends g{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==p.array)return l(t,{code:c.invalid_type,expected:p.array,received:t.parsedType}),v;if(n.exactLength!==null){let i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(l(t,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(l(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(l(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new R(t,i,t.path,o)))).then(i=>b.mergeArray(s,i));let a=[...t.data].map((i,o)=>n.type._parseSync(new R(t,i,t.path,o)));return b.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:f.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:f.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:f.toString(t)}})}nonempty(e){return this.min(1,e)}};L.create=(r,e)=>new L({type:r,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray,..._(e)});function ae(r){if(r instanceof A){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=O.create(ae(s))}return new A({...r._def,shape:()=>e})}else return r instanceof L?new L({...r._def,type:ae(r.element)}):r instanceof O?O.create(ae(r.unwrap())):r instanceof S?S.create(ae(r.unwrap())):r instanceof C?C.create(r.items.map(e=>ae(e))):r}var A=class r extends g{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=y.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==p.object){let u=this._getOrReturnCtx(e);return l(u,{code:c.invalid_type,expected:p.object,received:u.parsedType}),v}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof I&&this._def.unknownKeys==="strip"))for(let u in n.data)i.includes(u)||o.push(u);let d=[];for(let u of i){let h=a[u],k=n.data[u];d.push({key:{status:"valid",value:u},value:h._parse(new R(n,k,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof I){let u=this._def.unknownKeys;if(u==="passthrough")for(let h of o)d.push({key:{status:"valid",value:h},value:{status:"valid",value:n.data[h]}});else if(u==="strict")o.length>0&&(l(n,{code:c.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let h of o){let k=n.data[h];d.push({key:{status:"valid",value:h},value:u._parse(new R(n,k,n.path,h)),alwaysSet:h in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let h of d){let k=await h.key,xe=await h.value;u.push({key:k,value:xe,alwaysSet:h.alwaysSet})}return u}).then(u=>b.mergeObjectSync(s,u)):b.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return f.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,a,i,o;let d=(i=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=f.errToObj(e).message)!==null&&o!==void 0?o:d}:{message:d}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:m.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return y.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return y.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new r({...this._def,shape:()=>t})}deepPartial(){return ae(this)}partial(e){let t={};return y.objectKeys(this.shape).forEach(s=>{let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return y.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof O;)a=a._def.innerType;t[s]=a}}),new r({...this._def,shape:()=>t})}keyof(){return qe(y.objectKeys(this.shape))}};A.create=(r,e)=>new A({shape:()=>r,unknownKeys:"strip",catchall:I.create(),typeName:m.ZodObject,..._(e)});A.strictCreate=(r,e)=>new A({shape:()=>r,unknownKeys:"strict",catchall:I.create(),typeName:m.ZodObject,..._(e)});A.lazycreate=(r,e)=>new A({shape:r,unknownKeys:"strip",catchall:I.create(),typeName:m.ZodObject,..._(e)});var J=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new N(o.ctx.common.issues));return l(t,{code:c.invalid_union,unionErrors:i}),v}if(t.common.async)return Promise.all(s.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let d of s){let u={...t,common:{...t.common,issues:[]},parent:null},h=d._parseSync({data:t.data,path:t.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(d=>new N(d));return l(t,{code:c.invalid_union,unionErrors:o}),v}}get options(){return this._def.options}};J.create=(r,e)=>new J({options:r,typeName:m.ZodUnion,..._(e)});var D=r=>r instanceof Q?D(r.schema):r instanceof T?D(r.innerType()):r instanceof X?[r.value]:r instanceof ee?r.options:r instanceof te?y.objectValues(r.enum):r instanceof re?D(r._def.innerType):r instanceof W?[void 0]:r instanceof q?[null]:r instanceof O?[void 0,...D(r.unwrap())]:r instanceof S?[null,...D(r.unwrap())]:r instanceof ve||r instanceof ne?D(r.unwrap()):r instanceof se?D(r._def.innerType):[],Ne=class r extends g{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return l(t,{code:c.invalid_type,expected:p.object,received:t.parsedType}),v;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),v)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let i=D(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new r({typeName:m.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,..._(s)})}};function Ve(r,e){let t=j(r),s=j(e);if(r===e)return{valid:!0,data:r};if(t===p.object&&s===p.object){let n=y.objectKeys(e),a=y.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};for(let o of a){let d=Ve(r[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(t===p.array&&s===p.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],d=Ve(i,o);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return t===p.date&&s===p.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var H=class extends g{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(De(a)||De(i))return v;let o=Ve(a.value,i.value);return o.valid?((je(a)||je(i))&&t.dirty(),{status:t.value,value:o.data}):(l(s,{code:c.invalid_intersection_types}),v)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};H.create=(r,e,t)=>new H({left:r,right:e,typeName:m.ZodIntersection,..._(t)});var C=class r extends g{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.array)return l(s,{code:c.invalid_type,expected:p.array,received:s.parsedType}),v;if(s.data.length<this._def.items.length)return l(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&s.data.length>this._def.items.length&&(l(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((i,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new R(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>b.mergeArray(t,i)):b.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};C.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new C({items:r,typeName:m.ZodTuple,rest:null,..._(e)})};var Te=class r extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.object)return l(s,{code:c.invalid_type,expected:p.object,received:s.parsedType}),v;let n=[],a=this._def.keyType,i=this._def.valueType;for(let o in s.data)n.push({key:a._parse(new R(s,o,s.path,o)),value:i._parse(new R(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?b.mergeObjectAsync(t,n):b.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof g?new r({keyType:e,valueType:t,typeName:m.ZodRecord,..._(s)}):new r({keyType:Z.create(),valueType:e,typeName:m.ZodRecord,..._(t)})}},ue=class extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.map)return l(s,{code:c.invalid_type,expected:p.map,received:s.parsedType}),v;let n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,d],u)=>({key:n._parse(new R(s,o,s.path,[u,"key"])),value:a._parse(new R(s,d,s.path,[u,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of i){let u=await d.key,h=await d.value;if(u.status==="aborted"||h.status==="aborted")return v;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let d of i){let u=d.key,h=d.value;if(u.status==="aborted"||h.status==="aborted")return v;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}}}};ue.create=(r,e,t)=>new ue({valueType:e,keyType:r,typeName:m.ZodMap,..._(t)});var le=class r extends g{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.set)return l(s,{code:c.invalid_type,expected:p.set,received:s.parsedType}),v;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(l(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(l(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function i(d){let u=new Set;for(let h of d){if(h.status==="aborted")return v;h.status==="dirty"&&t.dirty(),u.add(h.value)}return{status:t.value,value:u}}let o=[...s.data.values()].map((d,u)=>a._parse(new R(s,d,s.path,u)));return s.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:f.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:f.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};le.create=(r,e)=>new le({valueType:r,minSize:null,maxSize:null,typeName:m.ZodSet,..._(e)});var Oe=class r extends g{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return l(t,{code:c.invalid_type,expected:p.function,received:t.parsedType}),v;function s(o,d){return ke({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ee(),oe].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:d}})}function n(o,d){return ke({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ee(),oe].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:d}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof M){let o=this;return E(async function(...d){let u=new N([]),h=await o._def.args.parseAsync(d,a).catch(U=>{throw u.addIssue(s(d,U)),u}),k=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(k,a).catch(U=>{throw u.addIssue(n(k,U)),u})})}else{let o=this;return E(function(...d){let u=o._def.args.safeParse(d,a);if(!u.success)throw new N([s(d,u.error)]);let h=Reflect.apply(i,this,u.data),k=o._def.returns.safeParse(h,a);if(!k.success)throw new N([n(h,k.error)]);return k.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:C.create(e).rest(V.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||C.create([]).rest(V.create()),returns:t||V.create(),typeName:m.ZodFunction,..._(s)})}},Q=class extends g{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Q.create=(r,e)=>new Q({getter:r,typeName:m.ZodLazy,..._(e)});var X=class extends g{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}};X.create=(r,e)=>new X({value:r,typeName:m.ZodLiteral,..._(e)});function qe(r,e){return new ee({values:r,typeName:m.ZodEnum,..._(e)})}var ee=class r extends g{constructor(){super(...arguments),fe.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{expected:y.joinValues(s),received:t.parsedType,code:c.invalid_type}),v}if(Ae(this,fe,"f")||Be(this,fe,new Set(this._def.values),"f"),!Ae(this,fe,"f").has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{received:t.data,code:c.invalid_enum_value,options:s}),v}return E(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};fe=new WeakMap;ee.create=qe;var te=class extends g{constructor(){super(...arguments),he.set(this,void 0)}_parse(e){let t=y.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==p.string&&s.parsedType!==p.number){let n=y.objectValues(t);return l(s,{expected:y.joinValues(n),received:s.parsedType,code:c.invalid_type}),v}if(Ae(this,he,"f")||Be(this,he,new Set(y.getValidEnumValues(this._def.values)),"f"),!Ae(this,he,"f").has(e.data)){let n=y.objectValues(t);return l(s,{received:s.data,code:c.invalid_enum_value,options:n}),v}return E(e.data)}get enum(){return this._def.values}};he=new WeakMap;te.create=(r,e)=>new te({values:r,typeName:m.ZodNativeEnum,..._(e)});var M=class extends g{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return l(t,{code:c.invalid_type,expected:p.promise,received:t.parsedType}),v;let s=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return E(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};M.create=(r,e)=>new M({type:r,typeName:m.ZodPromise,..._(e)});var T=class extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{l(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return v;let d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?v:d.status==="dirty"||t.value==="dirty"?ie(d.value):d});{if(t.value==="aborted")return v;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?v:o.status==="dirty"||t.value==="dirty"?ie(o.value):o}}if(n.type==="refinement"){let i=o=>{let d=n.refinement(o,a);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!G(i))return i;let o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>G(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);y.assertNever(n)}};T.create=(r,e,t)=>new T({schema:r,typeName:m.ZodEffects,effect:e,..._(t)});T.createWithPreprocess=(r,e,t)=>new T({schema:e,effect:{type:"preprocess",transform:r},typeName:m.ZodEffects,..._(t)});var O=class extends g{_parse(e){return this._getType(e)===p.undefined?E(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};O.create=(r,e)=>new O({innerType:r,typeName:m.ZodOptional,..._(e)});var S=class extends g{_parse(e){return this._getType(e)===p.null?E(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};S.create=(r,e)=>new S({innerType:r,typeName:m.ZodNullable,..._(e)});var re=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===p.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};re.create=(r,e)=>new re({innerType:r,typeName:m.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var se=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return me(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new N(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new N(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};se.create=(r,e)=>new se({innerType:r,typeName:m.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var pe=class extends g{_parse(e){if(this._getType(e)!==p.nan){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.nan,received:s.parsedType}),v}return{status:"valid",value:e.data}}};pe.create=r=>new pe({typeName:m.ZodNaN,..._(r)});var qt=Symbol("zod_brand"),ve=class extends g{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},_e=class r extends g{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?v:a.status==="dirty"?(t.dirty(),ie(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?v:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:m.ZodPipeline})}},ne=class extends g{_parse(e){let t=this._def.innerType._parse(e),s=n=>(G(n)&&(n.value=Object.freeze(n.value)),n);return me(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};ne.create=(r,e)=>new ne({innerType:r,typeName:m.ZodReadonly,..._(e)});function Je(r,e={},t){return r?F.create().superRefine((s,n)=>{var a,i;if(!r(s)){let o=typeof e=="function"?e(s):typeof e=="string"?{message:e}:e,d=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;n.addIssue({code:"custom",...u,fatal:d})}}):F.create()}var Jt={object:A.lazycreate},m;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(m||(m={}));var Ht=(r,e={message:`Input not instance of ${r.name}`})=>Je(t=>t instanceof r,e),He=Z.create,Qe=z.create,Qt=pe.create,Xt=B.create,Xe=K.create,er=Y.create,tr=ce.create,rr=W.create,sr=q.create,nr=F.create,ar=V.create,ir=I.create,or=de.create,cr=L.create,ge=A.create,dr=A.strictCreate,ur=J.create,lr=Ne.create,pr=H.create,fr=C.create,hr=Te.create,mr=ue.create,vr=le.create,_r=Oe.create,gr=Q.create,yr=X.create,wr=ee.create,xr=te.create,br=M.create,Ge=T.create,Er=O.create,kr=S.create,Ar=T.createWithPreprocess,Nr=_e.create,Tr=()=>He().optional(),Or=()=>Qe().optional(),Rr=()=>Xe().optional(),Ir={string:r=>Z.create({...r,coerce:!0}),number:r=>z.create({...r,coerce:!0}),boolean:r=>K.create({...r,coerce:!0}),bigint:r=>B.create({...r,coerce:!0}),date:r=>Y.create({...r,coerce:!0})},Cr=v,ye=Object.freeze({__proto__:null,defaultErrorMap:oe,setErrorMap:Nt,getErrorMap:Ee,makeIssue:ke,EMPTY_PATH:Tt,addIssueToContext:l,ParseStatus:b,INVALID:v,DIRTY:ie,OK:E,isAborted:De,isDirty:je,isValid:G,isAsync:me,get util(){return y},get objectUtil(){return Pe},ZodParsedType:p,getParsedType:j,ZodType:g,datetimeRegex:We,ZodString:Z,ZodNumber:z,ZodBigInt:B,ZodBoolean:K,ZodDate:Y,ZodSymbol:ce,ZodUndefined:W,ZodNull:q,ZodAny:F,ZodUnknown:V,ZodNever:I,ZodVoid:de,ZodArray:L,ZodObject:A,ZodUnion:J,ZodDiscriminatedUnion:Ne,ZodIntersection:H,ZodTuple:C,ZodRecord:Te,ZodMap:ue,ZodSet:le,ZodFunction:Oe,ZodLazy:Q,ZodLiteral:X,ZodEnum:ee,ZodNativeEnum:te,ZodPromise:M,ZodEffects:T,ZodTransformer:T,ZodOptional:O,ZodNullable:S,ZodDefault:re,ZodCatch:se,ZodNaN:pe,BRAND:qt,ZodBranded:ve,ZodPipeline:_e,ZodReadonly:ne,custom:Je,Schema:g,ZodSchema:g,late:Jt,get ZodFirstPartyTypeKind(){return m},coerce:Ir,any:nr,array:cr,bigint:Xt,boolean:Xe,date:er,discriminatedUnion:lr,effect:Ge,enum:wr,function:_r,instanceof:Ht,intersection:pr,lazy:gr,literal:yr,map:mr,nan:Qt,nativeEnum:xr,never:ir,null:sr,nullable:kr,number:Qe,object:ge,oboolean:Rr,onumber:Or,optional:Er,ostring:Tr,pipeline:Nr,preprocess:Ar,promise:br,record:hr,set:vr,strictObject:dr,string:He,symbol:tr,transformer:Ge,tuple:fr,undefined:rr,union:ur,unknown:ar,void:or,NEVER:Cr,ZodIssueCode:c,quotelessJson:At,ZodError:N});function et(r){let e=r.runtimeEnvStrict??r.runtimeEnv??process.env;if(r.emptyStringAsUndefined??!1)for(let[x,P]of Object.entries(e))P===""&&delete e[x];if(!!r.skipValidation)return e;let n=typeof r.client=="object"?r.client:{},a=typeof r.server=="object"?r.server:{},i=typeof r.shared=="object"?r.shared:{},o=ge(n),d=ge(a),u=ge(i),h=r.isServer??(typeof window>"u"||"Deno"in window),k=o.merge(u),xe=d.merge(u).merge(o),U=h?xe.safeParse(e):k.safeParse(e),lt=r.onValidationError??(x=>{throw console.error("\u274C Invalid environment variables:",x.flatten().fieldErrors),new Error("Invalid environment variables")}),pt=r.onInvalidAccess??(x=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(U.success===!1)return lt(U.error);let ft=x=>r.clientPrefix?!x.startsWith(r.clientPrefix)&&!(x in u.shape):!0,ht=x=>h||!ft(x),mt=x=>x==="__esModule"||x==="$$typeof",vt=(r.extends??[]).reduce((x,P)=>Object.assign(x,P),{}),_t=Object.assign(U.data,vt);return new Proxy(_t,{get(x,P){if(typeof P=="string"&&!mt(P))return ht(P)?Reflect.get(x,P):pt(P)}})}var we=(i=>(i.PROD_CN="prod-cn",i.PROD="prod",i.STAGING="staging",i.STAGING_CN="staging-cn",i.DEV="dev",i.LOCAL="local",i))(we||{}),tt=({fallback:r="prod"})=>{let e=process.env.ENV;if(!e)return r;let t=e.toLowerCase().trim();return Object.values(we).includes(t)?t:r},rt=r=>r==="prod-cn"||r==="staging-cn";var Sr=r=>{switch(r){case"local":return{CONNECT_API_BASE_URL:"http://localhost:3000/rest",CANVA_ENV_URL:"http://localhost:3000",CANVA_CLI_CLIENT_ID:"FAKE_CLIENT_ID",FLAVOR:"local"};case"dev":return{CONNECT_API_BASE_URL:"https://api.canva-dev.com/rest",CANVA_ENV_URL:"https://www.canva-dev.com",CANVA_CLI_CLIENT_ID:"OC-AZFEJKOjQYw3",FLAVOR:"dev"};case"staging-cn":return{CONNECT_API_BASE_URL:"https://api.canva-staging.cn/rest",CANVA_ENV_URL:"https://www.canva-staging.cn",CANVA_CLI_CLIENT_ID:"OC-AZNlOhtxI_Zb",FLAVOR:"staging-cn"};case"staging":return{CONNECT_API_BASE_URL:"https://api.canva-staging.com/rest",CANVA_ENV_URL:"https://www.canva-staging.com",CANVA_CLI_CLIENT_ID:"OC-AZH-EOTpT8Ib",FLAVOR:"staging"};case"prod-cn":return{CONNECT_API_BASE_URL:"https://api.canva.cn/rest",CANVA_ENV_URL:"https://www.canva.cn",CANVA_CLI_CLIENT_ID:"OC-AZN2AS1hKtVM",FLAVOR:"prod-cn"};case"prod":default:return{CONNECT_API_BASE_URL:"https://api.canva.com/rest",CANVA_ENV_URL:"https://www.canva.com",CANVA_CLI_CLIENT_ID:"OC-AZICxlGo2biD",FLAVOR:"prod"}}},st=({fallback:r="prod"})=>et({server:{FLAVOR:ye.enum(["prod","prod-cn","staging","staging-cn","dev","local"]).default(r),CONNECT_API_BASE_URL:ye.string().url(),CANVA_ENV_URL:ye.string().url(),CANVA_CLI_CLIENT_ID:ye.enum(["OC-AZICxlGo2biD","OC-AZN2AS1hKtVM","OC-AZH-EOTpT8Ib","OC-AZNlOhtxI_Zb","OC-AZFEJKOjQYw3","FAKE_CLIENT_ID"]).default("OC-AZICxlGo2biD")},runtimeEnv:{...Sr(tt({fallback:r}))},emptyStringAsUndefined:!0});var Re=class{constructor(e,t,s=!1){this.envService=e;this.env=t;this.debug=s}generatePreviewResult=async e=>{let t=e;if(!t){let n=await this.getAppId();if(!n.success)return n;t=n.data}return{success:!0,data:this.constructPreviewUrl(t)}};async getAppId(){try{let e=await this.envService.getAppIdFromEnvFile();if(!e.success)return e;let t=e.data;if(t==="YOUR_APP_ID_HERE"){let s="CANVA_APP_ID is set to the default placeholder value. Please update it in the .env file.";return this.debug&&console.error(s),{success:!1,code:"MISSING_FIELD",message:s}}return{success:!0,data:t}}catch(e){let t=`Unknown Error reading CANVA_APP_ID from .env file: ${e instanceof Error?e.message:String(e)}`;return this.debug&&console.error(t),{success:!1,code:"ENV_READ_ERROR",message:t}}}constructPreviewUrl(e){let t=this.encodeUiState({appId:e}),s=this.env.CANVA_ENV_URL,n=new URL("/login/",s),a=new URL("/design",s);return a.searchParams.append("create",""),a.searchParams.append("width","800"),a.searchParams.append("height","600"),a.searchParams.append("units","px"),a.searchParams.append("ui",t),n.searchParams.append("redirect",a.pathname+a.search),n.toString()}encodeUiState(e){let t={E:{"A?":"N",S:e.appId,g:!0}},s=JSON.stringify(t);return btoa(s).replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/[=]/g,"")}};var dt=kt(ct(),1);import qr from"fs/promises";import Jr from"path";var Ce=class{constructor(e,t=qr,s=Jr,n=!1){this.env=e;this.fileSystem=t;this.pathModule=s;this.debug=n}get isChina(){return rt(this.env.FLAVOR)}handleError(e,t,s){let n=`${t}: ${e instanceof Error?e.message:String(e)}`;return this.debug&&console.error(n),{success:!1,code:s,message:n}}async handleFileOperation(e,t,s){try{return{success:!0,data:await e()}}catch(n){return this.handleError(n,`Failed to ${s} file at ${t}`,"FILE_NOT_FOUND")}}async getAppIdFromEnvFile(){let e=this.pathModule.resolve(process.cwd(),".env"),t=await this.exists(e);if(!t.success||!t.data){let i="No .env file found, ensure you are in your intended app's directory.";return this.debug&&console.error(i),{success:!1,code:"FILE_NOT_FOUND",message:i}}let s=await this.readFile(e);if(!s.success)return s;let a=dt.parse(s.data).CANVA_APP_ID;if(!a){let i="CANVA_APP_ID not found in .env file";return this.debug&&console.error(i),{success:!1,code:"MISSING_FIELD",message:i}}return{success:!0,data:a}}async exists(e){return this.handleFileOperation(()=>this.fileSystem.access(e),e,"access").then(t=>({success:!0,data:t.success}))}async readFile(e){return this.handleFileOperation(()=>this.fileSystem.readFile(e,"utf-8"),e,"read")}async writeFile(e,t){return this.handleFileOperation(async()=>(await this.fileSystem.writeFile(e,t,"utf-8"),!0),e,"write")}async fetchRemoteEnvTemplate(){try{let e=await fetch("https://raw.githubusercontent.com/canva-sdks/canva-apps-sdk-starter-kit/refs/heads/main/.env.template");return e.ok?{success:!0,data:await e.text()}:this.handleError(new Error(e.statusText),"Failed to fetch .env.template","FILE_NOT_FOUND")}catch(e){return this.handleError(e,"Failed to fetch .env.template","FILE_NOT_FOUND")}}async parseEnvFile(e){let t=await this.exists(e);if(!t.success||!t.data)return{success:!0,data:new Set};let s=await this.readFile(e);return s.success?{success:!0,data:new Set(s.data.split(`
5
5
  `).map(a=>a.trim()).filter(a=>a&&!a.startsWith("#")).filter(a=>a.includes("=")).map(a=>a.split("=")[0]?.trim()??"").filter(a=>a!==""))}:s}};var ut=st({fallback:"prod"}),Hr=new Ce(ut),Qr=new Re(Hr,ut),Ps=()=>Qr.generatePreviewResult();export{Ps as generatePreviewUrl};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canva/cli",
3
- "version": "0.0.1-beta.32",
3
+ "version": "0.0.1-beta.33",
4
4
  "description": "The official Canva CLI.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Canva Pty Ltd.",