diff --git a/.gitignore b/.gitignore index 8d67a86..38657be 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .DS_Store node_modules -dist +.env diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..c454bee --- /dev/null +++ b/dist/index.js @@ -0,0 +1 @@ +import{writeFile as e}from"fs/promises";import{join as t}from"path";var n=["interface","display","layout","module","panel","theme"],o=["hook","endpoint"],r=["operation"];function i(e,t,n){function o(n,o){var r;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(r=n._zod).traits??(r.traits=new Set),n._zod.traits.add(e),t(n,o);for(const e in s.prototype)e in n||Object.defineProperty(n,e,{value:s.prototype[e].bind(n)});n._zod.constr=s,n._zod.def=o}const r=n?.Parent??Object;class i extends r{}function s(e){var t;const r=n?.Parent?new i:this;o(r,e),(t=r._zod).deferred??(t.deferred=[]);for(const e of r._zod.deferred)e();return r}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class s extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const a={};function u(e){return a}function c(e,t){return"bigint"==typeof t?t.toString():t}function p(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function d(e){return null==e}function l(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const f=Symbol("evaluating");function h(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==f)return void 0===o&&(o=f,o=n()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function m(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function _(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function v(e){return JSON.stringify(e)}const y="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function g(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const z=p(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function w(e){if(!1===g(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==g(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}const k=new Set(["string","number","symbol"]);function b(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function Z(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function P(e,t=0){for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function x(e){return"string"==typeof e?e:e?.message}function E(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const r=x(e.inst?._zod.def?.error?.(e))??x(t?.error?.(e))??x(n.customError?.(e))??x(n.localeError?.(e))??"Invalid input";o.message=r}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function O(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function A(...e){const[t,n,o]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:o}:{...t}}const I=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,c,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},j=i("$ZodError",I),S=i("$ZodError",I,{Parent:Error});const C=e=>(t,n,o,r)=>{const i=o?Object.assign(o,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new s;if(a.issues.length){const t=new(r?.Err??e)(a.issues.map(e=>E(e,i,u())));throw y(t,r?.callee),t}return a.value},U=e=>async(t,n,o,r)=>{const i=o?Object.assign(o,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(r?.Err??e)(s.issues.map(e=>E(e,i,u())));throw y(t,r?.callee),t}return s.value},D=e=>(t,n,o)=>{const r=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new s;return i.issues.length?{success:!1,error:new(e??j)(i.issues.map(e=>E(e,r,u())))}:{success:!0,data:i.value}},R=D(S),F=e=>async(t,n,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>E(e,r,u())))}:{success:!0,data:i.value}},L=F(S),N=/^[cC][^\s-]{8,}$/,V=/^[0-9a-z]+$/,M=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,W=/^[0-9a-vA-V]{20}$/,J=/^[A-Za-z0-9]{27}$/,B=/^[a-zA-Z0-9_-]{21}$/,q=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,K=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,G=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,H=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Y=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,X=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Q=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ee=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,te=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ne=/^[A-Za-z0-9_-]*$/,oe=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,re=/^\+(?:[0-9]){6,14}[0-9]$/,ie="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",se=new RegExp(`^${ie}$`);function ae(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const ue=/true|false/i,ce=/^[^A-Z]*$/,pe=/^[^a-z]*$/,de=i("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),le=i("$ZodCheckMaxLength",(e,t)=>{var n;de.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!d(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const o=n.value;if(o.length<=t.maximum)return;const r=O(o);n.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fe=i("$ZodCheckMinLength",(e,t)=>{var n;de.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!d(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const r=O(o);n.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),he=i("$ZodCheckLengthEquals",(e,t)=>{var n;de.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!d(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const o=n.value,r=o.length;if(r===t.length)return;const i=O(o),s=r>t.length;n.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),me=i("$ZodCheckStringFormat",(e,t)=>{var n,o;de.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),_e=i("$ZodCheckRegex",(e,t)=>{me.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ve=i("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ce),me.init(e,t)}),ye=i("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=pe),me.init(e,t)}),ge=i("$ZodCheckIncludes",(e,t)=>{de.init(e,t);const n=b(t.includes),o=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ze=i("$ZodCheckStartsWith",(e,t)=>{de.init(e,t);const n=new RegExp(`^${b(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),we=i("$ZodCheckEndsWith",(e,t)=>{de.init(e,t);const n=new RegExp(`.*${b(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ke=i("$ZodCheckOverwrite",(e,t)=>{de.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class be{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),o=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of o)this.content.push(e)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const $e={major:4,minor:0,patch:14},Ze=i("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$e;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const t of o)for(const n of t._zod.onattach)n(e);if(0===o.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let o,r=P(e);for(const i of t){if(i._zod.def.when){if(!i._zod.def.when(e))continue}else if(r)continue;const t=e.issues.length,a=i._zod.check(e);if(a instanceof Promise&&!1===n?.async)throw new s;if(o||a instanceof Promise)o=(o??Promise.resolve()).then(async()=>{await a;e.issues.length!==t&&(r||(r=P(e,t)))});else{if(e.issues.length===t)continue;r||(r=P(e,t))}}return o?o.then(()=>e):e};e._zod.run=(n,r)=>{const i=e._zod.parse(n,r);if(i instanceof Promise){if(!1===r.async)throw new s;return i.then(e=>t(e,o,r))}return t(i,o,r)}}e["~standard"]={validate:t=>{try{const n=R(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return L(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),Pe=i("$ZodString",(e,t)=>{var n;Ze.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Te=i("$ZodStringFormat",(e,t)=>{me.init(e,t),Pe.init(e,t)}),xe=i("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=K),Te.init(e,t)}),Ee=i("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=G(e))}else t.pattern??(t.pattern=G());Te.init(e,t)}),Oe=i("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=H),Te.init(e,t)}),Ae=i("$ZodURL",(e,t)=>{Te.init(e,t),e._zod.check=n=>{try{const o=n.value.trim(),r=new URL(o);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:oe.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=r.href:n.value=o)}catch(o){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ie=i("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Te.init(e,t)}),je=i("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=B),Te.init(e,t)}),Se=i("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=N),Te.init(e,t)}),Ce=i("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=V),Te.init(e,t)}),Ue=i("$ZodULID",(e,t)=>{t.pattern??(t.pattern=M),Te.init(e,t)}),De=i("$ZodXID",(e,t)=>{t.pattern??(t.pattern=W),Te.init(e,t)}),Re=i("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=J),Te.init(e,t)}),Fe=i("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ae({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${ie}T(?:${o})$`)}(t)),Te.init(e,t)}),Le=i("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=se),Te.init(e,t)}),Ne=i("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ae(t)}$`)),Te.init(e,t)}),Ve=i("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=q),Te.init(e,t)}),Me=i("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Y),Te.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),We=i("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=X),Te.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Je=i("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Q),Te.init(e,t)}),Be=i("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ee),Te.init(e,t),e._zod.check=n=>{const[o,r]=n.value.split("/");try{if(!r)throw new Error;const e=Number(r);if(`${e}`!==r)throw new Error;if(e<0||e>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function qe(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Ke=i("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=te),Te.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{qe(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});const Ge=i("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ne),Te.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{(function(e){if(!ne.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return qe(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),He=i("$ZodE164",(e,t)=>{t.pattern??(t.pattern=re),Te.init(e,t)});const Ye=i("$ZodJWT",(e,t)=>{Te.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[o]=n;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&"JWT"!==r?.typ||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Xe=i("$ZodBoolean",(e,t)=>{Ze.init(e,t),e._zod.pattern=ue,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(e){}const r=n.value;return"boolean"==typeof r||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Qe=i("$ZodUnknown",(e,t)=>{Ze.init(e,t),e._zod.parse=e=>e}),et=i("$ZodNever",(e,t)=>{Ze.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function tt(e,t,n){e.issues.length&&t.issues.push(...T(n,e.issues)),t.value[n]=e.value}const nt=i("$ZodArray",(e,t)=>{Ze.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);const i=[];for(let e=0;ett(t,n,e))):tt(a,n,e)}return i.length?Promise.all(i).then(()=>n):n}});function ot(e,t,n,o){e.issues.length&&t.issues.push(...T(n,e.issues)),void 0===e.value?n in o&&(t.value[n]=void 0):t.value[n]=e.value}const rt=i("$ZodObject",(e,t)=>{Ze.init(e,t);const n=p(()=>{const e=Object.keys(t.shape);for(const n of e)if(!(t.shape[n]instanceof Ze))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(o=t.shape,Object.keys(o).filter(e=>"optional"===o[e]._zod.optin&&"optional"===o[e]._zod.optout));var o;return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}});h(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const o=e[t]._zod;if(o.values){n[t]??(n[t]=new Set);for(const e of o.values)n[t].add(e)}}return n});let o;const r=g,i=!a.jitless,s=i&&z.value,u=t.catchall;let c;e._zod.parse=(a,p)=>{c??(c=n.value);const d=a.value;if(!r(d))return a.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),a;const l=[];if(i&&s&&!1===p?.async&&!0!==p.jitless)o||(o=(e=>{const t=new be(["shape","payload","ctx"]),o=n.value,r=e=>{const t=v(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const e of o.keys)i[e]="key_"+s++;t.write("const newResult = {}");for(const e of o.keys){const n=i[e],o=v(e);t.write(`const ${n} = ${r(e)};`),t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),a=o(a,p);else{a.value={};const e=c.shape;for(const t of c.keys){const n=e[t]._zod.run({value:d[t],issues:[]},p);n instanceof Promise?l.push(n.then(e=>ot(e,a,t,d))):ot(n,a,t,d)}}if(!u)return l.length?Promise.all(l).then(()=>a):a;const f=[],h=c.keySet,m=u._zod,_=m.def.type;for(const e of Object.keys(d)){if(h.has(e))continue;if("never"===_){f.push(e);continue}const t=m.run({value:d[e],issues:[]},p);t instanceof Promise?l.push(t.then(t=>ot(t,a,e,d))):ot(t,a,e,d)}return f.length&&a.issues.push({code:"unrecognized_keys",keys:f,input:d,inst:e}),l.length?Promise.all(l).then(()=>a):a}});function it(e,t,n,o){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const r=e.filter(e=>!P(e));return 1===r.length?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>E(e,o,u())))}),t)}const st=i("$ZodUnion",(e,t)=>{Ze.init(e,t),h(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),h(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),h(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),h(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>l(e.source)).join("|")})$`)}});const n=1===t.options.length,o=t.options[0]._zod.run;e._zod.parse=(r,i)=>{if(n)return o(r,i);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>it(t,r,e,i)):it(a,r,e,i)}}),at=i("$ZodIntersection",(e,t)=>{Ze.init(e,t),e._zod.parse=(e,n)=>{const o=e.value,r=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return r instanceof Promise||i instanceof Promise?Promise.all([r,i]).then(([t,n])=>ct(e,t,n)):ct(e,r,i)}});function ut(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(w(e)&&w(t)){const n=Object.keys(t),o=Object.keys(e).filter(e=>-1!==n.indexOf(e)),r={...e,...t};for(const n of o){const o=ut(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r[n]=o.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o{Ze.init(e,t),e._zod.parse=(n,o)=>{const r=n.value;if(!w(r))return n.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),n;const i=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const e of s)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const s=t.valueType._zod.run({value:r[e],issues:[]},o);s instanceof Promise?i.push(s.then(t=>{t.issues.length&&n.issues.push(...T(e,t.issues)),n.value[e]=t.value})):(s.issues.length&&n.issues.push(...T(e,s.issues)),n.value[e]=s.value)}let a;for(const e in r)s.has(e)||(a=a??[],a.push(e));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:a})}else{n.value={};for(const s of Reflect.ownKeys(r)){if("__proto__"===s)continue;const a=t.keyType._zod.run({value:s,issues:[]},o);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>E(e,o,u())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}const c=t.valueType._zod.run({value:r[s],issues:[]},o);c instanceof Promise?i.push(c.then(e=>{e.issues.length&&n.issues.push(...T(s,e.issues)),n.value[a.value]=e.value})):(c.issues.length&&n.issues.push(...T(s,c.issues)),n.value[a.value]=c.value)}}return i.length?Promise.all(i).then(()=>n):n}}),dt=i("$ZodEnum",(e,t)=>{Ze.init(e,t);const n=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter(e=>k.has(typeof e)).map(e=>"string"==typeof e?b(e):e.toString()).join("|")})$`),e._zod.parse=(t,r)=>{const i=t.value;return o.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}}),lt=i("$ZodLiteral",(e,t)=>{if(Ze.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?b(e):e?b(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,o)=>{const r=n.value;return e._zod.values.has(r)||n.issues.push({code:"invalid_value",values:t.values,input:r,inst:e}),n}}),ft=i("$ZodTransform",(e,t)=>{Ze.init(e,t),e._zod.parse=(e,n)=>{const o=t.transform(e.value,e);if(n.async){return(o instanceof Promise?o:Promise.resolve(o)).then(t=>(e.value=t,e))}if(o instanceof Promise)throw new s;return e.value=o,e}});function ht(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const mt=i("$ZodOptional",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",e._zod.optout="optional",h(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),h(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${l(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(t=>ht(t,e.value)):ht(o,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),_t=i("$ZodNullable",(e,t)=>{Ze.init(e,t),h(e._zod,"optin",()=>t.innerType._zod.optin),h(e._zod,"optout",()=>t.innerType._zod.optout),h(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${l(e.source)}|null)$`):void 0}),h(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),vt=i("$ZodDefault",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",h(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(void 0===e.value)return e.value=t.defaultValue,e;const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(e=>yt(e,t)):yt(o,t)}});function yt(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const gt=i("$ZodPrefault",(e,t)=>{Ze.init(e,t),e._zod.optin="optional",h(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),zt=i("$ZodNonOptional",(e,t)=>{Ze.init(e,t),h(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,o)=>{const r=t.innerType._zod.run(n,o);return r instanceof Promise?r.then(t=>wt(t,e)):wt(r,e)}});function wt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const kt=i("$ZodCatch",(e,t)=>{Ze.init(e,t),h(e._zod,"optin",()=>t.innerType._zod.optin),h(e._zod,"optout",()=>t.innerType._zod.optout),h(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(o=>(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map(e=>E(e,n,u()))},input:e.value}),e.issues=[]),e)):(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map(e=>E(e,n,u()))},input:e.value}),e.issues=[]),e)}}),bt=i("$ZodPipe",(e,t)=>{Ze.init(e,t),h(e._zod,"values",()=>t.in._zod.values),h(e._zod,"optin",()=>t.in._zod.optin),h(e._zod,"optout",()=>t.out._zod.optout),h(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{const o=t.in._zod.run(e,n);return o instanceof Promise?o.then(e=>$t(e,t,n)):$t(o,t,n)}});function $t(e,t,n){return e.issues.length?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const Zt=i("$ZodReadonly",(e,t)=>{Ze.init(e,t),h(e._zod,"propValues",()=>t.innerType._zod.propValues),h(e._zod,"values",()=>t.innerType._zod.values),h(e._zod,"optin",()=>t.innerType._zod.optin),h(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(Pt):Pt(o)}});function Pt(e){return e.value=Object.freeze(e.value),e}const Tt=i("$ZodCustom",(e,t)=>{de.init(e,t),Ze.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const o=n.value,r=t.fn(o);if(r instanceof Promise)return r.then(t=>xt(t,n,o,e));xt(r,n,o,e)}});function xt(e,t,n,o){if(!e){const e={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),t.issues.push(A(e))}}class Et{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Ot(){return new Et}const At=Ot();function It(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Z(t)})}function jt(e,t){return new le({check:"max_length",...Z(t),maximum:e})}function St(e,t){return new fe({check:"min_length",...Z(t),minimum:e})}function Ct(e,t){return new he({check:"length_equals",...Z(t),length:e})}function Ut(e){return new ke({check:"overwrite",tx:e})}function Dt(e){const t=function(e,t){const n=new de({check:"custom",...Z(t)});return n._zod.check=e,n}(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(A(e,n.value,t._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(A(o))}},e(n.value,n)));return t}const Rt=i("ZodISODateTime",(e,t)=>{Fe.init(e,t),tn.init(e,t)});function Ft(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z(t)})}(Rt,e)}const Lt=i("ZodISODate",(e,t)=>{Le.init(e,t),tn.init(e,t)});function Nt(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Z(t)})}(Lt,e)}const Vt=i("ZodISOTime",(e,t)=>{Ne.init(e,t),tn.init(e,t)});function Mt(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Z(t)})}(Vt,e)}const Wt=i("ZodISODuration",(e,t)=>{Ve.init(e,t),tn.init(e,t)});function Jt(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Z(t)})}(Wt,e)}const Bt=i("ZodError",(e,t)=>{j.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const n=t||function(e){return e.message},o={_errors:[]},r=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>r({issues:e}));else if("invalid_key"===t.code)r({issues:t.issues});else if("invalid_element"===t.code)r({issues:t.issues});else if(0===t.path.length)o._errors.push(n(t));else{let e=o,r=0;for(;rfunction(e,t=e=>e.message){const n={},o=[];for(const r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):o.push(t(r));return{formErrors:o,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),qt=C(Bt),Kt=U(Bt),Gt=D(Bt),Ht=F(Bt),Yt=i("ZodType",(e,t)=>(Ze.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,n)=>$(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>qt(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Gt(e,t,n),e.parseAsync=async(t,n)=>Kt(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ht(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Z(n)})}(Qn,e,t)}(t,n)),e.superRefine=t=>e.check(Dt(t)),e.overwrite=t=>e.check(Ut(t)),e.optional=()=>Mn(e),e.nullable=()=>Jn(e),e.nullish=()=>Mn(Jn(e)),e.nonoptional=t=>function(e,t){return new Kn({type:"nonoptional",innerType:e,...Z(t)})}(e,t),e.array=()=>En(e),e.or=t=>jn([e,t]),e.and=t=>new Sn({type:"intersection",left:e,right:t}),e.transform=t=>Yn(e,new Nn({type:"transform",transform:t})),e.default=t=>{return n=t,new Bn({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.prefault=t=>{return n=t,new qn({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():n}});var n},e.catch=t=>{return new Gn({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>Yn(e,t),e.readonly=()=>new Xn({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return At.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>At.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return At.get(e);const n=e.clone();return At.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Xt=i("_ZodString",(e,t)=>{Pe.init(e,t),Yt.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new _e({check:"string_format",format:"regex",...Z(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new ge({check:"string_format",format:"includes",...Z(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new ze({check:"string_format",format:"starts_with",...Z(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new we({check:"string_format",format:"ends_with",...Z(t),suffix:e})}(...t)),e.min=(...t)=>e.check(St(...t)),e.max=(...t)=>e.check(jt(...t)),e.length=(...t)=>e.check(Ct(...t)),e.nonempty=(...t)=>e.check(St(1,...t)),e.lowercase=t=>e.check(function(e){return new ve({check:"string_format",format:"lowercase",...Z(e)})}(t)),e.uppercase=t=>e.check(function(e){return new ye({check:"string_format",format:"uppercase",...Z(e)})}(t)),e.trim=()=>e.check(Ut(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Ut(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Ut(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Ut(e=>e.toUpperCase()))}),Qt=i("ZodString",(e,t)=>{Pe.init(e,t),Xt.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Z(t)})}(nn,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Z(t)})}(sn,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Z(t)})}(wn,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Z(t)})}(an,t)),e.guid=t=>e.check(It(on,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Z(t)})}(rn,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z(t)})}(rn,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z(t)})}(rn,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z(t)})}(rn,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z(t)})}(un,t)),e.guid=t=>e.check(It(on,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Z(t)})}(cn,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z(t)})}(pn,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Z(t)})}(dn,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Z(t)})}(yn,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Z(t)})}(gn,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Z(t)})}(ln,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z(t)})}(fn,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z(t)})}(hn,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z(t)})}(mn,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z(t)})}(_n,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z(t)})}(vn,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Z(t)})}(zn,t)),e.datetime=t=>e.check(Ft(t)),e.date=t=>e.check(Nt(t)),e.time=t=>e.check(Mt(t)),e.duration=t=>e.check(Jt(t))});function en(e){return function(e,t){return new e({type:"string",...Z(t)})}(Qt,e)}const tn=i("ZodStringFormat",(e,t)=>{Te.init(e,t),Xt.init(e,t)}),nn=i("ZodEmail",(e,t)=>{Oe.init(e,t),tn.init(e,t)}),on=i("ZodGUID",(e,t)=>{xe.init(e,t),tn.init(e,t)}),rn=i("ZodUUID",(e,t)=>{Ee.init(e,t),tn.init(e,t)}),sn=i("ZodURL",(e,t)=>{Ae.init(e,t),tn.init(e,t)}),an=i("ZodEmoji",(e,t)=>{Ie.init(e,t),tn.init(e,t)}),un=i("ZodNanoID",(e,t)=>{je.init(e,t),tn.init(e,t)}),cn=i("ZodCUID",(e,t)=>{Se.init(e,t),tn.init(e,t)}),pn=i("ZodCUID2",(e,t)=>{Ce.init(e,t),tn.init(e,t)}),dn=i("ZodULID",(e,t)=>{Ue.init(e,t),tn.init(e,t)}),ln=i("ZodXID",(e,t)=>{De.init(e,t),tn.init(e,t)}),fn=i("ZodKSUID",(e,t)=>{Re.init(e,t),tn.init(e,t)}),hn=i("ZodIPv4",(e,t)=>{Me.init(e,t),tn.init(e,t)}),mn=i("ZodIPv6",(e,t)=>{We.init(e,t),tn.init(e,t)}),_n=i("ZodCIDRv4",(e,t)=>{Je.init(e,t),tn.init(e,t)}),vn=i("ZodCIDRv6",(e,t)=>{Be.init(e,t),tn.init(e,t)}),yn=i("ZodBase64",(e,t)=>{Ke.init(e,t),tn.init(e,t)}),gn=i("ZodBase64URL",(e,t)=>{Ge.init(e,t),tn.init(e,t)}),zn=i("ZodE164",(e,t)=>{He.init(e,t),tn.init(e,t)}),wn=i("ZodJWT",(e,t)=>{Ye.init(e,t),tn.init(e,t)}),kn=i("ZodBoolean",(e,t)=>{Xe.init(e,t),Yt.init(e,t)});function bn(e){return function(e,t){return new e({type:"boolean",...Z(t)})}(kn,e)}const $n=i("ZodUnknown",(e,t)=>{Qe.init(e,t),Yt.init(e,t)});function Zn(){return new $n({type:"unknown"})}const Pn=i("ZodNever",(e,t)=>{et.init(e,t),Yt.init(e,t)});function Tn(e){return function(e,t){return new e({type:"never",...Z(t)})}(Pn,e)}const xn=i("ZodArray",(e,t)=>{nt.init(e,t),Yt.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(St(t,n)),e.nonempty=t=>e.check(St(1,t)),e.max=(t,n)=>e.check(jt(t,n)),e.length=(t,n)=>e.check(Ct(t,n)),e.unwrap=()=>e.element});function En(e,t){return function(e,t,n){return new e({type:"array",element:t,...Z(n)})}(xn,e,t)}const On=i("ZodObject",(e,t)=>{rt.init(e,t),Yt.init(e,t),h(e,"shape",()=>t.shape),e.keyof=()=>Rn(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Zn()}),e.loose=()=>e.clone({...e._zod.def,catchall:Zn()}),e.strict=()=>e.clone({...e._zod.def,catchall:Tn()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!w(t))throw new Error("Invalid input to extend: expected a plain object");const n=_(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return m(this,"shape",n),n},checks:[]});return $(e,n)}(e,t),e.merge=t=>function(e,t){const n=_(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return m(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return $(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def;return $(e,_(e._zod.def,{get shape(){const e={};for(const o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(e[o]=n.shape[o])}return m(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,o=_(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete o[e]}return m(this,"shape",o),o},checks:[]});return $(e,o)}(e,t),e.partial=(...t)=>function(e,t,n){const o=_(t._zod.def,{get shape(){const o=t._zod.def.shape,r={...o};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=e?new e({type:"optional",innerType:o[t]}):o[t])}else for(const t in o)r[t]=e?new e({type:"optional",innerType:o[t]}):o[t];return m(this,"shape",r),r},checks:[]});return $(t,o)}(Vn,e,t[0]),e.required=(...t)=>function(e,t,n){const o=_(t._zod.def,{get shape(){const o=t._zod.def.shape,r={...o};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(r[t]=new e({type:"nonoptional",innerType:o[t]}))}else for(const t in o)r[t]=new e({type:"nonoptional",innerType:o[t]});return m(this,"shape",r),r},checks:[]});return $(t,o)}(Kn,e,t[0])});function An(e,t){const n={type:"object",get shape(){return m(this,"shape",{...e}),this.shape},...Z(t)};return new On(n)}const In=i("ZodUnion",(e,t)=>{st.init(e,t),Yt.init(e,t),e.options=t.options});function jn(e,t){return new In({type:"union",options:e,...Z(t)})}const Sn=i("ZodIntersection",(e,t)=>{at.init(e,t),Yt.init(e,t)});const Cn=i("ZodRecord",(e,t)=>{pt.init(e,t),Yt.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Un(e,t,n){return new Cn({type:"record",keyType:e,valueType:t,...Z(n)})}const Dn=i("ZodEnum",(e,t)=>{dt.init(e,t),Yt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,o)=>{const r={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);r[o]=t.entries[o]}return new Dn({...t,checks:[],...Z(o),entries:r})},e.exclude=(e,o)=>{const r={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete r[t]}return new Dn({...t,checks:[],...Z(o),entries:r})}});function Rn(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Dn({type:"enum",entries:n,...Z(t)})}const Fn=i("ZodLiteral",(e,t)=>{lt.init(e,t),Yt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ln(e,t){return new Fn({type:"literal",values:Array.isArray(e)?e:[e],...Z(t)})}const Nn=i("ZodTransform",(e,t)=>{ft.init(e,t),Yt.init(e,t),e._zod.parse=(n,o)=>{n.addIssue=o=>{if("string"==typeof o)n.issues.push(A(o,n.value,t));else{const t=o;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(A(t))}};const r=t.transform(n.value,n);return r instanceof Promise?r.then(e=>(n.value=e,n)):(n.value=r,n)}});const Vn=i("ZodOptional",(e,t)=>{mt.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Mn(e){return new Vn({type:"optional",innerType:e})}const Wn=i("ZodNullable",(e,t)=>{_t.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Jn(e){return new Wn({type:"nullable",innerType:e})}const Bn=i("ZodDefault",(e,t)=>{vt.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const qn=i("ZodPrefault",(e,t)=>{gt.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Kn=i("ZodNonOptional",(e,t)=>{zt.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Gn=i("ZodCatch",(e,t)=>{kt.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const Hn=i("ZodPipe",(e,t)=>{bt.init(e,t),Yt.init(e,t),e.in=t.in,e.out=t.out});function Yn(e,t){return new Hn({type:"pipe",in:e,out:t})}const Xn=i("ZodReadonly",(e,t)=>{Zt.init(e,t),Yt.init(e,t),e.unwrap=()=>e._zod.def.innerType});const Qn=i("ZodCustom",(e,t)=>{Tt.init(e,t),Yt.init(e,t)});var eo="directus:extension",to=An({app:en(),api:en()}),no=An({request:Mn(An({urls:En(en()),methods:En(jn([Ln("GET"),Ln("POST"),Ln("PATCH"),Ln("PUT"),Ln("DELETE")]))})),log:Mn(An({})),sleep:Mn(An({}))}),oo=Mn(An({enabled:bn(),requestedScopes:no})),ro=jn([An({type:Rn(o),name:en(),source:en()}),An({type:Rn(n),name:en(),source:en()}),An({type:Rn(r),name:en(),source:to})]),io=An({host:en(),hidden:bn().optional()}),so=An({type:Rn(n),path:en(),source:en()}),ao=An({type:Rn(o),path:en(),source:en(),sandbox:oo}),uo=An({type:Rn(r),path:to,source:to,sandbox:oo}),co=An({type:Ln("bundle"),partial:bn().optional(),path:to,entries:En(ro)});En(ro);var po=io.and(jn([so,ao,uo,co]));An({name:en(),version:en(),type:jn([Ln("module"),Ln("commonjs")]).optional(),description:en().optional(),icon:en().optional(),dependencies:Un(en(),en()).optional(),devDependencies:Un(en(),en()).optional(),[eo]:po});const lo=(e,t)=>new Date(e).toLocaleDateString("fr",{year:"numeric",month:"numeric",day:"numeric"});var fo=({action:n},{env:o})=>{const r=async()=>{const n=await fetch(`${o.PUBLIC_URL}/graphql`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:"\n\t\tquery getMaps {\n\t\t\tmaps {\n\t\t\t\tid\n\t\t\t\tproperty_name\n\t\t\t\tdescription\n\t\t\t\tdate_created\n\t\t\t\tphotos {\n\t\t\t\t\tphoto {\n\t\t\t\t\t\tid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tproperty_code_type\n\t\t\t\tproperty_type\n\t\t\t\tgeoFeatures\n\t\t\t\tproperty_rooms\n\t\t\t\tproperty_surface\n\t\t\t\tproperty_sell\n\t\t\t\tproperty_fees\n\t\t\t\tproperty_price\n\t\t\t\tproperty_dpe_conso\n\t\t\t\tproperty_dpe_ges\n\t\t\t\tproperty_dpe_date\n\t\t\t\tproperty_depenses_min\n\t\t\t\tproperty_depenses_max\n\t\t\t\tproperty_depenses_est\n\t\t\t\tproperty_dpe_date_price\n\t\t\t}\n\t\t}\n\t"})}),r=await n.json(),i=r.data?.maps??[],s=Array.isArray(i)?{client:[...i.map(e=>({annonce:{reference:e.id,titre:e.property_name,texte:e?.description??"Pas encore de description.",date_saisie:lo(e.date_created),photos:e?.photos?.map(e=>({photo:`${o.PUBLIC_URL}/assets/${e.photo.id}`}))??null,code_type:e.property_code_type??void 0,libelle_type:e.property_type??void 0,code_postal:e.geoFeatures.properties.postcode,ville:e.geoFeatures.properties.city,nb_pieces_logement:e.property_rooms,surface:e.property_surface??void 0,adresse:e.geoFeatures.properties.name??void 0,type:e.property_sell,frais_agence:e.property_fees,prix:"L"!==e.property_sell?e.property_price:void 0,loyer_mensuel:"L"===e.property_sell?e.property_price:void 0,dpe_valeur_conso:e.property_dpe_conso,dpe_valeur_ges:e.property_dpe_ges,dpe_date_realisation:lo(e.property_dpe_date),montant_depenses_energies_min:e.property_depenses_min,montant_depenses_energies_max:e.property_depenses_max,montant_depenses_energies_estime:e.property_depenses_est,date_indice_prix_energies:e.property_dpe_date_price,categories:e?.categories?.map(e=>e?.name)??void 0,updatedAt:e?.date_updated,settings:{zoom:e?.settings?.zoom??10,theme:e?.settings?.theme??"default",markers:e?.settings?.markers?.enabled??!1},...e?.location&&{latitude:e.location?.lat,longitude:e.location?.lng},...e?.metadata&&{originalMetadata:e.metadata}}}))]}:[];const a=JSON.stringify(s,null,2),u=t(o.OUTPUT_DIR,o.OUTPUT_FILENAME);await e(u,a,"utf8")};[`${o.COLLECTION}.items.create`,`${o.COLLECTION}.items.update`,`${o.COLLECTION}.items.delete`].forEach(e=>{n(e,r)})};export{fo as default};