@crossmint/cli 1.1.7 → 1.1.8

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/build-pkg.js CHANGED
@@ -10,4 +10,7 @@ await build({
10
10
  sourcemap: true,
11
11
  external: ["keytar"],
12
12
  inject: ["./shims/prelude.js"],
13
+ define: {
14
+ "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
15
+ },
13
16
  });
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
- var Zs=(t,e)=>()=>(t&&(e=t(t=0)),e);var Hs=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);import Gr from"path";import{fileURLToPath as Zr}from"url";var l=Zs(()=>{"use strict"});var Bs=Hs((jl,Vr)=>{Vr.exports={name:"@crossmint/cli",version:"1.1.7",description:"",keywords:[],license:"ISC",author:"",type:"module",main:"dist/bin/crossmint.js",bin:{crossmint:"dist/bin/crossmint.js"},scripts:{build:"tsup --env.NODE_ENV production","build:pkg":"node ./build-pkg.js",dev:"tsup --watch --env.NODE_ENV development",start:"pnpm build && node dist/bin/crossmint.js","test:vitest":"vitest run","test:vitest:watch":"vitest"},dependencies:{"@crossmint/common-consts":"workspace:*","@crossmint/common-string-utils":"workspace:*","@crossmint/common-types":"workspace:*","@crossmint/data-dbs-types":"workspace:*","@crossmint/products-console-types":"workspace:*","@inquirer/prompts":"7.4.0",chalk:"4.1.2",commander:"12.0.0",keytar:"7.9.0",nanospinner:"1.2.2",open:"9.1.0"},devDependencies:{"@crossmint/tsconfig":"workspace:*","@crossmint/tsupconfig":"workspace:*","@crossmint/vitestconfig":"workspace:*","@types/node":"20.14.8","@yao-pkg/pkg":"6.3.2",esbuild:"0.25.2",vitest:"2.1.9"},pkg:{scripts:"dist/bin/crossmint.js",assets:[],targets:["node20-macos-arm64","node20-linux-x64","node20-macos-x64"],outputPath:"build"}}});l();import{program as ye}from"commander";l();l();var Ks={production:"https://www.crossmint.com",staging:"https://staging.crossmint.com",local:"http://localhost:3000"};function se(t){return Ks[t]}l();l();import it from"keytar";var ct="crossmint-cli";async function ve(t,e){return it.setPassword(ct,t,e)}async function Ee(t){return it.getPassword(ct,t)}async function De(t){return it.deletePassword(ct,t)}function kt(t){return ve("environment",t)}async function D(){return Ee("environment")}async function Lt(){return De("environment")}function Dt(t){return ve("sessionToken",t)}async function $t(){return Ee("sessionToken")}async function Mt(){return De("sessionToken")}function Re(t){return ve("projectId",t)}async function U(){return Ee("projectId")}async function Ut(){return De("projectId")}import{select as yr}from"@inquirer/prompts";l();l();l();l();l();l();var zs=Object.defineProperty;var W=(t,e)=>zs(t,"name",{value:e,configurable:!0});l();var b;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{let n={};for(let o of r)n[o]=o;return n},t.getValidEnumValues=r=>{let n=t.objectKeys(r).filter(i=>typeof r[r[i]]!="number"),o={};for(let i of n)o[i]=r[i];return t.objectValues(o)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(o);return n},t.find=(r,n)=>{for(let o of r)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function a(r,n=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=a,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(b||(b={}));var dt;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(dt||(dt={}));var m=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),J=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}},p=b.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"]),Ys=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),$=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let s=e||function(n){return n.message},a={_errors:[]},r=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)a._errors.push(s(o));else{let i=a,d=0;for(;d<o.path.length;){let u=o.path[d];d===o.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(s(o))):i[u]=i[u]||{_errors:[]},i=i[u],d++}}};return r(this),a}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){let s={},a=[];for(let r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(e(r))):a.push(e(r));return{formErrors:a,fieldErrors:s}}get formErrors(){return this.flatten()}};$.create=t=>new $(t);var Ne=(t,e)=>{let s;switch(t.code){case p.invalid_type:t.received===m.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case p.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,b.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:s=`Unrecognized key(s) in object: ${b.joinValues(t.keys,", ")}`;break;case p.invalid_union:s="Invalid input";break;case p.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${b.joinValues(t.options)}`;break;case p.invalid_enum_value:s=`Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`;break;case p.invalid_arguments:s="Invalid function arguments";break;case p.invalid_return_type:s="Invalid function return type";break;case p.invalid_date:s="Invalid date";break;case p.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:b.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case p.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case p.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case p.custom:s="Invalid input";break;case p.invalid_intersection_types:s="Intersection results could not be merged";break;case p.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case p.not_finite:s="Number must be finite";break;default:s=e.defaultError,b.assertNever(t)}return{message:s}},Wt=Ne;function qs(t){Wt=t}function Me(){return Wt}var Ue=t=>{let{data:e,path:s,errorMaps:a,issueData:r}=t,n=[...s,...r.path||[]],o={...r,path:n},i="",d=a.filter(u=>!!u).slice().reverse();for(let u of d)i=u(o,{data:e,defaultError:i}).message;return{...r,path:n,message:r.message||i}},Js=[];function f(t,e){let s=Ue({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Me(),Ne].filter(a=>!!a)});t.common.issues.push(s)}var N=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){let a=[];for(let r of s){if(r.status==="aborted")return E;r.status==="dirty"&&e.dirty(),a.push(r.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,s){let a=[];for(let r of s)a.push({key:await r.key,value:await r.value});return t.mergeObjectSync(e,a)}static mergeObjectSync(e,s){let a={};for(let r of s){let{key:n,value:o}=r;if(n.status==="aborted"||o.status==="aborted")return E;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(a[n.value]=o.value)}return{status:e.value,value:a}}},E=Object.freeze({status:"aborted"}),Gt=t=>({status:"dirty",value:t}),j=t=>({status:"valid",value:t}),pt=t=>t.status==="aborted",ut=t=>t.status==="dirty",Oe=t=>t.status==="valid",Ve=t=>typeof Promise<"u"&&t instanceof Promise,h;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var V=class{constructor(e,s,a,r){this._cachedPath=[],this.parent=e,this.data=s,this._path=a,this._key=r}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}},Vt=(t,e)=>{if(Oe(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let s=new $(t.common.issues);return this._error=s,this._error}}};function T(t){if(!t)return{};let{errorMap:e,invalid_type_error:s,required_error:a,description:r}=t;if(e&&(s||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,i)=>o.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:a??i.defaultError}:{message:s??i.defaultError},description:r}}var A=class{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)}get description(){return this._def.description}_getType(e){return J(e.data)}_getOrReturnCtx(e,s){return s||{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 N,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 s=this._parse(e);if(Ve(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){let s=this._parse(e);return Promise.resolve(s)}parse(e,s){let a=this.safeParse(e,s);if(a.success)return a.data;throw a.error}safeParse(e,s){var a;let r={common:{issues:[],async:(a=s?.async)!==null&&a!==void 0?a:!1,contextualErrorMap:s?.errorMap},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:J(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Vt(r,n)}async parseAsync(e,s){let a=await this.safeParseAsync(e,s);if(a.success)return a.data;throw a.error}async safeParseAsync(e,s){let a={common:{issues:[],contextualErrorMap:s?.errorMap,async:!0},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:J(e)},r=this._parse({data:e,path:a.path,parent:a}),n=await(Ve(r)?r:Promise.resolve(r));return Vt(a,n)}refine(e,s){let a=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,n)=>{let o=e(r),i=()=>n.addIssue({code:p.custom,...a(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,s){return this._refinement((a,r)=>e(a)?!0:(r.addIssue(typeof s=="function"?s(a,r):s),!1))}_refinement(e){return new M({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return G.create(this,this._def)}nullable(){return q.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Y.create(this,this._def)}promise(){return ee.create(this,this._def)}or(e){return le.create([this,e],this._def)}and(e){return de.create(this,e,this._def)}transform(e){return new M({...T(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let s=typeof e=="function"?e:()=>e;return new he({...T(this._def),innerType:this,defaultValue:s,typeName:y.ZodDefault})}brand(){return new Be({typeName:y.ZodBranded,type:this,...T(this._def)})}catch(e){let s=typeof e=="function"?e:()=>e;return new be({...T(this._def),innerType:this,catchValue:s,typeName:y.ZodCatch})}describe(e){let s=this.constructor;return new s({...this._def,description:e})}pipe(e){return je.create(this,e)}readonly(){return Pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xs=/^c[^\s-]{8,}$/i,Qs=/^[a-z][a-z0-9]*$/,ea=/^[0-9A-HJKMNP-TV-Z]{26}$/,ta=/^[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,sa=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",lt,ra=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,na=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,oa=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function ia(t,e){return!!((e==="v4"||!e)&&ra.test(t)||(e==="v6"||!e)&&na.test(t))}var X=class t extends A{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.string,received:n.parsedType}),E}let a=new N,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if(n.kind==="max")e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if(n.kind==="length"){let o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(r=this._getOrReturnCtx(e,r),o?f(r,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&f(r,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),a.dirty())}else if(n.kind==="email")sa.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"email",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="emoji")lt||(lt=new RegExp(aa,"u")),lt.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"emoji",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="uuid")ta.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"uuid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="cuid")Xs.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cuid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="cuid2")Qs.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cuid2",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="ulid")ea.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"ulid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),f(r,{validation:"url",code:p.invalid_string,message:n.message}),a.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"regex",code:p.invalid_string,message:n.message}),a.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),a.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:{startsWith:n.value},message:n.message}),a.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:{endsWith:n.value},message:n.message}),a.dirty()):n.kind==="datetime"?oa(n).test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:"datetime",message:n.message}),a.dirty()):n.kind==="ip"?ia(e.data,n.version)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"ip",code:p.invalid_string,message:n.message}),a.dirty()):b.assertNever(n);return{status:a.value,value:e.data}}_regex(e,s,a){return this.refinement(r=>e.test(r),{validation:s,code:p.invalid_string,...h.errToObj(a)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}datetime(e){var s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(s=e?.offset)!==null&&s!==void 0?s:!1,...h.errToObj(e?.message)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...h.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s?.position,...h.errToObj(s?.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...h.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...h.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...h.errToObj(s)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}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 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 minLength(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}};X.create=t=>{var e;return new X({checks:[],typeName:y.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...T(t)})};function ca(t,e){let s=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,r=s>a?s:a,n=parseInt(t.toFixed(r).replace(".","")),o=parseInt(e.toFixed(r).replace(".",""));return n%o/Math.pow(10,r)}var ae=class t extends A{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)!==m.number){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.number,received:n.parsedType}),E}let a,r=new N;for(let n of this._def.checks)n.kind==="int"?b.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:p.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?ca(e.data,n.value)!==0&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:p.not_finite,message:n.message}),r.dirty()):b.assertNever(n);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,h.toString(s))}gt(e,s){return this.setLimit("min",e,!1,h.toString(s))}lte(e,s){return this.setLimit("max",e,!0,h.toString(s))}lt(e,s){return this.setLimit("max",e,!1,h.toString(s))}setLimit(e,s,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:a,message:h.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,s=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(s===null||a.value>s)&&(s=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(s)&&Number.isFinite(e)}};ae.create=t=>new ae({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,...T(t)});var re=class t extends A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==m.bigint){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.bigint,received:n.parsedType}),E}let a,r=new N;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):b.assertNever(n);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,h.toString(s))}gt(e,s){return this.setLimit("min",e,!1,h.toString(s))}lte(e,s){return this.setLimit("max",e,!0,h.toString(s))}lt(e,s){return this.setLimit("max",e,!1,h.toString(s))}setLimit(e,s,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:a,message:h.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(s)})}get minValue(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}};re.create=t=>{var e;return new re({checks:[],typeName:y.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...T(t)})};var ne=class extends A{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.boolean,received:a.parsedType}),E}return j(e.data)}};ne.create=t=>new ne({typeName:y.ZodBoolean,coerce:t?.coerce||!1,...T(t)});var oe=class t extends A{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.date,received:n.parsedType}),E}if(isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_date}),E}let a=new N,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),a.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),a.dirty()):b.assertNever(n);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(s)})}get minDate(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}};oe.create=t=>new oe({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,...T(t)});var Ae=class extends A{_parse(e){if(this._getType(e)!==m.symbol){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.symbol,received:a.parsedType}),E}return j(e.data)}};Ae.create=t=>new Ae({typeName:y.ZodSymbol,...T(t)});var ie=class extends A{_parse(e){if(this._getType(e)!==m.undefined){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.undefined,received:a.parsedType}),E}return j(e.data)}};ie.create=t=>new ie({typeName:y.ZodUndefined,...T(t)});var ce=class extends A{_parse(e){if(this._getType(e)!==m.null){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.null,received:a.parsedType}),E}return j(e.data)}};ce.create=t=>new ce({typeName:y.ZodNull,...T(t)});var Q=class extends A{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}};Q.create=t=>new Q({typeName:y.ZodAny,...T(t)});var z=class extends A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}};z.create=t=>new z({typeName:y.ZodUnknown,...T(t)});var B=class extends A{_parse(e){let s=this._getOrReturnCtx(e);return f(s,{code:p.invalid_type,expected:m.never,received:s.parsedType}),E}};B.create=t=>new B({typeName:y.ZodNever,...T(t)});var Se=class extends A{_parse(e){if(this._getType(e)!==m.undefined){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.void,received:a.parsedType}),E}return j(e.data)}};Se.create=t=>new Se({typeName:y.ZodVoid,...T(t)});var Y=class t extends A{_parse(e){let{ctx:s,status:a}=this._processInputParams(e),r=this._def;if(s.parsedType!==m.array)return f(s,{code:p.invalid_type,expected:m.array,received:s.parsedType}),E;if(r.exactLength!==null){let o=s.data.length>r.exactLength.value,i=s.data.length<r.exactLength.value;(o||i)&&(f(s,{code:o?p.too_big:p.too_small,minimum:i?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),a.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(f(s,{code:p.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),a.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(f(s,{code:p.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),a.dirty()),s.common.async)return Promise.all([...s.data].map((o,i)=>r.type._parseAsync(new V(s,o,s.path,i)))).then(o=>N.mergeArray(a,o));let n=[...s.data].map((o,i)=>r.type._parseSync(new V(s,o,s.path,i)));return N.mergeArray(a,n)}get element(){return this._def.type}min(e,s){return new t({...this._def,minLength:{value:e,message:h.toString(s)}})}max(e,s){return new t({...this._def,maxLength:{value:e,message:h.toString(s)}})}length(e,s){return new t({...this._def,exactLength:{value:e,message:h.toString(s)}})}nonempty(e){return this.min(1,e)}};Y.create=(t,e)=>new Y({type:t,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...T(e)});function Te(t){if(t instanceof k){let e={};for(let s in t.shape){let a=t.shape[s];e[s]=G.create(Te(a))}return new k({...t._def,shape:()=>e})}else return t instanceof Y?new Y({...t._def,type:Te(t.element)}):t instanceof G?G.create(Te(t.unwrap())):t instanceof q?q.create(Te(t.unwrap())):t instanceof Z?Z.create(t.items.map(e=>Te(e))):t}var k=class t extends A{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(),s=b.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==m.object){let u=this._getOrReturnCtx(e);return f(u,{code:p.invalid_type,expected:m.object,received:u.parsedType}),E}let{status:a,ctx:r}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof B&&this._def.unknownKeys==="strip"))for(let u in r.data)o.includes(u)||i.push(u);let d=[];for(let u of o){let g=n[u],I=r.data[u];d.push({key:{status:"valid",value:u},value:g._parse(new V(r,I,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof B){let u=this._def.unknownKeys;if(u==="passthrough")for(let g of i)d.push({key:{status:"valid",value:g},value:{status:"valid",value:r.data[g]}});else if(u==="strict")i.length>0&&(f(r,{code:p.unrecognized_keys,keys:i}),a.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let g of i){let I=r.data[g];d.push({key:{status:"valid",value:g},value:u._parse(new V(r,I,r.path,g)),alwaysSet:g in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let g of d){let I=await g.key;u.push({key:I,value:await g.value,alwaysSet:g.alwaysSet})}return u}).then(u=>N.mergeObjectSync(a,u)):N.mergeObjectSync(a,d)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,a)=>{var r,n,o,i;let d=(o=(n=(r=this._def).errorMap)===null||n===void 0?void 0:n.call(r,s,a).message)!==null&&o!==void 0?o:a.defaultError;return s.code==="unrecognized_keys"?{message:(i=h.errToObj(e).message)!==null&&i!==void 0?i:d}:{message:d}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let s={};return b.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(s[a]=this.shape[a])}),new t({...this._def,shape:()=>s})}omit(e){let s={};return b.objectKeys(this.shape).forEach(a=>{e[a]||(s[a]=this.shape[a])}),new t({...this._def,shape:()=>s})}deepPartial(){return Te(this)}partial(e){let s={};return b.objectKeys(this.shape).forEach(a=>{let r=this.shape[a];e&&!e[a]?s[a]=r:s[a]=r.optional()}),new t({...this._def,shape:()=>s})}required(e){let s={};return b.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])s[a]=this.shape[a];else{let n=this.shape[a];for(;n instanceof G;)n=n._def.innerType;s[a]=n}}),new t({...this._def,shape:()=>s})}keyof(){return Bt(b.objectKeys(this.shape))}};k.create=(t,e)=>new k({shape:()=>t,unknownKeys:"strip",catchall:B.create(),typeName:y.ZodObject,...T(e)});k.strictCreate=(t,e)=>new k({shape:()=>t,unknownKeys:"strict",catchall:B.create(),typeName:y.ZodObject,...T(e)});k.lazycreate=(t,e)=>new k({shape:t,unknownKeys:"strip",catchall:B.create(),typeName:y.ZodObject,...T(e)});var le=class extends A{_parse(e){let{ctx:s}=this._processInputParams(e),a=this._def.options;function r(n){for(let i of n)if(i.result.status==="valid")return i.result;for(let i of n)if(i.result.status==="dirty")return s.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(i=>new $(i.ctx.common.issues));return f(s,{code:p.invalid_union,unionErrors:o}),E}if(s.common.async)return Promise.all(a.map(async n=>{let o={...s,common:{...s.common,issues:[]},parent:null};return{result:await n._parseAsync({data:s.data,path:s.path,parent:o}),ctx:o}})).then(r);{let n,o=[];for(let d of a){let u={...s,common:{...s.common,issues:[]},parent:null},g=d._parseSync({data:s.data,path:s.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!n&&(n={result:g,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(n)return s.common.issues.push(...n.ctx.common.issues),n.result;let i=o.map(d=>new $(d));return f(s,{code:p.invalid_union,unionErrors:i}),E}}get options(){return this._def.options}};le.create=(t,e)=>new le({options:t,typeName:y.ZodUnion,...T(e)});var $e=t=>t instanceof pe?$e(t.schema):t instanceof M?$e(t.innerType()):t instanceof ue?[t.value]:t instanceof me?t.options:t instanceof fe?Object.keys(t.enum):t instanceof he?$e(t._def.innerType):t instanceof ie?[void 0]:t instanceof ce?[null]:null,Fe=class t extends A{_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.object)return f(s,{code:p.invalid_type,expected:m.object,received:s.parsedType}),E;let a=this.discriminator,r=s.data[a],n=this.optionsMap.get(r);return n?s.common.async?n._parseAsync({data:s.data,path:s.path,parent:s}):n._parseSync({data:s.data,path:s.path,parent:s}):(f(s,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,a){let r=new Map;for(let n of s){let o=$e(n.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new t({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:r,...T(a)})}};function mt(t,e){let s=J(t),a=J(e);if(t===e)return{valid:!0,data:t};if(s===m.object&&a===m.object){let r=b.objectKeys(e),n=b.objectKeys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let d=mt(t[i],e[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(s===m.array&&a===m.array){if(t.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],d=mt(o,i);if(!d.valid)return{valid:!1};r.push(d.data)}return{valid:!0,data:r}}else return s===m.date&&a===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var de=class extends A{_parse(e){let{status:s,ctx:a}=this._processInputParams(e),r=(n,o)=>{if(pt(n)||pt(o))return E;let i=mt(n.value,o.value);return i.valid?((ut(n)||ut(o))&&s.dirty(),{status:s.value,value:i.data}):(f(a,{code:p.invalid_intersection_types}),E)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([n,o])=>r(n,o)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};de.create=(t,e,s)=>new de({left:t,right:e,typeName:y.ZodIntersection,...T(s)});var Z=class t extends A{_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.array)return f(a,{code:p.invalid_type,expected:m.array,received:a.parsedType}),E;if(a.data.length<this._def.items.length)return f(a,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&a.data.length>this._def.items.length&&(f(a,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());let n=[...a.data].map((o,i)=>{let d=this._def.items[i]||this._def.rest;return d?d._parse(new V(a,o,a.path,i)):null}).filter(o=>!!o);return a.common.async?Promise.all(n).then(o=>N.mergeArray(s,o)):N.mergeArray(s,n)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Z.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Z({items:t,typeName:y.ZodTuple,rest:null,...T(e)})};var We=class t extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.object)return f(a,{code:p.invalid_type,expected:m.object,received:a.parsedType}),E;let r=[],n=this._def.keyType,o=this._def.valueType;for(let i in a.data)r.push({key:n._parse(new V(a,i,a.path,i)),value:o._parse(new V(a,a.data[i],a.path,i))});return a.common.async?N.mergeObjectAsync(s,r):N.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(e,s,a){return s instanceof A?new t({keyType:e,valueType:s,typeName:y.ZodRecord,...T(a)}):new t({keyType:X.create(),valueType:e,typeName:y.ZodRecord,...T(s)})}},Ce=class extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.map)return f(a,{code:p.invalid_type,expected:m.map,received:a.parsedType}),E;let r=this._def.keyType,n=this._def.valueType,o=[...a.data.entries()].map(([i,d],u)=>({key:r._parse(new V(a,i,a.path,[u,"key"])),value:n._parse(new V(a,d,a.path,[u,"value"]))}));if(a.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of o){let u=await d.key,g=await d.value;if(u.status==="aborted"||g.status==="aborted")return E;(u.status==="dirty"||g.status==="dirty")&&s.dirty(),i.set(u.value,g.value)}return{status:s.value,value:i}})}else{let i=new Map;for(let d of o){let u=d.key,g=d.value;if(u.status==="aborted"||g.status==="aborted")return E;(u.status==="dirty"||g.status==="dirty")&&s.dirty(),i.set(u.value,g.value)}return{status:s.value,value:i}}}};Ce.create=(t,e,s)=>new Ce({valueType:e,keyType:t,typeName:y.ZodMap,...T(s)});var Ie=class t extends A{_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.set)return f(a,{code:p.invalid_type,expected:m.set,received:a.parsedType}),E;let r=this._def;r.minSize!==null&&a.data.size<r.minSize.value&&(f(a,{code:p.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&a.data.size>r.maxSize.value&&(f(a,{code:p.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());let n=this._def.valueType;function o(d){let u=new Set;for(let g of d){if(g.status==="aborted")return E;g.status==="dirty"&&s.dirty(),u.add(g.value)}return{status:s.value,value:u}}let i=[...a.data.values()].map((d,u)=>n._parse(new V(a,d,a.path,u)));return a.common.async?Promise.all(i).then(d=>o(d)):o(i)}min(e,s){return new t({...this._def,minSize:{value:e,message:h.toString(s)}})}max(e,s){return new t({...this._def,maxSize:{value:e,message:h.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}};Ie.create=(t,e)=>new Ie({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,...T(e)});var Ge=class t extends A{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.function)return f(s,{code:p.invalid_type,expected:m.function,received:s.parsedType}),E;function a(i,d){return Ue({data:i,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Me(),Ne].filter(u=>!!u),issueData:{code:p.invalid_arguments,argumentsError:d}})}function r(i,d){return Ue({data:i,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Me(),Ne].filter(u=>!!u),issueData:{code:p.invalid_return_type,returnTypeError:d}})}let n={errorMap:s.common.contextualErrorMap},o=s.data;if(this._def.returns instanceof ee){let i=this;return j(async function(...d){let u=new $([]),g=await i._def.args.parseAsync(d,n).catch(_e=>{throw u.addIssue(a(d,_e)),u}),I=await Reflect.apply(o,this,g);return await i._def.returns._def.type.parseAsync(I,n).catch(_e=>{throw u.addIssue(r(I,_e)),u})})}else{let i=this;return j(function(...d){let u=i._def.args.safeParse(d,n);if(!u.success)throw new $([a(d,u.error)]);let g=Reflect.apply(o,this,u.data),I=i._def.returns.safeParse(g,n);if(!I.success)throw new $([r(g,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Z.create(e).rest(z.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,a){return new t({args:e||Z.create([]).rest(z.create()),returns:s||z.create(),typeName:y.ZodFunction,...T(a)})}},pe=class extends A{get schema(){return this._def.getter()}_parse(e){let{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}};pe.create=(t,e)=>new pe({getter:t,typeName:y.ZodLazy,...T(e)});var ue=class extends A{_parse(e){if(e.data!==this._def.value){let s=this._getOrReturnCtx(e);return f(s,{received:s.data,code:p.invalid_literal,expected:this._def.value}),E}return{status:"valid",value:e.data}}get value(){return this._def.value}};ue.create=(t,e)=>new ue({value:t,typeName:y.ZodLiteral,...T(e)});function Bt(t,e){return new me({values:t,typeName:y.ZodEnum,...T(e)})}var me=class t extends A{_parse(e){if(typeof e.data!="string"){let s=this._getOrReturnCtx(e),a=this._def.values;return f(s,{expected:b.joinValues(a),received:s.parsedType,code:p.invalid_type}),E}if(this._def.values.indexOf(e.data)===-1){let s=this._getOrReturnCtx(e),a=this._def.values;return f(s,{received:s.data,code:p.invalid_enum_value,options:a}),E}return j(e.data)}get options(){return this._def.values}get enum(){let e={};for(let s of this._def.values)e[s]=s;return e}get Values(){let e={};for(let s of this._def.values)e[s]=s;return e}get Enum(){let e={};for(let s of this._def.values)e[s]=s;return e}extract(e){return t.create(e)}exclude(e){return t.create(this.options.filter(s=>!e.includes(s)))}};me.create=Bt;var fe=class extends A{_parse(e){let s=b.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==m.string&&a.parsedType!==m.number){let r=b.objectValues(s);return f(a,{expected:b.joinValues(r),received:a.parsedType,code:p.invalid_type}),E}if(s.indexOf(e.data)===-1){let r=b.objectValues(s);return f(a,{received:a.data,code:p.invalid_enum_value,options:r}),E}return j(e.data)}get enum(){return this._def.values}};fe.create=(t,e)=>new fe({values:t,typeName:y.ZodNativeEnum,...T(e)});var ee=class extends A{unwrap(){return this._def.type}_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.promise&&s.common.async===!1)return f(s,{code:p.invalid_type,expected:m.promise,received:s.parsedType}),E;let a=s.parsedType===m.promise?s.data:Promise.resolve(s.data);return j(a.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}};ee.create=(t,e)=>new ee({type:t,typeName:y.ZodPromise,...T(e)});var M=class extends A{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:s,ctx:a}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:o=>{f(a,o),o.fatal?s.abort():s.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let o=r.transform(a.data,n);return a.common.issues.length?{status:"dirty",value:a.data}:a.common.async?Promise.resolve(o).then(i=>this._def.schema._parseAsync({data:i,path:a.path,parent:a})):this._def.schema._parseSync({data:o,path:a.path,parent:a})}if(r.type==="refinement"){let o=i=>{let d=r.refinement(i,n);if(a.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(a.common.async===!1){let i=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?E:(i.status==="dirty"&&s.dirty(),o(i.value),{status:s.value,value:i.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(i=>i.status==="aborted"?E:(i.status==="dirty"&&s.dirty(),o(i.value).then(()=>({status:s.value,value:i.value}))))}if(r.type==="transform")if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Oe(o))return o;let i=r.transform(o.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:i}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>Oe(o)?Promise.resolve(r.transform(o.value,n)).then(i=>({status:s.value,value:i})):o);b.assertNever(r)}};M.create=(t,e,s)=>new M({schema:t,typeName:y.ZodEffects,effect:e,...T(s)});M.createWithPreprocess=(t,e,s)=>new M({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,...T(s)});var G=class extends A{_parse(e){return this._getType(e)===m.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};G.create=(t,e)=>new G({innerType:t,typeName:y.ZodOptional,...T(e)});var q=class extends A{_parse(e){return this._getType(e)===m.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};q.create=(t,e)=>new q({innerType:t,typeName:y.ZodNullable,...T(e)});var he=class extends A{_parse(e){let{ctx:s}=this._processInputParams(e),a=s.data;return s.parsedType===m.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:s.path,parent:s})}removeDefault(){return this._def.innerType}};he.create=(t,e)=>new he({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});var be=class extends A{_parse(e){let{ctx:s}=this._processInputParams(e),a={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Ve(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new $(a.common.issues)},input:a.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new $(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};be.create=(t,e)=>new be({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});var xe=class extends A{_parse(e){if(this._getType(e)!==m.nan){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.nan,received:a.parsedType}),E}return{status:"valid",value:e.data}}};xe.create=t=>new xe({typeName:y.ZodNaN,...T(t)});var la=Symbol("zod_brand"),Be=class extends A{_parse(e){let{ctx:s}=this._processInputParams(e),a=s.data;return this._def.type._parse({data:a,path:s.path,parent:s})}unwrap(){return this._def.type}},je=class t extends A{_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?E:n.status==="dirty"?(s.dirty(),Gt(n.value)):this._def.out._parseAsync({data:n.value,path:a.path,parent:a})})();{let r=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return r.status==="aborted"?E:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:a.path,parent:a})}}static create(e,s){return new t({in:e,out:s,typeName:y.ZodPipeline})}},Pe=class extends A{_parse(e){let s=this._def.innerType._parse(e);return Oe(s)&&(s.value=Object.freeze(s.value)),s}};Pe.create=(t,e)=>new Pe({innerType:t,typeName:y.ZodReadonly,...T(e)});var Zt=(t,e={},s)=>t?Q.create().superRefine((a,r)=>{var n,o;if(!t(a)){let i=typeof e=="function"?e(a):typeof e=="string"?{message:e}:e,d=(o=(n=i.fatal)!==null&&n!==void 0?n:s)!==null&&o!==void 0?o:!0,u=typeof i=="string"?{message:i}:i;r.addIssue({code:"custom",...u,fatal:d})}}):Q.create(),da={object:k.lazycreate},y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(y||(y={}));var pa=(t,e={message:`Input not instance of ${t.name}`})=>Zt(s=>s instanceof t,e),Ht=X.create,Kt=ae.create,ua=xe.create,ma=re.create,zt=ne.create,fa=oe.create,ha=Ae.create,ga=ie.create,ya=ce.create,_a=Q.create,va=z.create,Ea=B.create,Ta=Se.create,Aa=Y.create,Sa=k.create,Ca=k.strictCreate,Ia=le.create,ba=Fe.create,xa=de.create,Pa=Z.create,wa=We.create,Ra=Ce.create,Na=Ie.create,Oa=Ge.create,ja=pe.create,ka=ue.create,La=me.create,Da=fe.create,$a=ee.create,Ft=M.create,Ma=G.create,Ua=q.create,Va=M.createWithPreprocess,Fa=je.create,Wa=()=>Ht().optional(),Ga=()=>Kt().optional(),Ba=()=>zt().optional(),Za={string:t=>X.create({...t,coerce:!0}),number:t=>ae.create({...t,coerce:!0}),boolean:t=>ne.create({...t,coerce:!0}),bigint:t=>re.create({...t,coerce:!0}),date:t=>oe.create({...t,coerce:!0})},Ha=E,_=Object.freeze({__proto__:null,defaultErrorMap:Ne,setErrorMap:qs,getErrorMap:Me,makeIssue:Ue,EMPTY_PATH:Js,addIssueToContext:f,ParseStatus:N,INVALID:E,DIRTY:Gt,OK:j,isAborted:pt,isDirty:ut,isValid:Oe,isAsync:Ve,get util(){return b},get objectUtil(){return dt},ZodParsedType:m,getParsedType:J,ZodType:A,ZodString:X,ZodNumber:ae,ZodBigInt:re,ZodBoolean:ne,ZodDate:oe,ZodSymbol:Ae,ZodUndefined:ie,ZodNull:ce,ZodAny:Q,ZodUnknown:z,ZodNever:B,ZodVoid:Se,ZodArray:Y,ZodObject:k,ZodUnion:le,ZodDiscriminatedUnion:Fe,ZodIntersection:de,ZodTuple:Z,ZodRecord:We,ZodMap:Ce,ZodSet:Ie,ZodFunction:Ge,ZodLazy:pe,ZodLiteral:ue,ZodEnum:me,ZodNativeEnum:fe,ZodPromise:ee,ZodEffects:M,ZodTransformer:M,ZodOptional:G,ZodNullable:q,ZodDefault:he,ZodCatch:be,ZodNaN:xe,BRAND:la,ZodBranded:Be,ZodPipeline:je,ZodReadonly:Pe,custom:Zt,Schema:A,ZodSchema:A,late:da,get ZodFirstPartyTypeKind(){return y},coerce:Za,any:_a,array:Aa,bigint:ma,boolean:zt,date:fa,discriminatedUnion:ba,effect:Ft,enum:La,function:Oa,instanceof:pa,intersection:xa,lazy:ja,literal:ka,map:Ra,nan:ua,nativeEnum:Da,never:Ea,null:ya,nullable:Ua,number:Kt,object:Sa,oboolean:Ba,onumber:Ga,optional:Ma,ostring:Wa,pipeline:Fa,preprocess:Va,promise:$a,record:wa,set:Na,strictObject:Ca,string:Ht,symbol:ha,transformer:Ft,tuple:Pa,undefined:ga,union:Ia,unknown:va,void:Ta,NEVER:Ha,ZodIssueCode:p,quotelessJson:Ys,ZodError:$});l();l();var Yt=/^(?:https?:\/\/)?(?:(?:[a-z0-9])(?:[a-z0-9-]{0,61}[a-z0-9])?\.)+(?:[a-z]{2,24}|[a-z0-9-]{2,24}\.?)/i;l();var ft={BUYER:"buyer",SELLER:"seller",BUYER_SUBTRACT:"buyer-subtract"};l();l();var ht={ERC_721:"erc-721",ERC_1155:"erc-1155",PRIVATE_ERC_721:"private-erc-721",THIRDWEB_DROP:"thirdweb-drop",THIRDWEB_EDITION_DROP:"thirdweb-edition-drop",EVM_MAGIC_EDEN_SECONDARY:"eth-magic-eden-secondary",RESERVOIR_SECONDARY:"reservoir-secondary-eth",WEN_MINT_ERC_721A:"wen-mint-erc721a",MANIFOLD_ERC_721:"manifold-erc-721",MANIFOLD_ERC_1155:"manifold-erc-1155",ZORA_DROP_ERC_721:"zora-drop-erc-721",ZORA_EDITION_ERC_721:"zora-edition-erc-721",ZORA_ERC_1155:"zora-erc-1155",MANAGED_ERC_721:"managed-erc-721",MANAGED_ERC_1155:"managed-erc-1155",OKX:"okx",RARIBLE:"rarible",SOUND:"sound-evm",HIGHLIGHT:"highlight",EVM_SECONDARY_AGGREGATE:"evm-secondary-aggregate",MANAGED_STORY_NFT_COLLECTION:"story-spg-collection",TEMP_WORLDSTORE_EVM:"temp-worldstore-evm",WORLDSTORE_EVM:"worldstore-protocol-evm",EVM_EXCHANGE_AGGREGATE:"evm-exchange-aggregate"},cn=Object.values(ht);l();var gt={CANDY_MACHINE:"candy-machine",SNOWCRASH:"solana-custom-snowcrash",YAWW:"solana-custom-yawww",HADESWAP:"solana-custom-hadeswap",SOLANART:"solana-custom-solanart",GLASS_PRIMARY:"solana-custom-glass-primary",EXCHANGE_ART_SECONDARY:"solana-custom-exchangeart-secondary",EXCHANGE_ART_EDITION_MINT:"solana-custom-exchangeart-edition-mint",AUCTION_HOUSE:"solana-auction-house",SOLANA_MAGIC_EDEN_LAUNCHPAD:"solana-magic-eden-launchpad",SOLANA_MAGIC_EDEN_SECONDARY:"solana-magic-eden-secondary",SOLANA_SECONDARY_AGGREGATE:"solana-secondary-aggregate",HYPERSPACE:"solana-hyperspace-marketplace",FORM_FUNCTION:"solana-form-function",FORM_FUNCTION_EDITION:"solana-form-function-edition",METAPLEX_CERTIFIED_COLLECTION:"metaplex-certified-collection",CATHOEN_SECONDARY:"solana-catheon-secondary",TENSOR_SECONDARY:"solana-tensor-secondary",MANAGED_METAPLEX:"managed-metaplex",MANAGED_SFT_METAPLEX:"managed-sft-metaplex",SOLANA_EXCHANGE_AGGREGATE:"solana-exchange-aggregate"},pn=Object.values(gt);l();l();function F(t){return Object.values(t)}W(F,"objectValues");function qt(t){return Object.keys(t)}W(qt,"objectKeys");function Jt(t){return Object.entries(t)}W(Jt,"objectEntries");var yt={CLUTCHY_SECONDARY:"sui-clutchy-secondary",MANAGED_SUI_DIGITAL_ASSET:"managed-sui-digital-asset"},_n=F(yt);l();var _t={MANAGED_XION_CW_721:"managed-xion-cw-721",XION_CW_721:"xion-cw-721"},An=F(_t);l();var vt={MANAGED_APTOS_DIGITAL_ASSET:"managed-aptos-digital-asset"},bn=F(vt);l();function Et(t,e){return t.includes(e)}W(Et,"arrayIncludes");var C={...gt,...ht,...yt,...vt,..._t},Ka=F(C);function za(t){return Et(Ka,t)}W(za,"isClientContractType");var Xt=(t=>(t.CONSOLE="console",t.PROJECT="project",t))(Xt||{});var Ya=/^(?:https?:\/\/(?:www\.)?(?:twitter\.com|x\.com)\/)?(?:@)?([A-Za-z0-9_]{4,15})$/,qa=_.object({twitter:_.string().regex(Ya,"Please enter a valid Twitter/X handle").or(_.string().length(0)).optional(),discord:_.string().optional(),website:_.union([_.literal(""),_.string().regex(Yt,"Invalid URL")]).optional()}),Ja=_.object({useCompression:_.boolean().optional(),feesPayer:_.nativeEnum(ft).optional().default(ft.BUYER),allowDirectTemplateMinting:_.boolean().optional()}),Qt=500,Xa=_.object({title:_.string().min(1).max(100).regex(/.*\S.*/,"Name cannot be empty"),description:_.string().max(Qt).min(1,"Description cannot be empty"),imageUrl:_.union([_.literal(""),_.string().url("Image url should be a valid url, starting with https://")]).optional(),symbol:_.string().optional()}),Qa={[C.CANDY_MACHINE]:[{name:ke(C.CANDY_MACHINE),label:"Candy Machine Id"}],[C.AUCTION_HOUSE]:[{name:ke(C.AUCTION_HOUSE),label:"Action House Address"}],[C.SOLANA_MAGIC_EDEN_LAUNCHPAD]:[{name:ke(C.SOLANA_MAGIC_EDEN_LAUNCHPAD),label:"Candy Machine Id"}]};function ke(t){switch(t){case C.CANDY_MACHINE:case C.SOLANA_MAGIC_EDEN_LAUNCHPAD:return"candyMachineId";case C.AUCTION_HOUSE:return"auctionHouseAddress";case C.ERC_721:case C.ERC_1155:case C.THIRDWEB_DROP:case C.THIRDWEB_EDITION_DROP:case C.WEN_MINT_ERC_721A:case C.MANAGED_ERC_721:case C.MANAGED_ERC_1155:case C.ZORA_DROP_ERC_721:case C.ZORA_EDITION_ERC_721:case C.ZORA_ERC_1155:case C.HIGHLIGHT:case C.PRIVATE_ERC_721:case C.MANAGED_XION_CW_721:case C.XION_CW_721:return"contractAddress";case C.MANIFOLD_ERC_721:case C.MANIFOLD_ERC_1155:return"tokenContractAddress";case C.MANAGED_METAPLEX:return"mintAddress";case C.MANAGED_APTOS_DIGITAL_ASSET:return"objectId";case C.MANAGED_SUI_DIGITAL_ASSET:return"packageId";case C.HADESWAP:case C.SOLANART:case C.GLASS_PRIMARY:case C.EXCHANGE_ART_SECONDARY:case C.SOLANA_MAGIC_EDEN_SECONDARY:case C.HYPERSPACE:case C.EVM_MAGIC_EDEN_SECONDARY:case C.RESERVOIR_SECONDARY:case C.METAPLEX_CERTIFIED_COLLECTION:return null;default:throw new Error(`Contract address type ${t} not recorded in getContractAddressFieldFromContractType`)}}W(ke,"getContractAddressFieldFromContractType");function es(t){var e;return((e=t.mintingContract)==null?void 0:e.chain)||t.chain}W(es,"getChainFromClientIntegration");var Tt={SUBSCRIPTIONS:"subscriptions",COLLECTIONS:"collections"};l();var er=_.object({whitelabelWalletAPI:_.boolean(),whitelabelCheckoutAPI:_.boolean(),billingAPI:_.boolean(),ethereumMintAPI:_.boolean(),baseMintAPI:_.boolean().optional(),isEscrowless:_.boolean(),subprojectCreation:_.object({enabled:_.boolean(),KYCOwnership:_.enum(["crossmint","developer"])}).optional(),mintAPIBYOC:_.boolean().optional(),mintAPITransferable:_.boolean().optional(),mintAPIUserIdBasedMintRecipient:_.boolean().optional(),embeddedCheckout:_.boolean().optional(),batchMintAPI:_.boolean().optional(),spamPlan:_.enum(["simple","advanced"]).optional(),paymentsMintToProjectScopedWallets:_.boolean().optional(),nonCustodialWallets:_.boolean().optional(),mintingAndWalletsSubscriptionsSelfServe:_.boolean().optional(),registerExternalCollections:_.boolean().optional(),mintAPIMaxReuploadFileSizeMB:_.number().optional(),solanaNonCompressedMint:_.boolean().optional(),solanaSFTMint:_.boolean().optional(),subscriptions:_.boolean().optional(),memeTokensCheckout:_.boolean().optional(),onrampCheckout:_.boolean().optional(),worldstore:_.object({sellerId:_.string().optional()}).optional(),payWithCryptoNativePassthrough:_.boolean().optional()}),ge=(t=>(t.WHITELABEL_WALLET_API="whitelabelWalletAPI",t.WHITELABEL_CHECKOUT_API="whitelabelCheckoutAPI",t.BILLING_API="billingAPI",t.SUBSCRIPTIONS="subscriptions",t))(ge||{});var w={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",HEAD:"HEAD",OPTIONS:"OPTIONS",CONNECT:"CONNECT",TRACE:"TRACE"},tr=F(w);l();l();var sr=Object.defineProperty,c=(t,e)=>sr(t,"name",{value:e,configurable:!0});l();l();var ar=Object.defineProperty,S=(t,e)=>ar(t,"name",{value:e,configurable:!0});function H(t){return t.charAt(0).toUpperCase()+t.slice(1)}S(H,"capitalizeFirstLetter");function K(t){return!t||t.length===0||t.trim().length===0}S(K,"isEmpty");function ss(t,e){return t.length<=e?t:t.slice(0,e)+"\u2026"}S(ss,"cutAndAddEllipsis");function as(t,e=4,s=4){return t.length<=e+s?t:t.slice(0,e)+"\u2026"+t.slice(s*-1)}S(as,"cutMiddleAndAddEllipsis");function rs(){return(Math.random()+1).toString(36).substring(7)}S(rs,"randomString");function ns(t){let e=t.length,s=0,a=0;if(e>0)for(;a<e;)s=(s<<5)-s+t.charCodeAt(a++)|0;return s}S(ns,"hashCode");var ts=1e3;function os(t){return t.length<=ts?t:t.slice(0,ts)+"<truncated>"}S(os,"truncateForLog");function is(t){return!t||typeof t!="string"?!1:t.toLowerCase()==="true"}S(is,"parseBoolean");function cs(t){return/^-?\d+$/.test(t)}S(cs,"containsInteger");function ls(t){if(t.length===0)return"";if(t.length===1)return t[0];let e=t.slice(0,t.length-1),s=t[t.length-1];return e.join(", ")+" and "+s}S(ls,"makeFormattedEnglishList");function ds(t){return K(t)?"":t.split(" ").map(e=>e?H(e):"").join(" ")}S(ds,"capitalizeFirstLetterOfEachWord");function ps(t){return t.replace(/\s/g,"")}S(ps,"removeAllWhitespaces");function us(t){if(K(t))return 0;let e=S((s,a)=>{let r=(a.charCodeAt(0)-48)/74;return(s+r)%1},"base58Reduction");return t.split("").reduce(e,0)}S(us,"normalizeBase58String");function ms(t,e=100){if(!K(t))return t.substring(0,e)}S(ms,"trimIfDefined");function fs(t){return t.replace(/(\r\n|\n|\r)/g," ").replace(/[\x00-\x1F\x7F-\uFFFF]/g,"")}S(fs,"sanitizeStringToValidHTTPHeaderValue");function hs(t){try{JSON.parse(t)}catch{return!1}return!0}S(hs,"isStringifiedJson");function gs(t,e){if(!K(t))try{return JSON.parse(t)}catch(s){console.error(`safeJSONParse failed: ${e??""}`,s);return}}S(gs,"safeJSONParse");function ys(t,e){return t?.toLowerCase()===e?.toLowerCase()}S(ys,"equalsIgnoreCase");function _s(t){return t.map(e=>`'${e}'`).join(" | ")}S(_s,"arrayToUnionString");function vs(t){return t.startsWith("0x")?t:`0x${t}`}S(vs,"addHexIndicator");function Es(t){return Number.parseFloat(t).toString()}S(Es,"removeTrailingZeros");function Ts(){let t="9876543210",e="";for(let s=0;s<4;s++)e+=t[Math.floor(Math.random()*10)];return e}S(Ts,"generateOTP");function As(t){return t&&t.includes("@")?t.split("@")[0]:t??""}S(As,"getNameFromEmail");function Ss(t){return t!=null?`@${t.split("@").pop()}`:""}S(Ss,"getDomainFromEmail");function Cs(t){return H(t.toLowerCase().replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_","")))}S(Cs,"snakeToUpperCamel");function Is(t){return t[0].toLowerCase()+t.slice(1,t.length).replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}S(Is,"upperCamelToSnake");function bs(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}S(bs,"slugify");var rr=S(t=>t.startsWith("0x")?t.slice(2):t,"trimHexIndicator");function At(t){return new TextEncoder().encode(t).length}S(At,"utf8Size");function xs(t){return At(JSON.stringify(t))}S(xs,"serializedSize");function Ps(t){let e=unescape(encodeURIComponent(t)),s=new Uint8Array(e.length);for(let a=0;a<e.length;a++)s[a]=e.charCodeAt(a);return s}S(Ps,"stringToUtf8ByteArray");function ws(t){return t.split("_").map(e=>H(e)).join(" ")}S(ws,"capitalizeAndRemoveUnderscores");function Rs(t){return t.split("-").map(e=>H(e)).join(" ")}S(Rs,"capitalizeAndRemoveDashes");function Ns(t){if(typeof t!="string")return t;let e=t;for(;;)try{let s=JSON.parse(e);if(typeof s=="string")e=s;else return s}catch{return e}}S(Ns,"multiParse");function Os(t,e=1){let s=["gmail.com","hotmail.com","outlook.com","live.com"],[a,r]=t.split("@"),[n,o]=r.split("."),i,d;return a.length<=3?i="*".repeat(a.length):i=a.length<=e?a:a[0]+"*".repeat(a.length-e-1)+a.slice(-e),s.includes(`${n}.${o}`)?d=`${n}.${o}`:d=`${n.length>1?n[0]+"*".repeat(n.length-2)+n.slice(-1):n}.${o}`,`${i}@${d}`}S(Os,"obfuscateEmail");function js(t){return t.includes("*")}S(js,"isObfuscated");function ks(t){return t===null?!1:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t||"")}S(ks,"isEmail");function Ls(...t){for(let e of t)if(!K(e))return e;throw new Error("All values are empty")}S(Ls,"getFirstNonEmpty");function Ds(t){return t.endsWith(".")?t.slice(0,-1):t}S(Ds,"removeTrailingDecimal");var $s={admin:{index:"/console/admin",quickstarts:{index:"/console/admin/quickstarts",new:"/console/admin/quickstarts/new",edit:c(t=>`/console/admin/quickstarts/${t}`,"edit")}},billing:{index:"/console/billing",subscribe:c((t,e)=>{let s=new URLSearchParams({projectId:t});return e!=null&&s.append("product",e),`/alpha/console/billing/subscribe?${s.toString()}`},"subscribe"),planDetails:"/console/billing/plan-details"},overview:{index:"/console/overview"},subscriptions:{index:"/console/subscriptions"},orders:{index:"/console/orders"},createAccount:"/console/create-account",onboarding:"/console/onboarding",collections:{index:"/console/collections",create:"/console/create-collection",dashboard:c(t=>`/console/collections/${t}/dashboard`,"dashboard"),details:c(t=>`/console/collections/${t}/details`,"details"),branding:c(t=>`/console/collections/${t}/branding`,"branding"),contract:c(t=>`/console/collections/${t}/contract`,"contract"),payments:c(t=>`/console/collections/${t}/payments`,"payments"),orders:c(t=>`/console/collections/${t}/orders`,"orders"),orderDetails:c((t,e)=>`/console/collections/${t}/orders/${e}`,"orderDetails"),payouts:{index:c((t,e)=>`/console/collections/${t}/payouts${e!=null?`?topology=${e}`:""}`,"index"),details:c((t,e,s="collections")=>`/console/collections/${t}/payouts/${e}?topology=${s}`,"details"),scheduled:c((t,e,s="collections")=>`/console/collections/${t}/payouts/scheduled/${e}?topology=${s}`,"scheduled")},claimsStorefront:c(t=>`/console/collections/${t}/claims-storefront`,"claimsStorefront"),registeredNfts:c(t=>`/console/collections/${t}/registered/nfts`,"registeredNfts"),createdNfts:c(t=>`/console/collections/${t}/created/nfts`,"createdNfts")},wallets:{index:"/console/wallets",address:c((t,e)=>`/console/wallets/${t}?${e}`,"address")},prepay:{create:c(t=>`/console/collections/create-prepay/${t}`,"create"),details:c(t=>`/console/collections/prepay/${t}/details`,"details"),update:c(t=>`/console/collections/prepay/${t}/update`,"update")},projects:{index:"/console/projects",addMember:"/console/projects/addMember",apiKeys:{index:"/console/projects/apiKeys",edit:c((t,e)=>`/console/projects/${t}/APIKeys/Create?apiKeyId=${e}`,"edit")},projectId:c(t=>`/console/projects/${t}`,"projectId"),withId:c(t=>`/console/projects/${t}`,"withId"),branding:c(t=>`/console/projects/${t}/branding`,"branding"),settings:c(t=>`/console/projects/${t}/settings`,"settings"),walletsSettings:c(t=>`/console/projects/${t}/settings/wallets`,"walletsSettings")},webhooks:{index:"/console/webhooks"},domains:{index:"/console/domains"},account:{index:"/console/account"},mintingApi:{index:"/console/minting-api"},authorizeDevice:{index:c(t=>`/console/authorize-device?${new URLSearchParams(t).toString()}`,"index"),success:"/console/authorize-device/success"}};function Ze(t,e){return e?`${t}?clientId=${e}`:t}c(Ze,"appendClientId");var nr={console:{collections:{new:{chooseAction:c(t=>Ze("/alpha/console/collections/new/choose-action",t),"chooseAction"),details:c((t,e=Tt.COLLECTIONS)=>`/alpha/console/collections/new/details?${new URLSearchParams({topology:e,...K(t)?{}:{clientId:t}}).toString()}`,"details"),registerCollection:c(t=>Ze("/alpha/console/collections/new/register-collection",t),"registerCollection"),smartContract:c(t=>Ze("/alpha/console/collections/new/smart-contract",t),"smartContract"),subscription:"/alpha/console/collections/new/subscription"}}}},or={admin:{godmode:{info:c(t=>`/api/admin/godmode/info?userId=${t}`,"info"),relatedEntities:c(t=>`/api/admin/godmode/related-entities?identifier=${t}`,"relatedEntities"),impersonate:c((t,e)=>`/api/admin/godmode/impersonate?entityId=${t}&type=${e}`,"impersonate"),gatherInfo:c((t,e)=>`/api/admin/godmode/gather-info/${t}/${e}`,"gatherInfo"),enterpriseData:c(t=>`/api/admin/godmode/enterprise-data?identifier=${t}`,"enterpriseData")}},auth:{callback:{email:"/api/auth/callback/email"}},internal:{transfer:{confirmation:"/api/internal/transfer/confirmation"},transaction:{confirmation:"/api/internal/transaction/confirmation"}},"v1-alpha1":{wallets:{transaction:{getViewInfo:c(t=>`/api/v1-alpha1/wallets/transaction/getViewInfo/${t}`,"getViewInfo")},nfts:c(t=>`api/v1-alpha1/wallets/${t}/nfts`,"nfts"),getViewInfo:c(t=>`api/v1-alpha1/wallets/transfers/getViewInfo/${t}`,"getViewInfo")},collections:{index:"/api/v1-alpha1/collections",mints:c((t,e,s)=>`/api/v1-alpha1/collections/${t}/mints?projectId=${e}${s?`&cursor=${s}`:""}`,"mints")},minting:{collections:{nfts:c((t,e)=>`/api/v1-alpha1/minting/collections/${t}/nfts?projectId=${e}`,"nfts")}},project:{branding:c(t=>`/api/v1-alpha1/projects/${t}/branding`,"branding"),usage:c((t,e,s)=>`/api/v1-alpha1/projects/${t}/usage?dimension=${e}&startDate=${s}`,"usage"),walletsCreated:c(t=>`/api/v1-alpha1/projects/${t}/wallets-created`,"walletsCreated")}},blockchain:{price:c(t=>`/api/blockchain/${t}/price`,"price")},console:{billing:{details:c(t=>`/api/billing/${t}`,"details"),addPaymentMethodUrl:c(t=>`/api/billing/addPaymentInfoUrl/${t}`,"addPaymentMethodUrl"),getCurrentBalance:c(t=>`/api/billing/${t}/balance`,"getCurrentBalance"),paymentMethods:c(t=>`/api/billing/${t}/paymentMethods`,"paymentMethods")},collections:{index:c(t=>`/api/collections?projectId=${t}`,"index"),indexPaginated:c((t,e,s,a,r=!1)=>`/api/v1-alpha1/collections?${new URLSearchParams({projectId:t,topology:e,page:s.toString(),perPage:a.toString(),hideDrafts:r?"true":"false"})}`,"indexPaginated"),byClientId:c((t,e)=>`/api/console/collections/${t}?projectId=${e}`,"byClientId"),requestVerification:c((t,e)=>`/api/console/collections/${t}/request-verification?projectId=${e}`,"requestVerification"),mintableTemplates:c((t,e,s,a=20)=>`/api/console/collections/${t}/templates/mintable?projectId=${e}&page=${s}&perPage=${a}`,"mintableTemplates"),templateSupply:c((t,e)=>`/api/console/collections/${t}/templates/supply?projectId=${e}`,"templateSupply"),payments:{parameters:c((t,e)=>`/api/console/collections/${t}/payments/parameters?projectId=${e}`,"parameters")},orders:{stats:c((t,e)=>`/api/collections/${t}/orders/stats?projectId=${e}`,"stats"),index:c((t,e,s)=>{let a=new URLSearchParams({projectId:e,...s});return`/api/collections/${t}/orders?${a}`},"index"),order:c((t,e,s)=>`/api/collections/${t}/orders/${s}?projectId=${e}`,"order")},claimsStorefront:c((t,e)=>`/api/console/collections/${t}/claims-storefront?projectId=${e}`,"claimsStorefront"),register:{evm:{contract:{getInfo:c((t,e)=>`/api/console/collections/register/evm/contract/${t}/get-info?chain=${e}`,"getInfo")},getThirdwebParams:c((t,e)=>`/api/console/collections/register/evm/contract/get-thirdweb-params?projectId=${t}&clientId=${e}`,"getThirdwebParams")}},batchUpload:c((t,e,s)=>`/api/console/collections/${t}/batchUpload?projectId=${e}&batchIdentifier=${s}`,"batchUpload"),batchUploadStatus:c((t,e,s,a)=>`/api/console/collections/${t}/batchUpload?projectId=${e}&batchIdentifier=${s}&workflowId=${a}`,"batchUploadStatus")},getProject:c(t=>`/api/console/projects?projectId=${t}`,"getProject"),projects:{index:`/api/${$s.projects.index}`,exportCsv:c((t,e)=>`/api/export-csv?projectId=${t}&clientId=${e}`,"exportCsv"),apiKeys:c((t,e)=>`/api/console/projects/${t}/apiKeys${K(e)?"":`?keyId=${e}`}`,"apiKeys"),webhook:c(t=>`/api/console/projects/${t}/webhook`,"webhook"),members:"/api/console/projects/members",billing:{paymentMethods:c(t=>`/api/console/projects/${t}/billing/paymentMethods`,"paymentMethods"),balance:c(t=>`/api/console/projects/${t}/billing/balance`,"balance"),subscription:c(t=>`/api/console/projects/${t}/billing/subscription`,"subscription"),subscriptionCosts:c((t,e)=>`/api/console/projects/${t}/billing/subscriptionCosts?subscriptionId=${e}`,"subscriptionCosts"),pricing:c(t=>`/api/console/projects/${t}/billing/pricing`,"pricing"),apiActionEnabled:c((t,e,s)=>`/api/console/projects/${t}/billing/apiActionEnabled?apiAction=${e}&chain=${s}`,"apiActionEnabled"),subscriptionPaymentStatus:c((t,e)=>`/api/console/projects/${t}/billing/subscriptionPaymentStatus?subscriptionIds=${e.join(",")}`,"subscriptionPaymentStatus"),usage:c(t=>`/api/console/projects/${t}/billing/usage`,"usage"),autoRecharge:c(t=>`/api/console/projects/${t}/billing/autoRecharge`,"autoRecharge"),redeemCoupon:c(t=>`/api/console/projects/${t}/billing/redeemCoupon`,"redeemCoupon"),payments:c(t=>`/api/console/projects/${t}/billing/payments`,"payments"),topupStatus:c((t,e)=>`/api/console/projects/${t}/billing/topupStatus?requestId=${e}`,"topupStatus"),billingInformation:c(t=>`/api/console/projects/${t}/billing/billingInformation`,"billingInformation")},privacyPolicy:c(t=>`/api/console/project/${t}/privacy-policy`,"privacyPolicy")},webhook:{index:c(t=>`/api/console/webhook?projectId=${t}`,"index"),attempts:c(t=>`/api/console/webhook/attempts?projectId=${t}`,"attempts"),svix:{appPortal:"/api/console/webhook/svix/app-portal"}},domains:{createUpdateDelete:c((t,e)=>`/api/v1-alpha1/projects/${t}/domains/${e}`,"createUpdateDelete")},accesslist:{discordInfo:c((t,e)=>`/api/console/collections/${t}/accesslists/discord?projectId=${e}`,"discordInfo"),validateTwitter:c((t,e,s)=>`/api/console/collections/${t}/accesslists/twitter?username=${s}&projectId=${e}`,"validateTwitter"),accesslists:c((t,e)=>`/api/console/collections/${t}/accesslists?projectId=${e}`,"accesslists")},developerAccount:{get:c(t=>`/api/console/developer-account?projectId=${t}`,"get")},mintingApi:{hasMinted:c(t=>`/api/console/minting-api/hasMinted?projectId=${t}`,"hasMinted")},payments:{hostedSalesPage:{index:c((t,e)=>`/api/console/collections/${t}/payments/hostedSalesPage?projectId=${e}`,"index")},enable:c((t,e)=>`/api/console/collections/${t}/payments/enable?projectId=${e}`,"enable")},branding:c((t,e)=>`/api/console/collections/${t}/branding?projectId=${e}`,"branding"),registerContract:c((t,e)=>`/api/console/collections/${t}/register-contract?projectId=${e}`,"registerContract"),dashboard:{revenue:c((t,e,s,a,r)=>`/api/console/collections/${t}/dashboard/revenue/?projectId=${e}&after=${s}&before=${a}&periodInMS=${r}`,"revenue"),sales:c((t,e,s,a)=>`/api/console/collections/${t}/dashboard/sales/?projectId=${e}&after=${s}&before=${a}`,"sales")},contactSales:{upgradePlanSubmission:c(t=>`/api/console/contact-sales/upgrade-plan-submission?projectId=${t}`,"upgradePlanSubmission")}},developerAccount:"/api/developeraccount",contactSales:{upgradePlanSubmission:c(t=>`/api/console/contact-sales/upgrade-plan-submission?projectId=${t}`,"upgradePlanSubmission")},crossmint:{user:{discord:{index:"/api/crossmint/user/discord"}}},projects:"/api/projects",verification:{otp:c((t,e,s)=>`/api/verifyOTP?${new URLSearchParams({exportId:t,otp:e,uuid:s}).toString()}`,"otp"),getStatusByEntityId:c(t=>`/api/verification/${t}/status`,"getStatusByEntityId"),getCollectionStatus:c((t,e)=>`/api/verification/${t}/collectionStatus?projectId=${e}`,"getCollectionStatus")},prepays:{details:c(t=>`/api/prepays/${t}`,"details")},hostedSalesPage:{mintStatus:c(({clientId:t,isConsole:e,quantity:s,projectId:a,currency:r,price:n})=>`/api/collections/drop/mintStatus?clientId=${t}&quantity=${s}&currency=${r}&price=${n}&isConsole=${e}${a?`&projectId=${a}`:""}`,"mintStatus"),index:c(t=>`/api/collections/drop?slug=${t}`,"index"),context:c(t=>`/api/collections/drop/context?slug=${t}`,"context")},claim:{index:"/api/collections/claim",context:c(t=>`/api/collections/claim/context?slug=${t}`,"context"),pageStatus:c(({clientId:t,projectId:e})=>`/api/collections/claim/pageStatus?clientId=${t}&projectId=${e}`,"pageStatus"),supply:c(({clientId:t,projectId:e})=>`/api/collections/claim/supply?clientId=${t}&projectId=${e}`,"supply"),status:c(({clientId:t,projectId:e,requestId:s})=>`/api/collections/claim/status?clientId=${t}&projectId=${e}&requestId=${s}`,"status")},walletConnect:{signMessage:"/api/walletConnect"},transactions:{nft:c(t=>`/api/transactions/${t}/nft`,"nft")},"2023-06-09":{crossmint:{connect:c((t,{forceWalletSelection:e,projectId:s,showAAWallets:a})=>{let r=e?"&forceWalletSelection=true":"",n=s?`&projectId=${s}`:"";return`/api/2023-06-09/crossmint/connect?chain=${t}${r}${n}${a?"&showAAWallets=true":""}`},"connect")}},"2022-06-09":{minting:{collections:{index:c(t=>`/api/2022-06-09/minting/collections?projectId=${t}`,"index"),collectionId:c((t,e)=>`/api/2022-06-09/minting/collections/${t}${e?`?projectId=${e}`:""}`,"collectionId"),templates:c((t,e)=>`/api/2022-06-09/minting/collections/${t}/templates?projectId=${e}`,"templates"),nfts:c((t,e)=>`/api/2022-06-09/minting/collections/${t}/nfts?projectId=${e}`,"nfts"),template:c((t,e,s)=>`/api/2022-06-09/minting/collections/${t}/templates/${e}?projectId=${s}`,"template")}},wallets:{index:c(t=>`/api/2022-06-09/wallets?projectId=${t}`,"index")}},wallets:{get(t,e,s,a){return`/api/unstable/wallets?${new URLSearchParams({projectId:t,page:e.toString(),perPage:s.toString(),...a})}`},index:c(t=>`/api/v1-alpha1/wallets?projectId=${t}`,"index")},services:{aws:{s3:{presignedPutObject:c((t,e,s,a)=>`/api/services/aws/s3/presignedPutObject?${new URLSearchParams({clientId:t,projectId:s,batchIdentifier:e,bucketName:a}).toString()}`,"presignedPutObject")}}}},ir={referralProgramAgreement:"/legal/referral-program-agreement",contentPolicy:"/content-policy",termsOfService:"/legal/terms-of-service",msa:"/master-services-agreement",privacyPolicy:"/legal/privacy-policy"},cr={claim:c(t=>`/collections/${t}/claim`,"claim")},lr={getSession:"/api/session",signOut:"/api/session/signout",oauthSessionAuthenticate:"/api/session/authenticate",authenticate:"/api/session/authenticate",oauthSessionAuthenticateAuthSDK:"/api/2024-09-26/session/sdk/auth/authenticate",stytchGetOrCreateUser:"/api/sdk/auth/user/get-or-create",exchangeAccessToken:"/api/session/exchange-access-token"},dr={support:"https://help.crossmint.com/hc/en-us/requests/new",collectionVerificationFAQ:"https://help.crossmint.com/hc/en-us/articles/17367432791053-Crossmint-Collection-Review",sales:"/contact/sales",index:"/contact"},pr={contract:c(t=>`/claim/contract/${t}`,"contract")},ur={index:"https://docs.crossmint.com",changelog:{index:"https://docs.crossmint.com/changelog",article:c(t=>`https://docs.crossmint.com/changelog/${t}`,"article")}},mr={index:"/cli-signin",success:"/cli-signin/success"},x={cliSignin:mr,console:$s,api:or,alpha:nr,legal:ir,collection:cr,authentication:lr,notFound:"/404",contact:dr,claim:pr,docs:ur,pricing:"/pricing"};async function R(t,e=w.GET,s){let a=await $t(),r=await D();a||(console.error("\u274C Session not found, please run crossmint login"),process.exit(1)),r||(console.error("\u274C Environment not found, please run crossmint login"),process.exit(1));let n=`${se(r)}${t}`;return He(n,e,s,{Cookie:`sessionToken=${a}`})}async function Ms(t,e=w.GET,s){let a=await D();a||(console.error("\u274C Environment not found"),process.exit(1));let r=`${se(a)}${t}`;return He(r,e,s)}async function He(t,e=w.GET,s,a){let r={method:e,headers:{"Content-Type":"application/json",...a}};s&&(r.body=JSON.stringify(s));let n=await fetch(t,r);if(n.status>=400){let o=await n.json();throw new Error(`${o.message}`)}return await n.json()}import{select as hr}from"@inquirer/prompts";l();import{createSpinner as fr}from"nanospinner";function L(t){let e=fr(t),s={start:a=>(e.start({text:a}),s),succeed:a=>(e.success({text:a}),s),fail:a=>(e.error({text:a}),s)};return s}async function we(){let t=L("Fetching projects...").start();try{let e=await R(x.api.projects);if(!e||e.length===0)return t.fail("No projects found. Create a new project using `crossmint project create`"),process.exit(0);if(t.succeed("Fetched projects"),e.length===1){let a=e[0];return console.log(`You only have one project: ${a.name}`),console.log("To create another project, run `crossmint project create`"),await Re(a.id),console.log(`\u2705 Project ${a.name} selected`),process.exit(0)}let s=await hr({message:"Select a project:",choices:e.map(a=>({name:a.name,value:a,description:a.description}))});await Re(s.id),console.log(`\u2705 Project ${s.name} selected`),process.exit(0)}catch{t.fail("Failed to fetch projects"),process.exit(1)}}import _r from"open";l();import Us from"crypto";async function Vs(){let e=Us.randomBytes(32).toString("base64url"),a=Us.createHash("sha256").update(e).digest().toString("base64url");return await ve("pkceCodeVerifier",e),a}async function Fs(){return await Ee("pkceCodeVerifier")}l();import gr from"http";l();async function Ke(){let t=await D();return t||(console.error("\u274C Environment not found"),process.exit(1)),t==="local"?{uri:"test.stytch.com",projectId:"project-test-8eb55d3d-949f-4e0f-aea6-c9ba740f7813",clientId:"connected-app-test-4d27d6d8-3491-45c8-9bb0-b05f89cb7a1a"}:t==="staging"?{uri:"api.stytch.com",projectId:"project-live-b7c564af-0c0d-4662-bfc0-72bed1049cfe",clientId:"connected-app-live-47cd5bf1-c155-42c1-9f36-5d35853b34a7"}:{uri:"api.stytch.com",projectId:"project-live-7a1cb98d-b8b7-4471-aaf6-f8af67a0df94",clientId:"connected-app-live-a72edd7e-6ff3-4002-a13a-e7ca66354bd1"}}async function St(t){return new Promise((e,s)=>{let a=gr.createServer(async(n,o)=>{try{let d=new URL(n.url||"",`http://${n.headers.host}`).searchParams.get("code");if(!d){o.writeHead(400,{"Content-Type":"text/plain"}),o.end("No code provided");return}let u=await Ke(),g=await He(`https://${u.uri}/v1/public/${u.projectId}/oauth2/token`,w.POST,{grant_type:"authorization_code",code:d,client_id:u.clientId,redirect_uri:"http://127.0.0.1:3456/callback",code_verifier:await Fs()}),I=await Ms(x.authentication.exchangeAccessToken,w.POST,{accessToken:g.access_token});await Dt(I.sessionToken),o.writeHead(302,{Location:`${se(t)}${x.console.authorizeDevice.success}`}),o.end(),a.close(),e(g)}catch(i){o.writeHead(500,{"Content-Type":"text/plain"}),o.end("Error during authentication"),a.close(),s(i)}});a.listen(3456)})}var vr=!1;async function Ct(){try{console.log("\u{1F510} Crossmint CLI - Login");let t=await yr({message:"Select environment:",choices:[{name:"Production",value:"production"},{name:"Staging",value:"staging"},...vr?[{name:"Local",value:"local"}]:[]]}),e=se(t);e||(console.error(`Error: No URL found for ${t} environment`),process.exit(1)),await kt(t);let s=St(t),{clientId:a}=await Ke(),n={code_challenge:await Vs(),code_challenge_method:"S256",scope:"full_access",response_type:"code",grant_type:"authorization_code",redirect_uri:"http://127.0.0.1:3456/callback",client_id:a},o=`${e}${x.console.authorizeDevice.index(n)}`;console.log("Opening browser for authentication..."),_r(o),await s,console.log(`\u2705 Login successful! You are now authenticated in the ${t} environment.`),await we()}catch{console.error("\u274C Login failed, please try again."),process.exit(1)}}l();l();async function te(t){return(await R(x.api.projects)).find(a=>a.id===t)}async function It(){let t=await D(),e=await U(),s=await te(e||""),a=await R(x.authentication.getSession);console.log(`You are logged in to \u{1F340}Crossmint as: ${a.user.email} - Environment: ${H(t)} - ${s?`Project: ${s.name}`:"No project selected"}`),process.exit(0)}l();async function bt(){await Mt(),await Lt(),await Ut(),console.log("Logged out"),process.exit(0)}l();l();import{confirm as Er,input as Tr}from"@inquirer/prompts";async function ze(t={}){let e=L();try{let s=t.name;s||(s=await Tr({message:"Enter project name:",validate:o=>o.length>0||"Project name is required"})),e.start(`\u{1F680} Creating project "${s}" with Smart Wallets...`);let a=await R(x.api.console.projects.index,w.POST,{name:s,walletType:"smart_wallet",storageProvider:"ipfs",projectThumbnail:""}),r=JSON.parse(a);e.succeed(`\u2705 Project created successfully!
2
+ var zs=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ys=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);import Yr from"path";import{fileURLToPath as Jr}from"url";var l=zs(()=>{"use strict"});var St=Ys((No,yr)=>{yr.exports={name:"@crossmint/cli",version:"1.1.8",description:"",keywords:[],license:"ISC",author:"",type:"module",main:"dist/bin/crossmint.js",bin:{crossmint:"dist/bin/crossmint.js"},scripts:{build:"tsup --env.NODE_ENV production","build:pkg":"NODE_ENV=production node ./build-pkg.js",dev:"tsup --watch --env.NODE_ENV development",start:"pnpm build && node dist/bin/crossmint.js","test:vitest":"vitest run","test:vitest:watch":"vitest"},dependencies:{"@crossmint/common-consts":"workspace:*","@crossmint/common-string-utils":"workspace:*","@crossmint/common-types":"workspace:*","@crossmint/data-dbs-types":"workspace:*","@crossmint/products-console-types":"workspace:*","@inquirer/prompts":"7.4.0",chalk:"4.1.2",commander:"12.0.0",keytar:"7.9.0",nanospinner:"1.2.2",open:"9.1.0"},devDependencies:{"@crossmint/tsconfig":"workspace:*","@crossmint/tsupconfig":"workspace:*","@crossmint/vitestconfig":"workspace:*","@types/node":"20.14.8","@yao-pkg/pkg":"6.5.1",esbuild:"0.25.2",vitest:"2.1.9"},pkg:{scripts:"dist/bin/crossmint.js",assets:[],targets:["node20-macos-arm64","node20-linux-x64","node20-macos-x64"],outputPath:"build"}}});l();import{program as ye}from"commander";l();l();var qs={production:"https://www.crossmint.com",staging:"https://staging.crossmint.com",local:"http://localhost:3000"};function se(t){return qs[t]}l();l();import it from"keytar";var ct="crossmint-cli";async function Ee(t,e){return it.setPassword(ct,t,e)}async function ve(t){return it.getPassword(ct,t)}async function De(t){return it.deletePassword(ct,t)}function Lt(t){return Ee("environment",t)}async function D(){return ve("environment")}async function Dt(){return De("environment")}function $t(t){return Ee("sessionToken",t)}async function Mt(){return ve("sessionToken")}async function Ut(){return De("sessionToken")}function Re(t){return Ee("projectId",t)}async function U(){return ve("projectId")}async function Vt(){return De("projectId")}import{select as Sr}from"@inquirer/prompts";l();l();l();l();l();l();var Js=Object.defineProperty;var W=(t,e)=>Js(t,"name",{value:e,configurable:!0});l();var b;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{let n={};for(let o of r)n[o]=o;return n},t.getValidEnumValues=r=>{let n=t.objectKeys(r).filter(i=>typeof r[r[i]]!="number"),o={};for(let i of n)o[i]=r[i];return t.objectValues(o)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(o);return n},t.find=(r,n)=>{for(let o of r)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function a(r,n=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=a,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(b||(b={}));var dt;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(dt||(dt={}));var m=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),J=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}},p=b.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"]),Xs=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),$=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let s=e||function(n){return n.message},a={_errors:[]},r=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)a._errors.push(s(o));else{let i=a,d=0;for(;d<o.path.length;){let u=o.path[d];d===o.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(s(o))):i[u]=i[u]||{_errors:[]},i=i[u],d++}}};return r(this),a}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){let s={},a=[];for(let r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(e(r))):a.push(e(r));return{formErrors:a,fieldErrors:s}}get formErrors(){return this.flatten()}};$.create=t=>new $(t);var Ne=(t,e)=>{let s;switch(t.code){case p.invalid_type:t.received===m.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case p.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,b.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:s=`Unrecognized key(s) in object: ${b.joinValues(t.keys,", ")}`;break;case p.invalid_union:s="Invalid input";break;case p.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${b.joinValues(t.options)}`;break;case p.invalid_enum_value:s=`Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`;break;case p.invalid_arguments:s="Invalid function arguments";break;case p.invalid_return_type:s="Invalid function return type";break;case p.invalid_date:s="Invalid date";break;case p.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:b.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case p.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case p.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case p.custom:s="Invalid input";break;case p.invalid_intersection_types:s="Intersection results could not be merged";break;case p.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case p.not_finite:s="Number must be finite";break;default:s=e.defaultError,b.assertNever(t)}return{message:s}},Gt=Ne;function Qs(t){Gt=t}function Me(){return Gt}var Ue=t=>{let{data:e,path:s,errorMaps:a,issueData:r}=t,n=[...s,...r.path||[]],o={...r,path:n},i="",d=a.filter(u=>!!u).slice().reverse();for(let u of d)i=u(o,{data:e,defaultError:i}).message;return{...r,path:n,message:r.message||i}},ea=[];function f(t,e){let s=Ue({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Me(),Ne].filter(a=>!!a)});t.common.issues.push(s)}var O=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){let a=[];for(let r of s){if(r.status==="aborted")return v;r.status==="dirty"&&e.dirty(),a.push(r.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,s){let a=[];for(let r of s)a.push({key:await r.key,value:await r.value});return t.mergeObjectSync(e,a)}static mergeObjectSync(e,s){let a={};for(let r of s){let{key:n,value:o}=r;if(n.status==="aborted"||o.status==="aborted")return v;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(a[n.value]=o.value)}return{status:e.value,value:a}}},v=Object.freeze({status:"aborted"}),Bt=t=>({status:"dirty",value:t}),j=t=>({status:"valid",value:t}),pt=t=>t.status==="aborted",ut=t=>t.status==="dirty",Oe=t=>t.status==="valid",Ve=t=>typeof Promise<"u"&&t instanceof Promise,h;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var V=class{constructor(e,s,a,r){this._cachedPath=[],this.parent=e,this.data=s,this._path=a,this._key=r}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}},Ft=(t,e)=>{if(Oe(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let s=new $(t.common.issues);return this._error=s,this._error}}};function T(t){if(!t)return{};let{errorMap:e,invalid_type_error:s,required_error:a,description:r}=t;if(e&&(s||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,i)=>o.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:a??i.defaultError}:{message:s??i.defaultError},description:r}}var A=class{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)}get description(){return this._def.description}_getType(e){return J(e.data)}_getOrReturnCtx(e,s){return s||{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 O,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 s=this._parse(e);if(Ve(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){let s=this._parse(e);return Promise.resolve(s)}parse(e,s){let a=this.safeParse(e,s);if(a.success)return a.data;throw a.error}safeParse(e,s){var a;let r={common:{issues:[],async:(a=s?.async)!==null&&a!==void 0?a:!1,contextualErrorMap:s?.errorMap},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:J(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Ft(r,n)}async parseAsync(e,s){let a=await this.safeParseAsync(e,s);if(a.success)return a.data;throw a.error}async safeParseAsync(e,s){let a={common:{issues:[],contextualErrorMap:s?.errorMap,async:!0},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:J(e)},r=this._parse({data:e,path:a.path,parent:a}),n=await(Ve(r)?r:Promise.resolve(r));return Ft(a,n)}refine(e,s){let a=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,n)=>{let o=e(r),i=()=>n.addIssue({code:p.custom,...a(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,s){return this._refinement((a,r)=>e(a)?!0:(r.addIssue(typeof s=="function"?s(a,r):s),!1))}_refinement(e){return new M({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return G.create(this,this._def)}nullable(){return q.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Y.create(this,this._def)}promise(){return ee.create(this,this._def)}or(e){return le.create([this,e],this._def)}and(e){return de.create(this,e,this._def)}transform(e){return new M({...T(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let s=typeof e=="function"?e:()=>e;return new he({...T(this._def),innerType:this,defaultValue:s,typeName:y.ZodDefault})}brand(){return new Be({typeName:y.ZodBranded,type:this,...T(this._def)})}catch(e){let s=typeof e=="function"?e:()=>e;return new be({...T(this._def),innerType:this,catchValue:s,typeName:y.ZodCatch})}describe(e){let s=this.constructor;return new s({...this._def,description:e})}pipe(e){return je.create(this,e)}readonly(){return Pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ta=/^c[^\s-]{8,}$/i,sa=/^[a-z][a-z0-9]*$/,aa=/^[0-9A-HJKMNP-TV-Z]{26}$/,ra=/^[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,na=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,oa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",lt,ia=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,ca=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,la=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function da(t,e){return!!((e==="v4"||!e)&&ia.test(t)||(e==="v6"||!e)&&ca.test(t))}var X=class t extends A{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.string,received:n.parsedType}),v}let a=new O,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if(n.kind==="max")e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if(n.kind==="length"){let o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(r=this._getOrReturnCtx(e,r),o?f(r,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&f(r,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),a.dirty())}else if(n.kind==="email")na.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"email",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="emoji")lt||(lt=new RegExp(oa,"u")),lt.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"emoji",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="uuid")ra.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"uuid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="cuid")ta.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cuid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="cuid2")sa.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cuid2",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="ulid")aa.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"ulid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),f(r,{validation:"url",code:p.invalid_string,message:n.message}),a.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"regex",code:p.invalid_string,message:n.message}),a.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),a.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:{startsWith:n.value},message:n.message}),a.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:{endsWith:n.value},message:n.message}),a.dirty()):n.kind==="datetime"?la(n).test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:"datetime",message:n.message}),a.dirty()):n.kind==="ip"?da(e.data,n.version)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"ip",code:p.invalid_string,message:n.message}),a.dirty()):b.assertNever(n);return{status:a.value,value:e.data}}_regex(e,s,a){return this.refinement(r=>e.test(r),{validation:s,code:p.invalid_string,...h.errToObj(a)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}datetime(e){var s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(s=e?.offset)!==null&&s!==void 0?s:!1,...h.errToObj(e?.message)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...h.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s?.position,...h.errToObj(s?.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...h.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...h.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...h.errToObj(s)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}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 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 minLength(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}};X.create=t=>{var e;return new X({checks:[],typeName:y.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...T(t)})};function pa(t,e){let s=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,r=s>a?s:a,n=parseInt(t.toFixed(r).replace(".","")),o=parseInt(e.toFixed(r).replace(".",""));return n%o/Math.pow(10,r)}var ae=class t extends A{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)!==m.number){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.number,received:n.parsedType}),v}let a,r=new O;for(let n of this._def.checks)n.kind==="int"?b.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:p.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?pa(e.data,n.value)!==0&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:p.not_finite,message:n.message}),r.dirty()):b.assertNever(n);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,h.toString(s))}gt(e,s){return this.setLimit("min",e,!1,h.toString(s))}lte(e,s){return this.setLimit("max",e,!0,h.toString(s))}lt(e,s){return this.setLimit("max",e,!1,h.toString(s))}setLimit(e,s,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:a,message:h.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,s=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(s===null||a.value>s)&&(s=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(s)&&Number.isFinite(e)}};ae.create=t=>new ae({checks:[],typeName:y.ZodNumber,coerce:t?.coerce||!1,...T(t)});var re=class t extends A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==m.bigint){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.bigint,received:n.parsedType}),v}let a,r=new O;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):b.assertNever(n);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,h.toString(s))}gt(e,s){return this.setLimit("min",e,!1,h.toString(s))}lte(e,s){return this.setLimit("max",e,!0,h.toString(s))}lt(e,s){return this.setLimit("max",e,!1,h.toString(s))}setLimit(e,s,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:a,message:h.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(s)})}get minValue(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}};re.create=t=>{var e;return new re({checks:[],typeName:y.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...T(t)})};var ne=class extends A{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.boolean,received:a.parsedType}),v}return j(e.data)}};ne.create=t=>new ne({typeName:y.ZodBoolean,coerce:t?.coerce||!1,...T(t)});var oe=class t extends A{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.date,received:n.parsedType}),v}if(isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_date}),v}let a=new O,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),a.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),a.dirty()):b.assertNever(n);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(s)})}get minDate(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}};oe.create=t=>new oe({checks:[],coerce:t?.coerce||!1,typeName:y.ZodDate,...T(t)});var Ae=class extends A{_parse(e){if(this._getType(e)!==m.symbol){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.symbol,received:a.parsedType}),v}return j(e.data)}};Ae.create=t=>new Ae({typeName:y.ZodSymbol,...T(t)});var ie=class extends A{_parse(e){if(this._getType(e)!==m.undefined){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.undefined,received:a.parsedType}),v}return j(e.data)}};ie.create=t=>new ie({typeName:y.ZodUndefined,...T(t)});var ce=class extends A{_parse(e){if(this._getType(e)!==m.null){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.null,received:a.parsedType}),v}return j(e.data)}};ce.create=t=>new ce({typeName:y.ZodNull,...T(t)});var Q=class extends A{constructor(){super(...arguments),this._any=!0}_parse(e){return j(e.data)}};Q.create=t=>new Q({typeName:y.ZodAny,...T(t)});var z=class extends A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j(e.data)}};z.create=t=>new z({typeName:y.ZodUnknown,...T(t)});var B=class extends A{_parse(e){let s=this._getOrReturnCtx(e);return f(s,{code:p.invalid_type,expected:m.never,received:s.parsedType}),v}};B.create=t=>new B({typeName:y.ZodNever,...T(t)});var Se=class extends A{_parse(e){if(this._getType(e)!==m.undefined){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.void,received:a.parsedType}),v}return j(e.data)}};Se.create=t=>new Se({typeName:y.ZodVoid,...T(t)});var Y=class t extends A{_parse(e){let{ctx:s,status:a}=this._processInputParams(e),r=this._def;if(s.parsedType!==m.array)return f(s,{code:p.invalid_type,expected:m.array,received:s.parsedType}),v;if(r.exactLength!==null){let o=s.data.length>r.exactLength.value,i=s.data.length<r.exactLength.value;(o||i)&&(f(s,{code:o?p.too_big:p.too_small,minimum:i?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),a.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(f(s,{code:p.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),a.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(f(s,{code:p.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),a.dirty()),s.common.async)return Promise.all([...s.data].map((o,i)=>r.type._parseAsync(new V(s,o,s.path,i)))).then(o=>O.mergeArray(a,o));let n=[...s.data].map((o,i)=>r.type._parseSync(new V(s,o,s.path,i)));return O.mergeArray(a,n)}get element(){return this._def.type}min(e,s){return new t({...this._def,minLength:{value:e,message:h.toString(s)}})}max(e,s){return new t({...this._def,maxLength:{value:e,message:h.toString(s)}})}length(e,s){return new t({...this._def,exactLength:{value:e,message:h.toString(s)}})}nonempty(e){return this.min(1,e)}};Y.create=(t,e)=>new Y({type:t,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...T(e)});function Te(t){if(t instanceof k){let e={};for(let s in t.shape){let a=t.shape[s];e[s]=G.create(Te(a))}return new k({...t._def,shape:()=>e})}else return t instanceof Y?new Y({...t._def,type:Te(t.element)}):t instanceof G?G.create(Te(t.unwrap())):t instanceof q?q.create(Te(t.unwrap())):t instanceof Z?Z.create(t.items.map(e=>Te(e))):t}var k=class t extends A{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(),s=b.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==m.object){let u=this._getOrReturnCtx(e);return f(u,{code:p.invalid_type,expected:m.object,received:u.parsedType}),v}let{status:a,ctx:r}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof B&&this._def.unknownKeys==="strip"))for(let u in r.data)o.includes(u)||i.push(u);let d=[];for(let u of o){let g=n[u],I=r.data[u];d.push({key:{status:"valid",value:u},value:g._parse(new V(r,I,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof B){let u=this._def.unknownKeys;if(u==="passthrough")for(let g of i)d.push({key:{status:"valid",value:g},value:{status:"valid",value:r.data[g]}});else if(u==="strict")i.length>0&&(f(r,{code:p.unrecognized_keys,keys:i}),a.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let g of i){let I=r.data[g];d.push({key:{status:"valid",value:g},value:u._parse(new V(r,I,r.path,g)),alwaysSet:g in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let g of d){let I=await g.key;u.push({key:I,value:await g.value,alwaysSet:g.alwaysSet})}return u}).then(u=>O.mergeObjectSync(a,u)):O.mergeObjectSync(a,d)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,a)=>{var r,n,o,i;let d=(o=(n=(r=this._def).errorMap)===null||n===void 0?void 0:n.call(r,s,a).message)!==null&&o!==void 0?o:a.defaultError;return s.code==="unrecognized_keys"?{message:(i=h.errToObj(e).message)!==null&&i!==void 0?i:d}:{message:d}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let s={};return b.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(s[a]=this.shape[a])}),new t({...this._def,shape:()=>s})}omit(e){let s={};return b.objectKeys(this.shape).forEach(a=>{e[a]||(s[a]=this.shape[a])}),new t({...this._def,shape:()=>s})}deepPartial(){return Te(this)}partial(e){let s={};return b.objectKeys(this.shape).forEach(a=>{let r=this.shape[a];e&&!e[a]?s[a]=r:s[a]=r.optional()}),new t({...this._def,shape:()=>s})}required(e){let s={};return b.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])s[a]=this.shape[a];else{let n=this.shape[a];for(;n instanceof G;)n=n._def.innerType;s[a]=n}}),new t({...this._def,shape:()=>s})}keyof(){return Zt(b.objectKeys(this.shape))}};k.create=(t,e)=>new k({shape:()=>t,unknownKeys:"strip",catchall:B.create(),typeName:y.ZodObject,...T(e)});k.strictCreate=(t,e)=>new k({shape:()=>t,unknownKeys:"strict",catchall:B.create(),typeName:y.ZodObject,...T(e)});k.lazycreate=(t,e)=>new k({shape:t,unknownKeys:"strip",catchall:B.create(),typeName:y.ZodObject,...T(e)});var le=class extends A{_parse(e){let{ctx:s}=this._processInputParams(e),a=this._def.options;function r(n){for(let i of n)if(i.result.status==="valid")return i.result;for(let i of n)if(i.result.status==="dirty")return s.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(i=>new $(i.ctx.common.issues));return f(s,{code:p.invalid_union,unionErrors:o}),v}if(s.common.async)return Promise.all(a.map(async n=>{let o={...s,common:{...s.common,issues:[]},parent:null};return{result:await n._parseAsync({data:s.data,path:s.path,parent:o}),ctx:o}})).then(r);{let n,o=[];for(let d of a){let u={...s,common:{...s.common,issues:[]},parent:null},g=d._parseSync({data:s.data,path:s.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!n&&(n={result:g,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(n)return s.common.issues.push(...n.ctx.common.issues),n.result;let i=o.map(d=>new $(d));return f(s,{code:p.invalid_union,unionErrors:i}),v}}get options(){return this._def.options}};le.create=(t,e)=>new le({options:t,typeName:y.ZodUnion,...T(e)});var $e=t=>t instanceof pe?$e(t.schema):t instanceof M?$e(t.innerType()):t instanceof ue?[t.value]:t instanceof me?t.options:t instanceof fe?Object.keys(t.enum):t instanceof he?$e(t._def.innerType):t instanceof ie?[void 0]:t instanceof ce?[null]:null,Fe=class t extends A{_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.object)return f(s,{code:p.invalid_type,expected:m.object,received:s.parsedType}),v;let a=this.discriminator,r=s.data[a],n=this.optionsMap.get(r);return n?s.common.async?n._parseAsync({data:s.data,path:s.path,parent:s}):n._parseSync({data:s.data,path:s.path,parent:s}):(f(s,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),v)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,a){let r=new Map;for(let n of s){let o=$e(n.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new t({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:r,...T(a)})}};function mt(t,e){let s=J(t),a=J(e);if(t===e)return{valid:!0,data:t};if(s===m.object&&a===m.object){let r=b.objectKeys(e),n=b.objectKeys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let d=mt(t[i],e[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(s===m.array&&a===m.array){if(t.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],d=mt(o,i);if(!d.valid)return{valid:!1};r.push(d.data)}return{valid:!0,data:r}}else return s===m.date&&a===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var de=class extends A{_parse(e){let{status:s,ctx:a}=this._processInputParams(e),r=(n,o)=>{if(pt(n)||pt(o))return v;let i=mt(n.value,o.value);return i.valid?((ut(n)||ut(o))&&s.dirty(),{status:s.value,value:i.data}):(f(a,{code:p.invalid_intersection_types}),v)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([n,o])=>r(n,o)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};de.create=(t,e,s)=>new de({left:t,right:e,typeName:y.ZodIntersection,...T(s)});var Z=class t extends A{_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.array)return f(a,{code:p.invalid_type,expected:m.array,received:a.parsedType}),v;if(a.data.length<this._def.items.length)return f(a,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&a.data.length>this._def.items.length&&(f(a,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());let n=[...a.data].map((o,i)=>{let d=this._def.items[i]||this._def.rest;return d?d._parse(new V(a,o,a.path,i)):null}).filter(o=>!!o);return a.common.async?Promise.all(n).then(o=>O.mergeArray(s,o)):O.mergeArray(s,n)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Z.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Z({items:t,typeName:y.ZodTuple,rest:null,...T(e)})};var We=class t extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.object)return f(a,{code:p.invalid_type,expected:m.object,received:a.parsedType}),v;let r=[],n=this._def.keyType,o=this._def.valueType;for(let i in a.data)r.push({key:n._parse(new V(a,i,a.path,i)),value:o._parse(new V(a,a.data[i],a.path,i))});return a.common.async?O.mergeObjectAsync(s,r):O.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(e,s,a){return s instanceof A?new t({keyType:e,valueType:s,typeName:y.ZodRecord,...T(a)}):new t({keyType:X.create(),valueType:e,typeName:y.ZodRecord,...T(s)})}},Ce=class extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.map)return f(a,{code:p.invalid_type,expected:m.map,received:a.parsedType}),v;let r=this._def.keyType,n=this._def.valueType,o=[...a.data.entries()].map(([i,d],u)=>({key:r._parse(new V(a,i,a.path,[u,"key"])),value:n._parse(new V(a,d,a.path,[u,"value"]))}));if(a.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of o){let u=await d.key,g=await d.value;if(u.status==="aborted"||g.status==="aborted")return v;(u.status==="dirty"||g.status==="dirty")&&s.dirty(),i.set(u.value,g.value)}return{status:s.value,value:i}})}else{let i=new Map;for(let d of o){let u=d.key,g=d.value;if(u.status==="aborted"||g.status==="aborted")return v;(u.status==="dirty"||g.status==="dirty")&&s.dirty(),i.set(u.value,g.value)}return{status:s.value,value:i}}}};Ce.create=(t,e,s)=>new Ce({valueType:e,keyType:t,typeName:y.ZodMap,...T(s)});var Ie=class t extends A{_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.set)return f(a,{code:p.invalid_type,expected:m.set,received:a.parsedType}),v;let r=this._def;r.minSize!==null&&a.data.size<r.minSize.value&&(f(a,{code:p.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&a.data.size>r.maxSize.value&&(f(a,{code:p.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());let n=this._def.valueType;function o(d){let u=new Set;for(let g of d){if(g.status==="aborted")return v;g.status==="dirty"&&s.dirty(),u.add(g.value)}return{status:s.value,value:u}}let i=[...a.data.values()].map((d,u)=>n._parse(new V(a,d,a.path,u)));return a.common.async?Promise.all(i).then(d=>o(d)):o(i)}min(e,s){return new t({...this._def,minSize:{value:e,message:h.toString(s)}})}max(e,s){return new t({...this._def,maxSize:{value:e,message:h.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}};Ie.create=(t,e)=>new Ie({valueType:t,minSize:null,maxSize:null,typeName:y.ZodSet,...T(e)});var Ge=class t extends A{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.function)return f(s,{code:p.invalid_type,expected:m.function,received:s.parsedType}),v;function a(i,d){return Ue({data:i,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Me(),Ne].filter(u=>!!u),issueData:{code:p.invalid_arguments,argumentsError:d}})}function r(i,d){return Ue({data:i,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Me(),Ne].filter(u=>!!u),issueData:{code:p.invalid_return_type,returnTypeError:d}})}let n={errorMap:s.common.contextualErrorMap},o=s.data;if(this._def.returns instanceof ee){let i=this;return j(async function(...d){let u=new $([]),g=await i._def.args.parseAsync(d,n).catch(_e=>{throw u.addIssue(a(d,_e)),u}),I=await Reflect.apply(o,this,g);return await i._def.returns._def.type.parseAsync(I,n).catch(_e=>{throw u.addIssue(r(I,_e)),u})})}else{let i=this;return j(function(...d){let u=i._def.args.safeParse(d,n);if(!u.success)throw new $([a(d,u.error)]);let g=Reflect.apply(o,this,u.data),I=i._def.returns.safeParse(g,n);if(!I.success)throw new $([r(g,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Z.create(e).rest(z.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,a){return new t({args:e||Z.create([]).rest(z.create()),returns:s||z.create(),typeName:y.ZodFunction,...T(a)})}},pe=class extends A{get schema(){return this._def.getter()}_parse(e){let{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}};pe.create=(t,e)=>new pe({getter:t,typeName:y.ZodLazy,...T(e)});var ue=class extends A{_parse(e){if(e.data!==this._def.value){let s=this._getOrReturnCtx(e);return f(s,{received:s.data,code:p.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}};ue.create=(t,e)=>new ue({value:t,typeName:y.ZodLiteral,...T(e)});function Zt(t,e){return new me({values:t,typeName:y.ZodEnum,...T(e)})}var me=class t extends A{_parse(e){if(typeof e.data!="string"){let s=this._getOrReturnCtx(e),a=this._def.values;return f(s,{expected:b.joinValues(a),received:s.parsedType,code:p.invalid_type}),v}if(this._def.values.indexOf(e.data)===-1){let s=this._getOrReturnCtx(e),a=this._def.values;return f(s,{received:s.data,code:p.invalid_enum_value,options:a}),v}return j(e.data)}get options(){return this._def.values}get enum(){let e={};for(let s of this._def.values)e[s]=s;return e}get Values(){let e={};for(let s of this._def.values)e[s]=s;return e}get Enum(){let e={};for(let s of this._def.values)e[s]=s;return e}extract(e){return t.create(e)}exclude(e){return t.create(this.options.filter(s=>!e.includes(s)))}};me.create=Zt;var fe=class extends A{_parse(e){let s=b.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==m.string&&a.parsedType!==m.number){let r=b.objectValues(s);return f(a,{expected:b.joinValues(r),received:a.parsedType,code:p.invalid_type}),v}if(s.indexOf(e.data)===-1){let r=b.objectValues(s);return f(a,{received:a.data,code:p.invalid_enum_value,options:r}),v}return j(e.data)}get enum(){return this._def.values}};fe.create=(t,e)=>new fe({values:t,typeName:y.ZodNativeEnum,...T(e)});var ee=class extends A{unwrap(){return this._def.type}_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.promise&&s.common.async===!1)return f(s,{code:p.invalid_type,expected:m.promise,received:s.parsedType}),v;let a=s.parsedType===m.promise?s.data:Promise.resolve(s.data);return j(a.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}};ee.create=(t,e)=>new ee({type:t,typeName:y.ZodPromise,...T(e)});var M=class extends A{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:s,ctx:a}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:o=>{f(a,o),o.fatal?s.abort():s.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let o=r.transform(a.data,n);return a.common.issues.length?{status:"dirty",value:a.data}:a.common.async?Promise.resolve(o).then(i=>this._def.schema._parseAsync({data:i,path:a.path,parent:a})):this._def.schema._parseSync({data:o,path:a.path,parent:a})}if(r.type==="refinement"){let o=i=>{let d=r.refinement(i,n);if(a.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(a.common.async===!1){let i=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?v:(i.status==="dirty"&&s.dirty(),o(i.value),{status:s.value,value:i.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(i=>i.status==="aborted"?v:(i.status==="dirty"&&s.dirty(),o(i.value).then(()=>({status:s.value,value:i.value}))))}if(r.type==="transform")if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Oe(o))return o;let i=r.transform(o.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:i}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>Oe(o)?Promise.resolve(r.transform(o.value,n)).then(i=>({status:s.value,value:i})):o);b.assertNever(r)}};M.create=(t,e,s)=>new M({schema:t,typeName:y.ZodEffects,effect:e,...T(s)});M.createWithPreprocess=(t,e,s)=>new M({schema:e,effect:{type:"preprocess",transform:t},typeName:y.ZodEffects,...T(s)});var G=class extends A{_parse(e){return this._getType(e)===m.undefined?j(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};G.create=(t,e)=>new G({innerType:t,typeName:y.ZodOptional,...T(e)});var q=class extends A{_parse(e){return this._getType(e)===m.null?j(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};q.create=(t,e)=>new q({innerType:t,typeName:y.ZodNullable,...T(e)});var he=class extends A{_parse(e){let{ctx:s}=this._processInputParams(e),a=s.data;return s.parsedType===m.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:s.path,parent:s})}removeDefault(){return this._def.innerType}};he.create=(t,e)=>new he({innerType:t,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});var be=class extends A{_parse(e){let{ctx:s}=this._processInputParams(e),a={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Ve(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new $(a.common.issues)},input:a.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new $(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};be.create=(t,e)=>new be({innerType:t,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});var xe=class extends A{_parse(e){if(this._getType(e)!==m.nan){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.nan,received:a.parsedType}),v}return{status:"valid",value:e.data}}};xe.create=t=>new xe({typeName:y.ZodNaN,...T(t)});var ua=Symbol("zod_brand"),Be=class extends A{_parse(e){let{ctx:s}=this._processInputParams(e),a=s.data;return this._def.type._parse({data:a,path:s.path,parent:s})}unwrap(){return this._def.type}},je=class t extends A{_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?v:n.status==="dirty"?(s.dirty(),Bt(n.value)):this._def.out._parseAsync({data:n.value,path:a.path,parent:a})})();{let r=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return r.status==="aborted"?v:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:a.path,parent:a})}}static create(e,s){return new t({in:e,out:s,typeName:y.ZodPipeline})}},Pe=class extends A{_parse(e){let s=this._def.innerType._parse(e);return Oe(s)&&(s.value=Object.freeze(s.value)),s}};Pe.create=(t,e)=>new Pe({innerType:t,typeName:y.ZodReadonly,...T(e)});var Ht=(t,e={},s)=>t?Q.create().superRefine((a,r)=>{var n,o;if(!t(a)){let i=typeof e=="function"?e(a):typeof e=="string"?{message:e}:e,d=(o=(n=i.fatal)!==null&&n!==void 0?n:s)!==null&&o!==void 0?o:!0,u=typeof i=="string"?{message:i}:i;r.addIssue({code:"custom",...u,fatal:d})}}):Q.create(),ma={object:k.lazycreate},y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(y||(y={}));var fa=(t,e={message:`Input not instance of ${t.name}`})=>Ht(s=>s instanceof t,e),Kt=X.create,zt=ae.create,ha=xe.create,ga=re.create,Yt=ne.create,ya=oe.create,_a=Ae.create,Ea=ie.create,va=ce.create,Ta=Q.create,Aa=z.create,Sa=B.create,Ca=Se.create,Ia=Y.create,ba=k.create,xa=k.strictCreate,Pa=le.create,wa=Fe.create,Ra=de.create,Na=Z.create,Oa=We.create,ja=Ce.create,ka=Ie.create,La=Ge.create,Da=pe.create,$a=ue.create,Ma=me.create,Ua=fe.create,Va=ee.create,Wt=M.create,Fa=G.create,Wa=q.create,Ga=M.createWithPreprocess,Ba=je.create,Za=()=>Kt().optional(),Ha=()=>zt().optional(),Ka=()=>Yt().optional(),za={string:t=>X.create({...t,coerce:!0}),number:t=>ae.create({...t,coerce:!0}),boolean:t=>ne.create({...t,coerce:!0}),bigint:t=>re.create({...t,coerce:!0}),date:t=>oe.create({...t,coerce:!0})},Ya=v,_=Object.freeze({__proto__:null,defaultErrorMap:Ne,setErrorMap:Qs,getErrorMap:Me,makeIssue:Ue,EMPTY_PATH:ea,addIssueToContext:f,ParseStatus:O,INVALID:v,DIRTY:Bt,OK:j,isAborted:pt,isDirty:ut,isValid:Oe,isAsync:Ve,get util(){return b},get objectUtil(){return dt},ZodParsedType:m,getParsedType:J,ZodType:A,ZodString:X,ZodNumber:ae,ZodBigInt:re,ZodBoolean:ne,ZodDate:oe,ZodSymbol:Ae,ZodUndefined:ie,ZodNull:ce,ZodAny:Q,ZodUnknown:z,ZodNever:B,ZodVoid:Se,ZodArray:Y,ZodObject:k,ZodUnion:le,ZodDiscriminatedUnion:Fe,ZodIntersection:de,ZodTuple:Z,ZodRecord:We,ZodMap:Ce,ZodSet:Ie,ZodFunction:Ge,ZodLazy:pe,ZodLiteral:ue,ZodEnum:me,ZodNativeEnum:fe,ZodPromise:ee,ZodEffects:M,ZodTransformer:M,ZodOptional:G,ZodNullable:q,ZodDefault:he,ZodCatch:be,ZodNaN:xe,BRAND:ua,ZodBranded:Be,ZodPipeline:je,ZodReadonly:Pe,custom:Ht,Schema:A,ZodSchema:A,late:ma,get ZodFirstPartyTypeKind(){return y},coerce:za,any:Ta,array:Ia,bigint:ga,boolean:Yt,date:ya,discriminatedUnion:wa,effect:Wt,enum:Ma,function:La,instanceof:fa,intersection:Ra,lazy:Da,literal:$a,map:ja,nan:ha,nativeEnum:Ua,never:Sa,null:va,nullable:Wa,number:zt,object:ba,oboolean:Ka,onumber:Ha,optional:Fa,ostring:Za,pipeline:Ba,preprocess:Ga,promise:Va,record:Oa,set:ka,strictObject:xa,string:Kt,symbol:_a,transformer:Wt,tuple:Na,undefined:Ea,union:Pa,unknown:Aa,void:Ca,NEVER:Ya,ZodIssueCode:p,quotelessJson:Xs,ZodError:$});l();var qa=_.object({whitelabelWalletAPI:_.boolean(),whitelabelCheckoutAPI:_.boolean(),billingAPI:_.boolean(),ethereumMintAPI:_.boolean(),baseMintAPI:_.boolean().optional(),isEscrowless:_.boolean(),subprojectCreation:_.object({enabled:_.boolean(),KYCOwnership:_.enum(["crossmint","developer"])}).optional(),mintAPIBYOC:_.boolean().optional(),mintAPITransferable:_.boolean().optional(),mintAPIUserIdBasedMintRecipient:_.boolean().optional(),embeddedCheckout:_.boolean().optional(),batchMintAPI:_.boolean().optional(),spamPlan:_.enum(["simple","advanced"]).optional(),paymentsMintToProjectScopedWallets:_.boolean().optional(),nonCustodialWallets:_.boolean().optional(),mintingAndWalletsSubscriptionsSelfServe:_.boolean().optional(),registerExternalCollections:_.boolean().optional(),mintAPIMaxReuploadFileSizeMB:_.number().optional(),solanaNonCompressedMint:_.boolean().optional(),solanaSFTMint:_.boolean().optional(),subscriptions:_.boolean().optional(),memeTokensCheckout:_.boolean().optional(),onrampCheckout:_.boolean().optional(),worldstore:_.object({sellerId:_.string().optional()}).optional(),payWithCryptoNativePassthrough:_.boolean().optional()}),ge=(t=>(t.WHITELABEL_WALLET_API="whitelabelWalletAPI",t.WHITELABEL_CHECKOUT_API="whitelabelCheckoutAPI",t.BILLING_API="billingAPI",t.SUBSCRIPTIONS="subscriptions",t))(ge||{});l();function F(t){return Object.values(t)}W(F,"objectValues");function qt(t){return Object.keys(t)}W(qt,"objectKeys");function Jt(t){return Object.entries(t)}W(Jt,"objectEntries");l();l();var Xt=/^(?:https?:\/\/)?(?:(?:[a-z0-9])(?:[a-z0-9-]{0,61}[a-z0-9])?\.)+(?:[a-z]{2,24}|[a-z0-9-]{2,24}\.?)/i;l();var ft={BUYER:"buyer",SELLER:"seller",BUYER_SUBTRACT:"buyer-subtract"};l();l();var ht={ERC_721:"erc-721",ERC_1155:"erc-1155",PRIVATE_ERC_721:"private-erc-721",THIRDWEB_DROP:"thirdweb-drop",THIRDWEB_EDITION_DROP:"thirdweb-edition-drop",EVM_MAGIC_EDEN_SECONDARY:"eth-magic-eden-secondary",RESERVOIR_SECONDARY:"reservoir-secondary-eth",WEN_MINT_ERC_721A:"wen-mint-erc721a",MANIFOLD_ERC_721:"manifold-erc-721",MANIFOLD_ERC_1155:"manifold-erc-1155",ZORA_DROP_ERC_721:"zora-drop-erc-721",ZORA_EDITION_ERC_721:"zora-edition-erc-721",ZORA_ERC_1155:"zora-erc-1155",MANAGED_ERC_721:"managed-erc-721",MANAGED_ERC_1155:"managed-erc-1155",OKX:"okx",RARIBLE:"rarible",SOUND:"sound-evm",HIGHLIGHT:"highlight",EVM_SECONDARY_AGGREGATE:"evm-secondary-aggregate",MANAGED_STORY_NFT_COLLECTION:"story-spg-collection",WORLDSTORE_EVM:"worldstore-protocol-evm",EVM_EXCHANGE_AGGREGATE:"evm-exchange-aggregate"},vn=Object.values(ht);l();var gt={CANDY_MACHINE:"candy-machine",SNOWCRASH:"solana-custom-snowcrash",YAWW:"solana-custom-yawww",HADESWAP:"solana-custom-hadeswap",SOLANART:"solana-custom-solanart",GLASS_PRIMARY:"solana-custom-glass-primary",EXCHANGE_ART_SECONDARY:"solana-custom-exchangeart-secondary",EXCHANGE_ART_EDITION_MINT:"solana-custom-exchangeart-edition-mint",AUCTION_HOUSE:"solana-auction-house",SOLANA_MAGIC_EDEN_LAUNCHPAD:"solana-magic-eden-launchpad",SOLANA_MAGIC_EDEN_SECONDARY:"solana-magic-eden-secondary",SOLANA_SECONDARY_AGGREGATE:"solana-secondary-aggregate",HYPERSPACE:"solana-hyperspace-marketplace",FORM_FUNCTION:"solana-form-function",FORM_FUNCTION_EDITION:"solana-form-function-edition",METAPLEX_CERTIFIED_COLLECTION:"metaplex-certified-collection",CATHOEN_SECONDARY:"solana-catheon-secondary",TENSOR_SECONDARY:"solana-tensor-secondary",MANAGED_METAPLEX:"managed-metaplex",MANAGED_SFT_METAPLEX:"managed-sft-metaplex",SOLANA_EXCHANGE_AGGREGATE:"solana-exchange-aggregate"},Sn=Object.values(gt);l();var yt={CLUTCHY_SECONDARY:"sui-clutchy-secondary",MANAGED_SUI_DIGITAL_ASSET:"managed-sui-digital-asset"},xn=F(yt);l();var _t={MANAGED_XION_CW_721:"managed-xion-cw-721",XION_CW_721:"xion-cw-721"},Nn=F(_t);l();var Et={MANAGED_APTOS_DIGITAL_ASSET:"managed-aptos-digital-asset"},Ln=F(Et);l();function vt(t,e){return t.includes(e)}W(vt,"arrayIncludes");var C={...gt,...ht,...yt,...Et,..._t},Ja=F(C);function Xa(t){return vt(Ja,t)}W(Xa,"isClientContractType");var Qt=(t=>(t.CONSOLE="console",t.PROJECT="project",t))(Qt||{});var Qa=/^(?:https?:\/\/(?:www\.)?(?:twitter\.com|x\.com)\/)?(?:@)?([A-Za-z0-9_]{4,15})$/,er=_.object({twitter:_.string().regex(Qa,"Please enter a valid Twitter/X handle").or(_.string().length(0)).optional(),discord:_.string().optional(),website:_.union([_.literal(""),_.string().regex(Xt,"Invalid URL")]).optional()}),tr=_.object({useCompression:_.boolean().optional(),feesPayer:_.nativeEnum(ft).optional().default(ft.BUYER),allowDirectTemplateMinting:_.boolean().optional()}),es=500,sr=_.object({title:_.string().min(1).max(100).regex(/.*\S.*/,"Name cannot be empty"),description:_.string().max(es).min(1,"Description cannot be empty"),imageUrl:_.union([_.literal(""),_.string().url("Image url should be a valid url, starting with https://")]).optional(),symbol:_.string().optional()}),ar={[C.CANDY_MACHINE]:[{name:ke(C.CANDY_MACHINE),label:"Candy Machine Id"}],[C.AUCTION_HOUSE]:[{name:ke(C.AUCTION_HOUSE),label:"Action House Address"}],[C.SOLANA_MAGIC_EDEN_LAUNCHPAD]:[{name:ke(C.SOLANA_MAGIC_EDEN_LAUNCHPAD),label:"Candy Machine Id"}]};function ke(t){switch(t){case C.CANDY_MACHINE:case C.SOLANA_MAGIC_EDEN_LAUNCHPAD:return"candyMachineId";case C.AUCTION_HOUSE:return"auctionHouseAddress";case C.ERC_721:case C.ERC_1155:case C.THIRDWEB_DROP:case C.THIRDWEB_EDITION_DROP:case C.WEN_MINT_ERC_721A:case C.MANAGED_ERC_721:case C.MANAGED_ERC_1155:case C.ZORA_DROP_ERC_721:case C.ZORA_EDITION_ERC_721:case C.ZORA_ERC_1155:case C.HIGHLIGHT:case C.PRIVATE_ERC_721:case C.MANAGED_XION_CW_721:case C.XION_CW_721:return"contractAddress";case C.MANIFOLD_ERC_721:case C.MANIFOLD_ERC_1155:return"tokenContractAddress";case C.MANAGED_METAPLEX:return"mintAddress";case C.MANAGED_APTOS_DIGITAL_ASSET:return"objectId";case C.MANAGED_SUI_DIGITAL_ASSET:return"packageId";case C.HADESWAP:case C.SOLANART:case C.GLASS_PRIMARY:case C.EXCHANGE_ART_SECONDARY:case C.SOLANA_MAGIC_EDEN_SECONDARY:case C.HYPERSPACE:case C.EVM_MAGIC_EDEN_SECONDARY:case C.RESERVOIR_SECONDARY:case C.METAPLEX_CERTIFIED_COLLECTION:return null;default:throw new Error(`Contract address type ${t} not recorded in getContractAddressFieldFromContractType`)}}W(ke,"getContractAddressFieldFromContractType");function ts(t){var e;return((e=t.mintingContract)==null?void 0:e.chain)||t.chain}W(ts,"getChainFromClientIntegration");var Tt={SUBSCRIPTIONS:"subscriptions",COLLECTIONS:"collections"};var R={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",HEAD:"HEAD",OPTIONS:"OPTIONS",CONNECT:"CONNECT",TRACE:"TRACE"},rr=F(R);l();l();var nr=Object.defineProperty,c=(t,e)=>nr(t,"name",{value:e,configurable:!0});l();l();var or=Object.defineProperty,S=(t,e)=>or(t,"name",{value:e,configurable:!0});function H(t){return t.charAt(0).toUpperCase()+t.slice(1)}S(H,"capitalizeFirstLetter");function K(t){return!t||t.length===0||t.trim().length===0}S(K,"isEmpty");function as(t,e){return t.length<=e?t:t.slice(0,e)+"\u2026"}S(as,"cutAndAddEllipsis");function rs(t,e=4,s=4){return t.length<=e+s?t:t.slice(0,e)+"\u2026"+t.slice(s*-1)}S(rs,"cutMiddleAndAddEllipsis");function ns(){return(Math.random()+1).toString(36).substring(7)}S(ns,"randomString");function os(t){let e=t.length,s=0,a=0;if(e>0)for(;a<e;)s=(s<<5)-s+t.charCodeAt(a++)|0;return s}S(os,"hashCode");var ss=1e3;function is(t){return t.length<=ss?t:t.slice(0,ss)+"<truncated>"}S(is,"truncateForLog");function cs(t){return!t||typeof t!="string"?!1:t.toLowerCase()==="true"}S(cs,"parseBoolean");function ls(t){return/^-?\d+$/.test(t)}S(ls,"containsInteger");function ds(t){if(t.length===0)return"";if(t.length===1)return t[0];let e=t.slice(0,t.length-1),s=t[t.length-1];return e.join(", ")+" and "+s}S(ds,"makeFormattedEnglishList");function ps(t){return K(t)?"":t.split(" ").map(e=>e?H(e):"").join(" ")}S(ps,"capitalizeFirstLetterOfEachWord");function us(t){return t.replace(/\s/g,"")}S(us,"removeAllWhitespaces");function ms(t){if(K(t))return 0;let e=S((s,a)=>{let r=(a.charCodeAt(0)-48)/74;return(s+r)%1},"base58Reduction");return t.split("").reduce(e,0)}S(ms,"normalizeBase58String");function fs(t,e=100){if(!K(t))return t.substring(0,e)}S(fs,"trimIfDefined");function hs(t){return t.replace(/(\r\n|\n|\r)/g," ").replace(/[\x00-\x1F\x7F-\uFFFF]/g,"")}S(hs,"sanitizeStringToValidHTTPHeaderValue");function gs(t){try{JSON.parse(t)}catch{return!1}return!0}S(gs,"isStringifiedJson");function ys(t,e){if(!K(t))try{return JSON.parse(t)}catch(s){console.error(`safeJSONParse failed: ${e??""}`,s);return}}S(ys,"safeJSONParse");function _s(t,e){return t?.toLowerCase()===e?.toLowerCase()}S(_s,"equalsIgnoreCase");function Es(t){return t.map(e=>`'${e}'`).join(" | ")}S(Es,"arrayToUnionString");function vs(t){return t.startsWith("0x")?t:`0x${t}`}S(vs,"addHexIndicator");function Ts(t){return Number.parseFloat(t).toString()}S(Ts,"removeTrailingZeros");function As(){let t="9876543210",e="";for(let s=0;s<4;s++)e+=t[Math.floor(Math.random()*10)];return e}S(As,"generateOTP");function Ss(t){return t&&t.includes("@")?t.split("@")[0]:t??""}S(Ss,"getNameFromEmail");function Cs(t){return t!=null?`@${t.split("@").pop()}`:""}S(Cs,"getDomainFromEmail");function Is(t){return H(t.toLowerCase().replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_","")))}S(Is,"snakeToUpperCamel");function bs(t){return t[0].toLowerCase()+t.slice(1,t.length).replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}S(bs,"upperCamelToSnake");function xs(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}S(xs,"slugify");var ir=S(t=>t.startsWith("0x")?t.slice(2):t,"trimHexIndicator");function At(t){return new TextEncoder().encode(t).length}S(At,"utf8Size");function Ps(t){return At(JSON.stringify(t))}S(Ps,"serializedSize");function ws(t){let e=unescape(encodeURIComponent(t)),s=new Uint8Array(e.length);for(let a=0;a<e.length;a++)s[a]=e.charCodeAt(a);return s}S(ws,"stringToUtf8ByteArray");function Rs(t){return t.split("_").map(e=>H(e)).join(" ")}S(Rs,"capitalizeAndRemoveUnderscores");function Ns(t){return t.split("-").map(e=>H(e)).join(" ")}S(Ns,"capitalizeAndRemoveDashes");function Os(t){if(typeof t!="string")return t;let e=t;for(;;)try{let s=JSON.parse(e);if(typeof s=="string")e=s;else return s}catch{return e}}S(Os,"multiParse");function js(t,e=1){let s=["gmail.com","hotmail.com","outlook.com","live.com"],[a,r]=t.split("@"),[n,o]=r.split("."),i,d;return a.length<=3?i="*".repeat(a.length):i=a.length<=e?a:a[0]+"*".repeat(a.length-e-1)+a.slice(-e),s.includes(`${n}.${o}`)?d=`${n}.${o}`:d=`${n.length>1?n[0]+"*".repeat(n.length-2)+n.slice(-1):n}.${o}`,`${i}@${d}`}S(js,"obfuscateEmail");function ks(t){return t.includes("*")}S(ks,"isObfuscated");function Ls(t){return t===null?!1:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t||"")}S(Ls,"isEmail");function Ds(...t){for(let e of t)if(!K(e))return e;throw new Error("All values are empty")}S(Ds,"getFirstNonEmpty");function $s(t){return t.endsWith(".")?t.slice(0,-1):t}S($s,"removeTrailingDecimal");var Ms={admin:{index:"/console/admin",quickstarts:{index:"/console/admin/quickstarts",new:"/console/admin/quickstarts/new",edit:c(t=>`/console/admin/quickstarts/${t}`,"edit")}},billing:{index:"/console/billing",subscribe:c((t,e)=>{let s=new URLSearchParams({projectId:t});return e!=null&&s.append("product",e),`/alpha/console/billing/subscribe?${s.toString()}`},"subscribe"),planDetails:"/console/billing/plan-details"},overview:{index:"/console/overview"},subscriptions:{index:"/console/subscriptions"},orders:{index:"/console/orders",orderDetails:c(t=>`/console/orders/${t}`,"orderDetails")},createAccount:"/console/create-account",onboarding:"/console/onboarding",collections:{index:"/console/collections",create:"/console/create-collection",dashboard:c(t=>`/console/collections/${t}/dashboard`,"dashboard"),details:c(t=>`/console/collections/${t}/details`,"details"),branding:c(t=>`/console/collections/${t}/branding`,"branding"),contract:c(t=>`/console/collections/${t}/contract`,"contract"),payments:c(t=>`/console/collections/${t}/payments`,"payments"),orders:c(t=>`/console/collections/${t}/orders`,"orders"),orderDetails:c((t,e)=>`/console/collections/${t}/orders/${e}`,"orderDetails"),payouts:{index:c((t,e)=>`/console/collections/${t}/payouts${e!=null?`?topology=${e}`:""}`,"index"),details:c((t,e,s="collections")=>`/console/collections/${t}/payouts/${e}?topology=${s}`,"details"),scheduled:c((t,e,s="collections")=>`/console/collections/${t}/payouts/scheduled/${e}?topology=${s}`,"scheduled")},claimsStorefront:c(t=>`/console/collections/${t}/claims-storefront`,"claimsStorefront"),registeredNfts:c(t=>`/console/collections/${t}/registered/nfts`,"registeredNfts"),createdNfts:c(t=>`/console/collections/${t}/created/nfts`,"createdNfts")},wallets:{index:"/console/wallets",address:c((t,e)=>`/console/wallets/${t}?${e}`,"address")},prepay:{create:c(t=>`/console/collections/create-prepay/${t}`,"create"),details:c(t=>`/console/collections/prepay/${t}/details`,"details"),update:c(t=>`/console/collections/prepay/${t}/update`,"update")},projects:{index:"/console/projects",addMember:"/console/projects/addMember",apiKeys:{index:"/console/projects/apiKeys",edit:c((t,e)=>`/console/projects/${t}/APIKeys/Create?apiKeyId=${e}`,"edit")},projectId:c(t=>`/console/projects/${t}`,"projectId"),withId:c(t=>`/console/projects/${t}`,"withId"),branding:c(t=>`/console/projects/${t}/branding`,"branding"),settings:c(t=>`/console/projects/${t}/settings`,"settings"),walletsSettings:c(t=>`/console/projects/${t}/settings/wallets`,"walletsSettings")},webhooks:{index:"/console/webhooks"},domains:{index:"/console/domains"},account:{index:"/console/account"},mintingApi:{index:"/console/minting-api"},authorizeDevice:{index:c(t=>`/console/authorize-device?${new URLSearchParams(t).toString()}`,"index"),success:"/console/authorize-device/success"}};function Ze(t,e){return e?`${t}?clientId=${e}`:t}c(Ze,"appendClientId");var cr={console:{collections:{new:{chooseAction:c(t=>Ze("/alpha/console/collections/new/choose-action",t),"chooseAction"),details:c((t,e=Tt.COLLECTIONS)=>`/alpha/console/collections/new/details?${new URLSearchParams({topology:e,...K(t)?{}:{clientId:t}}).toString()}`,"details"),registerCollection:c(t=>Ze("/alpha/console/collections/new/register-collection",t),"registerCollection"),smartContract:c(t=>Ze("/alpha/console/collections/new/smart-contract",t),"smartContract"),subscription:"/alpha/console/collections/new/subscription"}}}},lr={admin:{godmode:{info:c(t=>`/api/admin/godmode/info?userId=${t}`,"info"),relatedEntities:c(t=>`/api/admin/godmode/related-entities?identifier=${t}`,"relatedEntities"),impersonate:c((t,e)=>`/api/admin/godmode/impersonate?entityId=${t}&type=${e}`,"impersonate"),gatherInfo:c((t,e)=>`/api/admin/godmode/gather-info/${t}/${e}`,"gatherInfo"),enterpriseData:c(t=>`/api/admin/godmode/enterprise-data?identifier=${t}`,"enterpriseData")}},auth:{callback:{email:"/api/auth/callback/email"}},internal:{transfer:{confirmation:"/api/internal/transfer/confirmation"},transaction:{confirmation:"/api/internal/transaction/confirmation"}},"v1-alpha1":{wallets:{transaction:{getViewInfo:c(t=>`/api/v1-alpha1/wallets/transaction/getViewInfo/${t}`,"getViewInfo")},nfts:c(t=>`api/v1-alpha1/wallets/${t}/nfts`,"nfts"),getViewInfo:c(t=>`api/v1-alpha1/wallets/transfers/getViewInfo/${t}`,"getViewInfo")},collections:{index:"/api/v1-alpha1/collections",mints:c((t,e,s)=>`/api/v1-alpha1/collections/${t}/mints?projectId=${e}${s?`&cursor=${s}`:""}`,"mints")},minting:{collections:{nfts:c((t,e)=>`/api/v1-alpha1/minting/collections/${t}/nfts?projectId=${e}`,"nfts")}},project:{branding:c(t=>`/api/v1-alpha1/projects/${t}/branding`,"branding"),usage:c((t,e,s)=>`/api/v1-alpha1/projects/${t}/usage?dimension=${e}&startDate=${s}`,"usage"),walletsCreated:c(t=>`/api/v1-alpha1/projects/${t}/wallets-created`,"walletsCreated")}},blockchain:{price:c(t=>`/api/blockchain/${t}/price`,"price")},console:{billing:{details:c(t=>`/api/billing/${t}`,"details"),addPaymentMethodUrl:c(t=>`/api/billing/addPaymentInfoUrl/${t}`,"addPaymentMethodUrl"),getCurrentBalance:c(t=>`/api/billing/${t}/balance`,"getCurrentBalance"),paymentMethods:c(t=>`/api/billing/${t}/paymentMethods`,"paymentMethods")},collections:{index:c(t=>`/api/collections?projectId=${t}`,"index"),indexPaginated:c((t,e,s,a,r=!1)=>`/api/v1-alpha1/collections?${new URLSearchParams({projectId:t,topology:e,page:s.toString(),perPage:a.toString(),hideDrafts:r?"true":"false"})}`,"indexPaginated"),byClientId:c((t,e)=>`/api/console/collections/${t}?projectId=${e}`,"byClientId"),requestVerification:c((t,e)=>`/api/console/collections/${t}/request-verification?projectId=${e}`,"requestVerification"),mintableTemplates:c((t,e,s,a=20)=>`/api/console/collections/${t}/templates/mintable?projectId=${e}&page=${s}&perPage=${a}`,"mintableTemplates"),templateSupply:c((t,e)=>`/api/console/collections/${t}/templates/supply?projectId=${e}`,"templateSupply"),payments:{parameters:c((t,e)=>`/api/console/collections/${t}/payments/parameters?projectId=${e}`,"parameters")},orders:{stats:c((t,e)=>`/api/collections/${t}/orders/stats?projectId=${e}`,"stats"),index:c((t,e,s)=>{let a=new URLSearchParams({projectId:e,...s});return`/api/collections/${t}/orders?${a}`},"index"),order:c((t,e,s)=>`/api/collections/${t}/orders/${s}?projectId=${e}`,"order")},claimsStorefront:c((t,e)=>`/api/console/collections/${t}/claims-storefront?projectId=${e}`,"claimsStorefront"),register:{evm:{contract:{getInfo:c((t,e)=>`/api/console/collections/register/evm/contract/${t}/get-info?chain=${e}`,"getInfo")},getThirdwebParams:c((t,e)=>`/api/console/collections/register/evm/contract/get-thirdweb-params?projectId=${t}&clientId=${e}`,"getThirdwebParams")}},batchUpload:c((t,e,s)=>`/api/console/collections/${t}/batchUpload?projectId=${e}&batchIdentifier=${s}`,"batchUpload"),batchUploadStatus:c((t,e,s,a)=>`/api/console/collections/${t}/batchUpload?projectId=${e}&batchIdentifier=${s}&workflowId=${a}`,"batchUploadStatus")},getProject:c(t=>`/api/console/projects?projectId=${t}`,"getProject"),projects:{index:`/api/${Ms.projects.index}`,exportCsv:c((t,e)=>`/api/export-csv?projectId=${t}&clientId=${e}`,"exportCsv"),apiKeys:c((t,e)=>`/api/console/projects/${t}/apiKeys${K(e)?"":`?keyId=${e}`}`,"apiKeys"),webhook:c(t=>`/api/console/projects/${t}/webhook`,"webhook"),members:"/api/console/projects/members",billing:{paymentMethods:c(t=>`/api/console/projects/${t}/billing/paymentMethods`,"paymentMethods"),balance:c(t=>`/api/console/projects/${t}/billing/balance`,"balance"),subscription:c(t=>`/api/console/projects/${t}/billing/subscription`,"subscription"),subscriptionCosts:c((t,e)=>`/api/console/projects/${t}/billing/subscriptionCosts?subscriptionId=${e}`,"subscriptionCosts"),pricing:c(t=>`/api/console/projects/${t}/billing/pricing`,"pricing"),apiActionEnabled:c((t,e,s)=>`/api/console/projects/${t}/billing/apiActionEnabled?apiAction=${e}&chain=${s}`,"apiActionEnabled"),subscriptionPaymentStatus:c((t,e)=>`/api/console/projects/${t}/billing/subscriptionPaymentStatus?subscriptionIds=${e.join(",")}`,"subscriptionPaymentStatus"),usage:c(t=>`/api/console/projects/${t}/billing/usage`,"usage"),autoRecharge:c(t=>`/api/console/projects/${t}/billing/autoRecharge`,"autoRecharge"),redeemCoupon:c(t=>`/api/console/projects/${t}/billing/redeemCoupon`,"redeemCoupon"),payments:c(t=>`/api/console/projects/${t}/billing/payments`,"payments"),topupStatus:c((t,e)=>`/api/console/projects/${t}/billing/topupStatus?requestId=${e}`,"topupStatus"),billingInformation:c(t=>`/api/console/projects/${t}/billing/billingInformation`,"billingInformation")},privacyPolicy:c(t=>`/api/console/project/${t}/privacy-policy`,"privacyPolicy")},webhook:{index:c(t=>`/api/console/webhook?projectId=${t}`,"index"),attempts:c(t=>`/api/console/webhook/attempts?projectId=${t}`,"attempts"),svix:{appPortal:"/api/console/webhook/svix/app-portal"}},domains:{createUpdateDelete:c((t,e)=>`/api/v1-alpha1/projects/${t}/domains/${e}`,"createUpdateDelete")},accesslist:{discordInfo:c((t,e)=>`/api/console/collections/${t}/accesslists/discord?projectId=${e}`,"discordInfo"),validateTwitter:c((t,e,s)=>`/api/console/collections/${t}/accesslists/twitter?username=${s}&projectId=${e}`,"validateTwitter"),accesslists:c((t,e)=>`/api/console/collections/${t}/accesslists?projectId=${e}`,"accesslists")},developerAccount:{get:c(t=>`/api/console/developer-account?projectId=${t}`,"get")},mintingApi:{hasMinted:c(t=>`/api/console/minting-api/hasMinted?projectId=${t}`,"hasMinted")},payments:{hostedSalesPage:{index:c((t,e)=>`/api/console/collections/${t}/payments/hostedSalesPage?projectId=${e}`,"index")},enable:c((t,e)=>`/api/console/collections/${t}/payments/enable?projectId=${e}`,"enable")},branding:c((t,e)=>`/api/console/collections/${t}/branding?projectId=${e}`,"branding"),registerContract:c((t,e)=>`/api/console/collections/${t}/register-contract?projectId=${e}`,"registerContract"),dashboard:{revenue:c((t,e,s,a,r)=>`/api/console/collections/${t}/dashboard/revenue/?projectId=${e}&after=${s}&before=${a}&periodInMS=${r}`,"revenue"),sales:c((t,e,s,a)=>`/api/console/collections/${t}/dashboard/sales/?projectId=${e}&after=${s}&before=${a}`,"sales")},contactSales:{upgradePlanSubmission:c(t=>`/api/console/contact-sales/upgrade-plan-submission?projectId=${t}`,"upgradePlanSubmission")}},developerAccount:"/api/developeraccount",contactSales:{upgradePlanSubmission:c(t=>`/api/console/contact-sales/upgrade-plan-submission?projectId=${t}`,"upgradePlanSubmission")},crossmint:{user:{discord:{index:"/api/crossmint/user/discord"}}},projects:"/api/projects",verification:{otp:c((t,e,s)=>`/api/verifyOTP?${new URLSearchParams({exportId:t,otp:e,uuid:s}).toString()}`,"otp"),getStatusByEntityId:c(t=>`/api/verification/${t}/status`,"getStatusByEntityId"),getCollectionStatus:c((t,e)=>`/api/verification/${t}/collectionStatus?projectId=${e}`,"getCollectionStatus")},prepays:{details:c(t=>`/api/prepays/${t}`,"details")},hostedSalesPage:{mintStatus:c(({clientId:t,isConsole:e,quantity:s,projectId:a,currency:r,price:n})=>`/api/collections/drop/mintStatus?clientId=${t}&quantity=${s}&currency=${r}&price=${n}&isConsole=${e}${a?`&projectId=${a}`:""}`,"mintStatus"),index:c(t=>`/api/collections/drop?slug=${t}`,"index"),context:c(t=>`/api/collections/drop/context?slug=${t}`,"context")},claim:{index:"/api/collections/claim",context:c(t=>`/api/collections/claim/context?slug=${t}`,"context"),pageStatus:c(({clientId:t,projectId:e})=>`/api/collections/claim/pageStatus?clientId=${t}&projectId=${e}`,"pageStatus"),supply:c(({clientId:t,projectId:e})=>`/api/collections/claim/supply?clientId=${t}&projectId=${e}`,"supply"),status:c(({clientId:t,projectId:e,requestId:s})=>`/api/collections/claim/status?clientId=${t}&projectId=${e}&requestId=${s}`,"status")},walletConnect:{signMessage:"/api/walletConnect"},transactions:{nft:c(t=>`/api/transactions/${t}/nft`,"nft")},"2023-06-09":{crossmint:{connect:c((t,{forceWalletSelection:e,projectId:s,showAAWallets:a})=>{let r=e?"&forceWalletSelection=true":"",n=s?`&projectId=${s}`:"";return`/api/2023-06-09/crossmint/connect?chain=${t}${r}${n}${a?"&showAAWallets=true":""}`},"connect")}},"2022-06-09":{minting:{collections:{index:c(t=>`/api/2022-06-09/minting/collections?projectId=${t}`,"index"),collectionId:c((t,e)=>`/api/2022-06-09/minting/collections/${t}${e?`?projectId=${e}`:""}`,"collectionId"),templates:c((t,e)=>`/api/2022-06-09/minting/collections/${t}/templates?projectId=${e}`,"templates"),nfts:c((t,e)=>`/api/2022-06-09/minting/collections/${t}/nfts?projectId=${e}`,"nfts"),template:c((t,e,s)=>`/api/2022-06-09/minting/collections/${t}/templates/${e}?projectId=${s}`,"template")}},wallets:{index:c(t=>`/api/2022-06-09/wallets?projectId=${t}`,"index")}},wallets:{get(t,e,s,a){return`/api/unstable/wallets?${new URLSearchParams({projectId:t,page:e.toString(),perPage:s.toString(),...a})}`},index:c(t=>`/api/v1-alpha1/wallets?projectId=${t}`,"index")},services:{aws:{s3:{presignedPutObject:c((t,e,s,a)=>`/api/services/aws/s3/presignedPutObject?${new URLSearchParams({clientId:t,projectId:s,batchIdentifier:e,bucketName:a}).toString()}`,"presignedPutObject")}}}},dr={referralProgramAgreement:"/legal/referral-program-agreement",contentPolicy:"/content-policy",termsOfService:"/legal/terms-of-service",msa:"/master-services-agreement",privacyPolicy:"/legal/privacy-policy"},pr={claim:c(t=>`/collections/${t}/claim`,"claim")},ur={getSession:"/api/session",signOut:"/api/session/signout",oauthSessionAuthenticate:"/api/session/authenticate",authenticate:"/api/session/authenticate",oauthSessionAuthenticateAuthSDK:"/api/2024-09-26/session/sdk/auth/authenticate",stytchGetOrCreateUser:"/api/sdk/auth/user/get-or-create",exchangeAccessToken:"/api/session/exchange-access-token"},mr={support:"https://help.crossmint.com/hc/en-us/requests/new",collectionVerificationFAQ:"https://help.crossmint.com/hc/en-us/articles/17367432791053-Crossmint-Collection-Review",sales:"/contact/sales",index:"/contact"},fr={contract:c(t=>`/claim/contract/${t}`,"contract")},hr={index:"https://docs.crossmint.com",changelog:{index:"https://docs.crossmint.com/changelog",article:c(t=>`https://docs.crossmint.com/changelog/${t}`,"article")},payments:{index:"https://docs.crossmint.com/payments/introduction"}},gr={index:"/cli-signin",success:"/cli-signin/success"},x={cliSignin:gr,console:Ms,api:lr,alpha:cr,legal:dr,collection:pr,authentication:ur,notFound:"/404",contact:mr,claim:fr,docs:hr,pricing:"/pricing"};import Us from"os";var Vs=St().version,Fs="@crossmint/cli";function _r(){let t=Us.platform(),e=Us.arch(),s=process.version;return`${Fs} ${Vs} (${t} ${e}) Node.js/${s} (production)`}function Er(){return{"user-agent":_r(),"x-client-name":Fs,"x-client-version":Vs}}async function N(t,e=R.GET,s){let a=await Mt(),r=await D();a||(console.error("\u274C Session not found, please run crossmint login"),process.exit(1)),r||(console.error("\u274C Environment not found, please run crossmint login"),process.exit(1));let n=`${se(r)}${t}`;return He(n,e,s,{Cookie:`sessionToken=${a}`})}async function Ws(t,e=R.GET,s){let a=await D();a||(console.error("\u274C Environment not found"),process.exit(1));let r=`${se(a)}${t}`;return He(r,e,s)}async function He(t,e=R.GET,s,a){let r={method:e,headers:{"Content-Type":"application/json",...Er(),...a}};s&&(r.body=JSON.stringify(s));let n=await fetch(t,r);if(n.status>=400){let o=await n.json();throw new Error(`${o.message}`)}return await n.json()}import{select as Tr}from"@inquirer/prompts";l();import{createSpinner as vr}from"nanospinner";function L(t){let e=vr(t),s={start:a=>(e.start({text:a}),s),succeed:a=>(e.success({text:a}),s),fail:a=>(e.error({text:a}),s)};return s}async function we(){let t=L("Fetching projects...").start();try{let e=await N(x.api.projects);if(!e||e.length===0)return t.fail("No projects found. Create a new project using `crossmint project create`"),process.exit(0);if(t.succeed("Fetched projects"),e.length===1){let a=e[0];return console.log(`You only have one project: ${a.name}`),console.log("To create another project, run `crossmint project create`"),await Re(a.id),console.log(`\u2705 Project ${a.name} selected`),process.exit(0)}let s=await Tr({message:"Select a project:",choices:e.map(a=>({name:a.name,value:a,description:a.description}))});await Re(s.id),console.log(`\u2705 Project ${s.name} selected`),process.exit(0)}catch{t.fail("Failed to fetch projects"),process.exit(1)}}import Cr from"open";l();import Gs from"crypto";async function Bs(){let e=Gs.randomBytes(32).toString("base64url"),a=Gs.createHash("sha256").update(e).digest().toString("base64url");return await Ee("pkceCodeVerifier",e),a}async function Zs(){return await ve("pkceCodeVerifier")}l();import Ar from"http";l();async function Ke(){let t=await D();return t||(console.error("\u274C Environment not found"),process.exit(1)),t==="local"?{uri:"test.stytch.com",projectId:"project-test-8eb55d3d-949f-4e0f-aea6-c9ba740f7813",clientId:"connected-app-test-4d27d6d8-3491-45c8-9bb0-b05f89cb7a1a"}:t==="staging"?{uri:"api.stytch.com",projectId:"project-live-b7c564af-0c0d-4662-bfc0-72bed1049cfe",clientId:"connected-app-live-47cd5bf1-c155-42c1-9f36-5d35853b34a7"}:{uri:"api.stytch.com",projectId:"project-live-7a1cb98d-b8b7-4471-aaf6-f8af67a0df94",clientId:"connected-app-live-a72edd7e-6ff3-4002-a13a-e7ca66354bd1"}}async function Ct(t){return new Promise((e,s)=>{let a=Ar.createServer(async(n,o)=>{try{let d=new URL(n.url||"",`http://${n.headers.host}`).searchParams.get("code");if(!d){o.writeHead(400,{"Content-Type":"text/plain"}),o.end("No code provided");return}let u=await Ke(),g=await He(`https://${u.uri}/v1/public/${u.projectId}/oauth2/token`,R.POST,{grant_type:"authorization_code",code:d,client_id:u.clientId,redirect_uri:"http://127.0.0.1:3456/callback",code_verifier:await Zs()}),I=await Ws(x.authentication.exchangeAccessToken,R.POST,{accessToken:g.access_token});await $t(I.sessionToken),o.writeHead(302,{Location:`${se(t)}${x.console.authorizeDevice.success}`}),o.end(),a.close(),e(g)}catch(i){o.writeHead(500,{"Content-Type":"text/plain"}),o.end("Error during authentication"),a.close(),s(i)}});a.listen(3456)})}var Ir=!1;async function It(){try{console.log("\u{1F510} Crossmint CLI - Login");let t=await Sr({message:"Select environment:",choices:[{name:"Production",value:"production"},{name:"Staging",value:"staging"},...Ir?[{name:"Local",value:"local"}]:[]]}),e=se(t);e||(console.error(`Error: No URL found for ${t} environment`),process.exit(1)),await Lt(t);let s=Ct(t),{clientId:a}=await Ke(),n={code_challenge:await Bs(),code_challenge_method:"S256",scope:"full_access",response_type:"code",grant_type:"authorization_code",redirect_uri:"http://127.0.0.1:3456/callback",client_id:a},o=`${e}${x.console.authorizeDevice.index(n)}`;console.log("Opening browser for authentication..."),Cr(o),await s,console.log(`\u2705 Login successful! You are now authenticated in the ${t} environment.`),await we()}catch{console.error("\u274C Login failed, please try again."),process.exit(1)}}l();l();async function te(t){return(await N(x.api.projects)).find(a=>a.id===t)}async function bt(){let t=await D(),e=await U(),s=await te(e||""),a=await N(x.authentication.getSession);console.log(`You are logged in to \u{1F340}Crossmint as: ${a.user.email} - Environment: ${H(t)} - ${s?`Project: ${s.name}`:"No project selected"}`),process.exit(0)}l();async function xt(){await Ut(),await Dt(),await Vt(),console.log("Logged out"),process.exit(0)}l();l();import{confirm as br,input as xr}from"@inquirer/prompts";async function ze(t={}){let e=L();try{let s=t.name;s||(s=await xr({message:"Enter project name:",validate:o=>o.length>0||"Project name is required"})),e.start(`\u{1F680} Creating project "${s}" with Smart Wallets...`);let a=await N(x.api.console.projects.index,R.POST,{name:s,walletType:"smart_wallet",storageProvider:"ipfs",projectThumbnail:""}),r=JSON.parse(a);e.succeed(`\u2705 Project created successfully!
3
3
 
