diff --git a/dist/index.mjs b/dist/index.mjs index a8375cf..a32bcbb 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -165,7 +165,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Ca,s=!la.jitless,c=s&&wa.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Fs([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Rs(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Ra(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Va(e,r,ua())))}),t)}const zs=z(`$ZodUnion`,(e,t)=>{Qo.init(e,t),_a(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),_a(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),_a(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),_a(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ha(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>Rs(t,i,e,a)):Rs(s,i,e,a)}}),Bs=z(`$ZodIntersection`,(e,t)=>{Qo.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Hs(e,t,n)):Hs(e,i,a)}});function Vs(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ta(e)&&Ta(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Vs(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;re.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Ra(e))return e;let o=Vs(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Us=z(`$ZodEnum`,(e,t)=>{Qo.init(e,t);let n=da(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Da.has(typeof e)).map(e=>typeof e==`string`?Oa(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ws=z(`$ZodTransform`,(e,t)=>{Qo.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ca(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new sa;return n.value=i,n}});function Gs(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Ks=z(`$ZodOptional`,(e,t)=>{Qo.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,_a(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),_a(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ha(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Gs(t,e.value)):Gs(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),qs=z(`$ZodExactOptional`,(e,t)=>{Ks.init(e,t),_a(e._zod,`values`,()=>t.innerType._zod.values),_a(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Js=z(`$ZodNullable`,(e,t)=>{Qo.init(e,t),_a(e._zod,`optin`,()=>t.innerType._zod.optin),_a(e._zod,`optout`,()=>t.innerType._zod.optout),_a(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ha(e.source)}|null)$`):void 0}),_a(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ys=z(`$ZodDefault`,(e,t)=>{Qo.init(e,t),e._zod.optin=`optional`,_a(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Xs(e,t)):Xs(r,t)}});function Xs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Zs=z(`$ZodPrefault`,(e,t)=>{Qo.init(e,t),e._zod.optin=`optional`,_a(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Qs=z(`$ZodNonOptional`,(e,t)=>{Qo.init(e,t),_a(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>$s(t,e)):$s(i,e)}});function $s(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const ec=z(`$ZodCatch`,(e,t)=>{Qo.init(e,t),_a(e._zod,`optin`,()=>t.innerType._zod.optin),_a(e._zod,`optout`,()=>t.innerType._zod.optout),_a(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Va(e,n,ua()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Va(e,n,ua()))},input:e.value}),e.issues=[]),e)}}),tc=z(`$ZodPipe`,(e,t)=>{Qo.init(e,t),_a(e._zod,`values`,()=>t.in._zod.values),_a(e._zod,`optin`,()=>t.in._zod.optin),_a(e._zod,`optout`,()=>t.out._zod.optout),_a(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>nc(e,t.in,n)):nc(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>nc(e,t.out,n)):nc(r,t.out,n)}});function nc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const rc=z(`$ZodReadonly`,(e,t)=>{Qo.init(e,t),_a(e._zod,`propValues`,()=>t.innerType._zod.propValues),_a(e._zod,`values`,()=>t.innerType._zod.values),_a(e._zod,`optin`,()=>t.innerType?._zod?.optin),_a(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ic):ic(r)}});function ic(e){return e.value=Object.freeze(e.value),e}const ac=z(`$ZodCustom`,(e,t)=>{Ro.init(e,t),Qo.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>oc(t,n,r,e));oc(i,n,r,e)}});function oc(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ua(e))}}var sc,cc=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function lc(){return new cc}(sc=globalThis).__zod_globalRegistry??(sc.__zod_globalRegistry=lc());const uc=globalThis.__zod_globalRegistry;function dc(e,t){return new e({type:`string`,...B(t)})}function fc(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...B(t)})}function pc(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...B(t)})}function mc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...B(t)})}function hc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...B(t)})}function gc(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...B(t)})}function _c(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...B(t)})}function vc(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...B(t)})}function yc(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...B(t)})}function bc(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...B(t)})}function xc(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...B(t)})}function Sc(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...B(t)})}function Cc(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...B(t)})}function wc(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...B(t)})}function Tc(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...B(t)})}function Ec(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...B(t)})}function Dc(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...B(t)})}function Oc(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...B(t)})}function kc(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...B(t)})}function Ac(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...B(t)})}function jc(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...B(t)})}function Mc(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...B(t)})}function Nc(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...B(t)})}function Pc(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...B(t)})}function Fc(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...B(t)})}function Ic(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...B(t)})}function Lc(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...B(t)})}function Rc(e,t){return new e({type:`boolean`,...B(t)})}function zc(e,t){return new e({type:`null`,...B(t)})}function Bc(e){return new e({type:`unknown`})}function Vc(e,t){return new e({type:`never`,...B(t)})}function Hc(e,t){return new zo({check:`max_length`,...B(t),maximum:e})}function Uc(e,t){return new Bo({check:`min_length`,...B(t),minimum:e})}function Wc(e,t){return new Vo({check:`length_equals`,...B(t),length:e})}function Gc(e,t){return new Uo({check:`string_format`,format:`regex`,...B(t),pattern:e})}function Kc(e){return new Wo({check:`string_format`,format:`lowercase`,...B(e)})}function qc(e){return new Go({check:`string_format`,format:`uppercase`,...B(e)})}function Jc(e,t){return new Ko({check:`string_format`,format:`includes`,...B(t),includes:e})}function Yc(e,t){return new qo({check:`string_format`,format:`starts_with`,...B(t),prefix:e})}function Xc(e,t){return new Jo({check:`string_format`,format:`ends_with`,...B(t),suffix:e})}function Zc(e){return new Yo({check:`overwrite`,tx:e})}function Qc(e){return Zc(t=>t.normalize(e))}function $c(){return Zc(e=>e.trim())}function el(){return Zc(e=>e.toLowerCase())}function tl(){return Zc(e=>e.toUpperCase())}function nl(){return Zc(e=>xa(e))}function rl(e,t,n){return new e({type:`array`,element:t,...B(n)})}function il(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...B(n)})}function al(e){let t=ol(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Ua(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Ua(r))}},e(n.value,n)));return t}function ol(e,t){let n=new Ro({check:`custom`,...B(t)});return n._zod.check=e,n}function sl(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??uc,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function cl(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,cl(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&dl(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ll(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ul(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:pl(t,`input`,e.processors),output:pl(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function dl(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return dl(r.element,n);if(r.type===`set`)return dl(r.valueType,n);if(r.type===`lazy`)return dl(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return dl(r.innerType,n);if(r.type===`intersection`)return dl(r.left,n)||dl(r.right,n);if(r.type===`record`||r.type===`map`)return dl(r.keyType,n)||dl(r.valueType,n);if(r.type===`pipe`)return dl(r.in,n)||dl(r.out,n);if(r.type===`object`){for(let e in r.shape)if(dl(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(dl(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(dl(e,n))return!0;return!!(r.rest&&dl(r.rest,n))}return!1}const fl=(e,t={})=>n=>{let r=sl({...n,processors:t});return cl(e,r),ll(r,e),ul(r,e)},pl=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=sl({...i??{},target:a,io:t,processors:n});return cl(e,o),ll(o,e),ul(o,e)},ml={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},hl=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ml[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},gl=(e,t,n,r)=>{n.type=`boolean`},_l=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},vl=(e,t,n,r)=>{n.not={}},yl=(e,t,n,r)=>{let i=e._zod.def,a=da(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},bl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},xl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Sl=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=cl(a.element,t,{...r,path:[...r.path,`items`]})},Cl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=cl(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=cl(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},wl=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>cl(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Tl=(e,t,n,r)=>{let i=e._zod.def,a=cl(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=cl(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},El=(e,t,n,r)=>{let i=e._zod.def,a=cl(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Dl=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ol=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},kl=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Al=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},jl=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;cl(a,t,r);let o=t.seen.get(e);o.ref=a},Ml=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Nl=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Pl=z(`ZodISODateTime`,(e,t)=>{fs.init(e,t),su.init(e,t)});function Fl(e){return Pc(Pl,e)}const Il=z(`ZodISODate`,(e,t)=>{ps.init(e,t),su.init(e,t)});function Ll(e){return Fc(Il,e)}const Rl=z(`ZodISOTime`,(e,t)=>{ms.init(e,t),su.init(e,t)});function zl(e){return Ic(Rl,e)}const Bl=z(`ZodISODuration`,(e,t)=>{hs.init(e,t),su.init(e,t)});function Vl(e){return Lc(Bl,e)}const Hl=(e,t)=>{Ga.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ja(e,t)},flatten:{value:t=>qa(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,fa,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,fa,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ul=z(`ZodError`,Hl),Wl=z(`ZodError`,Hl,{Parent:Error}),Gl=Ya(Wl),Kl=Xa(Wl),ql=Za(Wl),Jl=$a(Wl),Yl=to(Wl),Xl=no(Wl),Zl=ro(Wl),Ql=io(Wl),$l=ao(Wl),eu=oo(Wl),tu=so(Wl),nu=co(Wl),ru=z(`ZodType`,(e,t)=>(Qo.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:pl(e,`input`),output:pl(e,`output`)}}),e.toJSONSchema=fl(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(ya(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>ka(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Gl(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ql(e,t,n),e.parseAsync=async(t,n)=>Kl(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Jl(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Yl(e,t,n),e.decode=(t,n)=>Xl(e,t,n),e.encodeAsync=async(t,n)=>Zl(e,t,n),e.decodeAsync=async(t,n)=>Ql(e,t,n),e.safeEncode=(t,n)=>$l(e,t,n),e.safeDecode=(t,n)=>eu(e,t,n),e.safeEncodeAsync=async(t,n)=>tu(e,t,n),e.safeDecodeAsync=async(t,n)=>nu(e,t,n),e.refine=(t,n)=>e.check(fd(t,n)),e.superRefine=t=>e.check(pd(t)),e.overwrite=t=>e.check(Zc(t)),e.optional=()=>Ju(e),e.exactOptional=()=>Xu(e),e.nullable=()=>Qu(e),e.nullish=()=>Ju(Qu(e)),e.nonoptional=t=>id(e,t),e.array=()=>Iu(e),e.or=t=>Bu([e,t]),e.and=t=>Hu(e,t),e.transform=t=>cd(e,Ku(t)),e.default=t=>ed(e,t),e.prefault=t=>nd(e,t),e.catch=t=>od(e,t),e.pipe=t=>cd(e,t),e.readonly=()=>ud(e),e.describe=t=>{let n=e.clone();return uc.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return uc.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return uc.get(e);let n=e.clone();return uc.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),iu=z(`_ZodString`,(e,t)=>{$o.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hl(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Gc(...t)),e.includes=(...t)=>e.check(Jc(...t)),e.startsWith=(...t)=>e.check(Yc(...t)),e.endsWith=(...t)=>e.check(Xc(...t)),e.min=(...t)=>e.check(Uc(...t)),e.max=(...t)=>e.check(Hc(...t)),e.length=(...t)=>e.check(Wc(...t)),e.nonempty=(...t)=>e.check(Uc(1,...t)),e.lowercase=t=>e.check(Kc(t)),e.uppercase=t=>e.check(qc(t)),e.trim=()=>e.check($c()),e.normalize=(...t)=>e.check(Qc(...t)),e.toLowerCase=()=>e.check(el()),e.toUpperCase=()=>e.check(tl()),e.slugify=()=>e.check(nl())}),au=z(`ZodString`,(e,t)=>{$o.init(e,t),iu.init(e,t),e.email=t=>e.check(fc(cu,t)),e.url=t=>e.check(vc(du,t)),e.jwt=t=>e.check(Nc(Eu,t)),e.emoji=t=>e.check(yc(fu,t)),e.guid=t=>e.check(pc(lu,t)),e.uuid=t=>e.check(mc(uu,t)),e.uuidv4=t=>e.check(hc(uu,t)),e.uuidv6=t=>e.check(gc(uu,t)),e.uuidv7=t=>e.check(_c(uu,t)),e.nanoid=t=>e.check(bc(pu,t)),e.guid=t=>e.check(pc(lu,t)),e.cuid=t=>e.check(xc(mu,t)),e.cuid2=t=>e.check(Sc(hu,t)),e.ulid=t=>e.check(Cc(gu,t)),e.base64=t=>e.check(Ac(Cu,t)),e.base64url=t=>e.check(jc(wu,t)),e.xid=t=>e.check(wc(_u,t)),e.ksuid=t=>e.check(Tc(vu,t)),e.ipv4=t=>e.check(Ec(yu,t)),e.ipv6=t=>e.check(Dc(bu,t)),e.cidrv4=t=>e.check(Oc(xu,t)),e.cidrv6=t=>e.check(kc(Su,t)),e.e164=t=>e.check(Mc(Tu,t)),e.datetime=t=>e.check(Fl(t)),e.date=t=>e.check(Ll(t)),e.time=t=>e.check(zl(t)),e.duration=t=>e.check(Vl(t))});function ou(e){return dc(au,e)}const su=z(`ZodStringFormat`,(e,t)=>{es.init(e,t),iu.init(e,t)}),cu=z(`ZodEmail`,(e,t)=>{rs.init(e,t),su.init(e,t)}),lu=z(`ZodGUID`,(e,t)=>{ts.init(e,t),su.init(e,t)}),uu=z(`ZodUUID`,(e,t)=>{ns.init(e,t),su.init(e,t)}),du=z(`ZodURL`,(e,t)=>{is.init(e,t),su.init(e,t)}),fu=z(`ZodEmoji`,(e,t)=>{as.init(e,t),su.init(e,t)}),pu=z(`ZodNanoID`,(e,t)=>{os.init(e,t),su.init(e,t)}),mu=z(`ZodCUID`,(e,t)=>{ss.init(e,t),su.init(e,t)}),hu=z(`ZodCUID2`,(e,t)=>{cs.init(e,t),su.init(e,t)}),gu=z(`ZodULID`,(e,t)=>{ls.init(e,t),su.init(e,t)}),_u=z(`ZodXID`,(e,t)=>{us.init(e,t),su.init(e,t)}),vu=z(`ZodKSUID`,(e,t)=>{ds.init(e,t),su.init(e,t)}),yu=z(`ZodIPv4`,(e,t)=>{gs.init(e,t),su.init(e,t)}),bu=z(`ZodIPv6`,(e,t)=>{_s.init(e,t),su.init(e,t)}),xu=z(`ZodCIDRv4`,(e,t)=>{vs.init(e,t),su.init(e,t)}),Su=z(`ZodCIDRv6`,(e,t)=>{ys.init(e,t),su.init(e,t)}),Cu=z(`ZodBase64`,(e,t)=>{xs.init(e,t),su.init(e,t)}),wu=z(`ZodBase64URL`,(e,t)=>{Cs.init(e,t),su.init(e,t)}),Tu=z(`ZodE164`,(e,t)=>{ws.init(e,t),su.init(e,t)}),Eu=z(`ZodJWT`,(e,t)=>{Es.init(e,t),su.init(e,t)}),Du=z(`ZodBoolean`,(e,t)=>{Ds.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gl(e,t,n,r)});function Ou(e){return Rc(Du,e)}const ku=z(`ZodNull`,(e,t)=>{Os.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_l(e,t,n,r)});function Au(e){return zc(ku,e)}const ju=z(`ZodUnknown`,(e,t)=>{ks.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Mu(){return Bc(ju)}const Nu=z(`ZodNever`,(e,t)=>{As.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vl(e,t,n,r)});function Pu(e){return Vc(Nu,e)}const Fu=z(`ZodArray`,(e,t)=>{Ms.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sl(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Uc(t,n)),e.nonempty=t=>e.check(Uc(1,t)),e.max=(t,n)=>e.check(Hc(t,n)),e.length=(t,n)=>e.check(Wc(t,n)),e.unwrap=()=>e.element});function Iu(e,t){return rl(Fu,e,t)}const Lu=z(`ZodObject`,(e,t)=>{Ls.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cl(e,t,n,r),_a(e,`shape`,()=>t.shape),e.keyof=()=>Wu(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Mu()}),e.loose=()=>e.clone({...e._zod.def,catchall:Mu()}),e.strict=()=>e.clone({...e._zod.def,catchall:Pu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Na(e,t),e.safeExtend=t=>Pa(e,t),e.merge=t=>Fa(e,t),e.pick=t=>ja(e,t),e.omit=t=>Ma(e,t),e.partial=(...t)=>Ia(qu,e,t[0]),e.required=(...t)=>La(rd,e,t[0])});function Ru(e,t){return new Lu({type:`object`,shape:e??{},...B(t)})}const zu=z(`ZodUnion`,(e,t)=>{zs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wl(e,t,n,r),e.options=t.options});function Bu(e,t){return new zu({type:`union`,options:e,...B(t)})}const Vu=z(`ZodIntersection`,(e,t)=>{Bs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tl(e,t,n,r)});function Hu(e,t){return new Vu({type:`intersection`,left:e,right:t})}const Uu=z(`ZodEnum`,(e,t)=>{Us.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yl(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Uu({...t,checks:[],...B(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Uu({...t,checks:[],...B(r),entries:i})}});function Wu(e,t){return new Uu({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...B(t)})}const Gu=z(`ZodTransform`,(e,t)=>{Ws.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xl(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ca(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ua(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Ua(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ku(e){return new Gu({type:`transform`,transform:e})}const qu=z(`ZodOptional`,(e,t)=>{Ks.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ju(e){return new qu({type:`optional`,innerType:e})}const Yu=z(`ZodExactOptional`,(e,t)=>{qs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xu(e){return new Yu({type:`optional`,innerType:e})}const Zu=z(`ZodNullable`,(e,t)=>{Js.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>El(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qu(e){return new Zu({type:`nullable`,innerType:e})}const $u=z(`ZodDefault`,(e,t)=>{Ys.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ol(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ed(e,t){return new $u({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ea(t)}})}const td=z(`ZodPrefault`,(e,t)=>{Zs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nd(e,t){return new td({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ea(t)}})}const rd=z(`ZodNonOptional`,(e,t)=>{Qs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function id(e,t){return new rd({type:`nonoptional`,innerType:e,...B(t)})}const ad=z(`ZodCatch`,(e,t)=>{ec.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Al(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function od(e,t){return new ad({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const sd=z(`ZodPipe`,(e,t)=>{tc.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jl(e,t,n,r),e.in=t.in,e.out=t.out});function cd(e,t){return new sd({type:`pipe`,in:e,out:t})}const ld=z(`ZodReadonly`,(e,t)=>{rc.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ml(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ud(e){return new ld({type:`readonly`,innerType:e})}const dd=z(`ZodCustom`,(e,t)=>{ac.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bl(e,t,n,r)});function fd(e,t={}){return il(dd,e,t)}function pd(e){return al(e)}var md=oa();const hd=Ru({cwd:ou().optional(),args:Iu(ou()).optional()}),gd=Bu([Au(),Ou(),hd,Iu(hd)]),_d=`Vite+`;function vd(){return{version:jr(`version`)||`latest`,nodeVersion:jr(`node-version`)||void 0,nodeVersionFile:jr(`node-version-file`)||void 0,workingDirectory:jr(`working-directory`)||void 0,runInstall:yd(jr(`run-install`)),cache:Mr(`cache`),cacheDependencyPath:jr(`cache-dependency-path`)||void 0,registryUrl:jr(`registry-url`)||void 0,scope:jr(`scope`)||void 0}}function yd(e){if(!e||e===`false`||e===`null`)return[];if(e===`true`)return[{}];let t=(0,md.parse)(e);try{let e=gd.parse(t);return e?e===!0?[{}]:Array.isArray(e)?e:[e]:[]}catch(e){throw e instanceof Ul?Error(`Invalid run-install input: ${e.issues.map(e=>e.message).join(`, `)}`):e}}function bd(){return N((process.platform===`win32`?process.env.USERPROFILE:process.env.HOME)||de(),`.vite-plus`)}function xd(){return process.env.GITHUB_WORKSPACE||process.cwd()}function Sd(e,t){return ee(e)?e:N(t,e)}function Cd(e){if(!e.workingDirectory)return xd();let t=Sd(e.workingDirectory,xd());if(!P(t))throw Error(`working-directory not found: ${e.workingDirectory} (resolved to ${t})`);if(!oe(t).isDirectory())throw Error(`working-directory is not a directory: ${e.workingDirectory} (resolved to ${t})`);return t}function wd(e,t){return t?Sd(t,e):e}const Td=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function Ed(e,t=xd()){if(e){let n=Sd(e,t);if(P(n)){let e=j(n),t=Td.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:Dd(n,e)}return}let n=ae(t);for(let e of Td)if(n.includes(e.filename)){let n=N(t,e.filename);return Rr(`Auto-detected lock file: ${e.filename}`),{type:e.type,path:n,filename:e.filename}}}function Dd(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}async function Od(e,t){switch(e){case`npm`:case`pnpm`:case`yarn`:case`bun`:return Ad(t);default:return[]}}async function kd(e,t,n){let r=`${e} ${t.join(` `)}`;try{let i=await Er(e,t,{cwd:n?.cwd,silent:!0,ignoreReturnCode:!0});if(i.exitCode===0)return i.stdout.trim();R(`Command "${r}" exited with code ${i.exitCode}`);return}catch(e){Lr(`Failed to run "${r}": ${String(e)}`);return}}async function Ad(e){let t=await kd(`vp`,[`pm`,`cache`,`dir`],{cwd:e});return t?[t]:[]}async function jd(e){let{version:t}=e;Rr(`Installing ${_d}@${t}...`);let n={...process.env,VP_VERSION:t,VITE_PLUS_VERSION:t},r=``;for(let e=1;e<=3;e++){try{let e=await Md(n);if(e===0){Nd();return}r=`exit code ${e}`}catch(e){r=e instanceof Error?e.message:String(e)}if(e<3){let t=2e3*e;Lr(`Failed to install ${_d} (${r}). Retrying in ${t}ms... (attempt ${e+1}/3)`),await ne(t)}}throw Error(`Failed to install ${_d} after 3 attempts: ${r}`)}async function Md(e){let t={env:e,ignoreReturnCode:!0};return process.platform===`win32`?Tr(`pwsh`,[`-Command`,`& ([scriptblock]::Create((irm https://viteplus.dev/install.ps1)))`],t):Tr(`bash`,[`-c`,`curl -fsSL https://viteplus.dev/install.sh | bash`],t)}function Nd(){let e=N(bd(),`bin`);process.env.PATH?.includes(e)||Ar(e)}function Pd(e,t){let n=e.trim();return n.length<=t?n:`…(truncated, showing last ${t} chars)…\n${n.slice(-t)}`}async function Fd(e){let t=Cd(e);for(let n of e.runInstall){let e=[`install`];n.args&&e.push(...n.args);let r=wd(t,n.cwd),i=`vp ${e.join(` `)}`;zr(`Running ${i} in ${r}...`);try{let{exitCode:t,stdout:n,stderr:a}=await Er(`vp`,e,{cwd:r,ignoreReturnCode:!0});if(Br(),t===0){Rr(`Successfully ran ${i}`);continue}let o=a.trim()||n.trim();o&&Ir(Pd(o,4e3),{title:`${i} failed`}),Pr(`Command "${i}" (cwd: ${r}) exited with code ${t}`)}catch(e){Br(),Pr(`Failed to run ${i}: ${String(e)}`)}}}function Id(e){let t={followSymbolicLinks:!0,implicitDescendants:!0,matchDirectories:!0,omitBrokenSymbolicLinks:!0,excludeHiddenFiles:!1};return e&&(typeof e.followSymbolicLinks==`boolean`&&(t.followSymbolicLinks=e.followSymbolicLinks,R(`followSymbolicLinks '${t.followSymbolicLinks}'`)),typeof e.implicitDescendants==`boolean`&&(t.implicitDescendants=e.implicitDescendants,R(`implicitDescendants '${t.implicitDescendants}'`)),typeof e.matchDirectories==`boolean`&&(t.matchDirectories=e.matchDirectories,R(`matchDirectories '${t.matchDirectories}'`)),typeof e.omitBrokenSymbolicLinks==`boolean`&&(t.omitBrokenSymbolicLinks=e.omitBrokenSymbolicLinks,R(`omitBrokenSymbolicLinks '${t.omitBrokenSymbolicLinks}'`)),typeof e.excludeHiddenFiles==`boolean`&&(t.excludeHiddenFiles=e.excludeHiddenFiles,R(`excludeHiddenFiles '${t.excludeHiddenFiles}'`))),t}const Ld=process.platform===`win32`;function Rd(e){if(e=Ud(e),Ld&&/^\\\\[^\\]+(\\[^\\]+)?$/.test(e))return e;let t=u.dirname(e);return Ld&&/^\\\\[^\\]+\\[^\\]+\\$/.test(t)&&(t=Ud(t)),t}function zd(e,t){if(h(e,`ensureAbsoluteRoot parameter 'root' must not be empty`),h(t,`ensureAbsoluteRoot parameter 'itemPath' must not be empty`),Bd(t))return t;if(Ld){if(t.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)){let e=process.cwd();return h(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`),t[0].toUpperCase()===e[0].toUpperCase()?t.length===2?`${t[0]}:\\${e.substr(3)}`:(e.endsWith(`\\`)||(e+=`\\`),`${t[0]}:\\${e.substr(3)}${t.substr(2)}`):`${t[0]}:\\${t.substr(2)}`}else if(Hd(t).match(/^\\$|^\\[^\\]/)){let e=process.cwd();return h(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`),`${e[0]}:\\${t.substr(1)}`}}return h(Bd(e),`ensureAbsoluteRoot parameter 'root' must have an absolute root`),e.endsWith(`/`)||Ld&&e.endsWith(`\\`)||(e+=u.sep),e+t}function Bd(e){return h(e,`hasAbsoluteRoot parameter 'itemPath' must not be empty`),e=Hd(e),Ld?e.startsWith(`\\\\`)||/^[A-Z]:\\/i.test(e):e.startsWith(`/`)}function Vd(e){return h(e,`isRooted parameter 'itemPath' must not be empty`),e=Hd(e),Ld?e.startsWith(`\\`)||/^[A-Z]:/i.test(e):e.startsWith(`/`)}function Hd(e){return e||=``,Ld?(e=e.replace(/\//g,`\\`),(/^\\\\+[^\\]/.test(e)?`\\`:``)+e.replace(/\\\\+/g,`\\`)):e.replace(/\/\/+/g,`/`)}function Ud(e){return e?(e=Hd(e),!e.endsWith(u.sep)||e===u.sep||Ld&&/^[A-Z]:\\$/i.test(e)?e:e.substr(0,e.length-1)):``}var Wd;(function(e){e[e.None=0]=`None`,e[e.Directory=1]=`Directory`,e[e.File=2]=`File`,e[e.All=3]=`All`})(Wd||={});const Gd=process.platform===`win32`;function Kd(e){e=e.filter(e=>!e.negate);let t={};for(let n of e){let e=Gd?n.searchPath.toUpperCase():n.searchPath;t[e]=`candidate`}let n=[];for(let r of e){let e=Gd?r.searchPath.toUpperCase():r.searchPath;if(t[e]===`included`)continue;let i=!1,a=e,o=Rd(a);for(;o!==a;){if(t[o]){i=!0;break}a=o,o=Rd(a)}i||(n.push(r.searchPath),t[e]=`included`)}return n}function qd(e,t){let n=Wd.None;for(let r of e)r.negate?n&=~r.match(t):n|=r.match(t);return n}function Jd(e,t){return e.some(e=>!e.negate&&e.partialMatch(t))}var Yd=F(((e,t)=>{t.exports=function(e,t){for(var r=[],i=0;i{t.exports=n;function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var a=i(e,t,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+e.length,a[1]),post:n.slice(a[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}n.range=i;function i(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i=0?c:l;r.length&&(s=[a,o])}return s}})),Zd=F(((e,t)=>{var n=Yd(),r=Xd();t.exports=p;var i=`\0SLASH`+Math.random()+`\0`,a=`\0OPEN`+Math.random()+`\0`,o=`\0CLOSE`+Math.random()+`\0`,s=`\0COMMA`+Math.random()+`\0`,c=`\0PERIOD`+Math.random()+`\0`;function l(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function u(e){return e.split(`\\\\`).join(i).split(`\\{`).join(a).split(`\\}`).join(o).split(`\\,`).join(s).split(`\\.`).join(c)}function d(e){return e.split(i).join(`\\`).split(a).join(`{`).split(o).join(`}`).split(s).join(`,`).split(c).join(`.`)}function f(e){if(!e)return[``];var t=[],n=r(`{`,`}`,e);if(!n)return e.split(`,`);var i=n.pre,a=n.body,o=n.post,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;var c=f(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function p(e){return e?(e.substr(0,2)===`{}`&&(e=`\\{\\}`+e.substr(2)),v(u(e),!0).map(d)):[]}function m(e){return`{`+e+`}`}function h(e){return/^-?0\d/.test(e)}function g(e,t){return e<=t}function _(e,t){return e>=t}function v(e,t){var i=[],a=r(`{`,`}`,e);if(!a||/\$$/.test(a.pre))return[e];var s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),u=s||c,d=a.body.indexOf(`,`)>=0;if(!u&&!d)return a.post.match(/,(?!,).*\}/)?(e=a.pre+`{`+a.body+o+a.post,v(e)):[e];var p;if(u)p=a.body.split(/\.\./);else if(p=f(a.body),p.length===1&&(p=v(p[0],!1).map(m),p.length===1)){var y=a.post.length?v(a.post,!1):[``];return y.map(function(e){return a.pre+p[0]+e})}var b=a.pre,y=a.post.length?v(a.post,!1):[``],x;if(u){var S=l(p[0]),C=l(p[1]),w=Math.max(p[0].length,p[1].length),T=p.length==3?Math.abs(l(p[2])):1,E=g;C0){var j=Array(A+1).join(`0`);k=O<0?`-`+j+k.slice(1):j+k}}x.push(k)}}else x=n(p,function(e){return v(e,!1)});for(var M=0;M{t.exports=h,h.Minimatch=g;var n=function(){try{return I(`path`)}catch{}}()||{sep:`/`};h.sep=n.sep;var r=h.GLOBSTAR=g.GLOBSTAR={},i=Zd(),a={"!":{open:`(?:(?!(?:`,close:`))[^/]*?)`},"?":{open:`(?:`,close:`)?`},"+":{open:`(?:`,close:`)+`},"*":{open:`(?:`,close:`)*`},"@":{open:`(?:`,close:`)`}},o=`[^/]`,s=o+`*?`,c=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,l=`(?:(?!(?:\\/|^)\\.).)*?`,u=d(`().*{}+?[]^$\\!`);function d(e){return e.split(``).reduce(function(e,t){return e[t]=!0,e},{})}var f=/\/+/;h.filter=p;function p(e,t){return t||={},function(n,r,i){return h(n,e,t)}}function m(e,t){t||={};var n={};return Object.keys(e).forEach(function(t){n[t]=e[t]}),Object.keys(t).forEach(function(e){n[e]=t[e]}),n}h.defaults=function(e){if(!e||typeof e!=`object`||!Object.keys(e).length)return h;var t=h,n=function(n,r,i){return t(n,r,m(e,i))};return n.Minimatch=function(n,r){return new t.Minimatch(n,m(e,r))},n.Minimatch.defaults=function(n){return t.defaults(m(e,n)).Minimatch},n.filter=function(n,r){return t.filter(n,m(e,r))},n.defaults=function(n){return t.defaults(m(e,n))},n.makeRe=function(n,r){return t.makeRe(n,m(e,r))},n.braceExpand=function(n,r){return t.braceExpand(n,m(e,r))},n.match=function(n,r,i){return t.match(n,r,m(e,i))},n},g.defaults=function(e){return h.defaults(e).Minimatch};function h(e,t,n){return x(t),n||={},!n.nocomment&&t.charAt(0)===`#`?!1:new g(t,n).match(e)}function g(e,t){if(!(this instanceof g))return new g(e,t);x(e),t||={},e=e.trim(),!t.allowWindowsEscape&&n.sep!==`/`&&(e=e.split(n.sep).join(`/`)),this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion===void 0?200:t.maxGlobstarRecursion,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}g.prototype.debug=function(){},g.prototype.make=_;function _(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,n),n=this.globParts=n.map(function(e){return e.split(f)}),this.debug(this.pattern,n),n=n.map(function(e,t,n){return e.map(this.parse,this)},this),this.debug(this.pattern,n),n=n.filter(function(e){return e.indexOf(!1)===-1}),this.debug(this.pattern,n),this.set=n}g.prototype.parseNegate=v;function v(){var e=this.pattern,t=!1,n=this.options,r=0;if(!n.nonegate){for(var i=0,a=e.length;ib)throw TypeError(`pattern is too long`)};g.prototype.parse=C;var S={};function C(e,t){x(e);var n=this.options;if(e===`**`)if(n.noglobstar)e=`*`;else return r;if(e===``)return``;var i=``,c=!!n.nocase,l=!1,d=[],f=[],p,m=!1,h=-1,g=-1,_=e.charAt(0)===`.`?``:n.dot?`(?!(?:^|\\/)\\.{1,2}(?:$|\\/))`:`(?!\\.)`,v=this;function y(){if(p){switch(p){case`*`:i+=s,c=!0;break;case`?`:i+=o,c=!0;break;default:i+=`\\`+p;break}v.debug(`clearStateChar %j %j`,p,i),p=!1}}for(var b=0,C=e.length,w;b1&&e.reused===`ref`){a(n);continue}}}function ul(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:pl(t,`input`,e.processors),output:pl(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function dl(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return dl(r.element,n);if(r.type===`set`)return dl(r.valueType,n);if(r.type===`lazy`)return dl(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return dl(r.innerType,n);if(r.type===`intersection`)return dl(r.left,n)||dl(r.right,n);if(r.type===`record`||r.type===`map`)return dl(r.keyType,n)||dl(r.valueType,n);if(r.type===`pipe`)return dl(r.in,n)||dl(r.out,n);if(r.type===`object`){for(let e in r.shape)if(dl(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(dl(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(dl(e,n))return!0;return!!(r.rest&&dl(r.rest,n))}return!1}const fl=(e,t={})=>n=>{let r=sl({...n,processors:t});return cl(e,r),ll(r,e),ul(r,e)},pl=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=sl({...i??{},target:a,io:t,processors:n});return cl(e,o),ll(o,e),ul(o,e)},ml={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},hl=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ml[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},gl=(e,t,n,r)=>{n.type=`boolean`},_l=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},vl=(e,t,n,r)=>{n.not={}},yl=(e,t,n,r)=>{let i=e._zod.def,a=da(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},bl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},xl=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Sl=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=cl(a.element,t,{...r,path:[...r.path,`items`]})},Cl=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=cl(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=cl(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},wl=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>cl(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Tl=(e,t,n,r)=>{let i=e._zod.def,a=cl(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=cl(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},El=(e,t,n,r)=>{let i=e._zod.def,a=cl(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Dl=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ol=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},kl=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Al=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},jl=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;cl(a,t,r);let o=t.seen.get(e);o.ref=a},Ml=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Nl=(e,t,n,r)=>{let i=e._zod.def;cl(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Pl=z(`ZodISODateTime`,(e,t)=>{fs.init(e,t),su.init(e,t)});function Fl(e){return Pc(Pl,e)}const Il=z(`ZodISODate`,(e,t)=>{ps.init(e,t),su.init(e,t)});function Ll(e){return Fc(Il,e)}const Rl=z(`ZodISOTime`,(e,t)=>{ms.init(e,t),su.init(e,t)});function zl(e){return Ic(Rl,e)}const Bl=z(`ZodISODuration`,(e,t)=>{hs.init(e,t),su.init(e,t)});function Vl(e){return Lc(Bl,e)}const Hl=(e,t)=>{Ga.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ja(e,t)},flatten:{value:t=>qa(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,fa,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,fa,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ul=z(`ZodError`,Hl),Wl=z(`ZodError`,Hl,{Parent:Error}),Gl=Ya(Wl),Kl=Xa(Wl),ql=Za(Wl),Jl=$a(Wl),Yl=to(Wl),Xl=no(Wl),Zl=ro(Wl),Ql=io(Wl),$l=ao(Wl),eu=oo(Wl),tu=so(Wl),nu=co(Wl),ru=z(`ZodType`,(e,t)=>(Qo.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:pl(e,`input`),output:pl(e,`output`)}}),e.toJSONSchema=fl(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(ya(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>ka(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>Gl(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ql(e,t,n),e.parseAsync=async(t,n)=>Kl(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Jl(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Yl(e,t,n),e.decode=(t,n)=>Xl(e,t,n),e.encodeAsync=async(t,n)=>Zl(e,t,n),e.decodeAsync=async(t,n)=>Ql(e,t,n),e.safeEncode=(t,n)=>$l(e,t,n),e.safeDecode=(t,n)=>eu(e,t,n),e.safeEncodeAsync=async(t,n)=>tu(e,t,n),e.safeDecodeAsync=async(t,n)=>nu(e,t,n),e.refine=(t,n)=>e.check(fd(t,n)),e.superRefine=t=>e.check(pd(t)),e.overwrite=t=>e.check(Zc(t)),e.optional=()=>Ju(e),e.exactOptional=()=>Xu(e),e.nullable=()=>Qu(e),e.nullish=()=>Ju(Qu(e)),e.nonoptional=t=>id(e,t),e.array=()=>Iu(e),e.or=t=>Bu([e,t]),e.and=t=>Hu(e,t),e.transform=t=>cd(e,Ku(t)),e.default=t=>ed(e,t),e.prefault=t=>nd(e,t),e.catch=t=>od(e,t),e.pipe=t=>cd(e,t),e.readonly=()=>ud(e),e.describe=t=>{let n=e.clone();return uc.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return uc.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return uc.get(e);let n=e.clone();return uc.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),iu=z(`_ZodString`,(e,t)=>{$o.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hl(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(Gc(...t)),e.includes=(...t)=>e.check(Jc(...t)),e.startsWith=(...t)=>e.check(Yc(...t)),e.endsWith=(...t)=>e.check(Xc(...t)),e.min=(...t)=>e.check(Uc(...t)),e.max=(...t)=>e.check(Hc(...t)),e.length=(...t)=>e.check(Wc(...t)),e.nonempty=(...t)=>e.check(Uc(1,...t)),e.lowercase=t=>e.check(Kc(t)),e.uppercase=t=>e.check(qc(t)),e.trim=()=>e.check($c()),e.normalize=(...t)=>e.check(Qc(...t)),e.toLowerCase=()=>e.check(el()),e.toUpperCase=()=>e.check(tl()),e.slugify=()=>e.check(nl())}),au=z(`ZodString`,(e,t)=>{$o.init(e,t),iu.init(e,t),e.email=t=>e.check(fc(cu,t)),e.url=t=>e.check(vc(du,t)),e.jwt=t=>e.check(Nc(Eu,t)),e.emoji=t=>e.check(yc(fu,t)),e.guid=t=>e.check(pc(lu,t)),e.uuid=t=>e.check(mc(uu,t)),e.uuidv4=t=>e.check(hc(uu,t)),e.uuidv6=t=>e.check(gc(uu,t)),e.uuidv7=t=>e.check(_c(uu,t)),e.nanoid=t=>e.check(bc(pu,t)),e.guid=t=>e.check(pc(lu,t)),e.cuid=t=>e.check(xc(mu,t)),e.cuid2=t=>e.check(Sc(hu,t)),e.ulid=t=>e.check(Cc(gu,t)),e.base64=t=>e.check(Ac(Cu,t)),e.base64url=t=>e.check(jc(wu,t)),e.xid=t=>e.check(wc(_u,t)),e.ksuid=t=>e.check(Tc(vu,t)),e.ipv4=t=>e.check(Ec(yu,t)),e.ipv6=t=>e.check(Dc(bu,t)),e.cidrv4=t=>e.check(Oc(xu,t)),e.cidrv6=t=>e.check(kc(Su,t)),e.e164=t=>e.check(Mc(Tu,t)),e.datetime=t=>e.check(Fl(t)),e.date=t=>e.check(Ll(t)),e.time=t=>e.check(zl(t)),e.duration=t=>e.check(Vl(t))});function ou(e){return dc(au,e)}const su=z(`ZodStringFormat`,(e,t)=>{es.init(e,t),iu.init(e,t)}),cu=z(`ZodEmail`,(e,t)=>{rs.init(e,t),su.init(e,t)}),lu=z(`ZodGUID`,(e,t)=>{ts.init(e,t),su.init(e,t)}),uu=z(`ZodUUID`,(e,t)=>{ns.init(e,t),su.init(e,t)}),du=z(`ZodURL`,(e,t)=>{is.init(e,t),su.init(e,t)}),fu=z(`ZodEmoji`,(e,t)=>{as.init(e,t),su.init(e,t)}),pu=z(`ZodNanoID`,(e,t)=>{os.init(e,t),su.init(e,t)}),mu=z(`ZodCUID`,(e,t)=>{ss.init(e,t),su.init(e,t)}),hu=z(`ZodCUID2`,(e,t)=>{cs.init(e,t),su.init(e,t)}),gu=z(`ZodULID`,(e,t)=>{ls.init(e,t),su.init(e,t)}),_u=z(`ZodXID`,(e,t)=>{us.init(e,t),su.init(e,t)}),vu=z(`ZodKSUID`,(e,t)=>{ds.init(e,t),su.init(e,t)}),yu=z(`ZodIPv4`,(e,t)=>{gs.init(e,t),su.init(e,t)}),bu=z(`ZodIPv6`,(e,t)=>{_s.init(e,t),su.init(e,t)}),xu=z(`ZodCIDRv4`,(e,t)=>{vs.init(e,t),su.init(e,t)}),Su=z(`ZodCIDRv6`,(e,t)=>{ys.init(e,t),su.init(e,t)}),Cu=z(`ZodBase64`,(e,t)=>{xs.init(e,t),su.init(e,t)}),wu=z(`ZodBase64URL`,(e,t)=>{Cs.init(e,t),su.init(e,t)}),Tu=z(`ZodE164`,(e,t)=>{ws.init(e,t),su.init(e,t)}),Eu=z(`ZodJWT`,(e,t)=>{Es.init(e,t),su.init(e,t)}),Du=z(`ZodBoolean`,(e,t)=>{Ds.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gl(e,t,n,r)});function Ou(e){return Rc(Du,e)}const ku=z(`ZodNull`,(e,t)=>{Os.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_l(e,t,n,r)});function Au(e){return zc(ku,e)}const ju=z(`ZodUnknown`,(e,t)=>{ks.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Mu(){return Bc(ju)}const Nu=z(`ZodNever`,(e,t)=>{As.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vl(e,t,n,r)});function Pu(e){return Vc(Nu,e)}const Fu=z(`ZodArray`,(e,t)=>{Ms.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sl(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Uc(t,n)),e.nonempty=t=>e.check(Uc(1,t)),e.max=(t,n)=>e.check(Hc(t,n)),e.length=(t,n)=>e.check(Wc(t,n)),e.unwrap=()=>e.element});function Iu(e,t){return rl(Fu,e,t)}const Lu=z(`ZodObject`,(e,t)=>{Ls.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cl(e,t,n,r),_a(e,`shape`,()=>t.shape),e.keyof=()=>Wu(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Mu()}),e.loose=()=>e.clone({...e._zod.def,catchall:Mu()}),e.strict=()=>e.clone({...e._zod.def,catchall:Pu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Na(e,t),e.safeExtend=t=>Pa(e,t),e.merge=t=>Fa(e,t),e.pick=t=>ja(e,t),e.omit=t=>Ma(e,t),e.partial=(...t)=>Ia(qu,e,t[0]),e.required=(...t)=>La(rd,e,t[0])});function Ru(e,t){return new Lu({type:`object`,shape:e??{},...B(t)})}const zu=z(`ZodUnion`,(e,t)=>{zs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wl(e,t,n,r),e.options=t.options});function Bu(e,t){return new zu({type:`union`,options:e,...B(t)})}const Vu=z(`ZodIntersection`,(e,t)=>{Bs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tl(e,t,n,r)});function Hu(e,t){return new Vu({type:`intersection`,left:e,right:t})}const Uu=z(`ZodEnum`,(e,t)=>{Us.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yl(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Uu({...t,checks:[],...B(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Uu({...t,checks:[],...B(r),entries:i})}});function Wu(e,t){return new Uu({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...B(t)})}const Gu=z(`ZodTransform`,(e,t)=>{Ws.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xl(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ca(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ua(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Ua(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ku(e){return new Gu({type:`transform`,transform:e})}const qu=z(`ZodOptional`,(e,t)=>{Ks.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ju(e){return new qu({type:`optional`,innerType:e})}const Yu=z(`ZodExactOptional`,(e,t)=>{qs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xu(e){return new Yu({type:`optional`,innerType:e})}const Zu=z(`ZodNullable`,(e,t)=>{Js.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>El(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qu(e){return new Zu({type:`nullable`,innerType:e})}const $u=z(`ZodDefault`,(e,t)=>{Ys.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ol(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ed(e,t){return new $u({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ea(t)}})}const td=z(`ZodPrefault`,(e,t)=>{Zs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nd(e,t){return new td({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ea(t)}})}const rd=z(`ZodNonOptional`,(e,t)=>{Qs.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function id(e,t){return new rd({type:`nonoptional`,innerType:e,...B(t)})}const ad=z(`ZodCatch`,(e,t)=>{ec.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Al(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function od(e,t){return new ad({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const sd=z(`ZodPipe`,(e,t)=>{tc.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jl(e,t,n,r),e.in=t.in,e.out=t.out});function cd(e,t){return new sd({type:`pipe`,in:e,out:t})}const ld=z(`ZodReadonly`,(e,t)=>{rc.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ml(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ud(e){return new ld({type:`readonly`,innerType:e})}const dd=z(`ZodCustom`,(e,t)=>{ac.init(e,t),ru.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bl(e,t,n,r)});function fd(e,t={}){return il(dd,e,t)}function pd(e){return al(e)}var md=oa();const hd=Ru({cwd:ou().optional(),args:Iu(ou()).optional()}),gd=Bu([Au(),Ou(),hd,Iu(hd)]),_d=`Vite+`;function vd(){return{version:jr(`version`)||`latest`,nodeVersion:jr(`node-version`)||void 0,nodeVersionFile:jr(`node-version-file`)||void 0,workingDirectory:jr(`working-directory`)||void 0,runInstall:yd(jr(`run-install`)),cache:Mr(`cache`),cacheDependencyPath:jr(`cache-dependency-path`)||void 0,registryUrl:jr(`registry-url`)||void 0,scope:jr(`scope`)||void 0}}function yd(e){if(!e||e===`false`||e===`null`)return[];if(e===`true`)return[{}];let t=(0,md.parse)(e);try{let e=gd.parse(t);return e?e===!0?[{}]:Array.isArray(e)?e:[e]:[]}catch(e){throw e instanceof Ul?Error(`Invalid run-install input: ${e.issues.map(e=>e.message).join(`, `)}`):e}}function bd(){return N((process.platform===`win32`?process.env.USERPROFILE:process.env.HOME)||de(),`.vite-plus`)}function xd(){return process.env.GITHUB_WORKSPACE||process.cwd()}function Sd(e,t){return ee(e)?e:N(t,e)}function Cd(e){if(!e.workingDirectory)return xd();let t=Sd(e.workingDirectory,xd());if(!P(t))throw Error(`working-directory not found: ${e.workingDirectory} (resolved to ${t})`);if(!oe(t).isDirectory())throw Error(`working-directory is not a directory: ${e.workingDirectory} (resolved to ${t})`);return t}function wd(e,t){return t?Sd(t,e):e}const Td=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function Ed(e,t=xd()){if(e){let n=Sd(e,t);if(P(n)){let e=j(n),t=Td.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:Dd(n,e)}return}let n=ae(t);for(let e of Td)if(n.includes(e.filename)){let n=N(t,e.filename);return Rr(`Auto-detected lock file: ${e.filename}`),{type:e.type,path:n,filename:e.filename}}}function Dd(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}async function Od(e,t){switch(e){case`npm`:case`pnpm`:case`yarn`:case`bun`:return Ad(t);default:return[]}}async function kd(e,t,n){let r=`${e} ${t.join(` `)}`;try{let i=await Er(e,t,{cwd:n?.cwd,silent:!0,ignoreReturnCode:!0});if(i.exitCode===0)return i.stdout.trim();R(`Command "${r}" exited with code ${i.exitCode}`);return}catch(e){Lr(`Failed to run "${r}": ${String(e)}`);return}}async function Ad(e){let t=await kd(`vp`,[`pm`,`cache`,`dir`],{cwd:e});return t?[t]:[]}async function jd(e){let{version:t}=e;Rr(`Installing ${_d}@${t}...`);let n={...process.env,VP_VERSION:t,VITE_PLUS_VERSION:t},r=``;for(let e=1;e<=3;e++){try{let e=await Md(n);if(e===0){Nd();return}r=`exit code ${e}`}catch(e){r=e instanceof Error?e.message:String(e)}if(e<3){let t=2e3*e;Lr(`Failed to install ${_d} (${r}). Retrying in ${t}ms... (attempt ${e+1}/3)`),await ne(t)}}throw Error(`Failed to install ${_d} after 3 attempts: ${r}`)}async function Md(e){let t={env:e,ignoreReturnCode:!0};return process.platform===`win32`?Tr(`pwsh`,[`-Command`,`& ([scriptblock]::Create((irm https://viteplus.dev/install.ps1)))`],t):Tr(`bash`,[`-c`,`curl -fsSL https://viteplus.dev/install.sh | bash`],t)}function Nd(){let e=N(bd(),`bin`);process.env.PATH?.includes(e)||Ar(e)}function Pd(e,t){let n=e.trim();return n.length<=t?n:`…(truncated, showing last ${t} chars)…\n${n.slice(-t)}`}async function Fd(e){let t=Cd(e);for(let n of e.runInstall){let e=[`install`];n.args&&e.push(...n.args);let r=wd(t,n.cwd),i=`vp ${e.join(` `)}`;zr(`Running ${i} in ${r}...`);let a;try{a=await Er(`vp`,e,{cwd:r,ignoreReturnCode:!0})}catch(e){throw Br(),Error(`Failed to run ${i}: ${String(e)}`)}if(Br(),a.exitCode===0){Rr(`Successfully ran ${i}`);continue}let o=a.stderr.trim()||a.stdout.trim();throw o&&Ir(Pd(o,4e3),{title:`${i} failed`}),Error(`Command "${i}" (cwd: ${r}) exited with code ${a.exitCode}`)}}function Id(e){let t={followSymbolicLinks:!0,implicitDescendants:!0,matchDirectories:!0,omitBrokenSymbolicLinks:!0,excludeHiddenFiles:!1};return e&&(typeof e.followSymbolicLinks==`boolean`&&(t.followSymbolicLinks=e.followSymbolicLinks,R(`followSymbolicLinks '${t.followSymbolicLinks}'`)),typeof e.implicitDescendants==`boolean`&&(t.implicitDescendants=e.implicitDescendants,R(`implicitDescendants '${t.implicitDescendants}'`)),typeof e.matchDirectories==`boolean`&&(t.matchDirectories=e.matchDirectories,R(`matchDirectories '${t.matchDirectories}'`)),typeof e.omitBrokenSymbolicLinks==`boolean`&&(t.omitBrokenSymbolicLinks=e.omitBrokenSymbolicLinks,R(`omitBrokenSymbolicLinks '${t.omitBrokenSymbolicLinks}'`)),typeof e.excludeHiddenFiles==`boolean`&&(t.excludeHiddenFiles=e.excludeHiddenFiles,R(`excludeHiddenFiles '${t.excludeHiddenFiles}'`))),t}const Ld=process.platform===`win32`;function Rd(e){if(e=Ud(e),Ld&&/^\\\\[^\\]+(\\[^\\]+)?$/.test(e))return e;let t=u.dirname(e);return Ld&&/^\\\\[^\\]+\\[^\\]+\\$/.test(t)&&(t=Ud(t)),t}function zd(e,t){if(h(e,`ensureAbsoluteRoot parameter 'root' must not be empty`),h(t,`ensureAbsoluteRoot parameter 'itemPath' must not be empty`),Bd(t))return t;if(Ld){if(t.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)){let e=process.cwd();return h(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`),t[0].toUpperCase()===e[0].toUpperCase()?t.length===2?`${t[0]}:\\${e.substr(3)}`:(e.endsWith(`\\`)||(e+=`\\`),`${t[0]}:\\${e.substr(3)}${t.substr(2)}`):`${t[0]}:\\${t.substr(2)}`}else if(Hd(t).match(/^\\$|^\\[^\\]/)){let e=process.cwd();return h(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`),`${e[0]}:\\${t.substr(1)}`}}return h(Bd(e),`ensureAbsoluteRoot parameter 'root' must have an absolute root`),e.endsWith(`/`)||Ld&&e.endsWith(`\\`)||(e+=u.sep),e+t}function Bd(e){return h(e,`hasAbsoluteRoot parameter 'itemPath' must not be empty`),e=Hd(e),Ld?e.startsWith(`\\\\`)||/^[A-Z]:\\/i.test(e):e.startsWith(`/`)}function Vd(e){return h(e,`isRooted parameter 'itemPath' must not be empty`),e=Hd(e),Ld?e.startsWith(`\\`)||/^[A-Z]:/i.test(e):e.startsWith(`/`)}function Hd(e){return e||=``,Ld?(e=e.replace(/\//g,`\\`),(/^\\\\+[^\\]/.test(e)?`\\`:``)+e.replace(/\\\\+/g,`\\`)):e.replace(/\/\/+/g,`/`)}function Ud(e){return e?(e=Hd(e),!e.endsWith(u.sep)||e===u.sep||Ld&&/^[A-Z]:\\$/i.test(e)?e:e.substr(0,e.length-1)):``}var Wd;(function(e){e[e.None=0]=`None`,e[e.Directory=1]=`Directory`,e[e.File=2]=`File`,e[e.All=3]=`All`})(Wd||={});const Gd=process.platform===`win32`;function Kd(e){e=e.filter(e=>!e.negate);let t={};for(let n of e){let e=Gd?n.searchPath.toUpperCase():n.searchPath;t[e]=`candidate`}let n=[];for(let r of e){let e=Gd?r.searchPath.toUpperCase():r.searchPath;if(t[e]===`included`)continue;let i=!1,a=e,o=Rd(a);for(;o!==a;){if(t[o]){i=!0;break}a=o,o=Rd(a)}i||(n.push(r.searchPath),t[e]=`included`)}return n}function qd(e,t){let n=Wd.None;for(let r of e)r.negate?n&=~r.match(t):n|=r.match(t);return n}function Jd(e,t){return e.some(e=>!e.negate&&e.partialMatch(t))}var Yd=F(((e,t)=>{t.exports=function(e,t){for(var r=[],i=0;i{t.exports=n;function n(e,t,n){e instanceof RegExp&&(e=r(e,n)),t instanceof RegExp&&(t=r(t,n));var a=i(e,t,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+e.length,a[1]),post:n.slice(a[1]+t.length)}}function r(e,t){var n=t.match(e);return n?n[0]:null}n.range=i;function i(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i=0?c:l;r.length&&(s=[a,o])}return s}})),Zd=F(((e,t)=>{var n=Yd(),r=Xd();t.exports=p;var i=`\0SLASH`+Math.random()+`\0`,a=`\0OPEN`+Math.random()+`\0`,o=`\0CLOSE`+Math.random()+`\0`,s=`\0COMMA`+Math.random()+`\0`,c=`\0PERIOD`+Math.random()+`\0`;function l(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function u(e){return e.split(`\\\\`).join(i).split(`\\{`).join(a).split(`\\}`).join(o).split(`\\,`).join(s).split(`\\.`).join(c)}function d(e){return e.split(i).join(`\\`).split(a).join(`{`).split(o).join(`}`).split(s).join(`,`).split(c).join(`.`)}function f(e){if(!e)return[``];var t=[],n=r(`{`,`}`,e);if(!n)return e.split(`,`);var i=n.pre,a=n.body,o=n.post,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;var c=f(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function p(e){return e?(e.substr(0,2)===`{}`&&(e=`\\{\\}`+e.substr(2)),v(u(e),!0).map(d)):[]}function m(e){return`{`+e+`}`}function h(e){return/^-?0\d/.test(e)}function g(e,t){return e<=t}function _(e,t){return e>=t}function v(e,t){var i=[],a=r(`{`,`}`,e);if(!a||/\$$/.test(a.pre))return[e];var s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),u=s||c,d=a.body.indexOf(`,`)>=0;if(!u&&!d)return a.post.match(/,(?!,).*\}/)?(e=a.pre+`{`+a.body+o+a.post,v(e)):[e];var p;if(u)p=a.body.split(/\.\./);else if(p=f(a.body),p.length===1&&(p=v(p[0],!1).map(m),p.length===1)){var y=a.post.length?v(a.post,!1):[``];return y.map(function(e){return a.pre+p[0]+e})}var b=a.pre,y=a.post.length?v(a.post,!1):[``],x;if(u){var S=l(p[0]),C=l(p[1]),w=Math.max(p[0].length,p[1].length),T=p.length==3?Math.abs(l(p[2])):1,E=g;C0){var j=Array(A+1).join(`0`);k=O<0?`-`+j+k.slice(1):j+k}}x.push(k)}}else x=n(p,function(e){return v(e,!1)});for(var M=0;M{t.exports=h,h.Minimatch=g;var n=function(){try{return I(`path`)}catch{}}()||{sep:`/`};h.sep=n.sep;var r=h.GLOBSTAR=g.GLOBSTAR={},i=Zd(),a={"!":{open:`(?:(?!(?:`,close:`))[^/]*?)`},"?":{open:`(?:`,close:`)?`},"+":{open:`(?:`,close:`)+`},"*":{open:`(?:`,close:`)*`},"@":{open:`(?:`,close:`)`}},o=`[^/]`,s=o+`*?`,c=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,l=`(?:(?!(?:\\/|^)\\.).)*?`,u=d(`().*{}+?[]^$\\!`);function d(e){return e.split(``).reduce(function(e,t){return e[t]=!0,e},{})}var f=/\/+/;h.filter=p;function p(e,t){return t||={},function(n,r,i){return h(n,e,t)}}function m(e,t){t||={};var n={};return Object.keys(e).forEach(function(t){n[t]=e[t]}),Object.keys(t).forEach(function(e){n[e]=t[e]}),n}h.defaults=function(e){if(!e||typeof e!=`object`||!Object.keys(e).length)return h;var t=h,n=function(n,r,i){return t(n,r,m(e,i))};return n.Minimatch=function(n,r){return new t.Minimatch(n,m(e,r))},n.Minimatch.defaults=function(n){return t.defaults(m(e,n)).Minimatch},n.filter=function(n,r){return t.filter(n,m(e,r))},n.defaults=function(n){return t.defaults(m(e,n))},n.makeRe=function(n,r){return t.makeRe(n,m(e,r))},n.braceExpand=function(n,r){return t.braceExpand(n,m(e,r))},n.match=function(n,r,i){return t.match(n,r,m(e,i))},n},g.defaults=function(e){return h.defaults(e).Minimatch};function h(e,t,n){return x(t),n||={},!n.nocomment&&t.charAt(0)===`#`?!1:new g(t,n).match(e)}function g(e,t){if(!(this instanceof g))return new g(e,t);x(e),t||={},e=e.trim(),!t.allowWindowsEscape&&n.sep!==`/`&&(e=e.split(n.sep).join(`/`)),this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion===void 0?200:t.maxGlobstarRecursion,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}g.prototype.debug=function(){},g.prototype.make=_;function _(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,n),n=this.globParts=n.map(function(e){return e.split(f)}),this.debug(this.pattern,n),n=n.map(function(e,t,n){return e.map(this.parse,this)},this),this.debug(this.pattern,n),n=n.filter(function(e){return e.indexOf(!1)===-1}),this.debug(this.pattern,n),this.set=n}g.prototype.parseNegate=v;function v(){var e=this.pattern,t=!1,n=this.options,r=0;if(!n.nonegate){for(var i=0,a=e.length;ib)throw TypeError(`pattern is too long`)};g.prototype.parse=C;var S={};function C(e,t){x(e);var n=this.options;if(e===`**`)if(n.noglobstar)e=`*`;else return r;if(e===``)return``;var i=``,c=!!n.nocase,l=!1,d=[],f=[],p,m=!1,h=-1,g=-1,_=e.charAt(0)===`.`?``:n.dot?`(?!(?:^|\\/)\\.{1,2}(?:$|\\/))`:`(?!\\.)`,v=this;function y(){if(p){switch(p){case`*`:i+=s,c=!0;break;case`?`:i+=o,c=!0;break;default:i+=`\\`+p;break}v.debug(`clearStateChar %j %j`,p,i),p=!1}}for(var b=0,C=e.length,w;b-1;M--){var ee=f[M],N=i.slice(0,ee.reStart),te=i.slice(ee.reStart,ee.reEnd-8),ne=i.slice(ee.reEnd-8,ee.reEnd),re=i.slice(ee.reEnd);ne+=re;var P=N.split(`(`).length-1,ie=re;for(b=0;b=0&&(a=e[o],!a);o--);for(o=0;o=0;o--)if(t[o]===r){c=o;break}var l=t.slice(a,s),u=n?t.slice(s+1):t.slice(s+1,c),d=n?[]:t.slice(c+1);if(l.length){var f=e.slice(i,i+l.length);if(!this._matchOne(f,l,n,0,0))return!1;i+=l.length}var p=0;if(d.length){if(d.length+i>e.length)return!1;var m=e.length-d.length;if(this._matchOne(e,d,n,m,0))p=d.length;else{if(e[e.length-1]!==``||i+d.length===e.length||(m--,!this._matchOne(e,d,n,m,0)))return!1;p=d.length+1}}if(!u.length){var h=!!p;for(o=i;o0,`Parameter 'itemPath' must not be an empty array`);for(let t=0;te.getLiteral(t)).filter(e=>!o&&!(o=e===``));this.searchPath=new ef(s).toString(),this.rootRegExp=new RegExp(e.regExpEscape(s[0]),nf?`i`:``),this.isImplicitPattern=n;let c={dot:!0,nobrace:!0,nocase:nf,nocomment:!0,noext:!0,nonegate:!0};a=nf?a.replace(/\\/g,`/`):a,this.minimatch=new tf(a,c)}match(e){return this.segments[this.segments.length-1]===`**`?(e=Hd(e),!e.endsWith(u.sep)&&this.isImplicitPattern===!1&&(e=`${e}${u.sep}`)):e=Ud(e),this.minimatch.match(e)?this.trailingSeparator?Wd.Directory:Wd.All:Wd.None}partialMatch(e){return e=Ud(e),Rd(e)===e?this.rootRegExp.test(e):this.minimatch.matchOne(e.split(nf?/\\+/:/\/+/),this.minimatch.set[0],!0)}static globEscape(e){return(nf?e:e.replace(/\\/g,`\\\\`)).replace(/(\[)(?=[^/]+\])/g,`[[]`).replace(/\?/g,`[?]`).replace(/\*/g,`[*]`)}static fixupPattern(n,r){h(n,`pattern cannot be empty`);let i=new ef(n).segments.map(t=>e.getLiteral(t));if(h(i.every((e,t)=>(e!==`.`||t===0)&&e!==`..`),`Invalid pattern '${n}'. Relative pathing '.' and '..' is not allowed.`),h(!Vd(n)||i[0],`Invalid pattern '${n}'. Root segment must not contain globs.`),n=Hd(n),n===`.`||n.startsWith(`.${u.sep}`))n=e.globEscape(process.cwd())+n.substr(1);else if(n===`~`||n.startsWith(`~${u.sep}`))r||=t.homedir(),h(r,`Unable to determine HOME directory`),h(Bd(r),`Expected HOME directory to be a rooted path. Actual '${r}'`),n=e.globEscape(r)+n.substr(1);else if(nf&&(n.match(/^[A-Z]:$/i)||n.match(/^[A-Z]:[^\\]/i))){let t=zd(`C:\\dummy-root`,n.substr(0,2));n.length>2&&!t.endsWith(`\\`)&&(t+=`\\`),n=e.globEscape(t)+n.substr(2)}else if(nf&&(n===`\\`||n.match(/^\\[^\\]/))){let t=zd(`C:\\dummy-root`,`\\`);t.endsWith(`\\`)||(t+=`\\`),n=e.globEscape(t)+n.substr(1)}else n=zd(e.globEscape(process.cwd()),n);return Hd(n)}static getLiteral(e){let t=``;for(let n=0;n=0){if(r.length>1)return``;if(r){t+=r,n=i;continue}}}t+=r}return t}static regExpEscape(e){return e.replace(/[[\\^$.|?*+()]/g,`\\$&`)}},af=class{constructor(e,t){this.path=e,this.level=t}},of=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},sf=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},cf=function(e){return this instanceof cf?(this.v=e,this):new cf(e)},lf=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof cf?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}};const uf=process.platform===`win32`;var df=class e{constructor(e){this.patterns=[],this.searchPaths=[],this.options=Id(e)}getSearchPaths(){return this.searchPaths.slice()}glob(){return of(this,void 0,void 0,function*(){var e,t,n,r;let i=[];try{for(var a=!0,o=sf(this.globGenerator()),s;s=yield o.next(),e=s.done,!e;a=!0){r=s.value,a=!1;let e=r;i.push(e)}}catch(e){t={error:e}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return i})}globGenerator(){return lf(this,arguments,function*(){let t=Id(this.options),n=[];for(let e of this.patterns)n.push(e),t.implicitDescendants&&(e.trailingSeparator||e.segments[e.segments.length-1]!==`**`)&&n.push(new rf(e.negate,!0,e.segments.concat(`**`)));let r=[];for(let e of Kd(n)){R(`Search path '${e}'`);try{yield cf(a.promises.lstat(e))}catch(e){if(e.code===`ENOENT`)continue;throw e}r.unshift(new af(e,1))}let i=[];for(;r.length;){let o=r.pop(),s=qd(n,o.path),c=!!s||Jd(n,o.path);if(!s&&!c)continue;let l=yield cf(e.stat(o,t,i));if(l&&!(t.excludeHiddenFiles&&u.basename(o.path).match(/^\./)))if(l.isDirectory()){if(s&Wd.Directory&&t.matchDirectories)yield yield cf(o.path);else if(!c)continue;let e=o.level+1,n=(yield cf(a.promises.readdir(o.path))).map(t=>new af(u.join(o.path,t),e));r.push(...n.reverse())}else s&Wd.File&&(yield yield cf(o.path))}})}static create(t,n){return of(this,void 0,void 0,function*(){let r=new e(n);uf&&(t=t.replace(/\r\n/g,` `),t=t.replace(/\r/g,` `));let i=t.split(` diff --git a/src/run-install.test.ts b/src/run-install.test.ts new file mode 100644 index 0000000..108efc1 --- /dev/null +++ b/src/run-install.test.ts @@ -0,0 +1,87 @@ +import { describe, it, expect, afterEach, vi } from "vite-plus/test"; +import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { delimiter, join } from "node:path"; +import { runViteInstall } from "./run-install.js"; +import type { Inputs } from "./types.js"; + +const baseInputs: Inputs = { + version: "latest", + nodeVersion: undefined, + nodeVersionFile: undefined, + workingDirectory: undefined, + runInstall: [], + cache: false, + cacheDependencyPath: undefined, + registryUrl: undefined, + scope: undefined, +}; + +describe("runViteInstall", () => { + let tempDir: string | undefined; + + afterEach(() => { + vi.unstubAllEnvs(); + if (tempDir) { + rmSync(tempDir, { recursive: true, force: true }); + tempDir = undefined; + } + }); + + it("stops after the first failed install", async () => { + tempDir = mkdtempSync(join(tmpdir(), "setup-vp-")); + const binDir = join(tempDir, "bin"); + const appDir = join(tempDir, "packages", "app"); + const libDir = join(tempDir, "packages", "lib"); + const callsLog = join(tempDir, "calls.log"); + + mkdirSync(binDir); + mkdirSync(appDir, { recursive: true }); + mkdirSync(libDir, { recursive: true }); + writeFileSync(join(appDir, ".fail-vp-install"), ""); + + writeFileSync( + join(binDir, "vp"), + [ + "#!/bin/sh", + 'printf "%s %s\\n" "$PWD" "$*" >> "$VP_CALLS_LOG"', + 'if [ -f ".fail-vp-install" ]; then', + ' echo "install failed" >&2', + " exit 1", + "fi", + "exit 0", + "", + ].join("\n"), + ); + chmodSync(join(binDir, "vp"), 0o755); + + writeFileSync( + join(binDir, "vp.cmd"), + [ + "@echo off", + 'echo %CD% %*>>"%VP_CALLS_LOG%"', + 'if exist ".fail-vp-install" (', + " echo install failed 1>&2", + " exit /b 1", + ")", + "exit /b 0", + "", + ].join("\r\n"), + ); + + vi.stubEnv("GITHUB_WORKSPACE", tempDir); + vi.stubEnv("PATH", `${binDir}${delimiter}${process.env.PATH ?? ""}`); + vi.stubEnv("VP_CALLS_LOG", callsLog); + + await expect( + runViteInstall({ + ...baseInputs, + runInstall: [{ cwd: "packages/app" }, { cwd: "packages/lib" }], + }), + ).rejects.toThrow(`Command "vp install" (cwd: ${appDir}) exited with code 1`); + + const calls = readFileSync(callsLog, "utf8").trim().split(/\r?\n/); + expect(calls).toHaveLength(1); + expect(calls[0]).toContain(`${join("packages", "app")} install`); + }); +}); diff --git a/src/run-install.ts b/src/run-install.ts index 908e39a..885e41e 100644 --- a/src/run-install.ts +++ b/src/run-install.ts @@ -1,4 +1,4 @@ -import { startGroup, endGroup, setFailed, info, error as logError } from "@actions/core"; +import { startGroup, endGroup, info, error as logError } from "@actions/core"; import { getExecOutput } from "@actions/exec"; import type { Inputs } from "./types.js"; import { getConfiguredProjectDir, getInstallCwd } from "./utils.js"; @@ -25,28 +25,30 @@ export async function runViteInstall(inputs: Inputs): Promise { startGroup(`Running ${cmdStr} in ${cwd}...`); + let result: Awaited>; try { - const { exitCode, stdout, stderr } = await getExecOutput("vp", args, { + result = await getExecOutput("vp", args, { cwd, ignoreReturnCode: true, }); - endGroup(); - - if (exitCode === 0) { - info(`Successfully ran ${cmdStr}`); - continue; - } - - const detail = stderr.trim() || stdout.trim(); - if (detail) { - logError(tailOutput(detail, MAX_ERROR_TAIL), { - title: `${cmdStr} failed`, - }); - } - setFailed(`Command "${cmdStr}" (cwd: ${cwd}) exited with code ${exitCode}`); } catch (error) { endGroup(); - setFailed(`Failed to run ${cmdStr}: ${String(error)}`); + throw new Error(`Failed to run ${cmdStr}: ${String(error)}`); + } + + endGroup(); + + if (result.exitCode === 0) { + info(`Successfully ran ${cmdStr}`); + continue; + } + + const detail = result.stderr.trim() || result.stdout.trim(); + if (detail) { + logError(tailOutput(detail, MAX_ERROR_TAIL), { + title: `${cmdStr} failed`, + }); } + throw new Error(`Command "${cmdStr}" (cwd: ${cwd}) exited with code ${result.exitCode}`); } }