@stoker-platform/node-client 0.5.52 → 0.5.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs +1 -1
- package/dist/bundle.js +1 -1
- package/package.json +2 -2
package/dist/bundle.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const He=require("lodash/isEqual.js"),Zo=require("lodash/merge.js"),qo=require("lodash/set.js"),he=require("lodash/cloneDeep.js"),It=require("firebase-admin/app"),B=require("firebase-admin/firestore"),ci=require("node:url"),Bo=require("cross-spawn"),ui=require("firebase-admin/database"),gt=require("firebase-admin/auth"),jn=n=>!!n.auth,Te=(n,e)=>{if(e?.operations)return e.operations.includes(n)},zn=(n,e)=>e?e.Role?n.access?.includes(e.Role):!1:!0,Ho=(n,e)=>e?!e.Role||n.restrictCreate===!0?!1:typeof n.restrictCreate=="object"?n.restrictCreate?.includes(e.Role):!0:!0,di=(n,e)=>e?!e.Role||n.restrictUpdate===!0?!1:typeof n.restrictUpdate=="object"?n.restrictUpdate?.includes(e.Role):!0:!0,dr=(n,e,t)=>{const{labels:s}=n;return t.collections&&Te("Update",t.collections[s.collection])&&(!e.access||zn(e,t))&&di(e,t)&&!(n.auth&&!t.collections?.[s.collection].auth&&["Enabled","Role","Name","Email","Photo_URL"].includes(e.name))},W=(n,e)=>n.filter(t=>t.name===e)[0],ee=n=>["OneToOne","OneToMany","ManyToOne","ManyToMany"].includes(n.type),fi=(n,e)=>{const t={Record_Owner:"recordOwner",Record_User:"recordUser",Record_Property:"recordProperty"},s=[],{labels:r,access:i}=n,{attributeRestrictions:o}=i,a=e.collections?.[r.collection];return o?.forEach(l=>{"roles"in l&&l.roles.forEach(c=>{const d=a?.[t[l.type]];c.role===e.Role&&(!c.assignable||d?.active)&&s.push(l)})}),s},Ps=(n,e)=>{const t=[],{labels:s,access:r}=n,{entityRestrictions:i}=r,o=e.collections?.[s.collection];return i?.restrictions?.forEach(a=>{"roles"in a&&a.roles.forEach(l=>{l.role===e.Role&&(!i.assignable?.includes(e.Role)||o?.restrictEntities)&&t.push(a)})}),t},hi=(n,e,t)=>{const s=[],{access:r}=n,{entityRestrictions:i}=r;return i?.parentFilters?.forEach(o=>{if(!o.roles.some(f=>f.role===t.Role))return;const a=o.collectionField,l=W(n.fields,a);if(!ee(l))throw new Error("PERMISSION_DENIED");const c=t.collections?.[l.collection],h=e.collections[l.collection].access.entityRestrictions;if(!h)throw new Error("PERMISSION_DENIED");const u=h.restrictions?.find(f=>f.type===o.type&&f.roles.some(y=>y.role===t.Role));if(!u)throw new Error("PERMISSION_DENIED");u.roles.forEach(f=>{f.role===t.Role&&(!h.assignable?.includes(t.Role)||c?.restrictEntities)&&s.push({parentFilter:o,parentRestriction:u})})}),s},mi=(n,e,t)=>{const s=Object.values(e.collections),{labels:r}=n,i=[];for(const o of s){const{fields:a}=o;for(const l of a)if(!(l.access&&!zn(l,t))&&t.Role&&ee(l)&&l.collection===r.collection&&l.dependencyFields)for(const c of l.dependencyFields)!i.find(h=>h.field===c.field)&&c.roles.includes(t.Role)&&i.push(c)}return i},Go=(n,e,t,s,r,i,o)=>{const{fields:a}=e,l=r.collections?.[e.labels.collection];let c=!0;if(!l){c=!1;return}const d=fi(e,r),h=Ps(e,r),u=hi(e,t,r);d?.filter(E=>E.type==="Record_Owner").forEach(E=>{"operations"in E&&E.operations&&!E.operations.includes(n)||i.Created_By!==s&&(c=!1)}),d?.filter(E=>E.type==="Record_User").forEach(E=>{if("operations"in E&&E.operations&&!E.operations.includes(n))return;const F=W(a,E.collectionField);i[`${F.name}_Array`]?.includes(r.Doc_ID)||(c=!1)}),d?.filter(E=>E.type==="Record_Property").forEach(E=>{if("operations"in E&&E.operations&&!E.operations.includes(n))return;const F=W(a,E.propertyField),_=E.roles.find(Z=>Z.role===r.Role);F.type==="Array"?_.values?.some(Z=>i[F.name].includes(Z))||(c=!1):_.values?.includes(i[F.name])||(c=!1)});let f=!0,y=!1;h?.filter(E=>E.type==="Individual").forEach(()=>{y=!0,l?.individualEntities?.includes(i.id)||(f=!1)});let v=!0,p=!1;if(h?.filter(E=>E.type==="Parent").forEach(E=>{p=!0;const F=W(a,E.collectionField);l?.parentEntities?.some(_=>i[`${F.name}_Array`].includes(_))||(v=!1)}),h?.filter(E=>E.type==="Parent_Property").forEach(E=>{p=!0;const F=W(a,E.collectionField),_=W(a,E.propertyField);Object.entries(l?.parentPropertyEntities||{}).some(Z=>{const[b,m]=Z;return b===i[_.name]&&i[`${F.name}_Array`].some(L=>m.includes(L))})||(v=!1)}),y&&p){if(!(f||v)){c=!1;return}}else if(!f||!v){c=!1;return}let g=!0,I=!1;u?.filter(E=>E.parentFilter.type==="Individual").forEach(E=>{I=!0;const{parentFilter:F}=E,_=W(a,F.collectionField),Z=r.collections?.[_.collection];if(!Z){c=!1;return}Z.individualEntities?.some(b=>i[`${_.name}_Array`].includes(b))||(g=!1)});let k=!0,x=!1;if(u?.filter(E=>E.parentFilter.type==="Parent").forEach(E=>{x=!0;const{parentFilter:F}=E,_=W(a,F.collectionField),Z=W(a,F.parentCollectionField),b=r.collections?.[_.collection];if(!b){c=!1;return}b.parentEntities?.some(m=>i[`${Z.name}_Array`].includes(m))||(k=!1)}),u?.filter(E=>E.parentFilter.type==="Parent_Property").forEach(E=>{x=!0;const{parentFilter:F}=E,_=W(a,F.collectionField),Z=W(a,F.parentPropertyField),b=W(a,F.parentCollectionField),m=r.collections?.[_.collection];if(!m){c=!1;return}Object.entries(m.parentPropertyEntities||{}).some(L=>{const[N,D]=L;return N===i[Z.name]&&i[`${b.name}_Array`].some(w=>D.includes(w))})||(k=!1)}),I&&x){if(!(g||k)){c=!1;return}}else if(!g||!k){c=!1;return}return c},it=(n,e,t,s,r,i)=>{const{labels:o}=e,a=r.collections?.[o.collection];let l=!0;if(!a||!r.Role)return l=!1,l;Te(n,a)||(l=!1);const d=Ps(e,r)?.filter(h=>h.type==="Individual").length>0;return n==="Create"&&d&&(l=!1),Go(n,e,t,s,r,i)||(l=!1),l},pi=(n,e,t)=>{const{labels:s}=n,r=[];for(const i of Object.values(e.collections));return r},Yo=(n,e)=>{let t=!0,s="";return Object.keys(e).forEach(r=>{if(!["Doc_ID","Role","Collection","Enabled","collections"].includes(r)){t=!1,s="Permissions object must contain Doc_ID, Role, Collection, Enabled, and collections";return}}),e.collections&&(Object.keys(e.collections).forEach(r=>{if(!Object.keys(n.collections).includes(r)){s=`Collection ${r} not found in schema`,t=!1;return}const i=n.collections[r],o=e.collections?.[r];if(o){if(!o.operations){s=`Collection ${r} does not have operations`,t=!1;return}if(!Object.keys(o).every(a=>["operations","auth","restrictEntities","individualEntities","parentEntities","parentPropertyEntities","recordProperty","recordUser","recordOwner"].includes(a))){s=`Collection ${r} has invalid properties`,t=!1;return}if(!o.operations.every(a=>["Read","Create","Update","Delete"].includes(a))){s=`Collection ${r} has invalid operations`,t=!1;return}if(o.auth&&(typeof o.auth!="boolean"||!i.auth)){s=`Collection ${r} has invalid auth value`,t=!1;return}if(o.restrictEntities&&!i.access.entityRestrictions?.restrictions){s=`Collection ${r} has invalid restrictEntities value`,t=!1;return}Object.entries(o).forEach(([a,l])=>{if(a!=="operations"&&a!=="auth"&&a!=="restrictEntities"){let c;a==="recordOwner"?c="Record_Owner":a==="recordUser"?c="Record_User":a==="recordProperty"?c="Record_Property":a==="individualEntities"?c="Individual":a==="parentEntities"?c="Parent":a==="parentPropertyEntities"&&(c="Parent_Property");const d=i.access.attributeRestrictions?.filter(u=>u.type===c&&u.roles.some(f=>f.role===e.Role)),h=i.access.entityRestrictions?.restrictions?.filter(u=>u.type===c&&u.roles.some(f=>f.role===e.Role));if(i.access.entityRestrictions?.assignable&&!(Array.isArray(i.access.entityRestrictions.assignable)&&i.access.entityRestrictions.assignable.every(u=>n.config.roles.includes(u)))){s=`Collection ${r} has invalid entity restrictions assignable value`,t=!1;return}if(d?.length||h?.length){if(a==="Record_Owner"||a==="Record_User"||a==="Record_Property"){const u=Object.keys(l);if(u.length!==1||u[0]!=="active"||typeof l.active!="boolean"){s=`Collection ${r} has invalid attribute restriction value`,t=!1;return}}if(a==="Individual"&&!Array.isArray(l)){s=`Collection ${r} has invalid individual entities value`,t=!1;return}if(a==="Parent"){const u=Object.keys(l);if(!(u.length===1&&Object.keys(n.collections).includes(u[0])&&Array.isArray(l[u[0]]))){s=`Collection ${r} has invalid parent entities value`,t=!1;return}}if(a==="Parent_Property"){const u=Object.keys(l);if(!(u.length===1&&Object.keys(n.collections).includes(u[0])&&typeof l[u[0]]=="object"&&l[u[0]]!==null)){s=`Collection ${r} has invalid parent property entities value`,t=!1;return}}}else{s=`Collection ${r} has invalid restriction type ${a}`,t=!1;return}}})}}),s&&console.error(`PERMISSION_DENIED: ${s}`)),t},Jo=(n,e,t)=>{let s=!0,r="";Object.values(n.collections).filter(i=>i.auth).forEach(i=>{if(e.collections?.[i.labels.collection]?.auth&&!i.access.auth?.includes(e.Role)){r="Record cannot have auth access to collection",s=!1;return}});for(const i of Object.values(n.collections)){const{labels:o,access:a,fields:l}=i,{operations:c,attributeRestrictions:d,entityRestrictions:h}=a,u=c.assignable,f=e.collections?.[o.collection],y=["read","create","update","delete"];if(u!==!0&&!(typeof u=="object"&&u.includes(t))?y.forEach(p=>{const g=p.charAt(0).toUpperCase()+p.slice(1);if(p!=="assignable"){const I=!!a.operations[p]?.includes(t),k=!!f?.operations.includes(g);if(!I&&k){r=`Collection ${o.collection} has excess ${p} operation for role ${t}`,s=!1;return}if(I&&!k){r=`Collection ${o.collection} has missing ${p} operation for role ${t}`,s=!1;return}}}):y.forEach(p=>{const g=p.charAt(0).toUpperCase()+p.slice(1);if(p!=="assignable"){const I=!!a.operations[p]?.includes(t),k=!!f?.operations.includes(g);if(!I&&k){r=`Collection ${o.collection} has excess ${p} operation for role ${t}`,s=!1;return}}}),!d&&!h||(d?.forEach(p=>{for(const g of p.roles)if(g.role===t&&!g.assignable){if(p.type==="Record_Owner"&&!e.collections?.[o.collection]?.recordOwner?.active){r=`Collection ${o.collection} is missing Record_Owner restriction for role ${t}`,s=!1;return}if(p.type==="Record_User"&&!e.collections?.[o.collection]?.recordUser?.active){r=`Collection ${o.collection} is missing Record_User restriction for role ${t}`,s=!1;return}if(p.type==="Record_Property"&&!e.collections?.[o.collection]?.recordProperty?.active){r=`Collection ${o.collection} is missing Record_Property restriction for role ${t}`,s=!1;return}}}),h?.assignable?.includes(t)))continue;let v=!1;if(h?.restrictions?.forEach(p=>{for(const g of p.roles)if(g.role===t){if(v=!0,p.type==="Individual"&&!e.collections?.[o.collection]?.individualEntities){r=`Collection ${o.collection} is missing individual entities`,s=!1;return}if(p.type==="Parent"){const I=W(l,p.collectionField);if(!ee(I)){s=!1;return}if(!e.collections?.[o.collection]?.parentEntities){r=`Collection ${o.collection} is missing parent entities`,s=!1;return}}if(p.type==="Parent_Property"){const I=W(l,p.collectionField);if(!ee(I)){s=!1;return}if(!e.collections?.[o.collection]?.parentPropertyEntities?.[I.collection]){r=`Collection ${o.collection} is missing parent property entities`,s=!1;return}}}}),v&&!e.collections?.[o.collection]?.restrictEntities){r=`Collection ${o.collection} must have restrictEntities set to true`,s=!1;return}}return r&&console.error(`PERMISSION_DENIED: ${r}`),s},Qo=(n,e,t,s,r,i,o,a,l)=>{const{access:c}=e,{permissionWriteRestrictions:d}=c;let h=!0,u="";const f=d?.filter(y=>s===y.userRole);return f?.length&&!f.some(y=>y.recordRole===r)?(u=`User ${s} does not have write access to record with role ${r}`,h=!1,h):n==="update"&&o.User_ID&&f?.length&&!f.some(y=>y.recordRole===a)?(u=`User ${s} does not have write access to record with role ${r}`,h=!1,h):(d?.forEach(y=>{s===y.userRole&&y.recordRole===r&&n!=="delete"&&i&&Object.keys(t.collections).forEach(v=>{const p=i.collections?.[v],g=l?.collections?.[v];if(!(n==="update"&&He(p,g))&&p){const I=y.collections.some(k=>k.collection===v);if(I){if(I){const k=y.collections.find(E=>E.collection===v);if(!(p.operations.every(E=>k.operations.includes(E))||n==="update"&&He(p.operations,g?.operations))){u=`User ${s} does not have write access to all included operations for collection ${v}`,h=!1;return}if(!k.auth&&p.auth&&!(n==="update"&&He(p.auth,g?.auth))){u=`User ${s} does not have write access to auth for collection ${v}`,h=!1;return}const x={recordOwner:"Record_Owner",recordUser:"Record_User",recordProperty:"Record_Property"};if(Object.keys(x).forEach(E=>{const F=x[E];if(k.attributeRestrictions?.includes(F)&&!(p[E]?.active||n==="update"&&He(p[E],g?.[E]))){u=`User ${s} does not have write access to attribute restriction ${E} for collection ${v}`,h=!1;return}}),k.restrictEntities&&!p.restrictEntities&&!(n==="update"&&He(p.restrictEntities,g?.restrictEntities))){u=`User ${s} does not have write access to restrictEntities for collection ${v}`,h=!1;return}}}else{u=`User ${s} does not have write access to collection ${v}`,h=!1;return}}})}),u&&console.error(`PERMISSION_DENIED: ${u}`),h)},Ko=(n,e,t,s)=>{let r=!0,i="";return Object.values(n.collections).forEach(o=>{const a=t.collections?.[o.labels.collection],l=s?.collections?.[o.labels.collection],c=e?.collections?.[o.labels.collection];if(a?.auth&&!l?.auth&&!jn(c)){i=`User does not have auth access to collection ${o.labels.collection}`,r=!1;return}for(const d of a?.operations||[])if(!l?.operations.includes(d)&&(!Te("Read",c)||!Te(d,c))){i=`User does not have ${d.toLowerCase()} access to collection ${o.labels.collection}`,r=!1;return}if(!a?.recordOwner&&l?.recordOwner&&c?.recordOwner){i=`User does not have write access to recordOwner for collection ${o.labels.collection}`,r=!1;return}if(!a?.recordUser&&l?.recordUser&&c?.recordUser){i=`User does not have write access to recordUser for collection ${o.labels.collection}`,r=!1;return}if(!a?.recordProperty&&l?.recordProperty&&c?.recordProperty){i=`User does not have write access to recordProperty for collection ${o.labels.collection}`,r=!1;return}if(!a?.restrictEntities&&l?.restrictEntities&&c?.restrictEntities){i=`User does not have write access to restrictEntities for collection ${o.labels.collection}`,r=!1;return}}),i&&console.error(`PERMISSION_DENIED: ${i}`),r},Ls=(n,e,t,s,r,i,o,a,l,c,d)=>{const{labels:h}=s;let u=!0,f="";if(!e.Role)return f="Record does not have a role",u=!1,u;if(n==="update"&&!c)return f="Original record is required for update operations",u=!1,u;if(n==="update"&&i&&d==="update"&&a&&!l)return f="Original permissions are required for this operation",u=!1,u;if(i){if(!o?.Role)return f="Current user does not have a role",u=!1,u;if(!Qo(n,s,r,o.Role,e.Role,a,c,c?.Role,l))return u=!1,u;if(n==="update"&&d!=="delete"&&c?.User_ID&&e.User_ID!==c.User_ID)return f="User ID does not match original user ID",u=!1,u;if(n==="update"&&c&&c.User_ID&&i===c.User_ID&&(a||e.Role!==c.Role||e.Enabled!==void 0&&e.Enabled!==c.Enabled))return f="User cannot update their own record",u=!1,u;if(n==="delete"&&i===e.User_ID)return f="User cannot delete their own record",u=!1,u}return n==="delete"||d==="delete"||!a?u:a.Role?(Yo(r,a)||(u=!1),a.Collection&&a.Collection!==h.collection?(f="Permissions collection does not match record collection",u=!1,u):a.Role!==e.Role?(f="Permissions role does not match record role",u=!1,u):a.Enabled!==void 0&&!!a.Enabled!=!!e.Enabled?(f="Permissions enabled state does not match record enabled state",u=!1,u):a.Doc_ID&&a.Doc_ID!==t?(f="Permissions doc ID does not match record doc ID",u=!1,u):!Jo(r,a,a.Role)||i&&o&&l&&!Ko(r,o,a,l)?(u=!1,u):(f&&console.error(`PERMISSION_DENIED: ${f}`),u)):(f="Permissions do not have a role",u=!1,u)},fr=(n,e,t,s,r,i,o)=>{const{labels:a,fields:l}=t,c=i?.collections?.[a.collection];let d=!0;if(r&&!c)throw new Error("PERMISSION_DENIED");r&&!Te("Create",c)&&(d=!1),r&&!it("Create",t,s,r,i,n)&&(d=!1),t.auth&&o&&(r&&!jn(c)&&(d=!1),Ls("create",n,e,t,s,r,i,o)||(d=!1));for(const h of l){const u=n[h.name];h.access&&!zn(h,i)&&u!==void 0&&(d=!1),u!==void 0&&!Ho(h,i)&&(d=!1)}if(!d)throw new Error("PERMISSION_DENIED")},ke=n=>n&&(n._methodName==="deleteField"||n.constructor.name==="DeleteTransform"),nt=n=>{for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(ke(n[e])?delete n[e]:typeof n[e]=="object"&&n[e]!==null&&nt(n[e]))},hr=(n,e,t,s,r,i,o,a,l,c)=>{const{labels:d,fields:h}=s,u=o?.collections?.[d.collection],f={...e,...n};nt(f);let y=!0,v="";if(i&&!u)throw new Error("PERMISSION_DENIED");i&&!Te("Update",u)&&(y=!1,v="Authenticated user does not have Update access to this collection"),i&&(!it("Update",s,r,i,o,e)||!it("Update",s,r,i,o,f))&&(y=!1,v="Authenticated user does not have Update access to this document"),i&&s.softDelete&&f[s.softDelete.archivedField]!==e[s.softDelete.archivedField]&&!Te("Delete",u)&&(y=!1,v="Authenticated user does not have Delete or Restore access to this document"),a&&(i&&!jn(u)&&(y=!1,v="Authenticated user does not have Auth access for this collection"),Ls("update",f,t,s,r,i,o,l,c,e,a)||(v="Authenticated user does not have sufficient write access for this record",y=!1));for(const p of h){const g=n[p.name];p.access&&!zn(p,o)&&g!==void 0&&(v=`Authenticated user does not have access to field ${p.name}`,y=!1),g!==void 0&&!di(p,o)&&(v=`Authenticated user does not have Update access to field ${p.name}`,y=!1)}if(!y)throw v&&console.error(`PERMISSION_DENIED: ${v}`),new Error("PERMISSION_DENIED")},Xo=(n,e,t,s,r,i)=>{const{labels:o}=t,a=i.collections?.[o.collection];let l=!0;if(!a)throw new Error("PERMISSION_DENIED");if(Te("Delete",a)||(l=!1),it("Delete",t,s,r,i,n)||(l=!1),t.auth&&n.User_ID&&(jn(a)||(l=!1),Ls("delete",n,e,t,s,r,i)||(l=!1)),!l)throw new Error("PERMISSION_DENIED")},ea=async(n,e,t,s,r)=>{const{labels:i}=e,o=r.collections?.[i.collection];let a=!0;if(!o){a=!1;return}if(Te("Read",o)||(a=!1),it("Read",e,t,s,r,n)||(a=!1),!a)throw new Error("PERMISSION_DENIED")},ta=async(n,e,t,s,r)=>{const{labels:i}=e,o=r.collections?.[i.collection];let a=!0;if(!o){a=!1;return}if(Te("Read",o)||(a=!1),n.forEach(l=>{it("Read",e,t,s,r,l)||(a=!1)}),!a)throw new Error("PERMISSION_DENIED")},na=(n,e,t)=>{const{access:s}=n;return s.operations[t]?.includes(e)},sa=(n,e,t)=>{const{access:s}=e,{entityRestrictions:r}=s;if(r?.restrictions){for(const i of r.restrictions)if(i.roles?.some(o=>o.role===n)&&!("singleQuery"in i&&i.singleQuery))return`${i.type} entity restriction`}if(r?.parentFilters)for(const i of r.parentFilters){if(!i.roles.some(c=>c.role===n))continue;const o=W(e.fields,i.collectionField);if(!ee(o))throw new Error("PERMISSION_DENIED");const l=t.collections[o.collection].access.entityRestrictions?.restrictions?.find(c=>c.type===i.type&&c.roles.some(d=>d.role===n));if(!l)throw new Error("PERMISSION_DENIED");if(l.type!==i.type)throw new Error("PERMISSION_DENIED");if(!("singleQuery"in l&&l.singleQuery))return`${i.type} parent filter`}return!0},ra=(n,e,t,s,r)=>{const i={};for(const o of n){const l=e[o].default({sdk:t,utils:s,context:r});for(const c in l)c==="custom"||c==="admin"||c==="fields"||delete l[c];for(const c of l.fields)for(const d in c)d==="custom"||d==="admin"||d==="name"||d==="formula"||delete c[d];i[o]=l}return i},Ae=(n,e)=>e.fields.filter(t=>t.name===n.name)[0],Kn={global:{},collections:{}},qt=(n,e)=>n&&typeof n=="function"?e?n(...e):n():n,oe=async(n,e)=>{let t=n;return n&&(typeof n=="function"||typeof n.then=="function")&&(e?t=await n(...e):t=await n()),t},ia=async(n,e,t,s)=>{for(const d of e)if(d==="__proto__"||d==="constructor"||d==="prototype")throw new Error("Invalid config path: prototype pollution keys are not allowed");let r=Kn,i=!0;for(const d of e){if(d===void 0||r[d]===void 0){i=!1;break}r=r[d]}if(r&&i&&!s)return r;let o,a=n,l=!0;e[0]==="collections"?o=e.slice(2):o=e.slice(1);for(const d of o){if(d===void 0||a[d]===void 0){l=!1;break}a=a[d]}let c;if(l&&(c=await oe(a,t)),c){let d=Kn;const h={};for(let u=0;u<e.length;u++){const f=e[u];if(f!==void 0){if(f==="__proto__"||f==="constructor"||f==="prototype")throw new Error("Invalid config path: prototype pollution keys are not allowed");u===e.length-1?qo(h,e.join("."),c):(d[f]||={},d=d[f])}}Zo(Kn,h)}return c},lt=(n,e,t)=>{const s=Object.values(t.collections),{labels:r}=e;let i=!1;for(const o of s){const{fields:a}=o;for(const l of a)if(ee(l)&&l.collection===r.collection&&l.dependencyFields)for(const c of l.dependencyFields)c.field===n.name&&(i=!0)}return i},yi=(n,e)=>{const t=Object.values(e.collections),{labels:s}=n,r={};return t.forEach(i=>{const{labels:o,fields:a}=i;a.forEach(l=>{ee(l)&&l.collection===s.collection&&l.dependencyFields&&l.dependencyFields.forEach(c=>{r[c.field]||={},r[c.field][o.collection]||=[],r[c.field][o.collection]=r[c.field][o.collection].concat(c.roles),r[c.field][o.collection]=[...new Set(r[c.field][o.collection])]})})}),r},Xn=n=>JSON.stringify(n.map(e=>e.name)),mt=["id","Collection_Path","Last_Write_At","Last_Save_At","Last_Write_By","Last_Write_App","Last_Write_Connection_Status","Last_Write_Version","Created_At","Saved_At","Created_By"],Zn=()=>mt.map(n=>{let e="",t;switch(n){case"id":e="String";break;case"Collection_Path":e="Array";break;case"Created_At":e="Timestamp";break;case"Saved_At":e="Timestamp";break;case"Created_By":e="String";break;case"Last_Write_At":e="Timestamp";break;case"Last_Save_At":e="Timestamp";break;case"Last_Write_By":e="String";break;case"Last_Write_App":e="String";break;case"Last_Write_Connection_Status":e="String",t=["Online","Offline"];break;case"Last_Write_Version":e="Number";break}const s={name:n,type:e,required:!0};return t&&(s.values=t),s}),gi=(n,e)=>{const t=[],{access:s,fields:r}=n,{attributeRestrictions:i,entityRestrictions:o}=s,a=Zn();return i&&i.forEach(l=>{if(l.roles.some(c=>c.role===e))switch(l.type){case"Record_Owner":t.push(W(a,"Created_By"));break;case"Record_User":t.push(W(r,l.collectionField));break;case"Record_Property":t.push(W(r,l.propertyField));break}}),o&&(o.restrictions?.forEach(l=>{if(l.roles.some(c=>c.role===e))switch(l.type){case"Individual":t.push(W(a,"id"));break;case"Parent":t.push(W(r,l.collectionField));break;case"Parent_Property":t.push(W(r,l.collectionField)),t.push(W(r,l.propertyField));break}}),o.parentFilters&&o.parentFilters.forEach(l=>{if(l.roles.some(c=>c.role===e))switch(l.type){case"Individual":t.push(W(r,l.collectionField));break;case"Parent":t.push(W(r,l.parentCollectionField));break;case"Parent_Property":t.push(W(r,l.parentCollectionField)),t.push(W(r,l.parentPropertyField));break}})),[...new Set(t)]},oa=(n,e)=>{const t=[],{fields:s,roleSystemFields:r,preloadCache:i,queries:o}=n,a=Zn();return t.push({name:"Collection_Path",type:"Array",required:!0}),s.forEach(c=>{(!c.access||c.access.includes(e))&&t.push(c)}),r?.filter(c=>(!c.roles||c.roles.includes(e))&&c.field!=="Collection_Path").forEach(c=>{t.push(W(a,c.field))}),i?.range&&i.range.fields.forEach(c=>{mt.includes(c)&&t.push(W(a,c))}),o?.forEach(c=>{const d=W(s.concat(a),c.field);(!c.roles||c.roles.includes(e))&&d&&(!d.access||d.access?.includes(e))&&mt.includes(c.field)&&t.push(W(a,c.field))}),gi(n,e).forEach(c=>{mt.includes(c.name)&&t.push(W(a,c.name))}),[...new Set(t)]},aa=(n,e,t)=>{const s=[],{fields:r,preloadCache:i}=e,o=Zn();i?.range&&i.range.fields.forEach(c=>{mt.includes(c)?s.push(W(o,c)):s.push(W(r,c))});const a=new Set,l=yi(e,t);return Object.entries(l).map(([c,d])=>{n.name===c&&Object.values(d).forEach(h=>{h.forEach(u=>{a.add(u)})})}),a.forEach(c=>{s.push(...gi(e,c))}),[...new Set(s)]},dn=(n,e,t)=>{const s=[],{fields:r,softDelete:i}=e;s.push({name:"Collection_Path",type:"Array",required:!0}),s.push({name:"id",type:"String",required:!0});const o=[],a=yi(e,t);if(Object.values(a).forEach(l=>{Object.keys(l).forEach(c=>{t.collections[c].fields.forEach(h=>{ee(h)&&h.collection===e.labels.collection&&h.dependencyFields?.some(u=>u.field===n.name)&&h.constraints&&h.constraints.forEach(u=>{o.push(u[0])})})})}),o.forEach(l=>{s.push(W(r,l))}),i){const l=W(r,i.archivedField);l&&s.push(l)}return s.push(...aa(n,e,t)),[...new Set(s)]},wi=(n,e)=>{const{preloadCache:t}=n,s=new Set;for(const r of e.config.roles){if(!na(n,r,"read"))continue;const i=oa(n,r);let o=!1;if(s.size===0)s.add({key:"1",roles:[r],fields:i}),o=!0;else for(const a of s)i.length===a.fields.length&&i.every(l=>a.fields.some(c=>c.name===l.name))&&!!t?.roles.includes(r)==!!a.roles.every(l=>t?.roles.includes(l))&&(a.roles.push(r),o=!0);o||s.add({key:(s.size+1).toString(),roles:[r],fields:i})}return s},_i=(n,e,t)=>{const s=wi(e,t);for(const r of s.values())if(r.roles.includes(n))return r},la=(n,e)=>{const{fields:t}=e,s=Zn(),r=[];return[...t,...s.filter(o=>o.name!=="id")].forEach(o=>{n?.fields.some(a=>a.name===o.name)||r.push(o)}),r},Vs=(n,e,t)=>{const s={};return Object.values(n.collections).forEach(r=>{const i=wi(r,n),o=Array.from(i);o.map(a=>(a.fields.forEach(l=>{}),a)),s[r.labels.collection]=new Set(o)}),s},Tn=n=>({Last_Write_At:n.Last_Write_At,Last_Write_By:n.Last_Write_By,Last_Write_Connection_Status:n.Last_Write_Connection_Status,Last_Write_Version:n.Last_Write_Version,Last_Write_App:n.Last_Write_App,Last_Save_At:n.Last_Save_At}),es=async(n,e,t)=>{if(e){const s=await oe(e,[t]);if(s===!1)throw new Error(`CANCELLED: Operation cancelled by ${n}`);return s}};async function ae(n,e,t,s){const r=await es(n,t.custom?.[n],s);for(const i of t.fields)await es(n,i.custom?.[n],s);if(n!=="setEmbedding"&&(await es(n,e?.[n],s),n==="postWriteError"))return r}const Us=(n,e,t,s,r,i,o,a,l,c)=>(n==="create"&&(t.Collection_Path=e,t.Created_At=a,t.Saved_At=l,t.Created_By=o||"System"),t.Last_Write_App=r,t.Last_Write_At=a,t.Last_Save_At=l,t.Last_Write_By=o||"System",t.Last_Write_Connection_Status=i,t.Last_Write_Version=s.version,t),dt=(n,e)=>{const{access:t,queries:s}=n,{serverReadOnly:r}=t,i=new Set;if(s)for(const o of s){const a=W(e,o.field);e.find(l=>l.name===o.field)&&ee(a)&&["OneToOne","OneToMany"].includes(a.type)&&i.add(a)}return e.forEach(o=>{ee(o)&&["OneToOne","OneToMany"].includes(o.type)&&o.sorting&&(typeof o.sorting=="boolean"||!o.sorting.roles?.every(a=>r?.includes(a)))&&i.add(o)}),i},wt=(n,e)=>{const{access:t,recordTitleField:s}=n,{serverReadOnly:r}=t,i=new Set;return e.forEach(o=>{(s===o.name||o.sorting&&(typeof o.sorting=="boolean"||!o.sorting.roles?.every(a=>r?.includes(a))))&&o.type==="String"&&i.add(o)}),i},Sn=(n,e,t)=>{const{fields:s}=n;s.forEach(i=>{if(ee(i))if(e[i.name]){if(ke(e[i.name]))e[`${i.name}_Array`]=e[i.name];else if(e[`${i.name}_Array`]=Object.keys(e[i.name]),i.includeFields)for(const o of i.includeFields){const a=t.collections[i.collection],l=W(a.fields,o);wt(a,[l]).size===1&&Object.keys(e[i.name]).forEach(d=>{e[i.name][d][o]?e[i.name][d][`${o}_Lowercase`]=e[i.name][d][o].toLowerCase():delete e[i.name][d][`${o}_Lowercase`]})}}else delete e[`${i.name}_Array`],delete e[`${i.name}_Single`]}),dt(n,s).forEach(i=>{if(e[i.name])if(ke(e[i.name]))e[`${i.name}_Single`]=e[i.name];else{const o=e[`${i.name}_Array`]?.[0];if(o){const a=e[i.name][o]||{};e[`${i.name}_Single`]={id:o,...a}}}})},Rn=(n,e)=>{wt(n,n.fields).forEach(s=>{e[s.name]?e[`${s.name}_Lowercase`]=e[s.name].toLowerCase():delete e[`${s.name}_Lowercase`]})},ca=async(n,e,t,s)=>{const{fields:r}=e;for(const i of t.fields){const o=W(r,i.name);i.custom?.initialValue!==void 0&&!(s&&o.access&&!o.access.includes(s))&&(n[i.name]=await oe(i.custom.initialValue,[n]),wt(e,[o]).size===1&&(n[`${i.name}_Lowercase`]=n[i.name].toLowerCase()))}for(const i of r)s&&i.access&&!i.access.includes(s)||("autoIncrement"in i&&i.autoIncrement&&!n[i.name]&&(n[i.name]="Pending"),!ee(i)&&i.nullable&&n[i.name]===void 0&&(n[i.name]=null))};var se;(function(n){n.assertEqual=r=>{};function e(r){}n.assertIs=e;function t(r){throw new Error}n.assertNever=t,n.arrayToEnum=r=>{const i={};for(const o of r)i[o]=o;return i},n.getValidEnumValues=r=>{const i=n.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),o={};for(const a of i)o[a]=r[a];return n.objectValues(o)},n.objectValues=r=>n.objectKeys(r).map(function(i){return r[i]}),n.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&i.push(o);return i},n.find=(r,i)=>{for(const o of r)if(i(o))return o},n.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,i=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}n.joinValues=s,n.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(se||(se={}));var mr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(mr||(mr={}));const U=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xe=n=>{switch(typeof n){case"undefined":return U.undefined;case"string":return U.string;case"number":return Number.isNaN(n)?U.nan:U.number;case"boolean":return U.boolean;case"function":return U.function;case"bigint":return U.bigint;case"symbol":return U.symbol;case"object":return Array.isArray(n)?U.array:n===null?U.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?U.promise:typeof Map<"u"&&n instanceof Map?U.map:typeof Set<"u"&&n instanceof Set?U.set:typeof Date<"u"&&n instanceof Date?U.date:U.object;default:return U.unknown}},A=se.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ye extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},s={_errors:[]},r=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let a=s,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return r(this),s}static assert(e){if(!(e instanceof Ye))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const r of this.issues)if(r.path.length>0){const i=r.path[0];t[i]=t[i]||[],t[i].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}Ye.create=n=>new Ye(n);const gs=(n,e)=>{let t;switch(n.code){case A.invalid_type:n.received===U.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case A.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,se.jsonStringifyReplacer)}`;break;case A.unrecognized_keys:t=`Unrecognized key(s) in object: ${se.joinValues(n.keys,", ")}`;break;case A.invalid_union:t="Invalid input";break;case A.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${se.joinValues(n.options)}`;break;case A.invalid_enum_value:t=`Invalid enum value. Expected ${se.joinValues(n.options)}, received '${n.received}'`;break;case A.invalid_arguments:t="Invalid function arguments";break;case A.invalid_return_type:t="Invalid function return type";break;case A.invalid_date:t="Invalid date";break;case A.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:se.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case A.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case A.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case A.custom:t="Invalid input";break;case A.invalid_intersection_types:t="Intersection results could not be merged";break;case A.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case A.not_finite:t="Number must be finite";break;default:t=e.defaultError,se.assertNever(n)}return{message:t}};let ua=gs;function da(){return ua}const fa=n=>{const{data:e,path:t,errorMaps:s,issueData:r}=n,i=[...t,...r.path||[]],o={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let a="";const l=s.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...r,path:i,message:a}};function P(n,e){const t=da(),s=fa({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===gs?void 0:gs].filter(r=>!!r)});n.common.issues.push(s)}class _e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const r of t){if(r.status==="aborted")return J;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const r of t){const i=await r.key,o=await r.value;s.push({key:i,value:o})}return _e.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const r of t){const{key:i,value:o}=r;if(i.status==="aborted"||o.status==="aborted")return J;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(s[i.value]=o.value)}return{status:e.value,value:s}}}const J=Object.freeze({status:"aborted"}),Bt=n=>({status:"dirty",value:n}),Ce=n=>({status:"valid",value:n}),pr=n=>n.status==="aborted",yr=n=>n.status==="dirty",Dt=n=>n.status==="valid",In=n=>typeof Promise<"u"&&n instanceof Promise;var j;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(j||(j={}));class je{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gr=(n,e)=>{if(Dt(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ye(n.common.issues);return this._error=t,this._error}}};function K(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:r}=n;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,a)=>{const{message:l}=n;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??s??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??t??a.defaultError}},description:r}}class te{get description(){return this._def.description}_getType(e){return Xe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _e,ctx:{common:e.parent.common,data:e.data,parsedType:Xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(In(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)},r=this._parseSync({data:e,path:s.path,parent:s});return gr(s,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return Dt(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>Dt(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)},r=this._parse({data:e,path:s.path,parent:s}),i=await(In(r)?r:Promise.resolve(r));return gr(s,i)}refine(e,t){const s=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,i)=>{const o=e(r),a=()=>i.addIssue({code:A.custom,...s(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new Ft({schema:this,typeName:Y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return st.create(this,this._def)}nullable(){return $t.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ue.create(this)}promise(){return Cn.create(this,this._def)}or(e){return Nn.create([this,e],this._def)}and(e){return Dn.create(this,e,this._def)}transform(e){return new Ft({...K(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ks({...K(this._def),innerType:this,defaultValue:t,typeName:Y.ZodDefault})}brand(){return new $a({typeName:Y.ZodBranded,type:this,...K(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new bs({...K(this._def),innerType:this,catchValue:t,typeName:Y.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ws.create(this,e)}readonly(){return Ts.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ha=/^c[^\s-]{8,}$/i,ma=/^[0-9a-z]+$/,pa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ya=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ga=/^[a-z0-9_-]{21}$/i,wa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_a=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ea=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,va="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ts;const Oa=/^(?:(?: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])$/,ka=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ba=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ta=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sa=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ra=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ei="((\\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])))",Ia=new RegExp(`^${Ei}$`);function vi(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function xa(n){return new RegExp(`^${vi(n)}$`)}function Na(n){let e=`${Ei}T${vi(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Da(n,e){return!!((e==="v4"||!e)&&Oa.test(n)||(e==="v6"||!e)&&ba.test(n))}function Aa(n,e){if(!wa.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Ca(n,e){return!!((e==="v4"||!e)&&ka.test(n)||(e==="v6"||!e)&&Ta.test(n))}class Ge extends te{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==U.string){const i=this._getOrReturnCtx(e);return P(i,{code:A.invalid_type,expected:U.string,received:i.parsedType}),J}const s=new _e;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),P(r,{code:A.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),P(r,{code:A.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(r=this._getOrReturnCtx(e,r),o?P(r,{code:A.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&P(r,{code:A.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")Ea.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"email",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")ts||(ts=new RegExp(va,"u")),ts.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"emoji",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")ya.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"uuid",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")ga.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"nanoid",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")ha.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"cuid",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")ma.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"cuid2",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")pa.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"ulid",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),P(r,{validation:"url",code:A.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"regex",code:A.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?Na(i).test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?Ia.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?xa(i).test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?_a.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"duration",code:A.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?Da(e.data,i.version)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"ip",code:A.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?Aa(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"jwt",code:A.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?Ca(e.data,i.version)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"cidr",code:A.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?Sa.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"base64",code:A.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?Ra.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"base64url",code:A.invalid_string,message:i.message}),s.dirty()):se.assertNever(i);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),{validation:t,code:A.invalid_string,...j.errToObj(s)})}_addCheck(e){return new Ge({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...j.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...j.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...j.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...j.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...j.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...j.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...j.errToObj(t)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new Ge({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ge({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ge({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ge.create=n=>new Ge({checks:[],typeName:Y.ZodString,coerce:n?.coerce??!1,...K(n)});function Fa(n,e){const t=(n.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,i=Number.parseInt(n.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return i%o/10**r}class At extends te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==U.number){const i=this._getOrReturnCtx(e);return P(i,{code:A.invalid_type,expected:U.number,received:i.parsedType}),J}let s;const r=new _e;for(const i of this._def.checks)i.kind==="int"?se.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{code:A.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?Fa(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{code:A.not_finite,message:i.message}),r.dirty()):se.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,j.toString(t))}gt(e,t){return this.setLimit("min",e,!1,j.toString(t))}lte(e,t){return this.setLimit("max",e,!0,j.toString(t))}lt(e,t){return this.setLimit("max",e,!1,j.toString(t))}setLimit(e,t,s,r){return new At({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:j.toString(r)}]})}_addCheck(e){return new At({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&se.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}At.create=n=>new At({checks:[],typeName:Y.ZodNumber,coerce:n?.coerce||!1,...K(n)});class en extends te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==U.bigint)return this._getInvalidInput(e);let s;const r=new _e;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):se.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return P(t,{code:A.invalid_type,expected:U.bigint,received:t.parsedType}),J}gte(e,t){return this.setLimit("min",e,!0,j.toString(t))}gt(e,t){return this.setLimit("min",e,!1,j.toString(t))}lte(e,t){return this.setLimit("max",e,!0,j.toString(t))}lt(e,t){return this.setLimit("max",e,!1,j.toString(t))}setLimit(e,t,s,r){return new en({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:j.toString(r)}]})}_addCheck(e){return new en({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}en.create=n=>new en({checks:[],typeName:Y.ZodBigInt,coerce:n?.coerce??!1,...K(n)});class ws extends te{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==U.boolean){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.boolean,received:s.parsedType}),J}return Ce(e.data)}}ws.create=n=>new ws({typeName:Y.ZodBoolean,coerce:n?.coerce||!1,...K(n)});class xn extends te{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==U.date){const i=this._getOrReturnCtx(e);return P(i,{code:A.invalid_type,expected:U.date,received:i.parsedType}),J}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return P(i,{code:A.invalid_date}),J}const s=new _e;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),P(r,{code:A.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),P(r,{code:A.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):se.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new xn({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:j.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}xn.create=n=>new xn({checks:[],coerce:n?.coerce||!1,typeName:Y.ZodDate,...K(n)});class wr extends te{_parse(e){if(this._getType(e)!==U.symbol){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.symbol,received:s.parsedType}),J}return Ce(e.data)}}wr.create=n=>new wr({typeName:Y.ZodSymbol,...K(n)});class _s extends te{_parse(e){if(this._getType(e)!==U.undefined){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.undefined,received:s.parsedType}),J}return Ce(e.data)}}_s.create=n=>new _s({typeName:Y.ZodUndefined,...K(n)});class _r extends te{_parse(e){if(this._getType(e)!==U.null){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.null,received:s.parsedType}),J}return Ce(e.data)}}_r.create=n=>new _r({typeName:Y.ZodNull,...K(n)});class Es extends te{constructor(){super(...arguments),this._any=!0}_parse(e){return Ce(e.data)}}Es.create=n=>new Es({typeName:Y.ZodAny,...K(n)});class Er extends te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ce(e.data)}}Er.create=n=>new Er({typeName:Y.ZodUnknown,...K(n)});class ot extends te{_parse(e){const t=this._getOrReturnCtx(e);return P(t,{code:A.invalid_type,expected:U.never,received:t.parsedType}),J}}ot.create=n=>new ot({typeName:Y.ZodNever,...K(n)});class vr extends te{_parse(e){if(this._getType(e)!==U.undefined){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.void,received:s.parsedType}),J}return Ce(e.data)}}vr.create=n=>new vr({typeName:Y.ZodVoid,...K(n)});class Ue extends te{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==U.array)return P(t,{code:A.invalid_type,expected:U.array,received:t.parsedType}),J;if(r.exactLength!==null){const o=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(o||a)&&(P(t,{code:o?A.too_big:A.too_small,minimum:a?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(P(t,{code:A.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(P(t,{code:A.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>r.type._parseAsync(new je(t,o,t.path,a)))).then(o=>_e.mergeArray(s,o));const i=[...t.data].map((o,a)=>r.type._parseSync(new je(t,o,t.path,a)));return _e.mergeArray(s,i)}get element(){return this._def.type}min(e,t){return new Ue({...this._def,minLength:{value:e,message:j.toString(t)}})}max(e,t){return new Ue({...this._def,maxLength:{value:e,message:j.toString(t)}})}length(e,t){return new Ue({...this._def,exactLength:{value:e,message:j.toString(t)}})}nonempty(e){return this.min(1,e)}}Ue.create=(n,e)=>new Ue({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...K(e)});function Tt(n){if(n instanceof ue){const e={};for(const t in n.shape){const s=n.shape[t];e[t]=st.create(Tt(s))}return new ue({...n._def,shape:()=>e})}else return n instanceof Ue?new Ue({...n._def,type:Tt(n.element)}):n instanceof st?st.create(Tt(n.unwrap())):n instanceof $t?$t.create(Tt(n.unwrap())):n instanceof pt?pt.create(n.items.map(e=>Tt(e))):n}class ue extends te{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=se.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==U.object){const c=this._getOrReturnCtx(e);return P(c,{code:A.invalid_type,expected:U.object,received:c.parsedType}),J}const{status:s,ctx:r}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof ot&&this._def.unknownKeys==="strip"))for(const c in r.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const d=i[c],h=r.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new je(r,h,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof ot){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of a)l.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(c==="strict")a.length>0&&(P(r,{code:A.unrecognized_keys,keys:a}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of a){const h=r.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new je(r,h,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of l){const h=await d.key,u=await d.value;c.push({key:h,value:u,alwaysSet:d.alwaysSet})}return c}).then(c=>_e.mergeObjectSync(s,c)):_e.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new ue({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const r=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:j.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new ue({...this._def,unknownKeys:"strip"})}passthrough(){return new ue({...this._def,unknownKeys:"passthrough"})}extend(e){return new ue({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ue({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ue({...this._def,catchall:e})}pick(e){const t={};for(const s of se.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new ue({...this._def,shape:()=>t})}omit(e){const t={};for(const s of se.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new ue({...this._def,shape:()=>t})}deepPartial(){return Tt(this)}partial(e){const t={};for(const s of se.objectKeys(this.shape)){const r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new ue({...this._def,shape:()=>t})}required(e){const t={};for(const s of se.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof st;)i=i._def.innerType;t[s]=i}return new ue({...this._def,shape:()=>t})}keyof(){return Oi(se.objectKeys(this.shape))}}ue.create=(n,e)=>new ue({shape:()=>n,unknownKeys:"strip",catchall:ot.create(),typeName:Y.ZodObject,...K(e)});ue.strictCreate=(n,e)=>new ue({shape:()=>n,unknownKeys:"strict",catchall:ot.create(),typeName:Y.ZodObject,...K(e)});ue.lazycreate=(n,e)=>new ue({shape:n,unknownKeys:"strip",catchall:ot.create(),typeName:Y.ZodObject,...K(e)});class Nn extends te{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function r(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ye(a.ctx.common.issues));return P(t,{code:A.invalid_union,unionErrors:o}),J}if(t.common.async)return Promise.all(s.map(async i=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let i;const o=[];for(const l of s){const c={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ye(l));return P(t,{code:A.invalid_union,unionErrors:a}),J}}get options(){return this._def.options}}Nn.create=(n,e)=>new Nn({options:n,typeName:Y.ZodUnion,...K(e)});function vs(n,e){const t=Xe(n),s=Xe(e);if(n===e)return{valid:!0,data:n};if(t===U.object&&s===U.object){const r=se.objectKeys(e),i=se.objectKeys(n).filter(a=>r.indexOf(a)!==-1),o={...n,...e};for(const a of i){const l=vs(n[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===U.array&&s===U.array){if(n.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<n.length;i++){const o=n[i],a=e[i],l=vs(o,a);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return t===U.date&&s===U.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class Dn extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=(i,o)=>{if(pr(i)||pr(o))return J;const a=vs(i.value,o.value);return a.valid?((yr(i)||yr(o))&&t.dirty(),{status:t.value,value:a.data}):(P(s,{code:A.invalid_intersection_types}),J)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,o])=>r(i,o)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Dn.create=(n,e,t)=>new Dn({left:n,right:e,typeName:Y.ZodIntersection,...K(t)});class pt extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.array)return P(s,{code:A.invalid_type,expected:U.array,received:s.parsedType}),J;if(s.data.length<this._def.items.length)return P(s,{code:A.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J;!this._def.rest&&s.data.length>this._def.items.length&&(P(s,{code:A.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...s.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new je(s,o,s.path,a)):null}).filter(o=>!!o);return s.common.async?Promise.all(i).then(o=>_e.mergeArray(t,o)):_e.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new pt({...this._def,rest:e})}}pt.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pt({items:n,typeName:Y.ZodTuple,rest:null,...K(e)})};class An extends te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.object)return P(s,{code:A.invalid_type,expected:U.object,received:s.parsedType}),J;const r=[],i=this._def.keyType,o=this._def.valueType;for(const a in s.data)r.push({key:i._parse(new je(s,a,s.path,a)),value:o._parse(new je(s,s.data[a],s.path,a)),alwaysSet:a in s.data});return s.common.async?_e.mergeObjectAsync(t,r):_e.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof te?new An({keyType:e,valueType:t,typeName:Y.ZodRecord,...K(s)}):new An({keyType:Ge.create(),valueType:e,typeName:Y.ZodRecord,...K(t)})}}class Or extends te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.map)return P(s,{code:A.invalid_type,expected:U.map,received:s.parsedType}),J;const r=this._def.keyType,i=this._def.valueType,o=[...s.data.entries()].map(([a,l],c)=>({key:r._parse(new je(s,a,s.path,[c,"key"])),value:i._parse(new je(s,l,s.path,[c,"value"]))}));if(s.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return J;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),a.set(c.value,d.value)}return{status:t.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return J;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),a.set(c.value,d.value)}return{status:t.value,value:a}}}}Or.create=(n,e,t)=>new Or({valueType:e,keyType:n,typeName:Y.ZodMap,...K(t)});class tn extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.set)return P(s,{code:A.invalid_type,expected:U.set,received:s.parsedType}),J;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(P(s,{code:A.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(P(s,{code:A.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const d of l){if(d.status==="aborted")return J;d.status==="dirty"&&t.dirty(),c.add(d.value)}return{status:t.value,value:c}}const a=[...s.data.values()].map((l,c)=>i._parse(new je(s,l,s.path,c)));return s.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new tn({...this._def,minSize:{value:e,message:j.toString(t)}})}max(e,t){return new tn({...this._def,maxSize:{value:e,message:j.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}tn.create=(n,e)=>new tn({valueType:n,minSize:null,maxSize:null,typeName:Y.ZodSet,...K(e)});class kr extends te{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}kr.create=(n,e)=>new kr({getter:n,typeName:Y.ZodLazy,...K(e)});class Os extends te{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return P(t,{received:t.data,code:A.invalid_literal,expected:this._def.value}),J}return{status:"valid",value:e.data}}get value(){return this._def.value}}Os.create=(n,e)=>new Os({value:n,typeName:Y.ZodLiteral,...K(e)});function Oi(n,e){return new Ct({values:n,typeName:Y.ZodEnum,...K(e)})}class Ct extends te{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return P(t,{expected:se.joinValues(s),received:t.parsedType,code:A.invalid_type}),J}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return P(t,{received:t.data,code:A.invalid_enum_value,options:s}),J}return Ce(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ct.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ct.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}Ct.create=Oi;class br extends te{_parse(e){const t=se.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==U.string&&s.parsedType!==U.number){const r=se.objectValues(t);return P(s,{expected:se.joinValues(r),received:s.parsedType,code:A.invalid_type}),J}if(this._cache||(this._cache=new Set(se.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=se.objectValues(t);return P(s,{received:s.data,code:A.invalid_enum_value,options:r}),J}return Ce(e.data)}get enum(){return this._def.values}}br.create=(n,e)=>new br({values:n,typeName:Y.ZodNativeEnum,...K(e)});class Cn extends te{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.promise&&t.common.async===!1)return P(t,{code:A.invalid_type,expected:U.promise,received:t.parsedType}),J;const s=t.parsedType===U.promise?t.data:Promise.resolve(t.data);return Ce(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Cn.create=(n,e)=>new Cn({type:n,typeName:Y.ZodPromise,...K(e)});class Ft extends te{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:o=>{P(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){const o=r.transform(s.data,i);if(s.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return J;const l=await this._def.schema._parseAsync({data:a,path:s.path,parent:s});return l.status==="aborted"?J:l.status==="dirty"||t.value==="dirty"?Bt(l.value):l});{if(t.value==="aborted")return J;const a=this._def.schema._parseSync({data:o,path:s.path,parent:s});return a.status==="aborted"?J:a.status==="dirty"||t.value==="dirty"?Bt(a.value):a}}if(r.type==="refinement"){const o=a=>{const l=r.refinement(a,i);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?J:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>a.status==="aborted"?J:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(r.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Dt(o))return J;const a=r.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>Dt(o)?Promise.resolve(r.transform(o.value,i)).then(a=>({status:t.value,value:a})):J);se.assertNever(r)}}Ft.create=(n,e,t)=>new Ft({schema:n,typeName:Y.ZodEffects,effect:e,...K(t)});Ft.createWithPreprocess=(n,e,t)=>new Ft({schema:e,effect:{type:"preprocess",transform:n},typeName:Y.ZodEffects,...K(t)});class st extends te{_parse(e){return this._getType(e)===U.undefined?Ce(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}st.create=(n,e)=>new st({innerType:n,typeName:Y.ZodOptional,...K(e)});class $t extends te{_parse(e){return this._getType(e)===U.null?Ce(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$t.create=(n,e)=>new $t({innerType:n,typeName:Y.ZodNullable,...K(e)});class ks extends te{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===U.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ks.create=(n,e)=>new ks({innerType:n,typeName:Y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...K(e)});class bs extends te{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return In(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ye(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ye(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}bs.create=(n,e)=>new bs({innerType:n,typeName:Y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...K(e)});class Tr extends te{_parse(e){if(this._getType(e)!==U.nan){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.nan,received:s.parsedType}),J}return{status:"valid",value:e.data}}}Tr.create=n=>new Tr({typeName:Y.ZodNaN,...K(n)});class $a extends te{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ws extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?J:i.status==="dirty"?(t.dirty(),Bt(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?J:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new Ws({in:e,out:t,typeName:Y.ZodPipeline})}}class Ts extends te{_parse(e){const t=this._def.innerType._parse(e),s=r=>(Dt(r)&&(r.value=Object.freeze(r.value)),r);return In(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}}Ts.create=(n,e)=>new Ts({innerType:n,typeName:Y.ZodReadonly,...K(e)});var Y;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(Y||(Y={}));const be=Ge.create,ft=At.create,Kt=ws.create,ns=_s.create,me=Es.create;ot.create;const _t=Ue.create,We=ue.create,ve=Nn.create;Dn.create;pt.create;const rn=An.create,Oe=Os.create,Fn=Ct.create;Cn.create;st.create;$t.create;const wn=()=>me().refine(n=>n&&(n.seconds!==void 0&&n.nanoseconds!==void 0||n._seconds!==void 0&&n._nanoseconds!==void 0),{message:"Value is not a valid timestamp"}),Sr=()=>me().refine(n=>n&&(n._methodName==="serverTimestamp"||n.constructor.name==="ServerTimestampTransform"),{message:"Value is not a valid server timestamp"}),ki=(n,e,t)=>{const s={};if(n.includeFields){const i=e.collections[n.collection];if(!i)return rn(me());n.includeFields.forEach(o=>{const a=i.fields.find(c=>c.name===o);if(!a)throw new Error(`Field ${o} not found in collection ${n.collection}`);s[o]=$n(i,a),wt(i,[a]).size===1&&(s[`${o}_Lowercase`]=$n(i,a,!0))})}const r={Collection_Path:_t(be()),...s};return t&&(r.id=be().length(20)),We(r)},Ma=(n,e)=>{let t=rn(ki(n,e));return n.required||(t=t.optional()),t},Pa=n=>{let e=_t(ve([be().length(20),be().length(28)]));return["OneToOne","OneToMany"].includes(n.type)?e=e.max(1):(n.min&&(e=e.min(n.min)),n.max&&(e=e.max(n.max)),n.length&&(e=e.length(n.length))),n.required?e=e.nonempty():e=e.optional(),e},$n=(n,e,t)=>{const{softDelete:s}=n,r=s?.timestampField;let i;switch(e.type){case"String":if(i=be(),e.length&&(i=i.length(e.length)),e.minlength&&(i=i.min(e.minlength)),e.maxlength&&(i=i.max(e.maxlength)),e.email&&(i=i.email()),e.uuid&&(i=i.uuid()),e.url&&(i=i.url()),e.emoji&&(i=i.emoji()),e.ip&&(i=i.ip()),e.pattern&&(i=i.regex(new RegExp(e.pattern))),t&&(i=i.toLowerCase()),e.values)if(t){const o=e.values.map(a=>a.toLowerCase());i=Fn(o)}else i=Fn(e.values);break;case"Boolean":i=Kt();break;case"Number":e.autoIncrement?i=ve([Oe("Pending"),ft().int()]):(i=ft(),e.min&&(i=i.min(e.min)),e.max&&(i=i.max(e.max)),e.decimal?i=i.refine(o=>e.decimal?(o.toString().split(".")[1]?.length||0)<=e.decimal:!1,{message:`Value must have ${e.decimal} or fewer decimal places`}):i=i.int(),e.values&&(i=i.refine(o=>e.values?.includes(o),{message:"Value is not an allowed value"})));break;case"Timestamp":e.name===r?i=me().refine(o=>o&&(o._methodName==="serverTimestamp"||o.constructor.name==="ServerTimestampTransform"||o.seconds!==void 0&&o.nanoseconds!==void 0||o._seconds!==void 0&&o._nanoseconds!==void 0),{message:"Value is not a valid timestamp"}):(i=wn(),e.min&&(i=i.refine(o=>o.toMillis()>=e.min,{message:`Value is less than the minimum allowed value of ${e.min}`})),e.max&&(i=i.refine(o=>o.toMillis()<=e.max,{message:`Value is greater than the maximum allowed value of ${e.max}`})));break;case"Array":i=_t(me()),e.length&&(i=i.length(e.length)),e.minlength?i=i.min(e.minlength):e.required&&(i=i.nonempty()),e.maxlength&&(i=i.max(e.maxlength)),e.values&&(i=i.refine(o=>{let a=!0;return o.forEach(l=>{e.values&&!e.values.includes(l)&&(a=!1)}),a},{message:"Value is not an allowed value"}));break;case"Map":i=rn(me()),e.required&&(i=i.refine(o=>o&&typeof o=="object"&&Object.keys(o).length>0,{message:"Value must have at least one object property"}));break;case"Embedding":i=me();break}return!ee(e)&&e.nullable&&(i=i.nullable()),e.required||(i=i.optional()),i},bi=(n,e,t)=>{const s={Collection_Path:_t(be()),Last_Write_App:be(),Last_Write_At:wn(),Last_Save_At:Sr(),Last_Write_By:ve([be().length(28),Oe("System")]),Last_Write_Connection_Status:Fn(["Online","Offline"]),Last_Write_Version:ft().int(),id:be().regex(new RegExp("^[a-zA-Z0-9]+$")).length(20),Created_At:wn(),Created_By:ve([be().length(28),Oe("System")])};n==="create"&&(s.Saved_At=Sr()),n==="update"&&(s.Saved_At=wn(),s.Collection_Path=s.Collection_Path.optional(),s.id=s.id.optional(),s.Created_At=s.Created_At.optional(),s.Saved_At=s.Saved_At.optional(),s.Created_By=s.Created_By.optional());const r=dt(e,e.fields),i=Array.from(r).map(l=>l.name);e.fields.forEach(l=>{ee(l)?(s[l.name]=Ma(l,t),s[`${l.name}_Array`]=Pa(l),i.includes(l.name)&&(s[`${l.name}_Single`]=ki(l,t,!0),l.required||(s[`${l.name}_Single`]=s[`${l.name}_Single`].optional())),l.length&&(s[l.name]=s[l.name].refine(c=>l.length&&c&&Object.keys(c).length===l.length,{message:`Value must contain ${l.length} item(s)`})),l.min&&(s[l.name]=s[l.name].refine(c=>l.min&&c&&Object.keys(c).length>=l.min,{message:`Value must contain at least ${l.min} item(s)`})),l.max&&(s[l.name]=s[l.name].refine(c=>l.max&&(!c||Object.keys(c).length<=l.max),{message:`Value must contain at most ${l.max} item(s)`}))):l.type!=="Computed"&&(s[l.name]=$n(e,l))}),wt(e,e.fields).forEach(l=>{s[l.name]&&(s[`${l.name}_Lowercase`]=$n(e,l,!0))});const a=We(s);return e.allowSchemalessFields?a.passthrough():a.strict()};class Et extends Error{}class La extends Et{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Va extends Et{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Ua extends Et{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class St extends Et{}class Ti extends Et{constructor(e){super(`Invalid unit ${e}`)}}class pe extends Et{}class Ke extends Et{constructor(){super("Zone is an abstract class")}}const $="numeric",Pe="short",Se="long",Mn={year:$,month:$,day:$},Si={year:$,month:Pe,day:$},Wa={year:$,month:Pe,day:$,weekday:Pe},Ri={year:$,month:Se,day:$},Ii={year:$,month:Se,day:$,weekday:Se},xi={hour:$,minute:$},Ni={hour:$,minute:$,second:$},Di={hour:$,minute:$,second:$,timeZoneName:Pe},Ai={hour:$,minute:$,second:$,timeZoneName:Se},Ci={hour:$,minute:$,hourCycle:"h23"},Fi={hour:$,minute:$,second:$,hourCycle:"h23"},$i={hour:$,minute:$,second:$,hourCycle:"h23",timeZoneName:Pe},Mi={hour:$,minute:$,second:$,hourCycle:"h23",timeZoneName:Se},Pi={year:$,month:$,day:$,hour:$,minute:$},Li={year:$,month:$,day:$,hour:$,minute:$,second:$},Vi={year:$,month:Pe,day:$,hour:$,minute:$},Ui={year:$,month:Pe,day:$,hour:$,minute:$,second:$},ja={year:$,month:Pe,day:$,weekday:Pe,hour:$,minute:$},Wi={year:$,month:Se,day:$,hour:$,minute:$,timeZoneName:Pe},ji={year:$,month:Se,day:$,hour:$,minute:$,second:$,timeZoneName:Pe},zi={year:$,month:Se,day:$,weekday:Se,hour:$,minute:$,timeZoneName:Se},Zi={year:$,month:Se,day:$,weekday:Se,hour:$,minute:$,second:$,timeZoneName:Se};class on{get type(){throw new Ke}get name(){throw new Ke}get ianaName(){return this.name}get isUniversal(){throw new Ke}offsetName(e,t){throw new Ke}formatOffset(e,t){throw new Ke}offset(e){throw new Ke}equals(e){throw new Ke}get isValid(){throw new Ke}}let ss=null;class qn extends on{static get instance(){return ss===null&&(ss=new qn),ss}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return to(e,t,s)}formatOffset(e,t){return Xt(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const Ss=new Map;function za(n){let e=Ss.get(n);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Ss.set(n,e)),e}const Za={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function qa(n,e){const t=n.format(e).replace(/\u200E/g,""),s=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,r,i,o,a,l,c,d]=s;return[o,r,i,a,l,c,d]}function Ba(n,e){const t=n.formatToParts(e),s=[];for(let r=0;r<t.length;r++){const{type:i,value:o}=t[r],a=Za[i];i==="era"?s[a]=o:H(a)||(s[a]=parseInt(o,10))}return s}const rs=new Map;class Je extends on{static create(e){let t=rs.get(e);return t===void 0&&rs.set(e,t=new Je(e)),t}static resetCache(){rs.clear(),Ss.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=Je.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return to(e,t,s,this.name)}formatOffset(e,t){return Xt(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const s=za(this.name);let[r,i,o,a,l,c,d]=s.formatToParts?Ba(s,t):qa(s,t);a==="BC"&&(r=-Math.abs(r)+1);const u=Hn({year:r,month:i,day:o,hour:l===24?0:l,minute:c,second:d,millisecond:0});let f=+t;const y=f%1e3;return f-=y>=0?y:1e3+y,(u-f)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Rr={};function Ha(n,e={}){const t=JSON.stringify([n,e]);let s=Rr[t];return s||(s=new Intl.ListFormat(n,e),Rr[t]=s),s}const Rs=new Map;function Is(n,e={}){const t=JSON.stringify([n,e]);let s=Rs.get(t);return s===void 0&&(s=new Intl.DateTimeFormat(n,e),Rs.set(t,s)),s}const xs=new Map;function Ga(n,e={}){const t=JSON.stringify([n,e]);let s=xs.get(t);return s===void 0&&(s=new Intl.NumberFormat(n,e),xs.set(t,s)),s}const Ns=new Map;function Ya(n,e={}){const{base:t,...s}=e,r=JSON.stringify([n,s]);let i=Ns.get(r);return i===void 0&&(i=new Intl.RelativeTimeFormat(n,e),Ns.set(r,i)),i}let Ht=null;function Ja(){return Ht||(Ht=new Intl.DateTimeFormat().resolvedOptions().locale,Ht)}const Ds=new Map;function qi(n){let e=Ds.get(n);return e===void 0&&(e=new Intl.DateTimeFormat(n).resolvedOptions(),Ds.set(n,e)),e}const As=new Map;function Qa(n){let e=As.get(n);if(!e){const t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...Bi,...e}),As.set(n,e)}return e}function Ka(n){const e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));const t=n.indexOf("-u-");if(t===-1)return[n];{let s,r;try{s=Is(n).resolvedOptions(),r=n}catch{const l=n.substring(0,t);s=Is(l).resolvedOptions(),r=l}const{numberingSystem:i,calendar:o}=s;return[r,i,o]}}function Xa(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function el(n){const e=[];for(let t=1;t<=12;t++){const s=V.utc(2009,t,1);e.push(n(s))}return e}function tl(n){const e=[];for(let t=1;t<=7;t++){const s=V.utc(2016,11,13+t);e.push(n(s))}return e}function fn(n,e,t,s){const r=n.listingMode();return r==="error"?null:r==="en"?t(e):s(e)}function nl(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||qi(n.locale).numberingSystem==="latn"}class sl{constructor(e,t,s){this.padTo=s.padTo||0,this.floor=s.floor||!1;const{padTo:r,floor:i,...o}=s;if(!t||Object.keys(o).length>0){const a={useGrouping:!1,...s};s.padTo>0&&(a.minimumIntegerDigits=s.padTo),this.inf=Ga(e,a)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):Bs(e,3);return de(t,this.padTo)}}}class rl{constructor(e,t,s){this.opts=s,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),a=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Je.create(a).valid?(r=a,this.dt=e):(r="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,r=e.zone.name):(r="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=Is(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const s=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:s}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class il{constructor(e,t,s){this.opts={style:"long",...s},!t&&Xi()&&(this.rtf=Ya(e,s))}format(e,t){return this.rtf?this.rtf.format(e,t):Rl(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const Bi={firstDay:1,minimalDays:4,weekend:[6,7]};class ie{static fromOpts(e){return ie.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,s,r,i=!1){const o=e||ce.defaultLocale,a=o||(i?"en-US":Ja()),l=t||ce.defaultNumberingSystem,c=s||ce.defaultOutputCalendar,d=Fs(r)||ce.defaultWeekSettings;return new ie(a,l,c,d,o)}static resetCache(){Ht=null,Rs.clear(),xs.clear(),Ns.clear(),Ds.clear(),As.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:s,weekSettings:r}={}){return ie.create(e,t,s,r)}constructor(e,t,s,r,i){const[o,a,l]=Ka(e);this.locale=o,this.numberingSystem=t||a||null,this.outputCalendar=s||l||null,this.weekSettings=r,this.intl=Xa(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=nl(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:ie.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Fs(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return fn(this,e,ro,()=>{const s=this.intl==="ja"||this.intl.startsWith("ja-");t&=!s;const r=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const o=s?a=>this.dtFormatter(a,r).format():a=>this.extract(a,r,"month");this.monthsCache[i][e]=el(o)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return fn(this,e,ao,()=>{const s=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},r=t?"format":"standalone";return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=tl(i=>this.extract(i,s,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return fn(this,void 0,()=>lo,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[V.utc(2016,11,13,9),V.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return fn(this,e,co,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[V.utc(-40,1,1),V.utc(2017,1,1)].map(s=>this.extract(s,t,"era"))),this.eraCache[e]})}extract(e,t,s){const r=this.dtFormatter(e,t),i=r.formatToParts(),o=i.find(a=>a.type.toLowerCase()===s);return o?o.value:null}numberFormatter(e={}){return new sl(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new rl(e,this.intl,t)}relFormatter(e={}){return new il(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Ha(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||qi(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:eo()?Qa(this.locale):Bi}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let is=null;class we extends on{static get utcInstance(){return is===null&&(is=new we(0)),is}static instance(e){return e===0?we.utcInstance:new we(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new we(Gn(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Xt(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Xt(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Xt(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class ol extends on{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function tt(n,e){if(H(n)||n===null)return e;if(n instanceof on)return n;if(fl(n)){const t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?qn.instance:t==="utc"||t==="gmt"?we.utcInstance:we.parseSpecifier(t)||Je.create(n)}else return rt(n)?we.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new ol(n)}const js={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Ir={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},al=js.hanidec.replace(/[\[|\]]/g,"").split("");function ll(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t<n.length;t++){const s=n.charCodeAt(t);if(n[t].search(js.hanidec)!==-1)e+=al.indexOf(n[t]);else for(const r in Ir){const[i,o]=Ir[r];s>=i&&s<=o&&(e+=s-i)}}return parseInt(e,10)}else return e}const Cs=new Map;function cl(){Cs.clear()}function Fe({numberingSystem:n},e=""){const t=n||"latn";let s=Cs.get(t);s===void 0&&(s=new Map,Cs.set(t,s));let r=s.get(e);return r===void 0&&(r=new RegExp(`${js[t]}${e}`),s.set(e,r)),r}let xr=()=>Date.now(),Nr="system",Dr=null,Ar=null,Cr=null,Fr=60,$r,Mr=null;class ce{static get now(){return xr}static set now(e){xr=e}static set defaultZone(e){Nr=e}static get defaultZone(){return tt(Nr,qn.instance)}static get defaultLocale(){return Dr}static set defaultLocale(e){Dr=e}static get defaultNumberingSystem(){return Ar}static set defaultNumberingSystem(e){Ar=e}static get defaultOutputCalendar(){return Cr}static set defaultOutputCalendar(e){Cr=e}static get defaultWeekSettings(){return Mr}static set defaultWeekSettings(e){Mr=Fs(e)}static get twoDigitCutoffYear(){return Fr}static set twoDigitCutoffYear(e){Fr=e%100}static get throwOnInvalid(){return $r}static set throwOnInvalid(e){$r=e}static resetCaches(){ie.resetCache(),Je.resetCache(),V.resetCache(),cl()}}class Me{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Hi=[0,31,59,90,120,151,181,212,243,273,304,334],Gi=[0,31,60,91,121,152,182,213,244,274,305,335];function Ne(n,e){return new Me("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function zs(n,e,t){const s=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&s.setUTCFullYear(s.getUTCFullYear()-1900);const r=s.getUTCDay();return r===0?7:r}function Yi(n,e,t){return t+(an(n)?Gi:Hi)[e-1]}function Ji(n,e){const t=an(n)?Gi:Hi,s=t.findIndex(i=>i<e),r=e-t[s];return{month:s+1,day:r}}function Zs(n,e){return(n-e+7)%7+1}function Pn(n,e=4,t=1){const{year:s,month:r,day:i}=n,o=Yi(s,r,i),a=Zs(zs(s,r,i),t);let l=Math.floor((o-a+14-e)/7),c;return l<1?(c=s-1,l=nn(c,e,t)):l>nn(s,e,t)?(c=s+1,l=1):c=s,{weekYear:c,weekNumber:l,weekday:a,...Yn(n)}}function Pr(n,e=4,t=1){const{weekYear:s,weekNumber:r,weekday:i}=n,o=Zs(zs(s,1,e),t),a=xt(s);let l=r*7+i-o-7+e,c;l<1?(c=s-1,l+=xt(c)):l>a?(c=s+1,l-=xt(s)):c=s;const{month:d,day:h}=Ji(c,l);return{year:c,month:d,day:h,...Yn(n)}}function os(n){const{year:e,month:t,day:s}=n,r=Yi(e,t,s);return{year:e,ordinal:r,...Yn(n)}}function Lr(n){const{year:e,ordinal:t}=n,{month:s,day:r}=Ji(e,t);return{year:e,month:s,day:r,...Yn(n)}}function Vr(n,e){if(!H(n.localWeekday)||!H(n.localWeekNumber)||!H(n.localWeekYear)){if(!H(n.weekday)||!H(n.weekNumber)||!H(n.weekYear))throw new St("Cannot mix locale-based week fields with ISO-based week fields");return H(n.localWeekday)||(n.weekday=n.localWeekday),H(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),H(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ul(n,e=4,t=1){const s=Bn(n.weekYear),r=De(n.weekNumber,1,nn(n.weekYear,e,t)),i=De(n.weekday,1,7);return s?r?i?!1:Ne("weekday",n.weekday):Ne("week",n.weekNumber):Ne("weekYear",n.weekYear)}function dl(n){const e=Bn(n.year),t=De(n.ordinal,1,xt(n.year));return e?t?!1:Ne("ordinal",n.ordinal):Ne("year",n.year)}function Qi(n){const e=Bn(n.year),t=De(n.month,1,12),s=De(n.day,1,Ln(n.year,n.month));return e?t?s?!1:Ne("day",n.day):Ne("month",n.month):Ne("year",n.year)}function Ki(n){const{hour:e,minute:t,second:s,millisecond:r}=n,i=De(e,0,23)||e===24&&t===0&&s===0&&r===0,o=De(t,0,59),a=De(s,0,59),l=De(r,0,999);return i?o?a?l?!1:Ne("millisecond",r):Ne("second",s):Ne("minute",t):Ne("hour",e)}function H(n){return typeof n>"u"}function rt(n){return typeof n=="number"}function Bn(n){return typeof n=="number"&&n%1===0}function fl(n){return typeof n=="string"}function hl(n){return Object.prototype.toString.call(n)==="[object Date]"}function Xi(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function eo(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function ml(n){return Array.isArray(n)?n:[n]}function Ur(n,e,t){if(n.length!==0)return n.reduce((s,r)=>{const i=[e(r),r];return s&&t(s[0],i[0])===s[0]?s:i},null)[1]}function pl(n,e){return e.reduce((t,s)=>(t[s]=n[s],t),{})}function Mt(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Fs(n){if(n==null)return null;if(typeof n!="object")throw new pe("Week settings must be an object");if(!De(n.firstDay,1,7)||!De(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!De(e,1,7)))throw new pe("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function De(n,e,t){return Bn(n)&&n>=e&&n<=t}function yl(n,e){return n-e*Math.floor(n/e)}function de(n,e=2){const t=n<0;let s;return t?s="-"+(""+-n).padStart(e,"0"):s=(""+n).padStart(e,"0"),s}function et(n){if(!(H(n)||n===null||n===""))return parseInt(n,10)}function ct(n){if(!(H(n)||n===null||n===""))return parseFloat(n)}function qs(n){if(!(H(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function Bs(n,e,t="round"){const s=10**e;switch(t){case"expand":return n>0?Math.ceil(n*s)/s:Math.floor(n*s)/s;case"trunc":return Math.trunc(n*s)/s;case"round":return Math.round(n*s)/s;case"floor":return Math.floor(n*s)/s;case"ceil":return Math.ceil(n*s)/s;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function an(n){return n%4===0&&(n%100!==0||n%400===0)}function xt(n){return an(n)?366:365}function Ln(n,e){const t=yl(e-1,12)+1,s=n+(e-t)/12;return t===2?an(s)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Hn(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function Wr(n,e,t){return-Zs(zs(n,1,e),t)+e-1}function nn(n,e=4,t=1){const s=Wr(n,e,t),r=Wr(n+1,e,t);return(xt(n)-s+r)/7}function $s(n){return n>99?n:n>ce.twoDigitCutoffYear?1900+n:2e3+n}function to(n,e,t,s=null){const r=new Date(n),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};s&&(i.timeZone=s);const o={timeZoneName:e,...i},a=new Intl.DateTimeFormat(t,o).formatToParts(r).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function Gn(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const s=parseInt(e,10)||0,r=t<0||Object.is(t,-0)?-s:s;return t*60+r}function no(n){const e=Number(n);if(typeof n=="boolean"||n===""||!Number.isFinite(e))throw new pe(`Invalid unit value ${n}`);return e}function Vn(n,e){const t={};for(const s in n)if(Mt(n,s)){const r=n[s];if(r==null)continue;t[e(s)]=no(r)}return t}function Xt(n,e){const t=Math.trunc(Math.abs(n/60)),s=Math.trunc(Math.abs(n%60)),r=n>=0?"+":"-";switch(e){case"short":return`${r}${de(t,2)}:${de(s,2)}`;case"narrow":return`${r}${t}${s>0?`:${s}`:""}`;case"techie":return`${r}${de(t,2)}${de(s,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Yn(n){return pl(n,["hour","minute","second","millisecond"])}const gl=["January","February","March","April","May","June","July","August","September","October","November","December"],so=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wl=["J","F","M","A","M","J","J","A","S","O","N","D"];function ro(n){switch(n){case"narrow":return[...wl];case"short":return[...so];case"long":return[...gl];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const io=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],oo=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],_l=["M","T","W","T","F","S","S"];function ao(n){switch(n){case"narrow":return[..._l];case"short":return[...oo];case"long":return[...io];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const lo=["AM","PM"],El=["Before Christ","Anno Domini"],vl=["BC","AD"],Ol=["B","A"];function co(n){switch(n){case"narrow":return[...Ol];case"short":return[...vl];case"long":return[...El];default:return null}}function kl(n){return lo[n.hour<12?0:1]}function bl(n,e){return ao(e)[n.weekday-1]}function Tl(n,e){return ro(e)[n.month-1]}function Sl(n,e){return co(e)[n.year<0?0:1]}function Rl(n,e,t="always",s=!1){const r={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&i){const h=n==="days";switch(e){case 1:return h?"tomorrow":`next ${r[n][0]}`;case-1:return h?"yesterday":`last ${r[n][0]}`;case 0:return h?"today":`this ${r[n][0]}`}}const o=Object.is(e,-0)||e<0,a=Math.abs(e),l=a===1,c=r[n],d=s?l?c[1]:c[2]||c[1]:l?r[n][0]:n;return o?`${a} ${d} ago`:`in ${a} ${d}`}function jr(n,e){let t="";for(const s of n)s.literal?t+=s.val:t+=e(s.val);return t}const Il={D:Mn,DD:Si,DDD:Ri,DDDD:Ii,t:xi,tt:Ni,ttt:Di,tttt:Ai,T:Ci,TT:Fi,TTT:$i,TTTT:Mi,f:Pi,ff:Vi,fff:Wi,ffff:zi,F:Li,FF:Ui,FFF:ji,FFFF:Zi};class ye{static create(e,t={}){return new ye(e,t)}static parseFormat(e){let t=null,s="",r=!1;const i=[];for(let o=0;o<e.length;o++){const a=e.charAt(o);a==="'"?((s.length>0||r)&&i.push({literal:r||/^\s+$/.test(s),val:s===""?"'":s}),t=null,s="",r=!r):r||a===t?s+=a:(s.length>0&&i.push({literal:/^\s+$/.test(s),val:s}),s=a,t=a)}return s.length>0&&i.push({literal:r||/^\s+$/.test(s),val:s}),i}static macroTokenToFormatOpts(e){return Il[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,s=void 0){if(this.opts.forceSimple)return de(e,t);const r={...this.opts};return t>0&&(r.padTo=t),s&&(r.signDisplay=s),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,t){const s=this.loc.listingMode()==="en",r=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(f,y)=>this.loc.extract(e,f,y),o=f=>e.isOffsetFixed&&e.offset===0&&f.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,f.format):"",a=()=>s?kl(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(f,y)=>s?Tl(e,f):i(y?{month:f}:{month:f,day:"numeric"},"month"),c=(f,y)=>s?bl(e,f):i(y?{weekday:f}:{weekday:f,month:"long",day:"numeric"},"weekday"),d=f=>{const y=ye.macroTokenToFormatOpts(f);return y?this.formatWithSystemDefault(e,y):f},h=f=>s?Sl(e,f):i({era:f},"era"),u=f=>{switch(f){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return r?i({day:"numeric"},"day"):this.num(e.day);case"dd":return r?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return c("short",!0);case"cccc":return c("long",!0);case"ccccc":return c("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return c("short",!1);case"EEEE":return c("long",!1);case"EEEEE":return c("narrow",!1);case"L":return r?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return r?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return r?i({month:"numeric"},"month"):this.num(e.month);case"MM":return r?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return r?i({year:"numeric"},"year"):this.num(e.year);case"yy":return r?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return r?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return r?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return h("short");case"GG":return h("long");case"GGGGG":return h("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return d(f)}};return jr(ye.parseFormat(t),u)}formatDurationFromString(e,t){const s=this.opts.signMode==="negativeLargestOnly"?-1:1,r=d=>{switch(d[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},i=(d,h)=>u=>{const f=r(u);if(f){const y=h.isNegativeDuration&&f!==h.largestUnit?s:1;let v;return this.opts.signMode==="negativeLargestOnly"&&f!==h.largestUnit?v="never":this.opts.signMode==="all"?v="always":v="auto",this.num(d.get(f)*y,u.length,v)}else return u},o=ye.parseFormat(t),a=o.reduce((d,{literal:h,val:u})=>h?d:d.concat(u),[]),l=e.shiftTo(...a.map(r).filter(d=>d)),c={isNegativeDuration:l<0,largestUnit:Object.keys(l.values)[0]};return jr(o,i(l,c))}}const uo=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Pt(...n){const e=n.reduce((t,s)=>t+s.source,"");return RegExp(`^${e}$`)}function Lt(...n){return e=>n.reduce(([t,s,r],i)=>{const[o,a,l]=i(e,r);return[{...t,...o},a||s,l]},[{},null,1]).slice(0,2)}function Vt(n,...e){if(n==null)return[null,null];for(const[t,s]of e){const r=t.exec(n);if(r)return s(r)}return[null,null]}function fo(...n){return(e,t)=>{const s={};let r;for(r=0;r<n.length;r++)s[n[r]]=et(e[t+r]);return[s,null,t+r]}}const ho=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,xl=`(?:${ho.source}?(?:\\[(${uo.source})\\])?)?`,Hs=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,mo=RegExp(`${Hs.source}${xl}`),Gs=RegExp(`(?:[Tt]${mo.source})?`),Nl=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Dl=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Al=/(\d{4})-?(\d{3})/,Cl=fo("weekYear","weekNumber","weekDay"),Fl=fo("year","ordinal"),$l=/(\d{4})-(\d\d)-(\d\d)/,po=RegExp(`${Hs.source} ?(?:${ho.source}|(${uo.source}))?`),Ml=RegExp(`(?: ${po.source})?`);function Nt(n,e,t){const s=n[e];return H(s)?t:et(s)}function Pl(n,e){return[{year:Nt(n,e),month:Nt(n,e+1,1),day:Nt(n,e+2,1)},null,e+3]}function Ut(n,e){return[{hours:Nt(n,e,0),minutes:Nt(n,e+1,0),seconds:Nt(n,e+2,0),milliseconds:qs(n[e+3])},null,e+4]}function ln(n,e){const t=!n[e]&&!n[e+1],s=Gn(n[e+1],n[e+2]),r=t?null:we.instance(s);return[{},r,e+3]}function cn(n,e){const t=n[e]?Je.create(n[e]):null;return[{},t,e+1]}const Ll=RegExp(`^T?${Hs.source}$`),Vl=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Ul(n){const[e,t,s,r,i,o,a,l,c]=n,d=e[0]==="-",h=l&&l[0]==="-",u=(f,y=!1)=>f!==void 0&&(y||f&&d)?-f:f;return[{years:u(ct(t)),months:u(ct(s)),weeks:u(ct(r)),days:u(ct(i)),hours:u(ct(o)),minutes:u(ct(a)),seconds:u(ct(l),l==="-0"),milliseconds:u(qs(c),h)}]}const Wl={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Ys(n,e,t,s,r,i,o){const a={year:e.length===2?$s(et(e)):et(e),month:so.indexOf(t)+1,day:et(s),hour:et(r),minute:et(i)};return o&&(a.second=et(o)),n&&(a.weekday=n.length>3?io.indexOf(n)+1:oo.indexOf(n)+1),a}const jl=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function zl(n){const[,e,t,s,r,i,o,a,l,c,d,h]=n,u=Ys(e,r,s,t,i,o,a);let f;return l?f=Wl[l]:c?f=0:f=Gn(d,h),[u,new we(f)]}function Zl(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const ql=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Bl=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Hl=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function zr(n){const[,e,t,s,r,i,o,a]=n;return[Ys(e,r,s,t,i,o,a),we.utcInstance]}function Gl(n){const[,e,t,s,r,i,o,a]=n;return[Ys(e,a,t,s,r,i,o),we.utcInstance]}const Yl=Pt(Nl,Gs),Jl=Pt(Dl,Gs),Ql=Pt(Al,Gs),Kl=Pt(mo),yo=Lt(Pl,Ut,ln,cn),Xl=Lt(Cl,Ut,ln,cn),ec=Lt(Fl,Ut,ln,cn),tc=Lt(Ut,ln,cn);function nc(n){return Vt(n,[Yl,yo],[Jl,Xl],[Ql,ec],[Kl,tc])}function sc(n){return Vt(Zl(n),[jl,zl])}function rc(n){return Vt(n,[ql,zr],[Bl,zr],[Hl,Gl])}function ic(n){return Vt(n,[Vl,Ul])}const oc=Lt(Ut);function ac(n){return Vt(n,[Ll,oc])}const lc=Pt($l,Ml),cc=Pt(po),uc=Lt(Ut,ln,cn);function dc(n){return Vt(n,[lc,yo],[cc,uc])}const Zr="Invalid Duration",go={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},fc={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...go},xe=146097/400,Ot=146097/4800,hc={years:{quarters:4,months:12,weeks:xe/7,days:xe,hours:xe*24,minutes:xe*24*60,seconds:xe*24*60*60,milliseconds:xe*24*60*60*1e3},quarters:{months:3,weeks:xe/28,days:xe/4,hours:xe*24/4,minutes:xe*24*60/4,seconds:xe*24*60*60/4,milliseconds:xe*24*60*60*1e3/4},months:{weeks:Ot/7,days:Ot,hours:Ot*24,minutes:Ot*24*60,seconds:Ot*24*60*60,milliseconds:Ot*24*60*60*1e3},...go},ht=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],mc=ht.slice(0).reverse();function Be(n,e,t=!1){const s={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new ne(s)}function wo(n,e){let t=e.milliseconds??0;for(const s of mc.slice(1))e[s]&&(t+=e[s]*n[s].milliseconds);return t}function qr(n,e){const t=wo(n,e)<0?-1:1;ht.reduceRight((s,r)=>{if(H(e[r]))return s;if(s){const i=e[s]*t,o=n[r][s],a=Math.floor(i/o);e[r]+=a*t,e[s]-=a*o*t}return r},null),ht.reduce((s,r)=>{if(H(e[r]))return s;if(s){const i=e[s]%1;e[s]-=i,e[r]+=i*n[s][r]}return r},null)}function Br(n){const e={};for(const[t,s]of Object.entries(n))s!==0&&(e[t]=s);return e}class ne{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let s=t?hc:fc;e.matrix&&(s=e.matrix),this.values=e.values,this.loc=e.loc||ie.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=s,this.isLuxonDuration=!0}static fromMillis(e,t){return ne.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new pe(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new ne({values:Vn(e,ne.normalizeUnit),loc:ie.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(rt(e))return ne.fromMillis(e);if(ne.isDuration(e))return e;if(typeof e=="object")return ne.fromObject(e);throw new pe(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[s]=ic(e);return s?ne.fromObject(s,t):ne.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[s]=ac(e);return s?ne.fromObject(s,t):ne.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new pe("need to specify a reason the Duration is invalid");const s=e instanceof Me?e:new Me(e,t);if(ce.throwOnInvalid)throw new Ua(s);return new ne({invalid:s})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Ti(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const s={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?ye.create(this.loc,s).formatDurationFromString(this,e):Zr}toHuman(e={}){if(!this.isValid)return Zr;const t=e.showZeros!==!1,s=ht.map(r=>{const i=this.values[r];return H(i)||i===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(i)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(s)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Bs(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},V.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?wo(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=ne.fromDurationLike(e),s={};for(const r of ht)(Mt(t.values,r)||Mt(this.values,r))&&(s[r]=t.get(r)+this.get(r));return Be(this,{values:s},!0)}minus(e){if(!this.isValid)return this;const t=ne.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const s of Object.keys(this.values))t[s]=no(e(this.values[s],s));return Be(this,{values:t},!0)}get(e){return this[ne.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Vn(e,ne.normalizeUnit)};return Be(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:s,matrix:r}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:s};return Be(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return qr(this.matrix,e),Be(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=Br(this.normalize().shiftToAll().toObject());return Be(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>ne.normalizeUnit(o));const t={},s={},r=this.toObject();let i;for(const o of ht)if(e.indexOf(o)>=0){i=o;let a=0;for(const c in s)a+=this.matrix[c][o]*s[c],s[c]=0;rt(r[o])&&(a+=r[o]);const l=Math.trunc(a);t[o]=l,s[o]=(a*1e3-l*1e3)/1e3}else rt(r[o])&&(s[o]=r[o]);for(const o in s)s[o]!==0&&(t[i]+=o===i?s[o]:s[o]/this.matrix[i][o]);return qr(this.matrix,t),Be(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Be(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=Br(this.values);return Be(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(s,r){return s===void 0||s===0?r===void 0||r===0:s===r}for(const s of ht)if(!t(this.values[s],e.values[s]))return!1;return!0}}const kt="Invalid Interval";function pc(n,e){return!n||!n.isValid?le.invalid("missing or invalid start"):!e||!e.isValid?le.invalid("missing or invalid end"):e<n?le.invalid("end before start",`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${e.toISO()}`):null}class le{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new pe("need to specify a reason the Interval is invalid");const s=e instanceof Me?e:new Me(e,t);if(ce.throwOnInvalid)throw new Va(s);return new le({invalid:s})}static fromDateTimes(e,t){const s=Zt(e),r=Zt(t),i=pc(s,r);return i??new le({start:s,end:r})}static after(e,t){const s=ne.fromDurationLike(t),r=Zt(e);return le.fromDateTimes(r,r.plus(s))}static before(e,t){const s=ne.fromDurationLike(t),r=Zt(e);return le.fromDateTimes(r.minus(s),r)}static fromISO(e,t){const[s,r]=(e||"").split("/",2);if(s&&r){let i,o;try{i=V.fromISO(s,t),o=i.isValid}catch{o=!1}let a,l;try{a=V.fromISO(r,t),l=a.isValid}catch{l=!1}if(o&&l)return le.fromDateTimes(i,a);if(o){const c=ne.fromISO(r,t);if(c.isValid)return le.after(i,c)}else if(l){const c=ne.fromISO(s,t);if(c.isValid)return le.before(a,c)}}return le.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const s=this.start.startOf(e,t);let r;return t?.useLocaleWeeks?r=this.end.reconfigure({locale:s.locale}):r=this.end,r=r.startOf(e,t),Math.floor(r.diff(s,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?le.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Zt).filter(o=>this.contains(o)).sort((o,a)=>o.toMillis()-a.toMillis()),s=[];let{s:r}=this,i=0;for(;r<this.e;){const o=t[i]||this.e,a=+o>+this.e?this.e:o;s.push(le.fromDateTimes(r,a)),r=a,i+=1}return s}splitBy(e){const t=ne.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s}=this,r=1,i;const o=[];for(;s<this.e;){const a=this.start.plus(t.mapUnits(l=>l*r));i=+a>+this.e?this.e:a,o.push(le.fromDateTimes(s,i)),s=i,r+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,s=this.e<e.e?this.e:e.e;return t>=s?null:le.fromDateTimes(t,s)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,s=this.e>e.e?this.e:e.e;return le.fromDateTimes(t,s)}static merge(e){const[t,s]=e.sort((r,i)=>r.s-i.s).reduce(([r,i],o)=>i?i.overlaps(o)||i.abutsStart(o)?[r,i.union(o)]:[r.concat([i]),o]:[r,o],[[],null]);return s&&t.push(s),t}static xor(e){let t=null,s=0;const r=[],i=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),o=Array.prototype.concat(...i),a=o.sort((l,c)=>l.time-c.time);for(const l of a)s+=l.type==="s"?1:-1,s===1?t=l.time:(t&&+t!=+l.time&&r.push(le.fromDateTimes(t,l.time)),t=null);return le.merge(r)}difference(...e){return le.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:kt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Mn,t={}){return this.isValid?ye.create(this.s.loc.clone(t),e).formatInterval(this):kt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:kt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:kt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:kt}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:kt}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):ne.invalid(this.invalidReason)}mapEndpoints(e){return le.fromDateTimes(e(this.s),e(this.e))}}class hn{static hasDST(e=ce.defaultZone){const t=V.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Je.isValidZone(e)}static normalizeZone(e){return tt(e,ce.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||ie.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||ie.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||ie.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:s=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||ie.create(t,s,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||ie.create(t,s,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:s=null,locObj:r=null}={}){return(r||ie.create(t,s,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:r=null}={}){return(r||ie.create(t,s,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return ie.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return ie.create(t,null,"gregory").eras(e)}static features(){return{relative:Xi(),localeWeek:eo()}}}function Hr(n,e){const t=r=>r.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),s=t(e)-t(n);return Math.floor(ne.fromMillis(s).as("days"))}function yc(n,e,t){const s=[["years",(l,c)=>c.year-l.year],["quarters",(l,c)=>c.quarter-l.quarter+(c.year-l.year)*4],["months",(l,c)=>c.month-l.month+(c.year-l.year)*12],["weeks",(l,c)=>{const d=Hr(l,c);return(d-d%7)/7}],["days",Hr]],r={},i=n;let o,a;for(const[l,c]of s)t.indexOf(l)>=0&&(o=l,r[l]=c(n,e),a=i.plus(r),a>e?(r[l]--,n=i.plus(r),n>e&&(a=n,r[l]--,n=i.plus(r))):n=a);return[n,r,a,o]}function gc(n,e,t,s){let[r,i,o,a]=yc(n,e,t);const l=e-r,c=t.filter(h=>["hours","minutes","seconds","milliseconds"].indexOf(h)>=0);c.length===0&&(o<e&&(o=r.plus({[a]:1})),o!==r&&(i[a]=(i[a]||0)+l/(o-r)));const d=ne.fromObject(i,s);return c.length>0?ne.fromMillis(l,s).shiftTo(...c).plus(d):d}const wc="missing Intl.DateTimeFormat.formatToParts support";function re(n,e=t=>t){return{regex:n,deser:([t])=>e(ll(t))}}const _c=" ",_o=`[ ${_c}]`,Eo=new RegExp(_o,"g");function Ec(n){return n.replace(/\./g,"\\.?").replace(Eo,_o)}function Gr(n){return n.replace(/\./g,"").replace(Eo," ").toLowerCase()}function $e(n,e){return n===null?null:{regex:RegExp(n.map(Ec).join("|")),deser:([t])=>n.findIndex(s=>Gr(t)===Gr(s))+e}}function Yr(n,e){return{regex:n,deser:([,t,s])=>Gn(t,s),groups:e}}function mn(n){return{regex:n,deser:([e])=>e}}function vc(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Oc(n,e){const t=Fe(e),s=Fe(e,"{2}"),r=Fe(e,"{3}"),i=Fe(e,"{4}"),o=Fe(e,"{6}"),a=Fe(e,"{1,2}"),l=Fe(e,"{1,3}"),c=Fe(e,"{1,6}"),d=Fe(e,"{1,9}"),h=Fe(e,"{2,4}"),u=Fe(e,"{4,6}"),f=p=>({regex:RegExp(vc(p.val)),deser:([g])=>g,literal:!0}),v=(p=>{if(n.literal)return f(p);switch(p.val){case"G":return $e(e.eras("short"),0);case"GG":return $e(e.eras("long"),0);case"y":return re(c);case"yy":return re(h,$s);case"yyyy":return re(i);case"yyyyy":return re(u);case"yyyyyy":return re(o);case"M":return re(a);case"MM":return re(s);case"MMM":return $e(e.months("short",!0),1);case"MMMM":return $e(e.months("long",!0),1);case"L":return re(a);case"LL":return re(s);case"LLL":return $e(e.months("short",!1),1);case"LLLL":return $e(e.months("long",!1),1);case"d":return re(a);case"dd":return re(s);case"o":return re(l);case"ooo":return re(r);case"HH":return re(s);case"H":return re(a);case"hh":return re(s);case"h":return re(a);case"mm":return re(s);case"m":return re(a);case"q":return re(a);case"qq":return re(s);case"s":return re(a);case"ss":return re(s);case"S":return re(l);case"SSS":return re(r);case"u":return mn(d);case"uu":return mn(a);case"uuu":return re(t);case"a":return $e(e.meridiems(),0);case"kkkk":return re(i);case"kk":return re(h,$s);case"W":return re(a);case"WW":return re(s);case"E":case"c":return re(t);case"EEE":return $e(e.weekdays("short",!1),1);case"EEEE":return $e(e.weekdays("long",!1),1);case"ccc":return $e(e.weekdays("short",!0),1);case"cccc":return $e(e.weekdays("long",!0),1);case"Z":case"ZZ":return Yr(new RegExp(`([+-]${a.source})(?::(${s.source}))?`),2);case"ZZZ":return Yr(new RegExp(`([+-]${a.source})(${s.source})?`),2);case"z":return mn(/[a-z_+-/]{1,256}?/i);case" ":return mn(/[^\S\n\r]/);default:return f(p)}})(n)||{invalidReason:wc};return v.token=n,v}const kc={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function bc(n,e,t){const{type:s,value:r}=n;if(s==="literal"){const l=/^\s+$/.test(r);return{literal:!l,val:l?" ":r}}const i=e[s];let o=s;s==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let a=kc[o];if(typeof a=="object"&&(a=a[i]),a)return{literal:!1,val:a}}function Tc(n){return[`^${n.map(t=>t.regex).reduce((t,s)=>`${t}(${s.source})`,"")}$`,n]}function Sc(n,e,t){const s=n.match(e);if(s){const r={};let i=1;for(const o in t)if(Mt(t,o)){const a=t[o],l=a.groups?a.groups+1:1;!a.literal&&a.token&&(r[a.token.val[0]]=a.deser(s.slice(i,i+l))),i+=l}return[s,r]}else return[s,{}]}function Rc(n){const e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,s;return H(n.z)||(t=Je.create(n.z)),H(n.Z)||(t||(t=new we(n.Z)),s=n.Z),H(n.q)||(n.M=(n.q-1)*3+1),H(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),H(n.u)||(n.S=qs(n.u)),[Object.keys(n).reduce((i,o)=>{const a=e(o);return a&&(i[a]=n[o]),i},{}),t,s]}let as=null;function Ic(){return as||(as=V.fromMillis(1555555555555)),as}function xc(n,e){if(n.literal)return n;const t=ye.macroTokenToFormatOpts(n.val),s=bo(t,e);return s==null||s.includes(void 0)?n:s}function vo(n,e){return Array.prototype.concat(...n.map(t=>xc(t,e)))}class Oo{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=vo(ye.parseFormat(t),e),this.units=this.tokens.map(s=>Oc(s,e)),this.disqualifyingUnit=this.units.find(s=>s.invalidReason),!this.disqualifyingUnit){const[s,r]=Tc(this.units);this.regex=RegExp(s,"i"),this.handlers=r}}explainFromTokens(e){if(this.isValid){const[t,s]=Sc(e,this.regex,this.handlers),[r,i,o]=s?Rc(s):[null,null,void 0];if(Mt(s,"a")&&Mt(s,"H"))throw new St("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:s,result:r,zone:i,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function ko(n,e,t){return new Oo(n,t).explainFromTokens(e)}function Nc(n,e,t){const{result:s,zone:r,specificOffset:i,invalidReason:o}=ko(n,e,t);return[s,r,i,o]}function bo(n,e){if(!n)return null;const s=ye.create(e,n).dtFormatter(Ic()),r=s.formatToParts(),i=s.resolvedOptions();return r.map(o=>bc(o,n,i))}const ls="Invalid DateTime",Jr=864e13;function Gt(n){return new Me("unsupported zone",`the zone "${n.name}" is not supported`)}function cs(n){return n.weekData===null&&(n.weekData=Pn(n.c)),n.weekData}function us(n){return n.localWeekData===null&&(n.localWeekData=Pn(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function ut(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new V({...t,...e,old:t})}function To(n,e,t){let s=n-e*60*1e3;const r=t.offset(s);if(e===r)return[s,e];s-=(r-e)*60*1e3;const i=t.offset(s);return r===i?[s,r]:[n-Math.min(r,i)*60*1e3,Math.max(r,i)]}function pn(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function _n(n,e,t){return To(Hn(n),e,t)}function Qr(n,e){const t=n.o,s=n.c.year+Math.trunc(e.years),r=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...n.c,year:s,month:r,day:Math.min(n.c.day,Ln(s,r))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=ne.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Hn(i);let[l,c]=To(a,t,n.zone);return o!==0&&(l+=o,c=n.zone.offset(l)),{ts:l,o:c}}function bt(n,e,t,s,r,i){const{setZone:o,zone:a}=t;if(n&&Object.keys(n).length!==0||e){const l=e||a,c=V.fromObject(n,{...t,zone:l,specificOffset:i});return o?c:c.setZone(a)}else return V.invalid(new Me("unparsable",`the input "${r}" can't be parsed as ${s}`))}function yn(n,e,t=!0){return n.isValid?ye.create(ie.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function ds(n,e,t){const s=n.c.year>9999||n.c.year<0;let r="";if(s&&n.c.year>=0&&(r+="+"),r+=de(n.c.year,s?6:4),t==="year")return r;if(e){if(r+="-",r+=de(n.c.month),t==="month")return r;r+="-"}else if(r+=de(n.c.month),t==="month")return r;return r+=de(n.c.day),r}function Kr(n,e,t,s,r,i,o){let a=!t||n.c.millisecond!==0||n.c.second!==0,l="";switch(o){case"day":case"month":case"year":break;default:if(l+=de(n.c.hour),o==="hour")break;if(e){if(l+=":",l+=de(n.c.minute),o==="minute")break;a&&(l+=":",l+=de(n.c.second))}else{if(l+=de(n.c.minute),o==="minute")break;a&&(l+=de(n.c.second))}if(o==="second")break;a&&(!s||n.c.millisecond!==0)&&(l+=".",l+=de(n.c.millisecond,3))}return r&&(n.isOffsetFixed&&n.offset===0&&!i?l+="Z":n.o<0?(l+="-",l+=de(Math.trunc(-n.o/60)),l+=":",l+=de(Math.trunc(-n.o%60))):(l+="+",l+=de(Math.trunc(n.o/60)),l+=":",l+=de(Math.trunc(n.o%60)))),i&&(l+="["+n.zone.ianaName+"]"),l}const So={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Dc={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ac={ordinal:1,hour:0,minute:0,second:0,millisecond:0},En=["year","month","day","hour","minute","second","millisecond"],Cc=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Fc=["year","ordinal","hour","minute","second","millisecond"];function vn(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new Ti(n);return e}function Xr(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return vn(n)}}function $c(n){if(Yt===void 0&&(Yt=ce.now()),n.type!=="iana")return n.offset(Yt);const e=n.name;let t=Ms.get(e);return t===void 0&&(t=n.offset(Yt),Ms.set(e,t)),t}function ei(n,e){const t=tt(e.zone,ce.defaultZone);if(!t.isValid)return V.invalid(Gt(t));const s=ie.fromObject(e);let r,i;if(H(n.year))r=ce.now();else{for(const l of En)H(n[l])&&(n[l]=So[l]);const o=Qi(n)||Ki(n);if(o)return V.invalid(o);const a=$c(t);[r,i]=_n(n,a,t)}return new V({ts:r,zone:t,loc:s,o:i})}function ti(n,e,t){const s=H(t.round)?!0:t.round,r=H(t.rounding)?"trunc":t.rounding,i=(a,l)=>(a=Bs(a,s||t.calendary?0:2,t.calendary?"round":r),e.loc.clone(t).relFormatter(t).format(a,l)),o=a=>t.calendary?e.hasSame(n,a)?0:e.startOf(a).diff(n.startOf(a),a).get(a):e.diff(n,a).get(a);if(t.unit)return i(o(t.unit),t.unit);for(const a of t.units){const l=o(a);if(Math.abs(l)>=1)return i(l,a)}return i(n>e?-0:0,t.units[t.units.length-1])}function ni(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}let Yt;const Ms=new Map;class V{constructor(e){const t=e.zone||ce.defaultZone;let s=e.invalid||(Number.isNaN(e.ts)?new Me("invalid input"):null)||(t.isValid?null:Gt(t));this.ts=H(e.ts)?ce.now():e.ts;let r=null,i=null;if(!s)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{const a=rt(e.o)&&!e.old?e.o:t.offset(this.ts);r=pn(this.ts,a),s=Number.isNaN(r.year)?new Me("invalid input"):null,r=s?null:r,i=s?null:a}this._zone=t,this.loc=e.loc||ie.create(),this.invalid=s,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new V({})}static local(){const[e,t]=ni(arguments),[s,r,i,o,a,l,c]=t;return ei({year:s,month:r,day:i,hour:o,minute:a,second:l,millisecond:c},e)}static utc(){const[e,t]=ni(arguments),[s,r,i,o,a,l,c]=t;return e.zone=we.utcInstance,ei({year:s,month:r,day:i,hour:o,minute:a,second:l,millisecond:c},e)}static fromJSDate(e,t={}){const s=hl(e)?e.valueOf():NaN;if(Number.isNaN(s))return V.invalid("invalid input");const r=tt(t.zone,ce.defaultZone);return r.isValid?new V({ts:s,zone:r,loc:ie.fromObject(t)}):V.invalid(Gt(r))}static fromMillis(e,t={}){if(rt(e))return e<-Jr||e>Jr?V.invalid("Timestamp out of range"):new V({ts:e,zone:tt(t.zone,ce.defaultZone),loc:ie.fromObject(t)});throw new pe(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(rt(e))return new V({ts:e*1e3,zone:tt(t.zone,ce.defaultZone),loc:ie.fromObject(t)});throw new pe("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const s=tt(t.zone,ce.defaultZone);if(!s.isValid)return V.invalid(Gt(s));const r=ie.fromObject(t),i=Vn(e,Xr),{minDaysInFirstWeek:o,startOfWeek:a}=Vr(i,r),l=ce.now(),c=H(t.specificOffset)?s.offset(l):t.specificOffset,d=!H(i.ordinal),h=!H(i.year),u=!H(i.month)||!H(i.day),f=h||u,y=i.weekYear||i.weekNumber;if((f||d)&&y)throw new St("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&d)throw new St("Can't mix ordinal dates with month/day");const v=y||i.weekday&&!f;let p,g,I=pn(l,c);v?(p=Cc,g=Dc,I=Pn(I,o,a)):d?(p=Fc,g=Ac,I=os(I)):(p=En,g=So);let k=!1;for(const m of p){const L=i[m];H(L)?k?i[m]=g[m]:i[m]=I[m]:k=!0}const x=v?ul(i,o,a):d?dl(i):Qi(i),E=x||Ki(i);if(E)return V.invalid(E);const F=v?Pr(i,o,a):d?Lr(i):i,[_,Z]=_n(F,c,s),b=new V({ts:_,zone:s,o:Z,loc:r});return i.weekday&&f&&e.weekday!==b.weekday?V.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${b.toISO()}`):b.isValid?b:V.invalid(b.invalid)}static fromISO(e,t={}){const[s,r]=nc(e);return bt(s,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[s,r]=sc(e);return bt(s,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[s,r]=rc(e);return bt(s,r,t,"HTTP",t)}static fromFormat(e,t,s={}){if(H(e)||H(t))throw new pe("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=s,o=ie.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[a,l,c,d]=Nc(o,e,t);return d?V.invalid(d):bt(a,l,s,`format ${t}`,e,c)}static fromString(e,t,s={}){return V.fromFormat(e,t,s)}static fromSQL(e,t={}){const[s,r]=dc(e);return bt(s,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new pe("need to specify a reason the DateTime is invalid");const s=e instanceof Me?e:new Me(e,t);if(ce.throwOnInvalid)throw new La(s);return new V({invalid:s})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const s=bo(e,ie.fromObject(t));return s?s.map(r=>r?r.val:null).join(""):null}static expandFormat(e,t={}){return vo(ye.parseFormat(e),ie.fromObject(t)).map(r=>r.val).join("")}static resetCache(){Yt=void 0,Ms.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?cs(this).weekYear:NaN}get weekNumber(){return this.isValid?cs(this).weekNumber:NaN}get weekday(){return this.isValid?cs(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?us(this).weekday:NaN}get localWeekNumber(){return this.isValid?us(this).weekNumber:NaN}get localWeekYear(){return this.isValid?us(this).weekYear:NaN}get ordinal(){return this.isValid?os(this.c).ordinal:NaN}get monthShort(){return this.isValid?hn.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?hn.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?hn.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?hn.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,s=Hn(this.c),r=this.zone.offset(s-e),i=this.zone.offset(s+e),o=this.zone.offset(s-r*t),a=this.zone.offset(s-i*t);if(o===a)return[this];const l=s-o*t,c=s-a*t,d=pn(l,o),h=pn(c,a);return d.hour===h.hour&&d.minute===h.minute&&d.second===h.second&&d.millisecond===h.millisecond?[ut(this,{ts:l}),ut(this,{ts:c})]:[this]}get isInLeapYear(){return an(this.year)}get daysInMonth(){return Ln(this.year,this.month)}get daysInYear(){return this.isValid?xt(this.year):NaN}get weeksInWeekYear(){return this.isValid?nn(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?nn(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:s,calendar:r}=ye.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:s,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(we.instance(e),t)}toLocal(){return this.setZone(ce.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:s=!1}={}){if(e=tt(e,ce.defaultZone),e.equals(this.zone))return this;if(e.isValid){let r=this.ts;if(t||s){const i=e.offset(this.ts),o=this.toObject();[r]=_n(o,i,e)}return ut(this,{ts:r,zone:e})}else return V.invalid(Gt(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:s}={}){const r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:s});return ut(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Vn(e,Xr),{minDaysInFirstWeek:s,startOfWeek:r}=Vr(t,this.loc),i=!H(t.weekYear)||!H(t.weekNumber)||!H(t.weekday),o=!H(t.ordinal),a=!H(t.year),l=!H(t.month)||!H(t.day),c=a||l,d=t.weekYear||t.weekNumber;if((c||o)&&d)throw new St("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&o)throw new St("Can't mix ordinal dates with month/day");let h;i?h=Pr({...Pn(this.c,s,r),...t},s,r):H(t.ordinal)?(h={...this.toObject(),...t},H(t.day)&&(h.day=Math.min(Ln(h.year,h.month),h.day))):h=Lr({...os(this.c),...t});const[u,f]=_n(h,this.o,this.zone);return ut(this,{ts:u,o:f})}plus(e){if(!this.isValid)return this;const t=ne.fromDurationLike(e);return ut(this,Qr(this,t))}minus(e){if(!this.isValid)return this;const t=ne.fromDurationLike(e).negate();return ut(this,Qr(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const s={},r=ne.normalizeUnit(e);switch(r){case"years":s.month=1;case"quarters":case"months":s.day=1;case"weeks":case"days":s.hour=0;case"hours":s.minute=0;case"minutes":s.second=0;case"seconds":s.millisecond=0;break}if(r==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:o}=this;o<i&&(s.weekNumber=this.weekNumber-1),s.weekday=i}else s.weekday=1;if(r==="quarters"){const i=Math.ceil(this.month/3);s.month=(i-1)*3+1}return this.set(s)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?ye.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):ls}toLocaleString(e=Mn,t={}){return this.isValid?ye.create(this.loc.clone(t),e).formatDateTime(this):ls}toLocaleParts(e={}){return this.isValid?ye.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:s=!1,includeOffset:r=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=vn(o);const a=e==="extended";let l=ds(this,a,o);return En.indexOf(o)>=3&&(l+="T"),l+=Kr(this,a,t,s,r,i,o),l}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?ds(this,e==="extended",vn(t)):null}toISOWeekDate(){return yn(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:s=!0,includePrefix:r=!1,extendedZone:i=!1,format:o="extended",precision:a="milliseconds"}={}){return this.isValid?(a=vn(a),(r&&En.indexOf(a)>=3?"T":"")+Kr(this,o==="extended",t,e,s,i,a)):null}toRFC2822(){return yn(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return yn(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ds(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:s=!0}={}){let r="HH:mm:ss.SSS";return(t||e)&&(s&&(r+=" "),t?r+="z":e&&(r+="ZZ")),yn(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():ls}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",s={}){if(!this.isValid||!e.isValid)return ne.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...s},i=ml(t).map(ne.normalizeUnit),o=e.valueOf()>this.valueOf(),a=o?this:e,l=o?e:this,c=gc(a,l,i,r);return o?c.negate():c}diffNow(e="milliseconds",t={}){return this.diff(V.now(),e,t)}until(e){return this.isValid?le.fromDateTimes(this,e):this}hasSame(e,t,s){if(!this.isValid)return!1;const r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,s)<=r&&r<=i.endOf(t,s)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||V.fromObject({},{zone:this.zone}),s=e.padding?this<t?-e.padding:e.padding:0;let r=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(r=e.unit,i=void 0),ti(t,this.plus(s),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?ti(e.base||V.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(V.isDateTime))throw new pe("min requires all arguments be DateTimes");return Ur(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(V.isDateTime))throw new pe("max requires all arguments be DateTimes");return Ur(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,s={}){const{locale:r=null,numberingSystem:i=null}=s,o=ie.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});return ko(o,e,t)}static fromStringExplain(e,t,s={}){return V.fromFormatExplain(e,t,s)}static buildFormatParser(e,t={}){const{locale:s=null,numberingSystem:r=null}=t,i=ie.fromOpts({locale:s,numberingSystem:r,defaultToEN:!0});return new Oo(i,e)}static fromFormatParser(e,t,s={}){if(H(e)||H(t))throw new pe("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=s,o=ie.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new pe(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:a,zone:l,specificOffset:c,invalidReason:d}=t.explainFromTokens(e);return d?V.invalid(d):bt(a,l,s,`format ${t.format}`,e,c)}static get DATE_SHORT(){return Mn}static get DATE_MED(){return Si}static get DATE_MED_WITH_WEEKDAY(){return Wa}static get DATE_FULL(){return Ri}static get DATE_HUGE(){return Ii}static get TIME_SIMPLE(){return xi}static get TIME_WITH_SECONDS(){return Ni}static get TIME_WITH_SHORT_OFFSET(){return Di}static get TIME_WITH_LONG_OFFSET(){return Ai}static get TIME_24_SIMPLE(){return Ci}static get TIME_24_WITH_SECONDS(){return Fi}static get TIME_24_WITH_SHORT_OFFSET(){return $i}static get TIME_24_WITH_LONG_OFFSET(){return Mi}static get DATETIME_SHORT(){return Pi}static get DATETIME_SHORT_WITH_SECONDS(){return Li}static get DATETIME_MED(){return Vi}static get DATETIME_MED_WITH_SECONDS(){return Ui}static get DATETIME_MED_WITH_WEEKDAY(){return ja}static get DATETIME_FULL(){return Wi}static get DATETIME_FULL_WITH_SECONDS(){return ji}static get DATETIME_HUGE(){return zi}static get DATETIME_HUGE_WITH_SECONDS(){return Zi}}function Zt(n){if(V.isDateTime(n))return n;if(n&&n.valueOf&&rt(n.valueOf()))return V.fromJSDate(n);if(n&&typeof n=="object")return V.fromObject(n);throw new pe(`Unknown datetime argument: ${n}, of type ${typeof n}`)}const Mc=(n,e)=>{const t={};if(n.includeFields){const s=e.collections[n.collection];if(!s)return rn(me());n.includeFields.forEach(r=>{const i=s.fields.find(o=>o.name===r);i?t[r]=Ro(i)?.nullable():t[r]=me()})}return We({Collection_Path:_t(be()),...t})},Pc=(n,e,t,s)=>{let r=We({}).catchall(Mc(n,e)),i;if(!s&&t){const o=Ae(n,t);i=qt(o.admin?.skipFormRequiredValidation)}return(!n.required||i)&&(r=r.optional()),r},Lc=()=>me().refine(n=>n&&(n.seconds!==void 0&&n.nanoseconds!==void 0||n._seconds!==void 0&&n._nanoseconds!==void 0),{message:"Must be a valid date"}),Ro=(n,e,t)=>{let s;const r=`${qt(n.description)}
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const He=require("lodash/isEqual.js"),Zo=require("lodash/merge.js"),qo=require("lodash/set.js"),he=require("lodash/cloneDeep.js"),It=require("firebase-admin/app"),B=require("firebase-admin/firestore"),ci=require("node:url"),Bo=require("cross-spawn"),ui=require("firebase-admin/database"),gt=require("firebase-admin/auth"),jn=n=>!!n.auth,Te=(n,e)=>{if(e?.operations)return e.operations.includes(n)},zn=(n,e)=>e?e.Role?n.access?.includes(e.Role):!1:!0,Ho=(n,e)=>e?!e.Role||n.restrictCreate===!0?!1:typeof n.restrictCreate=="object"?n.restrictCreate?.includes(e.Role):!0:!0,di=(n,e)=>e?!e.Role||n.restrictUpdate===!0?!1:typeof n.restrictUpdate=="object"?n.restrictUpdate?.includes(e.Role):!0:!0,dr=(n,e,t)=>{const{labels:s}=n;return t.collections&&Te("Update",t.collections[s.collection])&&(!e.access||zn(e,t))&&di(e,t)&&!(n.auth&&!t.collections?.[s.collection].auth&&["Enabled","Role","Name","Email","Photo_URL"].includes(e.name))},W=(n,e)=>n.filter(t=>t.name===e)[0],ee=n=>["OneToOne","OneToMany","ManyToOne","ManyToMany"].includes(n.type),fi=(n,e)=>{const t={Record_Owner:"recordOwner",Record_User:"recordUser",Record_Property:"recordProperty"},s=[],{labels:r,access:i}=n,{attributeRestrictions:o}=i,a=e.collections?.[r.collection];return o?.forEach(l=>{"roles"in l&&l.roles.forEach(c=>{const d=a?.[t[l.type]];c.role===e.Role&&(!c.assignable||d?.active)&&s.push(l)})}),s},Ps=(n,e)=>{const t=[],{labels:s,access:r}=n,{entityRestrictions:i}=r,o=e.collections?.[s.collection];return i?.restrictions?.forEach(a=>{"roles"in a&&a.roles.forEach(l=>{l.role===e.Role&&(!i.assignable?.includes(e.Role)||o?.restrictEntities)&&t.push(a)})}),t},hi=(n,e,t)=>{const s=[],{access:r}=n,{entityRestrictions:i}=r;return i?.parentFilters?.forEach(o=>{if(!o.roles.some(f=>f.role===t.Role))return;const a=o.collectionField,l=W(n.fields,a);if(!ee(l))throw new Error("PERMISSION_DENIED");const c=t.collections?.[l.collection],h=e.collections[l.collection].access.entityRestrictions;if(!h)throw new Error("PERMISSION_DENIED");const u=h.restrictions?.find(f=>f.type===o.type&&f.roles.some(y=>y.role===t.Role));if(!u)throw new Error("PERMISSION_DENIED");u.roles.forEach(f=>{f.role===t.Role&&(!h.assignable?.includes(t.Role)||c?.restrictEntities)&&s.push({parentFilter:o,parentRestriction:u})})}),s},mi=(n,e,t)=>{const s=Object.values(e.collections),{labels:r}=n,i=[];for(const o of s){const{fields:a}=o;for(const l of a)if(!(l.access&&!zn(l,t))&&t.Role&&ee(l)&&l.collection===r.collection&&l.dependencyFields)for(const c of l.dependencyFields)!i.find(h=>h.field===c.field)&&c.roles.includes(t.Role)&&i.push(c)}return i},Go=(n,e,t,s,r,i,o)=>{const{fields:a}=e,l=r.collections?.[e.labels.collection];let c=!0;if(!l){c=!1;return}const d=fi(e,r),h=Ps(e,r),u=hi(e,t,r);d?.filter(E=>E.type==="Record_Owner").forEach(E=>{"operations"in E&&E.operations&&!E.operations.includes(n)||i.Created_By!==s&&(c=!1)}),d?.filter(E=>E.type==="Record_User").forEach(E=>{if("operations"in E&&E.operations&&!E.operations.includes(n))return;const F=W(a,E.collectionField);i[`${F.name}_Array`]?.includes(r.Doc_ID)||(c=!1)}),d?.filter(E=>E.type==="Record_Property").forEach(E=>{if("operations"in E&&E.operations&&!E.operations.includes(n))return;const F=W(a,E.propertyField),_=E.roles.find(Z=>Z.role===r.Role);F.type==="Array"?_.values?.some(Z=>i[F.name].includes(Z))||(c=!1):_.values?.includes(i[F.name])||(c=!1)});let f=!0,y=!1;h?.filter(E=>E.type==="Individual").forEach(()=>{y=!0,l?.individualEntities?.includes(i.id)||(f=!1)});let v=!0,p=!1;if(h?.filter(E=>E.type==="Parent").forEach(E=>{p=!0;const F=W(a,E.collectionField);l?.parentEntities?.some(_=>i[`${F.name}_Array`].includes(_))||(v=!1)}),h?.filter(E=>E.type==="Parent_Property").forEach(E=>{p=!0;const F=W(a,E.collectionField),_=W(a,E.propertyField);Object.entries(l?.parentPropertyEntities||{}).some(Z=>{const[b,m]=Z;return b===i[_.name]&&i[`${F.name}_Array`].some(L=>m.includes(L))})||(v=!1)}),y&&p){if(!(f||v)){c=!1;return}}else if(!f||!v){c=!1;return}let g=!0,I=!1;u?.filter(E=>E.parentFilter.type==="Individual").forEach(E=>{I=!0;const{parentFilter:F}=E,_=W(a,F.collectionField),Z=r.collections?.[_.collection];if(!Z){c=!1;return}Z.individualEntities?.some(b=>i[`${_.name}_Array`].includes(b))||(g=!1)});let k=!0,x=!1;if(u?.filter(E=>E.parentFilter.type==="Parent").forEach(E=>{x=!0;const{parentFilter:F}=E,_=W(a,F.collectionField),Z=W(a,F.parentCollectionField),b=r.collections?.[_.collection];if(!b){c=!1;return}b.parentEntities?.some(m=>i[`${Z.name}_Array`].includes(m))||(k=!1)}),u?.filter(E=>E.parentFilter.type==="Parent_Property").forEach(E=>{x=!0;const{parentFilter:F}=E,_=W(a,F.collectionField),Z=W(a,F.parentPropertyField),b=W(a,F.parentCollectionField),m=r.collections?.[_.collection];if(!m){c=!1;return}Object.entries(m.parentPropertyEntities||{}).some(L=>{const[N,D]=L;return N===i[Z.name]&&i[`${b.name}_Array`].some(w=>D.includes(w))})||(k=!1)}),I&&x){if(!(g||k)){c=!1;return}}else if(!g||!k){c=!1;return}return c},it=(n,e,t,s,r,i)=>{const{labels:o}=e,a=r.collections?.[o.collection];let l=!0;if(!a||!r.Role)return l=!1,l;Te(n,a)||(l=!1);const d=Ps(e,r)?.filter(h=>h.type==="Individual").length>0;return n==="Create"&&d&&(l=!1),Go(n,e,t,s,r,i)||(l=!1),l},pi=(n,e,t)=>{const{labels:s}=n,r=[];for(const i of Object.values(e.collections));return r},Yo=(n,e)=>{let t=!0,s="";return Object.keys(e).forEach(r=>{if(!["Doc_ID","Role","Collection","Enabled","collections"].includes(r)){t=!1,s="Permissions object must contain Doc_ID, Role, Collection, Enabled, and collections";return}}),e.collections&&(Object.keys(e.collections).forEach(r=>{if(!Object.keys(n.collections).includes(r)){s=`Collection ${r} not found in schema`,t=!1;return}const i=n.collections[r],o=e.collections?.[r];if(o){if(!o.operations){s=`Collection ${r} does not have operations`,t=!1;return}if(!Object.keys(o).every(a=>["operations","auth","restrictEntities","individualEntities","parentEntities","parentPropertyEntities","recordProperty","recordUser","recordOwner"].includes(a))){s=`Collection ${r} has invalid properties`,t=!1;return}if(!o.operations.every(a=>["Read","Create","Update","Delete"].includes(a))){s=`Collection ${r} has invalid operations`,t=!1;return}if(o.auth&&(typeof o.auth!="boolean"||!i.auth)){s=`Collection ${r} has invalid auth value`,t=!1;return}if(o.restrictEntities&&!i.access.entityRestrictions?.restrictions){s=`Collection ${r} has invalid restrictEntities value`,t=!1;return}Object.entries(o).forEach(([a,l])=>{if(a!=="operations"&&a!=="auth"&&a!=="restrictEntities"){let c;a==="recordOwner"?c="Record_Owner":a==="recordUser"?c="Record_User":a==="recordProperty"?c="Record_Property":a==="individualEntities"?c="Individual":a==="parentEntities"?c="Parent":a==="parentPropertyEntities"&&(c="Parent_Property");const d=i.access.attributeRestrictions?.filter(u=>u.type===c&&u.roles.some(f=>f.role===e.Role)),h=i.access.entityRestrictions?.restrictions?.filter(u=>u.type===c&&u.roles.some(f=>f.role===e.Role));if(i.access.entityRestrictions?.assignable&&!(Array.isArray(i.access.entityRestrictions.assignable)&&i.access.entityRestrictions.assignable.every(u=>n.config.roles.includes(u)))){s=`Collection ${r} has invalid entity restrictions assignable value`,t=!1;return}if(d?.length||h?.length){if(a==="Record_Owner"||a==="Record_User"||a==="Record_Property"){const u=Object.keys(l);if(u.length!==1||u[0]!=="active"||typeof l.active!="boolean"){s=`Collection ${r} has invalid attribute restriction value`,t=!1;return}}if(a==="Individual"&&!Array.isArray(l)){s=`Collection ${r} has invalid individual entities value`,t=!1;return}if(a==="Parent"){const u=Object.keys(l);if(!(u.length===1&&Object.keys(n.collections).includes(u[0])&&Array.isArray(l[u[0]]))){s=`Collection ${r} has invalid parent entities value`,t=!1;return}}if(a==="Parent_Property"){const u=Object.keys(l);if(!(u.length===1&&Object.keys(n.collections).includes(u[0])&&typeof l[u[0]]=="object"&&l[u[0]]!==null)){s=`Collection ${r} has invalid parent property entities value`,t=!1;return}}}else{s=`Collection ${r} has invalid restriction type ${a}`,t=!1;return}}})}}),s&&console.error(`PERMISSION_DENIED: ${s}`)),t},Jo=(n,e,t)=>{let s=!0,r="";Object.values(n.collections).filter(i=>i.auth).forEach(i=>{if(e.collections?.[i.labels.collection]?.auth&&!i.access.auth?.includes(e.Role)){r="Record cannot have auth access to collection",s=!1;return}});for(const i of Object.values(n.collections)){const{labels:o,access:a,fields:l}=i,{operations:c,attributeRestrictions:d,entityRestrictions:h}=a,u=c.assignable,f=e.collections?.[o.collection],y=["read","create","update","delete"];if(u!==!0&&!(typeof u=="object"&&u.includes(t))?y.forEach(p=>{const g=p.charAt(0).toUpperCase()+p.slice(1);if(p!=="assignable"){const I=!!a.operations[p]?.includes(t),k=!!f?.operations.includes(g);if(!I&&k){r=`Collection ${o.collection} has excess ${p} operation for role ${t}`,s=!1;return}if(I&&!k){r=`Collection ${o.collection} has missing ${p} operation for role ${t}`,s=!1;return}}}):y.forEach(p=>{const g=p.charAt(0).toUpperCase()+p.slice(1);if(p!=="assignable"){const I=!!a.operations[p]?.includes(t),k=!!f?.operations.includes(g);if(!I&&k){r=`Collection ${o.collection} has excess ${p} operation for role ${t}`,s=!1;return}}}),!d&&!h||(d?.forEach(p=>{for(const g of p.roles)if(g.role===t&&!g.assignable){if(p.type==="Record_Owner"&&!e.collections?.[o.collection]?.recordOwner?.active){r=`Collection ${o.collection} is missing Record_Owner restriction for role ${t}`,s=!1;return}if(p.type==="Record_User"&&!e.collections?.[o.collection]?.recordUser?.active){r=`Collection ${o.collection} is missing Record_User restriction for role ${t}`,s=!1;return}if(p.type==="Record_Property"&&!e.collections?.[o.collection]?.recordProperty?.active){r=`Collection ${o.collection} is missing Record_Property restriction for role ${t}`,s=!1;return}}}),h?.assignable?.includes(t)))continue;let v=!1;if(h?.restrictions?.forEach(p=>{for(const g of p.roles)if(g.role===t){if(v=!0,p.type==="Individual"&&!e.collections?.[o.collection]?.individualEntities){r=`Collection ${o.collection} is missing individual entities`,s=!1;return}if(p.type==="Parent"){const I=W(l,p.collectionField);if(!ee(I)){s=!1;return}if(!e.collections?.[o.collection]?.parentEntities){r=`Collection ${o.collection} is missing parent entities`,s=!1;return}}if(p.type==="Parent_Property"){const I=W(l,p.collectionField);if(!ee(I)){s=!1;return}if(!e.collections?.[o.collection]?.parentPropertyEntities?.[I.collection]){r=`Collection ${o.collection} is missing parent property entities`,s=!1;return}}}}),v&&!e.collections?.[o.collection]?.restrictEntities){r=`Collection ${o.collection} must have restrictEntities set to true`,s=!1;return}}return r&&console.error(`PERMISSION_DENIED: ${r}`),s},Qo=(n,e,t,s,r,i,o,a,l)=>{const{access:c}=e,{permissionWriteRestrictions:d}=c;let h=!0,u="";const f=d?.filter(y=>s===y.userRole);return f?.length&&!f.some(y=>y.recordRole===r)?(u=`User ${s} does not have write access to record with role ${r}`,h=!1,h):n==="update"&&o.User_ID&&f?.length&&!f.some(y=>y.recordRole===a)?(u=`User ${s} does not have write access to record with role ${r}`,h=!1,h):(d?.forEach(y=>{s===y.userRole&&y.recordRole===r&&n!=="delete"&&i&&Object.keys(t.collections).forEach(v=>{const p=i.collections?.[v],g=l?.collections?.[v];if(!(n==="update"&&He(p,g))&&p){const I=y.collections.some(k=>k.collection===v);if(I){if(I){const k=y.collections.find(E=>E.collection===v);if(!(p.operations.every(E=>k.operations.includes(E))||n==="update"&&He(p.operations,g?.operations))){u=`User ${s} does not have write access to all included operations for collection ${v}`,h=!1;return}if(!k.auth&&p.auth&&!(n==="update"&&He(p.auth,g?.auth))){u=`User ${s} does not have write access to auth for collection ${v}`,h=!1;return}const x={recordOwner:"Record_Owner",recordUser:"Record_User",recordProperty:"Record_Property"};if(Object.keys(x).forEach(E=>{const F=x[E];if(k.attributeRestrictions?.includes(F)&&!(p[E]?.active||n==="update"&&He(p[E],g?.[E]))){u=`User ${s} does not have write access to attribute restriction ${E} for collection ${v}`,h=!1;return}}),k.restrictEntities&&!p.restrictEntities&&!(n==="update"&&He(p.restrictEntities,g?.restrictEntities))){u=`User ${s} does not have write access to restrictEntities for collection ${v}`,h=!1;return}}}else{u=`User ${s} does not have write access to collection ${v}`,h=!1;return}}})}),u&&console.error(`PERMISSION_DENIED: ${u}`),h)},Ko=(n,e,t,s)=>{let r=!0,i="";return Object.values(n.collections).forEach(o=>{const a=t.collections?.[o.labels.collection],l=s?.collections?.[o.labels.collection],c=e?.collections?.[o.labels.collection];if(a?.auth&&!l?.auth&&!jn(c)){i=`User does not have auth access to collection ${o.labels.collection}`,r=!1;return}for(const d of a?.operations||[])if(!l?.operations.includes(d)&&(!Te("Read",c)||!Te(d,c))){i=`User does not have ${d.toLowerCase()} access to collection ${o.labels.collection}`,r=!1;return}if(!a?.recordOwner&&l?.recordOwner&&c?.recordOwner){i=`User does not have write access to recordOwner for collection ${o.labels.collection}`,r=!1;return}if(!a?.recordUser&&l?.recordUser&&c?.recordUser){i=`User does not have write access to recordUser for collection ${o.labels.collection}`,r=!1;return}if(!a?.recordProperty&&l?.recordProperty&&c?.recordProperty){i=`User does not have write access to recordProperty for collection ${o.labels.collection}`,r=!1;return}if(!a?.restrictEntities&&l?.restrictEntities&&c?.restrictEntities){i=`User does not have write access to restrictEntities for collection ${o.labels.collection}`,r=!1;return}}),i&&console.error(`PERMISSION_DENIED: ${i}`),r},Ls=(n,e,t,s,r,i,o,a,l,c,d)=>{const{labels:h}=s;let u=!0,f="";if(!e.Role)return f="Record does not have a role",u=!1,u;if(n==="update"&&!c)return f="Original record is required for update operations",u=!1,u;if(n==="update"&&i&&d==="update"&&a&&!l)return f="Original permissions are required for this operation",u=!1,u;if(i){if(!o?.Role)return f="Current user does not have a role",u=!1,u;if(!Qo(n,s,r,o.Role,e.Role,a,c,c?.Role,l))return u=!1,u;if(n==="update"&&d!=="delete"&&c?.User_ID&&e.User_ID!==c.User_ID)return f="User ID does not match original user ID",u=!1,u;if(n==="update"&&c&&c.User_ID&&i===c.User_ID&&(a||e.Role!==c.Role||e.Enabled!==void 0&&e.Enabled!==c.Enabled))return f="User cannot update their own record",u=!1,u;if(n==="delete"&&i===e.User_ID)return f="User cannot delete their own record",u=!1,u}return n==="delete"||d==="delete"||!a?u:a.Role?(Yo(r,a)||(u=!1),a.Collection&&a.Collection!==h.collection?(f="Permissions collection does not match record collection",u=!1,u):a.Role!==e.Role?(f="Permissions role does not match record role",u=!1,u):a.Enabled!==void 0&&!!a.Enabled!=!!e.Enabled?(f="Permissions enabled state does not match record enabled state",u=!1,u):a.Doc_ID&&a.Doc_ID!==t?(f="Permissions doc ID does not match record doc ID",u=!1,u):!Jo(r,a,a.Role)||i&&o&&l&&!Ko(r,o,a,l)?(u=!1,u):(f&&console.error(`PERMISSION_DENIED: ${f}`),u)):(f="Permissions do not have a role",u=!1,u)},fr=(n,e,t,s,r,i,o)=>{const{labels:a,fields:l}=t,c=i?.collections?.[a.collection];let d=!0;if(r&&!c)throw new Error("PERMISSION_DENIED");r&&!Te("Create",c)&&(d=!1),r&&!it("Create",t,s,r,i,n)&&(d=!1),t.auth&&o&&(r&&!jn(c)&&(d=!1),Ls("create",n,e,t,s,r,i,o)||(d=!1));for(const h of l){const u=n[h.name];h.access&&!zn(h,i)&&u!==void 0&&(d=!1),u!==void 0&&!Ho(h,i)&&(d=!1)}if(!d)throw new Error("PERMISSION_DENIED")},ke=n=>n&&(n._methodName==="deleteField"||n.constructor.name==="DeleteTransform"),nt=n=>{for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(ke(n[e])?delete n[e]:typeof n[e]=="object"&&n[e]!==null&&nt(n[e]))},hr=(n,e,t,s,r,i,o,a,l,c)=>{const{labels:d,fields:h}=s,u=o?.collections?.[d.collection],f={...e,...n};nt(f);let y=!0,v="";if(i&&!u)throw new Error("PERMISSION_DENIED");i&&!Te("Update",u)&&(y=!1,v="Authenticated user does not have Update access to this collection"),i&&(!it("Update",s,r,i,o,e)||!it("Update",s,r,i,o,f))&&(y=!1,v="Authenticated user does not have Update access to this document"),i&&s.softDelete&&f[s.softDelete.archivedField]!==e[s.softDelete.archivedField]&&!Te("Delete",u)&&(y=!1,v="Authenticated user does not have Delete or Restore access to this document"),a&&(i&&!jn(u)&&(y=!1,v="Authenticated user does not have Auth access for this collection"),Ls("update",f,t,s,r,i,o,l,c,e,a)||(v="Authenticated user does not have sufficient write access for this record",y=!1));for(const p of h){const g=n[p.name];p.access&&!zn(p,o)&&g!==void 0&&(v=`Authenticated user does not have access to field ${p.name}`,y=!1),g!==void 0&&!di(p,o)&&(v=`Authenticated user does not have Update access to field ${p.name}`,y=!1)}if(!y)throw v&&console.error(`PERMISSION_DENIED: ${v}`),new Error("PERMISSION_DENIED")},Xo=(n,e,t,s,r,i)=>{const{labels:o}=t,a=i.collections?.[o.collection];let l=!0;if(!a)throw new Error("PERMISSION_DENIED");if(Te("Delete",a)||(l=!1),it("Delete",t,s,r,i,n)||(l=!1),t.auth&&n.User_ID&&(jn(a)||(l=!1),Ls("delete",n,e,t,s,r,i)||(l=!1)),!l)throw new Error("PERMISSION_DENIED")},ea=async(n,e,t,s,r)=>{const{labels:i}=e,o=r.collections?.[i.collection];let a=!0;if(!o){a=!1;return}if(Te("Read",o)||(a=!1),it("Read",e,t,s,r,n)||(a=!1),!a)throw new Error("PERMISSION_DENIED")},ta=async(n,e,t,s,r)=>{const{labels:i}=e,o=r.collections?.[i.collection];let a=!0;if(!o){a=!1;return}if(Te("Read",o)||(a=!1),n.forEach(l=>{it("Read",e,t,s,r,l)||(a=!1)}),!a)throw new Error("PERMISSION_DENIED")},na=(n,e,t)=>{const{access:s}=n;return s.operations[t]?.includes(e)},sa=(n,e,t)=>{const{access:s}=e,{entityRestrictions:r}=s;if(r?.restrictions){for(const i of r.restrictions)if(i.roles?.some(o=>o.role===n)&&!("singleQuery"in i&&i.singleQuery))return`${i.type} entity restriction`}if(r?.parentFilters)for(const i of r.parentFilters){if(!i.roles.some(c=>c.role===n))continue;const o=W(e.fields,i.collectionField);if(!ee(o))throw new Error("PERMISSION_DENIED");const l=t.collections[o.collection].access.entityRestrictions?.restrictions?.find(c=>c.type===i.type&&c.roles.some(d=>d.role===n));if(!l)throw new Error("PERMISSION_DENIED");if(l.type!==i.type)throw new Error("PERMISSION_DENIED");if(!("singleQuery"in l&&l.singleQuery))return`${i.type} parent filter`}return!0},ra=(n,e,t,s,r)=>{const i={};for(const o of n){const l=e[o].default({sdk:t,utils:s,context:r});for(const c in l)c==="custom"||c==="admin"||c==="fields"||delete l[c];for(const c of l.fields)for(const d in c)d==="custom"||d==="admin"||d==="name"||d==="formula"||delete c[d];i[o]=l}return i},Ae=(n,e)=>e.fields.filter(t=>t.name===n.name)[0],Kn={global:{},collections:{}},qt=(n,e)=>n&&typeof n=="function"?e?n(...e):n():n,oe=async(n,e)=>{let t=n;return n&&(typeof n=="function"||typeof n.then=="function")&&(e?t=await n(...e):t=await n()),t},ia=async(n,e,t,s)=>{for(const d of e)if(d==="__proto__"||d==="constructor"||d==="prototype")throw new Error("Invalid config path: prototype pollution keys are not allowed");let r=Kn,i=!0;for(const d of e){if(d===void 0||r[d]===void 0){i=!1;break}r=r[d]}if(r&&i&&!s)return r;let o,a=n,l=!0;e[0]==="collections"?o=e.slice(2):o=e.slice(1);for(const d of o){if(d===void 0||a[d]===void 0){l=!1;break}a=a[d]}let c;if(l&&(c=await oe(a,t)),c){let d=Kn;const h={};for(let u=0;u<e.length;u++){const f=e[u];if(f!==void 0){if(f==="__proto__"||f==="constructor"||f==="prototype")throw new Error("Invalid config path: prototype pollution keys are not allowed");u===e.length-1?qo(h,e.join("."),c):(d[f]||={},d=d[f])}}Zo(Kn,h)}return c},lt=(n,e,t)=>{const s=Object.values(t.collections),{labels:r}=e;let i=!1;for(const o of s){const{fields:a}=o;for(const l of a)if(ee(l)&&l.collection===r.collection&&l.dependencyFields)for(const c of l.dependencyFields)c.field===n.name&&(i=!0)}return i},yi=(n,e)=>{const t=Object.values(e.collections),{labels:s}=n,r={};return t.forEach(i=>{const{labels:o,fields:a}=i;a.forEach(l=>{ee(l)&&l.collection===s.collection&&l.dependencyFields&&l.dependencyFields.forEach(c=>{r[c.field]||={},r[c.field][o.collection]||=[],r[c.field][o.collection]=r[c.field][o.collection].concat(c.roles),r[c.field][o.collection]=[...new Set(r[c.field][o.collection])]})})}),r},Xn=n=>JSON.stringify(n.map(e=>e.name)),mt=["id","Collection_Path","Last_Write_At","Last_Save_At","Last_Write_By","Last_Write_App","Last_Write_Connection_Status","Last_Write_Version","Created_At","Saved_At","Created_By"],Zn=()=>mt.map(n=>{let e="",t;switch(n){case"id":e="String";break;case"Collection_Path":e="Array";break;case"Created_At":e="Timestamp";break;case"Saved_At":e="Timestamp";break;case"Created_By":e="String";break;case"Last_Write_At":e="Timestamp";break;case"Last_Save_At":e="Timestamp";break;case"Last_Write_By":e="String";break;case"Last_Write_App":e="String";break;case"Last_Write_Connection_Status":e="String",t=["Online","Offline"];break;case"Last_Write_Version":e="Number";break}const s={name:n,type:e,required:!0};return t&&(s.values=t),s}),gi=(n,e)=>{const t=[],{access:s,fields:r}=n,{attributeRestrictions:i,entityRestrictions:o}=s,a=Zn();return i&&i.forEach(l=>{if(l.roles.some(c=>c.role===e))switch(l.type){case"Record_Owner":t.push(W(a,"Created_By"));break;case"Record_User":t.push(W(r,l.collectionField));break;case"Record_Property":t.push(W(r,l.propertyField));break}}),o&&(o.restrictions?.forEach(l=>{if(l.roles.some(c=>c.role===e))switch(l.type){case"Individual":t.push(W(a,"id"));break;case"Parent":t.push(W(r,l.collectionField));break;case"Parent_Property":t.push(W(r,l.collectionField)),t.push(W(r,l.propertyField));break}}),o.parentFilters&&o.parentFilters.forEach(l=>{if(l.roles.some(c=>c.role===e))switch(l.type){case"Individual":t.push(W(r,l.collectionField));break;case"Parent":t.push(W(r,l.parentCollectionField));break;case"Parent_Property":t.push(W(r,l.parentCollectionField)),t.push(W(r,l.parentPropertyField));break}})),[...new Set(t)]},oa=(n,e)=>{const t=[],{fields:s,roleSystemFields:r,preloadCache:i,queries:o}=n,a=Zn();return t.push({name:"Collection_Path",type:"Array",required:!0}),s.forEach(c=>{(!c.access||c.access.includes(e))&&t.push(c)}),r?.filter(c=>(!c.roles||c.roles.includes(e))&&c.field!=="Collection_Path").forEach(c=>{t.push(W(a,c.field))}),i?.range&&i.range.fields.forEach(c=>{mt.includes(c)&&t.push(W(a,c))}),o?.forEach(c=>{const d=W(s.concat(a),c.field);(!c.roles||c.roles.includes(e))&&d&&(!d.access||d.access?.includes(e))&&mt.includes(c.field)&&t.push(W(a,c.field))}),gi(n,e).forEach(c=>{mt.includes(c.name)&&t.push(W(a,c.name))}),[...new Set(t)]},aa=(n,e,t)=>{const s=[],{fields:r,preloadCache:i}=e,o=Zn();i?.range&&i.range.fields.forEach(c=>{mt.includes(c)?s.push(W(o,c)):s.push(W(r,c))});const a=new Set,l=yi(e,t);return Object.entries(l).map(([c,d])=>{n.name===c&&Object.values(d).forEach(h=>{h.forEach(u=>{a.add(u)})})}),a.forEach(c=>{s.push(...gi(e,c))}),[...new Set(s)]},dn=(n,e,t)=>{const s=[],{fields:r,softDelete:i}=e;s.push({name:"Collection_Path",type:"Array",required:!0}),s.push({name:"id",type:"String",required:!0});const o=[],a=yi(e,t);if(Object.values(a).forEach(l=>{Object.keys(l).forEach(c=>{t.collections[c].fields.forEach(h=>{ee(h)&&h.collection===e.labels.collection&&h.dependencyFields?.some(u=>u.field===n.name)&&h.constraints&&h.constraints.forEach(u=>{o.push(u[0])})})})}),o.forEach(l=>{s.push(W(r,l))}),i){const l=W(r,i.archivedField);l&&s.push(l)}return s.push(...aa(n,e,t)),[...new Set(s)]},wi=(n,e)=>{const{preloadCache:t}=n,s=new Set;for(const r of e.config.roles){if(!na(n,r,"read"))continue;const i=oa(n,r);let o=!1;if(s.size===0)s.add({key:"1",roles:[r],fields:i}),o=!0;else for(const a of s)i.length===a.fields.length&&i.every(l=>a.fields.some(c=>c.name===l.name))&&!!t?.roles.includes(r)==!!a.roles.every(l=>t?.roles.includes(l))&&(a.roles.push(r),o=!0);o||s.add({key:(s.size+1).toString(),roles:[r],fields:i})}return s},_i=(n,e,t)=>{const s=wi(e,t);for(const r of s.values())if(r.roles.includes(n))return r},la=(n,e)=>{const{fields:t}=e,s=Zn(),r=[];return[...t,...s.filter(o=>o.name!=="id")].forEach(o=>{n?.fields.some(a=>a.name===o.name)||r.push(o)}),r},Vs=(n,e,t)=>{const s={};return Object.values(n.collections).forEach(r=>{const i=wi(r,n),o=Array.from(i);o.map(a=>(a.fields.forEach(l=>{}),a)),s[r.labels.collection]=new Set(o)}),s},Tn=n=>({Last_Write_At:n.Last_Write_At,Last_Write_By:n.Last_Write_By,Last_Write_Connection_Status:n.Last_Write_Connection_Status,Last_Write_Version:n.Last_Write_Version,Last_Write_App:n.Last_Write_App,Last_Save_At:n.Last_Save_At}),es=async(n,e,t)=>{if(e){const s=await oe(e,[t]);if(s===!1)throw new Error(`CANCELLED: Operation cancelled by ${n}`);return s}};async function ae(n,e,t,s){const r=await es(n,t.custom?.[n],s);for(const i of t.fields)await es(n,i.custom?.[n],s);if(n!=="setEmbedding"&&(await es(n,e?.[n],s),n==="postWriteError"))return r}const Us=(n,e,t,s,r,i,o,a,l,c)=>(n==="create"&&(t.Collection_Path=e,t.Created_At=a,t.Saved_At=l,t.Created_By=o||"System"),t.Last_Write_App=r,t.Last_Write_At=a,t.Last_Save_At=l,t.Last_Write_By=o||"System",t.Last_Write_Connection_Status=i,t.Last_Write_Version=s.version,t),dt=(n,e)=>{const{access:t,queries:s}=n,{serverReadOnly:r}=t,i=new Set;if(s)for(const o of s){const a=W(e,o.field);e.find(l=>l.name===o.field)&&ee(a)&&["OneToOne","OneToMany"].includes(a.type)&&i.add(a)}return e.forEach(o=>{ee(o)&&["OneToOne","OneToMany"].includes(o.type)&&o.sorting&&(typeof o.sorting=="boolean"||!o.sorting.roles?.every(a=>r?.includes(a)))&&i.add(o)}),i},wt=(n,e)=>{const{access:t,recordTitleField:s}=n,{serverReadOnly:r}=t,i=new Set;return e.forEach(o=>{(s===o.name||o.sorting&&(typeof o.sorting=="boolean"||!o.sorting.roles?.every(a=>r?.includes(a))))&&o.type==="String"&&i.add(o)}),i},Sn=(n,e,t)=>{const{fields:s}=n;s.forEach(i=>{if(ee(i))if(e[i.name]){if(ke(e[i.name]))e[`${i.name}_Array`]=e[i.name];else if(e[`${i.name}_Array`]=Object.keys(e[i.name]),i.includeFields)for(const o of i.includeFields){const a=t.collections[i.collection],l=W(a.fields,o);wt(a,[l]).size===1&&Object.keys(e[i.name]).forEach(d=>{e[i.name][d][o]?e[i.name][d][`${o}_Lowercase`]=e[i.name][d][o].toLowerCase():delete e[i.name][d][`${o}_Lowercase`]})}}else delete e[`${i.name}_Array`],delete e[`${i.name}_Single`]}),dt(n,s).forEach(i=>{if(e[i.name])if(ke(e[i.name]))e[`${i.name}_Single`]=e[i.name];else{const o=e[`${i.name}_Array`]?.[0];if(o){const a=e[i.name][o]||{};e[`${i.name}_Single`]={id:o,...a}}}})},Rn=(n,e)=>{wt(n,n.fields).forEach(s=>{e[s.name]?e[`${s.name}_Lowercase`]=e[s.name].toLowerCase():delete e[`${s.name}_Lowercase`]})},ca=async(n,e,t,s)=>{const{fields:r}=e;for(const i of t.fields){const o=W(r,i.name);i.custom?.initialValue!==void 0&&!(s&&o.access&&!o.access.includes(s))&&(n[i.name]=await oe(i.custom.initialValue,[n]),wt(e,[o]).size===1&&(n[`${i.name}_Lowercase`]=n[i.name].toLowerCase()))}for(const i of r)s&&i.access&&!i.access.includes(s)||("autoIncrement"in i&&i.autoIncrement&&!n[i.name]&&(n[i.name]="Pending"),!ee(i)&&i.nullable&&n[i.name]===void 0&&(n[i.name]=null))};var se;(function(n){n.assertEqual=r=>{};function e(r){}n.assertIs=e;function t(r){throw new Error}n.assertNever=t,n.arrayToEnum=r=>{const i={};for(const o of r)i[o]=o;return i},n.getValidEnumValues=r=>{const i=n.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),o={};for(const a of i)o[a]=r[a];return n.objectValues(o)},n.objectValues=r=>n.objectKeys(r).map(function(i){return r[i]}),n.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&i.push(o);return i},n.find=(r,i)=>{for(const o of r)if(i(o))return o},n.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,i=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}n.joinValues=s,n.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(se||(se={}));var mr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(mr||(mr={}));const U=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xe=n=>{switch(typeof n){case"undefined":return U.undefined;case"string":return U.string;case"number":return Number.isNaN(n)?U.nan:U.number;case"boolean":return U.boolean;case"function":return U.function;case"bigint":return U.bigint;case"symbol":return U.symbol;case"object":return Array.isArray(n)?U.array:n===null?U.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?U.promise:typeof Map<"u"&&n instanceof Map?U.map:typeof Set<"u"&&n instanceof Set?U.set:typeof Date<"u"&&n instanceof Date?U.date:U.object;default:return U.unknown}},A=se.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ye extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},s={_errors:[]},r=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let a=s,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return r(this),s}static assert(e){if(!(e instanceof Ye))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const r of this.issues)if(r.path.length>0){const i=r.path[0];t[i]=t[i]||[],t[i].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}Ye.create=n=>new Ye(n);const gs=(n,e)=>{let t;switch(n.code){case A.invalid_type:n.received===U.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case A.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,se.jsonStringifyReplacer)}`;break;case A.unrecognized_keys:t=`Unrecognized key(s) in object: ${se.joinValues(n.keys,", ")}`;break;case A.invalid_union:t="Invalid input";break;case A.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${se.joinValues(n.options)}`;break;case A.invalid_enum_value:t=`Invalid enum value. Expected ${se.joinValues(n.options)}, received '${n.received}'`;break;case A.invalid_arguments:t="Invalid function arguments";break;case A.invalid_return_type:t="Invalid function return type";break;case A.invalid_date:t="Invalid date";break;case A.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:se.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case A.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case A.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case A.custom:t="Invalid input";break;case A.invalid_intersection_types:t="Intersection results could not be merged";break;case A.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case A.not_finite:t="Number must be finite";break;default:t=e.defaultError,se.assertNever(n)}return{message:t}};let ua=gs;function da(){return ua}const fa=n=>{const{data:e,path:t,errorMaps:s,issueData:r}=n,i=[...t,...r.path||[]],o={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let a="";const l=s.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...r,path:i,message:a}};function P(n,e){const t=da(),s=fa({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===gs?void 0:gs].filter(r=>!!r)});n.common.issues.push(s)}class _e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const r of t){if(r.status==="aborted")return J;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const r of t){const i=await r.key,o=await r.value;s.push({key:i,value:o})}return _e.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const r of t){const{key:i,value:o}=r;if(i.status==="aborted"||o.status==="aborted")return J;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(s[i.value]=o.value)}return{status:e.value,value:s}}}const J=Object.freeze({status:"aborted"}),Bt=n=>({status:"dirty",value:n}),Ce=n=>({status:"valid",value:n}),pr=n=>n.status==="aborted",yr=n=>n.status==="dirty",Dt=n=>n.status==="valid",In=n=>typeof Promise<"u"&&n instanceof Promise;var j;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(j||(j={}));class je{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gr=(n,e)=>{if(Dt(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ye(n.common.issues);return this._error=t,this._error}}};function K(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:r}=n;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,a)=>{const{message:l}=n;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??s??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??t??a.defaultError}},description:r}}class te{get description(){return this._def.description}_getType(e){return Xe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _e,ctx:{common:e.parent.common,data:e.data,parsedType:Xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(In(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)},r=this._parseSync({data:e,path:s.path,parent:s});return gr(s,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return Dt(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>Dt(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xe(e)},r=this._parse({data:e,path:s.path,parent:s}),i=await(In(r)?r:Promise.resolve(r));return gr(s,i)}refine(e,t){const s=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,i)=>{const o=e(r),a=()=>i.addIssue({code:A.custom,...s(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new Ft({schema:this,typeName:Y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return st.create(this,this._def)}nullable(){return $t.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ue.create(this)}promise(){return Cn.create(this,this._def)}or(e){return Nn.create([this,e],this._def)}and(e){return Dn.create(this,e,this._def)}transform(e){return new Ft({...K(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ks({...K(this._def),innerType:this,defaultValue:t,typeName:Y.ZodDefault})}brand(){return new $a({typeName:Y.ZodBranded,type:this,...K(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new bs({...K(this._def),innerType:this,catchValue:t,typeName:Y.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ws.create(this,e)}readonly(){return Ts.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ha=/^c[^\s-]{8,}$/i,ma=/^[0-9a-z]+$/,pa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ya=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ga=/^[a-z0-9_-]{21}$/i,wa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_a=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ea=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,va="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ts;const Oa=/^(?:(?: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])$/,ka=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ba=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ta=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Sa=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ra=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ei="((\\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])))",Ia=new RegExp(`^${Ei}$`);function vi(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function xa(n){return new RegExp(`^${vi(n)}$`)}function Na(n){let e=`${Ei}T${vi(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Da(n,e){return!!((e==="v4"||!e)&&Oa.test(n)||(e==="v6"||!e)&&ba.test(n))}function Aa(n,e){if(!wa.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Ca(n,e){return!!((e==="v4"||!e)&&ka.test(n)||(e==="v6"||!e)&&Ta.test(n))}class Ge extends te{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==U.string){const i=this._getOrReturnCtx(e);return P(i,{code:A.invalid_type,expected:U.string,received:i.parsedType}),J}const s=new _e;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),P(r,{code:A.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),P(r,{code:A.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(r=this._getOrReturnCtx(e,r),o?P(r,{code:A.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&P(r,{code:A.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if(i.kind==="email")Ea.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"email",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="emoji")ts||(ts=new RegExp(va,"u")),ts.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"emoji",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="uuid")ya.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"uuid",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="nanoid")ga.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"nanoid",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid")ha.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"cuid",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="cuid2")ma.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"cuid2",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="ulid")pa.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"ulid",code:A.invalid_string,message:i.message}),s.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),P(r,{validation:"url",code:A.invalid_string,message:i.message}),s.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"regex",code:A.invalid_string,message:i.message}),s.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):i.kind==="datetime"?Na(i).test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:"datetime",message:i.message}),s.dirty()):i.kind==="date"?Ia.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:"date",message:i.message}),s.dirty()):i.kind==="time"?xa(i).test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{code:A.invalid_string,validation:"time",message:i.message}),s.dirty()):i.kind==="duration"?_a.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"duration",code:A.invalid_string,message:i.message}),s.dirty()):i.kind==="ip"?Da(e.data,i.version)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"ip",code:A.invalid_string,message:i.message}),s.dirty()):i.kind==="jwt"?Aa(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"jwt",code:A.invalid_string,message:i.message}),s.dirty()):i.kind==="cidr"?Ca(e.data,i.version)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"cidr",code:A.invalid_string,message:i.message}),s.dirty()):i.kind==="base64"?Sa.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"base64",code:A.invalid_string,message:i.message}),s.dirty()):i.kind==="base64url"?Ra.test(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{validation:"base64url",code:A.invalid_string,message:i.message}),s.dirty()):se.assertNever(i);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),{validation:t,code:A.invalid_string,...j.errToObj(s)})}_addCheck(e){return new Ge({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...j.errToObj(e)})}url(e){return this._addCheck({kind:"url",...j.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...j.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...j.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...j.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...j.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...j.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...j.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...j.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...j.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...j.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...j.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...j.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...j.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...j.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...j.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...j.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...j.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...j.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...j.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...j.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...j.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...j.errToObj(t)})}nonempty(e){return this.min(1,j.errToObj(e))}trim(){return new Ge({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ge({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ge({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ge.create=n=>new Ge({checks:[],typeName:Y.ZodString,coerce:n?.coerce??!1,...K(n)});function Fa(n,e){const t=(n.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,i=Number.parseInt(n.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return i%o/10**r}class At extends te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==U.number){const i=this._getOrReturnCtx(e);return P(i,{code:A.invalid_type,expected:U.number,received:i.parsedType}),J}let s;const r=new _e;for(const i of this._def.checks)i.kind==="int"?se.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{code:A.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?Fa(e.data,i.value)!==0&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),P(s,{code:A.not_finite,message:i.message}),r.dirty()):se.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,j.toString(t))}gt(e,t){return this.setLimit("min",e,!1,j.toString(t))}lte(e,t){return this.setLimit("max",e,!0,j.toString(t))}lt(e,t){return this.setLimit("max",e,!1,j.toString(t))}setLimit(e,t,s,r){return new At({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:j.toString(r)}]})}_addCheck(e){return new At({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:j.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:j.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&se.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}At.create=n=>new At({checks:[],typeName:Y.ZodNumber,coerce:n?.coerce||!1,...K(n)});class en extends te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==U.bigint)return this._getInvalidInput(e);let s;const r=new _e;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),P(s,{code:A.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):se.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return P(t,{code:A.invalid_type,expected:U.bigint,received:t.parsedType}),J}gte(e,t){return this.setLimit("min",e,!0,j.toString(t))}gt(e,t){return this.setLimit("min",e,!1,j.toString(t))}lte(e,t){return this.setLimit("max",e,!0,j.toString(t))}lt(e,t){return this.setLimit("max",e,!1,j.toString(t))}setLimit(e,t,s,r){return new en({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:j.toString(r)}]})}_addCheck(e){return new en({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:j.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}en.create=n=>new en({checks:[],typeName:Y.ZodBigInt,coerce:n?.coerce??!1,...K(n)});class ws extends te{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==U.boolean){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.boolean,received:s.parsedType}),J}return Ce(e.data)}}ws.create=n=>new ws({typeName:Y.ZodBoolean,coerce:n?.coerce||!1,...K(n)});class xn extends te{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==U.date){const i=this._getOrReturnCtx(e);return P(i,{code:A.invalid_type,expected:U.date,received:i.parsedType}),J}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return P(i,{code:A.invalid_date}),J}const s=new _e;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),P(r,{code:A.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),s.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),P(r,{code:A.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),s.dirty()):se.assertNever(i);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new xn({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:j.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:j.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}xn.create=n=>new xn({checks:[],coerce:n?.coerce||!1,typeName:Y.ZodDate,...K(n)});class wr extends te{_parse(e){if(this._getType(e)!==U.symbol){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.symbol,received:s.parsedType}),J}return Ce(e.data)}}wr.create=n=>new wr({typeName:Y.ZodSymbol,...K(n)});class _s extends te{_parse(e){if(this._getType(e)!==U.undefined){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.undefined,received:s.parsedType}),J}return Ce(e.data)}}_s.create=n=>new _s({typeName:Y.ZodUndefined,...K(n)});class _r extends te{_parse(e){if(this._getType(e)!==U.null){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.null,received:s.parsedType}),J}return Ce(e.data)}}_r.create=n=>new _r({typeName:Y.ZodNull,...K(n)});class Es extends te{constructor(){super(...arguments),this._any=!0}_parse(e){return Ce(e.data)}}Es.create=n=>new Es({typeName:Y.ZodAny,...K(n)});class Er extends te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ce(e.data)}}Er.create=n=>new Er({typeName:Y.ZodUnknown,...K(n)});class ot extends te{_parse(e){const t=this._getOrReturnCtx(e);return P(t,{code:A.invalid_type,expected:U.never,received:t.parsedType}),J}}ot.create=n=>new ot({typeName:Y.ZodNever,...K(n)});class vr extends te{_parse(e){if(this._getType(e)!==U.undefined){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.void,received:s.parsedType}),J}return Ce(e.data)}}vr.create=n=>new vr({typeName:Y.ZodVoid,...K(n)});class Ue extends te{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==U.array)return P(t,{code:A.invalid_type,expected:U.array,received:t.parsedType}),J;if(r.exactLength!==null){const o=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(o||a)&&(P(t,{code:o?A.too_big:A.too_small,minimum:a?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(P(t,{code:A.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(P(t,{code:A.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>r.type._parseAsync(new je(t,o,t.path,a)))).then(o=>_e.mergeArray(s,o));const i=[...t.data].map((o,a)=>r.type._parseSync(new je(t,o,t.path,a)));return _e.mergeArray(s,i)}get element(){return this._def.type}min(e,t){return new Ue({...this._def,minLength:{value:e,message:j.toString(t)}})}max(e,t){return new Ue({...this._def,maxLength:{value:e,message:j.toString(t)}})}length(e,t){return new Ue({...this._def,exactLength:{value:e,message:j.toString(t)}})}nonempty(e){return this.min(1,e)}}Ue.create=(n,e)=>new Ue({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...K(e)});function Tt(n){if(n instanceof ue){const e={};for(const t in n.shape){const s=n.shape[t];e[t]=st.create(Tt(s))}return new ue({...n._def,shape:()=>e})}else return n instanceof Ue?new Ue({...n._def,type:Tt(n.element)}):n instanceof st?st.create(Tt(n.unwrap())):n instanceof $t?$t.create(Tt(n.unwrap())):n instanceof pt?pt.create(n.items.map(e=>Tt(e))):n}class ue extends te{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=se.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==U.object){const c=this._getOrReturnCtx(e);return P(c,{code:A.invalid_type,expected:U.object,received:c.parsedType}),J}const{status:s,ctx:r}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof ot&&this._def.unknownKeys==="strip"))for(const c in r.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const d=i[c],h=r.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new je(r,h,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof ot){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of a)l.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(c==="strict")a.length>0&&(P(r,{code:A.unrecognized_keys,keys:a}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of a){const h=r.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new je(r,h,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of l){const h=await d.key,u=await d.value;c.push({key:h,value:u,alwaysSet:d.alwaysSet})}return c}).then(c=>_e.mergeObjectSync(s,c)):_e.mergeObjectSync(s,l)}get shape(){return this._def.shape()}strict(e){return j.errToObj,new ue({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const r=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:j.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new ue({...this._def,unknownKeys:"strip"})}passthrough(){return new ue({...this._def,unknownKeys:"passthrough"})}extend(e){return new ue({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ue({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ue({...this._def,catchall:e})}pick(e){const t={};for(const s of se.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new ue({...this._def,shape:()=>t})}omit(e){const t={};for(const s of se.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new ue({...this._def,shape:()=>t})}deepPartial(){return Tt(this)}partial(e){const t={};for(const s of se.objectKeys(this.shape)){const r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new ue({...this._def,shape:()=>t})}required(e){const t={};for(const s of se.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let i=this.shape[s];for(;i instanceof st;)i=i._def.innerType;t[s]=i}return new ue({...this._def,shape:()=>t})}keyof(){return Oi(se.objectKeys(this.shape))}}ue.create=(n,e)=>new ue({shape:()=>n,unknownKeys:"strip",catchall:ot.create(),typeName:Y.ZodObject,...K(e)});ue.strictCreate=(n,e)=>new ue({shape:()=>n,unknownKeys:"strict",catchall:ot.create(),typeName:Y.ZodObject,...K(e)});ue.lazycreate=(n,e)=>new ue({shape:n,unknownKeys:"strip",catchall:ot.create(),typeName:Y.ZodObject,...K(e)});class Nn extends te{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function r(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ye(a.ctx.common.issues));return P(t,{code:A.invalid_union,unionErrors:o}),J}if(t.common.async)return Promise.all(s.map(async i=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let i;const o=[];for(const l of s){const c={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ye(l));return P(t,{code:A.invalid_union,unionErrors:a}),J}}get options(){return this._def.options}}Nn.create=(n,e)=>new Nn({options:n,typeName:Y.ZodUnion,...K(e)});function vs(n,e){const t=Xe(n),s=Xe(e);if(n===e)return{valid:!0,data:n};if(t===U.object&&s===U.object){const r=se.objectKeys(e),i=se.objectKeys(n).filter(a=>r.indexOf(a)!==-1),o={...n,...e};for(const a of i){const l=vs(n[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===U.array&&s===U.array){if(n.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<n.length;i++){const o=n[i],a=e[i],l=vs(o,a);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return t===U.date&&s===U.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class Dn extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=(i,o)=>{if(pr(i)||pr(o))return J;const a=vs(i.value,o.value);return a.valid?((yr(i)||yr(o))&&t.dirty(),{status:t.value,value:a.data}):(P(s,{code:A.invalid_intersection_types}),J)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([i,o])=>r(i,o)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Dn.create=(n,e,t)=>new Dn({left:n,right:e,typeName:Y.ZodIntersection,...K(t)});class pt extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.array)return P(s,{code:A.invalid_type,expected:U.array,received:s.parsedType}),J;if(s.data.length<this._def.items.length)return P(s,{code:A.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J;!this._def.rest&&s.data.length>this._def.items.length&&(P(s,{code:A.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...s.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new je(s,o,s.path,a)):null}).filter(o=>!!o);return s.common.async?Promise.all(i).then(o=>_e.mergeArray(t,o)):_e.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new pt({...this._def,rest:e})}}pt.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pt({items:n,typeName:Y.ZodTuple,rest:null,...K(e)})};class An extends te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.object)return P(s,{code:A.invalid_type,expected:U.object,received:s.parsedType}),J;const r=[],i=this._def.keyType,o=this._def.valueType;for(const a in s.data)r.push({key:i._parse(new je(s,a,s.path,a)),value:o._parse(new je(s,s.data[a],s.path,a)),alwaysSet:a in s.data});return s.common.async?_e.mergeObjectAsync(t,r):_e.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof te?new An({keyType:e,valueType:t,typeName:Y.ZodRecord,...K(s)}):new An({keyType:Ge.create(),valueType:e,typeName:Y.ZodRecord,...K(t)})}}class Or extends te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.map)return P(s,{code:A.invalid_type,expected:U.map,received:s.parsedType}),J;const r=this._def.keyType,i=this._def.valueType,o=[...s.data.entries()].map(([a,l],c)=>({key:r._parse(new je(s,a,s.path,[c,"key"])),value:i._parse(new je(s,l,s.path,[c,"value"]))}));if(s.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return J;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),a.set(c.value,d.value)}return{status:t.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return J;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),a.set(c.value,d.value)}return{status:t.value,value:a}}}}Or.create=(n,e,t)=>new Or({valueType:e,keyType:n,typeName:Y.ZodMap,...K(t)});class tn extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==U.set)return P(s,{code:A.invalid_type,expected:U.set,received:s.parsedType}),J;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(P(s,{code:A.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(P(s,{code:A.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const d of l){if(d.status==="aborted")return J;d.status==="dirty"&&t.dirty(),c.add(d.value)}return{status:t.value,value:c}}const a=[...s.data.values()].map((l,c)=>i._parse(new je(s,l,s.path,c)));return s.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new tn({...this._def,minSize:{value:e,message:j.toString(t)}})}max(e,t){return new tn({...this._def,maxSize:{value:e,message:j.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}tn.create=(n,e)=>new tn({valueType:n,minSize:null,maxSize:null,typeName:Y.ZodSet,...K(e)});class kr extends te{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}kr.create=(n,e)=>new kr({getter:n,typeName:Y.ZodLazy,...K(e)});class Os extends te{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return P(t,{received:t.data,code:A.invalid_literal,expected:this._def.value}),J}return{status:"valid",value:e.data}}get value(){return this._def.value}}Os.create=(n,e)=>new Os({value:n,typeName:Y.ZodLiteral,...K(e)});function Oi(n,e){return new Ct({values:n,typeName:Y.ZodEnum,...K(e)})}class Ct extends te{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return P(t,{expected:se.joinValues(s),received:t.parsedType,code:A.invalid_type}),J}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return P(t,{received:t.data,code:A.invalid_enum_value,options:s}),J}return Ce(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ct.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ct.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}Ct.create=Oi;class br extends te{_parse(e){const t=se.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==U.string&&s.parsedType!==U.number){const r=se.objectValues(t);return P(s,{expected:se.joinValues(r),received:s.parsedType,code:A.invalid_type}),J}if(this._cache||(this._cache=new Set(se.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=se.objectValues(t);return P(s,{received:s.data,code:A.invalid_enum_value,options:r}),J}return Ce(e.data)}get enum(){return this._def.values}}br.create=(n,e)=>new br({values:n,typeName:Y.ZodNativeEnum,...K(e)});class Cn extends te{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==U.promise&&t.common.async===!1)return P(t,{code:A.invalid_type,expected:U.promise,received:t.parsedType}),J;const s=t.parsedType===U.promise?t.data:Promise.resolve(t.data);return Ce(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Cn.create=(n,e)=>new Cn({type:n,typeName:Y.ZodPromise,...K(e)});class Ft extends te{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:o=>{P(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){const o=r.transform(s.data,i);if(s.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return J;const l=await this._def.schema._parseAsync({data:a,path:s.path,parent:s});return l.status==="aborted"?J:l.status==="dirty"||t.value==="dirty"?Bt(l.value):l});{if(t.value==="aborted")return J;const a=this._def.schema._parseSync({data:o,path:s.path,parent:s});return a.status==="aborted"?J:a.status==="dirty"||t.value==="dirty"?Bt(a.value):a}}if(r.type==="refinement"){const o=a=>{const l=r.refinement(a,i);if(s.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?J:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>a.status==="aborted"?J:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(r.type==="transform")if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Dt(o))return J;const a=r.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>Dt(o)?Promise.resolve(r.transform(o.value,i)).then(a=>({status:t.value,value:a})):J);se.assertNever(r)}}Ft.create=(n,e,t)=>new Ft({schema:n,typeName:Y.ZodEffects,effect:e,...K(t)});Ft.createWithPreprocess=(n,e,t)=>new Ft({schema:e,effect:{type:"preprocess",transform:n},typeName:Y.ZodEffects,...K(t)});class st extends te{_parse(e){return this._getType(e)===U.undefined?Ce(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}st.create=(n,e)=>new st({innerType:n,typeName:Y.ZodOptional,...K(e)});class $t extends te{_parse(e){return this._getType(e)===U.null?Ce(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$t.create=(n,e)=>new $t({innerType:n,typeName:Y.ZodNullable,...K(e)});class ks extends te{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===U.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ks.create=(n,e)=>new ks({innerType:n,typeName:Y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...K(e)});class bs extends te{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return In(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ye(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ye(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}bs.create=(n,e)=>new bs({innerType:n,typeName:Y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...K(e)});class Tr extends te{_parse(e){if(this._getType(e)!==U.nan){const s=this._getOrReturnCtx(e);return P(s,{code:A.invalid_type,expected:U.nan,received:s.parsedType}),J}return{status:"valid",value:e.data}}}Tr.create=n=>new Tr({typeName:Y.ZodNaN,...K(n)});class $a extends te{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ws extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?J:i.status==="dirty"?(t.dirty(),Bt(i.value)):this._def.out._parseAsync({data:i.value,path:s.path,parent:s})})();{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?J:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new Ws({in:e,out:t,typeName:Y.ZodPipeline})}}class Ts extends te{_parse(e){const t=this._def.innerType._parse(e),s=r=>(Dt(r)&&(r.value=Object.freeze(r.value)),r);return In(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}}Ts.create=(n,e)=>new Ts({innerType:n,typeName:Y.ZodReadonly,...K(e)});var Y;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(Y||(Y={}));const be=Ge.create,ft=At.create,Kt=ws.create,ns=_s.create,me=Es.create;ot.create;const _t=Ue.create,We=ue.create,ve=Nn.create;Dn.create;pt.create;const rn=An.create,Oe=Os.create,Fn=Ct.create;Cn.create;st.create;$t.create;const wn=()=>me().refine(n=>n&&(n.seconds!==void 0&&n.nanoseconds!==void 0||n._seconds!==void 0&&n._nanoseconds!==void 0),{message:"Value is not a valid timestamp"}),Sr=()=>me().refine(n=>n&&(n._methodName==="serverTimestamp"||n.constructor.name==="ServerTimestampTransform"),{message:"Value is not a valid server timestamp"}),ki=(n,e,t)=>{const s={};if(n.includeFields){const i=e.collections[n.collection];if(!i)return rn(me());n.includeFields.forEach(o=>{const a=i.fields.find(c=>c.name===o);if(!a)throw new Error(`Field ${o} not found in collection ${n.collection}`);s[o]=$n(i,a),wt(i,[a]).size===1&&(s[`${o}_Lowercase`]=$n(i,a,!0))})}const r={Collection_Path:_t(be()),...s};return t&&(r.id=be().length(20)),We(r)},Ma=(n,e)=>{let t=rn(ki(n,e));return n.required||(t=t.optional()),t},Pa=n=>{let e=_t(ve([be().length(20),be().length(28)]));return["OneToOne","OneToMany"].includes(n.type)?e=e.max(1):(n.min&&(e=e.min(n.min)),n.max&&(e=e.max(n.max)),n.length&&(e=e.length(n.length))),n.required?e=e.nonempty():e=e.optional(),e},$n=(n,e,t)=>{const{softDelete:s}=n,r=s?.timestampField;let i;switch(e.type){case"String":if(i=be(),e.length&&(i=i.length(e.length)),e.minlength&&(i=i.min(e.minlength)),e.maxlength&&(i=i.max(e.maxlength)),e.email&&(i=i.email()),e.uuid&&(i=i.uuid()),e.url&&(i=i.url()),e.emoji&&(i=i.emoji()),e.ip&&(i=i.ip()),e.pattern&&(i=i.regex(new RegExp(e.pattern))),t&&(i=i.toLowerCase()),e.values)if(t){const o=e.values.map(a=>a.toLowerCase());i=Fn(o)}else i=Fn(e.values);break;case"Boolean":i=Kt();break;case"Number":e.autoIncrement?i=ve([Oe("Pending"),ft().int()]):(i=ft(),e.min&&(i=i.min(e.min)),e.max&&(i=i.max(e.max)),e.decimal?i=i.refine(o=>e.decimal?(o.toString().split(".")[1]?.length||0)<=e.decimal:!1,{message:`Value must have ${e.decimal} or fewer decimal places`}):i=i.int(),e.values&&(i=i.refine(o=>e.values?.includes(o),{message:"Value is not an allowed value"})));break;case"Timestamp":e.name===r?i=me().refine(o=>o&&(o._methodName==="serverTimestamp"||o.constructor.name==="ServerTimestampTransform"||o.seconds!==void 0&&o.nanoseconds!==void 0||o._seconds!==void 0&&o._nanoseconds!==void 0),{message:"Value is not a valid timestamp"}):(i=wn(),e.min&&(i=i.refine(o=>o.toMillis()>=e.min,{message:`Value is less than the minimum allowed value of ${e.min}`})),e.max&&(i=i.refine(o=>o.toMillis()<=e.max,{message:`Value is greater than the maximum allowed value of ${e.max}`})));break;case"Array":i=_t(me()),e.length&&(i=i.length(e.length)),e.minlength?i=i.min(e.minlength):e.required&&(i=i.nonempty()),e.maxlength&&(i=i.max(e.maxlength)),e.values&&(i=i.refine(o=>{let a=!0;return o.forEach(l=>{e.values&&!e.values.includes(l)&&(a=!1)}),a},{message:"Value is not an allowed value"}));break;case"Map":i=rn(me()),e.required&&(i=i.refine(o=>o&&typeof o=="object"&&Object.keys(o).length>0,{message:"Value must have at least one object property"}));break;case"Embedding":i=me();break}return!ee(e)&&e.nullable&&(i=i.nullable()),e.required||(i=i.optional()),i},bi=(n,e,t)=>{const s={Collection_Path:_t(be()),Last_Write_App:be(),Last_Write_At:wn(),Last_Save_At:Sr(),Last_Write_By:ve([be().length(28),Oe("System")]),Last_Write_Connection_Status:Fn(["Online","Offline"]),Last_Write_Version:ft().int(),id:be().regex(new RegExp("^[a-zA-Z0-9]+$")).length(20),Created_At:wn(),Created_By:ve([be().length(28),Oe("System")])};n==="create"&&(s.Saved_At=Sr()),n==="update"&&(s.Saved_At=wn(),s.Collection_Path=s.Collection_Path.optional(),s.id=s.id.optional(),s.Created_At=s.Created_At.optional(),s.Saved_At=s.Saved_At.optional(),s.Created_By=s.Created_By.optional());const r=dt(e,e.fields),i=Array.from(r).map(l=>l.name);e.fields.forEach(l=>{ee(l)?(s[l.name]=Ma(l,t),s[`${l.name}_Array`]=Pa(l),i.includes(l.name)&&(s[`${l.name}_Single`]=ki(l,t,!0),l.required||(s[`${l.name}_Single`]=s[`${l.name}_Single`].optional())),l.length&&(s[l.name]=s[l.name].refine(c=>l.length&&c&&Object.keys(c).length===l.length,{message:`Value must contain ${l.length} item(s)`})),l.min&&(s[l.name]=s[l.name].refine(c=>l.min&&c&&Object.keys(c).length>=l.min,{message:`Value must contain at least ${l.min} item(s)`})),l.max&&(s[l.name]=s[l.name].refine(c=>l.max&&(!c||Object.keys(c).length<=l.max),{message:`Value must contain at most ${l.max} item(s)`}))):l.type!=="Computed"&&(s[l.name]=$n(e,l))}),wt(e,e.fields).forEach(l=>{s[l.name]&&(s[`${l.name}_Lowercase`]=$n(e,l,!0))});const a=We(s);return e.allowSchemalessFields?a.passthrough():a.strict()};class Et extends Error{}class La extends Et{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Va extends Et{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Ua extends Et{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class St extends Et{}class Ti extends Et{constructor(e){super(`Invalid unit ${e}`)}}class pe extends Et{}class Ke extends Et{constructor(){super("Zone is an abstract class")}}const $="numeric",Pe="short",Se="long",Mn={year:$,month:$,day:$},Si={year:$,month:Pe,day:$},Wa={year:$,month:Pe,day:$,weekday:Pe},Ri={year:$,month:Se,day:$},Ii={year:$,month:Se,day:$,weekday:Se},xi={hour:$,minute:$},Ni={hour:$,minute:$,second:$},Di={hour:$,minute:$,second:$,timeZoneName:Pe},Ai={hour:$,minute:$,second:$,timeZoneName:Se},Ci={hour:$,minute:$,hourCycle:"h23"},Fi={hour:$,minute:$,second:$,hourCycle:"h23"},$i={hour:$,minute:$,second:$,hourCycle:"h23",timeZoneName:Pe},Mi={hour:$,minute:$,second:$,hourCycle:"h23",timeZoneName:Se},Pi={year:$,month:$,day:$,hour:$,minute:$},Li={year:$,month:$,day:$,hour:$,minute:$,second:$},Vi={year:$,month:Pe,day:$,hour:$,minute:$},Ui={year:$,month:Pe,day:$,hour:$,minute:$,second:$},ja={year:$,month:Pe,day:$,weekday:Pe,hour:$,minute:$},Wi={year:$,month:Se,day:$,hour:$,minute:$,timeZoneName:Pe},ji={year:$,month:Se,day:$,hour:$,minute:$,second:$,timeZoneName:Pe},zi={year:$,month:Se,day:$,weekday:Se,hour:$,minute:$,timeZoneName:Se},Zi={year:$,month:Se,day:$,weekday:Se,hour:$,minute:$,second:$,timeZoneName:Se};class on{get type(){throw new Ke}get name(){throw new Ke}get ianaName(){return this.name}get isUniversal(){throw new Ke}offsetName(e,t){throw new Ke}formatOffset(e,t){throw new Ke}offset(e){throw new Ke}equals(e){throw new Ke}get isValid(){throw new Ke}}let ss=null;class qn extends on{static get instance(){return ss===null&&(ss=new qn),ss}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return to(e,t,s)}formatOffset(e,t){return Xt(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const Ss=new Map;function za(n){let e=Ss.get(n);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Ss.set(n,e)),e}const Za={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function qa(n,e){const t=n.format(e).replace(/\u200E/g,""),s=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,r,i,o,a,l,c,d]=s;return[o,r,i,a,l,c,d]}function Ba(n,e){const t=n.formatToParts(e),s=[];for(let r=0;r<t.length;r++){const{type:i,value:o}=t[r],a=Za[i];i==="era"?s[a]=o:H(a)||(s[a]=parseInt(o,10))}return s}const rs=new Map;class Je extends on{static create(e){let t=rs.get(e);return t===void 0&&rs.set(e,t=new Je(e)),t}static resetCache(){rs.clear(),Ss.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=Je.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:s}){return to(e,t,s,this.name)}formatOffset(e,t){return Xt(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const s=za(this.name);let[r,i,o,a,l,c,d]=s.formatToParts?Ba(s,t):qa(s,t);a==="BC"&&(r=-Math.abs(r)+1);const u=Hn({year:r,month:i,day:o,hour:l===24?0:l,minute:c,second:d,millisecond:0});let f=+t;const y=f%1e3;return f-=y>=0?y:1e3+y,(u-f)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Rr={};function Ha(n,e={}){const t=JSON.stringify([n,e]);let s=Rr[t];return s||(s=new Intl.ListFormat(n,e),Rr[t]=s),s}const Rs=new Map;function Is(n,e={}){const t=JSON.stringify([n,e]);let s=Rs.get(t);return s===void 0&&(s=new Intl.DateTimeFormat(n,e),Rs.set(t,s)),s}const xs=new Map;function Ga(n,e={}){const t=JSON.stringify([n,e]);let s=xs.get(t);return s===void 0&&(s=new Intl.NumberFormat(n,e),xs.set(t,s)),s}const Ns=new Map;function Ya(n,e={}){const{base:t,...s}=e,r=JSON.stringify([n,s]);let i=Ns.get(r);return i===void 0&&(i=new Intl.RelativeTimeFormat(n,e),Ns.set(r,i)),i}let Ht=null;function Ja(){return Ht||(Ht=new Intl.DateTimeFormat().resolvedOptions().locale,Ht)}const Ds=new Map;function qi(n){let e=Ds.get(n);return e===void 0&&(e=new Intl.DateTimeFormat(n).resolvedOptions(),Ds.set(n,e)),e}const As=new Map;function Qa(n){let e=As.get(n);if(!e){const t=new Intl.Locale(n);e="getWeekInfo"in t?t.getWeekInfo():t.weekInfo,"minimalDays"in e||(e={...Bi,...e}),As.set(n,e)}return e}function Ka(n){const e=n.indexOf("-x-");e!==-1&&(n=n.substring(0,e));const t=n.indexOf("-u-");if(t===-1)return[n];{let s,r;try{s=Is(n).resolvedOptions(),r=n}catch{const l=n.substring(0,t);s=Is(l).resolvedOptions(),r=l}const{numberingSystem:i,calendar:o}=s;return[r,i,o]}}function Xa(n,e,t){return(t||e)&&(n.includes("-u-")||(n+="-u"),t&&(n+=`-ca-${t}`),e&&(n+=`-nu-${e}`)),n}function el(n){const e=[];for(let t=1;t<=12;t++){const s=V.utc(2009,t,1);e.push(n(s))}return e}function tl(n){const e=[];for(let t=1;t<=7;t++){const s=V.utc(2016,11,13+t);e.push(n(s))}return e}function fn(n,e,t,s){const r=n.listingMode();return r==="error"?null:r==="en"?t(e):s(e)}function nl(n){return n.numberingSystem&&n.numberingSystem!=="latn"?!1:n.numberingSystem==="latn"||!n.locale||n.locale.startsWith("en")||qi(n.locale).numberingSystem==="latn"}class sl{constructor(e,t,s){this.padTo=s.padTo||0,this.floor=s.floor||!1;const{padTo:r,floor:i,...o}=s;if(!t||Object.keys(o).length>0){const a={useGrouping:!1,...s};s.padTo>0&&(a.minimumIntegerDigits=s.padTo),this.inf=Ga(e,a)}}format(e){if(this.inf){const t=this.floor?Math.floor(e):e;return this.inf.format(t)}else{const t=this.floor?Math.floor(e):Bs(e,3);return de(t,this.padTo)}}}class rl{constructor(e,t,s){this.opts=s,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),a=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Je.create(a).valid?(r=a,this.dt=e):(r="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,r=e.zone.name):(r="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=Is(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(t=>{if(t.type==="timeZoneName"){const s=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...t,value:s}}else return t}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class il{constructor(e,t,s){this.opts={style:"long",...s},!t&&Xi()&&(this.rtf=Ya(e,s))}format(e,t){return this.rtf?this.rtf.format(e,t):Rl(t,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}}const Bi={firstDay:1,minimalDays:4,weekend:[6,7]};class ie{static fromOpts(e){return ie.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,t,s,r,i=!1){const o=e||ce.defaultLocale,a=o||(i?"en-US":Ja()),l=t||ce.defaultNumberingSystem,c=s||ce.defaultOutputCalendar,d=Fs(r)||ce.defaultWeekSettings;return new ie(a,l,c,d,o)}static resetCache(){Ht=null,Rs.clear(),xs.clear(),Ns.clear(),Ds.clear(),As.clear()}static fromObject({locale:e,numberingSystem:t,outputCalendar:s,weekSettings:r}={}){return ie.create(e,t,s,r)}constructor(e,t,s,r,i){const[o,a,l]=Ka(e);this.locale=o,this.numberingSystem=t||a||null,this.outputCalendar=s||l||null,this.weekSettings=r,this.intl=Xa(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=nl(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&t?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:ie.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,Fs(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return fn(this,e,ro,()=>{const s=this.intl==="ja"||this.intl.startsWith("ja-");t&=!s;const r=t?{month:e,day:"numeric"}:{month:e},i=t?"format":"standalone";if(!this.monthsCache[i][e]){const o=s?a=>this.dtFormatter(a,r).format():a=>this.extract(a,r,"month");this.monthsCache[i][e]=el(o)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return fn(this,e,ao,()=>{const s=t?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},r=t?"format":"standalone";return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=tl(i=>this.extract(i,s,"weekday"))),this.weekdaysCache[r][e]})}meridiems(){return fn(this,void 0,()=>lo,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[V.utc(2016,11,13,9),V.utc(2016,11,13,19)].map(t=>this.extract(t,e,"dayperiod"))}return this.meridiemCache})}eras(e){return fn(this,e,co,()=>{const t={era:e};return this.eraCache[e]||(this.eraCache[e]=[V.utc(-40,1,1),V.utc(2017,1,1)].map(s=>this.extract(s,t,"era"))),this.eraCache[e]})}extract(e,t,s){const r=this.dtFormatter(e,t),i=r.formatToParts(),o=i.find(a=>a.type.toLowerCase()===s);return o?o.value:null}numberFormatter(e={}){return new sl(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new rl(e,this.intl,t)}relFormatter(e={}){return new il(this.intl,this.isEnglish(),e)}listFormatter(e={}){return Ha(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||qi(this.intl).locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:eo()?Qa(this.locale):Bi}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}}let is=null;class we extends on{static get utcInstance(){return is===null&&(is=new we(0)),is}static instance(e){return e===0?we.utcInstance:new we(e)}static parseSpecifier(e){if(e){const t=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(t)return new we(Gn(t[1],t[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${Xt(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${Xt(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,t){return Xt(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class ol extends on{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function tt(n,e){if(H(n)||n===null)return e;if(n instanceof on)return n;if(fl(n)){const t=n.toLowerCase();return t==="default"?e:t==="local"||t==="system"?qn.instance:t==="utc"||t==="gmt"?we.utcInstance:we.parseSpecifier(t)||Je.create(n)}else return rt(n)?we.instance(n):typeof n=="object"&&"offset"in n&&typeof n.offset=="function"?n:new ol(n)}const js={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Ir={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},al=js.hanidec.replace(/[\[|\]]/g,"").split("");function ll(n){let e=parseInt(n,10);if(isNaN(e)){e="";for(let t=0;t<n.length;t++){const s=n.charCodeAt(t);if(n[t].search(js.hanidec)!==-1)e+=al.indexOf(n[t]);else for(const r in Ir){const[i,o]=Ir[r];s>=i&&s<=o&&(e+=s-i)}}return parseInt(e,10)}else return e}const Cs=new Map;function cl(){Cs.clear()}function Fe({numberingSystem:n},e=""){const t=n||"latn";let s=Cs.get(t);s===void 0&&(s=new Map,Cs.set(t,s));let r=s.get(e);return r===void 0&&(r=new RegExp(`${js[t]}${e}`),s.set(e,r)),r}let xr=()=>Date.now(),Nr="system",Dr=null,Ar=null,Cr=null,Fr=60,$r,Mr=null;class ce{static get now(){return xr}static set now(e){xr=e}static set defaultZone(e){Nr=e}static get defaultZone(){return tt(Nr,qn.instance)}static get defaultLocale(){return Dr}static set defaultLocale(e){Dr=e}static get defaultNumberingSystem(){return Ar}static set defaultNumberingSystem(e){Ar=e}static get defaultOutputCalendar(){return Cr}static set defaultOutputCalendar(e){Cr=e}static get defaultWeekSettings(){return Mr}static set defaultWeekSettings(e){Mr=Fs(e)}static get twoDigitCutoffYear(){return Fr}static set twoDigitCutoffYear(e){Fr=e%100}static get throwOnInvalid(){return $r}static set throwOnInvalid(e){$r=e}static resetCaches(){ie.resetCache(),Je.resetCache(),V.resetCache(),cl()}}class Me{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const Hi=[0,31,59,90,120,151,181,212,243,273,304,334],Gi=[0,31,60,91,121,152,182,213,244,274,305,335];function Ne(n,e){return new Me("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`)}function zs(n,e,t){const s=new Date(Date.UTC(n,e-1,t));n<100&&n>=0&&s.setUTCFullYear(s.getUTCFullYear()-1900);const r=s.getUTCDay();return r===0?7:r}function Yi(n,e,t){return t+(an(n)?Gi:Hi)[e-1]}function Ji(n,e){const t=an(n)?Gi:Hi,s=t.findIndex(i=>i<e),r=e-t[s];return{month:s+1,day:r}}function Zs(n,e){return(n-e+7)%7+1}function Pn(n,e=4,t=1){const{year:s,month:r,day:i}=n,o=Yi(s,r,i),a=Zs(zs(s,r,i),t);let l=Math.floor((o-a+14-e)/7),c;return l<1?(c=s-1,l=nn(c,e,t)):l>nn(s,e,t)?(c=s+1,l=1):c=s,{weekYear:c,weekNumber:l,weekday:a,...Yn(n)}}function Pr(n,e=4,t=1){const{weekYear:s,weekNumber:r,weekday:i}=n,o=Zs(zs(s,1,e),t),a=xt(s);let l=r*7+i-o-7+e,c;l<1?(c=s-1,l+=xt(c)):l>a?(c=s+1,l-=xt(s)):c=s;const{month:d,day:h}=Ji(c,l);return{year:c,month:d,day:h,...Yn(n)}}function os(n){const{year:e,month:t,day:s}=n,r=Yi(e,t,s);return{year:e,ordinal:r,...Yn(n)}}function Lr(n){const{year:e,ordinal:t}=n,{month:s,day:r}=Ji(e,t);return{year:e,month:s,day:r,...Yn(n)}}function Vr(n,e){if(!H(n.localWeekday)||!H(n.localWeekNumber)||!H(n.localWeekYear)){if(!H(n.weekday)||!H(n.weekNumber)||!H(n.weekYear))throw new St("Cannot mix locale-based week fields with ISO-based week fields");return H(n.localWeekday)||(n.weekday=n.localWeekday),H(n.localWeekNumber)||(n.weekNumber=n.localWeekNumber),H(n.localWeekYear)||(n.weekYear=n.localWeekYear),delete n.localWeekday,delete n.localWeekNumber,delete n.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function ul(n,e=4,t=1){const s=Bn(n.weekYear),r=De(n.weekNumber,1,nn(n.weekYear,e,t)),i=De(n.weekday,1,7);return s?r?i?!1:Ne("weekday",n.weekday):Ne("week",n.weekNumber):Ne("weekYear",n.weekYear)}function dl(n){const e=Bn(n.year),t=De(n.ordinal,1,xt(n.year));return e?t?!1:Ne("ordinal",n.ordinal):Ne("year",n.year)}function Qi(n){const e=Bn(n.year),t=De(n.month,1,12),s=De(n.day,1,Ln(n.year,n.month));return e?t?s?!1:Ne("day",n.day):Ne("month",n.month):Ne("year",n.year)}function Ki(n){const{hour:e,minute:t,second:s,millisecond:r}=n,i=De(e,0,23)||e===24&&t===0&&s===0&&r===0,o=De(t,0,59),a=De(s,0,59),l=De(r,0,999);return i?o?a?l?!1:Ne("millisecond",r):Ne("second",s):Ne("minute",t):Ne("hour",e)}function H(n){return typeof n>"u"}function rt(n){return typeof n=="number"}function Bn(n){return typeof n=="number"&&n%1===0}function fl(n){return typeof n=="string"}function hl(n){return Object.prototype.toString.call(n)==="[object Date]"}function Xi(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function eo(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function ml(n){return Array.isArray(n)?n:[n]}function Ur(n,e,t){if(n.length!==0)return n.reduce((s,r)=>{const i=[e(r),r];return s&&t(s[0],i[0])===s[0]?s:i},null)[1]}function pl(n,e){return e.reduce((t,s)=>(t[s]=n[s],t),{})}function Mt(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function Fs(n){if(n==null)return null;if(typeof n!="object")throw new pe("Week settings must be an object");if(!De(n.firstDay,1,7)||!De(n.minimalDays,1,7)||!Array.isArray(n.weekend)||n.weekend.some(e=>!De(e,1,7)))throw new pe("Invalid week settings");return{firstDay:n.firstDay,minimalDays:n.minimalDays,weekend:Array.from(n.weekend)}}function De(n,e,t){return Bn(n)&&n>=e&&n<=t}function yl(n,e){return n-e*Math.floor(n/e)}function de(n,e=2){const t=n<0;let s;return t?s="-"+(""+-n).padStart(e,"0"):s=(""+n).padStart(e,"0"),s}function et(n){if(!(H(n)||n===null||n===""))return parseInt(n,10)}function ct(n){if(!(H(n)||n===null||n===""))return parseFloat(n)}function qs(n){if(!(H(n)||n===null||n==="")){const e=parseFloat("0."+n)*1e3;return Math.floor(e)}}function Bs(n,e,t="round"){const s=10**e;switch(t){case"expand":return n>0?Math.ceil(n*s)/s:Math.floor(n*s)/s;case"trunc":return Math.trunc(n*s)/s;case"round":return Math.round(n*s)/s;case"floor":return Math.floor(n*s)/s;case"ceil":return Math.ceil(n*s)/s;default:throw new RangeError(`Value rounding ${t} is out of range`)}}function an(n){return n%4===0&&(n%100!==0||n%400===0)}function xt(n){return an(n)?366:365}function Ln(n,e){const t=yl(e-1,12)+1,s=n+(e-t)/12;return t===2?an(s)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][t-1]}function Hn(n){let e=Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond);return n.year<100&&n.year>=0&&(e=new Date(e),e.setUTCFullYear(n.year,n.month-1,n.day)),+e}function Wr(n,e,t){return-Zs(zs(n,1,e),t)+e-1}function nn(n,e=4,t=1){const s=Wr(n,e,t),r=Wr(n+1,e,t);return(xt(n)-s+r)/7}function $s(n){return n>99?n:n>ce.twoDigitCutoffYear?1900+n:2e3+n}function to(n,e,t,s=null){const r=new Date(n),i={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};s&&(i.timeZone=s);const o={timeZoneName:e,...i},a=new Intl.DateTimeFormat(t,o).formatToParts(r).find(l=>l.type.toLowerCase()==="timezonename");return a?a.value:null}function Gn(n,e){let t=parseInt(n,10);Number.isNaN(t)&&(t=0);const s=parseInt(e,10)||0,r=t<0||Object.is(t,-0)?-s:s;return t*60+r}function no(n){const e=Number(n);if(typeof n=="boolean"||n===""||!Number.isFinite(e))throw new pe(`Invalid unit value ${n}`);return e}function Vn(n,e){const t={};for(const s in n)if(Mt(n,s)){const r=n[s];if(r==null)continue;t[e(s)]=no(r)}return t}function Xt(n,e){const t=Math.trunc(Math.abs(n/60)),s=Math.trunc(Math.abs(n%60)),r=n>=0?"+":"-";switch(e){case"short":return`${r}${de(t,2)}:${de(s,2)}`;case"narrow":return`${r}${t}${s>0?`:${s}`:""}`;case"techie":return`${r}${de(t,2)}${de(s,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function Yn(n){return pl(n,["hour","minute","second","millisecond"])}const gl=["January","February","March","April","May","June","July","August","September","October","November","December"],so=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wl=["J","F","M","A","M","J","J","A","S","O","N","D"];function ro(n){switch(n){case"narrow":return[...wl];case"short":return[...so];case"long":return[...gl];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const io=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],oo=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],_l=["M","T","W","T","F","S","S"];function ao(n){switch(n){case"narrow":return[..._l];case"short":return[...oo];case"long":return[...io];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const lo=["AM","PM"],El=["Before Christ","Anno Domini"],vl=["BC","AD"],Ol=["B","A"];function co(n){switch(n){case"narrow":return[...Ol];case"short":return[...vl];case"long":return[...El];default:return null}}function kl(n){return lo[n.hour<12?0:1]}function bl(n,e){return ao(e)[n.weekday-1]}function Tl(n,e){return ro(e)[n.month-1]}function Sl(n,e){return co(e)[n.year<0?0:1]}function Rl(n,e,t="always",s=!1){const r={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},i=["hours","minutes","seconds"].indexOf(n)===-1;if(t==="auto"&&i){const h=n==="days";switch(e){case 1:return h?"tomorrow":`next ${r[n][0]}`;case-1:return h?"yesterday":`last ${r[n][0]}`;case 0:return h?"today":`this ${r[n][0]}`}}const o=Object.is(e,-0)||e<0,a=Math.abs(e),l=a===1,c=r[n],d=s?l?c[1]:c[2]||c[1]:l?r[n][0]:n;return o?`${a} ${d} ago`:`in ${a} ${d}`}function jr(n,e){let t="";for(const s of n)s.literal?t+=s.val:t+=e(s.val);return t}const Il={D:Mn,DD:Si,DDD:Ri,DDDD:Ii,t:xi,tt:Ni,ttt:Di,tttt:Ai,T:Ci,TT:Fi,TTT:$i,TTTT:Mi,f:Pi,ff:Vi,fff:Wi,ffff:zi,F:Li,FF:Ui,FFF:ji,FFFF:Zi};class ye{static create(e,t={}){return new ye(e,t)}static parseFormat(e){let t=null,s="",r=!1;const i=[];for(let o=0;o<e.length;o++){const a=e.charAt(o);a==="'"?((s.length>0||r)&&i.push({literal:r||/^\s+$/.test(s),val:s===""?"'":s}),t=null,s="",r=!r):r||a===t?s+=a:(s.length>0&&i.push({literal:/^\s+$/.test(s),val:s}),s=a,t=a)}return s.length>0&&i.push({literal:r||/^\s+$/.test(s),val:s}),i}static macroTokenToFormatOpts(e){return Il[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,s=void 0){if(this.opts.forceSimple)return de(e,t);const r={...this.opts};return t>0&&(r.padTo=t),s&&(r.signDisplay=s),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,t){const s=this.loc.listingMode()==="en",r=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",i=(f,y)=>this.loc.extract(e,f,y),o=f=>e.isOffsetFixed&&e.offset===0&&f.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,f.format):"",a=()=>s?kl(e):i({hour:"numeric",hourCycle:"h12"},"dayperiod"),l=(f,y)=>s?Tl(e,f):i(y?{month:f}:{month:f,day:"numeric"},"month"),c=(f,y)=>s?bl(e,f):i(y?{weekday:f}:{weekday:f,month:"long",day:"numeric"},"weekday"),d=f=>{const y=ye.macroTokenToFormatOpts(f);return y?this.formatWithSystemDefault(e,y):f},h=f=>s?Sl(e,f):i({era:f},"era"),u=f=>{switch(f){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return r?i({day:"numeric"},"day"):this.num(e.day);case"dd":return r?i({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return c("short",!0);case"cccc":return c("long",!0);case"ccccc":return c("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return c("short",!1);case"EEEE":return c("long",!1);case"EEEEE":return c("narrow",!1);case"L":return r?i({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return r?i({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return l("short",!0);case"LLLL":return l("long",!0);case"LLLLL":return l("narrow",!0);case"M":return r?i({month:"numeric"},"month"):this.num(e.month);case"MM":return r?i({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return l("short",!1);case"MMMM":return l("long",!1);case"MMMMM":return l("narrow",!1);case"y":return r?i({year:"numeric"},"year"):this.num(e.year);case"yy":return r?i({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return r?i({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return r?i({year:"numeric"},"year"):this.num(e.year,6);case"G":return h("short");case"GG":return h("long");case"GGGGG":return h("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return d(f)}};return jr(ye.parseFormat(t),u)}formatDurationFromString(e,t){const s=this.opts.signMode==="negativeLargestOnly"?-1:1,r=d=>{switch(d[0]){case"S":return"milliseconds";case"s":return"seconds";case"m":return"minutes";case"h":return"hours";case"d":return"days";case"w":return"weeks";case"M":return"months";case"y":return"years";default:return null}},i=(d,h)=>u=>{const f=r(u);if(f){const y=h.isNegativeDuration&&f!==h.largestUnit?s:1;let v;return this.opts.signMode==="negativeLargestOnly"&&f!==h.largestUnit?v="never":this.opts.signMode==="all"?v="always":v="auto",this.num(d.get(f)*y,u.length,v)}else return u},o=ye.parseFormat(t),a=o.reduce((d,{literal:h,val:u})=>h?d:d.concat(u),[]),l=e.shiftTo(...a.map(r).filter(d=>d)),c={isNegativeDuration:l<0,largestUnit:Object.keys(l.values)[0]};return jr(o,i(l,c))}}const uo=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function Pt(...n){const e=n.reduce((t,s)=>t+s.source,"");return RegExp(`^${e}$`)}function Lt(...n){return e=>n.reduce(([t,s,r],i)=>{const[o,a,l]=i(e,r);return[{...t,...o},a||s,l]},[{},null,1]).slice(0,2)}function Vt(n,...e){if(n==null)return[null,null];for(const[t,s]of e){const r=t.exec(n);if(r)return s(r)}return[null,null]}function fo(...n){return(e,t)=>{const s={};let r;for(r=0;r<n.length;r++)s[n[r]]=et(e[t+r]);return[s,null,t+r]}}const ho=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,xl=`(?:${ho.source}?(?:\\[(${uo.source})\\])?)?`,Hs=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,mo=RegExp(`${Hs.source}${xl}`),Gs=RegExp(`(?:[Tt]${mo.source})?`),Nl=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,Dl=/(\d{4})-?W(\d\d)(?:-?(\d))?/,Al=/(\d{4})-?(\d{3})/,Cl=fo("weekYear","weekNumber","weekDay"),Fl=fo("year","ordinal"),$l=/(\d{4})-(\d\d)-(\d\d)/,po=RegExp(`${Hs.source} ?(?:${ho.source}|(${uo.source}))?`),Ml=RegExp(`(?: ${po.source})?`);function Nt(n,e,t){const s=n[e];return H(s)?t:et(s)}function Pl(n,e){return[{year:Nt(n,e),month:Nt(n,e+1,1),day:Nt(n,e+2,1)},null,e+3]}function Ut(n,e){return[{hours:Nt(n,e,0),minutes:Nt(n,e+1,0),seconds:Nt(n,e+2,0),milliseconds:qs(n[e+3])},null,e+4]}function ln(n,e){const t=!n[e]&&!n[e+1],s=Gn(n[e+1],n[e+2]),r=t?null:we.instance(s);return[{},r,e+3]}function cn(n,e){const t=n[e]?Je.create(n[e]):null;return[{},t,e+1]}const Ll=RegExp(`^T?${Hs.source}$`),Vl=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function Ul(n){const[e,t,s,r,i,o,a,l,c]=n,d=e[0]==="-",h=l&&l[0]==="-",u=(f,y=!1)=>f!==void 0&&(y||f&&d)?-f:f;return[{years:u(ct(t)),months:u(ct(s)),weeks:u(ct(r)),days:u(ct(i)),hours:u(ct(o)),minutes:u(ct(a)),seconds:u(ct(l),l==="-0"),milliseconds:u(qs(c),h)}]}const Wl={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Ys(n,e,t,s,r,i,o){const a={year:e.length===2?$s(et(e)):et(e),month:so.indexOf(t)+1,day:et(s),hour:et(r),minute:et(i)};return o&&(a.second=et(o)),n&&(a.weekday=n.length>3?io.indexOf(n)+1:oo.indexOf(n)+1),a}const jl=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function zl(n){const[,e,t,s,r,i,o,a,l,c,d,h]=n,u=Ys(e,r,s,t,i,o,a);let f;return l?f=Wl[l]:c?f=0:f=Gn(d,h),[u,new we(f)]}function Zl(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const ql=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Bl=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Hl=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function zr(n){const[,e,t,s,r,i,o,a]=n;return[Ys(e,r,s,t,i,o,a),we.utcInstance]}function Gl(n){const[,e,t,s,r,i,o,a]=n;return[Ys(e,a,t,s,r,i,o),we.utcInstance]}const Yl=Pt(Nl,Gs),Jl=Pt(Dl,Gs),Ql=Pt(Al,Gs),Kl=Pt(mo),yo=Lt(Pl,Ut,ln,cn),Xl=Lt(Cl,Ut,ln,cn),ec=Lt(Fl,Ut,ln,cn),tc=Lt(Ut,ln,cn);function nc(n){return Vt(n,[Yl,yo],[Jl,Xl],[Ql,ec],[Kl,tc])}function sc(n){return Vt(Zl(n),[jl,zl])}function rc(n){return Vt(n,[ql,zr],[Bl,zr],[Hl,Gl])}function ic(n){return Vt(n,[Vl,Ul])}const oc=Lt(Ut);function ac(n){return Vt(n,[Ll,oc])}const lc=Pt($l,Ml),cc=Pt(po),uc=Lt(Ut,ln,cn);function dc(n){return Vt(n,[lc,yo],[cc,uc])}const Zr="Invalid Duration",go={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},fc={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...go},xe=146097/400,Ot=146097/4800,hc={years:{quarters:4,months:12,weeks:xe/7,days:xe,hours:xe*24,minutes:xe*24*60,seconds:xe*24*60*60,milliseconds:xe*24*60*60*1e3},quarters:{months:3,weeks:xe/28,days:xe/4,hours:xe*24/4,minutes:xe*24*60/4,seconds:xe*24*60*60/4,milliseconds:xe*24*60*60*1e3/4},months:{weeks:Ot/7,days:Ot,hours:Ot*24,minutes:Ot*24*60,seconds:Ot*24*60*60,milliseconds:Ot*24*60*60*1e3},...go},ht=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],mc=ht.slice(0).reverse();function Be(n,e,t=!1){const s={values:t?e.values:{...n.values,...e.values||{}},loc:n.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||n.conversionAccuracy,matrix:e.matrix||n.matrix};return new ne(s)}function wo(n,e){let t=e.milliseconds??0;for(const s of mc.slice(1))e[s]&&(t+=e[s]*n[s].milliseconds);return t}function qr(n,e){const t=wo(n,e)<0?-1:1;ht.reduceRight((s,r)=>{if(H(e[r]))return s;if(s){const i=e[s]*t,o=n[r][s],a=Math.floor(i/o);e[r]+=a*t,e[s]-=a*o*t}return r},null),ht.reduce((s,r)=>{if(H(e[r]))return s;if(s){const i=e[s]%1;e[s]-=i,e[r]+=i*n[s][r]}return r},null)}function Br(n){const e={};for(const[t,s]of Object.entries(n))s!==0&&(e[t]=s);return e}class ne{constructor(e){const t=e.conversionAccuracy==="longterm"||!1;let s=t?hc:fc;e.matrix&&(s=e.matrix),this.values=e.values,this.loc=e.loc||ie.create(),this.conversionAccuracy=t?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=s,this.isLuxonDuration=!0}static fromMillis(e,t){return ne.fromObject({milliseconds:e},t)}static fromObject(e,t={}){if(e==null||typeof e!="object")throw new pe(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new ne({values:Vn(e,ne.normalizeUnit),loc:ie.fromObject(t),conversionAccuracy:t.conversionAccuracy,matrix:t.matrix})}static fromDurationLike(e){if(rt(e))return ne.fromMillis(e);if(ne.isDuration(e))return e;if(typeof e=="object")return ne.fromObject(e);throw new pe(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,t){const[s]=ic(e);return s?ne.fromObject(s,t):ne.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,t){const[s]=ac(e);return s?ne.fromObject(s,t):ne.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,t=null){if(!e)throw new pe("need to specify a reason the Duration is invalid");const s=e instanceof Me?e:new Me(e,t);if(ce.throwOnInvalid)throw new Ua(s);return new ne({invalid:s})}static normalizeUnit(e){const t={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!t)throw new Ti(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){const s={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?ye.create(this.loc,s).formatDurationFromString(this,e):Zr}toHuman(e={}){if(!this.isValid)return Zr;const t=e.showZeros!==!1,s=ht.map(r=>{const i=this.values[r];return H(i)||i===0&&!t?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(i)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(s)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Bs(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},V.fromMillis(t,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?wo(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const t=ne.fromDurationLike(e),s={};for(const r of ht)(Mt(t.values,r)||Mt(this.values,r))&&(s[r]=t.get(r)+this.get(r));return Be(this,{values:s},!0)}minus(e){if(!this.isValid)return this;const t=ne.fromDurationLike(e);return this.plus(t.negate())}mapUnits(e){if(!this.isValid)return this;const t={};for(const s of Object.keys(this.values))t[s]=no(e(this.values[s],s));return Be(this,{values:t},!0)}get(e){return this[ne.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const t={...this.values,...Vn(e,ne.normalizeUnit)};return Be(this,{values:t})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:s,matrix:r}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:s};return Be(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return qr(this.matrix,e),Be(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=Br(this.normalize().shiftToAll().toObject());return Be(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>ne.normalizeUnit(o));const t={},s={},r=this.toObject();let i;for(const o of ht)if(e.indexOf(o)>=0){i=o;let a=0;for(const c in s)a+=this.matrix[c][o]*s[c],s[c]=0;rt(r[o])&&(a+=r[o]);const l=Math.trunc(a);t[o]=l,s[o]=(a*1e3-l*1e3)/1e3}else rt(r[o])&&(s[o]=r[o]);for(const o in s)s[o]!==0&&(t[i]+=o===i?s[o]:s[o]/this.matrix[i][o]);return qr(this.matrix,t),Be(this,{values:t},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Be(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;const e=Br(this.values);return Be(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(s,r){return s===void 0||s===0?r===void 0||r===0:s===r}for(const s of ht)if(!t(this.values[s],e.values[s]))return!1;return!0}}const kt="Invalid Interval";function pc(n,e){return!n||!n.isValid?le.invalid("missing or invalid start"):!e||!e.isValid?le.invalid("missing or invalid end"):e<n?le.invalid("end before start",`The end of an interval must be after its start, but you had start=${n.toISO()} and end=${e.toISO()}`):null}class le{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(e,t=null){if(!e)throw new pe("need to specify a reason the Interval is invalid");const s=e instanceof Me?e:new Me(e,t);if(ce.throwOnInvalid)throw new Va(s);return new le({invalid:s})}static fromDateTimes(e,t){const s=Zt(e),r=Zt(t),i=pc(s,r);return i??new le({start:s,end:r})}static after(e,t){const s=ne.fromDurationLike(t),r=Zt(e);return le.fromDateTimes(r,r.plus(s))}static before(e,t){const s=ne.fromDurationLike(t),r=Zt(e);return le.fromDateTimes(r.minus(s),r)}static fromISO(e,t){const[s,r]=(e||"").split("/",2);if(s&&r){let i,o;try{i=V.fromISO(s,t),o=i.isValid}catch{o=!1}let a,l;try{a=V.fromISO(r,t),l=a.isValid}catch{l=!1}if(o&&l)return le.fromDateTimes(i,a);if(o){const c=ne.fromISO(r,t);if(c.isValid)return le.after(i,c)}else if(l){const c=ne.fromISO(s,t);if(c.isValid)return le.before(a,c)}}return le.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e="milliseconds"){return this.isValid?this.toDuration(e).get(e):NaN}count(e="milliseconds",t){if(!this.isValid)return NaN;const s=this.start.startOf(e,t);let r;return t?.useLocaleWeeks?r=this.end.reconfigure({locale:s.locale}):r=this.end,r=r.startOf(e,t),Math.floor(r.diff(s,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:t}={}){return this.isValid?le.fromDateTimes(e||this.s,t||this.e):this}splitAt(...e){if(!this.isValid)return[];const t=e.map(Zt).filter(o=>this.contains(o)).sort((o,a)=>o.toMillis()-a.toMillis()),s=[];let{s:r}=this,i=0;for(;r<this.e;){const o=t[i]||this.e,a=+o>+this.e?this.e:o;s.push(le.fromDateTimes(r,a)),r=a,i+=1}return s}splitBy(e){const t=ne.fromDurationLike(e);if(!this.isValid||!t.isValid||t.as("milliseconds")===0)return[];let{s}=this,r=1,i;const o=[];for(;s<this.e;){const a=this.start.plus(t.mapUnits(l=>l*r));i=+a>+this.e?this.e:a,o.push(le.fromDateTimes(s,i)),s=i,r+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const t=this.s>e.s?this.s:e.s,s=this.e<e.e?this.e:e.e;return t>=s?null:le.fromDateTimes(t,s)}union(e){if(!this.isValid)return this;const t=this.s<e.s?this.s:e.s,s=this.e>e.e?this.e:e.e;return le.fromDateTimes(t,s)}static merge(e){const[t,s]=e.sort((r,i)=>r.s-i.s).reduce(([r,i],o)=>i?i.overlaps(o)||i.abutsStart(o)?[r,i.union(o)]:[r.concat([i]),o]:[r,o],[[],null]);return s&&t.push(s),t}static xor(e){let t=null,s=0;const r=[],i=e.map(l=>[{time:l.s,type:"s"},{time:l.e,type:"e"}]),o=Array.prototype.concat(...i),a=o.sort((l,c)=>l.time-c.time);for(const l of a)s+=l.type==="s"?1:-1,s===1?t=l.time:(t&&+t!=+l.time&&r.push(le.fromDateTimes(t,l.time)),t=null);return le.merge(r)}difference(...e){return le.xor([this].concat(e)).map(t=>this.intersection(t)).filter(t=>t&&!t.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:kt}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Mn,t={}){return this.isValid?ye.create(this.s.loc.clone(t),e).formatInterval(this):kt}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:kt}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:kt}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:kt}toFormat(e,{separator:t=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:kt}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):ne.invalid(this.invalidReason)}mapEndpoints(e){return le.fromDateTimes(e(this.s),e(this.e))}}class hn{static hasDST(e=ce.defaultZone){const t=V.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return Je.isValidZone(e)}static normalizeZone(e){return tt(e,ce.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||ie.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||ie.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||ie.create(e)).getWeekendDays().slice()}static months(e="long",{locale:t=null,numberingSystem:s=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||ie.create(t,s,i)).months(e)}static monthsFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:r=null,outputCalendar:i="gregory"}={}){return(r||ie.create(t,s,i)).months(e,!0)}static weekdays(e="long",{locale:t=null,numberingSystem:s=null,locObj:r=null}={}){return(r||ie.create(t,s,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:t=null,numberingSystem:s=null,locObj:r=null}={}){return(r||ie.create(t,s,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return ie.create(e).meridiems()}static eras(e="short",{locale:t=null}={}){return ie.create(t,null,"gregory").eras(e)}static features(){return{relative:Xi(),localeWeek:eo()}}}function Hr(n,e){const t=r=>r.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),s=t(e)-t(n);return Math.floor(ne.fromMillis(s).as("days"))}function yc(n,e,t){const s=[["years",(l,c)=>c.year-l.year],["quarters",(l,c)=>c.quarter-l.quarter+(c.year-l.year)*4],["months",(l,c)=>c.month-l.month+(c.year-l.year)*12],["weeks",(l,c)=>{const d=Hr(l,c);return(d-d%7)/7}],["days",Hr]],r={},i=n;let o,a;for(const[l,c]of s)t.indexOf(l)>=0&&(o=l,r[l]=c(n,e),a=i.plus(r),a>e?(r[l]--,n=i.plus(r),n>e&&(a=n,r[l]--,n=i.plus(r))):n=a);return[n,r,a,o]}function gc(n,e,t,s){let[r,i,o,a]=yc(n,e,t);const l=e-r,c=t.filter(h=>["hours","minutes","seconds","milliseconds"].indexOf(h)>=0);c.length===0&&(o<e&&(o=r.plus({[a]:1})),o!==r&&(i[a]=(i[a]||0)+l/(o-r)));const d=ne.fromObject(i,s);return c.length>0?ne.fromMillis(l,s).shiftTo(...c).plus(d):d}const wc="missing Intl.DateTimeFormat.formatToParts support";function re(n,e=t=>t){return{regex:n,deser:([t])=>e(ll(t))}}const _c=" ",_o=`[ ${_c}]`,Eo=new RegExp(_o,"g");function Ec(n){return n.replace(/\./g,"\\.?").replace(Eo,_o)}function Gr(n){return n.replace(/\./g,"").replace(Eo," ").toLowerCase()}function $e(n,e){return n===null?null:{regex:RegExp(n.map(Ec).join("|")),deser:([t])=>n.findIndex(s=>Gr(t)===Gr(s))+e}}function Yr(n,e){return{regex:n,deser:([,t,s])=>Gn(t,s),groups:e}}function mn(n){return{regex:n,deser:([e])=>e}}function vc(n){return n.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Oc(n,e){const t=Fe(e),s=Fe(e,"{2}"),r=Fe(e,"{3}"),i=Fe(e,"{4}"),o=Fe(e,"{6}"),a=Fe(e,"{1,2}"),l=Fe(e,"{1,3}"),c=Fe(e,"{1,6}"),d=Fe(e,"{1,9}"),h=Fe(e,"{2,4}"),u=Fe(e,"{4,6}"),f=p=>({regex:RegExp(vc(p.val)),deser:([g])=>g,literal:!0}),v=(p=>{if(n.literal)return f(p);switch(p.val){case"G":return $e(e.eras("short"),0);case"GG":return $e(e.eras("long"),0);case"y":return re(c);case"yy":return re(h,$s);case"yyyy":return re(i);case"yyyyy":return re(u);case"yyyyyy":return re(o);case"M":return re(a);case"MM":return re(s);case"MMM":return $e(e.months("short",!0),1);case"MMMM":return $e(e.months("long",!0),1);case"L":return re(a);case"LL":return re(s);case"LLL":return $e(e.months("short",!1),1);case"LLLL":return $e(e.months("long",!1),1);case"d":return re(a);case"dd":return re(s);case"o":return re(l);case"ooo":return re(r);case"HH":return re(s);case"H":return re(a);case"hh":return re(s);case"h":return re(a);case"mm":return re(s);case"m":return re(a);case"q":return re(a);case"qq":return re(s);case"s":return re(a);case"ss":return re(s);case"S":return re(l);case"SSS":return re(r);case"u":return mn(d);case"uu":return mn(a);case"uuu":return re(t);case"a":return $e(e.meridiems(),0);case"kkkk":return re(i);case"kk":return re(h,$s);case"W":return re(a);case"WW":return re(s);case"E":case"c":return re(t);case"EEE":return $e(e.weekdays("short",!1),1);case"EEEE":return $e(e.weekdays("long",!1),1);case"ccc":return $e(e.weekdays("short",!0),1);case"cccc":return $e(e.weekdays("long",!0),1);case"Z":case"ZZ":return Yr(new RegExp(`([+-]${a.source})(?::(${s.source}))?`),2);case"ZZZ":return Yr(new RegExp(`([+-]${a.source})(${s.source})?`),2);case"z":return mn(/[a-z_+-/]{1,256}?/i);case" ":return mn(/[^\S\n\r]/);default:return f(p)}})(n)||{invalidReason:wc};return v.token=n,v}const kc={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function bc(n,e,t){const{type:s,value:r}=n;if(s==="literal"){const l=/^\s+$/.test(r);return{literal:!l,val:l?" ":r}}const i=e[s];let o=s;s==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=t.hour12?"hour12":"hour24");let a=kc[o];if(typeof a=="object"&&(a=a[i]),a)return{literal:!1,val:a}}function Tc(n){return[`^${n.map(t=>t.regex).reduce((t,s)=>`${t}(${s.source})`,"")}$`,n]}function Sc(n,e,t){const s=n.match(e);if(s){const r={};let i=1;for(const o in t)if(Mt(t,o)){const a=t[o],l=a.groups?a.groups+1:1;!a.literal&&a.token&&(r[a.token.val[0]]=a.deser(s.slice(i,i+l))),i+=l}return[s,r]}else return[s,{}]}function Rc(n){const e=i=>{switch(i){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let t=null,s;return H(n.z)||(t=Je.create(n.z)),H(n.Z)||(t||(t=new we(n.Z)),s=n.Z),H(n.q)||(n.M=(n.q-1)*3+1),H(n.h)||(n.h<12&&n.a===1?n.h+=12:n.h===12&&n.a===0&&(n.h=0)),n.G===0&&n.y&&(n.y=-n.y),H(n.u)||(n.S=qs(n.u)),[Object.keys(n).reduce((i,o)=>{const a=e(o);return a&&(i[a]=n[o]),i},{}),t,s]}let as=null;function Ic(){return as||(as=V.fromMillis(1555555555555)),as}function xc(n,e){if(n.literal)return n;const t=ye.macroTokenToFormatOpts(n.val),s=bo(t,e);return s==null||s.includes(void 0)?n:s}function vo(n,e){return Array.prototype.concat(...n.map(t=>xc(t,e)))}class Oo{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=vo(ye.parseFormat(t),e),this.units=this.tokens.map(s=>Oc(s,e)),this.disqualifyingUnit=this.units.find(s=>s.invalidReason),!this.disqualifyingUnit){const[s,r]=Tc(this.units);this.regex=RegExp(s,"i"),this.handlers=r}}explainFromTokens(e){if(this.isValid){const[t,s]=Sc(e,this.regex,this.handlers),[r,i,o]=s?Rc(s):[null,null,void 0];if(Mt(s,"a")&&Mt(s,"H"))throw new St("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:s,result:r,zone:i,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}}function ko(n,e,t){return new Oo(n,t).explainFromTokens(e)}function Nc(n,e,t){const{result:s,zone:r,specificOffset:i,invalidReason:o}=ko(n,e,t);return[s,r,i,o]}function bo(n,e){if(!n)return null;const s=ye.create(e,n).dtFormatter(Ic()),r=s.formatToParts(),i=s.resolvedOptions();return r.map(o=>bc(o,n,i))}const ls="Invalid DateTime",Jr=864e13;function Gt(n){return new Me("unsupported zone",`the zone "${n.name}" is not supported`)}function cs(n){return n.weekData===null&&(n.weekData=Pn(n.c)),n.weekData}function us(n){return n.localWeekData===null&&(n.localWeekData=Pn(n.c,n.loc.getMinDaysInFirstWeek(),n.loc.getStartOfWeek())),n.localWeekData}function ut(n,e){const t={ts:n.ts,zone:n.zone,c:n.c,o:n.o,loc:n.loc,invalid:n.invalid};return new V({...t,...e,old:t})}function To(n,e,t){let s=n-e*60*1e3;const r=t.offset(s);if(e===r)return[s,e];s-=(r-e)*60*1e3;const i=t.offset(s);return r===i?[s,r]:[n-Math.min(r,i)*60*1e3,Math.max(r,i)]}function pn(n,e){n+=e*60*1e3;const t=new Date(n);return{year:t.getUTCFullYear(),month:t.getUTCMonth()+1,day:t.getUTCDate(),hour:t.getUTCHours(),minute:t.getUTCMinutes(),second:t.getUTCSeconds(),millisecond:t.getUTCMilliseconds()}}function _n(n,e,t){return To(Hn(n),e,t)}function Qr(n,e){const t=n.o,s=n.c.year+Math.trunc(e.years),r=n.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,i={...n.c,year:s,month:r,day:Math.min(n.c.day,Ln(s,r))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=ne.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=Hn(i);let[l,c]=To(a,t,n.zone);return o!==0&&(l+=o,c=n.zone.offset(l)),{ts:l,o:c}}function bt(n,e,t,s,r,i){const{setZone:o,zone:a}=t;if(n&&Object.keys(n).length!==0||e){const l=e||a,c=V.fromObject(n,{...t,zone:l,specificOffset:i});return o?c:c.setZone(a)}else return V.invalid(new Me("unparsable",`the input "${r}" can't be parsed as ${s}`))}function yn(n,e,t=!0){return n.isValid?ye.create(ie.create("en-US"),{allowZ:t,forceSimple:!0}).formatDateTimeFromString(n,e):null}function ds(n,e,t){const s=n.c.year>9999||n.c.year<0;let r="";if(s&&n.c.year>=0&&(r+="+"),r+=de(n.c.year,s?6:4),t==="year")return r;if(e){if(r+="-",r+=de(n.c.month),t==="month")return r;r+="-"}else if(r+=de(n.c.month),t==="month")return r;return r+=de(n.c.day),r}function Kr(n,e,t,s,r,i,o){let a=!t||n.c.millisecond!==0||n.c.second!==0,l="";switch(o){case"day":case"month":case"year":break;default:if(l+=de(n.c.hour),o==="hour")break;if(e){if(l+=":",l+=de(n.c.minute),o==="minute")break;a&&(l+=":",l+=de(n.c.second))}else{if(l+=de(n.c.minute),o==="minute")break;a&&(l+=de(n.c.second))}if(o==="second")break;a&&(!s||n.c.millisecond!==0)&&(l+=".",l+=de(n.c.millisecond,3))}return r&&(n.isOffsetFixed&&n.offset===0&&!i?l+="Z":n.o<0?(l+="-",l+=de(Math.trunc(-n.o/60)),l+=":",l+=de(Math.trunc(-n.o%60))):(l+="+",l+=de(Math.trunc(n.o/60)),l+=":",l+=de(Math.trunc(n.o%60)))),i&&(l+="["+n.zone.ianaName+"]"),l}const So={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},Dc={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},Ac={ordinal:1,hour:0,minute:0,second:0,millisecond:0},En=["year","month","day","hour","minute","second","millisecond"],Cc=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],Fc=["year","ordinal","hour","minute","second","millisecond"];function vn(n){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[n.toLowerCase()];if(!e)throw new Ti(n);return e}function Xr(n){switch(n.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return vn(n)}}function $c(n){if(Yt===void 0&&(Yt=ce.now()),n.type!=="iana")return n.offset(Yt);const e=n.name;let t=Ms.get(e);return t===void 0&&(t=n.offset(Yt),Ms.set(e,t)),t}function ei(n,e){const t=tt(e.zone,ce.defaultZone);if(!t.isValid)return V.invalid(Gt(t));const s=ie.fromObject(e);let r,i;if(H(n.year))r=ce.now();else{for(const l of En)H(n[l])&&(n[l]=So[l]);const o=Qi(n)||Ki(n);if(o)return V.invalid(o);const a=$c(t);[r,i]=_n(n,a,t)}return new V({ts:r,zone:t,loc:s,o:i})}function ti(n,e,t){const s=H(t.round)?!0:t.round,r=H(t.rounding)?"trunc":t.rounding,i=(a,l)=>(a=Bs(a,s||t.calendary?0:2,t.calendary?"round":r),e.loc.clone(t).relFormatter(t).format(a,l)),o=a=>t.calendary?e.hasSame(n,a)?0:e.startOf(a).diff(n.startOf(a),a).get(a):e.diff(n,a).get(a);if(t.unit)return i(o(t.unit),t.unit);for(const a of t.units){const l=o(a);if(Math.abs(l)>=1)return i(l,a)}return i(n>e?-0:0,t.units[t.units.length-1])}function ni(n){let e={},t;return n.length>0&&typeof n[n.length-1]=="object"?(e=n[n.length-1],t=Array.from(n).slice(0,n.length-1)):t=Array.from(n),[e,t]}let Yt;const Ms=new Map;class V{constructor(e){const t=e.zone||ce.defaultZone;let s=e.invalid||(Number.isNaN(e.ts)?new Me("invalid input"):null)||(t.isValid?null:Gt(t));this.ts=H(e.ts)?ce.now():e.ts;let r=null,i=null;if(!s)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{const a=rt(e.o)&&!e.old?e.o:t.offset(this.ts);r=pn(this.ts,a),s=Number.isNaN(r.year)?new Me("invalid input"):null,r=s?null:r,i=s?null:a}this._zone=t,this.loc=e.loc||ie.create(),this.invalid=s,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new V({})}static local(){const[e,t]=ni(arguments),[s,r,i,o,a,l,c]=t;return ei({year:s,month:r,day:i,hour:o,minute:a,second:l,millisecond:c},e)}static utc(){const[e,t]=ni(arguments),[s,r,i,o,a,l,c]=t;return e.zone=we.utcInstance,ei({year:s,month:r,day:i,hour:o,minute:a,second:l,millisecond:c},e)}static fromJSDate(e,t={}){const s=hl(e)?e.valueOf():NaN;if(Number.isNaN(s))return V.invalid("invalid input");const r=tt(t.zone,ce.defaultZone);return r.isValid?new V({ts:s,zone:r,loc:ie.fromObject(t)}):V.invalid(Gt(r))}static fromMillis(e,t={}){if(rt(e))return e<-Jr||e>Jr?V.invalid("Timestamp out of range"):new V({ts:e,zone:tt(t.zone,ce.defaultZone),loc:ie.fromObject(t)});throw new pe(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,t={}){if(rt(e))return new V({ts:e*1e3,zone:tt(t.zone,ce.defaultZone),loc:ie.fromObject(t)});throw new pe("fromSeconds requires a numerical input")}static fromObject(e,t={}){e=e||{};const s=tt(t.zone,ce.defaultZone);if(!s.isValid)return V.invalid(Gt(s));const r=ie.fromObject(t),i=Vn(e,Xr),{minDaysInFirstWeek:o,startOfWeek:a}=Vr(i,r),l=ce.now(),c=H(t.specificOffset)?s.offset(l):t.specificOffset,d=!H(i.ordinal),h=!H(i.year),u=!H(i.month)||!H(i.day),f=h||u,y=i.weekYear||i.weekNumber;if((f||d)&&y)throw new St("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(u&&d)throw new St("Can't mix ordinal dates with month/day");const v=y||i.weekday&&!f;let p,g,I=pn(l,c);v?(p=Cc,g=Dc,I=Pn(I,o,a)):d?(p=Fc,g=Ac,I=os(I)):(p=En,g=So);let k=!1;for(const m of p){const L=i[m];H(L)?k?i[m]=g[m]:i[m]=I[m]:k=!0}const x=v?ul(i,o,a):d?dl(i):Qi(i),E=x||Ki(i);if(E)return V.invalid(E);const F=v?Pr(i,o,a):d?Lr(i):i,[_,Z]=_n(F,c,s),b=new V({ts:_,zone:s,o:Z,loc:r});return i.weekday&&f&&e.weekday!==b.weekday?V.invalid("mismatched weekday",`you can't specify both a weekday of ${i.weekday} and a date of ${b.toISO()}`):b.isValid?b:V.invalid(b.invalid)}static fromISO(e,t={}){const[s,r]=nc(e);return bt(s,r,t,"ISO 8601",e)}static fromRFC2822(e,t={}){const[s,r]=sc(e);return bt(s,r,t,"RFC 2822",e)}static fromHTTP(e,t={}){const[s,r]=rc(e);return bt(s,r,t,"HTTP",t)}static fromFormat(e,t,s={}){if(H(e)||H(t))throw new pe("fromFormat requires an input string and a format");const{locale:r=null,numberingSystem:i=null}=s,o=ie.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),[a,l,c,d]=Nc(o,e,t);return d?V.invalid(d):bt(a,l,s,`format ${t}`,e,c)}static fromString(e,t,s={}){return V.fromFormat(e,t,s)}static fromSQL(e,t={}){const[s,r]=dc(e);return bt(s,r,t,"SQL",e)}static invalid(e,t=null){if(!e)throw new pe("need to specify a reason the DateTime is invalid");const s=e instanceof Me?e:new Me(e,t);if(ce.throwOnInvalid)throw new La(s);return new V({invalid:s})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){const s=bo(e,ie.fromObject(t));return s?s.map(r=>r?r.val:null).join(""):null}static expandFormat(e,t={}){return vo(ye.parseFormat(e),ie.fromObject(t)).map(r=>r.val).join("")}static resetCache(){Yt=void 0,Ms.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?cs(this).weekYear:NaN}get weekNumber(){return this.isValid?cs(this).weekNumber:NaN}get weekday(){return this.isValid?cs(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?us(this).weekday:NaN}get localWeekNumber(){return this.isValid?us(this).weekNumber:NaN}get localWeekYear(){return this.isValid?us(this).weekYear:NaN}get ordinal(){return this.isValid?os(this.c).ordinal:NaN}get monthShort(){return this.isValid?hn.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?hn.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?hn.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?hn.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,t=6e4,s=Hn(this.c),r=this.zone.offset(s-e),i=this.zone.offset(s+e),o=this.zone.offset(s-r*t),a=this.zone.offset(s-i*t);if(o===a)return[this];const l=s-o*t,c=s-a*t,d=pn(l,o),h=pn(c,a);return d.hour===h.hour&&d.minute===h.minute&&d.second===h.second&&d.millisecond===h.millisecond?[ut(this,{ts:l}),ut(this,{ts:c})]:[this]}get isInLeapYear(){return an(this.year)}get daysInMonth(){return Ln(this.year,this.month)}get daysInYear(){return this.isValid?xt(this.year):NaN}get weeksInWeekYear(){return this.isValid?nn(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?nn(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:t,numberingSystem:s,calendar:r}=ye.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:s,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(we.instance(e),t)}toLocal(){return this.setZone(ce.defaultZone)}setZone(e,{keepLocalTime:t=!1,keepCalendarTime:s=!1}={}){if(e=tt(e,ce.defaultZone),e.equals(this.zone))return this;if(e.isValid){let r=this.ts;if(t||s){const i=e.offset(this.ts),o=this.toObject();[r]=_n(o,i,e)}return ut(this,{ts:r,zone:e})}else return V.invalid(Gt(e))}reconfigure({locale:e,numberingSystem:t,outputCalendar:s}={}){const r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:s});return ut(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const t=Vn(e,Xr),{minDaysInFirstWeek:s,startOfWeek:r}=Vr(t,this.loc),i=!H(t.weekYear)||!H(t.weekNumber)||!H(t.weekday),o=!H(t.ordinal),a=!H(t.year),l=!H(t.month)||!H(t.day),c=a||l,d=t.weekYear||t.weekNumber;if((c||o)&&d)throw new St("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(l&&o)throw new St("Can't mix ordinal dates with month/day");let h;i?h=Pr({...Pn(this.c,s,r),...t},s,r):H(t.ordinal)?(h={...this.toObject(),...t},H(t.day)&&(h.day=Math.min(Ln(h.year,h.month),h.day))):h=Lr({...os(this.c),...t});const[u,f]=_n(h,this.o,this.zone);return ut(this,{ts:u,o:f})}plus(e){if(!this.isValid)return this;const t=ne.fromDurationLike(e);return ut(this,Qr(this,t))}minus(e){if(!this.isValid)return this;const t=ne.fromDurationLike(e).negate();return ut(this,Qr(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;const s={},r=ne.normalizeUnit(e);switch(r){case"years":s.month=1;case"quarters":case"months":s.day=1;case"weeks":case"days":s.hour=0;case"hours":s.minute=0;case"minutes":s.second=0;case"seconds":s.millisecond=0;break}if(r==="weeks")if(t){const i=this.loc.getStartOfWeek(),{weekday:o}=this;o<i&&(s.weekNumber=this.weekNumber-1),s.weekday=i}else s.weekday=1;if(r==="quarters"){const i=Math.ceil(this.month/3);s.month=(i-1)*3+1}return this.set(s)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?ye.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):ls}toLocaleString(e=Mn,t={}){return this.isValid?ye.create(this.loc.clone(t),e).formatDateTime(this):ls}toLocaleParts(e={}){return this.isValid?ye.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e="extended",suppressSeconds:t=!1,suppressMilliseconds:s=!1,includeOffset:r=!0,extendedZone:i=!1,precision:o="milliseconds"}={}){if(!this.isValid)return null;o=vn(o);const a=e==="extended";let l=ds(this,a,o);return En.indexOf(o)>=3&&(l+="T"),l+=Kr(this,a,t,s,r,i,o),l}toISODate({format:e="extended",precision:t="day"}={}){return this.isValid?ds(this,e==="extended",vn(t)):null}toISOWeekDate(){return yn(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:s=!0,includePrefix:r=!1,extendedZone:i=!1,format:o="extended",precision:a="milliseconds"}={}){return this.isValid?(a=vn(a),(r&&En.indexOf(a)>=3?"T":"")+Kr(this,o==="extended",t,e,s,i,a)):null}toRFC2822(){return yn(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return yn(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?ds(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:s=!0}={}){let r="HH:mm:ss.SSS";return(t||e)&&(s&&(r+=" "),t?r+="z":e&&(r+="ZZ")),yn(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():ls}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};const t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t="milliseconds",s={}){if(!this.isValid||!e.isValid)return ne.invalid("created by diffing an invalid DateTime");const r={locale:this.locale,numberingSystem:this.numberingSystem,...s},i=ml(t).map(ne.normalizeUnit),o=e.valueOf()>this.valueOf(),a=o?this:e,l=o?e:this,c=gc(a,l,i,r);return o?c.negate():c}diffNow(e="milliseconds",t={}){return this.diff(V.now(),e,t)}until(e){return this.isValid?le.fromDateTimes(this,e):this}hasSame(e,t,s){if(!this.isValid)return!1;const r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,s)<=r&&r<=i.endOf(t,s)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const t=e.base||V.fromObject({},{zone:this.zone}),s=e.padding?this<t?-e.padding:e.padding:0;let r=["years","months","days","hours","minutes","seconds"],i=e.unit;return Array.isArray(e.unit)&&(r=e.unit,i=void 0),ti(t,this.plus(s),{...e,numeric:"always",units:r,unit:i})}toRelativeCalendar(e={}){return this.isValid?ti(e.base||V.fromObject({},{zone:this.zone}),this,{...e,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...e){if(!e.every(V.isDateTime))throw new pe("min requires all arguments be DateTimes");return Ur(e,t=>t.valueOf(),Math.min)}static max(...e){if(!e.every(V.isDateTime))throw new pe("max requires all arguments be DateTimes");return Ur(e,t=>t.valueOf(),Math.max)}static fromFormatExplain(e,t,s={}){const{locale:r=null,numberingSystem:i=null}=s,o=ie.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});return ko(o,e,t)}static fromStringExplain(e,t,s={}){return V.fromFormatExplain(e,t,s)}static buildFormatParser(e,t={}){const{locale:s=null,numberingSystem:r=null}=t,i=ie.fromOpts({locale:s,numberingSystem:r,defaultToEN:!0});return new Oo(i,e)}static fromFormatParser(e,t,s={}){if(H(e)||H(t))throw new pe("fromFormatParser requires an input string and a format parser");const{locale:r=null,numberingSystem:i=null}=s,o=ie.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0});if(!o.equals(t.locale))throw new pe(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${t.locale}`);const{result:a,zone:l,specificOffset:c,invalidReason:d}=t.explainFromTokens(e);return d?V.invalid(d):bt(a,l,s,`format ${t.format}`,e,c)}static get DATE_SHORT(){return Mn}static get DATE_MED(){return Si}static get DATE_MED_WITH_WEEKDAY(){return Wa}static get DATE_FULL(){return Ri}static get DATE_HUGE(){return Ii}static get TIME_SIMPLE(){return xi}static get TIME_WITH_SECONDS(){return Ni}static get TIME_WITH_SHORT_OFFSET(){return Di}static get TIME_WITH_LONG_OFFSET(){return Ai}static get TIME_24_SIMPLE(){return Ci}static get TIME_24_WITH_SECONDS(){return Fi}static get TIME_24_WITH_SHORT_OFFSET(){return $i}static get TIME_24_WITH_LONG_OFFSET(){return Mi}static get DATETIME_SHORT(){return Pi}static get DATETIME_SHORT_WITH_SECONDS(){return Li}static get DATETIME_MED(){return Vi}static get DATETIME_MED_WITH_SECONDS(){return Ui}static get DATETIME_MED_WITH_WEEKDAY(){return ja}static get DATETIME_FULL(){return Wi}static get DATETIME_FULL_WITH_SECONDS(){return ji}static get DATETIME_HUGE(){return zi}static get DATETIME_HUGE_WITH_SECONDS(){return Zi}}function Zt(n){if(V.isDateTime(n))return n;if(n&&n.valueOf&&rt(n.valueOf()))return V.fromJSDate(n);if(n&&typeof n=="object")return V.fromObject(n);throw new pe(`Unknown datetime argument: ${n}, of type ${typeof n}`)}const Mc=(n,e)=>{const t={};if(n.includeFields){const s=e.collections[n.collection];if(!s)return rn(me());n.includeFields.forEach(r=>{const i=s.fields.find(o=>o.name===r);i?t[r]=Ro(i)?.nullable():t[r]=me()})}return We({Collection_Path:_t(be()),...t})},Pc=(n,e,t,s)=>{let r=We({}).catchall(Mc(n,e)),i;if(!s&&t){const o=Ae(n,t);i=qt(o.admin?.skipFormRequiredValidation)}return(!n.required||i)&&(r=r.optional()),r},Lc=()=>me().refine(n=>n===null||n&&(n.seconds!==void 0&&n.nanoseconds!==void 0||n._seconds!==void 0&&n._nanoseconds!==void 0),{message:"Must be a valid date"}),Ro=(n,e,t)=>{let s;const r=`${qt(n.description)}
|
|
2
2
|
|
|
3
3
|
`||"";let i,o,a;if(!t&&e){const l=Ae(n,e);i=l.admin?.condition?.form!==void 0&&!qt(l.admin.condition.form),o=qt(l.admin?.skipFormRequiredValidation),a=qt(l.admin?.image)}switch(n.type){case"String":s=be(),n.length&&(s=s.length(n.length,`Must be ${n.length} character(s) long`)),n.minlength&&(s=s.min(n.minlength,`Must contain at least ${n.minlength} character(s)`)),n.maxlength&&(s=s.max(n.maxlength,`Must contain at most ${n.maxlength} character(s)`)),n.email?s=s.email("Must be a valid email address"):n.uuid?s=ve([s.uuid("Must be a valid UUID"),Oe("")]):n.url?s=ve([s.url("Must be a valid URL"),Oe("")]):n.emoji?s=ve([s.emoji("Must be a valid emoji"),Oe("")]):n.ip?s=ve([s.ip("Must be a valid IP address"),Oe("")]):n.pattern&&(!t&&a?s=ve([s.regex(new RegExp(n.pattern)),s.regex(/^blob:/)],{message:"Must be a valid value"}):s=s.regex(new RegExp(n.pattern),"Must be a valid value")),n.values&&(s=ve([Fn(n.values,{message:`Must be one of the following values: ${n.values.join(", ")}`}),ns()])),r&&(s=s.describe(r.trim()));break;case"Boolean":s=Kt(),r&&(s=s.describe(r.trim()));break;case"Number":n.autoIncrement?s=ve([ns(),ft().int()],{message:"Must be a valid number"}):(s=ft({message:"Must be a valid number"}),n.min&&(s=s.min(n.min,`Must be greater than or equal to ${n.min}`)),n.max&&(s=s.max(n.max,`Must be less than or equal to ${n.max}`)),n.decimal?t?s=s.describe(`${r}Must have ${n.decimal} decimal places`):s=s.refine(l=>n.decimal?(l.toString().split(".")[1]?.length||0)<=n.decimal:!1,{message:`Must have ${n.decimal} or fewer decimal places`}):s=s.int("Must not have decimal places"),n.values?(t||(s=ve([s.refine(l=>n.values?.includes(l),{message:`Must be one of the following values: ${n.values.join(", ")}`}),ns()])),s=s.describe(`${r}Must be one of the following values: ${n.values.join(", ")}`)):r&&(s=s.describe(r.trim())));break;case"Timestamp":t?(s=We({seconds:ft(),nanoseconds:ft()}),n.min&&n.max?s=s.describe(`${r}Must be between ${V.fromMillis(n.min).toLocaleString(V.DATE_MED)} and ${V.fromMillis(n.max).toLocaleString(V.DATE_MED)}`):n.min?s=s.describe(`${r}Must be greater than or equal to ${V.fromMillis(n.min).toLocaleString(V.DATE_MED)}`):n.max?s=s.describe(`${r}Must be less than or equal to ${V.fromMillis(n.max).toLocaleString(V.DATE_MED)}`):r&&(s=s.describe(r.trim()))):(s=Lc(),n.min&&(s=s.refine(l=>l.toMillis()>=n.min,{message:`Must be greater than or equal to ${V.fromMillis(n.min).toLocaleString(V.DATE_MED)}`})),n.max&&(s=s.refine(l=>l.toMillis()<=n.max,{message:`Must be less than or equal to ${V.fromMillis(n.max).toLocaleString(V.DATE_MED)}`})));break;case"Array":s=_t(me()),n.length&&(s=s.length(n.length,`Must contain ${n.length} item(s)`)),n.minlength?s=s.min(n.minlength,`Must contain at least ${n.minlength} item(s)`):n.required&&!i&&(s=s.nonempty("Must contain at least one item")),n.maxlength&&(s=s.max(n.maxlength,`Must contain at most ${n.maxlength} item(s)`)),n.values?(t||(s=s.refine(l=>{let c=!0;return l.forEach(d=>{n.values&&!n.values.includes(d)&&(c=!1)}),c},{message:`Must only contain the following values: ${n.values.join(", ")}`})),s=s.describe(`${r}Must only contain the following values: ${n.values.join(", ")}`)):r&&(s=s.describe(r.trim())),n.nullable&&(s=s.nullable());break;case"Map":n.required&&!i?t?s=We({}).catchall(me()).describe(`${r}Must be an object. Must contain at least one object property.`):s=rn(me()).refine(l=>l&&typeof l=="object"&&Object.keys(l).length>0,{message:"Must not be an empty value"}):s=We({}).catchall(me()).describe(`${r}Must be an object`);break;case"Computed":s=me()}return(!n.required||i||o)&&(s=s.optional()),s},Vc=(n,e,t,s,r)=>{const{auth:i,softDelete:o}=n,a={};n.fields.forEach(c=>{c.type==="Embedding"||s&&c.type==="Computed"||s&&(c.name===o?.archivedField||c.name===o?.timestampField)||(ee(c)?(a[c.name]=Pc(c,e,t,s),s?(c.length&&(a[c.name]=a[c.name].describe(`Must contain ${c.length} item(s)`)),c.min&&(a[c.name]=a[c.name].describe(`Must contain at least ${c.min} item(s)`)),c.max&&(a[c.name]=a[c.name].describe(`Must contain at most ${c.max} item(s)`))):(c.length&&(a[c.name]=a[c.name].refine(d=>c.length&&d&&Object.keys(d).length===c.length,{message:`Must contain ${c.length} item(s)`})),c.min&&(a[c.name]=a[c.name].refine(d=>c.min&&d&&Object.keys(d).length>=c.min,{message:`Must contain at least ${c.min} item(s)`})),c.max&&(a[c.name]=a[c.name].refine(d=>c.max&&(!d||Object.keys(d).length<=c.max),{message:`Must contain at most ${c.max} item(s)`})))):a[c.name]=Ro(c,t,s),r&&(a[c.name]=a[c.name].optional()))}),!s&&i&&(a.operation=ve([Oe("create"),Oe("update"),Oe("delete")]).optional(),a.password=be().optional(),a.passwordConfirm=be().optional(),Object.values(e.collections).forEach(c=>{a[`auth-${c.labels.collection}`]=Kt().optional(),a[`operations-${c.labels.collection}`]=_t(ve([Oe("Read"),Oe("Create"),Oe("Update"),Oe("Delete")])).optional(),a[`restrict-${c.labels.collection}`]=Kt().optional(),c.access.attributeRestrictions?.forEach(d=>{a[`attribute-${c.labels.collection}-${d.type}`]=Kt().optional()}),c.access.entityRestrictions?.restrictions?.forEach(d=>{if(d.type==="Individual"&&(a[`accessible-${c.labels.collection}-${c.labels.collection}`]=We({}).catchall(me()).optional()),d.type==="Parent"||d.type==="Parent_Property"){const h=W(c.fields,d.collectionField);a[`accessible-${c.labels.collection}-${h.collection}`]=We({}).catchall(me()).optional()}})}));const l=We(a);return n.allowSchemalessFields?l.passthrough():l.strict()},si=async(n,e)=>{if(n){const t=await oe(n,[e]);if(!t.valid)throw new Error(t.message)}},sn=async(n,e,t,s,r,i)=>{await si(s.custom?.preValidate,r);for(const a of s.fields)await si(a.custom?.preValidate,r);return bi(n,t,i).parse(e),e},Js=(n,e,t,s,r,i,o,a,l,c,d,h,u,f,y,v,p,g,I,k,x)=>{const{fields:E}=o;E.filter(m=>"unique"in m&&m.unique).forEach(m=>{n!=="delete"&&(typeof r[m.name]=="string"||typeof r[m.name]=="number")&&(e.set(f(m,r[m.name].toString().toLowerCase().replace(/\s/g,"---").replaceAll("/","|||")),{id:s,Collection_Path:t}),x&&x.size++)}),E.forEach(m=>{if(lt(m,o,i)){const L=dn(m,o,i),N={};r[m.name]!==void 0&&(N[m.name]=r[m.name],ee(m)&&(N[`${m.name}_Array`]=r[`${m.name}_Array`])),L.forEach(D=>{r[D.name]!==void 0&&(ee(D)?N[`${D.name}_Array`]=r[`${D.name}_Array`]:N[D.name]=r[D.name])}),Object.keys(N).length>0&&(n==="create"&&(N.Collection_Path=t,N.Collection_Path_String=t.join("/"),e.set(u(m),N)),n==="update"&&e.update(u(m),N),n==="delete"&&e.delete(u(m)),x&&x.size++)}});const F=l[o.labels.collection];for(const m of F){const L=la(m,o),N={...r};L.forEach(D=>{delete N[D.name],delete N[`${D.name}_Array`],delete N[`${D.name}_Single`],delete N[`${D.name}_Lowercase`]}),Object.keys(N).length>0&&(n==="create"&&(N.Collection_Path||=t,N.Collection_Path_String=t.join("/"),e.set(y(m.key),N)),n==="update"&&e.update(y(m.key),N),n==="delete"&&e.delete(y(m.key)),x&&x.size++)}const _=(m,L)=>{let N=1;lt(L,m,i)&&N++,m.fields.forEach(w=>{lt(w,m,i)&&JSON.parse(Xn(dn(w,m,i))).includes(L.name)&&N++});const D=l[m.labels.collection];for(const w of D)w.fields.some(R=>R.name===L.name)&&ee(L)&&N++;return N},Z=(m,L,N,D,w)=>{const R={};R[`${N.name}.${s}`]=h(),R[`${N.name}_Array`]=d(s),R[`${N.name}_Single`]=h(),e.update(v(w,D),R),lt(N,L,i)&&e.update(p(m,N.name,D),{[`${N.name}.${s}`]:h(),[`${N.name}_Array`]:d(s)}),L.fields.forEach(T=>{lt(T,L,i)&&JSON.parse(Xn(dn(T,L,i))).includes(N.name)&&e.update(p(m,T.name,D),{[`${N.name}_Array`]:d(s)})});const S=l[L.labels.collection];for(const T of S)T.fields.some(C=>C.name===N.name)&&ee(N)&&e.update(g(m,T.key,D),R)};if(n==="delete")return;const b=E.filter(m=>ee(m)&&m.twoWay);if(!a?.noTwoWay){for(const m of b){if(!x)throw new Error("VALIDATION_ERROR: batchSize is required");const L=i.collections[m.collection],N=W(L.fields,m.twoWay),D=dt(L,L.fields),w=Array.from(D).map(R=>R.name);if(!N)throw new Error(`SCHEMA_ERROR: Field ${m.twoWay} not found in collection ${m.collection}`);if(ee(N)){if(r[`${m.name}_Array`])for(const[R,S]of Object.entries(r[m.name])){if(n==="update"&&I&&I[`${m.name}_Array`]?.includes(R))continue;const T={...I,...r};nt(T);const C={};N.includeFields&&N.includeFields.forEach(O=>{if(T[O]!==void 0){C[O]=T[O];const G=W(o.fields,O);wt(o,[G]).size===1&&(C[`${O}_Lowercase`]=T[`${O}_Lowercase`])}});const q={[`${m.twoWay}.${s}`]:{Collection_Path:t,...C},[`${m.twoWay}_Array`]:c(s)};w.includes(N.name)&&(q[`${m.twoWay}_Single`]={Collection_Path:t,id:s,...C});const M=Tn(r);e.update(v(S.Collection_Path,R),{...q,...M}),x.size++,lt(N,L,i)&&(e.update(p(m,N.name,R),{[`${N.name}.${s}`]:{Collection_Path:t,...C},[`${N.name}_Array`]:c(s)}),x.size++),L.fields.forEach(O=>{if(lt(O,L,i)){const G=JSON.parse(Xn(dn(O,L,i))),z={};G.includes(N.name)&&(z[`${m.twoWay}_Array`]=c(s)),Object.keys(M).forEach(X=>{G.includes(X)&&(z[X]=M[X])}),Object.keys(z).length>0&&(e.update(p(m,O.name,R),z),x.size++)}});const Q=l[L.labels.collection];for(const O of Q)if(O.fields.some(G=>G.name===N.name)){const G={...q};Object.keys(M).forEach(z=>{O.fields.some(X=>X.name===z)&&(G[z]=M[z])}),Object.keys(G).length>0&&(e.update(g(m,O.key,R),G),x.size++)}}}else throw new Error(`SCHEMA_ERROR: Invalid field type: ${N.type}`)}x&&x.size>500&&console.error(new Error(`VALIDATION_ERROR: ${x.size} operations in the Firestore transaction has exceeded the recommended limit of 500. This is likely due to a large number of two way updates, roles, dependencies on the collection, unique field checks, entity restrictions (in permissions when dealing with user collections) or relation hierarchy checks.`));for(const m of b){if(!x)throw new Error("VALIDATION_ERROR: batchSize is required");const L=i.collections[m.collection],N=W(L.fields,m.twoWay);if(!N)throw new Error(`SCHEMA_ERROR: Field ${m.twoWay} not found in collection ${m.collection}`);if(ee(N)){if(n==="update"&&I&&!(r[m.name]&&ke(r[m.name]))&&r[`${m.name}_Array`]&&I[`${m.name}_Array`]?.length>0)for(const[D,w]of Object.entries(I[m.name]))!r[`${m.name}_Array`].includes(D)&&!k?.get(m.name)?.includes(D)&&(x.size+=_(L,N),x.size<=500&&Z(m,L,N,D,w.Collection_Path))}else throw new Error(`SCHEMA_ERROR: Invalid field type: ${N.type}`)}for(const m of b){if(!x)throw new Error("VALIDATION_ERROR: batchSize is required");const L=i.collections[m.collection],N=W(L.fields,m.twoWay);if(!N)throw new Error(`SCHEMA_ERROR: Field ${m.twoWay} not found in collection ${m.collection}`);if(ee(N)){if(n==="update"&&I&&r[m.name]&&ke(r[m.name])&&I[`${m.name}_Array`]?.length>0)for(const[D,w]of Object.entries(I[m.name]))k?.get(m.name)?.includes(D)||(x.size+=_(L,N),x.size<=500&&Z(m,L,N,D,w.Collection_Path))}else throw new Error(`SCHEMA_ERROR: Invalid field type: ${N.type}`)}}},Ve=n=>{for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(n[e]===void 0?delete n[e]:typeof n[e]=="object"&&n[e]!==null&&Ve(n[e]))},Qs=n=>{if(n=n.toString(),/[/]|^\.+$|^__.*__$/.test(n))return!1;try{const s=new TextEncoder().encode(n),r=new TextDecoder().decode(s);if(n!==r)return!1}catch{return!1}return!(new Blob([n]).size>1500)},ri=async(n,e,t,s=1e3,r=5)=>{for(;r>0;)try{await n(...e);break}catch(i){if(r--,r===0)throw i;await new Promise(o=>setTimeout(o,s)),s*=2}},Un=n=>{if(!n||typeof n!="string")return"";let e=n.replace(/[\r\n]/g,"");if(e=e.replace(/\0/g,""),e=e.replace(/[\x00-\x08\x0B-\x1F\x7F]/g,""),e=e.trim(),e.length>254)throw new Error("Email address is too long");return e},fs=n=>n?Array.isArray(n)?n.map(s=>Un(s)).filter(s=>s.length>0):Un(n)||"":"",Uc=n=>{if(!n||typeof n!="string")return"";let e=n.replace(/[\r\n]/g," ");if(e=e.replace(/\0/g,""),e=e.replace(/[\x00-\x08\x0B-\x1F\x7F]/g,""),e=e.trim(),e.length>998)throw new Error("Email subject is too long");return e},ii=n=>{if(!n||typeof n!="string")return"";let e=n.replace(/\0/g,"");if(e=e.replace(/\r\n\r\n/g,`
|
|
4
4
|
|
package/dist/bundle.js
CHANGED
|
@@ -9145,7 +9145,7 @@ const $c = (n, e) => {
|
|
|
9145
9145
|
i = qt(o.admin?.skipFormRequiredValidation);
|
|
9146
9146
|
}
|
|
9147
9147
|
return (!n.required || i) && (r = r.optional()), r;
|
|
9148
|
-
}, Fc = () => pe().refine((n) => n && (n.seconds !== void 0 && n.nanoseconds !== void 0 || n._seconds !== void 0 && n._nanoseconds !== void 0), {
|
|
9148
|
+
}, Fc = () => pe().refine((n) => n === null || n && (n.seconds !== void 0 && n.nanoseconds !== void 0 || n._seconds !== void 0 && n._nanoseconds !== void 0), {
|
|
9149
9149
|
message: "Must be a valid date"
|
|
9150
9150
|
}), vo = (n, e, t) => {
|
|
9151
9151
|
let s;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/node-client",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@google-cloud/storage": "^7.19.0",
|
|
27
27
|
"@stoker-platform/types": "0.5.33",
|
|
28
|
-
"@stoker-platform/utils": "0.5.
|
|
28
|
+
"@stoker-platform/utils": "0.5.45",
|
|
29
29
|
"@types/luxon": "^3.7.1",
|
|
30
30
|
"cross-spawn": "^7.0.6",
|
|
31
31
|
"firebase-admin": "^13.8.0",
|