@budibase/backend-core 3.18.2 → 3.18.4

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.
Files changed (34) hide show
  1. package/dist/index.js +15 -15
  2. package/dist/index.js.map +4 -4
  3. package/dist/package.json +2 -2
  4. package/dist/plugins.js +1 -1
  5. package/dist/plugins.js.map +4 -4
  6. package/dist/src/cache/appMetadata.d.ts +2 -2
  7. package/dist/src/cache/appMetadata.js +1 -1
  8. package/dist/src/cache/appMetadata.js.map +1 -1
  9. package/dist/src/context/mainContext.d.ts +1 -1
  10. package/dist/src/context/mainContext.js +3 -5
  11. package/dist/src/context/mainContext.js.map +1 -1
  12. package/dist/src/db/utils.d.ts +3 -3
  13. package/dist/src/db/utils.js +4 -4
  14. package/dist/src/db/utils.js.map +1 -1
  15. package/dist/src/docIds/conversions.d.ts +2 -2
  16. package/dist/src/docIds/conversions.js.map +1 -1
  17. package/dist/src/events/publishers/app.d.ts +13 -13
  18. package/dist/src/events/publishers/app.js +1 -1
  19. package/dist/src/events/publishers/app.js.map +1 -1
  20. package/dist/src/events/publishers/serve.d.ts +3 -3
  21. package/dist/src/events/publishers/serve.js +1 -1
  22. package/dist/src/events/publishers/serve.js.map +1 -1
  23. package/dist/src/objectStore/objectStore.d.ts +2 -2
  24. package/dist/src/objectStore/objectStore.js +17 -10
  25. package/dist/src/objectStore/objectStore.js.map +1 -1
  26. package/dist/src/security/roles.d.ts +1 -1
  27. package/dist/src/utils/utils.d.ts +0 -1
  28. package/dist/src/utils/utils.js +17 -25
  29. package/dist/src/utils/utils.js.map +1 -1
  30. package/dist/tests/core/utilities/structures/apps.d.ts +2 -2
  31. package/dist/tests/core/utilities/structures/apps.js.map +1 -1
  32. package/dist/tests/core/utilities/structures/licenses.js +1 -1
  33. package/dist/tests/core/utilities/structures/licenses.js.map +1 -1
  34. package/package.json +2 -2
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/backend-core",
3
- "version": "3.18.2",
3
+ "version": "3.18.4",
4
4
  "description": "Budibase backend core libraries used in server and worker",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -112,5 +112,5 @@
112
112
  }
113
113
  }
114
114
  },
115
- "gitHead": "43d59f5579dd910575d8aebefb40fae25570c05d"
115
+ "gitHead": "b82c05d3d0949d198b49415d20980e72cc61ca5b"
116
116
  }
