@telia-ace/alliance-cli 1.1.1-next.0 → 1.1.2-next.0

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.
@@ -1,8 +1,8 @@
1
1
  import { createRequire as c__createRequire } from 'node:module';
2
2
  const require = c__createRequire(import.meta.url);
3
- import{h as O,i as Ae,l as I}from"./chunk-AEIX73UA.js";import{existsSync as $,readFileSync as tt}from"node:fs";import{relative as Ce,resolve as M}from"node:path";var b;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{let a={};for(let i of s)a[i]=i;return a},r.getValidEnumValues=s=>{let a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(let o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(let i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(b||(b={}));var Ee;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ee||(Ee={}));var u=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=r=>{switch(typeof r){case"undefined":return u.undefined;case"string":return u.string;case"number":return isNaN(r)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(r)?u.array:r===null?u.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?u.promise:typeof Map<"u"&&r instanceof Map?u.map:typeof Set<"u"&&r instanceof Set?u.set:typeof Date<"u"&&r instanceof Date?u.date:u.object;default:return u.unknown}},c=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"]),nt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),T=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,f=0;for(;f<i.path.length;){let d=i.path[f];f===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],f++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};T.create=r=>new T(r);var le=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===u.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,b.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:b.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(r)}return{message:t}},De=le;function st(r){De=r}function ye(){return De}var ve=r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a},o="",f=n.filter(d=>!!d).slice().reverse();for(let d of f)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},at=[];function l(r,e){let t=ve({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ye(),le].filter(n=>!!n)});r.common.issues.push(t)}var x=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return m;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t)n.push({key:await s.key,value:await s.value});return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}},m=Object.freeze({status:"aborted"}),ze=r=>({status:"dirty",value:r}),w=r=>({status:"valid",value:r}),je=r=>r.status==="aborted",Oe=r=>r.status==="dirty",fe=r=>r.status==="valid",_e=r=>typeof Promise<"u"&&r instanceof Promise,p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}));var A=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}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}},Le=(r,e)=>{if(fe(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new T(r.common.issues);return this._error=t,this._error}}};function g(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:t??o.defaultError},description:s}}var y=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 L(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new x,ctx:{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(_e(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Le(s,a)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(_e(s)?s:Promise.resolve(s));return Le(n,a)}refine(e,t){let n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{let i=e(s),o=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new C({schema:this,typeName:h.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return S.create(this,this._def)}nullable(){return Z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return P.create(this,this._def)}promise(){return z.create(this,this._def)}or(e){return H.create([this,e],this._def)}and(e){return Y.create(this,e,this._def)}transform(e){return new C({...g(this._def),schema:this,typeName:h.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ee({...g(this._def),innerType:this,defaultValue:t,typeName:h.ZodDefault})}brand(){return new ke({typeName:h.ZodBranded,type:this,...g(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new ce({...g(this._def),innerType:this,catchValue:t,typeName:h.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return pe.create(this,e)}readonly(){return ue.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},it=/^c[^\s-]{8,}$/i,ot=/^[a-z][a-z0-9]*$/,ct=/^[0-9A-HJKMNP-TV-Z]{26}$/,dt=/^[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,ut=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Se,ft=/^(((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}))$/,pt=/^(([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})))$/,ht=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.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$"):r.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 mt(r,e){return!!((e==="v4"||!e)&&ft.test(r)||(e==="v6"||!e)&&pt.test(r))}var V=class r extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.string,received:a.parsedType}),m}let n=new x,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?l(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ut.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Se||(Se=new RegExp(lt,"u")),Se.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")dt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")it.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ot.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ct.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?ht(a).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?mt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,...p.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}datetime(e){var t;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:(t=e?.offset)!==null&&t!==void 0?t:!1,...p.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...p.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get 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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};V.create=r=>{var e;return new V({checks:[],typeName:h.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};function gt(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}var U=class r extends y{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)!==u.number){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.number,received:a.parsedType}),m}let n,s=new x;for(let a of this._def.checks)a.kind==="int"?b.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?gt(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_finite,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};U.create=r=>new U({checks:[],typeName:h.ZodNumber,coerce:r?.coerce||!1,...g(r)});var B=class r extends y{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)!==u.bigint){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.bigint,received:a.parsedType}),m}let n,s=new x;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};B.create=r=>{var e;return new B({checks:[],typeName:h.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};var W=class extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.boolean,received:n.parsedType}),m}return w(e.data)}};W.create=r=>new W({typeName:h.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var q=class r extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.date,received:a.parsedType}),m}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),m}let n=new x,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):b.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};q.create=r=>new q({checks:[],coerce:r?.coerce||!1,typeName:h.ZodDate,...g(r)});var se=class extends y{_parse(e){if(this._getType(e)!==u.symbol){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.symbol,received:n.parsedType}),m}return w(e.data)}};se.create=r=>new se({typeName:h.ZodSymbol,...g(r)});var J=class extends y{_parse(e){if(this._getType(e)!==u.undefined){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.undefined,received:n.parsedType}),m}return w(e.data)}};J.create=r=>new J({typeName:h.ZodUndefined,...g(r)});var F=class extends y{_parse(e){if(this._getType(e)!==u.null){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.null,received:n.parsedType}),m}return w(e.data)}};F.create=r=>new F({typeName:h.ZodNull,...g(r)});var D=class extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};D.create=r=>new D({typeName:h.ZodAny,...g(r)});var R=class extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};R.create=r=>new R({typeName:h.ZodUnknown,...g(r)});var E=class extends y{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:u.never,received:t.parsedType}),m}};E.create=r=>new E({typeName:h.ZodNever,...g(r)});var ae=class extends y{_parse(e){if(this._getType(e)!==u.undefined){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.void,received:n.parsedType}),m}return w(e.data)}};ae.create=r=>new ae({typeName:h.ZodVoid,...g(r)});var P=class r extends y{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==u.array)return l(t,{code:c.invalid_type,expected:u.array,received:t.parsedType}),m;if(s.exactLength!==null){let i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(l(t,{code:i?c.too_big:c.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(l(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(l(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new A(t,i,t.path,o)))).then(i=>x.mergeArray(n,i));let a=[...t.data].map((i,o)=>s.type._parseSync(new A(t,i,t.path,o)));return x.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}};P.create=(r,e)=>new P({type:r,minLength:null,maxLength:null,exactLength:null,typeName:h.ZodArray,...g(e)});function ne(r){if(r instanceof k){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=S.create(ne(n))}return new k({...r._def,shape:()=>e})}else return r instanceof P?new P({...r._def,type:ne(r.element)}):r instanceof S?S.create(ne(r.unwrap())):r instanceof Z?Z.create(ne(r.unwrap())):r instanceof j?j.create(r.items.map(e=>ne(e))):r}var k=class r extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==u.object){let d=this._getOrReturnCtx(e);return l(d,{code:c.invalid_type,expected:u.object,received:d.parsedType}),m}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof E&&this._def.unknownKeys==="strip"))for(let d in s.data)i.includes(d)||o.push(d);let f=[];for(let d of i){let _=a[d],N=s.data[d];f.push({key:{status:"valid",value:d},value:_._parse(new A(s,N,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof E){let d=this._def.unknownKeys;if(d==="passthrough")for(let _ of o)f.push({key:{status:"valid",value:_},value:{status:"valid",value:s.data[_]}});else if(d==="strict")o.length>0&&(l(s,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let _ of o){let N=s.data[_];f.push({key:{status:"valid",value:_},value:d._parse(new A(s,N,s.path,_)),alwaysSet:_ in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let _ of f){let N=await _.key;d.push({key:N,value:await _.value,alwaysSet:_.alwaysSet})}return d}).then(d=>x.mergeObjectSync(n,d)):x.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;let f=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=p.errToObj(e).message)!==null&&o!==void 0?o:f}:{message:f}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:h.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return b.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return b.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}deepPartial(){return ne(this)}partial(e){let t={};return b.objectKeys(this.shape).forEach(n=>{let s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return b.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof S;)a=a._def.innerType;t[n]=a}}),new r({...this._def,shape:()=>t})}keyof(){return Ue(b.objectKeys(this.shape))}};k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:E.create(),typeName:h.ZodObject,...g(e)});k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:E.create(),typeName:h.ZodObject,...g(e)});k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:E.create(),typeName:h.ZodObject,...g(e)});var H=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new T(o.ctx.common.issues));return l(t,{code:c.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(n.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a,i=[];for(let f of n){let d={...t,common:{...t.common,issues:[]},parent:null},_=f._parseSync({data:t.data,path:t.path,parent:d});if(_.status==="valid")return _;_.status==="dirty"&&!a&&(a={result:_,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(f=>new T(f));return l(t,{code:c.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}};H.create=(r,e)=>new H({options:r,typeName:h.ZodUnion,...g(e)});var ge=r=>r instanceof G?ge(r.schema):r instanceof C?ge(r.innerType()):r instanceof K?[r.value]:r instanceof X?r.options:r instanceof Q?Object.keys(r.enum):r instanceof ee?ge(r._def.innerType):r instanceof J?[void 0]:r instanceof F?[null]:null,be=class r extends y{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.object)return l(t,{code:c.invalid_type,expected:u.object,received:t.parsedType}),m;let n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let a of t){let i=ge(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new r({typeName:h.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...g(n)})}};function Ie(r,e){let t=L(r),n=L(e);if(r===e)return{valid:!0,data:r};if(t===u.object&&n===u.object){let s=b.objectKeys(e),a=b.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(let o of a){let f=Ie(r[o],e[o]);if(!f.valid)return{valid:!1};i[o]=f.data}return{valid:!0,data:i}}else if(t===u.array&&n===u.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],f=Ie(i,o);if(!f.valid)return{valid:!1};s.push(f.data)}return{valid:!0,data:s}}else return t===u.date&&n===u.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Y=class extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(je(a)||je(i))return m;let o=Ie(a.value,i.value);return o.valid?((Oe(a)||Oe(i))&&t.dirty(),{status:t.value,value:o.data}):(l(n,{code:c.invalid_intersection_types}),m)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Y.create=(r,e,t)=>new Y({left:r,right:e,typeName:h.ZodIntersection,...g(t)});var j=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.array)return l(n,{code:c.invalid_type,expected:u.array,received:n.parsedType}),m;if(n.data.length<this._def.items.length)return l(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...n.data].map((i,o)=>{let f=this._def.items[o]||this._def.rest;return f?f._parse(new A(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>x.mergeArray(t,i)):x.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};j.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new j({items:r,typeName:h.ZodTuple,rest:null,...g(e)})};var xe=class r extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.object)return l(n,{code:c.invalid_type,expected:u.object,received:n.parsedType}),m;let s=[],a=this._def.keyType,i=this._def.valueType;for(let o in n.data)s.push({key:a._parse(new A(n,o,n.path,o)),value:i._parse(new A(n,n.data[o],n.path,o))});return n.common.async?x.mergeObjectAsync(t,s):x.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof y?new r({keyType:e,valueType:t,typeName:h.ZodRecord,...g(n)}):new r({keyType:V.create(),valueType:e,typeName:h.ZodRecord,...g(t)})}},ie=class extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.map)return l(n,{code:c.invalid_type,expected:u.map,received:n.parsedType}),m;let s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,f],d)=>({key:s._parse(new A(n,o,n.path,[d,"key"])),value:a._parse(new A(n,f,n.path,[d,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let f of i){let d=await f.key,_=await f.value;if(d.status==="aborted"||_.status==="aborted")return m;(d.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(d.value,_.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let f of i){let d=f.key,_=f.value;if(d.status==="aborted"||_.status==="aborted")return m;(d.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(d.value,_.value)}return{status:t.value,value:o}}}};ie.create=(r,e,t)=>new ie({valueType:e,keyType:r,typeName:h.ZodMap,...g(t)});var oe=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.set)return l(n,{code:c.invalid_type,expected:u.set,received:n.parsedType}),m;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(l(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(l(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let a=this._def.valueType;function i(f){let d=new Set;for(let _ of f){if(_.status==="aborted")return m;_.status==="dirty"&&t.dirty(),d.add(_.value)}return{status:t.value,value:d}}let o=[...n.data.values()].map((f,d)=>a._parse(new A(n,f,n.path,d)));return n.common.async?Promise.all(o).then(f=>i(f)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};oe.create=(r,e)=>new oe({valueType:r,minSize:null,maxSize:null,typeName:h.ZodSet,...g(e)});var we=class r extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.function)return l(t,{code:c.invalid_type,expected:u.function,received:t.parsedType}),m;function n(o,f){return ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ye(),le].filter(d=>!!d),issueData:{code:c.invalid_arguments,argumentsError:f}})}function s(o,f){return ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ye(),le].filter(d=>!!d),issueData:{code:c.invalid_return_type,returnTypeError:f}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof z){let o=this;return w(async function(...f){let d=new T([]),_=await o._def.args.parseAsync(f,a).catch(Ne=>{throw d.addIssue(n(f,Ne)),d}),N=await Reflect.apply(i,this,_);return await o._def.returns._def.type.parseAsync(N,a).catch(Ne=>{throw d.addIssue(s(N,Ne)),d})})}else{let o=this;return w(function(...f){let d=o._def.args.safeParse(f,a);if(!d.success)throw new T([n(f,d.error)]);let _=Reflect.apply(i,this,d.data),N=o._def.returns.safeParse(_,a);if(!N.success)throw new T([s(_,N.error)]);return N.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:j.create(e).rest(R.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||j.create([]).rest(R.create()),returns:t||R.create(),typeName:h.ZodFunction,...g(n)})}},G=class extends y{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};G.create=(r,e)=>new G({getter:r,typeName:h.ZodLazy,...g(e)});var K=class extends y{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};K.create=(r,e)=>new K({value:r,typeName:h.ZodLiteral,...g(e)});function Ue(r,e){return new X({values:r,typeName:h.ZodEnum,...g(e)})}var X=class r extends y{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{expected:b.joinValues(n),received:t.parsedType,code:c.invalid_type}),m}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{received:t.data,code:c.invalid_enum_value,options:n}),m}return w(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return r.create(e)}exclude(e){return r.create(this.options.filter(t=>!e.includes(t)))}};X.create=Ue;var Q=class extends y{_parse(e){let t=b.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==u.string&&n.parsedType!==u.number){let s=b.objectValues(t);return l(n,{expected:b.joinValues(s),received:n.parsedType,code:c.invalid_type}),m}if(t.indexOf(e.data)===-1){let s=b.objectValues(t);return l(n,{received:n.data,code:c.invalid_enum_value,options:s}),m}return w(e.data)}get enum(){return this._def.values}};Q.create=(r,e)=>new Q({values:r,typeName:h.ZodNativeEnum,...g(e)});var z=class extends y{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return l(t,{code:c.invalid_type,expected:u.promise,received:t.parsedType}),m;let n=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return w(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};z.create=(r,e)=>new z({type:r,typeName:h.ZodPromise,...g(e)});var C=class extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===h.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{l(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){let i=o=>{let f=s.refinement(o,a);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!fe(i))return i;let o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>fe(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);b.assertNever(s)}};C.create=(r,e,t)=>new C({schema:r,typeName:h.ZodEffects,effect:e,...g(t)});C.createWithPreprocess=(r,e,t)=>new C({schema:e,effect:{type:"preprocess",transform:r},typeName:h.ZodEffects,...g(t)});var S=class extends y{_parse(e){return this._getType(e)===u.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};S.create=(r,e)=>new S({innerType:r,typeName:h.ZodOptional,...g(e)});var Z=class extends y{_parse(e){return this._getType(e)===u.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z.create=(r,e)=>new Z({innerType:r,typeName:h.ZodNullable,...g(e)});var ee=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===u.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ee.create=(r,e)=>new ee({innerType:r,typeName:h.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var ce=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return _e(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new T(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new T(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ce.create=(r,e)=>new ce({innerType:r,typeName:h.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var de=class extends y{_parse(e){if(this._getType(e)!==u.nan){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.nan,received:n.parsedType}),m}return{status:"valid",value:e.data}}};de.create=r=>new de({typeName:h.ZodNaN,...g(r)});var yt=Symbol("zod_brand"),ke=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},pe=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),ze(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?m:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:h.ZodPipeline})}},ue=class extends y{_parse(e){let t=this._def.innerType._parse(e);return fe(t)&&(t.value=Object.freeze(t.value)),t}};ue.create=(r,e)=>new ue({innerType:r,typeName:h.ZodReadonly,...g(e)});var Be=(r,e={},t)=>r?D.create().superRefine((n,s)=>{var a,i;if(!r(n)){let o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,f=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:f})}}):D.create(),vt={object:k.lazycreate},h;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(h||(h={}));var _t=(r,e={message:`Input not instance of ${r.name}`})=>Be(t=>t instanceof r,e),We=V.create,qe=U.create,bt=de.create,xt=B.create,Je=W.create,wt=q.create,kt=se.create,Tt=J.create,Ct=F.create,Nt=D.create,At=R.create,St=E.create,Et=ae.create,jt=P.create,Ot=k.create,It=k.strictCreate,Rt=H.create,Pt=be.create,Zt=Y.create,$t=j.create,Mt=xe.create,Lt=ie.create,Vt=oe.create,Dt=we.create,zt=G.create,Ut=K.create,Bt=X.create,Wt=Q.create,qt=z.create,Ve=C.create,Jt=S.create,Ft=Z.create,Ht=C.createWithPreprocess,Yt=pe.create,Gt=()=>We().optional(),Kt=()=>qe().optional(),Xt=()=>Je().optional(),Qt={string:r=>V.create({...r,coerce:!0}),number:r=>U.create({...r,coerce:!0}),boolean:r=>W.create({...r,coerce:!0}),bigint:r=>B.create({...r,coerce:!0}),date:r=>q.create({...r,coerce:!0})},er=m,v=Object.freeze({__proto__:null,defaultErrorMap:le,setErrorMap:st,getErrorMap:ye,makeIssue:ve,EMPTY_PATH:at,addIssueToContext:l,ParseStatus:x,INVALID:m,DIRTY:ze,OK:w,isAborted:je,isDirty:Oe,isValid:fe,isAsync:_e,get util(){return b},get objectUtil(){return Ee},ZodParsedType:u,getParsedType:L,ZodType:y,ZodString:V,ZodNumber:U,ZodBigInt:B,ZodBoolean:W,ZodDate:q,ZodSymbol:se,ZodUndefined:J,ZodNull:F,ZodAny:D,ZodUnknown:R,ZodNever:E,ZodVoid:ae,ZodArray:P,ZodObject:k,ZodUnion:H,ZodDiscriminatedUnion:be,ZodIntersection:Y,ZodTuple:j,ZodRecord:xe,ZodMap:ie,ZodSet:oe,ZodFunction:we,ZodLazy:G,ZodLiteral:K,ZodEnum:X,ZodNativeEnum:Q,ZodPromise:z,ZodEffects:C,ZodTransformer:C,ZodOptional:S,ZodNullable:Z,ZodDefault:ee,ZodCatch:ce,ZodNaN:de,BRAND:yt,ZodBranded:ke,ZodPipeline:pe,ZodReadonly:ue,custom:Be,Schema:y,ZodSchema:y,late:vt,get ZodFirstPartyTypeKind(){return h},coerce:Qt,any:Nt,array:jt,bigint:xt,boolean:Je,date:wt,discriminatedUnion:Pt,effect:Ve,enum:Bt,function:Dt,instanceof:_t,intersection:Zt,lazy:zt,literal:Ut,map:Lt,nan:bt,nativeEnum:Wt,never:St,null:Ct,nullable:Ft,number:qe,object:Ot,oboolean:Xt,onumber:Kt,optional:Jt,ostring:Gt,pipeline:Yt,preprocess:Ht,promise:qt,record:Mt,set:Vt,strictObject:It,string:We,symbol:kt,transformer:Ve,tuple:$t,undefined:Tt,union:Rt,unknown:At,void:Et,NEVER:er,ZodIssueCode:c,quotelessJson:nt,ZodError:T});var tr=v.object({}),rr=v.object({alias:v.object({}).passthrough().default({}).describe("Equivalent to `vite.resolve.alias`.\n\nhttps://vitejs.dev/config/shared-options.html#resolve-alias"),plugins:v.any().array().default([]).describe("Equivalent to `vite.plugins`.\n\nhttps://vitejs.dev/config/shared-options.html#plugins")}),nr=v.object({server:v.number().default(3e3).describe("The port that the dev server should use."),gateway:v.number().default(3001).describe("The port that the api gateway should use.")}),sr=v.object({apps:v.string().array().default([]).describe(`Additional apps to include.
3
+ import{h as I,i as Ne,l as R}from"./chunk-AEIX73UA.js";import{existsSync as M,readFileSync as tt}from"node:fs";import{relative as Ce,resolve as L}from"node:path";var b;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{let a={};for(let i of s)a[i]=i;return a},r.getValidEnumValues=s=>{let a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(let o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(let i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(b||(b={}));var Ee;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ee||(Ee={}));var u=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),V=r=>{switch(typeof r){case"undefined":return u.undefined;case"string":return u.string;case"number":return isNaN(r)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(r)?u.array:r===null?u.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?u.promise:typeof Map<"u"&&r instanceof Map?u.map:typeof Set<"u"&&r instanceof Set?u.set:typeof Date<"u"&&r instanceof Date?u.date:u.object;default:return u.unknown}},c=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"]),nt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),T=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,f=0;for(;f<i.path.length;){let d=i.path[f];f===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],f++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};T.create=r=>new T(r);var fe=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===u.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,b.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:b.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(r)}return{message:t}},De=fe;function st(r){De=r}function ve(){return De}var _e=r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a},o="",f=n.filter(d=>!!d).slice().reverse();for(let d of f)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},at=[];function l(r,e){let t=_e({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ve(),fe].filter(n=>!!n)});r.common.issues.push(t)}var x=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return m;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t)n.push({key:await s.key,value:await s.value});return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}},m=Object.freeze({status:"aborted"}),ze=r=>({status:"dirty",value:r}),w=r=>({status:"valid",value:r}),je=r=>r.status==="aborted",Oe=r=>r.status==="dirty",pe=r=>r.status==="valid",be=r=>typeof Promise<"u"&&r instanceof Promise,p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}));var N=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}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}},Le=(r,e)=>{if(pe(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new T(r.common.issues);return this._error=t,this._error}}};function g(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:t??o.defaultError},description:s}}var y=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 V(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new x,ctx:{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(be(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Le(s,a)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(be(s)?s:Promise.resolve(s));return Le(n,a)}refine(e,t){let n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{let i=e(s),o=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new C({schema:this,typeName:h.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return S.create(this,this._def)}nullable(){return $.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Z.create(this,this._def)}promise(){return U.create(this,this._def)}or(e){return G.create([this,e],this._def)}and(e){return K.create(this,e,this._def)}transform(e){return new C({...g(this._def),schema:this,typeName:h.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new re({...g(this._def),innerType:this,defaultValue:t,typeName:h.ZodDefault})}brand(){return new Te({typeName:h.ZodBranded,type:this,...g(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new de({...g(this._def),innerType:this,catchValue:t,typeName:h.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return he.create(this,e)}readonly(){return le.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},it=/^c[^\s-]{8,}$/i,ot=/^[a-z][a-z0-9]*$/,ct=/^[0-9A-HJKMNP-TV-Z]{26}$/,dt=/^[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,ut=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Se,ft=/^(((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}))$/,pt=/^(([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})))$/,ht=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.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$"):r.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 mt(r,e){return!!((e==="v4"||!e)&&ft.test(r)||(e==="v6"||!e)&&pt.test(r))}var D=class r extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.string,received:a.parsedType}),m}let n=new x,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?l(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ut.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Se||(Se=new RegExp(lt,"u")),Se.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")dt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")it.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ot.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ct.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?ht(a).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?mt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,...p.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}datetime(e){var t;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:(t=e?.offset)!==null&&t!==void 0?t:!1,...p.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...p.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get 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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};D.create=r=>{var e;return new D({checks:[],typeName:h.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};function gt(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}var B=class r extends y{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)!==u.number){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.number,received:a.parsedType}),m}let n,s=new x;for(let a of this._def.checks)a.kind==="int"?b.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?gt(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_finite,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};B.create=r=>new B({checks:[],typeName:h.ZodNumber,coerce:r?.coerce||!1,...g(r)});var q=class r extends y{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)!==u.bigint){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.bigint,received:a.parsedType}),m}let n,s=new x;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};q.create=r=>{var e;return new q({checks:[],typeName:h.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};var J=class extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.boolean,received:n.parsedType}),m}return w(e.data)}};J.create=r=>new J({typeName:h.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var F=class r extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.date,received:a.parsedType}),m}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),m}let n=new x,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):b.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};F.create=r=>new F({checks:[],coerce:r?.coerce||!1,typeName:h.ZodDate,...g(r)});var ae=class extends y{_parse(e){if(this._getType(e)!==u.symbol){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.symbol,received:n.parsedType}),m}return w(e.data)}};ae.create=r=>new ae({typeName:h.ZodSymbol,...g(r)});var H=class extends y{_parse(e){if(this._getType(e)!==u.undefined){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.undefined,received:n.parsedType}),m}return w(e.data)}};H.create=r=>new H({typeName:h.ZodUndefined,...g(r)});var Y=class extends y{_parse(e){if(this._getType(e)!==u.null){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.null,received:n.parsedType}),m}return w(e.data)}};Y.create=r=>new Y({typeName:h.ZodNull,...g(r)});var z=class extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};z.create=r=>new z({typeName:h.ZodAny,...g(r)});var P=class extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};P.create=r=>new P({typeName:h.ZodUnknown,...g(r)});var E=class extends y{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:u.never,received:t.parsedType}),m}};E.create=r=>new E({typeName:h.ZodNever,...g(r)});var ie=class extends y{_parse(e){if(this._getType(e)!==u.undefined){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.void,received:n.parsedType}),m}return w(e.data)}};ie.create=r=>new ie({typeName:h.ZodVoid,...g(r)});var Z=class r extends y{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==u.array)return l(t,{code:c.invalid_type,expected:u.array,received:t.parsedType}),m;if(s.exactLength!==null){let i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(l(t,{code:i?c.too_big:c.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(l(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(l(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new N(t,i,t.path,o)))).then(i=>x.mergeArray(n,i));let a=[...t.data].map((i,o)=>s.type._parseSync(new N(t,i,t.path,o)));return x.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}};Z.create=(r,e)=>new Z({type:r,minLength:null,maxLength:null,exactLength:null,typeName:h.ZodArray,...g(e)});function se(r){if(r instanceof k){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=S.create(se(n))}return new k({...r._def,shape:()=>e})}else return r instanceof Z?new Z({...r._def,type:se(r.element)}):r instanceof S?S.create(se(r.unwrap())):r instanceof $?$.create(se(r.unwrap())):r instanceof O?O.create(r.items.map(e=>se(e))):r}var k=class r extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==u.object){let d=this._getOrReturnCtx(e);return l(d,{code:c.invalid_type,expected:u.object,received:d.parsedType}),m}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof E&&this._def.unknownKeys==="strip"))for(let d in s.data)i.includes(d)||o.push(d);let f=[];for(let d of i){let _=a[d],A=s.data[d];f.push({key:{status:"valid",value:d},value:_._parse(new N(s,A,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof E){let d=this._def.unknownKeys;if(d==="passthrough")for(let _ of o)f.push({key:{status:"valid",value:_},value:{status:"valid",value:s.data[_]}});else if(d==="strict")o.length>0&&(l(s,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let _ of o){let A=s.data[_];f.push({key:{status:"valid",value:_},value:d._parse(new N(s,A,s.path,_)),alwaysSet:_ in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let _ of f){let A=await _.key;d.push({key:A,value:await _.value,alwaysSet:_.alwaysSet})}return d}).then(d=>x.mergeObjectSync(n,d)):x.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;let f=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=p.errToObj(e).message)!==null&&o!==void 0?o:f}:{message:f}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:h.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return b.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return b.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}deepPartial(){return se(this)}partial(e){let t={};return b.objectKeys(this.shape).forEach(n=>{let s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return b.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof S;)a=a._def.innerType;t[n]=a}}),new r({...this._def,shape:()=>t})}keyof(){return Ue(b.objectKeys(this.shape))}};k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:E.create(),typeName:h.ZodObject,...g(e)});k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:E.create(),typeName:h.ZodObject,...g(e)});k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:E.create(),typeName:h.ZodObject,...g(e)});var G=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new T(o.ctx.common.issues));return l(t,{code:c.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(n.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a,i=[];for(let f of n){let d={...t,common:{...t.common,issues:[]},parent:null},_=f._parseSync({data:t.data,path:t.path,parent:d});if(_.status==="valid")return _;_.status==="dirty"&&!a&&(a={result:_,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(f=>new T(f));return l(t,{code:c.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}};G.create=(r,e)=>new G({options:r,typeName:h.ZodUnion,...g(e)});var ye=r=>r instanceof X?ye(r.schema):r instanceof C?ye(r.innerType()):r instanceof Q?[r.value]:r instanceof ee?r.options:r instanceof te?Object.keys(r.enum):r instanceof re?ye(r._def.innerType):r instanceof H?[void 0]:r instanceof Y?[null]:null,xe=class r extends y{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.object)return l(t,{code:c.invalid_type,expected:u.object,received:t.parsedType}),m;let n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let a of t){let i=ye(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new r({typeName:h.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...g(n)})}};function Ie(r,e){let t=V(r),n=V(e);if(r===e)return{valid:!0,data:r};if(t===u.object&&n===u.object){let s=b.objectKeys(e),a=b.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(let o of a){let f=Ie(r[o],e[o]);if(!f.valid)return{valid:!1};i[o]=f.data}return{valid:!0,data:i}}else if(t===u.array&&n===u.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],f=Ie(i,o);if(!f.valid)return{valid:!1};s.push(f.data)}return{valid:!0,data:s}}else return t===u.date&&n===u.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var K=class extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(je(a)||je(i))return m;let o=Ie(a.value,i.value);return o.valid?((Oe(a)||Oe(i))&&t.dirty(),{status:t.value,value:o.data}):(l(n,{code:c.invalid_intersection_types}),m)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};K.create=(r,e,t)=>new K({left:r,right:e,typeName:h.ZodIntersection,...g(t)});var O=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.array)return l(n,{code:c.invalid_type,expected:u.array,received:n.parsedType}),m;if(n.data.length<this._def.items.length)return l(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...n.data].map((i,o)=>{let f=this._def.items[o]||this._def.rest;return f?f._parse(new N(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>x.mergeArray(t,i)):x.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};O.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new O({items:r,typeName:h.ZodTuple,rest:null,...g(e)})};var we=class r extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.object)return l(n,{code:c.invalid_type,expected:u.object,received:n.parsedType}),m;let s=[],a=this._def.keyType,i=this._def.valueType;for(let o in n.data)s.push({key:a._parse(new N(n,o,n.path,o)),value:i._parse(new N(n,n.data[o],n.path,o))});return n.common.async?x.mergeObjectAsync(t,s):x.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof y?new r({keyType:e,valueType:t,typeName:h.ZodRecord,...g(n)}):new r({keyType:D.create(),valueType:e,typeName:h.ZodRecord,...g(t)})}},oe=class extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.map)return l(n,{code:c.invalid_type,expected:u.map,received:n.parsedType}),m;let s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,f],d)=>({key:s._parse(new N(n,o,n.path,[d,"key"])),value:a._parse(new N(n,f,n.path,[d,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let f of i){let d=await f.key,_=await f.value;if(d.status==="aborted"||_.status==="aborted")return m;(d.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(d.value,_.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let f of i){let d=f.key,_=f.value;if(d.status==="aborted"||_.status==="aborted")return m;(d.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(d.value,_.value)}return{status:t.value,value:o}}}};oe.create=(r,e,t)=>new oe({valueType:e,keyType:r,typeName:h.ZodMap,...g(t)});var ce=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.set)return l(n,{code:c.invalid_type,expected:u.set,received:n.parsedType}),m;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(l(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(l(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let a=this._def.valueType;function i(f){let d=new Set;for(let _ of f){if(_.status==="aborted")return m;_.status==="dirty"&&t.dirty(),d.add(_.value)}return{status:t.value,value:d}}let o=[...n.data.values()].map((f,d)=>a._parse(new N(n,f,n.path,d)));return n.common.async?Promise.all(o).then(f=>i(f)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ce.create=(r,e)=>new ce({valueType:r,minSize:null,maxSize:null,typeName:h.ZodSet,...g(e)});var ke=class r extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.function)return l(t,{code:c.invalid_type,expected:u.function,received:t.parsedType}),m;function n(o,f){return _e({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ve(),fe].filter(d=>!!d),issueData:{code:c.invalid_arguments,argumentsError:f}})}function s(o,f){return _e({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ve(),fe].filter(d=>!!d),issueData:{code:c.invalid_return_type,returnTypeError:f}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof U){let o=this;return w(async function(...f){let d=new T([]),_=await o._def.args.parseAsync(f,a).catch(Ae=>{throw d.addIssue(n(f,Ae)),d}),A=await Reflect.apply(i,this,_);return await o._def.returns._def.type.parseAsync(A,a).catch(Ae=>{throw d.addIssue(s(A,Ae)),d})})}else{let o=this;return w(function(...f){let d=o._def.args.safeParse(f,a);if(!d.success)throw new T([n(f,d.error)]);let _=Reflect.apply(i,this,d.data),A=o._def.returns.safeParse(_,a);if(!A.success)throw new T([s(_,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:O.create(e).rest(P.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||O.create([]).rest(P.create()),returns:t||P.create(),typeName:h.ZodFunction,...g(n)})}},X=class extends y{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};X.create=(r,e)=>new X({getter:r,typeName:h.ZodLazy,...g(e)});var Q=class extends y{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};Q.create=(r,e)=>new Q({value:r,typeName:h.ZodLiteral,...g(e)});function Ue(r,e){return new ee({values:r,typeName:h.ZodEnum,...g(e)})}var ee=class r extends y{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{expected:b.joinValues(n),received:t.parsedType,code:c.invalid_type}),m}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{received:t.data,code:c.invalid_enum_value,options:n}),m}return w(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return r.create(e)}exclude(e){return r.create(this.options.filter(t=>!e.includes(t)))}};ee.create=Ue;var te=class extends y{_parse(e){let t=b.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==u.string&&n.parsedType!==u.number){let s=b.objectValues(t);return l(n,{expected:b.joinValues(s),received:n.parsedType,code:c.invalid_type}),m}if(t.indexOf(e.data)===-1){let s=b.objectValues(t);return l(n,{received:n.data,code:c.invalid_enum_value,options:s}),m}return w(e.data)}get enum(){return this._def.values}};te.create=(r,e)=>new te({values:r,typeName:h.ZodNativeEnum,...g(e)});var U=class extends y{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return l(t,{code:c.invalid_type,expected:u.promise,received:t.parsedType}),m;let n=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return w(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};U.create=(r,e)=>new U({type:r,typeName:h.ZodPromise,...g(e)});var C=class extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===h.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{l(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){let i=o=>{let f=s.refinement(o,a);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!pe(i))return i;let o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>pe(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);b.assertNever(s)}};C.create=(r,e,t)=>new C({schema:r,typeName:h.ZodEffects,effect:e,...g(t)});C.createWithPreprocess=(r,e,t)=>new C({schema:e,effect:{type:"preprocess",transform:r},typeName:h.ZodEffects,...g(t)});var S=class extends y{_parse(e){return this._getType(e)===u.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};S.create=(r,e)=>new S({innerType:r,typeName:h.ZodOptional,...g(e)});var $=class extends y{_parse(e){return this._getType(e)===u.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$.create=(r,e)=>new $({innerType:r,typeName:h.ZodNullable,...g(e)});var re=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===u.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};re.create=(r,e)=>new re({innerType:r,typeName:h.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var de=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return be(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new T(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new T(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};de.create=(r,e)=>new de({innerType:r,typeName:h.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var ue=class extends y{_parse(e){if(this._getType(e)!==u.nan){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.nan,received:n.parsedType}),m}return{status:"valid",value:e.data}}};ue.create=r=>new ue({typeName:h.ZodNaN,...g(r)});var yt=Symbol("zod_brand"),Te=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},he=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),ze(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?m:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:h.ZodPipeline})}},le=class extends y{_parse(e){let t=this._def.innerType._parse(e);return pe(t)&&(t.value=Object.freeze(t.value)),t}};le.create=(r,e)=>new le({innerType:r,typeName:h.ZodReadonly,...g(e)});var We=(r,e={},t)=>r?z.create().superRefine((n,s)=>{var a,i;if(!r(n)){let o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,f=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:f})}}):z.create(),vt={object:k.lazycreate},h;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(h||(h={}));var _t=(r,e={message:`Input not instance of ${r.name}`})=>We(t=>t instanceof r,e),Be=D.create,qe=B.create,bt=ue.create,xt=q.create,Je=J.create,wt=F.create,kt=ae.create,Tt=H.create,Ct=Y.create,At=z.create,Nt=P.create,St=E.create,Et=ie.create,jt=Z.create,Ot=k.create,It=k.strictCreate,Rt=G.create,Pt=xe.create,Zt=K.create,$t=O.create,Mt=we.create,Lt=oe.create,Vt=ce.create,Dt=ke.create,zt=X.create,Ut=Q.create,Wt=ee.create,Bt=te.create,qt=U.create,Ve=C.create,Jt=S.create,Ft=$.create,Ht=C.createWithPreprocess,Yt=he.create,Gt=()=>Be().optional(),Kt=()=>qe().optional(),Xt=()=>Je().optional(),Qt={string:r=>D.create({...r,coerce:!0}),number:r=>B.create({...r,coerce:!0}),boolean:r=>J.create({...r,coerce:!0}),bigint:r=>q.create({...r,coerce:!0}),date:r=>F.create({...r,coerce:!0})},er=m,v=Object.freeze({__proto__:null,defaultErrorMap:fe,setErrorMap:st,getErrorMap:ve,makeIssue:_e,EMPTY_PATH:at,addIssueToContext:l,ParseStatus:x,INVALID:m,DIRTY:ze,OK:w,isAborted:je,isDirty:Oe,isValid:pe,isAsync:be,get util(){return b},get objectUtil(){return Ee},ZodParsedType:u,getParsedType:V,ZodType:y,ZodString:D,ZodNumber:B,ZodBigInt:q,ZodBoolean:J,ZodDate:F,ZodSymbol:ae,ZodUndefined:H,ZodNull:Y,ZodAny:z,ZodUnknown:P,ZodNever:E,ZodVoid:ie,ZodArray:Z,ZodObject:k,ZodUnion:G,ZodDiscriminatedUnion:xe,ZodIntersection:K,ZodTuple:O,ZodRecord:we,ZodMap:oe,ZodSet:ce,ZodFunction:ke,ZodLazy:X,ZodLiteral:Q,ZodEnum:ee,ZodNativeEnum:te,ZodPromise:U,ZodEffects:C,ZodTransformer:C,ZodOptional:S,ZodNullable:$,ZodDefault:re,ZodCatch:de,ZodNaN:ue,BRAND:yt,ZodBranded:Te,ZodPipeline:he,ZodReadonly:le,custom:We,Schema:y,ZodSchema:y,late:vt,get ZodFirstPartyTypeKind(){return h},coerce:Qt,any:At,array:jt,bigint:xt,boolean:Je,date:wt,discriminatedUnion:Pt,effect:Ve,enum:Wt,function:Dt,instanceof:_t,intersection:Zt,lazy:zt,literal:Ut,map:Lt,nan:bt,nativeEnum:Bt,never:St,null:Ct,nullable:Ft,number:qe,object:Ot,oboolean:Xt,onumber:Kt,optional:Jt,ostring:Gt,pipeline:Yt,preprocess:Ht,promise:qt,record:Mt,set:Vt,strictObject:It,string:Be,symbol:kt,transformer:Ve,tuple:$t,undefined:Tt,union:Rt,unknown:Nt,void:Et,NEVER:er,ZodIssueCode:c,quotelessJson:nt,ZodError:T});var tr=v.object({}),rr=v.object({alias:v.object({}).passthrough().default({}).describe("Equivalent to `vite.resolve.alias`.\n\nhttps://vitejs.dev/config/shared-options.html#resolve-alias"),plugins:v.any().array().default([]).describe("Equivalent to `vite.plugins`.\n\nhttps://vitejs.dev/config/shared-options.html#plugins")}),nr=v.object({server:v.number().default(3e3).describe("The port that the dev server should use."),gateway:v.number().default(3001).describe("The port that the api gateway should use.")}),sr=v.object({apps:v.string().array().default([]).describe(`Additional apps to include.
4
4
 
5
- Note: additional apps need to be added as devDependencies.`),ports:nr.default({}).describe("Options for ports."),open:v.boolean().default(!1).describe("Whether the dev server should automatically open in your browser or not."),logging:v.boolean().default(!1).describe("Whether the dev server and browser console should output more log information or not.")}),ar=v.object({mode:v.string().default("production").describe("Which mode to use when building the app. [production | development]"),watch:v.boolean().default(!1).describe("Whether the build should start watching and rebuild when files change or not.")}),ir=v.object({app:v.string().default("./src/app.ts").describe("The entry file for the app."),manifest:v.string().default("./src/manifest.json").describe("The entry file for the app manifest.")}),he=v.object({vite:rr.default({}).describe("Options related to Vite."),server:sr.default({}).describe("Options related to the dev server."),entries:ir.default({}).describe("Options related to the app entry points."),build:ar.default({}).describe("Options related to app build."),experimental:tr.default({}).describe("Experimental options.")}),or=v.enum(["build","serve"]),cr=v.object({command:or,mode:v.string()}),dr=v.function().args(cr).returns(he.or(v.promise(he))),Mr=v.function().args(v.union([he,dr]));var ur=v.enum(["necessary","functional","analytics","marketing"]),lr=v.object({purpose:v.string().describe("Purpose of the storing the value."),category:ur.describe("Category of the storage value - necessary, functional, analytics or marketing."),lifespan:v.string().describe("Basic description of how long the value will be stored.")}),fr=v.record(lr.describe("Key used when writing to the storage.")),pr=v.object({value:v.string().describe("The localization token default value."),description:v.string().describe("The localization token description.")}),hr=v.object({localization:v.record(pr.describe("Key used when getting the localized text.")).default({}).describe("Translateable texts used in the app")}),mr=v.object({name:v.string().describe("URL friendly name of the app."),endpoints:v.string().array().default([]).describe("Endpoints that should be communicated with using the API gateway."),permissions:v.string().array().default([]).describe("Permissions that can be added to user roles."),resources:hr.default({}).describe("Resources used by the app."),storage:fr.default({}).describe("Cookies, session storage, and local storage values that are used by the app.")}).passthrough();function Fe(r,e){let t=mr.safeParse(r);return t.success?t.data:He(t.error.format(),e?[e]:[]).join(`
6
- `)}function He(r,e=[],t=""){r._errors?.length&&e.push(`${t} - ${r._errors.join(" + ")}`);for(let[n,s]of Object.entries(r))n==="_errors"||!s||typeof s!="object"||Array.isArray(s)||He(s,e,t?`${t}.${n}`:n);return e}function Pe(r,e,t=".",n){if(!Re(e))return Pe(r,{},t,n);let s=Object.assign({},e);for(let a in r){if(a==="__proto__"||a==="constructor")continue;let i=r[a];i!=null&&(n&&n(s,a,i,t)||(Array.isArray(i)&&Array.isArray(s[a])?s[a]=[...i,...s[a]]:Re(i)&&Re(s[a])?s[a]=Pe(i,s[a],(t?`${t}.`:"")+a.toString(),n):s[a]=i))}return s}function Re(r){if(r===null||typeof r!="object")return!1;let e=Object.getPrototypeOf(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)}function Ze(r){return(...e)=>e.reduce((t,n)=>Pe(t,n,"",r),{})}var Ye=Ze(),zr=Ze((r,e,t)=>{if(r[e]!==void 0&&typeof t=="function")return r[e]=t(r[e]),!0}),Ur=Ze((r,e,t)=>{if(Array.isArray(r[e])&&typeof t=="function")return r[e]=t(r[e]),!0});var gr=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,yr=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,vr=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function _r(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){br(r);return}return e}function br(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function $e(r,e={}){if(typeof r!="string")return r;let t=r.trim();if(r[0]==='"'&&r.at(-1)==='"'&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){let n=t.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!vr.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(gr.test(r)||yr.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,_r)}return JSON.parse(r)}catch(n){if(e.strict)throw n;return r}}import{createServer as xr}from"node:net";import{networkInterfaces as wr}from"node:os";var kr=new Set([1,7,9,11,13,15,17,19,20,21,22,23,25,37,42,43,53,69,77,79,87,95,101,102,103,104,109,110,111,113,115,117,119,123,135,137,139,143,161,179,389,427,465,512,513,514,515,526,530,531,532,540,548,554,556,563,587,601,636,989,990,993,995,1719,1720,1723,2049,3659,4045,5060,5061,6e3,6566,6665,6666,6667,6668,6669,6697,10080]);function Tr(r){return kr.has(r)}function Cr(r){return!Tr(r)}function Nr(r,e){r&&console.log(`[get-port] ${e}`)}function Ge(r,e){return new Promise(t=>{let n=xr();n.unref(),n.on("error",()=>{t(!1)}),n.listen({port:r,host:e},()=>{let{port:s}=n.address();n.close(()=>{t(Cr(s)&&s)})})})}function Ar(r){let e=new Set(r);for(let t of Object.values(wr()))for(let n of t||[])n.address&&!n.internal&&!n.address.startsWith("fe80::")&&e.add(n.address);return[...e]}function Sr(r){return r?`on host ${JSON.stringify(r)}`:"on any host"}async function Me(r,e=process.env.HOST,t){if(e||(e=Ar([void 0,"0.0.0.0"])),!Array.isArray(e))return Ge(r,e);for(let n of e){let s=await Ge(r,n);if(s===!1)return r<1024&&t&&Nr(t,`Unable to listen to the priviliged port ${r} ${Sr(n)}`),!1;r===0&&s!==0&&(r=s)}return r}import{loadConfigFromFile as Er}from"vite";var te=O("yellow"),Te=O("green"),Ke=O("red"),Xe=O("cyan"),me=O("bold"),Qe=O("underline"),sn=O("italic"),an=O("magentaBright"),rt={"arg.build.watch":"Whether the build should start watching and rebuild when files change or not.","arg.config":"The path to the app configuration file.","arg.debug":"Whether to output debug information or not.","arg.entries.app":"The entry file for the app.","arg.entries.manifest":"The entry file for the app manifest.","arg.jwt.app":"Token app name.","arg.jwt.expiration":"Token expiration time compatible with https://npmjs.com/package/ms.","arg.jwt.user.email":"Token user email.","arg.jwt.user.name":"Token user name.","arg.jwt.user.permission":"Token user permission(s).","arg.jwt.user.sub":"Token user object id.","arg.jwt.user.type":"Token user type.","arg.jwt.workspace":"Token workspace name.","arg.jwt.organization":"Token organization name.","arg.mode":"Which mode to use when building the app.","arg.public-key.clean":"Whether to exclude the -----BEGIN PUBLIC KEY----- prefix and -----END PUBLIC KEY----- suffix or not.","arg.public-key.type":"Type of public key.","arg.serve.logging":"Whether the server and browser console should output more log information or not.","arg.serve.open":"Whether the server should automatically open in your browser or not.","arg.serve.ports.gateway":"The port that the gateway should use.","arg.serve.ports.server":"The port that the server should use.","arg.upgrade.next":"Whether or not the CLI should include the 'next' tag when upgrading @telia-ace packages.","changes.upgraded":`Upgraded ${te("'{{pkg}}'")} to ${Te("'{{v}}'")}`,"command.build":"Builds an Alliance app.","command.jwt":"Creates an Alliance JWT.","command.public-key":"Creates a public key used to verify an Alliance JWT.","command.serve":"Starts the Alliance development server.","command.upgrade":"Upgrades Alliance app(s).","errors.invalid-manifest":"Invalid app manifest","errors.no-entry":"Could not find any app and/or manifest entry file at '{{app}}' or '{{manifest}}'","errors.npm-error":"Could not get upgrade information from NPM.","errors.port-busy":"Port {{busy}} is busy","info.gateway-url":`${me("Gateway:")} ${Qe(Xe("{{url}}"))}`,"info.header.changes":"Changes","info.header.recommendations":"Recommendations","info.header.warnings":"Warnings","info.next-steps":"Next steps:","info.server-url":`${me("Server:")} ${Qe(Xe("{{url}}"))}`,"info.steps.install":`Run ${te("'{{cmd}}'")} to install the changed package versions`,"info.steps.warnings":`Address the ${Ke("warnings")} and ${te("recommendations")} detailed above`,"info.stop-server":me("Press CTRL + C to stop the server."),"info.upgraded":`Upgraded ${te("'{{pkg}}'")} to ${Te("'{{v}}'")}`,"recommendations.upgrade":`Upgrade ${te("'{{pkg}}'")} to ${Te("'{{v}}'")}`,"warnings.change":`Change ${te("'{{property}}'")} from ${Ke("'{{current}}'")} to ${Te("'{{new}}'")}`,"warnings.remove":`Remove ${te("'{{property}}'")}{{alt}}`},on=Object.keys(rt);function re(r,e={}){return Object.entries(e).reduce((t,[n,s])=>t.replaceAll(`{{${n}}}`,String(s)),rt[r]).trim()}var cn={type:"string",description:re("arg.config"),required:!1,alias:"c",valueHint:"./alliance.config.ts"},dn={type:"boolean",description:re("arg.debug"),required:!1,default:!1,alias:"d"};function un({debug:r,input:e,output:t}){r&&(I.log(me(Ae("cyan","Input:"))),console.log(JSON.stringify(e,null,2),`
7
- `),I.log(me(Ae("cyan","Output:")))),console.log(t,`
8
- `)}var et=["./src/app.ts","./src/app.js","./src/app.mts","./src/app.mjs","./src/app.cts","./src/app.cjs"],jr=["alliance.config.js","alliance.config.mjs","alliance.config.ts","alliance.config.cjs","alliance.config.mts","alliance.config.cts","alliance.config.json"];async function Or(r,e){let t;if(e?t=M(process.cwd(),e):t=Rr(),t&&$(t)){if(t.endsWith(".json"))return $e(tt(t).toString());try{return(await Er(r,t))?.config||{}}catch(n){I.error(n.message),process.exit(1)}}return{}}function Ir(r){let e=M(process.cwd(),r.app);if(r.manifest=M(process.cwd(),r.manifest),!et.includes(r.app))return r.app=e,r;for(let t of et){let n=M(process.cwd(),t);if($(n)){r.app=n;break}}return r}function Rr(){let r=jr.reduce((e,t)=>{if(e.length)return e;let n=M(process.cwd(),t);return $(n)?n:e},"");if($(r))return r}async function ln(r,e="",t={}){let n=Ye(t,await Or(r,e));!n.build?.mode&&(n.build?.watch||r.command==="serve")&&(n.build={...n.build,mode:"development"});let s=he.parse(n);return r.command==="serve"&&(await Me(s.server.ports.server)||(I.error(re("errors.port-busy",{busy:s.server.ports.server})),process.exit(1)),await Me(s.server.ports.gateway)||(I.error(re("errors.port-busy",{busy:s.server.ports.gateway})),process.exit(1))),{...s,entries:Ir(s.entries)}}function fn(r,e){let t={};if($(e.entries.manifest)){let n=$e(tt(e.entries.manifest).toString()),s=Fe(n,re("errors.invalid-manifest"));typeof s=="string"&&(I.error(s),process.exit(1)),t.ALLIANCE_APP_MANIFEST=s,t.ALLIANCE_APP_NAME=JSON.stringify(s.name)}return r==="build"&&(!$(e.entries.manifest)||!$(e.entries.app))&&(I.error(re("errors.no-entry",{app:Ce(process.cwd(),M(e.entries.app)),manifest:Ce(process.cwd(),M(e.entries.manifest))})),process.exit(1)),r==="serve"&&(t.ALLIANCE_ENVIRONMENT={logging:e.server.logging}),t}function pn({entries:r,server:e}){let t=[];$(r.app)&&$(r.manifest)&&t.push({packageName:"entry",appImportPath:r.app,manifestImportPath:r.manifest});for(let n of e.apps)t.push({packageName:n,appImportPath:`${n}/app`,manifestImportPath:`${n}/manifest`});return t.length||(I.error(re("errors.no-entry",{app:Ce(process.cwd(),M(r.app)),manifest:Ce(process.cwd(),M(r.manifest))})),process.exit(1)),t}export{$e as a,te as b,Te as c,Ke as d,Xe as e,me as f,Qe as g,on as h,re as i,cn as j,dn as k,un as l,ln as m,fn as n,pn as o};
5
+ Note: additional apps need to be added as devDependencies.`),ports:nr.default({}).describe("Options for ports."),open:v.boolean().default(!1).describe("Whether the dev server should automatically open in your browser or not."),logging:v.boolean().default(!1).describe("Whether the dev server and browser console should output more log information or not.")}),ar=v.object({mode:v.string().default("production").describe("Which mode to use when building the app. [production | development]"),watch:v.boolean().default(!1).describe("Whether the build should start watching and rebuild when files change or not.")}),ir=v.object({app:v.string().default("./src/app.ts").describe("The entry file for the app."),manifest:v.string().default("./src/manifest.json").describe("The entry file for the app manifest.")}),me=v.object({vite:rr.default({}).describe("Options related to Vite."),server:sr.default({}).describe("Options related to the dev server."),entries:ir.default({}).describe("Options related to the app entry points."),build:ar.default({}).describe("Options related to app build."),experimental:tr.default({}).describe("Experimental options.")}),or=v.enum(["build","serve"]),cr=v.object({command:or,mode:v.string()}),dr=v.function().args(cr).returns(me.or(v.promise(me))),Mr=v.function().args(v.union([me,dr]));var ur=v.enum(["necessary","functional","analytics","marketing"]),lr=v.object({purpose:v.string().describe("Purpose of the storing the value."),category:ur.describe("Category of the storage value - necessary, functional, analytics or marketing."),lifespan:v.string().describe("Basic description of how long the value will be stored.")}),fr=v.record(lr.describe("Key used when writing to the storage.")),pr=v.object({value:v.string().describe("The localization token default value."),description:v.string().describe("The localization token description.")}),hr=v.object({localization:v.record(pr.describe("Key used when getting the localized text.")).default({}).describe("Translateable texts used in the app")}),mr=v.object({name:v.string().describe("URL friendly name of the app."),endpoints:v.string().array().default([]).describe("Endpoints that should be communicated with using the API gateway."),permissions:v.string().array().default([]).describe("Permissions that can be added to user roles."),resources:hr.default({}).describe("Resources used by the app."),storage:fr.default({}).describe("Cookies, session storage, and local storage values that are used by the app.")}).passthrough();function Fe(r,e){let t=mr.safeParse(r);return t.success?t.data:He(t.error.format(),e?[e]:[]).join(`
6
+ `)}function He(r,e=[],t=""){r._errors?.length&&e.push(`${t} - ${r._errors.join(" + ")}`);for(let[n,s]of Object.entries(r))n==="_errors"||!s||typeof s!="object"||Array.isArray(s)||He(s,e,t?`${t}.${n}`:n);return e}function Pe(r,e,t=".",n){if(!Re(e))return Pe(r,{},t,n);let s=Object.assign({},e);for(let a in r){if(a==="__proto__"||a==="constructor")continue;let i=r[a];i!=null&&(n&&n(s,a,i,t)||(Array.isArray(i)&&Array.isArray(s[a])?s[a]=[...i,...s[a]]:Re(i)&&Re(s[a])?s[a]=Pe(i,s[a],(t?`${t}.`:"")+a.toString(),n):s[a]=i))}return s}function Re(r){if(r===null||typeof r!="object")return!1;let e=Object.getPrototypeOf(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)}function Ze(r){return(...e)=>e.reduce((t,n)=>Pe(t,n,"",r),{})}var Ye=Ze(),zr=Ze((r,e,t)=>{if(r[e]!==void 0&&typeof t=="function")return r[e]=t(r[e]),!0}),Ur=Ze((r,e,t)=>{if(Array.isArray(r[e])&&typeof t=="function")return r[e]=t(r[e]),!0});var gr=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,yr=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,vr=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function _r(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){br(r);return}return e}function br(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function $e(r,e={}){if(typeof r!="string")return r;let t=r.trim();if(r[0]==='"'&&r.at(-1)==='"'&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){let n=t.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!vr.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(gr.test(r)||yr.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,_r)}return JSON.parse(r)}catch(n){if(e.strict)throw n;return r}}import{createServer as xr}from"node:net";import{networkInterfaces as wr}from"node:os";var kr=new Set([1,7,9,11,13,15,17,19,20,21,22,23,25,37,42,43,53,69,77,79,87,95,101,102,103,104,109,110,111,113,115,117,119,123,135,137,139,143,161,179,389,427,465,512,513,514,515,526,530,531,532,540,548,554,556,563,587,601,636,989,990,993,995,1719,1720,1723,2049,3659,4045,5060,5061,6e3,6566,6665,6666,6667,6668,6669,6697,10080]);function Tr(r){return kr.has(r)}function Cr(r){return!Tr(r)}function Ar(r,e){r&&console.log(`[get-port] ${e}`)}function Ge(r,e){return new Promise(t=>{let n=xr();n.unref(),n.on("error",()=>{t(!1)}),n.listen({port:r,host:e},()=>{let{port:s}=n.address();n.close(()=>{t(Cr(s)&&s)})})})}function Nr(r){let e=new Set(r);for(let t of Object.values(wr()))for(let n of t||[])n.address&&!n.internal&&!n.address.startsWith("fe80::")&&e.add(n.address);return[...e]}function Sr(r){return r?`on host ${JSON.stringify(r)}`:"on any host"}async function Me(r,e=process.env.HOST,t){if(e||(e=Nr([void 0,"0.0.0.0"])),!Array.isArray(e))return Ge(r,e);for(let n of e){let s=await Ge(r,n);if(s===!1)return r<1024&&t&&Ar(t,`Unable to listen to the priviliged port ${r} ${Sr(n)}`),!1;r===0&&s!==0&&(r=s)}return r}import{loadConfigFromFile as Er}from"vite";var j=I("yellow"),W=I("green"),Ke=I("red"),Xe=I("cyan"),ge=I("bold"),Qe=I("underline"),sn=I("italic"),an=I("magentaBright"),rt={"arg.build.watch":"Whether the build should start watching and rebuild when files change or not.","arg.config":"The path to the app configuration file.","arg.debug":"Whether to output debug information or not.","arg.entries.app":"The entry file for the app.","arg.entries.manifest":"The entry file for the app manifest.","arg.jwt.app":"Token app name.","arg.jwt.expiration":"Token expiration time compatible with https://npmjs.com/package/ms.","arg.jwt.user.email":"Token user email.","arg.jwt.user.name":"Token user name.","arg.jwt.user.permission":"Token user permission(s).","arg.jwt.user.sub":"Token user object id.","arg.jwt.user.type":"Token user type.","arg.jwt.workspace":"Token workspace name.","arg.jwt.organization":"Token organization name.","arg.mode":"Which mode to use when building the app.","arg.public-key.clean":"Whether to exclude the -----BEGIN PUBLIC KEY----- prefix and -----END PUBLIC KEY----- suffix or not.","arg.public-key.type":"Type of public key.","arg.serve.logging":"Whether the server and browser console should output more log information or not.","arg.serve.open":"Whether the server should automatically open in your browser or not.","arg.serve.ports.gateway":"The port that the gateway should use.","arg.serve.ports.server":"The port that the server should use.","arg.upgrade.next":"Whether or not the CLI should include the 'next' tag when upgrading @telia-ace packages.","changes.upgraded":`Upgraded ${j("'{{pkg}}'")} to ${W("'{{v}}'")}`,"command.build":"Builds an Alliance app.","command.jwt":"Creates an Alliance JWT.","command.public-key":"Creates a public key used to verify an Alliance JWT.","command.serve":"Starts the Alliance development server.","command.upgrade":"Upgrades Alliance app(s).","errors.invalid-manifest":"Invalid app manifest","errors.no-entry":"Could not find any app and/or manifest entry file at '{{app}}' or '{{manifest}}'","errors.npm-error":"Could not get upgrade information from NPM.","errors.port-busy":"Port {{busy}} is busy","info.gateway-url":`${ge("Gateway:")} ${Qe(Xe("{{url}}"))}`,"info.header.changes":"Changes","info.header.recommendations":"Recommendations","info.header.warnings":"Warnings","info.next-steps":"Next steps:","info.server-url":`${ge("Server:")} ${Qe(Xe("{{url}}"))}`,"info.steps.install":`Run ${j("'{{cmd}}'")} to install the changed package versions`,"info.steps.warnings":`Address the ${Ke("warnings")} and ${j("recommendations")} detailed above`,"info.stop-server":ge("Press CTRL + C to stop the server."),"info.upgraded":`Upgraded ${j("'{{pkg}}'")} to ${W("'{{v}}'")}`,"recommendations.update.webprovisions-registry-app":`Remove ${j("'{{pkg}}'")} and install ${W("'{{wpPkg}}'")} (preferably as a dev dependency)`,"recommendations.update.webprovisions-registry-config":`Add ${j("'@webprovisions-registry:registry=https://registry.webprovisions.io'")} to the ${W("'.npmrc'")} file to always use the Webprovisions registry for Webprovisions packages`,"recommendations.add.webprovisions-registry-config":`Create a ${W("'.npmrc'")} file containing ${j("'@webprovisions-registry:registry=https://registry.webprovisions.io'")} to always use the Webprovisions registry for Webprovisions packages`,"recommendations.upgrade":`Upgrade ${j("'{{pkg}}'")} to ${W("'{{v}}'")}`,"warnings.set":`Set ${j("'{{property}}'")} to ${W("'{{new}}'")}`,"warnings.change":`Change ${j("'{{property}}'")} from ${Ke("'{{current}}'")} to ${W("'{{new}}'")}`,"warnings.remove":`Remove ${j("'{{property}}'")}{{alt}}`},on=Object.keys(rt);function ne(r,e={}){return Object.entries(e).reduce((t,[n,s])=>t.replaceAll(`{{${n}}}`,String(s)),rt[r]).trim()}var cn={type:"string",description:ne("arg.config"),required:!1,alias:"c",valueHint:"./alliance.config.ts"},dn={type:"boolean",description:ne("arg.debug"),required:!1,default:!1,alias:"d"};function un({debug:r,input:e,output:t}){r&&(R.log(ge(Ne("cyan","Input:"))),console.log(JSON.stringify(e,null,2),`
7
+ `),R.log(ge(Ne("cyan","Output:")))),console.log(t,`
8
+ `)}var et=["./src/app.ts","./src/app.js","./src/app.mts","./src/app.mjs","./src/app.cts","./src/app.cjs"],jr=["alliance.config.js","alliance.config.mjs","alliance.config.ts","alliance.config.cjs","alliance.config.mts","alliance.config.cts","alliance.config.json"];async function Or(r,e){let t;if(e?t=L(process.cwd(),e):t=Rr(),t&&M(t)){if(t.endsWith(".json"))return $e(tt(t).toString());try{return(await Er(r,t))?.config||{}}catch(n){R.error(n.message),process.exit(1)}}return{}}function Ir(r){let e=L(process.cwd(),r.app);if(r.manifest=L(process.cwd(),r.manifest),!et.includes(r.app))return r.app=e,r;for(let t of et){let n=L(process.cwd(),t);if(M(n)){r.app=n;break}}return r}function Rr(){let r=jr.reduce((e,t)=>{if(e.length)return e;let n=L(process.cwd(),t);return M(n)?n:e},"");if(M(r))return r}async function ln(r,e="",t={}){let n=Ye(t,await Or(r,e));!n.build?.mode&&(n.build?.watch||r.command==="serve")&&(n.build={...n.build,mode:"development"});let s=me.parse(n);return r.command==="serve"&&(await Me(s.server.ports.server)||(R.error(ne("errors.port-busy",{busy:s.server.ports.server})),process.exit(1)),await Me(s.server.ports.gateway)||(R.error(ne("errors.port-busy",{busy:s.server.ports.gateway})),process.exit(1))),{...s,entries:Ir(s.entries)}}function fn(r,e){let t={};if(M(e.entries.manifest)){let n=$e(tt(e.entries.manifest).toString()),s=Fe(n,ne("errors.invalid-manifest"));typeof s=="string"&&(R.error(s),process.exit(1)),t.ALLIANCE_APP_MANIFEST=s,t.ALLIANCE_APP_NAME=JSON.stringify(s.name)}return r==="build"&&(!M(e.entries.manifest)||!M(e.entries.app))&&(R.error(ne("errors.no-entry",{app:Ce(process.cwd(),L(e.entries.app)),manifest:Ce(process.cwd(),L(e.entries.manifest))})),process.exit(1)),r==="serve"&&(t.ALLIANCE_ENVIRONMENT={logging:e.server.logging}),t}function pn({entries:r,server:e}){let t=[];M(r.app)&&M(r.manifest)&&t.push({packageName:"entry",appImportPath:r.app,manifestImportPath:r.manifest});for(let n of e.apps)t.push({packageName:n,appImportPath:`${n}/app`,manifestImportPath:`${n}/manifest`});return t.length||(R.error(ne("errors.no-entry",{app:Ce(process.cwd(),L(r.app)),manifest:Ce(process.cwd(),L(r.manifest))})),process.exit(1)),t}export{$e as a,j as b,W as c,Ke as d,Xe as e,ge as f,Qe as g,on as h,ne as i,cn as j,dn as k,un as l,ln as m,fn as n,pn as o};
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as c__createRequire } from 'node:module';
3
3
  const require = c__createRequire(import.meta.url);