4
4
  `),console.log(`\u{1F4CC} Project Details:
5
5
  Name: ${s}
6
6
  ID: ${r.kableClientId}
7
- `),await Er({message:"Do you want to select this project?"})&&(await Re(r._id),console.log(`\u2705Project '${s}' selected`)),process.exit(0)}catch(s){e.fail(`\u274C Failed to create project: ${s instanceof Error?s.message:"Unknown error"}`),process.exit(1)}}l();async function Ye(){let t=await U();t||(console.error("No project selected. Please select a project first using `crossmint project select`"),process.exit(1));let e=L("Fetching project details...").start();try{let s=await te(t);s||(e.fail("Project not found"),process.exit(1)),e.succeed("Fetched project details"),console.log(`
8
- \u{1F4CC} Project Details:`),console.log(`Name: ${s.name}`),console.log(`ID: ${s.kableClientId}`),console.log(`Wallet Type: ${s.addons.nonCustodialWallets?"Smart":"Custodial"}`),process.exit(0)}catch(s){e.fail("Failed to fetch project details"),console.error("Error:",s instanceof Error?s.message:"Unknown error"),process.exit(1)}}l();l();import{select as Gs,checkbox as jr}from"@inquirer/prompts";l();import{Separator as Rr}from"@inquirer/prompts";l();l();l();l();var xt={WALLET_CREATE:"wallets.create",WALLET_READ:"wallets.read",WALLET_NFT_READ:"wallets:nfts.read",WALLET_BALANCE_READ:"wallets:balance.read",WALLET_TRANSACTION_CREATE:"wallets:transactions.create",WALLET_TRANSACTION_SIGN:"wallets:transactions.sign",WALLET_TRANSACTION_READ:"wallets:transactions.read",WALLET_SIGNATURES_CREATE:"wallets:signatures.create",WALLET_SIGNATURES_READ:"wallets:signatures.read",CREDENTIALS_READ:"credentials.read",CREDENTIALS_DECRYPT:"credentials.decrypt",ORDERS_CREATE:"orders.create",WALLET_FUND:"wallets.fund"},Sr={},O={...xt,...Sr};var qe={USERS_CREATE:"users.create",USERS_READ:"users.read"},qi={...O,...qe};l();l();var v={MINTING_API:"minting_api",WALLETS:"wallets_api",PAYMENTS:"payments",PROJECT_API:"project_api",CREDENTIALS_API:"credentials_api",USERS:"users"},Pt={[v.MINTING_API]:"Minting API",[v.WALLETS]:"Wallet API",[v.PAYMENTS]:"Payments",[v.PROJECT_API]:"Project Admin",[v.CREDENTIALS_API]:"Verifiable Credentials",[v.USERS]:"Users"};var Cr=[{value:O.ORDERS_CREATE,title:"Create an order",description:"Create an order for headless checkout.",category:v.PAYMENTS,projectPermission:null,dangerMessage:null}],Je=[{value:O.WALLET_READ,title:"Read wallet",description:"Retrieve all wallets for a user.",category:v.WALLETS,projectPermission:null,dangerMessage:null},{value:O.WALLET_CREATE,title:"Create wallet",description:"Create a wallet for a user.",category:v.WALLETS,projectPermission:null,dangerMessage:null},{value:O.WALLET_TRANSACTION_CREATE,title:"Create Transaction",description:"Create a transaction from a user's wallet.",category:v.WALLETS,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in unauthorized wallet transactions."},{value:O.WALLET_TRANSACTION_SIGN,title:"Sign Transaction",description:"Sign a transaction from a user's wallet.",category:v.WALLETS,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in unauthorized transaction signatures."},{value:O.WALLET_TRANSACTION_READ,title:"Read Transactions",description:"Read transactions from a user's wallet.",category:v.WALLETS,projectPermission:null,dangerMessage:null},{value:O.WALLET_SIGNATURES_CREATE,title:"Create Wallet Signatures",description:"Create a signature for a wallet.",category:v.WALLETS,projectPermission:null,dangerMessage:null},{value:O.WALLET_SIGNATURES_READ,title:"Read Wallet Signatures",description:"Read a signature for a wallet.",category:v.WALLETS,projectPermission:null,dangerMessage:null},{value:O.WALLET_NFT_READ,title:"Get NFTs",description:"Fetch the NFTs owned by a specific wallet address.",category:v.WALLETS,projectPermission:null,dangerMessage:null},{value:O.WALLET_BALANCE_READ,title:"Get wallet balance",description:"Get the balance of a specific wallet address.",category:v.WALLETS,projectPermission:null,dangerMessage:null},{value:O.CREDENTIALS_READ,title:"Get Credentials",description:"Fetch credentials, some endpoints will only work with a server side key.",category:v.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:O.CREDENTIALS_DECRYPT,title:"Decrypt Credentials",description:"Decrypt credentials, mainly used by our client side SDK.",category:v.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:O.WALLET_FUND,title:"Fund Wallet",description:"Send funds to a wallet.",category:v.WALLETS,projectPermission:null,dangerMessage:null},...Cr];var wt=[...Je,{value:qe.USERS_CREATE,title:"Create users",description:"Create users / allow them to sign up",category:v.USERS,projectPermission:null,dangerMessage:null},{value:qe.USERS_READ,title:"Read users",description:"Get profile info for user accounts",category:v.USERS,projectPermission:null,dangerMessage:null}];l();l();var Ir={NFTS_MINT:"nfts.mint"},P={COLLECTIONS_CREATE:"collections.create",COLLECTIONS_UPDATE:"collections.update",COLLECTIONS_READ:"collections.read",NFTS_CREATE:"nfts.create",NFTS_UPDATE:"nfts.update",NFTS_DELETE:"nfts.delete",NFTS_READ:"nfts.read",NFTS_TRANSFER:"nfts.transfer",CREDENTIALS_TEMPLATE_CREATE:"credentials:templates.create",CREDENTIALS_CREATE:"credentials.create",CREDENTIALS_DELETE:"credentials.delete",WALLET_NFT_TRANSFER:"wallets:nfts.transfer",WALLET_MESSAGE_SIGN:"wallets:messages.sign",BILLING_READONLY:"billing.readonly",PROJECTS_USAGE_READ:"projects:usage.read",ORDERS_UPDATE:"orders.update",ORDERS_READ:"orders.read",SUBSCRIPTIONS_UPDATE:"subscriptions.update",SUBSCRIPTIONS_READ:"subscriptions.read",USERS_READ:"users.read",...xt},br={COLLECTIONS_WRITE:"collections.write",ALLOWLIST_WRITE:"allowlist.write",MERKLE_COMPUTE:"allowlist:merkle.compute",VERIFY_ADDRESSES:"allowlist:addresses.verify",ACCESSLIST_WRITE:"accesslist.write",ACCESSLIST_READ:"accesslist.read",WALLET_FROM_EMAIL:"user:wallets.read",WALLET_TRANSACTION_SIGN:"wallets:transactions.sign",WALLET_TRANSACTION_SEND:"wallets:transactions.send",NFT_CHECKOUT:"nfts.checkout"},xr={MARKETPLACES_TOS_ACCEPT:"crossmint:marketplaces:tos.accept",FILEBASE_BUCKET_DELETE:"crossmint:filebase.buckets.delete",GOD:"god"},pc={...P,...br,...xr,...Ir};var Pr=[{value:P.ORDERS_READ,title:"Get order",description:"Get an existing order for headless checkout.",category:v.PAYMENTS,projectPermission:null,dangerMessage:null},{value:P.ORDERS_UPDATE,title:"Update order",description:"Update an existing order for headless checkout.",category:v.PAYMENTS,projectPermission:null,dangerMessage:null}],wr=[{value:P.SUBSCRIPTIONS_UPDATE,title:"Update a subscription",description:"Be able to update and cancel subscriptions",category:v.PAYMENTS,projectPermission:ge.SUBSCRIPTIONS,dangerMessage:null},{value:P.SUBSCRIPTIONS_READ,title:"Retrieve subscription information",description:"Be able to read subscription information",category:v.PAYMENTS,projectPermission:ge.SUBSCRIPTIONS,dangerMessage:null}],Rt=[...Je,{value:P.NFTS_CREATE,title:"Mint NFTs",description:"Mint your NFTs and deliver them to a wallet or to an email address.",category:v.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_UPDATE,title:"Update NFTs",description:"Update a minted NFT's metadata on IPFS (image, description, name...).",category:v.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_READ,title:"Read NFTs",description:"Retrieve all metadata for an NFT.",category:v.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_DELETE,title:"Burn NFTs",description:"Burn a specific NFT within a collection.",category:v.MINTING_API,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in permanent loss of user assets."},{value:P.NFTS_TRANSFER,title:"Transfer NFTs",description:"Transfer an NFT to a different wallet.",category:v.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_CREATE,title:"Create collection",description:"Create a collection of NFTs.",category:v.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_UPDATE,title:"Update collection",description:"Update information for an existing collection (image, name, royalties...).",category:v.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_READ,title:"Read collections",description:"Retrieve the information about a specific collection.",category:v.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_TEMPLATE_CREATE,title:"Create Credentials Templates",description:"Create a template for your credentials.",category:v.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_CREATE,title:"Create Credentials and Types",description:"Issue your credentials and create credential types",category:v.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_DELETE,title:"Revoke Credentials",description:"Revoke a credential issued to a subject.",category:v.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.WALLET_NFT_TRANSFER,title:"Transfer NFTs",description:"Transfer an NFT from a user's wallet.",category:v.WALLETS,projectPermission:ge.WHITELABEL_WALLET_API,dangerMessage:"Sensitive scope: misuse of this scope may result in permanent loss of user assets."},{value:P.WALLET_MESSAGE_SIGN,title:"Sign Messages",description:"Sign a message from a user's wallet.",category:v.WALLETS,projectPermission:null,dangerMessage:null},{value:P.BILLING_READONLY,title:"Get balance",description:"Get balance in credits for a project.",category:v.PROJECT_API,projectPermission:ge.BILLING_API,dangerMessage:null},{value:P.PROJECTS_USAGE_READ,title:"Get usage",description:"Get usage for the different products in a project.",category:v.PROJECT_API,projectPermission:null,dangerMessage:null},{value:P.USERS_READ,title:"Get user",description:"Get user information.",category:v.USERS,projectPermission:null,dangerMessage:null},...wr,...Pr];l();var Nt=["server","client"];function Xe(t,e,s,a=[]){let n=(t==="server"?Rt:wt).reduce((o,i)=>{let{title:d,description:u,value:g,category:I}=i;return o[I]||(o[I]=[]),Nr(i,e,s)||o[I].push({name:`${d} (${g})`,value:g,description:u,checked:a.includes(g)}),o},{});return Object.entries(n).flatMap(([o,i])=>[new Rr(Pt[o]),...i])}function Nr(t,e,s){return e==="production"&&t.projectPermission!=null&&s?.addons!=null&&!s.addons[t.projectPermission]}l();import{input as Ws}from"@inquirer/prompts";function Or(t){try{return new URL(t),!0}catch{return!1}}async function Qe(t,e){let s=[],a=[],r=e?`
9
- Press [tab] to edit or [enter] to confirm current value`:"";if(t==="web"){let n=await Ws({default:e?.join(","),message:`Enter whitelisted domain or localhost (e.g., https://www.yourdomain.com) (separate multiple domains with a comma):${r}`,validate:o=>{let i=o.split(",");for(let d of i)if(!Or(d))return`Invalid domain: ${d}. Please enter a valid URL (e.g., https://www.yourdomain.com)`;return!0}});s.push(...n.split(",").map(o=>o.trim()))}else if(t==="mobile"){let n=await Ws({default:e?.join(","),message:`Enter iOS bundle ID or Android package name (e.g., com.company.appname) (separate multiple domains with a comma):${r}`,validate:o=>{let i=o.split(",");for(let d of i)if(d.trim().length===0)return"App identifier cannot be empty";return!0}});a.push(...n.split(",").map(o=>o.trim()))}return{whitelistedOrigins:s,whitelistedAppIdentifiers:a}}async function et(){let t=await D(),e=await U();t||(console.error("There is no environment selected, please first run `crossmint login`"),process.exit(1)),e||(console.error("There is no project selected, please first run `crossmint project select`"),process.exit(1));let s=L("Creating key...");try{let a=await Gs({message:"Select Key Usage:",choices:[{name:"Server side",value:"server"},{name:"Client side",value:"client"}]}),r,n,o;a==="client"&&(r=await Gs({message:"Select client platform:",choices:[{name:"Web",value:"web"},{name:"Mobile",value:"mobile"}]}),{whitelistedOrigins:n,whitelistedAppIdentifiers:o}=await Qe(r));let i=await te(e);i||(console.error("\u274C Project not found, please run `crossmint project select`"),process.exit(1));let d=Xe(a,t,i),u=await jr({message:`Select scopes for ${a} key:`,choices:d,validate:Le=>Le.length===0?"At least one scope must be selected":!0}),g={usageOrigin:a,scopes:u};a==="client"&&(g.whitelistedOrigins=n,g.whitelistedAppIdentifiers=o),s.start();let I=await R(x.api.console.projects.apiKeys(e),w.POST,g);s.succeed("\u2705 API Key created successfully!"),console.log("Key ID:",I.apiKey._id),console.log("\u{1F512} Key Secret:",I.apiKey.clientSecret),a==="server"&&t==="production"&&console.log("Please save these credentials securely. The key secret will not be shown again."),process.exit(0)}catch(a){s.fail(`\u274C Failed to create key: ${a instanceof Error?a.message:"Unknown error"}`),process.exit(1)}}l();l();import{spawn as kr}from"child_process";var tt=class{output="";pager;constructor(){this.pager=kr("less",["-R"],{stdio:["pipe","inherit","inherit"]}),this.pager.on("exit",e=>{console.log(this.output),process.exit(e??0)})}add(e){this.output+=e}shouldUsePager(){let e=process.stdout.rows;return this.output.split(`
10
- `).length>e}write(){this.shouldUsePager()?(this.pager.stdin?.write(this.output),this.pager.stdin?.end()):this.pager.kill()}};import st from"chalk";async function at(t){let e=await D(),s=await U();s||(console.error("There is no project selected, please first run `crossmint project select`"),process.exit(1)),t&&!Nt.includes(t)&&(console.error("Invalid key type. Please use 'server' or 'client'."),process.exit(1));let a=L("Fetching API keys...");try{a.start();let r=await R(x.api.console.projects.apiKeys(s)),n=t?r.filter(d=>d.usageOrigin===t):r;if(n.length===0)return a.succeed("\u{1F50D} No API keys found for this project. To create a new API key, run `crossmint keys create`"),process.exit(0);a.succeed("\u{1F4CC} List of API Keys:");let o=new tt,i=st.bold.magenta("=========");n.forEach((d,u)=>{o.add(`
7
+ `),await br({message:"Do you want to select this project?"})&&(await Re(r._id),console.log(`\u2705Project '${s}' selected`)),process.exit(0)}catch(s){e.fail(`\u274C Failed to create project: ${s instanceof Error?s.message:"Unknown error"}`),process.exit(1)}}l();async function Ye(){let t=await U();t||(console.error("No project selected. Please select a project first using `crossmint project select`"),process.exit(1));let e=L("Fetching project details...").start();try{let s=await te(t);s||(e.fail("Project not found"),process.exit(1)),e.succeed("Fetched project details"),console.log(`
8
+ \u{1F4CC} Project Details:`),console.log(`Name: ${s.name}`),console.log(`ID: ${s.kableClientId}`),console.log(`Wallet Type: ${s.addons.nonCustodialWallets?"Smart":"Custodial"}`),process.exit(0)}catch(s){e.fail("Failed to fetch project details"),console.error("Error:",s instanceof Error?s.message:"Unknown error"),process.exit(1)}}l();l();import{select as Ks,checkbox as Vr}from"@inquirer/prompts";l();import{Separator as $r}from"@inquirer/prompts";l();l();l();l();var Pt={WALLET_CREATE:"wallets.create",WALLET_READ:"wallets.read",WALLET_NFT_READ:"wallets:nfts.read",WALLET_BALANCE_READ:"wallets:balance.read",WALLET_TRANSACTION_CREATE:"wallets:transactions.create",WALLET_TRANSACTION_SIGN:"wallets:transactions.sign",WALLET_TRANSACTION_READ:"wallets:transactions.read",WALLET_SIGNATURES_CREATE:"wallets:signatures.create",WALLET_SIGNATURES_READ:"wallets:signatures.read",CREDENTIALS_READ:"credentials.read",CREDENTIALS_DECRYPT:"credentials.decrypt",ORDERS_CREATE:"orders.create",ORDERS_WS_CREATE:"orders.ws.create",ORDERS_WS_SEARCH:"orders.ws.search",WALLET_FUND:"wallets.fund"},wr={},w={...Pt,...wr};var Rr={NFTS_MINT:"nfts.mint"},P={COLLECTIONS_CREATE:"collections.create",COLLECTIONS_UPDATE:"collections.update",COLLECTIONS_READ:"collections.read",NFTS_CREATE:"nfts.create",NFTS_UPDATE:"nfts.update",NFTS_DELETE:"nfts.delete",NFTS_READ:"nfts.read",NFTS_TRANSFER:"nfts.transfer",CREDENTIALS_TEMPLATE_CREATE:"credentials:templates.create",CREDENTIALS_CREATE:"credentials.create",CREDENTIALS_DELETE:"credentials.delete",WALLET_NFT_TRANSFER:"wallets:nfts.transfer",WALLET_MESSAGE_SIGN:"wallets:messages.sign",BILLING_READONLY:"billing.readonly",PROJECTS_USAGE_READ:"projects:usage.read",ORDERS_UPDATE:"orders.update",ORDERS_READ:"orders.read",SUBSCRIPTIONS_UPDATE:"subscriptions.update",SUBSCRIPTIONS_READ:"subscriptions.read",USERS_READ:"users.read",...Pt},Nr={COLLECTIONS_WRITE:"collections.write",ALLOWLIST_WRITE:"allowlist.write",MERKLE_COMPUTE:"allowlist:merkle.compute",VERIFY_ADDRESSES:"allowlist:addresses.verify",ACCESSLIST_WRITE:"accesslist.write",ACCESSLIST_READ:"accesslist.read",WALLET_FROM_EMAIL:"user:wallets.read",WALLET_TRANSACTION_SIGN:"wallets:transactions.sign",WALLET_TRANSACTION_SEND:"wallets:transactions.send",NFT_CHECKOUT:"nfts.checkout"},Or={MARKETPLACES_TOS_ACCEPT:"crossmint:marketplaces:tos.accept",FILEBASE_BUCKET_DELETE:"crossmint:filebase.buckets.delete",GOD:"god"},rc={...P,...Nr,...Or,...Rr};l();l();var E={MINTING_API:"minting_api",WALLETS:"wallets_api",PAYMENTS:"payments",PROJECT_API:"project_api",CREDENTIALS_API:"credentials_api",USERS:"users"},wt={[E.MINTING_API]:"Minting API",[E.WALLETS]:"Wallet API",[E.PAYMENTS]:"Payments",[E.PROJECT_API]:"Project Admin",[E.CREDENTIALS_API]:"Verifiable Credentials",[E.USERS]:"Users"};var jr=[{value:w.ORDERS_CREATE,title:"Create an order",description:"Create an order for headless checkout.",category:E.PAYMENTS,projectPermission:null,dangerMessage:null}],kr=[{value:w.ORDERS_WS_CREATE,title:"Create worldstore order",description:"Create an order for a Worldstore listing.",category:E.PAYMENTS,projectPermission:null,dangerMessage:null},{value:w.ORDERS_WS_SEARCH,title:"Search worldstore listings",description:"Search Worldstore listings.",category:E.PAYMENTS,projectPermission:null,dangerMessage:null}],qe=[{value:w.WALLET_READ,title:"Read wallet",description:"Retrieve all wallets for a user.",category:E.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_CREATE,title:"Create wallet",description:"Create a wallet for a user.",category:E.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_TRANSACTION_CREATE,title:"Create Transaction",description:"Create a transaction from a user's wallet.",category:E.WALLETS,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in unauthorized wallet transactions."},{value:w.WALLET_TRANSACTION_SIGN,title:"Sign Transaction",description:"Sign a transaction from a user's wallet.",category:E.WALLETS,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in unauthorized transaction signatures."},{value:w.WALLET_TRANSACTION_READ,title:"Read Transactions",description:"Read transactions from a user's wallet.",category:E.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_SIGNATURES_CREATE,title:"Create Wallet Signatures",description:"Create a signature for a wallet.",category:E.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_SIGNATURES_READ,title:"Read Wallet Signatures",description:"Read a signature for a wallet.",category:E.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_NFT_READ,title:"Get NFTs",description:"Fetch the NFTs owned by a specific wallet address.",category:E.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_BALANCE_READ,title:"Get wallet balance",description:"Get the balance of a specific wallet address.",category:E.WALLETS,projectPermission:null,dangerMessage:null},{value:w.CREDENTIALS_READ,title:"Get Credentials",description:"Fetch credentials, some endpoints will only work with a server side key.",category:E.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:w.CREDENTIALS_DECRYPT,title:"Decrypt Credentials",description:"Decrypt credentials, mainly used by our client side SDK.",category:E.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:w.WALLET_FUND,title:"Fund Wallet",description:"Send funds to a wallet.",category:E.WALLETS,projectPermission:null,dangerMessage:null},...jr,...kr];var Lr=[{value:P.ORDERS_READ,title:"Get order",description:"Get an existing order for headless checkout.",category:E.PAYMENTS,projectPermission:null,dangerMessage:null},{value:P.ORDERS_UPDATE,title:"Update order",description:"Update an existing order for headless checkout.",category:E.PAYMENTS,projectPermission:null,dangerMessage:null}],Dr=[{value:P.SUBSCRIPTIONS_UPDATE,title:"Update a subscription",description:"Be able to update and cancel subscriptions",category:E.PAYMENTS,projectPermission:ge.SUBSCRIPTIONS,dangerMessage:null},{value:P.SUBSCRIPTIONS_READ,title:"Retrieve subscription information",description:"Be able to read subscription information",category:E.PAYMENTS,projectPermission:ge.SUBSCRIPTIONS,dangerMessage:null}],Rt=[...qe,{value:P.NFTS_CREATE,title:"Mint NFTs",description:"Mint your NFTs and deliver them to a wallet or to an email address.",category:E.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_UPDATE,title:"Update NFTs",description:"Update a minted NFT's metadata on IPFS (image, description, name...).",category:E.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_READ,title:"Read NFTs",description:"Retrieve all metadata for an NFT.",category:E.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_DELETE,title:"Burn NFTs",description:"Burn a specific NFT within a collection.",category:E.MINTING_API,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in permanent loss of user assets."},{value:P.NFTS_TRANSFER,title:"Transfer NFTs",description:"Transfer an NFT to a different wallet.",category:E.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_CREATE,title:"Create collection",description:"Create a collection of NFTs.",category:E.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_UPDATE,title:"Update collection",description:"Update information for an existing collection (image, name, royalties...).",category:E.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_READ,title:"Read collections",description:"Retrieve the information about a specific collection.",category:E.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_TEMPLATE_CREATE,title:"Create Credentials Templates",description:"Create a template for your credentials.",category:E.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_CREATE,title:"Create Credentials and Types",description:"Issue your credentials and create credential types",category:E.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_DELETE,title:"Revoke Credentials",description:"Revoke a credential issued to a subject.",category:E.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.WALLET_NFT_TRANSFER,title:"Transfer NFTs",description:"Transfer an NFT from a user's wallet.",category:E.WALLETS,projectPermission:ge.WHITELABEL_WALLET_API,dangerMessage:"Sensitive scope: misuse of this scope may result in permanent loss of user assets."},{value:P.WALLET_MESSAGE_SIGN,title:"Sign Messages",description:"Sign a message from a user's wallet.",category:E.WALLETS,projectPermission:null,dangerMessage:null},{value:P.BILLING_READONLY,title:"Get balance",description:"Get balance in credits for a project.",category:E.PROJECT_API,projectPermission:ge.BILLING_API,dangerMessage:null},{value:P.PROJECTS_USAGE_READ,title:"Get usage",description:"Get usage for the different products in a project.",category:E.PROJECT_API,projectPermission:null,dangerMessage:null},{value:P.USERS_READ,title:"Get user",description:"Get user information.",category:E.USERS,projectPermission:null,dangerMessage:null},...Dr,...Lr];l();l();var Je={USERS_CREATE:"users.create",USERS_READ:"users.read"},vc={...w,...Je};var Nt=[...qe,{value:Je.USERS_CREATE,title:"Create users",description:"Create users / allow them to sign up",category:E.USERS,projectPermission:null,dangerMessage:null},{value:Je.USERS_READ,title:"Read users",description:"Get profile info for user accounts",category:E.USERS,projectPermission:null,dangerMessage:null}];l();var Ot=["server","client"];function Xe(t,e,s,a=[]){let n=(t==="server"?Rt:Nt).reduce((o,i)=>{let{title:d,description:u,value:g,category:I}=i;return o[I]||(o[I]=[]),Mr(i,e,s)||o[I].push({name:`${d} (${g})`,value:g,description:u,checked:a.includes(g)}),o},{});return Object.entries(n).flatMap(([o,i])=>[new $r(wt[o]),...i])}function Mr(t,e,s){return e==="production"&&t.projectPermission!=null&&s?.addons!=null&&!s.addons[t.projectPermission]}l();import{input as Hs}from"@inquirer/prompts";function Ur(t){try{return new URL(t),!0}catch{return!1}}async function Qe(t,e){let s=[],a=[],r=e?`
9
+ Press [tab] to edit or [enter] to confirm current value`:"";if(t==="web"){let n=await Hs({default:e?.join(","),message:`Enter whitelisted domain or localhost (e.g., https://www.yourdomain.com) (separate multiple domains with a comma):${r}`,validate:o=>{let i=o.split(",");for(let d of i)if(!Ur(d))return`Invalid domain: ${d}. Please enter a valid URL (e.g., https://www.yourdomain.com)`;return!0}});s.push(...n.split(",").map(o=>o.trim()))}else if(t==="mobile"){let n=await Hs({default:e?.join(","),message:`Enter iOS bundle ID or Android package name (e.g., com.company.appname) (separate multiple domains with a comma):${r}`,validate:o=>{let i=o.split(",");for(let d of i)if(d.trim().length===0)return"App identifier cannot be empty";return!0}});a.push(...n.split(",").map(o=>o.trim()))}return{whitelistedOrigins:s,whitelistedAppIdentifiers:a}}async function et(){let t=await D(),e=await U();t||(console.error("There is no environment selected, please first run `crossmint login`"),process.exit(1)),e||(console.error("There is no project selected, please first run `crossmint project select`"),process.exit(1));let s=L("Creating key...");try{let a=await Ks({message:"Select Key Usage:",choices:[{name:"Server side",value:"server"},{name:"Client side",value:"client"}]}),r,n,o;a==="client"&&(r=await Ks({message:"Select client platform:",choices:[{name:"Web",value:"web"},{name:"Mobile",value:"mobile"}]}),{whitelistedOrigins:n,whitelistedAppIdentifiers:o}=await Qe(r));let i=await te(e);i||(console.error("\u274C Project not found, please run `crossmint project select`"),process.exit(1));let d=Xe(a,t,i),u=await Vr({message:`Select scopes for ${a} key:`,choices:d,validate:Le=>Le.length===0?"At least one scope must be selected":!0}),g={usageOrigin:a,scopes:u};a==="client"&&(g.whitelistedOrigins=n,g.whitelistedAppIdentifiers=o),s.start();let I=await N(x.api.console.projects.apiKeys(e),R.POST,g);s.succeed("\u2705 API Key created successfully!"),console.log("Key ID:",I.apiKey._id),console.log("\u{1F512} Key Secret:",I.apiKey.clientSecret),a==="server"&&t==="production"&&console.log("Please save these credentials securely. The key secret will not be shown again."),process.exit(0)}catch(a){s.fail(`\u274C Failed to create key: ${a instanceof Error?a.message:"Unknown error"}`),process.exit(1)}}l();l();import{spawn as Fr}from"child_process";var tt=class{output="";pager;constructor(){this.pager=Fr("less",["-R"],{stdio:["pipe","inherit","inherit"]}),this.pager.on("exit",e=>{console.log(this.output),process.exit(e??0)})}add(e){this.output+=e}shouldUsePager(){let e=process.stdout.rows;return this.output.split(`
10
+ `).length>e}write(){this.shouldUsePager()?(this.pager.stdin?.write(this.output),this.pager.stdin?.end()):this.pager.kill()}};import st from"chalk";async function at(t){let e=await D(),s=await U();s||(console.error("There is no project selected, please first run `crossmint project select`"),process.exit(1)),t&&!Ot.includes(t)&&(console.error("Invalid key type. Please use 'server' or 'client'."),process.exit(1));let a=L("Fetching API keys...");try{a.start();let r=await N(x.api.console.projects.apiKeys(s)),n=t?r.filter(d=>d.usageOrigin===t):r;if(n.length===0)return a.succeed("\u{1F50D} No API keys found for this project. To create a new API key, run `crossmint keys create`"),process.exit(0);a.succeed("\u{1F4CC} List of API Keys:");let o=new tt,i=st.bold.magenta("=========");n.forEach((d,u)=>{o.add(`
11
11
  ${i}
12
12
 
13
13
  `),o.add(`${st.bold(`${u+1}. Key ID:`)} ${d._id}
@@ -15,4 +15,4 @@ ${i}
15
15
 
16
16
  `);let I=[["Type",H(d.usageOrigin)],["Created By",d.createdBy],["Created",d.createdAt?new Date(d.createdAt).toLocaleString():void 0],["Scopes",d.scopes.join(", ")]];d.usageOrigin==="client"&&(d.whitelistedOrigins.length>0&&I.push(["Whitelisted Origins",d.whitelistedOrigins.join(", ")]),d.whitelistedAppIdentifiers&&d.whitelistedAppIdentifiers.length>0&&I.push(["Whitelisted App IDs",d.whitelistedAppIdentifiers.join(", ")])),I.forEach(([Le,_e])=>{_e!==void 0&&o.add(`${st.cyan(Le.padEnd(20))} ${_e}
17
17
  `)})}),o.add(`
18
- ${i}`),o.write()}catch(r){a.fail(`\u274C Failed to fetch keys: ${r instanceof Error?r.message:"Unknown error"}`),process.exit(1)}}l();import{confirm as Lr}from"@inquirer/prompts";async function rt(t){let e=await U();e||(console.error("There is no project selected, please first run `crossmint project select`"),process.exit(1));let s=L("Deleting API key...");try{await Lr({message:"Are you sure you want to delete this API key? This action cannot be undone.",default:!1})||(s.fail("Operation cancelled"),process.exit(0)),s.start(),await R(x.api.console.projects.apiKeys(e,t),w.DELETE),s.succeed("\u2705 API key deleted successfully!")}catch(a){s.fail(`\u274C Failed to delete API key: ${a instanceof Error?a.message:"Unknown error"}`),process.exit(1)}}l();import{checkbox as Dr}from"@inquirer/prompts";async function nt(t){let e=await D();e||(console.error("There is no environment selected, please first run `crossmint login`"),process.exit(1));let s=await U();s||(console.error("There is no project selected, please first run `crossmint project select`"),process.exit(1));let a=L("Fetching API key...");try{a.start();let n=(await R(x.api.console.projects.apiKeys(s))).find(I=>I._id.toString()===t);n||(a.fail("API key not found"),process.exit(1));let o,i;n.usageOrigin==="client"&&(a.succeed("\u{1F4CC} Current API Key Whitelisted Origins:"),{whitelistedOrigins:o,whitelistedAppIdentifiers:i}=await Qe(n.whitelistedOrigins?.length>0?"web":"mobile",n.whitelistedOrigins?.length>0?n.whitelistedOrigins:n.whitelistedAppIdentifiers)),a.succeed("\u{1F4CC} Current API Key Scopes:");let d=await te(s);d||(console.error("\u274C Project not found, please run `crossmint project select`"),process.exit(1));let u=Xe(n.usageOrigin,e,d,n.scopes),g=await Dr({message:`Select scopes for ${n.usageOrigin} key:`,choices:u,validate:I=>I.length===0?"At least one scope must be selected":!0});if($r(n,g)||Mr(n,o,i)){a.start("Updating API key scopes...");let I={apiKeyId:t,...n,scopes:g};n.usageOrigin==="client"&&(I.whitelistedOrigins=o,I.whitelistedAppIdentifiers=i),await R(x.api.console.projects.apiKeys(s),w.PUT,I)}a.succeed("\u2705 API key scopes updated successfully!")}catch(r){a.fail(`\u274C Failed to update API key: ${r instanceof Error?r.message:"Unknown error"}`),process.exit(1)}}function $r(t,e){return t.scopes.some(s=>!e.includes(s))||e.some(s=>!t.scopes.includes(s))}function Mr(t,e,s){return t.usageOrigin==="client"&&(t.whitelistedOrigins?.some(a=>!e?.includes(a))||e?.some(a=>!t.whitelistedOrigins?.includes(a))||t.whitelistedAppIdentifiers?.some(a=>!s?.includes(a))||s?.some(a=>!t.whitelistedAppIdentifiers?.includes(a)))}ye.name("crossmint").description("Crossmint CLI Tool").version(Bs().version);var ot=ye.command("keys").description("API Keys management commands");ot.command("create").description("Create a new API Key").action(et);ot.command("delete <key-id>").description("Delete an API Key").action(rt);ot.command("edit <key-id>").description("Edit the scopes of an API Key").action(nt);ot.command("list [type]").description("List all API Keys (optionally filter by type: server|client)").action(at);ye.command("login").description("Login to Crossmint").action(Ct);ye.command("logout").description("Logout from Crossmint").action(bt);var Ot=ye.command("projects").description("Project management commands");Ot.command("create").description("Create a new project").action(ze).option("-n, --name <name>","Project name");Ot.command("details").description("Show project details").action(Ye);Ot.command("select").description("Select a project").action(we);ye.command("whoami").description("Show current user and environment").action(It);ye.parse(process.argv);
18
+ ${i}`),o.write()}catch(r){a.fail(`\u274C Failed to fetch keys: ${r instanceof Error?r.message:"Unknown error"}`),process.exit(1)}}l();import{confirm as Wr}from"@inquirer/prompts";async function rt(t){let e=await U();e||(console.error("There is no project selected, please first run `crossmint project select`"),process.exit(1));let s=L("Deleting API key...");try{await Wr({message:"Are you sure you want to delete this API key? This action cannot be undone.",default:!1})||(s.fail("Operation cancelled"),process.exit(0)),s.start(),await N(x.api.console.projects.apiKeys(e,t),R.DELETE),s.succeed("\u2705 API key deleted successfully!")}catch(a){s.fail(`\u274C Failed to delete API key: ${a instanceof Error?a.message:"Unknown error"}`),process.exit(1)}}l();import{checkbox as Gr}from"@inquirer/prompts";async function nt(t){let e=await D();e||(console.error("There is no environment selected, please first run `crossmint login`"),process.exit(1));let s=await U();s||(console.error("There is no project selected, please first run `crossmint project select`"),process.exit(1));let a=L("Fetching API key...");try{a.start();let n=(await N(x.api.console.projects.apiKeys(s))).find(I=>I._id.toString()===t);n||(a.fail("API key not found"),process.exit(1));let o,i;n.usageOrigin==="client"&&(a.succeed("\u{1F4CC} Current API Key Whitelisted Origins:"),{whitelistedOrigins:o,whitelistedAppIdentifiers:i}=await Qe(n.whitelistedOrigins?.length>0?"web":"mobile",n.whitelistedOrigins?.length>0?n.whitelistedOrigins:n.whitelistedAppIdentifiers)),a.succeed("\u{1F4CC} Current API Key Scopes:");let d=await te(s);d||(console.error("\u274C Project not found, please run `crossmint project select`"),process.exit(1));let u=Xe(n.usageOrigin,e,d,n.scopes),g=await Gr({message:`Select scopes for ${n.usageOrigin} key:`,choices:u,validate:I=>I.length===0?"At least one scope must be selected":!0});if(Br(n,g)||Zr(n,o,i)){a.start("Updating API key scopes...");let I={apiKeyId:t,...n,scopes:g};n.usageOrigin==="client"&&(I.whitelistedOrigins=o,I.whitelistedAppIdentifiers=i),await N(x.api.console.projects.apiKeys(s),R.PUT,I)}a.succeed("\u2705 API key scopes updated successfully!")}catch(r){a.fail(`\u274C Failed to update API key: ${r instanceof Error?r.message:"Unknown error"}`),process.exit(1)}}function Br(t,e){return t.scopes.some(s=>!e.includes(s))||e.some(s=>!t.scopes.includes(s))}function Zr(t,e,s){return t.usageOrigin==="client"&&(t.whitelistedOrigins?.some(a=>!e?.includes(a))||e?.some(a=>!t.whitelistedOrigins?.includes(a))||t.whitelistedAppIdentifiers?.some(a=>!s?.includes(a))||s?.some(a=>!t.whitelistedAppIdentifiers?.includes(a)))}ye.name("crossmint").description("Crossmint CLI Tool").version(St().version);var ot=ye.command("keys").description("API Keys management commands");ot.command("create").description("Create a new API Key").action(et);ot.command("delete <key-id>").description("Delete an API Key").action(rt);ot.command("edit <key-id>").description("Edit the scopes of an API Key").action(nt);ot.command("list [type]").description("List all API Keys (optionally filter by type: server|client)").action(at);ye.command("login").description("Login to Crossmint").action(It);ye.command("logout").description("Logout from Crossmint").action(xt);var jt=ye.command("projects").description("Project management commands");jt.command("create").description("Create a new project").action(ze).option("-n, --name <name>","Project name");jt.command("details").description("Show project details").action(Ye);jt.command("select").description("Select a project").action(we);ye.command("whoami").description("Show current user and environment").action(bt);ye.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossmint/cli",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "ISC",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "scripts": {
14
14
  "build": "tsup --env.NODE_ENV production",