package/dist/plugins.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var pt=Object.create;var Te=Object.defineProperty;var ut=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ct=Object.getPrototypeOf,lt=Object.prototype.hasOwnProperty;var je=(r,e)=>{for(var t in e)Te(r,t,{get:e[t],enumerable:!0})},qe=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of dt(e))!lt.call(r,o)&&o!==t&&Te(r,o,{get:()=>e[o],enumerable:!(n=ut(e,o))||n.enumerable});return r};var Ye=(r,e,t)=>(t=r!=null?pt(ct(r)):{},qe(e||!r||!r.__esModule?Te(t,"default",{value:r,enumerable:!0}):t,r)),mt=r=>qe(Te({},"__esModule",{value:!0}),r);var Ur={};je(Ur,{validate:()=>Pr});module.exports=mt(Ur);var gt=["user:created","user:updated","user:deleted","user:admin:assigned","user:admin:removed","user:builder:assigned","user:builder:removed","user_group:created","user_group:updated","user_group:deleted","user_group:user_added","user_group:users_deleted","user_group:permissions_edited"],ft=["automation:deleted","workspace_app:deleted","datasource:deleted","table:deleted","query:deleted","view:deleted"],kr=[...gt,...ft];var be=(n=>(n.SQL="sql",n.JSON="json",n.FIELDS="fields",n))(be||{}),Ne=(I=>(I.STRING="string",I.CODE="code",I.LONGFORM="longForm",I.BOOLEAN="boolean",I.NUMBER="number",I.PASSWORD="password",I.LIST="list",I.OBJECT="object",I.JSON="json",I.FILE="file",I.FIELD_GROUP="fieldGroup",I.SELECT="select",I))(Ne||{});var ve=(n=>(n.CONNECTION_CHECKING="connection",n.FETCH_TABLE_NAMES="fetch_table_names",n.EXPORT_SCHEMA="export_schema",n))(ve||{});var Et=Ye(require("lodash/isPlainObject"));var Pe=(t=>(t.RETURN_ALL="all",t.RETURN_NONE="none",t))(Pe||{});var Fn={OptOut:"analytics:opt:out",OptIn:"analytics:opt:in",SelfHostInit:"hosting:init",PluginInit:"plugin:init"};var Ue=(A=>(A.OBJECT="object",A.STRING="string",A.BOOLEAN="boolean",A.NUMBER="number",A.ARRAY="array",A.JSON="json",A.DATE="date",A.DATETIME="datetime",A.ATTACHMENT="attachment",A.LONGFORM="longform",A))(Ue||{}),Le=(R=>(R.TABLE="table",R.ROW="row",R.ROWS="rows",R.WIDE="wide",R.QUERY="query",R.QUERY_PARAMS="queryParams",R.QUERY_LIMIT="queryLimit",R.LOOP_OPTION="loopOption",R.ITEM="item",R.CODE="code",R.FILTERS="filters",R.COLUMN="column",R.TRIGGER_SCHEMA="triggerSchema",R.CRON="cron",R.WEBHOOK_URL="webhookUrl",R.AUTOMATION="automation",R.AUTOMATION_FIELDS="automationFields",R.MULTI_ATTACHMENTS="multi_attachments",R.TRIGGER_FILTER="trigger_filter",R.CATEGORIES="categories",R))(Le||{}),Me=(a=>(a.ROW_SAVED="ROW_SAVED",a.ROW_UPDATED="ROW_UPDATED",a.ROW_DELETED="ROW_DELETED",a.WEBHOOK="WEBHOOK",a.APP="APP",a.CRON="CRON",a.ROW_ACTION="ROW_ACTION",a))(Me||{});var we=(y=>(y.SEND_EMAIL_SMTP="SEND_EMAIL_SMTP",y.CREATE_ROW="CREATE_ROW",y.UPDATE_ROW="UPDATE_ROW",y.DELETE_ROW="DELETE_ROW",y.EXECUTE_BASH="EXECUTE_BASH",y.OUTGOING_WEBHOOK="OUTGOING_WEBHOOK",y.EXECUTE_SCRIPT="EXECUTE_SCRIPT",y.EXECUTE_SCRIPT_V2="EXECUTE_SCRIPT_V2",y.EXECUTE_QUERY="EXECUTE_QUERY",y.SERVER_LOG="SERVER_LOG",y.DELAY="DELAY",y.FILTER="FILTER",y.API_REQUEST="API_REQUEST",y.QUERY_ROWS="QUERY_ROWS",y.LOOP="LOOP",y.COLLECT="COLLECT",y.OPENAI="OPENAI",y.TRIGGER_AUTOMATION_RUN="TRIGGER_AUTOMATION_RUN",y.BRANCH="BRANCH",y.CLASSIFY_CONTENT="CLASSIFY_CONTENT",y.PROMPT_LLM="PROMPT_LLM",y.TRANSLATE="TRANSLATE",y.SUMMARISE="SUMMARISE",y.GENERATE_TEXT="GENERATE_TEXT",y.EXTRACT_FILE_DATA="EXTRACT_FILE_DATA",y.EXTRACT_STATE="EXTRACT_STATE",y.LOOP_V2="LOOP_V2",y.discord="discord",y.slack="slack",y.zapier="zapier",y.integromat="integromat",y.n8n="n8n",y))(we||{}),He=[...Object.values(we),...Object.values(Me)];var ke=(n=>(n.DATASOURCE="datasource",n.COMPONENT="component",n.AUTOMATION="automation",n))(ke||{});var Xi=Object.values(ke);var ta=["rows","queries","automations"],ra=["queries","automations"];var Be=(t=>(t.ASCENDING="ascending",t.DESCENDING="descending",t))(Be||{}),Fe=(t=>(t.STRING="string",t.NUMBER="number",t))(Fe||{});var _={};je(_,{BRAND:()=>Wt,DIRTY:()=>q,EMPTY_PATH:()=>xt,INVALID:()=>f,NEVER:()=>Cr,OK:()=>O,ParseStatus:()=>h,Schema:()=>S,ZodAny:()=>W,ZodArray:()=>G,ZodBigInt:()=>H,ZodBoolean:()=>K,ZodBranded:()=>Ee,ZodCatch:()=>ie,ZodDate:()=>Z,ZodDefault:()=>oe,ZodDiscriminatedUnion:()=>xe,ZodEffects:()=>P,ZodEnum:()=>re,ZodError:()=>C,ZodFirstPartyTypeKind:()=>E,ZodFunction:()=>Re,ZodIntersection:()=>J,ZodIssueCode:()=>p,ZodLazy:()=>ee,ZodLiteral:()=>te,ZodMap:()=>le,ZodNaN:()=>ge,ZodNativeEnum:()=>ne,ZodNever:()=>U,ZodNull:()=>$,ZodNullable:()=>w,ZodNumber:()=>Y,ZodObject:()=>D,ZodOptional:()=>N,ZodParsedType:()=>c,ZodPipeline:()=>Ae,ZodPromise:()=>j,ZodReadonly:()=>ae,ZodRecord:()=>ye,ZodSchema:()=>S,ZodSet:()=>me,ZodString:()=>Q,ZodSymbol:()=>de,ZodTransformer:()=>P,ZodTuple:()=>M,ZodType:()=>S,ZodUndefined:()=>X,ZodUnion:()=>z,ZodUnknown:()=>F,ZodVoid:()=>ce,addIssueToContext:()=>u,any:()=>zt,array:()=>rr,bigint:()=>Ht,boolean:()=>ot,coerce:()=>Ir,custom:()=>tt,date:()=>Kt,datetimeRegex:()=>Je,defaultErrorMap:()=>k,discriminatedUnion:()=>ar,effect:()=>Tr,enum:()=>fr,function:()=>lr,getErrorMap:()=>se,getParsedType:()=>L,instanceof:()=>qt,intersection:()=>sr,isAborted:()=>Se,isAsync:()=>pe,isDirty:()=>_e,isValid:()=>V,late:()=>jt,lazy:()=>mr,literal:()=>gr,makeIssue:()=>fe,map:()=>dr,nan:()=>Yt,nativeEnum:()=>Er,never:()=>er,null:()=>$t,nullable:()=>_r,number:()=>nt,object:()=>nr,objectUtil:()=>Ge,oboolean:()=>Or,onumber:()=>hr,optional:()=>Sr,ostring:()=>Rr,pipeline:()=>yr,preprocess:()=>xr,promise:()=>Ar,quotelessJson:()=>Tt,record:()=>ur,set:()=>cr,setErrorMap:()=>_t,strictObject:()=>or,string:()=>rt,symbol:()=>Zt,transformer:()=>Tr,tuple:()=>pr,undefined:()=>Xt,union:()=>ir,unknown:()=>Jt,util:()=>x,void:()=>tr});var x;(function(r){r.assertEqual=o=>{};function e(o){}r.assertIs=e;function t(o){throw new Error}r.assertNever=t,r.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},r.getValidEnumValues=o=>{let i=r.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return r.objectValues(s)},r.objectValues=o=>r.objectKeys(o).map(function(i){return o[i]}),r.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},r.find=(o,i)=>{for(let s of o)if(i(s))return s},r.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}r.joinValues=n,r.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(x||(x={}));var Ge;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ge||(Ge={}));var c=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=r=>{switch(typeof r){case"undefined":return c.undefined;case"string":return c.string;case"number":return Number.isNaN(r)?c.nan:c.number;case"boolean":return c.boolean;case"function":return c.function;case"bigint":return c.bigint;case"symbol":return c.symbol;case"object":return Array.isArray(r)?c.array:r===null?c.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?c.promise:typeof Map<"u"&&r instanceof Map?c.map:typeof Set<"u"&&r instanceof Set?c.set:typeof Date<"u"&&r instanceof Date?c.date:c.object;default:return c.unknown}};var p=x.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"]),Tt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),C=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(t(s));else{let a=n,m=0;for(;m<s.path.length;){let l=s.path[m];m===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(s))):a[l]=a[l]||{_errors:[]},a=a[l],m++}}};return o(this),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];t[i]=t[i]||[],t[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};C.create=r=>new C(r);var St=(r,e)=>{let t;switch(r.code){case p.invalid_type:r.received===c.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case p.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case p.invalid_union:t="Invalid input";break;case p.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case p.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case p.invalid_arguments:t="Invalid function arguments";break;case p.invalid_return_type:t="Invalid function return type";break;case p.invalid_date:t="Invalid date";break;case p.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case p.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case p.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case p.custom:t="Invalid input";break;case p.invalid_intersection_types:t="Intersection results could not be merged";break;case p.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case p.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}},k=St;var Ke=k;function _t(r){Ke=r}function se(){return Ke}var fe=r=>{let{data:e,path:t,errorMaps:n,issueData:o}=r,i=[...t,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",m=n.filter(l=>!!l).slice().reverse();for(let l of m)a=l(s,{data:e,defaultError:a}).message;return{...o,path:i,message:a}},xt=[];function u(r,e){let t=se(),n=fe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===k?void 0:k].filter(o=>!!o)});r.common.issues.push(n)}var h=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let o of t){if(o.status==="aborted")return f;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let o of t){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let o of t){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return f;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}},f=Object.freeze({status:"aborted"}),q=r=>({status:"dirty",value:r}),O=r=>({status:"valid",value:r}),Se=r=>r.status==="aborted",_e=r=>r.status==="dirty",V=r=>r.status==="valid",pe=r=>typeof Promise<"u"&&r instanceof Promise;var g;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(g||(g={}));var v=class{constructor(e,t,n,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=o}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}},Ze=(r,e)=>{if(V(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new C(r.common.issues);return this._error=t,this._error}}};function T(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:o}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,a)=>{let{message:m}=r;return s.code==="invalid_enum_value"?{message:m??a.defaultError}:typeof a.data>"u"?{message:m??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:m??t??a.defaultError}},description:o}}var S=class{get description(){return this._def.description}_getType(e){return L(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new h,ctx:{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(pe(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Ze(n,o)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return V(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>V(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(pe(o)?o:Promise.resolve(o));return Ze(n,i)}refine(e,t){let n=o=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(o):t;return this._refinement((o,i)=>{let s=e(o),a=()=>i.addIssue({code:p.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(m=>m?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof t=="function"?t(n,o):t),!1))}_refinement(e){return new P({schema:this,typeName:E.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 N.create(this,this._def)}nullable(){return w.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return G.create(this)}promise(){return j.create(this,this._def)}or(e){return z.create([this,e],this._def)}and(e){return J.create(this,e,this._def)}transform(e){return new P({...T(this._def),schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new oe({...T(this._def),innerType:this,defaultValue:t,typeName:E.ZodDefault})}brand(){return new Ee({typeName:E.ZodBranded,type:this,...T(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new ie({...T(this._def),innerType:this,catchValue:t,typeName:E.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ae.create(this,e)}readonly(){return ae.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},yt=/^c[^\s-]{8,}$/i,Rt=/^[0-9a-z]+$/,ht=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ot=/^[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,It=/^[a-z0-9_-]{21}$/i,Ct=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Dt=/^[-+]?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)?)??$/,bt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Nt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ve,vt=/^(?:(?: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])$/,Pt=/^(?:(?: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])$/,Ut=/^(([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]))$/,Lt=/^(([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])$/,Mt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$e="((\\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])))",kt=new RegExp(`^${$e}$`);function ze(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Bt(r){return new RegExp(`^${ze(r)}$`)}function Je(r){let e=`${$e}T${ze(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ft(r,e){return!!((e==="v4"||!e)&&vt.test(r)||(e==="v6"||!e)&&Ut.test(r))}function Gt(r,e){if(!Ct.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Vt(r,e){return!!((e==="v4"||!e)&&Pt.test(r)||(e==="v6"||!e)&&Lt.test(r))}var Q=class r extends S{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==c.string){let i=this._getOrReturnCtx(e);return u(i,{code:p.invalid_type,expected:c.string,received:i.parsedType}),f}let n=new h,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),u(o,{code:p.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),u(o,{code:p.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=e.data.length>i.value,a=e.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(e,o),s?u(o,{code:p.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&u(o,{code:p.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")bt.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"email",code:p.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ve||(Ve=new RegExp(Nt,"u")),Ve.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"emoji",code:p.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ot.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"uuid",code:p.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")It.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"nanoid",code:p.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")yt.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"cuid",code:p.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Rt.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"cuid2",code:p.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")ht.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"ulid",code:p.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),u(o,{validation:"url",code:p.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"regex",code:p.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),u(o,{code:p.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.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)||(o=this._getOrReturnCtx(e,o),u(o,{code:p.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),u(o,{code:p.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Je(i).test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{code:p.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?kt.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{code:p.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Bt(i).test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{code:p.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Dt.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"duration",code:p.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Ft(e.data,i.version)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"ip",code:p.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Gt(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"jwt",code:p.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Vt(e.data,i.version)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"cidr",code:p.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Mt.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"base64",code:p.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?wt.test(e.data)||(o=this._getOrReturnCtx(e,o),u(o,{validation:"base64url",code:p.invalid_string,message:i.message}),n.dirty()):x.assertNever(i);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(o=>e.test(o),{validation:t,code:p.invalid_string,...g.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.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,...g.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,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...g.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get 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(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Q.create=r=>new Q({checks:[],typeName:E.ZodString,coerce:r?.coerce??!1,...T(r)});function Qt(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=t>n?t:n,i=Number.parseInt(r.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return i%s/10**o}var Y=class r extends S{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)!==c.number){let i=this._getOrReturnCtx(e);return u(i,{code:p.invalid_type,expected:c.number,received:i.parsedType}),f}let n,o=new h;for(let i of this._def.checks)i.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:p.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:p.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:p.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Qt(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),u(n,{code:p.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),u(n,{code:p.not_finite,message:i.message}),o.dirty()):x.assertNever(i);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,n,o){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:g.toString(o)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Y.create=r=>new Y({checks:[],typeName:E.ZodNumber,coerce:r?.coerce||!1,...T(r)});var H=class r extends S{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)!==c.bigint)return this._getInvalidInput(e);let n,o=new h;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:p.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),u(n,{code:p.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),u(n,{code:p.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):x.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return u(t,{code:p.invalid_type,expected:c.bigint,received:t.parsedType}),f}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,n,o){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:g.toString(o)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};H.create=r=>new H({checks:[],typeName:E.ZodBigInt,coerce:r?.coerce??!1,...T(r)});var K=class extends S{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==c.boolean){let n=this._getOrReturnCtx(e);return u(n,{code:p.invalid_type,expected:c.boolean,received:n.parsedType}),f}return O(e.data)}};K.create=r=>new K({typeName:E.ZodBoolean,coerce:r?.coerce||!1,...T(r)});var Z=class r extends S{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==c.date){let i=this._getOrReturnCtx(e);return u(i,{code:p.invalid_type,expected:c.date,received:i.parsedType}),f}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return u(i,{code:p.invalid_date}),f}let n=new h,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),u(o,{code:p.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),u(o,{code:p.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):x.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Z.create=r=>new Z({checks:[],coerce:r?.coerce||!1,typeName:E.ZodDate,...T(r)});var de=class extends S{_parse(e){if(this._getType(e)!==c.symbol){let n=this._getOrReturnCtx(e);return u(n,{code:p.invalid_type,expected:c.symbol,received:n.parsedType}),f}return O(e.data)}};de.create=r=>new de({typeName:E.ZodSymbol,...T(r)});var X=class extends S{_parse(e){if(this._getType(e)!==c.undefined){let n=this._getOrReturnCtx(e);return u(n,{code:p.invalid_type,expected:c.undefined,received:n.parsedType}),f}return O(e.data)}};X.create=r=>new X({typeName:E.ZodUndefined,...T(r)});var $=class extends S{_parse(e){if(this._getType(e)!==c.null){let n=this._getOrReturnCtx(e);return u(n,{code:p.invalid_type,expected:c.null,received:n.parsedType}),f}return O(e.data)}};$.create=r=>new $({typeName:E.ZodNull,...T(r)});var W=class extends S{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}};W.create=r=>new W({typeName:E.ZodAny,...T(r)});var F=class extends S{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}};F.create=r=>new F({typeName:E.ZodUnknown,...T(r)});var U=class extends S{_parse(e){let t=this._getOrReturnCtx(e);return u(t,{code:p.invalid_type,expected:c.never,received:t.parsedType}),f}};U.create=r=>new U({typeName:E.ZodNever,...T(r)});var ce=class extends S{_parse(e){if(this._getType(e)!==c.undefined){let n=this._getOrReturnCtx(e);return u(n,{code:p.invalid_type,expected:c.void,received:n.parsedType}),f}return O(e.data)}};ce.create=r=>new ce({typeName:E.ZodVoid,...T(r)});var G=class r extends S{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),o=this._def;if(t.parsedType!==c.array)return u(t,{code:p.invalid_type,expected:c.array,received:t.parsedType}),f;if(o.exactLength!==null){let s=t.data.length>o.exactLength.value,a=t.data.length<o.exactLength.value;(s||a)&&(u(t,{code:s?p.too_big:p.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&t.data.length<o.minLength.value&&(u(t,{code:p.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&t.data.length>o.maxLength.value&&(u(t,{code:p.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((s,a)=>o.type._parseAsync(new v(t,s,t.path,a)))).then(s=>h.mergeArray(n,s));let i=[...t.data].map((s,a)=>o.type._parseSync(new v(t,s,t.path,a)));return h.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}};G.create=(r,e)=>new G({type:r,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray,...T(e)});function ue(r){if(r instanceof D){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=N.create(ue(n))}return new D({...r._def,shape:()=>e})}else return r instanceof G?new G({...r._def,type:ue(r.element)}):r instanceof N?N.create(ue(r.unwrap())):r instanceof w?w.create(ue(r.unwrap())):r instanceof M?M.create(r.items.map(e=>ue(e))):r}var D=class r extends S{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==c.object){let l=this._getOrReturnCtx(e);return u(l,{code:p.invalid_type,expected:c.object,received:l.parsedType}),f}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof U&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let m=[];for(let l of s){let A=i[l],b=o.data[l];m.push({key:{status:"valid",value:l},value:A._parse(new v(o,b,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof U){let l=this._def.unknownKeys;if(l==="passthrough")for(let A of a)m.push({key:{status:"valid",value:A},value:{status:"valid",value:o.data[A]}});else if(l==="strict")a.length>0&&(u(o,{code:p.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let A of a){let b=o.data[A];m.push({key:{status:"valid",value:A},value:l._parse(new v(o,b,o.path,A)),alwaysSet:A in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let A of m){let b=await A.key,I=await A.value;l.push({key:b,value:I,alwaysSet:A.alwaysSet})}return l}).then(l=>h.mergeObjectSync(n,l)):h.mergeObjectSync(n,m)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let o=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:g.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:E.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let n of x.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let n of x.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return ue(this)}partial(e){let t={};for(let n of x.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?t[n]=o:t[n]=o.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let n of x.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof N;)i=i._def.innerType;t[n]=i}return new r({...this._def,shape:()=>t})}keyof(){return et(x.objectKeys(this.shape))}};D.create=(r,e)=>new D({shape:()=>r,unknownKeys:"strip",catchall:U.create(),typeName:E.ZodObject,...T(e)});D.strictCreate=(r,e)=>new D({shape:()=>r,unknownKeys:"strict",catchall:U.create(),typeName:E.ZodObject,...T(e)});D.lazycreate=(r,e)=>new D({shape:r,unknownKeys:"strip",catchall:U.create(),typeName:E.ZodObject,...T(e)});var z=class extends S{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new C(a.ctx.common.issues));return u(t,{code:p.invalid_union,unionErrors:s}),f}if(t.common.async)return Promise.all(n.map(async i=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let m of n){let l={...t,common:{...t.common,issues:[]},parent:null},A=m._parseSync({data:t.data,path:t.path,parent:l});if(A.status==="valid")return A;A.status==="dirty"&&!i&&(i={result:A,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(m=>new C(m));return u(t,{code:p.invalid_union,unionErrors:a}),f}}get options(){return this._def.options}};z.create=(r,e)=>new z({options:r,typeName:E.ZodUnion,...T(e)});var B=r=>r instanceof ee?B(r.schema):r instanceof P?B(r.innerType()):r instanceof te?[r.value]:r instanceof re?r.options:r instanceof ne?x.objectValues(r.enum):r instanceof oe?B(r._def.innerType):r instanceof X?[void 0]:r instanceof $?[null]:r instanceof N?[void 0,...B(r.unwrap())]:r instanceof w?[null,...B(r.unwrap())]:r instanceof Ee||r instanceof ae?B(r.unwrap()):r instanceof ie?B(r._def.innerType):[],xe=class r extends S{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.object)return u(t,{code:p.invalid_type,expected:c.object,received:t.parsedType}),f;let n=this.discriminator,o=t.data[n],i=this.optionsMap.get(o);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(u(t,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),f)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let o=new Map;for(let i of t){let s=B(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,i)}}return new r({typeName:E.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...T(n)})}};function Qe(r,e){let t=L(r),n=L(e);if(r===e)return{valid:!0,data:r};if(t===c.object&&n===c.object){let o=x.objectKeys(e),i=x.objectKeys(r).filter(a=>o.indexOf(a)!==-1),s={...r,...e};for(let a of i){let m=Qe(r[a],e[a]);if(!m.valid)return{valid:!1};s[a]=m.data}return{valid:!0,data:s}}else if(t===c.array&&n===c.array){if(r.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<r.length;i++){let s=r[i],a=e[i],m=Qe(s,a);if(!m.valid)return{valid:!1};o.push(m.data)}return{valid:!0,data:o}}else return t===c.date&&n===c.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var J=class extends S{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),o=(i,s)=>{if(Se(i)||Se(s))return f;let a=Qe(i.value,s.value);return a.valid?((_e(i)||_e(s))&&t.dirty(),{status:t.value,value:a.data}):(u(n,{code:p.invalid_intersection_types}),f)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};J.create=(r,e,t)=>new J({left:r,right:e,typeName:E.ZodIntersection,...T(t)});var M=class r extends S{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==c.array)return u(n,{code:p.invalid_type,expected:c.array,received:n.parsedType}),f;if(n.data.length<this._def.items.length)return u(n,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;!this._def.rest&&n.data.length>this._def.items.length&&(u(n,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...n.data].map((s,a)=>{let m=this._def.items[a]||this._def.rest;return m?m._parse(new v(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>h.mergeArray(t,s)):h.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};M.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new M({items:r,typeName:E.ZodTuple,rest:null,...T(e)})};var ye=class r extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==c.object)return u(n,{code:p.invalid_type,expected:c.object,received:n.parsedType}),f;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new v(n,a,n.path,a)),value:s._parse(new v(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?h.mergeObjectAsync(t,o):h.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof S?new r({keyType:e,valueType:t,typeName:E.ZodRecord,...T(n)}):new r({keyType:Q.create(),valueType:e,typeName:E.ZodRecord,...T(t)})}},le=class extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==c.map)return u(n,{code:p.invalid_type,expected:c.map,received:n.parsedType}),f;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,m],l)=>({key:o._parse(new v(n,a,n.path,[l,"key"])),value:i._parse(new v(n,m,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let m of s){let l=await m.key,A=await m.value;if(l.status==="aborted"||A.status==="aborted")return f;(l.status==="dirty"||A.status==="dirty")&&t.dirty(),a.set(l.value,A.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let m of s){let l=m.key,A=m.value;if(l.status==="aborted"||A.status==="aborted")return f;(l.status==="dirty"||A.status==="dirty")&&t.dirty(),a.set(l.value,A.value)}return{status:t.value,value:a}}}};le.create=(r,e,t)=>new le({valueType:e,keyType:r,typeName:E.ZodMap,...T(t)});var me=class r extends S{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==c.set)return u(n,{code:p.invalid_type,expected:c.set,received:n.parsedType}),f;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(u(n,{code:p.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),t.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(u(n,{code:p.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty());let i=this._def.valueType;function s(m){let l=new Set;for(let A of m){if(A.status==="aborted")return f;A.status==="dirty"&&t.dirty(),l.add(A.value)}return{status:t.value,value:l}}let a=[...n.data.values()].map((m,l)=>i._parse(new v(n,m,n.path,l)));return n.common.async?Promise.all(a).then(m=>s(m)):s(a)}min(e,t){return new r({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:g.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};me.create=(r,e)=>new me({valueType:r,minSize:null,maxSize:null,typeName:E.ZodSet,...T(e)});var Re=class r extends S{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.function)return u(t,{code:p.invalid_type,expected:c.function,received:t.parsedType}),f;function n(a,m){return fe({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,se(),k].filter(l=>!!l),issueData:{code:p.invalid_arguments,argumentsError:m}})}function o(a,m){return fe({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,se(),k].filter(l=>!!l),issueData:{code:p.invalid_return_type,returnTypeError:m}})}let i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof j){let a=this;return O(async function(...m){let l=new C([]),A=await a._def.args.parseAsync(m,i).catch(De=>{throw l.addIssue(n(m,De)),l}),b=await Reflect.apply(s,this,A);return await a._def.returns._def.type.parseAsync(b,i).catch(De=>{throw l.addIssue(o(b,De)),l})})}else{let a=this;return O(function(...m){let l=a._def.args.safeParse(m,i);if(!l.success)throw new C([n(m,l.error)]);let A=Reflect.apply(s,this,l.data),b=a._def.returns.safeParse(A,i);if(!b.success)throw new C([o(A,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:M.create(e).rest(F.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||M.create([]).rest(F.create()),returns:t||F.create(),typeName:E.ZodFunction,...T(n)})}},ee=class extends S{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ee.create=(r,e)=>new ee({getter:r,typeName:E.ZodLazy,...T(e)});var te=class extends S{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:p.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:e.data}}get value(){return this._def.value}};te.create=(r,e)=>new te({value:r,typeName:E.ZodLiteral,...T(e)});function et(r,e){return new re({values:r,typeName:E.ZodEnum,...T(e)})}var re=class r extends S{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return u(t,{expected:x.joinValues(n),received:t.parsedType,code:p.invalid_type}),f}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return u(t,{received:t.data,code:p.invalid_enum_value,options:n}),f}return O(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};re.create=et;var ne=class extends S{_parse(e){let t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==c.string&&n.parsedType!==c.number){let o=x.objectValues(t);return u(n,{expected:x.joinValues(o),received:n.parsedType,code:p.invalid_type}),f}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=x.objectValues(t);return u(n,{received:n.data,code:p.invalid_enum_value,options:o}),f}return O(e.data)}get enum(){return this._def.values}};ne.create=(r,e)=>new ne({values:r,typeName:E.ZodNativeEnum,...T(e)});var j=class extends S{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.promise&&t.common.async===!1)return u(t,{code:p.invalid_type,expected:c.promise,received:t.parsedType}),f;let n=t.parsedType===c.promise?t.data:Promise.resolve(t.data);return O(n.then(o=>this._def.type.parseAsync(o,{path:t.path,errorMap:t.common.contextualErrorMap})))}};j.create=(r,e)=>new j({type:r,typeName:E.ZodPromise,...T(e)});var P=class extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:s=>{u(n,s),s.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(t.value==="aborted")return f;let m=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return m.status==="aborted"?f:m.status==="dirty"?q(m.value):t.value==="dirty"?q(m.value):m});{if(t.value==="aborted")return f;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?f:a.status==="dirty"?q(a.value):t.value==="dirty"?q(a.value):a}}if(o.type==="refinement"){let s=a=>{let m=o.refinement(a,i);if(n.common.async)return Promise.resolve(m);if(m instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?f:(a.status==="dirty"&&t.dirty(),s(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?f:(a.status==="dirty"&&t.dirty(),s(a.value).then(()=>({status:t.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!V(s))return f;let a=o.transform(s.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:n.data,path:n.path,parent:n}).then(s=>V(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:t.value,value:a})):f);x.assertNever(o)}};P.create=(r,e,t)=>new P({schema:r,typeName:E.ZodEffects,effect:e,...T(t)});P.createWithPreprocess=(r,e,t)=>new P({schema:e,effect:{type:"preprocess",transform:r},typeName:E.ZodEffects,...T(t)});var N=class extends S{_parse(e){return this._getType(e)===c.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};N.create=(r,e)=>new N({innerType:r,typeName:E.ZodOptional,...T(e)});var w=class extends S{_parse(e){return this._getType(e)===c.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};w.create=(r,e)=>new w({innerType:r,typeName:E.ZodNullable,...T(e)});var oe=class extends S{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===c.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};oe.create=(r,e)=>new oe({innerType:r,typeName:E.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});var ie=class extends S{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return pe(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new C(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new C(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ie.create=(r,e)=>new ie({innerType:r,typeName:E.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});var ge=class extends S{_parse(e){if(this._getType(e)!==c.nan){let n=this._getOrReturnCtx(e);return u(n,{code:p.invalid_type,expected:c.nan,received:n.parsedType}),f}return{status:"valid",value:e.data}}};ge.create=r=>new ge({typeName:E.ZodNaN,...T(r)});var Wt=Symbol("zod_brand"),Ee=class extends S{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Ae=class r extends S{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?f:i.status==="dirty"?(t.dirty(),q(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?f:o.status==="dirty"?(t.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:E.ZodPipeline})}},ae=class extends S{_parse(e){let t=this._def.innerType._parse(e),n=o=>(V(o)&&(o.value=Object.freeze(o.value)),o);return pe(t)?t.then(o=>n(o)):n(t)}unwrap(){return this._def.innerType}};ae.create=(r,e)=>new ae({innerType:r,typeName:E.ZodReadonly,...T(e)});function Xe(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function tt(r,e={},t){return r?W.create().superRefine((n,o)=>{let i=r(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Xe(e,n),m=a.fatal??t??!0;o.addIssue({code:"custom",...a,fatal:m})}});if(!i){let s=Xe(e,n),a=s.fatal??t??!0;o.addIssue({code:"custom",...s,fatal:a})}}):W.create()}var jt={object:D.lazycreate},E;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(E||(E={}));var qt=(r,e={message:`Input not instance of ${r.name}`})=>tt(t=>t instanceof r,e),rt=Q.create,nt=Y.create,Yt=ge.create,Ht=H.create,ot=K.create,Kt=Z.create,Zt=de.create,Xt=X.create,$t=$.create,zt=W.create,Jt=F.create,er=U.create,tr=ce.create,rr=G.create,nr=D.create,or=D.strictCreate,ir=z.create,ar=xe.create,sr=J.create,pr=M.create,ur=ye.create,dr=le.create,cr=me.create,lr=Re.create,mr=ee.create,gr=te.create,fr=re.create,Er=ne.create,Ar=j.create,Tr=P.create,Sr=N.create,_r=w.create,xr=P.createWithPreprocess,yr=Ae.create,Rr=()=>rt().optional(),hr=()=>nt().optional(),Or=()=>ot().optional(),Ir={string:r=>Q.create({...r,coerce:!0}),number:r=>Y.create({...r,coerce:!0}),boolean:r=>K.create({...r,coerce:!0}),bigint:r=>H.create({...r,coerce:!0}),date:r=>Z.create({...r,coerce:!0})};var Cr=f;var Ce=_.string().refine(r=>r!=="_complexIdOperator",{message:"Key '_complexIdOperator' is not allowed"}),it=_.record(Ce,_.string()),he=_.record(Ce,_.any()),Oe=_.record(Ce,_.union([_.any().array(),_.string()])),at=_.lazy(()=>_.object({conditions:_.array(_.object(st))})),Ie=_.union([_.string(),_.number()]),st={string:it.optional(),fuzzy:it.optional(),range:_.record(Ce,_.union([_.object({high:Ie,low:Ie}),_.object({high:Ie}),_.object({low:Ie})])).optional(),equal:he.optional(),notEqual:he.optional(),empty:he.optional(),notEmpty:he.optional(),oneOf:Oe.optional(),contains:Oe.optional(),notContains:Oe.optional(),containsAny:Oe.optional(),$and:at.optional(),$or:at.optional()},Cs=_.object({query:_.object({allOr:_.boolean().optional(),onEmptyFilter:_.nativeEnum(Pe).optional(),...st}).optional(),paginate:_.boolean().optional(),bookmark:_.union([_.string(),_.number()]).nullish(),limit:_.number().optional(),sort:_.string().nullish(),sortOrder:_.nativeEnum(Be).optional(),sortType:_.nativeEnum(Fe).nullish(),version:_.string().optional(),disableEscaping:_.boolean().optional(),countRows:_.boolean().optional()});var d=Ye(require("joi")),Dr=["Relational","Non-relational","Spreadsheet","Object store","Graph","API"];function We(r,e){let{error:t}=r.validate(e);if(t)throw t}function br(r){let e=d.default.object({type:d.default.string().allow("component").required(),metadata:d.default.object().unknown(!0).required(),hash:d.default.string().optional(),version:d.default.string().optional(),schema:d.default.object({name:d.default.string().required(),settings:d.default.array().items(d.default.object().unknown(!0)).required()}).unknown(!0)});We(e,r)}function Nr(r){let e=d.default.object({type:d.default.string().allow(...Object.values(Ne)).required(),required:d.default.boolean().required(),default:d.default.any(),display:d.default.string()}),t=d.default.object({type:d.default.string().allow(...Object.values(be)),readable:d.default.boolean(),displayName:d.default.string(),fields:d.default.object().pattern(d.default.string(),e)}).required(),n=d.default.object({type:d.default.string().allow("datasource").required(),metadata:d.default.object().unknown(!0).required(),hash:d.default.string().optional(),version:d.default.string().optional(),schema:d.default.object({docs:d.default.string(),plus:d.default.boolean().optional(),isSQL:d.default.boolean().optional(),auth:d.default.object({type:d.default.string().required()}).optional(),features:d.default.object(Object.fromEntries(Object.values(ve).map(o=>[o,d.default.boolean().optional()]))).optional(),relationships:d.default.boolean().optional(),description:d.default.string().required(),friendlyName:d.default.string().required(),type:d.default.string().allow(...Dr),datasource:d.default.object().pattern(d.default.string(),e).required(),query:d.default.object().pattern(d.default.string(),t).unknown(!0).required(),extra:d.default.object().pattern(d.default.string(),d.default.object({type:d.default.string().required(),displayName:d.default.string().required(),required:d.default.boolean(),data:d.default.object()}))})});We(n,r)}function vr(r){let e=d.default.object().pattern(d.default.string(),{type:d.default.string().allow(...Object.values(Ue)).required(),customType:d.default.string().allow(...Object.values(Le)),title:d.default.string(),description:d.default.string(),enum:d.default.array().items(d.default.string()),pretty:d.default.array().items(d.default.string())}),t=d.default.object({properties:e,required:d.default.array().items(d.default.string())}).concat(e).required(),n=d.default.object({type:d.default.string().allow("automation").required(),metadata:d.default.object().unknown(!0).required(),hash:d.default.string().optional(),version:d.default.string().optional(),schema:d.default.object({name:d.default.string().required(),tagline:d.default.string().required(),icon:d.default.string().required(),description:d.default.string().required(),type:d.default.string().allow("ACTION","LOGIC").required(),stepId:d.default.string().disallow(...He).required(),inputs:d.default.object().optional(),schema:d.default.object({inputs:t,outputs:t}).required()})});We(n,r)}function Pr(r){switch(r?.type){case"component":br(r);break;case"datasource":Nr(r);break;case"automation":vr(r);break;default:throw new Error(`Unknown plugin type - check schema.json: ${r.type}`)}}0&&(module.exports={validate});
1
+ "use strict";var f=Object.create;var l=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var N=(t,n)=>{for(var i in n)l(t,i,{get:n[i],enumerable:!0})},_=(t,n,i,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let g of P(n))!A.call(t,g)&&g!==i&&l(t,g,{get:()=>n[g],enumerable:!(a=b(n,g))||a.enumerable});return t};var x=(t,n,i)=>(i=t!=null?f(D(t)):{},_(n||!t||!t.__esModule?l(i,"default",{value:t,enumerable:!0}):i,t)),U=t=>_(l({},"__esModule",{value:!0}),t);var M={};N(M,{validate:()=>B});module.exports=U(M);var T=(a=>(a.SQL="sql",a.JSON="json",a.FIELDS="fields",a))(T||{}),O=(o=>(o.STRING="string",o.CODE="code",o.LONGFORM="longForm",o.BOOLEAN="boolean",o.NUMBER="number",o.PASSWORD="password",o.LIST="list",o.OBJECT="object",o.JSON="json",o.FILE="file",o.FIELD_GROUP="fieldGroup",o.SELECT="select",o))(O||{});var c=(a=>(a.CONNECTION_CHECKING="connection",a.FETCH_TABLE_NAMES="fetch_table_names",a.EXPORT_SCHEMA="export_schema",a))(c||{});var p=(E=>(E.OBJECT="object",E.STRING="string",E.BOOLEAN="boolean",E.NUMBER="number",E.ARRAY="array",E.JSON="json",E.DATE="date",E.DATETIME="datetime",E.ATTACHMENT="attachment",E.LONGFORM="longform",E))(p||{}),u=(s=>(s.TABLE="table",s.ROW="row",s.ROWS="rows",s.WIDE="wide",s.QUERY="query",s.QUERY_PARAMS="queryParams",s.QUERY_LIMIT="queryLimit",s.LOOP_OPTION="loopOption",s.ITEM="item",s.CODE="code",s.FILTERS="filters",s.COLUMN="column",s.TRIGGER_SCHEMA="triggerSchema",s.CRON="cron",s.WEBHOOK_URL="webhookUrl",s.AUTOMATION="automation",s.AUTOMATION_FIELDS="automationFields",s.MULTI_ATTACHMENTS="multi_attachments",s.TRIGGER_FILTER="trigger_filter",s.CATEGORIES="categories",s))(u||{}),L=(R=>(R.ROW_SAVED="ROW_SAVED",R.ROW_UPDATED="ROW_UPDATED",R.ROW_DELETED="ROW_DELETED",R.WEBHOOK="WEBHOOK",R.APP="APP",R.CRON="CRON",R.ROW_ACTION="ROW_ACTION",R))(L||{});var C=(r=>(r.SEND_EMAIL_SMTP="SEND_EMAIL_SMTP",r.CREATE_ROW="CREATE_ROW",r.UPDATE_ROW="UPDATE_ROW",r.DELETE_ROW="DELETE_ROW",r.EXECUTE_BASH="EXECUTE_BASH",r.OUTGOING_WEBHOOK="OUTGOING_WEBHOOK",r.EXECUTE_SCRIPT="EXECUTE_SCRIPT",r.EXECUTE_SCRIPT_V2="EXECUTE_SCRIPT_V2",r.EXECUTE_QUERY="EXECUTE_QUERY",r.SERVER_LOG="SERVER_LOG",r.DELAY="DELAY",r.FILTER="FILTER",r.API_REQUEST="API_REQUEST",r.QUERY_ROWS="QUERY_ROWS",r.LOOP="LOOP",r.COLLECT="COLLECT",r.OPENAI="OPENAI",r.TRIGGER_AUTOMATION_RUN="TRIGGER_AUTOMATION_RUN",r.BRANCH="BRANCH",r.CLASSIFY_CONTENT="CLASSIFY_CONTENT",r.PROMPT_LLM="PROMPT_LLM",r.TRANSLATE="TRANSLATE",r.SUMMARISE="SUMMARISE",r.GENERATE_TEXT="GENERATE_TEXT",r.EXTRACT_FILE_DATA="EXTRACT_FILE_DATA",r.EXTRACT_STATE="EXTRACT_STATE",r.LOOP_V2="LOOP_V2",r.discord="discord",r.slack="slack",r.zapier="zapier",r.integromat="integromat",r.n8n="n8n",r))(C||{}),m=[...Object.values(C),...Object.values(L)];var e=x(require("joi")),I=["Relational","Non-relational","Spreadsheet","Object store","Graph","API"];function d(t,n){let{error:i}=t.validate(n);if(i)throw i}function y(t){let n=e.default.object({type:e.default.string().allow("component").required(),metadata:e.default.object().unknown(!0).required(),hash:e.default.string().optional(),version:e.default.string().optional(),schema:e.default.object({name:e.default.string().required(),settings:e.default.array().items(e.default.object().unknown(!0)).required()}).unknown(!0)});d(n,t)}function S(t){let n=e.default.object({type:e.default.string().allow(...Object.values(O)).required(),required:e.default.boolean().required(),default:e.default.any(),display:e.default.string()}),i=e.default.object({type:e.default.string().allow(...Object.values(T)),readable:e.default.boolean(),displayName:e.default.string(),fields:e.default.object().pattern(e.default.string(),n)}).required(),a=e.default.object({type:e.default.string().allow("datasource").required(),metadata:e.default.object().unknown(!0).required(),hash:e.default.string().optional(),version:e.default.string().optional(),schema:e.default.object({docs:e.default.string(),plus:e.default.boolean().optional(),isSQL:e.default.boolean().optional(),auth:e.default.object({type:e.default.string().required()}).optional(),features:e.default.object(Object.fromEntries(Object.values(c).map(g=>[g,e.default.boolean().optional()]))).optional(),relationships:e.default.boolean().optional(),description:e.default.string().required(),friendlyName:e.default.string().required(),type:e.default.string().allow(...I),datasource:e.default.object().pattern(e.default.string(),n).required(),query:e.default.object().pattern(e.default.string(),i).unknown(!0).required(),extra:e.default.object().pattern(e.default.string(),e.default.object({type:e.default.string().required(),displayName:e.default.string().required(),required:e.default.boolean(),data:e.default.object()}))})});d(a,t)}function G(t){let n=e.default.object().pattern(e.default.string(),{type:e.default.string().allow(...Object.values(p)).required(),customType:e.default.string().allow(...Object.values(u)),title:e.default.string(),description:e.default.string(),enum:e.default.array().items(e.default.string()),pretty:e.default.array().items(e.default.string())}),i=e.default.object({properties:n,required:e.default.array().items(e.default.string())}).concat(n).required(),a=e.default.object({type:e.default.string().allow("automation").required(),metadata:e.default.object().unknown(!0).required(),hash:e.default.string().optional(),version:e.default.string().optional(),schema:e.default.object({name:e.default.string().required(),tagline:e.default.string().required(),icon:e.default.string().required(),description:e.default.string().required(),type:e.default.string().allow("ACTION","LOGIC").required(),stepId:e.default.string().disallow(...m).required(),inputs:e.default.object().optional(),schema:e.default.object({inputs:i,outputs:i}).required()})});d(a,t)}function B(t){switch(t?.type){case"component":y(t);break;case"datasource":S(t);break;case"automation":G(t);break;default:throw new Error(`Unknown plugin type - check schema.json: ${t.type}`)}}0&&(module.exports={validate});
2
2
  //# sourceMappingURL=plugins.js.map