4
- import{a}from"./chunk-TTCH5DKE.js";import{i,l as n}from"./chunk-AEIX73UA.js";var l="@telia-ace/alliance-cli",o="1.1.1-next.0",s="CLI used when developing ACE Alliance apps.";try{await a({meta:{name:l,version:o,description:s},subCommands:{build:()=>import("./build-HMHVWY52.js").then(e=>e.default),serve:()=>import("./serve-O62T2P57.js").then(e=>e.default),jwt:()=>import("./jwt-NHGJB7BY.js").then(e=>e.default),"public-key":()=>import("./public-key-BH3GNWCY.js").then(e=>e.default),upgrade:()=>import("./upgrade-SKSITG2O.js").then(e=>e.default)}})}catch(e){n.error(i("bold",i("red","Error:")),i("bold",e?.message||"something went wrong"))}
4
+ import{a}from"./chunk-TTCH5DKE.js";import{i,l as n}from"./chunk-AEIX73UA.js";var l="@telia-ace/alliance-cli",o="1.1.2-next.0",s="CLI used when developing ACE Alliance apps.";try{await a({meta:{name:l,version:o,description:s},subCommands:{build:()=>import("./build-MRIPJB7D.js").then(e=>e.default),serve:()=>import("./serve-COCIXSFA.js").then(e=>e.default),jwt:()=>import("./jwt-TCUDRJXF.js").then(e=>e.default),"public-key":()=>import("./public-key-MNL3VTOO.js").then(e=>e.default),upgrade:()=>import("./upgrade-AVG3YKS3.js").then(e=>e.default)}})}catch(e){n.error(i("bold",i("red","Error:")),i("bold",e?.message||"something went wrong"))}
@@ -1,3 +1,3 @@
1
1
  import { createRequire as c__createRequire } from 'node:module';