15
- "build:pkg": "node ./build-pkg.js",
15
+ "build:pkg": "NODE_ENV=production node ./build-pkg.js",
16
16
  "dev": "tsup --watch --env.NODE_ENV development",
17
17
  "start": "pnpm build && node dist/bin/crossmint.js",
18
18
  "test:vitest": "vitest run",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "20.14.8",
31
- "@yao-pkg/pkg": "6.3.2",
31
+ "@yao-pkg/pkg": "6.5.1",
32
32
  "esbuild": "0.25.2",
33
33
  "vitest": "2.1.9"
34
34
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossmint/cli",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "ISC",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "scripts": {
14
14
  "build": "tsup --env.NODE_ENV production",
15
- "build:pkg": "node ./build-pkg.js",
15
+ "build:pkg": "NODE_ENV=production node ./build-pkg.js",
16
16
  "dev": "tsup --watch --env.NODE_ENV development",
17
17
  "start": "pnpm build && node dist/bin/crossmint.js",
18
18
  "test:vitest": "vitest run",
@@ -36,7 +36,7 @@
36
36
  "@crossmint/tsupconfig": "workspace:*",
37
37
  "@crossmint/vitestconfig": "workspace:*",
38
38
  "@types/node": "20.14.8",
39
- "@yao-pkg/pkg": "6.3.2",
39
+ "@yao-pkg/pkg": "6.5.1",
40
40
  "esbuild": "0.25.2",
