zaileys 0.29.11-beta → 0.29.12-beta

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/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "zaileys",
3
- "version": "0.29.11-beta",
3
+ "version": "0.29.12-beta",
4
4
  "description": "Zaileys - Simplify Typescript/Javascript WhatsApp NodeJS API",
5
- "main": "dist/index.cjs.js",
6
- "module": "dist/index.esm.js",
7
- "types": "dist/index.d.ts",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "require": {
11
11
  "types": "./dist/index.d.ts",
12
- "default": "./dist/index.cjs.js"
12
+ "default": "./dist/index.cjs"
13
13
  },
14
14
  "import": {
15
15
  "types": "./dist/index.d.ts",
16
- "default": "./dist/index.esm.js"
16
+ "default": "./dist/index.mjs"
17
17
  }
18
18
  }
19
19
  },
@@ -1,17 +0,0 @@
1
- import { z } from "zod";
2
- import { ClientClassesType } from "../types/classes/client";
3
- import { EventCallbackType, EventEnumType } from "../types/classes/event";
4
- declare class Client {
5
- private props;
6
- options: z.infer<typeof ClientClassesType> | undefined;
7
- private chatId;
8
- private logger;
9
- private event;
10
- private db;
11
- private socket;
12
- private groupCache;
13
- constructor(props: z.input<typeof ClientClassesType>);
14
- initialize(): Promise<void>;
15
- on<T extends EventEnumType>(event: T, handler: EventCallbackType[T]): void;
16
- }
17
- export default Client;
@@ -1,12 +0,0 @@
1
- import { WASocket } from "baileys";
2
- import { EventCallbackType, EventEnumType } from "../types/classes/event";
3
- import Client from "./Client";
4
- declare class Event {
5
- private client;
6
- private events;
7
- constructor(client: Client);
8
- setup(sock: WASocket): void;
9
- on<T extends EventEnumType>(event: T, handler: EventCallbackType[T]): void;
10
- private emit;
11
- }
12
- export default Event;
@@ -1,3 +0,0 @@
1
- export default class Parser {
2
- constructor();
3
- }
@@ -1,12 +0,0 @@
1
- import { Kysely } from "kysely";
2
- import { z } from "zod";
3
- import { AuthAdapterHandlerType } from "../types/adapter/general";
4
- import { AdapterDatabaseType } from "../types/classes/client";
5
- import type { DB } from "./schema";
6
- import { BaileysEventEmitter } from "baileys";
7
- export declare const ConnectDB: (type: z.infer<typeof AdapterDatabaseType>["type"], url: string) => Kysely<DB>;
8
- export declare const MigrateDB: (db: Kysely<DB>) => Promise<void>;
9
- export declare const AuthAdapterHandler: (db: Kysely<DB>, session: string) => AuthAdapterHandlerType;
10
- export declare const StoreAdapterHandler: (db: Kysely<DB>, session: string) => Promise<{
11
- bind: (event: BaileysEventEmitter) => void;
12
- }>;
@@ -1,63 +0,0 @@
1
- import { z } from "zod";
2
- export declare const AuthSchema: z.ZodObject<{
3
- session: z.ZodString;
4
- id: z.ZodString;
5
- value: z.ZodNullable<z.ZodString>;
6
- }, "strip", z.ZodTypeAny, {
7
- session: string;
8
- value: string | null;
9
- id: string;
10
- }, {
11
- session: string;
12
- value: string | null;
13
- id: string;
14
- }>;
15
- export declare const ChatSchema: z.ZodObject<{
16
- session: z.ZodString;
17
- id: z.ZodString;
18
- value: z.ZodNullable<z.ZodString>;
19
- }, "strip", z.ZodTypeAny, {
20
- session: string;
21
- value: string | null;
22
- id: string;
23
- }, {
24
- session: string;
25
- value: string | null;
26
- id: string;
27
- }>;
28
- export declare const ContactSchema: z.ZodObject<{
29
- session: z.ZodString;
30
- id: z.ZodString;
31
- value: z.ZodNullable<z.ZodString>;
32
- }, "strip", z.ZodTypeAny, {
33
- session: string;
34
- value: string | null;
35
- id: string;
36
- }, {
37
- session: string;
38
- value: string | null;
39
- id: string;
40
- }>;
41
- export declare const MessageSchema: z.ZodObject<{
42
- session: z.ZodString;
43
- id: z.ZodString;
44
- value: z.ZodNullable<z.ZodString>;
45
- }, "strip", z.ZodTypeAny, {
46
- session: string;
47
- value: string | null;
48
- id: string;
49
- }, {
50
- session: string;
51
- value: string | null;
52
- id: string;
53
- }>;
54
- export type AuthTable = z.infer<typeof AuthSchema>;
55
- export type ChatTable = z.infer<typeof ChatSchema>;
56
- export type ContactTable = z.infer<typeof ContactSchema>;
57
- export type MessageTable = z.infer<typeof MessageSchema>;
58
- export type DB = {
59
- auth: AuthTable;
60
- chats: ChatTable;
61
- contacts: ContactTable;
62
- messages: MessageTable;
63
- };
@@ -1,57 +0,0 @@
1
- import { AppDataSync, valueReplacer, valueReviver } from "../types/adapter/general";
2
- export declare const fromObject: (args: AppDataSync) => {
3
- keyData: Uint8Array<ArrayBuffer> | (Uint8Array<ArrayBufferLike> & any[]);
4
- fingerprint: {
5
- rawId: number;
6
- currentIndex: number;
7
- deviceIndexes: number[];
8
- };
9
- timestamp: number | import("long").Long;
10
- };
11
- export declare const BufferJSON: {
12
- replacer: (_: string, value: valueReplacer) => valueReplacer | {
13
- type: string;
14
- data: string;
15
- };
16
- reviver: (_: string, value: valueReviver) => valueReviver | Buffer<ArrayBuffer>;
17
- };
18
- export declare const initAuthCreds: () => {
19
- noiseKey: {
20
- private: Buffer<any>;
21
- public: Buffer<any>;
22
- };
23
- pairingEphemeralKeyPair: {
24
- private: Buffer<any>;
25
- public: Buffer<any>;
26
- };
27
- signedIdentityKey: {
28
- private: Buffer<any>;
29
- public: Buffer<any>;
30
- };
31
- signedPreKey: {
32
- keyPair: {
33
- private: Buffer<any>;
34
- public: Buffer<any>;
35
- };
36
- signature: any;
37
- keyId: number;
38
- };
39
- registrationId: number;
40
- advSecretKey: string;
41
- processedHistoryMessages: never[];
42
- nextPreKeyId: number;
43
- firstUnuploadedPreKeyId: number;
44
- accountSyncCounter: number;
45
- accountSettings: {
46
- unarchiveChats: boolean;
47
- };
48
- deviceId: string;
49
- phoneId: `${string}-${string}-${string}-${string}-${string}`;
50
- identityId: Buffer<ArrayBufferLike>;
51
- backupToken: Buffer<ArrayBufferLike>;
52
- registered: boolean;
53
- registration: never;
54
- pairingCode: undefined;
55
- lastPropHash: undefined;
56
- routingInfo: undefined;
57
- };
@@ -1,8 +0,0 @@
1
- import { ZodError } from "zod";
2
- export declare const handleZodError: (error: ZodError) => {
3
- status: string;
4
- errors: {
5
- field: string;
6
- message: string;
7
- }[];
8
- };
package/dist/index.cjs.js DELETED
@@ -1 +0,0 @@
1
- "use strict";var e=require("baileys"),t=require("node-cache"),s=require("pino"),a=require("better-sqlite3"),n=require("fs"),r=require("kysely"),i=require("mysql2"),o=require("path"),d=require("pg"),c=require("url"),u=require("crypto"),l=require("libsignal");function h(e){return e&&e.__esModule?e:{default:e}}var p=h(e),m=h(t),f=h(s),y=h(a),g=h(i),v=h(o);const _=l.curve,x=()=>{const{pubKey:e,privKey:t}=_.generateKeyPair();return{private:Buffer.from(t),public:Buffer.from(e.slice(1))}},b=(e,t)=>{const s=x(),a=(e=>33===e.length?e:Buffer.concat([Buffer.from([5]),e]))(s.public),n=((e,t)=>_.calculateSignature(e,t))(e.private,a);return{keyPair:s,signature:n,keyId:t}},k=e=>"string"==typeof e?parseInt(e,10):e,w=e=>{const t={...e.fingerprint,deviceIndexes:Array.isArray(e.fingerprint.deviceIndexes)?e.fingerprint.deviceIndexes:[]},s={keyData:Array.isArray(e.keyData)?e.keyData:new Uint8Array,fingerprint:{rawId:t.rawId||0,currentIndex:t.rawId||0,deviceIndexes:t.deviceIndexes},timestamp:k(e.timestamp)};return"string"==typeof e.keyData&&(s.keyData=(e=>{let t=e.length;if(!t)return new Uint8Array(1);let s=0;for(;--t%4>1&&"="===e.charAt(t);)++s;return new Uint8Array(Math.ceil(3*e.length)/4-s).fill(0)})(e.keyData)),s},Z=(e,t)=>"Buffer"===t?.type&&Array.isArray(t?.data)?{type:"Buffer",data:Buffer.from(t?.data).toString("base64")}:t,T=(e,t)=>"Buffer"===t?.type?Buffer.from(t?.data,"base64"):t,C=async(e,t)=>{const s="auth";await(async e=>{await e.schema.createTable("auth").ifNotExists().addColumn("session","varchar(50)",(e=>e.notNull())).addColumn("id","varchar(80)",(e=>e.notNull())).addColumn("value","text",(e=>e.defaultTo(null))).addUniqueConstraint("auth_session_id_unique",["session","id"]).execute(),await e.schema.createTable("chats").ifNotExists().addColumn("session","varchar(50)",(e=>e.notNull())).addColumn("id","varchar(80)",(e=>e.notNull())).addColumn("value","text",(e=>e.defaultTo(null))).addUniqueConstraint("chats_session_id_unique",["session","id"]).execute(),await e.schema.createTable("contacts").ifNotExists().addColumn("session","varchar(50)",(e=>e.notNull())).addColumn("id","varchar(80)",(e=>e.notNull())).addColumn("value","text",(e=>e.defaultTo(null))).addUniqueConstraint("contacts_session_id_unique",["session","id"]).execute(),await e.schema.createTable("messages").ifNotExists().addColumn("session","varchar(50)",(e=>e.notNull())).addColumn("id","varchar(80)",(e=>e.notNull())).addColumn("value","text",(e=>e.defaultTo(null))).addUniqueConstraint("messages_session_id_unique",["session","id"]).execute(),await e.schema.createIndex("auth_session_idx").ifNotExists().on("auth").column("session").execute(),await e.schema.createIndex("auth_id_idx").ifNotExists().on("auth").column("id").execute(),await e.schema.createIndex("chats_session_idx").ifNotExists().on("chats").column("session").execute(),await e.schema.createIndex("chats_id_idx").ifNotExists().on("chats").column("id").execute(),await e.schema.createIndex("contacts_session_idx").ifNotExists().on("contacts").column("session").execute(),await e.schema.createIndex("contacts_id_idx").ifNotExists().on("contacts").column("id").execute(),await e.schema.createIndex("messages_session_idx").ifNotExists().on("messages").column("session").execute(),await e.schema.createIndex("messages_id_idx").ifNotExists().on("messages").column("id").execute()})(e);const a=async e=>{for(let t=0;t<10;t++)try{return await e()}catch{await new Promise((e=>setTimeout(e,200)))}throw new Error("Max retries reached")},n=async n=>{const r=await a((()=>e.selectFrom(s).select(["value"]).where("id","=",n).where("session","=",t).executeTakeFirst()));if(!r?.value)return null;const i="object"==typeof r.value?JSON.stringify(r.value):r.value;return JSON.parse(i,T)},r=async(n,r)=>{const i=JSON.stringify(r,Z);await a((()=>e.insertInto(s).values({session:t,id:n,value:i}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:i}))).execute()))},i=async n=>{await a((()=>e.deleteFrom(s).where("id","=",n).where("session","=",t).execute()))},o=await n("creds")||(()=>{const e=x();return{noiseKey:x(),pairingEphemeralKeyPair:x(),signedIdentityKey:e,signedPreKey:b(e,1),registrationId:16383&Uint16Array.from(u.randomBytes(2))[0],advSecretKey:u.randomBytes(32).toString("base64"),processedHistoryMessages:[],nextPreKeyId:1,firstUnuploadedPreKeyId:1,accountSyncCounter:0,accountSettings:{unarchiveChats:!1},deviceId:Buffer.from(u.randomUUID().replace(/-/g,""),"hex").toString("base64url"),phoneId:u.randomUUID(),identityId:u.randomBytes(20),backupToken:u.randomBytes(20),registered:!1,registration:{},pairingCode:void 0,lastPropHash:void 0,routingInfo:void 0}})();return{state:{creds:o,keys:{get:async(e,t)=>{const s={};for(const a of t){let t=await n(`${e}-${a}`);"app-state-sync-key"===e&&t&&(t=w(t)),s[a]=t}return s},set:async e=>{for(const t in e)for(const s in e[t]){const a=e[t][s],n=`${t}-${s}`;a?await r(n,a):await i(n)}}}},saveCreds:async()=>{await r("creds",o)},clear:async()=>{await(async()=>{await a((()=>e.deleteFrom(s).where("session","=",t).where("id","!=","creds").execute()))})()},removeCreds:async()=>{await(async()=>{await a((()=>e.deleteFrom(s).where("session","=",t).execute()))})()}}};var N,O,S;(O=N||(N={})).assertEqual=e=>e,O.assertIs=function(e){},O.assertNever=function(e){throw new Error},O.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},O.getValidEnumValues=e=>{const t=O.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),s={};for(const a of t)s[a]=e[a];return O.objectValues(s)},O.objectValues=e=>O.objectKeys(e).map((function(t){return e[t]})),O.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},O.find=(e,t)=>{for(const s of e)if(t(s))return s},O.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,O.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},O.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(S||(S={})).mergeShapes=(e,t)=>({...e,...t});const I=N.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),A=e=>{switch(typeof e){case"undefined":return I.undefined;case"string":return I.string;case"number":return isNaN(e)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":return Array.isArray(e)?I.array:null===e?I.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?I.promise:typeof Map<"u"&&e instanceof Map?I.map:typeof Set<"u"&&e instanceof Set?I.set:typeof Date<"u"&&e instanceof Date?I.date:I.object;default:return I.unknown}},E=N.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 j extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};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(e){return e.message},s={_errors:[]},a=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)s._errors.push(t(n));else{let e=s,a=0;for(;a<n.path.length;){const s=n.path[a];a===n.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(n))):e[s]=e[s]||{_errors:[]},e=e[s],a++}}};return a(this),s}static assert(e){if(!(e instanceof j))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,N.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},s=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}j.create=e=>new j(e);const P=(e,t)=>{let s;switch(e.code){case E.invalid_type:s=e.received===I.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case E.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,N.jsonStringifyReplacer)}`;break;case E.unrecognized_keys:s=`Unrecognized key(s) in object: ${N.joinValues(e.keys,", ")}`;break;case E.invalid_union:s="Invalid input";break;case E.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${N.joinValues(e.options)}`;break;case E.invalid_enum_value:s=`Invalid enum value. Expected ${N.joinValues(e.options)}, received '${e.received}'`;break;case E.invalid_arguments:s="Invalid function arguments";break;case E.invalid_return_type:s="Invalid function return type";break;case E.invalid_date:s="Invalid date";break;case E.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:N.assertNever(e.validation):s="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case E.too_small:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case E.too_big:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case E.custom:s="Invalid input";break;case E.invalid_intersection_types:s="Intersection results could not be merged";break;case E.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case E.not_finite:s="Number must be finite";break;default:s=t.defaultError,N.assertNever(e)}return{message:s}};let R=P;function $(){return R}const M=e=>{const{data:t,path:s,errorMaps:a,issueData:n}=e,r=[...s,...n.path||[]],i={...n,path:r};if(void 0!==n.message)return{...n,path:r,message:n.message};let o="";const d=a.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:r,message:o}};function F(e,t){const s=$(),a=M({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s,s===P?void 0:P].filter((e=>!!e))});e.common.issues.push(a)}class D{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if("aborted"===a.status)return U;"dirty"===a.status&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const e of t){const t=await e.key,a=await e.value;s.push({key:t,value:a})}return D.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:t,value:n}=a;if("aborted"===t.status||"aborted"===n.status)return U;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"!==t.value&&(typeof n.value<"u"||a.alwaysSet)&&(s[t.value]=n.value)}return{status:e.value,value:s}}}const U=Object.freeze({status:"aborted"}),L=e=>({status:"dirty",value:e}),q=e=>({status:"valid",value:e}),z=e=>"aborted"===e.status,K=e=>"dirty"===e.status,V=e=>"valid"===e.status,B=e=>typeof Promise<"u"&&e instanceof Promise;function J(e,t,s,a){if("a"===s&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?a:"a"===s?a.call(e):a?a.value:t.get(e)}function W(e,t,s,a,n){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?n.call(e,s):n?n.value=s:t.set(e,s),s}var H,Y,G;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(H||(H={}));class Q{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const X=(e,t)=>{if(V(t))return{success:!0,data:t.value};if(!e.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 j(e.common.issues);return this._error=t,this._error}}};function ee(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:a,description:n}=e;if(t&&(s||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(t,n)=>{var r,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:o??n.defaultError}:typeof n.data>"u"?{message:null!==(r=o??a)&&void 0!==r?r:n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:null!==(i=o??s)&&void 0!==i?i:n.defaultError}},description:n}}class te{get description(){return this._def.description}_getType(e){return A(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new D,ctx:{common:e.parent.common,data:e.data,parsedType:A(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(B(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){var s;const a={common:{issues:[],async:null!==(s=t?.async)&&void 0!==s&&s,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)},n=this._parseSync({data:e,path:a.path,parent:a});return X(a,n)}"~validate"(e){var t,s;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:A(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return V(t)?{value:t.value}:{issues:a.common.issues}}catch(e){!(null===(s=null===(t=e?.message)||void 0===t?void 0:t.toLowerCase())||void 0===s)&&s.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then((e=>V(e)?{value:e.value}:{issues:a.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:A(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(B(a)?a:Promise.resolve(a));return X(s,n)}refine(e,t){const s=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const n=e(t),r=()=>a.addIssue({code:E.custom,...s(t)});return typeof Promise<"u"&&n instanceof Promise?n.then((e=>!!e||(r(),!1))):!!n||(r(),!1)}))}refinement(e,t){return this._refinement(((s,a)=>!!e(s)||(a.addIssue("function"==typeof t?t(s,a):t),!1)))}_refinement(e){return new at({schema:this,typeName:yt.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:e=>this["~validate"](e)}}optional(){return nt.create(this,this._def)}nullable(){return rt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fe.create(this)}promise(){return st.create(this,this._def)}or(e){return Le.create([this,e],this._def)}and(e){return Ve.create(this,e,this._def)}transform(e){return new at({...ee(this._def),schema:this,typeName:yt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new it({...ee(this._def),innerType:this,defaultValue:t,typeName:yt.ZodDefault})}brand(){return new ut({typeName:yt.ZodBranded,type:this,...ee(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ot({...ee(this._def),innerType:this,catchValue:t,typeName:yt.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return lt.create(this,e)}readonly(){return ht.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const se=/^c[^\s-]{8,}$/i,ae=/^[0-9a-z]+$/,ne=/^[0-9A-HJKMNP-TV-Z]{26}$/i,re=/^[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,ie=/^[a-z0-9_-]{21}$/i,oe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,de=/^[-+]?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)?)??$/,ce=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let ue;const le=/^(?:(?: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])$/,he=/^(?:(?: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])$/,pe=/^(([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]))$/,me=/^(([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])$/,fe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ye=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ge="((\\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])))",ve=new RegExp(`^${ge}$`);function _e(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function xe(e){return new RegExp(`^${_e(e)}$`)}function be(e){let t=`${ge}T${_e(e)}`;const s=[];return s.push(e.local?"Z?":"Z"),e.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function ke(e,t){return!(("v4"!==t&&t||!le.test(e))&&("v6"!==t&&t||!pe.test(e)))}function we(e,t){if(!oe.test(e))return!1;try{const[s]=e.split("."),a=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),n=JSON.parse(atob(a));return!("object"!=typeof n||null===n||!n.typ||!n.alg||t&&n.alg!==t)}catch{return!1}}function Ze(e,t){return!(("v4"!==t&&t||!he.test(e))&&("v6"!==t&&t||!me.test(e)))}class Te extends te{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==I.string){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.string,received:t.parsedType}),U}const t=new D;let s;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),F(s,{code:E.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),F(s,{code:E.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const n=e.data.length>a.value,r=e.data.length<a.value;(n||r)&&(s=this._getOrReturnCtx(e,s),n?F(s,{code:E.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):r&&F(s,{code:E.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)ce.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"email",code:E.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)ue||(ue=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ue.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"emoji",code:E.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)re.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"uuid",code:E.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)ie.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"nanoid",code:E.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)se.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"cuid",code:E.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)ae.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"cuid2",code:E.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)ne.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"ulid",code:E.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),F(s,{validation:"url",code:E.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"regex",code:E.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),F(s,{code:E.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),F(s,{code:E.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),F(s,{code:E.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?be(a).test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{code:E.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?ve.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{code:E.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?xe(a).test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{code:E.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?de.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"duration",code:E.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?ke(e.data,a.version)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"ip",code:E.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?we(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"jwt",code:E.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?Ze(e.data,a.version)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"cidr",code:E.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?fe.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"base64",code:E.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?ye.test(e.data)||(s=this._getOrReturnCtx(e,s),F(s,{validation:"base64url",code:E.invalid_string,message:a.message}),t.dirty()):N.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement((t=>e.test(t)),{validation:t,code:E.invalid_string,...H.errToObj(s)})}_addCheck(e){return new Te({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...H.errToObj(e)})}url(e){return this._addCheck({kind:"url",...H.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...H.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...H.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...H.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...H.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...H.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...H.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...H.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...H.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...H.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...H.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...H.errToObj(e)})}datetime(e){var t,s;return"string"==typeof e?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:null!==(t=e?.offset)&&void 0!==t&&t,local:null!==(s=e?.local)&&void 0!==s&&s,...H.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...H.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...H.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...H.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...H.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...H.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...H.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...H.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...H.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...H.errToObj(t)})}nonempty(e){return this.min(1,H.errToObj(e))}trim(){return new Te({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Te({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Te({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Ce(e,t){const s=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=s>a?s:a;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}Te.create=e=>{var t;return new Te({checks:[],typeName:yt.ZodString,coerce:null!==(t=e?.coerce)&&void 0!==t&&t,...ee(e)})};class Ne 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)!==I.number){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.number,received:t.parsedType}),U}let t;const s=new D;for(const a of this._def.checks)"int"===a.kind?N.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),F(t,{code:E.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),F(t,{code:E.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),F(t,{code:E.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):"multipleOf"===a.kind?0!==Ce(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),F(t,{code:E.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),F(t,{code:E.not_finite,message:a.message}),s.dirty()):N.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,H.toString(t))}gt(e,t){return this.setLimit("min",e,!1,H.toString(t))}lte(e,t){return this.setLimit("max",e,!0,H.toString(t))}lt(e,t){return this.setLimit("max",e,!1,H.toString(t))}setLimit(e,t,s,a){return new Ne({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:H.toString(a)}]})}_addCheck(e){return new Ne({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:H.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:H.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:H.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:H.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:H.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&N.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Ne.create=e=>new Ne({checks:[],typeName:yt.ZodNumber,coerce:e?.coerce||!1,...ee(e)});class Oe 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)!==I.bigint)return this._getInvalidInput(e);let t;const s=new D;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),F(t,{code:E.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),F(t,{code:E.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),F(t,{code:E.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):N.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.bigint,received:t.parsedType}),U}gte(e,t){return this.setLimit("min",e,!0,H.toString(t))}gt(e,t){return this.setLimit("min",e,!1,H.toString(t))}lte(e,t){return this.setLimit("max",e,!0,H.toString(t))}lt(e,t){return this.setLimit("max",e,!1,H.toString(t))}setLimit(e,t,s,a){return new Oe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:H.toString(a)}]})}_addCheck(e){return new Oe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:H.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Oe.create=e=>{var t;return new Oe({checks:[],typeName:yt.ZodBigInt,coerce:null!==(t=e?.coerce)&&void 0!==t&&t,...ee(e)})};class Se extends te{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==I.boolean){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.boolean,received:t.parsedType}),U}return q(e.data)}}Se.create=e=>new Se({typeName:yt.ZodBoolean,coerce:e?.coerce||!1,...ee(e)});class Ie extends te{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==I.date){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.date,received:t.parsedType}),U}if(isNaN(e.data.getTime())){return F(this._getOrReturnCtx(e),{code:E.invalid_date}),U}const t=new D;let s;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),F(s,{code:E.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),F(s,{code:E.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):N.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:H.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:H.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Ie.create=e=>new Ie({checks:[],coerce:e?.coerce||!1,typeName:yt.ZodDate,...ee(e)});class Ae extends te{_parse(e){if(this._getType(e)!==I.symbol){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.symbol,received:t.parsedType}),U}return q(e.data)}}Ae.create=e=>new Ae({typeName:yt.ZodSymbol,...ee(e)});class Ee extends te{_parse(e){if(this._getType(e)!==I.undefined){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.undefined,received:t.parsedType}),U}return q(e.data)}}Ee.create=e=>new Ee({typeName:yt.ZodUndefined,...ee(e)});class je extends te{_parse(e){if(this._getType(e)!==I.null){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.null,received:t.parsedType}),U}return q(e.data)}}je.create=e=>new je({typeName:yt.ZodNull,...ee(e)});class Pe extends te{constructor(){super(...arguments),this._any=!0}_parse(e){return q(e.data)}}Pe.create=e=>new Pe({typeName:yt.ZodAny,...ee(e)});class Re extends te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return q(e.data)}}Re.create=e=>new Re({typeName:yt.ZodUnknown,...ee(e)});class $e extends te{_parse(e){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.never,received:t.parsedType}),U}}$e.create=e=>new $e({typeName:yt.ZodNever,...ee(e)});class Me extends te{_parse(e){if(this._getType(e)!==I.undefined){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.void,received:t.parsedType}),U}return q(e.data)}}Me.create=e=>new Me({typeName:yt.ZodVoid,...ee(e)});class Fe extends te{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==I.array)return F(t,{code:E.invalid_type,expected:I.array,received:t.parsedType}),U;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,n=t.data.length<a.exactLength.value;(e||n)&&(F(t,{code:e?E.too_big:E.too_small,minimum:n?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(F(t,{code:E.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(F(t,{code:E.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map(((e,s)=>a.type._parseAsync(new Q(t,e,t.path,s))))).then((e=>D.mergeArray(s,e)));const n=[...t.data].map(((e,s)=>a.type._parseSync(new Q(t,e,t.path,s))));return D.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new Fe({...this._def,minLength:{value:e,message:H.toString(t)}})}max(e,t){return new Fe({...this._def,maxLength:{value:e,message:H.toString(t)}})}length(e,t){return new Fe({...this._def,exactLength:{value:e,message:H.toString(t)}})}nonempty(e){return this.min(1,e)}}function De(e){if(e instanceof Ue){const t={};for(const s in e.shape){const a=e.shape[s];t[s]=nt.create(De(a))}return new Ue({...e._def,shape:()=>t})}return e instanceof Fe?new Fe({...e._def,type:De(e.element)}):e instanceof nt?nt.create(De(e.unwrap())):e instanceof rt?rt.create(De(e.unwrap())):e instanceof Be?Be.create(e.items.map((e=>De(e)))):e}Fe.create=(e,t)=>new Fe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:yt.ZodArray,...ee(t)});class Ue extends te{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=N.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==I.object){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.object,received:t.parsedType}),U}const{status:t,ctx:s}=this._processInputParams(e),{shape:a,keys:n}=this._getCached(),r=[];if(!(this._def.catchall instanceof $e&&"strip"===this._def.unknownKeys))for(const e in s.data)n.includes(e)||r.push(e);const i=[];for(const e of n){const t=a[e],n=s.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new Q(s,n,s.path,e)),alwaysSet:e in s.data})}if(this._def.catchall instanceof $e){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)i.push({key:{status:"valid",value:e},value:{status:"valid",value:s.data[e]}});else if("strict"===e)r.length>0&&(F(s,{code:E.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=s.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new Q(s,a,s.path,t)),alwaysSet:t in s.data})}}return s.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of i){const s=await t.key,a=await t.value;e.push({key:s,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>D.mergeObjectSync(t,e))):D.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return new Ue({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{var a,n,r,i;const o=null!==(r=null===(n=(a=this._def).errorMap)||void 0===n?void 0:n.call(a,t,s).message)&&void 0!==r?r:s.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=H.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}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:yt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ue({...this._def,catchall:e})}pick(e){const t={};return N.objectKeys(e).forEach((s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])})),new Ue({...this._def,shape:()=>t})}omit(e){const t={};return N.objectKeys(this.shape).forEach((s=>{e[s]||(t[s]=this.shape[s])})),new Ue({...this._def,shape:()=>t})}deepPartial(){return De(this)}partial(e){const t={};return N.objectKeys(this.shape).forEach((s=>{const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()})),new Ue({...this._def,shape:()=>t})}required(e){const t={};return N.objectKeys(this.shape).forEach((s=>{if(e&&!e[s])t[s]=this.shape[s];else{let e=this.shape[s];for(;e instanceof nt;)e=e._def.innerType;t[s]=e}})),new Ue({...this._def,shape:()=>t})}keyof(){return Xe(N.objectKeys(this.shape))}}Ue.create=(e,t)=>new Ue({shape:()=>e,unknownKeys:"strip",catchall:$e.create(),typeName:yt.ZodObject,...ee(t)}),Ue.strictCreate=(e,t)=>new Ue({shape:()=>e,unknownKeys:"strict",catchall:$e.create(),typeName:yt.ZodObject,...ee(t)}),Ue.lazycreate=(e,t)=>new Ue({shape:e,unknownKeys:"strip",catchall:$e.create(),typeName:yt.ZodObject,...ee(t)});class Le extends te{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map((async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const s=e.map((e=>new j(e.ctx.common.issues)));return F(t,{code:E.invalid_union,unionErrors:s}),U}));{let e;const a=[];for(const n of s){const s={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:s});if("valid"===r.status)return r;"dirty"===r.status&&!e&&(e={result:r,ctx:s}),s.common.issues.length&&a.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=a.map((e=>new j(e)));return F(t,{code:E.invalid_union,unionErrors:n}),U}}get options(){return this._def.options}}Le.create=(e,t)=>new Le({options:e,typeName:yt.ZodUnion,...ee(t)});const qe=e=>e instanceof Ge?qe(e.schema):e instanceof at?qe(e.innerType()):e instanceof Qe?[e.value]:e instanceof et?e.options:e instanceof tt?N.objectValues(e.enum):e instanceof it?qe(e._def.innerType):e instanceof Ee?[void 0]:e instanceof je?[null]:e instanceof nt?[void 0,...qe(e.unwrap())]:e instanceof rt?[null,...qe(e.unwrap())]:e instanceof ut||e instanceof ht?qe(e.unwrap()):e instanceof ot?qe(e._def.innerType):[];class ze extends te{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.object)return F(t,{code:E.invalid_type,expected:I.object,received:t.parsedType}),U;const s=this.discriminator,a=t.data[s],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(F(t,{code:E.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),U)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const s of t){const t=qe(s.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(a.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);a.set(n,s)}}return new ze({typeName:yt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...ee(s)})}}function Ke(e,t){const s=A(e),a=A(t);if(e===t)return{valid:!0,data:e};if(s===I.object&&a===I.object){const s=N.objectKeys(t),a=N.objectKeys(e).filter((e=>-1!==s.indexOf(e))),n={...e,...t};for(const s of a){const a=Ke(e[s],t[s]);if(!a.valid)return{valid:!1};n[s]=a.data}return{valid:!0,data:n}}if(s===I.array&&a===I.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let a=0;a<e.length;a++){const n=Ke(e[a],t[a]);if(!n.valid)return{valid:!1};s.push(n.data)}return{valid:!0,data:s}}return s===I.date&&a===I.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Ve extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(e,a)=>{if(z(e)||z(a))return U;const n=Ke(e.value,a.value);return n.valid?((K(e)||K(a))&&t.dirty(),{status:t.value,value:n.data}):(F(s,{code:E.invalid_intersection_types}),U)};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((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Ve.create=(e,t,s)=>new Ve({left:e,right:t,typeName:yt.ZodIntersection,...ee(s)});class Be extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==I.array)return F(s,{code:E.invalid_type,expected:I.array,received:s.parsedType}),U;if(s.data.length<this._def.items.length)return F(s,{code:E.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;!this._def.rest&&s.data.length>this._def.items.length&&(F(s,{code:E.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new Q(s,e,s.path,t)):null})).filter((e=>!!e));return s.common.async?Promise.all(a).then((e=>D.mergeArray(t,e))):D.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Be({...this._def,rest:e})}}Be.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Be({items:e,typeName:yt.ZodTuple,rest:null,...ee(t)})};class Je 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!==I.object)return F(s,{code:E.invalid_type,expected:I.object,received:s.parsedType}),U;const a=[],n=this._def.keyType,r=this._def.valueType;for(const e in s.data)a.push({key:n._parse(new Q(s,e,s.path,e)),value:r._parse(new Q(s,s.data[e],s.path,e)),alwaysSet:e in s.data});return s.common.async?D.mergeObjectAsync(t,a):D.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return new Je(t instanceof te?{keyType:e,valueType:t,typeName:yt.ZodRecord,...ee(s)}:{keyType:Te.create(),valueType:e,typeName:yt.ZodRecord,...ee(t)})}}class We 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!==I.map)return F(s,{code:E.invalid_type,expected:I.map,received:s.parsedType}),U;const a=this._def.keyType,n=this._def.valueType,r=[...s.data.entries()].map((([e,t],r)=>({key:a._parse(new Q(s,e,s.path,[r,"key"])),value:n._parse(new Q(s,t,s.path,[r,"value"]))})));if(s.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const s of r){const a=await s.key,n=await s.value;if("aborted"===a.status||"aborted"===n.status)return U;("dirty"===a.status||"dirty"===n.status)&&t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const s of r){const a=s.key,n=s.value;if("aborted"===a.status||"aborted"===n.status)return U;("dirty"===a.status||"dirty"===n.status)&&t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}We.create=(e,t,s)=>new We({valueType:t,keyType:e,typeName:yt.ZodMap,...ee(s)});class He extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==I.set)return F(s,{code:E.invalid_type,expected:I.set,received:s.parsedType}),U;const a=this._def;null!==a.minSize&&s.data.size<a.minSize.value&&(F(s,{code:E.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&s.data.size>a.maxSize.value&&(F(s,{code:E.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function r(e){const s=new Set;for(const a of e){if("aborted"===a.status)return U;"dirty"===a.status&&t.dirty(),s.add(a.value)}return{status:t.value,value:s}}const i=[...s.data.values()].map(((e,t)=>n._parse(new Q(s,e,s.path,t))));return s.common.async?Promise.all(i).then((e=>r(e))):r(i)}min(e,t){return new He({...this._def,minSize:{value:e,message:H.toString(t)}})}max(e,t){return new He({...this._def,maxSize:{value:e,message:H.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}He.create=(e,t)=>new He({valueType:e,minSize:null,maxSize:null,typeName:yt.ZodSet,...ee(t)});class Ye extends te{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.function)return F(t,{code:E.invalid_type,expected:I.function,received:t.parsedType}),U;function s(e,s){return M({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,$(),P].filter((e=>!!e)),issueData:{code:E.invalid_arguments,argumentsError:s}})}function a(e,s){return M({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,$(),P].filter((e=>!!e)),issueData:{code:E.invalid_return_type,returnTypeError:s}})}const n={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof st){const e=this;return q((async function(...t){const i=new j([]),o=await e._def.args.parseAsync(t,n).catch((e=>{throw i.addIssue(s(t,e)),i})),d=await Reflect.apply(r,this,o);return await e._def.returns._def.type.parseAsync(d,n).catch((e=>{throw i.addIssue(a(d,e)),i}))}))}{const e=this;return q((function(...t){const i=e._def.args.safeParse(t,n);if(!i.success)throw new j([s(t,i.error)]);const o=Reflect.apply(r,this,i.data),d=e._def.returns.safeParse(o,n);if(!d.success)throw new j([a(o,d.error)]);return d.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ye({...this._def,args:Be.create(e).rest(Re.create())})}returns(e){return new Ye({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new Ye({args:e||Be.create([]).rest(Re.create()),returns:t||Re.create(),typeName:yt.ZodFunction,...ee(s)})}}class Ge 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})}}Ge.create=(e,t)=>new Ge({getter:e,typeName:yt.ZodLazy,...ee(t)});class Qe extends te{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return F(t,{received:t.data,code:E.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Xe(e,t){return new et({values:e,typeName:yt.ZodEnum,...ee(t)})}Qe.create=(e,t)=>new Qe({value:e,typeName:yt.ZodLiteral,...ee(t)});class et extends te{constructor(){super(...arguments),Y.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),s=this._def.values;return F(t,{expected:N.joinValues(s),received:t.parsedType,code:E.invalid_type}),U}if(J(this,Y,"f")||W(this,Y,new Set(this._def.values),"f"),!J(this,Y,"f").has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return F(t,{received:t.data,code:E.invalid_enum_value,options:s}),U}return q(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 et.create(e,{...this._def,...t})}exclude(e,t=this._def){return et.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Y=new WeakMap,et.create=Xe;class tt extends te{constructor(){super(...arguments),G.set(this,void 0)}_parse(e){const t=N.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==I.string&&s.parsedType!==I.number){const e=N.objectValues(t);return F(s,{expected:N.joinValues(e),received:s.parsedType,code:E.invalid_type}),U}if(J(this,G,"f")||W(this,G,new Set(N.getValidEnumValues(this._def.values)),"f"),!J(this,G,"f").has(e.data)){const e=N.objectValues(t);return F(s,{received:s.data,code:E.invalid_enum_value,options:e}),U}return q(e.data)}get enum(){return this._def.values}}G=new WeakMap,tt.create=(e,t)=>new tt({values:e,typeName:yt.ZodNativeEnum,...ee(t)});class st extends te{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==I.promise&&!1===t.common.async)return F(t,{code:E.invalid_type,expected:I.promise,received:t.parsedType}),U;const s=t.parsedType===I.promise?t.data:Promise.resolve(t.data);return q(s.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}st.create=(e,t)=>new st({type:e,typeName:yt.ZodPromise,...ee(t)});class at extends te{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===yt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:e=>{F(s,e),e.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===a.type){const e=a.transform(s.data,n);if(s.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return U;const a=await this._def.schema._parseAsync({data:e,path:s.path,parent:s});return"aborted"===a.status?U:"dirty"===a.status||"dirty"===t.value?L(a.value):a}));{if("aborted"===t.value)return U;const a=this._def.schema._parseSync({data:e,path:s.path,parent:s});return"aborted"===a.status?U:"dirty"===a.status||"dirty"===t.value?L(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,n);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===a.status?U:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((s=>"aborted"===s.status?U:("dirty"===s.status&&t.dirty(),e(s.value).then((()=>({status:t.value,value:s.value}))))))}if("transform"===a.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!V(e))return e;const r=a.transform(e.value,n);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>V(e)?Promise.resolve(a.transform(e.value,n)).then((e=>({status:t.value,value:e}))):e))}N.assertNever(a)}}at.create=(e,t,s)=>new at({schema:e,typeName:yt.ZodEffects,effect:t,...ee(s)}),at.createWithPreprocess=(e,t,s)=>new at({schema:t,effect:{type:"preprocess",transform:e},typeName:yt.ZodEffects,...ee(s)});class nt extends te{_parse(e){return this._getType(e)===I.undefined?q(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}nt.create=(e,t)=>new nt({innerType:e,typeName:yt.ZodOptional,...ee(t)});class rt extends te{_parse(e){return this._getType(e)===I.null?q(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rt.create=(e,t)=>new rt({innerType:e,typeName:yt.ZodNullable,...ee(t)});class it extends te{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===I.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}it.create=(e,t)=>new it({innerType:e,typeName:yt.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...ee(t)});class ot extends te{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return B(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new j(s.common.issues)},input:s.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new j(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}ot.create=(e,t)=>new ot({innerType:e,typeName:yt.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...ee(t)});class dt extends te{_parse(e){if(this._getType(e)!==I.nan){const t=this._getOrReturnCtx(e);return F(t,{code:E.invalid_type,expected:I.nan,received:t.parsedType}),U}return{status:"valid",value:e.data}}}dt.create=e=>new dt({typeName:yt.ZodNaN,...ee(e)});const ct=Symbol("zod_brand");class ut 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 lt extends te{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?U:"dirty"===e.status?(t.dirty(),L(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})();{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?U:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new lt({in:e,out:t,typeName:yt.ZodPipeline})}}class ht extends te{_parse(e){const t=this._def.innerType._parse(e),s=e=>(V(e)&&(e.value=Object.freeze(e.value)),e);return B(t)?t.then((e=>s(e))):s(t)}unwrap(){return this._def.innerType}}function pt(e,t){const s="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof s?{message:s}:s}function mt(e,t={},s){return e?Pe.create().superRefine(((a,n)=>{var r,i;const o=e(a);if(o instanceof Promise)return o.then((e=>{var r,i;if(!e){const e=pt(t,a),o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:s)||void 0===i||i;n.addIssue({code:"custom",...e,fatal:o})}}));if(!o){const e=pt(t,a),o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:s)||void 0===i||i;n.addIssue({code:"custom",...e,fatal:o})}})):Pe.create()}ht.create=(e,t)=>new ht({innerType:e,typeName:yt.ZodReadonly,...ee(t)});const ft={object:Ue.lazycreate};var yt;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(yt||(yt={}));const gt=Te.create,vt=Ne.create,_t=dt.create,xt=Oe.create,bt=Se.create,kt=Ie.create,wt=Ae.create,Zt=Ee.create,Tt=je.create,Ct=Pe.create,Nt=Re.create,Ot=$e.create,St=Me.create,It=Fe.create,At=Ue.create,Et=Ue.strictCreate,jt=Le.create,Pt=ze.create,Rt=Ve.create,$t=Be.create,Mt=Je.create,Ft=We.create,Dt=He.create,Ut=Ye.create,Lt=Ge.create,qt=Qe.create,zt=et.create,Kt=tt.create,Vt=st.create,Bt=at.create,Jt=nt.create,Wt=rt.create,Ht=at.createWithPreprocess,Yt=lt.create,Gt={string:e=>Te.create({...e,coerce:!0}),number:e=>Ne.create({...e,coerce:!0}),boolean:e=>Se.create({...e,coerce:!0}),bigint:e=>Oe.create({...e,coerce:!0}),date:e=>Ie.create({...e,coerce:!0})},Qt=U;var Xt=Object.freeze({__proto__:null,defaultErrorMap:P,setErrorMap:function(e){R=e},getErrorMap:$,makeIssue:M,EMPTY_PATH:[],addIssueToContext:F,ParseStatus:D,INVALID:U,DIRTY:L,OK:q,isAborted:z,isDirty:K,isValid:V,isAsync:B,get util(){return N},get objectUtil(){return S},ZodParsedType:I,getParsedType:A,ZodType:te,datetimeRegex:be,ZodString:Te,ZodNumber:Ne,ZodBigInt:Oe,ZodBoolean:Se,ZodDate:Ie,ZodSymbol:Ae,ZodUndefined:Ee,ZodNull:je,ZodAny:Pe,ZodUnknown:Re,ZodNever:$e,ZodVoid:Me,ZodArray:Fe,ZodObject:Ue,ZodUnion:Le,ZodDiscriminatedUnion:ze,ZodIntersection:Ve,ZodTuple:Be,ZodRecord:Je,ZodMap:We,ZodSet:He,ZodFunction:Ye,ZodLazy:Ge,ZodLiteral:Qe,ZodEnum:et,ZodNativeEnum:tt,ZodPromise:st,ZodEffects:at,ZodTransformer:at,ZodOptional:nt,ZodNullable:rt,ZodDefault:it,ZodCatch:ot,ZodNaN:dt,BRAND:ct,ZodBranded:ut,ZodPipeline:lt,ZodReadonly:ht,custom:mt,Schema:te,ZodSchema:te,late:ft,get ZodFirstPartyTypeKind(){return yt},coerce:Gt,any:Ct,array:It,bigint:xt,boolean:bt,date:kt,discriminatedUnion:Pt,effect:Bt,enum:zt,function:Ut,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>mt((t=>t instanceof e),t),intersection:Rt,lazy:Lt,literal:qt,map:Ft,nan:_t,nativeEnum:Kt,never:Ot,null:Tt,nullable:Wt,number:vt,object:At,oboolean:()=>bt().optional(),onumber:()=>vt().optional(),optional:Jt,ostring:()=>gt().optional(),pipeline:Yt,preprocess:Ht,promise:Vt,record:Mt,set:Dt,strictObject:Et,string:gt,symbol:wt,transformer:Bt,tuple:$t,undefined:Zt,union:jt,unknown:Nt,void:St,NEVER:Qt,ZodIssueCode:E,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:j});const es=Xt.object({type:Xt.enum(["sqlite","postgresql","mysql"]).default("sqlite"),connection:Xt.object({url:Xt.string().default("./zaileys.db")}).optional().default({})}).optional().default({}),ts={prefix:Xt.string().optional(),ignoreMe:Xt.boolean().optional().default(!0),showLogs:Xt.boolean().optional().default(!0),autoMentions:Xt.boolean().optional().default(!0),autoOnline:Xt.boolean().optional().default(!0),autoRead:Xt.boolean().optional().default(!0),autoRejectCall:Xt.boolean().optional().default(!0),database:es,citation:Xt.record(Xt.function().returns(Xt.union([Xt.number().array(),Xt.promise(Xt.number().array())]))).optional().transform((async e=>{const t={};if(e)for(const s of Object.keys(e)){const a=`is${s.charAt(0).toUpperCase()+s.slice(1)}`,n=await e[s]();t[a]=n}return t}))},ss=Xt.object({authType:Xt.literal("pairing"),phoneNumber:Xt.number(),...ts}),as=Xt.object({authType:Xt.literal("qr"),phoneNumber:Xt.undefined().optional(),...ts}),ns=Xt.discriminatedUnion("authType",[ss,as]);var rs=class{client;events=new Map;constructor(e){this.client=e}setup(t){t.ev.on("connection.update",(async t=>{const{connection:s,lastDisconnect:a,qr:n}=t;if(this.emit("connection",{status:s||"connecting"}),"qr"==this.client.options?.authType&&n&&console.log("Scan qrcode with your whatsapp: "),"close"===s){const t=a?.error?.output?.statusCode,s=t!==e.DisconnectReason.loggedOut;if(console.log(a?.error?.message),401==t||405==t||500==t)return;s&&await this.client.initialize()}else"open"===s&&this.emit("connection",{status:"open"})})),t.ev.on("messages.upsert",(({messages:e})=>{this.emit("messages",e)})),t.ev.on("call",(e=>{this.emit("call",e)}))}on(e,t){this.events.has(e)||this.events.set(e,[]),this.events.get(e).push(t)}emit(e,t){(this.events.get(e)||[]).forEach((e=>e(t)))}};var is=class{props;options;chatId="zaileys-chats";logger=f.default({level:"silent",enabled:!1});event;db;socket;groupCache=new m.default({stdTTL:300,useClones:!1});constructor(e){this.props=e,this.initialize(),this.event=new rs(this)}async initialize(){this.options=await ns.parseAsync(this.props),this.db=((e,t)=>{if("sqlite"===e){const e=t||"./db/zaileys.db",s=v.default.resolve(e);return n.mkdirSync(v.default.dirname(s),{recursive:!0}),n.writeFileSync(s,"",{flag:"a"}),new r.Kysely({dialect:new r.SqliteDialect({database:new y.default(s)})})}const s=new c.URL(t),a=s.protocol.replace(":","");if("mysql"===e)return new r.Kysely({dialect:new r.MysqlDialect({pool:g.default.createPool({host:s.hostname,user:s.username,password:s.password,database:s.pathname.replace("/",""),port:parseInt(s.port||"3306",10)})})});if("postgresql"===e)return new r.Kysely({dialect:new r.PostgresDialect({pool:new d.Pool({host:s.hostname,user:s.username,password:s.password,database:s.pathname.replace("/",""),port:parseInt(s.port||"5432",10)})})});throw new Error(`Unsupported database protocol: ${a}`)})(this.options.database.type,this.options.database.connection.url);const{state:t,saveCreds:s,removeCreds:a}=await C(this.db,this.chatId),i=await(async(e,t)=>({bind:s=>{s.on("messaging-history.set",(async s=>{const{chats:a,contacts:n,messages:r}=s;for(const s of a)await e.insertInto("chats").values({session:t,id:s.id,value:JSON.stringify(s)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(s)}))).execute();for(const s of n)await e.insertInto("contacts").values({session:t,id:s.id,value:JSON.stringify(s)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(s)}))).execute();for(const s of r)await e.insertInto("messages").values({session:t,id:s.key.id,value:JSON.stringify(s)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(s)}))).execute()})),s.on("messages.upsert",(async({messages:s})=>{for(const a of s)await e.insertInto("messages").values({session:t,id:a.key.id,value:JSON.stringify(a)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(a)}))).execute()})),s.on("chats.upsert",(async s=>{for(const a of s)await e.insertInto("chats").values({session:t,id:a.id,value:JSON.stringify(a)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(a)}))).execute()})),s.on("contacts.upsert",(async s=>{for(const a of s)await e.insertInto("contacts").values({session:t,id:a.id,value:JSON.stringify(a)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(a)}))).execute()}))}}))(this.db,this.chatId);this.socket=p.default({logger:this.logger,markOnlineOnConnect:this.options.autoOnline,syncFullHistory:!1,defaultQueryTimeoutMs:void 0,msgRetryCounterCache:new m.default,cachedGroupMetadata:async e=>this.groupCache.get(e),printQRInTerminal:"qr"==this.options.authType,browser:e.Browsers.ubuntu("qr"==this.options.authType?"Zaileys Library":"Firefox"),auth:{creds:t.creds,keys:e.makeCacheableSignalKeyStore(t.keys,this.logger)}}),"pairing"==this.options.authType&&this.options.phoneNumber&&!this.socket?.authState.creds.registered&&setTimeout((async()=>{try{if("pairing"==this.options?.authType){const e=await(this.socket?.requestPairingCode(this.options.phoneNumber.toString()));console.log("🚀 ~ Client.ts:53 ~ Client ~ setTimeout ~ code:",e)}}catch{console.log("Connection failed"),process.exit(1)}}),5e3),this.socket?.ev.on("creds.update",s),i.bind(this.socket?.ev),this.event.setup(this.socket)}on(e,t){this.event.on(e,t)}};module.exports=is;
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import Client from "./classes/Client";
2
- export default Client;
package/dist/index.esm.js DELETED
@@ -1 +0,0 @@
1
- import e,{DisconnectReason as t,Browsers as s,makeCacheableSignalKeyStore as a}from"baileys";import n from"node-cache";import r from"pino";import i from"better-sqlite3";import{mkdirSync as o,writeFileSync as d}from"fs";import{Kysely as c,SqliteDialect as u,MysqlDialect as l,PostgresDialect as h}from"kysely";import p from"mysql2";import m from"path";import{Pool as f}from"pg";import{URL as y}from"url";import{randomBytes as g,randomUUID as v}from"crypto";import{curve as _}from"libsignal";const x=_,b=()=>{const{pubKey:e,privKey:t}=x.generateKeyPair();return{private:Buffer.from(t),public:Buffer.from(e.slice(1))}},k=(e,t)=>{const s=b(),a=(e=>33===e.length?e:Buffer.concat([Buffer.from([5]),e]))(s.public),n=((e,t)=>x.calculateSignature(e,t))(e.private,a);return{keyPair:s,signature:n,keyId:t}},w=e=>"string"==typeof e?parseInt(e,10):e,Z=e=>{const t={...e.fingerprint,deviceIndexes:Array.isArray(e.fingerprint.deviceIndexes)?e.fingerprint.deviceIndexes:[]},s={keyData:Array.isArray(e.keyData)?e.keyData:new Uint8Array,fingerprint:{rawId:t.rawId||0,currentIndex:t.rawId||0,deviceIndexes:t.deviceIndexes},timestamp:w(e.timestamp)};return"string"==typeof e.keyData&&(s.keyData=(e=>{let t=e.length;if(!t)return new Uint8Array(1);let s=0;for(;--t%4>1&&"="===e.charAt(t);)++s;return new Uint8Array(Math.ceil(3*e.length)/4-s).fill(0)})(e.keyData)),s},T=(e,t)=>"Buffer"===t?.type&&Array.isArray(t?.data)?{type:"Buffer",data:Buffer.from(t?.data).toString("base64")}:t,C=(e,t)=>"Buffer"===t?.type?Buffer.from(t?.data,"base64"):t,N=async(e,t)=>{const s="auth";await(async e=>{await e.schema.createTable("auth").ifNotExists().addColumn("session","varchar(50)",(e=>e.notNull())).addColumn("id","varchar(80)",(e=>e.notNull())).addColumn("value","text",(e=>e.defaultTo(null))).addUniqueConstraint("auth_session_id_unique",["session","id"]).execute(),await e.schema.createTable("chats").ifNotExists().addColumn("session","varchar(50)",(e=>e.notNull())).addColumn("id","varchar(80)",(e=>e.notNull())).addColumn("value","text",(e=>e.defaultTo(null))).addUniqueConstraint("chats_session_id_unique",["session","id"]).execute(),await e.schema.createTable("contacts").ifNotExists().addColumn("session","varchar(50)",(e=>e.notNull())).addColumn("id","varchar(80)",(e=>e.notNull())).addColumn("value","text",(e=>e.defaultTo(null))).addUniqueConstraint("contacts_session_id_unique",["session","id"]).execute(),await e.schema.createTable("messages").ifNotExists().addColumn("session","varchar(50)",(e=>e.notNull())).addColumn("id","varchar(80)",(e=>e.notNull())).addColumn("value","text",(e=>e.defaultTo(null))).addUniqueConstraint("messages_session_id_unique",["session","id"]).execute(),await e.schema.createIndex("auth_session_idx").ifNotExists().on("auth").column("session").execute(),await e.schema.createIndex("auth_id_idx").ifNotExists().on("auth").column("id").execute(),await e.schema.createIndex("chats_session_idx").ifNotExists().on("chats").column("session").execute(),await e.schema.createIndex("chats_id_idx").ifNotExists().on("chats").column("id").execute(),await e.schema.createIndex("contacts_session_idx").ifNotExists().on("contacts").column("session").execute(),await e.schema.createIndex("contacts_id_idx").ifNotExists().on("contacts").column("id").execute(),await e.schema.createIndex("messages_session_idx").ifNotExists().on("messages").column("session").execute(),await e.schema.createIndex("messages_id_idx").ifNotExists().on("messages").column("id").execute()})(e);const a=async e=>{for(let t=0;t<10;t++)try{return await e()}catch{await new Promise((e=>setTimeout(e,200)))}throw new Error("Max retries reached")},n=async n=>{const r=await a((()=>e.selectFrom(s).select(["value"]).where("id","=",n).where("session","=",t).executeTakeFirst()));if(!r?.value)return null;const i="object"==typeof r.value?JSON.stringify(r.value):r.value;return JSON.parse(i,C)},r=async(n,r)=>{const i=JSON.stringify(r,T);await a((()=>e.insertInto(s).values({session:t,id:n,value:i}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:i}))).execute()))},i=async n=>{await a((()=>e.deleteFrom(s).where("id","=",n).where("session","=",t).execute()))},o=await n("creds")||(()=>{const e=b();return{noiseKey:b(),pairingEphemeralKeyPair:b(),signedIdentityKey:e,signedPreKey:k(e,1),registrationId:16383&Uint16Array.from(g(2))[0],advSecretKey:g(32).toString("base64"),processedHistoryMessages:[],nextPreKeyId:1,firstUnuploadedPreKeyId:1,accountSyncCounter:0,accountSettings:{unarchiveChats:!1},deviceId:Buffer.from(v().replace(/-/g,""),"hex").toString("base64url"),phoneId:v(),identityId:g(20),backupToken:g(20),registered:!1,registration:{},pairingCode:void 0,lastPropHash:void 0,routingInfo:void 0}})();return{state:{creds:o,keys:{get:async(e,t)=>{const s={};for(const a of t){let t=await n(`${e}-${a}`);"app-state-sync-key"===e&&t&&(t=Z(t)),s[a]=t}return s},set:async e=>{for(const t in e)for(const s in e[t]){const a=e[t][s],n=`${t}-${s}`;a?await r(n,a):await i(n)}}}},saveCreds:async()=>{await r("creds",o)},clear:async()=>{await(async()=>{await a((()=>e.deleteFrom(s).where("session","=",t).where("id","!=","creds").execute()))})()},removeCreds:async()=>{await(async()=>{await a((()=>e.deleteFrom(s).where("session","=",t).execute()))})()}}};var O,S,I;(S=O||(O={})).assertEqual=e=>e,S.assertIs=function(e){},S.assertNever=function(e){throw new Error},S.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},S.getValidEnumValues=e=>{const t=S.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),s={};for(const a of t)s[a]=e[a];return S.objectValues(s)},S.objectValues=e=>S.objectKeys(e).map((function(t){return e[t]})),S.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},S.find=(e,t)=>{for(const s of e)if(t(s))return s},S.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,S.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},S.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(I||(I={})).mergeShapes=(e,t)=>({...e,...t});const A=O.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),E=e=>{switch(typeof e){case"undefined":return A.undefined;case"string":return A.string;case"number":return isNaN(e)?A.nan:A.number;case"boolean":return A.boolean;case"function":return A.function;case"bigint":return A.bigint;case"symbol":return A.symbol;case"object":return Array.isArray(e)?A.array:null===e?A.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?A.promise:typeof Map<"u"&&e instanceof Map?A.map:typeof Set<"u"&&e instanceof Set?A.set:typeof Date<"u"&&e instanceof Date?A.date:A.object;default:return A.unknown}},j=O.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 P extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};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(e){return e.message},s={_errors:[]},a=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)s._errors.push(t(n));else{let e=s,a=0;for(;a<n.path.length;){const s=n.path[a];a===n.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(n))):e[s]=e[s]||{_errors:[]},e=e[s],a++}}};return a(this),s}static assert(e){if(!(e instanceof P))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,O.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},s=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}P.create=e=>new P(e);const R=(e,t)=>{let s;switch(e.code){case j.invalid_type:s=e.received===A.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case j.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,O.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:s=`Unrecognized key(s) in object: ${O.joinValues(e.keys,", ")}`;break;case j.invalid_union:s="Invalid input";break;case j.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${O.joinValues(e.options)}`;break;case j.invalid_enum_value:s=`Invalid enum value. Expected ${O.joinValues(e.options)}, received '${e.received}'`;break;case j.invalid_arguments:s="Invalid function arguments";break;case j.invalid_return_type:s="Invalid function return type";break;case j.invalid_date:s="Invalid date";break;case j.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:O.assertNever(e.validation):s="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case j.too_small:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case j.too_big:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case j.custom:s="Invalid input";break;case j.invalid_intersection_types:s="Intersection results could not be merged";break;case j.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case j.not_finite:s="Number must be finite";break;default:s=t.defaultError,O.assertNever(e)}return{message:s}};let $=R;function M(){return $}const F=e=>{const{data:t,path:s,errorMaps:a,issueData:n}=e,r=[...s,...n.path||[]],i={...n,path:r};if(void 0!==n.message)return{...n,path:r,message:n.message};let o="";const d=a.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:r,message:o}};function D(e,t){const s=M(),a=F({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s,s===R?void 0:R].filter((e=>!!e))});e.common.issues.push(a)}class U{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if("aborted"===a.status)return L;"dirty"===a.status&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const e of t){const t=await e.key,a=await e.value;s.push({key:t,value:a})}return U.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:t,value:n}=a;if("aborted"===t.status||"aborted"===n.status)return L;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"!==t.value&&(typeof n.value<"u"||a.alwaysSet)&&(s[t.value]=n.value)}return{status:e.value,value:s}}}const L=Object.freeze({status:"aborted"}),z=e=>({status:"dirty",value:e}),q=e=>({status:"valid",value:e}),K=e=>"aborted"===e.status,V=e=>"dirty"===e.status,B=e=>"valid"===e.status,J=e=>typeof Promise<"u"&&e instanceof Promise;function W(e,t,s,a){if("a"===s&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?a:"a"===s?a.call(e):a?a.value:t.get(e)}function H(e,t,s,a,n){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?n.call(e,s):n?n.value=s:t.set(e,s),s}var Y,G,Q;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(Y||(Y={}));class X{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const ee=(e,t)=>{if(B(t))return{success:!0,data:t.value};if(!e.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 P(e.common.issues);return this._error=t,this._error}}};function te(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:a,description:n}=e;if(t&&(s||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(t,n)=>{var r,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:o??n.defaultError}:typeof n.data>"u"?{message:null!==(r=o??a)&&void 0!==r?r:n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:null!==(i=o??s)&&void 0!==i?i:n.defaultError}},description:n}}class se{get description(){return this._def.description}_getType(e){return E(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:E(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new U,ctx:{common:e.parent.common,data:e.data,parsedType:E(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(J(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){var s;const a={common:{issues:[],async:null!==(s=t?.async)&&void 0!==s&&s,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:E(e)},n=this._parseSync({data:e,path:a.path,parent:a});return ee(a,n)}"~validate"(e){var t,s;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:E(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return B(t)?{value:t.value}:{issues:a.common.issues}}catch(e){!(null===(s=null===(t=e?.message)||void 0===t?void 0:t.toLowerCase())||void 0===s)&&s.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then((e=>B(e)?{value:e.value}:{issues:a.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:E(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(J(a)?a:Promise.resolve(a));return ee(s,n)}refine(e,t){const s=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const n=e(t),r=()=>a.addIssue({code:j.custom,...s(t)});return typeof Promise<"u"&&n instanceof Promise?n.then((e=>!!e||(r(),!1))):!!n||(r(),!1)}))}refinement(e,t){return this._refinement(((s,a)=>!!e(s)||(a.addIssue("function"==typeof t?t(s,a):t),!1)))}_refinement(e){return new nt({schema:this,typeName:gt.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:e=>this["~validate"](e)}}optional(){return rt.create(this,this._def)}nullable(){return it.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return De.create(this)}promise(){return at.create(this,this._def)}or(e){return ze.create([this,e],this._def)}and(e){return Be.create(this,e,this._def)}transform(e){return new nt({...te(this._def),schema:this,typeName:gt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ot({...te(this._def),innerType:this,defaultValue:t,typeName:gt.ZodDefault})}brand(){return new lt({typeName:gt.ZodBranded,type:this,...te(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new dt({...te(this._def),innerType:this,catchValue:t,typeName:gt.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ht.create(this,e)}readonly(){return pt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ae=/^c[^\s-]{8,}$/i,ne=/^[0-9a-z]+$/,re=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ie=/^[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,oe=/^[a-z0-9_-]{21}$/i,de=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ce=/^[-+]?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)?)??$/,ue=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let le;const he=/^(?:(?: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])$/,pe=/^(?:(?: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])$/,me=/^(([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]))$/,fe=/^(([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])$/,ye=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ge=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ve="((\\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])))",_e=new RegExp(`^${ve}$`);function xe(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function be(e){return new RegExp(`^${xe(e)}$`)}function ke(e){let t=`${ve}T${xe(e)}`;const s=[];return s.push(e.local?"Z?":"Z"),e.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function we(e,t){return!(("v4"!==t&&t||!he.test(e))&&("v6"!==t&&t||!me.test(e)))}function Ze(e,t){if(!de.test(e))return!1;try{const[s]=e.split("."),a=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),n=JSON.parse(atob(a));return!("object"!=typeof n||null===n||!n.typ||!n.alg||t&&n.alg!==t)}catch{return!1}}function Te(e,t){return!(("v4"!==t&&t||!pe.test(e))&&("v6"!==t&&t||!fe.test(e)))}class Ce extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==A.string){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.string,received:t.parsedType}),L}const t=new U;let s;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),D(s,{code:j.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),D(s,{code:j.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const n=e.data.length>a.value,r=e.data.length<a.value;(n||r)&&(s=this._getOrReturnCtx(e,s),n?D(s,{code:j.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):r&&D(s,{code:j.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)ue.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"email",code:j.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)le||(le=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),le.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"emoji",code:j.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)ie.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"uuid",code:j.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)oe.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"nanoid",code:j.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)ae.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"cuid",code:j.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)ne.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"cuid2",code:j.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)re.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"ulid",code:j.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),D(s,{validation:"url",code:j.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"regex",code:j.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),D(s,{code:j.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),D(s,{code:j.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),D(s,{code:j.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?ke(a).test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:j.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?_e.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:j.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?be(a).test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:j.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?ce.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"duration",code:j.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?we(e.data,a.version)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"ip",code:j.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?Ze(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"jwt",code:j.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?Te(e.data,a.version)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"cidr",code:j.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?ye.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"base64",code:j.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?ge.test(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{validation:"base64url",code:j.invalid_string,message:a.message}),t.dirty()):O.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement((t=>e.test(t)),{validation:t,code:j.invalid_string,...Y.errToObj(s)})}_addCheck(e){return new Ce({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Y.errToObj(e)})}datetime(e){var t,s;return"string"==typeof e?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:null!==(t=e?.offset)&&void 0!==t&&t,local:null!==(s=e?.local)&&void 0!==s&&s,...Y.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Y.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Y.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Y.errToObj(t)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new Ce({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ce({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ce({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Ne(e,t){const s=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=s>a?s:a;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}Ce.create=e=>{var t;return new Ce({checks:[],typeName:gt.ZodString,coerce:null!==(t=e?.coerce)&&void 0!==t&&t,...te(e)})};class Oe extends se{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)!==A.number){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.number,received:t.parsedType}),L}let t;const s=new U;for(const a of this._def.checks)"int"===a.kind?O.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),D(t,{code:j.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),D(t,{code:j.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),D(t,{code:j.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):"multipleOf"===a.kind?0!==Ne(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),D(t,{code:j.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),D(t,{code:j.not_finite,message:a.message}),s.dirty()):O.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,s,a){return new Oe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Y.toString(a)}]})}_addCheck(e){return new Oe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&O.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Oe.create=e=>new Oe({checks:[],typeName:gt.ZodNumber,coerce:e?.coerce||!1,...te(e)});class Se extends se{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)!==A.bigint)return this._getInvalidInput(e);let t;const s=new U;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),D(t,{code:j.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),D(t,{code:j.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),D(t,{code:j.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):O.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.bigint,received:t.parsedType}),L}gte(e,t){return this.setLimit("min",e,!0,Y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Y.toString(t))}setLimit(e,t,s,a){return new Se({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Y.toString(a)}]})}_addCheck(e){return new Se({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Se.create=e=>{var t;return new Se({checks:[],typeName:gt.ZodBigInt,coerce:null!==(t=e?.coerce)&&void 0!==t&&t,...te(e)})};class Ie extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==A.boolean){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.boolean,received:t.parsedType}),L}return q(e.data)}}Ie.create=e=>new Ie({typeName:gt.ZodBoolean,coerce:e?.coerce||!1,...te(e)});class Ae extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==A.date){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.date,received:t.parsedType}),L}if(isNaN(e.data.getTime())){return D(this._getOrReturnCtx(e),{code:j.invalid_date}),L}const t=new U;let s;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),D(s,{code:j.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),D(s,{code:j.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):O.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ae({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Ae.create=e=>new Ae({checks:[],coerce:e?.coerce||!1,typeName:gt.ZodDate,...te(e)});class Ee extends se{_parse(e){if(this._getType(e)!==A.symbol){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.symbol,received:t.parsedType}),L}return q(e.data)}}Ee.create=e=>new Ee({typeName:gt.ZodSymbol,...te(e)});class je extends se{_parse(e){if(this._getType(e)!==A.undefined){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.undefined,received:t.parsedType}),L}return q(e.data)}}je.create=e=>new je({typeName:gt.ZodUndefined,...te(e)});class Pe extends se{_parse(e){if(this._getType(e)!==A.null){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.null,received:t.parsedType}),L}return q(e.data)}}Pe.create=e=>new Pe({typeName:gt.ZodNull,...te(e)});class Re extends se{constructor(){super(...arguments),this._any=!0}_parse(e){return q(e.data)}}Re.create=e=>new Re({typeName:gt.ZodAny,...te(e)});class $e extends se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return q(e.data)}}$e.create=e=>new $e({typeName:gt.ZodUnknown,...te(e)});class Me extends se{_parse(e){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.never,received:t.parsedType}),L}}Me.create=e=>new Me({typeName:gt.ZodNever,...te(e)});class Fe extends se{_parse(e){if(this._getType(e)!==A.undefined){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.void,received:t.parsedType}),L}return q(e.data)}}Fe.create=e=>new Fe({typeName:gt.ZodVoid,...te(e)});class De extends se{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==A.array)return D(t,{code:j.invalid_type,expected:A.array,received:t.parsedType}),L;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,n=t.data.length<a.exactLength.value;(e||n)&&(D(t,{code:e?j.too_big:j.too_small,minimum:n?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(D(t,{code:j.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(D(t,{code:j.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map(((e,s)=>a.type._parseAsync(new X(t,e,t.path,s))))).then((e=>U.mergeArray(s,e)));const n=[...t.data].map(((e,s)=>a.type._parseSync(new X(t,e,t.path,s))));return U.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new De({...this._def,minLength:{value:e,message:Y.toString(t)}})}max(e,t){return new De({...this._def,maxLength:{value:e,message:Y.toString(t)}})}length(e,t){return new De({...this._def,exactLength:{value:e,message:Y.toString(t)}})}nonempty(e){return this.min(1,e)}}function Ue(e){if(e instanceof Le){const t={};for(const s in e.shape){const a=e.shape[s];t[s]=rt.create(Ue(a))}return new Le({...e._def,shape:()=>t})}return e instanceof De?new De({...e._def,type:Ue(e.element)}):e instanceof rt?rt.create(Ue(e.unwrap())):e instanceof it?it.create(Ue(e.unwrap())):e instanceof Je?Je.create(e.items.map((e=>Ue(e)))):e}De.create=(e,t)=>new De({type:e,minLength:null,maxLength:null,exactLength:null,typeName:gt.ZodArray,...te(t)});class Le extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=O.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==A.object){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.object,received:t.parsedType}),L}const{status:t,ctx:s}=this._processInputParams(e),{shape:a,keys:n}=this._getCached(),r=[];if(!(this._def.catchall instanceof Me&&"strip"===this._def.unknownKeys))for(const e in s.data)n.includes(e)||r.push(e);const i=[];for(const e of n){const t=a[e],n=s.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new X(s,n,s.path,e)),alwaysSet:e in s.data})}if(this._def.catchall instanceof Me){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)i.push({key:{status:"valid",value:e},value:{status:"valid",value:s.data[e]}});else if("strict"===e)r.length>0&&(D(s,{code:j.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=s.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new X(s,a,s.path,t)),alwaysSet:t in s.data})}}return s.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of i){const s=await t.key,a=await t.value;e.push({key:s,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>U.mergeObjectSync(t,e))):U.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return new Le({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{var a,n,r,i;const o=null!==(r=null===(n=(a=this._def).errorMap)||void 0===n?void 0:n.call(a,t,s).message)&&void 0!==r?r:s.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=Y.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new Le({...this._def,unknownKeys:"strip"})}passthrough(){return new Le({...this._def,unknownKeys:"passthrough"})}extend(e){return new Le({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Le({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:gt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Le({...this._def,catchall:e})}pick(e){const t={};return O.objectKeys(e).forEach((s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])})),new Le({...this._def,shape:()=>t})}omit(e){const t={};return O.objectKeys(this.shape).forEach((s=>{e[s]||(t[s]=this.shape[s])})),new Le({...this._def,shape:()=>t})}deepPartial(){return Ue(this)}partial(e){const t={};return O.objectKeys(this.shape).forEach((s=>{const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()})),new Le({...this._def,shape:()=>t})}required(e){const t={};return O.objectKeys(this.shape).forEach((s=>{if(e&&!e[s])t[s]=this.shape[s];else{let e=this.shape[s];for(;e instanceof rt;)e=e._def.innerType;t[s]=e}})),new Le({...this._def,shape:()=>t})}keyof(){return et(O.objectKeys(this.shape))}}Le.create=(e,t)=>new Le({shape:()=>e,unknownKeys:"strip",catchall:Me.create(),typeName:gt.ZodObject,...te(t)}),Le.strictCreate=(e,t)=>new Le({shape:()=>e,unknownKeys:"strict",catchall:Me.create(),typeName:gt.ZodObject,...te(t)}),Le.lazycreate=(e,t)=>new Le({shape:e,unknownKeys:"strip",catchall:Me.create(),typeName:gt.ZodObject,...te(t)});class ze extends se{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map((async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const s=e.map((e=>new P(e.ctx.common.issues)));return D(t,{code:j.invalid_union,unionErrors:s}),L}));{let e;const a=[];for(const n of s){const s={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:s});if("valid"===r.status)return r;"dirty"===r.status&&!e&&(e={result:r,ctx:s}),s.common.issues.length&&a.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=a.map((e=>new P(e)));return D(t,{code:j.invalid_union,unionErrors:n}),L}}get options(){return this._def.options}}ze.create=(e,t)=>new ze({options:e,typeName:gt.ZodUnion,...te(t)});const qe=e=>e instanceof Qe?qe(e.schema):e instanceof nt?qe(e.innerType()):e instanceof Xe?[e.value]:e instanceof tt?e.options:e instanceof st?O.objectValues(e.enum):e instanceof ot?qe(e._def.innerType):e instanceof je?[void 0]:e instanceof Pe?[null]:e instanceof rt?[void 0,...qe(e.unwrap())]:e instanceof it?[null,...qe(e.unwrap())]:e instanceof lt||e instanceof pt?qe(e.unwrap()):e instanceof dt?qe(e._def.innerType):[];class Ke extends se{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==A.object)return D(t,{code:j.invalid_type,expected:A.object,received:t.parsedType}),L;const s=this.discriminator,a=t.data[s],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(D(t,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),L)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const s of t){const t=qe(s.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(a.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);a.set(n,s)}}return new Ke({typeName:gt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...te(s)})}}function Ve(e,t){const s=E(e),a=E(t);if(e===t)return{valid:!0,data:e};if(s===A.object&&a===A.object){const s=O.objectKeys(t),a=O.objectKeys(e).filter((e=>-1!==s.indexOf(e))),n={...e,...t};for(const s of a){const a=Ve(e[s],t[s]);if(!a.valid)return{valid:!1};n[s]=a.data}return{valid:!0,data:n}}if(s===A.array&&a===A.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let a=0;a<e.length;a++){const n=Ve(e[a],t[a]);if(!n.valid)return{valid:!1};s.push(n.data)}return{valid:!0,data:s}}return s===A.date&&a===A.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Be extends se{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(e,a)=>{if(K(e)||K(a))return L;const n=Ve(e.value,a.value);return n.valid?((V(e)||V(a))&&t.dirty(),{status:t.value,value:n.data}):(D(s,{code:j.invalid_intersection_types}),L)};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((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Be.create=(e,t,s)=>new Be({left:e,right:t,typeName:gt.ZodIntersection,...te(s)});class Je extends se{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==A.array)return D(s,{code:j.invalid_type,expected:A.array,received:s.parsedType}),L;if(s.data.length<this._def.items.length)return D(s,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),L;!this._def.rest&&s.data.length>this._def.items.length&&(D(s,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new X(s,e,s.path,t)):null})).filter((e=>!!e));return s.common.async?Promise.all(a).then((e=>U.mergeArray(t,e))):U.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Je({...this._def,rest:e})}}Je.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Je({items:e,typeName:gt.ZodTuple,rest:null,...te(t)})};class We extends se{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!==A.object)return D(s,{code:j.invalid_type,expected:A.object,received:s.parsedType}),L;const a=[],n=this._def.keyType,r=this._def.valueType;for(const e in s.data)a.push({key:n._parse(new X(s,e,s.path,e)),value:r._parse(new X(s,s.data[e],s.path,e)),alwaysSet:e in s.data});return s.common.async?U.mergeObjectAsync(t,a):U.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return new We(t instanceof se?{keyType:e,valueType:t,typeName:gt.ZodRecord,...te(s)}:{keyType:Ce.create(),valueType:e,typeName:gt.ZodRecord,...te(t)})}}class He extends se{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!==A.map)return D(s,{code:j.invalid_type,expected:A.map,received:s.parsedType}),L;const a=this._def.keyType,n=this._def.valueType,r=[...s.data.entries()].map((([e,t],r)=>({key:a._parse(new X(s,e,s.path,[r,"key"])),value:n._parse(new X(s,t,s.path,[r,"value"]))})));if(s.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const s of r){const a=await s.key,n=await s.value;if("aborted"===a.status||"aborted"===n.status)return L;("dirty"===a.status||"dirty"===n.status)&&t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const s of r){const a=s.key,n=s.value;if("aborted"===a.status||"aborted"===n.status)return L;("dirty"===a.status||"dirty"===n.status)&&t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}He.create=(e,t,s)=>new He({valueType:t,keyType:e,typeName:gt.ZodMap,...te(s)});class Ye extends se{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==A.set)return D(s,{code:j.invalid_type,expected:A.set,received:s.parsedType}),L;const a=this._def;null!==a.minSize&&s.data.size<a.minSize.value&&(D(s,{code:j.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&s.data.size>a.maxSize.value&&(D(s,{code:j.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function r(e){const s=new Set;for(const a of e){if("aborted"===a.status)return L;"dirty"===a.status&&t.dirty(),s.add(a.value)}return{status:t.value,value:s}}const i=[...s.data.values()].map(((e,t)=>n._parse(new X(s,e,s.path,t))));return s.common.async?Promise.all(i).then((e=>r(e))):r(i)}min(e,t){return new Ye({...this._def,minSize:{value:e,message:Y.toString(t)}})}max(e,t){return new Ye({...this._def,maxSize:{value:e,message:Y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ye.create=(e,t)=>new Ye({valueType:e,minSize:null,maxSize:null,typeName:gt.ZodSet,...te(t)});class Ge extends se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==A.function)return D(t,{code:j.invalid_type,expected:A.function,received:t.parsedType}),L;function s(e,s){return F({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,M(),R].filter((e=>!!e)),issueData:{code:j.invalid_arguments,argumentsError:s}})}function a(e,s){return F({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,M(),R].filter((e=>!!e)),issueData:{code:j.invalid_return_type,returnTypeError:s}})}const n={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof at){const e=this;return q((async function(...t){const i=new P([]),o=await e._def.args.parseAsync(t,n).catch((e=>{throw i.addIssue(s(t,e)),i})),d=await Reflect.apply(r,this,o);return await e._def.returns._def.type.parseAsync(d,n).catch((e=>{throw i.addIssue(a(d,e)),i}))}))}{const e=this;return q((function(...t){const i=e._def.args.safeParse(t,n);if(!i.success)throw new P([s(t,i.error)]);const o=Reflect.apply(r,this,i.data),d=e._def.returns.safeParse(o,n);if(!d.success)throw new P([a(o,d.error)]);return d.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ge({...this._def,args:Je.create(e).rest($e.create())})}returns(e){return new Ge({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new Ge({args:e||Je.create([]).rest($e.create()),returns:t||$e.create(),typeName:gt.ZodFunction,...te(s)})}}class Qe extends se{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})}}Qe.create=(e,t)=>new Qe({getter:e,typeName:gt.ZodLazy,...te(t)});class Xe extends se{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return D(t,{received:t.data,code:j.invalid_literal,expected:this._def.value}),L}return{status:"valid",value:e.data}}get value(){return this._def.value}}function et(e,t){return new tt({values:e,typeName:gt.ZodEnum,...te(t)})}Xe.create=(e,t)=>new Xe({value:e,typeName:gt.ZodLiteral,...te(t)});class tt extends se{constructor(){super(...arguments),G.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),s=this._def.values;return D(t,{expected:O.joinValues(s),received:t.parsedType,code:j.invalid_type}),L}if(W(this,G,"f")||H(this,G,new Set(this._def.values),"f"),!W(this,G,"f").has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return D(t,{received:t.data,code:j.invalid_enum_value,options:s}),L}return q(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 tt.create(e,{...this._def,...t})}exclude(e,t=this._def){return tt.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}G=new WeakMap,tt.create=et;class st extends se{constructor(){super(...arguments),Q.set(this,void 0)}_parse(e){const t=O.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==A.string&&s.parsedType!==A.number){const e=O.objectValues(t);return D(s,{expected:O.joinValues(e),received:s.parsedType,code:j.invalid_type}),L}if(W(this,Q,"f")||H(this,Q,new Set(O.getValidEnumValues(this._def.values)),"f"),!W(this,Q,"f").has(e.data)){const e=O.objectValues(t);return D(s,{received:s.data,code:j.invalid_enum_value,options:e}),L}return q(e.data)}get enum(){return this._def.values}}Q=new WeakMap,st.create=(e,t)=>new st({values:e,typeName:gt.ZodNativeEnum,...te(t)});class at extends se{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==A.promise&&!1===t.common.async)return D(t,{code:j.invalid_type,expected:A.promise,received:t.parsedType}),L;const s=t.parsedType===A.promise?t.data:Promise.resolve(t.data);return q(s.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}at.create=(e,t)=>new at({type:e,typeName:gt.ZodPromise,...te(t)});class nt extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===gt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:e=>{D(s,e),e.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===a.type){const e=a.transform(s.data,n);if(s.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return L;const a=await this._def.schema._parseAsync({data:e,path:s.path,parent:s});return"aborted"===a.status?L:"dirty"===a.status||"dirty"===t.value?z(a.value):a}));{if("aborted"===t.value)return L;const a=this._def.schema._parseSync({data:e,path:s.path,parent:s});return"aborted"===a.status?L:"dirty"===a.status||"dirty"===t.value?z(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,n);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===a.status?L:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((s=>"aborted"===s.status?L:("dirty"===s.status&&t.dirty(),e(s.value).then((()=>({status:t.value,value:s.value}))))))}if("transform"===a.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!B(e))return e;const r=a.transform(e.value,n);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>B(e)?Promise.resolve(a.transform(e.value,n)).then((e=>({status:t.value,value:e}))):e))}O.assertNever(a)}}nt.create=(e,t,s)=>new nt({schema:e,typeName:gt.ZodEffects,effect:t,...te(s)}),nt.createWithPreprocess=(e,t,s)=>new nt({schema:t,effect:{type:"preprocess",transform:e},typeName:gt.ZodEffects,...te(s)});class rt extends se{_parse(e){return this._getType(e)===A.undefined?q(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rt.create=(e,t)=>new rt({innerType:e,typeName:gt.ZodOptional,...te(t)});class it extends se{_parse(e){return this._getType(e)===A.null?q(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}it.create=(e,t)=>new it({innerType:e,typeName:gt.ZodNullable,...te(t)});class ot extends se{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===A.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ot.create=(e,t)=>new ot({innerType:e,typeName:gt.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...te(t)});class dt extends se{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return J(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new P(s.common.issues)},input:s.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new P(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}dt.create=(e,t)=>new dt({innerType:e,typeName:gt.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...te(t)});class ct extends se{_parse(e){if(this._getType(e)!==A.nan){const t=this._getOrReturnCtx(e);return D(t,{code:j.invalid_type,expected:A.nan,received:t.parsedType}),L}return{status:"valid",value:e.data}}}ct.create=e=>new ct({typeName:gt.ZodNaN,...te(e)});const ut=Symbol("zod_brand");class lt extends se{_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 ht extends se{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?L:"dirty"===e.status?(t.dirty(),z(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})();{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?L:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new ht({in:e,out:t,typeName:gt.ZodPipeline})}}class pt extends se{_parse(e){const t=this._def.innerType._parse(e),s=e=>(B(e)&&(e.value=Object.freeze(e.value)),e);return J(t)?t.then((e=>s(e))):s(t)}unwrap(){return this._def.innerType}}function mt(e,t){const s="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof s?{message:s}:s}function ft(e,t={},s){return e?Re.create().superRefine(((a,n)=>{var r,i;const o=e(a);if(o instanceof Promise)return o.then((e=>{var r,i;if(!e){const e=mt(t,a),o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:s)||void 0===i||i;n.addIssue({code:"custom",...e,fatal:o})}}));if(!o){const e=mt(t,a),o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:s)||void 0===i||i;n.addIssue({code:"custom",...e,fatal:o})}})):Re.create()}pt.create=(e,t)=>new pt({innerType:e,typeName:gt.ZodReadonly,...te(t)});const yt={object:Le.lazycreate};var gt;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(gt||(gt={}));const vt=Ce.create,_t=Oe.create,xt=ct.create,bt=Se.create,kt=Ie.create,wt=Ae.create,Zt=Ee.create,Tt=je.create,Ct=Pe.create,Nt=Re.create,Ot=$e.create,St=Me.create,It=Fe.create,At=De.create,Et=Le.create,jt=Le.strictCreate,Pt=ze.create,Rt=Ke.create,$t=Be.create,Mt=Je.create,Ft=We.create,Dt=He.create,Ut=Ye.create,Lt=Ge.create,zt=Qe.create,qt=Xe.create,Kt=tt.create,Vt=st.create,Bt=at.create,Jt=nt.create,Wt=rt.create,Ht=it.create,Yt=nt.createWithPreprocess,Gt=ht.create,Qt={string:e=>Ce.create({...e,coerce:!0}),number:e=>Oe.create({...e,coerce:!0}),boolean:e=>Ie.create({...e,coerce:!0}),bigint:e=>Se.create({...e,coerce:!0}),date:e=>Ae.create({...e,coerce:!0})},Xt=L;var es=Object.freeze({__proto__:null,defaultErrorMap:R,setErrorMap:function(e){$=e},getErrorMap:M,makeIssue:F,EMPTY_PATH:[],addIssueToContext:D,ParseStatus:U,INVALID:L,DIRTY:z,OK:q,isAborted:K,isDirty:V,isValid:B,isAsync:J,get util(){return O},get objectUtil(){return I},ZodParsedType:A,getParsedType:E,ZodType:se,datetimeRegex:ke,ZodString:Ce,ZodNumber:Oe,ZodBigInt:Se,ZodBoolean:Ie,ZodDate:Ae,ZodSymbol:Ee,ZodUndefined:je,ZodNull:Pe,ZodAny:Re,ZodUnknown:$e,ZodNever:Me,ZodVoid:Fe,ZodArray:De,ZodObject:Le,ZodUnion:ze,ZodDiscriminatedUnion:Ke,ZodIntersection:Be,ZodTuple:Je,ZodRecord:We,ZodMap:He,ZodSet:Ye,ZodFunction:Ge,ZodLazy:Qe,ZodLiteral:Xe,ZodEnum:tt,ZodNativeEnum:st,ZodPromise:at,ZodEffects:nt,ZodTransformer:nt,ZodOptional:rt,ZodNullable:it,ZodDefault:ot,ZodCatch:dt,ZodNaN:ct,BRAND:ut,ZodBranded:lt,ZodPipeline:ht,ZodReadonly:pt,custom:ft,Schema:se,ZodSchema:se,late:yt,get ZodFirstPartyTypeKind(){return gt},coerce:Qt,any:Nt,array:At,bigint:bt,boolean:kt,date:wt,discriminatedUnion:Rt,effect:Jt,enum:Kt,function:Lt,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>ft((t=>t instanceof e),t),intersection:$t,lazy:zt,literal:qt,map:Dt,nan:xt,nativeEnum:Vt,never:St,null:Ct,nullable:Ht,number:_t,object:Et,oboolean:()=>kt().optional(),onumber:()=>_t().optional(),optional:Wt,ostring:()=>vt().optional(),pipeline:Gt,preprocess:Yt,promise:Bt,record:Ft,set:Ut,strictObject:jt,string:vt,symbol:Zt,transformer:Jt,tuple:Mt,undefined:Tt,union:Pt,unknown:Ot,void:It,NEVER:Xt,ZodIssueCode:j,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:P});const ts=es.object({type:es.enum(["sqlite","postgresql","mysql"]).default("sqlite"),connection:es.object({url:es.string().default("./zaileys.db")}).optional().default({})}).optional().default({}),ss={prefix:es.string().optional(),ignoreMe:es.boolean().optional().default(!0),showLogs:es.boolean().optional().default(!0),autoMentions:es.boolean().optional().default(!0),autoOnline:es.boolean().optional().default(!0),autoRead:es.boolean().optional().default(!0),autoRejectCall:es.boolean().optional().default(!0),database:ts,citation:es.record(es.function().returns(es.union([es.number().array(),es.promise(es.number().array())]))).optional().transform((async e=>{const t={};if(e)for(const s of Object.keys(e)){const a=`is${s.charAt(0).toUpperCase()+s.slice(1)}`,n=await e[s]();t[a]=n}return t}))},as=es.object({authType:es.literal("pairing"),phoneNumber:es.number(),...ss}),ns=es.object({authType:es.literal("qr"),phoneNumber:es.undefined().optional(),...ss}),rs=es.discriminatedUnion("authType",[as,ns]);var is=class{client;events=new Map;constructor(e){this.client=e}setup(e){e.ev.on("connection.update",(async e=>{const{connection:s,lastDisconnect:a,qr:n}=e;if(this.emit("connection",{status:s||"connecting"}),"qr"==this.client.options?.authType&&n&&console.log("Scan qrcode with your whatsapp: "),"close"===s){const e=a?.error?.output?.statusCode,s=e!==t.loggedOut;if(console.log(a?.error?.message),401==e||405==e||500==e)return;s&&await this.client.initialize()}else"open"===s&&this.emit("connection",{status:"open"})})),e.ev.on("messages.upsert",(({messages:e})=>{this.emit("messages",e)})),e.ev.on("call",(e=>{this.emit("call",e)}))}on(e,t){this.events.has(e)||this.events.set(e,[]),this.events.get(e).push(t)}emit(e,t){(this.events.get(e)||[]).forEach((e=>e(t)))}};var os=class{props;options;chatId="zaileys-chats";logger=r({level:"silent",enabled:!1});event;db;socket;groupCache=new n({stdTTL:300,useClones:!1});constructor(e){this.props=e,this.initialize(),this.event=new is(this)}async initialize(){this.options=await rs.parseAsync(this.props),this.db=((e,t)=>{if("sqlite"===e){const e=t||"./db/zaileys.db",s=m.resolve(e);return o(m.dirname(s),{recursive:!0}),d(s,"",{flag:"a"}),new c({dialect:new u({database:new i(s)})})}const s=new y(t),a=s.protocol.replace(":","");if("mysql"===e)return new c({dialect:new l({pool:p.createPool({host:s.hostname,user:s.username,password:s.password,database:s.pathname.replace("/",""),port:parseInt(s.port||"3306",10)})})});if("postgresql"===e)return new c({dialect:new h({pool:new f({host:s.hostname,user:s.username,password:s.password,database:s.pathname.replace("/",""),port:parseInt(s.port||"5432",10)})})});throw new Error(`Unsupported database protocol: ${a}`)})(this.options.database.type,this.options.database.connection.url);const{state:t,saveCreds:r,removeCreds:g}=await N(this.db,this.chatId),v=await(async(e,t)=>({bind:s=>{s.on("messaging-history.set",(async s=>{const{chats:a,contacts:n,messages:r}=s;for(const s of a)await e.insertInto("chats").values({session:t,id:s.id,value:JSON.stringify(s)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(s)}))).execute();for(const s of n)await e.insertInto("contacts").values({session:t,id:s.id,value:JSON.stringify(s)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(s)}))).execute();for(const s of r)await e.insertInto("messages").values({session:t,id:s.key.id,value:JSON.stringify(s)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(s)}))).execute()})),s.on("messages.upsert",(async({messages:s})=>{for(const a of s)await e.insertInto("messages").values({session:t,id:a.key.id,value:JSON.stringify(a)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(a)}))).execute()})),s.on("chats.upsert",(async s=>{for(const a of s)await e.insertInto("chats").values({session:t,id:a.id,value:JSON.stringify(a)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(a)}))).execute()})),s.on("contacts.upsert",(async s=>{for(const a of s)await e.insertInto("contacts").values({session:t,id:a.id,value:JSON.stringify(a)}).onConflict((e=>e.columns(["session","id"]).doUpdateSet({value:JSON.stringify(a)}))).execute()}))}}))(this.db,this.chatId);this.socket=e({logger:this.logger,markOnlineOnConnect:this.options.autoOnline,syncFullHistory:!1,defaultQueryTimeoutMs:void 0,msgRetryCounterCache:new n,cachedGroupMetadata:async e=>this.groupCache.get(e),printQRInTerminal:"qr"==this.options.authType,browser:s.ubuntu("qr"==this.options.authType?"Zaileys Library":"Firefox"),auth:{creds:t.creds,keys:a(t.keys,this.logger)}}),"pairing"==this.options.authType&&this.options.phoneNumber&&!this.socket?.authState.creds.registered&&setTimeout((async()=>{try{if("pairing"==this.options?.authType){const e=await(this.socket?.requestPairingCode(this.options.phoneNumber.toString()));console.log("🚀 ~ Client.ts:53 ~ Client ~ setTimeout ~ code:",e)}}catch{console.log("Connection failed"),process.exit(1)}}),5e3),this.socket?.ev.on("creds.update",r),v.bind(this.socket?.ev),this.event.setup(this.socket)}on(e,t){this.event.on(e,t)}};export{os as default};
@@ -1,156 +0,0 @@
1
- type Awaitable<T> = T | Promise<T>;
2
- export type AuthAdapterHandlerType = Promise<{
3
- state: AuthenticationState;
4
- saveCreds: () => Promise<void>;
5
- clear: () => Promise<void>;
6
- removeCreds: () => Promise<void>;
7
- }>;
8
- type Contact = {
9
- id: string;
10
- lid?: string;
11
- name?: string;
12
- notify?: string;
13
- verifiedName?: string;
14
- imgUrl?: string | null;
15
- status?: string;
16
- };
17
- type Account = {
18
- details?: Uint8Array | null;
19
- accountSignatureKey?: Uint8Array | null;
20
- accountSignature?: Uint8Array | null;
21
- deviceSignature?: Uint8Array | null;
22
- };
23
- type SignedKeyPair = {
24
- keyPair: KeyPair;
25
- signature: Uint8Array;
26
- keyId: number;
27
- timestampS?: number;
28
- };
29
- type ProtocolAddress = {
30
- name: string;
31
- deviceId: number;
32
- };
33
- type SignalIdentity = {
34
- identifier: ProtocolAddress;
35
- identifierKey: Uint8Array;
36
- };
37
- type LTHashState = {
38
- version: number;
39
- hash: Buffer;
40
- indexValueMap: {
41
- [indexMacBase64: string]: {
42
- valueMac: Uint8Array | Buffer;
43
- };
44
- };
45
- };
46
- type SignalCreds = {
47
- readonly signedIdentityKey: KeyPair;
48
- readonly signedPreKey: SignedKeyPair;
49
- readonly registrationId: number;
50
- };
51
- type AccountSettings = {
52
- unarchiveChats: boolean;
53
- defaultDisappearingMode?: Pick<any, "ephemeralExpiration" | "ephemeralSettingTimestamp">;
54
- };
55
- type SignalKeyStore = {
56
- get<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Awaitable<{
57
- [id: string]: SignalDataTypeMap[T];
58
- }>;
59
- set(data: SignalDataSet): Awaitable<void>;
60
- clear?(): Awaitable<void>;
61
- };
62
- interface RegistrationOptions {
63
- phoneNumber?: string;
64
- phoneNumberCountryCode: string;
65
- phoneNumberNationalNumber: string;
66
- phoneNumberMobileCountryCode: string;
67
- phoneNumberMobileNetworkCode: string;
68
- method?: "sms" | "voice" | "captcha";
69
- captcha?: string;
70
- }
71
- export type SslOptions = {
72
- pfx?: string;
73
- key?: string | string[] | Buffer | Buffer[];
74
- passphrase?: string;
75
- cert?: string | string[] | Buffer | Buffer[];
76
- ca?: string | string[] | Buffer | Buffer[];
77
- crl?: string | string[];
78
- ciphers?: string;
79
- rejectUnauthorized?: boolean;
80
- minVersion?: string;
81
- maxVersion?: string;
82
- verifyIdentity?: boolean;
83
- };
84
- export type Fingerprint = {
85
- rawId: number;
86
- currentIndex: number;
87
- deviceIndexes: number[];
88
- };
89
- export type AppDataSync = {
90
- keyData: Uint8Array;
91
- fingerprint: Fingerprint;
92
- timestamp: Long | number;
93
- };
94
- export type SignalDataTypeMap = {
95
- session: Uint8Array;
96
- "pre-key": KeyPair;
97
- "sender-key": Uint8Array;
98
- "app-state-sync-key": AppDataSync;
99
- "app-state-sync-version": LTHashState;
100
- "sender-key-memory": {
101
- [jid: string]: boolean;
102
- };
103
- };
104
- export type SignalDataSet = {
105
- [T in keyof SignalDataTypeMap]?: {
106
- [id: string]: SignalDataTypeMap[T] | null;
107
- };
108
- };
109
- export type KeyPair = {
110
- public: Uint8Array;
111
- private: Uint8Array;
112
- };
113
- export type sqlData = {
114
- constructor: {
115
- name: "RowDataPacket";
116
- };
117
- value?: object[];
118
- };
119
- export type valueReplacer = {
120
- data: number[];
121
- type: string;
122
- };
123
- export type valueReviver = {
124
- data: string;
125
- type: string;
126
- };
127
- export type AuthenticationState = {
128
- creds: AuthenticationCreds;
129
- keys: SignalKeyStore;
130
- };
131
- export type AuthenticationCreds = SignalCreds & {
132
- readonly noiseKey: KeyPair;
133
- readonly pairingEphemeralKeyPair: KeyPair;
134
- advSecretKey: string;
135
- me?: Contact;
136
- account?: Account;
137
- signalIdentities?: SignalIdentity[];
138
- myAppStateKeyId?: string;
139
- firstUnuploadedPreKeyId: number;
140
- nextPreKeyId: number;
141
- lastAccountSyncTimestamp?: number;
142
- platform?: string;
143
- processedHistoryMessages: Pick<any, "key" | "messageTimestamp">[];
144
- accountSyncCounter: number;
145
- accountSettings: AccountSettings;
146
- deviceId: string;
147
- phoneId: string;
148
- identityId: Buffer;
149
- registered: boolean;
150
- backupToken: Buffer;
151
- registration: RegistrationOptions;
152
- pairingCode: string | undefined;
153
- lastPropHash: string | undefined;
154
- routingInfo: Buffer | undefined;
155
- };
156
- export {};
@@ -1,152 +0,0 @@
1
- import { z } from "zod";
2
- export declare const AdapterDatabaseType: z.ZodDefault<z.ZodOptional<z.ZodObject<{
3
- type: z.ZodDefault<z.ZodEnum<["sqlite", "postgresql", "mysql"]>>;
4
- connection: z.ZodDefault<z.ZodOptional<z.ZodObject<{
5
- url: z.ZodDefault<z.ZodString>;
6
- }, "strip", z.ZodTypeAny, {
7
- url: string;
8
- }, {
9
- url?: string | undefined;
10
- }>>>;
11
- }, "strip", z.ZodTypeAny, {
12
- type: "sqlite" | "postgresql" | "mysql";
13
- connection: {
14
- url: string;
15
- };
16
- }, {
17
- type?: "sqlite" | "postgresql" | "mysql" | undefined;
18
- connection?: {
19
- url?: string | undefined;
20
- } | undefined;
21
- }>>>;
22
- export declare const ClientClassesType: z.ZodDiscriminatedUnion<"authType", [z.ZodObject<{
23
- prefix: z.ZodOptional<z.ZodString>;
24
- ignoreMe: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
25
- showLogs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
26
- autoMentions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
27
- autoOnline: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
28
- autoRead: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
29
- autoRejectCall: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
30
- database: z.ZodDefault<z.ZodOptional<z.ZodObject<{
31
- type: z.ZodDefault<z.ZodEnum<["sqlite", "postgresql", "mysql"]>>;
32
- connection: z.ZodDefault<z.ZodOptional<z.ZodObject<{
33
- url: z.ZodDefault<z.ZodString>;
34
- }, "strip", z.ZodTypeAny, {
35
- url: string;
36
- }, {
37
- url?: string | undefined;
38
- }>>>;
39
- }, "strip", z.ZodTypeAny, {
40
- type: "sqlite" | "postgresql" | "mysql";
41
- connection: {
42
- url: string;
43
- };
44
- }, {
45
- type?: "sqlite" | "postgresql" | "mysql" | undefined;
46
- connection?: {
47
- url?: string | undefined;
48
- } | undefined;
49
- }>>>;
50
- citation: z.ZodEffects<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnion<[z.ZodArray<z.ZodNumber, "many">, z.ZodPromise<z.ZodArray<z.ZodNumber, "many">>]>>>>, Record<string, any>, Record<string, (...args: unknown[]) => number[] | Promise<number[]>> | undefined>;
51
- authType: z.ZodLiteral<"pairing">;
52
- phoneNumber: z.ZodNumber;
53
- }, "strip", z.ZodTypeAny, {
54
- authType: "pairing";
55
- phoneNumber: number;
56
- ignoreMe: boolean;
57
- showLogs: boolean;
58
- autoMentions: boolean;
59
- autoOnline: boolean;
60
- autoRead: boolean;
61
- autoRejectCall: boolean;
62
- database: {
63
- type: "sqlite" | "postgresql" | "mysql";
64
- connection: {
65
- url: string;
66
- };
67
- };
68
- citation: Record<string, any>;
69
- prefix?: string | undefined;
70
- }, {
71
- authType: "pairing";
72
- phoneNumber: number;
73
- prefix?: string | undefined;
74
- ignoreMe?: boolean | undefined;
75
- showLogs?: boolean | undefined;
76
- autoMentions?: boolean | undefined;
77
- autoOnline?: boolean | undefined;
78
- autoRead?: boolean | undefined;
79
- autoRejectCall?: boolean | undefined;
80
- database?: {
81
- type?: "sqlite" | "postgresql" | "mysql" | undefined;
82
- connection?: {
83
- url?: string | undefined;
84
- } | undefined;
85
- } | undefined;
86
- citation?: Record<string, (...args: unknown[]) => number[] | Promise<number[]>> | undefined;
87
- }>, z.ZodObject<{
88
- prefix: z.ZodOptional<z.ZodString>;
89
- ignoreMe: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
90
- showLogs: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
91
- autoMentions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
92
- autoOnline: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
93
- autoRead: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
94
- autoRejectCall: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
95
- database: z.ZodDefault<z.ZodOptional<z.ZodObject<{
96
- type: z.ZodDefault<z.ZodEnum<["sqlite", "postgresql", "mysql"]>>;
97
- connection: z.ZodDefault<z.ZodOptional<z.ZodObject<{
98
- url: z.ZodDefault<z.ZodString>;
99
- }, "strip", z.ZodTypeAny, {
100
- url: string;
101
- }, {
102
- url?: string | undefined;
103
- }>>>;
104
- }, "strip", z.ZodTypeAny, {
105
- type: "sqlite" | "postgresql" | "mysql";
106
- connection: {
107
- url: string;
108
- };
109
- }, {
110
- type?: "sqlite" | "postgresql" | "mysql" | undefined;
111
- connection?: {
112
- url?: string | undefined;
113
- } | undefined;
114
- }>>>;
115
- citation: z.ZodEffects<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnion<[z.ZodArray<z.ZodNumber, "many">, z.ZodPromise<z.ZodArray<z.ZodNumber, "many">>]>>>>, Record<string, any>, Record<string, (...args: unknown[]) => number[] | Promise<number[]>> | undefined>;
116
- authType: z.ZodLiteral<"qr">;
117
- phoneNumber: z.ZodOptional<z.ZodUndefined>;
118
- }, "strip", z.ZodTypeAny, {
119
- authType: "qr";
120
- ignoreMe: boolean;
121
- showLogs: boolean;
122
- autoMentions: boolean;
123
- autoOnline: boolean;
124
- autoRead: boolean;
125
- autoRejectCall: boolean;
126
- database: {
127
- type: "sqlite" | "postgresql" | "mysql";
128
- connection: {
129
- url: string;
130
- };
131
- };
132
- citation: Record<string, any>;
133
- phoneNumber?: undefined;
134
- prefix?: string | undefined;
135
- }, {
136
- authType: "qr";
137
- phoneNumber?: undefined;
138
- prefix?: string | undefined;
139
- ignoreMe?: boolean | undefined;
140
- showLogs?: boolean | undefined;
141
- autoMentions?: boolean | undefined;
142
- autoOnline?: boolean | undefined;
143
- autoRead?: boolean | undefined;
144
- autoRejectCall?: boolean | undefined;
145
- database?: {
146
- type?: "sqlite" | "postgresql" | "mysql" | undefined;
147
- connection?: {
148
- url?: string | undefined;
149
- } | undefined;
150
- } | undefined;
151
- citation?: Record<string, (...args: unknown[]) => number[] | Promise<number[]>> | undefined;
152
- }>]>;
@@ -1,65 +0,0 @@
1
- import { z } from "zod";
2
- declare const EventConnectionType: z.ZodObject<{
3
- status: z.ZodEnum<["connecting", "open", "close"]>;
4
- }, "strip", z.ZodTypeAny, {
5
- status: "connecting" | "open" | "close";
6
- }, {
7
- status: "connecting" | "open" | "close";
8
- }>;
9
- declare const EventMessagesType: z.ZodObject<{
10
- messages: z.ZodObject<{
11
- remoteJid: z.ZodString;
12
- id: z.ZodString;
13
- }, "strip", z.ZodTypeAny, {
14
- id: string;
15
- remoteJid: string;
16
- }, {
17
- id: string;
18
- remoteJid: string;
19
- }>;
20
- }, "strip", z.ZodTypeAny, {
21
- messages: {
22
- id: string;
23
- remoteJid: string;
24
- };
25
- }, {
26
- messages: {
27
- id: string;
28
- remoteJid: string;
29
- };
30
- }>;
31
- declare const EventCallType: z.ZodObject<{
32
- call: z.ZodObject<{
33
- id: z.ZodString;
34
- from: z.ZodString;
35
- timestamp: z.ZodNumber;
36
- }, "strip", z.ZodTypeAny, {
37
- id: string;
38
- timestamp: number;
39
- from: string;
40
- }, {
41
- id: string;
42
- timestamp: number;
43
- from: string;
44
- }>;
45
- }, "strip", z.ZodTypeAny, {
46
- call: {
47
- id: string;
48
- timestamp: number;
49
- from: string;
50
- };
51
- }, {
52
- call: {
53
- id: string;
54
- timestamp: number;
55
- from: string;
56
- };
57
- }>;
58
- declare const EventEnumType: z.ZodEnum<["connection", "messages", "call"]>;
59
- export type EventEnumType = z.infer<typeof EventEnumType>;
60
- export type EventCallbackType = {
61
- connection: (data: z.infer<typeof EventConnectionType>) => void;
62
- messages: (data: z.infer<typeof EventMessagesType>) => void;
63
- call: (data: z.infer<typeof EventCallType>) => void;
64
- };
65
- export {};