2
2
  const require = c__createRequire(import.meta.url);
3
- import{i,k as a,l as n}from"./chunk-CWA32LZ6.js";import"./chunk-TTCH5DKE.js";import"./chunk-AEIX73UA.js";import{createBearerToken as u,getPrivateKey as m,slugify as o,zSharedConfig as d}from"@telia-ace/alliance-internal-node-utilities";var f={meta:{name:"jwt",description:i("command.jwt")},args:{app:{type:"string",description:i("arg.jwt.app"),required:!1,alias:"a",default:"the-app"},workspace:{type:"string",description:i("arg.jwt.workspace"),required:!1,alias:"w",default:"The Workspace"},organization:{type:"string",description:i("arg.jwt.organization"),required:!1,alias:"o",default:"The Organization"},expiration:{type:"string",description:i("arg.jwt.expiration"),required:!1,alias:"e",default:"1d"},"user.name":{type:"string",description:i("arg.jwt.user.name"),required:!1,default:"John Doe"},"user.type":{type:"string",description:i("arg.jwt.user.type"),required:!1,default:"user",valueHint:"user|system-admin|system"},"user.email":{type:"string",description:i("arg.jwt.user.email"),required:!1,default:"john.doe@mail.com"},"user.permission":{type:"string",description:i("arg.jwt.user.permission"),required:!1,alias:"p"},"user.sub":{type:"string",description:i("arg.jwt.user.sub"),required:!1,alias:"s",default:"2ccaa1b2-5e34-4dd7-bb47-28435e973969"},debug:a},run({args:e}){let s=[];if(Array.isArray(e["user.permission"]))for(let t of e["user.permission"])typeof t=="string"&&s.push(t);else typeof e["user.permission"]=="string"&&s.push(e["user.permission"]);let r={user:{name:e["user.name"],email:e["user.email"],permissions:s,sub:e["user.sub"],type:e["user.type"]},app:e.app,workspace:{name:e.workspace,slug:o(e.workspace)},organization:{name:e.organization,slug:o(e.organization)},expiration:e.expiration},p=u({...r,aud:r.app,name:r.user.name,sub:r.user.sub,privateKey:m(d.pick({JWT_PRIVATE_KEY:!0}).parse({}))});n({debug:e.debug,input:r,output:p})}};export{f as default};
3
+ import{i,k as a,l as n}from"./chunk-OJBRHDBC.js";import"./chunk-TTCH5DKE.js";import"./chunk-AEIX73UA.js";import{createBearerToken as u,getPrivateKey as m,slugify as o,zSharedConfig as d}from"@telia-ace/alliance-internal-node-utilities";var f={meta:{name:"jwt",description:i("command.jwt")},args:{app:{type:"string",description:i("arg.jwt.app"),required:!1,alias:"a",default:"the-app"},workspace:{type:"string",description:i("arg.jwt.workspace"),required:!1,alias:"w",default:"The Workspace"},organization:{type:"string",description:i("arg.jwt.organization"),required:!1,alias:"o",default:"The Organization"},expiration:{type:"string",description:i("arg.jwt.expiration"),required:!1,alias:"e",default:"1d"},"user.name":{type:"string",description:i("arg.jwt.user.name"),required:!1,default:"John Doe"},"user.type":{type:"string",description:i("arg.jwt.user.type"),required:!1,default:"user",valueHint:"user|system-admin|system"},"user.email":{type:"string",description:i("arg.jwt.user.email"),required:!1,default:"john.doe@mail.com"},"user.permission":{type:"string",description:i("arg.jwt.user.permission"),required:!1,alias:"p"},"user.sub":{type:"string",description:i("arg.jwt.user.sub"),required:!1,alias:"s",default:"2ccaa1b2-5e34-4dd7-bb47-28435e973969"},debug:a},run({args:e}){let s=[];if(Array.isArray(e["user.permission"]))for(let t of e["user.permission"])typeof t=="string"&&s.push(t);else typeof e["user.permission"]=="string"&&s.push(e["user.permission"]);let r={user:{name:e["user.name"],email:e["user.email"],permissions:s,sub:e["user.sub"],type:e["user.type"]},app:e.app,workspace:{name:e.workspace,slug:o(e.workspace)},organization:{name:e.organization,slug:o(e.organization)},expiration:e.expiration},p=u({...r,aud:r.app,name:r.user.name,sub:r.user.sub,privateKey:m(d.pick({JWT_PRIVATE_KEY:!0}).parse({}))});n({debug:e.debug,input:r,output:p})}};export{f as default};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as c__createRequire } from 'node:module';
2
2
  const require = c__createRequire(import.meta.url);