41
41
  "vitest": "2.1.9"
42
42
  },
@@ -1,6 +1,29 @@
1
1
  import { HttpMethods } from "@crossmint/common-consts";
2
2
  import { getSessionToken, getEnvironment } from "./store";
3
3
  import { getCrossmintUrl } from "./urls";
4
+ import os from "os";
5
+
6
+ // CLI identification constants
7
+ const CLI_VERSION = require("../../package.json").version;
8
+ const CLI_NAME = "@crossmint/cli";
9
+
10
+ // Generate CLI User-Agent string
11
+ function getCLIUserAgent(): string {
12
+ const platform = os.platform();
13
+ const arch = os.arch();
14
+ const nodeVersion = process.version;
15
+ const nodeEnv = process.env.NODE_ENV;
16
+ return `${CLI_NAME} ${CLI_VERSION} (${platform} ${arch}) Node.js/${nodeVersion} (${nodeEnv})`;
17
+ }
18
+
19
+ // Common headers for CLI requests
20
+ function getCLIHeaders(): Record<string, string> {
21
+ return {
22
+ "user-agent": getCLIUserAgent(),
23
+ "x-client-name": CLI_NAME,
24
+ "x-client-version": CLI_VERSION,
25
+ };
26
+ }
4
27
 
5
28
  export async function fetchAuthenticated(path: string, method: HttpMethods = HttpMethods.GET, body?: any) {
6
29
  const sessionToken = await getSessionToken();
@@ -44,6 +67,7 @@ export async function fetchJSON(
44
67
  method,
45
68
  headers: {
46
69
  "Content-Type": "application/json",
70
+ ...getCLIHeaders(),
47
71
  ...headers,
48
72
  },
49
73
  };