3
- import{i as t,k as l,l as c}from"./chunk-CWA32LZ6.js";import"./chunk-TTCH5DKE.js";import"./chunk-AEIX73UA.js";import{createPublicKeys as a,getCleanPublicKey as n,zSharedConfig as o}from"@telia-ace/alliance-internal-node-utilities";var r={meta:{name:"public-key",description:t("command.public-key")},args:{type:{type:"string",required:!1,default:"spki",alias:"t",description:t("arg.public-key.type"),valueHint:"pkcs|spki|csp"},clean:{type:"boolean",required:!1,default:!1,alias:"c",description:t("arg.public-key.clean")},debug:l},run({args:i}){let e={clean:i.clean,type:i.type},p=a(o.pick({JWT_PUBLIC_CSP_KEY:!0,JWT_PRIVATE_KEY:!0}).parse({})),u=e.clean?n(e.type,p):p[e.type];c({debug:i.debug,input:e,output:u})}};export{r as default};
3
+ import{i as t,k as l,l as c}from"./chunk-OJBRHDBC.js";import"./chunk-TTCH5DKE.js";import"./chunk-AEIX73UA.js";import{createPublicKeys as a,getCleanPublicKey as n,zSharedConfig as o}from"@telia-ace/alliance-internal-node-utilities";var r={meta:{name:"public-key",description:t("command.public-key")},args:{type:{type:"string",required:!1,default:"spki",alias:"t",description:t("arg.public-key.type"),valueHint:"pkcs|spki|csp"},clean:{type:"boolean",required:!1,default:!1,alias:"c",description:t("arg.public-key.clean")},debug:l},run({args:i}){let e={clean:i.clean,type:i.type},p=a(o.pick({JWT_PUBLIC_CSP_KEY:!0,JWT_PRIVATE_KEY:!0}).parse({})),u=e.clean?n(e.type,p):p[e.type];c({debug:i.debug,input:e,output:u})}};export{r as default};
@@ -0,0 +1,4 @@
1
+ import { createRequire as c__createRequire } from 'node:module';
2
+ const require = c__createRequire(import.meta.url);
3
+ import{a as p,i as r,j as m,m as l,n as f,o as c}from"./chunk-OJBRHDBC.js";import"./chunk-TTCH5DKE.js";import{l as s}from"./chunk-AEIX73UA.js";import{existsSync as d,readFileSync as h,rmSync as S}from"node:fs";import{start as x}from"@telia-ace/alliance-gateway/dev";import{createIndexHtml as b,getAppManifests as A}from"@telia-ace/alliance-internal-node-utilities";import{onExit as D}from"signal-exit";import y from"node:dns";import{createServer as g}from"vite";var w=process.env.CI==="true"||process.env.NODE_ENV==="test";async function v(e){let t=f("serve",e);y.setDefaultResultOrder("verbatim");let i=await g({plugins:e.vite.plugins,configFile:!1,mode:e.build.mode,server:{open:e.server.open,port:e.server.ports.server,host:"localhost",proxy:{"/-/":{target:`http://localhost:${e.server.ports.gateway}/`,prependPath:!1,rewrite:o=>o.replace("/-/","/")}},strictPort:!0},clearScreen:!1,resolve:{alias:e.vite.alias},define:t}).then(o=>o.listen());return(w?console.log:s.box)([r("info.server-url",{url:`http://localhost:${e.server.ports.server}`}),r("info.gateway-url",{url:`http://localhost:${e.server.ports.gateway}`}),r("info.stop-server")].join(`
4
+ `)),i}async function u(e){let t,i,o;D(()=>{if(t)try{t.close()}catch(n){s.error(n)}if(i&&d(i))try{S(i,{force:!0})}catch(n){s.error(n)}if(o)try{o.close()}catch(n){s.error(n)}});let a=await A(e.server.apps);d(e.entries.manifest)&&a.unshift(p(h(e.entries.manifest).toString())),t=await x(e,a),i=b(c(e)),o=await v(e)}var _={meta:{name:"serve",description:r("command.serve")},args:{"ports.server":{type:"string",description:r("arg.serve.ports.server"),required:!1},"ports.gateway":{type:"string",description:r("arg.serve.ports.gateway"),required:!1},"entries.app":{type:"string",valueHint:"./src/app.ts",description:r("arg.entries.app"),required:!1},"entries.manifest":{type:"string",valueHint:"./src/manifest.json",description:r("arg.entries.manifest"),required:!1},mode:{type:"string",alias:"m",description:r("arg.mode"),required:!1},logging:{type:"boolean",alias:"l",description:r("arg.serve.logging"),required:!1},open:{type:"boolean",alias:"o",description:r("arg.serve.open"),required:!1},config:m},async run({args:e}){let t=await l({command:"serve",mode:e.mode||"development"},e.config,{build:{mode:e.mode},server:{open:e.open,ports:{gateway:e["ports.gateway"]?Number(e["ports.gateway"]):void 0,server:e["ports.server"]?Number(e["ports.server"]):void 0},logging:e.logging},entries:{app:e["entries.app"],manifest:e["entries.manifest"]}});await u(t)}};export{_ as default};
@@ -0,0 +1,4 @@
1
+ import { createRequire as c__createRequire } from 'node:module';
2
+ const require = c__createRequire(import.meta.url);
3
+ import{a as _,b as F,c as P,d as N,e as H,f as E,g as z,h as B,i as p}from"./chunk-OJBRHDBC.js";import"./chunk-TTCH5DKE.js";import{a as C,c as D,e as me,l as A}from"./chunk-AEIX73UA.js";var Q=D((Ie,K)=>{"use strict";var X=process.platform==="win32",he=X?"\\\\+":"\\/",G=X?"\\\\":"/",ye="((?:[^/]*(?:/|$))*)",we="([^/]*)",j=`((?:[^${G}]*(?:${G}|$))*)`,be=`([^${G}]*)`;function xe(e,{extended:r=!1,globstar:n=!1,strict:l=!1,filepath:t=!1,flags:s=""}={}){let c="",a="",g={regex:"",segments:[]},w=!1,d=!1,h=[];function o(f,{split:m,last:S,only:v}={}){v!=="path"&&(c+=f),t&&v!=="regex"&&(g.regex+=f==="\\/"?he:f,m?(S&&(a+=f),a!==""&&(s.includes("g")||(a=`^${a}$`),g.segments.push(new RegExp(a,s))),a=""):a+=f)}let i,u;for(let f=0;f<e.length;f++){if(i=e[f],u=e[f+1],["\\","$","^",".","="].includes(i)){o(`\\${i}`);continue}if(i==="/"){o(`\\${i}`,{split:!0}),u==="/"&&!l&&(c+="?");continue}if(i==="("){if(h.length){o(i);continue}o(`\\${i}`);continue}if(i===")"){if(h.length){o(i);let m=h.pop();o(m==="@"?"{1}":m==="!"?"([^/]*)":m);continue}o(`\\${i}`);continue}if(i==="|"){if(h.length){o(i);continue}o(`\\${i}`);continue}if(i==="+"){if(u==="("&&r){h.push(i);continue}o(`\\${i}`);continue}if(i==="@"&&r&&u==="("){h.push(i);continue}if(i==="!"){if(r){if(d){o("^");continue}if(u==="("){h.push(i),o("(?!"),f++;continue}o(`\\${i}`);continue}o(`\\${i}`);continue}if(i==="?"){if(r){u==="("?h.push(i):o(".");continue}o(`\\${i}`);continue}if(i==="["){if(d&&u===":"){f++;let m="";for(;e[++f]!==":";)m+=e[f];m==="alnum"?o("(\\w|\\d)"):m==="space"?o("\\s"):m==="digit"&&o("\\d"),f++;continue}if(r){d=!0,o(i);continue}o(`\\${i}`);continue}if(i==="]"){if(r){d=!1,o(i);continue}o(`\\${i}`);continue}if(i==="{"){if(r){w=!0,o("(");continue}o(`\\${i}`);continue}if(i==="}"){if(r){w=!1,o(")");continue}o(`\\${i}`);continue}if(i===","){if(w){o("|");continue}o(`\\${i}`);continue}if(i==="*"){if(u==="("&&r){h.push(i);continue}let m=e[f-1],S=1;for(;e[f+1]==="*";)S++,f++;let v=e[f+1];n?S>1&&(m==="/"||m===void 0)&&(v==="/"||v===void 0)?(o(ye,{only:"regex"}),o(j,{only:"path",last:!0,split:!0}),f++):(o(we,{only:"regex"}),o(be,{only:"path"})):o(".*");continue}o(i)}s.includes("g")||(c=`^${c}$`,a=`^${a}$`,t&&(g.regex=`^${g.regex}$`));let y={regex:new RegExp(c,s)};return t&&(g.segments.push(new RegExp(a,s)),g.regex=new RegExp(g.regex,s),g.globstar=new RegExp(s.includes("g")?j:`^${j}$`,s),y.path=g),y}K.exports=xe});var Z=D((Me,Y)=>{"use strict";var $e=C("os"),U=C("path"),ve=$e.platform()==="win32",Ce={"{":"}","(":")","[":"]"},Re=/\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\)|(\\).|([@?!+*]\(.*\)))/,Se=/\\(.)|(^!|[*?{}()[\]]|\(\?)/;function V(e,{strict:r=!0}={}){if(e==="")return!1;let n,l=r?Re:Se;for(;n=l.exec(e);){if(n[2])return!0;let t=n.index+n[0].length,s=n[1],c=s?Ce[s]:null;if(s&&c){let a=e.indexOf(c,t);a!==-1&&(t=a+1)}e=e.slice(t)}return!1}function Ae(e,{strict:r=!1}={}){ve&&e.includes("/")&&(e=e.split("\\").join("/")),/[\{\[].*[\/]*.*[\}\]]$/.test(e)&&(e+="/"),e+="a";do e=U.dirname(e);while(V(e,{strict:r})||/(^|[^\\])([\{\[]|\([^\)]+$)/.test(e));return e.replace(/\\([\*\?\|\[\]\(\)\{\}])/g,"$1")}function Pe(e,r={}){let n=Ae(e,r),l=V(e,r),t;return n!="."?(t=e.substr(n.length),t.startsWith("/")&&(t=t.substr(1))):t=e,l||(n=U.dirname(e),t=n!=="."?e.substr(n.length):e),t.startsWith("./")&&(t=t.substr(2)),t.startsWith("/")&&(t=t.substr(1)),{base:n,glob:t,isGlob:l}}Y.exports=Pe});var ie=D((Fe,te)=>{"use strict";var I=C("fs"),Ee=Q(),{promisify:ee}=C("util"),ze=Z(),{join:q,resolve:J,relative:Oe}=C("path"),ke=/(^|[\\\/])\.[^\\\/\.]/g,We=ee(I.readdir),Te=ee(I.stat),L={};async function ne(e,r,n,l,t="",s=0){let c=n.segments[s],a=J(l.cwd,r,t),g=await We(a),{dot:w,filesOnly:d}=l,h=0,o=g.length,i,u,y,f,m;for(;h<o;h++)if(u=q(a,i=g[h]),y=t?q(t,i):i,!(!w&&ke.test(y))){if(m=n.regex.test(y),(f=L[y])===void 0&&(L[y]=f=I.lstatSync(u)),!f.isDirectory()){m&&e.push(Oe(l.cwd,u));continue}c&&!c.test(i)||(!d&&m&&e.push(q(r,y)),await ne(e,r,n,l,y,c&&c.toString()!==n.globstar&&s+1))}}te.exports=async function(e,r={}){if(!e)return[];let n=ze(e);if(r.cwd=r.cwd||".",!n.isGlob)try{let s=J(r.cwd,e),c=await Te(s);return r.filesOnly&&!c.isFile()?[]:r.absolute?[s]:[e]}catch(s){if(s.code!="ENOENT")throw s;return[]}r.flush&&(L={});let l=[],{path:t}=Ee(n.glob,{filepath:!0,globstar:!0,extended:!0});return t.globstar=t.globstar.toString(),await ne(l,n.base,t,r,".",0),r.absolute?l.map(s=>J(r.cwd,s)):l}});import{existsSync as O,readFileSync as W,writeFileSync as De}from"node:fs";import{dirname as _e,relative as se,resolve as x,sep as M}from"node:path";var le=me(ie(),1);import Ne from"detect-indent";import{loadFile as je}from"magicast";import{getDefaultExportOptions as Ge}from"magicast/helpers";import{run as qe}from"npm-check-updates";function b(...e){let r=" ";return(n,l)=>e.reduce((t,s)=>typeof s=="number"?`${new Array(s).fill(r).join("")}${t}`:typeof s=="string"?`${s}${t}`:s(t),B.includes(n)?p(n,l):n)}async function ce(e){let r=await qe({deep:!0,cwd:process.cwd(),filter:n=>n.startsWith($)||n.startsWith(R)||["typescript","vite"].includes(n),target:n=>(n.startsWith($)||n.startsWith(R))&&e?"@next":"@latest"});return r||(A.error(p("errors.npm-error")),process.exit(1)),Promise.all(Object.entries(r).filter(([n])=>{try{return W(x(n)).toString().includes($)}catch{return!1}}).map(async([n,l])=>{let t=x(_e(n)),s=x(t,"tsconfig.json"),c=x(t,"package.json"),a=x(t,".npmrc"),[g]=await(0,le.default)(`${oe(t)}/alliance.config*`);return{path:oe(se(process.cwd(),t)),packageJson:O(c)?k(c,t):void 0,tsConfigJson:O(s)?k(s,t):void 0,allianceConfig:O(g)?k(g,t):void 0,npmConfig:O(a)?k(a,t):void 0,upgrades:l}}))}async function ae({tsConfigJson:e}){if(!e)return;let{warn:r,error:n,output:l}=T(e.relative);try{let t=_(W(e.full).toString());t?.compilerOptions?.moduleResolution?.toLowerCase()!=="bundler"&&r(p("warnings.change",{property:"compilerOptions.moduleResolution",current:t?.compilerOptions?.moduleResolution,new:"bundler"}))}catch(t){n(t)}l()}async function fe({npmConfig:e}){let{error:r,output:n,recommend:l}=T(e?.relative||".npmrc");if(!e)l(p("recommendations.add.webprovisions-registry-config"));else try{W(e.full).toString().includes(`${ge}:registry=https://registry.webprovisions.io`)||l(p("recommendations.update.webprovisions-registry-config"))}catch(t){r(t)}n()}async function ue({allianceConfig:e}){if(!e)return;let{warn:r,error:n,output:l}=T(e.relative,!1);try{let t=await je(e.full),s=Ge(t);typeof s?.experimental?.logging=="boolean"&&r(p("warnings.remove",{property:"experimental.logging",alt:`, use ${P("'server.logging'")} instead`})),typeof s?.server?.mode<"u"&&r(p("warnings.remove",{property:"server.mode",alt:", no longer supported"}))}catch(t){n(t)}l()}async function pe({packageJson:e,allianceConfig:r,tsConfigJson:n,upgrades:l}){if(!e)return;let{change:t,warn:s,output:c,error:a,recommend:g}=T(e.relative,!!r||!!n);try{let w=W(e.full).toString(),d=_(w);if(d.publishConfig?.registry!=="https://registry.webprovisions.io"&&s(p("warnings.set",{property:"publishConfig.registry",new:"https://registry.webprovisions.io"})),d.publishConfig?.access!=="public"&&s(p("warnings.set",{property:"publishConfig.access",new:"public"})),d.alliance?.apps&&s(p("warnings.remove",{property:"alliance.apps",alt:`, use the app config ${P("'server.apps'")} option instead`})),d.scripts){let o=Object.entries(d.scripts).filter(([i,u])=>u.includes("create alliance")||u.includes("create-alliance"));for(let[i,u]of o)try{u.includes("serve")||u.includes("server")?(s(p("warnings.change",{property:`scripts.${i}`,current:u,new:"npx @telia-ace/alliance-cli serve"})),u.includes("--server-mode")&&s(p("warnings.remove",{property:"--server-mode",alt:", no longer supported"}))):u.includes("build")&&s(p("warnings.change",{property:`scripts.${i}`,current:u,new:"npx @telia-ace/alliance-cli build"}))}catch(y){a(y)}}for(let o of Object.keys({...d?.dependencies,...d?.devDependencies})){if(!o.startsWith(re))continue;let i=o.replace(re,"");g(p("recommendations.update.webprovisions-registry-app",{pkg:o,wpPkg:`${R}${i}`}))}let h=o=>{if(o)for(let i of Object.keys(o))!i.startsWith($)&&!i.startsWith(R)||!l[i]||(o[i]=l[i])};h(d.dependencies),h(d.devDependencies);for(let[o,i]of Object.entries(l))o.startsWith($)||o.startsWith(R)?t(p("changes.upgraded",{pkg:o,v:i})):g(p("recommendations.upgrade",{pkg:o,v:i}));De(e.full,JSON.stringify(d,null,Ne(w).indent))}catch(w){a(w)}c()}var $="@telia-ace",ge="@webprovisions-registry",re=`${$}/alliance-app-`,R=`${ge}/alliance-app-`;function T(e,r=!0){let n=[],l=[],t=[],s=[];return{warn:c=>l.push(c),change:c=>n.push(c),recommend:c=>t.push(c),error:c=>s.push(c),output:()=>{if(!n.length&&!l.length&&!t.length)return;console.log(b(H,1)(e));let c=b("- ",2);if(n.length){console.log(b(2,P)("info.header.changes"));for(let a of n)console.log(c(a))}if(l.length){console.log(b(2,N)("info.header.warnings"));for(let a of l)console.log(c(a))}if(t.length){console.log(b(2,F)("info.header.recommendations"));for(let a of t)console.log(c(a))}if(s.length){console.log(b(2,N)("Errors"));for(let a of s)A.error(c(a))}r&&console.log()}}}function oe(e){return e.replaceAll(M,"/")}function k(e,r=process.cwd()){let n=x(process.cwd(),e);return{full:n.replaceAll(M,"/"),relative:se(r,n).replaceAll(M,"/")}}function de(){let e=Je();return A.log(b(z,E)("info.next-steps")),console.log([p("info.steps.warnings"),p("info.steps.install",{cmd:`${e} install`})].map(r=>b("- ",1)(r)).join(`
4
+ `))}function Je(){try{if(!process.env.npm_config_user_agent)return"npm";let r=process.env.npm_config_user_agent.split(" ")[0],n=r.lastIndexOf("/"),l=r.substring(0,n);return l==="npminstall"?"cnpm":l}catch{return"npm"}}var rn={meta:{name:"upgrade",description:p("command.upgrade")},args:{next:{type:"boolean",description:p("arg.upgrade.next"),default:!1,required:!1,alias:"n"}},async run(e){let r=await ce(e.args.next);for(let n of r)console.log(),console.log(b(z,E)(n.path||"root")),await fe(n),await pe(n),await ae(n),await ue(n);console.log(),de(),console.log()}};export{rn as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/alliance-cli",
3
- "version": "1.1.1-next.0",
3
+ "version": "1.1.2-next.0",
4
4
  "description": "CLI used when developing ACE Alliance apps.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "type": "module",
@@ -18,11 +18,11 @@
18
18
  "npm-check-updates": "^16.14.11",
19
19
  "signal-exit": "^4.1.0",
20
20
  "vite": "^5.0.7",
21
- "@telia-ace/alliance-gateway": "^1.1.1-next.0",
21
+ "@telia-ace/alliance-gateway": "^1.1.1",
22
22
  "@telia-ace/alliance-internal-node-utilities": "^1.1.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@telia-ace/alliance-framework": "^1.1.1-next.0"
25
+ "@telia-ace/alliance-framework": "^1.1.1"
26
26
  },
27
27
  "engines": {
28
28
  "node": ">=15.0.0"
@@ -1,4 +0,0 @@
1
- import { createRequire as c__createRequire } from 'node:module';
2
- const require = c__createRequire(import.meta.url);
3
- import{a as p,i as r,j as l,m,n as f,o as c}from"./chunk-CWA32LZ6.js";import"./chunk-TTCH5DKE.js";import{l as s}from"./chunk-AEIX73UA.js";import{existsSync as v,readFileSync as h,rmSync as S}from"node:fs";import{start as x}from"@telia-ace/alliance-gateway/dev";import{createIndexHtml as b,getAppManifests as A}from"@telia-ace/alliance-internal-node-utilities";import{onExit as D}from"signal-exit";import y from"node:dns";import{createServer as g}from"vite";var w=process.env.CI==="true"||process.env.NODE_ENV==="test";async function d(e){let t=f("serve",e);y.setDefaultResultOrder("verbatim");let i=await g({plugins:e.vite.plugins,configFile:!1,mode:e.build.mode,server:{open:e.server.open,port:e.server.ports.server,host:"localhost",proxy:{"/-/":{target:`http://localhost:${e.server.ports.gateway}/`,prependPath:!1,rewrite:o=>o.replace("/-/","/")}},strictPort:!0},clearScreen:!1,resolve:{alias:e.vite.alias},define:t}).then(o=>o.listen());return(w?console.log:s.box)([r("info.server-url",{url:`http://localhost:${e.server.ports.server}`}),r("info.gateway-url",{url:`http://localhost:${e.server.ports.gateway}`}),r("info.stop-server")].join(`
4
- `)),i}async function u(e){let t,i,o;D(()=>{if(t)try{t.close()}catch(n){s.error(n)}if(i&&v(i))try{S(i,{force:!0})}catch(n){s.error(n)}if(o)try{o.close()}catch(n){s.error(n)}});let a=await A(e.server.apps);v(e.entries.manifest)&&a.unshift(p(h(e.entries.manifest).toString())),t=await x(e,a),i=b(c(e)),o=await d(e)}var _={meta:{name:"serve",description:r("command.serve")},args:{"ports.server":{type:"string",description:r("arg.serve.ports.server"),required:!1},"ports.gateway":{type:"string",description:r("arg.serve.ports.gateway"),required:!1},"entries.app":{type:"string",valueHint:"./src/app.ts",description:r("arg.entries.app"),required:!1},"entries.manifest":{type:"string",valueHint:"./src/manifest.json",description:r("arg.entries.manifest"),required:!1},mode:{type:"string",default:"development",alias:"m",description:r("arg.mode"),required:!1},logging:{type:"boolean",default:!1,alias:"l",description:r("arg.serve.logging"),required:!1},open:{type:"boolean",default:!1,alias:"o",description:r("arg.serve.open"),required:!1},config:l},async run({args:e}){let t=await m({command:"serve",mode:e.mode||"production"},e.config,{build:{mode:e.mode},server:{open:e.open,ports:{gateway:e["ports.gateway"]?Number(e["ports.gateway"]):void 0,server:e["ports.server"]?Number(e["ports.server"]):void 0},logging:e.logging},entries:{app:e["entries.app"],manifest:e["entries.manifest"]}});await u(t)}};export{_ as default};
@@ -1,4 +0,0 @@
1
- import { createRequire as c__createRequire } from 'node:module';
2
- const require = c__createRequire(import.meta.url);
3
- import{a as P,b as I,c as C,d as z,e as M,f as E,g as A,h as F,i as p}from"./chunk-CWA32LZ6.js";import"./chunk-TTCH5DKE.js";import{a as b,c as O,e as fe,l as S}from"./chunk-AEIX73UA.js";var X=O((Ne,B)=>{"use strict";var H=process.platform==="win32",ue=H?"\\\\+":"\\/",T=H?"\\\\":"/",ge="((?:[^/]*(?:/|$))*)",pe="([^/]*)",k=`((?:[^${T}]*(?:${T}|$))*)`,de=`([^${T}]*)`;function me(e,{extended:r=!1,globstar:t=!1,strict:l=!1,filepath:i=!1,flags:s=""}={}){let c="",a="",m={regex:"",segments:[]},w=!1,h=!1,d=[];function o(f,{split:g,last:R,only:$}={}){$!=="path"&&(c+=f),i&&$!=="regex"&&(m.regex+=f==="\\/"?ue:f,g?(R&&(a+=f),a!==""&&(s.includes("g")||(a=`^${a}$`),m.segments.push(new RegExp(a,s))),a=""):a+=f)}let n,u;for(let f=0;f<e.length;f++){if(n=e[f],u=e[f+1],["\\","$","^",".","="].includes(n)){o(`\\${n}`);continue}if(n==="/"){o(`\\${n}`,{split:!0}),u==="/"&&!l&&(c+="?");continue}if(n==="("){if(d.length){o(n);continue}o(`\\${n}`);continue}if(n===")"){if(d.length){o(n);let g=d.pop();o(g==="@"?"{1}":g==="!"?"([^/]*)":g);continue}o(`\\${n}`);continue}if(n==="|"){if(d.length){o(n);continue}o(`\\${n}`);continue}if(n==="+"){if(u==="("&&r){d.push(n);continue}o(`\\${n}`);continue}if(n==="@"&&r&&u==="("){d.push(n);continue}if(n==="!"){if(r){if(h){o("^");continue}if(u==="("){d.push(n),o("(?!"),f++;continue}o(`\\${n}`);continue}o(`\\${n}`);continue}if(n==="?"){if(r){u==="("?d.push(n):o(".");continue}o(`\\${n}`);continue}if(n==="["){if(h&&u===":"){f++;let g="";for(;e[++f]!==":";)g+=e[f];g==="alnum"?o("(\\w|\\d)"):g==="space"?o("\\s"):g==="digit"&&o("\\d"),f++;continue}if(r){h=!0,o(n);continue}o(`\\${n}`);continue}if(n==="]"){if(r){h=!1,o(n);continue}o(`\\${n}`);continue}if(n==="{"){if(r){w=!0,o("(");continue}o(`\\${n}`);continue}if(n==="}"){if(r){w=!1,o(")");continue}o(`\\${n}`);continue}if(n===","){if(w){o("|");continue}o(`\\${n}`);continue}if(n==="*"){if(u==="("&&r){d.push(n);continue}let g=e[f-1],R=1;for(;e[f+1]==="*";)R++,f++;let $=e[f+1];t?R>1&&(g==="/"||g===void 0)&&($==="/"||$===void 0)?(o(ge,{only:"regex"}),o(k,{only:"path",last:!0,split:!0}),f++):(o(pe,{only:"regex"}),o(de,{only:"path"})):o(".*");continue}o(n)}s.includes("g")||(c=`^${c}$`,a=`^${a}$`,i&&(m.regex=`^${m.regex}$`));let y={regex:new RegExp(c,s)};return i&&(m.segments.push(new RegExp(a,s)),m.regex=new RegExp(m.regex,s),m.globstar=new RegExp(s.includes("g")?k:`^${k}$`,s),y.path=m),y}B.exports=me});var V=O((Ge,U)=>{"use strict";var he=b("os"),K=b("path"),ye=he.platform()==="win32",we={"{":"}","(":")","[":"]"},xe=/\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\)|(\\).|([@?!+*]\(.*\)))/,$e=/\\(.)|(^!|[*?{}()[\]]|\(\?)/;function Q(e,{strict:r=!0}={}){if(e==="")return!1;let t,l=r?xe:$e;for(;t=l.exec(e);){if(t[2])return!0;let i=t.index+t[0].length,s=t[1],c=s?we[s]:null;if(s&&c){let a=e.indexOf(c,i);a!==-1&&(i=a+1)}e=e.slice(i)}return!1}function be(e,{strict:r=!1}={}){ye&&e.includes("/")&&(e=e.split("\\").join("/")),/[\{\[].*[\/]*.*[\}\]]$/.test(e)&&(e+="/"),e+="a";do e=K.dirname(e);while(Q(e,{strict:r})||/(^|[^\\])([\{\[]|\([^\)]+$)/.test(e));return e.replace(/\\([\*\?\|\[\]\(\)\{\}])/g,"$1")}function ve(e,r={}){let t=be(e,r),l=Q(e,r),i;return t!="."?(i=e.substr(t.length),i.startsWith("/")&&(i=i.substr(1))):i=e,l||(t=K.dirname(e),i=t!=="."?e.substr(t.length):e),i.startsWith("./")&&(i=i.substr(2)),i.startsWith("/")&&(i=i.substr(1)),{base:t,glob:i,isGlob:l}}U.exports=ve});var ne=O((qe,ee)=>{"use strict";var j=b("fs"),Re=X(),{promisify:Y}=b("util"),Se=V(),{join:_,resolve:D,relative:Ce}=b("path"),Ee=/(^|[\\\/])\.[^\\\/\.]/g,Ae=Y(j.readdir),Oe=Y(j.stat),W={};async function Z(e,r,t,l,i="",s=0){let c=t.segments[s],a=D(l.cwd,r,i),m=await Ae(a),{dot:w,filesOnly:h}=l,d=0,o=m.length,n,u,y,f,g;for(;d<o;d++)if(u=_(a,n=m[d]),y=i?_(i,n):n,!(!w&&Ee.test(y))){if(g=t.regex.test(y),(f=W[y])===void 0&&(W[y]=f=j.lstatSync(u)),!f.isDirectory()){g&&e.push(Ce(l.cwd,u));continue}c&&!c.test(n)||(!h&&g&&e.push(_(r,y)),await Z(e,r,t,l,y,c&&c.toString()!==t.globstar&&s+1))}}ee.exports=async function(e,r={}){if(!e)return[];let t=Se(e);if(r.cwd=r.cwd||".",!t.isGlob)try{let s=D(r.cwd,e),c=await Oe(s);return r.filesOnly&&!c.isFile()?[]:r.absolute?[s]:[e]}catch(s){if(s.code!="ENOENT")throw s;return[]}r.flush&&(W={});let l=[],{path:i}=Re(t.glob,{filepath:!0,globstar:!0,extended:!0});return i.globstar=i.globstar.toString(),await Z(l,t.base,i,r,".",0),r.absolute?l.map(s=>D(r.cwd,s)):l}});import{existsSync as N,readFileSync as J,writeFileSync as Pe}from"node:fs";import{dirname as ze,relative as ie,resolve as v,sep as q}from"node:path";var re=fe(ne(),1);import ke from"detect-indent";import{loadFile as Te}from"magicast";import{getDefaultExportOptions as _e}from"magicast/helpers";import{run as De}from"npm-check-updates";function x(...e){let r=" ";return(t,l)=>e.reduce((i,s)=>typeof s=="number"?`${new Array(s).fill(r).join("")}${i}`:typeof s=="string"?`${s}${i}`:s(i),F.includes(t)?p(t,l):t)}async function oe(e){let r=await De({deep:!0,cwd:process.cwd(),filter:t=>t.startsWith("@telia-ace")||["typescript","vite"].includes(t),target:t=>t.startsWith("@telia-ace")&&e?"@next":"@latest"});return r||(S.error(p("errors.npm-error")),process.exit(1)),Promise.all(Object.entries(r).filter(([t])=>{try{return J(v(t)).toString().includes("@telia-ace")}catch{return!1}}).map(async([t,l])=>{let i=v(ze(t)),s=v(i,"tsconfig.json"),c=v(i,"package.json"),[a]=await(0,re.default)(`${te(i)}/alliance.config*`);return{path:te(ie(process.cwd(),i)),packageJson:N(c)?G(c,i):void 0,tsConfigJson:N(s)?G(s,i):void 0,allianceConfig:N(a)?G(a,i):void 0,upgrades:l}}))}async function se({tsConfigJson:e}){if(!e)return;let{warn:r,error:t,output:l}=L(e.relative);try{let i=P(J(e.full).toString());i?.compilerOptions?.moduleResolution?.toLowerCase()!=="bundler"&&r(p("warnings.change",{property:"compilerOptions.moduleResolution",current:i?.compilerOptions?.moduleResolution,new:"bundler"}))}catch(i){t(i)}l()}async function le({allianceConfig:e}){if(!e)return;let{warn:r,error:t,output:l}=L(e.relative,!1);try{let i=await Te(e.full),s=_e(i);typeof s?.experimental?.logging=="boolean"&&r(p("warnings.remove",{property:"experimental.logging",alt:`, use ${C("'server.logging'")} instead`})),typeof s?.server?.mode<"u"&&r(p("warnings.remove",{property:"experimental.mode",alt:", no longer supported"}))}catch(i){t(i)}l()}async function ce({packageJson:e,allianceConfig:r,tsConfigJson:t,upgrades:l}){if(!e)return;let{change:i,warn:s,output:c,error:a,recommend:m}=L(e.relative,!!r||!!t);try{let w=J(e.full).toString(),h=P(w);if(h.alliance?.apps&&s(p("warnings.remove",{property:"alliance.apps",alt:`, use the app config ${C("'server.apps'")} option instead`})),h.scripts){let o=Object.entries(h.scripts).filter(([n,u])=>u.includes("create alliance")||u.includes("create-alliance"));for(let[n,u]of o)try{u.includes("serve")||u.includes("server")?(s(p("warnings.change",{property:`scripts.${n}`,current:u,new:"npx @telia-ace/alliance-cli serve"})),u.includes("--server-mode")&&s(p("warnings.remove",{property:"--server-mode",alt:", no longer supported"}))):u.includes("build")&&s(p("warnings.change",{property:`scripts.${n}`,current:u,new:"npx @telia-ace/alliance-cli build"}))}catch(y){a(y)}}let d=o=>{if(o)for(let n of Object.keys(o))!n.startsWith("@telia-ace")||!l[n]||(o[n]=l[n])};d(h.dependencies),d(h.devDependencies);for(let[o,n]of Object.entries(l))o.startsWith("@telia-ace")?i(p("changes.upgraded",{pkg:o,v:n})):m(p("recommendations.upgrade",{pkg:o,v:n}));Pe(e.full,JSON.stringify(h,null,ke(w).indent))}catch(w){a(w)}c()}function L(e,r=!0){let t=[],l=[],i=[],s=[];return{warn:c=>l.push(c),change:c=>t.push(c),recommend:c=>i.push(c),error:c=>s.push(c),output:()=>{if(!t.length&&!l.length&&!i.length)return;console.log(x(M,1)(e));let c=x("- ",2);if(t.length){console.log(x(2,C)("info.header.changes"));for(let a of t)console.log(c(a))}if(l.length){console.log(x(2,z)("info.header.warnings"));for(let a of l)console.log(c(a))}if(i.length){console.log(x(2,I)("info.header.recommendations"));for(let a of i)console.log(c(a))}if(s.length){console.log(x(2,z)("Errors"));for(let a of s)S.error(c(a))}r&&console.log()}}}function te(e){return e.replaceAll(q,"/")}function G(e,r=process.cwd()){let t=v(process.cwd(),e);return{full:t.replaceAll(q,"/"),relative:ie(r,t).replaceAll(q,"/")}}function ae(){let e=We();return S.log(x(A,E)("info.next-steps")),console.log([p("info.steps.warnings"),p("info.steps.install",{cmd:`${e} install`})].map(r=>x("- ",1)(r)).join(`
4
- `))}function We(){try{if(!process.env.npm_config_user_agent)return"npm";let r=process.env.npm_config_user_agent.split(" ")[0],t=r.lastIndexOf("/"),l=r.substring(0,t);return l==="npminstall"?"cnpm":l}catch{return"npm"}}var Ye={meta:{name:"upgrade",description:p("command.upgrade")},args:{next:{type:"boolean",description:p("arg.upgrade.next"),default:!1,required:!1,alias:"n"}},async run(e){let r=await oe(e.args.next);for(let t of r)console.log(),console.log(x(A,E)(t.path||"root")),await ce(t),await se(t),await le(t);console.log(),ae(),console.log()}};export{Ye as default};